source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
manager.py | from dataclasses import dataclass
import logging
import threading
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from concurrent.futures.thread import ThreadPoolExecutor
from blspy import G1Element
from skynetpos import DiskProver
from skynet.c... |
command.py | # source jcollado http://stackoverflow.com/questions/1191374/subprocess-with-timeout?rq=1
from os import SEEK_END
import io
import subprocess
from subprocess import TimeoutExpired
import threading
# source https://stackoverflow.com/questions/4789837/how-to-terminate-a-python-subprocess-launched-with-shell-true
import... |
__init__.py | # vim: ts=4:sw=4:et:cc=120
import collections
import datetime
import fcntl
import gc
import importlib
import inspect
import io
import logging
import os, os.path
import queue
import shutil
import signal
import socket
import ssl
import stat
import sys
import tarfile
import tempfile
import threading
import time
import uu... |
00_compute_features.py | import numpy as np
import os
from config import conf
from featureExtraction import gaze_analysis as ga
import threading
import getopt
import sys
from config import names as gs
def compute_sliding_window_features(participant, ws, gazeAnalysis_instance):
"""
calls the gazeAnalysis instance it was given, calls it to ge... |
PyShell.py | #! /usr/bin/env python
import os
import os.path
import sys
import string
import getopt
import re
import socket
import time
import threading
import traceback
import types
import linecache
from code import InteractiveInterpreter
try:
from Tkinter import *
except ImportError:
print>>sys.__st... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from ...util import bfh, bh2u, UserCancelled, UserFacingException
from ...bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from ...bip32 import BIP32Node
from ... import constants
from ...i18n import _
from ...transaction import deserialize, Transaction
from ... |
app.py | # coding=utf-8
import numpy as np
import time
from threading import Thread
# Import modules
from modules import globals
from modules import connection
from modules import sound
from modules import ai
from modules import led
import atexit
# Global inits
#====================================================#
#init and... |
dx_replication.py | #!/usr/bin/env python
# Corey Brune - Feb 2017
#Description:
# This script will setup replication between two hosts.
#
#Requirements
#pip install docopt delphixpy.v1_8_0
#The below doc follows the POSIX compliant standards and allows us to use
#this doc to also define our arguments for the script.
"""Description
Usage... |
mavros_offboard_attctl_test.py | #!/usr/bin/env python2
#***************************************************************************
#
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#... |
handle.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft 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
#
# U... |
plotter.py | import os
import time
from threading import Thread
import numpy as np
import matplotlib.pyplot as plt
from panoptes.utils.time import CountdownTimer
from huntsman.drp.base import HuntsmanBase
from huntsman.drp.collection import ExposureCollection, CalibCollection
__all__ = ("PlotterService",)
FILTER_KEY = "physic... |
multi_process_runner.py | # Lint as: python3
# Copyright 2019 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 ... |
streaming.py | # Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
import httplib
from socket import timeout
from threading import Thread
from time import sleep
import urllib
from tweepy.auth import BasicAuthHandler, OAuthHandler
from tweepy.models import Status
from tweepy.api import API
from tweepy.error im... |
assistant.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys, inspect
import datetime
import signal
import threading
import time
# function: get directory of current script, if script is built
# into an executable file, get directory of the excutable file
def current_file_directory():
path = os.path.realpath(sys.path... |
core.py | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 17 14:13:39 2018
@author: bella
Foreground core for 21cmmc
"""
import logging
from os import path
import numpy as np
import py21cmmc as p21
from astropy import constants as const
from astropy import units as un
from powerbox import LogNormalPowerBox
from powerbox.dft i... |
test_replication.py | """TestCases for distributed transactions.
"""
import os
import time
import unittest
from test_all import db, test_support, have_threads, verbose, \
get_new_environment_path, get_new_database_path
#----------------------------------------------------------------------
class DBReplication(unittest.TestCase)... |
executor.py | """LowLatencyExecutor for low latency task/lambda-function execution
"""
from concurrent.futures import Future
import logging
import threading
import queue
from multiprocessing import Process, Queue
from parsl.serialize import pack_apply_message, deserialize
from parsl.executors.low_latency import zmq_pipes
from pars... |
main.py | import os
import sys
import cv2
import dlib
import numpy as np
import time
import threading
import glob
from skimage import io
face_recognition = dlib.face_recognition_model_v1('./models/dlib_face_recognition_resnet_model_v1.dat')
face_detector = dlib.get_frontal_face_detector()
shape_predictor = dlib.shape_predictor... |
utils.py | # -*- coding: utf-8 -*-
'''
Created on Mar 3, 2017
@author: hustcc
'''
from functools import wraps
from threading import Thread
import json
import click
import datetime
import copy
from webhookit import app
import sys
if sys.version > '3': # noqa
# py3
the_unicode = str # noqa
else: # noqa
# py2
th... |
main.py | ##########################
from bottle import route, run, static_file,request,response
from subprocess import Popen,PIPE,check_output,CalledProcessError,call
import multiprocessing
import requests
import re
import wifi
import mimetypes,os
import pwd
import json
########
import sys
sys.path.append("../lib" )
import t... |
multiping.py | import os
import sys
import time
import threading
class Ping:
def __init__(self):
self._running = True
def terminate(self):
self._running = False
def run(self):
while self._running:
pass
# 子執行緒的工作函數
def job(num, hostname):
response = os.system("p... |
tests.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 us... |
scheduler.py | # coding=utf-8
"""Module that provides a cron-like task scheduler.
This task scheduler is designed to be used from inside your own program.
You can schedule Python functions to be called at specific intervals or
days. It uses the standard 'sched' module for the actual task scheduling,
but provides much more:
* repea... |
pong_v0.py | # La pelota (un sprite) rebotando en las paredes de la ventana.
import pygame
import threading
import time
from empty_display import EmptyDisplay
import lib.colors as Color
WIDTH = 0
HEIGHT = 1
SPEED = 8
class SharedState:
ball_x_coor = 1
CPU_motion = 0
player_motion = 0
player_score = 0
CPU_scor... |
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... |
device_thread.py | # Copyright 2018 Jetperch LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
__init__.py | # -*- coding: utf-8 -*-
# Copyright: (c) 2019-2021, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""Installed collections management package."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import errno
import f... |
multi-worker.py | import tensorflow as tf
import threading, queue
import gym
N_WORKER = 4
EP_MAX = 100
EP_LEN = 50
class Brain(object):
def __init__(self):
pass
def update(self):
global GLOBAL_UPDATE_COUNTER
while not COORD.should_stop():
if GLOBAL_EP < EP_MAX:
# print("I am brain")
UPDATE_EVENT.wait()
print(... |
ChatRoom3.0Client.py | #!/usr/bin/env python
# -.- coding: utf-8 -.-y
import socket
import math
import os
import time
import base64
from Crypto.Cipher import AES
from Crypto import Random
import threading
import random
import Queue
import sys
import argparse
import datetime
from multiprocessing import Process
import getpass
try:
from Tki... |
CodeXBot.py | import sys
import socket
import requests
import bot_settings as settings
import threading
import time
import logging
import collections
from flask_socketio import SocketIO
from queue import Queue
from botCommands import Commands
class TwitchBot():
def __init__(self, username, client_id, token, channel):
se... |
projector.py | #!/usr/bin/python3
import tkinter as tk
import tkinter.font as tkFont
import time
import os
import ctypes
from PIL import Image
from PIL import ImageTk
import threading
import imutils
import numpy as np
from enum import Enum
from optionMenu import optionMenu
from language import Language
from arduino import Arduino
imp... |
test_automap.py | from sqlalchemy.testing import fixtures
from ..orm._fixtures import FixtureTest
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import relationship, interfaces, configure_mappers
from sqlalchemy.ext.automap import generate_relationship
from sqlalchemy.testing.mock import Mock, patch
from sqlalchemy ... |
testM2.py | #!/usr/bin/python
import os
import sys
import numpy as np
import cv2
import time
import threading
from multiprocessing import Process, Queue, Pipe, Manager, Lock
print(os.path.dirname(__file__))
print(os.path.basename(__file__))
print(sys.version_info)
print(cv2.__version__)
class fpsWithTick(object):
def __in... |
utils.py | import multiprocessing as mp
import os
import requests
import pytest
DATA_PATH = os.path.join("tests", "data")
def download(url):
filename = url.rsplit("/")[-1]
filepath = os.path.join(DATA_PATH, filename)
if not os.path.exists(filepath):
with open(filepath, "wb") as f:
response = req... |
main.py | #!/usr/bin/python
# coding=utf-8
# -------------------------------------------------------------
# Telegram Reddit Crawler Bot
#
# Autor: Tiago M Reichert
# Data Inicio: 25/06/2017
# Data Release: 26/06/2017
# email: tiago@reichert.eti.br
# Versão: v1.0a
# --------------------------... |
stk.py | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 4 20:13:37 2020
@author: jolsten
"""
import os, sys, logging
import subprocess
import platform
import time
from pathlib import Path
from .connect import Connect, AsyncConnect
from .exceptions import *
from .utils import STK_DATEFMT
from threading impo... |
main_helpers.py | # Copyright 2017 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.
from __future__ import print_function
import argparse
import contextlib
import datetime
import hashlib
import json
import logging
import logging.handlers
im... |
multireflector.py | # Inspired by, and based on, Adam Tilghman's Multi-Namespace work in
# https://github.com/jupyterhub/kubespawner/pull/218
import threading
import time
from eliot import start_action
from kubernetes import watch
from kubespawner.reflector import NamespacedResourceReflector
from traitlets import Bool
# This is kubernete... |
multiprocessing.py | # Note that `__name__ == '__main__'` is only required for Windows compatibility
# We don't use it because Ubuntu is expected.
from abc import ABC
from abc import abstractmethod
from multiprocessing import Process
from multiprocessing import Pipe
class ProcessWorker(ABC):
r"""Base class for all workers implemen... |
DatasetLoader.py | #! /usr/bin/python
# -*- encoding: utf-8 -*-
import torch
import numpy
import random
import pdb
import os
import threading
import time
import math
from scipy.io import wavfile
from queue import Queue
def round_down(num, divisor):
return num - (num%divisor)
def loadWAV(filename, max_frames, evalmode=True, num_ev... |
carla_rl.py | import glob
import os
import sys
import random
import time
import numpy as np
import cv2
import math
from collections import deque
from keras.applications.xception import Xception
from keras.layers import Dense, GlobalAveragePooling2D
from keras.optimizers import Adam
from keras.models import Model
from keras.callbacks... |
inference_fluidmorph.py | import os
import sys
import cv2
import torch
import argparse
import numpy as np
from tqdm import tqdm
from torch.nn import functional as F
import warnings
import _thread
import threading
from queue import Queue, Empty
warnings.filterwarnings("ignore")
from pprint import pprint, pformat
import time
import psutil
impor... |
federated_sample_CNN_CFA.py | from __future__ import absolute_import, division, print_function, unicode_literals
from keras.utils import to_categorical
from consensus.cfa import CFA_process
import numpy as np
import tensorflow as tf
import datetime
import scipy.io as sio
import multiprocessing
import math
from matplotlib.pyplot import pause
import ... |
run_dispatcher.py | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import os
import logging
from multiprocessing import Process
from django.conf import settings
from django.core.cache import cache as django_cache
from django.core.management.base import BaseCommand
from django.db import connection as django_connection, connecti... |
pseudo_virus.py | #!/usr/bin/env python2
import ctypes
import time
import win32api
import threading
import random
import glob
import os
from string import ascii_lowercase
class cd_drive(object):
def run(self):
while True:
time.sleep(random.randint(1, 20))
action = random.randint(0, 1)
if action:
... |
simple_dataset.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from torch.nn.functional import interpolate
from yolov3.ut... |
deepwalk.py | import torch
import argparse
import dgl
import torch.multiprocessing as mp
from torch.utils.data import DataLoader
import os
import random
import time
import numpy as np
from reading_data import DeepwalkDataset
from model import SkipGramModel
from utils import thread_wrapped_func, shuffle_walks
class DeepwalkTrainer:... |
client_control.py | import traceback
from threading import Thread, Lock
import curses
import time
import socket
import json
from datetime import date
from datetime import datetime
from datetime import timedelta
from astral import LocationInfo
from astral.sun import sun
from dateutil.tz import *
import toml
import os
import requests
import... |
botany.py | #!/usr/bin/env python3
import time
import pickle
import json
import os
import random
import getpass
import threading
import errno
import uuid
import sqlite3
from menu_screen import *
# TODO:
# - Switch from personal data file to table in DB
class Plant(object):
# This is your boat!
stage_list = [
'se... |
iCopy.py | import time, logging, re, chardet
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
CallbackQueryHandler,
ConversationHandler,
)
from telegram.ext.dispatcher import run_async
import utils
from utils import (
folder_name,
sendmsg,
restricted,
menu_keyboa... |
debug_events_writer_test.py | # Copyright 2019 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... |
pipeline_ops_test.py | # Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
train.py | #!/usr/bin/env python
"""Train models."""
import os
import signal
import torch
import onmt.opts as opts
import onmt.utils.distributed
from onmt.utils.misc import set_random_seed
from onmt.utils.logging import init_logger, logger
from onmt.train_single import main as single_main
from onmt.utils.parse import ArgumentPa... |
test_browser_credential.py | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import functools
import random
import socket
import threading
import time
from azure.core.exceptions import ClientAuthenticationError
from azure.core.pipeline.policies ... |
conftest.py | import logging
import os
import random
import time
import tempfile
import threading
from concurrent.futures.thread import ThreadPoolExecutor
from datetime import datetime
from math import floor
from shutil import copyfile
from functools import partial
from botocore.exceptions import ClientError
import pytest
from coll... |
startup.py | import os
import threading
import sys
def run(fname):
with open('fname', 'r') as f:
exec(f.read())
threads = []
with open('startup.conf', 'r') as f:
for i in f.readlines():
threads.append(threading.Thread(target=run, args=(i)))
print(threads)
while sys.stdin.read(9) != 'aqwsderfg':
pass
|
tests.py | # -*- coding: utf-8 -*-
# Unit and doctests for specific database backends.
from __future__ import absolute_import, unicode_literals
import datetime
import threading
from django.conf import settings
from django.core.management.color import no_style
from django.core.exceptions import ImproperlyConfigured
from django.d... |
websocket_client.py | import json
import logging
import socket
import ssl
import sys
import traceback
from datetime import datetime
from threading import Lock, Thread
from time import sleep
from typing import Optional
import websocket
from vnpy.trader.utility import get_file_logger
class WebsocketClient:
"""
Websocket API
A... |
hybridworker.py | #!/usr/bin/env python2
#
# Copyright (C) Microsoft Corporation, All rights reserved.
import ConfigParser
import os
import platform
import shutil
import subprocess
import sys
import threading
import time
import traceback
# import worker module after linuxutil.daemonize() call
sandboxes_root_folder_name = "sandboxes"
... |
service.py | # coding=utf-8
# Copyright 2018 Sascha Schirra
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following di... |
flower_neopixel.py | # coding: UTF-8
import os
import time
import pickle
import base64
import numpy as np
import threading
#from threading import Semaphore, Thread
from neopixel import *
from happymirror_const import *
# Define functions which animate LEDs in various ways.
def colorWipe(strip, color, wait_ms=0):
"""Wipe color across ... |
pyghmicons.py | #!/usr/bin/env python
# Copyright 2013 IBM 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... |
dsPool.py | # -*- coding: utf-8 -*-
from multiprocessing import Process, Pipe
"""
multiprocessing.Pool()と同じ機能を実現するPool()
(クラス内関数も利用できる)
"""
def pipefunc(func, conn,arg):
conn.send(func(arg))
conn.close()
class dsPool:
proc_num = 8
def __init__(self, proc_num):
self.proc_num = proc_num
def map(self... |
test_server.py | import os
import threading
import json
import numpy as np
import pytest
from skimage import io
from skimage._shared._tempfile import temporary_file
from scipy import ndimage as ndi
from gala import features, serve, evaluate as ev
D = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.join(D, 'example-data... |
vt.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2019 DoomedRaven.
# This file is part of VirusTotalApi - https://github.com/doomedraven/VirusTotalApi
# See the file 'LICENSE.md' for copying permission.
from __future__ import print_function
# Full VT APIv3 functions added by Andriy Brukhovetskyy
# doom... |
playback.py | """#!/home/sgc/anaconda3/envs/phaseNet/bin/python"""
# -*- coding: utf-8 -*-
from obspy import UTCDateTime
from obspy.clients.fdsn import Client
import os, multiprocessing
from datetime import timedelta
from utils.merge_xml_picks import merge_xml_picks
def get_xml_Origins(xml_picks,output_file,locator_type="LOCSAT",
... |
__init__.py | # Copyright 2011,2013,2017 James McCauley
#
# 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 t... |
remote_executor.py | # Lint as: python3
# Copyright 2019, The TensorFlow Federated 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 ... |
__init__.py | """
Support to check for available updates for AIS
"""
import asyncio
from distutils.version import StrictVersion
import json
import logging
import os
import platform
import subprocess
from subprocess import PIPE, Popen
import sys
import aiohttp
import async_timeout
import voluptuous as vol
from homeassistant.compon... |
__init__.py | # Copyright 2017 Mycroft AI 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 writin... |
test_container.py | # global
import os
import queue
import pytest
import random
import numpy as np
import multiprocessing
import pickle
# local
import ivy
from ivy.container import Container
import ivy_tests.test_ivy.helpers as helpers
def test_container_list_join(device, call):
container_0 = Container(
{
"a": [... |
wsserver.py | '''
https://opensource.org/licenses/MIT
License: The MIT License (MIT)
Copyright (c) 2016 Ariel Kalingking akalingking@gmail.com
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 restrict... |
1618079756490-webdriver.py | from selenium import webdriver
from twocaptcha import TwoCaptcha
import time
from fake_useragent import UserAgent
from threading import Thread
import random
import requests
import string
solver = TwoCaptcha('f668b604d0954938b5c223f22ca1f90c')
apiKey = 'b2UOnh0HVAAljzfOLLdNvQ7uzu5gkiiMqn7h7sKcdeQv'
def tool(thread):
... |
__main__.py | from discord.ext import commands
import os
from threading import Thread
import time
import re
import lavalink
import discord
class Bot:
def __init__(self, **kwargs):
self.intents = discord.Intents.default()
self.intents.members = True
if "prefix" not in kwargs:
raise "You must provide a prefix"
else:
se... |
host3.py | '''
在host1上修改,合并两个接收端,旨在区分ack和数据报
host1作为客户端
'''
import threading
import pickle
import socket
from Utils3 import PDU, Config, CRC, RecvLogConfig
import os
import signal
import random
import time
host1_config = Config() # 读取配置文件
event = threading.Event() # event flag
lock = threading.RLock() # 递归锁
host1_send_file =... |
misc_util.py | from __future__ import division
import glob
import itertools
import json
import logging
import math
import os
import re
import shutil
import subprocess
from typing import Optional, Tuple, Sequence, Dict, Union
import numpy as np
import torch
import constants
try:
from reprlib import repr
except ImportError:
... |
position_example.py | ########################################################################
#
# Copyright (c) 2017, STEREOLABS.
#
# All rights reserved.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHA... |
client.py | #!/usr/bin/env python
from json import dumps
from threading import Thread
from websocket import create_connection
import sys
def receive():
while True:
try:
greeting = ws.recv()
print("< {}".format(greeting))
except:
pass
ws = create_connection('ws://localhost... |
subproc_vec_env.py | import numpy as np
from multiprocessing import Process, Pipe, set_start_method
from vec_env import VecEnv, CloudpickleWrapper
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while True:
cmd, data = remote.recv()
if cmd == 'step':
... |
flask_index_task.py | from ..search import Search
import threading
import subprocess
import markdown
import logging
import codecs
import os, json
from datetime import datetime
from werkzeug.contrib.fixers import ProxyFix
from flask import Flask, request, redirect, url_for, render_template, flash, jsonify
from flask import Markup
from fla... |
scanner.py | import threading
import socket
import sys
from datetime import datetime
open_ports = []
def scan_ports(name, start_port, max_port):
try:
for port in range(start_port, max_port):
if (port - 1) == max_port - 1:
print(name, "is finishing its tasks")
s = socket.socket(... |
spaceapi.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0111,R0903
"""Displays the state of a Space API endpoint
Space API is an API for hackspaces based on JSON. See spaceapi.io for
an example.
Requires the following libraries:
* requests
* regex
Parameters:
* spaceapi.url: String representati... |
my_mulprocess.py | from multiprocessing import Process
import multiprocessing
from time import sleep, ctime
import os
# def clock(interval):
# while True:
# print("The time is {0}".format(ctime()))
# sleep(interval)
#
# if __name__ == '__main__':
# p = multiprocessing.Process(target=clock, args=(5,))
# p.star... |
pythonic_video_tracker.py | import os
import time
from collections import deque
import copy
from datetime import datetime
from queue import SimpleQueue
from threading import Thread
import pcv
import cv2
import imageio
from pcv.vidIO import LockedCamera, SlowCamera, Camera
from db.video_data_db import insert_image
from device_tracking import Tra... |
migrate.py | #!/usr/bin/env python
#***************************************************************************
#* Copyright (c) 2021 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or... |
conftest.py | # Copyright The PyTorch Lightning team.
#
# 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 i... |
keylime_agent.py | #!/usr/bin/python3
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
import asyncio
import http.server
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import threading
import base64
import configparser
import uuid
impor... |
client.py | __author__ = 'bensoer'
from socket import *
import threading
import sys
bufferSize = 2048
serverName = 'localhost'
serverPort = 1400
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.bind((serverName, serverPort))
canCheck = 1
def checkForReceiving():
message, clientAddress = serverSocket.recvfrom(buffe... |
thread-closure-bug-demo.py | # This is a reproducer for:
# https://bugs.python.org/issue30744
# https://bitbucket.org/pypy/pypy/issues/2591/
import sys
import threading
import time
COUNT = 100
def slow_tracefunc(frame, event, arg):
# A no-op trace function that sleeps briefly to make us more likely to hit
# the race condition.
t... |
test_auto_scheduler_search_policy.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
parsing.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* --------... |
wxPython06_Embed_ControlFrameworks.py | # coding=utf-8
import tkinter as tk
from tkinter import ttk
from threading import Thread
win = tk.Tk()
win.title("Python GUI")
ttk.Label(win, text="This is a test!").grid(column=0, row=0)
def wx_app():
import wx
app = wx.App()
frame = wx.Frame(None, -1, "wxPython GUI", size=(200, 150))
frame.SetBack... |
utility.py | import os
import math
import time
import datetime
from multiprocessing import Process
from multiprocessing import Queue
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import imageio
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lrs
class time... |
mp_parse, 31-7-2021.py | from queue import Queue
import threading
import os
import time
"""
Bresenham Algothms for drawing lines
use -> plotLine(pStart, pEnd)
p_start : <tuple> initial point
p_end : <tuple> end point
return <list.tuple> in between points
"""
def plotLineM(x0, y0, x1, y1):
dx = int(x1 - x0)
dy = int(y1 - y0)
... |
plugin.py | import threading
from binascii import hexlify, unhexlify
from electrum.util import bfh, bh2u
from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, NetworkConstants)
from electrum.i18n import _
from electrum.plugins import BasePlugin
from elect... |
executorwebdriver.py | import json
import os
import socket
import sys
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
... |
demo_image_repo.py | """
demo_image_repo.py
Demonstration code handling an Image Repository.
Use:
import demo.demo_image_repo as di
di.clean_slate()
See README.md for more details.
<Demo Interface Provided Via XMLRPC>
XMLRPC interface presented TO THE DEMO WEBSITE:
add_target_to_image_repo(target_filepath, filepat... |
eval_mini_srcgame_add_map_bn.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
USED_DEVICES = "4,5"
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = USED_DEVICES
import sys
import threading
import time
import tensorflow as tf
from absl import... |
relay_integration.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
Server.py | from flask import Flask, render_template, request
from threading import Thread
from sys import argv
import logging, time, sys
logging.getLogger('werkzeug').setLevel(logging.ERROR)
tokens = {'tokens':[],'used':[]}
app = Flask(__name__)
def tokenremoval(token):
tokens['tokens'].append(token)
time... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.