Saravanan666/pypi-org huggingface dataset:
Package: django-sanitized-dump
django-sanitized-dumpSanitize sensitive information from your database dumps 💩Supports:PostgreSQLMySQLGetting startedpip install django-sanitized-dumporpip install django-sanitized-dump[MySQL]if you use MySQLAddsanitized_dumptoINSTALLED_APPSInitialize config file:./manage.py init_sanitizerCheck your newly created.sanitizerconfigfile and modify the sanitation strategy to fit your requirements.Run./manage.py check_sanitizerconfigto verify that your.sanitizerconfigincludes all models and fieldsGet sanitized database dump:./manage.py create_sanitized_dump > dump.sqlDB SanitationHeavy lifting of the DB sanitation is done by:https://github.com/andersinno/python-database-sanitizerConfigurationConfiguration file is used to define a strategy on how to sanitize your data. Strategy defines a sanitation function for each model field.Example configconfig:addons:-"ai-sanitizers"-"some-other-lib"strategy:user:first_name:"name.first_name"last_name:"name.last_name"education:created:nullmodified:nullid:nullfield:"education.field"school:"education.school"started:"datetime.datetime"credits:nullinformation:"string.loremipsum_preserved"file_file:nullExample custom sanitizers# /sanitizers/name.pydefsanitize_first_name(value):returnfaker.first_name()defsanitize_last_name(value):returnfaker.last_name()# /sanitizers/education.pydefsanitize_field(value):return"Some field"defsanitize_schoo(value):return"My school"Validating sanitizer return valueNote: This should not be done in the initial implementation of the sanitizer but is up to the sanitizer functions. This is just a nice to have but not of a high priority.Check that the returned value is of the same type as the argument value passed to the sanitizer.
For instance, if a MySQL DATETIME value is passed to the sanitizer, a MySQL DATETIME value shoud be returned as well.Configuration method resolution orderCustom sanitizers inside ./sanitizersAddon sanitizers (config.addons)Core sanitizersDjango Management CommandsSanitized Dump./manage.py create_sanitized_dump > dump.sqlWarn about unhandled fieldsCreates a database dump (mysqldump/pgdump)Run sanitizerCheck Sanitized Dump./manage.py check_sanitizerconfigReturns an error code if there are unhandled database fieldsCheck can be used in CI environments for detecting changes in models, that are not present in
sanitizer configuration.Init Sanitizer./manage.py init_sanitizerCreate configuration from current database state
Package: django-sanitizer
**NOTE: Please try to break this and tell me where it is insufficent.**Allows only whitelisted tags and attributes through.The setting ALLOWED_TAGS can override the behavior. The syntax ofthis setting is a space-separated list of tags, which are optionallyfollowed by a colon and a comma-separated list of attribute permitted inthe tag.For example, to allow <a> tags which are links or named anchors, but notto allow definition of an onclick attribute:ALLOWED_TAGS = "a:href,name"In your templates, sanitizing is easy.{% load sanitizer %}{{ user_comment|allowtags|safe }}{{ user_comment|allowtags:"b i"|safe }}Disallowed tags or attributes are simply removed.In some cases, it is useful to disallow a tag, but to convert it to somethingsafe, rather than stripping it entirely. For example, you might not want toallow <h1> tags, and want to "quiet" them into <h2> tags.{{ body|maptags:"h1=h2 h2=h3 h4=h5" }}
Package: django-sans-db
Django sans DBTools for limiting access to the database in parts of your Django code.Installationpip install django-sans-dbIf you wish to use the{% sansdb %}template tag,
you will need to add"sans_db"to yourINSTALLED_APPS.UsageContext managerYou can block access to your database for a section of your code usingblock_db:fromsans_db.context_managersimportblock_dbUser.objects.create(...)# Works outside of block_db()withblock_db():User.objects.get()# Raises DatabaseAccessBlockedIf you have multiple entries in your DjangoDATABASESsetting,
thenblock_dbwill default to blocking all of them.If you wish to block access to a subset of your databases,
pass a list of their aliases (the keys in theDATABASESdictionary).fromsans_db.context_managersimportblock_dbwithblock_db(databases=["replica"]):User.objects.using("primary").create(...)# This DB isn't blocked.User.objects.using("replica").get()# Raises DatabaseAccessBlockedDecoratorYou can decorate functions and methods withblock_dbto block database access in them. Eg:fromsans_db.context_managersimportblock_dbclassMyClass:defallowed(self):User.objects.create(...)# Works outside of block_db()@block_db()defnot_allowed(self):User.objects.create(...)# Raises DatabaseAccessBlockedTemplate backendYou can block access to the database when rendering Django templates with our custom template backend.Note: Currently, only Django templates are supported.You can block database access in all of your templates
by setting your templates backend to"sans_db.template_backends.django_sans_db.DjangoTemplatesSansDB"For example:# settings.pyTEMPLATES=[{"BACKEND":"sans_db.template_backends.django_sans_db.DjangoTemplatesSansDB","APP_DIRS":True,"OPTIONS":{...},},]Attempts to query the database will now cause asans_db.exceptions.DatabaseAccessBlockedto be raised.Please refer to Django's docs onsupport for template enginesfor details on how to set this up as a secondary template renderer.Template tagYou can block DB access in a portion of your template
by wrapping it with the{% sansdb %}template tag.The template tag accepts database aliases as either strings, or variables.
If passed as a variable, either strings or iterables of strings are accepted.
If no aliases are passed, all databases will be blocked.Note:DatabaseAccessBlockedis raised when an attempt is made to access the DB.To block all databases:{%loadsansdb%}{%sansdb%}{# ... #}{%endsansdb%}To block a list of databases named in the template:{%loadsansdb%}{%sansdb"second_db""third_db"%}{# ... #}{%endsansdb%}To block a list of databases from a context variable:{%loadsansdb%}{%sansdbdatabases%}{# ... #}{%endsansdb%}
Package: django-sap
django-sapStartingThese instructions will allow you to install the library in your python project.Current featuresSend invoice reserve.Send incoming payment.Pre-requisitosPython >= 3.7Django >= 3requests >= 2InstallationTo get the latest stable release from PyPi:pip install django-saporFrom a buildgit clone https://gitlab.com/linets/ecommerce/oms/integrations/oms-sapcd {{project}}python setup.py sdistand, install in your project djangopip install {{path}}/oms-sap/dist/{{tar.gz file}}Settings in django projectDJANGO_SAP = {
    'SAP': {
        'BASE_URL': '<SAP_BASE_URL>',
        'USERNAME': '<SAP_USERNAME>',
        'PASSWORD': '<SAP_PASSWORD>',
        'COMPANY_DB': '<SAP_COMPANY_DB>',
        'SERIE': '<SAP_SERIE>',
        'CARD_CODE': '<SAP_CARD_CODE>',
        'WAREHOUSE_CODE': '<SAP_WAREHOUSE_CODE>',
        'TAX_CODE': '<SAP_TAX_CODE>',
        'COSTING_CODE': '<SAP_COSTING_CODE>',
        'COSTING_CODE2': '<SAP_COSTING_CODE2>',
        'COSTING_CODE3': '<SAP_COSTING_CODE3>',
        'INDICATOR': '<SAP_INDICATOR>',
        'RESERVE_INVOICE': '<SAP_RESERVE_INVOICE>',
        'U_TIPO_PED_WMS': '<SAP_U_TIPO_PED_WMS>',
    }
}UsageSend invoice reserve:from sap.handler import SapHandler

