merge with upstream master
This commit is contained in:
16
helix/helpers/camel_case.py
Normal file
16
helix/helpers/camel_case.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import re
|
||||
|
||||
|
||||
def convert_camel_case_to_snake_case(name):
|
||||
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
|
||||
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
||||
|
||||
|
||||
def convert_dict_keys_to_snake_case(a_dict):
|
||||
new_dict = {}
|
||||
for old_key in a_dict.keys():
|
||||
new_key = convert_camel_case_to_snake_case(old_key)
|
||||
new_dict[new_key] = a_dict[old_key]
|
||||
return new_dict
|
||||
|
||||
|
||||
@@ -130,8 +130,14 @@ class NodeQuadTree():
|
||||
self.nodeList = toKeep
|
||||
|
||||
# Return a list of all possible nodes that can be near this point
|
||||
def retrieve(self, nearPoint):
|
||||
retNodes = list(self.nodeList)
|
||||
# Optimization `only_quads_related = True`:
|
||||
# Avoid replicate a large self.nodeList. Get only the other elements.
|
||||
# Call this in complement of `self.nodeList`
|
||||
def retrieve(self, nearPoint, only_quads_related=False):
|
||||
if only_quads_related:
|
||||
retNodes = []
|
||||
else:
|
||||
retNodes = self.nodeList[:] # = list(self.nodeList)
|
||||
|
||||
if self.quads[0] is not None:
|
||||
index = self.getIndex(nearPoint)
|
||||
|
||||
Reference in New Issue
Block a user