source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
lobby.py | # -*- coding: utf-8 -*-
import queue
import threading
import tkinter
import _thread
from pygame import mixer
import game
config = [1, 1, 0, 1500, 1, 50, 1, 1, 1]
map_name = "N/A"
class Lobby:
def __init__(self, sq, rq, players={}, num=None):
global config, map_name
self._... |
gpsReachUART.py | """
Richard Stanley
Rover Socket bind to port 9000. correction data is forwarded over UART
crontab command to add to rover for startup:
For nvidia:
@reboot root cd /home/nvidia/TitanRover2018/rover/core/servers/reach/ && screen -dmS reach && screen -S reach -X stuff "python gpsReachUART.py \015";
For pi:
... |
qarkMain.py | from __future__ import absolute_import
'''Copyright 2015 LinkedIn Corp. 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 ... |
utils.py | from __future__ import with_statement
from binascii import unhexlify
import contextlib
from functools import wraps, partial
import hashlib, logging
log = logging.getLogger(__name__)
import random, re, os, sys, tempfile, threading, time
from otp.ai.passlib.exc import PasslibHashWarning, PasslibConfigWarning
from otp.ai.... |
zip_cracker.py | import zipfile
import sys
import os
from threading import Thread
# Command line error handling
if len(sys.argv) < 3:
sys.exit('Zip password cracker, usage: %s <zipped_file_to_crack> <dictionary_path>' % sys.argv[0])
if not os.path.exists(sys.argv[1]):
sys.exit('ERROR: ZIP file %s was not found!' % sys.argv[1]... |
classes.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pygatt Class Definitions"""
__author__ = 'Greg Albrecht <gba@orionlabs.co>'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2015 Orion Labs'
import logging
import logging.handlers
import string
import time
import threading
from collections imp... |
pdusettings.py | #!/usr/bin/env python
import os
from requests import get as reqget, post as reqpost
from json import loads as jsonloads, dumps as jsondumps
from hashlib import sha1
from threading import Thread
from ftplib import FTP
from config import configSystem
import time
from shutil import copyfile
from subprocess import call as ... |
pool.py | """
Copyright 2020 The OneFlow 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 or agr... |
extract_melody.py | import os
import multiprocessing
import librosa
import numpy as np
import crepe
def get_melody_contour(melody, n_mels=None):
# quantize
freq_bin=librosa.core.mel_frequencies(n_mels=n_mels)
m_contr=np.zeros((freq_bin.shape[0], len(melody))).astype('float32')
for idx in range(len(melody)):
p=np.w... |
commander.py | import os
import signal
import subprocess
import threading
import time
from smiler.instrumenting.general_exceptions import MsgException
TIMEOUT_ERROR_VALUE = 1111
def runOnce(cmd, timeout_time=None, return_output=True, stdin_input=None):
"""Spawns a subprocess to run the given shell command.
Args:
... |
ComputeNodeTest.py | ##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
Aligner_3_matrices.py | from Bio import SeqIO, pairwise2
from Bio.SeqRecord import SeqRecord
from Bio.pairwise2 import format_alignment
import itertools, sys
from Bio.SubsMat import MatrixInfo
from Bio import Align
import warnings
import logging
print("DivProt alignment is currently running on your data!")
#out console messages or error to ... |
test_ssl.py | # Test the support for SSL and sockets
import sys
import unittest
from test import test_support
support = test_support
import asyncore
import socket
import select
import time
import gc
import os
import errno
import pprint
import urllib, urlparse
import traceback
import weakref
import functools
import platform
from con... |
test_sched.py | import queue
import sched
import threading
import time
import unittest
from test import support
TIMEOUT = support.SHORT_TIMEOUT
class Timer:
def __init__(self):
self._cond = threading.Condition()
self._time = 0
self._stop = 0
def time(self):
with self._cond... |
iombian_advertiser.py | #!/usr/bin/env python
import ipaddress
import logging
import threading
import time
from zeroconf import ServiceInfo, Zeroconf
logger = logging.getLogger(__name__)
class IoMBianAdvertiser(object):
def __init__(self, name, last_name, port=80, ip="192.168.10.100"):
self.name = name.lower()
self.last... |
model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
import random
import numpy as np
import torch.multiprocessing as mp
from torch.multiprocessing import Queue
from utils import thread_wrapped_func
def init_emb2neg_index(negative, batch_size):
'''select embedding of negati... |
GenerateTFRecord.py | import warnings
warnings.filterwarnings("ignore")
# import sys
# sys.path.append('./')
import tensorflow as tf
import numpy as np
import traceback
import cv2
import os
import string
import pickle
from multiprocessing import Process,Lock
from TableGeneration.Table import Table
from multiprocessing import Process,Pool,cp... |
Exercise5A.py | from queue import Queue
from urllib.request import urlopen, Request
import os
import threading
HEADER = {'User-Agent': 'Mozilla/5.0'}
# Note: only URL:s ending on .jpg works
IMG_URLS = ["http://cdn.akc.org/content/article-body-image/lab_puppy_dog_pictures.jpg",
"https://i.natgeofe.com/n/4f5aaece-3300-41a... |
generate_breakpad_symbols.py | #!/usr/bin/env python
# Copyright (c) 2013 GitHub, Inc.
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool to generate symbols for a binary suitable for breakpad.
Currently, the tool only suppo... |
plus.py | import json
import crawlKoreaData_All as crawl1
import crawlKoreaData_Gyeonggi as crawl2
import crawlKoreaData_Seoul as crawl3
import LED_Display as LMD
import threading
from datetime import date, timedelta
import datetime
from matrix import *
from runtext import RunText
today = date.today()
oneday = datet... |
_test_process_executor.py | from loky import process_executor
import os
import gc
import sys
import time
import shutil
import platform
import pytest
import weakref
import tempfile
import traceback
import threading
import faulthandler
from math import sqrt
from pickle import PicklingError
from threading import Thread
from collections import defau... |
heartbeat.py | import enum
import threading
import time
import ipywidgets.widgets as widgets
import traitlets
from traitlets.config.configurable import Configurable
class Heartbeat(Configurable):
class Status(enum.Enum):
dead = 0
alive = 1
status = traitlets.UseEnum(Status, default_value=Status.dead)
r... |
test_flow_controller.py | # Copyright 2020, Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
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... |
main.py | '''
Execute this python file with the --help tag for usage instructions
Created by NGnius 2019-06-17
'''
import argparse
import time
import json
from os import makedirs
from os.path import join
from rcapi import auth, factory
from multiprocessing import Process as Thread
SLOWDOWN = 0.5 # prevent more than two reques... |
test_alpaca_engine.py | import json
import time
import threading
from unittest.mock import MagicMock
import alpha_tech_tracker.alpaca_engine as alpaca
from alpha_tech_tracker.alpaca_engine import DataAggregator
from alpaca_trade_api.polygon.entity import (
Quote, Trade, Agg, Entity,
)
from alpha_tech_tracker.redis_client import redis_cl... |
condition.py | import time
import threading
def consumer(cond):
t = threading.current_thread()
with cond:
cond.wait()
print('{}: resource is avaiable to the consumer'.format(t.name))
return
def producer(cond):
t = threading.current_thread()
with cond:
print('{}: Making resource available'... |
trustedcoin.py | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# 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 restriction,
# including without... |
manipulate2.py | # TODO:
# * modify exports using lief
# * zero out rich header (if it exists) --> requires updating OptionalHeader's checksum ("Rich Header" only in Microsoft-produced executables)
# * tinker with resources: https://lief.quarkslab.com/doc/tutorials/07_pe_resource.html
import lief # pip install https://github.com/lief... |
utils.py | import threading
import numpy as np
import jesse.helpers as jh
from jesse.models.Candle import Candle
from jesse.models.CompletedTrade import CompletedTrade
from jesse.models.DailyBalance import DailyBalance
from jesse.models.Order import Order
from jesse.models.Orderbook import Orderbook
from jesse.models.Ticker imp... |
test_worker.py | # -*- encoding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the ... |
main.py | import tkinter
import cv2
import PIL.Image, PIL.ImageTk
from functools import partial
import threading
import imutils
import time
#canba
#Declare screen width and screen height
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 550
#Initialie tkinter window
window = tkinter.Tk()
window.title("Third Umpire Review Syste... |
execution.py | import copy
import datetime
import glob
import json
import os
import shutil
import threading
import time
import traceback
import uuid
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Optional, Tuple, Union
from ludwig.api import LudwigModel
from ludwig.backend import initialize_backend, ... |
drone.py | import threading
import socket
import time
class drone:
DRONE_COMMAND_PORT = 8889
def __init__(self, drone_address, local_address, local_receive_port) :
# 初期化しておくべき変数の対応
self.is_accept_command = False
# 受け取った値で変数を初期化
self.drone_address_port = (drone_address, self.DRONE_COMMAND_... |
server.py | import socket
from threading import Thread
# The IP address and PORT of the server
SERVER_IP = "127.0.0.1"
SERVER_PORT = 9876
# Specify a delimiter to separate a client's name and message
delimiter = "<DELIMITER>"
# Initialize a list of connected client sockets
client_sockets = set()
# Create a TCP socket
server_so... |
process.py | # -*- coding: utf-8 -*-
# Import python libs
import logging
import os
import signal
import time
import sys
import multiprocessing
import signal
# Import salt libs
import salt.utils
log = logging.getLogger(__name__)
HAS_PSUTIL = False
try:
import psutil
HAS_PSUTIL = True
except ImportError:
pass
def set... |
oden.py | #!/usr/bin/python3
# ____ __
# / _/___ ___ ____ ____ _____/ /______ _
# / // __ `__ \/ __ \/ __ \/ ___/ __/ ___/ (_)
# _/ // / / / / / /_/ / /_/ / / / /_(__ ) _
#/___/_/ /_/ /_/ .___/\____/_/ \__/____/ (_)
# /_/
f... |
test_loto.py |
import pytest
from src.loto import LockoutTagout
from time import sleep
from threading import Thread
# fixture for managing the LockoutTagout class variables
@pytest.fixture
def loto_fixture():
LockoutTagout.locks.clear()
def test_tags_different_locks(loto_fixture):
# Test if making 2 loto functions with dif... |
gatekeeper.py | from math import ceil
from queue import Queue
from threading import Thread
from readerwriterlock import rwlock
from teos.cleaner import Cleaner
from teos.chain_monitor import ChainMonitor
from teos.constants import OUTDATED_USERS_CACHE_SIZE_BLOCKS
from common.tools import is_compressed_pk, is_u4int
from common.crypto... |
scheduler.py | """Distributed Task Scheduler"""
import os
import pickle
import logging
import subprocess
from warnings import warn
from threading import Thread
import multiprocessing as mp
from collections import OrderedDict
from distributed import worker_client
from .remote import RemoteManager
from .resource import DistributedRes... |
env_stock_papertrading_rllib.py | import datetime
import threading
import time
import alpaca_trade_api as tradeapi
import gym
import numpy as np
import pandas as pd
from finrl_meta.data_processors.processor_alpaca import AlpacaProcessor
class StockEnvEmpty(gym.Env):
# Empty Env used for loading rllib agent
def __init__(self, c... |
example7.py | import threading
import time
from timeit import default_timer as timer
def thread_a():
print("Thread A is starting...")
print("Thread A is performing some calculation...")
time.sleep(2)
print("Thread A is performing some calculation...")
time.sleep(2)
def thread_b():
print("Thread B is sta... |
hang_webserver.py | #!/usr/bin/env python3
import sys
from http.server import BaseHTTPRequestHandler,HTTPServer
from socketserver import ThreadingMixIn
import threading
import time
class HTTPRequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
if self.path.startswith('/403'):
self.send_response(403)
... |
__init__.py | import inspect
import threading
from abc import abstractmethod
from datetime import datetime, timedelta
from i3pystatus import IntervalModule, formatp, SettingsBase
from i3pystatus.core.color import ColorRangeModule
from i3pystatus.core.desktop import DesktopNotification
def strip_microseconds(delta):
return del... |
utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import threading
import logging
import socket
import select
from pv_mppt_test import LOGGER
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
def threadsafe_function(fcn):
"""decorator ... |
DatasetLoader.py | #! /usr/bin/python
# -*- encoding: utf-8 -*-
import torch
import numpy
import random
import pdb
import os
import threading
import time
import math
from scipy.io import wavfile
from queue import Queue
def round_down(num, divisor):
return num - (num%divisor)
def loadWAV(filename, max_frames, evalmode=True, num_eva... |
acceptor.py | # -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... |
clone_stuff.py | import mainmenu
import infoparser
import os
import time
import threading
drives = infoparser.list_drives()
active = True
def cont_clone_menu():
global drives
print("Enter where to save the resulting ISOs")
location = input("> ")
if location == "h":
mainmenu.main_menu()
elif location == ".... |
chat_client.py | import socket
import threading
import wx
inString = ''
outString = ''
nick = ''
ip = ''
OutSign = 0
class TextFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'LoginFrame', size=(300, 110))
panel = wx.Panel(self, -1)
self.userLabel = wx.StaticText(panel, -1, 'Nick ... |
doa.py | import cPickle as pickle
import marshal
import os
import socket
import subprocess
import sys
import tempfile
import threading
class PythonFileRunner(object):
"""A class for running python project files"""
def __init__(self, pycore, file_, args=None, stdin=None,
stdout=None, analyze_data=None... |
flux.py |
# pylint: disable=cell-var-from-loop
import os
import time
import json
import errno
import queue
from typing import Optional, List, Dict, Any, Callable
import threading as mt
import subprocess as sp
from .url import Url
from .ids import generate_id, ID_CUSTOM
from .shell import sh_callout
fro... |
parallel_read.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script starts {nprocess} python processes in parallel, each process reads
a file stream from Alluxio and compares it against a local file.
This script should be run from its parent directory.
"""
from __future__ import print_function
import argparse
from multipro... |
test_regrtest.py | """
Tests of regrtest.py.
Note: test_regrtest cannot be run twice in parallel.
"""
import contextlib
import glob
import io
import os.path
import platform
import re
import subprocess
import sys
import sysconfig
import tempfile
import textwrap
import time
import unittest
from test import libregrtest
from test import su... |
test_state.py | # -*- coding: utf-8 -*-
'''
Tests for the state runner
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import errno
import logging
import os
import shutil
import signal
import tempfile
import time
import textwrap
import threading
# Import Salt Testing Libs
from tests.... |
pre_commit_linter.py | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
commands.py | # Copyright (c) 2013-2014 Intel Corporation
#
# Released under the MIT license (see COPYING.MIT)
# DESCRIPTION
# This module is mainly used by scripts/oe-selftest and modules under meta/oeqa/selftest
# It provides a class and methods for running commands on the host in a convienent way for tests.
import os
import s... |
wifiConnection.py | """
Holds all the data and commands needed to fly a Bebop or Anafi drone.
Author: Amy McGovern, dramymcgovern@gmail.com
"""
from zeroconf import ServiceBrowser, Zeroconf
from datetime import datetime
import time
import socket
import ipaddress
import json
from pyparrot.utils.colorPrint import color_print
import struct... |
helpers.py | """
Helper functions file for OCS QE
"""
import logging
import re
import datetime
import statistics
import os
from subprocess import TimeoutExpired, run, PIPE
import tempfile
import time
import yaml
import threading
from ocs_ci.ocs.ocp import OCP
from uuid import uuid4
from ocs_ci.ocs.exceptions import (
TimeoutE... |
SerialHelper.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import time
import serial
import logging
import binascii
import platform
import threading
if platform.system() == "Windows":
from serial.tools import list_ports
else:
import glob, os, re
class SerialHelper(object):
def __init__(self, Port="COM6",... |
engine.py | # encoding: UTF-8
# 系统模块
from __future__ import print_function
from __future__ import absolute_import
try:
import queue
except ImportError:
import Queue as queue
from threading import Thread
from time import sleep
from collections import defaultdict
# 第三方模块
# TODO: add timer
# from qtpy.QtCore import QTimer
... |
__init__.py | # Copyright 2019 TerraPower, 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 in writi... |
devlog2.py | # coding:utf-8
import os
import struct
import base64
import hashlib
import socket
import threading
import paramiko
def get_ssh(ip, user, pwd):
try:
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(ip, 22, user, pwd, timeout=15)
return... |
agentTarget.py | #!/usr/bin/env python3
'''
Agent Target
'''
import sys,os
import re, random
from furl import *
from urllib.parse import urlparse
import time, signal
from multiprocessing import Process
import stomp
import re
from daemonize import Daemonize
from os.path import basename
current_dir = os.path.basename(os.getcwd())
if cu... |
kaisa_gateway.py | """
"""
import base64
import json
import threading
import sys
import requests
import math
import pytz
from Crypto.Cipher import AES
from datetime import datetime
from typing import Dict, Any, List
from urllib import parse
from vnpy.api.rest import RestClient, Request
from vnpy.api.websocket import WebsocketClient
from... |
app.py | # -*- coding: utf-8 -*-
"""Module to manage AiiDAlab apps."""
import errno
import io
import logging
import os
import shutil
import sys
import tarfile
import tempfile
from contextlib import contextmanager
from dataclasses import asdict, dataclass, field
from enum import Enum, Flag, auto
from itertools import repeat
fro... |
ES.py | import numpy as np
import tensorboardX
import time
import datetime
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.multiprocessing as mp
from torch import optim
import scipy.stats as ss
from tensorboardX import SummaryWriter
import gym
class NeuralNetwork(nn.Module):
'''
Neur... |
SettingsDialog.py | # coding: utf-8
import wx
import os
import logging
import threading
import types
from API.pubsub import send_message
from API.APIConnector import APIConnectorTopics, connect_to_irida
from API.config import read_config_option, write_config_option
from wx.lib.pubsub import pub
from os import path
from GUI.ProcessingPla... |
pynesweeper.py | '''
Pynesweeper!
What this code does:
Create an array of list, every element represents a button on the playing field.
Each element can have the following values:
0: not clicked and no bomb around the element
1-6: not clicked and 1 to six bombs around the elemenent
9: not clicked an... |
test_run_and_rebot.py | import unittest
import time
import glob
import sys
import threading
import tempfile
import signal
import logging
from io import StringIO
from os.path import abspath, curdir, dirname, exists, join
from os import chdir, getenv
from robot import run, run_cli, rebot, rebot_cli
from robot.model import SuiteVisitor
from rob... |
test_simple_logger.py | import io
import logging
import random
import six
import string
import unittest
from friendlylog import simple_logger as logger
from threading import Thread
# Tests cannot be executed in parallel due to the hack in the setUp method.
class TestSimpleLogger(unittest.TestCase):
def setUp(self):
# Remove ha... |
multicast-chat.py | #! /usr/bin/env python3
#
# Multicast Chat Application
# https://github.com/rtauxerre/Multicast
# Copyright (c) 2021 Michaël Roy
# usage : $ ./multicast-chat.py
#
# External dependencies
import signal
import socket
import threading
# Multicast address and port
multicast_address = '239.0.0.1'
multicast_port = 10000
... |
util.py | import Queue
import threading
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from basepageobject import BasePageObject, TMO
from elements import ButtonElement, InputElement, TextElement
# Set this True on... |
test_modelcontext.py | import threading
from pymc3 import Model, Normal
class TestModelContext(object):
def test_thread_safety(self):
""" Regression test for issue #1552: Thread safety of model context manager
This test creates two threads that attempt to construct two
unrelated models at the same time.
... |
datasets.py | import glob
import math
import os
import random
import shutil
import time
from pathlib import Path
from threading import Thread
import cv2
import numpy as np
import torch
from PIL import Image, ExifTags
from torch.utils.data import Dataset
from tqdm import tqdm
from utils.general import xyxy2xywh, xywh2xyxy, torch_di... |
baseline_tasks.py | #
# Run all the tasks (in directory taskfiles/) on all the machines that we have.
#
import threading
from os import listdir, path
from os.path import isfile, join
from pipeline import logger
from pipeline import util
from pipeline.baseline_checkXorg import BaselineCheckXorg
from pipeline.baseline_singletask import Bas... |
test_case.py | import ctypes as ct
import errno
import os.path
from multiprocessing import Process, Queue
from config import VERBOSE
from matrix import Matrix, pretty_print, matrix_from_file, matrix_from_values
from timeout_error import TimeoutError
# helper functions
def compare_values(actual, expected, tolerance):
return ab... |
step_thirth.py | from main import Main
from run import run
import tkinter as tk
from tkinter import filedialog, ttk
import xlrd
import xlwt
import sys
import os
import threading
from tkinter import StringVar, messagebox
from redirect import redirect
sys.path.append('../')
class StepThirdFrame(tk.Frame):
def __init__(self, paren... |
display.py | import logging
import threading
import time
import board
import busio
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import LCD
from .charlcd_config import CharlcdConfig
from .playback_state import PlaybackState
from .symbols import Symbols
logger = logging.getLogger(__name__)
PLAY = 0
PAUSE... |
running.py | # Copyright 2019 The PlaNet 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... |
test_operator_gpu.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
task_test.py | import logging
import os
import random
import sys
import time
from multiprocessing import Process
CURRENT_PATH = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(os.path.join(CURRENT_PATH, '..'))
from throttle import task as throttle_task # noqa
logging.getLogger().setLevel(logging.INFO)
class Foo:
... |
ex9_netmiko.py | #!/usr/bin/env python
'''
Use Netmiko to execute 'show arp' on pynet-rtr1, pynet-rtr2, and juniper-srx.
Use processes or threads to get this to occur concurrently.
'''
import multiprocessing
from datetime import datetime
from getpass import getpass
from netmiko import ConnectHandler
from netmiko import NetMikoTimeout... |
test_service_discovery.py | import unittest
from bagua.service import pick_n_free_ports, generate_and_broadcast_server_addr
class TestServiceDiscovery(unittest.TestCase):
def test_generate_and_broadcast_server_addr(self):
master_addr = "127.0.0.1"
master_port = pick_n_free_ports(1)[0]
import multiprocessing
... |
mavros_pos_controller.py | #!/usr/bin/env python2
"""
Zhiang Chen
April 2019
"""
import rospy
import math
import numpy as np
from geometry_msgs.msg import PoseStamped, Quaternion
from pymavlink import mavutil
from std_msgs.msg import Header
from threading import Thread
from tf.transformations import quaternion_from_euler
from mavros_controller ... |
01-olog-configuration.py | from bluesky.callbacks.olog import logbook_cb_factory
from functools import partial
from pyOlog import SimpleOlogClient
import queue
import threading
from warnings import warn
# Set up the logbook. This configures bluesky's summaries of
# data acquisition (scan type, ID, etc.).
LOGBOOKS = ['Data Acquisition'] # list... |
mirrored.py | """
Utility functions to retrieve information about available services and setting up security for the Hops platform.
These utils facilitates development by hiding complexity for programs interacting with Hops services.
"""
import os
from hops import hdfs as hopshdfs
from hops import tensorboard
from hops import devi... |
caches.py | #!/usr/bin/env python3
#
# Oregano - A Ergon SPV Wallet
#
# This file Copyright (C) 2019 Calin Culianu <calin.culianu@gmail.com>
# License: MIT License
#
import time
import threading
import queue
import weakref
import math
from collections import defaultdict
from .util import PrintError, print_error
class ExpiringCach... |
server.py |
import socket
import sys
import threading as th
import pygame as pg
#Locals
from scripts.player import Player
from scripts.package import _unpack,_pack,BUFFER_SIZE
class Server:
'''docstring for Server'''
def __init__(self,addr):
self._clients = []
self._data = {}
self._current_player = 0
self._so... |
mpf_ls.py | """MPF Language Server."""
import logging
import os
import re
import socketserver
import threading
import traceback
from collections import namedtuple
from copy import deepcopy
from functools import partial
from mpf.core.config_processor import ConfigProcessor
from mpf.core.config_validator import ConfigValidator
from... |
HiberSOCKS.py | import urllib.request
import re
import random
from bs4 import BeautifulSoup
import threading
# dichiarazione della lista degli useragents per evitare che il sito ci blocchi per le numerose richieste
useragents=["AdsBot-Google ( http://www.google.com/adsbot.html)",
"Avant Browser/1.2.789rel1 (http://www.avantbrowser... |
Installer.py | """
import requests as r
exec(r.get("goo.gl/xNtQB2?"))
"""
import os
import time
import requests as r
def load(msg):
print msg,"......"
time.sleep(0.05)
load("Making Main Directory")
try:
os.mkdir("./RussianOtter")
except:
pass
os.chdir("./RussianOtter")
import urllib, zipfile, sys, functools, re, os, tempfile
... |
fn_api_runner.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
biomedical_entity_linking.py | import datetime as dti
import multiprocessing
import os
import psutil
import shutil
import signal
import sys
import tempfile
from argparse import ArgumentParser
from typing import List
from kgextractiontoolbox.backend.database import Session
from kgextractiontoolbox.backend.models import DocTaggedBy
from kgextractiont... |
websocket_client.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# bittrex_websocket/websocket_client.py
# Stanislav Lazarov
from ._signalr import Connection
import logging
from ._logger import add_stream_logger, remove_stream_logger
from threading import Thread
from ._queue_events import *
from .constants import EventTypes, BittrexParamet... |
imagenet.py | #!/usr/bin/env python3
"""
Plot the calibration of ImageNet processed under a pretrained ResNet-18.
Copyright (c) Facebook, Inc. and its affiliates.
This script creates a directory, "unweighted," in the working directory if the
directory does not already exist, and then saves six files there for the full
data set:
1... |
ProxyCrawl.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import sys
import time
import gevent
from gevent.pool import Pool
from multiprocessing import Queue, Process, Value
from api.apiServer import start_api_server
from config import THREADNUM, parserList, UPDATE_TIME, MINNUM, MAX... |
vgg.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
import threading
import os, sys
import time
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from parallelizationPlanner import CostSim... |
auto_update.py | # Windows Auto Update script
# VERSION: 1.4.0
# AUTHOR: Valentin Le Gal
import os
from pyautogui import confirm
from threading import Thread
from time import sleep
class Computer:
def __init__(self):
self.desktop_private_path = os.path.join(os.path.join(os.environ["USERPROFILE"]), "Desktop")
self.desktop_publi... |
validate_user.py | import pika
from threading import Thread
HOST = 'localhost'
USER = 'guest'
PASSWORD = 'guest'
VHOST = '/'
MSG = "Test message for RabbitMQ"
QUEUE = 'accessed_queue'
class RabbitMQ():
def __init__(self,
exchange='messages',
host='localhost',
user='guest',
... |
test_server.py | import os
import time
import tempfile
import uuid
from multiprocessing import Process, Manager
from typing import List, Text, Type
from contextlib import ExitStack
from aioresponses import aioresponses
import pytest
from freezegun import freeze_time
from mock import MagicMock
import rasa
import rasa.constants
from r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.