Skip to main content

Collection of simple utils.

Project description

fastutils

Collection of simple utils.

Install

pip install fastutils

Tested With Python

  • 2.7
  • 3.3
  • 3.4
  • 3.5
  • 3.6
  • 3.7
  • 3.8
  • 3.9
  • 3.10
  • 3.11

Installed utils

  1. fastutils.aesutils
    1. AES_BLOCK_SIZE
    2. decrypt
    3. decrypt_and_base64decode
    4. decrypt_and_safeb64decode
    5. decrypt_and_unhexlify
    6. encrypt
    7. encrypt_and_base64encode
    8. encrypt_and_hexlify
    9. encrypt_and_safeb64encode
    10. get_aes_mode
    11. get_md5_key
    12. get_mysql_aes_key
    13. get_padding_remove_method
    14. get_raw_aes_key
    15. get_sha1prng_key
    16. padding_ansix923
    17. padding_iso10126
    18. padding_pkcs5
    19. remove_padding_ansix923
    20. remove_padding_iso10126
    21. remove_padding_pkcs5
  2. fastutils.cacheutils
    1. ReqIdCache
    2. cache
    3. get_cached_value
    4. simple_cache
  3. fastutils.cipherutils
    1. AesCipher
    2. AesCtrCipher
    3. AesGcmCipher
    4. Base64Encoder
    5. CipherBase
    6. DecryptFailed
    7. EncoderBase
    8. HexlifyEncoder
    9. IvCipher
    10. IvfCipher
    11. MappingCipher
    12. MysqlAesCipher
    13. RawDataEncoder
    14. RawKeyAesCipher
    15. RsaCipher
    16. S12Cipher
    17. S1Cipher
    18. S2Cipher
    19. SafeBase64Encoder
    20. Utf8Encoder
    21. aes_padding_ansix923
    22. aes_padding_iso10126
    23. aes_padding_pkcs5
    24. get_aes_mode
    25. md5_key
    26. mysql_aes_key
    27. sha1prng_key
  4. fastutils.dictutils
    1. HttpHeadersDict
    2. Object
    3. attrgetorset
    4. attrset
    5. change
    6. changes
    7. deep_merge
    8. diff
    9. fix_object
    10. ignore_none_item
    11. prefix_key
    12. select
    13. to_object
    14. touch
    15. update
  5. fastutils.fsutils
    1. TemporaryFile
    2. copy
    3. expand
    4. file_content_replace
    5. filecopy
    6. first_exists_file
    7. get_application_config_filepath
    8. get_application_config_paths
    9. get_safe_filename
    10. get_size_deviation
    11. get_size_display
    12. get_swap_filename
    13. get_temp_workspace
    14. get_unit_size
    15. info
    16. load_application_config
    17. mkdir
    18. move
    19. pathjoin
    20. readfile
    21. rename
    22. rm
    23. safe_write
    24. size_unit_names
    25. size_unit_upper_limit
    26. touch
    27. treecopy
    28. write
  6. fastutils.funcutils
    1. BunchCallable
    2. ChainableProxy
    3. call_with_inject
    4. chain
    5. classproperty
    6. get_all_builtin_exceptions
    7. get_builtins_dict
    8. get_class_name
    9. get_default_values
    10. get_inject_params
    11. get_method_help
    12. get_method_signature
    13. inspect
    14. is_a_class
    15. isclass
    16. mcall_with_inject
    17. signature
    18. try_again_on_error
  7. fastutils.hashutils
    1. Base64ResultEncoder
    2. Blake2BHexlifyPasswordHash
    3. Blake2BPbkdf2PasswordHash
    4. Blake2BPbkdf2PasswordHashColon
    5. Blake2BSimplePasswordHash
    6. Blake2BSimpleSaltPasswordHash
    7. Blake2SHexlifyPasswordHash
    8. Blake2SPbkdf2PasswordHash
    9. Blake2SPbkdf2PasswordHashColon
    10. Blake2SSimplePasswordHash
    11. Blake2SSimpleSaltPasswordHash
    12. DigestResultEncoder
    13. HexlifyPasswordHashBase
    14. HexlifyResultEncoder
    15. Md5HexlifyPasswordHash
    16. Md5Pbkdf2PasswordHash
    17. Md5Pbkdf2PasswordHashColon
    18. Md5SimplePasswordHash
    19. Md5SimpleSaltPasswordHash
    20. PasswordHashMethodBase
    21. PasswordHashMethodNotSupportError
    22. Pbkdf2PasswordHashBase
    23. ResultEncoderBase
    24. Sha1HexlifyPasswordHash
    25. Sha1Pbkdf2PasswordHash
    26. Sha1Pbkdf2PasswordHashColon
    27. Sha1SimplePasswordHash
    28. Sha1SimpleSaltPasswordHash
    29. Sha224HexlifyPasswordHash
    30. Sha224Pbkdf2PasswordHash
    31. Sha224Pbkdf2PasswordHashColon
    32. Sha224SimplePasswordHash
    33. Sha224SimpleSaltPasswordHash
    34. Sha256HexlifyPasswordHash
    35. Sha256Pbkdf2PasswordHash
    36. Sha256Pbkdf2PasswordHashColon
    37. Sha256SimplePasswordHash
    38. Sha256SimpleSaltPasswordHash
    39. Sha384HexlifyPasswordHash
    40. Sha384Pbkdf2PasswordHash
    41. Sha384Pbkdf2PasswordHashColon
    42. Sha384SimplePasswordHash
    43. Sha384SimpleSaltPasswordHash
    44. Sha3_224HexlifyPasswordHash
    45. Sha3_224Pbkdf2PasswordHash
    46. Sha3_224Pbkdf2PasswordHashColon
    47. Sha3_224SimplePasswordHash
    48. Sha3_224SimpleSaltPasswordHash
    49. Sha3_256HexlifyPasswordHash
    50. Sha3_256Pbkdf2PasswordHash
    51. Sha3_256Pbkdf2PasswordHashColon
    52. Sha3_256SimplePasswordHash
    53. Sha3_256SimpleSaltPasswordHash
    54. Sha3_384HexlifyPasswordHash
    55. Sha3_384Pbkdf2PasswordHash
    56. Sha3_384Pbkdf2PasswordHashColon
    57. Sha3_384SimplePasswordHash
    58. Sha3_384SimpleSaltPasswordHash
    59. Sha3_512HexlifyPasswordHash
    60. Sha3_512Pbkdf2PasswordHash
    61. Sha3_512Pbkdf2PasswordHashColon
    62. Sha3_512SimplePasswordHash
    63. Sha3_512SimpleSaltPasswordHash
    64. Sha512HexlifyPasswordHash
    65. Sha512Pbkdf2PasswordHash
    66. Sha512Pbkdf2PasswordHashColon
    67. Sha512SimplePasswordHash
    68. Sha512SimpleSaltPasswordHash
    69. ShaHexlifyPasswordHash
    70. ShaPbkdf2PasswordHash
    71. ShaPbkdf2PasswordHashColon
    72. ShaSimplePasswordHash
    73. ShaSimpleSaltPasswordHash
    74. SimplePasswordHashBase
    75. SimpleSaltPasswordHashBase
    76. Sm3HexlifyPasswordHash
    77. Sm3Pbkdf2PasswordHash
    78. Sm3Pbkdf2PasswordHashColon
    79. Sm3SimplePasswordHash
    80. Sm3SimpleSaltPasswordHash
    81. Xxh128HexlifyPasswordHash
    82. Xxh128Pbkdf2PasswordHash
    83. Xxh128Pbkdf2PasswordHashColon
    84. Xxh128SimplePasswordHash
    85. Xxh128SimpleSaltPasswordHash
    86. Xxh32HexlifyPasswordHash
    87. Xxh32Pbkdf2PasswordHash
    88. Xxh32Pbkdf2PasswordHashColon
    89. Xxh32SimplePasswordHash
    90. Xxh32SimpleSaltPasswordHash
    91. Xxh64HexlifyPasswordHash
    92. Xxh64Pbkdf2PasswordHash
    93. Xxh64Pbkdf2PasswordHashColon
    94. Xxh64SimplePasswordHash
    95. Xxh64SimpleSaltPasswordHash
    96. algorithms_available
    97. get_blake2b
    98. get_blake2b_base64
    99. get_blake2b_digest
    100. get_blake2b_hexdigest
    101. get_blake2s
    102. get_blake2s_base64
    103. get_blake2s_digest
    104. get_blake2s_hexdigest
    105. get_file_blake2b
    106. get_file_blake2b_base64
    107. get_file_blake2b_digest
    108. get_file_blake2b_hexdigest
    109. get_file_blake2s
    110. get_file_blake2s_base64
    111. get_file_blake2s_digest
    112. get_file_blake2s_hexdigest
    113. get_file_hash
    114. get_file_hash_base64
    115. get_file_hash_hexdigest
    116. get_file_hash_result
    117. get_file_md5
    118. get_file_md5_base64
    119. get_file_md5_digest
    120. get_file_md5_hexdigest
    121. get_file_sha
    122. get_file_sha1
    123. get_file_sha1_base64
    124. get_file_sha1_digest
    125. get_file_sha1_hexdigest
    126. get_file_sha224
    127. get_file_sha224_base64
    128. get_file_sha224_digest
    129. get_file_sha224_hexdigest
    130. get_file_sha256
    131. get_file_sha256_base64
    132. get_file_sha256_digest
    133. get_file_sha256_hexdigest
    134. get_file_sha384
    135. get_file_sha384_base64
    136. get_file_sha384_digest
    137. get_file_sha384_hexdigest
    138. get_file_sha3_224
    139. get_file_sha3_224_base64
    140. get_file_sha3_224_digest
    141. get_file_sha3_224_hexdigest
    142. get_file_sha3_256
    143. get_file_sha3_256_base64
    144. get_file_sha3_256_digest
    145. get_file_sha3_256_hexdigest
    146. get_file_sha3_384
    147. get_file_sha3_384_base64
    148. get_file_sha3_384_digest
    149. get_file_sha3_384_hexdigest
    150. get_file_sha3_512
    151. get_file_sha3_512_base64
    152. get_file_sha3_512_digest
    153. get_file_sha3_512_hexdigest
    154. get_file_sha512
    155. get_file_sha512_base64
    156. get_file_sha512_digest
    157. get_file_sha512_hexdigest
    158. get_file_sha_base64
    159. get_file_sha_digest
    160. get_file_sha_hexdigest
    161. get_file_sm3
    162. get_file_sm3_base64
    163. get_file_sm3_digest
    164. get_file_sm3_hexdigest
    165. get_file_xxh128
    166. get_file_xxh128_base64
    167. get_file_xxh128_digest
    168. get_file_xxh128_hexdigest
    169. get_file_xxh32
    170. get_file_xxh32_base64
    171. get_file_xxh32_digest
    172. get_file_xxh32_hexdigest
    173. get_file_xxh64
    174. get_file_xxh64_base64
    175. get_file_xxh64_digest
    176. get_file_xxh64_hexdigest
    177. get_hash
    178. get_hash_base64
    179. get_hash_hexdigest
    180. get_hash_result
    181. get_md5
    182. get_md5_base64
    183. get_md5_digest
    184. get_md5_hexdigest
    185. get_password_hash
    186. get_password_hash_methods
    187. get_pbkdf2_blake2b
    188. get_pbkdf2_blake2s
    189. get_pbkdf2_hmac
    190. get_pbkdf2_md5
    191. get_pbkdf2_sha
    192. get_pbkdf2_sha1
    193. get_pbkdf2_sha224
    194. get_pbkdf2_sha256
    195. get_pbkdf2_sha384
    196. get_pbkdf2_sha3_224
    197. get_pbkdf2_sha3_256
    198. get_pbkdf2_sha3_384
    199. get_pbkdf2_sha3_512
    200. get_pbkdf2_sha512
    201. get_pbkdf2_sm3
    202. get_pbkdf2_xxh128
    203. get_pbkdf2_xxh32
    204. get_pbkdf2_xxh64
    205. get_salted_hash_base64
    206. get_sha
    207. get_sha1
    208. get_sha1_base64
    209. get_sha1_digest
    210. get_sha1_hexdigest
    211. get_sha224
    212. get_sha224_base64
    213. get_sha224_digest
    214. get_sha224_hexdigest
    215. get_sha256
    216. get_sha256_base64
    217. get_sha256_digest
    218. get_sha256_hexdigest
    219. get_sha384
    220. get_sha384_base64
    221. get_sha384_digest
    222. get_sha384_hexdigest
    223. get_sha3_224
    224. get_sha3_224_base64
    225. get_sha3_224_digest
    226. get_sha3_224_hexdigest
    227. get_sha3_256
    228. get_sha3_256_base64
    229. get_sha3_256_digest
    230. get_sha3_256_hexdigest
    231. get_sha3_384
    232. get_sha3_384_base64
    233. get_sha3_384_digest
    234. get_sha3_384_hexdigest
    235. get_sha3_512
    236. get_sha3_512_base64
    237. get_sha3_512_digest
    238. get_sha3_512_hexdigest
    239. get_sha512
    240. get_sha512_base64
    241. get_sha512_digest
    242. get_sha512_hexdigest
    243. get_sha_base64
    244. get_sha_digest
    245. get_sha_hexdigest
    246. get_sm3
    247. get_sm3_base64
    248. get_sm3_digest
    249. get_sm3_hexdigest
    250. get_xxh128
    251. get_xxh128_base64
    252. get_xxh128_digest
    253. get_xxh128_hexdigest
    254. get_xxh32
    255. get_xxh32_base64
    256. get_xxh32_digest
    257. get_xxh32_hexdigest
    258. get_xxh64
    259. get_xxh64_base64
    260. get_xxh64_digest
    261. get_xxh64_hexdigest
    262. is_the_same_hash_method
    263. method_load
    264. new
    265. pbkdf2_hmac
    266. register_hexlify_password_hash
    267. register_password_hash_method
    268. register_pbkdf2_password_hash
    269. register_simple_password_hash
    270. register_simple_salt_password_hash
    271. setup_hash_method_loader
    272. validate_password_hash
    273. validate_pbkdf2_blake2b
    274. validate_pbkdf2_blake2s
    275. validate_pbkdf2_hmac
    276. validate_pbkdf2_md5
    277. validate_pbkdf2_sha
    278. validate_pbkdf2_sha1
    279. validate_pbkdf2_sha224
    280. validate_pbkdf2_sha256
    281. validate_pbkdf2_sha384
    282. validate_pbkdf2_sha3_224
    283. validate_pbkdf2_sha3_256
    284. validate_pbkdf2_sha3_384
    285. validate_pbkdf2_sha3_512
    286. validate_pbkdf2_sha512
    287. validate_pbkdf2_sm3
    288. validate_pbkdf2_xxh128
    289. validate_pbkdf2_xxh32
    290. validate_pbkdf2_xxh64
  8. fastutils.httputils
    1. download
    2. get_sitename
    3. get_url_filename
    4. get_url_save_path
    5. get_urlinfo
    6. urlparse
  9. fastutils.imageutils
    1. get_base64image
    2. get_image_bytes
    3. parse_base64image
    4. resize
    5. resize_to_fixed_height
    6. resize_to_fixed_width
  10. fastutils.jsonutils
    1. SimpleJsonEncoder
    2. make_simple_json_encoder
    3. register_global_encoder
    4. simple_json_dumps
  11. fastutils.listutils
    1. append_new
    2. chunk
    3. clean_none
    4. compare
    5. compare_execute
    6. first
    7. group
    8. ignore_none_element
    9. int_list_to_bytes
    10. is_ordered
    11. list2dict
    12. pad
    13. replace
    14. topological_sort
    15. topological_test
    16. unique
  12. fastutils.logutils
    1. get_console_handler
    2. get_file_handler
    3. get_simple_config
    4. setup
  13. fastutils.msgpackutils
    1. EmptyMsgData
    2. Msg
    3. MsgDecryptFailed
    4. WrongMsgType
    5. dumps
    6. loads
  14. fastutils.nameutils
    1. get_last_names
    2. get_random_name
    3. get_suggest_first_names
    4. guess_lastname
    5. guess_surname
  15. fastutils.numericutils
    1. _infinity
    2. binary_decompose
    3. bytes2ints
    4. decimal_change_base
    5. float_split
    6. from_bytes
    7. get_float_part
    8. infinity
    9. int2bytes
    10. ints2bytes
    11. is_infinity
    12. ninfinity
    13. pinfinity
  16. fastutils.pinyinutils
    1. to_pinyin
  17. fastutils.randomutils
    1. Lcg31Random
    2. Random
    3. UuidGenerator
    4. choices
    5. get_password_seed32
    6. uuid1
    7. uuid3
    8. uuid4
    9. uuid5
  18. fastutils.rsautils
    1. decrypt
    2. encrypt
    3. export_key
    4. get_hash_method
    5. load_private_key
    6. load_public_key
    7. load_public_key_from_private_key
    8. newkeys
    9. sign
    10. verify
  19. fastutils.strutils
    1. BAI
    2. BASE64_CHARS
    3. HEXLIFY_CHARS
    4. QIAN
    5. SHI
    6. StrUtils
    7. URLSAFEB64_CHARS
    8. WAN
    9. YI
    10. binarify
    11. bytes2ints
    12. camel
    13. captital_number
    14. char_force_to_int
    15. chunk
    16. clean
    17. combinations
    18. combinations2
    19. decodable
    20. default_cn_digits
    21. default_cn_float_places
    22. default_cn_negative
    23. default_cn_places
    24. default_cn_yuan
    25. default_encoding
    26. default_encodings
    27. default_quotes
    28. default_random_string_choices
    29. do_clean
    30. encodable
    31. force_float
    32. force_int
    33. force_numberic
    34. force_type_to
    35. format_with_mapping
    36. get_all_substrings
    37. get_base64image
    38. get_image_bytes
    39. html_element_css_append
    40. int2bytes
    41. ints2bytes
    42. is_base64_decodable
    43. is_chinese_character
    44. is_hex_digits
    45. is_str_composed_by_the_choices
    46. is_unhexlifiable
    47. is_urlsafeb64_decodable
    48. is_uuid
    49. join_lines
    50. no_mapping
    51. none_to_empty_string
    52. parse_base64image
    53. random_string
    54. remove_prefix
    55. remove_suffix
    56. reverse
    57. simple_cn_yuan
    58. simplesplit
    59. smart_get_binary_data
    60. split
    61. split2
    62. str_composed_by
    63. stringlist_append
    64. strip_string
    65. substrings
    66. text_display_length
    67. text_display_shorten
    68. unbinarify
    69. unquote
    70. wholestrip
  20. fastutils.sysutils
    1. default_timeout_kill
    2. execute_script
    3. get_current_thread_id
    4. get_daemon_application_pid
    5. get_node_ip
    6. get_random_script_name
    7. get_worker_id
    8. get_worker_info
    9. psutil_timeout_kill
  21. fastutils.threadutils
    1. ConcurrentLimitJobQueue
    2. Counter
    3. Future
    4. JobExecuteTimeout
    5. JobQueue
    6. JobResultNotSet
    7. LoopIdle
    8. Service
    9. ServiceStop
    10. ServiceTerminate
    11. SimpleConsumer
    12. SimpleProducer
    13. SimpleProducerConsumerServer
    14. SimpleServer
    15. StartOnTerminatedService
  22. fastutils.treeutils
    1. SimpleRouterTree
    2. build_tree
    3. print_tree
    4. print_tree_callback
    5. tree_walk
  23. fastutils.typingutils
    1. Number
    2. STRING_ENCODINGS
    3. register_global_caster
    4. smart_cast

