source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
testhadoop.py | #!/usr/bin/python
# coding=utf-8
##########################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import patch
from diamond.collector import Collector
from hadoop import HadoopMetrics2Collector
from... |
test_locks.py | import errno
import os
import tempfile
import time
from multiprocessing import Process
from mock import Mock
from pytest import raises
from locks import Mutex
try:
BlockingIOError
except NameError:
BlockingIOError = (IOError, OSError)
class TestMutex(object):
def test___init__(self):
mutex = M... |
CHAS.py | #!/usr/bin/env python3
from olctools.accessoryFunctions.accessoryFunctions import dotter, GenObject, make_path, run_subprocess, \
write_to_logfile
from threading import Thread
from queue import Queue
from glob import glob
import threading
import os
__author__ = 'adamkoziol'
class CHAS(object):
def chas(self)... |
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... |
flaskwebgui.py | import os, time, psutil
import sys, subprocess as sps
from threading import Thread
class FlaskUI:
"""
This class opens in 3 threads the browser, the flask server, and a thread which closes the server if GUI is not opened
Described Parameters:
app, ... |
utils.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... |
log_handler.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... |
abunai.py | #! /usr/bin/env python
# Abunai v2.2
# IRC translator bot
# call with python abunai.py server nick channel USER USERLANGUAGE CHANNELLANGUAGE
# do not include the # sign in the channel arg
# as is, this script won't play nicely with servers that need nickserv or sasl
# quit by entering q at the terminal
import ... |
restservice.py | from fedn.clients.reducer.interfaces import CombinerInterface
from fedn.clients.reducer.state import ReducerState, ReducerStateToString
from flask_wtf.csrf import CSRFProtect
from werkzeug.utils import secure_filename
from flask import Flask, jsonify, render_template, request
from flask import redirect, url_for, flash... |
bot_manager.py | #!/usr/bin/env python3
# coding: utf-8
# @Author: arthur
# @Email: arthur.bernard.92@gmail.com
# @Date: 2020-01-27 09:58:03
# @Last modified by: ArthurBernard
# @Last modified time: 2020-05-10 18:31:21
""" Set a server and run each bot. """
# Built-in packages
import logging
from multiprocessing import Process
from t... |
trezor.py | import traceback
import sys
from typing import NamedTuple, Any
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
from electrum import const... |
flameMenuSG.py | '''
flameMenuSG
Flame 2020 and higher
written by Andrii Toloshnyy
andriy.toloshnyy@gmail.com
'''
import os
import sys
import time
import threading
import atexit
import inspect
import re
from pprint import pprint
from pprint import pformat
__version__ = 'v0.1.5'
# from sgtk.platform.qt import QtGui
menu_group_name =... |
JobBrowserBFF_JSONRPCServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from wsgiref.simple_server import make_server
from JobBrowserBFF.jsonrpcbase import (
JSONRPCService,
InvalidParamsError,
KeywordEr... |
dut.py | #!/usr/bin/python
'''The MIT License (MIT)
Copyright (c) 2017 Yu Xiong Wei(try.dash.now@gmail.com)
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... |
greengrassHelloWorld.py | #
# Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# greengrassHelloWorld.py
# Demonstrates a simple publish to a topic using Greengrass core sdk
# This lambda function will retrieve underlying platform information and send
# a hello world message along with the platform information to ... |
collection.py | # Copyright 2009-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
mainwindow.py | import json
import os
import sys
from threading import Thread
from typing import Dict, Optional, Tuple, Union
sys.path.append(os.getcwd()) # must be ran in sbumips directory (this is bc PYTHONPATH is weird in terminal)
from constants import *
from interpreter.interpreter import Interpreter
from sbumips import assembl... |
gist_80.py | import functools
import json
import os
import shutil
import tempfile
import threading
import traceback
import webbrowser
try:
import sublime
import sublime_plugin
except ImportError:
from test.stubs import sublime
from test.stubs import sublime_plugin
from gist_20_exceptions import MissingCredentialsE... |
federated_learning_keras_PS_MNIST_gradients.py | from DataSets import MnistData
from DataSets_task import MnistData_task
from consensus.consensus_v2 import CFA_process
from consensus.parameter_server import Parameter_Server
# best use with PS active
# from ReplayMemory import ReplayMemory
import numpy as np
import os
import tensorflow as tf
from tensorflow import ke... |
core_test.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
Server.py | #
# Server.py
#
# Created by Thomas Johannesmeyer on 02/02/2016.
# Copyright (c) 2016 Thomas Johannesmeyer. All rights reserved.
#
#!/usr/bin/python
import socket
import os
import sys
import inspect
from threading import Thread
from Logger import *
from time import sleep
from signal import pause
##
# Importin... |
test_sslkeylog.py | import sys
import os
import time
import re
import threading
import socket
import ssl
from contextlib import closing
import pytest
from mock import Mock
from six.moves import socketserver
import sslkeylog
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
CERTFILE = os.path.join(SCRIPT_DIR, 'keycert.pem')
ADDRE... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
import logging
import getpass
import multiprocessing
import fnmatch
import os
import hashlib
import re
import threading
import time
import traceback
import sys
import signal
# Import third party libs
import zmq
HAS_RANGE = False
try:
... |
_kit2fiff_gui.py | """Mayavi/traits GUI for converting data from KIT systems"""
# Authors: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD (3-clause)
import os
from ..externals.six.moves import queue
from threading import Thread
import numpy as np
from scipy.linalg import inv
# allow import without traits
try:
fro... |
Chapter15_ProcessThread10_ThreadLocal.py | # -*- coding: utf-8 -*-
import threading
local_school = threading.local() # 创建全局ThreadLocal对象,其每个属性都是线程的局部变量,可以任意读写而互不干扰
def process_student():
std = local_school.student # 获取当前线程关联的student
age = local_school.age
print(std, age, threading.current_thread().name)
def process_thread(name, ag... |
touch.py | #!/usr/bin/python
import evdev
import threading
import urwid
import os
import sys
#########################################################
# Display stuff
#########################################################
quit = False
class Button(object):
def __init__(self, params):
self.name = params['name']... |
main.py | def main():
from argparse import ArgumentParser
from os import environ
parser = ArgumentParser(
prog='CyberPuffer', description='CyberPuffer - Just yet another telegram bot')
parser.add_argument('--secret', '-s', dest='api_secret')
parser.add_argument('--config', '-c', dest='config_id'... |
test_attach_context_to_thread.py | from threading import Thread
from unittest import TestCase, main
from expects import expect, be, raise_error
from twin_sister import dependency, dependency_context
class TwoStageThread(Thread):
"""
Thread that runs in two stages:
1. Launch the thread but do nothing else
2. Run the target function
... |
TwitterListener.py | import asyncio
import threading
import tweepy
import urllib3
from utils.config import GLOBAL as cfg
from queue import Queue
from threading import Thread
NUM_THREADS = 5
class TwitterListener(tweepy.StreamListener):
def __init__(self, cog, q = Queue()):
super().__init__()
self.twitter_cog = cog
... |
HiwinRA605_socket_ros_20190614132314.py | #!/usr/bin/env python3
# license removed for brevity
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
import threading
import time
##
import sys
import os
import numpy as np
import rospy
import matplotlib as plot
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
import HiwinRA605_s... |
system_tests_http1_adaptor.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... |
yapt.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Photo Tools
"""
import argparse
import datetime
import os
import pathlib
import re
import shutil
import sys
import threading
import time
import typing
import humanize
import piexif
from PIL import Image
from yaptUtils import decode, decodeExifDateTime
__author__ = ... |
test_errcodes.py | #!/usr/bin/env python
# test_errcodes.py - unit test for psycopg2.errcodes module
#
# Copyright (C) 2015 Daniele Varrazzo <daniele.varrazzo@gmail.com>
#
# psycopg2 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 ... |
Lidar.py | # -*- coding: utf-8 -*-
'''
雷达类
基于官方ROS驱动,本脚本只提供订阅"/livox/lidar"topic的后续处理
'''
# 为了某些情况ros驱动没有正常加载,但也可以用主程序类测试
try:
import rospy
from sensor_msgs.msg import PointCloud2
from sensor_msgs import point_cloud2
except:
print("[ERROR] ROS environment hasn't been successfully loaded.You can only use DepthQueue... |
algo_five.py | from functools import reduce
import numpy as np
import random as r
import socket
import struct
import subprocess as sp
import threading
from threading import Thread
import ast
import time
import datetime as dt
import os
import psutil
from netifaces import interfaces, ifaddresses, AF_INET
import paho.mqtt.client as mqtt... |
bruter.py | # Date: 12/28/2018
# Author: Mohamed
# Description: Bruter
import queue
import time
import threading
import typing
from lib.browser import Browser
from lib.display import Display
from lib.proxy_manager import ProxyManager
from lib.password_manager import PasswordManager
from lib.const import max_time_to_wait, max_bots... |
simplepty.py | import tty, termios, signal, fcntl, struct, os, threading, sys, time
def run_in_raw_mode(func):
def inner(*args, **kwargs):
fd = 0
old = termios.tcgetattr(fd)
try:
tty.setraw(fd)
func(*args, **kwargs)
finally:
termios.tcsetattr(fd, termios.TCSADRA... |
distributed_train.py | from rainbow_ddpg.ddpg import DDPG
import baselines.common.tf_util as tfutil
import itertools
from baselines import logger
import numpy as np
import tensorflow as tf
import cv2
import gym
from baselines.common.schedules import LinearSchedule
import sys
import os
from threading import Thread
tmp = os.path.dirname(sys.m... |
stream_interface.py | """Stream Interface base class
"""
import logging
import threading
import time
import traceback
import serial
from .mesh_interface import MeshInterface
from .util import stripnl
START1 = 0x94
START2 = 0xc3
HEADER_LEN = 4
MAX_TO_FROM_RADIO_SIZE = 512
class StreamInterface(MeshInterface):
"""Interface class for... |
zmq_server.py | #!/bin/python
from multiprocessing import Pool
import multiprocessing as mp
import multiprocessing
import socket
import sys
import os
import argparse
import json
import pickle
import ast
import importlib
import contextlib
def execute(connection, address):
import logging
logging.basicConfig(level=logging.DEBUG)... |
util.py |