source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
trezor.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_nmc.util import bfh, bh2u, versiontuple, UserCancelled
from electrum_nmc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, is_address)
from electrum_nmc import constants
fr... |
test_utils.py | # Copyright BigchainDB GmbH and BigchainDB contributors
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
# Code is Apache-2.0 and docs are CC-BY-4.0
import queue
from unittest.mock import patch, call
import pytest
pytestmark = pytest.mark.tendermint
@pytest.fixture
def mock_queue(monkeypatch):
class Mock... |
skipgram.py | from __future__ import division # py3 "true division"
"""
Modified by Yikai Wang
"""
import logging
import sys
import os
import heapq
import copy
import numpy as np
from timeit import default_timer
from copy import deepcopy
from collections import defaultdict
import threading
import itertools
try:
from queue imp... |
test_proactor.py | from toga_winforms.libs import proactor, WinForms
import unittest
import unittest.mock as mock
import asyncio
from threading import Thread
class Counter(object):
def __init__(self):
self.count = 0
def increment(self):
self.count += 1
class TestProactor(unittest.TestCase):
def setUp(self... |
discover.py | import asyncio
import re
import socket
from threading import Thread
from typing import Optional
from aiohttp import ClientSession
from zeroconf import ServiceBrowser, Zeroconf
from .devices_repository import CoolkitDevicesRepository
from .device import CoolkitDevice
from .log import Log
from .session import CoolkitSe... |
train_faster_rcnn_alt_opt_800.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Faster R-CNN network using alternat... |
detector_app.py | import io
import base64
import sys
import tempfile
import cv2
import time
import argparse
import datetime
import numpy as np
from queue import Queue
from threading import Thread
MODEL_BASE = '/home/anoop/models/research'
sys.path.append(MODEL_BASE)
sys.path.append(MODEL_BASE + '/object_detection')
sys.path.append(MODE... |
connection.py | from json import dumps, loads
from logging import getLogger
from threading import Thread
from .api import aggregate
from .protocol import *
__all__ = ["Connection"]
class Connection(object):
"""Handles an open connection between the server and the JS client."""
def __init__(self, socket, database):
... |
dataset.py | # Copyright 2020 - 2021 MONAI Consortium
# 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 wri... |
executor.py | #!/usr/bin/env python3
from gi.repository import GLib
import subprocess
import threading
from nwg_panel.tools import check_key, update_image
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk, Gdk, GdkPixbuf
class Executor(Gtk.EventBox):
def __init__(se... |
reader.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
plotting.py | """
vtk plotting module
"""
from multiprocessing import Process
import colorsys
import numpy as np
import vtkInterface
import imageio
import time
import logging
from PIL import Image
log = logging.getLogger(__name__)
log.setLevel('CRITICAL')
try:
import vtk
from vtk.util import numpy_support as VN
font_... |
S7Logger.py | # Only Bool-type of memory values supported!
# for taglists.txt: show all columns, select all (CTRL+A) and paste to notepad
# columns should be in following order: Name, Tag table, Data type, Address
# tags export to xlsx is not supported
# If there is need to debug, enable this
# logging.basicConfig(level=log... |
supreme.py | import os
import json
import logging
import threading
from harvester import Harvester
from main import run_all
def profiles_exist(profiles_file):
"""
個人情報存在チェック
"""
with open(profiles_file) as f:
profiles = json.load(f)
if profiles:
return True
def tasks_exist(tasks_file):
"""... |
evaluation.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pickle
from queue import Queue
import os
import sys
from threading import Thread, stack_size as set_thread_stack_size
from typing import Tuple
from mathics_scanner import TranslateError
from mathics import settings
from mathics.core.expression import ensure_con... |
timeclient.py | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
from socket import *
from threading import Thread
def gettime(address):
sock = socket(AF_INET,SOCK_STREAM)
sock.connect(address)
tm = sock.recv(1024)
sock.close()
print("The time is %s" % tm.decode('ascii'))
t1 = [ Thread(target=gettime, args=(('localh... |
merger.py | #!/usr/bin/env python
from glob import glob
from accessoryFunctions.accessoryFunctions import *
import shutil
__author__ = 'adamkoziol'
def relativesymlink(src_file, dest_file):
"""
https://stackoverflow.com/questions/9793631/creating-a-relative-symlink-in-python-without-using-os-chdir
:param src_file: ... |
test_processor.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by Exopy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------------... |
batch_env_factory.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# 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... |
test_complete.py | import multiprocessing
import os
import time
from unittest import mock
import requests
from coworks.utils import import_attr
class TestClass:
@mock.patch.dict(os.environ, {"FLASK_RUN_FROM_CLI": "false", "AWS_XRAY_SDK_ENABLED": "false"})
def test_run_complete(self, samples_docs_dir, unused_tcp_port):
... |
monitor.py | # Automatically restart when the source code changes.
# From http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode
import os
import sys
import time
import signal
import threading
import atexit
import Queue
_interval = 1.0
_times = {}
_files = []
_running = False
_queue = Queue.Queue()
_lock = threading.Lock()
d... |
__init__.py | """
# an API for Meshtastic devices
Primary class: SerialInterface
Install with pip: "[pip3 install meshtastic](https://pypi.org/project/meshtastic/)"
Source code on [github](https://github.com/meshtastic/Meshtastic-python)
properties of SerialInterface:
- radioConfig - Current radio configuration and device setting... |
extract_feature.py | import modeling
import tokenization
from graph import optimize_graph
import args
from queue import Queue
from threading import Thread
import tensorflow as tf
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
class InputExample(object):
def __init__(self, unique_id, text_a, text_b):
self.unique_id = uni... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018-2020 The thecoffeecoins Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test thecoffeecoinsd shutdown."""
from test_framework.test_framework import thecoffeecoinsTestF... |
app.py | from flask import Flask
from sentence_extractor.token_ext_runner import extract_tokens_thread
from sentence_extractor.sentence_ext_runner import extract_sentences_thread
from machine_translator.machine_translator_runner import translation_fetcher_and_writer_thread
from machine_translator.machine_translator_runner impo... |
bulk_odk.py | import requests
import xmltodict
import time
from threading import Thread
from queue import Queue
# Recommended use: copy this script inside the nest container, because /upload
# hasn't been opened to the outside.
username = "username"
password = "password"
aggregate_url = "https://aggurl.info"
form_id = "form_id"
n... |
build_docs.py | import glob
import os
import shutil
from pathlib import Path
from subprocess import check_output
from threading import Thread
from typing import Dict, Union, Optional, Set, List, Sequence, Mapping
from git import Git
from ruamel.yaml import YAML # type: ignore
from constants import ABS_PATH_OF_TOP_LEVEL_DIR
class ... |
benchmark_echo.py | from gevent.server import StreamServer
import gevent
from gevent import socket, spawn
from gevent import queue
import multiprocessing
import time
import os
"""
(4765, 'New connection from 127.0.0.1:59612')
on reader..
on writer..
call: 762043 KB/s, dt=1.2598
client: socker Close and sleep gevent for 0.5 sec
server: t... |
testing.py | #############################################################################
#
# Copyright (c) 2004-2009 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS... |
smartzone_exporter.py | # requests used to fetch API data
import requests
# Allow for silencing insecure warnings from requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
# Builtin JSON module for testing - might not need later
import json
# Needed for sleep and exporter start/end time metrics
import time
# ar... |
train_runner.py | # Copyright 2018 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... |
roomba.py | from __future__ import division
# @modified 20191115 - Branch #3262: py3
# from os import kill, getpid
from os import kill
from redis import StrictRedis, WatchError
from multiprocessing import Process
from threading import Thread
from msgpack import Unpacker, packb
try:
from types import TupleType
except ImportErr... |
Progression.py | from typing import Set
from PIL import Image, ImageTk
from tkinter.ttk import Style, Progressbar, Combobox
from tkinter import messagebox
import tkinter
import time
import subprocess
import threading
import os
import webbrowser
import Utils
import Settings
threading.excepthook = Utils.thread_exceptions
class Progre... |
widget.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
The widget is called from web2py.
"""
import datetime
import sys
import cStringIO
import time
import threa... |
multiprocessing_env.py | # This code is from openai baseline
# https://github.com/openai/baselines/tree/master/baselines/common/vec_env
import numpy as np
from multiprocessing import Process, Pipe
from gym import spaces
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while True:... |
__init__.py | #!/usr/bin/python3 -OO
# Copyright 2007-2021 The SABnzbd-Team <team@sabnzbd.org>
#
# 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 2
# of the License, or (at your option) any late... |
replicatorsrc.py | import sys
sys.path.append("../")
from threading import Thread
from common.zmqHelper import zhelper
from common.util import readVideo
import zmq
import progressbar
from appconfig import KEEPERS_TO_KEEPERS_REPL_PORT as KEEPERS_TO_KEEPERS_PORT, TRACKER_IP, TRACKER_PORTS
class ReplicatorSrc:
def __init__(self, port):
... |
packet_capture.py | """
Thread that continuously captures and processes packets.
"""
import scapy.all as sc
import threading
import time
from host_state import HostState
import utils
class PacketCapture(object):
def __init__(self, host_state):
assert isinstance(host_state, HostState)
self._host_state = host_state... |
video_ffpyplayer.py | '''
FFmpeg based video abstraction
==============================
To use, you need to install ffpyplyaer and have a compiled ffmpeg shared
library.
https://github.com/matham/ffpyplayer
The docs there describe how to set this up. But briefly, first you need to
compile ffmpeg using the shared flags while disabling... |
connection_test.py | import demistomock as demisto
from Active_Directory_Query import main, group_dn
import socket
import ssl
from threading import Thread
import time
import os
import pytest
import json
from IAMApiModule import *
from unittest.mock import patch
BASE_TEST_PARAMS = {
'server_ip': '127.0.0.1',
'secure_connection': '... |
vntr_finder.py | import logging
import numpy
import os
from multiprocessing import Process, Manager, Value, Semaphore
from random import random
from uuid import uuid4
import pysam
from Bio import pairwise2
from Bio.Seq import Seq
from blast_wrapper import get_blast_matched_ids, make_blast_database
from coverage_bias import CoverageBi... |
test_opencypher_query_without_iam.py | """
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
"""
import json
import threading
import logging
import time
import requests
from requests import HTTPError
from test.integration.DataDrivenOpenCypherTest import DataDrivenOpenCypherTest
logger = logging.getLogg... |
core.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/9/20 0020 9:23
# @Author : Hadrianl
# @File : core.py
# @Contact : 137150224@qq.com
import websocket as ws
import gzip as gz
import json
from . import utils as u
from .utils import logger, zmq_ctx
from threading import Thread
import datetime as dt... |
enumerate-thread.py | from time import sleep, perf_counter
from threading import Thread, enumerate
start = perf_counter()
def show(name):
print(f'Starting {name} ...')
print(enumerate())
sleep(3)
print(f'Finishing {name} ...')
t1 = Thread(target=show, args=('One',), name='First')
t2 = Thread(target=show, args=('Two',), ... |
hover.py | # When I wrote this, only God and I understood what I was doing
# Now, God only knows
import time, sys
from threading import Thread
#FIXME: Has to be launched from within the example folder
sys.path.append("/home/jonathan/Programs/crazyflie/cfclient-2014.01.0/lib")
import cflib
from cflib.crazyflie import Crazyflie
... |
patch_master.py | #!/usr/bin/env python
import sys
import os
import logging
import resource
import traceback
import timeout_decorator
import itertools
import psutil
import multiprocessing
import subprocess
import random
import concurrent.futures
import datetime
import tempfile
import termcolor
import traceback
import time
import cPickl... |
dataloader.py | import math
import torch
from dataset_file import DatasetFile
from converter import ImageConverter, LabelConverter, FlexibleLabelConverter
class CustomDataloader(object):
def __init__(self, dataset='mnist.dataset', batch_size=16, fold='train', shuffle=True, last_batch=False, example_count=None, **kwargs):
... |
guiplus.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
import os, sys, threading, time
fro... |
schedule_every_n_sec.py | import time
from threading import Thread
class Scheduler:
"""
Every n seconds, start executing the given function.
"""
def __init__(self, n, function, *args, **kwargs):
def target():
while self.flag:
function(*args, **kwargs)
time.sleep(n)
... |
panorama.py | import logging
try:
from Queue import Empty
except:
from queue import Empty
from time import time, sleep
from threading import Thread
# @modified 20190522 - Task #3034: Reduce multiprocessing Manager list usage
# Use Redis sets in place of Manager().list() to reduce memory and number of
# processes
# from multi... |
run.py | from node import Node
import threading
f = open("input", 'r')
lines = f.readlines()
n = int(lines[0])
nodes = {}
for i in range(1, n+1):
nodes[i] = Node(uid=i, network_size=n)
uid = -1
for i in range((n * n) + 1):
if len(lines[i].split()) == 4:
tokens = lines[i].split()
uid = int(tokens[0... |
cctvbruter.py | #!/usr/bin/python
# Bruteforce tool for CCTV RCE Exploit
# You don't have to edit anything.
import urllib.request, threading, socket, time, sys
if len(sys.argv) != 2:
print("Correct useage: python " + sys.argv[0].split("\\").pop() + " <thread count> ")
sys.exit()
lock, finalprintout, timeout, creds, thread... |
run_worker.py | import multiprocessing
import time
import argparse
from workers.km_worker import start_worker
import workers.loaded_index as li
parser = argparse.ArgumentParser()
parser.add_argument('-w', '--workers', default=1)
args = parser.parse_args()
def start_workers(do_multiprocessing = True):
n_workers = args.workers
... |
utils.py | import numpy as np
from random import seed, shuffle
import loss_funcs as lf # our implementation of loss funcs
from scipy.optimize import minimize # for loss func minimization
from multiprocessing import Pool, Process, Queue
from collections import defaultdict
from copy import deepcopy
import matplotlib.pyplot as plt #... |
File Transfer.py | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import threading
import time
import shutil
# In[ ]:
def copyfunc(src,dst):
shutil.copytree(src,dst)
# In[ ]:
start = time.time()
src="E:\\"
dst="F:\\"
threads = []
for file in os.listdir(src):
t = threading.Thread(target=copyfunc,args=(src+file,dst+"abcd... |
smiler.py | import os
import sys
import subprocess
import re
import shutil
import threading
import signal
import logging
import time
sys.path.extend(['./acvtool/smiler/libs'])
from config import config
from granularity import Granularity
from instrumenting import manifest_instrumenter
from libs import Libs
from smalitree import ... |
test_poplib.py | """Test script for poplib module."""
# Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL
# a real test suite
import poplib
import asyncore
import asynchat
import socket
import os
import errno
import threading
from unittest import TestCase, skipUnless
from test import support as test_support
HOST... |
test_pyerrors.py | import pytest
import sys
import StringIO
from pypy.module.cpyext.state import State
from pypy.module.cpyext.test.test_api import BaseApiTest
from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
from rpython.rtyper.lltypesystem import rffi
class TestExceptions(BaseApiTest):
def test_GivenExc... |
kubeless.py | #!/usr/bin/env python
import importlib
import os
import queue
import threading
import bottle
import prometheus_client as prom
import sys
import tracing
from ce import Event
from tracing import set_req_context
def create_service_name(pod_name: str, service_namespace: str) -> str:
# remove generated pods suffix ... |
main_microservices_server.py | #Policy
"""
! : means command for the microservices main server
> : means requests for nonexisting Communication, request an verification output
$ : answer to an existing Communication
* : Means an issue/error
V : is validation (like when the server confirms request's receiving)
CLOSE : sent when a socket is closed b... |
test_cursor.py | # Copyright 2009-present 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 wri... |
test_semlock.py | from _multiprocessing import SemLock
from threading import Thread
import thread
import time
import sys
import pytest
@pytest.mark.skipif(sys.platform=='win32', reason='segfaults on win32')
def test_notify_all():
"""A low-level variation on test_notify_all() in lib-python's
test_multiprocessing.py
"""
N... |
main.py | # import modules
try :
import os
import configparser
import time as tm
from datetime import *
import json
import prettytable
import easygui
import threading
except :
myassert( False, "Could not import some modules. Use \'pip install <module>\' to install them", True )
... |
engine.py | """
"""
import logging
from logging import Logger
import smtplib
import os
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any, Sequence, Type, Dict, List, Optional
from vnpy.event import Event, Eve... |
test_autograd.py | import contextlib
import gc
import sys
import io
import math
import random
import tempfile
import time
import threading
import unittest
import warnings
from copy import deepcopy
from collections import OrderedDict
from itertools import product, permutations
from operator import mul
from functools import reduce, partial... |
multiprocess.py | import multiprocessing
def _SpawnProcess(func,args,num_processes):
processes = []
for _ in range(num_processes):
p = multiprocessing.Process(target=func, args=args)
p.start()
processes.append(p)
return processes
def SpawnProcesses(funcs,args,num_processes,join=True):
if type... |
functions.py | import boto3
import time
import sys
import datetime
from settings import *
import os
from threading import Thread
import subprocess
cwd = os.path.dirname(os.path.realpath(__file__))
ec2resource = boto3.resource('ec2')
ec2client = boto3.client('ec2')
def add_ssh_identities():
known_hosts_content = ""
subp... |
spatial.py | import bottle
#import os
import sys
import requests
import json
import pyproj
import traceback
import math
#from datetime import datetime
from multiprocessing import Process, Pipe
from shapely.geometry import shape,MultiPoint,Point,mapping
from shapely.geometry.polygon import Polygon
from shapely.geometry.multipolygon... |
root.py | import setting
import os
import time
from multiprocessing import Process
from signal import *
from datetime import datetime
from db import db
from flask import Flask, render_template, redirect, url_for, request
from pluginManager import pluginManager
#crons
def sync_cron():
while True:
print("[INFO] Starti... |
PFLOTRANServer.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... |
__init__.py | from __future__ import print_function, division, absolute_import
import os
import sys
import shutil
import subprocess
import optparse
import math
import signal
import threading
import atexit
import types
import re
import pprint
import time
import traceback
import locale
import inspect
import getpass
import tempfile
im... |
utilities.py | import datetime
import os
import threading
import time
from calendar import timegm
TIME_ZONE = 'Europe/Berlin'
SECONDS_IN_A_MINUTE = 60
SECONDS_IN_AN_HOUR = SECONDS_IN_A_MINUTE * 60
SECONDS_IN_A_DAY = SECONDS_IN_AN_HOUR * 24
SECONDS_IN_A_WEEK = SECONDS_IN_A_DAY * 7
DAILY = 'daily'
WEEKLY = 'weekly'
DOY_YEAR_MILITARY... |
train_pinsage.py | import argparse
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import dgl.function as fn
from dgl.nn.pytorch import GraphConv
import dgl.multiprocessing as mp
from torch.nn.parallel import DistributedDataParallel
import sys
import os
import ... |
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... |
fastconditiontimedchangecalculator.py | from crestdsl import model
from crestdsl import sourcehelper as SH
import ast
from .to_z3 import Z3Converter, get_z3_variable, get_z3_var, get_z3_value, get_minimum_dt_of_several
from .z3conditionchangecalculator import Z3ConditionChangeCalculator, get_behaviour_change_dt_from_constraintset
from .z3calculator import Z3... |
Time_API.py | '''
Python side of the time api.
This provides actual realtime timer support, which will work within
a single frame (which is otherwise not possible with X4's internal
timer).
'''
from X4_Python_Pipe_Server import Pipe_Server, Pipe_Client
import time
import threading
# Name of the pipe to use.
pipe_name = 'x4_time'
#... |
office_service.py | # (c) 2014 - Felipe Astroza Araya
# Under BSD License
import os
import win32com.client as win32
import pythoncom
import md5
import time
import threading
from bottle import route, run, request, static_file, Bottle, HTTPError
app = Bottle()
UPLOAD_PATH = os.getcwd()+'\\uploads'
PDF_PATH = os.getcwd()+'\\pd... |
completers.py | import time
import threading
import logging
from typing import Iterable
from prompt_toolkit.contrib.regular_languages.completion import GrammarCompleter
from prompt_toolkit.contrib.regular_languages.compiler import compile
from prompt_toolkit.completion import WordCompleter, FuzzyWordCompleter
from prompt_toolkit.docu... |
md_browser.py | #!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Simple Markdown browser for a Git checkout."""
from __future__ import print_function
import SimpleHTTPServer
import SocketServer
im... |
DLThreadPool.py |
# import logging
import threading
import time
from . import DLCommon as cv
class ThreadPool:
def __init__(self, daemon):
self._daemon = daemon
self._threads = []
self._insp_thr_ = None
self._app_lock = threading.Lock()
def Thread(self, *args, **kwargs):
with self._app_... |
child_process_executor.py | '''Facilities for running arbitrary commands in child processes.'''
import os
import queue
import sys
from abc import ABCMeta, abstractmethod
from collections import namedtuple
import six
from dagster import check
from dagster.seven import multiprocessing
from dagster.utils.error import serializable_error_info_from_... |
main.py | import json
import redis
import threading
import logging
from psycopg2.pool import ThreadedConnectionPool
from core.events.oktell import OktellOrderAccepted
from core.coreapi import TMAPI
from .kts.channels import Channel, Channels
from .config import REDIS, CHANNELS, DSN, TME_DB
from orders.database import AsteriskSou... |
agent.py | from __future__ import division, print_function, absolute_import
import time
import datetime
import sys
import traceback
import socket
import threading
import os
import signal
import atexit
import platform
import random
import math
from .runtime import min_version, runtime_info, register_signal
from .utils import tim... |
obstacle.py | from bangtal import *
import threading
import random
class Obstacle(Object):
def __init__(self, scene, player):
super().__init__(random.choice(['images/cat1.png', 'images/cat2.png',\
'images/cat3.png', 'images/cat4.png', 'images/dog1.png',\
'images/dog2.png','images/dog3.png', 'imag... |
__init__.py | #Server code adapted from optional lectures
from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
import sys, math, os, random
from direct.gui.OnscreenText import OnscreenText
from direct.interval.IntervalGlobal import *
from direct.interval.LerpInterval import *
from direct.gui.DirectGui import *
... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import functools
import os
import sys
import copy
import time
import types
import signal
import random
import logging
import threading
import tracebac... |
server.py | import random
import socket
import sys
import traceback
from multiprocessing import Process
from tornado import httpclient, ioloop, iostream, web
from tornado.httpclient import HTTPResponse
from scylla.config import get_config
from scylla.database import ProxyIP
from scylla.loggings import logger
# Using CurlAsyncHT... |
test_cli.py | #!/usr/bin/python
"""
(C) 2018,2019 Jack Lloyd
Botan is released under the Simplified BSD License (see license.txt)
"""
import subprocess
import sys
import os
import logging
import optparse # pylint: disable=deprecated-module
import time
import shutil
import tempfile
import re
import random
import json
import binasc... |
labels.py | import hashlib
import requests
import threading
import json
import sys
import traceback
import base64
import electrum_deeponion as electrum
from electrum_deeponion.plugins import BasePlugin, hook
from electrum_deeponion.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, parent, config, name):
... |
mailbox_listener.py | from typing import Dict, Any, Tuple, Optional
import contextlib
import email
import os
import threading
import imapclient.response_types
from .mailbox_tasks import MailboxTasks
from .packet import Packet, PlainPacket, SecurePacket
from ..credential import Credential
from . import socket_context, imapclient
class Mail... |
ffmagick.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Simple slideshow maker. The following external tools are needed:
- ffmpeg
- imagemagick (convert, mogrify, montage)
- mkvtoolnix (mkvmerge)
"""
import multiprocessing as mp
import os
import shutil
import subprocess
import sys
import time
from argparse im... |
worldnews.py | import re
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
import os
import httplib2
from multiprocessing import Pool
c=0
import requests
from datetime import datetime
import multiprocessing
from multiprocessing import current_process
import time
import os
import sys
FORMAT = '%d-%m-%Y %H:%M:%S'
def make_soup... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
okcoinGateway.py | # encoding: UTF-8
'''
vn.okcoin的gateway接入
注意:
1. 前仅支持USD和CNY的现货交易,USD的期货合约交易暂不支持
'''
import os
import json
from datetime import datetime
from time import sleep
from copy import copy
from threading import Condition
from Queue import Queue
from threading import Thread
from time import sleep
from vnpy.api.okcoin impo... |
sync.py | # -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 re... |
main.py | """
Remixatron Web UI
(c) 2019 - Dave Rensin - dave@rensin.com
This is a web ui for the Remixatron Infinite Jukebox project. (https://github.com/drensin/Remixatron)
The original project was a CLI that used curses, but that caused problems on Windows and other systems. So,
I wrote thsi UI to be a b... |
Exchange2domain.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import ssl
import argparse
import logging
import sys
import getpass
import base64
import re
import binascii
import time
import config
import xml.etree.ElementTree as ET
from httplib import HTTPConnection, HTTPSConnection, ResponseNotReady
from impacket import ntlm
from comm... |
consumer.py | import datetime
import logging
import os
import signal
import threading
import time
from collections import defaultdict
from multiprocessing import Event as ProcessEvent
from multiprocessing import Process
try:
import gevent
from gevent import Greenlet
from gevent.event import Event as GreenEvent
except I... |
app.py | import logging
from vk import VK
from vk.bot_framework import Dispatcher
from vk.utils import TaskManager
from db.prestart import pre_start as pre_start_db
from shuecm.config import LOGGING_LEVEL
from shuecm.config import PRODUCTION
from shuecm.config import SENTRY_DSN
from shuecm.config import VK_GROUP_ID
... |
do_lock.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time, threading
# 假定这是你的银行存款:
balance = 0
lock = threading.Lock()
def change_it(n):
# 先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance - n
def run_thread(n):
for i in range(100000):
# 先要获取锁:
lock.acquire()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.