SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

 
 

python3-morphys rpm build for : OpenSuSE. For other distributions click python3-morphys.

Name : python3-morphys
Version : 1.0 Vendor : obs://build_opensuse_org/home:bmwiedemann
Release : lp155.1.1 Date : 2023-07-21 13:00:56
Group : Development/Languages/Python Source RPM : python-morphys-1.0-lp155.1.1.src.rpm
Size : 0.01 MB
Packager : https://www_suse_com/
Summary : Smart conversions between unicode and bytes types for common cases
Description :
=======
Morphys
=======

**Morphys** is a simple, small library providing utilities for easy smart
conversions between ``unicode`` and ``bytes`` types.

In Python 2, the treatment of ``unicode`` and ``bytes`` objects is a potential
source of many surprising and annoying errors, should a non-ASCII character
appear anywhere in a string.

The two types are completely equivalent if only ASCII characters are used, and
many libraries treat them as such, while others are more vigilant about which
type they accept. Some can even return one or the other type of string from the
same function depending on the content (for example, the standard library
``json`` module).

**Morphys** is meant to help with cases where types of strings handled by
libraries are inconsistent or undocumented. Or where simply both types of
string can appear, but should be coerced to the same type before being handled.


Conversion functions
====================

**Morphys** provides two functions for smart conversions to ``unicode`` or
``bytes``. They just return their argument unchanged if it\'s already the right
type and can also convert any object defining the ``__unicode__`` (or
``__str__`` in Python 3) \"magic\" method.

``ensure_bytes(obj, encoding=None)``
Return ``obj`` as a ``bytes`` object, if necessary encoding it using
``encoding``.

``ensure_unicode(obj, encoding=None)``
Return ``obj`` as an ``unicode`` object, if necessary decoding it using
``encoding``.

See docstrings in the module for more detailed description of the functions.


Lazy conversion wrapper
=======================

In certain cases it may be more convenient to use an object that can be used
both as ``bytes`` or ``unicode`` as needed. The class ``StrMorpher`` is
provided for this case. Its constructor takes the same arguments as the
conversion functions. The object makes calls to the appropriate conversion
function when its \"magic\" methods that convert to ``bytes`` or ``unicode``
are invoked.

Note, that ``StrMorpher`` is not itself a subclass of any of the string
types and relies on the \"magic\" methods being called to produce the actual
string objects.

See docstrings in the module for more detailed description of the class.


Default encoding
================

The ``encoding`` parameter is optional in all places where it\'s accepted. Where
it is left as ``None``, the default encoding is used.

The default encoding is controlled by ``default_encoding`` global
variable in the ``morphys`` module. Initially it\'s set to \"utf-8\", but it\'s
allowed to set it to a different encoding name from user code.


Python 3
========

While **Morphys** is mostly meant to solve issues of string types handling in
Python 2, it\'s fully compatible with Python 3 and can be used with it.

RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/home:/bmwiedemann:/ipfs/15.5/noarch

Content of RPM  Changelog  Provides Requires

Download
ftp.icm.edu.pl  python3-morphys-1.0-lp155.1.1.noarch.rpm
     

Provides :
python3-morphys

Requires :
python(abi) = 3.6
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1


Content of RPM :
/usr/lib/python3.6/site-packages/__pycache__
/usr/lib/python3.6/site-packages/__pycache__/morphys.cpython-36.opt-1.pyc
/usr/lib/python3.6/site-packages/__pycache__/morphys.cpython-36.pyc
/usr/lib/python3.6/site-packages/morphys-1.0-py3.6.egg-info
/usr/lib/python3.6/site-packages/morphys-1.0-py3.6.egg-info/PKG-INFO
/usr/lib/python3.6/site-packages/morphys-1.0-py3.6.egg-info/SOURCES.txt
/usr/lib/python3.6/site-packages/morphys-1.0-py3.6.egg-info/dependency_links.txt
/usr/lib/python3.6/site-packages/morphys-1.0-py3.6.egg-info/top_level.txt
/usr/lib/python3.6/site-packages/morphys.py

 
ICM