Help

See pydoc for help.

python3 -m pydoc -b # start pydoc

Usage Examples

fastutils.strutils.chunk

from fastutils import strutils

In [33]: strutils.chunk('hello', 3)
Out[33]: ['hel', 'lo']

In [34]: strutils.chunk('hello', 6)
Out[34]: ['hello']

In [35]: strutils.chunk('hello', 5)
Out[35]: ['hello']

fastutils.strutils.get_all_substrings

from fastutils import strutils

In [4]: strutils.get_all_substrings('a')
Out[4]: {'a'}

In [5]: strutils.get_all_substrings('ab')
Out[5]: {'a', 'ab', 'b'}

In [6]: strutils.get_all_substrings('abc')
Out[6]: {'a', 'ab', 'abc', 'b', 'bc', 'c'}

In [7]: strutils.get_all_substrings('abcd')
Out[7]: {'a', 'ab', 'abc', 'abcd', 'b', 'bc', 'bcd', 'c', 'cd', 'd'}

fastutils.listutils.list2dict

In [1]: from fastutils import listutils

In [2]: listutils.list2dict([1,2,3], ['a', 'b'])
Out[2]: {'a': 1, 'b': 2}

In [3]: listutils.list2dict([1,2,3], ['a', 'b', 'c'])
Out[3]: {'a': 1, 'b': 2, 'c': 3}

