commit f001321f24035ffd63275542580e28efe57c23c3
Author: nolash <dev@holbrook.no>
Date: Sun, 31 Oct 2021 07:38:54 +0100
Initial commit
Diffstat:
7 files changed, 132 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,4 @@
+__pycache__
+*.pyc
+*egg.info
+build/
diff --git a/LICENSE b/LICENSE
@@ -0,0 +1,14 @@
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
+
diff --git a/WAIVER b/WAIVER
@@ -0,0 +1,17 @@
+# Copyright waiver for the python package "leveldir"
+
+I dedicate any and all copyright interest in this software to the
+public domain. I make this dedication for the benefit of the public at
+large and to the detriment of my heirs and successors. I intend this
+dedication to be an overt act of relinquishment in perpetuity of all
+present and future rights to this software under copyright law.
+
+To the best of my knowledge and belief, my contributions are either
+originally authored by me or are derived from prior works which I have
+verified are also in the public domain and are not subject to claims
+of copyright by other parties.
+
+To the best of my knowledge and belief, no individual, business,
+organization, government, or other entity has any copyright interest
+in my contributions, and I affirm that I will not make contributions
+that are otherwise encumbered.
diff --git a/WARRANTY b/WARRANTY
@@ -0,0 +1,5 @@
+This program is free software. It comes without any warranty, to
+ * the extent permitted by applicable law. You can redistribute it
+ * and/or modify it under the terms of the Do What The Fuck You Want
+ * To Public License, Version 2, as published by Sam Hocevar. See
+ * http://www.wtfpl.net/ for more details.
diff --git a/setup.cfg b/setup.cfg
@@ -0,0 +1,28 @@
+[metadata]
+name = urlybird
+version = 0.0.1a2
+description = Common url operations not covered by the standard library urllib
+author = Louis Holbrook
+author_email = dev@holbrook.no
+url = https://gitlab.com/chaintools/chainlib
+keywords =
+ url
+ internet
+classifiers =
+ Programming Language :: Python :: 3
+ Operating System :: OS Independent
+ Development Status :: 3 - Alpha
+ Topic :: Software Development :: Libraries
+ Environment :: Console
+ Intended Audience :: Developers
+ License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
+ Topic :: Internet
+# Topic :: Blockchain :: EVM
+license = WTFPL
+licence_files =
+ LICENSE
+
+[options]
+python_requires = >= 3.6
+packages =
+ urlybird
diff --git a/setup.py b/setup.py
@@ -0,0 +1,28 @@
+from setuptools import setup
+import configparser
+import os
+
+
+requirements = []
+f = open('requirements.txt', 'r')
+while True:
+ l = f.readline()
+ if l == '':
+ break
+ requirements.append(l.rstrip())
+f.close()
+
+test_requirements = []
+f = open('test_requirements.txt', 'r')
+while True:
+ l = f.readline()
+ if l == '':
+ break
+ test_requirements.append(l.rstrip())
+f.close()
+
+
+setup(
+ install_requires=requirements,
+ tests_require=test_requirements,
+ )
diff --git a/urlybird/merge.py b/urlybird/merge.py
@@ -0,0 +1,36 @@
+def urlhostmerge(hoststring, host, port):
+ if host == None and port == None:
+ return hoststring
+ r_host = None
+ r_port = None
+
+ if hoststring != None:
+ if isinstance(hoststring, bytes) or isinstance(hoststring, bytearray):
+ hoststring = hoststring.decode('utf-8')
+ try:
+ (r_host, r_port) = hoststring.split(':')
+ except ValueError:
+ r_host = hoststring
+ if host != None:
+ r_host = host
+ if port != None:
+ r_port = str(port)
+ if r_port == None:
+ return r_host
+ return r_host + ':' + r_port
+
+
+def urlmerge(default_url, *args):
+ r = ['', '', '', '', '']
+ if default_url != None:
+ for i, v in enumerate(default_url):
+ if v == None:
+ continue
+ r[i] = default_url[i]
+ for url in args:
+ for i, v in enumerate(url):
+ if v == None:
+ v = ''
+ if len(v) != 0:
+ r[i] = url[i]
+ return (r[0], r[1], r[2], r[3], r[4],)