source
stringlengths
3
86
python
stringlengths
75
1.04M
lambda_executors.py
import os import re import json import time import logging import threading import subprocess # from datetime import datetime from multiprocessing import Process, Queue try: from shlex import quote as cmd_quote except ImportError: # for Python 2.7 from pipes import quote as cmd_quote from localstack import ...
proxy_wrapper_nowait.py
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
test_pool.py
""" Copyright 2012 Basho Technologies, Inc. This file is provided to you 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...
test_server.py
{%- if cookiecutter.copyright != "None" -%} # Copyright (c) {% now "utc", '%Y' %}, {{ cookiecutter.copyright }}. Unauthorised use, distribution or duplication is prohibited {% endif %} import json import multiprocessing import random import requests from src.server import create_app class TestServer: def setup...
test_sync.py
import os from unittest import mock import threading from sync import get_settings_from_env, server_factory import json import pytest import requests # Data sets passed to server DATA_INCORRECT_CHILDREN = { "parent": { "metadata": { "labels": { "pipelines.kubeflow.org/enabled":...
base.py
# -*- coding: utf-8 -*- # BSD 3-Clause License # # Copyright (c) 2019, Elasticsearch BV # 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 ...
script.py
from __future__ import absolute_import import os, traceback, threading, shlex from . import controller class ScriptError(Exception): pass class ScriptContext: def __init__(self, master): self._master = master def log(self, message, level="info"): """ Logs an event. ...
eea_runtime_wasmer.py
# # This module contains an example wasmer runtime # https://github.com/wasmerio/wasmer-python # import json import os import threading import time import eea_api import eea_utils import eea_registered_functions from wasmer import engine, Store, ImportObject, Function, Module, Instance, Memory, MemoryType from wasme...
mp.py
## this is mp.py from mpwn, a single file framework which lives at: ## https://github.com/lunxbochs/mpwn # ######### # # Copyright (c) 2019 Ryan Hileman # # 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 ...
an2linuxserver.py
#!/usr/bin/env python3 # # Copyright 2017 rootkiwi # # AN2Linux-server is licensed under GNU General Public License 3, with the additional # special exception to link portions of this program with the OpenSSL library. # # See LICENSE for more details. import logging import sys try: import ssl except ImportError as...
env.py
############################################################################## # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, ...
testing.py
import bz2 from collections import Counter from contextlib import contextmanager from datetime import datetime from functools import wraps import gzip import os from shutil import rmtree import string import tempfile from typing import Union, cast import warnings import zipfile import numpy as np from numpy.random imp...
PySight3.py
!/usr/bin/env python # -*- coding: utf-8 -*- #douglas molina """ Created on Sep 20, 2016 Modified: May 2020 @author: deralexxx Script to pull iocs from iSight and push them to MISP Modified by: Douglas Molina Alexander Jaeger See CHANGELOG.md for history """ import datetime import email.utils import hashlib import hm...
email.py
from flask_mail import Message, Mail from flask import render_template from threading import Thread from app import mail from manage import app def send_email(to,subject,template,**kwargs): msg = Message(app.config['FLASK_BMS_EMAIL_PREFIX']+subject, sender=app.config['FLASK_BMS_EMAIL_SENDER'], reci...
mpi_master.py
from mpi4py import MPI import sys import logging import numpy as np import zmq import time from epics import caput from threading import Thread, Lock from enum import Enum from collections import deque f = '%(asctime)s - %(levelname)s - %(filename)s:%(funcName)s - %(message)s' logging.basicConfig(level=logging.DEBUG, ...
example_test.py
import http.server import multiprocessing import os import random import re import socket import ssl import struct import subprocess import ttfw_idf from RangeHTTPServer import RangeRequestHandler from tiny_test_fw import DUT, Utility server_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'test_certs/...
linkcheck.py
""" sphinx.builders.linkcheck ~~~~~~~~~~~~~~~~~~~~~~~~~ The CheckExternalLinksBuilder class. :copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import queue import re import socket import threading from html.parser import HTMLParser from o...
thread_bg_simple1.py
import threading import time def func_thread(): time.sleep(3) print("this thread is called %s)" % threading.current_thread().name) print("the main thread is called %s" % threading.main_thread().name) child = threading.Thread(target=func_thread, daemon=True) child.start()
camera.py
"""Camera Reachy module. This module lets you access always up-to-date image from the camera. The synchronisation is done in background and only started when you need it. """ from enum import Enum from typing import Optional import cv2 as cv from google.protobuf.empty_pb2 import Empty from google.protobuf.wrappers_pb...
main.py
#!/usr/bin/env python3 # Copyright 2016-2019 Christoph Reiter # # 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 the rights to use, copy, mo...
demo.py
# deltix TimeBase client import dxapi from dxapi import InstrumentMessage, InstrumentType, InstrumentIdentity # FINOS Perspective import perspective from perspective import Table # OrderBook from orderbook import Book, to_dict # Other libs import threading import asyncio from datetime import datetime import time fro...
test_debug.py
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
ex6.py
#!/usr/bin/env python ''' Use threads and Netmiko to connect to each of the devices in the database. Execute 'show version' on each device. Record the amount of time required to do this. DISCLAIMER NOTE: Solution is limited to the exercise's scope ''' from net_system.models import NetworkDevice import django import th...
HTTPControl.py
import jinja2 import json import logging import math import mimetypes import os import pathlib from http.server import HTTPServer, BaseHTTPRequestHandler from socketserver import ThreadingMixIn from datetime import datetime, timedelta import re import subprocess import sys import threading import time import urllib.par...
aji2.py
# -*- coding: utf-8 -*- import KRIS from KRIS.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 import r...
hello_world_executor.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 # "L...
codec.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...
selection.py
#!/usr/bin/env python """Selection procedures (local and global)""" import numpy as np import multiprocessing as mp import time import random import anneal import itertools from multiprocessing import pool, Process # Redundant? import simulate_data as sim import summary_stats as sum_stat import estimators as estim i...
test_xmlrpc.py
import base64 import datetime import decimal import sys import time import unittest from unittest import mock import xmlrpc.client as xmlrpclib import xmlrpc.server import http.client import http, http.server import socket import threading import re import io import contextlib from test import support try: import ...
test_util_test.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
manager.py
#!/usr/bin/env python3 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from typing import Dict, List from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR, PARAMS from common.android im...
emails.py
# -*- coding: utf-8 -*- """ :author: Grey Li (李辉) :url: http://greyli.com :copyright: © 2018 Grey Li <withlihui@gmail.com> :license: MIT, see LICENSE for more details. """ from threading import Thread from flask import url_for, current_app from flask_mail import Message from bluelog.extensions import ...
tests.py
#! /usr/bin/env python3 import hashlib import http.server import os import shutil import subprocess import sys import tempfile import threading import unittest @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") class WrapperScriptTests(unittest.TestCase): http_port = 8080 def setUp(sel...
arrow_dataset_ops.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...
stun_client.py
import socket import sys import traceback import struct import threading; from threading import Thread; import time; import datetime; import json #import buffered_message; import hashlib from Crypto.PublicKey import RSA from connection_state import ConnectionState # publickey = RSA.importKey(key_string) import tcp; im...
nweb_agent.py
#!/usr/bin/python3 import sys import requests import subprocess import time import os import random import string import json import base64 import threading import multiprocessing import multiprocessing.pool # my script for headshotting servers from getheadshot import getheadshot from config import Config from sys i...
Matrix_Work_Queue.py
#!/usr/bin/python import os import sys import zmq import numpy as np from mpi4py import MPI from multiprocessing import Process, Value # Procedure executed by the control process def control_dispatch(port, persist, progress, last_line): context = zmq.Context() socket = context.socket(zmq.REP) socket.bind("tcp...
core.py
import sys from itertools import chain, combinations, permutations import json from profil3r.modules.email import email from profil3r.modules.social import facebook, twitter, tiktok, instagram from profil3r.modules.porn import onlyfans from profil3r.colors import Colors import threading import json import os result = ...
test_perf_grpcio.py
# from gevent import monkey # monkey.patch_all() # # import grpc._cython.cygrpc # grpc._cython.cygrpc.init_grpc_gevent() import time import anyio import sys import argparse import functools from queue import Queue import multiprocessing import grpc from generated.greeter_pb2 import HelloRequest, HelloReply from g...
tests.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...
utils.py
"""Utilities shared by tests.""" import collections import contextlib import io import logging import os import re import selectors import socket import socketserver import sys import tempfile import threading import time import unittest import weakref from unittest import mock from http.server import HTTPServer fro...
simu.py
# create list for 1000 peers # read the .csv and assign msgId's to the peers with %1000 # somehow create a unique trader.py for every peer. # somehow pass the assigned messages to the right trader.py import csv from udpsend import create_peer from twisted.internet import reactor import threading PEER_AMOUNT = 100 allo...
bundle_manager.py
import copy import datetime import logging import os import random import re import shutil import sys import tempfile import threading import time import traceback from apache_beam.io.filesystems import FileSystems from collections import defaultdict from typing import List from codalab.objects.permission import ( ...
js.py
import json from IPython.display import display, HTML from flask_cors import CORS, cross_origin import dis_into_json import os from flask import Flask, request import threading import logging import ulid ############################################################################## # jupyter notebook tricks def quiet...
publisher.py
import errno import hashlib import os import posixpath import select import shutil import subprocess import tempfile import threading from contextlib import contextmanager from ftplib import Error as FTPError from werkzeug import urls from lektor._compat import (iteritems, iterkeys, range_type, string_types, text...
__init__.py
import multiprocessing as mp import queue as Queue_ from threading import Thread import _multiprocessing as _mp import weakref class Queue(): def __init__(self, maxsize=0, debug=False): if maxsize <= 0: # same as mp.Queue maxsize = _mp.SemLock.SEM_VALUE_MAX self.mpq = mp.Qu...
utility.py
import os import math import time import datetime from multiprocessing import Process from multiprocessing import Queue import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import imageio import torch import torch.optim as optim import torch.optim.lr_scheduler as lrs import torc...
C1.py
import socket import threading import sys import pickle class Cliente(): """docstring for Cliente""" def __init__(self, host="localhost", port=8991): self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((str(host), int(port))) ...
spydf.pyw
from tkinter import * from tkinter.filedialog import askdirectory import spydf_gui import threading import config import importlib import sys def main(): def update(text): status.set(text) def set_path(): path = askdirectory() with open ("spydf_path.txt", "w") as file: fi...
bot_jira_di_schedule.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # -*- encoding: utf-8 -*- # # Copyright (c) 2020 anqi.huang@outlook.com # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
test_tracer.py
from __future__ import print_function import functools import os import platform import sys import threading from pprint import pprint import pytest import hunter from hunter import And from hunter import Backlog from hunter import CallPrinter from hunter import CodePrinter from hunter import Debugger from hunter im...
flask_server.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Staying alive." def run(): app.run(host='0.0.0.0', port=8080) def keep_alive(): t = Thread(target=run) t.start()
app_utils.py
# From http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/ import struct import six import collections import cv2 import datetime import subprocess as sp import json import numpy import time from threading import Thread from matplotlib import colors class FPS: def ...
test_airflow_job.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
custom.py
# pylint: disable=too-many-lines # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------...
gui.py
from tkinter import * from tkinter import ttk import ctypes import requests import time import os import sys from requests.models import Response import winshell import zipfile import threading import pythoncom from guimodules import * from globalmodules import * # don't open a console window ctypes.windll.kernel32.Se...
app.py
#!/usr/bin/env python import gzip_middleware import bottle as b import subprocess import threading import functools import setup_db import datetime import binascii import sqlite3 import hashlib import pbkdf2 import time import os import conf #copied from sqlite3/dbapi2.py def convert_timestamp(val): datepart, ti...
speech_recognize.py
import queue import threading import time import speech_recognition as sr import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '../common')) from interface_struct import ListeningData def main(q): print("[[VOICE RECOGNITION]]", "speech recognition start.") r = sr.Recognizer() mic ...
PySight.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Sep 20, 2016 @author: deralexxx Script to pull iocs from iSight and push them to MISP Alexander Jaeger See CHANGELOG.md for history """ import _thread import datetime import email.utils import hashlib import hmac import json import os from pymisp import...
jobs.py
# -*- coding: utf-8 -*- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the #...
syncer.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, unicode_literals import contextlib import datetime import os import sys import time import unicodedata import dropbox import time import shutil import threading sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__fil...
PyShell.py
#! /usr/bin/env python3 import getopt import os import os.path import re import socket import subprocess import sys import threading import time import tokenize import traceback import types import linecache from code import InteractiveInterpreter try: from tkinter import * except ImportError: print("** IDLE...
openevse.py
# The MIT License (MIT) # # Copyright (c) 2015-2017 Sebastien Maccagnoni <sebastien@maccagnoni.eu> # # 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 lim...
OF_BS_circle.py
import cv2 from tkinter import Tk from tkinter.filedialog import askopenfilename import numpy as np import imutils import threading def main(): cap = cv2.VideoCapture(vid_path) status1, previous_frame = cap.read() total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) copy_frame = cv2.cvtColor...
test_statemachine.py
import unittest import time, threading, random, functools if __name__ == '__main__': import sys, os sys.path.insert(0, os.getcwd()) import sleekxmpp.xmlstream.statemachine as sm class testStateMachine(unittest.TestCase): def setUp(self): pass def testDefaults(self): "Test ensure transitions occur correc...
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...
RL.py
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import math import numpy as np from numba import njit import layers from optimizer import LaProp from multiprocessing.sharedctypes import Value, RawValue, RawArray import multiprocessing as mp import time, random from termcol...
util.py
# # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try:...
networkBuff-server-rw.py
import zmq, time, sys import syslog, threading import socket, select, sys import syslog, subprocess from collections import deque psocket=None ssocket=None s=None NETWORK_THRESHOLD_MAX=2048 IsConnected=False; connection=None data=deque([]) bufferqlen=0 MAXBUFFLEN=0 def check_ip(ip_addr): oct = ip_addr.split('.',3...
app.py
from tkinter import * from tkinter.ttk import Notebook,Progressbar,Combobox import threading import time from tkinter import filedialog import tkinter.messagebox import pandas as pd class Excel_2_Converting: def __init__(self,root): self.root=root self.root.title("Excel to Csv Convertion")...
param_tree.py
import argparse import logging import queue import threading import time import sys import yaml import uavcan from PyQt5.QtGui import QFont from PyQt5.QtWidgets import QApplication, QPushButton, QVBoxLayout, QWidget from ..network.NodeStatusMonitor import NodeStatusMonitor from ..network.ParameterTree import Paramete...
ossh_server.py
from threading import Thread import socket import json from jnpr.junos import Device from jnpr.junos.exception import ConnectError from junospyez_ossh_server.log import logger __all__ = ['OutboundSSHServer'] def gather_basic_facts(device): """ Using the provide Junos Device object, retrieve basic facts abou...
gpiocontroller.py
from random import randint from threading import Thread import time import RPi.GPIO as GPIO MODUS_MANUELL = 0 MODUS_AUTOMATIK = 1 MODUS_BREMSASSISTENT = 2 stepCounter = 0 modus = MODUS_MANUELL phase = 0 distanceSensorResult = {19:10000, 21:10000, 23:10000} distanceSensorLastCheckTime = {19:0, 21:0, 23:0} class GPIO...
main.py
import asyncio import datetime import signal import sys import traceback import discord import os import weeb import pymysql as mysql from discord.ext import commands import config import random import aiohttp from cogs.utils.db import get_all_prefixes, get_blacklist from cogs.utils.tools import get_prefix class Goda...
data_preprocess.py
# -*- coding: utf-8 -*- """Data_preprocess.ipynb Automatically generated by Colaboratory. # DATA """ import numpy as np import glob import random import struct import csv from tensorflow.core.example import example_pb2 import tensorflow as tf from threading import Thread from queue import Queue import time import ...
ngxtop.py
#!/usr/bin/env python """ngxtop - ad-hoc query for nginx access log. Usage: ngxtop [options] ngxtop [options] (print|top|avg|sum) <var> ... ngxtop info ngxtop [options] query <query> ... Options: -l <file>, --access-log <file> access log file to parse. -f <format>, --log-format <format> log...
hjconnect.py
#!/usr/bin/env python3 """ /start json: "conn": bool "uptime": int "time": int "id": str "timestr": str /status json: "id": str "memtotal": int "memused": int "disktotal": int "diskfree": int "cputemp": "cpuload": "...
main.py
import sys import threading def fibo(n): i = 0 current = 0 previous = 1 for i in range(1, n): temp = current current += previous previous = temp # print(current) print(current) if __name__=="__main__": n = int(sys.argv[1]) # print(arg) # fibo(n) t...
test_stim_client_server.py
import queue import threading import time import pytest from mne.utils import requires_good_network from mne_realtime import StimServer, StimClient _server = None _have_put_in_trigger = False _max_wait = 10. @requires_good_network def test_connection(): """Test TCP/IP connection for StimServer <-> StimClient."...
P2PChat-UI.py
#!/usr/bin/python3 # Student name and No.: Tarun Sudhams, 3035253876 # Student name and No.: Anchit Som, 3035244265 # Development platform: Mac OS X 10.12 and Ubuntu 18.04 LTS for testing # Python version: Python 3.7.2 64-bit # Version: 1.0 from tkinter import * import sys import socket import time impo...
dataservicer.py
from collections import defaultdict import ray import logging import grpc from queue import Queue import sys from typing import Any, Dict, Iterator, TYPE_CHECKING, Union from threading import Event, Lock, Thread import time import ray.core.generated.ray_client_pb2 as ray_client_pb2 import ray.core.generated.ray_clien...
jobManager.py
from __future__ import print_function # # JobManager - Thread that assigns jobs to worker threads # # The job manager thread wakes up every so often, scans the job list # for new unassigned jobs, and tries to assign them. # # Assigning a job will try to get a preallocated VM that is ready, # otherwise will pass 'None' ...
test_apis.py
from athena import ndarray, optimizer from athena import gpu_ops as ad import time, os, sys import yaml import multiprocessing from multiprocessing.sharedctypes import RawArray as rarr import argparse import signal import numpy as np from scipy.stats import truncnorm import ctypes import matplotlib.pyplot as plt nite...
autoscan.py
#importing modules import pytesseract # Wenn tesseract exe nicht im System PATH angegeben, dann: #pytess= r"/home/detleva/.local/bin" from PIL import Image # Wenn poppler/bin nicht im System PATH angegeben, dann: #pdftoppm_path = r"/home/detleva/.local/bin/pdftoppm" import os#, subprocess from pdf2image impo...
test_sync_with_master.py
import os import pika import threading as mt from radical.entk.execman.base import Base_TaskManager as BaseTmgr from radical.entk.execman.base import Base_ResourceManager as BaseRmgr from radical.entk import Task, Stage, Pipeline # ------------------------------------------------------------------...
lisp.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...
input_module_kvstore_to_kvstore.py
# encoding = utf-8 import os import sys import time import datetime from six.moves import range ''' IMPORTANT Edit only the validate_input and collect_events functions. Do not edit any other part in this file. This file is generated only once when creating the modular input. ''' ''' # For advanced us...
clean_vocab.py
""" Helper file to include functions to clean .vocab files from non-alphabtic characters """ import re import ioutils from multiprocessing import Queue, Process from argparse import ArgumentParser EXCLUDE_PATTERN = re.compile('[^A-Za-z]+') VOCAB_FILE = "{year:d}-vocab.pkl" def worker(proc_num, queue, out_dir, i...
ismd.py
#!/usr/bin/env python3 from smd.smdutil import _Error, ConsoleMessage import traceback class MonitorError(_Error): """Monitor exceptions raised by this module.""" def __init__(self, errmsg): self.errmsg = errmsg message = ConsoleMessage(__file__).o class OutputMonitor(): def __init__(self): ...
can_bridge.py
#!/usr/bin/env python3 import os import time import math import atexit import numpy as np import threading import random import cereal.messaging as messaging import argparse from common.params import Params from common.realtime import Ratekeeper from selfdrive.golden.can import can_function, sendcan_function from selfd...
utils.py
import os import subprocess import sys from datetime import datetime, timedelta from pathlib import Path from queue import Queue from subprocess import PIPE, Popen from threading import Thread from typing import Any, Dict, Iterable, List, Optional, Tuple, Union import pydantic from python_on_whales.exceptions import ...
HypeManLite.py
import configparser import socketserver import json import threading import requests import discord import os config = configparser.ConfigParser() config.read('HypeManLite.ini') BOT_ID = config['HYPEMANLITE']['BOT_ID'] PORT = config.getint('HYPEMANLITE', 'PORT') HOST = config['HYPEMANLITE']['HOST'] WEBHOOK = config['...
osr_basic.py
#!/usr/bin/env pytest # -*- coding: utf-8 -*- ############################################################################### # $Id$ # # Project: GDAL/OGR Test Suite # Purpose: Basic tests of OGRSpatialReference (OSR) operation, not including # support for actual reprojection or use of EPSG tables. # Author...
lyr_solid.py
#!/usr/bin/python import pxlBuffer as pxb import random from time import sleep import time def blinkColor(q, led_count, layerNum, wait_ms=1, color="random", runtime=1): layer = pxb.pixelLayer(q, led_count, layerNum) endTime=time.time()+runtime #layer[0:layer.size+1] = color; count = 0 for i in range(layer...
server.py
import gzip import random import socket from abc import ABC from queue import Queue from threading import Thread, Lock from typing import List, Set, Tuple, Dict, Type, Optional from pkg_resources import resource_stream import pyscrabble.protocol as proto from pyscrabble.model import Player, Board, Tile, SquareType w...
test_mainwindow.py
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright © Spyder Project Contributors # # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) # ----------------------------------------------------------------------------- """ Te...
BogoSort.py
from Algorithims import Algorithms import time import threading import random class BogoSort(Algorithms): def __init__(self, data, delay): Algorithms.__init__(self) self.data = data self.delay = delay sorting_thread = threading.Thread(target=self.sort, args=(self.data, self.drawDa...
install.py
from multiprocessing import Process import subprocess import sys import download_binary def main(): config = subprocess.call(['python', 'config.py', '--size=720x350']) if config is 0: download_bin = Process(target = download_binary.main) download_bin.start() download = subprocess.call...
blueberry_client.py
""" Bluetooth client for android phones """ from jnius import autoclass from Queue import Queue import threading class BlueberryClient(object): def __init__(self): self.BluetoothAdapter = autoclass('android.bluetooth.BluetoothAdapter') self.BluetoothDevice = autoclass('android.bluetooth.Bluetoo...
0_1_threading_methods.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Time : 2021-4-06 @Author : EvilRecluse @Contact : https://github.com/RecluseXU @Desc : threading模块的各种函数 ''' # here put the import lib import threading import time def helloworld(): for i in range(5): print('Sleep x {}'.format(i)) ...