source
stringlengths
3
86
python
stringlengths
75
1.04M
listing28-2.py
from xmlrpclib import ServerProxy, Fault from server import Node, UNHANDLED from client import randomString from threading import Thread from time import sleep from os import listdir import sys import wx HEAD_START = 0.1 # Seconds SECRET_LENGTH = 100 class ListableNode(Node): """ An extended version of Node,...
servicehandler.py
from SocketServer import ThreadingMixIn import json import logging import os import SimpleHTTPServer import BaseHTTPServer import threading from time import sleep import baseservice import time import config basepath = os.path.dirname(__file__) formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') lo...
parallel.py
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ##...
lisp-itr.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...
__init__.py
import os import time import traceback import yaml import threading import logging import selenium from selenium import webdriver logger = logging.getLogger('autowebprint.driver_firefox') _default_preferences = { 'browser.aboutConfig.showWarning': False, 'print.always_print_silent': True, 'print_printer...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Bitcoin Core Developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test paymastercoind shutdown.""" from test_framework.test_framework import BitcoinTestFramework from t...
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...
main.py
import requests from PIL import Image from bs4 import BeautifulSoup import copy import time import re import os import json import threading class Spider: class Lesson: def __init__(self, name, code, teacher_name, Time, number): self.name = name self.code = code self.t...
test_contextualize.py
import loguru from loguru import logger import threading import asyncio import importlib import sys import pytest def test_contextualize(writer): logger.add(writer, format="{message} {extra[foo]} {extra[baz]}") with logger.contextualize(foo="bar", baz=123): logger.info("Contextualized") assert w...
HackRequests.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : w8ay # @Mail : w8ay@qq.com # @File : hackRequests.py import copy import gzip import queue import socket import ssl import threading import time import zlib from http import client from urllib import parse class HackError(Exception): def __...
__init__.py
import time from threading import Thread, RLock from typing import Dict, Optional, List from platypush.backend.sensor import SensorBackend from platypush.context import get_plugin from platypush.message.event.bluetooth import BluetoothDeviceFoundEvent, BluetoothDeviceLostEvent class BluetoothScannerBackend(SensorBac...
crackPassword.py
# Copyright: © 2019, Fendy Lieanata, All rights reserved. import time import multiprocessing import math # Create a function called "chunks" with two arguments, l and n: def chunks(LIST, NUMBER_OF_PARTS): # For item i in a range that is a length of l, for i in range(0, len(LIST), NUMBER_OF_PARTS): # ...
fstest.py
# Copyright (C) The Arvados Authors. All rights reserved. # # SPDX-License-Identifier: AGPL-3.0 from multiprocessing import Process import os import subprocess import sys import prof def fn(n): return "file%i" % n def createfiles(d, n): for j in xrange(1, 5): print "Starting small file %s %i, %i" % (...
server.py
"""Server that handles all the requests for DRLVis frontend.""" import argparse import timeit from flask import Flask, request from flask_cors import CORS import os import sys import signal from threading import Thread from http import server import socketserver from drlvis.data_preprocessor import DataPreprocessor A...
openvino-usbcamera-cpu-ncs2-async.py
import sys import os import numpy as np import cv2 from os import system import io import time from os.path import isfile from os.path import join import re import argparse import platform try: from armv7l.openvino.inference_engine import IENetwork, IEPlugin except: from openvino.inference_engine import IENetwo...
Sil.py
# -*- coding: utf-8 -*- import LineAlpha from LineAlpha.Gen.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia,glob from bs4 import BeautifulSoup from urllib import urlopen imp...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading from electrum.bitcoin import TYPE_ADDRESS from electrum.storage import WalletStorage from electrum.wallet import Wallet, InternalAddressCorruption from electrum.paymentrequest import InvoiceStore fr...
server.py
import abc import socket from threading import Thread import six.moves.cPickle as pickle from flask import Flask, request from multiprocessing import Process from elephas.utils.sockets import determine_master from elephas.utils.sockets import receive, send from elephas.utils.serialization import dict_to_model from ele...
pydoc.py
#!/usr/bin/env python # -*- coding: Latin-1 -*- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object. Or, at the shell command line outside of Python: Run "pydo...
test_poll.py
# Test case for the os.poll() function import os import random import select try: import threading except ImportError: threading = None import time import unittest from test.test_support import TESTFN, run_unittest, reap_threads, cpython_only try: select.poll except AttributeError: raise unittest.Skip...
test_uart3.py
import serial import threading import time import struct s = serial.Serial("/dev/ttyAMA1", 115200) PACKET_START_BYTE = 0xaa NUM_J = 6 data_struct_fmt = "<BB" + "B"*NUM_J + "i"*NUM_J + "h"*NUM_J + "h"*NUM_J + "L" def send(joint_num, curve_id, shift_y, scale_y, length_usec): msg = struct.pack("<BBBBhhI", PACKET_START...
pcba_test.py
# coding=utf-8 from tkinter import * from tkinter.ttk import Combobox import serial.tools.list_ports from tkinter.scrolledtext import ScrolledText import json import time import threading from tkinter.messagebox import showinfo, askokcancel from functools import wraps def retry(times): def wrapper_fn(f): ...
scellsegUi.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'cellPoseUI.ui' import numpy as np import sys, os, pathlib, warnings, datetime, tempfile, glob, time, threading from natsort import natsorted from PyQt5 import QtCore, QtGui, QtWidgets, Qt import pyqtgraph as pg import cv2 fr...
LocalDispatcher.py
########################################################################## # # Copyright (c) 2013-2014, 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: # # * Redi...
system_test.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
test_util_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...
execution_engine2Server.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...
test_diskutils.py
import functools import gc import os import queue import shutil import subprocess import sys from time import sleep from unittest import mock import pytest import dask from distributed.compatibility import MACOS, WINDOWS from distributed.diskutils import WorkSpace from distributed.metrics import time from distribute...
ftl_navigation_node.py
################################################################################# # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # # # Licensed under the Apache License, Version 2.0 (the "License"). ...
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...
local_timer_test.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import multiprocessing as mp import signal import time import unittest import unittest.mock as mock import torch....
bhnet.py
#!/opt/local/bin/python2.7 import sys import socket import getopt import threading import subprocess # define some global variables listen = False command = False upload = False execute = "" target = "" upload_destination = "" port = 0 # this r...
unlogger.py
#!/usr/bin/env python3 import argparse import os import sys import zmq import time import signal import multiprocessing from uuid import uuid4 from collections import namedtuple from collections import deque from datetime import datetime from cereal import log as capnp_log from cereal.services import service_list from...
dataloader.py
import os import sys import time from multiprocessing import Queue as pQueue from threading import Thread import cv2 import numpy as np import torch import torch.multiprocessing as mp import torchvision.transforms as transforms from PIL import Image from torch.autograd import Variable from SPPE.src.utils.img import ...
TDStream_v3.py
# -*- coding: utf-8 -*- """ Created on Mon Sep 2 11:19:59 2019 The MIT License Copyright (c) 2018 Addison Lynch 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, in...
thermald.py
#!/usr/bin/env python3 import datetime import os import queue import threading import time from collections import OrderedDict, namedtuple from pathlib import Path from typing import Dict, Optional, Tuple import psutil import cereal.messaging as messaging from cereal import log from common.dict_helpers import strip_d...
repeating_timer.py
""" Internal helper class for repeating tasks. """ # currently excluded from documentation - see docs/README.md from threading import Event, Thread class RepeatingTimer: def __init__(self, interval, callable): self._interval = interval self._action = callable self._stop = Event() s...
file_server.py
######### # Copyright (c) 2013 GigaSpaces Technologies Ltd. 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...
web_console.py
# coding: utf-8 # Author: Roman Miroshnychenko aka Roman V.M. # E-mail: roman1972@gmail.com # # Copyright (c) 2016 Roman Miroshnychenko # # 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 witho...
nacos_channel.py
# Copyright 2016 gRPC 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 law or agreed to in writing...
data_service_ops_test.py
# Copyright 2020 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...
utils.py
from threading import Thread, Lock from .logger import Logger, DEBUG import multiprocessing def wait(lock): lock.acquire() lock.release() def is_okey_to_continue(lock, check): if callable(check) is False: raise AssertionError('\'check\' must be callable') if not lock is None: lock.acq...
debugout.py
# circulaRprint # # Circular Plotter controller for Raspberry Pi # # Author: Oehrly, 2018 # ################################################# # # draws the calculated x-y-points on screen # as it is drawing based on x-y coordinates if stepper class or the calcul...
SQLper.py
import sqlite3 import socket import threading import datetime # from datetime conn = sqlite3.connect(':memory:') c = conn.cursor() ####### socket connection ####### HEADER = 16 PORT = 5050 SERVER = '0.0.0.0' #socket.gethostbyname(socket.gethostname()) ADDR = (SERVER, PORT) FORMAT = 'utf-8' DISCONNECT...
test_dbapi.py
# pysqlite2/test/dbapi.py: tests for DB-API compliance # # Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of t...
multi-threading.py
#!/usr/bin/env python # coding: utf-8 # # Dense 3D Face Correspondence # In[1]: import os os.environ["MKL_NUM_THREADS"] = "12" os.environ["NUMEXPR_NUM_THREADS"] = "12" os.environ["OMP_NUM_THREADS"] = "12" # In[2]: import pdb import numpy as np from collections import defaultdict import time, warnings import re ...
_common.py
""" Common code for all runtimes. Desktop runtimes provide a way to load a page as desktop application. To do so, we may cache or link to an existing runtime (like Firefox) or even keep a local copy of a runtime (like NW.js). Some runtimes (e.g. Firefox) needs a whole directory structure as its app definition. Others ...
get_picture_url.py
import threading import requests import queue import os import re import sys import collections from bs4 import BeautifulSoup from urllib.parse import urljoin def get_text(link: str) -> str: ''' return the text of a given url. ''' response = requests.get(link, timeout=10) response.encoding = response.apparent_e...
stt_io_bucketingiter.py
from __future__ import print_function import mxnet as mx import sys from log_util import LogUtil sys.path.insert(0, "../../python") import bisect import socket import numpy as np import threading BATCH_SIZE = 1 SEQ_LENGTH = 0 NUM_GPU = 1 def get_label(buf, num_lable): ret = np.zeros(num_lable) for i in ra...
feeder.py
import os import threading import time import numpy as np import tensorflow as tf from datasets import audio from infolog import log from tensorflow.python.keras.utils import np_utils from sklearn.model_selection import train_test_split from .util import is_mulaw_quantize, is_scalar_input _batches_per_group = 64 ...
batch.py
import os import torch.multiprocessing as mp mp.set_start_method('spawn', force=True) def run(str): os.system(str) return 0 def main(): strs = [f"python -m torch.distributed.launch --nproc_per_node=1 main.py nbs --gpus {i} --index {i}" for i in range(8)] processes = [] for i in range(1): ...
run.py
import msvcrt import time from threading import Thread from mc_autosplit.utils.exception import FailedToReadAdvancements from mc_autosplit.utils.mc_utils import get_last_played_level, get_advancements from mc_autosplit.splitting import handle_advancement_changes from mc_autosplit.watcher import PathWatcher class Run...
monitor.py
import logging import socket import threading import datetime import time import math class BPLMonitor(object): """Event listener to monitor controller.""" def __init__(self, host, port, sensors): """Initialize BPL monitor instance.""" self.host = host self.port = port self.s...
main2.py
import cv2 import numpy as np import urllib.request import time import threading import math def getPokemon(star, end): print("Started worked for range:", star, "to", end) # creating a loop to get 809 pokemon image for i in range(star, end): try: url = 'https://assets.pokemon.com/assets...
multi_inference_20200804114158.py
# coding=utf-8 import os import cv2 import sys import pdb import subprocess import multiprocessing import inference_utils import common def single_process(index, task, gpu): print(("任务%d处理%d张图片" % (index, len(task)))) # 写文件 filename = inference_utils.dump_testfile(task, index) out_str = subproces...
svm_run_cv_old.py
""" Runs svm_learn & svm_classify for each fold in the CV experiment. Takes in the path to the folder with CV folds. Each folder should start with 'fold' and contain the following files: svm.train, svm.test, svm.relevancy """ import os import logging import subprocess import multiprocessing import sys f...
brute.py
#!/usr/bin/env python3 """Brute Force Checkin module Disclaimer: The network administrator will see the spike in network requests. Not only will you potentially slow down services for your classmates but also be very obvious as to who is trying/succeeds in using brute-force to check-in to class. ...
Server.py
# coding: utf-8 ######################################################################### # 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> # # author yeeku.H.lee kongyeeku@163.com # # # # version 1.0 ...
statink.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # IkaLog # ====== # Copyright (C) 2015 Takeshi HASEGAWA # # 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/l...
test_advanced.py
# coding: utf-8 from concurrent.futures import ThreadPoolExecutor import json import logging import random import sys import threading import time import numpy as np import pytest import ray.cluster_utils import ray.test_utils from ray.test_utils import client_test_enabled from ray.test_utils import RayTestTimeoutEx...
train_dist.py
import sys sys.path.append('.') import os import tqdm import torch import random import tempfile import argparse import numpy as np import multiprocessing from torch import optim from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from data.aug.compose import Compose from data.a...
datasets.py
# Dataset utils and dataloaders import glob import hashlib import json import logging import math import os import random import shutil import time from itertools import repeat from multiprocessing.pool import ThreadPool, Pool from pathlib import Path from threading import Thread import cv2 import numpy as np import ...
__init__.py
import datetime import threading import time import serial import local_config from models import Bike from vtk_bike import app, mongo def action(): app.bikes = {0: Bike("bike1"), 1: Bike("bike2")} ser = None for i in range(2): try: ser = serial.Serial(local_config.address + str(i), ...
ServerConnection.py
import socket import os import getpass from threading import Thread """This module taces care of the server-specific logic.""" class ServerConnection: """Base class which takes care of initializing the server endpoint for either chat or transfer.""" def __init__(self, server_ip, callbacks): self.ser...
labstreaminglayer_syncronizer.py
#!/usr/bin/env python import sys, os #find better way to do this. projectDir = os.path.join(os.path.dirname(__file__), '../') sys.path.append(projectDir + "../thirdparty/liblsl-Python") import nodeconfig as config import rospy import threading from data.mapper_LSLToROS import Mapper_LSLtoROS from data.mapper_ROSToLS...
wmr.py
import usb1 import numpy as np import time import struct import sys import io import binascii from enum import Enum import threading MICROSOFT_VID = 0x045e HOLOLENS_SENSORS_PID = 0x0659 TRANSFER_SIZE = 0x96C00 HOLOLENS_MAGIC = 0x2B6F6C44 class WmrCamera: d...
edit_collection_dialog.py
#!/usr/bin/env python # # Copyright 2019 DFKI GmbH. # # 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, merg...
server.py
#!/usr/bin/env python3 from time import sleep from argparse import ArgumentParser from json import dumps, loads from json.decoder import JSONDecodeError from threading import Thread from random import choice from socketserver import BaseRequestHandler from socketserver import ThreadingTCPServer # Cache Storage! cache...
run-tests.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 "Li...
master.py
import os import re import threading import json import sys import random from datetime import * from socket import * from _thread import * NO_OF_WORKERS = 3 FREE_SLOT = 0 # 0-received 1-finish execution of job def func_log_job_request(path2file, flag, job_id, list_mapID, list_reducerID): with ...
youtube.py
import re import threading import traceback import requests from requests.adapters import HTTPAdapter from requests.packages.urllib3.util.retry import Retry from requests.packages.urllib3.util.timeout import Timeout import pykka import youtube_dl from cachetools import LRUCache, cached from mopidy.models import Image...
test.py
import threading import time import random import logging import sys taskQueue = ["Run", "Walk", "Talk", "Fight", "Live"] taskToBeAdded = iter(["Jump", "Talk", "Fight"]) task = "" status = True iterating = False def performTask(): iterating = True for pTask in list(taskQueue): task = pTask tas...
face_recognition.py
"""Validate a face recognizer on the "Labeled Faces in the Wild" dataset (http://vis-www.cs.umass.edu/lfw/). Embeddings are calculated using the pairs from http://vis-www.cs.umass.edu/lfw/pairs.txt and the ROC curve is calculated and plotted. Both the model metagraph and the model parameters need to exist in the same d...
connection.py
import os import base64 import binascii import struct import numpy from collections import deque from threading import Thread, Event, RLock, current_thread #logging import logging def configure_logger(addr=None, instance_id=None): logger = logging.getLogger("%s[%s]@%s:%s" % (__name__, str(instance_id), str(addr[0]...
main.py
import re import os import psutil import argparse import requests from os import _exit,path,devnull from sys import stdout from time import sleep from random import choice from argparse import ArgumentParser from traceback import print_exc from threading import Thread,Lock,enumerate as list_threads from user_agent impo...
tello.py
# coding=utf-8 import socket import time import threading import cv2 from threading import Thread from djitellopy.decorators import accepts class Tello: """Python wrapper to interact with the Ryze Tello drone using the official Tello api. Tello API documentation: https://dl-cdn.ryzerobotics.com/downloads/...
peripherals.py
import cv2 import threading class Camera: def __init__(self, resolution, framerate=30): self.stream = cv2.VideoCapture(0) # start the video stream ret = self.stream.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*'MJPG')) ret = self.stream.set(3,resolution[0]) ret = self.stream.set(...
web_scanner.py
from urllib.request import urlopen, Request from urllib.error import URLError from urllib.parse import quote from queue import Queue from threading import Thread # 웹 요청을 보내는 브라우저 명시 user_agent = 'Mozilla/5.0\(compatible, MSTE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko' # 주어진 targethost에서 스캔 대상 확장자인 exts가 포함...
fake.py
# This file is Copyright (c) 2010 by the GPSD project # BSD terms apply: see the file COPYING in the distribution root for details. """ gpsfake.py -- classes for creating a controlled test environment around gpsd. The gpsfake(1) regression tester shipped with GPSD is a trivial wrapper around this code. For a more int...
predictive_music_model.py
#!/usr/bin/python import logging import time import datetime import numpy as np import queue from pythonosc import dispatcher from pythonosc import osc_server from pythonosc import udp_client import argparse from threading import Thread parser = argparse.ArgumentParser(description='Predictive Musical Interaction MDRN...
IpMgrSubscribe.py
# Warning: Do NOT edit this file directly. Your changes may be overwritten. # This file is automatically generated by GenIpMgrSubscribe.py import threading from SmartMeshSDK import ApiException class IpMgrSubscribe(object): ''' \brief Notification listener for IpMgrConnectorMux object ''' ...
update_test.py
#!/usr/bin/python # # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from xml.dom import minidom import sys import threading import urllib2 UPDATE_BLOB="""\ <?xml version="1.0" encoding="UTF-8"?> <...
test__threading_monkey_in_thread.py
# We can monkey-patch in a thread, but things don't work as expected. import sys import threading from gevent import monkey import greentest class Test(greentest.TestCase): @greentest.ignores_leakcheck # can't be run multiple times def test_patch_in_thread(self): all_warnings = [] try: ...
test_concurrent_futures.py
import test.support # Skip tests if _multiprocessing wasn't built. test.support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. test.support.import_module('multiprocessing.synchronize') from test.support.script_helper import assert_python_ok import contextlib import itertools imp...
movies_top250.py
import time import requests from lxml import html from threading import Thread def get_tree(url): r = requests.get(url) tree = html.fromstring(r.text) return tree def get_movies(): xpath_title = '//div[@class="article"]//div[@class="hd"]//span[@class="title"][1]/text()' movies = [] def foo(...
methods.py
# Copyright 2018 gRPC 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 law or agreed to in writing...
test_subprocess.py
import unittest from unittest import mock from test import support import subprocess import sys import signal import io import itertools import os import errno import tempfile import time import traceback import selectors import sysconfig import select import shutil import threading import gc import textwrap import jso...
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...
ekranyakala.py
import numpy as np import win32gui, win32ui, win32con from threading import Thread, Lock class ekranYakala: stopped = True lock = None screenshot = None w = 0 h = 0 hwnd = None cropped_x = 0 cropped_y = 0 offset_x = 0 offset_y = 0 def __init__(self, window_name=None): ...
lock_1.py
from threading import Thread, Lock c = 0 lock = Lock() def count_300(): global c lock.acquire() try: while c < 30000: c += 1 print(c) finally: lock.release() def count_10000(): global c x = 340 while c < 100000: c += 1 print(c) t_0 = Thr...
GIL_effect.py
import multiprocessing as mp import time def worker(r): pid = mp.current_process().name # do some hard and time consuming work: global result res = 0 for i in r: res += i if "Process-" in pid: output.put(result) else: result += res print("Worker {} is working with {}".format(pid, r)) if __name__ =...
tests.py
from __future__ import unicode_literals from datetime import datetime import threading from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.db import connections, DEFAULT_DB_ALIAS from django.db import DatabaseError from django.db.models.fields import Field from django.db.models....
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_functools.py
import abc import builtins import collections import collections.abc import copy from itertools import permutations import pickle from random import choice import sys from test import support import threading import time import typing import unittest import unittest.mock from weakref import proxy import contextlib imp...
gbn_receiver.py
import time from collections import deque from threading import Lock, Condition, Thread from senders.gbn_sender import GoBackNSender from senders.udt_sender import UDTSender, LossyUDTSender, CorruptingUDTSender from helpers.logger_utils import get_stdout_logger from receivers.udt_receiver import UDTReceiver, Interrup...
escaped_monkey.py
#!/usr/bin/python2 import socket import sys import select import threading import json import time import os import persist # Constants DEFAULTPORT = 60000 if os.path.isfile("port"): with open("port", 'r') as f: DEFAULTPORT = int(f.read().strip()) TIMEOUT_BULLY_OK = 2.0 TIMEOUT_BULLY_COORDINATOR = 2.0 T...
_mputil.py
import multiprocessing import time def batch_process(func, iter_input, num_cores=multiprocessing.cpu_count()): """ Takes in a function, independent inputs to the function in a list, and the number of desired parallel cores and parallelizes the computation across the number of cores desired, returning ...
run_daemons.py
import logging import multiprocessing import queue from time import sleep from retrying import retry from structlog import wrap_logger from app.exceptions import DaemonStartupError from app.file_sender import start_file_sender from app.readiness import Readiness from app.message_listener import start_message_listener...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support from test.support import import_helper from test.support import os_helper from test.support import socket_helper from test.support import threading_helper from test.support import warnings_helper import sock...
main.py
import argparse import github3 import toml import json import re from . import utils import logging from threading import Thread, Lock import time import traceback import sqlite3 import requests from contextlib import contextmanager from itertools import chain from queue import Queue import os from enum import IntEnum ...