Saravanan666/pypi-org huggingface dataset:
Package: saet-sockjs-tornado
SockJS-tornado is a Python server side counterpart ofSockJS-client browser libraryrunning on top ofTornadoframework.Simplified echo SockJS server could look more or less like::from tornado import web, ioloop
from sockjs.tornado import SockJSRouter, SockJSConnectionclass EchoConnection(SockJSConnection):def on_message(self, msg):self.send(msg)if __name__ == ‘__main__’:EchoRouter = SockJSRouter(EchoConnection, ‘/echo’)app = web.Application(EchoRouter.urls)
app.listen(9999)
ioloop.IOLoop.instance().start()(Take look atexamplesfor a complete version).Subscribe toSockJS mailing listfor discussions and support.SockJS-tornado APISockJS provides slightly different API thantornado.websocket. Main differences are:Depending on transport, actual client connection might or might not be there. So, there is no _self.request_ andothertornado.web.RequestHandlerproperties.Changedopencallback name toon_opento be more consistent with other callbacks.Instead ofwrite_message, all messages are sent usingsendmethod. Just in case,sendintornado.web.RequestHandlersends raw data over the connection, without encoding it.There is handybroadcastfunction, which accepts list (or iterator) of clients and message to send.SettingsYou can pass various settings to theSockJSRouter, in a dictionary:MyRouter = SockJSRouter(MyConnection, '/my', dict(disabled_transports=['websocket']))Deploymentsockjs-tornado properly works behind haproxy and it is recommended deployment approach.Sample configuration file can be foundhere.If your log is full of “WARNING: Connection closed by the client”, passno_keep_aliveasTruetoHTTPServerconstructor:HTTPServer(app, no_keep_alive=True).listen(port)or:app.listen(port, no_keep_alive=True)Changelog1.0.7Tornado 6.x compatibility fix. Minimum supported Tornado version is 4.x now.XSS fix1.0.6XSS security fix for the HTMLFILE transport1.0.2Tornado 5.x compatibility fix1.0.1Tornado 4.x compatibility fix1.0.0Major version bump. sockjs-tornado can be considered maturePython 3 supportTornado 3.0 support on both Python 2 and Python 3Bug fixes0.0.5iOS 6 supportSockJS 0.3.3 client supportSome headers and request URI path is now passed to on_open handlerAdded binary transport support for raw websocket transportMinor multiplex sample fixes0.0.4Added support for older simplejson library versionsFixed installation script0.0.3SockJS 0.3 supportConnection multiplexing sampleIP validation is now optional0.0.2SockJS 0.2 support and compatibility fixes0.0.1Initial release.
Package: safaa
SafaaSafaa is a Python package designed for handling false positive detection in copyright notices.
Additionally, it can declutter copyright notices, removing unnecessary extra text.FeaturesLoad pre-trained models or train your own.Integration with scikit-learn for training and prediction.Integrated with spaCy for named entity recognition and decluttering tasks.Preprocessing tools to ensure data consistency and quality.Ability to handle local or default model directories.InstallationTo install Safaa, simply use pip:pipinstallsafaaUsageInitializationfrom safaa.Safaa import *
agent = SafaaAgent()Preprocessing Datadata = ["Your raw data here"]
preprocessed_data = agent.preprocess_data(data)Predicting False Positivespredictions = agent.predict(data)Decluttering Copyright Noticesdecluttered_data = agent.declutter(data, predictions)Training ModelsTo train the false positive detector:training_data = ["Your training data here"]
labels = ["Your labels here"]
agent.train_false_positive_detector_model(training_data, labels)To train the named entity recognition model:train_path = "path/to/train.spacy"
dev_path = "path/to/dev.spacy"
agent.train_ner_model(train_path, dev_path)Saving Trained Modelssave_path = "path/to/save"
agent.save(save_path)Dependenciesscikit-learnspaCyjoblibregexosshutilLicenseThis project is licensed under theGNU LESSER GENERAL PUBLIC LICENSE, Version 2.1, February 1999.Contact InformationName: Abdelrahman JamalEmail:abdelrahmanjamal5565@gmail.comLinkedIn:linkedin.com/in/abdelrahmanjamal
Package: safari-bookmarks-cli
safari-bookmarks-cliA cli to manage bookmarks in the Safari web browser.This utility interacts with Safari'sBookmarks.plistfile. When it detects changes it is reloaded without intervention.NotemacOS 10.14+ requires Full Disk Access for the application being used. ie. Terminal, iTerm, etc.InstallationYou can install safari-bookmarks-cli via pip:pip3installsafari-bookmarks-cli# verify installationsafari-bookmarks--versionUsageThe following assumes the default location for Safari's bookmarks, which is~/Library/Safari/Bookmarks.plist. If this is not the case you can specify an alternate location by passing the arguments-f <elsewhere>.For a full list of commands and options just run:safari-bookmarks--helpTo list all bookmarks runsafari-bookmarkslistAdd a new bookmark to the menubarsafari-bookmarksadd--title"New bookmark"--url"http://example.com"--toBookmarksMenuAdd a new bookmark to the menusafari-bookmarksadd--title"New folder"--list--toBookmarksBarMove a bookmark to a different foldersafari-bookmarksmove--title"New bookmark"--to"New folder"Remove a bookmark or folderNoteremoving a folder will also remove all bookmarks and folders within it.safari-bookmarksremove"New folder"TestingClone the repository:gitclonehttps://github.com/evilmarty/safari-bookmarks-cli.gitInstall pytest and flake8pip3installpytestflake8Run thempytest&&flake8
Package: safarireadinglist
Safari reading list in Pythonsafarireadinglistis a Python package to load your Safari reading list into Python, and to export it, including thumbnail icons.Sample resultsInstallationInstall thesafarireadinglistpackage from PyPI:pipinstallsafarireadinglistNote: before using, you need to give the terminal full disk access in the system preferences. Go toSettings/Security & Privacy/Full Disk Access. Navigate to/Applications/Utilities/folder and choose theTerminalapp. If you are launching the command from VS Code you will need to add this as well.Alternative local installation:pipinstall-e.Note:setuptoolsis the only requirement. For dev purposes, you may want to install the exact versions inpip install -r requirements.txt.UsageIn the command line, execute:export-safari-rlexportThe reading list will be inreading_list.json. You may also provide other options:export-safari-rl --help.You can also export the icons from the reading list:export-safari-rlexport-iconsThe icons will be in thereading_list_iconsfolder.See also theREADMEin theexamplesfolder for more examples.Python packageThe package is a Python package and can also be used as such. Seeexample_python.pyfor an example.Example of output formatSeereading_list.json. The format is a list of dictionaries, where each dictionary conforms to thesafarireadinglist.ReadingListItemdataclass.WebsiteTo generate the website from thewebsitefolder, run:cd website
python website.py reading_list.json reading_list_iconsThe output is in thewebsite_outfolder.Known errors & solutionsIf you are getting some error like this:cp:/Users/XXX/Library/Safari/Bookmarks.plist:OperationnotpermittedYou need to give the terminal full disk access. Go toSettings/Security & Privacy/Full Disk Access. Navigate to/Applications/Utilities/folder and choose theTerminalapp. If you are launching the command from VS Code you will need to add this as well.
Package: safe_access
Safe Access==============Tired of always checking hasattr, len, or if a key is in a dictionary? safe_access allowsyou to safely drill down multiple levels into any python object without having to worry aboutAttributeErrors, KeyErrors, or IndexErrors. Oh, and it supports wildcards.*Available on pypi*: https://pypi.python.org/pypi/safe_accesspythonfrom safe_access import safe_accessclass A(object):passa = A()a.b = {"abc": ['x', 'y', 'z'], "def": [1, 2, 3]}# Access valid pathprint safe_access(a, 'a.b["abc"][1]', default_value=7)# returns 'y'# Access valid path with variable substitutionmyvar = 1print safe_access(a, 'a.b["abc"][myvar]', default_value=7, myvar=myvar)# returns 'y'# Access that causes index out of range, but returns default value of 7print safe_access(a, 'a.b["abc"][404]', default_value=7)# returns 7# Access non-existant attributeprint safe_access(a, 'a.bad_attribute')# returns None# Access wildcardprint safe_access(a, 'a.b[*][0]')# returns ['x', 1]Limitations:\1. Does not support function calls at this time\2. Does not support escaped quotations\3. Does not support variable references withing tuple literals
Package: safeaipackage
SAFE AIThe increasing widespread of Artificial Intelligence (AI) applications implies the formalisa-
tion of an AI risk management model which needs methodological guidelines for an effec-
tive implementation. To fill the gap,Giudici and Raffinetti (2023)introduced a S.A.F.E.
risk management model which derives from the proposed international regulations four main
compliance principles: Security, Accuracy, Fairness and Explainability, that can be measured
for any AI application. The primary motivation for developing safeaipackage is providing a
unified framework that can evaluate these AI risks.
The important aspect of the S.A.F.E. model is that it proposes metrics that are interrelated,
are standardised, and have a common mathematical root: the Lorenz Zonoid tool (see, e.g.Koshevoy and Mosler 1996;Lorenz 1905).
Despite the advantages deriving from the S.A.F.E
approach, it suffers from being computationally intensive as it requires the construction of
all the models’ configurations. Moreover, the recent regulatory debate has further expanded
the notion of Security, distinguishing the internal resilience of an AI system: its robustness;
from the external resilience of the ecosystem which surrounds it: environmental, social and
governance sustainability see, e.g.International Standard Organisation 2023.
In line with this evolution and the need of providing a unified and computationally efficient
method, in this contribution we suggest to combine different statistical metrics able to measure
the Security (robustness), Accuracy, Fairness and Explainability of highly complex machine
learning models. We remark that the definition of robustness that we adopt in this paper
derives from that being employed by AI regulators and standard setters, for which an AI
system should achieve an appropriate level of robustness, to be resilient to internal anomalies
and external attacks. For consistency, the proposed measures will be based on the Lorenz and
concordance curves (see, e.g.Giudici and Raffinetti 2011). This will allow to
integrate all measures into an agnostic score that can be employed to assess the trustworthiness
of any AI application.The revisited S.A.F.E. approach will be called RGB where RGB stands for “Rank Graduation
Box”. The use of the term “box” is motivated by the need of emphasizing that our proposal is
always in progress so that, like a box, it can be constantly filled by innovative tools addressed
to the measurement of the new future requirements necessary for the safety condition of
AI-systems.InstallSimply use:pip install safeaipackageExampleIn the folder "examples", we provide two notebooks related to a classification and a regression problem applied to theemployee dataset.
This dataset can also be downloaded from this folder.CitationsThe proposed measures in this package came primarily out of research byPaolo Giudici,Emanuela Raffinetti,
andGolnoosh Babaeiin theStatistical laboratoryat the University of Pavia. If you use safe_ai package in your research we would appreciate a citation to the appropriate paper(s):For the RGA measure introduced in "check_accuracy" module, you can read/citethis paper
Package: safe-assert
safe-assertAllows users to write composableasserts that are not stripped away inoptimized mode.FeaturesSingle simple, pythonic, fast, tested, typed, documented function. That's it!Becausesafe_assertis a function, it can be easily composed with other functionsFully typed with annotations and checked with mypy,PEP561 compatibleInstallationpipinstallsafe-assertExamplesThe usage is identical toassertkeyword, but a function:fromsafe_assertimportsafe_assertdefsort_positive_numbers(numbers:List[int])->List[int]:safe_assert(all(num>=0fornuminnumbers),'found negative')returnsorted(numbers)sort_positive_numbers([1,2,3])# => will worksort_positive_numbers([-1,2,3])# => will fail in runtime with `AssertionError`How is it different from regularassert?
The major one is that it would not be stripped away with-Oflag.
So, it still allows to write declarative checks that are safe in production.The second one is that you can compose it as any other regular function.
Useful in conjunction withdry-pythonprojects.InternalsHow does it work internally?
It internally raisesAssertionErrorthat is also used by theassertkeyword itself.Seedocsto learn more.LicenseMIT.
Package: safe-autonomy-dynamics
safe-autonomy-dynamicsIntroThe safe-autonomy-dynamics package provides an API for dynamic systems supported by a library of common functions used to access and update system dynamics. These dynamics are used to build simulated environments which behave like real-world systems for the purpose of safe autonomy research and development (though their use is not limited to the safety domain). The package also includes a zoo of air and space domain dynamics modules tailored for simulating aerospace systems. The team intends to grow the zoo as new dynamic systems are studied or simulation requirements change.DocsLibrary documentation and api reference locatedhere.InstallationThe following instructions detail how to install
the safe-autonomy-dynamics library on your local system.
It is recommended to install the python modules within
avirtualenvorcondaenvironment.
safe-autonomy-dynamics utilizesPoetryto handle installation.
Poetry can install safe-autonomy-dynamics into an auto-generated virtualenv or within the currently active environment.Installing safe-autonomy-dynamicsClone a copy of the safe-autonomy-dynamics repo onto your local
machine via SSH (recommended):gitclonegit@github.com:act3-ace/safe-autonomy-dynamics.gitor HTTPS:gitclonehttps://github.com/act3-ace/safe-autonomy-dynamics.gitInstalling safe-autonomy-dynamics with pipTo install the safe-autonomy-dynamics module into your
environment usingpip:cdsafe-autonomy-dynamics
pipinstall.For a local development version, please install
using the-e, --editableoption:pipinstall-e.If you'd like jax support, specify the jax extra:pipinstall.[jax]Installing safe-autonomy-dynamics with PoetryInstall the safe-autonomy-dynamics module into your
environment usingpoetry:cdsafe-autonomy-dynamics
poetryinstallPoetry will handle installing appropriate versions of the dependencies for safe-autonomy-dynamics into your environment, if they aren't already installed.  Poetry will install an editable version of safe-autonomy-dynamics to the environment.If you'd like jax support, specify the jax extra:poetryinstall-EjaxBuild Docs LocallyFirst make sure the mkdocs requirements are installedpoetryinstall--withdocsNow, build the documentation and serve it locally. By default, you should be able to reach the docs on your local web browser at127.0.0.1:8000rm-rsite
poetryrunmkdocsbuild
cp-rdocs/.site/
poetryrunmkdocsservePublic ReleaseApproved for public release; distribution is unlimited. Case Number: AFRL-2023-6155A prior version of this repository was approved for public release. Case Number: AFRL-2022-3202TeamUmberto Ravaioli,
Kyle Dunlap,
Jamie Cunningham,
John McCarroll,
Kerianne Hobbs,
Charles Keating
Package: safebooru2
Safebooru2A module containing classes and methods for interacting with the safebooru.org
public API. This is my second API wrapper module for safebooru.org, here's the
link to that:https://github.com/boddz/safebooruit is one of my older
projects, some things are poorly done, and I am bored so that's why this
module is a thing.For some more information about the safebooru.org API, you can find some
official documentation:https://safebooru.org/index.php?page=help&topic=dapiAs safebooru.org is running a variant of Gelbooru, you can find a bit more
documentation at:https://gelbooru.com/index.php?page=wiki&s=view&id=18780Other parts of gelbooru.com are NSFW, so heads up.To be released under the GNU GPLv3 licence, which can be found in the source
directory, or with this link:https://www.gnu.org/licenses/gpl-3.0.en.htmlNoteThis is currently in early development, there will be a lot of changes.This should in theory work perfectly fine with other similar booru sites that
are using Gelbooru, however my main focus for this project is to target
safebooru.org.Setup(Optional)
I would first recommend setting up a virtual environment:cdsafebooru2
python3-mvenvvenv# Should work with most systems, might require install.sourcevenv/bin/activate# Activate the venv.Install from PyPIpipinstallsafebooru2Install ManuallyEnsure pip setuptools/ build are installed and up-to-date:pipinstall--upgradesetuptools
pipinstall--upgradebuildOnce done, build the package:python-mbuildFinally, install the generated .whl file with pip:# Of course this file name may vary depending on versioning and such.pipinstall--force-reinstalldist/safebooru2-1.0.0-py3-none-any.whlNo InstallIf you don't want to have the package directly installed to site packages
then just install the requirements and have fun:pipinstall-rrequirements.txtUsageAt the moment, there aren't really any user friendly docs I have created
for this, I have left some basic usage examples in themain.pyfile in the
CWD. You can of course read through thesrc/safebooru2/safebooru.pyfile
to get a feel for the module as well, I tried documenting everything in it
to the best of my ability.(I do plan on sitting down and creating some proper docs soon C:)TestingOnce setup, you can run all tests directly by doing:maketest# Provided GNU make is installed.Or individual tests by doing:python3-munittesttests/test_foo_bar.pyContributionPlease checkout and target thedevelbranch if contributing anything.Thanks.
Package: safebox
SAFEBOXA minimal safe way to store your application credentials.DESCRIPTIONThis application is build with cython and c/c++ code, this allow us to store a "super secret key" to encrypt and decrypt strings, usingAESalgorithm, this allow to store, with a minimum safety, crypted strings, this strings, can be, for ex. users, passwords, address to database connection.IMPORTANT: This module comes with random keys, but is EXTREMALLY RECOMENDED than you compile this module by you own, from sources (available on github), to define YOUR UNIQUE secret key on the c/c++ modules.IMPORTANT2: The PRIVATE_KEY must be 32bytes long (32 chars) and the PRIVATE_IV must be 16bytes long.REFERENCESEncryption algorithm take from:Encryptions
Package: safecast_tracker
Command-line Safecast Tracker for APRS:safecast_trackerExamplesThe following example uses thesafecast_trackercommand to connect to APRS-IS
as W2GMD and send a single-shot location frame containing k=v Safecast values:$ safecast_tracker -c W2GMD -p 12345 -c xx:xx:xxSee AlsoSee$ safecast_tracker-hfor more information.SourceGithub:https://github.com/ampledata/safecast_trackerAuthorGreg Albrecht W2GMD <gba@orionlabs.co>CopyrightCopyright 2015 Orion Labs, Inc.LicenseApache License, Version 2.0
Package: safe-cmp
In Python 2, it was possible to compare any object:>>> None > 2
False
>>> [] < object()
TrueBut this is no longer true in Python 3:>>> None > 2
...
TypeError: '>' not supported between instances of 'NoneType' and 'int'
>>> [] < object()
...
TypeError: '<' not supported between instances of 'list' and 'object'But there are many cases where it is useful to, for example:Sort heterogeneous lists (ie, lists that contain many types of object)Compare objects toNone(for example, to find themax(...)of a list
where some items may beNone)Write generic functions which will have robust, deterministic behaviour on
arbitrary inputsafe_cmpprovides functions for safely sorting and ordering any value in
Python 3. In fancy math terms,safe_cmpimplements a total ordering of all
values in Python 3[1].safe_cmpimplements Python 2 compatible safe versions of the ordering
functions:safe_cmp: a Python 2 compatible implementation ofcmpfor Python 3safe_sorted: a safe version ofsorted(...)safe_min: a safe version ofmin(...)safe_max: a safe version ofmax(...)And provides a wrapper -safe_order- which defines a total ordering for
any object (for example,heterogeneous_list.sort(key=safe_order)).ExamplesSorting a heterogeneous list:>>>fromsafe_cmpimportsafe_sorted,safe_order>>>items=[1,None,"foo",{},object]>>>list(safe_sorted(items))# Using "safe_sorted"[None,{},1,'foo',object]>>>items.sort(key=safe_order)# Using "safe_order" with key=>>>items[None,{},1,'foo',object]Finding the max of a list which includes nulls:>>>fromsafe_cmpimportsafe_max>>>safe_max([1,None,3,None,4])4The rare situation where Python 2 stylecmpis useful:>>>fromsafe_cmpimportsafe_cmp>>>safe_cmp(None,1)-1>>>safe_cmp(None,None)0>>>safe_cmp(1,None)1Note:safe_cmpwill produce Python 2 compatible results when called withnan:>>>fromsafe_cmpimportsafe_cmp>>>nan=float("NaN")>>>safe_cmp(nan,1)-1>>>safe_cmp(1,nan)1>>>safe_cmp(nan,nan)0As willsafe_sorted:>>>fromsafe_cmpimportsafe_sorted>>>list(safe_sorted([nan,2,nan,1]))[nan,2,nan,1]PerformanceCurrentlysafe_cmpmethods are currently implemented in Python (in contrast
to their unsafe builtin counterparts, which are implemented in C), so
performance will notable worse for large comparisons:In [1]: %timeit safe_max(range(10000000))
2.8 s ± 42 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [2]: %timeit max(range(10000000))
345 ms ± 6.23 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)For smaller comparisons, though, the difference will be negligible:In [1]: %timeit safe_max(1, 2)
682 ns ± 7.12 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)

