source
stringlengths
3
86
python
stringlengths
75
1.04M
vid2img_sthv2.py
# Code for "TSM: Temporal Shift Module for Efficient Video Understanding" # arXiv:1811.08383 # Ji Lin*, Chuang Gan, Song Han # {jilin, songhan}@mit.edu, ganchuang@csail.mit.edu import os import threading NUM_THREADS = 100 VIDEO_ROOT = '/ssd/video/something/v2/20bn-something-something-v2' # Downloaded webm vid...
tzp.py
import zmq import curses import argparse import configparser import threading import time from curses import wrapper from client import Client from ui import UI def parse_args(): parser = argparse.ArgumentParser(description='Client for teezeepee') # Please specify your username parser.add_argument('use...
test_c10d.py
import copy import math import operator import os import random import signal import sys import tempfile import threading import time import traceback import unittest from unittest import mock from contextlib import contextmanager from datetime import timedelta from functools import reduce from itertools import groupby...
testremote.py
import os import sys import time import tempfile import unittest import threading import multiprocessing as mp import vivisect import vivisect.cli as vivcli import vivisect.const as v_const import vivisect.tests.helpers as helpers import vivisect.remote.server as v_r_server import envi.memcanvas as e_mcanvas def run...
LedAnimation.py
from StoppableThread import StoppableThread from threading import Thread from blinker import signal class KeyFrame: def __init__(self, animationFunc, strip, **kwargs): self.Animation = animationFunc self.strip = strip self.kwargs = kwargs def Play(self): self.Animation(self.strip, self.kwargs) class Anim...
server2.test.py
# AUM SHREEGANESHAAYA NAMAH|| from server2 import Server2 as Server from numpy.random import poisson import csv import random from threading import Thread from config import poi_avg S = None def randStr(): return ''.join(random.choice(['0', '1', '2', '3', '4', '5']) for x in range(10)) class MinCAV: def __init_...
wire_cutter_main.py
# Threading programming test # /home/pi/bstrip/src/ # Start Date 2/23/22 from threading import Thread import time import csv import asyncio import serial, string import re, struct from array import * import os, numpy global ready_rio global rio_stop global ready_mng global mng_stop global ready_dec global dec_stop gl...
guardserver.py
import sys sys.argv[1:] = ['0.0.0.0','7080'] import web from time import sleep, time from pymodbus.server.sync import StartTcpServer from pymodbus.device import ModbusDeviceIdentification from pymodbus.datastore import ModbusSequentialDataBlock from pymodbus.datastore import ModbusSlaveContext, ModbusServerContext im...
bmn_utils.py
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve. # #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...
stack_selector_tif.py
import os import sys import numpy as np import pandas as pd import re from pathlib import Path import imageio import tifffile from qtpy import QtWidgets, QtCore, QtGui from saenopy.gui import QtShortCuts from saenopy.gui.stack_selector_leica import StackSelectorLeica class StackSelectorTif(QtWidgets.QWidget): loa...
index.py
# -*- coding: utf-8 -*- # Copyright (c) 2020 # Author: xiaoweixiang # # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportError: from dummy_threading import Thread from . import DistlibException from .compat import (HTTPBa...
app.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import time import threading from flask import Flask, render_template, request, flash, redirect, url_for from post import * app = Flask(__name__) app.secret_key = os.urandom(12) @app.route('/') def home(): return render_template('index.html') @app.route('/w...
AMQP.py
#!/usr/bin/env python3 ###################################################################################################### # # Organization: Peter Moss Leukemia AI Research # Repository: HIAS: Hospital Intelligent Automation System # # Author: Adam Milton-Barker (AdamMiltonBarker.com) # # Title: i...
pydoc.py
#!/usr/bin/env python # -*- coding: latin-1 -*- """Generate Python documentation in HTML or text for interactive use. In the Python interpreter, do "from pydoc import help" to provide online help. Calling help(thing) on a Python object documents the object. Or, at the shell command line outside of Python: Run "pydo...
main.py
import datetime import os import sqlite3 import tempfile import threading import time from elevate import elevate from tkinter import * from tkinter import colorchooser, filedialog, messagebox, simpledialog, ttk import pyautogui # import winshell # from win32com.client import Dispatch """ -----------...
testrunner.py
#!/usr/bin/python # Copyright 2007-2011 David Michael Bryson, all rights reserved. # http://programerror.com/software/testrunner # # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # # 1. Redistributions of source co...
email_writer.py
#!/usr/bin/env python3 import getpass import smtplib import socket import sys import threading import time from email.message import EmailMessage from os.path import dirname, realpath; sys.path.append(dirname(dirname(dirname(realpath(__file__))))) from logger.utils.formats import Text from logger.writers.writer imp...
third_scraper.py
from bs4 import BeautifulSoup from pymongo import MongoClient import requests import threading GOOGLE_NEWS_URL = "https://news.google.com/news/?ned=us&hl=en" MATCH_URL = 'gizmodo.com' def get_beautiful_soup(url): re = requests.get(url) if re.status_code == 200: return BeautifulSoup(re.text, 'html.pa...
syn_flood.py
# Developed by GABRIEL PEREIRA PINHEIRO and VICTOR ARAUJO VIEIRA # In the University of Brasilia on 2017 # Atack SYN flood #All copyrights to Gabriel Pereira Pinheiro and Victor Araujo Vieira import socket, sys, random from struct import * from threading import Thread import time flag_encerra_threads = False # ch...
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...
pre_compile_test.py
# Copyright 2021 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...
marathon_lb.py
#!/usr/bin/env python3 """# marathon-lb ### Overview The marathon-lb is a service discovery and load balancing tool for Marathon based on HAProxy. It reads the Marathon task information and dynamically generates HAProxy configuration details. To gather the task information, marathon-lb needs to know where to find Mar...
queuetest.py
from systemtools.basics import * from systemtools.duration import * import time from multiprocessing import Process def f(q): time.sleep(getRandomInt(10)) # time.sleep(1) q.put(None) if __name__ == '__main__': nbProcesses = 15 pbar = ProgressBar(nbProcesses) q = pbar.startQueue() processes = [] for i in range...
Hiwin_RT605_ArmCommand_Socket_20190627161225.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 i...
test_websocket_provider.py
import asyncio import pytest import sys from threading import ( Thread, ) import websockets from tests.utils import ( wait_for_ws, ) from web3 import Web3 from web3.exceptions import ( ValidationError, ) from web3.providers.websocket import ( WebsocketProvider, ) if sys.version_info >= (3, 8): fr...
app.py
from __future__ import absolute_import import flask from flask import Flask, jsonify, request import numpy as np import pandas as pd import json import os from pathlib import Path import threading import dash from dash import Dash import dash_html_components as html import dash_core_components as dcc import plotly.gra...
streaming.py
# Tweepy # Copyright 2009-2010 Joshua Roesslein # See LICENSE for details. # Appengine users: https://developers.google.com/appengine/docs/python/sockets/#making_httplib_use_sockets from __future__ import absolute_import, print_function import logging import re import requests import sys from requests.exceptions imp...
mqttwarn.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import paho.mqtt.client as paho # pip install paho-mqtt import logging import signal import sys import time from datetime import datetime try: import json except ImportError: import simplejson as json import Queue import threading import imp try: import hashl...
crs2_shared_memory.py
import random as rn import time import numpy as np import helpers as hp import functions as f import multiprocessing def get_centroid(x): return (np.sum(np.array(x), axis=0)/len(x)).tolist() def get_P(centroid, R_n_plus_1): doubled_G = [2*x for x in centroid] return [doubled_G[i] - R_n_plus_1[i] for i i...
unittest_targets.py
#!/usr/bin/env python3 # # Copyright (C) 2010-2020 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the License); you may # not use this file except in compliance with the License. # You may obtain a copy of the License at # ...
ovas.py
#Dependencies: #openvas_lib #pip install openvas_lib (or install from github) import sys import threading import Queue from openvas_lib import VulnscanManager, VulnscanException from output import * class AutoOpenvas(): def __init__(self): self.targets = [] def add_host(self, target): self.targets.append(ta...
io.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...
osx.py
from AppKit import * from PyObjCTools import AppHelper from Carbon.CarbonEvt import RegisterEventHotKey, GetApplicationEventTarget from Carbon.Events import cmdKey, controlKey import struct from threading import Thread from main import KeyboardHandler kEventHotKeyPressedSubtype = 6 kEventHotKeyReleasedSubty...
resource_lister.py
import jq from .common import Common, DefaultAnchor, DefaultDimension, DefaultBorder, SessionAwareDialog from .termui.alignment import TopRightAnchor, Dimension from .termui.dialog import DialogControl, DialogFieldLabel, DialogField from .termui.list_control import ListControl, ListEntry from .termui.ui import ControlC...
test_parallel_backend.py
# -*- coding: utf-8 -*- """ Tests the parallel backend """ import faulthandler import itertools import multiprocessing import os import random import subprocess import sys import threading import unittest import numpy as np from numba import jit, vectorize, guvectorize, set_num_threads from numba.tests.support impor...
sim.py
from enum import Enum from math import comb from assignment_models import ActionModel, DiscreteModel, RandomModel from environment import Environment import plotly.graph_objs as go import time from numpy.random import randint, default_rng import multiprocessing as mp from pandas import DataFrame, ExcelWriter from os im...
movo_jtas.py
"""-------------------------------------------------------------------- Copyright (c) 2017, Kinova Robotics inc. 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 mus...
test_ice.py
# The MIT License (MIT) # # Copyright (c) 2014-2017 Susam Pal # # 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, mo...
multiprocessing_1.py
#!/usr/bin/env python3 import multiprocessing import time import random def hello(n): time.sleep(random.randint(1,3)) print("[{0}] Hello!".format(n)) processes = [ ] for i in range(10): t = multiprocessing.Process(target=hello, args=(i,)) processes.append(t) t.start() for one_process in processe...
task.py
#coding: utf-8 # +------------------------------------------------------------------- # | 宝塔Linux面板 # +------------------------------------------------------------------- # | Copyright (c) 2015-2016 宝塔软件(http://bt.cn) All rights reserved. # +------------------------------------------------------------------- # | Author...
__init__.py
#!/usr/bin/env python # coding: utf-8 """Simple wrapper for python multiprocessing. .. include:: ../../README.md :start-line: 4 """ __all__ = ( "Process", "Queue", "__url__", "__version__", "__pubdate__", "__author__", "__email__", "__copyright__", "__license__", "Msg", ...
client_runner.py
import json import os import subprocess import sys import tempfile import threading import time from collections import deque from typing import Optional, Dict, Any from ray_release.anyscale_util import LAST_LOGS_LENGTH from ray_release.cluster_manager.cluster_manager import ClusterManager from ray_release.exception ...
test_settings.py
import copy import mock import os from stor import settings import threading import time import unittest test_settings = { 'swift:download': { 'container_threads': 10, 'object_threads': 10, 'shuffle': True, 'skip_identical': True }, 'swift:upload': { 'changed': False...
regrtest.py
#! /usr/bin/env python3 """ Usage: python -m test [options] [test_name1 [test_name2 ...]] python path/to/Lib/test/regrtest.py [options] [test_name1 [test_name2 ...]] If no arguments or options are provided, finds all files matching the pattern "test_*" in the Lib/test subdirectory and runs them in alphabetical orde...
kinect2grasp_python2.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author : Hongzhuo Liang # E-mail : liang@informatik.uni-hamburg.de # Description: # Date : 05/08/2018 6:04 PM # File Name : kinect2grasp_python2.py # Note: this file is written in Python2 import torch import rospy from sensor_msgs.msg import PointCloud2 fr...
exch_btcc.py
from befh.restful_api_socket import RESTfulApiSocket from befh.exchange import ExchangeGateway from befh.market_data import L2Depth, Trade from befh.util import Logger from befh.instrument import Instrument from befh.sql_client_template import SqlClientTemplate import time import threading from functools import partial...
data_utils.py
# Copyright 2018 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...
pod.py
#!/usr/bin/env python3 # MIT License # # Copyright (C) 2019-2020, Entynetproject. All Rights Reserved. # # 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 withou...
webrtc.py
# pure-Python webrtc implementation around gstreamer import socket import struct import random import datetime import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class RTCPeerConnection(): """ WebRTC connection encapsulation; provides Connection interface and lifecycle m...
main.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...
test_utils.py
# Copyright (c) 2010-2012 OpenStack Foundation # # 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 agree...
dropbox-script.py
#!/usr/bin/python # # Copyright (c) Dropbox, Inc. # # dropbox # Dropbox frontend script # This file is part of nautilus-dropbox 1.6.1. # # nautilus-dropbox 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, eithe...
tcp_server.py
# !/usr/bin/env python3 # -*- coding: utf-8 -*- #请结合本目录下tcp_client.py一起使用 import socket,time,threading def tcplink(sock, addr): print('Accept new connection from %s:%s...' % addr) sock.send(b'Welcome!') while True: data = sock.recv(1024) time.sleep(1) if not data or data.decode('ut...
input_reader.py
# coding=utf-8 # Copyright 2019 The Mesh TensorFlow 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 applicab...
run.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@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...
rmaics_ROS_auto_pub_with_action.py
# -*- coding: utf-8 -*- # RoboMaster AI Challenge Simulator (RMAICS) ''' using python2.7 wait for a signal to start the game step and broadcast every 0.1 second broadcasting tf: odom, base_link, map; #assume odom = map for convinence ''' from roborts_msgs.msg import GimbalAngle, GameStatus, GameResult, GameSurvivor, B...
mc_client.py
import subprocess import threading import asyncio import time from typing import List, TYPE_CHECKING if TYPE_CHECKING: from app.bot import CCBot class AlreadyRunnning(Exception): def __init__(self): super().__init__("The MC Server is already running!") class McClient: def __init__(self, path: s...
retry_failed.py
# Include standard modules import shutil import glob import json import os import subprocess import sys import time import distutils.spawn import urllib import logging import random from threading import Timer, Thread from urllib.parse import urlparse from constants import VERSION, LOG_DIR, LOG_FILE_PATH, UPLOADED_UUI...
server.py
from __future__ import annotations import multiprocessing as mp import random import threading from contextlib import contextmanager from functools import partial from pathlib import Path from typing import Dict, List, Optional, Tuple import torch from multiaddr import Multiaddr from hivemind.dht import DHT from hiv...
astra.py
import argparse import base64 import json import requests import time import ast import utils.logger as logger import utils.logs as logs import urllib.parse import hashlib import webbrowser import re from core.zapscan import * from core.parsers import * from utils.logger import * from core.login import APILogin from u...
utils.py
#================================================================ # # File name : utils.py # Author : PyLessons # Created date: 2020-09-27 # Website : https://pylessons.com/ # GitHub : https://github.com/pythonlessons/TensorFlow-2.x-YOLOv3 # Description : additional yolov3 and yolov4 functio...
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...
test_gauge.py
"""Unit tests for gauge""" # pylint: disable=protected-access # pylint: disable=too-many-lines from collections import namedtuple import random import re import shutil import tempfile import threading import time import os import unittest from unittest import mock from http.server import HTTPServer, BaseHTTPRequestH...
thread-crash.py
# Copyright (C) Jean-Paul Calderone # See LICENSE for details. # # Stress tester for thread-related bugs in ssl_Connection_send and # ssl_Connection_recv in src/ssl/connection.c for usage of a single # Connection object simultaneously in multiple threads. In 0.7 and earlier, # this will somewhat reliably cause Python ...
about_asyncio_threading.py
# -*- coding: utf8 -*- __author__ = 'wangqiang' ''' asyncio与threading多线程的应用 ''' import asyncio import threading import random def thr(i): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) loop.run_until_complete(do_stuff(i)) loop.close() async def do_stuff(i): await asyncio.sleep(ra...
test_urllib.py
"""Regresssion tests for urllib""" from __future__ import absolute_import, division, unicode_literals import io import os import sys import tempfile from nturl2path import url2pathname, pathname2url from base64 import b64encode import collections from future.builtins import bytes, chr, hex, open, range, str, int from...
monitor.py
# # Copyright Cloudlab URV 2021 # # 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 writin...
shell.py
from threading import Thread from libs.config import gget, alias, color, set_namespace from libs.myapp import send, base64_encode, is_windows, get_system_code from libs.app import readline, value_translation NEW_WINDOWS_WORDLIST = {"common_wordlist": ( "echo", "dir", "cd", "md", "rd", "tree", ...
server.py
import socket import threading # Connection Data host = '127.0.0.1' port = 55555 # Starting Server server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((host, port)) server.listen() # Lists For Clients and Their Nicknames clients = [] nicknames = [] # Sending Messages To All Connected Clients def br...
Code-03-Passing_Parameter_to_thread.py
''' DEVELOPER NAME : BALAVIGNESH.M IMPLEMENTED DATE: 16-11-2018 ''' import threading class SingleThreadparameter: def AddSum(self,num1,num2): print("The Given numbers Are {x} and {y}".format(x=num1,y=num2)) print("The Result is:", num1 + num2) single = SingleThreadparameter() tim = threading.T...
__init__.py
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistribu...
http_mock_handler.py
import re from threading import Thread import socket from http.server import BaseHTTPRequestHandler, HTTPServer import requests from tests.contansts import * class HttpMockHandler(BaseHTTPRequestHandler): @staticmethod def get_port(): socket_obj = socket.socket(socket.AF_INET, type=socket.SOCK_STREAM)...
processqueue.py
from multiprocessing import Process, Queue import os, time, random # 写数据进程执行的代码: def write(q): print('Process to write: %s' % os.getpid()) for value in ['A', 'B', 'C']: print('Put %s to queue...' % value) q.put(value) time.sleep(random.random()) # 读数据进程执行的代码: def read(q): print('Pr...
mqtt_wss_example_test.py
from __future__ import unicode_literals import os import re import ssl import sys from builtins import str from threading import Event, Thread import paho.mqtt.client as mqtt import ttfw_idf from tiny_test_fw import DUT event_client_connected = Event() event_stop_client = Event() event_client_received_correct = Even...
worker_ps_interaction_test.py
# Copyright 2020 The ElasticDL 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 applicable law...
server.py
import tornado.ioloop import tornado.web import tornado.escape import threading import asyncio import sys from myrobot import config import json conversation = None class BaseHandler(tornado.web.RequestHandler): def get_current_user(self): return self.get_secure_cookie('user') class MainHandler(BaseHa...
fasta.py
from bisect import bisect from contextlib import closing, contextmanager from itertools import accumulate, chain, islice, zip_longest from multiprocessing import Lock, RawValue from wrappers import Thread from os import cpu_count from re import sub from sys import argv, stdout output_file = open("bench_output-fasta_mp...
sync.py
""" This module is about synchronizing and coordinating events among concurrent activities. """ from contextlib import contextmanager, ExitStack import sys import threading import time import inspect from functools import wraps import re import logging import atexit import signal import os from collections import Cou...
ResultManager.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ================================================== # @Time : 2019-06-20 10:14 # @Author : ryuchen # @File : ResultManager.py # @Desc : # ================================================== import os import json import errno import socket import logging import threading im...
registry.py
""" This module should hold the registries responsible for managing different metric groups """ import asyncio from threading import Thread from logging import getLogger class RegistryCollisionException(Exception): pass class MeterRegistry: push_interval: int = None _meters = dict() _loop = asyncio....
dns_server.py
#!/usr/bin/env python # coding=utf-8 # MSF Bridge for reverse_dns transport # # Authors: Maxim Andreyanov, Alexey Sintsov # import argparse import sys import time import threading import SocketServer import struct import re import ssl import Queue import base64 import logging from logging.handlers ...
cluster.py
################################################################################ # Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors # # This file is a part of the MadGraph5_aMC@NLO project, an application which # automatically generates Feynman diagrams and matrix eleme...
process_queue.py
""" 进程间通信示例 """ from multiprocessing import Queue, Process q = Queue() # 解决问题 分支任务解决器 def handle(): while True: res = q.get() try: eval(f"{res}") # 执行这个语句 except Exception: print("程序有误") p = Process(target=handle, daemon=True) p.start() # 任务主线,随时提出任务,等待解决 while...
sign_cam.py
# -*- coding: utf-8 -*- # TODO: 다양한 정확도로 표지판을 인식해보고 적당한 경계값 찾아내기 (잘 안 된다) from module.pytorch_yolo import yolo from subroutine import Subroutine from data_class import Data from data_source import Source import time import numpy as np BUFFER_SIZE = 10 # 과거에 봤던 프레임을 남겨두고 한 프레임씩 밀면서 업데이트한다 class SignCam(Subroutine): ...
paper_preprocess.py
import argparse import os from copy import deepcopy import numpy as np from multiprocessing import Process from tqdm import tqdm import pandas as pd from elephant import spectral from barrylab_ephys_analysis.blea_utils import argparse_to_kwargs from barrylab_ephys_analysis.recording_io import check_if_analysis_field_...
fs.py
import json import os from threading import Thread from time import sleep def pather(*args): return "/".join([arg for arg in args]) def init(path, name): try: os.stat(pather(path, name)) except: os.mkdir(pather(path,name)) def write(key, value, path, name): with open(pather(...
port_scan_rec.py
from bson import json_util from bson.objectid import ObjectId import socket, threading from queue import Queue import pika import pymongo client = pymongo.MongoClient(open('mongo_string.txt').read()) db = client.test connection = pika.BlockingConnection( pika.ConnectionParameters(host='rabbitmq', heartbeat=0)) ch...
multi_processing.py
#!/usr/bin/env python3 import concurrent.futures import multiprocessing import os import random import time def wait(seconds): print(f'Waiting {round(seconds, 2)}s. PID: {os.getpid()}') time.sleep(seconds) return f'Done sleeping for {round(seconds, 2)}s' if __name__ == '__main__': start = time.perf_...
test_main.py
# -*- coding: utf-8 -*- """ Test module for poseidon.py Created on 28 June 2016 @author: Charlie Lewis, dgrossman, MShel """ import json import logging import os import time import redis from prometheus_client import Gauge from poseidon.constants import NO_DATA from poseidon.helpers.config import Config from poseido...
run.py
import speech_recognition as sr import serial import threading import csv from time import sleep usbport = '/dev/cu.usbmodem1411' # change the usb port ser = serial.Serial(usbport, 9600) flag = 0 sem = threading.Semaphore(1) value_begin = b'b' value_stop = b'.' value_right = b'r' value_left = b'l' def printData(): ...
Model.py
# AUM SHREEGANESHAAYA NAMAH|| AUM NAMAH SHIVAAYA|| # Connected Autonomous Vehicle (CAV) model class file import numpy as np import config from utils import dist, contiguous, objStr from numpy.random import poisson from threading import Thread class CAV: iter = None # iteration number ID, timestamp = None, 0 # mi...
fediplay.py
from os import environ, umask import shlex from subprocess import run from threading import Thread, Lock from lxml.etree import HTML import mastodon Mastodon = mastodon.Mastodon from youtube_dl import YoutubeDL class Queue(object): def __init__(self): self.lock = Lock() self.playing = False ...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
contool.py
""" 两个csv文件的比较 功能很简单 难点:有可能数据量会很大,十万条百万条的那种 所以不能一下就加载到内存中 """ import threading import time import traceback from pathlib import Path import queue import csv class Contool(object): def __init__(self): filepath = Path(__file__).parent # 输入文件夹 self.inputfile: Path = filepath / '_input' ...
httpclient_test.py
# -*- coding: utf-8 -*- import base64 import binascii from contextlib import closing import copy import threading import datetime from io import BytesIO import subprocess import sys import time import typing # noqa: F401 import unicodedata import unittest from tornado.escape import utf8, native_str, to_unicode from t...
deepwalk.py
import torch import argparse import dgl import torch.multiprocessing as mp from torch.utils.data import DataLoader import os import random import time import numpy as np from reading_data import DeepwalkDataset from model import SkipGramModel from utils import thread_wrapped_func, shuffle_walks, sum_up_params class D...
unit.py
import unittest import sys import os import re import time import shutil import tempfile import threading import errno sys.path.append(os.path.join("..", "src", "bin")) from web_ping import URLField, DurationField, WebPing, NTLMAuthenticationValueException from modular_input import Field, FieldValidationException fro...
swarm.py
# Adapted from boids implementation by Stephen Chappell # Accessed on 11/20/2012 at http://code.activestate.com/recipes/502240/ # Which was in turn motivated by the following pseudocode: # http://www.vergenet.net/~conrad/boids/pseudocode.html # Note: OSC messages (incoming and outgoing) are # normalized to the r...
q4_eval.py
# This file is used to evaluate the prioritized planning and genetic algorithm for task 4 import time import threading import numpy as np import pyglet from collections import deque from flatland.utils.rendertools import RenderTool from flatland.utils.graphics_pgl import RailViewWindow from utils.environment_utils ...
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from flask import Flask, request, redirect app = Flask(__name__) import logging logging.basicConfig(level=logging.DEBUG) import threading def show(text): title = str(threading.current_thread()) # Copy from: SimplePyScripts\windows__t...