source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
httpd.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2019 Maltrail developers (https://github.com/stamparm/maltrail/)
See the file 'LICENSE' for copying permission
"""
import BaseHTTPServer
import cStringIO
import datetime
import httplib
import glob
import gzip
import hashlib
import io
import json
import mimetypes
import os
... |
test_inverter.py | """Test cases for inverter.py."""
from io import BytesIO
from queue import Queue
from socket import socketpair, create_connection
from threading import Thread
from time import sleep
from unittest import TestCase
from samil.inverter import calculate_checksum, construct_message, Inverter, InverterEOFError, InverterFinde... |
stoppable_test.py | import os
import unittest
from signal import SIGINT
from time import sleep
from multiprocessing import Process
from rocky.process import stoppable
def nice_process():
with stoppable() as s:
while s.check_stop():
sleep(0.01)
def nasty_process():
with stoppable() as s:
while True... |
test_lock.py | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 28 20:23:09 2015
@author: Eike
"""
from threading import Thread
import time
import tsdb
import redis
TESTDB=9
POOL = redis.ConnectionPool(host='localhost', port=6379, db=TESTDB)
def test_lock_twice_acquire_lt_lock_timeout():
lockname = 'a_key'
conn = redis.... |
genqueue.py | # genqueue.py
#
# Generate a sequence of items that put onto a queue
def consume_queue(thequeue):
while True:
item = thequeue.get()
if item is StopIteration:
break
yield item
# Example
if __name__ == '__main__':
import queue,threading
def consumer(q):
for item ... |
layout.py | from __future__ import annotations
from typing import Optional, Callable, TYPE_CHECKING, TypeVar, Union, Any, cast
import time
import math
import logging
import subprocess
import os
from itertools import product
from threading import Thread
from pywm import (
PyWM,
PyWMOutput,
PyWMDownstreamState,
PYW... |
midi_hub.py | # Copyright 2022 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
notify_mtr.py | #!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import base64
import hashlib
import hmac
import os
import re
import threading
import time
import urllib.parse
import json5 as json
import requests
from utils_env import get_file_path
# 原先的 print 函数和主线程的锁
_print = print
mutex = threading.Lock()
# 定义新的 print 函数
def print... |
models.py | from django.db import models
from django.contrib.auth.models import User
from io import BytesIO
from PIL import Image
from django.core.files import File
import requests
from threading import Thread
from posts import models as post_models
def compress(image):
im = Image.open(image)
if im.mode in ("RGBA","P"):
... |
semaphore_objects_01_bounded.py | import threading
from time import sleep
N_MAX_CLIENTS_LOGGED_SIMULNANEOUSLY: int = 3
N_CLIENTS: int = 15
semaphore = threading.BoundedSemaphore(value=N_MAX_CLIENTS_LOGGED_SIMULNANEOUSLY)
def client() -> None:
semaphore.acquire()
print(f'\n{threading.current_thread().name} -> logged in -> N ACTIVED THREADS: {thr... |
tboplayer.py |
"""
A GUI interface using jbaiter's pyomxplayer to control omxplayer
INSTALLATION
***
* TBOPlayer requires avconv, youtube-dl, and also the python libraries requests, gobject2, gtk2, pexpect and ptyprocess to be installed in order to work.
*
* -------------------------
*
* To install TBOPlayer and all re... |
ANPR_main.py | try:
os.system("killall -9 python")
time.sleep(100)
print("old python process killed ")
except:
print("No running python process ")
pass
from ANPR_lp_detection import *
from ANPR_lp_recognition import *
from postprocess_anpr import *
from user_interface import *
import multiprocessing
def main()... |
event_unittest.py | #!/usr/bin/env python3
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import threading
import time
import unittest
from cros.factory.test import event
from cros.factory.utils import net_ut... |
webServer.py | #!/usr/bin/env/python
# File name : server.py
# Production : GWR
# Website : www.adeept.com
# Author : William
# Date : 2020/03/17
import time
import threading
import move
import Adafruit_PCA9685
import os
import info
import RPIservo
import functions
import robotLight
import switch
import socket
#websocket
im... |
train_pg_f18.py | """
Original code from John Schulman for CS294 Deep Reinforcement Learning Spring 2017
Adapted for CS294-112 Fall 2017 by Abhishek Gupta and Joshua Achiam
Adapted for CS294-112 Fall 2018 by Michael Chang and Soroush Nasiriany
"""
import numpy as np
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import tensorflow a... |
RendererManager.py | """
Copyright (c) 2013 Timon Wong
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, publish, distribute, sub... |
shared_test.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... |
Client.py | import socket
import threading
class Client:
def __init__(self):
self.create_connection()
def create_connection(self):
self.s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
while 1:
try:
host = input('Enter host name --> ')
port ... |
model_server.py | """Scooter ML model server."""
import json
import time
from threading import Thread
import signal
from select import select
import sys
import numpy as np
import redis
# initialize constants used for server queuing
PREDICTION_QUEUE = "prediction:queue"
BATCH_SIZE = 32
SERVER_SLEEP = 0.25
CLIENT_SLEEP = 0.25
TIMEOUT ... |
test_fx.py | import builtins
import contextlib
import copy
import functools
import inspect
import math
import numbers
import operator
import os
import pickle
import sys
import torch
import traceback
import typing
import types
import warnings
import unittest
from math import sqrt
from torch.multiprocessing import Process
from torch.... |
httpclient_test.py | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
import base64
import binascii
from contextlib import closing
import functools
import sys
import threading
from tornado.escape import utf8
from tornado.httpclient import HTTPRequest, HTTPResponse, _RequestProxy, HTT... |
discovery_client.py | # Copyright (c) 2020 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 appli... |
dcos_rsyslog_tcp_proxy.py | #!/usr/bin/env python3.6
# Brief: Logs Proxy between DC/OS and Rsyslog
# Author: Alejandro Villegas Lopez <avillegas@keedio.com>
################################################################################
# Libraries
import json
import socket
import time
import threading
import argparse
import logging
import err... |
serverlogic.py | ###################################################################
from traceback import print_exc as pe
import uuid
import time
import os
from threading import Thread
import requests
import json
import chess
import random
###################################################################
import utils.file
from ut... |
routes.py | from flask import Flask, render_template
from time import sleep
import threading
def waitfn(arg):
for i in range(arg):
with open('foo.txt', 'a') as f:
f.write("i {0}\n".format(i))
sleep(2)
app = Flask(__name__)
@app.route('/')
def home():
return render_template('home.html')
@a... |
pika_route.py | import random
import threading
import pika
"""
总结:
"""
def send():
tag = random.choice(['info', 'error', 'warn'])
rb_conn = pika.BlockingConnection(pika.ConnectionParameters(host='192.168.101.129',
port=5672,
... |
indicator.py | #!/bin/env python
# -*- coding: utf-8 -*-
"""Indicator."""
import os
import subprocess
import signal
import json
import gi
import time
from threading import Thread
from urllib2 import Request, urlopen
gi.require_version("Gtk", "3.0")
gi.require_version('AppIndicator3', '0.1')
gi.require_version('Notify', '0.7')
fr... |
raspberrySpyLcd.py | #!/usr/bin/python
#
# HD44780 LCD Test Script for
# Raspberry Pi
#
# Author : Matt Hawkins, refactored into class with scrolling support
# Site : http://www.raspberrypi-spy.co.uk
#
# Date : 26/07/2012
# - updated for 4x20 originally did 2x16
import os
import sys
import syslog
import threading
import RPi.GPIO as G... |
worker.py | import collections.abc
try:
import dill as pickle
except ImportError:
import pickle
import multiprocessing as mp
import signal
import traceback
import _thread
from datetime import datetime
from functools import partial
from threading import Thread
from typing import Any, Callable, List, Optional, Tuple, Union, ... |
jukebox.py | """
jukebox.py
"""
import logging
import os
import threading
import time
from pprint import pprint
from typing import Tuple, List, Union, Optional, Generator, Dict
import spotipy
import spotipy.util as util
from dotenv import load_dotenv
from spotipy.oauth2 import SpotifyOAuth
import os
import json
import socket
# ... |
pyminer.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
bitmex_websocket.py | # coding: UTF-8
import hashlib
import hmac
import json
import os
import threading
import time
import traceback
import urllib
import websocket
from datetime import datetime
from src import logger, to_data_frame, notify
from src.config import config as conf
def generate_nonce():
return int(round(time.time() * 100... |
pyTaskManager.py | #!/usr/bin/env python
# coding: utf-8
#
# Copyright (C) 2017 hidenorly
#
# 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 ... |
Gorombaba.py | # coding=utf-8
#coding_by_Azhar_Baloch
#Sahu-Zada
import os,sys,time,datetime,random,hashlib,re,threading,json,getpass,urllib,cookielib
from multiprocessing.pool import ThreadPool
try:
import mechanize
except ImportError:
os.system("pip2 install mechanize")
try:
import requests
except ImportError:
os.system("pip2 ... |
test_sched.py | import queue
import sched
import time
import unittest
try:
import threading
except ImportError:
threading = None
TIMEOUT = 10
class Timer:
def __init__(self):
self._cond = threading.Condition()
self._time = 0
self._stop = 0
def time(self):
with self._cond:
... |
nighthawk_grpc_service.py | import logging
import socket
import subprocess
import tempfile
import threading
import time
from common import IpVersion
# TODO(oschaaf): unify some of this code with the test server wrapper.
class NighthawkGrpcService(object):
"""
Class for running the Nighthawk gRPC service in a separate process.
Usage:
... |
tb_device_mqtt.py | # Copyright 2020. ThingsBoard
#
# 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 ... |
cli.py | # coding:utf-8
import sys
import logging
import argparse
import threading
import time
import os
from six.moves import queue
from captain_comeback.index import CgroupIndex
from captain_comeback.cgroup import Cgroup
from captain_comeback.restart.engine import RestartEngine, restart
from captain_comeback.activity.engine ... |
scheduler.py | import calendar
import ctypes
import datetime
import logging
import sched
import threading
from threading import Thread
from typing import Callable, List
from crontab import CronTab
from injector import Module, inject, singleton
from prometheus_client.metrics import Gauge
from rep0st.framework.execute import execute
... |
mcafee_esm_case_polling.py | # -*- coding: utf-8 -*-
# pragma pylint: disable=unused-argument, no-self-use
# (c) Copyright IBM Corp. 2010, 2018. All Rights Reserved.
"""Polling implementation"""
import logging
import time
import json
import calendar
import jinja2
from datetime import datetime
from threading import Thread
from os.path import join,... |
Knight_Tour.py | import pygame
from heapq import *
import random
import time
import ExtraWidgits
import ExtraWidgits_for_Pathfinders
from threading import *
import StartProcess
import Knight_Tour
RunClock=True
class Knight():
def __init__(self, v, speed):
self.n = v
self.cb = [[0 for x in range(v)] for y in range(... |
post_rec_particles.py | """
Script for post-processing already reconstructed particles
Input: - STAR file with next columns:
'_rlnMicrographName': tomogram that will be used for reconstruction
'_rlnImageName': tomograms used for picking
'_rlnCtfImage': (optional) CTF model subvolume
... |
beacon.py | import logging
import os
import re
import uuid
import time
import threading
import socket
import util
log = logging.getLogger(__name__)
MULTICAST_PORT = 9131
MULTICAST_IP = '239.255.250.250'
MULTICAST_TTL = int(os.getenv('IP2SL_BEACON_HOPS', 2)) # after TWO network hops the beacon packet should be discarded
# I... |
test_thread.py | import contextvars
import operator
import threading
import time
import pytest
from threadlet import Future, TimeoutError
from threadlet.thread import Thread
from threadlet.utils import FuturedFunc
NUMBERS = [1, 2]
EXPECTED_RES = sum(NUMBERS)
ctx_var: contextvars.ContextVar = contextvars.ContextVar("ctx_var")
def ... |
opentera_webrtc_audio_mixer.py | #!/usr/bin/env python3
# PYTHONPATH is set properly when loading a workspace.
# This package needs to be installed first.
import pyaudio
import numpy
import threading
from datetime import datetime, timedelta
import queue
# ROS
import rospy
from opentera_webrtc_ros_msgs.msg import PeerAudio
p = pyaudio.PyAudio()
outp... |
email.py | import logging
import urllib
from textwrap import dedent
from mailer import Mailer, Message
from retrying import retry
from dart.model.exception import DartEmailException
from dart.context.locator import injectable
from dart.util.config import _get_dart_host
from Queue import Queue
from threading import Thread
_logg... |
personTracking.py | #NAME: personTracking.py
#DATE: 08/02/2019
#AUTH: Ryan McCartney, EEE Undergraduate, Queen's University Belfast
#DESC: A python class for tracking people data streamed from a kinect camera
#COPY: Copyright 2018, All Rights Reserved, Ryan McCartney
import threading
import numpy as np
import cv2 as cv
import time
i... |
test_arrow.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 applic... |
pmkid.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from ..model.attack import Attack
from ..config import Configuration
from ..tools.hashcat import HcxDumpTool, HcxPcapTool, Hashcat
from ..util.color import Color
from ..util.timer import Timer
from ..model.pmkid_result import CrackResultPMKID
from threading import Thread
... |
server.py | import os
import threading
import socket
from http.server import BaseHTTPRequestHandler, HTTPServer
class ExploitHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
mimeType = 'text/html'
if self.path == '/':
self.path = '/index.html'
if self.pa... |
monitor.py | import subprocess
import threading
import time
import json
import requests
import sys
controller_ip_port = 'localhost:8080'
def getThroughput(pool_id, id, ip):
p = subprocess.Popen('iperf3 -c ' + ip + ' -p 500 -w 500 k -J --connect-timeout 10000', stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
... |
main.py | from threading import Thread
from imutils.video import VideoStream
import cv2
import time
import imutils
import math
import argparse
import matplotlib.pyplot as plt
import numpy as np
parser = argparse.ArgumentParser(
description='This program calculates either the static or kinetic friction coefficient between t... |
athenad.py | #!/usr/bin/env python3
import base64
import hashlib
import io
import json
import os
import sys
import queue
import random
import select
import socket
import threading
import time
from collections import namedtuple
from functools import partial
from typing import Any
import requests
from jsonrpc import JSONRPCResponseM... |
robot_gui.py | import sys
import time
import ast
import csv
import os
import math
import threading
import numpy
import rclpy
from rclpy.node import Node
from std_msgs.msg import String
from sensor_msgs.msg import JointState
from robot_msgs.msg import GuiToRobot, RobotToGui
from ament_index_python.packages import get_package_share_di... |
HASSStatus.py | # HomeAssistant Status Output
# Publishes the provided sensor key and value pair to a HomeAssistant instance
from ww import f
class HASSStatus:
import time
import threading
import requests
apiKey = None
config = None
configConfig = None
configHASS = None
debugLevel = 0
master = ... |
run_test.py | #!/usr/bin/env python3
# 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.
import multiprocessing as mp
import os
import shutil
import subprocess
import tempfile
imp... |
install_utils.py | import getopt
import re
import subprocess
import sys
import threading
import time
sys.path = [".", "lib"] + sys.path
import testconstants
from remote.remote_util import RemoteMachineShellConnection, RemoteUtilHelper
from membase.api.rest_client import RestConnection
import install_constants
import TestInput
import log... |
blinds_control.py | # server stuff
# import simple_server as simpleSrvr
from simple_server import *
# motor control stuff
import motor_control as motorCtrl
# blossom control
import blossom_control as blossom
# blossom info
blossom_add = blossom.blossom_add
blossom_blinds = {'raise':'fear2','lower':'sad3','':'yes'}
# GPIO setup
import RP... |
data_plane.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... |
tasking_manager_geometries.py | import csv
from queue import Queue
import threading
from osgeo import ogr
from mapswipe_workers.definitions import logger
from mapswipe_workers.definitions import DATA_PATH
from mapswipe_workers.utils import tile_functions, geojson_functions
def load_data(project_id: str, csv_file: str) -> list:
"""
This wil... |
server.py | import socket, threading
import keyboard
users = 0
def user(conn, n):
global users
myid = users
print("New user: " + str(myid))
users += 1
while True:
data = conn.recv(128)
if not data:
break
s = data.decode().split(';') # UP/DOWN;keycode
print(s[0]... |
udp_main.py | import socketserver
import threading
import os
import random
import time
# import binascii
from . import aes
from .udp_parser import CommandParser
from .udp_class import Room, Player, bi
from .udp_config import Config
# token: {'key': key, 'room': Room, 'player_index': player_index, 'player_id': player_id}
link_play_... |
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... |
app.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @author : microfat
# @time : 09/27/20 14:03:09
# @File : app.py
import hashlib
import threading
import json
from pygments import highlight, lexers, formatters
from flask import Flask, request
app = Flask(__name__)
class Handle:
def __init__(self):
pass... |
bmv2.py | # coding=utf-8
"""
Copyright 2019-present Open Networking 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 la... |
fileStore.py | # Copyright (C) 2015-2016 Regents of the University of California
#
# 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... |
distributor.py | import json
import os
import re
import hashlib
import threading
from File.file import File
from Performance import recoder
from .operate import Operate
from .task import *
import GPUtil
import tensorflow as tf
import psutil
# noinspection PyTypeChecker
class Distributor:
def __init__(self, modelConfig, adb_path,... |
__init__.py | import asyncio
import json
import threading
from threading import Thread
import numpy as np
import pydash as _
from si_prefix import si_format, si_parse
from dropbot import SerialProxy
from micropede.client import MicropedeClient , dump_stack
from micropede.async import MicropedeAsync
SCHEMA = {
"t... |
app.py |
import sys,os
#if __name__ == "__main__":
# basedir=os.path.abspath(os.path.dirname(__file__) + '/../..')
# print(basedir)
# os.chdir(basedir)
# sys.path.append(basedir)
import numpy as np
import tqdm
from PyQt5.QtWidgets import QApplication, QLineEdit, QFileDialog, QDialog,QVBoxLayout
from PyQt5 import ... |
PasswordCheckBase.py | # -*- coding: utf-8 -*-
# !/usr/bin/env/ python3
"""
Author: Rookie
E-mail: hyll8882019@outlook.com
"""
import tldextract
from collections import deque
from threading import Thread
from concurrent.futures import ThreadPoolExecutor
from urllib.parse import urlparse
from RookieTools.CheckBase import CheckBase, abstractme... |
Test.py | # Refer to the following link for PyQt documentation:
# http://pyqt.sourceforge.net/Docs/PyQt4/classes.html
# Written for AMIS-30543 driver.
'''
At an RPM of 60 and an input of 200 steps in mode 1/1, takes motor 1 second to complete task
At an RPM of 120 and an input of 200 steps in mode 1/2, takes motor 1 second to c... |
service.py | """
Base types for all anchore engine services
"""
import copy
import connexion
import enum
from flask import g, jsonify
import json
import os
from pathlib import Path
import yaml
import time
import threading
import traceback
from anchore_engine.configuration import localconfig
from anchore_engine.subsys import log... |
zeromq_queue.py | # -*- coding: utf-8 -*-
"""ZeroMQ implementations of the Plaso queue interface."""
import abc
import errno
import threading
import time
# The 'Queue' module was renamed to 'queue' in Python 3
try:
import Queue # pylint: disable=import-error
except ImportError:
import queue as Queue # pylint: disable=import-erro... |
webserver.py | import time
import threading
import traceback
import json
import nose
import sys
import linecache
import inspect
import os.path
try: # Python 2
import Queue as queue
import urlparse
from StringIO import StringIO
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import SocketServer as so... |
pkg.py | #!/usr/bin/python3
import os
import sys
import json
import subprocess
from glob import glob
from threading import Thread
from PyQt5.QtCore import QFileInfo, QPointF, QSize, QUrl, Qt, QRect
from PyQt5.QtGui import QColor, QDesktopServices, QFont, QImage, QIcon, QBrush, QPixmap, QPainter, QWindow
from PyQt5.QtWidgets i... |
client-multithread.py | import requests
import random
import threading
import sys
HOST, PORT = "localhost", 9999
data_url = "http://localhost:3000/test_data/file"
max_file_count = 9
max_file_name = 9
nthreads = int(sys.argv[1])
def client_method():
fnames = ''
nfiles = random.randrange(0, max_file_count)
for i in range(nfiles)... |
client_socket.py | """
client_socket.py:
Socket used to attach to the TCP server as a client and read/write data.
"""
import select
import socket
import threading
from fprime.constants import DATA_ENCODING
from fprime_gds.common.handlers import DataHandler
# Constants for public use
GUI_TAG = "GUI"
FSW_TAG = "FSW"
class ThreadedTCP... |
project_run.py | #!/usr/bin/python
# ----------------------------------------------------------------------------
# cocos "install" plugin
#
# Authr: Luis Parravicini
#
# License: MIT
# ----------------------------------------------------------------------------
'''
"run" plugin for cocos command line tool
'''
__docformat__ = 'restruc... |
initialize.py | from distutils.version import LooseVersion
import requests
import os
import shutil
import threading
import webbrowser
from zipfile import ZipFile
from pathlib import Path
import traceback
import tempfile
# import concurrent.futures
from flask import Flask, url_for, make_response
from flask.json import dumps
from flask_... |
scriptinfo.py | import os
import sys
from copy import copy
from functools import partial
from tempfile import mkstemp
import attr
import logging
import json
from furl import furl
from pathlib2 import Path
from threading import Thread, Event
from .util import get_command_output
from ....backend_api import Session
from ....debugging i... |
massif.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2014-2018 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu)
#
# Permission is hereby gra... |
service.py | """[Docstring] Declares functions, running the heartbeat."""
from threading import Thread
from time import sleep
from paho.mqtt.client import Client, MQTTv311
class Service:
"""[Docstring] Static class, holding and managing the microservice's heartbeat thread."""
heartbeatThread: Thread
heartbeatCount: int... |
mail.py | from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from app import mail
def _send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_object()
msg = M... |
workbench.py | # -*- coding: utf-8 -*-
import ast
import collections
import importlib
import os.path
import pkgutil
import platform
import queue
import re
import shutil
import socket
import sys
import tkinter as tk
import tkinter.font as tk_font
import traceback
import webbrowser
from logging import getLogger
from threading import Th... |
app.py | # encoding: utf-8
'''
A REST API for Salt
===================
.. py:currentmodule:: salt.netapi.rest_cherrypy.app
.. note::
This module is Experimental on Windows platforms, and supports limited
configurations:
- doesn't support PAM authentication (i.e. external_auth: auto)
- doesn't support SSL (i.... |
tun.py | #!/usr/bin/env python3
import os
import pickle
import time
import numpy as np
import talib.abstract as ta
import tensorflow as tf
import threading
from random import randint
from pandas import DataFrame, Series
from sklearn.preprocessing import MinMaxScaler
from keras.models import load_model
from telegram import Pars... |
manager.py | #!/usr/bin/env python3.5
# manager will start all requird processes (Python, C, C++)
# for testing see also https://medium.com/@comma_ai/open-sourcing-openpilot-development-tools-a5bc427867b6
import os
import sys
import fcntl
import errno
import signal
import subprocess
#import logging
#instead of setting the PYTHO... |
run.py | from aws_iot_client import AWSIOTClient
from sensor import Sensor
import time
from datetime import datetime
import threading
import json
from concurrent.futures import ProcessPoolExecutor as executor
from random import random
class Config:
def __init__(self, host, rootCA, cert, privkey, clientId, devices):
... |
HiwinRA605_socket_ros_test_20190625195933.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... |
test_tensorflow2_autolog.py | # pep8: disable=E501
import collections
import pytest
import sys
from packaging.version import Version
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras import layers
import mlflow
import mlflow.tensorflow
import mlflow.keras
from mlflow.utils.autologging_utils import BatchMetricsL... |
azurecli.py | import json
import os
import signal
import subprocess
import sys
from io import StringIO
from threading import Thread, Timer
from azure.cli.core import get_default_cli
from fstrings import f
from six.moves.queue import Empty, Queue
from . import telemetry
from .compat import PY2
if PY2:
from .compat import FileN... |
lab5.py | import threading
tr_dict = dict()
mutex = threading.Lock()
prohibited = (',','.','?','!','-','+','\'','@')
def Count_trigrams(in_str):
trgrms = dict()
trgrm = ""
for i in in_str:
if i not in prohibited:
trgrm += i
else:
trgrm = ""
if len(trgrm) == 3:
if trgrm in trgrms:
trgrms[... |
old_alimama.py | # encoding: utf-8
import os
import re
import json
import os.path
import configparser
import platform
import random
import sys
import time
import traceback
import datetime
if sys.version_info[0] < 3:
import urllib
else:
import urllib.parse as urllib
from io import BytesIO
import pyqrcode
import requests
from P... |
ArnoldDenoiser.py | """************************************************************************************************************************************
Copyright 2017 Autodesk, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
Yo... |
demo.py | # -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import math
import os
from multiprocessing import Queue, Process
import cv2
import numpy as np
import tensorflow as tf
from alpharotate.libs.utils.coordinate_convert imp... |
test4.py | ''' Attempting to write an octree in python
I want this to work with VERY large data sets that can't be stored fully in memory. So my procedure will be as follows:
- need to read in line-by-line and clear memory every X MB (or maybe every X particles;can I check memory load in python?)
- go down to nodes with contain... |
test_executor_timeout_failures.py | import multiprocessing
import time
import pytest
from jina import Client, Document, Executor, Flow, requests
class SlowExecutor(Executor):
@requests
def foo(self, *args, **kwargs):
time.sleep(0.2)
def _test_error(flow_kwargs, add_kwargs, error_port=None):
f = Flow(**flow_kwargs).add(**add_kwar... |
parallel.py | # coding: 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
# "License... |
Beat.py | from DataBase import DataBase
from NeuralNet import NeuralNet
from threading import Thread
from kivy.app import App
from GraphViewerWidget import GraphViewerWidget
import numpy as np
from kivy.clock import Clock
from Config import Config
class Beat(App):
def __init__(self, **kwargs):
super(Beat, self).__i... |
myRL_1_server_no_training.py | #!/usr/bin/env python
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
import base64
import urllib
import sys
import os
import json
os.environ['CUDA_VISIBLE_DEVICES']=''
import numpy as np
import tensorflow as tf
import time
import a3c
import multiprocessing
import time
import copy
im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.