Saravanan666/pypi-org huggingface dataset:
Package: carbon-api
CarbonCreate beautiful carbon code images using python or terminal.This is an unofficial asynchronous python wrapper for carbon.now.sh which can be also be used inside cli.InstallationPyPI (recommended)pipinstallcarbon-apiDirectly from Sourcegitclonehttps://github.com/StarkBotsIndustries/CarboncdCarbon

pythonsetup.pyinstallExampleUsageUsing as an Asynchronous LibraryimportasynciofromcarbonimportCarbonclient=Carbon()asyncdefmain():img=awaitclient.create("Your code here")print(img)asyncio.run(main())OptionsYou can pass globally usable options' values toCarbonclassfromcarbonimportCarbonclient=Carbon(downloads_dir=os.getcwd(),# Defaults to current directorycolour="rgba(171, 184, 195, 1)",# Hex or rgba colorshadow=True,# Turn on/off shadowshadow_blur_radius="68px",shadow_offset_y="20px",export_size="2x",# resolution of exported image, e.g. 1x, 3xfont_size="14px",font_family="Hack",# font family, e.g. JetBrains Mono, Fira Code.first_line_number=1,language="auto",# programing language for properly highlightingline_numbers=False,# turn on/off, line numberhorizontal_padding="56px",vertical_padding="56px",theme="seti",# code themewatermark=False,# turn on/off watermarkwidth_adjustment=True,# turn on/off width adjustmentwindow_controls=True,# turn on/off window controlswindow_theme=None)Same options are also available inCarbon.createmethod, which override the global options.You can also specify the file name to the create method. Path to the image will be returned by the function.path=awaitclient.create(file="my-code.png")# Path will be downloads_dir/fileprint(path)Using CLI$carbon-app

Createbeautifulcarboncodeimagesusingpythonorterminal

Options:-v,--versioncheckthecurrentversioninstalled-fFILE,--fileFILEpassfilepathtoreadcodefrom-cCODE,--codeCODEpasssomecodetomakecarbon

