source
stringlengths
3
86
python
stringlengths
75
1.04M
video_analyser.py
import argparse as argp import multiprocessing.dummy as mp from pathlib import Path import time import cv2 import pandas as pd from tqdm import tqdm def writer_write(writer, q): while True: frame = q.get() if type(frame) == str and frame == "STOP": return writer.write(frame) ...
vanee_controller.py
import time import threading import logging import queue import signal import sys from datetime import datetime, timedelta import RPi.GPIO as GPIO logging.basicConfig(level=logging.DEBUG, format="%(asctime)s:%(name)s:%(message)s") MAX_HIGH_TIME = timedelta(minutes=60) HIGH_TIME_STEP = timedelta(minutes=15) RELAY_P...
indexer.py
from bs4 import BeautifulSoup as bs import os import threading import requests from time import sleep, ctime host = "http://index-of.co.uk/" headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.3; Win64; x64) \ AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"} # spoofed user agent fully_retri...
email.py
# coding : utf-8 from flask_mail import Message from app import mail from flask import render_template from app import app from threading import Thread def send_password_reset_email(user): token = user.get_reset_password_token() send_email('[Microblog] Reset Your Password', sender=app.config['ADMINS'][0], ...
testutils.py
from __future__ import print_function import os import sys from types import TracebackType import isodate import datetime import random from contextlib import AbstractContextManager, contextmanager from typing import ( Callable, Iterable, List, Optional, TYPE_CHECKING, Type, Iterator, ...
gdal2tiles.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ****************************************************************************** # $Id$ # # Project: Google Summer of Code 2007, 2008 (http://code.google.com/soc/) # Support: BRGM (http://www.brgm.fr) # Purpose: Convert a raster into TMS (Tile Map Service) tiles ...
core.py
# -*- coding: utf-8 -*- u"""SecureTea. Project: ╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐ ╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤ ╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴ Version: 1.1 Module: SecureTea """ # To share mouse gestures import struct import sys import time import threading from securetea import configurations from securet...
multit.py
import time, threading import numpy as np # 假定这是你的银行存款: start = time.time() x = 128 balance = np.zeros([x,x,x]) def change_it(i,j,k): # 先存后取,结果应该为0: global balance balance[i,j,k] = i*25+j*5+k # balance = balance - n def run_thread(n): for i in range(n): for j in range(n): ...
PopulateRedditDB.py
from multiprocessing import Process, Manager import time import itertools import sys,getopt,json, csv class Config: def __init__(self, corpus, dbhost, dbname, dbuser, dbpassword, threads, subredditid): self.corpus = corpus self.dbhost = dbhost self.dbname = dbname self.dbuser = dbus...
test_workspace.py
#!/usr/bin/env python # encoding: utf-8 # # Copyright SAS Institute # # Licensed under the Apache License, Version 2.0 (the License); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
threading.py
import asyncio import threading import datetime from queue import Queue from random import randint import re import sys import traceback import inspect from datetime import timedelta import logging import functools import iso8601 from appdaemon import utils as utils from appdaemon.appdaemon import AppDaemon class Th...
run.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ASL preprocessing workflow.""" from .. import config def main(): """Entry point.""" from os import EX_SOFTWARE from pathlib import Path import sys import gc from multiprocessing import Process, Manager from .parser import parse_args from...
test_thread_safety.py
import random import threading import time from typing import Callable from antidote import factory, world from antidote.core import Container class A: pass class B: pass class ThreadSafetyTest: n_threads = 10 __state = None @classmethod def run(cls, target: Callable[[], object], n_threa...
server.py
import time import threading from src.engine.engine import UsiEngine from src.engine.enums import Turn from src.engine.game_result import GameResult from src.engine.scanner import Scanner # 1対1での対局を管理してくれる補助クラス class AyaneruServer: def __init__(self): # --- public members --- # 1P側、2P側のエンジンを生成し...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import tempfile import urllib.request import traceback import asyncore import weakref import platform import functools ssl =...
player_7digital.py
""" Thierry Bertin-Mahieux (2010) Columbia University tb2332@columbia.edu This code uses 7digital API and info contained in HDF5 song file to get a preview URL and play it. It can be used to quickly listen to a song in the dataset. The goal is to be able to search songs by artist name, title, or Echo Nest ID. This is...
queue1_20_3_2.py
#!/usr/bin/env python3 # -*- coding:UTF-8 -*- # 两个使用者和生产者进程 import multiprocessing import time def consumer(input_q): while True: item = input_q.get() print(item) #可以换成实际的处理工作 input_q.task_done() time.sleep(1) def producer(seq,output_q): for item in seq: ...
gateway.py
from time import sleep import numpy as np import math import random from datetime import datetime, timedelta, timezone import paho.mqtt.client as mqtt import threading import ssl #import json # only for debug of control_execute_schedule #import requests #import pycurl #import httplib #import urllib import utils im...
main.py
from _runtime import server, CONFIG from fastapi import FastAPI, Request, Body, Response, status from fastapi.responses import HTMLResponse, StreamingResponse, FileResponse from fastapi_utils.tasks import repeat_every import uvicorn import rsa import os import sys import hashlib from pydantic import BaseModel, create_...
selfserve.py
#!/usr/bin/python # Self Server import sys import time import os import pickle import BaseHTTPServer import CGIHTTPServer import SocketServer import BaseHTTPServer import SimpleHTTPServer import socket import struct import threading class mcastThread: def __del__(self): try: self.sock.setsockopt(socket....
ExtensionDriver.py
# ========================================================================= # # Copyright Ziv Yaniv # # 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/licen...
listeners.py
""" Custom listeners for monitoring cybersecurity tweets. """ import configparser import csv import os import sys import time from http.client import IncompleteRead as http_incompleteRead from queue import Queue from threading import Thread from urllib3.exceptions import IncompleteRead as urllib3_incompleteRead impo...
netcdf.py
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Test NetCDF driver support. # Author: Frank Warmerdam <warmerdam@pobox.com> # #############################################################...
base_camera.py
import time import threading try: from greenlet import getcurrent as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident import logging logger = logging.getLogger('app') # logger = logging.getLogger(__name__) class CameraEvent(o...
mbase.py
""" mbase module This module contains the base model class from which all of the other models inherit from. """ import abc import os import shutil import threading import warnings import queue as Queue from datetime import datetime from shutil import which from subprocess import Popen, PIPE, STDOUT import copy im...
example1.py
import threading import random import time def update(): global counter current_counter = counter # reading in shared resource time.sleep(random.randint(0, 1)) # simulating heavy calculations counter = current_counter + 1 # updating shared resource counter = 0 threads = [threading.Thread(target...
collect.py
# taaraxtak # nick merrill # 2021 # # create-tables.py - defines the Postgres tables. # this runs always. import time import schedule import threading import logging from funcy import partial from src.shared.utils import configure_logging from src.w3techs.collect import collect as w3techs_collect from src.ooni.coll...
process&thread_basics.py
from multiprocessing import Process import time, os, threading from threading import Thread def learn(s): print(f'学习{s}中,进程号:{os.getpid()},线程号:{threading.current_thread()}') time.sleep(5) print(f'学习{s}完毕,进程号:{os.getpid()},线程号:{threading.current_thread()}') class_list = ['Optimization', 'Stochastic Model...
test_fft.py
import functools import unittest import pytest import numpy as np import cupy from cupy import testing from cupy.fft import config from cupy.fft.fft import _default_fft_func, _fft, _fftn def nd_planning_states(states=[True, False], name='enable_nd'): """Decorator for parameterized tests with and wihout nd plann...
process.py
import os import queue import threading from utils.scraper import Scraper class Process(Scraper): def __init__(self, site, base_dir, parse_count=10, threads=1): self._base_dir = base_dir self._progress_file = self._base_dir + "/progress" self.log_file = self._base_dir + "/logs" sel...
main_multiprocess.py
import csv import sklearn import imutils import argparse import cv2 import numpy as np import Preprocess as pp import os import time import datetime import tensorflow as tf import math import Calibration as cal import collections import DetectChars import DetectPlates import PossiblePlate import paho.mqtt.client as pah...
__init__.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
completer.py
# -*- coding: utf-8 -*- # # Copyright 2017 Google LLC. 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 requir...
get_dir.py
#!/usr/bin/env python3 """ Download the specified directory from the specified job's output files. """ import argparse import os import os.path as osp import subprocess import time from multiprocessing import Process def getfile(f): dirname = osp.dirname(f) os.makedirs(dirname, exist_ok=True) print("Dow...
test_container.py
# global import os import queue import pytest import random import numpy as np import multiprocessing import pickle # local import ivy from ivy.container import Container import ivy_tests.test_ivy.helpers as helpers def test_container_list_join(device, call): container_0 = Container( { "a": [...
run.py
import os import sys import time import torch import shutil from elegantrl.train.utils import init_agent, init_evaluator, init_replay_buffer from elegantrl.train.utils import server_leaderboard, PipeEvaluator from elegantrl.train.config import build_env from elegantrl.train.worker import PipeWorker from elegantrl.trai...
http_server__threading.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' # SOURCE: http://andreymal.org/socket3/ import time import socket from threading import Thread def send_answer(conn, status="200 OK", typ="text/plain; charset=utf-8", data=""): data = data.encode("utf-8") conn.send(b"GET HTTP/1.1 " + ...
app.py
# -*- coding: utf-8 -*- """ Created on Thu Apr 12 01:39:31 2021 @author: amannirala13 """ # Library import block import serial import numpy as np import os try: import tkinter as tk except: import Tkinter as tk import time import threading from datetime import datetime, timedelta #------------------------------------...
OpTestInstallUtil.py
#!/usr/bin/env python2 # OpenPOWER Automated Test Project # # Contributors Listed Below - COPYRIGHT 2018 # [+] International Business Machines Corp. # # # 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 Lic...
locusts.py
#! python3 # -*- encoding: utf-8 -*- ''' Current module: httplocust.locusts Rough version history: v1.0 Original version to use ******************************************************************** @AUTHOR: Administrator-Bruce Luo(罗科峰) MAIL: luokefeng@163.com RCS: httplocust.locusts...
vm_util_test.py
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
helpers.py
import cgi import threading import pymlconf import ujson from . import exceptions from .configuration import settings, configure class LazyAttribute: """ ``LazyAttribute`` decorator is intended to promote a function call to object attribute. This means the function is called once and replaced wi...
test_focuser.py
import time import pytest from threading import Thread from panoptes.utils.config.helpers import load_config from panoptes.pocs.focuser.simulator import Focuser as SimFocuser from panoptes.pocs.focuser.birger import Focuser as BirgerFocuser from panoptes.pocs.focuser.focuslynx import Focuser as FocusLynxFocuser from...
trainer.py
""" training script date: 10/4 author: arabian9ts """ # escape matplotlib error import matplotlib matplotlib.use('Agg') # escape tensorflow warning import os os.environ['TF_CPP_MIN_LOG_LEVEL']='2' import datetime import tensorflow as tf import numpy as np import pickle import threading import matplotlib.pyplot as p...
Process.py
import threading class ProcessParallel(object): #Thanks https://stackoverflow.com/questions/11968689/python-multithreading-wait-till-all-threads-finished def __init__(self, *jobs): self.jobs = jobs self.processes = [] self.processes_url = [] self.processes_extra = [] ...
videoGet.py
from threading import Thread import socket import struct import time class VideoGet(): def __init__(self, ui): self.HOST = "169.254.196.68" self._PORT = 8485 self.frame_data_send = "" self._ui = ui def connect(self): while True: if self._ui.camera_var == 0: ...
demo.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- import requests import json import time from lxml import etree import threading headers = { "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36" } News_set = set() def getData(): ...
ClientsCluster.py
__author__ = 'cmantas' _author__ = 'cmantas' from Node import Node from VM import get_all_vms from json import loads, dumps from os import remove from os.path import isfile from lib.persistance_module import get_script_text, env_vars from lib.tiramola_logging import get_logger from threading import Thread from lib.Clus...
kernel.py
from queue import Queue from threading import Thread from ipykernel.kernelbase import Kernel import re import subprocess import tempfile import os import os.path as path class RealTimeSubprocess(subprocess.Popen): """ A subprocess that allows to read its stdout and stderr in real time """ def __init...
test_client_http.py
import select import socket import contextlib import threading import mock from tests import unittest from contextlib import contextmanager import botocore.session from botocore.config import Config from botocore.vendored.six.moves import BaseHTTPServer, socketserver from botocore.exceptions import ( ConnectTimeou...
test_collection.py
import numpy import pandas as pd import pytest from pymilvus import DataType from base.client_base import TestcaseBase from utils.util_log import test_log as log from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from utils.utils import * from...
engine.py
""" """ import logging from logging import Logger import smtplib import os from abc import ABC from datetime import datetime from email.message import EmailMessage from queue import Empty, Queue from threading import Thread from typing import Any, Sequence, Type, Dict, List, Optional from vnpy.event import Event, Eve...
__init__.py
""" # an API for Meshtastic devices Primary class: SerialInterface Install with pip: "[pip3 install meshtastic](https://pypi.org/project/meshtastic/)" Source code on [github](https://github.com/meshtastic/Meshtastic-python) properties of SerialInterface: - radioConfig - Current radio configuration and device setting...
appmonitor.py
#!/usr/bin/python import os, sys import sh import pika #aiopika import ssl import certifi import time import glob import json import pickle import traceback import threading import queue import urllib import urllib.parse import urllib.request import imp import logging from dotenv import load_dotenv log = logging.getL...
test__socket.py
from gevent import monkey; monkey.patch_all() import sys import os import array import socket import traceback import time import greentest from functools import wraps import _six as six # we use threading on purpose so that we can test both regular and gevent sockets with the same code from threading import Thread as...
test_logging.py
# Copyright 2001-2017 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
start_distributed_worker.py
# Copyright 2021 Huawei Technologies 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...
test_sources.py
# # Runtime Tests for Source Modules # import contextlib import ctypes import http.server import json import os import socketserver import subprocess import tempfile import threading import pytest import osbuild.objectstore import osbuild.meta import osbuild.sources from osbuild import host from .. import test def...
test_api.py
import mock import re import socket import threading import time import warnings from unittest import TestCase import pytest from ddtrace.api import API, Response from ddtrace.compat import iteritems, httplib, PY3 from ddtrace.internal.runtime.container import CGroupInfo from ddtrace.vendor.six.moves import BaseHTTP...
mine_safe_bank.py
import datetime import random import time from threading import Thread, RLock from typing import List class Account: def __init__(self, balance=0): self.balance = balance def main(): accounts = create_accounts() total = sum(a.balance for a in accounts) validate_bank(accounts, total) pri...
test_xmlrpc.py
import base64 import datetime import sys import time import unittest import xmlrpclib import SimpleXMLRPCServer import mimetools import httplib import socket import StringIO import os import re from test import test_support try: import threading except ImportError: threading = None try: import gzip except...
__init__.py
# -*- coding: utf-8 -*- import os import sys import platform import multiprocessing from multiprocessing import Process, Queue from ._core import __doc__, run from ._core import __file__ as module_file_path # Fix for MacOS High Sierra, see: # https://stackoverflow.com/questions/30669659/multiproccesing-and-error-th...
ws_api_socket.py
from functools import partial from befh.api_socket import ApiSocket from befh.util import Logger import websocket import threading import json import time import zlib class WebSocketApiClient(ApiSocket): """ Generic REST API call """ def __init__(self, id, received_data_compressed=False, proxy=None): ...
sampro.py
''' Data is kept in two dictionaries: 1- rooted_leaf_counts; this is the amount of samples on each function/line number pair this data can be used to answer the question "where are my threads spending their time?" this is useful for finding hotspots; these are namespaced by root function, this is a decent proxy for thr...
train.py
import threading from time import time import tensorflow as tf from models.load_data import * from tensorflow.contrib.slim.nets import inception from adv_imagenet_models import inception_resnet_v2 from attacks import fgsm summary_path = '/home/yangfan/ensemble_training' ALPHA = 0.5 EPSILON = 0.3 learning_rate = 0.00...
_nonunicode-textEditor.py
""" ################################################################################ PyEdit 2.1: a Python/tkinter text file editor and component. Uses the Tk text widget, plus GuiMaker menus and toolbar buttons to implement a full-featured text editor that can be run as a standalone program, and attached as a componen...
remote_executor.py
# Copyright 2019, The TensorFlow Federated 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 o...
scripts.py
# -*- coding: utf-8 -*- ''' This module contains the function calls to execute command line scripts ''' # Import python libs from __future__ import absolute_import, print_function import os import sys import time import logging import threading import traceback from random import randint # Import salt libs from salt ...
wallpaper-switcher.py
import argparse import importlib import os import random import signal import sys import threading import time from collections import defaultdict import json import ntpath import wallpaper_helper img_transition = importlib.import_module("image-transition") # TODO: add blur option class WallpaperSwitcher: rece...
scriptinfo.py
import os import sys from copy import copy from datetime import datetime from functools import partial from tempfile import mkstemp, gettempdir import attr import logging import json from pathlib2 import Path from threading import Thread, Event from .util import get_command_output, remove_user_pass_from_url from .......
client.py
from multiprocessing import Process import time import pprint from swiftclient.client import Connection """ reference : https://docs.openstack.org/python-swiftclient/latest/client-api.html#examples """ pretty_print = pprint.PrettyPrinter(indent=4).pprint meta_name = "x-container-meta-data" container_meta_testdata={m...
debug.py
"""Class that renders the BT in a web browser and allows ticking the tree manually.""" # Copyright (c) 2022, ABB # All rights reserved. # # Redistribution and use in source and binary forms, with # or without modification, are permitted provided that # the following conditions are met: # # * Redistributions of sourc...
software_engineering_threading2.py
import threading def appstart(): print 'Start your dev_appserver' # Do operations def coveragestart(): print 'Start your coverage' # Do operations t = threading.Thread(name='start', target=appstart) w = threading.Thread(name='stop', target=coveragestart) t.start() w.start() w.join() # Note that I am ...
cluster_filter.py
import pandas as pd import numpy as np import itertools import shlex import subprocess import os, sys import threading import signal import time sys.path.insert(0, os.path.dirname(os.path.abspath(os.path.realpath(__file__)))) import variables class TimeOutException(BaseException): pass # filename = '{}.pid'.form...
addons.py
# -*- coding: utf-8 -*- #监听websocket,通过xmlrpc为其他程序提供抓包服务 import os from selenium.webdriver.chrome.options import Options from selenium import webdriver import threading import pickle import mitmproxy.addonmanager import mitmproxy.connections import mitmproxy.http import mitmproxy.log import mitmproxy.tcp import mitmpr...
joomla_killer.py
import http.cookiejar import queue import threading import urllib.error import urllib.parse import urllib.request from abc import ABC from html.parser import HTMLParser # general settings user_thread = 10 username = "admin" wordlist_file = "INSERT-WORDLIST" resume = None # target specific settings target_url = "http:...
maincode_raspberrypi.py
#Main Code: Automated Bridge Inspection - Raspberry Pi #Group 1, ME588 # import packages here #################################### # import different functions needed here ########################## # FSM ########################################################## # inputs: # pan = camera servo1 angle readings (ou...
decorators.py
from threading import Thread def asynch(f): def wrapper(*args, **kwargs): thr = Thread(target=f, args=args, kwargs=kwargs) thr.start() return wrapper
test_pytest_cov.py
import collections import glob import os import platform import re import subprocess import sys from itertools import chain import coverage import py import pytest import virtualenv import xdist from fields import Namespace from process_tests import TestProcess as _TestProcess from process_tests import dump_on_error f...
test_callbacks.py
import os import sys import multiprocessing import numpy as np import pytest from keras import optimizers np.random.seed(1337) from keras import callbacks from keras.models import Graph, Sequential from keras.layers.core import Dense from keras.utils.test_utils import get_test_data from keras import backend as K fro...
HiwinRA605_socket_ros_test_20190626114758.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...
__init__.py
#!/usr/bin/python3 # @todo logging # @todo extra options for url like , verify=False etc. # @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option? # @todo option for interval day/6 hour/etc # @todo on change detected, config for calling some API # @todo fetch title into json # https://di...
deploy_operations.py
''' deploy operations for setup zstack database. @author: Youyk ''' import zstackwoodpecker.test_util as test_util import apibinding.api_actions as api_actions import account_operations import resource_operations as res_ops import zstacklib.utils.sizeunit as sizeunit import zstacklib.utils.jsonobject as ...
installwizard.py
import os import sys import threading import traceback from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from electrum import Wallet, WalletStorage from electrum.util import UserCancelled, InvalidPassword from electrum.base_wizard import BaseWizard from electrum.i18n import _ from ....
models.py
from django.db import models from django.utils import timezone from django.utils.crypto import get_random_string from django.conf import settings import qrcode import os class User(models.Model): email = models.EmailField(max_length=100) password = models.CharField(max_length=40) signup_at = models.Da...
dsr_service_motion_simple.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ## # @brief [py example simple] motion basic test for doosan robot # @author Kab Kyoum Kim (kabkyoum.kim@doosan.com) import rospy import os import threading, time import sys sys.dont_write_bytecode = True sys.path.append( os.path.abspath(os.path.join(os.path.dirn...
Server.py
import socket from threading import Thread import time data = open("../assets/version.txt" , "r").read() print("Chat Room 101 | " + data) time.sleep(1) clients = {} addresses = {} host = socket.gethostname() ip = socket.gethostbyname(host) port = 8080 s = socket.socket() s.bind((host,port)) print(host, ip) print("As...
test_insert.py
import pytest from pymilvus import DataType, ParamError, BaseException from utils.utils import * from common.constants import * from common.common_type import CaseLabel ADD_TIMEOUT = 60 uid = "test_insert" field_name = default_float_vec_field_name binary_field_name = default_binary_vec_field_name default_single_query ...
json_ipc.py
import os import socket import threading import logging import easilyb.json_serialize as json logger = logging.getLogger(__name__) BUFFER_SIZE = 4096 MAX_OBJECT_SIZE = 1024 * 1024 * 1024 # 1GB DEFAULT_MAX_TRIES = 5 class JsonSocket(object): def __init__(self, sock, max_tries=DEFAULT_MAX_TRIES): self.soc...
file.py
import sublime import threading import yaml import os from contextlib import contextmanager if 'syntax_file_map' not in globals(): syntax_file_map = {} if 'determine_syntax_thread' not in globals(): determine_syntax_thread = None def determine_syntax_files(): global determine_syntax_thread if not s...
test_runner_local.py
import os import threading import time from typing import Optional from unittest import TestCase import psutil from galaxy import ( job_metrics, model, ) from galaxy.app_unittest_utils.tools_support import UsesTools from galaxy.jobs.runners import local from galaxy.util import bunch class TestLocalJobRunner...
test_http_client_connection_to_aries_cloud_agent.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # 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 ...
receiver.py
import queue import threading import cv2 from enhancer import Enhancer import numpy as np from tensorflow import keras import time from stream import Streamer output_dir = 'frames' q = queue.Queue() q_out = queue.Queue() # model = keras.models.load_model('models/generator.h5') # inputs = keras.Input((None, None, 3)) ...
import_img.py
# ##### BEGIN GPL LICENSE BLOCK ##### # # 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 2 # of the License, or (at your option) any later version. # # This program is distrib...
transport.py
""" track.transport ~~~~~~~~~~~~~~~ :copyright: (c) 2013 Simon Zimmermann. :copyright: (c) 2010-2012 by the Sentry Team. """ from __future__ import absolute_import import atexit import logging import os import requests import threading import time from .compat import Queue DEFAULT_TIMEOUT = 10 logger = logging.get...
sfp_tldsearch.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------- # Name: sfp_tldsearch # Purpose: SpiderFoot plug-in for identifying the existence of this target # on other TLDs. # # Author: Steve Micallef <steve@binarypool.com> # # Created: 3...
test_tracer.py
import time import mock import opentracing from opentracing import Format from opentracing import InvalidCarrierException from opentracing import SpanContextCorruptedException from opentracing import UnsupportedFormatException from opentracing import child_of import pytest import ddtrace from ddtrace.ext.priority imp...
create_instances.py
#!/usr/bin/env python3 # # Copyright 2018 The Bazel 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 ...
circuit_design.py
#Uses python3 import sys import threading sys.setrecursionlimit(10 ** 7) # max depth of recursion threading.stack_size(2 ** 27) # new thread will get stack of such size class Dgraph: """ A class to represent a directed graph. ... Attributes ---------- num_v : int() Number of vert...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...