source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
manager.py | #!/usr/bin/env python3
import os
import time
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import datetime
import textwrap
from typing import Dict, List
from selfdrive.swaglog import cloudlog, add_logentries_handler
from common.basedir import BASEDIR, PARAMS
from common.android im... |
btdripper.py | #!/usr/bin/env python3
# *-*- coding: utf-8 -*-
import gatt
import threading
import logging
class BtDripper(gatt.Device):
DRIPPER_SERVICE_UUID = '0000ffe0-0000-1000-8000-00805f9b34fb'
DRIPPER_CHARACTERISTIC_UUID = '0000ffe1-0000-1000-8000-00805f9b34fb'
SEQUENCE_ON = [b'\x01\x01\x10\x02\x00\x01\x58\xca',
... |
main.py | import json
import mysql.connector
import config
from multiprocessing import Process
import time
import logging
from logging.handlers import RotatingFileHandler
import gateway
import acquisition
def main():
"""main"""
# create logger
logger = logging.getLogger('myems-modbus-tcp')
# spec... |
videoGet2.py | import cv2
import pyrealsense2 as rs
import numpy as np
from threading import Thread
import math
class imageCapRS2:
def commandThread(self):
while not self.stopped:
self.ready = False
self.frames = self.pipeline.wait_for_frames()
self.ready = True
self.depth... |
root_diff.py | """Calculates the difference between two ROOT (https://root.cern.ch/) files.
If a difference is present, the command will create plots for the distributions that differ.
TODO: separate functionality: plotting, recursive reading of ROOT files, diff calculation
TODO: allow for injection of user-defined high-level varia... |
run_GSM_DAG_on_38_willems.py | import argparse
import json
import multiprocessing
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sandbox.meio.gsm.analysis_utils import run_gsm, get_network, print_supply_chain_log
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Running ... |
manager.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... |
common_func.py | #!/usr/bin/env python
# coding=utf-8
from __future__ import print_function, unicode_literals, division, absolute_import
import sys
import time
import binascii
import struct
import collections
import logging
import socket
import functools
import threading
import traceback
import warnings
try:
import selectors
f... |
__init__.py | import logging
import time
from enum import Enum
from threading import Thread
from collections import defaultdict
from typing import Optional, Union, Tuple, Set, Type, Callable
import serial
from . import protocol
from .protocol import (
ReceiveMessage,
TimeMessage,
AccelerationMessage,
AngularVeloci... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import importlib.machinery
import importlib.util
import os
import pickle
import random
import re
import subprocess
import sys
import t... |
net_suite_test.py | import re
import os
import sys
import socket
from threading import Thread, Event
import subprocess
import time
from shutil import copyfile
try:
import IDF
except ImportError:
# this is a test case write with tiny-test-fw.
# to run test cases outside tiny-test-fw,
# we need to set environment variable `... |
issue_1856.py | #!/usr/bin/env python
# https://bugs.python.org/issue1856
import os
import sys
import time
import threading as mt
def work(parent):
i = 0
while True:
print i,
i += 1
time.sleep(0.1)
def test():
parent = None
for th in mt.enumerate():
if th.name == 'MainThread':
... |
cal_match_pct.py | # Apache License Version 2.0
# Copyright 2022 Xin Huang
#
# 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... |
utils_test.py | #!/usr/bin/env vpython
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
# Disable 'Access to a protected member ...'. NDB uses '_' for other purposes.
# pylint: disable=W0212
import datetime
imp... |
checker.py | import asyncio
import aiosonic
import re
import os
import time
import threading
from tasksio import TaskPool
from colorama import init, Fore, Back, Style
init(convert=True)
TOKENS_LOADED = 0
TOKENS_INVALID = 0
TOKENS_LOCKED = 0
TOKENS_VALID = 0
TOKENS_VALID_LIST = []
def filter_tokens(unfiltered):... |
main.py | # Importing modules
import logging
import logging.handlers
from contextlib import suppress
import os
def make_logger():
with suppress(FileExistsError): os.mkdir('logs')
LOG_FILENAME = 'logs/main.log'
# Set up a specific logger with our desired output level
log = logging.getLogger('MainLogger')
log.s... |
parallel.py | # -*- coding: utf-8 -*-
#
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
#
# 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
#
# Un... |
error_correction.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module wraps the error correction process and attaches readers to the process pipes.
The code for the error correction process can be found under:
https://github.com/kurtsiefer/qcrypto/tree/master/errorcorrection
Copyright (c) 2020 Mathias A. Seidler, S-Fifteen... |
js_container.py | #!/usr/bin/env python
# Program Name : js_container.py
# Description : Delphix implementation script
# Author : Corey Brune
# Created: March 4 2016
#
# Copyright (c) 2016 by Delphix.
# All rights reserved.
# See http://docs.delphix.com/display/PS/Copyright+Statement for details
#
# Delphix Support statement avai... |
db_test.py | import threading
import uuid
from typing import Dict
from sqlalchemy import text
from sqlalchemy.orm import Session
from fuck_sql.db_conn import DBContext
from fuck_sql.models import Test
class DBTest:
def insert(self, db: Session, obj):
db.add(obj)
db.commit()
def limit_update(self, db: S... |
arcanecam.py | import pyvirtualcam
import numpy as np
import matplotlib.pyplot as plt
import cv2
import multiprocessing
from torchvision import transforms
from facenet_pytorch import MTCNN
import torch, PIL
import torch.nn.functional as F
import time
from tqdm.auto import tqdm
def detect(mtcnn, img):
# Detect faces
batch_boxes, ba... |
ProxyRefreshSchedule.py | # -*- coding: utf-8 -*-
# !/usr/bin/env python
"""
-------------------------------------------------
File Name: ProxyRefreshSchedule.py
Description : 代理定时刷新
Author : JHao
date: 2016/12/4
-------------------------------------------------
Change Activity:
2016/12/4: 代... |
handlers.py | # Copyright 2001-2016 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
process_server_demo.py | """
创建tcp套接字
等待客户端连接
客户端连接,则创建子进程
"""
from socket import *
from multiprocessing import Process
import sys
HOST = "0.0.0.0"
PORT = 6955
ADDR = (HOST, PORT)
def main():
tcp_socket = socket()
tcp_socket.bind(ADDR)
tcp_socket.listen(5)
# 循环链接客户端
while True:
try:
connfd, addr = tcp... |
test_events.py | """Tests for events.py."""
import collections.abc
import concurrent.futures
import functools
import gc
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
... |
simulator.py | """Provide a stream of random orders to exercise the services."""
from numpy.random import (poisson, randint)
from os import environ
from requests import put, get, post
from threading import Thread, active_count
from time import sleep
# Constants
MAX_ORDERS = 4 # Total number of orders to create
MAX_QUEUE = 2 # Max... |
manager.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# 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 ... |
interface.py | import logging
import threading
import time
import wave
import pyaudio
log = logging.getLogger(__name__)
class WaveFileTee(object):
def __init__(self, filename, callback):
self.wf = wave.open(filename, 'wb')
self.wf.setnchannels(2)
self.wf.setsampwidth(2)
self.callback = callback
... |
LURKc.py |
from tkinter import Tk, Frame, Listbox, Label, Text, StringVar, BooleanVar, Entry, EXTENDED, MULTIPLE, SINGLE, INSERT, END, ACTIVE, N, S, E, W
from tkinter import ttk
from tkinter.scrolledtext import *
from LURKp import LURKp
import time, threading
### Character Stats ###
character_dict = {
'name': '', # 31 bytes... |
mcts_agent5.py | import argparse
import multiprocessing
from queue import Empty
import random
import time
import os
import re
import glob
import pickle
import numpy as np
import time
import pommerman
from pommerman.agents import BaseAgent, SimpleAgent
from pommerman import constants
from keras.models import Model, load_model, model_f... |
threaded_server.py | from threading import Thread
import socket
import json
import pickle
import logging
import hashlib
class Server:
def __init__(self, port):
self.database = "./users.json"
self.server_port = port
self.users = []
self.connections = []
self.init_server()
def init_server(se... |
marshal.py | # Copyright 2019 Atalaya Tech, 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, ... |
bot.py | #!/usr/bin/env python
# coding: utf-8
from wxbot import *
import json
import math
DEFAULT_WX_ROBOT_SWITCH = True
class WXChatbot(WXBot):
def __init__(self):
WXBot.__init__(self)
self.robot_switch = DEFAULT_WX_ROBOT_SWITCH
def auto_switch(self, msg):
msg_data = msg['content']['data']
stop_cmd = [u'退下', u'... |
kernel.py | from __future__ import print_function
from ipykernel.kernelbase import Kernel
from ipykernel.comm import CommManager
from ipykernel.zmqshell import ZMQInteractiveShell
from IPython.core.display_trap import DisplayTrap
from subprocess import check_output
from traitlets import Instance, Type
import pkg_resources
impo... |
helper.py | import time
from collections import defaultdict
from itertools import chain, combinations
from functools import wraps
from re import match, ASCII
from threading import Thread
from typing import (
Any, Dict, List, Set, Tuple, Optional, DefaultDict, FrozenSet, Union,
Iterable, Callable
)
from mypy_extensions impo... |
onlinescreen.py | from json.decoder import JSONDecodeError
import threading
from functools import partial
from kivy.uix.screenmanager import Screen
from ui.modals import *
import config
import re
import requests
class OnlineScreen(Screen):
def __init__(self, CApp, **kwargs):
super(OnlineScreen, self).__init__(**kwargs... |
server_udp.py | import socket
import threading
from datetime import datetime
from pytz import timezone
code_table = 'utf-8'
hostS = 'networkslab-ivt.ftp.sh'
hostL = '127.0.0.1'
port = 55555
file_end = '37e3f4a8-b8c9-4f22-ad4d-8bd81e686822'
length_of_message = len(f"file{file_end}")
server = socket.socket(socket.AF_INET... |
writer.py | #!/usr/bin/env python
import os
import sys
from time import sleep, strftime
from datetime import datetime
import logging
import json
import pickle
import pika
from greent.util import LoggingUtil
from greent.export import BufferedWriter
from builder.buildmain import setup
from greent.graph_components import KNode, KE... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return 'Bot is alive!'
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start()
|
test_runner.py | #
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... |
simulator.py | import utils
import traceback
import threading
import time
import os
import curses
import random
def printFormatted(line,msg):
screen_w = os.get_terminal_size().columns
format_str = '{: <' + str(screen_w) + '}'
win.addstr(line, 0, format_str.format(msg))
win = None
mainLoop = True
sendLoop ... |
calendar_part.py |
'''Warning: I wrote this code when I was newbie, so the way of programming might not be the best'''
import calendar
import datetime
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.gridlayout import GridLayout
from kivy.properties import ListProperty
from kivy.properties import ObjectProperty
from kivy.properti... |
main.py |
from downloader._utils import ( urlparse, StatePrint, mkdir, download_folder, ClearWindow, sleep, asyncio )
from downloader import *
from downloader import _utils
from os.path import isdir, isfile
from os import system
import ctypes
import sys
from threading import Thread
def run_executor(import_file, content_url)... |
2018711735_multi_agent.py | import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
#from multiprocessing_env import SubprocVecEnv
from multiprocessing import Process, Pipe
import warnings
warnings.filterwarnings("ignore")
import gym
import pybullet_envs
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
f... |
try.py | from multiprocessing.connection import Listener
import requests
from bs4 import BeautifulSoup
import json
import websocket
import asyncio
import time
import re
import http.cookiejar
from typing import Mapping, Optional, List
import pickle
from colorama import Fore, Back, Style, init
import os
import sys
import curses
... |
delay.py | import os
import subprocess
import xmlrpc.server as rpc
import time
import sys
import multiprocessing as mp
try:
import pydivert
except ImportError:
pass
class LinuxDelayHandler:
@staticmethod
def get_interface_name():
""" Get the first interface name that is not the localhost. """
ne... |
overlay.py | ##########################################################################
#
# WooferBot, an interactive BrowserSource Bot for streamers
# Copyright (C) 2020 Tomaae
# (https://wooferbot.com/)
#
# This file is part of WooferBot.
#
# WooferBot is distributed in the hope that it will be useful,
# but WI... |
tests.py | from base64 import b64decode, b64encode
from json import loads
from os.path import basename
from tempfile import NamedTemporaryFile
from threading import Thread
from nose.tools import eq_, raises
from six import b, u
from six.moves import BaseHTTPServer
from pyhectane import Connection
class SimpleHttpHandler(BaseH... |
test_general.py | """
Collection of tests for unified general functions
"""
# global
import os
import math
import time
import einops
import pytest
from hypothesis import given, strategies as st
import threading
import numpy as np
from numbers import Number
from collections.abc import Sequence
import torch.multiprocessing as multiproces... |
docAPImatcher_server.py | import json
import wsgiref.simple_server
import subprocess
import threading
import docAPImatcher_exe as exe
from docAPImatcher import *
def get_id():
# read file
with open('server_id.json', 'r') as file:
data = file.read()
# parse file
obj = json.loads(data)
# show values
return int(ob... |
autoreload.py | import functools
import itertools
import logging
import os
import pathlib
import signal
import subprocess
import sys
import threading
import time
import traceback
import weakref
from collections import defaultdict
from pathlib import Path
from types import ModuleType
from zipimport import zipimporter
from django.apps ... |
helpers.py | # This file is copied from https://github.com/qtile/qtile
"""
This file contains various helpers and basic variables for the test suite.
Defining them here rather than in conftest.py avoids issues with circular imports
between test/conftest.py and test/backend/<backend>/conftest.py files.
"""
import functools
import... |
test_sockets.py | import os, multiprocessing, subprocess, socket, time
from runner import BrowserCore, path_from_root
from tools.shared import *
node_ws_module_installed = False
try:
NPM = os.path.join(os.path.dirname(NODE_JS[0]), 'npm.cmd' if WINDOWS else 'npm')
except:
pass
def clean_processes(processes):
import signal, errno
... |
server_dash.py | # -*- coding: utf-8 -*-
# Run this app with `python app.py` and
# visit http://127.0.0.1:8050/ in your web browser.
import random
import time
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
... |
helpers.py | """Supporting functions for polydata and grid objects."""
import collections.abc
import enum
import logging
import os
import signal
import sys
import threading
from threading import Thread
import traceback
from typing import Optional
import warnings
import numpy as np
import pyvista
from pyvista import _vtk
from pyv... |
berkeleydb.py | import logging
from threading import Thread
from os.path import exists, abspath
from os import mkdir
from rdflib.store import Store, VALID_STORE, NO_STORE
from rdflib.term import URIRef
from urllib.request import pathname2url
def bb(u):
return u.encode("utf-8")
try:
from berkeleydb import db
has_bsddb ... |
__init__.py | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
'''
Module camera provides the Camera class which
offers a threaded interface to multiple types of cameras.
'''
import logging
from threading import Thread
class Camera:
'''
Instantiate the Camera c... |
tests_servidor.py | import sys
import threading
import os
import requests
sys.path.append('../../api_rest')
import unittest
import subprocess
class Test(unittest.TestCase):
def setUp(self):
"""
El servidor se inicia en su propio hilo y se termina al final de los tests. revisar ejemplo 2 en:
https://eli.thegr... |
test_real_dictionaries.py | #
# NOTE
#
# See information on how tests are organized and how they should work in the tests' package __init__.py file
# (currently lingvodoc/tests/__init__.py).
#
from tests.tests import MyTestCase
from pyramid.httpexceptions import (
HTTPNotFound,
HTTPOk,
HTTPBadRequest,
HTTPConflict,
HTTPInt... |
crefi.py | #!/usr/bin/python
import os
import errno
import argparse
from version import __version__
from multiprocessing import Process
from crefi_helper import singledir, multipledir
def multiple(mnt_pnt, brdth, depth, files, fop, file_type="text", inter="1000",
size="100K", mins="10K", maxs="500K", rand=False, l... |
__init__.py | import smbus
import time
from threading import Thread
import atexit
from colorsys import hsv_to_rgb
try:
import queue
except ImportError:
import Queue as queue
ADDR = 0x3f
__version__ = '0.0.2'
_bus = None
LED_DATA = 7
LED_CLOCK = 6
REG_INPUT = 0x00
REG_OUTPUT = 0x01
REG_POLARITY = 0x02
REG_CONFIG = 0x03
... |
task02.py | """
Here's a not very efficient calculation function that calculates something important::
import time
import struct
import random
import hashlib
def slow_calculate(value):
'''Some weird voodoo magic calculations'''
time.sleep(random.randint(1,3))
data = hashlib.... |
ytdl.py | #!/usr/local/bin/python3
# coding: utf-8
# ytdl-bot - bot.py
# 5/3/21 18:31
#
__author__ = "Benny <cyph3rnoah>"
import asyncio
import datetime
import functools
import logging
import os
import pathlib
import platform
import re
import subprocess
import tempfile
import threading
import traceback
import fakeredis
impor... |
bindshell.py | from libs.config import alias, color
from libs.myapp import send, is_windows
from threading import Thread
from time import sleep
def get_php(port, passwd):
if (is_windows()):
return """$pass="%s";
$port=%s;
@error_reporting(0);
@set_time_limit(0); @ignore_user_abort(1); @ini_set('max_execution_... |
test_cp.py | # -*- coding: utf-8 -*-
# Copyright 2013 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 require... |
pytorch_batched_bot.py | import collections
import random
import threading
from typing import Dict, List, Any, Tuple
import torch
from torch import nn
from hearthstone.simulator.agent.actions import StandardAction, RearrangeCardsAction, DiscoverChoiceAction, Action
from hearthstone.simulator.agent.agent import AnnotatingAgent
from hearthston... |
master_discovery.py | # 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:
#
# * Redistributions of source code mus... |
sendmail.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
from multiprocessing import Process
import email
from email import encoders
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
import smtplib
from django.conf import settings
class MailSender(ob... |
server.py | #!/usr/bin/env python
import sys
import io
import os
import shutil
from subprocess import Popen, PIPE
from string import Template
from struct import Struct
from threading import Thread, Lock
from time import sleep, time
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse, parse... |
master.py | #
# Copyright Cloudlab URV 2020
#
# 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_worker.py | #!/usr/bin/env python
import unittest
import logging
import os
from multiprocessing import Process, Queue
import random
import sys
import time
sys.path.insert(0, os.path.abspath('..'))
from context import Context
from worker import Worker
class WorkerTests(unittest.TestCase):
def test_stop(self):
log... |
testing.py | import os
import os.path
import threading
import mellon
from mellon.mellon import create_and_register_app
from mellon.factories.web_crawler import tests
from mellon.factories.web_crawler.web_crawler.pipelines import WebCrawlerPipelineItems
from mellon.factories.web_crawler.file import run_spiders
from mellon.factories.... |
train.py | # Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016
"""Train"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
from datetime import datetime
import os.path
import sys
import time
import numpy as np
from six.moves import xrange
import tensorfl... |
build_imagenet_data.py | #!/usr/bin/python
# 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 a... |
measurementhandler.py | __package__ = "modelconductor"
from queue import Queue
from queue import Empty
from time import sleep
from datetime import datetime as dt
from datetime import timedelta
from .utils import Measurement
from .exceptions import ExperimentDurationExceededException
from modelconductor import server
from threading import Thre... |
test_threaded.py | from nose.tools import *
import unittest
import os
import threading
from helpers import create_osm_file, osmobj, HandlerTestBase, CountingHandler
import osmium as o
def import_data(function_complete):
data = [osmobj('N', id=1, lat=28.0, lon=-23.3)]
fn = create_osm_file(data)
c = CountingHandler()
try... |
test_flight.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... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
runMyDataRecording.py | # encoding: utf-8
from __future__ import print_function
import json
import multiprocessing
from time import sleep
from datetime import datetime, time
import random
from negociant.event import EventEngine2
from negociant.trader.vtEvent import EVENT_LOG, EVENT_ERROR
from negociant.trader.vtEngine import MainEngine, Lo... |
system.py | # Copyright 2014-2020 Chris Cummins <chrisc.101@gmail.com>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
DrsVmotion.py | __author__ = 'Smruti P Mohanty'
"""
Company : VMWare Inc.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
"""
from framework.common import TestConstants as tc
from framework.common import EsxStats as EsxStats
f... |
test_subprocess.py | import unittest
from test import test_support
import subprocess
import sys
import signal
import os
import errno
import tempfile
import time
import re
import sysconfig
try:
import resource
except ImportError:
resource = None
try:
import threading
except ImportError:
threading = None
mswindows = (sys.pl... |
Pose_recv.py | #
# Created on Wed Sep 22 2021
# Author: Owen Yip
# Mail: me@owenyip.com
#
# Socket number:
# RpLidar is 5450, IMU is 5451, Driver is 5452
#
import os,sys
pwd = os.path.abspath(os.path.abspath(__file__))
father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + "..")
sys.path.append(father_path)
import thre... |
app.py | # _*_ coding: utf-8 _*_
import random
import tornado.ioloop
import tornado.web
import urllib3
import docker
import os
import json
from shutil import copyfile
import threading
import string
import subprocess
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(filename)s[li... |
simulation_2.py | '''
Created on Oct 12, 2016
@author: mwittie
'''
import network_2
import link_2
import threading
from time import sleep
##configuration parameters
router_queue_size = 0 # 0 means unlimited
simulation_time = 4 # give the network sufficient time to transfer all packets before quitting
if __name__ == '_... |
sftp_file.py | # Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (a... |
backup.py | import os
import sys
import time
import shutil
import hashlib
import zipfile
import argparse
import textwrap
import threading
from datetime import date
from logger import *
START_TIME = time.time()
LOGGER = Logger().getlogger()
BACKUP_NAME = "Backup-" + str(date.today())
class ArchiveCheckError(Ex... |
mathjax2katex.py | #! /usr/bin/env python
# -*- coding: latin-1 -*-
import Queue
import os
import re
import shelve
import subprocess
import sys
import threading
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def FindMatching(data, prefix):
start = data.find(prefix)
if start < 0:
return (None, None)
end = start + ... |
test_parallel_backend.py | # -*- coding: utf8 -*-
from __future__ import print_function, absolute_import
"""
Tests the parallel backend
"""
import threading
import multiprocessing
import random
import os
import sys
import subprocess
import signal
from numba import config, utils
if utils.PYVERSION >= (3, 0):
import queue as t_queue
impo... |
EventManager.py | # -*- coding: utf-8 -*-
"""
"""
# 系统模块
from Queue import Queue, Empty
from threading import *
########################################################################
class EventManager:
#----------------------------------------------------------------------
def __init__(self):
"""初始化事件管理器"""
#... |
engine.py | """
Event-driven framework of VeighNa framework.
"""
from collections import defaultdict
from queue import Empty, Queue
from threading import Thread
from time import sleep
from typing import Any, Callable, List
EVENT_TIMER = "eTimer"
class Event:
"""
Event object consists of a type string which is used
... |
roll.py | #!/usr/bin/env python
# My simulation of how to keep track of chat history over time
# with a random input source of messages
from threading import Thread, Lock, current_thread, Timer, local as threading_local
from random import random
from time import sleep
#vt = Thread(target=self.view_runner_sched)
#vt.daemon = T... |
imap_idle.py | # -*- coding: utf-8 -*-
"""
Display number of unread messages from IMAP account.
Configuration parameters:
allow_urgent: display urgency on unread messages (default False)
cache_timeout: refresh interval for this module (default 60)
criterion: status of emails to check for (default 'UNSEEN')
format: di... |
test_stack.py | # -*- encoding: utf-8 -*-
import os
import threading
import time
import timeit
import pytest
import ddtrace
from ddtrace.vendor import six
from ddtrace.profiling import _nogevent
from ddtrace.profiling import recorder
from ddtrace.profiling.collector import stack
from . import test_collector
TESTING_GEVENT = os.ge... |
hyperparam_search.py | from multiprocessing import Process
import inspect
import logz
import time
import os
import tensorflow as tf
import numpy as np
import pybulletgym.envs
import pybullet
import gym
from train_pg_f18 import train_PG
import plot
def plotting(logdir, legend=None, value="AverageReturn"):
use_legend = False
if leg... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
arp_manager.py | from threading import Thread, Event
from datetime import datetime, timedelta
from mininet.log import lg
class ARPManager(object):
def __init__(self, sw, arp_timeout=600):
self.sw = sw
self.arp_table = dict()
self.running = False
self.thread = None
self.arp_timeout = arp_ti... |
train_abstractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
from pytorch_transformers import BertTokenizer
import distributed
from models import data_loader, model_builder
from models.data_loader i... |
main.py | # -*- coding: utf8 -*-
import os
import re
import json
import configparser
import threading
from datetime import datetime
from urllib import parse
from urllib.parse import quote
import requests
class HeathReport(object):
def __init__(self, user):
"""
:params username: 手机号或学号
:params ... |
mesh_executor.py | """
mesh executor with root rights
"""
import json
from shlex import quote
import socket
import subprocess
import syslog
import select
import threading
try:
# in deb import
from .src.batstat import Batman, STATUS
from .src.batadvvis import BatAdvVis
from .src.socket_helper import recv_msg, send_msg
exc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.