m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

216 lines
9.0 KiB

6 months ago
  1. Metadata-Version: 2.1
  2. Name: humanfriendly
  3. Version: 10.0
  4. Summary: Human friendly output for text interfaces using Python
  5. Home-page: https://humanfriendly.readthedocs.io
  6. Author: Peter Odding
  7. Author-email: peter@peterodding.com
  8. License: MIT
  9. Platform: UNKNOWN
  10. Classifier: Development Status :: 6 - Mature
  11. Classifier: Environment :: Console
  12. Classifier: Framework :: Sphinx :: Extension
  13. Classifier: Intended Audience :: Developers
  14. Classifier: Intended Audience :: System Administrators
  15. Classifier: License :: OSI Approved :: MIT License
  16. Classifier: Natural Language :: English
  17. Classifier: Programming Language :: Python
  18. Classifier: Programming Language :: Python :: 2
  19. Classifier: Programming Language :: Python :: 2.7
  20. Classifier: Programming Language :: Python :: 3
  21. Classifier: Programming Language :: Python :: 3.5
  22. Classifier: Programming Language :: Python :: 3.6
  23. Classifier: Programming Language :: Python :: 3.7
  24. Classifier: Programming Language :: Python :: 3.8
  25. Classifier: Programming Language :: Python :: 3.9
  26. Classifier: Programming Language :: Python :: Implementation :: CPython
  27. Classifier: Programming Language :: Python :: Implementation :: PyPy
  28. Classifier: Topic :: Communications
  29. Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
  30. Classifier: Topic :: Software Development
  31. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  32. Classifier: Topic :: Software Development :: User Interfaces
  33. Classifier: Topic :: System :: Shells
  34. Classifier: Topic :: System :: System Shells
  35. Classifier: Topic :: System :: Systems Administration
  36. Classifier: Topic :: Terminals
  37. Classifier: Topic :: Text Processing :: General
  38. Classifier: Topic :: Text Processing :: Linguistic
  39. Classifier: Topic :: Utilities
  40. Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
  41. Requires-Dist: monotonic ; python_version == "2.7"
  42. Requires-Dist: pyreadline ; sys_platform == "win32" and python_version<"3.8"
  43. Requires-Dist: pyreadline3 ; sys_platform == "win32" and python_version>="3.8"
  44. humanfriendly: Human friendly input/output in Python
  45. ====================================================
  46. .. image:: https://github.com/xolox/python-humanfriendly/actions/workflows/test.yml/badge.svg?branch=master
  47. :target: https://github.com/xolox/python-humanfriendly/actions
  48. .. image:: https://codecov.io/gh/xolox/python-humanfriendly/branch/master/graph/badge.svg?token=jYaj4T74TU
  49. :target: https://codecov.io/gh/xolox/python-humanfriendly
  50. The functions and classes in the `humanfriendly` package can be used to make
  51. text interfaces more user friendly. Some example features:
  52. - Parsing and formatting numbers, file sizes, pathnames and timespans in
  53. simple, human friendly formats.
  54. - Easy to use timers for long running operations, with human friendly
  55. formatting of the resulting timespans.
  56. - Prompting the user to select a choice from a list of options by typing the
  57. option's number or a unique substring of the option.
  58. - Terminal interaction including text styling (`ANSI escape sequences`_), user
  59. friendly rendering of usage messages and querying the terminal for its
  60. size.
  61. The `humanfriendly` package is currently tested on Python 2.7, 3.5+ and PyPy
  62. (2.7) on Linux and macOS. While the intention is to support Windows as well,
  63. you may encounter some rough edges.
  64. .. contents::
  65. :local:
  66. Getting started
  67. ---------------
  68. It's very simple to start using the `humanfriendly` package::
  69. >>> from humanfriendly import format_size, parse_size
  70. >>> from humanfriendly.prompts import prompt_for_input
  71. >>> user_input = prompt_for_input("Enter a readable file size: ")
  72. Enter a readable file size: 16G
  73. >>> num_bytes = parse_size(user_input)
  74. >>> print(num_bytes)
  75. 16000000000
  76. >>> print("You entered:", format_size(num_bytes))
  77. You entered: 16 GB
  78. >>> print("You entered:", format_size(num_bytes, binary=True))
  79. You entered: 14.9 GiB
  80. To get a demonstration of supported terminal text styles (based on
  81. `ANSI escape sequences`_) you can run the following command::
  82. $ humanfriendly --demo
  83. Command line
  84. ------------
  85. .. A DRY solution to avoid duplication of the `humanfriendly --help' text:
  86. ..
  87. .. [[[cog
  88. .. from humanfriendly.usage import inject_usage
  89. .. inject_usage('humanfriendly.cli')
  90. .. ]]]
  91. **Usage:** `humanfriendly [OPTIONS]`
  92. Human friendly input/output (text formatting) on the command
  93. line based on the Python package with the same name.
  94. **Supported options:**
  95. .. csv-table::
  96. :header: Option, Description
  97. :widths: 30, 70
  98. "``-c``, ``--run-command``","Execute an external command (given as the positional arguments) and render
  99. a spinner and timer while the command is running. The exit status of the
  100. command is propagated."
  101. ``--format-table``,"Read tabular data from standard input (each line is a row and each
  102. whitespace separated field is a column), format the data as a table and
  103. print the resulting table to standard output. See also the ``--delimiter``
  104. option."
  105. "``-d``, ``--delimiter=VALUE``","Change the delimiter used by ``--format-table`` to ``VALUE`` (a string). By default
  106. all whitespace is treated as a delimiter."
  107. "``-l``, ``--format-length=LENGTH``","Convert a length count (given as the integer or float ``LENGTH``) into a human
  108. readable string and print that string to standard output."
  109. "``-n``, ``--format-number=VALUE``","Format a number (given as the integer or floating point number ``VALUE``) with
  110. thousands separators and two decimal places (if needed) and print the
  111. formatted number to standard output."
  112. "``-s``, ``--format-size=BYTES``","Convert a byte count (given as the integer ``BYTES``) into a human readable
  113. string and print that string to standard output."
  114. "``-b``, ``--binary``","Change the output of ``-s``, ``--format-size`` to use binary multiples of bytes
  115. (base-2) instead of the default decimal multiples of bytes (base-10)."
  116. "``-t``, ``--format-timespan=SECONDS``","Convert a number of seconds (given as the floating point number ``SECONDS``)
  117. into a human readable timespan and print that string to standard output."
  118. ``--parse-length=VALUE``,"Parse a human readable length (given as the string ``VALUE``) and print the
  119. number of metres to standard output."
  120. ``--parse-size=VALUE``,"Parse a human readable data size (given as the string ``VALUE``) and print the
  121. number of bytes to standard output."
  122. ``--demo``,"Demonstrate changing the style and color of the terminal font using ANSI
  123. escape sequences."
  124. "``-h``, ``--help``",Show this message and exit.
  125. .. [[[end]]]
  126. A note about size units
  127. -----------------------
  128. When I originally published the `humanfriendly` package I went with binary
  129. multiples of bytes (powers of two). It was pointed out several times that this
  130. was a poor choice (see issue `#4`_ and pull requests `#8`_ and `#9`_) and thus
  131. the new default became decimal multiples of bytes (powers of ten):
  132. +------+---------------+---------------+
  133. | Unit | Binary value | Decimal value |
  134. +------+---------------+---------------+
  135. | KB | 1024 | 1000 +
  136. +------+---------------+---------------+
  137. | MB | 1048576 | 1000000 |
  138. +------+---------------+---------------+
  139. | GB | 1073741824 | 1000000000 |
  140. +------+---------------+---------------+
  141. | TB | 1099511627776 | 1000000000000 |
  142. +------+---------------+---------------+
  143. | etc | | |
  144. +------+---------------+---------------+
  145. The option to use binary multiples of bytes remains by passing the keyword
  146. argument `binary=True` to the `format_size()`_ and `parse_size()`_ functions.
  147. Windows support
  148. ---------------
  149. Windows 10 gained native support for ANSI escape sequences which means commands
  150. like ``humanfriendly --demo`` should work out of the box (if your system is
  151. up-to-date enough). If this doesn't work then you can install the colorama_
  152. package, it will be used automatically once installed.
  153. Contact
  154. -------
  155. The latest version of `humanfriendly` is available on PyPI_ and GitHub_. The
  156. documentation is hosted on `Read the Docs`_ and includes a changelog_. For bug
  157. reports please create an issue on GitHub_. If you have questions, suggestions,
  158. etc. feel free to send me an e-mail at `peter@peterodding.com`_.
  159. License
  160. -------
  161. This software is licensed under the `MIT license`_.
  162. © 2021 Peter Odding.
  163. .. External references:
  164. .. _#4: https://github.com/xolox/python-humanfriendly/issues/4
  165. .. _#8: https://github.com/xolox/python-humanfriendly/pull/8
  166. .. _#9: https://github.com/xolox/python-humanfriendly/pull/9
  167. .. _ANSI escape sequences: https://en.wikipedia.org/wiki/ANSI_escape_code
  168. .. _changelog: https://humanfriendly.readthedocs.io/en/latest/changelog.html
  169. .. _colorama: https://pypi.org/project/colorama
  170. .. _format_size(): https://humanfriendly.readthedocs.io/en/latest/#humanfriendly.format_size
  171. .. _GitHub: https://github.com/xolox/python-humanfriendly
  172. .. _MIT license: https://en.wikipedia.org/wiki/MIT_License
  173. .. _parse_size(): https://humanfriendly.readthedocs.io/en/latest/#humanfriendly.parse_size
  174. .. _peter@peterodding.com: peter@peterodding.com
  175. .. _PyPI: https://pypi.org/project/humanfriendly
  176. .. _Read the Docs: https://humanfriendly.readthedocs.io