Saravanan666/pypi-org huggingface dataset:
Package: trivial-torch-tools
What is this?Functions and decorators I found myself rewriting for every pytorch projectHow do I use this?pip install trivial-torch-toolsfromtrivial_torch_toolsimportSequential,initimporttorch.nnasnnclassModel(nn.Module):@init.to_device()# ^ does self.to() and defaults to GPU if available (uses default_device variable)@init.save_and_load_methods(model_attributes=["layers"],basic_attributes=["input_shape"])# ^ creates self.save(path=self.path) and self.load(path=self.path)def__init__(self):self.input_shape=(81,81,3)layers=Sequential(input_shape=self.input_shape)# ^ dynamically compute the output shape/size of layers (the nn.Linear below)layers.add_module('conv1',nn.Conv2d(input_shape[0],32,kernel_size=8,stride=4,padding=0))layers.add_module('relu1',nn.ReLU())layers.add_module('flatten',nn.Flatten(start_dim=1,end_dim=-1))layers.add_module('linear1',nn.Linear(in_features=layers.output_size,out_features=10))layers.add_module('sigmoid1',nn.Sigmoid())self.layers=layers# layers.output_size# layers.output_shape# layers.layer_shapes# available toolsfromtrivial_torch_toolsimport*core.default_device# defaults to cuda if availablecore.to_tensor(nested_lists_of_arrays_tuples_and_more)# aggresively converts objects to tensors# decorators for def __init__()@model.init.to_device(device=default_device)@model.init.save_and_load_methods(basic_attributes=[],model_attributes=[],path_attribute="path")@model.init.forward_sequential_method# decorators for def forward(): # or whatever@model.convert_each_arg.to_tensor()# Use to_tensor(which_args=[0]) to only convert first arg@model.convert_each_arg.to_device()# Use to_device(which_args=[0]) to only convert first arg@model.convert_each_arg.to_batched_tensor(number_of_dimensions=4)# 4 works for color images@model.convert_each_arg.torch_tensor_from_opencv_format()image.tensor_from_path(path)image.pil_image_from_tensor(tensor)image.torch_tensor_from_opencv_format(tensor_or_array)image.opencv_tensor_from_torch_format(tensor)image.opencv_array_from_pil_image(image_obj)OneHotifier.tensor_from_argmax(tensor)# [0.1,99,0,0,] => [0,1,0,0,]OneHotifier.index_from_one_hot(tensor)# [0,1,0,0,] => 2OneHotifier.index_tensor_from_onehot_batch(tensor)# [[0,1,0,0,]] => [2]importtorchconverter=OneHotifier(possible_values=["thing0",('thing',1),{"thing":2}])converter.to_one_hot({"thing":2})# >>> tensor([0,0,1])converter.from_one_hot(torch.tensor([0,0,1]))# >>> {"thing":2}
Package: trivia.py
trivia.pyAn easy to use python api wrapper forOpen Trivia DBwith autocachingNote:There is an request limit of 1 category per request and a max of 50 questions per requestInstallingPython 3.6 or higher is requiredpip install trivia.pyUsagequestion(parameters)Parameters:amount (int):
The amount of questions you wish to request, defaults to 10category (int):
The category you wish to request from (refer to table below for which number correlates to which category), defaults toNonereturning all categories.IntCategory0All categories1General Knowledge2Entertainment: Books3Entertainment: Film4Entertainment: Music5Entertainment: Musicals & Theatres6Entertainment: Television7Entertainment: Video Games8Entertainment: Board Games9Science & Nature10Science: Computers11Science: Mathematics12Mythology13Sports14Geography15History16Politics17Art18Celebrities19Animals20Vehicles21Entertainment: Comics22Science: Gadgets23Entertainment: Japanese Anime & Manga24Entertainment: Cartoon & Animationsdifficulty (str):
The difficulty of the questions, can beeasy,medium, orhard. Defaults toNonereturning all difficulties.quizType (str):
The type of questions, can bemultiple(multiple choice questions), orboolean(true/false questions). Defaults toNonereturning all questions types.Return:Return a list of dicts which contains the keys belowcategory (str):
The category the question comes from.type (str):
The type of question (multiple, or boolean).difficulty (str):
The difficulty of the question.question (str):
The text of the question.correct_answer (str):
The correct answer.incorrect_answer (list):
List of strings of all the incorrect answers.ExamplesBasic code examplefromtriviaimporttriviaimportasyncio#To use outside of an async functionloop=asyncio.get_event_loop()questions=loop.run_until_complete(trivia.question(amount=1,category=2,difficulty='easy',quizType='multiple'))#To use within an aysnc functionasyncdefmain():questions=awaittrivia.question(amount=1,category=2,difficulty='easy',quizType='multiple')An example of the return[{'category':'Entertainment: Books','type':'multiple','difficulty':'easy','question':'What is the title of the first Sherlock Holmes book by Arthur Conan Doyle?','correct_answer':'A Study in Scarlet','incorrect_answers':['The Sign of the Four','A Case of Identity','The Doings of Raffles Haw']}]
Package: trivia-yaml
Use this script to convert Red-DiscordBot’s V2 trivia list format to YAML,
which is used in V3.Installationpip install trivia-yamlUsageConverting a single trivia list:trivia-yaml mylist.txtConverting a folder containing multiple trivia lists:trivia-yaml mylistsBy default these commands output.yamlfiles to a sub-directory namedyaml_output.For outputting files to a particular folder:trivia-yaml mylists -t my_output_folder
Package: trivrepr
trivrepr - a helper for generating repr() stringsDescriptionThe trivrepr module contains the TrivialRepr class that may be
derived from to provide an implementation of__repr__()for
simple classes that have all their attributes passed directly to
the constructor.import trivrepr

