source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
repairer.py | # -*- coding: utf-8 -*-
# Copyright 2013-2021 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
#
# Unless required by applicable law or a... |
app.py | """============================================================================
Python Dashboard produced to monitor timeseries data with high periodicity and search for anomlous regions in the data.
Dashboard largely developed based on tutorial located at https://realpython.com/python-dash/ and inspired by https://d... |
gdbclientutils.py | import os
import os.path
import threading
import socket
import lldb
import binascii
import traceback
from lldbsuite.support import seven
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbtest_config
def checksum(message):
"""
Calculate the GDB server protocol checksum of the message.
T... |
train.py | import numpy as np
import tf_models
from sklearn.preprocessing import scale
import tensorflow as tf
from tensorflow.keras.backend import learning_phase
from tensorflow.keras.layers import concatenate, Conv3D
from nibabel import load as load_nii
import os
import argparse
import keras
import glob
import Queue
from thread... |
rk05.py | #!/usr/bin/env python3
# This is a translation of Julius Schmidt's PDP-11 emulator in JavaScript.
# You can run that one in your browser: http://pdp11.aiju.de
# (c) 2011, Julius Schmidt, JavaScript implementation, MIT License
# (c) 2019, Andriy Makukha, ported to Python 3, MIT License
# Version 6 Unix (in the disk ima... |
action_queue.py | '''ActionQueue: a background worker that manages its own worker thread automatically.'''
from threading import Thread, Lock, Event
from queue import Queue, Empty
__all__ = [
'ActionQueue',
]
class ActionQueue:
'''A background worker that manages its own worker thread automatically.
Enqueue work items... |
MatlabModelDriver.py | import subprocess
import uuid as uuid_gen
import logging
from datetime import datetime
import os
import glob
import psutil
import warnings
import weakref
import io as sio
from yggdrasil import tools, platform, serialize
from yggdrasil.languages import get_language_dir
from yggdrasil.config import ygg_cfg
from yggdrasil... |
chatcommunicate.py | # coding=utf-8
from chatexchange import events
from chatexchange.browser import LoginError
from chatexchange.messages import Message
from chatexchange_extension import Client
import collections
import itertools
import os
import os.path
import queue
import regex
import requests
import sys
import threading
import time
im... |
message_handler.py | import threading
from time import sleep
import kernel
def bot_polling():
while True:
app = kernel.Kernel()
try:
bot_actions(app)
app.bot.polling(none_stop=True, interval=app.BOT_INTERVAL_POLLING, timeout=app.BOT_TIMEOUT_POLLING)
except Exception as ex:
... |
api.py | import flask
import requests
import argparse
import json
import websockets
import uuid
import asyncio
import logging
import re
import threading
from flask import Flask, request, jsonify
logging.basicConfig(filename='parlai_api.log', level=30)
parser = argparse.ArgumentParser(description="Simple API for ... |
TXT2EXCEL.py | # Author - Shane Carnahan
# Email - Shane.Carnahan1@gmail.com
# Date - 8/29/2018
# Project - TXT2EXCEL
# Module Version - 1.0
import glob, csv, xlwt, os, tkinter
from tkinter import *
from tkinter import messagebox
import tkinter.filedialog as filedialog
from pathlib import Path
from threading import Thread
from MyL... |
util.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 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 restriction,
# including without... |
worker.py | from contextlib import contextmanager
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
import sys
import threading
import time
import traceback
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Union
# Ray modules
from ra... |
multithreading_test.py | from do_something import *
import time
import threading
if __name__ == "__main__":
start_time = time.time()
size = 10000000
threads = 10
jobs = []
for i in range(0, threads):
out_list = list()
thread = threading.Thread(target=do_something(size, out_list))
jobs.append(thread)... |
subproc_vec_env.py | import multiprocessing as mp
import numpy as np
from .vec_env import VecEnv, CloudpickleWrapper, clear_mpi_env_vars
def worker(remote, parent_remote, env_fn_wrappers):
def step_env(env, action):
ob, reward, done, info = env.step(action)
if done:
ob = env.reset()
return ob, rew... |
rage.py | #SKID THIS = BLACKLISTED! <3
#RAGE was made by ††#7777 | discord.gg/raided
import os, sys, time, requests, os.path, base64, json, threading, string, random, discord, asyncio, httpx, pyautogui, re, http.client, subprocess, shutil
from discord_webhook import DiscordWebhook
from itertools import cycle
from discord.... |
system_test.py | '''
Copyright (c) 2019, Arm Limited and Contributors
SPDX-License-Identifier: Apache-2.0
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 requ... |
inthread.py | from cogen.core import schedulers
from cogen.core.coroutines import coroutine
from cogen.core.events import Operation
from threading import Thread
class RunInThread(Operation):
def __init__(self, callable, args=(), kwargs=None):
self.callable = callable
self.args = args
self.kwargs = kwargs or {}
su... |
build.py | ## @file
# build a platform or a module
#
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
... |
control.py | #NAME: move.py
#DATE: 08/02/2019
#AUTH: Ryan McCartney, EEE Undergraduate, Queen's University Belfast
#DESC: A python class for moving the wheelchair in an intuative manner
#COPY: Copyright 2019, All Rights Reserved, Ryan McCartney
import numpy as np
import threading
import time
import math
import requests
import pyg... |
routes.py | from app import app, db, mail
from flask import render_template, flash, redirect, url_for, request, jsonify, session
from app.forms import LoginForm, RegistrationForm
from flask_login import current_user, login_user, logout_user, login_required
from flask_mail import Message
from app.models import User, History, Feedba... |
server.py | import os
import atexit
import multiprocessing
import cherrypy
from django.conf import settings
from django.core.management import call_command
from kolibri.content.utils import paths
from kolibri.content.utils.annotation import update_channel_metadata_cache
from kolibri.deployment.default.wsgi import application
de... |
EV0.00000002.py | #=======================================================================
VERSION = 'EXTINCTION EVENT v0.00000002 alpha release'
#=======================================================================
# python modules
import os
import sys
import json
import time
import math
import random
import warnings
import request... |
fuse.py | from __future__ import print_function
import os
import stat
from errno import ENOENT, EIO
from fuse import Operations, FuseOSError
import threading
import time
import pandas as pd
from fuse import FUSE
def str_to_time(s):
t = pd.to_datetime(s)
return t.to_datetime64().view('int64') / 1e9
class FUSEr(Operati... |
archiver.py | """ Code to facilitate delayed archiving of FITS files in the images directory """
import os
import time
import queue
import atexit
import shutil
from contextlib import suppress
from threading import Thread
from astropy import units as u
from panoptes.utils.utils import get_quantity_value
from panoptes.utils.time impo... |
test_api.py | """
mbed SDK
Copyright (c) 2011-2014 ARM Limited
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 wr... |
pyi3.py | #!/usr/bin/env python3
import threading
import json
import queue
import socket
import struct
import subprocess
__author__ = 'Adaephon'
msgTypes = [
'command',
'get_workspaces',
'subscribe',
'get_outputs',
'get_tree',
'get_marks',
'get_bar_config',
'get_version',
'get_binding_modes... |
kb_staging_exporterServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
callback_thread.py | from threading import Thread
from typing import Any, Iterable, Mapping
from types_extensions import Function, void, safe_type
class CallbackThread(Thread):
"""
An extension to python's threading API allowing for a callback to be executed upon completion of the given
function. The callback is executed wit... |
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... |
midi_pi.py | import cProfile
import pstats
import sys
import time
from threading import Thread
from config import Config
from display import Display
from i2c import I2C
from leds import Leds
from midi_ports import MidiPorts
from music import Music
from power import Power
from server import Server
from util import niceTime, updateP... |
test_interrupt.py | import os
import signal
import tempfile
import time
from threading import Thread
import pytest
from dagster import (
DagsterEventType,
Field,
ModeDefinition,
String,
execute_pipeline_iterator,
pipeline,
reconstructable,
resource,
seven,
solid,
)
from dagster.core.errors import D... |
count_primes.py | import sys
from multiprocessing import Process, Value, Lock
def is_prime(n):
if n <= 1:
return False
if n <= 3:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5;
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6... |
BotMonitor.py | #!/usr/bin/env python3
"""
Created on Apr 23, 2012
@author: moloch
---------
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as publishe... |
test_utils.py | # Copyright (c) 2010-2012 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 ... |
mt_sleep2.py | # Copyright (c) 2014 ASMlover. 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 retain the above copyright
# notice, this list ofconditions and the fol... |
ssh.py | # -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
test_io.py | import sys
import gzip
import os
import threading
from tempfile import mkstemp, NamedTemporaryFile
import time
from datetime import datetime
import warnings
import numpy as np
import numpy.ma as ma
from numpy.lib._iotools import ConverterError, ConverterLockError, \
ConversionWarning
fro... |
ALL_IN_ONE_C_2.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Импорт библиотек
import math
import rospy
import time
from sensor_msgs.msg import Image
from sensor_msgs.msg import CameraInfo
from std_msgs.msg import Int32, Header, Float32
from cv_bridge import CvBridge, CvBridgeError
import cv2
import numpy as np
from threading impo... |
test_forward.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
__init__.py | import os
import sys
import multiprocessing
import signal
import urlparse
from yumsync import util, progress
from yumsync.log import log
from yumsync.metadata import __version__
def sync(repos=None, callback=None):
""" Mirror repositories with configuration data from multiple sources.
Handles all input valida... |
model.py | from ctypes import *
import numpy as np
import os
import shutil
from threading import Thread
liblr = cdll.LoadLibrary(os.path.dirname(os.path.realpath(__file__))+'/liblr.so')
def accuracy(y, pred, size):
hit = 0.0
for i in range(size):
if y[i] == 1.0 and pred[i] > 0.5:
hit += 1.0
if y[i] == 0.0 ... |
tdPython1.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id: tdPython1.py $
"""
VirtualBox Validation Kit - Python Bindings Test #1
"""
__copyright__ = \
"""
Copyright (C) 2010-2015 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free so... |
Tasks.py | import sys
from threading import Thread
from collections import OrderedDict
from argparse import ArgumentTypeError
from time import sleep
from threading import Thread, Event
from alive_progress import alive_bar
from DocuTrace.Analysis.DataCollector import DataCollector
from DocuTrace.Analysis.ComputeData import Comput... |
rhcnode.py | #!/usr/bin/env python
# Copyright (c) 2019, The Personal Robotics Lab, The MuSHR Team, The Contributors of MuSHR
# License: BSD 3-Clause. See LICENSE.md file in root directory.
import cProfile
import os
import signal
import threading
import rospy
from ackermann_msgs.msg import AckermannDriveStamped
from geometry_msg... |
CARP_solver.py | import sys
import queue
import random
import time
import copy
import numpy as np
from multiprocessing import Process,Queue
file_path=sys.argv[1]
termin_time=sys.argv[3]
random_seed=sys.argv[5]
start=time.time()
random.seed(random_seed)
f=open(file_path,encoding='utf-8')
sentimentlist = []
for line in f:
s = line... |
smartcomponent.py | #####################################################
#
# smartcomponent.py
#
# Copyright 2007 Hewlett-Packard Development Company, L.P.
#
# Hewlett-Packard and the Hewlett-Packard logo are trademarks of
# Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries.
#
# Confidential computer software. ... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau... |
tpu_estimator.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... |
protocol.py | #############################################################################
#
# $Id: protocol.py,v 2.94 2007/03/04 01:45:49 irmen Exp $
# Pyro Protocol Adapters
#
# This is part of "Pyro" - Python Remote Objects
# which is (c) Irmen de Jong - irmen@users.sourceforge.net
#
#############################################... |
gamepad.py | import numpy as np
import cv2
from mss import mss
from PIL import Image
from skimage.transform import resize
from skimage.io import imread
import math
import pyvjoy
from threading import Thread
from inputs import get_gamepad
from inputs import devices
import time
from train import create_model
def resize_image(img):
... |
constellation_projector.py | # Standard imports
import datetime
import logging
import os
import threading
# Constellation imports
import config
import projector_control
class Projector:
"""Holds basic data about a projector"""
def __init__(self, id_, ip, connection_type, mac_address=None, make=None, password=None):
self.id = i... |
unlogger.py | #!/usr/bin/env python3
import argparse
import os
import sys
import zmq
import time
import signal
import multiprocessing
from uuid import uuid4
from collections import namedtuple
from collections import deque
from datetime import datetime
from cereal import log as capnp_log
from cereal.services import service_list
from... |
word2vec.py | import collections
import math
import multiprocessing
import os
import random
import threading
from copy import deepcopy
import pandas as pd
import numpy as np
import tensorflow as tf
from docluster.core import Model
from docluster.core.document_embedding import TfIdf
from docluster.core.preprocessing import Preproce... |
TWCManager.py | #! /usr/bin/python3
################################################################################
# Code and TWC protocol reverse engineering by Chris Dragon.
#
# Additional logs and hints provided by Teslamotorsclub.com users:
# TheNoOne, IanAmber, and twc.
# Thank you!
#
# For support and information, please re... |
s3.py | """
Object Store plugin for the Amazon Simple Storage Service (S3)
"""
import logging
import multiprocessing
import os
import shutil
import subprocess
import threading
import time
from datetime import datetime
from galaxy.exceptions import ObjectNotFound
from galaxy.util import string_as_bool, umask_fix_perms
from g... |
pi_face_gpio_digital.py | """PiFace GPIO pin implementing SPI."""
import threading
from raspy.invalid_operation_exception import InvalidOperationException
from raspy.object_disposed_exception import ObjectDisposedException
from raspy.io import pin_state
from raspy.io import pin_mode
from raspy.io import pin_pull_resistance
from raspy.io.io_exc... |
server.py | # Copyright (c) 2016-2021, Xilinx, Inc.
# 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. Redistributions of source code must retain the above copyright notice,
# this list o... |
profiled_async_ppo_atari_visual.py | # https://github.com/facebookresearch/torchbeast/blob/master/torchbeast/core/environment.py
import numpy as np
from collections import deque
import gym
from gym import spaces
import cv2
cv2.ocl.setUseOpenCL(False)
class NoopResetEnv(gym.Wrapper):
def __init__(self, env, noop_max=30):
"""Sample initial st... |
test_parallel_backend.py | # -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
"""
Tests the parallel backend
"""
import threading
import multiprocessing
import random
import os
import sys
import subprocess
import numpy as np
from numba import config, utils
from numba import unittest_support as unittest
from numba ... |
env.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2022 Valory AG
# Copyright 2018-2021 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... |
_testing.py | import bz2
from collections import Counter
from contextlib import contextmanager
from datetime import datetime
from functools import wraps
import gzip
import operator
import os
from shutil import rmtree
import string
import tempfile
from typing import Any, Callable, ContextManager, List, Optional, Type, Union, cast
imp... |
server.py | """
Command execution server process.
| Server process | | forkserver |
client server
run -------
client -> server
To allow use of any callable in the server we override the forkserver
implementation and do not
"""
from __future__ import annotations
import contextvars
import functools
import json
import loggi... |
jsview_3d.py |
from __future__ import absolute_import, division, print_function
from libtbx.math_utils import roundoff
import traceback
from cctbx.miller import display2 as display
from cctbx.array_family import flex
from cctbx import miller
from crys3d.hklview import HKLJavaScripts
from scitbx import graphics_utils
from scitbx impo... |
eval.py | import os
import json
import pprint
import random
import time
import torch
import torch.multiprocessing as mp
from data.preprocess import Dataset
from importlib import import_module
# import threading
class EvalMMT(object):
"""iTHOR-based interactive evaluation
Based on eval.py form the original Alfred repos... |
test_cancellation.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... |
localhost.py | #
# (C) Copyright Cloudlab URV 2021
#
# 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 wr... |
blc_hash.py | #!/usr/bin/env python
import sys
import threading
import Queue
import random
import time
import string
import hashlib
import argparse
import socket
import json
###
thread_list = []
charmap = string.lowercase + string.uppercase + string.digits
wait_to_send = [] # Stuff we've queued but can't send for various reasons.
... |
onnxruntime_test_python.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# -*- coding: UTF-8 -*-
import unittest
import os
import numpy as np
import onnxruntime as onnxrt
import threading
import sys
from helper import get_name
from onnxruntime.capi.onnxruntime_pybind11_state import Fail
class Te... |
__main__.py | """Script to set up and run central server.
Responsible for communication with computing nodes, primary backup, job
scheduling, load balancing, job-node matchmaking decisions etc.
Messages received from the node:
- JOB_SUBMIT: The node sends the job to be submitted for execution
in thi... |
app.py | from src.kafka_module.kf_service import process_layout_detector_kf, layout_detector_request_worker
from anuvaad_auditor.loghandler import log_info
from anuvaad_auditor.loghandler import log_error
from flask import Flask
from flask.blueprints import Blueprint
from flask_cors import CORS
from src import routes
import con... |
threading_utils.py | # Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Classes and functions related to threading."""
import functools
import inspect
import logging
import os
import sys
import threading
import tim... |
pyrebase.py | import requests
from requests import Session
from requests.exceptions import HTTPError
try:
from urllib.parse import urlencode, quote
except:
from urllib import urlencode, quote
import json
import math
from random import randrange
import time
from collections import OrderedDict
from .pyre_sseclient import SSEC... |
example_monitoring.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_monitoring.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/LUCIT-Systems-and-Development/unicorn-binance-websocket-api
# Documentation: https://lucit-systems-and-development.github.io/unicorn-binance-websocket-api
# Py... |
example_test.py | import re
import os
import socket
from threading import Thread
import ssl
from tiny_test_fw import DUT
import ttfw_idf
try:
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
except ImportError:
import http.server as BaseHTTPServer
from http.server import SimpleHTTPRequestHand... |
Binance Detect Moonings.py | """
Olorin Sledge Fork
Version: 1.28
Disclaimer
All investment strategies and investments involve risk of loss.
Nothing contained in this program, scripts, code or repositoy should be
construed as investment advice.Any reference to an investment's past or
potential performance is not, and should not be construed as, ... |
server.py | from os import chdir
from sys import stdout
from socketserver import ThreadingMixIn
from http.server import SimpleHTTPRequestHandler, HTTPServer
from threading import Thread
from websocket_server_api import WebsocketServer
from socket_server import new_client, message_received
lg = """
_ ____ ... |
rop.py | # coding=utf-8
# Copyright 2018 Sascha Schirra
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following di... |
common_service.py | """TcEx Framework Service Common module"""
# standard library
import json
import logging
import threading
import time
import traceback
import uuid
from datetime import datetime
from typing import Callable, Optional, Union
# first-party
from tcex.services.mqtt_message_broker import MqttMessageBroker
# get tcex logger
... |
raft.py | import threading
import time
import random
import json
import math
import sys
import os
from Queue import Queue,Empty
#ELECTION_TIMEOUT_LIMITS = (150, 300)
HEARTHBEAT_INTERVAL = 150
ELECTION_PERIOD = 1000 # 1s for a candidate to wait for others response
class RaftNode(object):
def __init__(self, i):
s... |
test_concat_runner.py | # Copyright 2021 Zilliz. 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 agree... |
mock.py | from .btcomm import BluetoothServer, BluetoothClient, BluetoothAdapter
from .dot import BlueDot
from .threads import WrapThread
from .constants import PROTOCOL_VERSION
CLIENT_NAME = "Mock client"
class MockBluetoothAdapter(BluetoothAdapter):
def __init__(self, device = "mock0", address = "00:00:00:00:00:00"):
... |
__init__.py | # Copyright 2013-2014 OpenStack Foundation
#
# 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 ... |
jd.py | import logging
import sqlite3
import threading
import time
class Converter(object):
def __init__(self, database_path, file_path):
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(levelname)s %(message)s",
datefmt='%Y-%m-%d %H:%M:%S',
)
sel... |
test_operator.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... |
TWCManager.py | #! /usr/bin/python3
################################################################################
# Code and TWC protocol reverse engineering by Chris Dragon.
#
# Additional logs and hints provided by Teslamotorsclub.com users:
# TheNoOne, IanAmber, and twc.
# Thank you!
#
# For support and information, please re... |
server.py | import socket, sys, json
import threading
def threadWork(client,adr):
try:
while True:
msg = client.recv(1024).decode('utf-8')
if not msg:
print("----------------------------------------------")
print(f'client {adr} closed')
print("---... |
command_control.py | # coding: utf-8
import sys
from flare.tools.utils import bcolors
from flare.base.config import flareConfig
try:
import pandas as pd
except:
print("Please make sure you have pandas installed. pip -r requirements.txt or pip install pandas")
sys.exit(0)
try:
from elasticsearch import Elasticsearch, help... |
python_thread_lock.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'线程锁'
__author__ = 'garyhu'
import threading,time,pdb;
balance = 0;
lock = threading.Lock();
def change_b(n):
global balance;
pdb.set_trace();# 调试断点
balance = balance - n;
balance = balance + n;
def run_task(n):
for i in range(100):
# ... |
serving_file_test.py | import requests
import random
from multiprocessing import Process
def test():
if random.randint(0, 1) == 0:
resp = requests.get("http://localhost:8080/statics/js/bootstrap.bundle.min.js")
else:
resp = requests.get("http://localhost:8080/statics/css/bootstrap.min.css")
if resp.status_code !... |
main.py | import os
import threading
from time import sleep
from enum import Enum
from twisted.internet import reactor, task
from shutil import copyfile
from neo.Core.Blockchain import Blockchain
from neo.Network.NodeLeader import NodeLeader
from neo.Implementations.Blockchains.LevelDB.LevelDBBlockchain import LevelDBBlockchain
... |
DeviceCfgBackup_v5.0.py | #encoding=utf-8
import paramiko,openpyxl,time,re,os,sys,threading
from threading import *
from netmiko import ConnectHandler
def gain_cfgIp(): #设备IP获取
fd=openpyxl.load_workbook(sys.path[0]+r'/DeviceIP.xlsx')
ip_sheet=fd['ip']
i=2
list_ip=[]
name_sw=[]
while ip_she... |
tracker.py | #!/usr/bin/env python3
#CS456 Assignment #3 - Tracker
#Daiyang Wang
#20646168
#Parameters: None
from socket import *
from threading import Thread, Lock
import sys, string, random, signal, json, collections
from packet import packet
import time
TERMINATE = False
peer_dict = {}
file_dict = {}
mesgs = collections.... |
Temperature.py | import paho.mqtt.client as mqtt
import threading
import random
import time
from tkinter import *
import datetime
##### Flags #####
TEMP_RISE = True
BROKER = "192.168.12.1"
TOPIC = 'internetofthings/sim/'
SUBTOPIC = 'temperature'
def show_values():
input_temp = w2.get()
while TRUE:
while True:
... |
LogCompiler.py | #!/usr/bin/python
# Copyright (c) 2017, Autonomous Networks Research Group. All rights reserved.
# Developed by:
# Autonomous Networks Research Group (ANRG)
# University of Southern California
# http://anrg.usc.edu/
# Contributors:
# Vidhi Goel
# Jake Goodman
# Jessica Koe
# Jun Shin
# Davina Z... |
bench.py | import sys
from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair
import queue, threading, time
if len(sys.argv) != 5:
print('Usage: python3 bench.py load_file_path run_file_path endpoints nthread')
sys.exit(1)
alice, bob = generate_keypair(), generate_keypair()
metadat... |
pitmRelay.py | #!/usr/bin/python
# piTempBuzzer
import os
import hashlib
import struct
import socket
import syslog
import sys
import threading
import time
from pitmCfg import pitmCfg
from pitmLCDisplay import *
from pitmMcastOperations import pitmMcast
from pitmLogHandler import pitmLogHandler
from gpiotools import gpiotools
class... |
wsdump.py | #!/Users/ethan/Documents/Proxabot/venv/bin/python3
"""
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software... |
oldtest.py | '''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
import unittest
import threading
import tornado_requests
import os
import json
import base64
import configparser
import common
import crypto
import tempfile
import signal
import subprocess
import queue
import uuid
im... |
script.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
try:
import queue
except ImportError:
import Queue as queue
import argparse
import importlib
import os
import sys
import threading
from spreadflow_observer_fs.protocol import MessageFactory
from patht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.