ObjectList
Use methods and method chaining on lists of objects. Also allowing clean syntax for parallel processing.
Examples
As an example we define an ObjectList of Path objects.
from objectlist import ObjectList
from pathlib import Path
path_list = [Path('foo/a'), Path('foo/bar/b'), Path('foo/bar/c')]
path_objectlist = ObjectList(path_list)
Getting object attributes and properties
If we would like to get the parents of all paths
[WindowsPath('foo'), WindowsPath('foo/bar'), WindowsPath('foo/bar')]
then using a normal list it is necessary to use a loop:
[p.parent for p in path_list]
but using an ObjectList this can be done by
path_objectlist.parent
ObjectLists can be easily converted to strings:
path_objectlist.parent.str
['foo', 'foo\\bar', 'foo\\bar']
Using object methods and passing arguments
Object methods can also be used
path_objectlist.with_suffix('.txt')
[WindowsPath('foo/a.txt'), WindowsPath('foo/bar/b.txt'), WindowsPath('foo/bar/c.txt')]
Using parallel processing
Parallel processing can be activated on existing ObjectLists by using .parallel
path_objectlist.parallel.with_suffix('.txt')
Alternatively parallel processing can be activated when the ObjectList is defined:
path_objectlist = ObjectList(path_list,
use_parallel_processing=True,
number_of_cores=None,
parallel_processing_kwargs=dict(verbose=0),
return_none_if_all_none=True)
Metadata
Release files for objectlist 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| objectlist-1.0.2.tar.gz | 17.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| objectlist-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / objectlist-1.0.2.tar.gz
| Download URL | objectlist-1.0.2.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b3b54c28dc5deafec5e5cac4365aa0141adedd0d63b07ca6f69d5aab3547131
|
|
BLAKE2b-256 checksum How to use checksums |
eca092b191513ff703b0ce661d0776dc97324dfafeac2d3de2943252126f6330
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / objectlist-1.0.2-py3-none-any.whl
| Download URL | objectlist-1.0.2-py3-none-any.whl |
|---|---|
| Size | 17.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6e4cd31810785b233fe13372a14293b379dcaa05e7851196050d6d52f786f05
|
|
BLAKE2b-256 checksum How to use checksums |
add767a38f79e8912703ca78e0669c6b93893b742843a30fa6bc61c7e1b039ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|