source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
ddp.py | # Copyright 2021 MosaicML. All Rights Reserved.
from __future__ import annotations
import collections.abc
import logging
import os
import subprocess
import sys
import time
import warnings
from abc import ABC, abstractmethod
from dataclasses import dataclass
from threading import Thread
from typing import Callable, It... |
test_sys.py | import builtins
import codecs
import gc
import locale
import operator
import os
import struct
import subprocess
import sys
import sysconfig
import test.support
from test import support
from test.support import os_helper
from test.support.script_helper import assert_python_ok, assert_python_failure
from test.support imp... |
mp.py | import os
import psutil
import sys
from multiprocessing import Process, Lock, Event as ProcessEvent
from multiprocessing.pool import ThreadPool
from threading import Thread, Event as TrEvent
from time import sleep
from typing import List, Dict
from ..py3_interop import AbstractContextManager
try:
from multiproces... |
transaction.py | #!/usr/bin/python3
import functools
import sys
import threading
import time
from enum import IntEnum
from hashlib import sha1
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
import black
import requests
from eth_abi import decode_abi
from hexbytes import HexByte... |
utils.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2012-11-06 11:50:13
import logging
import hashlib
import datetime
import socket
import base64
import six
from six import iteritems
md5string = lambda x: ... |
build_mscoco_data.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... |
flterm.py | #!/usr/bin/env python3.5
# This file is Copyright (c) 2015-2020 M-Labs Limited.
# License: BSD
import sys
import os
import time
import asyncio
import asyncserial
import serial
import argparse
if sys.platform == "win32":
import msvcrt
import threading
def init_getkey(callback):
loop = asyncio.ge... |
utils.py | #
# Copyright (c) 2016 Christoph Heiss <me@christoph-heiss.me>
#
# 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
# to use, copy, m... |
runner.py | #!/usr/bin/env python3
# Copyright 2010 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.
"""This is the Emscripten test runner. To run ... |
test_qgsnetworkcontentfetcherregistry.py | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsNetworkContentFetcherRegistry
.. note:: This program 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 2 of the License, or
(at your option) any late... |
tube.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import logging
import re
import six
import string
import subprocess
import sys
import threading
import time
from six.moves import range
from pwnlib import atexit
from pwnlib import term
from pwnlib.context import context
f... |
robot_test.py | #!/usr/bin/env python3
import copy
import logging
import os
import pathlib
import re
import socket
import threading
from typing import Union
import queue
from functools import partial
import yaml
import pytest
from unittest import mock
import mecademicpy.robot as mdr
import mecademicpy.mx_robot_def as mx_def
import ... |
tcp_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Thomas Jackson <jacksontj.89@gmail.com>`
'''
# Import python libs
from __future__ import absolute_import
import os
import threading
import tornado.gen
import tornado.ioloop
from tornado.testing import AsyncTestCase
import salt.config
import salt.ext.six as six
imp... |
simple_queue.py | from cloudbutton.multiprocessing import Process, SimpleQueue
def f(q):
q.put([42, None, 'hello World'])
if __name__ == '__main__':
q = SimpleQueue()
p = Process(target=f, args=(q,))
p.start()
print(q.get()) # prints "[42, None, 'hello']"
p.join()
|
session.py | #
# Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
#
import os
import threading
from typing import List
import pyarrow
from bitstring import BitArray
import grpc
from pydeephaven._arrow_flight_service import ArrowFlightService
from pydeephaven._console_service import ConsoleService
from pydeephaven.... |
report.py | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import threading
fr... |
test.py | # -*- coding: utf8 -*-
from contextlib import contextmanager
from functools import wraps
from os.path import exists, join, realpath, dirname, split
import errno
import fcntl
import inspect
import logging
import os
import platform
import pty
import resource
import sh
import signal
import stat
import sys
import tempfile
... |
update_repository_manager.py | """
Determine if installed tool shed repositories have updates available in their respective tool sheds.
"""
import logging
import threading
from sqlalchemy import false
from galaxy import util
from galaxy.tool_shed.util.repository_util import get_tool_shed_status_for_installed_repository
from galaxy.tool_shed.util.s... |
0001.py | # -*- coding: utf-8 -*-
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 import BeautifulSoup
from urllib import urlopen
fr... |
adc.py | # Copyright 2019 The OpenRadar 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 applicable law... |
util.py | import wx
import os
import re
import time
import base64
import calendar
import urllib2
import urlparse
import threading
# not using in live bus
#import feedparser
from htmlentitydefs import name2codepoint
from settings import settings
def set_icon(window):
bundle = wx.IconBundle()
bundle.AddIco... |
generate_traffic.py | import requests
import argparse
import threading
import time
import json
import random
import uuid
global url
global keycloak
global username
global password
global bearer_token
global bad_request_rate
global match_filter_rate
bridges = []
processors = []
def create_bridge():
while True:
if (random.ran... |
test_itertools.py | import unittest
from test import support
from itertools import *
import weakref
from decimal import Decimal
from fractions import Fraction
import operator
import random
import copy
import pickle
from functools import reduce
import sys
import struct
import threading
import gc
maxsize = support.MAX_Py_ssize_t
minsize = ... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
pingbot.py | import os
import logging
import settings
import time
import multiprocessing
from pingbot_lib import Operations as op
from pingbot_lib import Prometheus as prom
#Instantiate prom
pr = prom()
o = op()
def pinghost(input_list):
for host in input_list:
success = o.ping(host['ip'])
if ... |
monitored_session_test.py | # pylint: disable=g-bad-file-header
# 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/LICENS... |
download_task_runner.py | import os
import sys
import importlib
import argparse
import Queue
from threading import Thread
from time import time, localtime, strftime, sleep
from ConfigParser import SafeConfigParser
import random
from prettytable import PrettyTable
import runner_util
from benchcloud.file_utils import file_util
from benchcloud.t... |
api_test.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 multiprocessing
import os
import unittest
from unittest.mock import patch
import ... |
deadline_test.py | import os
import sys
import time
from absl import app
from absl import flags
from multiprocessing import Process
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import erdos.graph
from erdos.data_stream import DataStream
from erdos.message import Message
from erdos.op import Op
from erdos... |
io_wrap.py | #!/usr/bin/env python
from __future__ import print_function
"""Utilities for capturing output from the current process and processes it
starts.
This file is also a test harness for I/O wrapping: run it as a script with a
shell command in the commandline arguments to see how PTY redirection behaves
for that command.
... |
TimerCommand.py | #!/usr/bin/env python
# Copyright European Organization for Nuclear Research (CERN)
#
# 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
#
# Authors:
... |
database_variot.py | import base64
import os
import numpy
import sys
import traceback
from database import Database
import queue
import threading
import os
from time import sleep
import pycurl
import json
import io
import requests
# Set up MAC address on server when ready, and use mac address as device ID; possibly token in the future
cla... |
DAQProvider.py |
import multiprocessing as mult
import logging
import re
import Queue
try:
import zmq
except ImportError:
print "no zmq installed..."
from SimDaqConnection import SimDaqConnection,SimDaqServer
from DaqConnection import DaqConnection,DaqServer
class DAQIOError(IOError):
pass
class DAQProvider:
"""
... |
manager.py | #!/usr/bin/env python3
import datetime
import os
import signal
import subprocess
import sys
import traceback
from multiprocessing import Process
import cereal.messaging as messaging
import selfdrive.crash as crash
from common.basedir import BASEDIR
from common.params import Params, ParamKeyType
from common.text_window... |
server.py | import socket
import time
import threading
from text_formatting import RED, END
from constants import HEADER_SIZE, DATA_LEFT_SIZE, PORT, MAX_SIZE, FORMAT, DISCONNECT, NOTHING, LENGTH, RESPOND,\
END, DATA
LENGTH_SIZE = HEADER_SIZE - (DATA_LEFT_SIZE + 2)
RESPOND_FLAG = LENGTH_SIZE
END_FLAG = LENGTH_SIZE + 1
class ... |
lf_several_queues.py | #!/usr/bin/env python
# encoding: utf-8
from azure.storage.queue import QueueService
from datetime import datetime
from common.common import *
import threading
import json
import random
def connect_queue():
queue_service = QueueService(ACCOUNT_NAME, ACCOUNT_KEY)
return queue_service
def create_queue(queue_se... |
skywatch.py | import json, os, requests, datetime
# import adafruit_dht
import board, time, glob
from adafruit_bme280 import basic as adafruit_bme280
import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library
import threading
import socket, subprocess, uuid, shutil
class systemInfo:
def __init__(self):
self.systemInfo = {}
# G... |
run_mxnet.py | """
This is a sample stub of loadgen with multiple processes support.
Each process sets its affinity by a proc list.
Loadgen is a producer, which calls issue_queries(). issue_queries() gets query
from loadgen and puts query id/sample indices into an input queue.
Each Consumer(process)'s run() reads input queue, calls... |
plugin.py | import queue
from threading import Thread, Barrier
class EtherSensePlugin:
def __init__(self, process_async, barrier):
self.process_async = process_async
self.barrier = barrier
self.__bypass = False
if self.process_async:
self.frame_queue = queue.Queue()
s... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. versionadded:: 2014.7.0
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
:depends:
- CherryPy Python module. Version 3.2.3 is currently recommended when
SSL is enabled, since this version worked the best with SSL in
internal testing.... |
HTTPServer.py | #!/usr/bin/python
"""
HTTPServer
"""
import os
import threading
import json
import zlib
from collections import OrderedDict
try:
from urlparse import urlparse, parse_qs
from SocketServer import ThreadingMixIn, TCPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
from u... |
engineer.py | import os
import numpy as np
import pandas as pd
from scipy.stats import skew, kurtosis, mode
# from constant import Constant
from .meta_feature_utils import sample_num_strategy # sample strategy
import random
import re
import easyocr # pip install easyocr
import torch
from facenet_pytorch import MTCNN # pip insta... |
device_manager.py | # Copyright 2017 MDSLAB - University of Messina
# 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
#
# U... |
tello-command.py | #!/usr/bin/python3
import threading
import socket
import time
tello_ip = "192.168.10.1"
"""
Tello port to send command message.
"""
command_port = 8889
"""
@brief Host IP address. 0.0.0.0 referring to current
host/computer IP address.
"""
host_ip = "0.0.0.0"
"""
@brief UDP port to receive response msg f... |
test_transport.py | """Unit tests for the transport module."""
from datetime import datetime
import logging
import queue
import os
import platform
import socket
import ssl
from struct import pack
import sys
import threading
import time
import pytest
from pydicom import dcmread
import pynetdicom
from pynetdicom import AE, evt, _config,... |
__init__.py | """
Flexible RPC client and server for Python classes based on ZeroMQ and MessagePack.
outrun primarily relies on RPC to expose the local file system by simply executing calls
like open(), readdir(), truncate(), symlink() over the network. With that it has a
couple of requirements that were not met by popular existing... |
test.py | #!/usr/bin/env python3
import os, sys, json, time, requests, copy, traceback, tempfile, threading, subprocess
from collections import OrderedDict
from subprocess import check_output
from multiprocessing import Pool
from contextlib import contextmanager
OLDIR = 'test-dir'
results = OrderedDict(... |
get_proxies.py | import json
import requests
import time
from bs4 import BeautifulSoup as Soup
import threading
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
'AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/64.0.3282.186 Safari/537.36'}
def dict2proxy(dic):
... |
1.1_rms_bankers_Speak.py | from functools import reduce
from sys import *
import numpy as np
import random as r
import ping_code as pc
import socket
import struct
import subprocess as sp
from threading import Thread
import paramiko
import ast
import time
import os
import getpass as gp
import data
hosts = {} # {hostname: ip}
multicast_group = '... |
raft.py | import json
import logging
import os
import threading
import time
from patroni.dcs import AbstractDCS, ClusterConfig, Cluster, Failover, Leader, Member, SyncState, TimelineHistory
from ..utils import validate_directory
from pysyncobj import SyncObj, SyncObjConf, replicated, FAIL_REASON
from pysyncobj.transport import ... |
pyshell.py | #! /usr/bin/env python3
import sys
if __name__ == "__main__":
sys.modules['idlelib.pyshell'] = sys.modules['__main__']
try:
from tkinter import *
except ImportError:
print("** IDLE can't import Tkinter.\n"
"Your Python may not be configured for Tk. **", file=sys.__stderr__)
raise SystemExit(... |
bug_state.py | """
This script goes over lists of bugs per predefined bugzilla query and outputs
a CSV with data to be digested elsewhere.
"""
from os import path
from os import remove
from sys import argv
from threading import Thread
import bug_state_statistics
import update_sheet
import common_functions
from bug_state_functions imp... |
stim_server_client.py | # Author: Mainak Jas <mainak@neuro.hut.fi>
# License: BSD (3-clause)
import queue
import time
import socket
import socketserver
import threading
import numpy as np
from ..utils import logger, verbose, fill_doc, deprecated
RT_MSG = ('The realtime module is being deprecated from `mne-python` '
'and moved to... |
wallet_multiwallet.py | #!/usr/bin/env python3
# Copyright (c) 2017-2020 The Mantle Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiwallet.
Verify that a mantled node can load multiple wallet files
"""
from decimal import Dec... |
map_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... |
cluster_monitor_2_test.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... |
client.py | # client.py
#
# Common client. Measure the response rate of the echo server
from socket import *
import time
from threading import Thread
import atexit
import sys
if len(sys.argv) > 1:
MSGSIZE = int(sys.argv[1])
else:
MSGSIZE = 1
msg = b'x'*MSGSIZE
sock = socket(AF_INET, SOCK_STREAM)
sock.connect(('localhos... |
voice_client.py | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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 to use, copy, modify, merg... |
StreamWebVideo.py | # import the necessary packages
from threading import Thread
import cv2
import time
from CameraMemory import CameraMemory
import logging
"""
Implement a URL based video stream.
Note: for some reason, reading / writing OPENCV cv2.CAP_PROPS* gives an error using
Python 3.7 and OpenCV 4.1. For now, don't sup... |
cli.py | # Leave a space between each Stock Symbol
import Stocks #Main API
import sys #To get Command Line arguments
import config #Config file API
import multiprocessing #It's obviuos :)
import time
StartEndString = "------------------------------------" #For neat printing.
StockApp = Stocks.Stocks() #Initialize API
bcolors... |
test_user_secrets.py | import json
import os
import subprocess
import threading
import unittest
from http.server import BaseHTTPRequestHandler, HTTPServer
from test.support import EnvironmentVarGuard
from urllib.parse import urlparse
from datetime import datetime, timedelta
import mock
from google.auth.exceptions import DefaultCredentialsEr... |
camera361.py | import time
import picamera
import picamera.array
from picamera.array import PiRGBAnalysis
import cv2
from gpiozero import Button
import threading
import sys
import random
import math
import numpy as np
import traceback
capture =False
running = True
analyze = False
text = False
cv2.namedWindow("window... |
TestAll.py | #!/usr/bin/env python
#coding: utf-8
import os
import re
import json
import time
import subprocess
import threading
from datetime import datetime
import psutil
import requests
TEST_SERVER_HOSTS = ['192.168.40.215', '192.168.40.91']
TEST_SERVER_PORT = 8999
TEST_REQ_TMPL = 'http://%(host)s:%(port)d/test'
APP_SERVER_I... |
main.py | """
The entry point to the Graphical user user interface for the capser project
trial software.
Author: Jonah Yolles-Murphy
...
FIXME: talk about the project architecture here.
...
"""
# import normal packages
import threading
import sys
#import threads
import user_interface as ui
from user_interface import *
impor... |
tts.py |
import threading
import subprocess
import os
def say(text):
threading.Thread(target=run_say, args=(text,)).start()
def run_say(text):
subprocess.call(["espeak", text], stdout=open(os.devnull, 'w'), stderr=subprocess.STDOUT) |
tumblr.py | #!/usr/bin/env python2
# vim: set fileencoding=utf8
from __future__ import unicode_literals
import os
import sys
import re
import json
import collections
import multiprocessing
import requests
requests.packages.urllib3.disable_warnings()
import argparse
import random
import time
import select
import signal
API_KEY =... |
TAsyncioServerTest.py | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 requi... |
master.py | """
A instagram user for posting medias.
"""
import os
import shutil
import settings
from instagram.base import BaseInstagram, MediaTypes
from common.tools import LockDir
from common.logger import logger
class MasterInstagram(BaseInstagram):
"Master instagram user"
def _start(self):
... |
threading.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, print_function, absolute_import,
division)
import sys
import threading
import time
import Queue
from time import sleep
from itertools import izip_longest
import logging
from qalib.qabase.formatters import... |
web.py | import click
import tensorflow as tf
from flask import Flask, jsonify, request, render_template
from threading import Thread
from PIL import Image
from six.moves import _thread
from luminoth.tools.checkpoint import get_checkpoint_config
from luminoth.utils.config import get_config, override_config_params
from luminot... |
measurePerformance.py | # ########################################################################
# Copyright 2013 Advanced Micro Devices, 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.apach... |
ch06_listing_source.py |
import bisect
from collections import defaultdict, deque
import json
import math
import os
import time
import unittest
import uuid
import zlib
import redis
QUIT = False
pipe = inv = item = buyer = seller = inventory = None
# <start id="_1314_14473_8380"/>
def add_update_contact(conn, user, contact):
ac_list = '... |
monitored_session_test.py | # pylint: disable=g-bad-file-header
# 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/LICENS... |
dataclient.py | """
This file implements a threaded stream controller to abstract a data stream
back to the ray clientserver.
"""
import logging
import queue
import threading
import grpc
from typing import Any
from typing import Dict
import ray.core.generated.ray_client_pb2 as ray_client_pb2
import ray.core.generated.ray_client_pb2_... |
remote_control.py | #!/usr/bin/env python3
import RPi.GPIO as GPIO
import time, threading
from datetime import datetime
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, DateTime, String, ForeignKey
from sqlalchemy.sql import select, func
#zaehler = 1
time.sleep(1)
CONN = create_engine('sqlite:////home/ampel2go/a... |
test_http.py | import asyncio
import contextlib
import os
import sys
import threading
import time
from collections import ChainMap
from http.server import BaseHTTPRequestHandler, HTTPServer
import pytest
import fsspec.asyn
import fsspec.utils
fsspec.utils.setup_logging(logger_name="fsspec.http")
requests = pytest.importorskip("re... |
compression.py | """
Module for compression and decompression investigations.
This module is the main contribution of my master thesis.
"""
import bz2
from datetime import datetime
import gzip
import logging
import lzma
from pathlib import Path
import shutil
import threading
import zlib
import cv2
import numpy as np
class Compress... |
execution_manager.py | import subprocess
import threading
import os
from utils import logger_utils
from utils.managers.manager import Manager
from utils.managers.project_manager import ProjectManager
class ExecutionManager(Manager):
__LOGGER = logger_utils.get_logger(__name__)
@classmethod
def execute_program(cls, project, ma... |
client.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
from datetime import datetime
import os
import os.path
import shutil
import time
import tempfile
imp... |
interactive_session.py | import code
import logging
from threading import Thread
from .helpers import setup_logging
# Set up logging
setup_logging()
logger = logging.getLogger(__name__)
class InteractiveSession:
"""
Starting an InteractiveConsole and constantly checking
"""
mitm_handler = None
def __init__(self, mitm_... |
startcollection.py | # coding:utf-8
import threading
import datetime
import time
from terminal.gethostapdfield import HOSTAPD
class T1:
def thread2(self):
count = 0
while True:
count += 1
print 'swm'
if count == 10:
break
return 'hello'
class T2:
def thread... |
Slider.py | import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import serial
import threading
class ServoSlider(QWidget):
def __init__(self, parent = None):
super(ServoSlider, self).__init__(parent)
layout = QVBoxLayout()
self.sl = QSlider(Qt.Horizontal)
self.sl.setMinimum(0)
... |
datasets.py | # Dataset utils and dataloaders
import glob
import logging
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, Exif... |
frontendcomm.py | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
In addition to the remote_call mechanism implemented in CommBase:
- Implements _wait_reply, so blocking calls can be made.
"""
import pickle
import socket
import... |
runserver.py | #!/usr/bin/env python
# Copyright 2013 Brett Slatkin
#
# 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... |
crawler.py | import sys
import socket
import time
import multiprocessing
def sendmsg(msgstr,client):
msg = msgstr.encode("utf-8")
data_length = len(msg) + 8
code = 689
dlbytes = int.to_bytes(data_length,4,'little')
header = dlbytes + dlbytes + int.to_bytes(code,4,'little')
client.send(header)
sent = 0
... |
preview.py | from io import BytesIO
import picamera
import threading
from PIL import Image, ImageDraw
from time import sleep
from display import show
class Preview:
running = False
camera_preview_thread = None
camera = None
lock = None
snap_path = None
resolution = (480,320)
screen = (480, 320)
re... |
multiprocessing3_queue.py | # View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
import multiprocessing as mp
def job(q):
res = 0
for i in range(1000):
res += i + i ** ... |
run_demos.py | import importlib
import json
import os
import subprocess
import sys
import threading
import time
import requests
LAUNCH_PERIOD = 60
GRADIO_DEMO_DIR = "../../demo"
sys.path.insert(0, GRADIO_DEMO_DIR)
with open("demos.json") as demos_file:
demo_port_sets = json.load(demos_file)
def launch_demo(demo_folder):
... |
cell_continuous_handler.py | from .cell_clear_selection import CellClearSelection
from ipme.utils.constants import COLORS, BORDER_COLORS, PLOT_HEIGHT, PLOT_WIDTH, SIZING_MODE, RUG_DIST_RATIO, RUG_SIZE
from ipme.utils.stats import kde
from ipme.utils.functions import find_inds_before_after, find_indices
from bokeh.models import BoxSelectTool, Ho... |
utilities.py | #!/bin/env python
# -*coding: UTF-8 -*-
#
# Disclaimer:
# Functions get_sys_info, netcdf_and_hdf5_versions and show_versions are from:
# xarray/util/print_versions.py
#
import os
import sys
import warnings
import urllib
import json
import collections
import copy
from functools import reduce
from packaging import ver... |
test_concurrency.py | import random
import threading
import time
from sqlalchemy import Column
from sqlalchemy import exc
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy... |
main.py | #!venv/Scripts/python.exe
import discord
from discord import permissions
from discord import webhook
from discord import channel
from discord.ext.commands.core import check
from dotenv import load_dotenv
import mysql.connector
from discord.ext import commands
import os
from discord.ext.commands import errors
import ra... |
ServerSide.py | import socket
import threading
def removeTokenandSendMessage(encryptedmsg):
msg = encryptedmsg[0:-1]
for i in range(0, len(ipA)):
server.sendto(msg.encode(character), (ipA[i], ipB[i]))
def serverSide():
global ipA, ipB
while True:
while True:
try:
msgBytes... |
vesper_recorder.py | """Module containing the `VesperRecorder` class."""
from http.server import HTTPServer, BaseHTTPRequestHandler
from logging import FileHandler, Formatter
from threading import Thread
import datetime
import logging
import math
import os
import wave
import pyaudio
import pytz
from vesper.util.audio_recorder import Au... |
abi_thread.py | #importing threading module
#to create threads
#threads are light weight process used for multi tasking
import threading
def division(a,b):
print("Normal as usual division:")
print(a/b)
def floordiv(a,b):
print("Floor rounded off division:")
print(a//b)
print("Enter two numbers:")
print("Number 1:")
num1=int(in... |
PlayGame.py | import pygame, numpy, threading, timeit
from .SceneBase import SceneBase
from .DrawingUtils import *
from models.game import Game, Board, Move, TimeLimitedBot
from services import ImageService, FontService, SceneManager, SettingsService as Settings
class PlayGame(SceneBase):
"""
This scene shows a graphical re... |
test_util_test.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
runtest.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import logging
import os
import random
import re
import setproctitle
import shutil
import string
import subprocess
import sys
import tempfile
import threading
import time
from collections import def... |
taskrunner.py | import sys
import time
import sys
from threading import Thread
from director import asynctaskqueue
from director.timercallback import TimerCallback
class TaskRunner(object):
def __init__(self):
self.interval = 1/60.0
sys.setcheckinterval(1000)
try:
sys.setswitchinterval(self.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.