source
stringlengths
3
86
python
stringlengths
75
1.04M
main.py
# -*- coding:utf-8 -*- from PythonMiddleware.notify import Notify from PythonMiddleware.graphene import Graphene from PythonMiddlewarebase.operationids import operations #import base64 # from PythonMiddlewarebase import memo #from PythonMiddleware.block import Block #from PythonMiddleware.account import Account, Accou...
main_window.py
#!/usr/bin/env python # # 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 witho...
service_manager.py
# Copyright (c) 2019, The Regents of the University of California # 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, thi...
proc.py
from __future__ import annotations import atexit import signal from functools import partial from multiprocessing import Process from pathlib import Path from platform import platform from sys import exit from typing import Any, Callable, Optional, Set, Union from weakref import finalize as finalizer PLATFORM: str = ...
sl.py
# Speed Limit Signal Recognition ## Link to yt video: https://youtu.be/6PDmYAtLAKQ?t=148 import sys import os sys.path.append("../classes") sys.path.append("../lib") from camera import Camera from servo import Servo from romi import Romi from slLib import * from a_star import AStar from threading import Thread...
my_ext_gui.py
# Demonstration code for a new external gui appliction, which could be # implemented using any cross-platform Python GUI (Tkinter, wxPython, # # To get started: # # (1) Copy this file into PyMOL/modules # (or create a subdirectory with prefix and rename this file to # __init__.py inside it: "my_ext_gui/__init__.p...
omegav.py
import requests import time import threading from datetime import datetime from datetime import timedelta class Py3status: def post_config_hook(self): """ Runs the first time py3statusbar is initialized """ self.thread_started = False self.time = None self.st...
utils.py
import threading import mailchimp from django.conf import settings class SendSubscriberMail(object): def __init__(self, email): self.email = email thread = threading.Thread(target=self.run, args=()) thread.daemon = True thread.start() def run(self): API_KEY = settings....
cron.py
""" Cron class to schedule jobs to be done """ import datetime import time import schedule from threading import Thread from .singleton import Singleton class Cron(metaclass=Singleton): """ All you need to do is init Cron class: cron = Cron() Then add tasks to schedule ...
caching_test.py
# Copyright 2018-2022 Streamlit 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 wr...
thread_practice.py
''' Python线程机制 Thread target参数如何使用? 如何实现多线程? thread.join()函数? ''' import threading import time def run(): time.sleep(2) print('当前线程的名字是: ', threading.current_thread().name) time.sleep(2) if __name__ == '__main__': start_time = time.time() print('这是主线程:', threading.current_thread().name) ...
idf-mt.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Image Duplicate finder Uses https://pypi.org/project/ImageHash/ Image Datasets https://lionbridge.ai/datasets/5-million-faces-top-15-free-image-datasets-for-facial-recognition/ """ from PIL import Image import imagehash import glob, queue import threading '''Locatio...
hash.py
#!/usr/bin/env python """ Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/) See the file 'LICENSE' for copying permission """ from __future__ import print_function try: from crypt import crypt except: # removed ImportError because of https://github.com/sqlmapproject/sqlmap/issues/3171 from thir...
tf-30.py
#!/usr/bin/env python import re, sys, operator, queue, threading # Two data spaces word_space = queue.Queue() freq_space = queue.Queue() stopwords = set(open('../stop_words.txt').read().split(',')) # Worker function that consumes words from the word space # and sends partial results to the frequency space def proces...
manager.py
from cloudbutton.multiprocessing import Process, Manager def f(d, l): d[1] = '1' d['2'] = 2 d[0.25] = None l.reverse() if __name__ == '__main__': with Manager() as manager: d = manager.dict() l = manager.list(range(10)) p = Process(target=f, args=(d, l)) p.start(...
main.py
from ximea import xiapi from imutils.video import FPS, fps import cv2 import numpy as np import time import multiprocessing from multiprocessing import Pool, Queue, Pipe,Value import sys,os import pickle import matplotlib import matplotlib.pyplot as plt from scipy.optimize import leastsq import usbtmc from numba impor...
pokeslack.py
#!/usr/bin/python # -*- coding: utf-8 -*- import flask from flask import Flask, render_template from flask_googlemaps import GoogleMaps from flask_googlemaps import Map from flask_googlemaps import icons import os import codecs import re import sys import struct import json import requests import argparse import getpa...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
benchmark.py
# -*- coding: utf-8 -*- import time import sys import argparse sys.path.append('../') from multiprocessing import Process, Value from tornado import ioloop, gen from torpc import RPCServer, RPCClient from example_utils import log_initialize def rpc_server_entry(rpc_address): log_initialize() server = RPCSe...
rpc_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
base_test.py
# -*- coding: utf-8 -*- import contextlib import copy import datetime import json import threading import elasticsearch import mock import pytest from elasticsearch.exceptions import ElasticsearchException from elastalert.enhancements import BaseEnhancement from elastalert.kibana import dashboard_temp from elastalert...
ipc.py
import os import sys import threading import time from .compat import WIN if WIN: # pragma: no cover import msvcrt from . import winapi class ProcessGroup(object): def __init__(self): self.h_job = winapi.CreateJobObject(None, None) info = winapi.JOBOBJECT_BASIC_LIMIT_IN...
plugin.py
import base64 import re import threading from binascii import hexlify, unhexlify from functools import partial from electrum.bitcoin import (bc_address_to_hash_160, xpub_from_pubkey, public_key_to_bc_address, EncodeBase58Check, TYPE_ADDRESS, TYPE_SCRIPT) fro...
base.py
import argparse import base64 import copy import itertools import json import multiprocessing import os import re import sys import threading import time import uuid import warnings from collections import OrderedDict from contextlib import ExitStack from typing import ( TYPE_CHECKING, Dict, List, Optio...
030.py
#!/usr/bin/python # -*- coding: utf-8 -*- '''' 多进程 ''' from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print('Run child process %s (%s)...' % (name, os.getpid())) if __name__=='__main__': print('Parent process %s.' % os.getpid()) p = Process(target=run_proc, args=('test',))...
data_io.py
########################################################## # pytorch-kaldi v.0.1 # Mirco Ravanelli, Titouan Parcollet # Mila, University of Montreal # October 2018 ########################################################## import numpy as np import sys from utils import compute_cw_max, dict_fea_lab_arch, is_sequential...
mock_checksystem.py
#!/usr/bin/env python3 import logging import socket import string import threading log_format = '%(asctime)s %(levelname)s %(message)s' logging.basicConfig(format=log_format, datefmt='%H:%M:%S', level=logging.DEBUG) def handle_client(sock): sock.sendall(b'Hello\nEnter your flags\n') while True: fl...
test_lock_file.py
import time import multiprocessing as mp from aql_testcase import AqlTestCase, skipped from aql.utils import Tempfile, FileLock, ErrorFileLocked from aql.utils.aql_lock_file import GeneralFileLock # ============================================================================== def write_process(filename, event, lo...
conftest.py
import atexit from contextlib import contextmanager import logging import os import platform import queue import shutil import subprocess import sys import tempfile import time import threading from unittest import mock from unittest.mock import MagicMock import urllib import click from click.testing import CliRunner ...
tuq_cluster_ops.py
import time import threading import json from security.auditmain import audit from tuqquery.tuq_join import JoinTests from remote.remote_util import RemoteMachineShellConnection from membase.api.rest_client import RestConnection from membase.helper.cluster_helper import ClusterOperationHelper from backuptests import Ba...
main.py
#!/usr/bin/env python3 import configparser import sys from argparse import ArgumentParser import os import termios import re from typing import List RootDir = "." Sources = [] # type: List[str] Blacklist = [] FileWhitelist = [] SkipShodan = False DownloadOnly = False Args = None reloadHandlers = [] def prepare_st...
test_change_stream.py
# Copyright 2017 MongoDB, 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 writing, so...
facade00mainprogram.py
#!/usr/bin/env python3 # Copyright 2016-2018 Brian Warner # # 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...
step_4_speaker_determination.py
# -*- coding: utf-8 -*- """ Created on Sat Aug 21 11:56:23 2021 @author: roman """ ###################### # use a set threshold for speaker recognition threshold = 0.45 # in prod this will be a part of global config # URL for downstream service to call.... ABStopic_daemon_url = 'http://127.0.0.1:5003/' # in prod th...
BlacklistWordReward_StreamlabsSystem.py
# -*- coding: utf-8 -*- #--------------------------- # Import Libraries #--------------------------- import clr, codecs, json, os, re, sys, threading, datetime, math clr.AddReference("IronPython.Modules.dll") sys.path.append(os.path.dirname(os.path.realpath(__file__)) + r"\References") clr.AddReference(r"TwitchLib...
MeshAlgoDistributePointsTest.py
########################################################################## # # Copyright (c) 2011, Image Engine Design 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: # # * Redistribu...
ParallelSquareSumServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
SpotDiff.py
import json import logging import os import queue import threading import asyncio import collections import time from copy import copy curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] rootPath = os.path.split(rootPath)[0] os.sys.path.append(rootPath) from dquant.common.alarms...
keyboard_ctrl.py
import sys import termios import time from termios import (BRKINT, CS8, CSIZE, ECHO, ICANON, ICRNL, IEXTEN, INPCK, ISTRIP, IXON, PARENB, VMIN, VTIME) from typing import NoReturn # Indexes for termios list. IFLAG = 0 OFLAG = 1 CFLAG = 2 LFLAG = 3 ISPEED = 4 OSPEED = 5 CC = 6 STDIN_FD = sys.stdin.f...
dblp.py
import bisect import logging import random import threading import Stemmer import numpy as np import nltk from sklearn.preprocessing import MinMaxScaler nltk.download('stopwords') from nltk.corpus import stopwords as stop_words from scipy import sparse from .utils import Indexer, create_sparse path = 'th' paper_thre...
main_window.py
#!/usr/bin/env python # # 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 witho...
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 sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fu...
Tarea_(2).py
from threading import Semaphore, Thread from random import random from time import sleep from time import time num_hilos = 6 cont = 0 mutex = Semaphore (1) torniquete = Semaphore(0) conexion = Semaphore (10) def jefe(id, torniquete): global cont, mutex print("\n Recibiendo solicitudes de conexión de red %d ...
events.py
import datetime import io import threading import time from os import environ import avro.io import avro.schema from confluent_kafka import Producer, Consumer, KafkaError from confluent_kafka.admin import AdminClient, NewTopic, NewPartitions from eslogger import Logger class MessageException(Exception): def __i...
pool.py
# # Module providing the `Pool` class for managing a process pool # # multiprocessing/pool.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # # Modifications Copyright (c) 2020 Uber Technologies """ *Pools* are supported by Fiber. They allow the user to manage a pool of worker...
qt.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 Thomas Voegtlin # # 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...
gps.py
# -*- coding: utf-8 -*- from __future__ import print_function import math import time import serial import threading class Filter(): def __init__(self): self.v = 0.0 self.yaw = 0.0 self.x = 0.0 self.y = 0.0 self.last_t = time.time() self.cnt = 0 self.INIT_ST...
archiver.py
import argparse import dateutil.tz import errno import io import json import logging import os import pstats import random import re import shutil import socket import stat import subprocess import sys import tempfile import time import unittest from binascii import unhexlify, b2a_base64 from configparser import Config...
runGame.py
import os import threading from time import sleep PATH_SERVER = "Server" AGENTS = "TUC_TAC,temporaryName" # Key: Agent's name. Value: [Agent's path, Binaries] # AGENT_INFO = {"TUC_TAC": ["brokers/TUC_TAC", "TUC_TAC_2020.jar"], # "DiCaprio": ["brokers/DiCaprio", "DiCaprio-1.7.0.jar"], # ...
index.py
from server import app from flask import render_template, flash, jsonify, request, redirect from threading import Thread from server.tasks import process_video from flask_cors import CORS, cross_origin import os, uuid cors = CORS(app) app.config['CORS_HEADERS'] = 'Content-Type' ALLOWED_EXTENSIONS = {'mp4', 'avi', 'mp...
fumadores_v2.py
#!/usr/bin/python3 # # Versión corregida del problema de los fumadores compulsivos: Agrega # a un arreglo de intermediarios para arbitrar entre los fumadores. import time import random import threading # Los requisitos del problema establecen que no se debe modificar al # agente. def agente(): while True: ...
server.py
import backoff import grpc import logging import queue import redis import threading import time import uuid import log from battleships_pb2 import Attack, Response, Status from battleships_pb2_grpc import BattleshipsServicer from game import Game from message import Message logger = log.get_logger(__name__) logger.se...
real_time_data.py
""" PyXLL Examples: Real time data As well as returning static values from functions, PyXLL functions can return special 'RTD' instances that can notify Excel of updates to their value. This could be used for any real time data feed, such as live prices or the status of a service. """ from pyxll import RTD, xl_func, ...
miniterm.py
#!d:\documentshdd\pythonworkshopcedt\physyncbridge\physyncenvwin\scripts\python.exe # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import codecs import os import sys imp...
my_serverwork.py
""" 任务:写一个web服务器 1、导入模块socket\threading\sys 2、建立套接字对象 3、地址重写 3、绑定端口号 4、设置监听,套接字由主动变被动 5、接受浏览器的链接accept 6、接收浏览器的请求 8、查找请求目录 9、发送响应报文 10、结束与浏览器的链接 """ import socket import threading import sys from application import app class HttpServer(object): """服务器类""" def __init__(self): self.tcp_server_socket = ...
test_system.py
# Copyright 2016 Google LLC 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 ag...
multiprocessing.py
from multiprocessing import Process def run_mp(fn, args): """ Args: fn: function to be run into multiprocess way args: tuple of args --> (arg1. arg2, ...) Returns: """ proc = Process(target=fn, args=args) proc.start() proc.join()
login.py
# # Copyright (c) 2018, Pruthvi Kumar 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 follo...
QKeithleyBiasWidget.py
# --------------------------------------------------------------------------------- # QKeithleyBiasWidget -> QWidget # Copyright (C) 2019 Michael Winters # github: https://github.com/mesoic # email: mesoic@protonmail.com # --------------------------------------------------------------------------------- # # Permiss...
listener.py
#! /usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import os import json import time import threading import requests import typing as t from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer class _Handler(BaseHTTPRequestHandler): """ Request handler ...
main.py
import csv import re import sys import subprocess import psycopg2 import json from pg_query import Node, parse_sql import math import threading import datetime import time import itertools #### PARSING QUERY PLAN ################################################## ######################################################...
Server.py
# -*- encoding: utf-8 -*- import socket import threading import sys from PyQt5.QtWidgets import QApplication,QWidget from time import gmtime, strftime class Server: def __init__(self, host, port): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock = sock self.so...
meiju.py
# -*- coding:utf-8 -*- import requests import re import sys import threading import time reload(sys) sys.setdefaultencoding('utf-8') class Archives(object): def save_links(self,url): try: data=requests.get(url,timeout=3) content=data.text link_pat='"(ed2k://\|fil...
scanform_shipments_from_batch.py
import os import time from threading import Thread import easypost from dotenv import load_dotenv # Iterate through shipments from a batch one by one and concurrently # scanform them. Great when you have a troubled batch and don't know # which shipments are bad. # # Usage: EASYPOST_TEST_API_KEY=123... BATCH=batch_123...
synchronous-concurrency-1.py
import sys from queue import Queue from threading import Thread lines = Queue(1) count = Queue(1) def read(file): try: for line in file: lines.put(line) finally: lines.put(None) print(count.get()) def write(file): n = 0 while 1: line = lines.get() if li...
torrent.py
import socket import ipaddress import sys import select import threading import queue import time import os from threading import Thread # global inits bufferSIZE = 1500 ip = socket.gethostbyname(socket.gethostname()) HOST = ip PORT = int(sys.argv[1]) PACKET_COUNTS = [] COUNT = -1 TRANSFER_FI...
base.py
""" Module containing base classes that represent object entities that can accept configuration, start/stop/run/abort, create results and have some state. """ import os import sys import signal import time import threading import psutil import traceback from collections import deque, OrderedDict from schema import Or...
EDL.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import re from base64 import b64decode from multiprocessing import Process from gevent.pywsgi import WSGIServer from tempfile import NamedTemporaryFile from flask import Flask, Response, request from netaddr import IPAd...
scripts_regression_tests.py
#!/usr/bin/env python """ Script containing CIME python regression test suite. This suite should be run to confirm overall CIME correctness. """ import glob, os, re, shutil, signal, sys, tempfile, \ threading, time, logging, unittest, getpass, \ filecmp, time, atexit from xml.etree.ElementTree import ParseEr...
utils.py
import json import functools import logging # noqa import os import re import subprocess as sp import sys import urllib.request import urllib.error import urllib.parse from pathlib import Path from threading import Thread, Lock # installer modules from . import menus from .config import COLORS, get_logger, CONFIG_FILE,...
__init__.py
''' UnrealCV ======== Provides functions to interact with games built using Unreal Engine. >>> import unrealcv >>> (HOST, PORT) = ('localhost', 9000) >>> client = unrealcv.Client((HOST, PORT)) ''' import sys, ctypes, struct, threading, socket, re, time, logging try: from Queue import Queue except: from queue i...
bridge.py
#!/usr/bin/env python # # Copyright (c) 2018-2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # """ Rosbridge class: Class that handle communication between CARLA and ROS """ try: import queue except ImportError: impor...
unittest_targets.py
#!/usr/bin/env python3 # # Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # # 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 # ...
test_mq.py
''' Copyright (c) 2013 Qin Xuye <qin@qinxuye.me> 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 wr...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
test_rest_v2_0_0.py
import json import os import random import string import subprocess import sys import time import unittest from multiprocessing import Process import requests from dateutil.parser import parse from test.apiv2.rest_api import Podman PODMAN_URL = "http://localhost:8080" def _url(path): return PODMAN_URL + "/v2.0...
test_dispatcher.py
from __future__ import print_function, division, absolute_import import errno import multiprocessing import os import platform import shutil import subprocess import sys import threading import warnings import inspect import pickle import weakref try: import jinja2 except ImportError: jinja2 = None try: ...
main.pyw
from PyQt5.QtWidgets import QMainWindow, QApplication from PyQt5 import QtWidgets, QtGui, QtCore from PyQt5 import uic import os, sys from threading import Thread from queue import Queue, Empty from random import randint from torrequest_fix import TorRequest import json import re from tkinter import messagebo...
main.py
#!/usr/bin/env python3 import operator import sys from collections import defaultdict, namedtuple from queue import Empty, Queue from threading import Thread Vec2D = namedtuple("Vec2D", ["x", "y"]) class Memory(list): def __getitem__(self, index): if index >= len(self): self.extend([0] * (in...
bot.py
# -*- coding: utf-8 -*- # Importing a TON of shit import asyncio from zipfile import ZipFile import datetime from datetime import timedelta import databaseworker as db import random import re import signal import subprocess import time from contextlib import contextmanager import emoji import psutil import requests imp...
aionfpga.py
#!/usr/bin/env python3 '''aionfpga ~ aionfpga Copyright (C) 2020 Dominik Müller and Nico Canzani ''' import math import ctypes from threading import Thread import cv2 import numpy as np from ui import UI import fhnwtoys.inference as fh # returns the rectangular window function def rect_window(): window = np.o...
tree-orders.py
# python3 import sys, threading sys.setrecursionlimit(10**6) # max depth of recursion threading.stack_size(2**27) # new thread will get stack of such size class TreeOrders: def read(self): self.n = int(sys.stdin.readline()) self.key = [0 for i in range(self.n)] self.left = [0 for i in range(self.n)] ...
ContextTest.py
########################################################################## # # Copyright (c) 2012, John Haddon. 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 so...
client.py
from base64 import b64encode from engineio.json import JSONDecodeError import logging import queue import signal import ssl import threading import time import urllib try: import requests except ImportError: # pragma: no cover requests = None try: import websocket except ImportError: # pragma: no cover ...
username_checker.py
import json from queue import Queue import threading from urllib.error import HTTPError from urllib.request import urlopen from urllib.parse import urlparse url_list = [ "https://keybase.io/{username}", "https://github.com/{username}", "https://replit.com/@{username}", ] queue = Queue() domain_status = [] ...
dag_chainer.py
CONSTANT_MATCH_SCORE=None MAX_MATCH_SCORE=50.0 import math from subprocess import Popen, PIPE import os op = os.path PATH = op.dirname(op.abspath(__file__)) import sys sys.path.insert(0, PATH) from dagtools import DagLine import collections import operator #try: # from processing import Process, Pipe as mPipe ...
test_xmlrpc.py
import base64 import datetime import sys import time import unittest import xmlrpclib import SimpleXMLRPCServer import mimetools import httplib import socket import StringIO import os import re from test import test_support try: import threading except ImportError: threading = None try: import gzip except...
server.py
# Author: Martin Klamrowski # Last modified: 5/12/2018 import socket, time, sqlite3, logging, sys, threading, datetime class ApplicationServer(): """ This class models the behaviour of the server for the You Safe Bolt system. The communication protocol is described in the README. To run the serv...
session_debug_testlib.py
# Copyright 2016 The TensorFlow 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...
test_threadsafety.py
""" A little note on how these tests work: Almost all asyncio objects are not thread-safe, as per the official doc. This includes `asyncio.Queue`. This queue is used for k8s-event posting. K8s-events are posted via ``kopf.event()`` and similar calls, and also via ``logger.info()`` for per-object logging messages. Th...
login.py
#!/usr/bin/python import os from os.path import expanduser from glob import glob from util import * import threading import time import subprocess import win32api import win32process from win32con import * """ @job def MountTruecrypt(): truecrypt = "C:/Program Files/TrueCrypt/TrueCrypt.exe" if not...
__init__.py
from queue import Queue from threading import Thread import numpy as np import tensorflow as tf from . import modeling, tokenization from ...base import * class BertModel(BaseModel): def __init__(self, verbose=False, **kwargs): super().__init__(**kwargs) self.download() self.output_q = Q...
views.py
import django from django.shortcuts import render, get_object_or_404, redirect from django.urls import reverse from django.http import HttpResponse, JsonResponse from django.contrib.auth import authenticate, login, logout from django.core.files import File from django.contrib import messages from django.db.models impor...
host_callback_test.py
# Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
poppy_rank.py
#!/usr/bin/env python3 # Import modules import sys import argparse import multiprocessing as mp import time from datetime import timedelta as delta import threading import re from itertools import product from decimal import Decimal import json import hashlib import pandas as pd from equilibrator_api import ComponentC...
intervention.py
import RPi.GPIO as GPIO import time import datetime import subprocess import multiprocessing # !IMPORTANT! assign unique name to device deviceName = "jezelf" # !IMPORTANT! max recording time in seconds maxRecordTime = 300 inPinA = 12 inPinB = 16 inPinC = 20 inPinD = 21 outPinA = 6 outPinB = 13 outPinC = 19 outPinD =...
async_printing.py
#!/usr/bin/env python # coding=utf-8 """ A simple example demonstrating an application that asynchronously prints alerts, updates the prompt and changes the window title """ import random import threading import time from typing import List import cmd2 from cmd2 import fg, style ALERTS = ["Watch as this application p...
IOBoard.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' MIT License Copyright (c) [2016] [POLYGON Team Ltd.] 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...
engine.py
# This file is part of the python-chess library. # Copyright (C) 2012-2020 Niklas Fiekas <niklas.fiekas@backscattering.de> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of t...
core_agent_state_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # # 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 ...