source
stringlengths
3
86
python
stringlengths
75
1.04M
plugin_service.py
import asyncio import threading import atexit import json import os import shutil import time import traceback import uuid from collections import namedtuple from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor from os import environ import yaml from apscheduler.schedulers.background import Backgroun...
libraries.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals from sublime import active_window from os import path from json import loads from glob import glob from threading import Th...
session.py
# San Jose State Greenlight scraper objects # Written by Kevin Tom import threading import Queue import re import mechanize from bs4 import BeautifulSoup class GreenlightSession(object): def __init__(self, username='', password=''): self.username = username self.password = password s...
atrace_agent.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import optparse import platform import re import sys import threading import zlib import py_utils from devil.android import device_utils from devil.android...
mp_support.py
""" This module defines modified versions of some classes and functions defined in :mod:`multiprocessing.managers` to support OpenMDAO distributed simulations. Channel communication can be secured by setting `authkey` to 'PublicKey'. When `authkey` is 'PublicKey', an additional session establishment protocol is used b...
DatasetLoader_imbalance.py
#! /usr/bin/python # -*- encoding: utf-8 -*- import torch import numpy import random import pdb import os import threading import time import math from scipy.io import wavfile from queue import Queue import random def round_down(num, divisor): return num - (num%divisor) def loadWAV(filename, max_frames, evalmod...
solr_helpers.py
__author__= "Claire L Mattoon, Johnny Edward, Eric Ziecker" import xml.etree.ElementTree as etree import aristotle.settings as settings import sunburnt from app_helpers import repository from multiprocessing import Process, Queue print("AFTER IMPORT") SOLR_QUEUE = Queue(maxsize=5) MODS_NS = 'http://www.loc.gov/mods/...
registrar_common.py
''' SPDX-License-Identifier: Apache-2.0 Copyright 2017 Massachusetts Institute of Technology. ''' import base64 import threading import sys import signal import time import http.server from http.server import HTTPServer, BaseHTTPRequestHandler from socketserver import ThreadingMixIn from sqlalchemy.exc import SQLAlche...
loca_navi_demo.py
import argparse, copy import multiprocessing, time from lib.navigation import Navigation from Map.map_plotter import Plotter from distutils.util import strtobool parser = argparse.ArgumentParser() parser.add_argument("--scene_type", type=int, default=1, help="Choose scene type for simulation, 1 for Kitchens, 2 for Li...
cli.py
# -*- coding: utf-8 -*- """ flask.cli ~~~~~~~~~ A simple command line application to run flask apps. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import os import sys import traceback from threading import Lock, Thread from functools import update_wrapp...
real_time.py
#done changes import os import sys import json import numpy as np import torch from torch import nn from torch import optim from torch.optim import lr_scheduler from threading import Thread from threading import Lock import time import cv2 from torch.autograd import Variable import torch.nn.functional as F from opts i...
utils.py
#!/usr/bin/env python3 # encoding: utf-8 import os import sys import comm.global_var as gl try: import ConfigParser except: try: import configparser as ConfigParser except: from six.moves import configparser as ConfigParser if sys.version_info.major == 2: import commands else: impo...
get_errors.py
#! /usr/bin/env python3 import os import re import json import logging from multiprocessing import Process, Queue, current_process from collections import OrderedDict import numpy as np import click from data_iterator import TextIterator from params import load_params logging.basicConfig(level=logging.WARN, ...
mp.py
import os import pickle import struct import sys from functools import partial from multiprocessing import Process, Lock, Event as ProcessEvent from multiprocessing.pool import ThreadPool from threading import Thread, Event as TrEvent from time import sleep, time from typing import List, Dict import psutil from six.mo...
player.py
import logging import threading import time from collections import defaultdict from sound_player.common import StatusObject, STATUS logger = logging.getLogger(__name__) class Playlist(StatusObject): def __init__(self, concurency=1, replace=False, loop=1): super().__init__() self._concurency = c...
systeminfo.py
import csv import datetime import logging import os import platform import subprocess import threading import time from typing import Any, Dict, List import psutil from calchas.common import base class Sensor(base.Publisher): def __init__(self, options: Dict[str, Any]): super().__init__(options) ...
recursiveFractalSearch.py
import math import numpy as np import random import timeit from threading import Thread import functools dist_ar = [] # 거리표(global) cities_count = 0 # 도시 수(global) dots_list = [] # 도시 리스트(global) # Hyper Parameter limits = 60 * 12 # 제한시간 Fractal_size = 5 # 재귀 수 # 시간제한 데코레이터 def timeout(seconds_before_timeout): ...
sample_part1.py
import socket import time UDP_IP = '127.0.0.1' UDP_PORT = 8883 def run_client(ip, port): time.sleep(2) MESSAGE = u"""Эхо-служба (€) «Hello World!»""" sock = socket.socket(socket.AF_INET, # IPv4 socket.SOCK_DGRAM) # UDP server = (ip, port) for line in MESSAGE.split(' '):...
test_player.py
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation t...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform import array import contextlib from weakref import proxy import signal import math import pickle import struct impo...
ReducePNGFolder.py
# -*- coding: utf-8 -*- import os import multiprocessing import threading from PIL import Image import sys class ReducePNGFolder: #Author: Juan Pablo Toledo Gavagnin ''' # How to use # python scriptName.py originalFolderURI destinationFolderURI # Dependencies # This scripts needs to ha...
call.py
# Copyright (c) 2014-2015, Ruslan Baratov # All rights reserved. # Adapted to python3 version of: http://stackoverflow.com/questions/4984428 import os import platform import subprocess import sys import threading import time # Tests: # # Windows: # * Control Panel -> Region -> Administrative -> Current languange for...
client.py
# coding: utf-8 import time import pickle import socket import random import logging import argparse import threading logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M:%S') def main(name, port, ring,...
wsdump.py
#!/Users/eo/Dev/pyProj/vectorbt/.venv/bin/python3 import argparse import code import sys import threading import time import ssl import gzip import zlib import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): encoding = ...
Network.py
from pyramid.response import Response from pyramid.view import view_config import os import sys import time import ujson from datetime import datetime, timedelta from lxml import etree, html from .config import Config import logging log = logging.getLogger(__name__) import networkx as nx from networkx.readwrite imp...
example_stream_buffer.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # File: example_stream_buffer.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://pyp...
demo.py
# Copyright 2020-2022 OpenDR European Project # # 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 agree...
chef.py
import asyncio import atexit import multiprocessing as mp import os import re import subprocess import sys from asyncio.events import get_running_loop from pathlib import Path from queue import Queue from signal import SIGINT, SIGKILL, SIGTERM, SIGUSR1, signal from threading import Timer from time import perf_counter ...
client.py
from base64 import b64encode import logging try: import queue except ImportError: # pragma: no cover import Queue as queue import signal import ssl import threading import time import six from six.moves import urllib try: import requests except ImportError: # pragma: no cover requests = None try: ...
BotConcurrentModule.py
import asyncio import threading import importlib from multiprocessing import Process, Queue from botsdk.Bot import Bot from botsdk.BotRequest import BotRequest from botsdk.tool.BotException import BotException from botsdk.tool.JsonConfig import getConfig from botsdk.tool.TimeTest import * from botsdk.tool.Error import ...
tk_agent.py
import logging import time import threading import copy import os import chess import chess.pgn # from tkinter import * # from tkinter.ttk import * # from tkinter import filedialog, font import tkinter as tk import tkinter.ttk as ttk from tkinter import font, filedialog import PIL from PIL import ImageTk, Image, Im...
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...
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...
util.py
import asyncio import io import logging import os import random import re import socket import subprocess import tarfile import threading import time from contextlib import contextmanager from functools import partial as p from io import BytesIO from typing import Any, Dict, List, TypeVar, cast import docker import ne...
vnbitfinex.py
# encoding: UTF-8 from __future__ import print_function import json import requests import traceback import ssl from threading import Thread from queue import Queue, Empty import time import hmac import base64 import hashlib import websocket from six.moves import input WEBSOCKET_V2_URL = 'wss://api.bitfinex.com/ws/2...
infeed_outfeed_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...
TDMqttClient.py
#Copyright (C) 2021,2022 Andrew Palardy #See LICENSE file for complete license terms #MqttClient class #Implements management code for Paho MQTT client from paho.mqtt import client as mqtt_client import json import threading class TDMqttClient(): #Create camera decoder with a config dictionary def __init__(sel...
sender.py
# This class is responsible for handling all asynchronous Logz.io's # communication import sys import json from time import sleep from datetime import datetime from threading import Thread, enumerate import requests from .logger import get_logger if sys.version[0] == '2': import Queue as queue else: import ...
__init__.py
#!/usr/bin/env python3 # vim: sw=4:ts=4:et:cc=120 __version__ = '1.0.15' __doc__ = """ Yara Scanner ============ A wrapper around the yara library for Python. :: scanner = YaraScanner() # start tracking this yara file scanner.track_yara_file('/path/to/yara_file.yar') scanner.load_rules() scanner.s...
util.py
# # Module providing various facilities to other parts of the package # # multiprocessing/util.py # # Copyright (c) 2006-2008, R Oudkerk # Licensed to PSF under a Contributor Agreement. # # Modifications Copyright (c) 2020 Cloudlab URV # import traceback import weakref import redis import uuid import logging import sys...
test_threading_local.py
import unittest from doctest import DocTestSuite from test import test_support import weakref import gc # Modules under test _thread = test_support.import_module('thread') threading = test_support.import_module('threading') import _threading_local class Weak(object): pass def target(local, weakli...
DesktopUtils.pyw
import tkinter as tk from dotenv import load_dotenv import os import importlib from infi.systray import SysTrayIcon from win32_adapter import * import threading import sys import time load_dotenv() class DesktopUtils: VERSION = "1.0" def __init__(self): self.widgets = {} se...
_coreg_gui.py
# -*- coding: utf-8 -*- u"""Traits-based GUI for head-MRI coregistration. Hierarchy --------- This is the hierarchy of classes for control. Brackets like [1] denote properties that are set to be equivalent. :: CoregFrame: GUI for head-MRI coregistration. |-- CoregModel (model): Traits object for estimating the h...
test_browser.py
# coding=utf-8 # Copyright 2013 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. from __future__ import print_function import argparse ...
gist_historical_example.py
# Gist example of IB wrapper from here: https://gist.github.com/robcarver17/f50aeebc2ecd084f818706d9f05c1eb4 # # Download API from http://interactivebrokers.github.io/# # (must be at least version 9.73) # # Install python API code /IBJts/source/pythonclient $ python3 setup.py install # # Note: The test cases, and the d...
wrap_test.py
from functools import wraps from threading import Thread, Lock counter = 0 def synchronized(lock): """ Synchronization decorator. """ def real_wrapper(function): @wraps(function) def wrapper(*args, **kwargs): global lock lock.acquire() try: ...
ews.py
# vim: sw=4:ts=4:et:cc=120 import collections import importlib import logging import os, os.path import sqlite3 import threading from urllib.parse import urlparse import saq from saq.constants import * from saq.collectors import Collector, Submission from saq.error import report_exception from saq.util import local_...
run_end_to_end_tests.py
#!/usr/bin/env python3 # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
server.py
import socket, threading, time MAX_CONNECTION_NUMBER = 5 MAX_MESSAGE_LIMIT = 1024 # bytes PORT = 9999 IP = '127.0.0.1' def tcp_link(sock, addr): print(f'Accpet new connection from {sock} {addr}...') sock.send(b'Welcome!') while True: data = sock.recv(MAX_MESSAGE_LIMIT) # max recv bytes 1k ...
core.py
""" homeassistant ~~~~~~~~~~~~~ Home Assistant is a Home Automation framework for observing the state of entities and react to changes. """ import os import time import logging import threading import enum import re import functools as ft from collections import namedtuple from homeassistant.const import ( EVENT...
client.py
import socket from tkinter import * from threading import Thread import random from PIL import ImageTk, Image screen_width = None screen_height = None SERVER = None PORT = None IP_ADDRESS = None playerName = None canvas1 = None canvas2 = None nameEntry = None nameWindow = None gameWindow = None ...
app.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 # AWS X-ray support from aws_xray_sdk.core import xray_recorder from aws_xray_sdk.ext.flask.middleware import XRayMiddleware from aws_xray_sdk.core import patch_all patch_all() xray_recorder.begin_segment("Videos-in...
cli.py
import http.server import os import socketserver import threading from pathlib import Path from webbrowser import open as webbrowser_open import click import jinja2 from cli import echo from engine.stack import CloudformationStack HTTP_SERVE_ADDRESS = "127.0.0.1" HTTP_SERVE_PORT = 1234 APP_MAIN_PATH = Path(__file__)....
test_postgresql.py
import datetime import mock # for the mock.call method, importing it without a namespace breaks python3 import os import psycopg2 import shutil import subprocess import unittest from mock import Mock, MagicMock, PropertyMock, patch, mock_open from patroni.async_executor import CriticalTask from patroni.dcs import Clu...
Base.py
# Trading algorithm structure and initialization file. import gdax, pymongo, collections, threading, sys, os, subprocess import WStoMongo, Level2Data, HistData, DataFunc db = pymongo.MongoClient().algodb_test quitCall = False print "Welcome to the Trahan Autonomous Trading Program!" # Main program loop to start thr...
monitor.py
# -*- coding: UTF-8 -*- #!/usr/bin/env python # 基本 from __future__ import division import time import uuid import logging import sys import json import threading import os # 访问activemq import stomp # 访问zookeeper from kazoo.client import KazooClient # 访问数据库 import psycopg2 # 通讯rpyc模块 import rpyc from rpyc.utils.server...
__init__.py
#!/usr/bin/env python3 # # Copyright 2017-2018 Amazon.com, Inc. and its affiliates. All Rights Reserved. # # Licensed under the MIT License. See the LICENSE accompanying this file # for the specific language governing permissions and limitations under # the License. # # # Copy this script to /sbin/mount.efs and make su...
test_utils.py
# Copyright (c) 2010-2012 OpenStack Foundation # # 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 agree...
packages_analyzer.py
#!/usr/bin/env python """ 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")...
bluePugs.py
#!/usr/bin/python3 # encoding: utf-8 # BluePugs Engine # By Guanicoe # guanicoe@pm.me # https://github.com/guanicoe/Blue-pugs-engine from collections import deque from urllib.parse import urlsplit from billiard import Process, Value from bs4 import BeautifulSoup import concurrent.futures as futures import pandas as pd ...
test_run_example.py
''' This test tests whether starting a `run_ogcore_example.py` run of the model does not break down (is still running) after 5 minutes or 300 seconds. ''' import multiprocessing import time import os import sys import importlib.util from pathlib import Path import pytest def call_run_ogcore_example(): cur_path = ...
run_search.py
import argparse from timeit import default_timer as timer from aimacode.search import InstrumentedProblem from aimacode.search import (breadth_first_search, astar_search, breadth_first_tree_search, depth_first_graph_search, uniform_cost_search, greedy_best_first_graph_search, depth_limited_search, recursive...
auth.py
# coding: utf-8 from __future__ import print_function, unicode_literals import bottle import os from threading import Thread, Event import webbrowser from wsgiref.simple_server import WSGIServer, WSGIRequestHandler, make_server from boxsdk import OAuth2 CLIENT_ID = 'g5llkevn2tlidg9gplfc2mpsuvl0ht0k' # Insert Box ...
server.py
#!/bin/python3 ''' This starts the socket server to which things connect to play the game ''' import socketserver import socket # pylint: disable=unused-import import threading import time import random import sys import logging import os.path try: import ujson as json except: import json import battlecode as ...
playlist.py
import threading import vlc import gplaylist as grayp import pafy import sys from os import system,name import requests import urllib class GPlayer: def __init__(self): self.lnks = set() self.isPlaying=False self.audvol = 150 self.flag = True self.Instance=Instance = vlc.I...
test_telnetlib.py
import socket import telnetlib import time import Queue import unittest from unittest import TestCase from test import test_support threading = test_support.import_module('threading') HOST = test_support.HOST EOF_sigil = object() def server(evt, serv, dataq=None): """ Open a tcp server in three steps 1) ...
_client.py
from statefun_tasks import TaskRequest, TaskResult, TaskException, DefaultSerialiser, PipelineBuilder from statefun_tasks.client import TaskError from google.protobuf.any_pb2 import Any from kafka import KafkaProducer, KafkaConsumer, TopicPartition import logging import socket from uuid import uuid4 from threading im...
main.py
from tkinter import * from tkinter import ttk from tkinter import messagebox from tkinter import filedialog from json_manager import * from pygame import mixer from pytube import YouTube from moviepy.video.io.VideoFileClip import VideoFileClip import threading as thr root = Tk() root.title('MuPlay [vs1]') ...
serial_plot.py
#!/usr/bin/env python # # Pavel Kirienko, 2013 <pavel.kirienko@gmail.com> # from PyQt4 import QtGui from plot_widget import RealtimePlotWidget from serial_reader import SerialReader import sys, threading, time SER_PORT = '/dev/ttyUSB0' if len(sys.argv) < 2 else sys.argv[1] SER_BAUDRATE = 115200 def raw_handler(lin...
batch_reader.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # Modifications Copyright 2018 Arman Cohan # # 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 Licens...
gap.py
r""" Interface to GAP Sage provides an interface to the GAP system. This system provides extensive group theory, combinatorics, etc. The GAP interface will only work if GAP is installed on your computer; this should be the case, since GAP is included with Sage. The interface offers three pieces of functionality: #....
bulktasks.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # Copyright 2019 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 ...
data_utils.py
# Lint as python3 # Copyright 2018 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 r...
probe.py
#!/usr/bin/env python # Copyright (c) 2014, Paessler AG <support@paessler.com> # All rights reserved. # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the # following conditions are met: # 1. Redistributions of source code must retain the above copyright not...
InMemoryTransport.py
# Copyright 2015 Ufora Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
test_datasets.py
# coding: utf-8 import threading import attr import irl.exploration.datasets as D def test_Trajectories(): Trans = attr.make_class("Transition", ("val", "done")) ds = D.Trajectories(lambda traj: [x.val ** 2 for x in traj]) ds.concat([Trans(1, False), Trans(2, False), Trans(3, True)]) assert len(ds...
BotAmino.py
from time import sleep as slp from sys import exit from json import dumps, load, loads from pathlib import Path from threading import Thread from contextlib import suppress from unicodedata import normalize from string import punctuation from random import choice # from datetime import datetime from .local_am...
FileEmulator.py
#!/usr/bin/python # Wrote by: Aaron Baker from classes.RepeatedTimer import RepeatedTimer from classes.HttpRequestHandler import HttpRequestHandler from http.server import BaseHTTPRequestHandler, HTTPServer import time import threading import urllib.request import colorama # pip install from colorama import Fore, Bac...
inetstat.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import pwd import glob import re import socket import time import struct from collections import OrderedDict from multiprocessing import Process, Manager, cpu_count try: import _pickle as pickle # Python 3.5 import of cPickle except ImportError: ...
mp3_dl.py
import youtube_dl, spotipy, os, requests, threading, queue from spotipy.oauth2 import SpotifyOAuth from mutagen.mp3 import MP3 from mutagen.id3 import ID3, APIC, TIT2, TPE1, TALB, TRCK from mutagen.id3 import ID3NoHeaderError from youtube_dl.utils import DownloadError from requests.exceptions import HTTPError number_o...
webcam.py
# https://github.com/aiortc/aiortc/tree/master/examples/webcam # read frames from a webcam and send them to a browser. # video autostarts # can be used in an iFrame # use WebcamVideoStream to run the camera in a thread - reduces wait time for next frame import argparse from collections import namedtuple from threadi...
web.py
# coding=utf-8 import os import re import sys import functools import threading import cherrypy import json import subprocess import traceback import webbrowser import argparse from mako.template import Template from uuid import uuid4 import telenium from telenium.client import TeleniumHttpClient from ws4py.server.che...
web.py
import os import sys import inspect import tempfile import shutil import jinja2 import time # web content if sys.version_info[0] >= 3: # python 3.x import http.server as SimpleHTTPServer import socketserver as SocketServer else: # python 2.x import SimpleHTTPServer import SocketServer import ...
punctuation_capitalization_dataset.py
# Copyright (c) 2020, NVIDIA CORPORATION. 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...
server.py
# Import required modules import socket import threading HOST = '127.0.0.1' PORT = 1234 # You can use any port between 0 to 65535 LISTENER_LIMIT = 5 active_clients = [] # List of all currently connected users # Function to listen for upcoming messages from a client def listen_for_messages(client, username):...
main.py
import numpy as np from multiprocessing import Process from sklearn.neighbors import KNeighborsRegressor from scipy.spatial.distance import euclidean def filter_data(input, output, distance, pivot_distance, threshold): training = [] result = [] for i in xrange(0, len(input)): if euclidean(pivot_distance, d...
heartbeat.py
from threading import Thread, Timer from requests import post from requests.exceptions import ConnectionError, ConnectTimeout from document.exec_env import Exec_Env_Document from lib.http import HTTP_Status from lib.token import create_token from reader.arg import Arg_Reader from utils.log import Log def heartbeat(...
rabbitmq_client.py
"""时间: 2019/12/24 作者: liyongfang@cyai.com 更改记录: 重要说明: """ import json import logging import os import threading from django.conf import settings import django import pika from utils import config os.environ.setdefault("DJANGO_SETTINGS_MODULE", "wol_server.settings") django.setup() logger = logging.getLogger...
Lib.py
#!/usr/bin/env python3 import os, psutil, signal import sys import fcntl import pytz import time from datetime import datetime import multiprocessing from multiprocessing import Queue import subprocess, shlex import atexit import signal import socketserver import socket import re import shutil def getTaipeiTime(): ...
spoof.py
import time import threading from scapy.all import ARP, send # pylint: disable=no-name-in-module from .host import Host from evillimiter.common.globals import BROADCAST class ARPSpoofer(object): def __init__(self, interface, gateway_ip, gateway_mac): self.interface = interface self.gateway_ip = g...
btcproxy.py
""" A bitcoind proxy that allows instrumentation and canned responses """ from flask import Flask, request from bitcoin.rpc import JSONRPCError from bitcoin.rpc import RawProxy as BitcoinProxy from utils import BitcoinD from cheroot.wsgi import Server from cheroot.wsgi import PathInfoDispatcher import decimal import f...
views.py
import threading import time from news.models import News from news.scrape import Scrape from django.shortcuts import render # Web scrape threading def ScrapeThreading(): t1 = threading.Thread(target=Scrape, daemon=True) # daemon thread runs in background t1.start() time.sleep(600) ScrapeThreadi...
cmd.py
from subprocess import check_output import subprocess import threading import locale import os kubectlCommand = os.environ["KUBETERMINAL_CMD"] #execute kubectl commands def executeCmd(cmd): #TODO: if output is very long, this will hang until it is done output = "" try: output = check_output(cmd,sh...
ProbabilitySim.py
import time import multiprocessing import random """ Probability Simulator, provides different kind of "pools" to get items from AbstractPool - AbstractClass just to make sure all pools implement methods All pools return tuple. Has clone ability to make new of the same object for in use of Simulator Cl...
views.py
# project/users/views.py ################# #### imports #### ################# from flask import render_template, Blueprint, request, redirect, url_for, flash, abort from sqlalchemy.exc import IntegrityError from flask_login import login_user, current_user, login_required, logout_user from flask_mail import Message ...
keep_alive.py
from flask import Flask from threading import Thread app = Flask("") @app.route("/") def home(): return "I am alive!" def run(): app.run(host="0.0.0.0", port=8080) def keep_alive(): t = Thread(target=run) t.start()
monitor.py
from pyudevmonitor.monitor import UDevMonitor from pyudevmonitor.event import UEvent import queue import typing import threading from loguru import logger from usb2container.volume import add_volume, remove_volume from usb2container.config import global_config ACTION_ADD: str = "add" ACTION_BIND: str = "bind" ACTION...
arm_control.py
#!/usr/bin/python3 # taken from https://github.com/AcutronicRobotics/mara_examples import rclpy from multiprocessing import Process from rclpy.node import Node from rclpy.qos import qos_profile_sensor_data from hrim_actuator_rotaryservo_msgs.msg import GoalRotaryServo from hrim_actuator_gripper_srvs.srv import Contro...
local_dependency_manager.py
from contextlib import closing from collections import namedtuple import logging import os import threading import traceback import time import shutil from codalab.lib.formatting import size_str from codalab.worker.file_util import remove_path, un_tar_directory from codalab.worker.fsm import BaseDependencyManager, Dep...
run.py
import os import time import shutil import torch import numpy as np import numpy.random as rd import multiprocessing as mp from env import build_env from replay import ReplayBuffer, ReplayBufferMP, ReplayBufferMARL from evaluator import Evaluator from tqdm import tqdm """[ElegantRL.2021.09.09](https://github.com/AI4F...