In [4]: listutils.list2dict([1,2,3], ['a', 'b', 'c', 'd'])
Out[4]: {'a': 1, 'b': 2, 'c': 3, 'd': None}

fastutils.listutils.compare_execute

Example 1

from fastutils import listutils

old_list = [1,2,3]
new_list = [2,3,4]

created, deleted, changed = listutils.compare_execute(
      old_data=old_list,
      new_data=new_list,
      create_callback=lambda key, data: data,
      delete_callback=lambda key, instance: instance,
      change_callback=lambda key, instance, data: instance,
      old_key=lambda x: x
)
assert created == [4]
assert deleted == [1]
assert changed == [2, 3]

Example 2

from fastutils import listutils

old_list = [1,2,3]
new_list = [3,4,5]

def do_create(key, data):
   if data > 4:
         return data
   else:
         return None

def do_delete(key, instance):
   if instance > 1:
         return instance
   else:
         return None

def do_change(key, instance, data):
   return None

created, deleted, changed = listutils.compare_execute(
   old_data=old_list,
   new_data=new_list,
   create_callback=do_create,
   delete_callback=do_delete,
   change_callback=do_change,
   old_key=lambda x: x
)
assert created == [5]
assert deleted == [2]
assert changed == []

Releases

v0.43.4

  • Fix rsautils.load_public_key in py2.7.
  • Add log_to_console and log_to_file option in logutils.get_simple_config.

