source
stringlengths
3
86
python
stringlengths
75
1.04M
frontpagedownloader4.0.py
import praw, requests, os, time, shutil, multiprocessing, re, downloaderconstants mainbase = downloaderconstants.basepath r = praw.Reddit(client_id=downloaderconstants.client_id, client_secret=downloaderconstants.client_secret, user_agent='collects information from the front page of u/PM_ME_U_IN_TH...
containers.py
#!/usr/bin/env python # # Copyright 2007 Google 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 o...
multiprocess.py
#multiprocessing.py #import os #print 'Process %s start......'%os.getpid() #pid=os.fork() #if pid==0: # print 'I am child process (%s) and my parent is %s.' % (os.getpid(), os.getppid()) #else: # print 'I (%s) just created a child process (%s).' % (os.getpid(), pid) from multiprocessing import Process impo...
testaddkeyscomments.py
import unittest, time import web, argparse, os, logging, sys from multiprocessing import Process import web, argparse, os, logging, sys from ..client.listcurator import * from ..service.listcurator import * from sqlalchemy import * PORT = 45005 HOST = '0.0.0.0' ML_SAVE_DIR = 'managed_lists' SAVE_DIR = os.path.join(os...
test_sanity_sample.py
""" Copyright (c) 2019 Intel Corporation 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 writin...
HTTPListener.py
import logging from configparser import ConfigParser import os import sys import imp import threading import socketserver import http.server import ssl import socket import posixpath import mimetypes import time from . import * MIME_FILE_RESPONSE = { 'text/html': 'FakeNet.html', 'image/png': 'FakeN...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
sublert.py
#!/usr/bin/env python # coding: utf-8 # Announced and released during OWASP Seasides 2019 & NullCon. # Huge shout out to the Indian bug bounty community for their hospitality. import argparse import dns.resolver import sys import requests import json import difflib import os import re import psycopg2 from tld import g...
botapi.py
# -*- coding: utf-8 -*- """Unofficial Telegram Bot API .. _Google Python Style Guide: http://google.github.io/styleguide/pyguide.html """ import os from requests import Request, Session from collections import namedtuple from abc import ABCMeta, abstractmethod from threading import Thread from enum import Enum im...
test_html.py
from functools import partial from importlib import reload from io import BytesIO, StringIO import os import re import threading from urllib.error import URLError import numpy as np from numpy.random import rand import pytest from pandas.compat import is_platform_windows from pandas.errors import ParserError import p...
_robot_transport_serial.py
import logging from ._robot_transport_base import RobotTransportBase from .._comms_constants import ( MicromelonOpCode as OPCODE, MicromelonType as OPTYPE, CONNECTION_STATUS, ) from ..._binary import bytesToIntArray import serial import threading from ..._mm_logging import getLogger logger = getLogger() ...
VIGITIAVideoStreamReceiver.py
# Based on https://answers.opencv.org/question/202017/how-to-use-gstreamer-pipeline-in-opencv/ import cv2 import threading class VIGITIAVideoStreamReceiver: frame = None def __init__(self, name='Video Stream', origin_ip='', port=5000): self.name = name self.origin_ip = origin_ip se...
FilePush.py
#-*- coding: utf-8 -*- #!/usr/bin/python import paramiko import threading import sys import subprocess import logging import Queue queue=Queue.Queue() #日志设置 logging.basicConfig(level=logging.INFO, format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s', datefmt='%a...
fifo_queue_test.py
# Copyright 2015 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...
runCtaTrading.py
# encoding: UTF-8 from __future__ import print_function import sys try: reload(sys) # Python 2 sys.setdefaultencoding('utf8') except NameError: pass # Python 3 import multiprocessing from time import sleep from datetime import datetime, time from vnpy.event import EventEngine2 from vnpy.trader.v...
udp_server_mock.py
import threading import socketserver import argparse import time class ThreadedUDPRequestHandler(socketserver.BaseRequestHandler): def handle(self): data = self.request[0].strip() socket = self.request[1] print(f'[{time.time()}] Incoming: {data}') reply = data.upper() pr...
lucky-decrypt.py
#!/usr/bin/env python3 import time, os, re, sys import filetype import json from Crypto.Cipher import AES from multiprocessing import Process, Queue printablestr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" printstr2 = "ABCDEFGHIJPQRSTUVWdefghijklmnopqrstuvwx3456789" def getrandstr(seed: int) -...
serialize_tensorboard.py
# Copyright 2015 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 a...
vehicle_introducer_node.py
import rospy import cv2 from vehicle_detection_tracking.introducer import Introducer from duckietown_utils.jpg import image_cv_from_jpg class vehicle_introducer_node(): def __init__(self): try: pos_dist = np.load("~/duckietown/catkin_ws/src/vehicle_detection_tracking/distribution/posDist.npy").tolist() neg_di...
main.py
#!/usr/bin/env python #-*- coding:utf-8 _*- """ @author: HJK @file: main.py @time: 2019-01-08 """ import sys import importlib import threading import traceback import glovar from core import extractors from core.common import music_list_merge from core.exceptions import * from utils import echo from utils impor...
reflector.py
# specifically use concurrent.futures for threadsafety # asyncio Futures cannot be used across threads from concurrent.futures import Future import time import threading from traitlets.config import LoggingConfigurable from traitlets import Any, Dict, Int, Unicode from kubernetes import config, watch # This is kubern...
wispy.py
#!/usr/bin/env python ''' Created on 10-02-2012 @author: Mikolaj Chwalisz ''' import threading import subprocess import os import logging spectools_dir = "./spectools" # Has to relative to the the wispy.py module class sensing(object): ''' classdocs ''' def __init__(self, name='0', wispy_nr='0', ...
spinner_thread.py
#!/usr/bin/env python3 # spinner_thread.py # credits: Adapted from Michele Simionato's # multiprocessing example in the python-list: # https://mail.python.org/pipermail/python-list/2009-February/538048.html import threading import itertools import time import sys def spin(msg, done): # <1> write, flush = sys....
language_server.py
import enum import logging import os import sys import threading import urllib.parse import pyls_jsonrpc.dispatchers import pyls_jsonrpc.endpoint import pyls_jsonrpc.streams from collections import defaultdict from dataclasses import dataclass from functools import wraps from pathlib import Path, PurePath from typing i...
sql_isolation_testcase.py
""" Copyright (c) 2004-Present Pivotal Software, Inc. This program and the accompanying materials are made available under the terms of the 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....
test_util.py
# Copyright 2015 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...
subproc_vec_env.py
import multiprocessing as mp import numpy as np from baselines.common.vec_env.vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars from mani_skill_learn.utils.data import to_torch def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() try: while...
__init__.py
import sys from index import Index from bottle import route, run, template, request, response # to simulate readiness delay import time import threading index = Index(None) @route('/') def search(): if not index.isReady: response.status = 503 return dict({"Status":"Not ready."}) q =...
tracker.py
""" This script is a variant of dmlc-core/dmlc_tracker/tracker.py, which is a specialized version for xgboost tasks. """ # pylint: disable=invalid-name, missing-docstring, too-many-arguments, too-many-locals # pylint: disable=too-many-branches, too-many-statements, too-many-instance-attributes import socket import str...
gitfs.py
# -*- coding: utf-8 -*- ''' Base classes for gitfs/git_pillar integration tests ''' # Import python libs from __future__ import absolute_import, print_function, unicode_literals import sys import copy import errno import logging import os import pprint import shutil import tempfile import textwrap import threading imp...
cache.py
'''Caching utilities''' from __future__ import unicode_literals import io import os import re import six import sys import json import time import atexit import inspect import requests import tempfile import mimetypes import subprocess # nosec import pandas as pd import tornado.template from threading import Thr...
monitor_ctrl.py
#!python3 # coding = utf-8 import os import sys import logging import argparse import vcp try: import tkinter from tkinter import ttk TK_IMPORTED = True except ImportError: TK_IMPORTED = False __VERSION__ = '1.0' __APP_NAME__ = 'monitor_ctrl' __LOGGING_FORMAT = "%(levelname)s:[%(f...
main.py
import display_modes.gameoflife import display_modes.spectrumanalyzer import display_modes.imageviewer import display_modes.thermalcamera import display_modes.pixelrain import display_modes.module import driver import threading def stopThread(): global moduleThread if moduleThread: display_modes.modul...
stress_test.py
from threading import Thread from image_producer import * # initialize the number of requests for the stress test along with # the sleep amount between requests NUM_REQUESTS = 500 SLEEP_COUNT = 0.05 def prepare_images(img_path): image_dicts = [] for f in listdir(img_path): if isfile(join(img_path, f)...
discovery.py
''' Automatron: Discovery * Launch sub processes to perform discovery * Poll process for JSON list of new targets * Check if target already exists * If yes break out of loops * Login to new targets * Perform host level fact finding * Add to target inventory ''' import fabric.api import subprocess import sys import...
locate_vlan.py
# This code accepts an interger input of vlan-id and searches the hosts to find matching interfaces # The affected hosts are defined in the Basondole Tools device menu and are accessed via ssh using paramiko lib # AUTHOR: Paul S.I. Basondole Python 3.7 import re import time import socket import paramiko import threadi...
playlist.py
import threading import xbmc import xbmcgui import kodigui import busy import videoplayer import windowutils import dropdown import search import plexnet import opener from lib import colors from lib import util from lib import player from lib import backgroundthread from lib.util import T PLAYLIST_PAGE_SIZE = 500...
driver_station_sim.py
#!/usr/bin/env python import os import argparse import rospy import rospkg import threading from PyQt5.QtWidgets import QWidget, QCheckBox, QApplication, QHBoxLayout, QVBoxLayout from PyQt5 import QtCore, QtWidgets #from PyQt5 import QtGui from qt_gui.plugin import Plugin from python_qt_binding import loadUi from py...
concurrency.py
import threading import functools def atomize(f, lock=None): """ Decorate a function with a reentrant lock to prevent multiple threads from calling said thread simultaneously. >>> import time >>> checkpoints = [] >>> @atomize ... def sleep_and_save_time(): ... time.sleep(.1) ....
kinesis-recv.py
#!/usr/bin/env python import sys#!/usr/bin/env python import sys import traceback import os import imp import json import time from multiprocessing import Process, Queue import prometheus_client as prom import boto3 timeout = float(os.getenv('FUNC_TIMEOUT', 180)) stream_name = 'foobar' kinesis = boto3.client('kine...
base_crash_reporter.py
# Electrum - lightweight Bitcoin client # # 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, modify, merge, # publish...
viewing.py
#A* ------------------------------------------------------------------- #B* This file contains source code for the PyMOL computer program #C* Copyright (c) Schrodinger, LLC. #D* ------------------------------------------------------------------- #E* It is unlawful to modify or remove this copyright notice. #F* --------...
cli.py
import socket import subprocess import time from threading import Thread import click import requests from utils import resource_path API_BASE_URL = "https://spoofy.baka.tokyo/" SPOTIFY_CONNECT_NAME = "Spoofy Bot" SAMPLE_RATE = 44100 CHANNELS = 2 BITS = 16 SAMPLE_SIZE = (SAMPLE_RATE * BITS * CHANNELS) // 8 CHUNK_SIZ...
run_outer_tests.py
#coding:utf-8 import os import sys import time import pipes import subprocess import threading import pexpect import signal class ReturnContainer(): def __init__(self): self.value = None class Command(object): def __init__(self, cmd, fail_cmd, post_cmd=None, post_delay=0): self.cmd = cmd ...
example2.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from concurrent.futures import Future import threading def spam(x, y, fut): result = x + y fut.set_result(result) fut = Future() t = threading.Thread(target=spam, args=(1,2,fut)) t.start() t.join() print('Result', fut.result())
mapping_visu.py
""" Visualize 3D point cloud of the environment in real-time, or playback your recordings and view their 3D point cloud. Press 'H' to view Open3D point cloud viewer options. Requirements: pip install open3d """ import numpy as np import spectacularAI import threading import open3d as o3d import time import depthai im...
test_stdout.py
from __future__ import print_function import os import random import string import sys import time import pytest from dagster import ( DagsterEventType, InputDefinition, ModeDefinition, execute_pipeline, pipeline, reconstructable, resource, solid, ) from dagster.core.execution.compute...
schedule.py
import time from multiprocessing import Process import asyncio import aiohttp try: from aiohttp.errors import ProxyConnectionError, ServerDisconnectedError,ClientResponseError,ClientConnectorError except: from aiohttp import ClientProxyConnectionError as ProxyConnectionError,ServerDisconnectedError,ClientRespon...
client.py
import socket import threading import os import signal from sys import platform import sys import base64 class clientType: PORT = 5050 DISCONNECT_MESSAGE = "exit" passkey = '' IP = '' username = '' client = '' def __init__(self): if platform == "linux" or platform == "linux2" or p...
thread.py
#!/usr/bin/env python import cv2 as cv from threading import Thread def work(img, n): r = img for _ in range(n): r = cv.medianBlur(r, 17) return r frame = None goon = True def capture(): global frame cap = cv.VideoCapture(0) while goon: _,frame = cap.read() print(...
external_program.py
# -*- coding: utf-8 -*- # # Copyright 2012-2016 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...
binarySweep.py
#!/usr/bin/env python3 # # binarySweep.py # # small scale unix command-line tool for removing unused C/C++ binary files # in specified directory and/or subdirectories up to specified depth # # # MIT License # # Copyright (c) 2022 Luke Ingram # # Permission is hereby granted, free of charge...
h4.py
''' 现有两个进程,1号进程向文件写入10个"hello" 2号进程向文件写入10个"world",两个进程并发执行 如何使得文件中的内容一定是"hellohellohellohellohello.....worldworldworld......." ''' from multiprocessing import Process,Lock def new1write(name,mylock): with mylock: f = open(name,'r+') f.write('hello'*10) f.close() def new2write(name,mylock)...
test_util.py
# Copyright 2015 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...
vaults.py
import logging import re import threading import time from typing import List from brownie import chain from eth_utils import encode_hex, event_abi_to_log_topic from joblib import Parallel, delayed from semantic_version.base import Version from yearn import apy from yearn.apy.common import ApySamples from yearn.common...
gui_elements.py
#!/usr/bin/python2 from __future__ import division, print_function import shutil # Imports # Core Imports import threading import time from io import BytesIO # Third-party imports import wx from twisted.internet import protocol import evora.common.logging.my_logger as my_logger __author__ = "Tristan J. Hillis" """...
A_1_Add_columns_participant_info_new.py
import pandas as pd import math import argparse from tqdm import tqdm from multiprocessing import Process def get_participants_from_(log): # get all sampled participants log_raw = pd.read_csv(r'~\Desktop\VB_Schnittstelle\Dataset\log_raw.csv') participants = pd.read_csv(r'~\Desktop\VB_Schnittstelle\Dataset\...
GhostOnWires v1.py
############################################################################## # # # By RootInSilence # # # ####...
enumerateThreads.py
import threading import time import random def myThread(i): print("Thread {}: started".format(i)) time.sleep(random.randint(1,5)) print("Thread {}: finished".format(i)) def main(): for i in range(4): thread = threading.Thread(target=myThread, args=(i,)) thread.start() print("Enumerating: {}".forma...
app_utils.py
# From http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/ import struct import six import collections import cv2 import datetime import subprocess as sp import json import numpy import time from threading import Thread from matplotlib import colors class FPS: def __init__(self): ...
main2_lps_gradient_quantization.py
from numpy.random import seed seed(8) #1 import tensorflow tensorflow.random.set_seed(7) # tensorflow.random.set_random_seed(7) import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import os from tensorflow.keras import backend as K from tensorflow.keras.models ...
listb.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import tools import time import re import db import threading class Source (object) : def __init__ (self): self.T = tools.Tools() self.now = int(time.time() * 1000) self.siteUrl = str('http://m.iptv807.com/') def getSource (self) : ...
test_sigma_dut.py
# Test cases for sigma_dut # Copyright (c) 2017, Qualcomm Atheros, Inc. # Copyright (c) 2018-2019, The Linux Foundation # # This software may be distributed under the terms of the BSD license. # See README for more details. import binascii import hashlib import logging logger = logging.getLogger() import os import soc...
clusterScalerTest.py
# Copyright (C) 2015-2018 Regents of the University of California # # 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 app...
email.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from project import mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(to, subject, template, **kwargs): app = current_app._get_current_object() msg ...
ftp.py
#-*- coding: utf-8 -*- #System Stuff import time from threading import Thread # pyftpdlib import from pyftpdlib.handlers import FTPHandler from pyftpdlib.servers import MultiprocessFTPServer from pyftpdlib.authorizers import DummyAuthorizer import pyftpdlib.log as ftp_log #This class handles FTP connections class f...
worker.py
import logging import os import shutil from subprocess import PIPE, Popen import threading import time import traceback import socket import http.client import sys from typing import Optional, Set, Dict import psutil import docker from codalab.lib.telemetry_util import capture_exception, using_sentry import codalab.w...
runtests.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import argparse from datetime import datetime import io import json import os import shutil import sys from difflib import unified_diff # python's own diff library from multiprocessing import Process, Queue, freeze_support # add s...
kernel.py
from queue import Queue from threading import Thread from ipykernel.kernelbase import Kernel import subprocess import logging import tempfile import os class RealTimeSubprocess(subprocess.Popen): """ A subprocess that allows to read its stdout and stderr in real time """ def __init__(self, cmd, write...
trainer.py
# Lint as: python2, python3 # 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 # ...
server.py
#!/usr/bin/python2 import argparse import atexit import logging import os import signal import subprocess import sys import tempfile import time from mininet.node import UserSwitch, OVSSwitch from mininet.link import Link, TCIntf import mininet.term import Pyro4 import threading import traceback from MaxiNet.tools ...
__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...
main.py
import traceback import StellarPlayer import requests import threading import json import time import os import io import sys import socket plugin_dir = os.path.dirname(__file__) sys.path.append(plugin_dir) try: from bottle import route, run, template, request, response, get, post, static_file, TEMPLATE_PATH exce...
misc.py
# pylint: disable=W0702,W1203,R0913 import json import os import signal import subprocess import sys import time from queue import Queue, Empty from threading import Thread from oteod import MMDETECTION_TOOLS class NonBlockingStreamReader: def __init__(self, stream): self.stream = stream self.q...
fritzbox_callmonitor.py
""" A sensor to monitor incoming and outgoing phone calls on a Fritz!Box router. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.fritzbox_callmonitor/ """ import logging import socket import threading import datetime import time import re import v...
__main__.py
"""isort:skip_file""" # first, logging level lower import os os.environ["KCFG_KIVY_LOG_LEVEL"] = os.environ.get("KCFG_KIVY_LOG_LEVEL", "warning") # if "KIVY_AUDIO" not in os.environ: # trying default again # os.environ["KIVY_AUDIO"] = "sdl2" # some backends hard crash / this seems to be most stable import kivy k...
test_leabra_mechanism.py
import copy import numpy as np import pytest import random from psyneulink.core.compositions.composition import Composition from psyneulink.core.components.functions.transferfunctions import Linear, Logistic from psyneulink.core.components.mechanisms.processing.transfermechanism import TransferMechanism from psyneulin...
lshbuilder.py
from tables import * import functools import argparse import sys import multiprocessing as mp import pandas as pd import time as t import pickle from datasketch import MinHashLSH, MinHashLSHForest , WeightedMinHashGenerator from datetime import datetime import h5py import json import time import ete3 import gc from p...
shout_client.py
#! /usr/bin/env python import time, random import Pyro.core import Pyro.naming from Pyro.errors import * from threading import Thread class Listener(Pyro.core.ObjBase): def __init__(self): Pyro.core.ObjBase.__init__(self) def callback(self, message): print 'GOT CALLBACK: ',message abort=0 def shouter(objectU...
bootstrap_test.py
import os import random import re import shutil import tempfile import threading import time import logging import signal from cassandra import ConsistencyLevel from cassandra.concurrent import execute_concurrent_with_args from ccmlib.node import NodeError, TimeoutError, ToolError, Node import pytest from distutils....
pyxqueue.py
import os import enum import json import time import uuid import traceback import multiprocessing from functools import wraps class TaskError(Exception): def __init__(self, error, exc_info): super().__init__() self.error = error self.exc_info = exc_info def __str__(self): ret...
inputstream.py
from threading import Thread import cv2 import time from queue import Queue from fps import Fps class InputStream(): def __init__(self, path): self.path = path if isinstance(path, int): self.isCam = True else: self.isCam = False def initStream(self): i...
asynchronous_call.py
# -*- coding: utf-8 -*- from Queue import Queue from threading import Thread import sys class asynchronous(object): def __init__(self, func): print self.__class__, sys._getframe().f_code.co_name self.func = func def threaded(*args, **kwargs): print sys._getframe().f_code.co_na...
model.py
import time import sys import os.path import threading #from typing import Dict, Tuple, Sequence from typing import Dict, List from abc import ABC, abstractmethod from vimgdb.base.data import BaseData from vimgdb.base.common import Common from vimgdb.model.state import State class Model(Common, ABC): def __init_...
p2sModel.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import random import threading import h5py import util from util import * import time class KnowledgePronounCorefModel(object): def __init__(self, config): self.config = config self.conte...
lab7_threaded_hist.py
import random import threading import collections from threading import RLock #lock = RLock() mylist = [] for i in range(0, 50000000): x = random.randint(-10, 10) mylist.append(x) mid = len(mylist) // 2 L = mylist[:mid] R = mylist[mid:] histL = {} histR = {} def thread_A(): print("t...
neoici.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pickle import json import io import threading import pynvim import requests import xmltodict from pydub import AudioSegment from pydub.playback import play from validators import url as valid_url class ResultThread(threading.Thread): def __init__(self, *args,...
hivetest.py
#!/usr/bin/env python # # 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 "Lic...
test4.py
import multiprocessing import time def worker(interval): print("work start:{0}".format(time.ctime())); time.sleep(interval) print("work end:{0}".format(time.ctime())); if __name__ == "__main__": p = multiprocessing.Process(target=worker, args=(3,)) p.start() print "end!"
main.py
from __future__ import print_function import argparse import os import torch import torch.multiprocessing as mp import my_optim from envs import create_atari_env, create_doom_env, create_picolmaze_env from model import ActorCritic, IntrinsicCuriosityModule from train import train from test import test from train_no...
node.py
from requests.adapters import HTTPAdapter, Retry from threading import Thread, Lock, Event from transaction import Transaction from blockchain import Blockchain from copy import deepcopy import concurrent.futures from wallet import Wallet from block import Block import requests import config import pickle import time ...
krakenticker.py
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys, traceback import threading import time from PyQt4 import QtGui,QtCore import simplejson as json import urllib2 from boardlet import Boardlet from modellet import Modellet class KrakenTicker(Boardlet): def __init__(self, parent, targetCurr): super...
main.py
# pip install -r requirements.txt import tkinter import numpy as np from tkinter import * import tkinter as tk from tkinter import ttk from functools import partial from tkinter.filedialog import askopenfilename from PIL import Image, ImageTk, ImageDraw from image_processing import ImageProcessing import cv2 from imuti...
server.py
""" Modul mit Klassen und Methoden fuer den KOCHA-Server. """ import json import locale import socket import sys import threading from kocha import shared class KochaTcpConnection(shared.KochaTcpSocketWrapper): """ Klasse kapselt die Verbindung einens KOCHA-Clients mit dem KOCHA-Server. """ def...
test_restful.py
#!/usr/bin/python3 """ SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. NOTE: This unittest is being used as a procedural test. The tests must be run in-order and CANNOT be parallelized! Tests all but two RESTful interfaces: * agent's POST /keys/vkey - Done by CV a...
clang_format.py
#! /usr/bin/env python """ A script that provides: 1. Ability to grab binaries where possible from LLVM. 2. Ability to download binaries from MongoDB cache for clang-format. 3. Validates clang-format is the right version. 4. Has support for checking which files are to be checked. 5. Supports validating and updating a s...
sync_rl.py
import multiprocessing as mp import time import torch.distributed from rlpyt.runners.minibatch_rl import MinibatchRl, MinibatchRlEval from rlpyt.utils.seed import make_seed from rlpyt.utils.collections import AttrDict from rlpyt.utils.quick_args import save__init__args from rlpyt.utils.synchronize import drain_queue,...
io.py
"""Data iterators for common data formats""" from __future__ import absolute_import from collections import OrderedDict, namedtuple import sys import ctypes import logging import threading import numpy as np from .base import _LIB from .base import c_array, c_str, mx_uint, py_str from .base import DataIterHandle, NDAr...
utils.py
import asyncio from collections import namedtuple from queue import Empty, Full, Queue from threading import Lock, Thread from pypeln import utils as pypeln_utils import time LOOP = asyncio.new_event_loop() def run_on_loop(f_coro): if not LOOP.is_running(): def run(): LOOP.run_forever() ...
ggSAT_sim.py
import os import sys import random from subprocess import call import multiprocessing import time import json tree = {} def terminal(string): os.system(string) def buildtree(literals, parent, depth): global tree global paths dec_lit1 = random.choice(literals) dec_lit2 = random.choice(literals...