source
stringlengths
3
86
python
stringlengths
75
1.04M
10bot.py
# -*- coding: utf-8 -*- import LINETCR from LINETCR.lib.curve.ttypes import * from datetime import datetime from bs4 import BeautifulSoup import time, random, sys, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia,tempfile,glob,shutil,unicodedata,goslate from gtt...
watcher.py
#!/usr/bin/env python3 # coding=utf-8 ''' #------------------------------------------------------------------------------- Project : YouTube Watcher Module : watcher Purpose : Track YouTube channels and download new videos Version : 0.5.2 beta Status : Development Modified : Created : Author : Burak Tokman...
http_server.py
#!/usr/bin/env python # Copyright 2018 the Deno authors. All rights reserved. MIT license. # Many tests expect there to be an http server on port 4545 servering the deno # root directory. import os import sys from threading import Thread import SimpleHTTPServer import SocketServer from util import root_path from time i...
test_cancel.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # test_cancel.py - unit test for query cancellation # # Copyright (C) 2010-2011 Jan Urbański <wulczer@wulczer.org> # # psycopg2 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...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest import unittest.mock from test import support from test.support import socket_helper import socket import select import time import datetime import gc import os import errno import pprint import urllib.request import threading import traceback import as...
main.py
#!/usr/bin/python3 import os import sys import subprocess import threading from termcolor import colored import pyfiglet ascii_banner = pyfiglet.figlet_format("PYSCAN") print(colored(ascii_banner, 'green')) def getStringFromBraces(string): return string.replace('(', '').replace(')','') def drawHost(hostString): arg...
rgb_server.py
#!/usr/bin/env python3 # gets rgb value from client and sets lights accordingly from ast import Bytes import socket import logging import os import time import multiprocessing import copy from rgb import RGB #configs: HOST = '192.168.1.69' # change this values depending on the ip of your pi PORT...
demo_multi_thread.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- # -------------------------------------------------------- # Tensorflow Faster R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Jiasen Lu, Jianwei Yang, based on code from Ross Girshick # --------------------------------------------------------...
client.py
from utils import sha256 import threading import argparse import socket import json class Client: def __init__(self, ip: str, port: int, username: str, password: str): self.__ip = ip self.__port = port self.alive = False self.username = username self.password = sha256(password) @property def ip(self...
connect_pool.py
#------------------------------------------------------------------------------ # connect_pool.py (Section 2.1) #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Copyright 2017, 2018, Oracle and/or its affil...
CntlrWinMain.py
''' Created on Oct 3, 2010 This module is Arelle's controller in windowing interactive UI mode @author: Mark V Systems Limited (c) Copyright 2010 Mark V Systems Limited, All rights reserved. ''' from arelle import PythonUtil # define 2.x or 3.x string types import os, sys, subprocess, pickle, time, locale, re from tk...
server.py
import logging import threading import queue import sys import pickle import sys import queue import os import signal from gevent.server import StreamServer import FetchAgent.MessageProcessor import traceback import logSetup import mprpc import gevent.monkey import gevent # from graphitesend import graphitesend impo...
server.py
"""Logging Server for multiprocessing logging managements. Basic usage: >>> import logging, sys >>> ls = LoggingServer() >>> sh = logging.StreamHandler(sys.stdout) >>> ls.logger.addHandler(sh) >>> ls.start() # run server in other thread. >>> # your process ... >>> # end process >>> ...
pymysql_9_conn_test.py
#! /usr/bin/python # -*- coding: UTF-8 -*- from pymysql_comm import UsingMysql import threading from random import randint # 模拟用户行为, 仅仅是查看数据库连接 def mock_user_action(name): log_label = '%s 查看了数据库' % name with UsingMysql(log_time=False) as um: um.cursor.execute("update Product set name = '%s' from ...
common.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...
ts.py
# Anthony Tiongson (ast119) with assistance from Nicolas Gundersen (neg62) # TS (a simplified top-level DNS server) # resources: # https://www.pythonforbeginners.com/system/python-sys-argv import sys, threading, time, random, socket def server(): # Establish port via command-line argument port = int(sys.ar...
mmorpgClient.py
import socket, pickle,time,os,threading,msvcrt,sys,random import Action, basicBullet, Map, chatListUsers createBullet = basicBullet.BasicBullet createAction = Action.Action #servidor IP_server='localhost' porta_server=12397 ACTION_DICTIONARY = {"a":"walk","w":"walk","s":"walk","d":"walk"," ":"shot","l":"reborn","r":"r...
Test_reconstruction_queues.py
from __future__ import division from misc_scripts.r_factor_calc import * from iotbx.pdb.multimer_reconstruction import multimer from multiprocessing import Process, Queue, Lock from iotbx import pdb import cPickle as pickle import os ''' Read list of pdb files names with more than one good BIOMT records Read list o...
views.py
from django.shortcuts import render from django.http import HttpResponse from django.conf import settings from django.views.decorators.csrf import csrf_exempt from django.http import JsonResponse from django.views.decorators.http import require_POST from django.views.generic import View import json from datetime impor...
base.py
import base64 import hashlib import io import json import os import threading import traceback import socket import sys from abc import ABCMeta, abstractmethod from six import text_type from six.moves.http_client import HTTPConnection from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit from ..testrunner i...
main.py
#!./env/bin/python3 from scapy.all import * from time import sleep from sys import exit as sysexit import string import random import threading from argparse import ArgumentParser # check for root if not os.geteuid() == 0: sysexit("\nOnly root can run this script\n") # init option parser parser = ArgumentParser(...
request.py
# Uses 6 threads to generate requests and force uwsgi # queuing to happen import requests import threading def request_loop(): while True: requests.get('http://uwsgi-test:8080/') if __name__ == "__main__": threads = [] for i in range(20): t = threading.Thread(target=request_loop) ...
testmaster.py
# Authors: Dennis Benz, Levin Nemesch, Jo Sandor # Version 1, 2022 import multiprocessing as mp import resource import subprocess as sp import json import sys, getopt from time import time, sleep import threading as thr from queue import Queue # Font utility class for formattet output class font: PURPLE = '\033[95...
datasets.py
# # Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ # Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch> # from bisect import bisect_left from collections import OrderedDict, deque from functools import partial import gzip from itertools import islice import os from os import path impo...
keyboard_reader.py
#!/usr/bin/env python import rospy from std_msgs.msg import Int32 import curses import threading import time pub = {} lock = threading.Event() def keyboard_listener(stdscr): # don't wait for input when calling getch stdscr.nodelay(1) # hide the cursor curses.curs_set(0) stdscr.addstr('Reading ke...
test_logging.py
# Copyright 2001-2014 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
trezor.py
import traceback import sys from typing import NamedTuple, Any from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path from electrum import const...
apkleaks.py
#!/usr/bin/env python3 import io import json import logging.config import os import re import shutil import sys import tempfile import threading import filecmp from contextlib import closing from distutils.spawn import find_executable from pathlib import Path from pipes import quote from urllib.request import urlopen ...
incast.py
#!/usr/bin/python import sys from mininet.topo import Topo from mininet.net import Mininet from mininet.log import lg from mininet.node import CPULimitedHost from mininet.link import TCLink from mininet.link import TCIntf from mininet.util import irange, custom, quietRun, dumpNetConnections from mininet.cli import CLI ...
van_hove.py
import multiprocessing import sys import itertools as it import numpy as np import mdtraj as md from progressbar import ProgressBar from scattering.utils.utils import get_dt from scattering.utils.constants import get_form_factor def compute_van_hove(trj, chunk_length, water=False, r_range=(0, 1...
subscriber.py
#!/usr/bin/env python # Copyright 2016 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...
down.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import logging import tempfile import threading import time import warnings import requests from .chunk import Chunk logger = logging.getLogger(__name__) def readabl...
SentenceTransformer.py
import json import logging import os import shutil from collections import OrderedDict from typing import List, Dict, Tuple, Iterable, Type, Union, Callable from zipfile import ZipFile import requests import numpy as np from numpy import ndarray import transformers import torch from torch import nn, Tensor, device from...
tpu_estimator.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...
data.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...
base.py
import argparse import base64 import copy import json import multiprocessing import os import sys import threading import time import uuid from collections import OrderedDict from contextlib import ExitStack from typing import ( TYPE_CHECKING, Dict, List, Optional, Set, Tuple, Type, Unio...
main.py
# -*- coding: utf-8 -*- # @Author: Manuel Rodriguez <valle> # @Date: 01-Mar-2018 # @Email: valle.mrv@gmail.com # @Last modified by: valle # @Last modified time: 13-Mar-2018 # @License: Apache license vesion 2.0 import os import sys BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ROOT_DIR =...
serverDriver.py
import threading import arduinoConnection import mysqlSetup import time if __name__ == "__main__": # Run setup once mysqlSetup.mysqlinitsetup() # creating thread t1 = threading.Thread(target=arduinoConnection.arduinoEngine) t1.daemon = True t1.start() # keep daemon threads alive whil...
agent.py
""" Copyright (c) 2010-2015, Contrail consortium. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions ...
clusterutils.py
# Copyright 2016 Cloudbase Solutions Srl # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
misc.py
""" Misc module contains stateless functions that could be used during pytest execution, or outside during setup/teardown of the integration tests environment. """ import contextlib import errno import functools import http.server as SimpleHTTPServer import os import re import shutil import socketserver import stat imp...
mainwindow.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder, the Scientific Python Development Environment ===================================================== Developed and maintained by the Spyder Proj...
connectzygo.py
""" Main function for setting up a Zygo interferometer as a remote server. Not tested at this time. Module is not working! Author: James Johnson License: MIT """ import socket import numpy as np import time import os import logging import threading # setup logging for debug logging.basicConfig(format='%(asctime)s ...
model.py
import os import logging import sys import time import json import redis import attr import io try: import torch.multiprocessing as mp try: mp.set_start_method('spawn') except RuntimeError: pass except ImportError: import multiprocessing as mp import importlib import importlib.util impor...
parallel_programming_1.py
#!/usr/bin/env python3 """ Code for https://www.linkedin.com/learning/python-parallel-and-concurrent-programming-part-1/multiple-threads-python-demo?u=26192810 """ import os import threading """ C20: 演示一个简单的 thread 例子, 显示 pid, threading.active_count() 和返回 Thread 对象列表 """ class C2_0: # a simple function that waste...
app.py
# -*- coding: utf-8 -*- """ A routing layer for the MUN bot built using [Slack's Events API](https://api.slack.com/events-api) in Python """ import json import bot from flask import Flask, request, make_response, render_template from threading import Thread pyBot = bot.Bot() slack = pyBot.client app = Flask(__name__...
utils_test.py
from __future__ import annotations import asyncio import concurrent.futures import contextlib import copy import functools import gc import inspect import io import logging import logging.config import multiprocessing import os import re import signal import socket import subprocess import sys import tempfile import t...
utils.py
import os import datetime from multiprocessing import Process import time import yaml import streamlit as st import psutil import pandas as pd from typing import Callable, Union, Tuple def get_size(path: str ) -> float: """ Helper function to get size of a path (file / folder) Args: path (str): P...
vec_env.py
import argparse import cloudpickle from multiprocessing import Process, Pipe import numpy as np from .base import BaseEnv class RunningNormalizer(object): def __init__(self, shape): self.shape = shape self.running_mean = np.zeros(shape) self.running_var, self.running_std = np.ones(shape)...
generate_tweets.py
#!/usr/bin/env python """Generate tweets based on what comes in along in the tweet stream.""" import sys import os import tweepy import common import time import multiprocessing import signal import random try: import credentials except ImportError: raise StandardError("Please copy credentials_template.py to cr...
tregex_stage.py
from gflags import (DEFINE_string, FLAGS, DuplicateFlagError, DEFINE_integer, DEFINE_enum) import itertools import threading import logging from math import log10 from os import path import Queue import subprocess import sys import tempfile import time from threading import Lock from nlpypline.data...
makepanda.py
#!/usr/bin/env python ######################################################################## # # To build panda using this script, type 'makepanda.py' on unix # or 'makepanda.bat' on windows, and examine the help-text. # Then run the script again with the appropriate options to compile # panda3d. # ##################...
main.py
import cv2 import numpy as np import colors import position from twophase import solve import threading from cube3d import RubiksCube def show_scramble_2d(text=None, img=None): cv2.imshow(text, img) cv2.waitKey(0) def create_cube(solution, start_position): game = RubiksCube(solution, start_position) ...
programs.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """Running programs utilities.""" from __future__ import print_function # Standard library imports from ast import literal_eval from getpass import getu...
poker.py
import time import random import pokerhands from operator import attrgetter import time import pokerstrat import server from threading import Thread from websocket_server import WebsocketServer #card class class Card: RANKS=['2','3','4','5','6','7','8','9','10','J', 'Q', 'K', 'A'] SUITS=['h', 'c', 's', 'd...
common.py
# # # # # # common.py # # Contains methods used across # multiple backend files # # University of Illinois/NCSA Open Source License # Copyright (c) 2015 Information Trust Institute # All rights reserved. # # Developed by: # # Information Trust Institute # University of Illinois # http://www.iti.illinois.edu # # Permiss...
menulcd.py
import os from subprocess import call from xml.dom import minidom from lib.ledsettings import LedSettings import webcolors as wc from PIL import ImageFont, Image, ImageDraw import LCD_1in3 import LCD_1in44 import LCD_Config from lib.functions import * import RPi.GPIO as GPIO class MenuLCD: def __init__(self, ...
pabot.py
#!/usr/bin/env python # Copyright 2014->future! Mikko Korpela # # 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 ...
sumo_multi_clients.py
import os import subprocess import threading import time from smarts.core.utils.sumo import SUMO_PATH, sumolib, traci PORT = 8001 """ Conclusions: 1. connected clients < num-clients: SUMO will block, only start once all clients have connected. 2. connected clients > num-clients: Extra connection will be closed by SU...
automated_driving_with_fusion2_1.py
"""Defines SimpleSensorFusionControl class ---------------------------------------------------------------------------------------------------------- This file is part of Sim-ATAV project and licensed under MIT license. Copyright (c) 2018 Cumhur Erkan Tuncali, Georgios Fainekos, Danil Prokhorov, Hisahiro Ito, James Kap...
utils.py
# # Copyright 2018 PyWren Team # (C) Copyright IBM Corp. 2020 # (C) Copyright Cloudlab URV 2020 # # 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-...
loader.py
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. ############################################################################## """Detectron data loader. The design is gene...
remote.py
# -*- coding: utf-8 -*- # pylint: disable=import-error, no-name-in-module import contextlib import multiprocessing import os import queue import signal import time import traceback import warnings from const import DUMP_PATH, HOOK_CPU, INTERVAL, QUEUE_DUMP, QUEUE_LOGS, SCAN_CPU from scan import lookup, scan try: ...
dronelauncher_python_final.py
#DRONE LAUNCHER """ ALL positional rotation is commented out unitl the rotation motor is customized adequately (no jerking) Please be advised: The launch is NOT connected. This means that any attempts to use functions involving the launch will result in unwanted delay due to timeout tries on packages. Launcher use ha...
master.py
# -*- coding: utf-8 -*- ''' This module contains all of the routines needed to set up a master server, this involves preparing the three listeners and the workers needed by the master. ''' # Import python libs from __future__ import absolute_import, with_statement, print_function, unicode_literals import copy import c...
scheduler.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8: # Author: Binux<i@binux.me> # http://binux.me # Created on 2014-02-07 17:05:11 import itertools import json import logging import os import time from collections import deque from six import iteritems, itervalues...
concurrency.py
# encoding: utf-8 """ This module helps you run things concurrently. Most useful are the ``concurrent`` context manager and the ``MultiObject`` class. The features in this module are integrated with the ``logging`` module, to provide thread-context to log messages. It also has support for integration ``gevent``. ``Mu...
Misc.py
## @file # Common routines used by all tools # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ## # Import Modules # from __future__ import absolute_import import sys import string import threading import time import re import ...
main.py
''' This is the main alarms file ''' # pylint: disable=line-too-long, unsubscriptable-object, global-statement, bare-except import time import json import random import sched import threading import logging from datetime import datetime import pyttsx3 from flask import Flask, request, render_template from news_filter...
carla_manual_control.py
#!/usr/bin/env python # # Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # Copyright (c) 2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Welcome to CARLA ROS manual contro...
jsview_3d.py
from __future__ import absolute_import, division, print_function from libtbx.math_utils import roundoff import traceback from cctbx.miller import display2 as display from cctbx.array_family import flex from cctbx import miller from scitbx import graphics_utils from scitbx import matrix from libtbx.utils import Sorry, ...
meterpreter.py
#!/usr/bin/python import binascii import code import os import platform import random import re import select import socket import struct import subprocess import sys import threading import time import traceback try: import ctypes except ImportError: has_windll = False else: has_windll = hasattr(ctypes, '...
runjob.py
#!/usr/bin/env python # Copyright 2018 National Technology & Engineering Solutions of Sandia, LLC # (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. # Government retains certain rights in this software. import sys sys.dont_write_bytecode = True sys.excepthook = sys.__excepthook__ import os impor...
test_utilities.py
# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
riak_kill_start.py
#!/bin/python import sys; import subprocess; from time import sleep; from threading import Thread; from Thesis.ycsbClient.runMultipleYcsbClients import executeCommandOnYcsbNodes; from Thesis.plot.ParseYcsbTestResults import parseAndPlot; from Thesis.delete_data.deleteAllRiakData import deleteAllDataInRiak; from Thesi...
client.py
# code to simulate the client # each client sends a particular request for a size and gets back the best price for that size for each supplier from os import startfile import socket from random import randint from threading import Thread from jpype import * num_clients = 10 # number of clients to be create...
multi_camera_multi_target_tracking.py
#!/usr/bin/env python3 """ Copyright (c) 2019-2020 Intel Corporation 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 applicab...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import json import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional, TYPE_CH...
server.py
import time import copy import json import socket import threading # running locally from message import Message class Servidor: HOST = "127.0.0.1" PORT = 10098 ALIVE_PORT = PORT + 1 SERVER = (HOST, PORT) BUFFERSIZE = 1024 BROAD_CAST_TIME_INTERVAL = 30 # Tempo entre cada requisição mand...
01-torque_control_cyclic.py
#! /usr/bin/env python3 ### # KINOVA (R) KORTEX (TM) # # Copyright (c) 2019 Kinova inc. All rights reserved. # # This software may be modified and distributed # under the terms of the BSD 3-Clause license. # # Refer to the LICENSE file for details. # ### ### # * DESCRIPTION OF CURRENT EXAMPLE: # =====================...
data.py
from __future__ import print_function import numpy as np import mxnet as mx import multiprocessing import time import logging import tables tables.set_blosc_max_threads(4) def add_data_args(parser): data = parser.add_argument_group('Data', 'the input data') data.add_argument('--data-config', type=str, help='t...
test.py
""" 自定义进程类 """ from multiprocessing import Process # 使用面向对象的思想,创建自己的类 class MyProcess(Process): def __init__(self, value, group=None, target=None, name=None, args=(), kwargs={}): self.value = value super().__init__(group, target, name, args, kwargs) # 进行执行内容的入口函数 def run(self): pr...
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...
server.py
# Krishna Chaitanya Naragam # 1001836274 from tkinter import * from datetime import datetime import threading from flask import Flask import os, signal from flask import request import time # declarations root = None information_panel = None # serve Queue A def serve_A(i): i = float(i) output = "\n=========...
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...
application.py
from tkinter import * from panhandler import * import threading from subprocess import call root = Tk() root.configure(background='#404040', padx=10, pady=10) root.title("Panhandler") title = Label(root, text="That Panhandlin' Bitch") title.configure(background='#404040', fg='#FFFFFF') title.grid(row=0, column=0) u...
run_sniper.py
import sys, os, time, subprocess, threading, tempfile, sniper_lib def Tee(filename, prefix = ''): open(filename, 'w').close() # Make sure is writeable and empty obj = subprocess.Popen(['bash', '-c', 'while read line; do echo "%s"$line; echo $line >> %s; done' % (prefix, filename)], stdin = subprocess.PIPE) retur...
relay_integration.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...
test_nvml.py
import multiprocessing as mp import os import pytest pytestmark = pytest.mark.gpu pynvml = pytest.importorskip("pynvml") import dask from distributed.diagnostics import nvml from distributed.utils_test import gen_cluster def test_one_time(): if nvml.device_get_count() < 1: pytest.skip("No GPUs availa...
feeder_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...
sftp_test.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2016 Kitware 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 cop...
WeaveBluezMgr.py
# # Copyright (c) 2015-2018 Nest Labs, Inc. # Copyright (c) 2019-2020 Google LLC. # 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://ww...
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run flash build target to rebuild and flash entire project (Ctrl-T Ctrl-F) # - Run app-flash build target to rebuild and f...
decorators.py
import threading from functools import wraps from django.core.exceptions import PermissionDenied def require_member(func): @wraps(func) def inner(request, *args, **kwargs): if request.user_obj: return func(request, *args, **kwargs) else: raise PermissionDenied('You mus...
power_dataset.py
# HAT: Hardware-Aware Transformers for Efficient Natural Language Processing # Hanrui Wang, Zhanghao Wu, Zhijian Liu, Han Cai, Ligeng Zhu, Chuang Gan and Song Han # The 58th Annual Meeting of the Association for Computational Linguistics (ACL), 2020. # Paper: https://arxiv.org/abs/2005.14187 # Project page: https://han...
init.py
import docker from docker.models.images import Image from docker.models.containers import _create_container_args import yaml import shutil from multiprocessing import Process, Queue from distutils.dir_util import copy_tree import sys, os, time from pathlib import Path from jinja2 import Template def build_image(docker...
__init__.py
# pylint: disable=too-many-lines # (Yes, it has a point!) __copyright__ = """ Copyright (C) 2009-2013 Andreas Kloeckner Copyright (C) 2020 Matt Wala """ __license__ = """ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software")...
test_memory.py
import ctypes import gc import pickle import threading import unittest import fastrlock import pytest import cupy.cuda from cupy.cuda import device from cupy.cuda import memory from cupy.cuda import stream as stream_module from cupy import testing class MockMemory(memory.Memory): cur_ptr = 1 def __init__(s...
peer.py
import os import sys import socket import threading import json import time import click from watchdog.observers import Observer from watchdog.events import PatternMatchingEventHandler FORMAT = "utf-8" SIZE = 1024 def watchFolder(conn): # Keep watching the folder for any change patterns = "*" ignore_patte...
control_lirc.py
import bluetooth from control_artik import * import logging import socket import string import subprocess import sys import time import threading FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' logging.basicConfig(format=FORMAT, level=logging.DEBUG) class ControlLirc(object): def __init__(self): ...