source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
vsearch4web.py | from flask import Flask, render_template, request, redirect, escape, session, copy_current_request_context
from datetime import date
from vsearch import search4letters
import mysql.connector
from DBcm import UseDatabase, ConnectionError, CredentialsError, SQLError
from check_login import check_logged_in
from time impor... |
tests.py | # -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
import os
import re
import copy
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from django.conf import settings
... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
from threading import Thread
import time
import csv
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob
# See https://en.wikipedia.org/wiki/ISO_4217
CCY_PRECISIONS = {'BHD': 3, 'BIF':... |
utils.py | # Copyright 2015 Brocade Communications System, 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 ... |
dump_csv_converter.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import threading
from datetime import datetime
from math import floor
from pathlib import Path
import numpy as np
import pandas as pd
import yaml
class DumpConverter:
""" This class is used for convert binary snapshot dump conte... |
serverp.py | import os
import time
import asyncio
import tornado.ioloop
import tornado.web
from tornado.httpserver import HTTPServer, socket
from tornado.options import options
import threading
from resources import url_patterns
from utils.observer import Subject
from components.control_gpio import ControlGPIO
from components.camer... |
parallel_runner_V2.py | from envs import REGISTRY as env_REGISTRY
from functools import partial
from components.episode_buffer import EpisodeBatch
from multiprocessing import Pipe, Process
import numpy as np
import torch as th
# Based (very) heavily on SubprocVecEnv from OpenAI Baselines
# https://github.com/openai/baselines/blob/master/bas... |
_server.py | """Custom uvicorn-based server for hosting the API.
Uvicorn, the underlying server used for hosting the FastAPI app, does
not support programmatical shutoff or restart. Additionally, it expects
to be run in the main thread and will raise exceptions otherwise.
This module defines the ``ApiHost`` wrapper class which pr... |
musiccast_discovery.py | ''' Discovery module for MusicCast devices.
Based on the UPnP protocol v2.0:
http://www.upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v2.0.pdf
This module searches for MusicCast devices in the network by using the UPnP protocol.
A complete search process is made of 2 steps, each launched in a separate thread:
... |
app2.py | #!C:/Python35/python.exe
# -*- coding: UTF-8 -*-
#
# belmih 2016
#
from multiprocessing import Process, Queue, Lock
import os
import xml.etree.cElementTree as ET
import shutil
import zipfile
import time
import csv
import argparse
abspath = os.path.abspath(__file__)
workdir = os.path.dirname(abspath)
os.chdir(workdi... |
train_book.py | #coding:utf-8
import numpy
from data_iterator import DataIterator
import tensorflow as tf
from model import *
import time
import random
import sys
from utils import *
import multiprocessing
import argparse
import cPickle as pkl
parser = argparse.ArgumentParser()
parser.add_argument('-p', type=str, default='train', hel... |
test_asyncio_change_stream.py | # Copyright 2017-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
test_socket.py | #!/usr/bin/env python3
import unittest
from test import support
from unittest.case import _ExpectedFailure
import errno
import io
import socket
import select
import tempfile
import _testcapi
import time
import traceback
import queue
import sys
import os
import array
import platform
import contextlib
from weakref impo... |
distributed.py | """Builders for distributed training."""
import multiprocessing
import numpy as np
class Sequential:
'''A group of environments used in sequence.'''
def __init__(self, environment_builder, max_episode_steps, workers):
self.environments = [environment_builder() for _ in range(workers)]
self.m... |
manager.py | import os
import json
import time
import traceback
from ..util import *
from ..sentences import models
from .generator import Generator
from threading import Thread
from colorama import Fore, init
init(autoreset=True)
import tracemalloc
class Manager:
def __init__(self, app):
self.app = a... |
buck.py | # Copyright 2004-present Facebook. All rights reserved.
import functools
import glob
import json
import logging
import os
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from json.decoder import JSONDecodeError
from logging import Logger
from typing import Dict, Iterab... |
sleepgraph.py | #!/usr/bin/python
# SPDX-License-Identifier: GPL-2.0-only
#
# Tool for analyzing suspend/resume timing
# Copyright (c) 2013, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the... |
main.py | import json, time,sys
from azure.eventhub import EventHubConsumerClient
from SaveData import savedata
import threading
import os
from dotenv import load_dotenv
load_dotenv()
CONNECTION_STR = os.getenv("EVENT_HUB_CONN_STR")
EVENTHUB_NAME = os.getenv("EVENTHUB_NAME")
savedata = savedata()
def on_event(partition_context,... |
test.py | import unittest
from microservices.utils import set_logging
from threading import Thread, Event
set_logging()
class TestService(unittest.TestCase):
def test_service(self):
from microservices.queues.service import Microservice
from microservices.queues.client import Client
from kombu.conne... |
app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @PypiSeedTag: Main
# @Project : prize
"""
generated by PypiSeed(PPC) - Main Program
"""
import datetime
import threading
import time
import math
from random import *
from tkinter import *
from prize.ui.menu_setting import *
from prize.util.number import padding0
from p... |
pong.py | import torch
from torch import nn
from torch.distributions import Categorical
from torch.optim import Adam, SGD, ASGD
import torch.multiprocessing as mp
import os
from multiprocessing import Process, Queue
import queue
import numpy
import argparse
import glob
#from matplotlib import pyplot as plot
import copy... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
servers.py | """Adapt an HTTP server."""
import time
class ServerAdapter(object):
"""Adapter for an HTTP server.
If you need to start more than one HTTP server (to serve on multiple
ports, or protocols, etc.), you can manually register each one and then
start them all with bus.start:
s1 = Server... |
ircthread.py | #!/usr/bin/env python
# Copyright(C) 2011-2016 Thomas Voegtlin
#
# 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, m... |
onedrive.py | from __future__ import print_function
import base64
import copy
import json
import os
import re
import time
import traceback
from builtins import object
from builtins import str
from typing import List
from pydispatch import dispatcher
from requests import Request, Session
from empire.server.common import encryption... |
email.py | # -*- coding: utf-8 -*-
__author__ = "苦叶子"
"""
公众号: 开源优测
Email: lymking@foxmail.com
"""
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_emai... |
dualserv.py | # dualserve.py
#
# An example of a server implementation that works both in Curio and
# as a normal threaded application
import threading
from curio import run, spawn_thread, async_thread, AWAIT
# This is a normal synchronous function. It is used in both synchronous
# and asynchronous code.
def echo_handler(client,... |
views.py | # -*- coding: utf-8 -*-
# Copyright 2013 Dev in Cachu authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import logging
import threading
import requests
from django import http
from django.conf import settings
from django.core import m... |
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... |
pybluetoothserial.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pybluetoothserial.py (PBS) : Connect to bluetooth serial devices.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Thomas Maurice <tmaurice59@gmail.com>
Everyone is permitted to copy and ... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.contacts import Contacts
from electrum.payment... |
bestuurder.py | import threading
import time
import serial
import sys
class _Getch:
"""Gets a single character from standard input. Does not echo to the screen."""
def __init__(self):
try:
self.impl = _GetchWindows()
except ImportError:
self.impl = _GetchUnix()
def __call__(self):... |
tutorial011.py | import time
from pydx12 import *
from utils import get_best_adapter, enable_debug, print_debug, setup_debug, UploadBuffer, Texture, ReadbackBuffer, Barrier, VertexBuffer, Rasterizer
from PIL import Image
import gc
import sys
import time
import random
import numpy
import threading
from queue import Queue
enable_debug()... |
videoAudio.py | import cv2
import pyaudio
import wave
import threading
import time
import subprocess
import os
########################
# JRF
# VideoRecorder and AudioRecorder are two classes based on openCV and pyaudio, respectively.
# By using multithreading these two classes allow to record simultaneously video and audio.
# ffmpeg... |
socket_handler.py | '''
File: socket_handler.py
Description: Socket handling mechanism for Bolt Sink
Author: Saurabh Badhwar <sbadhwar@redhat.com>
Date: 23/10/2017
'''
import os
import socket
import threading
class SocketHandler(object):
"""Socket Handler for handling incoming/outgoing socket connections
Bolt sink is responsible... |
kitti_block_data_prep_util.py | #xyz Sep 2017
'''
Data preparation for datsets: stanford_indoor, scannet, ETH_semantic3D
Core idea: store all the information in hdf5 file itself
# The workflow to use this tool:
Raw_H5f -> Sorted_H5f -> merge block to get new block size -> randomnly select n points
-> Normed_H5f -> Net_Provider
## Raw_H5f store ... |
serv.py | import os,sys,logging
import signal, time
from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
import threading
import Queue
try:
import sqlite3
except ImportError:
from pysqlite2 import dbapi2 as sqlite3
import bb.server.xmlrpc
import prserv
import prserv.db
import errno
logger = lo... |
conftest.py | """Fixtures and setup / teardown functions
Tasks:
1. setup test database before starting the tests
2. delete test database after running the tests
"""
import os
import copy
import random
from collections import namedtuple
from logging import getLogger
from logging.config import dictConfig
import pytest
from pymongo ... |
views.py | import json
from threading import Thread
from asgiref.sync import async_to_sync
from channels.generic.websocket import WebsocketConsumer
from django.http.request import QueryDict
from Lib.log import logger
from Lib.xcache import Xcache
from WebSocket.Handle.console import Console
from WebSocket.Handle.heartbeat impor... |
__main__.py | """Initializes the XML-RPC server for provisioning and ATM operation
Module structure:
XML-RPC server started in __main__.py with functions from the following
files:
- atm.py
- provision_tool.py
The ATM and provision tool use the Bank, HSM, and Card classes from
./interfaces to communi... |
bang_control.py | import time
import threading
try:
import RPi.GPIO as GPIO
except (ModuleNotFoundError, RuntimeError):
print("B&G autopilot is not attached")
class BangControl:
AP_ON = 1 # black-white
AP_OFF = 2 # black-brown
PLUS_TEN = 3 # black-yellow
MINUS_TEN = 4 # black-blue
PLUS_ONE = 5 # black... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import os
import pickle
import random
import re
import subprocess
import sys
import sysconfig
import textwrap
import threading
import ... |
parutils.py | from abc import ABCMeta, abstractmethod
from .constants import PARALLEL_PROFILE
from .utils import setup_progressbar, grouper, flatten_list
import logging
import multiprocessing
import sys
logger = logging.getLogger(__name__)
__author__ = 'kgori'
"""
Introduced this workaround for a bug in multiprocessing where
error... |
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... |
pantsd_integration_test.py | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import glob
import os
import signal
import threading
import time
import unittest
from textwrap import dedent
from typing import List, Optional, Tuple
import psutil
import pytest
from pan... |
node.py | # Copyright 2013-2018 Aerospike, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
vpp_papi.py | #!/usr/bin/env python3
#
# Copyright (c) 2016 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
server.py | ################################################################################
#
# 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 ... |
main3.py | #!/usr/bin/python
from numpy import savetxt, loadtxt, array
from deap import base, creator, tools
from scipy import interpolate
from pickle import load, dump
from os import system, access, remove, path
from time import sleep
from glob import glob
from queue import Queue, Empty
from threading import Thread
fro... |
1.unlock.py | '''
说明: 不加锁会导致数据不准确, 本来希望list[0]的值被加两次, 但实际上只加了一次
'''
import time
from threading import Thread
from typing import List
def req1(list: List):
# 1. 线程1: b的值为0
# 2. 线程2: b的值为0
b = list[0]
time.sleep(0.001)
# 3. 线程1: list[0]的值为1
# 4. 线程2: list[0]的值为1
list[0] = b+1
list = [0]
tasks = [Thread(... |
solver_listener.py | # --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright IBM Corp. 2017, 2018
# --------------------------------------------------------------------------
# Author: Olivier OUDOT... |
multi_client.py | # Copyright 2020 MobiledgeX, Inc. All rights and licenses reserved.
# MobiledgeX, Inc. 156 2nd Street #408, San Francisco, CA 94105
#
# 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
#
# htt... |
utils.py | """Helper methods to run the experiment
"""
import numpy as np
import matplotlib.pyplot as plt
import threading
from channel import Channel
from environment import Environment
from interaction import Interaction
from replica_fish import ReplicaFish
from DelightFish import Fish
from observer import Observer
def gene... |
node.py | import grequests
import requests
from blockchain import *
from klein import Klein
from transaction import *
FULL_NODE_PORT = "30013"
NODES_URL = "http://{}:{}/nodes"
TRANSACTIONS_URL = "http://{}:{}/transactions"
BLOCK_URL = "http://{}:{}/block/{}"
BLOCKS_RANGE_URL = "http://{}:{}/blocks/{}/{}"
BLOCKS_URL = "http://{... |
clang-tidy-diff.py | #!/usr/bin/env python
#
#===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===---------... |
test_subprocess.py | import unittest
from test import test_support
import subprocess
import sys
import signal
import os
import errno
import tempfile
import time
import re
import sysconfig
try:
import resource
except ImportError:
resource = None
try:
import threading
except ImportError:
threading = None
mswindows = (sys.pl... |
viewsets.py | import threading
import unittest
import uuid
from io import StringIO
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.exceptions import NotFound
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
# Local imports
from actuator.models import Actu... |
extra_mock_server.py | import json
import multiprocessing
import os
import socket
from contextlib import closing
from urllib import parse
import eventlet
import requests
from eventlet import wsgi
from flask import Flask, Response, app, request, stream_with_context
from lyrebird import application
from lyrebird.base_server import ThreadServe... |
wb-mqtt-orvibo.py | #!/usr/bin/env python
# Based on https://github.com/cherezov/orvibo
# @author cherezov.pavel@gmail.com
# @author zeke.home@gmail.com
from struct import pack
import threading
from threading import Thread
try:
import mosquitto as mqtt
except ImportError:
import paho.mqtt.client as mqtt
from contextlib import ... |
POVME3.py | # POVME 3.0 is released under the GNU General Public License (see http://www.gnu.org/licenses/gpl.html).
# If you have any questions, comments, or suggestions, please don't hesitate to contact me,
# Jeff Wagner, at j5wagner [at] ucsd [dot] edu.
#
# If you use POVME in your work, please cite Durrant, J. D., C. A. de Oli... |
papertrex.py | import threading
import time
import random
import uuid
from datetime import datetime
from typing import Tuple, Any, Optional, List
from bittrex import Bittrex, BittrexBuyLimit, BittrexSellLimit, BittrexOpenOrder, BittrexOrder, \
BittrexBalance, BittrexOpenOrderType
from prodict import Prodict
def gen_id():
s... |
test_poll.py | # Test case for the os.poll() function
import os
import subprocess
import random
import select
import threading
import time
import unittest
from test.support import run_unittest, cpython_only
from test.support import threading_helper
from test.support.os_helper import TESTFN
try:
select.poll
exce... |
fifo_queue_test.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... |
TestController.py | import collections
import os
import random
import threading
import collections
import shutil
import sys
import tempfile
import time
import traceback
import unittest
import wx
from . import HydrusConstants as HC
from . import ClientConstants as CC
from . import HydrusGlobals as HG
from . import ClientAPI
from . import C... |
XTImageDownloader.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import os.path
import re
import urllib2
from Tkinter import *
import tkFileDialog
import threading
# 图片类
class Picture(object):
def __init__(self, name, url, dir_path, index):
# 该图片顺序下标 用于设置默认图片名字
self.index = index
# 图片名
sel... |
backup.py | 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.get_themes() # Returns a lis... |
cron.py | #!/usr/bin/env python3
# Corona-Info-App
# Cron-Script for LK Marburg-Bidenkopf
# © 2020 Johannes Kreutz.
# Include utilities
# Include db connection
from main import db
from models.cron import cron
for job in cron.query.all():
if job.run() == False:
print ("A Job was unsuccessful:", job.id)
"""
#Fo... |
network.py | """
Defines network nodes used within core.
"""
import logging
import math
import threading
import time
from collections import OrderedDict
from pathlib import Path
from queue import Queue
from typing import TYPE_CHECKING, Dict, List, Optional, Type
import netaddr
from core import utils
from core.emulator.data impor... |
test_integration.py | import json
import os
import pytest
import threading
from api_flow import execute, configure
from api_flow.complex_namespace import ComplexNamespace
from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
from unittest.mock import MagicMock
response_success_json = ComplexNamespace(
status_code=200,
... |
command.py | # Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import enum
import json
import logging
import os
import re
import resource
import signal
import subprocess
import threading
from ab... |
douban.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... |
eval_circuit.py | from src.circuits.evaluator import BasicEvaluator
from src.circuits.evaluator import SecureEvaluator
from src.circuits.dealer import Dealer
from src.circuits.oracle import Oracle
#import circuit
from examples.perceptron import circuit as circ
import numpy as np
from threading import Thread
import copy
import time
def ... |
nolock_speech_client.py | import speech_recognition
from gtts import gTTS
import os
import websocket
from threading import Thread
import time
import sys
import argparse
USER_NAME = ""
TEST_MODE = False
speaking = False
def speak(incomingtext):
speaking = True
print(incomingtext)
tts = gTTS(text=incomingtext, lang='en')
tts.s... |
cron_app.py | #encoding:utf-8
import datetime
import csv
import logging
from multiprocessing import Process
from datetime import datetime
import yaml
from croniter import croniter
import pymongo
from supplier import supply
from receiver import receive_check_reply
logger = logging.getLogger(__name__)
def read_own_cron(config):... |
app.py | import logging
import os
import subprocess
import sys
import threading
import time
from flask import Flask, request, Response
app = Flask(__name__)
logging.basicConfig(level=logging.INFO, format='[%(asctime)s] - %(levelname)s - %(module)s: %(message)s',
stream=sys.stdout)
logger = logging.getLogg... |
exports.py | # Copyright 2004-2019 Tom Rothamel <pytom@bishoujo.us>
#
# 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, m... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau... |
driver.py | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# (c) Copyright 2013 Hewlett-Pa... |
test_shell_interactive.py | #!/usr/bin/env impala-python
# -*- 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 Apach... |
test_c10d_nccl.py | import copy
import math
import os
import random
import signal
import sys
import tempfile
import threading
import time
from contextlib import contextmanager
from datetime import timedelta
from itertools import product
from unittest import mock
import torch
import torch.distributed as c10d
if not c10d.is_available():
... |
bridge.py | import rospy
from std_msgs.msg import Float32, Int16, Float32MultiArray, String
import struct
from threading import Thread
import frame
from serial_comm import SerialComm
from utils import power_to_motor_payload, servo_angle_to_duty, reset_STM
class Bridge():
def __init__(self):
self.serial_device = ro... |
test_streams.py | """Tests for streams.py."""
import gc
import os
import queue
import pickle
import socket
import sys
import threading
import unittest
from unittest import mock
from test import support
try:
import ssl
except ImportError:
ssl = None
import asyncio
from test.test_asyncio import utils as test_utils
def tearDown... |
env_wrapper.py | from mapf_env import Environment
import numpy as np
from typing import Union, List, Tuple
import multiprocessing as mp
from multiprocessing import Process, Pipe
from copy import deepcopy
## Creates multiple environments parallelly
#
# @param config Environment configuration
class ParallelEnv:
def __piped_env(pip... |
test_ipv6.py | import rpyc
import threading
import socket
import unittest
import time
from rpyc.utils.server import ThreadedServer
from rpyc import SlaveService
from nose import SkipTest
#if not getattr(socket, "has_ipv6", False):
# travis: "Network is unreachable", https://travis-ci.org/tomerfiliba/rpyc/jobs/108231239#L450
raise Sk... |
server.py | '''
Function:
联机对战服务器端
Author:
Charles
微信公众号:
Charles的皮卡丘
'''
import socket
import pygame
import random
import threading
from ..misc import *
from PyQt5 import QtCore
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from itertools import product
'''服务器端'''
class gobangSev... |
dvc_impl.py | #!/usr/bin/python3
#
# Copyright (c) 2014-2022 The Voxie Authors
#
# 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,... |
netcdf.py | #!/usr/bin/env pytest
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test NetCDF driver support.
# Author: Frank Warmerdam <warmerdam@pobox.com>
#
#############################################################... |
mikaelacashmancontigfilterkbaseServer.py | #!/usr/bin/env python
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, ServerError, InvalidRequestE... |
gui.py | #!/usr/bin/env python
# coding: utf-8
import threading
import time
import tkinter
import tkinter.filedialog
from mywidget import *
from JableTVJob import JableTVJob
import os
import re
def gui_main(urls, dest):
mainWnd = JableTVDownloadWindow(dest=dest, urls=urls)
mainWnd.mainloop()
mainWnd.cancel_downl... |
lysys.py | import threading
import subprocess
import ns_daemon
import psutil
import time
import json
from termcolor import colored
import sys
import time
import docker
for sock in psutil.net_connections():
if sock.laddr.port == 53:
print(colored("error : ","red",attrs=['bold']),colored("a service is running on por... |
bussinessDirectoryService.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
import threading
from rabbitMq.rabbitMq import RabbitMQ
from rabbitMq.rabbitMqQueue import RabbitMQQueueEnum as QueueEnum
from fetchDataBase import *
import datetime
import json
# 爬虫模块反馈查询完成, 更新数据库
def respDataProcess(rabbitMq, source, message):
# 更新自己日期到自己的数... |
ReportBot.py | #!/usr/bin/env python3
from colorama import Fore ,Back ,Style #line:3
from multiprocessing import Process #line:4
from about import about_msg #line:5
from help import help_msg #line:6
from libs .animation import colorText #line:7
from libs .animation import starting_bot #line:8
from libs .animation import load_animatio... |
encoder_tss.py | import RPi.GPIO as GPIO
import time
from time import sleep
from threading import Thread
counter = 0
previous_count=0
pin_A = 18
PPR = 500
#pin_B = 23
in1 =16
in2 =20
en =21
def setup():
global in1,in2,en,p
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(in1, GPIO.OUT)
GPIO.setup(in2, GPIO... |
test_gateway.py | import functools
import time
from threading import Thread
import numpy as np
import pytest
import requests
from jina.flow import Flow
concurrency = 10
# @pytest.mark.skip('this tests hang up for unknown reason on github')
def test_rest_gateway_concurrency():
def _request(status_codes, durations, index):
... |
test__local.py | import greentest
from copy import copy
# Comment the line below to see that the standard thread.local is working correct
from gevent import monkey; monkey.patch_all()
from threading import local
from threading import Thread
class ReadProperty(object):
"""A property that can be overridden"""
# A non-data de... |
patcher_test.py | import os
import shutil
import sys
import tempfile
from tests import LimitedTestCase, main, run_python, skip_with_pyevent
base_module_contents = """
import socket
import urllib
print("base {0} {1}".format(socket, urllib))
"""
patching_module_contents = """
from eventlet.green import socket
from eventlet.green impor... |
operator.py | import asyncio
import logging
import multiprocessing as mp
import os
import threading
from typing import Any
from typing import Callable
from typing import Dict
from typing import Tuple
from typing import Optional
import kopf
import yaml
import ray.autoscaler._private.monitor as monitor
from ray._private import servi... |
sumHugeRange_multithreaded.py | import threading
import time
def worker(r):
global result
res = 0
for i in r:
res += i
result += res
#################################################
# Multithreaded Processing:
#################################################
t = time.time()
result = 0
#create threads
tr1 = threading.Thread(name="... |
osc.py | #!/usr/bin/env python
from collections import defaultdict
import sys
from OSC import OSCServer
import time
import threading
def my_handler(addr, tags, data, client_address):
print addr, data, client_address
class OSCServerThread(OSCServer):
def start(self):
self._server_thread = threading.Thread(ta... |
scheduler_job.py | # pylint: disable=no-name-in-module
#
# 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, Versio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.