source
stringlengths
3
86
python
stringlengths
75
1.04M
utils.py
from queue import PriorityQueue from threading import Thread EOF = b'' EMPTYLINE = b'\n' TAP = 'tap' TARGET = 'target' def run_thread(fn, args): thread = Thread(target=fn, args=args) thread.daemon = True thread.start() return thread def create_queue(maxsize=0): return PriorityQueue(maxsize)
process.py
# -*- coding: utf-8 -*- # Import python libs from __future__ import absolute_import, with_statement import copy import os import sys import time import errno import types import signal import logging import threading import contextlib import subprocess import multiprocessing import multiprocessing.util import socket ...
13_生产者消费者模型.py
import time import queue import threading q = queue.Queue() # 线程安全 def producer(id): """ 生产者 :return: """ while True: time.sleep(2) q.put('包子') print('厨师%s 生产了一个包子' % id) for i in range(1, 4): t = threading.Thread(target=producer, args=(i,)) t.start() def cons...
__init__.py
r""" ## streamcapture: capture the outputs of Python streams, such as sys.stdout and sys.stderr ### Author: Sébastien Loisel # Installation `pip install streamcapture` # Example usage ```python import streamcapture, sys, os print("This does not get saved to the log file") with streamcapture.StreamCapture(sys.stdou...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin Core 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 i...
viewing.py
#A* ------------------------------------------------------------------- #B* This file contains source code for the PyMOL computer program #C* Copyright (c) Schrodinger, LLC. #D* ------------------------------------------------------------------- #E* It is unlawful to modify or remove this copyright notice. #F* --------...
Abstract.py
import abc, threading, time, logging, traceback logger = logging.getLogger('danmu') # This client will auto-reload if exception is raised inside and write a log # it is deprecated once used # log of main start and thread is recorded # If you want to close it outside, just set the deprecated flag to True # Inside relo...
conftest.py
# SPDX-License-Identifier: MIT import multiprocessing import time import jeepney import jeepney.io.blocking import pytest from dbus_objects.integration import DBusServerBase from dbus_objects.integration.jeepney import BlockingDBusServer from dbus_objects.object import DBusObject, dbus_method, dbus_property from dbu...
test_mp_full.py
""" multiproc full tests. """ import multiprocessing import platform import pytest import time import six import wandb def train(add_val): time.sleep(1) wandb.log(dict(mystep=1, val=2 + add_val)) wandb.log(dict(mystep=2, val=8 + add_val)) wandb.log(dict(mystep=3, val=3 + add_val)) wandb.log(dict...
client.py
####################################################################### # File: client.py # Author: Jose Ortiz # Purpose: CSC645 Assigment #1 TCP socket programming # Description: Template client class. You are free to modify this # file to meet your own needs. Addi...
test_failure_2.py
import json import logging import os import signal import sys import threading import time import numpy as np import pytest import redis import ray from ray.experimental.internal_kv import _internal_kv_get from ray.autoscaler._private.util import DEBUG_AUTOSCALING_ERROR import ray._private.utils from ray.util.placeme...
run_spread.py
import multiprocessing from time import sleep from datetime import datetime, time from logging import INFO from vnpy.event import EventEngine from vnpy.trader.setting import SETTINGS from vnpy.trader.engine import MainEngine from vnpy.gateway.ctp import CtpGateway #from vnpy.app.cta_strategy import CtaStrategyApp #f...
miniterm.py
#!C:\dev\work\ScrapyCourse\venv\Scripts\python.exe # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import codecs import os import sys import threading import serial from...
wrapper.py
# Copyright (c) arlotito. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for full license information. import logging logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) import typing import threading import subprocess from os import listdir import re imp...
lSubtraction.py
# Lane Detection & Following - Subtraction ## Link to yt video: https://youtu.be/6PDmYAtLAKQ?t=12 import sys sys.path.append("../classes") sys.path.append("../lib") from romi import Romi from camera import Camera from servo import Servo from lSubtractionLib import laneRec from a_star import AStar from threadin...
_linux_driver.py
from __future__ import annotations import asyncio import os from codecs import getincrementaldecoder import selectors import signal import sys import termios from time import time import tty from typing import Any, TYPE_CHECKING from threading import Event, Thread if TYPE_CHECKING: from rich.console import Consol...
lesdb.py
''' Leader Election Shared Db File ''' from .leader import DbLeader from .sdb import SharedDataBase from time import sleep from ..utils.network import Tcp_Message, Void, Tcp_Sock_Reader, ServerTcp, Encode_Request, Decode_Response from socket import socket, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR from ..utils.logger impor...
trezor.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, versiontuple, UserCancelled from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT, is_address) from electrum import constants from electrum....
server.py
# -*- coding:utf-8 -*- # 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, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope tha...
test_socket.py
import unittest from test import support from test.support import os_helper from test.support import socket_helper from test.support import threading_helper import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform...
shawel.py
#!/usr/bin/python3 import requests, time, argparse, builtins, os, vk, multiprocessing from datetime import datetime from OpenSSL.SSL import Error as VeryError from requests import ReadTimeout, ConnectTimeout, HTTPError, Timeout, ConnectionError parser = argparse.ArgumentParser() parser.add_argument('-d','--debug', act...
__init__.py
import datetime import os import time import keyboard import random from json import load, loads import sys import pyjokes from tkinter import Tk import psutil from playsound import playsound import multiprocessing as mp import pywhatkit from tkinter.filedialog import askopenfilename from pywikihow impo...
testing.py
"""Testing utilities.""" import os import re import threading import functools from tempfile import NamedTemporaryFile from numpy import testing import numpy as np from ._warnings import expected_warnings import warnings from .. import data, io, img_as_uint, img_as_float, img_as_int, img_as_ubyte SKIP_RE = re.com...
botany.py
#!/usr/bin/env python3 import time import pickle import json import os import random import getpass import threading import errno import uuid import sqlite3 from menu_screen import * # TODO: # - Switch from personal data file to table in DB class Plant(object): # This is your plant! stage_list = [ 's...
test_logging.py
#!/usr/bin/env python # # Copyright 2001-2012 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright n...
test10.py
# ---------------------------------------------- # -*- coding: utf-8 -*- # @Time : 2020-03-04 16:38 # @Author : 吴林江 # @Email : wulinjiang1@kingsoft.com # @File : test10.py # ---------------------------------------------- import redis import uuid import time from threading import Thread redis_client = redis.R...
dataloader_iter.py
# Copyright (c) 2020 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 appli...
consumer.py
""" Copyright European Organization for Nuclear Research (CERN) Licensed under the Apache License, Version 2.0 (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Authors: - Wen Guan, <wguan@...
wrappers.py
# This code is mainly excerpted from openai baseline code. # https://github.com/openai/baselines/blob/master/baselines/common/atari_wrappers.py import cv2 import gym import numpy as np from gym import spaces from collections import deque from abc import ABC, abstractmethod from multiprocessing import Process, Pipe fro...
main.py
# encoding: utf-8 import sys import re import cv2 from graph import * import face_inference import Head_pose_inference import client import threading import time import ChannelManager lenofUrl = len(sys.argv) # The number of parameters is incorrect. if lenofUrl <= 1: print("[ERROR] Please input mp4/Rtsp URL") ...
test_mix.py
import pdb import copy import pytest import threading import datetime import logging from time import sleep from multiprocessing import Process import sklearn.preprocessing from milvus import IndexType, MetricType from utils import * dim = 128 index_file_size = 10 table_id = "test_mix" add_interval_time = 2 vectors = ...
move_data_fast.py
""" Script to move data fast using multiprocessing and shutil Usage: python move_data_fast.py <source_dir> <target_dir> <start_episode_num> <end_episode_num> """ import os import sys import numpy as np import shutil import time import multiprocessing source_dir = sys.argv[1] target_dir = sys.argv[2] def copy_episod...
simulated.py
# -*- coding: utf-8 -*- """ Created on Wed Dec 13 09:04:00 2019 @author: lladeira """ import io import os import sys import warnings import random from random import gauss import multiprocessing from multiprocessing import Process from multiprocessing import Manager import threading import numpy as np import pandas ...
run.py
#! /usr/bin/env python3 # # Copyright (C) 2017-2021 Open Information Security Foundation # # 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 ...
client.py
# -*- coding: utf-8 -*- # # Copyright (C) 2007-2009 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. from datetime import datetime import os import os.path import shutil import time import tempfile imp...
test.py
import gzip import json import logging import os import io import random import threading import time import helpers.client import pytest from helpers.cluster import ClickHouseCluster, ClickHouseInstance, get_instances_dir from helpers.network import PartitionManager from helpers.test_tools import exec_query_with_retr...
coap.py
import logging.config import os import random import socket import struct import threading from coapthon import defines from coapthon.layers.blocklayer import BlockLayer from coapthon.layers.messagelayer import MessageLayer from coapthon.layers.observelayer import ObserveLayer from coapthon.layers.requestlayer import ...
my_little_piano_app.py
""" * In HTML and using JavaScript we will call special functions that * will play a specific note on the buzzer when any key of the piano * is pressed. Also we have 3 pages on the web, one for single octave piano, * another for three octave piano, and last one are for the sample songs. * You can enable those song...
base_test.py
# -*- coding: utf-8 -*- import contextlib import copy import datetime import json import threading import elasticsearch import mock import pytest from elasticsearch.exceptions import ElasticsearchException from elastalert.enhancements import BaseEnhancement from elastalert.kibana import dashboard_temp from elastalert...
kdf_estimation.py
# This is some old code used to try and extrapolate parameter cost # from some sample measurements. In the end I decided to throw it # all out and just do the following: # # 1. measure the maximum memory that can be used # 2. scale t to get the desired duration # # This change is motivated by # # 1. the desire to...
test_dxlclient.py
# -*- coding: utf-8 -*- ################################################################################ # Copyright (c) 2018 McAfee LLC - All Rights Reserved. ################################################################################ """ Test cases for the DxlClient class """ # Run with python -m unittest dxlc...
build_image_data.py
"""Converts image data to TFRecords file format with Example protos. The image data set is expected to reside in JPEG files located in the following directory structure. data_dir/label_0/image0.jpeg data_dir/label_0/image1.jpg ... data_dir/label_1/weird-image.jpeg data_dir/label_1/my-image.jpeg ... where...
kivy.py
#!/usr/bin/env python3 import asyncio import kivy kivy.require('1.10.0') # kivy.Logger.disabled = True import logging import threading import traceback from kivy.app import App from kivy.core.window import Window from kivy.properties import ObjectProperty, BooleanProperty, NumericProperty from kivy.lang import Builde...
scan_helper_jpg_resize_percentage.py
# -*- coding: utf-8 -*- # version: python 3 # ========== # 作用: # imagemagick处理图片(缩放) # 多进程处理 # ========== # 依赖项: # https://github.com/ImageMagick/ImageMagick/issues/594 # brew install imagemagick@6 # ========== import sys, os, time from multiprocessing import Process, Queue path = '/Users/osx/Desktop/test' # 处理目录【修改...
periodic_timer.py
# -*- encoding: utf-8 -*- import threading import time class PeriodicTimer: def __init__(self, interval): self._interval = interval self._flag = 0 self._cv = threading.Condition() def start(self): t = threading.Thread(target=self.run) t.daemon = True t.start()...
dataset.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...
sadtool.py
#!/usr/bin/python27 # Demo version 1.0.0 # SadCode.org # this software was created just for penetration testing and information gathering! # So we don't Accept any responsibility for any illegal usage. # Coded By VanGans import sys try: import hashlib except ImportError: print '---------------------------------...
TrendScoreToDatabase.py
""" Author: John Andree Lidquist, Marten Bolin Date: Last update: 2017/11/21 Albin Bergvall Purpose: Gets movie from database and stores a trending score """ from datetime import datetime import threading import os from apscheduler.schedulers.background import BackgroundScheduler from Product.TrendManager.TwitterAPI ...
ForwardEntnahmerate.py
''' Mit der Forward-Entnahmerate steigert Jana ihr Budget um 38% https://www.finanzen-erklaert.de/forward-entnahmerate/ ''' import pandas as pd import time from SEsimulation.mDate import mDate from SEsimulation import SEsimulation import numpy as np import plotly.express as px from tabulate import tabulate import mu...
model_service_worker.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # http://www.apache.org/licenses/LICENSE-2.0 # or in the "license" file...
test_parser.py
#!/usr/bin/env python import re import random import string import threading from tests import unittest, OrderedDict from jmespath import parser from jmespath import visitor from jmespath import ast from jmespath import exceptions class TestParser(unittest.TestCase): def setUp(self): self.parser = parser...
teamsPresence.py
# !/usr/bin/env python # Python script to show Teams presence status on led # Author: Maximilian Krause # Date 04.11.2020 version = 1.4 workday_start = None workday_end = None workdays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"] width = 0 height = 0 blinkThread = None after_work = False globalRed = 0 gl...
viz.py
import time import argparse import torch import scipy import numpy as np import open3d as o3d from queue import Empty from multiprocessing import Queue, Process from scipy.spatial.transform import Rotation def pose_matrix_from_quaternion(pvec): """ convert 4x4 pose matrix to (t, q) """ pose = np.eye(4) po...
augment.py
from __future__ import division, unicode_literals import functools import re import threading import typing import http.server if typing.TYPE_CHECKING: from .common import FileDownloader from ..postprocessor.metadataparser import MetadataParserPP from ..utils import ( sanitized_Request, ) class Augment(): ...
websocket.py
from homebrain import Agent, Dispatcher, Event from websocket_server import WebsocketServer import threading import logging import json class WebSocket(Agent): autostart = True def __init__(self): super(WebSocket, self).__init__() self.target = self.identifier self.server = Websocke...
thumbnail_maker.py
# thumbnail_maker.py import time import os import logging from urllib.parse import urlparse from urllib.request import urlretrieve from queue import Queue from threading import Thread import PIL from PIL import Image FORMAT = "[%(threadName)s, %(asctime)s, %(levelname)s] %(message)s" logging.basicConfig(filename='log...
sniffer.py
"""Sniff inbound requests to the server """ from scapy.all import * from datarecv import DataReceiver from command.cmdqueue import CommandQueue from utils.consts import log class Sniffer(): def __init__(self, interface, packet_filter, rel_path, cmd_file, config): self.interface = interface self.bp...
background.py
"""Run a full background program that launches and manages a ConsoleWidget.""" from console.widget import ConsoleWidget import io import logging import multiprocessing import sys import threading import tkinter as tk from tkinter import messagebox logger = logging.getLogger(__name__) # Show a default menu bar. def _...
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...
GoalTCPServer.py
#Socket server handler class #------------------------------------------------------------------------------- # IMPORTS #------------------------------------------------------------------------------- import Queue import SocketServer import threading #-----------------------...
queues.py
from __future__ import print_function from __future__ import division from __future__ import absolute_import import logging import os from multiprocessing import Process, Queue, Event, Lock from ..core.constants import BATCH, REALTIME, GPU, CPU, LOGGING_LEVEL from ..core.node import Node, ProducerNode, ConsumerNode,...
train_entry_point.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "l...
main.py
import sys sys.path.append('source') # Добовление дерикторию импорта import time import colorama import threading import functions from cfg import * from requests import get from progress.bar import ShadyBar # --- Инициализация colorama'ы --- # colorama.init() # --- Выбор протокола proxy --- # # Если значение пр...
request_block.py
import logging import os import sys import time from threading import Thread # append project dir to python path from labchain.network import networking from labchain.datastructure.block import Block from labchain.datastructure.transaction import Transaction from tests.test_account import MockCryptoHelper f...
02_0_manual_create_process.py
#! /root/anaconda3/bin/python """ (base) [root@k8s-ansible ~]# cat /proc/40498/status | grep Threads Threads: 1 (base) [root@k8s-ansible ~]# cat /proc/40499/status | grep Threads Threads: 1 看进程的线程 """ import time from multiprocessing import Process from multiprocessing import current_process print('父进程启动(%d--%s)' % (c...
start.py
#!/usr/bin/python3 import os import glob import shutil import multiprocessing import logging as log import sys from podop import run_server from socrate import system, conf log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "WARNING")) def start_podop(): os.setuid(100) url = "http://" + ...
replay_buffer.py
import queue as Queue from random import shuffle from random import seed seed(123) from threading import Thread import numpy as np import time import tensorflow as tf try: import Queue as Q # ver. < 3.0 except ImportError: import queue as Q from sklearn.preprocessing import normalize PriorityQueue = Q.PriorityQue...
mainscreen.py
# coding:utf8 import time import traceback from threading import Thread from kivy.app import App from uix.widgets import ColoredScreen from bot import utils class MainScreen(ColoredScreen): def __init__(self, **kwargs): super(MainScreen, self).__init__(**kwargs) self.app = App.get_running_app...
main.py
import wx from convert_to_opus import converter import os import sys class RedirectText(object): # Redirects console output to wx panel def __init__(self, aWxTextCtrl): self.out = aWxTextCtrl def write(self, string): self.out.WriteText(string) class windowClass(wx.Frame): def __init__(...
dask.py
# pylint: disable=too-many-arguments, too-many-locals, no-name-in-module # pylint: disable=missing-class-docstring, invalid-name # pylint: disable=too-many-lines, fixme # pylint: disable=too-few-public-methods # pylint: disable=import-error """Dask extensions for distributed training. See https://xgboost.readthedocs.io...
move.py
import os,sys,subprocess,shutil from threading import Thread from concurrent.futures import ThreadPoolExecutor, wait milo = input('输入文件夹:') if milo =='1': milo = 'milo' elif milo == '2': milo = 'milo2' elif milo == '3': milo ='milo3' filepath = '/home/{}/b/Twitch'.format(milo) files = os.listdir(filepath) d...
article_analysis_test.py
import inspect import logging import socket import sys import threading import time import unittest from modules import article_analysis from modules.protocol import net from modules.protocol import types def load_tests(loader, tests, pattern): suite = unittest.TestSuite() for (name, obj) in inspect.getmembe...
OptimizeRasters.py
# ------------------------------------------------------------------------------ # Copyright 2018 Esri # 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/LICEN...
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...
pabot.py
#!/usr/bin/env python # Copyright 2014->future! Mikko Korpela # # 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 ...
apollo_client.py
# -*- coding: utf-8 -*- import json import logging import sys import threading import time import requests class ApolloClient(object): def __init__(self, app_id, cluster='default', config_server_url='http://localhost:8080', timeout=35, ip=None): self.config_server_url = config_server_url self.app...
presence_adapter.py
"""Presence Detection adapter for Mozilla WebThings Gateway.""" from datetime import datetime, timedelta from gateway_addon import Adapter, Database import json import os import re import threading import time import subprocess import socket from .presence_device import PresenceDevice from .util import * _CONFIG...
feeder.py
from sklearn.model_selection import train_test_split from synthesizer.utils.text import text_to_sequence from synthesizer.infolog import log import tensorflow as tf import numpy as np import threading import time import os _batches_per_group = 16 class Feeder: """ Feeds batches of data into queue on a bac...
updater.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Update HTPC Manager from Github. Either through git command or tarball. Updater and SourceUpdater written by styxit https://github.com/styxit Git updater written by mbw2001 https://github.com/mbw2001 Used as reference: - https://github.com/mrkipling/maraschino - htt...
test_worker.py
import multiprocessing import os import time from fooster.web import web import mock import pytest @pytest.mark.xfail def test_worker_shutdown(): sync = multiprocessing.get_context(web.start_method).Manager() server = mock.MockHTTPServer(sync=sync) process = multiprocessing.get_context(web.start_meth...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from actilectrum.storage import WalletStorage, StorageReadWriteError from actilectrum.wallet_db import WalletDB f...
open-nti.py
#!/usr/bin/env python # coding: utf-8 # Authors: efrain@juniper.net psagrera@juniper.net # Version 2.0 20160124 from datetime import datetime # In order to retreive time and timespan from datetime import timedelta # In order to retreive time and timespan from influxdb import InfluxDBClient from pyez_mock import mock...
Manipulator.py
# This Python file uses the following encoding: utf-8 import numpy as np from Constants import * from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from opengl_drawing_tools import * from Column import * import sensor from World_Components import * from stl_loader import * class Joint(Hang...
batch_ops_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
unsplash_crawler.py
# coding=utf-8 ''' @Author: Kyle @Date: 2020-03-06 13:57:33 @LastEditors: Kyle @LastEditTime: 2020-03-28 11:07:43 @Description: @FilePath: /MarkdownToWordPress/unsplash_crawler.py ''' import sys import requests import json from urllib.parse import unquote from urllib.request import urlretrieve import threading # htt...
tablet.py
import serial from paint import Paint import threading import queue ASCII = "za" VERSION = "z?" HIGHRES = "v" SENDCONFIG = "a" ser = serial.Serial("/dev/ttyS0",9600,parity=serial.PARITY_ODD) def run_command(command='',read=True,prefix="",chop=False,process=False): if command != '': b = command.encode('a...
web.py
import click import tensorflow as tf from flask import Flask, jsonify, request, render_template from threading import Thread from PIL import Image from six.moves import _thread from luminoth.tools.checkpoint import get_checkpoint_config from luminoth.utils.config import get_config, override_config_params from luminot...
widget.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) The widget is called from web2py ---------------------------------- """ from __future__ import print_...
SoftWare_main.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os # os.environ["CUDA_VISIBLE_DEVICES"] = "7" # import _init_paths import torch.multiprocessing as mp import logging import os import signal from FairMot.lib.tracking_utils.utils import mkdir_if_missin...
test_server_client.py
from threading import Thread from typing import Tuple import pytest from singa import tensor from src.client.app import Client from src.server.app import Server from ..helpers.conftest import server_client_single def test_start(): server = Server(num_clients=1) client = Client(global_rank=0) thread_s =...
Level.py
import random import Tile import string import math import RobotAI import socket import threading class Level(): def __init__(self,w,h): self.width = w self.height = h self.loadLevelFromFile("levels/Arena.txt") #self.generateLevel() self.ticks=0 self.player = None self.entities = [] self.hasAStarW...
test_singletonperthread.py
import uuid from multiprocessing import Queue from threading import Thread, currentThread from azurelinuxagent.common.singletonperthread import SingletonPerThread from tests.tools import AgentTestCase, clear_singleton_instances class TestClassToTestSingletonPerThread(SingletonPerThread): """ Since these test...
core.py
# -*- coding: utf-8 -*- import os import sys import shlex import signal import subprocess import threading import traceback __version__ = '0.1.1' def _terminate_process(process): if sys.platform == 'win32': import ctypes PROCESS_TERMINATE = 1 handle = ctypes.windll.kernel32.OpenProcess(P...
main.py
################################################################################ ### a big thanks to Hemanth Nag for his tutorial: ########## # https://towardsdatascience.com/camera-app-with-flask-and-opencv-bd147f6c0eec # #############################################################################...
IndexFiles.py
# SJTU EE208 INDEX_DIR = "IndexFiles.index" import sys, os, lucene, threading, time, math from datetime import datetime # from java.io import File from java.nio.file import Paths from org.apache.lucene.analysis.miscellaneous import LimitTokenCountAnalyzer from org.apache.lucene.analysis.standard import StandardAnaly...
train_model.py
""" This function will train the model """ # import multiprocessing # from multiprocessing import Manager import threading import tensorflow as tf import numpy as np import time import random from copy import deepcopy import os from hashlib import sha512 import matplotlib.pyplot as plt import matplotlib from tkinter ...
process.py
# ############################################## # # The MIT License (MIT) # # Copyright (c) 2018 Kevin Walchko # # see LICENSE for full details # ############################################## # from __future__ import print_function # import multiprocessing as mp # from pygecko.transport import zmqTCP # # # class Geck...
InitialDataConcurent.py
import pandas as pd import os import numpy as np from multiprocessing import Process class InitialDataConcurent: def LoadAllFile(self): self.threadsCount = 8 p = Process(target=self.LoadStatusMaintenance) p.start() print("Cobas") self.LoadFlightSchedule...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import json import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH...
headset.py
import threading import usb.core import usb.util class Headset(): def __init__(self): self._dev = None self._thread = None self._battery_level = None self._power_button = None self._vol_up_button = None self._vol_down_button = None self._power_state = None ...