topologicpy 0.6.3__py3-none-any.whl → 0.7.0__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.
topologicpy/Context.py CHANGED
@@ -24,7 +24,7 @@ class Context:
24
24
 
25
25
  Parameters
26
26
  ----------
27
- topology : topologic.Topology
27
+ topology : topologic_core.Topology
28
28
  The input topology.
29
29
  u : float , optional
30
30
  The input *u* parameter. This defines the relative parameteric location of the content object along the *u* axis.
@@ -35,17 +35,19 @@ class Context:
35
35
 
36
36
  Returns
37
37
  -------
38
- topologic.Context
38
+ topologic_core.Context
39
39
  The created context object. See Aperture.ByObjectContext.
40
40
 
41
41
  """
42
- if not isinstance(topology, topologic.Topology):
42
+ from topologicpy.Topology import Topology
43
+
44
+ if not Topology.IsInstance(topology, "Topology"):
43
45
  print("Context.ByTopologyParameters - Error: The input topology parameter is not a valid topologic topology. Returning None.")
44
46
  return None
45
47
 
46
48
  context = None
47
49
  try:
48
- context = topologic.Context.ByTopologyParameters(topology, u, v, w)
50
+ context = topologic.Context.ByTopologyParameters(topology, u, v, w) # Hook to Core
49
51
  except:
50
52
  print("Context.ByTopologyParameters - Error: The operation failed. Returning None.")
51
53
  context = None
@@ -58,16 +60,18 @@ class Context:
58
60
 
59
61
  Parameters
60
62
  ----------
61
- context : topologic.Context
63
+ context : topologic_core.Context
62
64
  The input context.
63
65
 
64
66
  Returns
65
67
  -------
66
- topologic.Topology
68
+ topologic_core.Topology
67
69
  The topology of the input context.
68
70
 
69
71
  """
70
- if not isinstance(context, topologic.Context):
72
+ from topologicpy.Topology import Topology
73
+
74
+ if not Topology.IsInstance(context, "Context"):
71
75
  print("Context.Topology - Error: The input context parameter is not a valid topologic context. Returning None.")
72
76
  return None
73
77
  topology = None
topologicpy/DGL.py CHANGED
@@ -1619,7 +1619,7 @@ class DGL:
1619
1619
 
1620
1620
  Parameters
1621
1621
  ----------
1622
- topologicGraph : topologic.Graph
1622
+ topologicGraph : topologic_core.Graph
1623
1623
  The input topologic graph.
1624
1624
  bidirectional : bool , optional
1625
1625
  If set to True, the output DGL graph is forced to be bidirectional. The defaul is True.
topologicpy/Dictionary.py CHANGED
@@ -17,7 +17,7 @@
17
17
  import topologic_core as topologic
18
18
  from topologic_core import IntAttribute, DoubleAttribute, StringAttribute, ListAttribute
19
19
 
