source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... |
__init__.py | """
objectstore package, abstraction for storing blobs of data for use in Galaxy.
all providers ensure that data can be accessed on the filesystem for running
tools
"""
import logging
import os
import random
import shutil
import threading
import time
from collections import OrderedDict
from xml.etree import ElementTr... |
main.py | from subscribe import subscribe
from publish import publish
from time import sleep
import threading
from trafficlight import blink_red, blink_green, blink_amber
broker = "test.mosquitto.org"
topic = "trafficlight/bradford"
try:
# subscribe to the topic
thr = threading.Thread(target=subscribe, args=(broker, to... |
connect_manager.py | import os
import sys
import socket
import operator
import time
import threading
import struct
if __name__ == '__main__':
current_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.abspath(os.path.join(current_path, os.pardir))
python_path = os.path.join(root_path, 'python27', '1.0')
... |
threadpool.py | import asyncio
import logging
import threading
import time
from queue import Queue
from mmpy_bot.scheduler import default_scheduler
from mmpy_bot.webhook_server import WebHookServer
log = logging.getLogger("mmpy.threadpool")
class ThreadPool(object):
def __init__(self, num_workers: int):
"""Threadpool c... |
clear.py | # -*- coding: utf-8 -*-
import PySimpleGUI as sg
import time
import asyncio
import sqlite3
import threading
import queue
import logging
import os
import json
import aiohttp
import random
import sys
import xlsxwriter #导入模块
g_all_num = 0
g_related_uid_list = []
delay = 0.8
g_total_num = 0
g_stop = F... |
test_sys.py | # -*- coding: iso-8859-1 -*-
import unittest, test.support
import sys, io, os
import struct
import subprocess
import textwrap
# count the number of test runs, used to create unique
# strings to intern in test_intern()
numruns = 0
class SysModuleTest(unittest.TestCase):
def setUp(self):
self.orig_stdout ... |
myThreadLocal.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Author:Winston.Wang
import threading
#print(dir(threading))
thread_local = threading.local()
def process_student():
std = thread_local.student
print('Hello,%s(in %s)' % (std,threading.current_thread().name))
def add_local(name):
thread_local.student = name
process_stu... |
thread_pool.py | #!/usr/bin/env python
#coding:utf-8
"""
Author: --<v1ll4n>
Purpose: Provide some useful thread utils
Created: 2016/10/29
"""
import unittest
#import multiprocessing
from pprint import pprint
from time import sleep
try:
from Queue import Full, Empty, Queue
except:
from queue import Full, ... |
main.py | from flask import Flask, render_template, session, request, make_response, json, jsonify, url_for
from flask_socketio import SocketIO, emit, join_room, leave_room,close_room, rooms, disconnect
import glob
# import json
import math
import numpy as np
import os
import pyaudio
from random import randint
from threading imp... |
js_env.py | import re
import os
import shlex
import subprocess
import datetime
import configparser
import argparse
from glob import glob
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from flask import Flask
from threading import Thread
def which(program):
"""
This function is... |
telemetry.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
core.py | from messagebus import Bus
from configbus import Config
from threading import Thread
import subprocess
import time
# start jobs
class JobHandler(object):
def __init__(self, job):
self.job_name = job[:-3]
self.command = ['python', '{}'.format(job)]
self.job = object
self.status = Fa... |
mini_event.py | import threading
class mini_event:
BUTTON_DOWN = 1
BUTTON_UP = 2
BUTTON_HOLD = 3
subscribers = { BUTTON_DOWN: [], BUTTON_UP : [], BUTTON_HOLD: [] }
trigger_hold_stop = False # This value should be turned to True if the hold event callback needs to be stopped.
def add_subscriber( self, callba... |
4.thread_lock.py | import threading
def job1():
global A, lock
lock.acquire()
for i in range(10):
A += 1
print('job1', A)
lock.release()
def job2():
global A, lock
lock.acquire()
for i in range(10):
A += 10
print('job2', A)
lock.release()
if __name__ == '__main__':
... |
lisp-core.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... |
aec_mp.py | # -*- coding: utf-8 -*-
"""
Script to process realtime audio with a trained DTLN-aec model.
This script directly interacts with audio devices. It expects 16kHz audio input/output.
Input device should contain a loopback channel as its last channel, and it assume raw mic input is in the first channel.
Example call:
... |
chatroom.py | ################################################################################
## author: Lucas santos
## version: 1.0
## Python 3.6.5 | UTF-8
from tkinter import *
import socket
from threading import Thread
from random import randint
from time import sleep
#########################################################... |
Box-Method.py | # This PROGRAM calculates the fractal dimension of the coastline and border of India using the box counting method.
#
# The features/boxes of grid are distributed between the nodes and each node distributes features between its cores.
# At each core, the function : counter() is executed and results are stored in a Mult... |
litex_term.py | #!/usr/bin/env python3
#
# This file is part of LiteX.
#
# Copyright (c) 2015-2020 Florent Kermarrec <florent@enjoy-digital.fr>
# Copyright (c) 2015 Sebastien Bourdeauducq <sb@m-labs.hk>
# Copyright (c) 2016 whitequark <whitequark@whitequark.org>
# SPDX-License-Identifier: BSD-2-Clause
import sys
import signal
import... |
simulator.py | import threading
import pygame
from .arenas import TCRArena
from .display import Display
DEFAULT_GAME = 'tin-can-rally'
GAMES = {'tin-can-rally': TCRArena,
}
class Simulator(object):
def __init__(self, config=None, size=(8, 8), frames_per_second=30, background=True):
if config is None:
... |
statreload.py | import multiprocessing
import os
import signal
import sys
import time
from pathlib import Path
HANDLED_SIGNALS = (
signal.SIGINT, # Unix signal 2. Sent by Ctrl+C.
signal.SIGTERM, # Unix signal 15. Sent by `kill <pid>`.
)
class StatReload:
def __init__(self, config):
self.config = config
... |
managerHardware.py | from backendRelay import Relay
from backendTimerUtils import IndefiniteTimer, time_in_range
from threading import Thread
from time import sleep
from statistics import mean
import datetime
class Lights(Relay):
def __init__(self, relaystring, gpiomanager, camera):
super(Lights, self).__init__(relaystring, "L... |
gene.py | from dataclasses import is_dataclass
from random import choice, randint, random, sample, shuffle
from time import time
from multiprocessing import Process, Manager
from tzer.error import MaybeDeadLoop, RuntimeFailure
from tzer.template import execute_both_mode
from tzer.seed_eval import SimpleLSTMEvaluator
from tzer.c... |
utils.py | import sys
import os.path
import random
import socket
import threading
from paste.deploy import loadapp
from paste.httpserver import serve
def get_interfaces(obj):
return [o for o in obj.__provides__.interfaces()]
# used on testing
# copied from ZopeLite Class from zope.testingZope.TestCase
# but we can't impo... |
main.py | # Copyright 2012 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
# notice, this list of conditi... |
daemon.py | import os
import errno
import threading
import tuned.logs
from tuned.exceptions import TunedException
from tuned.profiles.exceptions import InvalidProfileException
import tuned.consts as consts
from tuned.utils.commands import commands
from tuned import exports
from tuned.utils.profile_recommender import ProfileRecomme... |
pacman.py | # pylint: disable=C0111,R0903
"""Displays update information per repository for pacman."
Requires the following executables:
* fakeroot
* pacman
"""
import os
import threading
import bumblebee.input
import bumblebee.output
import bumblebee.engine
#list of repositories.
#the last one sould always be other
r... |
mpv.py | # coding: utf-8
# ------------------------------------------------------------------------------
#
# mpv.py - Control mpv from Python using JSON IPC
#
# Copyright (c) 2015 Lars Gustäbel <lars@gustaebel.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated... |
client.py | import socket
import threading
from Tkinter import Tk, Entry, Frame, StringVar, Scrollbar, Listbox, END, X, BOTTOM, Y, RIGHT, LEFT, BOTH
from random import randint
def receive_data(sock):
while True:
try:
data, addr = sock.recvfrom(4096)
if data:
msg_list.insert(END... |
http_listener.py | #!/usr/bin/env python3
import swimlane_environment_validator.lib.config as config
import swimlane_environment_validator.lib.log_handler as log_handler
from threading import Thread
from flask import Flask
import click
import ssl
from OpenSSL import crypto, SSL
logger = log_handler.setup_logger()
app = Flask(__name__... |
ajax.py |
@view_config(route_name='gene_check', renderer="json")
def gene_check_view(request):
"""
This is the first one that gets called. It starts a series of parallel jobs, whose IDs are stored in request.session['threads'].
:param request:
:return:
"""
print(request.POST)
if request.POST['gene'... |
parallelizer.py | # -*- coding: utf-8 -*-
import os, sys, time, multiprocessing, re
from .processes import ForkedProcess
from .remoteproxy import ClosedError
from ..python2_3 import basestring, xrange
class CanceledError(Exception):
"""Raised when the progress dialog is canceled during a processing operation."""
pass
class Pa... |
__init__.py | import json
import os
import copy
import threading
import time
import pkg_resources
from sqlalchemy.exc import IntegrityError
# anchore modules
import anchore_engine.clients.anchoreio
import anchore_engine.common.helpers
import anchore_engine.common.images
from anchore_engine.clients.services import internal_client_f... |
helpers.py | """
:copyright: Copyright 2013-2017 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
tests.support.helpers
~~~~~~~~~~~~~~~~~~~~~
Test support helpers
"""
import base64
import errno
import fnmatch
import functools
import inspect
import loggi... |
HeartLeak.py | #!/usr/bin/env python27
#=========================================================#
# [+] Title: HeartLeak (CVE-2014-0160) #
# [+] Script: HeartLeak.py #
# [+] Twitter: https://twitter.com/OffensivePython #
# [+] Blog: http://pytesting.blogspot.com ... |
herebedragons.py | # Django specific settings
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# Django imports
from django.core.management.base import BaseCommand
# Application specific imports
# standard libs
import uuid
import datetime
import threading
import queue
# other libs
from sense_hat import SenseHat
... |
srv_threaded.py | #!/usr/bin/env python3
# Foundations of Python Network Programming, Third Edition
# https://github.com/brandon-rhodes/fopnp/blob/m/py3/chapter07/srv_threaded.py
# Using multiple threads to serve several clients in parallel.
import zen_utils
from threading import Thread
def start_threads(listener, workers=4):
t = ... |
global_handle.py | #!/usr/bin/python
'''
(C) Copyright 2018-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
'''
import ctypes
import traceback
from multiprocessing import sharedctypes
from avocado import fail_on
from apricot import TestWithServers
from pydaos.raw import DaosPool, DaosContainer, DaosApiError, IO... |
running.py | # -*- coding: utf-8 -*-
"""Code for maintaining the background process and for running
user programs
Commands get executed via shell, this way the command line in the
shell becomes kind of title for the execution.
"""
import collections
import logging
import os.path
import shlex
import shutil
import signal
import... |
automated_driving_with_fusion2_5.py | """Defines SimpleSensorFusionControl class
----------------------------------------------------------------------------------------------------------
This file is part of Sim-ATAV project and licensed under MIT license.
Copyright (c) 2018 Cumhur Erkan Tuncali, Georgios Fainekos, Danil Prokhorov, Hisahiro Ito, James Kap... |
telemetry.py | """
Copyright 2022 Open STEMware Foundation
All Rights Reserved.
This program is free software; you can modify and/or redistribute it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation; version 3 with attribution addendums as found in the
LICEN... |
task.py | import atexit
import os
import signal
import sys
import threading
import time
from argparse import ArgumentParser
from collections import OrderedDict, Callable
import psutil
import six
from .backend_api.services import tasks, projects
from .backend_api.session.session import Session
from .backend_interface.model impo... |
callbacks_test.py | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
executor.py | from __future__ import print_function, division, absolute_import
from collections import defaultdict
from concurrent.futures._base import DoneAndNotDoneFutures, CancelledError
from concurrent import futures
from functools import wraps, partial
import itertools
import logging
import os
from time import sleep
import uui... |
mcastnode.py | #!/usr/bin/python
# -------------------------------------------------------------------------
# Goals :
# ------
# Multicast node
# *************************************************************************
# ======================
# Import section
# ======================
import sys
import signal
import string
imp... |
horovod_patches.py | # Copyright 2018 BLEMUNDSBURY AI LIMITED
#
# 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 ... |
server.py | #!/usr/bin/env/python
# File name : server.py
# Production : RaspTank
# Website : www.adeept.com
# E-mail : support@adeept.com
# Author : William
# Date : 2018/08/22
import socket
import time
import threading
import move
import Adafruit_PCA9685
pwm = Adafruit_PCA9685.PCA9685()
pwm... |
nifty.py |
"""@package geometric.nifty Nifty functions, originally intended to be imported by any module within ForceBalance.
This file was copied over from ForceBalance to geomeTRIC in order to lighten the dependencies of the latter.
Table of Contents:
- I/O formatting
- Math: Variable manipulation, linear algebra, least squa... |
spatial.py | '''
Spatial analyses functions for Digital Earth Africa data.
'''
# Import required packages
import fiona
import collections
import numpy as np
import xarray as xr
from osgeo import osr
from osgeo import ogr
import geopandas as gpd
import rasterio.features
import scipy.interpolate
import multiprocessing as mp
from sci... |
pants_daemon.py | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import logging
import os
import sys
import threading
from contextlib import contextmanager
from dataclasses import dataclass
from setproctitle import setproctitle as set_process_title
fr... |
GUIASSISTANT.py | #########################
# GLOBAL VARIABLES USED #
#########################
ai_name = 'F.R.I.D.Y.'.lower()
EXIT_COMMANDS = ['bye','exit','quit','shut down', 'shutdown']
rec_email, rec_phoneno = "", ""
WAEMEntry = None
avatarChoosen = 0
choosedAvtrImage = None
botChatTextBg = "#007cc7"
botChatText = "w... |
utils.py | #!/usr/bin/python3
import json
import threading
import asyncio
import random
import sys
from .constants import *
from rpcutils import errorhandler as rpcErrorHandler, constants as rpcConstants
from wsutils.subscriptionshandler import SubcriptionsHandler
from . import apirpc
from logger import logger
def ensureHash(ha... |
install_utils.py | import getopt
import re
import subprocess
import sys
import threading
import time
sys.path = [".", "lib"] + sys.path
import testconstants
from remote.remote_util import RemoteMachineShellConnection, RemoteUtilHelper
from membase.api.rest_client import RestConnection
import install_constants
import TestInput
import log... |
2_daemon.py | from logging_utils import info, debug,PROCESS_FORMAT
import logging
import multiprocessing
from random import randint
from time import sleep
logging.basicConfig(level=logging.DEBUG, format=PROCESS_FORMAT)
def sai_hi(id) -> None:
iteration = 0
while True:
iteration += 1
info(f"Hi! I'm a new pro... |
test_engine_py3k.py | import asyncio
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import delete
from sqlalchemy import event
from sqlalchemy import exc
from sqlalchemy import func
from sqlalchemy import inspect
from sqlalchemy import Integer
from sqlalchemy import select
from sqlalchemy import String
f... |
User.py | # Authro : ThreeDog
# Data : 2019-05-28
# Function : 将所有的用户、消息相关的操作封装在一个模块中。
# Remark : Users中有一个字典存放所有User,User中有一个队列(list)存放所有消息
import threading
import time
import itchat
from itchat.content import *
from MyCommand import Cmd
from Common import user_type_dict,type_dict,history,minput
from tdinput ... |
HASSStatus.py | # HomeAssistant Status Output
# Publishes the provided sensor key and value pair to a HomeAssistant instance
import logging
from ww import f
logger = logging.getLogger(__name__.rsplit(".")[-1])
class HASSStatus:
import time
import threading
import requests
apiKey = None
config = None
conf... |
courses.py | import re
from collections import OrderedDict
from datetime import datetime
from threading import Thread
import requests
from bs4 import BeautifulSoup
from data_parser.base_parser import BaseParser
from validations.schemas.courses_schema import CoursesSchema
class CoursesParser(BaseParser):
link = "https://cour... |
spark.py | import threading
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
from src.putils import pretty_print
class Spark:
def __init__(self):
self.sc = SparkContext(appName="SparkSIFTCounter")
self.sc.setLogLevel('ERROR')
self.streaming_sc = StreamingContext(self.... |
verbose_sqli.py | import os
import re
from queue import Queue
from urllib.parse import urlparse
from threading import Thread
import requests
import threading
from requests import get
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
lock = threadin... |
init_env.py | # -*- coding:utf-8 -*-
#
# File : env.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2019, RT-Thread Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; e... |
io.py | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import defaultdict
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, Executor, Future, _base, as_c... |
run_expr.py | #!/usr/bin/env python
import argparse
import datetime as dt
import os
import shutil
import threading
import subprocess32 as subprocess
import time
# Timeout in seconds to run the simulation
RUN_TIMEOUT = 60
class Trial:
def __init__(self, tname, desc_path, params_file):
self.tname = tname
self.d... |
client_demo.py | import socket
import struct
import threading
import queue
import time
class ThreadedClient(threading.Thread):
def __init__(self, host, port):
threading.Thread.__init__(self)
#set up queues
self.send_q = queue.Queue(maxsize = 10)
#declare instance variables
self.host =... |
test_github.py | from threading import Thread
from unittest import TestCase
from parameterized import parameterized
from hvac import exceptions
from hvac.tests import utils
try:
# Python 2.7
from http.server import HTTPServer
except ImportError:
# Python 3.x
from BaseHTTPServer import HTTPServer
class TestGithub(ut... |
benchmark.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import sys
import requests
import argparse
from multiprocessing import Process
from datetime import datetime
from wsgiref.simple_server import make_server
from cachecontrol import CacheControl
HOST = "localhost"
PORT = 8050
URL = "htt... |
daomanager.py | """
Data Access Object Manager.
The DAO manager coordinates the DAOs from each one of the necessary sources to
generate the dataframe usef by the classifiers to calculate a prediction score.
"""
from typing import Generator
import pandas as pd
import geniepy.datamgmt.daos as daos
from multiprocessing import Process
im... |
rm_socket.py | import traceback
import errno
import queue
import rm_log
import select
import socket
import subprocess
import threading
logger = rm_log.dji_scratch_logger_get()
class RmSocket(object):
TCP_MODE = 'tcp'
UDP_MODE = 'udp'
def __init__(self):
self.user_fd_to_socket_fd = {}
self.socket_filen... |
main.py | from os import path
import requests
import os
import re
import threading
import time
root = os.path.dirname(__file__)
index = []
plist = []
os.chdir(root)
# 函数是个好东西
def write(file: str, text: str):
"""
写一个文件
"""
f = open(os.path.join(root, file), "w", encoding="utf-8")
f.write(text)
f.close()... |
server.py | # Copyright (c) Microsoft 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 or agreed to in wri... |
image_window.pyw | # example1.py
import os
from synchronizationRole import updataIfNeed
import zipfile
import struct
import win32api
import win32con
import win32gui
import threading
import Image
import time
import socket
import online_check as oc
import tkinter as tk
import message_transaction as mt
import tkinter.messagebox as tkmb
from... |
data_helper.py | from typing import Iterable, Any, Optional, List
from collections.abc import Sequence
import numbers
import time
import copy
from threading import Thread
from queue import Queue
import numpy as np
import torch
def to_device(item: Any, device: str, ignore_keys: list = []) -> Any:
"""
Overview:
Transfe... |
picam.py | # import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
from threading import Thread
class PiVideoStream:
def __init__(self, resolution=(320, 240), framerate=32, rotation=0):
# initialize the camera and stream
self.camera = PiCamera()
self.camera... |
develop_utils.py | import os
import numpy as np
# from pl_examples import LightningTemplateModel
from pytorch_lightning import seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import TensorBoardLogger, TestTubeLogger
from tests import TEMP_PATH, RANDOM_PORTS, RANDOM_SEEDS
from tests... |
OpDialogue.py | ##########################################################################
#
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
rebalance.py | #!/usr/bin/env python3
from pyln.client import Plugin, Millisatoshi, RpcError
from threading import Thread, Lock
from datetime import timedelta
import time
import uuid
plugin = Plugin()
plugin.rebalance_stop = False
def setup_routing_fees(plugin, route, msatoshi):
delay = plugin.cltv_final
for r in reversed(... |
engine.py | """
Main BZT classes
Copyright 2015 BlazeMeter 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... |
sensor.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2020 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
from __future__ import print_function # Requires: Python >= 2.6
import sys
sys.dont_write_bytecode = True
import cProfile
import inspect
import math
impor... |
importmagicserver.py | # -*- coding: utf-8 -*-
"""
importmagic.el server
---------------------
Copyright (c) 2017 Nicolás Salas V.
Licensed under GPL3. See the LICENSE file for details
"""
import sexpdata
import sys
import threading
from collections import deque
import importmagic
from epc.server import EPCServer
server = EPCServer(('loc... |
motion_detector.py | from threading import Thread
from queue import Queue
import numpy as np
import cv2
import requests
import json
import os, time
with open('config.json', 'r') as f:
config = json.load(f)
sd_thresh = config['detection']['threshold']
upload_url = config['upload']['url']
uid = config['upload']['uid']
skip_frames = c... |
test.py | import os.path as p
import random
import threading
import time
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
from helpers.client import QueryRuntimeException
import json
import subprocess
import kafka.errors
from kafka import KafkaAdminClient, KafkaProducer, KafkaConsu... |
judge.py | import enum
import threading
import subprocess
import shutil
import queue
import traceback
import os, os.path
class IsolatedJobEnvironment:
def __init__(self):
self._instructions = []
pass
def add_directory(self, host, virtual):
if not virtual.startswith("/"):
raise ValueEr... |
xair.py | "This modules managed communications with the XAir mixer"
# part of xair-remote.py
# Copyright (c) 2018, 2021 Peter Dikant
# Additions Copyright (c) 2021 Ross Dickson
# Some rights reserved. See LICENSE.
import time
import threading
import socket
import netifaces
from pythonosc.dispatcher import Dispatcher
from python... |
async_tasks.py | # Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
scheduler.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
USAGE = """
## Example
For any existing app
Create File: app/models/scheduler.py ======
from gluon.scheduler import Scheduler
def demo1(*args,**vars):
print 'you passed args=%s and vars=%s' % (args, vars)
return 'done!'
def demo2():
1/0
scheduler = Schedul... |
kafka_consumer.py | import requests
import argparse
import logging
import coloredlogs
import threading
from flask import Flask, request, jsonify
from flask_swagger import swagger
from waitress import serve
import subprocess
import json
from kafka import KafkaConsumer
from threading import Thread
import time
app = Flask(__name__)
logger ... |
work_queue.py | # -*- python -*-
# Mark Charney
#BEGIN_LEGAL
#
#Copyright (c) 2017x Intel 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
#... |
navi.py | #!/usr/bin/env python
## TODO: expand the forest to use <slot>, <info>, <more>
## TODO: add <value> browser
## TODO: add <value>/<slot> browser.
## TODO: add <array>/<index> browser.
## TODO: add close button to popouts
## TODO: add static class list
import andbug, os.path, json, subprocess, threading
import re
try:... |
ddp.py | from typing import Callable, cast, Type, T, Tuple, Any
import torch
from time import sleep
from loguru import logger
from functools import wraps
from argparse import Namespace
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.distributed import Backend
from multiprocessing import Process, Q... |
test_eth.py | import logging
import signal
import time
import datetime
# import random
from threading import Thread, Event # , Lock, Condition
from array import array
import struct
import numpy as np
from basil.dut import Dut
from basil.HL.RegisterHardwareLayer import RegisterHardwareLayer
conf = '''
name : test_eth
version :... |
update_ohlc.py | import os
import sys
from multiprocessing import Process
sys.path.append('src')
from DataSource import IEXCloud, Polygon # noqa autopep8
from Constants import PathFinder, POLY_CRYPTO_SYMBOLS, FEW_DAYS # noqa autopep8
import Constants as C # noqa autopep8
iex = IEXCloud()
poly = Polygon(os.environ['POLYGON'... |
scapy-watch.py | #!/usr/bin/env python
"""
Proof of concept for monitoring network for setting home automation use
not ready for prime time of any kind
"""
__author__ = "Peter Shipley"
from scapy.all import *
from threading import Thread
import ISY
import time
import socket
import signal
verbose=1
conf.verb=1
import argpa... |
lock_or_mutex.py | """
menggunakan lock/mutex untuk mengsinkronisasi akses ke shared resource
"""
import threading, time, random
counter = 0
lock = threading.Lock() # lock untuk mendapatkan akses ke shared resource
def worker(name):
global counter
for _ in range(10):
if lock.acquire(): # lock resource, onl... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# 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 the Software without restriction,
# including witho... |
runtests.py | #!/usr/bin/env python2.7
#
# Copyright 2015 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT licens... |
app.py | """
PyGPSClient - Main tkinter application class.
Created on 12 Sep 2020
:author: semuadmin
:copyright: SEMU Consulting © 2020
:license: BSD 3-Clause
"""
from threading import Thread
from tkinter import Tk, Frame, N, S, E, W, PhotoImage, font
from .strings import (
TITLE,
MENUHIDESE,
MEN... |
trezor.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_ltc.util import bfh, bh2u, versiontuple, UserCancelled
from electrum_ltc.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, is_address)
from electrum_ltc import constant... |
test_rpc.py | '''
Copyright (c) 2013 Qin Xuye <qin@qinxuye.me>
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 wr... |
serve.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""
Creates server for streamed game state
"""
import os
import json
import logging
import textwrap
from os.path import join as pjoin
from multiprocessing import Process, Pipe
from multiprocessing.connection import Connecti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.