semvec/pypi-packages huggingface dataset:
sentinel-value 1.0.0
Sentinel Values - unique objects akin to None, True, False
License: MIT
Requires Python: >=3.6.0,<4.0.0
Keywords: sentinel,pep661,singleton,missing,util,typing

sentinel-value
==============

|pypi badge| |build badge| |docs badge|


``sentinel-value`` is a Python package, that helps to create `Sentinel Values`_ -
special singleton objects, akin to ``None``, ``NotImplemented`` and  ``Ellipsis``.

It implements the ``sentinel()`` function (described by `PEP 661`_),
and for advanced cases it also provides the ``SentinelValue()`` class (not a part of `PEP 661`_).

.. _`Sentinel Values`: https://en.wikipedia.org/wiki/Sentinel_value
.. _`PEP 661`: https://www.python.org/dev/peps/pep-0661


Usage example:

.. code:: python

  from sentinel_value import sentinel

  MISSING = sentinel("MISSING")

  def get_something(default=MISSING):
      ...
      if default is not MISSING:
          return default
      ...


Or, the same thing, but using the ``SentinelValue`` class
(slightly more verbose, but allows to have nice type annotations):

.. code:: python

  from typing import Union
  from sentinel_value import SentinelValue

  class Missing(SentinelValue):
      pass

  MISSING = Missing(__name__, "MISSING")

  def get_something(default: Union[str, Missing] = MISSING):
      ...
      if default is not MISSING:
          return default
      ...


Links
-----

- Read the Docs: https://sentinel-value.readthedocs.io
- GitHub repository: https://github.com/vdmit11/sentinel-value
- Python package: https://pypi.org/project/sentinel-value/


.. |pypi badge| image:: https://img.shields.io/pypi/v/sentinel-value.svg
  :target: https://pypi.org/project/sentinel-value/
  :alt: Python package version

.. |build badge| image:: https://github.com/vdmit11/sentinel-value/actions/workflows/build.yml/badge.svg
  :target: https://github.com/vdmit11/sentinel-value/actions/workflows/build.yml
  :alt: Tests Status

.. |docs badge| image:: https://readthedocs.org/projects/sentinel-value/badge/?version=latest
  :target: https://sentinel-value.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation Status
bfmplot 0.0.11
Snippet collections for plots how I make them.
License: MIT

bfmplot
=======

A collection of snippets for plots to make my life easier. The name is a
nod to the great `Burkhard
Bunk <http://people.physik.hu-berlin.de/~bunk/bbplot/>`__.

Install
-------

Clone this repository

.. code:: bash

   git clone git@github.com:benmaier/bfmplot.git

Install as development version (such that you don't have to reinstall
after updating the repository)

.. code:: bash

   pip install -e ./bfmplot --no-binary :all:
   cd bfmplot; make

Alternatively, install normally

.. code:: bash

   pip install ./bfmplot
   cd bfmplot; make install

Examples
--------

First Example
~~~~~~~~~~~~~

.. code:: python

   from bfmplot import pl
   import bfmplot as bp
   import numpy as np

   def sin_test(n=8,text_position='start'):

       # new figure in the golden ratio
       pl.figure(figsize=bp.golden_ratio(5))

       x = np.linspace(0,5*np.pi,100)

       # plot several functions with different markers
       for i in range(n):
           pl.plot(x, 1-np.sin(x[::-1]/np.sqrt(i+1)), marker=bp.markers[i],mfc='w',label='$i=%d$'%i)

       # remove right and top axis
       bp.strip_axis(pl.gca())

       # order legend items to align to the right
       leg = pl.legend()
       bp.align_legend_right(leg)

       # draw an arrow
       bp.arrow(pl.gca(), r'$i$', (6, 0.8), (3, 1.8), text_position=text_position)

       pl.xlabel('this is the x-label')
       pl.ylabel('this is the y-label')

       pl.gcf().tight_layout()


   sin_test(n=4,text_position='start')

   pl.show()

.. image:: https://github.com/benmaier/bfmplot/raw/master/sandbox/one.png
   :alt: one

Colors
~~~~~~

.. code:: python

   for colors,name in zip([
                   bp.mpl_default_colors,
                   bp.new_colors,
                   bp.brewer_qualitative,
                   bp.cccs_colors,                
                   bp.get_cividis_colors(8),
                   bp.wong,
                  ],
                  [
                   'bfmplot.mpl_default_colors',
                   'bfmplot.new_colors',
                   'bfmplot.brewer_qualitative',
                   'bfmplot.cccs_colors',
                   'bfmplot.get_cividis_colors(8)',
                   'bfmplot.wong',
                  ],
                  ):

       bp.set_color_cycle(colors)
       sin_test(n=8,text_position='start')

|image1| |image2| |image3| |image4| |image5| |image6|

.. |image1| image:: https://github.com/benmaier/bfmplot/raw/master/sandbox/bfmplot.mpl_default_colors.png
.. |image2| image:: https://github.com/benmaier/bfmplot/raw/master/sandbox/bfmplot.new_colors.png
.. |image3| image:: https://github.com/benmaier/bfmplot/raw/master/sandbox/bfmplot.brewer_qualitative.png
.. |image4| image:: https://github.com/benmaier/bfmplot/raw/master/sandbox/bfmplot.cccs_colors.png
.. |image5| image:: https://github.com/benmaier/bfmplot/raw/master/sandbox/bfmplot.get_cividis_colors_8_.png
.. |image6| image:: https://github.com/benmaier/bfmplot/raw/master/sandbox/bfmplot.wong.png