Saravanan666/pypi-org huggingface dataset:
Package: prettypo
Pretty Page Object GeneratorA simple tool to make your page objects pretty and save some time for standard methods implementation.classBasePage(PrettyPageObject):def__init__(self,driver):super(BasePage,self).__init__(driver)self.button('ok',By.ID,'ok')self.text_field('login',By.XPATH,'//login')self.label('welcome_message',locator='welcome_message')self.elements('custom_parameters',locator='locator')self.element('parent',locator='xxx')self.button('button_that_difficult_to_find',By.XPATH,'/a',parent_getter=self.parent_element)deftest_page(driver):page=BasePage(driver)page.login='SuperUser'page.ok()wait_for_element(page.welcome_message_element())assertpage.welcome_message=="Welcom SuperUser"UsageJust inherit your Base Page class from PrettyPageObject and that's all!FeaturesPrettypo generates several methods for the requested element depending on the type of the elementself.button('name', by, locator, parent_getter) will generate next methods:name() - to call click()name_element() - to get full access to WebElement objectself.text_field('name', by, locator, parent_getter)nameproperty to get element's.text()name=string - setter is reassigned to.send_keys(string)name_element() - to get full access to WebElement objectself.elements('name', by, locator, parent_getter)name_elements() - get list of WebElement objectsself.label('name', by, locator, parent_getter)nameproperty to get element's.text()name_element() - to get full access to WebElement object
Package: pretty-poly
pretty_poly - a package for displaying polyomino tilingsThis is a Python package for displaying polyomino tilings, expressed as lists of lists of (x, y) tuples, in various ways.Example use>>> from pretty_poly import make_ascii
>>> print(make_ascii([[(0, 0), (0, 1), (0, 2), (1, 1)], [(0, 3), (1, 3), (2, 3), (1, 2)], [(1, 0), (2, 0), (3, 0), (2, 1)], [(3, 1), (3, 2), (2, 2)]]))
+-+-+-+-+
| |     |
+ +-+ +-+
|   | | |
+ +-+-+ +
| | |   |
+-+ +-+-+
|     |
+-+-+-+Example outputYou can see some examples of images created using this package:These files were created by the code in examples/make.pyHow to cite this code:@misc{pretty_poly,
  author = {Jack Grahl},
  title = {pretty_poly - a package for displaying polyomino tilings},
  year = {2021},
  howpublished = {\url{https://github.com/jwg4/pretty_poly}},
  commit = {...}
}
Package: prettyprint
This module privides pretty printing for list/dict/tuple/set python object.Simple example of usage is followings>>> from prettyprint import pp
>>> target = ['want pretty printing', '望麗出力']
>>> print target
['want pretty printing', '\xe6\x9c\x9b\xe9\xba\x97\xe5\x87\xba\xe5\x8a\x9b']  # what a ugly print especially in japanese
>>> pp(target)   # now we can see pretty print with pp
[
    "want pretty printing",
    "望麗出力"
]
>>> target_dict = {'order': {'en':'pretty print', 'ja':'綺麗に出力せよ'}}
>>> print target_dict  # what a hell again
{'order': {'en': 'pretty print', 'ja': '\xe7\xb6\xba\xe9\xba\x97\xe3\x81\xab\xe5\x87\xba\xe5\x8a\x9b\xe3\x81\x9b\xe3\x82\x88'}}
>>> pp(target_dict)  # pp again
{
    "order": {
        "en": "print prettily",
        "ja": "綺麗に出力せよ"
    }
}
Package: pretty_print_dictionary
Python-PrettyPrintDictionary============================Prints Dictionary key-values in a human readable manner.<h2>What it is?</h2>Suppose you have the following dictionary:```dict_1 = {'a': 0, '1': {1: 'c', 2: 'd'}, '2': [1, 2, 3, 4, 5, 6]}```When you print this on the console you will have this:```>>> {'a': 0, '1': {1: 'c', 2: 'd'}, '2': [1, 2, 3, 4, 5, 6]}```What if you have a very larger dictionary of things that each key has an iterable object, i.e dictionary, list, ...? How does it look like?Suppose you have the following dictionary:```dict_1 = {'a': 0, '1': {1: {'abc': [1, 2, 3, 4, 5, 6], 'efg': [7, 8, 9, 10, 100]},2: {'1': {1: 'abc', 2: 'efg'}, '2': {3: 'abc'}}}, '2': [1, 2, 3, 4, 5, 6]}```if you print if normally it will be this:```{'a': 0, '1': {1: {'abc': [1, 2, 3, 4, 5, 6], 'efg': [7, 8, 9, 10, 100]}, 2: {'1': {1: 'abc', 2: 'efg'}, '2': {3: 'abc'}}}, '2': [1, 2, 3, 4, 5, 6]}```But if you use this lib it would be this(this is PyCharm Console):<img src="http://s3.postimg.org/575oxpv7n/git_pretty_print_dict01.jpg"  /><h2>Usage</h2>Simply import the <b>PrettyDict</b> from <b>pretty_dictionary</b> module from <b>pretty_print_dictionary</b> package```from pretty_print_dictionary.pretty_dictionary import PrettyDict```Create your own dictionary.```my_dictionary = {0:[1,2,3], 1:['a','b']}```Create a class of <b>PrettyDict</b> and set your dictionary as its argument.```pd = PrettyDict(my_dictionary)```Call the <b>ppd</b>(Pretty Print Dictionary) method to print the dictionary```pd.ppd()```<h4>Keywords</h4>there is 4 keywords for this module:<table ><tr><th>keyword</th><th>comments</th><th>value(s)</th></tr><tr><td>fill_char_width</td><td>specifies number of chars to be indented for each level.</td><td> int </td></tr><tr><td>fill_char</td><td>specifies the char to be indented for each level.</td><td> str</td></tr><tr><td>order</td><td>specifies the color style for output.</td><td>'full', 'even', 'random'</td></tr><tr><td>show_level</td><td>prints the level number next to the key element</td><td>'show', 'hide'</td></tr></table>
Package: prettyprompt
Pretty PromptSimple tools for better prompts.Installationpip install prettypromptUsageSniffing bad intentionsfromprettypromptimportsniffers# will this SQL statement write to my database?sniffers.is_sql_write_statement(user_supplied_sql)# is this a prompt injection attempt? ask ChatGPT# (needs an OpenAI API key)sniffers.is_prompt_injection(prompt,strategy="LLM")# uses spaCy to indicate the imperative-ness of a string# needs a trained pipeline e.g. `python -m spacy download en_core_web_sm`sniffers.is_imperative(prompt)Converting inputfromprettypromptimportconverters# convert scraped HTML into plain text, maintaining some structureconverters.html_to_text(scraped_html)# splits text into meaningful chunks, using GPT-3.5converters.chunker(long_text,max_words_per_chunk,min_words_per_chunk)Cleaning inputfromprettypromptimportcleaners# remove tags from HTMLcleaners.remove_tags(html)# normalise spacescleaners.normalise_spaces(text)# swap common 'smart' characters with ASCII equivalentscleaners.simplify_text(text)Testspip install pytest pytest-mockpytestTODOPrompt Injection
Package: pretty-py3
pretty-py3Python advanced pretty printer.  This pretty printer is intended to
replace the oldpprintpython module which does not allow developers
to provide their own pretty print callbacks.This module is based on ruby'sprettyprint.rblibrary byTanaka Akira.This was converted to python3 byMark Grandiand othersExample UsageTo directly print the representation of an object usepprint:from pretty import pprint
pprint(complex_object)To get a string of the output usepretty:from pretty import pretty
string = pretty(complex_object)ExtendingThe pretty library allows developers to add pretty printing rules for their
own objects.  This process is straightforward.  All you have to do is to
add a__pretty__method to your object and call the methods on the
pretty printer passed:class MyObject(object):

    def __pretty__(self, p, cycle):
        ...Here the example implementation of a__pretty__method for a list
subclass::class MyList(list):

    def __pretty__(self, p, cycle):
        if cycle:
            p.text('MyList(...)')
        else:
            with p.group(8, 'MyList([', '])'):
                for idx, item in enumerate(self):
                    if idx:
                        p.text(',')
                        p.breakable()
                    p.pretty(item)Thecycleparameter isTrueif pretty detected a cycle.  Youhaveto
react to that or the result is an infinite loop.p.text()just adds
non breaking text to the output,p.breakable()either adds a whitespace
or breaks here.  If you pass it an argument it's used instead of the
default space.p.prettyprettyprints another object using the pretty print
method.The first parameter to thegroupfunction specifies the extra indentation
of the next line. The second and the third parameter are the opening and
closing strings that will be printed before and after the group.
In this example the next item will either be not
breaked (if the items are short enough) or aligned with the right edge of
the opening bracked ofMyList.Changelog0.2.4Merged pull request #2 (https://github.com/mgrandi/pretty-py3/pull/2) from @alexshpilkin,
"Fix double indentation in PrettyPrinter.group()"Merged pull request #3 (https://github.com/mgrandi/pretty-py3/pull/3) from @alexshpilkin,
"Better support for set and OrderedDict types"0.2.3Merged pull request #1 (https://github.com/mgrandi/pretty-py3/pull/1) from @avoidscorn,
"Add missing comma in single-element tuple."0.2.2Finish porting it to python3Copyrightcopyright 2007by Armin Ronacher.copyright 2014by Mark Grandi - python 3 portlicenseBSD License.
Package: pretty-python
pretty_pythonStandard Python Shim for IPython pretty librarySeelib.pretty Docsfor full api.Only differnce to use this is to import as follows:from pretty_python import pretty, pprint

d = dict(Foo=[1,2,3], Bar={'a':1, 'b':2, 'c':3})

print(f"my dict: {pretty(d)}")

# -or-

pprint(d)If running within IPython / Jupyter Notebook, it will load the builtin pretty library, otherwise it will load this fork which removes IPython dependency
Package: prettyqr
Create QR codes merged with images.Installationpip install prettyqrYou will needPythonandpip.Example usageTake a background image:And a URL or some other text:foo.comCombine them:prettyqr --qr-opacity 150 --outfile img/dna-qr.png foo.com img/dna-orig.pngCommand-line optionsusage: prettyqr [-h] [--border BORDER] [--out-file OUT_FILE]
                [--qr-opacity QR_OPACITY] [--qr-red QR_RED]
                [--qr-green QR_GREEN] [--qr-blue QR_BLUE]
                DATA IMAGE-FILE

Make pretty QR codes.

positional arguments:
  DATA                  Data to encode (e.g., "http://example.com").
  IMAGE-FILE            Image file to composite (e.g., "lena.jpg").

optional arguments:
  -h, --help            show this help message and exit
  --border BORDER       Size of border (in multiples of QR module size).
                        Defaults to 4. Can be zero if the QR code is intended
                        for printing or use on a light background.
  --out-file OUT_FILE   Path to write composite image file to. Extension will
                        determine the output format. Defaults to
                        "prettyqr.png".
  --qr-opacity QR_OPACITY
                        Opacity of the QR code modules, between 0 (invisible)
                        and 255 (opaque). Default is 200.
  --qr-red QR_RED       Red element of the QR module color, between 0 and 255.
                        Default is 0.
  --qr-green QR_GREEN   Green element of the QR module color, between 0 and
                        255. Default is 0.
  --qr-blue QR_BLUE     Blue element of the QR module color, between 0 and
                        255. Default is 0.Limitationsprettyqris a fairly raw proof-of-concept, and currently has an
assortment of limitations:Only supports square images.Only supports square QR modules.Doesn’t support complex color changes in the source image.It will work best with sources where the focus of the image is not
central, and doesn’t handle black backgrounds very well.All of these issues are fairly tractable; patches are welcome.
Package: prettyrecord
prettyrecord allows you to define your data structures in declarative way,
similar to SQLAlchemy’s declarative_base or Django’s models. To achieve the goal,
prettyrecord uses Python’s descriptor and metaclass mechanisms.Usageto define new structure, subclass Record or derived class and fill with fields, eg.:from prettyrecord import Record


class DummyRecord(Record, some_trait=False):
    field1 = Field(required=True, default_value='')
    field2 = Field(default_value=0)
    field3 = ListField(constraint=lambda value: -5 < value < 5)


dr = DummyRecord(field1='foo', field3=[-2, 3, 1, 0, 4)
print(dr.field1)          # shows 'foo'
print(dr.__some_trait__)  # shows 'False'to define new field, subclass Field, RecordField, ListField or derived class, eg.:from prettyrecord import Field


class Integer(Field):
    def normalize(self, value):
        value = super(Integer, self).normalize(value)
        return int(value)to change creation process of your structures, subclass MetaRecord and define new base class for them, eg.:from prettyrecord.record import Record, MetaRecord


class MetaMyRecord(MetaRecord):
    def __new__(mcs, name, bases, attrs, **kwargs):
        # your code here - remember to call super().__new__

    def __init__(cls, name, bases, attrs, **kwargs):
        # your code here - remember to call super().__init__


class MyRecord(Record, metaclass=MetaMyRecord):
    pass
Package: prettyresults
prettyresults - Present data analysis results in Web or Docx formatPrettyresults is a Python package to display data analysis results in different formats.
In short: you run your data analysis using your preferred Python tools, generate
a set of results (figures, tables...) and tell prettyresults about them.
Prettyresults will generate a neat, friendly web page with your results.Suppose you are analyzing some social or medical data, using pandas and scipy.stats.
You've created several matplotlib figures with descriptive data, some frequency tables,
some inference analysis... Visualizing all this information at once in a notebook may
not be practical. Prettyresults will display these results you've already created in
a webpage, allowing you to visualize them without problems. It can also create
a web document for you, with a subset of the obtained results.Prettyresults is a Python library. It implements a result system to add and manipulate
results (such as figures or tables). Results are hierarchical, forming a tree.
Results can then be used to generate a web page or a Word document.Installation and requirementsFrom pypi:pip install prettyresultsRequired Python 3.4+. Tested with Python 3.6.7.Prettyresults employs Pandas and Matplotlib.
Package: pretty-simple-namespace
Pretty SimpleNamespaceTable of ContentsWhat is it?Why create it?Simple usageFeaturesLimitationsRelated projectsApiTestWhat is it?A stringifier and formatter for SimpleNamespace which attempts to make the
data as readable as possible.Why create it?I use SimpleNamespace often to hold state and needed a way to print it out for
debugging purposes.Simple usagefrompretty_simple_namespaceimportpprintfromtypesimportSimpleNamespaceasojoe=o(name={"first":"joe","last":"schmo"},age=30,favoriteFoods=["apples","steak"],)pprint(joe)# prints# {#   name: {#     first: 'joe'#     last: 'schmo'#   }#   age: 30#   favoriteFoods: [#     'apples'#     'steak'#   ]# }Featureshandles recursive structures by tracking and printing references nicelyrecurses into typeslist,dictandSimpleNamespacefor nowhas special-case printing for typesbool,str,callableandNonebooleans and None are printed lowercasestrings are wrapped in single quotescallable appends()e.g.myMethod().  Arguments aren't representedall other types are printed by wrapping it instre.g.str(userDefinedType)Limitationsmulti-line strings look uglydoesn't have a way to recurse into structures other than what's listed aboveRelated projectstedentApiformat(something, indent=2) => strformatssomethingto a string as seen inSimple usagepprint(something, indent=2) => Nonejust prints the formatedsomethingwrapWith(*, indent) =>Wrapped moduleuse this when you want to callformatorpprintwith a different default
indent value so you don't have to pass it manually all the time.e.g.frompretty_simple_namespaceimportwrapWithpprint=wrapWith(indent=4).pprintpprint(o(tabbed4spaces=True))# {#     tabbed4spaces: true# }Wrapped modulejust an instance of SimpleNamespace with two attributesformatandpprint.Test## you must have poetry installed#$poetryshell
$poetryinstall
$pythonrunTests.py
Package: prettysleeper
ðŸ•› prettysleeperA Small Gimmick that makes waiting just a bit more fun by introducing a Wizard and a countdown timer to show the current waiting time with a running clock, emoji's and memes.How to install:Download from pip:python -m pip install prettysleeperHow to use:# -*- coding: utf-8 -*-
from prettysleeper import psleep
psleep(10)This will ouput something like this:ðŸ§™   ðŸ•› sleeping for 10When it's done, the message is replaced with an alert:ðŸ§™   Done!Standard messages show a simple countdown and an alert message after, which can be customized using:psleep(1, alert="YEET!")... will first like this:ðŸ§™   ðŸ•› sleeping for 1... then:ðŸ§™   YEET!*All options:
psleep(time, alert="Done!", final=True, wiz="w"):
When final is set to False, there won't be a final True output after the alert.
Try loading as module ;)python -m prettysleeperFor console usage, see:psleep -h
Package: prettyson
prettysonA Python-based JSON file formatter, inspired byBlack.installationYou can installprettysonviapip:$ python3 -m pip install prettysonhow to useUsingprettysonis very simple; you just pass it the JSON files you want to format.$ prettyson my_json_file.json my_json_files/*.jsonBy default,prettysonwill reformat your files in-place if they are incorrectly
formatted. If you just want to check your files, but not reformat them (as you would
in a pre-commit or CI context for example), you can use thedry runoption:$ prettyson --dry-run my_json_file.jsonIf you also want it to sort the JSON keys, use thesortoption:$ prettyson --sort my_json_file.jsonBy default, the indentation that is used is four spaces; you could specify a different
amount of spaces via theindentoption, or use tabs instead via theuse tabsoption:$ prettyson --indent 2 my_json_file.json # 2-space indentation
$ prettyson --use-tabs my_json_file.json # tab indentationYou can get an exhaustive list of options by running:$ prettyson --help
Package: prettystring
prettystringUse prettystring to build colorful strings for more engaging output.Prettystrings are conveniently encoded with the proper ANSI color codes based
on the colors you specify for them.InstallationInstall usingpip:pip install prettystringUsageAs straight forward as you may think:>>> from prettystring import prettystring as pstr
>>> colorful = pstr('sweet!')
>>> colorful.__str__()
'\x1b[;39;49msweet!\x1b[0m'Prettystrings are initialized with default ANSI code values.sweet!should be
in default colors. Paint it withpaint():>>> colorful.paint(pstr.blue)
>>> colorful.__str__()
'\x1b[;34;49msweet!\x1b[0m'
>>> print colorful
sweet!The value ofcolorfulwill show up blue whenprintis called on it.You can also initialize prettystrings with a style:>>> stylish = pstr('the answer is 42', pstr.blink, pstr.green, pstr.bgblue)
>>> stylish.__str__()
'\x1b[5;32;44mthe answer is 42\x1b[0m'
>>> print stylish
the answer is 42You can even format:>>> pstr('Hello {}!').paint(pstr.red).format(pstr('world').paint(pstr.blue))
'\x1b[;31;49mHello \x1b[;34;49mworld\x1b[0m\x1b[;31;49m!\x1b[0m'Note that format returns a regular string. This is a known limitation, and is
being worked on.Prettystring EnumsUse these enum values with thepaint()method to apply color and formatting
to prettystrings.Note that you can only apply one style, one color, and one background color at
a time (no mixing colors [yet]).Styles (Formatting)prettystring.styledefault
prettystring.bold
prettystring.dim
prettystring.underline
prettystring.blink
prettystring.invert
prettystring.hiddenColorsprettystring.default
prettystring.black
prettystring.red
prettystring.green
prettystring.yellow
prettystring.blue
prettystring.magenta
prettystring.cyan
prettystring.light
prettystring.darkLight colorsprettystring.lred
prettystring.lgreen
prettystring.lyellow
prettystring.lblue
prettystring.lmagenta
prettystring.lcyan
prettystring.whiteBackground colorsprettystring.bgdefault
prettystring.bgblack
prettystring.bgred
prettystring.bggreen
prettystring.bgyellow
prettystring.bgblue
prettystring.bgmagenta
prettystring.bgcyan
prettystring.bglight
prettystring.bgdarkLight background colorsprettystring.bglred
prettystring.bglgreen
prettystring.bglyellow
prettystring.bglblue
prettystring.bglmagenta
prettystring.bglcyan
prettystring.bgwhiteCompatibilityPrettystring is sure to work in most Unix based environments. Official
compatibility tests/upgrades are soon to come.ContributionFeel free to make prettystring better by submitting a pull request. I will
review your submission as soon as possible.LicenseThis software is distributed under the MIT License. See LICENSE.md for details.
Package: pretty-table-printer
pretty-table-printerA collection of utilities for turning lists of dicts into nicely formatted plain text tables.Free software: MIT licenseDocumentation:https://pretty-table-printer.readthedocs.io.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2019-04-06)First release on PyPI.
Package: pretty-tables
Pretty TablesCreate pretty tables from headers and rows, perfect for console output.Pretty Tables will create uniformly dispersed columns based on the input given and can be scaled to your needs in length of the table or number of columns. The input is automatically validated and allows for custom formatting making generating Pretty Tables a breeze.Install# Install packagepip3installpretty-tables# Install locallyjustinstallUsagePretty Tables is simple to use. Create a table by callingpretty_tables.create(), pass a list of headers and a 2 dimensional list of rows (each row must match the length of the headers). Pass an optionalempty_cell_placeholderstring,colorslist, or atruthyindex to customize your Pretty Table.Pretty Tables will automatically validate the input and convert each item to a string before returning successfully; however, you can pass Pretty Tables any data type within the header or row lists. In the following example, we are usingintegers,booleans,None, andstrings:importpretty_tablesheaders=['ID','Name','Occupation','Employed']rows=[[1,'Justin','Software Engineer',True],[2,'Misty','Receptionist',False],[3,'John',None,False],]# Add optional custom colors to each columncolors=[pretty_tables.Colors.red,pretty_tables.Colors.green,pretty_tables.Colors.blue,pretty_tables.Colors.purple,]# Generate the pretty table outputtable=pretty_tables.create(headers=headers,rows=rows,empty_cell_placeholder='No data',# Optional: override the default `None` with a custom stringcolors=colors,# Optional: mutually exclusive with `truthy`# truthy=3,  # Optional: integer of the column you want to check for truthy values on, mutually exclusive with `colors`)print(table)ColorsYou can also color each column differently by using thecolorsargument and passing a list of colors from thepretty_tables.Colorsclass. The input list must match the length of the headers list.blackbluecyangreenpurpleredwhiteyellowboldreset (resets all text formatting)underlinenone (acts like reset, used instead of passingNoneas a color)Development# Get a comprehensive list of development toolsjust--listAttributionStack Overflow question on formatting tables for console