# packages

pkgId: 1ddb7c4b3934900fc3f017f4c72ac8fcb55cf80857ad87a62c449f4dfbc5ccaf
name: python-awtest
arch: src
version: 1.4
epoch: 0
release: 1
url: http://github.com/awhedon/gaplearn
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-awtest-1.4-1.src.rpm
checksum_type: sha256
summary:
  Bridging gaps between other machine learning and deep learning tools and making robust, post-mortem analysis possible.

description:
  GapLearn bridges gaps between other machine learning and deep learning tools. All models can be passed to the functions below regardless of the framework they were built upon (scikit-learn, tensorflow, xgboost, or even good ole numpy).

  My first package objective is to bring transparency to the often black-boxy model training process by making by making robust post-mortem analysis of the hyperparameter and feature selection processes possible. The functions below also further automate some processes while still giving the user full control of the results.

  Many features are on their way. Unit tests and full documentation will be added shortly.

  The source code is available on [GitHub](https://www.github.com/awhedon/gaplearn)



  ```bash
  pip install gaplearn
  ```

  See the latest version on [PyPI](https://pypi.org/project/gaplearn/)





  The `cv` submodule will have these classes (sfs has been released):


  **Description:**
  - This is a sequential feature selector that enables you to perform backwards elimination with any model (not just a linear regression).
  - At each step, the feature that has the lowest permutation importance is selected for removal. The permutation importance is measured as the decrease in accuracy by default, but the user can pass any custom scoring function.

  **Improvements on their way:**
  - Add forward selection and all subsets testing
  - Add more built-in scoring functions to for assessing feature permutation importance
  - Create custom permutation scoring method to remove `eli5` as a dependency
  - Enable a user to get the feature set that matches a certain criteria ("has n features", "has score > x")


  **backwards_elimination(X, y, model = 'logit', params = {}, fit_function = None, predict_function = None, score_function = None, score_name = 'accuracy', cols = [], verbose = 0)**
  - Run the backwards elimination
  - **Params:**
  	- X: (DataFrame or matrix) with independent variables
  	- y: (iterable) dependent corresponding variable values
  	- params: (dict) parameter set for model
  	- model: (str or custom model type) if str ('logit' or 'rfc'), a corresponding sci-kit learn model will be used; if custom model type, the model you pass will be used
  	- fit_function: (function) the function that will be used to train the model; the function must accept the parameters `model`, `X`, and `y`; if this value is not set, `backwards_elimination` will attempt to use your model's `fit` method
  	- predict_function: (function) the function that will be used to make predictions with the model; the function must accept the parameters `model`, and `X`; if this value is not set, `backwards_elimination` will attempt to use your model's `predict` method
  	- score_function: (function) the function that will be used to score the model and determine the feature permutation importance; the function must accept the parameters `y` and `preds`; if this value is not set, the accuracy will be used
  	- score_name: (str) name of the score calculated by the `score_function`; 'accuracy' by default

  **Example:**
  ```python
  import pandas as pd
  from gaplearn.cv import sfs



  X = pd.read_csv('X_classification.csv')
  y = pd.read_csv('y_classification.csv')

  fs_rfc = sfs()

  print('The backwards elimination has been run: {}'.format(fs_rfc.be_complete))

  fs_rfc.backwards_elimination(X, y, model = 'rfc', params = {'n_jobs': -1})


  summary_rfc = fs_rfc.get_summary_be() # Alternatively, `summary_rfc = fs_rfc.summary_be`


  results_rfc = fs_rfc.get_results_be() # Alternatively, `results_rfc = fs_rfc.results_be


  features_rfc = fs_rfc.features_be # Alternatives, `sorted(list(results_rfc['feature to remove']))


  summary_rfc[summary_rfc['overall accuracy'] > .85]



  from sklearn.linear_model import SGDRegressor

  model_sgd = SGDRegressor(loss = 'modified_huber', penalty = 'elasticnet')

  X = pd.read_csv('X_regression.csv')
  y = pd.read_csv('y_regression.csv')

  fs_nb = sfs()

  def mse(y, preds):
  	score = sum([(preds[i] - y[i]) ** 2 for i in range(y.shape[0])]) / y.shape[0]
  	return score

  def arbitrary_prediction(model, X):
  	preds = model.predict(X) + 1 # arbitrarily deciding to add 1 to the prediction (realistically, this would be a wrapper for model that don't have a `fit` method)
  	return preds

  fs_nb.backwards_elimination(X, y, model = model_sgd, predict_function = arbitrary_prediction, score_function = mse)


  summary_nb = fs_nb.get_summary_be() # Alternatively, `summary = fs_nb.summary_be`


  results_nb = fs_nb.get_results_be() # Alternatively, `results = fs_nb.results_be


  features_nb = fs_nb.features_be # Alternatives, `sorted(list(results['feature to remove']))
  ```


  **Description:**
  - This is a hyperparameter grid/random search for clustering algorithms
  - Unlike other grid/random search algorithms, this one enables you to get the observation-by-observation results from each parameter set so that you can do deep post-mortem analysis of the grid/random search.


  **Description:**
  - This is a hyperparameter grid/random search for both regression algorithms and classification algorithms
  - Unlike other grid/random search algorithms, this one enables you to get the observation-by-observation results from each parameter set so that you can do deep post-mortem analysis of the grid/random search.



  The `data_eng` submodule will have these classes (sfs has been released):


  **Description:**
  - This enables users to chunk multi-parameter sql queries and process them on multiple threads.


pkgId: d1f6143198db70e7febc144846b90201a4c4d0080029e3bebb0e5922d6068505
name: python-awx-plugins-core
arch: src
version: 0.0.1a7
epoch: 0
release: 1
summary: A temporary home for the essential AWX plugins
url: https://docs.ansible.com
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-awx-plugins-core-0.0.1a7-1.src.rpm
checksum_type: sha256
description:
  <!-- DO-NOT-REMOVE-docs-badges-START -->

  [![CI/CD Badge]][CI/CD]
  [![pre-commit.ci Badge]][pre-commit.ci]
  [![PyPI Badge]][PyPI]
  [![PyPI Supported Versions Badge]][PyPI Supported Versions]
  [![Codecov Badge]][Codecov]
  [![Code of Conduct Badge]][Code of Conduct]
  [![Apache v2 License Badge]][Apache v2 License]
  [![Ansible Matrix Badge]][Ansible Matrix]
  [![Ansible Discourse Badge]][Ansible Discourse]

  [CI/CD Badge]:
  https://github.com/ansible/awx-plugins/actions/workflows/ci-cd.yml/badge.svg?branch=devel
  [CI/CD]: https://github.com/ansible/awx-plugins/actions/workflows/ci-cd.yml

  [pre-commit.ci Badge]:
  https://results.pre-commit.ci/badge/github/ansible/awx-plugins/devel.svg
  [pre-commit.ci]:
  https://results.pre-commit.ci/latest/github/ansible/awx-plugins/devel

  [PyPI Badge]: https://img.shields.io/pypi/v/awx-plugins-core
  [PyPI]: https://pypi.org/p/awx-plugins-core

  [PyPI Supported Versions Badge]: https://img.shields.io/pypi/pyversions/awx-plugins-core.svg
  [PyPI Supported Versions]: https://pypi.org/p/awx-plugins-core

  [Codecov Badge]: https://codecov.io/gh/ansible/awx-plugins/branch/devel/graph/badge.svg
  [Codecov]: https://app.codecov.io/gh/ansible/awx-plugins

  [Code of Conduct Badge]: https://img.shields.io/badge/code%20of%20conduct-Ansible-yellow.svg
  [Code of Conduct]: https://docs.ansible.com/ansible/latest/community/code_of_conduct.html

  [Apache v2 License Badge]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
  [Apache v2 License]: https://github.com/ansible/awx-plugins/blob/devel/LICENSE

  [Ansible Matrix Badge]:
  https://img.shields.io/badge/matrix-Ansible%20Community-blueviolet.svg?logo=matrix
  [Ansible Matrix]: https://chat.ansible.im/#/welcome

  [Ansible Discourse Badge]:
  https://img.shields.io/badge/discourse-Ansible%20Community-yellowgreen.svg?logo=discourse
  [Ansible Discourse]: https://forum.ansible.com
  <!-- DO-NOT-REMOVE-docs-badges-END -->

  [![RTD Build Status Badge]][RTD Docs]

  [RTD Build Status Badge]:
  https://readthedocs.org/projects/awx-plugins-core/badge/?version=latest
  [RTD Docs]: https://awx-plugins-core.rtfd.io



  <!-- DO-NOT-REMOVE-docs-intro-START -->
  Credential plugins moved out of AWX.
  <!-- DO-NOT-REMOVE-docs-intro-END -->

rpm_license:
[cell repeats an earlier one in this file: 10254 characters]


pkgId: 151bda3d7d97c7a93cc2da5ed1adfdd628da54601ef2e98a623cf8ecf8741aa6
name: python-awx-plugins.interfaces
arch: src
version: 0.0.1a2
epoch: 0
release: 1
summary: Common interfaces for implementing plugins to AWX.
url: https://docs.ansible.com
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-awx-plugins.interfaces-0.0.1a2-1.src.rpm
checksum_type: sha256
description:
  <!-- DO-NOT-REMOVE-docs-badges-START -->

  [![CI/CD Badge]][CI/CD]
  [![pre-commit.ci Badge]][pre-commit.ci]
  [![PyPI Badge]][PyPI]
  [![PyPI Supported Versions Badge]][PyPI Supported Versions]
  [![Codecov Badge]][Codecov]
  [![Code of Conduct Badge]][Code of Conduct]
  [![Apache v2 License Badge]][Apache v2 License]
  [![Ansible Matrix Badge]][Ansible Matrix]
  [![Ansible Discourse Badge]][Ansible Discourse]

  [CI/CD Badge]:
  https://github.com/ansible/awx_plugins.interfaces/actions/workflows/ci-cd.yml/badge.svg?branch=devel
  [CI/CD]: https://github.com/ansible/awx_plugins.interfaces/actions/workflows/ci-cd.yml

  [pre-commit.ci Badge]:
  https://results.pre-commit.ci/badge/github/ansible/awx_plugins.interfaces/devel.svg
  [pre-commit.ci]:
  https://results.pre-commit.ci/latest/github/ansible/awx_plugins.interfaces/devel

  [PyPI Badge]: https://img.shields.io/pypi/v/awx_plugins.interfaces
  [PyPI]: https://pypi.org/p/awx_plugins.interfaces

  [PyPI Supported Versions Badge]: https://img.shields.io/pypi/pyversions/awx_plugins.interfaces.svg
  [PyPI Supported Versions]: https://pypi.org/p/awx_plugins.interfaces

  [Codecov Badge]: https://codecov.io/gh/ansible/awx_plugins.interfaces/branch/devel/graph/badge.svg
  [Codecov]: https://app.codecov.io/gh/ansible/awx_plugins.interfaces

  [Code of Conduct Badge]: https://img.shields.io/badge/code%20of%20conduct-Ansible-yellow.svg
  [Code of Conduct]: https://docs.ansible.com/ansible/latest/community/code_of_conduct.html

  [Apache v2 License Badge]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
  [Apache v2 License]: https://github.com/ansible/awx_plugins.interfaces/blob/devel/LICENSE

  [Ansible Matrix Badge]:
  https://img.shields.io/badge/matrix-Ansible%20Community-blueviolet.svg?logo=matrix
  [Ansible Matrix]: https://chat.ansible.im/#/welcome

  [Ansible Discourse Badge]:
  https://img.shields.io/badge/discourse-Ansible%20Community-yellowgreen.svg?logo=discourse
  [Ansible Discourse]: https://forum.ansible.com
  <!-- DO-NOT-REMOVE-docs-badges-END -->

  [![RTD Build Status Badge]][RTD Docs]

  [RTD Build Status Badge]:
  https://readthedocs.org/projects/awx-plugins-interfaces/badge/?version=latest
  [RTD Docs]: https://awx-plugins-interfaces.rtfd.io



  <!-- DO-NOT-REMOVE-docs-intro-START -->
  Common interfaces for implementing plugins to AWX.
  <!-- DO-NOT-REMOVE-docs-intro-END -->

rpm_license:
[cell repeats an earlier one in this file: 10254 characters]


pkgId: d2033a774a1b94be34d6c113bfb9aaef5ab613e6edda85a04c00f0947ebf8d81
name: python-ax-platform
arch: src
version: 0.4.1
epoch: 0
release: 1
summary: Adaptive Experimentation
url: https://github.com/facebook/Ax
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ax-platform-0.4.1-1.src.rpm
checksum_type: sha256
description:
  <img width="300" src="https://ax.dev/img/ax_logo_lockup.svg" alt="Ax Logo" />

  <hr/>

  [![Support Ukraine](https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat&labelColor=005BBB)](https://opensource.fb.com/support-ukraine)
  [![Build Status](https://img.shields.io/pypi/v/ax-platform.svg)](https://pypi.org/project/ax-platform/)
  [![Build Status](https://img.shields.io/pypi/pyversions/ax-platform.svg)](https://pypi.org/project/ax-platform/)
  [![Build Status](https://img.shields.io/pypi/wheel/ax-platform.svg)](https://pypi.org/project/ax-platform/)
  [![Build Status](https://github.com/facebook/Ax/workflows/Build%20and%20Test%20Workflow/badge.svg)](https://github.com/facebook/Ax/actions?query=workflow%3A%22Build+and+Test+Workflow%22)
  [![codecov](https://codecov.io/gh/facebook/Ax/branch/main/graph/badge.svg)](https://codecov.io/gh/facebook/Ax)
  [![Build Status](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

  Ax is an accessible, general-purpose platform for understanding, managing,
  deploying, and automating adaptive experiments.

  Adaptive experimentation is the machine-learning guided process of iteratively
  exploring a (possibly infinite) parameter space in order to identify optimal
  configurations in a resource-efficient manner. Ax currently supports Bayesian
  optimization and bandit optimization as exploration strategies. Bayesian
  optimization in Ax is powered by
  [BoTorch](https://github.com/facebookexternal/botorch), a modern library for
  Bayesian optimization research built on PyTorch.

  For full documentation and tutorials, see the [Ax website](https://ax.dev)



  - **Versatility**: Ax supports different kinds of experiments, from dynamic
    ML-assisted A/B testing, to hyperparameter optimization in machine learning.
  - **Customization**: Ax makes it easy to add new modeling and decision
    algorithms, enabling research and development with minimal overhead.
  - **Production-completeness**: Ax comes with storage integration and ability to
    fully save and reload experiments.
  - **Support for multi-modal and constrained experimentation**: Ax allows for
    running and combining multiple experiments (e.g. simulation with a real-world
    "online" A/B test) and for constrained optimization (e.g. improving
    classification accuracy without significant increase in resource-utilization).
  - **Efficiency in high-noise setting**: Ax offers state-of-the-art algorithms
    specifically geared to noisy experiments, such as simulations with
    reinforcement-learning agents.
  - **Ease of use**: Ax includes 3 different APIs that strike different balances
    between lightweight structure and flexibility. The Service API (recommended
    for the vast majority of use-cases) provides an extensive, robust, and
    easy-to-use interface to Ax; the Loop API enables particularly concise usage;
    and the Developer API enables advanced experimental and methodological
    control.



  To run a simple optimization loop in Ax (using the
  [Booth response surface](https://www.sfu.ca/~ssurjano/booth.html) as the
  artificial evaluation function):

  ```python
  >>> from ax import optimize
  >>> best_parameters, best_values, experiment, model = optimize(
          parameters=[
            {
              "name": "x1",
              "type": "range",
              "bounds": [-10.0, 10.0],
            },
            {
              "name": "x2",
              "type": "range",
              "bounds": [-10.0, 10.0],
            },
          ],
          
          evaluation_function=lambda p: (p["x1"] + 2*p["x2"] - 7)**2 + (2*p["x1"] + p["x2"] - 5)**2,
          minimize=True,
      )


  ```





  You need Python 3.10 or later to run Ax.

  The required Python dependencies are:

  - [botorch](https://www.botorch.org)
  - jinja2
  - pandas
  - scipy
  - sklearn
  - plotly >=2.2.1





  We recommend installing Ax via pip (even if using Conda environment):

  ```
  conda install pytorch torchvision -c pytorch  # OSX only (details below)
  pip install ax-platform
  ```

  Installation will use Python wheels from PyPI, available for
  [OSX, Linux, and Windows](https://pypi.org/project/ax-platform/#files).

  _Note_: Make sure the `pip` being used to install `ax-platform` is actually the
  one from the newly created Conda environment. If you're using a Unix-based OS,
  you can use `which pip` to check.

  _Recommendation for MacOS users_: PyTorch is a required dependency of BoTorch,
  and can be automatically installed via pip. However, **we recommend you
  [install PyTorch manually](https://pytorch.org/get-started/locally/#anaconda-1)
  before installing Ax, using the Anaconda package manager**. Installing from
  Anaconda will link against MKL (a library that optimizes mathematical
  computation for Intel processors). This will result in up to an
  order-of-magnitude speed-up for Bayesian optimization, as at the moment,
  installing PyTorch from pip does not link against MKL.

  If you need CUDA on MacOS, you will need to build PyTorch from source. Please
  consult the PyTorch installation instructions above.



  To use Ax with a notebook environment, you will need Jupyter. Install it first:

  ```
  pip install jupyter
  ```

  If you want to store the experiments in MySQL, you will need SQLAlchemy:

  ```
  pip install SQLAlchemy
  ```





  You can install the latest (bleeding edge) version from Git.

  First, see recommendation for installing PyTorch for MacOS users above.

  At times, the bleeding edge for Ax can depend on bleeding edge versions of
  BoTorch (or GPyTorch). We therefore recommend installing those from Git as well:

  ```
  pip install git+https://github.com/cornellius-gp/linear_operator.git
  pip install git+https://github.com/cornellius-gp/gpytorch.git
  export ALLOW_LATEST_GPYTORCH_LINOP=true
  pip install git+https://github.com/pytorch/botorch.git
  export ALLOW_BOTORCH_LATEST=true
  pip install git+https://github.com/facebook/Ax.git#egg=ax-platform
  ```



  If using Ax in Jupyter notebooks:

  ```
  pip install git+https://github.com/facebook/Ax.git#egg=ax-platform[notebook]
  ```

  To support plotly-based plotting in newer Jupyter notebook versions

  ```
  pip install "notebook>=5.3" "ipywidgets==7.5"
  ```

  [See Plotly repo's README](https://github.com/plotly/plotly.py#jupyter-notebook-support)
  for details and JupyterLab instructions.

  If storing Ax experiments via SQLAlchemy in MySQL or SQLite:

  ```
  pip install git+https://github.com/facebook/Ax.git#egg=ax-platform[mysql]
  ```





  Please open an issue on our [issues page](https://github.com/facebook/Ax/issues)
  with any questions, feature requests or bug reports! If posting a bug report,
  please include a minimal reproducible example (as a code snippet) that we can
  use to reproduce and debug the problem you encountered.



  See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.

  When contributing to Ax, we recommend cloning the
  [repository](https://github.com/facebook/Ax) and installing all optional
  dependencies:

  ```
  pip install git+https://github.com/cornellius-gp/linear_operator.git
  pip install git+https://github.com/cornellius-gp/gpytorch.git
  export ALLOW_LATEST_GPYTORCH_LINOP=true
  pip install git+https://github.com/pytorch/botorch.git
  export ALLOW_BOTORCH_LATEST=true
  git clone https://github.com/facebook/ax.git --depth 1
  cd ax
  pip install -e .[tutorial]
  ```

  See recommendation for installing PyTorch for MacOS users above.

  The above example limits the cloned directory size via the
  [`--depth`](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt)
  argument to `git clone`. If you require the entire commit history you may remove
  this argument.



  Ax is licensed under the [MIT license](./LICENSE).


pkgId: 580318fc4c2591ee73afb5b1c6620951fc546b3ed3fa4cf99d4a98c98f352a05
name: python-ax3-email
arch: src
version: 2.0.0
epoch: 0
release: 1
summary: AX3 Email is a Django application designed to send emails using Huey tasks.
url: https://pypi.org/project/ax3-email/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ax3-email-2.0.0-1.src.rpm
checksum_type: sha256
description:
  AX3 Email is a Django application designed to send emails using Huey tasks.



  You can easily install AX3 Email from the PyPI package using the following command:

  ```bash
  pip install ax3-email
  ```

  After the package is installed, you need to configure your project settings. Specifically, you need to add `ax3_email` to your `INSTALLED_APPS`:

  ```python
  INSTALLED_APPS += ['ax3_email']
  ```



  Next, you need to add the email backend settings. Here's how you can do it:

  ```python

  EMAIL_BACKEND = 'ax3_email.backends.AX3EmailBackend'
  ```

  You can also specify additional settings for AX3 Email:

  ```python

  AX3_EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' # Optional - Default is smtp (django). This is the Django Email that actually sends the emails.
  AX3_EMAIL_RETRIES  # Optional - Default is 3. This is the maximum number of times to retry sending an email.
  AX3_EMAIL_DELAY # Optional - Default is 600. This is the time in seconds between attempts to send an email.
  AX3_EMAIL_BACKUP_LIST # Optional - This is a list of emails to send a BCC backup copy of each email.
  AX3_ONLY_BACKUP_LIST # Optional - If set to True, emails will only be sent to the backup list.
  EMAIL_SUBJECT # Optional - This is a string format for all email subjects. For example, you can use '[ax3_prefix] {} ' as a prefix.
  ```



  To build the package, you need to run the following command:

  ```bash
  rye build && rye publish

  ```


pkgId: c84bb79055a98d0feced235e1153a5c3502a4df84cf7f4225ee823e7fcf31de5
name: python-ax3-model-extras
arch: src
version: 2.0.1
epoch: 0
release: 1
summary: Django app extras for AX3 models
url: https://github.com/axiacore/ax3-model-extras
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ax3-model-extras-2.0.1-1.src.rpm
checksum_type: sha256
description:
  AX3 Model Extras is easy to install from the PyPI package:

  ```bash
  $ pip install ax3-model-extras
  ```

  To enable ax3_model_extras in your project you need to add it to INSTALLED_APPS in your projects settings.py file:

  ```python
  INSTALLED_APPS = (
      ...
      'ax3_model_extras',
      ...
  )
  ```



  If you want to validate the dimension and file size for images:

  ```python
  from ax3_model_extras.validators import FileSizeValidator, ImageDimensionValidator


  class Post(models.Model):
      title = models.CharField()

      slug = models.SlugField()

      image = models.ImageField(
          validators=[ImageDimensionValidator([1920, 800]), FileSizeValidator(350)],
          help_text='JPG. 1920x800px. 350kb max.',
      )
  ```

  If you want to validate one dimension, you have to send the other dimension with 0

  ```python
  from ax3_model_extras.validators import FileSizeValidator, ImageDimensionValidator


  class Post(models.Model):
      title = models.CharField()

      slug = models.SlugField()

      image = models.ImageField(
          validators=[ImageDimensionValidator([1920, 0]), FileSizeValidator(350)],
          help_text='JPG. width=1920px. 350kb max.',
      )
  ```



  If you want to improve the local file storage or use S3 upload:

  ```python
  from ax3_model_extras.storages import get_storage, get_upload_path


  class Post(models.Model):
      title = models.CharField()

      slug = models.SlugField()

      image = models.ImageField(
          upload_to=get_upload_path,
          storage=get_storage(),
      )
  ```



  Use as:

  ```python
  from ax3_model_extras.fields import OptimizedImageField


  class Post(models.Model):
      title = models.CharField()

      slug = models.SlugField()

      image = OptimizedImageField()

  ```

  If want to set the size of the image using the 'cover' method do:

  ```python
  image = OptimizedImageField(
      optimized_image_output_size=(1920, 800),
  )
  ```

  If want to set the size of the image using the 'thumbnail' method do:

  ```python
  image = OptimizedImageField(
      optimized_image_output_size=(1920, 800),
      optimized_image_resize_method='thumbnail',
  )
  ```

  If want to restrict the file format do (If not set it supports JPEG, PNG and GIF):

  ```python
  image = OptimizedImageField(
      optimized_image_output_size=(1920, 800),
      optimized_image_resize_method='thumbnail',
      optimized_file_formats=['PNG'],
  )
  ```

  If want to specific quality of the image (If not set it default =  75):

  ```python
  image = OptimizedImageField(
      optimized_image_output_size=(1920, 800),
      optimized_image_resize_method='thumbnail',
      optimized_file_formats=['PNG'],
      optimized_image_quality=85.5,
  )
  ```

  Resize is done using [python-resize-image](https://pypi.org/project/python-resize-image/)



  Make sure you have an API Token for PyPI: https://pypi.org/help/#apitoken

  Make sure you increase the version number and create a git tag:

  ```bash
  $ python3 -m pip install --user --upgrade setuptools wheel twine
  $ ./release.sh
  ```

  Made by [Axiacore](https://axiacore.com).


pkgId: 2f28b1a802247da182cb6455deac261900565bc0732ead7c5e0e016449e46d8a
name: python-ax3-redactor
arch: src
version: 2.0.0
epoch: 0
release: 1
summary: A Django app to add support for redactor
url: https://github.com/Axiacore/ax3-redactor
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ax3-redactor-2.0.0-1.src.rpm
checksum_type: sha256
description:
  This app is part of the AX3 technology developed by Axiacore.

  It will allow to use redactor inside the django admin interface.



  1. Add "redactor" to your INSTALLED_APPS setting like this:

  ```python
      INSTALLED_APPS = [
          ...
          'redactor',
      ]
  ```

  2. Include the redactor URLconf in your project urls.py like this:

  ```python
      path('', include('redactor.urls')),
  ```

  3. Run `python manage.py migrate` to create the redactor models.

  4. Copy this redactor library files into a `static` folder in your proyect:

  ```python
      vendor/redactor/redactor.min.css
      vendor/redactor/redactor.min.js
      vendor/redactor/plugins/imagemanager.min.js
      vendor/redactor/plugins/video.min.js
      vendor/redactor/plugins/widget.min.js
  ```

  5. Add to the admin.py the redactor support for a given model:

  ```python
      from django.contrib import admin

      from redactor.mixins import RedactorMixin

      from .models import Post


      @admin.register(Post)
      class PostAdmin(RedactorMixin, admin.ModelAdmin):
          ...

          redactor_fields = ['content']

          ...
  ```

  `content` is a `TextField` attribute at the `Post` model.
  You can use multiple fields.



  Make sure you have an API Token for PyPI: https://pypi.org/help/#apitoken

  Make sure you increase the version number and create a git tag:

  ```bash
  $ python3 -m pip install --user --upgrade setuptools wheel twine
  $ ./release.sh
  ```

  Made by [Axiacore](https://axiacore.com).


pkgId: 5969f5547cc6cce005806231d690f55e7960b8e86da423c2395f80967d1612eb
name: python-axblack
arch: src
version: 20220330
epoch: 0
release: 1
summary: The uncompromising code formatter (compromised version)
url: https://github.com/axiros/axblack
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axblack-20220330-1.src.rpm
checksum_type: sha256
description:
  This is a forked alternative to the official [black](https://github.com/psf/black) formatter,
  which is a wonderful tool but (too?) [strict](https://github.com/psf/black/issues/118) about single quotes, ([very](https://github.com/psf/black/issues/51)) unfortunatelly.
  > We we are sure they'll change their minds one day, so this fork is not necessary any more - it is a workaround to bridge that time gap.
  Note: There are other forks as well, with yet more features, e.g. [oitnb](https://pypi.org/project/oitnb/) - orange is the new black.
  *This* fork is based on [this](https://github.com/psf/black/tree/fb1ac6981257c91a1d3bf753d10e1091f05b001a) psf/black version (2019-11-23). We will not merge in all code restructurings done in 2020.

  This is based on a python only version of black. Meanwhile they compile it to C, gaining some 25-30% performance, compared to axblack.
  You'll notice a difference only at huge file sizes.
  Tip: Configure your code formatter to run [async][lfn] at file save.
  [lfn]: https://github.com/lukas-reineke/lsp-format.nvim

  1. The argument that one unified style **would** be superbeneficial for
  the whole community we do share - BUT: While line length **is** still configurable that goal cannot be reached anyway, even with opinionated fixed quoting style. Also with the new (since 20.x?) 'line wrap at trailing comma feature' they actually allow a lot of individual 'creative freedom', regarding how code looks.
  2. The reason why the black author [changed his mind](https://github.com/psf/black/issues/51#issuecomment-375722810_) away from using single quotes: [pull request/75](https://github.com/psf/black/pull/75#issuecomment-376203386_) was this example: `{MESSAGE.two: "Please don't look over there."}`. We ~~don't~~ do not think, that this example is justifying the strict rejection of the idea of making quoting style even configurable.
  3. You are not alone if you prefer single quotes:
  > [If you use single-quotes for your strings you are in good company: “People use to really love double quotes. I don’t know why.. ](https://www.youtube.com/watch?v=wf-BqAjZb8M&feature=youtu.be&t=1081)
  [![](https://raw.githubusercontent.com/axiros/axblack/master/docs/_static/ht_tw.png)](https://twitter.com/raymondh/status/1259209765072154624)
  ```python
  >>> """"""'what do you  prefer'""""""
  'what do you  prefer'
  ```


  Single quotes are default.
  Patch is based on this [PR](https://github.com/psf/black/pull/1003).

  When you explitely specify excludes in a toml file, then we respect them
  *always* - even if a file is given on the CLI.

  The list of files to be formatted are often *dynamically* built, e.g.:
      black `git diff --name-only --diff-filter=ACM`
  We must in such cases still respect the exclude list, even if files had been changed
  (e.g. from ZODB dumps).

  When you configure explicitely (via `--config`) a pyproject.toml file, then
  its path will fix the project root, relevant for regex matching the
  excludes (see above). Otherwise black would reset the project root per passed
  file, which is a problem when it finds e.g. subrepos' .git or .hg folders.

  No pre-release foo.
  - [here](https://github.com/psf/black/issues/209)
  - [here](https://github.com/microsoft/vscode-python/issues/5171)
  - [here](https://github.com/microsoft/vscode-python/issues/5756)
  - [here](https://github.com/psf/black/issues/517)
  regarding why.
  We leave the calver style versioning scheme, but w/o dots, to indicate that this is not a "real" project.
  > Yes this is [PEP-440](https://www.python.org/dev/peps/pep-0440/) compatible.
  > And yes, we (meanwhile) know that [pipenv](https://chriswarrick.com/blog/2018/07/17/pipenv-promises-a-lot-delivers-very-little/) has a problem with such versions and `^`. Here you have to pin it.

  We wanted to keep the offset minimal and not deviate more than necessary.
  Therefore via the vim plugin and also the blackd server you do not have the option to
  set double quotes - you have to use the `--double-quotes` command line flag as
  only way to get them.
  Should you prefer them for private projects or find them in project policies, by any means, use the official black version then.
  Q: Why not rename black into axblack to allow coexistance?
  A: Because black is builtin-supported by [many](https://github.com/dense-analysis/ale/blob/master/doc/ale-python.txt
  ) tools, which rely on that name. Meaning you need seperate python
  environments in order to use both on one host.
  Tip: When a tool has a dependency on the official version than nail it to
   `18.6b4`, e.g. in pyproject.toml:
  ```toml
  [tool.poetry.dev-dependencies]
  autoflake = "^1.4"
  axblack = "^20201010"
  black = "18.6b4"
  ```
  Since axblack still is installed into site-packges directly, while newer
  version of black are in a subfolder there.
  <details><summary>Changelog</summary>
  [2022-03-30 13:33]
  - Removed the `_unicodefun` patching of click (https://github.com/axiros/axblack/issues/16)
  [ 2022-03-21 14:47]
  - Added an unprocessed `--stdin-filename` CLI switch, since some LSP servers (e.g. null-ls) send it
  [2020-10-09 19:31]
  - Changed the triple quote behaviour (keep them only in simple statements like
    docstrings but not assignments). See https://github.com/axiros/axblack/issues/6
  [2019-12-12 12:57]
  - Changed the exclude behaviour: When exclude given in .toml file we *always*
    respect it - even if a file is excplitely given on CLI for formats.
  [2019-11-24 11:21]
  - Set single_quotes as default in black.py `class File`, so that it works also
    in vim.
  [2019-11-24 11:21]
  - Recreated repo as direct fork of psf/black, with adapted master branch for
    easier future merges from them (and getting their newest improvements)
  [2019-11-23 21:16]
  - Dropped the -s in favor of the long argument "double-quotes" - to never
    collide with any argument of theirs. Default for double-quotes: False
  - Bugfixed the parsing of single-quotes
  - Added the [cf](./ax/cf) tool.
  [2019-11-23 18:05]
  - Added more README (Usage)
  [2019-11-23 15:05]
  Initial version after:
  - `git clone https://github.com/mark-riley/black.git axblack`
  - `git reset --hard configure-quote-style`
  - `git reset --hard remotes/origin/configure-quote-style`
  - Set `default=True` into black.py
  - Created axblack pip and pushed to pypi.
  </details>

  `pip install axblack` into a python3 v(irtual)env or conda environment.
  See also original docu below - exchange "psf/black" with "axiros/axblack".

  Install black into a python environment and refer to it via
  `g:black_virtualenv` as shown in the example, then the plugin will install
  a venv into .vim/black!
  Also, note that it proves very handy to have formatting being done at each file write.
  <details><summary>Suggested vim setup</summary>
  ```vim
  Plug 'axiros/axblack'
  " not black related but useful:
  autocmd FileType python map <Leader>e Otry:<Esc>j^i<TAB><Esc>oexcept Exception as ex:<CR>print('breakpoint set')<CR>breakpoint()<CR>keep_ctx=True<Esc>^
  " defaults:
  let g:black_linelength = 88
  let g:black_fast = 1
  " set appropriately:
  let g:black_virtualenv = "<set to base dir of a py3 environ with black installed>"
  " Clean whitespace at saves:
  "autocmd BufWritePre * execute ':RemoveWhitespace'
  fun! Blackify()
      if &ft =~ 'python'
      endif
  endfun
  " blackify at any write of a python file:
  autocmd BufWritePre * call Blackify()
  " Using pythonmode? Keep it happy:
  let g:pymode_options_max_line_length = 88
  let g:pymode_lint_options_pep8 = {'max_line_length': g:pymode_options_max_line_length}
  let g:pymode_options_colorcolumn = 1
  ```
  </details>


  Create a `pyproject.toml` file in the toplevel directory of your project as
  shown below and adapt the exclude directories according to your needs.
  <details>
  <summary>Example `pyproject.toml`</summary>
  Add a note for using axblack to avoid confusion:
  ```toml
  [tool.black]

  line-length = 88
  target-version = ['py27']
  include = '\.pyi?$'
  exclude = '''
  (
    /(
        \.eggs         # exclude a few common directories in the
      | \.git          # root of the project
      | \.hg
      | \.mypy_cache
      | \.tox
      | \.venv
      | _build
      | build
      | dist
    )/
    | (.*)/foo.py      # also separately exclude a files named foo.py
  )
  '''
  ```
  </details>
  Then `black .` will reformat from the current directory, recursively (not
  above this directory).
  If you have a mix of python2 and python3 in your project then create
  a specific `pyproject.toml` within the respective top level directory and run
  black for each of them seperately. black always searching up the specified
  directory on the command line for the first project toml file and uses it.

  Black ensures to not break anything, by comparing ASTs before and after
  formatting - which slows it down a bit.
  If the code base is large you want to normally have **fast** mode on, therefore, in daily work.
  This is what you do:
  1. Create your project toml file with excludes which shall *never* be
     formattet.
  1. Run black with `--safe` on. If all can be converted then good, you can add
     `--fast` from now on or put it even into your toml file.
     Should you have errors from the AST check then, **before** any run in fast mode either
     - exclude those files within the toml
     - fix them. From experience this often hints to bugs.
     Example:
  ```
  error: cannot format .../sleekxmpp/thirdparty/gnupg.py: INTERNAL ERROR:
  Black produced different code on the second pass of the formatter.
  ```
  Again: **Do not run black in fast mode if you had errors in safe mode!**
  It will produce source code which is potentially off, behaviourally, from the original!

  With more collaborateurs on the same repo (e.g. at a customer site) you may want to
  consider enforcing your code style via a repo hook:
  <details><summary>Repo Hook Example</summary>
  ```bash





  black="/agent/py3/bin/black" # adapt to your environment
  git diff --cached --name-only --diff-filter=ACM | while read -r fn
  do
      echo "Format check: $fn"
      "$black" --check "$fn" > /dev/null || exit 1
      echo "Accepted."
  done || {
      echo "Commit rejected - not all files formatted correctly."
      echo "Please do so now: $black -h"
      exit 1
  }
  ```
  </details>
  <br/>

  If you
  - can't adopt pyproject.toml but want to stick to shell sourceable config
    and /or environ based config
  - require composition of such config
  - easily want to run in client server mode, for speed
  - require automatically created skip lists
  then have a look at [this](./ax/cf) code formatter tool we created, which
  wraps black and blackd.
  > The tool is not installed by pip currently.


pkgId: 70c7dad371895ac82e52a747d14f522711fd75856ffba49086ba59f956f314ed
name: python-axdocsystem
arch: src
version: 0.1.52
epoch: 0
release: 1
summary: a simple document managment system, was created for the purpose of submitting a work for uni
url: https://pypi.org/project/axdocsystem/
rpm_license: UNKNOWN
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axdocsystem-0.1.52-1.src.rpm
checksum_type: sha256
description:
  a simple document managment system, was created for the purpose of submitting a work for uni



  ```bash
  pip install axdocsystem
  ```


pkgId: 97b9310335163f82c45871f4e28637f1e0c27bdd6fa91d364da9b637a54fe0d0
name: python-axe-core-python
arch: src
version: 0.1.0
epoch: 0
release: 1
summary: Automated web accessibility testing using axe-core engine.
url: https://github.com/ruslan-rv-ua/axe-core-python
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axe-core-python-0.1.0-1.src.rpm
checksum_type: sha256
description:
  ![PyPI](https://img.shields.io/pypi/v/axe-core-python)
  ![PyPI - License](https://img.shields.io/pypi/l/axe-core-python)
  ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/axe-core-python)
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/axe-core-python)


  Automated web accessibility testing using [axe-core](https://github.com/dequelabs/axe-core) engine.



  - [Full documentation](https://ruslan-rv-ua.github.io/axe-core-python/).



  - Python >= 3.10
  - [selenium](https://www.selenium.dev) >= 4.4.0
  or [playwright](https://github.com/microsoft/playwright-python) >= 1.25.0



  ```console
  pip install -U axe-core-python
  ```



  ```python
  from playwright.sync_api import sync_playwright
  from axe_core_python.sync_playwright import Axe

  axe = Axe()

  with sync_playwright() as playwright:
      browser = playwright.chromium.launch()
      page = browser.new_page()
      page.goto("https://www.google.com")
      result = axe.run(page)
      browser.close()

  violations = result['violations']
  print(f"{len(violations)} violations found.")
  ```

  For more examples see [documentation](https://ruslan-rv-ua.github.io/axe-core-python/).


pkgId: 153015db80e2d15b0da6f995dc054db247c9548f78da35c5d1c4c434eeeca862
name: python-axe-selenium-python
arch: src
version: 2.1.6
epoch: 0
release: 1
summary: Python library to integrate axe and selenium for web accessibility testing.
url: http://github.com/mozilla-services/axe-selenium-python
rpm_license: Mozilla Public License 2.0 (MPL 2.0)
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axe-selenium-python-2.1.6-1.src.rpm
checksum_type: sha256
description:
  axe-selenium-python integrates aXe and selenium to enable automated web accessibility testing.
  **This version of axe-selenium-python is using axe-core@3.1.1.**


pkgId: 87faa163c63184179b0ad93213153a883f1e22c7bfaa5a9213d0c17878377902
name: python-axe-selenium-python-nhsuk
arch: src
version: 1.0.4
epoch: 0
release: 1
summary: Python library to integrate axe and selenium for web accessibility testing.
url: https://github.com/ghufrankhan/axe-selenium-python
rpm_license: Mozilla Public License 2.0 (MPL 2.0)
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axe-selenium-python-nhsuk-1.0.4-1.src.rpm
checksum_type: sha256
description:
  | This package is derived from `axe-selenium-python 2.1.6 <https://pypi.org/project/axe-selenium-python/2.1.6/>`_.
  | The main purpose of creating a new package was to allow us to update the axe-core version and push to PyPi. The original package has not been updated since 2018.


pkgId: 007aa595dceefd1f8edc2f087b16677323a9252fbf85c65589a3c19461e59c87
name: python-axem-dem
arch: src
version: 0.8.0
epoch: 0
release: 1
summary: Manager for Containerized Development Environments
url: https://axemsolutions.io/
rpm_license: Eclipse Public License - v2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axem-dem-0.8.0-1.src.rpm
checksum_type: sha256
description:
  <div align="center">
      <picture>
          <source media="(prefers-color-scheme: dark)" srcset="docs/wp-content/dem_logo_dark.png">
          <img alt="DEM logo" src="docs/wp-content/dem_logo_light.png" width="150">
      </picture>
  </div>

  <br>

  <h1 align="center">
      Development Environment Manager <br /> for <br /> Embedded Development
  </h1>

  <h3 align="center">
  Manage your isolated Development Environments with ease
  </h3>
  <br />

  <p align="center">
      <a href="https://github.com/axem-solutions/dem/tags" target="_blank"><img src="https://img.shields.io/github/v/tag/axem-solutions/dem?logo=github&color=79A7B5&link=https%3A%2F%2Fgithub.com%2Faxem-solutions%2Fdem%2Freleases" alt="GitHub tag (with filter)"/></a>
      <a href="https://github.com/axem-solutions/dem/issues" target="_blank"><img src="https://img.shields.io/github/issues/axem-solutions/dem?logo=github&color=2ea087&link=https%3A%2F%2Fgithub.com%2Faxem-solutions%2Fdem%2Fissues" alt="GitHub issues"/></a>
      <a href="https://discord.com/invite/Nv6hSzXruK" target="_blank"><img src="https://img.shields.io/discord/1156270239860920431?logo=discord&color=2C2F33&link=https%3A%2F%2Fdiscord.com%2Finvite%Nv6hSzXruK" alt="Discord"/></a>
  </p>

  <br />

  <h3 align="center">
  :star2: Join our Community on  <a href="https://discord.com/invite/Nv6hSzXruK">Discord</a> :star2:
  </h3>

  <br />



  <p align="center">
  <strong>
  <a href="https://www.axemsolutions.io/dem_doc/index.html">Documentation</a> • <a href="https://www.axemsolutions.io/tutorial/index.html">Tutorial</a> •
  <a href="https://github.com/axem-solutions/.github/blob/4bdc1be72b0a2c97da19408c59d6dd5d1845a469/CONTRIBUTING.md">Contribution Guide</a> •
  <a href="https://github.com/axem-solutions/.github/blob/4bdc1be72b0a2c97da19408c59d6dd5d1845a469/SUPPORT.md">Support</a>
  </strong>
  </p>

  **DEM** is a command-line tool that provides an easy, reproducible, and scalable way to set up
  multi-container-based Development Environments (DevEnvs for short) for software development.

  > DEM is currently in alpha state, so expect major changes in the future!

  <p align="center">
  Contributors and early adopters are welcome!
  </p>



  - Create scalable, reliable, and reproducible containerized Development Environments where each tool
  is isolated in its own container.
  - Install preconfigured Development Environments from catalogs.
  - Ensure that everyone on your team works with the same toolset.


  Unlike other container-based development environments that pack all tools into a single image
  requiring users to enter the container via an interactive shell, DEM creates a separate container
  for each tool. This allows you to work on your host system with your usual setup while the
  development-specific tools are isolated in containers.



  Linux and Windows are supported.

  :information_source: macOS is not yet officially supported. However, if all prerequisites are met,
  DEM should work on macOS as well.

  DEM depends on Python and Docker. Ensure you have the following versions:

  - Python 3.10+
  - Docker Engine 24.0+



  First, install Python and Docker if you haven't already:

  - [Python](https://www.python.org/downloads/)
  - [Docker](https://docs.docker.com/get-docker/)

  Make sure to include **pip** during Python installation.

  Install DEM from the PyPI repository using:

      pip install axem-dem

  - The package name is 'axem-dem', but the command is `dem`.
  - Ensure the Docker daemon is running before using DEM.



  Enable autocompletion for PowerShell, Bash, and Zsh shells:

      dem --install-completion

  If the command doesn't work, specify your shell type as an input parameter (powershell, bash, or zsh).

  > **Note for Zsh users:** `compinit` must be called from your .zshrc.



  We got you covered in all scenarios!



  DEM comes with a few templates available from the `axem` catalog. List them with:

      dem list --cat axem

  Clone the selected template:

      dem clone DEV_ENV_NAME

  Replace DEV_ENV_NAME with the name of the Development Environment you want to clone.



  Enter the project's root directory and initialize the DevEnv:

      dem init



  Import a DevEnv descriptor JSON:

      dem import PATH_TO_DEV_ENV

  where PATH_TO_DEV_ENV is the path to the JSON file.



  Create a new DevEnv:

      dem create DEV_ENV_NAME

  Customize your DevEnv:
  - Add or remove tools.
  - Change the tool image for a given tool.

  You can edit the DevEnv with:

      dem modify DEV_ENV_NAME

  Finally, if you are ready to use the Development Environment, install it with:

      dem install DEV_ENV_NAME

  >For more detailed instructions please refer to the
  [Documentation](https://www.axemsolutions.io/dem_doc/index.html)


  A Development Environment (DevEnv) is a set of software tools used for a specific development
  project (e.g., build system, debugger, test framework).

  The idea is to pack the tools separately into container images, which are then can be stored in
  registries.

  Each DevEnv has a descriptor, like a blueprint, indicating which tools are required.

  ![DevEnv descriptor](/docs/wp-content/dev_env_descriptor.png)

  Sample descriptors can be stored in the Development Environment **Catalogs**. You can browse these
  catalogs and download a copy of the Development Environment descriptor to your local catalog.

  ![Catalogs](/docs/wp-content/dem_catalogs.png)

  A DevEnv can be installed from your local catalog.

  ![DevEnv installation](/docs/wp-content/dev_env_installation.png)


pkgId: ad0f55ba754816585c729ee49595757fc0788633a09167479dba3a194a07d690
name: python-axie-utils
arch: src
version: 2.1.3
epoch: 0
release: 1
summary: Library that provides the functionality you need to build your own axie Infinity python tools
url: https://ferranmarin.github.io/axie-utils-lib/
rpm_license: GNU LGPLv3
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axie-utils-2.1.3-1.src.rpm
checksum_type: sha256
description:
  Aim of this library is to contain all the actions one might want to do when building tools around the Axie Infinity videogame. It started with me building an automation tool and needing to build different solutions. Extracting this functionality allows for that easily.

  **NOTE: Only v1 of this library uses free tx, from v2 and onwards all transactions consume RON. That is due to now free tx being much more rare to have available.**




  Install and update using pip:

  ```
  pip install -U axie-utils
  ```



  This example would send 100 SLP from `ronin:from_where_to_send_SLP` to `ronin:to_where_we_send_SLP`.

  ``` python
  from axie_utils import Payment

  p = Payment(
      "Testing Account",
      "ronin:from_where_to_send_SLP",
      "0x:private_key_from_the_from_acc",
      "ronin:to_where_we_send_SLP",
      100)

  p.execute()
  ```

  This example, shows how we would claim SLP from an account.

  ``` python
  from axie_utils import Claim

  c = Claim(
      "Testing Account",
      "ronin:acc_to_claim",
      "0x:private_key_from_acc_to_claim"
  )
  c.execute()

  ```



  For furhter documentation, please visit this [link](https://ferranmarin.github.io/axie-utils-lib/).


pkgId: af65db7a8641a84444c353b22b99305f470835694a397059ff4d63a82e8524e3
name: python-axio2zarr
arch: src
version: 0.2.6
epoch: 0
release: 1
summary: AXIOSCAN to Zarr conversion
url: https://gitlab.developers.cam.ac.uk/astronomy/camcead/imaxt/axio2zarr
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axio2zarr-0.2.6-1.src.rpm
checksum_type: sha256
description:
  Convert AXIOSCAN dataset to Zarr.

  NOTE: only those AXIOSCAN datasets with SCMYX dimensions where S=1 are supported at the moment.



  ```
  pip install axio2zarr
  ```



  * aicspylibczi
  * click
  * dask
  * numpy
  * xarray
  * zarray




  ```
  from axio2zarr import axio2zarr

  axio2zarr(input_path, output_path)
  ```



  ```
  axio2zarr input_path output_path


pkgId: 229953719ddf74d2595484259820a3eb4850b4be9cb73f0646536d29d66456ac
name: python-axiom-py
arch: src
version: 0.8.1
epoch: 0
release: 1
summary: Official bindings for the Axiom API
url: https://axiom.co
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axiom-py-0.8.1-1.src.rpm
checksum_type: sha256
description:
  <a href="https://axiom.co">
  <picture>
    <source media="(prefers-color-scheme: dark) and (min-width: 600px)" srcset="https://axiom.co/assets/github/axiom-github-banner-light-vertical.svg">
    <source media="(prefers-color-scheme: light) and (min-width: 600px)" srcset="https://axiom.co/assets/github/axiom-github-banner-dark-vertical.svg">
    <source media="(prefers-color-scheme: dark) and (max-width: 599px)" srcset="https://axiom.co/assets/github/axiom-github-banner-light-horizontal.svg">
    <img alt="Axiom.co banner" src="https://axiom.co/assets/github/axiom-github-banner-dark-horizontal.svg" align="right">
  </picture>
  </a>
  &nbsp;

  [![CI][ci_badge]][ci]
  [![PyPI version][pypi_badge]][pypi]
  [![Python version][version_badge]][pypi]

  [Axiom](https://axiom.co) unlocks observability at any scale.

  - **Ingest with ease, store without limits:** Axiom’s next-generation datastore enables ingesting petabytes of data with ultimate efficiency. Ship logs from Kubernetes, AWS, Azure, Google Cloud, DigitalOcean, Nomad, and others.
  - **Query everything, all the time:** Whether DevOps, SecOps, or EverythingOps, query all your data no matter its age. No provisioning, no moving data from cold/archive to “hot”, and no worrying about slow queries. All your data, all. the. time.
  - **Powerful dashboards, for continuous observability:** Build dashboards to collect related queries and present information that’s quick and easy to digest for you and your team. Dashboards can be kept private or shared with others, and are the perfect way to bring together data from different sources

  For more information check out the [official documentation](https://axiom.co/docs)
  and our
  [community Discord](https://axiom.co/discord).



  Install using `pip`:

  ```bash

  python3 -m pip install axiom-py


  py -m pip install axiom-py
  ```

  Alternatively, if you have the [`pip`](https://pip.pypa.io/) package installed, you can install `axiom-py` with the following command:

  ```bash
  pip3 install axiom-py
  ```

  If you use the [Axiom CLI](https://github.com/axiomhq/cli), run `eval $(axiom config export -f)` to configure your environment variables.

  Otherwise create a personal token in [the Axiom settings](https://cloud.axiom.co/profile) and export it as `AXIOM_TOKEN`. Set `AXIOM_ORG_ID` to the organization ID from the settings page of the organization you want to access.

  You can also configure the client using options passed to the client constructor:

  ```py
  import axiom_py

  client = axiom_py.Client("<api token>", "<org id>")
  ```

  Create and use a client like this:

  ```py
  import axiom_py
  import rfc3339
  from datetime import datetime,timedelta

  client = axiom_py.Client()

  client.ingest_events(
      dataset="my-dataset",
      events=[
          {"foo": "bar"},
          {"bar": "baz"},
      ])
  client.query(r"['my-dataset'] | where foo == 'bar' | limit 100")
  ```

  For more examples, see [`examples/client.py`](examples/client_example.py).



  You can use the `AxiomHandler` to send logs from the `logging` module to Axiom
  like this:

  ```python
  import axiom_py
  from axiom_py.logging import AxiomHandler
  import logging


  def setup_logger():
      client = axiom_py.Client()
      handler = AxiomHandler(client, "my-dataset")
      logging.getLogger().addHandler(handler)
  ```

  For a full example, see [`examples/logger.py`](examples/logger_example.py).

  If you use [structlog](https://github.com/hynek/structlog), you can set up the
  `AxiomProcessor` like this:

  ```python
  from axiom_py import Client
  from axiom_py.structlog import AxiomProcessor


  def setup_logger():
      client = Client()

      structlog.configure(
          processors=[
              
              structlog.processors.add_log_level,
              structlog.processors.TimeStamper(fmt="iso", key="_time"),
              AxiomProcessor(client, "my-dataset"),
              
          ]
      )
  ```

  For a full example, see [`examples/structlog.py`](examples/structlog_example.py).



  This project uses [uv](https://docs.astral.sh/uv) for dependency management
  and packaging, so make sure that this is installed.

  To lint and format files before commit, run `uvx pre-commit install`.



  Distributed under MIT License (`The MIT License`).

  <!-- Badges -->

  [ci]: https://github.com/axiomhq/axiom-py/actions/workflows/ci.yml
  [ci_badge]: https://img.shields.io/github/actions/workflow/status/axiomhq/axiom-py/ci.yml?branch=main&ghcache=unused
  [pypi]: https://pypi.org/project/axiom-py/
  [pypi_badge]: https://img.shields.io/pypi/v/axiom-py.svg
  [version_badge]: https://img.shields.io/pypi/pyversions/axiom-py.svg

rpm_license:
  MIT License  Copyright (c) 2021 Axiom, Inc.  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: ae33c62b9f8e899108c65897fe0d57a29058156d83ee6d4005182c0a16c84920
name: python-axiomatic
arch: src
version: 0.0.4
epoch: 0
release: 1
summary: please add a summary manually as the author left a blank one
url: https://pypi.org/project/axiomatic/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axiomatic-0.0.4-1.src.rpm
checksum_type: sha256
description:
  [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Faxiomatic-ai%2Faxiomatic-python-sdk)
  [![pypi](https://img.shields.io/pypi/v/axiomatic)](https://pypi.python.org/pypi/axiomatic)

  The Axiomatic Python library provides convenient access to the Axiomatic API from Python.



  ```sh
  pip install axiomatic
  ```



  A full reference for this library is available [here](./reference.md).



  Instantiate and use the client with the following:

  ```python
  from axiomatic import Axiomatic

  client = Axiomatic(
      api_key="YOUR_API_KEY",
  )
  client.pic.extract()
  ```



  The SDK also exports an `async` client so that you can make non-blocking calls to our API.

  ```python
  import asyncio

  from axiomatic import AsyncAxiomatic

  client = AsyncAxiomatic(
      api_key="YOUR_API_KEY",
  )


  async def main() -> None:
      await client.pic.extract()


  asyncio.run(main())
  ```



  When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
  will be thrown.

  ```python
  from axiomatic.core.api_error import ApiError

  try:
      client.pic.extract(...)
  except ApiError as e:
      print(e.status_code)
      print(e.body)
  ```





  The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
  as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
  retry limit (default: 2).

  A request is deemed retriable when any of the following HTTP status codes is returned:

  - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
  - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
  - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)

  Use the `max_retries` request option to configure this behavior.

  ```python
  client.pic.extract(..., request_options={
          "max_retries": 1
      })
      ```



  The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.

  ```python

      from axiomatic import Axiomatic

  client = Axiomatic(
      ...,
      timeout=20.0,
  )


      
      client.pic.extract(..., request_options={
          "timeout_in_seconds": 1
      })
      ```



  You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
  and transports.
  ```python
  import httpx
  from axiomatic import Axiomatic

  client = Axiomatic(
      ...,
      httpx_client=httpx.Client(
          proxies="http://my.test.proxy.example.com",
          transport=httpx.HTTPTransport(local_address="0.0.0.0"),
      ),
  )
  ```



  While we value open-source contributions to this SDK, this library is generated programmatically.
  Additions made directly to this library would have to be moved over to our generation code,
  otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
  a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
  an issue first to discuss with us!

  On the other hand, contributions to the README are always very welcome!


pkgId: c6b13e91307c8786f17c43cbcee6e0b4057e69641649e1087ff27af2d9e7fe38
name: python-axios
arch: src
version: 0.4.0
epoch: 0
release: 1
summary: Command line utility to access https://family.axioscloud.it
url: https://github.com/zmoog/axios
rpm_license: Apache License, Version 2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axios-0.4.0-1.src.rpm
checksum_type: sha256
description:
  Python library and CLI to access the school electronic register from Axios

  [![PyPI](https://img.shields.io/pypi/v/axios.svg)](https://pypi.org/project/axios/)
  [![Changelog](https://img.shields.io/github/v/release/zmoog/axios?include_prereleases&label=changelog)](https://github.com/zmoog/axios/releases)
  [![Tests](https://github.com/zmoog/axios/workflows/Test/badge.svg)](https://github.com/zmoog/axios/actions?query=workflow%3ATest)
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/zmoog/axios/blob/master/LICENSE)

  Command line utility to access https://family.axioscloud.it



  Install this tool using `pip`:

      pip install axios



  First, set the environment variables:

      export AXIOS_CUSTOMER_ID="12345678909"
      export AXIOS_USERNAME="1234"
      export AXIOS_PASSWORD="a-secret-i-will-not-share"
      export AXIOS_STUDENT_ID="4567"

  To list latest grades, run:

      $ axios grades list
                                                                                              Grades

        Data         Materia                      Tipo      Voto   Obiettivi   Commento                                                                                Docente
       ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
        2022-12-06   TECNOLOGIA e INFORMATICA     Scritto   7.5                                                                                                        Pavarin Maria Luisa
        2022-12-02   MATEMATICA                   Scritto   7,75               Verifica sugli insiemi                                                                  Micela Silvia
        2022-12-01   ARTE E IMMAGINE              Grafico   10                 Tav.3 figura e sfondo                                                                   Pagliarulo Veronica
        2022-12-01   ARTE E IMMAGINE              Grafico   7/8                Tav.1 Punto e linea                                                                     Pagliarulo Veronica
        2022-11-30   MUSICA                       Orale     7                  Verifica di carattere teorico. Interrogazione su tutto il programma svolto finora.      Cataldo Francesco
        2022-11-24   ITALIANO                     Scritto   8.5                Fonologia e ortografia                                                                  Rapalino Lara
        2022-11-23   TECNOLOGIA e INFORMATICA     Grafico   6.5                                                                                                        Pavarin Maria Luisa
        2022-11-23   MUSICA                       Orale     7,5                Verifica di carattere teorico. Interrogazione su tutto il programma svolto finora.      Cataldo Francesco
        2022-11-18   MATEMATICA                   Grafico   8,5                Verifica sulle equivalenze e le operazioni con le misure del tempo                      Micela Silvia
        2022-11-16   TECNOLOGIA e INFORMATICA     Grafico   7                                                                                                          Pavarin Maria Luisa
        2022-11-10   ARTE E IMMAGINE              Grafico   8                  Poster per la pace                                                                      Pagliarulo Veronica
        2022-11-09   LINGUA STRANIERA INGLESE     Scritto   8,5                Test units 1 e 2                                                                        Barbero Daniela

  Defaults to current year and period.

  To select a different year or period, run:

      
      axios --period FT02 grades list

      
      axios --year 2021 grades list

      
      axios --year 2021 --period FT01

  To format the output in JSON or NDJSON, run:

      $ axios --output-format json grades list
      [
          {
              "date": "2023-03-23",
              "subject": "ARTE E IMMAGINE",
              "kind": "Grafico",
              "value": "9",
              "teacher": "Pagliarulo Veronica",
              "comment": "Concorso LAV"
          },
          {
              "date": "2023-03-20",
              "subject": "STORIA",
              "kind": "Orale",
              "value": "10",
              "teacher": "Novelli Cristina",
              "comment": ""
          }
      ]

      $ axios --output-format ndjson grades list
      {"date": "2023-03-23", "subject": "ARTE E IMMAGINE", "kind": "Grafico", "value": "9", "teacher": "Pagliarulo Veronica", "comment": "Concorso LAV"}
      {"date": "2023-03-20", "subject": "STORIA", "kind": "Orale", "value": "10", "teacher": "Novelli Cristina", "comment": ""}

  For help, run:

      axios --help

  You can also use:

      python -m axios --help



  To contribute to this tool, first checkout the code. Then create a new virtual environment:

      cd axios
      python -m venv venv
      source venv/bin/activate

  Now install the dependencies and test dependencies:

      pip install -e '.[test]'

  To run the tests:

      pytest


pkgId: 87ab0a60495fcb49771edd7689d8265a6829ef82534a8fe9059ae8feb6cad8f7
name: python-axisregistry
arch: src
version: 0.4.11
epoch: 0
release: 1
summary: A python API to access data from the Google Fonts variable fonts axis registry.
url: https://github.com/googlefonts/axisregistry/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axisregistry-0.4.11-1.src.rpm
checksum_type: sha256
description:
  This repository is the official **upstream** Google Fonts **Axis Registry.**

  This data-set is synced into the central [github.com/google/fonts](https://github.com/google/fonts) git repo, through which all Google Fonts assets are onboarded.

  The **actual** Axis Registry lives within the actual live Google Fonts product, surfaced at [fonts.google.com/variablefonts#axis-definitions](https://fonts.google.com/variablefonts#axis-definitions) – so axis definitions are only final when they appear on that page, and this repository will from time to time contain fresh data not in the live system, and subject to change.



  This repo is structured as a Python package/module, providing easy access to the registry data-set from Python programs.

  The Python package contains a collection of metadata source files that collectively form the Google Fonts Axis Registry.

  This module is the central place for dataset updates.
  After updates are made here on the `main` branch, the maintainers of the central repo will update subtree located at `google/fonts/axisregistry` and then work to push those changes through to the live Google Fonts API via sandbox servers, according to the typical push process.
  For more detailed information, please see the [Axis Registry](https://googlefonts.github.io/gf-guide/googlefonts.html#axis-registry) section of the _`google/fonts` repository explained_ article in the GF Guide.

  <!--


  Font projects that need to introduce a new axis to Google Fonts must follow the [Axis Registry Protocol](https://googlefonts.github.io/gf-guide/axis-registry.html) article in the GF Guide.
  -->



  *   `tag`
      *   Tag for the axis used to specify an axis in `font-variation-settings` and CSS API requests.
  *   `display_name`
      *   Readable name for the axis, generally the expanded form of `tag`.
  *   `min_value`
      *   Lower bound of the axis. Inclusive.
  *   `max_value`
      *   Upper bound of the axis. Inclusive.
  *   `default_value`
      *   Default position of the aixs.
  *   `precision`
      *   Describes the specificity at which an axis position can be specified.
          For example, `0` means values must be specified as whole numbers while `-1` means values can be as precise as one decimal place.
  *   `fallback`
      *   Instance positions along the axis, such as wght 100,200,300,400,500,600,700,800,900.
      *   A cross-product of fallback positions along all supported axes is created to support legacy browsers that lack variable font support.
          For axes with CSS3 properties (such as [font-weight](https://drafts.csswg.org/css-fonts-3/#font-weight-prop)), the positions accessible
          to CSS3 should be specified. For axes lacking CSS3 properties a legacy browser is limited to a single position and that position must
          be at a fallback.
          <br>In case an axis doesn't include predefined positions, it is mandatory to define at least one fallback position. It should be called `Default` and its value should correspond to the `default_value` position of the axis.
  *   `fallback_only`
      *   Describes whether to only use fallback values when presenting to users in the UI. Currently, default to `true`, for continuous range axes should be set to `false.`
  *   `description`
      *   A description of the axis.



  We support a superset of the [OpenType axis registry](https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg) axis set, and use additional metadata for each axis.
  Axes present in a font file but not in this registry will not function via our API.
  No variable font is expected to support all of the axes here.

  Any font foundry or distributor library that offers variable fonts has a implicit, latent, de-facto axis registry, which can be extracted by scanning the library for axes' tags, labels, and min/def/max values.
  While in 2016 Microsoft originally offered to include more axes in the OpenType 1.8 specification ([github.com/microsoft/OpenTypeDesignVariationAxisTags](https://github.com/microsoft/OpenTypeDesignVariationAxisTags)), by August 2020 this effort had stalled.
  We hope more foundries and distributors will publish documents like this that make their axes explicit, to encourage of adoption of variable fonts throughout the industry, and provide source material for a future update to the OpenType specification's axis registry.


pkgId: 80ba1494fe56e2b1a0f1ecce4959851c0c257dba56f2a5eecc306a24fa965796
name: python-axisvm
arch: src
version: 1.2.2
epoch: 0
release: 1
summary: A Python package for AxisVM.
url: https://github.com/AxisVM/pyaxisvm
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axisvm-1.2.2-1.src.rpm
checksum_type: sha256
description:
  ![alt text](https://github.com/AxisVM/DynamoToAxisVM/blob/master/Documentation/images/AxisVM%20logo.bmp)

  <table>
      <tr>
          <td>Latest Release</td>
          <td>
              <a href="https://pypi.org/project/axisvm/"/>
              <img src="https://badge.fury.io/py/axisvm.svg"/>
          </td>
      </tr>
      <tr>
          <td>License</td>
          <td>
              <a href="https://opensource.org/licenses/MIT"/>
              <img src="https://img.shields.io/badge/License-MIT-yellow.svg"/>
          </td>
      </tr>
  </table>



  The **PyAxisVM** project offers a high-level interface to **AxisVM**, making its operations available directly from Python. It builds on top of Microsoft's COM technology and supports all the features of the original **AxisVM** COM type library, making you able to

  * build, manipulate and analyse **AxisVM** models

  * find better solutions with iterative methods

  * combine the power of **AxisVM** with third-party Python libraries

  * build extension modules

  On top of that, **PyAxisVM** enhances the type library with Python's slicing mechanism, context management and more, that enables writing clean, concise, and readable code.



  This is optional, but we suggest you to create a dedicated virtual enviroment at all times to avoid conflicts with your other projects. Create a folder, open a command shell in that folder and use the following command

  ```console
  >>> python -m venv venv_name
  ```

  Once the enviroment is created, activate it via typing

  ```console
  >>> .\venv_name\Scripts\activate
  ```

  The **AxisVM** python package can be installed (either in a virtual enviroment or globally) from PyPI using `pip` on Python >= 3.7 <= 3.10:

  ```console
  >>> pip install axisvm
  ```

  or chechkout with the following command over HTTPS via <https://github.com/AxisVM/pyaxisvm.git> or by using the GitHub CLI

  ```console
  gh repo clone AxisVM/pyaxisvm
  ```

  and install from source by typing

  ```console
  >>> pip install .
  ```

  If you want to run the tests, you can install the package along with the necessary optional dependencies like this

  ```console
  >>> pip install ".[test]"
  ```



  If you are a developer and want to install the library in development mode, the suggested way is by using this command:

  ```console
  >>> pip install "-e .[test, dev]"
  ```

  If you plan to touch the docs, you can install the requirements for that as well:

  ```console
  >>> pip install "-e .[test, dev, docs]"
  ```



  The ***AxisVM API Reference Guide*** is available in pdf format,  you can download it [***here***](https://axisvm.eu/axisvm-downloads/#application).

  The documentation of this library is available [***here***](https://axisvm.github.io/pyaxisvm-docs/).

  Please feel free to post issues and other questions at **PyAxisVM** Issues. This is the best place to post questions and code related to issues with this project. If you are not familiar with GitHub, you can also reach out to us through the usual channels, but if you are, GitHub is preferred.



  You will need a local licenced copy of **AxisVM** version >= 13r2. To get a copy of **AxisVM**, please visit our [***homepage***](https://axisvm.eu/).



  **PyAxisVM** is licensed under the [MIT license](https://opensource.org/license/mit/).

  This module, **PyAxisVM** makes no commercial claim over AxisVM whatsoever. This tool extends the functionality of **AxisVM** by adding a Python interface to the **AxisVM** COM service without changing the core behavior or license of the original software. The use of **PyAxisVM** requires a legally licensed local copy of **AxisVM**.

rpm_license:
  MIT License  Copyright (c) 2021 AxisVM - InterCAD  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: 735d441b2e4d69e83ebdda0af960712a5479f9b1585a80db78692783a7d1f2a8
name: python-axolotl
arch: src
version: 0.5.1.post1
epoch: 0
release: 1
summary: LLM Trainer
url: https://pypi.org/project/axolotl/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axolotl-0.5.1.post1-1.src.rpm
checksum_type: sha256
description:
  Axolotl is a tool designed to streamline the fine-tuning of various AI models, offering support for multiple configurations and architectures.


pkgId: 7477802c9c55e8beafb6b951b90b5e0ccd9b3feec1df09c993c352d34eb41f80
name: python-axolpy-lib
arch: src
version: 1.4.10
epoch: 0
release: 1
summary: Axolotl Library in Python
url: https://pypi.org/project/axolpy-lib/
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axolpy-lib-1.4.10-1.src.rpm
checksum_type: sha256
description:
  1. [axolpy-script](https://github.com/tchiunam/axolpy-script) for using Axolpy scripts

  [![FOSSA Status](https://app.fossa.com/api/projects/custom%2B32310%2Fgithub.com%2Ftchiunam%2Faxolpy-lib.svg?type=large)](https://app.fossa.com/projects/custom%2B32310%2Fgithub.com%2Ftchiunam%2Faxolpy-lib?ref=badge_large)

rpm_license:
  MIT License Copyright (c) 2022 tchiunam 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: ac40db28352d24d773d180ac494a5263197d42b9474d3572af82b116a40496d6
name: python-axon-pypi
arch: src
version: 1.0.3
epoch: 0
release: 1
url: https://pypi.org/project/axon-pypi/
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axon-pypi-1.0.3-1.src.rpm
checksum_type: sha256
summary:
  Multi-dimensional array creation & manipulation library like numpy written from scratch in Python along with a scalar level autograd engine written in C/C++ with Python wrapper

description:
  ![axonlogo.png](https://github.com/shivendrra/axon/blob/main/logo.png)

  **Axon:** is a lightweight Python library for creating and manipulating multi-dimensional arrays, inspired by libraries such as NumPy. It's written in python only, for now.

  **Axon.micro:** You have seen [Micrograd](https://github.com/karpathy/micrograd) by Karpathy, this is the upgraded version of micrograd written in c/c++ & has more functions & operational support. A light weight scalar-level autograd engine written in c/c++ & python



  - Element-wise operations (addition, multiplication, etc.)
  - Matrix multiplication
  - Broadcasting
  - Activation functions (ReLU, tanh, sigmoid, GELU)
  - Reshape, transpose, flatten
  - Data type conversion
  - Micrograd support(Scalar level autograd engine)



  Clone the repository:

  ```bash
  git clone https://github.com/shivendrra/axon.git
  cd axon
  ```

  or

  Install via pip:

  ```bash
  pip install axon-pypi
  ```



  You can use this similar to micrograd to build a simple neural network or do scalar level backprop.




  ```python
  import axon
  from axon import array


  a = array([[1, 2], [3, 4]], dtype=axon.int32)
  b = array([[5, 6], [7, 8]], dtype=axon.int32)


  c = a + b
  print("Addition:\n", c)


  d = a * b
  print("Multiplication:\n", d)


  e = a @ b
  print("Matrix Multiplication:\n", e)
  ```



  ```
  Addition:
   array([6, 8], [10, 12], dtype=int32)
  Multiplication:
   array([5, 12], [21, 32], dtype=int32)
  Matrix Multiplication:
   array([19, 22], [43, 50], dtype=int32)
  ```

  anyway, prefer documentation for detailed usage guide:

  1. [axon.md](https://github.com/shivendrra/axon/blob/main/docs/axon.md): for development purpose
  2. [usage.md](https://github.com/shivendrra/axon/blob/main/docs/usage.md): for using it like numpy
  3. [axon_micro.md]((https://github.com/shivendrra/axon/blob/main/docs/axon_micro.md)): for axon.micro i.e. scalar autograd engine


  ```python

  from axon.micro import scalar

  a = scalar(2)
  b = scalar(3)

  c = a + b
  d = a * b
  e = c.relu()
  f = d ** 2.0

  f.backward()

  print(a)
  print(b)
  print(c)
  print(d)
  print(e)
  print(f)
  ```

  you can even checkout [example](https://github.com/shivendrra/axon/tree/main/examples) neural networks to run them on your system, or build your own :-D.



  If you would like to contribute to this project, you can start by forking the repository:

  1. Click the "Fork" button at the top right of this page.
  2. Clone your forked repository to your local machine:

  ```bash
  git clone https://github.com/shivendrra/axon.git
  ```

  3. Create a new branch:

  ```bash
  git checkout -b my-feature-branch
  ```

  4. Make your changes.
  5. Commit and push your changes:

  ```bash
  git add .
  git commit -m "Add my feature"
  git push origin my-feature-branch
  ```

  6. Create a pull request on the original repository.



  To run the unit tests you will have to install PyTorch & Numpy, which the tests use as a reference for verifying the correctness of the calculated gradients & calculated values. Then simply run each file according to your prefrence:

  ```shell
  python -m tests/test_array.py # for testing the axon functions with numpy
  python -m tests/test_micro.py # for testing the axon.micro functions with pytorch
  ```



  We welcome contributions! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes.
  4. Ensure all tests pass.
  5. Submit a pull request with a clear description of your changes.



  This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.


pkgId: 8c3d77c96772b5f1378001bdefeb5139f15892e0e209f50accf68557fc600d27
name: python-axon-synthesis
arch: src
version: 0.1.8
epoch: 0
release: 1
summary: A package to synthesize artificial axons
url: https://axon-synthesis.readthedocs.io
rpm_license: Apache License 2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axon-synthesis-0.1.8-1.src.rpm
checksum_type: sha256
description:
  A package to synthesize artificial axons.

  The main documentation, is available here: [https://axon-synthesis.readthedocs.io](https://axon-synthesis.readthedocs.io)




  It is recommended to install ``axon-synthesis`` using [pip](https://pip.pypa.io/en/stable/):

  ```bash
  pip install axon-synthesis
  ```




  An example can be found in the ``examples`` directory.
  This example contains a small input dataset and a ``run.sh`` script that will execute the code.
  The inputs can be reviewed and modified for testing.




  When you use the ``axon-synthesis`` software or method for your research, we ask you to cite the
  publication associated to this repository (use the ``Cite this repository`` button on the
  [main page](https://github.com/BlueBrain/axon-synthesis) of the code).




  The development of this software was supported by funding to the Blue Brain Project, a research
  center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government’s ETH
  Board of the Swiss Federal Institutes of Technology.

  For license and authors, see `LICENSE.txt` and `AUTHORS.md` respectively.

  Copyright © 2023-2024 Blue Brain Project, EPFL


pkgId: da02ee2ad47d2285026b0838ecf1e66078c52dd9c30b8a8f8128412c66f7845c
name: python-axosyslog-cfg-helper
arch: src
version: 1.10.5
epoch: 0
release: 1
summary: Configuration helper for axosyslog.
url: https://github.com/alltilla/axosyslog-cfg-helper
rpm_license: GPL-3.0-only
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axosyslog-cfg-helper-1.10.5-1.src.rpm
checksum_type: sha256
description:
  This tool makes configuring [AxoSyslog](https://github.com/axoflow/axosyslog) a bit easier by listing the options of each available driver.

  The options are generated from [AxoSyslog v4.8.0](https://github.com/axoflow/axosyslog/releases/tag/axosyslog-4.8.0).




  ```
  pipx install axosyslog-cfg-helper
  ```


  ```
  docker pull ghcr.io/alltilla/axosyslog-cfg-helper
  ```


  ```
  axosyslog-cfg-helper
  ```


  ```
  axosyslog-cfg-helper --context parser
  ```


  ```
  axosyslog-cfg-helper --context parser --driver csv-parser
  ```


  [![Example](https://raw.githubusercontent.com/alltilla/axosyslog-cfg-helper/assets/example.gif)](https://raw.githubusercontent.com/alltilla/axosyslog-cfg-helper/assets/example.gif)


  The tool is still in development, but most of the drivers are supported.

  Missing features are:
    * Proper `rewrite` support.
    * Proper `filter` support.
    * Drivers defined in `SCL`s.
    * Drivers defined with confgen.

  Any contribution is welcome :)


  The project uses [poetry](https://python-poetry.org/) as a dependency management system.

  Building of the option database needs the [neologism](https://github.com/alltilla/neologism) pip package, which gets installed by poetry, however it has another dependency, which is [bison](https://www.gnu.org/software/bison/). Make sure to install bison (at least 3.7.6) on you system if you wan't to develop locally. `make bison` can help with that.

  The [Makefile](https://github.com/alltilla/axosyslog-cfg-helper/blob/master/Makefile) consists of some useful commands:
    * `make venv` prepares the venv.
    * `make bison` downloads bison 3.7.6, builds it and installs it under `/usr/local`.
      * You can change the install path with `make bison BISON_INSTALL_PATH=...`
    * `make check` runs the unit tests, style-checkers and linters.
    * `make format` formats the code.
    * `make db` downloads the axosyslog release tarball and generates the option database.
    * `make db AXOSYSLOG_SOURCE_DIR=/path/to/axosyslog` creates a tarball from the state of the axosyslog source dir and generates the option database.
    * `make package` creates the pip package.


  You can reach out to the AxoSyslog community on Discord:

  [![Axoflow Discord Server](https://discordapp.com/api/guilds/1082023686028148877/widget.png?style=banner2)](https://discord.gg/E65kP9aZGm)


pkgId: a211149954e3e388d0bb01e4aaa707447a4ee0319da7d0178a217fbd5ed66de6
name: python-axual-client-python
arch: src
version: 1.1.5
epoch: 0
release: 1
summary: Axual client for Python
url: https://pypi.org/project/axual-client-python/
rpm_license: Apache-2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-axual-client-python-1.1.5-1.src.rpm
checksum_type: sha256
description:
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
  [![Pipeline Status](https://gitlab.com/axual/public/axual-client-python/badges/master/pipeline.svg)](https://gitlab.com/axual/public/axual-client-python/commits/master)
  [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=axual-public-axual-client-python&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=axual-public-axual-client-python)
  [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=axual-public-axual-client-python&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=axual-public-axual-client-python)
  Python client library that enables interaction with the Axual platform.
  ![Python Client Overview](http://www.plantuml.com/plantuml/png/VP0zQyCm48Rdw5TSJI6J6-hP14AxT0jqB1s4T8v5zA7ALca8_Uzrpht4zf39kkTz_HpSW_7APerGAnkoDhupXxRV76Lpb5iXrc8DAaI36eotnYEqc12Q51pqBKAqqlVPsGqqmMfCJyCVeadI8HJx57HMc436M83i838uYvKABWQFleTYzvEb1MNDC5rxuoX-MVOIV9VTHAO8t9TnxofZ6xKebjG_YvdarNGgV6CwmMx_HZLz8RFEkshHIKXuC5sVJjJYGQo-CcQ4eduS3qafFP_lP9KGAre4vKThj4R_MMudKdxDOhQENoWPLV-eWlBMkfpWTbseXuGMBY5lMd3MS4niSc1oBI4z5uhg3m00)

  Python 3 is required, Python 3.6 or greater is recommended.

  ```bash
  pip install axual-client-python
  ```

  Tests are located in the `tests/` directory.
  To run all of them:
  ```bash
  python -m unittest discover tests
  ```


  ```python
  import json
  from axualclient.producer import Producer
  conf = {
      
      'application_id': application_id,
      'endpoint': endpoint,
      'tenant': tenant,
      'environment': environment,
      
      'ssl.certificate.location': producer_app_cert,
      'ssl.key.location': producer_app_key,
      'ssl.ca.location': root_cert,
  }
  producer = Producer(conf)
  producer.produce(value=json.dumps(dict(a=1, b='banana')))
  producer.flush()  # Flushes producer before ending (triggering callbacks for delivery reports)
  ```
  See [SSL Configuration](#ssl-configuration) for more info on the certificates required.

  ```python
  from axualclient.consumer import Consumer
  conf = {
      
      'application_id': application_id,
      'endpoint': endpoint,
      'tenant': tenant,
      'environment': environment,
      
      'ssl.certificate.location': producer_app_cert,
      'ssl.key.location': producer_app_key,
      'ssl.ca.location': root_cert,
      
      'auto.offset.reset': 'earliest',
      'on_commit': on_commit_callback,
  }
  consumer = Consumer(conf)
  try:
      
      consumer.subscribe(['your-topic'])
      while True:
          msg = consumer.poll(1.0)
          
          if msg is None:
              continue
          if msg.error():
              
              raise KafkaException(msg.error())
          else:
              
              print(
                  f'Received message on topic {msg.topic()} partition {msg.partition()} '
                  f'offset {msg.offset()} key {msg.key()} value {msg.value()}'
              )
              
              consumer.commit()
  finally:
      if consumer is not None:
          
          consumer.commit()
          consumer.close()
  ```

  Producing AVRO messages works if you have the AVRO schema available that was uploaded to self-service.
  Those schemas need to be provided to the serializer via the `schema_str` as Avro [Schema Declaration](https://avro.apache.org/docs/current/spec.html#schemas>).
  ```python
  from axualclient.avro import AvroSerializer
  from axualclient.serializing_producer import SerializingProducer
  key_serializer = AvroSerializer(schema_str=Application.SCHEMA, to_dict=application_to_dict)
  value_serializer = AvroSerializer(schema_str=ApplicationLogEvent.SCHEMA, to_dict=application_log_event_to_dict)
  conf = {
      
      'application_id': application_id,
      'endpoint': endpoint,
      'tenant': tenant,
      'environment': environment,
      
      'ssl.certificate.location': producer_app_cert,
      'ssl.key.location': producer_app_key,
      'ssl.ca.location': root_cert,
      
      'key.serializer': key_serializer,
      'value.serializer': value_serializer,
      'acks': 'all',
  }
  producer = SerializingProducer(conf)
  producer.produce(topic=topic, value=value, key=key)
  producer.flush() # Flushes producer before ending (triggering callbacks for delivery reports)
  ```

  Consumer `AvroDeserializers` need to be instantiated and passed as configuration to the Axual `DeserializingConsumer` like so:
  ```python
  from axualclient.avro import AvroDeserializer
  from axualclient.deserializing_consumer import DeserializingConsumer

  key_deserializer = AvroDeserializer(
      
      schema_str=Application.SCHEMA,
      from_dict=dict_to_application
  )
  value_deserializer = AvroDeserializer(
      
      schema_str=ApplicationLogEvent.SCHEMA,
      from_dict=dict_to_application_log_event,
  )
  configuration = {
      
      'application_id': application_id,
      'endpoint': endpoint,
      'tenant': tenant,
      'environment': environment,
      
      'ssl.certificate.location': producer_app_cert,
      'ssl.key.location': producer_app_key,
      'ssl.ca.location': root_cert,
      
      'key.deserializer': key_deserializer,
      'value.deserializer': value_deserializer,
      'auto.offset.reset': 'earliest',
      'on_commit': on_commit_callback,
      'error_cb': on_error_callback,
      'logger': logger
  }
  consumer = DeserializingConsumer(configuration)
  try:
      consumer.subscribe([topic])
      while True:
          msg = consumer.poll()
          if msg is None:
              continue
          if msg.error():
              print(f'Error returned by poll: {msg.error()}')
          else:
              print(
                  f'Received message on topic {msg.topic()} partition {msg.partition()} '
                  f'offset {msg.offset()} key: {str(msg.key())} value: {str(msg.value())}'
              )
              consumer.commit()
  except KeyboardInterrupt:
      print('Caught KeyboardInterrupt, stopping.')
  finally:
      if consumer is not None:
          print('Committing final offsets and leaving group.')
          consumer.commit()
          consumer.close()
  ```

  The client configuration requires a correct SSL configuration in order to communicate securely with brokers, the discovery API, and the schema registry.
  Each application (as defined in self-service) requires an application certificate (`ssl.certificate.location`) and corresponding private key (`ssl.key.location`).
  The application certificate must match the one uploaded in self-service for that application.
  The file with root certificates needs to be created properly: the brokers might be using a root certificate authority different
  from the authority that signed the certificates for the discovery API and schema registry.
  The base64-encoded unencrypted versions of these certificates can be pasted into one file (`ssl.ca.location`).
  This file would then look like the following example:


pkgId: 67af81a683ab1863b2d334d64c18a737d81d3a7ffbc5f8744e2cc4d75b69eb23
name: python-ayapingping-py
arch: src
version: 4.6.3
epoch: 0
release: 1
url: https://pypi.org/project/ayapingping-py/
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ayapingping-py-4.6.3-1.src.rpm
checksum_type: sha256
summary:
  ayapingping-py generates standard project structure to build applications in Python that follow Clean Architecture and Feature-Driven Design concept

description:
  ![python](https://img.shields.io/pypi/pyversions/ayapingping-py.svg?style=flat)
  ![version](https://img.shields.io/pypi/v/ayapingping-py.svg?style=flat)
  ![download](https://img.shields.io/pypi/dm/ayapingping-py.svg?style=flat)
  ![dependents](https://img.shields.io/librariesio/dependents/pypi/ayapingping-py.svg?style=flat)

  ![build](https://img.shields.io/circleci/project/github/dalikewara/ayapingping-py.svg?style=flat)
  ![language](https://img.shields.io/github/languages/top/dalikewara/ayapingping-py.svg?style=flat)
  ![issue](https://img.shields.io/github/issues/dalikewara/ayapingping-py.svg?style=flat)
  ![last_commit](https://img.shields.io/github/last-commit/dalikewara/ayapingping-py.svg?style=flat)
  ![github_tag](https://img.shields.io/github/v/tag/dalikewara/ayapingping-py.svg?style=flat)
  ![github_license](https://img.shields.io/github/license/dalikewara/ayapingping-py.svg?style=flat)

  **ayapingping-py** generates standard project structure to build applications in Python that follow Clean
  Architecture and Feature-Driven Design concept.

  > Golang variant: [ayapingping-go](https://github.com/dalikewara/ayapingping-go)

  > TypeScript variant: [ayapingping-ts](https://github.com/dalikewara/ayapingping-ts)



  - Python>=3.10.12
  - Operating systems supporting `/bin/sh` with **POSIX** standards ([WHY?](https://github.com/dalikewara/ayapingping-sh)).
    **Linux** and **macOS** should have no issues here as they support it by default. For **Windows** users, consider using WSL instead





  You can use the `pip install` method:

  ```bash
  pip install ayapingping-py
  ```



  If you're facing a warning or an issue like this, for example:

  ```text
  WARNING: The script ayapingping-py is installed in '/your/path/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  ```

  Then you can install it using the `--user` option, for example:

  ```bash
  pip install --user --force-reinstall ayapingping-py
  ```

  Or if it doesn't work, you can add the directory containing the scripts to your **PATH** manually.
  Open your shell configuration file (e.g., `.bashrc`, `.zshrc`, `.profile`, or similar) and add the following line:

  ```bash
  export PATH=$PATH:/your/path/.local/bin
  ```

  Then, restart your shell or run:

  ```bash
  source ~/.bashrc   # or source ~/.zshrc, ~/.profile or similar
  ```

  This will make the changes take effect immediately.



  To generate a new project, simply run the `ayapingping-py` command:

  ```bash
  ayapingping-py
  ```

  Then enter your project name, the **ayapingping-py** generator will set up the project for you.

  ![Alt Text](https://lh3.googleusercontent.com/drive-viewer/AKGpihZVKfRP1YbgPEilKjEypqE84gyuFpsONb8qqVY2qrnZsAkBo68gqR1UioKlq0G2gW_kCZqFVIPYA7kbRJBrRqb-vl3OnA=w840-h939)

  > The animated example uses the Golang version, but it essentially follows the same approach



  Simply start working on your project and make changes.



  To implement the concept of Clean Architecture and ~~Domain-Driven Design~~ Feature-Driven Design, and to keep them understandable, we structure the project like this:



  - In this file, you initialize dependencies, injections, and anything required to start and run your application
  - You can use the command `venv/bin/python main.py`, `python main.py` or `make start` to run your application



  - The **Domain** represents your primary business model or entity
  - Define your main object models or properties for your business here, including database models, DTOs (Data Transfer Objects), etc
  - Keep this package as straightforward as possible. Avoid including any code that is not directly related to the model itself
  - If a **Feature** imports anything from this location, and you want the **Feature** to be accessible through the `importFeature` or `exportFeature` command
    without the risk of missing package errors, **DON'T FORGET** to include them in the `features/yourFeature/dependency.json` file



  - A **Feature** encapsulates your main business feature, logic, or service
  - Here, you include everything necessary to ensure the proper functioning of the feature
  - Please prioritize **Feature-Driven Design**, ensuring that features can be easily adapted and seamlessly integrated and imported into different projects
  - If another **Feature** imports anything from this location (the current **Feature**), and you want the current **Feature** to be
    accessible through the `importFeature` or `exportFeature` command without the risk of missing package errors, **DON'T FORGET** to include them in the `dependency.json` file
  - The `dependency.json` is **OPTIONAL**, and **ONLY USEFUL WHEN** you use the `importFeature` or `exportFeature` command. It serves to define
    the **Feature** dependencies and avoids possible missing package errors
  - A standard **Feature** comprises the following parts: `delivery`, `repositories`, `usecases` and `utility`
    - **delivery**
      - Hosts feature handlers like HTTP handlers, gRPC handlers, cron jobs, or anything serving between the client and your application or feature
      - For config variables, external clients, or use cases, pass or inject them as dependencies
    - **repositories**
      - Handles communication with external data resources like databases, cloud services, or external services
      - Keep your repositories as simple as possible; avoid adding excessive logic
      - If necessary, separate operations into smaller methods
      - Changes outside the `repositories` should not affect them (except changes for business domain/model/entity)
      - For config variables, database frameworks, or external clients, pass or inject them as dependencies
    - **usecases**
      - Contains the main feature logic
      - Changes outside the `usecases` should not impact them (except changes for business domain/model/entity and repositories)
      - For config variables, external clients, or repositories, pass or inject them as dependencies
    - **utility**
      - Accommodates functions tailored to help with common tasks specifically for the **Feature**—treat them as helpers
  - Feel free to adopt your own style as long as it aligns with the core concept



  - In this place, you can implement various functions to assist you in performing common tasks—consider them as helpers
  - Common functions can be directly called from any location
  - If a **Domain** or **Feature** imports anything from this location, and you want the **Feature** to be accessible through
    the `importFeature` or `exportFeature` command without the risk of missing package errors, **DON'T FORGET** to include
    them in the `features/yourFeature/dependency.json` file



  - This is the location to house infrastructure configurations or scripts to facilitate the deployment of your project on a server or VM



  Feel free to create your own style to suit your requirements, as long as you still follow the main architecture concept.
  You can create folders such as `migration` to store your database migrations, `tmp` for temporary files, etc.



  To seamlessly incorporate or import features from another project, use the `importFeature` command:

  ```bash
  ayapingping-py importFeature [feature_1,feature_2,...] from [/local/project or https://example.com/user/project.git or git@example.com:user/project.git]
  ```

  For example:

  ```bash
  ayapingping-py importFeature example_feature from /path/to/your/project
  ```

  ```bash
  ayapingping-py importFeature example_feature_1,example_feature_2 from git@github.com:username/project.git
  ```



  If your feature relies on external packages, it's crucial to address dependencies properly during the import process.
  Failure to import necessary dependencies may result in missing packages. To prevent this, please document your feature
  dependencies in the `dependency.json` file. Supported dependencies are limited to the following directories: `domain`, `common`, and `features`.
  Ensure that your feature dependencies strictly adhere to these directories, avoiding reliance on other locations.
  You can also include any external packages to `externals` param to install them automatically using the `venv/bin/pip install` or `pip install` method.

  Example `dependency.json` file:

  ```json
  {
    "domains": [
      "domain_1.py",
      "domain_2.py"
    ],
    "features": [
      "feature1",
      "feature2"
    ],
    "commons": [
      "common_function_1.py",
      "common_function_2.py"
    ],
    "externals": [
      "python-dotenv==1.0.1",
      "mysql-connector-python==8.3.0",
      "Flask==3.0.2"
    ]
  }
  ```



  There are several commands similar to `importFeature` above, such as `importDomain`, `importCommon`, `exportFeature`, `exportDomain`, etc.
  They function in the same way, for example:

  ```bash
  ayapingping-py importDomain example.py from /path/to/your/project
  ```

  ```bash
  ayapingping-py importCommon common_function_1.py from https://example.com/user/project.git
  ```

  For `export` command, the behavior is similar to the `import` command, but now uses `export` as the prefix and `to` instead of
  `from` when pointing to the source, for example:

  ```bash
  ayapingping-py exportFeature example_feature to /path/to/your/project
  ```

  For more detail and explanation, please visit [ayapingping-sh](https://github.com/dalikewara/ayapingping-sh)





  Read at [CHANGELOG.md](https://github.com/dalikewara/ayapingping-py/blob/master/CHANGELOG.md)



  Copyright &copy; 2024 [Dali Kewara](https://www.dalikewara.com)



  [MIT License](https://github.com/dalikewara/ayapingping-py/blob/master/LICENSE)


pkgId: 4bc6d5abe13eac554f3dc3156f8a0f72835623e1b397a2eefee3b30301c06bd4
name: python-ayeaye
arch: src
version: 0.1.1
epoch: 0
release: 1
summary: An ETL (Extract, Transform, Load) framework
url: https://github.com/Aye-Aye-Dev/AyeAye
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ayeaye-0.1.1-1.src.rpm
checksum_type: sha256
description:
  An ETL (Extract, Transform, Load) framework.



  In the virtual environment for the project you’d like to use Aye Aye in, run:-

  ```shell
  pip install ayeaye
  ```



  Use [Pipenv](https://pipenv.pypa.io/en/latest/) to manage a python virtual environment and package management0

  ```shell
  pipenv shell
  pipenv install ayeaye
  ```

  Within the environment created by pipenv above, run one of the examples:-

  ```shell
  curl "https://raw.githubusercontent.com/Aye-Aye-Dev/AyeAye/master/examples/poisonous_animals.py" \
    --output poisonous_animals.py
  mkdir data
  curl https://raw.githubusercontent.com/Aye-Aye-Dev/AyeAye/master/examples/data/poisonous_animals.json \
    --output data/poisonous_animals.json
  python poisonous_animals.py
  ```

  This model takes a small input dataset of animals and collates them by the country they are found. It doesn't write to a dataset, it just outputs a log. The log for this example contains the name of the country and the animals found there.

  There are more examples in the [Aye-Aye-Recipes](https://github.com/Aye-Aye-Dev/Aye-Aye-Recipes) git repo.




  An Aye Aye ETL *model* inherits from `ayeaye.model` and uses class level variables to declare *connectors* to the data it acts on.

  Example:-

  ```python
  import ayeaye

  class PoisonousAnimals(ayeaye.Model):
      poisonous_animals = ayeaye.Connect(engine_url='json://data/poisonous_animals.json')
  ```

  When instantiated, `self.poisonous_animals` will be a *dataset* that ETL operations can be done with.

  The `engine_url` parameter passed to `ayeaye.Connect` is specifying the dataset type JSON in this case) and exact location for the data (`data/poisonous_animals.json` is a relative file path).

  Instead of `engine_url` you could also specify a `ref` and this uses the data catalogue to lookup the `engine_url`. (TODO this feature is coming soon!). When used this way, `ayeaye.Connect` is responsible for resolving the `ref` to an `engine_url` and passing this to a subclass of `ayeaye.connectors.base.DataConnector` which can read and maybe write this data type.




  Ensure the working directory is the base Aye Aye directory (i.e. the same directory as the Pipfile):
  ```shell
  pipenv install --dev
  export PYTHONPATH=`pwd`/lib
  pipenv run python -m unittest discover
  ```



  To use the latest code in editable mode-

  ```shell
  pipenv install -e git+https://github.com/Aye-Aye-Dev/AyeAye#egg=ayeaye
  ```

  When `venv` is being used, add this line to `requirements.txt`-

  ```
  git+https://github.com/Aye-Aye-Dev/AyeAye#egg=ayeaye
  ```



  Extra dependencies for API usage within Aye-aye models can be installed like this:

  ```shell
  pipenv install "ayeaye[api]"
   or multiple
  pipenv install "ayeaye[api,aws,compression]"
  ```

  | Label | Functionality |
  | --- | --- |
  | api | Restful JSON via http(s) |
  | aws | File based connectors can use Amazon Web Service S3 file storage |
  | compression | On the fly compression for file based connectors |




  Aye Aye is distributed under the terms of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) and Copyright Progressive Logic Limit 2021 and onwards.


pkgId: eb2ad61d7d1b80095871ea88f448dc6585a4cf4be991d0418e09ee8298f38e40
name: python-ayla-iot-unofficial
arch: src
version: 1.4.2
epoch: 0
release: 1
summary: Python API for Ayla IoT products
url: https://github.com/rewardone/ayla-iot-unofficial
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ayla-iot-unofficial-1.4.2-1.src.rpm
checksum_type: sha256
description:
  An unofficial python library for interacting with the Ayla IoT API.
  Intended to be generic for multi-device use.

  Designed primarily to be a support package for [Home Assistant](https://www.home-assistant.io/) integrations.

  This library is heavily based off of [sharkiq](https://github.com/JeffResc/sharkiq) by [@JeffResc](https://github.com/JeffResc).

  [PyPi](https://pypi.org/project/ayla-iot-unofficial/)


  This device is integrated by/with Ayla Networks and (generally) uses their documentation.

  These can be used as starting references:
  * https://developer.aylanetworks.com/apibrowser
  * https://docs.aylanetworks.com/reference/getting_started
  * https://connection.aylanetworks.com/s/article/2080270


  From PyPi
  ```bash
  pip install ayla-iot-unofficial
  ```

  Build from source
  ```bash
  pip install build
  pip build
  pip install ayla-iot-unofficial
  ```


  Requires typical http interaction and datatype packages like requests, aiohttp, ujson


  Reqiures a username and password (typically a smart device's app login credentials)
  Requires an app_id and app_secret (granted by Ayla to the smart device's app for operation/integration)

  The app_id and app_secret may need to be obtained from proxy traffic or other method.



  Instantiate a new class object through new_ayla_api() or Ayla() directly.

  For devices that may be region specific, the new_ayla_api() function will create an Ayla() object based on the europe boolean.


  Standard use should call sign_in() on the Ayla object after creation. This will perform the POST login request to obtain an access_token.

  Some devices communicate with a different IoT domain but still expose the Ayla access_token. This access token can be passed into the Ayla object using _set_credentials() and the proper arguments.


  By default, calling get_devices() will return a list of class specific device objects with updated properties for use.

  See device.py for implemented device classes.


  ```python
  python3 -m pip install ayla-iot-unofficial
  ```

  ```python
  import ayla_iot_unofficial

  USERNAME = 'me@email.com'
  PASSWORD = '$7r0nkP@s$w0rD'

  ayla_api = new_ayla_api(USERNAME, PASSWORD, APP_ID, APP_SECRET)
  ayla_api.sign_in()

  devices = ayla_api.get_devices()


  shark   = devices[0]

  shark.set_operating_mode(OperatingModes.START)
  shark.return_to_base()


  softener = devices[1]

  softener.capacity_remaining_gallons
  softener.set_vacation_mode()
  ```


  [MIT](https://choosealicense.com/licenses/mit/)


pkgId: d73e098faddcde6d5851173702db9a18d3580078dd71ee2337f73a9fd0acfa74
name: python-aylien-news-api
arch: src
version: 5.2.3
epoch: 0
release: 1
summary: AYLIEN News API
url: https://pypi.org/project/aylien-news-api/
rpm_license: UNKNOWN
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-aylien-news-api-5.2.3-1.src.rpm
checksum_type: sha256
description:
  The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.   # noqa: E501


pkgId: 246b22c029acf6f76c8db08a15acf7ce60bee9d5f1ac567e05778dc621d5b820
name: python-ayon-python-api
arch: src
version: 1.0.10
epoch: 0
release: 1
summary: AYON Python API
url: https://github.com/ynput/ayon-python-api
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ayon-python-api-1.0.10-1.src.rpm
checksum_type: sha256
description:
  The wheel file can be used to install using pip:
      pip install <REPOSITORY ROOT>/dist/ayon_python_api-<VERSION>-py3-none-any
  If pip complain that `ayon-python-api` is already installed just uninstall existing one first:
      pip uninstall ayon-python-api

  - Find more suitable name of `ServerAPI` objects (right now is used `con` or `connection`)
  - Add all available CRUD operation on entities using REST
  - Add folder and task changes to operations
  - Enhance entity hub
    - Missing docstrings in EntityHub -> especially entity arguments are missing
    - Better order of arguments for entity classes
      - Move entity hub to first place
      - Skip those which are invalid for the entity and fake it for base or remove it from base
    - Entity hub should use operations session to do changes
    - Entity hub could also handle 'product', 'version' and 'representation' entities
    - Missing 'status' on folders
    - Missing assignees on tasks
    - Pass docstrings and arguments definitions from `ServerAPI` methods to global functions
  - Split `ServerAPI` into smaller chunks (somehow), the class has 4k+ lines of code
  - Add .pyi stub for ServerAPI
  - Missing websockets connection

rpm_license:
[cell repeats an earlier one in this file: 10254 characters]


pkgId: 54d2c6ef25b6f9f02a77e3a00442ac672b04526f0e518deea8cac550890959a3
name: python-ayoomoney
arch: src
version: 1.2.2
epoch: 0
release: 1
summary: Простая синхронная/асинхронная библиотека для работы с API ЮMoney
url: https://github.com/Demetrous-fd/ayoomoney
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-ayoomoney-1.2.2-1.src.rpm
checksum_type: sha256
description:
  ```shell
  pip install ayoomoney
  ```



  1. Зарегистрируйте новое приложение YooMoney по ссылке https://yoomoney.ru/myservices/new
     - В полях "Адрес сайта" и "Redirect URI" укажите адрес: http://my.localhost:8042
     - Чекбокс "Проверять подлинность приложения (OAuth2 client_secret)" должен быть отключен
  2. Получите и скопируйте `client_id` после создания приложения
  3. [Получение access-токена](https://yoomoney.ru/docs/wallet/using-api/authorization/obtain-access-token)

     Во всех методах используются все доступные разрешения/scope, вы можете указать нужные вам разрешения
     через запятую, используя параметр `--scope`, пример: `--scope account-info,operation-details,operation-history`

     - Автоматическое получение
     ```shell
     python -m ayoomoney.auth auto <client_id> http://my.localhost:8042
     ```

     - Ручное получение
     ```shell
     python -m ayoomoney.auth simple <client_id> http://my.localhost:8042
     ```
     Во время перенаправления по `redirect_uri` в адресной строке появится параметр `code=`.
     Скопируйте значение и вставьте его в консоль

     Если авторизация прошла успешно, в консоли отобразится Ваш access-token.
  4. Сохраните access-token в [переменные окружения](https://habr.com/ru/articles/472674/), не храните токен в коде.



  ```python
  from os import environ

  from ayoomoney.wallet import YooMoneyWalletAsync, YooMoneyWallet
  from ayoomoney.types import AccountInfo


  def sync_example():
      wallet = YooMoneyWallet(access_token=environ.get("ACCESS_TOKEN"))
      account_info: AccountInfo = wallet.account_info()
      print(account_info)

      wallet.close()  # Не забудьте закрыть сессию или используйте менеджер контекста


  async def async_example():
      wallet = YooMoneyWalletAsync(access_token=environ.get("ACCESS_TOKEN"))
      account_info: AccountInfo = await wallet.account_info()
      print(account_info)

      await wallet.close()  # Не забудьте закрыть сессию или используйте менеджер контекста


  if __name__ == "__main__":
      sync_example()

      
      
  ```


  ```python
  from os import environ

  from ayoomoney.wallet import YooMoneyWalletAsync, YooMoneyWallet
  from ayoomoney.types import AccountInfo


  def sync_example():
      with YooMoneyWallet(access_token=environ.get("ACCESS_TOKEN")) as wallet:
          account_info: AccountInfo = wallet.account_info()
          print(account_info)


  async def async_example():
      async with YooMoneyWalletAsync(access_token=environ.get("ACCESS_TOKEN")) as wallet:
          account_info: AccountInfo = await wallet.account_info()
          print(account_info)


  if __name__ == "__main__":
      sync_example()

     
     
  ```



  ```python
  from os import environ

  from ayoomoney.wallet import YooMoneyWalletAsync, PaymentSource


  async def main():
      async with YooMoneyWalletAsync(access_token=environ.get("ACCESS_TOKEN")) as wallet:
          payment_form = await wallet.create_payment_form(
              amount_rub=2,
              unique_label="myproject",
              payment_source=PaymentSource.YOOMONEY_WALLET,
              success_redirect_url="https://www.youtube.com/watch?v=dQw4w9WgXcQ&pp=ygUJcmljayByb2xl"
          )
          
          payment_is_completed: bool = await wallet.check_payment_on_successful(
              payment_form.payment_label
          )

          print(
              f"Ссылка на оплату:\n{payment_form.link_for_customer}\n\n"
              f"Форма оплачена: {'Да' if payment_is_completed else 'Нет'}"
          )


  if __name__ == "__main__":
      import asyncio
      asyncio.run(main())

  ```



  ```python
  from datetime import datetime
  from os import environ

  from ayoomoney.types import OperationHistoryParams, OperationHistoryParamType
  from ayoomoney.wallet import YooMoneyWalletAsync


  async def main():
      async with YooMoneyWalletAsync(access_token=environ.get("ACCESS_TOKEN")) as wallet:
          payments_from = datetime.strptime("15.09.2024", "%d.%m.%Y")
          params = OperationHistoryParams(
              

              from_datetime=payments_from,  # Получение операций после 15.09.2024 00:00
              

              operation_type=["deposition", OperationHistoryParamType.PAYMENT],
              

              records=3,  # limit, Количество операций за один запрос, по умолчанию 30
              start_record=3,  # offset, https://yoomoney.ru/docs/wallet/user-account/operation-history#filtering-logic

              details=True  # Показывать подробные детали операции. types.Operation -> types.OperationDetails
          )
          history = await wallet.get_operation_history(params)
          for operation in history.operations:
              print(type(operation), operation)


  if __name__ == '__main__':
      import asyncio

      asyncio.run(main())


  ```


  В библиотеке реализованы только модели уведомлений, реализовать http-сервера вы должны сами.

  Список моделей:
  - NotificationBase используется для http
  - NotificationExtend используется для https

  Примеры:
  - Простой пример с FastAPI
     ```python
     from typing import Annotated
     from os import environ

     from fastapi import FastAPI, Form, HTTPException
     from ayoomoney.types import NotificationBase

     app = FastAPI()


     @app.post("/notification")
     async def payment_handler(data: Annotated[NotificationBase, Form()]):
         

         is_valid_hash = data.check_sha1_hash(environ.get("YOOMONEY_NOTIFICATION_SECRET"))
         if is_valid_hash is False:
             raise HTTPException(status_code=403)

     ```
  - [Телеграм бот на aiogram](https://github.com/Demetrous-fd/ayoomoney/tree/main/examples/notification)


  Если вы обнаружили ошибку или хотите предложить идею для улучшения проекта, создайте issue.

  Если у вас есть возможность и желание внести улучшения в проект, отправляйте pull request.


pkgId: 7915522218214df8902cc195ad85f7461ef73b69555b5f923f6459b14fb9c827
name: python-az-iranian-bank-gateways
arch: src
version: 2.0.12
epoch: 0
release: 1
summary: Iranian Bank Gateways for django
url: https://github.com/ali-zahedi/az-iranian-bank-gateways
rpm_license: BSD License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-az-iranian-bank-gateways-2.0.12-1.src.rpm
checksum_type: sha256
description:
  <!--![GitHub All Releases](https://img.shields.io/github/downloads/ali-zahedi/az-iranian-bank-gateways/total)-->
  <!--![GitHub issues](https://img.shields.io/github/issues/ali-zahedi/az-iranian-bank-gateways)-->


  ![GitHub](https://img.shields.io/github/license/ali-zahedi/az-iranian-bank-gateways)
  ![GitHub](https://img.shields.io/pypi/pyversions/az-iranian-bank-gateways.svg)
  ![GitHub](https://img.shields.io/pypi/v/az-iranian-bank-gateways.svg)
  ![GitHub](https://img.shields.io/pypi/dm/az-iranian-bank-gateways.svg?style=flat-square)
  [![Join the chat at https://gitter.im/az-iranian-bank-gateways/community](https://badges.gitter.im/az-iranian-bank-gateways/community.svg)](https://gitter.im/az-iranian-bank-gateways/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

  <p dir="rtl">
   کدهای آزاد و متن باز به زبان پایتون (python) که برای ارتباط با درگاه های بانکهای ایرانی در جنگو (Django) توسعه داده شده است.

   <p dir="rtl">
   در حال حاضر درگاه های با درگاه های زیر می توانید پرداخت کنید.
   </p>

   1. [درگاه پرداخت بانک ملی ایران (BMI)](https://mmp.sadadpsp.ir/Browse/MerchantRequestForm?@TermType_Shaparakabbr=INT)

   1. [درگاه پرداخت بانک سامان (SEP)](https://www.sep.ir/iemerchantregister)

   1. [درگاه پرداخت زرین پال](https://next.zarinpal.com/auth/register)

   1. [درگاه پرداخت آی دی پی (IDPay)](https://idpay.ir/s/664153)

   1. [درگاه پرداخت زیبال](https://zibal.ir)

   1. [درگاه پرداخت باهمتا](https://webpay.bahamta.com?rc=Sv7oH)

   1. [درگاه به پرداخت](http://www.behpardakht.com/)

   1. [درگاه پی ورژن ۱](https://www.pay.ir/)

  [[_TOC_]]

  <h1 dir="rtl">آموزشی</h1>

  1. [یوتیوب](https://youtu.be/VnwY7DJlPKs)
  1. [آپارات](https://www.aparat.com/v/DxL5J)
  1. [آکادمی ژاک](https://academy.zhaak.com/course/236/python-tips)



  <h1 dir="rtl">نصب</h1>

  <p dir="rtl"> نصب از طریق پکیج منیجر </p>

  ``pip install az-iranian-bank-gateways``


  <h1 dir="rtl">تنظیمات</h1>



  <p dir="rtl"> در فایل `settings.py` تنظیمات زیر را انجام میدهیم. </p>


   ``` python
   INSTALLED_APPS = [
       
       "azbankgateways",
       
   ]
   AZ_IRANIAN_BANK_GATEWAYS = {
       "GATEWAYS": {
           "BMI": {
               "MERCHANT_CODE": "<YOUR MERCHANT CODE>",
               "TERMINAL_CODE": "<YOUR TERMINAL CODE>",
               "SECRET_KEY": "<YOUR SECRET CODE>",
           },
           "SEP": {
               "MERCHANT_CODE": "<YOUR MERCHANT CODE>",
               "TERMINAL_CODE": "<YOUR TERMINAL CODE>",
           },
           "ZARINPAL": {
               "MERCHANT_CODE": "<YOUR MERCHANT CODE>",
               "SANDBOX": 0,  # 0 disable, 1 active
           },
           "IDPAY": {
               "MERCHANT_CODE": "<YOUR MERCHANT CODE>",
               "METHOD": "POST",  # GET or POST
               "X_SANDBOX": 0,  # 0 disable, 1 active
           },
           "ZIBAL": {
               "MERCHANT_CODE": "<YOUR MERCHANT CODE>",
           },
           "BAHAMTA": {
               "MERCHANT_CODE": "<YOUR MERCHANT CODE>",
           },
           "MELLAT": {
               "TERMINAL_CODE": "<YOUR TERMINAL CODE>",
               "USERNAME": "<YOUR USERNAME>",
               "PASSWORD": "<YOUR PASSWORD>",
           },
           "PAYV1": {
               "MERCHANT_CODE": "<YOUR MERCHANT CODE>",
               "X_SANDBOX": 0,  # 0 disable, 1 active
           },
       },
       "IS_SAMPLE_FORM_ENABLE": True,  # اختیاری و پیش فرض غیر فعال است
       "DEFAULT": "BMI",
       "CURRENCY": "IRR",  # اختیاری
       "TRACKING_CODE_QUERY_PARAM": "tc",  # اختیاری
       "TRACKING_CODE_LENGTH": 16,  # اختیاری
       "SETTING_VALUE_READER_CLASS": "azbankgateways.readers.DefaultReader",  # اختیاری
       "BANK_PRIORITIES": [
           "BMI",
           "SEP",
           
       ],  # اختیاری
       "IS_SAFE_GET_GATEWAY_PAYMENT": False,  # اختیاری، بهتر است True بزارید.
       "CUSTOM_APP": None,  # اختیاری
   }
   ```

  1. `GATEWAYS` :  تنظیمات مربوط به هر بانک به صورت دیکشنری های جدا در این قسمت وجود دارد. تنظیماتی مانند کلاس اجرا کننده، کلیدهای امنیتی که توسط بانک در اختیار شما قرار می گیرد.

  1. `DEFAULT`: در زمانی که به سازنده فکتوری پارامتری ارسال نشود از این تنظیم به عنوان بانک پیش فرض استفاده خواهد شد و ارتباطات با این بانک برقرار می شود.

  1. `CURRENCY - (IRR, IRT)`: واحد پولی که نرم افزار با آن کار می کند. این واحد پولی فارغ از واحد پولی درگاه خواهد بود.  در صورتی که واحد پولی نرم افزار با واحد پولی درگاه بانک متفاوت باشد تبدیل ریال به تومان یا بالعکس انجام خواهد شد.

  1. `TRACKING_CODE_QUERY_PARAM `: پارامتری که در هنگام بازگشت از درگاه به کال بک یو آر ال تعیین شده تنظیم و ارسال می گردد. به عنوان مثال زمانی که از کاربر از درگاه بانک باز می گردد چه پرداخت موفق داشته باشد و چه نا موفق کاربر به لینکی که در هنگام استفاده از درگاه تنظیم شده است٬ ارجاع داده می شود و در انتهای آن این رشته + کد پیگیری بازگردانده می شود تا بتوان داده ها را از این طریق بازیابی کرد.

  1. `TRACKING_CODE_LENGTH`: طول کد پیگیری تولید شده توسط سیستم است. دقت شود که در برخی درگاه ها مانند درگاه بانک ملی ایران، طول ۲۰ کاراکتر خطای `شماره سفارش ارسال نشده است` را می دهد.

  1. `SETTING_VALUE_READER_CLASS`: با مقدار دهی به این تنظیم شما می توانید حالت یک متغیر خوان اضافه کنید که قابلیت های دیگری مثل پروایدر و پشتیبانی از یک بانک با چند اکانت و ... را به آن اضافه کنید.

  1. `BANK_PRIORITIES`: این آرایه اختیاری است. زمانی که وضعیت اتصال به درگاه به صورت خودکار تعیین شده باشد، ابتدا به بانک پیش فرض متصل می شود و سپس بر این اساس شروع به اتصال خواهد کرد، تا به اولین درگاه فعال برسد. در حالت پیش فرض این آرایه خالی است که بعد از اتصال به درگاه مورد نظر در صورت خطا بقیه درگاه ها امتحان نخواهند شد.

  1. `IS_SAMPLE_FORM_ENABLE`: یو آر ال های مربوط به تست درگاه بانک را فعال و یا غیر فعال می کند. در صورت فعال بودن می توانید از طریق آدرس زیر درگاه پرداخت را امتحان کنید.

     * [Sample payment](http://127.0.0.1:8000/bankgateways/sample-payment/)

  1. `CALLBACK_NAMESPACE`: اگر میخواهید تابع کال بک داخلی را اوررایت کنید یا پروژه دارای اپ های مختلفی است و قسمت پرداخت در اپ جداگانه ای قرار دارد میتوانید محل قرار گیری یو آر ال های پیشفرض را تغییر دهید  برای مثال:
     ```
     'CALLBACK_NAMESPACE': 'api:payment:callback',
      ```
  1. `GO_TO_BANK_GATEWAY_NAMESPACE`: اگر میخواهید تابع رفتن به دروازه بانک داخلی را اوررایت کنید یا پروژه دارای اپ های مختلفی است وقسمت پرداخت در اپ جداگانه ای قرار دارد میتوانید محل قرار گیری یو آر ال های پیشفرض را تغییر دهید برای مثال:
      ```
       'GO_TO_BANK_GATEWAY_NAMESPACE': 'api:payment:go-to-bank-gateway',
      ```
  1. `SAMPLE_RESULT_NAMESPACE`: اگر میخواهید صفحه نمونه داخلی را اوررایت کنید یا پروژه دارای اپ های مختلفی است وقسمت پرداخت در اپ جداگانه ای قرار دارد میتوانید محل قرار گیری یو آر ال های پیشفرض را تغییر دهید برای مثال:
      ```
       'SAMPLE_RESULT_NAMESPACE': 'api:payment:sample-result',
      ```
  1. `'IS_SAFE_GET_GATEWAY_PAYMENT'`:<br>
     ```
     'IS_SAFE_GET_GATEWAY_PAYMENT': True,
     ```
     <p dir="rtl"> توصیه میشه True باشه.</p>
     <p dir="rtl"> درصورتی که مقدار برابر با True قرار بگیرد تابع redirect_gateway از دسترس خارج میشودو باید از تابع get_gateway استفاده شود.</p>
  1. `CUSTOM_APP` : <br>
     ```
     CUSTOM_APP : 'api:payment',
     ```
     <p dir="rtl">
     اگر نیاز ندارید توابع داخلی را اوررایت کنیدو فقط به این نیاز دارید که مسیر یو ار ال های داخلی را در اپ جداگانه ای قرارگیرد میتوانید از این گزینه برای ادرسی دهی محل قرار گیری اپ استفاده کنید
     </p>


  <p dir="rtl">
   در فایل `urls.py`
  </p>

  ```python
  from django.contrib import admin
  from django.urls import path

  from azbankgateways.urls import az_bank_gateways_urls

  admin.autodiscover()

  urlpatterns = [
      path("admin/", admin.site.urls),
      path("bankgateways/", az_bank_gateways_urls()),
  ]
  ```
  <p dir="rtl">
  با اضافه کردن آدرس بالا به لیست یو آر ال ها، پرداخت ها پس از درگاه به این مسیر هدایت و اعتبار سنجی می شوند و سپس مجدد به سمت کال بکی که به ازای هر درخواست تنظیم می شود، مسیر یابی خواهد شد.
  </p>


  <p dir="rtl">
  بعد از انجام تنظیمات دستور زیر را اجرا می کنیم.
  </p>

  ```
  python manage.py migrate
  ```

  <h4 dir="rtl">اگر از reverse proxy و https استفاده می کنید برای رفع موارد احتمالی حتما تنظیمات این <a href="https://stackoverflow.com/questions/62047354/build-absolute-uri-with-https-behind-reverse-proxy/65934202#65934202">لینک</a> را انجام دهید.</h4>


  <h1 dir="rtl">نحوه استفاده</h1>
  <h2 dir="rtl">ارسال به بانک</h2>

  <h3 dir="rtl">برای وقتی که تنظیمات IS_SAFE_GET_GATEWAY_PAYMENT': False'</h3>
  <p dir="rtl">
   برای استفاده و اتصال به درگاه بانک کافی است یک `BankFactory` ایجاد کنیم و پارامترهای اجباری را تنظیم کنیم. سپس کاربر را می توانیم به درگاه بانک هدایت  کنیم.
  </p>


  ```python
  import logging
  from django.urls import reverse
  from azbankgateways import (
      bankfactories,
      models as bank_models,
      default_settings as settings,
  )
  from azbankgateways.exceptions import AZBankGatewaysException


  def go_to_gateway_view(request):
      
      amount = 1000
      
      user_mobile_number = "+989112221234"  # اختیاری

      factory = bankfactories.BankFactory()
      try:
          bank = (
              factory.auto_create()
          )  # or factory.create(bank_models.BankType.BMI) or set identifier
          bank.set_request(request)
          bank.set_amount(amount)
          
          bank.set_client_callback_url(reverse("callback-gateway"))
          bank.set_mobile_number(user_mobile_number)  # اختیاری

          
          
          bank_record = bank.ready()

          
          return bank.redirect_gateway()
      except AZBankGatewaysException as e:
          logging.critical(e)
          
          raise e
  ```

  <h3 dir="rtl">برای وقتی که تنظیمات IS_SAFE_GET_GATEWAY_PAYMENT': True'</h3>
  <p dir="rtl">
   در این قسمت مثل مثال قبل عمل میکنیم تنها تفاوت این است که از تابع get_gateway بجای redirect_gateway استفاده میکنیم دلیل این کار افزایش امنیت و تغییر صفحهredirect میباشد.
  </p>


  ```python
  import logging
  from django.urls import reverse
  from django.shortcuts import render
  from azbankgateways import (
      bankfactories,
      models as bank_models,
      default_settings as settings,
  )
  from azbankgateways.exceptions import AZBankGatewaysException


  def go_to_gateway_view(request):
      
      amount = 1000
      
      user_mobile_number = "+989112221234"  # اختیاری

      factory = bankfactories.BankFactory()
      try:
          bank = (
              factory.auto_create()
          )  # or factory.create(bank_models.BankType.BMI) or set identifier
          bank.set_request(request)
          bank.set_amount(amount)
          
          bank.set_client_callback_url(reverse("callback-gateway"))
          bank.set_mobile_number(user_mobile_number)  # اختیاری

          
          
          bank_record = bank.ready()

          
          context = bank.get_gateway()
          return render(request, "redirect_to_bank.html", context=context)
      except AZBankGatewaysException as e:
          logging.critical(e)
          return render(request, "redirect_to_bank.html")
  ```

  <h3 dir="rtl"> تنظیم SECURE_REFERRER_POLICY برای درگاه بانک ملی و سامان </h3>
  <p dir="rtl">
  برای استفاده از درگاه بانک ملی و سامان تنظیم SECURE_REFERRER_POLICY در setting جنگو به صورت زیر الزامیست
  </p>

  ```python
  SECURE_REFERRER_POLICY = "strict-origin-when-cross-origin"
  ```

  <h3 dir="rtl">   انتخاب خودکار درگاه    </h3>

  <p dir="rtl">
  در صورتیکه تمایل دارید به صورت خودکار به اولین درگاه در دسترس متصل شوید. ابتدا از قسمت تنظیمات در بخش `BANK_PRIORITIES
  ` اولویت های بانک های مد نظر را وارید کنید. سپس به جای استفاده از متد `factory.create` از متد ‍`factory.auto_create` در این بخش استفاده کنید.
  به متد auto_create می توانید مبلغ مد نظر را نیز برای صحت سنجی از حداقل مبلغ نیز ارسال کنید.
   </p>

  `set_mobile_number` متدی است که پارامتر شماره موبایل کاربری که قصد خرید دارد را به آن پاس میدهیم. این شماره موبایل جهت پرداخت و پیگیری آسان تر به درگاه ارسال می شود

  هم‌چنین می‌توانید عملیات auto create کردن factory را از طریق interface انجام دهید:

  ```python
  from azbankgateways.bankfactories_interface import BankFactory
  from azbankgateways.exceptions import AZBankGatewaysException


  def go_to_gateway_view(request):
      try :
          factory = BankFactory()
          bank = factory.auto_create(
              request=request,
              amount=amount,
              callback_url=callback_url,
              mobile_number=mobile_number,
          )

          
          
          bank_record = bank.ready()

          
          return bank.redirect_gateway()
      except AZBankGatewaysException as e :
          raise e

  ```

  عملیات create کردن factory از طریق interface :

  ```python
  from azbankgateways.bankfactories_interface import BankFactory
  from azbankgateways.exceptions import AZBankGatewaysException


  def go_to_gateway_view(request):
      try :
          factory = BankFactory()
          bank = factory.create(
              request=request,
              amount=amount,
              callback_url=callback_url,
              mobile_number=mobile_number,
  	        bank_type=bank_type,
          )

          
          
          bank_record = bank.ready()

          
          return bank.redirect_gateway()
      except AZBankGatewaysException as e :
          raise e

  <h2 dir="rtl">ساخت صفحه redirect_to_bank.html </h2>
  <p dir="rtl">
  این صفحه درصورتی کارمیکند که IS_SAFE_GET_GATEWAY_PAYMENT': True' و view مربوطه تنظیم شود.<br> برای این کار در پوشه templates پروژه فایل redirect_to_bank.html را ایجاد کرده و محتوای زیر را در آن قرار میدیم (میتونید با سلیقه خودتون سفاریشی کنید)
   </p>

  ```html
  <!DOCTYPE html>
  <html lang="fa">
  <head>
      <meta charset="UTF-8">
      <title>انتقال به درگاه پرداخت</title>
  </head>
  <body>

     {% if url %}
       <h5>در حال اتصال به درگاه پرداخت ...</h5>
     {% else %}
       <h5>خطا در ارتباط با درگاه</h5>
     {% endif %}

     {% if url %}
        <form id='id_form' action="{{ url }}" method="{{ method }}">
            {% csrf_token %}
            {% for key, value in params.items %}
                <input type="hidden" name="{{ key }}" value="{{ value }}">
            {% endfor %}
        </form>

        <script type="text/javascript">
            window.onload = function () {

                function submitForm() {
                    document.forms['id_form'].submit();
                }

                submitForm();
            }
        </script>
     {% endif %}
  </body>
  </html>
  ```


  <h2 dir="rtl">بازگشت از بانک</h2>

  <p dir="rtl">
  وضعیت رکورد بانک به شرح ذیل می باشد.
   </p>

  1. `WAITING`: در انتظار برای انتقال کاربر به درگاه بانک

  1. `REDIRECT_TO_BANK`: کاربر به درگاه بانک منتقل شده است ولی هنوز از درگاه باز نگشته است.

  1. `RETURN_FROM_BANK`: کاربر از درگاه برگشته ولی عملیات صحت سنجی٬ یا تکمیل نشده است یا با خطا درهنگام تایید از سوی بانک مواجه شده است. در این شرایط می توان با فراخوانی مجدد در بازه زمانی کمتر از ۱۵ دقیقه که کاربر بازگشته است٬ عملیات تایید را مجدد درخواست کرد. شرح تایید مجدد در پایین تر آورده شده است.

  1. `CANCEL_BY_USER`: پرداخت توسط کاربر کنسل شده است.

  1. `EXPIRE_GATEWAY_TOKEN`: ارتباط با درگاه بانک برقرار شده ولی کاربر به درگاه هدایت نشده است.

  1. `EXPIRE_VERIFY_PAYMENT`: در بازه زمانی ۱۵ دقیقه پس از بازگشت٬ موفق به تایید اطلاعات پرداخت نشده ایم.

  1. `COMPLETE`: وضعیت پرداخت موفق است.


  ```python
  import logging

  from django.http import HttpResponse, Http404
  from django.urls import reverse

  from azbankgateways import (
      bankfactories,
      models as bank_models,
      default_settings as settings,
  )


  def callback_gateway_view(request):
      tracking_code = request.GET.get(settings.TRACKING_CODE_QUERY_PARAM, None)
      if not tracking_code:
          logging.debug("این لینک معتبر نیست.")
          raise Http404

      try:
          bank_record = bank_models.Bank.objects.get(tracking_code=tracking_code)
      except bank_models.Bank.DoesNotExist:
          logging.debug("این لینک معتبر نیست.")
          raise Http404

      
      if bank_record.is_success:
          
          
          return HttpResponse("پرداخت با موفقیت انجام شد.")

      
      return HttpResponse(
          "پرداخت با شکست مواجه شده است. اگر پول کم شده است ظرف مدت ۴۸ ساعت پول به حساب شما بازخواهد گشت."
      )
  ```


  <h2 dir="rtl">درخواست تایید مجدد از بانک</h2>

  ```python
  import logging
  from azbankgateways import (
      bankfactories,
      models as bank_models,
      default_settings as settings,
  )

  factory = bankfactories.BankFactory()


  bank_models.Bank.objects.update_expire_records()


  for item in bank_models.Bank.objects.filter_return_from_bank():
      bank = factory.create(
          bank_type=item.bank_type, identifier=item.bank_choose_identifier
      )
      bank.verify(item.tracking_code)
      bank_record = bank_models.Bank.objects.get(tracking_code=item.tracking_code)
      if bank_record.is_success:
          logging.debug("This record is verify now.", extra={"pk": bank_record.pk})
  ```



  - [X] Add BMI support
  - [X] Add SEP support
  - [X] Add Zarinpal support
  - [X] Add IDPay support
  - [X] Add Zibal support
  - [X] Add Bahamta support
  - [X] Add BehPardakht support
  - [X] Add Pay.ir V1 support
  - [ ] Add Pay.ir V2 support
  - [ ] Add nextpay-ir support (need MERCHANT_CODE & etc.)
  - [ ] Add Paystar support (need MERCHANT_CODE & etc.)
  - [ ] Add Sepah Bank support (need MERCHANT_CODE & etc.)
  - [ ] Managing verification Process when Gateway Not Available
  - [ ] Add celery beat for when Gateway Not Available







  <p dir="rtl">
   اگر از این بسته استفاده می کنید و خوشتون اومده با دادن ستاره به ما دلگرمی بدید.البته که اگر زمان بگذارید و گسترش بدید خیلی استقبال می کنیم و خوشحال میشیم. البته که در هیچ کدوم از این موارد اصراری نیست.
  </p>

  <p dir="rtl">
  برای نصب وابستگی ها از طریق زیر اقدام کنید و بعد از انجام تغییرات مرج ریکوئست ارسال کنید.
  </p>

  ```shell
  pip install -e ".[dev]"
  pre-commit install
  ```
  <p dir="rtl">
  بیشتر بخوانیم:
  </p>

  * [flake8](https://flake8.pycqa.org/en/latest/)
  * [black](https://black.readthedocs.io/en/stable/)

  <p dir="rtl">
   شاد باشید و خندون
  </p>



  * [erfanmosaddeghi ](https://github.com/erfanmosaddeghi) برای اصلاح حداقل مبلغ زرین پال
  * [sina-am](https://github.com/sina-am) اضافه کردن درگاه بانک ملت
  * [joejoe-am](https://github.com/joejoe-am) برای رفع مشکل اولویت بندی در اتصال خودکار
  * [mash5026](https://github.com/mash5026) برای رفع مشکل unmarshalling ERROR: For input string
  * [hypy13](https://github.com/hypy13) برای آپدیت به ورژن های بالاتر از جنگو ۳.۲
  * [jam4li](https://github.com/jam4li) برای اضافه کردن سندباکس زرین پال
  * [ravexina](https://github.com/ravexina) رفع مشکل تسویه حساب بانک ملت
  * [nimaes80](https://github.com/nimaes80) اضافه کردن درگاه pay.ir ورژن یک
  * [khademmilad](https://github.com/khademmilad) پشتیبانی از پایتون ۳.۱۰ و ۳.۱۱
  * [Saman-Zand-H](https://github.com/Saman-Zand-H) رفع مشکل اتصال pay.ir در برخی موارد
  * [MrMRM1](https://github.com/MrMRM1)  [بابت رفع مشکل امنیتی](https://github.com/ali-zahedi/az-iranian-bank-gateways/pull/65#issuecomment-1624927632)
  * [MrMRM1](https://github.com/MrMRM1) اضافه شدن قابلیت اوررایت یا تغییر ادرس یو آر ال های پیشفرض
  * [shiani](https://github.com/shiani) error occurs when the main language of site is Persian and it has to use gettext_lazy translation.
  * [amirreza8002](https://github.com/amirreza8002) رفع مشکل ترجمه
  * [ahmadrezanavaie](https://github.com/ahmadrezanavaie) رفع مشکل ترجمه
  * [zamoosh](https://github.com/zamoosh) اضافه کردن وضعیت های  تراکنش در بانک ملت
  * [birddevelper](https://github.com/birddevelper) الزامی کردن وجود referrer برای درگاه های بانک ملی و سامان و رفع مشکل توکن درگاه بانک ملی
  * [apidemy](https://github.com/apidemy) ریفکتور _is_strict_origin_policy_enabled و پیروی از DRY
  * [TinyPuff](https://github.com/TinyPuff) رفع مشکل Pay.ir
  * [mojtabaakbari221b](https://github.com/mojtabaakbari221b ) اضافه کردن اینترفیس برای bankfactory


  The MIT License (MIT). Please see [License File](LICENSE) for more information.


  [لینک]: https://stackoverflow.com/questions/62047354/build-absolute-uri-with-https-behind-reverse-proxy/65934202#65934202را


  [لینک]: https://stackoverflow.com/questions/62047354/build-absolute-uri-with-https-behind-reverse-proxy/65934202#65934202


pkgId: 58669cacd903295dc64c5565b41dddf02b520660e81de819945ee5068edc0a95
name: python-az-iranian-bank-intro
arch: src
version: 1.2.3
epoch: 0
release: 1
summary: Iranian Bank intro
url: https://github.com/ali-zahedi/az-iranian-bank-intro
rpm_license: BSD License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-az-iranian-bank-intro-1.2.3-1.src.rpm
checksum_type: sha256
description:
  <!--![GitHub All Releases](https://img.shields.io/github/downloads/ali-zahedi/az-iranian-bank-intro/total)-->
  <!--![GitHub issues](https://img.shields.io/github/issues/ali-zahedi/az-iranian-bank-intro)-->
  ![GitHub](https://img.shields.io/github/license/ali-zahedi/az-iranian-bank-intro)
  ![GitHub](https://img.shields.io/pypi/pyversions/az-iranian-bank-intro.svg?maxAge=2592000)
  ![GitHub](https://img.shields.io/pypi/v/az-iranian-bank-intro.svg?maxAge=2592000)



  <p dir="rtl">
   کدهای آزاد و متن باز به زبان پایتون (python) که برای استفاده از اطلاعات، اعتبار سنجی درگاه های بانکهای ایرانی توسعه داده شده است.
  </p>

  🌟 If you ❤️ library, please star it! 🌟

  [[_TOC_]]


  <h1 dir="rtl">نصب</h1>

  <p dir="rtl"> نصب از طریق پکیج منیجر </p>

  ```pip install az-iranian-bank-intro```


  <h1 dir="rtl">نحوه استفاده</h1>

  <h2 dir="rtl">اعتبار سنجی کارت ها</h2>

  <p dir="rtl">
  برای اعتبار سنجی کارت های بانکی کافی است متد اعتبار سنجی را ایمپورت کنیم و شماره کارت مورد نظر را به آن پاس دهیم. در صورتی که شماره کارت مورد نظر معتبر باشد برنامه به کار خود ادامه خواهد داد و در صورتی که نا معتبر باشد exception ارسال خواهد شد.
  </p>

  ```python
  import logging
  from azbankintro import card_validate, CardValidationException

  try:
      card_validate('6280992042433333')
      logging.debug('کارت معتبر است.')
  except CardValidationException:
      logging.debug('کارت نا معتبر است.')
  ```


  <h2 dir="rtl">اعتبار سنجی IBAN یا شماره شبا</h2>

  <p dir="rtl">
  برای اعتبار سنجی شماره IBAN کافی است متد اعتبار سنجی را ایمپورت کنیم و شماره IBAN مورد نظر را به آن پاس دهیم. در صورتی که شماره مورد نظر معتبر باشد برنامه به کار خود ادامه خواهد داد و در صورتی که نا معتبر باشد exception ارسال خواهد شد.
  </p>

  ```python
  import logging
  from azbankintro import iban_validate, IBANValidationException

  try:
      iban_validate('IR062960000000100324200001')
      logging.debug('شماره IBAN معتبر است.')
  except IBANValidationException:
      logging.debug('شماره IBAN نا معتبر است.')
  ```


  <h2 dir="rtl">استفاده از کلاس IBAN</h2>


  <h3 dir="rtl">تبدیل شماره حساب به شبا یا IBAN</h2>

  <p dir="rtl">
  در صورتی که تمایل دارید شماره حساب بانک مورد را تبدیل به شماره شبا کنید می توانید از ساختار زیر استفاده کنید.
  </p>

  ```python
  from azbankintro import *
  IBAN.calculate_iban(BankEnum.MELLI_BANK, '0338404829005')
  ```

  <p dir="rtl">
  در صورتی که نوع بانک مد نظر را ندارید و فقط رشته آن را دارید می توانید از کد زیر جهت دریافت بانک استفاده کنید.
  </p>

  ```python
  from azbankintro import *
  s = 'BMI'
  bank_type = BankEnum(s)
  IBAN.calculate_iban(bank_type, '0338404829005')
  ```

  <p dir="rtl">
  در صورتی که یک instance از نوع IBAN دارید نیز می توانید عملیات اعتبار سنجی را به گونه زیر انجام دهید.
  </p>

  ```python
  from azbankintro import *
  s = 'BMI'
  bank_type = BankEnum(s)
  iban = IBAN.calculate_iban(bank_type, '0338404829005')
  iban.validate()
  ```

  <p dir="rtl">
  می توانید از فرمتر نیز استفاده کنید.
  </p>

  ```python
  from azbankintro import *
  iban = IBAN.calculate_iban(BankEnum.MELLI_BANK, '0338404829005')
  print(iban.__str__())
  print(iban.format('-'))
  print(iban.format(' '))
  """
  IR040170000000338404829005
  IR04-0170-0000-0033-8404-8290-05
  IR04 0170 0000 0033 8404 8290 05
  """
  ```



  - [ ] Documentation

  - [X] Bank list

  - [ ] Logo

  - [X] Validate card

  - [X] Validate IBAN

  - [X] Calculate IBAN




  <p dir="rtl">
   اگر از این بسته استفاده می کنید و خوشتون اومده با دادن ستاره به ما دلگرمی بدید.البته که اگر زمان بگذارید و گسترش بدید خیلی استقبال می کنیم و خوشحال میشیم. البته که در هیچ کدوم از این موارد اصراری نیست.
  </p>
  <p dir="rtl">
   شاد باشید و خندون
  </p>



  The MIT License (MIT). Please see [License File](LICENSE) for more information.


pkgId: 42168787aa2879ba2ef797f68cd9e04870406cba7e8df454f7eafd8247a5695c
name: python-az-partner-center-cli
arch: src
version: 0.2.5
epoch: 0
release: 1
summary: https://api.partner.microsoft.com/v1.0/ingestion
url: https://pypi.org/project/az-partner-center-cli/
rpm_license: UNKNOWN
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-az-partner-center-cli-0.2.5-1.src.rpm
checksum_type: sha256
description:
  No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501


pkgId: e7aaff099413724741416f894726bf92fd65e1bd156b640f9df58eaec7e1064f
name: python-az-ssh-wrapper
arch: src
version: 1.0.3
epoch: 0
release: 1
summary: SSH Wrapper for Azure CLI's `az ssh` command
url: https://pypi.org/project/az-ssh-wrapper/
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-az-ssh-wrapper-1.0.3-1.src.rpm
checksum_type: sha256
description:
  This package provides a wrapper script for the Azure CLI `az ssh`
  command. This makes it possible to use `az ssh` with programs which
  expect the standard SSH interface, such as Ansible. This is useful for
  example if you want to deploy an Ansible role to an Azure VM, and you
  want to automatically connect to the VM using `az ssh`, rather than
  needing to manage SSH keys, etc.

  `az-ssh` accepts all the standard SSH arguments, and passes them on
  directly to `az ssh`.

  It filters out the `ControlMaster` and `ControlPersist` options, as
  there is a known issue using these options with `az ssh`, which causes
  `az ssh` to block for the duration of the `ControlPersist` value. See
  the following GitHub issue for details:

  https://github.com/Azure/azure-cli-extensions/issues/7285



  - [Azure CLI][azure-cli]
  - An Azure VM with the `AADSSHLoginForLinux` VM extension installed.
  - An Entra account with the `Virtual Machine Administrator Login` or
    `Virtual Machine User Login` role configured for the VM.
  - Linux or WSL (Windows is not supported due to
    <https://github.com/PowerShell/PowerShell/issues/24585>).



  Install with `pip`, `pipx` or `uv tool`.

  ```
  pip install az-ssh-wrapper
  ```

  ```
  pipx install az-ssh-wrapper
  ```

  ```
  uv tool install az-ssh-wrapper
  ```



  Install with `pip`, `pipx` or `uv tool`

  ```
  pip install az-ssh-wrapper@git+https://github.com/swsphn/az-ssh-wrapper.git
  ```

  ```
  pipx install az-ssh-wrapper@git+https://github.com/swsphn/az-ssh-wrapper.git
  ```

  ```
  uv tool install az-ssh-wrapper@git+https://github.com/swsphn/az-ssh-wrapper.git
  ```

  Note: While the package is called `az-ssh-wrapper`, the installed
  executable is called `az-ssh`.



  If you can already connect to a VM using the following Azure CLI
  command, this wrapper will enable Ansible to connect in the same way:

      az ssh vm --ip 1.2.3.4

  For example, the above command using this wrapper is:

      az-ssh 1.2.3.4

  If you need to pass options or arguments to SSH, Azure CLI requires you
  to use the following syntax:

      az ssh vm --ip 1.2.3.4 -- <options>

  For example, to connect to the server, run the `date` command, then
  exit:

      az ssh vm --ip 1.2.3.4 -- date

  In contrast, Az SSH Wrapper allows you to use the standard SSH form:

      az-ssh 1.2.3.4 date



  After installing this package you can simply specify
  `ansible_ssh_executable = az-ssh`, and it will automatically connect to
  the VM using your Azure credentials with your existing Azure CLI login.
  For example, you could configure this as a variable in your hosts
  inventory file.

  [azure-cli]: https://learn.microsoft.com/en-gb/cli/azure/install-azure-cli

rpm_license:
  MIT License  Copyright (c) 2023 David Wales, South Western Sydney Primary Health Network  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: ad85e2a8b7760a98bb6a3c7e85da6b4dc3844cd357ca1bea188f0283db269d15
name: python-azapy
arch: src
version: 1.2.5
epoch: 0
release: 1
summary: Financial Portfolio Optimization Algorithms
url: https://github.com/Mircea-MMXXI/azapy.git
rpm_license: GPLv3
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azapy-1.2.5-1.src.rpm
checksum_type: sha256
description:
  ![TimeSeries](https://github.com/Mircea-MMXXI/azapy/blob/main/graphics/Portfolio_1.png?raw=true)

  Author: Mircea Marinescu

  email: Mircea.Marinescu@outlook.com

  [Package documentation](https://azapy.readthedocs.io/en/latest)

  Package installation: `pip install azapy`

  [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/D1D07G22H)

  A graphical user interface is provided by [**azapyGUI**](https://azapyGUI.readthedocs.io/en/latest) package.





    1. mCVaR - mixture CVaR (Conditional Value at Risk)
    2. mSMCR - mixture SMCR (Second Moment Coherent Risk)
    3. mMAD - m-level MAD (Mean Absolute Deviation)
    4. mLSD - m-level LSD (Lower Semi-Deviation)
    5. mBTAD - mixture BTAD (Below Threshold Absolute Deviation)
    6. mBTSD - mixture BTSD (Below Threshold Semi-Deviation)
    7. GINI - Gini index (as in Corrado Gini statistician 1884-1965)
    8. SD - standard deviation
    9. MV - variance (as in mean-variance model)
    10. mEVaR - mixture EVaR (Entropic Value at Risk)
    <span style="color:blue">(beta version)</span>



    1. Optimal-risk portfolio for targeted expected rate of return value
    2. Sharpe-optimal portfolio - maximization of generalized Sharpe ratio
    3. Sharpe-optimal portfolio - minimization of inverse generalized Sharpe
    ratio
    4. Minimum risk portfolio
    5. Optimal-risk portfolio for a fixed risk-aversion factor
    6. Optimal-risk portfolio with the same risk value as a benchmark portfolio
    (e.g., same as equal weighted portfolio)
    7. Optimal-diversified portfolio for targeted expected rate of return
    (minimization of inverse *1-D* ratio) <span style="color:blue">(beta version)</span>
    8. Optimal-diversified portfolio for targeted expected rate of return
    (maximization of *1-D* ratio) <span style="color:blue">(beta version)</span>
    9. Maximum diversified portfolio <span style="color:blue">(beta version)</span>
    10. Optimal-diversified portfolio with the same diversification factor as
    a benchmark portfolio (e.g., same as equal weighted portfolio)
    <span style="color:blue">(beta version)</span>
    11. Optimal-diversified portfolio with the same expected rate of return as
    a benchmark portfolio (e.g., same as equal weighted portfolio)
    <span style="color:blue">(beta version)</span>



    1. Constant weighted portfolio. A particular case is equal
       weighted portfolio.
    2. Inverse volatility portfolio (i.e., portfolio weights are proportional to
       the inverse of asset volatilities)
    3. Inverse variance portfolio (i.e., portfolio weights are proportional to
       the inverse of asset variances)
    4. Inverse drawdown portfolio (i.e., portfolio weights are proportional to
       the asset absolute value of maximum drawdowns over a predefined
       historical period)



    1. Kelly's portfolio (as in John Larry Kelly Jr. scientist 1923-1965) -
       maximization of portfolio log returns
    2. Universal portfolio (Thomas M. Cover 1996) <span style="color:blue">(beta version)</span>



    1. Dual Momentum Selector <span style="color:blue">(beta version)</span>
    2. Correlation Clustering Selector <span style="color:blue">(beta version)</span>



  * Collect historical market data from various providers.

    Supported providers:
    + yahoo.com
    + eodhistoricaldata.com
    + alphavantage.co
    + marketstack.com

  * Generate business calendars for all major exchanges across the world.
  * Generate rebalancing portfolio schedules.
  * Append a cash-like security to an existing market data object.
  * Update market data saved in a directory.
  * N-simplex random vectors generators.



  * python 3.11.8
  * pandas 2.1.4
  * numpy 1.26.2
  * scipy 1.11.4
  * statsmodels 0.14.0
  * matplotlib 3.8.0
  * plotly 5.9.0
  * requests 2.31.0
  * pandas_market_calendars 4.3.2
  * ecos 2.0.12
  * cvxopt 1.3.2
  * ta 0.11.0
  * yfinance 0.2.33


pkgId: b39b05e606fd588586d53ff6a50a0ef17d266a5f0e28fa46f43f5c05a87f3ea6
name: python-azarashi
arch: src
version: 0.11.0
epoch: 0
release: 1
summary: QZSS DCR Decoder
url: https://github.com/nbtk/azarashi
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azarashi-0.11.0-1.src.rpm
checksum_type: sha256
description:
  [![Downloads](https://static.pepy.tech/personalized-badge/azarashi?period=total&units=none&left_color=grey&right_color=blue&left_text=Downloads)](https://pepy.tech/project/azarashi)

  A QZSS DCR Decoder.

  azarashi は準天頂衛星みちびきが送信する災危通報メッセージのデコーダーです。u-blox と Sony Spresense が出力するメッセージ形式に対応しています。災危通報(災害・危機管理通報サービス)とは、防災機関から発表される地震や津波発生時の災害情報などの危機管理情報を準天頂衛星みちびき経由で送信するサービスです。

  ```shell
  $ pip install azarashi
  ```

  デバイスに災危通報メッセージを出力させるための設定例です。

  UARTを有効にするため、設定ファイルの末尾に `enable_uart=1` を追記します。
  ```shell
  $ sudo vi /boot/firmware/config.txt
  ```
  ```shell
  [all]
  ...


  enable_uart=1
  ```
  再起動して、シリアルデバイスが認識されていることを確認します。
  ```shell
  $ sudo reboot
  ```
  `/dev/ttyS0` の状態を確認しましょう。
  ```shell
  $ stat /dev/ttyS0
  ```
  ```shell
    File: /dev/ttyS0
    Size: 0         	Blocks: 0          IO Block: 4096   character special file
  Device: 5h/5d	Inode: 602         Links: 1     Device type: 4,40
  Access: (0660/crw-rw----)  Uid: (    0/    root)   Gid: (   20/ dialout)
  ...
  ```
  もし `/dev/ttyS0` が存在しない場合は dmsg コマンドで確認しましょう。ファイル名が異なるか UART ポートを有効化する設定が間違っているか、有効化に失敗していることが考えられます。
  ```shell
  $ sudo dmesg | grep serial
  ```
  ```shell
  [    0.525432] bcm2835-aux-uart fe215040.serial: there is not valid maps for state default
  [    0.527303] fe215040.serial: ttyS0 at MMIO 0xfe215040 (irq = 21, base_baud = 62500000) is a 16550
  ```
  シリアルデバイスに `sudo` コマンドを使わずに読み書きしたいときは、ユーザを `dialout` グループに追加します。
  ```shell
  $ sudo usermod -a -G dialout $USER
  $ logout # then re-login to the machine
  ```
  データシートを参照して直接インストラクションを流し込むか、設定ツールをつかって SFRBX メッセージの出力を有効にしてください。設定ツール ubxtool は下記のようにインストールします。
  ```shell
  $ sudo apt update
  $ sudo apt install gpsd gpsd-clients
  ```
  SFRBX メッセージの出力に関連する設定コマンドの例です。
  ```shell
  $ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,1,1 # sets 'enable'  to ram
  $ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,0,1 # sets 'disable' to ram
  $ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,1,2 # sets 'enable'  to bbr (battery-backed ram)
  $ ubxtool -f /dev/ttyS0 -s 9600 -z CFG-MSGOUT-UBX_RXM_SFRBX_UART1,0,2 # sets 'disable' to bbr (battery-backed ram)
  $ ubxtool -f /dev/ttyS0 -s 9600 -g CFG-MSGOUT-UBX_RXM_SFRBX_UART1 | grep -A3 UBX-CFG-VALGET # gets the state
  ```
  デバイスに通電してから災危通報メッセージを出力し始めるまでしばらく時間がかかります。

  設定ツール [u-center](https://www.u-blox.com/en/product/u-center) をダウンロードし、インストールしてください。

  u-center で SFRBX メッセージを出力するように設定してください。下記は SFRBX メッセージを USB に出力するための参考設定手順です。
  ```
  Open u-center ->
    View -> Configuration View ->
      CFG (Configuration) -> Revert to default configuration -> Send
      MSG (Messages) -> Messages -> 02-13 RXM-SFRBX ->
        Check the "USB" box and type 1 in the "on" box -> Send
      NMEA (NMEA Protocol) -> NMEA Version -> Select 4.11 -> Send
      CFG (Configuration) -> Save current configuration -> Send
  ```
  u-center で QZSS の L1S シグナル受信機能を有効にしてください。下記は GPS と QZSS のメッセージをすべて受信するための参考設定手順です。
  ```
  Open u-center ->
    View -> Generation 9 Configuration View -> GNSS Configuration ->
      Check All the "GPS" and "QZSS" boxes ->
    　　  Check the "RAM" and "Flash" boxes in the "Write to layer" ->
   　　　　   Send Configuration
  ```
  設定は永続化され、他の機器に接続し直しても災危通報メッセージを出力します。デバイスに通電してから災危通報メッセージを出力し始めるまでしばらく時間がかかります。

  [QZSS 災危通報 (QZQSM) の NMEA センテンスを出力するように設定してください。](https://developer.sony.com/develop/spresense/docs/arduino_tutorials_ja.html#_qzss_災危通報を出力する)

  azarashi コマンドをつかうとプログラミングすることなく災危通報メッセージをデコードできます。
  ```shell
  $ echo '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05' | azarashi nmea
  ```
  オプションは下記のとおりです。
  ```shell
  usage: azarashi [-h] [-f INPUT] [-s] [-u] [-v] {hex,nmea,ublox}

  azarashi CLI

  positional arguments:
    {hex,nmea,ublox}      message type

  options:
    -h, --help            show this help message and exit
    -f INPUT, --input INPUT
                          input device (default: stdin)
    -s, --source          output the source messages (default: False)
    -u, --unique          supress duplicate messages (default: False)
    -v, --verbose         verbose mode (default: False)
  ```

  stty コマンドでデバイスファイルを `raw` に設定し azarashi コマンドのメッセージタイプに `ublox` を指定します。デバイスファイルのパスは適宜変更してください。
  ```shell
  $ stty -F /dev/ttyS0 raw
  ```
  azarashi コマンドに ublox オプションを指定します。
  ```shell
  $ azarashi ublox -f /dev/ttyS0
  ```
  なお、デバイスファイルの読込権限が足りず sudo コマンドを使って python3 インタプリタを実行するとき azarashi モジュールも sudo で実行される python3 環境にインストールされている必要があることに注意してください。あるいは次のように実行しても動作は同じです。
  ```shell
  $ sudo cat /dev/ttyS0 | azarashi ublox
  ```

  azarashi コマンドに nmea オプションを指定します。
  ```shell
  $ azarashi nmea -f /dev/ttyUSB0
  ```

  azarashi コマンドのメッセージタイプに `hex` を指定してください。`hex` はヘッダ、チェックサムを含まない16進数文字列のメッセージ形式です。
  ```shell
  $ echo C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC | azarashi hex
  ```


  ```python
  azarashi.decode(msg, msg_type='nmea')
  ```
  - `msg`: メッセージを渡してください。メッセージは str 型または bytes 型です。
  - `msg_type`: デフォルトは `nmea` 、オプションとして `hex` または `ublox` を指定できます。`nmea` または `hex` を指定したときメッセージは str 型、`ublox` を指定したときメッセージは bytes 型です。

  デコードして得られたレポートオブジェクトを `str()` にわたすとヒューマンリーダブルな災害情報を返します。
  ```python
  >>> import azarashi
  >>> msg = '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05'
  >>> report = azarashi.decode(msg, 'nmea')
  >>> str(report)
  '防災気象情報(緊急地震速報)(発表)(訓練/試験)\n*** これは訓練です ***\n緊急地震速報\n強い揺れに警戒してください。\n\n発表時刻: 3月10日10時0分\n\n震央地名: 日向震度(上限): 〜程度以上\n島根、岡山、広島、山口、香川、愛媛、高知、福岡、佐賀、長崎、熊本、大分、宮崎、鹿児島、中国、四国、九州'
  ```
  つまりレポートオブジェクトを `print()` にわたせば災害情報を出力します。
  ```python
  >>> print(report)
  ```
  ```
  防災気象情報(緊急地震速報)(発表)(訓練/試験)
  *** これは訓練です ***
  緊急地震速報
  強い揺れに警戒してください。

  発表時刻: 3月10日10時0分

  震央地名: 日向灘
  地震発生時刻: 10日10時0分
  深さ: 10km
  マグニチュード: 7.2
  震度(下限): 震度6弱
  震度(上限): 〜程度以上
  島根、岡山、広島、山口、香川、愛媛、高知、福岡、佐賀、長崎、熊本、大分、宮崎、鹿児島、中国、四国、九州
  ```
  レポートオブジェクトからパラメータを取得するには `get_params()` メソッドを使います。
  ```python
  >>> from pprint import pprint
  >>> pprint(report.get_params())
  ```
  ```python
  {'assumptive': False,
   'depth_of_hypocenter': '10km',
   'depth_of_hypocenter_raw': 10,
   'disaster_category': '緊急地震速報',
   'disaster_category_en': 'Earthquake Early Warning',
   'disaster_category_no': 1,
   'eew_forecast_regions': ['島根', '岡山', '広島', '山口', '香川', '愛媛',
                            '高知', '福岡', '佐賀', '長崎', '熊本', '大分',
                            '宮崎', '鹿児島', '中国', '四国', '九州'],
   'eew_forecast_regions_raw': [37, 38, 39, 40, 42, 43,
                                44, 45, 46, 47, 48, 49,
                                50, 51, 66, 67, 68],
   'information_type': '発表',
   'information_type_en': 'Issue',
   'information_type_no': 0,
   'long_period_ground_motion_lower_limit': None,
   'long_period_ground_motion_lower_limit_raw': 0,
   'long_period_ground_motion_upper_limit': None,
   'long_period_ground_motion_upper_limit_raw': 0,
   'magnitude': '7.2',
   'magnitude_raw': 72,
   'message': b'\xc6\xaf\x89\xa8 \x00\x03$\x00\x00P@\x05H\xc5\xe2\xc0\x00\x00\x00'
              b'\x03\xdf\xf8\x00\x1c\x00\x00\x11\x85D?\xc0',
   'message_header': '$QZQSM',
   'message_type': 'DCR',
   'nmea': '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05',
   'notifications_on_disaster_prevention': ['強い揺れに警戒してください。'],
   'notifications_on_disaster_prevention_raw': [201],
   'occurrence_time_of_earthquake': datetime.datetime(2024, 3, 10, 1, 0),
   'preamble': 'C',
   'raw': b'\xaf\x89\xa8 \x00\x03$\x00\x00P@\x05H\xc5\xe2\xc0\x00\x00\x00\x03'
          b'\xdf\xf8\x00\x1c\x00\x00\x10',
   'report_classification': '訓練/試験',
   'report_classification_en': 'Training/Test',
   'report_classification_no': 7,
   'report_time': datetime.datetime(2024, 3, 10, 1, 0),
   'satellite_id': 55,
   'satellite_prn': 183,
   'seismic_epicenter': '日向灘',
   'seismic_epicenter_raw': 791,
   'seismic_intensity_lower_limit': '震度6弱',
   'seismic_intensity_lower_limit_raw': 8,
   'seismic_intensity_upper_limit': '〜程度以上',
   'seismic_intensity_upper_limit_raw': 11,
   'sentence': '$QZQSM,55,C6AF89A820000324000050400548C5E2C000000003DFF8001C00001185443FC*05',
   'timestamp': datetime.datetime(2024, 6, 21, 15, 40, 34, 960948),
   'version': 1}
  ```
  重複して受信した同一情報のメッセージかどうかは等価演算子で判別できます。
  ```python
  >>> msg2 = '$QZQSM,55,9AAF89A820000324000050400548C5E2C000000003DFF8001C0000123FB3EB0*03'
  >>> report2 = azarashi.decode(msg2, 'nmea')
  >>> report == report2
  ```
  ```
  True
  ```

  ```python
  azarashi.decode_stream(stream, msg_type='nmea', callback=None, callback_args=(), callback_kwargs={}, unique=False, ignore_dcr=False, ignore_dcx=True)
  ```
  - `stream`: I/Oストリームを渡してください。デバイスファイルを `open()` して渡すときは、事前に stty コマンドで `ublox` なら `raw` モード、`nmea` ならデフォルト設定にしてください。pySerial つかうときは stty コマンドによる設定は不要です。
  - `msg_type`: デフォルトは `nmea` 、オプションとして `hex` または `ublox` を指定できます。
  - `callback`: メッセージをデコードしたあとに実行されるコールバック関数です。`None` の場合 `decode_stream()` はメッセージをデコードするたびに結果を返します。コールバック関数が与えられた場合 `decode_stream()` は例外が発生しない限り繰り返しメッセージをデコードし、そのたびにコールバック関数に結果を渡して実行します。下記はコールバック関数のインタフェースです。
  ```python
  callback(report, *callback_args, **callback_kwargs)
  ```
  - `calback_args`: コールバック関数に渡される引数です。
  - `callback_kwargs`: コールバック関数に渡されるキーワード引数です。
  - `unique`: 重複したメッセージを無視したいときは `True` を指定してください。
  - `ignore_dcr`: DCRメッセージを無視したいときは `True` を指定してください。デフォルトは `False` です。
  - `ignore_dcx`: DCXメッセージを無視したくないときは `False` を指定してください。デフォルトは `True` です。

  指定したデバイスファイルを読み込み、デコードしたレポートオブジェクトを `print()` に渡します。
  ```python
  >>> import azarashi
  >>> f = open('/dev/ttyS0', mode='r')
  >>> azarashi.decode_stream(f, msg_type='ublox', callback=print)
  ```

  この例外クラスは何らかの理由でデコードに失敗したときに送出されます。エラーメッセージを表示すると問題解決の一助となるでしょう。

  `NotImplementedError` を継承した例外クラスです。実験的な配信など、デコーダが対応していないメッセージを受け取ったときに送出されます。配信がはじまると騒々しいのでデバッグ以外ではこの例外を握りつぶしたほうがよいかもしれません。


  例外処理を加えた簡単なプログラムの例です。
  ```python
  import azarashi
  import sys

  def example():
      with open('/dev/ttyS0', mode='r') as f:
          while True:
              try:
                  azarashi.decode_stream(f, msg_type='ublox', callback=print)
              except azarashi.QzssDcrDecoderException as e:
                  print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
              except azarashi.QzssDcrDecoderNotImplementedError as e:
                  print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
              except EOFError as e:
                  print(f'{e}', file=sys.stderr)
                  return 0
              except Exception as e:
                  print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
                  return 1

  exit(example())
  ```

  [pySerial](https://pythonhosted.org/pyserial/) でシリアルポートを `open()` して `decode_stream()` に渡すこともできます。この方法では stty コマンドによる設定は不要です。
  ```python
  import azarashi
  import sys
  import serial
  import pprint

  def handler(report):
      pprint.pprint(report.get_params())

  def example():
      with serial.Serial('/dev/ttyS0', 9600) as ser:
          while True:
              try:
                  azarashi.decode_stream(ser, 'ublox', handler, unique=True)
              except azarashi.QzssDcrDecoderException as e:
                  print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
              except azarashi.QzssDcrDecoderNotImplementedError as e:
                  print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
              except EOFError as e:
                  print(f'{e}', file=sys.stderr)
                  return 0
              except Exception as e:
                  print(f'# [{type(e).__name__}] {e}', file=sys.stderr)
                  return 1

  exit(example())
  ```

  GPS アンテナは屋外や窓際に設置する必要があるため、それが実際にデータを処理する装置の近くとは限りません。そこでデータを UDP パケットに載せて再送するスクリプトを書きました。IPv4/IPv6 両方に対応しています。簡単な実装なので、ソースを参考に改造するベースにもよいと思います。

  送信側のスクリプトです。デフォルトでは IPv6 リンクローカルマルチキャストアドレスにパケットを送信します。宛先アドレスを指定したい場合は -d オプションを使用してください。
  ```shell
  $ python3 -m azarashi.network.transmitter -t ublox -f /dev/ttyS0
  ```
  なお、デバイスファイルの読込権限が足りず sudo コマンドを使って python3 インタプリタを実行するとき azarashi モジュールも sudo で実行される python3 環境にインストールされている必要があることに注意してください。あるいは次のように実行しても動作は同じです。
  ```shell
  $ sudo cat /dev/ttyS0 | python3 -m azarashi.network.transmitter -t ublox
  ```
  オプションは下記のとおりです。
  ```
  usage: transmitter.py [-h] [-d DST_HOST] [-p DST_PORT] [-t {hex,nmea,ublox}] [-f INPUT] [-u]

  azarashi network transmitter

  options:
    -h, --help            show this help message and exit
    -d DST_HOST, --dst-host DST_HOST
                          destination host (default: ff02::1)
    -p DST_PORT, --dst-port DST_PORT
                          destination port (default: 2112)
    -t {hex,nmea,ublox}, --msg-type {hex,nmea,ublox}
                          message type (default: ublox)
    -f INPUT, --input INPUT
                          input device (default: stdin)
    -u, --unique          supress duplicate messages (default: False)
  ```

  受信側のスクリプトです。
  ```shell
  $ python3 -m azarashi.network.receiver
  ```
  オプションは下記のとおりです。
  ```
  usage: receiver.py [-h] [-b BIND_ADDR] [-p BIND_PORT] [-i BIND_IFACE] [-v]

  azarashi network receiver

  optional arguments:
    -h, --help            show this help message and exit
    -b BIND_ADDR, --bind-addr BIND_ADDR
                          address to bind (default: ::)
    -p BIND_PORT, --bind-port BIND_PORT
                          port to bind (default: 2112)
    -i BIND_IFACE, --bind-iface BIND_IFACE
                          iface to bind (default: any)
    -v, --verbose         verbose mode (default: False)
  ```


  azarashi は DCX メッセージのデコードをサポートしています。下記は L-Alert をデコードする例です。
  ```python
  >>> import azarashi
  >>> msg = '$QZQSM,55,53B0604DE19524CDA305B2C1E355B57800000CCC000000000000001022A8188*7E' # l-alert
  >>> report = azarashi.decode(msg, 'nmea')
  >>> print(report)
  ```
  ```

  A1 - Message type: Alert
  A2 - Country/region name: Japan
  A3 - Provider identifier: Foundation for MultiMedia Communications
  A4 - Hazard category and type: MET - Rainfall
  A4 - Hazard definition: Rainfall greater than or equal to 50 mm in past 24 hours. Note: Precise threshold is according to each local standard.
  A5 - Severity: Severe - Significant threat to life or property
  A6A7 - Hazard onset: 2024-06-23 13:00:00
  A8 - Hazard duration: 6H <= Duration < 12H
  A11 - Guidance to react: Keep away from Water area.
  A11 - Guidance to react (ja): 離れろ。水場。
  A12 - Ellipse centre latitude: 35.688
  A13 - Ellipse centre longitude: 139.691
  A14 - Ellipse semi - major axis: 10.933
  A15 - Ellipse semi - minor axis: 5.979
  A16 - Ellipse azimuth: 45.0
  A17 - Specific settings: B1 - Improved Resolution of Main Ellipse
  C1 - Refined latitude of centre of main ellipse: 35.688
  C2 - Refined longitude of centre of main ellipse: 139.691
  C3 - Refined length of semi major axis: 10.933
  C4 - Refined length of semi minor axis: 5.979
  ```
  レポートオブジェクトからパラメータを取得するには `get_params()` メソッドを使います。
  ```python
  >>> from pprint import pprint
  >>> pprint(report.get_params(), sort_dicts=False)
  ```
  ```python
  {'sentence': '$QZQSM,55,53B0604DE19524CDA305B2C1E355B57800000CCC000000000000001022A8188*7E',
   'timestamp': datetime.datetime(2024, 6, 21, 15, 9, 5, 433111),
   'message': b'S\xb0`M\xe1\x95$\xcd\xa3\x05\xb2\xc1\xe3U\xb5x\x00\x00\x0c\xcc'
              b'\x00\x00\x00\x00\x00\x00\x00\x10"\xa8\x18\x80',
   'nmea': '$QZQSM,55,53B0604DE19524CDA305B2C1E355B57800000CCC000000000000001022A8188*7E',
   'message_header': '$QZQSM',
   'satellite_id': 55,
   'satellite_prn': 183,
   'raw': b'M\xe1\x95$\xcd\xa3\x05\xb2\xc1\xe3U\xb5x\x00\x00\x0c\xcc\x00\x00\x00'
          b'\x00\x00\x00\x00\x10',
   'preamble': 'A',
   'message_type': 'DCX',
   'camf': <azarashi.qzss_dcr_lib.decoder.qzss_dcx_decoder.QzssDcxDecoder.decode.<locals>.CAMF object at 0x1023af6a0>,
   'ignore_a12_to_a16': False,
   'ignore_a17_to_a18': False,
   'ignore_ex1': True,
   'ignore_ex2_to_ex7': True,
   'ignore_ex8_to_ex9': True,
   'satellite_designation_mask_type': 'MT44 is for Japan or for use outside Japan',
   'satellite_designation_mask': ['For Japan',
                                  'For Japan',
                                  'For Japan',
                                  'For Japan',
                                  'For Japan',
                                  'For use outside Japan',
                                  'For use outside Japan',
                                  'For Japan',
                                  'For Japan'],
   'dcx_message_type': 'L-Alert',
   'a1_message_type': 'Alert',
   'a2_country_region_name': 'Japan',
   'a3_provider_identifier': 'Foundation for MultiMedia Communications',
   'a4_hazard_category': 'MET',
   'a4_hazard_type': 'Rainfall',
   'a4_hazard_definition': 'Rainfall greater than or equal to 50 mm in past 24 '
                           'hours. Note: Precise threshold is according to each '
                           'local standard.',
   'a5_severity': 'Severe - Significant threat to life or property',
   'a6_hazard_onset_week': 'Current',
   'a7_hazard_onset_time_of_week': 'SUNDAY - 01:00 PM',
   'a6a7_hazard_onset_datetime': datetime.datetime(2024, 6, 23, 13, 0),
   'a8_hazard_duration': '6H <= Duration < 12H',
   'a9_selection_of_library': 'Country/region guidance library',
   'a10_library_version': '#1',
   'a11_japanese_library': 'Keep away from Water area.',
   'a11_japanese_library_ja': '離れろ。水場。',
   'a12_ellipse_centre_latitude': 35.6882581826505,
   'a13_ellipse_centre_longitude': 139.69085457500137,
   'a14_ellipse_semi_major_axis': 10.932758602420911,
   'a15_ellipse_semi_minor_axis': 5.978542029422428,
   'a16_ellipse_azimuth': 45.0,
   'a17_main_subject_for_specific_settings': 'B1 - Improved Resolution of Main '
                                             'Ellipse',
   'c1_refined_latitude_of_centre_of_main_ellipse': 35.6882581826505,
   'c2_refined_longitude_of_centre_of_main_ellipse': 139.69085457500137,
   'c3_refined_length_of_semi_major_axis': 10.932758602420911,
   'c4_refined_length_of_semi_minor_axis': 5.978542029422428,
   'dcx_version': 1}
  ```
  ビットフィールドの値は `report.camf` オブジェクトに格納されています。
  ```python
  print(report.camf.get_params())
  ```
  ```python
  {'sdmt': 0, 'sdm': 96, 'a1': 1, 'a2': 111, 'a3': 1, 'a4': 74, 'a5': 2, 'a6': 0, 'a7': 9421, 'a8': 2, 'a9': 1, 'a10': 0, 'a11': 773, 'a12': 45761, 'a13': 116395, 'a14': 13, 'a15': 11, 'a16': 48, 'a17': 0, 'a18': 0, 'ex1': 13104, 'ex2': 0, 'ex3': 0, 'ex4': 0, 'ex5': 0, 'ex6': 0, 'ex7': 0, 'ex8': 0, 'ex9': 7376896189632872448, 'ex10': 0, 'vn': 1, 'c1': 0, 'c2': 0, 'c3': 0, 'c4': 0}
  ```

  DCX メッセージのデコード結果が格納されるレポートオブジェクトは下記のとおりです。

  CAMF フィールドが空のメッセージです。SD フィールドを監視するために使用します。不要なら無視してください。
  ```python
  class QzssDcxNullMsg(QzssDcXtendedMessageBase)
  ```

  日本国外の機関から発報されたメッセージです。
  ```python
  class QzssDcxOutsideJapan(QzssDcXtendedMessageBase)
  ```

  ```python
  class QzssDcxLAlert(QzssDcXtendedMessageBase)
  ```

  ```python
  class QzssDcxJAlert(QzssDcXtendedMessageBase)
  ```

  ```python
  class QzssDcxMTInfo(QzssDcXtendedMessageBase)
  ```

  日本の未定義の機関から発報されたメッセージです。azarashi はこのメッセージを正確にデコードできないでしょう。デバッグの目的以外では無視してください。
  ```python
  class QzssDcxUnknown(QzssDcXtendedMessageBase)
  ```

  IS-QZSS-DCR-013、IS-QZSS-DCX-002 をサポートしています。


  ```
  [UnicodeDecodeError] 'utf-8' codec can't decode byte 0xNN in position XX: ~
  ```
  GPS モジュールと接続するインタフェースのボーレートが一致せず、壊れたビット列をデコードしようとして失敗していることが考えられます。ボーレートは例えば次のような値です。
  ```
  9600, 19200, 38400, 57600, 115200
  ```
  設定方法は GPS モジュール、stty または pySerial のマニュアルを参照してください。

  CLI でストリームを受けていた azarashi は、書き込み側がクローズすると Encountered EOF と stderr に出力して終了します。これは正常な動作です。その直前までエラーなく動作していたと解釈してください。

  DCX メッセージの SD フィールドを監視する必要があるとき `decode.stream()` メソッドの `unique` オプションは指定しないでください。`unique` オプションを指定したとき、重複した DCX メッセージかどうかを判断するために SD フィールドの差異は考慮されません。SD フィールドが異なるメッセージでも CAMF フィールドが同じメッセージは同一とみなされます。したがって SD フィールドのみが異なるメッセージを取りこぼす可能性があり SD フィールドの変化を正確に監視できません。


  イシュー報告、プルリクエスト、コメント等、なんでもよいのでフィードバックお待ちしています。星をもらうと開発が活発になります。


pkgId: b261e98c40f0ac310f871d8c1b506e2566179f75c1c5432d5a55bebee9c0d952
name: python-azauthlib
arch: src
version: 1.0.0b1
epoch: 0
release: 1
url: https://github.com/cedricmoorejr/azauthlib/tree/v1.0.0b1
rpm_license: Apache Software License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azauthlib-1.0.0b1-1.src.rpm
checksum_type: sha256
summary:
  A Python library simplifying Azure Microsoft Graph authentication. Provides an intuitive interface for acquiring access tokens through interactive login, silent authentication, device code flow, and client credentials flow. Includes utilities for seamless token storage and refresh management.

description:
  <div align="center">

  > **Your Simplified Authentication Companion for Azure Microsoft Graph**
  </div>
  `azauthlib` is a Python library that **streamlines the authentication process** with Azure Microsoft Graph. From interactive logins to client credentials flow, `azauthlib` provides an intuitive interface, robust token management, and a GUI for seamless configuration.
  🔐 Whether you're building applications that interact with Microsoft Graph APIs or automating workflows, `azauthlib` has you covered.
  ![Microsoft REST API](https://img.shields.io/badge/Powered%20by-Microsoft%20REST%20APIs-blue)
  ![Release Date](https://img.shields.io/github/release-date/cedricmoorejr/azauthlib)
  ![Azure](https://img.shields.io/badge/Cloud-Azure-blue?logo=microsoft-azure)
  ![Language](https://img.shields.io/badge/language-python-blue)
  ![License](https://img.shields.io/github/license/cedricmoorejr/azauthlib)
  ![PyPI](https://img.shields.io/pypi/v/azauthlib)
  ![Static Badge](https://img.shields.io/badge/status-beta-yellow)
  ![OAuth 2.0](https://img.shields.io/badge/OAuth-2.0-blue)
  ![Version](https://img.shields.io/github/v/release/cedricmoorejr/azauthlib)
  ![Azure AD](https://img.shields.io/badge/Azure%20Active%20Directory-Integration-blue?logo=microsoft)
  ![OpenID Connect](https://img.shields.io/badge/OpenID%20Connect-Supported-green)
  ![Azure DevOps](https://img.shields.io/badge/DevOps-Azure-blue?logo=azure-devops)
  ![Docs](https://img.shields.io/badge/docs-complete-brightgreen)
  ![Microsoft Graph](https://img.shields.io/badge/Microsoft%20Graph-API-blue?logo=microsoft)


pkgId: c37f37a66d01511a132744791586f5cb422682905e4c0241e89778b65670e80a
name: python-azblob
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: Download Azure blobs.
url: https://github.com/plang85/azblob
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azblob-1.0.0-1.src.rpm
checksum_type: sha256
description:
  [![PyPI version](https://badge.fury.io/py/azblob.svg)](https://badge.fury.io/py/azblob)
  [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)


  One-line CLI to download from Azure blob storage. Supports private blobs.




  To install:

  ```
  $ pip install azblob
  ```




  **Anonymous** access, account name from command line
  ```
  $ azblob -n account_url download my_container my_blob
  ```
  where `account_url` is e.g. `https://<storage name>.blob.core.windows.net`
  **Anonymous** access, account name from environment
  ```
  $ export AZBLOB_ACCOUNTNAME=account_url
  $ azblob download my_container my_blob
  ```

  **Private** container, credentials from command line
  ```
  $ azblob -n account_url -k my_key download my_container my_blob
  ```

  **Private** container, credentials from environment
  ```
  $ export AZBLOB_ACCOUNTNAME=account_url
  $ export AZBLOB_ACCOUNTKEY=my_key
  $ azblob download my_container my_blob
  ```


  Same authentication mechanism. List blobs in `my_container`
  ```
  azblob list my_container
  ```

  and, as always
  ```
  $ azblob -h
  $ azblob download -h
  $ azblob list -h
  ```


pkgId: 7085d4a3d66641f59eebd7897eb4bfbf2690024e0281544c80679a0743bb1f06
name: python-azcausal
arch: src
version: 0.2.4.2
epoch: 0
release: 1
summary: Casual Inference
url: https://github.com/amazon-science/azcausal
rpm_license: Apache License 2.0
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azcausal-0.2.4.2-1.src.rpm
checksum_type: sha256
description:
  Causal inference is an important component of the experiment evaluation. We highly recommend to have a look at the open-source
  book: `Causal Inference for The Brave and True <https://matheusfacure.github.io/python-causality-handbook/landing-page.html>`_
  Please find the software documentation here: https://amazon-science.github.io/azcausal/latest/
  Currently, azcausal provides two well-known and widely used causal inference methods: Difference-in-Difference (DID) and
  Synthetic Difference-in-Difference (SDID). Moreover, error estimates via Placebo, Boostrap, or JackKnife are available.
  Installation
  ********************************************************************************
  To install the current release, please execute:
      pip install git+https://github.com/amazon-science/azcausal.git
  Usage
  ********************************************************************************
      from azcausal.core.error import JackKnife
      from azcausal.core.panel import CausalPanel
      from azcausal.data import CaliforniaProp99
      from azcausal.estimators.panel.sdid import SDID
      from azcausal.util import to_panels
      
      df = CaliforniaProp99().df()
      
      data = to_panels(df, 'Year', 'State', ['PacksPerCapita', 'treated'])
      ctypes = dict(outcome='PacksPerCapita', time='Year', unit='State', intervention='treated')
      
      panel = CausalPanel(data).setup(**ctypes)
      
      estimator = SDID()
      
      result = estimator.fit(panel)
      
      estimator.error(result, JackKnife())
      
      estimator.plot(result)
      
      print(result.summary(title="CaliforniaProp99"))
      ╭──────────────────────────────────────────────────────────────────────────────╮
      |                               CaliforniaProp99                               |
      ├──────────────────────────────────────────────────────────────────────────────┤
      |                                    Panel                                     |
      |  Time Periods: 31 (19/12)                                  total (pre/post)  |
      |  Units: 39 (38/1)                                       total (contr/treat)  |
      ├──────────────────────────────────────────────────────────────────────────────┤
      |                                     ATT                                      |
      |  Effect (±SE): -15.60 (±2.9161)                                              |
      |  Confidence Interval (95%): [-21.32 , -9.8884]                          (-)  |
      |  Observed: 60.35                                                             |
      |  Counter Factual: 75.95                                                      |
      ├──────────────────────────────────────────────────────────────────────────────┤
      |                                  Percentage                                  |
      |  Effect (±SE): -20.54 (±3.8393)                                              |
      |  Confidence Interval (95%): [-28.07 , -13.02]                           (-)  |
      |  Observed: 79.46                                                             |
      |  Counter Factual: 100.00                                                     |
      ├──────────────────────────────────────────────────────────────────────────────┤
      |                                  Cumulative                                  |
      |  Effect (±SE): -187.25 (±34.99)                                              |
      |  Confidence Interval (95%): [-255.83 , -118.66]                         (-)  |
      |  Observed: 724.20                                                            |
      |  Counter Factual: 911.45                                                     |
      ╰──────────────────────────────────────────────────────────────────────────────╯
  Estimators
  ********************************************************************************
  - **Difference-in-Difference (DID):** Simple implementation of the well-known Difference-in-Difference estimator.
  - **Synthetic Difference-in-Difference (SDID):** Arkhangelsky, Dmitry Athey, Susan Hirshberg, David A. Imbens, Guido W. Wager, Stefan Synthetic Difference-in-Differences American Economic Review 111 12 4088-4118 2021 10.1257/aer.20190159 https://www.aeaweb.org/articles?id=10.1257/aer.20190159. Implementation based on https://synth-inference.github.io/synthdid/
  Contact
  ********************************************************************************
  Feel free to contact me if you have any questions:
  | `Julian Blank <http://julianblank.com>`_  (blankjul [at] amazon.com)
  | Amazon.com
  | Applied Scientist, Amazon
  | 410 Terry Ave N, Seattle 98109, WA.


pkgId: 85bef5fa833bd0e00aee3fa975028ef50f4262f17e0acd178b0aabbc54248968
name: python-azdocgen
arch: src
version: 0.1.2
epoch: 0
release: 1
summary: A simple Azure Pipeline documentation generator
url: https://pypi.org/project/azdocgen/
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azdocgen-0.1.2-1.src.rpm
checksum_type: sha256
description:
  [![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/)
  ![publish workflow](https://github.com/gianfa/azdocgen/actions/workflows/publish.yml/badge.svg?branch=main)
  [![PyPI version](https://img.shields.io/pypi/v/azdocgen.svg)](https://pypi.org/project/azdocgen/)
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

  AZDocGen is a Python-based tool to automatically generate detailed documentation for Azure Pipelines YAML files. It extracts key details, such as *triggers*, *variables*, *resources*, *stages*, *jobs*, *steps*, and *conditions*, and outputs structured Markdown documentation, including Mermaid diagrams for a visual summary of the pipeline.



  You can install AZDocGen via `pip` or `poetry`.



  ```bash
  pip install azdocgen
  ```



  ```bash
  poetry add azdocgen
  ```





  You can use AZDocGen directly from the command line to generate documentation for an Azure Pipelines YAML file.

  ```bash
  azdocgen <pipeline_yaml_path> <output_md_path>
  ```



  ```bash
  azdocgen azure-pipelines.yml docs/azure-pipelines-docs.md
  ```

  This will parse the `azure-pipelines.yml` file and generate the documentation in the `docs/azure-pipelines-docs.md` file.



  You can also use AZDocGen as a Python library to generate documentation programmatically.



  ```python
  import yaml
  from azdocgen.generate_doc import generate_markdown
  from azdocgen.triggers import parse_triggers
  from azdocgen.variables import parse_variables
  from azdocgen.resources import parse_resources
  from azdocgen.stages import parse_stages


  pipeline_file = "azure-pipelines.yml"
  output_file = "docs/azure-pipelines-docs.md"

  with open(pipeline_file, "r") as f:
      yaml_content = yaml.safe_load(f)


  triggers = parse_triggers(yaml_content)
  variables = parse_variables(yaml_content)
  resources = parse_resources(yaml_content)
  stages = parse_stages(yaml_content)


  generate_markdown(
      triggers=triggers,
      variables=variables,
      stages=stages,
      resources=resources,
      output_file=output_file,
      pipeline_file=pipeline_file,
  )

  print(f"Documentation written to {output_file}")
  ```



  - **Triggers**: Extracts branch and tag triggers.
  - **Variables**: Documents variables defined in the pipeline.
  - **Resources**: Lists repositories, containers, and pipeline dependencies.
  - **Stages, Jobs, and Steps**: Provides a hierarchical breakdown of the pipeline.
  - **Conditions**: Includes all conditions at stage, job, and step levels.
  - **Mermaid Diagrams**: Generates visual workflows.



  Contributions are welcome! Please follow these steps:

  1. Fork this repository.
  2. Create a feature branch: `git checkout -b feature/my-feature`.
  3. Commit your changes: `git commit -m 'Add my feature'`.
  4. Push to the branch: `git push origin feature/my-feature`.
  5. Submit a pull request.



  AZDocGen is licensed under the MIT License. See `LICENSE` for more details.


pkgId: 2d8191f378a2b4eac188b5496e78d2e8f72f153da2cdc3108372c7d8c6f8c493
name: python-azdsdr
arch: src
version: 1.230612.2
epoch: 0
release: 1
summary: This package provide functions and tools for accessing data in a easy way.
url: https://github.com/xhinker/azdsdr
rpm_license: Apache License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azdsdr-1.230612.2-1.src.rpm
checksum_type: sha256
description:
  * Add `bar1_chart` in `vis_tools`, so that you can plot bar chart using `vis_tools` class.

  * Add `Grid` and `XY Axes Lable` option for 1 line and 2 lines chart.

  * Add walk-around and solutions to potential installation errors.

  * Add `show_data_label` option for `vis_tools`'s `line1_chart` function.
  If specify the `show_data_label=True`, the chart will show each data point's value.

  * Add guid to the temp cosmos script file and temp middle stream file to avoid temp files collision.

  * Add function `get_table_schema` for `KustoReader`
  * Add function `get_table_folder` for `KustoReader`

  * Update Dremio Reader configuration document and screenshot.

  * Add function `download_file_list` of class `AzureBlobReader` to download a list of CSV file with the same schema and merge to one target CSV file.
  * Add function `delete_blob_files` of class `AzureBlobReader` to delete a list of blob files.
  * Add [usage sample code](https://github.com/xhinker/azdsdr/tree/main/usage_examples).


pkgId: 74d8b2ce72e5bbdce82f2f1f66188e9a71c4c2c31d6b7a56f7be43b142b0b5f5
name: python-azfs
arch: src
version: 0.2.14
epoch: 0
release: 1
summary: AzFS is to provide convenient Python read/write functions for Azure Storage Account.
url: https://github.com/gsy0911/azfs
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azfs-0.2.14-1.src.rpm
checksum_type: sha256
description:
  [![pytest](https://github.com/gsy0911/azfs/workflows/pytest/badge.svg)](https://github.com/gsy0911/azfs/actions?query=workflow%3Apytest)
  [![codecov](https://codecov.io/gh/gsy0911/azfs/branch/master/graph/badge.svg)](https://codecov.io/gh/gsy0911/azfs)
  [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/gsy0911/azfs.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/gsy0911/azfs/context:python)
  [![Documentation Status](https://readthedocs.org/projects/azfs/badge/?version=latest)](https://azfs.readthedocs.io/en/latest/?badge=latest)


  [![PythonVersion](https://img.shields.io/badge/python-3.6|3.7|3.8-blue.svg)](https://www.python.org/downloads/release/python-377/)
  [![PiPY](https://img.shields.io/pypi/v/azfs.svg)](https://pypi.org/project/azfs/)
  [![Downloads](https://pepy.tech/badge/azfs)](https://pepy.tech/project/azfs)

  AzFS is to provide convenient Python read/write functions for Azure Storage Account.

  `AzFS` can

  * list files in blob (also with wildcard `*`),
  * check if file exists,
  * read csv as pd.DataFrame, and json as dict from blob,
  * write pd.DataFrame as csv, and dict as json to blob.



  ```bash
  $ pip install azfs
  ```



  For `Blob` Storage.


  ```python
  import azfs
  from azure.identity import DefaultAzureCredential
  import pandas as pd


  azc = azfs.AzFileClient()


  credential = "[your storage account credential]"

  credential = DefaultAzureCredential()
  azc = azfs.AzFileClient(credential=credential)


  connection_string = "DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx;EndpointSuffix=core.windows.net"
  azc = azfs.AzFileClient(connection_string=connection_string)


  csv_path = "https://testazfs.blob.core.windows.net/test_caontainer/test_file.csv"


  df = azc.read_csv(csv_path, index_col=0)

  with azc:
      df = pd.read_csv_az(csv_path, header=None)



  azc.write_csv(path=csv_path, df=df)

  with azc:
      df.to_csv_az(path=csv_path, index=False)


  csv_pattern_path = "https://testazfs.blob.core.windows.net/test_caontainer/*.csv"
  df = azc.read().csv(csv_pattern_path)


  df = azc.read().apply(function=lambda x: x[x['id'] == 'AAA']).csv(csv_pattern_path)


  df = azc.read(use_mp=True).apply(function=lambda x: x[x['id'] == 'AAA']).csv(csv_pattern_path)
  ```

  For `Queue` Storage

  ```python
  import azfs
  queue_url = "https://{storage_account}.queue.core.windows.net/{queue_name}"

  azc = azfs.AzFileClient()
  queue_message = azc.get(queue_url)




  queue_content = queue_message.get('content')

  ```

  For `Table` Storage

  ```python

  import azfs
  cons = {
      "account_name": "{storage_account_name}",
      "account_key": "{credential}",
      "database_name": "{database_name}"
  }

  table_client = azfs.TableStorageWrapper(**cons)


  table_client.put(id_="1", message="hello_world")


  table_client.get(id_="1")

  ```

  check more details in  [![Documentation Status](https://readthedocs.org/projects/azfs/badge/?version=latest)](https://azfs.readthedocs.io/en/latest/?badge=latest)



  Supported authentication types are
  * [Azure Active Directory (AAD) token credential](https://docs.microsoft.com/azure/storage/common/storage-auth-aad).
  * connection_string, like `DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxx;EndpointSuffix=core.windows.net`



  The table below shows if `AzFS` provides read/write functions for the storage.


  | account kind | Blob | Data Lake | Queue | File | Table |
  |:--|:--:|:--:|:--:|:--:|:--:|
  | StorageV2 | O | O | O | X | O |
  | StorageV1 | O | O | O | X | O |
  | BlobStorage | O | - | - | - | - |

  * O: provides basic functions
  * X: not provides
  * -: storage type unavailable



  ```
  pandas
  azure-identity >= "1.3.1"
  azure-storage-blob >= "12.3.0"
  azure-storage-file-datalake >= "12.0.0"
  azure-storage-queue >= "12.1.1"
  azure-cosmosdb-table
  ```




  * [azure-sdk-for-python/storage](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/storage)
  * [filesystem_spec](https://github.com/intake/filesystem_spec)


pkgId: 87af7cdb3d49c5f2740a70fc775295d78f337951bd5a4af10a4740f1d63e50d1
name: python-azimuth-sdk
arch: src
version: 0.2.0
epoch: 0
release: 1
summary: SDK for the Azimuth API
url: https://github.com/azimuth-cloud/azimuth-sdk
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azimuth-sdk-0.2.0-1.src.rpm
checksum_type: sha256
description:
  An SDK for interacting with [Azimuth](https://github.com/azimuth-cloud/azimuth) resources using
  [Python](https://www.python.org/).

  Both synchronous use and asynchronous use, using the `async/await` syntax from
  [asyncio](https://docs.python.org/3/library/asyncio.html), are supported.



  The Azimuth SDK can be installed from PyPI:

  ```sh
  pip install azimuth-sdk
  ```



  To begin using the Azimuth SDK, you must first create a configuration object that defines how
  to authenticate with Azimuth.

  Currently, authentication with Azimuth uses [OpenStack](https://www.openstack.org/) credentials.
  Azimuth supports two user-facing authentication methods:

    * Username + Password
    * [Keystone federation](https://docs.openstack.org/keystone/latest/admin/federation/introduction.html)

  The Keystone federation flow requires a browser, so is not supported by the Azimuth SDK.

  Azimuth also supports authenticating with an
  [application credential](https://docs.openstack.org/keystone/latest/user/application_credentials.html).
  This authentication method is usually hidden from browser-based users, but is available for use
  by the SDK. **This is the recommended authentication method.**

  The SDK `Configuration` object can be initialised either using known credentials or from a
  [clouds.yaml file](https://docs.openstack.org/python-openstackclient/pike/configuration/index.html).
  The Azimuth SDK respects the same `OS_CLOUD` and `OS_CLIENT_CONFIG_FILE` environment variables that
  the [OpenStack CLI](https://docs.openstack.org/python-openstackclient/latest/) respects.

  ```python
  from azimuth_sdk import Configuration


  AZIMUTH_URL = "https://portal.azimuth.example.org"


  config = Configuration.create(
      AZIMUTH_URL,
      authenticator = "appcred",
      auth_data = {
          "application_credential_id": "<application credential id>",
          "application_credential_secret": "<application credential secret>",
      },
      
      default_tenancy_id = "<tenancy id>"
  )


  config = Configuration.from_openstack_clouds_file(
      AZIMUTH_URL,
      "/path/to/openstack/clouds.yaml"
  )


  config = Configuration.from_environment(AZIMUTH_URL)
  ```

  Once you have a `Configuration` object, it can be used to create either synchronous or
  asynchronous clients with which you can interact with Azimuth, e.g. by listing the
  available tenancies:

  ```python

  with config.sync_client() as client:
      for tenancy in client.tenancies().list():
          print(tenancy.name)


  async with config.async_client() as client:
      async for tenancy in client.tenancies().list():
          print(tenancy.name)
  ```

  > **WARNING**
  >
  > It is important that the client is used inside a `with` or `async with` block, for
  > synchronous or asynchronous clients respectively, as this ensures that resources
  > are set up and released as required.
  >
  > See Python's [contextlib](https://docs.python.org/3/library/contextlib.html) for more information.

  You can then interact with resources for a tenancy. The following resources are available:

  ```python

  client.images(tenancy_id = None)

  client.sizes(tenancy_id = None)

  client.volumes(tenancy_id = None)

  client.external_ips(tenancy_id = None)

  client.machines(tenancy_id = None)

  client.cluster_types(tenancy_id = None)

  client.clusters(tenancy_id = None)

  client.kubernetes_cluster_templates(tenancy_id = None)

  client.kubernetes_clusters(tenancy_id = None)

  client.kubernetes_app_templates(tenancy_id = None)

  client.kubernetes_apps(tenancy_id = None)
  ```

  For each of these methods, the `tenancy_id` is optional. If it is not given, a default
  tenancy ID will be used, which is determined as follows:

    * Explicitly set when the `Configuration` is created
    * From `clouds.{cloud}.auth.project_id` in the `clouds.yaml`, if present
    * As the first available tenancy in the tenancy list (may not be deterministic)

  The default tenancy for a client can also be changed using the `switch_tenancy` method:

  ```python
  client.switch_tenancy(new_tenancy_id)
  ```

  Each of these returns a `Resource` object, which can be interacted with as follows.

  > **NOTE**
  >
  > The sync methods are available on resources produced by synchronous clients
  > (i.e. created using `config.sync_client`), and the
  > async methods on resources produced by asynchronous clients
  > (i.e. created using `config.async_client`).

  ```python


  for instance in resource.list():
      print(instance)

  async for instance in resource.list():
      print(instance)



  instance = resource.first()

  instance = await resource.first()



  instance = resource.fetch("<id>")

  instance = await resource.fetch("<id>")



  instance = resource.create({"name": "my-instance", "<prop>": "<value>"})

  instance = await resource.create({ "name": "my-instance", "<prop>": "<value>"})



  instance = resource.replace("<id>", {"name": "my-instance", "<prop>": "<value>"})

  instance = await resource.replace("<id>", {"name": "my-instance", "<prop>": "<value>"})



  instance = resource.patch("<id>", {"<prop>": "<value>"})

  instance = await resource.patch("<id>", {"<prop>": "<value>"})



  instance = resource.create_or_replace("<id>", {"name": "my-instance", "<prop>": "<value>"})

  instance = await resource.create_or_replace("<id>", {"name": "my-instance", "<prop>": "<value>"})



  instance = resource.create_or_patch("<id>", {"<prop>": "<value>"})

  instance = await resource.create_or_patch("<id>", {"<prop>": "<value>"})



  instance = resource.delete("<id>")

  instance = await resource.delete("<id>")
  ```


pkgId: 59ccbf2471dc6f39c5f4f035fb6e3a39d355f35429563e949197f92cc982e4bf
name: python-azkaban
arch: src
version: 0.9.14
epoch: 0
release: 1
summary: AzkabanCLI: a lightweight command line interface for Azkaban.
url: http://azkabancli.readthedocs.org/
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azkaban-0.9.14-1.src.rpm
checksum_type: sha256
description:
  A lightweight [Azkaban][] client providing:

  * A command line interface to run workflows, upload projects, etc.
  * A convenient and extensible way for building projects.



  Below is a simple configuration file for a project containing a workflow with
  three jobs:

  ```python
  from azkaban import Job, Project
  from getpass import getuser

  PROJECT = Project('sample')


  PROJECT.properties = {
    'user.to.proxy': getuser(),
  }


  JOBS = {
    'first': Job({'type': 'command', 'command': 'echo "Hello"'}),
    'second': Job({'type': 'command', 'command': 'echo "World"'}),
    'third': Job({'type': 'noop', 'dependencies': 'first,second'}),
  }

  for name, job in JOBS.items():
    PROJECT.add_job(name, job)
  ```

  The [examples][] directory contains another sample project that uses Azkaban
  properties to build a project with two configurations: production and test,
  without any job duplication.



  The full documentation can be found [here][doc].



  Using [pip][]:

  ```sh
  $ pip install azkaban
  ```



  Run tests:

  ```sh
  $ nosetests
  ```

  To also run the integration tests against an Azkaban server, create
  `~/.azkabanrc` that includes at least:

  ```cfg
  [azkaban]
  test.alias = local

  [alias.local]
  url = azkaban:azkaban@http://localhost:8081
  ```

  [Azkaban]: http://data.linkedin.com/opensource/azkaban
  [doc]: http://azkabancli.readthedocs.org/
  [examples]: https://github.com/mtth/azkaban/tree/master/examples
  [pip]: http://www.pip-installer.org/en/latest/


pkgId: 76ae5f405ea146f8cfb89a4e618ce9e3b0eb73a5599f23311767962faf5c5ab1
name: python-azlocal
arch: src
version: 0.0.5
epoch: 0
release: 1
summary: 'azlocal' - Thin wrapper around 'az' to use with Localstack
url: https://pypi.org/project/azlocal/
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azlocal-0.0.5-1.src.rpm
checksum_type: sha256
description:
  "azlocal" - Thin wrapper around "az" to use with Localstack


  azlocal login
  azlocal storage account list



  azlocal -h

rpm_license:
[cell repeats an earlier one in this file: 10254 characters]


pkgId: feae44763a981176cdb16266c6c99ed85c25428eeb9dcdcfd33f5ff3be12ef9a
name: python-azol
arch: src
version: 0.2.4b1
epoch: 0
release: 1
summary: A python-based pentesting library for Azure and Entra ID
url: https://github.com/cdburkard/azol
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azol-0.2.4b1-1.src.rpm
checksum_type: sha256
description:
  A python-based pentesting library for Azure and Entra ID



  Install the library using Python3 pip:

  ```pip install azol```



  Log in as a user and get all subscriptions:

  ```
  from azol.credentials import User
  from azol.clients import ArmClient

  cred = User(username="user@domain.com")
  armClient = ArmClient(tenant="tenant.com", cred=cred)

  subscriptions=armClient.get_subscriptions()

  for sid in subscriptions:
    print(sid)
  ```

  Log in as a Service Principal and get all groups, with owners

  ```
  from pprint import pprint
  from azol.credentials import ServicePrincipal
  from azol.clients import GraphClient

  cred = ServicePrincipal(client_id="00000000-0000-0000-0000-000000000000", client_secret="your secret" )

  GraphClient = GraphClient(tenant="tenant.com", cred=cred)

  groups=GraphClient.get_all_groups_and_owners()

  for group in groups:
    pprint(group)

  ```


pkgId: 50d75e9be2e5e2e7fdc774945e4fd12c1b837152fdf1600e306f53f2390ccdd0
name: python-azol
arch: src
version: 0.2.7
epoch: 0
release: 1
summary: A python-based pentesting library for Azure and Entra ID
url: https://github.com/cdburkard/azol
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azol-0.2.7-1.src.rpm
checksum_type: sha256
description:
  A python-based pentesting library for Azure and Entra ID



  Install the library using Python3 pip:

  ```pip install azol```



  Log in as a user and get all subscriptions:

  ```
  from azol.credentials import User
  from azol.clients import ArmClient

  cred = User(username="user@domain.com")
  arm_client = ArmClient(tenant="tenant.com", cred=cred)

  subscriptions=arm_client.get_subscriptions()

  for sub_id in subscriptions:
    print(sub_id)
  ```

  Log in as a Service Principal and get all groups, with owners

  ```
  from pprint import pprint
  from azol.credentials import ServicePrincipal
  from azol.clients import GraphClient

  cred = ServicePrincipal(client_id="00000000-0000-0000-0000-000000000000", client_secret="your secret" )

  graph_client = GraphClient(tenant="tenant.com", cred=cred)

  groups=graph_client.get_all_groups_and_owners()

  for group in groups:
    pprint(group)

  ```

  Log in as a user to their default tenant, but use an interactive signin. Get all tenants the user belongs to.

  ```
  from azol import *

  cred=User("user@domain.com")
  arm_client=ArmClient(cred=cred, oauth_flow="authorization_code")

  tenants=arm_client.get_tenants()

  for tenant in tenants:
    print(tenant["defaultDomain"])

  ```


pkgId: ef5010881f20d646d6b3dfca7cc8d0012ecf4efc4cff00aa0a014e2771285eec
name: python-azotea
arch: src
version: 0.3.39
epoch: 0
release: 1
summary: ('command line tool to reduce DSLR RAW images',)
url: https://guaix.ucm.es/AZOTEA
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azotea-0.3.39-1.src.rpm
checksum_type: sha256
description:
  Pipeline Python de reducción de datos para [AZOTEA](https://guaix.ucm.es/AZOTEA) (Astronomía Zenital desde el hOgar en Tiempos de Extremo Aislamiento).

  Esta es una herramienta de línea de comandos.



  AZOTEA es un programa que lleva una pequeña base de datos incorporada para recordar los valores medidos y el estado de procesamiento de las imagenes. El usuario nunca trata con la base de datos directamente sino que actua con comandos. Las imagenes nunca se modifican ni se cambian de lugar y tipicamente se genera una sesion de procesado con el lote de imágenes del directorio de trabajo. Lo habitual sería un directorio por día lleno de imagenes.

  Los datos de interés se guardan en la base de datos y a partir de ellos se generan ficheros para publicar o compartir.

  Si la base de datos se corrompe o se borra, para recuperar su contenido habría que correr el pipeline de reduccióm de imágenes con todos los directorios que se hayan generado, cosa no siempre posible. Por ello se incluyen comandos de backup de la base de datos.

  El pipeline de AZOTEA consta de los siguientes pasos en secuencia:

  * Registro de las imágenes en la base de datos
  * Calculo de estadístcas en la región de interés (ROI) (media y varianza)
  * Clasificacion de las imagenes den LIGHT y DARK para la sustracción de cuadro oscuro
  * Elaboración de un DARK maestro por cada directorio de trabajo si es que hay imágenes de tipo DARK y sustracción del nivel de oscuro a las tomas de tipo LIGHT.
  * Exportación de los resultados de la sesion de reducción. En la actualidad sólo se soporta un solo formato de tipo CSV

  Todos estos pasos se efectuan secuencialmente con `azotea image reduce`
  Opcionalmente se puede invocar `azotea image export ` sin especificar directorio de trabajo para exportar en un sencillo CSV todas las seisones de reducción.



  Instalar primero ***Python 3*** y su herramienta `pip`. Esta suele venir incluida en Linux y MacOS pero no así en Windows. Una vez que tenemos esto, se instala AZOTEA como sigue:

  ```bash
  pip install --user azotea
  ```

  Para actualizar a la última versión de AZOTEA, teclear:

  ```bash
  pip install --user -U azotea
  ```


  Comprobar la version instalada

  ```bash
  ~$ azotea --version
  ```

  ```
  azotea 0.3.0
  ```




  AZOTEA necesita Python 3.6 o superior.
  AZOTEA *No es compatible con Python 2*






  Antes de poder operar con AZOTEA hay que crear un fichero de configuración para el observador.
  La primera vez que se vaya a usar azotea, se puede hacer lo siguiente:

  ```bash
  ~$ azotea init
  ```


  La inicialización creará:
  * Un directorio  `$HOME/azotea/` donde se irán colocando ficheros de configuración, logs, informes CSV, etc.
  * un fichero `azotea.ini` en el directorio `$HOME/azotea/config` de cada usuario.

  ***IMPORTANTE***: Editar el fichero con un block de notas o similar. Los campos son descriptivos y no debería haber ningin problema al rellenarlos.




  AZOTEA se irá actualizando a medida que soporte más cámaras.

  Los modelos de camara soportados hasta el momento se pueden ver listando el fichero de configuracion interno

  ```bash
  azotea config camera --list
  ```

  ***Uso Avanzado, no recomendado***: Si hay necesidad de crar una entrada más a este fichero, se puede hacer una copia de él y luego editarlo de manera análoga a la configuración global. Este fichero no es para todo el mundo, sólo los que entienden cómo funciona el software deben hacerlo.


  ```bash
  azotea config camera --create
  ```

  ```
  2020-04-01 19:25:12,998 [INFO] Created /home/rafa/azotea/config/camera.ini file
  ```

  Para probar la cámara comn este nuevo fichero en todos los comandos `azotea` posteriores hay que especificarlo como opción global antes de los comandos. Ejemplo:


  ```bash
  azotea --camera /home/rafa/azotea/config/camera.ini image reduce --work-dir <directorio>
  ```





  Para observadores impacientes que quieren reducir la observación una noche en un directorio.

  1. Configurado el fichero `azotea.ini`, que debe residir en `$HOME/azotea/azotea.ini`

  2. Volcar *todas* las imagenes de la cámara de una misma noche a un directorio de trabajo (p.e. `/home/rafa/demo/test`)

  3. Si hay tomas *dark*, renombrar dichas tomas a `dark_<nombre original>`

  4. ¡Por fin! ejecutar en una linea de comandos:

  ```bash
  azotea image reduce --work-dir <directorio donde están las imágenes>
  ```

  Si se desea detalle del proceso, ejecutar en su lugar

  ```bash
  azotea --verbose image reduce --work-dir <directorio donde están las imágenes>
  ```



  1. Primera inicializacion

  ```bash
  ~$ azotea init
  ```

  ```
  2020-04-16 11:02:38,937 [INFO] Creating /home/rafa/azotea directory
  2020-04-16 11:02:38,939 [INFO] Creating /home/rafa/azotea/config directory
  2020-04-16 11:02:38,939 [INFO] Creating /home/rafa/azotea/dbase directory
  2020-04-16 11:02:38,939 [INFO] Creating /home/rafa/azotea/backup directory
  2020-04-16 11:02:38,940 [INFO] Creating /home/rafa/azotea/log directory
  2020-04-16 11:02:38,940 [INFO] Created /home/rafa/azotea/config/azotea.ini file, please review it
  2020-04-16 11:02:38,940 [INFO] Created database file /home/rafa/azotea/dbase/azotea.db
  2020-04-16 11:02:39,375 [INFO] Created data model from schema.sql
  2020-04-16 11:02:39,376 [INFO] Populating data model from auxiliar.sql
  ```

  2. Reorganizacion de un lote de observaciones de varias noches

  ```bash
   ~$ azotea reorganize images --input-dir todas_mis_observaciones --output-dir zamorano
  ```

  ```
  2020-04-08 11:53:43,826 [INFO] Read 6 images
  2020-04-08 11:53:43,826 [INFO] Creating 2 output directories
  2020-04-08 11:53:43,826 [INFO] Copying images to output directories
  2020-04-08 11:53:43,885 [INFO] Copied 6 images
  ```

  3. Reducción separada de una noche

  ***Noche del 25 al 26 de Marzo de 2020***

  ```bash
  ~$ azotea image reduce --work-dir zamorano/2020-03-25
  ```

  ```
  2020-04-16 11:15:45,112 [INFO] Created data model from schema.sql
  2020-04-16 11:15:45,113 [INFO] Populating data model from auxiliar.sql
  2020-04-16 11:15:45,313 [INFO] Opening configuration file /home/rafa/azotea/config/azotea.ini
  2020-04-16 11:15:45,315 [INFO] Found 3 candidates matching filter *.*
  2020-04-16 11:15:45,316 [INFO] ==> Start reduction session, id = 20200416091545
  2020-04-16 11:15:45,449 [INFO] Registered 3 images in database
  2020-04-16 11:15:45,579 [INFO] 3 new images registered in database
  2020-04-16 11:15:45,579 [INFO] 0 images deleted from database
  2020-04-16 11:15:45,579 [INFO] Computing image statistics
  2020-04-16 11:15:46,757 [INFO] Statistics for 3 images done
  2020-04-16 11:15:46,846 [INFO] Classifying images
  2020-04-16 11:15:46,901 [INFO] Classified 3 images
  2020-04-16 11:15:46,902 [INFO] No dark frame found for current working directory
  2020-04-16 11:15:46,903 [INFO] Saved data to session CSV file /home/rafa/azotea/csv/-session-2020-03-25.csv
  ```

  La observacion de la noches se deja bajo la carpeta `$HOME/azotea/csv/` en el fichero CSV `session-2020-03-25.csv`. Se puede especificar en la línea de comandos una ruta distinta para este fichero.


  4. Obtencion de un fichero global CSV con todas las mediciones de todas las sesiones de reduccion de datos

  ```bash
  ~$ azotea image export
  ```

  ```
  2020-04-08 11:58:33,750 [INFO] Saved data to global CSV file /home/rafa/azotea/csv/azotea.csv
  ```


  5. Volver a reprocesar un directorio

  Si hemos cambiado la region de interes en el fichero config.ini,
  debemos reprocesar los directorios que nos interese, especificando la opcion --reset.


  ```bash
  ~$ azotea image reduce --reset --work-dir zamorano/2020-03-25
  ```



  Si tenemos todas las imagenes de varias noches en un mismo directorio, es *MUY RECOMENDABLE* organizarlas en subdirectorios con las imagenes de una misma noche en cada subdirectorio. Esto puede haberse hecho de origen por el programa de adqusisción de la cámara, pero si no es así, AZOTEA puede hacerlo mirando la fecha de exposición de los datos EXIF de cada imagen.

  ```bash
  ~$ azotea reorganize images --input-dir zamorano/toidas_mis_observaciones --output-dir zamorano/clasificadas
  ~$ ls zamorano/clasificadas
  ```

  Ahora podemos reducir todas las noches de observación con una orden simple

  ```bash
  ~$ azotea image reduce --work-dir zamorano/clasificadas
  ```

  Se generará un fichero CSV por noche de observación




  AZOTEA viene información de cómo decodificar los canales RGB de cámaras conocidas hasta la fecha.
  AZOTEA se irá actualizando a medida que se van probando más cámaras.
  Sin embargo, para ir añadiendo camaras no conocidas hasta la fecha a un fichero, se puede crear un fichero.

  ```bash
  azotea config camera --create
  emacs ~$/azotea/config/camera.ini
  ```



  Por defecto AZOTEA saca unas trazas por consola con breve información de lo que va haciendo. Si se desea más detalle se puede especificar la opción `--verbose` (abreviado `-v`). Por el contrario, se puede tambien omitir las trazas (excepto las de error y aviso) con la opción `--quiet` (abreviado `-q`)

  ```bash
  azotea --verbose <comando> <subcomando>
  ```

  Las trazas de consola reducción de datos puede además capturarse a un fichero

  ```bash
  azotea image reduce --log-file <ruta del fichero de log> [otras opciones del subcomando reduce]
  ```

  Para la ejecución automatizada bajo un trabajo planificado (ej. cron de Linux), se pueden deshabilitar las trazas de consola y habilitar las de fichero

  ```bash
  azotea image reduce --multiuser --no-console --log-file <ruta fichero log>  --work-dir <ruta dir>
  ```



  Para una reducción automatizada de todas las observaciones de todos los usuarios hay que hacer un trabajo organizativo previo por cada observador.



  1. Preparar su fichero exclusivo de configuracion global y colocarlo en $HOME/azotea/config/

  ```bash
  cp $HOME/azotea/config/azotea.ini $HOME/azotea/config/jizquierdo.ini
  emacs $HOME/azotea/config/jizquierdo.ini
  ```

  2. Recolectar las imágenes de los observadores cada una en un direcorio distinto


  ```bash
  mkdir contribuciones/jizquierdo
  ```

  Es ***requisito*** que el nombre del directorio sea ***igual*** al del fichero de configuracion, sin el sufijo `.ini`


  3. Reorganizar las imagenes de cada observacion por noche de observacion

  Puede que ya las tengamos separadas en directporios de observacion de origen, peor si no es así, se puede ejecutar lo siguiente:

  ```bash
  azotea reorganize images --input-dir contribuciones/jizquierdo --output-dir clasificadas/jizquierdo
  ls clasificadas/jizquierdo
  ```

  Una vez finalizados estos pasos, ya se puede proceder a la reduccipn automatizada.



  Reducir las imágenes de todos los observadores

  ```
  azotea image reduce --multiuser --work-dir clasificadas
  ```

  Con el indicador `--multiuser` AZOTEA ira navegando por los subdirectorios de directorio de trabajo especificado (`clasificadas`) y tomara dischos nombres de subdirectorio como nombres de fichero .ini a cargar
  Y efectuará uan reducción de varias noches de observación por cada usuario




  AZOTEA tiene otros comandos para
  1. efectuar y listar backups de la base de datos
  2. limpiar o recrear la base de datos desde cero.



  El pipeline de reducción genera dos ficheros CSV:

  * Un fichero global CSV donde se van acumulando todos los datos de todos los lotes procesados hasta el momento: `azotea.csv`

  * Un fichero CSV con los resultados de la reducción del último lote. Si el lote solo abarca un directorio de trabajo, el nombre será `session-<directorio de trabajo>.csv`. Si el lote comprende varios directorios de trabajo, el fichero incluye el identificador del lote, no el directorio de trabajo `session-YYYYMMDDHHMMSS.csv` (Ejemplo: `session-20200402103223.csv`)


  Ambos ficheros se situan en la el directorio raiz (`$HOME`) de cada usuario.

  El fichero CSV tiene una cabecera con los nombres de las columnas, a saber:


  |    Columna      |  Descripcion                                           |
  |:---------------:|:-------------------------------------------------------|
  | session         | Id. de sesion de reducción de datos (YYYYMMDDHHMMSS).  |
  | observer        | Nombre del observador.                                 |
  | organization    | Organizacion a la que pertenece el observador.         |
  | location        | Localidad desde donde ha sido tomada la imagen.        |
  | type            | Tipo de imagen (LIGHT/DARK)                            |
  | tstamp          | Fecha y hora de la imagen, formato ISO 8601            |
  | name            | Nombre de la imagen (=nombre del fichero sin la ruta.) |
  | model           | Modelo de cámara.                                      |
  | ISO             | Sensibilidad ISO de la toma.                           |
  | roi             | Region de interés [x1:x2, y1:y2]                       |
  | dark_roi        | Region de interes para medida oscura [x1:x2, y1:y2]    |
  | exptime         | Tiempo de exposicion                                   |
  | mean_signal_R1  | Promedio de señal canal R.                             |
  | stdev_signal_R1 | Desviación tipica señal del canal R.                   |
  | mean_signal_G2  | Promedio de señal en un canal G.                       |
  | stdev_signal_G2 | Desviación tipica de señal en un canal G.              |
  | mean_signal_G3  | Promedio de señal en el otro canal G.                  |
  | stdev_signal_G3 | Desviación tipica de señal en el otro canal G.         |
  | mean_signal_B4  | Promedio de señal del canal B.                         |
  | stdev_signal_B4 | Desviación tipica señal del canal B.                   |



  1. Version del programa

  ```bash
  azotea --version
  ```

  2. Comandos

  La lista de comandos soportados por AZOTEA puede ir cambiando con las versiones. Aún así siempre se podrán averiguar todos con la opcion --help en cada nivel.


  La invocación de AZOTEA tiene la forma general de:

  ```
  azotea [--opcion1, --opcion2, ...] <comando>  <subcomando> [--opcion3, --opcion4, ...]
  ```

  Cada comando y subcomando dentro del comando tienen su propia ayuda:

  ```bash
  azotea --help
  azotea <comando> --help
  azotea <comando> <subcomando> --help
  ```

  Ejemplos:

  ```bash
  azotea --help
  azotea image --help
  azotea image list --help
  ```


pkgId: 7febd00749139c949a71667a15859e017d4a762b56375ba99c488bba5f78f427
name: python-aztk
arch: src
version: 0.10.3
epoch: 0
release: 1
summary: On-demand, Dockerized, Spark Jobs on Azure (powered by Azure Batch)
url: https://github.com/Azure/aztk
rpm_license: MIT
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-aztk-0.10.3-1.src.rpm
checksum_type: sha256
description:
  Azure Distributed Data Engineering Toolkit (AZTK) is a python CLI application for provisioning on-demand Spark on Docker clusters in Azure. It's a cheap and easy way to get up and running with a Spark cluster, and a great tool for Spark users who want to experiment and start testing at scale.

  This toolkit is built on top of Azure Batch but does not require any Azure Batch knowledge to use.


  - Spark cluster provision time of 5 minutes on average
  - Spark clusters run in Docker containers
  - Run Spark on a GPU enabled cluster
  - Users can bring their own Docker image
  - Ability to use low-priority VMs for an 80% discount
  - Mixed Mode clusters that use both low-priority and dedicated VMs
  - Built in support for Azure Blob Storage and Azure Data Lake connection
  - [Tailored pythonic experience with PySpark, Jupyter, and Anaconda](https://github.com/Azure/aztk/wiki/PySpark-on-Azure-with-AZTK)
  - [Tailored R experience with SparklyR, RStudio-Server, and Tidyverse](https://github.com/Azure/aztk/wiki/SparklyR-on-Azure-with-AZTK)
  - Ability to run _spark submit_ directly from your local machine's CLI



  1. Install `aztk` with pip:
  ```bash
      pip install aztk
  ```
  2. Initialize the project in a directory. This will automatically create a *.aztk* folder with config files in your working directory:
  ```bash
      aztk spark init
  ```
  3. Login or register for an [Azure Account](https://azure.microsoft.com), navigate to [Azure Cloud Shell](https://shell.azure.com), and run:
  ```sh
  wget -q https://raw.githubusercontent.com/Azure/aztk/v0.10.3/account_setup.sh -O account_setup.sh &&
  chmod 755 account_setup.sh &&
  /bin/bash account_setup.sh
  ```

  4. Follow the on screen prompts to create the necessary Azure resources and copy the output into your `.aztk/secrets.yaml` file. For more information see [Getting Started Scripts](./01-Getting-Started-Script).




  The core experience of this package is centered around a few commands.

  ```sh

  aztk spark cluster create
  aztk spark cluster add-user
  ```
  ```sh

  aztk spark cluster get
  aztk spark cluster list
  aztk spark cluster delete
  ```
  ```sh

  aztk spark cluster ssh
  aztk spark cluster submit
  ```



  First, create your cluster:
  ```bash
  aztk spark cluster create --id my_cluster --size 5 --vm-size standard_d2_v2
  ```
  - See our available VM sizes [here.](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/sizes)
  - The `--vm-size` argument must be the official SKU name which usually come in the form: "standard_d2_v2"
  - You can create [low-priority VMs](https://docs.microsoft.com/en-us/azure/batch/batch-low-pri-vms) at an 80% discount by using `--size-low-pri` instead of `--size`
  - By default, AZTK runs Spark 2.2.0 on an Ubuntu16.04 Docker image. More info [here](/docker-image)
  - By default, AZTK will create a user (with the username **spark**) for your cluster
  - The cluster id (`--id`) can only contain alphanumeric characters including hyphens and underscores, and cannot contain more than 64 characters.
  - By default, you cannot create clusters of more than 20 cores in total. Visit [this page](https://docs.microsoft.com/en-us/azure/batch/batch-quota-limit#view-batch-quotas) to request a core quota increase.

  More information regarding using a cluster can be found in the [cluster documentation](./docs/10-clusters.md)


  To check your cluster status, use the `get` command:
  ```bash
  aztk spark cluster get --id my_cluster
  ```



  When your cluster is ready, you can submit jobs from your local machine to run against the cluster. The output of the spark-submit will be streamed to your local console. Run this command from the cloned AZTK repo:
  ```bash
  // submit a java application
  aztk spark cluster submit \
      --id my_cluster \
      --name my_java_job \
      --class org.apache.spark.examples.SparkPi \
      --executor-memory 20G \
      path\to\examples.jar 1000

  // submit a python application
  aztk spark cluster submit \
      --id my_cluster \
      --name my_python_job \
      --executor-memory 20G \
      path\to\pi.py 1000
  ```
  - The `aztk spark cluster submit` command takes the same parameters as the standard [`spark-submit` command](https://spark.apache.org/docs/latest/submitting-applications.html), except instead of specifying `--master`, AZTK requires that you specify your cluster `--id` and a unique job `--name`
  - The job name, `--name`, argument must be at least 3 characters long
      - It can only contain alphanumeric characters including hyphens but excluding underscores
      - It cannot contain uppercase letters
  - Each job you submit **must** have a unique name
  - Use the `--no-wait` option for your command to return immediately

  Learn more about the spark submit command [here](./docs/20-spark-submit.md)


  Most users will want to work interactively with their Spark clusters. With the `aztk spark cluster ssh` command, you can SSH into the cluster's master node. This command also helps you port-forward your Spark Web UI and Spark Jobs UI to your local machine:
  ```bash
  aztk spark cluster ssh --id my_cluster --user spark
  ```
  By default, we port forward the Spark Web UI to *localhost:8080*, Spark Jobs UI to *localhost:4040*, and the Spark History Server to *localhost:18080*.

  You can configure these settings in the *.aztk/ssh.yaml* file.

  NOTE: When working interactively, you may want to use tools like Jupyter or RStudio-Server. To do so, you need to setup your cluster with the appropriate docker image and plugin. See [Plugins](./docs/15-plugins.md) for more information.



  You can also see your clusters from the CLI:
  ```
  aztk spark cluster list
  ```

  And get the state of any specified cluster:
  ```
  aztk spark cluster get --id <my_cluster_id>
  ```

  Finally, you can delete any specified cluster:
  ```
  aztk spark cluster delete --id <my_cluster_id>
  ```


  - [How do I connect to Azure Storage (WASB)?](./docs/30-cloud-storage.md)
  - [I want to use a different version of Spark](./docs/12-docker-image.md)
  - [How do I SSH into my Spark cluster's master node?](./docs/10-clusters.md#ssh-and-port-forwarding)
  - [How do I interact with my Spark cluster using a password instead of an SSH-key?](./docs/10-clusters.md#interactive-mode)
  - [How do I change my cluster default settings?](./docs/13-configuration.md)
  - [How do I modify my *spark-env.sh*, *spark-defaults.conf* or *core-site.xml* files?](./docs/13-configuration.md)
  - [How do I use GPUs with AZTK](./docs/60-gpu.md)
  - [I'm a python user and want to use PySpark, Jupyter, Anaconda packages, and have a Pythonic experience.](https://github.com/Azure/aztk/wiki/PySpark-on-Azure-with-AZTK)
  - [I'm a R user and want to use SparklyR, RStudio, Tidyverse packages, and have an R experience.](https://github.com/Azure/aztk/wiki/SparklyR-on-Azure-with-AZTK)


  You can find more documentation [here](./docs)


pkgId: ecf249da43a71cbf366d7c4df793f7ad803638abcad5ba11296f97fa4aa32712
name: python-azula
arch: src
version: 0.2.4
epoch: 0
release: 1
summary: Diffusion models in PyTorch
url: https://pypi.org/project/azula/
rpm_license: None
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azula-0.2.4-1.src.rpm
checksum_type: sha256
description:
  ![Azula's banner](https://raw.githubusercontent.com/probabilists/azula/master/docs/images/banner.svg)



  Azula is a Python package that implements diffusion models in [PyTorch](https://pytorch.org). Its goal is to unify the different formalisms and notations of the generative diffusion models literature into a single, convenient and hackable interface.

  > In the [Avatar](https://wikipedia.org/wiki/Avatar:_The_Last_Airbender) cartoon, [Azula](https://wikipedia.org/wiki/Azula) is a powerful fire and lightning bender ⚡️



  The `azula` package is available on [PyPI](https://pypi.org/project/azula), which means it is installable via `pip`.

  ```
  pip install azula
  ```

  Alternatively, if you need the latest features, you can install it from the repository.

  ```
  pip install git+https://github.com/probabilists/azula
  ```



  In Azula's formalism, a diffusion model is the composition of three elements: a noise schedule, a denoiser and a sampler.

  * A noise schedule is a mapping from a time $t \in [0, 1]$ to the signal scale $\alpha_t$ and the noise scale $\sigma_t$ in a perturbation kernel $p(X_t \mid X) = \mathcal{N}(X_t \mid \alpha_t X_t, \sigma_t^2 I)$ from a "clean" random variable $X \sim p(X)$ to a "noisy" random variable $X_t$.

  * A denoiser is a neural network trained to predict $X$ given $X_t$.

  * A sampler defines a series of transition kernels $q(X_s \mid X_t)$ from $t$ to $s < t$ based on a noise schedule and a denoiser. Simulating these transitions from $t = 1$ to $0$ samples approximately from $p(X)$.

  This formalism is closely followed by Azula's API.

  ```python
  from azula.denoise import PreconditionedDenoiser
  from azula.noise import VPSchedule
  from azula.sample import DDPMSampler


  schedule = VPSchedule()


  denoiser = PreconditionedDenoiser(
      backbone=CustomNN(in_features=5, out_features=5),
      schedule=schedule,
  )


  optimizer = torch.optim.Adam(denoiser.parameters(), lr=1e-3)

  for x in train_loader:
      t = torch.rand((batch_size,))

      loss = denoiser.loss(x, t).mean()
      loss.backward()

      optimizer.step()
      optimizer.zero_grad()


  sampler = DDPMSampler(denoiser.eval(), steps=1000)

  x1 = sampler.init((64, 5))
  x0 = sampler(x1)
  ```

  Alternatively, Azula's plugin interface allows to load pre-trained models and use them with the same convenient interface.

  ```python
  import sys

  sys.path.append("path/to/guided-diffusion")

  from azula.plugins import adm
  from azula.sample import DDIMSampler


  denoiser = adm.load_model("imagenet_256x256")


  sampler = DDIMSampler(denoiser, steps=64).cuda()

  x1 = sampler.init((4, 3 * 256 * 256))
  x0 = sampler(x1)

  images = torch.clip((x0 + 1) / 2, min=0, max=1).reshape(4, 3, 256, 256)
  ```

  For more information, check out the documentation and tutorials at [azula.readthedocs.io](https://azula.readthedocs.io).



  If you have a question, an issue or would like to contribute, please read our [contributing guidelines](https://github.com/probabilists/azula/blob/master/CONTRIBUTING.md).


pkgId: 64600b137500bef8527b364cffe8f26b519d61a7d9bf1befb0937e118187b6dd
name: python-azure-activation-service
arch: src
version: 0.1.0
epoch: 0
release: 1
summary: Auto Activate Azure Roles
url: https://pypi.org/project/azure-activation-service/
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-activation-service-0.1.0-1.src.rpm
checksum_type: sha256
description:
  Auto Activate Azure Roles

  The tool works as a companion to the MSRA Intern's Tool.

  ```bash

  aas list-roles  # refresh role list
  aas import-config  # import auto-renew config from MSRA Intern's Tool
  ass auto-activate  # auto activate roles
  ass generate-service  # generate user service
  systemctl --user enable azure-pim-activator  # enable user service
  loginctl enable-linger $USER  # to keep user service active
  ```

  The tool reads and stores everything in `$AZURE_CONFIG_DIR`, so if you are working with multiple users you can do the above operations with different `$AZURE_CONFIG_DIR`.

rpm_license:
  MIT License  Copyright (c) 2024 NCJ  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: 9a55b8ee3ccbcb182a6a2d43c63bfdd3c95d0ee557488c4a0d6c329644436622
name: python-azure-ai-anomalydetector
arch: src
version: 3.0.0b6
epoch: 0
release: 1
summary: Microsoft Cognitive Services Anomaly Detector Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-anomalydetector-3.0.0b6-1.src.rpm
checksum_type: sha256
description:
  [Anomaly Detector](https://learn.microsoft.com/azure/cognitive-services/Anomaly-Detector/overview) is an AI service with a set of APIs, which enables you to monitor and detect anomalies in your time series data with little machine learning (ML) knowledge, either batch validation or real-time inference.





  - Python 3.7 or later is required to use this package.
  - You need an [Azure subscription][azure_sub] to use this package.
  - An existing Cognitive Services Anomaly Detector instance.



  ```bash
  python -m pip install azure-ai-anomalydetector
  ```

  > Note: This version of the client library defaults to the `3.0.0b6` version of the service.

  This table shows the relationship between SDK versions and supported API versions of the service:

  |SDK version|Supported API version of service |
  |-------------|---------------|
  |3.0.0b6 | 1.1|
  |3.0.0b4, 3.0.0b5| 1.1-preview-1|
  |3.0.0b3 | 1.1-preview|
  |3.0.0b1, 3.0.0b2  | 1.0 |





  You can find the endpoint for your Anomaly Detector service resource using the
  [Azure Portal](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesAnomalyDetector)
  or [Azure CLI](https://learn.microsoft.com/cli/azure/):

  ```bash

  az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint"
  ```



  You can get the **API Key** from the Anomaly Detector service resource in the Azure Portal.
  Alternatively, you can use **Azure CLI** snippet below to get the API key of your resource.

  ```PowerShell
  az cognitiveservices account keys list --resource-group <your-resource-group-name> --name <your-resource-name>
  ```



  Once you have the value for the API key, you can pass it as a string into an instance of **AzureKeyCredential**. Use the key as the credential parameter
  to authenticate the client:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.anomalydetector import AnomalyDetectorClient

  credential = AzureKeyCredential("<api_key>")
  client = AnomalyDetectorClient(endpoint="https://<resource-name>.cognitiveservices.azure.com/", credential=credential)
  ```



  With the Anomaly Detector, you can either detect anomalies in one variable using **Univariate Anomaly Detection**, or detect anomalies in multiple variables with **Multivariate Anomaly Detection**.

  |Feature  |Description  |
  |---------|---------|
  |Univariate Anomaly Detection | Detect anomalies in one variable, like revenue, cost, etc. The model was selected automatically based on your data pattern. |
  |Multivariate Anomaly Detection| Detect anomalies in multiple variables with correlations, which are usually gathered from equipment or other complex system. The underlying model used is Graph attention network.|



  The Univariate Anomaly Detection API enables you to monitor and detect abnormalities in your time series data without having to know machine learning. The algorithms adapt by automatically identifying and applying the best-fitting models to your data, regardless of industry, scenario, or data volume. Using your time series data, the API determines boundaries for anomaly detection, expected values, and which data points are anomalies.

  Using the Anomaly Detector doesn't require any prior experience in machine learning, and the REST API enables you to easily integrate the service into your applications and processes.

  With the Univariate Anomaly Detection, you can automatically detect anomalies throughout your time series data, or as they occur in real-time.

  |Feature  |Description  |
  |---------|---------|
  | Streaming detection| Detect anomalies in your streaming data by using previously seen data points to determine if your latest one is an anomaly. This operation generates a model using the data points you send, and determines if the target point is an anomaly. By calling the API with each new data point you generate, you can monitor your data as it's created. |
  | Batch detection | Use your time series to detect any anomalies that might exist throughout your data. This operation generates a model using your entire time series data, with each point analyzed with the same model.         |
  | Change points detection | Use your time series to detect any trend change points that exist in your data. This operation generates a model using your entire time series data, with each point analyzed with the same model.    |



  The **Multivariate Anomaly Detection** APIs further enable developers by easily integrating advanced AI for detecting anomalies from groups of metrics, without the need for machine learning knowledge or labeled data. Dependencies and inter-correlations between up to 300 different signals are now automatically counted as key factors. This new capability helps you to proactively protect your complex systems such as software applications, servers, factory machines, spacecraft, or even your business, from failures.

  With the Multivariate Anomaly Detection, you can automatically detect anomalies throughout your time series data, or as they occur in real-time. There are three processes to use Multivariate Anomaly Detection.

  - **Training**: Use Train Model API to create and train a model, then use Get Model Status API to get the status and model metadata.
  - **Inference**:
    - Use Async Inference API to trigger an asynchronous inference process and use Get Inference results API to get detection results on a batch of data.
    - You could also use Sync Inference API to trigger a detection on one timestamp every time.
  - **Other operations**: List Model API and Delete Model API are supported in Multivariate Anomaly Detection model for model management.



  We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads.



  The following section provides several code snippets covering some of the most common Anomaly Detector service tasks, including:

  - [Univariate Anomaly Detection - Batch detection](#batch-detection)
  - [Univariate Anomaly Detection - Streaming detection](#streaming-detection)
  - [Univariate Anomaly Detection - Detect change points](#detect-change-points)
  - [Multivariate Anomaly Detection](#multivariate-anomaly-detection-sample)



  ```python
  from azure.ai.anomalydetector import AnomalyDetectorClient
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.anomalydetector.models import *


  SUBSCRIPTION_KEY = os.environ["ANOMALY_DETECTOR_KEY"]
  ANOMALY_DETECTOR_ENDPOINT = os.environ["ANOMALY_DETECTOR_ENDPOINT"]
  TIME_SERIES_DATA_PATH = os.path.join("sample_data", "request-data.csv")
  client = AnomalyDetectorClient(ANOMALY_DETECTOR_ENDPOINT, AzureKeyCredential(SUBSCRIPTION_KEY))

  series = []
  data_file = pd.read_csv(TIME_SERIES_DATA_PATH, header=None, encoding="utf-8", parse_dates=[0])
  for index, row in data_file.iterrows():
      series.append(TimeSeriesPoint(timestamp=row[0], value=row[1]))

  request = UnivariateDetectionOptions(
      series=series,
      granularity=TimeGranularity.DAILY,
  )


  if any(response.is_anomaly):
      print("An anomaly was detected at index:")
      for i, value in enumerate(response.is_anomaly):
          if value:
              print(i)
  else:
      print("No anomalies were detected in the time series.")

  ```



  ```python
  from azure.ai.anomalydetector import AnomalyDetectorClient
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.anomalydetector.models import *


  SUBSCRIPTION_KEY = os.environ["ANOMALY_DETECTOR_KEY"]
  ANOMALY_DETECTOR_ENDPOINT = os.environ["ANOMALY_DETECTOR_ENDPOINT"]
  TIME_SERIES_DATA_PATH = os.path.join("sample_data", "request-data.csv")
  client = AnomalyDetectorClient(ANOMALY_DETECTOR_ENDPOINT, AzureKeyCredential(SUBSCRIPTION_KEY))

  series = []
  data_file = pd.read_csv(TIME_SERIES_DATA_PATH, header=None, encoding="utf-8", parse_dates=[0])
  for index, row in data_file.iterrows():
      series.append(TimeSeriesPoint(timestamp=row[0], value=row[1]))

  request = UnivariateDetectionOptions(
      series=series,
      granularity=TimeGranularity.DAILY,
  )
  print("Detecting the anomaly status of the latest data point.")

  if response.is_anomaly:
      print("The latest point is detected as anomaly.")
  else:
      print("The latest point is not detected as anomaly.")
  ```



  ```python
  from azure.ai.anomalydetector import AnomalyDetectorClient
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.anomalydetector.models import *


  SUBSCRIPTION_KEY = os.environ["ANOMALY_DETECTOR_KEY"]
  ANOMALY_DETECTOR_ENDPOINT = os.environ["ANOMALY_DETECTOR_ENDPOINT"]
  TIME_SERIES_DATA_PATH = os.path.join("sample_data", "request-data.csv")
  client = AnomalyDetectorClient(ANOMALY_DETECTOR_ENDPOINT, AzureKeyCredential(SUBSCRIPTION_KEY))

  series = []
  data_file = pd.read_csv(TIME_SERIES_DATA_PATH, header=None, encoding="utf-8", parse_dates=[0])
  for index, row in data_file.iterrows():
      series.append(TimeSeriesPoint(timestamp=row[0], value=row[1]))

  request = UnivariateChangePointDetectionOptions(
      series=series,
      granularity=TimeGranularity.DAILY,
  )


  if any(response.is_change_point):
      print("An change point was detected at index:")
      for i, value in enumerate(response.is_change_point):
          if value:
              print(i)
  else:
      print("No change point were detected in the time series.")

  ```



  To see how to use Anomaly Detector library to conduct Multivariate Anomaly Detection, see this [sample](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/anomalydetector/azure-ai-anomalydetector/samples/sample_multivariate_detect.py).

  To get more details of Anomaly Detector package, refer to this [azure.ai.anomalydetector package](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-ai-anomalydetector/latest/azure.ai.anomalydetector.html#).





  Anomaly Detector client library will raise exceptions defined in [Azure Core](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html#module-azure.core.exceptions).



  This library uses the standard [logging](https://docs.python.org/3/library/logging.html) library for logging.

  Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level.

  Detailed `DEBUG` level logging, including request/response bodies and **unredacted**
  headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.

  See full SDK logging documentation with examples [here](https://learn.microsoft.com/azure/developer/python/sdk/azure-sdk-logging).



  Optional keyword arguments can be passed in at the client and per-operation level.
  The azure-core [reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html) describes available configurations for retries, logging, transport protocols, and more.



  These code samples show common scenario operations with the Azure Anomaly Detector library. More samples can be found under the [samples](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/anomalydetector/azure-ai-anomalydetector/samples/) directory.

  - Univariate Anomaly Detection - Batch Detection: [sample_detect_entire_series_anomaly.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/anomalydetector/azure-ai-anomalydetector/samples/sample_detect_entire_series_anomaly.py)

  - Univariate Anomaly Detection - Streaming Detection: [sample_detect_last_point_anomaly.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/anomalydetector/azure-ai-anomalydetector/samples/sample_detect_last_point_anomaly.py)

  - Univariate Anomaly Detection - Change Point Detection: [sample_detect_change_point.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/anomalydetector/azure-ai-anomalydetector/samples/sample_detect_change_point.py)

  - Multivariate Anomaly Detection: [sample_multivariate_detect.py](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/anomalydetector/azure-ai-anomalydetector/samples/sample_multivariate_detect.py)



  For more extensive documentation on Azure Anomaly Detector, see the [Anomaly Detector documentation](https://learn.microsoft.com/azure/cognitive-services/anomaly-detector/overview) on docs.microsoft.com.



  This project welcomes contributions and suggestions. Most contributions require
  you to agree to a Contributor License Agreement (CLA) declaring that you have
  the right to, and actually do, grant us the rights to use your contribution.
  For details, visit [CLA homepage](https://cla.microsoft.com).

  When you submit a pull request, a CLA-bot will automatically determine whether
  you need to provide a CLA and decorate the PR appropriately (e.g., label,
  comment). Simply follow the instructions provided by the bot. You will only
  need to do this once across all repos using our CLA.

  This project has adopted the
  [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
  see the Code of Conduct FAQ or contact opencode@microsoft.com with any
  additional questions or comments.

  <!-- LINKS -->
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [azure_sub]: https://azure.microsoft.com/free/


pkgId: b8ec330ec85a7edd5086ac7e4ade46611c5ede136cc1a1926aa7fb397a1adfd4
name: python-azure-ai-contentsafety
arch: src
version: 1.0.0
epoch: 0
release: 1
summary: Microsoft Azure AI Content Safety Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-contentsafety-1.0.0-1.src.rpm
checksum_type: sha256
description:
  [Azure AI Content Safety][contentsafety_overview] detects harmful user-generated and AI-generated content in applications and services. Content Safety includes text and image APIs that allow you to detect material that is harmful:

  * Text Analysis API: Scans text for sexual content, violence, hate, and self-harm with multi-severity levels.
  * Image Analysis API: Scans images for sexual content, violence, hate, and self-harm with multi-severity levels.
  * Text Blocklist Management APIs: The default AI classifiers are sufficient for most content safety needs; however, you might need to screen for terms that are specific to your use case. You can create blocklists of terms to use with the Text API.



  Various documentation is available to help you get started

  - [API reference documentation][api_reference_docs]
  - [Product documentation][product_documentation]





  - Python 3.7 or later is required to use this package.
  - You need an [Azure subscription][azure_sub] to use this package.
  - An [Azure AI Content Safety][contentsafety_overview] resource, if no existing resource, you could [create a new one](https://aka.ms/acs-create).



  ```bash
  pip install azure-ai-contentsafety
  ```





  You can find the endpoint for your Azure AI Content Safety service resource using the [Azure Portal][azure_portal] or [Azure CLI][azure_cli_endpoint_lookup]:

  ```bash

  az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint"
  ```



  To use an API key as the `credential` parameter.

  - Step 1: Get the API key.
  The API key can be found in the [Azure Portal][azure_portal] or by running the following [Azure CLI][azure_cli_key_lookup] command:

      ```bash
      az cognitiveservices account keys list --name "<resource-name>" --resource-group "<resource-group-name>"
      ```

  - Step 2: Pass the key as a string into an instance of `AzureKeyCredential`.

      ```python
      from azure.core.credentials import AzureKeyCredential
      from azure.ai.contentsafety import ContentSafetyClient, BlocklistClient

      endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
      credential = AzureKeyCredential("<api_key>")
      content_safety_client = ContentSafetyClient(endpoint, credential)
      blocklist_client = BlocklistClient(endpoint, credential)
      ```



  - Step 1: Enable Microsoft Entra ID for your resource.
      Please refer to this document [Authenticate with Microsoft Entra ID][authenticate_with_microsoft_entra_id] for the steps to enable Microsoft Entra ID for your resource.

      The main steps are:
    - Create resource with a custom subdomain.
    - Create Service Principal and assign Cognitive Services User role to it.

  - Step 2: Set the values of the client ID, tenant ID, and client secret of the Microsoft Entra application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.

    DefaultAzureCredential will use the values from these environment variables.

      ```python
      from azure.identity import DefaultAzureCredential
      from azure.ai.contentsafety import ContentSafetyClient, BlocklistClient

      endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
      credential = DefaultAzureCredential()
      content_safety_client = ContentSafetyClient(endpoint, credential)
      blocklist_client = BlocklistClient(endpoint, credential)
      ```





  There are different types of analysis available from this service. The following table describes the currently available APIs.

  |Feature  |Description  |
  |---------|---------|
  |Text Analysis API|Scans text for sexual content, violence, hate, and self-harm with multi-severity levels.|
  |Image Analysis API|Scans images for sexual content, violence, hate, and self-harm with multi-severity levels.|
  | Text Blocklist Management APIs|The default AI classifiers are sufficient for most content safety needs. However, you might need to screen for terms that are specific to your use case. You can create blocklists of terms to use with the Text API.|



  Content Safety recognizes four distinct categories of objectionable content.

  |Category|Description|
  |---------|---------|
  |Hate |Hate and fairness-related harms refer to any content that attacks or uses pejorative or discriminatory language with reference to a person or identity group based on certain differentiating attributes of these groups including but not limited to race, ethnicity, nationality, gender identity and expression, sexual orientation, religion, immigration status, ability status, personal appearance, and body size.|
  |Sexual |Sexual describes language related to anatomical organs and genitals, romantic relationships, acts portrayed in erotic or affectionate terms, pregnancy, physical sexual acts, including those portrayed as an assault or a forced sexual violent act against one's will, prostitution, pornography, and abuse.|
  |Violence |Violence describes language related to physical actions intended to hurt, injure, damage, or kill someone or something; describes weapons, guns and related entities, such as manufacturers, associations, legislation, and so on.|
  |Self-harm |Self-harm describes language related to physical actions intended to purposely hurt, injure, damage one's body or kill oneself.|

  Classification can be multi-labeled. For example, when a text sample goes through the text moderation model, it could be classified as both Sexual content and Violence.



  Every harm category the service applies also comes with a severity level rating. The severity level is meant to indicate the severity of the consequences of showing the flagged content.

  **Text**: The current version of the text model supports the full 0-7 severity scale. By default, the response will output 4 values: 0, 2, 4, and 6. Each two adjacent levels are mapped to a single level. Users could use "outputType" in request and set it as "EightSeverityLevels" to get 8 values in output: 0,1,2,3,4,5,6,7. You can refer [text content severity levels definitions][text_severity_levels] for details.

  - [0,1] -> 0
  - [2,3] -> 2
  - [4,5] -> 4
  - [6,7] -> 6

  **Image**: The current version of the image model supports the trimmed version of the full 0-7 severity scale. The classifier only returns severities 0, 2, 4, and 6; each two adjacent levels are mapped to a single level. You can refer [image content severity levels definitions][image_severity_levels] for details.

  - [0,1] -> 0
  - [2,3] -> 2
  - [4,5] -> 4
  - [6,7] -> 6



  Following operations are supported to manage your text blocklist:

  - Create or modify a blocklist
  - List all blocklists
  - Get a blocklist by blocklistName
  - Add blocklistItems to a blocklist
  - Remove blocklistItems from a blocklist
  - List all blocklistItems in a blocklist by blocklistName
  - Get a blocklistItem in a blocklist by blocklistItemId and blocklistName
  - Delete a blocklist and all of its blocklistItems

  You can set the blocklists you want to use when analyze text, then you can get blocklist match result from returned response.



  The following section provides several code snippets covering some of the most common Content Safety service tasks, including:

  - [Analyze text](#analyze-text)
  - [Analyze image](#analyze-image)
  - [Manage text blocklist](#manage-text-blocklist)

  Please refer to [sample data](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/contentsafety/azure-ai-contentsafety/samples/sample_data) for the data used here. For more samples, please refer to [samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/contentsafety/azure-ai-contentsafety/samples).




  <!-- SNIPPET:sample_analyze_text.analyze_text -->

  ```python

      import os
      from azure.ai.contentsafety import ContentSafetyClient
      from azure.ai.contentsafety.models import TextCategory
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError
      from azure.ai.contentsafety.models import AnalyzeTextOptions

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = ContentSafetyClient(endpoint, AzureKeyCredential(key))

      
      request = AnalyzeTextOptions(text="You are an idiot")

      
      try:
          response = client.analyze_text(request)
      except HttpResponseError as e:
          print("Analyze text failed.")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise

      hate_result = next(item for item in response.categories_analysis if item.category == TextCategory.HATE)
      self_harm_result = next(item for item in response.categories_analysis if item.category == TextCategory.SELF_HARM)
      sexual_result = next(item for item in response.categories_analysis if item.category == TextCategory.SEXUAL)
      violence_result = next(item for item in response.categories_analysis if item.category == TextCategory.VIOLENCE)

      if hate_result:
          print(f"Hate severity: {hate_result.severity}")
      if self_harm_result:
          print(f"SelfHarm severity: {self_harm_result.severity}")
      if sexual_result:
          print(f"Sexual severity: {sexual_result.severity}")
      if violence_result:
          print(f"Violence severity: {violence_result.severity}")
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.analyze_text_with_blocklists -->

  ```python

      import os
      from azure.ai.contentsafety import ContentSafetyClient
      from azure.core.credentials import AzureKeyCredential
      from azure.ai.contentsafety.models import AnalyzeTextOptions
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = ContentSafetyClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"
      input_text = "I h*te you and I want to k*ll you."

      try:
          
          analysis_result = client.analyze_text(
              AnalyzeTextOptions(text=input_text, blocklist_names=[blocklist_name], halt_on_blocklist_hit=False)
          )
          if analysis_result and analysis_result.blocklists_match:
              print("\nBlocklist match results: ")
              for match_result in analysis_result.blocklists_match:
                  print(
                      f"BlocklistName: {match_result.blocklist_name}, BlockItemId: {match_result.blocklist_item_id}, "
                      f"BlockItemText: {match_result.blocklist_item_text}"
                  )
      except HttpResponseError as e:
          print("\nAnalyze text failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->



  <!-- SNIPPET:sample_analyze_image.analyze_image -->

  ```python

      import os
      from azure.ai.contentsafety import ContentSafetyClient
      from azure.ai.contentsafety.models import ImageCategory
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError
      from azure.ai.contentsafety.models import AnalyzeImageOptions, ImageData

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]
      image_path = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "./sample_data/image.jpg"))

      
      client = ContentSafetyClient(endpoint, AzureKeyCredential(key))

      
      with open(image_path, "rb") as file:
          request = AnalyzeImageOptions(image=ImageData(content=file.read()))

      
      try:
          response = client.analyze_image(request)
      except HttpResponseError as e:
          print("Analyze image failed.")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise

      hate_result = next(item for item in response.categories_analysis if item.category == ImageCategory.HATE)
      self_harm_result = next(item for item in response.categories_analysis if item.category == ImageCategory.SELF_HARM)
      sexual_result = next(item for item in response.categories_analysis if item.category == ImageCategory.SEXUAL)
      violence_result = next(item for item in response.categories_analysis if item.category == ImageCategory.VIOLENCE)

      if hate_result:
          print(f"Hate severity: {hate_result.severity}")
      if self_harm_result:
          print(f"SelfHarm severity: {self_harm_result.severity}")
      if sexual_result:
          print(f"Sexual severity: {sexual_result.severity}")
      if violence_result:
          print(f"Violence severity: {violence_result.severity}")
  ```

  <!-- END SNIPPET -->




  <!-- SNIPPET:sample_manage_blocklist.create_or_update_text_blocklist -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.ai.contentsafety.models import TextBlocklist
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"
      blocklist_description = "Test blocklist management."

      try:
          blocklist = client.create_or_update_text_blocklist(
              blocklist_name=blocklist_name,
              options=TextBlocklist(blocklist_name=blocklist_name, description=blocklist_description),
          )
          if blocklist:
              print("\nBlocklist created or updated: ")
              print(f"Name: {blocklist.blocklist_name}, Description: {blocklist.description}")
      except HttpResponseError as e:
          print("\nCreate or update text blocklist failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.list_text_blocklists -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      try:
          blocklists = client.list_text_blocklists()
          if blocklists:
              print("\nList blocklists: ")
              for blocklist in blocklists:
                  print(f"Name: {blocklist.blocklist_name}, Description: {blocklist.description}")
      except HttpResponseError as e:
          print("\nList text blocklists failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.get_text_blocklist -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"

      try:
          blocklist = client.get_text_blocklist(blocklist_name=blocklist_name)
          if blocklist:
              print("\nGet blocklist: ")
              print(f"Name: {blocklist.blocklist_name}, Description: {blocklist.description}")
      except HttpResponseError as e:
          print("\nGet text blocklist failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.delete_blocklist -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"

      try:
          client.delete_text_blocklist(blocklist_name=blocklist_name)
          print(f"\nDeleted blocklist: {blocklist_name}")
      except HttpResponseError as e:
          print("\nDelete blocklist failed:")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.add_block_items -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.ai.contentsafety.models import AddOrUpdateTextBlocklistItemsOptions, TextBlocklistItem
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"
      block_item_text_1 = "k*ll"
      block_item_text_2 = "h*te"

      block_items = [TextBlocklistItem(text=block_item_text_1), TextBlocklistItem(text=block_item_text_2)]
      try:
          result = client.add_or_update_blocklist_items(
              blocklist_name=blocklist_name, options=AddOrUpdateTextBlocklistItemsOptions(blocklist_items=block_items)
          )
          for block_item in result.blocklist_items:
              print(
                  f"BlockItemId: {block_item.blocklist_item_id}, Text: {block_item.text}, Description: {block_item.description}"
              )
      except HttpResponseError as e:
          print("\nAdd block items failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.list_block_items -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.core.credentials import AzureKeyCredential
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"

      try:
          block_items = client.list_text_blocklist_items(blocklist_name=blocklist_name)
          if block_items:
              print("\nList block items: ")
              for block_item in block_items:
                  print(
                      f"BlockItemId: {block_item.blocklist_item_id}, Text: {block_item.text}, "
                      f"Description: {block_item.description}"
                  )
      except HttpResponseError as e:
          print("\nList block items failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.get_block_item -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.core.credentials import AzureKeyCredential
      from azure.ai.contentsafety.models import TextBlocklistItem, AddOrUpdateTextBlocklistItemsOptions
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"
      block_item_text_1 = "k*ll"

      try:
          
          add_result = client.add_or_update_blocklist_items(
              blocklist_name=blocklist_name,
              options=AddOrUpdateTextBlocklistItemsOptions(blocklist_items=[TextBlocklistItem(text=block_item_text_1)]),
          )
          if not add_result or not add_result.blocklist_items or len(add_result.blocklist_items) <= 0:
              raise RuntimeError("BlockItem not created.")
          block_item_id = add_result.blocklist_items[0].blocklist_item_id

          
          block_item = client.get_text_blocklist_item(blocklist_name=blocklist_name, blocklist_item_id=block_item_id)
          print("\nGet blockitem: ")
          print(
              f"BlockItemId: {block_item.blocklist_item_id}, Text: {block_item.text}, Description: {block_item.description}"
          )
      except HttpResponseError as e:
          print("\nGet block item failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->


  <!-- SNIPPET:sample_manage_blocklist.remove_block_items -->

  ```python

      import os
      from azure.ai.contentsafety import BlocklistClient
      from azure.core.credentials import AzureKeyCredential
      from azure.ai.contentsafety.models import (
          TextBlocklistItem,
          AddOrUpdateTextBlocklistItemsOptions,
          RemoveTextBlocklistItemsOptions,
      )
      from azure.core.exceptions import HttpResponseError

      key = os.environ["CONTENT_SAFETY_KEY"]
      endpoint = os.environ["CONTENT_SAFETY_ENDPOINT"]

      
      client = BlocklistClient(endpoint, AzureKeyCredential(key))

      blocklist_name = "TestBlocklist"
      block_item_text_1 = "k*ll"

      try:
          
          add_result = client.add_or_update_blocklist_items(
              blocklist_name=blocklist_name,
              options=AddOrUpdateTextBlocklistItemsOptions(blocklist_items=[TextBlocklistItem(text=block_item_text_1)]),
          )
          if not add_result or not add_result.blocklist_items or len(add_result.blocklist_items) <= 0:
              raise RuntimeError("BlockItem not created.")
          block_item_id = add_result.blocklist_items[0].blocklist_item_id

          
          client.remove_blocklist_items(
              blocklist_name=blocklist_name, options=RemoveTextBlocklistItemsOptions(blocklist_item_ids=[block_item_id])
          )
          print(f"\nRemoved blockItem: {add_result.blocklist_items[0].blocklist_item_id}")
      except HttpResponseError as e:
          print("\nRemove block item failed: ")
          if e.error:
              print(f"Error code: {e.error.code}")
              print(f"Error message: {e.error.message}")
              raise
          print(e)
          raise
  ```

  <!-- END SNIPPET -->





  Azure AI Content Safety client library will raise exceptions defined in [Azure Core][azure_core_exception]. Error codes are defined as below:

  |Error Code	|Possible reasons	|Suggestions|
  |-----------|-------------------|-----------|
  |InvalidRequestBody	|One or more fields in the request body do not match the API definition.	|1. Check the API version you specified in the API call.<br>2. Check the corresponding API definition for the API version you selected.|
  |InvalidResourceName	|The resource name you specified in the URL does not meet the requirements, like the blocklist name, blocklist term ID, etc.	|1. Check the API version you specified in the API call.<br>2. Check whether the given name has invalid characters according to the API definition.|
  |ResourceNotFound	|The resource you specified in the URL may not exist, like the blocklist name.	|1. Check the API version you specified in the API call.<br>2. Double check the existence of the resource specified in the URL.|
  |InternalError	|Some unexpected situations on the server side have been triggered.	|1. You may want to retry a few times after a small period and see it the issue happens again.<br>2. Contact Azure Support if this issue persists.|
  |ServerBusy	|The server side cannot process the request temporarily.	|1. You may want to retry a few times after a small period and see it the issue happens again.<br>2.Contact Azure Support if this issue persists.|
  |TooManyRequests	|The current RPS has exceeded the quota for your current SKU.	|1. Check the pricing table to understand the RPS quota.<br>2.Contact Azure Support if you need more QPS.|



  This library uses the standard [logging](https://docs.python.org/3/library/logging.html) library for logging.

  Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level.

  Detailed `DEBUG` level logging, including request/response bodies and **unredacted** headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.

  See full SDK logging documentation with examples [here](https://learn.microsoft.com/azure/developer/python/sdk/azure-sdk-logging).



  Optional keyword arguments can be passed in at the client and per-operation level. The azure-core [reference documentation](https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html) describes available configurations for retries, logging, transport protocols, and more.





  For more extensive documentation on Azure Content Safety, see the [Azure AI Content Safety][contentsafety_overview] on docs.microsoft.com.



  This project welcomes contributions and suggestions. Most contributions require
  you to agree to a Contributor License Agreement (CLA) declaring that you have
  the right to, and actually do, grant us the rights to use your contribution.
  For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether
  you need to provide a CLA and decorate the PR appropriately (e.g., label,
  comment). Simply follow the instructions provided by the bot. You will only
  need to do this once across all repos using our CLA.

  This project has adopted the
  [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
  see the Code of Conduct FAQ or contact opencode@microsoft.com with any
  additional questions or comments.

  <!-- LINKS -->
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
  [azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
  [azure_identity_pip]: https://pypi.org/project/azure-identity/
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [pip]: https://pypi.org/project/pip/
  [azure_sub]: https://azure.microsoft.com/free/
  [contentsafety_overview]: https://aka.ms/acs-doc
  [azure_portal]: https://ms.portal.azure.com/
  [azure_cli_endpoint_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account?view=azure-cli-latest#az-cognitiveservices-account-show
  [azure_cli_key_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account/keys?view=azure-cli-latest#az-cognitiveservices-account-keys-list
  [azure_core_exception]: https://azuresdkdocs.blob.core.windows.net/$web/python/azure-core/latest/azure.core.html#module-azure.core.exceptions
  [authenticate_with_microsoft_entra_id]: https://learn.microsoft.com/azure/ai-services/authentication?tabs=powershell#authenticate-with-microsoft-entra-id
  [text_severity_levels]: https://learn.microsoft.com/azure/ai-services/content-safety/concepts/harm-categories?tabs=definitions#text-content
  [image_severity_levels]: https://learn.microsoft.com/azure/ai-services/content-safety/concepts/harm-categories?tabs=definitions#image-content
  [product_documentation]: https://learn.microsoft.com/azure/cognitive-services/content-safety/
  [api_reference_docs]: https://azure.github.io/azure-sdk-for-python/cognitiveservices.html#azure-ai-contentsafety


pkgId: 41e51465947519fb60c7e61c1a905f136d2ed25bbcc5f00e4feac9c8fc99ea4b
name: python-azure-ai-documentintelligence
arch: src
version: 1.0.0b4
epoch: 0
release: 1
summary: Microsoft Azure AI Document Intelligence Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-documentintelligence-1.0.0b4-1.src.rpm
checksum_type: sha256
description:
  Azure AI Document Intelligence ([previously known as Form Recognizer][service-rename]) is a cloud service that uses machine learning to analyze text and structured data from your documents. It includes the following main features:

  - Layout - Extract content and structure (ex. words, selection marks, tables) from documents.
  - Document - Analyze key-value pairs in addition to general layout from documents.
  - Read - Read page information from documents.
  - Prebuilt - Extract common field values from select document types (ex. receipts, invoices, business cards, ID documents, U.S. W-2 tax documents, among others) using prebuilt models.
  - Custom - Build custom models from your own data to extract tailored field values in addition to general layout from documents.
  - Classifiers - Build custom classification models that combine layout and language features to accurately detect and identify documents you process within your application.
  - Add-on capabilities - Extract barcodes/QR codes, formulas, font/style, etc. or enable high resolution mode for large documents with optional parameters.

  [Source code][python-di-src]
  | [Package (PyPI)][python-di-pypi]
  | [API reference documentation][python-di-ref-docs]
  | [Product documentation][python-di-product-docs]
  | [Samples][python-di-samples]



  _The latest service API is currently only available in some Azure regions, the available regions can be found from [here][python-di-available-regions]._





  ```bash
  python -m pip install azure-ai-documentintelligence
  ```

  This table shows the relationship between SDK versions and supported API service versions:

  |SDK version|Supported API service version|
  |-|-|
  |1.0.0b1 | 2023-10-31-preview|
  |1.0.0b2 | 2024-02-29-preview|

  Older API versions are supported in `azure-ai-formrecognizer`, please see the [Migration Guide][migration-guide] for detailed instructions on how to update application.



  - Python 3.8 or later is required to use this package.
  - You need an [Azure subscription][azure_sub] to use this package.
  - An existing Azure AI Document Intelligence instance.



  Document Intelligence supports both [multi-service and single-service access][cognitive_resource_portal]. Create a Cognitive Services resource if you plan to access multiple cognitive services under a single endpoint/key. For Document Intelligence access only, create a Document Intelligence resource. Please note that you will need a single-service resource if you intend to use [Azure Active Directory authentication](#create-the-client-with-an-azure-active-directory-credential).

  You can create either resource using:

  * Option 1: [Azure Portal][cognitive_resource_portal].
  * Option 2: [Azure CLI][cognitive_resource_cli].

  Below is an example of how you can create a Document Intelligence resource using the CLI:

  ```PowerShell


  az group create --name <your-resource-name> --location <location>
  ```

  ```PowerShell

  az cognitiveservices account create \
      --name <your-resource-name> \
      --resource-group <your-resource-group-name> \
      --kind FormRecognizer \
      --sku <sku> \
      --location <location> \
      --yes
  ```

  For more information about creating the resource or how to get the location and sku information see [here][cognitive_resource_cli].



  In order to interact with the Document Intelligence service, you will need to create an instance of a client.
  An **endpoint** and **credential** are necessary to instantiate the client object.



  You can find the endpoint for your Document Intelligence resource using the
  [Azure Portal][azure_portal_get_endpoint]
  or [Azure CLI][azure_cli_endpoint_lookup]:

  ```bash

  az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint"
  ```

  Either a regional endpoint or a custom subdomain can be used for authentication. They are formatted as follows:

  ```
  Regional endpoint: https://<region>.api.cognitive.microsoft.com/
  Custom subdomain: https://<resource-name>.cognitiveservices.azure.com/
  ```

  A regional endpoint is the same for every resource in a region. A complete list of supported regional endpoints can be consulted [here][regional_endpoints]. Please note that regional endpoints do not support AAD authentication.

  A custom subdomain, on the other hand, is a name that is unique to the Document Intelligence resource. They can only be used by [single-service resources][cognitive_resource_portal].



  The API key can be found in the [Azure Portal][azure_portal] or by running the following Azure CLI command:

  ```bash
  az cognitiveservices account keys list --name "<resource-name>" --resource-group "<resource-group-name>"
  ```



  To use an [API key][cognitive_authentication_api_key] as the `credential` parameter,
  pass the key as a string into an instance of [AzureKeyCredential][azure-key-credential].

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient

  endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api_key>")
  document_intelligence_client = DocumentIntelligenceClient(endpoint, credential)
  ```



  `AzureKeyCredential` authentication is used in the examples in this getting started guide, but you can also
  authenticate with Azure Active Directory using the [azure-identity][azure_identity] library.
  Note that regional endpoints do not support AAD authentication. Create a [custom subdomain][custom_subdomain]
  name for your resource in order to use this type of authentication.

  To use the [DefaultAzureCredential][default_azure_credential] type shown below, or other credential types provided
  with the Azure SDK, please install the `azure-identity` package:

  ```pip install azure-identity```

  You will also need to [register a new AAD application and grant access][register_aad_app] to Document Intelligence by assigning the `"Cognitive Services User"` role to your service principal.

  Once completed, set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.

  ```python
  """DefaultAzureCredential will use the values from these environment
  variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
  """
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  credential = DefaultAzureCredential()

  document_intelligence_client = DocumentIntelligenceClient(endpoint, credential)
  ```





  `DocumentIntelligenceClient` provides operations for analyzing input documents using prebuilt and custom models through the `begin_analyze_document` API.
  Use the `model_id` parameter to select the type of model for analysis. See a full list of supported models [here][di-models].
  The `DocumentIntelligenceClient` also provides operations for classifying documents through the `begin_classify_document` API.
  Custom classification models can classify each page in an input file to identify the document(s) within and can also identify multiple documents or multiple instances of a single document within an input file.

  Sample code snippets are provided to illustrate using a DocumentIntelligenceClient [here](#examples "Examples").
  More information about analyzing documents, including supported features, locales, and document types can be found in the [service documentation][di-models].



  `DocumentIntelligenceAdministrationClient` provides operations for:

  - Building custom models to analyze specific fields you specify by labeling your custom documents. A `DocumentModelDetails` is returned indicating the document type(s) the model can analyze, as well as the estimated confidence for each field. See the [service documentation][di-build-model] for a more detailed explanation.
  - Creating a composed model from a collection of existing models.
  - Managing models created in your account.
  - Listing operations or getting a specific model operation created within the last 24 hours.
  - Copying a custom model from one Document Intelligence resource to another.
  - Build and manage a custom classification model to classify the documents you process within your application.

  Please note that models can also be built using a graphical user interface such as [Document Intelligence Studio][di-studio].

  Sample code snippets are provided to illustrate using a DocumentIntelligenceAdministrationClient [here](#examples "Examples").



  Long-running operations are operations which consist of an initial request sent to the service to start an operation,
  followed by polling the service at intervals to determine whether the operation has completed or failed, and if it has
  succeeded, to get the result.

  Methods that analyze documents, build models, or copy/compose models are modeled as long-running operations.
  The client exposes a `begin_<method-name>` method that returns an `LROPoller` or `AsyncLROPoller`. Callers should wait
  for the operation to complete by calling `result()` on the poller object returned from the `begin_<method-name>` method.
  Sample code snippets are provided to illustrate using long-running operations [below](#examples "Examples").



  The following section provides several code snippets covering some of the most common Document Intelligence tasks, including:

  * [Extract Layout](#extract-layout "Extract Layout")
  * [Extract Figures from Documents](#extract-figures-from-documents "Extract Figures from Documents")
  * [Analyze Documents Result in PDF](#analyze-documents-result-in-pdf "Analyze Documents Result in PDF")
  * [Using the General Document Model](#using-the-general-document-model "Using the General Document Model")
  * [Using Prebuilt Models](#using-prebuilt-models "Using Prebuilt Models")
  * [Build a Custom Model](#build-a-custom-model "Build a custom model")
  * [Analyze Documents Using a Custom Model](#analyze-documents-using-a-custom-model "Analyze Documents Using a Custom Model")
  * [Manage Your Models](#manage-your-models "Manage Your Models")
  * [Add-on capabilities](#add-on-capabilities "Add-on Capabilities")



  Extract text, selection marks, text styles, and table structures, along with their bounding region coordinates, from documents.

  <!-- SNIPPET:sample_analyze_layout.extract_layout -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.ai.documentintelligence.models import AnalyzeResult

  def _in_span(word, spans):
      for span in spans:
          if word.span.offset >= span.offset and (word.span.offset + word.span.length) <= (span.offset + span.length):
              return True
      return False

  def _format_polygon(polygon):
      if not polygon:
          return "N/A"
      return ", ".join([f"[{polygon[i]}, {polygon[i + 1]}]" for i in range(0, len(polygon), 2)])

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

  document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  with open(path_to_sample_documents, "rb") as f:
      poller = document_intelligence_client.begin_analyze_document(
          "prebuilt-layout", analyze_request=f, content_type="application/octet-stream"
      )
  result: AnalyzeResult = poller.result()

  if result.styles and any([style.is_handwritten for style in result.styles]):
      print("Document contains handwritten content")
  else:
      print("Document does not contain handwritten content")

  for page in result.pages:
      print(f"----Analyzing layout from page #{page.page_number}----")
      print(f"Page has width: {page.width} and height: {page.height}, measured with unit: {page.unit}")

      if page.lines:
          for line_idx, line in enumerate(page.lines):
              words = []
              if page.words:
                  for word in page.words:
                      print(f"......Word '{word.content}' has a confidence of {word.confidence}")
                      if _in_span(word, line.spans):
                          words.append(word)
              print(
                  f"...Line # {line_idx} has word count {len(words)} and text '{line.content}' "
                  f"within bounding polygon '{_format_polygon(line.polygon)}'"
              )

      if page.selection_marks:
          for selection_mark in page.selection_marks:
              print(
                  f"Selection mark is '{selection_mark.state}' within bounding polygon "
                  f"'{_format_polygon(selection_mark.polygon)}' and has a confidence of {selection_mark.confidence}"
              )

  if result.paragraphs:
      print(f"----Detected #{len(result.paragraphs)} paragraphs in the document----")
      
      result.paragraphs.sort(key=lambda p: (p.spans.sort(key=lambda s: s.offset), p.spans[0].offset))
      print("-----Print sorted paragraphs-----")
      for paragraph in result.paragraphs:
          if not paragraph.bounding_regions:
              print(f"Found paragraph with role: '{paragraph.role}' within N/A bounding region")
          else:
              print(f"Found paragraph with role: '{paragraph.role}' within")
              print(
                  ", ".join(
                      f" Page #{region.page_number}: {_format_polygon(region.polygon)} bounding region"
                      for region in paragraph.bounding_regions
                  )
              )
          print(f"...with content: '{paragraph.content}'")
          print(f"...with offset: {paragraph.spans[0].offset} and length: {paragraph.spans[0].length}")

  if result.tables:
      for table_idx, table in enumerate(result.tables):
          print(f"Table # {table_idx} has {table.row_count} rows and " f"{table.column_count} columns")
          if table.bounding_regions:
              for region in table.bounding_regions:
                  print(
                      f"Table # {table_idx} location on page: {region.page_number} is {_format_polygon(region.polygon)}"
                  )
          for cell in table.cells:
              print(f"...Cell[{cell.row_index}][{cell.column_index}] has text '{cell.content}'")
              if cell.bounding_regions:
                  for region in cell.bounding_regions:
                      print(
                          f"...content on page {region.page_number} is within bounding polygon '{_format_polygon(region.polygon)}'"
                      )

  print("----------------------------------------")
  ```

  <!-- END SNIPPET -->



  Extract figures from the document as cropped images.

  <!-- SNIPPET:sample_analyze_result_figures.analyze_result_figures -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.ai.documentintelligence.models import AnalyzeOutputOption, AnalyzeResult

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

  document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  with open(path_to_sample_documents, "rb") as f:
      poller = document_intelligence_client.begin_analyze_document(
          "prebuilt-layout",
          analyze_request=f,
          output=[AnalyzeOutputOption.FIGURES],
          content_type="application/octet-stream",
      )
  result: AnalyzeResult = poller.result()
  operation_id = poller.details["operation_id"]

  if result.figures:
      for figure in result.figures:
          if figure.id:
              response = document_intelligence_client.get_analyze_result_figure(
                  model_id=result.model_id, result_id=operation_id, figure_id=figure.id
              )
              with open(f"{figure.id}.png", "wb") as writer:
                  writer.writelines(response)
  else:
      print("No figures found.")
  ```

  <!-- END SNIPPET -->



  Convert an analog PDF into a PDF with embedded text. Such text can enable text search within the PDF or allow the PDF to be used in LLM chat scenarios.

  _Note: For now, this feature is only supported by `prebuilt-read`. All other models will return error._

  <!-- SNIPPET:sample_analyze_result_pdf.analyze_result_pdf -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.ai.documentintelligence.models import AnalyzeOutputOption, AnalyzeResult

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

  document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))

  with open(path_to_sample_documents, "rb") as f:
      poller = document_intelligence_client.begin_analyze_document(
          "prebuilt-read",
          analyze_request=f,
          output=[AnalyzeOutputOption.PDF],
          content_type="application/octet-stream",
      )
  result: AnalyzeResult = poller.result()
  operation_id = poller.details["operation_id"]

  response = document_intelligence_client.get_analyze_result_pdf(model_id=result.model_id, result_id=operation_id)
  with open("analyze_result.pdf", "wb") as writer:
      writer.writelines(response)
  ```

  <!-- END SNIPPET -->



  Analyze key-value pairs, tables, styles, and selection marks from documents using the general document model provided by the Document Intelligence service.
  Select the General Document Model by passing `model_id="prebuilt-document"` into the `begin_analyze_document` method:

  <!-- SNIPPET:sample_analyze_general_documents.analyze_general_documents -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.ai.documentintelligence.models import DocumentAnalysisFeature, AnalyzeResult

  def _in_span(word, spans):
      for span in spans:
          if word.span.offset >= span.offset and (word.span.offset + word.span.length) <= (span.offset + span.length):
              return True
      return False

  def _format_bounding_region(bounding_regions):
      if not bounding_regions:
          return "N/A"
      return ", ".join(
          f"Page #{region.page_number}: {_format_polygon(region.polygon)}" for region in bounding_regions
      )

  def _format_polygon(polygon):
      if not polygon:
          return "N/A"
      return ", ".join([f"[{polygon[i]}, {polygon[i + 1]}]" for i in range(0, len(polygon), 2)])

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

  document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  with open(path_to_sample_documents, "rb") as f:
      poller = document_intelligence_client.begin_analyze_document(
          "prebuilt-layout",
          analyze_request=f,
          features=[DocumentAnalysisFeature.KEY_VALUE_PAIRS],
          content_type="application/octet-stream",
      )
  result: AnalyzeResult = poller.result()

  if result.styles:
      for style in result.styles:
          if style.is_handwritten:
              print("Document contains handwritten content: ")
              print(",".join([result.content[span.offset : span.offset + span.length] for span in style.spans]))

  print("----Key-value pairs found in document----")
  if result.key_value_pairs:
      for kv_pair in result.key_value_pairs:
          if kv_pair.key:
              print(
                  f"Key '{kv_pair.key.content}' found within "
                  f"'{_format_bounding_region(kv_pair.key.bounding_regions)}' bounding regions"
              )
          if kv_pair.value:
              print(
                  f"Value '{kv_pair.value.content}' found within "
                  f"'{_format_bounding_region(kv_pair.value.bounding_regions)}' bounding regions\n"
              )

  for page in result.pages:
      print(f"----Analyzing document from page #{page.page_number}----")
      print(f"Page has width: {page.width} and height: {page.height}, measured with unit: {page.unit}")

      if page.lines:
          for line_idx, line in enumerate(page.lines):
              words = []
              if page.words:
                  for word in page.words:
                      print(f"......Word '{word.content}' has a confidence of {word.confidence}")
                      if _in_span(word, line.spans):
                          words.append(word)
              print(
                  f"...Line #{line_idx} has {len(words)} words and text '{line.content}' within "
                  f"bounding polygon '{_format_polygon(line.polygon)}'"
              )

      if page.selection_marks:
          for selection_mark in page.selection_marks:
              print(
                  f"Selection mark is '{selection_mark.state}' within bounding polygon "
                  f"'{_format_polygon(selection_mark.polygon)}' and has a confidence of "
                  f"{selection_mark.confidence}"
              )

  if result.tables:
      for table_idx, table in enumerate(result.tables):
          print(f"Table # {table_idx} has {table.row_count} rows and {table.column_count} columns")
          if table.bounding_regions:
              for region in table.bounding_regions:
                  print(
                      f"Table # {table_idx} location on page: {region.page_number} is {_format_polygon(region.polygon)}"
                  )
          for cell in table.cells:
              print(f"...Cell[{cell.row_index}][{cell.column_index}] has text '{cell.content}'")
              if cell.bounding_regions:
                  for region in cell.bounding_regions:
                      print(
                          f"...content on page {region.page_number} is within bounding polygon '{_format_polygon(region.polygon)}'\n"
                      )
  print("----------------------------------------")
  ```

  <!-- END SNIPPET -->

  - Read more about the features provided by the `prebuilt-document` model [here][service_prebuilt_document].



  Extract fields from select document types such as receipts, invoices, business cards, identity documents, and U.S. W-2 tax documents using prebuilt models provided by the Document Intelligence service.

  For example, to analyze fields from a sales receipt, use the prebuilt receipt model provided by passing `model_id="prebuilt-receipt"` into the `begin_analyze_document` method:

  <!-- SNIPPET:sample_analyze_receipts.analyze_receipts -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.ai.documentintelligence.models import AnalyzeResult

  def _format_price(price_dict):
      return "".join([f"{p}" for p in price_dict.values()])

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

  document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  with open(path_to_sample_documents, "rb") as f:
      poller = document_intelligence_client.begin_analyze_document(
          "prebuilt-receipt", analyze_request=f, locale="en-US", content_type="application/octet-stream"
      )
  receipts: AnalyzeResult = poller.result()

  if receipts.documents:
      for idx, receipt in enumerate(receipts.documents):
          print(f"--------Analysis of receipt #{idx + 1}--------")
          print(f"Receipt type: {receipt.doc_type if receipt.doc_type else 'N/A'}")
          if receipt.fields:
              merchant_name = receipt.fields.get("MerchantName")
              if merchant_name:
                  print(
                      f"Merchant Name: {merchant_name.get('valueString')} has confidence: "
                      f"{merchant_name.confidence}"
                  )
              transaction_date = receipt.fields.get("TransactionDate")
              if transaction_date:
                  print(
                      f"Transaction Date: {transaction_date.get('valueDate')} has confidence: "
                      f"{transaction_date.confidence}"
                  )
              items = receipt.fields.get("Items")
              if items:
                  print("Receipt items:")
                  for idx, item in enumerate(items.get("valueArray")):
                      print(f"...Item #{idx + 1}")
                      item_description = item.get("valueObject").get("Description")
                      if item_description:
                          print(
                              f"......Item Description: {item_description.get('valueString')} has confidence: "
                              f"{item_description.confidence}"
                          )
                      item_quantity = item.get("valueObject").get("Quantity")
                      if item_quantity:
                          print(
                              f"......Item Quantity: {item_quantity.get('valueString')} has confidence: "
                              f"{item_quantity.confidence}"
                          )
                      item_total_price = item.get("valueObject").get("TotalPrice")
                      if item_total_price:
                          print(
                              f"......Total Item Price: {_format_price(item_total_price.get('valueCurrency'))} has confidence: "
                              f"{item_total_price.confidence}"
                          )
              subtotal = receipt.fields.get("Subtotal")
              if subtotal:
                  print(
                      f"Subtotal: {_format_price(subtotal.get('valueCurrency'))} has confidence: {subtotal.confidence}"
                  )
              tax = receipt.fields.get("TotalTax")
              if tax:
                  print(f"Total tax: {_format_price(tax.get('valueCurrency'))} has confidence: {tax.confidence}")
              tip = receipt.fields.get("Tip")
              if tip:
                  print(f"Tip: {_format_price(tip.get('valueCurrency'))} has confidence: {tip.confidence}")
              total = receipt.fields.get("Total")
              if total:
                  print(f"Total: {_format_price(total.get('valueCurrency'))} has confidence: {total.confidence}")
          print("--------------------------------------")
  ```

  <!-- END SNIPPET -->

  You are not limited to receipts! There are a few prebuilt models to choose from, each of which has its own set of supported fields. See other supported prebuilt models [here][di-models].



  Build a custom model on your own document type. The resulting model can be used to analyze values from the types of documents it was trained on.
  Provide a container SAS URL to your Azure Storage Blob container where you're storing the training documents.

  More details on setting up a container and required file structure can be found in the [service documentation][di-build-training-set].

  <!-- SNIPPET:sample_manage_models.build_model -->

  ```python

  import uuid
  from azure.ai.documentintelligence import DocumentIntelligenceAdministrationClient
  from azure.ai.documentintelligence.models import (
      DocumentBuildMode,
      BuildDocumentModelRequest,
      AzureBlobContentSource,
      DocumentModelDetails,
  )
  from azure.core.credentials import AzureKeyCredential

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]
  container_sas_url = os.environ["DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL"]

  document_intelligence_admin_client = DocumentIntelligenceAdministrationClient(endpoint, AzureKeyCredential(key))
  poller = document_intelligence_admin_client.begin_build_document_model(
      BuildDocumentModelRequest(
          model_id=str(uuid.uuid4()),
          build_mode=DocumentBuildMode.TEMPLATE,
          azure_blob_source=AzureBlobContentSource(container_url=container_sas_url),
          description="my model description",
      )
  )
  model: DocumentModelDetails = poller.result()

  print(f"Model ID: {model.model_id}")
  print(f"Description: {model.description}")
  print(f"Model created on: {model.created_date_time}")
  print(f"Model expires on: {model.expiration_date_time}")
  if model.doc_types:
      print("Doc types the model can recognize:")
      for name, doc_type in model.doc_types.items():
          print(f"Doc Type: '{name}' built with '{doc_type.build_mode}' mode which has the following fields:")
          if doc_type.field_schema:
              for field_name, field in doc_type.field_schema.items():
                  if doc_type.field_confidence:
                      print(
                          f"Field: '{field_name}' has type '{field['type']}' and confidence score "
                          f"{doc_type.field_confidence[field_name]}"
                      )
  ```

  <!-- END SNIPPET -->



  Analyze document fields, tables, selection marks, and more. These models are trained with your own data, so they're tailored to your documents.
  For best results, you should only analyze documents of the same document type that the custom model was built with.

  <!-- SNIPPET:sample_analyze_custom_documents.analyze_custom_documents -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.ai.documentintelligence.models import AnalyzeResult

  def _print_table(header_names, table_data):
      
      max_len_list = []
      for i in range(len(header_names)):
          col_values = list(map(lambda row: len(str(row[i])), table_data))
          col_values.append(len(str(header_names[i])))
          max_len_list.append(max(col_values))

      row_format_str = "".join(map(lambda len: f"{{:<{len + 4}}}", max_len_list))

      print(row_format_str.format(*header_names))
      for row in table_data:
          print(row_format_str.format(*row))

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]
  model_id = os.getenv("CUSTOM_BUILT_MODEL_ID", custom_model_id)

  document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))


  with open(path_to_sample_documents, "rb") as f:
      poller = document_intelligence_client.begin_analyze_document(
          model_id=model_id, analyze_request=f, content_type="application/octet-stream"
      )
  result: AnalyzeResult = poller.result()

  if result.documents:
      for idx, document in enumerate(result.documents):
          print(f"--------Analyzing document #{idx + 1}--------")
          print(f"Document has type {document.doc_type}")
          print(f"Document has document type confidence {document.confidence}")
          print(f"Document was analyzed with model with ID {result.model_id}")
          if document.fields:
              for name, field in document.fields.items():
                  field_value = field.get("valueString") if field.get("valueString") else field.content
                  print(
                      f"......found field of type '{field.type}' with value '{field_value}' and with confidence {field.confidence}"
                  )

      
      SYMBOL_OF_TABLE_TYPE = "array"
      SYMBOL_OF_OBJECT_TYPE = "object"
      KEY_OF_VALUE_OBJECT = "valueObject"
      KEY_OF_CELL_CONTENT = "content"

      for doc in result.documents:
          if not doc.fields is None:
              for field_name, field_value in doc.fields.items():
                  
                  if field_value.type == SYMBOL_OF_TABLE_TYPE and field_value.value_array:
                      col_names = []
                      sample_obj = field_value.value_array[0]
                      if KEY_OF_VALUE_OBJECT in sample_obj:
                          col_names = list(sample_obj[KEY_OF_VALUE_OBJECT].keys())
                      print("----Extracting Dynamic Table Cell Values----")
                      table_rows = []
                      for obj in field_value.value_array:
                          if KEY_OF_VALUE_OBJECT in obj:
                              value_obj = obj[KEY_OF_VALUE_OBJECT]
                              extract_value_by_col_name = lambda key: (
                                  value_obj[key].get(KEY_OF_CELL_CONTENT)
                                  if key in value_obj and KEY_OF_CELL_CONTENT in value_obj[key]
                                  else "None"
                              )
                              row_data = list(map(extract_value_by_col_name, col_names))
                              table_rows.append(row_data)
                      _print_table(col_names, table_rows)

                  elif (
                      field_value.type == SYMBOL_OF_OBJECT_TYPE
                      and KEY_OF_VALUE_OBJECT in field_value
                      and field_value[KEY_OF_VALUE_OBJECT] is not None
                  ):
                      rows_by_columns = list(field_value[KEY_OF_VALUE_OBJECT].values())
                      is_fixed_table = all(
                          (
                              rows_of_column["type"] == SYMBOL_OF_OBJECT_TYPE
                              and Counter(list(rows_by_columns[0][KEY_OF_VALUE_OBJECT].keys()))
                              == Counter(list(rows_of_column[KEY_OF_VALUE_OBJECT].keys()))
                          )
                          for rows_of_column in rows_by_columns
                      )

                      
                      if is_fixed_table:
                          print("----Extracting Fixed Table Cell Values----")
                          col_names = list(field_value[KEY_OF_VALUE_OBJECT].keys())
                          row_dict: dict = {}
                          for rows_of_column in rows_by_columns:
                              rows = rows_of_column[KEY_OF_VALUE_OBJECT]
                              for row_key in list(rows.keys()):
                                  if row_key in row_dict:
                                      row_dict[row_key].append(rows[row_key].get(KEY_OF_CELL_CONTENT))
                                  else:
                                      row_dict[row_key] = [
                                          row_key,
                                          rows[row_key].get(KEY_OF_CELL_CONTENT),
                                      ]

                          col_names.insert(0, "")
                          _print_table(col_names, list(row_dict.values()))

  print("------------------------------------")
  ```

  <!-- END SNIPPET -->

  Additionally, a document URL can also be used to analyze documents using the `begin_analyze_document` method.

  <!-- SNIPPET:sample_analyze_receipts_from_url.analyze_receipts_from_url -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.documentintelligence import DocumentIntelligenceClient
  from azure.ai.documentintelligence.models import AnalyzeDocumentRequest, AnalyzeResult

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]

  document_intelligence_client = DocumentIntelligenceClient(endpoint=endpoint, credential=AzureKeyCredential(key))
  url = "https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_forms/receipt/contoso-receipt.png"
  poller = document_intelligence_client.begin_analyze_document(
      "prebuilt-receipt", AnalyzeDocumentRequest(url_source=url)
  )
  receipts: AnalyzeResult = poller.result()
  ```

  <!-- END SNIPPET -->



  Manage the custom models attached to your account.

  <!-- SNIPPET:sample_manage_models.build_model -->

  ```python

  import uuid
  from azure.ai.documentintelligence import DocumentIntelligenceAdministrationClient
  from azure.ai.documentintelligence.models import (
      DocumentBuildMode,
      BuildDocumentModelRequest,
      AzureBlobContentSource,
      DocumentModelDetails,
  )
  from azure.core.credentials import AzureKeyCredential

  endpoint = os.environ["DOCUMENTINTELLIGENCE_ENDPOINT"]
  key = os.environ["DOCUMENTINTELLIGENCE_API_KEY"]
  container_sas_url = os.environ["DOCUMENTINTELLIGENCE_STORAGE_CONTAINER_SAS_URL"]

  document_intelligence_admin_client = DocumentIntelligenceAdministrationClient(endpoint, AzureKeyCredential(key))
  poller = document_intelligence_admin_client.begin_build_document_model(
      BuildDocumentModelRequest(
          model_id=str(uuid.uuid4()),
          build_mode=DocumentBuildMode.TEMPLATE,
          azure_blob_source=AzureBlobContentSource(container_url=container_sas_url),
          description="my model description",
      )
  )
  model: DocumentModelDetails = poller.result()

  print(f"Model ID: {model.model_id}")
  print(f"Description: {model.description}")
  print(f"Model created on: {model.created_date_time}")
  print(f"Model expires on: {model.expiration_date_time}")
  if model.doc_types:
      print("Doc types the model can recognize:")
      for name, doc_type in model.doc_types.items():
          print(f"Doc Type: '{name}' built with '{doc_type.build_mode}' mode which has the following fields:")
          if doc_type.field_schema:
              for field_name, field in doc_type.field_schema.items():
                  if doc_type.field_confidence:
                      print(
                          f"Field: '{field_name}' has type '{field['type']}' and confidence score "
                          f"{doc_type.field_confidence[field_name]}"
                      )
  ```

  <!-- END SNIPPET -->

  <!-- SNIPPET:sample_manage_models.get_resource_info -->

  ```python
  account_details = document_intelligence_admin_client.get_resource_info()
  print(
      f"Our resource has {account_details.custom_document_models.count} custom models, "
      f"and we can have at most {account_details.custom_document_models.limit} custom models"
  )
  ```

  <!-- END SNIPPET -->

  <!-- SNIPPET:sample_manage_models.list_models -->

  ```python

  models = document_intelligence_admin_client.list_models()

  print("We have the following 'ready' models with IDs and descriptions:")
  for model in models:
      print(f"{model.model_id} | {model.description}")
  ```

  <!-- END SNIPPET -->

  <!-- SNIPPET:sample_manage_models.get_model -->

  ```python
  my_model = document_intelligence_admin_client.get_model(model_id=model.model_id)
  print(f"\nModel ID: {my_model.model_id}")
  print(f"Description: {my_model.description}")
  print(f"Model created on: {my_model.created_date_time}")
  print(f"Model expires on: {my_model.expiration_date_time}")
  if my_model.warnings:
      print("Warnings encountered while building the model:")
      for warning in my_model.warnings:
          print(f"warning code: {warning.code}, message: {warning.message}, target of the error: {warning.target}")
  ```

  <!-- END SNIPPET -->

  <!-- SNIPPET:sample_manage_models.delete_model -->

  ```python

  document_intelligence_admin_client.delete_model(model_id=my_model.model_id)

  from azure.core.exceptions import ResourceNotFoundError

  try:
      document_intelligence_admin_client.get_model(model_id=my_model.model_id)
  except ResourceNotFoundError:
      print(f"Successfully deleted model with ID {my_model.model_id}")
  ```

  <!-- END SNIPPET -->


  Document Intelligence supports more sophisticated analysis capabilities. These optional features can be enabled and disabled depending on the scenario of the document extraction.

  The following add-on capabilities are available in this SDK:
  - [barcode/QR code][addon_barcodes_sample]
  - [formula][addon_formulas_sample]
  - [font/style][addon_fonts_sample]
  - [high resolution mode][addon_highres_sample]
  - [language][addon_languages_sample]
  - [query fields][query_fields_sample]

  Note that some add-on capabilities will incur additional charges. See pricing: https://azure.microsoft.com/pricing/details/ai-document-intelligence/.





  Document Intelligence client library will raise exceptions defined in [Azure Core][azure_core_exceptions].
  Error codes and messages raised by the Document Intelligence service can be found in the [service documentation][di-errors].



  This library uses the standard
  [logging][python_logging] library for logging.

  Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level.

  Detailed `DEBUG` level logging, including request/response bodies and **unredacted**
  headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  Optional keyword arguments can be passed in at the client and per-operation level.
  The azure-core [reference documentation][azure_core_ref_docs]
  describes available configurations for retries, logging, transport protocols, and more.





  See the [Sample README][sample_readme] for several code snippets illustrating common patterns used in the Document Intelligence Python API.



  For more extensive documentation on Azure AI Document Intelligence, see the [Document Intelligence documentation][python-di-product-docs] on docs.microsoft.com.




  This project welcomes contributions and suggestions. Most contributions require
  you to agree to a Contributor License Agreement (CLA) declaring that you have
  the right to, and actually do, grant us the rights to use your contribution.
  For details, visit https://cla.microsoft.com.

  When you submit a pull request, a CLA-bot will automatically determine whether
  you need to provide a CLA and decorate the PR appropriately (e.g., label,
  comment). Simply follow the instructions provided by the bot. You will only
  need to do this once across all repos using our CLA.

  This project has adopted the
  [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
  see the Code of Conduct FAQ or contact opencode@microsoft.com with any
  additional questions or comments.

  <!-- LINKS -->
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [azure_sub]: https://azure.microsoft.com/free/
  [python-di-src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence
  [python-di-pypi]: https://pypi.org/project/azure-ai-documentintelligence/
  [python-di-product-docs]: https://learn.microsoft.com/azure/ai-services/document-intelligence/overview?view=doc-intel-4.0.0&viewFallbackFrom=form-recog-3.0.0
  [python-di-ref-docs]: https://aka.ms/azsdk/python/documentintelligence/docs
  [python-di-samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples
  [python-di-available-regions]: https://aka.ms/azsdk/documentintelligence/available-regions
  [azure_portal]: https://ms.portal.azure.com/
  [regional_endpoints]: https://azure.microsoft.com/global-infrastructure/services/?products=form-recognizer
  [cognitive_resource_portal]: https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesFormRecognizer
  [cognitive_resource_cli]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli?tabs=windows
  [azure-key-credential]: https://aka.ms/azsdk/python/core/azurekeycredential
  [di-studio]: https://documentintelligence.ai.azure.com/studio
  [di-build-model]: https://aka.ms/azsdk/documentintelligence/buildmodel
  [di-build-training-set]: https://aka.ms/azsdk/documentintelligence/buildtrainingset
  [di-models]: https://aka.ms/azsdk/documentintelligence/models
  [di-errors]: https://aka.ms/azsdk/documentintelligence/errors
  [azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs
  [azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions
  [python_logging]: https://docs.python.org/3/library/logging.html
  [azure_cli_endpoint_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account?view=azure-cli-latest#az-cognitiveservices-account-show
  [azure_portal_get_endpoint]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource
  [cognitive_authentication_api_key]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource
  [register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/sdk/azure-sdk-logging
  [migration-guide]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md
  [sample_readme]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples
  [addon_barcodes_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_addon_barcodes.py
  [addon_fonts_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_addon_fonts.py
  [addon_formulas_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_addon_formulas.py
  [addon_highres_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_addon_highres.py
  [addon_languages_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_addon_languages.py
  [query_fields_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/documentintelligence/azure-ai-documentintelligence/samples/sample_analyze_addon_query_fields.py
  [service-rename]: https://techcommunity.microsoft.com/t5/azure-ai-services-blog/azure-form-recognizer-is-now-azure-ai-document-intelligence-with/ba-p/3875765
  [service_prebuilt_document]: https://docs.microsoft.com/azure/ai-services/document-intelligence/concept-general-document#general-document-features


pkgId: 3701a711d694746343a9bca9bee8ee540c70df88e884b74935f9f3ffa4c1c11d
name: python-azure-ai-evaluation
arch: src
version: 1.0.1
epoch: 0
release: 1
summary: Microsoft Azure Evaluation Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-evaluation-1.0.1-1.src.rpm
checksum_type: sha256
description:
  Use Azure AI Evaluation SDK to assess the performance of your generative AI applications. Generative AI application generations are quantitatively measured with mathematical based metrics, AI-assisted quality and safety metrics. Metrics are defined as `evaluators`. Built-in or custom evaluators can provide comprehensive insights into the application's capabilities and limitations.

  Use Azure AI Evaluation SDK to:
  - Evaluate existing data from generative AI applications
  - Evaluate generative AI applications
  - Evaluate by generating mathematical, AI-assisted quality and safety metrics

  Azure AI SDK provides following to evaluate Generative AI Applications:
  - [Evaluators][evaluators] - Generate scores individually or when used together with `evaluate` API.
  - [Evaluate API][evaluate_api] - Python API to evaluate dataset or application using built-in or custom evaluators.

  [Source code][source_code]
  | [Package (PyPI)][evaluation_pypi]
  | [API reference documentation][evaluation_ref_docs]
  | [Product documentation][product_documentation]
  | [Samples][evaluation_samples]






  - Python 3.8 or later is required to use this package.
  - [Optional] You must have [Azure AI Project][ai_project] or [Azure Open AI][azure_openai] to use AI-assisted evaluators



  Install the Azure AI Evaluation SDK for Python with [pip][pip_link]:

  ```bash
  pip install azure-ai-evaluation
  ```
  If you want to track results in [AI Studio][ai_studio], install `remote` extra:
  ```python
  pip install azure-ai-evaluation[remote]
  ```





  Evaluators are custom or prebuilt classes or functions that are designed to measure the quality of the outputs from language models or generative AI applications.



  Built-in evaluators are out of box evaluators provided by Microsoft:
  | Category  | Evaluator class                                                                                                                    |
  |-----------|------------------------------------------------------------------------------------------------------------------------------------|
  | [Performance and quality][performance_and_quality_evaluators] (AI-assisted)  | `GroundednessEvaluator`, `RelevanceEvaluator`, `CoherenceEvaluator`, `FluencyEvaluator`, `SimilarityEvaluator`, `RetrievalEvaluator` |
  | [Performance and quality][performance_and_quality_evaluators] (NLP)  | `F1ScoreEvaluator`, `RougeScoreEvaluator`, `GleuScoreEvaluator`, `BleuScoreEvaluator`, `MeteorScoreEvaluator`|
  | [Risk and safety][risk_and_safety_evaluators] (AI-assisted)    | `ViolenceEvaluator`, `SexualEvaluator`, `SelfHarmEvaluator`, `HateUnfairnessEvaluator`, `IndirectAttackEvaluator`, `ProtectedMaterialEvaluator`                                             |
  | [Composite][composite_evaluators] | `QAEvaluator`, `ContentSafetyEvaluator`                                             |

  For more in-depth information on each evaluator definition and how it's calculated, see [Evaluation and monitoring metrics for generative AI][evaluation_metrics].

  ```python
  import os

  from azure.ai.evaluation import evaluate, RelevanceEvaluator, ViolenceEvaluator, BleuScoreEvaluator


  bleu_score_evaluator = BleuScoreEvaluator()
  result = bleu_score(
      response="Tokyo is the capital of Japan.",
      ground_truth="The capital of Japan is Tokyo."
  )


  model_config = {
      "azure_endpoint": os.environ.get("AZURE_OPENAI_ENDPOINT"),
      "api_key": os.environ.get("AZURE_OPENAI_API_KEY"),
      "azure_deployment": os.environ.get("AZURE_OPENAI_DEPLOYMENT"),
  }

  relevance_evaluator = RelevanceEvaluator(model_config)
  result = relevance_evaluator(
      query="What is the capital of Japan?",
      response="The capital of Japan is Tokyo."
  )


  azure_ai_project = {
      "subscription_id": "<subscription_id>",
      "resource_group_name": "<resource_group_name>",
      "project_name": "<project_name>",
  }

  violence_evaluator = ViolenceEvaluator(azure_ai_project)
  result = violence_evaluator(
      query="What is the capital of France?",
      response="Paris."
  )
  ```



  Built-in evaluators are great out of the box to start evaluating your application's generations. However you can build your own code-based or prompt-based evaluator to cater to your specific evaluation needs.

  ```python


  def response_length(response, **kwargs):
      return len(response)


  class BlocklistEvaluator:
      def __init__(self, blocklist):
          self._blocklist = blocklist

      def __call__(self, *, response: str, **kwargs):
          score = any([word in answer for word in self._blocklist])
          return {"score": score}

  blocklist_evaluator = BlocklistEvaluator(blocklist=["bad, worst, terrible"])

  result = response_length("The capital of Japan is Tokyo.")
  result = blocklist_evaluator(answer="The capital of Japan is Tokyo.")

  ```


  The package provides an `evaluate` API which can be used to run multiple evaluators together to evaluate generative AI application response.



  ```python
  from azure.ai.evaluation import evaluate

  result = evaluate(
      data="data.jsonl", # provide your data here
      evaluators={
          "blocklist": blocklist_evaluator,
          "relevance": relevance_evaluator
      },
      
      evaluator_config={
          "relevance": {
              "column_mapping": {
                  "query": "${data.queries}"
                  "ground_truth": "${data.ground_truth}"
                  "response": "${outputs.response}"
              }
          }
      }
      
      azure_ai_project = azure_ai_project,
      
      output_path="./evaluation_results.json"
  )
  ```
  For more details refer to [Evaluate on test dataset using evaluate()][evaluate_dataset]


  ```python
  from askwiki import askwiki

  result = evaluate(
      data="data.jsonl",
      target=askwiki,
      evaluators={
          "relevance": relevance_eval
      },
      evaluator_config={
          "default": {
              "column_mapping": {
                  "query": "${data.queries}"
                  "context": "${outputs.context}"
                  "response": "${outputs.response}"
              }
          }
      }
  )
  ```
  Above code snippet refers to askwiki application in this [sample][evaluate_app].

  For more details refer to [Evaluate on a target][evaluate_target]




  Simulators allow users to generate synthentic data using their application. Simulator expects the user to have a callback method that invokes their AI application. The intergration between your AI application and the simulator happens at the callback method. Here's how a sample callback would look like:


  ```python
  async def callback(
      messages: Dict[str, List[Dict]],
      stream: bool = False,
      session_state: Any = None,
      context: Optional[Dict[str, Any]] = None,
  ) -> dict:
      messages_list = messages["messages"]
      
      latest_message = messages_list[-1]
      query = latest_message["content"]
      
      
      response = call_to_your_application(query, messages_list, context)
      formatted_response = {
          "content": response,
          "role": "assistant",
          "context": "",
      }
      messages["messages"].append(formatted_response)
      return {"messages": messages["messages"], "stream": stream, "session_state": session_state, "context": context}
  ```

  The simulator initialization and invocation looks like this:
  ```python
  from azure.ai.evaluation.simulator import Simulator
  model_config = {
      "azure_endpoint": os.environ.get("AZURE_ENDPOINT"),
      "azure_deployment": os.environ.get("AZURE_DEPLOYMENT_NAME"),
      "api_version": os.environ.get("AZURE_API_VERSION"),
  }
  custom_simulator = Simulator(model_config=model_config)
  outputs = asyncio.run(custom_simulator(
      target=callback,
      conversation_turns=[
          [
              "What should I know about the public gardens in the US?",
          ],
          [
              "How do I simulate data against LLMs",
          ],
      ],
      max_conversation_turns=2,
  ))
  with open("simulator_output.jsonl", "w") as f:
      for output in outputs:
          f.write(output.to_eval_qr_json_lines())
  ```



  ```python
  from azure.ai.evaluation.simulator import AdversarialSimulator, AdversarialScenario
  from azure.identity import DefaultAzureCredential
  azure_ai_project = {
      "subscription_id": <subscription_id>,
      "resource_group_name": <resource_group_name>,
      "project_name": <project_name>
  }
  scenario = AdversarialScenario.ADVERSARIAL_QA
  simulator = AdversarialSimulator(azure_ai_project=azure_ai_project, credential=DefaultAzureCredential())

  outputs = asyncio.run(
      simulator(
          scenario=scenario,
          max_conversation_turns=1,
          max_simulation_results=3,
          target=callback
      )
  )

  print(outputs.to_eval_qr_json_lines())
  ```

  For more details about the simulator, visit the following links:
  - [Adversarial Simulation docs][adversarial_simulation_docs]
  - [Adversarial scenarios][adversarial_simulation_scenarios]
  - [Simulating jailbreak attacks][adversarial_jailbreak]



  In following section you will find examples of:
  - [Evaluate an application][evaluate_app]
  - [Evaluate different models][evaluate_models]
  - [Custom Evaluators][custom_evaluators]
  - [Adversarial Simulation][adversarial_simulation]
  - [Simulate with conversation starter][simulate_with_conversation_starter]

  More examples can be found [here][evaluate_samples].





  Please refer to [troubleshooting][evaluation_tsg] for common issues.



  This library uses the standard
  [logging][python_logging] library for logging.
  Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO
  level.

  Detailed DEBUG level logging, including request/response bodies and unredacted
  headers, can be enabled on a client with the `logging_enable` argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  - View our [samples][evaluation_samples].
  - View our [documentation][product_documentation]



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [source_code]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/evaluation/azure-ai-evaluation
  [evaluation_pypi]: https://pypi.org/project/azure-ai-evaluation/
  [evaluation_ref_docs]: https://learn.microsoft.com/python/api/azure-ai-evaluation/azure.ai.evaluation?view=azure-python-preview
  [evaluation_samples]: https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios
  [product_documentation]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk
  [python_logging]: https://docs.python.org/3/library/logging.html
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
  [azure_core_readme]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [pip_link]: https://pypi.org/project/pip/
  [azure_core_ref_docs]: https://aka.ms/azsdk-python-core-policies
  [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/core/azure-core/README.md
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com
  [evaluate_target]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk#evaluate-on-a-target
  [evaluate_dataset]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk#evaluate-on-test-dataset-using-evaluate
  [evaluators]: https://learn.microsoft.com/python/api/azure-ai-evaluation/azure.ai.evaluation?view=azure-python-preview
  [evaluate_api]: https://learn.microsoft.com/python/api/azure-ai-evaluation/azure.ai.evaluation?view=azure-python-preview#azure-ai-evaluation-evaluate
  [evaluate_app]: https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios/evaluate/evaluate_app
  [evaluation_tsg]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/evaluation/azure-ai-evaluation/TROUBLESHOOTING.md
  [ai_studio]: https://learn.microsoft.com/azure/ai-studio/what-is-ai-studio
  [ai_project]: https://learn.microsoft.com/azure/ai-studio/how-to/create-projects?tabs=ai-studio
  [azure_openai]: https://learn.microsoft.com/azure/ai-services/openai/
  [evaluate_models]: https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios/evaluate/evaluate_endpoints
  [custom_evaluators]: https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios/evaluate/evaluate_custom
  [evaluate_samples]: https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios/evaluate
  [evaluation_metrics]: https://learn.microsoft.com/azure/ai-studio/concepts/evaluation-metrics-built-in
  [performance_and_quality_evaluators]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk#performance-and-quality-evaluators
  [risk_and_safety_evaluators]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk#risk-and-safety-evaluators
  [composite_evaluators]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/evaluate-sdk#composite-evaluators
  [adversarial_simulation_docs]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/simulator-interaction-data#generate-adversarial-simulations-for-safety-evaluation
  [adversarial_simulation_scenarios]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/simulator-interaction-data#supported-adversarial-simulation-scenarios
  [adversarial_simulation]: https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios/evaluate/simulate_adversarial
  [simulate_with_conversation_starter]: https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios/evaluate/simulate_conversation_starter
  [adversarial_jailbreak]: https://learn.microsoft.com/azure/ai-studio/how-to/develop/simulator-interaction-data#simulating-jailbreak-attacks







  - Fixed `[remote]` extra to be needed only when tracking results in Azure AI Studio.
  - Removing `azure-ai-inference` as dependency.




  - The `parallel` parameter has been removed from composite evaluators: `QAEvaluator`, `ContentSafetyChatEvaluator`, and `ContentSafetyMultimodalEvaluator`. To control evaluator parallelism, you can now use the `_parallel` keyword argument, though please note that this private parameter may change in the future.
  - Parameters `query_response_generating_prompty_kwargs` and `user_simulator_prompty_kwargs` have been renamed to `query_response_generating_prompty_options` and `user_simulator_prompty_options` in the Simulator's __call__ method.


  - Fixed an issue where the `output_path` parameter in the `evaluate` API did not support relative path.
  - Output of adversarial simulators are of type `JsonLineList` and the helper function `to_eval_qr_json_lines` now outputs context from both user and assistant turns along with `category` if it exists in the conversation
  - Fixed an issue where during long-running simulations, API token expires causing "Forbidden" error. Instead, users can now set an environment variable `AZURE_TOKEN_REFRESH_INTERVAL` to refresh the token more frequently to prevent expiration and ensure continuous operation of the simulation.
  - Fix `evaluate` function not producing aggregated metrics if ANY values to be aggregated were None, NaN, or
  otherwise difficult to process. Such values are ignored fully, so the aggregated metric of `[1, 2, 3, NaN]`
  would be 2, not 1.5.


  - Refined error messages for serviced-based evaluators and simulators.
  - Tracing has been disabled due to Cosmos DB initialization issue.
  - Introduced environment variable `AI_EVALS_DISABLE_EXPERIMENTAL_WARNING` to disable the warning message for experimental features.
  - Changed the randomization pattern for `AdversarialSimulator` such that there is an almost equal number of Adversarial harm categories (e.g. Hate + Unfairness, Self-Harm, Violence, Sex) represented in the  `AdversarialSimulator` outputs. Previously, for 200 `max_simulation_results` a user might see 140 results belonging to the 'Hate + Unfairness' category and 40 results belonging to the 'Self-Harm' category. Now, user will see 50 results for each of Hate + Unfairness, Self-Harm, Violence, and Sex.
  - For the `DirectAttackSimulator`, the prompt templates used to generate simulated outputs for each Adversarial harm category will no longer be in a randomized order by default. To override this behavior, pass `randomize_order=True` when you call the `DirectAttackSimulator`, for example:
  ```python
  adversarial_simulator = DirectAttackSimulator(azure_ai_project=azure_ai_project, credential=DefaultAzureCredential())
  outputs = asyncio.run(
      adversarial_simulator(
          scenario=scenario,
          target=callback,
          randomize_order=True
      )
  )
  ```




  - Added `GroundednessProEvaluator`, which is a service-based evaluator for determining response groundedness.
  - Groundedness detection in Non Adversarial Simulator via query/context pairs
  ```python
  import importlib.resources as pkg_resources
  package = "azure.ai.evaluation.simulator._data_sources"
  resource_name = "grounding.json"
  custom_simulator = Simulator(model_config=model_config)
  conversation_turns = []
  with pkg_resources.path(package, resource_name) as grounding_file:
      with open(grounding_file, "r") as file:
          data = json.load(file)
  for item in data:
      conversation_turns.append([item])
  outputs = asyncio.run(custom_simulator(
      target=callback,
      conversation_turns=conversation_turns,
      max_conversation_turns=1,
  ))
  ```
  - Adding evaluator for multimodal use cases


  - Renamed environment variable `PF_EVALS_BATCH_USE_ASYNC` to `AI_EVALS_BATCH_USE_ASYNC`.
  - `RetrievalEvaluator` now requires a `context` input in addition to `query` in single-turn evaluation.
  - `RelevanceEvaluator` no longer takes `context` as an input. It now only takes `query` and `response` in single-turn evaluation.
  - `FluencyEvaluator` no longer takes `query` as an input. It now only takes `response` in single-turn evaluation.
  - AdversarialScenario enum does not include `ADVERSARIAL_INDIRECT_JAILBREAK`, invoking IndirectJailbreak or XPIA should be done with `IndirectAttackSimulator`
  - Outputs of `Simulator` and `AdversarialSimulator` previously had `to_eval_qa_json_lines` and now has `to_eval_qr_json_lines`. Where `to_eval_qa_json_lines` had:
  ```json
  {"question": <user_message>, "answer": <assistant_message>}
  ```
  `to_eval_qr_json_lines` now has:
  ```json
  {"query": <user_message>, "response": assistant_message}
  ```


  - Non adversarial simulator works with `gpt-4o` models using the `json_schema` response format
  - Fixed an issue where the `evaluate` API would fail with "[WinError 32] The process cannot access the file because it is being used by another process" when venv folder and target function file are in the same directory.
  - Fix evaluate API failure when `trace.destination` is set to `none`
  - Non adversarial simulator now accepts context from the callback


  - Improved error messages for the `evaluate` API by enhancing the validation of input parameters. This update provides more detailed and actionable error descriptions.
  - `GroundednessEvaluator` now supports `query` as an optional input in single-turn evaluation. If `query` is provided, a different prompt template will be used for the evaluation.
  - To align with our support of a diverse set of models, the following evaluators will now have a new key in their result output without the `gpt_` prefix. To maintain backwards compatibility, the old key with the `gpt_` prefix will still be present in the output; however, it is recommended to use the new key moving forward as the old key will be deprecated in the future.
    - `CoherenceEvaluator`
    - `RelevanceEvaluator`
    - `FluencyEvaluator`
    - `GroundednessEvaluator`
    - `SimilarityEvaluator`
    - `RetrievalEvaluator`
  - The following evaluators will now have a new key in their result output including LLM reasoning behind the score. The new key will follow the pattern "<metric_name>_reason". The reasoning is the result of a more detailed prompt template being used to generate the LLM response. Note that this requires the maximum number of tokens used to run these evaluators to be increased.

      | Evaluator | New `max_token` for Generation |
      | --- | --- |
      | `CoherenceEvaluator` | 800 |
      | `RelevanceEvaluator` | 800 |
      | `FluencyEvaluator` | 800 |
      | `GroundednessEvaluator` | 800 |
      | `RetrievalEvaluator` | 1600 |
  - Improved the error message for storage access permission issues to provide clearer guidance for users.





  - Removed `numpy` dependency. All NaN values returned by the SDK have been changed to from `numpy.nan` to `math.nan`.
  - `credential` is now required to be passed in for all content safety evaluators and `ProtectedMaterialsEvaluator`. `DefaultAzureCredential` will no longer be chosen if a credential is not passed.
  - Changed package extra name from "pf-azure" to "remote".


  - Adversarial Conversation simulations would fail with `Forbidden`. Added logic to re-fetch token in the exponential retry logic to retrive RAI Service response.
  - Fixed an issue where the Evaluate API did not fail due to missing inputs when the target did not return columns required by the evaluators.


  - Enhance the error message to provide clearer instruction when required packages for the remote tracking feature are missing.
  - Print the per-evaluator run summary at the end of the Evaluate API call to make troubleshooting row-level failures easier.





  - Added `type` field to `AzureOpenAIModelConfiguration` and `OpenAIModelConfiguration`
  - The following evaluators now support `conversation` as an alternative input to their usual single-turn inputs:
    - `ViolenceEvaluator`
    - `SexualEvaluator`
    - `SelfHarmEvaluator`
    - `HateUnfairnessEvaluator`
    - `ProtectedMaterialEvaluator`
    - `IndirectAttackEvaluator`
    - `CoherenceEvaluator`
    - `RelevanceEvaluator`
    - `FluencyEvaluator`
    - `GroundednessEvaluator`
  - Surfaced `RetrievalScoreEvaluator`, formally an internal part of `ChatEvaluator` as a standalone conversation-only evaluator.



  - Removed `ContentSafetyChatEvaluator` and `ChatEvaluator`
  - The `evaluator_config` parameter of `evaluate` now maps in evaluator name to a dictionary `EvaluatorConfig`, which is a `TypedDict`. The
  `column_mapping` between `data` or `target` and evaluator field names should now be specified inside this new dictionary:

  Before:
  ```python
  evaluate(
      ...,
      evaluator_config={
          "hate_unfairness": {
              "query": "${data.question}",
              "response": "${data.answer}",
          }
      },
      ...
  )
  ```

  After
  ```python
  evaluate(
      ...,
      evaluator_config={
          "hate_unfairness": {
              "column_mapping": {
                  "query": "${data.question}",
                  "response": "${data.answer}",
               }
          }
      },
      ...
  )
  ```

  - Simulator now requires a model configuration to call the prompty instead of an Azure AI project scope. This enables the usage of simulator with Entra ID based auth.
  Before:
  ```python
  azure_ai_project = {
      "subscription_id": os.environ.get("AZURE_SUBSCRIPTION_ID"),
      "resource_group_name": os.environ.get("RESOURCE_GROUP"),
      "project_name": os.environ.get("PROJECT_NAME"),
  }
  sim = Simulator(azure_ai_project=azure_ai_project, credentails=DefaultAzureCredentials())
  ```
  After:
  ```python
  model_config = {
      "azure_endpoint": os.environ.get("AZURE_OPENAI_ENDPOINT"),
      "azure_deployment": os.environ.get("AZURE_DEPLOYMENT"),
  }
  sim = Simulator(model_config=model_config)
  ```
  If `api_key` is not included in the `model_config`, the prompty runtime in `promptflow-core` will pick up `DefaultAzureCredential`.



  - Fixed issue where Entra ID authentication was not working with `AzureOpenAIModelConfiguration`





  - `data` and `evaluators` are now required keywords in `evaluate`.





  - The `synthetic` namespace has been renamed to `simulator`, and sub-namespaces under this module have been removed
  - The `evaluate` and `evaluators` namespaces have been removed, and everything previously exposed in those modules has been added to the root namespace `azure.ai.evaluation`
  - The parameter name `project_scope` in content safety evaluators have been renamed to `azure_ai_project` for consistency with evaluate API and simulators.
  - Model configurations classes are now of type `TypedDict` and are exposed in the `azure.ai.evaluation` module instead of coming from `promptflow.core`.
  - Updated the parameter names for `question` and `answer` in built-in evaluators to more generic terms: `query` and `response`.



  - First preview
  - This package is port of `promptflow-evals`. New features will be added only to this package moving forward.
  - Added a `TypedDict` for `AzureAIProject` that allows for better intellisense and type checking when passing in project information


pkgId: 9dce32f75f71b1df3950dc78c6299fcc067602fd0e1a977181d7e02677e7c5f7
name: python-azure-ai-formrecognizer
arch: src
version: 3.3.3
epoch: 0
release: 1
summary: Microsoft Azure Form Recognizer Client Library for Python
url: https://github.com/Azure/azure-sdk-for-python
rpm_license: MIT License
rpm_group: Unspecified
rpm_buildhost: localhost
location_href: Packages/python-azure-ai-formrecognizer-3.3.3-1.src.rpm
checksum_type: sha256
description:
  Azure Document Intelligence ([previously known as Form Recognizer][service-rename]) is a cloud service that uses machine learning to analyze text and structured data from your documents. It includes the following main features:

  - Layout - Extract content and structure (ex. words, selection marks, tables) from documents.
  - Document - Analyze key-value pairs in addition to general layout from documents.
  - Read - Read page information from documents.
  - Prebuilt - Extract common field values from select document types (ex. receipts, invoices, business cards, ID documents, U.S. W-2 tax documents, among others) using prebuilt models.
  - Custom - Build custom models from your own data to extract tailored field values in addition to general layout from documents.
  - Classifiers - Build custom classification models that combine layout and language features to accurately detect and identify documents you process within your application.
  - Add-on capabilities - Extract barcodes/QR codes, formulas, font/style, etc. or enable high resolution mode for large documents with optional parameters.

  [Source code][python-fr-src]
  | [Package (PyPI)][python-fr-pypi]
  | [Package (Conda)](https://anaconda.org/microsoft/azure-ai-formrecognizer/)
  | [API reference documentation][python-fr-ref-docs]
  | [Product documentation][python-fr-product-docs]
  | [Samples][python-fr-samples]




  _This package supports the following service API versions: 2.0, 2.1, 2022-08-31 and 2023-07-31. Service API version 2023-10-31-preview and later are supported in package `azure-ai-documentintelligence`. Please refer this [doc][fr_to_di_migration_guideline] for migration details._






  * Python 3.8 or later is required to use this package.
  * You must have an [Azure subscription][azure_subscription] and a
  [Cognitive Services or Form Recognizer resource][FR_or_CS_resource] to use this package.



  Install the Azure Form Recognizer client library for Python with [pip][pip]:

  ```bash
  pip install azure-ai-formrecognizer
  ```

  > Note: This version of the client library defaults to the `2023-07-31` version of the service.

  This table shows the relationship between SDK versions and supported API versions of the service:

  |SDK version|Supported API version of service
  |-|-
  |3.3.X - Latest GA release | 2.0, 2.1, 2022-08-31, 2023-07-31 (default)
  |3.2.X | 2.0, 2.1, 2022-08-31 (default)
  |3.1.X| 2.0, 2.1 (default)
  |3.0.0| 2.0

  > Note: Starting with version `3.2.X`, a new set of clients were introduced to leverage the newest features
  > of the Document Intelligence service. Please see the [Migration Guide][migration-guide] for detailed instructions on how to update application
  > code from client library version `3.1.X` or lower to the latest version. Additionally, see the [Changelog][changelog] for more detailed information.
  > The below table describes the relationship of each client and its supported API version(s):

  |API version|Supported clients
  |-|-
  |2023-07-31 | DocumentAnalysisClient and DocumentModelAdministrationClient
  |2022-08-31 | DocumentAnalysisClient and DocumentModelAdministrationClient
  |2.1 | FormRecognizerClient and FormTrainingClient
  |2.0 | FormRecognizerClient and FormTrainingClient



  Document Intelligence supports both [multi-service and single-service access][cognitive_resource_portal]. Create a Cognitive Services resource if you plan to access multiple cognitive services under a single endpoint/key. For Document Intelligence access only, create a Form Recognizer resource. Please note that you will need a single-service resource if you intend to use [Azure Active Directory authentication](#create-the-client-with-an-azure-active-directory-credential).

  You can create either resource using:

  * Option 1: [Azure Portal][cognitive_resource_portal].
  * Option 2: [Azure CLI][cognitive_resource_cli].

  Below is an example of how you can create a Form Recognizer resource using the CLI:

  ```PowerShell


  az group create --name <your-resource-name> --location <location>
  ```

  ```PowerShell

  az cognitiveservices account create \
      --name <your-resource-name> \
      --resource-group <your-resource-group-name> \
      --kind FormRecognizer \
      --sku <sku> \
      --location <location> \
      --yes
  ```

  For more information about creating the resource or how to get the location and sku information see [here][cognitive_resource_cli].



  In order to interact with the Document Intelligence service, you will need to create an instance of a client.
  An **endpoint** and **credential** are necessary to instantiate the client object.



  You can find the endpoint for your Form Recognizer resource using the
  [Azure Portal][azure_portal_get_endpoint]
  or [Azure CLI][azure_cli_endpoint_lookup]:

  ```bash

  az cognitiveservices account show --name "resource-name" --resource-group "resource-group-name" --query "properties.endpoint"
  ```

  Either a regional endpoint or a custom subdomain can be used for authentication. They are formatted as follows:

  ```
  Regional endpoint: https://<region>.api.cognitive.microsoft.com/
  Custom subdomain: https://<resource-name>.cognitiveservices.azure.com/
  ```

  A regional endpoint is the same for every resource in a region. A complete list of supported regional endpoints can be consulted [here][regional_endpoints]. Please note that regional endpoints do not support AAD authentication.

  A custom subdomain, on the other hand, is a name that is unique to the Form Recognizer resource. They can only be used by [single-service resources][cognitive_resource_portal].



  The API key can be found in the [Azure Portal][azure_portal] or by running the following Azure CLI command:

  ```bash
  az cognitiveservices account keys list --name "<resource-name>" --resource-group "<resource-group-name>"
  ```



  To use an [API key][cognitive_authentication_api_key] as the `credential` parameter,
  pass the key as a string into an instance of [AzureKeyCredential][azure-key-credential].

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.formrecognizer import DocumentAnalysisClient

  endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api_key>")
  document_analysis_client = DocumentAnalysisClient(endpoint, credential)
  ```



  `AzureKeyCredential` authentication is used in the examples in this getting started guide, but you can also
  authenticate with Azure Active Directory using the [azure-identity][azure_identity] library.
  Note that regional endpoints do not support AAD authentication. Create a [custom subdomain][custom_subdomain]
  name for your resource in order to use this type of authentication.

  To use the [DefaultAzureCredential][default_azure_credential] type shown below, or other credential types provided
  with the Azure SDK, please install the `azure-identity` package:

  ```pip install azure-identity```

  You will also need to [register a new AAD application and grant access][register_aad_app] to Document Intelligence by assigning the `"Cognitive Services User"` role to your service principal.

  Once completed, set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables:
  `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`.

  <!-- SNIPPET:sample_authentication.create_da_client_with_aad -->

  ```python
  """DefaultAzureCredential will use the values from these environment
  variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET
  """
  from azure.ai.formrecognizer import DocumentAnalysisClient
  from azure.identity import DefaultAzureCredential

  endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
  credential = DefaultAzureCredential()

  document_analysis_client = DocumentAnalysisClient(endpoint, credential)
  ```

  <!-- END SNIPPET -->





  `DocumentAnalysisClient` provides operations for analyzing input documents using prebuilt and custom models through the `begin_analyze_document` and `begin_analyze_document_from_url` APIs.
  Use the `model_id` parameter to select the type of model for analysis. See a full list of supported models [here][fr-models].
  The `DocumentAnalysisClient` also provides operations for classifying documents through the `begin_classify_document` and `begin_classify_document_from_url` APIs.
  Custom classification models can classify each page in an input file to identify the document(s) within and can also identify multiple documents or multiple instances of a single document within an input file.

  Sample code snippets are provided to illustrate using a DocumentAnalysisClient [here](#examples "Examples").
  More information about analyzing documents, including supported features, locales, and document types can be found in the [service documentation][fr-models].



  `DocumentModelAdministrationClient` provides operations for:

  - Building custom models to analyze specific fields you specify by labeling your custom documents. A `DocumentModelDetails` is returned indicating the document type(s) the model can analyze, as well as the estimated confidence for each field. See the [service documentation][fr-build-model] for a more detailed explanation.
  - Creating a composed model from a collection of existing models.
  - Managing models created in your account.
  - Listing operations or getting a specific model operation created within the last 24 hours.
  - Copying a custom model from one Form Recognizer resource to another.
  - Build and manage a custom classification model to classify the documents you process within your application.

  Please note that models can also be built using a graphical user interface such as [Document Intelligence Studio][fr-studio].

  Sample code snippets are provided to illustrate using a DocumentModelAdministrationClient [here](#examples "Examples").



  Long-running operations are operations which consist of an initial request sent to the service to start an operation,
  followed by polling the service at intervals to determine whether the operation has completed or failed, and if it has
  succeeded, to get the result.

  Methods that analyze documents, build models, or copy/compose models are modeled as long-running operations.
  The client exposes a `begin_<method-name>` method that returns an `LROPoller` or `AsyncLROPoller`. Callers should wait
  for the operation to complete by calling `result()` on the poller object returned from the `begin_<method-name>` method.
  Sample code snippets are provided to illustrate using long-running operations [below](#examples "Examples").



  The following section provides several code snippets covering some of the most common Document Intelligence tasks, including:

  * [Extract Layout](#extract-layout "Extract Layout")
  * [Using the General Document Model](#using-the-general-document-model "Using the General Document Model")
  * [Using Prebuilt Models](#using-prebuilt-models "Using Prebuilt Models")
  * [Build a Custom Model](#build-a-custom-model "Build a custom model")
  * [Analyze Documents Using a Custom Model](#analyze-documents-using-a-custom-model "Analyze Documents Using a Custom Model")
  * [Manage Your Models](#manage-your-models "Manage Your Models")
  * [Classify Documents][classify_sample]
  * [Add-on capabilities](#add-on-capabilities "Add-on Capabilities")



  Extract text, selection marks, text styles, and table structures, along with their bounding region coordinates, from documents.

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.formrecognizer import DocumentAnalysisClient

  endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
  key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

  document_analysis_client = DocumentAnalysisClient(
      endpoint=endpoint, credential=AzureKeyCredential(key)
  )
  with open(path_to_sample_documents, "rb") as f:
      poller = document_analysis_client.begin_analyze_document(
          "prebuilt-layout", document=f
      )
  result = poller.result()

  for idx, style in enumerate(result.styles):
      print(
          "Document contains {} content".format(
              "handwritten" if style.is_handwritten else "no handwritten"
          )
      )

  for page in result.pages:
      print("----Analyzing layout from page #{}----".format(page.page_number))
      print(
          "Page has width: {} and height: {}, measured with unit: {}".format(
              page.width, page.height, page.unit
          )
      )

      for line_idx, line in enumerate(page.lines):
          words = line.get_words()
          print(
              "...Line # {} has word count {} and text '{}' within bounding polygon '{}'".format(
                  line_idx,
                  len(words),
                  line.content,
                  line.polygon,
              )
          )

          for word in words:
              print(
                  "......Word '{}' has a confidence of {}".format(
                      word.content, word.confidence
                  )
              )

      for selection_mark in page.selection_marks:
          print(
              "...Selection mark is '{}' within bounding polygon '{}' and has a confidence of {}".format(
                  selection_mark.state,
                  selection_mark.polygon,
                  selection_mark.confidence,
              )
          )

  for table_idx, table in enumerate(result.tables):
      print(
          "Table # {} has {} rows and {} columns".format(
              table_idx, table.row_count, table.column_count
          )
      )
      for region in table.bounding_regions:
          print(
              "Table # {} location on page: {} is {}".format(
                  table_idx,
                  region.page_number,
                  region.polygon,
              )
          )
      for cell in table.cells:
          print(
              "...Cell[{}][{}] has content '{}'".format(
                  cell.row_index,
                  cell.column_index,
                  cell.content,
              )
          )
          for region in cell.bounding_regions:
              print(
                  "...content on page {} is within bounding polygon '{}'".format(
                      region.page_number,
                      region.polygon,
                  )
              )

  print("----------------------------------------")
  ```



  Analyze key-value pairs, tables, styles, and selection marks from documents using the general document model provided by the Document Intelligence service.
  Select the General Document Model by passing `model_id="prebuilt-document"` into the `begin_analyze_document` method:

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.formrecognizer import DocumentAnalysisClient

  endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
  key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

  document_analysis_client = DocumentAnalysisClient(
      endpoint=endpoint, credential=AzureKeyCredential(key)
  )
  with open(path_to_sample_documents, "rb") as f:
      poller = document_analysis_client.begin_analyze_document(
          "prebuilt-document", document=f
      )
  result = poller.result()

  for style in result.styles:
      if style.is_handwritten:
          print("Document contains handwritten content: ")
          print(",".join([result.content[span.offset:span.offset + span.length] for span in style.spans]))

  print("----Key-value pairs found in document----")
  for kv_pair in result.key_value_pairs:
      if kv_pair.key:
          print(
                  "Key '{}' found within '{}' bounding regions".format(
                      kv_pair.key.content,
                      kv_pair.key.bounding_regions,
                  )
              )
      if kv_pair.value:
          print(
                  "Value '{}' found within '{}' bounding regions\n".format(
                      kv_pair.value.content,
                      kv_pair.value.bounding_regions,
                  )
              )

  for page in result.pages:
      print("----Analyzing document from page #{}----".format(page.page_number))
      print(
          "Page has width: {} and height: {}, measured with unit: {}".format(
              page.width, page.height, page.unit
          )
      )

      for line_idx, line in enumerate(page.lines):
          words = line.get_words()
          print(
              "...Line # {} has {} words and text '{}' within bounding polygon '{}'".format(
                  line_idx,
                  len(words),
                  line.content,
                  line.polygon,
              )
          )

          for word in words:
              print(
                  "......Word '{}' has a confidence of {}".format(
                      word.content, word.confidence
                  )
              )

      for selection_mark in page.selection_marks:
          print(
              "...Selection mark is '{}' within bounding polygon '{}' and has a confidence of {}".format(
                  selection_mark.state,
                  selection_mark.polygon,
                  selection_mark.confidence,
              )
          )

  for table_idx, table in enumerate(result.tables):
      print(
          "Table # {} has {} rows and {} columns".format(
              table_idx, table.row_count, table.column_count
          )
      )
      for region in table.bounding_regions:
          print(
              "Table # {} location on page: {} is {}".format(
                  table_idx,
                  region.page_number,
                  region.polygon,
              )
          )
      for cell in table.cells:
          print(
              "...Cell[{}][{}] has content '{}'".format(
                  cell.row_index,
                  cell.column_index,
                  cell.content,
              )
          )
          for region in cell.bounding_regions:
              print(
                  "...content on page {} is within bounding polygon '{}'\n".format(
                      region.page_number,
                      region.polygon,
                  )
              )
  print("----------------------------------------")
  ```

  - Read more about the features provided by the `prebuilt-document` model [here][service_prebuilt_document].



  Extract fields from select document types such as receipts, invoices, business cards, identity documents, and U.S. W-2 tax documents using prebuilt models provided by the Document Intelligence service.

  For example, to analyze fields from a sales receipt, use the prebuilt receipt model provided by passing `model_id="prebuilt-receipt"` into the `begin_analyze_document` method:

  <!-- SNIPPET:sample_analyze_receipts.analyze_receipts -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.formrecognizer import DocumentAnalysisClient

  endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
  key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]

  document_analysis_client = DocumentAnalysisClient(
      endpoint=endpoint, credential=AzureKeyCredential(key)
  )
  with open(path_to_sample_documents, "rb") as f:
      poller = document_analysis_client.begin_analyze_document(
          "prebuilt-receipt", document=f, locale="en-US"
      )
  receipts = poller.result()

  for idx, receipt in enumerate(receipts.documents):
      print(f"--------Analysis of receipt #{idx + 1}--------")
      print(f"Receipt type: {receipt.doc_type if receipt.doc_type else 'N/A'}")
      merchant_name = receipt.fields.get("MerchantName")
      if merchant_name:
          print(
              f"Merchant Name: {merchant_name.value} has confidence: "
              f"{merchant_name.confidence}"
          )
      transaction_date = receipt.fields.get("TransactionDate")
      if transaction_date:
          print(
              f"Transaction Date: {transaction_date.value} has confidence: "
              f"{transaction_date.confidence}"
          )
      if receipt.fields.get("Items"):
          print("Receipt items:")
          for idx, item in enumerate(receipt.fields.get("Items").value):
              print(f"...Item #{idx + 1}")
              item_description = item.value.get("Description")
              if item_description:
                  print(
                      f"......Item Description: {item_description.value} has confidence: "
                      f"{item_description.confidence}"
                  )
              item_quantity = item.value.get("Quantity")
              if item_quantity:
                  print(
                      f"......Item Quantity: {item_quantity.value} has confidence: "
                      f"{item_quantity.confidence}"
                  )
              item_price = item.value.get("Price")
              if item_price:
                  print(
                      f"......Individual Item Price: {item_price.value} has confidence: "
                      f"{item_price.confidence}"
                  )
              item_total_price = item.value.get("TotalPrice")
              if item_total_price:
                  print(
                      f"......Total Item Price: {item_total_price.value} has confidence: "
                      f"{item_total_price.confidence}"
                  )
      subtotal = receipt.fields.get("Subtotal")
      if subtotal:
          print(f"Subtotal: {subtotal.value} has confidence: {subtotal.confidence}")
      tax = receipt.fields.get("TotalTax")
      if tax:
          print(f"Total tax: {tax.value} has confidence: {tax.confidence}")
      tip = receipt.fields.get("Tip")
      if tip:
          print(f"Tip: {tip.value} has confidence: {tip.confidence}")
      total = receipt.fields.get("Total")
      if total:
          print(f"Total: {total.value} has confidence: {total.confidence}")
      print("--------------------------------------")
  ```

  <!-- END SNIPPET -->

  You are not limited to receipts! There are a few prebuilt models to choose from, each of which has its own set of supported fields. See other supported prebuilt models [here][fr-models].



  Build a custom model on your own document type. The resulting model can be used to analyze values from the types of documents it was trained on.
  Provide a container SAS URL to your Azure Storage Blob container where you're storing the training documents.

  More details on setting up a container and required file structure can be found in the [service documentation][fr-build-training-set].

  <!-- SNIPPET:sample_build_model.build_model -->

  ```python
  from azure.ai.formrecognizer import (
      DocumentModelAdministrationClient,
      ModelBuildMode,
  )
  from azure.core.credentials import AzureKeyCredential

  endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
  key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
  container_sas_url = os.environ["CONTAINER_SAS_URL"]

  document_model_admin_client = DocumentModelAdministrationClient(
      endpoint, AzureKeyCredential(key)
  )
  poller = document_model_admin_client.begin_build_document_model(
      ModelBuildMode.TEMPLATE,
      blob_container_url=container_sas_url,
      description="my model description",
  )
  model = poller.result()

  print(f"Model ID: {model.model_id}")
  print(f"Description: {model.description}")
  print(f"Model created on: {model.created_on}")
  print(f"Model expires on: {model.expires_on}")
  print("Doc types the model can recognize:")
  for name, doc_type in model.doc_types.items():
      print(
          f"Doc Type: '{name}' built with '{doc_type.build_mode}' mode which has the following fields:"
      )
      for field_name, field in doc_type.field_schema.items():
          print(
              f"Field: '{field_name}' has type '{field['type']}' and confidence score "
              f"{doc_type.field_confidence[field_name]}"
          )
  ```

  <!-- END SNIPPET -->



  Analyze document fields, tables, selection marks, and more. These models are trained with your own data, so they're tailored to your documents.
  For best results, you should only analyze documents of the same document type that the custom model was built with.

  <!-- SNIPPET:sample_analyze_custom_documents.analyze_custom_documents -->

  ```python
  from azure.core.credentials import AzureKeyCredential
  from azure.ai.formrecognizer import DocumentAnalysisClient

  endpoint = os.environ["AZURE_FORM_RECOGNIZER_ENDPOINT"]
  key = os.environ["AZURE_FORM_RECOGNIZER_KEY"]
  model_id = os.getenv("CUSTOM_BUILT_MODEL_ID", custom_model_id)

  document_analysis_client = DocumentAnalysisClient(
      endpoint=endpoint, credential=AzureKeyCredential(key)
  )


  with open(path_to_sample_documents, "rb") as f:
      poller = document_analysis_client.begin_analyze_document(
          model_id=model_id, document=f
      )
  result = poller.result()

  for idx, document in enumerate(result.documents):
      print(f"--------Analyzing document #{idx + 1}--------")
      print(f"Document has type {document.doc_type}")
      print(f"Document has document type confidence {document.confidence}")
      print(f"Document was analyzed with model with ID {result.model_id}")
      for name, field in document.fields.items():
          field_value = field.value if field.value else field.content
          print(
              f"......found field of type '{field.value_type}' with value '{field_value}' and with confidence {field.confidence}"
          )


  for page in result.pages:
      print(f"\nLines found on page {page.page_number}")
      for line in page.lines:
          print(f"...Line '{line.content}'")
      for word in page.words:
          print(f"...Word '{word.content}' has a confidence of {word.confidence}")
      if page.selection_marks:
          print(f"\nSelection marks found on page {page.page_number}")
          for selection_mark in page.selection_marks:
              print(
                  f"...Selection mark is '{selection_mark.state}' and has a confidence of {selection_mark.confidence}"
              )

  for i, table in enumerate(result.tables):
      print(f"\nTable {i + 1} can be found on page:")
      for region in table.bounding_regions:
          print(f"...{region.page_number}")
      for cell in table.cells:
          print(
              f"...Cell[{cell.row_index}][{cell.column_index}] has text '{cell.content}'"
          )
  print("-----------------------------------")
  ```

  <!-- END SNIPPET -->

  Alternatively, a document URL can also be used to analyze documents using the `begin_analyze_document_from_url` method.

  ```python
  document_url = "<url_of_the_document>"
  poller = document_analysis_client.begin_analyze_document_from_url(model_id=model_id, document_url=document_url)
  result = poller.result()
  ```



  Manage the custom models attached to your account.

  ```python
  from azure.ai.formrecognizer import DocumentModelAdministrationClient
  from azure.core.credentials import AzureKeyCredential
  from azure.core.exceptions import ResourceNotFoundError

  endpoint = "https://<my-custom-subdomain>.cognitiveservices.azure.com/"
  credential = AzureKeyCredential("<api_key>")

  document_model_admin_client = DocumentModelAdministrationClient(endpoint, credential)

  account_details = document_model_admin_client.get_resource_details()
  print("Our account has {} custom models, and we can have at most {} custom models".format(
      account_details.custom_document_models.count, account_details.custom_document_models.limit
  ))


  models = document_model_admin_client.list_document_models()
  print("We have models with the following ids: {}".format(
      ", ".join([m.model_id for m in models])
  ))


  model_id = "<model_id from the Build a Model sample>"

  custom_model = document_model_admin_client.get_document_model(model_id=model_id)
  print("Model ID: {}".format(custom_model.model_id))
  print("Description: {}".format(custom_model.description))
  print("Model created on: {}\n".format(custom_model.created_on))


  document_model_admin_client.delete_document_model(model_id=custom_model.model_id)

  try:
      document_model_admin_client.get_document_model(model_id=custom_model.model_id)
  except ResourceNotFoundError:
      print("Successfully deleted model with id {}".format(custom_model.model_id))
  ```


  Document Intelligence supports more sophisticated analysis capabilities. These optional features can be enabled and disabled depending on the scenario of the document extraction.

  The following add-on capabilities are available for 2023-07-31 (GA) and later releases:
  - [barcode/QR code][addon_barcodes_sample]
  - [formula][addon_formulas_sample]
  - [font/style][addon_fonts_sample]
  - [high resolution mode][addon_highres_sample]
  - [language][addon_languages_sample]

  Note that some add-on capabilities will incur additional charges. See pricing: https://azure.microsoft.com/pricing/details/ai-document-intelligence/.





  Form Recognizer client library will raise exceptions defined in [Azure Core][azure_core_exceptions].
  Error codes and messages raised by the Document Intelligence service can be found in the [service documentation][fr-errors].



  This library uses the standard
  [logging][python_logging] library for logging.

  Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level.

  Detailed `DEBUG` level logging, including request/response bodies and **unredacted**
  headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.

  See full SDK logging documentation with examples [here][sdk_logging_docs].



  Optional keyword arguments can be passed in at the client and per-operation level.
  The azure-core [reference documentation][azure_core_ref_docs]
  describes available configurations for retries, logging, transport protocols, and more.





  See the [Sample README][sample_readme] for several code snippets illustrating common patterns used in the Form Recognizer Python API.



  For more extensive documentation on Azure AI Document Intelligence, see the [Document Intelligence documentation][python-fr-product-docs] on docs.microsoft.com.



  This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit [cla.microsoft.com][cla].

  When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

  This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.

  <!-- LINKS -->

  [python-fr-src]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/azure/ai/formrecognizer
  [python-fr-pypi]: https://pypi.org/project/azure-ai-formrecognizer/
  [python-fr-product-docs]: https://learn.microsoft.com/azure/applied-ai-services/form-recognizer/overview?view=form-recog-3.0.0
  [python-fr-ref-docs]: https://aka.ms/azsdk/python/formrecognizer/docs
  [python-fr-samples]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples

  [azure_subscription]: https://azure.microsoft.com/free/
  [azure_portal]: https://ms.portal.azure.com/
  [regional_endpoints]: https://azure.microsoft.com/global-infrastructure/services/?products=form-recognizer
  [FR_or_CS_resource]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows
  [pip]: https://pypi.org/project/pip/
  [cognitive_resource_portal]: https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesFormRecognizer
  [cognitive_resource_cli]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account-cli?tabs=windows
  [azure-key-credential]: https://aka.ms/azsdk/python/core/azurekeycredential
  [labeling-tool]: https://aka.ms/azsdk/formrecognizer/labelingtool
  [fr-studio]: https://aka.ms/azsdk/formrecognizer/formrecognizerstudio
  [fr-build-model]: https://aka.ms/azsdk/formrecognizer/buildmodel
  [fr-build-training-set]: https://aka.ms/azsdk/formrecognizer/buildtrainingset
  [fr-models]: https://aka.ms/azsdk/formrecognizer/models
  [fr-errors]: https://aka.ms/azsdk/formrecognizer/errors
  [fr_to_di_migration_guideline]: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/documentintelligence/azure-ai-documentintelligence/MIGRATION_GUIDE.md

  [azure_core_ref_docs]: https://aka.ms/azsdk/python/core/docs
  [azure_core_exceptions]: https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions
  [python_logging]: https://docs.python.org/3/library/logging.html
  [multi_and_single_service]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows
  [azure_cli_endpoint_lookup]: https://docs.microsoft.com/cli/azure/cognitiveservices/account?view=azure-cli-latest#az-cognitiveservices-account-show
  [azure_portal_get_endpoint]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource
  [cognitive_authentication_api_key]: https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account?tabs=multiservice%2Cwindows#get-the-keys-for-your-resource
  [register_aad_app]: https://docs.microsoft.com/azure/cognitive-services/authentication#assign-a-role-to-a-service-principal
  [custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
  [azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
  [default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
  [service_recognize_receipt]: https://aka.ms/azsdk/formrecognizer/receiptfieldschema
  [service_recognize_business_cards]: https://aka.ms/azsdk/formrecognizer/businesscardfieldschema
  [service_recognize_invoice]: https://aka.ms/azsdk/formrecognizer/invoicefieldschema
  [service_recognize_identity_documents]: https://aka.ms/azsdk/formrecognizer/iddocumentfieldschema
  [service_recognize_tax_documents]: https://aka.ms/azsdk/formrecognizer/taxusw2fieldschema
  [service_prebuilt_document]: https://docs.microsoft.com/azure/applied-ai-services/form-recognizer/concept-general-document#general-document-features
  [sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/sdk/azure-sdk-logging
  [sample_readme]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples
  [changelog]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/CHANGELOG.md
  [migration-guide]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/MIGRATION_GUIDE.md
  [classify_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2_and_later/sample_classify_document.py
  [service-rename]: https://techcommunity.microsoft.com/t5/azure-ai-services-blog/azure-form-recognizer-is-now-azure-ai-document-intelligence-with/ba-p/3875765
  [addon_barcodes_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2_and_later/sample_analyze_addon_barcodes.py
  [addon_fonts_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2_and_later/sample_analyze_addon_fonts.py
  [addon_formulas_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2_and_later/sample_analyze_addon_formulas.py
  [addon_highres_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2_and_later/sample_analyze_addon_highres.py
  [addon_languages_sample]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.2_and_later/sample_analyze_addon_languages.py

  [cla]: https://cla.microsoft.com
  [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
  [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
  [coc_contact]: mailto:opencode@microsoft.com







  - Added support for Python 3.12.
  - Python 3.7 is no longer supported. Please use Python version 3.8 or later.
  - Changed the default polling interval from 5s to 1s.




  - Fixed incorrect data type for returned formula objects.




  - Exposed `send_request()` method in each client to send custom requests using the client's existing pipeline. ([#32151](https://github.com/Azure/azure-sdk-for-python/issues/32151))



  This version of the client library defaults to the service API version `2023-07-31`.


   > Note: The following changes are only breaking from the previous beta. They are not breaking against previous stable versions.

  - Going forward this library will default to service API version `2023-07-31`.
  - Removed `query_fields` keyword argument from `begin_analyze_document()` and `begin_analyze_document_from_url()`.
  - Removed `kind` property from `DocumentPage`.
  - Removed `images` property from `DocumentPage`.
  - Removed `DocumentImage` model.
  - Removed `annotations` property from `DocumentPage`.
  - Removed `DocumentAnnotation` model.
  - Removed `common_name` property from `DocumentKeyValuePair`.
  - Changed `AnalysisFeature` enum member names and values. Supported enum members are: `OCR_HIGH_RESOLUTION`, `LANGUAGES`, `BARCODES`, `FORMULAS`, `KEY_VALUE_PAIRS`, `STYLE_FONT`.
  - Renamed `custom_neural_document_model_builds` property to `neural_document_model_quota` on `ResourceDetails` model.
  - Renamed `AzureBlobSource` model to `BlobSource`.
  - Renamed `AzureBlobFileListSource` model to `BlobFileListSource`.
  - Marked `neural_document_model_quota` as optional on `ResourceDetails`.


  - Corrected typing for the `polygon` property on `DocumentWord`, `DocumentSelectionMark`, `DocumentLine`.
  - Corrected typing for `words`, `lines`, and `selection_marks` properties on `DocumentPage`.
  - Renamed the samples directory to `v3.2_and_later/` for samples that support 3.2 and later.



  This version of the client library defaults to the service API version `2023-02-28-preview`.



  - Added `features` keyword argument on `begin_analyze_document()` and `begin_analyze_document_from_url()`.
  - Added `query_fields` keyword argument on `begin_analyze_document()` and `begin_analyze_document_from_url()`.
  - Added `AnalysisFeature` enum with optional document analysis feature to enable.
  - Added `file_list` keyword argument on `begin_build_document_model()`.
  - Added the following optional properties on `DocumentStyle` class: `similar_font_family`, `font_style`, `font_weight`, `color`, `background_color`.
  - Added support for custom document classification on `DocumentModelAdministrationClient`: `begin_build_document_classifier`,
    `list_document_classifiers`, `get_document_classifier`, and `delete_document_classifier`.
  - Added support for classifying documents on `DocumentAnalysisClient`: `begin_classify_document` and `begin_classify_document_from_url`.
  - Added `ClassifierDocumentTypeDetails` to use with `begin_build_document_classifier()`.
  - Added model `QuotaDetails` and property `custom_neural_document_model_builds` on `ResourceDetails`.
  - Added kind `documentClassifierBuild` to `OperationSummary` and `OperationDetails`.
  - Added property `expires_on` to `DocumentModelDetails` and `DocumentModelSummary`.
  - Added kind `formulaBlock` to `DocumentParagraph`.
  - Added property `common_name` to `DocumentKeyValuePair`.
  - Added property `code` to `CurrencyValue`.
  - Added properties `unit`, `city_district`, `state_district`, `suburb`, `house`, and `level` to `AddressValue`.
  - Added "boolean" `value_type` and `bool` `value` to `DocumentField`.
  - Added properties `annotations`, `images`, `formulas`, and `barcodes` to `DocumentPage`.
  - Added models `DocumentAnnotation`, `DocumentImage`, `DocumentFormula`, and `DocumentBarcode`.




  - Corrected typing for `invoice` argument in `begin_recognize_invoices()` on async `FormRecognizerClient`.
  - Fixed issue when calling `to_dict()` on `DocumentField` where `value` is not returned for address and currency fields.
  - Corrected typing for `form_type_confidence` property on `RecognizedForm`.
  - Corrected typing for `appearance` property on `FormLine`.


  - Improved static typing.




  - Content type `image/heif` is supported for document analysis and building models.
  - Added `custom_document_models` property on `ResourceDetails`.
  - Added new `CustomDocumentModelsDetails` model to represent the details of the custom document models in a given Form Recognizer resource.


  - This library will default to service API version `2022-08-31` going forward.
  - Removed `kind` property on `DocumentPage`.
  - Renamed `begin_build_model()` to `begin_build_document_model()` on the `DocumentModelAdministrationClient`.
  - Renamed `begin_compose_model()` to `begin_compose_document_model()` on the `DocumentModelAdministrationClient`.
  - Renamed `begin_copy_model_to()` to `begin_copy_document_model_to()` on the `DocumentModelAdministrationClient`.
  - Renamed `list_models()` to `list_document_models()` on the `DocumentModelAdministrationClient`.
  - Renamed `get_model()` to `get_document_model()` on the `DocumentModelAdministrationClient`.
  - Renamed `delete_model()` to `delete_document_model()` on the `DocumentModelAdministrationClient`.
  - Removed `document_model_count` and `document_model_limit` properties on `ResourceDetails`.
  - Renamed `DocumentModelOperationDetails` to `OperationDetails`.
  - Renamed `DocumentModelOperationSummary` to `OperationSummary`.
  - Removed `DocumentContentElement`.
  - Removed `kind` and `content` properties from `DocumentSelectionMark`.
  - Removed `kind` from `DocumentWord`.


  - Added `DocumentParagraph` to `__all__`.




  - Added `TargetAuthorization` of type `dict[str, str]`.


  - Renamed `source` argument to `blob_container_url` on `begin_build_model()` and made it a required keyword-only argument.
  - Changed argument order on `begin_build_model()`. `build_mode` is the first expected argument, followed by `blob_container_url`.
  - Renamed `begin_create_composed_model()` on `DocumentModelAdministrationClient` to `begin_compose_model()`.
  - Renamed `get_account_info()` on `DocumentModelAdministrationClient` to `get_resource_details()`.
  - Renamed `DocumentBuildMode` to `ModelBuildMode`.
  - Renamed `AccountInfo` model to `ResourceDetails`.
  - Renamed `DocTypeInfo` model to `DocumentTypeDetails`.
  - Renamed `DocumentModelInfo` model to `DocumentModelSummary`.
  - Renamed `DocumentModel` to `DocumentModelDetails`.
  - Renamed `ModelOperation` to `DocumentModelOperationDetails`.
  - Renamed `ModelOperationInfo` to `DocumentModelOperationSummary`.
  - Renamed `model` parameter to `model_id` on `begin_analyze_document()` and `begin_analyze_document_from_url()`.
  - Removed `continuation_token` keyword from `begin_analyze_document()` and `begin_analyze_document_from_url()` on `DocumentAnalysisClient` and from `begin_build_model()`, `begin_compose_model()` and `begin_copy_model_to()` on `DocumentModelAdministrationClient`.
  - Changed return type of `get_copy_authorization()` from `dict[str, str]` to `TargetAuthorization`.
  - Changed expected `target` parameter in `begin_copy_to()` from `dict[str, str]` to `TargetAuthorization`.
  - Long-running operation metadata is now accessible through the `details` property on the returned `DocumentModelAdministrationLROPoller` and `AsyncDocumentModelAdministrationLROPoller` instances.


  - Python 3.6 is no longer supported in this release. Please use Python 3.7 or later.




  - Added `paragraphs` property on `AnalyzeResult`.
  - Added new `DocumentParagraph` model to represent document paragraphs.
  - Added new `AddressValue` model to represent address fields found in documents.
  - Added `kind` property on `DocumentPage`.


  - Renamed `bounding_box` to `polygon` on `BoundingRegion`, `DocumentContentElement`, `DocumentLine`, `DocumentSelectionMark`, `DocumentWord`.
  - Renamed `language_code` to `locale` on `DocumentLanguage`.
  - Some models that previously returned string for address related fields may now return `AddressValue`. TIP: Use `get_model()` on `DocumentModelAdministrationClient` to see updated prebuilt model schemas.
  - Removed `entities` property on `AnalyzeResult`.
  - Removed `DocumentEntity` model.




  - Renamed `begin_copy_model()` to `begin_copy_model_to()`.
  - In `begin_create_composed_model()`, renamed required parameter `model_ids` to `component_model_ids`.
  - Renamed `model_count` and `model_limit` on `AccountInfo` to `document_model_count` and `document_model_limit`.


  - Fixed `to_dict()` and `from_dict()` methods on `DocumentField` to support converting lists, dictionaries, and CurrenyValue field types to and from a dictionary.


  - Renamed `sample_copy_model.py` and `sample_copy_model_async.py` to `sample_copy_model_to.py` and `sample_copy_model_to_async.py` under the `3.2-beta` samples folder. Updated the samples to use renamed copy model method.




  - Added new `CurrencyValue` model to represent the amount and currency symbol values found in documents.
  - Added `DocumentBuildMode` enum with values `template` and `neural`. These enum values can be passed in for the `build_mode` parameter in `begin_build_model()`.
  - Added `api_version` and `tags` properties on `ModelOperation`, `ModelOperationInfo`, `DocumentModel`, `DocumentModelInfo`.
  - Added `build_mode` property on `DocTypeInfo`.
  - Added a `tags` keyword argument to `begin_build_model()`, `begin_create_composed_model()`, and `get_copy_authorization()`.
  - Added `languages` property on `AnalyzeResult`.
  - Added model `DocumentLanguage` that includes information about the detected languages found in a document.
  - Added `sample_analyze_read.py` and `sample_analyze_read_async.py` under the `v3.2-beta` samples directory. These samples use the new `prebuilt-read` model added by the service.
  - Added `sample_analyze_tax_us_w2.py` and `sample_analyze_tax_us_w2_async.py` under the `v3.2-beta` samples directory. These samples use the new `prebuilt-tax.us.w2` model added by the service.


  - Added new required parameter `build_mode` to `begin_build_model()`.
  - Some models that previously returned float for currency related fields may now return a `CurrencyValue`. TIP: Use `get_model()` on `DocumentModelAdministrationClient` to see updated prebuilt model schemas.


  - Default the `percent_completed` property to 0 when not returned with model operation information.


  - Python 2.7 is no longer supported in this release. Please use Python 3.6 or later.
  - Bumped `azure-core` minimum dependency version from `1.13.0` to `1.20.1`.
  - Updated samples that call `begin_build_model()` to send the `build_mode` parameter.




  - Added `get_words()` on `DocumentLine`.
  - Added samples showing how to use `get_words()` on a `DocumentLine` under `/samples/v3.2-beta`: `sample_get_words_on_document_line.py` and `sample_get_words_on_document_line_async.py`.


  - Renamed `DocumentElement` to `DocumentContentElement`.



  This version of the SDK defaults to the latest supported API version, which is currently 2021-09-30-preview.

  > Note: Starting with version 2021-09-30-preview, a new set of clients were introduced to leverage the newest features of the Form Recognizer service. Please see the [Migration Guide](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/MIGRATION_GUIDE.md) for detailed instructions on how to update application code from client library version 3.1.X or lower to the latest version. Also, please refer to the [README](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/formrecognizer/azure-ai-formrecognizer/README.md) for more information about the library.


  - Added new `DocumentAnalysisClient` with  `begin_analyze_document` and `begin_analyze_document_from_url` methods. Use these methods with the latest Form Recognizer
  API version to analyze documents, with prebuilt and custom models.
  - Added new models to use with the new `DocumentAnalysisClient`: `AnalyzeResult`, `AnalyzedDocument`, `BoundingRegion`, `DocumentElement`, `DocumentEntity`, `DocumentField`, `DocumentKeyValuePair`, `DocumentKeyValueElement`, `DocumentLine`, `DocumentPage`, `DocumentSelectionMark`, `DocumentSpan`, `DocumentStyle`, `DocumentTable`, `DocumentTableCell`, `DocumentWord`.
  - Added new `DocumentModelAdministrationClient` with methods: `begin_build_model`, `begin_create_composed_model`, `begin_copy_model`, `get_copy_authorization`, `get_model`, `delete_model`, `list_models`, `get_operation`, `list_operations`, `get_account_info`, `get_document_analysis_client`.
  - Added new models to use with the new `DocumentModelAdministrationClient`: `DocumentModel`, `DocumentModelInfo`, `DocTypeInfo`, `ModelOperation`, `ModelOperationInfo`, `AccountInfo`, `DocumentAnalysisError`, `DocumentAnalysisInnerError`.
  - Added samples using the `DocumentAnalysisClient` and `DocumentModelAdministrationClient` under `/samples/v3.2-beta`.
  - Added `DocumentAnalysisApiVersion` to be used with `DocumentAnalysisClient` and `DocumentModelAdministrationClient`.


  - Python 3.5 is no longer supported in this release.




  - A `HttpResponseError` will be immediately raised when the call quota volume is exceeded in a `F0` tier Form Recognizer
  resource.


  - Bumped `azure-core` minimum dependency version from `1.8.2` to `1.13.0`



  **Bug Fixes**

  - Handles invoices that do not have sub-line item fields detected.



  This version of the SDK defaults to the latest supported API version, which currently is v2.1

  Note: this version will be the last to officially support Python 3.5, future versions will require Python 2.7 or Python 3.6+

  **Breaking Changes**

  - `begin_recognize_id_documents` renamed to `begin_recognize_identity_documents`.
  - `begin_recognize_id_documents_from_url` renamed to `begin_recognize_identity_documents_from_url`.
  - The model `TextAppearance` now includes the properties `style_name` and `style_confidence` that were part of the `TextStyle` object.
  - Removed the model `TextStyle`.
  - Removed field value types "gender" and "country" from the `FieldValueType` enum.
  - Added field value type "countryRegion" to the `FieldValueType` enum.
  - Renamed field name for identity documents from "Country" to "CountryRegion".

  **New features**

  - Added `to_dict` and `from_dict` methods to all of the models



  **New features**

  - New methods `begin_recognize_id_documents` and `begin_recognize_id_documents_from_url` introduced to the SDK. Use these methods to recognize data from identity documents.
  - New field value types "gender" and "country" described in the `FieldValueType` enum.
  - Content-type `image/bmp` now supported by custom forms and training methods.
  - Added keyword argument `pages` for business cards, receipts, custom forms, and invoices
  to specify which page to process of the document.
  - Added keyword argument `reading_order` to `begin_recognize_content` and `begin_recognize_content_from_url`.

  **Dependency Updates**

  - Bumped `msrest` requirement from `0.6.12` to `0.6.21`.



  **Breaking Changes**

  - `Appearance` is renamed to `TextAppearance`
  - `Style` is renamed to `TextStyle`
  - Client property `api_version` is no longer exposed. Pass keyword argument `api_version` into the client to select the
  API version

  **Dependency Updates**

  - Bumped `six` requirement from `1.6` to `1.11.0`.



  **Bug Fixes**

  - Package requires [azure-core](https://pypi.org/project/azure-core/) version 1.8.2 or greater




  This version of the SDK defaults to the latest supported API version, which currently is v2.1-preview.

  **New features**

  - New methods `begin_recognize_business_cards` and `begin_recognize_business_cards_from_url` introduced to the SDK. Use these
  methods to recognize data from business cards
  - New methods `begin_recognize_invoices` and `begin_recognize_invoices_from_url` introduced to the SDK. Use these
  methods to recognize data from invoices
  - Recognize receipt methods now take keyword argument `locale` to optionally indicate the locale of the receipt for
  improved results
  - Added ability to create a composed model from the `FormTrainingClient` by calling method `begin_create_composed_model()`
  - Added support to train and recognize custom forms with selection marks such as check boxes and radio buttons.
  This functionality is only available for models trained with labels
  - Added property `selection_marks` to `FormPage` which contains a list of `FormSelectionMark`
  - When passing `include_field_elements=True`, the property `field_elements` on `FieldData` and `FormTableCell` will
  also be populated with any selection marks found on the page
  - Added the properties `model_name` and `properties` to types `CustomFormModel` and `CustomFormModelInfo`
  - Added keyword argument `model_name` to `begin_training()` and `begin_create_composed_model()`
  - Added model type `CustomFormModelProperties` that includes information like if a model is a composed model
  - Added property `model_id` to `CustomFormSubmodel` and `TrainingDocumentInfo`
  - Added properties `model_id` and `form_type_confidence` to `RecognizedForm`
  - `appearance` property added to `FormLine` to indicate the style of extracted text - like "handwriting" or "other"
  - Added keyword argument `pages` to `begin_recognize_content` and `begin_recognize_content_from_url` to specify the page
  numbers to analyze
  - Added property `bounding_box` to `FormTable`
  - Content-type `image/bmp` now supported by recognize content and prebuilt models
  - Added keyword argument `language` to `begin_recognize_content` and `begin_recognize_content_from_url` to specify
  which language to process document in

  **Dependency updates**

  - Package now requires [azure-common](https://pypi.org/project/azure-common/) version 1.1



  First stable release of the azure-ai-formrecognizer client library.

  **New features**

  - Client-level, keyword argument `api_version` can be used to specify the service API version to use. Currently only v2.0
  is supported. See the enum `FormRecognizerApiVersion` for supported API versions.
  - `FormWord` and `FormLine` now have attribute `kind` which specifies the kind of element it is, e.g. "word" or "line"



  The version of this package now targets the service's v2.0 API.

  **Breaking Changes**

  - Client library version bumped to `3.0.0b1`
  - Values are now capitalized for enums `FormContentType`, `LengthUnit`, `TrainingStatus`, and `CustomFormModelStatus`
  - `document_name` renamed to `name` on `TrainingDocumentInfo`
  - Keyword argument `include_sub_folders` renamed to `include_subfolders` on `begin_training` methods

  **New features**

  - `FormField` now has attribute `value_type` which contains the semantic data type of the field value. The options for
  `value_type` are described in the enum `FieldValueType`

  **Fixes and improvements**

  - Fixes a bug where error code and message weren't being returned on `HttpResponseError` if operation failed during polling
  - `FormField` property `value_data` is now set to `None` if no values are returned on its `FieldData`.
  Previously `value_data` returned a `FieldData` with all its attributes set to `None` in the above case.




  **Breaking Changes**

  - `RecognizedReceipts` class has been removed.
  - `begin_recognize_receipts` and `begin_recognize_receipts_from_url` now return `RecognizedForm`.
  - `requested_on` has been renamed to `training_started_on` and `completed_on` renamed to `training_completed_on` on `
  CustomFormModel` and `CustomFormModelInfo`
  - `FieldText` has been renamed to `FieldData`
  - `FormContent` has been renamed to `FormElement`
  - Parameter `include_text_content` has been renamed to `include_field_elements` for
  `begin_recognize_receipts`, `begin_recognize_receipts_from_url`, `begin_recognize_custom_forms`, and `begin_recognize_custom_forms_from_url`
  - `text_content` has been renamed to `field_elements` on `FieldData` and `FormTableCell`

  **Fixes and improvements**

  - Fixes a bug where `text_angle` was being returned out of the specified interval (-180, 180]



  **Breaking Changes**

  - All asynchronous long running operation methods now return an instance of an `AsyncLROPoller` from `azure-core`
  - All asynchronous long running operation methods are renamed with the `begin_` prefix to indicate that an `AsyncLROPoller` is returned:
      - `train_model` is renamed to `begin_training`
      - `recognize_receipts` is renamed to `begin_recognize_receipts`
      - `recognize_receipts_from_url` is renamed to `begin_recognize_receipts_from_url`
      - `recognize_content` is renamed to `begin_recognize_content`
      - `recognize_content_from_url` is renamed to `begin_recognize_content_from_url`
      - `recognize_custom_forms` is renamed to `begin_recognize_custom_forms`
      - `recognize_custom_forms_from_url` is renamed to `begin_recognize_custom_forms_from_url`
  - Sync method `begin_train_model` renamed to `begin_training`
  - `training_files` parameter of `begin_training` is renamed to `training_files_url`
  - `use_labels` parameter of `begin_training` is renamed to `use_training_labels`
  - `list_model_infos` method has been renamed to `list_custom_models`
  - Removed `get_form_training_client` from `FormRecognizerClient`
  - Added `get_form_recognizer_client` to `FormTrainingClient`
  - A `HttpResponseError` is now raised if a model with `status=="invalid"` is returned from the `begin_training` methods
  - `PageRange` is renamed to `FormPageRange`
  - `first_page` and `last_page` renamed to `first_page_number` and `last_page_number`, respectively on `FormPageRange`
  - `FormField` does not have a page_number
  - `use_training_labels` is now a required positional param in the `begin_training` APIs
  - `stream` and `url` parameters found on methods for `FormRecognizerClient` have been renamed to `form` and `form_url`, respectively
  - For `begin_recognize_receipt` methods, parameters have been renamed to `receipt` and `receipt_url`
  - `created_on` and `last_modified` are renamed to `requested_on` and `completed_on` in the
  `CustomFormModel`  and `CustomFormModelInfo` models
  - `models` property of `CustomFormModel` is renamed to `submodels`
  - `CustomFormSubModel` is renamed to `CustomFormSubmodel`
  - `begin_recognize_receipts` APIs now return a list of `RecognizedReceipt` instead of `USReceipt`
  - Removed `USReceipt`. To see how to deal with the return value of `begin_recognize_receipts`, see the recognize receipt samples in the [samples directory](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples) for details.
  - Removed `USReceiptItem`. To see how to access the individual items on a receipt, see the recognize receipt samples in the [samples directory](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples) for details.
  - Removed `USReceiptType` and the `receipt_type` property from `RecognizedReceipt`. See the recognize receipt samples in the [samples directory](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/formrecognizer/azure-ai-formrecognizer/samples) for details.

  **New features**

  - Support to copy a custom model from one Form Recognizer resource to another
  - Authentication using `azure-identity` credentials now supported
    - see the [Azure Identity documentation](https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/identity/azure-identity/README.md) for more information
  - `page_number` attribute has been added to `FormTable`
  - All long running operation methods now accept the keyword argument `continuation_token` to restart the poller from a saved state

  **Dependency updates**

  - Adopted [azure-core](https://pypi.org/project/azure-core/) version 1.6.0 or greater



  **Fixes and improvements**

  - Bug fixed where `confidence` == `0.0` was erroneously getting set to `1.0`
  - `__repr__` has been added to all of the models




  Version (1.0.0b1) is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Form Recognizer.
  This library replaces the package found here: https://pypi.org/project/azure-cognitiveservices-formrecognizer/

  For more information about this, and preview releases of other Azure SDK libraries, please visit
  https://azure.github.io/azure-sdk/releases/latest/python.html.

  **Breaking changes: New API design**

  - New namespace/package name:
    - The namespace/package name for the Form Recognizer client library has changed from
      `azure.cognitiveservices.formrecognizer` to `azure.ai.formrecognizer`
  - Two client design:
      - FormRecognizerClient to analyze fields/values on custom forms, receipts, and form content/layout
      - FormTrainingClient to train custom models (with/without labels), and manage the custom models on your account
  - Different analyze methods based on input type: file stream or URL.
      - URL input should use the method with suffix `from_url`
      - Stream methods will automatically detect content-type of the input file
  - Asynchronous APIs added under `azure.ai.formrecognizer.aio` namespace
  - Authentication with API key supported using `AzureKeyCredential("<api_key>")` from `azure.core.credentials`
  - New underlying REST pipeline implementation based on the azure-core library
  - Client and pipeline configuration is now available via keyword arguments at both the client level, and per-operation.
      See README for a link to optional configuration arguments
  - New error hierarchy:
      - All service errors will now use the base type: `azure.core.exceptions.HttpResponseError`


