Saravanan666/pypi-org huggingface dataset:
Package: django-smart-models
Django smart modelsMake your Django models & fields smarter with built-in support for OpenAI & Stability AI APIsQuick startInstalldjango-smart-modelspipinstalldjango-smart-modelsAdd "smart_models" to your INSTALLED_APPS setting like this:INSTALLED_APPS=[...'smart_models',]Run migrations to create smart_models modelspythonmanage.pymakemigrationssmart_models
pythonmanage.pymigrate# Initialize API configurationspythonmanage.pyinit_smart_modelsGetOpenAIandStability AIAPI keysAdd API keys to environment variablesOPENAI_API_KEYandSTABILITYAI_API_KEYCopy & paste below code snippet tosettings.pyAI_API_SETTINGS={"openai":{"key":os.getenv("OPENAI_API_KEY"),},"stability_ai":{"key":os.getenv("STABILITYAI_API_KEY"),"host":"grpc.stability.ai:443",},}UsageReferdemofor sample usage exampleFieldsSmartTextFieldSupports auto spell correction, translation, generating summary, generating emojis along with title generation tasks.Base class:models.TextFieldParameters:data_fields:list[str]spell_correct:booltranslate:booltarget_lan:strgenerate_title:boolmax_title_length:intsummarize:boolemojify:boolapi_provider:models.APIProvidersSmartImageFieldSupports thumbnail generation for a given article/textBase class:models.ImageFieldParameters:data_fields:list[str]thumbnail:boolimage_height:intimage_width:intimage_extension:strapi_provider:models.APIProvidersAudioToTextFieldSupports tasks of transcribing an audio or generating translation of an audio (text)Base class:models.TextFieldParameters:data_fields:list[str]transcribe:booltranslate:boolapi_provider:models.APIProvidersAPIProvidersBase class:models.TextChoicesChoices:OPENAISTABILITYAIGCP# API support yet to be addedAZURE# API support yet to be addedAWS# API support yet to be addedModelsTextAIModelImageAIModelAudioAIModelTODO:There is room for lots of improvements and will be taken up in future.[] async and celery based task execution[] Exception handling for OpenAI max_tokens[] Integrate all OpenAI APIs[] Stability AI API integration[] Hugging Face AI API integration[] GCP, Azure, AWS AI API integrationAs this is more of a hobby project, updates would be pushed at very slow speed. But pull requests are welcome!
Package: django-smart-pagination
Generate pagination links for DjangoInstead of displaying links to all the pages at once, django-smart-pagination calculates a limited subset of them.Works with Django Templates and Jinja2.UsageFirst addsmart_paginationto your installed apps:INSTALLED_APPS=['smart_pagination']Use a pagination block passing thePageobject, the number of links (literal of variable)
and the name to associate thesmart_pagination.Paginatorobject.{%loadpagination_tags%}{%paginatepage_objnum_linkspaging%}<ul>{%forpageinpaging.pages%}<li class="{%ifpage.is_current%}current{%endif%}">{{page.number}}</li>{%endfor%}</ul>{%endpaginate%}ThePaginatorobject contains the following properties:firstFirstPage. Will beNoneif it is already the first page.prevPreviousPage. Will beNoneif there is no previous page.pagesList of pages.nextNextPage. Will beNoneif there is no next page.lastLastPage. Will beNoneif it is already the last page.{%loadpagination_tags%}{%paginatepage_objnum_linkspaging%}<ul>{%ifpaging.first%}<li>First -{{paging.first.number}}</li>{%endif%}{%ifpaging.prev%}<li>Previous -{{paging.prev.number}}</li>{%endif%}{%forpageinpaging.pages%}<li class="{%ifpage.is_current%}current{%endif%}">{{page.number}}</li>{%endfor%}{%ifpaging.next%}<li>Next -{{paging.next.number}}</li>{%endif%}{%ifpaging.last%}<li>Last -{{paging.last.number}}</li>{%endif%}</ul>{%endpaginate%}If you are sending the page_kwarg as a query parameter, you can optionally pass a fourth argument with the name
of the page_kwarg and thePaginatorwill provide the query string without the page_kwarg:{%loadpagination_tags%}{%paginatepage_objnum_linkspaging'page'%}<ul>{%forpageinpaging.pages%}<li><a href="?page={{page.number}}&{{paging.query}}">{{page.number}}</a></li>{%endfor%}</ul>{%endpaginate%}
Package: django-smart-proxy
[![Latest Version](https://pypip.in/version/django-smart-proxy/badge.svg)](https://pypi.python.org/pypi/django-smart-proxy/)[![Downloads](https://pypip.in/download/django-smart-proxy/badge.svg)](https://pypi.python.org/pypi/django-smart-proxy/)Django Smart Proxy==================Django Smart Proxy is a plug-and-play solution for implementing pass-through proxies ina Django-based environment.**Extensibility**<br/>Django Smart Proxy exposes a *request_decorators* parameter that makes it easilyextensible, allowing access to the request "pipeline" before being sent to the host.**Common Use Cases**- Handling OAuth on the server-side to avoid exposing secret keys to the client.- As an alternative to CORS for making cross-domain AJAX requests.- Anything else...?Installation============**Requires**- Python >= 2.6 (supports up to 3.4)- Django >= 1.4 (Python 2 support up to 1.6.x)*For all requirements, see <a href="https://github.com/celerityweb/django-smart-proxy/blob/master/setup.py" target="_blank">setup.py</a>.***Installing**```pip install django-smart-proxy```Usage=====1. Add ```smart_proxy``` to ```INSTALLED_APPS``` in your ```settings.py```.**Example**```pythonINSTALLED_APPS = (...,'smart_proxy',...,)```2. Add a ```SMART_PROXIES``` dictionary to ```settings.py``` to configure an arbitrary number of proxies.**Example**```pythonSMART_PROXIES = {'instagram': {'host_endpoint': 'https://api.instagram.com/v1/','allowed_methods': ('get', 'put', 'post', 'delete',),'timeout': 60.0,},'twitter': {'host_endpoint': 'https://api.twitter.com/1.1/','allowed_methods': ('get', 'put', 'post', 'delete',),'timeout': 60.0,'request_decorators': ('channel.apps.twitter_auth.utils.append_authorization_header',),},}```3. Edit your ```urls.py``` to configure a root URL mapping for the proxies.**Example**```pythonurlpatterns = patterns(...,url(r'^proxy/', include('smart_proxy.urls')),...,)```4. If applicable, provide an implementation for your request decorators.**Example**```pythonfrom django.conf import settingsfrom requests_oauthlib import OAuth1def append_authorization_header(request, session):"""This function decorates requests to the Twitter proxy with asigned oauth-compliant Authorization header."""client_key = getattr(settings, 'SOCIAL_AUTH_TWITTER_KEY', None)client_secret = getattr(settings, 'SOCIAL_AUTH_TWITTER_SECRET', None)if client_key and client_secret:request.auth = OAuth1(client_key,client_secret=client_secret,resource_owner_key=session.get('twitter_oauth_token'),resource_owner_secret=session.get('twitter_oauth_token_secret'))return request```5. You're Done!In this example, your proxies will be available at ```/proxy/instagram/``` and ```/proxy/twitter/``` respectively.
Package: django-smart-pwa
Django pwa can convert your project into a progressive web application within seconds. Just install the package
add into INSTALLED_APPS and add urlpatterns and you are done.Quickstart1.Add pwa to your INSTALLED_APPS settings like this:INSTALLED_APPS = [……,
‘pwa’,]Include the polls URLconf in your project urls.py like thisurlpatterns = [path(‘’,include(‘pwa.urls’)),]Place the static folder in your main project directory
Package: django-smart-redis
it is SMAAAART!!Quick startInstall packages:pip install django-smart-redisAdd “django_smart_redis” to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...
    'django_smart_redis',
    ...
]Settings:SMART_REDIS_HOST='127.0.0.1'
SMART_REDIS_PORT=6379
SMART_REDIS_DB=0
SMART_REDIS_PASSWORD="pswd"
SMART_REDIS_NAMESPACE="cache"Example code:Coming soon…
Package: django-smart-save
Makesavecallfull_clean.Do you think Django modelssavemethod will validate all fields
(i.e. callfull_clean) before saving or any time at all? Wrong!I discovered this awful truth when I couldn’t understand why
a model object with an email field (withoutblank=True) could be
saved with an empty string as email address.More info:“Why doesn’t django’s model.save() call full clean?”http://stackoverflow.com/questions/4441539/“Model docs imply that ModelForm will call Model.full_clean(), but it won’t.”https://code.djangoproject.com/ticket/13100InstallingFirst add the application to your Python path. The easiest way is to usepip:pip install django-smart-saveYou should install by downloading the source and running:$ python setup.py installConfiguringMake sure you havedjango.contrib.authinstalled, and add thesmart_saveapplication to yourINSTALLED_APPSlist:INSTALLED_APPS = (
    ...
    'django.contrib.auth',
    'smart_save',
)You can specify a different method name in your project settings (default: save_if_valid):SMART_SAVE_METHOD = ‘my_save’Usage OverviewIt is simple:>>> user = User(username="chris")
>>> user.save_if_valid()
True
>>> user = User(username="")
>>> user.save_if_valid()
False
>>> user._errors
{'username': ['This field cannot be blank.']}LicenseAnyone is free to use or modify this software under the terms of the BSD
license.
Package: django-smart-selects
Django Smart SelectsThis package allows you to quickly filter or group "chained" models by adding a custom foreign key or many to many field to your models. This will use an AJAX query to load only the applicable chained objects.Works with Django version 2.2 to 4.0.Warning: The AJAX endpoint enforces no permissions by default.  This means thatany model with a chained field will be world readable. If you would like more control over this permission, thedjango-autocomplete-lightpackage is a great, high-quality package that enables the same functionality with permission checks.DocumentationFor more information on installation and configuration see the documentation at:https://django-smart-selects.readthedocs.io/Reporting issues / sending PRsYou can try the test_app example using:pythonmanage.pymigrate
pythonmanage.pyloaddatatest_app/fixtures/*
pythonmanage.pyrunserverThen login with admin/admin athttp://127.0.0.1:8000/admin/TODOAdd permission checks to enable users to restrict who can use the chained fields.Add aChainedCheckboxSelectMultiplewidget and adjustchainedm2m.jsandchainedfk.jsto build checkboxes in that case
Package: django-smart-slug
slug fields for the lazyExamplesThere are exhausting examples in the tests, but here’s the quick rundown:from django.db import models
from smart_slug.fields import SmartSlugField

class Simple(models.Model):
    slug = SmartSlugField(max_length=5, underscores=False)

class Complex(models.Model):
    title = models.CharField(max_length=100)
    slug = SmartSlugField(
        source_field='title',
        date_field='pub_date',
        split_on_words=True,
        max_length=10)
    pub_date = models.DateTimeField(auto_now=True)

>>> s1 = Simple.objects.create(slug='simple')
>>> s1.slug
simpl

>>> s2 = Simple.objects.create(slug='simple')
>>> s2.slug
sim-1

>>> s3 = Simple.objects.create(slug='simple')
>>> s3.slug
sim-2

>>> c1 = Complex.objects.create(title='complex example')
>>> c1.slug
complex

>>> c2 = Complex.objects.create(title='complex example')
>>> c2.slug
complex_
Package: django-smartspaceless
Django Smart Spacelessis aDjangotemplate tagapplication for minifying block-level HTML elements only.It’s just likespaceless, but preserves white space between inline HTML elements. Useful for HTML where spaces directly between<a>,<strong>, and other inline elements is likely desired to be preserved. Packages thedjango-htmlminproject to be used as a template tag.Package distributionCode repositoryDocumentationTestsInstall$pipinstalldjango-smartspacelessAdd tosettings.py.INSTALLED_APPS=[# ...'smartspaceless',]Usage{%loadsmartspaceless_tags%}{%smartspaceless%}<p><a href="#">Link 1</a></p>
<p><a href="#">Link 2</a> <a href="#">Link 3</a></p>{%endsmartspaceless%}Result:<p><ahref="#">Link 1</a></p><p><ahref="#">Link 2</a><ahref="#">Link 3</a></p>The space between<ahref="#">Link2</a>and<ahref="#">Link3</a>is preserved. Removing that space would be bad.NotePlease note thatdjango-htmlminby default uses thehtml5libparser, which prepends possibly missing<html><head></head><body>and appends possibly missing</body></html>tags in an effort to create valid HTML. The template tag changes this default behavior to usehtml.parser, the HTML parser in Python’s standard library, which does not alter HTML fragments.
Package: django-smarttest
GoalProvide code snippets which help running tests in Django.InstallationInstall requirements:pip install -r requirements.txtInstall Smarttest:pip install django-smarttestor current development version:pip install hg+https:://bitbucket.org/kidosoft/django-smarttestConfigurationINSTALLED_APPS=[...'smarttest',...]UsagePreventing tests from touching databaseimportunittestfromsmarttest.decoratorsimportno_db_testcase@no_db_testcaseclassSomeTestCase(unittest.TestCase):deftest_some_test(self):...If you’ll accidentally write code that tries to run some query on database
you’ll get exception.Running only selected test typesimportunittestfromsmarttest.decoratorsimporttest_type@test_type('acceptance')classSomeAcceptanceTestCase(unittest.TestCase):deftest_some_acceptance_test(self):...@test_type('unit')classSomeUnitTestCase(unittest.TestCase):deftest_some_unit_test(self):...classUnspecifiedTypeTestCase(unittest.TestCase):deftest_some_test(self):...$python-munittestscript...----------------------------------------------------------------------Ran3testsin0.000sOK$IGNORE_TESTS=unitpython-munittestscript.s.----------------------------------------------------------------------Ran3testsin0.000sOK(skipped=1)$IGNORE_TESTS=acceptancepython-munittestscripts..----------------------------------------------------------------------Ran3testsin0.000sOK(skipped=1)$IGNORE_TESTS=acceptance,unitpython-munittestscriptss.----------------------------------------------------------------------Ran3testsin0.000sOK(skipped=2)Test type can be any selected word. It doesn’t have to be “unit” or “acceptance”. You can have different test types for running in different environments if you need.TestCase for use with switchable splinter driverSimple TestCase that allows for simple switching between different drivers
in tests.In settings.py:TEST_DRIVER='firefox'# or django or any otherIn test:fromsmarttest.testcasesimportSplinterTestCaseclassSomeTestCase(SplinterTestCase):deftest_some_test(self):self.browser.visit(self.get_host()+'/')If you run tests continuously (e.g. doing Test Driven Development)
TEST_DRIVER=’django’ (default setting) is the fastest driver that do not
interrupt your workflow. However when you run your acceptance tests you may want
to check how it behaves with real browser. Simply set TEST_DRIVER=’firefox’
or any other real browser supported by splinter.Supported Django versionsTested with:Django 1.2.7 on python2.7Django 1.3.7 on python2.7Django 1.4.16 on python2.7Django 1.5.11 on python2.7, python3.3, python3.4Django 1.6.8 on python2.7, python3.3, python3.4Django 1.7.1 on python2.7, python3.3, python3.4Documentationhttp://kidosoft.pl/docs/django-smarttest/
Package: django-smarturlfield
Django model and form fields that performs URL normalization. For example it adds‘http://’prefix and forces punicode encoding.
There are also fields that stores a list of URLs.Tested with Django 3.0.x (should also work for 2.x)Installing$ pip install django-smarturlfieldFieldsSmartURLFormFieldrenders as<input>and can handle values like this:http://example.comexample.com(normalized tohttp://example.com)земфира.рф(normalized tohttp://xn--80ajfftz0a.xn--p1ai)MultipleSmartURLFormFieldrenders as<textarea>and can store multiple URLs separated by newline.UsageIn forms:fromsmarturlfieldimportSmartURLFormField,MultipleSmartURLFormFieldclassMyForm(forms.Form):url=SmartURLFormField()url_list=MultipleSmartURLFormField()# textarea# ...In models:fromsmarturlfieldimportSmartURLDbField,MultipleSmartURLDbFieldclassMyModel(models.Model):url=SmartURLDbField()url_list=MultipleSmartURLDbField()# textarea# ...
Package: django-smarty
Django Smartyis aDjangotemplate filterapplication to convert ASCII punctuation characters into smart typographic punctuation HTML entities withSmartyPants. Uses thePython smartypantspackage.Package distributionCode repositoryInstall$pipenvinstalldjango-smartyAdd tosettings.py.INSTALLED_APPS=[# ...'smarty',]Usage{%loadsmarty_tags%}{{post.body|smarty}}Result:&#8220;Hello&#8212;world!&#8221;Settingssmartyis a filter composed of several smaller filters:smartypantsis the original SmartyPantssmartycapswraps capital letters in<spanclass="initialism"></span>One can apply any filter individually. For example, if one preferred the original SmartyPants, write{{ post.body|smartypants }}.One can customize the application and order ofsmartyfilters with theSMARTY_FILTERSsetting. By default, theSMARTY_FILTERSsetting is:SMARTY_FILTERS=['smartypants','smartycaps',]One can also customize the HTML class ofsmartycapswith theSMARTY_CAPS_CLASSsetting. By default, theSMARTY_CAPS_CLASSsetting is:SMARTY_CAPS_CLASS='initialism'
Package: django-smb
django-smbA django app to manage data sourcing from remoteSMBlocations.This app creates models for SMB location configuration and file syncing.
The models are complemented with some utility methods to facilitate data import.Quick startAdd "django_smb" to your INSTALLED_APPS setting like this::INSTALLED_APPS = [  
        ...  
        'django_smb',  
    ]Include the dicom URLconf in your project urls.py like this::path('smb/', include('django_smb.urls')),Runpython manage.py migrateto create the dicom models.Start the development server and visithttp://127.0.0.1:8000/admin/.Visithttp://127.0.0.1:8000/dicom/.
Package: django-smelly-tokens
It is sometimes possible to tell that code stinks even without looking at it.
This Django app tries to accomplish that.Installationpipinstalldjango-smelly-tokensUsageIn yoursettings.pydefineSMELLY_TOKENS_APPLICATIONSlist with
packages you want to inspect.In a package with code quality tests (e.g. test_tokens.py) import tests you
want to check your apps against:fromsmelly_tokens.test_smelly_tokensimport(EvalTokenTestCase,PdbTokenTestCase,)Rundjango-admin.pytestor./manage.py testorpy.testornoseor whatever runner you’re using.ExceptionsTo silence known errors PEP8-stylenoqacomment can be used in the
beginning of a file:# smelly_tokens: noqaOr in-line:eval('print 123')# noqaTo exclude an entire directory add it’s path toSMELLY_TOKENS_EXCLUDE_DIRSlist insettings.Adding your own tokensTo create a new type of smelly token test case, inheritSmellyTokensTestCaseand override_tokenslist:fromdjango.testimportTestCasefromsmelly_tokens.test_smelly_tokensimportSmellyTokensTestCaseclassOOPTokensTestCase(SmellyTokensTestCase,TestCase):""" OOP hater. """_tokens=['class','object','Object']ReferencesFull documentation;Changelog0.5.0 (2022-06-06)Use pathlib for path manipulation.0.4.6 (2020-09-21)Better directory exclusion.0.4.5 (2020-09-21)New pkgutil.get_loader fix.0.4.4 (2018-06-06)#movingtogitlab0.4 (2017-05-06)Introduced zest.releaser.Released to PyPI.Documentation.0.3 (2017-05-02)Python 2 / 3 compatibility.Multiple tokens per class.
Package: django-smileys
django-smileysis an application that allows your Django-powered site to
display those annoying and useless smileys whenever thesmileysfilter a
pattern that you specify.  This application serves a very simple purpose, but
its uses can go beyond that of merely inserting smileys whenever a particular
pattern (like “:)” or “;)”).  It can replace whatever pattern you want with an
image of your choosing.  There’s gotta be something useful in that, right?This application can make your blog, forums, photo galleries, user comments,
etc a little more interesting, and it’s very simple to install.  Free icon sets
plague the Internet, and you can choose whatever icons you’d like to use!FeaturesStrict pattern matching: you can specify very strict patterns for your
smileysRegular expression pattern matching: if you need a little more power in your
pattern matching capabilities, you can specify that your patterns are regular
expressions (on a per-smiley basis) and the filter should know what to do.RequirementsThis application was built on Django 1.0.2, and it should work with any version
of Django that uses theadmin.site.registermethod for telling the Django
admin that a model should appear in the admin (as opposed to theclass Admin:method).InstallationDownloaddjango-smileysusingoneof the following methods:easy_install or pipYou can download the package from theCheeseShopor use one of the following
commands:easy_install django-smileys
pip install -U django-smileysto download and installdjango-smileys.Clone From Version ControlYou can grab the latest copy of the source code by cloning the project from one
of these official repositories:hg clone http://bitbucket.org/codekoala/django-smileys
git clone http://github.com/codekoala/django-smileys.git
hg clone http://django-smileys.googlecode.com/hg django-smileysPackage DownloadDownload the latest.tar.gzfile from the downloads section and extract it
somewhere you’ll remember.ConfigurationFirst of all, you must add this project to your list ofINSTALLED_APPSinsettings.py:INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    ...
    'smileys',
    ...
)Runmanage.py syncdb.  This creates a the table in your database that is
necessary for operation.UsageOpen the template file that you want to have your smileys appear in and make
sure it has something like this in it:{% load smiley_tags %}

{% block content %}
{{ some_content_var|smileys }}
{% endblock %}Thesmiley_tagslibrary provides you with asmileysfilter, which will
examine your database for all active smileys.  It then runs thoughsome_content_var(in this example) and replaces the patterns it finds with
the respective smileys.  More recent versions also contain atextile_smileystag for users of Textile formatting.  Pretty simple huh!And useless! w00t.