Saravanan666/pypi-org huggingface dataset:
Package: simple-html
simple_htmlTemplate-less. Type-safe. Minified by default. Fast.simple_html allows you to create HTML in standard Python. Benefits include:typically faster than jinja2 -- up to 15x fastertypically renders fewer bytes than template-based renderingtypes let your editor and tools help you write correct code fasterlightweight and framework agnosticalways renders valid htmlInstallationpip install simple-htmlUsagefromsimple_htmlimportdiv,h1,render,pnode=div({},h1({"id":"hello"},"Hello World!"),p({},"hooray!"))render(node)# <div><h1 id="hello">Hello World!</h1><p>hooray!</p></div>There are several ways to render nodes:fromsimple_htmlimportbr,div,h1,img,render# raw noderender(br)# <br/># node with attributes onlyrender(img({"src":"/some/image/url.jpg","alt":"a great picture"}))# <img src="/some/image/url.jpg" alt="a great picture"/># node with childrenrender(div({},h1({},"something")))# <div><h1>something</h1></div>'Tag attributes withNoneas the value will only render the attribute name:fromsimple_htmlimportdiv,renderrender(div({"empty-str-attribute":"","key-only-attr":None}))# <div empty-str-attribute="" key-only-attr></div>You can render inline css styles withrender_styles:fromsimple_htmlimportdiv,render,render_stylesstyles=render_styles({"min-width":"25px"})render(div({"style":styles},"cool"))# <div style="min-width:25px;">cool</div># ints and floats are legal valuesstyles=render_styles({"padding":0,"flex-grow":0.6})render(div({"style":styles},"wow"))# <div style="padding:0;flex-grow:0.6;">wow</div>Lists and generators are both valid collections of nodes:fromtypingimportGeneratorfromsimple_htmlimportdiv,render,Node,brdefget_list_of_nodes()->list[Node]:return["neat",br]render(div({},get_list_of_nodes()))# <div>neat<br/></div>defnode_generator()->Generator[Node,None,None]:yield"neat"yieldbrrender(div({},node_generator()))# <div>neat<br/></div>For convenience, many tags are provided, but you can also create your own:fromsimple_htmlimportTag,rendercustom_elem=Tag("custom-elem")# works the same as any other tagnode=custom_elem({"id":"some-custom-elem-id"},"Wow")render(node)# <custom-elem id="some-custom-elem-id">Wow</custom-elem>Strings are escaped by default, but you can pass inSafeStrings to avoid escaping.fromsimple_htmlimportbr,p,SafeString,rendernode=p({},"Escaped & stuff",br,SafeString("Not escaped & stuff"))render(node)# <p>Escaped &amp; stuff<br/>Not escaped & stuff</p>Attributes are also escaped -- both names and values. You can useSafeStringto bypass, if needed.fromsimple_htmlimportdiv,render,SafeStringescaped_attrs_node=div({"<bad>":"</also bad>"})render(escaped_attrs_node)# <div &amp;lt;bad&amp;gt;="&amp;lt;/also bad&amp;gt;"></div>unescaped_attrs_node=div({SafeString("<bad>"):SafeString("</also bad>")})render(unescaped_attrs_node)# <div <bad>="</also bad>"></div>
Package: simple-html-table
simple_html_tableSimple way to create HTML tables with support for rowspan and colspan attributes.Usagesimple_html_table defines three classes that represent HTML tables, rows and cells respectively. To use the module,
create a Table instance and pass it a 2D numpy array of strings, or a callable that will take Cell objects and return
strings.:from simple_html_table import Table

contents = [
    ["Head 1", "Head 2", "Head 3", "Head 4"],
    ["(1,1)", "(1,2)", "(1,3)", "(1,4)"],
    ["(2,1)", "(2,2)", "(2,3)", "(2,4)"],
]

table = Table((3, 4), table_contents=np.array(contents))

table[1, 1].colspan = 2
table[0, 0].rowspan = 3
table[0, 1].attrs_dict.update({"style": "{ background: red; }"})
table[0].header = True
for cell in table[0]:
    cell.classes = "table_th"

