repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
bdowning/aiotools
tests/test_timer.py
import asyncio import pytest import aiotools @pytest.mark.asyncio async def test_timer(): """ Test the timer functionality. """ vclock = aiotools.VirtualClock() with vclock.patch_loop(): count = 0 async def counter(interval): assert interval == 0.1 nonloc...
bdowning/aiotools
src/aiotools/func.py
<gh_stars>100-1000 import collections import functools from .compat import get_running_loop __all__ = ( 'apartial', 'lru_cache', ) _CacheEntry = collections.namedtuple('_CacheEntry', 'value expire_at') def apartial(coro, *args, **kwargs): """ Wraps a coroutine function with pre-defined arguments (i...
bdowning/aiotools
examples/locking.py
<filename>examples/locking.py import asyncio import aiotools lock = asyncio.Lock() @aiotools.actxmgr async def mygen(input_value): print(input_value) await lock.acquire() print('The lock is acquired.') try: yield 'return_value' finally: lock.release() print('The lock is re...
bdowning/aiotools
examples/zmqserver.py
<reponame>bdowning/aiotools<filename>examples/zmqserver.py import logging import os from typing import Set import aiotools import zmq, zmq.asyncio num_workers = 4 log_init_states: Set[str] = set() def get_logger(name: str, pid: int) -> logging.Logger: log = logging.getLogger(name) # initialize only once fo...
bdowning/aiotools
src/aiotools/compat.py
<gh_stars>100-1000 import asyncio if hasattr(asyncio, 'get_running_loop'): get_running_loop = asyncio.get_running_loop else: get_running_loop = asyncio.get_event_loop if hasattr(asyncio, 'all_tasks'): all_tasks = asyncio.all_tasks else: all_tasks = asyncio.Task.all_tasks # type: ignore if hasattr...
bdowning/aiotools
tests/test_taskgroup.py
<reponame>bdowning/aiotools import asyncio import sys import warnings import pytest from aiotools import ( TaskGroup, TaskGroupError, VirtualClock, ) @pytest.mark.asyncio async def test_delayed_subtasks(): with VirtualClock().patch_loop(): async with TaskGroup() as tg: t1 = tg.cr...
bdowning/aiotools
examples/zmqclient.py
import zmq if __name__ == '__main__': ctx = zmq.Context() s = ctx.socket(zmq.PUSH) s.connect('tcp://127.0.0.1:5033') for _ in range(100): s.send(b'hello world') s.close()
bdowning/aiotools
examples/socketserver.py
import asyncio import aiotools async def echo(reader, writer): data = await reader.read(100) writer.write(data) await writer.drain() writer.close() @aiotools.actxmgr async def worker_main(loop, pidx, args): # Create a listening socket with SO_REUSEPORT option so that each worker # process ...
bdowning/aiotools
tests/test_func.py
import asyncio import pytest from aiotools.func import apartial, lru_cache async def do(a, b, *, c=1, d=2): '''hello world''' return (a, b, c, d) @pytest.mark.asyncio async def test_apartial_orig(): do2 = apartial(do) ret = await do2(1, 2, c=3, d=4) assert ret == (1, 2, 3, 4) @pytest.mark.as...
bdowning/aiotools
src/aiotools/fork.py
<filename>src/aiotools/fork.py """ This module implements a simple :func:`os.fork()`-like interface, but in an asynchronous way with full support for PID file descriptors on Python 3.9 or higher and the Linux kernel 5.4 or higher. It internally synchronizes the beginning and readiness status of child processes so that...
bdowning/aiotools
tests/test_ptaskgroup.py
<reponame>bdowning/aiotools<filename>tests/test_ptaskgroup.py import aiotools import asyncio import sys import pytest @pytest.mark.asyncio async def test_ptaskgroup_all_done(): count = 0 vclock = aiotools.VirtualClock() with vclock.patch_loop(): async def subtask(): nonlocal count ...
bdowning/aiotools
tests/test_server.py
<filename>tests/test_server.py import pytest import asyncio import functools import glob import logging.config import multiprocessing as mp import os import signal import sys import tempfile import time from typing import List, Sequence import aiotools if os.environ.get('CI', '') and sys.version_info < (3, 9, 0): ...
yuanlonghao/reranking
reranking/metrics.py
<gh_stars>1-10 import math from typing import Any, Dict, List, Optional, Tuple import numpy as np import pandas as pd __all__ = [ "proportion", "skew", "skew_static", "kld", "ndcg_diff", "ndkl", "infeasible", ] EPSILON = 1e-12 def proportion( item_attributes: List[Any], attributes: O...
yuanlonghao/reranking
reranking/reranker.py
import math from logging import getLogger from typing import Any, Dict, List, Optional, Set, Tuple, Union import numpy as np import pandas as pd logger = getLogger(__name__) ## TODO: deal with this situation: attributes = ["f1", ["f1", "f2"], "f2", ...] class Reranker: """ Re-ranking algorithms in the pape...
yuanlonghao/reranking
tests/test_reranker.py
<filename>tests/test_reranker.py from typing import Any, Dict, List, Optional, Tuple import numpy as np import pytest from reranking.reranker import Reranker class TestReranking: @pytest.fixture def genders(self) -> List[str]: np.random.seed(seed=43) genders: List[str] = np.random.choice( ...
yuanlonghao/reranking
setup.py
""" Publish steps: - Confirm version number in `setup.py`. - Delete the old version files in `/dist`. - Wrap package: `python setup.py sdist bdist_wheel` - Upload: `twine upload --repository-url https://upload.pypi.org/legacy/ dist/*` (username&password required) """ import setuptools with open("README.md", "r") as f...
yuanlonghao/reranking
tests/test_metrics.py
<gh_stars>1-10 from typing import Any, Dict, List import pytest from reranking.metrics import ( infeasible, kld, ndcg_diff, ndkl, proportion, skew, skew_static, ) class TestMetrics: @pytest.fixture def item_attributes(self) -> List[Any]: return [1, 1, 2, 3, 4] @pytes...
yuanlonghao/reranking
reranking/__init__.py
<reponame>yuanlonghao/reranking from typing import Any, Dict, List, Optional, Union import pandas as pd from .metrics import * from .reranker import Reranker def rerank( item_attribute: List[Any], desired_distribution: Dict[Any, float], max_na: Optional[int] = None, k_max: Optional[int] = None, ...
Jaraxxus-Me/UAVpytrackers_for_Odroid
bacflibs/bacffeatures.py
import numpy as np import pickle import os import cv2 from bacflibs import _gradient from bacflibs import otb_hc_config def mround(x): x_ = x.copy() idx = (x - np.floor(x)) >= 0.5 x_[idx] = np.floor(x[idx]) + 1 idx = ~idx x_[idx] = np.floor(x[idx]) return x_ def fhog(I, bin_size=8, num_orient...
Jaraxxus-Me/UAVpytrackers_for_Odroid
lib/eco/config/gpu_config.py
class GPUConfig: use_gpu=False gpu_id=2 gpu_config=GPUConfig()
Jaraxxus-Me/UAVpytrackers_for_Odroid
autotrack.py
<gh_stars>0 """ Python re-implemented of "Learning Spatial-Temporal Regularized Correlation Filters for Visual Tracking" @inproceedings{li2018learning, title={Learning spatial-temporal regularized correlation filters for visual tracking}, author={<NAME> and <NAME> and <NAME> and <NAME> and <NAME>}, booktitle={Pro...
Jaraxxus-Me/UAVpytrackers_for_Odroid
lib/utils.py
import os import numpy as np import cv2 import matplotlib.pyplot as plt def APCE(response_map): Fmax=np.max(response_map) Fmin=np.min(response_map) apce=(Fmax-Fmin)**2/(np.mean((response_map-Fmin)**2)) return apce def PSR(response): response_map=response.copy() max_loc=np.unravel_...
Jaraxxus-Me/UAVpytrackers_for_Odroid
examples/uavdataset_config.py
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Sat Dec 12 09:18:12 2020 @author: Jaraxxus """ import os class UAVDatasetConfig: def __init__(self,vediopath): self.path=vediopath frames={} names=os.listdir(vediopath) for name in names: frames[name]=[1,len...
Jaraxxus-Me/UAVpytrackers_for_Odroid
cf_demo.py
<filename>cf_demo.py import os import time from autotrack import AutoTrack from arcf import ARCF import glob import cv2 import numpy as np def get_init_gt(anno_path): gt_path = os.path.join(anno_path) with open(gt_path, 'r') as f: line = f.readline() if ',' in line: gt_...
Jaraxxus-Me/UAVpytrackers_for_Odroid
arcf.py
""" Python re-implementation of "Learning Background-Aware Correlation Filters for Visual Tracking" @article{Galoogahi2017Learning, title={Learning Background-Aware Correlation Filters for Visual Tracking}, author={Galoogahi, <NAME> and <NAME> and <NAME>}, year={2017}, } """ import numpy as np import cv2...
Jaraxxus-Me/UAVpytrackers_for_Odroid
lib/eco/features/__init__.py
<reponame>Jaraxxus-Me/UAVpytrackers_for_Odroid from .features import GrayFeature,FHogFeature, TableFeature, fhog, mround
Jaraxxus-Me/UAVpytrackers_for_Odroid
bacflibs/scale_estimator.py
import numpy as np import cv2 from numpy.fft import fft, ifft from .feature import extract_hog_feature #from .feature import extract_pyhog_feature from .utils import cos_window from .fft_tools import ifft2,fft2 class DSSTScaleEstimator: def __init__(self,target_sz,config): init_target_sz = np.array([target...
Jaraxxus-Me/UAVpytrackers_for_Odroid
autotrack_config.py
class AutoTrackConfig: hog_cell_size=4 hog_n_dim=31 gray_cell_size=4 cn_use_for_gray=False cn_cell_size=4 cn_n_dim=10 search_area_shape = 'square' # the shape of the samples search_area_scale = 5.0 # the scaling of the target size to get the search area ...
uchida-takumi/my_simple_mecab
example.py
<filename>example.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 使い方の例 """ from src.my_simple_mecab import keitaiso text = "今日は何時に帰ってきますか? と彼女は尋ねてくる" use_PoW = ['名詞','動詞','形容詞','副詞','記号',] stop_words = ['*','よう','上','の','様','こちら','際','ところ','はず','\u3000',] k = keitaiso(use_PoW=use_PoW,stop_words=stop_words) p...
uchida-takumi/my_simple_mecab
src/my_simple_mecab.py
# -*- coding: utf-8 -*- """ MeCabを使った形態素解析でテキストをベクトル化するやつです。 """ import MeCab from collections import Counter class keitaiso: def __init__(self, use_PoW=['名詞','動詞','形容詞','副詞','記号'], stop_words=[], use_words=[], user_dic_files=[]): """ ARGUMENT ---------------- use_PoW [list]: ...
StAugust/kaggle
titanic/test.py
<filename>titanic/test.py<gh_stars>0 import numpy as np if __name__ == '__main__': print("this is the main method")
MLackner/NUSFSpectra
pythonmodules/pySfgProcess/spikeRemoval.py
# -*- coding: utf-8 -*- """ This script searches a directory and reads in the ASCII data files produced by WinSpec, corrects for cosmic ray spikes with a rolling median filter, and replaces the original file with the updated file if spikes are found. The original file is placed in a new directory called preSpikeCorr...
MLackner/NUSFSpectra
pythonmodules/pySfgProcess/pscalib.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 7 16:42:16 2018 @author: geiger """ #import dfg class to hold individual dfg acquisition from dfg import DFG #import numpy import numpy as np from scipy.optimize import curve_fit from scipy import exp #import matplotlib for plotting import mat...
MLackner/NUSFSpectra
pythonmodules/pySfgProcess/spectrum.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 31 17:04:26 2017 Class to hold data for a compilation of DFGs making up a whole spectrum. Methods in this class make up the majority of processing that occurs. The class gets initialized with the path to a folder with a set of DFGs, both of the sam...
MLackner/NUSFSpectra
pythonmodules/pySfgProcess/dfg.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 31 17:04:26 2017 Class to hold data from a single DFG acquisition. A set of DFGs may or may not make up a full spectrum from spectrum.py. DFG stands for 'difference frequency generation'. When collecting a broad SFG vibrational spectrum, the IR w...
MLackner/NUSFSpectra
pythonmodules/pySfgProcess/fullwn.py
<reponame>MLackner/NUSFSpectra #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 23 21:04:16 2017 Object that is just an array that holds all the wavenumber values that the acquisitions, once they are padded with zeros and/or properly summed up, are plotted against. @author: pohno """ #import n...
CollectivaT-dev/ckan
ckan/tests/logic/action/test_get.py
<reponame>CollectivaT-dev/ckan # encoding: utf-8 import datetime import re import copy import pytest from six import text_type from six.moves import xrange import ckan.logic as logic import ckan.logic.schema as schema import ckan.plugins as p import ckan.tests.factories as factories import ckan.tests.helpers as help...
davidrelke/CARLA-2DBBox
collectData.py
# Example program to save several sensor data including bounding box # Sensors: RGB Camera (+BoundingBox), De[th Camera, Segmentation Camera, Lidar Camera # By <NAME> # 2020 # Last tested on CARLA 0.9.10.1 # CARLA Simulator is licensed under the terms of the MIT license # For a copy, see <https://opensource.org...
davidrelke/CARLA-2DBBox
carla_vehicle_annotator.py
<gh_stars>0 ### Functions to extract 2D vehicle Bounding Box from CARLA ### By <NAME> ### Based example from CARLA Github client_bounding_boxes.py ### 2020 ### Last tested on CARLA 0.9.10.1 ### All of functions in PART 1 and PART 2 are copied from client_bounding_boxes.py example ### Except functions that conve...
davidrelke/CARLA-2DBBox
count_types.py
import os from os import listdir from os.path import isfile, join from typing import List labels_path = os.path.abspath("data/labels") label_files: List[str] = [labels_path + "/" + f for f in listdir(labels_path) if isfile(join(labels_path, f))] num_cars = 0 num_trucks = 0 num_bikes = 0 num_motorbikes = 0 ...
julianmak/pydra
native/sta2dfft.py
<gh_stars>0 #/usr/bin/env python3 # # JM: 12 Apr 2018 # # the sta2dfft.f90 adapted for python # contains 2d spectral commands which uses stafft from stafft import * # This module performs FFTs in two directions on two dimensional arrays using # the stafft library module to actually compute the FFTs. If FFTs in one ...
julianmak/pydra
wrapper/pydra_analysis.py
#!/usr/bin/env python3 # # JM, 29 Oct 2018 # # some subfunctions to do analysis of pydra data from pydra_misc import * # numpy is loaded here as np from casl import parameters, spectral, constants #------------------------------------------------------------------------------- # generate the eddy momentum quantities ...
julianmak/pydra
native/parameters.py
#!/usr/bin/env python3 # # JM: 11 Apr 2018 # # sample parameters.py for testing purposes, should write a script # to grab the relevant things from the folder parameters.f90 file # Initial time loop from which to begin the simulation: loopinit = 0 # loopinit > 0 may be used for continuing a simulation (see replace belo...
julianmak/pydra
native/spectral.py
#/usr/bin/env python3 # # JM: 12 Apr 2018 # # the secptral adapted for python # contains inversion commands etc. from constants import * # from generic import * from sta2dfft import * from numpy import arange, zeros, pi, exp, sqrt, around, log10 # define some parameters nwx = int(nx / 2) nwxm1, mwxp1 = nwx - 1, nwx ...
julianmak/pydra
native/stafft.py
#/usr/bin/env python3 # # JM: 11 Apr 2018 # # the stafft.f90 adapted for python # standalone and it shouldn't depend on anything # #------------------------------------------------------------------------------- # Fourier transform module. # This is not a general purpose transform package but is designed to be # quic...
julianmak/pydra
native/constants.py
##/usr/bin/env python3 # # JM: 11 Apr 2018 # # constants that are unchanged, depending on the customisable parameters.py from parameters import * from numpy import sqrt, pi # Contains all the non-modifiable parameters as well as all # quantities which never change throughout a simulation # for the suite of casl f90 c...
julianmak/pydra
native/__init__.py
<gh_stars>0 #!/usr/bin/env python3 # # JM: 11 Apr 2018 # # to initialise pydra analysis and load various things from parameters import * from constants import *
julianmak/pydra
wrapper/sample_f2py/test_driver.py
#!/usr/bin/env python3 # from numpy import f2py sourcefile = open("test_mod.f90", "rb") # open as binary sourcecode = sourcefile.read() print(sourcecode) f2py.compile(sourcecode, modulename = "murp", extension = ".f90") from murp import test_mod test_mod.print_murp(6.0) p = test_mod.add_murp(3.0, 4.0) print(p) j...
julianmak/pydra
wrapper/pydra_misc.py
<reponame>julianmak/pydra #!/usr/bin/env python3 # # JM, 20 Apr 2018 # # some misc functions relating to pydra import os import numpy as np from numpy.fft import rfft, irfft #------------------------------------------------------------------------------- # read the PV data def read_qq(data_dir, nx, ny, kt, num_frame ...
julianmak/pydra
wrapper/pydra_plot.py
#!/usr/bin/env python3 # # JM, 30 Oct 2018 # # some plotting functions relating to pydra from pydra_analysis import * import matplotlib.pyplot as plt import numpy as np plt.rcParams["font.family"] = "DejaVu Serif" plt.rcParams["mathtext.fontset"] = "cm" plt.rcParams["mathtext.rm"] = "serif" plt.rcParams["image.cmap"]...
julianmak/pydra
native/testing_run.py
<gh_stars>0 #/usr/bin/env python3 # # JM: 11 Apr 2018 # # just a python script to test the running of stuff from spectral import * nx = 128 ny = 64 ellx = 6.28318530717958647692 elly = 3.14159265358979323846 init_spectral() #factors, trig = initfft(n) #print(trig) #x = forfft(m, n, trig, factors) #print(x)
MichaelLiut/UTM_PyGame
Zelle Graphics/MovingBox.py
# Course: Course ID # Name: XXXXXXXX # Student number: 0000000 # File: MovingBox.py # This program creates a graphical window, displays a message and a square. # After a click, the square starts rolling to the right. When it rolls all # the way to the right, a message is displayed, and after a click, the # program ...
MichaelLiut/UTM_PyGame
Zelle Graphics/Train.py
<gh_stars>0 # Course: Course ID # Name: XXXXXXXX # Student number: 0000000 # File: Train.py # This program creates a train in the right end of a graphics window. # After a click, the train moves left as far as it can and then stops. # After a click, the train backs back to its original position. # After a click, the ...
MichaelLiut/UTM_PyGame
PyGame Graphics/Particle Flocking System - The Beginning/main.py
<reponame>MichaelLiut/UTM_PyGame ################################################################################ ############################ UTM PyGame Workshop ############################### ############################## June 5, 2018 ################################## ############################################...
MichaelLiut/UTM_PyGame
Zelle Graphics/SmallTrain.py
# Course: Course ID # Name: XXXXXXXX # Student number: 0000000 # File: SmallTrain.py # This program creates a graphical window, displays a message. After a click, # a tractor-trailer emerges from behind the right edge of the window and moves # from right to left. As it moves, it slowly gets smaller. It will dis...
MichaelLiut/UTM_PyGame
Zelle Graphics/UnBlockMe.py
<reponame>MichaelLiut/UTM_PyGame # Course: Course ID # Name: XXXXXXXX # Student number: 0000000 # File: UnBlockMe.py # import names from module graphics from graphics import * from time import sleep import sys # draw the frame of the grid in the window win # x,y are coordinates of the top left corner of the first fi...
MichaelLiut/UTM_PyGame
PyGame Graphics/Particle Flocking System - The Beginning/particle.py
<gh_stars>0 ################################################################################ ############################ UTM PyGame Workshop ############################### ############################## June 5, 2018 ################################## #################################################################...
MichaelLiut/UTM_PyGame
PyGame Graphics/Another Game/main.py
import sys import pygame from pygame.locals import * import random SCREEN_SIZE = (640, 480) WHITE = (255, 255, 255) BLACK = (0, 0, 0) # The world class keeps a list of all active entities class World(object): def __init__(self): self.entities = [] def add_player(self, entity): self...
MichaelLiut/UTM_PyGame
PyGame Graphics/PyGame_Example.py
<gh_stars>0 import sys import pygame from pygame.locals import * pygame.init() # initializes the PyGame modules # Set a PyGame Window to a size of 640 x 480 screenSizeX = 640 screenSizeY = 480 screen = pygame.display.set_mode((screenSizeX,screenSizeY)) # Circle Creation centre = (100, 100) radius = 20...
MichaelLiut/UTM_PyGame
Zelle Graphics/Train_Skeleton.py
# Course: Course Code # Name: FirstName LastName # Student Number: ########## # File: Train_YourName.py # Description: What does this file do? # import all names from module graphics from graphics import * # import name sleep from module time import time # Wheels are common to BoxCar, PassengerCar, Caboose, a...
theoofman/encoder
src/toastencoder/encoder.py
<reponame>theoofman/encoder def encode(msg,key): out = "" for i in range(len(msg)): out += chr(ord(msg[i])+key) return(out) def decode(msg,key): out = "" for i in range(len(msg)): out += chr(ord(msg[i])-key) return(out)
Neckster/conformance-checking-augur-smart-contract
petri_extractor.py
import os from pm4py.objects.log.importer.xes import importer as xes_importer from pm4py.algo.discovery.inductive import algorithm as inductive_miner from pm4py.objects.petri.exporter import exporter as pnml_exporter from pm4py.visualization.petrinet import visualizer as pn_visualizer log = xes_importer.apply(os.path....
Neckster/conformance-checking-augur-smart-contract
conformance_checker.py
import os from pm4py.objects.log.importer.xes import importer as xes_importer from pm4py.objects.petri.importer import importer as pnml_importer from pm4py.algo.conformance.tokenreplay import algorithm as token_replay from pm4py.algo.conformance.log_skeleton import algorithm as lsk_conformance from pm4py.algo.conforman...
Neckster/conformance-checking-augur-smart-contract
log_preprocessor.py
<reponame>Neckster/conformance-checking-augur-smart-contract<filename>log_preprocessor.py<gh_stars>0 import os from pm4py.algo.filtering.log.attributes import attributes_filter from pm4py.objects.log.importer.xes import importer as xes_importer from pm4py.objects.log.exporter.xes import exporter as xes_exporter from p...
lubianat/topictagger
term2subject/term2subject.py
<gh_stars>0 import pandas as pd from pandas import json_normalize from gooey import Gooey import requests from wikidata2df import wikidata2df import argparse # Simple GUI based on Gooey # # https://github.com/chriskiehl/Gooey @Gooey def main(): parser = argparse.ArgumentParser(description='Add main subject sta...
blaulan/alfred-beancount
beancount.py
# -*- coding: utf-8 -*- # @Author: <NAME> <<EMAIL>> # @Date: 2020-02-28 16:48:17 # @Last Modified By: <NAME> <<EMAIL>> # @Last Modified Time: 2020-03-02 22:47:36 import os import re import sys import math import glob import json from datetime import datetime from pypinyin import lazy_pinyin from rapidfuzz import f...
blaulan/alfred-beancount
commandline.py
# -*- coding: utf-8 -*- # @Author: <NAME> <<EMAIL>> # @Date: 2020-02-29 17:49:05 # @Last Modified By: <NAME> <<EMAIL>> # @Last Modified Time: 2020-03-02 22:06:26 from prompt_toolkit import PromptSession from prompt_toolkit.completion import Completer, Completion from prompt_toolkit.validation import Validator, Val...
varjas/siprefix
siprefix/siprefix.py
import math # Return prefix or scale based on one input # Only handles prefixes separated by 3 orders of magnitude def siConvert(order=None, prefix=None): # Require at least one argument if prefix is None and order is None: raise TypeError("siConvert() missing at least 1 positional argument: 'order' or 'prefix'") ...
varjas/siprefix
siprefix/__init__.py
from siprefix import *
jumper2014/web-test-framework-python-unittest-selenium
libs/pages/home_page.py
<filename>libs/pages/home_page.py #!/usr/bin/env python # author: zengyuetian # page object and function for search page from libs.pages.base_page_object import BasePage from libs.pagefactory.pagefactory_support import callable_find_by as find_by class HomePage(BasePage): # page object definition search_box...
jumper2014/web-test-framework-python-unittest-selenium
suites/search/__init__.py
#!/usr/bin/env python # coding=utf-8 # author: zengyuetian if __name__ == '__main__': pass
jumper2014/web-test-framework-python-unittest-selenium
libs/pages/result_page.py
<filename>libs/pages/result_page.py<gh_stars>1-10 #!/usr/bin/env python # coding=utf-8 # author: zengyuetian from libs.pages.base_page_object import BasePage from libs.pagefactory.pagefactory_support import callable_find_by as find_by import unittest import time class ResultPage(BasePage): # page object definiti...
jumper2014/web-test-framework-python-unittest-selenium
main.py
<reponame>jumper2014/web-test-framework-python-unittest-selenium<filename>main.py #!/usr/bin/env python # coding=utf-8 # author: zengyuetian import unittest from suites.search.test_search import * if __name__ == "__main__": suite = unittest.TestSuite() suite.addTest(TestSearch('testSearchOk')) runner = un...
jumper2014/web-test-framework-python-unittest-selenium
suites/search/test_search.py
#!/usr/bin/env python # coding=utf-8 # author: zengyuetian import unittest from libs.pages.home_page import * from libs.pages.result_page import * from selenium import webdriver class TestSearch(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() def testSearchOk(self): se...
jumper2014/web-test-framework-python-unittest-selenium
libs/pages/base_page_object.py
#!/usr/bin/env python # author: zengyuetian # base page class from selenium.webdriver.common.action_chains import ActionChains import time class BasePage(object): def __init__(self, driver, base_url='http://www.baidu.com'): self._driver = driver self.base_url = base_url self.timeout = 30 ...
jumper2014/web-test-framework-python-unittest-selenium
libs/pagefactory/pagefactory_support.py
#!/usr/bin/env python # https://jeremykao.wordpress.com/2015/06/10/pagefactory-pattern-in-python/ # author: Jeremy, github: https://gist.github.com/imsardine/6185d76377e2c8d06d07#file-pageobject_support-py # updated to support python2 and python3 import sys __all__ = ['visible', 'cacheable', 'callable_find_by', 'prop...
madhuvenkidusamy/sql-challenge
employees.py
<gh_stars>0 import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, inspect import pandas as pd # Connect to postgres engine = create_engine("postgres://madhuvenkidusamy:blend62@localhost:5432/employees") # Load CSVs into Beekeeper. ...
nbeguier/coverage2css
coverage2css.py
<gh_stars>0 #!/usr/bin/env python3 """ Chrome Coverage to CSS file Copyright (c) 2020-2021 <NAME> Licensed under the MIT License Written by <NAME> (<EMAIL>) """ # Standard library imports import sys import json # Debug # from pdb import set_trace as st JSON_COVERAGE = sys.argv[1] CSS_NAME = sys.argv[2] VERSION = '...
4BH1J337/Volume-Calculator
main.py
<filename>main.py from tkinter import * # all root=Tk() #call tkinter function root.geometry("320x480") #Width x Height (320,480) root.resizable(False,False) # window always stay in same size root.title("Volume Calculator") #Title bar root.iconbitmap('Images/volcon.ico')# Setting icon of master window,The i...
daangn/redis-memory-analyzer
rma/rule/Hash.py
import statistics from itertools import tee from tqdm import tqdm from rma.redis import * from rma.helpers import pref_encoding, make_total_row, progress_iterator class HashStatEntry(object): def __init__(self, info, redis): """ :param key_name: :param RmaRedis redis: :return: ...
amickael/pyopentdb
pyopentdb/enum/Difficulty.py
from enum import Enum, unique @unique class Difficulty(Enum): EASY = "easy" MEDIUM = "medium" HARD = "hard" difficulty_map = {i.value: i for i in Difficulty}
amickael/pyopentdb
pyopentdb/api/__init__.py
from pyopentdb.api.OpenTDBClient import OpenTDBClient
amickael/pyopentdb
pyopentdb/model/QuestionResult.py
from dataclasses import dataclass from typing import List from copy import deepcopy import html from pyopentdb.model.Question import Question from pyopentdb.enum import ( category_name_map, difficulty_map, question_type_map, ) from pyopentdb.exc.QuestionError import QuestionError @dataclass class Questio...
amickael/pyopentdb
pyopentdb/model/Question.py
import json from dataclasses import dataclass, asdict from enum import Enum from random import shuffle from typing import List, Union from pyopentdb.enum import QuestionType, Difficulty, Category from pyopentdb.exc import QuestionError @dataclass class Question: category: Category question_type: QuestionType...
amickael/pyopentdb
pyopentdb/__init__.py
from pyopentdb.api import OpenTDBClient from pyopentdb.enum import ( QuestionType, Difficulty, Category, CategoryItem, ResponseCode, ) from pyopentdb.exc import APIError, QuestionError from pyopentdb.model import Question __author__ = "<NAME>" __version__ = "0.0.4" __description__ = "Python interfa...
amickael/pyopentdb
pyopentdb/scripts/get_categories.py
<reponame>amickael/pyopentdb import requests req = requests.get("https://opentdb.com/api_category.php") data = req.json()["trivia_categories"] for cat in data: ident = cat["id"] name = cat["name"] enum = name.upper().replace(" ", "_").replace(":", "_").replace("&", "_").strip() enum = enum.replace("___...
amickael/pyopentdb
pyopentdb/enum/ResponseCode.py
<reponame>amickael/pyopentdb from enum import Enum, unique from collections import namedtuple ResponseCodeItem = namedtuple("ResponseCodeItem", ["code", "name", "description"]) @unique class ResponseCode(Enum): SUCCESS = ResponseCodeItem(0, "Success", "Returned results successfully.") NO_RESULTS = ResponseCo...
amickael/pyopentdb
pyopentdb/model/QuestionSet.py
import json from copy import deepcopy from typing import List, Union from pyopentdb.model.Question import Question class QuestionSet: def __init__(self, questions: List[Question]): self.items = questions def __len__(self) -> int: return len(self.items) def __getitem__(self, item: int) -...
amickael/pyopentdb
pyopentdb/api/OpenTDBClient.py
from typing import Union from warnings import warn import requests from pyopentdb.enum import Category, Difficulty, QuestionType, ResponseCode from pyopentdb.exc import APIError from pyopentdb.model import QuestionResponse, QuestionSet class OpenTDBClient: def __init__(self): self.session = requests.Ses...
amickael/pyopentdb
pyopentdb/enum/QuestionType.py
<filename>pyopentdb/enum/QuestionType.py from enum import Enum, unique @unique class QuestionType(Enum): MULTIPLE = "multiple" TRUE_FALSE = "boolean" question_type_map = {i.value: i for i in QuestionType}
amickael/pyopentdb
pyopentdb/model/__init__.py
from pyopentdb.model.Question import Question from pyopentdb.model.QuestionResponse import QuestionResponse from pyopentdb.model.QuestionResult import QuestionResult from pyopentdb.model.QuestionSet import QuestionSet
amickael/pyopentdb
setup.py
from setuptools import setup, find_packages import pyopentdb with open("README.md", "r") as f: readme = f.read() with open("requirements.txt", "r") as f: requirements = [i.rstrip() for i in f.readlines()] setup( name="pyopentdb", version=pyopentdb.__version__, description=pyopentdb.__description...
amickael/pyopentdb
pyopentdb/enum/Category.py
<reponame>amickael/pyopentdb from collections import namedtuple from enum import Enum, unique CategoryItem = namedtuple("CategoryItem", ["id", "name", "emoji", "aria"]) @unique class Category(Enum): GENERAL_KNOWLEDGE = CategoryItem(9, "General Knowledge", "🧠", "brain") ENTERTAINMENT_BOOKS = CategoryItem(10,...
amickael/pyopentdb
pyopentdb/enum/__init__.py
from pyopentdb.enum.QuestionType import QuestionType, question_type_map from pyopentdb.enum.Difficulty import Difficulty, difficulty_map from pyopentdb.enum.Category import ( Category, CategoryItem, category_id_map, category_name_map, ) from pyopentdb.enum.ResponseCode import ResponseCode, response_code...
amickael/pyopentdb
pyopentdb/exc/__init__.py
<reponame>amickael/pyopentdb<filename>pyopentdb/exc/__init__.py from pyopentdb.exc.QuestionError import QuestionError from pyopentdb.exc.APIError import APIError
amickael/pyopentdb
pyopentdb/model/QuestionResponse.py
from typing import List from pyopentdb.enum import response_code_map from pyopentdb.model.QuestionResult import QuestionResult from pyopentdb.model.QuestionSet import QuestionSet class QuestionResponse: def __init__(self, response_code: int, results: List[dict]): self.response_code = response_code_map.ge...
dmcskim/hmp_download
hmp_download.py
#!/usr/bin/env python3 """ download_hmp.py: Downloads Human Microbiome Project (HMP) data files from a manifest file. """ __author__ = '<NAME>' __maintainer__ = '<NAME>' __email__ = '<EMAIL>' __version__ = '0.0.1' __status__ = 'Development' from numpy import array from pandas import read_csv impo...
dmcskim/hmp_download
setup.py
#!/usr/bin/env python """Download HMP data files.""" from os.path import dirname setup_args = {} try: from setuptools import setup # Dependencies for easy_install: setup_args.update( install_requires=[ 'pandas >= 0.20.2', 'numpy >= 1.13.3', 'wget >= 3.0', ...
trnolan/simple-messaging-api
run.py
# stdlib import os # project from messaging_app import app if __name__ == '__main__': app.run(host='0.0.0.0', port=os.environ.get('HTTP_PORT'))
trnolan/simple-messaging-api
messaging_app/__init__.py
# stdlib import datetime import logging import os # 3p from flask import Flask, request from flask.json import jsonify from flask_jwt import JWT, jwt_required import json import pika app = Flask(__name__) params = pika.ConnectionParameters(host='amqp', credentials=pika.PlainCredentials(username='amqp', password='<PA...