source
stringlengths
3
86
python
stringlengths
75
1.04M
kws_detector.py
""" This is a packet of KWS detection, dependent on DNN training part """ import ctypes as ct import numpy as np import wave import math import matplotlib.pyplot as plt import pyaudio import os import sys from scipy.io import wavfile # must have matching versions: llvmlite==0.22 numba==0.36.1 librosa==0.5 ...
core.py
# -*- coding: utf8 -*- """Classes for SOLR core""" import httplib import datetime import time import multiprocessing import multiprocessing.dummy import sys import warnings import threading import Queue import logging from solrcl.base import * from solrcl.solrtype import * from solrcl.solrfield import * from solr...
function_tests.py
import threading from cmd_functions import * def prnt(): import time while True: print("test") time.sleep(3) cloud = threading.Thread(target=cloud_sync, args=(), daemon=True) prnt = threading.Thread(target=prnt, args=(), daemon=True) cloud.start() prnt.start() while True: pass
utils.py
#!/usr/bin/env python """ General Utilities (part of web.py) """ from __future__ import print_function __all__ = [ "Storage", "storage", "storify", "Counter", "counter", "iters", "rstrips", "lstrips", "strips", "safeunicode", "safestr", "timelimit", "Memoize", "memoize", "re_compile", "re_subm", ...
wrapper.py
#!/usr/bin/python -u import os import socket import subprocess import threading import sys from hashlib import md5 from contextlib import closing sys.stderr = open('/tmp/log', 'wb', 0) def find_free_port(): with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: s.setsockopt(socket.SOL_SOCK...
test_run.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2020 tecnovert # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. # coldstakepool$ pytest -v -s import os import sys import time import json import shutil import signal...
GUI.py
# sometimes Tkinter is not installed TkinterIsInstalled = True import platform if platform.python_version()[0] == '2': # Python2 try: from Tkinter import Tk, Toplevel, Button, Entry, Menubutton, Label, Frame, StringVar, DISABLED, ACTIVE except: TkinterIsInstalled = False else: # Python...
MosaicSectionFinder.py
# The Leginon software is Copyright 2004 # The Scripps Research Institute, La Jolla, CA # For terms of the license agreement # see http://ami.scripps.edu/software/leginon-license # import wx import threading from leginon.gui.wx.Choice import Choice from leginon.gui.wx.Entry import IntEntry, FloatEntry import leginon....
itunes.py
import urllib import threading from copy import deepcopy from Queue import Queue import requests import feedparser from podcasts.constants import ITUNES_SEARCH_URL, ITUNES_LOOKUP_URL from podcasts.api import API from podcasts.models.series import Series from podcasts.models.episode import Episode def search_podcast_se...
ib_gateway.py
""" Please install ibapi from Interactive Brokers github page. """ from copy import copy from datetime import datetime from queue import Empty from threading import Thread from ibapi import comm from ibapi.client import EClient from ibapi.common import MAX_MSG_LEN, NO_VALID_ID, OrderId, TickAttrib, TickerId from ibapi...
memory_tests.py
# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). # # 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...
main.py
#!/usr/bin/python3 # ____ _ _ ____ _ _ _ # / ___|___ _ __ ___ _ __ ___ _ _ _ __ (_) |_ _ _ / ___|___ _ __ | |_ _ __ ___ | | | ___ _ __ # | | / _ \| '_ ` _ \| '_ ` _ \| | | | '_ \| | __| | | | | / _ \| '_ \| __| '__/ _ \| | |...
feeder.py
import os import random import threading import sys import numpy as np import skimage.io as sio import tensorflow as tf from definitions import * from pyutils.iolib.audio import load_wav class FilenameProvider(object): def __init__(self, directory, subset_fn=None, num_epochs=1, ...
led_ws2812b.py
#*************************************************************************************************** # Imports #*************************************************************************************************** # Global imports import os import threading import time import traceback from typing import Union import que...
handlers.py
# -*- coding:utf-8 -*- #----------------------------------------------------------------------------- # Copyright (c) 2015, ROOT Team. # Authors: Danilo Piparo # Omar Zapata <Omar.Zapata@cern.ch> http://oproject.org # Distributed under the terms of the Modified LGPLv3 License. # # The full license is i...
app.py
"""Value at Risk sandbox application. This application is a self-contained HTTP server and Apache Spark processing engine based on the algorithms present in the Value at Risk Jupyter notebook (https://github.com/radanalyticsio/workshop). """ import logging import multiprocessing as mp import os import random import t...
DialogPluginManager.py
''' Created on March 1, 2012 @author: Mark V Systems Limited (c) Copyright 2011 Mark V Systems Limited, All rights reserved. based on pull request 4 ''' from tkinter import Toplevel, font, messagebox, VERTICAL, HORIZONTAL, N, S, E, W from tkinter.constants import DISABLED, ACTIVE try: from tkinter.ttk import Tre...
HiwinRA605_socket_ros_20190530111711.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
password.py
#!/usr/bin/env python3 # Made by Innovative Inventor at https://github.com/innovativeinventor. # If you like this code, star it on GitHub! # Contributions are always welcome. # MIT License # Copyright (c) 2017 InnovativeInventor # Permission is hereby granted, free of charge, to any person obtaining a copy # of this...
last_auth.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """last_auth.py: Postfix Daemon that saves last saslauth date .""" __author__ = "Leandro Abelin Noskoski" __site__ = "www.alternativalinux.net" __projectpage__ = "https://github.com/noskoski/postfix_smtpd_last_auth" __copyright__ = "Copyright 2019, Alternativa Linux" ...
remote_process_server.py
from multiprocessing.managers import BaseManager from threading import Thread from multiprocessing import Queue from time import sleep queue=Queue() def watch(): while 1: while not queue.empty(): print(queue.get()) sleep(1) def StartManager(): class QueueManager(BaseManager): ...
main.py
#! /usr/bin/env python3 from launcher import TTRLauncher from gui.frame import LauncherFrame from PyQt5.QtWidgets import QApplication import multiprocessing from launcher import localizer, messagetypes import traceback import sys import os class Process(multiprocessing.Process): pass def run_launcher(guiToLaunche...
npu_hook.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Huawei Technologies Co., Ltd. 2019-2021. 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...
data_handlers.py
# -*- coding: utf-8 -*- # @Author: lorenzo # @Date: 2017-08-29 21:10:17 # @Last Modified by: Lorenzo # @Last Modified time: 2017-09-17 16:09:14 # Copyright 2017 Lorenzo Rizzello # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES # O...
proxy_spider.py
import socket import requests from bs4 import BeautifulSoup import urllib.request import os import random import time import sql_operation import _thread import threading import baidudetector def get_html(i): print("------------------------------------------------第" + str(i) + "页内容") url = 'https://www.xicid...
test_instrumented_app.py
# Copyright (C) 2018 SignalFx. All rights reserved. from time import sleep from flask_opentracing import FlaskScopeManager from opentracing.mocktracer import MockTracer from threading import Thread import opentracing import requests import pytest import six from signalfx_tracing.libraries import flask_config from sig...
mdns_example_test.py
import os import re import socket import struct import subprocess import time from threading import Event, Thread import dpkt import dpkt.dns import ttfw_idf from tiny_test_fw import DUT stop_mdns_server = Event() esp_answered = Event() def get_dns_query_for_esp(esp_host): dns = dpkt.dns.DNS(b'\x00\x00\x01\x00\...
test_dbapi.py
# pysqlite2/test/dbapi.py: tests for DB-API compliance # # Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of t...
js_container.py
#!/usr/bin/env python # Program Name : js_container.py # Description : Delphix implementation script # Author : Corey Brune # Created: March 4 2016 # # Copyright (c) 2016 by Delphix. # All rights reserved. # See http://docs.delphix.com/display/PS/Copyright+Statement for details # # Delphix Support statement avai...
application.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...
main.py
from plugin.models import SchedulerJob from plugin.modules.core.base import Module from plugin.modules.scheduler.handlers import BackupMaintenanceIntervalHandler, SyncIntervalHandler from datetime import datetime from threading import Thread import logging import time log = logging.getLogger(__name__) HANDLERS = [ ...
socketclient.py
import socket from time import sleep import sys import pickle from threading import Thread import hashlib import datetime # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = ('localhost', 10000)...
analyse_random_aggreement.py
# -*- coding: utf-8 -*- """ Created on Tue Jan 2 13:04:57 2018 @author: pscog """ #import sys #import os #sys.path.append(os.path.dirname(os.getcwd())) from multiprocessing import Process import PyThurstonian from PyThurstonian import thurstonian, hdi import pandas as pd import seaborn as sns import matplot...
test_memmapping.py
import os import mmap import sys import platform import gc import pickle import itertools from time import sleep import subprocess import threading import pytest from joblib.test.common import with_numpy, np from joblib.test.common import setup_autokill from joblib.test.common import teardown_autokill from joblib.tes...
mp.py
import os import pickle import struct import sys from functools import partial from multiprocessing import Lock, Event as ProcessEvent from threading import Thread, Event as TrEvent, RLock as ThreadRLock from time import sleep, time from typing import List, Dict, Optional from multiprocessing import Process import psu...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum_lcc import Wallet, WalletStorage from electrum_lcc.util import UserCancelled, InvalidPassword from electrum_lcc.base_wizard import BaseWizard, HWD_SETUP_DECRYPT_WALL...
pomodoro.py
#!/usr/bin/python # -*- coding:utf-8 -*- import json import logging import os import sys import threading import time from lib.TP_lib import gt1151 from lib.TP_lib import epd2in13_V2 import app fontdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'font') libdir = os.path.join(os.path.d...
demo_dp_interface.py
import logging from time import sleep from random import random from threading import Thread from datetime import datetime, timezone logger = logging.getLogger(__name__) class DemoDPInterface(): """ This is a demo version of a datapoint interface which pushes dummy values and metadata into the DB to supp...
multitester.py
""" Certbot Integration Test Tool - Configures (canned) boulder server - Launches EC2 instances with a given list of AMIs for different distros - Copies certbot repo and puts it on the instances - Runs certbot tests (bash scripts) on all of these - Logs execution and success/fail for debugging Notes: - Some AWS ima...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain...
robot-socket.py
#https://pypi.python.org/pypi/socketIO-client #if script called without args, it goes to production #if it's called with 'dev' arg, it defaults to localhost # Import servo logic from sebulba.py from sebulba import * import logging import sys import requests import time from threading import Thread import requests imp...
music.py
import discord import os import fnmatch import random import audio_metadata import threading from time import sleep import pathlib from discord.ext import commands from bot.features.tgacog import TGACog class Music(TGACog): """ Sit back and enjoy some chill tunes """ def __init__(self, bot): ...
AsyncTap.py
# # Copyright (c) 2011, 2012 # Claudio Kopper <claudio.kopper@icecube.wisc.edu> # and the IceCube Collaboration <http://www.icecube.wisc.edu> # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this...
bot_utils.py
import logging import re import threading import time from bot import download_dict, download_dict_lock LOGGER = logging.getLogger(__name__) MAGNET_REGEX = r"magnet:\?xt=urn:btih:[a-zA-Z0-9]*" URL_REGEX = r"(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-?=%.]+" class MirrorStatus: STATUS_UPL...
capture_camera.py
""" To capture images from the Percept DK Vision SoM Camera Adapted from: https://github.com/NVIDIA-AI-IOT/jetcam/blob/master/jetcam/usb_camera.py """ import traitlets import threading import numpy as np import cv2 import atexit class Camera(traitlets.HasTraits): value = traitlets.Any() width = traitlets.In...
run.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ fMRI preprocessing workflow ===== """ import os from pathlib import Path import logging import sys import gc import uuid import warnings from argparse import ArgumentParser from argparse import RawTextHelpFormatter from multiprocessing import cpu_count from time impor...
SpeechClientBridge.py
import queue from threading import Thread from google.cloud import speech from google.cloud.speech import types class SpeechClientBridge: def __init__(self, streaming_config, on_response): self._on_response = on_response self._queue = queue.Queue() self._ended = False client = spe...
imagemgr.py
#!/usr/bin/python3 """ design: 1. When user create an image, it will upload to an image server, at the same time, local host will save an image. A time file will be made with them. Everytime a container start by this image, the time file will update. 2. When user save an image, if it is a update option...
base.py
import requests import json import numpy as np import schedule, time from lru import LRU from threading import Thread ''' import schedule import time def job(): print("I'm working...") schedule.every(10).minutes.do(job) schedule.every().hour.do(job) schedule.every().day.at("10:30").do(job) schedule.every(5).to(...
host.py
import math import time import uuid from queue import Queue, Empty from .network import Network from qunetsim.backends import EQSNBackend from qunetsim.components import protocols from qunetsim.objects import Logger, DaemonThread, Message, Packet, Qubit, QuantumStorage, ClassicalStorage, \ QuantumConnection, Class...
scans.py
""" scans.py Copyright 2015 Andres Riancho This file is part of w3af, http://w3af.org/ . w3af 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 version 2 of the License. w3af is distributed in the hope that it wi...
api.py
from flask import Blueprint from flask import copy_current_request_context from app.db import * from flask_restful import Api, Resource, reqparse import requests import json import datetime import itertools from threading import Thread import threading import base64 import re import calendar def remove_allergy(str):...
test_integration.py
from distribute.dist import Worker, worker_from_url from nose.tools import raises, assert_equal, with_setup import platform import sh import os from multiprocessing import Process from threading import Thread from nose.plugins.attrib import attr base_dir = "tests/addition_test" n = 2 def setup(): # clean up the lo...
main.py
import threading from queue import Queue from bot import Bot from url import * from creator import * folder = 'Fit' url = 'http://www.fit.ba/' domain = get_url(url) waiting_files = folder + '/waitinglist.txt' links_files = folder + '/links.txt' number_of_cores = 8 waiting_list = Queue() Bot(folder, url, domain) # Bec...
host.py
from concurrent.futures import ThreadPoolExecutor from threading import Thread from typing import Callable, Dict, Any from gooey.gui import seeder from gooey.gui import state as s from gooey.gui.state import FullGooeyState from gooey.python_bindings.types import Try, PublicGooeyState def communicateFormValidation(st...
related_cards_widget.py
import threading from cmg import widgets from cmg.color import Color from cmg.event import Event from study_tool.card import Card from study_tool.config import Config from study_tool.gui.generic_table_widget import GenericTableWidget class RelatedCardsWidget(widgets.Widget): """ Widget for editing a card's re...
media_stream_processor.py
''' * Copyright (C) 2019-2020 Intel Corporation. * * SPDX-License-Identifier: MIT License * ***** * * MIT License * * Copyright (c) Microsoft Corporation. * * 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...
resize_img.py
import json import ipdb import numpy as np import os import subprocess from multiprocessing import Process, Queue, Lock from moviepy.video.io.VideoFileClip import VideoFileClip as Video from glob import glob import csv from tqdm import tqdm import cvbase.optflow.io as flowlib import torch.nn.functional as F import torc...
database.py
import pymysql from threading import Thread from sys import exit class Database(object): def __init__(self, user, password, database): try: self.db = pymysql.connect ( host="127.0.0.1", port=3306, user=user, ...
PlayersListing.py
#!python # Collect for each region the list of players by league # Strategy: we go through the list of all the known players and check their games # As a starting list, we can take master/challenger players import os import multiprocessing import time import pickle import sys from pickle import PickleError from Inte...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import torch import torch.optim as optim import torch.optim.lr_scheduler as lrs class time...
ib_gateway.py
""" Please install ibapi from Interactive Brokers github page. """ from copy import copy from datetime import datetime from queue import Empty from threading import Thread from ibapi import comm from ibapi.client import EClient from ibapi.common import MAX_MSG_LEN, NO_VALID_ID, OrderId, TickAttrib, TickerId from ibapi...
daemon.py
#!/usr/bin/env python3 """ Upload messages to cloud watch logs """ import errno import json import logging import os import socket import sys import threading import time import typing import globus_cw_daemon.config as config import globus_cw_daemon.cwlogs as cwlogs import globus_cw_daemon.local_logging as local_loggi...
test_tools.py
# Copyright 2016 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 ...
main.py
from email.headerregistry import Group from multiprocessing.dummy import current_process import os import pickle import struct import threading from tkinter import * import socket import json from tokenize import group import cv2 import base64 import numpy as np import time import zlib import queue as pyqueue import py...
tgclient.py
#!/usr/bin/env python3 import telebot # pip3 install pytelegrambotapi from threading import Thread from time import sleep from typing import List, Optional, Any, Union, Iterable, Callable from telebot.types import Message, Chat # typing from .helper import Log class Kill(Exception): ''' Used to intentionally ki...
dag_processing.py
# -*- 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 License, Version 2.0 (the #...
runner.py
# Copyright 2018 Datawire. 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 agr...
train_abstractive.py
#!/usr/bin/env python """ Main training workflow """ from __future__ import division import argparse import glob import os import random import signal import time import torch from pytorch_transformers import BertTokenizer import distributed from models import data_loader, model_builder from models.data_loader i...
test_httplib.py
import errno from http import client import io import itertools import os import array import re import socket import threading import warnings import unittest TestCase = unittest.TestCase from test import support here = os.path.dirname(__file__) # Self-signed cert file for 'localhost' CERT_localhost = os.path.join(...
ta_example.py
#@title Prepare data and utility functions. {display-mode: "form"} #@markdown #@markdown You do not need to look into this cell. #@markdown Just execute once and you are good to go. #@markdown #@markdown In this tutorial, we will use a speech data from [VOiCES dataset](https://iqtlabs.github.io/voices/), which is licen...
test.py
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
arrow_dataset_ops.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...
__init__.py
#!/usr/bin/env python3 """ Server wrapper """ import functools from threading import Thread from Translatron.Server.HTTPServer import startHTTPServer from Translatron.Server.WebsocketInterface import startWebsocketServer def startTranslatron(startWebsocket = True, startHTTP = True, join = True, http_port=8080): ""...
test_library_cache.py
import unittest import sys import os from robotide.spec.librarymanager import LibraryManager from threading import Thread from robotide.namespace.cache import LibraryCache from resources import DATAPATH sys.path.append(os.path.join(DATAPATH, 'libs')) class TestLibraryCache(unittest.TestCase): @...
api_socketio.py
import threading,time import asyncio from aiohttp import web import socketio # creates a new Async Socket IO Server sio = socketio.AsyncServer() # Creates a new Aiohttp Web Application app = web.Application() # Binds our Socket.IO server to our Web App # instance sio.attach(app) # @sio.event # def connect(sid, enviro...
cluster.py
# Standard import ast import importlib import signal import socket import traceback import uuid from multiprocessing import Event, Process, Value, current_process from time import sleep # External import arrow # Django from django import db from django.conf import settings from django.utils import timezone from djang...
conftest.py
import asyncio import json import os import threading import time import typing import pytest import trustme from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.serialization import ( BestAvailableEncryption, Encoding, PrivateFormat, load_pem_private_key, ) from...
pulling.py
import argparse import base64 import json import os import sys import time import pandas as pd import requests from web3.exceptions import ContractLogicError sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from utils import chain from utils import config from utils import ipfs import t...
main.py
import click import time import threading import re from PIL import Image, ImageDraw, ImageFont import numpy as np def print_text_to_graphics(text): click.echo(convert_text_to_graphics(text)) def convert_text_to_graphics(text): font = ImageFont.load_default() size = font.getsize(text) image = Image....
atlas_helper_methods.py
""" This module has all the helper functions for atlas """ import json, yaml, ast import sys, traceback, os import memcache import threading import logging import datetime from threading import Lock import collections from collections import defaultdict class AtlasHelper: def __init__(self): self.output_...
datasets.py
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license """ Dataloaders and dataset utils """ import glob import hashlib import json import os import random import shutil import time from itertools import repeat from multiprocessing.pool import Pool, ThreadPool from pathlib import Path from threading import Thread from zipfile im...
test_base.py
# Copyright 2014 Scalyr Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
global_interpreter_lock.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/12/16 15:45 # @Author : zengsm # @File : global_interpreter_lock # 参考资料 https://www.cnblogs.com/welan/p/10009638.html import sys import threading import time import traceback class HookThread(threading.Thread): """ 钩子线程,主线程获取子线程异常 """ def __init__(...
pg_jddc.py
# coding: utf-8 import os import struct import collections from tensorflow.core.example import example_pb2 def read_text_file(text_file): lines = [] with open(text_file, "r") as f: for line in f: lines.append(line.strip()) return lines def write_to_bin(articles, out_file): with open(out_file, 'wb'...
simulation_with_gui.py
#!/usr/bin/env python3 import threading import rclpy from rclpy.node import Node from wolfgang_pybullet_sim.ros_interface import ROSInterface from wolfgang_pybullet_sim.simulation import Simulation if __name__ == "__main__": rclpy.init(args=None) simulation = Simulation(True) node = Node('pybullet_sim') ...
hyperionplatform.py
import json import logging import threading import websocket from .baseplatform import BasePlatform logger = logging.getLogger(__name__) class HyperionPlatform(BasePlatform): def __init__(self, config): logger.debug("Initializing Hyperion platform") super(HyperionPlatform, self).__init__(config, 'hyperion')...
huge.py
__author__ = 'bernardo' import urllib2 import time from datetime import datetime import argparse import thread import threading PORT = 8000 ip = "localhost" def call(): a = urllib2.urlopen(("http://{0}:{1}/ping.tst").format(str(parsed.ip), str(parsed.p))).read() print a parser = argparse.ArgumentParser() p...
fsfreezer.py
#!/usr/bin/env python # # VM Backup extension # # Copyright 2014 Microsoft Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
recordMetrics.py
import requests import time import re import signal from argparse import ArgumentParser from threading import Thread IGNORE = 'IGNORE' METRIC_INIT_RETRIES = 5 ENABLED = True FLINK_ENDPOINT = 'http://localhost:9999' SAMPLING_FREQ_SEC = 1 # TODO: Other options for flink latency except latency_mean METRICS = { 'nu...
gui.py
import pickle import logging from agent import Agent import numpy as np from tkinter import * from tkinter import ttk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk from matplotlib.figure import Figure from simulation import SimulationProducer from threading import Thread from sc...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
videoGet.py
from threading import Thread import socket import struct import time class VideoGet(): def __init__(self, ui): self._HOST = '169.254.11.41' self._PORT = 8485 self.frame_data_send = "" self._ui = ui def connect(self): while True: if self._ui.camera_var == 0: ...
tasks.py
from __future__ import absolute_import import os import subprocess import sys import tarfile import tempfile import traceback import zipfile from threading import Thread import six from django.utils.text import get_valid_filename from django.core.files import File from django.conf import settings from celery import T...
gui.py
from posixpath import split from tkinter import * from tkinter import scrolledtext import threading from tkinter.filedialog import askopenfilename, asksaveasfilename import wave import pyaudio import os from asr import ASR_from_files, ASR_live import time CHUNK = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1...
PaymentWindow.py
""" Zachary Cook Prompt for user information. """ import math import ntpath import os import threading import time from PyQt5 import QtWidgets,QtCore from cura.CuraApplication import CuraApplication from ConstructRIT import Configuration from ConstructRIT.UI.ThreadedMainWindow import ThreadedMainWindow, ThreadedOpera...
networkrobotinterface.py
"""Classes for building networked RIL servers and clients. .. versionadded:: 0.9 """ from .robotinterface import RobotInterfaceBase from .robotinterfaceutils import _RobotInterfaceState,_RobotInterfaceStructure,_RobotInterfaceSettings,_RobotInterfaceCommand,_RobotInterfaceStatefulBase,_RobotInterfaceStatefulWrapper f...
test_state.py
# -*- coding: utf-8 -*- """ Tests for the state runner """ # Import Python Libs from __future__ import absolute_import, print_function, unicode_literals import errno import logging import os import re import shutil import signal import tempfile import textwrap import threading # Import Salt Testing Libs from tests.s...
webclient.py
""" CPAchecker is a tool for configurable software verification. This file is part of CPAchecker. Copyright (C) 2007-2014 Dirk Beyer 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 Licen...
TelloAPI.py
import cv2 import time import socket import threading class Response(object): def __init__(self): pass def recv(self, data): pass def pop(self): pass def empty(self): pass class Command(Response): def __init__(self): super(Command, self).__init__() ...