Collection of simple utils.
Project description
zenutils
Collection of simple utils.
Install
pip install zenutils
Extra packages requires
- For python3.2 and python2.x, requires extra package: inspect2~=0.1.2
- For user who is using xxhash methods with hashutils, requires extra package: xxhash
- For user who is using sm3 methods with hashutils, requires extra package: sm3utils.
- If your python installation's hashlib already support sm3 hash method, you don't have to install sm3utils.
- xxhash and sm3utils are not put into this package's requirements, you need to install them by your self.
Notice
- The hashutils' hash methods are different on different python installations. The list below is based on Python 3.10.6 x86_64 on windows. Mostly md5, sha1, sha224, sha256, sha384, sha512 methods are supported.
- The hashutils' DEFAULT_HASH_METHOD is sm3 and DEFAULT_PASSWORD_HASH_METHOD is ssm3, so if your python installation is not support sm3 hash method, you need to install sm3utils by yourself.
Utils
- zenutils.base64utils
- a85decode
- a85encode
- b16decode
- b16encode
- b32decode
- b32encode
- b32hexdecode
- b32hexencode
- b64decode
- b64encode
- b85decode
- b85encode
- decode
- decodebytes
- encode
- encodebytes
- standard_b64decode
- standard_b64encode
- urlsafe_b64decode
- urlsafe_b64encode
- zenutils.baseutils
- Null
- zenutils.cacheutils
- ReqIdCache
- cache
- get_cached_value
- simple_cache
- zenutils.cipherutils
- Base64Encoder
- CipherBase
- DecryptFailed
- EncoderBase
- HexlifyEncoder
- IvCipher
- IvfCipher
- MappingCipher
- RawDataEncoder
- S12Cipher
- S1Cipher
- S2Cipher
- SafeBase64Encoder
- Utf8Encoder
- zenutils.dateutils
- get_days
- get_months
- get_years
- zenutils.dictutils
- HttpHeadersDict
- Object
- attrgetorset
- attrset
- change
- changes
- deep_merge
- diff
- fix_object
- ignore_none_item
- prefix_key
- select
- to_object
- touch
- update
- zenutils.errorutils
- AccessDenied
- AccountDisabledError
- AccountLockedError
- AccountRemovedError
- AccountStatusError
- AccountTemporaryLockedError
- AnotherServiceError
- AppAuthFailed
- AuthError
- BadParameter
- BadParameterType
- BadResponseContent
- BadUserToken
- BizError
- BizErrorBase
- CacheError
- CaptchaOnlyAllowedOnce
- CaptchaRequired
- CaptchaValidateFailed
- CastFailedError
- CastToBooleanFailed
- CastToFloatFailed
- CastToIntegerFailed
- CastToNumbericFailed
- CastToStringFailed
- ClientLostError
- ConfigError
- DataError
- DatabaseError
- EventNotRegistered
- FormError
- HttpError
- InformalRequestError
- InformalResultPackage
- InformalResultPackage
- LogicError
- LoginRequired
- MessageQueueError
- MissingConfigItem
- MissingField
- MissingParameter
- NetworkError
- NoAccessPermissionError
- NoDeletePermissionError
- NoMatchingRouteFound
- NoPermissionError
- NoPermissionToCleanCacheError
- NoReadPermissionError
- NoUpstreamServerAvailabe
- NoWritePermissionError
- NotSupportedHttpMethod
- NotSupportedTypeToCast
- OK
- ParamError
- ParseJsonError
- PermissionError
- RepeatedlySubmitForm
- ReqeustForbidden
- ReqidDuplicateError
- RequestExpired
- SYSTEM_ERROR_CODE_MAPPING
- ServiceError
- StringTooLong
- StringTooShort
- SysError
- TargetNotFound
- TooLargeRequestError
- TsExpiredError
- TypeError
- UndefinedError
- UserDoesNotExist
- UserPasswordError
- ValueExceedsMaxLimit
- ValueLessThanMinLimit
- WrongFieldType
- WrongParameterType
- clean_language_name
- get_error_info
- get_language
- set_error_info
- set_language
- zenutils.fsutils
- TemporaryFile
- copy
- expand
- file_content_replace
- filecopy
- first_exists_file
- get_application_config_filepath
- get_application_config_paths
- get_safe_filename
- get_size_deviation
- get_size_display
- get_swap_filename
- get_temp_workspace
- get_unit_size
- info
- mkdir
- move
- pathjoin
- readfile
- rename
- rm
- safe_write
- size_unit_names
- size_unit_upper_limit
- touch
- treecopy
- write
- zenutils.funcutils
- BunchCallable
- ChainableProxy
- call_with_inject
- chain
- classproperty
- get_all_builtin_exceptions
- get_builtins_dict
- get_class_name
- get_default_values
- get_inject_params
- get_method_help
- get_method_signature
- inspect
- is_a_class
- isclass
- mcall_with_inject
- signature
- try_again_on_error
- zenutils.hashutils
- Base64ResultEncoder
- Blake2BHexlifyPasswordHash
- Blake2BPbkdf2PasswordHash
- Blake2BPbkdf2PasswordHashColon
- Blake2BSimplePasswordHash
- Blake2BSimpleSaltPasswordHash
- Blake2SHexlifyPasswordHash
- Blake2SPbkdf2PasswordHash
- Blake2SPbkdf2PasswordHashColon
- Blake2SSimplePasswordHash
- Blake2SSimpleSaltPasswordHash
- DigestResultEncoder
- HexlifyPasswordHashBase
- HexlifyResultEncoder
- Md5HexlifyPasswordHash
- Md5Pbkdf2PasswordHash
- Md5Pbkdf2PasswordHashColon
- Md5SimplePasswordHash
- Md5SimpleSaltPasswordHash
- PasswordHashMethodBase
- PasswordHashMethodNotSupportError
- Pbkdf2PasswordHashBase
- ResultEncoderBase
- Sha1HexlifyPasswordHash
- Sha1Pbkdf2PasswordHash
- Sha1Pbkdf2PasswordHashColon
- Sha1SimplePasswordHash
- Sha1SimpleSaltPasswordHash
- Sha224HexlifyPasswordHash
- Sha224Pbkdf2PasswordHash
- Sha224Pbkdf2PasswordHashColon
- Sha224SimplePasswordHash
- Sha224SimpleSaltPasswordHash
- Sha256HexlifyPasswordHash
- Sha256Pbkdf2PasswordHash
- Sha256Pbkdf2PasswordHashColon
- Sha256SimplePasswordHash
- Sha256SimpleSaltPasswordHash
- Sha384HexlifyPasswordHash
- Sha384Pbkdf2PasswordHash
- Sha384Pbkdf2PasswordHashColon
- Sha384SimplePasswordHash
- Sha384SimpleSaltPasswordHash
- Sha3_224HexlifyPasswordHash
- Sha3_224Pbkdf2PasswordHash
- Sha3_224Pbkdf2PasswordHashColon
- Sha3_224SimplePasswordHash
- Sha3_224SimpleSaltPasswordHash
- Sha3_256HexlifyPasswordHash
- Sha3_256Pbkdf2PasswordHash
- Sha3_256Pbkdf2PasswordHashColon
- Sha3_256SimplePasswordHash
- Sha3_256SimpleSaltPasswordHash
- Sha3_384HexlifyPasswordHash
- Sha3_384Pbkdf2PasswordHash
- Sha3_384Pbkdf2PasswordHashColon
- Sha3_384SimplePasswordHash
- Sha3_384SimpleSaltPasswordHash
- Sha3_512HexlifyPasswordHash
- Sha3_512Pbkdf2PasswordHash
- Sha3_512Pbkdf2PasswordHashColon
- Sha3_512SimplePasswordHash
- Sha3_512SimpleSaltPasswordHash
- Sha512HexlifyPasswordHash
- Sha512Pbkdf2PasswordHash
- Sha512Pbkdf2PasswordHashColon
- Sha512SimplePasswordHash
- Sha512SimpleSaltPasswordHash
- ShaHexlifyPasswordHash
- ShaPbkdf2PasswordHash
- ShaPbkdf2PasswordHashColon
- ShaSimplePasswordHash
- ShaSimpleSaltPasswordHash
- SimplePasswordHashBase
- SimpleSaltPasswordHashBase
- Sm3HexlifyPasswordHash
- Sm3Pbkdf2PasswordHash
- Sm3Pbkdf2PasswordHashColon
- Sm3SimplePasswordHash
- Sm3SimpleSaltPasswordHash
- Xxh128HexlifyPasswordHash
- Xxh128Pbkdf2PasswordHash
- Xxh128Pbkdf2PasswordHashColon
- Xxh128SimplePasswordHash
- Xxh128SimpleSaltPasswordHash
- Xxh32HexlifyPasswordHash
- Xxh32Pbkdf2PasswordHash
- Xxh32Pbkdf2PasswordHashColon
- Xxh32SimplePasswordHash
- Xxh32SimpleSaltPasswordHash
- Xxh64HexlifyPasswordHash
- Xxh64Pbkdf2PasswordHash
- Xxh64Pbkdf2PasswordHashColon
- Xxh64SimplePasswordHash
- Xxh64SimpleSaltPasswordHash
- algorithms_available
- get_blake2b
- get_blake2b_base64
- get_blake2b_digest
- get_blake2b_hexdigest
- get_blake2s
- get_blake2s_base64
- get_blake2s_digest
- get_blake2s_hexdigest
- get_file_blake2b
- get_file_blake2b_base64
- get_file_blake2b_digest
- get_file_blake2b_hexdigest
- get_file_blake2s
- get_file_blake2s_base64
- get_file_blake2s_digest
- get_file_blake2s_hexdigest
- get_file_hash
- get_file_hash_base64
- get_file_hash_hexdigest
- get_file_hash_result
- get_file_md5
- get_file_md5_base64
- get_file_md5_digest
- get_file_md5_hexdigest
- get_file_sha
- get_file_sha1
- get_file_sha1_base64
- get_file_sha1_digest
- get_file_sha1_hexdigest
- get_file_sha224
- get_file_sha224_base64
- get_file_sha224_digest
- get_file_sha224_hexdigest
- get_file_sha256
- get_file_sha256_base64
- get_file_sha256_digest
- get_file_sha256_hexdigest
- get_file_sha384
- get_file_sha384_base64
- get_file_sha384_digest
- get_file_sha384_hexdigest
- get_file_sha3_224
- get_file_sha3_224_base64
- get_file_sha3_224_digest
- get_file_sha3_224_hexdigest
- get_file_sha3_256
- get_file_sha3_256_base64
- get_file_sha3_256_digest
- get_file_sha3_256_hexdigest
- get_file_sha3_384
- get_file_sha3_384_base64
- get_file_sha3_384_digest
- get_file_sha3_384_hexdigest
- get_file_sha3_512
- get_file_sha3_512_base64
- get_file_sha3_512_digest
- get_file_sha3_512_hexdigest
- get_file_sha512
- get_file_sha512_base64
- get_file_sha512_digest
- get_file_sha512_hexdigest
- get_file_sha_base64
- get_file_sha_digest
- get_file_sha_hexdigest
- get_file_sm3
- get_file_sm3_base64
- get_file_sm3_digest
- get_file_sm3_hexdigest
- get_file_xxh128
- get_file_xxh128_base64
- get_file_xxh128_digest
- get_file_xxh128_hexdigest
- get_file_xxh32
- get_file_xxh32_base64
- get_file_xxh32_digest
- get_file_xxh32_hexdigest
- get_file_xxh64
- get_file_xxh64_base64
- get_file_xxh64_digest
- get_file_xxh64_hexdigest
- get_hash
- get_hash_base64
- get_hash_digest
- get_hash_hexdigest
- get_hash_result
- get_md5
- get_md5_base64
- get_md5_digest
- get_md5_hexdigest
- get_password_hash
- get_password_hash_methods
- get_pbkdf2_blake2b
- get_pbkdf2_blake2s
- get_pbkdf2_hmac
- get_pbkdf2_md5
- get_pbkdf2_sha
- get_pbkdf2_sha1
- get_pbkdf2_sha224
- get_pbkdf2_sha256
- get_pbkdf2_sha384
- get_pbkdf2_sha3_224
- get_pbkdf2_sha3_256
- get_pbkdf2_sha3_384
- get_pbkdf2_sha3_512
- get_pbkdf2_sha512
- get_pbkdf2_sm3
- get_pbkdf2_xxh128
- get_pbkdf2_xxh32
- get_pbkdf2_xxh64
- get_salted_hash_base64
- get_sha
- get_sha1
- get_sha1_base64
- get_sha1_digest
- get_sha1_hexdigest
- get_sha224
- get_sha224_base64
- get_sha224_digest
- get_sha224_hexdigest
- get_sha256
- get_sha256_base64
- get_sha256_digest
- get_sha256_hexdigest
- get_sha384
- get_sha384_base64
- get_sha384_digest
- get_sha384_hexdigest
- get_sha3_224
- get_sha3_224_base64
- get_sha3_224_digest
- get_sha3_224_hexdigest
- get_sha3_256
- get_sha3_256_base64
- get_sha3_256_digest
- get_sha3_256_hexdigest
- get_sha3_384
- get_sha3_384_base64
- get_sha3_384_digest
- get_sha3_384_hexdigest
- get_sha3_512
- get_sha3_512_base64
- get_sha3_512_digest
- get_sha3_512_hexdigest
- get_sha512
- get_sha512_base64
- get_sha512_digest
- get_sha512_hexdigest
- get_sha_base64
- get_sha_digest
- get_sha_hexdigest
- get_sm3
- get_sm3_base64
- get_sm3_digest
- get_sm3_hexdigest
- get_xxh128
- get_xxh128_base64
- get_xxh128_digest
- get_xxh128_hexdigest
- get_xxh32
- get_xxh32_base64
- get_xxh32_digest
- get_xxh32_hexdigest
- get_xxh64
- get_xxh64_base64
- get_xxh64_digest
- get_xxh64_hexdigest
- is_the_same_hash_method
- method_load
- new
- pbkdf2_hmac
- register_hexlify_password_hash
- register_password_hash_method
- register_pbkdf2_password_hash
- register_simple_password_hash
- register_simple_salt_password_hash
- setup_hash_method_loader
- validate_password_hash
- validate_pbkdf2_blake2b
- validate_pbkdf2_blake2s
- validate_pbkdf2_hmac
- validate_pbkdf2_md5
- validate_pbkdf2_sha
- validate_pbkdf2_sha1
- validate_pbkdf2_sha224
- validate_pbkdf2_sha256
- validate_pbkdf2_sha384
- validate_pbkdf2_sha3_224
- validate_pbkdf2_sha3_256
- validate_pbkdf2_sha3_384
- validate_pbkdf2_sha3_512
- validate_pbkdf2_sha512
- validate_pbkdf2_sm3
- validate_pbkdf2_xxh128
- validate_pbkdf2_xxh32
- validate_pbkdf2_xxh64
- zenutils.httputils
- download
- get_sitename
- get_url_filename
- get_url_save_path
- get_urlinfo
- urlparse
- zenutils.importutils
- get_caller_globals
- get_caller_locals
- import_from_string
- import_module
- zenutils.jsonutils
- SimpleJsonEncoder
- make_simple_json_encoder
- register_global_encoder
- simple_json_dumps
- zenutils.listutils
- append_new
- chunk
- clean_none
- compare
- compare_execute
- first
- group
- ignore_none_element
- int_list_to_bytes
- is_ordered
- list2dict
- pad
- replace
- topological_sort
- topological_test
- unique
- zenutils.logutils
- get_console_handler
- get_file_handler
- get_simple_config
- setup
- zenutils.nameutils
- get_last_names
- get_random_name
- get_suggest_first_names
- guess_lastname
- guess_surname
- zenutils.numericutils
- _infinity
- binary_decompose
- bytes2ints
- decimal_change_base
- float_split
- from_bytes
- get_float_part
- infinity
- int2bytes
- ints2bytes
- is_infinity
- ninfinity
- pinfinity
- zenutils.packutils
- AbstractResultPacker
- RcmPacker
- zenutils.perfutils
- timeit
- zenutils.randomutils
- Lcg31Random
- Random
- UuidGenerator
- choices
- get_password_seed32
- uuid1
- uuid3
- uuid4
- uuid5
- zenutils.serviceutils
- DebugService
- ServiceBase
- zenutils.sixutils
- BASESTRING_TYPES
- BYTES
- BYTES_TYPE
- INT_TO_BYTES
- NUMERIC_TYPES
- PY2
- PY3
- STR_TYPE
- TEXT
- bchar
- bstr_to_array
- bytes_to_array
- create_new_class
- default_encoding
- default_encodings
- force_bytes
- force_text
- unicode
- zenutils.socketserverutils
- NStreamExchangeProtocolBase
- ServerEngineBase
- ServerHandle
- zenutils.strutils
- BAI
- BASE64_CHARS
- HEXLIFY_CHARS
- QIAN
- SHI
- StrUtils
- URLSAFEB64_CHARS
- WAN
- YI
- binarify
- bytes2ints
- camel
- captital_number
- char_force_to_int
- chunk
- clean
- combinations
- combinations2
- decodable
- default_cn_digits
- default_cn_float_places
- default_cn_negative
- default_cn_places
- default_cn_yuan
- default_encoding
- default_encodings
- default_quotes
- default_random_string_choices
- do_clean
- encodable
- force_float
- force_int
- force_numberic
- force_type_to
- format_with_mapping
- get_all_substrings
- get_base64image
- get_image_bytes
- html_element_css_append
- int2bytes
- ints2bytes
- is_base64_decodable
- is_chinese_character
- is_hex_digits
- is_str_composed_by_the_choices
- is_unhexlifiable
- is_urlsafeb64_decodable
- is_uuid
- join_lines
- no_mapping
- none_to_empty_string
- parse_base64image
- random_string
- remove_prefix
- remove_suffix
- reverse
- simple_cn_yuan
- simplesplit
- smart_get_binary_data
- split
- split2
- str_composed_by
- stringlist_append
- strip_string
- substrings
- text_display_length
- text_display_shorten
- unbinarify
- unquote
- wholestrip
- zenutils.sysutils
- default_timeout_kill
- execute_script
- get_current_thread_id
- get_node_ip
- get_random_script_name
- get_worker_id
- psutil_timeout_kill
- zenutils.threadutils
- ConcurrentLimitJobQueue
- Counter
- Future
- JobExecuteTimeout
- JobQueue
- JobResultNotSet
- LoopIdle
- Service
- ServiceStop
- ServiceTerminate
- SimpleConsumer
- SimpleProducer
- SimpleProducerConsumerServer
- SimpleServer
- StartOnTerminatedService
- zenutils.treeutils
- SimpleRouterTree
- build_tree
- print_tree
- print_tree_callback
- tree_walk
- zenutils.typingutils
- Number
- STRING_ENCODINGS
- register_global_caster
- smart_cast
- zenutils.xmlrpcutils
- SimpleAuthMixin
- SimpleAuthSafeTransport
- SimpleAuthTransport
Compatibility
Test passed with python versions:
- Python 2.7 passed
- Python 3.2 passed
- Python 3.3 passed
- Python 3.4 passed
- Python 3.5 passed
- Python 3.7 passed
- Python 3.8 passed
- Python 3.9 passed
- Python 3.10 passed
- Python 3.11 passed
Release
v0.1.0
- First release.
v0.2.0
- Add treeutils.SimpleRouterTree.
- Add randomutils.HashPrng.
- Add hashutils.get_password_hash and hashutils.validate_password_hash.
- Add dictutils.HttpHeadersDict.
- Add sysutils.get_node_ip.
v0.3.1
- Add funcutils.retry.
- Fix hashutils.validate_password_hash problem.
v0.3.2
- Add sm3 hash support in hashutils.
- Add xxhash hash support in hashutils.
- Export hashutils.pbkdf2_hmac to work with your self defined hash methods.
- Fix problem in sysutils.get_random_script_name on windows.
- Fix path string problem in tests.test_httputils on windows.
v0.3.3
- Fix funcutils.isclass can not detect classes with metaclass. Use inspect.isclass instead.
- Add cacheutils.cache.
v0.3.5
- Change default log file path from
pwd
/app.log topwd
/logs/app.log. - Add fsutils.get_swap_filename.
- Add fsutils.safe_write.
- Add fsutils.get_safe_filename.
v0.3.6
- Add sixutils.create_new_class.
- Fix hashutils problem in python3.3 and below.
- Extend numericutils.int2bytes as int.to_bytes.
V0.3.7
- Add randomutils.Lcg31Random.
- Add randomutils.get_password_seed32.
v0.3.8
- Fix force_text in handling NON-STR type data.
v0.3.9
- Add delete_script parameter in fsutils.execute_script.
v0.3.12
- dictutils.Object add select method.
- Add errorutils.
- Add packutils.
- Add perfutils.
- Add serviceutils.
v0.3.15
- Add serviceutils.ServerEngineBase.
v0.3.16
- Rename serviceutils.ServerEngineBase to socketserverutils.ServerEngineBase.
- Add socketserverutils.NStreamExchangeProtocolBase.
- Add ServerHandle.
v0.3.19
- Fix NStreamExchangeProtocolBase makefile buffering problem for py2.7.
- Fix log format problem in old version python.
- Add more exception classes in errorutils.
- Add dateutils.
- Add errorutils.AuthenticationRequired.
v0.3.23
- Fix logger.error missing msg problem.
- Add threadutils.ConcurrentLimitJobQueue.
v0.4.8
- Fix *args problem in call_with_inject.
- Change serviceutils.ServiceBase.register_to.
- Add cacheutils.ReqIdCache.
- Add xmlrpcutils.SimpleAuthTransport.
- Add xmlrpcutils.SimpleAuthSafeTransport.
- Add threadutils.JobQueue.
- Add threadutils.Future.
- Add funcutils.get_method_help.
- Add funcutils.get_method_signature.
v0.4.9
- Add cacheutils.simple_cache.
v0.4.10
- Fix readme document.
- Fix pylint warnings.
- Unit test problems fix.
v0.5.0
- Add sixutils.unicode.
v0.5.1
- Fix logutils default format missing space between thread and module fields.
v0.5.2
- Add hashutils.get_hash_digest.
- Add log_to_console and log_to_file option in logutils.get_simple_config.
v0.5.3
- Fix jsonutils.simple_json_dumps for set value problem.
v0.5.4
- fsutils.safe_write add timestr suffix.
v0.5.5
- Remove tests from release package.
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
zenutils-0.5.5.tar.gz
(88.9 kB
view hashes)
Built Distributions
zenutils-0.5.5-py32-none-any.whl
(94.4 kB
view hashes)
zenutils-0.5.5-py3-none-any.whl
(94.4 kB
view hashes)
zenutils-0.5.5-py2-none-any.whl
(94.4 kB
view hashes)
Close
Hashes for zenutils-0.5.5-py32-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0903c3777b3dbb9ebd2fe136b953c9c38d214426d3346630a2f6a3a7363e49c5 |
|
MD5 | 522fc675f4c8009d3efc22090809e2f0 |
|
BLAKE2b-256 | da4648cf4109d4893fe9c348baf5dd4c0e949bfb6870416dcf1b0f56f326b59d |