v0.43.3

  • Improve rsautils.load_public_key to load NON-PEM public key.

v0.43.2

  • Improve rsautils.load_private_key to load NON-PEM private key.

v0.43.1

  • Unit test problems fix.
  • Add cipherutils.AesCtrCipher.
  • Add cipherutils.AesGcmCipher.

v0.43.0

  • Doc Update.
  • Add python_requires in setup.
  • Fix sysutils.get_worker_info problem in docker env.

v0.42.14

  • Add fastutils.listutils.compare_execute.
  • Add fastutils.dictutils.Object.fix to fix the Object instance if you added a dict thing to the Objects' list/dict item.

v0.42.13

  • Add fastutils.strutils.get_all_substrings.
  • Add fastutils.listutils.list2dict.

v0.42.11

  • Fix fastutils.cipherutils.CipherBase incompatibility problem.

v0.43.9

  • doc update.

v0.42.8

  • Fix threadutils.Counter incr/decr result value duplicate problem.

v0.42.7

  • Fix logutils formatter missing problem.

v0.42.6

  • Add filelike-methods for fsutils.TemporaryFile.

v0.42.5

  • Add TemporaryFile.open and TemporaryFile.close methods.

v0.42.4

  • Change rsautils.encrypt default envelope method to PKCS1_OAEP, and rsautils.decrypt support both PKCS1_OAEP and PKCS1_v1_5 methods.
  • Add rsautils.sign and resautils.verify methods.

