source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
test_generator_api.py | import functools
import threading
import unittest
import pytest
import numpy
import cupy
from cupy import random
from cupy import testing
from cupy.testing import _attr
from cupy.testing import _condition
def numpy_cupy_equal_continuous_distribution(significance_level, name='xp'):
"""Decorator that tests the di... |
qt.py | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 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... |
api.py | """Remotely control your Binance account via their API : https://binance-docs.github.io/apidocs/spot/en"""
import hashlib
import hmac
import json
import math
import re
import sys
import time
from datetime import datetime, timedelta
from threading import Thread
from urllib.parse import urlencode
import numpy as np
imp... |
test__threading_vs_settrace.py | from __future__ import print_function
import sys
import subprocess
import unittest
from gevent.thread import allocate_lock
import gevent.testing as greentest
script = """
from gevent import monkey
monkey.patch_all() # pragma: testrunner-no-monkey-combine
import sys, os, threading, time
# A deadlock-killer, to preven... |
test_etcd_client.py | # Copyright 2020 The FedLearner 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... |
main.py | import logging
import re
import time
from copy import deepcopy
from enum import Enum
from typing import List, Optional
from datetime import datetime
import threading
import traceback
import html
import json
import peewee
import telegram.error
from telegram import Update, InlineKeyboardMarkup, InlineKeyboardButton, Bot... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrumsys.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrumsys.bip32 import BIP32Node
from electrumsys import constants
fr... |
amazon.py | from bs4 import BeautifulSoup
from time import perf_counter
import concurrent.futures
import threading as th
import requests
def clean_string(string):
string = string.replace("\n","")
string = string.replace("\t","")
string = string.strip()
return string
class AmazonScraper:
"""
This clas... |
TransportLayer.py | import socket
import logging
import time
import threading
import sys
class RDT:
CONGESTION_AVOIDANCE = -1
SLOW_START = 0
FAST_RECOVERY = 1
def __init__(self):
self.MSS = 2048
self.N = 100 # Window size.
self.RTO = 0.75 # Timeout (secs).
self.connection = False
... |
i3expod.py | #!/usr/bin/python3
import ctypes
import os
import configparser
import xdg
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
import i3ipc
import copy
import signal
import sys
import traceback
import pprint
import time
import argparse
import random
import subprocess
import math
from threading import Thread
t... |
worker.py | import six
import logging
import socket
import uuid
import threading
import traceback
import datetime
from plynx.service.tcp_utils import send_msg, recv_msg
from plynx.service.messages import WorkerMessage, RunStatus, WorkerMessageType, MasterMessageType
from plynx.constants import JobReturnStatus
from plynx.utils.conf... |
program.py | import glob
import os
import signal
#import resource
import logging
import re
import shutil
import tempfile
import shlex
import fnmatch
import platform
import subprocess
import threading
import traceback
from time import clock
def locate_program(candidatePaths):
for p in candidatePaths:
if os.path.isfile(p... |
app_utils.py | # From http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/
import struct
import six
import collections
import cv2
import datetime
from threading import Thread
from matplotlib import colors
# class FPS:
# def __init__(self):
# # store the start time, end time, and total n... |
live_event_engine.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from queue import Queue, Empty
from threading import Thread
from collections import defaultdict
import logging
_logger = logging.getLogger(__name__)
class LiveEventEngine(object):
"""
Event queue + a thread to dispatch events
"""
def __init__(self):
... |
bootstrap.py | """
Bootstrap an installation of TLJH.
Sets up just enough TLJH environments to invoke tljh.installer.
This script is run as:
curl <script-url> | sudo python3 -
Constraints:
- Entire script should be compatible with Python 3.6 (We run on Ubuntu 18.04+)
- Script should parse in Python 3.4 (since we exit with... |
process_family.py | """Test stub of terminate_process()."""
import multiprocessing
from multiprocessing import Process, synchronize
from typing import Any, Callable, List, Optional
import psutil
from tests.testlibraries.cpu_bound import cpu_bound
class ProcessFamily:
"""Creates child process and grandchild process ad once."""
... |
fdu.py | #!/usr/bin/env python
import datetime
import json
import pathlib
import platform
import pprint
import sys
import time
import traceback
from multiprocessing import Process
import click
import requests
import six
import yaml
import freenom_dns_updater
from freenom_dns_updater.get_my_ip import *
is_windows = any(platfo... |
pingpongpiweb.py | # Ping Pong Pi web UI running on flask.
# Uses zmq to speak to daemon controlling screen.
from flask import Flask, render_template, appcontext_tearing_down, request
from multiprocessing import Process, Queue
from multiprocessing.connection import Client
import atexit
import time
import zmq
app = Flask(__name__)
@ap... |
application_runners.py | from __future__ import print_function
import sys
import os
import uuid
import shlex
import threading
import subprocess
import logging
import runpy
import future.utils as utils
import flask
import requests
from dash.testing.errors import (
NoAppFoundError,
TestingTimeoutError,
ServerCloseError,
)
import d... |
select_ticket_info.py | # -*- coding=utf-8 -*-
import datetime
import random
import os
import socket
import sys
import threading
import time
import TickerConfig
import wrapcache
from agency.cdn_utils import CDNProxy, open_cdn_file
from config import urlConf, configCommon
from config.TicketEnmu import ticket
from config.configCommon import sea... |
mediaplayer.py | from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from MediaPlayer.MainWindow import Ui_MainWindow
from Backend.DHT.Utils import *
from Pyro4.errors import PyroError
import pyaudio
import time
from threading import Thread
Pyro4.config.SERIALIZER = "pickle"
Pyro4.config.SERIALIZERS_ACCE... |
classes.py | import threading
import jsonpickle
from cloudant.client import Cloudant
from cloudant.error import CloudantException
from cloudant.query import Query, QueryResult
from cloudant.result import Result, ResultByKey
from requests import adapters
from cloudant.adapters import Replay429Adapter
from datetime import datetime, t... |
multiprocessing_env.py | # Code is from OpenAI baseline.
#https://github.com/openai/baselines/tree/master/baselines/common/vec_env
import numpy as np
from multiprocessing import Process, Pipe
def worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.x()
while True:
cmd, data = remote.re... |
plugin.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
####################
import base64
import logging
import json
import ssl
import os.path
import hashlib
import time
import threading
import requests
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from urlparse import urlparse, parse_qs
import urllib2
impor... |
http_server.py | import webview
import os
import sys
import socket
import threading
import logging
from random import random
try:
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import ThreadingMixIn
except ImportError:
from http.server import SimpleHTTPReq... |
utilities.py | #!/bin/env python
# -*coding: UTF-8 -*-
#
# Disclaimer:
# Functions get_sys_info, netcdf_and_hdf5_versions and show_versions are from:
# xarray/util/print_versions.py
#
import os
import sys
import warnings
import urllib
import json
import collections
import copy
from functools import reduce
from packaging import ver... |
TASK_sharing_variable_by_processes.py | """ЗАДАЧА:
Разгледайте дадения по-долу код и направете необходимите промени,
така че след приключването на двата процеса променливата x да има стойност 20.
Използвайте multiprocessing.Queue() за да обмените текущата стойност на x между процесите.
"""
import multiprocessing as mp
def increment(r):
global x
for ... |
ida_script.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import datetime
import threading
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer
from xml.sax.saxutils import escape
import idaapi
import idautils
import idc
# Wait for any processing to get done
idaapi.autoWait()
... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. versionadded:: 2014.7.0
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends:
- CherryPy Python module. Version 3.2.3 is currently recommended when
SSL is enabled, since this version worked the best with SSL in
internal testing.... |
semaphore.py | __author__ = 'July'
# http://www.bogotobogo.com/python/Multithread/python_multithreading_Synchronization_Semaphore_Objects_Thread_Pool.php
import threading
import time
import logging
logging.basicConfig(level=logging.DEBUG,
format='(%(threadName)-9s) %(message)s',)
class ThreadPool(object):
de... |
index.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
try:
from threading import Thread
except ImportErr... |
logger.py | import time
import re
import socket
import sys
import Adafruit_DHT
import traceback
import paho.mqtt.client as mqtt
from threading import Thread
class DHT22Logger:
config = None
mqtt_client = None
mqtt_connected = False
worker = None
temperature = None
humidity = None
def __init__(self, c... |
multithread.py | # -*- coding: utf-8 -*-
# @Time : 5/15/2018 2:42 PM
# @Author : sunyonghai
# @File : multithread.py
# @Software: ZJ_AI
import random
import threading
import queue
import numpy as np
import time
from PIL import Image
import os
class Generator(object):
def __init__(self):
self.q = queue.Queue(maxsize=... |
test_threaded_import.py | # This is a variant of the very old (early 90's) file
# Demo/threads/bug.py. It simply provokes a number of threads into
# trying to import the same module "at the same time".
# There are no pleasant failure modes -- most likely is that Python
# complains several times about module random having no attribute
# randran... |
MultiServer.py | from __future__ import annotations
import argparse
import asyncio
import functools
import json
import logging
import zlib
import collections
import typing
import inspect
import weakref
import datetime
import threading
import random
import ModuleUpdate
ModuleUpdate.update()
import websockets
import prompt_toolkit
fr... |
application.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... |
core.py | import sys
from itertools import chain, combinations, permutations
import json
from profil3r.modules.email import email
from profil3r.modules.social import facebook, twitter, tiktok, instagram
from profil3r.modules.music import soundcloud
from profil3r.modules.programming import github
from profil3r.colors import Color... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
test_locks.py | from __future__ import annotations
import queue
from threading import Thread
from typing import TYPE_CHECKING
import pytest
from django.db import OperationalError, connection, connections
from django.db.transaction import TransactionManagementError, atomic
from django.test import TestCase, TransactionTestCase
from d... |
test_cli_script.py | # Copyright 2015 Oliver Cope
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
tcp-server.py | import socket
import threading
# Server will listen on this socket
IP = '0.0.0.0'
PORT = 9998
def main():
"""Create a multi-threaded TCP server"""
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind ((IP, PORT))
# Queue up to 5 'connect requests' before refusing outside connection... |
gpu_imagenet_bench.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... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask("")
def run():
app.run(host="0.0.0.0", port=3000)
def keep_alive():
t = Thread(target=run)
t.start()
|
test_advanced.py | # coding: utf-8
from concurrent.futures import ThreadPoolExecutor
import json
import logging
import random
import sys
import threading
import time
import numpy as np
import pytest
import ray
import ray.cluster_utils
import ray.test_utils
from ray.test_utils import RayTestTimeoutException
logger = logging.getLogger(... |
WebFuzzer.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "Testing Web Applications" - a chapter of "The Fuzzing Book"
# Web site: https://www.fuzzingbook.org/html/WebFuzzer.html
# Last change: 2021-11-03 13:11:54+01:00
#
# Copyright (c) 2021 CISPA Helmholtz Center for Information Security
# Copyright (c) 2018-2020 Saarland Un... |
__init__.py | """Term-Image's Terminal User Interface"""
from __future__ import annotations
import argparse
import logging as _logging
import os
from pathlib import Path
from typing import Iterable, Iterator, Tuple, Union
import urwid
from .. import logging
from ..config import max_notifications
from ..utils import lock_tty
from... |
UrlFetcher.py | from urllib2 import urlopen, HTTPError, URLError
from time import sleep
from threading import Thread
from Queue import Queue
class UrlFetcher(object):
MAX_READ_SIZE = 1024 * 1024
def __init__(self, threads=12):
self._input_queue = Queue()
self._output_queue = None
self._threads = thre... |
controller.py | import re
from copy import copy
from datetime import datetime
from logging import getLogger
from threading import Thread, Event
from time import time
from plotly import graph_objects as go
from plotly.subplots import make_subplots
from attr import attrib, attrs
from typing import Sequence, Optional, Mapping, Callable... |
test_leaks.py | import unittest
import sys
import gc
import time
import weakref
import greenlet
import threading
class ArgRefcountTests(unittest.TestCase):
def test_arg_refs(self):
args = ('a', 'b', 'c')
refcount_before = sys.getrefcount(args)
g = greenlet.greenlet(
lambda *args: greenlet.get... |
wsdump.py | #!/home/manuel/Desktop/core_android/mycroft-env/bin/python3
import argparse
import code
import sys
import threading
import time
import ssl
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readline
except ImportError:
pass
def get_encoding():
encoding = getattr(sys.st... |
plugin.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
####################
# apple tv Plugin
# Developed by Karl Wachs
# karlwachs@me.com
#pyatv is maintained by postlund
#see: https://github.com/postlund/pyatv
try:
import json
except:
import simplejson as json
import datetime
import time
import subprocess
import fcntl
im... |
random_task.py | import task_submit
from task_submit import VGGTask,RESTask,RETask,DENTask,XCETask
import random
import kubernetes
import influxdb
import kubernetes
import requests
from multiprocessing import Process
import multiprocessing
import urllib
import urllib3
import time
import os
import json
import math
import pandas as pd
im... |
asynchronous_bayesian_optimization.pct.py | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.12.0
# kernelspec:
# display_name: 'Python 3.7.5 64-bit (''.venv'': venv)'
# name: python3
# ---
# %% [markdown]
# # Asynchronous Bayesian op... |
main_menu.py | import curses, time, random, sys, win32console, locale, threading
from pygame import mixer
#games
from methods.menus import *
import rps
import snake
import leaderboard
import asciiAnimation
import snow
import xo
#set encodage to utf-8
locale.setlocale(locale.LC_ALL, '')
#set window title
win32consol... |
PlexAPI.py | #!/usr/bin/env python
"""
Collection of "connector functions" to Plex Media Server/MyPlex
PlexGDM:
loosely based on hippojay's plexGDM:
https://github.com/hippojay/script.plexbmc.helper... /resources/lib/plexgdm.py
Plex Media Server communication:
source (somewhat): https://github.com/hippojay/plugin.video.plexbmc... |
HaCRSUI.py | #!/usr/bin/env python
import ConfigParser
import psycopg2
import operator
import uuid
import json
import glob
import urllib
import sys
import textwrap
sys.path.append('../mtutil/')
from HaCRSUtil import HaCRSUtil
from TurkerResults import TurkerResults
from HaCRSTurker import HaCRSTurker
from HaCRSDB import HaCRSDB
fro... |
d99409444758b87def44f203587af8561cb8d45eKodemon.py | import multiprocessing, signal, time
import KodemonUDPServer, KodemonAPI
def StartUDPServer():
server = KodemonUDPServer.KodemonUDPServer()
server.serve_forever()
def StartAPI():
api = KodemonAPI.KodemonAPI(debug=False)
api.run()
def sigintHandler(signum, frame):
print 'Exiting'
pUDP.terminate()
pAPI.termin... |
rdd.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... |
lunar.py | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import gym
import os
import threading
import multiprocessing
from random import choice
from time import sleep
from time import time
from a3c import *
from utils import *
max_episode_steps = 1000
gamma = 0.999
s_size = 8
a_size = 4
load_mo... |
video_module.py | from engine import SystemState
from engine import Utilities
from engine import Menu
from engine import Screen
from engine import TextWriter
from engine import Events
import RPi.GPIO
import pyaudio
import wave
import atexit
import io
import stat
import os
import signal
import picamera
import time
import sys
import threa... |
RNASeq_ICGS.py | ###RNASeq
#Copyright 2005-2008 J. David Gladstone Institutes, San Francisco California
#Author Nathan Salomonis - nsalomonis@gmail.com
#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 wi... |
view_vision_position.py | #!/usr/bin/env python3
# Copyright 2020, NTRobotics
#
# 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... |
faster.py | from requests import *
from multiprocessing import *
import utils
import re
match_ids = re.compile("<th scope=\"row\">(.+?)</th>")
match_bucks = re.compile("You have (.+?) bucks</div>")
def exploit(host):
s = session()
# reg
un = utils.randomString()
print(un)
result = s.post(f"http://faster.{host... |
DependencyNodeTest.py | ##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
scheduler.py | import time
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta
from multiprocessing import Queue, Process
from threading import Thread
import schedule
from scylla.config import get_config
from scylla.database import ProxyIP
from scylla.jobs import validate_proxy_ip
from scylla.... |
test_thread_file_handler.py | """Test the TcEx Batch Module."""
# standard library
import os
import threading
class TestApiHandler:
"""Test the TcEx API Handler Module."""
@staticmethod
def logging_thread(logfile, tcex):
"""Test thread logging
Args:
logfile (str): The logfile name.
tcex (TcEx,... |
common.py | # Copyright 2021 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.
from enum import Enum
from functools import wraps
from pathlib import... |
app_main.py | import json
# import os
from multiprocessing import Process, Pipe
import boto3
import numpy as np
from astropy import log
from astroquery.mast import Observations
# TODO: Remove this after https://github.com/astropy/astroquery/pull/1536
# is merged.
log.setLevel('ERROR')
lambda_client = boto3.client('lambda')
... |
main_window.py | #!/usr/bin/env python3
#
# Electrum ABC - lightweight eCash client
# Copyright (C) 2020 The Electrum ABC developers
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in... |
python_server.py | import time, socket, json, threading
RECEIVE_BUF = 1024*1024
conn = None
callbacksThread = None
def waitForConnection():
global conn, callbacksThread
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
s.bind(("127.0.0.1", 81))
s.listen(1)... |
remotehost.py | # Host class
# Copyright (c) 2016, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
import subprocess
import threading
logger = logging.getLogger()
def execute_thread(command, reply):
cmd = ' '.join(command)
logger.d... |
_time.py | # Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
__init__.py | """CFNgin directed acyclic graph (DAG) implementation."""
from __future__ import annotations
import collections
import logging
from copy import copy, deepcopy
from threading import Thread
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
OrderedDict,
Set,
Tupl... |
vad_collector.py | import logging
import collections
import contextlib
import wave
import tempfile
import webrtcvad
import torch
from array import array
import time
import threading
import psutil
import pyaudio
import os
from flowd.metrics import BaseCollector
def normalize(snd_data) -> array:
"""Average the volume out"""
time... |
core.py | from sublime_db.core.typecheck import (
Any,
Generator,
Callable,
List,
Optional,
TypeVar,
Generic,
Union
)
import sublime
import threading
import concurrent
from sublime_db.libs import asyncio
from .log import log_exception
T = TypeVar('T')
awaitable = Generator[Any, Any, T]
async = asyncio.coroutine
futur... |
lambda_executors.py | import base64
import contextlib
import glob
import json
import logging
import os
import re
import subprocess
import sys
import threading
import time
import traceback
import uuid
from multiprocessing import Process, Queue
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from localstack import config... |
delta_keep_alive.py | #!/usr/bin/python3
# C:\Work\Python\HID_Util\src\grt_FW_version.py
# based on bsl.py
from binascii import hexlify
import sys
import argparse
import threading
from time import perf_counter as timer
from time import sleep
# NOTE: about include_dll_path for __init__.py error.
# You MUST include the next lin... |
portable_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... |
downloader.py | import os
import xmlrpc.client
from pathlib import Path
from threading import Thread
from time import sleep
from typing import List
from pydantic import BaseModel
from christina import utils
from christina.logger import get_logger
from christina.tools.proxy import HTTP_PROXY
DOWNLOAD_DIR = Path(os.environ['STATIC_DI... |
ap.py | from pystray import Icon, MenuItem, Menu
from PIL import Image # big
from dev_autopilot import *
from src.directinput import *
import threading
import kthread
import keyboard
STATE = 0
def setup(icon):
icon.visible = True
def exit_action():
stop_action()
icon.visible = False
icon.stop... |
multi_proxy_server.py | #!/usr/bin/enc python3
import socket, time, sys
from multiprocessing import Process
#define global address and buffer size
HOST = "localhost"
PORT = 8001
BUFFER_SIZE = 1024
# get_remote_ip:
def get_remote_ip(host):
print(f'Getting IP for {host}')
try:
remote_ip = socket.gethostbyname(host)
except ... |
tf.py | # import the necessary packages
from __future__ import print_function
from PIL import Image as m2
from PIL import ImageTk
from tkinter import *
import threading
import datetime
import cv2
import os
from scipy import misc
import argparse
import tensorflow as tf
import numpy as np
import facenet
import detect_face
import... |
elara.py | """
Copyright (c) 2021, Saurabh Pujari
All rights reserved.
This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
"""
import threading
from .db_thread import DB_Thread
import os
import atexit
from .elarautil import Util
from .exceptions import Inv... |
Craft.py | import websocket
import threading
import os
import json
import uuid
import sys
from time import sleep
from json import JSONEncoder
from uuid import UUID
JSONEncoder_olddefault = JSONEncoder.default
#special encoding for supporting UUID in json payload
def JSONEncoder_newdefault(self, o):
if isinstance(o, UUID): re... |
worker_process.py | import logging
import threading
from queue import Queue
from eqsn.qubit_thread import SINGLE_GATE, MERGE_SEND, MERGE_ACCEPT, MEASURE, \
MEASURE_NON_DESTRUCTIVE, GIVE_STATEVECTOR, \
CONTROLLED_GATE, NEW_QUBIT, ADD_MERGED_QUBITS_TO_DICT, CONTROLLED_TWO_GATE, \
DOUBLE_GATE, QubitThread
from eqsn.shared_dict i... |
locators.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Impo... |
scheduled_executor.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... |
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.... |
__main__.py | import pygame
from pygame.locals import *
from sys import exit
from music21 import *
import tkinter as tk
import threading
import time
import mido
background_image_filename = 'background2.png'
enkeys = ['f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'f10', 'f11', 'f12', '1', '2', '3', '4', '5', '6', '7', '8', '9... |
fake_ice.py | #!/usr/bin/env python
CAPABILITES = "?_dIifOoBbMmeGgPp"
MAX_GPIO = 24
DEFAULT_SERIAL = '/tmp/com2'
DEFAULT_BAUD_DIVIDER = 0x00AE
DEFAULT_I2C_MASK = '1001100x'
DEFAULT_I2C_SPEED_IN_KHZ = 100
DEFAULT_FLOW_CLOCK_IN_HZ = .625
DEFAULT_POWER_0P6 = 0.675
DEFAULT_POWER_1P2 = 1.2
DEFAULT_POWER_VBATT = 3.8
DEFAULT_VSET_0P6 = 19... |
process.py | # -*- coding: utf-8 -*-
'''
Functions for daemonizing and otherwise modifying running processes
'''
# Import python libs
from __future__ import absolute_import, with_statement, print_function, unicode_literals
import copy
import os
import sys
import time
import errno
import types
import signal
import logging
import th... |
mem.py | "Utility functions for memory management"
from ..imports.torch import *
from ..core import *
from ..script import *
import functools, threading, time
#from .pynvml_gate import *
from collections import namedtuple
#is_osx = platform.system() == "Darwin"
use_gpu = torch.cuda.is_available()
GPUMemory = namedtuple('GPUM... |
07_pendulum_ddpg_main.py | # https://github.com/openai/gym/blob/master/gym/envs/classic_control/pendulum.py
# https://mspries.github.io/jimmy_pendulum.html
#!/usr/bin/env python3
import time
import torch
import torch.nn.functional as F
import torch.multiprocessing as mp
from torch import optim
import os, sys
import numpy as np
current_path = os... |
1.4.1.py | #coding:utf-8
'''
第一种方式:使用os模块中的fork方式实现多进程
import os
if __name__ == '__main__':
print 'current Process (%s) start ...'%(os.getpid())
pid = os.fork()
if pid < 0:
print 'error in fork'
elif pid == 0:
print 'I am child process(%s) and my parent process is (%s)',(os.getpid(),os.getppid())
... |
cam_socket.py | import cv2
import threading, time, logging
import socket, time, pickle, io, zlib, struct
'''
Author: LiaoSteve
>> Threading cam and socket are combined together
'''
class CamSocket():
def __init__(self, URL, origin_size=False):
#-- cam
self.__URL = URL
self.cam_Fr... |
SubsetClass.py | from colorama import Fore, Style
from threading import Thread
from .helper import val_range
from .config import column_index, column_name, debug
class SubsetClass(object):
"""
Class that stores SubsetClass details for components of model
"""
def __init__(self, time_step, query_df, model_df, row):
... |
__init__.py | #!/usr/bin/env python3
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
#########################################################################
# Copyright 2022- Michael Wenzel wenzel_michael@web.de
#########################################################################
# ... |
controller.py | #!/usr/bin/python3
import argparse, os, queue, random, subprocess, sys, threading
import common
def make_seed(random):
return random.randrange(1 << 63)
def banner(msg, fill):
print(msg.center(60, fill))
def build(args):
players = [common.get_player(name) for name in args.players]
for p in players:
... |
stage.py | import sys
import time
import traceback
from collections import namedtuple
import threading
from pypeln import utils as pypeln_utils
from . import utils
class Stage(pypeln_utils.BaseStage):
def __init__(
self,
f,
workers,
maxsize,
on_start,
on_done,
depend... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.