source
stringlengths
3
86
python
stringlengths
75
1.04M
utility.py
from abc import ABC import nltk import queue import threading import pickle import warnings import json from html.parser import HTMLParser import os warnings.filterwarnings("ignore", category=DeprecationWarning) warnings.filterwarnings("ignore", category=UserWarning) langs = ['ru', 'en'] categories = ["entertainment"...
collect_from_opcua.py
#!/usr/bin/env python import matplotlib matplotlib.use("Agg") import time from lofarimaging.opc_interface import download_xst from lofarimaging import make_xst_plots import threading import sys import matplotlib.pyplot as plt import logging integration_time_s = 5 logger = logging.getLogger(__name__) def download_an...
worker.py
''' Created on May 29, 2015 @author: mzwier ''' import logging import multiprocessing import os import signal import threading from .core import ZMQCore, Message, ZMQWMTimeout, PassiveMultiTimer, Task, Result, TIMEOUT_MASTER_BEACON import zmq log = logging.getLogger(__name__) class ZMQWorker(ZMQCore): '''Th...
gps.py
import argparse from functools import reduce import logging import operator import os import platform import threading import time import pynmea2 import serial import utm logger = logging.getLogger(__name__) def is_mac(): return "Darwin" == platform.system() class Gps: def __init__(self, serial:str, baudrat...
environment.py
import abc import datetime import os import psycopg2 import json import shutil import signal import six import subprocess import sys import tempfile import threading import time import yaml from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer @six.add_metaclass(abc.ABCMeta) class AbstractControlle...
TCP_Control.py
#-*- coding:utf-8 -*- import RPi.GPIO as GPIO import socket import time import string import threading #按键值定义 run_car = '1' #按键前 back_car = '2' #按键后 left_car = '3' #按键左 right_car = '4' #按键右 stop_car = '0' #按键停 #舵机按键值定义 front_left_servo = '1' #前舵机向左 front_right_servo = '2' #前舵机向右 up_servo = '3' #摄像头舵机向上...
test_creator.py
from __future__ import absolute_import, unicode_literals import difflib import gc import logging import os import shutil import stat import subprocess import sys from itertools import product from textwrap import dedent from threading import Thread import pytest from virtualenv.__main__ import run, run_with_catch fr...
dj.py
# WinDJ - David Ragusa # Refer to the LICENSE file. import os import re import sys import pafy import html import queue import requests import threading import pyWinhook import tkinter as tk import multiprocessing from configparser import ConfigParser from helper import errorbox, resource_path try: ...
http.py
#!/usr/bin/env https://github.com/Tandelajr/mr.tandela # MIT License # # Copyright (C) 2020, Entynetproject. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without re...
gui.py
# -*- coding: utf-8; -*- import sys import tkinter import prepare_ocr import ocr from PIL import Image import data import adjust import screenshot import tts import threading import re import webbrowser import urllib.parse import uihelper def show(param, history): root = tkinter.Tk() uihelper.registerEntryPo...
1.Learning_rate_finder.py
import neptune.new as neptune import os import torch.nn as nn import torch import torch.nn.functional as F from torch.optim import SGD, Adam from torch.utils.data import DataLoader, random_split from torch.optim.lr_scheduler import CyclicLR import torch.multiprocessing as mp import numpy as np import random import sys...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import deserialize_xpub from electrum import constants from electrum.i18n import _ from el...
serve.py
''' Serve the docs page and open in default browser. Combination of these two SO (license CC-BY-SA 4.0) answers: https://stackoverflow.com/a/51295415/3838691 https://stackoverflow.com/a/52531444/3838691 ''' import time from threading import Thread import webbrowser from functools import partial from http.server import...
feeder.py
import os import threading import time import traceback import numpy as np import tensorflow as tf from infolog import log from sklearn.model_selection import train_test_split from tacotron.utils.text import text_to_sequence _batches_per_group = 64 class Feeder: """ Feeds batches of data into queue on a backgroun...
test_stream_xep_0030.py
import time import threading import unittest from sleekxmpp.test import SleekTest class TestStreamDisco(SleekTest): """ Test using the XEP-0030 plugin. """ def tearDown(self): self.stream_close() def testInfoEmptyDefaultNode(self): """ Info query result from an entity M...
interface.py
import asyncio import logging import argparse from time import sleep from threading import Thread from kademlia.network import Server # command line interface class App(object): def __init__(self): self.parser = argparse.ArgumentParser(description='A p2p key-value databse.') def parse_commandline(sel...
parallel.py
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03a_parallel.ipynb (unless otherwise specified). __all__ = ['threaded', 'startthread', 'set_num_threads', 'ThreadPoolExecutor', 'ProcessPoolExecutor', 'parallel', 'run_procs', 'parallel_gen'] # Cell from .imports import * from .foundation import * from .basic...
asynchronous_control_carla.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys from os.path import join, dirname sys.path.insert(0, join(dirname(__file__), '../../')) sys.path.insert(0, join(dirname(__file__), '../')) import simulator simulator.load('/home/wang/CARLA_0.9.9.4') import carla sys.path.append('/home/wang/CARLA_0.9.9.4/PythonA...
task.py
import logging import threading import time import tkinter as tk from typing import TYPE_CHECKING, Any, Callable, Optional, Tuple if TYPE_CHECKING: from core.gui.app import Application class ProgressTask: def __init__( self, app: "Application", title: str, task: Callable, ...
stock_rpc_gateway.py
import sys import traceback import json from copy import deepcopy from uuid import uuid1 from datetime import datetime, timedelta from time import sleep from threading import Thread from multiprocessing.dummy import Pool from typing import Dict import pandas as pd from vnpy.event import Event from vnpy.rpc import RpcC...
test_api.py
import cio import six import threading from cio.backends import cache from cio.conf import settings from cio.conf.exceptions import ImproperlyConfigured from cio.pipeline import pipeline from cio.backends import storage from cio.backends.exceptions import NodeDoesNotExist from cio.utils.uri import URI from tests import...
__init__.py
""" Created on Aug 2, 2015 @author: ivan """ from threading import Thread from commander.listview import ListView from commander.input import Input from commander.commander import Commander from commander.command import Command if __name__ == "__main__": class TestCmd(Command): def do_echo(self, *arg...
thread_safe.py
# -*- coding: utf-8 -*- from __future__ import with_statement import time import ctypes import Queue import threading import traceback import inspect import weakref from basis import weakmethod # 取自 PyPubSub v3.2 的 pubsub.core.weakmethod class SafeList(object): def __init__(self, init_list=None, lock=No...
redirect.py
import sys import os import threading import logging from vsi.tools.python import Try class RedirectBase(object): def flush(self): ''' Flushes stdout and stderr ''' sys.stdout.flush() sys.stderr.flush() class Logger(object): ''' File object wrapper for logger. Careful when using this, if t...
_core.py
""" Multicast DNS Service Discovery for Python, v0.14-wmcbrine Copyright 2003 Paul Scott-Murphy, 2014 William McBrine This module provides a framework for the use of DNS Service Discovery using IP multicast. This library is free software; you can redistribute it and/or modify it under the terms of...
proc.py
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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...
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 ...
MLCompare.py
#-*- coding: utf-8 -*- """ TODO: - Test with a larger dataset. - Add choice for regression vs classification. (separate methods or function params) - Add more algorithms. """ import time import numpy as np from sklearn import datasets, svm, neighbors, linear_model, naive_bayes, tree, ensemble from sklearn.grid_sea...
2.multiprocess.py
#!/usr/bin/python3 #encoding=utf8 from multiprocessing import Process import os #sub process run code def run_subProcess(name): print('Run child process name is %s (%s)' %(name ,os.getpid())) if __name__ == '__main__' : print('Parent process %s.' %os.getpid()) p = Process(target=run_subProcess, args=('test',)) p...
7_distributed_curricula.py
""" Copyright © 2021 The Johns Hopkins University Applied Physics Laboratory LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to...
main.py
#! /usr/bin/env python # noted by chan #orion -v --debug hunt -c ./orion_config.yaml -n ppo_test ./algorithms/ppo/main.py --epochs~'fidelity(5000, 10000)' --lr~'uniform(1e-5, 1)' #orion -v --debug hunt -c ./orion_config.yaml -n nav_ppo ./alg_robothor/ppo/main.py --gamma~'uniform(.95,.9995)' --epochs~'fidelity(5000, 100...
agent.py
import subprocess from datetime import datetime from threading import Thread from functools import partial from apps.assets.models import Host from apps.schedule.models import JobHistory from libs.utils import Container from libs.ssh import ssh_exec_command # targets有三种格式: # localhost 服务端本机执行 # 1 整数类型...
main.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Name: CodyCloud Ngrok Server # Author: Icy(enderman1024@foxmail.com) # OS: Linux import time, socket, threading, os, sys, json def init(): global LOGGER, KEY, STOP paths = ("./bin/","./cache/","./configs/","./logs/") for i in paths: path_fixer(i) try: configs = ...
SharedStateService.py
# Copyright 2015 Ufora 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 i...
ImplementationTool.py
#!python # Produces the set of factorial implementations (defined by models argument) from input RT-level model # for given configuration of implementation flow (config.flow in the input configuration argument) # Author: Ilya Tuzov, Universitat Politecnica de Valencia import sys import xml.etree.ElementTree as ET impo...
__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...
WS11-threads-processes.py
from multiprocessing import freeze_support from multiprocessing import Pool from multiprocessing import Process from threading import Thread import time def countdown(n): while n > 0: n -= 1 count = 50000000 start = time.time() countdown(count) print(time.time() - start) t1 = Thread(target=countdown, ...
wandb_run.py
import _thread as thread import atexit from collections.abc import Mapping from datetime import timedelta from enum import IntEnum import functools import glob import json import logging import numbers import os import re import sys import threading import time import traceback from types import TracebackType from typi...
config.py
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: # # Copyright 2021 The NiPreps Developers <nipreps@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...
network_subscriber.py
from importlib import import_module import rclpy import socket import threading import traceback from ros2relay.message_socket.message_socket import MessageSocket, SocketMessage, MessageType from ros2relay.metrics.metrics import MessageMetricsHandler from rclpy.node import Node class NetworkSubscriber(Node): """...
safe_t.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node from electrum import constants from electrum.i18n import _ from electrum....
arm_localcpu_imagenet_bench.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...
main.py
import threading from queue import Queue from spider import Spider from domain import * from general import * PROJECT_NAME = 'autotrader' # no built in constants in python, just use all caps HOMEPAGE = 'https://twitter.com/' DOMAIN_NAME = get_domain_name(HOMEPAGE) QUEUE_FILE = PROJECT_NAME + '/queue.txt' CR...
slot.py
import os import random import signal import sys import threading from time import sleep from .component import Component class SlotComponent(Component): """ .. warning:: Experiment feature. BE CAREFUL! WE MAY REMOVE THIS FEATURE! """ class Handle(object): """ * `...
interface.py
from _socket import SO_REUSEADDR, SOL_SOCKET from libs.FlightGear import FlightGear import sys from libs.SimpleWebSocketServer import SimpleWebSocketServer, WebSocket import subprocess from threading import Thread, Event from multiprocessing import Process, freeze_support import SimpleHTTPServer import SocketServer imp...
flasher.py
#!/usr/bin/env python # # Copyright (c) 2016, Pycom Limited. # # This software is licensed under the GNU GPL version 3 or any # later version, with permitted additional terms. For more information # see the Pycom Licence v1.0 document supplied with this file, or # available at https://www.pycom.io/opensource/licensing ...
__init__.py
import copy import os import threading import time import json import operator import pkg_resources # anchore modules import anchore_engine.clients.localanchore_standalone import anchore_engine.common.helpers from anchore_engine.clients.services import internal_client_for from anchore_engine.clients.services.simpleque...
test_ufuncs.py
from __future__ import print_function import functools import itertools import re import sys import warnings import threading import numpy as np import numba.unittest_support as unittest from numba import types, typing, utils, typeof, numpy_support, njit from numba.compiler import compile_isolated, Flags, DEFAULT_FL...
test_kmlsync.py
#!/usr/bin/env python PKG = 'lg_earth' NAME = 'test_kmlsync' KMLSYNC_HOST = '127.0.0.1' KMLSYNC_PORT = 8765 KML_ENDPOINT = 'http://' + KMLSYNC_HOST + ':' + str(KMLSYNC_PORT) WINDOW_SLUG = 'center' import sys import re import time import json import rospy import rostest import unittest import requests import xml.etre...
server.py
# Copyright (c) 2016-2021, Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list o...
target_bigquery.py
#!/usr/bin/env python3 import argparse import io import sys import simplejson as json import logging import collections import threading import http.client import urllib import pkg_resources from decimal import Decimal from datetime import datetime, timedelta from time import sleep from jsonschema import validate imp...
test_utilities.py
import threading from _pydevd_bundle.pydevd_utils import convert_dap_log_message_to_expression from tests_python.debug_constants import IS_PY26, IS_PY3K, TEST_GEVENT, IS_CPYTHON import sys from _pydevd_bundle.pydevd_constants import IS_WINDOWS, IS_PY2, IS_PYPY import pytest import os import codecs from _pydevd_bundle....
manualtab.py
# Released under the MIT License. See LICENSE for details. # """Defines the manual tab in the gather UI.""" from __future__ import annotations import threading from typing import TYPE_CHECKING, cast from enum import Enum from dataclasses import dataclass from bastd.ui.gather import GatherTab import _ba import ba if...
24var.py
#!/usr/bin/env python3 # -*- config: utf-8 -*- #Вариант 24 import math from threading import Thread def sm_first(x, n): return math.cos(n*x)*n/(4*(n**2)-1) def first(x, n): n = n x = x eps = 1.0E-7 previous = 0 current = sm_first(x, n) n += 1 test = - 1/4 - ((1 / 4) * math.cos(x/...
__init__.py
# coding=utf-8 from __future__ import absolute_import import io import logging import os import socket import subprocess import threading import time from base64 import b64decode from datetime import timedelta, datetime from io import BytesIO from threading import Thread, Event from typing import Tuple, Optional impo...
encode_png_benchmark.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...
util.py
import web3 import web3.auto as web3auto from web3.middleware import geth_poa_middleware import time import threading import hashlib import os import subprocess import json from sha3 import keccak_256 w3 = None HOST="127.0.0.1" PORT="8545" def connect(host=None,port=None,poa=False): global w3 if host is None...
buildSystem.py
# Author: Benjamin Merkt, Physikalisches Institut, Universitaet Freiburg import sys import sympy as spy import numpy as np from multiprocessing import Queue, Queue, Process # try/except necessary for R interface (imports automatically and does not find other files) try: from functions import * from polyClass impo...
planificador_merge_paralelo.py
import Sensor_merge_paralelo import random import time import numpy import sys from multiprocessing import Process, Manager, Lock from multiprocessing.managers import BaseManager def alarmas(object, num_process, tiempo_limite): tiempo_inicio = time.time() while (1): lista = object.get_obj() fo...
node_tools_test.py
#!/usr/bin/env python # # Copyright 2008 the V8 project authors. 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 source code must retain the above copyright # noti...
train_extractive.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 import distributed from models import data_loader, model_builder from models.data_loader import load_dataset from models.model_builder im...
hotword_factory.py
# Copyright 2017 Mycroft AI 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 writin...
heartbeat.py
#-*- coding:utf-8 -*- import requests import time import logging import logging.handlers import psutil import os import signal import argparse import threading import smtplib from email.mime.text import MIMEText logger = logging.getLogger(__name__) formatter = logging.Formatter('[%(asctime)s][%(levelname)s|%(filena...
ChipBluezMgr.py
# # Copyright (c) 2020 Project CHIP Authors # Copyright (c) 2019-2020 Google LLC. # Copyright (c) 2015-2018 Nest Labs, 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 ...
test_flow_controller.py
# Copyright 2020, 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 required by applicable law or a...
feeder.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...
datasets.py
import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from utils.utils import xyxy2xywh, xywh2...
connhandler.py
""" initate connect request and schedule 1min task """ import platform import time from apminsight.agentfactory import get_agent from apminsight.constants import arh_connect, arh_data from apminsight.logger import agentlogger from apminsight.collector.reqhandler import send_req from apminsight.collector.reshandl...
gDrive.py
import os import re import glob import pickle import urllib.parse as urlparse from urllib.parse import parse_qs from bot import LOGGER import json import random import time import threading import logging import requests import socket from socket import timeout from google.auth.transport.requests import Request from ...
nmap_ping.py
from __future__ import print_function from logging import getLogger, ERROR getLogger("scapy.runtime").setLevel(ERROR)#Une erreur apparait, ce bout de code permet de l'enlever from scapy.all import get_if_addr, conf import subprocess from multiprocessing import Process import sys import time import os import argparse im...
advanced-reboot.py
# # ptf --test-dir ptftests fast-reboot --qlen=1000 --platform remote -t 'verbose=True;dut_username="admin";dut_hostname="10.0.0.243";reboot_limit_in_seconds=30;portchannel_ports_file="/tmp/portchannel_interfaces.json";vlan_ports_file="/tmp/vlan_interfaces.json";ports_file="/tmp/ports.json";dut_mac="4c:76:25:f5:48:80";...
filter.py
from web3 import Web3, HTTPProvider from threading import Thread import time, sys # Constant #--------------------------------------------------------------------- #host = 'http://localhost:8545' # XXX a_keyPair = "0x57083392b29bdf24512c93cfdf45d38c87d9d882da3918c59f4406445ea976a4" b_keyPair= "0x7b5c5af9736d9f1773f2...
application.py
from threading import Thread from application.domain.iBaseWatcher import IBaseWatcher from application.domain.iCerebrum import ICerebrum from application.domain.iRobotWorker import IRobotWorker class Application: def __init__(self, cerebrum: ICerebrum, robot_worker: IRobotWorker, base_watcher: IBaseWatcher): ...
MultiV2.py
import logging from threading import Thread, Lock, current_thread from queue import Queue import time from tradingview_ta import TA_Handler, Interval, Exchange # use for environment variables import os # use if needed to pass args to external modules import sys # used for directory handling import glob import time #lo...
demo_fox.py
# -*- coding: utf-8 -*- # @Time : 2018/9/6 下午2:13 # @Author : shijie luan # @Email : lsjfy0411@163.com # @File : demo_protocol.py # @Software: PyCharm ''' 本模块主要是为了和10个协议的仿真接轨,可以复用数据库模块、server模块、分类模块 鉴于FANUC蜜罐已经实现了各模块,所以此模块改动前可参照上述提到的几个模块 基本思路: 1.筛选10个协议:需要 请求(最好是nmap脚本的,没有也可以标明功能)—— 应答对 2.数据库存储:id-请...
carla_waypoint_publisher.py
#!/usr/bin/env python # # Copyright (c) 2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Generates a plan of waypoints to follow It uses the current pose of the ego vehicle as starting point. If the vehicle is respawned or...
24_multiprocess_sharememory.py
""" 进程间通信之共享内存 """ from multiprocessing import Process from multiprocessing import Value from multiprocessing import Array import ctypes # 在共享内存中创建一个表示数值的ctypes对象 num1 = Value('d', 2.3) num2 = Value(ctypes.c_float, 2.4) # 在共享内存中创建一个表示数组的ctypes对象 arr1 = Array('i', range(1, 5)) arr2 = Array(ctypes.c_int, range(6, 10)) ...
multiproc.py
# Copyright 2020 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import collections import logging import os import select import threading """Zmake multiprocessing utility module. This module is used to aid in zmake's...
Brakometer.py
import ac import acsys import colorsys import json import math import pickle import traceback import threading import os import sys import platform import ACUtils from BrakePointIndicator import BrakePointIndicator doRender = True appWindow = 0 indicators = {} customFont = "Consolas" shutdown = False tyreCompound = ...
mqtt_publish_test.py
from __future__ import print_function from __future__ import unicode_literals from builtins import str import re import sys import ssl import paho.mqtt.client as mqtt from threading import Thread, Event import time import string import random from tiny_test_fw import DUT import ttfw_idf event_client_connected = Even...
__main__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Copyright 2018 SiLeader and Cerussite. 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-...
02_Semaphores.py
""" Semaphores is simply advanced counter and it will block only after number of threads have acquireed it using acquire() to count - 1 using release() to count + 1 BoundedSemaphore raise an error if release() increase counter beyond the maximize size Semaphore not bounded demo with simply producer and consum...
player.py
import threading import queue from subprocess import Popen, PIPE q = queue.Queue() q_list = [] process = None def worker(): global current, process, q_list while True: item = q.get() log = None if "stream_url" in item: if "log" in item: ...
PyShell.py
#! /usr/bin/env python from __future__ import print_function import os import os.path import sys import string import getopt import re import socket import time import threading import io import linecache from code import InteractiveInterpreter from platform import python_version, system try: from Tkinter import...
node_installer.py
import json import logging import os import threading import time from subprocess import Popen, PIPE class NodeInstaller(object): __instance = None def __init__(self, js_folder: str): self.logger = logging.getLogger(self.__class__.__name__) self.js_folder = js_folder ...
throttler.py
# Copyright 2016-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...
client.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import uuid import websocket import time import threading from parlai.core.params import ParlaiParser def ...
mips.py
from pyspark.ml.clustering import KMeans from pyspark.ml.evaluation import ClusteringEvaluator import pyspark.sql.functions as F import numpy as np from heapq import heapify, heappush, heappop, nlargest import threading import logging import time def unit_vector(vector): return vector / np.linalg.norm(vector) def...
namecolorchange.py
from gevent import monkey monkey.patch_all() from discord.ext import commands import discord import random from discord_slash import SlashCommand from flask import Flask from flask_compress import Compress from gevent.pywsgi import WSGIServer from threading import Thread import os bot = commands.Bot(command_prefix=">"...
gloable_way4.py
import threading def consume4(): k = list(range(10000)) for i in k: with open('a.txt', 'a+') as file: file.write('{},{}\n'.format(i, threading.current_thread().name)) def consume3(): k = list(range(10000)) for i in k: with open('a.txt', 'a+') as file: file.wri...
pystray_icon.py
from PIL import Image from pystray import Icon, Menu, MenuItem import webview import sys import multiprocessing if sys.platform == 'darwin': ctx = multiprocessing.get_context('spawn') Process = ctx.Process Queue = ctx.Queue else: Process = multiprocessing.Process Queue = multiprocessing.Queue """...
executor.py
from concurrent.futures import Future import typeguard import logging import threading import queue import pickle from multiprocessing import Process, Queue from typing import Dict, List, Optional, Tuple, Union import math from ipyparallel.serialize import pack_apply_message from ipyparallel.serialize import deseriali...
test_all.py
#!/usr/bin/python3 from functions import * now = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%p") # Get header file. with open(os.path.join(scriptDir,headerHtml), 'r') as content_file: dashboard = content_file.read() dashboard = dashboard + "\n<p>Last updated: " + now + " UTC</p><br>" # Table opening and c...
AntPool.py
''' Antpool Executor @ 2021/2 By Charles Lai ''' __version__ = '0.12' __author__ = 'Charles Lai' import json, time, threading import inspect, base64,pickle import asyncio, concurrent.futures from tornado.websocket import websocket_connect # 通过这个类来进行 ws 连接,而后生成一个 Executor 对象 # 从concurrent.futures._...
test_container.py
# global import os import queue import pickle import pytest import random import numpy as np import multiprocessing # local import ivy from ivy.container import Container import ivy_tests.test_ivy.helpers as helpers def test_container_list_join(dev, call): container_0 = Container({'a': [ivy.array([1], dev=dev)],...
handbrake.py
import os import subprocess import argparse import re import datetime import threading import platform import sys import ctypes import path import jaraco.path from jaraco.ui import menu from jaraco.functools import call_aside try: from jaraco.windows.power import no_sleep except ImportError: from jaraco.conte...
eval_aggregator_test.py
# coding=utf-8 # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to ...
tests.py
#! /usr/bin/env python3 import hashlib import http.server import os import shutil import socket import subprocess import tempfile import threading import unittest class WrapperScriptTests(unittest.TestCase): http_port = 8080 default_bash = "/usr/bin/bash" minimum_script_dependencies = [ "/usr/bi...
base.py
"""Base class for nbviewer tests. Derived from IPython.html notebook test case in 2.0 """ #----------------------------------------------------------------------------- # Copyright (C) 2013 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, ...
wxRavenRavencoreAssetOverviewLogic.py
''' Created on 29 déc. 2021 @author: slinux ''' from .wxRavenRavencoreDesign import wxRavenAssetDetails_OverviewPanel from .jobs import AssetNavigator_AssetOwnerJob import wx import qrcode from PIL import Image import os from libs import PILutils import wx.lib.mixins.listctrl as listmix import threading from wxRa...