v0.42.3

  • Add console_handler_class and file_handler_class parameters for function logutils.get_simple_config.
  • Add simple and simple_json formatter in logutils.get_simple_config.

v0.42.2

  • Add sysutils.get_worker_info.
  • Fix logutils' implicit imports problem.
  • Fix funcutils.classproperty.

v0.42.1

  • Fix logutils problem.

v0.42.0

  • Add msgpackutils.
  • Fix problem in nameutils.

v0.41.1

  • Fix numericutils.get_float_part problem.

v0.41.0

  • cipherutils changes.
  • Fix license_files missing problem.

v0.40.2

  • Add cipherutils.raw_aes_key.
  • Add cipherutils.get_aes_mode.

v0.40.0

  • Add listutils.chunk.
  • New threadutils.
  • Fix dictutils.Object.

v0.39.8

  • fsutils.TemporaryFile add auto delete.
  • dictutils.changes can return changed keys.
  • dictutils.change can control do update or not.
  • dictutils.change add ignore_empty_value support.

v0.39.7

  • Fix strutils.force_byte, strutils.force_text.

v0.39.6

  • Fix encode_datetime problem.

v0.39.5

  • Add field name while failed to do typing cast.

v0.39.4

  • Add more default jsonutils encoders.

v0.39.1

  • Fix logutils.setup default config for windows.

