source
stringlengths
3
86
python
stringlengths
75
1.04M
main.py
# -*- coding: utf-8 -*- {{{ # vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et: # Copyright (c) 2015, Battelle Memorial Institute # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistri...
portable_runner.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
mpu6050_only_record.py
"""A GUI tool for recording MPU-6050 digital accelerometer and gyroscope readings on a Raspberry Pi. Created by: Vijaykumar Walikar Released under the MIT License Copyright (c) 2018 Vijaykumar Walikar """ from tkinter import * from tkinter import ttk import csv import time import datetime import threading ...
consensus.py
import socket import threading import turtle import graph import time import MMMMM import random mycolor = "#{0:06x}".format(random.randint(0x000000, 0xffffff)) mycpu = int(input("What is your computer number? ")) def COLMSG(cpu, color): """ Returns a properly formatted COLMSG message for the given cpu and color. ...
im2rec.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache Licens...
crossover_parr.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 31 16:39:03 2021 @author: akshat """ import numpy as np import rdkit from rdkit import Chem from rdkit.Chem import AllChem from rdkit.DataStructs.cDataStructs import TanimotoSimilarity from selfies import encoder, decoder import multiprocessing fr...
callback.py
from utlis.rank import setrank,isrank,remrank,remsudos,setsudo,GPranks,IDrank from utlis.send import send_msg, BYusers, Sendto, fwdto,Name,Glang,getAge from utlis.locks import st,getOR,Clang,st_res from utlis.tg import Bot from config import * from pyrogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup,...
singleMachine.py
#!/usr/bin/env python #Copyright (C) 2011 by Benedict Paten (benedictpaten@gmail.com) # #Permission is hereby granted, free of charge, to any person obtaining a copy #of this software and associated documentation files (the "Software"), to deal #in the Software without restriction, including without limitation the rig...
qq_exmail_brute.py
# # author : whoam1 # # blog : http://www.cnnetarmy.com # # Use for brute exmail.qq.com week password. import requests import re import rsa import base64 import time import random import threading def brute(email,password,UA): url = 'https://en.exmail.qq.com' headers ={ 'Connection': 'keep-alive','Cache-Control...
driver.py
# Copyright 2020 Uber Technologies, Inc. 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...
agent.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...
_backend_overview.py
# -*- coding: utf-8 -*- # Copyright 2018, IBM. # # This source code is licensed under the Apache License, Version 2.0 found in # the LICENSE.txt file in the root directory of this source tree. """A module for monitoring backends.""" import time import threading import types from IPython.display import display ...
final_application.py
#!/usr/bin/env python from traits.etsconfig.api import ETSConfig ETSConfig.toolkit = 'wx' from threading import Thread from time import sleep from traits.api import * from traitsui.api import View, Item, Group, HSplit, Handler from traitsui.menu import NoButtons from code_snippet_8 import MPLFigureEditor from matplot...
GUI.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- import tkinter as tk import os from tkinter import messagebox import pickle from client_alone import Client import time import threading from multiprocessing import Queue ##genere une frame uniquement dédié pour le login screen class LoginFrame(tk.Frame): ##Le construc...
ue_mac.py
""" Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. """ import threading from typing import List from ryu.controller import ofp_event from ryu.controller.handler import M...
web_server_old.py
from http.server import HTTPServer, BaseHTTPRequestHandler from queue import Queue from threading import Thread, Event import json # Import Tuple type which is used in optional function type annotations. from typing import Tuple import keyprofile class WebServerManager(): """Creates new web server thread.""" ...
indexer.py
import os import sys import stat import fnmatch import threading import traceback from queue import Queue from threading import Thread, Event from collections import defaultdict from functools import wraps, partial, reduce from itertools import filterfalse, chain import sublime # The primary DB is indexed on the fly...
wss.py
# -*- coding: utf-8 -*- """ Created on Sat Mar 24 00:16:07 2020 @author: tranl """ import time, sys, math import numpy as np import pandas as pd import websocket import threading import json from tradingpy import PRICEPRE, SIDE, Signal from utility import print_, orderstr, timestr, barstr def wss_run(*args): ##...
test_dist_train.py
# Copyright (c) 2018 PaddlePaddle 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 app...
serve.py
#!/usr/bin/env python # Copyright (C) 2010 Ion Torrent Systems, Inc. All Rights Reserved """ Ion Job Server ============== The Job Server connects the Torrent PC Analysis frontend to the compute infrastructure that performs actual data analysis. It is a tool for monitoring and managing the computational tasks require...
tr503_alternative.py
import cfscrape import requests import threading import sys from requests_toolbelt.adapters import source inc=0 def process(scraper1,ip): global inc while(1): print scraper1.get("http://tamilrockers.nu/index.php?app=core&module=search&do=search&andor_type=and&sid=38f869bef6a07185cdfac88653d2f212&search_date_start...
__init__.py
''' module beeline ''' import functools import logging import os import socket from contextlib import contextmanager from libhoney import Client from beeline.trace import SynchronousTracer from beeline.version import VERSION from beeline import internal import beeline.propagation.default import sys # pyflakes assert i...
ssh.py
#!/usr/bin/env python """ DMLC submission script by ssh One need to make sure all slaves machines are ssh-able. """ from __future__ import absolute_import import os, subprocess, logging from threading import Thread from . import tracker def sync_dir(local_dir, slave_node, slave_dir): """ sync the working dir...
ceres.py
import common import exporter import importer import manager import antler import os import sys import time from flask_api import FlaskAPI from flask import request from flask_api import status import json from datetime import datetime import utils import threading free_data = {} insert_queue = [] app = FlaskAPI(__nam...
PC_Miner.py
#!/usr/bin/env python3 """ Duino-Coin Official PC Miner 3.1 © MIT licensed https://duinocoin.com https://github.com/revoxhere/duino-coin Duino-Coin Team & Community 2019-2021 """ from threading import Semaphore from time import time, sleep, strptime, ctime from hashlib import sha1 from socket import socket ...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrum_stratis as electrum from electrum_stratis.stratis import TYPE_ADDRESS from electrum_stratis import WalletStorage, Wallet from electrum_stratis_gui.kivy.i18n import _ from electrum_st...
output_devices.py
from RPi.GPIO import PWM, OUT, setup from time import sleep from threading import Thread from atexit import register import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) register(GPIO.cleanup) class GeneralPurposeOutputDevice: def __init__(self, pin: int, starting_value: float=0, max_value: float=1): assert 0....
test_browser.py
# coding=utf-8 # Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import argparse import json import multiprocessing imp...
measurePerformance.py
# ######################################################################## # Copyright 2013 Advanced Micro Devices, 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.apach...
__init__.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...
video.py
#!/usr/bin/env python import numpy as np import open3d as o3d import open3d.visualization.gui as gui import open3d.visualization.rendering as rendering import os import time import threading SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) RGB_DIR = os.path.join(SCRIPT_DIR, "../../test_data/RGBD/color") DEPTH_...
atari_wrappers.py
import gym import numpy as np from collections import deque from PIL import Image from multiprocessing import Process, Pipe # atari_wrappers.py class NoopResetEnv(gym.Wrapper): def __init__(self, env, noop_max=30): """Sample initial states by taking random number of no-ops on reset. No-op is assume...
AI.py
import os import random import threading import numpy as np from gtts import gTTS import json, requests from scipy.io import loadmat from eleonora.modules import UI import speech_recognition as sr from playsound import playsound from eleonora.modules import Interact import eleonora.utils.config as config from eleonora....
pre_commit_linter.py
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
perf_test.py
import sys import time import os import subprocess from multiprocessing import Queue from multiprocessing import Process import sqlite3 from main import process_and_parse from FuzzyParser import FuzzyParser from main import pre_process from full_parse import make_graph import gc def run_single_full(filename, p_num, a...
installwizard.py
import os from functools import partial import threading from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import platform...
test_transmit.py
from unittest import TestCase, skipIf from threading import Thread from .test_server import app from genki import Client require_server = skipIf( app is None, '''Flask is not installed, \rtherefore no test server available''') def start_server(): Thread(target=app.run, daemon=True).start() class ...
adminset_agent.py
#!/usr/bin/env python # coding=utf-8 import os from subprocess import Popen, PIPE import re import platform import socket import time import json import threading token = 'HPcWR7l4NJNJ' server_ip = '192.168.47.130' try: import psutil except ImportError as msg: print(msg) print("--------------------------...
BobClient.py
# Copyright (c) 2016 Gabriel Oliveri (<gabrieloandco@gmail.com>) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy,...
threadedhttpserver.py
import socketserver import threading from http.server import SimpleHTTPRequestHandler class ThreadedHTTPServer(object): def __init__(self, host, port, request_handler=SimpleHTTPRequestHandler): socketserver.TCPServer.allow_reuse_address = True self.server = socketserver.TCPServer((host, port), req...
test_vscode_robot.py
import logging import os from pathlib import Path import threading import pytest from robocorp_ls_core.protocols import ILanguageServerClient from robocorp_ls_core.unittest_tools.cases_fixture import CasesFixture from robotframework_ls.commands import ROBOT_INTERNAL_RFINTERACTIVE_STOP from robotframework_ls.impl.robo...
configmanager.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2014 IBM Corporation # Copyright 2015-2019 Lenovo # # 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/licens...
cgw_general_utils.py
# -*- coding: utf-8 -*- """ Created on Wed May 11 14:14:05 2016 @author: kbefus """ import sys import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs from distutils.dir_util import copy_tree import glob,os,warnings from osgeo import osr,gdal with warnings.catch_warnings(): ...
listenSer.py
''' ************************************************** * 智能体监听模块 * * * * 1. 监听智能体控制器设置请求 * * 2. 循环处理任务队列中的任务 * * 3. 接收请求并执行 * * ...
controller.py
from PyQt5 import QtWidgets import qtmodern.styles, qtmodern.windows import threading, queue, sys, hypixelDataGetter, guiManager def eventManager(eventQueue: queue.Queue, guiView: guiManager) -> None: """eventManager function proccesses events There are 2 events we need to watch out for [BOXCLICK], [ITEM...
server.py
from six.moves import BaseHTTPServer import errno import os import socket from six.moves.socketserver import ThreadingMixIn import ssl import sys import threading import time import traceback from six import binary_type, text_type import uuid from collections import OrderedDict from six.moves.queue import Queue from ...
webScrapping.py
import requests import datetime import csv from bs4 import BeautifulSoup import threading def getMonthNumber(month): """ Change the months from string to int. """ months = { "Jan":1, "Feb":2, "Mar":3, "Apr":4, "May":5, "Jun":6, "Jul":7, "A...
emails.py
from flask import render_template from flask.ext.mail import Message from app import mail from decorators import async from config import ADMINS @async def send_async_email(msg): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender = sender, r...
communicator.py
""" Communicator """ import sys import os import time import json import serial import serial.tools.list_ports import threading from ..devices import DeviceManager from .constants import BAUDRATE_LIST from .context import APP_CONTEXT from .utils.resource import ( get_executor_path ) if sys.version_info[0] > 2: ...
runners.py
# -*- coding: utf-8 -*- import codecs import locale import os import struct import sys import threading from functools import partial from subprocess import Popen, PIPE # Import some platform-specific things at top level so they can be mocked for # tests. try: import pty except ImportError: pty = None try: ...
SocialFish.py
#!/usr/bin/python3 #-*- coding: utf-8 -*- # SOCIALFISH v2.0 # by: An0nUD4Y # ########################### from time import sleep from sys import stdout, exit, argv from os import system, path from distutils.dir_util import copy_tree import multiprocessing from urllib.request import urlopen, quote, unquote from pla...
get-downloads-scoped.py
#!/usr/bin/env python import sys import os import signal import json from pathlib import Path import requests import threading, queue import time package_q = queue.Queue(maxsize=3000) results_q = queue.Queue(maxsize=3000) file_dir = sys.argv[1] path = Path(file_dir) base_url = "https://api.npmjs.org/downloads/point...
cli.py
# -*- coding: utf-8 -*- """ flask.cli ~~~~~~~~~ A simple command line application to run flask apps. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import print_function import ast import inspect import os import re import sys import trace...
trezor.py
import traceback import sys from typing import NamedTuple, Any from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum import const...
utils.py
from timeit import default_timer import json import os import pickle import shutil import zipfile import requests import inspect import numpy as np import pandas import dgl import torch import time from ogb.nodeproppred import DglNodePropPredDataset from functools import partial, reduce, wraps def _download(url, pat...
test_smtplib.py
import asyncore import email.utils import socket import threading import smtpd import smtplib import StringIO import sys import time import select from unittest import TestCase from test import test_support HOST = test_support.HOST def server(evt, buf, serv): serv.listen(5) evt.set() try: conn, a...
example_trbinance_com.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_trbinance_com.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api # Documentation: https://lucit-systems-and-development.github.io/unicorn-binance-websocket-api #...
mainframe.py
# -*- coding: UTF-8 -*- # # Tencent is pleased to support the open source community by making QTA available. # Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the BSD 3-Clause License (the "License"); you may not use this # file except in compliance with the License. You may ...
arcade_controller_watcher.py
import signal import re import threading import time import struct import kodi_handler as kodi class ArcadeControllerWatcher(object): KEYCODE_KEY_F13 = 183 KEYCODE_KEY_F14 = 184 def __init__(self): self.inputcode = "" self.current_inputcode = "" self.done = False signal.signal(signal.SIGI...
NodeManager.py
# For cmd running not add to os path, pycharm not need. import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) rootPath = os.path.split(curPath)[0] sys.path.append(rootPath) import time import codecs from multiprocessing import Process, Queue from multiprocessing.managers import BaseManager ''' [分...
job.py
# Copyright 2017 Spotify AB # # 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, softw...
__init__.py
# Copyright (c) PyZMQ Developers. # Distributed under the terms of the Modified BSD License. import sys import time from threading import Thread from unittest import TestCase try: from unittest import SkipTest except ImportError: from unittest2 import SkipTest from pytest import mark import zmq from zmq.util...
data.py
from avista_portal.api import api_bp as bp from flask import request, jsonify, current_app from avista_data.device import Device from avista_data.sensor import Sensor from avista_data.data_point import DataPoint from avista_data.issue import Issue from avista_data.issue_type import IssueType def find_or_create_device...
openimage.py
# -*- coding: utf-8 -*- import os import csv import time import argparse import pickle import numpy as np import multiprocessing as mp import pandas as pd from queue import Queue from miscc.google_img_parser import get_img_by_url example_text = '''example: python Main.py --csv_path ./test.csv --outp...
oepoll.py
# -*- coding: utf-8 -*- from .client import LINE from types import * import os, sys, threading, time class OEPoll(object): OpInterrupt = {} client = None __squareSubId = {} __squareSyncToken = {} def __init__(self, client): if type(client) is not LINE: raise Exception('You nee...
recoco.py
# Copyright 2011 James McCauley # # This file is part of POX. # # POX 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, either version 3 of the License, or # (at your option) any later version. # # POX is distri...
n1ql_upgrade.py
import threading from .tuq import QueryTests from upgrade.newupgradebasetest import NewUpgradeBaseTest from .flex_index_phase1 import FlexIndexTests from remote.remote_util import RemoteMachineShellConnection from membase.api.rest_client import RestConnection from couchbase.cluster import Cluster from couchbase.cluster...
demo.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import _init_paths import os import cv2 import json import csv import time from opts import opts from detectors.detector_factory import detector_factory from lib.utils.debugger import Debugger from twisted.i...
dataengine-service_install_libs.py
#!/usr/bin/python3 # ***************************************************************************** # # 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 ...
testserver.py
# (c) 2005 Clark C. Evans # This module is part of the Python Paste Project and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php # This code was written with funding by http://prometheusresearch.com """ WSGI Test Server This builds upon paste.util.baseserver to customize it for r...
all.py
from utlis.rank import setrank,isrank,remrank,remsudos,setsudo, GPranks,IDrank from utlis.send import send_msg, BYusers, GetLink,Name,Glang,getAge from utlis.locks import st,getOR from utlis.tg import Bot from config import * from pyrogram import ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton import t...
muti_processing.py
from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print('Run child process %s (%s)...' % (name, os.getpid())) if __name__ == '__main__': print('Parent process %s.' % os.getpid()) p = Process(target=run_proc, args=('test',)) print('Child process will start.') p.start()...
tensorFI.py
#!/usr/bin/python # Library for performing fault injections into TensorFlow graphs (in place) # Uses the fault injection functions defined in modifyGraph and ficonfig import tensorflow as tf import printGraph as pg import modifyGraph as mg from injectFault import initFIConfig, initFILog, logRun from fiConfig import c...
nanny.py
import asyncio import logging from multiprocessing.queues import Empty import os import psutil import shutil import threading import uuid import warnings import weakref import dask from dask.system import CPU_COUNT from tornado.ioloop import IOLoop from tornado.locks import Event from tornado import gen from .comm im...
parallel_trackers.py
# import the necessary packages from imutils.video import VideoStream from imutils.video import FPS import argparse import imutils import time import cv2 import socket import time import helpers import math import multiprocessing def tracker(cv_name, conn): tracker = helpers.get_tracker(cv_name) count = 0 ...
server.py
import math import os import queue import sys import threading import time import uuid from collections import namedtuple from concurrent.futures import ThreadPoolExecutor from threading import Event as ThreadingEventType from time import sleep import grpc from dagster import check, seven from dagster.core.code_pointe...
main.py
import argparse import threading import time from pathlib import Path from pose import getKeypoints, getValidPairs, getPersonwiseKeypoints import cv2 import depthai as dai import numpy as np from imutils.video import FPS parser = argparse.ArgumentParser() parser.add_argument('-nd', '--no-debug', action="store_true", h...
PyShell.py
#! /usr/bin/env python from __future__ import print_function import os import os.path import sys import string import getopt import re import socket import time import threading import io import linecache from code import InteractiveInterpreter from platform import python_version, system try: from Tkinter import...
sbh_accessor.py
import sbol2 as sbol import tenacity import threading import traceback class SBHAccessor: def __init__(self, *, sbh_url): self.shutdownThread = False self.event = threading.Event() self.lock = threading.Lock() self.sbh = sbol.PartShop(sbh_url) self.sbh_username = None ...
GetSNPage.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from mttkinter import mtTkinter as mttk from tkinter import * from tkinter import messagebox import ConnectionTracer import threading import time import subprocess import os from pip._vendor import requests from pystrich.code128 import Code128Encoder from pystrich.qrcode im...
ping.py
import requests import time import threading def ping(): fo = open("url.txt", "r") str = fo.read(100); x = requests.get(str) fo.close() print(threading.Thread().getName(), x.status_code) threads = [] for x in range(5): t = threading.Thread(target=ping()) start_time = time.time() threads.append(t) ...
test_diskutils.py
from __future__ import print_function, division, absolute_import import functools import gc import os import shutil import subprocess import sys from time import sleep import mock import pytest import dask from distributed.compatibility import Empty, WINDOWS from distributed.diskutils import WorkSpace from distribut...
action.py
from django.conf import settings from django.core.management.base import CommandError from systems.manage.task import CommandAborted from systems.commands.index import CommandMixin from systems.commands.mixins import exec from systems.commands import base, messages from utility import display import threading import ...
mouseclick.py
import pyautogui as pg import multiprocessing import time print(pg.position()) def foo(): pg.moveTo(411,605) while True: pg.click() if __name__ == '__main__': # Start foo as a process p = multiprocessing.Process(target=foo) p.start() # Wait 11 seconds for foo time.sleep(11) # Termina...
kombu_worker.py
import random import string from time import sleep from kombu.mixins import ConsumerMixin from kombu import Exchange, Queue from kombu.pools import producers from kombu.log import get_logger from kombu.utils import kwdict, reprcall logger = get_logger(__name__) task_exchange = Exchange('tasks', type='direct') task_que...
code.py
#!/usr/bin/env python2 """ Code Copyright (C) 2012-2015 Liam Stanley Source/docs: https://github.com/lrstanley/Code """ import sys sys.dont_write_bytecode = True import os import re import json import optparse import time import traceback from multiprocessing import Process from core import bot from util import output...
RobomasterController.py
import threading from robomaster import chassis from robomaster import gripper from robomaster import robotic_arm from robot.components.controller.IRobotController import IRobotController class QueueRobomasterController(IRobotController): def __init__(self, ep_chassis: chassis, ...
restic-sidecar.py
import os import json import socket import bottle import restic import threading import dateutil.parser listen_address = os.environ.get('RSC_LISTEN_ADDRESS','0.0.0.0') listen_port = os.environ.get('RSC_LISTEN_PORT','9000') metrics_prefix = os.environ.get('RSC_METRICS_PREFIX','rsc') retention_policy = os.environ.get('R...
cache.py
from pixie import users from pixie import servers import threading import time import operator def init(threshold=100): return CacheControl(threshold) class CacheControl: cached_users = dict() cached_servers = dict() def __init__(self, threshold=100): self.cached_users = dict() sel...
Item57.py
""" Item 57: Avoid Creating New Thread Instances for On-demand Fan-out """ """ Threads are the natural tool to use in order to do parallel I/O in Python. They do not work will for fanning out to many concurrent lines of excecution. In this example the Game of Life is used to illustrate the problem. Threads have many ...
sc_video.py
#!/usr/bin/python """ sc_video.py This file includes functions to: Initialise the camera Initialise the output video Image size is held in the smart_camera.cnf """ import sys from os.path import expanduser import time import math import multiprocessing import cv2 import numpy as np import sc_config from sc_log...
test_queues.py
import threading import time from dagster_celery import celery_executor from dagster import ModeDefinition, default_executors from .utils import execute_on_thread, skip_ci, start_celery_worker celery_mode_defs = [ModeDefinition(executor_defs=default_executors + [celery_executor])] # @pytest.mark.skip @skip_ci def...
mate_ksx3267v2.py
#!/usr/bin/env python # # -*- coding: utf-8 -*- # # Copyright (c) 2018 JiNong, Inc. # All right reserved. # import struct import time import socket import select import traceback import hashlib import json from enum import IntEnum from threading import Thread, Lock from mate import Mate, ThreadMate, DevType from mbloc...
framereader.py
# pylint: skip-file import json import os import pickle import queue import struct import subprocess import tempfile import threading from functools import wraps import numpy as np from aenum import Enum from lru import LRU import _io from tools.lib.cache import cache_path_for_file_path from tools.lib.exceptions impo...
cov_util.py
# -*- coding: utf-8 -*- # Copyright 2019 The GraphicsFuzz Project 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
receive.py
import functools import threading import time import pika from modules.rabbitmq.messages.api_controller import Api_Controller class ExampleConsumer(object): def __init__(self, amqp_url, queue, apiController: Api_Controller): self.apiController = apiController self.should_reconnect = False ...
run.py
# -*- encoding: utf-8 -*- """ Copyright (c) 2019 - present AppSeed.us """ from flask_migrate import Migrate from sys import exit from decouple import config from apps.config import config_dict from apps import create_app, db, thread_deepblu from apps.report.models import motions from apps.camera.autoid import autoid ...
video_show.py
from threading import Thread import cv2 class VideoShow: # Class that continuously shows a frame using a dedicated thread. # Since it works in the thread other than the main UI Thread the # video playback is faster and would be difficult to analyze. # I haven't used it in the the video editing autom...
dataCollector.py
#!/usr/bin/env python import socket, json, time, threading, urllib.request, urllib.error, logging.config, sys from tools import helper from time import mktime import dataLogger #from uuid import getnode as get_mac MCAST_GRP = '224.1.1.1' MCAST_PORT_BEAGLE_ALIVE = 5007 MCAST_PORT_DATACOLL_ALIVE = 5008 UDP_PORT = 5010 ...
script.py
from __future__ import absolute_import import os import traceback import threading import shlex from . import controller class ScriptError(Exception): pass class ScriptContext: def __init__(self, master): self._master = master def log(self, message, level="info"): """ Logs a...