source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
reconnect_test.py | import sys
import time
from threading import Thread, Event
from hazelcast import HazelcastClient
from hazelcast.errors import HazelcastError, TargetDisconnectedError
from hazelcast.lifecycle import LifecycleState
from hazelcast.util import AtomicInteger
from tests.base import HazelcastTestCase
from tests.util import e... |
main.py | from threading import Thread
from collections import Counter, OrderedDict
import subprocess
import time, datetime
import statistics
from IPython.display import display
import ipywidgets as widgets
import matplotlib
from launcher.study import Study
import sys
sys.path.append('/home/docker/melissa/melissa')
sys.path.ap... |
portable_runner.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 us... |
tensorboard_manager.py | # -*- coding: utf-8 -*-
import os
import sys
import threading
import time
import itertools
from collections import namedtuple
import logging
sys.argv = ["tensorboard"]
from tensorboard.backend import application # noqa
try:
# Tensorboard 0.4.x series
from tensorboard import default
ge... |
camera.py | import cv2
import base64
from socketIO_client import SocketIO, BaseNamespace
import numpy as np
import time
from PIL import Image
from threading import Thread, ThreadError
import io
img_np = None
socketIO = SocketIO('http://192.168.0.102', 8020)
live_namespace = socketIO.define(BaseNamespace, '/live')
def receive_eve... |
test_poll.py | # Test case for the os.poll() function
import os
import subprocess
import random
import select
import threading
import time
import unittest
from test.support import TESTFN, run_unittest, reap_threads, cpython_only
try:
select.poll
except AttributeError:
raise unittest.SkipTest("select.poll not d... |
updateOWLfilesFromOutputs.py | import shutil
from multiprocessing import Process
import time
import rdflib
def prepareDataToUpdate():
taskList = []
with open('outputBusOPF.txt') as fileNow:
linesNow = fileNow.readlines()
for line in linesNow:
splittedLine = line.split('\t')
index = str('{0:03}'.format(int(splittedLine[0])))
bus... |
demo.py | import logging
from multiprocessing import Process, Queue
from pathlib import Path
from suitcase.jsonl import Serializer
from bluesky import RunEngine
from ophyd.sim import det, det4, noisy_det, motor, motor1, motor2, img
from bluesky.plans import scan, count, grid_scan
from bluesky.preprocessors import SupplementalDa... |
test_proxy.py | import threading
import websocket
import json
import time
def on_open(ws):
print("opened")
auth_data = {
"action": "authenticate",
"data": {"key_id": "INSERT_KEY", "secret_key": "INSERT_KEY"}
}
ws.send(json.dumps(auth_data))
listen_message = {"action": "listen", "data": {"streams... |
videoio.py | from pathlib import Path
from enum import Enum
from collections import deque
from urllib.parse import urlparse
import subprocess
import threading
import logging
import cv2
logger = logging.getLogger(__name__)
# set up logging
LOG_PATH_GSTREAMER_CAPTURE = 'site/gstreamer_capture.log'
LOG_PATH_GSTREAMER_WRITE = 'site/g... |
threadScheduler.py | import threading
import os.path
import time
from blueThreadLoop import MainBlue
# class myThread (threading.Thread):
# def __init__(self, threadID, name, counter):
# threading.Thread.__init__(self)
# self.threadID = threadID
# self.name = name
# self.counter = counter
# def run(self):
# print(... |
piDcMotor.py | #!/usr/bin/python3
# File name : piDcMotor.py
# Description : encapsulates a DC motor connected via Raspberry Pi's GPIO
from time import sleep
from piServices.piUtils import timePrint, startThread
import RPi.GPIO as GPIO
from iotServerLib import piIotNode
# motor states:
# stop - the motor is stop
# starting - ... |
test_seed_cachelock.py | # This file is part of the MapProxy project.
# Copyright (C) 2012 Omniscale <http://omniscale.de>
#
# 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/LICEN... |
button.py | import os
import threading
import time
if os.uname()[1] == 'raspberrypi':
import RPi.GPIO as GPIO
class ArcadeButton:
def __init__(self):
if os.uname()[1] == 'raspberrypi':
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(5, GPIO.IN, pull_up_down=GPIO... |
maskdetection.py | import os
import threading
import argparse
import filetype
import base64
import cv2
import numpy as np
from PIL import Image
from io import BytesIO
from datetime import datetime
from flask import Flask, Response, make_response, send_file
from flask import flash, request, redirect, jsonify
from flask import render_tem... |
test_operator_gpu.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... |
main.pyw | #####################################################################
# #
# /main.pyw #
# #
# Copyright 2013, Monash University ... |
build_environment.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
"""
This module contains all routines related to setting up the package
build environment. All of this is set up by packa... |
test_websocket.py | import asyncio
import functools
import threading
import requests
import pytest
import websockets
from contextlib import contextmanager
from uvicorn.protocols.http import HttpToolsProtocol
class WebSocketResponse:
persist = False
def __init__(self, scope):
self.scope = scope
async def __call__(s... |
spark_backend.py | import pkg_resources
import sys
import os
import json
import socket
import socketserver
from threading import Thread
import py4j
import pyspark
from typing import List
import hail as hl
from hail.utils.java import Env, scala_package_object, scala_object
from hail.expr.types import dtype
from hail.expr.table_type impo... |
__init__.py | #
# Unit tests for the multiprocessing package
#
import unittest
import unittest.mock
import queue as pyqueue
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import subprocess
import struct
import operator
import p... |
top.py | #!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import logging
import time
from queue import PriorityQueue
from threading import Thread
from typing import Any, Optional
from .cache import JobFilter, TopCache
from .signalr import Stream
from .top_view import render
de... |
queue_m1.py | from collections import namedtuple
import multiprocessing as mp
import random
import time
VALUES = (100, 200, 500, 1000)
Coin = namedtuple('Coin', ['value'])
def reader(queue):
termination_threshold = 25
termination_count = 0
reader_sum = 0
while termination_count < termination_threshold:
if... |
discretization.py | # Copyright (c) 2011-2016 by California Institute of Technology
# Copyright (c) 2016 by The Regents of the University of Michigan
# 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. Redistrib... |
run.py | #!/usr/bin/env python
"""dMRI preprocessing workflow."""
from .. import config
def main():
"""Entry point."""
import os
import sys
import gc
from multiprocessing import Process, Manager
from .parser import parse_args
from ..utils.bids import write_derivative_description
parse_args()
... |
test_logging.py | #!/usr/bin/env python
#
# Copyright 2001-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copy... |
screens.py | import asyncio
from weakref import ref
from decimal import Decimal
import re
import threading
import traceback, sys
from typing import TYPE_CHECKING, List, Optional
from kivy.app import App
from kivy.cache import Cache
from kivy.clock import Clock
from kivy.compat import string_types
from kivy.properties import (Objec... |
looper.py | """A Looper mode for detecting and looping over a particular section."""
import OSC
import threading
import time
from Psc2.modes import mode
class Looper(mode.Mode):
"""A Looper Mode that can loop over a set of pre-defined sections.
It will start playback of the loop upon demand. The tempo can be set via
call... |
tor-spider.py | import pymysql.cursors
from maga import Maga
from struct import pack,unpack
from time import sleep, time
import time
from queue import Queue
import asyncio
import threading
import socket
import signal
import requests
import json
import os
import base64
import bencoder
import math
from pybloom_live import ScalableBloomF... |
monitor_test.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import multiprocessing
import subprocess
import time
import unittest
import ray
class MonitorTest(unittest.TestCase):
def _testCleanupOnDriverExit(self, num_redis_shards):
stdout = subprocess.che... |
setlist.py | from concurrent.futures import ThreadPoolExecutor
from threading import Thread
from typing import Any, Iterable
from pydantic import BaseModel
from playbacker.audiofile import AudioFile
from playbacker.song import Song
class Setlist(BaseModel):
name: str
songs: list[Song]
preloaded: bool = False
de... |
wordSimilarity.py | import urllib.request
import sys
import json
import math
from urllib.parse import quote
from threading import Thread
class WordSimilarity:
scoreDictionary = {}
scoreDictionary['esa'] = 0
scoreDictionary['swoogle'] = 0
# 1 - EasyESA client
# a score of 1 and -1 results in a perfect match
# treshold values to co... |
AVR_Miner.py | #!/usr/bin/env python3
"""
Duino-Coin Official AVR Miner 3.1 © MIT licensed
https://duinocoin.com
https://github.com/revoxhere/duino-coin
Duino-Coin Team & Community 2019-2022
"""
from os import _exit, mkdir
from os import name as osname
from os import path
from os import system as ossystem
from platform import machin... |
volume.py | import collections
import io
import logging
import os
import subprocess
import re
import tempfile
import threading
import shutil
import warnings
from imagemounter import _util, filesystems, FILE_SYSTEM_TYPES, VOLUME_SYSTEM_TYPES, dependencies
from imagemounter.exceptions import NoMountpointAvailableError, SubsystemErr... |
binance_pairs_ema.py | import requests
import json
import os
import time
from threading import Thread
from bfxhfindicators import EMA
BASE_URL = 'https://api.binance.com'
TIMEFRAME = '15m'
EMA_PERIODS = [96, 288]
symbols = []
candles = {}
prices = {}
ema_values = {}
def load_candles(sym):
global candles, prices, BASE_URL
payload ... |
settings_20210906111013.py | """
Django settings for First_Wish project.
Generated by 'django-admin startproject' using Django 3.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathli... |
test_snapshot.py | import unittest
from unittest.mock import patch
from http.server import BaseHTTPRequestHandler, HTTPServer
from threading import Thread
import httpretty
from selenium.webdriver import Firefox, FirefoxOptions
from percy import percy_snapshot, percySnapshot
import percy.snapshot as local
LABEL = local.LABEL
# mock a s... |
pydevd.py | '''
Entry point module (keep at root):
This module starts the debugger.
'''
import sys # @NoMove
if sys.version_info[:2] < (2, 6):
raise RuntimeError('The PyDev.Debugger requires Python 2.6 onwards to be run. If you need to use an older Python version, use an older version of the debugger.')
import atexit
from c... |
ground_seg.py | ######################################
#######realsense plotting#############
######################################
'''
Working with
UBUNTU 16.04 LTS
OPENCV 4.0~
Python 3.6
pyrealsense2
matplotlib
numpy
for intel D435i
font
'''
import numpy as np
import cv2
import matplotlib.pyplot as plt
... |
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... |
data_service_ops_test.py | # Copyright 2020 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... |
puyself.py | # -*- coding: utf-8 -*-
import PUY
from PUY.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 import BeautifulSoup
from urllib import urlopen
import req... |
manager.py | #!/usr/bin/env python3
import datetime
import importlib
import os
import sys
import fcntl
import errno
import signal
import shutil
import subprocess
import textwrap
import time
import traceback
from multiprocessing import Process
from typing import Dict
from common.basedir import BASEDIR
from common.spinner import Sp... |
doom_multiagent_wrapper.py | import threading
import time
from enum import Enum
from multiprocessing import Process
from queue import Empty, Queue
import faster_fifo
import cv2
import filelock
import gym
from filelock import FileLock
from sample_factory.envs.doom.doom_gym import doom_lock_file
from sample_factory.envs.doom.doom_render import con... |
run_oversampled_afterburner.py | import csv
import os
import sys
from multiprocessing import Process, current_process
import datetime as dt
import time
print("### Starting afterburner oversampling routine ###")
start_time = time.time()
# stop spawning sampling/afterburner events when
# the total number of hadrons summed over all samples
# is great... |
validate.py | #!/usr/bin/env python3
import argparse
import os, atexit
import textwrap
import time
import tempfile
import threading, subprocess
import barrier, finishedSignal
import random
import signal
import random
import time
from enum import Enum
from collections import defaultdict, OrderedDict
BARRIER_IP = "localhost"
BA... |
utils.py | from biosimulators_utils.log.data_model import CombineArchiveLog # noqa: F401
from biosimulators_utils.report.data_model import SedDocumentResults # noqa: F401
from ...exceptions import RequestTimeoutException
import functools
import importlib
import multiprocessing
import os
import sys
import time
import types # no... |
registrations.py | import threading
from .uri import *
class WAMPRegistrations(object):
def __init__(self):
self.registered = WAMPURIList()
self.subscribed = WAMPURIList()
def register_local(self,uri,callback,options=None):
""" Registers a local function for handling requests.
This is the en... |
bayesactinteractive.py | """------------------------------------------------------------------------------------------
Bayesian Affect Control Theory
Interactive Example
Author: Jesse Hoey jhoey@cs.uwaterloo.ca http://www.cs.uwaterloo.ca/~jhoey
September 2013
Use for research purposes only.
Please do not re-distribute without written permis... |
map_dataset_op_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... |
client.py | import socket
import threading
import sys
import datetime
class Client:
soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # make TCP connection on IPv4
port = 800
buffSize = 1024
def __init__(self, ip):
self.ip = ip
self.soc.connect((self.ip, self.port))
#sendTh = threading.Thread(target=s... |
parallel_senders.py | import threading
import BB
class ParallelSender(object):
'''
Sends a command and waits for the answer in parallel to other thread's execution,
allowing other thread's to poll if the response have been received.
:param Command command: Command to be sent, must be an instance of class Command.
:... |
audio_listener.py | #!/usr/bin/env python
import mpl_toolkits # import before pathlib
import sys
import os
import pathlib
import time
import shutil
from functools import partial
from multiprocessing.dummy import Pool
import threading
from io import BytesIO
import traceback
from timeit import default_timer as timer
from typing import Uni... |
rpc_server.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.
"""The task RPC server code.
This server is an XML-RPC server which serves code from
rpc_methods.RPCMethods.
This server will run until shutdown is called ... |
iTrader.py | from tkinter import *
from tkinter import Menu
from tkinter import ttk
from tkinter.ttk import Combobox
from tkinter import messagebox
import tkinter.font as font
from binance_api import Binance
import threading
import time
import datetime
import os
import os.path
#Основные глобальные переменные
ep... |
2021-11-21-cmind-drawncode.py | import threading, socket
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import sys
from worrd import gud
def recvMsg(soc): #좌표 받음
while True:
data = soc.recv(15)
msg = data.decode()
a=msg.split(',')
ex.sok(a[0],a[1],a[2],a[3])
soc.close()
cla... |
controller.py | import io
import itertools
import re
import subprocess
from threading import Thread
from core.data_extractor import DataExtractor
from core.objects.annotation import Annotation
from core.utils import ends_with_slash
class AnnotationsPageController:
data_extractor: DataExtractor
def view_annotation(self, ann... |
cameraClass.py | import cv2
import numpy as np
from time import sleep
from threading import Thread
class cameraClassPi:
def __init__(self):
from picamera import PiCamera
from picamera.array import PiRGBArray
# initialize the camera and stream
self.camera = PiCamera()
#self.camera.senso... |
uart_provider.py | import os
import re
import sys
import time
import json
import binascii
import math
# import asyncio
import datetime
import threading
import struct
from azure.storage.blob import BlockBlobService
from ...framework.utils import helper
from ...framework.utils import resource
from ..base import OpenDeviceBase
from ..config... |
myfork.py | import time
from multiprocessing import Process
def f(name):
print('hello', name)
print('我是子进程')
if __name__ == '__main__':
p = Process(target=f, args=('bob',))
p.start()
time.sleep(15)
print('执行主进程的内容了')
|
tttclient.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 10 14:19:06 2020
This Tic-tac-toe Games is COMP-2100 Group 1 Final Project
Submitted to Prof. Othman, Salem
@author: Boonpeng, Pikulkaew (Pk)
@author: DiMarzio, Ariane
@author: Sajjad, Tania
This project uses PyGame for creating GUI
There are 2 types of ga... |
test_processpool.py | # Copyright 2018 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 accompa... |
server.py | import json
import logging
import os
import uuid
from typing import List
import sys
import cache
import math
import base64
from random import randint
from multiprocessing import Process, Pool
from threading import Thread
import boto3
import botocore
import requests
import uvicorn as uvicorn
from fastapi import FastAPI... |
thread_queue.py | #线程间通信
import time
import threading
import variables # 不能用from variables import detail_url_list 因为这样会导致一个线程的修改其他线程看不到
from threading import Condition
#1. 生产者当生产10个url以后就就等待,保证detail_url_list中最多只有十个url
#2. 当url_list为空的时候,消费者就暂停
def get_detail_html(lock):
#爬取文章详情页
detail_url_list = variables.detail_url_list
... |
pipeline_http_client.py | # Copyright (c) 2020 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 appli... |
random_explore.py | import json
import time
import os
import random
import multiprocessing
import numpy as np
import tensorflow as tf
import nsm
from nsm import data_utils
from nsm import env_factory
from nsm import graph_factory
from nsm import model_factory
from nsm import agent_factory
from nsm import executor_factory
from nsm import... |
conftest.py | import pytest
import time
from context import HGECtx, HGECtxError, ActionsWebhookServer, EvtsWebhookServer, HGECtxGQLServer, GQLWsClient, PytestConf, GraphQLWSClient
import threading
from auth_webhook_server import create_server, stop_server
import random
from datetime import datetime
import sys
import os
from collecti... |
tasktools.py | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
# Copyright (c) 2018 Juniper Networks, Inc.
# All rights reserved.
# Use is subject to license terms.
#
# Author: cklewar
import datetime
import os
import select
import socket
import threading
import lib.constants as c
from jnpr.junos.exception import *
f... |
index.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The web server to handle requests from the clients to search queries
and handle requests for crawling new web pages. The server runs on the
python web-server framework called Flask. Incoming client requests are
handled and tasks are added to Redis task queues for proce... |
__init__.py | import netifaces
import socket
import time
import threading
def Get_IP():
ips = {"ext": [], "local": []}
for inface in netifaces.interfaces():
try:
ip = netifaces.ifaddresses(inface)[netifaces.AF_INET][0]['addr']
if "127" == ip[:3]:
ips['local'].append(ip)
... |
test_ssl.py | import pytest
import threading
import socket as stdlib_socket
import ssl
from contextlib import contextmanager
from functools import partial
from OpenSSL import SSL
import trustme
from async_generator import async_generator, yield_, asynccontextmanager
import trio
from .. import _core
from .._highlevel_socket import... |
xmp_integration.py | #
# xmp_integration.py
#
# Tools for loading MegaDetector batch API results into XMP metadata, specifically
# for consumption in digiKam:
#
# https://cran.r-project.org/web/packages/camtrapR/vignettes/camtrapr2.html
#
#%% Imports and constants
import argparse
import tkinter
from tkinter import ttk, messagebox, fi... |
datalogger.py | '''
Created on Oct 6, 2018
@author: Vinu Karthek
'''
import os, datetime, threading
from classes import tkinter_app
import logging
try:
import tkinter as tk # Python 3.x
import tkinter.scrolledtext as ScrolledText
except ImportError:
import Tkinter as tk # Python 2.x
import ScrolledText
class datalog... |
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... |
lit.py | """
Author: Animesh Koratana <koratana@stanford.edu>
LIT: Lightweight Iterative Trainer
"""
import os
import time
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.cuda
import torch.optim
import torch.utils.data
from tqdm i... |
vChat2.0.py | #coding:utf-8
from socket import *
import time, threading
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
serverName = '118.89.229.68';
sendPort = 12001;
receivePort = 12002;
checkPort = 12003;
userName = "";
key = "";
pwd = "";
def sendThread():
while 1:
sentence = raw_input();
sentence +=... |
server.py | from flask import Flask, render_template, redirect, request
import string
import signal
import sys
from threading import Thread
import control
app = Flask(__name__)
current_function = None
controller = control.Control()
control_thread = None
@app.route('/')
def index():
return render_template('index.html', fun... |
main.py | # -*- coding: utf-8 -*-
"""Persistence agent."""
import argparse
import os
import sys
import threading
from kubernetes import client
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from projects.agent.logger import DEFAULT_LOG_LEVEL
from projects.agent.watchers.deployment ... |
azure_util.py | from azure.identity import AzureCliCredential
from azure.identity._credentials import azure_cli
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.network import NetworkManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.network.v2020_06_01.models import Network... |
local_timer_example.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# 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.
import logging
import multiprocessing as mp
import signal
import time
import unittest
imp... |
get_photo_info.py | import flickrapi
import psycopg2
import threading
import traceback
from ast import literal_eval
import json
def data_walker(method, searchstring='*/photo', **params):
"""Calls 'method' with page=0, page=1 etc. until the total
number of pages has been visited. Yields the photos
returned.
As... |
server.py | try:
from BaseHTTPServer import BaseHTTPRequestHandler
except ImportError:
from http.server import BaseHTTPRequestHandler
try:
from BaseHTTPServer import HTTPServer
except ImportError:
from http.server import HTTPServer
try:
import urllib.parse as urlparse
except ImportError:
import urlparse
... |
tunnel.py | """Basic ssh tunnel utilities, and convenience functions for tunneling
zeromq connections.
Authors
-------
* Min RK
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full... |
cpu_vs_gpu.py | # Usage: python cpu_vs_gpu.py
import time
from multiprocessing import Process
def do_cpu():
import _dynet as C
C.init()
cm = C.Model()
cpW = cm.add_parameters((1000,1000))
s = time.time()
C.renew_cg()
W = C.parameter(cpW)
W = W*W*W*W*W*W*W
z = C.squared_distance(W,W)
z.value()
z.backward()
pri... |
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... |
managers.py | #
# Module providing manager classes for dealing
# with shared objects
#
# multiprocessing/managers.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
__all__ = [ 'BaseManager', 'SyncManager', 'BaseProxy', 'Token',
'SharedMemoryManager' ]
#
# Imports
#
import sys... |
httpserver.py | import socket
import threading
import re
import os
HOST = 'localhost';
PORT = 3333;
BUFSIZE = 4096;
#http ヘッダー群
LINE = '\n';
HTTP_200_STATUS = 'HTTP/1.0 200 OK\n';
HTTP_404_STATUS = 'HTTP/1.0 404 Not Found\n';
SERVER_NAME = 'Server: Python Http Server\n';
CONTENT_TYPE = 'Content-Type: text/html; charset=UTF-8\n'
def... |
loader.py | """
The Salt loader is the core to Salt's plugin system, the loader scans
directories for python loadable code and organizes the code into the
plugin interfaces used by Salt.
"""
import contextvars
import copy
import functools
import importlib.machinery # pylint: disable=no-name-in-module,import-error
import importli... |
openNeuroService.py | """
A command-line service to be run where the OpenNeuro data is downloaded and cached.
This service instantiates a BidsInterface object for serving the data back to the client
running in the cloud. It connects to the remote projectServer.
Once a connection is established it waits for requets and invokes the BidsInterf... |
threading_global_1.py | #!/usr/bin/env python3
import threading
import time
import random
mylist = [ ]
def hello(n):
time.sleep(random.randint(1,3))
mylist.append(threading.get_ident()) # bad in real code!
print("[{0}] Hello!".format(n))
threads = [ ]
for i in range(10):
t = threading.Thread(target=hello, args=(i,))
... |
image_view2_wrapper.py | from rqt_gui_py.plugin import Plugin
import python_qt_binding.QtGui as QtGui
from python_qt_binding.QtGui import (QAction, QIcon, QMenu, QWidget,
QPainter, QColor, QFont, QBrush,
QPen, QMessageBox, QSizePolicy,
... |
e03parallel.py | #!/usr/bin/env python3
"""
./e03parallel.py http://camlistore.org 2
Found 37 urls
...
"""
from queue import Queue
from sys import argv
from threading import Thread
from e01extract import canonicalize, extract
from e02crawl import print_crawl
def crawl_parallel(start_url, max_depth):
fetch_queue = Queue() # (c... |
PBR.py | from threading import Thread, Event
from time import sleep
from core.device.abstract import Connector
from core.log import Logger
from custom.devices.Phenometrics.libs.communication import Connection
class PBR(Connector):
class PumpManager:
def __init__(self, device_id, connection: Connection):
... |
py_portscanner.py | #!/usr/bin/env python
import socket, sys
from threading import Thread
# Easily changeable variables (you can extend the timeout length if necessary)
threads = []
timeout = 0.5
# Inputs & simple error handling
try:
host = raw_input("Enter Target Host Address: ")
hostIP = socket.gethostbyname(host)
startPort =... |
qdb.py | #!/usr/bin/env python
# coding:utf-8
"Queues(Pipe)-based independent remote client-server Python Debugger"
__author__ = "Mariano Reingart (reingart@gmail.com)"
__copyright__ = "Copyright (C) 2011 Mariano Reingart"
__license__ = "LGPL 3.0"
__version__ = "1.01b"
# remote debugger queue-based (jsonrpc-like interface):
... |
test_http_server.py | from collections import OrderedDict
from mock_decorators import setup, teardown
from threading import Thread
from poster.encode import MultipartParam
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
import urllib
def http_test(res, url, get=None, post=None):
... |
views.py | # # scans and scan settings
import logging
from threading import Thread
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.shortcuts import render... |
sniper.py |
from scapy.sendrecv import sniff
from scapy.sendrecv import sendp
from scapy.config import conf
from scapy.layers.dot11 import Dot11
from scapy.layers.dot11 import RadioTap
from scapy.layers.dot11 import Raw
from scapy.layers.dot11 import Dot11Deauth
from utils import org
import signal
import sys
import time
import th... |
sshCalCopy.py | #!/usr/bin/python
import paramiko
import sys
import os
import string
import threading
import time
import select
from datetime import datetime
# from fileNameGui import FileGUI
# import fileNameGui
# from Tkinter import *
import qs
global threads
threads = []
global upload
upload = False
class FileCopy:
... |
email.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = Me... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.