source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
LockUsingWithStmt.py | from threading import Lock,Thread
''' We can also called as lock using context manager '''
''' The acquire() method will be called when the block is entered, and release()
will be called when the block is exited. '''
''' If you know the log management then you can use log instead of print statement '''
def lock... |
logicmodule.py | import json
from enum import Enum
from abc import ABCMeta, abstractmethod
from core.result.reporter import ResultReporter
from core.resource.pool import ResourcePool
from core.config.setting import static_setting, SettingBase
from threading import Thread
from importlib import import_module
import os
class ModuleType(... |
buffering.py | import multiprocessing as mp
import queue
import threading
def buffered_gen_mp(source_gen, buffer_size=2):
"""
Generator that runs a slow source generator in a separate process.
buffer_size: the maximal number of items to pre-generate (length of the buffer)
"""
if buffer_size < 2:
raise Ru... |
sync.py | import argparse
import datetime
import logging
import pathlib
import os
import shutil
import threading
import time
import requests
from cloud import api, helpers
log = logging.getLogger(__name__)
def _upload(files, email: str, password: str, jpeg_storage_path: str, processing_callback):
has_uploaded_images = Fa... |
ConvertToUTF8.py | # -*- coding: utf-8 -*-
import sublime, sublime_plugin
import sys
import os
if sys.version_info < (3, 0):
from chardet.universaldetector import UniversalDetector
NONE_COMMAND = (None, None, 0)
ST3 = False
else:
from .chardet.universaldetector import UniversalDetector
NONE_COMMAND = ('', None, 0)
ST3 = True
impor... |
video_processor.py | #! /usr/bin/env python3
# Copyright(c) 2017 Intel Corporation.
# License: MIT See LICENSE file in root directory.
# NPS
# pulls images from video device and places them in a Queue
# if the queue is full will start to skip video frames.
#import numpy as np
import cv2
import queue
import threading
import time
class v... |
alu.py |
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University
# ServerlessBench is licensed under the Mulan PSL v1.
# You can use this software according to the terms and conditions of the Mulan PSL v1.
# You may obtain a copy of Mulan PSL v1 at:
# http://license.coscl.org.cn/M... |
repository.py | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
import functools
import os
import re
import shutil
import subprocess
import zipfile
from argparse import ArgumentParser, Namespace, _SubParsersActio... |
process_class_01.py | from multiprocessing import Process
from time import sleep
from random import randint
def target_function() -> None:
print(f'Hi -> {randint(0, 100)}')
sleep(2)
if __name__ == '__main__':
process = Process(target=target_function)
process.start()
print('Process not joined')
|
test_grpc_server_registry.py | import sys
import threading
import time
import pytest
from dagster import file_relative_path, pipeline, repository
from dagster.core.errors import DagsterUserCodeProcessError
from dagster.core.host_representation.grpc_server_registry import ProcessGrpcServerRegistry
from dagster.core.host_representation.origin import ... |
controller.py | import numpy as np
import math
import time
import threading
class Controller_PID_Point2Point():
def __init__(self, get_state, get_time, actuate_motors, params, quad_identifier):
self.quad_identifier = quad_identifier
self.actuate_motors = actuate_motors
self.get_state = get_state
se... |
MimeSweeperMain.py | from PyQt5.QtCore import *
from PyQt5.QtWidgets import QMainWindow, QMessageBox, QApplication
from src.gui.main_create_gui import mimesweeper_main_create_gui, create_tiles
from src.mechanics.mechanics import generate_mimes, generate_clean_tiles, create_matrix
from src.classes.DifficultyDialog import DifficultyDialog
fr... |
AstroLauncher.py | import argparse
import asyncio
import atexit
import ctypes
import dataclasses
import os
import secrets
import shutil
import signal
import socket
import subprocess
import sys
import time
from subprocess import DEVNULL
from threading import Thread
import psutil
from watchdog.events import FileSystemEventHandler
from wat... |
core.py | #!/usr/bin/env python3
# Author:
# Romain Bentz (pixis - @hackanddo)
# Website:
# https://beta.hackndo.com
from multiprocessing import Process, RLock
from lsassy.modules.dumper import Dumper
from lsassy.modules.impacketconnection import ImpacketConnection
from lsassy.modules.logger import Logger
from lsassy.modules... |
multiple_windows.py | import webview
import threading
"""
This example demonstrates how to create and manage multiple windows
"""
def create_new_window():
# Create new window and store its uid
child_window = webview.create_window('Window #2', width=800, height=400)
# Load content into both windows
webview.load_html('<h1>M... |
rabbitmq.py | #!/usr/bin/env python3
#author markpurcell@ie.ibm.com
"""RabbitMQ helper class.
/*
* 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 th... |
MetricsRecorder.py | from common.modules.sensors.cpu.controllers.CPUSensor import CPUSensor
from common.modules.sensors.ram.controllers.RAMSensor import RAMSensor
from common.modules.sensors.battery.controllers.BatterySensor import BatterySensor
import threading
import time
class MetricsRecorder:
__cpu_sensor: CPUSensor
__ram_sens... |
verification.py | #!/usr/bin/python3
import os
import subprocess
import threading
import sys
import time
import re
import filecmp
import difflib
APPLICATION = "./tests/main"
APPLICATION_CODE = "./tests/main.cpp"
FILE_RUN_OUTPUT = "./tests/executed.txt"
FILE_DEBUG_OUTPUT = "./tests/debugged.txt"
# debug application and save gdb print ... |
SentenceTransformer.py | import json
import logging
import os
import shutil
import stat
from collections import OrderedDict
from typing import List, Dict, Tuple, Iterable, Type, Union, Callable, Optional
import requests
import numpy as np
from numpy import ndarray
import transformers
from huggingface_hub import HfApi, HfFolder, Repository, hf_... |
ui.py | import datetime
import threading
from json import (load as jsonload, dump as jsondump)
import PySimpleGUI as sg
from apscheduler.schedulers.background import BlockingScheduler
from szu_autoconnect.core.auto import Connector
SETTINGS_FILE = 'settings.cfg'
DEFAULT_SETTINGS = {
'username': '',
'password': '',
... |
run.py | import yaml
import os
import sys
import time
import threading
from http.server import SimpleHTTPRequestHandler
import socketserver
from letsencrypt import main as cli
cwd = os.getcwd()
logs = cwd+"/logs"
conf = cwd+"/conf"
work = cwd+"/work"
host = cwd+"/host"
port = int(os.getenv('PORT', '5000'))
# Before we switc... |
service.py | # Copyright (c) 2010-2013 OpenStack, LLC.
#
# 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 ... |
merge.py | #!/usr/bin/python
import os
import cli.app
import cli.log
import logging
import re
from math import floor
from multiprocessing import Pool, Process, cpu_count
from time import sleep
from os import walk
from os import path
from zipfile import ZipFile
from shutil import copy2
from natsort import natsorted
from reportlab... |
archiver.py | import argparse
import errno
import io
import json
import logging
import os
import pstats
import random
import re
import shutil
import socket
import stat
import subprocess
import sys
import tempfile
import time
import unittest
from binascii import unhexlify, b2a_base64
from configparser import ConfigParser
from datetim... |
generator_stress_test.py | from logging import getLogger
from dataclasses import dataclass, field
from datetime import datetime
from drivebuildclient.AIExchangeService import AIExchangeService
from drivebuildclient.aiExchangeMessages_pb2 import SimulationID
from drivebuildclient import static_vars
from pathlib import Path
from typing import Any... |
webauthn.py | """
Copyright 2018-present SYNETIS.
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, s... |
tcp_server.py | #!/usr/bin/env python3
import argparse
import sys
import socket
import threading
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-b', '--bind', type=str, dest='bind', default='0.0.0.0', help='bind address')
parser.add_argument('-p', '--port', type=int, des... |
required.py | # required.py
#
# Design and Program: Vishav Singh
# Manuel Gonzales
#
#
# functions:
#
# def pass_decode(cipher, key)
# def sniffer(listen, dst, pwd, key, num)
# def parse(pkt, pwd, port, key, num)
# def split_every(n, s)
# def send_message(ip_address, port, protocol, message)
# def mai... |
httpd.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2019 Miroslav Stampar (@stamparm)
See the file 'LICENSE' for copying permission
"""
import BaseHTTPServer
import cStringIO
import datetime
import httplib
import glob
import gzip
import hashlib
import io
import json
import mimetypes
import os
import re
import socket
import ... |
panda.py | # Copyright European Organization for Nuclear Research (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
#
# Authors:
# - Ralph ... |
test_closing.py | from fixtures import * # noqa: F401,F403
from flaky import flaky
from lightning import RpcError
from utils import only_one, sync_blockheight, wait_for, DEVELOPER, TIMEOUT, VALGRIND, SLOW_MACHINE, COMPAT
import os
import queue
import pytest
import re
import threading
import unittest
@unittest.skipIf(not DEVELOPER, "... |
qzone_api.py | import os
import pickle
import threading
from typing import Optional
import aiohttp
from loguru import logger
from nonebot import CommandSession, get_bot
from . import sim_login
config = get_bot().config
get_relative_path = lambda p: os.path.join(os.path.dirname(__file__), p)
_login_thread_lock: Optional[threading.... |
boards.py | import threading
import serial
import time
class Duino(object):
def __init__(self, parent=None):
self.onMsg = None
def connect(self, port):
self._exit = False
self.ser = serial.Serial()
try:
self.ser.port = port
self.ser.baudrate = 115200
... |
taskQueue.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from threading import Thread
import Queue
import time
import sys
import signal
class TaskQueue():
def __init__(self, num_workers = 1):
self.is_exit = False
self.queue = Queue.Queue(0)
self.num_workers = num_workers
self.workers = []
self.start_wor... |
installwizard.py |
import os
import sys
import threading
import traceback
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from electrum import Wallet, WalletStorage
from electrum.util import UserCancelled, InvalidPassword
from electrum.base_wizard import BaseWizard
from electrum.i18n import _
from .... |
tutorial_remotesensing.py | """
mss.tutorials.tutorial_remotesensing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This python script generates an automatic demonstration of how to work with remote sensing tool in topview.
This file is part of mss.
:copyright: Copyright 2021 Hrithik Kumar Verma
:copyright: Copyright 2021 by the m... |
lisp.py | # -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.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... |
myplex.py | # -*- coding: utf-8 -*-
import copy
import threading
import time
from typing import List
from xml.etree import ElementTree
import requests
from plexapi import (BASE_HEADERS, CONFIG, TIMEOUT, X_PLEX_ENABLE_FAST_CONNECT,
X_PLEX_IDENTIFIER, log, logfilter, utils)
from plexapi.base import PlexObject
f... |
CommandManager.py | # coding:utf-8
def start_Manager(self,url_q,result_q):
'''
创建一个分布式管理器
:param url_q:url 队列
:param result_q: 结果队列
:return:
'''
# 把创建的两个队列注册在网络上,利用register方法,callable参数关联了Queue对象,
# 将Queue对象在网络中暴露
BaseManager.register('get_task_queue',callable = lambda:url_q)
BaseManager.register('get_result_queue',callable = l... |
websocket.py |
import logging
log = logging.getLogger(__name__)
import threading
import uuid
from tornado import websocket, ioloop
from tornado.web import Application
from tornado.httpserver import HTTPServer
from bokeh import protocol
from .wsmanager import WebSocketManager
from .zmqsub import Subscriber
class WebSocketHandler... |
base_historian.py | # -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2017, Battelle Memorial Institute.
#
# 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... |
rnode.py | import os
import logging
import re
from contextlib import contextmanager
from rnode_testing.docker import docker_network
import rnode_testing.resources as resources
from rnode_testing.util import log_box, make_tempfile, make_tempdir
from rnode_testing.wait import wait_for, node_started
import shlex
from multiprocessin... |
shell.py | """
Scrapy Shell
See documentation in docs/topics/shell.rst
"""
from threading import Thread
from scrapy.command import ScrapyCommand
from scrapy.shell import Shell
from scrapy import log
class Command(ScrapyCommand):
requires_project = False
default_settings = {'KEEP_ALIVE': True, 'LOGSTATS_INTERVAL': 0}
... |
__init__.py | """Playback sounds or check input volume."""
import logging
import numpy as np
import os
import queue
import sounddevice as sd
import soundfile as sf
import threading
__version__ = '0.2.1'
_DTYPE = 'float32' # float32 is highly recommended
_BLOCKTIMEFRAC = 20 # 48000 / 20 = 2400 -> results in blocksize = 4096
_MA... |
train_test.py | import neptune.new as neptune
import os
import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.optim import SGD, Adam
from torch.utils.data import DataLoader, random_split
from torch.optim.lr_scheduler import CyclicLR
import torch.multiprocessing as mp
import numpy as np
import random
import math... |
uplink_bridge.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... |
snowball_uploader_26-success.py | '''
status: completed
version: v26
way: using multi-part uploading
ref: https://gist.github.com/teasherm/bb73f21ed2f3b46bc1c2ca48ec2c1cf5
changelog:
- 2021.02.20
- save filelist_dir as filelist-currentdata.gz when executing genlist
- 2021.02.20
- performance improvement of genlist; dumping file list, not ea... |
parallel_loop.py | # Copyright (c) 2016-2019 Renata Hodovan, Akos Kiss.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
import logging
import multiprocessing
import os
import signal
impo... |
train.py | from img_utils import *
#from unet import *
from fcn import *
from progressbar import ProgressBar
from PIL import Image
import cv2
import torch
import os
import time
import glob
import numpy as np
np.random.seed(0)
batch_size = 32
model = Model()
device = torch.device("cuda:0" if torch.cuda.is_available()
... |
SPOR_BASIC_5.py | # !/usr/bin/env python3
import sys
import os
import time
import subprocess
from itertools import product
from threading import Thread
import TEST
import TEST_FIO
import TEST_LIB
import TEST_LOG
import TEST_SETUP_IBOFOS
volumes = [1]
current_test = 0
run_time = 10
###################################################... |
CountyExtended.py | import pandas as pd
import numpy as np
import numpy.matlib as npm
import scipy.optimize
import matplotlib.pyplot as plt
from matplotlib import cm
import os
# import pyDOE
from timeit import default_timer as timer
from datetime import timedelta
import multiprocessing
from core.MCMCPosteriorSamplingFunction import MCMC... |
application.py | #SPDX-License-Identifier: MIT
"""
Handles global context, I/O, and configuration
"""
import os
import time
import logging
import multiprocessing as mp
import json
import pkgutil
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from sqlalchemy import create_engine
from sqlalchemy... |
upload_api-v2.py | # coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os, json, time, sys, thread
import argparse
import unicodedata
import shutil
import subprocess
import threading
# import dlib
import math
import time
import os.path
import Queue
from threa... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
db_update.py | """
--- Reference
Full Stack Trading app https://hackingthemarkets.com/full-stack-trading-app-tutorial-part-01-database-design/
Alpaca Tutorial https://www.youtube.com/watch?v=GsGeLHTOGAg
-- Downloads
SQLite Tools https://sqlite.org/download.html
SQL Browser https://sqlitebrowser.org/
Alpaca API: pip3 install symbol... |
lab12_e.py | from sys import setrecursionlimit
import threading
setrecursionlimit(10 ** 9)
threading.stack_size(3 * 67108864)
def main():
def cover(vertex):
nonlocal set_tree
if set_tree[vertex]: return set_tree[vertex]
leaf_len, deep_leaf_len = 0, 0
for ver in leaf[vertex]: leaf_len += cover(ve... |
picamera3.py | #!/usr/bin/python3
#
# Copyright (C) 2016 by meigrafd (meiraspi@gmail.com) published under the MIT License
# v1.0
#
# display picamera stream on Tkinter. lowest streaming latency
#
# Pillow.ImageTk for python3: apt-get install python3-pil.imagetk
#
from picamera.array import PiRGBArray
from PIL import Image, ImageTk
f... |
trezor.py | import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
from electrum import constants... |
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... |
xla_client_test.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... |
sync.py | # -*- coding: utf-8 -*-
"""
This module contains the main syncing functionality.
"""
# system imports
import os
import os.path as osp
from stat import S_ISDIR
import resource
import logging
import time
import tempfile
import random
from threading import Thread, Event, RLock, current_thread
from concurrent.futures im... |
test_queue.py | # Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import itertools
import random
import threading
import time
import unittest
import weakref
from test import support
py_queue = support.import_fresh_module('queue', blocked=['_queue'])
c_queue = support.... |
test_jobmanager.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import time
import multiprocessing as mp
from multiprocessing.managers import BaseManager
import socket
import signal
import logging
import datetime
import threading
from numpy import random
import pytest
import shutil
import pathlib
sys.path.insert(0,... |
mtqueue.py | """
Easy-Job worker based on python multithreading and Queue
This backend doesn't have any configuration option
"""
from easy_job.workers.common import call_with_retry, empty_callback
from . import BaseInitializer, BaseRunner
import logging
from queue import Empty
import os
import time
from easy_job.workers.mixins imp... |
server.py | import socket
import threading
import subprocess
import sys
from functions import handler
# --- OpenCV Detection process ---
subprocess.Popen([sys.executable,"./Object_detection_picamera.py"], cwd="./tensorflow1/models/research/object_detection")
HEADER = 64
# Choose a port
PORT = 5050
FORMAT = 'utf-8'
DISCONNEC... |
app.py | """TODO"""
import random
from collections import namedtuple
from threading import Thread, Event, Timer, RLock
import attr
from src.bater.validators import is_percentage, is_positive
@attr.s
class App:
"""TODO"""
min_threshold = attr.ib(
default=50, validator=[attr.validators.instance_of(int), is_pe... |
ntlmrelayx.py | #!/usr/bin/env python
# SECUREAUTH LABS. Copyright 2018 SecureAuth Corporation. All rights reserved.
#
# This software is provided under under a slightly modified version
# of the Apache Software License. See the accompanying LICENSE file
# for more information.
#
# Generic NTLM Relay Module
#
# Authors:
# Alberto Sol... |
ABridge.py | import time
from . import ABridgeAdapter as ab
import threading
import json
from pydispatch import dispatcher
from random import randrange
class ABridge(object):
VERSION = '1.0.4'
MAX_CONNECT_RETRIES = 1000000
SIGNAL_INDEX_READY = 1
SIGNAL_LANE_READY = 2
SIGNAL_DATA_READY = 3
SIGNAL_STOP = 4
... |
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):
#app.app_context创建程序上下文,mail.send函数实现要在上下文中
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = ... |
server.py | import socket
import threading
HEADER = 64
PORT = 5050
SERVER = socket.gethostbyname(socket.gethostname())
ADDR = (SERVER, PORT)
FORMAT = "utf-8"
DISCONNECT_MESSAGE = "CONNECTION SUCCESSFULLY TERMINATED!!! run the program again to reconnect..."
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ser... |
test_cuda.py | from itertools import repeat, chain, product
from typing import NamedTuple
import collections
import gc
import io
import os
import pickle
import queue
import sys
import tempfile
import threading
import unittest
import torch
import torch.cuda
import torch.cuda.comm as comm
from torch import multiprocessing as mp
from t... |
limit_.py | # License: MIT
import sys
import dill
import time
import psutil
from collections import namedtuple
from multiprocessing import Process, freeze_support, Pipe
class SignalException(Exception):
pass
class TimeoutException(Exception):
pass
class OutOfMemoryLimitException(Exception):
pass
def get_platfo... |
multiproc.py | import os,sys
from multiprocessing import Process, JoinableQueue, Queue
def worker(inQueue, outQueue, task):
for data in iter(inQueue.get,'stop'):
result = task(data)
if result != None:
outQueue.put( result )
else:
outQueue.put('Ignore')
inQueue.task_done()
inQueue.task_done()
return ... |
example.py | import time
import multiprocessing
square_result = []
def calc_square(numbers):
for n in numbers:
square_result.append(n*n)
print 'Result within process: ', square_result
if __name__ == '__main__':
arr = [1, 2, 3]
p1 = multiprocessing.Process(target=calc_square, args=(arr,))
p1.start()
... |
poke_env_new_copg.py | import asyncio
import numpy as np
from tabulate import tabulate
from threading import Thread
from poke_env.utils import to_id_str
from poke_env.player.env_player import (
Gen8EnvSinglePlayer,
)
from poke_env.player.utils import cross_evaluate
from poke_env.teambuilder.constant_teambuilder import ConstantTeambuilde... |
httpserver3.py | #!/usr/bin/env python3
"""A simple HTTP server with REST and json for python 3.
addrecord takes utf8-encoded URL parameters
getrecord returns utf8-encoded json.
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import argparse
import re
import cgi
import json
import threading
import asyncio
import time
f... |
recorder.py | import numpy as np
import pyaudio
import threading
from estimate_bpm import BPM_Analyzer
import librosa
class InputRecorder:
"""Simple, cross-platform class to record from the default input device."""
def __init__(self):
self.RATE = 44100
self.BUFFERSIZE = 2**12
self.secToRecord =... |
RCTAcquisition.py | # The Leginon software is Copyright 2004
# The Scripps Research Institute, La Jolla, CA
# For terms of the license agreement
# see http://ami.scripps.edu/software/leginon-license
#
import threading
import wx
from leginon.gui.wx.Choice import Choice
from leginon.gui.wx.Entry import Entry, FloatEntry, IntEntry, EVT_ENT... |
test_execute.py | # coding: utf-8
import collections.abc as collections_abc
from contextlib import contextmanager
from contextlib import nullcontext
from io import StringIO
import re
import threading
from unittest.mock import call
from unittest.mock import Mock
from unittest.mock import patch
import weakref
import sqlalchemy as tsa
fr... |
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... |
blink.py | import requests
import socket
import threading
import logging
import subprocess
import video
#import mraa
import variable
# change this to the values from MCS web console
# change 'INFO' to 'WARNING' to filter info messages
logging.basicConfig(level='INFO')
heartBeatTask = None
def establishCommandChannel():
# Q... |
createusers.py | import csv
import logging
import math
import multiprocessing
import os
import random
import sys
import faker
from couchers.crypto import hash_password
from couchers.db import session_scope
from couchers.models import User
from couchers.servicers.api import hostingstatus2sql
from couchers.utils import create_coordinat... |
Hiwin_RT605_ArmCommand_Socket_20190627183752.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... |
client.py | import socket
import threading
import tkinter
import tkinter.scrolledtext
from tkinter import simpledialog
HOST = "127.0.0.1"
PORT = 9090
class Client:
def __init__(self, host, port):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.connect((host, port))
msg = tki... |
test_commands.py | import time
from multiprocessing import Process
from tests import RQTestCase
from tests.fixtures import long_running_job
from rq import Queue, Worker
from rq.command import send_command, send_kill_horse_command, send_shutdown_command, send_stop_job_command
from rq.exceptions import InvalidJobOperation, NoSuchJobErro... |
rfid_reader_async.py | """
The MIT License (MIT)
Copyright (c) 2016 Jake Lussier (Stanford University)
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... |
MetaboliteAtlasServer.py | #!/usr/bin/env python
from wsgiref.simple_server import make_server
import sys, json, traceback
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, log, ServerError, ParseError, InvalidRequestError
from os ... |
_server.py | # Copyright 2016 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... |
app.py | import webbrowser,time,_thread
from flask import Flask,request,render_template
def web_view(port):
webbrowser.open('http://127.0.0.1:'+str(port))
def run(port,app):
app.run(port=port)
data = eval(open('config.json','r').read())
app = Flask(__name__)
#@app.route('/ckeditor/build/<file>')
#def aaaa(file):
#... |
cache.py | import time
import threading
from django.conf import settings
from django.core.cache import cache
from djutils.cache import key_from_args, cached_filter, CachedNode
from djutils.test import TestCase
from djutils.tests.cache_backend import CacheClass
class CacheUtilsTestCase(TestCase):
def setUp(self):
c... |
w2l_service.py | #!/usr/bin/env python3.6
# Common Imports
import rospy
import roslib
from harmoni_common_lib.constants import State
from harmoni_common_lib.service_server import HarmoniServiceServer
from harmoni_common_lib.service_manager import HarmoniServiceManager
import harmoni_common_lib.helper_functions as hf
# Specific Impor... |
dataframe_viewer.py | import sys
import threading
import os
import numpy as np
import pandas as pd
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from pandasgui.store import Store, PandasGuiDataFrame
import pandasgui
import logging
logger = logging.getLogger(__name__)
class DataFrameViewer(QtWidgets.QWidget):
... |
views.py | """Defines a number of routes/views for the flask app."""
from argparse import ArgumentParser, Namespace
from functools import wraps
import io
import os
import sys
import shutil
from tempfile import TemporaryDirectory, NamedTemporaryFile
import time
from typing import Callable, List, Tuple
import multiprocessing as mp... |
pqcom.py | #!/usr/bin/env python
"""
+------------------------------------------------------------------+
| pq pqcom - + x |
+------------------------------------------------------------------+
| + | > | = | H | X | i | |
+----------------... |
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... |
robot_host_gazebo.py | #!/usr/bin/python3
import math
import rospy
import rostopic
import rosnode
import copy
import threading
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import TwistStamped
from sensor_msgs.msg import LaserScan
from nics_robot_host.srv import *
from rospy.core import rospyinfo
class RobotHostGazebo(ob... |
irc.py | # coding=utf-8
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import sys
import re
import time
import socket
import asyncore
import asynchat
import os
import codecs
import traceback
from sopel.logger import get_logger
from sopel.tools import stderr... |
_uti_basic.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#############################################################################
import time
now = time.time
import smtplib, ssl
from multiprocessing import Pool
import multiprocessing
n_cores = multiprocessing.cpu_count()
####################################################... |
exp_synthetic_instances_D2.py | import main
import generate_yaml
import math
from multiprocessing import Process
import time
def convert_params_to_string(dimension_simplex,
dimension_space,
degree,
N,
simplextype,
... |
worker.py | """
Module for executing tasks in separate thread.
"""
try:
from queue import Queue
except:
# ST2, Python 2
from Queue import Queue
import threading
import traceback
class Worker:
"""
Worker to execute tasks.
"""
def __init__(self):
self.q = Queue()
self.running = False
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.