result = table.render()
print(result,"\n")

def content_func(cell: Cell) -> str:
    """Callback function to fill in the table."""
    row, col = cell.location
    return contents[row][col]

table2 = Table((3, 4), table_contents=content_func)
result = table2.render()
print(result)Output<table class='html_table'>
	<tr class='html_tr'>
		<th class='table_th' rowspan=3>Head 1</th>
		<th class='table_th' style='{ background: red; }'>Head 2</th>
		<th class='table_th'>Head 3</th>
		<th class='table_th'>Head 4</th>
	</tr>
	<tr class='html_tr'>
		<td class='html_td' colspan=2>(1,2)</td>
		<td class='html_td'>(1,4)</td>
	</tr>
	<tr class='html_tr'>
		<td class='html_td'>(2,2)</td>
		<td class='html_td'>(2,3)</td>
		<td class='html_td'>(2,4)</td>
	</tr>
</table>

<table class='html_table'>
	<tr class='html_tr'>
		<td class='html_td'>Head 1</td>
		<td class='html_td'>Head 2</td>
		<td class='html_td'>Head 3</td>
		<td class='html_td'>Head 4</td>
	</tr>
	<tr class='html_tr'>
		<td class='html_td'>(1,1)</td>
		<td class='html_td'>(1,2)</td>
		<td class='html_td'>(1,3)</td>
		<td class='html_td'>(1,4)</td>
	</tr>
	<tr class='html_tr'>
		<td class='html_td'>(2,1)</td>
		<td class='html_td'>(2,2)</td>
		<td class='html_td'>(2,3)</td>
		<td class='html_td'>(2,4)</td>
	</tr>
