kodexa 7.4.415329037666__py3-none-any.whl → 7.4.415475692281__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kodexa/model/model.py CHANGED
@@ -1847,10 +1847,10 @@ class ContentNode(object):
1847
1847
  bool: True if this node is the first child of its parent or if this node has no parent; else, False;
1848
1848
 
1849
1849
  """
1850
- if not self.parent:
1850
+ if not self.get_parent():
1851
1851
  return True
1852
1852
 
1853
- return self.index == 0
1853
+ return self.index == self.get_parent().get_first_child_index()
1854
1854
 
1855
1855
  def is_last_child(self):
1856
1856
  """Determines if this node is the last child of its parent or has no parent.
@@ -1865,6 +1865,23 @@ class ContentNode(object):
1865
1865
 
1866
1866
  return self.index == self.get_parent().get_last_child_index()
1867
1867
 
1868
+ def get_first_child_index(self):
1869
+ """Returns the min index value for the children of this node. If the node has no children, returns None.
1870
+
1871
+ Returns:
1872
+ int or None: The min index of the children of this node, or None if there are no children.
1873
+
1874
+ """
1875
+ if not self.get_children():
1876
+ return None
1877
+
1878
+ min_index = None
1879
+ for child in self.get_children():
1880
+ if min_index is None or child.index < min_index:
1881
+ min_index = child.index
1882
+
1883
+ return min_index
1884
+
1868
1885
  def get_last_child_index(self):
1869
1886
  """Returns the max index value for the children of this node. If the node has no children, returns None.
1870
1887
 
@@ -1899,6 +1916,7 @@ class ContentNode(object):
1899
1916
 
1900
1917
  """
1901
1918
  if self.get_children():
1919
+ # TODO - is this what we want? Should it return None?
1902
1920
  if index < self.get_children()[0].index:
1903
1921
  virtual_node = self.document.create_node(
1904
1922
  node_type=self.get_children()[0].node_type,
@@ -2007,7 +2025,6 @@ class ContentNode(object):
2007
2025
  if potential_next_node:
2008
2026
  return potential_next_node
2009
2027
  except Exception:
2010
-
2011
2028
  # traverse additional layer
2012
2029
  potential_next_node = (
2013
2030
  self.get_parent()
@@ -2019,6 +2036,7 @@ class ContentNode(object):
2019
2036
  )
2020
2037
  if potential_next_node:
2021
2038
  return potential_next_node
2039
+
2022
2040
  return node
2023
2041
 
2024
2042
  if compiled_node_type_re.match(node.node_type) and (
@@ -2052,9 +2070,17 @@ class ContentNode(object):
2052
2070
  ContentNode or None: The previous node or None, if no node exists
2053
2071
 
2054
2072
  """
2055
-
2056
2073
  # TODO: implement/differentiate traverse logic for CHILDREN and SIBLING
2057
- if self.index == 0:
2074
+
2075
+ parent = self.get_parent()
2076
+ parent_first_child_index = 0
2077
+
2078
+ if parent:
2079
+ parent_first_child_index = parent.get_first_child_index()
2080
+
2081
+ # TODO - the first item in the list does not always have an index property of 0
2082
+ # TODO - should this be in the loop?
2083
+ if self.index == parent_first_child_index:
2058
2084
  if (
2059
2085
  traverse == traverse.ALL
2060
2086
  or traverse == traverse.PARENT
@@ -2071,6 +2097,8 @@ class ContentNode(object):
2071
2097
  compiled_node_type_re = re.compile(node_type_re)
2072
2098
 
2073
2099
  while True:
2100
+ # This creates a virtual node if the index is not found
2101
+ # and the index is not greater than the last child index
2074
2102
  node = self.get_parent().get_node_at_index(search_index)
2075
2103
 
2076
2104
  if not node:
@@ -2084,6 +2112,8 @@ class ContentNode(object):
2084
2112
 
2085
2113
  search_index -= 1
2086
2114
 
2115
+ if traverse == traverse.SIBLING and search_index < 0:
2116
+ return None
2087
2117
 
2088
2118
  class ContentFeature(object):
2089
2119
  """
kodexa/model/objects.py CHANGED
@@ -1550,6 +1550,7 @@ class Session(BaseModel):
1550
1550
  updated_on: Optional[StandardDateTime] = Field(None, alias="updatedOn")
1551
1551
  token: Optional[str] = None
1552
1552
  last_accessed: Optional[StandardDateTime] = Field(None, alias="lastAccessed")
1553
+ organization: Optional[Organization] = None
1553
1554
 
1554
1555
 
1555
1556
  class Status4(Enum):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kodexa
3
- Version: 7.4.415329037666
3
+ Version: 7.4.415475692281
4
4
  Summary: Python SDK for the Kodexa Platform
5
5
  Author: Austin Redenbaugh
6
6
  Author-email: austin@kodexa.com
@@ -12,8 +12,8 @@ kodexa/model/entities/check_response.py,sha256=eqBHxO6G2OAziL3p9bHGI-oiPkAG82H6C
12
12
  kodexa/model/entities/product.py,sha256=StUhTEeLXmc05cj6XnZppQfeJsqCPbX1jdhsysHH--Q,5787
13
13
  kodexa/model/entities/product_group.py,sha256=540fRGyUf34h1BzAN1DiWu6rGgvaj3xDFhZ2k-RvSFY,3617
14
14
  kodexa/model/entities/product_subscription.py,sha256=UcmWR-qgLfdV7VCtJNwzgkanoS8nBSL6ngVuxQUK1M8,3810
15
- kodexa/model/model.py,sha256=q3zEm6pPOB-xPCKbOxmTMqLALzmQr2Ppam8knApoSEE,119645
16
- kodexa/model/objects.py,sha256=j-EmVUkpvGjl7YdjI_2NM9ILaQkwYteVy889MBWXkRc,201068
15
+ kodexa/model/model.py,sha256=o93SDgw8mj28LWbwJB78PF_Oim8qeCTH1a9x_GDc7yg,120895
16
+ kodexa/model/objects.py,sha256=jmid2pcUgl3wyUxWns7AuY18Gnw2d02dlH18MHE5quA,201116
17
17
  kodexa/model/persistence.py,sha256=jUgQ8xwsAFIoZ_bEynxCDEWhUII42eN0e0Mum0dkQPg,72043
18
18
  kodexa/model/utils.py,sha256=YEG3f8YzBil06D0P3_dfx2S9GnHREzyrjnlWwQ7oPlU,3038
19
19
  kodexa/pipeline/__init__.py,sha256=sA7f5D6qkdMrpp2xTIeefnrUBI6xxEEWostvxfX_1Cs,236
@@ -45,7 +45,7 @@ kodexa/testing/test_utils.py,sha256=v44p__gE7ia67W7WeHN2HBFCWSCUrCZt7G4xBNCmwf8,
45
45
  kodexa/training/__init__.py,sha256=xs2L62YpRkIRfslQwtQZ5Yxjhm7sLzX2TrVX6EuBnZQ,52
46
46
  kodexa/training/train_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  kodexa/utils/__init__.py,sha256=Pnim1o9_db5YEnNvDTxpM7HG-qTlL6n8JwFwOafU9wo,5928
48
- kodexa-7.4.415329037666.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
49
- kodexa-7.4.415329037666.dist-info/METADATA,sha256=bway5CMdQqfM-2mfSPIsxL1vv4CYx-I6qgU2X6MNCCY,2916
50
- kodexa-7.4.415329037666.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
51
- kodexa-7.4.415329037666.dist-info/RECORD,,
48
+ kodexa-7.4.415475692281.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
49
+ kodexa-7.4.415475692281.dist-info/METADATA,sha256=wcKOpNbsYh8YZ1VzM8W96eExXUfhVdlYlJ9fL184A1s,2916
50
+ kodexa-7.4.415475692281.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
51
+ kodexa-7.4.415475692281.dist-info/RECORD,,