source
stringlengths
3
86
python
stringlengths
75
1.04M
PacketForwarderCollector.py
# LoRaWAN Security Framework - GenericMqttCollector # Copyright (c) 2019 IOActive Inc. All rights reserved. import sys,argparse, datetime, json, os, re, time,logging, threading, socket, traceback import auditing.datacollectors.utils.PhyParser as phy_parser from auditing.datacollectors.utils.PacketPersistence import ...
ui_code.py
# Copyright (C) 2022 Louis Vottero louis.vot@gmail.com All rights reserved. from __future__ import absolute_import import subprocess import re import threading from .. import qt_ui, qt from .. import util_file from .. import util from . import ui_data from . import process in_maya = False if u...
context.py
""" Overview: Utilities for building context variables on thread level. This is useful when implementing a with-block-based syntax. For example: >>> from contextlib import contextmanager >>> from hbutils.reflection import context >>> >>> # developer's view ... @cont...
tello.py
# coding=utf-8 import cv2 import time import socket import logging import threading from threading import Thread from drone.djitellopy.decorators import accepts class Tello: """Python wrapper to interact with the Ryze Tello drone using the official Tello api. Tello API documentation: https://dl-cdn.ryzero...
multiple_dag_devices.py
import sys import os sys.path.append(os.getcwd()) import pyschedcl as fw import logging import argparse import json #import sys import time import datetime #import plotly.plotly as py from os import listdir from os.path import isfile, join import matplotlib.pyplot as plt import networkx as nx import csv import random i...
email.py
from threading import Thread from apps.exts import mail from flask_mail import Message from flask import current_app, render_template def async_send_mail(app,msg): with app.app_context(): mail.send(message=msg) # 封装函数 实现邮件发送 def send_mail(to,subject,template,**kwargs): # 获取当前的实例 app = current...
master.py
# run queue, e.g. start / shutdown / balance import zmq import threading import time import sys import os from threading import Thread from Queue import Queue from apscheduler.scheduler import Scheduler POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), ...
clean.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 sys import exit from .initialize import Initialize from ..libraries.tools import save_setting from ..libraries.thread...
vpp_papi.py
#!/usr/bin/env python # # Copyright (c) 2016 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
video.py
#!/usr/bin/python3 # part of https://github.com/WolfgangFahl/play-chess-with-a-webcam import cv2 import numpy as np import math from time import strftime from pcwawc.environment import Environment from pcwawc.fpscheck import FPSCheck from imutils import perspective import argparse from threading import Thread import os...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The Gthpcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test gthpcoind shutdown.""" from test_framework.test_framework import GthpcoinTestFramework from test_fram...
road_speed_limiter.py
import json import select import threading import time import socket import fcntl import struct from threading import Thread from cereal import messaging from common.params import Params from common.numpy_fast import interp, clip from common.realtime import sec_since_boot from selfdrive.config import Conversions as CV ...
train.py
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
main_window.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2012 thomasv@gitorious # # 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 witho...
alert_saq.py
#!/usr/bin/env python3 # vim: ts=3:sw=3:et import os import sys import traceback import re import csv import time import logging import logging.config import argparse import datetime import configparser import threading import smtplib from saq.constants import * from saq.client import Alert import csv from splunklib ...
animate.py
import shutil import sys from contextlib import contextmanager from threading import Event, Thread from typing import Generator, List from pipx.constants import WINDOWS from pipx.emojis import EMOJI_SUPPORT stderr_is_tty = sys.stderr.isatty() CLEAR_LINE = "\033[K" EMOJI_ANIMATION_FRAMES = ["⣷", "⣯", "⣟", "⡿", "⢿", "...
logs.py
from functools import wraps import json try: # Python 3 imports from urllib.parse import urljoin except ImportError: # Python 2 imports from urlparse import urljoin from collections import defaultdict from threading import Thread from twisted.internet import reactor, ssl from twisted.internet.defer import De...
server.py
#!/usr/bin/env/python # File name : server.py # Production : RaspTank # Website : www.adeept.com # E-mail : support@adeept.com # Author : William # Date : 2018/08/22 import socket import time import threading import move import Adafruit_PCA9685 pwm = Adafruit_PCA9685.PCA9685() pwm.set_pwm_freq(...
main.py
from pandac.PandaModules import loadPrcFileData loadPrcFileData('', 'win-size 640 480') # Window size loadPrcFileData('', 'win-fixed-size #t') # Window is a fixed size loadPrcFileData('', 'textures-auto-power-2 1') loadPrcFileData('', 'textures-power-2 up') loadPrcFileData('', 'load-file-type p3assimp') from di...
api_unit_test.py
import math import os import sys import threading import time import unittest filename = os.path.dirname(__file__) gdsName = os.path.join(filename, "../../../../src") fprimeName = os.path.join(filename, "../../../../../Fw/Python/src") sys.path.insert(0, gdsName) sys.path.insert(0, fprimeName) from fprime_gds.common.t...
main.py
import shutil from datetime import datetime, date from time import gmtime, strftime import zipfile import re import glob from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webd...
server.py
#!/usr/bin/python3 import socket, sys, threading # Simple chat client that allows multiple connections via threads PORT = 3333 # the port number to run our server on __version__ = "0.0.1" class ChatServer(threading.Thread): conns = list() def __init__(self, port, host='localhost'): threading.Thread...
wsdump.py
#!/Users/lijing@us.ibm.com/root/temp/tmp/2020/watson-voice-bot/mytestenv/bin/python3.8 import argparse import code import sys import threading import time import ssl import six from six.moves.urllib.parse import urlparse import websocket try: import readline except ImportError: pass def get_encoding(): ...
clang-tidy-diff.py
#!/usr/bin/env python # #===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===# # # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===---------...
mp_classify.py
#!/usr/bin/env python # Copyright 2019 Xilinx 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 ...
train.py
#/usr/bin/python3 from sys import argv print("loading") import torch import kaldi_io as kio import numpy as np from model import XVectorModel from torch import nn from torch import optim from sys import exit import os from math import isnan from math import floor from queue import Queue from threading import Thread f...
browserstack_tests.py
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as expected from selenium.webdriver.common.by i...
resnet50.py
''' Copyright 2019 Xilinx Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
skill.py
# coding: utf-8 """ Contains code for handling skills. """ from mycroft.configuration import Configuration from gi.repository import Gtk, GObject import os.path import re import threading import xdg mycroft_config = None mycroft_config_set = False # Getting the config takes a while, and locks up the application. # Ru...
app.py
from __future__ import print_function import logging import os.path import sys import argparse import random import fnmatch from functools import partial import subprocess import threading import sys import platform from Qt import QtCore, QtWidgets, QtGui from pxr import Usd, Sdf, Ar, UsdUtils, Tf import utils from ...
views.py
# coding=utf-8 import json import threading from django.contrib.auth.decorators import login_required from django.http import HttpResponse, Http404 from django.shortcuts import render from django.views.decorators.csrf import csrf_exempt from frigg.builds.models import Build from frigg.utils import github_api_get_requ...
non_blocking_io.py
# coding=utf-8 # Copyright 2021 The OneFlow 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 require...
email.py
from threading import Thread from flask import render_template from flask_mail import Message from app import app, mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender=sender, reci...
experiment.py
from abc import ABC, abstractmethod import logging import time import catkit.util from catkit.testbed import devices from catkit import datalogging from catkit.multiprocessing import Process class SafetyTest(ABC): name = None warning = False @abstractmethod def check(self): """Implement to r...
emergency_stop.py
#!/usr/bin/env python # # Copyright 2015 Airbus # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA) # # 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 # # ...
master.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Copyright (c) 2013 Qin Xuye <qin@qinxuye.me> 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...
beam_worker_pool_service.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...
run_all.py
"""Run all test cases. Run each file in a separate process to avoid GPU memory conflicts. Usages: python3 run_all.py python3 run_all.py --filter pipeline python3 run_all.py --filter auto_sharding """ import argparse import glob import multiprocessing import os import time from typing import Sequence import unittest ...
stream_create_and_transcribe.py
#!/usr/bin/env python # Copyright 2021 Hyperia # # 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 ...
rocket.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 "Li...
sanitylib.py
#!/usr/bin/env python3 # vim: set syntax=python ts=4 : # # Copyright (c) 2018 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import contextlib import string import mmap import sys import re import subprocess import select import shutil import shlex import signal import threading import concurrent.fu...
utils.py
#---------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. #------------------------------------------------------------------...
test_run_function.py
from ast import Assert import unittest import dolphindb as ddb import numpy as np import pandas as pd from numpy.testing import assert_array_equal, assert_array_almost_equal from pandas.testing import assert_frame_equal, assert_series_equal from setup import HOST, PORT, WORK_DIR, DATA_DIR import time import th...
MiniMainWindow.py
""" MIT License Copyright (c) 2021 Pedro Correia 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, modify, merge, publish,...
server.py
import asyncio import time import os from multiprocessing import Process,Lock,Value,Manager import queue import sqlite3 import threading import collections import platform from ctypes import c_bool import copy """ 这里使用的是异步触发式服务器,因为在IO上同时需要保证效率, 所以代码会比较冗长,希望能提出宝贵建议 """ __author__ = "chriskaliX" class R...
test_operator.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...
stream_test.py
import httmock import os import sys import threading import unittest from . import captureOutput from girder_worker.core.io import (make_stream_push_adapter, make_stream_fetch_adapter) from girder_worker.core.utils import run_process from six.moves import BaseHTTPServer, socketserver ...
ts2.py
# Anthony Tiongson (ast119) with assistance from Nicolas Gundersen (neg62) # TS2 (a simplified top-level DNS server) # # resources: # https://www.pythonforbeginners.com/system/python-sys-argv import random, socket, sys, threading, time # makeDNSTable function stores a DNS table from a file into a dictionary def mak...
Processor.py
import time from threading import Lock, Thread from typing import Tuple, List, Callable, Dict import numpy as np from src.camera.Frame import Frame from src.utils.PubSub import PubSub from src.utils.injection.decorator import inject class Processor: """ A convenience class that provides functionality to cha...
main.py
# coding=utf-8 import classify import preprocess import pandas as pd import numpy as np import csv import codecs import multiprocessing import time def input(trainname): """ load the text file :param trainname: path of the input file :return:list """ traindata = [] with open(trainname, 'rb...
process_pool.py
# Copyright (c) 2017-2018 Uber Technologies, 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 ...
xmqp.py
""" XVM (c) www.modxvm.com 2013-2017 """ __all__ = ['start', 'stop', 'call'] # PUBLIC import os import threading import simplejson import traceback import uuid import BigWorld from gui.shared import g_eventBus, events import pika from pika import exceptions as pika_exceptions from xfw import * from xvm_main.pyth...
NarrativeIndexerServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wsgiref.simple_server import make_server import sys import json import traceback import datetime from multiprocessing import Process from getopt import getopt, GetoptError from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\ JSONRPCError, Inva...
Touchscreendisp (for use on the pi).py
from tkinter import * from tkinter import messagebox, _setit, ttk from PIL import Image, ImageTk from ttkthemes import ThemedStyle from Keyboard import create_keyboard, keyboard_on, function_maker import Wifi_file as wf import VideoSetting as vs import pickle import os import threading import cv2 import Stre...
apparea.py
#!/usr/bin/env python3 # Wrapper for apparea. import argparse import getpass import glob import json import subprocess import sys import threading import time import os from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer CONFIG_FILE = os.path.expanduser("~/.apparea.json") SITE = None PORT = None U...
monitor_engine.py
# -*- coding: utf-8 -*- u"""Monitor Engine module for SecureTea AntiVirus. Project: ╔═╗┌─┐┌─┐┬ ┬┬─┐┌─┐╔╦╗┌─┐┌─┐ ╚═╗├┤ │ │ │├┬┘├┤ ║ ├┤ ├─┤ ╚═╝└─┘└─┘└─┘┴└─└─┘ ╩ └─┘┴ ┴ Author: Abhishek Sharma <abhishek_official@hotmail.com> , Jul 4 2019 Version: 1.4 Module: SecureTea """ from securetea.lib.an...
ipcontrollerapp.py
#!/usr/bin/env python # encoding: utf-8 """ The IPython controller application. Authors: * Brian Granger * MinRK """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full ...
main.py
#!/usr/bin/env python3 # @File:main.py # @Date:2018/5/9 # Author:Cat.1 # 2018/05/20 代码部分重构 # 2018/07/15 重构系统 # 2018/07/29 增加酷狗音乐初步支持 # 2018/08/03 增加百度、酷我音乐初步支持 # 2018/08/25 增加Spotify初步支持 #t #te #tes #test #testt #testte #testtes import re import sys import copy import redis import datetime import threading import ...
sdca_ops_test.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...
utils.py
""".""" from threading import Event as _Event import logging as _log import sys as _sys from epics.ca import CAThread as _Thread from mathphys.functions import save_pickle as _save_pickle, \ load_pickle as _load_pickle import apsuite.commisslib as _commisslib class DataBaseClass: """.""" def __init__(...
newthreadscheduler.py
import time import logging import threading from rx.core import Scheduler, Disposable from .schedulerbase import SchedulerBase from .eventloopscheduler import EventLoopScheduler log = logging.getLogger('Rx') class NewThreadScheduler(SchedulerBase): """Creates an object that schedules each unit of work on a sepa...
test_client.py
import os import pytest import time import sys import logging import queue import threading import _thread from unittest.mock import patch import ray.util.client.server.server as ray_client_server from ray.tests.client_test_utils import create_remote_signal_actor from ray.tests.client_test_utils import run_wrapped_act...
run_capture_image.py
import io import socket import struct import time import datetime import picamera import logging import socketserver import threading from threading import Thread from threading import Condition from http import server date_time = datetime.datetime.now().strftime("%Y-%m-%d_%H:%M:%S") PAGE="""\ <html> <head> <title>pi...
mdns_example_test.py
import os import re import socket import struct import subprocess import time from threading import Event, Thread import dpkt import dpkt.dns import ttfw_idf from tiny_test_fw import DUT stop_mdns_server = Event() esp_answered = Event() def get_dns_query_for_esp(esp_host): dns = dpkt.dns.DNS(b'\x00\x00\x01\x00\...
event.py
# encoding: UTF-8 import logging from threading import Thread from queue import Queue, Empty from .threads import ReStartableThread class EventManager: ''' 以 key 为键标识每个事件,对一个 key 可以添加或移除多个监听器。 发布事件时传入 key 和数据 data ,后者将会传给监听器。 可指定 logger 记录日志,否则默认使用 __name__ 的 logger 。 ''' def __init__(self, ...
mnist_to_mr.py
# 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 # # Unless required by applicable law or agreed to...
chat_client_class.py
import time import socket import select import sys from chat_utils import * import client_state_machine as csm import threading class Client: def __init__(self): self.peer = '' self.console_input = [] self.state = S_OFFLINE self.system_msg = '' self.local_msg = '' s...
wake.py
"""Wake word support.""" import json import os import re import shutil import struct import subprocess import threading import time from pathlib import Path from typing import Any, Dict, Iterable, List, Optional, Type from rhasspy.actor import RhasspyActor from rhasspy.events import ( AudioData, ListenForWakeW...
p2p_stress.py
import testUtils import p2p_test_peers import random import time import copy import threading from core_symbol import CORE_SYMBOL class StressNetwork: speeds=[1,5,10,30,60,100,500] sec=10 maxthreads=100 trList=[] def maxIndex(self): return len(self.speeds) def randAcctName(self): ...
cam.py
"""Wrapper around two RPI and the multi channel switch. It relies on the use of the Multi_Adapter_Board_2Channel_uc444 for switching camera via the I2C and GPIO control. See https://github.com/ArduCAM/RaspberryPi/tree/master/Multi_Camera_Adapter/Multi_Adapter_Board_2Channel_uc444 """ import time import cv2 as cv f...
camera.py
import cv2,io,base64 from PIL import Image import threading from time import sleep from imutils.video import WebcamVideoStream import numpy as np import cv2 #import PIL.Image import time #from pygame import mixer #from tkinker import * #from PIL import ImageTk, Image from imutils.video import VideoStream from imutils i...
server.py
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ma...
t29.py
''' Created on 2019年6月19日 @author: bkd ''' import time, threading from kdGUI import * def run(): for i in range(10000): time.sleep(1) print(i) p.setValue(i * 1000) app = Window("abk") p = Progressbar(app) p.setMaximum(10000) p.setOrientation("horizontal") p["mode"] = "determina...
do-partition-stop.py
#! /usr/bin/env python # # This file is part of khmer, http://github.com/ged-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2013. It is licensed under # the three-clause BSD license; see doc/LICENSE.txt. Contact: ctb@msu.edu # import khmer import sys import threading import Queue import gc import os...
__init__.py
#!/usr/bin/python3 # @todo logging # @todo extra options for url like , verify=False etc. # @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option? # @todo option for interval day/6 hour/etc # @todo on change detected, config for calling some API # @todo fetch title into json # https://di...
test_sys.py
import unittest, test.support from test.support.script_helper import assert_python_ok, assert_python_failure import sys, io, os import struct import subprocess import textwrap import warnings import operator import codecs import gc import sysconfig import locale # count the number of test runs, used to create unique #...
__init__.py
# target-himydata # Copyright 2018 Himydata, 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 agr...
crawler.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import calendar import datetime import geopy import geopy.distance import json import logging import math import os import requests import ssl import threading import urllib.request import urllib.parse from geopy.distance import vincenty from geopy.distance import Vincent...
Dashboard.py
import curses import datetime import threading ''' # 간단 사용법 0. 사용할 모니터.py에서 Dashbord.Dashbord()를 선언합니다. dashboard = Dashbord.Dashbord() 1. 사용할 모니터.py에서 self.LASTEST_CRASH_TIME, self.DCHECK_COUNT, self.CRSAH_COUNT에 대한 것을 수집 할 수 있는 코드들을 넣어줍니다. self.LASTEST_CRASH_TIME = 크래시가 수집된 시간 self.CRSAH_COUNT = 크래시 ...
segment_deconvnet.py
#!/shared/xudongliu/anaconda3/envs/f_torch04/bin/python import argparse import json import logging import os import threading from os.path import exists, join, split, dirname import time import numpy as np import shutil import sys from PIL import Image import torch import torch.utils.data from torch import nn impor...
genmulti.py
# genmulti.py # # Generate items from multiple generators (multiplex) # import queue, threading from genqueue import genfrom_queue, sendto_queue from gencat import gen_cat def multiplex(sources): in_q = queue.Queue() consumers = [] for src in sources: thr = threading.Thread(target=s...
connection.py
#============================================================================ # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any ...
utils.py
import socket import threading import os import time # oneshot UNIX to TCP socket proxy. Stops after first connection def unix2tcp(unix_socket_path, tcp_host, tcp_port): try: os.unlink(unix_socket_path) except OSError: pass usock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) tsoc...
agent.py
# -*- coding: UTF-8 -*- import os import sys import json import time import socket import winerror import requests import win32event import win32service import win32timezone import servicemanager import win32serviceutil from threading import Thread from configparser import ConfigParser from watchdog.observers import Ob...
process.py
# coding: utf-8 """JupyterLab command handler""" # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. from __future__ import print_function import atexit import logging import os import re import signal import sys import threading import time import weakref from tornad...
runner_mutations_nolog.py
# Run Quacky on original vs mutant AWS IAM policies. # Analyze relative permissiveness. import argparse as ap import sys import os import re import math import multiprocessing from utils.Shell import Shell from utilities import get_abc_result_line parser = ap.ArgumentParser(description = 'Run Quacky on AWS IAM polici...
feature_shutdown.py
#!/usr/bin/env python3 # Copyright (c) 2018 The bitphantom Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test bitphantomd shutdown.""" from test_framework.test_framework import bitphantomTestFramework from tes...
wrapper.py
__author__ = 'ChenyangGao <https://chenyanggao.github.io/>' __version__ = (0, 0, 2) __all__ = ['as_thread', 'as_threads', 'timethis', 'with_lock', 'context', 'suppressed'] from concurrent.futures import Future from threading import current_thread, Lock, Thread from time import perf_counter from typing imp...
breaksolver.py
## # Copyright: Copyright (c) MOSEK ApS, Denmark. All rights reserved. # # File: breaksolver.py # # Purpose: Show how to break a long-running task. ## import sys import mosek.fusion from mosek.fusion import * import random import threading import time def main(): timeout = 5 n = 200 # num...
test_models.py
import unittest from yaksh.models import User, Profile, Question, Quiz, QuestionPaper,\ QuestionSet, AnswerPaper, Answer, Course, StandardTestCase,\ StdIOBasedTestCase, FileUpload, McqTestCase, AssignmentUpload,\ LearningModule, LearningUnit, Lesson, LessonFile, CourseStatus from yaksh.code_server import ( ...
yarn.py
""" This is a script to submit dmlc job via Yarn dmlc will run as a Yarn application """ # pylint: disable=invalid-name, too-many-locals, too-many-branches, missing-docstring from __future__ import absolute_import import os import sys import subprocess import warnings import logging import platform from threading impor...
DNS_local.py
import socket from .streambase import netutils from queue import Queue from threading import Thread """ userdict looks like this: {'name', [addr, port]} """ userdict = {} threadlist = [] _stop = False def get_localip(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: # doesn't even have to be reachable ...
graph-size-circum-trim.py
#! /usr/bin/env python2 # # This file is part of khmer, http://github.com/ged-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2013. It is licensed under # the three-clause BSD license; see doc/LICENSE.txt. # Contact: khmer-project@idyll.org # import khmer import sys import screed import os.path impor...
server_nonstop.py
import sys import queue import struct import threading import importlib import torch import torch.multiprocessing as mp from util.utils import TcpServer, TcpAgent, timestamp from mps.train import TrainProc from mps.inference import InferProc def func_get_request(active_model_name, qout): # Listen c...
loaders.py
""" This module gathers all user-facing functions with a `load_` prefix. """ import atexit import os import sys import tarfile import time import types import warnings from multiprocessing import Pipe, Process from multiprocessing.connection import Connection from pathlib import Path from typing import Dict, List, Opt...
main_gui.py
from tkinter import ( FALSE, Button, E, Label, Menu, N, S, StringVar, Tk, W, filedialog, messagebox, ttk, ) import threading from memory_reader import MemoryReader reader = MemoryReader() reader.getProcess() proc_open = False def read_config(): config = reader....
Sender.py
#!/usr/bin/python # -*- coding: ascii -*- # $Id: bCNC.py,v 1.6 2014/10/15 15:04:48 bnv Exp bnv $ # # Author: vvlachoudis@gmail.com # Date: 17-Jun-2015 __author__ = "Vasilis Vlachoudis" __email__ = "vvlachoudis@gmail.com" import os import re import sys import rexx import time import threading import webbrowser fro...
gui_app.py
from tkinter import * from tkinter import messagebox from tkinter import filedialog from scrapy.utils import project from scrapy import spiderloader from scrapy.utils.log import configure_logging from scrapy.crawler import CrawlerRunner from twisted.internet import reactor import threading def get_spiders(): setti...
lab3b.py
import multiprocessing as mp import numpy as np import time from functools import partial class Timer: def __init__(self): self.__start = 0.0 def __enter__(self): self.__start = time.time() return self def __exit__(self, exc_type, exc_value, traceback): print(time.time() ...
ccbench.py
# -*- coding: utf-8 -*- # This file should be kept compatible with both Python 2.6 and Python >= 3.0. from __future__ import division from __future__ import print_function """ ccbench, a Python concurrency benchmark. """ import time import os import sys import functools import itertools import threading import subpr...