Skip to content

Commit

Permalink
Changed alias for ElementTree from etree to ET to reflect current Pyt…
Browse files Browse the repository at this point in the history
…hon docs
  • Loading branch information
Bryant Howell committed Nov 13, 2019
1 parent 184a774 commit dea1dac
Show file tree
Hide file tree
Showing 23 changed files with 300 additions and 335 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ It should never be necessary to use TableauBase by itself.
### 0.4 tableau_exceptions
The tableau_exceptions file defines a variety of Exceptions that are specific to Tableau, particularly the REST API. They are not very complex, and most simply include a msg property that will clarify the problem if logged

### 0.5 ElementTree elements for XML
All XML in tableau_tools is handled through ElementTree. It is aliased

## 1. tableau_rest_api sub-package

Expand Down Expand Up @@ -365,7 +367,7 @@ tableau_tools handles translations between real world names and LUIDs automatica
There are few cases where only the LUID can be accepted. In this case, the parameter will show just "_luid".


#### 1.2.2 Plural querying methods and converting to name : luid dicts
#### 1.2.2 Plural querying methods and converting to { name : luid} Dict
The simplest method for getting information from the REST API are the "plural" querying methods

`TableauRestApiConnection.query_groups()`
Expand Down
10 changes: 5 additions & 5 deletions tableau_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re

from io import StringIO
import xml.etree.cElementTree as etree
import xml.etree.ElementTree as ET


class TableauBase(object):
Expand All @@ -20,7 +20,7 @@ def __init__(self):
self.tableau_namespace = 'http://tableau.com/api'
self.ns_map = {'t': 'http://tableau.com/api'}
self.ns_prefix = '{' + self.ns_map['t'] + '}'
etree.register_namespace('t', self.ns_map['t'])
ET.register_namespace('t', self.ns_map['t'])

self.site_roles = (
'Interactor',
Expand Down Expand Up @@ -444,13 +444,13 @@ def convert_view_content_url_to_embed_url(content_url):

# Generic method for XML lists for the "query" actions to name -> id dict
@staticmethod
def convert_xml_list_to_name_id_dict(etree_obj):
def convert_xml_list_to_name_id_dict(ET_obj):
"""
:type etree_obj: etree.Element
:type ET_obj: ET.Element
:return: dict
"""
d = {}
for element in etree_obj:
for element in ET_obj:
e_id = element.get("id")
# If list is collection, have to run one deeper
if e_id is None:
Expand Down
4 changes: 2 additions & 2 deletions tableau_documents/tableau_connection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ..tableau_base import *
from ..tableau_exceptions import *
import xml.etree.cElementTree as etree
import xml.etree.ElementTree as ET


# Represents the actual Connection tag of a given datasource
Expand All @@ -19,7 +19,7 @@ def __init__(self, connection_xml_obj, logger_obj=None):
@property
def cols(self):
"""
:rtype: etree.Element
:rtype: ET.Element
"""
return self.xml_obj.find('cols')

Expand Down
Loading

0 comments on commit dea1dac

Please sign in to comment.