source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
word2vec.py | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
base.py | import abc
from threading import Event, Thread
from typing import Any, Dict, Generic, Optional, Tuple, TypeVar
from idom.core.component import ComponentConstructor
_App = TypeVar("_App", bound=Any)
_Config = TypeVar("_Config", bound=Any)
_Self = TypeVar("_Self", bound="AbstractRenderServer[Any, Any]")
class Abstra... |
example1.py | import threading
import random
import time
def update():
global counter
current_counter = counter # reading in shared resource
time.sleep(random.randint(0, 1)) # simulating heavy calculations
counter = current_counter + 1 # updating shared resource
counter = 0
threads = [threading.Thread(target=upda... |
annotator.py | # TODO: Add this as an entry point in setup.py, so it can be run directly.
"""Tkinter-based app for annotating samples."""
import bz2
import dbm
import json
import threading
import time
import traceback
from io import BytesIO
from tkinter import Tk, Canvas, Text, END, Scrollbar, VERTICAL, HORIZONTAL, Frame, Label, But... |
fileio3.py | # File Transfer model #2
#
# In which the client requests each chunk individually, thus
# eliminating server queue overflows, but at a cost in speed.
from __future__ import print_function
import os
from threading import Thread
import zmq
from zhelpers import socket_set_hwm, zpipe
CHUNK_SIZE = 250000
PIPELINE = 10
... |
dumpjson.py | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... |
test_decimal.py | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz (aahz at pobox.com)
# and Tim Peters
"""
These are the test cases for the Decim... |
steps.py | from gevent import monkey
monkey.patch_all(subprocess=True)
import os
import sys
cwd = os.path.dirname(os.path.abspath(__file__))
scalrpy_dir = os.path.normpath(os.path.join(cwd, '../../..'))
sys.path.insert(0, scalrpy_dir)
scalrpytests_dir = os.path.join(cwd, '../..')
sys.path.insert(0, scalrpytests_dir)
from scalr... |
main.py | from threading import Thread
import pandas as pd
import warnings
import time
import os
import gc
from miraiml.util import is_valid_filename
from miraiml.core import MiraiSeeker, Ensembler
from miraiml.core import load_base_model, dump_base_model
class SearchSpace:
"""
This class represents the search space o... |
test_session.py | import os
localDir = os.path.dirname(__file__)
import sys
import threading
import time
import cherrypy
from cherrypy._cpcompat import copykeys, HTTPConnection, HTTPSConnection
from cherrypy.lib import sessions
from cherrypy.lib.httputil import response_codes
def http_methods_allowed(methods=['GET', 'HEAD']):
meth... |
get_photon_data.py | """Top level code that takes a atmosphere phase map and propagates a wavefront through the system"""
import os
import numpy as np
import traceback
import multiprocessing
import glob
import random
import pickle as pickle
import time
from proper_mod import prop_run
from medis.Utils.plot_tools import quicklook_im, view_d... |
manual_ai.py | from threading import Thread
from typing import List
from pathlib import Path
from drivebuildclient.aiExchangeMessages_pb2 import SimulationID
def _handle_vehicle(sid: SimulationID, vid: str, requests: List[str]) -> None:
vid_obj = VehicleID()
vid_obj.vid = vid
while True:
print(sid.sid + ": Tes... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
import sys
from test import test_support
import _testcapi
for name in dir(_testcapi):
if name.startswith('test_'):
test = getattr(_testcapi, name)
if... |
callback.py | from utlis.rank import setrank,isrank,remrank,remsudos,setsudo,GPranks,IDrank
from utlis.send import send_msg, BYusers, Sendto, fwdto,Name,Glang,getAge
from utlis.locks import st,getOR,Clang,st_res
from utlis.tg import Bot
from config import *
from pyrogram.types import ReplyKeyboardMarkup, InlineKeyboardMarkup, Inlin... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
import unittest.mock
from test import support
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
from test.support import threading_helper
from test.support import warnings_helper
import sock... |
lineups.py | #!./../../tools/python/bin/python
import os
import sys
from datetime import datetime
import queue
import threading
import time
def processLinueups():
while 1:
time.sleep(2)
print('hi'+str(a))
def __init__(self):
pass
def conditions():
return True
if __name__ == '__main__':
... |
road_speed_limiter.py | import json
import os
import select
import threading
import time
import socket
import fcntl
import struct
from threading import Thread
from cereal import messaging
from common.params import Params
from common.numpy_fast import interp, clip
from common.realtime import sec_since_boot
from selfdrive.config import Conversi... |
client.py | from network import Handler, poll
import sys
from threading import Thread
from time import sleep
myname = raw_input('What is your name? ')
class Client(Handler):
def on_close(self):
pass
def on_msg(self, msg):
print msg
host, port = 'localhost', 8888
client = Client(host, p... |
wallet.py | import copy, hashlib, json, logging, os
from time import time
from hwilib.descriptor import AddChecksum
from .device import Device
from .key import Key
from .helpers import decode_base58, der_to_bytes, get_xpub_fingerprint, sort_descriptor, fslock, parse_utxo
from hwilib.serializations import PSBT, CTransaction
from io... |
explore.py | # -*- coding: utf-8 -*-
from explorepy.bt_client import BtClient
from explorepy.parser import Parser
from explorepy.dashboard.dashboard import Dashboard
from explorepy._exceptions import *
from explorepy.packet import CommandRCV, CommandStatus, CalibrationInfo, DeviceInfo
from explorepy.tools import FileRecorder
import... |
wallet.py | # Electrum ABC - lightweight eCash client
# Copyright (C) 2020 The Electrum ABC developers
# Copyright (C) 2015 Thomas Voegtlin
#
# 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 restr... |
commentroulette.py | import praw
import random
from threading import Thread
import time
import requests
r = praw.Reddit('comment_roulette'
'Url:http://imtoopoorforaurl.com')
r.login()
def findNegCommentsAndDelete():
while(1):
comments = r.user.get_comments('new')
for comment in comments:
if(comment.score < 0):
comment.delet... |
gui.py | import sys
import os
import xbmc
import xbmcgui
import xbmcplugin
import threading
import socket
import urllib
from Queue import Queue
import plugins
import ConfigParser
import logging
import difflib
try: current_dlg_id = xbmcgui.getCurrentWindowDialogId()
except: current_dlg_id = 0
current_win_id = xbmcgui.getCurrent... |
app_utils.py | # import the necessary packages
import struct
import six
import collections
import cv2
import datetime
import subprocess as sp
import json
import numpy
import time
from matplotlib import colors
from threading import Thread
class FPS:
def __init__(self):
# store the start time, end time, and total number... |
TestPersistentPg.py | """Test the PersistentPg module.
Note:
We don't test performance here, so the test does not predicate
whether PersistentPg actually will help in improving performance or not.
We also assume that the underlying SteadyPg connections are tested.
Copyright and credit info:
* This test was contributed by Christoph Zwersc... |
utilities.py | #!/usr/bin/env python3
"""This module is used for miscellaneous utilities."""
import glob # cap grabbing
import hashlib # base url creation
import itertools # spinners gonna spin
import os # path work
import platform # platform info
import subprocess # loader verification
import sys # streams, version info
impo... |
04_demo_newtork.py | from multiprocessing import freeze_support
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import scipy.interpolate
import scipy.ndimage.filters
import threading
import dataset.cifar10_dataset
from network import activation
from network.layers.conv_to_fully_connected impor... |
test_fork1.py | """This test checks for correct fork() behavior.
"""
import _imp as imp
import os
import signal
import sys
import time
from test.fork_wait import ForkWait
from test.support import (run_unittest, reap_children, get_attribute,
import_module, verbose)
threading = import_module('threading')
# ... |
data_generator.py | import os
import cv2
import numpy as np
import random
import threading, queue
import argparse
from tqdm import tqdm
from fragment_generator import generate_fragment, positive_trait, negative_trait
DIMENSION_X, DIMENSION_Y = 224, 224
# write images asynchronously to disk to unblock computation
to_write = queue.Queu... |
plugin.py | import threading
from binascii import hexlify, unhexlify
from commerciumelectro.util import bfh, bh2u
from commerciumelectro.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT, NetworkConstants)
from commerciumelectro.i18n import _
from commerciumelectro.... |
msg_multiproc.py | import numpy as np
from multiprocessing import Pipe, Process
from . import Env
# LISTEN only needed for Windows, potentially MacOS, since SC2 on linux is headless
START, STEP, LISTEN, RESET, STOP, DONE = range(6)
class MsgProcEnv(Env):
def __init__(self, env):
super().__init__(env.id)
self._env =... |
bili_relation.py | import os
import time
import json
import redis
import requests
import signal
import random
from multiprocessing import Process, Pool
from bos_filter import RedisDB, BosFilter
from bili_mongo import BosMongo
rdb = RedisDB()
mbd = BosMongo()
bf = BosFilter()
r = redis.Redis(host="127.0.0.1")
redis_key = "bili_relation_... |
area.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 20 10:48:31 2021
@author: jon-f
"""
import os
import subprocess
import threading
from datetime import date
import glob
import time
import math
from IPython.display import display
import datetime as dt
import pytz
import matplotlib.pyplot as plt
import n... |
__main__.py | #####################################################################
# #
# __main__.py #
# #
# Copyright 2013, Monash University ... |
client_helper.py | import json
import pickle
import sys
import time
from threading import Thread
from random import Random
from bitarray import bitarray
from bitarray.util import hex2ba, ba2hex
from chat_bot import Bot
from udp_handler import Tracker
from chat_client import Chat
from Crypto.Cipher import AES, PKCS1_OAEP
from Crypto.Publ... |
MicrosoftTeams.py | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
import requests
from distutils.util import strtobool
from flask import Flask, request, Response
from gevent.pywsgi import WSGIServer
import jwt
import time
from threading import Thread
from typing import... |
firehose.py | #! /usr/bin/env awx-python
#
# !!! READ BEFORE POINTING THIS AT YOUR FOOT !!!
#
# This script attempts to connect to an AWX database and insert (by default)
# a billion main_jobevent rows as screamingly fast as possible.
#
# tl;dr for best results, feed it high IOPS.
#
# this script exists *solely* for the purpose of ... |
exchange_rate.py | from datetime import datetime
import inspect
import requests
import sys
import os
import json
from threading import Thread
import time
import csv
import decimal
from decimal import Decimal
from .bitcoin import COIN
from .i18n import _
from .util import PrintError, ThreadJob
# See https://en.wikipedia.org/wiki/ISO_42... |
manager.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import vim
import os
import sys
import json
import time
import operator
import itertools
import threading
import multiprocessing
from functools import partial
from functools import wraps
from .instance import LfInstance
from .cli import LfCli
from .utils import *
from .fuz... |
Misc.py | ## @file
# Common routines used by all tools
#
# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license m... |
prepro.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
import copy
import threading
import time
import numpy as np
import tensorlayer as tl
import scipy
import scipy.ndimage as ndi
from scipy import linalg
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
import skimag... |
main.py | #!/usr/bin/env python
# Author: Ryan Myers
# Models: Jeff Styers, Reagan Heller
#
# Last Updated: 2015-03-13
#
# This tutorial provides an example of creating a character
# and having it walk around on uneven terrain, as well
# as implementing a fully rotatable camera.
from gtts import gTTS
from playsound import plays... |
Milestone1.py | from concurrent.futures import thread
import threading
import datetime
import time
from nbformat import write
import yaml
with open('Milestone1B.yaml', 'r') as file:
data = yaml.safe_load(file)
output = open("Milestone1B.txt", "w")
def TimeFunction(ExecutionTime):
time.sleep(ExecutionTime)
def execWorkFlow(t... |
map_stage_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... |
pypanda_target.py | from threading import Thread
from time import sleep
from avatar2.targets import PandaTarget
from ..watchmen import watch
from .target import action_valid_decorator_factory, TargetStates
class PyPandaTarget(PandaTarget):
'''
The pypanda target is a PANDA target, but uses pypanda to run the framework.
'''... |
test_titlegiver.py | # coding=utf-8
import threading
import urllib
import os
import json
import urllib.parse
import unittest
import http.server
from plugins.titlegiver.titlegiver import Titlegiver
__author__ = "tigge"
__author__ = "reggna"
class Handler(http.server.BaseHTTPRequestHandler):
def redirect(self):
count = int(se... |
nanoleaf.py | """nanoleafapi
This module is a Python 3 wrapper for the Nanoleaf OpenAPI.
It provides an easy way to use many of the functions available in the API.
It supports the Light Panels (previously Aurora), Canvas and Shapes (including Hexgaons)."""
import json
from threading import Thread
import colorsys
import os
from typ... |
tab_pyenergenie_server2.py | #!/usr/bin/python
import time
import energenie
import sys
import os
import threading
import RPi.GPIO as GPIO
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from httplib2 import Http
import traceback
from energenie import OpenThings
from energenie import Devices
class PIRCallback:
def __init__(self,se... |
help.py | """Provide help information."""
import collections
import http.server
import threading
import jinja2
def register(bot):
threading.Thread(target=help_server, args=(bot,), daemon=True).start()
bot.listen(r'^help$', help, require_mention=True)
bot.listen(r'^macros$', help_macro, require_mention=True)
def ... |
decorators.py | from threading import Thread
def async(f):
def wrapper(*args, **kwargs):
thr = Thread(target = f, args = args, kwargs = kwargs)
thr.start()
return wrapper
|
rpc_channel.py | # Copyright (c) 2019 Platform9 Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
SimpleDiscord.py | import os
import json
import urllib3
from threading import Thread
import signal
import websocket
import time
#import zlib
from enum import IntEnum
from dataclasses import dataclass
#import io
import re
from simplediscord.utils import mylogger
# Discord opcodes
class Op_Code(IntEnum):
DISPATCH = 0
... |
wallet.py | import threading
import os
import time
import random
import codecs
import requests
import json
from ecdsa import SigningKey, SECP256k1
import sha3
import traceback
maxPage = pow(2,256) / 128
def getRandPage():
return random.randint(1, maxPage)
def getPage(pageNum):
keyList = []
addrList = []
addrStr ... |
callbacks.py | import os
import tempfile
import time
from copy import deepcopy
from functools import wraps
from threading import Thread
from typing import Optional
import optuna
from sb3_contrib import TQC
from stable_baselines3 import SAC
from stable_baselines3.common.callbacks import BaseCallback, EvalCallback
from stable_baseline... |
pyscriptrunner.py | from subprocess import Popen, PIPE
from threading import Thread
from Queue import Queue, Empty
from multiprocessing.pool import ThreadPool
import os
import tempfile
import sys
import atexit
# Queue to keep track of stdout
io_q = Queue()
result = Queue()
def stream_watcher(identifier, stream):
for line in stream... |
Stock_source_utils.py | from collections import deque
from datetime import datetime
from cassandra import ConsistencyLevel
from cassandra.query import BatchStatement
from threading import Event, Thread, Timer
import time
import json
class StockDataQueue:
def __init__(self, stock_symbol, interval_type, length, c_session):
self.que... |
GASRansomwareByModification.py | # Imports
import os # to get system root
import webbrowser # to load webbrowser to go to specific website eg bitcoin
import ctypes # so we can intereact with windows dlls and change windows background etc
import urllib.request # used for downloading and saving background image
import requests # used to make... |
CCWatcher.py | import re
import sys
import logging
import argparse
import requests
from scapy.all import *
from colorama import init
from threading import Thread
from termcolor import colored
#Color Windows
init()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def arguments():
parser = argparse.Ar... |
TAXIIServer.py | import demistomock as demisto
from CommonServerPython import *
from flask import Flask, request, make_response, Response, stream_with_context
from gevent.pywsgi import WSGIServer
from urllib.parse import urlparse, ParseResult
from tempfile import NamedTemporaryFile
from base64 import b64decode
from typing import Callab... |
server.py | # This standalone server is adapted from the worker code,
# but is meant to work in a standalone fashion without the
# need for a central server. Results are written to s3.
# testing with curl
# curl -H "Content-Type: application/json" -d '{"id": "asdf", "text_prompt": "A cute cartoon frog", "iterations": 100}' http:/... |
_a4c_post_configure_source.py |
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
from cloudify.state import ctx_parameters as inputs
import subprocess
import os
import re
import sys
import time
import threading
import platform
from StringIO import StringIO
from cloudify_rest_client import CloudifyClient
from cloudify im... |
controller.py | import logging
from threading import Thread
import time
from monitor.sensors import AbstractSensor
from monitor.repository import AbstractRepository
LOG = logging.getLogger('monitor_logger')
class Controller:
'''
Controller for sensors.
'''
def __init__(self, repo: AbstractRepository):
self.... |
gui.py | from tkinter import *
from tkinter.font import *
from guiExtensions.tk_extensions import ScrollableTV
### imports for running simulation
import csv
import time
import threading
root = Tk()
root.resizable(0, 0)
root.title("ble-simulation")
ff10=Font(family="Consolas", size=10)
ff10b=Font(family="Consolas", size=10, we... |
repo_manager.py | # ===============================================================================
# Copyright 2013 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... |
graphviz_visualizer_no_ros.py | # Copyright (c) 2021 Fynn Boyer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
getpodcast.py | #! /usr/bin/env python3
"""My Podcaster."""
import datetime
import email.utils
from subprocess import call, check_output
import mimetypes
import os
import re
import shutil
import socket
import urllib.error
import urllib.request
import requests
import tqdm
import random
import signal
from Podcast import Podcast
import c... |
views.py | from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from .forms import FolderForm, CardsForm
from .multithreads import *
from threading import Thread
from .models import CardFolder, MultiCard
@login_required
de... |
run_squad_ColabTCPTrans_quicktest_20191113.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... |
gpsstreamer.py | """
This illustrates a simple HTTP wrapper around the
pynmneagps NMEAStreamer streaming and parsing example.
It displays selected GPS data on a dynamically updated web page
using the native Python 3 http.server library and a RESTful API
implemented by the pynmeagps streaming and parsing service.
NB: Must be... |
tcp_test.py | #!/usr/bin/python3
# Copyright 2016 ETH Zurich
#
# 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... |
heartbeat.py | import asyncio
import time
import threading
class HeartBeat:
def __init__(self, rust_api) -> None:
self.rust_api = rust_api
self.next_run = time.time()
self.running = False
async def start_beat(self) -> None:
if self.running:
return
def wrapper(self, lo... |
executor.py | """Driver of the test execution framework."""
from __future__ import absolute_import
import threading
import time
from . import fixtures
from . import hook_test_archival as archival
from . import hooks as _hooks
from . import job as _job
from . import report as _report
from . import testcases
from .. import config a... |
main.py | import locale
import platform
import signal
import ssl
import sys
import threading
import time
from datetime import datetime
from multiprocessing import current_process, active_children
from typing import cast
import psutil
from colorama import Fore
from packaging import version
from psutil import Process
from yawast... |
model_helper_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... |
locapp.py | # coding:utf-8
import threading
from flask import Flask, request, Response, send_from_directory, make_response, render_template
import json
import gevent.monkey
from gevent.pywsgi import WSGIServer
import redis
from flask.ext.cors import CORS
gevent.monkey.patch_all()
# 内部引用
from wifilist.mongoquery import getquerydate... |
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 ... |
exec_proc_.py | import os
import signal
import subprocess
import sys
import types
from contextlib import contextmanager
from logging import getLogger
from threading import Thread
from typing import *
__all__ = ['timed_wait_proc', 'exec_proc']
OutputCallbackType = Callable[[bytes], None]
def timed_wait_proc(proc: subprocess.Popen, ... |
__init__.py | # -*- coding: utf-8 -*-
"""Miscellaneous helper functions (not wiki-dependent)."""
#
# (C) Pywikibot team, 2008-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id: 7e1c9c15b0d121bbe9e36717aa3be86d42ac86c0 $'
import collections
import g... |
parallel.py | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import operator
import sys
from threading import Lock
from threading import Semaphore
from threading import Thread
from docker.errors import APIError
from docker.errors import ImageNotFound
from six.moves import _thread as t... |
dispatcher.py | # (C) Copyright 1996-2018 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergov... |
custom_model.py | import json
import threading
from moto import settings
from moto.core.models import CloudFormationModel
from moto.awslambda import lambda_backends
from uuid import uuid4
class CustomModel(CloudFormationModel):
def __init__(self, region_name, request_id, logical_id, resource_name):
self.region_name = regi... |
roomba.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python 3.* (thanks to pschmitt for adding Python 3 compatibility).
Program to connect to Roomba 980 vacuum cleaner, dcode json, and forward to mqtt
server.
Nick Waterton 24th April 2017: V 1.0: Initial Release
Nick Waterton 4th July 2017 V 1.1.1: Fixed MQTT protoco... |
fritzbox_callmonitor.py | """
A sensor to monitor incoming and outgoing phone calls on a Fritz!Box router.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.fritzbox_callmonitor/
"""
import logging
import socket
import threading
import datetime
import time
import re
import v... |
main.py | from modules.Alfa.alfa import Alfa
import threading
import sys
alfa = Alfa()
if __name__ == "__main__":
try:
thread = threading.Thread(target=alfa.reciveData)
thread.daemon = True
thread.start()
alfa.sendData()
except KeyboardInterrupt:
sys.exit(0)
|
netcom.py | #!/usr/bin/python
import SocketServer, socket
import threading, Queue
import hashlib, netaddr
import argparse
class Communicator:
"""The communication module of the server, handling receipt and transmission of data over the network with a SocketServer and verifying messages with an md5 hash."""
# NOTE/TODO: T... |
parallel.py | import datetime
import logging
import os
import shutil
import tempfile
import signal
from multiprocessing import Process, Manager
from tests.common.helpers.assertions import pytest_assert as pt_assert
logger = logging.getLogger(__name__)
def parallel_run(target, args, kwargs, nodes, timeout=None):
"""Run target ... |
ClientStart.py | #!/usr/bin/env python2
import __builtin__
__builtin__.process = 'client'
# Temporary hack patch:
__builtin__.__dict__.update(__import__('pandac.PandaModules', fromlist=['*']).__dict__)
from direct.extensions_native import HTTPChannel_extensions
from direct.extensions_native import Mat3_extensions
from direct.extensio... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import _thread
import importlib.machinery
import importlib.util
import os
import pickle
import random
import re
import subprocess
impo... |
CheckX.py | from multiprocessing.dummy import Pool as ThreadPool
from os import path, mkdir, system, name
from threading import Thread, Lock
from time import sleep, strftime, gmtime, time
from traceback import format_exc
from colorama import Fore, init
from console.utils import set_title
from easygui import fileopenbox
f... |
network.py | from . import settings as globalsettings
from . import functions, command
import socket, pickle, datetime, errno, select
from threading import Thread
class User():
def __init__(self, socket, ip, username=''):
self.socket = socket
self.ip = ip
self.username = username
self.admin = False
def get_user_ip(self... |
test_events.py | """Tests for events.py."""
import functools
import gc
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import threading
import time
import errno
import unittest
from unittest import mock
import weakref
if sys.... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_pac.util import bfh, bh2u, UserCancelled
from electrum_pac.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
TYPE_ADDRESS, TYPE_SCRIPT)
from electrum_pac import constants
from electrum_pac.i18n ... |
Task.py | # Copyright 2019 Braxton Mckee
#
# 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 t... |
test_p2p_grpform.py | # P2P group formation test cases
# Copyright (c) 2013-2014, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
logger = logging.getLogger()
import time
import threading
import Queue
import os
import hostapd
import hwsim_utils
... |
run.py | import os
import coverage
import atexit
import signal
import threading
from typing import List
from gevent import monkey, signal as gevent_signal
from redis import StrictRedis
from cnaas_nms.app_settings import api_settings
# Do late imports for anything cnaas/flask related so we can do gevent monkey patch, see below
... |
manager.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: unicorn_binance_websocket_api/manager.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://www.lucit.tech/unicorn-binance-websocket-api.html
# Github: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api
# Documentat... |
run-tests.py | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Li... |
lambda_executors.py | import base64
import contextlib
import glob
import json
import logging
import os
import re
import subprocess
import sys
import threading
import time
import traceback
import uuid
from multiprocessing import Process, Queue
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from localstack import config... |
test_legacymultiproc_nondaemon.py | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Testing module for functions and classes from multiproc.py
"""
# Import packages
import os
import sys
from tempfile import mkdtemp
from shutil import rmtree
import pytest
import ... |
test_sys.py | # -*- coding: iso-8859-1 -*-
import unittest, test.test_support
import sys, cStringIO, os
import struct
class SysModuleTest(unittest.TestCase):
def test_original_displayhook(self):
import __builtin__
savestdout = sys.stdout
out = cStringIO.StringIO()
sys.stdout = out
dh = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.