source
stringlengths
3
86
python
stringlengths
75
1.04M
test_linsolve.py
import sys import threading import numpy as np from numpy import array, finfo, arange, eye, all, unique, ones, dot import numpy.random as random from numpy.testing import ( assert_array_almost_equal, assert_almost_equal, assert_equal, assert_array_equal, assert_, assert_allclose, assert_warns, ...
pinylib.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Pinylib module by Nortxort (https://github.com/nortxort/pinylib) """ # Edited for pinybot (https://github.com/TechWhizZ199/pinybot) import time import threading import random import traceback import logging import os import sys import getpass from rtmp import rtmp...
mcedit.py
# !/usr/bin/env python2.7 # -*- coding: utf_8 -*- # import resource_packs # not the right place, moving it a bit further #-# Modified by D.C.-G. for translation purpose #.# Marks the layout modifications. -- D.C.-G. from __future__ import unicode_literals """ mcedit.py Startup, main menu, keyboard configuration, auto...
httpd.py
import hashlib import os import threading # Moved in Python 2 -> 3, used only here. # Not adding to dvc.utils.compat to not load http.server for non-test runs. try: from http.server import HTTPServer except ImportError: from BaseHTTPServer import HTTPServer from RangeHTTPServer import RangeRequestHandler cl...
__init__.py
import json import os import base64 import hashlib import hmac import requests from threading import Thread import logging import datetime as dt import re from datetime import timedelta import azure.functions as func sentinel_customer_id = os.environ.get('WorkspaceID') sentinel_shared_key = os.environ.get('Workspace...
torrouterd.py
# daemon for tor routers to report network info to the pathing server import sys import uuid import time import threading import struct import socket from SocketServer import TCPServer, BaseRequestHandler from Crypt import Crypt from shared import * CONN_KEY = Crypt().generate_key() def append_current_time(payload,...
20_mnist_ddp.py
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modificatio...
datareaders.py
# -*- coding: utf-8 -*- """ © Michael Widrich, Markus Hofmarcher, 2017 Template and parent classes for creating reader/loader classes for datasets """ import inspect import threading import time from collections import OrderedDict, namedtuple from os import path from typing import Union import numpy as np import pa...
nose_tests_runner.py
# # PS Move API - An interface for the PS Move Motion Controller # Copyright (c) 2012 Thomas Perl <m@thp.io> # 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 co...
xla_client_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
script.py
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2020-2021 Alibaba Group Holding 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 # # http://www.apache.org/licenses/LI...
util.py
import binascii import collections import struct import sys from threading import Thread, Event import six from kafka.common import BufferUnderflowError def crc32(data): return binascii.crc32(data) & 0xffffffff def write_int_string(s): if s is not None and not isinstance(s, six.binary_type): raise...
xmlrpc_server.py
#!/usr/bin/env python from __future__ import print_function import os import sys from time import time, sleep import signal import socket from threading import Thread, Timer from six.moves.xmlrpc_server import SimpleXMLRPCServer from six.moves.xmlrpc_client import ServerProxy from larch import Interpreter, InputText ...
cli_api_run_launcher.py
import os import threading import time from dagster import check from dagster.api.execute_run import cli_api_execute_run from dagster.core.host_representation import ExternalPipeline from dagster.core.instance import DagsterInstance from dagster.core.storage.pipeline_run import PipelineRun from dagster.serdes import C...
fake_bundle_server.py
import sys from os.path import join as p from os import mkdir, listdir, chdir, walk import tarfile import logging from multiprocessing import Process from http.server import HTTPServer, SimpleHTTPRequestHandler import json import requests from owmeta_core import connect, BASE_SCHEMA_URL, BASE_CONTEXT from owmeta_core...
test_util.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
helper.py
import functools import json import multiprocessing import os import socket import subprocess from datetime import datetime from typing import List, Tuple import base58 import dateutil.tz from plenum.bls.bls_crypto_factory import create_default_bls_crypto_factory from plenum.test.node_catchup.helper import waitNodeDat...
kv.py
# -*- coding: utf-8 -*- import logging from app.utils import parse_redis_url from app import load_app_config from redis import StrictRedis import json import itertools import threading from app.faulty_client import ( FaultyClient, empty_list, ) logger = logging.getLogger(__name__) kv_manager = None def crea...
vep_transcript_etl.py
"""VEP Transcript ETL.""" import logging import multiprocessing import uuid import re from etl import ETL from files import TXTFile from transactors import CSVTransactor from transactors import Neo4jTransactor class VEPTranscriptETL(ETL): """VEP Transcript ETL.""" logger = logging.getLogger(__name__) ...
model_2_03_code.py
import tensorflow as tf from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten from tensorflow.keras.optimizers import Adam from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.callbacks import Callback import numpy as np import matplotlib.pyplot as plt f...
blurImageAppNumpy.pyw
#!/usr/bin/env python3 import blurImageNumpy import os try: import tkinter as tk from tkinter import filedialog from tkinter import ttk except ImportError: import Tkinter as tk import ttk import Filedialog as filedialog from PIL import ImageTk, Image import threading from queue import Queue FI...
build_mscoco_data.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
negmas_test.py
import datetime from multiprocessing import Process from matplotlib import pyplot as plt from negmas.apps.scml import GreedyFactoryManager, SCMLWorld from negmas.apps.scml.utils import anac2019_tournament from negmas.tournaments import TournamentResults, WorldRunResults, tournament from negmas.utilities import LinearU...
multi_process_runner.py
# Lint as: python3 # 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 ...
plugin.py
from binascii import hexlify, unhexlify from electrum_zclassic.util import bfh, bh2u from electrum_zclassic.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, TYPE_ADDRESS, TYPE_SCRIPT) from electrum_zclassic import constants from electrum_zclassic.i18n import _ from electrum...
pentestlib.py
# -*- coding: utf-8 -*- import numpy as np import sqlite3 import mss from pynput.keyboard import Key, Listener, Controller import requests import urllib2 from Crypto.Cipher import AES import mechanize from itertools import product #from scapy.layers.dot11 import Dot11, RadioTap import sendkeys from pygame i...
config_manager.py
# Copyright 2019, Optimizely # 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, softwar...
local_pc.py
import websocket import json from .commands import available_cmds from urllib.parse import urlparse import threading import requests from os import getcwd from hashlib import sha256 class LocalPc: def __init__(self, username, password, key, remoteServer, initialDir=None): self.remoteServer = remoteServer...
framework.py
#!/usr/bin/env python3 from __future__ import print_function import logging import sys import os import select import signal import subprocess import unittest import re import time import faulthandler import random import copy import platform import shutil from collections import deque from threading import Thread, Ev...
workserver.py
# workserver.py - simple HTTP server with a do_work / stop_work API # GET /do_work activates a worker thread which uses CPU # GET /stop_work signals worker thread to stop import math import socket import threading import time from bottle import route, run hostname = socket.gethostname() hostport = 9000 keepworking = ...
test_session.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2021 Alibaba Group Holding 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-...
server.py
#!/usr/bin/env python from contextlib import contextmanager import json from multiprocessing import Process import SimpleHTTPServer import SocketServer import random port = random.randint(8777, 8888) class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): self.send_response(200...
recipe-475217.py
from os.path import basename from queue import Queue from random import random, seed from sys import argv, exit from threading import Thread from time import sleep ################################################################################ class Widget: pass class Stack: def __init__(self): self...
2.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile from bs4 import BeautifulSoup from urllib import urlopen fr...
emails.py
from threading import Thread from flask import current_app, render_template from flask_mail import Message from albumy.extensions import mail def _send_async_mail(app, message): with app.app_context(): mail.send(message) def send_mail(to, subject, template, **kwargs): message = Message(current_app...
test_integration_basics.py
"""Tests Nighthawk's basic functionality.""" import json import logging import math import os import pytest import subprocess import sys import time from threading import Thread from test.integration.common import IpVersion from test.integration.integration_test_fixtures import ( http_test_server_fixture, https_t...
test_subprocess.py
import unittest from test import script_helper from test import support import subprocess import sys import signal import io import locale import os import errno import tempfile import time import re import sysconfig import warnings import select import shutil import gc import textwrap try: import threading except...
webhook_server.py
import argparse import json import logging import os from datetime import datetime from threading import Thread from flask import Flask, request API = Flask(__name__) ADDRESS = None PORT = None LOG = None DEBUG = None class HooksCLI: def __init__(self): """Initialize the CLI self.""" parser = ar...
conftest.py
# stdlib import logging from multiprocessing import Process import socket from time import time from typing import Any as TypeAny from typing import Dict as TypeDict from typing import Generator from typing import List as TypeList # third party import _pytest import pytest # syft absolute import syft as sy from syft ...
integrationTest_canTp.py
#!/usr/bin/env python __author__ = "Richard Clubb" __copyrights__ = "Copyright 2018, the python-uds project" __credits__ = ["Richard Clubb"] __license__ = "MIT" __maintainer__ = "Richard Clubb" __email__ = "richard.clubb@embeduk.com" __status__ = "Development" from threading import Thread from uds import CanTp from...
stream_live_pp.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Jan 12 11:11:58 2018 @author: chrelli """ #%% Import the nescessary stuff import sys sys.path.append(r'/usr/local/lib') import pyrealsense2 as rs import numpy as np import cv2 import json import time, os, shutil import matplotlib.pyplot as plt im...
test_functools.py
import abc import builtins import collections import collections.abc import copy from itertools import permutations import pickle from random import choice import sys from test import support import threading import time import typing import unittest import unittest.mock import os import weakref import gc from weakref ...
ws.py
#!/usr/bin/env python3 # requires https://pypi.python.org/pypi/websocket-client/ from excepthook import uncaught_exception, install_thread_excepthook import sys sys.excepthook = uncaught_exception install_thread_excepthook() # !! Important! Be careful when adding code/imports before this point. # Our except hook is i...
p2.py
from multiprocessing import Process numbers = [3, 4, 5, 6, 7, 8] def cube(x): for x in numbers: print('%s cube is %s' % (x, x**3)) def evenno(x): for x in numbers: if x % 2 == 0: print('%s is an even number ' % (x)) if __name__ == '__main__': ...
notebookapp.py
# coding: utf-8 """A tornado based IPython notebook server. Authors: * Brian Granger """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPY...
exchange_rate.py
from datetime import datetime import inspect import requests import sys from threading import Thread import time import traceback import csv from decimal import Decimal from bitcoin import COIN from i18n import _ from util import PrintError, ThreadJob from util import format_satoshis # See https://en.wikipedia.org/w...
king_of_the_hill.py
import time import logging from threading import Thread, Event, Lock from . import module from .. import map from .. import events logger = logging.getLogger(__name__) class KOTH(module.MapModule): # TODO Rethinking the way Games/Modules/threads inheritance here might work # I think now these can become i...
linkcheck.py
# -*- coding: utf-8 -*- """ sphinx.builders.linkcheck ~~~~~~~~~~~~~~~~~~~~~~~~~ The CheckExternalLinksBuilder class. :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import codecs import re import socket import threading from os import p...
http_server.py
# -*- coding:utf-8 -*- # @project: GPT2-NewsTitle # @filename: http_server.py # @author: 刘聪NLP # @contact: logcongcong@gmail.com # @time: 2020/12/19 20:49 """ ### http_server 语音合成简易界面。 构建简单的语音合成网页服务。 + 简单使用 ```python from ttskit import http_server http_server.start_sever() # 打开网页:http://localhost:9000/ttskit ``` + 命...
test_threading_local.py
import unittest from doctest import DocTestSuite from test import test_support as support import weakref import gc # Modules under test _thread = support.import_module('thread') threading = support.import_module('threading') import _threading_local class Weak(object): pass def target(local, weakl...
test_wsgi.py
import requests import threading from unittest import TestCase from wsgiref.simple_server import demo_app, make_server, WSGIRequestHandler from metrology import Metrology from metrology.wsgi import Middleware class SilentWSGIHandler(WSGIRequestHandler): def log_message(*args): pass class TestServer(ob...
48_5_multithread_queue.py
"""用于多线程的队列之Queue""" """ 为了在多线程中应用队列这种数据结构,标准库模块queue中提供了三个类对象: (1)Queue 与模块multiprocessing中的JoinableQueue几乎是相同的,其特点也是"先进先出"。 (2)LifoQueue 特点是Lifo(Last in first out,后进先出),也就是说,入队和出队都是在队尾。 后进先出的队列其实就是栈。 (3)PriorityQueue 队列中的每个对象都有优先级。出队时选择优先级最小的对象。 这三种队列的区别仅仅在于它们出队的顺序。 这三种队列都是多线程安全...
__init__.py
import os from flask import Flask from datetime import datetime from multiprocessing import Process import webbrowser from . import trends, overview, category, settings from .bkapp.bkapp_server import BokehServer from .gnucash.gnucash_db_parser import GnuCashDBParser def create_app(test_config=None): # app facto...
executor.py
import time import signal from threading import Thread class Executor: def __init__(self): self.exiting = False self.atomic = False signal.signal(signal.SIGINT, self._exit) signal.signal(signal.SIGTERM, self._exit) def _exit(self, signum, frame): self.exiting = True def begin_atomic(self)...
learn_event.py
import logging import threading import time logging.basicConfig( level=logging.DEBUG, format='%(threadName)s: %(message)s' ) def worker1(event): event.wait() # event.set() を待つ logging.debug('start') time.sleep(3) logging.debug('end') def worker2(event): event.wait() # event.set() を待つ...
anitraintools.py
import hdnntools as hdt import pyanitools as pyt import pyNeuroChem as pync from pyNeuroChem import cachegenerator as cg import numpy as np from scipy.integrate import quad import pandas as pd from time import sleep import subprocess import random import re import os from multiprocessing import Process import shut...
__init__.py
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2014 Vinay M. Sajip. See LICENSE for licensing information. # # sarge: Subprocess Allegedly Rewards Good Encapsulation :-) # import errno from io import BytesIO import logging import os try: import queue except ImportError: # pragma: no cover import Queue as queu...
crawler.py
import os import ujson from urllib.parse import urlparse, urljoin from threading import Thread from queue import Queue, Empty from crawl_server import logger from pybloom_live import ScalableBloomFilter class TooManyConnectionsError(Exception): pass class File: __slots__ = "name", "size", "mtime", "path", "...
__init__.py
from service import MiningService from subscription import MiningSubscription from twisted.internet import defer from twisted.internet.error import ConnectionRefusedError import time import simplejson as json from twisted.internet import reactor import threading from miningpool.mining.work_log_pruner import WorkLogPrun...
launcher.py
import asyncio import logging import multiprocessing import os import signal import sys import time import requests from discord import AllowedMentions, Intents, RequestsWebhookAdapter, Webhook from dotenv import load_dotenv import config import ipc from app.cache import Cache from app.classes.bot import Bot from app...
worker.py
from threading import Thread from queue import Queue import numpy as np from run_dqn import DQNAgent class Worker: def __init__(self, worker_id, env, agent): self._id = worker_id self._env = env self._agent = agent self._state = env.reset() self._transition_buffer = [] ...
multiprocessing_sharedctypes.py
""" "Multiprocessing" section example showing how to use sharedctypes submodule to share data between multiple processes. """ from multiprocessing import Process, Value, Array def f(n, a): n.value = 3.1415927 for i in range(len(a)): a[i] = -a[i] if __name__ == '__main__': num = Value('d', 0.0) ...
util.py
import hashlib import http.server import json import logging import os import platform import re import shutil import socketserver import stat import subprocess import tarfile import tempfile from contextlib import contextmanager, ExitStack from itertools import chain from multiprocessing import Process from shutil imp...
yamicache.py
#!/usr/bin/env python # coding: utf-8 """ yamicache : Yet another in-memory cache module ('yami' sounds better to me than 'yaim') This module provides a simple in-memory interface for caching results from function calls. """ # Imports ##################################################################### import json i...
reporter.py
# -*- coding: utf-8 -*- # Adapted from a contribution of Johan Dahlin import collections import errno import re import sys try: import multiprocessing except ImportError: # Python 2.5 multiprocessing = None import pycodestyle as pep8 __all__ = ['multiprocessing', 'BaseQReport', 'QueueReport'] class Bas...
_script_docker_python_loop.py
import os import threading import sys import json import traceback if sys.version_info[0] < 3: import Queue as queue else: import queue __read_thread = None __input_queue = None win = sys.platform.startswith('win') if win: __input_queue = queue.Queue() def read_input_loop(): global __input_queue ...
start_pipelined.py
""" Copyright (c) 2018-present, Facebook, Inc. 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. An additional grant of patent rights can be found in the PATENTS file in the same directory. """ import logging import threa...
process.py
import subprocess import threading class Process(): def __init__(self, path, engine): options = {"stdout": subprocess.PIPE, "stdin": subprocess.PIPE, "bufsize": 1, "universal_newlines": True} self.process = subprocess.Popen(path, stdout=subprocess.PIPE, stdin=subprocess.PIPE, bufsize=1) se...
system_tester.py
# What to do: # - Scp the binaries and so to approx. 20 servers # - Let the binaries run through ssh # - After a certain delay --> send all the logs + amount of blocks to the tester's main machine through scp # At the main machine analyze the logs with analyzer.py # bash but should do: ssh user@remote.host nohup py...
imu_server.py
#!/usr/bin/env python """ROS Node to expose a topics for the IMU (LSM9DS1) on the Pi-puck.""" # Base Imports import math from os import path from json import load from threading import Thread # ROS imports import rospy from geometry_msgs.msg import Vector3, Quaternion from sensor_msgs.msg import Imu, Temperature, Mag...
pipeline.py
#Milovision: A camera pose estimation programme # # Milovision: A camera pose estimation programme # # Copyright (C) 2013 Joris Stork # See LICENSE.txt # # pipeline.py """ :synopsis: Contains the Pipeline class. Instantiations are pose estimation pipelines consisting of one or more modules, from contour ...
collect_server_info.py
#!/usr/bin/env python import getopt import sys import os import time from threading import Thread from datetime import datetime import subprocess import platform sys.path = [".", "platform_utils"] + sys.path from testconstants import WIN_COUCHBASE_BIN_PATH_RAW import TestInput from remote.remote_util import RemoteMach...
plotting.py
"""PyVista plotting module.""" import collections.abc import ctypes from functools import wraps import io import logging import os import pathlib import platform import textwrap from threading import Thread import time from typing import Dict import warnings import weakref import numpy as np import scooby import pyvi...
conftest.py
import array import curio import functools import logging import os import pytest import signal import subprocess import sys import threading import time import uuid import trio from types import SimpleNamespace import caproto as ca import caproto.benchmarking # noqa from caproto.sync.client import read import capro...
bmv2.py
# Copyright 2018-present Open Networking 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 a...
pipeline_execute.py
import logging import d3m.runtime import d3m.metadata.base from sqlalchemy.orm import joinedload from d3m.container import Dataset from d3m.metadata import base as metadata_base from d3m_ta2_nyu.workflow import database, convert from multiprocessing import Manager, Process logger = logging.getLogger(__name__) @datab...
gps_ultimate.py
from altitude_measurable import AltitudeMeasurable import serial import threading import adafruit_gps class GPSUltimate(AltitudeMeasurable): """Reads the GPS-Sensor https://www.adafruit.com/product/746 https://learn.adafruit.com/adafruit-ultimate-gps/overview """ def __init__(self): # Cr...
bts2.py
#! /usr/bin/python3 # Module Runner # This is basically burn the subs import settings import sys from threading import Thread from time import sleep from dataBaseClass import Sub, db from placeAndGcode import placeNames, makeGcode from sendGcode import gSend from pubSubListener import ws1_start, pingTwitchServer...
multiprocessing_test2.py
import multiprocessing import time def to_signed(n): return n - ((0x80 & n) << 1) def sender(conn): mouse = open("/dev/input/mice", "rb") while True: status, dx, dy = tuple(c for c in mouse.read(3)) dx = to_signed(dx) dy = to_signed(dy) conn.send("viesti {}, {},{}".format(...
zmq.py
from __future__ import absolute_import, print_function import zmq from itertools import chain from bisect import bisect import socket from operator import add from time import sleep, time from toolz import accumulate, topk, pluck, merge, keymap import uuid from collections import defaultdict from contextlib import con...
whatsappBrowser.py
#!/usr/bin/env python import datetime import math import optparse import os import re import sys import threading import time import webbrowser from collections import namedtuple, OrderedDict from functools import wraps # Py3k compat. if sys.version_info[0] == 3: binary_types = (bytes, bytearray) decode_handl...
telegram_downloader.py
import logging import threading import time from pyrogram import Client from bot import LOGGER, download_dict, download_dict_lock, TELEGRAM_API, \ TELEGRAM_HASH, USER_SESSION_STRING from .download_helper import DownloadHelper from ..status_utils.telegram_download_status import TelegramDownloadStatus global_lock ...
batcher.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # # 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...
launch_server.py
import sys import os import argparse import numpy as np import torch import dgl from dgl import DGLGraph from dgl.contrib.sampling import SamplerPool import dgl.function as fn import multiprocessing import PaGraph.data as data import PaGraph.utils def main(args): coo_adj, feat = data.get_graph_data(args.dataset) ...
server.py
from pythontools.core import logger, events import socket, json, base64, traceback, math from threading import Thread from pythontools.dev import crypthography, dev class Server: def __init__(self, password): self.serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.serverSocket.s...
test_server.py
from stango import Stango from stango.files import Files import functools from threading import Thread from urllib.request import urlopen from urllib.error import HTTPError from . import StangoTestCase, make_suite, view_value, view_template class ServerTestCase(StangoTestCase): def setup(self): self.mana...
framework.py
#!/usr/bin/env python3 from __future__ import print_function import gc import sys import os import select import signal import unittest import tempfile import time import faulthandler import random import copy import psutil import platform from collections import deque from threading import Thread, Event from inspect ...
run_set.py
"""Run a collection of configurations for the test harness. Run a collection of configurations for the test harness which are represented as a JSON file file with a configs key whose json array value contains individual configurations to be executed. It expects JSON like: { "configs": [ { "name":...
spin.py
# -*- coding=utf-8 -*- import functools import os import signal import sys import threading import time import colorama import cursor import six from .compat import to_native_string from .termcolors import COLOR_MAP, COLORS, colored, DISABLE_COLORS from io import StringIO try: import yaspin except ImportError: ...
ReviewMLLoop.py
from threading import Thread from sqlalchemy import and_ from SmartAnno.utils.ConfigReader import ConfigReader from SmartAnno.db.ORMs import Annotation, Document from SmartAnno.gui.Workflow import Step, logMsg from SmartAnno.models.BaseClassifier import NotTrained, ReadyTrained from SmartAnno.models.logistic.Logistic...
rest.py
#!/usr/bin/python # -*- coding: utf-8 -*- """REST Actor. """ import json # Python-native imports import logging.config import threading from http.server import BaseHTTPRequestHandler # Third-party imports import pykka # App imports from pyCrow.crowlib.aux import Action from pyCrow.crowlib.http import Server L = lo...
app.py
from flask import Flask from redis import Redis from docker import APIClient import threading import socket import json app = Flask(__name__) redis = Redis(host='redis', port=6379) client = APIClient(base_url='unix://var/run/docker.sock') def EventCollector(): redis.set('event_log', '') for event in client.e...
picamera2.py
#!/usr/bin/python2.7 # # Copyright (C) 2016 by meigrafd (meiraspi@gmail.com) published under the MIT License # v1.0 # # display picamera stream on pygame. pygame picamera lowest streaming latency # # http://www.pyimagesearch.com/2015/12/28/increasing-raspberry-pi-fps-with-python-and-opencv/ # https://www.snip2code.com/...
org_manager.py
# org_manager.py __version__ = "0.0.1" import argparse import json import logging import os import sys import threading import traceback from . import sfdx_cli_utils as sfdx # Config # TGREEN = "\033[1;32m" TRED = "\033[1;31m" ENDC = "\033[m" # # # Set the Log level # logging.basicConfig( level=logging.ERROR, f...
process_worker.py
# coding=utf-8 import multiprocessing import serial import socket import os import fuckargs # 串口通讯 # 频率的决定者以硬件的串口通讯频率决定 def get_serial_info( distance, usb, bits ): os.system( "echo %d >>pid_repo" % os.getpid() ) # store the pid ser = serial.Serial( usb, bits ) while True: line = ser.readline()[:-1...
ZMQcomms.py
import zmq from threading import Lock, Thread from time import sleep, time import traceback import socket import pickle def get_localhost_ip(): # Get local IP address s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) address = s.getsockname()[0] s.close() return ...
agent.py
#!/usr/bin/python # Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
ipy.py
############################################################################# # Copyright (c) Wolf Vollprecht, QuantStack # # # # Distributed under the terms of the BSD 3-Clause License. # # ...
ActuatorController.py
import threading import socket import time import DBManager BUFFSIZE = 4096 frontstr = "AC >> " class ActuatorController(threading.Thread): def __init__(self, dbmanager = DBManager.DBManager(), server_host='localhost', actuator_manager_port=11202): threading.Thread.__init__(self) self.dbm = dbma...
db_tests.py
from itertools import permutations try: from Queue import Queue except ImportError: from queue import Queue import re import threading from peewee import * from peewee import Database from peewee import FIELD from peewee import attrdict from peewee import sort_models from .base import BaseTestCase from .base ...