v0.39.0

  • Change logutils.setup parameter name.
  • Fix bizerror.BizError encoding problem in jsonutils.

v0.38.2

  • Add timeutils.TimeService.

v0.37.11

  • Fix fsutils.write.

v0.37.10

  • fsutils.readfile add default params. The default value will be returned if the target file is not exists.
  • Add dictutils.diff function.
  • Force folder create in fsutils.write.
  • Make sure log folder exists in logutils.setup.
  • Add sysutils.execute_script.

v0.37.3

  • Add PyYAML deps in requirements.txt.

v0.37.2

  • SimpleProducerConsumerServerBase.on_consume_error function add new parameter: task.
  • Fix threadutils problems. Many changes are made.

v0.37.0

  • Add fsutils.load_application_config.

v0.36.2

  • Add fsutils.TemporaryFile
  • Add threadutils.SimpleProducerConsumerServer and fix problems in ServiceCore.

v0.35.0

  • strutils.is_uuid add allow_bad_characters parameter, default to False. For some old bad application using '815f5ecb-eg07-43af-8de2-87d3898093b5' as UUID.
  • Add nameutils.guess_surname.
  • Add fsutils.get_size_deviation, fsutils.get_unit_size and fsutils.get_size_display.

v0.34.0

  • Add sysutils.get_daemon_application_pid.
  • Add httputils.

