source
stringlengths
3
86
python
stringlengths
75
1.04M
conftest.py
from enum import Enum from multiprocessing import Process from typing import Dict, Iterable, List, Optional, Type, cast import pytest import uvicorn # type: ignore from asgiref.typing import ASGI3Application from fastapi import FastAPI, HTTPException from pydantic import BaseModel from pydantic.fields import Field fr...
blynk_test.py
import BlynkLib import time from threading import Thread import urllib2 BLYNK_AUTH = '71554af7a98b4535a7383f5be5d91ca3' BLYNK_SERVER = '27.254.63.34' # Initialize Blynk blynk = BlynkLib.Blynk(BLYNK_AUTH, server=BLYNK_SERVER) @blynk.VIRTUAL_WRITE(4) def v0_read_handler(value): # This widget will show some time in...
test_context.py
# -*- coding: utf-8 -*- ''' tests.unit.context_test ~~~~~~~~~~~~~~~~~~~~ ''' # Import python libs from __future__ import absolute_import import salt.ext.tornado.stack_context import salt.ext.tornado.gen from salt.ext.tornado.testing import AsyncTestCase, gen_test import threading import time # Import Salt Test...
client.py
# Adapted from https://github.com/montag451/pytun/blob/master/test/test_tun.py import sys import optparse import socket from scapy.all import IP import select import errno import pytun import utils import time from threading import Thread import signal import md5 from Crypto.Cipher import XOR def signal_handler(signa...
utils.py
############################################################################## # Copyright (C) 2019, UW REACT # # 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 co...
threading.py
# Instead of async, since there are really a very small set of things # we want to happen simultaneously within one process (namely getting # several parameters in parallel), we can parallelize them with threads. # That way the things we call need not be rewritten explicitly async. import threading import ctypes impor...
patient_data_handler.py
import pprint import datetime import gspread import pickle import time from threading import Thread import copy from oauth2client.service_account import ServiceAccountCredentials import yaml key_timestamp = "day" dt_update = 5.0 * 60.0 # load the configuration with open("config_enviroment.yaml", "r") as f: c_e = yam...
io.py
# -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, Executor, Future, _base, as_c...
main.py
import serial import tkinter as tk import time import function_utils as utils from PIL import Image,ImageTk from threading import Thread import serial.tools.list_ports as p import sys import os import matplotlib.pyplot as plt import applicationLib.robotLib.robot as robot my_robot = robot.Robot('arduino_robot') plt.sh...
nwidths.py
from dolfin import * import logging import sa_utils from sa_utils import comm, rank, size import sa_hdf5 import create_patches import spe import sympy as smp import numpy as np import scipy as sp import scipy.linalg as la import numpy.random as rnd import matplotlib.pyplot as plt from matplotlib.ticker import Forma...
tests.py
"""Tests related to django.db.backends that haven't been organized.""" import datetime import threading import unittest import warnings from unittest import mock from django.core.management.color import no_style from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, IntegrityError, connection, co...
run-dpdk-test.py
#!/usr/bin/env python3 # Copyright 2013-present Barefoot Networks, 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 b...
connection.py
# Copyright (c) 2015 Red Hat, 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 ...
widget.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) The widget is called from web2py ---------------------------------- """ from __future__ import print_...
test_lookup_remote_table_op.py
# Copyright (c) 2018 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...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import asyncio from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence from electrum.storage import WalletStorage, StorageReadWriteError from electrum.wallet_db import WalletDB from el...
network_publisher.py
import rclpy from rclpy.node import Node from contextlib import contextmanager from functools import partial, total_ordering from importlib import import_module import queue import socket from typing import Any import threading import traceback import time from ros2relay.message_socket.message_socket import MessageSo...
test_gc.py
import unittest from test.support import (verbose, refcount_test, run_unittest, strip_python_stderr, cpython_only) from test.script_helper import assert_python_ok, make_script, temp_dir import sys import time import gc import weakref try: import threading except ImportError: thread...
trainer_factory.py
# Copyright (c) 2019 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...
custom.py
# pylint: disable=too-many-lines # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------...
pyshell.py
#! /usr/bin/env python3 try: from tkinter import * except ImportError: print("** IDLE can't import Tkinter.\n" "Your Python may not be configured for Tk. **", file=sys.__stderr__) sys.exit(1) import tkinter.messagebox as tkMessageBox if TkVersion < 8.5: root = Tk() # otherwise create root in...
runner.py
#!/usr/bin/env python3 # Copyright 2010 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. """This is the Emscripten test runner. To run ...
timer_talker.py
import threading import time from speaker import Speaker class TimerTalker: speaker: Speaker def __init__(self): self.thread = None self.keep_running = None self.speaker = Speaker.get_instance() self.start_moment_idx = 0 def start_timer(self, time_to_start): if s...
variable_tagger.py
#!/usr/bin/env python3 # Copyright 2019 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...
vdb.py
import sys import pdb from bdb import BdbQuit from pdb import Pdb import os import signal from functools import partial import traceback #from vsi.tools import static if os.name == 'nt': from vsi.windows.named_pipes import Pipe import threading import ctypes ATTACH_SIGNAL = signal.SIGINT else: ATTACH_SIGNAL...
client.py
# -*- coding: utf-8 -*- # # Copyright (C) 2007-2009 Christopher Lenz # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. from datetime import datetime import os import os.path import shutil import time import tempfile imp...
helper.py
import os import sys import distutils.spawn import time import subprocess from threading import Thread from tempfile import NamedTemporaryFile from unix_windows import IS_WIN SUPPORTED_SHELLS = [ 'bash', 'zsh', ] # python 2/3 compatibility try: input = raw_input except NameError: pass def executable...
event.py
#!/usr/bin/python3 # MIT License # # (C) Copyright [2020-2021] Hewlett Packard Enterprise Development LP # # 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 with...
mainConsumer.py
from rabbitConsumer import * from socketConsumer import SocketConsumer from dlx import * import threading import sys if __name__ == '__main__': work_with = sys.argv[1] r_k = ['*.jpg', '*.jpeg', '#'] threads = [] dlx = ReconnectingDlx() threads.append(threading.Thread(target=dlx.run)) for j...
test_pipeline_process.py
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in co...
discovery.py
import socket import sys import time import threading #link s-r1 s_r1 = ('10.10.1.1',4000) #link s-r2 s_r2 = ('10.10.2.2',4000) #link s-r3 s_r3 = ('10.10.3.1',4000) #link r1-d r1_d = ('10.10.4.2',4000) #link r2-d r2_d = ('10.10.5.2',4000) #link r2-r3 r2_r3 = ('10.10.6.1',4000) #link r3-d r3_d = ('10.10.7.1',400...
gurobi.py
"""Crosshaul Module. Creating Gurobi Class for Journal 1. """ from datetime import datetime from multiprocessing import Process from gurobipy import * # GRB_INIT from helpers import * from heuristic import E from renewableEnergy import Battery from snapshot import * class GreenGurobi: # CONSTANTS NUMBER_OF_...
processes.py
import time import atexit import heapq from threading import Thread from plumbum.lib import IS_WIN32, six try: from queue import Queue, Empty as QueueEmpty except ImportError: from Queue import Queue, Empty as QueueEmpty # type: ignore try: from io import StringIO except ImportError: from cStringIO i...
PeepBlocker.py
#!/usr/bin/env python # -*- coding: utf8 -*- import tkinter import tkinter.filedialog from tkinter import messagebox import threading import cv2 import sys import os import numpy as np import datetime face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarc...
vncserver.py
import flask from flask import Flask import multiprocessing import subprocess import os import urllib app = Flask(__name__) mode_fullscreen = 0 mode_windowed = 1 current_mode = mode_fullscreen process = None current_monitor = 0 monitors = [ 'mark@192.168.100.1', 'talis@192.168.100.2', 'talis@192.168.100.3',...
Zjut.py
# -*- coding: utf-8 -*- ''' Zjut.py Zjut wlan account info collector and help to login ''' import urllib.request import urllib.parse import re import os import time import threading __author__ = 'Libao Jin' __date__ = 'Sept 02, 2015' available_accounts = [] def get_headers(): 'fill out the header to help crawler wo...
PI_test.py
import os import serial import time import libs.MAPS_mcu as mcu import libs.MAPS_pi as pi import libs.MAPS_plugin as plugin import libs.display as oled from datetime import datetime import requests import threading #import current file's config, by getting the script name with '.py' replace by '_confg' #ex: import "m...
stream_layered_image.py
""" This script generates a Docker image from a set of store paths. Uses Docker Image Specification v1.2 as reference [1]. It expects a JSON file with the following properties and writes the image as an uncompressed tarball to stdout: * "architecture", "config", "os", "created", "repo_tag" correspond to the fields ...
RegionMatching.py
from PIL import Image, ImageTk from numbers import Number try: import Tkinter as tk import tkMessageBox as tkmb except ImportError: import tkinter as tk import tkinter.messagebox as tkmb import multiprocessing import subprocess import pyperclip import tempfile import platform import numpy import time im...
test_plaintext_logging.py
import asyncio import contextlib import logging import math import os import re import signal import sys import threading import time from datetime import datetime from uuid import UUID import pytest from nivacloud_logging.log_utils import setup_logging, LogContext, auto_context, log_exceptions def _readout_log(cap...
session_test.py
<<<<<<< HEAD # 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 requir...
mt_bm_regex_v8.py
# Copyright 2009 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 # notice, this list of conditi...
test_wsgiref.py
from unittest import mock from test import support from test.support import socket_helper from test.test_httpservers import NoLogRequestHandler from unittest import TestCase from wsgiref.util import setup_testing_defaults from wsgiref.headers import Headers from wsgiref.handlers import BaseHandler, BaseCGIHandler, Simp...
bgtunnel.py
"""bgtunnel - Initiate SSH tunnels in the background Useful when you need to connect to a database only accessible through another ssh-enabled host. It works by opening a port forwarding ssh connection in the background, using threads. The connection(s) are automatically closed when the process exits, or when explicitl...
threadpool.py
""" Generic thread pool class. Modeled after Java's ThreadPoolExecutor. Please note that this ThreadPool does *not* fully implement the PEP 3148 ThreadPool! """ from threading import Thread, Lock, currentThread from weakref import ref import logging import atexit try: from queue import Queue, Empty except ImportE...
createKey.py
import random import time import multiprocessing def createKeys(): # 产生密钥的主函数 # 产生公钥n, f_n, e n, f_n, e = createPublicKey() # 产生私钥d d = createPrivateKey(e, f_n) return n, f_n, e, d def createPrivateKey(e, f_n): # 产生私钥d temp = egcd(e, f_n)[1] while temp < 0: ...
uid.py
""" Utilities for usage analytics. | Copyright 2017-2022, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ import os import multiprocessing from socket import gaierror import threading import uuid from httpx import HTTPError import universal_analytics as ua import fiftyone as fo import fiftyone.constants ...
smart_explainer.py
""" Smart explainer module """ import logging import copy import tempfile import shutil import pandas as pd from shapash.webapp.smart_app import SmartApp from shapash.utils.io import save_pickle from shapash.utils.io import load_pickle from shapash.utils.transform import inverse_transform, apply_postprocessing from sha...
monitorpublisher.py
# Copyright (c) 2014 CSIRO # Australia Telescope National Facility (ATNF) # Commonwealth Scientific and Industrial Research Organisation (CSIRO) # PO Box 76, Epping NSW 1710, Australia # atnf-enquiries@csiro.au # # This file is part of the ASKAP software distribution. # # The ASKAP software distribution is free softwar...
server-thread.py
import socket import time import threading # handler yang menghandle request dari client def hello(conn, addr): print(f"accept connection from {addr}") time.sleep(5) conn.sendall(b'Hello') # send data to client conn.close() # close connection sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # ...
portscanner.py
import socket import time import threading from queue import Queue socket.setdefaulttimeout(0.25) print_lock = threading.Lock() target = input('Enter the host to be scanned: ') t_IP = socket.gethostbyname(target) print ('Starting scan on host: ', t_IP) def portscan(port): s = socket.socket(socket.AF_INET, socket...
gtagsExpl.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import vim import re import os import os.path import shutil import itertools import subprocess from .utils import * from .explorer import * from .manager import * if sys.version_info >= (3, 0): import queue as Queue else: import Queue #***************************...
thread_watcher.py
from __future__ import print_function import gc import threading import time import unittest import weakref from functools import partial class ThreadWatcher(object): class Vigil(object): pass def __init__(self): self._refs = {} self._local = threading.local() def _on_death(sel...
downloadclient.py
# -*- coding: utf-8 -*- # Copyright European Organization for Nuclear Research (CERN) since 2012 # # 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-...
inference.py
#!/usr/bin/python2.7 import numpy as np import multiprocessing as mp import Queue from utils.dataset import Dataset from utils.network import Forwarder from utils.grammar import PathGrammar from utils.length_model import PoissonModel from utils.viterbi import Viterbi ### helper function for parallelized Viterbi deco...
plugin.py
import base64 import re import threading from binascii import hexlify, unhexlify from functools import partial from electrum_zeny.util import bfh, bh2u from electrum_zeny.bitcoin import (is_segwit_address, b58_address_to_hash160, xpub_from_pubkey, public_key_to_p2pkh, EncodeBase58Check, ...
index.py
# -*- coding: utf-8 -*- # # Copyright (C) 2013 Vinay Sajip. # Licensed to the Python Software Foundation under a contributor agreement. # See LICENSE.txt and CONTRIBUTORS.txt. # import hashlib import logging import os import shutil import subprocess import tempfile try: from threading import Thread except ImportErr...
reconscan.py
#!/usr/bin/env python ############################################################################################################### ## [Title]: reconscan.py -- a recon/enumeration script ## [Orignal script author]: Mike Czumak (T_v3rn1x) -- @SecuritySift ## [Modified by]: Filip Chyla (keresh) ## - removed hardcoded ...
aaaa.py
from socket import * #引入socket模块 import threading #引入多线程模块 import argparse #引入选项参数模块 lock = threading.Lock() #创建lock对象信号 openNum = 0 #创建变量值为0 threads = [] #创建变量值为空列表 def portScanner(host,port): #函数作为连接 global openNum #全局变量 try: #异常处理 ...
DriverEventual.py
import subprocess import os import Pyro4 import signal import time import threading import random ########################################################### # Server initialization ########################################################### pid = [] # Start name server curr_dir = os.path.dirname(__file__) server_py...
monobeast.py
# Copyright (c) Facebook, Inc. and its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
runtests.py
#!/usr/bin/env python from __future__ import print_function import atexit import base64 import os import sys import re import gc import heapq import locale import shutil import time import unittest import doctest import operator import subprocess import tempfile import traceback import warnings import zlib import glo...
train.py
#!/usr/bin/env python """Train models.""" import os import signal import torch import onmt.opts as opts import onmt.utils.distributed from onmt.utils.misc import set_random_seed from onmt.utils.logging import init_logger, logger from onmt.train_single import main as single_main from onmt.utils.parse import ArgumentPa...
navigation-nav-a3c.py
import time import logging import os import glob import sys from sys import stdout from collections import deque import copy import time import argparse import warnings import threading warnings.filterwarnings('ignore') import cv2 import PIL import numpy as np import matplotlib.pyplot as plt import tensorflow as tf im...
util.py
import os import shutil import sys import ctypes from pathlib import Path if sys.version_info[0] < 3 or sys.version_info[1] <= 5: print("\nPlease restart with Python 3.6+\n") print("Current Python version:", sys.version_info) exit(-1) tc_core = None def in_docker(): if os.environ.get("TI_IN_DOCKER", "") == ...
brain.py
# -*- coding: utf-8-*- import logging import pkgutil # from .plugins import linphone_controller from assistant.plugins.utilities import paths class Brain(object): def __init__( self, mic, speaker, profile, personality, notifier, ...
main.py
# Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
mongo_communicator.py
from datetime import datetime, timedelta import time import threading from multiprocessing import Process import logging from pymongo import MongoClient, ReturnDocument logger = logging.getLogger(__name__) STARTTIME_KEY = 'startTime' ENDTIME_KEY = 'endTime' REFRESH_KEY = 'last_refreshed' TIME_WORKED_KEY = 'totalTime...
Spinner.py
""" Spinner.py Spinner animation """ import sys import time import threading class Spinner: """ Spinner running in a separate thread """ busy = False delay = 0.1 @staticmethod def spinning_cursor(): """ Static method for the cursor animation """ while ...
test_app.py
from path import Path import os, sys from multiprocessing import Process import pytest import pytestqt import cadquery as cq from PyQt5.QtCore import Qt, QSettings from PyQt5.QtWidgets import QFileDialog, QMessageBox from cq_editor.__main__ import MainWindow from cq_editor.widgets.editor import Editor from cq_edito...
ssh.py
from __future__ import absolute_import from __future__ import division import inspect import logging import os import re import shutil import six import string import sys import tarfile import tempfile import threading import time import types from pwnlib import term from pwnlib.context import context from pwnlib.log...
test_capture.py
import contextlib import io import os import pickle import subprocess import sys import textwrap from io import UnsupportedOperation import py import pytest from _pytest import capture from _pytest.capture import CaptureManager from _pytest.main import EXIT_NOTESTSCOLLECTED # note: py.io capture tests where copied f...
plugin.py
''' Created on 18 déc. 2021 @author: slinux This file contains the main class to define the plugin Each plugin must have a plugin.py file which declare a class wxRavenPlugin(PluginObject) ''' #import the class form above level, it contains predefined functions to overwrite. #from plugins.pluginObjectTemplate im...
download_chunks.py
from multiprocessing import Pool, Process import os import subprocess as sub import linecache import Queue as q_exception # since queue exceptions are not available in the multiprocessing module import logging import tarfile import shutil import sys import time import apidropbox as drop import encryption as enc #pri...
Training.py
from sacred import Experiment import tensorflow as tf import threading import numpy as np import os import Datasets from Input import Input as Input from Input import batchgenerators as batchgen import Models.WGAN_Critic import Models.Unet import Utils import cPickle as pickle import Test ex = Experiment('Adversarial...
tests.py
from unittest import skipIf from django.test import TestCase, TransactionTestCase from django.core.exceptions import ImproperlyConfigured from django.urls import reverse from django.test.client import Client from django import db from django.db import transaction from ool import ConcurrentUpdate from .models import ...
PangenomeOrthomclServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
debugger_v2_plugin_test.py
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
main.py
import dweepy import paho.mqtt.client as paho import psutil import pywapi import signal import sys import time from threading import Thread import plotly.plotly as py from plotly.graph_objs import Scatter, Layout, Figure import pyupm_grove as grove # Create the relay switch object using GPIO pin 2 (D2) relay = gro...
prepare_wikiTables_rdfs4.py
import numpy as np import json import os from math import log import scipy.sparse as sp from utils_ import preprocess from random import shuffle import pandas as pd from tqdm import tqdm import random from scipy.spatial.distance import cosine from utils import loadWord2Vec,clean_str from nltk.corpus import wordnet as ...
amqpdriver.py
# Copyright 2013 Red Hat, 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 agr...
main.py
#!/usr/bin/env python3 """Implement a remote shell which talks to a MicroPython board. This program uses the raw-repl feature of the pyboard to send small programs to the pyboard to carry out the required tasks. """ # Take a look at https://repolinux.wordpress.com/2012/10/09/non-blocking-read-from-stdin-in-pyt...
host.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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
pipelinev2.py
import argparse import logging import multiprocessing from typing import Union import abc import math import nibabel as nib import numpy as np import os import re from nipype.interfaces import freesurfer from samitorch.inputs.augmentation.transformers import AddNoise from deepNormalize.inputs.transformers import AddBi...
Semaphore.py
import logging import threading import time import random LOG_FORMAT = '%(asctime)s %(threadName)-17s %(levelname)-8s %(message)s' logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) semaphore = threading.Semaphore(0) item = 0 def pelanggan(): logging.info('Pelanggan meminta antrian') semaphore.acqu...
test_base.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import gc import logging from multiprocessing import Manager, Process import os import random import sys import time from shellbot import Context from shellbot.stores import Store class MyStore(Store): def on_init(self, **kwargs): self.value...
process.py
import getpass from lithops.multiprocessing import Process def function(name, language='english'): greeting = { 'english': 'hello', 'spanish': 'hola', 'italian': 'ciao', 'german': 'hallo', 'french': 'salut', 'emoji': '\U0001F44B' } print(greeting[language]...
apt_tdc_roetdec.py
""" This is the main script for controlling the experiment. It contains the main control loop of experiment. """ import time import datetime import multiprocessing from multiprocessing.queues import Queue import threading import numpy as np # Serial ports and NI import serial.tools.list_ports # Local project scripts ...
penv.py
from multiprocessing import Process, Pipe import gym def worker(conn, env): while True: cmd, data = conn.recv() if cmd == "step": obs, reward, done, info = env.step(data) if done: obs = env.reset() conn.send((obs, reward, done, info)) elif...
utils.py
#!/usr/bin/env python """This file contains various utility classes used by GRR.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import base64 import errno import functools import getpass import io import os import...
_test_multiprocessing.py
import multiprocessing import sys import time def f(): time.sleep(1) if __name__ == "__main__": multiprocessing.set_start_method(sys.argv[1]) p = multiprocessing.Process(target=f) p.start() print(p.pid) p.join()
core.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
gatos_ratones.py
import threading from time import sleep from random import randint l_platos = 5 platos = [threading.Semaphore(1) for i in range(l_platos)] max_animales = threading.Semaphore(l_platos) puerta = threading.Semaphore(1) mutex_gatos_en_cuarto = threading.Semaphore(1) gatos_en_cuarto = 0 ratones_en_cuarto = 0 mutex_ra...
resource_helper.py
from __future__ import absolute_import, division, print_function from threading import Thread import sys import time import requests import ConfigParser import calendar import logging import utility_helper as util import pandas as pd import numpy as np import anomaly_database_helper as db sys.path.insert(0, '../anomaly...
__init__.py
import os import sys def _get_run_args(print_args: bool = True): from jina.parsers import get_main_parser silent_print = {'help', 'hub'} parser = get_main_parser() if len(sys.argv) > 1: from argparse import _StoreAction, _StoreTrueAction args, unknown = parser.parse_known_args() ...
HueBridgeEmulator.py
#!/usr/bin/python import os import time import json import socket import random from http.server import HTTPServer from datetime import datetime, timedelta from threading import Thread from collections import defaultdict from uuid import getnode as get_mac import logging import requests from homie_hue_bridge.HueSSDP ...
Asynchronous.py
""" """ import multiprocessing from UsefulTools.UtilsFunctions import pt import traceback import json def object_to_json(object, attributes_to_delete=None): """ Convert class to json with properties method. :param attributes_to_delete: String set with all attributes' names to delete from properties metho...
java_callback_test.py
""" Created on Apr 5, 2010 @author: Barthelemy Dagenais """ from __future__ import unicode_literals, absolute_import from multiprocessing import Process import subprocess from threading import Thread from traceback import print_exc import unittest from py4j.compat import range from py4j.java_gateway import ( Jav...
keep_alive.py
from flask import Flask, send_file from threading import Thread import os app = Flask("") @app.route('/') def _home(): return "BOT Alive and healthy! <a href=/logs/servers/>logs " @app.route("/help") def _help(): return("soon") @app.route("/logs/servers/") def _log_servers(): string = "Servers:<ul>" for i in...
server.py
import sys import time from gps3 import gps3 import imu from flask import Flask, render_template from turbo_flask import Turbo import threading app = Flask(__name__) turbo = Turbo(app) gps_socket = None gps_data = gps3.DataStream() imu_data = {} @app.before_first_request def before_first_request(): threading.Th...