# packages

pkgId: beaa2aff9f973951bba5ecd8eebe8f73217d2f83787c59823c1419cda7a4d977
name: python-benepar
arch: src
version: 0.2.0
epoch: 0
release: 1
summary: Berkeley Neural Parser
url: https://github.com/nikitakit/self-attentive-parser
rpm_license: Apache Software License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-benepar-0.2.0-1.src.rpm
checksum_type: sha256
description:
  `benepar_en3` | English | 95.40 F1 on [revised](https://catalog.ldc.upenn.edu/LDC2015T13) WSJ test set. The training data uses revised tokenization and syntactic annotation based on the same guidelines as the English Web Treebank and OntoNotes, which better matches modern tokenization practices in libraries like spaCy. Based on T5-small.
  `benepar_en3_large` | English | 96.29 F1 on [revised](https://catalog.ldc.upenn.edu/LDC2015T13) WSJ test set. The training data uses revised tokenization and syntactic annotation based on the same guidelines as the English Web Treebank and OntoNotes, which better matches modern tokenization practices in libraries like spaCy. Based on T5-large.
  `benepar_zh2` | Chinese | 92.56 F1 on CTB 5.1 test set. Usage with spaCy allows supports parsing from raw text, but the NLTK API only supports parsing previously tokenized sentences. Based on Chinese ELECTRA-180G-large.
  `benepar_ar` | Arabic | 90.52 F1 on SPMRL2013/2014 test set. Only supports using the NLTK API for parsing previously tokenized sentences. Parsing from raw text and spaCy integration are not supported. Based on XLM-R.
  `benepar_de` | German | 92.10 F1 on SPMRL2013/2014 test set. Based on XLM-R.
  `benepar_eu` | Basque | 93.36 F1 on SPMRL2013/2014 test set. Usage with spaCy first requires implementing Basque support in spaCy. Based on XLM-R.
  `benepar_fr` | French | 88.43 F1 on SPMRL2013/2014 test set. Based on XLM-R.
  `benepar_he` | Hebrew | 93.98 F1 on SPMRL2013/2014 test set. Only supports using the NLTK API for parsing previously tokenized sentences. Parsing from raw text and spaCy integration are not supported. Based on XLM-R.
  `benepar_hu` | Hungarian | 96.19 F1 on SPMRL2013/2014 test set. Usage with spaCy requires a [Hungarian model for spaCy](https://github.com/oroszgy/spacy-hungarian-models). The NLTK API only supports parsing previously tokenized sentences. Based on XLM-R.
  `benepar_ko` | Korean | 91.72 F1 on SPMRL2013/2014 test set. Can be used with spaCy's [multi-language sentence segmentation model](https://spacy.io/models/xx#xx_sent_ud_sm) (requires spaCy v3.0). The NLTK API only supports parsing previously tokenized sentences. Based on XLM-R.
  `benepar_pl` | Polish | 97.15 F1 on SPMRL2013/2014 test set. Based on XLM-R.
  `benepar_sv` | Swedish | 92.21 F1 on SPMRL2013/2014 test set. Can be used with spaCy's [multi-language sentence segmentation model](https://spacy.io/models/xx#xx_sent_ud_sm) (requires spaCy v3.0). Based on XLM-R.
  `benepar_en3_wsj` | English | **Consider using `benepar_en3` or `benepar_en3_large` instead**. 95.55 F1 on [canonical](https://catalog.ldc.upenn.edu/LDC99T42) WSJ test set used for decades of English constituency parsing publications. Based on BERT-large-uncased. We believe that the revised annotation guidelines used for training `benepar_en3`/`benepar_en3_large` are more suitable for downstream use because they better handle language usage in web text, and are more consistent with modern practices in dependency parsing and libraries like spaCy. Nevertheless, we provide the `benepar_en3_wsj` model for cases where using the revised treebanking conventions are not appropriate, such as benchmarking different models on the same dataset.

  Training requires cloning this repository from GitHub. While the model code in `src/benepar` is distributed in the `benepar` package on PyPI, the training and evaluation scripts directly under `src/` are not.

  * Python 3.7 or higher.
  * [PyTorch](http://pytorch.org/) 1.6.0, or any compatible version.
  * All dependencies required by the `benepar` package, including: [NLTK](https://www.nltk.org/) 3.2, [torch-struct](https://github.com/harvardnlp/pytorch-struct) 0.4, [transformers](https://github.com/huggingface/transformers) 4.3.0, or compatible.
  * [pytokenizations](https://github.com/tamuhey/tokenizations/) 0.7.2 or compatible.
  * [EVALB](http://nlp.cs.nyu.edu/evalb/). Before starting, run `make` inside the `EVALB/` directory to compile an `evalb` executable. This will be called from Python for evaluation. If training on the SPMRL datasets, you will need to run `make` inside the `EVALB_SPMRL/` directory instead.

  A new model can be trained using the command `python src/main.py train ...`. Some of the available arguments are:


pkgId: 8fa4b7c915db662ca90642fd79a84fe9b534d0a6d4a84371371154f78a27d108
name: python-benford-py
arch: src
version: 0.5.0
epoch: 0
release: 1
summary: A library for testing data sets with Bendford's Law
url: https://github.com/milcent/benford_py
rpm_license: BSD 3-Clause
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-benford-py-0.5.0-1.src.rpm
checksum_type: sha256
description:
  **Citing**
  If you find *Benford_py* useful in your research, please consider adding the following citation:
  ```bibtex
  @misc{benford_py,
        author = {Marcel, Milcent},
        title = {{Benford_py: a Python Implementation of Benford's Law Tests}},
        year = {2017},
        publisher = {GitHub},
        journal = {GitHub repository},
        howpublished = {\url{https://github.com/milcent/benford_py}},
  }


pkgId: ff8f76139ebad17c0e44305493f6c5d78c0d32d8c61397a30231d9bef567f1a2
name: python-benfordslaw
arch: src
version: 2.0.1
epoch: 0
release: 1
summary: benfordslaw is a python library to test the frequency distribution of leading digits.
url: https://erdogant.github.io/benfordslaw
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-benfordslaw-2.0.1-1.src.rpm
checksum_type: sha256
description:
  [![Python](https://img.shields.io/pypi/pyversions/benfordslaw)](https://img.shields.io/pypi/pyversions/benfordslaw)
  [![PyPI Version](https://img.shields.io/pypi/v/benfordslaw)](https://pypi.org/project/benfordslaw/)
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/erdogant/benfordslaw/blob/master/LICENSE)
  [![BuyMeCoffee](https://img.shields.io/badge/buymeacoffee-grey.svg)](https://www.buymeacoffee.com/erdogant)
  [![Github Forks](https://img.shields.io/github/forks/erdogant/benfordslaw.svg)](https://github.com/erdogant/benfordslaw/network)
  [![GitHub Open Issues](https://img.shields.io/github/issues/erdogant/benfordslaw.svg)](https://github.com/erdogant/benfordslaw/issues)
  [![Project Status](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
  [![Downloads](https://pepy.tech/badge/benfordslaw/month)](https://pepy.tech/project/benfordslaw/month)
  [![Downloads](https://pepy.tech/badge/benfordslaw)](https://pepy.tech/project/benfordslaw)
  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://erdogant.github.io/benfordslaw/pages/html/Documentation.html#colab-notebook)
  [![Sphinx](https://img.shields.io/badge/Sphinx-Docs-Green)](https://erdogant.github.io/benfordslaw/)
  [![DOI](https://zenodo.org/badge/239205250.svg)](https://zenodo.org/badge/latestdoi/239205250)
  <!---[![Coffee](https://img.shields.io/badge/coffee-black-grey.svg)](https://erdogant.github.io/donate/?currency=USD&amount=5)-->

  * ``benfordslaw`` is Python package to test if an empirical (observed) distribution differs significantly from a theoretical (expected, Benfords) distribution. The law states that in many naturally occurring collections of numbers, the leading significant digit is likely to be small. This method can be used if you want to test whether your set of numbers may be artificial (or manipulated). If a certain set of values follows Benford's Law then model's for the corresponding predicted values should also follow Benford's Law. Normal data (Unmanipulated) does trend with Benford's Law, whereas Manipulated or fraudulent data does not.

  * Assumptions of the data:
    1. The numbers need to be random and not assigned, with no imposed minimums or maximums.
    2. The numbers should cover several orders of magnitude
    3. Dataset should preferably cover at least 1000 samples. Though Benford's law has been shown to hold true for datasets containing as few as 50 numbers.


  **⭐️ Star this repo if you like it ⭐️**




  ```bash
  pip install benfordslaw
  ```



  ```python
  from benfordslaw import benfordslaw
  ```





  On the [documentation pages](https://erdogant.github.io/benfordslaw/) you can find detailed information about the working of the ``benfordslaw`` with many examples.

  <hr>





  * [Example: Analyze first digit-distribution](https://erdogant.github.io/benfordslaw/pages/html/Examples.html#second-digit-test)

  <p align="left">
    <a href="https://erdogant.github.io/benfordslaw/pages/html/Examples.html#second-digit-test">
    <img src="https://github.com/erdogant/benfordslaw/blob/master/docs/figs/fig1.png" width="600" />
    </a>
  </p>




  * [Example: Analyze second digit-distribution](https://erdogant.github.io/benfordslaw/pages/html/Examples.html)

  <p align="left">
    <a href="https://erdogant.github.io/benfordslaw/pages/html/Examples.html">
    <img src="https://github.com/erdogant/benfordslaw/blob/master/docs/figs/fig2nd_digit_votes.png" width="600" />
    </a>
  </p>




  * [Example: Analyze last digit-distribution](https://erdogant.github.io/benfordslaw/pages/html/Examples.html#last-digit-test)

  <p align="left">
    <a href="https://erdogant.github.io/benfordslaw/pages/html/Examples.html#last-digit-test">
    <img src="https://github.com/erdogant/benfordslaw/blob/master/docs/figs/fig_last_digit_votes.png" width="600" />
    </a>
  </p>




  * [Example: Analyze second last digit-distribution](https://erdogant.github.io/benfordslaw/pages/html/Examples.html#second-last-digit-test)

  <p align="left">
    <a href="https://erdogant.github.io/benfordslaw/pages/html/Examples.html#second-last-digit-test">
    <img src="https://github.com/erdogant/benfordslaw/blob/master/docs/figs/fig_2nd_last_digit_votes.png" width="600" />
    </a>
  </p>




  * https://en.wikipedia.org/wiki/Benford%27s_law
  * https://towardsdatascience.com/frawd-detection-using-benfords-law-python-code-9db8db474cf8


  Please cite in your publications if this is useful for your research (see citation).


  * Erdogan Taskesen, github: [erdogant](https://github.com/erdogant)


  * All kinds of contributions are welcome!
  * If you wish to buy me a <a href="https://www.buymeacoffee.com/erdogant">Coffee</a> for this work, it is very appreciated :)


  See [LICENSE](LICENSE) for details.


pkgId: 23b45a35f60accf166ea92ae9a4af4acf099fceaa0f07773c4b25ab72fea1a6a
name: python-benfordslaw-analysis
arch: src
version: 1.1.0
epoch: 0
release: 1
summary: Use this package to analyse your data with Benford's law
url: https://github.com/jurjen93/Benfords_law
rpm_license: LICENSE.txt
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-benfordslaw-analysis-1.1.0-1.src.rpm
checksum_type: sha256
description:
  Benford's law is a digit-law, which states that digits from numbers follow a specific frequency.
  This specific frequency has been observed in many numerical datasets,
  as discovered by Simon Newcomb and Frank Benford.
  You can find on [wikipedia] more information about this mysterious law.

  Benford's law is a helpful tool to detect fraud, do science, or just investigate the quality of data.
  You can also read my [blog] on Towards Data Science with a summary of Benford's law and [this paper],
  where I used Benford's law to study digit patterns of the distances between stars in our Milky Way.


  With ```pip install benfordslaw-analysis``` you can install the package.


  After installing, you can run in Python ```from benfordslaw_analysis.analysis import Analysis```.
  This imports the class ```Analysis```.
  With this class you can verify if Benford's law is hidden in your own data.

  For example, make a plot with Benford's law versus random data with:
  ```
  from benfordslaw_analysis.analysis import Analysis
  from random import uniform
  random_data = [uniform(-10, 10) for i in range(0,1000)]
  bl = Analysis(random_data)
  bl.plot_first_digit('Random stuff')
  ```
  ![Test Image 1](test/test.png)

  Note that we use the [Euclidean distance] between the digit frequency from Benford's law and your own data as a measure
  and that we use Poisson error bars (based on the number of data points).



  The normalized Euclidean distance is a quick way to test whether your data follows Benford law.
  This value is situated between 0 and 1, the closer to 0 the better.
  However, it is not a formal statistic because it is sample size independent.
  In the literature there are several other measures (Chi-square, Kolmogorov-Smirnov, ..) that are used. However, I noticed in my own research that
  size dependency is a limitation in bigger datasets and classifies all bigger datasets as non-Benford, even though they are Benford by eye.



  If you find ```benfordslaw_analysis``` a useful tool for your own research, please cite in the following way:

  ```
  @misc{benford_py,
        author = {Jurjen, de Jong},
        title = {{benfordslaw_analysis: a Python Implementation of Benford's Law analysis}},
        year = {2021},
        howpublished = {\url{https://github.com/jurjen93/Benfords_law}},
  }
  ```

  [wikipedia]: https://en.wikipedia.org/wiki/Benford%27s_law
  [blog]: https://towardsdatascience.com/benfords-law-in-the-gaia-universe-b5727db7a936
  [Euclidean distance]: https://en.wikipedia.org/wiki/Euclidean_distance
  [this paper]: https://www.aanda.org/articles/aa/pdf/2020/10/aa37256-19.pdf


pkgId: 83d6e26a14fc519f087516de3bf396c4b4781da5856f2fbb3943de85575dba00
name: python-beniget
arch: src
version: 0.4.2.post1
epoch: 0
release: 1
summary: Extract semantic information about static Python code
url: https://github.com/serge-sans-paille/beniget/
rpm_license: BSD 3-Clause
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-beniget-0.4.2.post1-1.src.rpm
checksum_type: sha256
description:
  A static analyzer for Python code.

  Beniget provides a static over-approximation of the global and
  local definitions inside Python Module/Class/Function.
  It can also compute def-use chains from each definition.


pkgId: 4641581794ab748a94a0bc6976e081ace6e20cf3882e9832704d1bca849036cd
name: python-benpay_merchant_api_sdk
arch: src
version: 0.0.4
epoch: 0
release: 1
summary: python sdk for benpay merchant
url: https://pypi.org/project/benpay_merchant_api_sdk/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-benpay_merchant_api_sdk-0.0.4-1.src.rpm
checksum_type: sha256
description:
  - [Official documentation](https://docs.benpay.org/zh-Hans/BenPay/Doc/api_doc/)



  ```bash
  pip install benpay_merchant_api_sdk
  ```


  > Consider `/v1/payment/create` as a reference, the full code can be located in the demo directory.
  * Get api key info

  https://www.benpay.org/paymvp/business

  * create order
  ```python
  import config
  import sys
  import uuid

  sys.path.append("../../")
  from benpay_merchant_api_sdk.client import BenpayMerchantClient
  import benpay_merchant_api_sdk.param.benpay_merchant_param as benpay_param


  client = BenpayMerchantClient(
      api_key=config.API_KEY,
      server=config.SERVER,
      merchant_private_key_string=config.MERCHANT_PRIVATE_KEY_STRING,
      platform_public_key_string=config.PLATFORM_PUBLIC_KEY_STRING
  )

  param = benpay_param.CreatePayOrderParam()
  param.coin = "BUSD"
  param.coinAmount = "0.1"
  param.out_trade_no = uuid.uuid4().hex
  param.merchant_note = "22222"

  resp = client.create_pay_order(param)

  if resp.status_code == 200:
      print(resp.json())
  else:
      print(resp.text)
  ```%


pkgId: 1599f9df32c923cbb346e9cd53382137915a2b14cea09a1d8eeca2b2af9229c4
name: python-benqprojector
arch: src
version: 0.1.4
epoch: 0
release: 1
summary: Library to control BenQ projectors.
url: https://github.com/rrooggiieerr/benqprojector.py
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-benqprojector-0.1.4-1.src.rpm
checksum_type: sha256
description:
  ![Python][python-shield]
  [![GitHub Release][releases-shield]][releases]
  [![Licence][license-shield]][license]
  [![Maintainer][maintainer-shield]][maintainer]
  [![Github Sponsors][github-shield]][github]
  [![PayPal][paypal-shield]][paypal]
  [![BuyMeCoffee][buymecoffee-shield]][buymecoffee]
  [![Patreon][patreon-shield]][patreon]



  Python library to control BenQ projectors over the serial interface or serial to network bridges
  like [esp-link](https://github.com/jeelabs/esp-link).

  BenQ projectors and flat panels with a serial port can support one of three protocols. This plugin
  supports projectors which are of the L, P, T, W and X series but probably also others.



  * Connects to a BenQ projector over serial and serial to network bridge
  * Sending commands to projectors
  * Reading the projector status
  * Detect projector capabilities
  * Uses asynchronous IO



  I'm using a generic serial to USB converter to connect to my projector. The projector has a male
  DB9 connector, thus you need a female conector on your USB converter.



  This Python library works if your projector supports the following command structure:

  `<CR>*<key>=<value>#<CR>`

  Where `<CR>` is a Carriage Return

  Examples:
  Power on   : `<CR>*pow=on#<CR>`
  Power off  : `<CR>*pow=off#<CR>`
  Change source to HDMI: `<CR>*sour=hdmi#<CR>`



  You can lookup and change the baud rate in the menu of your BenQ projector.



  The commands as described above should also work over a network connection, however I don't own
  such projector and have implemented the network functionality using a serial to network bridge. The
  network support for native networked BenQ projectors is thus experimental. Let me know if your
  network connected BenQ projector works.

  Example of a serial to network bridge using a serial to TTL converter and a Wemos C3 Mini:

  <img src="https://raw.githubusercontent.com/rrooggiieerr/benqprojector.py/main/serial%20to%20network%20bridge.png">

  It has to be said that a direct serial connection to the projector is much more responsive than
  using a network connection, at least when using a serial to network bridge. Maybe this is different
  on a native networked BenQ projector or using ethernet instead of WiFi.



  This library does **not** implement the PJLink protocol, but a proparitary BenQ protocol instead.
  The PJLink protocol is covered by other libraries.



  The following projectors are known to work:

  * HT4550i
  * MW519
  * TH585
  * TK800m
  * W1070
  * W1100
  * W1110
  * W1140
  * W1250
  * W4000i
  * X3000i

  The following projectors are not tested but use the same protocol according to the documentation:

  Others in the L, P, T, W and X Series

  Not supported:

  * RP552
  * RP552H
  * RP840G
  * RP653
  * RP703
  * RP750
  * RP750K
  * RP652
  * RP702
  * RP790S
  * RP705H

  Some projectors need to be **on** to be able to detect the model and the library to work.

  Please let me know if your projector is also supported by this Python library so I can improve the
  overview of supported projectors.



  To install the Python BenQ projector library use the Python package manager PIP:

  `pip3 install benqprojector`



  You can use the Python BenQ projector library directly from the command line to turn on and off
  your projector using the following syntax:

  Status of the projector: `python3 -m benqprojector serial <serial port> <baud> status`
  Turn on the projector: `python3 -m benqprojector serial <serial port> <baud> on`
  Turn off the projector: `python3 -m benqprojector serial <serial port> <baud> off`
  Monitor the projector status: `python3 -m benqprojector serial <serial port> <baud> monitor`

  Where `<serial port>` is the serial port your projector is connected to and `<baud>` the baud rate
  of the projector.

  Or if your projector is connected using a serial to network bridge:

  Status of the projector: `python3 -m benqprojector telnet <host> <port> status`
  Turn on the projector: `python3 -m benqprojector telnet <host> <port> on`
  Turn off the projector: `python3 -m benqprojector telnet <host> <port> off`
  Monitor the projector status: `python3 -m benqprojector telnet <host> <port> monitor`

  Where `<host>` is the hostname or IP address of the projector and `<port>` the optional port number
  of the projector. If no port number is given the default port number 8000 is used.



  The benqprojector CLI can detect the commands, sources and modes your projector supports. If you
  like to have your projector fully supported by this Python library please run this command and
  create an issue on Github with the output attached.

  To examine your projector capabilities:

  `python3 -m benqprojector serial <serial port> <baud> examine`

  Your projector needs to be **on** and on an **active source** to be able to detect all your
  projector capabilities.



  You can add the `--debug` flag to any CLI command to get a more details on what's going on. Like so:

  `python3 -m benqprojector serial <serial port> <baud> status --debug`



  Do you enjoy using this Python library? Then consider supporting my work using one of the following
  platforms, your donation is greatly appreciated and keeps me motivated:

  [![Github Sponsors][github-shield]][github]
  [![PayPal][paypal-shield]][paypal]
  [![BuyMeCoffee][buymecoffee-shield]][buymecoffee]
  [![Patreon][patreon-shield]][patreon]



  If you're in need for a freelance Python developer for your project please contact me, you can find
  my email address on [my GitHub profile](https://github.com/rrooggiieerr).

  [python-shield]: https://img.shields.io/badge/python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54
  [releases]: https://github.com/rrooggiieerr/benqprojector.py/releases
  [releases-shield]: https://img.shields.io/github/v/release/rrooggiieerr/benqprojector.py?style=for-the-badge
  [license]: ./LICENSE
  [license-shield]: https://img.shields.io/github/license/rrooggiieerr/benqprojector.py?style=for-the-badge
  [maintainer]: https://github.com/rrooggiieerr
  [maintainer-shield]: https://img.shields.io/badge/MAINTAINER-%40rrooggiieerr-41BDF5?style=for-the-badge
  [paypal]: https://paypal.me/seekingtheedge
  [paypal-shield]: https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white
  [buymecoffee]: https://www.buymeacoffee.com/rrooggiieerr
  [buymecoffee-shield]: https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black
  [github]: https://github.com/sponsors/rrooggiieerr
  [github-shield]: https://img.shields.io/badge/sponsor-30363D?style=for-the-badge&logo=GitHub-Sponsors&logoColor=ea4aaa
  [patreon]: https://www.patreon.com/seekingtheedge/creators
  [patreon-shield]: https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white


pkgId: baed5d4b7d2f6ccac8d7672aafa5a282cf6c1c81d96785b0737b68b0f9c42f99
name: python-bentley-ottmann
arch: src
version: 8.0.0
epoch: 0
release: 1
summary: please add a summary manually as the author left a blank one
url: https://github.com/lycantropos/bentley_ottmann/
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bentley-ottmann-8.0.0-1.src.rpm
checksum_type: sha256
description:
  [![](https://github.com/lycantropos/bentley_ottmann/workflows/CI/badge.svg?branch=master)](https://github.com/lycantropos/bentley_ottmann/actions/workflows/ci.yml "Github Actions")
  [![](https://readthedocs.org/projects/bentley_ottmann/badge/?version=latest)](https://bentley-ottmann.readthedocs.io/en/latest "Documentation")
  [![](https://codecov.io/gh/lycantropos/bentley_ottmann/branch/master/graph/badge.svg)](https://codecov.io/gh/lycantropos/bentley_ottmann "Codecov")
  [![](https://img.shields.io/github/license/lycantropos/bentley_ottmann.svg)](https://github.com/lycantropos/bentley_ottmann/blob/master/LICENSE "License")
  [![](https://badge.fury.io/py/bentley-ottmann.svg)](https://badge.fury.io/py/bentley-ottmann "PyPI")
  In what follows `python` is an alias for `python3.7` or `pypy3.7`
  or any later version (`python3.8`, `pypy3.8` and so on).

rpm_license:
  MIT License  Copyright (c) 2020 Azat Ibrakov  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


pkgId: 2f94a0dfc92aa8c56cb1f8e5b8c15f0efc6ae9bc0a879d3d3c79b1ea6b08da9a
name: python-bento-lib
arch: src
version: 12.2.2
epoch: 0
release: 1
summary: A set of common utilities and helpers for Bento platform services.
url: https://github.com/bento-platform/bento_lib
rpm_license: LGPL-3.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bento-lib-12.2.2-1.src.rpm
checksum_type: sha256
description:
  ![Test Status](https://github.com/bento-platform/bento_lib/workflows/Test/badge.svg)
  ![Lint Status](https://github.com/bento-platform/bento_lib/workflows/Lint/badge.svg)
  [![codecov](https://codecov.io/gh/bento-platform/bento_lib/branch/master/graph/badge.svg)](https://codecov.io/gh/bento-platform/bento_lib)
  [![PyPI version](https://badge.fury.io/py/bento-lib.svg)](https://badge.fury.io/py/bento-lib)

  Common utilities and helpers for Bento platform services.




  `bento_lib` can be added to a new service through normal installation, with any extras
  that may be needed:

  ```bash

  poetry add bento_lib


  pip install bento_lib[fastapi]


  ```




  Clone the repository and set up the Poetry environment using the following commands:

  ```bash
  git clone git@github.com:bento-platform/bento_lib.git
  poetry install --all-extras
  ```




  For tests to complete successfully, the following external servers must be running:

  * A Redis server at `localhost:6379`
  * A Postgres server at `localhost:5432` with `peer` access for the `postgres`
    role/database

  Then, tests and linting can be run with the following command:

  ```bash
  poetry run tox
  ```







    * [ ] All tests pass and test coverage has not been reduced

    * [ ] Package version has been updated (following semver) in `pyproject.toml`

    * [ ] The latest changes have been merged into the `master` branch

    * [ ] A release has been created, tagged in the format of `v#.#.#` and named
      in the format of `Version #.#.#`, listing any changes made, in the GitHub
      releases page **tagged from the master branch!**




  The `bento_lib` project uses [semantic versioning](https://semver.org/) for
  releasing. If the API is broken in any way, including minor differences in the
  way a function behaves given an identical set of parameters (excluding bugfixes
  for unintentional behaviour), the MAJOR version must be incremented. In this
  way, we guarantee that projects relying on this API do not accidentally break
  upon upgrading.




  When a version is tagged on GitHub, a build + release CI pipeline is automatically triggered.
  Make sure that the tagged version is a valid semantic versioning translation of the version in
  `pyproject.toml`, and that the versions otherwise match.






  `apps` provides Python classes for setting up applications, wrapping a framework's base class with
  additional code to set up error handling and basic Bento service boilerplate.



  `auth` provides Python service middleware for dealing with the Bento authorization service.



  `db` contains common base classes for setting up database managers.



  `drs` provides utilities for fetching data and record metadata from
  GA4GH-compatible DRS services, and Bento's own implementation (which has some
  non-standard extensions.)



  `events` facilitates JSON-serialized message-passing between Bento
  microservices. Serialized objects can be at most 512 MB.

  Events should have a lower-case type which is type-insensitively unique and
  adequately describes the associated data.

  All Bento channels are prefixed with `bento.`.



  `logging` contains helper functions for standardized Bento logging configuration
  and formatting.



  `responses` contains standardized error message-generating functions
  and exception handling functions for different Python web frameworks.



  `schemas` contains common JSON schemas which may be useful to a variety of
  different Bento services.

  `schemas.bento` contains Bento-specific schemas, and `schemas.ga4gh` contains
  GA4GH-standardized schemas (possibly not exactly to spec.)



  `search` contains definitions, validators, and transformations for the query
  syntax for Bento, as well as a transpiler to the `psycopg2` PostgreSQL IR.

  The query syntax for Bento takes advantage of JSON schemas augmented with
  additional properties about the field's accessibility and, in the case of
  Postgres, how the field maps to a table column (or JSON column sub-field.)

  `search.data_structure` contains code for evaluating a Bento query against a
  Python data structure.

  `search.operations` contains constants representing valid search operations one
  can allow against particular fields from within an augmented JSON schema.

  `search.postgres` contains a "transpiler" from the Bento query syntax to the
  `psycopg2`-provided
  [intermediate representation (IR)](https://www.psycopg.org/docs/sql.html) for
  PostgreSQL, allowing safe queries against a Postgres database.

  `search.queries` provides definitions for the Bento query AST and some helper
  methods for creating and processing ASTs.



  `service_info` contains Python typed dictionaries, Pydantic models, and helpers
  for common structures and operations related to GA4GH's `/service-info`
  specification.



  `streaming` contains helper code for streaming bytes via HTTP from files, and
  proxied HTTP resources, including exception definitions and HTTP `Range` header
  parsing.



  `workflows` contains common code used for handling workflow metadata processing
  and response generation, as well as code associated with Bento's ingestion
  routines across the different data services.


pkgId: 2bc9e70e503b120da84f5cb71fa23c36040494aff08d046743ae3aa2df224294
name: python-bento-tools
arch: src
version: 2.1.3
epoch: 0
release: 1
summary: A toolkit for subcellular analysis of spatial transcriptomics data
url: https://pypi.org/project/bento-tools/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bento-tools-2.1.3-1.src.rpm
checksum_type: sha256
description:
  [![GitHub license](https://img.shields.io/github/license/ckmah/bento-tools.svg)](https://github.com/ckmah/bento-tools/blob/master/LICENSE)


pkgId: 6dcd7acf5f1eb91b5ab95328784b33b63c994e838226415671679dc39241e85a
name: python-bentodev
arch: src
version: 2018.11.2
epoch: 0
release: 1
summary: BentoBox Local Development System
url: https://github.com/getbento/bentodev
rpm_license: UNKNOWN
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bentodev-2018.11.2-1.src.rpm
checksum_type: sha256
description:
  * Edit BentoBox themes locally
  * Uses real data when making themes
  * Use Flask to act as a proxy between server requests
  * Uses Jinja2 to rigidly enforce template edits


pkgId: 611edeed8f63532522d8b7c11af0dd8c932be69f2fa52df7e4438805cc06928b
name: python-bentoml
arch: src
version: 1.3.11
epoch: 0
release: 1
summary: BentoML: The easiest way to serve AI apps and models
url: https://bentoml.com
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bentoml-1.3.11-1.src.rpm
checksum_type: sha256
description:
  <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://github.com/bentoml/BentoML/assets/489344/d3e6c95d-d224-49a5-9cff-0789f094e127">
      <source media="(prefers-color-scheme: light)" srcset="https://github.com/bentoml/BentoML/assets/489344/de4da660-6aeb-4e5a-bf76-b7177435444d">
      <img alt="BentoML: Unified Model Serving Framework" src="https://github.com/bentoml/BentoML/assets/489344/de4da660-6aeb-4e5a-bf76-b7177435444d" width="370" style="max-width: 100%;">
  </picture>



  🍱 Build model inference APIs and multi-model serving systems with any open-source or custom AI models. 👉 [Join our Slack community!](https://l.bentoml.com/join-slack)

  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202-green.svg)](https://github.com/bentoml/BentoML?tab=Apache-2.0-1-ov-file)
  [![Releases](https://img.shields.io/github/v/release/bentoml/bentoml.svg)](https://github.com/bentoml/bentoml/releases)
  [![CI](https://github.com/bentoml/bentoml/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bentoml/BentoML/actions/workflows/ci.yml?query=branch%3Amain)
  [![Twitter](https://badgen.net/badge/icon/@bentomlai/1DA1F2?icon=twitter&label=Follow)](https://twitter.com/bentomlai)
  [![Community](https://badgen.net/badge/Join/Community/cyan?icon=slack)](https://l.bentoml.com/join-slack)



  BentoML is a Python library for building online serving systems optimized for AI apps and model inference.

  - **🍱 Easily build APIs for Any AI/ML Model.** Turn any model inference script into a REST API server with just a few lines of code and standard Python type hints.
  - **🐳 Docker Containers made simple.** No more dependency hell! Manage your environments, dependencies and model versions with a simple config file. BentoML automatically generates Docker images, ensures reproducibility, and simplifies how you deploy to different environments.
  - **🧭 Maximize CPU/GPU utilization.** Build high performance inference APIs leveraging built-in serving optimization features like dynamic batching, model parallelism, multi-stage pipeline and multi-model inference-graph orchestration.
  - **👩‍💻 Fully customizable.** Easily implement your own APIs or task queues, with custom business logic, model inference and multi-model composition. Supports any ML framework, modality, and inference runtime.
  - **🚀 Ready for Production.** Develop, run and debug locally. Seamlessly deploy to production with Docker containers or [BentoCloud](https://www.bentoml.com/).



  Install BentoML:

  ```

  pip install -U bentoml
  ```

  Define APIs in a `service.py` file.

  ```python
  from __future__ import annotations

  import bentoml

  @bentoml.service(
      resources={"cpu": "4"}
  )
  class Summarization:
      def __init__(self) -> None:
          import torch
          from transformers import pipeline

          device = "cuda" if torch.cuda.is_available() else "cpu"
          self.pipeline = pipeline('summarization', device=device)

      @bentoml.api(batchable=True)
      def summarize(self, texts: list[str]) -> list[str]:
          results = self.pipeline(texts)
          return [item['summary_text'] for item in results]
  ```

  Run the service code locally (serving at http://localhost:3000 by default):

  ```bash
  pip install torch transformers  # additional dependencies for local run

  bentoml serve service.py:Summarization
  ```

  Now you can run inference from your browser at http://localhost:3000 or with a Python script:

  ```python
  import bentoml

  with bentoml.SyncHTTPClient('http://localhost:3000') as client:
      summarized_text: str = client.summarize([bentoml.__doc__])[0]
      print(f"Result: {summarized_text}")
  ```



  To deploy your BentoML Service code, first create a `bentofile.yaml` file to define its dependencies and environments. Find the full list of bentofile options [here](https://docs.bentoml.com/en/latest/guides/build-options.html).

  ```yaml
  service: 'service:Summarization' # Entry service import path
  include:
    - '*.py' # Include all .py files in current directory
  python:
    packages: # Python dependencies to include
      - torch
      - transformers
  docker:
    python_version: "3.11"
  ```

  Then, choose one of the following ways for deployment:

  <details>

  <summary>🐳 Docker Container</summary>

  Run `bentoml build` to package necessary code, models, dependency configs into a Bento - the standardized deployable artifact in BentoML:

  ```bash
  bentoml build
  ```

  Ensure [Docker](https://docs.docker.com/) is running. Generate a Docker container image for deployment:

  ```bash
  bentoml containerize summarization:latest
  ```

  Run the generated image:

  ```bash
  docker run --rm -p 3000:3000 summarization:latest
  ```

  </details>

  <details>

  <summary>☁️ BentoCloud</summary>

  [BentoCloud](www.bentoml.com) provides compute infrastructure for rapid and reliable GenAI adoption. It helps speed up your BentoML development process leveraging cloud compute resources, and simplify how you deploy, scale and operate BentoML in production.

  [Sign up for BentoCloud](https://cloud.bentoml.com/signup) for personal access; for enterprise use cases, [contact our team](https://www.bentoml.com/contact).

  ```bash

  bentoml cloud login


  bentoml deploy .
  ```

  ![bentocloud-ui](./docs/source/_static/img/bentocloud/get-started/bentocloud-playground-quickstart.png)

  </details>

  For detailed explanations, read [Quickstart](https://docs.bentoml.com/en/latest/get-started/quickstart.html).



  - LLMs: [Llama 3.1](https://github.com/bentoml/BentoVLLM/tree/main/llama3.1-8b-instruct), [Mixtral](https://github.com/bentoml/BentoVLLM/tree/main/mixtral-8x7b-instruct), [Solar](https://github.com/bentoml/BentoVLLM/tree/main/solar-10.7b-instruct), [Mistral](https://github.com/bentoml/BentoVLLM/tree/main/mistral-7b-instruct), and [more](https://github.com/bentoml/BentoVLLM)
  - Image Generation: [Stable Diffusion 3 Medium](https://github.com/bentoml/BentoDiffusion/tree/main/sd3-medium), [Stable Video Diffusion](https://github.com/bentoml/BentoDiffusion/tree/main/svd), [Stable Diffusion XL Turbo](https://github.com/bentoml/BentoDiffusion/tree/main/sdxl-turbo), [ControlNet](https://github.com/bentoml/BentoDiffusion/tree/main/controlnet), [LCM LoRAs](https://github.com/bentoml/BentoDiffusion/tree/main/lcm), and [more](https://github.com/bentoml/BentoDiffusion).
  - Text Embeddings: [SentenceTransformers](https://github.com/bentoml/BentoSentenceTransformers)
  - Audio: [ChatTTS](https://github.com/bentoml/BentoChatTTS), [XTTS](https://github.com/bentoml/BentoXTTS), [WhisperX](https://github.com/bentoml/BentoWhisperX), [Bark](https://github.com/bentoml/BentoBark)
  - Computer Vision: [YOLO](https://github.com/bentoml/BentoYolo)
  - Multimodal: [BLIP](https://github.com/bentoml/BentoBlip), [CLIP](https://github.com/bentoml/BentoClip)
  - RAG: [RAG-as-a-Service with custom models](https://github.com/bentoml/rag-tutorials)

  Check out the [examples](./examples/) folder for more sample code and usage.



  - [Model composition](https://docs.bentoml.com/en/latest/guides/model-composition.html)
  - [Workers and model parallelization](https://docs.bentoml.com/en/latest/guides/workers.html)
  - [Adaptive batching](https://docs.bentoml.com/en/latest/guides/adaptive-batching.html)
  - [GPU inference](https://docs.bentoml.com/en/latest/guides/gpu-inference.html)
  - [Distributed serving systems](https://docs.bentoml.com/en/latest/guides/distributed-services.html)
  - [Concurrency and autoscaling](https://docs.bentoml.com/en/latest/bentocloud/how-tos/autoscaling.html)
  - [Model loading and Model Store](https://docs.bentoml.com/en/latest/guides/model-loading-and-management.html)
  - [Observability](https://docs.bentoml.com/en/latest/guides/observability/index.html)
  - [BentoCloud deployment](https://docs.bentoml.com/en/latest/guides/deployment.html)

  See [Documentation](https://docs.bentoml.com) for more tutorials and guides.



  Get involved and join our [Community Slack 💬](https://l.bentoml.com/join-slack), where thousands of AI/ML engineers help each other, contribute to the project, and talk about building AI products.

  To report a bug or suggest a feature request, use
  [GitHub Issues](https://github.com/bentoml/BentoML/issues/new/choose).



  There are many ways to contribute to the project:

  - Report bugs and "Thumbs up" on [issues](https://github.com/bentoml/BentoML/issues) that are relevant to you.
  - Investigate [issues](https://github.com/bentoml/BentoML/issues) and review other developers' [pull requests](https://github.com/bentoml/BentoML/pulls).
  - Contribute code or [documentation](https://docs.bentoml.com/en/latest/index.html) to the project by submitting a GitHub pull request.
  - Check out the [Contributing Guide](https://github.com/bentoml/BentoML/blob/main/CONTRIBUTING.md) and [Development Guide](https://github.com/bentoml/BentoML/blob/main/DEVELOPMENT.md) to learn more.
  - Share your feedback and discuss roadmap plans in the `#bentoml-contributors` channel [here](https://l.bentoml.com/join-slack).

  Thanks to all of our amazing contributors!

  <a href="https://github.com/bentoml/BentoML/graphs/contributors">
    <img src="https://contrib.rocks/image?repo=bentoml/BentoML" />
  </a>



  The BentoML framework collects anonymous usage data that helps our community improve the product. Only BentoML's internal API calls are being reported. This excludes any sensitive information, such as user code, model data, model names, or stack traces. Here's the [code](https://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/utils/analytics/usage_stats.py) used for usage tracking. You can opt-out of usage tracking by the `--do-not-track` CLI option:

  ```bash
  bentoml [command] --do-not-track
  ```

  Or by setting the environment variable:

  ```bash
  export BENTOML_DO_NOT_TRACK=True
  ```



  [Apache License 2.0](https://github.com/bentoml/BentoML/blob/main/LICENSE)


pkgId: 90fdc67bd540697ec9fd660e962c48ca74952caa6f39c332ca8771462efd349e
name: python-bentoml
arch: src
version: 1.3.15
epoch: 0
release: 1
summary: BentoML: The easiest way to serve AI apps and models
url: https://bentoml.com
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bentoml-1.3.15-1.src.rpm
checksum_type: sha256
description:
  <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://github.com/bentoml/BentoML/assets/489344/d3e6c95d-d224-49a5-9cff-0789f094e127">
      <source media="(prefers-color-scheme: light)" srcset="https://github.com/bentoml/BentoML/assets/489344/de4da660-6aeb-4e5a-bf76-b7177435444d">
      <img alt="BentoML: Unified Model Serving Framework" src="https://github.com/bentoml/BentoML/assets/489344/de4da660-6aeb-4e5a-bf76-b7177435444d" width="370" style="max-width: 100%;">
  </picture>



  🍱 Build model inference APIs and multi-model serving systems with any open-source or custom AI models. 👉 [Join our Slack community!](https://l.bentoml.com/join-slack)

  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202-green.svg)](https://github.com/bentoml/BentoML?tab=Apache-2.0-1-ov-file)
  [![Releases](https://img.shields.io/github/v/release/bentoml/bentoml.svg)](https://github.com/bentoml/bentoml/releases)
  [![CI](https://github.com/bentoml/bentoml/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bentoml/BentoML/actions/workflows/ci.yml?query=branch%3Amain)
  [![Twitter](https://badgen.net/badge/icon/@bentomlai/1DA1F2?icon=twitter&label=Follow)](https://twitter.com/bentomlai)
  [![Community](https://badgen.net/badge/Join/Community/cyan?icon=slack)](https://l.bentoml.com/join-slack)



  BentoML is a Python library for building online serving systems optimized for AI apps and model inference.

  - **🍱 Easily build APIs for Any AI/ML Model.** Turn any model inference script into a REST API server with just a few lines of code and standard Python type hints.
  - **🐳 Docker Containers made simple.** No more dependency hell! Manage your environments, dependencies and model versions with a simple config file. BentoML automatically generates Docker images, ensures reproducibility, and simplifies how you deploy to different environments.
  - **🧭 Maximize CPU/GPU utilization.** Build high performance inference APIs leveraging built-in serving optimization features like dynamic batching, model parallelism, multi-stage pipeline and multi-model inference-graph orchestration.
  - **👩‍💻 Fully customizable.** Easily implement your own APIs or task queues, with custom business logic, model inference and multi-model composition. Supports any ML framework, modality, and inference runtime.
  - **🚀 Ready for Production.** Develop, run and debug locally. Seamlessly deploy to production with Docker containers or [BentoCloud](https://www.bentoml.com/).



  Install BentoML:

  ```

  pip install -U bentoml
  ```

  Define APIs in a `service.py` file.

  ```python
  from __future__ import annotations

  import bentoml

  @bentoml.service(
      resources={"cpu": "4"}
  )
  class Summarization:
      def __init__(self) -> None:
          import torch
          from transformers import pipeline

          device = "cuda" if torch.cuda.is_available() else "cpu"
          self.pipeline = pipeline('summarization', device=device)

      @bentoml.api(batchable=True)
      def summarize(self, texts: list[str]) -> list[str]:
          results = self.pipeline(texts)
          return [item['summary_text'] for item in results]
  ```

  Run the service code locally (serving at http://localhost:3000 by default):

  ```bash
  pip install torch transformers  # additional dependencies for local run

  bentoml serve service.py:Summarization
  ```

  Now you can run inference from your browser at http://localhost:3000 or with a Python script:

  ```python
  import bentoml

  with bentoml.SyncHTTPClient('http://localhost:3000') as client:
      summarized_text: str = client.summarize([bentoml.__doc__])[0]
      print(f"Result: {summarized_text}")
  ```



  To deploy your BentoML Service code, first create a `bentofile.yaml` file to define its dependencies and environments. Find the full list of bentofile options [here](https://docs.bentoml.com/en/latest/guides/build-options.html).

  ```yaml
  service: 'service:Summarization' # Entry service import path
  include:
    - '*.py' # Include all .py files in current directory
  python:
    packages: # Python dependencies to include
      - torch
      - transformers
  docker:
    python_version: "3.11"
  ```

  Then, choose one of the following ways for deployment:

  <details>

  <summary>🐳 Docker Container</summary>

  Run `bentoml build` to package necessary code, models, dependency configs into a Bento - the standardized deployable artifact in BentoML:

  ```bash
  bentoml build
  ```

  Ensure [Docker](https://docs.docker.com/) is running. Generate a Docker container image for deployment:

  ```bash
  bentoml containerize summarization:latest
  ```

  Run the generated image:

  ```bash
  docker run --rm -p 3000:3000 summarization:latest
  ```

  </details>

  <details>

  <summary>☁️ BentoCloud</summary>

  [BentoCloud](www.bentoml.com) provides compute infrastructure for rapid and reliable GenAI adoption. It helps speed up your BentoML development process leveraging cloud compute resources, and simplify how you deploy, scale and operate BentoML in production.

  [Sign up for BentoCloud](https://cloud.bentoml.com/signup) for personal access; for enterprise use cases, [contact our team](https://www.bentoml.com/contact).

  ```bash

  bentoml cloud login


  bentoml deploy .
  ```

  ![bentocloud-ui](./docs/source/_static/img/bentocloud/get-started/bentocloud-playground-quickstart.png)

  </details>

  For detailed explanations, read the [Hello World example](https://docs.bentoml.com/en/latest/get-started/hello-world.html).



  - LLMs: [Llama 3.2](https://github.com/bentoml/BentoVLLM/tree/main/llama3.2-90b-instruct), [Mixtral](https://github.com/bentoml/BentoVLLM/tree/main/mixtral-8x7b-instruct), [Solar](https://github.com/bentoml/BentoVLLM/tree/main/solar-10.7b-instruct), and [Mistral](https://github.com/bentoml/BentoVLLM/tree/main/mistral-7b-instruct).
  - Image Generation: [Stable Diffusion 3 Medium](https://github.com/bentoml/BentoDiffusion/tree/main/sd3-medium), [Stable Video Diffusion](https://github.com/bentoml/BentoDiffusion/tree/main/svd), [Stable Diffusion XL Turbo](https://github.com/bentoml/BentoDiffusion/tree/main/sdxl-turbo), [ControlNet](https://github.com/bentoml/BentoDiffusion/tree/main/controlnet), and [LCM LoRAs](https://github.com/bentoml/BentoDiffusion/tree/main/lcm).
  - Embeddings: [SentenceTransformers](https://github.com/bentoml/BentoSentenceTransformers) and [ColPali](https://github.com/bentoml/BentoColPali)
  - Audio: [ChatTTS](https://github.com/bentoml/BentoChatTTS), [XTTS](https://github.com/bentoml/BentoXTTS), [WhisperX](https://github.com/bentoml/BentoWhisperX), [Bark](https://github.com/bentoml/BentoBark)
  - Computer Vision: [YOLO](https://github.com/bentoml/BentoYolo) and [ResNet](https://github.com/bentoml/BentoResnet)
  - Advanced examples: [Function calling](https://github.com/bentoml/BentoFunctionCalling), [LangGraph](https://github.com/bentoml/BentoLangGraph), [CrewAI](https://github.com/bentoml/BentoCrewAI)

  Check out the [full list](https://docs.bentoml.com/en/latest/examples/overview.html) for more sample code and usage.



  - [Model composition](https://docs.bentoml.com/en/latest/get-started/model-composition.html)
  - [Workers and model parallelization](https://docs.bentoml.com/en/latest/build-with-bentoml/parallelize-requests.html)
  - [Adaptive batching](https://docs.bentoml.com/en/latest/get-started/adaptive-batching.html)
  - [GPU inference](https://docs.bentoml.com/en/latest/build-with-bentoml/gpu-inference.html)
  - [Distributed serving systems](https://docs.bentoml.com/en/latest/build-with-bentoml/distributed-services.html)
  - [Concurrency and autoscaling](https://docs.bentoml.com/en/latest/scale-with-bentocloud/scaling/autoscaling.html)
  - [Model loading and Model Store](https://docs.bentoml.com/en/latest/build-with-bentoml/model-loading-and-management.html)
  - [Observability](https://docs.bentoml.com/en/latest/build-with-bentoml/observability/index.html)
  - [BentoCloud deployment](https://docs.bentoml.com/en/latest/get-started/cloud-deployment.html)

  See [Documentation](https://docs.bentoml.com) for more tutorials and guides.



  Get involved and join our [Community Slack 💬](https://l.bentoml.com/join-slack), where thousands of AI/ML engineers help each other, contribute to the project, and talk about building AI products.

  To report a bug or suggest a feature request, use
  [GitHub Issues](https://github.com/bentoml/BentoML/issues/new/choose).



  There are many ways to contribute to the project:

  - Report bugs and "Thumbs up" on [issues](https://github.com/bentoml/BentoML/issues) that are relevant to you.
  - Investigate [issues](https://github.com/bentoml/BentoML/issues) and review other developers' [pull requests](https://github.com/bentoml/BentoML/pulls).
  - Contribute code or [documentation](https://docs.bentoml.com/en/latest/index.html) to the project by submitting a GitHub pull request.
  - Check out the [Contributing Guide](https://github.com/bentoml/BentoML/blob/main/CONTRIBUTING.md) and [Development Guide](https://github.com/bentoml/BentoML/blob/main/DEVELOPMENT.md) to learn more.
  - Share your feedback and discuss roadmap plans in the `#bentoml-contributors` channel [here](https://l.bentoml.com/join-slack).

  Thanks to all of our amazing contributors!

  <a href="https://github.com/bentoml/BentoML/graphs/contributors">
    <img src="https://contrib.rocks/image?repo=bentoml/BentoML" />
  </a>



  The BentoML framework collects anonymous usage data that helps our community improve the product. Only BentoML's internal API calls are being reported. This excludes any sensitive information, such as user code, model data, model names, or stack traces. Here's the [code](https://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/utils/analytics/usage_stats.py) used for usage tracking. You can opt-out of usage tracking by the `--do-not-track` CLI option:

  ```bash
  bentoml [command] --do-not-track
  ```

  Or by setting the environment variable:

  ```bash
  export BENTOML_DO_NOT_TRACK=True
  ```



  [Apache License 2.0](https://github.com/bentoml/BentoML/blob/main/LICENSE)


pkgId: 15bf70d2b47ba0317e71915c5d7b491ad7e7548f7db4fde5a8b4208372608dc6
name: python-bentoudev.dataclass
arch: src
version: 1.6.0
epoch: 0
release: 1
summary: Yaml to dataclass loader
url: https://github.com/BentouDev/zetsubou.dataclass
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bentoudev.dataclass-1.6.0-1.src.rpm
checksum_type: sha256
description:
  [![CI (on push)](https://github.com/BentouDev/Bentoudev.dataclass/actions/workflows/python-ci.yml/badge.svg)](https://github.com/BentouDev/Bentoudev.dataclass/actions/workflows/python-ci.yml) [![PyPI version](https://badge.fury.io/py/bentoudev.dataclass.svg)](https://badge.fury.io/py/bentoudev.dataclass)

  Yaml to dataclass loader. Validates objects based on type information.

  Supports folowing types:
  - classes marked as dataclass (from ``dataclasses``)
  - int, str, float, list
  - Enum (from ``enum``)
  - Optional, List, Dict, Union (from ``typing``)
  - forward references to not yet known types (see example), including self-referencing


  ```sh
  pip install bentoudev.dataclass
  ```


  Work in progress, for now, check out examples below or browse the source code.



  ```python
  @dataclass
  class Person:
      name: str
      age: int
      money: float

  yaml_content = (
      'name: John\n'
      'age: 30\n'
      'money: 400.50'
  )

  obj = load_yaml_dataclass(Person, 'Person', yaml_content)

  assert obj.name == 'John'
  ```


  If you need to load complex class from a single value (like string), you can use ``@inline_loader`` attribute

  ```python
  import bentoudev.dataclass.yaml_loader
  import bentoudev.dataclass.base

  @dataclass
  @inline_loader(source_type=str, field_name='name')
  class ObjFromStr:
      name: str
      foo: int
      bar: float

  @dataclass
  class Container:
      value: ObjFromStr

  obj = load_yaml_dataclass(Container, 'pretty file name', 'value: ThisIsMyName')

  assert obj.value.name == 'ThisIsMyName'
  ```

  Sometimes you might want to load dataclass that forward references foreign types, from other modules, in form of a string. In order to support such types, loader must be supplied with list of them.
  ```python

  @dataclass
  class MyDataclass:
      foo: Optional['my_namespace.project.model.my_ext_dataclass']

  local_types = base.get_types_from_modules([__name__, 'my_namespace.project.model.my_ext_dataclass'])

  my_obj: MyDataclass = yaml_loader.load_yaml_dataclass(MyDataclass, 'pretty file name', yaml_content, ext_types=local_types)
  ```


  Additionaly to external types, self referencing is also supported

  ```python
  from dataclasses import dataclass
  import bentoudev.dataclass.yaml_loader as yaml_loader

  @dataclass
  class MyDataclass:
      my_string: str
      self_nested: Optional['MyDataclass']
      list_of_sth: List[str]
      user_data: Dict[str, str]

  yaml_content = (
      'my_string: foo\n'
      'self_nested:\n'
      '  my_string: bar\n'
      '  list_of_sth: inline_value\n'
      'list_of_sth:\n'
      '- first\n'
      '- second\n'
      'user_data:\n'
      '  anything: goes'
  )

  my_obj: MyDataclass = yaml_loader.load_yaml_dataclass(MyDataclass, 'pretty file name', yaml_content)
  ```

  Additional information about source from which obj/field was loaded can be enabled by using ``@track_source`` attribute, or setting ``always_track_source`` parameter to True (disabled by default, but recomended). Such information is then used to print prettier errors in ``DataclassLoadError``.

  ```python
  class EKind(Enum):
      FIRST = 1
      SECOND = 2

  @dataclass
  class SomeClass:
      kind: EKind

  try:
      obj =  yaml_loader.load_yaml_dataclass(SomeClass, '[SomeClass] my_file.yml', 'kind: THIRD', always_track_source=True)
  except DataclassLoadError as err:
      print(err)
  ```
  Outputs:
  ```
  error: Got 'THIRD' when expecting enum 'EKind' with one of values: FIRST, SECOND
  in "[SomeClass] my_file.yml", line 1, column 1:
  kind: THIRD
  ^ (line: 1)
  ```

  If you desire to retrieve this information and print error yourself, access it's ``source`` field in error, or use injected methods ``get_root_source`` or ``get_field_source``.
  ```python
  try:
      obj =  yaml_loader.load_yaml_dataclass(SomeClass, 'broken_file.yml', broken_yaml_content, always_track_source=True)
      field_src = obj.get_field_source('my_field_name')
      print(f"Value location line '{field_src.line_number}', column '{field_src.column_number}'")
  except DataclassLoadError as err:
      print(f"Error location line '{err.source.line_number}', column '{err.source.column_number}'")
  ```

  Additionaly, you can control how many lines are loaded for code snippet and in which format line numbers are presented via ``error_code_snippet_lines`` and ``error_format`` (Pretty or MSVC compatible).


pkgId: d4167b395f352760253cf5e0122ea30b9451c156e1d7f5ad78ec63704e9041e9
name: python-bentoutils
arch: src
version: 1.1.2
epoch: 0
release: 1
summary: Utilities for working with BentoML V1.x
url: https://github.com/markmo/bentoutils
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bentoutils-1.1.2-1.src.rpm
checksum_type: sha256
description:
  Console scripts for:

  1. bentopack - package an existing pretrained model and save to the Model Registry

  ```
  Usage: bentopack [OPTIONS]

  Options:
    --module TEXT  fully qualified module name containing service to package
    --clz TEXT     class name of service to package
    --name TEXT    model name
    --path TEXT    directory path of pretrained model
    --help         Show this message and exit.
  ```

  Example:
  ```
  bentopack \
      --module TopicBentoService \        # python module containing service class
      --clz TopicBentoService \           # service class
      --name tm_train3_roberta_l_weigh \  # pretrained model name
      --path /srv/models/multilabel-topic # local path to pretrained model (excluding name)
  ```

  2. deploy_to_knative - WIP


  Uses Kaniko

  kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster.

  kaniko solves two problems with using the Docker-in-Docker build method:

  * Docker-in-Docker requires privileged mode to function, which is a significant security concern.
  * Docker-in-Docker generally incurs a performance penalty and can be quite slow.

  The setting `--isdockerconfig` is required when using a private registry such as Harbor.

  We can build a Docker image with kaniko and push it to Docker Hub or any other standard Docker registry.

  To push to DockerHub or any other username and password Docker registries we need to mount the Docker config.json file that contains the credentials. Caching will not work for DockerHub as it does not support repositories with more than 2 path sections (acme/myimage/cache), but it will work in Artifactory and maybe other registry implementations.

      DOCKER_USERNAME=[...]
      DOCKER_PASSWORD=[...]
      AUTH=$(echo -n "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" | base64)
      cat << EOF > config.json
      {
          "auths": {
              "https://index.docker.io/v1/": {
                  "auth": "${AUTH}"
              }
          }
      }
      EOF

  Alternatively, to create a secret to authenticate to Google Cloud Registry, follow these steps:

  1. Create a service account in the Google Cloud Console project you want to push the final image to with Storage Admin permissions.
  2. Download a JSON key for this service account
  3. Rename the key to kaniko-secret.json
  4. To create the secret, run:

      kubectl create secret generic kaniko-secret --from-file=<path to kaniko-secret.json>

  Note: If using a GCS bucket in the same GCP project as a build context, this service account should now also have permissions to read from that bucket.

  See https://github.com/GoogleContainerTools/kaniko


pkgId: 559773e109384167fdd09e047127deddda1ec08d66add3e5ae868153c32e1027
name: python-benzinga
arch: src
version: 1.21
epoch: 0
release: 1
summary: Python Client Library for Benzinga Data
url: https://github.com/Benzinga/benzinga-python-client
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-benzinga-1.21-1.src.rpm
checksum_type: sha256
description:
  ![alt text](https://raw.githubusercontent.com/Benzinga/benzinga-python-client/master/logo/Benzinga_Logo-navy.png)



  This is the the official documentation for Benzinga's Python Package. This package
  Is compatible with Python v3.x+. For extensive instructions, visit [Benzinga Docs](https://docs.benzinga.io/benzinga-python/)



  The installation process varies depending on your python version and system used.
  The basic installation instructions are as follows:

  ```shell
  pip install benzinga
  ```

  Alternatively, the package can be installed by using:

  ```shell
  pip3 install benzinga
  ```

  Once you have successfully installed the package, you can either import the
  Financial Data module, for quantitative financial data:
  ```python
  from benzinga import financial_data
  ```
  or you can import the Benzinga News Data module, if you're looking into financial news:
  ```python
  from benzinga import news_data
  ```



  **Api Key** To initiate a class, an API key is used, for
  authentication purposes. [Contact us](https://cloud.benzinga.com/lets-talk/) if you don't yet have a key, we will take care of you!

  *Sample API Key (type: str) : "testkey892834789s9s8abshtuy"*



  **Log=True** by default. Purpose of logging is to determine when the call was made *(2020-10-21 08:02.29)* and get the
  status of API call within the console *(Status Code: 200)*

  *Log (type: bool)*



  1. Initiating the class:

  ```python
  from benzinga import financial_data
  api_key = "testkey892834789s9s8abshtuy"
  fin = financial_data.Benzinga(api_key)



  fin = financial_data.Benzinga(api_key, log=False)
  ```

  2. A sample test run to get ratings on a stock. (Returns a JSON object):

  ```python
  stock_ratings = fin.ratings()
  ```

  3. Since `fin.ratings()` returns a JSON dict, for a better view of the dict,
  you can call the `fin.output()` method on the result. Example:

  ```python
  fin.output(stock_ratings)
  ```



  1. Initiating the class:

  ```python
  from benzinga import news_data
  api_key = "testkey892834789s9s8abshtuy"
  paper = news_data.News(api_key)
  ```

  2. A sample test run to get general news. (Returns a JSON Object)

  ```python
  stories = paper.news()
  ```

  3. Since `fin.news()` returns a JSON dict, for a better view of the dict,
  you can call the `fin.output()` method on the result. Example:

  ```python
  paper.output(stories)
  ```

  It is important to note that for both the Financial Data Module and the News Data Module, there are many **optional** parameters for the methods. Below is a detailed listing of possible methods for the Financial Data Module and the news Data Module, their method call names, arguments, and what they return.

  For more Financial Data and News Data methods, please visit Benzinga Cloud.



  * Benzinga News: https://www.benzinga.com/
  * Benzinga Pro: https://pro.benzinga.com/


pkgId: aaf7df9339849753ace4907aa0e09376cdf359d3df08d4b20b54c32d50f0da33
name: python-beobench
arch: src
version: 0.5.4
epoch: 0
release: 1
url: https://pypi.org/project/beobench/
rpm_license: MIT license
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-beobench-0.5.4-1.src.rpm
checksum_type: sha256
summary:
  Beobench is a toolkit providing easy and unified access to building control environments for reinforcement learning (RL).


pkgId: bcecdebd0764f09c900c6d9692a24ad850bd211c817d7affaa8cd788e0ddc2b0
name: python-bepatient
arch: src
version: 0.12.0
epoch: 0
release: 1
summary: A library facilitating work with asynchronous APIs
url: https://webludus.pl/en
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bepatient-0.12.0-1.src.rpm
checksum_type: sha256
description:
  [![Tests](https://github.com/dawid-szaniawski/bepatient/actions/workflows/tox.yml/badge.svg)](https://github.com/dawid-szaniawski/bepatient/actions/workflows/tox.yml)
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bepatient)](https://pypi.org/project/bepatient/)
  [![PyPI](https://img.shields.io/pypi/v/bepatient)](https://pypi.org/project/bepatient/)
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/dawid-szaniawski/bepatient/blob/master/LICENSE)
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
  [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
  [![codecov](https://codecov.io/github/dawid-szaniawski/bepatient/branch/master/graph/badge.svg?token=hY7Nb5jGgi)](https://codecov.io/github/dawid-szaniawski/bepatient)
  [![CodeFactor](https://www.codefactor.io/repository/github/dawid-szaniawski/bepatient/badge)](https://www.codefactor.io/repository/github/dawid-szaniawski/bepatient)



  _bepatient_ is a library aimed at facilitating work with asynchronous applications. It
  allows for the repeated execution of specific actions until the desired effect is
  achieved.



  - Set up and monitor requests for expected values.
  - Flexible comparison using various checkers and comparers.
  - Configure multiple conditions to be met by response.
  - Inspect various aspects of the response (body, status code, headers).
  - Detailed logs, facilitating the analysis of the test process.
  - Retry mechanism with customizable retries and delay.



  To install _bepatient_, you can use pip:

  ```bash
  pip install bepatient
  ```

  _bepatient_ supports Python 3.10+



  Using RequestsWaiter object:

  ```python
  from requests import get

  from bepatient import RequestsWaiter

  waiter = RequestsWaiter(request=get("https://example.com/api"))
  waiter.add_checker(comparer="contain", expected_value="string")
  waiter.run()

  response = waiter.get_result()

  assert response.status_code == 200
  ```

  Simple way:

  ```python
  from requests import get

  from bepatient import wait_for_value_in_request

  response = wait_for_value_in_request(
      request=get("https://example.com/api"),
      comparer="contain",
      expected_value="string"
  )
  assert response.status_code == 200
  ```

  If we need add more than one checker:

  ```python
  from requests import get

  from bepatient import wait_for_values_in_request

  list_of_checkers = [
      {
          "checker": "json_checker",
          "comparer": "contain",
          "expected_value": "string"
      },
      {
          "checker": "headers_checker",
          "comparer": "is_equal",
          "expected_value": "cloudflare",
          "dict_path": "Server",
      },
  ]
  response = wait_for_values_in_request(
      request=get("https://example.com/api"),
      checkers=list_of_checkers,
      retries=5,
  )
  assert response.status_code == 200
  ```



  MIT License

  Copyright (c) 2023-2024 Dawid Szaniawski

  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:

  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.

  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  SOFTWARE.

rpm_license:
  MIT License  Copyright (c) 2023 Dawid Szaniawski  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


pkgId: d8f8fceeb96c1f2647d9ba1a2e905870a098afe67e5373fbd42027d27a45546d
name: python-beproduct
arch: src
version: 0.6.18
epoch: 0
release: 1
summary: BeProduct Public API SDK
url: https://github.com/BeProduct/BeProduct.Python.SDK
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-beproduct-0.6.18-1.src.rpm
checksum_type: sha256
description:
  Install:
  `pip install --upgrade beproduct`

  Use:
  ```python
  from beproduct.sdk import BeProduct

  client = BeProduct(client_id='YOUR_CLIENT_ID',
                     client_secret='YOUR_CLIENT_SECRET',
                     refresh_token='YOUR_REFRESH_TOKEN',
                     company_domain='YOUR_COMPANY_DOMAIN')

  style = client.style.attributes_get(header_id='e81d3be5-f5c2-450f-888e-8a854dfc2824')
  print(style)
  ```


pkgId: 7e3e457f24309644917208b72aebfe823ea3e7a475eeb3030e0a641a27084f63
name: python-ber-tlv
arch: src
version: 0.0.6
epoch: 0
release: 1
summary: A EMV BER-TLV encoding/decoding package
url: https://github.com/toumilov/python-ber-tlv
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ber-tlv-0.0.6-1.src.rpm
checksum_type: sha256
description:
  This is a BER-TLV (described in EMV Book 3) format encoder/decoder library for Python.
  BER is Basic Encoding Rules.
  TLV stands for Tag + Length + Value.
  Tag is 1-4 byte long (integer) identifier.
  Length is 1-4 byte integer representing value (or entire branch) size.
  Value is binary data, which can also be a nested list of sub-items.
  BER-TLV is a binary data storage tree, which is widely used in electonic payment industry and in EMV in particular.


  pip3 install ber-tlv


  Parse TLV:
  ```
  >>> from ber_tlv.tlv import *
  >>> Tlv.parse(binascii.unhexlify("7F100DF303414243F4038A0135100100"))
  [(32528, [(243, b'ABC'), (244, [(138, b'5')]), (16, b'\x00')])]
  ```
  Build TLV:
  ```
  >>> from ber_tlv.tlv import *
  >>> Tlv.build({0x9F10:[(0x8A,b"ABC"),(0x8B,{0x10:b"\xf0\x0d"})]})
  b'\x9f\x10\x0b\x8a\x03ABC\x8b\x04\x10\x02\xf0\r'
  ```
  Convert HEX bytes to string:
  ```
  >>> from ber_tlv.tlv import *
  >>> Tlv.hexify_bytes(b"\x01\x23\x45\x67\x89\xab\xcd\xef")
  '0123456789ABCDEF'
  ```
  Tag class checking:
  ```
  >>> from ber_tlv.tlv import *
  >>> Tag.isConstructed(0x7f10)
  True
  >>> Tag.tagClass(0x1f10) == Tag.UNIVERSAL
  True
  >>> Tag.tagClass(0x7f10) == Tag.APPLICATION
  True
  >>> Tag.tagClass(0x9f10) == Tag.CONTEXT_SPECIFIC
  True
  >>> Tag.tagClass(0xdf10) == Tag.PRIVATE
  True
  ```



  Below is a brief technical description of BER-TLV format.

  Tag has variable size of 1-4 bytes.
  If first tag byte, bits 1-5 are set to 1, there are more tag bytes follow. In subsequent bytes, bit 8 indicates if this is a last byte. Other bits identify unique tag number.

  Length field has variable size of 1-4 bytes.
  When bit b8 of the most significant byte of the length field is set to 0, the length field consists of only one byte. Bits b7 to b1 code the number of bytes of the value field. The length field is within the range 1 to 127.When bit b8 of the most significant byte of the length field is set to 1, the subsequent bits b7 to b1 of the most significant byte code the number of subsequent bytes in the length field. The subsequent bytes code an integer representing the number of bytes in the value field.

  Value is binary bytes array of specified length. Value may represent recursive sub-tree (branch).

  Before, between, or after TLV-coded data objects, zero bytes without any meaning may occur (for example, due to erased or modified TLV-coded data objects).


pkgId: 1d98a04312fe19cbb1f4a98d47d9db8f3959f12e307c2d600cadd71444ffedec
name: python-berbix
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: SDK for Berbix integrations
url: https://github.com/berbix/berbix-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-berbix-1.0.0-1.src.rpm
checksum_type: sha256
description:
  This Berbix Python library provides simple interfaces to interact with the Berbix API.



      pip install berbix





      import berbix

      client = berbix.Client(
        api_secret='your_api_secret_here')



      transaction_tokens = client.create_transaction(
        customer_uid="interal_customer_uid", # ID for the user in internal database
        template_key="your_template_key", # Template key for this transaction
      )



      refresh_token = '' # fetched from database
      transaction_tokens = Tokens.from_refresh(refresh_token)



      transaction_data = client.fetch_transaction(transaction_tokens)









  Supported options:

  - `api_secret` (required) - The API secret that can be found in your Berbix Dashboard.
  - `http_client` - An optional override for the default HTTP client.



  Creates a transaction within Berbix to initialize the client SDK. Typically after creating
  a transaction, you will want to store the refresh token in your database associated with the
  currently active user session.

  Supported options:

  - `email` - Previously verified email address for a user.
  - `phone` - Previously verified phone number for a user.
  - `customer_uid` - An ID or identifier for the user in your system.
  - `template_key` - The template key for this transaction.
  - Deprecated: `hosted_options` - Optional configuration object for creating hosted transactions. The `hosted_options` object can optionally include the following fields:
    - `completion_email` - Email address to which completion alerts will be sent for this transaction.
    - `redirect_url` - URL to redirect the user to after they complete the transaction. If not specified, the URL specified in the Berbix dashboard will be used instead.



  Creates a hosted transaction within Berbix to initialize the client SDK. This works the same as create_transaction except `hosted_options` is a valid parameter and that it returns an explicit `hosted_url` for hosted transactions.

  Supported options:

  - `email` - Previously verified email address for a user.
  - `phone` - Previously verified phone number for a user.
  - `customer_uid` - An ID or identifier for the user in your system.
  - `template_key` - The template key for this transaction.
  - `hosted_options` - Optional configuration object for creating hosted transactions. The `hosted_options` object can optionally include the following fields:
    - `completion_email` - Email address to which completion alerts will be sent for this transaction.
    - `redirect_url` - URL to redirect the user to after they complete the transaction. If not specified, the URL specified in the Berbix dashboard will be used instead.



  Fetches all of the information associated with the transaction. If the user has already completed the steps of the transaction, then this will include all of the elements of the transaction payload as described on the [Berbix developer docs](https://developers.berbix.com).



  This is typically not needed to be called explicitly as it will be called by the higher-level
  SDK methods, but can be used to get fresh client or access tokens.



  This method validates that the content of the webhook has not been forged. This should be called for every endpoint that is configured to receive a webhook from Berbix.

  Parameters:

  - `secret` - This is the secret associated with that webhook. NOTE: This is distinct from the API secret and can be found on the webhook configuration page of the dashboard.
  - `body` - The full request body from the webhook. This should take the raw request body prior to parsing.
  - `header` - The value in the 'X-Berbix-Signature' header.



  Permanently deletes all submitted data associated with the transaction corresponding to the tokens provided.



  Changes a transaction's "action", for example upon review in your systems. Returns the updated transaction upon success.

  Parameters:

  - `action: string` - A string describing the action taken on the transaction. Typically this will either be "accept" or "reject".
  - `note: string` - A string containing an optional note explaining the action taken.



  Completes a previously created transaction, and overrides its return payload and flags to match the provided parameters.

  Parameters:

  - `response_payload: string` - A string describing the payload type to return when fetching transaction metadata, e.g. "us-dl". See [our testing guide](https://docs.berbix.com/docs/testing) for possible options.
  - `flags: string[]` - An optional list of flags to associate with the transaction (independent of the payload's contents), e.g. ["id_under_18", "id_under_21"]. See [our flags documentation](https://docs.berbix.com/docs/id-flags) for a list of flags.
  - `override_fields: { string: string }` - An optional mapping from a [transaction field](https://docs.berbix.com/reference#gettransactionmetadata) to the desired override value, e.g. `override_fields={"date_of_birth": "2000-12-09"}}`







  This is the short-lived bearer token that the backend SDK uses to identify requests associated with a given transaction. This is not typically needed when using the higher-level SDK methods.



  This is the short-lived token that the frontend SDK uses to identify requests associated with a given transaction. After transaction creation, this will typically be sent to a frontend SDK.



  This is the long-lived token that allows you to create new tokens after the short-lived tokens have expired. This is typically stored in the database associated with the given user session.



  The internal Berbix ID number associated with the transaction.



  The time at which the access and client tokens will expire.



  The raw response object. This may include some non-token related fields.



  This is a member of the response object. Represents the hosted transaction URL. This value will only be set when creating a transaction if the `hosted_options` field is set.





  Creates a tokens object from a refresh token, which can be passed to higher-level SDK methods. The SDK will handle refreshing the tokens for accessing relevant data.







  This is the tokens object for future SDK calls.



  This is a member of the response object. Represents the hosted transaction URL.



      To release a new version of the SDK, first bump the version in `setup.py`.

      python setup.py sdist bdist_wheel
      twine upload dist/*


pkgId: 7400f51ba0d1929b2f31e6288e913072bf1439a0b59eabcec947b9efcddb92eb
name: python-berconpy
arch: src
version: 2.1.4
epoch: 0
release: 1
summary: An async wrapper for the BattlEye RCON protocol
url: https://github.com/thegamecracks/berconpy
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-berconpy-2.1.4-1.src.rpm
checksum_type: sha256
description:
  [![PyPI](https://img.shields.io/pypi/v/berconpy?label=View%20on%20pypi&style=flat-square)](https://pypi.org/project/berconpy/)
  [![Docs](https://readthedocs.org/projects/berconpy/badge/?style=flat-square)](http://berconpy.readthedocs.io/)

  An asynchronous Python wrapper over the
  [BattlEye RCON protocol][1].



  - Easy to use event-based interface
  - Automatic network loss recovery
  - Included extension for using Arma-related commands



  ```py
  import asyncio
  import berconpy

  client = berconpy.AsyncRCONClient()

  IP = "XXX.XXX.XXX.XXX"
  PORT = 9999
  PASSWORD = "ASCII_PASSWORD"

  @client.dispatch.on_login
  async def on_login():
      print("We have logged in!")

  async def main():
      async with client.connect(IP, PORT, PASSWORD):
          players = await client.send_command("players")
          print(players)

  asyncio.run(main())
  ```

  See the [documentation][2] for more details.



  (**Python 3.10** or higher is required)

  This package can be installed from PyPi using the following command:

  ```

  python3 -m pip install berconpy


  py -m pip install berconpy
  ```

  If you want to install the development version instead, and you have git installed:

  ```
  pip install git+https://github.com/thegamecracks/berconpy
  ```



  - [BattlEye RCON protocol specification][1]
  - [BattlEye RCON commands](https://www.battleye.com/support/documentation/)
  - [Arma server commands](https://community.bistudio.com/wiki/Multiplayer_Server_Commands)



  This project uses the [MIT][3] License.

  [1]: https://github.com/thegamecracks/berconpy/blob/main/docs/source/BERConProtocol.txt
  [2]: http://berconpy.readthedocs.io/
  [3]: https://github.com/thegamecracks/berconpy/blob/main/LICENSE


pkgId: feecf782711a9f8d031fce7c241dfc564e7a07319c55be8c648d7f0a0495d1d0
name: python-beren
arch: src
version: 0.7.1
epoch: 0
release: 1
summary: REST client for Orthanc DICOM servers
url: https://github.com/teffalump/beren
rpm_license: GNU General Public License v3 or later (GPLv3+)
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-beren-0.7.1-1.src.rpm
checksum_type: sha256
description:
  [![PyPI version](https://badge.fury.io/py/beren.svg)](https://badge.fury.io/py/beren)

  `beren` provides a REST client for [Orthanc](https://www.orthanc-server.com), an open-source DICOM server.

  Built using the excellent [apiron](https://github.com/ithaka/apiron) library.



  Use pip:

      pip install beren



  Import the client and provide the server details

      from beren import Orthanc
      orthanc = Orthanc('https://example-orthanc-server.com')

      
      orthanc.get_patients()
      orthanc.get_patient(id)
      ...and so on

      
      orthanc.get_studies()
      orthanc.get_study(id)
      ...and so on

      
      orthanc.get_series()
      orthanc.get_one_series(id)
      ...and so on

      
      orthanc.get_instances()
      orthanc.get_instance(id)
      ...and so on

      
      orthanc.get_changes()

      
      query = {'PatientName': 'Jon*'}
      orthanc.find(query, level='Patient', expand=False, limit=2)

      
      orthanc.get_queries()

  There are many other preconfigured endpoints.



  Many servers require authentication to utilize their API. Simply provide a valid authentication object when defining the client:

      from requests.auth import HTTPBasicAuth
      auth = HTTPBasicAuth('orthanc', 'orthanc')
      orthanc = Orthanc('https://test.server.com', auth=auth)

  To override the default authentication, provide a new authentication object when calling the endpoint:

      new_auth = HTTPBasicAuth('new_user', 'new_password')
      orthanc.get_patients(auth=auth)





  Some servers are slow (and some methods can be slow). For example, asking for all instances from a server can cause a timeout before the server responds. To
  modify the timeout settings, use `apiron`'s `Timeout` class:

      from apiron import Timeout
      t = Timeout(read_timeout=6, connection_timeout=1)   # Modify the timeout

      from beren import Orthanc
      orthanc = Orthanc('https://example-orthanc-server.com')
      orthanc.get_instances(timeout_spec=t)               # Use new timeout

  Increase the read timeout if the endpoint is slow. Increase the connection timeout for slow servers.



  To disable TLS certificate checking, use sessions:

      import requests
      session = requests.sessions.Session()       # New session
      session.verify = False                      # Disable certificate checking

      from beren import Orthanc
      orthanc = Orthanc('https://example-orthanc-server.com')
      orthanc.get_patients(session=session)       # Use session



  The client will warn when using HTTP endpoints. Medical data is particularly sensitive, consequently, strongly consider using HTTPS.

  You can disable the warning using the `warn_insecure` argument:

      from beren import Orthanc
      orthanc = Orthanc('http://insecure.endpoint.com', warn_insecure=False)



  To save an instance file to the local directory:

      from beren import Orthanc
      orthanc = Orthanc('https://example-orthanc-server.com')

      with open('test_file.dcm', 'wb') as dcm:
          for chunk in orthanc.get_instance_file(<instance_id>):
              dcm.write(chunk)

  To get an archive of a series (DCM files in a zip file):

      from beren import Orthanc
      orthanc = Orthanc('https://example-orthanc-server.com')

      with open('test.zip', 'wb') as z:
          for chunk in orthanc.get_series_archive(<instance_id>):
              z.write(chunk)



  - [apiron](https://github.com/ithaka/apiron)
  - [Orthanc documentation](https://book.orthanc-server.com)
  - [Orthanc OpenAPI](https://api.orthanc-server.com)
  - [Orthanc REST API spreadsheet](https://docs.google.com/spreadsheets/d/1muKHMIb9Br-59wfaQbDeLzAfKYsoWfDSXSmyt6P4EM8/pubhtml#)



  - Asynchronous requests
  - Document every function
  - Better test coverage


pkgId: c6c1b3a4b8ac00e4eafd1b2ea7c89c347ca39c053a4156d96ccd2bcb407c9343
name: python-bericht
arch: src
version: 0.1.6
epoch: 0
release: 1
summary: HTML to PDF streaming
url: https://github.com/systori/bericht
rpm_license: BSD
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bericht-0.1.6-1.src.rpm
checksum_type: sha256
description:
  Incremental HTML to PDF converter with support for extremely large documents. Bericht does not
  hold the HTML or the PDF in memory as it generates PDF pages; instead, it requires you to pass a
  generator which produces HTML snippets and **bericht** gives you a PDF stream iterator. As you iterate
  the PDF stream **bericht** will parse just enough HTML to produce a single page and return one page
  at a time which you can either write to a file, send over http or do whatever you need.
  Main features:
  - Quickly and efficiently generate on-demand PDFs from databases or other data sources.
  - Use familiar HTML and CSS to define your PDF layout.
  - Re-use the same code to produce HTML and PDF based reports for your users.
  - Ability to generate extremely large PDF files without storing any of the parts (input or output) in memory.
  - Many CSS extensions specifically for print/page related formatting:
    - ``@page:nth-child(an+b)``: at-rule to target/style individual pages (non-standard CSS).
    - ``@page { letterhead-page: 1; }``: ability to apply specific pages from another PDF as a
      watermark/letterhead in your newly generated PDF (the other PDF must be passed as argument
      to **bericht** generator to be able to extract pages from it using ``letterhead-page`` CSS attribute).
    - ``thead:nth-child(an+b)`` and ``tfoot:nth-child(an+b)``: **bericht** can repeat table headers/footers
      on subsequent pages when the table does not fit on one page, this rule allows you to style those
      rows differently depending on what page they are on (non-standard CSS).


pkgId: 83a0f31048d48c3facb3f9e09ad50cf238dde2cb576d29cf50611ef38e5ec249
name: python-bernhard
arch: src
version: 0.2.6
epoch: 0
release: 1
summary: Python client for Riemann
url: http://github.com/banjiewen/bernhard.git
rpm_license: ASF2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bernhard-0.2.6-1.src.rpm
checksum_type: sha256
description:
  A simple Python client for [Riemann](http://github.com/aphyr/riemann). Usage:

  ```python
  import bernhard

  c = bernhard.Client()
  c.send({'host': 'myhost.foobar.com', 'service': 'myservice', 'metric': 12})
  q = c.query('true')
  ```

  Bernhard supports custom attributes with the syntax:
  ```python
  import bernhard

  c = bernhard.Client()

  c.send({'host': 'awesome.host.com', 'attributes': {'sky': 'sunny', 'sea': 'agitated'}})
  ```

  Querying the index is as easy as:
  ```python
  import bernhard

  c = bernhard.Client()
  q = c.query('true')
  for e in q:
      print "Host:", e.host, "State:", e.state
  ```




  ```bash
  pip install bernhard
  ```

  You may encounter issues with the `protobuf` dependency; if so, just run `pip
  install protobuf` manually, then `pip install bernhard`.


pkgId: 203fcc9bc63152eda6098e9550e3b29b1377e6fc797110fe1ca16d74e9a06394
name: python-berrydb
arch: src
version: 1.2.1
epoch: 0
release: 1
summary: The database for unstructured data and AI apps
url: https://berrydb.io
rpm_license: Proprietary
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-berrydb-1.2.1-1.src.rpm
checksum_type: sha256
description:
  - [Getting Started](https://berrydb.io/blog/getting-started)
  - [Why BerryDB?](https://berrydb.io/blog/why-berrydb)
  - [Documentation](https://docs.berrydb.io/python-sdk/)


pkgId: 6c3cd31bbd2c2dbe44085290ec8ac566ee3047e15ebcf20d111046afb5aa0dc3
name: python-berserk
arch: src
version: 0.13.2
epoch: 0
release: 1
summary: Python client for the lichess API
url: https://github.com/lichess-org/berserk
rpm_license: GPL-3.0-or-later
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-berserk-0.13.2-1.src.rpm
checksum_type: sha256
description:
  Python client for the `Lichess API <https://lichess.org/api>`_.
  This is based on the `original berserk version created by rhgrant10 <https://github.com/rhgrant10/berserk>`_ and the `berserk-downstream fork created by ZackClements <https://github.com/ZackClements/berserk>`_. Big thanks to them and all other contributors!
  `Documentation <https://lichess-org.github.io/berserk/>`_


pkgId: 14cdd9495fffcc9bf408a931c6f15f989014d127fabd691ba5fc97ae71b2172d
name: python-bert-classifier
arch: src
version: 0.1.18
epoch: 0
release: 1
summary: Transformers based NLP classification models
url: https://github.com/minggnim/nlp-classification-model
rpm_license: GNU General Public License v3 (GPLv3)
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bert-classifier-0.1.18-1.src.rpm
checksum_type: sha256
description:
  [![Dependency Review](https://github.com/minggnim/nlp-classification-model/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/minggnim/nlp-classification-model/actions/workflows/dependency-review.yml)
  [![Python package](https://github.com/minggnim/nlp-classification-model/actions/workflows/python-package.yml/badge.svg)](https://github.com/minggnim/nlp-classification-model/actions/workflows/python-package.yml)
  [![Upload Python Package](https://github.com/minggnim/nlp-classification-model/actions/workflows/python-publish.yml/badge.svg)](https://github.com/minggnim/nlp-classification-model/actions/workflows/python-publish.yml)



  A repository for training deep learning classification models




  1. [Training](https://github.com/minggnim/nlp-classification-model/blob/master/notebooks/01_custom_training_example.ipynb)

  2. [Inference](https://github.com/minggnim/nlp-classification-model/blob/master/notebooks/02_inference_example.ipynb)





  ```
  pip install bert_classifier
  ```


  ```
  git clone git@github.com:minggnim/bert-classifier.git
  pip install -r requirements
  ```


pkgId: f8aa675df494b0c31bb36263091ea0817c47c29d885533d8158c3cc4bcaa1dd4
name: python-bert-etl
arch: src
version: 0.4.77
epoch: 0
release: 1
summary: A microframework for simple ETL solutions
url: https://github.com/jbcurtin/bert
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bert-etl-0.4.77-1.src.rpm
checksum_type: sha256
description:
  [![Documentation Status](https://readthedocs.org/projects/bert-etl/badge/?version=latest)](https://bert-etl.readthedocs.io/en/latest/?badge=latest)


  A microframework for simple ETL solutions.




  At its core, `bert-etl` uses Dynamodb Streams to communicate between lambda functions. `bert-etl.yaml` provides control on how the initial lambda function is called, either by periodic events, sns topics, or s3 bucket (planned)events. Passing an event to `bert-etl` is straight forward from `zappa` or a generic AWS lambda function you've hooked up to API Gateway.

  At this moment in time, there are no plans to attach API Gateway to `bert-etl.yaml` because there is already great software(like `zappa`) that does this.



  `bert-etl` ships with a deploy target to `aws-lambda`. This feature isn't very well documented yet, and has quite a bit of work to de done so it may function more consistently. Be aware that `aws-lambda` is a product ran and controlled by AWS. If you incure charges using `bert-etl` while utilizing `aws-lambda`, you may not consider us responsible. `bert-etl` is offered under `MIT` license which includes a `Use at your own risk` clause.



  Lets begin with an example of loading data from a file-server and than loading it into numpy arrays

  ```
  $ virtualenv -p $(which python3) env
  $ source env/bin/activate
  $ pip install bert-etl
  $ pip install librosa # for demo project
  $ docker run -p 6379:6379 -d redis # bert-etl runs on redis to share data across CPUs
  $ bert-runner.py -n demo
  $ PYTHONPATH='.' bert-runner.py -m demo -j sync_sounds -f
  ```





  * Added Error Management. When an error occurs, bert-runner will log the error and re-run the job. If the same error happens often enough, the job will be aborted



  * Added Release Notes



  * Added Redis Service auto run. Using docker, redis will be pulled and started in the background
  * Added Redis Service channels, sometimes you'll want to run to etl-jobs on the same machine



  Bert provides a boiler plate framework that'll allow one to write concurrent ETL code using Pythons' `microprocessing` module. One function starts the process, piping data into a Redis backend that'll then be consumed by the next function. The queues are respectfully named for the scope of the function: Work(start) and Done(end) queue. Please consider contributing to Bert Bounty Targets to improve this documentation

  https://www.patreon.com/jbcurtin




  * Create configuration file, `bert-etl.yaml`
  * Support conda venv
  * Support pyenv venv
  * Support dynamodb flush
  * Support multipule invocations per AWS account
  * Support undeploy AWS Lambda
  * Support Bottle functions in AWS Lambda




  * Introduce Bert API
  * Explain `bert.binding`
  * Explain `comm_binder`
  * Explain `work_queue`
  * Explain `done_queue`
  * Explain `ologger`
  * Explain `DEBUG` and how turning it off allows for x-concurrent processes
  * Show an example on how to load timeseries data, calcualte the mean, and display the final output of the mean
  * Expand the example to show how to scale the application implicitly
  * Show how to run locally using Redis
  * Show how to run locally without Redis, using Dynamodb instead
  * Show how to run remotly using AWSLambda and Dynamodb
  * Talk about dynamodb and eventual consistency


pkgId: a9de478c750668e5d92dfc88529be75bcab118adf4cc3666f346546ef88eafed
name: python-bert-extractive-summarizer
arch: src
version: 0.10.1
epoch: 0
release: 1
summary: Extractive Text Summarization with BERT
url: https://github.com/dmmiller612/bert-extractive-summarizer
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bert-extractive-summarizer-0.10.1-1.src.rpm
checksum_type: sha256
description:
  ![Build Status](https://github.com/dmmiller612/bert-extractive-summarizer/actions/workflows/test.yml/badge.svg)
  [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/dmmiller612/bert-extractive-summarizer)
  <img src="https://img.shields.io/pypi/v/bert-extractive-summarizer.svg" />

  This repo is the generalization of the lecture-summarizer repo. This tool utilizes the HuggingFace Pytorch transformers library
  to run extractive summarizations. This works by first embedding the sentences, then running a clustering algorithm, finding
  the sentences that are closest to the cluster's centroids. This library also uses coreference techniques, utilizing the
  https://github.com/huggingface/neuralcoref library to resolve words in summaries that need more context. The greedyness of
  the neuralcoref library can be tweaked in the CoreferenceHandler class.

  As of the most recent version of bert-extractive-summarizer, by default, CUDA is used if a gpu is available.

  Paper: https://arxiv.org/abs/1906.04165



  [Distill Bert Summarization Demo](https://smrzr.io)


  1. [Install](#install)
  2. [Examples](#examples)
     1. [Simple Example](#simple-example)
     2. [SBert](#use-sbert)
     3. [Retrieve Embeddings](#retrieve-embeddings)
     4. [Use Coreference](#use-coreference)
     5. [Custom Model Example](#custom-model-example)
     6. [Large Example](#large-example)
  3. [Calculating Elbow](#calculating-elbow)
  4. [Running the Service](#running-the-service)



  ```bash
  pip install bert-extractive-summarizer
  ```




  ```python
  from summarizer import Summarizer

  body = 'Text body that you want to summarize with BERT'
  body2 = 'Something else you want to summarize with BERT'
  model = Summarizer()
  model(body)
  model(body2)
  ```



  Number of sentences can be supplied as a ratio or an integer. Examples are provided below.

  ```python
  from summarizer import Summarizer
  body = 'Text body that you want to summarize with BERT'
  model = Summarizer()
  result = model(body, ratio=0.2)  # Specified with ratio
  result = model(body, num_sentences=3)  # Will return 3 sentences
  ```



  You can also concat the summarizer embeddings for clustering. A simple example is below.

  ```python
  from summarizer import Summarizer
  body = 'Text body that you want to summarize with BERT'
  model = Summarizer('distilbert-base-uncased', hidden=[-1,-2], hidden_concat=True)
  result = model(body, num_sentences=3)
  ```


  One can use Sentence Bert with bert-extractive-summarizer with the newest version. It is based off the paper here:
  https://arxiv.org/abs/1908.10084, and the library here: https://www.sbert.net/. To get started,
  first install SBERT:

  ```
  pip install -U sentence-transformers
  ```

  Then a simple example is the following:

  ```python
  from summarizer.sbert import SBertSummarizer

  body = 'Text body that you want to summarize with BERT'
  model = SBertSummarizer('paraphrase-MiniLM-L6-v2')
  result = model(body, num_sentences=3)
  ```

  It is worth noting that all the features that you can do with the main Summarizer class, you can also do with SBert.


  You can also retrieve the embeddings of the summarization. Examples are below:

  ```python
  from summarizer import Summarizer
  body = 'Text body that you want to summarize with BERT'
  model = Summarizer()
  result = model.run_embeddings(body, ratio=0.2)  # Specified with ratio.
  result = model.run_embeddings(body, num_sentences=3)  # Will return (3, N) embedding numpy matrix.
  result = model.run_embeddings(body, num_sentences=3, aggregate='mean')  # Will return Mean aggregate over embeddings.
  ```


  First ensure you have installed neuralcoref and spacy. It is worth noting that neuralcoref does not work with spacy > 0.2.1.
  ```bash
  pip install spacy
  pip install transformers # > 4.0.0
  pip install neuralcoref

  python -m spacy download en_core_web_md
  ```

  Then to to use coreference, run the following:

  ```python
  from summarizer import Summarizer
  from summarizer.text_processors.coreference_handler import CoreferenceHandler

  handler = CoreferenceHandler(greedyness=.4)




  body = 'Text body that you want to summarize with BERT'
  body2 = 'Something else you want to summarize with BERT'
  model = Summarizer(sentence_handler=handler)
  model(body)
  model(body2)
  ```


  ```python
  from transformers import *


  custom_config = AutoConfig.from_pretrained('allenai/scibert_scivocab_uncased')
  custom_config.output_hidden_states=True
  custom_tokenizer = AutoTokenizer.from_pretrained('allenai/scibert_scivocab_uncased')
  custom_model = AutoModel.from_pretrained('allenai/scibert_scivocab_uncased', config=custom_config)

  from summarizer import Summarizer

  body = 'Text body that you want to summarize with BERT'
  body2 = 'Something else you want to summarize with BERT'
  model = Summarizer(custom_model=custom_model, custom_tokenizer=custom_tokenizer)
  model(body)
  model(body2)
  ```



  ```python
  from summarizer import Summarizer

  body = '''
  The Chrysler Building, the famous art deco New York skyscraper, will be sold for a small fraction of its previous sales price.
  The deal, first reported by The Real Deal, was for $150 million, according to a source familiar with the deal.
  Mubadala, an Abu Dhabi investment fund, purchased 90% of the building for $800 million in 2008.
  Real estate firm Tishman Speyer had owned the other 10%.
  The buyer is RFR Holding, a New York real estate company.
  Officials with Tishman and RFR did not immediately respond to a request for comments.
  It's unclear when the deal will close.
  The building sold fairly quickly after being publicly placed on the market only two months ago.
  The sale was handled by CBRE Group.
  The incentive to sell the building at such a huge loss was due to the soaring rent the owners pay to Cooper Union, a New York college, for the land under the building.
  The rent is rising from $7.75 million last year to $32.5 million this year to $41 million in 2028.
  Meantime, rents in the building itself are not rising nearly that fast.
  While the building is an iconic landmark in the New York skyline, it is competing against newer office towers with large floor-to-ceiling windows and all the modern amenities.
  Still the building is among the best known in the city, even to people who have never been to New York.
  It is famous for its triangle-shaped, vaulted windows worked into the stylized crown, along with its distinctive eagle gargoyles near the top.
  It has been featured prominently in many films, including Men in Black 3, Spider-Man, Armageddon, Two Weeks Notice and Independence Day.
  The previous sale took place just before the 2008 financial meltdown led to a plunge in real estate prices.
  Still there have been a number of high profile skyscrapers purchased for top dollar in recent years, including the Waldorf Astoria hotel, which Chinese firm Anbang Insurance purchased in 2016 for nearly $2 billion, and the Willis Tower in Chicago, which was formerly known as Sears Tower, once the world's tallest.
  Blackstone Group (BX) bought it for $1.3 billion 2015.
  The Chrysler Building was the headquarters of the American automaker until 1953, but it was named for and owned by Chrysler chief Walter Chrysler, not the company itself.
  Walter Chrysler had set out to build the tallest building in the world, a competition at that time with another Manhattan skyscraper under construction at 40 Wall Street at the south end of Manhattan. He kept secret the plans for the spire that would grace the top of the building, building it inside the structure and out of view of the public until 40 Wall Street was complete.
  Once the competitor could rise no higher, the spire of the Chrysler building was raised into view, giving it the title.
  '''

  model = Summarizer()
  result = model(body, min_length=60)
  full = ''.join(result)
  print(full)
  """
  The Chrysler Building, the famous art deco New York skyscraper, will be sold for a small fraction of its previous sales price.
  The building sold fairly quickly after being publicly placed on the market only two months ago.
  The incentive to sell the building at such a huge loss was due to the soaring rent the owners pay to Cooper Union, a New York college, for the land under the building.'
  Still the building is among the best known in the city, even to people who have never been to New York.
  """
  ```



  As of bert-extractive-summarizer version 0.7.1, you can also calculate ELBOW to determine the optimal cluster. Below
  shows a sample example in how to retrieve the list of inertias.

  ```python
  from summarizer import Summarizer

  body = 'Your Text here.'
  model = Summarizer()
  res = model.calculate_elbow(body, k_max=10)
  print(res)
  ```

  You can also find the optimal number of sentences with elbow using the following algorithm.

  ```python
  from summarizer import Summarizer

  body = 'Your Text here.'
  model = Summarizer()
  res = model.calculate_optimal_k(body, k_max=10)
  print(res)
  ```



  ```
  model = Summarizer(
      model: This gets used by the hugging face bert library to load the model, you can supply a custom trained model here
      custom_model: If you have a pre-trained model, you can add the model class here.
      custom_tokenizer:  If you have a custom tokenizer, you can add the tokenizer here.
      hidden: Needs to be negative, but allows you to pick which layer you want the embeddings to come from.
      reduce_option: It can be 'mean', 'median', or 'max'. This reduces the embedding layer for pooling.
      sentence_handler: The handler to process sentences. If want to use coreference, instantiate and pass CoreferenceHandler instance
  )

  model(
      body: str # The string body that you want to summarize
      ratio: float # The ratio of sentences that you want for the final summary
      min_length: int # Parameter to specify to remove sentences that are less than 40 characters
      max_length: int # Parameter to specify to remove sentences greater than the max length,
      num_sentences: Number of sentences to use. Overrides ratio if supplied.
  )
  ```



  There is a provided flask service and corresponding Dockerfile. Running the service is simple, and can be done though
  the Makefile with the two commands:

  ```
  make docker-service-build
  make docker-service-run
  ```

  This will use the Bert-base-uncased model, which has a small representation. The docker run also accepts a variety of
  arguments for custom and different models. This can be done through a command such as:

  ```
  docker build -t summary-service -f Dockerfile.service ./
  docker run --rm -it -p 5000:5000 summary-service:latest -model bert-large-uncased
  ```

  Other arguments can also be passed to the server. Below includes the list of available arguments.

  * -greediness: Float parameter that determines how greedy nueralcoref should be
  * -reduce: Determines the reduction statistic of the encoding layer (mean, median, max).
  * -hidden: Determines the hidden layer to use for embeddings (default is -2)
  * -port: Determines the port to use.
  * -host: Determines the host to use.

  Once the service is running, you can make a summarization command at the `http://localhost:5000/summarize` endpoint.
  This endpoint accepts a text/plain input which represents the text that you want to summarize. Parameters can also be
  passed as request arguments. The accepted arguments are:

  * ratio: Ratio of sentences to summarize to from the original body. (default to 0.2)
  * min_length: The minimum length to accept as a sentence. (default to 25)
  * max_length: The maximum length to accept as a sentence. (default to 500)

  An example of a request is the following:

  ```
  POST http://localhost:5000/summarize?ratio=0.1

  Content-type: text/plain

  Body:
  The Chrysler Building, the famous art deco New York skyscraper, will be sold for a small fraction of its previous sales price.
  The deal, first reported by The Real Deal, was for $150 million, according to a source familiar with the deal.
  Mubadala, an Abu Dhabi investment fund, purchased 90% of the building for $800 million in 2008.
  Real estate firm Tishman Speyer had owned the other 10%.
  The buyer is RFR Holding, a New York real estate company.
  Officials with Tishman and RFR did not immediately respond to a request for comments.
  It's unclear when the deal will close.
  The building sold fairly quickly after being publicly placed on the market only two months ago.
  The sale was handled by CBRE Group.
  The incentive to sell the building at such a huge loss was due to the soaring rent the owners pay to Cooper Union, a New York college, for the land under the building.
  The rent is rising from $7.75 million last year to $32.5 million this year to $41 million in 2028.
  Meantime, rents in the building itself are not rising nearly that fast.
  While the building is an iconic landmark in the New York skyline, it is competing against newer office towers with large floor-to-ceiling windows and all the modern amenities.
  Still the building is among the best known in the city, even to people who have never been to New York.
  It is famous for its triangle-shaped, vaulted windows worked into the stylized crown, along with its distinctive eagle gargoyles near the top.
  It has been featured prominently in many films, including Men in Black 3, Spider-Man, Armageddon, Two Weeks Notice and Independence Day.
  The previous sale took place just before the 2008 financial meltdown led to a plunge in real estate prices.
  Still there have been a number of high profile skyscrapers purchased for top dollar in recent years, including the Waldorf Astoria hotel, which Chinese firm Anbang Insurance purchased in 2016 for nearly $2 billion, and the Willis Tower in Chicago, which was formerly known as Sears Tower, once the world's tallest.
  Blackstone Group (BX) bought it for $1.3 billion 2015.
  The Chrysler Building was the headquarters of the American automaker until 1953, but it was named for and owned by Chrysler chief Walter Chrysler, not the company itself.
  Walter Chrysler had set out to build the tallest building in the world, a competition at that time with another Manhattan skyscraper under construction at 40 Wall Street at the south end of Manhattan. He kept secret the plans for the spire that would grace the top of the building, building it inside the structure and out of view of the public until 40 Wall Street was complete.
  Once the competitor could rise no higher, the spire of the Chrysler building was raised into view, giving it the title.

  Response:

  {
      "summary": "The Chrysler Building, the famous art deco New York skyscraper, will be sold for a small fraction of its previous sales price. The buyer is RFR Holding, a New York real estate company. The incentive to sell the building at such a huge loss was due to the soaring rent the owners pay to Cooper Union, a New York college, for the land under the building."
  }
  ```


pkgId: a04bd1161ee9f6b5defe35c6ef025fbf076f56a1c9551b503ada54be5027570e
name: python-bert-schemas
arch: src
version: 4.6.4
epoch: 0
release: 1
summary: Bert service schemas
url: https://pypi.org/project/bert-schemas/
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bert-schemas-4.6.4-1.src.rpm
checksum_type: sha256
description:
  [![License: Apache](https://img.shields.io/badge/License-Apache-yellow.svg)](https://opensource.org/licenses/Apache-2.0) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/Infleqtion.svg?style=social&label=Follow%20%40Infleqtion)](https://twitter.com/Infleqtion)



  ```python
  pip install bert-schemas
  ```



  These Pydantic schemas are used by projects such as Oqtant for defining and validating REST payloads.


pkgId: 6b6b25173243c586d00e0fd6912a7e256ec1cf78ff41caa1d24750707129dff0
name: python-bert-score
arch: src
version: 0.3.13
epoch: 0
release: 1
summary: PyTorch implementation of BERT score
url: https://github.com/Tiiiger/bert_score
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bert-score-0.3.13-1.src.rpm
checksum_type: sha256
description:
  [![made-with-python](https://img.shields.io/badge/Made%20with-Python-red.svg)](#python)
  [![arxiv](https://img.shields.io/badge/arXiv-1904.09675-b31b1b.svg)](https://arxiv.org/abs/1904.09675)
  [![PyPI version bert-score](https://badge.fury.io/py/bert-score.svg)](https://pypi.python.org/pypi/bert-score/) [![Downloads](https://pepy.tech/badge/bert-score)](https://pepy.tech/project/bert-score) [![Downloads](https://pepy.tech/badge/bert-score/month)](https://pepy.tech/project/bert-score) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)


  Automatic Evaluation Metric described in the paper [BERTScore: Evaluating Text Generation with BERT](https://arxiv.org/abs/1904.09675) (ICLR 2020). We now support about 130 models (see this [spreadsheet](https://docs.google.com/spreadsheets/d/1RKOVpselB98Nnh_EOC4A2BYn8_201tmPODpNWu4w7xI/edit?usp=sharing) for their correlations with human evaluation). Currently, the best model is `microsoft/deberta-xlarge-mnli`, please consider using it instead of the default `roberta-large` in order to have the best correlation with human evaluation.


  <!-- - Features to appear in the next version (currently in the master branch): -->
  - Updated to version 0.3.13
    - Fix bug with transformers version > 4.17.0 ([#148](https://github.com/Tiiiger/bert_score/pull/148))
  - Updated to version 0.3.12
    - Having `get_idf_dict` compatible with DDP ([#140](https://github.com/Tiiiger/bert_score/pull/140))
    - Fix setup bug ([#138](https://github.com/Tiiiger/bert_score/pull/138))
  - Updated to version 0.3.11
    - Support 6 DeBERTa v3 models
    - Support 3 ByT5 models
  - Updated to version 0.3.10
    - Support 8 SimCSE models
    - Fix the support of scibert (to be compatible with transformers >= 4.0.0)
    - Add scripts for reproducing some results in our paper (See this [folder](./reproduce))
    - Support fast tokenizers in huggingface transformers with `--use_fast_tokenizer`. Notably, you will get different scores because of the difference in the tokenizer implementations ([#106](https://github.com/Tiiiger/bert_score/issues/106)).
    - Fix non-zero recall problem for empty candidate strings ([#107](https://github.com/Tiiiger/bert_score/issues/107)).
    - Add Turkish BERT Supoort ([#108](https://github.com/Tiiiger/bert_score/issues/108)).
  - Updated to version 0.3.9
    - Support 3 BigBird models
    - Fix bugs for mBART and T5
    - Support 4 mT5 models as requested ([#93](https://github.com/Tiiiger/bert_score/issues/93))
  - Updated to version 0.3.8
    - Support 53 new pretrained models including BART, mBART, BORT, DeBERTa, T5, BERTweet, MPNet, ConvBERT, SqueezeBERT, SpanBERT, PEGASUS, Longformer, LED, Blendbot, etc. Among them, DeBERTa achives higher correlation with human scores than RoBERTa (our default) on WMT16 dataset. The correlations are presented in this [Google sheet](https://docs.google.com/spreadsheets/d/1RKOVpselB98Nnh_EOC4A2BYn8_201tmPODpNWu4w7xI/edit?usp=sharing).
    - Please consider using `--model_type microsoft/deberta-xlarge-mnli` or `--model_type microsoft/deberta-large-mnli` (faster) if you want the scores to correlate better with human scores.
    - Add baseline files for DeBERTa models.
    - Add example code to generate baseline files (please see the [details](get_rescale_baseline)).
  - Updated to version 0.3.7
    - Being compatible with Huggingface's transformers version >=4.0.0. Thanks to public contributers ([#84](https://github.com/Tiiiger/bert_score/pull/84), [#85](https://github.com/Tiiiger/bert_score/issues/85), [#86](https://github.com/Tiiiger/bert_score/pull/86)).
  - See [#22](https://github.com/Tiiiger/bert_score/issues/22) if you want to replicate our experiments on the COCO Captioning dataset.


  - For people in China, downloading pre-trained weights can be very slow. We provide copies of a few models on Baidu Pan.
    - [roberta-large](https://pan.baidu.com/s/1MTmGHsZ3ubn7Vr_W-wyEdQ) password: dhe5
    - [bert-base-chinese](https://pan.baidu.com/s/1THfiCXjWtdGGsCMskQ5svA) password: jvk7
    - [bert-base-multilingual-cased](https://pan.baidu.com/s/100SBjkLmI7U4pgo_e0q7CQ) password: yx3q
  - [Huggingface's datasets](https://github.com/huggingface/datasets) library includes BERTScore in their metric collection.

  <details><summary>Previous updates</summary><p>

  - Updated to version 0.3.6
    - Support custom baseline files [#74](https://github.com/Tiiiger/bert_score/pull/74)
    - The option `--rescale-with-baseline` is changed to `--rescale_with_baseline` so that it is consistent with other options.
  - Updated to version 0.3.5
    - Being compatible with Huggingface's transformers >=v3.0.0 and minor fixes ([#58](https://github.com/Tiiiger/bert_score/pull/58), [#66](https://github.com/Tiiiger/bert_score/pull/66), [#68](https://github.com/Tiiiger/bert_score/pull/68))
    - Several improvements related to efficency ([#67](https://github.com/Tiiiger/bert_score/pull/67), [#69](https://github.com/Tiiiger/bert_score/pull/69))
  - Updated to version 0.3.4
    - Compatible with transformers v2.11.0 now (#58)
  - Updated to version 0.3.3
    - Fixing the bug with empty strings [issue #47](https://github.com/Tiiiger/bert_score/issues/47).
    - Supporting 6 [ELECTRA](https://github.com/google-research/electra) models and 24 smaller [BERT](https://github.com/google-research/bert) models.
    - A new [Google sheet](https://docs.google.com/spreadsheets/d/1RKOVpselB98Nnh_EOC4A2BYn8_201tmPODpNWu4w7xI/edit?usp=sharing) for keeping the performance (i.e., pearson correlation with human judgment) of different models on WMT16 to-English.
    - Including the script for tuning the best number of layers of an English pre-trained model on WMT16 to-English data (See the [details](tune_layers)).
  - Updated to version 0.3.2
    - **Bug fixed**: fixing the bug in v0.3.1 when having multiple reference sentences.
    - Supporting multiple reference sentences with our command line tool.
  - Updated to version 0.3.1
    - A new `BERTScorer` object that caches the model to avoid re-loading it multiple times. Please see our [jupyter notebook example](./example/Demo.ipynb) for the usage.
    - Supporting multiple reference sentences for each example. The `score` function now can take a list of lists of strings as the references and return the score between the candidate sentence and its closest reference sentence.

  </p></details>

  Please see [release logs](https://github.com/Tiiiger/bert_score/releases) for older updates.


  * [Tianyi Zhang](https://scholar.google.com/citations?user=OI0HSa0AAAAJ&hl=en)*
  * [Varsha Kishore](https://scholar.google.com/citations?user=B8UeYcEAAAAJ&authuser=2)*
  * [Felix Wu](https://sites.google.com/view/felixwu/home)*
  * [Kilian Q. Weinberger](http://kilian.cs.cornell.edu/index.html)
  * [Yoav Artzi](https://yoavartzi.com/)

  *: Equal Contribution


  BERTScore leverages the pre-trained contextual embeddings from BERT and matches
  words in candidate and reference sentences by cosine similarity.
  It has been shown to correlate with human judgment on sentence-level and
  system-level evaluation.
  Moreover, BERTScore computes precision, recall, and F1 measure, which can be
  useful for evaluating different language generation tasks.

  For an illustration, BERTScore recall can be computed as
  ![](./bert_score.png "BERTScore")

  If you find this repo useful, please cite:
  ```
  @inproceedings{bert-score,
    title={BERTScore: Evaluating Text Generation with BERT},
    author={Tianyi Zhang* and Varsha Kishore* and Felix Wu* and Kilian Q. Weinberger and Yoav Artzi},
    booktitle={International Conference on Learning Representations},
    year={2020},
    url={https://openreview.net/forum?id=SkeHuCVFDr}
  }
  ```


  * Python version >= 3.6
  * PyTorch version >= 1.0.0

  Install from pypi with pip by

  ```sh
  pip install bert-score
  ```
  Install latest unstable version from the master branch on Github by:
  ```
  pip install git+https://github.com/Tiiiger/bert_score
  ```

  Install it from the source by:
  ```sh
  git clone https://github.com/Tiiiger/bert_score
  cd bert_score
  pip install .
  ```
  and you may test your installation by:
  ```
  python -m unittest discover
  ```






  On a high level, we provide a python function `bert_score.score` and a python object `bert_score.BERTScorer`.
  The function provides all the supported features while the scorer object caches the BERT model to faciliate multiple evaluations.
  Check our [demo](./example/Demo.ipynb) to see how to use these two interfaces.
  Please refer to [`bert_score/score.py`](./bert_score/score.py) for implementation details.

  Running BERTScore can be computationally intensive (because it uses BERT :p).
  Therefore, a GPU is usually necessary. If you don't have access to a GPU, you
  can try our [demo on Google Colab](https://colab.research.google.com/drive/1kpL8Y_AnUUiCxFjhxSrxCsc6-sDMNb_Q)


  We provide a command line interface (CLI) of BERTScore as well as a python module.
  For the CLI, you can use it as follows:
  1. To evaluate English text files:

  We provide example inputs under `./example`.

  ```sh
  bert-score -r example/refs.txt -c example/hyps.txt --lang en
  ```
  You will get the following output at the end:

  roberta-large_L17_no-idf_version=0.3.0(hug_trans=2.3.0) P: 0.957378 R: 0.961325 F1: 0.959333

  where "roberta-large_L17_no-idf_version=0.3.0(hug_trans=2.3.0)" is the hash code.

  Starting from version 0.3.0, we support rescaling the scores with baseline scores

  ```sh
  bert-score -r example/refs.txt -c example/hyps.txt --lang en --rescale_with_baseline
  ```
  You will get:

  roberta-large_L17_no-idf_version=0.3.0(hug_trans=2.3.0)-rescaled P: 0.747044 R: 0.770484 F1: 0.759045

  This makes the range of the scores larger and more human-readable. Please see this [post](./journal/rescale_baseline.md) for details.

  When having multiple reference sentences, please use
  ```sh
  bert-score -r example/refs.txt example/refs2.txt -c example/hyps.txt --lang en
  ```
  where the `-r` argument supports an arbitrary number of reference files. Each reference file should have the same number of lines as your candidate/hypothesis file. The i-th line in each reference file corresponds to the i-th line in the candidate file.


  2. To evaluate text files in other languages:

  We currently support the 104 languages in multilingual BERT ([full list](https://github.com/google-research/bert/blob/master/multilingual.md#list-of-languages)).

  Please specify the two-letter abbreviation of the language. For instance, using `--lang zh` for Chinese text.

  See more options by `bert-score -h`.


  3. To load your own custom model:
  Please specify the path to the model and the number of layers to use by `--model` and `--num_layers`.
  ```sh
  bert-score -r example/refs.txt -c example/hyps.txt --model path_to_my_bert --num_layers 9
  ```


  4. To visualize matching scores:
  ```sh
  bert-score-show --lang en -r "There are two bananas on the table." -c "On the table are two apples." -f out.png
  ```
  The figure will be saved to out.png.

  5. If you see the following message while using BERTScore, please ignore it. This is expected.
  ```
  Some weights of the model checkpoint at roberta-large were not used when initializing RobertaModel: ['lm_head.decoder.weight', 'lm_head.layer_norm.weight', 'lm_head.dense.bias', 'lm_head.layer_norm.bias', 'lm_head.bias', 'lm_head.dense.weight']
  - This IS expected if you are initializing RobertaModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
  - This IS NOT expected if you are initializing RobertaModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
  ```



  * Report the hash code (e.g., `roberta-large_L17_no-idf_version=0.3.0(hug_trans=2.3.0)-rescaled`) in your paper so that people know what setting you use. This is inspired by [sacreBLEU](https://github.com/mjpost/sacreBLEU). Changes in huggingface's transformers version may also affect the score (See [issue #46](https://github.com/Tiiiger/bert_score/issues/46)).
  * Unlike BERT, RoBERTa uses GPT2-style tokenizer which creates addition " " tokens when there are multiple spaces appearing together. It is recommended to remove addition spaces by `sent = re.sub(r' +', ' ', sent)` or `sent = re.sub(r'\s+', ' ', sent)`.
  * Using inverse document frequency (idf) on the reference
    sentences to weigh word importance  may correlate better with human judgment.
    However, when the set of reference sentences become too small, the idf score
    would become inaccurate/invalid.
    We now make it optional. To use idf,
    please set `--idf` when using the CLI tool or
    `idf=True` when calling `bert_score.score` function.
  * When you are low on GPU memory, consider setting `batch_size` when calling
    `bert_score.score` function.
  * To use a particular model please set `-m MODEL_TYPE` when using the CLI tool
    or `model_type=MODEL_TYPE` when calling `bert_score.score` function.
  * We tune layer to use based on WMT16 metric evaluation dataset. You may use a
    different layer by setting `-l LAYER` or `num_layers=LAYER`. To tune the best layer for your custom model, please follow the instructions in [tune_layers](tune_layers) folder.
  * __Limitation__: Because BERT, RoBERTa, and XLM with learned positional embeddings are pre-trained on sentences with max length 512, BERTScore is undefined between sentences longer than 510 (512 after adding \[CLS\] and \[SEP\] tokens). The sentences longer than this will be truncated. Please consider using XLNet which can support much longer inputs.




  | Language  | Model                            |
  |:---------:|:--------------------------------:|
  | en        | roberta-large                    |
  | en-sci    | allenai/scibert_scivocab_uncased |
  | zh        | bert-base-chinese                |
  | tr        | dbmdz/bert-base-turkish-cased    |
  | others    | bert-base-multilingual-cased     |


  Please see this [Google sheet](https://docs.google.com/spreadsheets/d/1RKOVpselB98Nnh_EOC4A2BYn8_201tmPODpNWu4w7xI/edit?usp=sharing) for the supported models and their performance.


  This repo wouldn't be possible without the awesome
  [bert](https://github.com/google-research/bert), [fairseq](https://github.com/pytorch/fairseq), and [transformers](https://github.com/huggingface/transformers).


pkgId: 845c25bbfee89d2bd40125092a92da7a6a483183dde89341af870f66cc55eec1
name: python-bert-serving-client
arch: src
version: 1.10.0
epoch: 0
release: 1
summary: Mapping a variable-length sentence to a fixed-length vector using BERT model (Client)
url: https://github.com/hanxiao/bert-as-service
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bert-serving-client-1.10.0-1.src.rpm
checksum_type: sha256
description:
  > **This README.md is a mirror for PyPI. Please visit https://github.com/hanxiao/bert-as-service/blob/master/README.md for the latest README.md.**
  <h1 align="center">bert-as-service</h1>

  <p align="center">Using BERT model as a sentence encoding service, i.e. mapping a variable-length sentence to a fixed-length vector.</p>

  <p align="center">
    <a href="https://github.com/hanxiao/bert-as-service/stargazers">
      <img src="https://img.shields.io/github/stars/hanxiao/bert-as-service.svg?colorA=orange&colorB=orange&logo=github"
           alt="GitHub stars">
    </a>
    <a href="https://pypi.org/search/?q=bert-serving">
        <img src="https://img.shields.io/pypi/v/bert-serving-server.svg?colorB=brightgreen"
             alt="Pypi package">
      </a>
    <a href="https://bert-as-service.readthedocs.io/">
        <img src="https://readthedocs.org/projects/bert-as-service/badge/?version=latest"
             alt="ReadTheDoc">
      </a>
    <a href="https://pypi.org/search/?q=bert-serving">
        <img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/bert-serving-server">
    </a>
    <a href="https://github.com/hanxiao/bert-as-service/issues">
          <img src="https://img.shields.io/github/issues/hanxiao/bert-as-service.svg"
               alt="GitHub issues">
    </a>
    <a href="https://github.com/hanxiao/bert-as-service/blob/master/LICENSE">
          <img src="https://img.shields.io/github/license/hanxiao/bert-as-service.svg"
               alt="GitHub license">
    </a>
    <a href="https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fhanxiao%2Fbert-as-service">
    <img src="https://img.shields.io/twitter/url/https/github.com/hanxiao/bert-as-service.svg?style=social" alt="Twitter">
    </a>
  </p>

  <p align="center">
    <a href="#highlights">Highlights</a> •
    <a href="#what-is-it">What is it</a> •
    <a href="#install">Install</a> •
    <a href="#getting-started">Getting Started</a> •
    <a href="#server-and-client-api">API</a> •
    <a href="#book-tutorial">Tutorials</a> •
    <a href="#speech_balloon-faq">FAQ</a> •
    <a href="#zap-benchmark">Benchmark</a> •
    <a href="https://hanxiao.github.io/2019/01/02/Serving-Google-BERT-in-Production-using-Tensorflow-and-ZeroMQ/" target="_blank">Blog</a>

  </p>

  <p align="center">
      <img src=".github/demo.gif?raw=true" width="700">
  </p>

  <h6 align="center">Made by Han Xiao • :globe_with_meridians: <a href="https://hanxiao.github.io">https://hanxiao.github.io</a></h6>


  <center>
  <table>
    <tr>
    <td width="25%"><a href="https://github.com/gnes-ai/gnes">
        <img src=".github/gnes-logo-tight.svg" alt="GNES is Generic Neural Elastic Search (logo made by Han Xiao)">
        </a></td>
    <td>
    <b>✨Looking for X-as-service? Or more generic and cloud-native solution?</b>
    <p><br>Checkout my new project <a href="https://github.com/gnes-ai/gnes">GNES</a>! GNES is Generic Neural Elastic Search, a cloud-native semantic search system based on deep neural network. GNES enables large-scale index and semantic search for text-to-text, image-to-image, video-to-video and any-to-any content form.</p>
  </td>
    </tr>
  </table>
  </center>

  <h2 align="center">What is it</h2>

  **BERT** is a NLP model [developed by Google](https://github.com/google-research/bert) for pre-training language representations. It leverages an enormous amount of plain text data publicly available on the web and is trained in an unsupervised manner. Pre-training a BERT model is a fairly expensive yet one-time procedure for each language. Fortunately, Google released several pre-trained models where [you can download from here](https://github.com/google-research/bert#pre-trained-models).


  **Sentence Encoding/Embedding** is a upstream task required in many NLP applications, e.g. sentiment analysis, text classification. The goal is to represent a variable length sentence into a fixed length vector, e.g. `hello world` to `[0.1, 0.3, 0.9]`. Each element of the vector should "encode" some semantics of the original sentence.

  **Finally, `bert-as-service`** uses BERT as a sentence encoder and hosts it as a service via ZeroMQ, allowing you to map sentences into fixed-length representations in just two lines of code.

  <h2 align="center">Highlights</h2>

  - :telescope: **State-of-the-art**: build on pretrained 12/24-layer BERT models released by Google AI, which is considered as a milestone in the NLP community.
  - :hatching_chick: **Easy-to-use**: require only two lines of code to get sentence/token-level encodes.
  - :zap: **Fast**: 900 sentences/s on a single Tesla M40 24GB. Low latency, optimized for speed. See [benchmark](#zap-benchmark).
  - :octopus: **Scalable**: scale nicely and smoothly on multiple GPUs and multiple clients without worrying about concurrency. See [benchmark](#speed-wrt-num_client).
  - :gem: **Reliable**: tested on multi-billion sentences; days of running without a break or OOM or any nasty exceptions.

  More features: [XLA & FP16 support](#speed-wrt--fp16-and--xla); mix GPU-CPU workloads; optimized graph; `tf.data` friendly; customized tokenizer; flexible pooling strategy; [build-in HTTP server](#using-bert-as-service-to-serve-http-requests-in-json) and dashboard; [async encoding](#asynchronous-encoding); [multicasting](#broadcasting-to-multiple-clients); etc.


  <h2 align="center">Install</h2>

  Install the server and client via `pip`. They can be installed separately or even on *different* machines:
  ```bash
  pip install bert-serving-server  # server
  pip install bert-serving-client  # client, independent of `bert-serving-server`
  ```

  Note that the server MUST be running on **Python >= 3.5** with **Tensorflow >= 1.10** (*one-point-ten*). Again, the server does not support Python 2!

  :point_up: The client can be running on both Python 2 and 3 [for the following consideration](#q-can-i-run-it-in-python-2).

  <h2 align="center">Getting Started</h2>


  Download a model listed below, then uncompress the zip file into some folder, say `/tmp/english_L-12_H-768_A-12/`

  <details>
   <summary>List of released pretrained BERT models (click to expand...)</summary>


  <table>
  <tr><td><a href="https://storage.googleapis.com/bert_models/2018_10_18/uncased_L-12_H-768_A-12.zip">BERT-Base, Uncased</a></td><td>12-layer, 768-hidden, 12-heads, 110M parameters</td></tr>
  <tr><td><a href="https://storage.googleapis.com/bert_models/2018_10_18/uncased_L-24_H-1024_A-16.zip">BERT-Large, Uncased</a></td><td>24-layer, 1024-hidden, 16-heads, 340M parameters</td></tr>
  <tr><td><a href="https://storage.googleapis.com/bert_models/2018_10_18/cased_L-12_H-768_A-12.zip">BERT-Base, Cased</a></td><td>12-layer, 768-hidden, 12-heads , 110M parameters</td></tr>
  <tr><td><a href="https://storage.googleapis.com/bert_models/2018_10_18/cased_L-24_H-1024_A-16.zip">BERT-Large, Cased</a></td><td>24-layer, 1024-hidden, 16-heads, 340M parameters</td></tr>
  <tr><td><a href="https://storage.googleapis.com/bert_models/2018_11_23/multi_cased_L-12_H-768_A-12.zip">BERT-Base, Multilingual Cased (New)</a></td><td>104 languages, 12-layer, 768-hidden, 12-heads, 110M parameters</td></tr>
  <tr><td><a href="https://storage.googleapis.com/bert_models/2018_11_03/multilingual_L-12_H-768_A-12.zip">BERT-Base, Multilingual Cased (Old)</a></td><td>102 languages, 12-layer, 768-hidden, 12-heads, 110M parameters</td></tr>
  <tr><td><a href="https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip">BERT-Base, Chinese</a></td><td>Chinese Simplified and Traditional, 12-layer, 768-hidden, 12-heads, 110M parameters</td></tr>
  </table>

  </details>


  > **Optional:** fine-tuning the model on your downstream task. [Why is it optional?](#q-are-you-suggesting-using-bert-without-fine-tuning)


  After installing the server, you should be able to use `bert-serving-start` CLI as follows:
  ```bash
  bert-serving-start -model_dir /tmp/english_L-12_H-768_A-12/ -num_worker=4
  ```
  This will start a service with four workers, meaning that it can handle up to four **concurrent** requests. More concurrent requests will be queued in a load balancer. Details can be found in our [FAQ](#q-what-is-the-parallel-processing-model-behind-the-scene) and [the benchmark on number of clients](#speed-wrt-num_client).

  Below shows what the server looks like when starting correctly:
  <p align="center"><img src=".github/server-demo.gif?raw=true"/></p>

  <details>
   <summary>Alternatively, one can start the BERT Service in a Docker Container (click to expand...)</summary>

  ```bash
  docker build -t bert-as-service -f ./docker/Dockerfile .
  NUM_WORKER=1
  PATH_MODEL=/PATH_TO/_YOUR_MODEL/
  docker run --runtime nvidia -dit -p 5555:5555 -p 5556:5556 -v $PATH_MODEL:/model -t bert-as-service $NUM_WORKER
  ```
  </details>



  Now you can encode sentences simply as follows:
  ```python
  from bert_serving.client import BertClient
  bc = BertClient()
  bc.encode(['First do it', 'then do it right', 'then do it better'])
  ```
  It will return a `ndarray` (or `List[List[float]]` if you wish), in which each row is a fixed-length vector representing a sentence. Having thousands of sentences? Just `encode`! *Don't even bother to batch*, the server will take care of it.

  As a feature of BERT, you may get encodes of a pair of sentences by concatenating them with ` ||| ` (with whitespace before and after), e.g.
  ```python
  bc.encode(['First do it ||| then do it right'])
  ```

  Below shows what the server looks like while encoding:
  <p align="center"><img src=".github/server-run-demo.gif?raw=true"/></p>


  One may also start the service on one (GPU) machine and call it from another (CPU) machine as follows:

  ```python

  from bert_serving.client import BertClient
  bc = BertClient(ip='xx.xx.xx.xx')  # ip address of the GPU machine
  bc.encode(['First do it', 'then do it right', 'then do it better'])
  ```

  Note that you only need `pip install -U bert-serving-client` in this case, the server side is not required. You may also [call the service via HTTP requests.](#using-bert-as-service-to-serve-http-requests-in-json)

  > :bulb: **Want to learn more? Checkout our tutorials:**
  > - [Building a QA semantic search engine in 3 min.](#building-a-qa-semantic-search-engine-in-3-minutes)
  > - [Serving a fine-tuned BERT model](#serving-a-fine-tuned-bert-model)
  > - [Getting ELMo-like contextual word embedding](#getting-elmo-like-contextual-word-embedding)
  > - [Using your own tokenizer](#using-your-own-tokenizer)
  > - [Using `BertClient` with `tf.data` API](#using-bertclient-with-tfdata-api)
  > - [Training a text classifier using BERT features and tf.estimator API](#training-a-text-classifier-using-bert-features-and-tfestimator-api)
  > - [Saving and loading with TFRecord data](#saving-and-loading-with-tfrecord-data)
  > - [Asynchronous encoding](#asynchronous-encoding)
  > - [Broadcasting to multiple clients](#broadcasting-to-multiple-clients)
  > - [Monitoring the service status in a dashboard](#monitoring-the-service-status-in-a-dashboard)
  > - [Using `bert-as-service` to serve HTTP requests in JSON](#using-bert-as-service-to-serve-http-requests-in-json)
  > - [Starting `BertServer` from Python](#starting-bertserver-from-python)


  <h2 align="center">Server and Client API</h2>
  <p align="right"><a href="#bert-as-service"><sup>▴ Back to top</sup></a></p>

  [![ReadTheDoc](https://readthedocs.org/projects/bert-as-service/badge/?version=latest&style=for-the-badge)](http://bert-as-service.readthedocs.io)

  The best way to learn `bert-as-service` **latest API** is [reading the documentation](http://bert-as-service.readthedocs.io).



  [Please always refer to the latest server-side API documented here.](https://bert-as-service.readthedocs.io/en/latest/source/server.html#server-side-api), you may get the latest usage via:
  ```bash
  bert-serving-start --help
  bert-serving-terminate --help
  bert-serving-benchmark --help
  ```

  | Argument | Type | Default | Description |
  |--------------------|------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
  | `model_dir` | str | *Required* | folder path of the pre-trained BERT model. |
  | `tuned_model_dir`| str |(Optional)| folder path of a fine-tuned BERT model. |
  | `ckpt_name`| str | `bert_model.ckpt` | filename of the checkpoint file. |
  | `config_name`| str | `bert_config.json` | filename of the JSON config file for BERT model. |
  | `graph_tmp_dir` | str | None | path to graph temp file |
  | `max_seq_len` | int | `25` | maximum length of sequence, longer sequence will be trimmed on the right side. Set it to NONE for dynamically using the longest sequence in a (mini)batch. |
  | `cased_tokenization` | bool | False | Whether tokenizer should skip the default lowercasing and accent removal. Should be used for e.g. the multilingual cased pretrained BERT model. |
  | `mask_cls_sep` | bool | False | masking the embedding on [CLS] and [SEP] with zero. |
  | `num_worker` | int | `1` | number of (GPU/CPU) worker runs BERT model, each works in a separate process. |
  | `max_batch_size` | int | `256` | maximum number of sequences handled by each worker, larger batch will be partitioned into small batches. |
  | `priority_batch_size` | int | `16` | batch smaller than this size will be labeled as high priority, and jumps forward in the job queue to get result faster |
  | `port` | int | `5555` | port for pushing data from client to server |
  | `port_out` | int | `5556`| port for publishing results from server to client |
  | `http_port` | int | None | server port for receiving HTTP requests |
  | `cors` | str | `*` | setting "Access-Control-Allow-Origin" for HTTP requests |
  | `pooling_strategy` | str | `REDUCE_MEAN` | the pooling strategy for generating encoding vectors, valid values are `NONE`, `REDUCE_MEAN`, `REDUCE_MAX`, `REDUCE_MEAN_MAX`, `CLS_TOKEN`, `FIRST_TOKEN`, `SEP_TOKEN`, `LAST_TOKEN`. Explanation of these strategies [can be found here](#q-what-are-the-available-pooling-strategies). To get encoding for each token in the sequence, please set this to `NONE`.|
  | `pooling_layer` | list | `[-2]` | the encoding layer that pooling operates on, where `-1` means the last layer, `-2` means the second-to-last, `[-1, -2]` means concatenating the result of last two layers, etc.|
  | `gpu_memory_fraction` | float | `0.5` | the fraction of the overall amount of memory that each GPU should be allocated per worker |
  | `cpu` | bool | False | run on CPU instead of GPU |
  | `xla` | bool | False | enable [XLA compiler](https://www.tensorflow.org/xla/jit) for graph optimization (*experimental!*) |
  | `fp16` | bool | False | use float16 precision (experimental) |
  | `device_map` | list | `[]` | specify the list of GPU device ids that will be used (id starts from 0)|
  | `show_tokens_to_client` | bool | False | sending tokenization results to client |



  [Please always refer to the latest client-side API documented here.](https://bert-as-service.readthedocs.io/en/latest/source/client.html#module-client) Client-side provides a Python class called `BertClient`, which accepts arguments as follows:

  | Argument | Type | Default | Description |
  |----------------------|------|-----------|-------------------------------------------------------------------------------|
  | `ip` | str | `localhost` | IP address of the server |
  | `port` | int | `5555` | port for pushing data from client to server, *must be consistent with the server side config* |
  | `port_out` | int | `5556`| port for publishing results from server to client, *must be consistent with the server side config* |
  | `output_fmt` | str | `ndarray` | the output format of the sentence encodes, either in numpy array or python List[List[float]] (`ndarray`/`list`) |
  | `show_server_config` | bool | `False` | whether to show server configs when first connected |
  | `check_version` | bool | `True` | whether to force client and server to have the same version |
  | `identity` | str | `None` | a UUID that identifies the client, useful in multi-casting |
  | `timeout` | int | `-1` | set the timeout (milliseconds) for receive operation on the client |

  A `BertClient` implements the following methods and properties:

  | Method |  Description |
  |--------|------|
  |`.encode()`|Encode a list of strings to a list of vectors|
  |`.encode_async()`|Asynchronous encode batches from a generator|
  |`.fetch()`|Fetch all encoded vectors from server and return them in a generator, use it with `.encode_async()` or `.encode(blocking=False)`. Sending order is NOT preserved.|
  |`.fetch_all()`|Fetch all encoded vectors from server and return them in a list, use it with `.encode_async()` or `.encode(blocking=False)`. Sending order is preserved.|
  |`.close()`|Gracefully close the connection between the client and the server|
  |`.status`|Get the client status in JSON format|
  |`.server_status`|Get the server status in JSON format|


  <h2 align="center">:book: Tutorial</h2>
  <p align="right"><a href="#bert-as-service"><sup>▴ Back to top</sup></a></p>

  [![ReadTheDoc](https://readthedocs.org/projects/bert-as-service/badge/?version=latest&style=for-the-badge)](https://bert-as-service.readthedocs.io/en/latest/section/faq.html)

  The full list of examples can be found in [`example/`](example). You can run each via `python example/example-k.py`. Most of examples require you to start a BertServer first, please follow [the instruction here](#2-start-the-bert-service). Note that although `BertClient` works universally on both Python 2.x and 3.x, examples are only tested on Python 3.6.

  <details>
   <summary>Table of contents (click to expand...)</summary>

  > - [Building a QA semantic search engine in 3 min.](#building-a-qa-semantic-search-engine-in-3-minutes)
  > - [Serving a fine-tuned BERT model](#serving-a-fine-tuned-bert-model)
  > - [Getting ELMo-like contextual word embedding](#getting-elmo-like-contextual-word-embedding)
  > - [Using your own tokenizer](#using-your-own-tokenizer)
  > - [Using `BertClient` with `tf.data` API](#using-bertclient-with-tfdata-api)
  > - [Training a text classifier using BERT features and tf.estimator API](#training-a-text-classifier-using-bert-features-and-tfestimator-api)
  > - [Saving and loading with TFRecord data](#saving-and-loading-with-tfrecord-data)
  > - [Asynchronous encoding](#asynchronous-encoding)
  > - [Broadcasting to multiple clients](#broadcasting-to-multiple-clients)
  > - [Monitoring the service status in a dashboard](#monitoring-the-service-status-in-a-dashboard)
  > - [Using `bert-as-service` to serve HTTP requests in JSON](#using-bert-as-service-to-serve-http-requests-in-json)
  > - [Starting `BertServer` from Python](#starting-bertserver-from-python)

  </details>



  > The complete example can [be found example8.py](example/example8.py).

  As the first example, we will implement a simple QA search engine using `bert-as-service` in just three minutes. No kidding! The goal is to find similar questions to user's input and return the corresponding answer. To start, we need a list of question-answer pairs. Fortunately, this README file already contains [a list of FAQ](#speech_balloon-faq), so I will just use that to make this example perfectly self-contained. Let's first load all questions and show some statistics.

  ```python
  prefix_q = '##### **Q:** '
  with open('README.md') as fp:
      questions = [v.replace(prefix_q, '').strip() for v in fp if v.strip() and v.startswith(prefix_q)]
      print('%d questions loaded, avg. len of %d' % (len(questions), np.mean([len(d.split()) for d in questions])))
  ```

  This gives `33 questions loaded, avg. len of 9`. So looks like we have enough questions. Now start a BertServer with `uncased_L-12_H-768_A-12` pretrained BERT model:
  ```bash
  bert-serving-start -num_worker=1 -model_dir=/data/cips/data/lab/data/model/uncased_L-12_H-768_A-12
  ```

  Next, we need to encode our questions into vectors:
  ```python
  bc = BertClient(port=4000, port_out=4001)
  doc_vecs = bc.encode(questions)
  ```

  Finally, we are ready to receive new query and perform a simple "fuzzy" search against the existing questions. To do that, every time a new query is coming, we encode it as a vector and compute its dot product with `doc_vecs`; sort the result descendingly; and return the top-k similar questions as follows:
  ```python
  while True:
      query = input('your question: ')
      query_vec = bc.encode([query])[0]
      
      score = np.sum(query_vec * doc_vecs, axis=1) / np.linalg.norm(doc_vecs, axis=1)
      topk_idx = np.argsort(score)[::-1][:topk]
      for idx in topk_idx:
          print('> %s\t%s' % (score[idx], questions[idx]))
  ```

  That's it! Now run the code and type your query, see how this search engine handles fuzzy match:
  <p align="center"><img src=".github/qasearch-demo.gif?raw=true"/></p>



  Pretrained BERT models often show quite "okayish" performance on many tasks. However, to release the true power of BERT a fine-tuning on the downstream task (or on domain-specific data) is necessary. In this example, I will show you how to serve a fine-tuned BERT model.

  We follow the instruction in ["Sentence (and sentence-pair) classification tasks"](https://github.com/google-research/bert#sentence-and-sentence-pair-classification-tasks) and use `run_classifier.py` to fine tune `uncased_L-12_H-768_A-12` model on MRPC task. The fine-tuned model is stored at `/tmp/mrpc_output/`, which can be changed by specifying `--output_dir` of `run_classifier.py`.

  If you look into `/tmp/mrpc_output/`, it contains something like:
  ```bash
  checkpoint                                        128
  eval                                              4.0K
  eval_results.txt                                  86
  eval.tf_record                                    219K
  events.out.tfevents.1545202214.TENCENT64.site     6.1M
  events.out.tfevents.1545203242.TENCENT64.site     14M
  graph.pbtxt                                       9.0M
  model.ckpt-0.data-00000-of-00001                  1.3G
  model.ckpt-0.index                                23K
  model.ckpt-0.meta                                 3.9M
  model.ckpt-343.data-00000-of-00001                1.3G
  model.ckpt-343.index                              23K
  model.ckpt-343.meta                               3.9M
  train.tf_record                                   2.0M
  ```

  Don't be afraid of those mysterious files, as the only important one to us is `model.ckpt-343.data-00000-of-00001` (looks like my training stops at the 343 step. One may get `model.ckpt-123.data-00000-of-00001` or `model.ckpt-9876.data-00000-of-00001` depending on the total training steps). Now we have collected all three pieces of information that are needed for serving this fine-tuned model:
  - The pretrained model is downloaded to `/path/to/bert/uncased_L-12_H-768_A-12`
  - Our fine-tuned model is stored at `/tmp/mrpc_output/`;
  - Our fine-tuned model checkpoint is named as `model.ckpt-343` something something.

  Now start a BertServer by putting three pieces together:

  ```bash
  bert-serving-start -model_dir=/pretrained/uncased_L-12_H-768_A-12 -tuned_model_dir=/tmp/mrpc_output/ -ckpt_name=model.ckpt-343
  ```

  After the server started, you should find this line in the log:
  ```text
  I:GRAPHOPT:[gra:opt: 50]:checkpoint (override by fine-tuned model): /tmp/mrpc_output/model.ckpt-343
  ```
  Which means the BERT parameters is overrode and successfully loaded from our fine-tuned `/tmp/mrpc_output/model.ckpt-343`. Done!

  In short, find your fine-tuned model path and checkpoint name, then feed them to `-tuned_model_dir` and `-ckpt_name`, respectively.



  Start the server with `pooling_strategy` set to NONE.
  ```bash
  bert-serving-start -pooling_strategy NONE -model_dir /tmp/english_L-12_H-768_A-12/
  ```

  To get the word embedding corresponds to every token, you can simply use slice index as follows:
  ```python



  bc = BertClient()
  vec = bc.encode(['hey you', 'whats up?'])

  vec  # [2, 25, 768]
  vec[0]  # [1, 25, 768], sentence embeddings for `hey you`
  vec[0][0]  # [1, 1, 768], word embedding for `[CLS]`
  vec[0][1]  # [1, 1, 768], word embedding for `hey`
  vec[0][2]  # [1, 1, 768], word embedding for `you`
  vec[0][3]  # [1, 1, 768], word embedding for `[SEP]`
  vec[0][4]  # [1, 1, 768], word embedding for padding symbol
  vec[0][25]  # error, out of index!
  ```

  Note that no matter how long your original sequence is, the service will always return a `[max_seq_len, 768]` matrix for every sequence. When using slice index to get the word embedding, beware of the special tokens padded to the sequence, i.e. `[CLS]`, `[SEP]`, `0_PAD`.



  Often you want to use your own tokenizer to segment sentences instead of the default one from BERT. Simply call `encode(is_tokenized=True)` on the client slide as follows:

  ```python
  texts = ['hello world!', 'good day']


  texts2 = [s.split() for s in texts]

  vecs = bc.encode(texts2, is_tokenized=True)
  ```
  This gives `[2, 25, 768]` tensor where the first `[1, 25, 768]` corresponds to the token-level encoding of "hello world!". If you look into its values, you will find that only the first four elements, i.e. `[1, 0:3, 768]` have values, all the others are zeros. This is due to the fact that BERT considers "hello world!" as four tokens: `[CLS]` `hello` `world!` `[SEP]`, the rest are padding symbols and are masked out before output.

  Note that there is no need to start a separate server for handling tokenized/untokenized sentences. The server can tell and handle both cases automatically.

  Sometimes you want to know explicitly the tokenization performed on the server side to have better understanding of the embedding result. One such case is asking word embedding from the server (with `-pooling_strategy NONE`), one wants to tell which word is tokenized and which is unrecognized. You can get such information with the following steps:

   1. enabling `-show_tokens_to_client` on the server side;
   2. calling the server via `encode(..., show_tokens=True)`.

  For example, a basic usage like

  ```python
  bc.encode(['hello world!', 'thisis it'], show_tokens=True)
  ```
  returns a tuple, where the first element is the embedding and the second is the tokenization result from the server:

  ```text
  (array([[[ 0.        , -0.        ,  0.        , ...,  0.        , -0.        , -0.        ],
          [ 1.1100919 , -0.20474958,  0.9895898 , ...,  0.3873255  , -1.4093989 , -0.47620595],
          ..., -0.        , -0.        ]],

         [[ 0.        , -0.        ,  0.        , ...,  0.        , 0.        ,  0.        ],
          [ 0.6293478 , -0.4088499 ,  0.6022662 , ...,  0.41740108, 1.214456  ,  1.2532915 ],
          ..., 0.        ,  0.        ]]], dtype=float32),

            [['[CLS]', 'hello', 'world', '!', '[SEP]'], ['[CLS]', 'this', '##is', 'it', '[SEP]']])
  ```

  When using your own tokenization, you may still want to check if the server respects your tokens. For example,
  ```python
  bc.encode([['hello', 'world!'], ['thisis', 'it']], show_tokens=True, is_tokenized=True)
  ```
  returns:

  ```text
  (array([[[ 0.        , -0.        ,  0.        , ...,  0.       ,  -0.        ,  0.        ],
          [ 1.1111546 , -0.56572634,  0.37183186, ...,  0.02397121,  -0.5445367 ,  1.1009651 ],
          ..., -0.        ,  0.        ]],

         [[ 0.        ,  0.        ,  0.        , ...,  0.        ,  -0.        ,  0.        ],
          [ 0.39262453,  0.3782491 ,  0.27096173, ...,  0.7122045 ,  -0.9874849 ,  0.9318679 ],
          ..., -0.        ,  0.        ]]], dtype=float32),

           [['[CLS]', 'hello', '[UNK]', '[SEP]'], ['[CLS]', '[UNK]', 'it', '[SEP]']])
  ```

  One can observe that `world!` and `thisis` are not recognized on the server, hence they are set to `[UNK]`.

  Finally, beware that the pretrained BERT Chinese from Google is character-based, i.e. its vocabulary is made of single Chinese characters. Therefore it makes no sense if you use word-level segmentation algorithm to pre-process the data and feed to such model.

  Extremely curious readers may notice that the first row in the above example is all-zero even though the tokenization result includes `[CLS]` (well done, detective!). The reason is that the tokenization result will **always** includes `[CLS]` and `[UNK]` regardless the setting of `-mask_cls_sep`. This could be useful when you want to align the tokens afterwards. Remember, `-mask_cls_sep` only masks `[CLS]` and `[SEP]` out of the computation. It doesn't affect the tokenization algorithm.




  > The complete example can [be found example4.py](example/example4.py). There is also [an example in Keras](https://github.com/hanxiao/bert-as-service/issues/29#issuecomment-442362241).

  The [`tf.data`](https://www.tensorflow.org/guide/datasets) API enables you to build complex input pipelines from simple, reusable pieces. One can also use `BertClient` to encode sentences on-the-fly and use the vectors in a downstream model. Here is an example:

  ```python
  batch_size = 256
  num_parallel_calls = 4
  num_clients = num_parallel_calls * 2  # should be at least greater than `num_parallel_calls`


  bc_clients = [BertClient(show_server_config=False) for _ in range(num_clients)]


  def get_encodes(x):
      
      samples = [json.loads(l) for l in x]
      text = [s['raw_text'] for s in samples]  # List[List[str]]
      labels = [s['label'] for s in samples]  # List[str]
      
      bc_client = bc_clients.pop()
      features = bc_client.encode(text)
      
      bc_clients.append(bc_client)
      return features, labels


  ds = (tf.data.TextLineDataset(train_fp).batch(batch_size)
          .map(lambda x: tf.py_func(get_encodes, [x], [tf.float32, tf.string]),  num_parallel_calls=num_parallel_calls)
          .map(lambda x, y: {'feature': x, 'label': y})
          .make_one_shot_iterator().get_next())
  ```

  The trick here is to start a pool of `BertClient` and reuse them one by one. In this way, we can fully harness the power of `num_parallel_calls` of `Dataset.map()` API.




  > The complete example can [be found example5.py](example/example5.py).

  Following the last example, we can easily extend it to a full classifier using `tf.estimator` API. One only need minor change on the input function as follows:

  ```python
  estimator = DNNClassifier(
      hidden_units=[512],
      feature_columns=[tf.feature_column.numeric_column('feature', shape=(768,))],
      n_classes=len(laws),
      config=run_config,
      label_vocabulary=laws_str,
      dropout=0.1)

  input_fn = lambda fp: (tf.data.TextLineDataset(fp)
                         .apply(tf.contrib.data.shuffle_and_repeat(buffer_size=10000))
                         .batch(batch_size)
                         .map(lambda x: tf.py_func(get_encodes, [x], [tf.float32, tf.string]), num_parallel_calls=num_parallel_calls)
                         .map(lambda x, y: ({'feature': x}, y))
                         .prefetch(20))

  train_spec = TrainSpec(input_fn=lambda: input_fn(train_fp))
  eval_spec = EvalSpec(input_fn=lambda: input_fn(eval_fp), throttle_secs=0)
  train_and_evaluate(estimator, train_spec, eval_spec)
  ```

  The complete example can [be found example5.py](example/example5.py), in which a simple MLP is built on BERT features for predicting the relevant articles according to the fact description in the law documents. The problem is a part of the [Chinese AI and Law Challenge Competition](https://github.com/thunlp/CAIL/blob/master/README_en.md).




  > The complete example can [be found example6.py](example/example6.py).

  The TFRecord file format is a simple record-oriented binary format that many TensorFlow applications use for training data. You can also pre-encode all your sequences and store their encodings to a TFRecord file, then later load it to build a `tf.Dataset`. For example, to write encoding into a TFRecord file:

  ```python
  bc = BertClient()
  list_vec = bc.encode(lst_str)
  list_label = [0 for _ in lst_str]  # a dummy list of all-zero labels


  with tf.python_io.TFRecordWriter('tmp.tfrecord') as writer:
      def create_float_feature(values):
          return tf.train.Feature(float_list=tf.train.FloatList(value=values))

      def create_int_feature(values):
          return tf.train.Feature(int64_list=tf.train.Int64List(value=list(values)))

      for (vec, label) in zip(list_vec, list_label):
          features = {'features': create_float_feature(vec), 'labels': create_int_feature([label])}
          tf_example = tf.train.Example(features=tf.train.Features(feature=features))
          writer.write(tf_example.SerializeToString())
  ```

  Now we can load from it and build a `tf.Dataset`:
  ```python
  def _decode_record(record):
      """Decodes a record to a TensorFlow example."""
      return tf.parse_single_example(record, {
          'features': tf.FixedLenFeature([768], tf.float32),
          'labels': tf.FixedLenFeature([], tf.int64),
      })

  ds = (tf.data.TFRecordDataset('tmp.tfrecord').repeat().shuffle(buffer_size=100).apply(
      tf.contrib.data.map_and_batch(lambda record: _decode_record(record), batch_size=64))
        .make_one_shot_iterator().get_next())
  ```

  To save word/token-level embedding to TFRecord, one needs to first flatten `[max_seq_len, num_hidden]` tensor into an 1D array as follows:
  ```python
  def create_float_feature(values):
      return tf.train.Feature(float_list=tf.train.FloatList(value=values.reshape(-1)))
  ```
  And later reconstruct the shape when loading it:
  ```python
  name_to_features = {
      "feature": tf.FixedLenFeature([max_seq_length * num_hidden], tf.float32),
      "label_ids": tf.FixedLenFeature([], tf.int64),
  }

  def _decode_record(record, name_to_features):
      """Decodes a record to a TensorFlow example."""
      example = tf.parse_single_example(record, name_to_features)
      example['feature'] = tf.reshape(example['feature'], [max_seq_length, -1])
      return example
  ```
  Be careful, this will generate a huge TFRecord file.



  > The complete example can [be found example2.py](example/example2.py).

  `BertClient.encode()` offers a nice synchronous way to get sentence encodes. However,   sometimes we want to do it in an asynchronous manner by feeding all textual data to the server first, fetching the encoded results later. This can be easily done by:
  ```python

  def text_gen():
      while True:
          yield lst_str  # yield a batch of text lines

  bc = BertClient()


  for j in bc.encode_async(text_gen(), max_num_batch=10):
      print('received %d x %d' % (j.shape[0], j.shape[1]))
  ```



  > The complete example can [be found in example3.py](example/example3.py).

  The encoded result is routed to the client according to its identity. If you have multiple clients with same identity, then they all receive the results! You can use this *multicast* feature to do some cool things, e.g. training multiple different models (some using `scikit-learn` some using `tensorflow`) in multiple separated processes while only call `BertServer` once. In the example below, `bc` and its two clones will all receive encoded vector.

  ```python

  def client_clone(id, idx):
      bc = BertClient(identity=id)
      for j in bc.listen():
          print('clone-client-%d: received %d x %d' % (idx, j.shape[0], j.shape[1]))

  bc = BertClient()

  for j in range(2):
      threading.Thread(target=client_clone, args=(bc.identity, j)).start()

  for _ in range(3):
      bc.encode(lst_str)
  ```



  > The complete example can [be found in plugin/dashboard/](plugin/dashboard).

  As a part of the infrastructure, one may also want to monitor the service status and show it in a dashboard. To do that, we can use:
  ```python
  bc = BertClient(ip='server_ip')

  json.dumps(bc.server_status, ensure_ascii=False)
  ```

  This gives the current status of the server including number of requests, number of clients etc. in JSON format. The only thing remained is to start a HTTP server for returning this JSON to the frontend that renders it.

  Alternatively, one may simply expose an HTTP port when starting a server via:

  ```bash
  bert-serving-start -http_port 8001 -model_dir ...
  ```

  This will allow one to use javascript or `curl` to fetch the server status at port 8001.

  `plugin/dashboard/index.html` shows a simple dashboard based on Bootstrap and Vue.js.

  <p align="center"><img src=".github/dashboard.png?raw=true"/></p>



  Besides calling `bert-as-service` from Python, one can also call it via HTTP request in JSON. It is quite useful especially when low transport layer is prohibited. Behind the scene, `bert-as-service` spawns a Flask server in a separate process and then reuse a `BertClient` instance as a proxy to communicate with the ventilator.

  To enable the build-in HTTP server, we need to first (re)install the server with some extra Python dependencies:
  ```bash
  pip install -U bert-serving-server[http]
  ```

  Then simply start the server with:
  ```bash
  bert-serving-start -model_dir=/YOUR_MODEL -http_port 8125
  ```

  Done! Your server is now listening HTTP and TCP requests at port `8125` simultaneously!

  To send a HTTP request, first prepare the payload in JSON as following:
  ```json
  {
      "id": 123,
      "texts": ["hello world", "good day!"],
      "is_tokenized": false
  }
  ```
  , where `id` is a unique identifier helping you to synchronize the results; `is_tokenized` follows the meaning in [`BertClient` API](https://bert-as-service.readthedocs.io/en/latest/source/client.html#client.BertClient.encode_async) and `false` by default.

  Then simply call the server at `/encode` via HTTP POST request. You can use javascript or whatever, here is an example using `curl`:
  ```bash
  curl -X POST http://xx.xx.xx.xx:8125/encode \
    -H 'content-type: application/json' \
    -d '{"id": 123,"texts": ["hello world"], "is_tokenized": false}'
  ```
  , which returns a JSON:
  ```json
  {
      "id": 123,
      "results": [[768 float-list], [768 float-list]],
      "status": 200
  }
  ```

  To get the server's status and client's status, you can send GET requests at `/status/server` and `/status/client`, respectively.

  Finally, one may also config CORS to restrict the public access of the server by specifying `-cors` when starting `bert-serving-start`. By default `-cors=*`, meaning the server is public accessible.




  Besides shell, one can also start a `BertServer` from python. Simply do
  ```python
  from bert_serving.server.helper import get_args_parser
  from bert_serving.server import BertServer
  args = get_args_parser().parse_args(['-model_dir', 'YOUR_MODEL_PATH_HERE',
                                       '-port', '5555',
                                       '-port_out', '5556',
                                       '-max_seq_len', 'NONE',
                                       '-mask_cls_sep',
                                       '-cpu'])
  server = BertServer(args)
  server.start()
  ```

  Note that it's basically mirroring the arg-parsing behavior in CLI, so everything in that `.parse_args([])` list should be string, e.g. `['-port', '5555']` not `['-port', 5555]`.

  To shutdown the server, you may call the static method in `BertServer` class via:
  ```python
  BertServer.shutdown(port=5555)
  ```

  Or via shell CLI:
  ```bash
  bert-serving-terminate -port 5555
  ```

  This will terminate the server running on localhost at port 5555. You may also use it to terminate a remote server, see `bert-serving-terminate --help` for details.


  <h2 align="center">:speech_balloon: FAQ</h2>
  <p align="right"><a href="#bert-as-service"><sup>▴ Back to top</sup></a></p>

  [![ReadTheDoc](https://readthedocs.org/projects/bert-as-service/badge/?version=latest&style=for-the-badge)](https://bert-as-service.readthedocs.io/en/latest/section/faq.html)



  The design philosophy and technical details can be found [in my blog post](https://hanxiao.github.io/2019/01/02/Serving-Google-BERT-in-Production-using-Tensorflow-and-ZeroMQ/).



  **A:** [BERT code of this repo](server/bert_serving/server/bert/) is forked from the [original BERT repo](https://github.com/google-research/bert) with necessary modification, [especially in extract_features.py](server/bert_serving/server/bert/extract_features.py).


  In general, each sentence is translated to a 768-dimensional vector. Depending on the pretrained BERT you are using, `pooling_strategy` and `pooling_layer` the dimensions of the output vector could be different.



  **A:** Yes, pooling is required to get a fixed representation of a sentence. In the default strategy `REDUCE_MEAN`, I take the second-to-last hidden layer of all of the tokens in the sentence and do average pooling.



  **A:** Yes and no. On the one hand, Google pretrained BERT on Wikipedia data, thus should encode enough prior knowledge of the language into the model. Having such feature is not a bad idea. On the other hand, these prior knowledge is not specific to any particular domain. It should be totally reasonable if the performance is not ideal if you are using it on, for example, classifying legal cases. Nonetheless, you can always first fine-tune your own BERT on the downstream task and then use `bert-as-service` to extract the feature vectors efficiently. Keep in mind that `bert-as-service` is just a feature extraction service based on BERT. Nothing stops you from using a fine-tuned BERT.



  **A:** Sure! Just use a list of the layer you want to concatenate when calling the server. Example:

  ```bash
  bert-serving-start -pooling_layer -4 -3 -2 -1 -model_dir /tmp/english_L-12_H-768_A-12/
  ```



  **A:** Here is a table summarizes all pooling strategies I implemented. Choose your favorite one by specifying `bert-serving-start -pooling_strategy`.

  |Strategy|Description|
  |---|---|
  | `NONE` | no pooling at all, useful when you want to use word embedding instead of sentence embedding. This will results in a `[max_seq_len, 768]` encode matrix for a sequence.|
  | `REDUCE_MEAN` | take the average of the hidden state of encoding layer on the time axis |
  | `REDUCE_MAX` | take the maximum of the hidden state of encoding layer on the time axis |
  | `REDUCE_MEAN_MAX` | do `REDUCE_MEAN` and `REDUCE_MAX` separately and then concat them together on the last axis, resulting in 1536-dim sentence encodes |
  | `CLS_TOKEN` or `FIRST_TOKEN` | get the hidden state corresponding to `[CLS]`, i.e. the first token |
  | `SEP_TOKEN` or `LAST_TOKEN` | get the hidden state corresponding to `[SEP]`, i.e. the last token |



  **A:** Because a pre-trained model is not fine-tuned on any downstream tasks yet. In this case, the hidden state of `[CLS]` is not a good sentence representation. If later you fine-tune the model, you may use `[CLS]` as well.



  **A:** By default this service works on the second last layer, i.e. `pooling_layer=-2`. You can change it by setting `pooling_layer` to other negative values, e.g. -1 corresponds to the last layer.



  **A:** The last layer is too closed to the target functions (i.e. masked language model and next sentence prediction) during pre-training, therefore may be biased to those targets. If you question about this argument and want to use the last hidden layer anyway, please feel free to set `pooling_layer=-1`.



  **A:** It depends. Keep in mind that different BERT layers capture different information. To see that more clearly, here is a visualization on [UCI-News Aggregator Dataset](https://www.kaggle.com/uciml/news-aggregator-dataset), where I randomly sample 20K news titles; get sentence encodes from different layers and with different pooling strategies, finally reduce it to 2D via PCA (one can of course do t-SNE as well, but that's not my point). There are only four classes of the data, illustrated in red, blue, yellow and green. To reproduce the result, please run [example7.py](example/example7.py).

  <p align="center"><img src=".github/pool_mean.png?raw=true"></p>

  <p align="center"><img src=".github/pool_max.png?raw=true"></p>

  Intuitively, `pooling_layer=-1` is close to the training output, so it may be biased to the training targets. If you don't fine tune the model, then this could lead to a bad representation. `pooling_layer=-12` is close to the word embedding, may preserve the very original word information (with no fancy self-attention etc.). On the other hand, you may achieve the very same performance by simply using a word-embedding only. That said, anything in-between [-1, -12] is then a trade-off.



  **A:** For sure. But if you introduce new `tf.variables` to the graph, then you need to train those variables before using the model. You may also want to check [some pooling techniques I mentioned in my blog post](https://hanxiao.github.io/2018/06/24/4-Encoding-Blocks-You-Need-to-Know-Besides-LSTM-RNN-in-Tensorflow/#pooling-block).



  No, not at all. Just do `encode` and let the server handles the rest. If the batch is too large, the server will do batching automatically and it is more efficient than doing it by yourself. No matter how many sentences you have, 10K or 100K, as long as you can hold it in client's memory, just send it to the server. Please also read [the benchmark on the client batch size](https://github.com/hanxiao/bert-as-service#speed-wrt-client_batch_size).




  **A:** Yes! That's the purpose of this repo. In fact you can start as many clients as you want. One server can handle all of them (given enough time).



  **A:** The maximum number of concurrent requests is determined by `num_worker` in `bert-serving-start`. If you a sending more than `num_worker` requests concurrently, the new requests will be temporally stored in a queue until a free worker becomes available.



  **A:** No. One request means a list of sentences sent from a client. Think the size of a request as the batch size. A request may contain 256, 512 or 1024 sentences. The optimal size of a request is often determined empirically. One large request can certainly improve the GPU utilization, yet it also increases the overhead of transmission. You may run `python example/example1.py` for a simple benchmark.



  **A:** It highly depends on the `max_seq_len` and the size of a request. On a single Tesla M40 24GB with `max_seq_len=40`, you should get about 470 samples per second using a 12-layer BERT. In general, I'd suggest smaller `max_seq_len` (25) and larger request size (512/1024).



  **A:** Yes. See [Benchmark](#zap-benchmark).

  To reproduce the results, please run `bert-serving-benchmark`.



  **A:** [ZeroMQ](http://zeromq.org/).



  <img src=".github/bert-parallel-pipeline.png?raw=true" width="600">


  One port is for pushing text data into the server, the other port is for publishing the encoded result to the client(s). In this way, we get rid of back-chatter, meaning that at every level recipients never talk back to senders. The overall message flow is strictly one-way, as depicted in the above figure. Killing back-chatter is essential to real scalability, allowing us to use `BertClient` in an asynchronous way.



  **A:** No. Think of `BertClient` as a general feature extractor, whose output can be fed to *any* ML models, e.g. `scikit-learn`, `pytorch`, `tensorflow`. The only file that client need is [`client.py`](service/client.py). Copy this file to your project and import it, then you are ready to go.



  **A:** Yes.



  **A:** Yes. In fact, this is suggested. Make sure you have the following three items in `model_dir`:

  - A TensorFlow checkpoint (`bert_model.ckpt`) containing the pre-trained weights (which is actually 3 files).
  - A vocab file (`vocab.txt`) to map WordPiece to word id.
  - A config file (`bert_config.json`) which specifies the hyperparameters of the model.



  **A:** Server side no, client side yes. This is based on the consideration that python 2.x might still be a major piece in some tech stack. Migrating the whole downstream stack to python 3 for supporting `bert-as-service` can take quite some effort. On the other hand, setting up `BertServer` is just a one-time thing, which can be even [run in a docker container](#run-bert-service-on-nvidia-docker). To ease the integration, we support python 2 on the client side so that you can directly use `BertClient` as a part of your python 2 project, whereas the server side should always be hosted with python 3.



  No, if you are using [the pretrained Chinese BERT released by Google](https://github.com/google-research/bert#pre-trained-models) you don't need word segmentation. As this Chinese BERT is character-based model. It won't recognize word/phrase even if you intentionally add space in-between. To see that more clearly, this is what the BERT model actually receives after tokenization:

  ```python
  bc.encode(['hey you', 'whats up?', '你好么？', '我 还 可以'])
  ```

  ```
  tokens: [CLS] hey you [SEP]
  input_ids: 101 13153 8357 102 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  input_mask: 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

  tokens: [CLS] what ##s up ? [SEP]
  input_ids: 101 9100 8118 8644 136 102 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  input_mask: 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

  tokens: [CLS] 你 好 么 ？ [SEP]
  input_ids: 101 872 1962 720 8043 102 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  input_mask: 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

  tokens: [CLS] 我 还 可 以 [SEP]
  input_ids: 101 2769 6820 1377 809 102 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  input_mask: 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  ```

  That means the word embedding is actually the character embedding for Chinese-BERT.




  Because your word is out-of-vocabulary (OOV). The tokenizer from Google uses a greedy longest-match-first algorithm to perform tokenization using the given vocabulary.

  For example:
  ```python
  input = "unaffable"
  tokenizer_output = ["un", "##aff", "##able"]
  ```



  Yes. If you already tokenize the sentence on your own, simply send use `encode` with `List[List[Str]]` as input and turn on `is_tokenized`, i.e. `bc.encode(texts, is_tokenized=True)`.




  **A:** This is often due to the misuse of `BertClient` in multi-thread/process environment. Note that you can’t reuse one `BertClient` among multiple threads/processes, you have to make a separate instance for each thread/process. For example, the following won't work at all:

  ```python

  bc = BertClient()


  bc.encode(lst_str)


  bc.encode(lst_str)
  ```

  Instead, please do:

  ```python

  bc1 = BertClient()
  bc1.encode(lst_str)


  bc2 = BertClient()
  bc2.encode(lst_str)
  ```



  **A:** These folders are used by ZeroMQ to store sockets. You can choose a different location by setting the environment variable `ZEROMQ_SOCK_TMP_DIR` :
  `export ZEROMQ_SOCK_TMP_DIR=/tmp/`



  **A:** A decent representation for a downstream task doesn't mean that it will be meaningful in terms of cosine distance. Since cosine distance is a linear space where all dimensions are weighted equally. if you want to use cosine distance anyway, then please focus on the rank not the absolute value. Namely, do not use:
  ```
  if cosine(A, B) > 0.9, then A and B are similar
  ```
  Please consider the following instead:
  ```
  if cosine(A, B) > cosine(A, C), then A is more similar to B than C.
  ```

  The graph below illustrates the pairwise similarity of 3000 Chinese sentences randomly sampled from web (char. length < 25). We compute cosine similarity based on the sentence vectors and [Rouge-L](https://en.wikipedia.org/wiki/ROUGE_(metric)) based on the raw text. The diagonal (self-correlation) is removed for the sake of clarity. As one can see, there is some positive correlation between these two metrics.

  <p align="center"><img src=".github/cosine-vs-rougel.png?raw=true"/></p>




  **A:** This often suggests that the pretrained BERT could not generate a descent representation of your downstream task. Thus, you can fine-tune the model on the downstream task and then use `bert-as-service` to serve the fine-tuned BERT. Note that, `bert-as-service` is just a feature extraction service based on BERT. Nothing stops you from using a fine-tuned BERT.



  **A:** Yes, please run `bert-serving-start -cpu -max_batch_size 16`. Note that, CPU does not scale as good as GPU on large batches, therefore the `max_batch_size` on the server side needs to be smaller, e.g. 16 or 32.



  **A:** Generally, the number of workers should be less than or equal to the number of GPU/CPU you have. Otherwise, multiple workers will be allocated to one GPU/CPU, which may not scale well (and may cause out-of-memory on GPU).



  **A:** Yes, you can specifying `-device_map` as follows:
  ```bash
  bert-serving-start -device_map 0 1 4 -num_worker 4 -model_dir ...
  ```
  This will start four workers and allocate them to GPU0, GPU1, GPU4 and again GPU0, respectively. In general, if `num_worker` > `device_map`, then devices will be reused and shared by the workers (may scale suboptimally or cause OOM); if `num_worker` < `device_map`, only `device_map[:num_worker]` will be used.

  Note, `device_map` is ignored when running on CPU.

  <h2 align="center">:zap: Benchmark</h2>
  <p align="right"><a href="#bert-as-service"><sup>▴ Back to top</sup></a></p>

  [![ReadTheDoc](https://readthedocs.org/projects/bert-as-service/badge/?version=latest&style=for-the-badge)](https://bert-as-service.readthedocs.io/en/latest/section/benchmark.html)

  The primary goal of benchmarking is to test the scalability and the speed of this service, which is crucial for using it in a dev/prod environment. Benchmark was done on Tesla M40 24GB, experiments were repeated 10 times and the average value is reported.

  To reproduce the results, please run
  ```bash
  bert-serving-benchmark --help
  ```

  Common arguments across all experiments are:

  | Parameter         | Value |
  |-------------------|-------|
  | num_worker        | 1,2,4 |
  | max_seq_len       | 40    |
  | client_batch_size | 2048  |
  | max_batch_size    | 256   |
  | num_client        | 1     |



  `max_seq_len` is a parameter on the server side, which controls the maximum length of a sequence that a BERT model can handle. Sequences larger than `max_seq_len` will be truncated on the left side. Thus, if your client want to send long sequences to the model, please make sure the server can handle them correctly.

  Performance-wise, longer sequences means slower speed and  more chance of OOM, as the multi-head self-attention (the core unit of BERT) needs to do dot products and matrix multiplications between every two symbols in the sequence.

  <img src=".github/max_seq_len.png?raw=true" width="600">

  | `max_seq_len` | 1 GPU | 2 GPU | 4 GPU |
  |---------------|-------|-------|-------|
  | 20            | 903   | 1774  | 3254  |
  | 40            | 473   | 919   | 1687  |
  | 80            | 231   | 435   | 768   |
  | 160           | 119   | 237   | 464   |
  | 320           | 54    | 108   | 212   |



  `client_batch_size` is the number of sequences from a client when invoking `encode()`. For performance reason, please consider encoding sequences in batch rather than encoding them one by one.

  For example, do:
  ```python

  bc = BertClient()
  my_sentences = [s for s in my_corpus.iter()]

  vec = bc.encode(my_sentences)
  ```

  DON'T:
  ```python
  bc = BertClient()
  vec = []
  for s in my_corpus.iter():
      vec.append(bc.encode(s))
  ```

  It's even worse if you put `BertClient()` inside the loop. Don't do that.

  <img src=".github/client_batch_size.png?raw=true" width="600">

  | `client_batch_size` | 1 GPU | 2 GPU | 4 GPU |
  |---------------------|-------|-------|-------|
  | 1                   | 75    | 74    | 72    |
  | 4                   | 206   | 205   | 201   |
  | 8                   | 274   | 270   | 267   |
  | 16                  | 332   | 329   | 330   |
  | 64                  | 365   | 365   | 365   |
  | 256                 | 382   | 383   | 383   |
  | 512                 | 432   | 766   | 762   |
  | 1024                | 459   | 862   | 1517  |
  | 2048                | 473   | 917   | 1681  |
  | 4096                | 481   | 943   | 1809  |




  `num_client` represents the number of concurrent clients connected to the server at the same time.

  <img src=".github/num_clients.png?raw=true" width="600">

  | `num_client` | 1 GPU | 2 GPU | 4 GPU |
  |--------------|-------|-------|-------|
  | 1            | 473   | 919   | 1759  |
  | 2            | 261   | 512   | 1028  |
  | 4            | 133   | 267   | 533   |
  | 8            | 67    | 136   | 270   |
  | 16           | 34    | 68    | 136   |
  | 32           | 17    | 34    | 68    |

  As one can observe, 1 clients 1 GPU = 381 seqs/s, 2 clients 2 GPU 402 seqs/s, 4 clients 4 GPU 413 seqs/s. This shows the efficiency of our parallel pipeline and job scheduling, as the service can leverage the GPU time  more exhaustively as concurrent requests increase.




  `max_batch_size` is a parameter on the server side, which controls the maximum number of samples per batch per worker. If a incoming batch from client is larger than `max_batch_size`, the server will split it into small batches so that each of them is less or equal than `max_batch_size` before sending it to workers.

  <img src=".github/max_batch_size.png?raw=true" width="600">

  | `max_batch_size` | 1 GPU | 2 GPU | 4 GPU |
  |------------------|-------|-------|-------|
  | 32               | 450   | 887   | 1726  |
  | 64               | 459   | 897   | 1759  |
  | 128              | 473   | 931   | 1816  |
  | 256              | 473   | 919   | 1688  |
  | 512              | 464   | 866   | 1483  |




  `pooling_layer` determines the encoding layer that pooling operates on. For example, in a 12-layer BERT model, `-1` represents the layer closed to the output, `-12` represents the layer closed to the embedding layer. As one can observe below, the depth of the pooling layer affects the speed.

  <img src=".github/pooling_layer.png?raw=true" width="600">

  | `pooling_layer` | 1 GPU | 2 GPU | 4 GPU |
  |-----------------|-------|-------|-------|
  | [-1]            | 438   | 844   | 1568  |
  | [-2]            | 475   | 916   | 1686  |
  | [-3]            | 516   | 995   | 1823  |
  | [-4]            | 569   | 1076  | 1986  |
  | [-5]            | 633   | 1193  | 2184  |
  | [-6]            | 711   | 1340  | 2430  |
  | [-7]            | 820   | 1528  | 2729  |
  | [-8]            | 945   | 1772  | 3104  |
  | [-9]            | 1128  | 2047  | 3622  |
  | [-10]           | 1392  | 2542  | 4241  |
  | [-11]           | 1523  | 2737  | 4752  |
  | [-12]           | 1568  | 2985  | 5303  |




  `bert-as-service` supports two additional optimizations: half-precision and XLA, which can be turned on by adding `-fp16` and `-xla` to `bert-serving-start`, respectively. To enable these two options, you have to meet the following requirements:

  - your GPU supports FP16 instructions;
  - your Tensorflow is self-compiled with XLA and `-march=native`;
  - your CUDA and cudnn are not too old.

  On Tesla V100 with `tensorflow=1.13.0-rc0` it gives:

  <img src=".github/fp16-xla.svg" width="600">

  FP16 achieves ~1.4x speedup (round-trip) comparing to the FP32 counterpart. To reproduce the result, please run `python example/example1.py`.


  <h2 align="center">Citing</h2>
  <p align="right"><a href="#bert-as-service"><sup>▴ Back to top</sup></a></p>

  If you use bert-as-service in a scientific publication, we would appreciate references to the following BibTex entry:

  ```latex
  @misc{xiao2018bertservice,
    title={bert-as-service},
    author={Xiao, Han},
    howpublished={\url{https://github.com/hanxiao/bert-as-service}},
    year={2018}
  }
  ```


pkgId: cfbfe1277f873fd98feabc92cd996730954e1d915fb1e5dcd1fb2d3893fe6e6e
name: python-bertopic
arch: src
version: 0.16.3
epoch: 0
release: 1
summary: BERTopic performs topic Modeling with state-of-the-art transformer models.
url: https://github.com/MaartenGr/BERTopic
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bertopic-0.16.3-1.src.rpm
checksum_type: sha256
description:
  [![PyPI - Python](https://img.shields.io/badge/python-v3.8+-blue.svg)](https://pypi.org/project/bertopic/)
  [![Build](https://img.shields.io/github/actions/workflow/status/MaartenGr/BERTopic/testing.yml?branch=master)](https://github.com/MaartenGr/BERTopic/actions)
  [![docs](https://img.shields.io/badge/docs-Passing-green.svg)](https://maartengr.github.io/BERTopic/)
  [![PyPI - PyPi](https://img.shields.io/pypi/v/BERTopic)](https://pypi.org/project/bertopic/)
  [![PyPI - License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/MaartenGr/VLAC/blob/master/LICENSE)
  [![arXiv](https://img.shields.io/badge/arXiv-2203.05794-<COLOR>.svg)](https://arxiv.org/abs/2203.05794)




  <img src="images/logo.png" width="35%" height="35%" align="right" />

  BERTopic is a topic modeling technique that leverages 🤗 transformers and c-TF-IDF to create dense clusters
  allowing for easily interpretable topics whilst keeping important words in the topic descriptions.

  BERTopic supports all kinds of topic modeling techniques:
  <table>
    <tr>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/guided/guided.html">Guided</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/supervised/supervised.html">Supervised</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/semisupervised/semisupervised.html">Semi-supervised</a></td>
   </tr>
     <tr>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/manual/manual.html">Manual</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/distribution/distribution.html">Multi-topic distributions</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/hierarchicaltopics/hierarchicaltopics.html">Hierarchical</a></td>
   </tr>
   <tr>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/topicsperclass/topicsperclass.html">Class-based</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/topicsovertime/topicsovertime.html">Dynamic</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/online/online.html">Online/Incremental</a></td>
   </tr>
   <tr>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/multimodal/multimodal.html">Multimodal</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/multiaspect/multiaspect.html">Multi-aspect</a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/representation/llm.html">Text Generation/LLM</a></td>
   </tr>
   <tr>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/zeroshot/zeroshot.html">Zero-shot <b>(new!)</b></a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/merge/merge.html">Merge Models <b>(new!)</b></a></td>
      <td><a href="https://maartengr.github.io/BERTopic/getting_started/seed_words/seed_words.html">Seed Words <b>(new!)</b></a></td>
   </tr>
  </table>

  Corresponding medium posts can be found [here](https://towardsdatascience.com/topic-modeling-with-bert-779f7db187e6?source=friends_link&sk=0b5a470c006d1842ad4c8a3057063a99), [here](https://towardsdatascience.com/interactive-topic-modeling-with-bertopic-1ea55e7d73d8?sk=03c2168e9e74b6bda2a1f3ed953427e4) and [here](https://towardsdatascience.com/using-whisper-and-bertopic-to-model-kurzgesagts-videos-7d8a63139bdf?sk=b1e0fd46f70cb15e8422b4794a81161d). For a more detailed overview, you can read the [paper](https://arxiv.org/abs/2203.05794) or see a [brief overview](https://maartengr.github.io/BERTopic/algorithm/algorithm.html).



  Installation, with sentence-transformers, can be done using [pypi](https://pypi.org/project/bertopic/):

  ```bash
  pip install bertopic
  ```

  If you want to install BERTopic with other embedding models, you can choose one of the following:

  ```bash

  pip install bertopic[flair,gensim,spacy,use]


  pip install bertopic[vision]
  ```


  For an in-depth overview of the features of BERTopic
  you can check the [**full documentation**](https://maartengr.github.io/BERTopic/) or you can follow along
  with one of the examples below:

  | Name  | Link  |
  |---|---|
  | Start Here - **Best Practices in BERTopic**  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1BoQ_vakEVtojsd2x_U6-_x52OOuqruj2?usp=sharing)  |
  | **🆕 New!** - Topic Modeling on Large Data (GPU Acceleration)  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1W7aEdDPxC29jP99GGZphUlqjMFFVKtBC?usp=sharing)  |
  | **🆕 New!** - Topic Modeling with Llama 2 🦙 | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1QCERSMUjqGetGGujdrvv_6_EeoIcd_9M?usp=sharing)  |
  | **🆕 New!** - Topic Modeling with Quantized LLMs | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1DdSHvVPJA3rmNfBWjCo2P1E9686xfxFx?usp=sharing)  |
  | Topic Modeling with BERTopic  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1FieRA9fLdkQEGDIMYl0I3MCjSUKVF8C-?usp=sharing)  |
  | (Custom) Embedding Models in BERTopic  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/18arPPe50szvcCp_Y6xS56H2tY0m-RLqv?usp=sharing) |
  | Advanced Customization in BERTopic  |  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ClTYut039t-LDtlcd-oQAdXWgcsSGTw9?usp=sharing) |
  | (semi-)Supervised Topic Modeling with BERTopic  |  [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1bxizKzv5vfxJEB29sntU__ZC7PBSIPaQ?usp=sharing)  |
  | Dynamic Topic Modeling with Trump's Tweets  | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1un8ooI-7ZNlRoK0maVkYhmNRl0XGK88f?usp=sharing)  |
  | Topic Modeling arXiv Abstracts | [![Kaggle](https://img.shields.io/static/v1?style=for-the-badge&message=Kaggle&color=222222&logo=Kaggle&logoColor=20BEFF&label=)](https://www.kaggle.com/maartengr/topic-modeling-arxiv-abstract-with-bertopic) |



  We start by extracting topics from the well-known 20 newsgroups dataset containing English documents:

  ```python
  from bertopic import BERTopic
  from sklearn.datasets import fetch_20newsgroups

  docs = fetch_20newsgroups(subset='all',  remove=('headers', 'footers', 'quotes'))['data']

  topic_model = BERTopic()
  topics, probs = topic_model.fit_transform(docs)
  ```

  After generating topics and their probabilities, we can access all of the topics together with their topic representations:

  ```python
  >>> topic_model.get_topic_info()

  Topic	Count	Name
  -1	4630	-1_can_your_will_any
  0	693	49_windows_drive_dos_file
  1	466	32_jesus_bible_christian_faith
  2	441	2_space_launch_orbit_lunar
  3	381	22_key_encryption_keys_encrypted
  ...
  ```

  The `-1` topic refers to all outlier documents and are typically ignored. Each word in a topic describes the underlying theme of that topic and can be used
  for interpreting that topic. Next, let's take a look at the most frequent topic that was generated:

  ```python
  >>> topic_model.get_topic(0)

  [('windows', 0.006152228076250982),
   ('drive', 0.004982897610645755),
   ('dos', 0.004845038866360651),
   ('file', 0.004140142872194834),
   ('disk', 0.004131678774810884),
   ('mac', 0.003624848635985097),
   ('memory', 0.0034840976976789903),
   ('software', 0.0034415334250699077),
   ('email', 0.0034239554442333257),
   ('pc', 0.003047105930670237)]
  ```

  Using `.get_document_info`, we can also extract information on a document level, such as their corresponding topics, probabilities, whether they are representative documents for a topic, etc.:

  ```python
  >>> topic_model.get_document_info(docs)

  Document                               Topic	Name	                        Top_n_words                     Probability    ...
  I am sure some bashers of Pens...	0	0_game_team_games_season	game - team - games...	        0.200010       ...
  My brother is in the market for...      -1     -1_can_your_will_any	        can - your - will...	        0.420668       ...
  Finally you said what you dream...	-1     -1_can_your_will_any	        can - your - will...            0.807259       ...
  Think! It's the SCSI card doing...	49     49_windows_drive_dos_file	windows - drive - docs...	0.071746       ...
  1) I have an old Jasmine drive...	49     49_windows_drive_dos_file	windows - drive - docs...	0.038983       ...
  ```

  **`🔥 Tip`**: Use `BERTopic(language="multilingual")` to select a model that supports 50+ languages.



  In BERTopic, there are a number of different [topic representations](https://maartengr.github.io/BERTopic/getting_started/representation/representation.html) that we can choose from. They are all quite different from one another and give interesting perspectives and variations of topic representations. A great start is `KeyBERTInspired`, which for many users increases the coherence and reduces stopwords from the resulting topic representations:

   ```python
  from bertopic.representation import KeyBERTInspired


  representation_model = KeyBERTInspired()
  topic_model = BERTopic(representation_model=representation_model)
  ```

  However, you might want to use something more powerful to describe your clusters. You can even use ChatGPT or other models from OpenAI to generate labels, summaries, phrases, keywords, and more:

  ```python
  import openai
  from bertopic.representation import OpenAI


  client = openai.OpenAI(api_key="sk-...")
  representation_model = OpenAI(client, model="gpt-3.5-turbo", chat=True)
  topic_model = BERTopic(representation_model=representation_model)
  ```

  **`🔥 Tip`**: Instead of iterating over all of these different topic representations, you can model them simultaneously with [multi-aspect topic representations](https://maartengr.github.io/BERTopic/getting_started/multiaspect/multiaspect.html) in BERTopic.



  After having trained our BERTopic model, we can iteratively go through hundreds of topics to get a good
  understanding of the topics that were extracted. However, that takes quite some time and lacks a global representation. Instead, we can use one of the [many visualization options](https://maartengr.github.io/BERTopic/getting_started/visualization/visualization.html) in BERTopic.
  For example, we can visualize the topics that were generated in a way very similar to
  [LDAvis](https://github.com/cpsievert/LDAvis):

  ```python
  topic_model.visualize_topics()
  ```

  <img src="images/topic_visualization.gif" width="60%" height="60%" align="center" />


  By default, the [main steps](https://maartengr.github.io/BERTopic/algorithm/algorithm.html) for topic modeling with BERTopic are sentence-transformers, UMAP, HDBSCAN, and c-TF-IDF run in sequence. However, it assumes some independence between these steps which makes BERTopic quite modular. In other words, BERTopic not only allows you to build your own topic model but to explore several topic modeling techniques on top of your customized topic model:

  https://user-images.githubusercontent.com/25746895/218420473-4b2bb539-9dbe-407a-9674-a8317c7fb3bf.mp4

  You can swap out any of these models or even remove them entirely. The following steps are completely modular:

  1. [Embedding](https://maartengr.github.io/BERTopic/getting_started/embeddings/embeddings.html) documents
  2. [Reducing dimensionality](https://maartengr.github.io/BERTopic/getting_started/dim_reduction/dim_reduction.html) of embeddings
  3. [Clustering](https://maartengr.github.io/BERTopic/getting_started/clustering/clustering.html) reduced embeddings into topics
  4. [Tokenization](https://maartengr.github.io/BERTopic/getting_started/vectorizers/vectorizers.html) of topics
  5. [Weight](https://maartengr.github.io/BERTopic/getting_started/ctfidf/ctfidf.html) tokens
  6. [Represent topics](https://maartengr.github.io/BERTopic/getting_started/representation/representation.html) with one or [multiple](https://maartengr.github.io/BERTopic/getting_started/multiaspect/multiaspect.html) representations



  BERTopic has many functions that quickly can become overwhelming. To alleviate this issue, you will find an overview
  of all methods and a short description of its purpose.


  Below, you will find an overview of common functions in BERTopic.

  | Method | Code  |
  |-----------------------|---|
  | Fit the model    |  `.fit(docs)` |
  | Fit the model and predict documents  |  `.fit_transform(docs)` |
  | Predict new documents    |  `.transform([new_doc])` |
  | Access single topic   | `.get_topic(topic=12)`  |
  | Access all topics     |  `.get_topics()` |
  | Get topic freq    |  `.get_topic_freq()` |
  | Get all topic information|  `.get_topic_info()` |
  | Get all document information|  `.get_document_info(docs)` |
  | Get representative docs per topic |  `.get_representative_docs()` |
  | Update topic representation | `.update_topics(docs, n_gram_range=(1, 3))` |
  | Generate topic labels | `.generate_topic_labels()` |
  | Set topic labels | `.set_topic_labels(my_custom_labels)` |
  | Merge topics | `.merge_topics(docs, topics_to_merge)` |
  | Reduce nr of topics | `.reduce_topics(docs, nr_topics=30)` |
  | Reduce outliers | `.reduce_outliers(docs, topics)` |
  | Find topics | `.find_topics("vehicle")` |
  | Save model    |  `.save("my_model", serialization="safetensors")` |
  | Load model    |  `BERTopic.load("my_model")` |
  | Get parameters |  `.get_params()` |



  After having trained your BERTopic model, several attributes are saved within your model. These attributes, in part,
  refer to how model information is stored on an estimator during fitting. The attributes that you see below all end in `_` and are
  public attributes that can be used to access model information.

  | Attribute | Description |
  |------------------------|---------------------------------------------------------------------------------------------|
  | `.topics_`               | The topics that are generated for each document after training or updating the topic model. |
  | `.probabilities_` | The probabilities that are generated for each document if HDBSCAN is used. |
  | `.topic_sizes_`           | The size of each topic                                                                      |
  | `.topic_mapper_`          | A class for tracking topics and their mappings anytime they are merged/reduced.             |
  | `.topic_representations_` | The top *n* terms per topic and their respective c-TF-IDF values.                           |
  | `.c_tf_idf_`              | The topic-term matrix as calculated through c-TF-IDF.                                       |
  | `.topic_aspects_`          | The different aspects, or representations, of each topic.                                  |
  | `.topic_labels_`          | The default labels for each topic.                                                          |
  | `.custom_labels_`         | Custom labels for each topic as generated through `.set_topic_labels`.                      |
  | `.topic_embeddings_`      | The embeddings for each topic if `embedding_model` was used.                                |
  | `.representative_docs_`   | The representative documents for each topic if HDBSCAN is used.                             |



  There are many different use cases in which topic modeling can be used. As such, several variations of BERTopic have been developed such that one package can be used across many use cases.

  | Method | Code  |
  |-----------------------|---|
  | [Topic Distribution Approximation](https://maartengr.github.io/BERTopic/getting_started/distribution/distribution.html) | `.approximate_distribution(docs)` |
  | [Online Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/online/online.html) | `.partial_fit(doc)` |
  | [Semi-supervised Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/semisupervised/semisupervised.html) | `.fit(docs, y=y)` |
  | [Supervised Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/supervised/supervised.html) | `.fit(docs, y=y)` |
  | [Manual Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/manual/manual.html) | `.fit(docs, y=y)` |
  | [Multimodal Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/multimodal/multimodal.html) | ``.fit(docs, images=images)`` |
  | [Topic Modeling per Class](https://maartengr.github.io/BERTopic/getting_started/topicsperclass/topicsperclass.html) | `.topics_per_class(docs, classes)` |
  | [Dynamic Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/topicsovertime/topicsovertime.html) | `.topics_over_time(docs, timestamps)` |
  | [Hierarchical Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/hierarchicaltopics/hierarchicaltopics.html) | `.hierarchical_topics(docs)` |
  | [Guided Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/guided/guided.html) | `BERTopic(seed_topic_list=seed_topic_list)` |
  | [Zero-shot Topic Modeling](https://maartengr.github.io/BERTopic/getting_started/zeroshot/zeroshot.html) | `BERTopic(zeroshot_topic_list=zeroshot_topic_list)` |
  | [Merge Multiple Models](https://maartengr.github.io/BERTopic/getting_started/merge/merge.html) | `BERTopic.merge_models([topic_model_1, topic_model_2])` |



  Evaluating topic models can be rather difficult due to the somewhat subjective nature of evaluation.
  Visualizing different aspects of the topic model helps in understanding the model and makes it easier
  to tweak the model to your liking.

  | Method | Code  |
  |-----------------------|---|
  | Visualize Topics    |  `.visualize_topics()` |
  | Visualize Documents    |  `.visualize_documents()` |
  | Visualize Document Hierarchy    |  `.visualize_hierarchical_documents()` |
  | Visualize Topic Hierarchy    |  `.visualize_hierarchy()` |
  | Visualize Topic Tree   |  `.get_topic_tree(hierarchical_topics)` |
  | Visualize Topic Terms    |  `.visualize_barchart()` |
  | Visualize Topic Similarity  |  `.visualize_heatmap()` |
  | Visualize Term Score Decline  |  `.visualize_term_rank()` |
  | Visualize Topic Probability Distribution    |  `.visualize_distribution(probs[0])` |
  | Visualize Topics over Time   |  `.visualize_topics_over_time(topics_over_time)` |
  | Visualize Topics per Class | `.visualize_topics_per_class(topics_per_class)` |



  To cite the [BERTopic paper](https://arxiv.org/abs/2203.05794), please use the following bibtex reference:

  ```bibtext
  @article{grootendorst2022bertopic,
    title={BERTopic: Neural topic modeling with a class-based TF-IDF procedure},
    author={Grootendorst, Maarten},
    journal={arXiv preprint arXiv:2203.05794},
    year={2022}
  }
  ```

rpm_license:
  MIT License  Copyright (c) 2024, Maarten P. Grootendorst  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


pkgId: 9e10f548c1d51c5a625192476f2513fa7478898f4b0e00ab52ca41a189b8fa3e
name: python-bertviz
arch: src
version: 1.4.0
epoch: 0
release: 1
summary: Attention visualization tool for NLP Transformer models.
url: https://github.com/jessevig/bertviz
rpm_license: Apache 2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bertviz-1.4.0-1.src.rpm
checksum_type: sha256
description:
  <h1 align="center">
      BertViz
  </h1>
  <h3 align="center">
   Visualize Attention in NLP Models
  </h3>
  <h3 align="center">
      <a href="#-quick-tour">Quick Tour</a> &bull;
      <a href="#%EF%B8%8F-getting-started">Getting Started</a> &bull;
      <a href="https://colab.research.google.com/drive/1hXIQ77A4TYS4y3UthWF-Ci7V7vVUoxmQ?usp=sharing">Colab Tutorial</a> &bull;
      <a href="https://towardsdatascience.com/deconstructing-bert-part-2-visualizing-the-inner-workings-of-attention-60a16d86b5c1">Blog</a> &bull;
      <a href="https://www.aclweb.org/anthology/P19-3007.pdf">Paper</a> &bull;
      <a href="#-paper">Citation</a>
  </h3>

  BertViz is an interactive tool for visualizing attention in [Transformer](https://jalammar.github.io/illustrated-transformer/) language models such as BERT, GPT2, or T5. It can be run inside a Jupyter or Colab
   notebook through a simple Python API that supports most [Huggingface models](https://huggingface.co/models). BertViz extends the
     [Tensor2Tensor visualization tool](https://github.com/tensorflow/tensor2tensor/tree/master/tensor2tensor/visualization)
      by [Llion Jones](https://medium.com/@llionj), providing multiple views that each offer a unique lens into the attention mechanism.

  For updates on BertViz and related projects, feel free to follow me on [Twitter](https://twitter.com/jesse_vig).





  The *head view* visualizes attention for one or more attention heads in the same
   layer. It is based on the excellent [Tensor2Tensor visualization tool](https://github.com/tensorflow/tensor2tensor/tree/master/tensor2tensor/visualization) by [Llion Jones](https://medium.com/@llionj).

  🕹 Try out the head view in the [<b><u>Interactive Colab Tutorial</u></b>](https://colab.research.google.com/drive/1hXIQ77A4TYS4y3UthWF-Ci7V7vVUoxmQ?usp=sharing) (all visualizations pre-loaded).
  <p>
      <img src="https://raw.githubusercontent.com/jessevig/bertviz/master/images/head-view.gif" width="425"/>
  </p>




  The *model view* shows a bird's-eye view of attention across all layers and heads.

  🕹 Try out the model view in the [<b><u>Interactive Colab Tutorial</u></b>](https://colab.research.google.com/drive/1hXIQ77A4TYS4y3UthWF-Ci7V7vVUoxmQ?usp=sharing) (all visualizations pre-loaded).

  ![model view](https://raw.githubusercontent.com/jessevig/bertviz/master/images/model-view-noscroll.gif)


  The *neuron view* visualizes individual neurons in the query and key vectors and shows how they are used to compute attention.

  🕹 Try out the neuron view in the [<b><u>Interactive Colab Tutorial</u></b>](https://colab.research.google.com/drive/1hXIQ77A4TYS4y3UthWF-Ci7V7vVUoxmQ?usp=sharing) (all visualizations pre-loaded).


  ![neuron view](https://raw.githubusercontent.com/jessevig/bertviz/master/images/neuron-view-dark.gif)





  From the command line:

  ```bash
  pip install bertviz
  ```
  You must also have Jupyter Notebook and ipywidgets installed:

  ```bash
  pip install jupyterlab
  pip install ipywidgets
  ```
  (If you run into any issues installing Jupyter or ipywidgets, consult the documentation [here](https://jupyter.org/install) and [here](https://ipywidgets.readthedocs.io/en/stable/user_install.html).)

  To create a new Jupyter notebook, simply run:

  ```bash
  jupyter notebook
  ```

  Then click `New` and select `Python 3 (ipykernel)` if prompted.




  To run in [Colab](https://colab.research.google.com/), simply add the following cell at the beginning of your Colab notebook:

  ```
  !pip install bertviz
  ```


  Run the following code to load the `xtremedistil-l12-h384-uncased` model and display it in the model view:

  ```python
  from transformers import AutoTokenizer, AutoModel, utils
  from bertviz import model_view
  utils.logging.set_verbosity_error()  # Suppress standard warnings

  model_name = "microsoft/xtremedistil-l12-h384-uncased"  # Find popular HuggingFace models here: https://huggingface.co/models
  input_text = "The cat sat on the mat"
  model = AutoModel.from_pretrained(model_name, output_attentions=True)  # Configure model to return attention values
  tokenizer = AutoTokenizer.from_pretrained(model_name)
  inputs = tokenizer.encode(input_text, return_tensors='pt')  # Tokenize input text
  outputs = model(inputs)  # Run model
  attention = outputs[-1]  # Retrieve attention from model outputs
  tokens = tokenizer.convert_ids_to_tokens(inputs[0])  # Convert input ids to token strings
  model_view(attention, tokens)  # Display model view
  ```

  The visualization may take a few seconds to load. Feel free to experiment with different input texts and
   [models](https://huggingface.co/models).
  See [Documentation](#-documentation) for additional use cases and examples, e.g., encoder-decoder models.



  You may also run any of the sample [notebooks](notebooks/) included with BertViz:

  ```bash
  git clone --depth 1 git@github.com:jessevig/bertviz.git
  cd bertviz/notebooks
  jupyter notebook
  ```


  Check out the [<b><u>Interactive Colab Tutorial</u></b>](https://colab.research.google.com/drive/1hXIQ77A4TYS4y3UthWF-Ci7V7vVUoxmQ?usp=sharing)
  to learn more about BertViz and try out the tool. <b>Note</b>: all visualizations are pre-loaded, so there is no need to execute any cells.

  [![Tutorial](https://raw.githubusercontent.com/jessevig/bertviz/master/images/tutorial-screenshots.jpg)](https://colab.research.google.com/drive/1hXIQ77A4TYS4y3UthWF-Ci7V7vVUoxmQ?usp=sharing)






  - [Self-attention models (BERT, GPT-2, etc.)](#self-attention-models-bert-gpt-2-etc)
    * [Head and Model Views](#head-and-model-views)
    * [Neuron View](#neuron-view-1)
  - [Encoder-decoder models (BART, T5, etc.)](#encoder-decoder-models-bart-t5-etc)
  - [Installing from source](#installing-from-source)
  - [Additional options](#additional-options)
    * [Dark / light mode](#dark--light-mode)
    * [Filtering layers](#filtering-layers)
    * [Setting default layer/head(s)](#setting-default-layer-head-s)
    * [Visualizing sentence pairs](#visualizing-sentence-pairs)
    * [Obtain HTML representations](#obtain-HTML-representations)
    * [Non-Huggingface models](#non-huggingface-models)




  First load a Huggingface model, either a pre-trained model as shown below, or your own fine-tuned model.
   Be sure to set `output_attentions=True`.
  ```python
  from transformers import AutoTokenizer, AutoModel, utils
  utils.logging.set_verbosity_error()  # Suppress standard warnings
  tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
  model = AutoModel.from_pretrained("bert-base-uncased", output_attentions=True)
  ```

  Then prepare inputs and compute attention:

  ```python
  inputs = tokenizer.encode("The cat sat on the mat", return_tensors='pt')
  outputs = model(inputs)
  attention = outputs[-1]  # Output includes attention weights when output_attentions=True
  tokens = tokenizer.convert_ids_to_tokens(inputs[0])
  ```

  Finally, display the attention weights using the [`head_view`](bertviz/head_view.py) or [`model_view`](bertviz/model_view.py)
   functions:

  ```python
  from bertviz import head_view
  head_view(attention, tokens)
  ```

  <b>Examples</b>: DistilBERT ([Model View Notebook](notebooks/model_view_distilbert.ipynb), [Head View Notebook](notebooks/head_view_distilbert.ipynb))

  For full API, please refer to the source code for the [head view](bertviz/head_view.py) or [model view](bertviz/model_view.py).




  The neuron view is invoked differently than the head view or model view, due to requiring access to the model's
  query/key vectors, which are not returned through the Huggingface API. It is currently limited to custom versions of BERT, GPT-2, and
  RoBERTa included with BertViz.

  ```python

  from bertviz.transformers_neuron_view import BertModel, BertTokenizer
  from bertviz.neuron_view import show

  model_type = 'bert'
  model_version = 'bert-base-uncased'
  do_lower_case = True
  sentence_a = "The cat sat on the mat"
  sentence_b = "The cat lay on the rug"
  model = BertModel.from_pretrained(model_version, output_attentions=True)
  tokenizer = BertTokenizer.from_pretrained(model_version, do_lower_case=do_lower_case)
  show(model, model_type, tokenizer, sentence_a, sentence_b, layer=2, head=0)
  ```

  <b>Examples</b>:
  BERT ([Notebook](notebooks/neuron_view_bert.ipynb),
  [Colab](https://colab.research.google.com/drive/1m37iotFeubMrp9qIf9yscXEL1zhxTN2b)) •
  GPT-2 ([Notebook](notebooks/neuron_view_gpt2.ipynb),
  [Colab](https://colab.research.google.com/drive/1s8XCCyxsKvNRWNzjWi5Nl8ZAYZ5YkLm_)) •
  RoBERTa
  ([Notebook](notebooks/neuron_view_roberta.ipynb))

  For full API, please refer to the [source](bertviz/neuron_view.py).



  The head view and model view both support encoder-decoder models.

  First, load an encoder-decoder model:

  ```python
  from transformers import AutoTokenizer, AutoModel

  tokenizer = AutoTokenizer.from_pretrained("Helsinki-NLP/opus-mt-en-de")
  model = AutoModel.from_pretrained("Helsinki-NLP/opus-mt-en-de", output_attentions=True)
  ```

  Then prepare the inputs and compute attention:
  ```python
  encoder_input_ids = tokenizer("She sees the small elephant.", return_tensors="pt", add_special_tokens=True).input_ids
  decoder_input_ids = tokenizer("Sie sieht den kleinen Elefanten.", return_tensors="pt", add_special_tokens=True).input_ids

  outputs = model(input_ids=encoder_input_ids, decoder_input_ids=decoder_input_ids)

  encoder_text = tokenizer.convert_ids_to_tokens(encoder_input_ids[0])
  decoder_text = tokenizer.convert_ids_to_tokens(decoder_input_ids[0])
  ```

  Finally, display the visualization using either [`head_view`](bertviz/head_view.py) or [`model_view`](bertviz/model_view.py).
  ```python
  from bertviz import model_view
  model_view(
      encoder_attention=outputs.encoder_attentions,
      decoder_attention=outputs.decoder_attentions,
      cross_attention=outputs.cross_attentions,
      encoder_tokens= encoder_text,
      decoder_tokens = decoder_text
  )
  ```

  You may select `Encoder`, `Decoder`, or `Cross` attention from the drop-down in the upper left corner of the visualization.

  <b>Examples</b>: MarianMT ([Notebook](notebooks/model_view_encoder_decoder.ipynb)) • BART ([Notebook](notebooks/model_view_bart.ipynb))

  For full API, please refer to the source code for the [head view](bertviz/head_view.py) or [model view](bertviz/model_view.py).


  ```bash
  git clone https://github.com/jessevig/bertviz.git
  cd bertviz
  python setup.py develop
  ```





  The model view and neuron view support dark (default) and light modes. You may set the mode using
  the `display_mode` parameter:
  ```python
  model_view(attention, tokens, display_mode="light")
  ```




  To improve the responsiveness of the tool when visualizing larger models or inputs, you may set the `include_layers`
   parameter to restrict the visualization to a subset of layers (zero-indexed). This option is available in the head view and model
  view.

  **Example:** Render model view with only layers 5 and 6 displayed
  ```python
  model_view(attention, tokens, include_layers=[5, 6])
  ```

  For the model view, you may also restrict the visualization to a subset of attention heads (zero-indexed) by setting the
  `include_heads` parameter.




  In the head view, you may choose a specific `layer` and collection of `heads` as the default selection when the
   visualization first renders. Note: this is different from the `include_heads`/`include_layers` parameter (above), which
   removes layers and heads from the visualization completely.

  **Example:** Render head view with layer 2 and heads 3 and 5 pre-selected
  ```python
  head_view(attention, tokens, layer=2, heads=[3,5])
  ```

  You may also pre-select a specific `layer` and single `head` for the neuron view.



  Some models, e.g. BERT, accept a pair of sentences as input. BertViz optionally supports a drop-down menu that allows
  user to filter attention based on which sentence the tokens are in, e.g. only show attention between tokens in first
   sentence and tokens in second sentence.



  To enable this feature when invoking the [`head_view`](bertviz/head_view.py) or [`model_view`](bertviz/model_view.py) functions, set
   the `sentence_b_start` parameter to the start index of the second sentence. Note that the method for computing this
   index will depend on the model.

  Example (BERT):

  ```python
  from bertviz import head_view
  from transformers import AutoTokenizer, AutoModel, utils
  utils.logging.set_verbosity_error()  # Suppress standard warnings


  model_version = 'bert-base-uncased'
  model = AutoModel.from_pretrained(model_version, output_attentions=True)
  tokenizer = AutoTokenizer.from_pretrained(model_version)
  sentence_a = "the rabbit quickly hopped"
  sentence_b = "The turtle slowly crawled"
  inputs = tokenizer.encode_plus(sentence_a, sentence_b, return_tensors='pt')
  input_ids = inputs['input_ids']
  token_type_ids = inputs['token_type_ids'] # token type id is 0 for Sentence A and 1 for Sentence B
  attention = model(input_ids, token_type_ids=token_type_ids)[-1]
  sentence_b_start = token_type_ids[0].tolist().index(1) # Sentence B starts at first index of token type id 1
  token_ids = input_ids[0].tolist() # Batch index 0
  tokens = tokenizer.convert_ids_to_tokens(token_ids)
  head_view(attention, tokens, sentence_b_start)
  ```




  To enable this option in the neuron view, simply set the `sentence_a` and `sentence_b` parameters in [`neuron_view.show()`](bertviz/neuron_view.py).



  Support to retrieve the generated HTML representations has been added to head_view, model_view and neuron_view.

  Setting the 'html_action' parameter to 'return' will make the function call return a single HTML Python object that can be further processed. Remember you can access the HTML source using the data attribute of a Python HTML object.

  The default behavior for 'html_action' is 'view', which will display the visualization but won't return the HTML object.

  This functionality is useful if you need to:
  - Save the representation as an independent HTML file that can be accessed via web browser
  - Use custom display methods as the ones needed in Databricks to visualize HTML objects

  Example (head and model views):

  ```python
  from transformers import AutoTokenizer, AutoModel, utils
  from bertviz import head_view

  utils.logging.set_verbosity_error()  # Suppress standard warnings
  tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
  model = AutoModel.from_pretrained("bert-base-uncased", output_attentions=True)

  inputs = tokenizer.encode("The cat sat on the mat", return_tensors='pt')
  outputs = model(inputs)
  attention = outputs[-1]  # Output includes attention weights when output_attentions=True
  tokens = tokenizer.convert_ids_to_tokens(inputs[0])

  html_head_view = head_view(attention, tokens, html_action='return')

  with open("PATH_TO_YOUR_FILE/head_view.html", 'w') as file:
      file.write(html_head_view.data)

  ```

  Example (neuron view):

  ```python

  from bertviz.transformers_neuron_view import BertModel, BertTokenizer
  from bertviz.neuron_view import show

  model_type = 'bert'
  model_version = 'bert-base-uncased'
  do_lower_case = True
  sentence_a = "The cat sat on the mat"
  sentence_b = "The cat lay on the rug"
  model = BertModel.from_pretrained(model_version, output_attentions=True)
  tokenizer = BertTokenizer.from_pretrained(model_version, do_lower_case=do_lower_case)
  html_neuron_view = show(model, model_type, tokenizer, sentence_a, sentence_b, layer=2, head=0, html_action='return')

  with open("PATH_TO_YOUR_FILE/neuron_view.html", 'w') as file:
      file.write(html_neuron_view.data)
  ```



  The head view and model view may be used to
   visualize self-attention for any standard Transformer model,
  as long as the attention weights are available and follow the format specified in [`head_view`](bertviz/head_view.py) and
   [`model_view`](bertviz/model_view.py) (which is the format
  returned from Huggingface models). In some case, Tensorflow checkpoints may be loaded as Huggingface models as described
   in the
   [Huggingface docs](https://huggingface.co/transformers/).





  * This tool is designed for shorter inputs and may run slowly if the input text is very long and/or the model is very large.
   To mitigate this, you may wish to filter the layers displayed by setting the **`include_layers`** parameter, as described [above](#filtering-layers).
  * When running on Colab, some of the visualizations will fail (runtime disconnection) when the input text is long.  To mitigate this, you may wish to filter the layers displayed by setting the **`include_layers`** parameter, as described [above](#filtering-layers).
  * The *neuron view* only supports the custom BERT, GPT-2, and RoBERTa models included with the tool. This view needs access to the query and key vectors,
  which required modifying the model code (see `transformers_neuron_view` directory), which has only been done for these three models.



  * Visualizing attention weights illuminates one type of architecture within the model but does not
  necessarily provide a direct *explanation* for predictions [[1](https://arxiv.org/pdf/1909.11218.pdf), [2](https://arxiv.org/abs/1902.10186), [3](https://arxiv.org/pdf/1908.04626.pdf)].
  * If you wish to understand how the input text influences output predictions more directly, consider [saliency methods](https://arxiv.org/pdf/2010.05607.pdf) provided
  by tools such as the [Language Interpretability Toolkit](https://github.com/PAIR-code/lit) or [Ecco](https://github.com/jalammar/ecco).




  [<b>A Multiscale Visualization of Attention in the Transformer Model</b>](https://www.aclweb.org/anthology/P19-3007.pdf) (ACL System Demonstrations 2019).



  ```bibtex
  @inproceedings{vig-2019-multiscale,
      title = "A Multiscale Visualization of Attention in the Transformer Model",
      author = "Vig, Jesse",
      booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations",
      month = jul,
      year = "2019",
      address = "Florence, Italy",
      publisher = "Association for Computational Linguistics",
      url = "https://www.aclweb.org/anthology/P19-3007",
      doi = "10.18653/v1/P19-3007",
      pages = "37--42",
  }
  ```


  Jesse Vig [(homepage)](https://jessevig.com)


  We are grateful to the authors of the following projects, which are incorporated into this repo:
  * https://github.com/tensorflow/tensor2tensor
  * https://github.com/huggingface/pytorch-pretrained-BERT



  This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details


pkgId: d6a7a73b0fb1bb4dc59565ba32cde1ebafe9e1c7c72687641d20b5c975b76ec3
name: python-besapi
arch: src
version: 3.7.4
epoch: 0
release: 1
summary: Library for working with the BigFix REST API
url: https://github.com/jgstew/besapi
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-besapi-3.7.4-1.src.rpm
checksum_type: sha256
description:
  besapi is a Python library designed to interact with the BigFix [REST API](https://developer.bigfix.com/rest-api/api/).

  Installation:

  `pip install besapi`

  Usage:

  ```
  import besapi
  b = besapi.BESConnection('my_username', 'my_password', 'https://rootserver.domain.org:52311')
  rr = b.get('sites')






  >>>print rr
  ```

  ```xml
  <BESAPI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BESAPI.xsd">
  <ExternalSite Resource="http://rootserver.domain.org:52311/api/site/external/BES%20Support">
  <Name>BES Support</Name>
  </ExternalSite>
  <!---...--->
  <CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/Org">
  <Name>Org</Name>
  </CustomSite>
  <CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/Org%2fMac">
  <Name>Org/Mac</Name>
  </CustomSite>
  <CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/Org%2fWindows">
  <Name>Org/Windows</Name>
  </CustomSite>
  <CustomSite Resource="http://rootserver.domain.org:52311/api/site/custom/ContentDev">
  <Name>ContentDev</Name>
  </CustomSite>
  <OperatorSite Resource="http://rootserver.domain.org:52311/api/site/operator/mah60">
  <Name>mah60</Name>
  </OperatorSite>
  <ActionSite Resource="http://rootserver.domain.org:52311/api/site/master">
  <Name>ActionSite</Name>
  </ActionSite>
  </BESAPI>
  ```

  ```
  >>>rr.besobj.attrib
  {'{http://www.w3.org/2001/XMLSchema-instance}noNamespaceSchemaLocation': 'BESAPI.xsd'}

  >>>rr.besobj.ActionSite.attrib
  {'Resource': 'http://rootserver.domain.org:52311/api/site/master'}

  >>>rr.besobj.ActionSite.attrib['Resource']
  'http://rootserver.domain.org:52311/api/site/master'

  >>>rr.besobj.ActionSite.Name
  'ActionSite'

  >>>rr.besobj.OperatorSite.Name
  'mah60'

  >>>for cSite in rr.besobj.CustomSite:
  ...     print cSite.Name
  Org
  Org/Mac
  Org/Windows
  ContentDev
  ...

  >>>rr = b.get('task/operator/mah60/823975')
  >>>with open('/Users/Shared/Test.bes", "wb") as file:
  ...     file.write(rr.text)

  >>>b.delete('task/operator/mah60/823975')

  >>> file = open('/Users/Shared/Test.bes')
  >>> b.post('tasks/operator/mah60', file)
  >>> b.put('task/operator/mah60/823975', file)
  ```



  ```
  $ python bescli.py
  OR
  >>> import bescli
  >>> bescli.main()

  BigFix> login
  User [mah60]: mah60
  Root Server (ex. https://server.institution.edu:52311): https://my.company.org:52311
  Password:
  Login Successful!
  BigFix> get help
  ...
  BigFix> get sites
  ...
  BigFix> get sites.OperatorSite.Name
  mah60
  BigFix> get help/fixlets
  GET:
  /api/fixlets/{site}
  POST:
  /api/fixlets/{site}
  BigFix> get fixlets/operator/mah60
  ...
  ```



  - https://developer.bigfix.com/rest-api/
  - http://bigfix.me/restapi



  - Python 3.6 or later
    - version 1.1.3 of besapi was the last to have partial python2 support
  - lxml
  - requests
  - cmd2



  - https://github.com/jgstew/besapi/tree/master/examples
  - https://github.com/jgstew/generate_bes_from_template/blob/master/examples/generate_uninstallers.py
  - https://github.com/jgstew/jgstew-recipes/blob/main/SharedProcessors/BESImport.py
  - https://github.com/jgstew/jgstew-recipes/blob/main/SharedProcessors/BigFixActioner.py
  - https://github.com/jgstew/jgstew-recipes/blob/main/SharedProcessors/BigFixSessionRelevance.py



  - `pyinstaller --clean --collect-all besapi --onefile .\src\bescli\bescli.py`
  - Note: using UPX to compress the binary only saves 2MB out of 16MB on Windows



  - https://forum.bigfix.com/t/rest-api-python-module/2170
  - https://gist.github.com/hansen-m/58667f370047af92f634
  - https://docs.google.com/presentation/d/1pME28wdjkzj9378py9QjFyMOyOHcamB6bk4k8z-c-r0/edit#slide=id.g69e753e75_039
  - https://forum.bigfix.com/t/bigfix-documentation-resources/12540
  - https://forum.bigfix.com/t/query-for-finding-who-deleted-tasks-fixlets/13668/6
  - https://forum.bigfix.com/t/rest-api-java-wrapper/12693



  - MIT License


pkgId: 5fe3b7c3bb6af64e822b09d19a1c3647d1a20ba61ed844aeb20d7d43196af57e
name: python-bespokelabs
arch: src
version: 0.1.1
epoch: 0
release: 1
summary: The official Python library for the bespoke_labs API
url: https://github.com/bespokelabsai/bespokelabs-python
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bespokelabs-0.1.1-1.src.rpm
checksum_type: sha256
description:
  [![PyPI version](https://img.shields.io/pypi/v/bespokelabs.svg)](https://pypi.org/project/bespokelabs/)

  The Bespoke Labs Python library provides convenient access to the Bespoke Labs REST API from any Python 3.7+
  application. The library includes type definitions for all request params and response fields,
  and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).

  It is generated with [Stainless](https://www.stainlessapi.com/).



  The REST API documentation can be found on [docs.bespokelabs.ai](https://docs.bespokelabs.ai/). The full API of this library can be found in [api.md](https://github.com/bespokelabsai/bespokelabs-python/tree/main/api.md).



  ```sh

  pip install bespokelabs
  ```



  The full API of this library can be found in [api.md](https://github.com/bespokelabsai/bespokelabs-python/tree/main/api.md).

  ```python
  import os
  from bespokelabs import BespokeLabs

  client = BespokeLabs(
      
      auth_token=os.environ.get("BESPOKE_API_KEY"),
  )

  factcheck_create_response = client.minicheck.factcheck.create(
      claim="claim",
      context="context",
  )
  print(factcheck_create_response.support_prob)
  ```

  While you can provide a `auth_token` keyword argument,
  we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
  to add `BESPOKE_API_KEY="My Auth Token"` to your `.env` file
  so that your Auth Token is not stored in source control.



  Simply import `AsyncBespokeLabs` instead of `BespokeLabs` and use `await` with each API call:

  ```python
  import os
  import asyncio
  from bespokelabs import AsyncBespokeLabs

  client = AsyncBespokeLabs(
      
      auth_token=os.environ.get("BESPOKE_API_KEY"),
  )


  async def main() -> None:
      factcheck_create_response = await client.minicheck.factcheck.create(
          claim="claim",
          context="context",
      )
      print(factcheck_create_response.support_prob)


  asyncio.run(main())
  ```

  Functionality between the synchronous and asynchronous clients is otherwise identical.



  Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:

  - Serializing back into JSON, `model.to_json()`
  - Converting to a dictionary, `model.to_dict()`

  Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.



  When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `bespokelabs.APIConnectionError` is raised.

  When the API returns a non-success status code (that is, 4xx or 5xx
  response), a subclass of `bespokelabs.APIStatusError` is raised, containing `status_code` and `response` properties.

  All errors inherit from `bespokelabs.APIError`.

  ```python
  import bespokelabs
  from bespokelabs import BespokeLabs

  client = BespokeLabs()

  try:
      client.minicheck.factcheck.create(
          claim="claim",
          context="context",
      )
  except bespokelabs.APIConnectionError as e:
      print("The server could not be reached")
      print(e.__cause__)  # an underlying Exception, likely raised within httpx.
  except bespokelabs.RateLimitError as e:
      print("A 429 status code was received; we should back off a bit.")
  except bespokelabs.APIStatusError as e:
      print("Another non-200-range status code was received")
      print(e.status_code)
      print(e.response)
  ```

  Error codes are as followed:

  | Status Code | Error Type                 |
  | ----------- | -------------------------- |
  | 400         | `BadRequestError`          |
  | 401         | `AuthenticationError`      |
  | 403         | `PermissionDeniedError`    |
  | 404         | `NotFoundError`            |
  | 422         | `UnprocessableEntityError` |
  | 429         | `RateLimitError`           |
  | >=500       | `InternalServerError`      |
  | N/A         | `APIConnectionError`       |



  Certain errors are automatically retried 2 times by default, with a short exponential backoff.
  Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
  429 Rate Limit, and >=500 Internal errors are all retried by default.

  You can use the `max_retries` option to configure or disable retry settings:

  ```python
  from bespokelabs import BespokeLabs


  client = BespokeLabs(
      
      max_retries=0,
  )


  client.with_options(max_retries=5).minicheck.factcheck.create(
      claim="claim",
      context="context",
  )
  ```



  By default requests time out after 1 minute. You can configure this with a `timeout` option,
  which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:

  ```python
  from bespokelabs import BespokeLabs


  client = BespokeLabs(
      
      timeout=20.0,
  )


  client = BespokeLabs(
      timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
  )


  client.with_options(timeout=5.0).minicheck.factcheck.create(
      claim="claim",
      context="context",
  )
  ```

  On timeout, an `APITimeoutError` is thrown.

  Note that requests that time out are [retried twice by default](https://github.com/bespokelabsai/bespokelabs-python/tree/main/#retries).





  We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.

  You can enable logging by setting the environment variable `BESPOKE_LABS_LOG` to `debug`.

  ```shell
  $ export BESPOKE_LABS_LOG=debug
  ```



  In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:

  ```py
  if response.my_field is None:
    if 'my_field' not in response.model_fields_set:
      print('Got json like {}, without a "my_field" key present at all.')
    else:
      print('Got json like {"my_field": null}.')
  ```



  The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,

  ```py
  from bespokelabs import BespokeLabs

  client = BespokeLabs()
  response = client.minicheck.factcheck.with_raw_response.create(
      claim="claim",
      context="context",
  )
  print(response.headers.get('X-My-Header'))

  factcheck = response.parse()  # get the object that `minicheck.factcheck.create()` would have returned
  print(factcheck.support_prob)
  ```

  These methods return an [`APIResponse`](https://github.com/bespokelabsai/bespokelabs-python/tree/main/src/bespokelabs/_response.py) object.

  The async client returns an [`AsyncAPIResponse`](https://github.com/bespokelabsai/bespokelabs-python/tree/main/src/bespokelabs/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.



  The above interface eagerly reads the full response body when you make the request, which may not always be what you want.

  To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.

  ```python
  with client.minicheck.factcheck.with_streaming_response.create(
      claim="claim",
      context="context",
  ) as response:
      print(response.headers.get("X-My-Header"))

      for line in response.iter_lines():
          print(line)
  ```

  The context manager is required so that the response will reliably be closed.



  This library is typed for convenient access to the documented API.

  If you need to access undocumented endpoints, params, or response properties, the library can still be used.



  To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
  http verbs. Options on the client will be respected (such as retries) will be respected when making this
  request.

  ```py
  import httpx

  response = client.post(
      "/foo",
      cast_to=httpx.Response,
      body={"my_param": True},
  )

  print(response.headers.get("x-foo"))
  ```



  If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
  options.



  To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
  can also get all the extra fields on the Pydantic model as a dict with
  [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).



  You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

  - Support for proxies
  - Custom transports
  - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

  ```python
  from bespokelabs import BespokeLabs, DefaultHttpxClient

  client = BespokeLabs(
      
      base_url="http://my.test.server.example.com:8083",
      http_client=DefaultHttpxClient(
          proxies="http://my.test.proxy.example.com",
          transport=httpx.HTTPTransport(local_address="0.0.0.0"),
      ),
  )
  ```

  You can also customize the client on a per-request basis by using `with_options()`:

  ```python
  client.with_options(http_client=DefaultHttpxClient(...))
  ```



  By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.



  This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes that only affect static types, without breaking runtime behavior.
  2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
  3. Changes that we do not expect to impact the vast majority of users in practice.

  We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

  We are keen for your feedback; please open an [issue](https://www.github.com/bespokelabsai/bespokelabs-python/issues) with questions, bugs, or suggestions.



  Python 3.7 or higher.


pkgId: 9d15888c5541fdbbea27d3acb24f4a06abaa8a1b88a39683e03b0ef40fae931a
name: python-bespokelabs
arch: src
version: 0.2.0
epoch: 0
release: 1
summary: The official Python library for the bespoke_labs API
url: https://github.com/bespokelabsai/bespokelabs-python
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bespokelabs-0.2.0-1.src.rpm
checksum_type: sha256
description:
  [![PyPI version](https://img.shields.io/pypi/v/bespokelabs.svg)](https://pypi.org/project/bespokelabs/)

  The Bespoke Labs Python library provides convenient access to the Bespoke Labs REST API from any Python 3.8+
  application. The library includes type definitions for all request params and response fields,
  and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).

  It is generated with [Stainless](https://www.stainlessapi.com/).



  The REST API documentation can be found on [docs.bespokelabs.ai](https://docs.bespokelabs.ai/). The full API of this library can be found in [api.md](https://github.com/bespokelabsai/bespokelabs-python/tree/main/api.md).



  ```sh

  pip install bespokelabs
  ```



  The full API of this library can be found in [api.md](https://github.com/bespokelabsai/bespokelabs-python/tree/main/api.md).

  ```python
  import os
  from bespokelabs import BespokeLabs

  client = BespokeLabs(
      auth_token=os.environ.get("BESPOKE_API_KEY"),  # This is the default and can be omitted
  )

  factcheck = client.minicheck.factcheck.create(
      claim="claim",
      context="context",
  )
  print(factcheck.support_prob)
  ```

  While you can provide a `auth_token` keyword argument,
  we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
  to add `BESPOKE_API_KEY="My Auth Token"` to your `.env` file
  so that your Auth Token is not stored in source control.



  Simply import `AsyncBespokeLabs` instead of `BespokeLabs` and use `await` with each API call:

  ```python
  import os
  import asyncio
  from bespokelabs import AsyncBespokeLabs

  client = AsyncBespokeLabs(
      auth_token=os.environ.get("BESPOKE_API_KEY"),  # This is the default and can be omitted
  )


  async def main() -> None:
      factcheck = await client.minicheck.factcheck.create(
          claim="claim",
          context="context",
      )
      print(factcheck.support_prob)


  asyncio.run(main())
  ```

  Functionality between the synchronous and asynchronous clients is otherwise identical.



  Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:

  - Serializing back into JSON, `model.to_json()`
  - Converting to a dictionary, `model.to_dict()`

  Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.



  When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `bespokelabs.APIConnectionError` is raised.

  When the API returns a non-success status code (that is, 4xx or 5xx
  response), a subclass of `bespokelabs.APIStatusError` is raised, containing `status_code` and `response` properties.

  All errors inherit from `bespokelabs.APIError`.

  ```python
  import bespokelabs
  from bespokelabs import BespokeLabs

  client = BespokeLabs()

  try:
      client.minicheck.factcheck.create(
          claim="claim",
          context="context",
      )
  except bespokelabs.APIConnectionError as e:
      print("The server could not be reached")
      print(e.__cause__)  # an underlying Exception, likely raised within httpx.
  except bespokelabs.RateLimitError as e:
      print("A 429 status code was received; we should back off a bit.")
  except bespokelabs.APIStatusError as e:
      print("Another non-200-range status code was received")
      print(e.status_code)
      print(e.response)
  ```

  Error codes are as followed:

  | Status Code | Error Type                 |
  | ----------- | -------------------------- |
  | 400         | `BadRequestError`          |
  | 401         | `AuthenticationError`      |
  | 403         | `PermissionDeniedError`    |
  | 404         | `NotFoundError`            |
  | 422         | `UnprocessableEntityError` |
  | 429         | `RateLimitError`           |
  | >=500       | `InternalServerError`      |
  | N/A         | `APIConnectionError`       |



  Certain errors are automatically retried 2 times by default, with a short exponential backoff.
  Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
  429 Rate Limit, and >=500 Internal errors are all retried by default.

  You can use the `max_retries` option to configure or disable retry settings:

  ```python
  from bespokelabs import BespokeLabs


  client = BespokeLabs(
      
      max_retries=0,
  )


  client.with_options(max_retries=5).minicheck.factcheck.create(
      claim="claim",
      context="context",
  )
  ```



  By default requests time out after 1 minute. You can configure this with a `timeout` option,
  which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:

  ```python
  from bespokelabs import BespokeLabs


  client = BespokeLabs(
      
      timeout=20.0,
  )


  client = BespokeLabs(
      timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
  )


  client.with_options(timeout=5.0).minicheck.factcheck.create(
      claim="claim",
      context="context",
  )
  ```

  On timeout, an `APITimeoutError` is thrown.

  Note that requests that time out are [retried twice by default](https://github.com/bespokelabsai/bespokelabs-python/tree/main/#retries).





  We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.

  You can enable logging by setting the environment variable `BESPOKE_LABS_LOG` to `info`.

  ```shell
  $ export BESPOKE_LABS_LOG=info
  ```

  Or to `debug` for more verbose logging.



  In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:

  ```py
  if response.my_field is None:
    if 'my_field' not in response.model_fields_set:
      print('Got json like {}, without a "my_field" key present at all.')
    else:
      print('Got json like {"my_field": null}.')
  ```



  The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,

  ```py
  from bespokelabs import BespokeLabs

  client = BespokeLabs()
  response = client.minicheck.factcheck.with_raw_response.create(
      claim="claim",
      context="context",
  )
  print(response.headers.get('X-My-Header'))

  factcheck = response.parse()  # get the object that `minicheck.factcheck.create()` would have returned
  print(factcheck.support_prob)
  ```

  These methods return an [`APIResponse`](https://github.com/bespokelabsai/bespokelabs-python/tree/main/src/bespokelabs/_response.py) object.

  The async client returns an [`AsyncAPIResponse`](https://github.com/bespokelabsai/bespokelabs-python/tree/main/src/bespokelabs/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.



  The above interface eagerly reads the full response body when you make the request, which may not always be what you want.

  To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.

  ```python
  with client.minicheck.factcheck.with_streaming_response.create(
      claim="claim",
      context="context",
  ) as response:
      print(response.headers.get("X-My-Header"))

      for line in response.iter_lines():
          print(line)
  ```

  The context manager is required so that the response will reliably be closed.



  This library is typed for convenient access to the documented API.

  If you need to access undocumented endpoints, params, or response properties, the library can still be used.



  To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
  http verbs. Options on the client will be respected (such as retries) will be respected when making this
  request.

  ```py
  import httpx

  response = client.post(
      "/foo",
      cast_to=httpx.Response,
      body={"my_param": True},
  )

  print(response.headers.get("x-foo"))
  ```



  If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
  options.



  To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
  can also get all the extra fields on the Pydantic model as a dict with
  [`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).



  You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:

  - Support for proxies
  - Custom transports
  - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality

  ```python
  from bespokelabs import BespokeLabs, DefaultHttpxClient

  client = BespokeLabs(
      
      base_url="http://my.test.server.example.com:8083",
      http_client=DefaultHttpxClient(
          proxies="http://my.test.proxy.example.com",
          transport=httpx.HTTPTransport(local_address="0.0.0.0"),
      ),
  )
  ```

  You can also customize the client on a per-request basis by using `with_options()`:

  ```python
  client.with_options(http_client=DefaultHttpxClient(...))
  ```



  By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.



  This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes that only affect static types, without breaking runtime behavior.
  2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.
  3. Changes that we do not expect to impact the vast majority of users in practice.

  We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

  We are keen for your feedback; please open an [issue](https://www.github.com/bespokelabsai/bespokelabs-python/issues) with questions, bugs, or suggestions.



  If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.

  You can determine the version that is being used at runtime with:

  ```py
  import bespokelabs
  print(bespokelabs.__version__)
  ```



  Python 3.8 or higher.



  See [the contributing documentation](https://github.com/bespokelabsai/bespokelabs-python/tree/main/./CONTRIBUTING.md).


pkgId: 3cf063b1b4a80490173925d74af7129a6b373d13cf46fd3912490144ec2c803d
name: python-bespokelabs-curator
arch: src
version: 0.1.10
epoch: 0
release: 1
summary: Bespoke Labs Curator
url: https://github.com/bespokelabsai/curator
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bespokelabs-curator-0.1.10-1.src.rpm
checksum_type: sha256
description:
  <p align="center">
    <a href="https://bespokelabs.ai/" target="_blank">
      <picture>
        <source media="(prefers-color-scheme: light)" width="80px" srcset="https://raw.githubusercontent.com/bespokelabsai/curator/main/docs/Bespoke-Labs-Logomark-Red.png">
        <img alt="Bespoke Labs Logo" width="80px" src="https://raw.githubusercontent.com/bespokelabsai/curator/main/docs/Bespoke-Labs-Logomark-Red-on-Black.png">
      </picture>
    </a>
  </p>

  <h1 align="center">Bespoke Curator</h1>
  <h3 align="center" style="font-size: 20px; margin-bottom: 4px">Data Curation for Post-Training & Structured Data Extraction</h3>
  <br/>
  <p align="center">
    <a href="https://docs.bespokelabs.ai/">
      <img alt="Static Badge" src="https://img.shields.io/badge/Docs-docs.bespokelabs.ai-blue?style=flat&link=https%3A%2F%2Fdocs.bespokelabs.ai">
    </a>
    <a href="https://bespokelabs.ai/">
      <img alt="Site" src="https://img.shields.io/badge/Site-bespokelabs.ai-blue?link=https%3A%2F%2Fbespokelabs.ai"/>
    </a>
    <img alt="PyPI - Version" src="https://img.shields.io/pypi/v/bespokelabs-curator">
    <a href="https://twitter.com/bespokelabsai">
      <img src="https://img.shields.io/twitter/follow/bespokelabsai" alt="Follow on X" />
    </a>
    <a href="https://discord.gg/KqpXvpzVBS">
      <img alt="Discord" src="https://img.shields.io/discord/1230990265867698186">
    </a>
  </p>



  Bespoke Curator makes it very easy to create high-quality synthetic data at scale, which you can use to finetune models or use for structured data extraction at scale.

  Bespoke Curator is an open-source project:
  * That comes with a rich Python based library for generating and curating synthetic data.
  * A Curator Viewer which makes it easy to view the datasets, thus aiding in the dataset creation.
  * We will also be releasing high-quality datasets that should move the needle on post-training.



  1. **Programmability and Structured Outputs**: Synthetic data generation is lot more than just using a single prompt -- it involves calling LLMs multiple times and orchestrating control-flow. Curator treats structured outputs as first class citizens and helps you design complex pipelines.
  2. **Built-in Performance Optimization**: We often see calling LLMs in loops, or inefficient implementation of multi-threading. We have baked in performance optimizations so that you don't need to worry about those!
  3. **Intelligent Caching and Fault Recovery**: Given LLM calls can add up in cost and time, failures are undesirable but sometimes unavoidable. We cache the LLM requests and responses so that it is easy to recover from a failure. Moreover, when working on a multi-stage pipeline, caching of stages makes it easy to iterate.
  4. **Native HuggingFace Dataset Integration**: Work directly on HuggingFace Dataset objects throughout your pipeline. Your synthetic data is immediately ready for fine-tuning!
  5. **Interactive Curator Viewer**: Improve and iterate on your prompts using our built-in viewer. Inspect LLM requests and responses in real-time, allowing you to iterate and refine your data generation strategy with immediate feedback.



  ```bash
  pip install bespokelabs-curator
  ```



  ```python
  from bespokelabs import curator
  from datasets import Dataset
  from pydantic import BaseModel, Field
  from typing import List


  topics = Dataset.from_dict({"topic": [
      "Urban loneliness in a bustling city",
      "Beauty of Bespoke Labs's Curator library"
  ]})


  class Poem(BaseModel):
      poem: str = Field(description="A poem.")

  class Poems(BaseModel):
      poems_list: List[Poem] = Field(description="A list of poems.")



  poet = curator.Prompter(
      
      
      prompt_func=lambda row: f"Write two poems about {row['topic']}.",
      model_name="gpt-4o-mini",
      response_format=Poems,
      
      
      parse_func=lambda row, poems: [
          {"topic": row["topic"], "poem": p.poem} for p in poems.poems_list
      ],
  )

  poem = poet(topics)
  print(poem.to_pandas())






  ```
  Note that `topics` can be created with `curator.Prompter` as well,
  and we can scale this up to create tens of thousands of diverse poems.
  You can see a more detailed example in the [examples/poem.py](https://github.com/bespokelabsai/curator/blob/mahesh/update_doc/examples/poem.py) file,
  and other examples in the [examples](https://github.com/bespokelabsai/curator/blob/mahesh/update_doc/examples) directory.

  To run the examples, make sure to set your OpenAI API key in
  the environment variable `OPENAI_API_KEY` by running `export OPENAI_API_KEY=sk-...` in your terminal.

  See the [docs](https://docs.bespokelabs.ai/) for more details as well as
  for troubleshooting information.



  To run the bespoke dataset viewer:

  ```bash
  curator-viewer
  ```

  This will pop up a browser window with the viewer running on `127.0.0.1:3000` by default if you haven't specified a different host and port.


  Optional parameters to run the viewer on a different host and port:
  ```bash
  >>> curator-viewer -h
  usage: curator-viewer [-h] [--host HOST] [--port PORT] [--verbose]

  Curator Viewer

  options:
    -h, --help     show this help message and exit
    --host HOST    Host to run the server on (default: localhost)
    --port PORT    Port to run the server on (default: 3000)
    --verbose, -v  Enables debug logging for more verbose output
  ```

  The only requirement for running `curator-viewer` is to install node. You can install them by following the instructions [here](https://nodejs.org/en/download/package-manager).

  For example, to check if you have node installed, you can run:

  ```bash
  node -v
  ```

  If it's not installed, installing latest node on MacOS, you can run:

  ```bash

  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

  nvm install 22

  node -v # should print `v22.11.0`

  npm -v # should print `10.9.0`
  ```


  Contributions are welcome!


pkgId: 9f5d76f3f1929d303c05866a8487f6a2c9821748b54cc16685dbf6be109a9a31
name: python-bespokelabs-curator
arch: src
version: 0.1.7
epoch: 0
release: 1
summary: Bespoke Labs Curator
url: https://github.com/bespokelabsai/curator
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bespokelabs-curator-0.1.7-1.src.rpm
checksum_type: sha256
description:
  <p align="center">
    <a href="https://bespokelabs.ai/" target="_blank">
      <picture>
        <source media="(prefers-color-scheme: light)" width="10%" srcset="./docs/Bespoke-Labs-Logomark-Red.png">
        <img alt="Bespoke Labs Logo" width="10%" src="./docs/Bespoke-Labs-Logomark-Red-on-Black.png">
      </picture>
    </a>
  </p>

  <h1 align="center">Bespoke Labs Curator</h1>
  <h3 align="center" style="font-size: 20px; margin-bottom: 4px">Data Curation for Post-Training & Structured Data Extraction</h3>
  <br/>
  <p align="center">
    <a href="https://docs.bespokelabs.ai/">
      <img alt="Static Badge" src="https://img.shields.io/badge/Docs-docs.bespokelabs.ai-blue?style=flat&link=https%3A%2F%2Fdocs.bespokelabs.ai">
    </a>
    <a href="https://bespokelabs.ai/">
      <img alt="Site" src="https://img.shields.io/badge/Site-bespokelabs.ai-blue?link=https%3A%2F%2Fbespokelabs.ai"/>
    </a>
    <img alt="PyPI - Version" src="https://img.shields.io/pypi/v/bespokelabs-curator">
    <a href="https://twitter.com/bespokelabsai">
      <img src="https://img.shields.io/twitter/follow/bespokelabsai" alt="Follow on X" />
    </a>
    <a href="https://discord.gg/KqpXvpzVBS">
      <img alt="Discord" src="https://img.shields.io/discord/1230990265867698186">
    </a>
  </p>




  ```bash
  pip install bespokelabs-curator
  ```



  ```python
  from bespokelabs import curator
  import os

  os.environ['OPENAI_API_KEY'] = 'sk-...' # Set your OpenAI API key here

  poet = curator.Prompter(
      prompt_func=lambda: "Write a poem about the beauty of computer science",
      model_name="gpt-4o-mini",
  )

  poem = poet()
  print(poem["response"][0])
  ```

  You can see more examples in the [examples](examples) directory.

  To run the examples, make sure to set your OpenAI API key in the environment variable `OPENAI_API_KEY` by running `export OPENAI_API_KEY=sk-...` in your terminal.



  To run the bespoke dataset viewer:

  ```bash
  curator-viewer
  ```

  This will pop up a browser window with the viewer running on `127.0.0.1:3000` by default if you haven't specified a different host and port.


  Optional parameters to run the viewer on a different host and port:
  ```bash
  >>> curator-viewer -h
  usage: curator-viewer [-h] [--host HOST] [--port PORT] [--verbose]

  Curator Viewer

  options:
    -h, --help     show this help message and exit
    --host HOST    Host to run the server on (default: localhost)
    --port PORT    Port to run the server on (default: 3000)
    --verbose, -v  Enables debug logging for more verbose output
  ```

  The only requirement for running `curator-viewer` is to install node. You can install them by following the instructions [here](https://nodejs.org/en/download/package-manager).

  For example, to check if you have node installed, you can run:

  ```bash
  node -v
  ```

  If it's not installed, installing latest node on MacOS, you can run:

  ```bash

  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash

  nvm install 22

  node -v # should print `v22.11.0`

  npm -v # should print `10.9.0`
  ```


pkgId: 18d644ecd0dc21e36d61a6b38ed62ce3b55266902b860dcd333a6479946f5a7c
name: python-bespon
arch: src
version: 0.7.0
epoch: 0
release: 1
summary: Python library for BespON
url: https://pypi.org/project/bespon/
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bespon-0.7.0-1.src.rpm
checksum_type: sha256
rpm_license:
  Copyright 2016-2017 Geoffrey M. Poore  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.  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.


pkgId: 8e3952b48c6cfd189bc84f0313c8c003d167f546e718a166a370cba29a167bdf
name: python-besser
arch: src
version: 1.4.0
epoch: 0
release: 1
summary: BESSER
url: https://pypi.org/project/besser/
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-besser-1.4.0-1.src.rpm
checksum_type: sha256
description:
  <div align="center">
    <img src="./docs/source/_static/besser_logo_light.png" alt="BESSER platform" width="500"/>
  </div>

  [![Python](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11-blue?logo=python&logoColor=gold)](https://pypi.org/project/besser/)
  [![PyPI version](https://img.shields.io/pypi/v/besser?logo=pypi&logoColor=white)](https://pypi.org/project/besser/)
  [![PyPI - Downloads](https://static.pepy.tech/badge/besser)](https://pypi.org/project/besser/)
  [![Documentation Status](https://readthedocs.org/projects/besser/badge/?version=latest)](https://besser.readthedocs.io/en/latest/)
  [![PyPI - License](https://img.shields.io/pypi/l/besser)](https://opensource.org/license/MIT)
  [![LinkedIn](https://img.shields.io/badge/-LinkedIn-blue?logo=Linkedin&logoColor=white)](https://www.linkedin.com/company/besser-pearl)
  [![GitHub Repo stars](https://img.shields.io/github/stars/besser-pearl/besser?style=social)](https://star-history.com/#besser-pearl/besser)

  BESSER is a [low-modeling](https://modeling-languages.com/welcome-to-the-low-modeling-revolution/) [low-code](https://lowcode-book.com/) open-source platform. BESSER (Building bEtter Smart Software fastER) is funded thanks to an [FNR Pearl grant](https://modeling-languages.com/a-smart-low-code-platform-for-smart-software-in-luxembourg-goodbye-barcelona/) led by the [Luxembourg Institute of Science and Technology](https://www.list.lu/) with the participation of the [Snt/University of Luxembourg](https://www.uni.lu/snt-en/) and open to all your contributions!

  The BESSER low-code platform is built on top of [B-UML](https://besser.readthedocs.io/en/latest/buml_language.html) our Python-based personal interpretation of a "Universal Modeling Language" (yes, heavily inspired and a simplified version of the better known UML, the Unified Modeling Language).
  With B-UML you can specify your software application and then use any of the [code-generators available](https://besser.readthedocs.io/en/latest/generators.html) to translate your model into executable code suitable for various applications, such as Django models or database structures compatible with SQLAlchemy.

  **Check out the official [documentation](https://besser.readthedocs.io/en/latest/)**



  BESSER works with Python 3.9+. We recommend creating a virtual environment (e.g. [venv](https://docs.python.org/3/tutorial/venv.html), [conda](https://docs.conda.io/en/latest/)).

  The latest stable version of BESSER is available in the Python Package Index (PyPi) and can be installed using

      $ pip install besser

  BESSER can be used with any of the popular IDEs for Python development such as [VScode](https://code.visualstudio.com/), [PyCharm](https://www.jetbrains.com/pycharm/), [Sublime Text](https://www.sublimetext.com/), etc.



  If you are interested in developing new code generators or designing BESSER extensions, you can download and modify the full codebase, including tests and examples.



      $ git clone https://github.com/BESSER-PEARL/BESSER.git
      $ cd BESSER



  Run the setup script to create a virtual environment (if not already created), install the requirements, and configure the ``PYTHONPATH``. This ensures compatibility with IDEs (like VSCode) that may not automatically set the ``PYTHONPATH`` for recognizing *besser* as an importable module.

      $ python setup_environment.py

  **Note:** Each time you start your IDE, run the `setup_environment.py` script to ensure the environment is properly configured.



  To verify the setup, you can run a basic example.

      $ cd tests/structural/library
      $ python library.py


  If you want to try examples, check out the [BESSER-examples](https://github.com/BESSER-PEARL/BESSER-examples) repository!



  We encourage contributions from the community and any comment is welcome!

  If you are interested in contributing to this project, please read the [CONTRIBUTING.md](CONTRIBUTING.md) file.



  This repository has the CITATION.cff file, which activates the "Cite this repository" button in the About section (right side of the repository). The citation is in APA and BibTex format.



  At BESSER, our commitment is centered on establishing and maintaining development environments that are welcoming, inclusive, safe and free from all forms of harassment. All participants are expected to voluntarily respect and support our [Code of Conduct](CODE_OF_CONDUCT.md).



  The development of this project follows the governance rules described in the [GOVERNANCE.md](GOVERNANCE.md) document.


  You can reach us at: [info@besser-pearl.org](mailto:info@besser-pearl-org)

  Website: https://besser-pearl.github.io/website/



  This project is licensed under the [MIT](https://mit-license.org/) license.


pkgId: 64c7379533103debeb7b4b04d919174c4f52629defeadef3f69d9d1c1966b567
name: python-best
arch: src
version: 2.0.5
epoch: 0
release: 1
summary: Bayesian estimation supersedes the t-test
url: https://github.com/treszkai/best
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-best-2.0.5-1.src.rpm
checksum_type: sha256
description:
  Python implementation of a Bayesian model to replace t-tests with Bayesian estimation,
  following the idea described in the following publication:

  > John K. Kruschke. _Bayesian estimation supersedes the t test._
  > Journal of Experimental Psychology: General, 2013, v.142 (2), pp. 573-603. (doi: 10.1037/a0029146)

  The package implements Bayesian estimation of the mean of one or two groups,
  and plotting functions for the posterior distributions of variables such as the effect size,
  group means and their difference.



  See the documentation for more information, at [best.readthedocs.io](https://best.readthedocs.io).



   - Python ≧ 3.7
   - SciPy
   - [Matplotlib](http://matplotlib.org) (≧ 3.0.0) for plotting
   - [PyMC3](https://github.com/pymc-devs/pymc)



  A complete analysis and plotting is done in just a few lines:

  ```python
  >>> best_out = best.analyze_two(group1_data, group2_data)
  >>> fig = best.plot_all(best_out)
  >>> fig.savefig('best_plots.pdf')
  ```
  For example, the two-group analysis in `examples/smart_drug.py` produces the following output:

  ![smart_drug.png](examples/smart_drug.png)

  More detailed analysis of the same data can be found in the Jupyter notebook `examples/Smart drug (comparison of two groups).ipynb`.

  An example single-group analysis can be found in `examples/paired_samples.py`.

  The [documentation](https://best.readthedocs.io) describes the API in detail.



  Ensure your Python version is sufficiently up-to-date (at least 3.7):

  ```bash
  $ python --version
  Python 3.7.12
  ```

  Then install this package and its dependencies with PIP:
  ```bash
  $ pip install best
  ```





  Running the tests requires [pytest](https://docs.pytest.org/en/latest/index.html) (`pip install pytest`),
  and then can be run with:

  ```bash
  $ python -m pytest tests
  ```

  The plotting tests only ensure that the `plot_all` function does not throw errors,
  and the plots need manual verification at `tests/data/plot_all_*.pdf`.



  The documentation can be built with Sphinx:

  ```bash
  $ cd docs
  $ make html
  ```


pkgId: ee233cb36eeb76d027c72319e197122577a061e84995347c25acbe9123a8c6ab
name: python-best-ec2
arch: src
version: 1.1.4
epoch: 0
release: 1
url: https://gitlab.com/aliaksei-kankou/best-ec2/python-package
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-best-ec2-1.1.4-1.src.rpm
checksum_type: sha256
summary:
  Best EC2, the smart solution designed to optimize your Amazon EC2 instance type selection process. The app simplifies the challenge of choosing the optimal EC2 instance type that matches your specific requirements, balancing performance, cost, and computing needs.

description:
  Best EC2, the smart solution designed to optimize your Amazon EC2 instance type selection process. The app simplifies the challenge of choosing the optimal EC2 instance type that matches your specific requirements, balancing performance, cost, and computing needs.


  * python >=3.8.0
  * AWS Credentials


  pip install best-ec2



  ```json
  {
      "Version": "2012-10-17",
      "Statement": [
          {
              "Sid": "General",
              "Effect": "Allow",
              "Action": [
                  "ec2:DescribeInstanceTypes"
              ],
              "Resource": "*"
          },
          {
              "Sid": "OnDemand",
              "Effect": "Allow",
              "Action": [
                  "pricing:GetProducts"
              ],
              "Resource": "*"
          },
          {
              "Sid": "Spot",
              "Effect": "Allow",
              "Action": [
                  "ec2:DescribeAvailabilityZones",
                  "ec2:DescribeSpotPriceHistory"
              ],
              "Resource": "*"
          }
      ]
  }
  ```



  | Parameter                                 | Type            | Description                                      | Required | Default | Possible Values                                |
  |-------------------------------------------|-----------------|--------------------------------------------------|----------|---------|------------------------------------------------|
  | `describe_spot_price_history_concurrency` | `Optional[int]` | Concurrency level for retrieving spot prices     | No       | 20      | -                                              |
  | `describe_on_demand_price_concurrency`    | `Optional[int]` | Concurrency level for retrieving on-demand prices| No       | 10      | -                                              |
  | `result_cache_ttl_in_minutes`             | `Optional[int]` | Time-to-live for cached results                  | No       | 60      | -                                              |
  | `instance_type_cache_ttl_in_minutes`      | `Optional[int]` | Time-to-live for cached instance type list       | No       | 1440    | -                                              |
  | `on_demand_price_cache_ttl_in_minutes`    | `Optional[int]` | Time-to-live for cached on-demand prices         | No       | 1440    | -                                              |
  | `spot_price_cache_ttl_in_minutes`         | `Optional[int]` | Time-to-live for cached spot prices              | No       | 10      | -                                              |
  | `log_level`                               | `Optional[int]` | Log level                                        | No       | `INFO` (20) | CRITICAL (50), ERROR (40), WARNING (30), INFO (20), DEBUG (10), NOTSET (0) |



  | Parameter                       | Type                         | Description                                                                                                                       | Required | Default      | Values                                                                                                                                        |
  |---------------------------------|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|----------|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
  | `vcpu`                          | `Optional[float]`            | The number of virtual CPUs allocated to the instance, which affects its computing capabilities.                                   | No       | 1            |                                                                                                                                               |
  | `memory_gb`                     | `Optional[float]`            | The amount of memory allocated to the instance, specified in gigabytes (GiB).                                                     | No       | 1            |                                                                                                                                               |
  | `region`                        | `Optional[str]`              | The region where the instance is to be deployed, which can affect availability and pricing.                                       | No       | None         | E.g., `us-east-1`, `eu-west-1`                                                                                                                |
  | `usage_class`                   | `Optional[UsageClass]`       | The pricing model under which the instance operates: either preemptible `SPOT` instances or regular `ON_DEMAND` instances.        | No       | `on-demand`  | `spot`, `on-demand`                                                                                                                           |
  | `burstable`                     | `Optional[bool]`             | Specifies if the instance type can accrue and use CPU credits for short bursts of improved performance.                           | No       | None         | `True`, `False`                                                                                                                               |
  | `architecture`                  | `Optional[Architecture]`     | The processor architecture type for the instance, which determines the instruction set and memory addressing.                     | No       | `x86_64`     | `i386`, `x86_64`, `arm64`, `x86_64_mac`                                                                                                      |
  | `product_description`           | `Optional[ProductDescription]` | The list of operating systems available for the instance, which may affect compatibility and pricing.                             | No       | `Linux/UNIX` | `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Linux/UNIX (Amazon VPC)`, `Red Hat Enterprise Linux (Amazon VPC)`, `SUSE Linux (Amazon VPC)`, `Windows (Amazon VPC)` |
  | `is_current_generation`         | `Optional[bool]`             | Indicates if only the latest generation of instances should be considered, which typically offer better performance and features. | No       | None         | `True`, `False`                                                                                                                               |
  | `has_gpu`                       | `Optional[bool]`             | Designates whether the instance includes one or more GPUs, providing additional graphics or computational power.                  | No       | None         | `True`, `False`                                                                                                                               |
  | `gpu_memory`                    | `Optional[int]`              | If GPUs are present, this specifies their total memory in GiB. Only applicable when `has_gpu` is True.                            | No       | None         |                                                                                                                                               |
  | `gpus`                          | `Optional[int]`              | If GPUs are present, this specifies their total GPUs. Only applicable when `has_gpu` is True.                                     | No       | None         |                                                                                                                                               |
  | `is_instance_storage_supported` | `Optional[bool]`             | Determines if the instance should have direct attached storage, often used for high-performance requirements.                     | No       | None         | `True`, `False`                                                                                                                               |
  | `max_interruption_frequency`    | `Optional[int]`              | The maximum acceptable spot instance interruption rate, as a percentage (1-100). This helps balance cost with stability.          | No       | None         | E.g., 10                                                                                                                                       |
  | `availability_zones`            | `Optional[List[str]]`        | The specific geographic locations in which to search for instances, which can affect latency and data sovereignty considerations. | No       | None         | E.g., `us-east-1a`, `us-east-1b`                                                                                                              |
  | `final_spot_price_strategy`     | `Optional[FinalSpotPriceStrategy]` | Strategy used to determine the final spot price, which can optimize for cost or stability of the spot instance.                   | No       | `min`        | `min`, `max`, `average`                                                                                                                       |



  | Field                    | Type                                  | Description                                                                                                                | Example Values                                              |
  |--------------------------|---------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
  | `instance_type`          | `str`                                 | The identifier for the type of instance, which determines its capabilities, such as CPU and memory.                        | `c5d.large`, `m6idn.large`                                  |
  | `price`                  | `float`                               | The price per hour for the instance type. This could be the on-demand price or the spot price, which can vary based on market demand. | 0.0378, 0.0995                                              |
  | `az_price`               | `Optional[Dict[str, float]]`          | A dictionary containing the prices for the instance type within different Availability Zones.                              | `{'us-east-1a': 0.0378, 'us-east-1b': 0.0400}`              |
  | `vcpu`                   | `int`                                 | The number of virtual CPUs (vCPUs) provided by the instance type, which affects its processing capability.                 | 2, 4                                                        |
  | `memory_gb`              | `float`                               | The amount of memory (RAM) that the instance type offers, measured in GiB (gibibytes).                                     | 8, 16                                                       |
  | `network_performance`    | `str`                                 | A qualitative description of the instance type's network performance capability.                                          | `Up to 10 Gigabit`, `20 Gigabit`                            |
  | `storage`                | `Union[str, List[DiskInfo]]`          | Information about the storage that comes with the instance type, including size and type. It could be a list or a descriptive string. | `EBS only`, `[{'SizeInGB': 50, 'Count': 1, 'Type': 'ssd'}]` |
  | `gpu_memory_gb`          | `Optional[int]`                       | The amount of dedicated GPU memory that comes with the instance type, if applicable, measured in GiB.                     | 4, 8                                                        |
  | `gpus`                   | `Optional[int]`                       | The number of graphical processing units (GPUs) available in the instance type, which can enhance graphics and computational tasks. | 1, 2                                                        |
  | `interruption_frequency` | `Optional[InterruptionFrequencyInfo]` | An estimate of how often a spot instance may be interrupted. It can include statistical rates or qualitative descriptions. | `{'min': 5, 'max': 10, 'rate': '<10%'}`                     |





  ```
  from best_ec2 import (
      BestEc2,
      InstanceTypeRequest,
      InstanceTypeResponse,
  )

  ec2 = BestEc2()

  request: InstanceTypeRequest = {"vcpu": 1, "memory_gb": 1}

  response: InstanceTypeResponse = ec2.get_types(request)

  print(response[0:3])
  ```

  Response example:

  ```json
  [
     {
        "instance_type":"t3a.micro",
        "vcpu":2,
        "memory_gb":1,
        "network_performance":"Up to 5 Gigabit",
        "storage":"EBS Only",
        "price":0.0094
     },
     {
        "instance_type":"t3.micro",
        "vcpu":2,
        "memory_gb":1,
        "network_performance":"Up to 5 Gigabit",
        "storage":"EBS Only",
        "price":0.0104
     },
     {
        "instance_type":"t2.micro",
        "vcpu":1,
        "memory_gb":1,
        "network_performance":"Low to Moderate",
        "storage":"EBS Only",
        "price":0.0116
     }
  ]
  ```



  ```
  import logging
  from botocore.config import Config

  from best_ec2 import (
      BestEc2,
      BestEc2Options,
      InstanceTypeRequest,
      InstanceTypeResponse,
      UsageClass,
      Architecture,
      ProductDescription,
      FinalSpotPriceStrategy,
  )

  options: BestEc2Options = {
      "describe_spot_price_history_concurrency": 20,
      "describe_on_demand_price_concurrency": 15,
      "result_cache_ttl_in_minutes": 120,
      "instance_type_cache_ttl_in_minutes": 2880,
      "on_demand_price_cache_ttl_in_minutes": 720,
      "spot_price_cache_ttl_in_minutes": 5,
  }

  logging.basicConfig(
      level=logging.INFO, format="s: s: s"
  )
  logger = logging.getLogger()

  ec2 = BestEc2(options, logger)

  request: InstanceTypeRequest = {
      "vcpu": 1,
      "memory_gb": 2,
      "usage_class": UsageClass.SPOT.value,
      "region": "eu-central-1",
      "burstable": False,
      "architecture": Architecture.X86_64.value,
      "product_description": ProductDescription.LINUX_UNIX.value,
      "is_current_generation": True,
      "is_instance_storage_supported": True,
      "max_interruption_frequency": 0,
      "availability_zones": [
          "eu-central-1a",
          "eu-central-1b",
      ],
      "final_spot_price_strategy": FinalSpotPriceStrategy.MIN.value,
  }

  request_config: RequestConfig = {
      "ec2_client_config": Config(
          max_pool_connections=20, retries={"max_attempts": 15, "mode": "standard"}
      )
  }

  response: InstanceTypeResponse = ec2.get_types(request, request_config)

  print(response[0:3])
  ```

  Response example:

  ```json
  [
     {
        "instance_type":"i3en.large",
        "vcpu":2,
        "memory_gb":16,
        "network_performance":"Up to 25 Gigabit",
        "storage":[
           {
              "SizeInGB":1250,
              "Count":1,
              "Type":"ssd"
           }
        ],
        "price":0.0332,
        "az_price":{
           "eu-central-1a":0.0396,
           "eu-central-1b":0.0332
        },
        "interruption_frequency":{
           "min":0,
           "max":5,
           "rate":"<5%"
        }
     },
     {
        "instance_type":"c5ad.large",
        "vcpu":2,
        "memory_gb":4,
        "network_performance":"Up to 10 Gigabit",
        "storage":[
           {
              "SizeInGB":75,
              "Count":1,
              "Type":"ssd"
           }
        ],
        "price":0.0426,
        "az_price":{
           "eu-central-1a":0.0426,
           "eu-central-1b":0.0496
        },
        "interruption_frequency":{
           "min":0,
           "max":5,
           "rate":"<5%"
        }
     },
     {
        "instance_type":"c5d.large",
        "vcpu":2,
        "memory_gb":4,
        "network_performance":"Up to 10 Gigabit",
        "storage":[
           {
              "SizeInGB":50,
              "Count":1,
              "Type":"ssd"
           }
        ],
        "price":0.0448,
        "az_price":{
           "eu-central-1b":0.0448,
           "eu-central-1a":0.0459
        },
        "interruption_frequency":{
           "min":0,
           "max":5,
           "rate":"<5%"
        }
     }
  ]

  ```


pkgId: 2b4247f16316ce3db8279f755e20544fa6c16df07d2139708d5c947db0f8a605
name: python-best-shot
arch: src
version: 0.1.1
epoch: 0
release: 1
summary: Take your best shot
url: https://pypi.org/project/best-shot/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-best-shot-0.1.1-1.src.rpm
checksum_type: sha256
description:
  Made with ❤️ by developers who believe in the power of learning from examples.
  *Remember: The best AI is the one that learns from experience!* 🌟


pkgId: e73c8276a242386546c17beb65104bcf3901cdae25df966b99e9bb1cbca2458f
name: python-best403unlocker_py
arch: src
version: 0.0.1
epoch: 0
release: 1
summary: python lib of best403unlocker
url: https://github.com/msnp1381/best403unlocker-py
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-best403unlocker_py-0.0.1-1.src.rpm
checksum_type: sha256
description:
  The Python version of the 403 unlocker tool, available in [here](https://github.com/403unlocker/best403unlocker-py), has several key features:



  Built using Python's robust networking libraries and tools, providing excellent DNS handling capabilities and cross-platform support.



  Thanks to Python's portability, this project supports:

  - **Windows** (manual DNS configuration required)
  - **Linux** (automatic configuration)
  - **macOS** (automatic configuration)



  - Automated DNS speed testing
  - Progress bar visualization
  - Config file support
  - Both CLI and interactive modes





  ```bash
  pip install best403unlocker_py
  ```





  - Python 3.8 or higher
  - Poetry package manager
  - Administrative/root privileges (required for DNS configuration)



  1. Clone the repository:

  ```bash
  git clone https://github.com/403unlocker/best403unlocker-py.git
  cd best403unlocker-py
  ```

  2. Install dependencies using Poetry:

  ```bash
  poetry install
  ```





  This will:

  - Test all configured DNS servers
  - Display a progress bar during testing
  - Show results in a table format
  - Prompt to apply the fastest DNS server

  Command Line Options

  1. Test DNS servers with applying:

      ```bash
      unlock403 [--url URL]
      ```

  2. Test DNS servers without applying:

      ```bash
      unlock403 search-dns [--url URL]
      ```

  3. Set custom DNS servers:

     ```bash
     unlock403 set-custom-dns 8.8.8.8 8.8.4.4
     ```

  Examples
  Find fastest DNS for a specific domain:

  1. Default mode searche and set:

  ```bash
  unlock403
  ```

  2. Default mode searche and set with specific URL:

  ```bash
  unlock403 --url developers.google.com
  ```

  3. search with default url for dns:

  ```bash
  unlock403 search-dns
  ```

  4. search with custom url url for dns

  ```bash
  unlock403 search-dns --url developers.google.com
  ```



  Original concept by [Arman Taheri](https://github.com/ArmanTaheriGhaleTaki)



  Feel free to open issues and PRs on GitHub.

  [@msnp1381](https://github.com/msnp1381)
  OR
  [Email Me](mailto:mohamadnematpoor@gmail.com)


pkgId: f2e3b7234a0d3155cbb055e2ad22c14ef48b1eed756292f251ae584cbf11844c
name: python-bestchange-api
arch: src
version: 3.1.0.0
epoch: 0
release: 1
summary: Библиотека для работы с "api" сервиса bestchange.ru
url: https://maksam07.com
rpm_license: BSD License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bestchange-api-3.1.0.0-1.src.rpm
checksum_type: sha256
description:
  Библиотека для работы с "api" сервиса bestchange.ru предоставит Вам возможность получить:

  * курсы со всех направлений;
  * валюты;
  * обменные пункты;
  * города;
  * а так же кеширование всех этих данных.

  Установка:

  ```console
  pip install bestchange-api
  ```

  Пример использования:

  ```python
  from bestchange_api import BestChange

  api = BestChange()
  exchangers = api.exchangers().get()

  dir_from = 93
  dir_to = 42
  rows = api.rates().filter(dir_from, dir_to)
  title = 'Exchange rates in the direction (https://www.bestchange.ru/index.php?from={}&to={}) {} : {}'
  print(title.format(dir_from, dir_to, api.currencies().get_by_id(dir_from), api.currencies().get_by_id(dir_to)))
  for val in rows[:3]:
      print('{} {}'.format(exchangers[val['exchange_id']]['name'], val))

  ```

  Для обменных пунктов есть возможность сразу получить количество отзывов о них (работает, только если у обменника есть
  хоть одно направление на BestChange):

  ```python
  from bestchange_api import BestChange

  api = BestChange(exchangers_reviews=True)
  ```

  Все методы, реализованные на данный момент:

  ```python
  from bestchange_api import BestChange

  api = BestChange(cache=True, cache_seconds=300, cache_path='/home/user/tmp/')
  api.is_error()  # Возвращает False, если данные успешно загружены, иначе текст ошибки

  api.currencies().get()  # Получить список всех валют
  api.currencies().get_by_id(1)  # Получить название или словарь определенной валюты
  api.currencies().search_by_name('text')  # Поиск валют по подстроке

  api.exchangers().get()  # Получить список всех обменных пунктов
  api.exchangers().get_by_id(1)  # Получить название или словарь обменного пункта
  api.exchangers().search_by_name('text')  # Поиск обменных пунктов по подстроке

  api.cities().get()  # Получить список всех городов
  api.cities().get_by_id(1)  # Получить название или словарь города
  api.cities().search_by_name('text')  # Поиск городов по подстроке

  api.rates().filter(1, 2)  # Возвращает курсы, отфильтрованный и отсортированных по направлению


  currencies = api.currencies().get()
  for val in api.top().get():
      print(currencies[val['give_id']]['name'], '->', currencies[val['get_id']]['name'], ':', round(val['perc'], 2))
  ```

  Работа с прокси:

  ```python
  from bestchange_api import BestChange

  proxy = {'http': '127.0.0.1', 'https': '127.0.0.1'}
  api = BestChange(proxy=proxy)
  ```


pkgId: 2a93b7b6ae63ffe4387e8e3cc12353edbc96702f97ec93f939747b19684d49e8
name: python-bestconfig
arch: src
version: 1.3.6
epoch: 0
release: 1
summary: Setup your project config easily
url: https://github.com/fivol/bestconfig
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bestconfig-1.3.6-1.src.rpm
checksum_type: sha256
description:
  Этот модуль поможет сильно упростить использование конфигурационных
  файлов, вы предпочитаете хранить константы и
  настройки в `.yaml`, `.json` или в переменных окружения?
  Это не важно, `bestconfig` учитывает множество вариантов
  и предоставляет очень удобный интерфейс доступа к данным

  ```
  pip install bestconfig
  ```


  Предположим, у вас такая структура проекта
  ```
  root/
      app:
        main.py
        myconfig.json
      config.yaml
      .env
  ```
  `app/main.py`
  ```python
  from bestconfig import Config

  config = Config("myconfig.json")





  logger = config.get('logger')
  logger = config.logger
  logger = config['logger']

  mode = config.logger.mode
  mode = config.get('logger.mode') # -> DEBUG или None
  mode = config['__unknown__'] # raise KeyError
  mode = config.get('__unknown__') # return None
  ```
  Содержимое файлов:

  `.env`
  ```dotenv
  DATABASE_PASSWOD=postgres
  ```
  `config.yaml`
  ```yaml
  HOST: http://localhost
  PORT: 5050
  logger:
    mode: WARNING
  ```
  `myconfig.json`
  ```json
  {
      "VERSION": "1.23.4",
      "BUILD": 5563
  }
  ```
  `config.to_dict()` покажет следующее:
  ```json
  {
      "logger": {
          "mode": "DEBUG"
       },
      "VERSION": "1.23.4",
      "BUILD": 5563,
      "PORT": 5050,
      "HOST": "http://localhost",
      "DATABASE_PASSWOD": "postgres"
  }
  ```

  1. Класс `Config` просканировал текущую директорию, вплоть до корня проекта
  2. Нашел все указанные в аргументах файлы и те, что в списке по умолчанию
     (например `.env`, `env_file`, `config.yaml`, `configuration.ini` и тд)



  - Файлы следующих типов:
    - `.json`
    - `.yaml`
    - `.yml`
    - `.ini`
    - `.py` (если в нем нет инициализации `Config()` во избежание рекурсии)
    - `.cfg`
  - Файлы в формате `CONFIG_NAME=CONFIG_VALUE`
  - Уже существующие и новые переменные окружения
  - Обычные `python` словари



  - Все комбинации имени

    `config` `configuration` `settings` `setting` `conf`

    и расширения

    `.json` `.yaml` `.ini` `.env` `.cfg`
  - Выделенные, часто используемые названия
      - `env_file`
      - `.env`
      - `config.py`


  1. Через точку `config.name`
  1. Нотация `python dict` `config['name']`
  Бросает исключение при отсутствии
  1. `config.get('name', 'default_value', raise_absent=False)`
  1. `config.get('name.subname')` если параметр это тоже словарь,
  к вложенным значениям можно обращаться единым запросом через `get`,
     вложенность не ограничена
  1. Можно сразу при запросе приводить результат к определенному типу
      ```python
      config = Config()

      LIMIT = config.int('LIMIT')
      RATE = config.float('RATE')
      LOGGER = config.dict('logger')
      USERNAME = config.str('ADMIN_USERNAME')
      PRICES = config.list('PRICES')
      ```
      Эти функции, вернут вам значение соответствующего типа, либо,
      если преобразование не удалось - `None`
  1. По умолчанию, при обращении без указания типа, происходит следующее
      1. Каждый формат файлов, например `.yaml` уже парсится с учетом типов,
    так `varname: 123` будет считано как число 123
      1.  Если значение все равно представляет собой строку,
    совершается попытка интерпретировать его `python` выражение,
          так `.env` файл, содержащий `LIST=[1, 2]` станет
          ```python
          l = config.get('LIST')
          isinstance(l, list) # True
          print(l) # [1, 2]
          ```
          Чтобы избежать такого поведения, используйте
          ```python
           config.get_raw('key')
          ```
          Возвращенное значение не будет обработано, на самом деле, эта функция всего лишь делает
      `config.get(cast=None)`. За подробностями в исходники ;)

  Сохранить новую переменную, можно с помощью `set`
  ```python
  config.set('pages_limit', 12)
  print(config.get('pages_limit')) -> 12

  config.set('d', {'a': 'value'})

  ```

  Чтобы проверить, что нужные переменные окружения или файлы
  импортировались, используйте `config.assert_contains()`
  ```python
  config.set('key', 'value')
  config.assert_contains('key') # pass
  config.assert_contains('key1') # raise KeyError
  ```
  Бывает необходимо некоторым образом преобразовать
  конфиги после импорта из файлов, тогда пригодится функция `update_from_locals()`
  ```python
  from bestconfig import Config

  config = Config()

  FULL_NAME = f'{config.name} {config.lastname}'

  config.update_from_locals()
  ```
  Она рассматривает словарь `locals()` (то есть локальные переменные) и добавляет в общую базу
  `config.get('FULL_NAME')`

  Также иногда бывает удобно, вместо `config.set('key', 'value')`
  добавить целый словарь или даже файл во время исполнения
  ```python
  from bestconfig import Config
  config = Config(exclude_default=True)

  config.insert({
      'name': 'Ivan'
  })
  config.assert_contains('name')


  config.insert('other_file.yaml')
  ```



  - [github](https://github.com/fivol/bestconfig)
    Ссылки ниже доступны только с гитхаба (не с [pypi.org](https://pypi.org/project/bestconfig/))
  - [Примеры использования](examples)
  - [Как запустить тесты](docs/TESTS.md)

  **Если после документации остались вопросы,
  код подробно документирован, можно смело смотреть в исходники и читать docstring**


  - Поддержка загрузки из базы данных
  - Поддержка загрузки с config сервера
  - Перевод документации и комментариев на английский


pkgId: 92b05f3435c1fee916f0d4f89dea41f1d48ff19edb1309330fc8b7d9d9551011
name: python-bestia
arch: src
version: 4.8
epoch: 0
release: 1
summary: A collection of tools for building dynamic Command-Line applications
url: https://github.com/synestematic/bestia
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bestia-4.8-1.src.rpm
checksum_type: sha256
description:
  bestia is a library of functions and classes designed to help you build vibrant and dynamic applications for the command-line on Linux / Darwin systems. It allows you to create rich evolving TUI's for your terminal-based tools using a simple and readable programming interface.



  Please install bestia using pip:

  ```
  $   python3 -m pip install bestia
  ```


  The library does not require you to install any external dependencies.






  ```
  * echo
  * FString
  * Row
  * tty_cursor
  * tty_clear
  * tty_up
  * tty_rows
  * tty_cols
  * expand_seconds
  * human_bytes
  * remove_path
  * obfuscate_random_chars
  * ProgressBar
  * ansi_esc_seq
  * ansi_sgr_seq
  ```



  ```
  * LoopedList
  * items_are_equal
  * iterable_to_string
  * unique_random_items
  * pop_random_item
  ```




  Let's focus on the `echo` function, the `FString` class and the `Row` class which contain the core of this library's functionality.

  `>>> from bestia.output import echo, FString, Row `




  This is a very basic function which takes your string as first argument, followed by any number of effects that you may want to apply to your text. You can specify up to a maximum of 2 colors (1st: foreground, 2nd: background) and as many effects as you want.

  ![](https://github.com/synestematic/bestia/blob/master/resources/e.png?raw=true)

  Supported color values:
  `'black' 'red' 'green' 'yellow' 'blue' 'magenta' 'cyan' 'white'`


  Supported effect values:
  `'reset' 'bold' 'faint' 'underline' 'blink' 'reverse' 'conceal' 'cross' 'frame' 'circle' 'overline'`

  Not all terminal emulators support the same colors or effects so some of these may not work depending on what you are using.

  The echo function also has an optional last keyword argument `mode` that alters how strings are rendered|terminated.

  ```
  >>> echo("foo", mode='raw')
  foo>>>
  ```

  The `'modern'` mode is your standard printing mode.
  The `'raw'` mode prints strings without appending a newline char.
  The `'retro'` mode emulates the printing style of an 80's computer by adding a random amount of lag to each char that gets printed. It can make your applications have a real vintage feel to them.

  Play with all of them and see what you like!




  The `FString` class has all the "coloring" functionality of the `echo` function but requires you to explicitly use it's attributes `fg: str, bg: str, fx: list`. This added complexity allows for far more flexibility since you can specify these values when instantiating an object and modify them at will later. You can print your FString either by calling it's echo method or by printing the object itself.

  Coloring is NOT however the main feature of this class, the most important functionality that `FString` provides is the ability to force strings into specific areas of your terminal space. It achieves this by dynamically padding your string with spaces (or any other char) so that it will be placed where needed on the horizontal plane.

  ```
  >>> fs1 = FString('123', size=5, align='r')
  >>> print(fs1)
    123
  >>> fs1.size = 10
  >>> print(fs1)
         123
  >>> fs1.align = 'c'
  >>> print(fs1)
     123
  ```

  Notice how the "123" string moves to the right by setting it's `size` and `align` attributes. The default value for `align` is `'l'`, but other possible values are:
   `'l' 'r' 'c' 'cl' 'cr'`


  `FString` can add space to your strings but it can also crop them if you set a `size` value lower than the string's actual length. This is extremely useful when you are dealing with dynamic text and you want to ensure it will not take more than a fixed amount of space in your application.

  ```
  >>> fs2 = FString('Welcome to the Jungle!', size=10)
  >>> fs2.echo()
  Welcome to
  >>> fs2.size = 16
  >>> fs2.echo()
  Welcome to the J
  ```


  Dealing with empty spaces can make it hard to understand where our FStrings finish and begin. You can use the `pad` attribute for debugging purposes or to create more interesting TUI's:

  ```
  >>> FString(' asd ', size=20, align='cl', pad=' ').echo(mode='modern')
          asd
  >>> FString(' asd ', size=20, align='cl', pad='|').echo(mode='modern')
  ||||||| asd ||||||||
  >>> FString(' asd ', size=20, align='cr', pad='*').echo(mode='modern')
  ******** asd *******
  ```

  The `echo` method of `FString` also has an optional `mode` argument which works exactly as in the `echo` function.




  Row() is a class that accepts any number of `str` or `FString` objects as arguments and forces them to print on the same terminal row by automatically detecting the size of your terminal window and resizing each item accordingly. It will crop items if their total length is more than your terminal size or add spaces if their length is less. It is a fantastic tool for building dynamic textual user interfaces. First, let's check out some basics:

  ```
  >>> r = Row( '123', FString('ABC', align='r') )
  >>> r.echo(mode='retro')
  123                                                                                   ABC
  ```

  The size of your terminal is calculated on the fly just before rendering your strings. This means that `Row` objects work great at keeping your data neat and viewable even across terminal window resizes.

  Most of the times you will want your Row instances to automatically size up to your terminal width but if for some reason you don't, you can always set their `size` attribute to a static size.

  ```
  >>> r.size = 30
  >>> r.echo()
  123                        ABC
  ```

  If you need any of the strings that make up your `Row` to NOT be resized, just init a `FString` and then set it's `size` attribute to a static value. That object will now keep it's size static and `Row` will resize all other items.


  ```
  >>> Row(
  ...     FString('id', size=3, fg='cyan', align='l', bg='blue', fx=['bold', 'underline']),
  ...     FString('Location', size=None, fg='yellow', bg='blue', fx=['bold', 'underline']),
  ...     FString('Size', size=6, align='r', bg='blue', fx=['bold', 'underline']),
  ...     FString('Files', size=6, fg='green', align='r', bg='blue', fx=['bold', 'underline']),
  ...     FString('Users', size=6, fg='red', align='r', bg='blue', fx=['bold', 'underline']),
  ...     FString('Categories', size=15, align='r', bg='blue', fx=['bold', 'underline']),
  ...    ).echo(mode='retro')
  ```

  In this example, all items will have a fixed size and `Row` will take care of making them fit exactly into the terminal width by shrinking/expanding the Location `FString` (the only one that has not a fixed size value). The `mode` parameter will take care of giving the rendering of the string a retro vibe.

  Unfortunately MarkDown does not do a great job at showing off all the possibilities that this library gives you in terms of creating classy looking CLI tools. I will let the next __screenshots__ section do some of the talking now with a couple of examples of applications built using bestia.

  Enjoy!




  ![](https://github.com/synestematic/bestia/blob/master/resources/k.png?raw=true)

  ![](https://github.com/synestematic/bestia/blob/master/resources/r.png?raw=true)

  ![](https://github.com/synestematic/bestia/blob/master/resources/th.png?raw=true)


pkgId: e710cb85b832e6c99708d5a48fb6582bc99a52e01abc38e02411df483d8de7eb
name: python-bestrag
arch: src
version: 0.2.1
epoch: 0
release: 1
url: https://github.com/samadpls/bestRAG
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bestrag-0.2.1-1.src.rpm
checksum_type: sha256
summary:
  bestrag: Library for storing and searching document embeddings in a Qdrant vector database using hybrid embedding techniques.

description:
  To install **BestRAG**, simply run:
  ```bash
  pip install bestrag
  ```

  Here’s how you can use **BestRAG** in your projects:
  ```python
  from bestrag import BestRAG
  rag = BestRAG(
      url="https://YOUR_QDRANT_URL",
      api_key="YOUR_API_KEY",
      collection_name="YOUR_COLLECTION_NAME"
  )

  rag.store_pdf_embeddings("your_pdf_file.pdf")

  results = rag.search(query="your search query", limit=10)
  print(results)
  ```
  > **Note**: To generate your API key and endpoint, visit [Qdrant](https://qdrant.tech/).

  - **Hybrid RAG**: Utilizes dense, sparse, and late interaction embeddings for enhanced performance.
  - **Easy Integration**: Simple API for storing and searching embeddings.
  - **PDF Support**: Directly store embeddings from PDF documents.

  Feel free to contribute to **BestRAG**! Whether it’s reporting bugs, suggesting features, or submitting pull requests, your contributions are welcome.


pkgId: 63bf23f21507f15a894df5e83dac5745df61ea1468e13f35b1f0fae31f956d74
name: python-beta-code
arch: src
version: 1.1.1
epoch: 0
release: 1
summary: Converts Greek Beta Code to Greek characters and vice versa
url: https://github.com/perseids-tools/beta-code-py
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-beta-code-1.1.1-1.src.rpm
checksum_type: sha256
description:
  Converts Greek Beta Code to Greek characters and vice versa.



  `pip install beta-code`

  (See project on [PyPI](https://pypi.org/project/beta-code/))



  ```python
  import beta_code

  beta_code.greek_to_beta_code(u'χαῖρε ὦ κόσμε')


  beta_code.beta_code_to_greek(u'mh=nin a)/eide qea\\ *phlhi+a/dew *)axilh=os')

  ```



  ```python
  beta_code.beta_code_to_greek(u'f2a/nac', custom_map={ u'f2': u'ϝ' })

  ```



  `python -m unittest tests/test_beta_code.py`



  ```bash
  git subtree pull --prefix beta_code/vendor/beta-code-json/ https://github.com/perseids-tools/beta-code-json master --squash
  ```

  In the case of a merge conflict:

  ```bash
  git checkout --theirs vendor/beta-code-json/
  git add vendor/beta-code-json
  git commit
  ```



  * Install dependencies:

  ```bash
  python3 -m venv venv
  . ./venv/bin/activate
  pip3 install -r requirements.txt
  ```

  * Bump version in `setup.py`
  * Commit and push to GitHub
  * On GitHub, create a new release
  * Run `pip3 install wheel`
  * Run `python3 setup.py sdist bdist_wheel`
  * Run `python3 -m twine upload dist/*`



  For the mappings between Beta Code and Unicode, see [https://github.com/perseids-tools/beta-code-json](https://github.com/perseids-tools/beta-code-json).


pkgId: 2bd8a37f65568952e06bdaff9416e586998ad79e2b56a1b2ec525ff7e7563200
name: python-betabageldb
arch: src
version: 0.2.45
epoch: 0
release: 1
summary: BagelDB is a Python library for interacting with the BagelDB API.
url: https://github.com/Bagel-DB/Client
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betabageldb-0.2.45-1.src.rpm
checksum_type: sha256
description:
  Welcome to the BagelDB Python Client Example! BagelDB is your bread-and-butter library for interacting with the BagelDB API without breaking a sweat.

  One of the perks? **No need to call the OpenAI Embeddings method or any other model to generate embeddings!** That's right, the BagelDB client handles that for you. So, you don't need to spend extra bucks on generating embeddings. Quite a dough-saver, isn't it? 🥯💰



  - Python 3.6+
  - pip package manager
  - Cluster size limit 500MB (*Create a new issue if you want to increase the limit)



  To install the BagelDB Python client, run the following command in your terminal:

  ```shell
  pip install betabageldb
  ```



  1. **Import the necessary modules:**

  ```python
  import uuid
  import bagel
  from bagel.config import Settings
  ```

  This snippet imports the required modules for using BagelDB, including the uuid module for generating unique identifiers.

  2. **Define the BagelDB server settings:**

  ```python
  server_settings = Settings(
      bagel_api_impl="rest",
      bagel_server_host="api.bageldb.ai"
  )
  ```
  Here, we define the settings for connecting to the BagelDB server.

  3. **Create the BagelDB client:**

  ```python
  client = bagel.Client(server_settings)
  ```

  Create an instance of the BagelDB client using the previously defined server settings.

  4. **Ping the BagelDB server:**

  ```python
  print(client.ping())
  ```

  This checks the connectivity to the BagelDB server.

  5. **Get the BagelDB server version:**

  ```python
  print(client.get_version())
  ```

  Retrieves and prints the version of the BagelDB server.

  6. **Create and delete a cluster:**

  ```python
  name = str(uuid.uuid4())
  client.create_cluster(name)
  client.delete_cluster(name)
  ```
  Generates a unique name for a cluster, creates it, and then deletes it. This demonstrates basic cluster management.


  7. **Create, add documents, and query a cluster:**

  ```python
  cluster = client.get_or_create_cluster("testing")

  cluster.add(
      documents=["This is doc", "This is gooogle doc"],
      metadatas=[{"source": "notion"},
                 {"source": "google-doc"}],
      ids=[str(uuid.uuid4()), str(uuid.uuid4())],
  )

  results = cluster.find(query_texts=["query"], n_results=5)
  ```

  Creates a cluster or retrieves an existing one, adds documents with metadata. Here `ids` are unique identifiers for each documents. BagelDB generates embeddings using its model. And performs a text-based query/search. Here `n_results` is to limit number of results.


  8. **Add embeddings and query (without needing to generate embeddings yourself!):**

  ```python
  cluster = client.get_or_create_cluster("new_testing")

  cluster.add(embeddings=[[1.1, 2.3], [4.5, 6.9]],
              metadatas=[{"info": "M1"}, {"info": "M1"}],
              documents=["doc1", "doc2"],
              ids=["id1", "id2"])

  results = cluster.find(query_embeddings=[[1.1, 2.3]], n_results=2)
  ```

  This is similar to the previous example but uses pre-calculated embeddings for documents and performs a query based on those embeddings.

  9. **Modify cluster name:**

  ```python
  cluster.modify(name="new_name")
  ```

  Changes the name of the cluster.

  10. **Update document metadata:**

  ```python
  cluster.update(ids=["id1"], metadatas=[{"new":"metadata"}])
  ```

  Updates the metadata of a specific document in the cluster.

  11. **Upsert documents:**

  ```python
  cluster.upsert(documents=["new doc"],
                 metadatas=[{"new": "metadata"}],
                 ids=["doc1"])
  ```

  Inserts or updates documents in the cluster based on provided IDs.

  12. **Get cluster size:**
  ```python
  cluster = client.get_or_create_cluster("new_testing")
  print(f"cluster size {cluster.cluster_size} mb")
  ```
  Get the size of the cluster in megabytes. For each cluster max size is 500MB.

  13. **Add image:**

  In BagelDB we can add image also. Here is an example of adding image to cluster. It supports almost every image format.

  ```python
  filename = "your_img.png"
  resp = cluster.add_image(filename)
  ```
  14. **Embedding size:**

  ```python
  print(f"Embedding size {cluster.embedding_size}")
  ```

  Initially, if no data is added to the cluster, the value of `embedding_size` is None. After adding data, the `embedding_size` is set or assigned.


  15. **Add image by image download URLs:**

  Multiple images can be added to a BagelDB cluster using URLs. It's recommended to add fewer than 20 images at a time using this function. Upon execution, the function will return the URLs of successfully added images and those that failed. Here's an example:

  ```python
  cluster = api.get_or_create_cluster("new_testing")
  urls = [
      "https://bagel-public-models-s3-download.s3.eu-north-1.amazonaws.com/cat/60de145c79609acaba3bbe08974a9ff5.jpg",
      "https://bagel-public-models-s3-download.s3.eu-north-1.amazonaws.com/cat/black-white-cat-wallpaper.jpg",
  ]
  ids = [str(uuid.uuid4()) for i in range(len(urls))]
  resp = cluster.add_image_urls(ids=ids, urls=urls)
  ```


  Explore additional tutorials for more insights.

  - [Python Client Example](https://colab.research.google.com/drive/1PXRoP4vIsqQqsD9AGUrQ90D3x0x79F_w)
  - [Using BagelDB with Llama Index](https://colab.research.google.com/drive/13F3PxNgF10ZGlpZS20hQtwwkd8BiMcTS)
  - [Using BagelDB with Langchain](https://colab.research.google.com/drive/1UBWkuihFHvxbzeP61HT1-ttTsURcEXIS?usp=sharing)
  - [Build an image search engine in 10 minutes using BagelDB](https://colab.research.google.com/drive/1J_QlpqvnVloWHg_Q87s-hbp_VGq4wLQz)

  <br>

  Need more dough-tails? See the [example code](example.py) for a more comprehensive guide on using the BagelDB Python client.

  Happy coding and enjoy your fresh Bagels! 🥯👩‍💻👨‍💻


pkgId: b67e1123b98c7bd2d578917fb47436abedaf601828ecc53ac1e5f047d89d6aed
name: python-betacal
arch: src
version: 1.1.0
epoch: 0
release: 1
summary: Beta calibration
url: https://betacal.github.io/
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betacal-1.1.0-1.src.rpm
checksum_type: sha256
description:
  This package provides a BetaCalibration class which allows the user to fit any of our three proposed beta calibration models. For the paper and tutorials, check [https://betacal.github.io/](https://betacal.github.io/).



  * [Numpy] - NumPy is the fundamental package for scientific computing with
    Python.
  * [Scikit-learn] - Machine Learning in Python.



   - Install from pip using "pip install betacal"
   - Alternatively, download from the repository, cd to the folder and use "pip install ."
   - Once installed, import the package using "import betacal"



  Create a virtual environment with the necessary dependencies

  ```
  virtualenv venv
  . ./venv/bin/activate
  pip install -r requirements.txt
  ```

  and then run the script runtests.sh

  ```
  bash runtests.sh
  ```



  MIT

  [//]: # (References)
     [Numpy]: <http://www.numpy.org/>
     [Scikit-learn]: <http://scikit-learn.org/>


pkgId: 49566f2493f5f99f20e353dd1446ee80a4601ce19961a8de343a1eeeb01ac3d2
name: python-betacaptcha
arch: src
version: 0.3.0
epoch: 0
release: 1
summary: please add a summary manually as the author left a blank one
url: https://pypi.org/project/betacaptcha/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betacaptcha-0.3.0-1.src.rpm
checksum_type: sha256
description:
  Repository này chứa một client Python đơn giản để tương tác với API của BetaCaptcha. Client cung cấp các phương thức để chuyển đổi hình ảnh thành văn bản thông qua giải CAPTCHA, truy xuất số dư tài khoản, và giải các loại CAPTCHA khác nhau bao gồm hình ảnh CAPTCHA và reCAPTCHA.



  Để sử dụng client này, bạn cần cài đặt Python. Bạn có thể cài đặt các thư viện cần thiết bằng cách sử dụng `pip`:

  ```bash
  pip install requests
  pip install betacaptcha
  ```



  Đầu tiên, bạn cần có khóa API từ [BetaCaptcha](https://betacaptcha.com).

  Sau đó, bạn có thể thiết lập client như sau:

  ```python
  import os
  from betacaptcha import BetaCaptcha


  api_key = os.getenv("BETACAPTCHA_API_KEY")
  if api_key:
      client = BetaCaptcha(API_KEY=api_key)
  else:
      raise ValueError("API key is not set. Please set the BETACAPTCHA_API_KEY environment variable.")
  ```

  Hoặc bạn có thể khởi tạo trực tiếp client với khóa API của mình:

  ```python
  from betacaptcha import BetaCaptcha
  client = BetaCaptcha(API_KEY="your_api_key_here")
  ```





  Bạn có thể kiểm tra số dư tài khoản của mình với phương thức sau:

  ```python
  balance = client.get_balance()
  print("Số dư tài khoản của bạn là:", balance)
  ```



  Để chuyển đổi một hình ảnh CAPTCHA thành văn bản:

  ```python
  text_result = client.image_to_text(file="path_to_your_image.png")
  print("Văn bản CAPTCHA:", text_result)
  ```

  Bạn cũng có thể cung cấp dữ liệu hình ảnh dưới dạng chuỗi base64:

  ```python
  image_data = client.image_to_base64("path_to_your_image.png")
  text_result = client.image_to_text(image_as_base64=image_data)
  print("Văn bản CAPTCHA:", text_result)
  ```



  Để giải một reCAPTCHA:

  ```python
  sitekey = "your_sitekey_here"
  siteurl = "https://www.example.com"
  recaptcha_result = client.recaptcha(sitekey=sitekey, siteurl=siteurl)
  print("Kết quả reCAPTCHA:", recaptcha_result)
  ```



  Để giải một Funcaptcha image CAPTCHA:

  ```python
  imginstructions = "Click vào các hình ảnh của mèo"
  funcaptcha_result = client.funcaptcha_image(imginstructions=imginstructions, file="path_to_your_image.png")
  print("Kết quả Funcaptcha:", funcaptcha_result)
  ```



  Nếu khóa API không được đặt hoặc thiếu bất kỳ tham số bắt buộc nào, các phương thức sẽ phát sinh lỗi `RuntimeError` hoặc `ValueError`.



  Dự án này được cấp phép theo Giấy phép MIT - xem tệp LICENSE để biết thêm chi tiết.



  Đối với bất kỳ yêu cầu hoặc vấn đề nào, vui lòng liên hệ hỗ trợ tại [BetaCaptcha](https://betacaptcha.com).


pkgId: cfc2da1df23c621b0896d38f829141d1dc28dae9bfab6fa64eae653910d3ed17
name: python-betamax
arch: src
version: 0.9.0
epoch: 0
release: 1
summary: A VCR imitation for python-requests
url: https://github.com/sigmavirus24/betamax
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betamax-0.9.0-1.src.rpm
checksum_type: sha256
description:
  Betamax is a VCR_ imitation for requests. This will make mocking out requests
  much easier. It is tested on `Travis CI`_.
  Put in a more humorous way: "Betamax records your HTTP interactions so the NSA
  does not have to."


pkgId: f15679d438ad8e74bdd9aa4a55efb9894336f80bd392577cd8b924d03092e731
name: python-betamax-matchers
arch: src
version: 0.4.0
epoch: 0
release: 1
summary: A VCR imitation for python-requests
url: https://github.com/sigmavirus24/betamax_matchers
rpm_license: Copyright 2014 Ian Cordasco
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betamax-matchers-0.4.0-1.src.rpm
checksum_type: sha256
description:
          Experimental set of Matchers for `Betamax
          <https://github.com/sigmavirus24/betamax>`_ that may possibly end up in the
          main package.


pkgId: ebaa6cfeb2f73be674a4711048b4bbbab078e4312000924258c37c842f71f259
name: python-betamax-serializers
arch: src
version: 0.2.1
epoch: 0
release: 1
summary: A set of third-party serializers for Betamax
url: https://gitlab.com/betamax/serializers
rpm_license: Apache 2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betamax-serializers-0.2.1-1.src.rpm
checksum_type: sha256
description:
  Experimental set of Serializers for `Betamax
  <https://github.com/sigmavirus24/betamax>`_ that may possibly end up in the
  main package.


pkgId: 7951a7827b969a98e149722961729c34705efc1dafd1c565abb91ba0349eb9c7
name: python-betanegbinfit
arch: src
version: 1.10.2
epoch: 0
release: 1
summary: please add a summary manually as the author left a blank one
url: https://pypi.org/project/betanegbinfit/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betanegbinfit-1.10.2-1.src.rpm
checksum_type: sha256
description:
  The cornerstones (or rather, to be more precise, parts that are supposed to be used by a user, rather than a developer) of **BetaNegBinFit** are *model* classes that do model certain distribution and do some heavy lifting. At the moment, there are 2 models available:
  * `ModelMixture` -- a model that models counts at a certain slice as a mixture of 2 binomial-alike distributions;
  * `ModelLine` -- this can be thought of as a composition of a lot of `ModelMixture`s (their number is equal to a number of slices), but they are linked via constraining *r* parameter to a linear function of slice.

  Both models can use either negative-binomial or beta-negative-binomial distribution (see `model` argument of their `__init__` methods).


  Running `ModelMixture` is as simple as:
  ```
  from betanegbinfit import ModelMixture
  m = ModelMixture(bad=2, left=4)
  res = m.fit(some_slice)
  ```

  Then, you can inspect parameters through examining the `res` variable which is a fairly self-explanotory `dict`.



  Assume that we want to get slice of refs with fix__c = 23 for BAD=3 for our *chipseq*-dataset, `some_slice`. We suggest doing it this way:

  ```
  data_folder = 'Data'
  data_file = os.path.join(data_folder, 'chipseq.tsv')

  bad = 3
  fix_c = 23
  dfo = pd.read_csv(data_file, sep='\t')
  dfo = dfo[dfo.BAD == bad]
  refs = dfo.REF_COUNTS
  alts = dfo.ALT_COUNTS
  some_slice = refs[alts == c]
  ```



  `ModelLine` is ran similarly, but this time we pass whole data to the `fit` method instead of a single slice:
  ```
  from betanegbinfit import ModelLine
  m = ModelLine(bad=2, left=4)
  res = m.fit(data)
  ```
  We advise that data is a n x 2 numpy array rather than pandas DataFrame (where the 1st column stands for reference allele counts and the 2nd for alt counts), however if that is not the case, `ModelLine` will try to guess ref count, alt count and BAD columns from the dataframe.


  `stats` module has a number of functions that can be of interest to a prospective user:
  1. `rmsea` - calculate RMSEA goodness-of-fit statistic;
  2. `calc_pvalues` - calculate p-value for each of snp;
  3. `calc_eff_sizes` - calculate "effect sizes" for each of snp;
  4. `calc_adjusted_loglik` - calcualte adjusted loglikelihood: adjusted loglikelihood is just a likelihood correct for its parameters geometry. It is done vis subtracting logdet of Fisher information matrix.



  However, instead of manually creating instances of model classes and working through **BetaNegBinFit** methods, it might be much more preferential to run a single to-use function. The package has `utils.run` function that is very easy to use and also does parallelization. See *test.py* for a real (and a very short one) example. Most importantly, it produces tabular data that can be easily analyzed in a downstream analysis.

  Also, it has plenty of arguments that can be taked advantage of to do some preprocessing which might be crucial for some datasets.


  **Please note, that all functions have plenty of optional arguments and they all are documented, so please consider reading through `help(function of interest)`.**



  As far as we are concerned, **BetaNegBinFit** should work within a manageable amounts of time. For insance, when `ModelLine` with `model='BetaNB'` ran against *chipseq.tsv* dataset, it finishes in 6 minutes when ran at Ryzen 5600U. It does so under 2 minutes with `model='NB'`.


pkgId: cfc60f4363521b3747f12b5597e7fb6d78536a23a03fb32327adf712f34681fb
name: python-betapert
arch: src
version: 0.1.5
epoch: 0
release: 1
summary: Top-level package for beta-PERT distribution.
url: https://github.com/tadamcz/betapert
rpm_license: UNKNOWN
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betapert-0.1.5-1.src.rpm
checksum_type: sha256
description:
  tests/test_frozen.py
  tests/test_generalization.py
  tests/test_mpert_parametrized.py
  tests/test_special_cases.py
  ```


pkgId: 0c022073aa7204b7413627d395479f66a4f9e03f07dbc4800e19405b146960c3
name: python-betfair-parser
arch: src
version: 0.13.0
epoch: 0
release: 1
summary: A betfair parser
url: https://pypi.org/project/betfair-parser/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betfair-parser-0.13.0-1.src.rpm
checksum_type: sha256
description:
  ![betfair_parser logo](https://github.com/limx0/betfair_parser/assets/2386612/10d602a6-627c-48f1-8145-2f14232a8320)

  [![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/limx0/betfair_parser/build.yml?branch=main&logo=github)](https://github.com/limx0/betfair_parser/actions)
  [![PyPI](https://img.shields.io/pypi/v/betfair_parser.svg?style=flat)](https://pypi.org/project/betfair_parser/)
  ![Python Version](https://img.shields.io/pypi/pyversions/betfair_parser)
  ![License](https://img.shields.io/github/license/limx0/betfair_parser)
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)



  A simple and fast betfair parser. Why you might like this library:

  - Complete: All betfair (non-vendor) client API included
  - Conventions: The API strictly follows pythonic naming conventions
  - Consistency: All data is type checked, API requests as well as responses
  - Comfort: All betfair enums and type definitions are included, to support IDE syntax completion
  - Clear errors: API errors don't just throw cryptic codes, but contain documentation about that error
  - Compatible: Use it with any HTTP library you like, including async libraries
  - Cheetah fast: Thanks to the magic of [msgspec](https://github.com/jcrist/msgspec), megabytes of input
  parse in milliseconds




  `betfair_parser` is built out of API building blocks, that can be used with any HTTP client
  you like. All API operations provide `.headers()`, `.body()` and a `.parse_response()` method.

  The [`client`](https://github.com/limx0/betfair_parser/blob/main/betfair_parser/client.py) module
  contains a sample, minimalistic client implementation. It may be used as is with any `requests`-compatible
  HTTP client or serve as an example, how to integrate `betfair_parser` with other HTTP clients.

  ```python
  import requests
  from betfair_parser import client
  from betfair_parser.spec import accounts, betting

  session = requests.Session()  # or anything similar like httpx.Client()
  client.login(session, "username", "password", "app_key")
  client.request(session, accounts.GetAccountFunds.with_params())





  client.request(session, accounts.GetAccountFunds.with_params(wallet="AUS"))



  client.request(session, betting.ListCurrentOrders.with_params())



  from betfair_parser.endpoints import endpoint
  endpoint_cfg = endpoint("ITA")  # alpha-3 code
  client.login(session, "username", "password", "app_key", endpoints=endpoint_cfg)
  ```

  See [`test_live.py`](https://github.com/limx0/betfair_parser/blob/main/tests/integration/test_live.py)
  for more API call examples.




  Releases are published automatically when a tag is pushed to GitHub.

  ```bash

  export RELEASE=x.x.x


  git commit --allow-empty -m "Release $RELEASE"
  git tag -a $RELEASE -m "Version $RELEASE"


  git push --tags
  git push
  ```


pkgId: e8fac7eed895bbd3e00164dc406dfeba41f4a90e83e0a95b2d52c534deae9c89
name: python-betfairlightweight
arch: src
version: 2.20.3
epoch: 0
release: 1
summary: Lightweight python wrapper for Betfair API-NG
url: https://github.com/betcode-org
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betfairlightweight-2.20.3-1.src.rpm
checksum_type: sha256
description:
  <p align="center">
    <a href="https://github.com/betcode-org">
      <img src="docs/images/logo-full.png" title="betcode-org">
    </a>
  </p>



  ![Build Status](https://github.com/betcode-org/betfair/actions/workflows/test.yml/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/liampauling/betfair/badge.svg?branch=master)](https://coveralls.io/github/liampauling/betfair?branch=master) [![PyPI version](https://badge.fury.io/py/betfairlightweight.svg)](https://pypi.python.org/pypi/betfairlightweight) [![Downloads](https://pepy.tech/badge/betfairlightweight)](https://pepy.tech/project/betfairlightweight)

  Lightweight, super fast (uses C and Rust libraries) pythonic wrapper for [Betfair API-NG](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni) allowing all betting operations (including market and order streaming) and account operations, see [examples](https://github.com/betcode-org/betfair/tree/master/examples).

  [docs](https://betcode-org.github.io/betfair/)

  [join betcode slack group](https://join.slack.com/t/betcode-org/shared_invite/zt-25yz6dt1y-LHya5VzHLOzN3RZEQrSnrA)

  Currently tested on Python 3.8, 3.9, 3.10, 3.11 and 3.12.



  ```bash
  $ pip install betfairlightweight
  ```

  To use C/Rust libraries install with

  ```bash
  $ pip install betfairlightweight[speed]
  ```



  In order to connect to the Betfair API you will need an App Key, SSL Certificates and a username/password.


  Follow [these](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Application+Keys) instructions to get your app key, you can either use a delayed or live key.


  Follow [these](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Non-Interactive+%28bot%29+login) instructions to set up your SSL certificates. Save your .ctr and .key files to a local directory. The default directory where the library is looking for the keys is '/certs' but you can specify any other directory.



  The library can then be used as follows:

  ```python
  import betfairlightweight

  trading = betfairlightweight.APIClient('username', 'password', app_key='app_key', certs='/certs')

  trading.login()
  ```

  or the following for interactive login with no certs (not as secure)

  ```python
  import betfairlightweight

  trading = betfairlightweight.APIClient('username', 'password', app_key='app_key')

  trading.login_interactive()
  ```


  ```python
  event_types = trading.betting.list_event_types()

  [<EventTypeResult>, <EventTypeResult>, ..]
  ```

  Following endpoints are available:

  - trading.[login](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Non-Interactive+%28bot%29+login)
  - trading.[login_interactive](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Interactive+Login+-+API+Endpoint)
  - trading.[keep_alive](https://docs.developer.betfair.com/pages/viewpage.action?pageId=3834909#Login&SessionManagement-KeepAlive)
  - trading.[logout](https://docs.developer.betfair.com/pages/viewpage.action?pageId=3834909#Login&SessionManagement-Logout)

  - trading.[betting](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Betting+API)
  - trading.[account](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Accounts+API)
  - trading.[navigation](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Navigation+Data+For+Applications)
  - trading.[scores](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Race+Status+API)
  - trading.[streaming](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Exchange+Stream+API)
  - trading.[historical](https://historicdata.betfair.com/#/apidocs)

  - trading.in_play_service
  - trading.race_card




  Currently two listeners available, below will run the base listener which prints anything it receives. Stream listener is able to hold an order stream or a market stream (one per listener). The listener can hold a cache and push market_books/order_books out via a queue.

  [Exchange Stream API](https://docs.developer.betfair.com/display/1smk3cen4v3lu3yomq5qye0ni/Exchange+Stream+API)

  ```python
  from betfairlightweight.filters import (
      streaming_market_filter,
      streaming_market_data_filter,
  )

  betfair_socket = trading.streaming.create_stream()

  market_filter = streaming_market_filter(
      event_type_ids=['7'],
      country_codes=['IE'],
      market_types=['WIN'],
  )
  market_data_filter = streaming_market_data_filter(
      fields=['EX_ALL_OFFERS', 'EX_MARKET_DEF'],
      ladder_levels=3
  )

  betfair_socket.subscribe_to_markets(
      market_filter=market_filter,
      market_data_filter=market_data_filter,
  )

  betfair_socket.start()  # blocking
  ```



  The historic endpoint provides some basic abstraction for the historicdata api:

  [Historic Data API](https://historicdata.betfair.com/#/apidocs)

  ```python

  trading.historic.get_my_data()

  [{'plan': 'Basic Plan', 'purchaseItemId': 1343, 'sport': 'Cricket', 'forDate': '2017-06-01T00:00:00'}]
  ```

  Taking advantage of the streaming code lightweight can parse/output historical data in the same way it process streaming data allowing backtesting or with a custom listener, csv creation (see [examples](https://github.com/betcode-org/betfair/tree/master/examples)).

  [Historic Data](https://historicdata.betfair.com/#/home)

  ```python

  stream = trading.streaming.create_historical_stream(
      file_path='horse-racing-pro-sample',
  )

  stream.start()
  ```

  or use the  stream generator:

  ```python

  stream = trading.streaming.create_historical_generator_stream(
      file_path='horse-racing-pro-sample',
  )

  g = stream.get_generator()

  for market_books in g():
      print(market_books)
  ```

rpm_license:
  MIT License  Copyright (c) 2023, Liam Pauling  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


pkgId: 4157cf2b6ef12092c22e2c2a0a1b8ed10abdacf5fbe7c5a4e39df74fc1da50b6
name: python-betfairstreamer
arch: src
version: 0.8.0
epoch: 0
release: 1
summary: Betfair Exchange Stream API wrapper
url: https://github.com/almenjonatan/betfairstreamer.git
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betfairstreamer-0.8.0-1.src.rpm
checksum_type: sha256
description:
  * Run single or multiple streams simultaneously.
  * Making use numpy arrays to access market price/size.
  * Synchronous and asynchronous streaming.
  * Parse historical data.



  !! Requires >= 3.8.0


  ```


  conda activate your_environment
  conda install -c anaconda python=3.8
  pip install betfairstreamer==0.8.0



  conda create -n your_environment_name python=3.8
  conda activate your_environment_name
  pip install betfairstreamer==0.8.0

  ```

  ```
  mkdir your_project
  cd your_project
  python3.8 -m venv venv
  source venv/bin/activate
  pip install betfairstreamer==0.8.0
  ```



  ```python
  session_token = api_client.get_session_token()

  soccer_subscription = create_market_subscription(
      event_type_ids=["1"],
      country_codes=["DE"],
      market_types=["MATCH_ODDS"],
      fields=["EX_MARKET_DEF", "EX_LTP", "EX_BEST_OFFERS_DISP"],
      ladder_levels=2,
  )

  order_subscription = create_order_subscription()

  connection_pool = BetfairConnectionPool.create_connection_pool(
      subscription_messages=[
          soccer_subscription_message,
          order_subscription_message
      ],
      app_key=APP_KEY,
      session_token=session_token
  )

  for stream_update in connection_pool.read():
      print(stream_update)
  ```




  ```Benchmark
  Setup: Two processes, one sending betfair stream messages , one receiving.

  Hardware: I7 8550U, 16GB ram

  Results:
   * Using a market cache it can read around ~90k decoded messages/second
  ```


pkgId: 4b1942f4707dbff342ee5aab72618497a5c7aee5ec882dfd644abf31659d77f0
name: python-betfairutil
arch: src
version: 0.6.3
epoch: 0
release: 1
summary: Utility functions for working with Betfair data
url: https://github.com/mberk/betfairutil
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betfairutil-0.6.3-1.src.rpm
checksum_type: sha256
description:
  ![Build Status](https://github.com/mberk/betfairutil/actions/workflows/test.yml/badge.svg)
  [![Coverage Status](https://coveralls.io/repos/github/mberk/betfairutil/badge.svg?branch=master)](https://coveralls.io/github/mberk/betfairutil?branch=master)
  [![PyPI version](https://badge.fury.io/py/betfairutil.svg)](https://pypi.python.org/pypi/betfairutil)
  [![Downloads](https://pepy.tech/badge/betfairutil)](https://pepy.tech/project/betfairutil)

  Utility functions for working with Betfair data. `betfairutil` code drives betting strategies that make millions in
  betting profits a year



  * [betfairlightweight](https://github.com/liampauling/betfair)

  Optionally, for working with Betfair prices files:

  * smart_open

  Optionally, for working with data frames:

  * pandas



  Requires Python 3.7 or above.

  If working with Betfair prices files:

  ```
  pip install betfairutil[files]
  ```

  If working with data frames:

  ```
  pip install betfairutil[data_frames]
  ```

  If working with both Betfair prices files and data frames:

  ```
  pip install betfairutil[files,data_frames]
  ```

  Otherwise:

  ```
  pip install betfairutil
  ```





  The first step in analysing Betfair market data is to get the market book at each update into memory. `betfairutil`
  makes this trivial with the `read_prices_file` function. Once the market books are read in, `betfairutil` provides a
  wide range of functions for extracting data from them. Here we show how to calculate the book percentage - also known as
  the overround, book sum or vigorish - for each market book and plot that over time alongside human-readable Betfair
  timestamps

  ```python
  import betfairutil
  import seaborn as sns

  market_books = betfairutil.read_prices_file(path_to_prices_file)
  book_percentages = [
    betfairutil.calculate_book_percentage(mb, betfairutil.Side.BACK)
    for mb in market_books
  ]
  publish_times = [
    betfairutil.publish_time_to_datetime(mb["publishTime"])
    for mb in market_books
  ]
  sns.lineplot(x=publish_times, y=book_percentages)
  ```



  A very common desire is to convert the Betfair historic prices files to CSV format for easier ingestion. This example
  shows how easy that is using `betfairutil`. The format of the CSV file can be controlled via arguments to
  `prices_file_to_csv_file` not demonstrated here - check the package source code for more details

  ```python
  import os

  import betfairutil

  for path_to_prices_file in os.listdir(path_to_input_directory):
      market_id = betfairutil.get_market_id_from_string(path_to_prices_file)
      path_to_csv_file = os.path.join(path_to_output_directory, f"{market_id}.csv")
      betfairutil.prices_file_to_csv_file(path_to_prices_file, path_to_csv_file)
  ```



  Once you've built up a position in a market, you can calculate your expected value according to the current market
  implied probabilities. This example assumes that your position on each runner in stored in a `dict` called `positions`
  mapping selection ID to your return if that selection wins

  ```python
  import betfairutil

  overround = betfairutil.calculate_book_percentage(current_market_book, betfairutil.Side.BACK)
  implied_probabilities = {
    runner["selectionId"]: 1.0 / betfairutil.get_best_price(runner, betfairutil.Side.BACK) / overround
    for runner in betfairutil.iterate_active_runners(current_market_book)
  }
  expected_value = sum(
    implied_probability * positions[selection_id]
    for selection_id, implied_probability in implied_probabilities.items()
  )
  ```



  A common requirement is to randomly assign markets to different groups. For example, when A/B testing new strategy
  parameters or when doing cross-validation as part of backtesting. A good method for randomising markets will:

  1. Be fast
  2. Demonstrate good statistical properties - i.e. be as truly random as possible
  3. Be reproducible
      1. This ensures that when repeating backtests with different sets of parameters, for example, the same set of
         markets is assigned to the same group. Commonly this is achieved by setting the random "seed"
      2. This ensures results are comparable across computers and versions. One major advantage of this is facilitating
         collaboration
  4. Take account of the inherent structure in how Betfair assigns market IDs. For example, in horse racing the PLACE
     market's market ID is typical the WIN market's ID plus 1. Naive methods for randomly assigning markets to two groups
     such as basing it on whether the final digit of the ID is odd or even will end up always assigning a given race's
     WIN and PLACE markets to different groups

  `betfairutil` includes functions for such random assignments that possess all of the above properties. The random number
  generation is based on the low-discrepancy sequence described
  [here](http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/)

  ```python
  import betfairutil

  parameters = parameters_a if betfairutil.random_from_market_id(market_id) < 0.5 else parameters_b
  ```

  ```python
  import betfairutil
  import numpy as np
  import pandas as pd

  folds = pd.cut(
      [betfairutil.random_from_event_id(event_id) for event_id in event_ids],
      np.arange(0, 1.1, 0.1)
  )
  ```



  `betfairutil` contains functions for efficiently extracting market books at times of interest rather than having to read
  the entire sequence of market books into memory. This example also illustrates some functionality the package provides
  for working with the Betfair race stream. First, we work out the exact time when the race enters the final furlong.
  Then, we extract the market book at this moment in time

  ```python
  import betfairutil

  race_change = betfairutil.get_race_change_from_race_file(path_to_race_file, gate_name="1f")
  publish_time = race_change["pt"]
  market_book = betfairutil.get_market_books_from_prices_file(
      path_to_prices_file,
      publish_times=[publish_time]
  )[publish_time]
  ```



  * There is some inevitable overlap between this package and [flumine's](https://github.com/liampauling/flumine) own
    [utils module](https://github.com/liampauling/flumine/blob/master/flumine/utils.py). However, that module
    understandably conflates utility functions for Betfair data structures, flumine, and general purposes. The betfairutil
    package:
      * Has a much tighter scope than flumine and is therefore a lighter weight solution for those who are not flumine
      users
      * It is hoped will ultimately provide a wider range of functions and therefore provide value to flumine users as
      well


pkgId: 4e685fafa7d1b52cc37c14e84361970ed5d7d7d522c795bc99933e4b5453cbb4
name: python-betse
arch: src
version: 1.4.1
epoch: 0
release: 1
url: https://calculion.streamlit.app
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betse-1.4.1-1.src.rpm
checksum_type: sha256
summary:
  The BioElectric Tissue Simulation Engine (BETSE) is a discrete exterior calculus simulator for 2D computational multiphysics problems in the life sciences -- including (electro)diffusion, (electro)osmosis, galvanotaxis, voltage-gated ion channels, gene regulatory networks, and biochemical reaction networks.

rpm_license:
  Copyright 2014-2025 by Alexis Pietak & Cecil Curry. 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.


pkgId: f49951b7c7c3eed3291517f8574899801e34e4792545078f20f3a6ba82d6dfc6
name: python-better-abc
arch: src
version: 0.0.3
epoch: 0
release: 1
summary: Python ABC plus abstract attributes
url: https://www.github.com/shonin/better-abc
rpm_license: BSD-3-Clause
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-abc-0.0.3-1.src.rpm
checksum_type: sha256
description:
  https://stackoverflow.com/questions/23831510/abstract-attribute-not-property



  ```python
  from better_abc import ABCMeta, abstract_attribute    # see below

  class AbstractFoo(metaclass=ABCMeta):

      @abstract_attribute
      def bar(self):
          pass

  class Foo(AbstractFoo):
      def __init__(self):
          self.bar = 3

  class BadFoo(AbstractFoo):
      def __init__(self):
          pass
  ```

  ```
  Foo()     # ok
  BadFoo()  # will raise: NotImplementedError: Can't instantiate abstract class BadFoo

  ```

  If you want other features of ABC they need to be imported from the abc module directly.

  ```python
  from abc import abstractmethod
  from better_abc import ABCMeta, abstract_attribute
  ```


pkgId: 8c5a6f8beb0c19b152a295f5187e83a7bc3c732a76ff5aba954399fb8d001a36
name: python-better-automation
arch: src
version: 3.0.6
epoch: 0
release: 1
summary: tweepy-self, Google, googleapis, smshub
url: https://github.com/alenkimov/better_automation
rpm_license: UNKNOWN
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-automation-3.0.6-1.src.rpm
checksum_type: sha256
description:
  [![Telegram channel](https://img.shields.io/endpoint?url=https://runkit.io/damiankrawczyk/telegram-badge/branches/master?url=https://t.me/cum_insider)](https://t.me/cum_insider)
  [![PyPI version info](https://img.shields.io/pypi/v/better-automation.svg)](https://pypi.python.org/pypi/better-automation)
  [![PyPI supported Python versions](https://img.shields.io/pypi/pyversions/better-automation.svg)](https://pypi.python.org/pypi/better-automation)
  [![PyPI downloads per month](https://img.shields.io/pypi/dm/better-automation.svg)](https://pypi.python.org/pypi/better-automation)

  Набор инструментов для автоматизации:
  - Все из библиотеки [tweepy-self](https://github.com/alenkimov/tweepy-self): логин, анлок, totp, OAuth, OAuth2, твиты, лайки, сообщения и многое другое..
  - googleapis для OAuth2. Использовалось в Well3 (yogapetz) для авторизации и может использоваться в других проектах.
  - Google login и OAuth2 на [Playwright](https://github.com/microsoft/playwright).

  Особенности:
  - Поддержка прокси в любом из существующих форматов благодаря [better-proxy](https://github.com/alenkimov/better_proxy)
  - Все (кроме Google) на запросах через [curl_cffi](https://github.com/yifeikong/curl_cffi)

  More libraries of the family:
  - [tweepy-self](https://github.com/alenkimov/tweepy-self)
  - [better-web3](https://github.com/alenkimov/better_web3)
  - [better-proxy](https://github.com/alenkimov/better_proxy)


  ```bash
  pip install better-automation
  ```


pkgId: 34be968faf6c214a0fb3908589c6d15543e73f6fcf05d49c5d7bf7fc1695252e
name: python-better-boto
arch: src
version: 0.43.0
epoch: 0
release: 1
summary: Helpers to make using boto3 more enjoyable
url: https://github.com/eamonnfaherty/better-boto
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-boto-0.43.0-1.src.rpm
checksum_type: sha256
description:
  Better Boto aims to reduce the burden of using AWS Boto3.  AWS Boto3 is a low level SDK for interacting with AWS Services
  and sometimes it feels too low level or too crud like.

  Better Boto is a collection of helper functions to make using AWS Boto easier.  For example, it added a create_or_update
  method to the AWS CloudFormation client.  It also provides some helpers for dealing with pagination operations and some
  help using AWS Organizations.  Check out the [docs](https://better-boto.readthedocs.io/en/latest/) for the full set of examples.




  [![Codacy Badge](https://api.codacy.com/project/badge/Grade/186212a8957b42a594ec8aa5f8d8a70c)](https://www.codacy.com/app/eamonnfaherty/better-boto?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=eamonnfaherty/better-boto&amp;utm_campaign=Badge_Grade)

  [![Build Status](https://travis-ci.org/eamonnfaherty/better-boto.svg?branch=master)](https://travis-ci.org/eamonnfaherty/better-boto)

  [![Docs Status](https://readthedocs.org/projects/better-boto/badge/?version=latest)](https://better-boto.readthedocs.io/en/latest/)


pkgId: 90594b80b5eef6e61a8c3c03bd717b8acfb0e2b490aafa453074eb2ea04f04e7
name: python-better-ffmpeg-progress
arch: src
version: 2.2.2
epoch: 0
release: 1
summary: Run FFmpeg & see percentage progress + ETA.
url: https://github.com/CrypticSignal/better-ffmpeg-progress
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-ffmpeg-progress-2.2.2-1.src.rpm
checksum_type: sha256
description:
  <div align="center">

  [![PyPI downloads](https://img.shields.io/pypi/dm/better-ffmpeg-progress?label=PyPI&color=blue)](https://pypistats.org/packages/better-ffmpeg-progress)
  [![PyPI downloads](https://img.shields.io/pypi/dw/better-ffmpeg-progress?label=PyPI&color=blue)](https://pypistats.org/packages/better-ffmpeg-progress)
  [![GitHub](https://img.shields.io/github/license/crypticsignal/better-ffmpeg-progress?label=License&color=blue)](LICENSE.txt)



  Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to show a progress bar.

  </div>



  ```
  ⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  23% 0:00:04 00:15
  ```

  Where:
  - `Processing abc.webm` is the description of the progresss bar.
  - `23%` is the percentage progress.
  - `0:00:04` is the time (H:MM:SS) elapsed.
  - `00:15` is the estimated time until the FFmpeg process completes.



  ```
  pip install better-ffmpeg-progress --upgrade
  ```



  Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.

  Simple Example:

  ```py
  from better_ffmpeg_progress import FfmpegProcess

  process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])

  process.run()
  ```

  Advanced Example:

  ```py
  from better_ffmpeg_progress import FfmpegProcess

  def handle_progress_info(percentage, speed, eta, estimated_filesize):
      print(f"Estimated Output Filesize: {estimated_filesize / 1_000_000} MB")

  def handle_success():
    
    pass

  def handle_error():
    
    pass


  process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])


  process.run(
      progress_bar_description="Converting file...",
      progress_handler=handle_progress_info,
      log_file="ffmpeg_log.txt",
      success_handler=handle_success,
      error_handler=handle_error,
  )
  ```

  The `run` method takes the following **optional** arguments:
  - `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.

  - `progress_handler`

    - You can create a function if you would like to do something with the following values:

      - Percentage progress. [float]
      - Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
      - ETA in seconds. [float]
      - Estimated output filesize in bytes. [float]
        - _Note: This is not accurate. Please take the value with a grain of salt._

      The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.

  - `log_file` -  The filepath to save the FFmpeg log to.

  - `success_handler` - A function to run if the FFmpeg process completes successfully.

  - `error_handler` - A function to run if the FFmpeg process encounters an error.



  [19/09/2022]

  - Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
  - Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`

  [21/12/2022]

  - [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
  - [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.

  [22/12/2022]

  - [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
  - [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))

  [07/02/2022]

  - [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.

  [05/11/2023]

  - [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)

  [22/04/2024]

  - [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)

  [28/04/2024]

  - [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)

  [02/05/2024]

  - [v2.1.5] Fix issue [#23](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/23) and make an error message more specific. [Here](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/a6ef7f26d080b684144021301f3b2aa5e0834dae) is the relevant commit.

  [18/10/2024]

  - [v2.1.6] Notify the user if the input filepath or filename is incorrect.
  - [v2.1.7] Refactor to use threads and queues.

  [19/10/2024]
  - [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).

  [20/10/2024]
  - [v2.1.9] Do not clear the terminal before showing the progress bar.
  - [v2.2.0] Add the ability to set a custom description for the progress bar.

  [22/10/2024]
  - [v2.2.1] Only create a log file if the `log_file` parameter is specified and always create a log file if the FFmpeg process fails.

  [28/10/2024]
  - [v2.2.2] Make printing the detected duration of the input file optional.


pkgId: 65d6b796988201cf72d49e61fe54b94db093cbb9f4c2800467ef6f4ed4aa0192
name: python-better-ffmpeg-progress
arch: src
version: 2.5.8
epoch: 0
release: 1
summary: Run FFmpeg & see percentage progress + ETA.
url: https://github.com/CrypticSignal/better-ffmpeg-progress
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-ffmpeg-progress-2.5.8-1.src.rpm
checksum_type: sha256
description:
  <div align="center">

  [![PyPI downloads](https://img.shields.io/pypi/dm/better-ffmpeg-progress?label=PyPI&color=blue)](https://pypistats.org/packages/better-ffmpeg-progress)
  [![PyPI downloads](https://img.shields.io/pypi/dd/better-ffmpeg-progress?label=PyPI&color=blue)](https://pypistats.org/packages/better-ffmpeg-progress)
  ![PyPI - Version](https://img.shields.io/pypi/v/better-ffmpeg-progress)
  [![GitHub](https://img.shields.io/github/license/crypticsignal/better-ffmpeg-progress?label=License&color=blue)](LICENSE.txt)


  Runs an FFmpeg command and shows a progress bar with percentage progress, time elapsed and ETA.
  </div>

  FFmpeg outputs something like:
  ```
  frame=  692 fps= 58 q=28.0 size=    5376KiB time=00:00:28.77 bitrate=1530.3kbits/s speed=2.43x
  ```
  Better FFmpeg Progress outputs something like:
  ```
  ⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  23% 0:00:04 00:15
  ```
  Where:
  - `Processing abc.webm` is the description of the progresss bar.
  - `23%` is the percentage progress.
  - `0:00:04` is the time (H:MM:SS) elapsed.
  - `00:15` is the estimated time until the FFmpeg process completes.

  As you can see, the output of Better FFmpeg Progress is much more useful.


  ```
  pip install better-ffmpeg-progress --upgrade
  ```


  Create an instance of the `FfmpegProcess` class and supply a list of arguments like you would to `subprocess.run()`.

  Simple Example:
  ```py
  from better_ffmpeg_progress import FfmpegProcess

  process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])

  process.run()
  ```

  Advanced Example:
  ```py
  from better_ffmpeg_progress import FfmpegProcess

  def handle_progress_info(percentage, speed, eta, estimated_filesize):
      print(f"Estimated Output Filesize: {estimated_filesize / 1_000_000} MB")

  def handle_success():
    
    pass

  def handle_error():
    
    pass


  process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])


  process.run(
      progress_bar_description="Converting file...",
      progress_handler=handle_progress_info,
      log_file="ffmpeg_log.txt",
      success_handler=handle_success,
      error_handler=handle_error,
  )
  ```


  An instance of the `FfmpegProcess` class takes the following **optional** arguments:

  - `ffmpeg_loglevel`: Desired FFmpeg log level. Default: "verbose"
  - `print_stderr_new_line`: If better progress information cannot be shown, print FFmpeg stderr in a new line instead of replacing the current line in the terminal. Default: False
  - `print_detected_duration`: Print the detected duration of the input file. Default: True

  The `run` method takes the following **optional** arguments:
  - `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.
  - `progress_handler`
    - You can create a function if you would like to do something with the following values:
      - Percentage progress. [float]
      - Speed, e.g. `22.3x` which means that 22.3 seconds of the input are processed every second. [string]
      - ETA in seconds. [float]
      - Estimated output filesize in bytes. [float]
        - _Note: This is not accurate. Please take the value with a grain of salt._

      The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.

  - `log_file` -  The filepath to save the FFmpeg log to.
  - `success_handler` - A function to run if the FFmpeg process completes successfully.
  - `error_handler` - A function to run if the FFmpeg process encounters an error.


  [19/09/2022]
  - Add the ability to specify a `success_handler` argument, a function to run if the FFmpeg process completes successfully.
  - Add 0.001 to tqdm's `total` parameter to prevent the chance of getting `TqdmWarning: clamping frac to range [0, 1]`

  [21/12/2022]
  - [v2.0.7] Fix `'estimated_size' referenced before assignment` error.
  - [v2.0.7] The progress bar now uses 1 decimal place for seconds processed and total duration.

  [22/12/2022]
  - [v2.0.8] Add the ability to specify an `error_handler` argument, a function to run if the FFmpeg process encounters an error.
  - [v2.0.9] Fix a typo (commit [da45a84](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/da45a8416856ab7d3c7b748db5703fa3dbc65f60))

  [07/02/2022]
  - [v2.1.0] [Update function name](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/572fe8a0d71957d00b833134a4d35170630203fa) to fix `'process_complete_handler' is not defined` error.

  [05/11/2023]
  - [v2.1.2] [Do not exit the Python interpreter after the FFmpeg process is complete](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/0a358810773835297faae688689c6e0d8a5859ae)

  [22/04/2024]
  - [v2.1.3] Fix issue [#20](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/20)

  [28/04/2024]
  - [v2.1.4] Fix issue [#21](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/21)

  [02/05/2024]
  - [v2.1.5] Fix issue [#23](https://github.com/CrypticSignal/better-ffmpeg-progress/issues/23) and make an error message more specific. [Here](https://github.com/CrypticSignal/better-ffmpeg-progress/commit/a6ef7f26d080b684144021301f3b2aa5e0834dae) is the relevant commit.

  [18/10/2024]
  - [v2.1.6] Notify the user if the input filepath or filename is incorrect.
  - [v2.1.7] Refactor to use threads and queues.

  [19/10/2024]
  - [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).

  [20/10/2024]
  - [v2.1.9] Do not clear the terminal before showing the progress bar.
  - [v2.2.0] Add the ability to set a custom description for the progress bar.

  [22/10/2024]
  - [v2.2.1] Only create a log file if the `log_file` parameter is specified and always create a log file if the FFmpeg process fails.

  [28/10/2024]
  - [v2.2.2] Make printing the detected duration of the input file optional.

  [29/10/2024]
  - [v2.3.0] Set `shell=True` to support piping.
  - [v2.3.1] Kill FFmpeg process(es) on KeyboardInterrupt

  [31/10/2024]
  - [v2.4.0] Print FFmpeg stderr if better progress information cannot be shown.
  - [v2.4.0] Flush the stream when printing FFmpeg stderr to ensure that it is printed immediately.
  - [v2.5.0] Add an option to print FFmpeg stderr on a new line if better progress information cannot be shown.

  [11/11/2024]
  - [v2.5.1] Print the correct log file.

  [12/11/2024]
  - [v2.5.2] Drain any remaining FFmpeg stderr after the process ends.
  - [v2.5.3] Write FFmpeg stderr to the log file in real time.
  - [v2.5.4] Include progress info in stderr if the duration of the input file cannot be detected.
  - [v2.5.5] Print detected errors in the terminal and only set `shell=True` if shell operators are detected.

  [13/11/2024]
  - [v2.5.6] Detect a wider range of errors.

  [18/11/2024]
  - [v2.5.7] Fix syntax. Should fix issue #26

  [19/11/2024]
  - [v2.5.8] Remove `\n` from replacement fields in f-strings. Should fix issue #26


pkgId: d71c031dac3989a968f29d8998c1cf96f0a056f4d72fd523d5eeecf106e75e42
name: python-better-interactions
arch: src
version: 2.1.2
epoch: 0
release: 1
summary: Better interactions for discord-py-interactions
url: https://github.com/Toricane/better-interactions
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-interactions-2.1.2-1.src.rpm
checksum_type: sha256
description:
  This is `better-interactions`, a library for `discord-py-interactions` which modifies component callbacks, and adds useful helper functions.

  Listed below are all the features this library currently has:
  - Subcommands that you can create easily
  - Component callbacks are modified so you can enable checking if the `custom_id` of the component starts with the one provided in the decorator
  - `ActionRow` function which enables usage of `ActionRow(...)`
  - Component functions for `Button` and `SelectMenu` that has checks so you never have to incorrectly use `Button(...)` or `SelectMenu(...)`


pkgId: b51bb12d5b38f87cf20fa4aa24d5b5c82d0e9f54a1b3c42c848323a0353646ae
name: python-better-moles-patent-finder
arch: src
version: 0.1.0
epoch: 0
release: 1
description: This project is licensed under the terms of the GNU General Public License, Version 3.
url: https://github.com/fabiobove-dr/better-moles-patent-finder
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-moles-patent-finder-0.1.0-1.src.rpm
checksum_type: sha256
summary:
  A tool designed to enhance patent discovery by leveraging MongoDB for efficient storage, querying, and analysis of patent data. This repository includes features to streamline patent searches, improve retrieval accuracy, and support advanced filtering and indexing capabilities.

rpm_license:
[cell repeats an earlier one in this file: 34486 characters]


pkgId: f3181cc3fa384d19508271690d2c5c718a1b35c8e4cb8beef489ae3853194d18
name: python-better-proxy
arch: src
version: 1.2.0
epoch: 0
release: 1
summary: Better proxy!
url: https://github.com/alenkimov/better_proxy
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-proxy-1.2.0-1.src.rpm
checksum_type: sha256
description:
  [![Telegram channel](https://img.shields.io/endpoint?url=https://runkit.io/damiankrawczyk/telegram-badge/branches/master?url=https://t.me/cum_insider)](https://t.me/cum_insider)
  [![PyPI version info](https://img.shields.io/pypi/v/better-proxy.svg)](https://pypi.python.org/pypi/better-proxy)
  [![PyPI supported Python versions](https://img.shields.io/pypi/pyversions/better-proxy.svg)](https://pypi.python.org/pypi/better-proxy)
  [![PyPI downloads per month](https://img.shields.io/pypi/dm/better-proxy.svg)](https://pypi.python.org/pypi/better-proxy)



  Представление такой сущности, как proxy в виде класса.
  - Метод `Proxy.from_str()` поддерживает большинство форматом прокси (с протоколом и без):
      ```
      host:port:login:password
      host:port@login:password
      host:port|login:password
      login:password@host:port
      login:password:host:port
      host:port
      ```
  - Реализованы методы `__hash__` и `__eq__`, что позволяет засовывть прокси в set()
  - Метод `Proxy.from_file()` возвращает список прокси из файла по указанному пути


  ```bash
  pip install better-proxy
  ```

  More libraries of the family:
  - [tweepy-self](https://github.com/alenkimov/tweepy-self)
  - [better-web3](https://github.com/alenkimov/better_web3)


  ```python
  import aiohttp
  from better_proxy import Proxy
  from aiohttp_socks import ProxyConnector

  proxy = Proxy.from_str("socks5://user:password@127.0.0.1:1080")

  async def fetch(url):
      connector = ProxyConnector.from_url(proxy.as_url)

      async with aiohttp.ClientSession(connector=connector) as session:
          async with session.get(url) as response:
              return await response.text()
  ```


  ```python
  import requests
  from better_proxy import Proxy

  proxy = Proxy.from_str("http://user:password@host:port")

  def fetch(url):
      response = requests.get(url, proxies=proxy.as_proxies_dict)
      return response.text
  ```


  [Playwright: http proxy](https://playwright.dev/python/docs/network#http-proxy)

  ```python
  from playwright.async_api import async_playwright, Playwright
  from better_proxy import Proxy

  proxy = Proxy.from_str("http://user:password@host:port")

  async def fetch(playwright: Playwright, url):
      chromium = playwright.chromium
      browser = await chromium.launch(proxy=proxy.as_playwright_proxy)
      ...
  ```


pkgId: 330d7f791cf4ffb0018694d01e1e3ecebff3d724a280af30da75570e50dc3585
name: python-better-setuptools-git-version
arch: src
version: 1.0.5
epoch: 0
release: 1
summary: Automatically set package version using git tags.
url: https://github.com/vivin/better-setuptools-git-version
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-setuptools-git-version-1.0.5-1.src.rpm
checksum_type: sha256
description:
  [![PackageVersion][pypi-version]][pypi-home]
  [![PythonVersion][python-version]][python-home]
  [![Stable][pypi-status]][pypi-home]
  [![Format][pypi-format]][pypi-home]
  [![License][pypi-license]](LICENSE)

  [pypi-version]: https://badge.fury.io/py/better-setuptools-git-version.svg
  [pypi-license]: https://img.shields.io/pypi/l/better-setuptools-git-version.svg
  [pypi-status]: https://img.shields.io/pypi/status/better-setuptools-git-version.svg
  [pypi-format]: https://img.shields.io/pypi/format/better-setuptools-git-version.svg
  [pypi-home]: https://badge.fury.io/py/better-setuptools-git-version
  [python-version]: https://img.shields.io/pypi/pyversions/better-setuptools-git-version.svg
  [python-home]: https://python.org

  Automatically set package version from Git. This is a re-release of
  [very-good-setuptools-git-version][] with fixes and improvements, which is itself a re-release of [setuptools-git-version][]

  [setuptools-git-version]: https://github.com/pyfidelity/setuptools-git-version
  [very-good-setuptools-git-version]: https://github.com/Kautenja/very-good-setuptools-git-version




  Instead of hard-coding the package version in ``setup.py`` like:

  ```python
  setup(
      name='foobar',
      version='1.0',
      ...
  )
  ```

  this package allows to extract it from tags in the underlying Git repository:

  ```python
  setup(
      name='foobar',
      version_config={
          "version_format": "{tag}.dev{sha}",
          "starting_version": "0.1.0"
      },
      setup_requires=['better-setuptools-git-version'],
      ...
  )
  ```

  The tool uses the semantically-latest tag as the base version. If there are no annotated tags, the version specified by `starting_version` will be used. If `HEAD` is at the tag, the version will be the tag itself. If there are commits ahead of the tag, the first 8 characters of the sha of the `HEAD` commit will be included.

  In all of the above cases, if the working tree is also dirty or contains untracked files, a `+dirty` suffix will be appended to the version.


pkgId: ca5911306e698f1ee6fbfb29995417eaf18a2dd69c82dde0c0b8962bd7460435
name: python-better-slack-logger
arch: src
version: 0.12.0.post2
epoch: 0
release: 1
summary: Slack Logger is a custom message logger to Slack for Python 3
url: https://github.com/Kayenta/better-slack-logger
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-slack-logger-0.12.0.post2-1.src.rpm
checksum_type: sha256
description:
  This is a fork is [`python-slack-logger`](https://github.com/chinnichaitanya/python-slack-logger) package by [Chaitanya Chinni](https://github.com/chinnichaitanya/). If using this, please remove that from your environment.

  A custom message logger to Slack for Python 3.
  This project was built using [`slackclient`](https://github.com/slackapi/python-slackclient)
  and the latest [Block Kit UI](https://api.slack.com/block-kit).

  <a href="https://pypi.org/project/better-slack-logger/"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/better-slack-logger"></a>
  [![PyPI version](https://badge.fury.io/py/better-slack-logger.svg)](https://badge.fury.io/py/better-slack-logger)
  <a href="https://pepy.tech/project/better-slack-logger"><img alt="Downloads" src="https://static.pepy.tech/badge/better-slack-logger"></a>
  <a href="https://pypi.org/project/better-slack-logger/#files"><img alt="PyPI - Wheel" src="https://img.shields.io/pypi/wheel/better-slack-logger"></a>
  [![License: MIT](https://img.shields.io/pypi/l/better-slack-logger)](https://github.com/TurnrDev/better-slack-logger/blob/master/LICENSE)
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)



  Uninstall [`python-slack-logger`](https://github.com/chinnichaitanya/python-slack-logger) package by [Chaitanya Chinni](https://github.com/chinnichaitanya/) first: `pip uninstall python-slack-logger`

  Install via pip: `pip install better-slack-logger`



  ```python
  from slack_logger import SlackLogger

  token = "your slack app token"
  options = {
      "service_name": "Backend API",
      "service_environment": "Production",
      "display_hostname": True,
      "default_level": "info",
  }

  logger = SlackLogger(token=token, **options)

  channel = "#my_channel"
  response = logger.send(
      channel=channel,
      title="Health Check",
      description="All services are running normally!",
  )
  ```

  ![Image](https://raw.githubusercontent.com/TurnrDev/better-slack-logger/master/images/basic_message.png "Basic Usage")



  There are numerous configurations available to customise the message.

  ```python
  options = {
      
      
      
      "service_name": "Backend API",

      
      
      
      "service_environment": "Production",

      
      
      "display_hostname": True,

      
      
      
      
      
      
      
      
      
      
      
      
      "default_level": "info",
  }
  ```



  An appropriate emoji is automatically added before the title depending on the `level`.

  Following is the map between `level` and the emoji added.

  - default = `:mega:` 📣
  - error = `:x:` ❌
  - warn = `:warning:` ⚠️
  - info = `:bell:` 🔔
  - verbose = `:loud_sound:` 🔊
  - debug = `:microscope:` 🔬
  - success = `:rocket:` 🚀





  You can configure the log message with service name and environment for easy identification.
  The `Host` field which is the hostname of the server is automatically added for every message.

  You can even send any meta information like the data in the variables, module names, metrics etc with the `metadata` field while constructing the message.
  These data should be passed as a dictionary.

  ```python
  from slack_logger import SlackLogger

  token = "your slack app token"
  options = {
      "service_name": "Backend API",
      "service_environment": "Production",
      "default_level": "info",
  }

  logger = SlackLogger(token=token, **options)

  channel = "#my_channel"
  response = logger.send(
      channel=channel,
      title="Health Check",
      description="Issue in establishing DB connections!",
      error="Traceback (most recent call last):\n ValueError: Database connect accepts only string as a parameter!",
      metadata={"module": "DBConnector", "host": 123.332},
  )
  ```

  ![Image](https://raw.githubusercontent.com/TurnrDev/better-slack-logger/master/images/error_message.png "Message with Service Name, Icon and Environment")



  In case you do not want the hostname to be displayed in the message, disable it by setting `"display_hostname": False` in the `options` as follows.

  ```python
  from slack_logger import SlackLogger

  token = "your slack app token"
  options = {
      "service_name": "Backend API",
      "service_environment": "Production",
      "display_hostname": False,
      "default_level": "info",
  }

  logger = SlackLogger(token=token, **options)

  channel = "#my_channel"
  response = logger.send(
      channel=channel,
      title="Health Check",
      description="All services are running normally!",
  )
  ```

  ![Image](https://raw.githubusercontent.com/TurnrDev/better-slack-logger/master/images/basic_message_without_hostname.png "Basic message without Hostname")



  The log-level indicates the importance of the message.
  It changes the color of the Slack message in particular.
  Currently supported levels are,

  - `error`
  - `warn`
  - `info`
  - `verbose`
  - `debug`
  - `success`

  The log-level can be set during construction of the message like through the parameter `level`.

  If the parameter isn't provided, it'll be set to the one given in `default_level`.
  Any invalid input would be ignored and the log-level would be automatically be set to `default`.

  Any complicated nested dictionary can be passed to the `metadata` field and the message gets forrmatted accordingly for easy reading.

  ```python
  from slack_logger import SlackLogger

  token = "your slack app token"
  options = {
      "service_name": "Backend API",
      "service_environment": "Production",
      "default_level": "info",
  }

  logger = SlackLogger(token=token, **options)

  channel = "#my_channel"
  response = logger.send(
      channel=channel,
      title="Celery Task Manager",
      description="Successfully completed training job for model v1.3.3!",
      level="success",
      metadata={
          "Metrics": {
              "Accuracy": 78.9,
              "Inference time": "0.8 sec",
              "Model size": "32 MB",
          },
          "Deployment status": "progress",
      },
  )
  ```

  ![Image](https://raw.githubusercontent.com/TurnrDev/better-slack-logger/master/images/success_message.png "Message with success log-level")



  The `error` field can contain any error message.
  It will be automatically be formatted in the final message.
  For example, you can send a complete traceback of an error message to debug faster!

  ```python
  import traceback

  from slack_logger import SlackLogger


  def get_traceback(e):
      tb = (
          "Traceback (most recent call last):\n"
          + "".join(traceback.format_list(traceback.extract_tb(e.__traceback__)))
          + type(e).__name__
          + ": "
          + str(e)
      )
      return tb


  token = "your slack app token"
  options = {
      "service_name": "Backend API",
      "service_environment": "Production",
      "default_level": "info",
  }

  err = KeyError("'email' field cannot be None")

  logger = SlackLogger(token=token, **options)

  channel = "#my_channel"
  response = logger.send(
      channel=channel,
      title="Runtime Exception",
      description=err.__str__(),
      error=get_traceback(err),
      metadata={"email": None, "module": "auth", "method": "POST"},
  )
  ```

  ![Image](https://raw.githubusercontent.com/TurnrDev/better-slack-logger/master/images/complete_error_traceback.png "Message with complete error traceback")


pkgId: a4751e50a662546c0d5fad0838bf7206c73ef5ff67c3bbfa79ad96c9026726ac
name: python-better-threads
arch: src
version: 2.0.7
epoch: 0
release: 1
summary: A package that provides extended control over threads
url: https://github.com/ItsYasiru/Better-Threads
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-threads-2.0.7-1.src.rpm
checksum_type: sha256
description:
  A wrapper over threads that provides extended control. The module supports pausing, terminating and putting threads to sleep. The module also provides some additional tools to Pipe data between threads and a thread pool to keep track of threads.


  - Pipe data between threads
  - Pause, Resume and Stop threads
  - Simple

  **Python 3.7 or higher is required**
  ```
  pip install better-threads
  ```

  More exmples https://github.com/ItsYasiru/Better-Threads/tree/master/examples
  ```py
  import time
  from BetterThreads import ThreadPool

  thread_pool = ThreadPool()


  @thread_pool.thread()
  def test_loop():
      print("Loop running!")
      time.sleep(1)


  test_loop.start(test_loop)
  time.sleep(5)
  test_loop.terminate(test_loop)
  ```


pkgId: 0a6de9974ae614e1d148f101c14a3cc0763d5a6ea1a924707780d3878ff0fc20
name: python-better-twitter
arch: src
version: 0.1.0
epoch: 0
release: 1
summary: A python package to block and mute fake and toxic twitter accounts in an automated and easy way.
url: https://github.com/saeedesmaili/better-twitter
rpm_license: MIT license
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-twitter-0.1.0-1.src.rpm
checksum_type: sha256
description:
  A simple python tool that makes your twitter timeline much better.


  ```bash
  pip3 install better-twitter
  ```


  To be able to use this package, you need to [register a Twitter app](https://github.com/saeedesmaili/better-twitter/blob/main/docs/twitter_app.md) and add its credentials when you use this package for the first time. This package will connect to your Twitter account using that app's credentials on behalf of you.



  To block multiple users of a file:
  ```bash
  better-twitter --block-file test_file.csv
  ```
  Note: The csv file should have two columns named `user_id` and `screen_name`.


  To mute multiple users of a file:
  ```bash
  better-twitter --mute-file test_file.csv
  ```
  Note: The csv file should have two columns named `user_id` and `screen_name`.


  To update twitter API credentials:
  ```bash
  better-twitter --update-api
  ```


  - [x] Add "mute from file" functionality
  - [x] Add "block from file" functionality
  - [ ] Rewrite the functions in OOP style
  - [ ] Splite functions to be separated in different files and directories (instead of a single main.py file)
  - [ ] Add "block/mute retweeters of a tweet" functionality
  - [ ] Add "block/mute likes of a tweet" functionality
  - [ ] Add "check a fake user's retweets" functionality
  - [ ] Add "remove my tweets older than N days" functionality
  - [ ] Add "remove my likes older than N days" functionality
  - [ ] Add "search for tweets containing a specific word/hashtag and block/mute them"
  - [ ] Add "export an account's tweets/followers/followings/likes"
  - [ ] Add "block accounts tweeting about a specific hashtag"
  - [ ] Add "export block list"


pkgId: 436264db0dea24031c41326d0968712e4296c3ce1ab829613a03258d9fa01f28
name: python-better-web3
arch: src
version: 3.2.1
epoch: 0
release: 1
summary: Chains, Contracts, batch calls and other Web3 stuff!
url: https://github.com/alenkimov/better_web3
rpm_license: UNKNOWN
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-better-web3-3.2.1-1.src.rpm
checksum_type: sha256
description:
  [![Telegram channel](https://img.shields.io/endpoint?url=https://runkit.io/damiankrawczyk/telegram-badge/branches/master?url=https://t.me/cum_insider)](https://t.me/cum_insider)
  [![PyPI version info](https://img.shields.io/pypi/v/better-web3.svg)](https://pypi.python.org/pypi/better-web3)
  [![PyPI supported Python versions](https://img.shields.io/pypi/pyversions/better-web3.svg)](https://pypi.python.org/pypi/better-web3)
  [![PyPI downloads per month](https://img.shields.io/pypi/dm/better-web3.svg)](https://pypi.python.org/pypi/better-web3)

  ```bash
  pip install better-web3
  ```

  More libraries of the family:
  - [better-proxy](https://github.com/alenkimov/better_proxy)
  - [better-automation](https://github.com/alenkimov/better_automation)


  - [safe-global](https://github.com/safe-global) / [Safe-eth-py (previosly known as Gnosis-py)](https://github.com/safe-global/safe-eth-py)
  - [Whynot63](https://github.com/Whynot63) / [web3-premium](https://github.com/Whynot63/web3-premium)


pkgId: 65b95192cb0655bb75a2cd3efed2504c37754f5eb039697ad7394ee238340c03
name: python-betterLogs4Python
arch: src
version: 0.1.8
epoch: 0
release: 1
url: https://github.com/JonasMayerDev/betterLogs4Python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betterLogs4Python-0.1.8-1.src.rpm
checksum_type: sha256
summary:
  As the name says, it's a little helper for logging more comfortably in python 3 (for now only python3 support) to file and console!

description:
      logFilename        |"app.log"      |(String) Defines the filename/path the BetterLogger will log to if printToFile is True.
      loggerName         |""             |(String) Defines a module name that will be added to the log message.
      includeTime        |False          |(Bool)   Defines if the log time should be included.
      printToConsole     |True           |(Bool)   Defines if the log messages should be printed to stdout (Console output).
      printToFile        |True           |(Bool)   Defines if the log messages should be printed to file (specified in logFilename parameter).
      lineLimiter        |-1             |(Int > 0) Defines the max number of lines in the log file. (-1 means no limit) (When exceeding the limit, old logs get deleted).
      runLimiter         |-1             |(Int > 0) Defines the max number of runs in the log file. Runs are separated with String defined in runSeparator parameter. (-1 means no limit) (When exceeding the limit, old runs get deleted).
      logLevelThreshold  |0              |(Int)    Defines the threshold of log level number that get logged (Message will only get printed to File or Console if it's logLevelNum > logLevelThreshold. Else the log will be ignored. Default logLevelNum is 20).
      runSeparator       |"----------"   |(String)   Defines the String that defines the end of a run. It gets used to retain the runLimit and gets logged when finishRun function is called. (If you normal log contains the runSeparator String it counts as the runSeparator)
      ```python
      logger = BetterLogger()
      ```
  3. Log to file by calling the log function with the logLevelNum parameter to define the type of the log message (default ist 20).
      The logLevelNum corresponds to the types as follows:


pkgId: 90eb3d611764841b927cfa98207a736ecebe59592ca98925827eeac2c66d6d16
name: python-betterTUI
arch: src
version: 0.0.51
epoch: 0
release: 1
summary: collection of curses widgets for building TUI's
url: https://github.com/Gomez0015/betterTUI
rpm_license: GNU General Public License v3 (GPLv3)
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-betterTUI-0.0.51-1.src.rpm
checksum_type: sha256
description:
  [Code](https://github.com/Gomez0015/betterTUI/tree/master/examples/musicPlayer)

  ![Demo_Screenshot](https://github.com/Gomez0015/betterTUI/blob/f7c04ba5d005b92d3084f69dbf703e725abc2346/examples/musicPlayer/image.png)



  The purpose of betterTUI is to make creating TUI's in python with navigation, input
  and colors easy and fast. I developped this library over curses because I could not find any others
  which accomplished this goal. If you want to contribute to the library, you are welcome to add
  Issues/PullRequests and I will look at them ASAP!

  You can find the documentation here: [Documentation](https://bettertui.readthedocs.io/en/latest/)


pkgId: 636b85d704cc0325dd234d4a525f899fae4b11eeee9ee6a3e626dca294c7f720
name: python-bettercam
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: A Python high-performance screenshot library for Windows use Desktop Duplication API
url: https://github.com/RootKit-Org/BetterCam
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-bettercam-1.0.0-1.src.rpm
checksum_type: sha256
description:
  ![World's Best AI Aimbot Banner](images/banner.png)

  [![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)
  > ***🌟 World's Fastest Python Screenshot Library for Windows 🐍***

  ```python
  import bettercam
  camera = bettercam.create()
  camera.grab()
  ```


  BetterCam is the World's 🌏 Fastest Publicly available Python screenshot library for Windows, boasting 240Hz+ capturing using the Desktop Duplication API 🖥️💨. Born from [DXCam](https://github.com/ra1nty/DXcam), it shines in deep learning pipelines for FPS games, outpacing other Python solutions like [python-mss](https://github.com/BoboTiG/python-mss) and [D3DShot](https://github.com/SerpentAI/D3DShot/).

  BetterCam's superpowers include:
  - 🚅 Insanely fast screen capturing (> 240Hz)
  - 🎮 Capture from Direct3D exclusive full-screen apps without interruption, even during alt+tab.
  - 🔧 Auto-adjusts to scaled / stretched resolutions.
  - 🎯 Precise FPS targeting for Video output.
  - 👌 Smooth NumPy, OpenCV, PyTorch integration, etc.

  > ***💞 Community contributions warmly invited!***



  ```bash
  pip install git+https://github.com/RootKit-Org/BetterCam
  ```

  **Note:** 🧩 OpenCV is needed by BetterCam for color space conversion. Install it with `pip install opencv-python` if not yet available.



  Each monitor is paired with a `BetterCam` instance.
  To get started:
  ```python
  import bettercam
  camera = bettercam.create()  # Primary monitor's BetterCam instance
  ```

  For a quick snap, call `.grab`:
  ```python
  frame = camera.grab()
  ```
  `frame` is a `numpy.ndarray` in the `(Height, Width, 3[RGB])` format by default. Note: `.grab` may return `None` if there's no update since the last `.grab`.

  To display your screenshot:
  ```python
  from PIL import Image
  Image.fromarray(frame).show()
  ```
  For a specific region, provide the `region` parameter with a tuple for the bounding box coordinates:
  ```python
  left, top = (1920 - 640) // 2, (1080 - 640) // 2
  right, bottom = left + 640, top + 640
  region = (left, top, right, bottom)
  frame = camera.grab(region=region)  # A 640x640x3 numpy ndarray snapshot
  ```


  Start and stop screen capture with `.start` and `.stop`:
  ```python
  camera.start(region=(left, top, right, bottom))  # Capture a region (optional)
  camera.is_capturing  # True

  camera.stop()
  camera.is_capturing  # False
  ```


  When capturing, grab the latest frame with `.get_latest_frame`:
  ```python
  camera.start()
  for i in range(1000):
      image = camera.get_latest_frame()  # Waits for a new frame
  camera.stop()
  ```



  ```python
  cam1, cam2, cam3 = [bettercam.create(device_idx=d, output_idx=o) for d, o in [(0, 0), (0, 1), (1, 1)]]
  img1, img2, img3 = [cam.grab() for cam in (cam1, cam2, cam3)]
  ```
  To list devices and outputs:
  ```pycon
  >>> import bettercam
  >>> bettercam.device_info()
  >>> bettercam.output_info()
  ```


  Select your color mode when creating a BetterCam instance:
  ```python
  bettercam.create(output_idx=0, output_color="BGRA")
  ```
  We support "RGB", "RGBA", "BGR", "BGRA", "GRAY" (for grayscale). Right now only `numpy.ndarray` shapes are supported: `(Height, Width, Channels)`.


  Frames go into a fixed-size ring buffer. Customize its max length with `max_buffer_len` on creation:
  ```python
  camera = bettercam.create(max_buffer_len=512)
  ```


  For precise FPS targeting, we use the high-resolution `CREATE_WAITABLE_TIMER_HIGH_RESOLUTION`:
  ```python
  camera.start(target_fps=120)  # Ideally, not beyond 240Hz.
  ```


  For constant framerate video recording, use `video_mode=True` during `.start`:
  ```python

  camera.start(target_fps=target_fps, video_mode=True)

  ```


  Call `.release` to stop captures and free resources. Manual deletion also possible:
  ```python
  del camera
  ```



  ```python
  cam = bettercam.create()

  ```
  |         | BetterCam Nvidia GPU :checkered_flag: | BetterCam :checkered_flag: | DXCam  | python-mss | D3DShot |
  |---------|---------------------------------------|--------------------------|--------|------------|---------|
  | Avg FPS | 111.667                               | 123.667                  | 39     | 34.667     | N/A     |
  | Std Dev | 0.889                                 | 1.778                    | 1.333  | 2.222      | N/A     |


  ```python

  ```
  | Target/Result | BetterCam Nvidia GPU :checkered_flag: | BetterCam :checkered_flag:   | DXCam | python-mss | D3DShot |
  |---------------|---------------------------------------|--------------------------|-------|------------|---------|
  | 120fps        | 111.667, 0.889                        | 88.333, 2.444            | 36.667, 0.889   | N/A        | N/A     |
  | 60fps         | 60, 0                                 | 60, 0                    | 35, 5.3   | N/A        | N/A     |


  - [DXCam](https://github.com/ra1nty/DXcam): Our origin story.
  - [D3DShot](https://github.com/SerpentAI/D3DShot/): Provided foundational ctypes.
  - [OBS Studio](https://github.com/obsproject/obs-studio): A treasure trove of knowledge.

  [^1]: [Preemption (computing)](https://en.wikipedia.org/wiki/Preemption_(computing))
  [^2]: [Time.sleep precision improvement](https://github.com/python/cpython/issues/65501)


