source
stringlengths
3
86
python
stringlengths
75
1.04M
ColorDetect.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ File name: "ColorDetect.py" Date created: 11/24/2017 Date last modified: 1/12/2018 Python Version: 3.6 A simple script for detecting and tracking tarps/squares based on there on their color. """ __author__ = "Hicham Belhseine" __email__ = "hichambelhseine...
WikiExtractor.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ============================================================================= # Version: 3.0 (July 22, 2020) # Author: Giuseppe Attardi (attardi@di.unipi.it), University of Pisa # # Contributors: # Antonio Fuschetto (fuschett@aol.com) # Leonardo Souza (lsouza@amte...
NTGrun.py
#-*- coding:utf-8 -*- import NTGGetCore import NTGMoreFunction import total import NTG_base import os import threading import re import json import base64 import tkinter.messagebox def about(COOKIE): print() def MutiSave(COOKIE, Surl, Pwd, Path, part, bt): ''' 先用GetRandsk获取Randsk 再...
08_texture_arrays.py
import sys, os #get path of script _script_path = os.path.realpath(__file__) _script_dir = os.path.dirname(_script_path) pyWolfPath = _script_dir if sys.platform == "linux" or sys.platform == "linux2": print "Linux not tested yet" elif sys.platform == "darwin": print "OS X not tested yet" elif sys.platform ==...
grid_tools.py
import numpy as np from numpy.fft import fft, ifft, fftfreq, rfftfreq from astropy.io import ascii,fits from scipy.interpolate import InterpolatedUnivariateSpline, interp1d from scipy.integrate import trapz from scipy.special import j1 import multiprocessing as mp import sys import gc import os import bz2 import h5py ...
executor.py
"""HighThroughputExecutor builds on the Swift/T EMEWS architecture to use MPI for fast task distribution There's a slow but sure deviation from Parsl's Executor interface here, that needs to be addressed. """ from concurrent.futures import Future import os import time import logging import threading import queue impo...
vrtderived.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test AddBand() with VRTDerivedRasterBand. # Author: Antonio Valentino <a_valentino@users.sf.net> # ########################################...
run.py
# -*- coding: utf-8 -*- """ Created on Tue Jul 11 18:48:04 2017 @author: Yugal """ from keras.models import model_from_json from keras.preprocessing.image import ImageDataGenerator import cv2 import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import threading from matplotlib.p...
07-attach.py
#!/usr/bin/env python """Test attach runs.""" import multiprocessing as mp import wandb import yea def process_child(attach_id): run_child = wandb.attach(attach_id=attach_id) run_child.config.c2 = 22 run_child.log({"s1": 21}) run_child.log({"s2": 22}) run_child.log({"s3": 23}) print("child o...
AccessibleScala.py
import sublime import sublime_plugin import threading import subprocess import os import re client = None def plugin_loaded(): global client if not client: client = AccessibleScalaClient() def plugin_unloaded(): global client if client: del client def runCommandRange(view, direction): file = vie...
logging_util.py
# Copyright 2018 Jetperch LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
x.py
import argparse import importlib.util import logging import signal import sys import os import traceback from multiprocessing import get_context import typing from typing import List, Text, Optional import ruamel.yaml as yaml from rasa.cli.utils import get_validated_path, print_warning, print_error from rasa.cli.argu...
utils.py
import asyncore import base64 import cherrypy import email import errno import json import os import six import smtpd import socket import threading import time from six import BytesIO from six.moves import queue, range, urllib _startPort = 31000 _maxTries = 100 class MockSmtpServer(smtpd.SMTPServer): mailQueue...
test_basic.py
# -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Copyright (c) 2005-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is...
start_regtest.py
import json import os import sys import subprocess from subprocess import PIPE import time import threading class Node: def __init__(self, node_root, bin_path, port, rpc_port): self.node_root = node_root self.bin_path = bin_path self.conf = self.node_root + '/qtum.conf' self.port = ...
api.myjson.com.py
#!/usr/bin/python3 import time import json import requests from queue import Queue from threading import Thread url = 'http://api.myjson.com/bins/' # 5 * # https://api.myjson.com/bins/ncAes def getChars(*args): args = iter(args) for c1 in args: c2 = next(args) for c in range(ord(c1), ord(c2) ...
utils.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # from __future__ import annotations import csv import itertools import logging import math import threading from collections import defaultdict from dataclasses import Field, field as dataclass_field, fields as dataclass_fields from typing impor...
pitmGovernor.py
#!rusr/bin/python # piTempMonitor Controller import urllib2 import re import json import hashlib import os import struct import socket import syslog import sys import threading import time from pitmCfg import pitmCfg from pitmLCDisplay import pitmLCDisplay from pitmLedFlasher import * from gpiotools2 import * class ...
server.py
r''' Copyright 2014 Google 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 applicable law or agreed to i...
queued_multiprocessor.py
from multiprocessing import JoinableQueue, Queue, Process import os import signal import time import setproctitle class QueuedMultiProcessor: STOP_SIGNAL = "STOP" QUEUE_SIZE = 1500 SLEEP_IF_FULL = 0.01 def __init__( self, stream, worker, writer, worker_setup=N...
appids_manager.py
#!/usr/bin/env python # coding:utf-8 import random import threading import time from config import config from proxy import xlog import check_ip class APPID_manager(object): lock = threading.Lock() def __init__(self): if len(config.GAE_APPIDS) == 0: xlog.error("No usable appid left, add...
yahoo_finance.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This script provides a basic access to yahoo finance data. Copyright (c) 2018, Jan-Christopher Magel License: MIT (see LICENSE for details) """ from __future__ import division try: from cStringIO import StringIO except ImportError: from io import StringIO imp...
RobotModel.py
import json from os import wait import time import math import threading from .HardwareModel import HardwareModel from .BehaviorModel import BehaviorModel eRobotState_VOID = 0 eRobotState_LOAD = 1 eRobotState_WAKE = 2 eRobotState_RUN = 3 eRobotState_DROWZEE = 4 eRobotState_SLEEP = 5 class RobotModel: def __init__(...
NetsbloxController.py
import socket import uuid import time import numpy as np import select import random import math import serial import sys sys.path.append("/home/pi/") #print(sys.path) import traceback from teachablerobots.src.Sense import Sense from teachablerobots.src.Hardware import * import ast from multiprocessing import Process, ...
test_executor_sequential.py
# Copyright 2016-2018 Dirk Thomas # Licensed under the Apache License, Version 2.0 import asyncio from collections import OrderedDict import os import signal import sys from threading import Thread import time from colcon_core.executor import Job from colcon_core.executor import OnError from colcon_core.executor.sequ...
main.py
#!/usr/bin/env python import rospy import time from std_msgs.msg import Int32 from geometry_msgs.msg import Twist from std_msgs.msg import Bool import numpy as np import threading import os ################################################################################ DEBUG debug_disable_hilens = os.getenv('DEBUG_N...
mpProcess.py
import os import time from multiprocessing import Process def seconds_timer(end_time): start_time = time.time() while True: time.sleep(0.001) if time.time() - start_time >= end_time: break proc = os.getpid() print('{0} seconds have elapsed by process id: {1}'.format(end_tim...
multi_thread_producer_consumer_class_summary.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), "../")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../")) from producer_consumer_class_summary import ProducerConsumerClassSummary import pyximport pyximport.instal...
GPShandler.py
""" GPShandler.py Code to manage the Dragino GPS device provides non-blocking access using GPSD """ import logging from threading import Thread try: from gps3 import agps3 except: import gpsd import json from time import time from datetime import datetime,timedelta DEFAULT_LOG_LEVEL=logging.INFO class GP...
MouseCTRL.py
import cv2 import numpy as np import time import autopy import mediapipe as mp import math import wx import threading thread = None # noinspection PyAttributeOutsideInit,PyShadowingNames class TraceThread(threading.Thread): def __init__(self, *args, **keywords): threading.Thread.__init__(self, *args, **ke...
advanced-reboot.py
# #ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";d...
member.py
from django.forms.formsets import formset_factory from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect from django.contrib import messages from django.contrib.auth.decorators import user_passes_test from django.core.mail import EmailMessage from django.core.paginator impor...
ImgToText.py
from PIL import Image from pytesseract import * import cv2 import multiprocessing def ocrToStr(img, lang, idx, rd): # zoom twice. img_result = cv2.resize(img, None, fx=2, fy=2, interpolation=cv2.INTER_CUBIC) # Page segmentation modes(psm): # 0 Orientation and script detection (OSD) only. # 1 ...
cnn_util_test.py
# coding=utf-8 # Copyright 2020 The Google Research 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...
tests.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import errno import os import shutil import sys import tempfile import threading import time import unittest from datetime import datetime, timedelta from django.core.cache import cache from django.core.exceptions import SuspiciousFileOperation, Suspicio...
processor_scheduled_events.py
""" Copyright BOOSTRY Co., Ltd. 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, software distr...
pyrelay.py
from ClientManager import ClientManager from PluginManager import loadPlugins from Client.Client import Client from Helpers.Servers import update import Helpers.Equip as EquipParser import Constants.ApiPoints as api import json import time import threading import argparse import os import requests VERSION...
__init__.py
##################################################################### # # # /__init__.py # # # # Copyright 2013, Monash University ...
test_auto_scheduler_measure.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 u...
gameOver.py
from matrix import * from stringIO import * import pygame as pg import random import LED_display as LMD import threading import time import timeit import keyboard def num_matrix(number, size): if size == "small": if number == 0: return zero elif number == 1: return one ...
__init__.py
# -*- coding: utf-8 -*- """ keyboard ======== Take full control of your keyboard with this small Python library. Hook global events, register hotkeys, simulate key presses and much more. ## Features - **Global event hook** on all keyboards (captures keys regardless of focus). - **Listen** and **send** keyboard event...
xAPIConnector.py
import json import socket import logging import time import ssl from threading import Thread # set to true on debug environment only DEBUG = True #default connection properites DEFAULT_XAPI_ADDRESS = 'xapi.xtb.com' # DEFAULT_XAPI_PORT = 5124 # Demo account port # DEFUALT_XAPI_STREAMING_PORT = 5125...
run_stella.py
#!/usr/bin/env python3 import os import sys import argparse import logging from io import IOBase from sys import stdout from select import select from threading import Thread from time import sleep from io import StringIO import shutil from datetime import datetime import numpy as np logging.basicConfig(filename=d...
fuzzer.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
_asyncio.py
import asyncio import concurrent.futures import inspect import math import os import socket import sys from collections import OrderedDict from functools import partial from threading import Thread from typing import ( Callable, Set, Optional, Union, Tuple, cast, Coroutine, Any, Awaitable, TypeVar, Generator, L...
tasks.py
# -*- coding: utf-8 -*- # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python from collections import OrderedDict, namedtuple import errno import functools import importlib import json import logging import os import shutil import stat import tempfile import time import traceback from distutils.dir_util ...
SoftWare_main_backup.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.opts import opts from FairMot.lib.tracking_u...
ble_connector.py
# Copyright 2022. ThingsBoard # # 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 ...
autoscaling_metrics.py
import threading import bisect from collections import defaultdict import time from typing import Callable, DefaultDict, Dict, List, Optional from dataclasses import dataclass, field import ray def start_metrics_pusher(interval_s: float, collection_callback: Callable[[], Dict[str, float]], ...
webserver.py
from flask import Flask, request, send_file, render_template, jsonify import urllib3 from gtts import gTTS import configparser import json import requests import base64 from naoqi import ALProxy from flask_socketio import SocketIO from threading import Thread import pyaudio import wave my_server = Flask(__name__) soc...
jira_service.py
from PyQt5.QtCore import QObject, QTimer, QSettings import threading from jira import JIRA from datetime import datetime from ticket_history_model import TicketHistoryModel, Base from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker class JiraService(QObject): def __init__(self): ...
graph-size-degree-trim.py
#! /usr/bin/env python2 # # This file is part of khmer, http://github.com/ged-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2013. It is licensed under # the three-clause BSD license; see doc/LICENSE.txt. # Contact: khmer-project@idyll.org # import khmer import sys import screed import os.path impor...
preview_window.py
"""preview_window.py - previews datasets for the Advanced NDE of Composites Project Chris R. Coughlin (TRI/Austin, Inc.) """ from controllers.preview_window_ctrl import PreviewWindowController from controllers import pathfinder from models import workerthread from models.mainmodel import get_logger from views import ...
test_client.py
import asyncio from collections import deque from contextlib import suppress from functools import partial import gc import logging from operator import add import os import pickle import psutil import random import subprocess import sys import threading from threading import Semaphore from time import sleep import tra...
lobby.py
__author__ = 'croxis' '''This will require a more advanced ecs module than what we have now. Will need to refactor later. We do not use spacedrive here as we don't want to start up ecs. This is for MULTIGAME lobby and management. Single game lobby works different. ''' from multiprocessing import Process from direct.dir...
main.py
# coding=utf-8 import threading import time import sys import random from PyQt5.QtWidgets import QMainWindow, QApplication, QDesktopWidget, QLabel, QVBoxLayout from PyQt5.QtGui import QIcon import linecache settingPath = "settings.wl" text = "<h1><font color={}>{}</font></h1>" try: title = linecache.getline(settin...
mb2mqtt.py
from pyModbusTCP.client import ModbusClient import paho.mqtt.client as mqtt from time import sleep from threading import Thread import sys class ClienteMODBUS(): """ Classe Cliente MODBUS """ def __init__(self,server_addr,porta,device_id,broker_addr,broker_port,scan_time=0.2): """ Con...
ck_cnnlstm_oppo.py
# 這個文件直接執行是給GCP用的 from obstacle_tower_env import ObstacleTowerEnv import numpy as np import tensorflow as tf import threading import queue # 運行環境設定: # 設置幾個代理 N_WORKER = 6 # 代理人自己更新的步數 EP_LEN = 500 # 最大訓練回合數(每個代理人加起來的回合) EP_MAX = N_WORKER * 200 # 設定更新整個模型:每個代理走了N步就更新 UPDATE_STEP = 20 # 本身是循環更新步 MIN_BAT...
test_gil_scoped.py
import multiprocessing import threading from pybind11_tests import gil_scoped as m def _run_in_process(target, *args, **kwargs): """Runs target in process and returns its exitcode after 1s (None if still alive).""" process = multiprocessing.Process(target=target, args=args, kwargs=kwargs) process.daemon =...
wxRaven_CodeEditorLogic.py
''' Created on 16 févr. 2022 @author: slinux ''' import logging from .CodeEditorEngine import * from .wxRavenShellDesign import * import threading import time from wxRavenGUI.application.wxcustom import * import wx.lib.mixins.listctrl as listmix from datetime import date import datetime from plugins.RavenRPC...
Ensemble.py
''' Created on Mar 23, 2019 @author: Gias ''' import os import re import pandas as pd import nltk from nltk.stem.snowball import SnowballStemmer from imblearn.over_sampling import SMOTE from statistics import mean import cPickle as pickle import numpy as np import argparse import csv from django.con...
s.py
import socket import threading import teleApi as tg import os import re import getFile import time # space for all clients and their corrosponding addrs all_clients=[] all_addr = [] # server info host = "localhost" port = 24980 headerLength = 100 #create socket serv = socket.socket() serv.setsockopt(socket.SOL_SOCK...
spin.py
import threading from magicbandreader.handlers import AbstractHandler from magicbandreader.led import LedColor class SpinHandler(AbstractHandler): """ Spins the lights around the main ring.""" def __init__(self, ctx): super().__init__(priority=1) self.ctx = ctx def handle_event(self, eve...
clustermanagerservice.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 u...
gceProvisioner.py
# Copyright (C) 2015 UCSC Computational Genomics Lab # # 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 o...
deployment.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import pkg_resources import re import redis import requests import shutil import six import sys import tempfile import threading import time from selenium import webdriver from selenium.webdriver.chrome.options import Options as ChromeOptions fro...
thruster-test-random.py
#!/usr/bin/env python3 import random import threading from time import sleep from control.thrusters import thrusters from control.util import zero_motors from shm import motor_desires test_values = (-255,-190, -140, -100, 60, 0, 60, 100, 140, 190, 255) #test_values = range(-128,128) #test_values = (-255, -127, 0, 1...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Gold BCR Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test goldbcrd shutdown.""" from test_framework.test_framework import Gold BCRTestFramework from test_...
0-collect.py
# --- # jupyter: # jupytext: # cell_metadata_filter: -all # custom_cell_magics: kql # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.11.2 # kernelspec: # display_name: Python 3.8.12 ('ai') # language: python # ...
map_dataset_op_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...
mqtt.py
import paho.mqtt.client as mqtt import heapq import threading import json import datetime import time from app import app from app.database.database import * from app.components.file_management import * from app.components.shared_resources import process_management_queue, mqtt_incoming_messages_list from app.component...
service_checker.py
# Internet interaction imports from sc_utils import shodan_ip_check from requests import get # Ping sweep imports from sc_utils import ping_sweep # Passive scan from sc_utils import dhcp_listener from sc_utils import simple_mail # For alerts # LAN scan import multiprocessing import socket from scapy.layers.l2 impor...
__init__.py
""" This file is part of pycos; see https://pycos.org for details. This module provides framework for concurrent, asynchronous network programming with tasks, asynchronous completions and message passing. Other modules in pycos download package provide API for distributed programming, asynchronous pipes, distributed c...
test_tracer.py
# -*- coding: utf-8 -*- """ tests for Tracer and utilities. """ import contextlib import gc import multiprocessing import os from os import getpid import threading from unittest.case import SkipTest import warnings import weakref import mock import pytest import six import ddtrace from ddtrace.constants import AUTO_K...
client.py
# -*- coding:utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Client widget for the IPython Console This is the widget used on all its tabs """ # Standard library imports from __future__ import absolute_import ...
test_context.py
# -*- coding: utf-8 -*- ''' tests.unit.context_test ~~~~~~~~~~~~~~~~~~~~ ''' # Import python libs from __future__ import absolute_import import tornado.stack_context import tornado.gen from tornado.testing import AsyncTestCase, gen_test import threading import time # Import Salt Testing libs from tests.support...
processor_v2.py
import datetime import glob import json import librosa import lmdb import math import matplotlib.pyplot as plt import numpy as np import os import pickle import pyarrow import python_speech_features as ps import threading import time import torch import torch.optim as optim import torch.nn as nn import torch.nn.functio...
utils.py
import json import logging from threading import Thread import requests from tensorflow.python.keras.initializers import RandomNormal from tensorflow.python.keras.layers import Embedding, Input from .activations import * from .layers import * from .sequence import * try: from packaging.version import parse excep...
main.py
__author__ = "Luiz Cartolano <cartolanoluiz@gmail.com>" __status__ = "terminated" __version__ = "1.3" __date__ = "12 december 2018" try: from importer import install from constants import PATH_IN, PATH_OUT_HOR, PATH_OUT_HOUGH import logging import os import threading except ImportError: ra...
test_threading.py
# Very rudimentary test of threading module import test.test_support from test.test_support import verbose import os import random import re import subprocess import sys import threading import thread import time import unittest import weakref # A trivial mutable counter. class Counter(object): def __init__(self)...
helpers.py
""" Helper functions file for OCS QE """ import logging import re import datetime import statistics import os from subprocess import TimeoutExpired import tempfile import time import yaml import threading from ocs_ci.ocs.ocp import OCP from uuid import uuid4 from ocs_ci.ocs.exceptions import TimeoutExpiredError, Unex...
asyncscheduledtask.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 u...
ajax.py
import json import logging import os import sys import threading import cherrypy import core from core import config, library, plugins, poster, scoreresults, searcher, snatcher, sqldb, updatestatus, version from core.providers import torrent, newznab from core.downloaders import nzbget, sabnzbd, transmission, qbittorre...
test_pyaims_thread_read.py
#!/usr/bin/env python from __future__ import print_function from __future__ import absolute_import import threading from soma import aims import os import sys from optparse import OptionParser import threading import tempfile import shutil import soma.subprocess import time import six from six.moves import zip def ...
Measure_Perf.py
''' Python side of measurement gathering. ''' from X4_Python_Pipe_Server import Pipe_Server, Pipe_Client import time import threading # Name of the pipe to use. pipe_name = 'x4_perf' # Flag to do a test run with the pipe client handled in python instead # of x4. test_python_client = 0 def main(args): ''' En...
DNSServerV3.py
# Fall 2016 CSci4211: Introduction to Computer Networks # This program serves as the server of DNS query. # Written in Python v3. import sys, threading, os from socket import * def main(): host = "localhost" # Hostname. It can be changed to anything you desire. port = 5001 # Port number. #create a socket object, ...
core.py
# !/usr/bin/python2 # coding: utf-8 """ GAME models """ import json import os import shutil import time from multiprocessing import Process from game.models import Game, FilesConfig, LabelsConfig from gamer.config import OUTPUT_FOLDER, PROCESSES_COUNT from gamer.emails.mailer import notify_user_of_start, notify_use...
mp.py
import logging import multiprocessing import select import unittest import collections import os import sys import six import multiprocessing.connection as connection from nose2 import events, loader, result, runner, session, util log = logging.getLogger(__name__) class MultiProcess(events.Plugin): configSect...
TestThreadingLocal.py
"""Test the ThreadingLocal module.""" __version__ = '1.1' __revision__ = "$Rev: 8218 $" __date__ = "$Date: 2011-08-14 13:57:11 +0200 (So, 14. Aug 2011) $" import sys from threading import Thread import unittest sys.path.insert(1, '../..') from DBUtils.ThreadingLocal import local class TestThreadingLocal(unittest....
jobs.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Copyright (c) 2012, Rui Carmo Description: In-process job management License: MIT (see LICENSE.md for details) """ import os, sys, logging, time, traceback, multiprocessing, gc from cPickle import loads, dumps from Queue import PriorityQueue, Empty from threading import T...
ws.py
#!/usr/bin/env python3 # coding=utf-8 # requires https://pypi.python.org/pypi/websocket-client/ from excepthook import uncaught_exception, install_thread_excepthook import sys sys.excepthook = uncaught_exception install_thread_excepthook() # !! Important! Be careful when adding code/imports before this point. # Our e...
streaming.py
from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import configparser # for reading the configuration file import os import sys import json # For converting string into json object import argparse # For parsing command-line arguments import time # For adding a timesta...
crdt_app.py
import logging import os import threading from logging.config import fileConfig from time import process_time from crdt.crdt_exceptions import VertexNotFound from crdt.list_crdt import ListCRDT from crdt.ops import RemoteOp, OpUndo, OpRedo, LocalOp from crdt.ordered_list.lseq_ordered_list import LSEQOrderedList from c...
device_connection_test.py
# Copyright 2020 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...
kinesis_client.py
import boto3 import logging import sys import time import uuid from queue import Queue from threading import Thread class KinesisClient(object): def __init__(self, stream_name, invalid_stream_name): self.stream_name = stream_name self.invalid_stream_name = invalid_stream_name self.messag...
midi_hub.py
# Copyright 2020 The Magenta Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
trezor.py
from binascii import hexlify, unhexlify import traceback import sys from electrum_deeponion.util import bfh, bh2u, versiontuple, UserCancelled from electrum_deeponion.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, deserialize_xpub, TYPE_ADDRESS, TYPE_SCRIPT, is_address) from el...
Chap10_Example10.32.py
from threading import * class abc: def __init__(self, seat_available): self.seat_available = seat_available self.mylock = Lock() def abc_reserveseat(self, seat_required): self.mylock.acquire() print("Number of seats remaining : ", self.seat_available) if self.seat_avai...
download_bcourses_photos.py
#!/usr/bin/env python # Instructions: pass --help to see instructions. import argparse import errno import json import mimetypes import os import re import sys import threading try: from queue import Queue # Python 3 except ImportError: from Queue import Queue # Python 2 try: import urllib.request as ...
vpp_papi.py
#!/usr/bin/env python3 # # Copyright (c) 2016 Cisco and/or its affiliates. # 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 require...