repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
DmPo/Schemaorg_CivicOS
lib/html5lib/tests/__init__.py
import sys import os parent_path = os.path.abspath(os.path.join(os.path.split(__file__)[0], "..")) if not parent_path in sys.path: sys.path.insert(0, parent_path) del parent_path from runtests import buildTestSuite import support
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/pyRdfa/transform/__init__.py
# -*- coding: utf-8 -*- """ Transformer sub-package for the pyRdfa package. It contains modules with transformer functions; each may be invoked by pyRdfa to transform the dom tree before the "real" RDfa processing. @summary: RDFa Transformer package @requires: U{RDFLib package<http://rdflib.net>} @organization: U{Worl...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/sparql/aggregates.py
from rdflib import Literal, XSD from rdflib.plugins.sparql.evalutils import _eval from rdflib.plugins.sparql.operators import numeric from rdflib.plugins.sparql.datatypes import type_promotion from rdflib.plugins.sparql.compat import num_max, num_min from decimal import Decimal """ Aggregation functions """ def _...
DmPo/Schemaorg_CivicOS
lib/html5lib/tests/test_whitespace_filter.py
<reponame>DmPo/Schemaorg_CivicOS import unittest from html5lib.filters.whitespace import Filter from html5lib.constants import spaceCharacters spaceCharacters = u"".join(spaceCharacters) class TestCase(unittest.TestCase): def runTest(self, input, expected): output = list(Filter(input)) errorMsg = ...
DmPo/Schemaorg_CivicOS
lib/html5lib/__init__.py
""" HTML parsing library based on the WHATWG "HTML5" specification. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage: import html5lib f = open("my_document.html") tree = h...
DmPo/Schemaorg_CivicOS
lib/isodate/tzinfo.py
<reponame>DmPo/Schemaorg_CivicOS ''' This module provides some datetime.tzinfo implementations. All those classes are taken from the Python documentation. ''' from datetime import timedelta, tzinfo import time ZERO = timedelta(0) # constant for zero time offset. class Utc(tzinfo): '''UTC Universal ...
DmPo/Schemaorg_CivicOS
lib/html5lib/tests/test_encoding.py
<reponame>DmPo/Schemaorg_CivicOS import os import unittest from support import html5lib_test_files, TestData, test_dir from html5lib import HTMLParser, inputstream import re, unittest class Html5EncodingTestCase(unittest.TestCase): def test_codec_name(self): self.assertEquals(inputstream.codecName("utf-8...
DmPo/Schemaorg_CivicOS
lib/rdflib_jsonld/util.py
try: import json assert json # workaround for pyflakes issue #13 except ImportError: import simplejson as json from rdflib.py3compat import PY3 from os import sep from os.path import normpath if PY3: from urllib.parse import urljoin, urlsplit, urlunsplit else: from urlparse import urljoin, urlspl...
DmPo/Schemaorg_CivicOS
api.py
<reponame>DmPo/Schemaorg_CivicOS #!/usr/bin/env python # -*- coding: UTF-8 -*- import logging logging.basicConfig(level=logging.INFO) # dev_appserver.py --log_level debug . log = logging.getLogger(__name__) import os import os.path import glob import re import threading import parsers import datetime, time from goo...
DmPo/Schemaorg_CivicOS
apirdflib.py
<reponame>DmPo/Schemaorg_CivicOS #!/usr/bin/env python # -*- coding: UTF-8 -*- import logging logging.basicConfig(level=logging.INFO) # dev_appserver.py --log_level debug . log = logging.getLogger(__name__) import sys sys.path.append('lib') import rdflib from rdflib import Literal from rdflib.term import URIRef from ...
DmPo/Schemaorg_CivicOS
scripts/scanissues.py
<reponame>DmPo/Schemaorg_CivicOS<filename>scripts/scanissues.py #!/usr/bin/env python # https://developer.github.com/v3/issues/ # https://developer.github.com/v3/repos/ # GET /repos/:owner/:repo/issues # Beginning of script to scan github for issue/term associations. # Note: https://developer.github.com/v3/#rate-lim...
DmPo/Schemaorg_CivicOS
lib/html5lib/tests/test_formfiller.py
<filename>lib/html5lib/tests/test_formfiller.py import sys import unittest from html5lib.filters.formfiller import SimpleFilter class FieldStorage(dict): def getlist(self, name): l = self[name] if isinstance(l, list): return l elif isinstance(l, tuple) or hasattr(l, '__iter__')...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/pyRdfa/property.py
<filename>lib/rdflib/plugins/parsers/pyRdfa/property.py # -*- coding: utf-8 -*- """ Implementation of the C{@property} value handling. RDFa 1.0 and RDFa 1.1 are fairly different. RDFa 1.0 generates only literals, see U{RDFa Task Force's wiki page<http://www.w3.org/2006/07/SWD/wiki/RDFa/LiteralObject>} for the details....
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/sparql/update.py
<filename>lib/rdflib/plugins/sparql/update.py """ Code for carrying out Update Operations """ from rdflib import Graph, Variable from rdflib.plugins.sparql.sparql import QueryContext from rdflib.plugins.sparql.evalutils import _fillTemplate, _join from rdflib.plugins.sparql.evaluate import evalBGP, evalPart def _...
DmPo/Schemaorg_CivicOS
lib/html5lib/filters/inject_meta_charset.py
<reponame>DmPo/Schemaorg_CivicOS<filename>lib/html5lib/filters/inject_meta_charset.py import _base class Filter(_base.Filter): def __init__(self, source, encoding): _base.Filter.__init__(self, source) self.encoding = encoding def __iter__(self): state = "pre_head" meta_found = ...
DmPo/Schemaorg_CivicOS
lib/rdflib_jsonld/__init__.py
""" """ __version__ = "0.3-dev"
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/nquads.py
""" This is a rdflib plugin for parsing NQuad files into Conjunctive graphs that can be used and queried. The store that backs the graph *must* be able to handle contexts. >>> from rdflib import ConjunctiveGraph, URIRef, Namespace >>> g = ConjunctiveGraph() >>> data = open("test/nquads.rdflib/example.nquads", "rb") >>...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/pyRdfa/host/atom.py
<reponame>DmPo/Schemaorg_CivicOS # -*- coding: utf-8 -*- """ Simple transfomer for Atom: the C{@typeof=""} is added to the C{<entry>} element (unless something is already there). @summary: Add a top "about" to <head> and <body> @requires: U{RDFLib package<http://rdflib.net>} @organization: U{World Wide Web Consortium<...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/pyRdfa/transform/lite.py
<filename>lib/rdflib/plugins/parsers/pyRdfa/transform/lite.py # -*- coding: utf-8 -*- """ @author: U{<NAME><a href="http://www.w3.org/People/Ivan/">} @license: This software is available for use under the U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">} @c...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/pyRdfa/rdfs/__init__.py
<filename>lib/rdflib/plugins/parsers/pyRdfa/rdfs/__init__.py # -*- coding: utf-8 -*- """ Separate module to handle vocabulary expansions. The L{cache} module takes care of caching vocabulary graphs; the L{process} module takes care of the expansion itself. @organization: U{World Wide Web Consortium<http://www.w3.org>}...
DmPo/Schemaorg_CivicOS
scripts/acks.py
#!/usr/bin/env python import sys import re # Takes a list of property URLs and generates property-acks.rdfa markup string = "" with open(sys.argv[1], 'r') as file: for line in file.readlines(): if re.match("^\s",line): pass else: line = line.rstrip("\n") strin...
DmPo/Schemaorg_CivicOS
lib/rdflib/tools/rdfs2dot.py
<reponame>DmPo/Schemaorg_CivicOS """ A commandline tool for drawing RDFS Class diagrams in Graphviz DOT format You can draw the graph of an RDFS file directly: .. code-block: bash rdf2dot my_rdfs_file.rdf | dot -Tpng | display """ import rdflib.extras.cmdlineutils import sys import itertools import collections ...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/pyRdfa/embeddedRDF.py
# -*- coding: utf-8 -*- """ Extracting possible embedded RDF/XML content from the file and parse it separately into the Graph. This is used, for example by U{SVG 1.2 Tiny<http://www.w3.org/TR/SVGMobile12/>}. @author: U{<NAME><a href="http://www.w3.org/People/Ivan/">} @license: This software is available for use under ...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/sparql/compat.py
""" Function/methods to help supporting 2.5-2.7 """ # Collection ABCs try: from collections import Mapping, MutableMapping # was added in 2.6 except: from UserDict import DictMixin class MutableMapping(DictMixin): def keys(self): return list(self) Mapping = MutableMapping # O...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/trix.py
""" A TriX parser for RDFLib """ from rdflib.namespace import Namespace from rdflib.term import URIRef from rdflib.term import BNode from rdflib.term import Literal from rdflib.graph import Graph, ConjunctiveGraph from rdflib.exceptions import ParserError from rdflib.parser import Parser from xml.sax.saxutils import h...
DmPo/Schemaorg_CivicOS
lib/html5lib/tests/test_serializer.py
<reponame>DmPo/Schemaorg_CivicOS import os import unittest from support import html5lib_test_files try: import json except ImportError: import simplejson as json import html5lib from html5lib import html5parser, serializer, constants from html5lib.treewalkers._base import TreeWalker optionals_loaded = [] tr...
DmPo/Schemaorg_CivicOS
lib/rdflib/extras/describer.py
<reponame>DmPo/Schemaorg_CivicOS #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import with_statement from rdflib import py3compat __doc__ = py3compat.format_doctest_out(""" A Describer is a stateful utility for creating RDF statements in a semi-declarative manner. It has methods for creating literal val...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/parsers/pyRdfa/rdfs/process.py
<reponame>DmPo/Schemaorg_CivicOS # -*- coding: utf-8 -*- """ @organization: U{World Wide Web Consortium<http://www.w3.org>} @author: U{<NAME><a href="http://www.w3.org/People/Ivan/">} @license: This software is available for use under the U{W3C® SOFTWARE NOTICE AND LICENSE<href="http://www.w3.org/Consortium/Legal/2002/...
DmPo/Schemaorg_CivicOS
lib/rdflib/parser.py
<gh_stars>1-10 """ Parser plugin interface. This module defines the parser plugin interface and contains other related parser support code. The module is mainly useful for those wanting to write a parser that can plugin to rdflib. If you are wanting to invoke a parser you likely want to do so through the Graph class ...
DmPo/Schemaorg_CivicOS
lib/rdflib/tools/graphisomorphism.py
<reponame>DmPo/Schemaorg_CivicOS """ A commandline tool for testing if RDF graphs are isomorpic, i.e. equal if BNode labels are ignored. """ from rdflib.graph import Graph from rdflib import BNode try: from itertools import combinations assert combinations except ImportError: # Python == 2.5 # Copied from...
DmPo/Schemaorg_CivicOS
lib/isodate/tests/test_date.py
############################################################################## # Copyright 2009, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must r...
DmPo/Schemaorg_CivicOS
lib/rdflib/compat.py
<gh_stars>1-10 # # code to simplify supporting older python versions # import sys from decimal import Decimal if sys.version_info[:2] < (2, 7): # Pre-2.7 decimal and float did not compare correctly def numeric_greater(a, b): if isinstance(a, Decimal) and isinstance(b, float): return fl...
DmPo/Schemaorg_CivicOS
lib/rdflib/plugins/serializers/nt.py
<filename>lib/rdflib/plugins/serializers/nt.py """ N-Triples RDF graph serializer for RDFLib. See <http://www.w3.org/TR/rdf-testcases/#ntriples> for details about the format. """ from rdflib.term import Literal from rdflib.serializer import Serializer from rdflib.py3compat import b import warnings __all__ = ['NTSerial...
DmPo/Schemaorg_CivicOS
lib/isodate/__init__.py
############################################################################## # Copyright 2009, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must r...
DmPo/Schemaorg_CivicOS
lib/rdflib_jsonld/context.py
# -*- coding: utf-8 -*- """ Implementation of the JSON-LD Context structure. See: http://json-ld.org/ """ from rdflib.namespace import RDF from .util import source_to_json, urljoin, split_iri, norm_url from .keys import (BASE, CONTAINER, CONTEXT, GRAPH, ID, INDEX, LANG, LIST, REV, SET, TYPE, VALUE, VOCAB...
DmPo/Schemaorg_CivicOS
lib/rdflib_jsonld/parser.py
<gh_stars>1-10 # -*- coding: utf-8 -*- """ This parser will interpret a JSON-LD document as an RDF Graph. See: http://json-ld.org/ Example usage:: >>> from rdflib.plugin import register, Parser >>> register('json-ld', Parser, 'rdflib_jsonld.parser', 'JsonLDParser') >>> from rdflib import Graph, URIR...
DmPo/Schemaorg_CivicOS
scripts/vocab_counts.py
<reponame>DmPo/Schemaorg_CivicOS # The file containing the actual counts is not checked in. # This file has the script for bucketizing the counts import sys def vocab_term (term) : parts = term.split('/', 4) if (len(parts) < 4) : return None domain = parts[2] if (not (domain == "schema.org"))...
DmPo/Schemaorg_CivicOS
lib/rdflib/query.py
import os import shutil import tempfile import warnings import types from urlparse import urlparse try: from io import BytesIO assert BytesIO except: from StringIO import StringIO as BytesIO from . import py3compat __all__ = ['Processor', 'Result', 'ResultParser', 'ResultSerializer', 'ResultE...
DmPo/Schemaorg_CivicOS
lib/html5lib/tests/runparsertests.py
import sys import os import glob import unittest #Allow us to import the parent module os.chdir(os.path.split(os.path.abspath(__file__))[0]) sys.path.insert(0, os.path.abspath(os.curdir)) sys.path.insert(0, os.path.abspath(os.pardir)) sys.path.insert(0, os.path.join(os.path.abspath(os.pardir), "src")) def buildTestSu...
DiscordDigital/ui.py
ui.py
import curses import collections import sys import os from time import sleep # File syntax # # When there's not enough space for all elements UI will go into scroll mode # # Syntax: # script.py ui_example.txt # # an object is one line, split by ; # The first part is the Name the second part is the shell action # Use t...
jacobbieker/DataMining_Jaccard
main.py
import numpy as np import sys import scipy.sparse as sparse import itertools def minhashing(csc_matrix, num_users, num_movies): """ Does the minhashing on a CSC sparse matrix, returning the dense signature matrix :param csc_matrix: CSC matrix with movies as rows, and users and columns :param num_users...
10-15-5/Crypto-Trader
trader-no-fstrings.py
<reponame>10-15-5/Crypto-Trader import cbpro import os import logging import time import configparser import sys import smtplib import math from binance.client import Client from binance.exceptions import BinanceAPIException, BinanceOrderException from binance.enums import * from email.mime.text import MIMEText from ...
jinjamator/jinjamator-plugin-content-ssh
jinjamator/plugins/content/ssh/__init__.py
# Copyright 2019 <NAME> # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softwar...
yukitheclown/io_scene_yuk
__init__.py
<reponame>yukitheclown/io_scene_yuk bl_info = { "name": "Yuk2 format", "author": "yukizini", "version": (0, 0, 0), "blender": (2, 74, 0), "location": "File > Export, Scene properties", "description": "Export yuk2", "wiki_url": "http://github.com/yukizini", "category": "Export", } if "bpy" in locals(): import ...
yukitheclown/io_scene_yuk
export_yuk2.py
<reponame>yukitheclown/io_scene_yuk import os import struct import shutil import zlib import bpy import mathutils import bpy_extras.io_utils def GetMesh(obj, context, GLOBAL_MATRIX): mesh = None try: mesh = obj.to_mesh(context.scene, False, 'PREVIEW', calc_tessface=False) except RuntimeError: return if GLOB...
AlvarDev/Cloud-SQL-Connection
main.py
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
gguilherme42/conceitos_de_LP
cap_2/exercicios_de_programacao/e003/multiplica_matriz_com_laco_logico.py
<gh_stars>0 class Matrix(): def __init__(self, matrix: list[list[int]]) -> None: self.columns = len(matrix[0]) if matrix else 0 self.lines = len(matrix) self.elements = matrix matrix_A = Matrix([[2, 3, 1], [-1, 0, 2]]) matrix_B = Matrix([ [1,-2], [0,5...
gguilherme42/conceitos_de_LP
cap_2/exercicios_de_programacao/e002/quicksort.py
from random import randint import quicksort_recursivo def partition(input_list: list, start: int, end: int) -> int: pivot_element = input_list[end] i = start for j in range(start, end): if input_list[j] <= pivot_element: input_list[j], input_list[i] = input_list[i], input_list[...
gguilherme42/conceitos_de_LP
cap_2/exercicios_de_programacao/e001/exercicio_com_registros.py
name = input("Student name: ").strip().lower() age = int(input(f"{name}'s age: ")) average = float(input(f"{name}'s average: ")) level = input(f"{name}'s level: ") student_data = [name, age, average, level] print(student_data)
gguilherme42/conceitos_de_LP
cap_2/exercicios_de_programacao/e002/quicksort_recursivo.py
<reponame>gguilherme42/conceitos_de_LP from random import randint def partition(input_list: list, start: int, end: int) -> int: pivot_element = input_list[end] i = start for j in range(start, end): if input_list[j] <= pivot_element: input_list[j], input_list[i] = inp...
ShawnTanzc/CG4002-Capstone-B15
external_comms/ultra96/publish.py
# publish.py import pika, os import ssl import json # Access the CLODUAMQP_URL environment variable and parse it (fallback to localhost) url = 'INSERT URL' params = pika.URLParameters(url) connection = pika.BlockingConnection(params) channel = connection.channel() # start a channel #channel.exchange_declare('test_exc...
ShawnTanzc/CG4002-Capstone-B15
external_comms/Others/eval_server/eval_server.py
# Changing the actions in self.actions should automatically change the script to function with the new number of moves. # Developed and improved by past CG4002 TAs and students: <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME> import os import sys import time import traceback import random import sock...
ShawnTanzc/CG4002-Capstone-B15
external_comms/ultra96/server_L2.py
import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print("Waiting for connection....") s.bind(('localhost', 15430)) s.listen() connection, address = s.accept() print("Connected to client") with connection: print(f"Connected by {address}") while True: buf = connection.recv(1024) ...
ShawnTanzc/CG4002-Capstone-B15
external_comms/ultra96/consume.py
<filename>external_comms/ultra96/consume.py # consume.py import pika, os # import requests module import requests import json # Access the CLODUAMQP_URL environment variable and parse it (fallback to localhost) url = 'INSERT URL' params = pika.URLParameters(url) connection = pika.BlockingConnection(params) channel =...
ShawnTanzc/CG4002-Capstone-B15
external_comms/laptop_1/client_L1.py
import paramiko from paramiko import SSHClient, AutoAddPolicy def sshCommand(hostname, port, username, password, command): sshClient = paramiko.SSHClient() sshClient.set_missing_host_key_policy(paramiko.AutoAddPolicy()) sshClient.load_system_host_keys() sshClient.connect(hostname, port, username, passw...
yjg30737/pyqt-capturer
setup.py
<gh_stars>0 from setuptools import setup, find_packages setup( name='pyqt-capturer', version='0.2.0', author='<NAME>', author_email='<EMAIL>', license='MIT', packages=find_packages(), package_data={'pyqt_capturer.ico': ['cam.svg', 'capture.svg', 'settings.svg', 'video.svg']}, descriptio...
yjg30737/pyqt-capturer
pyqt_capturer/settingsDialog.py
from PyQt5.QtGui import QColor from PyQt5.QtWidgets import QDialog, QFormLayout, QWidget, QPushButton, QVBoxLayout, QHBoxLayout, QGroupBox from PyQt5.QtCore import Qt, QSettings from pyqt_color_button import ColorButton from pyqt_color_picker import ColorPickerDialog from pyqt_find_path_widget import FindPathWidget c...
yjg30737/pyqt-capturer
pyqt_capturer/__init__.py
<reponame>yjg30737/pyqt-capturer from .capturer import Capturer from .settingsDialog import SettingsDialog
yjg30737/pyqt-capturer
pyqt_capturer/capturer.py
import threading, time, os, cv2 import numpy as np import mss import mss.tools from PyQt5.QtCore import Qt, QSettings from PyQt5.QtGui import QFont, QWindow from PyQt5.QtWidgets import QMainWindow, QDialog from pyqt_timer_label import TimerLabel from pyqt_transparent_centralwidget_window import TransparentCentralWidg...
valgur/GIMP-ML-Hub
plugins/deblur.py
<filename>plugins/deblur.py #!/usr/bin/env python2 import sys from os.path import dirname, realpath sys.path.append(realpath(dirname(__file__))) from gimpfu import main from _plugin_base import GimpPluginBase class Deblur(GimpPluginBase): def run(self): self.model_file = 'DeblurGANv2.py' result =...
valgur/GIMP-ML-Hub
models/_util.py
<reponame>valgur/GIMP-ML-Hub def to_rgb(image): if len(image.shape) == 2: image = image[:, :, None] return image[:, :, (0, 0, 0)] def apply_colormap(image, cmap='magma'): # image must be in 0-1 range import matplotlib.cm as cm mapper = cm.ScalarMappable(norm=lambda x: x, cmap=cmap) ret...
valgur/GIMP-ML-Hub
plugins/facegen.py
#!/usr/bin/env python2 import sys from os.path import dirname, realpath sys.path.append(realpath(dirname(__file__))) import gimpfu as gfu from gimpfu import main from _plugin_base import GimpPluginBase class FaceGen(GimpPluginBase): def run(self, img_layer, mask_layer, mask_m_layer): self.model_file = 'M...
valgur/GIMP-ML-Hub
plugins/monocular_depth.py
<filename>plugins/monocular_depth.py #!/usr/bin/env python2 import sys from os.path import dirname, realpath sys.path.append(realpath(dirname(__file__))) import gimpfu as gfu from _plugin_base import GimpPluginBase class DepthEstimation(GimpPluginBase): model_options = [ ("MiDaS (778 MB)", "MiDaS.py"), ...
valgur/GIMP-ML-Hub
plugins/super_resolution.py
#!/usr/bin/env python2 import sys from os.path import dirname, realpath sys.path.append(realpath(dirname(__file__))) from gimpfu import main, pdb from _plugin_base import GimpPluginBase class SuperResolution(GimpPluginBase): def run(self): self.model_file = 'SRResNet.py' result = self.predict(sel...
valgur/GIMP-ML-Hub
models/Monodepth2.py
import sys import numpy as np import torch import torch.hub from PIL import Image from torchvision import transforms from _model_base import ModelBase, handle_alpha from _util import to_rgb, apply_colormap class Monodepth2(ModelBase): def __init__(self): super().__init__() self.hub_repo = "valgu...
valgur/GIMP-ML-Hub
tests/test.py
#!/usr/bin/python import traceback from gimpfu import pdb, gimp import gimpfu as gfu infile = "test.jpg" outfile = "out.png" try: image = pdb.gimp_file_load(infile, infile, run_mode=gfu.RUN_NONINTERACTIVE) # w = 200 # h = round(w * image.height / float(image.width)) # pdb.gimp_image_scale(image, w, h)...
valgur/GIMP-ML-Hub
models/MiDaS.py
import sys import numpy as np import torch import torch.hub from PIL import Image from torchvision.transforms import Compose from _model_base import ModelBase, handle_alpha from _util import apply_colormap, to_rgb # Simplified transforms from # https://github.com/intel-isl/MiDaS/blob/master/models/transforms.py cla...
valgur/GIMP-ML-Hub
plugins/colorize.py
<reponame>valgur/GIMP-ML-Hub #!/usr/bin/env python2 import sys from os.path import dirname, realpath sys.path.append(realpath(dirname(__file__))) from gimpfu import main, pdb import gimpfu as gfu from _plugin_base import GimpPluginBase class Colorize(GimpPluginBase): def run(self): self.model_file = 'Neu...
chaveza6870/tsu
tsu/env_map.py
import os from pathlib import Path import attr import consolejs import tsu from . import user_utils from . import consts #@autowire(UserUtils) class EnvMap: _ENV_CLEAN_BASE = {"ANDROID_DATA": "/data", "ANDROID_ROOT": "/system"} _ENV_CLEAN_BASE_COPY = ["EXTERNAL_STORAGE", "LANG", "TERM"] _ENV_CLEAN_OTH...
chaveza6870/tsu
lint.py
import subprocess args = [ 'black', 'tsu/', 'tests/' ] subprocess.run(args)
chaveza6870/tsu
tests/test_env.py
<reponame>chaveza6870/tsu import pytest from unittest.mock import Mock, patch from tsu.get_shell import GetShell TERMUX_ID = 100972 class MockPath: @staticmethod def home(): return "/data/data/com.termux/files/home" class TestTodos(object): @classmethod def setup_class(cls): cls.mo...
chaveza6870/tsu
tsu/main.py
<gh_stars>1-10 # Copyright (c) 2019, <NAME> <<EMAIL> # This software is licensed under the MIT Liscense. # https://github.com/cswl/tsu/blob/v3.x/LICENSE-MIT import os import sys import os import pwd from pathlib import Path, PurePath from docopt import docopt import consolejs import tsu from tsu import consts from...
chaveza6870/tsu
tsu/defs.py
<reponame>chaveza6870/tsu<gh_stars>1-10 from .SuBinary import SuBinary magisk = SuBinary( name="MAGISK", argmap={"init": "su", "shell": "-s"}, verstring=r"MAGISKSU", veropt=["su", "--version"], path="/sbin/magisk", ) losu = SuBinary( name="MAGISK", argmap={"shell": "-s"}, verstring=r"c...
chaveza6870/tsu
tsu/user_utils.py
<reponame>chaveza6870/tsu from functools import lru_cache from pwd import getpwnam from pathlib import PurePath, Path import consolejs import tsu @lru_cache(maxsize=4) def is_other_user( user_n, uid): console = consolejs.get_console(tsu) if user_n == 0 or user_n == "root" or (not user_n): return Fal...
chaveza6870/tsu
tsu/exec.py
<gh_stars>1-10 # Copyright (c) 2019, <NAME> <<EMAIL> # This software is licensed under the MIT Liscense. # https://github.com/cswl/tsu/blob/v3.x/LICENSE-MIT import subprocess import re from pathlib import Path from collections import deque from . import consts import consolejs import tsu class SuExec: FOUND = ...
chaveza6870/tsu
tsu/SuBinary.py
from pathlib import Path import attr import typing from . import consts @attr.s(auto_attribs=True) class SuBinary: name: str path: str verstring: str veropt: list argmap: dict multipath: typing.List[str] = None abandoned : bool = None def lpath(self): if not self.multip...
chaveza6870/tsu
tsu/__init__.py
__version__ = "3.5.8" import sys import tsu.main
chaveza6870/tsu
setup_dist.py
<reponame>chaveza6870/tsu import sys from cx_Freeze import setup, Executable with open('tsu/__init__.py', 'r') as f: for line in f: if line.startswith('__version__'): version = line.strip().split('=')[1].strip(' \'"') break else: version = '0.0.1' options = { 'buil...
chaveza6870/tsu
tsu/consts.py
<reponame>chaveza6870/tsu # Copyright (c) 2019, <NAME> <<EMAIL> # This software is licensed under the MIT Liscense. # https://github.com/cswl/tsu/blob/v3.x/LICENSE-MIT from pathlib import Path from collections import OrderedDict # Defaults in Termux and Android TERMUX_FS = "/data/data/com.termux/files/" TERMUX_PREFI...
CyberDani/personal-roadmap
webPage/generator/unitTests/counter_test.py
import unittest import sys sys.path.append('..') from modules import counter class CounterTests(unittest.TestCase): def test_initNonSense(self): with self.assertRaises(Exception): counter.SimpleCounter(-234) with self.assertRaises(Exception): counter.SimpleCounter() with self.assertRaises(...
CyberDani/personal-roadmap
webPage/generator/unitTests/checks_test.py
import unittest import sys sys.path.append('..') from modules import checks from modules import filerw class ChecksTests(unittest.TestCase): def test_checkIntIsBetween_raiseException(self): with self.assertRaises(Exception): checks.checkIntIsBetween(0, 1, 4) with self.assertRaises(Exception): ...
CyberDani/personal-roadmap
webPage/generator/modules/htmlBody.py
from modules import checks from modules import htmlBuilder class HtmlBody: def __init__(self, htmlFile, indentDepth): checks.checkIntIsBetween(indentDepth, 1, 30) checks.checkIfFile(htmlFile) self.htmlFile = htmlFile self.indentDepth = indentDepth self.openedHtmlTags = [] def includeFileThenAp...
CyberDani/personal-roadmap
webPage/generator/unitTests/htmlBuilder_test.py
<gh_stars>0 import os import sys import unittest sys.path.append('..') from defTypes import buildType from defTypes import dbBranchType from defTypes import buildSettings from modules import htmlBuilder from modules import filerw from modules import counter def emptyHtmlHeadContent(settings): a = 2 def emptyHtmlB...
CyberDani/personal-roadmap
webPage/generator/unitTests/argumentParser_test.py
import unittest import sys sys.path.append('..') from defTypes import dbBranchType from defTypes import buildType from modules import argumentParser from modules import checks from modules import db class ArgumentParserTests(unittest.TestCase): def test_nonSense(self): with self.assertRaises(Exception): ...
CyberDani/personal-roadmap
webPage/generator/unitTests/cmd_test.py
<gh_stars>0 import unittest import sys sys.path.append('..') from modules import cmd from modules import stringUtil class CmdTests(unittest.TestCase): def test_getOutputFromCommandNonSense(self): with self.assertRaises(Exception): cmd.getOutputFromCommand("") with self.assertRaises(Exception): ...
CyberDani/personal-roadmap
webPage/generator/modules/argumentParser.py
import sys from defTypes import buildType from defTypes import dbBranchType from modules import checks from modules import db # args excludes the name of the script def parseArguments(args): checks.checkIfPureListOfStrings(args) argsSize = len(args) invalidUsage = True runUnitTests = False backup = False ...
CyberDani/personal-roadmap
webPage/generator/unitTests/filerw_test.py
import os import sys import unittest sys.path.append('..') from modules import filerw from modules import htmlBuilder class FileReadWriterTests(unittest.TestCase): def test_fileExists_nonSense(self): file = open("./unitTests/temp/test.txt", "w") with self.assertRaises(Exception): filerw.fileExists(fi...
CyberDani/personal-roadmap
webPage/generator/modules/htmlBuilder.py
from modules import checks from modules import filerw # <html><head> [headWriter] </head><body> [bodyWriter] </body></html> def buildIndexHtmlFile(indexHtmlHeadWriterFunction, indexHtmlBodyWriterFunction, settings): htmlFile = settings.htmlOutputFile settings.indentDepth = 2 htmlFile.write("<html>\n") htmlFile...
CyberDani/personal-roadmap
webPage/generator/defTypes/buildType.py
from enum import Enum class BuildType(Enum): DO_NOT_BUILD = 0 BUILD = 1 REBUILD = 2
CyberDani/personal-roadmap
webPage/generator/defTypes/dbBranchType.py
from enum import Enum class DbBranchType(Enum): MASTER = 0 DEVEL = 1
CyberDani/personal-roadmap
webPage/generator/modules/counter.py
from modules import checks class SimpleCounter: def __init__(self, startCounter): checks.checkIntIsBetween(startCounter, 0, 1000000) self.counter = startCounter def getNextInt(self): counterCp = self.counter self.counter += 1 return counterCp def getNextMessage(self, string): checks.c...
CyberDani/personal-roadmap
webPage/generator/unitTests/webReq_test.py
<filename>webPage/generator/unitTests/webReq_test.py import os import sys import unittest sys.path.append('..') from modules import webReq from modules import filerw class WebReqTests(unittest.TestCase): def test_getstatusCodeEncodingAndHtmlFromUrl_nonSense(self): with self.assertRaises(Exception): webRe...
CyberDani/personal-roadmap
webPage/generator/modules/cmd.py
import subprocess from modules import checks def getOutputFromCommand(command): checks.checkIfString(command, 1, 800) result = subprocess.run(command, stdout=subprocess.PIPE, shell=True).stdout.decode('utf-8') return result
CyberDani/personal-roadmap
webPage/generator/unitTests/git_test.py
<gh_stars>0 import sys import unittest sys.path.append('..') from modules import git from modules import cmd from modules import stringUtil from modules import filerw class GitUtilTests(unittest.TestCase): def test_getRepoRootDirectory(self): gitRoot = git.getRepoRootDirectory() currentPath = stringUtil.rT...
CyberDani/personal-roadmap
webPage/generator/modules/db.py
from defTypes import dbBranchType from modules import checks from modules import git # git:master -> MASTER, otherwise DEVEL def getDbBranchByGitBranch(gitBranch): checks.checkIfString(gitBranch, 1, 300) if gitBranch == "master": return dbBranchType.DbBranchType.MASTER return dbBranchType.DbBranchType.DEVEL...
CyberDani/personal-roadmap
webPage/generator/unitTests4unitTests/fail_x_group1.py
import unittest class Fail1Group1Tests(unittest.TestCase): def test_quickPass1(self): self.assertTrue(True) def test_quickPass2(self): self.assertTrue(True) def test_quickFail1(self): self.fail(":(") def test_quickPass3(self): self.assertTrue(True)
CyberDani/personal-roadmap
webPage/generator/unitTests/webLibs_test.py
<filename>webPage/generator/unitTests/webLibs_test.py import sys import unittest sys.path.append('..') from modules import filerw from modules import webLibs class WebLibsTests(unittest.TestCase): def test_addFontAwesome_v611_nonSense(self): file = open("./unitTests/temp/test.txt", "w") with self.assertRai...
CyberDani/personal-roadmap
webPage/generator/unitTests4unitTests/pass_x_group1.py
import unittest class Pass1Group1Tests(unittest.TestCase): def test_quickPass1(self): self.assertTrue(True) def test_quickPass2(self): self.assertTrue(True) def test_quickPass3(self): self.assertTrue(True)
CyberDani/personal-roadmap
webPage/generator/unitTests/buildType_test.py
import unittest import sys sys.path.append('..') from defTypes import buildType class BuildTypeTests(unittest.TestCase): def test_values(self): buildType.BuildType.DO_NOT_BUILD buildType.BuildType.BUILD buildType.BuildType.REBUILD def test_validateLength(self): self.assertEqual(len(buildType.B...
CyberDani/personal-roadmap
webPage/generator/modules/webReq.py
import requests from modules import checks def getstatusCodeEncodingAndHtmlFromUrl(url): checks.checkIfString(url, 9, 500) r = requests.get(url) return r.status_code, r.encoding, r.text def downloadFromUrlToFileIfStatusIs200(url, filePath): checks.checkIfString(url, 9, 500) checks.checkIfString(filePath, 3...