source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
mturk_manager.py | #!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
im... |
notebook.py | import cv2
import torch.hub
import os
import model
from PIL import Image
from torchvision import transforms
from grad_cam import BackPropagation
import time
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import threading
import vlc
from os.path import dirname, join
from twilio.rest import Client
impo... |
spyrelet.py | import pymongo
from nspyre.instrument_manager import Instrument_Manager
from nspyre.utils import *
# from instrument_server import Remote_Device
import pandas as pd
import numpy as np
from lantz import Q_
from pint.util import infer_base_unit
import traceback
import inspect
from collections import OrderedDict
from tqd... |
service.py | # Copyright (c) 2010-2013 OpenStack, LLC.
#
# 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 ... |
pcb.pyp | def pcb_fun():
global pcb_val
lights1 = [0]*15
lights2 = [0]*15
lights3 = [0]*15
lights4 = [0]*15
lights5 = [0]*15
lights6 = [0]*15
for i in range(0,15):
if(True):
i4 = (i & 0x08) >> 3
i3 = (i & 0x04) >> 2
i2 = (i & 0x02) >> 1
i1 ... |
main.py | """
main.py
Handles all accessible URI's for flask
"""
from flask import Flask, render_template, request, g
from darkweb.modules.base.crawlerconfig import CrawlerConfig
from darkweb.modules.irc.irc import IRC
from darkweb.modules.web.WebCrawler import WebCrawler
from darkweb.modules.parser.search import search
from dar... |
tasks.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Miguel Grinberg <miguelgrinberg50@gmail.com>
#
# Distributed under terms of the MIT license.
import threading
import time
import uuid
from datetime import datetime
from flask import current_app, request
from functools import wraps
fr... |
tcp_ip_client_sample.py | #!/usr/bin/env python
import socket
import json
import ast
import threading
import select
import Queue
import pandas as pd
import numpy as np
def show_menu():
for id in MENU_IMPUT.keys():
print str(id) + ' | ' + MENU_IMPUT[id]
def action_decode(action):
if action == '0':
return 'devices'
... |
learn.py | # # Unity ML-Agents Toolkit
import logging
import argparse
from multiprocessing import Process, Queue
import os
import glob
import shutil
import numpy as np
from typing import Any, Callable, Optional, List, NamedTuple
import mlagents.trainers
import mlagents.envs
from mlagents import tf_utils
from mlagents.trainers.... |
semapha.py | import time
from random import random
from threading import Thread, Semaphore
sema = Semaphore(3)
def foo(tid):
with sema:
print('{} acquire sema'.format(tid))
wt = random() *2
time.sleep(wt)
print('{} release sema'.format(tid))
return
threads = [ ]
for i in range(5):
t = Thre... |
connection.py | import json
import logging
from pprint import pformat
from pyee import EventEmitter
from threading import Thread
from node.network_util import count_incoming_packet, count_outgoing_packet
import sys
import time
import obelisk
import socket
from node import constants, network_util
from node.crypto_util import Cryptor
... |
dbxfs.py | #!/usr/bin/env python3
# This file is part of dbxfs.
# dbxfs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# dbxfs is distributed ... |
test_wsgiref.py | import cosmo
from unittest import mock
from test import support
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler
from wsgiref imp... |
threads.py | #!/usr/bin/env python
# cf. http://gee.cs.oswego.edu/dl/papers/fj.pdf
import math
import time
import inspect
import sys
import os.path
sys.path[0:0] = [ os.path.join( os.path.dirname( inspect.getabsfile( inspect.currentframe() ) ), '..', '..', 'lib' ) ]
from logging import warning
import threading
from threading i... |
__init__.py | #!/usr/bin/python3
# @todo logging
# @todo extra options for url like , verify=False etc.
# @todo enable https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl as option?
# @todo option for interval day/6 hour/etc
# @todo on change detected, config for calling some API
# @todo fetch title into json
# https://di... |
client.py | from socket import AF_INET, socket, SOCK_STREAM, gethostname, gethostbyname
from threading import Thread
class Client:
"""
for communication with the server
"""
HOST = gethostbyname(gethostname())
PORT = 7560
ADDRESS = (HOST, PORT)
BUFFER_SIZE = 512
__QUIT_CMD = '{/%quit%disconnect_now... |
executor.py | """LowLatencyExecutor for low latency task/lambda-function execution
"""
from concurrent.futures import Future
import logging
import threading
import queue
from multiprocessing import Process, Queue
from parsl.serialize import pack_apply_message, deserialize
from parsl.executors.low_latency import zmq_pipes
from pars... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import argparse
import json
import multiprocessing
imp... |
DiscordBot.py | import discord
import asyncio
import threading
import time
from dbHelper import sql
from datetime import datetime
import math
from BanProcessor import processBan, updateOpnsense
client = discord.Client()
notifsQueue = None
cfg = {}
async def startDiscord(token):
await client.start(token)
def stopDiscord():
... |
ex.py | #!/usr/bin/env python3
import threading
import time
from mbeacon import BeaconServer, BeaconFinder
# from collections import namedtuple
from enum import Enum, IntFlag
# Pub_t = namedtuple('Pub_t', 'key topic pid funcname')
# Sub_t = namedtuple('Sub_t', 'key topic pid funcname')
# Perf_t = namedtuple('Perf_t', 'key n... |
train.py | # -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2019 Megvii Technology
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
graph_digest_benchmark.py | #!/usr/bin/env python
"""
This benchmark will produce graph digests for all of the
downloadable ontologies available in Bioportal.
"""
from __future__ import print_function
from rdflib import Namespace, Graph
from rdflib.compare import to_isomorphic
from six.moves.urllib.request import urlopen
from six.moves import ... |
graph.py | import matplotlib.pyplot as plt
from collections import deque
import multiprocessing as mp
import numpy as np
import time
class ProcessPlotter(object):
def __init__(self, freq, title, label_instruct):
self.interval = freq
self.title = title
self.label_instruct = label_instruct
self.... |
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... |
pipeline_old.py | #!/usr/bin/env python
from inspect import currentframe, getframeinfo
import ConfigParser
import threading
import json
import os
from astropy.time import Time
import astropy.units as units
import multiprocessing
import numpy as np
import socket
import struct
from subprocess import check_output, PIPE, Popen
import time
... |
autoconv_handler.py | from copy import deepcopy
from datetime import datetime
from math import ceil
from re import match
from time import sleep
from autoconv.utils.telegram_data import TelegramData
from autoconv.utils.timed_thread import TimedThread
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.error import ... |
middleware.py | '''
Provides functionality for checking login details,
session validity, and the like.
2019 Benjamin Kellenberger
'''
from threading import Thread
from modules.Database.app import Database
import psycopg2
from datetime import timedelta
from util.helpers import current_time
import secrets
import hashlib
im... |
main.py | import pdb
import time
import os
import subprocess
import re
import random
import json
import numpy as np
import glob
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import socket
import argparse
import threading
import _thread
import signal
from datetime import datetime
import csv
i... |
title_popup_dialog.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'UI/title_popup_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.14.2
#
# WARNING! All changes made in this file will be lost!
import multiprocessing
import threading
from typing import Dict
from PyQt5 import QtCore, QtGui, QtWidgets
i... |
testing.py | import bz2
from collections import Counter
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import gzip
import http.client
import os
import re
from shutil import rmtree
import string
import tempfile
import traceback
from typing import Union, cast
import warnings
import zip... |
bm_core.py | #!/usr/bin/env python
#-*- coding:utf-8 -*-
#Copyright (C) 2018, Nudt, JingshengTang, All Rights Reserved
#Author: Jingsheng Tang
#Email: mrtang@nudt.edu.cn
import os,sys
file_dir = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(os.path.split(file_dir)[0]+'//GuiMachine')
import numpy as np
import mul... |
pcrender.py | from __future__ import print_function
import numpy as np
import ctypes as ct
import os
import cv2
import sys
import torch
import argparse
import time
import gibson.core.render.utils as utils
import transforms3d
import json
import zmq
from gibson import assets
from torchvision import datasets, transforms
from torch.au... |
networking.py | import ast
import asyncio
import ipaddress
import socket
from abc import abstractmethod
from argparse import Namespace
from threading import Thread
from typing import Optional
import grpc
from jina.logging.logger import JinaLogger
from jina.proto import jina_pb2_grpc
from jina.types.message import Message
from .. imp... |
utils.py | import logging
import os
import shlex
import subprocess
import threading
import time
from contextlib import contextmanager
from functools import wraps
import parsl
from parsl.version import VERSION
logger = logging.getLogger(__name__)
def get_version():
version = parsl.__version__
work_tree = os.path.dirnam... |
robot_gui.py | #!/usr/local/bin/python3
from robot import robot
import sys, time, threading
import numpy as np
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import pyqtgraph as pg
AXIS_PLOT_SIZE = 400
MEDIAN_LENGTH = 30
class App(QtGui.QMainWindow):
def __init__(self, parent=None):
super(App, self).__init__... |
__init__.py | # coding=utf-8
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from octoprint.util.version import get_octoprint_version_string
from tempfile import mkstemp
from datetime import timedelta
from slacker import Slacker, IncomingWebhook
from imgurpython import ImgurClient... |
job_worker.py | ###########################################################################
#
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/l... |
server_static.py | import serial
from dcd.entities.thing import Thing
from dcd.entities.property import PropertyType
from dotenv import load_dotenv
import os
# import flask
from flask import Flask, request, render_template
from flask_socketio import SocketIO, emit, send
import datetime
import time
from random import random
from numpy... |
rightBrain.py | import numpy as np
import threading
import time
import socket
import swarmNet
import os
import math
import droneControl
import struct
state = 0
rightState = state
running = True
started = False
Vu = 0
Vp = 0
dVu = 0
dVp = 0
vision = droneControl.vision()
tStatus = 0
tStatus0 = time.time()
tSta... |
gitego.py | # -*- coding: utf-8 -*-
#
# Copyright 2013 James Thornton (http://jamesthornton.com)
# BSD License
#
"""
GitHub ETL: Extract & Transform GitHub Egocentric Data.
Load via Gremlin
Requires the `requests` Python library to be installed:
$ sudo easy_install requests
"""
import os
import sys
import json
import string
im... |
get_bindlevel_for_peptides_in_dict.py | import pickle, tempfile, subprocess
from threading import Thread
NETMHCPAN_LOCATION = "data/netMHCpan"
DICTS_FOLDER = "data/dicts"
MHCS = ["HLA-A01:01", "HLA-A02:01"]#, "HLA-A03:01", "HLA-A11:01", "HLA-A24:02", "HLA-B40:01", "HLA-C01:02", "HLA-C04:01", "HLA-C07:01", "HLA-C07:02"]
GENES = ['e']#, 'm', 'n', 's']
MIN_PEP... |
test_flight.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... |
__init__.py | # -*- coding: utf-8 -*-
# Copyright 2015 MongoDB, 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... |
dynamixel_serial_proxy.py | # -*- coding: utf-8 -*-
#
# Software License Agreement (BSD License)
#
# Copyright (c) 2010-2011, Antons Rebguns.
# 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... |
test_tcp.py | import asyncio
import asyncio.sslproto
import gc
import os
import select
import socket
import unittest.mock
import ssl
import sys
import threading
import time
import weakref
from OpenSSL import SSL as openssl_ssl
from uvloop import _testbase as tb
SSL_HANDSHAKE_TIMEOUT = 15.0
class MyBaseProto(asyncio.Protocol):
... |
cameraServer.py | import socket
import numpy as np
import cv2
from threading import Thread
class cameraServer:
def __init__(self):
self.verbs = {
'on': self._turnCamerasOn,
'off': self._turnCamerasOff,
'pic': self._takeSinglePic
}
self.frame = np.zeros([2*480,640,3],dtype=np.uint8)
... |
turnc.py | #!/usr/bin/env vpython3
import sys
import time
import binascii
import socket
import select
import hashlib
import hmac
from sturn import utils
from sturn import turn
from sturn.turn import attributes as turnattributes
from sturn import stun
from sturn.stun import agent, attributes ,authentication
import json
import io... |
test_sia_client.py | # -*- coding: utf-8 -*-
"""Class for tests of pysiaalarm."""
import json
import logging
import random
import socket
import threading
import time
import pytest
from mock import patch
from pysiaalarm import InvalidAccountFormatError
from pysiaalarm import InvalidAccountLengthError
from pysiaalarm import InvalidKeyFormat... |
main.py | import threading
import requests
import time
import queue
import json
import os
from kafka import KafkaConsumer
DOCKER_HOST_IP=os.getenv('DOCKER_HOST_IP')
assert DOCKER_HOST_IP != None, "Failed to get DOCKER_HOST_IP from environment variable"
class TestCase:
def __init__(self, input, expectedOutput):
self... |
digit_finder.py | import sys
import time
import copy
import json
import queue
import signal
import getopt
import logging
import threading
import cv2
import imutils
import cherrypy
import numpy as np
from mxnet import nd
from mxnet import gluon
from sklearn.cluster import KMeans
from sklearn.metrics import calinski_harabasz_score
LOG_... |
__init__.py | """Miscellaneous helper functions (not wiki-dependent)."""
#
# (C) Pywikibot team, 2008-2021
#
# Distributed under the terms of the MIT license.
#
import collections
import gzip
import hashlib
import ipaddress
import itertools
import os
import queue
import re
import stat
import subprocess
import sys
import threading
im... |
train.py | #!/usr/bin/env python
# -*- coding = utf-8 -*-
import mxnet as mx
import numpy as np
import cv2
import os
import argparse
import multiprocessing
import random
import logging
import resnet
import dataset
# define metric
class Auc(mx.metric.EvalMetric):
def __init__(self):
super(Auc, self).__... |
TProcessPoolServer.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... |
uploader.py | #!/usr/bin/env python
import os
import time
import stat
import random
import ctypes
import inspect
import requests
import traceback
import threading
from collections import Counter
from selfdrive.swaglog import cloudlog
from selfdrive.loggerd.config import get_dongle_id_and_secret, ROOT
from common.api import api_get... |
test_integration_input_app_output.py | import datetime
import threading
import pytest
import os
import time
from dotenv import load_dotenv
from agogosml.common.kafka_streaming_client import KafkaStreamingClient
from agogosml.reader.input_reader_factory import InputReaderFactory
from agogosml.writer.output_writer_factory import OutputWriterFactory
from tes... |
gui_qt.py | """PyQT5 version of a treeview-based XML-editor
"""
from PyQt5.QtWidgets import (QWidget, QPushButton,
QHBoxLayout, QVBoxLayout, QApplication)
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow, QLabel
import os
import sys
## import functools
import PyQt5.QtWidgets as qt... |
test_system.py | # Copyright 2016 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
test_currentthreadscheduler.py | import pytest
import unittest
import threading
from datetime import timedelta
from time import sleep
from rx3.scheduler import CurrentThreadScheduler
from rx3.internal.basic import default_now
class TestCurrentThreadScheduler(unittest.TestCase):
def test_currentthread_singleton(self):
scheduler = [
... |
nhentaibot2.0.py | import discord
from discord.ext import commands
import requests
import threading
from bs4 import BeautifulSoup
intents = discord.Intents.all()
bot=commands.Bot(command_prefix=".",intents=intents)
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
game = discord.Game("Testing")... |
bitrate_api.py | import os, sys
import subprocess
from subprocess import Popen
from bitrate_db import influx
from flask import Flask
from flask import request, Response, make_response
from functools import wraps
import threading
from threading import Thread
dpmi = Flask(__name__)
interface="ens4"
directory="/home/ajheartnett/consume... |
materialize_with_ddl.py | import time
import pymysql.cursors
import pytest
from helpers.network import PartitionManager
import logging
from helpers.client import QueryRuntimeException
from helpers.cluster import get_docker_compose_path, run_and_check
import random
import threading
from multiprocessing.dummy import Pool
from helpers.test_tools... |
__init__.py | from flask import Flask, render_template, g
from threading import Thread
import functools
import schedule
import time
from .classes.datastores.sqlitedatastore import SqliteDataStore
from .classes.datastores.redisdatastore import RedisDataStore
from .classes.services.mcserver import MCServer
from .classes.services.mu... |
Server.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
test_threads.py | # MIT License
#
# Copyright (c) 2018-2019 Tskit Developers
# Copyright (c) 2016-2017 University of Oxford
#
# 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... |
app.py | # app.py
# Rohan Weeden
# Created: Feb. 2. 2018
# Flask server for displaying the hosts that are up on the given subnet
import atexit
import ipaddress
from flask import Flask
from flask import render_template, request
from flask_socketio import SocketIO
from threading import Timer, Thread, Lock
from time import time
... |
procutil.py | from multiprocessing import Process, Queue
import traceback
import logging
log = logging.getLogger(__name__)
def _wrapper(target, codec, queue, args, kwargs):
exc = tb = None
try:
if args is None:
args = []
if kwargs is None:
kwargs = {}
r = target(*args, **kwa... |
test_list_jy.py | import unittest
import random
import threading
import time
from test import test_support
import test_list
if test_support.is_jython:
from java.util import ArrayList
from java.lang import String
class ListTestCase(unittest.TestCase):
def test_recursive_list_slices(self):
x = [1,2,3,4,5]
x[... |
client.py | import socket
import random
from threading import Thread
from datetime import datetime
from colorama import Fore, init, Back
import sys
import signal
MESSAGE_SIZE = 1024
sock = None
def sigterm_handler(_signum, _frame) -> None:
sys.exit(1)
def clean_up():
global sock
# close the socket
sock.close... |
support.py | """
Assorted utilities for use in tests.
"""
import cmath
import contextlib
import enum
import gc
import math
import platform
import os
import shutil
import subprocess
import sys
import tempfile
import time
import io
import ctypes
import multiprocessing as mp
import warnings
import traceback
from contextlib import con... |
batch_sampler.py | """Module for parallel sampling a batch of rollouts"""
from functools import partial
import logging
import numpy as np
import multiprocessing as mp
import tensorflow as tf
from garage.sampler.base import BaseSampler
from garage.sampler.stateful_pool import singleton_pool
from garage.sampler.utils import truncate_paths
... |
test_coprocess.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
# To allow python to run these tests as main script
import contextlib
import functools
import multiprocessing
import sys
import os
import threading
import types
from random import randint
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__fil... |
data_gen.py | """Provides for generating and batching data, and converting it into the
tf.data.Dataset format expected by TensorFlow.
"""
import functools as ft
import multiprocessing as mp
import numpy as np
import os
import tensorflow as tf
tfd = tf.data
# https://github.com/patrick-kidger/tools
import tools
from . import data... |
message.py | import socketserver
import threading
import json
__author__ = 'Bartosz Kościow'
class MessageHandler(socketserver.BaseRequestHandler):
def handle(self):
data = self.request[0].strip()
event = None
try:
message = json.loads(data.decode())
if 'protocol' in message \
... |
learn_thread.py | # *-* coding: utf-8 -*
'''
多线程
Python3 有三个多线程模块 _thread, threading, Queue
_thread没什么人用
'''
import threading
import time
from concurrent.futures import ThreadPoolExecutor, as_completed
def threading_action_01(para='test_01_thread_01', sleep=3):
time.sleep(sleep)
print(f'{para} 开始 {time.strftime("%Y-%m-%d %H:%... |
subMain.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np
import sys
import time
import cv2
import json
import glob
import random
import dlib
import PySimpleGUI as sg
from PIL import ImageGrab
from mss import mss
__author__ = "masaru mizuochi"
__version__ = "1.00"
__date__ = "12 April 2020"
from com... |
process.py | from cloudbutton.multiprocessing import Process
def f(name):
import os
print(os.environ)
print('hello', name)
if __name__ == '__main__':
p = Process(target=f, args=('bob',))
p.start()
p.join()
|
thread_file.py | import threading
import time
import sys
from account import List, Checker
from getch import getch
class MyThread(List):
#def __init__(self):
# print('__init__ Mythread')
#print(self.list_upgrade)
ui = ""
def background(self):
while True:
time.sleep(1)
self.ui = input()
def loop(self):
# now threadin... |
enrich_parallel.py | import os
import requests
import time
import multiprocess as mp
import redis
from rq import Connection, Queue
from flask import Blueprint, current_app, jsonify, render_template, request
from bso.server.main.logger import get_logger
from bso.server.main.unpaywall_enrich import enrich
logger = get_logger(__name__)
defa... |
multi_process_runner_test.py | # Copyright 2019 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... |
apollo_client.py | # -*- coding: utf-8 -*-
import json
import logging
import sys
import threading
import time
import os
import requests
LOGGER = logging.getLogger(__name__)
class ApolloClient(object):
def __init__(self,
app_id,
cluster='default',
config_server_url='http://localho... |
test_install_mender_sh.py | #!/usr/bin/python3
# Copyright 2021 Northern.tech AS
#
# 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 a... |
containers.py | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
slowlorisE.py | import argparse
from threading import Thread
import socket
import random
import time
# Parse command line arguments
parser = argparse.ArgumentParser(description = "A simple SlowLoris DoS attack tool")
parser.add_argument("-t", "--target", type = str, help = "Attack target hostname/IP address", required = True)... |
hello_world__with_daemon.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from multiprocessing import Process, current_process
import time
def run():
print(current_process())
for i in 'Hello World!':
print(i)
time.sleep(0.2)
if __name__ == '__main__':
p = Process(target=run, daemon=True... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test whatcoind shutdown."""
from test_framework.test_framework import BitcoinTestFramework
from test_framew... |
core.py | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
alumnos_asesor.py | import threading
from time import sleep
import random
alumnos = 0
max_preguntas = 5 #con esta variable pensaba limitar el maximo de preguntas por alumno y emplear la funcion randint de random
turno = 0 #Con esta variable pensé en manejar los turnos
n=0
mutex = threading.Semaphore(1)
vacio = threading.Semaphore(1)
... |
ezclib.py | """ Ezcapechat RTMP library by Nortxort (https://github.com/nortxort) """
import json
import logging
import time
import re
import threading
import config
import user
from apis import ezcapechat
from pages import acc
from util import string_util
from rtmplib import rtmp
__version__ = '1.1.0'
log = logging.getLogger(__... |
master.py | """
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 collections
import copy
import ctypes
import functools
import logging
import multiprocessing
import os
import re
import signal
import stat
import sy... |
executors.py | __author__ = "Johannes Köster"
__copyright__ = "Copyright 2015-2019, Johannes Köster"
__email__ = "koester@jimmy.harvard.edu"
__license__ = "MIT"
import os
import sys
import contextlib
import time
import datetime
import json
import textwrap
import stat
import shutil
import shlex
import threading
import concurrent.futu... |
test_graphcomm.py | import pytest
import re
import zmq
import dill
import threading
import zmq.asyncio
import numpy as np
from ami.comm import GraphCommHandler, AsyncGraphCommHandler
class FakeManager:
def __init__(self, ctx, addr, conf, use_thread=True):
self.ctx = ctx
self.sock = self.ctx.socket(zmq.REP)
se... |
player.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: omi
# @Date: 2014-07-15 15:48:27
# @Last Modified by: omi
# @Last Modified time: 2015-01-30 18:05:08
'''
网易云音乐 Player
'''
# Let's make some noise
import subprocess
import threading
import time
import os
import signal
import random
import re
from ui import ... |
qq.py | import logging
import sqlite3
import threading
import time
class Scanner:
def __init__(self, database_name, file_name):
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(levelname)s %(message)s",
datefmt='%Y-%m-%d %H:%M:%S',
)
self.logger ... |
unused_scrapyModels.py |
import scrapy
from scrapy.crawler import CrawlerProcess
import scrapy
import scrapy.crawler as crawler
from multiprocessing import Process, Queue
from twisted.internet import reactor
from scrapy.utils.log import configure_logging
import json
class IoeSpider(scrapy.Spider):
name = "ioe"
start_urls = [
... |
gpio.py | # Copyright (c) 2012-2017 Ben Croston <ben@croston.org>.
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2021, Texas Instruments Incorporated. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentat... |
tello_with datareading.py | # coding=utf-8
import logging
import socket
import time
import threading
import queue
import cv2
import numpy as np
from threading import Thread
from djitellopy.decorators import accepts
class Tello:
"""Python wrapper to interact with the Ryze Tello drone using the official Tello api.
Tello API documentation:... |
test_dist_optim.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
import dgl
import sys
import numpy as np
import time
import socket
from scipy import sparse as spsp
import torch as th
from dgl.distributed import DistGraphServer, DistGraph
from dgl.distributed import partition_graph, load_partition_book
import multiprocessing as mp
from ... |
flann_parse_results.py | import threading, os, sys
import numpy as np
'''
This script parses the results from flann_parallel_search.py.
Its output is a CSV of the form (img1, img2, distance), iff img2 is within
the 10-ANN of img1.
'''
if len(sys.argv) != 4:
print "usage: python flann_parse_results.py dict_path result_path output_path"
exit... |
worker.py | import os
import sys
import json
import platform
import socket
import signal
import logging
import logging.config
import threading
import traceback
import argparse
import multiprocessing
from time import monotonic
from typing import Dict, Any, List, Tuple # noqa
import amqp
from kuyruk import importer, signals
from ... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import argparse
import json
import multiprocessing
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.