source
stringlengths
3
86
python
stringlengths
75
1.04M
opencti_connector_helper.py
import datetime import threading import pika import logging import json import time import base64 import uuid import os from typing import Callable, Dict, List from pika.exceptions import UnroutableError, NackError from pycti.api.opencti_api_client import OpenCTIApiClient from pycti.connector.opencti_connector import ...
worker_keep_alive_test.py
# -*- coding: utf-8 -*- # # Copyright 2016 VNG Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
http2_connection.py
import Queue import threading import socket import errno import struct from xlog import getLogger xlog = getLogger("gae_proxy") import connect_control from http_common import * from hyper.common.bufsocket import BufferedSocket from hyper.common.bufsocket import BufferedSocket from hyper.packages.hyperframe.frame ...
rest.py
import time import socket import requests import threading import config import endpoints import block from flask_cors import CORS from argparse import ArgumentParser from flask import Flask, jsonify, request, render_template from block import Block from transaction import Transaction from endpoints import node, res...
custom.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
LogAndPBMessager.py
from pushbullet import PushBullet import logging, logging.handlers import threading from time import localtime, strftime, sleep from requests import ConnectionError import OpenSSL class PushbulletMessenger(object): def __init__(self, api_token, channel_name): self.channel_name = channel_name self....
webhook_ngrok.py
# --------------------------------------------------------------------------- # Pelion Device Management SDK # (C) COPYRIGHT 2017 Arm 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 License at #...
vms_report.py
# coding: utf-8 #------------------------------ # [从]服务器上报 #------------------------------ import sys import os import json import time import threading import subprocess import shutil sys.path.append("/usr/local/lib/python2.7/site-packages") import psutil root_dir = os.getcwd() sys.path.append(root_dir + "/class/co...
pymolhttpd.py
# Copyright (C) Schrodinger, LLC. # All Rights Reserved # # For more information, see LICENSE in PyMOL's home directory. # # pymolhttpd.py # # web server interface for controlling PyMOL from __future__ import print_function from __future__ import absolute_import # we make extensive use of Python's build-in in web inf...
tests.py
# -*- coding: utf-8 -*- # Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. from __future__ import unicode_literals import copy import os import re import shutil import tempfile import threading import time import unittest import warnings from django.conf import settings ...
stats_server.py
#!/usr/bin/env python """Stats server implementation.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import collections import errno import json import logging import socket import threading from future.builtins import range from future.moves.urllib i...
dronelauncher_python1.py
#DRONE LAUNCHER #Import modules from flask import Flask, render_template, request, jsonify from roboclaw import Roboclaw import time import socket from neopixel import * import argparse import threading import thermo # LED strip configuration: LED_COUNT = 60 # Number of LED pixels. LED_PIN = 18 ...
qt.py
# This file is part of the pyMOR project (http://www.pymor.org). # Copyright 2013-2020 pyMOR developers and contributors. All rights reserved. # License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) """ This module provides a few methods and classes for visualizing data associated to grids. We us...
test_cancel.py
# Copyright (c) 2019-2021 Micro Focus or one of 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 applic...
02-threading_daemons.py
#!/usr/bin/env python3 # Threads, by default, are spawned as regular threads and hence # the programs only fully exit once all the threads exit. # Threads can be spawned as daemons, which runs in the background # and parallely, without interferring with the main program, but # providing support to it. # Example of s...
ocr.py
from abc import ABC, abstractmethod from typing import List import threading class OCR(ABC): @abstractmethod def initialize(self): ''' Initialize the OCR ''' pass @abstractmethod def ocr_one_image(self, images:List) -> List: ''' OCR an image. Input: An array of (area, image)s, opened by PIL and pre-proces...
run_trainer.py
#!/usr/bin/env python import argparse import ckpt_util from multiprocessing import Process, Queue from concurrent import futures import json import grpc import numpy as np import models import model_pb2 import os import replay_memory as rm import sys import tensorflow as tf import time import util np.set_printoptions(...
photo.py
# /usr/bin/env python3 import configparser import datetime import http.server import os import random import signal import socketserver from threading import Thread, Timer import time import urllib.parse import requests import utils from utils import debug, enc, error, info, runproc, BASE_KEY, CONFIG_FILE MONITOR_CM...
message_server.py
# -*- coding: utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the...
main.py
# !/usr/bin/env python3 # -- coding: utf-8 """MSC Monitor""" __author__ = "Justin Stasiw" __version__ = "$Revision 0.1b$" __date__ = "$Date: 2021/08/05" import mido import mido.backends.rtmidi from datetime import datetime from threading import Thread from pubsub import pub import multiprocessing from multiprocessin...
example_stream_everything.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_stream_everything.py # # Part of ‘UNICORN Binance WebSocket API’ # Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api # Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api # PyPI: https:/...
sendpkts.py
#!/usr/bin/env python3.7 # # File: sendpkts.py # # Description : flooder script # Created by : Quinn Burke (qkb5007@psu.edu) # Date : November 2019 # Last Modified : November 2019 ### Imports ### from random import randint, shuffle # from scapy.all import * import time import threading import sys import...
parallel_io.py
#!/usr/bin/python """ (C) Copyright 2020-2021 Intel Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent """ import threading import subprocess #nosec import time from getpass import getuser import general_utils from ClusterShell.NodeSet import NodeSet from command_utils import CommandFailure from fio_test_...
app.py
# -*- coding: utf-8 -*- """ :author: Grey Li (李辉) :url: http://greyli.com :copyright: © 2018 Grey Li :license: MIT, see LICENSE for more details. """ import os from threading import Thread import sendgrid from sendgrid.helpers.mail import Email as SGEmail, Content, Mail as SGMail from flask_mail import...
website.py
from flask import Flask, render_template, request from main import BuildPipeline from config import Config from threading import Thread app=Flask(__name__) pipeline = None @app.route('/') def index(): print("Index!!") return render_template("index.html") @app.route('/service/', methods=["GET","POST"]) def r...
server.py
import socket import threading # Connection Data host = '127.0.0.1' port = 3415 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((host, port)) server.listen() clients = [] nicknames = [] def broadcast(message): for client in clients: client.send(message) def handle(client): ...
impala_shell.py
#!/usr/bin/env python # Copyright 2012 Cloudera 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 ag...
main.py
from time import sleep from ahk import AHK import os from threading import Thread ahk = AHK() def read_file(file): with open(file, 'r') as f: read = f.read() return read def write_to_file(file, what): with open(file, 'w') as f: f.truncate(0) f.write(what) def ask...
parse_conceptual.py
import torch import clip from torch.utils.data import DataLoader, Dataset from PIL import Image import pickle from tqdm import tqdm import os import csv import threading import requests import shutil import PIL from typing import List, Tuple, Optional import argparse from pathlib import Path device = torch.device("cu...
datalog.py
# -*- coding: utf-8 -*- """ shepherd.datalog ~~~~~ Provides classes for storing and retrieving sampled IV data to/from HDF5 files. :copyright: (c) 2019 Networked Embedded Systems Lab, TU Dresden. :license: MIT, see LICENSE for more details. """ import logging import subprocess import threading import time from typi...
cachy.py
import cachetools, cachetools.func, time, threading, traceback from flaskthreads import AppContextThread from flaskthreads.thread_helpers import has_app_context, _app_ctx_stack, APP_CONTEXT_ERROR from flask import g import concurrent.futures from concurrent.futures.thread import _threads_queues import functools def ...
dlwsrestapi.py
#!/usr/bin/env python3 import sys import json import os import base64 import yaml import uuid import logging from logging.config import dictConfig import time import traceback import threading from flask import Flask, Response from flask_restful import reqparse, Api, Resource from flask import request, jsonify import...
training.py
# Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the 'License'). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'license' fil...
server.py
""" A high-speed, production ready, thread pooled, generic HTTP server. For those of you wanting to understand internals of this module, here's the basic call flow. The server's listening thread runs a very tight loop, sticking incoming connections onto a Queue:: server = HTTPServer(...) server.start() ->...
client.py
from socket import AF_INET, socket, SOCK_STREAM from threading import Thread, Lock import time class Client: """ for communication with server """ HOST = "192.168.1.4" PORT = 5500 ADDR = (HOST, PORT) BUFSIZ = 512 def __init__(self, name): """ Init object and send name ...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers // Copyright (c) 2014 Joey Krug and Jack Peterson # 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 st...
search.py
import os import sys import traceback import numpy as np import argparse import threading import codecs import logging logger = logging.getLogger(__name__) logging.basicConfig(level=logging.INFO, format="%(message)s") from tensorboardX import SummaryWriter # install tensorboardX (pip install tensorboardX) before import...
parallel_download.py
import os from multiprocessing import Process, Queue import lib.downloader as downloader class Pool: """ A pool of video downloaders. """ def __init__(self, classes, videos_dict, directory, num_workers, failed_save_file, compress, verbose, skip, log_file=None): """ :param classes: ...
mp_temp.py
import multiprocessing as mp import os class cl: def __init__(self): self.x = 1 def set(self): self.x = os.getpid() def __str__(self): return str(self.x) def run(a): a.set() print("Current pid, ", os.getpid(), a) print(a) if __name__ == "__main__"...
Post_MainEnvironmentSimulator.py
#Post_MainEnvironmentSimulator.py #Environment simulator + REST-Server + AdvantEDGE #Version:4 #Date:2020-04-14 #Author: Jaime Burbano #Description: This set of files are used to run the first simulation of the system using AdvantEDGE #runs with python 3 #python3 MainEnvironmentSimulator v001 import argparse import...
test_basic.py
# -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # Copyright (c) 2005-2020, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License (version 2 # or later) with exception for distributing the bootloader. # # The full license is...
indexer.py
# coding: utf-8 from __future__ import print_function from __future__ import unicode_literals import annoy import time import tqdm import random import multiprocessing def graceful_exit(fn): def _impl(*args, **kwargs): try: return fn(*args, **kwargs) except KeyboardInterrupt: ...
helpers.py
import threading from app.models import * from app.preprocessin import * from app.knn_new import knn_predict import time class LogFetcher(threading.Thread): def run(self): while True: latest_pred_id = data_set_normalized.objects.all() last_pred_id= len(latest_pred_id) if latest_pred_id == None: last_...
completers.py
import time import threading import logging from typing import Iterable from prompt_toolkit.contrib.regular_languages.completion import GrammarCompleter from prompt_toolkit.contrib.regular_languages.compiler import compile from prompt_toolkit.completion import WordCompleter, FuzzyWordCompleter from prompt_toolkit.docu...
ftxclient.py
import hmac import json import time import zlib from collections import defaultdict, deque from gevent.event import Event from itertools import zip_longest from threading import Thread, Lock from typing import Callable, DefaultDict, Deque, List, Dict, Tuple, Optional from websocket import WebSocketApp # based on http...
port_manager.py
import socket, sys from struct import * import threading from .proc_worker import ProcWorker, Event, bypass, ProcWorkerEvent, TocTocPortsEvent, PortManagerEvent import logging log = logging.getLogger(__name__) from scapy.all import sniff, IP, TCP class PortManager(): def __init__(self, address='0.0.0.0', unman...
personsitting.py
#! /usr/bin/env python # -*- encoding: UTF-8 -*- # DOCUMENTATION # http://doc.aldebaran.com/2-5/naoqi/peopleperception/alengagementzones-api.html#alengagementzones-api import qi import argparse import sys import os import time import threading from utils import point2world from naoqi import ALProxy import condition...
updater.py
# -*- coding: utf-8 -*- import os,tempfile,platform,urllib.request,sys,threading,getpass,config,hashlib,json,requests,random,string,lang,subprocess os.system("@title "+config.NAME+" "+config.VER) pwd = os.getcwd() r = requests.get(config.TEST_URL) if r.status_code!=204: print(lang.NETWORK_ERROR) input() sy...
backend.py
from thonny.common import ( InputSubmission, InterruptCommand, EOFCommand, parse_message, ToplevelCommand, ToplevelResponse, InlineCommand, InlineResponse, UserError, serialize_message, BackendEvent, ValueInfo, execute_system_command, ) import sys import logging impor...
bulb.py
import bluetooth, math, time, threading, logging class BluetoothBulb: def __init__(self, mac_address, name): self.__mac_address = mac_address self.__name = name self.__sock = None self.__socket_lock = threading.Lock() self.__heartbeat_running = False self.__heartbeat...
run.py
# Copyright (c) 2016-2017 Anki, 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 in the file LICENSE.txt or at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
dataloader_iter.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 appli...
pyc_stress_test.py
# Note: CPython doesn't pass this test import os import sys import multiprocessing def worker(): global done for i in xrange(100): del sys.modules["pyc_import_target"] import pyc_import_target done = True import pyc_import_target path = os.path.join(os.path.dirname(__file__), "pyc_impo...
test.py
from multiprocessing.dummy import Process as Thread from multiprocessing.dummy import Queue import time def func1(qm1, q12): while True: qget = qm1.get() if qget is not None: if qget is 'over': q12.put('over') break print ('Thread1 recv: %s'%q...
systrayicon.py
import os import threading import uuid from copy import copy from .win32_adapter import * class MenuOption: def __init__(self, text, icon_path=None, callback=None, submenu=None): self.text = text self.icon_path = icon_path self.callback = callback self.submenu = submenu s...
vehicle.py
import time from threading import Thread from .memory import Memory from .log import get_logger import time logger = get_logger(__name__) # TODO ## Should add the ultrasonic sensor as a part ## The ultrasonic sensor code should be in its won class ## maybe have the thread return a value rather than have it set the sh...
generator.py
""" Copyright 2017-2018 Fizyr (https://fizyr.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
vhal_emulator.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2016 Google 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 requir...
nanny.py
import asyncio import errno import logging import os import shutil import threading import uuid import warnings import weakref from contextlib import suppress from multiprocessing.queues import Empty from time import sleep as sync_sleep import psutil from tornado import gen from tornado.ioloop import IOLoop, PeriodicC...
test_capi.py
# Run the _testcapi module tests (tests for the Python/C API): by defn, # these are all functions _testcapi exports whose name begins with 'test_'. from collections import namedtuple import os import pickle import platform import random import re import subprocess import sys import sysconfig import textwrap import th...
test_fsm.py
"""Unit tests for fsm.py""" import datetime import logging import select import socket from struct import pack import sys import threading import time import pytest from pynetdicom import AE, build_context, evt, debug_logger from pynetdicom.association import Association from pynetdicom import fsm as FINITE_STATE fr...
base.py
import argparse import base64 import copy import itertools import json import multiprocessing import os import re import sys import threading import time import uuid import warnings from collections import OrderedDict from contextlib import ExitStack from typing import Optional, Union, Tuple, List, Set, Dict, overload,...
main.py
if __name__ == "__main__": from time import sleep import json from multiprocessing import * from src import ui from src.utils import sensor_listener, locker_state LCKMngKey = "" procs = [] app = ui.App() proc1 = Process(target=app.mainloop, args=()) procs.append(proc1) pr...
_threading.py
import queue import sys import threading from typing import Any, NamedTuple, Optional from pykka import Actor, Future, Timeout from pykka._types import OptExcInfo __all__ = ["ThreadingActor", "ThreadingFuture"] class ThreadingFutureResult(NamedTuple): value: Optional[Any] = None exc_info: Optional[OptExcIn...
lcs.py
""" This is a module to be used as a reference for building other modules """ import warnings from glcr import longest_common_subsequence from multiprocessing import Process import numpy as np import pandas as pd from matplotlib import pyplot as plt from sklearn.base import BaseEstimator from sklearn.utils....
test_scanner.py
# Copyright 2017, Inderpreet Singh, All rights reserved. import os import shutil import tempfile import unittest from threading import Thread from datetime import datetime from system import SystemScanner, SystemScannerError def my_mkdir(*args): os.mkdir(os.path.join(TestSystemScanner.temp_dir, *args)) def my...
client.py
#! /usr/bin/python # https://www.cryptopals.com/sets/4/challenges/31 # Implement and break HMAC-SHA1 with an artificial timing leak # SHA-1 implementation taken from https://github.com/ajalt/python-sha1/blob/master/sha1.py # HMAC: https://en.wikipedia.org/wiki/HMAC ##################################################...
test_pysnooper.py
# Copyright 2019 Ram Rachum and collaborators. # This program is distributed under the MIT license. import io import textwrap import threading import types import os import sys from pysnooper.utils import truncate import pytest import pysnooper from pysnooper.variables import needs_parentheses from .utils import (as...
train_mask_rcnn.py
"""Train Mask RCNN end to end.""" import argparse import os # disable autotune os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' os.environ['MXNET_GPU_MEM_POOL_TYPE'] = 'Round' os.environ['MXNET_GPU_MEM_POOL_ROUND_LINEAR_CUTOFF'] = '28' os.environ['MXNET_EXEC_BULK_EXEC_MAX_NODE_TRAIN_FWD'] = '999' os.environ['MXNET_EXE...
base.py
import sys import threading import logging import time logger = logging.getLogger("interchange.strategy.base") class BaseStrategy(object): """Implements threshold-interval based flow control. The overall goal is to trap the flow of apps from the workflow, measure it and redirect it the appropriate execut...
_backend.py
import sys import warnings from collections import namedtuple from contextlib import contextmanager from threading import Barrier from typing import List, Callable import logging import numpy from ._dtype import DType, combine_types SolveResult = namedtuple('SolveResult', [ 'method', 'x', 'residual', 'iteration...
AdcpTerminal.py
import rti_python.Comm.adcp_serial_port as adcp_serial import rti_python.Writer.rti_binary as RtiBinaryWriter import threading import time import serial import logging from obsub import event from threading import Lock from rti_python.Utilities.config import RtiConfig class AdcpTerminalVM: """ Setup a view to...
Chap10_Example10.2.py
from threading import * def my_msgprint(): print("The above line is executed by: ", current_thread().getName()) print("Main Thread creating child object") mthread = Thread(target = my_msgprint) # L1 print("Main Thread starting child thread") mthread.start()# L2
BLW3.py
#!/usr/bin/python # coding=utf-8 # BLackWhite # Source : Python2 # BLW V.3 #Import module import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system("pip2 install mechanize") try: import reques...
NodeCausal.py
#!/usr/bin/python3 import redis import os import threading import Pyro4 import Pyro4.naming import sys import time # Node class that points to the redis server on the local machine # Primary-based implementation for causal consistency class Node(object): # Initializes the connection to the indicated redis insta...
connection.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...
irc.py
# coding=utf-8 """ irc.py - An Utility IRC Bot Copyright 2008, Sean B. Palmer, inamidst.com Copyright 2012, Edward Powell, http://embolalia.net Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. Willie: http://willie.dftba.net/ When working on core IRC protocol related...
app.py
import os import sys import time from multiprocessing import Process from datetime import datetime from flask import render_template sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '.')) from auth import auth_bp from admin import admin_bp, fetch_instances_cost_from_aws from user_blu...
thermal_tracker.py
import pygame import os import math import time from datetime import datetime, date import numpy as np from scipy.interpolate import griddata from scipy import stats import cv2 from colour import Color from CentroidTracker import CentroidTracker from multiprocessing import Process, active_children import pexpect import...
video.py
import os import re import threading import time from io import BytesIO, StringIO import numpy import redis import requests from PIL import Image from zope.interface import implementer from mxdc import Signal, Device from mxdc import conf from mxdc.utils.log import get_module_logger from .interfaces import ICamera, ...
cfg_compare.py
#!/usr/bin/env python import os, sys, subprocess import argparse import subprocess import threading import timeit from configobj import ConfigObj from cvguipy import cvconfig if __name__ == '__main__': parser = argparse.ArgumentParser(description="compare two configuration files") parser.add_argument('config1'...
test_content.py
from __future__ import print_function import os import re import sys import json import time import argparse import threading import subprocess import traceback from time import sleep import datetime from distutils.version import LooseVersion import pytz from google.cloud import storage from google.api_core.exception...
dlfuncs.py
import os import shutil import json import threading import time from xml.dom.minidom import parseString from instagram_private_api import ClientConnectionError from instagram_private_api import ClientError from instagram_private_api import ClientThrottledError from instagram_private_api_extensions import live from i...
box_pushing_workers.py
import multiprocessing import time from qsim.simulator import QuasistaticSimParameters from qsim.system import cpp_params_from_py_params try: from irs_lqr.quasistatic_dynamics import * from zmq_parallel_cmp.array_io import * except ImportError: from irs_lqr.irs_lqr.quasistatic_dynamics import * from i...
__main__.py
# coding: utf-8 __appname__ = "xmltojson" __version__ = "17.191.1220" #добавлена обработка POST запроса #__version__ = "17.181.1520" #первая редакция __profile__ = "" __index__ =-1 import sys sys.PY3 = sys.version_info[0] > 2 if not sys.PY3: input = raw_input import os, time import traceback import socket __h...
server.py
import sys import socket import threading server_ip_address = sys.argv[1] server_port = int(sys.argv[2]) server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) def accept(client_socket): client_socket.sendall("ok".encode('utf-8')) return print ("Server: " + socket.gethostname()) s...
base_ete_test.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...
plugin.py
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # -------------------------------------------------------------------------- from __future__ import absolute_import from __future__ import division from __future__ import print_functi...
bigtable_emulator.py
# Copyright 2021 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, s...
__init__.py
##################################################################### # # # /plugins/delete_repeated_shots/__init__.py # # # # Copyright 2017, JQI ...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import print_function import logging import getpass import multiprocessing import fnmatch import copy import os import hashlib import re import types import threading import time import traceback import sys import signal i...
__init__.py
# The domain of your component. Should be equal to the name of your component. import logging, time, hmac, hashlib, random, base64, json, socket, requests, re, threading, hashlib, string import voluptuous as vol import asyncio from datetime import timedelta from datetime import datetime from homeassistant.helpers.ent...
local_bridge.py
from socket import socket, AF_INET, SOCK_STREAM from threading import Thread import json import asyncio ip = '127.0.0.1' port = 5001 #class ServerThread(Thread): # def __init__(self, q_main, q_worker): # self.queue_main = q_main # self.queue_worker = q_worker # super().__init__() # def run(...
twisterlib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fut...
parallel_parse_UniProt_dump_v2.py
# from collections import defaultdict import os, fileinput, subprocess, sys import zlib, gzip import tools, variables import create_SQL_tables_snakemake as cst import obo_parser import random, multiprocessing from collections import deque PLATFORM = sys.platform # def unzip_file(fn_in, fn_out, number_of_processes=4)...
thread_queue.py
from threading import Thread aLi = [0] def func1(aLi): for i in range(100000): aLi[0] += 1 def func2(aLi): for i in range(100000): aLi[0] -= 1 t1 = Thread(target=func1, args=(aLi, )) t2 = Thread(target=func2, args=(aLi, )) t1.start() t2.start() t1.join() t2.join() print(aLi)
tkit.py
# -*- coding: utf-8 -*- """tkit.py -- Tkinter Tool Kit This module provides a light, object-oriented API for rapid GUI design with Tkinter. Author: Garin Wally; Feb 2015; Oct 2017 Specs: all widgets should have a .name attribute all widgets should have a .set_parent method """ # Imports try: import tki...
backup.py
import hashlib import csv import os from datetime import date import shutil import glob import win32api import win32con import win32file import sys import yaml import argparse import subprocess import time import threading import queue import typing import pywintypes import zipfile class FileInfo...
pingpong.py
import socket import os import pygame import threading import random import sys class PingPongException(Exception): pass class Server: def __init__(self): self.HOST = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.PORT = 12000 self.hostName = socket.gethostnam...
strategy.py
from multiprocessing.pool import AsyncResult, ApplyResult from multiprocessing.pool import ThreadPool from multipledispatch import dispatch from collections.abc import Iterable from threading import Thread, current_thread from functools import wraps, partial as PartialFunction from typing import List, Dict, Callable, I...