class KeyValue(trivrepr.TrivialRepr):
    def __init__(self, key, value, more='hi'):
        super(KeyValue, self).__init__()
        self.key = key
        self.value = value
        self.more = more

kv = KeyValue(key='key', value='val')
print(repr(kv))This program will output:KeyValue(key='key', value='val', more='hi')The trivrepr module is fully typed.Version history0.1.1 (2019-03-07)Add the news.py tool for preparing the distribution changelog.Correct the project's homepage URL.Use setuptools-git to include more files in the sdist tarball.0.1.0 (2019-03-06)Initial public release.AuthorPeter Pentchevroam@ringlet.netCopyright and licenseCopyright (c) 2019  Peter Pentchev <roam@ringlet.net>
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Package: trivval
Trivial validation - when the full power of the JSON Schema is not neededThis library provides a simplistic way to validate a dictionary against
something resembling a schema - a dictionary describing the desired data
structure by example.The main entry point is thevalidate()function, but the variousvalidate_*()functions may be invoked directly with appropriate
arguments.The schema used for validation is a dictionary (the top-level object must
be a dictionary). For the present, the keys may only be strings.
A special case of a dictionary with a single key*means any value for
a key will be accepted. Otherwise, all keys with names not starting with
a?character are mandatory, and any keys with names starting with
a?character are optional.The dictionary values may be any of:a Python type signifying that the value must be an instance thereofa single-element list signifying that the value must be a list with
all the elements validated by the same rules as a dictionary value
(i.e. one of a Python type, a single-element list, a set, or
a dictionary)a set signifying that the value must be exactly equal to one of
the set elements, i.e. an enumeration of the allowed valuesa dictionary with the same semantics as described aboveFor example, the following schema:{
    "name": str,
    "id": int,
    "address": [str],
    "preferences": {
        "meal": set(("breakfast", "lunch", "brunch")),
        "colors": [{
            "name": str,
            "intensity": set(["dark", "light"])
        }]
    },
    "possessions": {
        "*": int
    }
}...may be used to validate the following dictionary:{
    "name": "A. N. Nymous",
    "id": 13,
    "address": [
        "42 Nowhere Circle",
        "Notown-at-all",
        "Unnamed territory"
    ],
    "preferences": {
        "meal": "brunch",
        "colors": [
            {"name": "blue", "intensity": "light"},
            {"name": "green", "intensity": "dark"}
        ]
    },
    "possessions": {
        "pencil": 4,
        "paper": 0
    }
}
Package: trivver
Compare package versions in all their varied glory.[Home|GitLab|PyPI]DescriptionThis module provides thecompare()function which compares two
version strings and returns a negative value, zero, or a positive
value depending on whether the first string represents a version
number lower than, equal to, or higher than the second one, and
thekey_compare()function which may be used as a key for e.g.sorted().This module does not strive for completeness in the formats of
version strings that it supports. Some version strings sorted by
its rules are:0.1.00.2.alpha0.20.2.10.2a0.2a.10.2a30.2a40.2p31.0~bpo31.0.beta1.0.beta.21.0.beta21.0.beta31.01.0.41:0.3Seethe change log(thedocs/changes.mdfile in the source
distribution) for the history oftrivverdevelopment.ContactThis module isdeveloped in a Gitlab repository.
The author isPeter Pentchev.
Package: trivy-streamlit
trivy-streamlitThis is a simple UI to display JSON generated by the opensource scannertrivyfrom AquaSecurity,
supported by the community.Thanks to AquaSecurity for providing this great tool.https://github.com/aquasecurity/trivy🏗️ Dependenciestrivypython3pip3It is beyond the scope of this document to explain how to install either of those. 🗡️⚙️ Generating JSON with trivyk8strivyk8s--formatjson-oresults.json--scanners=vuln--severity=CRITICAL--report=allclusterimagetrivyimage--formatjson-oresults.json--scanners=vuln--severity=CRITICAL--report=alldocker.io/grafana/grafana:10.2.2Installation🛞 Install from pypipipinstalltrivy-streamlit
Package: trkir-rpi
Raspberry PI script for PT Flir and IR camerasPrerequirementspython3pip3Installationsudo pip3 install trkir-rpisudo trkir-installUsetrkir-camera-run [--health_check 1]to run  the camera script [optional --health_check 1 to check the script locally]trkir-camera-devicesto get available cameras and its usb portstrkir-rpi-ipto get raspberryPi iptrkir-usb-recycleto reset usb hub (power cycle usb hub connection)
Package: trkr
# trkrtrkris a command-line tool to help track what our team is working on and
how long they work on it. With Trello and Google Sheets integration, it allows
you to search and select a related Trello card, and writes directly to a Worksheet.## RequirementsPython 2.6+ or 3+## Installation`python pip install trkr `## UsageUsing trkr is as simple as runningtrkr run. A list of valid command is available
by runningtrkr –help.### DescriptionProvide a description of the work accomplished. If none is provided, the commit
message of the last commit at HEAD will be used.### Minutes WorkedTime worked in minutes (must be a valid integer).### Trello CardYou have the choice to (i)nput a card’s URL, fuzzy (s)earch for a card, (p)ick from
a list of your assigned cards, or choose to (n)ot include a card.### DateEnter a timestamp in theMM/DD/YYYYformat. This can be skipped, and will instead
use the current date.## SetupTo start the setup script, runtrkr setup. It will ask for an email, Trello
API keys, and the worksheet URL. All settings are saved at~/.trkr/config.json,
and can be modified at a later time.### Trello Authentication#### Finding Client ID and Board IDOn Trello, navigate to a board and append.jsonto the URL. It should look
something likehttps://trello.com/c/<url>.json. When the JSON data has loaded,
hthe firstidwill be theBoard ID; copy and save it somewhere.Search next for your name or username, find theidassociated with it, and
save it somewhere; this is yourClient ID.#### API Keys and TokenTrello API keys can be found at [trello.com/app-key](https://trello.com/app-key).
The hash found underKeyis yourAPI Key, and the one underSecretis yourAPI Secret. A Token can be generated by clickingTokenon the same page; this
is yourToken.### Google Sheets AuthenticationOnce you’ve created a new Google Sheet, it’s URL is theDocument URL, and the
name of the sheet at the bottom is theWorksheet Name.In order to authorizetrkrto read/write from a worksheet, follow the steps
layed out in [Authorizing pygsheets](https://pygsheets.readthedocs.io/en/latest/authorizing.html).
With the JSON file in hand, move it to~/.trkr/keyfile.json. Lastly, share
the worksheet with the email found inkeyfile.json.trkrshould now be setup
and ready to use!## Acknowledgementtrkrrelies on the great work done by the [pygsheets](https://github.com/nithinmurali/pygsheets/)
and [py-trello](https://github.com/sarumont/py-trello) teams.
Package: tr-lang-py
tr-lang-pyPython bindings fortr-langInstallation$pipinstalltr-lang-pyUsageTo Run Inline tr-lang Codefromtr_langimportLexer,Parser,Run,bytecodecode="""'Hello, World!\\n' de"""lexer=Lexer(code)parser=Parser(lexer.tokenize())bytes=bytecode.to_bytes(parser.parse())run=Run(bytecode.from_bytes(bytes))run.run()# prints "Hello, World!\n"To Use tr-lang Files with Python# /path/to/file.pyfromtr_langimportLexer,Parser,Runwithopen("/path/to/tr-lang/file.trl")asf:Run(Parser(Lexer(f.read()).tokenize()).parse()).run()# /path/to/tr-lang/file.trl"What is your name? "de# print("What is your name?", end="")girdi->name# name = input()"Your name is "denamede".\n"de# print(f"Your name is{name}.")To Use tr-lang Bytecode from Pythonfromtr_langimportRun,bytecodewithopen("/path/to/bytecode.trl.byt","rb")asf:Run(bytecode.from_bytes(f.read())).run()Documentationtr-lang DocumentationContributingTo report bugs or suggest new features please use theissue trackerBugfix PR's are welcome!
Package: trlc
Treat Requirements Like Code (TRLC)TRLC is a domain-specific language developed at BMW for writing (and
linking) requirements with meta-data.The repository contains:Thelanguage reference
manualfor TRLC.Previous versionsare also available.A pure Python reference implementation of TRLC.The implementation is not very fast, but designed to be pedantically
correct in following the language definition. The tools also include a
powerful static analysis tool to find issues with types and
user-defined check rules.The Python implementation can be used for several purposes:It can be used to validate other TRLC implementations.It can be used to validate a body of requirements (e.g. a CI check
that all requirements are well formed)The API can be used to write other tools based on TRLC (for example
a tool to render the requirements in HTML, a tool to diff
requirements or perform an impact analysis, or a tool to perform
software traceability, etc.)DocumentationFor normal usersTutorial(read this as a first introduction)Release Notes(read this to find out whats new)LicenseFor API usersLanguage Reference Manual(for language lawyers)Python API Documentation(API reference for end-users)AST Hierarchy(overview over all classes in the AST)For TRLC developersLexer/Parser Hierarchy(overview over all classes releated to the lexing and parsing of TRLC)Tool Architecture OverviewDependenciesRun-time3.8 <= Python3 <= 3.11Optional dependencies (they are not installed automatically):PyVCG(Linux or OSX only, required
when using the--verifyoption)Development toolsGNU MakeGraphvizPyCodeStyle(from PyPI, for
basic checking of source code style)PyLint(from PyPI, for basic bug
finding)Coverage(from PyPI, to
perform branch coverage when running the test suite)Sphinx(from PyPI, for building
the documentation)PyVCG(from PyPI, for building
verification conditions)CVC5(from PyPI, for discharging
verification conditions)You can install all Python dependencies by doing:pip3install-rrequirements.txtWhen building the traceability report you also need to install two
lobster packages. Since there is a circular dependency, please install
like this:pip3installbmw-lobster-corebmw-lobster-tool-python
pip3install--no-depsbmw-lobster-tool-trlcThe most important make targets when developing TRLC are:lint(runs pycodestyle and pylint)test(performs unit and system tests and shows coverage)tracing(generates traceability report)
Package: trm.cline
trm.cline handles parameter input for Python scripts, interpreting
those entered on the command line, and internally prompting for those
not given according to names defined within the scripts. It uses disk
files to save the parameter values so that they can be recalled as
defaults on next invocation, potentially saving much typing. It also
allows multiple scripts to share parameters.Install with:pip install .or:pip install . --userif you don’t have root access.Free software: BSD license
Package: trml2pdf
Open source implementation of RML (Report Markup Language) from ReportLabRML User Guide(orbeginner tutorial)Not all tags are supported, but most of them work.Installpip install trml2pdfExamplesCreate a PDF file:importtrml2pdfprinttrml2pdf.parseString(open('file.rml','rt').read())If you are using this for Django you can dynamically create an .rml file with the template system and then render it.fromdjango.template.loaderimportget_templatefromdjango.template.contextimportContextimporttrml2pdfdata={'key1':'foo'}template=get_template('template.rml')context=Context(data)xmlstring=template.render(context)pdfstr=trml2pdf.parseString(xmlstring)Looking for maintainerI no longer use this library in my own projects, so there is no interest in adding new feature or improving things. If you are intersted in taking it over or being actively involved, please let me know
Package: trmnl-colors
trmnl_colors v-4.0.6Add colors to the static WOrLd!colors module is made to colorize the output of terminal when the code runs on command line, With that there are functions for adding basic text colors (Total 10 including invsisble) and or text formats such as Bold, Italics, Underline, Light or Strikethrough to your code.But wait there is more! use background colors, filled Variants which can be accessed by calling thier specific name and 'bg' postfix as in background. Here is an example describing with  use case:Latest Updates:Introducing constants to make your life more easier:Use case for constantsfromtrmnl_colors.constantsimport*print(RedB+"Hello"+GreenB+" World!",end="")print(RESET,end="")Use case for functionsfromtrmnl_colors.functionsimport*bluebg()print("Hello")reset()Each color can be accessed by calling thier particular name and the first letter of the format at the postfix.fromtrmnl_colors.functionsimport*yellowB()print("Hello")# After every color call remember to call the reset function.# Outputs Hello in yellow color in Bold textreset()For example:Call clr.redB() for red color with text format Bold, S for strikethrough D for Default U for Underline I for Italics L is for special lighter color substitute for each color.There are also filled color variants in which the font color and the background color match each other making them viable for specific type of color operations.There is a special function called reset() which is basically the default white so that the color function gets reset it is recommended to use this function after every usage of a color to mantain the color of the terminal.PS if you want to create blocks of colors for decoration purposes use filled variants e.g. clr.whitefilled()Terminal Application Screenshots with trmnl_colors:Explore & stay Creativeby: Idris-Vohra
Package: trm.utils
trm.utilsis a home for a few odds and ends that don’t on their
own justify their own package but are quite often useful. For instancetrm.utils.vec3is a sub-module that handles 3D Cartesian vectors,
whiletrm.utils.splfitis a method based on scipy routines that
carries out the commonly needed task of spline fitting with rejection
of bad data.Installationtrm.utilsmakes use of numpy, scipy and astropy (listed in the
pyproject.tomol files as requirements), and requires Python 3.6+. One
routinempl_style_axesonly makes sense for matplotlib plots, but
if you don’t use it, you don’t need matplotlib to be installed.Installtrm.utilswith:pip install trm.utilsto get via PyPI, or:pip install .if you have cloned from github. If you don’t have root access, append--userto the above commands to get a local install.Free software: BSD license
Package: tr-news-scraper
tr-news-scrapertr-news-scraper is a Python library that allows users to scrape Turkish news articles based on specified keywords from multiple sources. It gather news content from various news websites, enabling users to extract valuable information for analysis or research purposes.InstallationUse the package managerpipto install this library.pipinstalltr-news-scraperUsageScrape news articles based on a single or multiple keywords. scrape() method returns apandas dataframe.fromtr_news_scraperimporttr_news_scraperastnsscraper=tns.NewsScraper()# You can define page_limit parameter here. Default value is 20.single_keyword_news=scraper.scrape(["keyword"])# You can define keyword or keywords here.multiple_keywords_news=scraper.scrape(["keyword_1","keyword_2","keyword_3"])# You can define keyword or keywords here.titleauthorspublish_datetextkeywordstop_imgurlmeta_urlmeta_imgmeta_published_datemeta_descriptionmeta_keywordsdatekeywordtitle_1authors_1publish_date_1text_1keywords_1top_img_1url_1meta_url_1meta_img_1meta_published_date_1meta_description_1meta_keywords_1date_1keyword_1title_2authors_2publish_date_2text_2keywords_2top_img_2url_2meta_url_2meta_img_2meta_published_date_2meta_description_2meta_keywords_2date_2keyword_2title_3authors_3publish_date_3text_3keywords_3top_img_3url_3meta_url_3meta_img_3meta_published_date_3meta_description_3meta_keywords_3date_3keyword_3title_4authors_4publish_date_4text_4keywords_4top_img_4url_4meta_url_4meta_img_4meta_published_date_4meta_description_4meta_keywords_4date_4keyword_4title_5authors_5publish_date_5text_5keywords_5top_img_5url_5meta_url_5meta_img_5meta_published_date_5meta_description_5meta_keywords_5date_5keyword_5SourcesCNN TürkHürriyetMilliyetSabahPosta