source
stringlengths
3
86
python
stringlengths
75
1.04M
Mesh_Simplifier.py
import sys sys.path.append("E:/code/algorithm2/distribution/python/Release") import hgapi import numpy as np import os import vedo import time import glob from multiprocessing import Process # from tqdm import tqdm import shutil def get_gum_line_pts(gum_line_path): """ ่ฏปๅ–็‰™้พˆ็บฟๆ–‡ไปถ๏ผŒptsๆ ผๅผ """ f = open(gum_l...
anpr_camera_stream_og.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function import argparse import csv import io import os from datetime import datetime from threading import Thread import cv2 import requests from PIL import Image os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;udp" def pa...
plantspy_live.py
#!/usr/bin/env python3 import cv2 from io import StringIO # update for python3 # import numpy double entry? import logging import numpy as np import imutils import datetime import time from os import uname from PIL import Image from pylepton import Lepton # https://github.com/groupgets/pylepton from traceback import fo...
xsarm_dual.py
import math import rospy from threading import Thread from interbotix_xs_modules.arm import InterbotixManipulatorXS # This script is used to make two WidowX200 arms work in tandem with one another # # To get started, open a terminal and type 'roslaunch interbotix_xsarm_dual xsarm_dual.launch' # Then change to this dir...
train_latent_classifier.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import cv2 import numpy as np import pandas as pd import keras.backend as K import tensorflow as tf from progressbar import ProgressBar from keras import losses, optimizers from keras.models import model_from_json, Sequential from keras.callbacks import ModelCh...
test_window_runner.py
# Copyright 2021 Zilliz. 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 agree...
do_threading02.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from threading import Thread, Event import time # Code to execute in an independent thread def countdown(n, started_evt): print('countdown starting') started_evt.set() while n > 0: print('T-minus', n) n -= 1 time.sleep(5) # Create the...
dumpmon.py
# dumpmon.py # Author: Jordan Wright # Version: 0.0 (in dev) # --------------------------------------------------- # To Do: # # - Refine Regex # - Create/Keep track of statistics from lib.regexes import regexes from lib.Pastebin import Pastebin, PastebinPaste from lib.Slexy import Slexy, SlexyPaste from lib.Pastie im...
EmotivTasks.py
from classes import EmotivHeadset from threading import Thread def threaded(fn): def wrapper(*args, **kwargs): thread = Thread(target=fn, args=args, kwargs=kwargs) thread.start() return thread return wrapper class EmotivHeadsetThreadedTasks: def __init__(self): self.emoti...
jt65.py
#!/usr/local/bin/python # # decode JT65 # # inspired by the QEX May/June 2016 article by K9AN and K1JT # about soft-decision JT65 decoding. # # much information and code from the WSJT-X source distribution. # # uses Phil Karn's Reed-Solomon software. # # Robert Morris, AB1HL # import numpy import wave import weakaudi...
bot.py
import asyncio import logging import threading import unicodedata import discord from decouple import config from discord.utils import get from django.core.exceptions import ValidationError from django.core.validators import validate_email from pyfiglet import figlet_format from . import connect4, cowsay, xkcd from ....
automaton.py
""" forecaster.automate.automaton ~~~~~~~~~~~~~~ Proxy class to automate algorithms. """ import logging import time from threading import Event from forecaster.automate.positioner import Positioner from forecaster.automate.utils import LogThread, ThreadHandler, wait, wait_precisely from forecaster.enums import ACTIO...
callbacks_test.py
# Copyright 2016 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...
can.py
#!/usr/bin/env python import threading import Queue import uspp.uspp as serial import message_dispatcher as dispatcher # ------------------------------------------------------------------------------ class CanException(Exception): pass # -----------------------------------------------------------------------------...
a3c.py
""" Asynchronous Advantage Actor Critic (A3C) with discrete action space, Reinforcement Learning. The Cartpole example. View more on my tutorial page: https://morvanzhou.github.io/tutorials/ Using: tensorflow 1.0 gym 0.8.0 """ import multiprocessing import threading import tensorflow as tf import numpy as np import o...
rc.py
import os import sys import time import json import socket import base64 import struct import logging import platform import subprocess import threading from enum import Enum from types import SimpleNamespace # ============================================================================== # DEFINITI...
test_util.py
# Copyright 2015 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 a...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018-2019 The Zortcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test zortcoind shutdown.""" from test_framework.test_framework import ZortcoinTestFramework from test...
base.py
import json import copy import threading import array import struct import time import csv import os import random from open_gateway.sources.utils.sml_runner import SMLRunner from open_gateway import basedir, ensure_folder_exists try: from open_gateway.sources.buffers import ( CircularBufferQueue, ...
perf_stress_runner.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
solve_hallway.py
import logging import time import numpy as np from sqlalchemy import create_engine from examples.gym.hallway_env import HallwayEnv from examples.gym.tf_model import policy_model from rlmolecule.alphazero.tensorflow.tfalphazero_problem import TFAlphaZeroProblem from rlmolecule.gym.alphazero_gym import AlphaZeroGymEnv ...
download.py
import os, time, io, re, threading import requests from PIL import Image from PyPDF2 import PdfFileMerger header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36' } def mkdir(path): path = path.strip() isExists = os.path.exis...
04_lander_a3c.py
''' epoch: 23541 mean: 139.08, policy_loss: -0.06, value_loss: 0.72, entropy_loss: -0.01, reward 49.30 epoch: 23551 mean: 139.23, policy_loss: -0.09, value_loss: 13.88, entropy_loss: -0.01, reward 258.64 epoch: 23562 mean: 147.31, policy_loss: 0.02, value_loss: 15.12, entropy_loss: -0.01, reward 285.85 Solv...
test_simple_rpc.py
import logging import os import threading from time import sleep import pandas as pd import pytest import redis from pandas.util.testing import assert_frame_equal from parquery.write import df_to_parquet import parqueryd.config from parqueryd.controller import ControllerNode from parqueryd.rpc import RPC from parquer...
test_query_concurrency.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...
locators.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2015 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import gzip from io import BytesIO import json import logging import os import posixpath import re try: import threading except Impo...
test_cli.py
import os import json from pathlib import Path import yaml import unittest import click from click.testing import CliRunner os.environ['QA_TESTING'] = 'true' # Missing: # - tests with --share # - tests with CI=ON CI_COMMIT=XXXXXX class TestQaCli(unittest.TestCase): @classmethod def setUpClass(self): self.p...
print_word_vectors.py
from multiprocessing import Queue, Process from argparse import ArgumentParser import os """ print word vectors given years range and and queries file """ MODEL_FILE = "{year:d}-w.bin" def print_vectors(year, vec_dir, out_file, queries_file, dim): print "Print word vectors for year", year vocab_size = os.pop...
jobStoreTest.py
# Copyright (C) 2015-2021 Regents of the University of California # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
jobStoreTest.py
# Copyright (C) 2015-2016 Regents of the University of California # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
test_poll.py
# Test case for the os.poll() function import os import random import select import _testcapi try: import threading except ImportError: threading = None import time import unittest from test.support import TESTFN, run_unittest, reap_threads try: select.poll except AttributeError: raise unittest.SkipTe...
base.py
# Copyright 2014 ETH Zurich # # 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, sof...
Blocking.py
import keyboard from pynput.mouse import Controller from time import sleep import threading def blockinput(): global block_input_flag block_input_flag = 1 t1 = threading.Thread(target=blockinput_start) t1.start() print("Inputs are now Blocked") def unblockinput(): blockinput_stop() p...
udp_chat.py
""" This is a simple console chat over UDP. You need to know your peer IP address to chat """ import sys import socket import threading peer_addr = '192.168.1.10' # your peer's IP port = 22000 def get_host(): with socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM) as s: s.connect(('10.255.255....
lambda_executors.py
import os import re import sys import glob import json import time import logging import threading import traceback import subprocess import six import base64 from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: from pipes import quote as cmd_quote # for Pyth...
power_monitoring.py
import datetime import random import threading import time from statistics import mean from cereal import log from selfdrive.swaglog import cloudlog PANDA_OUTPUT_VOLTAGE = 5.28 # Parameters def get_battery_capacity(): return _read_param("/sys/class/power_supply/battery/capacity", int) def get_battery_status(): ...
__init__.py
''' # file siot.py # brief download into pc or raspberryPi and run the demo # Copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com) # licence The MIT License (MIT) # author [LuoYufeng](yufeng.luo@dfrobot.com) # version V1.0 # date 2019-10-8 ''' name ...
bugscanner.py
import os import re import sys import ssl import json import queue import socket import argparse import datetime import requests import threading CN = "\033[K" G1 = "\033[32;1m" G2 = "\033[32;2m" CC = "\033[0m" lock = threading.RLock() def get_value_from_list(data, index, default=""): try: return data[index] exc...
tests.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
fileprocessor.py
import logging from googledrive import GoogleDrive import redisqueue as qm import logging import time from os import listdir, remove from os.path import isfile, join from threading import Thread # Constants FOLDER_PATH_MAC = "/Users/ast/Desktop/test_data" FOLDER_PATH_PI_OLD = "/home/pi/test_data" FOLDER_PATH_CCTV = "...
de4th.py
# Basic Imports import os import time import requests import json import threading import random from colorama import Fore as F from datetime import datetime from selenium import webdriver from msvcrt import kbhit # Utility Functions def centure(var, space = None): if not space: space = (os.get_terminal_si...
ADVANCED_is_bst.py
#!/usr/bin/python3 import sys, threading #import math #test = open("tests\\4", "r") sys.setrecursionlimit(10**7) # max depth of recursion threading.stack_size(2**25) # new thread will get stack of such size class Tree: def read(self): self.n = int(sys.stdin.readline()) #self.n = int(test.readline()) ...
port_scanner.py
# ยฉ Port Scanner- Made by Yuval Simon. For bogan.cool import socket, subprocess, sys, time, os, threading from colorama import Fore class scanner(): def __init__(self): subprocess.call('clear', shell=True) print(f"""{Fore.GREEN} โ–ˆโ–ˆโ–“โ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–„โ–ˆโ–ˆโ–ˆโ–ˆโ–„ โ–„โ–„โ–„ โ–ˆโ–ˆโ–ˆโ–„ โ–ˆ โ–ˆโ–ˆโ–ˆโ–„ โ–ˆ โ–“โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ...
vsearch4web.py
from flask import ( Flask, render_template, request, redirect, escape, session, copy_current_request_context, ) from vsearch import search4letters from DBcm import UseDatabase, ConnectionError, CredentialsError, SQLError from checker import check_logged_in from time import sleep from threadi...
future.py
# from __future__ import annotations from functools import reduce import threading from threading import Thread from typing import Callable, Generic, List, TypeVar from .either import Either, Left, Right from .monad import Monad from .option import Option, Some, nil D = TypeVar("D") D2 = TypeVar("D2") # https://gith...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function, with_statement, unicode_literals import os import re import sys import copy import time import types import signal import random import fnmatch import logging import threading import ...
test_util.py
# Copyright 2015 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...
server.py
import uvicorn from fastapi import FastAPI from pydantic import BaseModel import os import logging import json from google.protobuf import any_pb2 import grpc import time from threading import Thread import sys import redis import cache import service_pb2 import service_pb2_grpc app = FastAPI() # Mandatory variables...
guitest.py
from PyQt5.QtWidgets import QApplication, QWidget, \ QPushButton, QVBoxLayout, QLabel, QGridLayout from PyQt5.QtGui import QPixmap, QImage import sys import struct import cv2 import socket import time import os import numpy as np import threading import config as cfg class Client(object): def _...
start.py
# -*- coding: utf-8 -*- """ Created on Sat Jun 19 17:24:54 2021 @author: Pvr1a """ import os import threading pxuser = "your.corporate.domain\\your_username" pxpass = input(f"Password for {pxuser}: ") env_px = f"http://{pxuser}:{pxpass}@127.0.0.1:50917"#I used lantern as proxy! os.environ["HTTPS_PROXY"] =...
nxted.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import wxversion wxversion.select('2.8') import wx import wx.aui import wx.stc as stc import os from pystc import PythonSTC, PythonSidebar from pystc import TitleUpdateEvent, EVT_TITLE_UPDATE import pycheck import subprocess from threading import Thread import sys impor...
codegenBase.py
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. ''' CodegenBase has print functions for the IR classes defined in IR.py. ''' import numpy as np import multiprocessing as mp import subprocess import operator import re import os import seedot.compiler.ir.ir as IR import se...
utils.py
# Copyright 2020 DeepMind Technologies Limited. 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 ...
flow.py
# -*- coding: UTF-8 -*- """ Flow: [load config] | [check undone job] / \ / \ (do...
client.py
import collections import json import logging import time import typing import weakref from enum import Enum from threading import Thread from typing import Dict, Iterable, Optional, Tuple, Union from .credentials import CertificateCredentials, Credentials from .errors import ConnectionFailed, exception_class_for_reas...
test__issue600.py
# Make sure that libev child watchers, implicitly installed through the use # of subprocess, do not cause waitpid() to fail to poll for processes. # NOTE: This was only reproducible under python 2. import gevent from gevent import monkey monkey.patch_all() from multiprocessing import Process from gevent.subprocess imp...
_app.py
""" """ """ websocket - WebSocket client library for Python Copyright (C) 2010 Hiroki Ohtani(liris) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the...
listing28-2.py
from xmlrpc.client import ServerProxy, Fault from server import Node, UNHANDLED from client import random_string from threading import Thread from time import sleep from os import listdir import sys import tkinter as tk HEAD_START = 0.1 # Seconds SECRET_LENGTH = 100 class ListableNode(Node): def list(self): ...
miner.py
import time import hashlib import json import requests import base64 from flask import Flask, request from multiprocessing import Process, Pipe import ecdsa from miner_config import MINER_ADDRESS, MINER_NODE_URL, PEER_NODES node = Flask(__name__) class Block: def __init__(self, index, timestamp, data, previous_...
cbas_secondary_indexes.py
from cbas_base import * from couchbase import FMT_BYTES import threading import random class CBASSecondaryIndexes(CBASBaseTest): def setUp(self): self.input = TestInputSingleton.input if "default_bucket" not in self.input.test_params: self.input.test_params.update({"default_bucket": Fa...
Daemon.py
#from threading import Thread import threading import time import sys import socket import Constant as const import Function as func import Package as pack from threading import * import time #from Thread import Timer listResultQuery = [] def sendAfin(conn): time.sleep(const.MAX_TIME / 1000) func.send_afin(conn, ...
driver.py
try: # Jupyter and IPython >= 4.0 import jupyter_client as client find_connection_file = client.find_connection_file except ImportError: # IPython 3 from IPython.lib.kernel import find_connection_file import IPython.kernel.blocking.client as client import sys impo...
bodypix_gl_imx.py
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
dataset.py
import netCDF4 as nc import numpy as np from shapely import prepared from shapely.ops import cascaded_union from util.ncconv.experimental.ocg_meta.interface import SpatialInterface,\ TemporalInterface, LevelInterface from util.ncconv.experimental.ocg_meta.element import PolyElementNotFound from warnings import warn...
utils.py
import asyncio import confluent_kafka from threading import Thread import json from functools import reduce import subprocess def CSHash(cert): result = subprocess.run(['./helpers/cshash', cert], stdout=subprocess.PIPE).stdout.decode('utf-8') result = result[:-1] #strip trailing '\n' return result def de...
test_http.py
# -*- coding: utf-8; -*- # # Licensed to CRATE Technology GmbH ("Crate") under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. Crate licenses # this file to you under the Apache License, Version 2.0 (the "License"...
Interfaz.py
#!/usr/bin/env python from threading import Thread import serial import time import collections import matplotlib.pyplot as plt import matplotlib.animation as animation import struct import copy class serialPlot: def __init__(self, serialPort='/dev/ttyUSB0', serialBaud=38400, plotLength=100, dataNumBytes=2, numP...
test_scheduler.py
from datetime import datetime, timedelta import os import signal import time from threading import Thread from rq import Queue from rq.job import Job import warnings from rq_scheduler import Scheduler from tests import RQTestCase def say_hello(name=None): """A job with a single argument and a return value.""" ...
test_thread.py
"""TestCases for multi-threaded access to a DB. """ import os import sys import time import errno from random import random DASH = '-' try: WindowsError except NameError: class WindowsError(Exception): pass import unittest from test_all import db, dbutils, test_support, verbose, ha...
thread_pool.py
""" A simple thread pool implementation """ import threading import Queue import multiprocessing import traceback import exceptions from time import time from tab_splunktalib.common import log logger = log.Logs().get_logger("util") class ThreadPool(object): """ A simple thread pool implementation """ ...
tests.py
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import tempfile import threading import time import unittest import warnings from unittest import mock from django.conf import settings from django.core...
manager.py
#!/usr/bin/env python2.7 import os import sys import fcntl import errno import signal import subprocess from common.basedir import BASEDIR sys.path.append(os.path.join(BASEDIR, "pyextra")) os.environ['BASEDIR'] = BASEDIR def unblock_stdout(): # get a non-blocking stdout child_pid, child_pty = os.forkpty() if ch...
__init__.py
# -*- coding: utf-8 -*- # # This file is part of PyBuilder # # Copyright 2011-2020 PyBuilder Team # # 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/l...
twisted_test.py
# Author: Ovidiu Predescu # Date: July 2011 # # 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 ...
repairer.py
# Copyright 2013-2018 CERN for the benefit of the ATLAS collaboration. # # 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...
__init__.py
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistribu...
server.py
#!/usr/bin/env python import rospy import rostest import threading import unittest from smach import * from smach_ros import * from smach_msgs.msg import * ### Custom state classe class Setter(State): """State that sets the key 'a' in its userdata""" def __init__(self): State.__init__(self,['done'...
line_detector_node.py
# 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 that it will be useful, # bu...
log_printer.py
from __future__ import absolute_import from __future__ import unicode_literals import sys from collections import namedtuple from itertools import cycle from threading import Thread from docker.errors import APIError from six.moves import _thread as thread from six.moves.queue import Empty from six.moves.queue import...
jobs.py
# -*- coding: utf-8 -*- # # 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 ...
sensordata.py
#!/usr/bin/env python3 # # sensordata.py # # Copyright 2010-2016 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://aws.amazon...
PingWorker.py
import threading from threading import Thread, Event from PingConfig import PingConfig import urllib.request from datetime import datetime class PingWorker: config:PingConfig event = None def __init__(self, config): self.config = config self.event = Event() def poke(self): id ...
test_events.py
"""Tests for events.py.""" import collections.abc import concurrent.futures import functools import io import os import platform import re import signal import socket try: import ssl except ImportError: ssl = None import subprocess import sys import threading import time import errno import unittest from unitt...
runtest.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import pytest import re import string import sys import threading import time import unittest from collections import defaultdict, namedtuple, OrderedDict import numpy as np import ray import ray.ra...
vms_async_master.py
# coding: utf-8 #------------------------------ # ่ฎกๅˆ’ไปปๅŠก #------------------------------ import sys import os import json import time import threading import subprocess import shutil import base64 sys.path.append("/usr/local/lib/python2.7/site-packages") import psutil sys.path.append(os.getcwd() + "/class/core") rel...
zhihu_processor.py
# coding: utf-8 from parser.base_processor import BaseProcessor import asyncio from threading import Thread import json from cqa import CqaMeta from parser.htmlfetch import start_crawler_worker from wrapper import timer class ZhihuProcessor(BaseProcessor): def __init__(self, crawler_worker_loop, max_fetch_cnt=3):...
control_simulator.py
""" Created on 20 May 2016 @author: Alan Greer """ from __future__ import print_function import argparse import logging import time import threading import subprocess from latrd_channel import LATRDChannel from latrd_message import LATRDMessageException, LATRDMessage, GetMessage, PutMessage, PostMessage, ResponseMess...
thread3_join.py
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial import threading import time def thread_job(): print('T1 start\n') for i in range(10): ti...
test_reorg_detector.py
# -*- coding: utf-8 -*- from http.server import HTTPServer from multiprocessing import Process from time import sleep from django.core.cache import cache from django.test import TestCase from eth_tester import EthereumTester from hexbytes import HexBytes from web3 import HTTPProvider from web3.providers.eth_tester imp...
main.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import datetime import json import logging import os.path import threading import time from http.server import BaseHTTPRequestHandler, HTTPServer import yaml import Route logLevel = logging.INFO logging.basicConfig(level=logLevel) yamlFilePath = "example-config.yaml" i...
cron.py
from collections import namedtuple from datetime import datetime, timedelta import logging import threading from time import sleep logger = logging.getLogger('liberapay.cron') Daily = namedtuple('Daily', 'hour') Weekly = namedtuple('Weekly', 'weekday hour') class Cron(object): def __init__(self, website): ...
recordBH1750.py
""" Este programa lee la informacion del sensor conectado al arduino y la guarda en un archivo llamado datos.csv """ import time import argparse from serial import Serial from threading import Thread def empty_serial_buffer(uart): while uart.inWaiting(): rubish = uart.read() class SerialRe...
configure_and_test_integration_instances.py
from __future__ import print_function import argparse import ast import json import os import subprocess import sys import uuid import zipfile from datetime import datetime from packaging.version import Version from enum import IntEnum from pprint import pformat from threading import Thread from time import sleep from...
jupyter_utils.py
# Copyright 2020 The Kale 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 ...
misc_test.py
# Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root # for full license information. # ============================================================================== import numpy as np import pytest import cntk from cntk.device import * import sys fr...
listen.py
import errno import socket from ..context import context from ..log import getLogger from ..timeout import Timeout from .sock import sock log = getLogger(__name__) class listen(sock): """Creates an TCP or UDP-socket to receive data on. It supports both IPv4 and IPv6. The returned object supports all the...
oplog_manager.py
# -*- coding: UTF-8 -*- # Copyright 2013-2014 MongoDB, 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 la...
runner.py
from __init__ import Server from __init__ import clientRead from timeloop import Timeloop from datetime import timedelta import time import threading import random import logging server = Server('http://10.5.4.11:8080') print(server) clientlist=[] mesgpermin=1 tl=Timeloop() @tl.job(interval=timedelta(seconds=30)) de...
cam_server.py
import tornado import tornado.websocket import tornado.httpserver import threading import time import base64 import sys, os import gi gi.require_version('Gst', '1.0') from gi.repository import Gst, GObject import json import signal sockets = [] frame_grabber = None def send_all(msg): for ws in sockets: w...
miner.py
import json import paho.mqtt.client as mqtt from util import * TRX_GEN_INTERVAL = 5 MQTTBROKER = 'localhost' LEADING_ZEROS = 2 def block_summary(block): """ Return a summary of a block """ return f"{block['blockhash']} {block['timestamp']} {block['proof']}" def mine(miner: 'Miner'): """ M...