Python language tools
Project description
vutils-python: Python Language Tools
This package provides a set of tools to deal with tasks related to Python language environment, like copying data to or from objects, importing, object analysis etc.
Installation
To get vutils-python
, just type
$ pip install vutils-python
How To Use
Functions and classes provided by vutils-python
can be accessed by importing
following submodules:
vutils.python.objects
Each of these submodules is described in the following subsections.
Objects Manipulation
Functions and classes that deals with Python objects, defined in
vutils.python.objects
submodule, are
merge_data(dest, src)
merges data fromsrc
todest
.src
anddest
must be of the same type. Examples:src = [1, 2, 3] dest = [1, 2] merge_data(dest, src) # dest will be [1, 2, 1, 2, 3] src = {1, 2, 3} dest = {2, 4} merge_data(dest, src) # dest will be {1, 2, 3, 4} src = {"a": "bc", 1: 2} dest = {1: "a", "b": "c"} merge_data(dest, src) # dest will be {1: 2, "a": "bc", "b": "c"} merge_data({}, [1]) # TypeError
ensure_key(mapping, key, default)
ensuresmapping
has akey
of the same type adefault
. Ifkey
is not inmapping
, storedefault
tomapping
under it.ensure_no_key(mapping, key)
ensureskey
is not present inmapping
.flatten(obj)
flattensobj
recursively if it islist
ortuple
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vutils-python-0.2.0.tar.gz
(8.0 kB
view hashes)
Built Distribution
Close
Hashes for vutils_python-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72a66bd23e82d48b7bf05b5aa96e0f32ec23068d74ced56527a9bfb8d0cc047c |
|
MD5 | 443bb12eaa4d1b694782faf51e242c9e |
|
BLAKE2b-256 | aaf644ed3c3468c19fb573a835a2782b581d50a8a27a8d2575beabe775ceac7a |