source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
server.py | # Copyright (C) 2013 Michael Fogleman
# 2020 William Emerison Six
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
#... |
clientserver.py | #####################################################################
# #
# clientserver.py #
# #
# Copyright 2013 - 2018, Chris Billingto... |
df2json.py | """
数据预处理功能,将csv格式的数据处理成腾讯文本分类包NeuralClassifier的数据格式
之前的数据格式:csv文件,字段为label item
目标的数据处理格式:
JSON example:
{
"doc_label": ["Computer--MachineLearning--DeepLearning", "Neuro--ComputationalNeuro"],
"doc_token": ["I", "love", "deep", "learning"],
"doc_keyword": ["deep learning"],
"doc_topic":... |
p2000.py | #!/usr/bin/env python3
"""RTL-SDR P2000 Receiver for Home Assistant."""
import calendar
import configparser
import fnmatch
import json
import logging
import os
import re
import subprocess
import sys
import threading
import time
from datetime import datetime
from logging.handlers import TimedRotatingFileHandler as _Time... |
server.py | #
# server.py
# Style Transfer Server
#
import os
import api
import uuid
import styleopt
from PIL import Image
from flask import Flask, request
from multiprocessing import Process, Queue, Manager
## Tasking
# Style transfer worker that runs style transfers task as defined by the
# payloads queued
class TransferWork... |
misc.py | # -*- coding: utf-8 -*-
"""Some miscellaneous utility functions."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
from contextlib import contextmanager
import fnmatch
import gc
import inspect
from math import log
import os
from queue import Queue, Empty
from string import Form... |
download_m3u8.py | #!/usr/bin/env python
# -*- coding:utf-8 -*
# ############################################################
#
# Copyright (c) 2020 xxx.com, Inc. All Rights Reserved
#
# ############################################################
'''
@Date: 2020-03-15 16:14:35
@Author: tf
@LastEditTime: 2020-03-19 00:08:18
@LastEditors... |
test_service_and_endpoint_shutdown_utils.py | import asyncio
import multiprocessing
import os
import signal
import pytest
from p2p.service import BaseService
from trinity.endpoint import TrinityEventBusEndpoint
from trinity._utils.shutdown import (
exit_with_endpoint_and_services,
)
class SimpleService(BaseService):
def __init__(self, ready_to_kill_ev... |
manage.py | # Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017 Universidade Federal de Campina Grande
# 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... |
pref_rps.py | from threading import Thread
import socket
import time
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 1234))
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
n = 0
status = True
def monitor():
global n, status
while status:
time.sleep(1)
print(n,... |
monadic.py | # Shamelessly copy/pasted from this awesome article :
# https://www.toptal.com/javascript/option-maybe-either-future-monads-js*
# by Alexey Karasev
import threading
from functools import reduce
class Monad:
# pure :: a -> M a. Same as unit: a -> M a
@staticmethod
def pure(x):
raise Exception("pu... |
samplegeneration.py | from threading import current_thread, Thread
import numpy as np
import random, sys, os
import string, time
from .xdf import load_xdf
from pylsl import local_clock, StreamInfo, StreamOutlet
RANDOM_CHN = 16
class SampleGeneration:
def __init__(self, mode):
self.mode = mode
self.thread = None
self.running ... |
CntlrWinMain.py | '''
Created on Oct 3, 2010
This module is Arelle's controller in windowing interactive UI mode
@author: Mark V Systems Limited
(c) Copyright 2010 Mark V Systems Limited, All rights reserved.
'''
from arelle import PythonUtil # define 2.x or 3.x string types
import os, sys, subprocess, pickle, time, locale, re
from tk... |
logging.py | """Logging utilities."""
import asyncio
from asyncio.events import AbstractEventLoop
from functools import partial, wraps
import inspect
import logging
import threading
import traceback
from typing import Any, Callable, Coroutine, Optional
class HideSensitiveDataFilter(logging.Filter):
"""Filter API password call... |
libvirt_events_thread.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# To use libvirt callbacks, one has to setup a single process-wide event loop for
# libvirt. This module provisions the event loop in a python thread dedicated to
# handling libvirt events.
import asyncio
from threading import Event, Lock, Threa... |
cache_server.py | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import http.server
import os
import re
import socketserver
from contextlib import contextmanager
from multiprocessing import Process, Queue
from pants.testutil.file_test_util import exact... |
test_setup.py | """Test component/platform setup."""
# pylint: disable=protected-access
import asyncio
import os
import threading
from unittest.mock import Mock, patch
import pytest
import voluptuous as vol
from homeassistant import config_entries, setup
import homeassistant.config as config_util
from homeassistant.const import EVEN... |
altitude_plot.py | #!/usr/bin/env python3
'''
Dependencies: numpy, matplotlib, https://github.com/simondlevy/RealtimePlotter
Copyright (C) 2021 Simon D. Levy
MIT License
'''
import serial
from realtime_plot import RealtimePlotter
import numpy as np
from threading import Thread
from sys import argv, stdout
# Change these to suit your... |
helpers.py |
'''
Authors: Jared Galloway, Jeff Adrion
'''
from ReLERNN.imports import *
#-------------------------------------------------------------------------------------------
def assign_task(mpID, task_q, nProcs):
c,i,nth_job=0,0,1
while (i+1)*nProcs <= len(mpID):
i+=1
nP1=nProcs-(len(mpID)%nProcs)
... |
create_tfrecords.py | """
Create the tfrecord files for a dataset.
This script is taken from the Visipedia repo: https://github.com/visipedia/tfrecords
A lot of this code comes from the tensorflow inception example, so here is their license:
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version ... |
bkapp.py | """
Embed bokeh server session into a flask framework
Adapted from bokeh-master/examples/howto/serve_embed/flask_gunicorn_embed.py
"""
import os
import time
import asyncio
import logging
from threading import Thread
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from bokeh import... |
pathway.py | #!/usr/bin/python -w
import socket, re, sys
from os import _exit
import re
from libs.python_modules.utils.sysutil import getstatusoutput
from multiprocessing import Process
import time
class PythonCyc:
_organism = 'meta'
soc = None
def __init__(self):
pass
def... |
socketHandler.py | # Source: https://pymotw.com/2/socket/udp.html
"""
This file contains the class SocketHandler, which handles both sending and receiving messages through sockets.
One SocketHandler is needed to handle all connections.
Written by Dorian Wang
"""
import socket
import sys
import time
import json
import threading
import se... |
EM.py | #
# COPYRIGHT:
# The Leginon software is Copyright 2003
# The Scripps Research Institute, La Jolla, CA
# For terms of the license agreement
# see http://ami.scripps.edu/software/leginon-license
#
from leginon import leginondata
import instrument
import node
import socket
import threading
impor... |
test_browser.py | import BaseHTTPServer, multiprocessing, os, shutil, subprocess, unittest, zlib, webbrowser, time, shlex
from runner import BrowserCore, path_from_root, nonfastcomp
from tools.shared import *
# User can specify an environment variable EMSCRIPTEN_BROWSER to force the browser test suite to
# run using another browser com... |
A3C.py | import copy
import random
import time
import numpy as np
import torch
from torch import multiprocessing
from torch.multiprocessing import Queue
from torch.optim import Adam
from agents.Base_Agent import Base_Agent
from utilities.Utility_Functions import create_actor_distribution, SharedAdam
class A3C(Base_Agent):
... |
multithread.py | import json
import csv
import time
import requests
import queue
import threading
file_root_path = '.'
file_name1 = 'dwa_d_ia_s_user_prod_0716u8.txt.csv'
file_name2 = 'dwa_d_ia_s_user_prod_transcoded.txt.csv'
def time_it(fun):
def inner_fun(*argc, **argv):
st = time.time()
ret = fun(*argc, **argv)
... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including witho... |
network.py | from operator import ne
import sys, os, signal,json
from multiprocessing import Process
from itsdangerous import exc
from scapy.layers.dot11 import Dot11, Dot11Beacon, Dot11ProbeResp,Dot11Elt, RadioTap, sendp, Dot11Deauth
from scapy.all import *
def channel_hopper():
while True:
try:
... |
client.py | import socket
import argparse
import threading
#접속하고 싶은 ip와 port를 입력받는 클라이언트 코드를 작성해보자.
# 접속하고 싶은 포트를 입력한다.
port = 4000
def handle_receive(lient_socket, user):
while 1:
try:
data = client_socket.recv(1024)
except:
print("연결 끊김")
break
data = data.decode(... |
websocket_override.py |
import time
import six
import json
import threading
from websocket._abnf import ABNF
from websocket._core import WebSocket, getdefaulttimeout
from websocket._exceptions import *
import websocket._logging
class PusherWebsocket(websocket.WebSocket):
def ping(self, payload=""):
subscriber_message = {'even... |
test_exit.py | import os
import threading
import time
from copy import deepcopy
from wsgiref.simple_server import WSGIRequestHandler, WSGIServer
import pytest
from fixtures import experiments
from chaoslib.exit import exit_gracefully, exit_ungracefully
from chaoslib.run import Runner
from chaoslib.types import Strategy
pytestmark ... |
parmapper.py | # -*- coding: utf-8 -*-
"""
parmap (or parmapper): Tool for easy parallel function mapping
without requiring a pickleable function (e.g. lambdas).
This script is from Jwink3101, https://github.com/Jwink3101/parmapper
"""
from __future__ import print_function, unicode_literals, division
__version__ = '20210422.0'
impo... |
cpu.py | import psutil # type: ignore
import multiprocessing
import threading
import time
from grape import FitnessHelper
class Cpu:
"""
Description:
------------
CPU負荷対応ツール
"""
__percent: float
__rate: float
__interval: float
__prev_percent: float
__prev_sleep: float
def __init_... |
server.py | """Fix TCP server module."""
import errno
import socket
import select
import threading
from six.moves import queue
from testplan.common.utils.timing import (
TimeoutException,
TimeoutExceptionInfo,
wait,
)
from testplan.common.utils.sockets.fix.utils import utc_timestamp
class ConnectionDetails(object):... |
async_utils.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 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.
# You may obtain a copy of the ... |
miniterm.py | #!/usr/bin/env python
#
# Very simple serial terminal
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C)2002-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
import codecs
import os
import sys
import threading
import serial
from serial.tools.list_ports impo... |
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... |
em_waves_demo1.py | """
Demo [em_waves](https://pypi.org/project/em-waves)
Running:
after installing em_waves with:
`pip3 install em_waves`
type:
`python3 em_waves_demo1.py`
"""
import multiprocessing
from em_waves import Medium, Sine, Gaussian, Rect
SHOW_PLOT = True
def proc_func(wave):
print (wave)
wave.show()
de... |
_nixcommon.py | # -*- coding: utf-8 -*-
import struct
import os
import atexit
from time import time as now
from threading import Thread
from glob import glob
try:
from queue import Queue
except ImportError:
from Queue import Queue
event_bin_format = 'llHHI'
# Taken from include/linux/input.h
# https://www.kern... |
presubmit_support.py | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Enables directory-specific presubmit checks to run at upload and/or commit.
"""
__version__ = '1.8.0'
# TODO(joi) Add caching ... |
burstMain.py | import time, os, sys
from multiprocessing import Process, current_process, Manager, Value
from burstVars import *
from burstGen import *
# Main script routine
if __name__ == '__main__':
print("Starting smtp-burst")
manager = Manager()
SB_FAILCOUNT = manager.Value('i', 0)
print("Generating %s of data to append ... |
kylin.py | from logging import setLogRecordFactory
import queue
import traceback
from threading import Thread
import sqlalchemy as sa
from common import util
class IDEBenchDriver:
def init(self, options, schema, driver_arg):
self.time_of_latest_request = 0
self.isRunning = False
self.requests = que... |
recorder.py | """Recorder."""
import datetime
import logging
import os
from threading import Thread
import cv2
import viseron.helpers as helpers
from viseron.cleanup import SegmentCleanup
from viseron.mqtt.camera import MQTTCamera
from viseron.segments import Segments
LOGGER = logging.getLogger(__name__)
class FFMPEGRecorder:
... |
serve.py | # Most of this code is:
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# The server command includes the additional header:
# For discussion of daemonizing:
# http://aspn.activestate.com/ASPN/C... |
mqttserviceprovider.py | #Manages connection to MQTT server.
#Handles subscriptions/publishing to server.
import paho.mqtt.client as mqtt
import json
import threading
def sameFunction(f1, f2): #used for unsubscribing, remove all subscriptions with a certain handler. Hacky, fix later.
if hasattr(f1, '__func__'):
f1 = f1.__func__... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# includi... |
utility_functions.py | ##
# Utility Functions to support re-use in python scripts.
# Includes functions for running external commands, etc
#
# Copyright (c) Microsoft Corporation
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import re
import os
import logging
import datetime
import time
import shutil
import threading
import subprocess
... |
bot.py | # -*- coding: utf-8 -*-
import random
from datetime import datetime
from threading import Thread
from time import sleep
import schedule
import telebot
import config
import mybotdata as bdat
import mybotfunctions as bfunc
import withstickers as stick
from metrics import update_number_of_users
from tele... |
republish_cmd_vel.py | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
from math import pi
from kobuki_msgs.msg import BumperEvent, Led
from threading import Thread
from std_srvs.srv import Empty, EmptyResponse
class CmdVelRepublisher():
"A class to republish cmd_vel information"
def __init__(self):
... |
Tcryptor.py | print(f' _ _ ---==== Tcryptor ====--- _ _\n')
from TcCore import *
from TcProcessor import TcProcessor
from TcEncryptor import TcEncryptor
from telegram import ParseMode
from telegram.utils.helpers import mention_html
import sys, traceback
from threading import Thread
import urllib.request # Check for inter... |
qbittorrent_worker.py | #!/usr/bin/env python
# encoding: utf-8
"""
下载检测
"""
'''
pl_hash_list 表字段 status说明
0 视频资源 - 正常
1 不含有视频资源
2 3小时下载未反应
4 3个月未下载完成
'''
import hashlib
import os
import time
import datetime
import traceback
import sys
import json
import socket
import threading
from hashlib import sha1
from random import randint
from struc... |
14107_NibeWP (14107).py | # coding: UTF-8
# Copyright 2021 T. Paul</p>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... |
yuzbulanson.py | import sys
import threading
from cv2 import cv2 as cv
import time
import queue
import time
import mysql.connector
import datetime
from datetime import timedelta
mydb=mysql.connector.connect(host='94.130.57.82',user="appsplat_semih",passwd="semihsemih123",database="appsplat_semih")
mycursor =mydb.cursor()
idnum=sys.... |
tasks.py | from threading import Thread
import sched
import time
class Task:
def __init__(self, type=None):
self.active = False
self.paused = False
self.thread = None
self.type = type
def __start__(self, target, period):
self.active = True
self.thread = Thread(target=self.... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import queue as pyqueue
import contextlib
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import struct
import operator
import weakref
import test.su... |
robot_cmd_ros.py | #!/usr/bin/env python
import time
import os
import socket
import math
import sys
from threading import Thread
from datetime import datetime
import rospy
import tf
import actionlib
import cv2
from std_msgs.msg import String
from geometry_msgs.msg import Twist, Quaternion, Pose, PoseWithCovarianceStamped
from sensor_... |
test_html.py | from __future__ import print_function
import os
import re
import threading
from functools import partial
import pytest
import numpy as np
from numpy.random import rand
from pandas import (DataFrame, MultiIndex, read_csv, Timestamp, Index,
date_range, Series)
from pandas.compat import (map, zip,... |
main.py | import requests
import threading
import os
import time
link_url = "https://raw.githubusercontent.com/codingbox/Pixiv-Craw/main/url.txt"
os.system("curl -O " + link_url)
url_list = []
f = open("url.txt", "r")
line = f.readline()
while line:
url_list.append(line.rstrip('\n'))
line = f.readline()
... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
core.py | # Copyright 2018 John Reese
# Licensed under the MIT license
import asyncio
import os
from unittest import TestCase
import aiomultiprocess as amp
from aiomultiprocess.core import context, PoolWorker
from .base import async_test
async def mapper(value):
return value * 2
async def starmapper(*values):
ret... |
test.py | import itertools
import os
import random
import threading
import time
from orco import Runtime, LocalExecutor
if os.path.isfile("test.db"):
os.unlink("test.db")
rt = Runtime("test.db")
executor = LocalExecutor(heartbeat_interval=1, n_processes=1)
rt.register_executor(executor)
executor2 = LocalExecutor(heartbe... |
proxy.py | import threading
import socket
from toolkit.network import basic # pylint: disable=import-error
class Proxy():
def __init__(self, serverport, serveraddr, clientport, clientaddr):
threading.Thread.__init__(self)
self.running = True
self.serverAddr = (clientaddr, clientport)
self.cl... |
policy_grad.py | from plan import *
from database_env import DataBaseEnv_QueryEncoding
from utils.utils import *
from utils.db_utils import *
from tree import *
import torch.multiprocessing as mp
import torch
import torch.nn as nn
import numpy as np
from copy import deepcopy
import time
from torch.utils.tensorboard import SummaryWriter... |
scratchpad.py | """
Display number of scratchpad windows and urgency hints.
Configuration parameters:
cache_timeout: refresh interval for i3-msg or swaymsg (default 5)
format: display format for this module
(default "\u232b [\\?color=scratchpad {scratchpad}]")
thresholds: specify color thresholds to use
(d... |
test_mysqlx_crud.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also d... |
remotehost.py | # Host class
# Copyright (c) 2016, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import logging
import subprocess
import threading
logger = logging.getLogger()
def execute_thread(command, reply):
try:
status = 0;
buf... |
backend.py | import copy
import functools
import logging
import os
import re
import shutil
import subprocess
import threading
from collections import OrderedDict
from queue import Queue
from time import sleep
from typing import Iterable, List
import fabric
from paramiko.ssh_exception import SSHException
__all__ = ["Cluster"]
log... |
ue_mac.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
from collections import namedtuple
import threading
from ryu.controller import ofp_event
from ryu.controller.handl... |
train_faster_rcnn_alt_opt.py | #!/usr/bin/env python
# --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Train a Faster R-CNN network using alternat... |
__init__.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Logging utils
"""
import os
import warnings
from threading import Thread
import pkg_resources as pkg
import torch
from torch.utils.tensorboard import SummaryWriter
from yolov5_master.utils.general import colorstr, emojis
from yolov5_master.utils.loggers.wandb.wandb_uti... |
howit.py | #here are the commands to demonstrate how to access and perform operations on a main file
#run the MODULE of MAIN FILE and import mainfile as a library
import code as x
#importing the main file("code" is the name of the file I have used) as a library
x.create("sastra",25)
#to create a key with key_nam... |
dispatcher.py | # This file is adapted from github repo: https://github.com/automl/HpBandSter.
import time
import Pyro4
import queue
import logging
import threading
class Job(object):
def __init__(self, id, **kwargs):
self.id = id
self.kwargs = kwargs
self.timestamps = dict()
self.result = None
self.exception = None
se... |
sem.py | #! /usr/bin/env python
# -*- coding:UTF-8 -*-
# 使用信号量机制,注意semaphore的使用
# sem可以管理某一类资源的一组实例
# 其实使用queue队列模块是最佳的
import threading
import time
import random
def numbergen(sem, queue, qlock):
while True:
time.sleep(2)
if random.randint(0,1):
value = random.randint(1,100)
qlock.... |
proxy-scraper.py | ######################################################################
################ http://scrapeomatic.blogspot.com/ ###################
######################################################################
##################### Proxy Scraper Script V1.2 ######################
####################################... |
linux_network.py | #INSTRUCTIONS
#Run using "python3 linux_network.py <your IP address>"
#The chat application we used during demonstration
#Requires that you create an ad hoc wifi network amoung the nodes using DSR to chat
#You must also know your IP in this network
#Your node ID is the last number in your IP, for example 10.1.1.12 is n... |
mem.py | "Utility functions for memory management"
from ..imports.torch import *
from ..core import *
from ..script import *
from ..utils.env import *
import pynvml, functools, traceback, threading, time
from collections import namedtuple
IS_IN_IPYTHON = is_in_ipython()
GPUMemory = namedtuple('GPUMemory', ['total', 'used', '... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
Camera.py | import datetime
import logging.config
import os
import shutil
import time
import tempfile
import numpy
import requests
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
from xml.etree import ElementTree
from collections import deque
from io import BytesIO
import threading
from threading import Thread, Event, Lock... |
bms_client.py | #!/usr/bin/env python
"""
Copyright 2014 The Trustees of Princeton University
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
Unle... |
process_handler.py | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import multiprocessi... |
report_error.py | #
# General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for 1st, 2nd and 3rd generation solar cells.
# Copyright (C) 2008-2022 Roderick C. I. MacKenzie r.c.i.mackenzie at googlemail.com
#
# https://www.gpvdm.com
#
# This program is free software; you can redist... |
port_listener.py | #!/usr/bin/python3
"""
Point of this script is to spawn TCP servers based on
configuration provided in proper file in etc.
"""
import socketserver
import json
import threading
import argparse
IP = "0.0.0.0"
CONFIG = {}
def start_listener(listener_data):
"""
Wrapper function to start TCP server.
... |
ensemble.py | import os
import time
import numpy as np
import json
import math
import tempfile
import uuid
import asyncio
import multiprocessing
import signal
import logging
from autoPyTorch.components.ensembles.ensemble_selection import EnsembleSelection
def build_ensemble(result, optimize_metric,
ensemble_size, all_predic... |
arithmetic.py | #!/usr/bin/env python3
import re, random
import token
import multiprocessing
import sympy
from sympy.core import numbers
from sympy.parsing.sympy_parser import parse_expr, standard_transformations, implicit_multiplication, implicit_application
from sympy.parsing.sympy_tokenize import TokenError
from sympy.physics imp... |
cleanup.py | from __future__ import absolute_import, print_function
import os
from datetime import timedelta
from uuid import uuid4
import click
from django.utils import timezone
from sentry.runner.decorators import log_options
from six.moves import xrange
# allows services like tagstore to add their own (abstracted) models
# ... |
mpris.py | """
Display song/video and control MPRIS compatible players.
There are two ways to control the media player. Either by clicking with a mouse
button in the text information or by using buttons. For former you have
to define the button parameters in your config.
Configuration parameters:
button_next: mouse button t... |
recursive_solver.py | from tree_viewer import TreeViewer
import Tkinter as tk
import threading
import time
NUM_DISKS = 3
Pole1 = '1'
Pole2 = '2'
Pole3 = '3'
BEGIN = [1,5]
MOVES = {}
MOVES[Pole1, Pole2] = [5,1,4,3,4,1,5,2,]
MOVES[Pole2, Pole1] = [3,5,1,4,2,4,1,5,]
MOVES[Pole1, Pole3] = [5,1,4,3,4,1,1,5,2,5,1,4,]
MOVES[Pole3, Pole1] = [4,1... |
trainer_factory.py | # Copyright (c) 2019 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... |
multi_process_runner.py | # Lint as: python3
# Copyright 2019 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 ... |
scripts.py | # -*- coding: utf-8 -*-
'''
This module contains the function calls to execute command line scripts
'''
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import os
import sys
import time
import signal
import logging
import functools
import threading
import traceback
import s... |
test_tls.py | import socket
import ssl
from contextlib import ExitStack
from threading import Thread
import pytest
from anyio import BrokenResourceError, connect_tcp
from anyio.abc import SocketAttribute
from anyio.streams.tls import TLSAttribute, TLSStream
pytestmark = pytest.mark.anyio
class TestTLSStream:
async def test_... |
installModels.py |
import os
import shutil
import threading
from pathlib import Path
import requests
from pydeepspeech.util import get_appdatadir
# AI model used for the application
_VERSION = 'v0.9.3'
_URLS = [
'https://itml.cl.indiana.edu/models/tr/output_graph.pbmm',
'https://itml.cl.indiana.edu/models/tr/kenlm.scorer',
]... |
run_threads.py | """I start all the threads necessary to control the slave nodes and receive info from the backend
controller"""
from threading import Thread
from typing import Type
from .abstract import AbstractSetup, AbstractSlave
from .project_logger import set_up_logging
from .chain_controller_interface import start_controller_ser... |
externing.py | #A* -------------------------------------------------------------------
#B* This file contains source code for the PyMOL computer program
#C* Copyright (c) Schrodinger, LLC.
#D* -------------------------------------------------------------------
#E* It is unlawful to modify or remove this copyright notice.
#F* -------... |
definition.py | import random
#from typing import List
from chatette_qiu.units import UnitDefinition#, Example
from .example import IntentExample
from threading import Thread
import time
class IntentDefinition(UnitDefinition):
"""
This class represents the definition of an intent,
containing all the rules it can generate... |
main.py | from quixstreaming import QuixStreamingClient
from quixstreaming.app import App
from quix_functions import QuixFunctions
from datetime import datetime, timezone
import traceback
from tfl_api import get_agg_bikepoint_data
from threading import Thread
import os
# should the main loop run?
run = True
# Quix injects cred... |
tcp_server.py | import socket, threading, time
"""Sample of TCP server"""
def handler(sock, addr):
print('[Server %s] accepted new connection.' % threading.current_thread().getName())
sock.send(b'Welcome!')
while True:
data = sock.recv(1024)
time.sleep(1)
if not data or data.decode('UTF-8') == 'e... |
test_holdup.py | import os
import socket
import ssl
import threading
import pytest
try:
from inspect import getfullargspec as getargspec
except ImportError:
from inspect import getargspec
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
pytest_plugins = 'pytester',
def urlope... |
socat_idp_sim.py | #!/usr/bin/env python
import threading
import subprocess
import serial
import time
import binascii
import base64
def socat(dte='./simdte', dce='./simdce'):
'''
Start a socat proxy for a given source to a given target
'''
cmd = 'socat -d -d -v pty,rawer,echo=0,link={} pty,rawer,echo=0,link={}'.format(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.