source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
driver.py | import threading
import asyncio
from typing import Dict, Union, List, Optional
from typing_extensions import Literal
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ContentType
from unified_message_relay.Core.UMRType import UnifiedMessage, MessageEntity, ChatAttribute, ChatType, EntityTyp... |
RobotCommandHandle.py | # Copyright 2021 Open Source Robotics Foundation, 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... |
cli.py | import collections
import csv
import multiprocessing as mp
import os
import datetime
import sys
from pprint import pprint
import re
import itertools
import json
import logging
import ckan.logic as logic
import ckan.model as model
import ckan.include.rjsmin as rjsmin
import ckan.include.rcssmin as rcssmin
import ckan.li... |
joy_detection_demo.py | #!/usr/bin/env python3
# Copyright 2017 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... |
misc_views.py | from django.core.mail import send_mail
from rest_framework.response import Response
from rest_framework import status
from rest_framework.views import APIView
import threading
def send_contact_us_email(name, email, hotel, role, additional_info, request_demo):
subject = 'Message from {}'.format(name)
contact_... |
ventana_elm.py | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 4 15:01:08 2019
@author: jrodriguez119
"""
import tkinter as tk
from tkinter import ttk
from tkinter import filedialog as fd
from tkinter import messagebox as mb
import elm
import pickle
from threading import Thread
from matplotlib.backends.backend_tkagg i... |
memory.py | import logging
import threading
from .inotify import INotify, flags
class InotifyTotalMemory(object):
def __init__(self):
self.manager = NodeSoftwareManager()
self.hostname = self.manager.get_name()
self._inotify = INotify()
self._worker = None
self._start()
def _sta... |
google_translator.py | # -*- coding: utf-8 -*-
# ############################
#
# Imports
#
# ############################
from translate import Translator
import threading
import hexchat
import os
# ############################
#
# Module name
#
# ############################
__module_name__ = "google translator"
__module_version__ = "1... |
__init__.py | import time
import redis
import threading
from uuid import uuid4
from mudpi import constants
from mudpi.logger.Logger import Logger, LOG_LEVEL
class Worker:
""" Base Worker Class
A worker is responsible for managing components,
updating component state, configurations ,etc.
A worker runs on a t... |
merge_wechat_backup.py | #!/usr/bin/python -u
"""
Copyright 2017, Jacksgong(https://blog.dreamtobe.cn)
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 applicab... |
tcp_server.py | import socket
import threading
bind_ip = "0.0.0.0"
bind_port = 9999
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((bind_ip, bind_port))
server.listen(5)
print "[*] Listening on %s:%d" % (bind_ip, bind_port)
# this is our client handling thread
def handle_client(client_socket):
# pri... |
face_detection_web.py | import cv2
import sys
import logging as log
#import datetime as dt
from time import sleep
import smtplib
import time
from datetime import datetime
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
#import RPi.GPIO as GPIO
import time
import thread... |
probe.py | #!/usr/bin/env python3
"""Plugin that probes the network for failed channels.
This plugin regularly performs a random probe of the network by sending a
payment to a random node in the network, with a random `payment_hash`, and
observing how the network reacts. The random `payment_hash` results in the
payments being re... |
jt_property.py | #!/usr/bin/env python
# coding: utf-8
import copy
import functools
import sys
import threading
from queue import Queue
class Node:
def __init__(self, data):
self.data = data
self.was_visited = False
self._edges = set()
def addEdge(self, edges):
""" add edges pointing out of self"""
assert is... |
startThreads.py | #coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
sys.path.append("..")
import threading
from Queue import Queue
from getEndPages import EveryClassification
from Downloader import Download
from Config import maxThread, PATH
def processThread():
threads = []
que = Queue()
... |
test_longpoll.py | import os
import ssl
from http.server import HTTPServer
from threading import Thread
from aiohttp.test_utils import unittest_run_loop
from aiovk import API
from aiovk.longpoll import LongPoll
# from tests.auth_data import USER_LOGIN, USER_PASSWORD, APP_ID
from tests.utils import AioTestCase, TEST_DIR
from tests.smoke... |
mysocketd.py | #!/usr/local/bin/python3 -u
import argparse
import multiprocessing
import jwt
from time import sleep,time
from threading import Thread
from kubernetes import client, config, watch
from mysocketctl.socket import get_sockets, new_socket
from mysocketctl.tunnel import new_tunnel
from mysocketctl.login import get_token
fr... |
test_safe_indexed_gzip.py | #!/usr/bin/env python
#
# test_safe_indexed_gzip.py -
#
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
from __future__ import print_function
from __future__ import division
import sys
import threading
import numpy as np
import pytest
import indexed_gzip as igzip
from . import check_data_valid
pytestmark = ... |
unittest_targets.py | #!/usr/bin/env python3
#
# Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
... |
controller.py | import os
import asyncio
import threading
from aiosmtpd.smtp import SMTP
from public import public
@public
class Controller:
def __init__(self, handler, loop=None, hostname=None, port=8025, *,
ready_timeout=1.0, enable_SMTPUTF8=True, ssl_context=None):
self.handler = handler
self... |
email.py | # from threading import Thread
# from flask import current_app, render_template
# from flask.ext.mail import Message
# from . import mail
# def send_async_email(app, msg):
# with app.app_context():
# mail.send(msg)
# def send_email(to, subject, template, **kwargs):
# app = current_app._get_current_o... |
asyncrecv.py | '''
非同步聽牌機
'''
import asyncio
import enum
import json
import logging
import math
import os
import os.path
import signal
import sys
import threading
import time
import types
from datetime import datetime, timedelta
import pythoncom
import comtypes.client
import comtypes.gen.SKCOMLib as sk
from com... |
DDOS.py | #!/usr/bin/env python3
#Code by LeeOn123
import random
import socket
import threading
print("--> By THAN <--")
print("#-- TCP/UDP --#")
ip = str(input(" Host/Ip:"))
port = int(input(" Port:"))
choice = str(input(" UDP(y/n):"))
times = int(input(" Packets per one connection:"))
threads = int(input(" Threads:"))
def run... |
threading_1.py | import threading
from time import sleep
def print_square(num):
print(f"Square : {num * num}")
sleep(1)
def print_cube(num):
print(f"Cube : {num * num * num}")
t2 = threading.Thread(target=print_square, args=(20,))
t2.start()
t2.join()
sleep(3)
if __name__ == "__main__":
t1 = thread... |
twisterlib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
from collections impo... |
cli.py | import os
import sys
import tempfile
import threading
from contextlib import contextmanager
from typing import Optional
import click
from dagster import check
from dagster.cli.workspace import (
get_workspace_process_context_from_kwargs,
workspace_target_argument,
)
from dagster.cli.workspace.cli_target import... |
test_queue.py | import pytest
from queue_stub import *
from queue_speech_to_text import *
def test_stub_func_without_input():
with pytest.raises(TypeError):
stub_func()
def test_stub_func_with_input2():
start = time.time()
q = multiprocessing.Queue()
q.put(2)
process = multiprocessing.Process(target=stub_func, arg... |
demo.py | #!/usr/bin/env python
# coding=utf-8
import tensorflow as tf
import bottle
from bottle import route, run
import threading
import json
import numpy as np
from prepro import convert_to_features, word_tokenize
from time import sleep
app = bottle.Bottle()
query = []
response = ""
@app.get("/")
def home():
with open... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import json
import logging
import os
import queue
import textwrap
import threading
import time
import urllib.request
import websockets
from PIL import Image, ImageDraw, ImageFont
from waveshare_epd import epd7in5b_HD as epd
PRODUCTION = os.environ.get('P... |
_supervisor.py | """This module is core of udpdater-supervisor. It runs and supervise updater execution."""
import atexit
import datetime
import os
import signal
import subprocess
import sys
import typing
from threading import Lock, Thread
from . import approvals, autorun, hook, notify
from ._pidlock import PidLock
from .const import ... |
build_remote.py | #!/usr/bin/env python3
import argparse
import glob
import datetime
from multiprocessing import Pool, Process, Manager, Event
import re
import subprocess
import sys
import tempfile
from os.path import join, realpath, dirname, basename, exists
CERTBOT_DIR = dirname(dirname(dirname(realpath(__file__))))
PLUGINS = [basen... |
tracker.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import time, sleep, mktime
import datetime as dt
import sched
from random import randint
import logging
from logging.config import dictConfig
import sys,os
import signal
from archery.bow import Daikyu as dict
from threading import Timer
#import zmq.green as zmq
... |
af@url_fetcher.py | from fake_useragent import UserAgent
from bs4 import BeautifulSoup
import requests
import re
import tldextract
import sys
import os
import threading
import time
urls = []
try:
if sys.argv[1] == '-l':
try:
userlist = open(sys.argv[2], "r")
except:
print("[ERROR] file not fou... |
temporary_processing.py | """The module for executing processes in parallel with starting the server."""
from threading import Thread
import time
import datetime
import random
from marketplace.models import Stock, Notification, MyStock, StockGrowthRates
from account.models import Profile
def postpone(function):
"""Stream creation decorat... |
async.py | import argparse
import asyncio
import collections
import cProfile
import gc
import random
import socket
import string
import sys
from multiprocessing import Barrier, Process, set_start_method
from statistics import mean, median, stdev
import aiohttp
def find_port():
s = socket.socket(socket.AF_INET, socket.SOCK_... |
thread_example.py | import itertools
import threading
import time
import multiprocessing
import numpy as np
class Worker:
def __init__(self, id_, global_counter):
self.id = id_
self.global_counter = global_counter
self.local_counter = itertools.count()
def run(self):
while True:
time.sleep(np.random.rand()*2)... |
scheduler_job.py | # -*- coding: utf-8 -*-
#
# 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
#... |
ufork.py | from __future__ import absolute_import
from __future__ import print_function
import atexit
import code
import errno
import logging
import os
import resource
import select
import signal
import socket
import sys
import threading
import time
import traceback
from collections import deque, namedtuple
from logging.handlers ... |
test_application.py | # GUI Application automation and testing library
# Copyright (C) 2006-2017 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... |
Rin.py | import picamera
import picamera.array
from time import sleep
import cv2
import numpy as np
from Rin_motion import Rin_motion as Rm
from Rin_network import Rin_network as Rn
from Rin_embedded import Rin_faces as Rf
import time
import threading
import socket
current_pos_1 = 90
current_pos_2 = 90
init_pos = [90, 9... |
ytdl.py | #!/usr/local/bin/python3
# coding: utf-8
# ytdl-bot - bot.py
# 5/3/21 18:31
#
__author__ = "Benny <benny.think@gmail.com>"
import subprocess
import tempfile
import os
import re
import logging
import threading
import asyncio
import traceback
import functools
import platform
import datetime
import contextlib
import f... |
plotter.py | # -*- coding: utf-8 -*-
"""
This module holds the plotting and data-visualization tools. Motto: don't know how it is interpreted? i'll show you!
#Plotim example
filename = "t2.jpg"
win = "test"
img = cv2.resize(cv2.imread(filename), (400, 400)) # (height, width)
plot = Plotim(win,img)
plot... |
ur3_rtq85_x.py | import math
import time
from robot_con.ur.robotiq import rtq_cbseries_gripper as r2f
from robot_con.ur.robotiq import rtq_ft300 as rft
from basis import robot_math as rm
import drivers.urx.ur_robot as urrobot
import robot_con.ur.program_builder as pb
import threading
import socket
import struct
import os
import motion.... |
cleanup.py | from __future__ import absolute_import, print_function
import os
from datetime import timedelta
from uuid import uuid4
import click
from django.utils import timezone
from sentry.runner.decorators import log_options
from six.moves import xrange
# allows services like tagstore to add their own (abstracted) models
# ... |
utils.py | """
Lot of the code here is stolen from C-lightning's test suite. This is surely
Rusty Russell or Christian Decker who wrote most of this (I'd put some sats on
cdecker), so credits to them ! (MIT licensed)
"""
import bip32
import coincurve
import itertools
import json
import logging
import os
import re
import socket
im... |
tgbot.py | from telegram import *
from telegram.ext import *
import logging
import youtube_dl
from yout import YoutubeSearch
from flask import Flask, Response
from os import environ
from threading import Thread
import requests
from uuid import uuid4
GET_DOWNLOADMUSIC1, GET_DOWNLOADMUSIC2, GET_DOWNLOADMUSIC3 = range(3)
song_url ... |
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... |
__init__.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2014-2015, Timm Linder, Social Robotics Lab, University of Freiburg
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistri... |
kbd_leds.py | #!/usr/bin/env python3
# Copyright 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Routines to modify keyboard LED state."""
import ast
import fcntl
import logging
import os
import sys
import threading
# Con... |
emu.py | #!/usr/bin/env python
import sys
import os
import time
import subprocess
import json
import random
import atexit
import threading
import signal
import psutil
import logging
def runSub(MQTT_ELB, UUID, PSK, job_num):
while True:
logging.debug('runSub: {}'.format(UUID))
command = ["./mosquitto-1.5.4/client/mos... |
core.py | from __future__ import print_function
import errno
import logging
import os
import pickle
import random
import re
import time
import requests
import threading
import json
import urllib.request
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
from newspaper import Article
from datetime import datetime,... |
test_enum.py | import enum
import inspect
import pydoc
import unittest
import threading
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
from datetime import timede... |
task11.py | from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy.core.window import Window
from kivymd.theming import ThemeManager
from kivy.animation import Animation
from threading import Thread
Window.size = (700, 500)
Window.title = 'Task11'
class Container(FloatLayout):
anim_1 = Animation(p... |
fileReader.py | import threading
import queue
import stat
import os
class FileReader:
def __init__(self, fileQ, errorReportQ, blockSize=1048576):
self.blockSize = blockSize
self.chunkQ = queue.Queue(2)
self.fileQ = fileQ
self.errorReportQ = errorReportQ
self.shutdown = threading.Event()
... |
amqpdriver.py |
# Copyright 2013 Red Hat, 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 agr... |
plan.py | """CFNgin plan, plan componenets, and functions for interacting with a plan."""
from __future__ import annotations
import json
import logging
import os
import threading
import time
import uuid
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
List,
NoReturn,
Optional,
OrderedDict... |
training.py | from django.shortcuts import render
from django.http import HttpResponse
from django.conf import settings
from rest_framework import permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from django.views.decorators.csrf import csrf_exempt
# from rest_framework.decorators im... |
test_base.py | # Copied from the uvloop project. If you add a new unittest here,
# please consider contributing it to the uvloop project.
#
# Portions copyright (c) 2015-present MagicStack Inc. http://magic.io
import asyncio
import logging
import os
import threading
import time
import weakref
from unittest import mock
import pyte... |
test_network.py | import json
import time
from contextlib import contextmanager
from multiprocessing import Process
import pytest
import requests
import responses
from flask import Flask, request
from requests import HTTPError
from urlobject import URLObject
from ..test_utils import silence
from ...base import get_host_ip, success_res... |
BankServicesServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Instituto Superior Técnico 2010/2011
# Operating and Distributed Systems
#
# Code written by:
# Filipe Funenga filipe.funenga@ist.utl.pt (57977)
# Martim Camacho martim.camacho@ist.utl.pt (56755)
# Pedro Silva pedro.silva@ist.utl.pt (58035)
#
# Credits:
#... |
rhcnode.py | #!/usr/bin/env python
# Copyright (c) 2019, The Personal Robotics Lab, The MuSHR Team, The Contributors of MuSHR
# License: BSD 3-Clause. See LICENSE.md file in root directory.
import cProfile
import os
import signal
import threading
import rospy
from ackermann_msgs.msg import AckermannDriveStamped
from geometry_msg... |
common_video.py | # coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
batcher.py | """This file contains code to process data into batches"""
import queue as Queue
from random import shuffle
from threading import Thread
import time
import numpy as np
import tensorflow as tf
import data
class Example(object):
"""Class representing a train/val/test example for text summarization."""
def __init_... |
aio_server_start_stop.py | import asyncio
import threading
class TestProtocol(asyncio.Protocol):
def connection_made(self, transport):
print('connection_made')
def data_received(self, data):
print('data_received')
def connection_lost(self, exc):
print('connection_lost')
loop = async... |
test_node.py | from tcoin_base.node import Node
from tcoin_base.wallet import Wallet
from tcoin_base.blockchain import Blockchain
import threading
import time
import errno
import sys
IP = "127.0.0.1"
PORT = int(input('Port: '))
n1 = Node(IP,PORT, True)
def new_job(target, args = None, daemon = False):
t = threading.Thread(targe... |
coverage_test_multicast.py | from Queue import Queue
import random
import threading
import unittest
from coapclient import HelperClient
from coapserver import CoAPServer
from coapthon import defines
from coapthon.messages.message import Message
from coapthon.messages.option import Option
from coapthon.messages.request import Request
from coapthon.... |
TCPSOCKET_ACCEPT.py | """
Copyright 2018 ARM Limited
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, software
dis... |
wsdump.py | #!/usr/bin/python3
import argparse
import code
import sys
import threading
import time
import ssl
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getattr(sys.stdin, "encoding", "")
if not encoding:... |
worker.py | from contextlib import contextmanager
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
import sys
import threading
import time
import traceback
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
# Ray modules
from ra... |
create_webserver.py | """
Utility to create a simple webserver that will answer oauth .well-known
required requests. This is so we can test the HTTP requesting part of issuers.
"""
import threading
import json
try:
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
except ImportError:
from http.server import BaseHTTPReq... |
dependency_getter.py | import time
import requests
import threading
import sys
node_name = sys.argv[1]
n_threads = int(sys.argv[2])
all_lines = open('/volatile/m139t745/rubygems/input/{}'.format(node_name)).read().splitlines()
output = open('/volatile/m139t745/rubygems/output/{}'.format(node_name), 'a')
lock = threading.Lock()
... |
tile_server.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import environ
from os.path import join, dirname, isfile
from flask import Flask, request, send_file, abort, jsonify
from flask_cors import CORS
from flask_pymongo import PyMongo
from dotenv import load_dotenv
from json import JSONEncoder
from bson import ObjectId... |
bot_cmds.py | '''
@ Harris Christiansen (code@HarrisChristiansen.com)
Generals.io Automated Client - https://github.com/harrischristiansen/generals-bot
Generals.io Bot Commands
'''
import random
import threading
import time
from .constants import *
from . import generals_api
class BotCommands(object):
def __init__(self, bot):... |
test_backfill_job.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... |
email.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
... |
sac_v2_multithread.py | '''
Soft Actor-Critic version 2
using target Q instead of V net: 2 Q net, 2 target Q net, 1 policy net
add alpha loss compared with version 1
paper: https://arxiv.org/pdf/1812.05905.pdf
'''
import math
import random
import gym
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import ... |
twisterlib.py | #!/usr/bin/env python3
# vim: set syntax=python ts=4 :
#
# Copyright (c) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import contextlib
import string
import mmap
import sys
import re
import subprocess
import select
import shutil
import shlex
import signal
import threading
import concurrent.fut... |
__main__.py | import subprocess
import threading
import aiohttp
import bot
from bot import constants
from bot.bot import Bot, StartupError
from bot.log import get_logger
try:
log = get_logger()
log.info("Creating NPM Module for the API")
npm_module = threading.Thread(
target=subprocess.run, args=("npm run sta... |
statusService.py | #!/usr/bin/env python
import rospy
import sys
import os
import operator
import optparse
from referee_service.srv import *
from threading import Thread
from threading import Lock
from std_msgs.msg import String
from playerTime import PlayerTime
from enum import Enum
lock = Lock()
playerTimes = dict()
startTime = 0
... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from .utils import xyxy2xywh, xywh2xyxy
help_url = 'htt... |
client1.py | import threading
import socket
name = "1"
def receive():
try:
while True:
message = sock.recv(1024).decode()
print(message)
except ConnectionResetError:
pass
def send():
try:
while True:
message = (name + ": " + input()).encode()
s... |
subproc_vec_env.py | import numpy as np
from multiprocessing import Process, Pipe
# This class is to run multiple environments at the same time.
def worker(remote, env_fn_wrapper):
env = env_fn_wrapper.x()
while True:
cmd, data = remote.recv()
if cmd == 'step':
ob, reward, done, info = env.step(data)
... |
httpServer.py | from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
from uuid import uuid1
from threading import Thread
from json import dumps
from hitch.macros import Macros
# Server Instance
class HitchHttpServer(object):
def __str__ (self):
return dumps(dict(
port=self.port,
... |
test_IRCClient.py | import threading
from socketserver import BaseRequestHandler, ThreadingTCPServer
from client.Client import Client
SERVER_HOST = "localhost"
SERVER_PORT = 0
def test_Client_connect():
server = ThreadingTCPServer((SERVER_HOST, SERVER_PORT), BaseRequestHandler)
serverThread = threading.Thread(target=server.se... |
openplc.py | # -----------------------------------------------------------------------------
# Copyright 2015 Thiago Alves
# This file is part of the OpenPLC Software Stack.
# OpenPLC 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 Soft... |
server.py | import threading
import socketserver
class Handler(object):
def __init__(self):
self.__client_address = None
self.__request = None
def handle(self, server=None):
pass
@property
def request(self):
return self.__request
@request.setter
def request(self, reques... |
stream_host.py | import threading
import SocketServer
import cv2
import numpy as np
class VideoStreamHandler(SocketServer.StreamRequestHandler):
def handle(self):
stream_bytes = ' '
# stream video frames one by one
try:
print ("thread started")
while True:
stream... |
demo.py | from pymol.wizard import Wizard
from pymol import cmd
saved = {}
class Demo(Wizard):
def launch(self,name):
return None
def __init__(self,name=None,_self=cmd):
Wizard.__init__(self,_self)
self.message = []
self.last = None
if 'last' in saved:
self.last = ... |
test.py | import time
import os
import threading
import random
from contextlib import contextmanager
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.network import PartitionManager
from helpers.test_tools import TSV
from helpers.client import CommandRequest
cluster = ClickHouseCluster(__file__)
node... |
drEngine.py | # encoding: UTF-8
'''
本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
'''
import json
import os
import copy
from collections import OrderedDict
from datetime import datetime, timedelta
from Queue import Queue
from threading import Thread
from eventEngine import *
from vtGateway import V... |
fn_api_runner.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... |
tartifact_store.py | import os
import uuid
import time
import tempfile
import re
from threading import Thread
import subprocess
import tarfile
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
import hashlib
from . import fs_tracker, logs
from . import util
from .util import download_file, d... |
tests.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import errno
import os
import shutil
import sys
import tempfile
import time
import unittest
import warnings
from datetime import datetime, timedelta
try:
import threading
except ImportError:
import dummy_threading as threading
from django.core.c... |
jobs.py | # -*- coding: utf-8 -*-
"""
jobs
~~~~~~~~~~~~~~
Jobs defined here.
:copyright: (c) 2016 by fengweimin.
:date: 16/8/12
"""
import os
import threading
import time
from collections import Counter
import schedule
from app.models import Post
post_view_times_counter = Counter()
def update_view_tim... |
leader_election.py | from socket import socket, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR, SOCK_STREAM, SO_BROADCAST
from time import sleep
from json import dumps, loads
from .network import Get_Subnet_Host_Number,Send_Broadcast_Message,Decode_Response,Encode_Request,Get_Broadcast_Ip,Get_Subnet_Host_Number,ServerUdp
from threading import Thread... |
GUI.py | import webbrowser
import PySimpleGUI as sg
from dotenv.main import load_dotenv
import inputs
import images
import TC
import RC
import MIOP
import json
import multiprocessing
from dotenv import load_dotenv
import os
# LINKS
# PySimpleGUI
# https://pypi.org/project/PySimpleGUI/
# https://pysimplegui.readthedocs.io/en/lat... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement
import os
import re
import sys
import copy
import time
import types
import signal
import fnmatch
import logging
import threading
import traceback
import contextlib
impo... |
cronjobs.py | #!/usr/bin/env python
"""Cron management classes."""
import logging
import random
import threading
import time
from grr import config
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib import stats
from grr.lib import utils
from grr.lib.rdfvalues import cronjobs as rdf_cronjobs
from grr.lib.rdfval... |
server.py | import os
import traceback
import datetime
from typing import Dict, Any, List, Sequence
import signal
import subprocess
import json
import base64
from time import sleep, time, strftime, gmtime
from threading import Thread
from functools import partial
import GPUtil
import psutil
import shutil
from entangle.entanglement... |
data_ingester.py | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.