v0.33.0

  • Add fsutils.info
  • Add strutils.encodable and strutils.decodable

v0.32.0

  • Add funcutils.try_again_on_error.

v0.31.0

  • Add fsutils.expands.
  • Add fsutils.get_application_config_filepath.

v0.30.1

  • Add cipherutils result_encoders' typing tips.

v0.30.0

  • Add strutils.stringlist_append.
  • Add strutils.html_element_css_append.
  • Add strutils.split2.
  • Add strutils.remove_prefix.
  • Add strutils.remove_suffix.
  • Change strutils.split("", [","]) returns [] instead of [""].
  • Add cipherutils.MysqlAesCipher.
  • Add listutils.topological_sort.
  • Add nameutils.

v0.29.0

  • Use pypinyin module instead of dragonmapper.
    • Replace the result lve to lue.

v0.28.2

  • Fix dictutils.update, so that it can works on anything.

v0.28.1

  • Add default parameter to fsutils.first_exists_file.

v0.28.0

  • Add fsutils.first_exists_file.
  • Add fsutils.expand.
  • Add listutils.first.

v0.27.0

  • Add lower_first parameter for strutils.camel.
  • Add dictutils.prefix_key.
  • Add sysutils.get_worker_id.

v0.26.0

  • Add treeutils.build_tree from list.
  • Add treeutils.walk_tree.
  • Add treeutils.print_tree.
  • Add fsutils.touch.

v0.25.0

  • Add strutils.is_uuid.
  • Add typingutils.cast_uuid.

v0.24.2

  • fsutils.file_content_replace add ignore_errors parameter.

v0.24.1

  • typingutils.cast_xxx treat empty string as None.
  • randomutils.UuidGenerator.next add parameter n, so that it can generate n uuids. If n==1, returns a UUID instance, and if n>1, returns a list of UUIDs.

v0.24.0

  • Add strutils.unquote.

v0.23.0

  • Add funcutils.get_default_values.
  • Add funcutils.chain.

v0.22.0

  • Add none-dict support in dictutils.change and dictutils.changes.
  • Add strutils.format_with_mapping.

v0.21.0

  • Add listutils.compare(old_set, new_set).
  • Add dictutils.change(object_instance, data_dict, object_key, dict_key=None) -> bool.
  • Add dictutils.changes(object_instance, data_dict, keys) -> bool:
  • Change listutils.replace, turn the default value of parameter inplace from True to False.
  • Fix Object instance problems.

v0.20.0

  • Add strutils.clean and change strutils.camel.
  • Add dictutils.to_object.
  • Add pinyinutils.

v0.19.0

  • Add fsutils.filecopy and fsutils.treecopy. Tips: fsutils.copy combines the function of filecopy and treecopy, if the src is a file then use filecopy, and if the src is a folder then use treecopy.
  • Fix problem in fsutils.copy.

v0.18.0

  • Add strutils.camel.

v0.17.0

  • Add fsutils.file_content_replace.
  • Add fsutils.move.
  • Change fsutils.rename's behavior.
  • Change fsutils.copy's behavior.

v0.16.0

  • Add fsutils.

v0.15.2

  • Add hostname, seed1, seed4 in domain_template of randomutils.UuidGenerator.