Enjoytheprogram:)You can pass the file path using the file argument.carbon-app--filepath_to_fileor simplycarbon-app-fpath_to_fileFor example:carbon-app--filemain.pyHeremain.pyshould be in the same directory.You can also directly pass code (not recommended)carbon-app--codeyour_code_hereor simplycarbon-app-cyour_code_hereCLI is in beta version and other options aren't available currently. If you're interested in that functionality, let me know.CreditscyberboysumanjayforCarbon-API.Community and SupportTelegram Channel -StarkBotsTelegram Chat -StarkBotsChatCopyright and LicenseCopyright (C) 2022Stark Bots<https://github.com/StarkBotsIndustries>Licensed under the terms ofGNU Lesser General Public License v3 or later (LGPLv3+)
Package: carbonate-utils
# Carbonate UtilsUtilities to plumb carbonate tools together.Depends on the master (and yet unreleased) branches of whisper, carbonate and carbon.## The Tools### carbonate-sync```bash$ carbonate-sync --helpusage: carbonate-sync [-h] [-c CONFIG_FILE] [-C CLUSTER] [-S REMOTE_CLUSTER][-n NODE] [-b BATCH_SIZE] [--ssh-options SSH_OPTIONS][--rsync-options RSYNC_OPTIONS] [--temp-dir TEMP_DIR][--exclude EXCLUDE] [--start-time START_TIME][--end-time END_TIME] [--overwrite OVERWRITE]carbonate-syncoptional arguments:-h, --help            show this help message and exit-c CONFIG_FILE, --config-file CONFIG_FILEConfig file to use (default:/opt/graphite/conf/carbonate.conf)-C CLUSTER, --cluster CLUSTERCluster name (default: main)-S REMOTE_CLUSTER, --remote-cluster REMOTE_CLUSTERRemote cluster name (default: None)-n NODE, --node NODE  Name of the local node (same as in carbonate.conf).(default: coulomier)-b BATCH_SIZE, --batch-size BATCH_SIZEBatch size for fetching metrics. (default: 1000)--ssh-options SSH_OPTIONSPass option(s) to ssh. Make sure to use "--ssh-options=" if option starts with '-' (default: -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -o Compression=no)--rsync-options RSYNC_OPTIONSPass option(s) to rsync. Make sure to use "--rsync-options=" if option starts with '-' (default:--archive --sparse --update --modify-window=100800)--temp-dir TEMP_DIR   Temporary dir (default: /tmp)--exclude EXCLUDE     Comma separated regexp of paths to exclude (slow).(default: ^carbon\.)--start-time START_TIMESync data more recent than this time. (default: 0)--end-time END_TIME   Sync data older than this time (default: now).(default: 1465420874.04)--overwrite OVERWRITEOverwrite local data with remote data (default:false). (default: False)```# Authors* Brice Arnould <b.arnould@criteo.com>* Corentin Chary <c.chary@criteo.com># License and warningsThese tools should be considered beta quality right now.Tests exist for most functionality, but there is still significant work to be done to make them bullet-proof.The code is available under the MIT license.
Package: carbon-black-cloud-threat-intelligence-connector
Threat Intelligence Connector for Carbon Black CloudThis is a python project that can be used for ingesting Threat Intelligence from various STIX Feeds. The current supported versions of STIX Feeds are 1.x, 2.0 and 2.1.
It supports python >= 3.8Installation$pipinstallcarbon-black-cloud-threat-intelligence-connector$cbc-threat-intel--helpUsage: cbc-threat-intel [OPTIONS] COMMAND [ARGS]...Options:--help  Show this message and exit.Commands:create-feed       Creates a feed in CBCcreate-watchlist  Creates a Watchlist in CBC (from already created feed)process-file      Process and import a single STIX content file into...process-server    Process and import a TAXII Server (2.0/2.1/1.x)version           Shows the version of the connectorDocumentationVisit thedeveloper network of Carbon Black Cloudfor more information of how to use the connector.Developing the connectorWe rely on pull requests to keep this project maintained. By participating in this project, you agree to abide by the VMwarecode of conduct.SetupIt is recommended to use Python3.8 / Python3.9 version for that project, assuming that you installed the deps with either virtualenv or poetry.For a good code quality make sure to install the hooks frompre-commitas well.$pre-commitinstallInstallationClone the repository$gitclonehttps://github.com/carbonblack/carbon-black-cloud-threat-intelligence-connector.git
$cdcarbon-black-cloud-threat-intelligence-connector/You can install this connector either via Poetry or using thevirtualenv.UsingPoetryYou will need toinstall poetryfirst.To install the connector run:$poetryinstallUsingvirtualenvYou will need toinstall virtualenvfirst.$virtualenvvenv
...
$source./venv/bin/activate(venv)$pipinstall-rrequirements.txtTestsThe tests can be run with the following command:$pytest./tests/unit/For running the performance tests check out theREADMESupportView all API and integration offerings on theDeveloper Networkalong with reference documentation, video tutorials, and how-to guides.Use theDeveloper Community Forumto discuss issues and get answers from other API developers in the Carbon Black Community.Create a github issue for bugs and change requests or create a ticket withCarbon Black Support.Submitting a PRIt is strongly recommended to have written tests and documentation for your changes before submitting a PR to the project. Make sure to write good commit messages as well.
Package: carbon-client
Client for sending metrics into carbon serverInitializationBy default carbon-client creates a client based on os.environ variables:CARBON_HOST - Contains one or many endpoints (e.g “127.0.0.1:2003, 10.2.1.0:2003”)CARBON_NS - it’s a namespace for sending metrics (e.g. “carbon.coal-service”)Actually you can configure this by hands.ExampleThe simple test :# You should set ENV variables CARBON_HOST and CARBON_NS# CARBON_HOST might contains multiple destinations (comma separated)fromtimeimportsleepfromcarbon.clientimportstatfromcarbon.client.extrasimportSimpleCounter# Will be pended one or two metrics# carbon_client.counter_ok# carbon_client.counter_fail - if exception will be raised# carbon_client is namespace by default.withSimpleCounter("counter"):sleep(1)# Will be pended one metric# carbon_client.timer_ok - if exception will be raised# carbon_client.timer_fail - if exception will be raised# carbon_client is namespace by default.withSimpleTimer("timer"):sleep(1)# Will be pended n metric# carbon_client.collector# carbon_client is namespace by default.withSimpleCollector("collector")ascollector:collector.add(123)collector.add(122)collector.add(-10)# all metrics will sent.stat.send()The advanced test :fromtimeimportsleepfromcarbon.clientimportUDPClientfromcarbon.client.extrasimportSimpleCounter,SimpleTimer,SimpleCollector# Will be send to multiple destinationsclient=UDPClient("127.0.0.1, 191.168.1.11:2003","test")withSimpleCounter("counter",client):sleep(1)withSimpleTimer("timer",client):sleep(1)withSimpleCollector("collector",client)ascollector:collector.add(123)client.send()Another test :fromtimeimportsleepfromcarbon.clientimportstatfromcarbon.clientimportmetrics# Counterstat['counter']=metrics.Counterstat['counter'].inc(1)sleep(1)stat['counter'].dec(1)# Timerstat['timer']=metrics.Timerstop_watch=stat['timer'].start()sleep(1)stat['timer'].stop(stop_watch)# Collectorstat['collector']=metrics.Collectorstat['collector'].add(1)sleep(1)stat['collector'].add(2)sleep(1)stat['collector'].add(3)sleep(1)stat['collector'].add(-10)stat.send()
Package: carboncopy
carboncopyKeep your repositories up-to-date with their templates in a few keystrokes.❓ Whycarboncopy?Github Template Repositoriesmade it really easy to skip project boilerplate setup steps and to produce "new project kits" that ensure that all your (or your organization's) new projects have all the must-haves. Problem is, templates aren't set in stone and it's likely that templates get updated after some projects have been spawned from it.Because template repositories are different than forks, you can't simply rebase your project to gulp in the latest templated goodies -- leaving you with the gnarly task of manually moving files over. No more.Withcarboncopy, you are one command away from pulling in the latest changes from your template repositories as if it were a regular base branch. You can configure it via its RC file to ignore certain files from the template, and more!📦 InstallationAs it is not yet published onPyPi, you can simply clone this repository and usepip install <path>to install it in your local environment.🔨 UsageFrom your repository, simply typecarboncopyin your terminal to bring up a prompt asking you what to pull from your template repository.Any change made is left as an unstaged change so you can commit and merge it however you want.⚙ ConfigurationYou can configure the waycarboncopyhandles your template's contents by creating a.carboncopyrcfile at the root of your repository. Documentation TBD. Seesrc/carboncopy/config_defaults.pyfor general layout.
Package: carbone-sdk
Carbone Render Python SDKPython SDK to use Carbone Render easily.About CarboneCarbone is a powerful document generator (PDF, DOCX, XLSX, ODT, PPTX, ODS, XML, CSV...) using templates and JSON data. It is based on LibreOffice and can convert any document. It is also possible to convert HTML to PDF. Learn more aboutsupported files and features.🔖API REFERENCEInstallpipinstallcarbone-sdkUsageYou can copy and run the code bellow to try.
Get your API token on your Carbone account:https://account.carbone.io/.importcarbone_sdk# SDK constructor# The access token can be passed as an argument to the constructor CarboneSDK# Or by the environment variable "CARBONE_TOKEN", use the command "export CARBONE_TOKEN=secret-token"csdk=carbone_sdk.CarboneSDK("secret-token")# Set API version (default : 4)csdk.set_api_version("4")# Set API URL for Carbone On-Premise for example (default: "https://api.carbone.io")csdk.set_api_url("https://api.carbone.io")# The template ID, it could be an ODT, DOCX, PPTX, XLSX, ODS file, etc...template_id="template"render_options={# REQUIRED: the "data" object contains all the data to inject into the template"data":{"id":42,"date":1492012745,"company":{"name":"myCompany","address":"here","city":"Notfar","postalCode":123456},"customer":{"name":"myCustomer","address":"there","city":"Faraway","postalCode":654321},"products":[{"name":"product 1","priceUnit":0.1,"quantity":10,"priceTotal":1}],"total":140},# REQUIRED: the "convertTo" attribute defines the format to generate or convert"convertTo":"pdf"# All rendering options are available on the following API specification:# https://carbone.io/api-reference.html#pdf-export-filter-options}# Render and return the report as bytes and a unique report namereport_bytes,unique_report_name=csdk.render(template_id,render_options)fd=open(unique_report_name,"wb")fd.write(report_bytes)fd.close()# voila 🎉DocumentationAPI REFERENCETestsTests - Run with MakefileInstall the test packages:$makeinstallTo run the tests:$maketestTo uninstall the test packages:$makeuninstallTests - Run manuallyInstall:$ pip install pytest
$ pip install requests_mockTo run all the test (-v for verbose output):$pytest-s-vtestsTo run a groupe of tests:$pytest-s-v./tests/test_carbone_sdk.py::TestRenderTo run a single test:$pytest-s-v./tests/test_carbone_sdk.py::TestRender::test_render_a_report_error_file_missingTo run a single test with all the DEBUG:$ pytest ./tests/test_carbone_sdk.py::TestRender::test_render_a_report_from_an_existing_template_id --log-cli-level=10If you need to test the generation of templateId, you can use the nodejsmain.jsto test the sha256 generation.$node./tests/main.js👤 Author@steevepay🤝 ContributingContributions, issues and feature requests are welcome!Feel free to checkissues page.Show your supportGive a ⭐️ if this project helped you!
Package: carbonfootprint
carbon-footprint-calculatorConda distribution~/anaconda3/bin/conda install anaconda-client conda-build
~/anaconda3/bin/conda config --set anaconda_upload no
~/anaconda3/bin/conda build . --output

~/anaconda3/bin/anaconda login
~/anaconda3/bin/anaconda upload dist/carbonfootprint-1.1.5.tar.gzReferneceshttps://docs.anaconda.com/anacondaorg/user-guide/tasks/work-with-packages/published packagehttps://anaconda.org/altanai/carbonfootprintPYppi ditribution1. Generating distribution archivesFirst install latest version of PyPA’s build then build . This should generate dist directory:python3 -m pip install --upgrade build
python3 -m build2. Uploading the distribution archivespython3 -m pip install --upgrade twine
twine check dist/*

    Checking dist/carbon_footprint_calculator-1.1.1-py3-none-any.whl: PASSED
    Checking dist/carbon_footprint_calculator-1.1.1.tar.gz: PASSEDInstall twine and upload all of the archives under dist to pypi’s test serverpython3 -m twine upload --repository testpypi dist/*or to pyapipython3 -m twine upload dist/*3.Installing the packageFrom pytestpython3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps carbonfootprintFrom pyapipip3 install carbonfootprintReferences :List of classifiers -https://pypi.org/classifiers/published carbonfootprint package on pyapiihttps://pypi.org/project/carbonfootprint/Test EnviornmentInstall and Setup Condaexport PATH=$PATH:/home/altanai/anaconda3/binActivate virtual envsource energycarbon_env/bin/activateRun unit testspython tests/unittests.pyDebugging and HelpIssue1Adding csv for the datasetssolutionrefer tohttps://python-packaging.readthedocs.io/en/latest/non-code-files.htmlAdd the following to dynamic setup.pyinclude_package_data=True
package_data={'': ['dataset/*']},
Package: carbonify
CarbonifyOpen source library for carbon accounting and Lifecycle analysisManipulating carbon data is complex and requires both climate expertise and the knowledge of the right data source to make valid hypothesis.TheCarbonifypython library and tools are aimed to democratize data manipulation of carbon data to facilitate accounting and lifecycle analysis.!!! warning "Experimental"
This library is extremely experimental, under active development and alpha-release
Don't expect the documentation to be up-to-date or all features to be tested
Please contactusif you have any questionFeaturesCurrent featuresEasy access to Base Carbone by ADEME with data indexingData visualization and search functionalities to easily find carbon ratiosInstallationInstall from PyPiThe library is available onPyPiviapip install carbonifyFor developersYou can clone the github repo / fork and develop locallyPoetry is used for environment management, dependencies and publishing, after clone you can run# To setup the environment
poetry install

# To run Jupyter notebook or a python console
poetry run jupyter notebook
poetry run pythonContributorsEkimetricsProject Structure- carbonify/ # Your python library
- data/
    - raw/
    - processed/
- docs/
- tests/                            # Where goes each unitary test in your folder
- scripts/                          # Where each automation script will go
- requirements.txt                  # Where you should put the libraries version used in your libraryReferencesBase CarboneBase Carboneby ADEME -DocumentationAgribalyseby ADEME -Documentationhttps://www.hellocarbo.com/blog/calculer/base-carbone/LCACarbonFact.cohttps://www.carbonify.app/products/apple-iphone-12-us-64gbEDA componentshttps://blog.streamlit.io/the-streamlit-agraph-component/https://github.com/ChrisChross/streamlit-agraph
Package: carbonintensity
carbonintensitySimple Carbon Intensity UK API LibraryThe purpose of this library is to retrieve information fromCarbon Intensity UKThe client connects asynchrnously to the API for retrieving information about the current level of CO2 generating energy in the current period.It usesaiohttpto communicate with the API asynchrnously. This decision has been based mainly on the premise that the library will be used in the context of Home Assistant integration.In addition it calculates when is the next 24 hours lowest level comparing values of the CO2 forecast levels.ExampleRetrieve regional and national information based on postcodeSW1for the next 24 hours starting now:client=Client("SW1")response=awaitclient.async_get_data()data=response["data"]Note: Time in UTCData formatAn example of the function output can be found below:{"data":{"current_period_from":"2020-05-20T10:00+00:00","current_period_to":"2020-05-20T10:30+00:00","current_period_forecast":300,"current_period_index":"high","current_period_national_forecast":230,"current_period_national_index":"moderate","lowest_period_from":"2020-05-21T14:00+00:00","lowest_period_to":"2020-05-21T14:30+00:00","lowest_period_forecast":168,"lowest_period_index":"moderate","postcode":"SW1"}}Install carbonintensitypython3-mpipinstall-UcarbonintensityLicensesThis work is based on the following:sampleclient: SeeOriginal licenseCarbon Intensity API: SeeTerms and conditions
Package: carbonintensityforked
carbonintensityforkedSimple Carbon Intensity UK API LibraryThe purpose of this library is to retrieve information fromCarbon Intensity UKThe client connects asynchronously to the API, retrieving information about the current level of CO2 generating energy in the current period.It usesaiohttpto communicate with the API asynchronously. This decision has been based mainly on the premise that the library will be used in the context of Home Assistant integration.In addition it calculates when is the next 24 hours lowest level comparing values of the CO2 forecast levels.This version also adds in a regional low carbon generation percentage, which is calculated as nuclear + wind + solar + biomass + hydro as well as the work by @jfparis to implement optimal windows/forecasts..2 Adds a regional fossil fuel generation percentage which calculates as gas + coal generation from the current window. .3 Adds oil and calls 48h service.ExampleRetrieve regional and national information based on postcodeSW1for the next 24 hours starting now:client=Client("SW1")response=awaitclient.async_get_data()data=response["data"]Note: Time in UTCData formatAn example of the function output can be found below:{"data":{"current_period_from":"2020-05-20T10:00+00:00","current_period_to":"2020-05-20T10:30+00:00","current_period_forecast":300,"current_period_index":"high","current_period_national_forecast":230,"current_period_national_index":"moderate","current_low_carbon_percentage":23,"current_fossil_fuel_percentage":65,"lowest_period_from":"2020-05-21T14:00+00:00","lowest_period_to":"2020-05-21T14:30+00:00","lowest_period_forecast":168,"lowest_period_index":"moderate","optimal_window_from":"2020-05-20T10:00+00:00","optimal_window_to":"2020-05-20T10:30+00:00","optimal_window_forecast":121,"optimal_window_index":"low","optimal_window_48_from":"2020-05-20T10:00+00:00","optimal_window_48_to":"2020-05-20T10:30+00:00","optimal_window_48_forecast":130,"optimal_window_48_index":"low","unit":"gCO2/kWh","forecast":[{"from":"2020-05-20T10:00+00:00","to":"2020-05-20T11:00+00:00","intensity":162,"index":0,"optimal":False}],"postcode":"SW1"}}Install carbonintensitypython3-mpipinstall-Ucarbonintensity-forkedLicensesThis work is based on the following:carbonintensity: SeeLicensesensor.carbon_intensity_uksampleclient: SeeOriginal licenseCarbon Intensity API: SeeTerms and conditions
Package: carbonium
carboniumEasily manage a list of names with several
properties and (overlapping) order criteria.InstallationInstall carbonium is as easy as runpip install carbonium.UsageAs first step you should define a name list:name_list=[{"domains":["raw","output"],"name":"var1","alias":"column_1_name","output_order":1,"filling_value":10,},{"domains":["raw"],"name":"var2","alias":"column_2_name","output_order":2,},{"domains":["new","output"],"name":"new_var","alias":"new_column_name",},]Eachname definitionis a dictionary that
contains some common, mandatory key, and some
other keys, domain-specific or name-specific.Mandatory keys are only three:domains, a list of string, each representing adomainname, a string, uniquely identifiers of anamealias, a string that can be used to refers to
the name in context where it is named with
this alternative string.Then, each name belongs to some domains. Domains
are used to perfom names selection (give me all
names belonging todomain). Names that belongs
to the same domain should have the same optional
attributes.Aftername listdefinition, you can instantiate
the structure class:fromcarboniumimportStructurestructure=Structure(name_list)Internally, the Structure class iteratively instantiate a
Name class for eachname definition. After this
step you can access to each Name and its properties
throughcobject, but you can also use one of
property or method of the class.print(structure.names)# returns:  ['var1', 'var2', 'new_var']print(structure.domains)# returns: {'new', 'output', 'raw'}print(structure.var1.name,structure.var1.domains,structure.var1.output_order)Callingstructure.var1.nameyou have access to the
string associated to var1... and so on.ordered_raw_columns=[(i,structure.get(i).output_order,structure.get(i).get("filling_value"))foriinstructure.get_names('raw')]ordered_raw_columns=sorted(ordered_raw_columns,key=lambdax:x[1])In this example all the names belonging torawdomain are extracted with some other properties.
In this way the same name can be used in different
domains or contexts by referring to contexctual
relevant properties.importpandasaspddf=pd.DataFrame([{"var1":100,"var2":200},{"var2":220},])fornameinstructure.get_names('raw'):alias=structure.get(name).aliasfilling=structure.get(name).get("filling_value")iffilling:df[alias].fillna(filling,inplace=True)fornameinstructure.get_names('new'):alias=structure.get(name).aliasdf[alias]="arbitrary"output_columns=structure.get_names('new')df[output_columns].to_parquet('output.parquet')As you can see, whithout modify the code but only the
taxonomy described inname_list, you can affect
different columns.
Package: carbonizer
A Python CLI to create carbonized versions of your code.
This projects is based on:Carbon,Pyppetterand the wonderfulTyperFramework.Installation:$pipinstallcarbonizerUsagecarbonizer--help# This creates a carbonized version in the same directorycarbonizersome_file.py# To create the output in a specific foldercarbonizer-otargetsome_file.py# This will grab all files and carbonize themcarbonizer-otarget.# The -c flag directly copied the output into your clipboardcarbonizer-csome_file.py# If you prefer to run the raw code you can also use the project likepython__main__.py-t"one-light"carbonizer-otargetNote: The copy functionality is only tested on Linux devices - while Mac is also supported theoretically, there is no support for windows.