Saravanan666/pypi-org huggingface dataset:
Package: smartninja-redis
SmartNinja RedisA wrapper that simulates Redis on localhost (using TinyDB) and uses a real Redis db in production.Important:This package is meant to be used at SmartNinja courses for learning purposes. It is not advised to use this package for serious projects. Use the defaultredispackage instead. You only need to change the import statement.InstallationInstall via pip:pipinstallsmartninja-redisDependenciesThe package has two dependencies:tinydbandredis. It installs them automatically.UsageAccess Redis via thefrom_url()function:importsmartninja_redisasredisr_url=redis.from_url(url="localhost")r_url.set(name="Ninja",value="Smart")print(r_url.get("Ninja"))or via Redis class directly:fromsmartninja_redisimportRedisr_class=Redis(host="localhost")r_class.set(name="smart",value="ninja")print(r_class.get("smart"))For now, onlyset()andget()methods work on localhost.The following set() parameters do not work: ex, px, nx, xxTinyDBTinyDB is used to simulate Redis on localhost (if you don't have Redis installed andREDIS_URLenv var set). TinyDB does not store any data on disk (in this case). It uses memory storage only.Using a real Redis serviceIf you'd like to use SmartNinja with a real Redis service (instead of TinyDB), make sure you haveREDIS_URLenvironment variable set.ContributionsContributions via pull requests are warmly welcome!TODOtestsCI
Package: smartninja-sql
SmartNinja SQLAboutSmartNinja SQL is a simple wrapper for SQLite database (support for others might be added in the future).The purpose of this tool is to simplify connecting to SQLite and getting relevant data from it.Important:This is not an object-relational mapper (ORM). You still need to write SQL queries.InstallationThis is a pip package:pip install smartninja-sqlThe package has one dependency,prettytable. It installs it automatically.The package requires Python 3 (does not work with Python 2).UsageTake a look at this basic usage example:fromsmartninja_sql.sqliteimportSQLiteDatabasedb=SQLiteDatabase()db.execute("""CREATE TABLE IF NOT EXISTS User (id integer PRIMARY KEY AUTOINCREMENT,name text NOT NULL,age integer);""")db.print_tables(verbose=True)If you open the connection with a database like this:db = SQLiteDatabase(), the database will be created in-memory only. When the program will finish, the database will be lost.If you want a persistent database, enter a database name:db=SQLiteDatabase(name="my_database.sqlite")If this database does not yet exist, Python will create it for you. If it does exist, it will connect to it.Print table data (name & fields)This method prints the data about the tables in a database. By default theverboseparameter isFalse- in this case the method prints the names of the tables only:# same result in both casesdb.print_tables()db.print_tables(verbose=False)But if you setverboseasTrue, the method will also print out all thefield namesin each table and their respectivetypes:db.print_tables(verbose=True)QueriesDatabase statements are executed using the.execute()method:# create tabledb.execute("""CREATE TABLE IF NOT EXISTS User (id integer PRIMARY KEY AUTOINCREMENT,name text NOT NULL,age integer);""")db.print_tables(verbose=True)# alter (edit) tabledb.execute("ALTER TABLE User ADD email TEXT;")db.print_tables(verbose=True)# the table has a new field: email# insert data into a tabledb.execute("INSERT INTO User (name, age, email) VALUES ('Matt', 31, 'matt@example.org')")db.execute("INSERT INTO User (name, age, email) VALUES ('Nina', 25, 'nina@example.org')")# get data (select) and print itprint(db.execute("SELECT * FROM User;"))print(db.execute("SELECT * FROM User WHERE age=25;"))print(db.execute("SELECT * FROM User WHERE age=26;"))If you're familiar with thesqlite3library, this method returns the.fetchall()result.Pretty printThe.pretty_print()method does the same as the.execute()method, except that it also prints the data in a nice
table in the Terminal (using theprettytablepackage).db.pretty_print("SELECT * FROM User;")Connection and cursorThe SmartNinja SQL wrapper is designed to simplify work with thesqlite3library. But if you'd want to access theconnectionandcursorvariablesdirectly, you definitely can:connection=db.conncursor=db.cursorBut you most likely won't have to.Closing the cursor and connectionYou can simply close the cursor and connection with a single method:db.close()TODOtestsCI pipeline
Package: smartnoise-eval
SmartNoise EvaluatorThe SmartNoise Evaluator is designed to help assess the privacy and accuracy of differentially private queries. It includes:Analyze: Analyze a dataset and provide information about cardinality, data types, independencies, and other information that is useful for creating a privacy pipelineEvaluator: Compares the privatized results to the true results and provides information about the accuracy and biasThese tools currently require PySpark.AnalyzeAnalyze provides metrics about a single dataset.Percent of all dimension combinations that are unique, k < 5 and k < 10 (Count up to configurable “reporting length”)Report which columns are “most linkable”Marginal histograms up to n-way -- choose default with reasonable size (e.g. 10 per marginal, and up to 20 marginals -- allow override).  Trim and encode labels.Number of rowsNumber of distinct rowsCount, Mean, Variance, Min, Max, Median, Percentiles for each marginalClassification AUCIndividual CardinalitiesDimensionality, SparsityIndependenciesEvaluateEvaluate compares an original data file with one or more comparison files.  It can compare any of the single-file metrics computed inAnalyzeas well as a number of metrics that involve two datasets.  When more than one comparison dataset is provided, we can provide all of the two-way comparisons with the original, and allow the consumer to combine these measures (e.g. average over all datasets)How many dimension combinations are suppressedHow many dimension combinations are fabricatedHow many redacted rows (fully redacted vs. partly redacted)Mean absolute error by 1-way, 2-way, etc. up to reporting lengthAlso do for user specified dimension combinationsReport by bin size (e.g., < 1000, >= 1000)Mean proportional error by 1-way, 2-way, etc.
Package: smartnoise-synth
SmartNoise SynthesizersDifferentially private synthesizers for tabular data.  Package includes:MWEMMSTQUAILDP-CTGANPATE-CTGANPATE-GANAIMInstallationpip install smartnoise-synthUsingPlease see theSmartNoise synthesizers documentationfor usage examples.Note on InputsMWEM and MST require columns to be categorical. If you have columns with continuous values, you should discretize them before fitting.  Take care to discretize in a way that does not reveal information about the distribution of the data.CommunicationYou are encouraged to join us onGitHub DiscussionsPlease useGitHub Issuesfor bug reports and feature requests.For other requests, including security issues, please contact us atsmartnoise@opendp.org.Releases and ContributingPlease let us know if you encounter a bug bycreating an issue.We appreciate all contributions. Please review thecontributors guide. We welcome pull requests with bug-fixes without prior discussion.If you plan to contribute new features, utility functions or extensions to this system, please first open an issue and discuss the feature with us.
Package: smart-notes-vault
Smart Notes Vault Python LibraryThe main purpose of this library is to provide Python utilities for working with Smart Notes Vault files, enabling automation scripts to interact with them.Table of ContentsIntroductionFeaturesInstallationUsageContributionLicenseIntroductionSmart Notes Vault is a note-manipulation library helps with automatization, like utilizes metadata and tags to organize and manage notes efficiently. This Python library aims to facilitate seamless integration with the Smart Notes Vault files and enable developers to build automation scripts for various tasks, making note management a breeze.FeaturesEasy manipulation of metadata in the Smart Notes Vault file header.Convenient handling of note tags for categorization and organization.(Add more features if applicable)InstallationYou can install the Smart Notes Vault Python library using pip:pipinstallsmart-notes-vaultUsageInclude code examples or detailed instructions on how to use your library.# %% importsimportsnv# %% Open vaultvault=snv.open_vault("./../Honza")vault# %% Test find allall_notes=vault.find_note_by_path("/*")len(all_notes)# %% Find all notes with Honza tagnotes_with_tag_Honza=[]fornoteinall_notes:try:ifnote.header:tags=note.header.tags()if"Honza"intags:notes_with_tag_Honza.append(note)except:if__debug__:print(f"Skip note{note!r}")len(notes_with_tag_Honza)# %% Remove tagmodify_notes=[]fornoteinnotes_with_tag_Honza:new_note=note.header.remove_tag("Honza")modify_notes.append(new_note)len(modify_notes)# %% Save resultsfornoteinmodify_notes:vault.save_note(note)Contribution Guidelines: Encourage contributions and provide guidelines for potential contributors.ContributionContributions to the Smart Notes Vault Python library are welcome! If you find any bugs, have feature requests, or want to make improvements, please follow the steps below:Fork the repositoryCreate a new branchMake your changes and commit themPush the changes to your forked repositoryCreate a pull request to the main repositoryWe appreciate your help in making this library even better!LicenseThis project is licensed under theMIT License.
Package: smartobject
SmartObjectSmartObjectis a library to easily
manipulate object attributes with the API commands, store and synchronize
object data.SmartObject is designed to quickly build IoT applications, but can be used in
any other applications, which require combining local and distributed object
storages and changing object properties via external API calls, automatically
validating incoming data.Mapped object attributes (called properties) can be automatically validated,
saved, loaded, serialized and synchronized with the external services.SmartObject looks like ORM, but it's different from ORM: object properties can
be stored in storages of different type and combined together into a single
data object.SmartObject has built-in storage engines for files (JSON, YAML, MessagePack and
CBOR) and databases: RDBMS via SQLAlchemy (can store objects) and Redis (can
handle external properties only).Property values are automatically processed, validated and synchronized with
external services if required.Note: all SmartObject methods are thread-safe (at least they should be :)Example:You have a team of people with heart-rate sensors. Data for each person is
stored in local JSON files, heartbeat is stored in Redis database. How to
implement this with SmartObject? Just a few lines of code:importsmartobjectclassPerson(smartobject.SmartObject):def__init__(self,name):self.name=nameself.load_property_map('person.yml')self.apply_property_map()smartobject.config.storage_dir='data'smartobject.define_storage(smartobject.JSONStorage())smartobject.define_storage(smartobject.RedisStorage(),'r1')people=smartobject.SmartObjectFactory(Person)# create objects with factorypeople.create(name='John')people.create(name='Jane')# create object manuallyjack=Person('Jack')# you can set a single proppeople.set_prop('John','sex','male')people.set_prop('Jane','sex','female')# or multiple props with dict# heartbeat value is automatically written to Redisjack.set_prop({'sex':'male','heartbeat':100})# print object info (name and sex only)frompprintimportpprintpprint(people.serialize('Jane',mode='info'))people.save()jack.save()# clear Jack's sexjack.set_prop('sex',None)# load it backjack.load()# add Jack to factorypeople.create(obj=jack)# heartbeat value is automatically read from Redisprint('Heartbeat of Jack is:{}'.format(people.get('Jack').heartbeat))The fileperson.ymlis a property map for thePersonobject. It can be
loaded from the external YAML file or specified directly, as Python dict.The map for the above example looks like:name:pk:trueserialize:infosex:type:strchoices:-null-male-femalestore:trueserialize:infoheartbeat:type:floatexternal:truestore:r1Pretty simple, isn't it? You define a map, SmartObject does the job!Installpip3installsmartobjectDocumentationFull documentation is available athttps://smartobject.readthedocs.io/
Package: smart-on-fhir-client
smart-on-fhir-client 🔥Package allowing to request a fhir server with the smart-on-fhir protocol.ℹ WarningIt is not a webserver providing a webserver with a callback url
usually involved in the smart-on-fhir procedureTutorialFirst, we will need to create a partner. We can do this easily subclassing thePartnerclass.importosfromsmart_on_fhir_client.partnerimportPartnerfromsmart_on_fhir_client.strategyimportStrategyclassOauthFHIRProvider(Partner):name='PROVIDER'supported_strategies:set[Strategy]={Strategy.M2M}client_id:str=os.getenv("PROVIDER_CLIENT_ID")client_secret:str=os.getenv("PROVIDER_CLIENT_SECRET")token_url:str=...# set the token urlfhir_url:str=...# set the fhir url# additional informationaudience:str=...# audiencedatabase_reference:str=...# optionalgrant_type:str="client_credentials"# set the credentialsFHIR_PROVIDER=OauthFHIRProvider()fromsmart_on_fhir_client.clientimportsmart_client_factoryfromsmart_on_fhir_client.requester.fhir_requesterimportfhir_client_managerfromsmart_on_fhir_client.strategyimportStrategy# set up your own fhir server urlfhir_client_manager.set_own_fhir_url("http://localhost:8080/fhir")asyncdefregister():asyncwithsmart_client_factory:awaitfhir_client_manager.register_fhir_client_async(smart_client_factory.builder().for_partner(FHIR_PROVIDER).for_strategy(Strategy.M2M)# you can register special classes for specific fhir resources.register_cls_for('Patient',CustomPatientResource))first_patient=awaitfhir_client_manager.patient.search().limit(10).first()awaitfirst_patient.pipe_to_target_fhir_server()FeaturesAllow to send some fetched fhir resources to another fhir server
via thepipe_to_target_fhir_server, making data transfer between two fhir
servers easier.NotesWork based heavily on fhir-py and fhir-resources python packages
Package: smartopen
smartopen=========smartopen is a command line program that will transform text accordingto handlers to URLs and open themUsage-----``smartopen --help`` displays the program usage:"""Usage: smartopen [options]Options:-h, --help            show this help message and exit-c CONFIG, --config=CONFIGconfig file to read-u, --url             print the first url handled-a, --all             print all handlers that match the query-H HANDLERS, --handler=HANDLERSname of the handler to use, in order--print-handlers      print all handlers in order they would be tried"""smartopen reads text from standard input or command line arguments.The handlers are then iterated through in a configurable order and, ifthe handler can transform the text into a URL, the URL is thenprocessed.  Unless otherwise specified by command line options(e.g. --url, --all), the first matching URL is then opened in firefox.Handlers--------smartopen has a pluggable system of configurable handlers.  Thesetuptools entry point ``[smartopen.locations]`` is an extension pointfor the handlers.  Several handlers come with smartopen, or you canwrite your own.URL:  a resolvable URLGoogle: a google searchWikipedia: a Wikipedia articleGoogleMaps: an address in google mapsetc.Configuration-------------smartopen uses a configuration file that defines the order of thehandlers and their behavior.A simple example is shown here:http://k0s.org/hg/smartopen/file/tip/smartopen.iniInterfacing With Your Environment---------------------------------While smartopen is useful of its own right, its utility may beenhanced by using as part of an environment.  For instance, I run thefluxbox window manager which allows the use of hotkeys.  By bindingsmartopen to ``Ctrl+Alt+s`` and using ``xclip``, I can open a URL that ismappable to a smartopen handler with a keyboard shortcut.  Therelevant line from my ``~/.fluxbox/keys`` file reads:Control Mod1 s :ExecCommand /home/jhammel/python/smartopen.py "$(xclip -o)" # smartopen----Posterity is gained...----------------------I mostly wrote smartopen to help me.  That it has.However...a few things....- better way of setting up handlers?- really, i want to push down to choose what i think the handler is,but only should we I release the hand that Jesus becomes Magic(sorry, I hate the movie too)....and more?Was reading about catfish....e.g.http://www.addictivetips.com/ubuntu-linux-tips/catfish-file-searching-tool-for-ubuntu-linux/..."""file search tool that support several different enginesA file search tool using different backends which is configurable viathe command line.This program acts as a frontend for different file search engines.The interface is intentionally lightweight and simple. But it takesconfiguration options from the command line.Currently find, locate, tracker, strigi, pinot, and beagle aresupported as backends""".Should smartopen....be a pluggable thing that takes text and findsboth *the handler* and *what to do with it*???I mean, short of it being a neural network anyway....
Package: smart-pandas
SMART_PANDAS 🤖Supercharge your data science workflows with 🐐 Ollama models.smart-pandasis a Python library highly inspired by the pandas-gpt, to perform the diverse operations on apandasDataFrame using llama 2 model.InstallationFirst install the ollama from 🐐ollama. Ollama is required and need to be installed must.pipinstallsmart-pandasExamplesimportpandasaspdimportsmart_pandasdf=pd.DataFrame('https://raw.githubusercontent.com/owid/covid-19-data/master/scripts/input/un/handwashing_facilities.csv')# Data transformationdf=df.ask('Remove iso_code')# Queriestop_10=df.ask('what are the top 10 most locations having handwashing_facilities, as a table')# Plottingtop_10=top_10.ask("Reset index")top_10.ask('horizontal bar plot, seaborn colors with width 700')AurthorMuntakimur RahamanSenior Data Scientist,Innova-analytics.aiContact:muntakim.cse@gmail.comAlternativespandas-gpt: OpenAI based pandas auto-completion (Paid api key)GitHub Copilot: General-purpose code completion (paid subscription)Sketch: AI-powered data summarization and code suggestions (works without an API key)DisclaimerPlease note that thelimitationsof llama 2 also apply to this library. I would recommend usingsmart-pandasin a sandboxed environment such asGoogle Colab,Kaggle, orGitPod.
Package: smartparse
Makes the ConfigParser smarter.A SmartParser provides methods to parse options as objects of the datetime-modules, as
list or as ‘smartlist’.
Items of a smartlist are automatically tried to converted into different
types (such as: int, float, time, date, datetime).It also provides additional get- and itme-methods (xget, xitem):
xget tries to get the option as one of the following types (in this
order): int, float, boolean, time, date, datetime, smartlist.
If every type fails the option is given as string.Latest VersionThe latest version of this project can be found at :http://github.com/thomst/smartparse.InstallationOption 1 : Install via pippip install smartparseOption 2 : If you have downloaded the sourcepython setup.py installDocumentationHow to use?import io
from smartparse import SmartParser

CONFIG = """
[Section]
bool = yes
int = 3
float = 3.3
time = 23:55:00
date = 2013.04.24
datetime = 2013.04.24 23:55:00
list = one two three four
smartlist = 3 4.4 1:55 yes 2013.04.24 2013.04.24_01:55
"""

config = SmartParser(allow_no_value=True)
config.readfp(io.BytesIO(CONFIG))
section = dict(self.config.xitems('Section'))

section['bool']             # True
section['datetime']         # datetime.datetime(2013, 4, 24, 23, 55)
section['list']             # ['one', 'two', 'three', 'four']
section['smartlist'][2]     # datetime.time(1, 55)
section['smartlist'][4]     # datetime.date(2013, 4, 24)Changes v0.5:Backwards incompatibility:getsmartlist became getxlist.
Removed the config-methods. Use the timeparser-module directly to change the
configuration about parsing time-, date- and datetime-objects.Reporting BugsPlease report bugs at github issue tracker:https://github.com/thomst/smartparse/issuesAuthorthomst <thomaslfuss@gmx.de>
Thomas Leichtfußhttp://github.com/thomst
Package: smart-path
smart_pathDispatch topathlib.Pathif a local file system path is given,
ors3path.S3Pathif the given path is prefixed withs3://ExampleBasicfromsmart_pathimportsmart_pathfrompathlibimportPathfroms3pathimportS3Path# A local path on file systempath_local=smart_path("/tmp/t")assertisinstance(path_local,Path)# A s3 path on osspath_brainpp_oss=smart_path("s3://public-datasets-contrib/",endpoint_url='s3.amazonaws.com')assertisinstance(path_local,S3Path)Stub Modefromsmart_pathimportsmart_path# Stub mode works like the symbolic link in Unix. The source path can be either# on local file system or brain++ oss, so do the target path. Stub Mode is# excepted to be helpful when we need to store a large file on oss and pretend# it is on local file system.## In stub mode, smart_path writes to two destinations:# 1. The string "hello-world" is written to `s3://somewhere/on/oss`# 2. The path "s3://somewhere/on/oss" is written to `corresponding/local/path`path=smart_path('s3://somewhere/on/oss',stub='corresponding/local/path')path.write_text('hello-world')# smart_path knows it is a stub filestub=smart_path('corresponding/local/path')print(stub.read_text())# prints "hello-world"Installationpipinstall-egit://github.com/wanzysky/smart_path.git#egg=smart_path# Or from PyPIpipinstallsmart_pathNotice:The entire project is borrowed from EMTF: EMTF-at-megvii-dot-com.
Package: smart-pathlib
# smart_pathlib - utils for making common path operations interoperable with Cloud object storages## What ?smart_pathlibis highly inspired bysmart_openand provide drop-in
replacement for Python part ofos,os.path,globmodules functions such asexists,stat,listdir,glob.## Why ?The goal is to provide a clean and Pythonic API for common file manipulations.
It simplifies rapid application development, making your code that manipulates
files interoperable with local file system and Cloud blob storage solutions
such as S3, GCS, Azure Blob Storage.## ExampleA drop-in replacementos.path.existsthat operates on different storage types:`python # Test if a local file exists from smart_pathlib import exists assertexists('/Users/me/Downloads/test_file.txt')``python # Test if a file exists on GCS from smart_pathlib import exists assertexists('gs://my_bucket/test_file.txt')`## InstallationYou can select the “flavor” ofsmart_pathlibto install, depending on your
storage provider:` pip install smart_pathlib[gcp]    # Install GCP deps `Or install all packages using:` pip install smart_pathlib[all] `
Package: smartpay
Smartpay Python SDKThe Smartpay Python SDK offers easy access to Smartpay API from applications written in Python.PrerequisitesPython v3+Installationpipinstall--savesmartpayUsageThe package needs to be configured with your own API keys, you can find them on yourdashboard.fromsmartpayimportSmartpaysmartpay=Smartpay('<YOUR_SECRET_KEY>',public_key='<YOUR_PUBLIC_KEY>');If you would like to know how Smartpay payment works, please see thepayment flowfor more details.Create Checkout sessionpayload={items:[{name:"レブロン 18 LOW",amount:250,currency:"JPY",quantity:1,},],shipping:{line1:"line1",locality:"locality",postalCode:"123",country:"JP",},# Your internal reference of the orderreference:"order_ref_1234567",# Callback URLssuccessUrl:"https://docs.smartpay.co/example-pages/checkout-successful",cancelUrl:"https://docs.smartpay.co/example-pages/checkout-canceled",test:true,};session=smartpay.create_checkout_session(payload);To retreive the session URLsessionURL=smartpay.get_session_url(session);We also prepare a morereal-world examplefor you to refer to.