source
stringlengths
3
86
python
stringlengths
75
1.04M
youget.py
from core.bots._base import Bot from core.state import State from _global import regex from _global.const import _Score from _global.mission import Mission import os import time import subprocess class YouGetBiliBili(Bot): def __init__(self, pool): super(YouGetBiliBili, self).__init__() self.pool ...
socket-client.py
import socket as Socket from socket import AF_INET, SOCK_STREAM, socket from threading import Thread import time class Client: def __init__(self): self.client_socket = socket(AF_INET, SOCK_STREAM) self.name = str(Socket.gethostbyname(Socket.gethostname())) self.receive_thread = N...
context.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
compras.py
# -*- coding: utf-8 -*- # @Author: Manuel Rodriguez <valle> # @Date: 28-Aug-2017 # @Email: valle.mrv@gmail.com # @Filename: views.py # @Last modified by: valle # @Last modified time: 02-Mar-2018 # @License: Apache license vesion 2.0 from django.forms.models import model_to_dict from django.db.models import Q fro...
http_mapi.py
import logging import base64 import random import os import ssl import time import copy from pydispatch import dispatcher from flask import Flask, request, make_response # Empire imports from lib.common import helpers from lib.common import agents from lib.common import encryption from lib.common import packets from l...
log-watch.py
#!/usr/bin/python # -*- coding: utf-8 -*- import glob import os import re from threading import Thread from time import sleep from subprocess import call class AbstractCallback(object): u"""Absctract class for line callback. Registred callback will be invked for every new line. If your action depends ...
eventgen_core.py
#!/usr/bin/env python # encoding: utf-8 import imp import json import logging import logging.config import os import sys import time from Queue import Empty, Queue from threading import Thread from lib.eventgenconfig import Config from lib.eventgenexceptions import PluginNotLoaded from lib.eventgentimer import Timer f...
train_ug_pretrain.py
import tensorflow as tf import numpy as np import time import datetime import os import network_pretrain_rank as network import network_pretrain as network_pre import json from sklearn.metrics import average_precision_score import sys import ctypes import threading from kg_dataset_transe import KnowledgeGraph export_p...
snappiserver.py
from flask import Flask, request, Response import threading import json import time import snappi app = Flask(__name__) CONFIG = None @app.route('/config', methods=['POST']) def set_config(): global CONFIG config = snappi.api().config() config.deserialize(request.data.decode('utf-8')) test = config.o...
threadDemo.py
import threading, time print('Start of program.') def takeANap(): #defines function for use in a new thread time.sleep(5) print('Wake up!') threadObj = threading.Thread(target=takeANap) #calls function in new thread. threadObj.start() print('End of program!')
network.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2020 tecnovert # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. ''' Message 2 bytes msg_class, 4 bytes length, [ 2 bytes msg_type, payload ] Handshake procedur...
Miner.py
from JsonRpc2Client import * from Utils import * from Cryptonight import SubscriptionCryptonight import socket, threading, urllib.parse, math SubscriptionByAlgorithm = { "cryptonight": SubscriptionCryptonight, } class Miner(JsonRpc2Client): """Simple mining client""" class MinerWarning(JsonRpc2Client.RequestRe...
machine.py
from contextlib import _GeneratorContextManager from pathlib import Path from queue import Queue from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple import base64 import io import os import queue import re import shlex import shutil import socket import subprocess import sys import tempfile import t...
numexpr.py
"""Tools for working with Numexp. At present all this module provides is a safe way of importing ``numexpr``. This prevents a hard crash (i.e. segfault) when the MKL is enabled but cannot be found. Just go: >>> from mmfutils.performance.numexpr import numexpr """ __all__ = ['numexpr'] numexpr = False try: imp...
MicrosoftTeams.py
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests from distutils.util import strtobool from flask import Flask, request, Response from gevent.pywsgi import WSGIServer import jwt import time from threading import Thread from typing import...
multi1.py
""" multiprocess basics: Process works like threading.Thread, but runs function call in parallel in a process instead of a thread; locks can be used to synchronize, e.g. prints on some platforms; starts new interpreter on windows, forks a new process on unix; """ import os from multiprocessing import Process, Lock d...
ConnectionManager.py
#!/usr/bin/env python ############################################################################ # # SAGE UI Users Server - A server that handles users, fsManagers and chat for SAGE # # Copyright (C) 2005 Electronic Visualization Laboratory, # University of Illinois at Chicago # # All rights reserved. # # Redistrib...
pyminer.py
#!/usr/bin/python # # Copyright (c) 2011 The Bitcoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import time import json import pprint import hashlib import struct import re import base64 import httplib import...
gavin_bms.py
#!/usr/local/bin/python3.6 -u # Daemon to read values from the voltage and current sensors # Data is requested through a json string, and returned as a json string import os.path from os import unlink #from datetime import date import json import socket from threading import Thread from time import sleep id = 'Gavin...
tun.py
# # Copyright (c) 2016-2017, The OpenThread 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 re...
controller.py
''' Description: 门禁控制模块 Author: Shengxiang Hu Github: https://github.com/MTleen Date: 2021-02-07 23:12:03 LastEditors: Shengxiang Hu LastEditTime: 2021-03-18 19:48:39 FilePath: /smart_gate_v2/controller.py ''' from flask import Flask from flask import request import os from numpy.lib.histograms import histogram import ...
DUrlConsumer.py
#! /usr/bin/python import traceback from datetime import datetime import gevent from gevent import monkey from common.DBHandler import MySQL from common.DBHandler import Redis from common.IOHandler import FileIO from common.IOHandler import NetworkIO monkey.patch_all() def getAllInfo(dbkey): urlPool = Redis()...
ocs_end_of_night_thread.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # + # import(s) # - from OcsCameraEntity import * from OcsSequencerEntity import * import threading import os # + # function: worker_code() # - def worker_code(entity='', entobj=None): # debug output print('name: {0:s}'.format(threading.currentThread().getName(...
Hiwin_socket_ros_20190510101135.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import Hiwin_socke...
rehasher.py
""" Author: Michel Peltriaux Organization: Spatial data infrastructure Rheinland-Pfalz, Germany Contact: michel.peltriaux@vermkv.rlp.de Created on: 22.01.19 """ import threading from collections import OrderedDict from Geoportal.utils import utils class Rehasher: """ Merges categories and filters from all sear...
rdd.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
tg.py
import logging import os import queue import threading from telegram.ext import CommandHandler, Filters, MessageHandler, Updater from client import chats, connect_ws, contexts logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG ) BOT_TOKEN = os.environ["BOT_TO...
sqanti_qc2.py
#!/usr/bin/env python # SQANTI: Structural and Quality Annotation of Novel Transcript Isoforms # Authors: Lorena de la Fuente, Hector del Risco, Cecile Pereira and Manuel Tardaguila # Modified by Liz (etseng@pacb.com) currently as SQANTI2 working version __author__ = "etseng@pacb.com" __version__ = '7.3.2' # Python ...
helpers.py
import re import os import urllib import requests from threading import Thread canUseBS4 = True valid_chars = '_.() abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&-+=' try: from bs4 import BeautifulSoup except ImportError as e: canUseBS4 = False # This function was written by NT_x86 def...
test.py
#!/usr/bin/env python # # Copyright 2012 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...
buildtester.py
#!/usr/bin/env python3 from flask import Flask, request, make_response, render_template from flask.ext.github import GitHub, GitHubError from collections import OrderedDict import configparser from datetime import datetime import atexit import hashlib import hmac import json import os import queue import re import sig...
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 ...
detect_multi_threaded.py
import argparse import copy from multiprocessing import Queue from threading import Thread from typing import List, Dict import cv2 from utils import Worker, Calibration from utils.webcam_video_stream import WebcamVideoStream from utils.zmq_publisher import HandPositionPublisher, MarkerPublisher from utils.synchroni...
ZyqChat.py
import wx import threading import socket from time import sleep, ctime from enum import Enum, IntEnum, unique import os import sys import signal import getpass class StyleList(Enum): OUTPUT = 2 SEND = 3 RECE = 4 class MyStyle(wx.TextAttr): def __init__(self, style = None): wx.TextAttr.__init_...
automate.py
import logging import time import io import zipfile import json import threading import inspect import datetime from . import handler from . import configuration from .instance import Instance from . import utilities from .resources import resources # The type of instance to use for compilation. BUILD_INSTANCE_TYPE =...
lisp-itr.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@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 obtain...
opcBridge.py
import opc import time import os import socket import json import threading import queue import datetime import numpy as np import yaml from flask import Flask, request from flask_restful import Resource, Api, reqparse import logging import requests ############################SUPPORT FUNCTIONS########################...
inference_folder.py
# Standard libraries import timeit from pathlib import Path from glob import glob from datetime import datetime import os import sys from collections import OrderedDict import argparse from typing import List sys.path.append('./') # PyTorch import torch torch.set_num_threads(1) from torch.autograd import Variable impo...
notebookapp.py
# coding: utf-8 """A tornado based Jupyter notebook server.""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import absolute_import, print_function import notebook import binascii import datetime import errno import importlib import io import jso...
setup.py
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. """Miscellaneous I/O utility functions for setting up the render pipeline. Abstracts over the setup that has...
object_detection_zed.py
import numpy as np import os import six.moves.urllib as urllib import sys import tensorflow as tf import collections import statistics import math import tarfile import os.path from threading import Lock, Thread from time import sleep import cv2 # ZED imports import pyzed.sl as sl sys.path.append('utils') # ## Obj...
run.py
#!/usr/bin/env python # _*_ coding: utf-8 _*_ # The reason we don't patch threading is because # our IPC queues rely on it for locking. We can't have them # be greenlets otherwise they will need the HTTPD to yeild # before data from the fetch process can be transmitted. from gevent import monkey; monkey.patch_all(thre...
__init__.py
import contextlib import datetime import errno import inspect import multiprocessing import os import re import signal import subprocess import sys import tempfile import threading from collections import namedtuple from enum import Enum from warnings import warn import yaml from six.moves import configparser from da...
accumulators.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
test_all_ctrls_wsgi.py
# coding: utf-8 import os from typing import Dict import unittest from threading import Thread from time import sleep from unittest.case import skip import urllib.request import urllib.error import http.client from wsgiref.simple_server import WSGIServer, make_server from simple_http_server.logger import get_logger, ...
presenter_agent.py
# !/usr/bin/env python # -*- coding:utf-8 -*- # Copyright 2021 Huawei Technologies Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # You may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
IOMaster_GUI_NoBoard.py
import tkinter as TK import usb.core import usb.util import serial import time import threading from tkinter import * from tkinter import ttk from tkinter import messagebox window = TK.Tk() window.title("IO Master Setup") window.geometry("400x500") tabControl = ttk.Notebook(window) sendTab = ttk.Frame(tabControl) re...
logger.py
import web import threading import time import sys from pirulo import Handler class TopicsHandler: def GET(self): return Plugin.INSTANCE.topics class ConsumersHandler: def GET(self): return Plugin.INSTANCE.consumers class Plugin(Handler): INSTANCE = None def __init__(self): H...
thread.py
''' @author: frank ''' import threading import inspect import pprint import traceback import log import functools logger = log.get_logger(__name__) class AsyncThread(object): def __init__(self, func): self.func = func def __get__(self, obj, type=None): return self.__class__(self.fun...
startDask.py
import os import argparse import time from dask.distributed import Client import sys, uuid import threading import subprocess import socket import mlflow from notebook.notebookapp import list_running_servers def write_freeze(): # log pip list before doing anything else from pathlib import Path import os ...
Matchup.py
""" Author: George Macrae 2014 """ import pygame, pygbutton, sys from pygame.locals import * from socket import * import threading import Start import textbox import Setup FPS = 30 WINDOWWIDTH = 860 WINDOWHEIGHT = 700 WHITE = (255, 255, 255) RED = (255, 0, 0) BLUE = (0, 0, 255) GREEN = (0, 255, 0) BLACK = (0, ...
client.py
""" Receieves notifications from remote queue. """ # pylint:disable=W0212 # pylint:disable=W0703 import threading import logging import json from azure.servicebus import ServiceBusService MESSAGE_WAIT_AFTER_ERROR = 5 MESSAGE_WAIT_TIMEOUT = 5 SBS_TOPIC_NAME = "webhooks" SBS_SUBSCRIPTION_NAME = "RPiOneSubscription" SBS...
proxy.py
import requests import time import random import sys from multiprocessing import Process, Manager, current_process sys.path.append('..') # For unit test from logger import crawler from config import headers, conf from login import get_cookies from page_parse.basic import is_404 from db.redis_db impo...
network.py
""" Defines network nodes used within core. """ import logging import threading from collections import OrderedDict from pathlib import Path from queue import Queue from typing import TYPE_CHECKING, Dict, List, Optional, Type import netaddr from core import utils from core.emulator.data import InterfaceData, LinkDat...
PyShell.py
# uncompyle6 version 2.9.10 # Python bytecode 2.7 (62211) # Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10) # [GCC 6.2.0 20161005] # Embedded file name: PyShell.py import os import os.path import sys import string import getopt import re import socket import time import threading import traceback impo...
z_train_abstractive.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 from pytorch_transformers import BertTokenizer import distributed from models import data_loader, model_builder from models.data_loader i...
srpc.py
from random import randint import socket from threading import Thread, Timer, Event #SRPC imports from connection import Connection from payload import Payload, ConnectPayload from srpcTypes import Service, Endpoint from srpcDefs import SRPCDef, Command class SRPC(object): """A simple RPC library for connecting to...
arduinoLink.py
import serial import tkinter as tk import os from threading import Thread from serial import * last_received = '' def receiving(ser): global last_received buffer = '' while True: last_received = ser.readline() buffer += ser.read(ser.inWaiting()) if '\n...
Snake.py
# Author: André Fonteles # This game does not run on windows due to the lack of # support for the curses library import atexit import random import curses import time import threading import os # An IOController controls the input (keyboard) and output # (console) of the game class IOController(): # TODO: cur...
oplog_manager.py
# Copyright 2013-2014 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
main.py
# use tkinter to create gui with 3 tabs - current, historical and read csv # import libraries import tkinter as tk from tkinter import ttk from tkinter import filedialog import csv import matplotlib.pyplot as plt import numpy as np from utils import data_util, database_util, graph_util import threading import time im...
Server.py
from http.server import BaseHTTPRequestHandler, HTTPServer import cgi import sys import threading import re from Adb_Handler import Adb_Handler as AdbHandler class Server(BaseHTTPRequestHandler): verbose = False key = '' deviceId = '' adbHandler = AdbHandler def start(self, ip, port, key, deviceI...
minion.py
# -*- coding: utf-8 -*- ''' Routines to set up a minion ''' # Import python libs from __future__ import absolute_import, print_function, with_statement, unicode_literals import functools import os import sys import copy import time import types import signal import random import logging import threading import tracebac...
engine.py
import os import sys import shutil import re import subprocess import itertools import mlir import ctypes import glob import operator import tempfile import uuid import distutils.ccompiler import multiprocessing as mp import llvmlite.binding as llvm import numpy as np from .sparse_utils import MLIRSparseTensor from fun...
build.py
## @file # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2007 - 2021, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR> # Copyright (c) 2020, ARM Limited. All rights reserved.<BR> # ...
start.py
import threading from discord.ext import commands import discord from website import create_app from cogs import generalCommands, events, leaderboard from settings import configFunctions global client client = commands.Bot(command_prefix=commands.when_mentioned_or(configFunctions.getCommandPrefix()), description='Yo...
test_pubsub.py
#!/usr/local/bin/python3.6 # vim: expandtab shiftwidth=4 # Copyright (C) 2019 National Institute of Informatics # # 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 own...
pants_daemon.py
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import logging impor...
test_websocket_provider.py
import asyncio import pytest import sys from threading import ( Thread, ) import websockets from tests.utils import ( wait_for_ws, ) from web3 import Web3 from web3.exceptions import ( ValidationError, ) from web3.providers.websocket import ( WebsocketProvider, ) if sys.version_info >= (3, 8): fr...
app.py
from PySide6.QtCore import QFile, QTextStream from PySide6.QtWidgets import QApplication, QWidget import sys import threading from extension.utils import get_tools from peewee import * get_tools() from file_cabinet.models import Drawer app = QApplication(sys.argv) from main.ui import MainWindow from main.settings ...
__init__.py
from __future__ import print_function import argparse import itertools import os import random import re import shlex import string import sys import traceback import warnings from collections import OrderedDict from fnmatch import fnmatchcase from subprocess import list2cmdline from threading import Thread import pl...
Run2 (copy).py
#!/usr/bin/env python # license removed for brevity import rospy import cv2 import numpy as np import time import threading from std_msgs.msg import String, Float32, Bool from sensor_msgs.msg import CompressedImage import sys from modules.Control import PID, Fuzzy from modules.Advance import Advance_lane, Speed_predict...
client2.py
#!/usr/bin/env python3 """Script for Tkinter GUI chat client.""" from socket import AF_INET, socket, SOCK_STREAM from threading import Thread import tkinter def receive(): """Handles receiving of messages.""" while True: try: msg = client_socket.recv(BUFSIZ).decode("utf8") msg_list.insert(tkinter.END, msg) ...
client.py
import os import socket from threading import Thread from queue import Queue from time import sleep from pickle import load, dump from .utils import Message, Channel HOST = "localhost" PORT = 5500 HOME = os.path.expanduser("~") class Client: def __init__(self, name: str, message_queue: Queue = Queue()) -> None:...
index.py
from flask import Flask import time import socket import threading import traceback app = Flask(__name__) class Tello: """Wrapper to simply interactions with the Ryze Tello drone.""" def __init__(self, local_ip, local_port, imperial=True, command_timeout=10, tello_ip='192.168.10.1', tello_port=8889): ...
agents_video_editor.py
#!/usr/bin/env python ############################################################## # # # Copyright 2019 Amazon.com, Inc. or its affiliates. # # All Rights Reserved. # # ...
asynchronous.py
# Practice Activity: Asynchronous Programming # # Continue from the previous practice activity. # Change your code to use asyn functions instead of threads. # Create an even loop just as we did in the video -- # you will just need to change the function body itself. # # Note: When you are doing async functions, # you c...
status_report.py
# import os # import sys # from ctypes import c_char # from io import StringIO # from multiprocessing import Process, Manager, Value, Array # from subprocess import Popen, PIPE # from time import sleep # # # class StatusStdOut(StringIO): # def __init__(self, stdout): # self.stdout = stdout # # def write...
test_pipe.py
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2018-2019 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the ...
github.py
import copy import json import re import threading import time from urllib.request import urlopen from i3pystatus import IntervalModule, formatp from i3pystatus.core import ConfigError from i3pystatus.core.desktop import DesktopNotification from i3pystatus.core.util import user_open, internet, require try: import...
HiwinRA605_socket_ros_test_20190625191433.py
#!/usr/bin/env python3 # license removed for brevity #接收策略端命令 用Socket傳輸至控制端電腦 import socket ##多執行序 import threading import time ## import sys import os import numpy as np import rospy import matplotlib as plot from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * import HiwinRA605_s...
parallelEnv.py
# taken from openai/baseline # with minor edits # see https://github.com/openai/baselines/baselines/common/vec_env/subproc_vec_env.py # import numpy as np import gym from multiprocessing import Process, Pipe from abc import ABC, abstractmethod class CloudpickleWrapper(object): """ Uses cloudpickle to seriali...
host_callback_test.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
main.py
import argparse, sys, socket # Import all from threading import Thread import json # We use threading, cuz multiprocessing is bad at passing arguments to targets # also, we don`t need GIL unlocking. VERSION = "v0.2" class Client: def __init__(self): self.parser() self.start() ...
sasiostdio.py
# # 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 by applicable law or agreed to in writing...
event_processor.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
upnp.py
import logging import threading from queue import Queue try: import miniupnpc except ImportError: pass log = logging.getLogger(__name__) class UPnP: def __init__(self): self.queue = Queue() def run(): try: self.upnp = miniupnpc.UPnP() self.up...
unix-crack.py
import argparse import crypt import threading from multiprocessing import Pool, Queue queue = Queue() def test_pass(user, crypt_pass, dict_words): salt = crypt_pass[0:2] for word in dict_words: crypt_word = crypt.crypt(word, salt) if crypt_word.strip() == crypt_pass.strip(): queue...
keep_alive.py
from flask import Flask from threading import Thread import random app = Flask('') @app.route('/') def home(): return 'Im in!' def run(): app.run( host='0.0.0.0', port=random.randint(2000,9000) ) def keep_alive(): ''' Creates and starts new thread that runs the function run. ''' t = Thread(target=ru...
main.py
import asyncio import json import logging import websockets import os import threading import socket from utils.crypto import encryptImage from utils.socket import recvall # Env SERVER_PORT = os.getenv('SERVER_PORT', 6789) SERVER_URL = os.getenv('SERVER_URL', "localhost") # Setup logging logging.basicConfig() # Body r...
silvia-pi.py
#!/usr/bin/python3 import logging from datetime import datetime as dt logger = logging.getLogger('silvia') logger.setLevel(logging.INFO) fh = logging.FileHandler('/home/pi/silvia-pi/logs/%s.log' % dt.strftime(dt.now(), '%Y-%m-%d')) fh.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s - %(name)s - %(le...
interactive.py
''' Interactive launcher ==================== .. versionadded:: 1.3.0 .. versionchanged:: 1.9.2 The interactive launcher has been deprecated. The :class:`InteractiveLauncher` provides a user-friendly python shell interface to an :class:`App` so that it can be prototyped and debugged interactively. .. note:: ...
database.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) """ These tests check the database is functioning properly, both in memory and in its file """ import datetime import func...
Mgmt.py
"""Mgmt System for PiCN""" import multiprocessing import os import select import socket import time from typing import Dict from PiCN.Layers.ICNLayer.ContentStore import BaseContentStore from PiCN.Layers.ICNLayer.ForwardingInformationBase import BaseForwardingInformationBase from PiCN.Layers.ICNLayer.PendingInterest...
job.py
""" **job** module handles all the job running logic: - consistent exception handling and logging - currently 2 job runners are implemented: - SimpleJobRunner runs the jobs sequentially. - ParallelJobRunner queues the jobs and run them in a dedicated thread """ from concurrent.futures import ThreadPoolExecutor, Pr...
dataclient.py
"""This file implements a threaded stream controller to abstract a data stream back to the ray clientserver. """ import logging import queue import threading import grpc from typing import Any, Callable, Dict, Optional import ray.core.generated.ray_client_pb2 as ray_client_pb2 import ray.core.generated.ray_client_pb2...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # from __future__ import absolute_import __all__ = ['BaseManager', 'SyncManager', 'BaseProxy', 'Token'] # # Imports # ...
docker_agent.py
'''An example docker agent.''' import json import time import os import threading import requests import docker from . import BaseAgent from .. import utility from .. import characters class DockerAgent(BaseAgent): """The Docker Agent that Connects to a Docker container where the character runs.""" def __in...
jobworker.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function import logging import pickle import threading import ray import ray.streaming._streaming as _streaming from ray.streaming.config import Config from ray.function_manager import FunctionDescriptor from ray.strea...
ClientNode.py
from utils.StorageUtility import StorageUtility from ClientDatabase import ClientDatabase from ServerConnection import ServerConnection from data_classes.Message import Message from data_classes.PublicInfo import PublicInfo from data_classes.UserInfo import UserInfo from threading import Thread, Event class ClientNod...