source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
sdca_ops_test.py | # Copyright 2016 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... |
middleware.py | # -*- coding: utf-8 -*-
import time
import datetime
import threading
import json
import base64
import re
import random
import itertools
from cStringIO import StringIO
from moesifapi.moesif_api_client import *
from moesifapi.api_helper import *
from moesifapi.exceptions.api_exception import *
from moesifapi.models im... |
email.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : Jianwei Fu
# E-mail : jianwei1031@gmail.com
# Date : 15/12/26 20:34:22
# Desc :
#
from threading import Thread
from flask import current_app, render_template
from flask.ext.mail import Message
from . import mail
def send_async_email(a... |
utils_test.py | from __future__ import annotations
import asyncio
import copy
import functools
import gc
import inspect
import io
import logging
import logging.config
import multiprocessing
import os
import queue
import re
import shutil
import signal
import socket
import subprocess
import sys
import tempfile
import threading
import u... |
server.py | import socket
import multiprocessing as mp
def chat(conn, addr):
while True:
msg = conn.recv(1024).decode("utf-8")
conn.send((msg + " too").encode("utf-8"))
print(addr, ": ", msg)
conn.close()
if __name__ == "__main__":
sk = socket.socket()
sk.bind(("127.0.0.1", 9000))
sk... |
thread_test.py | import time
import threading
from threading import Thread
from smac.examples.mlp import Mlp
import numpy as np
def threadFunc(threadName):
print("\r\n%s start" % threadName)
time.sleep(5)
print("\r\n%s end" % threadName)
pass
class AgentThread(Thread):
def __init__(self, agent_i... |
web_interface.py | import os
import os.path
from rebus.agent import Agent
import threading
import datetime
import time
import tornado.autoreload
import tornado.ioloop
import tornado.web
import tornado.template
from rebus.tools.selectors import guess_selector
from rebus.descriptor import Descriptor
import re
import json
class AsyncProxy... |
page.py | """Class 'Page' is a wrapper around requests.Response with convenient
functions.
"""
__all__ = ['Page', 'LoginPageBase', 'AuthPage', 'PowerschoolPage',
'MicrosoftPage', 'PowerschoolLearningPage']
__author__ = 'Thomas Zhu'
import abc
import base64
import hashlib
import hmac
import json
import os
import re
import s... |
accern_xyme.py | from typing import (
Any,
Callable,
cast,
Dict,
IO,
Iterable,
Iterator,
List,
Optional,
overload,
Set,
TextIO,
Tuple,
TYPE_CHECKING,
Union,
)
import io
import os
import pickle
import sys
import json
import time
import weakref
import inspect
import textwrap
imp... |
test_state.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
import shutil
import sys
import tempfile
import textwrap
import threading
import time
# Import Salt Testing libs
from tests.support.case import ModuleCase
from tests.support.h... |
__init__.py | import threading
import time
def run(runner):
runner.process()
def start_runner(runner):
t = threading.Thread(target=run, args=(runner, ))
t.start()
time.sleep(0.01) # make sure runner started.
return t
|
logger.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import logging
import multiprocessing
import os
import pickle
import signal
import sys
from enum import Enum
from logging.handlers import RotatingFileHandler, QueueHandler
from typing import Optional
class LogLevel(Enum):
CRITICAL = logging... |
face_detector_qwer_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... |
ThreadSynchronization.py | import threading as th
from time import sleep
def sync_thread(s,lock):
lock.acquire()
print("["+s,end="")
try:
sleep(1)
except Exception as e:
print(e)
lock.release()
print("]")
if __name__ == "__main__":
lock = th.Lock()
t1 = th.Thread(target=sync_thread,args=("I",lock... |
vsnp_add_zero_coverage.py | #!/usr/bin/env python
import argparse
import multiprocessing
import os
import queue
import re
import shutil
import pandas
import pysam
from Bio import SeqIO
INPUT_BAM_DIR = 'input_bam_dir'
INPUT_VCF_DIR = 'input_vcf_dir'
OUTPUT_VCF_DIR = 'output_vcf_dir'
OUTPUT_METRICS_DIR = 'output_metrics_dir'
def get_base_file_... |
reader.py | from contextlib import closing
import http.client
import os
import threading
import codalab.worker.download_util as download_util
from codalab.worker.download_util import get_target_path, PathException, BundleTarget
from codalab.worker.file_util import (
gzip_file,
gzip_bytestring,
read_file_section,
s... |
train.py | import argparse
import os
import random
import time
from elit.common.util import isdebugging
from elit.utils.log_util import cprint
if os.environ.get('USE_TF', None) is None:
os.environ["USE_TF"] = 'NO' # saves time loading transformers
import torch
import torch.distributed as dist
import torch.multiprocessing a... |
cli.py | # encoding: utf-8
import collections
import csv
import multiprocessing as mp
import os
import datetime
import sys
from pprint import pprint
import re
import itertools
import json
import logging
import urlparse
from optparse import OptionConflictError
import traceback
import sqlalchemy as sa
import routes
import paste... |
multiprocessing_env.py | import logging
import multiprocessing
import numpy as np
import traceback
import gym
from gym import spaces
from universe.vectorized import core
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class Error(Exception):
pass
def display_name(exception):
prefix = ''
# AttributeError has n... |
test_pdb.py | # A test suite for pdb; not very comprehensive at the moment.
import doctest
import os
import pdb
import sys
import types
import unittest
import subprocess
import textwrap
from contextlib import ExitStack
from io import StringIO
from test import support
# This little helper class is essential for testing pdb under do... |
context.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... |
cma_es.py | import cma
import numpy as np
import gym
import torch.multiprocessing as mp
from torch.multiprocessing import SimpleQueue
import pickle
import sys
from model import *
from utils import *
from config import *
import time
class Worker(mp.Process):
def __init__(self, id, state_normalizer, task_q, result_q, stop, conf... |
test_dataloader.py | import math
import sys
import errno
import os
import ctypes
import signal
import torch
import time
import traceback
import unittest
import subprocess
from torch import multiprocessing as mp
from torch.utils.data import Dataset, TensorDataset, DataLoader, ConcatDataset
from torch.utils.data.dataset import random_split
f... |
test_dao.py | '''
Created on Aug 26, 2014
@author: moloyc
'''
import unittest
from sqlalchemy import exc
from flexmock import flexmock
import jnpr.openclos.util
from jnpr.openclos.model import Pod, Device, Interface, InterfaceDefinition, TrapGroup
from jnpr.openclos.dao import AbstractDao
from jnpr.openclos.exception import Invali... |
eureka_client.py | # -*- coding: utf-8 -*-
"""
Copyright (c) 2018 Keijack Wu
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, merge,... |
test_socket.py | import time
import unittest
import six
if six.PY3:
from unittest import mock
else:
import mock
from engineio import packet
from engineio import payload
from engineio import socket
class TestSocket(unittest.TestCase):
def setUp(self):
self.bg_tasks = []
def _get_mock_server(self):
mo... |
network.py | """
Defines network nodes used within core.
"""
import logging
import threading
import time
from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Type
import netaddr
from core import utils
from core.constants import EBTABLES_BIN, TC_BIN
from core.emulator.data import LinkData, NodeData
from core.emulator... |
asyn.py | import asyncio
import asyncio.events
import functools
import inspect
import os
import re
import sys
import threading
from contextlib import contextmanager
from glob import has_magic
from .callbacks import _DEFAULT_CALLBACK
from .exceptions import FSTimeoutError
from .spec import AbstractFileSystem
from .utils import P... |
breaks.py | from tkinter import *
from utility import *
from tkinter import messagebox
import time
import threading
from win10toast import ToastNotifier
toast = ToastNotifier()
def main(root, WIDTH, HEIGHT, wu, hu):
global productiveTimeEntry, breakTimeEntry, currentStatusLabel
root.config(bg = "black")
heading = L... |
test_chatcommunicate.py | # coding=utf-8
import chatcommunicate
import chatcommands
from globalvars import GlobalVars
from datahandling import _remove_pickle
import collections
import io
import os
import os.path
import pytest
import threading
import time
import yaml
from fake import Fake
from unittest.mock import Mock, patch
def test_valida... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
ctc_without_blank.py | import queue
import threading
import numba
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Function, Variable
from pytorch_end2end.functions.utils import log_sum_exp
@numba.jit(nogil=True)
def _ctc_without_blank_loss(logits, targets, space_idx):
"""
http://www.cs.toronto.edu... |
callbacks_test.py | # Copyright 2016 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... |
ProtocolBaseClass.py | #!/usr/bin/env python
#
# (c) Copyright Rosetta Commons Member Institutions.
# (c) This file is part of the Rosetta software suite and is made available under license.
# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
# (c) For more information, see http://www.rosettacommons.or... |
base.py | import ast
import os
import time
import atexit
from logging import StreamHandler
from logging.handlers import SocketHandler
import threading
import warnings
from terra import settings
import terra.compute.utils
from terra.executor import Executor
from terra.logger import (
getLogger, LogRecordSocketReceiver, SkipStd... |
server.py | """
Telnet server.
Example usage::
class MyTelnetApplication(TelnetApplication):
def client_connected(self, telnet_connection):
# Set CLI with simple prompt.
telnet_connection.set_application(
telnet_connection.create_prompt_application(...))
def handle_com... |
test_explicit_comms.py | import multiprocessing as mp
import numpy as np
import pandas as pd
import pytest
import dask
from dask import dataframe as dd
from dask.dataframe.shuffle import partitioning_index
from distributed import Client
from distributed.deploy.local import LocalCluster
import dask_cuda
from dask_cuda.explicit_comms import c... |
programs.py | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Running programs utilities."""
from __future__ import print_function
# Standard library imports
from ast import literal_eval
from distutils.version i... |
learner.py | from __future__ import division
from __future__ import print_function
from builtins import zip
from builtins import range
from builtins import object
# 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 com... |
test_socket.py | import unittest
from test import support
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
import errno
import io
import itertools
import socket
import select
import tempfile
import time
import traceback
import queue
import sys
import os
import platform... |
manager.py | import os
import sched
import threading
import time
from flask import current_app, request
from ..conf.config import Constant, HttpMethod
from ..exceptions import ErrorResponse
from ..exceptions.error_code import MsgCode
from ..exceptions.log_msg import ErrorMsg, InfoMsg
from ..models import model_init_app
from ..ser... |
node0.py | import zmq
import time
import threading
import json
name = 'bob'
def cluster_manager (context, join_uri):
nodes = [name]
join_sock = context.socket (zmq.REP)
join_sock.bind (join_uri)
while True:
message = join_sock.recv ()
req = json.loads (message)
if 'type' in req and req['... |
application.py | # -*- coding: utf-8 -*-
"""
SQLpie™ is a simple, sleek, intuitive, and powerful API platform for prototyping projects that have data intelligence needs.
SQLpie is 100% written in Python and sits on top of a MySQL database, which means that it's easy to maintain and most (if not all) of the data processing heavy lifti... |
evaluation_matrix.py | import os
import pickle
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import glob
import torch
import scipy.misc
import numpy
import argparse
import cv2
from scipy import signal
from scipy import ndimage
from collections import OrderedDict
import multiprocessing
import math
from scipy.ndima... |
13_exercise_19.py | # -*- coding: utf-8 -*-
from multiprocessing import Process, Queue
import os, time, random
# 写数据进程执行的代码:
def write(q):
print('Process to write: %s' % os.getpid())
for value in ['A', 'B', 'C']:
print('Put %s to queue...' % value)
q.put(value)
time.sleep(random.random())
# 读数据进程执行的代码:
de... |
hapticenginge_interface.py | #!/usr/bin/python3
import argparse
import os
import sys
myfolder = os.path.dirname(os.path.abspath(__file__))
lib_path = os.path.join(myfolder, "../lib/")
sys.path.append(lib_path)
import haptic_engine_core
import subprocess
import time
import threading
parser = argparse.ArgumentParser()
parser.add_argument("-u", "--... |
cluster_coordinator_test.py | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
usbhid_test.py | from usbhid import usbhid
import sys
import threading
import time
import random
hid = usbhid()
ret = hid.open(0x084B,0x4853)
if ret != True:
sys.exit(-1)
# hid.disp_info()
# hid.set_debug_level(1)
# hid.
def hid_write(data):
block_size = 64
total_length = len(data)
offset = 0
length = total_length
__data = ... |
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... |
test_config.py | import asyncio
import copy
import pytest
import random
import yaml
from chia.util.config import create_default_chia_config, initial_config_file, load_config, save_config
from chia.util.path import mkdir
from multiprocessing import Pool
from pathlib import Path
from threading import Thread
from time import sleep
from t... |
test.py | import warnings
from textwrap import dedent
from . import expected
from gffutils import example_filename, create, parser, feature
import gffutils
import gffutils.helpers as helpers
import gffutils.gffwriter as gffwriter
import gffutils.inspect as inspect
import gffutils.iterators as iterators
import sys
import os
impor... |
setupqueries4years.py | from multiprocessing import Queue, Process
from argparse import ArgumentParser
import ioutils
"""
setup queries file to be used in printing word vectors for years
"""
SAVE_FILE = "{year:d}-query.txt"
FULL_RANGE_SAVE_FILE = "{year1:d}-{year2:d}-query.txt"
def worker(proc_num, queue, out_dir, target_lists):
while ... |
ping_thread_arp.py | #!/usr/bin/env python
from threading import Thread
import subprocess
from queue import Queue
import re
num_ping_threads = 3
num_arp_threads = 3
in_queue = Queue()
out_queue = Queue()
ips = ["10.0.1.1", "10.0.1.3", "10.0.1.11", "10.0.1.51"]
def pinger(i, iq, oq):
"""Pings subnet"""
while True:
ip = iq.... |
test.py | #!/usr/bin/env python
#
# Copyright 2008 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... |
rnode.py | import functools
import re
import os
import queue
import shlex
import string
import shutil
import logging
from logging import (Logger)
import threading
from threading import Event
import contextlib
from multiprocessing import Queue, Process
from typing import (
Dict,
List,
Tuple,
Optional,
Generator... |
money.py | import os
import time
from datetime import datetime
from multiprocessing import Process, Value
import sys
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from constant import MAX_TIME
# 日志输出
from logger import logger as logging
from util import check_game_state, start_game, i... |
start_pipelined.py | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
downloadandunbundle.py | # Copyright 2009-2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions ... |
SnakeServer.py | import socket
import pickle
import random
import threading
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import Qt
def get_ip():
try:
h_name = socket.gethostname()
IP = socket.gethostbyname(h_name)
except Exception:
IP = '127.0.0.1'
return IP
class SnakeServer:
de... |
runner.py | #!/usr/bin/env python2
# Copyright 2010 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
"""This is the Emscripten test runner. To run ... |
http1_tests.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... |
plotter.py | import atexit
import sys
if sys.version_info[0] == 2:
from Queue import Empty
else:
from queue import Empty
from multiprocessing import Process, Queue
from rllab.sampler.utils import rollout
import numpy as np
__all__ = [
'init_worker',
'init_plot',
'update_plot'
]
process = None
queue = None
de... |
oplog_manager.py | # Copyright 2013-2014 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 writin... |
tracker.py | from psutil import Process, cpu_percent
from threading import Thread
import time
import weakref
from typing import Union
from aim.ext.resource.stat import Stat
from aim.ext.resource.configs import AIM_RESOURCE_METRIC_PREFIX
class ResourceTracker(object):
STAT_INTERVAL_MIN = 0.1
STAT_INTERVAL_MAX = 24 * 60 * ... |
_threadedselect.py | # -*- test-case-name: twisted.test.test_internet -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Threaded select reactor
The threadedselectreactor is a specialized reactor for integrating with
arbitrary foreign event loop, such as those you find in GUI toolkits.
There are three things... |
bot.py | # -*- coding: utf-8 -*-
from linepy import *
from datetime import datetime
from time import sleep
from bs4 import BeautifulSoup
from googletrans import Translator
from humanfriendly import format_timespan, format_size, format_number, format_length
import socket, time, random, sys, json, codecs, threading, glob, re, str... |
day26-4 获取进程编号.py | # 1.导入多进程包
import multiprocessing
import time
import os
# 获取主进程id
main_process_id = os.getpid()
print('main_process_id:', main_process_id)
def dance():
# 获取当前进程ID
dance_process_id = os.getpid()
print('dance_process_id:', dance_process_id)
dance_parent_process_id = os.getppid()
print('dance_parent... |
cacheTiles.py | import sys
import time
import urllib.request
import threading
usage = "\n\n\n\tUSAGE: " + sys.argv[0] + " zoomLevel <optionalNumThreads> <optionalDelayBetweenRequests> <optionalXStart> <optionalYStart>\n\n\n"
if len(sys.argv) == 1:
print(usage)
sys.exit(1)
zoom = int(sys.argv[1])
print('Seeding cache for zoo... |
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 textwrap
import threading
import time
import unitt... |
test.py |
import threading
import sys
is_py2 = sys.version[0] == '2'
if is_py2:
import Queue as queue
else:
import queue as queue
def isScalar(x):
return not isinstance(x, (list, tuple))
def isList(x):
return isinstance(x, (list))
def asString(x):
return str(x)
def makeDict():
return {'a': 1.0, 'c': 3.0, 'b': ... |
asyncprogressor.py | #!/usr/bin/env python3
from tqdm import tqdm
import threading, time
import diskcache as dc
from datetime import datetime
done = False
def go_progress(seconds):
global done
with tqdm(total=400, bar_format = "{l_bar}{bar}") as pbar:
for i in range(0, 401):
time.sleep(seconds * 0.0025)
... |
common.py | # # # # #
# common.py
#
# Contains methods used across
# multiple backend files
#
# University of Illinois/NCSA Open Source License
# Copyright (c) 2015 Information Trust Institute
# All rights reserved.
#
# Developed by:
#
# Information Trust Institute
# University of Illinois
# http://www.iti.illinois.edu
#
# Permiss... |
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... |
auto_game_typey.py | #!/usr/bin/python3
import pyautogui
import time
import keyboard
import threading
def print_pos():
while(1):
print(pyautogui.position())
def everysec_press():
while(1):
# pyautogui.dragRel(0,0,1,button='left')
# pyautogui.press('b')
pyautogui.press(' ')
time.sleep(0.05)
... |
__init__.py | # coding=utf-8
# encoding: utf-8
from __future__ import absolute_import
from octoprint.util.version import get_octoprint_version_string
from tempfile import mkstemp
from datetime import timedelta
from slackclient import SlackClient
from slacker import Slacker, IncomingWebhook
from imgurpython import ImgurClient
from im... |
Server.py | '''
Melissa Hollingshed
14198590
Server.py
'''
import socket
import signal
import os
import threading
import time
import sys
from multiprocessing import Lock
RECV_SIZE = 1024
TIMEOUT = 45
LOCKOUT = 60
PORT = 18590
HOST = ''
user_list = []
lock = Lock()
user_lock = 0
# class for users on the client side
class User... |
test.py | import argparse
import json
import os
from pathlib import Path
from threading import Thread
import numpy as np
import torch
import yaml
from tqdm import tqdm
from models.experimental import attempt_load
from utils.datasets import create_dataloader
from utils.general import coco80_to_coco91_class, check_dataset, check... |
video.py | import os
import subprocess as sp
import re
import sys
import threading
import logging
import signal
from math import ceil
from queue import Queue, Empty
from gevent import idle
from config import config
from imageProcess import clean
from procedure import genProcess
from progress import Node, initialETA
from worker im... |
merge_wechat_backup.py | #!/usr/bin/python -u
"""
Copyright 2017, Jacksgong(https://blog.dreamtobe.cn)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicab... |
test_autograd.py | import gc
import sys
import io
import math
import random
import tempfile
import time
import threading
import unittest
import warnings
from copy import deepcopy
from collections import OrderedDict
from itertools import product, permutations
from operator import mul
from functools import reduce, partial
import torch
fro... |
test_threading.py | """
Tests for the threading module.
"""
import test.support
from test.support import (verbose, import_module, cpython_only,
requires_type_collecting)
from test.support.script_helper import assert_python_ok, assert_python_failure
import random
import sys
import _thread
import threading
import... |
tests_dag.py | import redis
from functools import wraps
import multiprocessing as mp
from includes import *
import time
'''
python -m RLTest --test tests_dag.py --module path/to/redisai.so
'''
def skip_if_not_version(major: int = 0, minor: int = 0, patch: int = 0):
def skipper(f):
@wraps(f)
def wrapper(env, *a... |
views.py | import fade
import undetected_chromedriver as uc
from time import sleep
from selenium.webdriver.common.by import By
import os
import io
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import threading
from datetime import datetime
from selenium im... |
Nodes.py | '''
Created on Jul 25, 2017
@author: Steven Proctor
grab +port grab +port
spit packets
recieve
'''
import socket
import time
from threading import Thread
class Node(object):
'''
classdocs
'''
def __init__(self, addr, ports,female):
self.buffer = []
self.portl... |
sim-webapp.py | #!/usr/bin/env python
#
# Pelion Virtual Demo
# (C) COPYRIGHT 2021 Pelion Ltd.
#
# 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 requir... |
socketTest.py | from socket import *
from time import sleep
import threading
def recvData():
udpRecvSocket = socket(AF_INET,SOCK_DGRAM)
myRecvPort = 48969
bindAddr = ('',myRecvPort)
try:
udpRecvSocket.bind(bindAddr)
except OSError:
myRecvPort = int(input("input a port:"))
bindAddr = ('',myR... |
runtests.py | #!/usr/bin/env python
import sys
import contextlib
import traceback
import unittest
import time
import os
import subprocess
import errno
import signal
import urllib2
import threading
import Queue
PREFIX = os.environ.get("AFDT_TEST_PREFIX", "").split()
class SubprocessTestCase(unittest.TestCase):
def setUp(self)... |
java_gateway.py | # -*- coding: UTF-8 -*-
"""Module to interact with objects in a Java Virtual Machine from a
Python Virtual Machine.
Variables that might clash with the JVM start with an underscore
(Java Naming Convention do not recommend to start with an underscore
so clashes become unlikely).
Created on Dec 3, 2009
:author: Barthe... |
generatorclient.py | import socket
from threading import Thread
import datetime
import pickle
import hashlib
import youtubequeue
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
last_upload_times = None
isRequestingScripts = False
# Connect the socket to the port where the server is listening
server_address = ('localh... |
test_logbook.py | # -*- coding: utf-8 -*-
from .utils import (
LogbookTestCase,
activate_via_push_pop,
activate_via_with_statement,
capturing_stderr_context,
get_total_delta_seconds,
make_fake_mail_handler,
missing,
require_module,
require_py3,
)
from contextlib import closing, contextmanager
from dat... |
language.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from multiprocessing import Process, Queue
from HDP_HSMM.basic.distributions import PoissonDuration
from HDP_HSMM.internals.transitions import HDPHMMTransitions
from HDP_HSMM.internals.states import InitialState
from HDP_HSMM.basic.util import sample_disc... |
OpDialogue.py | ##########################################################################
#
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "Hello. I am alive!"
def run():
app.run(host='0.0.0.0',port=8080)
def keep_alive():
t = Thread(target=run)
t.start() |
irc.py | import datetime
import re
import select
import socket
import threading
import time
from pytwitchirc.event import Event, CurrentEvent
class IRC:
def __init__(self, nickname: str, oauth: str, host='irc.chat.twitch.tv', port=6667,
log_settings=(0, 0, 0, 0), throttle=20, log_file=None, how_many=5, ... |
core.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
#... |
session_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... |
queue_test.py | import multiprocessing as mp
import time
import random
random.seed()
def AppendFIFO(list, value, max_values):
list.append(value)
while len(list) > max_values:
list.pop(0)
return list
def send_slow(queue1, queue2):
somelist = []
maxlen = 500
sequence = 0
while True:
queue... |
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... |
test_selenium.py | # class SeleniumTestCase(unittest.TestCase):
# client = None
# app = None
#
# def __init__(cls, app):
# # super(SeleniumTestCase, cls).__init__(**kwargs)
# cls.app = app
#
# @classmethod
# def setUpClass(cls):
#
# try:
# cls.client = webdriver.Safari(port=5001)
# except:
# pass
#
# if cls.client:
#... |
test_zmq.py | import pytest
pytest.importorskip('zmq')
from partd.zmq import Server, keys_to_flush, File, Client
from partd import core, Dict
from threading import Thread
from time import sleep
from contextlib import contextmanager
import pickle
import os
import shutil
def test_server():
s = Server()
try:
s.start... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.