source
stringlengths
3
86
python
stringlengths
75
1.04M
sample_generator.py
from collections import deque import threading import randomgen from utils.sampling.perlin import create_perlin_noise, calc_fade class SampleGenerator: """ Multi-threaded util that runs in the background and precalculates noise samples. To be used in with statement! Not a python "generator". Sorry about...
tcp.py
# -*- coding: utf-8 -*- ''' TCP transport classes Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})" ''' # Import Python Libs from __future__ import absolute_import import logging import msgpack import socket import os import weakref import time import traceback import errno # Import Salt...
run.py
import argparse, re, os from .product import version import importlib.util import threading def register_watch(module, filepath): spec = importlib.util.spec_from_file_location(module, filepath) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) watches = [] for (name, i...
_connectivity_channel.py
# Copyright 2015, Google Inc. # 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 retain the above copyright # notice, this list of conditions and the f...
test_websocket_provider.py
import asyncio from concurrent.futures import ( TimeoutError, ) import pytest from threading import ( Thread, ) import websockets from tests.utils import ( wait_for_ws, ) from cpc_fusion import Web3 from cpc_fusion.exceptions import ( ValidationError, ) from cpc_fusion.providers.websocket import ( ...
twisterlib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import math import sys import re import subprocess import select import shutil import shlex import signal import hashlib import thre...
test_add_vectors.py
import time import random import pdb import threading import logging from multiprocessing import Pool, Process import pytest from milvus import IndexType, MetricType from utils import * dim = 128 index_file_size = 10 table_id = "test_add" ADD_TIMEOUT = 60 nprobe = 1 tag = "1970-01-01" class TestAddBase: """ ...
semantic.py
""" Uses semantic to obtain an AST for a given code snippet in a language supported by semantic. This code is based on a semantic version that still supports the `--json-graph` option! Newer versions of semantic have dropped that command line option and it is unclear if it will return! To ensure this code will work wit...
test_gc.py
import unittest from test.test_support import verbose, run_unittest, start_threads import sys import time import gc import weakref try: import threading except ImportError: threading = None ### Support code ############################################################################### # Bug 1055820 has seve...
jobs.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
file_stream.py
import base64 import binascii import collections import logging import threading import requests import time import wandb import itertools from six.moves import queue from wandb import util from wandb import env MAX_LINE_SIZE = 4*1024*1024 - 100*1024 # imposed by back end logger = logging.getLogger(__name__) Chunk ...
hadoop_transfile.py
# -*- coding: utf-8 -*- from base.log import * import os from multiprocessing import Process import redis_pool def gen_id(): r = redis_pool.get('dornaemon') return r.incr('deploy_id') def do(src_path, dest_path,file_mode, deploy_id): log_path = 'html/deploy_logs/%d.txt' % deploy_id cmd = "python /home/op/wzs/py...
demo.py
########### Python 3.6 ############# import http.client, urllib.request, urllib.parse, urllib.error, base64, requests, json, cv2 import numpy as np import cv2 import os import keyboard from time import sleep import time import pygame import sys import random import keyboard import threading from threadin...
main_bot.py
from concurrent import futures import copy import datetime import threading import time import telebot from telebot.types import LabeledPrice import schedule from configs import settings from models.parsers import CurrencyExchanger from models.user import User, Prediction, Session from models import exce...
simulator.py
import Tkinter as tk import paho.mqtt.client as mqtt from threading import Thread import json broker = "localhost" client = mqtt.Client(client_id="c1",clean_session=False) client.loop_start() client.connect(broker) root = tk.Tk() root.geometry('%dx%d+%d+%d'%(370,250,200,150)) root.title('Node-Simulator') w = tk.Labe...
server.py
import sys import os sys.path.insert(1,os.path.dirname(os.getcwd())) import sqlite3 as sql import imqserver.db_utils as du from imqserver.server_util import * from imqserver.database import * class Server(object): def __init__(self,db_name): self.db = DATABASE(DATABASE_NAME=db_name) self.server = ...
example_204_no_content.py
# -*- coding: utf8 -*- import time import threading from icapserver import * set_logger('debug') class ExampleICAPHandler(BaseICAPRequestHandler): def example_OPTIONS(self): self.set_icap_response(200) self.set_icap_header('Methods', 'RESPMOD, REQMOD') self.set_icap_header('Service', 'ICAP Server' + ' ' + s...
train_pg_f18.py
""" Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017 Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany """ import numpy as np import tensorflow as tf import gym import logz import os import time im...
test_device.py
import logging import time import threading import scpidev FORMAT = "%(levelname)s: %(message)s" logging.basicConfig(format=FORMAT, level=logging.DEBUG) # logging.basicConfig(format=FORMAT, level=logging.INFO) # Define our callback functions def test_function(*args, **kwargs): print("## Execute. ##") i = 0 ...
myRL_2_server_no_training.py
#!/usr/bin/env python from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import SocketServer import base64 import urllib import sys import os import json os.environ['CUDA_VISIBLE_DEVICES']='' import numpy as np import tensorflow as tf import time import a3c import multiprocessing import time import copy im...
utils.py
# Code copied from https://github.com/github/CodeSearchNet for backward-compatible experimentations import multiprocessing from typing import List, Iterable, Callable, TypeVar, Dict, Any, Union from dpu_utils.utils import RichPath from pathlib import Path JobType = TypeVar("JobType") ResultType = TypeVar("ResultType"...
face2rec2.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
active_connection.py
from datetime import datetime import select import json import threading from flask import Blueprint, request, jsonify from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from flask_socketio import SocketIO from blueprints.connection import Connection, connection_schema, connections_sch...
opencti_connector_helper.py
import datetime import threading import queue import uuid import requests import pika import logging import json import time import base64 import os from typing import Callable, Dict, Optional, Union from sseclient import SSEClient from pika.exceptions import UnroutableError, NackError from pycti.api.opencti_api_clie...
main.py
import socket import threading import pickle import enum import random import math import time import sys import pygame BUFFER_SIZE = 4096 class MessageType(enum.Enum): GAME_INFO_REQUEST = 0 GAME_INFO_SEND = 1 PLAYER_INFO_BROADCAST = 2 PLAYER_INFO = 3 NEW_PLAYER_INFO = 4 class Timer: def _...
server.py
import socket import threading import sys import psutil import os import sched import time import ipaddress bind_ip = socket.gethostname() bind_port = 9991 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def start_server(): server.bind((bind_ip, bind_port)) server.listen(5) print("[*] Escutando...
datasets.py
import glob import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import math import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from utils.general import xyxy2xywh, xywh2xyxy, torch_di...
server.py
import threading import os import sys import time import datetime import io import re import base64 import uuid import queue import logging import traceback import numpy as np import pandas as pd from sklearn.model_selection import train_test_split import lightgbm as lgb import pickle from flask import Flask, send_fr...
mock_athenamp.py
#!/usr/bin/env python # 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 # # Authors: # - Taylor Childers (john.taylor.childers@cern.ch) #!/usr/bin/en...
testboxtasks.py
# -*- coding: utf-8 -*- # $Id: testboxtasks.py $ """ TestBox Script - Async Tasks. """ __copyright__ = \ """ Copyright (C) 2012-2015 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; you can redistribute it and/or mo...
bridge_gui.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from twisted.python import log from twisted.internet import reactor from twisted.internet.error import CannotListenError, ReactorNotRunning from autobahn.twisted.websocket import WebSocketServerFactory, listenWS,WebSocketClientFactory log.startLogging(sys.stdou...
main.py
# MIT License # # Copyright (c) 2022 Luke Ingram # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, ...
telegram-client.py
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters import threading import websocket import sys class TelegramClient: def __init__(self, _url, _token): self.url = _url self.token = _token self.socket = None self.bot = None self.chat_id = None ...
common.py
"""Test the helper method for writing tests.""" import asyncio from collections import OrderedDict from datetime import timedelta import functools as ft import json import os import sys from unittest.mock import patch, MagicMock, Mock from io import StringIO import logging import threading from contextlib import contex...
bluemo_ble.py
import logging import sys from abc import ABCMeta, abstractmethod import time import threading from threading import Semaphore from bgapi.module import BlueGigaClient, GATTService, GATTCharacteristic from bgapi.module import BlueGigaServer, ProcedureManager, BLEScanResponse from bgapi.cmd_def import gap_discover_mode,...
main.py
from datetime import datetime from http.server import BaseHTTPRequestHandler from http.server import HTTPServer from threading import Event from threading import Thread from time import sleep from analysis import Analysis from logs import Logs from trading import Trading from twitter import Twitter # Whether to send ...
__init__.py
""" The ``python_function`` model flavor serves as a default model interface for MLflow Python models. Any MLflow Python model is expected to be loadable as a ``python_function`` model. In addition, the ``mlflow.pyfunc`` module defines a generic :ref:`filesystem format <pyfunc-filesystem-format>` for Python models and...
ttest.py
import threading import time def thread_target(): i = 1 while True: print(i) time.sleep(1) flag = True thread_obj = threading.Thread(target = thread_target) thread_obj.start() thread_obj.join(timeout = 5) flag = False
test_integration.py
import collections import threading import subprocess import os import json import mock import pwd import socket import pytest try: from BaseHTTPServer import HTTPServer from BaseHTTPServer import BaseHTTPRequestHandler except ImportError: from http.server import HTTPServer from http.server import Bas...
nng.py
""" Provides a Pythonic interface to cffi nng bindings """ import logging import weakref import threading from ._nng import ffi, lib from .exceptions import check_err, ConnectionRefused from . import options from . import _aio logger = logging.getLogger(__name__) # a mapping of id(sock): sock for use in callbacks...
consumer.py
# Copyright (c) 2014 Rackspace, Inc. # 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 writ...
ads1x15.py
from ..devices import Sensor import Adafruit_ADS1x15 from time import sleep import threading from collections import deque import numpy class ADS1X15(Sensor): _MAX_VALUE = 32767 _CHANNELS = 4 GAINS = numpy.array([[2/3, 6.144], [1, 4.096], [2, 2.048], ...
test_urlcall.py
import json import socketserver import unittest import threading from http.server import BaseHTTPRequestHandler from prompy.networkio.call_factory import Caller, CallRoute from prompy.networkio.urlcall import url_call, json_call from prompy.promise import Promise from prompy.threadio.tpromise import TPromise from test...
test_rpc.py
import asyncio import threading import logging import multiprocessing as mp import pytest import msgpack from msgpackio.client import Client from msgpackio.rpc import RPCClient from msgpackio.server import RPCServer from msgpackio.exceptions import RemoteException log = logging.getLogger(__name__) def add(a, b): ...
lock_demo.py
""" @author: magician @file: lock_demo.py @date: 2020/8/7 """ from threading import Thread, Lock class Counter(object): """ Counter """ def __init__(self): self.count = 0 def increment(self, offset): self.count += offset def worker(sensor_index, how_many, counter): """ ...
test_gc.py
import unittest from test.test_support import verbose, run_unittest, start_threads import sys import time import gc import weakref try: import threading except ImportError: threading = None ### Support code ############################################################################### # Bug 1055820 has seve...
scapy_isolated_test.py
#!/usr/bin/python import sys, os from multiprocessing import Process import tempfile def check_offsets(build, stdout, scapy_str): import sys sys.stdout = stdout sys.stderr = stdout # clean this env for key in sys.modules.copy().keys(): if key.startswith('scapy.'): del sys.modul...
csv_importer.py
from openerp import models, api, fields, SUPERUSER_ID import pdb import time import os import csv import cStringIO import threading import logging from openerp.sql_db import db_connect _logger = logging.getLogger( "CSV_Importer" ) class CSVManager(models.Model): """ This class will be used as an interface for d...
router.py
"""Router - handle message router (base class) Router to manage responses. """ from abc import abstractmethod import logging import threading from typing import Dict, Optional from typing import TYPE_CHECKING import uuid from .message_future import MessageFuture from ..lib import debug_log if TYPE_CHECKING: f...
test_threading_2.py
# testing gevent's Event, Lock, RLock, Semaphore, BoundedSemaphore with standard test_threading from __future__ import print_function from six import xrange setup_ = '''from gevent import monkey; monkey.patch_all() from gevent.event import Event from gevent.lock import RLock, Semaphore, BoundedSemaphore from gevent.th...
utils.py
''' Author: Justin Chen Date: 11/8/2020 ''' import os import re import json import platform import unicodedata import urllib.request from urllib.error import URLError, HTTPError from threading import Thread from multiprocessing import Process, cpu_count from pathlib import Path from tqdm import tqdm from bs4 import Be...
follow_waypoints_path.py
#!/usr/bin/env python import threading import rospy import actionlib from smach import State,StateMachine from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal from geometry_msgs.msg import PoseWithCovarianceStamped, PoseArray ,PointStamped, PoseStamped from nav_msgs.msg import Path from std_msgs.msg import Empt...
redis.py
import functools import logging from threading import Thread import redis from PyQt5.QtCore import QThread, pyqtSignal from surirobot.core.common import ehpyqtSlot, QSuperTimer, State class RedisService(QThread): LISTEN_INTERVAL = 1000 update_state = pyqtSignal(str, int, dict) MODULE_NAME = 'redis' ...
test_fft.py
import functools import numpy as np import pytest import cupy from cupy.fft import config from cupy.fft._fft import (_default_fft_func, _fft, _fftn, _size_last_transform_axis) from cupy import testing from cupy.testing._helper import _wraps_partial @pytest.fixture def skip_forward_backwar...
scheduler.py
import threading from time import time import random import Queue from splunktalib.common import log logger = log.Logs().get_logger("util") class Scheduler(object): """ A simple scheduler which schedules the periodic or once event """ import splunktalib.sortedcontainers as sc max_delay_time = ...
gattclient.py
import os import sys import code import argparse from threading import Thread import gevent from binascii import unhexlify from PyBT.roles import LE_Central from PyBT.gatt_core import Connection, ConnectionError def debug(msg): if os.getenv("DEBUG"): sys.stdout.write(msg) sys.stdout.write("\n") d...
client.py
import socket from tkinter import * from threading import Thread import random from PIL import ImageTk, Image screen_width = None screen_height = None SERVER = None PORT = None IP_ADDRESS = None playerName = None canvas1 = None canvas2 = None nameEntry = None nameWindow = None gameWindow = None leftBoxes = [] rig...
sync.py
# FILE INFO ################################################### # Author: Jason Liu <jasonxliu2010@gmail.com> # Created on July 28, 2019 # Last Update: Time-stamp: <2019-08-19 19:25:26 liux> ############################################################### from collections import defaultdict import multiprocessing as mp...
test_httplib.py
import enum import errno from http import client, HTTPStatus import io import itertools import os import array import re import socket import threading import warnings import unittest from unittest import mock TestCase = unittest.TestCase from test import support from test.support import os_helper from test.support i...
serial_collection.py
# Copyright 2017 Google Inc. All Rights Reserved. # 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 agre...
thread.py
# -*- coding: utf8 -*- import time import threading import urlparse from downloader import Downloader SLEEP_TIME = 1 def threaded_crawler(seed_url, delay=5, cache=None, scrape_callback=None, user_agent='wswp', proxies=None, num_retries=1, max_threads=10, timeout=60): """Crawl this website in multiple threads ...
server.py
# Date: 06/01/2018 # Author: Pure-L0G1C # Description: Server import ssl import socket from os import path from lib import const from time import sleep from queue import Queue from random import randint from OpenSSL import crypto from threading import Thread, RLock from . lib import session, shell, int...
test_cymj.py
import pytest from numbers import Number from io import BytesIO, StringIO import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from mujoco_py import (MjSim, MjSimPool, load_model_from_xml, load_model_from_path, MjSimState, ignore_mujoco...
gezgin.py
import threading import requests from bs4 import BeautifulSoup,element from urllib.parse import quote import datetime as dt class Gezgin(object): def __init__(self,adres,header='Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:79.0) Gecko/20100101 Firefox/79.0',sure=0,yonlendirme=False): self.Adres=adres ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
Untitled-1.py
import re import os import queue import requests from requests.auth import HTTPProxyAuth import time import threading from PyQt4.QtCore import QThread, pyqtSignal, pyqtSlot from PyQt4 import QtCore , QtGui import CusLog from pypac import PACSession log = CusLog.CusLog(CusLog.LOG_INFO,"logs.txt") class...
agent.py
import os import dill import pickle import random import numpy as np import tensorflow as tf from ilurl.utils.default_logger import make_default_logger from ilurl.agents.worker import AgentWorker from ilurl.interfaces.agents import AgentInterface from ilurl.agents.ql.choice import choice_eps_greedy from ilurl.agents....
wsgi.py
import base64 import logging import multiprocessing import os import pickle import re import threading import time from datetime import datetime from email.utils import formatdate from io import BytesIO import pylibmc import requests from c3nav.mapdata.utils.cache import CachePackage from c3nav.mapdata.utils.tiles im...
subproc_vec_env.py
from multiprocessing import Process, Pipe import numpy as np from stable_baselines.common.vec_env import VecEnv, CloudpickleWrapper from stable_baselines.common.tile_images import tile_images def _worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.var() while True:...
client.py
#!/usr/bin/env python3 # -*-encoding: utf-8-*- # created: 02.12.2019 # by David Zashkolny # 3 course, comp math # Taras Shevchenko National University of Kyiv # email: davendiy@gmail.com from .constants import * from .logger import logger from .security import * import threading import socket import pickle import js...
navFunctions.py
''' Author: Sam Schmidt Purpose: navigation functions Date: 02/06/15 - 03/01/15 Dependencies: numpy, scipy, matplotlib, pandas, serial, time, os ''' ###imports from __future__ import division #enables default float division import numpy as np #used for signal processing import scipy.signal as signal #us...
utils.py
from os import path, remove import subprocess from threading import Thread from urllib.parse import urlparse import re from win32com.shell import shell, shellcon from PIL import Image, ImageTk import win32api import win32con import win32ui import win32gui from pytube import YouTube try: ...
http_server.py
#!/usr/bin/env python # Many tests expect there to be an http server on port 4545 servering the deno # root directory. import os import sys from threading import Thread import SimpleHTTPServer import SocketServer from util import root_path from time import sleep PORT = 4545 REDIRECT_PORT = 4546 def server(): os....
plugin.py
import requests.exceptions import time from aqt import mw from aqt.utils import showInfo, askUser, showWarning from aqt.qt import * from anki.utils import splitFields, ids2str from .duolingo_dialog import duolingo_dialog from .duolingo import Duolingo, LoginFailedException from .duolingo_model import get_duolingo_mo...
ftp.py
import os import threading import logging from app.classes.helpers import helper from app.classes.models import Ftp_Srv, MC_settings from pyftpdlib.authorizers import DummyAuthorizer from pyftpdlib.handlers import TLS_FTPHandler from pyftpdlib.servers import ThreadedFTPServer logger = logging.getLogger(__name__) ...
BatchBiogeochemicalReactionModelServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
capture_trajectory.py
import argparse import gym from kuka.env import KukaPoseEnv import numpy as np from pybullet_envs.bullet import KukaGymEnv from util import write_video, ensure_folder from PIL import Image import multiprocessing def get_cli_args(): parser = argparse.ArgumentParser() parser.add_argument('--out', default='tmp/'...
data_buffer_test.py
# Copyright (c) 2019 Horizon Robotics. All Rights Reserved. # # 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 applicab...
Waiters.py
import time import consts import random import logging import requests import threading logger = logging.getLogger(__name__) class Waiters: def __init__(self, dh, i): self.name = f'{dh.name} Waiter-{i}' self.dh = dh self.id = i self.TIME_UNIT = 1 self.initial = True d...
test_debug.py
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
test_signalDelay.py
import pathlib import sys sys.path.insert(0, str(pathlib.Path(__file__).parent.parent)) import logging import multiprocessing as mp from jobmanager import signalDelay import os import signal import time ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) ch.setFormatter(logging.Formatter(fmt="%(asctime)s|%(na...
runner.py
import argparse import json import logging import os import threading import time import traceback import colors import docker import numpy import psutil from ann_benchmarks.algorithms.definitions import (Definition, instantiate_algorithm) from ann_benchmarks.dataset...
test_advanced.py
# coding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function from concurrent.futures import ThreadPoolExecutor import glob import json import logging import os import random import setproctitle import shutil import six import sys import socket import subp...
simple_chat_server.py
# -*- coding: utf-8 -*- """simple_messager_server """ import socket from threading import Thread HOST="0.0.0.0" PORT=8080 HEADER=64 s=socket.socket(family=socket.AF_INET,type=socket.SOCK_STREAM) s.bind((HOST,PORT)) client={} addresses={} def handle_client_in(conn,addr): name_len=int(conn.recv(HEADER).decode('utf8'...
test_concurrent_futures.py
import test.support # Skip tests if _multiprocessing wasn't built. test.support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. test.support.import_module('multiprocessing.synchronize') # import threading after _multiprocessing to raise a more revelant error # message: "No module n...
composed_reader.py
#!/usr/bin/env python3 import logging import sys import threading import time from os.path import dirname, realpath; sys.path.append(dirname(dirname(dirname(realpath(__file__))))) from logger.readers.reader import Reader from logger.transforms.transform import Transform from logger.utils import formats # How long t...
test_database_manager.py
import time import unittest import json import os from database_manager import Database from threading import Thread test_name = "___testing" test_filename = test_name + ".json" test_data = { "1": 1, "test": "test", "list": ["1", 2, {"3": 3}], "dict": {"test": "data"} } class TestDbStatic(unittest.Te...
comm_funcs.py
# -*- coding:utf-8 -*- # /usr/bin/env python """ 公用函数库/类 """ import random import requests import datetime import json import calendar import os import pandas as pd import threading import aiohttp import yaml import akshare as ak import sqlalchemy import smtplib import pymysql from pymysql.cursors import DictCursor fro...
COMP_Crawler.py
# -*- coding:utf-8 -*- #env: python2.7 #not sure for the correctness, at least I can run. import urllib2 import os import re import urllib import multiprocessing def cbk(a, b, c): per = 100.0 * a * b / c if per > 100: per = 100 print '%.2f%%' % per def download(url, name): urllib.urlretr...
manager.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2015 clowwindy # # 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 b...
server.py
from math import floor from world import World import Queue import SocketServer import datetime import random import re import requests import urllib2 import json import sqlite3 import sys import threading import time import traceback import os import signal import boto3 import base64 from botocore.exceptions import Cl...
throttler.py
# -*- coding: utf-8 -*- # Copyright 2016-2021 CERN # # 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 a...
appjar.py
# -*- coding: utf-8 -*- """ appJar.py: Provides a GUI class, for making simple tkinter GUIs. """ # Nearly everything I learnt came from: http://effbot.org/tkinterbook/ # with help from: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html # with snippets from stackexchange.com # make print & unicode backwards ...
main_window.py
#!/usr/bin/env python3 # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including with...
data_utils.py
""" Miscellaneous functions manage data. Date: September 2018 Author: Ignacio Heredia Email: iheredia@ifca.unican.es Github: ignacioheredia """ import os import threading from multiprocessing import Pool import queue import subprocess import warnings import base64 import numpy as np import requests from tqdm import ...
bridge.py
# Copyright 2020 The FedLearner Authors. All Rights Reserved. # # 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 applica...
client.py
from tkinter import * import socket import threading import sys class ChatApplication(): def __init__(self): self.chatroom_size = '750x450+250+100' self.chatroom_title = 'Chatroom' self.backgroungcolor = 'pink' self.chatbox_size = (90, 25) self.messagebox_width = 70 ...
pyshell.py
import sys try: from tkinter import * except ImportError: print( "** IDLE can't import Tkinter.\nYour Python may not be configured for Tk. **" , file=sys.__stderr__) raise SystemExit(1) import tkinter.messagebox as tkMessageBox if TkVersion < 8.5: root = Tk() root.withdraw() tkMe...
webcamvideostream.py
# import the necessary packages from threading import Thread import cv2 class WebcamVideoStream: def __init__(self, src=0, name="WebcamVideoStream"): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.rea...
kb_MetricsServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...