Personal tools
Skip to content. | Skip to navigation
This project collects a few CRC32C implementations under an umbrella that dispatches to a suitable implementation based on the host computer's hardware capabilities. CRC32C is specified as the CRC that uses the iSCSI polynomial in RFC 3720. The polynomial was introduced by G. Castagnoli, S. Braeuer and M. Herrmann. CRC32C is used in software such as Btrfs, ext4, Ceph and leveldb.
Package apache-airflow-providers-ydb Release: 2.1.1 YDB
ydb
YDB Python DBAPI Introduction Python DBAPI to YDB, which provides both sync and async drivers and complies with PEP249. Installation pip install ydb-dbapi Usage To establish a new DBAPI connection you should provide host, port and database: import ydb_dbapi connection = ydb_dbapi.connect( host="localhost", port="2136", database="/local" ) # sync connection async_connection = await ydb_dbapi.async_connect( host="localhost", port="2136", database="/local" ) # async connection Usage of connection: with connection.cursor() as cursor: cursor.execute("SELECT id, val FROM table") row = cursor.fetchone() rows = cursor.fetchmany(size=5) rows = cursor.fetchall() Usage of async connection: async with async_connection.cursor() as cursor: await cursor.execute("SELECT id, val FROM table") row = await cursor.fetchone() rows = await cursor.fetchmany(size=5) rows = await cursor.fetchall()
Plone 5
AnyAscii Unicode to ASCII transliteration Web Demo Converts Unicode characters to their best ASCII representation AnyAscii provides ASCII-only replacement strings for practically all Unicode characters. Text is converted character-by-character without considering the context. The mappings for each script are based on popular existing romanization systems. Symbolic characters are converted based on their meaning or appearance. All ASCII characters in the input are left unchanged, every other character is replaced with printable ASCII characters. Unknown characters and some known characters are replaced with an empty string and removed. from anyascii import anyascii s = anyascii('άνθρωποι') assert s == 'anthropoi' Python 3.3+ compatible pip install anyascii FULL README
If you had a data model like this: class Band(models.Model): name = models.CharField(max_length=255) class BandMember(models.Model): band = models.ForeignKey('Band', related_name='members', on_delete=models.CASCADE) name = models.CharField(max_length=255) wouldn’t it be nice if you could construct bundles of objects like this, independently of the database: beatles = Band(name='The Beatles') beatles.members = [ BandMember(name='John Lennon'), BandMember(name='Paul McCartney'), ] Unfortunately, you can’t. Objects need to exist in the database for foreign key relations to work: IntegrityError: null value in column "band_id" violates not-null constraint But what if you could? There are all sorts of scenarios where you might want to work with a ‘cluster’ of related objects, without necessarily holding them in the database: maybe you want to render a preview of the data the user has just submitted, prior to saving. Maybe you need to construct a tree of things, serialize
django-permissionedforms django-permissionedforms is an extension to Django's forms framework, allowing you to define forms where certain fields are shown or omitted according to the user's permissions. Installation Run: pip install django-permissionedforms Usage To add permission rules to a basic Django form, subclass permissionedforms.PermissionedForm in place of django.forms.Form and add an inner Meta class: from permissionedforms import PermissionedForm class PersonForm(PermissionedForm): first_name = forms.CharField() last_name = forms.CharField() class Meta: field_permissions = { 'last_name': 'myapp.change_last_name' } field_permissions is a dict, mapping field names to permission codenames. For each field listed, that field will only be included in the final form if the user has the specified permission, as defined by the user.has_perm() method. See Django's documentation on custom permissions and programmatically creating permissions f
Extensions and monkey-patching for django-stubs This package contains extensions and monkey-patching functions for the django-stubs package. Certain features of django-stubs (i.e. generic django classes that don't define the __class_getitem__ method) require runtime monkey-patching, which can't be done with type stubs. These extensions were split into a separate package so library consumers don't need mypy as a runtime dependency (#526). Installation pip install django-stubs-ext Usage In your Django application, use the following code: import django_stubs_ext django_stubs_ext.monkeypatch() This only needs to be called once, so the call to monkeypatch should be placed in your top-level settings. Real-life example can be found here. Version compatibility Since django-stubs supports multiple Django versions, this package takes care to only monkey-patch the features needed by your django version, and decides which features to patch at runtime. This is completely safe, as (currently) w