source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
rates_api_server.py | """ rates api server """
from contextlib import contextmanager
from collections.abc import Generator
import multiprocessing as mp
import requests
from requests.exceptions import RequestException
from rates_demo.rates_api import start_rates_api
@contextmanager
def rates_api_server() -> Generator[None, None, None]:
... |
thread-3.py | #/usr/bin/env python
#coding=utf8
"""
# Author: kellanfan
# Created Time : Fri 21 Jul 2017 04:52:07 PM CST
# File Name: thread-3.py
# Description:
"""
import time, threading
# 假定这是你的银行存款:
balance = 0
def change_it(n):
# 先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance - n
def ru... |
conftest.py | # ***************************************
# |docname| - pytest fixtures for testing
# ***************************************
#
# To get started on running tests, see tests/README.rst
#
# These fixtures start the web2py server then submit requests to it.
#
# **NOTE:** Make sure you don't have another server running, ... |
serialport.py | # coding= utf-8
import serial
from threading import Thread
import serial.tools.list_ports
import time
class SerialPort:
def __init__(self, iport, fileWriter=None, baudRate=115200, showLog=False):
self.zeroCount = 0
self._port = iport
self._baudRate = baudRate
self._showLog = showL... |
generate_dataset_from_FatigueView.py | # -*- coding: UTF-8 -*-
'''=================================================
@Author :zhenyu.yang
@Date :2020/11/5 11:37 AM
=================================================='''
import sys
sys.path.append('./')
sys.path.insert(0,'/data/zhenyu.yang/modules')
import cv2
import json
import numpy as np
import random
i... |
cimfuzz.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
''' runtest
Assumptions:
The VMs of s2e be placed at S2EDIR/vm/ directory, with
name i386 and x86_64, the structure should look like:
========================================
$ tree $S2EDIR/vm
/$S2EDIR/vm
├── i386
│ ├── disk.s2... |
client.py | # Class: CS544
# Date : 13 March, 2020
# Purpose: Implementing client logic
from socket import AF_INET, socket, SOCK_STREAM #python package for importing TCP sockets
from threading import Thread
import tkinter #python library for UI used in the chat
from datetime import datetime #python package for datetime
import... |
log_battery.py | # log_battery.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:45 PM
"""Example to continuously read the battery (with no Wifi connection)"""
import csv
import time
import logging
import argparse
import threading
fro... |
solrqueue.py | from datetime import datetime
import logging
from queue import Empty, Full, Queue
import threading
from haystack.utils import get_identifier
from api_v2.search.index import TxnAwareSearchIndex
LOGGER = logging.getLogger(__name__)
class SolrQueue:
def __init__(self):
self._queue = Queue()
self._... |
build-all.py | #! /usr/bin/env python2
# Copyright (c) 2009-2015, 2017, The Linux Foundation. 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... |
test_rediscache.py | #!/usr/bin/env python3
"""
This will test various scenario with the redis cache.
It requires the local redis server to be started:
sudo service redis.server start
Start with unittest
python -m unittest test_rediscache.py
Start with pytest
pytest -s
Start with coverage
coverage run --source=rediscache --module pytes... |
main.py | from zeroconf import ServiceBrowser, Zeroconf, IPVersion
from simple_term_menu import TerminalMenu
import os
import time
import hashlib
import multiprocessing
import requests
import socket
import server
DEVEL = False
class ZeroconfListener():
"""
Listener definition used by Zeroconf.
Collects all discov... |
main.py | #!/usr/bin/env python3
from ev3dev2.motor import MediumMotor, OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D, SpeedPercent, MoveSteering
from ev3dev2.sound import Sound
from ev3dev2.sensor import INPUT_1, INPUT_2, INPUT_3, INPUT_4
from ev3dev2.sensor.lego import InfraredSensor, ColorSensor, TouchSensor
from time import sleep
i... |
local_state_collector.py | """Collecting the states of the local system"""
import copy
from datetime import datetime
import os
import re
import signal
import threading
import time
import psutil
from forch.proto.process_state_pb2 import ProcessState, VrrpState
from forch.proto.shared_constants_pb2 import State
from forch.proto.system_state_pb2... |
scripts.py | # -*- coding: utf-8 -*-
'''
This module contains the function calls to execute command line scripts
'''
# Import python libs
from __future__ import absolute_import, print_function
import os
import sys
import time
import logging
import threading
import traceback
from random import randint
# Import salt libs
from salt.... |
client.py | import os
import hashlib
import time
import queue
import signal
import typing
import getpass
import logging
import base64
import threading
from typing import Any, Dict, List, Type, Callable, Optional, DefaultDict, Tuple, Union
from types import FrameType
from collections import defaultdict
from telegram import VERSION... |
webcam.py | import time
import queue
import select
import threading
import contextlib
import flask
import v4l2capture
app = flask.Flask('basic-web-cam')
clients = set()
def gen_frames():
cam = v4l2capture.Video_device("/dev/video0")
with contextlib.closing(cam):
cam.set_format(640, 480, fourcc='MJPG')
... |
net.py | """
Handles P2P connections.
All networking functions are ultimately done through
this class.
"""
import hashlib
import signal
import zlib
from ast import literal_eval
from .nat_pmp import NatPMP
from .rendezvous_client import *
from .unl import UNL
from .upnp import *
# How many times a single messa... |
astra.py | import argparse
import base64
import json
import requests
import time
import ast
import utils.logger as logger
import utils.logs as logs
import urlparse
from core.zapscan import *
from core.parsers import *
from utils.logger import *
from core.login import APILogin
from utils.logger import logger
from utils.config im... |
server.py | # -*- coding:utf-8 -*-
"""
* Copyright@2016 Jingtum Inc. 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
*
* Un... |
Hiwin_RT605_ArmCommand_Socket_20190627204210.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
Application.py | ################################################################################
# Main application
################################################################################
import queue
import threading
from os.path import abspath, dirname, join
import tkinter as tk
from PIL import Image, ImageTk, ImageOps, Uni... |
aiostream.py | # Copyright 2020 Josh Pieper, jjp@pobox.com.
#
# 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... |
tensor.py | from collections import OrderedDict
from contextlib import contextmanager
from typing import Dict, List, Tuple
import subprocess
import time
import numpy as np
import logging
logger = logging.getLogger(__name__)
from torch import Tensor
from torch.cuda.amp import GradScaler, autocast
from torch.multiprocessing import ... |
regional_stack_lambda.py | '''
Creates regional CloudFormation stacks that trigger the main AutoSpotting
Lambda function
'''
from json import dumps
from sys import exc_info
from threading import Thread
from traceback import print_exc
from boto3 import client
from botocore.exceptions import ClientError
from botocore.vendored import req... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file license.txt 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
im... |
radiotuner.py | #!/usr/bin/env python3
from backend.streamer import AudioPipe
from backend.player import player_main
from frontend.tui import TUI_main
from frontend.webserver import define_webserver
from threading import Thread
from queue import Queue
import argparse
import socket
# Parse arguments
parser = argparse.ArgumentParser(de... |
main.py | import logging
import threading
from bokeh.io import curdoc
from bokeh.models import ColumnDataSource
from bokeh.plotting import Figure
from Comm.EnsembleJsonData import ADCP
from Ensemble.Ensemble import Ensemble
logger = logging.getLogger("EnsembleReceiver")
logger.setLevel(logging.DEBUG)
FORMAT = '[%(asctime)-15s... |
broker.py | import selectors
import socket
import types
import queue
import threading
from message_handler import MessageHandler
from datetime import datetime
class Broker():
_BINDING_IP = '127.0.0.1'
_BINDING_PORT = 65432
_consumerSelector = None
_QUEUE_SIZE = 2
_messageQueue = None
_messageHandler = None
_MAX_BUFFER_SIZ... |
datasets.py | # Dataset utils and dataloaders
import glob
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch... |
scheduler.py | import logging
import os
import signal
import time
import traceback
from datetime import datetime
from enum import Enum
from multiprocessing import Process
from redis import SSLConnection, UnixDomainSocketConnection
from .defaults import DEFAULT_LOGGING_DATE_FORMAT, DEFAULT_LOGGING_FORMAT
from .job import Job
from .l... |
__main__.py | from __future__ import division, unicode_literals, print_function, absolute_import # Ease the transition to Python 3
import os
import labscript_utils.excepthook
try:
from labscript_utils import check_version
except ImportError:
raise ImportError('Require labscript_utils > 2.1.0')
check_version('labscript_ut... |
tc_ui0.py | #-*- coding:utf-8 -*-
import tkinter as tk
from tkinter import ttk
import tkinter.filedialog as tkf
import tkinter.messagebox as tkm
import time
import threading
import os
def func_thrd_ExecuteCommand():
time.sleep(0.01)
text.delete(0.0,tk.END)
def handle_Input(event):
if event.keycode==13: ... |
runner.py | import multiprocessing
from ..runner_wrapper import RunnerWrapper
class ProcessRunner(RunnerWrapper):
""" Process Runner Wrapper """
def start(self):
""" Starts runner process """
if self.is_running():
raise RuntimeError("Can't start an already-running runner")
self.runn... |
player.py | import pygame
import threading
import pickle
from pathlib import Path
from .gameobject import Player, Action, Weapon
from .base_game import Observation, Cell
class RemotePlayer(Player):
def __init__(self, s, *args, **kwargs):
super().__init__(*args, **kwargs)
self.s = s
self.args_kwargs = ... |
AstroLauncher.py | import argparse
import asyncio
import atexit
import ctypes
import dataclasses
import json
import os
import secrets
import shutil
import signal
import socket
import subprocess
import sys
import time
import zipfile
from distutils import dir_util
from threading import Thread
import psutil
from packaging import version
fr... |
c3po.py | # -*- coding: utf-8 -*-
# Copyright 2015-2021 CERN
#
# 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 a... |
player.py | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merg... |
mem.py | #!/usr/bin/python3
import multiprocessing
def worker():
a = []
while True:
i = 1
a.append(i)
for i in range(12):
p = multiprocessing.Process(target=worker)
p.start()
p.join()
print("Exit")
|
test_client_multi.py | import sys
import pytest
import ray
@pytest.mark.skipif(
sys.platform == "win32",
reason="PSUtil does not work the same on windows.")
@pytest.mark.parametrize(
"call_ray_start",
["ray start --head --ray-client-server-port 25001 --port 0"],
indirect=True)
def test_multi_cli_basic(call_ray_start):
... |
session.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... |
logcat.py | import subprocess
import logging
from .adapter import Adapter
class Logcat(Adapter):
"""
A connection with the target device through logcat.
"""
def __init__(self, device=None):
"""
initialize logcat connection
:param device: a Device instance
"""
self.logger =... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def home():
return "My existence depends on pings!"
def run():
app.run(host='0.0.0.0', port=8080)
def keep_alive():
t = Thread(target=run)
t.start() |
render_environment.py | #!usr/env/bin/python
import rospy
import time
import random
import tf
import numpy as np
from threading import Thread
from visualization_msgs.msg import *
from simulation.msg import *
from simulation.srv import *
from geometry_msgs.msg import Point
rospy.init_node("Render")
rviz = rospy.Publisher("visualization_msg... |
utils.py | # Copyright (c) 2019 Rackspace US, 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... |
core.py | # -*- coding: utf-8 -*-
import os, sys, typing, threading
import tkinter as tk
from cefpython3 import cefpython as cef
from .assets import base_icon_file, base_js_file
class BrowserAPI:
"""
BrowserAPI base class
func execute_javascript: execute javascript code in webview
func execute_function: execut... |
test_closing.py | from fixtures import * # noqa: F401,F403
from lightning import RpcError
from utils import only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, VALGRIND, SLOW_MACHINE
import queue
import pytest
import re
import threading
import unittest
@unittest.skipIf(not DEVELOPER, "Too slow without --dev-bitcoind-poll")
de... |
_task_commons.py | import json
import logging
import os
import re
import sys
from typing import List, Tuple, Dict, Optional
import cloudpickle
import skein
import tensorflow as tf
from tf_yarn import event, cluster, Experiment, constants
from tf_yarn._internal import MonitoredThread, iter_tasks
_logger = logging.getLogger(__name__)
... |
pyterm.py | #!/usr/bin/env python3
"""Simple Python serial terminal
"""
# Copyright (c) 2010-2020, Emmanuel Blot <emmanuel.blot@free.fr>
# Copyright (c) 2016, Emmanuel Bouaziz <ebouaziz@free.fr>
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#pylint: disable-msg=too-many-instance-attributes
#pylint: disable-ms... |
event.py | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
import threading
import time
event=threading.Event()
def func():
#等待事件,进入等待阻塞状态
print'%s wait for event...'%threading.currentThread().getName()
event.wait()
#收到事件后进入运行状态
print'%s recv event.'% threading.currentThread().getName()
t1=threading.Thread(t... |
mrun.py | #!/usr/bin/env python
import mesos.native
import mesos.interface
from mesos.interface import mesos_pb2
import os
import logging
import re
import sys
import time
import math
import threading
import socket
import time
import tempfile
from optparse import OptionParser
from subprocess import *
def printOutput(p):
for... |
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=8000)
def keep_alive():
t = Thread(target=run)
t.start() |
__init__.py | import contextlib
import datetime
import errno
import functools
import inspect
import os
import pickle
import re
import signal
import socket
import subprocess
import sys
import tempfile
import threading
from collections import namedtuple
from enum import Enum
from warnings import warn
import six
import yaml
from dagst... |
window.py | # -*- coding: utf-8 -*-
"""
Display window properties (i.e. title, class, instance).
Configuration parameters:
cache_timeout: refresh interval for i3-msg or swaymsg (default 0.5)
format: display format for this module (default "{title}")
hide_title: hide title on containers with window title (default False... |
worker_keep_alive_test.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 VNG Corporation
#
# 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... |
ivis_data.py | """
Contains samples of IVIS requests and responses used for testing the IVIS interface
"""
SAMPLE_JOB_ID = "job1"
SAMPLE_JOB_INTERVAL = 10
SAMPLE_JOB_PARAMETERS = '''
[
{
"id": "sigSet",
"label": "Signal Set",
"type": "signalSet"
},
{
"id": "ts_signal",
"label": "TS signal",
... |
content_bruter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import urllib
import threading
import Queue
threads = 5
target_url = "http://testphp.vulnweb.com"
wordlist_file = "/tmp/all.txt" # SVNDiggerから
resume = None
user_agent = "Mozilla/5.0 (X11; Linux x86_64; rv:19.0) Gecko/20100101 Firefox... |
client.py | #-----------------Boilerplate Code Start-----------
import socket
from tkinter import *
from threading import Thread
import random
from PIL import ImageTk, Image
screen_width = None
screen_height = None
SERVER = None
PORT = None
IP_ADDRESS = None
playerName = None
canvas1 = None
canvas2 = None
nameEntry = None
na... |
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 namedtuple, OrderedDict
import os
import pickle
import platform
import random
import re
import subprocess
import sys
import sysconfig
import textw... |
plugin_server.py | import argparse
import threading
import multiprocessing
import os
import psutil
import socket
import sys
import time
BASEPATH = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT = os.path.dirname(BASEPATH)
sys.path.append(PROJECT_ROOT)
import actions.sniffer
import engine
from plugins.plugin import Plugin
cl... |
run_multiprocess.py | import os
import argparse
import subprocess
import multiprocessing
parser = argparse.ArgumentParser()
parser.add_argument("-n", type=int, help="number of processes")
args = parser.parse_args()
root = "/mnt/data1/chengdi/nb201/"
cmds = []
for i in range(15625):
cmds.append("python3 dse_p.py -m {} -i ./cifar10.json... |
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 __future__ import with_statement
import sys
import time
import random
import unittest
from test import test_support
try:
import thread
import threading
excep... |
node.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ____________developed by paco andres____________________
# ________in collaboration with cristian vazquez _________
import os
import time
from node.libs import config, control, utils, uriresolver
from multiprocessing import Process, Pipe, Queue
import threading
import t... |
jumpcutter_gui_threaded.py | import PySimpleGUI as sg
import subprocess
import sys
import threading
print(sg.version)
help_text = \
"""
Jumpcutter GUI
This is a front-end GUI for a command line tool named jumpcutter.
jumpcutter is a command line based tool written by Carykh. You'll find the repo here:
... |
conftest.py | import pathlib
import sys
from multiprocessing import Process
import docker
import pytest
from testcontainers.compose import DockerCompose
from .pact_provider import run_server
@pytest.fixture(scope="module")
def server():
proc = Process(target=run_server, args=(), daemon=True)
proc.start()
yield proc
... |
StandUI.py | # Software configuration
from library import config as sw_cfg
# LED status widget
from library.stand.led import LedWidget
# Suspending execution of the polling thread for the given number of seconds
from time import sleep
# Getting all possible combinations from the list
from itertools import combinations
# Foreign C ... |
usb_camera_demo.py | # -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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
#
# Unles... |
app.py | from flask import Flask, render_template, flash, redirect, url_for, session, request, logging
#from data import Articles
from flask_mysqldb import MySQL
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from functools import wraps
import qrcode
import smtplib
import mimetypes
from datetim... |
amsg_srv.py | #!env/bin/python3
import parser
import sys
import socket
import signal
import threading
import time
import argparse
import sqlite3
import rsa
class server:
def __init__(self,ip='localhost',port='9999'):
self.clients = {}
self.recv_value = 0
self.name = input("Enter you username for session... |
email.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
# send mail function
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_obj... |
connection_test.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Yiwen Sun and Ziyou Zhang"
__status__ = "Production"
import pytest
from pprint import pprint
from pymongo import MongoClient
from multiprocessing import Process
def test_connection():
with MongoClient(os.environ["CLIENT_ADDR"]) as client:
... |
managers.py | #
# Module providing manager classes for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token',
'SharedMemoryManager' ]
#
# Imports
#
import sys... |
curses_menu.py | import curses
import os
import platform
import threading
class CursesMenu(object):
"""
A class that displays a menu and allows the user to select an option
:cvar CursesMenu cls.currently_active_menu: Class variable that holds the currently active menu or None if no menu\
is currently active (E.G. whe... |
utils.py | #!/usr/bin/env python
"""
General Utilities
(part of web.py)
"""
__all__ = [
"Storage", "storage", "storify",
"iters",
"rstrips", "lstrips", "strips",
"safeunicode", "safestr", "utf8",
"TimeoutError", "timelimit",
"Memoize", "memoize",
"re_compile", "re_subm",
"group",
"IterBetter", "iterbetter",
... |
test_util_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... |
battery.py | import psutil
from plyer.utils import platform
from plyer import notification
import time
import tkinter
from tkinter import messagebox
from tkinter import *
from tkinter import ttk
from threading import *
import os
import sys
# function to exit from the application when called
def quit_prog():
# sys.exit()
o... |
kickthemout.py | #!/usr/bin/env python3
# -.- coding: utf-8 -.-
# kickthemout.py
"""
Copyright (C) 2017-18 Nikolaos Kamarinakis (nikolaskam@gmail.com) & David Schütz (xdavid@protonmail.com)
See License at nikolaskama.me (https://nikolaskama.me/kickthemoutproject)
"""
import os, sys, logging, math, traceback, optparse, threading
from ... |
test_browser.py | import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
from runner import BrowserCore, path_from_root
from tools.shared import *
# User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to
# run using another browser command line tha... |
soal1.py | from fuzzy import command
from multiprocessing import Process,Pipe
import random
import time
def SensorDepan(depan):
Jdepan = random.randrange(1,100)
depan.send(Jdepan)
print('Jarak depan mobil : ',Jdepan,' cm')
depan.close()
def SensorBelakang(belakang):
Jbelakang = random.randrange(1,100)
b... |
trash.py | # USAGE
# python webstreaming.py --ip 0.0.0.0 --port 8000
# source venv/bin/activate
# import the necessary packages
from pyimagesearch.motion_detection import SingleMotionDetector
from imutils.video import VideoStream
from flask import Response
from flask import Flask
from flask import render_template
impor... |
liqui.py | from restful_api_socket import RESTfulApiSocket
from exchanges.gateway import ExchangeGateway
from market_data import L2Depth, Trade
from util import Logger
from instrument import Instrument
from clients.sql_template import SqlClientTemplate
from functools import partial
from datetime import datetime
from threading imp... |
test_executors.py | import multiprocessing
import time
from datetime import timedelta
from unittest.mock import MagicMock
import pytest
import prefect
from prefect.utilities.executors import (
Heartbeat,
main_thread_timeout,
multiprocessing_timeout,
)
def test_heartbeat_calls_function_on_interval():
class A:
de... |
storage.py | # -*- coding:utf-8 -*-
from threading import Thread
import socket
import random
import urlparse
from django.core.files import base
from django.core.files.storage import Storage, FileSystemStorage
from django.conf import settings
from django_dust import http
from django_dust.settings import getsetting
class Distribu... |
__init__.py | # -*- coding: utf-8 -*-
'''
napalm-logs utilities
'''
from __future__ import absolute_import
from __future__ import unicode_literals
# Import pythond stdlib
import re
import ssl
import copy
import time
import socket
import logging
import threading
import collections
from pydoc import locate
from datetime import dateti... |
test_worker.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import json
import os
import psutil
import shutil
import signal
import subprocess
import sys
import time
import zlib
from datetime import datetime, timedelta, timezone
from multiprocess... |
API.py | from RAT import *
from Core.Settings.Organization import *
from Core.Settings.Antivirus import *
from Core.Settings.Admin import *
from Core.Settings.CriticalProcess import *
from Core.Settings.MessageBox import *
from Core.Network.Information import *
f... |
platform.py | import logging
import os
import re
import shlex
import subprocess
import sys
import threading
logger = logging.getLogger('textpipes')
MULTISPACE_RE = re.compile(r'\s+')
# built-in resource classes:
# make_immediately, default, short
# other suggestions:
# gpu, gpushort, multicore, bigmem, long
def make_override_str... |
host_test_default.py | # Copyright (c) 2018, Arm Limited and affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# ... |
combo_generator.py | """
@author: Min Du (midu@paloaltonetworks.com)
Copyright (c) 2021 Palo Alto Networks
"""
import os
import csv
import time
import math
import random
import logging
import multiprocessing
import numpy as np
from utils import misc
from utils import const
from utils.config_parser import CommonConfig
class ComboGenera... |
refactor.py | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Refactoring framework.
Used jako a main program, this can refactor any number of files and/or
recursively descend down directories. Imported jako a module, this
provides infrastructure to write your own refactoring... |
FlaskMain.py | #!/usr/bin/python
import math
import threading
import os
import subprocess
import time
import datetime
import sys
import logging
from flask import Flask, render_template, redirect, url_for, request, send_from_directory, session
import BokehGraphCreator as GraphCreater
sys.path.append('../Tools/')
import ScaleInfoRea... |
test_telnetlib.py | import socket
import select
import telnetlib
import time
import contextlib
import unittest
from unittest import TestCase
from test import support
threading = support.import_module('threading')
HOST = support.HOST
def server(evt, serv):
serv.listen(5)
evt.set()
try:
conn, addr = serv.accept()
... |
realsense.py | import numpy as np
import time
import cv2
import pyrealsense2 as rs
import random
import math
import argparse
from threading import Thread
from matplotlib import pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from mpl_toolkits.mplot3d import proj3d
from mpl_toolkits.mplot3d import Axes3D
fr... |
init_ppo.py | #!/usr/bin/env python3
import numpy as np
import tensorflow as tf
import threading, time
from threading import Thread, Lock
from wrappers.doom import Sandbox
from agent import AsynchronousAgent
from networks import actor_critic_ppo
from utils import load_config, log_feedback
# -----------------------------
physica... |
t.py | # -*- coding: utf-8 -*-
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
from bs4 import BeautifulSoup
from threading import Thread
from googletrans import Translator
from gtts import gTTS
import time,random,sys,json,codecs,threading,glob,urllib,urllib2,urllib3,re,ast,os,subprocess,r... |
base_camera.py | import time
import threading
import os
try:
from greenlet import getcurrent as get_ident
except ImportError:
try:
from thread import get_ident
except ImportError:
from _thread import get_ident
class CameraEvent(object):
"""An Event-like class that signals all active clients when a new... |
EasyNMT.py | import os
import torch
from .util import http_get, import_from_string
import json
from . import __DOWNLOAD_SERVER__
from typing import List, Union, Dict, FrozenSet, Set, Iterable
import numpy as np
import tqdm
import nltk
import torch.multiprocessing as mp
import queue
import math
import re
import logging
... |
do_lock.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time, threading
# 假定这是你的银行存款:
balance = 0
lock = threading.Lock()
def change_it(n):
# 先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance - n
def run_thread(n):
for i in range(100000):
# 先要获取锁:
lock.acquire()
... |
runner.py | import signal
import time
from threading import Thread
__all__ = ['Runner']
class Runner(object):
def __init__(self, conntracker, syncer, logger, **args):
self._conntracker = conntracker
self._syncer = syncer
self._logger = logger
self._args = args
self._done = False
... |
playsound.py | import logging
logger = logging.getLogger(__name__)
class PlaysoundException(Exception):
pass
def _canonicalizePath(path):
"""
Support passing in a pathlib.Path-like object by converting to str.
"""
import sys
if sys.version_info[0] >= 3:
return str(path)
else:
# On earlier... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.