v0.15.1

  • Add incr-lock for counter incr in randomutils.UuidGenerator.

v0.15.0

  • Add randomutils.UuidGenerator.

v0.14.0

  • Add strutils.substrings.
  • Add strutils.combinations.
  • Add cipherutils.Utf8Encoder.
  • Add cipherutils.S1Cipher.
  • Add cipherutils.S2Cipher.
  • Add funcutils.classproperty
  • WARN: Change a cipherutils.CipherBase's parameter name from encoder to result_encoder.

v0.13.4

  • Use new algorithm to improve randomutils.shuffle's performance.

v0.13.3

  • Add randomutils.shuffle.
  • Change randomutils.randint parameters from (max, min=0) to (a, b=None).

v0.13.2

  • Add listutils.group.
  • Add rsautils.export_key. And rsautils use Crypto.PublicKey.RSA for the base engine.

v0.13.1

  • Add strutils.force_float and strutils.force_numeric.
  • Add typingutils.cast_numeric support.

v0.13.0

  • IvfCihper accept integer value when float_digits=0.
  • Fix IvfCihper deviation problem which is caused by wrong module used in decrypt.
  • IvfCihper use new algorithm in computing module and max_value, so that result encrypted by version v0.12.0 can not decrypted by version v0.13.0.

v0.12.0

  • Add IvfCihper for float number encrypt and decrypt. The output of IvfCipher.encrypt is string.

v0.11.1

  • Use class instead of raw api for s12 and iv ciphers. It's can avoid many times in generating seeds.

v0.11.0

  • Add cipherutils.
  • Add strutils.binarify and strutils.unbinarify.
  • Add randomutils.Random.
  • Change aesutils functions' return type. Note: use cipherutils instead.

v0.10.1

  • Add bizerror dependency.

v0.10.0

  • Add strutils.is_chinese_character to test if the character is a chinese character.
  • Add cacheutils.get_cached_value to get or set cached value.

v0.9.0

  • Add listutils.append_new to append new value and only new value to the list.

v0.8.0

  • Add strutils.smart_get_binary_data.
  • Add rsautils.

v0.7.0

  • Add hashutils.get_file_hash.
  • Add extra install requires for python 2.x.
  • Add imageutils.parse_base64image and imageutils.get_image_bytes.
  • Fix jsonutils.make_simple_json_encoder ignore bases problem.

v0.6.0

  • Add imageutils, add imageutils.get_base64image to make base64 image that can be rendered by web browser.
  • Add imageutils.resize to scale image size.
  • Add Image-Object-Encode support in jsonutils.
  • Add threadutils, add threadutils.Service to simplify long-run-service programming.
  • Raise bizerror.MissingParameter error in funcutils.get_inject_params while missing required parameter.

v0.5.4

  • Fix hashutils.get_hash_hexdigest and hashutils.get_hash_base64 problem.

v0.5.3

  • Using typingutils.smart_cast in funcutils.get_inject_params.

v0.5.2

  • Add unit test cases for typingutils.
  • Fix cast_list, do strip for every element in comma-separated-list.
  • Fix base64 import missing in typingutils.

v0.5.1

  • Add typingutils.cast_str.

v0.5.0

  • Set library property in get_encoder in jsonutils.
  • Add typingutils.

v0.4.0

  • Add jsonutils, provides simple json encoder register system.

v0.3.2

  • Fix problems for python 2.7.
  • Fix name error of funcutils.

v0.3.1

  • Fix problem casued by str.isascii() which is new from python 3.7.

v0.3.0

  • Add listutils.unique to remove duplicated elements from the list.
  • Add listutils.replace to replace element value in thelist with new_value in collection of map.

v0.2.0

  • Add functuils.get_inject_params to smartly choose parameters from candidates by determine with the function's signature.
  • Add functuils.call_with_inject to smartly call the function by smartly choose parameters.

v0.1.1

  • Add strutils.wholestrip function, use to remove all white spaces in text.
  • Fix strutils.is_urlsafeb64_decodable, strutils.is_base64_decodable and strutils.is_unhexlifiable functions, that have problem to test text contains whitespaces.

v0.1.0

  • Add simple utils about operations of aes, dict, hash, list and str.

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

fastutils-0.43.4.tar.gz (34.7 kB view hashes)

Uploaded Source

Built Distribution

fastutils-0.43.4-py3-none-any.whl (34.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page