</table>Table and Row objects implement mutable sequence interfaces, so can be indexed. A Table will except being indexed with
a single integer to return a Row or with a tuple of two integers to return a Cell. A Row can be indexed to return Cell
instances.Cells know which Row they belong to and Tows know which Table they belong to. This means copying Cells and Rows will
probably mess up unless you explicitly reset the pointers.Colpan and Rowpans are implemented simply by storing references to the same Cell objects within the Row objects - as a
result, it is always possible to index the Table, but the Cell returned may think it belongs to a different row and
column within the table.
Package: simplehttpd
simplehttpd============An extendable replacement for http.server and its SimpleHTTPRequestHandlersimplehttpd was written as a quick hack to extend SimpleHTTPRequestHandler in http.server to be more, well, extendable.My specific need was to be able to quickly run an http server from the command line that also sent a custom header to the clientthat forbade caching of the content served, in order to quickly iterate in my web development project, being sure that the contenttruly was the latest content. The opportunity arose to make it more generally extendable, as you'll see from usage below.Usage=====Once you install withpython setup.py installor put simplehttpd wherever you need it, it mirrors the usage of http.server almost exactly.The default port is 8000, but you can also set your own port.python -m simplehttpd 8080An alternative that allows more customization is:python -c "import simplehttpd; simplehttpd.run(port=8080)"But what if you want to send a custom header, like 'Cache-Control: no-cache' with every page load?Well, simplehttpd.handler has an object called custom_headers which (by default) is an OrderedDict. So let's do this:python -c "import simplehttpd; simplehttpd.handler.custom_headers['Cache-Control'] = 'no-cache'; simplehttpd.run()"And for the really deep extending, you have even more options.The custom header could be a callable that disallows caching files, but allows caching of directory lists.def no_file_caching(response, file=None):if file is not None:self.send_header("Cache-Control", 'no-cache')Which will be called at send time.If you're really crazy, you could even replace methods on the handler class like send_custom_headers, which dispatches each custom headerOr replace the custom_headers OrderedDict on the handler class with your own kind of dict. It's just python, so let's hack!
Package: simple-httpfs
simple-httpfsA simple FUSE-based http file system. Read http files as if they were on
the local filesystem.Usagesimple-http /my/mount/dir
curl /my/mount/dir/http/slashdot.org/country.js..URLs are referenced relative to the mount directory and suffixed with..in
the style ofDaniel Rozenbergs
httpfs.Unmountingumount /my/mount/dir
Package: simple-https
simple_httpssimple https server.Just like ‘python3 -m http.server’, but https.Free software: GNU General Public License v3Documentation:https://simple-https.readthedocs.io.Installpip install simple_httpsUsagesimple-httpssimple-https -c /tmp/server.pemFeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2019-09-25)First release on PyPI.
Package: simple-http-server-jinja
Jinja for Python Simple Http ServerWhat's this?This is a Jinja extension for pythone simple http server (https://github.com/keijack/python-simple-http-server)How to use?installpython3 -m pip install simple_http_server_jinjafromsimple_http_serverimportroute,serverfromsimple_http_server_jinjaimportJinjaView,render@route("/index")defindex(name:str="world"):returnJinjaView("index.html",{"name":name})@route("/page")defpage():return200,render("page.html",{"a":"b"})defmain():server.start(port=9090)if__name__=="__main__":main()For the above code, the templates should be placed in thetemplatesfolder in your project's root.|--templates
|----index.html
|----page.html
|--main.pyYou can set your own Jinja2 Environment viaset_envfunction:fromsimple_http_serverimportroute,serverfromsimple_http_server_jinjaimportJinjaView,set_envfromjinja2importEnvironment,FileSystemLoader@route("/index")defindex(name:str="world"):returnJinjaView("index.html",{"name":name})defmain():env=Environment(loader=FileSystemLoader("/you/own/template/folder"))set_env(env)server.start(port=9090)if__name__=="__main__":main()
Package: simple-http-server-redis-session
Redis Sesion Implementation for Python Simple Http ServerWhat's this?This is the redis session implementation for the projecthttps://github.com/keijack/python-simple-http-server, use this extention to save you session data to redis.How to use?importsimple_http_serverimportsimple_http_server.serverasserverimportosfromsimple_http_server_redis_session.http_session_redis_implimportRedisSessionFactorydefmain(*args):# host, port, db, username, password are all optional.simple_http_server.set_session_factory(RedisSessionFactory(host="10.0.2.16",port=6379,db=0,username="",password=""))server.scan("tests/ctrls",r'.*controllers.*')root=os.path.dirname(os.path.abspath(__file__))server.start(port=9090,resources={"/public/*":f"{root}/tests/static"})or you can re-use your redis client which might be used in other codes.importsimple_http_serverimportsimple_http_server.serverasserverimportosimportredisfromsimple_http_server_redis_session.http_session_redis_implimportRedisSessionFactorydefmain(*args):# This redis client can be used in other business codes.redis_client=redis.Redis(host="10.0.2.16",port=6379,db=0,username="",password="")simple_http_server.set_session_factory(RedisSessionFactory(redis_client=redis_client))root=os.path.dirname(os.path.abspath(__file__))server.start(port=9090,resources={"/public/*":f"{root}/tests/static"})Write Your Own ObjectSerializerModulepickleis used to do the serialization and deserialization, if the defalut serialization logic could not satisfy you, you can write your ownsimple_http_server_redis_session.http_session_redis_implimportObjectSerializerclassMyObjectSerializer(ObjectSerializer):defobject_to_bytes(self,obj:Any)->bytes:bys=...returnbysdefbytes_to_objects(self,value:bytes)->Any:obj=...returnobj# Set it when initializing a SessionFactory.simple_http_server.set_session_factory(RedisSessionFactory(host="10.0.2.16",port=6379,db=0,username="",password="",object_serializer=MyObjectSerializer()))
Package: simple-i18n
i18nLightweight simple translation JavaScript module 'i18n' in Python implementation.InstallPlease note that simple-i18n depends on module 'pystache' and 'watchdog'.They will be automatically installed before pip installing simple-i18n.pipinstallsimple-i18nSynopsisfromsimple-i18nimportI18noptions=...i18n=I18n(options)i18n.__('Hello%s','Marcus')# -> Hello MarcusUsageFor detailed usage, please refer tohttps://www.npmjs.com/package/i18n
Package: simpleicons
simpleiconsUse a wide-range of icons derived from thesimple-iconsrepo in python. Go totheir websitefor a full list of icons. The slug version must be used for theicon_name. The icons folder that accompanies the package has all the files. The package uses the latest verison ofSimple Icons. It doesnotdepend on the filesystem.InstallationInstall withpip install simpleicons. Keep in mind that this is a fairly large package due to all the icons.UsageGeneral UsageThe API can then be used as follows, where [ICON SLUG] is replaced by a slug:fromsimpleicons.allimporticons# Get a specific icon by its slug as:icons.get('[ICON SLUG]')# For example:icon=icons.get('simpleicons')print(icon.__dict__)"""{'title': 'Simple Icons','slug': 'simpleicons','hex': '111111','source': 'https://simpleicons.org/','svg': '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">...</svg>','path': 'M12 12v-1.5c-2.484 ...','guidelines': 'https://simpleicons.org/styleguide','license': {type: '...',url: 'https://example.com/'}}"""NOTE: Theguidelinesentry will beNoneif we do not yet have guidelines data for the icon.NOTE: Thelicenseentry will beNoneif we do not yet have license data for the icon.Alternatively you can import the needed icons individually, where [ICON SLUG] is replaced by a slug:# Import a specific icon by its slug as:fromsimpleicons.iconsimportsi_[ICON_SLUG]# For example:fromsimpleicons.iconsimportsi_simpleiconsLastly, theiconsobject is also enumerable. This is useful if you want to do a computation on every icon:fromsimpleicons.allimporticonsfor(key,iconinicons){# do stuff}XMLThe XML for each icon can be easily manipulated with either of two functions:Icon.get_xml(**attrs) -> ElementTreefromsimpleicons.iconsimportsi_simpleicons# blue logo, adds the fill attribute: <svg fill="blue"></svg>si_simpleicons.get_xml(fill="blue")Icon.get_xml_bytes(**attrs) -> bytesfromsimpleicons.iconsimportsi_simpleiconssi_simpleicons.get_xml_bytes(fill="blue")ImageIn order to use this, you must install the extras:pip install -e simpleicons[imaging]. Icons can be converted to PIL Images withicon_to_image(icon_xml: bytes, bg: int=0xffffff, scale: Tuple[int, int]=(1, 1)) -> Image:fromsimpleicons.iconsimportsi_simpleiconsfromsimpleicons.imageimporticon_to_imagexml_bytes=si_simpleicons.get_xml_bytes(fill="blue")# black background and 5x scaleimg=icon_to_image(xml_bytes,bg=0x000000,scale=(5,5))# manipulate PIL Imageimg.putalpha(32)img.save("simpleicons_blue.png")
Package: simple-image-compressor
Simple Image CompressorSimple utility to compress images on a given path, with recursion.It uses multiple processes to consume the source directories queue.Does not preserve image metadata.See thesettingsfile.UsageCommand:simple_image_compressor [-h] [-v {0,1,2,3}] [-s] [-t] [-n] path [path ...]Positional arguments:pathpaths separated with spaces (paths with spaces must be quoted)Optional arguments:-h, --helpshow the help message and exit-v {0,1,2,3}verbosity level: 0=log file, 1=print dirs, 2=print files, 3=print json-ssoft compression: doesn't resize, just compresses up to 80% quality-ttemp output: doesn't replace source images, instead saves compressed images to %temp%-nno exceptions: process directories even if they're in the exceptions listExamplepython3-msimple_image_compressor-v2"/home/username/images/folder1/"python-msimple_image_compressor-v2"C:\users\username\Images\folder1\"PS: First project in Python.
Package: simple-image-debayer
Thesimple-image-debayerlibrary allows you to debayer images
in a directory. It uses OpenCV for the debayering underneath the hood.Changelog0.0.4 (2020-06-04)added option–ignore_errorsto keep debayering images despite errorsadded option–deleteto delete input file when successfully debayeredoutputting total processing time now at the endsplit code into more fine-grained methods to make it easier to use the tool as Python library0.0.3 (2020-05-25)outputting now the time left for processing the remainder of the images as well0.0.2 (2020-05-25)–output_dirparameter gets used now0.0.1 (2020-05-25)initial release
Package: simple-image-framework
Simple Image FrameworkThis image framework is built for a simple usage of processing images with python.
It is based on thePillowlibrary, (PIL fork).I set it for my own usage, but I hope it will be useful for you too.Installation如果你想使用built distribution来安装本库，可以使用以下命令：pipinstalldist/simple_image_framework-0.0.1-py3-none-any.whl如果你想使用source distribition来安装本库，则用以下命令：pipinstalldist/simple_image_framework-0.0.1-tar.gz如果你想重新安装，可以使用--force-reinstall标志来强制重新安装。如果你想直接使用 git 库得到的源码进行安装，可以在库根目录上直接使用命令：pipinstall.Usage详见 tests 文件夹中的参考样例ContributingCutie Deng :Githubmail:Dengzr2020@mail.sustech.edu.cn
Package: simple-image-viewer
Simple Image ViewerThis python code provides a simple image viewer for the rgular image formats. This image viewer also supports non-standard floating point images which are widely used in computer vision including optical flow, disparity, and depth formats.File Format Supportpng, jpg, ...:       All regular images.flo:                   Middleburry optical flow.dpt:                   Middleburry depth.pfm:                 Freiburg floating point disparity.Python PackageYou can also download and install theSimple Image Vieweras a python package by:python -m pip install simple-image-viewerThen you can simply import it in a python code and use it as follows:fromsimple_image_viewerimport*SimpleImageViewer().mainloop()DonationIf this project helps you to get your job done, you can give me a cup of coffee :)Copyright © 2020Saeid Hosseinipoor. Released under theMIT License.
Package: simple-imaging
simple-imagingsimple-imagingis a Python library for simple imaging processing tasks, made as part of the assignment for the Digital Imaging Processing class taken in 2020.InstallationUse the package managerpipto install simple-imaging.pipinstallsimple-imagingUsageA simple example of the usage can be found below.fromsimple_imagingimportimageimg=image.read_file('sample.ppm')img.negative()Developer referenceWIPRunning testsThis project has unit tests, and PRs have to pass in all tests to be merged.WIPContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseMIT
Package: simple-imshow
What it does:Reads and displays an image from a url, local filename, PIL image object,numpy.ndimage object, or any object type scipy.misc.imread supports directly.
Also contains ansimreadfunction that will return the image as anumpy.ndarray.I’ve had to look up how to display an image in this context or that too many
times.  This is an attempt to remedy that.Setup$pipinstallsimple-imshowUsage>>fromsimshowimportsimshow>>simshow('test-cats.jpg')# display from local file>>simshow('http://mathandy.com/escher_sphere.png')# display from urlRequest for Community Support:I’d love for others to help me make this a more
robust, more convenient tool – so, as the FAA likes to say, “If you see something, say something.” Or at least feel free to.TODO:Add simple tool to take a list of images and display a random sample (or all) as a grid of thumbnails.Add support for plots.Some thoughts on guidelines for this project:simreadshould be fast.I’d like to keep required dependencies limited to common ones available through pip (e.g. no requirement for opencv)It’d be nice ifsimshowcould refresh quickly enough support video feeds.  In my experience matplotlib figures will not though (I do not know matplotlib well though).
Package: simpleinflux
simpleinfluxA simple Python frontend for InfluxDBInstallationpip install simpleinfluxsimpleinfluxonly requires time, datetime, socket, and requests, so this should work on most systems.Quickstartsimpleinfluxdoes not use a stateful connection object, only stateless functions which execute the underlying http requests and parse the results into a sane representation. The functionsimportsimpleinflux# host = 'localhost' and port = 8086 are assumed, read below to change:simpleinflux.ping()# -> True (or False)simpleinflux.create_database('testDB')simpleinflux.get_databases()# -> ['_internal', 'testDB']simpleinflux.write(db='testDB',measurement='test',timestamp=time.time(),{'temperature_C':21.2})# -> True (or False)simpleinflux.get_measurements(db='testDB')# -> ['test']simpleinflux.read_latest(db='testDB',measurement='test')# -> {'time': 1654500223, 'temperature_C':21.2}# Set default database and measurement on package level:simpleinflux.default_db='testDB'simpleinflux.default_measurement='test'simpleinflux.write(timestamp=time.time(),{'temperature_C':21.3})simpleinflux.read_latest()# -> {'time': 1654500223, 'temperature_C':21.2}Changing host and portsimpleinfluxassumeshost = 'localhost'andport = 8086, which can be changed with optional arguments in most functions, e.g.ping_ok=simpleinflux.ping(host='localhost',port=28086)data=simpleinflux.read_latest(measurement='test',host='localhost',port=28086)or on the package level, e.g.simpleinflux.default_host='db.mydomain.com'simpleinflux.default_port=28086data=simpleinflux.read_latest(measurement='test')TimestampsAll timestamps in InfluxDB are integers with explicit precision.simpleinfluxuses second-precision as standard for both writes and reads. Other precisions can be set with theprecisionparameter in thewrite-function and theoutput_time_unitparameter in the variousread_-functions.InfluxDB recommends using the broadest precision timestamp you and your data can get away withfor optimal compression.Function Referenceping(raise_on_error=True, host='localhost', port=8086)returnsping_ok [Bool]Checks the connection to the port, and to the InfluxDB-API and returns True when successful. Does not check the connection to only the host, because supporting ping on multiple platforms seems kind of messy.raise_on_error [Bool], default: TrueIf True, raises aConnectionErrorif either the port or the API can't be reachedhost [String], default: 'localhost'The hostname of the system to be pingedport [Int], default: 8086The port of the system to be pingedChangelogVersionDateChanges0.0.42022-04-28Bugfix: Put DESC into the query for read_latest() so that it actually returns the last entry0.0.32022-04-27Changed read_latest because it didn't work correctly with all influx versions (returns time=0)0.0.22022-04-26Added actual functionality
Package: simpleini
This is the simplest way to interact with a single ini file to store settings.Attention! It is delivered together with logging to a file. You need to try to understand.Use:fromsimpleiniimportSETTINGS,loggingparsed_data=SETTINGS(<names_settings>,<required_settings>)# names_settings - A string with the names of the settings stored in the file. If there is no file, it will be created and the program will be completed.# required_settings - comma-separated list of required variables. 'all' - to check all variables```python#### Example ini reader (simple mode):```python# Read from [DEFAULT] sectionparsed_data=SETTINGS('settings1, settings2, settings3','all')settings1=parsed_data.settings1settings2=parsed_data.settings2settings3=parsed_data.settings3```python#### Examle ini readred```pythonparsed_data=SETTINGS()settings1=parsed_data.section_name.settings1settings2=parsed_data.section_name.settings2settings3=parsed_data.section_name_2.settings1```python#### Example with required fields```pythonsettings=SETTINGS(required_fields='NEW_DEFAULT.path_default')```python#### Example set```pythonsettings.set('test.one',123)```python#### Example remove section```pythonsettings.remove('section_name')```python#### Example remove option```pythonsettings.remove('section_name.option_name')```python#### Example logging:```pythonlogging('message for log')# it will write a file to the project folder log.txt and it will add incoming information to it```python
Package: simpleiniparser
It may feel boring to rewrite a parser fore every project you start.Filling your ini file with pythonic values will make you save time.Does the boring stuff for you as long as you behave like a conscenting adult.>>>config="""... [SECTION]... intvalue=2... floatvalue=7.8... stringvalue=some_value... cr_list = item1...           item2... boolean=False... comma_list_s='abc','def'... comma_list_i=1,2,3... comma_list_f=1.0,2.5,3... """...>>>fromsimpleiniparser.simple_iniconfig_parserimportfrom_string>>>config=from_string(config)>>>config['SECTION']['floatvalue']7.8>>>config['SECTION']['cr_list']['item1','item2']"""