Common¶
Common functions.
intsec ¶
intsec(list1, list2)
Simple intesection of two lists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list1 |
list
|
list1 |
required |
list2 |
list
|
list2 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
intersection of lists |
Source code in src/common.py
6 7 8 9 10 11 12 13 14 15 16 | |
diff ¶
diff(list1, list2)
Simple difference of items in list2 from list1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list1 |
list
|
list1 |
required |
list2 |
list
|
list2 |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
difference of lists |
Source code in src/common.py
19 20 21 22 23 24 25 26 27 28 29 | |
json_load ¶
json_load(file_loc)
Helper function to open/close json file, otherwise the python outputs warning that the file remains opened
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_loc |
str
|
location of the file |
required |
Returns:
| Name | Type | Description |
|---|---|---|
content |
dict
|
content of json file, usually dictionary |
Source code in src/common.py
32 33 34 35 36 37 38 39 40 41 42 43 44 | |
json_dump ¶
json_dump(file_loc, content)
Helper function to open/close json file and dump content into it, otherwise the python outputs warning that the file remains opened
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_loc |
str
|
location of the file |
required |
content |
object
|
data that will be saved to json, usually dictionary |
required |
Source code in src/common.py
47 48 49 50 51 52 53 54 55 56 | |
dill_load ¶
dill_load(file_loc)
Helper function to open/close dill file, otherwise the python outputs warning that the file remains opened
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_loc |
str
|
location of the file |
required |
Returns:
| Name | Type | Description |
|---|---|---|
content |
dict
|
content of dill file, usually dictionary |
Source code in src/common.py
59 60 61 62 63 64 65 66 67 68 69 70 71 | |
dill_dump ¶
dill_dump(file_loc, content)
Helper function to open/close dill file and dump content into it, otherwise the python outputs warning that the file remains opened
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_loc |
str
|
location of the file |
required |
content |
object
|
data that will be saved to dill, usually dictionary |
required |
Source code in src/common.py
74 75 76 77 78 79 80 81 82 83 | |