utilities module
AttrDict
Bases: dict
This class allows javascript-like attribute access for dictionaries. Pass in a nested dictionary and recursively access members as attributes.
Examples:
>>> attr_dict = AttrDict({'foo': [{'bar': [1,2]}]})
>>> attr_dict.foo[0].bar[1] == 2
True
Source code in pycocowriter/utils.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
NPEncoder
Bases: JSONEncoder
json encoder class used to convert numpy types into plain python types during json.dumps.
Examples:
>>> json.dumps({'array': np.array([1,2,3])}, cls=NPEncoder)
'{"array": [1, 2, 3]}'
Source code in pycocowriter/utils.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
skiprows(iterable, n)
skips the first n rows of iterable. returns iterable as a convenience
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iterable
|
Iterable
|
the iterable to skip rows of |
required |
n
|
int
|
the number of rows to skip |
required |
Returns:
| Name | Type | Description |
|---|---|---|
iterable |
Iterable
|
the original iterable, but now with n rows having been skipped |
Source code in pycocowriter/utils.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |