forked from andrewfullard/PyGCEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.py
More file actions
21 lines (18 loc) · 724 Bytes
/
util.py
File metadata and controls
21 lines (18 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
def getObject(name: str, objectList: set):
"""Finds a named object in a list of objects and returns it"""
for o in objectList:
if o.name.lower() == name.lower():
if o is not None:
return o
print("Object " + name + " not found!")
def commaSepListParser(entry: str) -> list():
"""Parses a comma-separated string into a Python List"""
entry = entry.replace(",", " ")
return entry.split()
def commaReplaceInList(listToReplace: list) -> list():
"""Replaces spurious commas in a Python List"""
outputList = []
for text in listToReplace:
newText = text.replace(",", "")
outputList.append(newText)
return outputList