handler = SapHandler()

default_data = handler.default_payload_invoice_reserve(instance)
response = handler.send_invoice_reserve(default_data)Send incoming payment:from sap.handler import SapHandler

handler = SapHandler()

default_data = handler.default_payload_incoming_payment(instance)
response = handler.send_incoming_payment(default_data)
Package: django-sape
# django-sape## Настройка`settings.py````INSTALLED_APPS = \(...'sape',...)``````SAPE_DOMAIN = 'example.com'SAPE_USER = 'sape_username'SAPE_CHARSET = 'utf8'SAPE_DIR = '/tmp/sape_cache/'```## Запрос ссылок (обновление кеша)`./manage.py sape fetch`## В шаблоне```{% load sape_extras %}...{% sape_links request %}```
Package: django-sape3
Реинкарнация интеграции фреймворка Django с сервисом sape.ru. За основу
были взяты идеи проекта наhttps://github.com/Dimmma/sapeи его
форка(https://github.com/fedosov/sape).Данное приложение ориентировано исключительно на работу с Python 3.
Причиной его создания послужила работа по миграции одного “пожилого”
сайта с PHP на Python.Установкаpipinstalldjango-sape3илиpipinstallgit+https://github.com/dalay/django-sape3.gitНастройкаsettings.pyINSTALLED_APPS=(...'sape',)# SAPE.RU# Обязательные настройкиSAPE_DOMAIN='example.com'SAPE_USER='sape_username'# Остальные настройкиSAPE_SHOW_CODE=False# Показывать или нет проверочный код sape# (при добавлении страниц сайте в сервис).SAPE_CHARSET='utf8'# Кодировка сайтаSAPE_DIR='/tmp/sape_cache/'# Где будет храниться файл,# содержащий полученные с sape ссылки.ШаблоныОбщее использование{% load sape %}
...
{% sape_links %}
или так, если нужен заголовок для блока с ссылками
{% sape_links 'Заголовок блока ссылок' %}Встроенные базовые шаблоны приложенияРодительский шаблон с кодом блока ссылок.sape/block.hmlДочерний шаблон вывода для конкретно ссылок.sape/links.htmlОбновление ссылочной базыПолучение ссылок для сайта с сервера sape.ru./manage.py sape update
Package: django-sass-finder
Django Sass FinderA static files finder for Django that compiles Sass filesInstallationWARNING: MAKE SURE YOU HAVE NO SASS PACKAGES INSTALLED (other than libsass)!Runpip install django_sass_finderto add this module to your virtualenv,
then add the finder to the list your static file finders as follows:STATICFILES_FINDERS=[# add the default Django finders as this setting will override the default'django.contrib.staticfiles.finders.FileSystemFinder','django.contrib.staticfiles.finders.AppDirectoriesFinder',# our finder'django_sass_finder.finders.ScssFinder',]There is no need to add django_sass_finder intosettings.INSTALLED_APPS.The following additional (with examples) settings are used and required by this staticfiles finder:BASE_DIR=...SCSS_ROOT=BASE_DIR/'scss'# where the .scss files are sourcedSCSS_COMPILE=[# a list of filename pattern to search for within SCSS_ROOT'site.scss',# default is **/*,css (all scss source files in and below SCSS_ROOT)'admin/admin.scss',]SCSS_INCLUDE_PATHS=[# optional: scss compiler include paths (default = empty)BASE_DIR/'node_modules']CSS_STYLE='compressed'# optional: output format 'nested', 'expanded','compact','compressed'CSS_MAP=True# optional: generate a source mapCSS_COMPILE_DIR=BASE_DIR/'static'/'css'# The target directories for the compiled .cssSTATICFILES_ROOT=[# this should be at or above the CSS_COMPILE_DIRBASE_DIR/'static'# but targetting {app}/static should also work]BASE_DIRand variants above arepathlib.Pathobjects, but path strings can also be used.UsageThis module dynamically compiles to target .css files, and recompiles them on demand whenever
they are updated.Thecollectstaticmanagement command compiles these, and lets theFilesystemFindertransfer
them to STATIC_ROOT. The development server is perfectly able to serve these from
STATICFILES_ROOT without the need tocollectstatic.LicenseThis package is licensed under the MIT license.
Package: django-sass-processor-dart-sass
django-sass-processor-dart-sassThis is a shim that makesdjango-sass-processoruseDart Sassrather thanlibsassbecause
libsass is deprecated.This provides a replacement forsass.pyprovided by libsass and simply calls out tosassprovided by Dart Sass.
Dart Sass must beinstalled separately.Note: vanilla Dart Sass onlyThis does not support the custom functions provided by django-sass-processor through libsass. It only supports vanilla
Dart Sass.How to use itThis clashes with libsass, so remove libsass if you have it installed:pip uninstall libsassInstall Dart Sass by following theirinstructions.Install this package:pipinstallhttps://github.com/laws-africa/django-sass-processor-dart-sassThat's it. Install and usedjango-sass-processoras normal.Advanced usageIf you need to change thesasscommand, override it like so:fromsassimportdart_sassdart_sass.sass_command=['/special/sass']# to use npm sass, use:dart_sass.sass_command=['npx','sass']Build and releaseBuild:python3 -m buildRelease to Pypi:python3 -m twine upload dist/*
Package: django-sassy-coffee
sassy_coffee============This is a django application to compile SASS, SCSS and CoffeeScript files from the static directory into CSS and JavaScript files. The resulting CSS's and JS's are already minified/compressed.This project is a very rough version of what is wanted. Feel free to suggest and colaborate with improvements to make it better. The only restriction is that the compilers being used cannot be external to the plugin. Must be entirely self contained. That is why it doesn't use popular plugins such as django-compass or django-compress and doesn't rely on executables such as Ruby's SASS and SCSS gem.Looking forward to include support for LESS and Stylus, among others.Quick start-----------Install using pip or easy_install$ pip install django-sassy-coffee$ easy_install django-sassy-coffeeAdd "sassy_coffee" to your INSTALLED_APPS setting like this:INSTALLED_APPS = (...'sassy_coffee',)Add the following options to the settings.py file to configure:DJANGO_SASSY_COFFEE_FORMATS = [# Add the formats you wish to compile# Use 'sass' for SASS files, 'scss' for SCSS files, and 'coffee' for CoffeeScript files]DJANGO_SASSY_COFFEE_EXCLUSIONS = [# Include the names of the files you want to be skipped by the compiler# The name must include format (for example, 'base.sass' or 'index.coffee')]Usage-----------Just add your SASS and CoffeeScript files inside your static folder. Recommended to locate them inside sass and coffee subfolders, but not required.
Package: django-satella-metrics
django-satella-metricsdjango-satella-metrics is a library to measureDjango'srequests usingSatella'smetricsSeeLICENSEfor text of the license. This library may contain
code taken from elsewhere on the internets, so this is copyright (c) respective authors.As far as compatible Djangos are considered: This has been tested as early as Django 1.8 with Python 3.6
and as late as Django 3.0.3 with Python 3.8. Enjoy!UsageFirst, add the following to yourMIDDLEWARE(orMIDDLEWARE_CLASSES):'django_satella_metrics.DjangoSatellaMetricsMiddleware'Define the following in your settings:fromsatella.instrumentation.metricsimportgetMetricDJANGO_SATELLA_METRICS={'summary_metric':getMetric('django.summary','summary'),'histogram_metric':getMetric('django.histogram','histogram'),'status_codes_metric':getMetric('django.status_codes','counter')}Or pass any other metrics that you'd like. This is the default configuration, so if you pass nothing it will be
as if you passed the listed code.Extra configurationIf you want URL readed from the request in a different way than reading URL, you can define a key calledurl_getter.
This should contain a callable that accepts a single argument, the request passed, and return a str, the URL to use.Additionally, if you want the Prometheus exporter to add extra labels to your exported metrics, you can add a key to
the config of nameextra_labelswhich will contain a dict with the labels to add, eg.DJANGO_SATELLA_METRICS={'extra_labels':{'service_name':'my_service','instance':1},'monitor_metrics':False}If you specifymonitor_metrics, which is a bool, to be True, then/metricsendpoint will also be
considered during monitoring.Exporting from the same serverIf you want to export metrics to Prometheus using Django, here you go. Just add following rule to yoururlpatterns:fromdjango_satella_metricsimportexport_metricsurlpatterns=[...,path('metrics',export_metrics),...]External Prometheus serverIf you want to set up an external Prometheus server, use the following snippet:fromsatella.instrumentation.metrics.exportersimportPrometheusHTTPExporterThreadphet=PrometheusHTTPExporterThread('0.0.0.0',8080,{'service_name':'my_service'})phet.start()
Package: django-satispaython
django-satispaythonA simple django app to manage Satispay payments following theWeb-button flow.Requirementspython >= 3.6django >= 3satispaython>= 0.2InstallationYou can install this package with pip:pip install django-satispaython.UsageKey generation and key-idIn order to use django-satispaython you need to generate aRSA private keyand then get akey-id.
Django-satispaython is based onsatispaythonso you can import it,create a keyandobtain a key-id.ConfigurationOnce you created a RSA key and got a key-id add django-satispaython to your INSTALLED_APPS:INSTALLED_APPS=(#...'django_satispaython.apps.DjangoSatispaythonConfig',#...)Then add the followings to you django settings:SATISPAYTHON_PRIVATE_KEY_PATH='/path/to/my/key.pem'SATISPAYTHON_KEY_ID_PATH='/path/to/my/key-id.txt'SATISPAYTHON_STAGING=TrueSATISPAYTHON_PRIVATE_KEY_PATH: the path of your PEM file containing the RSA private key used to get your key-id.SATISPAYTHON_KEY_ID_PATH: the path of the file containing the key-id coupled with the private-key.SATISPAYTHON_STAGING: ifTruedjango-satispaython will use theSandboxendpoints.Satispay APIIn order to use theSatispay APIimport django-satispaython.api:fromdjango_satispaythonimportapiassatispayThen you can:Create a paymentsatispay.create_payment(amount_unit,currency,callback_url,expiration_date=None,external_code=None,metadata=None,idempotency_key=None)You may use satispaython utility functionformat_datetimeto get a correctly formattedexpiration_dateto supply to the request.Get payment detailssatisapy.get_payment_details(payment_id)TemplatetagsIn order to render the Satispay button just load the tag and use it in the template:{% load django_satispaython %}
...
{% satispay_button payment_id=<your_payment_id> %}Note that the button will automatically point at the endpoint (production or sandbox) specified in the projectsettings.Database and AdminDjango-satispaython comes with a SatispayPayment model which contains every info associated to a payment and is automatically showed in the admin page.:information_source: All the Satispay API functions return an instance of the SatispayPayment modelwithoutactually storing it by default.If you want to store a newly created payment in the database or update an already existing one with the informations provided by the response, set theupdateparameter toTrue.satispay.create_payment(amount_unit,currency,callback_url,expiration_date=None,external_code=None,metadata=None,idempotency_key=None,update=True)satisapy.get_payment_details(payment_id,update=True)In this case an output similar to django'supdate_or_createwill be returned.TODOSSignalsImproperlyConfiguredException
Package: django-saveall
django-saveallcustom django-admin command for saving model instances throughout a projectRequirements:Python == 2.7django == 1.7.7 to 1.8.11How to install:Runpip installdjango-saveall;Add'saveall'to INSTALLED_APPS inside your settings.pyHow to use:You can call the command usingpython manage.py saveall <app.Model>orpython manage.py saveall--<option><args>;Options available:--app<app_name>: accepts multiple arguments, saves all instances
from all models inside specific app(s);--all: accepts no arguments, saves all instances from all models
inside project;Saving instances from specific models:By default, the command accepts as argument the path of the model you
want the instances to be saved. e.g.:python manage.py saveall app01.Model01It accepts multiple paths as well:python manage.py saveall app01.Model01 app02.Model02 app03.Model03Saving instances from all models inside an app:Using the--appoption, the command will accept as argument
solely the name of the app, and will save every instance from every
model:python manage.py saveall--appapp01It accepts multiple apps as well:python manage.py saveall--appapp01 app02 app03Saving all instances from all models inside a project:Using the--alloption, the command will get every instance from
every model inside the whole project and save it. It does not accept
arguments.python manage.py saveall--all
Package: django-save-deep
save_deepThis package first saves all the children of the given oject and then the object itself.
It solves the error:ValueError: save() prohibited to prevent data loss due to unsaved related object '<<foreign_object>>'.Note: it does not work (yet) with circular dependenciesExampleSay you have this this modelclassCompany(models.Model):name=models.CharField(max_length=256)classEmployee(models.Model):username=models.CharField(max_length=256)company=models.ForeignKey(Company,on_delete=models.CASCADE)If you try to doEmployee(username='tom',company=Company(name='some-name')).save()you getValueError: save() prohibited to prevent data loss due to unsaved related object '<<foreign_object>>'.But if you use save_deep, the company is saved first, then the employeeemployee=save_deep(Employee(username='tom',company=Company(name='some-name')))This works with a deeply nested object-tree and with updates (and update/create-mixes) as well as long
as there are no circular dependencies.
Package: django-save-the-change
Save The Change takes this:>>>lancelot=Knight.objects.get(name="Sir Lancelot")>>>lancelot.favorite_color="Blue">>>lancelot.save()And does this:UPDATE"roundtable_knight"SET"favorite_color"='Blue'Instead of this:UPDATE"roundtable_knight"SET"name"='Sir Lancelot',"from"='Camelot',"quest"='To seek the Holy Grail.',"favorite_color"='Blue',"epithet"='The brave',"actor"='John Cleese',"full_name"='John Marwood Cleese',"height"='6''11"',"birth_date"='1939-10-27',"birth_union"='UK',"birth_country"='England',"birth_county"='Somerset',"birth_town"='Weston-Super-Mare',"facial_hair"='mustache',"graduated"=true,"university"='Cambridge University',"degree"='LL.B.',InstallationInstall Save The Change just like everything else:$pipinstalldjango-save-the-changeDocumentationFull documentation is available atReadTheDocs.History1.1.0 (05/16/2014)Add proper support for ForeignKeys (thanks to Brandon Konkle and
Brian Wilson).Add update_together field to model Meta, via UpdateTogetherModel.1.0.0 (09/08/2013)Initial release.
Package: django-sayit
SayIt is an open source Django application or project to store transcripts
and present them in a modern, searchable format.One example of SayIt in action is mySociety’s websitesayit.mysociety.orgwhich contains a variety
of transcripts, including:The Leveson InquiryThe Charles Taylor trialThe plays of ShakespeareAnother isOpenHouse Nova Scotia, providing an
unofficial record of the proceedings of the Nova Scotia House of Assembly.SayIt is aPoplus componentbymySociety.Get involvedIf you have transcripts you’d like to be included on our website, or have
the technical skills to create such transcripts, please seehttp://sayit.mysociety.org/about/community.For more information on how to use SayIt in your own Django project or as a
standalone site, please see ourdocumentation:InstallationTestingDevelopmentTestingIn a virtualenv, to run the tests:pip install -e .[test]
./manage.py test speeches