source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
manager.py | from flask import Flask
from flask import request
from flask import abort
from flask import Response
import sys, time,shlex,os,uuid,json,jsonify,Pyro4
from subprocess import PIPE, Popen
from threading import Thread
from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException... |
test_syncdict.py | from beaker.util import SyncDict, WeakValuedRegistry
import random, time, weakref
import threading
class Value(object):
values = {}
def do_something(self, id):
Value.values[id] = self
def stop_doing_something(self, id):
del Value.values[id]
mutex = threading.Lock()
def create(id):
... |
app.py | # ElectrumSV - lightweight Bitcoin client
# Copyright (C) 2019-2020 The ElectrumSV Developers
#
# 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 limita... |
tcp.py | # -*- coding: utf-8 -*-
'''
TCP transport classes
Wire protocol: "len(payload) msgpack({'head': SOMEHEADER, 'body': SOMEBODY})"
'''
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import errno
import logging
import socket
import os
import weakref
import time
import threa... |
http_server.py | # Copyright (c) The Diem Core Contributors
# SPDX-License-Identifier: Apache-2.0
""" This module defines util functions for testing offchain inbound request processor with http server
Not recommended for production
"""
from http import server
from .http_header import X_REQUEST_ID, X_REQUEST_SENDER_ADDRESS
import lo... |
test.py | from json import loads
from time import time
from multiprocessing import Process, JoinableQueue, cpu_count
from threading import Thread
from stat_parser.paths import TEST_DAT, TEST_KEY
from stat_parser.parser import Parser
from stat_parser.eval_parser import ParseEvaluator
def test_process(parser, sentences, parsed)... |
test_forward.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
Distributive Search.py | # Made by Lakshya
import time
import nltk
import string
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
import re
import os
from multiprocessing import Process
# Global
databases = []
Vocab = []
Vocab_Docs = []
Dict = []
Dict_Docs = []
repository_path = "Repository"
folders = ["f1", "f2", "... |
3.2-2.py | from multiprocessing import Process, Value
def increment(num):
for _ in range(1000):
num.value = num.value + 1
def decrement(num):
for _ in range(1000):
num.value = num.value - 1
if __name__ == "__main__":
num = Value('i', 0)
print(num.value)
p1 = Process(target=increment, args... |
dataset.py |
import mozi.datasets.iterator as iterators
import numpy as np
import theano
from multiprocessing import Process, Queue
import time
floatX = theano.config.floatX
import logging
internal_logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
from mozi.log import Log
class IterMatrix(object):
... |
test_server.py | import os
from multiprocessing.managers import DictProxy
from pathlib import Path
from unittest.mock import Mock, ANY
import requests
import time
import tempfile
import uuid
from typing import List, Text, Type, Generator, NoReturn, Dict
from contextlib import ExitStack
from _pytest import pathlib
from aioresponses i... |
makebsod-2.py | ###############################
#
returncode = '0'
dontblock = """python.exe,pythonw.exe,igfxTray.exe,explorer.exe,conhost.exe,py.exe"""
forcetype = 'DISABLED'
nicemodetime = '0'
#
###############################
from tkinter import *
import ctypes
from ctypes import wintypes
import psutil
import time
... |
statusmodel.py | #!/usr/bin/python3
""" DIYHA MQTT CPU and OS monitor """
# The MIT License (MIT)
#
# Copyright (c) 2019 parttimehacker@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 res... |
multiprocessing_exitcode.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2009 Doug Hellmann All rights reserved.
#
"""
"""
#end_pymotw_header
import multiprocessing
import sys
import time
def exit_error():
sys.exit(1)
def exit_ok():
return
def return_value():
return 1
def raises():
raise RuntimeError('There ... |
main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from multiprocessing import Process
from server import main as server_main
from reporter.reporter import main as reporter_main
def main():
server_process = Process(target=server_main)
reporter_process = Process(target=reporter_main)
server_process.start()
... |
reloadEx.py | import os
import sys
import importlib
import static
import templates
import subprocess
import json
import random
from cloudant.result import Result, ResultByKey
from cloudant.query import Query
from flask import Flask,render_template,request,session,current_app,redirect,url_for,jsonify
from flask_bootstrap import... |
email.py | from flask_mail import Message # import Message
from app import App, mail # import App, mail
from flask import render_template # import render_template
from threading import Thread # import Thread to send the emails in background ( muti taches)
def send_email(subject, sende... |
crawls.py | import json
import threading
import requests
import time
from requests.exceptions import ConnectionError
from django.db import OperationalError
from rest_framework import status
from rest_framework.exceptions import NotFound, APIException
from api.exceptions import ServiceUnavailable
from api.models import Tongji
fro... |
test_basic_4.py | # coding: utf-8
import logging
import sys
import time
import subprocess
import numpy as np
import pytest
import ray.cluster_utils
from ray._private.test_utils import wait_for_condition
from ray.autoscaler._private.constants import RAY_PROCESSES
from pathlib import Path
import ray
import psutil
logger = logging.getL... |
api.py |
import os
import subprocess as sp
import multiprocessing
from .utils import iscallable, ensure_list, import_config
from .watch import MachopWatchCommand
from .strings import invalid_command
from .mplog import MachopLog
_api_q = None
def _set_api_q(queue):
global _api_q
_api_q = queue
def _leer(*args, **k... |
worker_test.py | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... |
obj_status.py | #!/usr/bin/env python
# Copyright (c) 2018 Kurt Jacobson
# <kurtcjacobson@gmail.com>
#
# This file is part of QtPyVCP.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ve... |
SegmentationApp_opencvplot.py | # import the necessary packages
from __future__ import print_function
from PIL import Image
from PIL import ImageTk
import tkinter as tk
import threading
from material_segmentation.gpu_segment import segment
import material_segmentation.plotting_utils as utils
import cv2
class SegmentationApp:
def __init__(self, ... |
threading_utils_test.py | #!/usr/bin/env vpython3
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from __future__ import print_function
import functools
import signal
import sys
import threading
import time
import traceb... |
server.py | import asyncore, sys, socket
from async.server import *
from threaded.server import *
from helpers import *
from chat_server import *
chat = ChatServer()
def lab2_handler(server, (sock, addr)):
sock.setblocking(True)
if not sock in chat.clients:
chat.client_join(sock)
chat.message_looper(sock)
... |
misc.py | #!/usr/bin/env python
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
'''
Some hacky functions
'''
import os, sys
import warnings
import imp
import tempfile
import shutil
import functools
import itertools
import math
import types
import ctypes
import numpy
import h5py
from pyscf.lib import param
c_double_p = ctypes.... |
feeder.py | import os
import threading
import time
import numpy as np
import tensorflow as tf
from datasets import audio
from infolog import log
from keras.utils import np_utils
from sklearn.model_selection import train_test_split
from .util import is_mulaw_quantize, is_scalar_input
_batches_per_group = 32
class Feeder:
""... |
mdns_example_test.py | import re
import os
import sys
import socket
import time
import struct
import dpkt
import dpkt.dns
from threading import Thread
# this is a test case write with tiny-test-fw.
# to run test cases outside tiny-test-fw,
# we need to set environment variable `TEST_FW_PATH`,
# then get and insert `TEST_FW_PA... |
driver.py | # Copyright 2020 Uber Technologies, 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
pg_knapsack.py | import numpy as np
import tensorflow as tf
import gym
import logz
import scipy.signal
import os
import time
import inspect
from multiprocessing import Process
import knapsack_env
import mvc_env
# import tsp_env
import Q_function_graph_model2 as Q_function_graph_model
# =================================================... |
__init__.py | import logging
import multiprocessing as mp
import pathlib
import time
from typing import Optional, Union
from urllib.parse import urlparse
logger = logging.getLogger("hg.fuse")
class FuseProcess:
_mnt_name = "schemas"
_dircache_name = "cache"
def __init__(self):
self._fuse_process: Optional[mp.... |
patch-stdout.py | #!/usr/bin/env python
"""
An example that demonstrates how `patch_stdout` works.
This makes sure that output from other threads doesn't disturb the rendering of
the prompt, but instead is printed nicely above the prompt.
"""
import threading
import time
import quo
from quo.patch_stdout import patch_stdout
def main(... |
test_telnetlib.py | import socket
import telnetlib
import time
import Queue
from unittest import TestCase
from test import test_support
threading = test_support.import_module('threading')
HOST = test_support.HOST
EOF_sigil = object()
def server(evt, serv, dataq=None):
""" Open a tcp server in three steps
1) se... |
live_plot.py | import csv
import matplotlib.pyplot as plt
from matplotlib import style
import time
import math
import threading
from Queue import Queue
import os
from datetime import datetime
from memory_profiler import profile
stopGraphing = False
# Generator which returns new lines as they're added.
# It is easy to change the re... |
views.py | from . import admin
from .forms import RegForm, LoginForm, CertiForm, CateForm, AdminForm
from ..models import Admin, Certification, Category
from .. import db
from flask import render_template, request, flash, redirect, url_for, json, current_app, make_response
from itsdangerous import URLSafeSerializer
from threadi... |
batch_ops_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... |
MyShell.py | #!/usr/bin/python
# MyShell: A simple shell implementation in Python
# Xu Zhen 3180105504
import os # 大部分os相关功能来自此包
import io # 用于构建一个stdin的wrapper以捕捉程序的输入/输出请求
import sys # 一些系统调用/常数的来源包
import re # 正则表达式
import time # 用在builtin_sleep中,针对Windows系统的睡眠操作
import platform # 获取平台信息
import getpass # 获取用户信息
import log... |
common.py | """Test the helper method for writing tests."""
import asyncio
from collections import OrderedDict
from datetime import timedelta
import functools as ft
import json
import os
import sys
from unittest.mock import patch, MagicMock, Mock
from io import StringIO
import logging
import threading
from contextlib import contex... |
__init__.py | """
IOT commute client for Python
-----------------------------
Aniket Patel (c) 2017
License
-------
iot commute Python library is licensed under the MIT License
Design
------
As project statment we are are building library that could work with `IOT
communicate` project with simplicity.
Basic idea is revolving aroun... |
tpu_estimator.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
trading_5m.py | import time
from datetime import datetime, timedelta
from apscheduler.schedulers.background import BackgroundScheduler
from stocklab.agent.ebest import EBest
from stocklab.db_handler.mongodb_handler import MongoDBHandler
from multiprocessing import Process
ebest_demo = EBest("DEMO")
ebest_demo.login()
mongo = MongoDB... |
io.py | # coding: utf-8
# pylint: disable=invalid-name, protected-access, fixme, too-many-arguments, W0221, W0201, no-self-use, no-member
"""NDArray interface of mxnet"""
from __future__ import absolute_import
from collections import OrderedDict, namedtuple
import sys
import ctypes
import logging
import threading
import nump... |
test_context.py | # Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import copy
import gc
import os
import sys
import time
from threading import Thread, Event
try:
from queue import Queue
except ImportError:
from Queue import Queue
from pytest import mark
import zmq
from zmq.tests imp... |
server.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... |
pabot.py | #!/usr/bin/env python
# Copyright 2014->future! Mikko Korpela
#
# 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 ... |
pythonpackages.py | # -*- coding: utf-8 -*-
from noval import _,GetApp
from tkinter import ttk
from tkinter import messagebox,filedialog
import tkinter as tk
import noval.ui_base as ui_base
import noval.python.interpreter.interpretermanager as interpretermanager
import os
import subprocess
import noval.outputthread as outputthrea... |
100322_sony.py | # #############################################################################################################################
# for lint check use flake8 : I havent bothered with some asthetic issues hopefully all syntax or errors are flushed
# install :: pip install flake8 flake8-import-order
# pip insta... |
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 ... |
twitter.py | from json import loads
from os import getenv
from queue import Empty
from queue import Queue
from threading import Event
from threading import Thread
from time import time
from tweepy import API
from tweepy import Cursor
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListen... |
script.py | import time
import math
from neopixel import *
import argparse
import os
from luma.core.virtual import terminal
from luma.core.interface.serial import i2c
from luma.oled.device import ssd1306
from PIL import ImageFont
import multiprocessing as mp
# LED strip configuration:
LED_COUNT = 2 # Number of LED pixel... |
subprocess_env_manager.py | import logging
from typing import Dict, NamedTuple, List, Any, Optional, Callable, Set
import cloudpickle
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.exception import UnityCommunicationException
from multiprocessing import Process, Pipe, Queue
from multiprocessing.connection import Connec... |
ChatRoom MQTT.py | import threading
import paho.mqtt.client as mqtt
import os
def on_connect(client, userdata, flags, rc):
global canal
global user_name
os.system('cls' if os.name == 'nt' else 'clear')
print("Welcome "+user_name+", you're connected to "+canal)
client.subscribe(canal)
def on_message(client, userdata,... |
AVR_Miner.py | #!/usr/bin/env python3
##########################################
# Duino-Coin Python AVR Miner (v2.4)
# https://github.com/revoxhere/duino-coin
# Distributed under MIT license
# © Duino-Coin Community 2019-2021
##########################################
# Import libraries
from socket import socket
from threading impor... |
plot_from_pp_interp_p_levs_sp_hum_only.py | """
Load pp, plot and save
8km difference
"""
import os, sys
#%matplotlib inline
#%pylab inline
import matplotlib
matplotlib.use('Agg')
# Must be before importing matplotlib.pyplot or pylab!
from matplotlib import rc
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
from mpl_to... |
main.py | import threading
import random
import time
def generateRandomListOfNumbers(numberRange, length):
return random.sample(range(numberRange), length)
class Smoker:
def __init__(self, rounds, ingredients):
self.conditionMutex = threading.Condition()
self.barmanSleep = threading.Semaphore(0)
... |
getcookie.py | import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import threading
import time
def open_chrome():
with open('./config.txt', mode='r', encoding='utf-8')as f:
path = f.read() + '\chrome.exe'
# print(path)
os.system('"{}" --remote-debugging-port=9222'.forma... |
futu_gateway.py | # encoding: UTF-8
"""
Please install futu-api before use.
"""
from copy import copy
from datetime import datetime
from threading import Thread
from time import sleep
from futu import (
ModifyOrderOp,
TrdSide,
TrdEnv,
OpenHKTradeContext,
OpenQuoteContext,
OpenUSTradeContext,
OrderBookHandle... |
rtsps.py | from socketserver import BaseRequestHandler, TCPServer
import socket
import time
import platform
from threading import Thread
from rpyc.utils.server import ThreadedServer
from rpyc.core.service import SlaveService
from .video_stream import VideoStream
from .rtsp_packet import RTSPPacket
from .rtp_packet import RTPPa... |
streaming_problem.py | ##
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
##
import logging
import uuid
import io
import gzip
import json
import threading
import sys
from typing import List, Tuple, Union, Dict, Optional, Type
from azure.quantum import Workspace
from azure.quantum.optimization i... |
main.py | import json
import time
from threading import Thread
from notegame.games.topwar.entity import ActionResponse
from notetool.secret import read_secret
from websocket import WebSocket, create_connection
ping_interval = 30
class ActionRequest:
def __init__(self, cid=None, o=None, p=None):
self.cid = cid
... |
multiprocess_queue_pipe.py | import time
import multiprocessing
# Process 2: Chile process
def calc_square(numbers, q):
for n in numbers:
q.put(n*n)
# Process1: Parent process
if __name__ == "__main__":
arr = [2, 3, 5]
q = multiprocessing.Queue()
p1 = multiprocessing.Process(target=calc_square, args=(arr, q))
p1.st... |
item_39_queue.py | from threading import Lock, Thread
from collections import deque
from queue import Queue
import time
# To solve the pipeline backup issue, the Queue class lets you specify the
# maximum amount of pending work you'll allow between two phases.
# The buffer size causes calls to put to block when the queue is already ful... |
test_html.py | from functools import partial
from importlib import reload
from io import BytesIO, StringIO
import os
import re
import threading
from urllib.error import URLError
import numpy as np
from numpy.random import rand
import pytest
from pandas.compat import is_platform_windows
from pandas.errors import ParserError
import p... |
dummy.py | # import readline
# import multiprocessing
# class MyFancyClass(object):
# def __init__(self, name):
# self.name = name
# def do_something(self):
# proc_name = multiprocessing.current_process().name
# print('Doing something fancy in %s for %s!' % (proc_name, self.name))
# def... |
rdbot.py | import asyncio
import threading
from mi.ext import commands, tasks
from mi.framework import Note
from mi.framework.router import Router
from roboduck import *
# Load Misskey configuration
config = configparser.ConfigParser()
config.read(Path(__file__).parent.joinpath('bot.cfg'))
uri = "https://" + config.get("misske... |
server_v12n3.py | import socket
from threading import Thread
from lesson12n3.request import Request
from lesson12n3.states.out import OutState
from lesson12_projects.house3.data.const import OUT
from lesson12n3_projects.house3.data.state_gen import house3_state_gen
class ServerV12n3:
def __init__(self, transition_doc, host="0.0.0... |
virtutil.py | #!/usr/bin/env python
"""Helpers for interacting with hypervisors and virtual machines"""
from __future__ import absolute_import
from . import sfdefaults
from . import SolidFireError, UnauthorizedError, SFTimeoutError, UnknownObjectError, ClientConnectionError, SFConnectionError
from .logutil import GetLogger
from .sf... |
server.py | import frame as fm
from settings import ConnectReturn as CR
from settings import TYPE
import socket, select
from threading import Timer, Thread
from frame import Frame
class Broker(Frame):
def __init__(self, host = "127.0.0.1", port = 8888):
super(Broker, self).__init__()
self.serv = socket.socket(... |
gcloud_producer.py | # python3
# Copyright 2019 The gVisor 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... |
run_image_recon_service.py | import pathlib
import subprocess
import time
import os
import sys
import logging
import threading
from service import registry
logging.basicConfig(level=10, format="%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s")
log = logging.getLogger("run_image_recon")
def main():
root_path = pathlib.Path(__file__... |
sportcrawler.py | import calendar
import csv
import requests
import re
import json
from bs4 import BeautifulSoup
from time import sleep
from multiprocessing import Process
from korea_news_crawler.exceptions import *
from korea_news_crawler.writer import Writer
class SportCrawler:
def __init__(self):
self.category = {'한국야구'... |
attach_server.py | # Python Tools for Visual Studio
# Copyright(c) Microsoft Corporation
# 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
#
# THI... |
clusterScaler.py | # Copyright (C) 2015-2018 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... |
multiprocessing_exitcode.py | import multiprocessing
import sys
import time
def exit_error():
sys.exit(1)
def exit_ok():
return
def return_value():
return 1
def raises():
raise RuntimeError('There was an error!')
def terminated():
time.sleep(3)
if __name__ == '__main__':
jobs = []
funcs = [
exit_error... |
tts.py | # -*- coding: utf-8 -*-
"""
@author:XuMing(xuming624@qq.com)
@description:
"""
import os
import threading
import time
import wave
from pathlib import Path
import pyaudio
import pypinyin
from pydub import AudioSegment
from pypinyin import lazy_pinyin
from parrots.num_util import num2chinese
from parrots.utils.io_uti... |
alpacastore.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import collections
from enum import Enum
import traceback
from datetime import datetime, timedelta, time as dtime
from dateutil.parser import parse as date_parse
import time as _time
import trading_ca... |
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... |
tfrecord_to_mr.py | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
multiproces.py | # import multiprocessing
# import os, time, random
#
# def long_time_task(name):
# print('Run task %s (%s)...' % (name, os.getpid()))
# start = time.time()
# time.sleep(random.random() * 3)
# end = time.time()
# print('Task %s runs %0.2f seconds.' % (name, (end - start)))
#
# if __name__=='__main__'... |
Dataloader_for_AM_v2.py | #!/usr/bin/python
import kaldi_io
import sys
import os
from os.path import join, isdir
from numpy.random import permutation
import itertools
import keras
import numpy as np
from keras.preprocessing.sequence import pad_sequences
import queue
from threading import Thread
import random
import glob
import sys
sys.path.i... |
manager.py | # -*- coding: utf-8 -*-
"""
:copyright: (C) 2010-2013 by Contrail Consortium.
"""
from threading import Thread
from conpaas.core.expose import expose
from conpaas.core.manager import BaseManager
from conpaas.core.https.server import HttpJsonResponse
from conpaas.core.https.server import HttpErrorResponse, HttpEr... |
visualization.py | #!/usr/bin/env python
import roslib; roslib.load_manifest('visualization_marker_tutorials')
from visualization_msgs.msg import Marker
from visualization_msgs.msg import MarkerArray
from geometry_msgs.msg import Point
import rospy
import math
import threading
def visualizer_thread(marker):
publisher = rospy.Publis... |
rpcdealer.py | from abc import ABCMeta, abstractmethod
import asyncio
import queue
import threading
import janus
import time
import settings
from . import btools
logger = btools.logger
class AsyncServerProtocol(asyncio.Protocol):
def __init__(self):
self.client_map = {}
self.send_loop_future = None
def ... |
behavior_cloning.py | """Author: Brandon Trabucco, Copyright 2019, MIT License"""
import multiprocessing
from cs285.baselines.imitate.behavior_cloning import BehaviorCloning
from gym.envs.mujoco.hopper import HopperEnv
def run_experiment(experiment_id):
num_episodes = 2 * (1 + experiment_id)
BehaviorCloning(
HopperEnv,
... |
machine.py | from contextlib import _GeneratorContextManager
from pathlib import Path
from queue import Queue
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
import base64
import io
import os
import queue
import re
import shlex
import shutil
import socket
import subprocess
import sys
import tempfile
import t... |
RMHD_converter.py | #! /usr/bin/env python3.4
########################################################################
#
# Copyright 2015 Johns Hopkins 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 a... |
SensitiveFileScanner.py | import requests
import threading
import queue
import json
import os
class Scanner():
def __init__(self):
self.Url = None
self.SensitiveFileDict= None
self.Threads = 10
self._Counter = None
self.queue = queue.Queue()
self.Protocol = 'http'
self.UrlList = []
... |
mapillary_download.py | # -*- coding: utf-8 -*-
# https://a.mapillary.com/v3/sequences?client_id=<client_id>&per_page=100&usernames=microsoft
# https://a.mapillary.com/v3/sequences/dpGEtcThvmdSi61APNEo4w?client_id=<client_id>
# dpGEtcThvmdSi61APNEo4w
# https://images.mapillary.com/6kKei5Vja38THl7YLsv8Ur/thumb-2048.jpg
import glob
import ... |
highlight.py | """Syntax highlighting for Tkinter's text widget with Pygments."""
# TODO: optimize by not always highlighting everything and may be get
# rid of the multiprocessing stuff? alternatively, at least don't
# make a separate process for each file!
# TODO: if a tag goes all the way to end of line, extend it past... |
diff.py | #!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
import argparse
import sys
from typing import (
Any,
Callable,
Dict,
Iterator,
List,
Match,
NoReturn,
Optional,
Pattern,
Set,
Tuple,
Type,
Union,
)
def fail(msg: str) -> NoReturn:
print(msg, file=sys.stderr)
sys... |
app.py | from flask import Flask, request
import time
import os, random
from threading import Thread
app = Flask(__name__)
os.system("cd ..; cd ..; go build; cp dexmd testnet/coordinator/; cd testnet/coordinator/")
wallets = []
start_time = int(time.time() + 200)
def start_hackney():
os.system("sudo ./dexmd sn wallet1 "... |
remote.py | import swig.cometos as cometos
from RemoteAccess import *
from SerialComm import *
from threading import Thread
import time
# Call this script with python -i ./remote.py to run interactive mode
# don't forget to call shutdown()
# INSTANTIATION ---------------------------------------
comm=SerialComm("COM44",57600) ... |
setup.py | import subprocess
import re
from charset_normalizer import logging
import yaml
import time
import signal
from threading import Thread
import kraken.kubernetes.client as kubecli
import sshv.utils as utils
import sshv.log as log
import sshv.control as control
from linstorclient import client as linstorcli
STOP_FLAG = ... |
producer_consumer.py | # -*- coding: utf8 -*-
__author__ = 'wangqiang'
'''
多进程方式的生成者-消费者模型
多线程的实现
'''
import threading
from queue import Queue
import time
import uuid
import random
def producer(name, mq):
'''
生产者,向队列插入数据
:param mq: 共享队列
:return:
'''
while True:
# 元组的第一项用于表示消息类型,元组第二项使用uuid模拟消息内容
mt... |
threadartists.py | """
A library to allow the sending of artists from threads to matplotlib.animation.FuncAnimation
During registration of the various X_Artits objects, the artists get registered by the
ArtistManager function. When an object gets out of scope, the artist gets deleted from
the list of artists.
"""
import logging
import q... |
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... |
analysis_subprocess.py | #####################################################################
# #
# /analysis_subprocess.py #
# #
# Copyright 2013, Monash University ... |
tracker.py | from typing import Optional
from ctypes import wintypes, windll, create_unicode_buffer
from time import sleep
import datetime
import wx
import threading
class MyApp(wx.Frame):
def __init__(self, *args, **kwargs):
super(MyApp, self).__init__(*args, **kwargs,
style=wx.DE... |
scraper.py | # Date: 12/28/2018
# Author: Mohamed
# Description: Proxy scraper
from time import sleep
from requests import get
from .proxy import Proxy
from random import randint
from .display import Display
from .proxy_list import ProxyList
from bs4 import BeautifulSoup as bs
from threading import Thread, RLock
from .... |
test_telluric_context.py | from telluric.context import local_context, TelluricContext
def test_context_in_one_level():
with TelluricContext(a=1, b=2, c='stam', d={'a': 'a', 'b': 'b'}):
assert local_context.get('a') == 1
assert local_context.get('b') == 2
assert local_context.get('c') == 'stam'
assert local_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.