├── python3.7libs
└── hpaste
│ ├── hcollections
│ ├── __init__.py
│ └── QDoubleInputDialog.py
│ ├── __init__.py
│ ├── hpastewebplugins
│ ├── disabled
│ │ ├── pasteorgru.py
│ │ ├── fpaste.py
│ │ ├── ix.py
│ │ ├── termbin.py
│ │ ├── sprunge.py
│ │ ├── clbin.py
│ │ ├── github.py
│ │ ├── pastenet.py
│ │ ├── dumptext.py
│ │ ├── textsave.py
│ │ └── hastebin.py
│ ├── __init__.py
│ └── houhpaste.py
│ ├── logger.py
│ ├── webclipboardbase.py
│ ├── widcacher.py
│ ├── nethelper.py
│ ├── pluginbenchmarker.py
│ ├── QWebAuthDialog.py
│ ├── resources
│ └── accountsmanager.ui
│ ├── accountsmanager_ui.py
│ └── hpasteoptions.py
├── python3.9libs
└── hpaste
│ ├── hcollections
│ ├── __init__.py
│ └── QDoubleInputDialog.py
│ ├── __init__.py
│ ├── hpastewebplugins
│ ├── disabled
│ │ ├── pasteorgru.py
│ │ ├── fpaste.py
│ │ ├── ix.py
│ │ ├── termbin.py
│ │ ├── sprunge.py
│ │ ├── clbin.py
│ │ ├── github.py
│ │ ├── pastenet.py
│ │ ├── dumptext.py
│ │ ├── textsave.py
│ │ └── hastebin.py
│ ├── __init__.py
│ └── houhpaste.py
│ ├── logger.py
│ ├── webclipboardbase.py
│ ├── widcacher.py
│ ├── nethelper.py
│ ├── pluginbenchmarker.py
│ ├── QWebAuthDialog.py
│ ├── resources
│ └── accountsmanager.ui
│ └── accountsmanager_ui.py
├── python3.10libs
└── hpaste
│ ├── hcollections
│ ├── __init__.py
│ └── QDoubleInputDialog.py
│ ├── __init__.py
│ ├── hpastewebplugins
│ ├── disabled
│ │ ├── pasteorgru.py
│ │ ├── fpaste.py
│ │ ├── ix.py
│ │ ├── termbin.py
│ │ ├── sprunge.py
│ │ ├── clbin.py
│ │ ├── github.py
│ │ ├── pastenet.py
│ │ ├── dumptext.py
│ │ ├── textsave.py
│ │ └── hastebin.py
│ ├── __init__.py
│ └── houhpaste.py
│ ├── logger.py
│ ├── webclipboardbase.py
│ ├── widcacher.py
│ ├── nethelper.py
│ ├── pluginbenchmarker.py
│ ├── QWebAuthDialog.py
│ ├── resources
│ └── accountsmanager.ui
│ ├── accountsmanager_ui.py
│ └── hpasteoptions.py
├── python3.11libs
└── hpaste
│ ├── hcollections
│ ├── __init__.py
│ ├── QDropdownWidget
│ │ └── __init__.py
│ └── QDoubleInputDialog.py
│ ├── __init__.py
│ ├── hpastewebplugins
│ ├── disabled
│ │ ├── pasteorgru.py
│ │ ├── fpaste.py
│ │ ├── ix.py
│ │ ├── termbin.py
│ │ ├── sprunge.py
│ │ ├── clbin.py
│ │ ├── github.py
│ │ ├── pastenet.py
│ │ ├── dumptext.py
│ │ ├── textsave.py
│ │ └── hastebin.py
│ ├── __init__.py
│ └── houhpaste.py
│ ├── hpastecollectionwidget
│ └── __init__.py
│ ├── logger.py
│ ├── webclipboardbase.py
│ ├── widcacher.py
│ ├── nethelper.py
│ ├── pluginbenchmarker.py
│ ├── QWebAuthDialog.py
│ ├── resources
│ └── accountsmanager.ui
│ └── hpasteoptions.py
├── .gitignore
├── hpaste.json
├── .hpaste_githubcollection
├── Houdini.keymap.overrides
├── config
└── Icons
│ ├── hpaste-copy.svg
│ ├── hpaste-cloud-upload.svg
│ ├── hpaste-paste.svg
│ ├── hpaste-cloud-download.svg
│ ├── hpaste-inspect.svg
│ ├── hpaste-collections.svg
│ ├── hpaste-cloud-settings.svg
│ └── hpaste-options.svg
├── NetworkViewMenu.xml
├── Houdini.keymap2.overrides
└── examples
├── README.md
└── localserver.py
/python3.7libs/hpaste/hcollections/__init__.py:
--------------------------------------------------------------------------------
1 | #from . import QDoubleInputDialog
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hcollections/__init__.py:
--------------------------------------------------------------------------------
1 | #from . import QDoubleInputDialog
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hcollections/__init__.py:
--------------------------------------------------------------------------------
1 | #from . import QDoubleInputDialog
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hcollections/__init__.py:
--------------------------------------------------------------------------------
1 | #from . import QDoubleInputDialog
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/.idea
2 | **/backup
3 | **/*.pyc
4 | *token.tok
5 | venv
6 | venv3
7 |
--------------------------------------------------------------------------------
/hpaste.json:
--------------------------------------------------------------------------------
1 | {
2 | "load_package_once": true,
3 | "path": "$HOUDINI_PACKAGE_PATH/../hpaste-master"
4 | }
--------------------------------------------------------------------------------
/python3.10libs/hpaste/__init__.py:
--------------------------------------------------------------------------------
1 | try:
2 | from .hpaste import *
3 | except:
4 | print("couldnt init hpaste")
5 | from .hpasteweb import *
6 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/__init__.py:
--------------------------------------------------------------------------------
1 | try:
2 | from .hpaste import *
3 | except:
4 | print("couldnt init hpaste")
5 | from .hpasteweb import *
6 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/__init__.py:
--------------------------------------------------------------------------------
1 | try:
2 | from .hpaste import *
3 | except:
4 | print("couldnt init hpaste")
5 | from .hpasteweb import *
6 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/__init__.py:
--------------------------------------------------------------------------------
1 | try:
2 | from .hpaste import *
3 | except:
4 | print("couldnt init hpaste")
5 | from .hpasteweb import *
6 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/pasteorgru.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'http://paste.org.ru', "code=%s"%s)
2 | # simple and dirty, like WePaste, i like it
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/pasteorgru.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'http://paste.org.ru', "code=%s"%s)
2 | # simple and dirty, like WePaste, i like it
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/pasteorgru.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'http://paste.org.ru', "code=%s"%s)
2 | # simple and dirty, like WePaste, i like it
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/pasteorgru.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'http://paste.org.ru', "code=%s"%s)
2 | # simple and dirty, like WePaste, i like it
--------------------------------------------------------------------------------
/.hpaste_githubcollection:
--------------------------------------------------------------------------------
1 | {
2 | "ver": "1.3",
3 | "collections": [],
4 | "publiccollections": [
5 | {
6 | "token": "",
7 | "enabled": true,
8 | "user": "hpaste-demo-collection"
9 | }
10 | ]
11 | }
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastecollectionwidget/__init__.py:
--------------------------------------------------------------------------------
1 | _qt = 5
2 | try:
3 | import PySide6
4 | _qt = 6
5 | except ImportError:
6 | pass
7 |
8 | if _qt == 6:
9 | from .qt6 import *
10 | elif _qt == 5:
11 | from .qt5 import *
12 | else:
13 | raise NotImplementedError()
14 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hcollections/QDropdownWidget/__init__.py:
--------------------------------------------------------------------------------
1 | _qt = 5
2 | try:
3 | import PySide6
4 | _qt = 6
5 | except ImportError:
6 | pass
7 |
8 | if _qt == 6:
9 | from .qt6 import *
10 | elif _qt == 5:
11 | from .qt5 import *
12 | else:
13 | raise NotImplementedError()
14 |
--------------------------------------------------------------------------------
/Houdini.keymap.overrides:
--------------------------------------------------------------------------------
1 | h.pane.wsheet.tool:hpasteweb HPasteWeb "Shelf Tool: HPasteWeb" Alt+Ctrl+Shift+V
2 | h.pane.wsheet.tool:hpastecollection Collection "Shelf Tool: Collection" Shift+Tab
3 | h.pane.wsheet.tool:hcopyweb HCopyWeb "Shelf Tool: HCopyWeb" Alt+Ctrl+Shift+C
4 | h.tool:hpasteinspect Inspect "Shelf Tool: Inspect" Alt+Ctrl+Shift+I
5 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/fpaste.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'https://paste.fedoraproject.org/api/paste/submit', json.dumps({'contents':'qweqweqwe test123', 'expiry_time':'%d'%(time.time()+6000), 'title':'test1'}), headers={'Content-Type':'application/json'})
2 | # urllib2.urlopen(json.loads(rep.read())['url']+'/raw').read()
3 | # cool
4 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/fpaste.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'https://paste.fedoraproject.org/api/paste/submit', json.dumps({'contents':'qweqweqwe test123', 'expiry_time':'%d'%(time.time()+6000), 'title':'test1'}), headers={'Content-Type':'application/json'})
2 | # urllib2.urlopen(json.loads(rep.read())['url']+'/raw').read()
3 | # cool
4 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/fpaste.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'https://paste.fedoraproject.org/api/paste/submit', json.dumps({'contents':'qweqweqwe test123', 'expiry_time':'%d'%(time.time()+6000), 'title':'test1'}), headers={'Content-Type':'application/json'})
2 | # urllib2.urlopen(json.loads(rep.read())['url']+'/raw').read()
3 | # cool
4 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/fpaste.py:
--------------------------------------------------------------------------------
1 | #TBD req = urllib2.Request(r'https://paste.fedoraproject.org/api/paste/submit', json.dumps({'contents':'qweqweqwe test123', 'expiry_time':'%d'%(time.time()+6000), 'title':'test1'}), headers={'Content-Type':'application/json'})
2 | # urllib2.urlopen(json.loads(rep.read())['url']+'/raw').read()
3 | # cool
4 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-copy.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/logger.py:
--------------------------------------------------------------------------------
1 | levelhreshold = 2
2 |
3 |
4 | def simpleLogger(s, level=1):
5 | if level < levelhreshold:
6 | return
7 | levels = ['VERBOSE', 'INFO', 'WARNING', 'ERROR', 'SUPER ERROR', 'OMEGA ERROR']
8 | if level < 0:
9 | level = 0
10 | elif level >= len(levels):
11 | level = len(levels) - 1
12 | print('%s: %s' % (levels[level], s))
13 |
14 |
15 | def passLogger(s, level=1):
16 | pass
17 |
18 |
19 | defaultLogger = simpleLogger
20 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/logger.py:
--------------------------------------------------------------------------------
1 | levelhreshold = 2
2 |
3 |
4 | def simpleLogger(s, level=1):
5 | if level < levelhreshold:
6 | return
7 | levels = ['VERBOSE', 'INFO', 'WARNING', 'ERROR', 'SUPER ERROR', 'OMEGA ERROR']
8 | if level < 0:
9 | level = 0
10 | elif level >= len(levels):
11 | level = len(levels) - 1
12 | print('%s: %s' % (levels[level], s))
13 |
14 |
15 | def passLogger(s, level=1):
16 | pass
17 |
18 |
19 | defaultLogger = simpleLogger
20 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/logger.py:
--------------------------------------------------------------------------------
1 | levelhreshold = 2
2 |
3 |
4 | def simpleLogger(s, level=1):
5 | if level < levelhreshold:
6 | return
7 | levels = ['VERBOSE', 'INFO', 'WARNING', 'ERROR', 'SUPER ERROR', 'OMEGA ERROR']
8 | if level < 0:
9 | level = 0
10 | elif level >= len(levels):
11 | level = len(levels) - 1
12 | print('%s: %s' % (levels[level], s))
13 |
14 |
15 | def passLogger(s, level=1):
16 | pass
17 |
18 |
19 | defaultLogger = simpleLogger
20 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/logger.py:
--------------------------------------------------------------------------------
1 | levelhreshold = 2
2 |
3 |
4 | def simpleLogger(s, level=1):
5 | if level < levelhreshold:
6 | return
7 | levels = ['VERBOSE', 'INFO', 'WARNING', 'ERROR', 'SUPER ERROR', 'OMEGA ERROR']
8 | if level < 0:
9 | level = 0
10 | elif level >= len(levels):
11 | level = len(levels) - 1
12 | print('%s: %s' % (levels[level], s))
13 |
14 |
15 | def passLogger(s, level=1):
16 | pass
17 |
18 |
19 | defaultLogger = simpleLogger
20 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-cloud-upload.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-paste.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/NetworkViewMenu.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-cloud-download.svg:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-inspect.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
--------------------------------------------------------------------------------
/Houdini.keymap2.overrides:
--------------------------------------------------------------------------------
1 | {
2 | "name":"Houdini",
3 | "version":2,
4 | "houdini.version":"20.5.278",
5 | "symbol":"",
6 | "contexts":[
7 | {
8 | "symbol":"h.pane.wsheet",
9 | "bindings":[
10 | {
11 | "action":"h.pane.wsheet.tool:hcopyweb",
12 | "keys":["Alt+Ctrl+Shift+C"
13 | ]
14 | }
15 | ]
16 | },
17 | {
18 | "symbol":"h.pane.wsheet",
19 | "bindings":[
20 | {
21 | "action":"h.pane.wsheet.tool:hpasteweb",
22 | "keys":["Alt+Ctrl+Shift+V"
23 | ]
24 | }
25 | ]
26 | },
27 | {
28 | "symbol":"h.pane.wsheet",
29 | "bindings":[
30 | {
31 | "action":"h.pane.wsheet.tool:hpastecollection",
32 | "keys":["Shift+Tab"
33 | ]
34 | }
35 | ]
36 | },
37 | {
38 | "symbol":"h",
39 | "bindings":[
40 | {
41 | "action":"h.tool:hpasteinspect",
42 | "keys":["Alt+Ctrl+Shift+I"
43 | ]
44 | }
45 | ]
46 | }
47 | ]
48 | }
49 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/webclipboardbase.py:
--------------------------------------------------------------------------------
1 | # TODO: move this class to hpastewebplugins
2 |
3 | class WebClipBoardError(RuntimeError):
4 | pass
5 |
6 |
7 | class WebClipBoardWidNotFound(WebClipBoardError):
8 | def __init__(self, wid):
9 | self.wid = wid
10 |
11 |
12 | class WebClipBoardBase(object):
13 |
14 | @classmethod
15 | def speedClass(self):
16 | """
17 | :return: int: speed class of the web plugin (0-9)
18 | """
19 | raise NotImplementedError()
20 |
21 | @classmethod
22 | def maxStringLength(self):
23 | """
24 | Keep in mind - this is about ascii string, so it should be equal to max data size in bytes
25 | :return: max string length
26 | """
27 | raise NotImplementedError()
28 |
29 | def webPackData(self, s: str) -> str:
30 | raise NotImplementedError()
31 |
32 | def webUnpackData(self, s: str) -> str:
33 | raise NotImplementedError()
34 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/webclipboardbase.py:
--------------------------------------------------------------------------------
1 | # TODO: move this class to hpastewebplugins
2 |
3 | class WebClipBoardError(RuntimeError):
4 | pass
5 |
6 |
7 | class WebClipBoardWidNotFound(WebClipBoardError):
8 | def __init__(self, wid):
9 | self.wid = wid
10 |
11 |
12 | class WebClipBoardBase(object):
13 |
14 | @classmethod
15 | def speedClass(self):
16 | """
17 | :return: int: speed class of the web plugin (0-9)
18 | """
19 | raise NotImplementedError()
20 |
21 | @classmethod
22 | def maxStringLength(self):
23 | """
24 | Keep in mind - this is about ascii string, so it should be equal to max data size in bytes
25 | :return: max string length
26 | """
27 | raise NotImplementedError()
28 |
29 | def webPackData(self, s: str) -> str:
30 | raise NotImplementedError()
31 |
32 | def webUnpackData(self, s: str) -> str:
33 | raise NotImplementedError()
34 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/webclipboardbase.py:
--------------------------------------------------------------------------------
1 | # TODO: move this class to hpastewebplugins
2 |
3 | class WebClipBoardError(RuntimeError):
4 | pass
5 |
6 |
7 | class WebClipBoardWidNotFound(WebClipBoardError):
8 | def __init__(self, wid):
9 | self.wid = wid
10 |
11 |
12 | class WebClipBoardBase(object):
13 |
14 | @classmethod
15 | def speedClass(self):
16 | """
17 | :return: int: speed class of the web plugin (0-9)
18 | """
19 | raise NotImplementedError()
20 |
21 | @classmethod
22 | def maxStringLength(self):
23 | """
24 | Keep in mind - this is about ascii string, so it should be equal to max data size in bytes
25 | :return: max string length
26 | """
27 | raise NotImplementedError()
28 |
29 | def webPackData(self, s: str) -> str:
30 | raise NotImplementedError()
31 |
32 | def webUnpackData(self, s: str) -> str:
33 | raise NotImplementedError()
34 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/webclipboardbase.py:
--------------------------------------------------------------------------------
1 | # TODO: move this class to hpastewebplugins
2 |
3 | class WebClipBoardError(RuntimeError):
4 | pass
5 |
6 |
7 | class WebClipBoardWidNotFound(WebClipBoardError):
8 | def __init__(self, wid):
9 | self.wid = wid
10 |
11 |
12 | class WebClipBoardBase(object):
13 |
14 | @classmethod
15 | def speedClass(self):
16 | """
17 | :return: int: speed class of the web plugin (0-9)
18 | """
19 | raise NotImplementedError()
20 |
21 | @classmethod
22 | def maxStringLength(self):
23 | """
24 | Keep in mind - this is about ascii string, so it should be equal to max data size in bytes
25 | :return: max string length
26 | """
27 | raise NotImplementedError()
28 |
29 | def webPackData(self, s: str) -> str:
30 | raise NotImplementedError()
31 |
32 | def webUnpackData(self, s: str) -> str:
33 | raise NotImplementedError()
34 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/__init__.py:
--------------------------------------------------------------------------------
1 | # this will have a list of available plugins
2 | import os
3 | import importlib
4 | import inspect
5 | from ..webclipboardbase import WebClipBoardBase
6 |
7 | pluginClassList = []
8 | pluginModuleList = []
9 |
10 |
11 | def rescanPlugins():
12 | global pluginClassList
13 | global pluginModuleList
14 | global __all__
15 | pluginClassList = []
16 | pluginModuleList = []
17 | files = [os.path.splitext(x)[0] for x in os.listdir(os.path.dirname(__file__)) if os.path.splitext(x)[1] == ".py" and x != "__init__.py"]
18 | __all__ = files
19 | for fn in files:
20 | try:
21 | newmodule = importlib.import_module(".".join((__name__, fn)))
22 | importlib.reload(newmodule)
23 | except Exception as e:
24 | print("hpaste web plugins: failed to load module {} because of: {}".format(fn, str(e)))
25 | continue
26 | pluginModuleList.append(newmodule)
27 | for name, obj in inspect.getmembers(newmodule):
28 | if inspect.isclass(obj) and WebClipBoardBase in inspect.getmro(obj)[1:]:
29 | pluginClassList.append(obj)
30 |
31 |
32 | rescanPlugins()
33 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/__init__.py:
--------------------------------------------------------------------------------
1 | # this will have a list of available plugins
2 | import os
3 | import importlib
4 | import inspect
5 | from ..webclipboardbase import WebClipBoardBase
6 |
7 | pluginClassList = []
8 | pluginModuleList = []
9 |
10 |
11 | def rescanPlugins():
12 | global pluginClassList
13 | global pluginModuleList
14 | global __all__
15 | pluginClassList = []
16 | pluginModuleList = []
17 | files = [os.path.splitext(x)[0] for x in os.listdir(os.path.dirname(__file__)) if os.path.splitext(x)[1] == ".py" and x != "__init__.py"]
18 | __all__ = files
19 | for fn in files:
20 | try:
21 | newmodule = importlib.import_module(".".join((__name__, fn)))
22 | importlib.reload(newmodule)
23 | except Exception as e:
24 | print("hpaste web plugins: failed to load module {} because of: {}".format(fn, str(e)))
25 | continue
26 | pluginModuleList.append(newmodule)
27 | for name, obj in inspect.getmembers(newmodule):
28 | if inspect.isclass(obj) and WebClipBoardBase in inspect.getmro(obj)[1:]:
29 | pluginClassList.append(obj)
30 |
31 |
32 | rescanPlugins()
33 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/__init__.py:
--------------------------------------------------------------------------------
1 | # this will have a list of available plugins
2 | import os
3 | import importlib
4 | import inspect
5 | from ..webclipboardbase import WebClipBoardBase
6 |
7 | pluginClassList = []
8 | pluginModuleList = []
9 |
10 |
11 | def rescanPlugins():
12 | global pluginClassList
13 | global pluginModuleList
14 | global __all__
15 | pluginClassList = []
16 | pluginModuleList = []
17 | files = [os.path.splitext(x)[0] for x in os.listdir(os.path.dirname(__file__)) if os.path.splitext(x)[1] == ".py" and x != "__init__.py"]
18 | __all__ = files
19 | for fn in files:
20 | try:
21 | newmodule = importlib.import_module(".".join((__name__, fn)))
22 | importlib.reload(newmodule)
23 | except Exception as e:
24 | print("hpaste web plugins: failed to load module {} because of: {}".format(fn, str(e)))
25 | continue
26 | pluginModuleList.append(newmodule)
27 | for name, obj in inspect.getmembers(newmodule):
28 | if inspect.isclass(obj) and WebClipBoardBase in inspect.getmro(obj)[1:]:
29 | pluginClassList.append(obj)
30 |
31 |
32 | rescanPlugins()
33 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/__init__.py:
--------------------------------------------------------------------------------
1 | # this will have a list of available plugins
2 | import os
3 | import importlib
4 | import inspect
5 | from ..webclipboardbase import WebClipBoardBase
6 |
7 | pluginClassList = []
8 | pluginModuleList = []
9 |
10 |
11 | def rescanPlugins():
12 | global pluginClassList
13 | global pluginModuleList
14 | global __all__
15 | pluginClassList = []
16 | pluginModuleList = []
17 | files = [os.path.splitext(x)[0] for x in os.listdir(os.path.dirname(__file__)) if os.path.splitext(x)[1] == ".py" and x != "__init__.py"]
18 | __all__ = files
19 | for fn in files:
20 | try:
21 | newmodule = importlib.import_module(".".join((__name__, fn)))
22 | importlib.reload(newmodule)
23 | except Exception as e:
24 | print("hpaste web plugins: failed to load module {} because of: {}".format(fn, str(e)))
25 | continue
26 | pluginModuleList.append(newmodule)
27 | for name, obj in inspect.getmembers(newmodule):
28 | if inspect.isclass(obj) and WebClipBoardBase in inspect.getmro(obj)[1:]:
29 | pluginClassList.append(obj)
30 |
31 |
32 | rescanPlugins()
33 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | This directory contains a couple of plugin examples for hpaste.
2 |
3 | The main idea of hpaste is to create ascii and url-safe representation of the snippet with assets and other metadata. You can see the result of that with **HCopy**
4 | shelf button (not HCopyWeb that is by default bound to shortcut ctrl+alt+shift+C)
5 |
6 | That huge piece of text then is fed to one of hpaste's **web plugins**, that take that huge text, store it somewhere and return you a small id (or wid, or handle, whatever you call it)
7 | The order of plugin being tried is defined in **HPaste Options** dialog
8 | The plugins themselves are read from **hpastewebplugins** directory
9 |
10 | You can write your own web plugins very easily, it just requires you to reimplement a couple of methods, nothing more
11 |
12 | #### Local network usage
13 | You can easily adapt hpaste to share snippets inside your company's local network, without any internet access.
14 | There are two examples provided:
15 | - storing snippets in shared network directory
16 | - storing snippets in a shared network sqlite database (this can easily be adapted to locally running mysql or postgres servers)
17 |
18 | check the files and read comments to guide you through this little plugins' structures
19 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/widcacher.py:
--------------------------------------------------------------------------------
1 | class WidCacher(object):
2 | _instance = None
3 |
4 | def __init__(self, maxsize=8):
5 | self.__maxsize = max(maxsize, 1)
6 | self.__cachedict = {}
7 | self.__cachequeue = []
8 |
9 | def __contains__(self, item):
10 | return item in self.__cachedict
11 |
12 | def __getitem__(self, item):
13 | return self.__cachedict[item]
14 |
15 | def __setitem__(self, key, value):
16 | if key in self.__cachequeue:
17 | self.__cachequeue.remove(key)
18 | if len(self.__cachequeue) >= self.__maxsize:
19 | for el in self.__cachequeue[self.__maxsize - 1:]:
20 | del self.__cachedict[el]
21 | self.__cachequeue = self.__cachequeue[:self.__maxsize - 1]
22 | self.__cachequeue.insert(0, key)
23 | self.__cachedict[key] = value
24 |
25 | def __len__(self):
26 | return len(self.__cachequeue)
27 |
28 | def maxSize(self):
29 | return self.__maxsize
30 |
31 | def clear(self):
32 | self.__cachedict = {}
33 | self.__cachequeue = []
34 |
35 | @classmethod
36 | def globalInstance(cls):
37 | if cls._instance is None:
38 | cls._instance = WidCacher()
39 | return cls._instance
40 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/widcacher.py:
--------------------------------------------------------------------------------
1 | class WidCacher(object):
2 | _instance = None
3 |
4 | def __init__(self, maxsize=8):
5 | self.__maxsize = max(maxsize, 1)
6 | self.__cachedict = {}
7 | self.__cachequeue = []
8 |
9 | def __contains__(self, item):
10 | return item in self.__cachedict
11 |
12 | def __getitem__(self, item):
13 | return self.__cachedict[item]
14 |
15 | def __setitem__(self, key, value):
16 | if key in self.__cachequeue:
17 | self.__cachequeue.remove(key)
18 | if len(self.__cachequeue) >= self.__maxsize:
19 | for el in self.__cachequeue[self.__maxsize - 1:]:
20 | del self.__cachedict[el]
21 | self.__cachequeue = self.__cachequeue[:self.__maxsize - 1]
22 | self.__cachequeue.insert(0, key)
23 | self.__cachedict[key] = value
24 |
25 | def __len__(self):
26 | return len(self.__cachequeue)
27 |
28 | def maxSize(self):
29 | return self.__maxsize
30 |
31 | def clear(self):
32 | self.__cachedict = {}
33 | self.__cachequeue = []
34 |
35 | @classmethod
36 | def globalInstance(cls):
37 | if cls._instance is None:
38 | cls._instance = WidCacher()
39 | return cls._instance
40 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/widcacher.py:
--------------------------------------------------------------------------------
1 | class WidCacher(object):
2 | _instance = None
3 |
4 | def __init__(self, maxsize=8):
5 | self.__maxsize = max(maxsize, 1)
6 | self.__cachedict = {}
7 | self.__cachequeue = []
8 |
9 | def __contains__(self, item):
10 | return item in self.__cachedict
11 |
12 | def __getitem__(self, item):
13 | return self.__cachedict[item]
14 |
15 | def __setitem__(self, key, value):
16 | if key in self.__cachequeue:
17 | self.__cachequeue.remove(key)
18 | if len(self.__cachequeue) >= self.__maxsize:
19 | for el in self.__cachequeue[self.__maxsize - 1:]:
20 | del self.__cachedict[el]
21 | self.__cachequeue = self.__cachequeue[:self.__maxsize - 1]
22 | self.__cachequeue.insert(0, key)
23 | self.__cachedict[key] = value
24 |
25 | def __len__(self):
26 | return len(self.__cachequeue)
27 |
28 | def maxSize(self):
29 | return self.__maxsize
30 |
31 | def clear(self):
32 | self.__cachedict = {}
33 | self.__cachequeue = []
34 |
35 | @classmethod
36 | def globalInstance(cls):
37 | if cls._instance is None:
38 | cls._instance = WidCacher()
39 | return cls._instance
40 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/widcacher.py:
--------------------------------------------------------------------------------
1 | class WidCacher(object):
2 | _instance = None
3 |
4 | def __init__(self, maxsize=8):
5 | self.__maxsize = max(maxsize, 1)
6 | self.__cachedict = {}
7 | self.__cachequeue = []
8 |
9 | def __contains__(self, item):
10 | return item in self.__cachedict
11 |
12 | def __getitem__(self, item):
13 | return self.__cachedict[item]
14 |
15 | def __setitem__(self, key, value):
16 | if key in self.__cachequeue:
17 | self.__cachequeue.remove(key)
18 | if len(self.__cachequeue) >= self.__maxsize:
19 | for el in self.__cachequeue[self.__maxsize - 1:]:
20 | del self.__cachedict[el]
21 | self.__cachequeue = self.__cachequeue[:self.__maxsize - 1]
22 | self.__cachequeue.insert(0, key)
23 | self.__cachedict[key] = value
24 |
25 | def __len__(self):
26 | return len(self.__cachequeue)
27 |
28 | def maxSize(self):
29 | return self.__maxsize
30 |
31 | def clear(self):
32 | self.__cachedict = {}
33 | self.__cachequeue = []
34 |
35 | @classmethod
36 | def globalInstance(cls):
37 | if cls._instance is None:
38 | cls._instance = WidCacher()
39 | return cls._instance
40 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/nethelper.py:
--------------------------------------------------------------------------------
1 | from urllib import request, error
2 | from .logger import defaultLogger as log
3 |
4 |
5 | class ErrorReply(object):
6 | def __init__(self, code, headers=None, msg=''):
7 | if headers is None:
8 | headers = {}
9 | self.__headers = headers
10 | self.__code = code
11 | self.msg = msg
12 |
13 | def info(self):
14 | return self.__headers
15 |
16 | def read(self):
17 | return None
18 |
19 |
20 | def urlopen_nt(req: request.Request, fallback_cert: int = 0) -> (int, object):
21 | """
22 | wrapper around urllib2.urlopen that does not throw HTTPError
23 | and does some additional things like falling back on SSL certs
24 | :param req:
25 | :param fallback_cert: do not use
26 | :return:
27 | """
28 | code = -1
29 | rep = None
30 | # print req.get_full_url(), req.get_data(), fallback_cert
31 | try:
32 | if fallback_cert == 0:
33 | rep = request.urlopen(req)
34 | elif fallback_cert == 1:
35 | import certifi
36 | rep = request.urlopen(req, cafile=certifi.where())
37 | elif fallback_cert == 2:
38 | import ssl
39 | rep = request.urlopen(req, context=ssl._create_unverified_context())
40 | log("connected with unverified context", 2)
41 | except error.HTTPError as e:
42 | code = e.code
43 | rep = ErrorReply(code, e.headers, e.reason)
44 | except error.URLError as e:
45 | if fallback_cert < 2:
46 | return urlopen_nt(req, fallback_cert+1)
47 | else:
48 | raise
49 |
50 | if code == -1:
51 | code = rep.getcode()
52 | return code, rep
53 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/nethelper.py:
--------------------------------------------------------------------------------
1 | from urllib import request, error
2 | from .logger import defaultLogger as log
3 |
4 |
5 | class ErrorReply(object):
6 | def __init__(self, code, headers=None, msg=''):
7 | if headers is None:
8 | headers = {}
9 | self.__headers = headers
10 | self.__code = code
11 | self.msg = msg
12 |
13 | def info(self):
14 | return self.__headers
15 |
16 | def read(self):
17 | return None
18 |
19 |
20 | def urlopen_nt(req: request.Request, fallback_cert: int = 0) -> (int, object):
21 | """
22 | wrapper around urllib2.urlopen that does not throw HTTPError
23 | and does some additional things like falling back on SSL certs
24 | :param req:
25 | :param fallback_cert: do not use
26 | :return:
27 | """
28 | code = -1
29 | rep = None
30 | # print req.get_full_url(), req.get_data(), fallback_cert
31 | try:
32 | if fallback_cert == 0:
33 | rep = request.urlopen(req)
34 | elif fallback_cert == 1:
35 | import certifi
36 | rep = request.urlopen(req, cafile=certifi.where())
37 | elif fallback_cert == 2:
38 | import ssl
39 | rep = request.urlopen(req, context=ssl._create_unverified_context())
40 | log("connected with unverified context", 2)
41 | except error.HTTPError as e:
42 | code = e.code
43 | rep = ErrorReply(code, e.headers, e.reason)
44 | except error.URLError as e:
45 | if fallback_cert < 2:
46 | return urlopen_nt(req, fallback_cert+1)
47 | else:
48 | raise
49 |
50 | if code == -1:
51 | code = rep.getcode()
52 | return code, rep
53 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/nethelper.py:
--------------------------------------------------------------------------------
1 | from urllib import request, error
2 | from .logger import defaultLogger as log
3 |
4 |
5 | class ErrorReply(object):
6 | def __init__(self, code, headers=None, msg=''):
7 | if headers is None:
8 | headers = {}
9 | self.__headers = headers
10 | self.__code = code
11 | self.msg = msg
12 |
13 | def info(self):
14 | return self.__headers
15 |
16 | def read(self):
17 | return None
18 |
19 |
20 | def urlopen_nt(req: request.Request, fallback_cert: int = 0) -> (int, object):
21 | """
22 | wrapper around urllib2.urlopen that does not throw HTTPError
23 | and does some additional things like falling back on SSL certs
24 | :param req:
25 | :param fallback_cert: do not use
26 | :return:
27 | """
28 | code = -1
29 | rep = None
30 | # print req.get_full_url(), req.get_data(), fallback_cert
31 | try:
32 | if fallback_cert == 0:
33 | rep = request.urlopen(req)
34 | elif fallback_cert == 1:
35 | import certifi
36 | rep = request.urlopen(req, cafile=certifi.where())
37 | elif fallback_cert == 2:
38 | import ssl
39 | rep = request.urlopen(req, context=ssl._create_unverified_context())
40 | log("connected with unverified context", 2)
41 | except error.HTTPError as e:
42 | code = e.code
43 | rep = ErrorReply(code, e.headers, e.reason)
44 | except error.URLError as e:
45 | if fallback_cert < 2:
46 | return urlopen_nt(req, fallback_cert+1)
47 | else:
48 | raise
49 |
50 | if code == -1:
51 | code = rep.getcode()
52 | return code, rep
53 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/nethelper.py:
--------------------------------------------------------------------------------
1 | from urllib import request, error
2 | from .logger import defaultLogger as log
3 |
4 |
5 | class ErrorReply(object):
6 | def __init__(self, code, headers=None, msg=''):
7 | if headers is None:
8 | headers = {}
9 | self.__headers = headers
10 | self.__code = code
11 | self.msg = msg
12 |
13 | def info(self):
14 | return self.__headers
15 |
16 | def read(self):
17 | return None
18 |
19 |
20 | def urlopen_nt(req: request.Request, fallback_cert: int = 0) -> (int, object):
21 | """
22 | wrapper around urllib2.urlopen that does not throw HTTPError
23 | and does some additional things like falling back on SSL certs
24 | :param req:
25 | :param fallback_cert: do not use
26 | :return:
27 | """
28 | code = -1
29 | rep = None
30 | # print req.get_full_url(), req.get_data(), fallback_cert
31 | try:
32 | if fallback_cert == 0:
33 | rep = request.urlopen(req)
34 | elif fallback_cert == 1:
35 | import certifi
36 | rep = request.urlopen(req, cafile=certifi.where())
37 | elif fallback_cert == 2:
38 | import ssl
39 | rep = request.urlopen(req, context=ssl._create_unverified_context())
40 | log("connected with unverified context", 2)
41 | except error.HTTPError as e:
42 | code = e.code
43 | rep = ErrorReply(code, e.headers, e.reason)
44 | except error.URLError as e:
45 | if fallback_cert < 2:
46 | return urlopen_nt(req, fallback_cert+1)
47 | else:
48 | raise
49 |
50 | if code == -1:
51 | code = rep.getcode()
52 | return code, rep
53 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-collections.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
52 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/ix.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class IX(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 1000000 #approx
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://ix.io", 'f:1='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/ix\.io\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://ix.io/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/ix.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class IX(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 1000000 #approx
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://ix.io", 'f:1='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/ix\.io\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://ix.io/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/ix.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class IX(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 1000000 #approx
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://ix.io", 'f:1='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/ix\.io\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://ix.io/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/ix.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class IX(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 1000000 #approx
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://ix.io", 'f:1='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/ix\.io\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://ix.io/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/termbin.py:
--------------------------------------------------------------------------------
1 |
2 | import urllib2
3 | import socket
4 | import re
5 |
6 | from ..webclipboardbase import WebClipBoardBase
7 | from .. import hpasteoptions as opt
8 |
9 |
10 | class TermBin(WebClipBoardBase):
11 | def __init__(self):
12 | pass
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 1048000
21 |
22 | def webPackData(self, s):
23 | if(not isinstance(s,str)):
24 | s=str(s)
25 |
26 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
27 | try:
28 | skt=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
29 | skt.settimeout(30)
30 | skt.connect((r'termbin.com',9999))
31 | skt.sendall(s)
32 | repurl=skt.recv(256)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 |
37 | # if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # like http://termbin.com/8onr
40 | repmatch=re.match(r'http:\/\/termbin\.com\/(.+)',repurl)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard url")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 |
48 | def webUnpackData(self, id):
49 | id=str(id)
50 |
51 |
52 | try:
53 | req = urllib2.Request(r"http://termbin.com/"+id)
54 | rep = urllib2.urlopen(req, timeout=30)
55 | except Exception as e:
56 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
57 |
58 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
59 |
60 | repstring = rep.read()
61 |
62 | return repstring
63 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/termbin.py:
--------------------------------------------------------------------------------
1 |
2 | import urllib2
3 | import socket
4 | import re
5 |
6 | from ..webclipboardbase import WebClipBoardBase
7 | from .. import hpasteoptions as opt
8 |
9 |
10 | class TermBin(WebClipBoardBase):
11 | def __init__(self):
12 | pass
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 1048000
21 |
22 | def webPackData(self, s):
23 | if(not isinstance(s,str)):
24 | s=str(s)
25 |
26 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
27 | try:
28 | skt=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
29 | skt.settimeout(30)
30 | skt.connect((r'termbin.com',9999))
31 | skt.sendall(s)
32 | repurl=skt.recv(256)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 |
37 | # if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # like http://termbin.com/8onr
40 | repmatch=re.match(r'http:\/\/termbin\.com\/(.+)',repurl)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard url")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 |
48 | def webUnpackData(self, id):
49 | id=str(id)
50 |
51 |
52 | try:
53 | req = urllib2.Request(r"http://termbin.com/"+id)
54 | rep = urllib2.urlopen(req, timeout=30)
55 | except Exception as e:
56 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
57 |
58 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
59 |
60 | repstring = rep.read()
61 |
62 | return repstring
63 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/termbin.py:
--------------------------------------------------------------------------------
1 |
2 | import urllib2
3 | import socket
4 | import re
5 |
6 | from ..webclipboardbase import WebClipBoardBase
7 | from .. import hpasteoptions as opt
8 |
9 |
10 | class TermBin(WebClipBoardBase):
11 | def __init__(self):
12 | pass
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 1048000
21 |
22 | def webPackData(self, s):
23 | if(not isinstance(s,str)):
24 | s=str(s)
25 |
26 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
27 | try:
28 | skt=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
29 | skt.settimeout(30)
30 | skt.connect((r'termbin.com',9999))
31 | skt.sendall(s)
32 | repurl=skt.recv(256)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 |
37 | # if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # like http://termbin.com/8onr
40 | repmatch=re.match(r'http:\/\/termbin\.com\/(.+)',repurl)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard url")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 |
48 | def webUnpackData(self, id):
49 | id=str(id)
50 |
51 |
52 | try:
53 | req = urllib2.Request(r"http://termbin.com/"+id)
54 | rep = urllib2.urlopen(req, timeout=30)
55 | except Exception as e:
56 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
57 |
58 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
59 |
60 | repstring = rep.read()
61 |
62 | return repstring
63 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/termbin.py:
--------------------------------------------------------------------------------
1 |
2 | import urllib2
3 | import socket
4 | import re
5 |
6 | from ..webclipboardbase import WebClipBoardBase
7 | from .. import hpasteoptions as opt
8 |
9 |
10 | class TermBin(WebClipBoardBase):
11 | def __init__(self):
12 | pass
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 1048000
21 |
22 | def webPackData(self, s):
23 | if(not isinstance(s,str)):
24 | s=str(s)
25 |
26 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
27 | try:
28 | skt=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
29 | skt.settimeout(30)
30 | skt.connect((r'termbin.com',9999))
31 | skt.sendall(s)
32 | repurl=skt.recv(256)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 |
37 | # if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # like http://termbin.com/8onr
40 | repmatch=re.match(r'http:\/\/termbin\.com\/(.+)',repurl)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard url")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 |
48 | def webUnpackData(self, id):
49 | id=str(id)
50 |
51 |
52 | try:
53 | req = urllib2.Request(r"http://termbin.com/"+id)
54 | rep = urllib2.urlopen(req, timeout=30)
55 | except Exception as e:
56 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
57 |
58 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
59 |
60 | repstring = rep.read()
61 |
62 | return repstring
63 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/sprunge.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class Sprunge(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,5)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 4000000 #TODO: find out
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://sprunge.us", 'sprunge='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/sprunge\.us\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://sprunge.us/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/sprunge.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class Sprunge(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,5)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 4000000 #TODO: find out
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://sprunge.us", 'sprunge='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/sprunge\.us\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://sprunge.us/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/sprunge.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class Sprunge(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,5)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 4000000 #TODO: find out
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://sprunge.us", 'sprunge='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/sprunge\.us\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://sprunge.us/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/sprunge.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class Sprunge(WebClipBoardBase):
9 | def __init__(self):
10 | pass
11 |
12 | @classmethod
13 | def speedClass(cls):
14 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,5)
15 |
16 | @classmethod
17 | def maxStringLength(self):
18 | return 4000000 #TODO: find out
19 |
20 | def webPackData(self, s):
21 | if (not isinstance(s, str)):
22 | s = str(s)
23 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
24 |
25 | try:
26 | req = urllib2.Request(r"http://sprunge.us", 'sprunge='+s)
27 | rep = urllib2.urlopen(req, timeout=30)
28 | repstring = rep.read()
29 | except Exception as e:
30 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
31 |
32 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
33 |
34 | #repstring is in form 'http://sprunge.us/iADC\n'
35 | repmatch=re.match(r'http:\/\/sprunge\.us\/([^\/\.\n]+)\n?$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("Unrecognized server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(r"http://sprunge.us/" + id)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 |
55 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
56 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/pluginbenchmarker.py:
--------------------------------------------------------------------------------
1 | import hpastewebplugins
2 | import hpasteweb as hw
3 | import random
4 | import time
5 | from pprint import pprint
6 |
7 |
8 | def doTest(cycles=1):
9 | pluginlist = [x for x in hpastewebplugins.pluginClassList]
10 | ts = ''
11 | for i in range(50000): ts += chr(random.randint(ord('A'), ord('Z')))
12 | # s is 50 kb
13 | times = {}
14 | for cycle in range(cycles):
15 | for i in range(3):
16 | if i == 0:
17 | s = ts
18 | elif i == 1:
19 | s = ts * 10
20 | else:
21 | s = ts * 50
22 |
23 | for plug in pluginlist:
24 | if plug.__name__ not in times:
25 | times[plug.__name__] = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] # up,down,count
26 | try:
27 | t1 = time.time() # we'd better use time.clock() - but it's behaviour is too platform-dependent!
28 | id = hw.webPack(s, [plug.__name__])
29 | t2 = time.time()
30 | ss = hw.webUnpack(id)
31 | t3 = time.time()
32 | if ss != s:
33 | raise RuntimeError("test failed")
34 | print('%s in progress #%d: %s' % (plug.__name__, i, str((t2 - t1, t3 - t2))))
35 | times[plug.__name__][i][0] += t2 - t1
36 | times[plug.__name__][i][1] += t3 - t2
37 | times[plug.__name__][i][2] += 1
38 | except:
39 | pass
40 | time.sleep(10)
41 |
42 | # totaltimes={}
43 | # for k in times:
44 | # if k not in totaltimes:totaltimes[k]=0
45 | print('------------------------------\n')
46 | for k in times:
47 | print("%s :" % k)
48 | for i in range(3):
49 | if times[k][i][2] == 0:
50 | print("\t FAILED")
51 | else:
52 | print("\t %f :: %f" % (times[k][i][0] / times[k][i][2], times[k][i][1] / times[k][i][2]))
53 | return times
54 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/pluginbenchmarker.py:
--------------------------------------------------------------------------------
1 | import hpastewebplugins
2 | import hpasteweb as hw
3 | import random
4 | import time
5 | from pprint import pprint
6 |
7 |
8 | def doTest(cycles=1):
9 | pluginlist = [x for x in hpastewebplugins.pluginClassList]
10 | ts = ''
11 | for i in range(50000): ts += chr(random.randint(ord('A'), ord('Z')))
12 | # s is 50 kb
13 | times = {}
14 | for cycle in range(cycles):
15 | for i in range(3):
16 | if i == 0:
17 | s = ts
18 | elif i == 1:
19 | s = ts * 10
20 | else:
21 | s = ts * 50
22 |
23 | for plug in pluginlist:
24 | if plug.__name__ not in times:
25 | times[plug.__name__] = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] # up,down,count
26 | try:
27 | t1 = time.time() # we'd better use time.clock() - but it's behaviour is too platform-dependent!
28 | id = hw.webPack(s, [plug.__name__])
29 | t2 = time.time()
30 | ss = hw.webUnpack(id)
31 | t3 = time.time()
32 | if ss != s:
33 | raise RuntimeError("test failed")
34 | print('%s in progress #%d: %s' % (plug.__name__, i, str((t2 - t1, t3 - t2))))
35 | times[plug.__name__][i][0] += t2 - t1
36 | times[plug.__name__][i][1] += t3 - t2
37 | times[plug.__name__][i][2] += 1
38 | except:
39 | pass
40 | time.sleep(10)
41 |
42 | # totaltimes={}
43 | # for k in times:
44 | # if k not in totaltimes:totaltimes[k]=0
45 | print('------------------------------\n')
46 | for k in times:
47 | print("%s :" % k)
48 | for i in range(3):
49 | if times[k][i][2] == 0:
50 | print("\t FAILED")
51 | else:
52 | print("\t %f :: %f" % (times[k][i][0] / times[k][i][2], times[k][i][1] / times[k][i][2]))
53 | return times
54 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/pluginbenchmarker.py:
--------------------------------------------------------------------------------
1 | import hpastewebplugins
2 | import hpasteweb as hw
3 | import random
4 | import time
5 | from pprint import pprint
6 |
7 |
8 | def doTest(cycles=1):
9 | pluginlist = [x for x in hpastewebplugins.pluginClassList]
10 | ts = ''
11 | for i in range(50000): ts += chr(random.randint(ord('A'), ord('Z')))
12 | # s is 50 kb
13 | times = {}
14 | for cycle in range(cycles):
15 | for i in range(3):
16 | if i == 0:
17 | s = ts
18 | elif i == 1:
19 | s = ts * 10
20 | else:
21 | s = ts * 50
22 |
23 | for plug in pluginlist:
24 | if plug.__name__ not in times:
25 | times[plug.__name__] = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] # up,down,count
26 | try:
27 | t1 = time.time() # we'd better use time.clock() - but it's behaviour is too platform-dependent!
28 | id = hw.webPack(s, [plug.__name__])
29 | t2 = time.time()
30 | ss = hw.webUnpack(id)
31 | t3 = time.time()
32 | if ss != s:
33 | raise RuntimeError("test failed")
34 | print('%s in progress #%d: %s' % (plug.__name__, i, str((t2 - t1, t3 - t2))))
35 | times[plug.__name__][i][0] += t2 - t1
36 | times[plug.__name__][i][1] += t3 - t2
37 | times[plug.__name__][i][2] += 1
38 | except:
39 | pass
40 | time.sleep(10)
41 |
42 | # totaltimes={}
43 | # for k in times:
44 | # if k not in totaltimes:totaltimes[k]=0
45 | print('------------------------------\n')
46 | for k in times:
47 | print("%s :" % k)
48 | for i in range(3):
49 | if times[k][i][2] == 0:
50 | print("\t FAILED")
51 | else:
52 | print("\t %f :: %f" % (times[k][i][0] / times[k][i][2], times[k][i][1] / times[k][i][2]))
53 | return times
54 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/pluginbenchmarker.py:
--------------------------------------------------------------------------------
1 | import hpastewebplugins
2 | import hpasteweb as hw
3 | import random
4 | import time
5 | from pprint import pprint
6 |
7 |
8 | def doTest(cycles=1):
9 | pluginlist = [x for x in hpastewebplugins.pluginClassList]
10 | ts = ''
11 | for i in range(50000): ts += chr(random.randint(ord('A'), ord('Z')))
12 | # s is 50 kb
13 | times = {}
14 | for cycle in range(cycles):
15 | for i in range(3):
16 | if i == 0:
17 | s = ts
18 | elif i == 1:
19 | s = ts * 10
20 | else:
21 | s = ts * 50
22 |
23 | for plug in pluginlist:
24 | if plug.__name__ not in times:
25 | times[plug.__name__] = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] # up,down,count
26 | try:
27 | t1 = time.time() # we'd better use time.clock() - but it's behaviour is too platform-dependent!
28 | id = hw.webPack(s, [plug.__name__])
29 | t2 = time.time()
30 | ss = hw.webUnpack(id)
31 | t3 = time.time()
32 | if ss != s:
33 | raise RuntimeError("test failed")
34 | print('%s in progress #%d: %s' % (plug.__name__, i, str((t2 - t1, t3 - t2))))
35 | times[plug.__name__][i][0] += t2 - t1
36 | times[plug.__name__][i][1] += t3 - t2
37 | times[plug.__name__][i][2] += 1
38 | except:
39 | pass
40 | time.sleep(10)
41 |
42 | # totaltimes={}
43 | # for k in times:
44 | # if k not in totaltimes:totaltimes[k]=0
45 | print('------------------------------\n')
46 | for k in times:
47 | print("%s :" % k)
48 | for i in range(3):
49 | if times[k][i][2] == 0:
50 | print("\t FAILED")
51 | else:
52 | print("\t %f :: %f" % (times[k][i][0] / times[k][i][2], times[k][i][1] / times[k][i][2]))
53 | return times
54 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/clbin.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class Clbin(WebClipBoardBase):
8 | def __init__(self):
9 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 1000000 #approx
18 |
19 | def webPackData(self, s):
20 | if (not isinstance(s, str)):
21 | s = str(s)
22 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
23 |
24 | try:
25 | req = urllib2.Request(r"https://clbin.com", 'clbin='+s, headers=self.__headers)
26 | rep = urllib2.urlopen(req, timeout=30)
27 | repstring = rep.read()
28 | except Exception as e:
29 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
30 |
31 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
32 |
33 | #repstring is in form 'http://sprunge.us/iADC\n'
34 | repmatch=re.match(r'https:\/\/clbin\.com\/([^\/\.\n]+)\n?$',repstring)
35 | if(repmatch is None):
36 | raise RuntimeError("Unrecognized server response")
37 | id=repmatch.group(1)
38 |
39 | return str(id)
40 |
41 |
42 | def webUnpackData(self, id):
43 | id=str(id)
44 | try:
45 | req = urllib2.Request(r"https://clbin.com/" + id, headers=self.__headers)
46 | rep = urllib2.urlopen(req, timeout=30)
47 | except Exception as e:
48 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
49 |
50 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
51 |
52 | repstring = rep.read()
53 |
54 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
55 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/clbin.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class Clbin(WebClipBoardBase):
8 | def __init__(self):
9 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 1000000 #approx
18 |
19 | def webPackData(self, s):
20 | if (not isinstance(s, str)):
21 | s = str(s)
22 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
23 |
24 | try:
25 | req = urllib2.Request(r"https://clbin.com", 'clbin='+s, headers=self.__headers)
26 | rep = urllib2.urlopen(req, timeout=30)
27 | repstring = rep.read()
28 | except Exception as e:
29 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
30 |
31 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
32 |
33 | #repstring is in form 'http://sprunge.us/iADC\n'
34 | repmatch=re.match(r'https:\/\/clbin\.com\/([^\/\.\n]+)\n?$',repstring)
35 | if(repmatch is None):
36 | raise RuntimeError("Unrecognized server response")
37 | id=repmatch.group(1)
38 |
39 | return str(id)
40 |
41 |
42 | def webUnpackData(self, id):
43 | id=str(id)
44 | try:
45 | req = urllib2.Request(r"https://clbin.com/" + id, headers=self.__headers)
46 | rep = urllib2.urlopen(req, timeout=30)
47 | except Exception as e:
48 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
49 |
50 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
51 |
52 | repstring = rep.read()
53 |
54 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
55 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/clbin.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class Clbin(WebClipBoardBase):
8 | def __init__(self):
9 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 1000000 #approx
18 |
19 | def webPackData(self, s):
20 | if (not isinstance(s, str)):
21 | s = str(s)
22 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
23 |
24 | try:
25 | req = urllib2.Request(r"https://clbin.com", 'clbin='+s, headers=self.__headers)
26 | rep = urllib2.urlopen(req, timeout=30)
27 | repstring = rep.read()
28 | except Exception as e:
29 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
30 |
31 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
32 |
33 | #repstring is in form 'http://sprunge.us/iADC\n'
34 | repmatch=re.match(r'https:\/\/clbin\.com\/([^\/\.\n]+)\n?$',repstring)
35 | if(repmatch is None):
36 | raise RuntimeError("Unrecognized server response")
37 | id=repmatch.group(1)
38 |
39 | return str(id)
40 |
41 |
42 | def webUnpackData(self, id):
43 | id=str(id)
44 | try:
45 | req = urllib2.Request(r"https://clbin.com/" + id, headers=self.__headers)
46 | rep = urllib2.urlopen(req, timeout=30)
47 | except Exception as e:
48 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
49 |
50 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
51 |
52 | repstring = rep.read()
53 |
54 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
55 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/clbin.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class Clbin(WebClipBoardBase):
8 | def __init__(self):
9 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 1000000 #approx
18 |
19 | def webPackData(self, s):
20 | if (not isinstance(s, str)):
21 | s = str(s)
22 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
23 |
24 | try:
25 | req = urllib2.Request(r"https://clbin.com", 'clbin='+s, headers=self.__headers)
26 | rep = urllib2.urlopen(req, timeout=30)
27 | repstring = rep.read()
28 | except Exception as e:
29 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
30 |
31 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
32 |
33 | #repstring is in form 'http://sprunge.us/iADC\n'
34 | repmatch=re.match(r'https:\/\/clbin\.com\/([^\/\.\n]+)\n?$',repstring)
35 | if(repmatch is None):
36 | raise RuntimeError("Unrecognized server response")
37 | id=repmatch.group(1)
38 |
39 | return str(id)
40 |
41 |
42 | def webUnpackData(self, id):
43 | id=str(id)
44 | try:
45 | req = urllib2.Request(r"https://clbin.com/" + id, headers=self.__headers)
46 | rep = urllib2.urlopen(req, timeout=30)
47 | except Exception as e:
48 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
49 |
50 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
51 |
52 | repstring = rep.read()
53 |
54 | return repstring[:-1]if repstring[-1]=='\n' else repstring #there is \n in the end...
55 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-cloud-settings.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
55 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/QWebAuthDialog.py:
--------------------------------------------------------------------------------
1 | raise NotImplementedError()
2 | # TODO: Ran into temporary deadend: This requires exposing client_secret for github authentication... so no point using it now
3 | # TODO: need to implement something like device flow, but it is in beta currently
4 | # TODO: or enter personal access token manually
5 |
6 | import re
7 | try:
8 | from PySide2.QtWidgets import QDialog, QVBoxLayout
9 | from PySide2.QtWebEngineWidgets import QWebEngineView
10 | from PySide2.QtCore import QUrl
11 | except ImportError:
12 | raise NotImplementedError('web auth implemented only for QT5. Sorry, people who still use houdini 16.5')
13 |
14 |
15 | class QWebAuthDialog(QDialog):
16 | def __init__(self, url, success_re, parent=None):
17 | super(QWebAuthDialog, self).__init__(parent=parent)
18 |
19 | self.__webview = QWebEngineView(parent=self)
20 | self.__webview.load(QUrl(url))
21 | self.__succre = re.compile(success_re)
22 | self.__webview.urlChanged.connect(self.on_url_changed)
23 |
24 | self.__layout = QVBoxLayout()
25 | self.setLayout(self.__layout)
26 | self.__layout.addWidget(self.__webview)
27 | self.__result = None
28 |
29 | def get_result(self):
30 | return self.__result
31 |
32 | def on_url_changed(self, qurl):
33 | url = qurl.toString()
34 | match = self.__succre.match(url)
35 | print(url, match)
36 | if match:
37 | self.__result = match
38 | self.accept()
39 |
40 |
41 | if __name__ == '__main__': # testing
42 | import sys
43 | import string
44 | import random
45 | from PySide2.QtWidgets import QApplication
46 | qapp = QApplication(sys.argv)
47 | # w = QWebAuthDialog('https://www.google.com', r'https://www.google.com/search\?(.*)')
48 | webauthstate = ''.join(random.choice(string.ascii_letters) for _ in range(32))
49 | webauthparms = {'client_id': '42e8e8e9d844e45c2d05',
50 | 'redirect_uri': 'https://github.com/login/oauth/success',
51 | 'scope': 'gist',
52 | 'state': webauthstate}
53 | w = QWebAuthDialog(url='https://github.com/login/oauth/authorize?' +
54 | '&'.join('%s=%s' % (k, v) for k, v in webauthparms.iteritems()),
55 | success_re=r'https://github.com/login/oauth/success\?(.*)',
56 | parent=None)
57 | w.setGeometry(512, 256, 1024, 768)
58 | res = w.exec_()
59 | print(res == QWebAuthDialog.Accepted)
60 | print(w.get_result())
61 | if res == QWebAuthDialog.Accepted:
62 | print(w.get_result().groups())
63 | # qapp.exec_()
64 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/QWebAuthDialog.py:
--------------------------------------------------------------------------------
1 | raise NotImplementedError()
2 | # TODO: Ran into temporary deadend: This requires exposing client_secret for github authentication... so no point using it now
3 | # TODO: need to implement something like device flow, but it is in beta currently
4 | # TODO: or enter personal access token manually
5 |
6 | import re
7 | try:
8 | from PySide2.QtWidgets import QDialog, QVBoxLayout
9 | from PySide2.QtWebEngineWidgets import QWebEngineView
10 | from PySide2.QtCore import QUrl
11 | except ImportError:
12 | raise NotImplementedError('web auth implemented only for QT5. Sorry, people who still use houdini 16.5')
13 |
14 |
15 | class QWebAuthDialog(QDialog):
16 | def __init__(self, url, success_re, parent=None):
17 | super(QWebAuthDialog, self).__init__(parent=parent)
18 |
19 | self.__webview = QWebEngineView(parent=self)
20 | self.__webview.load(QUrl(url))
21 | self.__succre = re.compile(success_re)
22 | self.__webview.urlChanged.connect(self.on_url_changed)
23 |
24 | self.__layout = QVBoxLayout()
25 | self.setLayout(self.__layout)
26 | self.__layout.addWidget(self.__webview)
27 | self.__result = None
28 |
29 | def get_result(self):
30 | return self.__result
31 |
32 | def on_url_changed(self, qurl):
33 | url = qurl.toString()
34 | match = self.__succre.match(url)
35 | print(url, match)
36 | if match:
37 | self.__result = match
38 | self.accept()
39 |
40 |
41 | if __name__ == '__main__': # testing
42 | import sys
43 | import string
44 | import random
45 | from PySide2.QtWidgets import QApplication
46 | qapp = QApplication(sys.argv)
47 | # w = QWebAuthDialog('https://www.google.com', r'https://www.google.com/search\?(.*)')
48 | webauthstate = ''.join(random.choice(string.ascii_letters) for _ in range(32))
49 | webauthparms = {'client_id': '42e8e8e9d844e45c2d05',
50 | 'redirect_uri': 'https://github.com/login/oauth/success',
51 | 'scope': 'gist',
52 | 'state': webauthstate}
53 | w = QWebAuthDialog(url='https://github.com/login/oauth/authorize?' +
54 | '&'.join('%s=%s' % (k, v) for k, v in webauthparms.iteritems()),
55 | success_re=r'https://github.com/login/oauth/success\?(.*)',
56 | parent=None)
57 | w.setGeometry(512, 256, 1024, 768)
58 | res = w.exec_()
59 | print(res == QWebAuthDialog.Accepted)
60 | print(w.get_result())
61 | if res == QWebAuthDialog.Accepted:
62 | print(w.get_result().groups())
63 | # qapp.exec_()
64 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/QWebAuthDialog.py:
--------------------------------------------------------------------------------
1 | raise NotImplementedError()
2 | # TODO: Ran into temporary deadend: This requires exposing client_secret for github authentication... so no point using it now
3 | # TODO: need to implement something like device flow, but it is in beta currently
4 | # TODO: or enter personal access token manually
5 |
6 | import re
7 | try:
8 | from PySide2.QtWidgets import QDialog, QVBoxLayout
9 | from PySide2.QtWebEngineWidgets import QWebEngineView
10 | from PySide2.QtCore import QUrl
11 | except ImportError:
12 | raise NotImplementedError('web auth implemented only for QT5. Sorry, people who still use houdini 16.5')
13 |
14 |
15 | class QWebAuthDialog(QDialog):
16 | def __init__(self, url, success_re, parent=None):
17 | super(QWebAuthDialog, self).__init__(parent=parent)
18 |
19 | self.__webview = QWebEngineView(parent=self)
20 | self.__webview.load(QUrl(url))
21 | self.__succre = re.compile(success_re)
22 | self.__webview.urlChanged.connect(self.on_url_changed)
23 |
24 | self.__layout = QVBoxLayout()
25 | self.setLayout(self.__layout)
26 | self.__layout.addWidget(self.__webview)
27 | self.__result = None
28 |
29 | def get_result(self):
30 | return self.__result
31 |
32 | def on_url_changed(self, qurl):
33 | url = qurl.toString()
34 | match = self.__succre.match(url)
35 | print(url, match)
36 | if match:
37 | self.__result = match
38 | self.accept()
39 |
40 |
41 | if __name__ == '__main__': # testing
42 | import sys
43 | import string
44 | import random
45 | from PySide2.QtWidgets import QApplication
46 | qapp = QApplication(sys.argv)
47 | # w = QWebAuthDialog('https://www.google.com', r'https://www.google.com/search\?(.*)')
48 | webauthstate = ''.join(random.choice(string.ascii_letters) for _ in range(32))
49 | webauthparms = {'client_id': '42e8e8e9d844e45c2d05',
50 | 'redirect_uri': 'https://github.com/login/oauth/success',
51 | 'scope': 'gist',
52 | 'state': webauthstate}
53 | w = QWebAuthDialog(url='https://github.com/login/oauth/authorize?' +
54 | '&'.join('%s=%s' % (k, v) for k, v in webauthparms.iteritems()),
55 | success_re=r'https://github.com/login/oauth/success\?(.*)',
56 | parent=None)
57 | w.setGeometry(512, 256, 1024, 768)
58 | res = w.exec_()
59 | print(res == QWebAuthDialog.Accepted)
60 | print(w.get_result())
61 | if res == QWebAuthDialog.Accepted:
62 | print(w.get_result().groups())
63 | # qapp.exec_()
64 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/github.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import json
3 | import re
4 |
5 | from ..webclipboardbase import WebClipBoardBase
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class GitHub(WebClipBoardBase):
10 | def __init__(self):
11 | #todo: make proper user agent
12 | self.__headers = {'User-Agent': 'HPaste'}
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 10000000 #actually the service seem th be able to eat more, much more!
21 |
22 | def webPackData(self, s):
23 | if (not isinstance(s, str)):
24 | s = str(s)
25 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
26 | data = {}
27 | data["description"] = "hpaste exchange snippet"
28 | data['public'] = False
29 | data['files'] = {'snippet.hou': {"content": s}}
30 | try:
31 | req = urllib2.Request(r'https://api.github.com/gists', json.dumps(data).encode('UTF-8'), headers=self.__headers)
32 | rep = urllib2.urlopen(req, timeout=30)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 | try:
37 | repdata = json.loads(rep.read())
38 | except:
39 | raise RuntimeError("server response cannot be parsed")
40 |
41 | # if (rep.getcode() != 201): raise RuntimeError("error code from web clipboard")
42 | rawurl=repdata["files"]["snippet.hou"]["raw_url"]
43 | #print(rawurl)
44 | repmatch=re.match(r'.*\/anonymous\/([^\/\.]+)\/raw\/([^\/\.]+)\/snippet\.hou',rawurl)
45 | if(repmatch is None):
46 | raise RuntimeError("unexpected clipboard url")
47 | id='-'.join((repmatch.group(1),repmatch.group(2)))
48 |
49 | return str(id)
50 |
51 |
52 | def webUnpackData(self, id):
53 | id=str(id)
54 | if('-' not in id):raise RuntimeError("bad wid format!")
55 | idparts=id.split('-')
56 | try:
57 | req = urllib2.Request(r"https://gist.githubusercontent.com/anonymous/"+idparts[0]+r"/raw/"+idparts[1]+r"/snippet.hou", headers=self.__headers)
58 | rep = urllib2.urlopen(req, timeout=30)
59 | except Exception as e:
60 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
61 |
62 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
63 |
64 | repstring = rep.read()
65 |
66 | return repstring
67 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/github.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import json
3 | import re
4 |
5 | from ..webclipboardbase import WebClipBoardBase
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class GitHub(WebClipBoardBase):
10 | def __init__(self):
11 | #todo: make proper user agent
12 | self.__headers = {'User-Agent': 'HPaste'}
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 10000000 #actually the service seem th be able to eat more, much more!
21 |
22 | def webPackData(self, s):
23 | if (not isinstance(s, str)):
24 | s = str(s)
25 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
26 | data = {}
27 | data["description"] = "hpaste exchange snippet"
28 | data['public'] = False
29 | data['files'] = {'snippet.hou': {"content": s}}
30 | try:
31 | req = urllib2.Request(r'https://api.github.com/gists', json.dumps(data).encode('UTF-8'), headers=self.__headers)
32 | rep = urllib2.urlopen(req, timeout=30)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 | try:
37 | repdata = json.loads(rep.read())
38 | except:
39 | raise RuntimeError("server response cannot be parsed")
40 |
41 | # if (rep.getcode() != 201): raise RuntimeError("error code from web clipboard")
42 | rawurl=repdata["files"]["snippet.hou"]["raw_url"]
43 | #print(rawurl)
44 | repmatch=re.match(r'.*\/anonymous\/([^\/\.]+)\/raw\/([^\/\.]+)\/snippet\.hou',rawurl)
45 | if(repmatch is None):
46 | raise RuntimeError("unexpected clipboard url")
47 | id='-'.join((repmatch.group(1),repmatch.group(2)))
48 |
49 | return str(id)
50 |
51 |
52 | def webUnpackData(self, id):
53 | id=str(id)
54 | if('-' not in id):raise RuntimeError("bad wid format!")
55 | idparts=id.split('-')
56 | try:
57 | req = urllib2.Request(r"https://gist.githubusercontent.com/anonymous/"+idparts[0]+r"/raw/"+idparts[1]+r"/snippet.hou", headers=self.__headers)
58 | rep = urllib2.urlopen(req, timeout=30)
59 | except Exception as e:
60 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
61 |
62 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
63 |
64 | repstring = rep.read()
65 |
66 | return repstring
67 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/github.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import json
3 | import re
4 |
5 | from ..webclipboardbase import WebClipBoardBase
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class GitHub(WebClipBoardBase):
10 | def __init__(self):
11 | #todo: make proper user agent
12 | self.__headers = {'User-Agent': 'HPaste'}
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 10000000 #actually the service seem th be able to eat more, much more!
21 |
22 | def webPackData(self, s):
23 | if (not isinstance(s, str)):
24 | s = str(s)
25 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
26 | data = {}
27 | data["description"] = "hpaste exchange snippet"
28 | data['public'] = False
29 | data['files'] = {'snippet.hou': {"content": s}}
30 | try:
31 | req = urllib2.Request(r'https://api.github.com/gists', json.dumps(data).encode('UTF-8'), headers=self.__headers)
32 | rep = urllib2.urlopen(req, timeout=30)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 | try:
37 | repdata = json.loads(rep.read())
38 | except:
39 | raise RuntimeError("server response cannot be parsed")
40 |
41 | # if (rep.getcode() != 201): raise RuntimeError("error code from web clipboard")
42 | rawurl=repdata["files"]["snippet.hou"]["raw_url"]
43 | #print(rawurl)
44 | repmatch=re.match(r'.*\/anonymous\/([^\/\.]+)\/raw\/([^\/\.]+)\/snippet\.hou',rawurl)
45 | if(repmatch is None):
46 | raise RuntimeError("unexpected clipboard url")
47 | id='-'.join((repmatch.group(1),repmatch.group(2)))
48 |
49 | return str(id)
50 |
51 |
52 | def webUnpackData(self, id):
53 | id=str(id)
54 | if('-' not in id):raise RuntimeError("bad wid format!")
55 | idparts=id.split('-')
56 | try:
57 | req = urllib2.Request(r"https://gist.githubusercontent.com/anonymous/"+idparts[0]+r"/raw/"+idparts[1]+r"/snippet.hou", headers=self.__headers)
58 | rep = urllib2.urlopen(req, timeout=30)
59 | except Exception as e:
60 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
61 |
62 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
63 |
64 | repstring = rep.read()
65 |
66 | return repstring
67 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/github.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import json
3 | import re
4 |
5 | from ..webclipboardbase import WebClipBoardBase
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class GitHub(WebClipBoardBase):
10 | def __init__(self):
11 | #todo: make proper user agent
12 | self.__headers = {'User-Agent': 'HPaste'}
13 |
14 | @classmethod
15 | def speedClass(cls):
16 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,4)
17 |
18 | @classmethod
19 | def maxStringLength(self):
20 | return 10000000 #actually the service seem th be able to eat more, much more!
21 |
22 | def webPackData(self, s):
23 | if (not isinstance(s, str)):
24 | s = str(s)
25 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
26 | data = {}
27 | data["description"] = "hpaste exchange snippet"
28 | data['public'] = False
29 | data['files'] = {'snippet.hou': {"content": s}}
30 | try:
31 | req = urllib2.Request(r'https://api.github.com/gists', json.dumps(data).encode('UTF-8'), headers=self.__headers)
32 | rep = urllib2.urlopen(req, timeout=30)
33 | except Exception as e:
34 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
35 |
36 | try:
37 | repdata = json.loads(rep.read())
38 | except:
39 | raise RuntimeError("server response cannot be parsed")
40 |
41 | # if (rep.getcode() != 201): raise RuntimeError("error code from web clipboard")
42 | rawurl=repdata["files"]["snippet.hou"]["raw_url"]
43 | #print(rawurl)
44 | repmatch=re.match(r'.*\/anonymous\/([^\/\.]+)\/raw\/([^\/\.]+)\/snippet\.hou',rawurl)
45 | if(repmatch is None):
46 | raise RuntimeError("unexpected clipboard url")
47 | id='-'.join((repmatch.group(1),repmatch.group(2)))
48 |
49 | return str(id)
50 |
51 |
52 | def webUnpackData(self, id):
53 | id=str(id)
54 | if('-' not in id):raise RuntimeError("bad wid format!")
55 | idparts=id.split('-')
56 | try:
57 | req = urllib2.Request(r"https://gist.githubusercontent.com/anonymous/"+idparts[0]+r"/raw/"+idparts[1]+r"/snippet.hou", headers=self.__headers)
58 | rep = urllib2.urlopen(req, timeout=30)
59 | except Exception as e:
60 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
61 |
62 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
63 |
64 | repstring = rep.read()
65 |
66 | return repstring
67 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/pastenet.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class PasteNet(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'http://pastenet.com/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 65000 #very small!
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host+"index.php", "title=anus&visibility=1&paste_expire_date=1W&format=text&paste_data=###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | #
35 | repmatch=re.search(r'value="http:\/\/pastenet\.com\/([^\/\.]*)\/*"',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + "paste.php?download&id=" + id, headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/pastenet.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class PasteNet(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'http://pastenet.com/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 65000 #very small!
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host+"index.php", "title=anus&visibility=1&paste_expire_date=1W&format=text&paste_data=###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | #
35 | repmatch=re.search(r'value="http:\/\/pastenet\.com\/([^\/\.]*)\/*"',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + "paste.php?download&id=" + id, headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/pastenet.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class PasteNet(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'http://pastenet.com/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 65000 #very small!
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host+"index.php", "title=anus&visibility=1&paste_expire_date=1W&format=text&paste_data=###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | #
35 | repmatch=re.search(r'value="http:\/\/pastenet\.com\/([^\/\.]*)\/*"',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + "paste.php?download&id=" + id, headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/pastenet.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class PasteNet(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'http://pastenet.com/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 65000 #very small!
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host+"index.php", "title=anus&visibility=1&paste_expire_date=1W&format=text&paste_data=###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | #
35 | repmatch=re.search(r'value="http:\/\/pastenet\.com\/([^\/\.]*)\/*"',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(1)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + "paste.php?download&id=" + id, headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/dumptext.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class DumpText(WebClipBoardBase):
8 | def __init__(self):
9 | self.__host = r"http://dumptext.com/"
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,2)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 999000
18 |
19 | def webPackData(self, s):
20 | '''
21 | this function packs s into some internetclipboard, u r responsible for that s is web-acceptable
22 | :param s: string, cool for web
23 | :return: string id for that sketchy site
24 | '''
25 |
26 | # approximate limit
27 | if (not isinstance(s, str)):
28 | s = str(s)
29 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
30 |
31 | try:
32 | req = urllib2.Request(self.__host, "submit=Dump&exposure=private&expiration=4&syntax=text&paste=" + "###===DATASTART===###" + s + "###===DATAEND===###")
33 | rep = urllib2.urlopen(req, timeout=30)
34 | repstring = rep.geturl()
35 | except Exception as e:
36 | raise RuntimeError("timeout connecting to web clipboard: " + e.message)
37 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # at this point repstring should be of this form http://dumptext.com/YI6dQ8FE
40 | repmatch=re.match(r'http:\/\/dumptext\.com\/([^\/\.]*)$',repstring)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard server response")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 | def webUnpackData(self, id):
48 | id=str(id)
49 | try:
50 | req = urllib2.Request(self.__host + id + r'/raw')
51 | rep = urllib2.urlopen(req, timeout=30)
52 | except Exception as e:
53 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
54 |
55 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
56 |
57 | repstring = rep.read()
58 | datastart = repstring.find('###===DATASTART===###')
59 | if (datastart == -1):
60 | #print(repstring)
61 | raise RuntimeError("data is corrupted")
62 | dataend = repstring.rfind('###===DATAEND===###')
63 | if (dataend == -1): raise RuntimeError("data end is corrupted")
64 |
65 | s = repstring[datastart + 21:dataend]
66 | return s
67 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/dumptext.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class DumpText(WebClipBoardBase):
8 | def __init__(self):
9 | self.__host = r"http://dumptext.com/"
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,2)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 999000
18 |
19 | def webPackData(self, s):
20 | '''
21 | this function packs s into some internetclipboard, u r responsible for that s is web-acceptable
22 | :param s: string, cool for web
23 | :return: string id for that sketchy site
24 | '''
25 |
26 | # approximate limit
27 | if (not isinstance(s, str)):
28 | s = str(s)
29 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
30 |
31 | try:
32 | req = urllib2.Request(self.__host, "submit=Dump&exposure=private&expiration=4&syntax=text&paste=" + "###===DATASTART===###" + s + "###===DATAEND===###")
33 | rep = urllib2.urlopen(req, timeout=30)
34 | repstring = rep.geturl()
35 | except Exception as e:
36 | raise RuntimeError("timeout connecting to web clipboard: " + e.message)
37 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # at this point repstring should be of this form http://dumptext.com/YI6dQ8FE
40 | repmatch=re.match(r'http:\/\/dumptext\.com\/([^\/\.]*)$',repstring)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard server response")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 | def webUnpackData(self, id):
48 | id=str(id)
49 | try:
50 | req = urllib2.Request(self.__host + id + r'/raw')
51 | rep = urllib2.urlopen(req, timeout=30)
52 | except Exception as e:
53 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
54 |
55 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
56 |
57 | repstring = rep.read()
58 | datastart = repstring.find('###===DATASTART===###')
59 | if (datastart == -1):
60 | #print(repstring)
61 | raise RuntimeError("data is corrupted")
62 | dataend = repstring.rfind('###===DATAEND===###')
63 | if (dataend == -1): raise RuntimeError("data end is corrupted")
64 |
65 | s = repstring[datastart + 21:dataend]
66 | return s
67 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/dumptext.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class DumpText(WebClipBoardBase):
8 | def __init__(self):
9 | self.__host = r"http://dumptext.com/"
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,2)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 999000
18 |
19 | def webPackData(self, s):
20 | '''
21 | this function packs s into some internetclipboard, u r responsible for that s is web-acceptable
22 | :param s: string, cool for web
23 | :return: string id for that sketchy site
24 | '''
25 |
26 | # approximate limit
27 | if (not isinstance(s, str)):
28 | s = str(s)
29 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
30 |
31 | try:
32 | req = urllib2.Request(self.__host, "submit=Dump&exposure=private&expiration=4&syntax=text&paste=" + "###===DATASTART===###" + s + "###===DATAEND===###")
33 | rep = urllib2.urlopen(req, timeout=30)
34 | repstring = rep.geturl()
35 | except Exception as e:
36 | raise RuntimeError("timeout connecting to web clipboard: " + e.message)
37 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # at this point repstring should be of this form http://dumptext.com/YI6dQ8FE
40 | repmatch=re.match(r'http:\/\/dumptext\.com\/([^\/\.]*)$',repstring)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard server response")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 | def webUnpackData(self, id):
48 | id=str(id)
49 | try:
50 | req = urllib2.Request(self.__host + id + r'/raw')
51 | rep = urllib2.urlopen(req, timeout=30)
52 | except Exception as e:
53 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
54 |
55 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
56 |
57 | repstring = rep.read()
58 | datastart = repstring.find('###===DATASTART===###')
59 | if (datastart == -1):
60 | #print(repstring)
61 | raise RuntimeError("data is corrupted")
62 | dataend = repstring.rfind('###===DATAEND===###')
63 | if (dataend == -1): raise RuntimeError("data end is corrupted")
64 |
65 | s = repstring[datastart + 21:dataend]
66 | return s
67 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/dumptext.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 | class DumpText(WebClipBoardBase):
8 | def __init__(self):
9 | self.__host = r"http://dumptext.com/"
10 |
11 | @classmethod
12 | def speedClass(cls):
13 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,2)
14 |
15 | @classmethod
16 | def maxStringLength(self):
17 | return 999000
18 |
19 | def webPackData(self, s):
20 | '''
21 | this function packs s into some internetclipboard, u r responsible for that s is web-acceptable
22 | :param s: string, cool for web
23 | :return: string id for that sketchy site
24 | '''
25 |
26 | # approximate limit
27 | if (not isinstance(s, str)):
28 | s = str(s)
29 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
30 |
31 | try:
32 | req = urllib2.Request(self.__host, "submit=Dump&exposure=private&expiration=4&syntax=text&paste=" + "###===DATASTART===###" + s + "###===DATAEND===###")
33 | rep = urllib2.urlopen(req, timeout=30)
34 | repstring = rep.geturl()
35 | except Exception as e:
36 | raise RuntimeError("timeout connecting to web clipboard: " + e.message)
37 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
38 |
39 | # at this point repstring should be of this form http://dumptext.com/YI6dQ8FE
40 | repmatch=re.match(r'http:\/\/dumptext\.com\/([^\/\.]*)$',repstring)
41 | if(repmatch is None):
42 | raise RuntimeError("unexpected clipboard server response")
43 | id=repmatch.group(1)
44 |
45 | return str(id)
46 |
47 | def webUnpackData(self, id):
48 | id=str(id)
49 | try:
50 | req = urllib2.Request(self.__host + id + r'/raw')
51 | rep = urllib2.urlopen(req, timeout=30)
52 | except Exception as e:
53 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
54 |
55 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
56 |
57 | repstring = rep.read()
58 | datastart = repstring.find('###===DATASTART===###')
59 | if (datastart == -1):
60 | #print(repstring)
61 | raise RuntimeError("data is corrupted")
62 | dataend = repstring.rfind('###===DATAEND===###')
63 | if (dataend == -1): raise RuntimeError("data end is corrupted")
64 |
65 | s = repstring[datastart + 21:dataend]
66 | return s
67 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/QWebAuthDialog.py:
--------------------------------------------------------------------------------
1 | raise NotImplementedError()
2 | # TODO: Ran into temporary deadend: This requires exposing client_secret for github authentication... so no point using it now
3 | # TODO: need to implement something like device flow, but it is in beta currently
4 | # TODO: or enter personal access token manually
5 |
6 | import re
7 | try:
8 | from PySide6.QtWidgets import QDialog, QVBoxLayout
9 | from PySide6.QtWebEngineWidgets import QWebEngineView
10 | from PySide6.QtCore import QUrl
11 | except ImportError:
12 | from PySide2.QtWidgets import QDialog, QVBoxLayout
13 | from PySide2.QtWebEngineWidgets import QWebEngineView
14 | from PySide2.QtCore import QUrl
15 |
16 |
17 | class QWebAuthDialog(QDialog):
18 | def __init__(self, url, success_re, parent=None):
19 | super(QWebAuthDialog, self).__init__(parent=parent)
20 |
21 | self.__webview = QWebEngineView(parent=self)
22 | self.__webview.load(QUrl(url))
23 | self.__succre = re.compile(success_re)
24 | self.__webview.urlChanged.connect(self.on_url_changed)
25 |
26 | self.__layout = QVBoxLayout()
27 | self.setLayout(self.__layout)
28 | self.__layout.addWidget(self.__webview)
29 | self.__result = None
30 |
31 | def get_result(self):
32 | return self.__result
33 |
34 | def on_url_changed(self, qurl):
35 | url = qurl.toString()
36 | match = self.__succre.match(url)
37 | print(url, match)
38 | if match:
39 | self.__result = match
40 | self.accept()
41 |
42 |
43 | if __name__ == '__main__': # testing
44 | import sys
45 | import string
46 | import random
47 | from PySide2.QtWidgets import QApplication
48 | qapp = QApplication(sys.argv)
49 | # w = QWebAuthDialog('https://www.google.com', r'https://www.google.com/search\?(.*)')
50 | webauthstate = ''.join(random.choice(string.ascii_letters) for _ in range(32))
51 | webauthparms = {'client_id': '42e8e8e9d844e45c2d05',
52 | 'redirect_uri': 'https://github.com/login/oauth/success',
53 | 'scope': 'gist',
54 | 'state': webauthstate}
55 | w = QWebAuthDialog(url='https://github.com/login/oauth/authorize?' +
56 | '&'.join('%s=%s' % (k, v) for k, v in webauthparms.iteritems()),
57 | success_re=r'https://github.com/login/oauth/success\?(.*)',
58 | parent=None)
59 | w.setGeometry(512, 256, 1024, 768)
60 | res = w.exec_()
61 | print(res == QWebAuthDialog.Accepted)
62 | print(w.get_result())
63 | if res == QWebAuthDialog.Accepted:
64 | print(w.get_result().groups())
65 | # qapp.exec_()
66 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/textsave.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class TextSave(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'https://textsave.de/text/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 10000000 #actually the service seem th be able to eat more,
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host, "###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | # at this point repstring should be of this form https://textsave.de/text/A4WXiJGGFndlHDY1
35 | repmatch=re.match(r'(http|https):\/\/textsave\.de\/text\/([^\/\.]*)$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(2)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + id + r'/raw', headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/textsave.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class TextSave(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'https://textsave.de/text/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 10000000 #actually the service seem th be able to eat more,
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host, "###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | # at this point repstring should be of this form https://textsave.de/text/A4WXiJGGFndlHDY1
35 | repmatch=re.match(r'(http|https):\/\/textsave\.de\/text\/([^\/\.]*)$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(2)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + id + r'/raw', headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/textsave.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class TextSave(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'https://textsave.de/text/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 10000000 #actually the service seem th be able to eat more,
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host, "###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | # at this point repstring should be of this form https://textsave.de/text/A4WXiJGGFndlHDY1
35 | repmatch=re.match(r'(http|https):\/\/textsave\.de\/text\/([^\/\.]*)$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(2)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + id + r'/raw', headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/textsave.py:
--------------------------------------------------------------------------------
1 | import urllib2
2 | import re
3 |
4 | from ..webclipboardbase import WebClipBoardBase
5 | from .. import hpasteoptions as opt
6 |
7 |
8 | class TextSave(WebClipBoardBase):
9 | def __init__(self):
10 | self.__host = r'https://textsave.de/text/'
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class'%cls.__name__,3)
16 |
17 | @classmethod
18 | def maxStringLength(self):
19 | return 10000000 #actually the service seem th be able to eat more,
20 |
21 | def webPackData(self, s):
22 | if (not isinstance(s, str)):
23 | s = str(s)
24 | if (len(s) > self.maxStringLength()): raise RuntimeError("len of s it too big for web clipboard currently")
25 |
26 | try:
27 | req = urllib2.Request(self.__host, "###===DATASTART===###"+s+"###===DATAEND===###", headers=self.__headers)
28 | rep = urllib2.urlopen(req, timeout=30)
29 | repstring = rep.read()
30 | except Exception as e:
31 | raise RuntimeError("error/timeout connecting to web clipboard: " + str(e.message))
32 |
33 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
34 | # at this point repstring should be of this form https://textsave.de/text/A4WXiJGGFndlHDY1
35 | repmatch=re.match(r'(http|https):\/\/textsave\.de\/text\/([^\/\.]*)$',repstring)
36 | if(repmatch is None):
37 | raise RuntimeError("unexpected clipboard server response")
38 | id=repmatch.group(2)
39 |
40 | return str(id)
41 |
42 |
43 | def webUnpackData(self, id):
44 | id=str(id)
45 | try:
46 | req = urllib2.Request(self.__host + id + r'/raw', headers=self.__headers)
47 | rep = urllib2.urlopen(req, timeout=30)
48 | except Exception as e:
49 | raise RuntimeError("error/timeout connecting to web clipboard: " + e.message)
50 |
51 | if (rep.getcode() != 200): raise RuntimeError("error code from web clipboard")
52 |
53 | repstring = rep.read()
54 | datastart = repstring.find('###===DATASTART===###')
55 | if (datastart == -1):
56 | #print(repstring)
57 | raise RuntimeError("data is corrupted")
58 | dataend = repstring.rfind('###===DATAEND===###')
59 | if (dataend == -1): raise RuntimeError("data end is corrupted")
60 |
61 | s = repstring[datastart + 21:dataend]
62 | return s
63 |
--------------------------------------------------------------------------------
/config/Icons/hpaste-options.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/disabled/hastebin.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HasteBin(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 1)#was 5, but ssl error
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 400000
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s):
36 | if isinstance(s, str):
37 | s = s.encode('UTF-8')
38 | if len(s) > self.maxStringLength():
39 | raise RuntimeError("len of s it too big for web clipboard currently")
40 |
41 | try:
42 | req = request.Request(r"https://hastebin.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | id=json.loads(repstring)['key']
53 | except Exception as e:
54 | raise RuntimeError("Unknown Server responce: "+str(e.message))
55 |
56 | return str(id)
57 |
58 | def webUnpackData(self, id):
59 | id = id.encode('UTF-8')
60 | try:
61 | req = request.Request(r"https://hastebin.com/raw/" + id, headers=self.__headers)
62 | rep = self.urlopen(req, timeout=30)
63 | except HTTPError as e:
64 | if e.code == 404:
65 | raise WebClipBoardWidNotFound(id)
66 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
67 | except Exception as e:
68 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
69 |
70 | if rep.getcode() != 200:
71 | raise RuntimeError("error code from web clipboard")
72 |
73 | repstring = rep.read()
74 |
75 | return repstring
76 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/disabled/hastebin.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HasteBin(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 1)#was 5, but ssl error
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 400000
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s):
36 | if isinstance(s, str):
37 | s = s.encode('UTF-8')
38 | if len(s) > self.maxStringLength():
39 | raise RuntimeError("len of s it too big for web clipboard currently")
40 |
41 | try:
42 | req = request.Request(r"https://hastebin.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | id=json.loads(repstring)['key']
53 | except Exception as e:
54 | raise RuntimeError("Unknown Server responce: "+str(e.message))
55 |
56 | return str(id)
57 |
58 | def webUnpackData(self, id):
59 | id = id.encode('UTF-8')
60 | try:
61 | req = request.Request(r"https://hastebin.com/raw/" + id, headers=self.__headers)
62 | rep = self.urlopen(req, timeout=30)
63 | except HTTPError as e:
64 | if e.code == 404:
65 | raise WebClipBoardWidNotFound(id)
66 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
67 | except Exception as e:
68 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
69 |
70 | if rep.getcode() != 200:
71 | raise RuntimeError("error code from web clipboard")
72 |
73 | repstring = rep.read()
74 |
75 | return repstring
76 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/disabled/hastebin.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HasteBin(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 1)#was 5, but ssl error
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 400000
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s):
36 | if isinstance(s, str):
37 | s = s.encode('UTF-8')
38 | if len(s) > self.maxStringLength():
39 | raise RuntimeError("len of s it too big for web clipboard currently")
40 |
41 | try:
42 | req = request.Request(r"https://hastebin.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | id=json.loads(repstring)['key']
53 | except Exception as e:
54 | raise RuntimeError("Unknown Server responce: "+str(e.message))
55 |
56 | return str(id)
57 |
58 | def webUnpackData(self, id):
59 | id = id.encode('UTF-8')
60 | try:
61 | req = request.Request(r"https://hastebin.com/raw/" + id, headers=self.__headers)
62 | rep = self.urlopen(req, timeout=30)
63 | except HTTPError as e:
64 | if e.code == 404:
65 | raise WebClipBoardWidNotFound(id)
66 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
67 | except Exception as e:
68 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
69 |
70 | if rep.getcode() != 200:
71 | raise RuntimeError("error code from web clipboard")
72 |
73 | repstring = rep.read()
74 |
75 | return repstring
76 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/disabled/hastebin.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HasteBin(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 1)#was 5, but ssl error
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 400000
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s):
36 | if isinstance(s, str):
37 | s = s.encode('UTF-8')
38 | if len(s) > self.maxStringLength():
39 | raise RuntimeError("len of s it too big for web clipboard currently")
40 |
41 | try:
42 | req = request.Request(r"https://hastebin.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | id=json.loads(repstring)['key']
53 | except Exception as e:
54 | raise RuntimeError("Unknown Server responce: "+str(e.message))
55 |
56 | return str(id)
57 |
58 | def webUnpackData(self, id):
59 | id = id.encode('UTF-8')
60 | try:
61 | req = request.Request(r"https://hastebin.com/raw/" + id, headers=self.__headers)
62 | rep = self.urlopen(req, timeout=30)
63 | except HTTPError as e:
64 | if e.code == 404:
65 | raise WebClipBoardWidNotFound(id)
66 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
67 | except Exception as e:
68 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
69 |
70 | if rep.getcode() != 200:
71 | raise RuntimeError("error code from web clipboard")
72 |
73 | repstring = rep.read()
74 |
75 | return repstring
76 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpastewebplugins/houhpaste.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HPaste(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 10)
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 2**20
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s: str) -> str:
36 | if len(s) > self.maxStringLength():
37 | raise RuntimeError("len of s it too big for web clipboard currently")
38 |
39 | s = s.encode('UTF-8')
40 |
41 | try:
42 | req = request.Request(r"https://hou-hpaste.herokuapp.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | repson = json.loads(repstring)
53 | id = repson['key']
54 | except Exception as e:
55 | raise RuntimeError("Unknown Server responce: " + repr(e))
56 |
57 | assert isinstance(id, str)
58 | return id
59 |
60 | def webUnpackData(self, wid: str) -> str:
61 | # id = id.encode('UTF-8')
62 | try:
63 | req = request.Request(r"https://hou-hpaste.herokuapp.com/raw/" + wid, headers=self.__headers)
64 | rep = self.urlopen(req, timeout=30)
65 | except HTTPError as e:
66 | if e.code == 404:
67 | raise WebClipBoardWidNotFound(wid)
68 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
69 | except Exception as e:
70 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
71 |
72 | if rep.getcode() != 200:
73 | raise RuntimeError("error code from web clipboard")
74 |
75 | repstring = rep.read()
76 |
77 | return repstring.decode('UTF-8')
78 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpastewebplugins/houhpaste.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HPaste(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 10)
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 2**20
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s: str) -> str:
36 | if len(s) > self.maxStringLength():
37 | raise RuntimeError("len of s it too big for web clipboard currently")
38 |
39 | s = s.encode('UTF-8')
40 |
41 | try:
42 | req = request.Request(r"https://hou-hpaste.herokuapp.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | repson = json.loads(repstring)
53 | id = repson['key']
54 | except Exception as e:
55 | raise RuntimeError("Unknown Server responce: " + repr(e))
56 |
57 | assert isinstance(id, str)
58 | return id
59 |
60 | def webUnpackData(self, wid: str) -> str:
61 | # id = id.encode('UTF-8')
62 | try:
63 | req = request.Request(r"https://hou-hpaste.herokuapp.com/raw/" + wid, headers=self.__headers)
64 | rep = self.urlopen(req, timeout=30)
65 | except HTTPError as e:
66 | if e.code == 404:
67 | raise WebClipBoardWidNotFound(wid)
68 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
69 | except Exception as e:
70 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
71 |
72 | if rep.getcode() != 200:
73 | raise RuntimeError("error code from web clipboard")
74 |
75 | repstring = rep.read()
76 |
77 | return repstring.decode('UTF-8')
78 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpastewebplugins/houhpaste.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HPaste(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 10)
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 2**20
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s: str) -> str:
36 | if len(s) > self.maxStringLength():
37 | raise RuntimeError("len of s it too big for web clipboard currently")
38 |
39 | s = s.encode('UTF-8')
40 |
41 | try:
42 | req = request.Request(r"https://hou-hpaste.herokuapp.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | repson = json.loads(repstring)
53 | id = repson['key']
54 | except Exception as e:
55 | raise RuntimeError("Unknown Server responce: " + repr(e))
56 |
57 | assert isinstance(id, str)
58 | return id
59 |
60 | def webUnpackData(self, wid: str) -> str:
61 | # id = id.encode('UTF-8')
62 | try:
63 | req = request.Request(r"https://hou-hpaste.herokuapp.com/raw/" + wid, headers=self.__headers)
64 | rep = self.urlopen(req, timeout=30)
65 | except HTTPError as e:
66 | if e.code == 404:
67 | raise WebClipBoardWidNotFound(wid)
68 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
69 | except Exception as e:
70 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
71 |
72 | if rep.getcode() != 200:
73 | raise RuntimeError("error code from web clipboard")
74 |
75 | repstring = rep.read()
76 |
77 | return repstring.decode('UTF-8')
78 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hpastewebplugins/houhpaste.py:
--------------------------------------------------------------------------------
1 | from urllib import request
2 | from urllib.error import URLError, HTTPError
3 | import json
4 |
5 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
6 | from .. import hpasteoptions as opt
7 |
8 |
9 | class HPaste(WebClipBoardBase):
10 | def __init__(self):
11 | self.__headers = {'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11'}
12 |
13 | @classmethod
14 | def speedClass(cls):
15 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 10)
16 |
17 | @classmethod
18 | def maxStringLength(cls):
19 | return 2**20
20 |
21 | @classmethod
22 | def urlopen(cls, url, timeout=30):
23 | try:
24 | rep = request.urlopen(url, timeout=timeout)
25 | except URLError as e:
26 | try:
27 | import certifi
28 | rep = request.urlopen(url, timeout=timeout, cafile=certifi.where())
29 | except ImportError:
30 | import ssl
31 | rep = request.urlopen(url, timeout=timeout, context=ssl._create_unverified_context())
32 | print("WARNING: connected with unverified context")
33 | return rep
34 |
35 | def webPackData(self, s: str) -> str:
36 | if len(s) > self.maxStringLength():
37 | raise RuntimeError("len of s it too big for web clipboard currently")
38 |
39 | s = s.encode('UTF-8')
40 |
41 | try:
42 | req = request.Request(r"https://hou-hpaste.herokuapp.com/documents", s, headers=self.__headers)
43 | rep = self.urlopen(req, timeout=30)
44 | repstring = rep.read()
45 | except Exception as e:
46 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
47 |
48 | if rep.getcode() != 200:
49 | raise RuntimeError("error code from web clipboard")
50 |
51 | try:
52 | repson = json.loads(repstring)
53 | id = repson['key']
54 | except Exception as e:
55 | raise RuntimeError("Unknown Server responce: " + repr(e))
56 |
57 | assert isinstance(id, str)
58 | return id
59 |
60 | def webUnpackData(self, wid: str) -> str:
61 | # id = id.encode('UTF-8')
62 | try:
63 | req = request.Request(r"https://hou-hpaste.herokuapp.com/raw/" + wid, headers=self.__headers)
64 | rep = self.urlopen(req, timeout=30)
65 | except HTTPError as e:
66 | if e.code == 404:
67 | raise WebClipBoardWidNotFound(wid)
68 | raise RuntimeError("error connecting to web clipboard: " + repr(e))
69 | except Exception as e:
70 | raise RuntimeError("error/timeout connecting to web clipboard: " + repr(e))
71 |
72 | if rep.getcode() != 200:
73 | raise RuntimeError("error code from web clipboard")
74 |
75 | repstring = rep.read()
76 |
77 | return repstring.decode('UTF-8')
78 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/resources/accountsmanager.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 488
10 | 426
11 |
12 |
13 |
14 | account manager
15 |
16 |
17 | QWidget#MainWindow {
18 | background-color : rgb(78,78,78)
19 | }
20 |
21 |
22 |
23 | 0
24 |
25 |
26 | 0
27 |
28 | -
29 |
30 |
-
31 |
32 |
-
33 |
34 |
35 | add
36 |
37 |
38 |
39 | -
40 |
41 |
42 | remove
43 |
44 |
45 |
46 | -
47 |
48 |
49 | Qt::Vertical
50 |
51 |
52 |
53 | 20
54 | 40
55 |
56 |
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 | -
65 |
66 |
-
67 |
68 |
69 | add
70 |
71 |
72 |
73 | -
74 |
75 |
76 | remove
77 |
78 |
79 |
80 | -
81 |
82 |
83 | Qt::Vertical
84 |
85 |
86 |
87 | 20
88 | 40
89 |
90 |
91 |
92 |
93 |
94 |
95 | -
96 |
97 |
98 | -
99 |
100 |
101 | re-initialize
102 | collections
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/resources/accountsmanager.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 488
10 | 426
11 |
12 |
13 |
14 | account manager
15 |
16 |
17 | QWidget#MainWindow {
18 | background-color : rgb(78,78,78)
19 | }
20 |
21 |
22 |
23 | 0
24 |
25 |
26 | 0
27 |
28 | -
29 |
30 |
-
31 |
32 |
-
33 |
34 |
35 | add
36 |
37 |
38 |
39 | -
40 |
41 |
42 | remove
43 |
44 |
45 |
46 | -
47 |
48 |
49 | Qt::Vertical
50 |
51 |
52 |
53 | 20
54 | 40
55 |
56 |
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 | -
65 |
66 |
-
67 |
68 |
69 | add
70 |
71 |
72 |
73 | -
74 |
75 |
76 | remove
77 |
78 |
79 |
80 | -
81 |
82 |
83 | Qt::Vertical
84 |
85 |
86 |
87 | 20
88 | 40
89 |
90 |
91 |
92 |
93 |
94 |
95 | -
96 |
97 |
98 | -
99 |
100 |
101 | re-initialize
102 | collections
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/resources/accountsmanager.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 488
10 | 426
11 |
12 |
13 |
14 | account manager
15 |
16 |
17 | QWidget#MainWindow {
18 | background-color : rgb(78,78,78)
19 | }
20 |
21 |
22 |
23 | 0
24 |
25 |
26 | 0
27 |
28 | -
29 |
30 |
-
31 |
32 |
-
33 |
34 |
35 | add
36 |
37 |
38 |
39 | -
40 |
41 |
42 | remove
43 |
44 |
45 |
46 | -
47 |
48 |
49 | Qt::Vertical
50 |
51 |
52 |
53 | 20
54 | 40
55 |
56 |
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 | -
65 |
66 |
-
67 |
68 |
69 | add
70 |
71 |
72 |
73 | -
74 |
75 |
76 | remove
77 |
78 |
79 |
80 | -
81 |
82 |
83 | Qt::Vertical
84 |
85 |
86 |
87 | 20
88 | 40
89 |
90 |
91 |
92 |
93 |
94 |
95 | -
96 |
97 |
98 | -
99 |
100 |
101 | re-initialize
102 | collections
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/resources/accountsmanager.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 488
10 | 426
11 |
12 |
13 |
14 | account manager
15 |
16 |
17 | QWidget#MainWindow {
18 | background-color : rgb(78,78,78)
19 | }
20 |
21 |
22 |
23 | 0
24 |
25 |
26 | 0
27 |
28 | -
29 |
30 |
-
31 |
32 |
-
33 |
34 |
35 | add
36 |
37 |
38 |
39 | -
40 |
41 |
42 | remove
43 |
44 |
45 |
46 | -
47 |
48 |
49 | Qt::Vertical
50 |
51 |
52 |
53 | 20
54 | 40
55 |
56 |
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 | -
65 |
66 |
-
67 |
68 |
69 | add
70 |
71 |
72 |
73 | -
74 |
75 |
76 | remove
77 |
78 |
79 |
80 | -
81 |
82 |
83 | Qt::Vertical
84 |
85 |
86 |
87 | 20
88 | 40
89 |
90 |
91 |
92 |
93 |
94 |
95 | -
96 |
97 |
98 | -
99 |
100 |
101 | re-initialize
102 | collections
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hcollections/QDoubleInputDialog.py:
--------------------------------------------------------------------------------
1 |
2 | from PySide2.QtWidgets import *
3 |
4 | class QDoubleInputDialog(QDialog):
5 | def __init__(self,parent=None):
6 | super(QDoubleInputDialog,self).__init__(parent)
7 |
8 | self.ui_mainLayout=QGridLayout(self)
9 | self.ui_text=QLabel(self)
10 | self.ui_label1 = QLabel(self)
11 | self.ui_label2 = QLabel(self)
12 | self.ui_line1 = QLineEdit(self)
13 | self.ui_line2 = QLineEdit(self)
14 |
15 | self.ui_buttonLayout=QHBoxLayout()
16 | self.ui_buttonOk = QPushButton('Ok',self)
17 | self.ui_buttonOk.setDefault(True)
18 | self.ui_buttonCancel = QPushButton('Cancel',self)
19 | self.ui_buttonLayout.addStretch()
20 | self.ui_buttonLayout.addWidget(self.ui_buttonOk)
21 | self.ui_buttonLayout.addWidget(self.ui_buttonCancel)
22 |
23 | self.ui_mainLayout.addWidget(self.ui_text, 0, 0, 1, 2)
24 | self.ui_mainLayout.addWidget(self.ui_label1, 1, 0)
25 | self.ui_mainLayout.addWidget(self.ui_label2, 2, 0)
26 | self.ui_mainLayout.addWidget(self.ui_line1, 1, 1)
27 | self.ui_mainLayout.addWidget(self.ui_line2, 2, 1)
28 | self.ui_mainLayout.addLayout(self.ui_buttonLayout, 4, 1)
29 |
30 | #Signals-Slots
31 | self.ui_buttonOk.clicked.connect(self.accept)
32 | self.ui_buttonCancel.clicked.connect(self.reject)
33 |
34 | #defaults
35 | self.ui_text.setText('Woof')
36 | self.ui_label1.setText('label1')
37 | self.ui_label2.setText('label2')
38 |
39 | @classmethod
40 | def getDoubleText(cls,parent,title,text,label1,label2,defValue1='',defValue2=''):
41 | dialog=QDoubleInputDialog(parent)
42 | dialog.setWindowTitle(title)
43 | dialog.ui_text.setText(text)
44 | dialog.ui_label1.setText(label1)
45 | dialog.ui_label2.setText(label2)
46 | dialog.ui_line1.setText(defValue1)
47 | dialog.ui_line2.setText(defValue2)
48 |
49 | res=dialog.exec_()
50 | return (dialog.ui_line1.text(),dialog.ui_line2.text(),res)
51 |
52 | @classmethod
53 | def getUserPassword(cls, parent, title, text, label1, label2, defValue1='', defValue2=''):
54 | dialog = QDoubleInputDialog(parent)
55 | dialog.setWindowTitle(title)
56 | dialog.ui_text.setText(text)
57 | dialog.ui_label1.setText(label1)
58 | dialog.ui_label2.setText(label2)
59 | dialog.ui_line1.setText(defValue1)
60 | dialog.ui_line2.setText(defValue2)
61 | dialog.ui_line2.setEchoMode(QLineEdit.Password)
62 |
63 | res = dialog.exec_()
64 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), res)
65 |
66 | @classmethod
67 | def getDoubleTextCheckbox(cls,parent,title,text,label1,label2,label3,defValue1='',defValue2='',defCheckbox=False):
68 | dialog = QDoubleInputDialog(parent)
69 | dialog.setWindowTitle(title)
70 | dialog.ui_text.setText(text)
71 | dialog.ui_label1.setText(label1)
72 | dialog.ui_label2.setText(label2)
73 | dialog.ui_line1.setText(defValue1)
74 | dialog.ui_line2.setText(defValue2)
75 | dialog.ui_checkbox=QCheckBox(label3,dialog)
76 | #dialog.ui_mainLayout.removeItem(dialog.ui_buttonLayout)
77 | #dialog.ui_mainLayout.addLayout(dialog.ui_buttonLayout,4,1)
78 | dialog.ui_mainLayout.addWidget(dialog.ui_checkbox, 3, 1)
79 |
80 | dialog.ui_checkbox.setChecked(defCheckbox)
81 |
82 | res = dialog.exec_()
83 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), dialog.ui_checkbox.isChecked(), res)
84 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hcollections/QDoubleInputDialog.py:
--------------------------------------------------------------------------------
1 |
2 | from PySide2.QtWidgets import *
3 |
4 | class QDoubleInputDialog(QDialog):
5 | def __init__(self,parent=None):
6 | super(QDoubleInputDialog,self).__init__(parent)
7 |
8 | self.ui_mainLayout=QGridLayout(self)
9 | self.ui_text=QLabel(self)
10 | self.ui_label1 = QLabel(self)
11 | self.ui_label2 = QLabel(self)
12 | self.ui_line1 = QLineEdit(self)
13 | self.ui_line2 = QLineEdit(self)
14 |
15 | self.ui_buttonLayout=QHBoxLayout()
16 | self.ui_buttonOk = QPushButton('Ok',self)
17 | self.ui_buttonOk.setDefault(True)
18 | self.ui_buttonCancel = QPushButton('Cancel',self)
19 | self.ui_buttonLayout.addStretch()
20 | self.ui_buttonLayout.addWidget(self.ui_buttonOk)
21 | self.ui_buttonLayout.addWidget(self.ui_buttonCancel)
22 |
23 | self.ui_mainLayout.addWidget(self.ui_text, 0, 0, 1, 2)
24 | self.ui_mainLayout.addWidget(self.ui_label1, 1, 0)
25 | self.ui_mainLayout.addWidget(self.ui_label2, 2, 0)
26 | self.ui_mainLayout.addWidget(self.ui_line1, 1, 1)
27 | self.ui_mainLayout.addWidget(self.ui_line2, 2, 1)
28 | self.ui_mainLayout.addLayout(self.ui_buttonLayout, 4, 1)
29 |
30 | #Signals-Slots
31 | self.ui_buttonOk.clicked.connect(self.accept)
32 | self.ui_buttonCancel.clicked.connect(self.reject)
33 |
34 | #defaults
35 | self.ui_text.setText('Woof')
36 | self.ui_label1.setText('label1')
37 | self.ui_label2.setText('label2')
38 |
39 | @classmethod
40 | def getDoubleText(cls,parent,title,text,label1,label2,defValue1='',defValue2=''):
41 | dialog=QDoubleInputDialog(parent)
42 | dialog.setWindowTitle(title)
43 | dialog.ui_text.setText(text)
44 | dialog.ui_label1.setText(label1)
45 | dialog.ui_label2.setText(label2)
46 | dialog.ui_line1.setText(defValue1)
47 | dialog.ui_line2.setText(defValue2)
48 |
49 | res=dialog.exec_()
50 | return (dialog.ui_line1.text(),dialog.ui_line2.text(),res)
51 |
52 | @classmethod
53 | def getUserPassword(cls, parent, title, text, label1, label2, defValue1='', defValue2=''):
54 | dialog = QDoubleInputDialog(parent)
55 | dialog.setWindowTitle(title)
56 | dialog.ui_text.setText(text)
57 | dialog.ui_label1.setText(label1)
58 | dialog.ui_label2.setText(label2)
59 | dialog.ui_line1.setText(defValue1)
60 | dialog.ui_line2.setText(defValue2)
61 | dialog.ui_line2.setEchoMode(QLineEdit.Password)
62 |
63 | res = dialog.exec_()
64 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), res)
65 |
66 | @classmethod
67 | def getDoubleTextCheckbox(cls,parent,title,text,label1,label2,label3,defValue1='',defValue2='',defCheckbox=False):
68 | dialog = QDoubleInputDialog(parent)
69 | dialog.setWindowTitle(title)
70 | dialog.ui_text.setText(text)
71 | dialog.ui_label1.setText(label1)
72 | dialog.ui_label2.setText(label2)
73 | dialog.ui_line1.setText(defValue1)
74 | dialog.ui_line2.setText(defValue2)
75 | dialog.ui_checkbox=QCheckBox(label3,dialog)
76 | #dialog.ui_mainLayout.removeItem(dialog.ui_buttonLayout)
77 | #dialog.ui_mainLayout.addLayout(dialog.ui_buttonLayout,4,1)
78 | dialog.ui_mainLayout.addWidget(dialog.ui_checkbox, 3, 1)
79 |
80 | dialog.ui_checkbox.setChecked(defCheckbox)
81 |
82 | res = dialog.exec_()
83 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), dialog.ui_checkbox.isChecked(), res)
84 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/hcollections/QDoubleInputDialog.py:
--------------------------------------------------------------------------------
1 |
2 | from PySide2.QtWidgets import *
3 |
4 | class QDoubleInputDialog(QDialog):
5 | def __init__(self,parent=None):
6 | super(QDoubleInputDialog,self).__init__(parent)
7 |
8 | self.ui_mainLayout=QGridLayout(self)
9 | self.ui_text=QLabel(self)
10 | self.ui_label1 = QLabel(self)
11 | self.ui_label2 = QLabel(self)
12 | self.ui_line1 = QLineEdit(self)
13 | self.ui_line2 = QLineEdit(self)
14 |
15 | self.ui_buttonLayout=QHBoxLayout()
16 | self.ui_buttonOk = QPushButton('Ok',self)
17 | self.ui_buttonOk.setDefault(True)
18 | self.ui_buttonCancel = QPushButton('Cancel',self)
19 | self.ui_buttonLayout.addStretch()
20 | self.ui_buttonLayout.addWidget(self.ui_buttonOk)
21 | self.ui_buttonLayout.addWidget(self.ui_buttonCancel)
22 |
23 | self.ui_mainLayout.addWidget(self.ui_text, 0, 0, 1, 2)
24 | self.ui_mainLayout.addWidget(self.ui_label1, 1, 0)
25 | self.ui_mainLayout.addWidget(self.ui_label2, 2, 0)
26 | self.ui_mainLayout.addWidget(self.ui_line1, 1, 1)
27 | self.ui_mainLayout.addWidget(self.ui_line2, 2, 1)
28 | self.ui_mainLayout.addLayout(self.ui_buttonLayout, 4, 1)
29 |
30 | #Signals-Slots
31 | self.ui_buttonOk.clicked.connect(self.accept)
32 | self.ui_buttonCancel.clicked.connect(self.reject)
33 |
34 | #defaults
35 | self.ui_text.setText('Woof')
36 | self.ui_label1.setText('label1')
37 | self.ui_label2.setText('label2')
38 |
39 | @classmethod
40 | def getDoubleText(cls,parent,title,text,label1,label2,defValue1='',defValue2=''):
41 | dialog=QDoubleInputDialog(parent)
42 | dialog.setWindowTitle(title)
43 | dialog.ui_text.setText(text)
44 | dialog.ui_label1.setText(label1)
45 | dialog.ui_label2.setText(label2)
46 | dialog.ui_line1.setText(defValue1)
47 | dialog.ui_line2.setText(defValue2)
48 |
49 | res=dialog.exec_()
50 | return (dialog.ui_line1.text(),dialog.ui_line2.text(),res)
51 |
52 | @classmethod
53 | def getUserPassword(cls, parent, title, text, label1, label2, defValue1='', defValue2=''):
54 | dialog = QDoubleInputDialog(parent)
55 | dialog.setWindowTitle(title)
56 | dialog.ui_text.setText(text)
57 | dialog.ui_label1.setText(label1)
58 | dialog.ui_label2.setText(label2)
59 | dialog.ui_line1.setText(defValue1)
60 | dialog.ui_line2.setText(defValue2)
61 | dialog.ui_line2.setEchoMode(QLineEdit.Password)
62 |
63 | res = dialog.exec_()
64 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), res)
65 |
66 | @classmethod
67 | def getDoubleTextCheckbox(cls,parent,title,text,label1,label2,label3,defValue1='',defValue2='',defCheckbox=False):
68 | dialog = QDoubleInputDialog(parent)
69 | dialog.setWindowTitle(title)
70 | dialog.ui_text.setText(text)
71 | dialog.ui_label1.setText(label1)
72 | dialog.ui_label2.setText(label2)
73 | dialog.ui_line1.setText(defValue1)
74 | dialog.ui_line2.setText(defValue2)
75 | dialog.ui_checkbox=QCheckBox(label3,dialog)
76 | #dialog.ui_mainLayout.removeItem(dialog.ui_buttonLayout)
77 | #dialog.ui_mainLayout.addLayout(dialog.ui_buttonLayout,4,1)
78 | dialog.ui_mainLayout.addWidget(dialog.ui_checkbox, 3, 1)
79 |
80 | dialog.ui_checkbox.setChecked(defCheckbox)
81 |
82 | res = dialog.exec_()
83 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), dialog.ui_checkbox.isChecked(), res)
84 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hcollections/QDoubleInputDialog.py:
--------------------------------------------------------------------------------
1 |
2 | try:
3 | from PySide6.QtWidgets import *
4 | except ImportError:
5 | from PySide2.QtWidgets import *
6 |
7 | class QDoubleInputDialog(QDialog):
8 | def __init__(self,parent=None):
9 | super(QDoubleInputDialog,self).__init__(parent)
10 |
11 | self.ui_mainLayout=QGridLayout(self)
12 | self.ui_text=QLabel(self)
13 | self.ui_label1 = QLabel(self)
14 | self.ui_label2 = QLabel(self)
15 | self.ui_line1 = QLineEdit(self)
16 | self.ui_line2 = QLineEdit(self)
17 |
18 | self.ui_buttonLayout=QHBoxLayout()
19 | self.ui_buttonOk = QPushButton('Ok',self)
20 | self.ui_buttonOk.setDefault(True)
21 | self.ui_buttonCancel = QPushButton('Cancel',self)
22 | self.ui_buttonLayout.addStretch()
23 | self.ui_buttonLayout.addWidget(self.ui_buttonOk)
24 | self.ui_buttonLayout.addWidget(self.ui_buttonCancel)
25 |
26 | self.ui_mainLayout.addWidget(self.ui_text, 0, 0, 1, 2)
27 | self.ui_mainLayout.addWidget(self.ui_label1, 1, 0)
28 | self.ui_mainLayout.addWidget(self.ui_label2, 2, 0)
29 | self.ui_mainLayout.addWidget(self.ui_line1, 1, 1)
30 | self.ui_mainLayout.addWidget(self.ui_line2, 2, 1)
31 | self.ui_mainLayout.addLayout(self.ui_buttonLayout, 4, 1)
32 |
33 | #Signals-Slots
34 | self.ui_buttonOk.clicked.connect(self.accept)
35 | self.ui_buttonCancel.clicked.connect(self.reject)
36 |
37 | #defaults
38 | self.ui_text.setText('Woof')
39 | self.ui_label1.setText('label1')
40 | self.ui_label2.setText('label2')
41 |
42 | @classmethod
43 | def getDoubleText(cls,parent,title,text,label1,label2,defValue1='',defValue2=''):
44 | dialog=QDoubleInputDialog(parent)
45 | dialog.setWindowTitle(title)
46 | dialog.ui_text.setText(text)
47 | dialog.ui_label1.setText(label1)
48 | dialog.ui_label2.setText(label2)
49 | dialog.ui_line1.setText(defValue1)
50 | dialog.ui_line2.setText(defValue2)
51 |
52 | res=dialog.exec_()
53 | return (dialog.ui_line1.text(),dialog.ui_line2.text(),res)
54 |
55 | @classmethod
56 | def getUserPassword(cls, parent, title, text, label1, label2, defValue1='', defValue2=''):
57 | dialog = QDoubleInputDialog(parent)
58 | dialog.setWindowTitle(title)
59 | dialog.ui_text.setText(text)
60 | dialog.ui_label1.setText(label1)
61 | dialog.ui_label2.setText(label2)
62 | dialog.ui_line1.setText(defValue1)
63 | dialog.ui_line2.setText(defValue2)
64 | dialog.ui_line2.setEchoMode(QLineEdit.Password)
65 |
66 | res = dialog.exec_()
67 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), res)
68 |
69 | @classmethod
70 | def getDoubleTextCheckbox(cls,parent,title,text,label1,label2,label3,defValue1='',defValue2='',defCheckbox=False):
71 | dialog = QDoubleInputDialog(parent)
72 | dialog.setWindowTitle(title)
73 | dialog.ui_text.setText(text)
74 | dialog.ui_label1.setText(label1)
75 | dialog.ui_label2.setText(label2)
76 | dialog.ui_line1.setText(defValue1)
77 | dialog.ui_line2.setText(defValue2)
78 | dialog.ui_checkbox=QCheckBox(label3,dialog)
79 | #dialog.ui_mainLayout.removeItem(dialog.ui_buttonLayout)
80 | #dialog.ui_mainLayout.addLayout(dialog.ui_buttonLayout,4,1)
81 | dialog.ui_mainLayout.addWidget(dialog.ui_checkbox, 3, 1)
82 |
83 | dialog.ui_checkbox.setChecked(defCheckbox)
84 |
85 | res = dialog.exec_()
86 | return (dialog.ui_line1.text(), dialog.ui_line2.text(), dialog.ui_checkbox.isChecked(), res)
87 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/accountsmanager_ui.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'accountsmanager.ui'
4 | #
5 | # Created: Sat Jan 13 23:24:24 2018
6 | # by: pyside2-uic running on PySide2 2.0.0~alpha0
7 | #
8 | # WARNING! All changes made in this file will be lost!
9 |
10 | from PySide2 import QtCore, QtGui, QtWidgets
11 |
12 | class Ui_MainWindow(object):
13 | def setupUi(self, MainWindow):
14 | MainWindow.setObjectName("MainWindow")
15 | MainWindow.resize(488, 426)
16 | MainWindow.setStyleSheet("QWidget#MainWindow {\n"
17 | " background-color : rgb(78,78,78)\n"
18 | "}")
19 | self.verticalLayout = QtWidgets.QVBoxLayout(MainWindow)
20 | self.verticalLayout.setSpacing(0)
21 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
22 | self.verticalLayout.setObjectName("verticalLayout")
23 | self.gridLayout = QtWidgets.QGridLayout()
24 | self.gridLayout.setObjectName("gridLayout")
25 | self.publicVerticalLayout = QtWidgets.QVBoxLayout()
26 | self.publicVerticalLayout.setObjectName("publicVerticalLayout")
27 | self.addPublicPushButton = QtWidgets.QPushButton(MainWindow)
28 | self.addPublicPushButton.setObjectName("addPublicPushButton")
29 | self.publicVerticalLayout.addWidget(self.addPublicPushButton)
30 | self.removePublicPushButton = QtWidgets.QPushButton(MainWindow)
31 | self.removePublicPushButton.setObjectName("removePublicPushButton")
32 | self.publicVerticalLayout.addWidget(self.removePublicPushButton)
33 | spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
34 | self.publicVerticalLayout.addItem(spacerItem)
35 | self.gridLayout.addLayout(self.publicVerticalLayout, 1, 2, 1, 1)
36 | self.authListView = QtWidgets.QListView(MainWindow)
37 | self.authListView.setObjectName("authListView")
38 | self.gridLayout.addWidget(self.authListView, 0, 0, 1, 1)
39 | self.authVerticalLayout = QtWidgets.QVBoxLayout()
40 | self.authVerticalLayout.setObjectName("authVerticalLayout")
41 | self.addAuthPushButton = QtWidgets.QPushButton(MainWindow)
42 | self.addAuthPushButton.setObjectName("addAuthPushButton")
43 | self.authVerticalLayout.addWidget(self.addAuthPushButton)
44 | self.removeAuthPushButton = QtWidgets.QPushButton(MainWindow)
45 | self.removeAuthPushButton.setObjectName("removeAuthPushButton")
46 | self.authVerticalLayout.addWidget(self.removeAuthPushButton)
47 | spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
48 | self.authVerticalLayout.addItem(spacerItem1)
49 | self.gridLayout.addLayout(self.authVerticalLayout, 0, 2, 1, 1)
50 | self.publicListView = QtWidgets.QListView(MainWindow)
51 | self.publicListView.setObjectName("publicListView")
52 | self.gridLayout.addWidget(self.publicListView, 1, 0, 1, 1)
53 | self.reinitPushButton = QtWidgets.QPushButton(MainWindow)
54 | self.reinitPushButton.setObjectName("reinitPushButton")
55 | self.gridLayout.addWidget(self.reinitPushButton, 2, 2, 1, 1)
56 | self.verticalLayout.addLayout(self.gridLayout)
57 |
58 | self.retranslateUi(MainWindow)
59 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
60 |
61 | def retranslateUi(self, MainWindow):
62 | MainWindow.setWindowTitle(QtWidgets.QApplication.translate("MainWindow", "account manager", None, -1))
63 | self.addPublicPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "add", None, -1))
64 | self.removePublicPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "remove", None, -1))
65 | self.addAuthPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "add", None, -1))
66 | self.removeAuthPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "remove", None, -1))
67 | self.reinitPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "re-initialize\n"
68 | "collections", None, -1))
69 |
70 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/accountsmanager_ui.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'accountsmanager.ui'
4 | #
5 | # Created: Sat Jan 13 23:24:24 2018
6 | # by: pyside2-uic running on PySide2 2.0.0~alpha0
7 | #
8 | # WARNING! All changes made in this file will be lost!
9 |
10 | from PySide2 import QtCore, QtGui, QtWidgets
11 |
12 | class Ui_MainWindow(object):
13 | def setupUi(self, MainWindow):
14 | MainWindow.setObjectName("MainWindow")
15 | MainWindow.resize(488, 426)
16 | MainWindow.setStyleSheet("QWidget#MainWindow {\n"
17 | " background-color : rgb(78,78,78)\n"
18 | "}")
19 | self.verticalLayout = QtWidgets.QVBoxLayout(MainWindow)
20 | self.verticalLayout.setSpacing(0)
21 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
22 | self.verticalLayout.setObjectName("verticalLayout")
23 | self.gridLayout = QtWidgets.QGridLayout()
24 | self.gridLayout.setObjectName("gridLayout")
25 | self.publicVerticalLayout = QtWidgets.QVBoxLayout()
26 | self.publicVerticalLayout.setObjectName("publicVerticalLayout")
27 | self.addPublicPushButton = QtWidgets.QPushButton(MainWindow)
28 | self.addPublicPushButton.setObjectName("addPublicPushButton")
29 | self.publicVerticalLayout.addWidget(self.addPublicPushButton)
30 | self.removePublicPushButton = QtWidgets.QPushButton(MainWindow)
31 | self.removePublicPushButton.setObjectName("removePublicPushButton")
32 | self.publicVerticalLayout.addWidget(self.removePublicPushButton)
33 | spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
34 | self.publicVerticalLayout.addItem(spacerItem)
35 | self.gridLayout.addLayout(self.publicVerticalLayout, 1, 2, 1, 1)
36 | self.authListView = QtWidgets.QListView(MainWindow)
37 | self.authListView.setObjectName("authListView")
38 | self.gridLayout.addWidget(self.authListView, 0, 0, 1, 1)
39 | self.authVerticalLayout = QtWidgets.QVBoxLayout()
40 | self.authVerticalLayout.setObjectName("authVerticalLayout")
41 | self.addAuthPushButton = QtWidgets.QPushButton(MainWindow)
42 | self.addAuthPushButton.setObjectName("addAuthPushButton")
43 | self.authVerticalLayout.addWidget(self.addAuthPushButton)
44 | self.removeAuthPushButton = QtWidgets.QPushButton(MainWindow)
45 | self.removeAuthPushButton.setObjectName("removeAuthPushButton")
46 | self.authVerticalLayout.addWidget(self.removeAuthPushButton)
47 | spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
48 | self.authVerticalLayout.addItem(spacerItem1)
49 | self.gridLayout.addLayout(self.authVerticalLayout, 0, 2, 1, 1)
50 | self.publicListView = QtWidgets.QListView(MainWindow)
51 | self.publicListView.setObjectName("publicListView")
52 | self.gridLayout.addWidget(self.publicListView, 1, 0, 1, 1)
53 | self.reinitPushButton = QtWidgets.QPushButton(MainWindow)
54 | self.reinitPushButton.setObjectName("reinitPushButton")
55 | self.gridLayout.addWidget(self.reinitPushButton, 2, 2, 1, 1)
56 | self.verticalLayout.addLayout(self.gridLayout)
57 |
58 | self.retranslateUi(MainWindow)
59 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
60 |
61 | def retranslateUi(self, MainWindow):
62 | MainWindow.setWindowTitle(QtWidgets.QApplication.translate("MainWindow", "account manager", None, -1))
63 | self.addPublicPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "add", None, -1))
64 | self.removePublicPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "remove", None, -1))
65 | self.addAuthPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "add", None, -1))
66 | self.removeAuthPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "remove", None, -1))
67 | self.reinitPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "re-initialize\n"
68 | "collections", None, -1))
69 |
70 |
--------------------------------------------------------------------------------
/python3.9libs/hpaste/accountsmanager_ui.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Form implementation generated from reading ui file 'accountsmanager.ui'
4 | #
5 | # Created: Sat Jan 13 23:24:24 2018
6 | # by: pyside2-uic running on PySide2 2.0.0~alpha0
7 | #
8 | # WARNING! All changes made in this file will be lost!
9 |
10 | from PySide2 import QtCore, QtGui, QtWidgets
11 |
12 | class Ui_MainWindow(object):
13 | def setupUi(self, MainWindow):
14 | MainWindow.setObjectName("MainWindow")
15 | MainWindow.resize(488, 426)
16 | MainWindow.setStyleSheet("QWidget#MainWindow {\n"
17 | " background-color : rgb(78,78,78)\n"
18 | "}")
19 | self.verticalLayout = QtWidgets.QVBoxLayout(MainWindow)
20 | self.verticalLayout.setSpacing(0)
21 | self.verticalLayout.setContentsMargins(0, 0, 0, 0)
22 | self.verticalLayout.setObjectName("verticalLayout")
23 | self.gridLayout = QtWidgets.QGridLayout()
24 | self.gridLayout.setObjectName("gridLayout")
25 | self.publicVerticalLayout = QtWidgets.QVBoxLayout()
26 | self.publicVerticalLayout.setObjectName("publicVerticalLayout")
27 | self.addPublicPushButton = QtWidgets.QPushButton(MainWindow)
28 | self.addPublicPushButton.setObjectName("addPublicPushButton")
29 | self.publicVerticalLayout.addWidget(self.addPublicPushButton)
30 | self.removePublicPushButton = QtWidgets.QPushButton(MainWindow)
31 | self.removePublicPushButton.setObjectName("removePublicPushButton")
32 | self.publicVerticalLayout.addWidget(self.removePublicPushButton)
33 | spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
34 | self.publicVerticalLayout.addItem(spacerItem)
35 | self.gridLayout.addLayout(self.publicVerticalLayout, 1, 2, 1, 1)
36 | self.authListView = QtWidgets.QListView(MainWindow)
37 | self.authListView.setObjectName("authListView")
38 | self.gridLayout.addWidget(self.authListView, 0, 0, 1, 1)
39 | self.authVerticalLayout = QtWidgets.QVBoxLayout()
40 | self.authVerticalLayout.setObjectName("authVerticalLayout")
41 | self.addAuthPushButton = QtWidgets.QPushButton(MainWindow)
42 | self.addAuthPushButton.setObjectName("addAuthPushButton")
43 | self.authVerticalLayout.addWidget(self.addAuthPushButton)
44 | self.removeAuthPushButton = QtWidgets.QPushButton(MainWindow)
45 | self.removeAuthPushButton.setObjectName("removeAuthPushButton")
46 | self.authVerticalLayout.addWidget(self.removeAuthPushButton)
47 | spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
48 | self.authVerticalLayout.addItem(spacerItem1)
49 | self.gridLayout.addLayout(self.authVerticalLayout, 0, 2, 1, 1)
50 | self.publicListView = QtWidgets.QListView(MainWindow)
51 | self.publicListView.setObjectName("publicListView")
52 | self.gridLayout.addWidget(self.publicListView, 1, 0, 1, 1)
53 | self.reinitPushButton = QtWidgets.QPushButton(MainWindow)
54 | self.reinitPushButton.setObjectName("reinitPushButton")
55 | self.gridLayout.addWidget(self.reinitPushButton, 2, 2, 1, 1)
56 | self.verticalLayout.addLayout(self.gridLayout)
57 |
58 | self.retranslateUi(MainWindow)
59 | QtCore.QMetaObject.connectSlotsByName(MainWindow)
60 |
61 | def retranslateUi(self, MainWindow):
62 | MainWindow.setWindowTitle(QtWidgets.QApplication.translate("MainWindow", "account manager", None, -1))
63 | self.addPublicPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "add", None, -1))
64 | self.removePublicPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "remove", None, -1))
65 | self.addAuthPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "add", None, -1))
66 | self.removeAuthPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "remove", None, -1))
67 | self.reinitPushButton.setText(QtWidgets.QApplication.translate("MainWindow", "re-initialize\n"
68 | "collections", None, -1))
69 |
70 |
--------------------------------------------------------------------------------
/examples/localserver.py:
--------------------------------------------------------------------------------
1 | #
2 | # This is a simple example of a plugin that stores code on local server to allow
3 | # exchanging of short snippets while with code not leaving company's subnetwork
4 | #
5 | from __future__ import print_function, absolute_import
6 | import os
7 | import random
8 | import string
9 |
10 | from ..webclipboardbase import WebClipBoardBase, WebClipBoardWidNotFound
11 | from .. import hpasteoptions as opt
12 |
13 |
14 | # rename this class adequate to your net, this name will be the plugin name
15 | # that goes after @ in qYUs2jkq@LocalServer link
16 | class LocalServer(WebClipBoardBase):
17 | def __init__(self):
18 | # in this example all snippets will be stored in separate files in some dir
19 | # on your local network, accessible to everyone.
20 | # There is no autocleaning feature here
21 | self.__basePath = r'/tmp/some/self/cleaning/dir'
22 | self.__symbols = string.ascii_lowercase + string.ascii_uppercase + string.ascii_letters
23 |
24 | @classmethod
25 | def speedClass(cls):
26 | """
27 | returns int, speed class of your plugin.
28 | returned int value will be used for initial plugin sort.
29 | this makes more sense for internet plugins,
30 | for local ones like this one you can just put a big number here
31 | """
32 | return opt.getOption('hpasteweb.plugins.%s.speed_class' % cls.__name__, 11)
33 |
34 | @classmethod
35 | def maxStringLength(cls):
36 | """
37 | returns maximum size of one entry.
38 | in case incoming snippet is bigger than this - it will be automatically
39 | splitted into parts fitting maxStringLength() value
40 | and user will get a longer snippet link like 12345678@LocalServer#23456789@LocalServer...
41 | """
42 | # we return 10 MiB, but there is actually no point limiting snippet
43 | # since we use files to store them in this example
44 | return 10**20
45 |
46 | def genId(self, size=12):
47 | """
48 | generates id to be used in the link.
49 | you are free to embed user id, hostname or whatever you want in it
50 | """
51 | if size < 1 or size > 4096:
52 | raise RuntimeError("improper size")
53 |
54 | lsmo = len(self.__symbols) - 1
55 | for attempt in range(8): # highly improbably that we will need more than 1 attempt
56 | wid = ''.join(random.choice(self.__symbols) for _ in range(size))
57 | if not os.path.exists(os.path.join(self.__basePath, wid)):
58 | break
59 | else:
60 | raise RuntimeError('could not generate unique wid!')
61 | return wid
62 |
63 | def webPackData(self, s): # type: (str) -> str
64 | """
65 | override this from WebClipBoardBase
66 | this takes in a big string of data, already guaranteed url-safe
67 | and should do something to associate and return some short id with that data.
68 | it doesn't matter how id looks like, but it is advised to heve it url-safe as well
69 | """
70 | if not os.path.exists(self.__basePath):
71 | os.makedirs(self.__basePath)
72 | wid = self.genId()
73 | assert len(s) <= self.maxStringLength() # this is actually guaranteed by the caller
74 | try:
75 | with open(os.path.join(self.__basePath, wid), 'w') as f:
76 | f.write(s)
77 | except Exception as e:
78 | raise RuntimeError("error writing to local server: " + str(e))
79 |
80 | return wid
81 |
82 | def webUnpackData(self, wid):
83 | """
84 | given proper wid, one previously generated by webPackData,
85 | return the snippet associated with that wid
86 | """
87 | try:
88 | widpath = os.path.join(self.__basePath, wid)
89 | if not os.path.exists(widpath):
90 | raise WebClipBoardWidNotFound(wid)
91 | with open(widpath) as f:
92 | s = f.read()
93 | except Exception as e:
94 | raise RuntimeError("error reading from local server: " + str(e))
95 |
96 | return s
97 |
--------------------------------------------------------------------------------
/python3.10libs/hpaste/hpasteoptions.py:
--------------------------------------------------------------------------------
1 | """
2 | this module is responsible for providing settings for hpaste and it's plugins
3 | """
4 | import os
5 | import json
6 | import copy
7 |
8 | if __name__ == '__main__':
9 | if 'HOUDINI_USER_PREF_DIR' not in os.environ:
10 | os.environ['HOUDINI_USER_PREF_DIR'] = r'D:\tmp'
11 |
12 | settings_filename = os.path.normpath(os.path.join(os.environ.get('HOUDINI_USER_PREF_DIR', '~'), '.hpaste_options'))
13 | default_options = {'hpaste': {}, 'hpasteweb': {}}
14 |
15 | cached_data = None
16 |
17 |
18 | class NonExistingOptionError(Exception):
19 | def __init__(self, message, lastvalidname, firstinvalidname):
20 | super(NonExistingOptionError, self).__init__(message)
21 | self.namepair = (lastvalidname, firstinvalidname)
22 |
23 |
24 | class OptionTypeError(Exception):
25 | pass
26 |
27 |
28 | def _readOptionsFile(filename=settings_filename):
29 | """
30 | This funciont is supposed to be used internally
31 | :param filename:
32 | :return:
33 | """
34 | global cached_data
35 | try:
36 | with open(filename, 'r') as f:
37 | cached_data = json.load(f)
38 | except IOError: # as e:
39 | # errno,message = e.args
40 | # print("Error reading settings file, Error %d: %s"%(errno,message))
41 | # print("Using default options")
42 | if cached_data is None:
43 | cached_data = default_options
44 | return cached_data
45 |
46 |
47 | def _writeOptionFile(data, filename=settings_filename):
48 | global cached_data
49 | cached_data = data
50 | try:
51 | with open(filename, 'w') as f:
52 | json.dump(cached_data, f, indent=4)
53 | except IOError as e:
54 | errno, message = e.args
55 | print("Error writing to settings file! Error %d: %s" % (errno, message))
56 | print("settings are not saved!")
57 | return False
58 | return True
59 |
60 |
61 | def getOption(option_name, defaultval=None):
62 | data = _readOptionsFile()
63 | names = option_name.split('.')
64 | option = data
65 | namesofar = ''
66 | for name in names:
67 | try:
68 | option = option[name]
69 | namesofar += '.%s' % name
70 | except KeyError:
71 | if defaultval is None:
72 | raise NonExistingOptionError('Option %s has no suboption %s' % (namesofar, name) if len(namesofar) == 0 else "Option %s does not exist" % name, namesofar, name)
73 | else:
74 | return defaultval
75 |
76 | return copy.deepcopy(option)
77 |
78 |
79 | def setOption(option_name, value):
80 | data = _readOptionsFile()
81 |
82 | names = option_name.split('.')
83 | option = data
84 | namesofar = ''
85 | for name in names[:-1]:
86 | try:
87 | option = option[name]
88 | except KeyError:
89 | option[name] = {}
90 | option = option[name]
91 | except TypeError:
92 | raise OptionTypeError('Option %s is %s' % (namesofar, type(option).__name__))
93 |
94 | namesofar += '.%s' % name
95 |
96 | try:
97 | option[names[-1]] = value
98 | except TypeError:
99 | raise OptionTypeError('Option %s is %s' % (namesofar, type(option).__name__))
100 |
101 | _writeOptionFile(data)
102 |
103 |
104 | if __name__ == '__main__':
105 | # test
106 | from pprint import pprint
107 |
108 | pprint(getOption('hpaste'))
109 | pprint(getOption('hpasteweb'))
110 | pprint("----------")
111 | setOption('hpaste.testoption1', 132)
112 | setOption('hpaste.testsu.lolo.bebe.gof', 'sdfq')
113 | pprint(getOption('hpaste'))
114 | pprint(getOption('hpaste.testoption1'))
115 | pprint(getOption('hpaste.testsu'))
116 | pprint(getOption('hpaste.testsu.lolo'))
117 | pprint(getOption('hpaste.testsu.lolo.bebe'))
118 | pprint(getOption('hpaste.testsu.lolo.bebe.gof'))
119 | pprint("-----------")
120 | pprint(getOption('hpaste.testsu.lolo.bebe.gos', 'default'))
121 | pprint(getOption('hpasteweb.cbin.speed_class', 4))
122 |
--------------------------------------------------------------------------------
/python3.11libs/hpaste/hpasteoptions.py:
--------------------------------------------------------------------------------
1 | """
2 | this module is responsible for providing settings for hpaste and it's plugins
3 | """
4 | import os
5 | import json
6 | import copy
7 |
8 | if __name__ == '__main__':
9 | if 'HOUDINI_USER_PREF_DIR' not in os.environ:
10 | os.environ['HOUDINI_USER_PREF_DIR'] = r'D:\tmp'
11 |
12 | settings_filename = os.path.normpath(os.path.join(os.environ.get('HOUDINI_USER_PREF_DIR', '~'), '.hpaste_options'))
13 | default_options = {'hpaste': {}, 'hpasteweb': {}}
14 |
15 | cached_data = None
16 |
17 |
18 | class NonExistingOptionError(Exception):
19 | def __init__(self, message, lastvalidname, firstinvalidname):
20 | super(NonExistingOptionError, self).__init__(message)
21 | self.namepair = (lastvalidname, firstinvalidname)
22 |
23 |
24 | class OptionTypeError(Exception):
25 | pass
26 |
27 |
28 | def _readOptionsFile(filename=settings_filename):
29 | """
30 | This funciont is supposed to be used internally
31 | :param filename:
32 | :return:
33 | """
34 | global cached_data
35 | try:
36 | with open(filename, 'r') as f:
37 | cached_data = json.load(f)
38 | except IOError: # as e:
39 | # errno,message = e.args
40 | # print("Error reading settings file, Error %d: %s"%(errno,message))
41 | # print("Using default options")
42 | if cached_data is None:
43 | cached_data = default_options
44 | return cached_data
45 |
46 |
47 | def _writeOptionFile(data, filename=settings_filename):
48 | global cached_data
49 | cached_data = data
50 | try:
51 | with open(filename, 'w') as f:
52 | json.dump(cached_data, f, indent=4)
53 | except IOError as e:
54 | errno, message = e.args
55 | print("Error writing to settings file! Error %d: %s" % (errno, message))
56 | print("settings are not saved!")
57 | return False
58 | return True
59 |
60 |
61 | def getOption(option_name, defaultval=None):
62 | data = _readOptionsFile()
63 | names = option_name.split('.')
64 | option = data
65 | namesofar = ''
66 | for name in names:
67 | try:
68 | option = option[name]
69 | namesofar += '.%s' % name
70 | except KeyError:
71 | if defaultval is None:
72 | raise NonExistingOptionError('Option %s has no suboption %s' % (namesofar, name) if len(namesofar) == 0 else "Option %s does not exist" % name, namesofar, name)
73 | else:
74 | return defaultval
75 |
76 | return copy.deepcopy(option)
77 |
78 |
79 | def setOption(option_name, value):
80 | data = _readOptionsFile()
81 |
82 | names = option_name.split('.')
83 | option = data
84 | namesofar = ''
85 | for name in names[:-1]:
86 | try:
87 | option = option[name]
88 | except KeyError:
89 | option[name] = {}
90 | option = option[name]
91 | except TypeError:
92 | raise OptionTypeError('Option %s is %s' % (namesofar, type(option).__name__))
93 |
94 | namesofar += '.%s' % name
95 |
96 | try:
97 | option[names[-1]] = value
98 | except TypeError:
99 | raise OptionTypeError('Option %s is %s' % (namesofar, type(option).__name__))
100 |
101 | _writeOptionFile(data)
102 |
103 |
104 | if __name__ == '__main__':
105 | # test
106 | from pprint import pprint
107 |
108 | pprint(getOption('hpaste'))
109 | pprint(getOption('hpasteweb'))
110 | pprint("----------")
111 | setOption('hpaste.testoption1', 132)
112 | setOption('hpaste.testsu.lolo.bebe.gof', 'sdfq')
113 | pprint(getOption('hpaste'))
114 | pprint(getOption('hpaste.testoption1'))
115 | pprint(getOption('hpaste.testsu'))
116 | pprint(getOption('hpaste.testsu.lolo'))
117 | pprint(getOption('hpaste.testsu.lolo.bebe'))
118 | pprint(getOption('hpaste.testsu.lolo.bebe.gof'))
119 | pprint("-----------")
120 | pprint(getOption('hpaste.testsu.lolo.bebe.gos', 'default'))
121 | pprint(getOption('hpasteweb.cbin.speed_class', 4))
122 |
--------------------------------------------------------------------------------
/python3.7libs/hpaste/hpasteoptions.py:
--------------------------------------------------------------------------------
1 | """
2 | this module is responsible for providing settings for hpaste and it's plugins
3 | """
4 | import os
5 | import json
6 | import copy
7 |
8 | if __name__ == '__main__':
9 | if 'HOUDINI_USER_PREF_DIR' not in os.environ:
10 | os.environ['HOUDINI_USER_PREF_DIR'] = r'D:\tmp'
11 |
12 | settings_filename = os.path.normpath(os.path.join(os.environ.get('HOUDINI_USER_PREF_DIR', '~'), '.hpaste_options'))
13 | default_options = {'hpaste': {}, 'hpasteweb': {}}
14 |
15 | cached_data = None
16 |
17 |
18 | class NonExistingOptionError(Exception):
19 | def __init__(self, message, lastvalidname, firstinvalidname):
20 | super(NonExistingOptionError, self).__init__(message)
21 | self.namepair = (lastvalidname, firstinvalidname)
22 |
23 |
24 | class OptionTypeError(Exception):
25 | pass
26 |
27 |
28 | def _readOptionsFile(filename=settings_filename):
29 | """
30 | This funciont is supposed to be used internally
31 | :param filename:
32 | :return:
33 | """
34 | global cached_data
35 | try:
36 | with open(filename, 'r') as f:
37 | cached_data = json.load(f)
38 | except IOError: # as e:
39 | # errno,message = e.args
40 | # print("Error reading settings file, Error %d: %s"%(errno,message))
41 | # print("Using default options")
42 | if cached_data is None:
43 | cached_data = default_options
44 | return cached_data
45 |
46 |
47 | def _writeOptionFile(data, filename=settings_filename):
48 | global cached_data
49 | cached_data = data
50 | try:
51 | with open(filename, 'w') as f:
52 | json.dump(cached_data, f, indent=4)
53 | except IOError as e:
54 | errno, message = e.args
55 | print("Error writing to settings file! Error %d: %s" % (errno, message))
56 | print("settings are not saved!")
57 | return False
58 | return True
59 |
60 |
61 | def getOption(option_name, defaultval=None):
62 | data = _readOptionsFile()
63 | names = option_name.split('.')
64 | option = data
65 | namesofar = ''
66 | for name in names:
67 | try:
68 | option = option[name]
69 | namesofar += '.%s' % name
70 | except KeyError:
71 | if defaultval is None:
72 | raise NonExistingOptionError('Option %s has no suboption %s' % (namesofar, name) if len(namesofar) == 0 else "Option %s does not exist" % name, namesofar, name)
73 | else:
74 | return defaultval
75 |
76 | return copy.deepcopy(option)
77 |
78 |
79 | def setOption(option_name, value):
80 | data = _readOptionsFile()
81 |
82 | names = option_name.split('.')
83 | option = data
84 | namesofar = ''
85 | for name in names[:-1]:
86 | try:
87 | option = option[name]
88 | except KeyError:
89 | option[name] = {}
90 | option = option[name]
91 | except TypeError:
92 | raise OptionTypeError('Option %s is %s' % (namesofar, type(option).__name__))
93 |
94 | namesofar += '.%s' % name
95 |
96 | try:
97 | option[names[-1]] = value
98 | except TypeError:
99 | raise OptionTypeError('Option %s is %s' % (namesofar, type(option).__name__))
100 |
101 | _writeOptionFile(data)
102 |
103 |
104 | if __name__ == '__main__':
105 | # test
106 | from pprint import pprint
107 |
108 | pprint(getOption('hpaste'))
109 | pprint(getOption('hpasteweb'))
110 | pprint("----------")
111 | setOption('hpaste.testoption1', 132)
112 | setOption('hpaste.testsu.lolo.bebe.gof', 'sdfq')
113 | pprint(getOption('hpaste'))
114 | pprint(getOption('hpaste.testoption1'))
115 | pprint(getOption('hpaste.testsu'))
116 | pprint(getOption('hpaste.testsu.lolo'))
117 | pprint(getOption('hpaste.testsu.lolo.bebe'))
118 | pprint(getOption('hpaste.testsu.lolo.bebe.gof'))
119 | pprint("-----------")
120 | pprint(getOption('hpaste.testsu.lolo.bebe.gos', 'default'))
121 | pprint(getOption('hpasteweb.cbin.speed_class', 4))
122 |
--------------------------------------------------------------------------------