source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
DispatchDialogue.py | ##########################################################################
#
# Copyright (c) 2018, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... |
client.py | #!/usr/bin/env python3
import argparse
import collections
import itertools
import json
import logging
import socket
import sys
import threading
import time
import pyglet
import yaml
import messages_pb2 as m
import netchannel as nc
import world as w
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--debu... |
concurrent_schema_changes_test.py | import glob
import os
import pprint
import re
import time
import pytest
import logging
from random import randrange
from threading import Thread
from cassandra.concurrent import execute_concurrent
from ccmlib.node import Node
from dtest import Tester, create_ks
since = pytest.mark.since
logger = logging.getLogger(_... |
tweeter.py | # -*- coding: utf-8 -*-
from time import sleep
import tkinter
from tkinter import *
from tkinter import ttk
from tkinter import font
import emoji, sys
import tweepy
import threading
# ~ NOTE ~
#-ウィンドウサイズ指定-#
window_width = 500 # x
window_height = 200 # y
#-ツイート格納リスト-#
tweets = []
# Twitter APIキー
consumer_key='CONSU... |
locators.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
import json
import logging
import os
import posixpath
import re
from io import BytesIO
try:
import threading
except Imp... |
main.py | from tkinter import Tk, PhotoImage, Label, Entry, Button, StringVar
from tkinter.filedialog import askdirectory
from tkinter.messagebox import showinfo
from functools import partial
from threading import Thread
from pytube import YouTube
def dldfunc(url1):
global thumburl
url2 = (url1.get())
pa... |
gcsio.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... |
tests.py | # -*- coding: utf-8 -*-
# Unit and doctests for specific database backends.
from __future__ import unicode_literals
import datetime
import re
import threading
import unittest
import warnings
from decimal import Decimal, Rounded
from django.core.exceptions import ImproperlyConfigured
from django.core.management.color ... |
decorators.py | import threading
import time
from functools import wraps
from mxdc.utils.log import get_module_logger
logger = get_module_logger(__name__)
def memoize(f):
""" Memoization decorator for functions taking one or more arguments. """
class Memodict(object):
def __init__(self, f):
self.store =... |
searchScaleTests.py | # searchScaleTests.py: test out the scalability of our hyperparameter searching
import os
import time
import random
import logging
from threading import Thread
from xtlib import utils
from xtlib.run import Run
from xtlib import cmd_core
from xtlib import constants
from xtlib import file_utils
from xtlib.helpers import... |
runServer.py | # encoding: utf-8
# 该文件,为无界面启动文件,以vtServer为容器,加载MainEngine
# 配置:
# self.gateway_name ,gateway 的连接名称,在vtEngine.initGateway()里面定义,对应的配置文件是 "连接名称_connect.json",
# self.strategies:启动的策略实例,须在catStrategy/CtaSetting.json 里面定义 [u'S28_RB1001', u'S28_TFT', u'S28_HCRB',u'atr_rsi']
# vtServer的ZMQ端口: 从VT_Setting.json中配置,根据AU... |
comm.py | from __future__ import absolute_import
import socket
import select
import threading
import pickle
import logging
import time
import os
def create_pickle_msg(rank, cmd, data):
"""Pickle the messages for transmission"""
msg = {"rank": rank, "cmd": cmd, "data": data}
msg = pickle.dumps(msg)
return msg
... |
plotdata.py | #!/usr/bin/env python
# Install pyqtgraph with:
# sudo apt install python-pyqtgraph
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
import os, sys
import collections
import random
import time
import math
import numpy as np
import Queue
import threading
import struct
import socket
import select
print(... |
variable_scope.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... |
repair_test.py | import os
import os.path
import threading
import time
import re
import pytest
import logging
from collections import namedtuple
from threading import Thread
from cassandra import ConsistencyLevel
from cassandra.query import SimpleStatement
from ccmlib.node import ToolError
from dtest import FlakyRetryPolicy, Tester,... |
face_detector_pi203_node.py | #!/usr/bin/env python
import rospy
import numpy as np
import math
from duckietown_msgs.msg import Twist2DStamped
from sensor_msgs.msg import CompressedImage, Image
from cv_bridge import CvBridge, CvBridgeError
import cv2
import sys
import time
import threading
class face_detector_wama(object):
def __init__(self):
s... |
pubsubmonitor.py | # pubsubmonitor.py
# ~~~~~~~~~
# This module implements the PubSubMonitor class.
# :authors: Justin Karneges, Konstantin Bokarius.
# :copyright: (c) 2015 by Fanout, Inc.
# :license: MIT, see LICENSE for more details.
import requests
import threading
import json
import copy
import urllib
import time
i... |
test.py | """Tests for wasser module"""
from multiprocessing import Process
from time import sleep
import unittest
import json
from wasser import Wasser
from simple_ssl_server import SimpleServer
class TestServer(SimpleServer):
"""Server for tests"""
def __init__(self, *args, **kwargs):
super(TestServer, self).... |
rabbit_mq_client.py | # Copyright 2016 deepsense.ai (CodiLime, 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 agree... |
test_protocol_cybinary.py | # -*- coding: utf-8 -*-
import collections
import multiprocessing
import os
import time
import pytest
from thriftpy._compat import u
from thriftpy.thrift import TType, TPayload, TDecodeException
from thriftpy.transport import TSocket, TServerSocket
from thriftpy.utils import hexlify
from thriftpy._compat import PYP... |
na_santricity_discover.py | #!/usr/bin/python
# (c) 2020, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = """
---
module: na_santricity_discover
short_description: NetApp E-Series discov... |
tunnel.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
parametersearch.py | """
Distributed Parameter Search
============================
This library distributes parameter searches over many clients.
Its designed for simplicity and hackability first.
It's author is Thomas Unterthiner.
Simple Usage
------------
This is a single-file implementation, so just copy ```parametersearch.py``` to yo... |
graph.py | from config import api_key
from Queue import Queue
import sys
import requests
import threading
import networkx as nx
import matplotlib.pyplot as plt
session = requests.Session()
session.params = {"key": api_key}
def get_request_json(route, params):
r = session.get("https://api.steampowered.com/"+route, params=params)... |
demo2.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys, os
import time
from pynfc import *
from threading import Thread
RED='\033[01;31m'
GREEN='\033[01;32m'
NC='\033[0m' # No Color
def read_adc_channel(channel):
n_times = 10
raw_sum = 0
for i in xrange(n_times):
raw = int(open('/sys/bus/iio/devices/iio:device... |
restful_template.py | from befh.restful_api_socket import RESTfulApiSocket
from befh.exchanges.gateway import ExchangeGateway
from befh.market_data import L2Depth, Trade
from befh.util import Logger
from befh.instrument import Instrument
from befh.clients.sql_template import SqlClientTemplate
from functools import partial
from datetime impo... |
libipmi.py | import threading
import sqlite3 as sql
import subprocess
import time
import csv
import shutil
from powerboard import summary_v2
import tensorflow as tf
import os
time_start = 0
glob_var = True
thread_list = []
# Stop the data reading using a global variable
def stop():
global glob_var
glob_var = False
# Func... |
chatcommunicate.py | from chatexchange import events
from chatexchange.browser import LoginError
from chatexchange.messages import Message
from chatexchange_extension import Client
import collections
import itertools
import os
import os.path
import pickle
import queue
import regex
import requests
import sys
import threading
import time
imp... |
server.py | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... |
misc.py | """
Misc module contains stateless functions that could be used during pytest execution,
or outside during setup/teardown of the integration tests environment.
"""
import contextlib
import errno
import multiprocessing
import os
import re
import shutil
import stat
import sys
import tempfile
import time
import warnings
... |
music-player.py | """ Music Player
----------------------------------------
"""
import os
import threading
import time
import tkinter.messagebox
from tkinter import *
from tkinter import filedialog
from tkinter import ttk
from ttkthemes import themed_tk as tk
from mutagen.mp3 import MP3
from pygame import mixer
root = tk.ThemedTk()
root... |
Blog2EpubKivy.py | #!/usr/bin/env python3
# -*- coding : utf-8 -*-
import sys
import os
import platform
import yaml
import subprocess
import logging
from pathlib import Path
from urllib import parse
from datetime import datetime
import threading
import webbrowser
from blog2epub.Blog2Epub import Blog2Epub
from blog2epub.crawlers.Crawler ... |
loggers.py | """PC est magique - Custom Flask Loggers"""
import os
import logging
from logging import StreamHandler
from logging.handlers import TimedRotatingFileHandler
import threading
import flask
from discord_webhook import DiscordWebhook
import requests
from app import PCEstMagiqueApp
from app.tools import typing
def _exe... |
08_pendulum_d4pg_main.py | # https://github.com/openai/gym/blob/master/gym/envs/classic_control/pendulum.py
# https://mspries.github.io/jimmy_pendulum.html
#!/usr/bin/env python3
import time
import torch
import torch.multiprocessing as mp
import os, sys
print("PyTorch Version", torch.__version__)
current_path = os.path.dirname(os.path.realpath(... |
_debugger_case_multiprocessing_2.py | from multiprocessing import Process, Queue
class Foo:
def __init__(self, value):
self.value = value # break 2 here
def f(q):
q.put(Foo(1))
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=(q,))
p.start()
print(q.get().value) # break 1 here
print('TEST SUCEED... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Server Host Connected and Synced to Main Code."
def run():
app.run(host='0.0.0.0',port=1215)
def keep_alive():
t = Thread(target=run)
t.start() |
_debugger_case_thread_creation_deadlock.py | from threading import Thread, Event
def create_thread():
event = Event()
event_set = [False]
def run_thread():
event_set[0] = True
event.set()
t = Thread(target=run_thread)
t.start()
try:
event.wait(5)
# note: not using `assert event.wait(5)`... |
trezor.py | import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
from electrum import constants... |
MusicCmd.py | import copy
import json
import os
import sys
import threading
from cmd import Cmd
import mpv
from wcwidth import wcswidth
from api import (MiguMusicAPI, NeteaseCloudMusicAPI, QQMusicApi,
convert_interval, convert_singerlist)
class MusicShell(Cmd):
''' Main command shell '''
prompt = 'Bowe... |
server__handle_stdin__input.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import logging
import time
from threading import Thread
from flask import Flask
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
text = "Hello World!"
def go():
time.sleep(2)
print('\n')
global text
while ... |
multiprocessing_test.py | #!usr/bin/python
# -*- coding:utf8 -*-
# import os
# import time
# # fork只能用于linux下面
# pid = os.fork()
# print("bobby")
# if pid == 0:
# print('子进程 {}, 父进程是: {}'.format(os.getpid(), os.getppid()))
# else:
# print('我是父进程: {}'.format(pid))
#
# time.sleep(2)
from concurrent.futures import ProcessPoolExecutor
impo... |
presenter_agent.py | """
@Date: 2020-12-09 23:28:01
@LastEditTime: 2020-12-20 22:59:23
@FilePath: /colorization_video_python/atlas_utils/presenteragent/presenter_agent.py
# !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
import time
#from threading import Thread
import threading
import os
import sys
sys.path.append(os.path.dirname(os.path... |
test_event_log.py | import os
import sys
import tempfile
import traceback
import pytest
import sqlalchemy
from dagster.core.errors import DagsterEventLogInvalidForRun
from dagster.core.storage.event_log import (
ConsolidatedSqliteEventLogStorage,
InMemoryEventLogStorage,
SqlEventLogStorageMetadata,
SqlEventLogStorageTable... |
server_main.py | """server_main module.
This module contains classes, containing server code.
Classes and their functions:
* GameServer - main loop, listening socket event handler, synchronization
event handlers.
* Resources - information about game resource pack.
* ResourceServer - HTTP server, used for resources d... |
gdal2tiles.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ******************************************************************************
# $Id$
#
# Project: Google Summer of Code 2007, 2008 (http://code.google.com/soc/)
# Support: BRGM (http://www.brgm.fr)
# Purpose: Convert a raster into TMS (Tile Map Service) tiles in a di... |
example.py | from __future__ import print_function
from treestream import RedisTreeWriter
from threading import Thread, Lock
from time import sleep
from random import random, randrange
from treestream import (
RedisTreeReader,
RedisTreeWriter,
)
print_lock = Lock()
def start_thread(func):
thread = Thread(target=func)
threa... |
collector.py | from typing import List
from kubemon.collector.commands import ConnectedMonitorsCommand, InstancesCommand, NotExistCommand, StartCommand, StopCommand
from ..dataclasses import Client
from ..config import DATA_PATH, DEFAULT_CLI_PORT
from ..utils import save_csv, receive, send_to
from addict import Dict
from dateti... |
run-tests.py | #!/usr/bin/env python3
#
# 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 "L... |
settings.py | import threading
import tkinter as tk
import webbrowser
from datetime import date
from pathlib import Path
from tkinter import messagebox
import api.remarkable_client
import utils.config as cfg
from api.remarkable_client import RemarkableClient
from model.item_manager import ItemManager
class Settings(object):
d... |
test_functools.py | import abc
import builtins
import collections
import collections.abc
import copy
from itertools import permutations
import pickle
from random import choice
import sys
from test import support
import threading
import time
import typing
import unittest
import unittest.mock
from weakref import proxy
import contextlib
imp... |
multiprocess_sgskip.py | """
============
Multiprocess
============
Demo of using multiprocessing for generating data in one process and
plotting in another.
Written by Robert Cimrman
"""
import multiprocessing as mp
import time
import matplotlib.pyplot as plt
import numpy as np
# Fixing random state for reproducibility
np.random.seed(196... |
runtests.py | #!/usr/bin/env python2.7
#
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT licens... |
simplest.py | import multiprocessing as mp
import time
def worker(x):
pid = mp.current_process().name;
print("x = {} in {}".format(x, pid))
time.sleep(2)
if __name__ == '__main__':
# create the process
p = mp.Process(target=worker, args=(42,))
# start the process:
p.start()
# wait until process completes:
p.j... |
druid.py | try:
from pydruid.db import connect
enabled = True
except ImportError:
enabled = False
from redash.query_runner import BaseQueryRunner, register, JobTimeoutException
from redash.query_runner import TYPE_STRING, TYPE_INTEGER, TYPE_BOOLEAN, TYPE_FLOAT
from redash.utils import enum, json_dumps, json_loads
fr... |
testTPSScript.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from chain.const import CONFIG, IP_CONFIG
from chain.hibechain import HIBEChain
# from chain.singlechain import SingleChain
from chain.gethnode import GethNode
from chain.iplist import IPList
from chain.conf import load_config_file
from typing import Optional
from random ... |
test_named_mutex.py |
import time
from winmutex import WinMutex
from unittest import TestCase
from threading import Thread
class TestNamedMutex (TestCase):
def test_named_mutex1 (self):
REPEAT_COUNT = 3
THREAD_COUNT = 3
stack = list()
def example (value):
mutex = WinMutex(name="example")
with mutex:
... |
qemu.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... |
main_window.py | import os
import re
import signal
import shutil
import threading
import sys
from .app_list_widget import AppList
from .eq_popover import EqPopover
from .latency_popover import LatencyPopover
from .rnnoise_popover import RnnoisePopover
from .groups_popover import JackGroupsPopover
from .port_select_popover import PortS... |
pan_tilt_tracking.py | # the goal of this file is to run all of the 4 independent processes
# that are used to control the vision system components as well as update the variables needed for the FSM
# global variable updates allow these processes to constantly update each other
# 1. objectCenter - finds/localizes the object
# 2. pannin... |
async_rl.py |
import time
import multiprocessing as mp
import psutil
import torch
from collections import deque
import math
from rlpyt.runners.base import BaseRunner
from rlpyt.utils.quick_args import save__init__args
from rlpyt.utils.logging import logger
from rlpyt.utils.collections import AttrDict
from rlpyt.utils.seed import s... |
tello_camera_aruco_marker_detection.py | # This python script accesses Tello's camera, takes off, and then detects markers to perform certain commands
# In this case we detect marker id 33 and do a forward flip while marker id 1 commands Tello to land
# Modify this script to suit your needs and feel free to open a GitHub issue with any questions
import cv2
i... |
traverse_graph.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... |
main.py | """
mlperf inference benchmarking tool
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import array
import collections
import json
import logging
import os
import sys
import threading
import time
from queue import Queue
import mlperf_l... |
hmk.py | from pepper.framework import *
from pepper.responder import *
from pepper.knowledge import sentences, animations
from pepper.language import Utterance
from pepper.language.generation.reply import reply_to_question
from pepper import config
from threading import Thread
from random import choice
from time import time
i... |
tasks.py | import os
import traceback
from datetime import datetime
from functools import partial
from threading import Thread
from tkinter import messagebox
import requests
from league_connection import LeagueConnection
from league_connection.exceptions import LeagueConnectionError
from client.exceptions import AccountBannedEx... |
cli.py | # -*- coding: utf-8 -*-
"""
flask.cli
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import traceback
from functools import update_wrapper
from operator import attrgetter
... |
test_lab_view.py | import time
from multiprocessing import Process
from threading import Thread
from traceback import print_exc
from unittest import TestCase
from bson import ObjectId
from alab_management.device_view import DeviceView
from alab_management.lab_view import LabView
from alab_management.sample_view import SampleView
from a... |
mqtt_s3_multi_clients_comm_manager.py | # -*-coding:utf-8-*-
import json
import logging
import time
import traceback
import uuid
from typing import List
import paho.mqtt.client as mqtt
import yaml
from .remote_storage import S3Storage
from ..base_com_manager import BaseCommunicationManager
from ..message import Message
from ..observer import Observer
cla... |
websiteCheck.py | from dotenv import load_dotenv
from WebsiteChecker.WCKafka import KafkaProducer
from WebsiteChecker.Website import website
import os
import signal
import sys
import logging
import time
import threading
logger = logging.getLogger(__name__)
num_threads = 0
thread_running = False
# Lock for the Website-List
lock_ws = th... |
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... |
main.py | from instapy_cli import client
from os import listdir
from os.path import isfile, join
import time
from tkinter import *
import tkinter as tk
from tkinter import filedialog
import threading
from PIL import ImageTk,Image
from tkinter.ttk import Progressbar
window = Tk()
window.geometry("500x400")
window.title("IMPU | 1... |
Binance_Detect_Moonings.py | """
Disclaimer
All investment strategies and investments involve risk of loss.
Nothing contained in this program, scripts, code or repositoy should be
construed as investment advice.Any reference to an investment's past or
potential performance is not, and should not be construed as, a recommendation
or as a guarantee... |
dag_processing.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
#... |
main.py | #To run flask in its own thread
import threading
import sys
import os
import logging
import time
#To catch CTRL+C
import signal
import requests
import traceback
from config import *
from client_api import *
from encapsulator.userspace import *
CLIENT_HOST = "0.0.0.0"
CLIENT_PORT = 4243
#Gracefully handle CTRL+C
def... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
"""
import numpy as np
import tensorflow as tf
import gym
import logz
import os
import time
im... |
test_browser.py | import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
from runner import BrowserCore, path_from_root, nonfastcomp
from tools.shared import *
# User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to
# run using another browser com... |
PythonLock.py | import time, threading
balance = 0
def change_it(n):
global balance
balance += n
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=(8,))
t1.start()
t2.start()
t1.join()
t2.join()... |
serverprox.py | from flcore.clients.clientprox import clientProx
from flcore.servers.serverbase import Server
from threading import Thread
class FedProx(Server):
def __init__(self, args, times):
super().__init__(args, times)
# select slow clients
self.set_slow_clients()
self.set_clients(args, cli... |
test_runner.py | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file acc... |
test_concurrency.py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for concurrency libraries."""
import glob
import os
import random
import re
import sys
import threading
import time
from flaky import flaky
import pytest... |
win32comport_demo.py | # This is a simple serial port terminal demo.
#
# Its primary purpose is to demonstrate the native serial port access offered via
# win32file.
# It uses 3 threads:
# - The main thread, which cranks up the other 2 threads, then simply waits for them to exit.
# - The user-input thread - blocks waiting for a keybo... |
main_window.py | #!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including with... |
multiprocess_data_loader.py | from collections import deque
import logging
from multiprocessing.process import BaseProcess
import random
import traceback
from typing import List, Iterator, Optional, Iterable, Union, TypeVar
from overrides import overrides
import torch
import torch.multiprocessing as mp
from allennlp.common.util import lazy_groups... |
sourcetrail.py | """Sourcetrail server"""
import socket
import errno
import threading
import os.path
import encodings.idna
import subprocess
import time
import vim
try:
# Python 3
import socketserver
except ImportError:
# Python 2
import SocketServer as socketserver
MESSAGE_SPLIT_STRING = ">>"
class Options:
"""... |
splib.py | # Superparameteriation coupling code for OpenIFS <--> Dales
#
# Fredrik Jansson, Gijs van den Oord
# 2017-2019
#
from __future__ import division
from __future__ import print_function
import json
import logging
import os
import shutil
import threading
from Queue import Queue # note named queue in python 3
import ... |
_fakefs.py | import atexit
import errno
import inspect
import os
import stat
import subprocess
from threading import Thread
from uuid import uuid4
try:
import fuse # pytype: disable=import-error
except ImportError: # pragma: no cover
raise ImportError(
inspect.cleandoc(
'''
Failed to impor... |
utils.py | """
Distributed under the terms of the BSD 3-Clause License.
The full license is in the file LICENSE, distributed with this software.
Author: Jun Zhu <jun.zhu@xfel.eu>
Copyright (C) European X-Ray Free-Electron Laser Facility GmbH.
All rights reserved.
"""
import os
import psutil
import multiprocessing as mp
import f... |
socket_handler.py | import socket
import socketserver
import struct
import threading
import json
import logging
from models.user import User
from models.phrasestroke import PhraseStroke
from server import database as db
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
SOCKET_PORT = 9696
class ThreadedTCPReq... |
vad_test.py | #!/usr/bin/env python3
###################################################################################################
#
# Project: Embedded Learning Library (ELL)
# File: vad_test.py
# Authors: Chris Lovett
#
# Requires: Python 3.x, numpy, tkinter, matplotlib
#
##########################################... |
runner.py | #!/usr/bin/env python
'''
Simple test runner
See settings.py file for options¶ms. Edit as needed.
These tests can be run in parallel using nose, for example
nosetests --processes=4 -v -s tests/runner.py
will use 4 processes. To install nose do something like
|pip install nose| or |sudo apt-get install python... |
example_2_sensel_contacts.py | #!/usr/bin/env python
##########################################################################
# MIT License
#
# Copyright (c) 2013-2017 Sensel, Inc.
#
# 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... |
scanner.py | #coding:utf-8
#!/usr/bin/env python
'''
______ __ __
/\__ _\ __ /\ \ /\ \__
\/_/\ \/ ___ ____/\_\ __\ \ \___\ \ ,_\
\ \ \ /' _ `\ /',__\/\ \ /'_ `\ \ _ `\ \ \/
\_\ \__/\ \/\ \/\__, `\ \ \/\ \L\ \ \ \ \ \ \ \_
/\___... |
test_immediatescheduler.py | import pytest
import unittest
import threading
from datetime import timedelta
from time import sleep
from rx.disposable import Disposable
from rx.scheduler import ImmediateScheduler
from rx.internal.basic import default_now
from rx.internal.constants import DELTA_ZERO
from rx.internal.exceptions import WouldBlockExce... |
signal_test2.py | # -*- coding: utf-8 -*-
# @author: edgardeng
# @date: 2021-03-18
# @file: 信号量
import signal
import time
from functools import partial
from multiprocessing import Process, Queue
class Counter(object):
def __init__(self, val):
self.current = val
def next(self):
self.current += 1
re... |
models.py | """Database models for the reader app."""
from __future__ import annotations
from hashlib import blake2b
from importlib.util import find_spec
from io import BytesIO
from logging import getLogger
from os import path, remove
from pathlib import PurePath
from shutil import rmtree
from threading import Lock, Thread
from ... |
penv.py | import gym
from multiprocessing import Process, Pipe
def get_local(obs):
# get local view
return obs["image"]*0.0
def reset(env, conventional, archimedean):
obs = env.reset()
active_sender = True
active_receiver = not active_sender
active = (activ... |
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_o... |
http_event_collector.py | """splunk_http_event_collector.py
Splunk HTTP event submission class
Remember: Friends don't let friends send in non Common Information Model data: http://docs.splunk.com/Documentation/CIM/latest/User/Overview
Please use CIM friendly field names when sending in data.
"""
from __future__ import print_fun... |
local_job_service.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... |
robot_driver.py | import rospy
import time
import actionlib
import threading
import argparse
from control_msgs.msg import FollowJointTrajectoryAction
from control_msgs.msg import FollowJointTrajectoryFeedback
from sensor_msgs.msg import JointState
from std_msgs.msg import String
from hiwin_robot_interface import HiwinRobotInterface
J... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.