Privex Python Helpers
develop
Main:
Privex Python Helpers’s documentation
Installation
Download and install from PyPi using pip (recommended)
(Alternative) Manual install from Git
Example Usages
Boolean testing
The
empty
function
The
is_true
and
is_false
functions
Handling environmental variables in different formats
Using
env_csv
to support lists contained within an env var
Using
env_keyval
to support dictionaries contained within an env var
Improved collections, including dict’s and namedtuple’s
Dictionaries with dot notation attribute read/write
Named Tuple’s (namedtuple) with dict-like key access, dict casting, and writable fields
Code Documentation:
privex.helpers.asyncx
async_sync
await_if_needed
awaitable
awaitable_class
call_sys_async
get_async_type
is_async_context
loop_run
run_sync
AwaitableMixin
Methods
aobject
Methods
__init__
privex.helpers.black_magic
caller_name
calling_function
calling_module
last_frames
last_stack_frame
privex.helpers.cache
Available Cache Adapters
Setting / updating the global cache adapter instance
Plug-n-play usage
adapter_get
adapter_set
get
get_or_set
remove
set
update_timeout
CacheWrapper
Methods
get_adapter
set_adapter
Attributes
cache_instance
privex.helpers.common
almost
byteify
call_sys
camel_to_snake
chunked
construct_dict
dec_round
empty
empty_if
env_bool
env_cast
env_csv
env_decimal
env_int
env_keyval
extract_settings
filter_form
get_function_params
human_name
inject_items
io_tail
is_false
is_true
parse_csv
parse_keyval
random_str
reverse_io
shell_quote
stringify
tail
ErrHelpParser
Methods
error
privex.helpers.collections
Object-like Dictionaries (dict’s)
Creating a new DictObject and using it
Converting an existing dictionary (dict) into a DictObject
Dict-able NamedTuple’s
What is a dictable_namedtuple and why use it?
Importing dictable_namedtuple functions
Creating a NEW dictable_namedtuple type and instance
Converting an existing namedtuple instance into a dictable_namedtuple instance
Converting an existing namedtuple type/class into a dictable_namedtuple type/class
convert_dictable_namedtuple
dictable_namedtuple
is_namedtuple
make_dict_tuple
subclass_dictable_namedtuple
DictObject
Methods
Dictable
Methods
from_dict
Mocker
Methods
__init__
add_mock_module
make_mock_class
OrderedDictObject
Methods
privex.helpers.converters
convert_bool_int
convert_datetime
convert_int_bool
convert_unixtime_datetime
privex.helpers.crypto
privex.helpers.decorators
async_retry
mock_decorator
r_cache
r_cache_async
retry_on_err
FO
Attributes
KWARG_ONLY
MIX
POS_AUTO
POS_ONLY
FormatOpt
Attributes
KWARG_ONLY
MIX
POS_AUTO
POS_ONLY
privex.helpers.django
handle_error
is_database_synchronized
model_to_dict
to_json
privex.helpers.exceptions
privex.helpers.extras
privex.helpers.net
asn_to_name
get_rdns
get_rdns_multi
ip4_to_rdns
ip6_to_rdns
ip_is_v4
ip_is_v6
ip_to_rdns
ping
resolve_ip
resolve_ips
resolve_ips_multi
privex.helpers.plugin
clean_threadstore
close_geoip
close_memcached_async
close_redis
close_redis_async
configure_memcached_async
configure_redis
configure_redis_async
connect_geoip
connect_memcached_async
connect_redis
connect_redis_async
get_geodbs
get_geoip
get_geoip_db
get_memcached_async
get_redis
get_redis_async
reset_geoip
reset_memcached_async
reset_redis
reset_redis_async
privex.helpers.settings
privex.helpers.setuppy
privex.helpers.types
NO_RESULT
Methods
USE_ORIG_VAR
Methods
Unit Testing
How to use the unit tests
Testing pre-requisites
Running via PyTest
Running individual test modules
Running directly using Python Unittest
Unit Test List / Overview
tests.asyncx
tests.base
EmptyIter
Methods
PrivexBaseCase
Methods
Attributes
empty_lst
empty_vals
empty_zero
falsey
falsey_empty
truthy
tests.cache
tests.general
tests.test_bool
TestBoolHelpers
Methods
test_empty_combined
test_empty_lst
test_empty_vals
test_empty_zero
test_emptyif_only_empty
test_emptyif_only_value
test_emptyif_with_is_not_empty
test_isfalse_falsey
test_isfalse_truthy
test_istrue_falsey
test_istrue_truthy
test_notempty
Attributes
tests.test_cache
TestCacheDecoratorMemory
Methods
setUpClass
tearDown
test_rcache_callable
test_rcache_rand
test_rcache_rand_dynamic
Attributes
cache
TestCacheDecoratorRedis
Methods
setUpClass
Attributes
pytestmark
TestMemoryCache
Methods
setUpClass
tearDownClass
test_cache_expire
test_cache_remove
test_cache_set
test_cache_update_timeout
test_cache_update_timeout_raise
Attributes
cache_keys
TestRedisCache
Methods
setUpClass
Attributes
pytestmark
tests.test_collections
TestDictObject
Methods
test_convert_from_dict
test_convert_to_dict
test_json_dumps
test_json_dumps_nested
test_set_attr
test_set_item
Attributes
TestDictableNamedtuple
Methods
setUp
test_asdict
test_convert
test_dict_cast
test_get_attr
test_get_index
test_get_item
test_metadata
test_set_attr
test_set_item
test_subclass
Attributes
example_items
TestIsNamedTuple
Methods
test_dictable_namedtuple
test_dictable_namedtuple_plus_invalid
test_dictable_plus_normal_namedtuple
test_not_namedtuple_class
test_not_namedtuple_dict
test_not_namedtuple_float
test_not_namedtuple_int
test_not_namedtuple_list
test_not_namedtuple_tuple
test_real_namedtuple
test_real_namedtuple_plus_invalid
Attributes
dict_persons
named_persons
TestOrderedDictObject
Methods
test_convert_from_dict
test_convert_to_dict
test_json_dumps
test_json_dumps_nested
test_set_attr
test_set_item
Attributes
tests.test_converters
TestConvertDate
Methods
test_convert_date_int
test_convert_date_int_ms
test_convert_date_int_str
test_convert_date_str
test_convert_date_str_2
test_convert_date_str_3
test_convert_date_str_4
test_convert_unixtime_int
test_convert_unixtime_int_ms
test_convert_unixtime_int_str
Attributes
TestConvertGeneral
Methods
test_convert_bool_int_empty
test_convert_bool_int_empty_cust
test_convert_bool_int_empty_fail
test_convert_bool_int_false
test_convert_bool_int_true
test_convert_int_bool_empty
test_convert_int_bool_empty_cust
test_convert_int_bool_empty_fail
test_convert_int_bool_false
test_convert_int_bool_true
Attributes
tests.test_crypto
CryptoBaseCase
Methods
Attributes
fake_b64_key
TestEncryptHelper
Methods
test_corrupt_key_encrypt
test_generate_key_enc_dec
test_invalid_key_decrypt
test_is_encrypted
test_password_key_diffpass
test_password_key_diffsalt
test_password_key_equal
test_password_key_gensalt
Attributes
txt
TestKeyManagerGeneration
Methods
test_ecdsa_gen
test_ed25519_gen
test_output_keypair
test_rsa_gen
Attributes
TestKeyManagerLoad
Methods
test_ecdsa_load
test_ed25519_load
test_load_invalid
test_load_keyfile_corrupt_private
test_load_keyfile_corrupt_public
test_load_keyfile_corrupt_public_2
test_load_keyfile_noexist
test_load_keyfile_sign_verify_rsa
test_rsa_load
Attributes
TestKeyManagerSignVerifyEncrypt
Methods
test_ecdsa_sign_verify
test_ed25519_sign_verify
test_rsa_encrypt_decrypt
test_rsa_sign_verify
Attributes
tests.test_extras
Example
Methods
__init__
TestAttrs
Methods
test_dictable_cast_dict
test_dictable_set_get
Attributes
pytestmark
TestGit
Methods
setUp
tearDown
test_add
test_add_async
test_checkout
test_checkout_async
test_commit
test_commit_async
test_get_current_branch
test_get_current_commit
test_get_current_tag
test_init
test_init_async
Attributes
tests.test_parse
TestParseHelpers
Methods
test_csv_single
test_csv_spaced
test_env_bool_false
test_env_bool_true
test_env_nonexist_bool
test_kval_clean
test_kval_custom_clean
test_kval_custom_spaced
test_kval_single
test_kval_spaced
Attributes
tests.test_rdns
TestIPReverseDNS
Methods
test_v4_arpa_boundary_16bit
test_v4_arpa_boundary_24bit
test_v4_inv_boundary
test_v4_inv_boundary_2
test_v4_invalid
test_v4_invalid_2
test_v4_to_arpa
test_v6_arpa_boundary_16bit
test_v6_arpa_boundary_32bit
test_v6_inv_boundary
test_v6_inv_boundary_2
test_v6_invalid
test_v6_invalid_2
test_v6_to_arpa
Attributes
tests.test_net
TestNet
Methods
test_asn_to_name_erroneous
test_asn_to_name_erroneous_2
test_asn_to_name_int
test_asn_to_name_str
test_get_rdns_invalid_domain
test_get_rdns_multi
test_get_rdns_multi_invalid
test_get_rdns_no_rdns_records
test_get_rdns_privex_ns1_host
test_get_rdns_privex_ns1_ip
test_ping
test_ping_v6
Attributes
TestNetResolveIP
Methods
test_resolve_ip_hiveseed
test_resolve_ip_hiveseed_v4
test_resolve_ip_hiveseed_v6
test_resolve_ip_v4_convert
test_resolve_ips_hiveseed
test_resolve_ips_hiveseed_v4
test_resolve_ips_hiveseed_v6
test_resolve_ips_ipv4_addr
test_resolve_ips_ipv4_addr_invalid
test_resolve_ips_ipv6_addr
test_resolve_ips_ipv6_addr_invalid
test_resolve_ips_multi_any
test_resolve_ips_multi_v4
test_resolve_ips_multi_v6
test_resolve_ips_v4_convert
test_resolve_ips_v4_convert_false
Attributes
Privex Python Helpers
Docs
»
How to use the unit tests
»
tests.asyncx
Edit on GitHub
tests.asyncx
¶
Read the Docs
v: develop
Versions
latest
stable
develop
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds
Free document hosting provided by
Read the Docs
.