source
stringlengths
3
86
python
stringlengths
75
1.04M
dash_buffer.py
from __future__ import division import Queue import threading import time import csv import os import config_dash from stop_watch import StopWatch # Durations in seconds PLAYER_STATES = ['INITIALIZED', 'INITIAL_BUFFERING', 'PLAY', 'PAUSE', 'BUFFERING', 'STOP', 'END'] EXIT_STATES = ['STOP', 'END'] cl...
helpers.py
# All helpers method here import time import logging import threading from .iv import InformationValue from ipywidgets.widgets import FloatProgress # from IPython.display import display logger = logging.getLogger(__name__) class Queue: def put(self, item): self.item = item def get(self): re...
contandoThreadsAtivas.py
# CONTANDO THREADS ATIVAS from concurrent.futures import thread import threading import time import random def minhaThread(i): print("Thread {}: inicializada".format(i)) time.sleep(random.randint(1,5)) print("\nThread {}: finalizada".format(i)) for i in range(random.randint(2,50)): thread=threading....
pretrained.py
# Copyright 2017-2022 John Snow Labs # # 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...
keep_alive_monitor.py
# std import logging import urllib.request from datetime import datetime from threading import Thread from time import sleep from typing import List # project from . import EventService, Event, EventType, EventPriority class KeepAliveMonitor: """Runs a separate thread to monitor time passed since last keep-a...
threadDemo.py
#!python3 # import threading, time print("Start of program.") def takeANap(): time.sleep(5) print("Wake up!") threadObj = threading.Thread(target=takeANap) threadObj.start() print("End of program.")
inf_ctr_mod.py
import time, threading, sys def counter(c_var): while True: c_var = c_var + 1 #print(c_var) if __name__ == "__main__": c = 0 ct = threading.Thread(target = counter, args = (c,)) ct.start() print("Counter started.") time.sleep(2) print(c) sys.exit()
034.py
#!/usr/bin/python # -*- coding: utf-8 -*- ''' 多线程 ''' import time, threading # 新线程执行的代码: def loop(): print('thread %s is running...' % threading.current_thread().name) n = 0 while n < 5: n = n + 1 print('thread %s >>> %s' % (threading.current_thread().name, n)) time.sleep(1) ...
train_sampling_unsupervised.py
import dgl import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch.multiprocessing as mp from torch.utils.data import DataLoader import dgl.function as fn import dgl.nn.pytorch as dglnn import time import argparse from _thread import start_new...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight bitcoinprivate client # Copyright (C) 2012 thomasv@gitorious # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # includin...
test_browser.py
import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex from runner import BrowserCore, path_from_root from tools.shared import * # User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to # run using another browser command line tha...
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...
sim.py
import asyncio import time as ttime from collections import deque, OrderedDict import itertools import numpy as np import random import threading from tempfile import mkdtemp import os import warnings import weakref import uuid import copy import logging from .signal import Signal, EpicsSignal, EpicsSignalRO from .sta...
camera.py
import abc import math import threading import time from collections.abc import Generator from typing import Optional import cv2 import numpy as np class BaseCamera(abc.ABC): def __init__( self, *, output_fps: float = 25.0, camera_fps: float = 25.0, ) -> None: """Start...
ui_client.py
from _thread import interrupt_main from threading import Thread from .pipe import Pipe class UI: def __init__(self, pipe): # type: (Pipe) -> None self.__pipe = pipe self.__thread = Thread(target=self.__update) self.__alive = True self.__thread.start() self.interrup...
thead_lock2.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import threading import time num = 0 def run(n): time.sleep(1) global num lock.acquire() #获取锁 num +=1 print '%s\n' %num lock.release() #释放锁 lock = threading.Lock() #实例化锁 for i in range(100): t = threading.Thread(target...
test_io.py
from __future__ import division, absolute_import, print_function import sys import gzip import os import threading from tempfile import mkstemp, NamedTemporaryFile import time import warnings import gc from io import BytesIO from datetime import datetime import numpy as np import numpy.ma as ma from numpy.lib._iotool...
messaging.py
import copy import datetime import logging import re import salt.exceptions import salt.utils.event import threading import threading_more import time import urlparse import uuid from salt_more import SuperiorCommandExecutionError from timeit import default_timer as timer log = logging.getLogger(__name__) class Me...
client.py
# Python 3.6.2 import socket import struct import threading import datetime import os import random import sys import secrets from time import sleep from hashlib import sha3_224 # Switch to the directory containing client.py this_dir = os.path.dirname(os.path.realpath(__file__)) os.chdir(this_dir) # Insert the server...
RecoderRobotData.py
# MIT License. # Copyright (c) 2020 by BioicDL. All rights reserved. # Created by LiuXb on 2020/11/24 # -*- coding:utf-8 -*- """ @Modified: @Description: """ import threading import time import queue from deepclaw.driver.arms.URController_rtde import URController import pickle # receive class GetRobotData(object): ...
spatialquerytests.py
import logger import time import unittest import threading from threading import Thread from membase.helper.rebalance_helper import RebalanceHelper from couchbase_helper.cluster import Cluster from basetestcase import BaseTestCase from remote.remote_util import RemoteMachineShellConnection import json import sys from ...
adbclient.py
# -*- coding: UTF-8 -*- # # Tencent is pleased to support the open source community by making QTA available. # Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the BSD 3-Clause License (the "License"); you may not use this # file except in compliance with the License. You may...
__init__.py
""" firebase Python package is a python interface to the Google's Firebase REST APIs By Joe Tilsed """ import json import time import math import socket import requests import datetime import threading import python_jwt as jwt from gcloud import storage from random import uniform from requests import Session from ss...
__init__.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributi...
gap.py
r""" Interface to GAP Sage provides an interface to the GAP system. This system provides extensive group theory, combinatorics, etc. The GAP interface will only work if GAP is installed on your computer; this should be the case, since GAP is included with Sage. The interface offers three pieces of functionality: #....
deepwalk.py
from gensim.models import Word2Vec import numpy as np import multiprocessing as mp import threading as thread def deepwalk(graph): args = DeepWalkSetting() return DeepWalk_Original(args, embed_dim=args.embed_dim, workers=args.workers, graph=graph, ).get_embeddings() class DeepWalkSetting: '''Configuration...
initserver.py
import settings settings.generateConfigFile() import reddit import socketserverhandler import socketservervideogenerator from time import sleep import database import datetime from threading import Thread import atexit def getScripts(): global lastUpdate print("Grabbing more scripts...") info = reddit.get...
simulator.py
from utils import GFrame from sokoban import * from utils import * from state import * from time import sleep from threading import Thread, currentThread, active_count from tkthread import TkThread import random class Simulator(): def __init__(self, map="fake", wait_time=1): self._map = map self._wait_time ...
beerchain_transaction_receipt_origin_contract_address.py
#!/usr/bin/env python3 from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * from test_framework.script import * from test_framework.mininode import * from test_framework.address import * import threading def waitforlogs(node, contract_address): logs = node.cli.waitforlo...
test_serializable_fails_if_update_same_rows.py
############## # Setup Django import django django.setup() ############# # Test proper import threading import time import pytest from django.db import DatabaseError, connection, transaction from django.db.models import F, Subquery from app.models import Sock @pytest.mark.django_db def test_serializable_fails_if_...
server_lifecycle.py
from threading import Thread import src.datastore def on_server_loaded(server_context): ''' If present, this function is called when the server first starts. ''' t = Thread(target=src.datastore.load, args=()) t.setDaemon(True) t.start() def on_server_unloaded(server_context): ''' If present, th...
langserver_ext.py
import logging import subprocess import threading from tornado import ioloop, process, web, websocket from pyls_jsonrpc import streams try: import ujson as json except Exception: # pylint: disable=broad-except import json log = logging.getLogger(__name__) class LanguageServerWebSocketHandler(websocket.We...
athenad.py
#!/usr/bin/env python3 import base64 import bz2 import hashlib import io import json import os import queue import random import select import socket import subprocess import sys import tempfile import threading import time from collections import namedtuple from datetime import datetime from functools import partial f...
runtime.py
import os import sys import re import subprocess import shlex import fcntl import time import threading def pipe_stdin_writer(pipe, buf): pipe.stdin.write(buf) pipe.stdin.close() def runner_wrap(pipes, main, piping, outputs, pipe_timeout, pipe_timeout_is_error): r = Runner(pipes, main, piping, outputs=out...
build_imagenet_data.py
# Copyright 2016 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...
test_browser.py
import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex from runner import BrowserCore, path_from_root from tools.shared import * # User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to # run using another browser command line tha...
rse.py
# -*- coding: utf-8 -*- # Copyright 2014-2021 CERN # # 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...
server.py
# -*- coding: utf-8 -*- """ DNS server framework - intended to simplify creation of custom resolvers. Comprises the following components: DNSServer - socketserver wrapper (in most cases you should just need to pass this an appropriate resolver instance an...
judge.py
from re import sub import epicbox import threading from django.conf import settings epicbox.configure(profiles=[ epicbox.Profile("python", "0xecho/python3.8.12:latest") ]) GLOBAL_LIMITS = {"cputime": 5*60, "memory": 512} def judge(submission): t = threading.Thread(target=judge_worker, args=(submission,)) ...
main.py
import cv2 from configs.settings import Settings import darknet from threading import Thread import time, pylaxz from queue import Queue """ Configs = {debug},{own_camera} """ class Application: def __init__(self) -> object: self.load_camera() if hostcamera else self.load_hub() if not nodetect: s...
cheekymonkey.py
#!/usr/bin/env python3 import timeit import os import arcade # from arcade.examples.frametime_plotter import FrametimePlotter # from arcade import FrametimePlotter from pyglet.gl import GL_NEAREST, GL_LINEAR import pymunk import logging import math import time import threading import argparse from signal import signal,...
tree_index_builder.py
# Copyright (c) 2021 PaddlePaddle 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 appli...
led.py
""" by Denexapp """ import threading import time import RPi.GPIO as GPIO class led(): def __init__(self, pin, period, invert=False): self.stop = True self.on = 0 self.off = 1 if invert: self.on = 1 self.off = 0 GPIO.setmode(GPIO.BCM) self.pi...
multiprocessing_env.py
# -*- coding: utf-8 -*- """ # Author : Camey # DateTime : 2022/4/19 10:25 下午 # Description : """ # 该代码来自 openai baseline,用于多线程环境 # https://github.com/openai/baselines/tree/master/baselines/common/vec_env import numpy as np from multiprocessing import Process, Pipe def worker(remote, parent_remote, env_fn_wr...
handler.py
import io import json import logging import socket import struct import threading import traceback import weakref import paramiko import tornado.web from tornado.ioloop import IOLoop from tornado.util import basestring_type from webssh.worker import Worker, recycle_worker, workers try: from concurrent.futures imp...
test_fork_locking.py
import logging import os import time import threading import unittest import _fork_locking #import _dummy_fork_locking as _fork_locking class ForkLockingHelpers(object): LockActionsCounter = 0 ForkActionsCounter = 0 LockActionsGuard = threading.Lock() @classmethod def LockActionsThreadProc(cls):...
event.py
# coding=utf8 import time import datetime import json import uuid import sys import threading import zmq import os import websocket from log import get_logger from load import mod_load from dog import WATCH_DIR sys.path.append(WATCH_DIR) class StrackEvent(websocket.WebSocketApp): def __init__(self, host, inte...
01_.py
""" Parte 1 """ import threading print(threading.active_count()) # Retorna a contagem das threads print(threading.enumerate()) # Retonar uma iterável das threads """ parte 2 """ import threading print(threading.enumerate()[0].name) # Nome da thread print(threading.enumerate()[0].is_alive()) # Stado da thread """...
decorator.py
#! /usr/bin/env python # -*- coding: UTF-8 -*- import threading import time import os import sys import platform import functools def chdir(dir_path=''): """自动调用os.chdir :param dir_path: :return: """ def _chdir(func): @functools.wraps(func) def __chdir(*args, **kwargs): ...
lock_management.py
import threading shared_resource_with_lock = 0 shared_resource_with_no_lock = 0 COUNT = 100000 shared_resource_lock = threading.Lock() ####LOCK MANAGEMENT## def increment_with_lock(): global shared_resource_with_lock for i in range(COUNT): shared_resource_lock.acquire() s...
node.py
# Importing socket library in python import socket import sys import time import threading import logging import re from abc import ABC, abstractmethod """ Abstract class with functions to create & handle a node. """ class Node(ABC): def __init__(self): """ Must be called by every derived ...
UsageRunner.py
# Copyright 2008-2012 Nokia Siemens Networks Oyj # # 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...
test_retry_logic.py
#!/usr/bin/env python # # (c) Copyright 2020 Hewlett Packard Enterprise Development LP # # 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...
StreamDeck.py
# Python Stream Deck Library # Released under the MIT license # # dean [at] fourwalledcubicle [dot] com # www.fourwalledcubicle.com # import threading import time from abc import ABC, abstractmethod from ..Transport.Transport import TransportError class StreamDeck(ABC): """ Represents...
test_functional.py
try: from importlib import reload except ImportError: pass import json import os import queue import tempfile import threading import pytest from . import serve from wptserve import logger class ServerProcSpy(serve.ServerProc): instances = None def start(self, *args, **kwargs): result = sup...
server_test.py
import socket import unittest import threading import functools import time import asyncore from glide.server import CommandServer, CommandBaseHandler PORT = 32767 class Tester(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_proc_handler(self): client...
bclient.py
import socket import pickle import threading import sys import hashlib import os import OpenSSL from OpenSSL import SSL from OpenSSL import crypto from Crypto import Random from Crypto.Cipher import AES from diffiehellman.diffiehellman import DiffieHellman from OpenCA import createCSR import Encryptor imp...
test_dataloader.py
# Owner(s): ["module: dataloader"] import math import sys import errno import multiprocessing import os import ctypes import faulthandler import torch import gc import time import signal import unittest import itertools import warnings import tempfile from torch import multiprocessing as mp from torch.utils.data impor...
Glue.py
#!/usr/bin/env python # encoding: utf-8 import sublime import sublime_plugin from sys import version_info import subprocess import os import threading import shlex import json import traceback if version_info[0] == 3: import io from .GlueIO import FileReader else: import StringIO from GlueIO import Fi...
postgresql_database_tests.py
from datetime import datetime import unittest import psycopg2 from time import sleep from pyDBMS.database.postgres_database import PostgresDatabase from tests.example_types import LogTimestamp, SimpleChildModel, SimpleModel, SpecialDate class TestPostgresDB(unittest.TestCase): DATABASE_NAME = 'test_database' d...
test_windbgmon.py
import os import threading import win32api import windbgmon def test_dbgmon(): messages = [] with windbgmon.DbgMon() as dbgmon: def monitor(): for pid, msg in dbgmon: messages.append((pid, msg)) thread = threading.Thread(target=monitor) thread.start...
client3.py
import socket import threading from datetime import datetime import traceback import sys import queue class TCP_Nonblocking_Client: def __init__(self, host, port, name): self.host = host self.port = port self.sock = None self.format = 'utf-8' self.received_messages = queue...
inspirobot.py
#!/usr/bin/python # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- """ Variety quote plugin sourcing quotes from inspirobit.me This script is placed in '~/.config/variety/plugins' and then activated from inside Variety's Preferences Quotes menu If script fails, you need to run...
run.py
import sys import signal import threading import asyncio import aiohttp import conf_loader import notifier import bili_sched import printer import bili_statistics from console_cmd import ConsoleCmd from tasks.login import LoginTask from tasks.live_daily_job import ( HeartBeatTask, OpenSilverBoxTask, RecvD...
test_backend.py
import base64 import copy import datetime import threading import time import unittest from datetime import timedelta from unittest.mock import Mock, patch from django.conf import settings from django.contrib.sessions.backends.cache import SessionStore as CacheSession from django.core.cache import DEFAULT_CACHE_ALIAS,...
crawling_summary.py
# -*- coding: utf-8 -*- from __future__ import print_function from datetime import datetime # +++++++++++++++++++++++++++++++++++++ # 최종 크롤러!!! # ++++++++++++++++++++++++++++++++++++ from time import sleep from time import sleep from bs4 import BeautifulSoup from multiprocessing import Process, Queue import os import ...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
launch_data_pkt_sim.py
import time def load_config(): fin = open("host.config", "r") host_info = [] while True: try: host_name, host_mnet_pid = fin.readline().split()[0], int(fin.readline()) host_info.append((host_name, host_mnet_pid)) print(host_name, host_mnet_pid) _ = f...
mp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import alfred import os import plistlib import json import codecs import urllib2 import logging import inspect from subprocess import call import tempfile import shutil import logging.handlers import threading import Queue class Workflow(): def __init__(self, dirname...
installwizard.py
import sys import os from PyQt5.QtGui import * from PyQt5.QtCore import * import PyQt5.QtCore as QtCore import electrum_ltc as electrum from electrum_ltc import Wallet, WalletStorage from electrum_ltc.util import UserCancelled, InvalidPassword from electrum_ltc.base_wizard import BaseWizard from electrum_ltc.i18n im...
dash_buffer.py
from __future__ import division import queue import threading import time import csv import os import config_dash from stop_watch import StopWatch # Durations in seconds PLAYER_STATES = ['INITIALIZED', 'INITIAL_BUFFERING', 'PLAY', 'PAUSE', 'BUFFERING', 'STOP', 'END'] EXIT_STATES = ['STOP', 'END'] cl...
bus.py
from abc import abstractmethod from asyncio.tasks import Task from configparser import ConfigParser import threading import asyncio import queue import os import time import sys from functools import reduce from random import getrandbits, randrange from typing import Any, Callable, Coroutine, Optional, Tuple, TypeVar,...
builder.py
# Copyright 2018 DeepMind Technologies Limited. 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 ...
Computation.py
#!/usr/bin/python import random import time import sys import zmq from mpi4py import MPI from multiprocessing import Process, Value def sensor_reading(port, sensor): context = zmq.Context() socket = context.socket(zmq.REP) socket.bind("tcp://*:" + str(port.value)) while True: message = socket.recv()...
MeasurementsClient.py
import logging import os import signal import csv import time import shutil import subprocess import datetime import json import sys import schedule import pickle import threading with open('config.json', 'r') as f: config = json.load(f) #Get the constants for the RIPE Atlas Measurements from config.json. target ...
enlarger.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time from threading import Thread from gpiozero import OutputDevice class Enlarger(OutputDevice): def __init__(self, pin): super(Enlarger, self).__init__(pin, initial_value=True) self.printing = False self.print_thread = None s...
rocket.py
# -*- coding: utf-8 -*- # This file is part of the Rocket Web Server # Copyright (c) 2011 Timothy Farrell # Modified by Massimo Di Pierro # Import System Modules import sys import errno import socket import logging import platform from gluon._compat import iteritems, to_bytes, to_unicode, StringIO from gluon._compat...
red_test.py
#!/usr/bin/env python import logging from redbot.resource import HttpResource import redbot.speak as rs import thor import threading from tornado import gen from tornado.options import parse_command_line from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase from tornado.web import RequestHandler, Application,...
wrap_rank.py
""" wrap_rank.py prefixes every line of output from a worker process with the rank that emitted it. In distributed training, the rank prefix added by wrap_rank.py is necessary for the WebUI log viewer's filter-by-rank feature to work. Additionally, when used in a Determined container, wrap_rank.py redirects stdout an...
utils.py
# Copyright 2020 - 2021 MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in wri...
lab8_e.py
from sys import setrecursionlimit import threading import queue setrecursionlimit(10 ** 9) threading.stack_size(67108864) def main(): file_input, file_output = open('pathbge1.in', 'r'), open('pathbge1.out','w') #non-recursive depth-first-searchw with dist minimization def bfs(graph, source, n): ...
GeniusLyricsGUI.py
import os import threading from tkinter import * from tkinter import messagebox from GeniusLyrics import search_song_lyrics, song_dict class GeniusLyricsGUI: def __init__(self, tk_root: Tk): tk_root.resizable(width=False, height=False) self.lyrics_frame = Frame(tk_root) self.songName = St...
test_win32file.py
import unittest from pywin32_testutil import str2bytes, TestSkipped, testmain import win32api, win32file, win32pipe, pywintypes, winerror, win32event import win32con, ntsecuritycon import sys import os import tempfile import threading import time import shutil import socket import datetime import random import win32tim...
train.py
import sys import os import argparse from setup.settings import hparams, preprocessing import math sys.path.append(os.path.dirname(os.path.realpath(__file__))) sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/nmt") from nmt import nmt import tensorflow as tf import colorama from threading import Thread f...
dashboard.py
#!/usr/bin/env python import Tkinter as tk import cv2 import os import tensorflow as tf import align.detect_face import facenet import tkMessageBox import argparse import time import shutil import threading import change_name_dialog import rospy import numpy as np from scipy import misc from Tkinter import * from PIL i...
zconfig.py
#!/usr/bin/python -OO # Copyright 2008-2017 The SABnzbd-Team <team@sabnzbd.org> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later...
usbcameradriver.py
# -*- coding: utf-8 -*- ''' Created on 24. Sep. 2015 ''' __version__ = '0.0.4' __author__ = "Dietmar Millinger" import sys sys.path.insert(1, '../') import os from drivers.driver import * import time from datetime import datetime import threading from PIL import Image, ImageChops import math import numpy as np f...
test_gateway.py
import functools import time from threading import Thread import numpy as np import pytest import requests from jina.enums import CompressAlgo from jina.executors.encoders import BaseEncoder from jina.flow import Flow from tests import random_docs concurrency = 10 class DummyEncoder(BaseEncoder): def encode(se...
webgui02.py
# Another simple example of how PyMOL can be controlled using a web browser # using Python's built-in web server capabilities try: import BaseHTTPServer except ImportError: import http.server as BaseHTTPServer import time import cgi import threading import traceback import os, sys, re from pymol import cmd f...
原始版_GSLST.py
import sys # sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') import numpy as np import tkinter as tk import time import cv2 as cv import multiprocessing as mp import jps_GSLST as J #注意,不同的线程的self的东西不是共享的 """ Log 1. 通过border中的点被检索后,remove该点,来减去了team的去重操作 2. 更改了JPS生成的点,现在只会把关键点放到生成路径中,而不是步长为1的所有点(JPS得到...
multiprocess_window.py
""" How to run a cancellable function when a new Tkinter window opens https://stackoverflow.com/questions/37669517/how-to-run-a-cancellable-function-when-a-new-tkinter-window-opens """ from tkinter import ttk, messagebox, Toplevel, Tk from tkinter.ttk import Frame, Button import time import multiprocessing def foo():...
test_direct.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright (c) 2002-2020 "Neo4j," # Neo4j Sweden AB [http://neo4j.com] # # This file is part of Neo4j. # # 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 L...
gate_runner.py
# Copyright 2019 École Polytechnique Fédérale de Lausanne. 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 r...
sync.py
""" This module is about synchronizing and coordinating events among concurrent activities. """ from contextlib import contextmanager, ExitStack import sys import threading import time import inspect from functools import wraps import re import logging import atexit import signal import os from collections import Cou...
hedgerbot.py
import logging from .observer import Observer import json import time import os import math import os, time import sys import traceback import config from private_markets import haobtccny, brokercny from .marketmaker import MarketMaker import threading class HedgerBot(MarketMaker): exchange = 'HaobtcCNY' hedge...
data.py
import os # import cv2 import random import tempfile import numpy as np from Queue import Queue from threading import Thread import nipy from data_providers.base_provider import VideosDataset, DataProvider from datasets.hdf5_loader import get_data class Data(VideosDataset): def __init__(self, name, train_ids, nor...
runner.py
import argparse import json import logging import os import threading import time import traceback import colors import docker import numpy import psutil from ann_benchmarks.algorithms.definitions import (Definition, instantiate_algorithm) from ann_benchmarks.dataset...
server.py
#!/usr/bin/env python import socket, threading, time def handle(s): print repr(s.recv(4096)) s.send(''' HTTP/1.1 101 Web Socket Protocol Handshake\r Upgrade: WebSocket\r Connection: Upgrade\r WebSocket-Origin: http://bettingisbelieving.com:8888\r WebSocket-Location: ws://bettingisbelieving.com:9876/\r WebSocket-P...
web_control.py
#!/usr/bin/env python # coding:utf-8 import os, sys current_path = os.path.dirname(os.path.abspath(__file__)) if __name__ == "__main__": python_path = os.path.abspath( os.path.join(current_path, os.pardir, 'python27', '1.0')) noarch_lib = os.path.abspath( os.path.join(python_path, 'lib', 'noarch')) sys.pa...
test_auth.py
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-------------------------------------------------------------------------- import pytes...