20
- class Dictionary(topologic.Dictionary):
20
+ class Dictionary():
21
21
  '''
22
22
  @staticmethod
23
23
  def ByDGLData(item):
@@ -60,7 +60,7 @@ class Dictionary(topologic.Dictionary):
60
60
 
61
61
  Returns
62
62
  -------
63
- topologic.Dictionary
63
+ topologic_core.Dictionary
64
64
  The created dictionary.
65
65
 
66
66
  """
@@ -84,34 +84,34 @@ class Dictionary(topologic.Dictionary):
84
84
  """
85
85
  return json.dumps(py_dict, indent=2)
86
86
 
87
- attr = topologic.StringAttribute("__NONE__")
87
+ attr = topologic.StringAttribute("__NONE__") # Hook to Core
88
88
  if value == None:
89
- attr = topologic.StringAttribute("__NONE__")
89
+ attr = topologic.StringAttribute("__NONE__") # Hook to Core
90
90
  elif isinstance(value, bool):
91
91
  if value == False:
92
- attr = topologic.IntAttribute(0)
92
+ attr = topologic.IntAttribute(0) # Hook to Core
93
93
  else:
94
- attr = topologic.IntAttribute(1)
94
+ attr = topologic.IntAttribute(1) # Hook to Core
95
95
  elif isinstance(value, int):
96
- attr = topologic.IntAttribute(value)
96
+ attr = topologic.IntAttribute(value) # Hook to Core
97
97
  elif isinstance(value, float):
98
- attr = topologic.DoubleAttribute(value)
99
- elif isinstance(value, topologic.Topology):
98
+ attr = topologic.DoubleAttribute(value) # Hook to Core
99
+ elif Topology.IsInstance(value, "Topology"):
100
100
  str_value = Topology.JSONString(value)
101
- attr = topologic.StringAttribute(str_value)
101
+ attr = topologic.StringAttribute(str_value) # Hook to Core
102
102
  elif isinstance(value, dict):
103
103
  str_value = dict_to_json(value)
104
- attr = topologic.StringAttribute(str_value)
104
+ attr = topologic.StringAttribute(str_value) # Hook to Core
105
105
  elif isinstance(value, str):
106
- attr = topologic.StringAttribute(value)
106
+ attr = topologic.StringAttribute(value) # Hook to Core
107
107
  elif isinstance(value, tuple):
108
108
  l = [Dictionary._ConvertValue(v) for v in list(value)]
109
- attr = topologic.ListAttribute(l)
109
+ attr = topologic.ListAttribute(l) # Hook to Core
110
110
  elif isinstance(value, list):
111
111
  l = [Dictionary._ConvertValue(v) for v in value]
112
- attr = topologic.ListAttribute(l)
112
+ attr = topologic.ListAttribute(l) # Hook to Core
113
113
  else:
114
- attr = topologic.StringAttribute("__NONE__")
114
+ attr = topologic.StringAttribute("__NONE__") # Hook to Core
115
115
  return attr
116
116
 
117
117
  @staticmethod
@@ -128,7 +128,7 @@ class Dictionary(topologic.Dictionary):
128
128
 
129
129
  Returns
130
130
  -------
131
- topologic.Dictionary
131
+ topologic_core.Dictionary
132
132
  The created dictionary.
133
133
 
134
134
  """
@@ -150,7 +150,7 @@ class Dictionary(topologic.Dictionary):
150
150
  else:
151
151
  stl_keys.append(str(keys[i]))
152
152
  stl_values.append(Dictionary._ConvertValue(values[i]))
153
- return topologic.Dictionary.ByKeysValues(stl_keys, stl_values)
153
+ return topologic.Dictionary.ByKeysValues(stl_keys, stl_values) # Hook to Core
154
154
 
155
155
  @staticmethod
156
156
  def ByMergedDictionaries(dictionaries):
@@ -164,16 +164,17 @@ class Dictionary(topologic.Dictionary):
164
164
 
165
165
  Returns
166
166
  -------
167
- topologic.Dictionary
167
+ topologic_core.Dictionary
168
168
  The created dictionary.
169
169
 
170
170
  """
171
+ from topologicpy.Topology import Topology
171
172
  if not isinstance(dictionaries, list):
172
173
  print("Dictionary.ByMergedDictionaries - Error: The input dictionaries parameter is not a valid list. Returning None.")
173
174
  return None
174
175
  new_dictionaries = []
175
176
  for d in dictionaries:
176
- if isinstance(d, topologic.Dictionary):
177
+ if Topology.IsInstance(d, "Dictionary"):
177
178
  new_dictionaries.append(d)
178
179
  elif isinstance(d, dict):
179
180
  new_dictionaries.append(Dictionary.ByPythonDictionary(d))
@@ -311,7 +312,7 @@ class Dictionary(topologic.Dictionary):
311
312
 
312
313
  Returns
313
314
  -------
314
- topologic.Dictionary
315
+ topologic_core.Dictionary
315
316
  The dictionary equivalent to the input python dictionary.
316
317
 
317
318
  """
@@ -331,7 +332,7 @@ class Dictionary(topologic.Dictionary):
331
332
 
332
333
  Parameters
333
334
  ----------
334
- dictionary : topologic.Dictionary or dict
335
+ dictionary : topologic_core.Dictionary or dict
335
336
  The input dictionary.
336
337
 
337
338
  Returns
@@ -340,12 +341,13 @@ class Dictionary(topologic.Dictionary):
340
341
  The list of keys of the input dictionary.
341
342
 
342
343
  """
343
- if not isinstance(dictionary, topologic.Dictionary) and not isinstance(dictionary, dict):
344
+ from topologicpy.Topology import Topology
345
+ if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
344
346
  print("Dictionary.Keys - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
345
347
  return None
346
348
  if isinstance(dictionary, dict):
347
349
  return list(dictionary.keys())
348
- elif isinstance(dictionary, topologic.Dictionary):
350
+ elif Topology.IsInstance(dictionary, "Dictionary"):
349
351
  return dictionary.Keys()
350
352
  else:
351
353
  return None
@@ -377,7 +379,7 @@ class Dictionary(topologic.Dictionary):
377
379
 
378
380
  Parameters
379
381
  ----------
380
- dictionary : topologic.Dictionary
382
+ dictionary : topologic_core.Dictionary
381
383
  The input dictionary.
382
384
 
383
385
  Returns
@@ -386,10 +388,12 @@ class Dictionary(topologic.Dictionary):
386
388
  The python dictionary equivalent of the input dictionary
387
389
 
388
390
  """
391
+ from topologicpy.Topology import Topology
392
+
389
393
  if isinstance(dictionary, dict):
390
394
  print("Dictionary.PythonDictionary - Warning: The input dictionary parameter is already a python dictionary. Returning that dictionary.")
391
395
  return dictionary
392
- if not isinstance(dictionary, topologic.Dictionary):
396
+ if not Topology.IsInstance(dictionary, "Dictionary"):
393
397
  print("Dictionary.PythonDictionary - Error: The input dictionary parameter is not a valid topologic dictionary. Returning None.")
394
398
  return None
395
399
  keys = dictionary.Keys()
@@ -399,17 +403,17 @@ class Dictionary(topologic.Dictionary):
399
403
  attr = dictionary.ValueAtKey(key)
400
404
  except:
401
405
  raise Exception("Dictionary.Values - Error: Could not retrieve a Value at the specified key ("+key+")")
402
- if isinstance(attr, topologic.IntAttribute):
406
+ if isinstance(attr, topologic.IntAttribute): # Hook to Core
403
407
  pythonDict[key] = (attr.IntValue())
404
- elif isinstance(attr, topologic.DoubleAttribute):
408
+ elif isinstance(attr, topologic.DoubleAttribute): # Hook to Core
405
409
  pythonDict[key] = (attr.DoubleValue())
406
- elif isinstance(attr, topologic.StringAttribute):
410
+ elif isinstance(attr, topologic.StringAttribute): # Hook to Core
407
411
  temp_str = attr.StringValue()
408
412
  if temp_str == "__NONE__":
409
413
  pythonDict[key] = None
410
414
  else:
411
415
  pythonDict[key] = (temp_str)
412
- elif isinstance(attr, topologic.ListAttribute):
416
+ elif isinstance(attr, topologic.ListAttribute): # Hook to Core
413
417
  pythonDict[key] = (Dictionary.ListAttributeValues(attr))
414
418
  else:
415
419
  pythonDict[key]=("")
@@ -422,17 +426,19 @@ class Dictionary(topologic.Dictionary):
422
426
 
423
427
  Parameters
424
428
  ----------
425
- dictionary : topologic.Dictionary or dict
429
+ dictionary : topologic_core.Dictionary or dict
426
430
  The input dictionary.
427
431
  key : string
428
432
  The input key.
429
433
 
430
434
  Returns
431
435
  -------
432
- topologic.Dictionary or dict
436
+ topologic_core.Dictionary or dict
433
437
  The input dictionary with the key/value removed from it.
434
438
 
435
439
  """
440
+ from topologicpy.Topology import Topology
441
+
436
442
  def processPythonDictionary (dictionary, key):
437
443
  values = []
438
444
  keys = dictionary.keys()
@@ -452,7 +458,7 @@ class Dictionary(topologic.Dictionary):
452
458
  new_values.append(Dictionary.ValueAtKey(dictionary, k))
453
459
  return Dictionary.ByKeysValues(new_keys, new_values)
454
460
 
455
- if not isinstance(dictionary, topologic.Dictionary) and not isinstance(dictionary, dict):
461
+ if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
456
462
  print("Dictionary.RemoveKey - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
457
463
  return None
458
464
  if not isinstance(key, str):
@@ -461,7 +467,7 @@ class Dictionary(topologic.Dictionary):
461
467
 
462
468
  if isinstance(dictionary, dict):
463
469
  return processPythonDictionary(dictionary, key)
464
- elif isinstance(dictionary, topologic.Dictionary):
470
+ elif Topology.IsInstance(dictionary, "Dictionary"):
465
471
  return processTopologicDictionary(dictionary, key)
466
472
  else:
467
473
  return None
@@ -473,7 +479,7 @@ class Dictionary(topologic.Dictionary):
473
479
 
474
480
  Parameters
475
481
  ----------
476
- dictionary : topologic.Dictionary or dict
482
+ dictionary : topologic_core.Dictionary or dict
477
483
  The input dictionary.
478
484
  key : string
479
485
  The input key.
@@ -482,10 +488,12 @@ class Dictionary(topologic.Dictionary):
482
488
 
483
489
  Returns
484
490
  -------
485
- topologic.Dictionary or dict
491
+ topologic_core.Dictionary or dict
486
492
  The input dictionary with the key/value pair added to it.
487
493
 
488
494
  """
495
+ from topologicpy.Topology import Topology
496
+
489
497
  def processPythonDictionary (dictionary, key, value):
490
498
  if value == "__NONE__":
491
499
  value = None
@@ -505,7 +513,7 @@ class Dictionary(topologic.Dictionary):
505
513
  d = Dictionary.ByKeysValues(keys, values)
506
514
  return d
507
515
 
508
- if not isinstance(dictionary, topologic.Dictionary) and not isinstance(dictionary, dict):
516
+ if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
509
517
  print("Dictionary.SetValueAtKey - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
510
518
  return None
511
519
  if not isinstance(key, str):
@@ -515,7 +523,7 @@ class Dictionary(topologic.Dictionary):
515
523
  value = "__NONE__"
516
524
  if isinstance(dictionary, dict):
517
525
  return processPythonDictionary(dictionary, key, value)
518
- elif isinstance(dictionary, topologic.Dictionary):
526
+ elif Topology.IsInstance(dictionary, "Dictionary"):
519
527
  return processTopologicDictionary(dictionary, key, value)
520
528
  else:
521
529
  return None
@@ -560,7 +568,7 @@ class Dictionary(topologic.Dictionary):
560
568
  topologies = None
561
569
  if temp_value == "__NONE__":
562
570
  return None
563
- elif isinstance(topologies, topologic.Topology):
571
+ elif Topology.IsInstance(topologies, "Topology"):
564
572
  return topologies
565
573
  elif isinstance(topologies, list):
566
574
  if len(topologies) > 1:
@@ -604,7 +612,7 @@ class Dictionary(topologic.Dictionary):
604
612
 
605
613
  Parameters
606
614
  ----------
607
- dictionary : topologic.Dictionary or dict
615
+ dictionary : topologic_core.Dictionary or dict
608
616
  The input dictionary.
609
617
  key : string
610
618
  The input key.
@@ -619,7 +627,7 @@ class Dictionary(topologic.Dictionary):
619
627
  from topologicpy.Topology import Topology
620
628
 
621
629
 
622
- if not isinstance(dictionary, topologic.Dictionary) and not isinstance(dictionary, dict):
630
+ if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
623
631
  print("Dictionary.ValueAtKey - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
624
632
  return None
625
633
  if not isinstance(key, str):
@@ -627,7 +635,7 @@ class Dictionary(topologic.Dictionary):
627
635
  return None
628
636
  if isinstance(dictionary, dict):
629
637
  attr = dictionary[key]
630
- elif isinstance(dictionary, topologic.Dictionary):
638
+ elif Topology.IsInstance(dictionary, "Dictionary"):
631
639
  attr = dictionary.ValueAtKey(key)
632
640
  else:
633
641
  return None
@@ -641,7 +649,7 @@ class Dictionary(topologic.Dictionary):
641
649
 
642
650
  Parameters
643
651
  ----------
644
- dictionary : topologic.Dictionary or dict
652
+ dictionary : topologic_core.Dictionary or dict
645
653
  The input dictionary.
646
654
 
647
655
  Returns
@@ -650,13 +658,15 @@ class Dictionary(topologic.Dictionary):
650
658
  The list of values found in the input dictionary.
651
659
 
652
660
  """
653
- if not isinstance(dictionary, topologic.Dictionary) and not isinstance(dictionary, dict):
661
+ from topologicpy.Topology import Topology
662
+
663
+ if not Topology.IsInstance(dictionary, "Dictionary") and not isinstance(dictionary, dict):
654
664
  print("Dictionary.Values - Error: The input dictionary parameter is not a valid topologic or python dictionary. Returning None.")
655
665
  return None
656
666
  keys = None
657
667
  if isinstance(dictionary, dict):
658
668
  keys = dictionary.keys()
659
- elif isinstance(dictionary, topologic.Dictionary):
669
+ elif Topology.IsInstance(dictionary, "Dictionary"):
660
670
  keys = dictionary.Keys()
661
671
  returnList = []
662
672
  if not keys:
@@ -665,33 +675,13 @@ class Dictionary(topologic.Dictionary):
665
675
  try:
666
676
  if isinstance(dictionary, dict):
667
677
  attr = dictionary[key]
668
- elif isinstance(dictionary, topologic.Dictionary):
678
+ elif Topology.IsInstance(dictionary, "Dictionary"):
669
679
  attr = Dictionary.ValueAtKey(dictionary,key)
670
680
  else:
671
681
  attr = None
672
682
  except:
673
683
  return None
674
684
  returnList.append(attr)
675
- '''
676
- if isinstance(attr, topologic.IntAttribute):
677
- returnList.append(attr.IntValue())
678
- elif isinstance(attr, topologic.DoubleAttribute):
679
- returnList.append(attr.DoubleValue())
680
- elif isinstance(attr, topologic.StringAttribute):
681
- temp_attr = attr.StringValue()
682
- if temp_attr == "__NONE__":
683
- returnList.append(None)
684
- else:
685
- returnList.append(attr.StringValue())
686
- elif isinstance(attr, topologic.ListAttribute):
687
- returnList.append(Dictionary.ListAttributeValues(attr))
688
- elif isinstance(attr, float) or isinstance(attr, int) or isinstance(attr, str):
689
- returnList.append(attr)
690
- elif isinstance(attr, list):
691
- returnList.append(Dictionary.ListAttributeValues(attr))
692
- else:
693
- returnList.append("")
694
- '''
695
685
  return returnList
696
686
 
697
687