source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
clientes.py | import socket
from threading import Thread
PORT = 5000
NUM_CLIENTS = 10
def start_connection():
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('localhost', PORT))
chunks = []
bytes_received = 0
while bytes_received < 18:
chunk = client_socket.rec... |
extract_observations.py | #!/usr/bin/python
#
# Copyright 2018 Dmytro Korduban. All Rights Reserved.
#
# Copyright 2017 Google 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://... |
utils.py | import json
import os
from multiprocessing import Process, Queue
import numpy as np
import pandas as pd
from scipy.stats import entropy
def makedir(dir_list, file=None):
save_dir = os.path.join(*dir_list)
if not os.path.exists(save_dir):
os.makedirs(save_dir)
if file is not None:
save_dir... |
client.py | import json
import re
from threading import Thread
import subprocess
import os
import select
import sys
import socket
import multiprocessing
import time
from colorama import Fore, Style
from random import randint
from bidict import bidict
from collections import defaultdict
from utils import *
from inpu... |
coordinator.py | # Copyright 2015 Google 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 applicable law or a... |
data_utils.py | # Copyright 2015 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... |
test_threadedExternal.py | import logging
import time, datetime
from thespian.test import *
from thespian.actors import *
import threading
ASK_WAIT = datetime.timedelta(seconds=5)
THREAD_WAIT_TIME=5 # seconds
finishes_lock = threading.Lock()
success_finishes = 0
failure_finishes = 0
def asker_main(asys, count, finished_address, ordered=Fals... |
object_storage_service_benchmark.py | # Copyright 2016 PerfKitBenchmarker 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... |
Main_Program_v3.py | '''
Main Program v3
--- Features:
- Support for reading GPS position values through LCM
- Support for reading GPS command values through LCM
- Support for Mode change
- Support for infrared line following
'''
#############
# Import libraries
from multiprocessing import Process, Value, Array
import numpy as np
i... |
cron.py | import logging
import threading
import time
from datetime import datetime, timedelta
from croniter import croniter
from core.cron.runnableascron import RunnAbleAsCron
class Cron:
runnableAsCron: [RunnAbleAsCron] = []
runningCron: {str} = set()
def __init__(self, ):
threading.Thread(target=self._l... |
VideoManager.py | import threading
import cv2 as cv
import datetime
from src.MotionDetector import MotionDetector
class VideoManager(object):
def __init__(self, length, video_format):
self.video_format = video_format
self.length = length
self.device = 0
self.codec = 'XVID'
self.fourcc = cv.V... |
compressed_vipc.py | #!/usr/bin/env python3
import os
os.environ["NV_LOW_LATENCY"] = "3" # both bLowLatency and CUVID_PKT_ENDOFPICTURE
import sys
import numpy as np
import multiprocessing
from cereal.visionipc.visionipc_pyx import VisionIpcServer, VisionStreamType # pylint: disable=no-name-in-module, import-error
W, H = 1928, 1208
V4... |
_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 w... |
test_mcrouter_basic.py | # Copyright (c) 2017, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the LICENSE
# file in the root directory of this source tree.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from t... |
echo_server.py | #!/usr/bin/env python3
import socket
import threading
def client_handler(conn,addr):
msg = "you are {}:{}\n".format(addr[0],addr[1])
conn.send(msg.encode("UTF-8"))
while True:
try:
data = conn.recv(1024)
conn.sendall(data)
except socket.error:
conn.close(... |
bhpnet.py | import sys
import socket
import getopt
import threading
import subprocess
# define some global vars
listen = False
command = False
upload = False
execute = ""
target = ""
upload_destination = ""
port = 0
def client_sender(buffer):
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
#conne... |
window.py | # -*- coding: utf-8 -*-
"""
Display window properties (i.e. title, class, instance).
Configuration parameters:
cache_timeout: refresh interval for i3-msg or swaymsg (default 0.5)
format: display format for this module (default "{title}")
hide_title: hide title on containers with window title (default False... |
COP_server.py | # https://stackoverflow.com/questions/19475955/using-django-models-in-external-python-script
from django_daemon_command.management.base import DaemonCommand
from django.utils import timezone
from api.models import Host
from alerts.models import Alert
import threading, socket, json, time
from typing import Final
import... |
thread_2.py | import paho.mqtt.client as mqtt
import time
import threading
import zbar
import serial
import threading
import cv2
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import image as image
from collections import defaultdict
from PIL import Image
# -------------------------------------------------... |
lockd.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import threading
import weakref
import time
sys.path.append("../")
from pysyncobj import SyncObj, replicated, SyncObjConf
import asyncio
import sys
import tornado.web
class LockImpl(SyncObj):
def __init__(self, selfAddress, partnerAddrs, aut... |
minion.py | # -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
from __future__ import absolute_import, print_function, with_statement, unicode_literals
import os
import re
import sys
import copy
import time
import types
import signal
import random
import fnmatch
import logging
import threading
import ... |
dx_refresh_vdb.py | #!/usr/bin/env python
# Adam Bowen - Apr 2016
# This script refreshes a vdb
# Updated by Corey Brune Oct 2016
# requirements
# pip install --upgrade setuptools pip docopt delphixpy.v1_8_0
# The below doc follows the POSIX compliant standards and allows us to use
# this doc to also define our arguments for the script. ... |
quality.py | #!/usr/bin/env python3
from olctools.accessoryFunctions.accessoryFunctions import GenObject, make_path, run_subprocess, write_to_logfile
import olctools.accessoryFunctions.metadataprinter as metadataprinter
from genewrappers.biotools import bbtools
from Bio.SeqUtils import GC
from Bio import SeqIO
from subprocess impor... |
dart_env_v4.py | # from rl.core import Env
import pydart2 as pydart
import numpy as np
from math import exp, pi
from PyCommon.modules.Math import mmMath as mm
from random import randrange, random
import gym
import gym.spaces
from gym.utils import seeding
import PyCommon.modules.Resource.ysMotionLoader as yf
from DartDeep.pd_controller... |
executorselenium.py | import json
import os
import socket
import threading
import time
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
st... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum_xazab.xazab_ps_util import (PSPossibleDoubleSpendError,
PSS... |
concurrenttest.py | import threading
import multiprocessing
import time
from os import getpid
from multiprocessing import Pool
def word():
for i in range(1, 9):
print("正在工作写文档%d,进程ID为%d" % (i, getpid()))
time.sleep(1)
def music():
for i in range(1, 5):
print("正在听歌%d,进程ID为%d" % (i, getpid()))
time... |
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
import logging
import msgpack
import socket
import os
import weakref
import time
import traceback
import errno
# Import Salt... |
sensormonitor.py | import datetime
import json
import logging
import statistics
import threading
import requests
import sqlite3
import time
from config import Config
from sensor import Sensor
import errno
import os
import urllib.parse
from paho.mqtt import client as mqtt_client
class SensorMonitor:
mqtt_client = None
latest_da... |
test_distributed.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT ARRANTI... |
instaForPepper.py | # This Python file uses the following encoding: utf-8
#WICHTIG: Dialoge und GUI Einheiten immer über den Roboter beenden und niemals einfach das Programm terminieren
# ansonten werden Behaviors nicht richtig geschlossen!
from instagram_private_api import Client, ClientCompatPatch
import qi
from naoqi import ALProxy
i... |
utils.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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... |
api_server.py | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
Hiwin_RT605_ArmCommand_Socket_20190627203841.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import socket
##多執行序
import threading
import time
import sys
import matplotlib as plot
import HiwinRA605_socket_TCPcmd as TCP
import HiwinRA605_socket_Taskcmd as Taskcmd
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv imp... |
common_utils.py | r"""Importing this file must **not** initialize CUDA context. test_distributed
relies on this assumption to properly run. This means that when this is imported
no CUDA calls shall be made, including torch.cuda.device_count(), etc.
torch.testing._internal.common_cuda.py can freely initialize CUDA context when imported.... |
app.py | from flask import Flask, request, render_template
from multiprocessing import Process, Lock
from pixels import cleantext, displaychar, scrolltext
app = Flask(__name__)
app.config['TEMPLATES_AUTO_RELOAD'] = True
lock = Lock()
scrolltext("❤️", delay=0.02)
@app.route('/')
def index():
return render_template('inde... |
test_client.py | #
# Copyright (c) dushin.net All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the foll... |
collect.py | # 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 writing, software
# distributed under the... |
test_utils.py | import json
import os
import shutil
import tempfile
import time
import zipfile
import multiprocessing
import contextlib
from unittest import mock
from django import forms
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.core.files.uploadedfile import Simple... |
vid2img_sthv2.py | # Code for "TSM: Temporal Shift Module for Efficient Video Understanding"
# arXiv:1811.08383
# Ji Lin*, Chuang Gan, Song Han
# {jilin, songhan}@mit.edu, ganchuang@csail.mit.edu
import os
import threading
NUM_THREADS = 100
VIDEO_ROOT = '/ssd/video/something/v2/20bn-something-something-v2' # Downloaded webm vid... |
module.py | import requests
import json
import threading
import queue
import time
from lib.outputlib import *
# The base class of Module().
# All modules shall be inherited from this class.
class Module:
# Init method. All variables and arguments goes here.
def __init__(self, module_controller):
self.module_contr... |
tcp.py | import socket
import sys
import traceback
import struct
import threading
from threading import Thread
import time
import datetime
import json
import buffered_message
from connection_state import ConnectionState
# *************
# EXAMPLE USAGE
# *************
"""
import socket
import tcp
import sys
import traceback
d... |
learning_threading.py | from threading import Thread
import time
def timer(name, delay, repeat):
print("Timer: " + name + " Started")
while repeat > 0:
time.sleep(delay)
print(name + ": " + str(time.ctime(time.time())))
repeat -= 1
print("Timer: " + name + " Completed")
def Main():
t1 = Thread(target=timer,args=("Timer1",1,5))
t... |
thread_sync.py | from threading import Thread
from time import sleep
ls = []
def looper(i):
for n in range(1,i+1):
ls.append(n)
sleep(0.01)
def count(i):
looper(i)
def count2(i):
looper(i)
t1 = Thread(target=count, args=(5,))
t1.start()
t2 = Thread(target=count, args=(5,))
t2.... |
perf_stress_runner.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
cloudalgo_main.py | # - config: The path to the config file for the cloud algo
#
# Usage: python -m cloudalgo_main -config=../config/cloudalgo_config.json
import sys
sys.path.append("../")
from cloudalgo.cloud_algo import CloudAlgo
import multiprocessing
import argparse
# Parse command line arguments
parser = argparse.ArgumentParser()
... |
flcliapi.py | """
flcliapi - Freelance Pattern agent class
Model 3: uses ROUTER socket to address specific services
Author: Min RK <benjaminrk@gmail.com>
"""
import threading
import time
import zmq
from zhelpers import zpipe
# If no server replies within this time, abandon request
GLOBAL_TIMEOUT = 3000 # msecs
# PING interva... |
OSCListener.py | #!/usr/bin/python
# OSCListener.py
#
# by Claude Heintz
# copyright 2014 by Claude Heintz Design
#
# see license included with this distribution or
# https://www.claudeheintzdesign.com/lx/opensource.html
import socket
import threading
import time
from select import select
import math
import struct
class OSC... |
server.py | from socket import *
from fib import fib
from threading import Thread
def fibServer(address):
sock = socket(AF_INET, SOCK_STREAM)
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
sock.bind(address)
sock.listen(5)
while True:
client, addr = sock.accept()
print("Connection", addr)
... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from typing import TYPE_CHECKING, Optional, Union, Callable, Sequence
from electrum.storage import WalletStorage, StorageReadWriteError
from electrum.wallet_db import WalletDB
from el... |
motor_imagery_app.py | """Example program to show how to read a multi-channel time series from LSL."""
import math
import threading
# import pygame
from random import random
from sklearn.preprocessing import OneHotEncoder
from pylsl import StreamInlet, resolve_stream
import numpy as np
import pandas as pd
import time
from sklearn import m... |
vector_envs.py | import copy
import multiprocessing as mp
from abc import ABC, abstractmethod
from typing import Any, Iterator, List, Tuple
import gym
import numpy as np
def worker(parent_conn: mp.Pipe, child_conn: mp.Pipe, env: gym.Env):
"""
Worker class to facilitate multiprocessing
:param parent_conn: Parent connecti... |
script.py | """Magic functions for running cells in various scripts."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import asyncio
import atexit
import errno
import os
import signal
import sys
import time
from subprocess import CalledProcessError
from threading import Thre... |
ThreadedCopy.py | import threading, os, time
import queue
import shutil
from glob import glob
fileQueue = queue.Queue()
j =2
destPath = f'1000{j}'
class ThreadedCopy:
totalFiles = 0
copyCount = 0
lock = threading.Lock()
def __init__(self):
fileList = glob(f'drive/MyDrive/100k_models/1000{j}/*')
... |
run_dqn_lander.py | import argparse
import gym
from gym import wrappers
import os.path as osp
import random
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as layers
from multiprocessing import Process
from tensorflow.python import debug as tf_debug
import dqn
from dqn_utils import *
def lander_model(obs, num... |
doc_isolation.py | import json
from threading import Thread
from basetestcase import BaseTestCase
from couchbase_helper.documentgenerator import doc_generator
from sdk_client3 import SDKClient
import com.couchbase.test.transactions.SimpleTransaction as Transaction
from reactor.util.function import Tuples
from sdk_exceptions import SDK... |
beat_service.py | """Define the beat service to interact with the task launcher."""
import time
import threading
import requests
from nmtwizard.logger import get_logger
logger = get_logger(__name__)
def start_beat_service(container_id, url, task_id, interval=30):
"""Start a background service that sends a HTTP GET request to:
... |
test_redis_ut.py | import os
import time
import pytest
from threading import Thread
from pympler.tracker import SummaryTracker
from swsscommon import swsscommon
from swsscommon.swsscommon import ConfigDBPipeConnector, DBInterface, SonicV2Connector, SonicDBConfig, ConfigDBConnector, SonicDBConfig, transpose_pops
import json
existing_file... |
util.py | # Electrum - lightweight Bitcoin client
# Copyright (C) 2011 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 limitation the rights t... |
test_capi.py | # Run the _testcapi module tests (tests for the Python/C API): by defn,
# these are all functions _testcapi exports whose name begins with 'test_'.
from collections import OrderedDict
import _thread
import importlib.machinery
import importlib.util
import os
import pickle
import random
import re
import subprocess
impo... |
start.py | #-*-coding:utf-8-*-
import sys
import os
import json
import numpy as np
import multiprocessing
import datetime
import pynvml
from pynvml import *
nvmlInit()
MEMORY_THESHOLD = 15 # GB
def get_aviliable_gpus():
print ("Driver Version:", nvmlSystemGetDriverVersion())
deviceCount = nvmlDeviceGetCount()
GPU_AV... |
generate.py | import os
import sys
import time
import copy
import shutil
import random
import threading
import torch
import platform
import os
import numpy as np
from tqdm import tqdm
import modules.utils as utils
import glob
import cv2
import modules.newloader as newloader
from modules.utils import quantize
from PIL import Image
d... |
surface_stats_collector.py | # 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.
import Queue
import datetime
import logging
import re
import threading
from pylib import perf_tests_helper
# Log marker containing SurfaceTexture time... |
command.py | import ipaddress
import logging
import signal
import socket
from argparse import (SUPPRESS, ArgumentDefaultsHelpFormatter, ArgumentParser,
Namespace, _SubParsersAction)
from ipaddress import IPv4Address, IPv6Address, IPv6Interface
from threading import Event, Lock, Thread
from typing import Dict, ... |
car_helpers.py | import os
import json
import threading
import requests
from common.params import Params, put_nonblocking
from common.basedir import BASEDIR
from selfdrive.version import comma_remote, tested_branch
from selfdrive.car.fingerprints import eliminate_incompatible_cars, all_legacy_fingerprint_cars
from selfdrive.car.vin imp... |
e2e_tests.py | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Author: wenxh
# This script is to be used as batch system intergration test in Azure Build Agent
import os
import sys
import subprocess
import multiprocessing
import logging
import json
import pprint
import numpy as np
import testcases
import e... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def show_panel():
return 'Bot is alive!'
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start() |
train_abstractive.py | #!/usr/bin/env python
"""
Main training workflow
"""
from __future__ import division
import argparse
import collections
import glob
import os
import random
import signal
import time
import torch
from transformers import BertTokenizer
from transformers import RobertaTokenizer
import distributed
from models import... |
spinner_threading.py | import threading
import itertools
import time
import sys
class Signal:
go = True
def spin(msg, signal):
"""
This function will run in separate thread
"""
write, flush = sys.stdout.write, sys.stdout.flush
for char in itertools.cycle("|/-\\"):
status = char + " " + msg
write(st... |
thread_delegating_executor.py | # Lint as: python3
# Copyright 2019, The TensorFlow Federated 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 ... |
Dictator.py | #!/usr/bin/env python
#test on http://www.youtube.com/watch?v=Or5R_uPvPao
from sys import stdin, stdout
from time import time, sleep
from struct import unpack
from os.path import isfile, isdir
from os import mkdir, system
from Queue import Queue
from cStringIO import StringIO
from threading import Thread
from subpro... |
client.py | import socket
import threading
from shell import PRIMITIVE, Shell, OPERATION
from utils import Utils
from graphics import Graphics
lock = threading.Lock()
class Client(object):
def __init__(self):
self.server_ip = "192.168.220.131"
self.server_port = 60000
self.client = socket.socket()
... |
routes.py | # routes.py
# Created by: Michael Cole
# Updated by: Michael Cole
# -----------------------------
# Contains all routing information
# (and lots of logic for now).
from datetime import date, datetime
from threading import Thread
from flask import redirect, render_template, request, url_for
from flask_login import cur... |
miner.py | import hashlib
import json
import options
import re
import signal
import socket
import socks
import sys
import time
# OpenCL miner specific
import clminer
import numpy as np
import threading
import queue
# load config
config = options.Get()
config.read()
pool_ip = config.pool_ip_conf
miner_address = config.miner_addr... |
engine.py | """"""
import importlib
import os
import traceback
from collections import defaultdict
from pathlib import Path
from typing import Any, Callable
from datetime import datetime, timedelta
from threading import Thread
from queue import Queue, Empty
from copy import copy, deepcopy
import time
import psutil
import os
from... |
TamTamBot.py | # -*- coding: UTF-8 -*-
import json
import math
import os
import re
import sqlite3
import sys
import traceback
from datetime import datetime
from datetime import timedelta
from threading import Thread
from time import sleep
import requests
import six
import urllib3
from openapi_client import Configuration, Update, Ap... |
photobooth_raspicamera.py | from picamera import PiCamera
from time import sleep
from gpiozero import Button
import pygame
from pygame.locals import *
from threading import Thread
from time import sleep
import time
import sys
def UpdateDisplay(num="",msg=""):
#init global variables from main thread
global SmallMessage
global TotalImageCou... |
main.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Elm Santos'
__version__ = '0.0.1'
__last_modification__ = '2022.04.22'
if __name__ == '__main__':
kv_0 = """
#:import utils kivy.utils
<RootWidget>:
MDTextField:
id: id_resultados
name: 'name_resultados'
size_hint: .9... |
console.py | #!/usr/bin/env python
# Copyright 2016 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.
"""Allow creation of uart/console interface via usb google serial endpoint."""
# Note: This is a py2/3 compatible file.
from __fut... |
app.py | import os
from multiprocessing import Process
import validators
from flask import Flask, request
import json
app = Flask(__name__)
def cast(url):
if validators.url(url):
os.system(f"python -m catt.cli cast {url}")
@app.route('/cast', methods=['PUT'])
def set_play_state():
data = json.loads(request.... |
pwospf.py | from threading import Thread, Event
from time import sleep
from datetime import datetime, timedelta
import grpc
from mininet.link import Intf
from mininet.log import lg
from p4.v1 import p4runtime_pb2
from p4_mininet import P4RuntimeSwitch
from p4_program import P4Program
from p4runtime_lib.error_utils import printGrp... |
__init__.py | import json
import re
import threading
import time
from urllib.request import Request, urlopen
from i3pystatus import SettingsBase, IntervalModule, formatp
from i3pystatus.core.util import user_open, internet, require
class WeatherBackend(SettingsBase):
settings = ()
@require(internet)
def http_request(... |
fd_2_client.py | import socket
from time import ctime
import threading
sADDR = ('127.0.0.1', 45002)
buff = 1024
cliSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cliSock.connect(sADDR)
def receive():
while True:
rMessage = cliSock.recv(buff)
if not rMessage:
print("Ending conne... |
output-consumer.py | #!/usr/bin/env python
import pika
import sys
import time
import subprocess
import datetime
import threading
from command_args import get_args, get_mandatory_arg, get_optional_arg
def get_node_ip(node_name):
bash_command = "bash ../cluster/get-node-ip.sh " + node_name
process = subprocess.Popen(bash_command.spl... |
app.py | # Modules
import os
import json
import random
from types import FunctionType
from base64 import b64encode, b64decode
from jinja2 import Environment, FileSystemLoader
from flask import Flask, abort, request, send_from_directory
from .kthread import KThread
from .webpage import load_page
# Flask app maker
def make_app(... |
environment.py | """
Temperature is in degrees celsius.
Pressure is in hPa.
Specific humidity is kg moisture per kg air.
Relative humidity is a fraction of total possible humidity.
"""
import threading
import time
import datetime
import math
SECONDS_PER_HOUR = 60 * 60
KIT_VOLUME = 0.5 * 1.0 * 2.0 # m^3
KIT_AIR_MASS = 1.293 * KIT_VO... |
utils.py | #!/usr/bin/env python
import time
import sys
import os
import threading
import subprocess
import socket
import uuid
import random
import pnfs
import ConfigParser
import configuration_client
import enstore_functions2
print_lock = threading.Lock()
STOP_FILE="/tmp/STOP"
def print_wrapper(func):
print_lock.acquire... |
test_browser.py | # coding=utf-8
# Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from __future__ import print_function
import argparse
... |
dashboard.py | import collections
from distutils.version import StrictVersion
import threading
import time
import numpy as np
from optuna._imports import try_import
import optuna.logging
import optuna.study
from optuna.study import StudyDirection
import optuna.trial
from optuna import type_checking
if type_checking.TYPE_CHECKING:
... |
scheduler.py | import queue
import time
from subprocess import run
from pynvml.pynvml import *
# start_time = time.time()
# call(["python", "main.py", "--train=./train.py" , "--batch_size=10", "--spatial_epochs=100", "--temporal_epochs=100", "--train_id=default", "--dB=SAMM_CASME_Optical", "--spatial_size=224", "--flag=st"])
# ela... |
app.py | #!/usr/bin/python
#-*- coding: UTF-8 -*-
from __future__ import unicode_literals
from flask import (Flask, render_template, redirect, url_for, request, flash)
from flask_bootstrap import Bootstrap
from flask_login import login_required, login_user, logout_user, current_user
from flask import send_file, send_from_dire... |
tone.py | """Tone generator for Pygame Zero.
This tone generator uses numpy to generate sounds on demand at a given duration
and frequency. These are kept in a LRU cache which in typical applications
will reduce the number of times they need to be regenerated.
Rather than generating plain sine waves, tones are shaped by a basi... |
run_webgpu_cts.py | # Copyright 2021 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.
import argparse
import json
from six.moves import BaseHTTPServer
from six.moves import urllib
import sys
from tempfile import mkstemp
import threading
import... |
main.py | #!/usr/bin/env python
# encoding: utf-8
"""
main.py
The entry point for the book reader application.
"""
__version_info__ = (0, 0, 1)
__version__ = '.'.join(map(str, __version_info__))
__author__ = "Willem van der Jagt"
import time
import sqlite3
import pdb
import signal
import sys, os
import config
import RPi.GPI... |
test11.py | import threading
class StoppableThread(threading.Thread):
"""Thread class with tests_devices stop() method. The thread itself has to check
regularly for the stopped() condition."""
def __init__(self, target):
super(StoppableThread, self).__init__(target=target)
self._stop_event = threading... |
webcam_demo_my_new.py | import torch
from torch.autograd import Variable
import torch.nn.functional as F
import torchvision.transforms as transforms
import torch.nn as nn
import torch.utils.data
import numpy as np
from opt import opt
from dataloader_webcam_my import WebcamLoader, DetectionLoader, DetectionProcessor, DataWriter, crop_from_de... |
sonar_v3_dev_daemon.py | # -*- coding: utf-8 -*-
# Copyright 2017-2020 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
App.py | from tkinter import *
from tkinter.ttk import Style
import cv2
from PokikiAPI import Pokiki
from PIL import Image, ImageTk
from tkinter import filedialog as fd
from threading import Thread
root = Tk()
root.title("Pokiki - Mosaic Video Maker")
root.resizable(False, False)
style = Style(root)
style.theme_use('clam')
#... |
test_util_test.py | # Copyright 2015 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... |
utils.py | from bitcoin.rpc import RawProxy as BitcoinProxy
from ephemeral_port_reserve import reserve
import logging
import re
import subprocess
import threading
import time
import os
import collections
import json
import base64
import requests
BITCOIND_CONFIG = collections.OrderedDict([
("server", 1),
("txindex", 1),... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.