In [2]: %timeit max(1, 2)
218 ns ± 6.87 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)If there is interest in performant implementations, however, they will be
straight forward to provide.Additionally, where obvious, performance optimizations have been implemented
(for example, caching the result ofkey=functions).[1]More precisely, a total orderingof all values which can be ordered.
This excludesNaN, and any other values which are defined as having an
undefined ordering.
Package: safecopy
SafecopySafecopy syncronizes drives and directories very carefully. Like rsync, without rsync's insecure default metadata check. Securely copies to and from remote filesystems through sshfs.DescriptionReliably Synchronize Drives and DirectoriesSafecopy synchronizes drives and directories, and carefully verifies the copy. When you are copying massive files or large directory trees, it's important to know that every file was copied accurately. Safecopy verifies byte-by-byte, or you can choose a quick metadata check.Installpip3 install safecopyUpdatesAll future updates will only be available from:git clone https://codeberg.org/topdevpros/safecopy.gitHow it Workssafecopy SOURCE ... DESTINATIONIt's just like the standard cp command. You can have as many source paths as you like. The destination path is always last.Safecopy gives you a lot of control:
-h, --help                Show this help message
--verbose                 Show progress
--quick               Only update files if the size or last modified time is different
--dryrun              Show what would be done, but don't do anything
--delete              Delete all files that are not in the source before copying any files
--nowarn              No warnings
--test                Run tests
--exclude EXCLUDE_PATH...   Exclude the files or directories (comma separated)
--verify              Verify copies
--persist             Continue on errors, except verify error
--retries RETRIES     How many times to retry a failed copy. Default is not to retryIf you need the rsync protocol run "pip3 install pyrsync2". But it's almost always better to replace rsync with safecopy and sshfs.
Error messagesWarning: setuid/setgid bit set on ...Safecopy detects when the setuid/setgid bit is set. This is almost always a serious security risk. To remove the bit:chmod -s PATH