source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
lsgn_data.py | import tensorflow as tf
import tensorflow_hub as hub
import h5py
import json
import numpy as np
import random
import threading
from input_utils import *
import util
import srl_eval_utils
# Names for the "given" tensors.
_input_names = [
"tokens", "context_word_emb", "head_word_emb", "lm_emb", "char_idx", "text_... |
taskManager.py | # BSD 2-Clause License
#
# Copyright (c) 2021-2022, Hewlett Packard Enterprise
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright... |
utils.py | #!/usr/bin/env/python
import numpy as np
import tensorflow as tf
import queue
import threading
import pickle
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit import Chem
from rdkit.Chem import rdmolops
from collections import defaultdict, deque
import os
import heapq
import planarity
import sascore... |
test_session.py | import os
import tempfile
import threading
import unittest
import web
class SessionTest(unittest.TestCase):
def setUp(self):
app = web.auto_application()
session = self.make_session(app)
class count(app.page):
def GET(self):
session.count += 1
... |
controllers.py | """maintains all functionality related running virtual machines, starting and tracking tests."""
import datetime
import hashlib
import json
import os
import shutil
import sys
from multiprocessing import Process
from typing import Any
import requests
from flask import (Blueprint, abort, flash, g, jsonify, redirect, re... |
sensordata.py | #!/usr/bin/env python3
#
# sensordata.py
#
# Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon... |
trainer_utils.py | # coding=utf-8
# Copyright 2020-present the HuggingFace Inc. team.
#
# 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 ap... |
race_condition_2_threads.py | import threading
from time import sleep
from random import random
counter = 0
def randsleep(): return sleep(0.1 * random())
def incr(n):
global counter
for count in range(n):
current = counter
randsleep()
counter = current + 1
randsleep()
# fix race condition with locking ... |
ssl_analyzer.py | #!/usr/bin/env python3
import socket
import sys
import json
from datetime import datetime
from ssl import PROTOCOL_TLSv1
from time import sleep
from ocspchecker import ocspchecker
from conf_reader import ReadConfig
from crl_check import check_crl, CRLStatus
from db import get_connection, insert_data, close_connection
... |
test_780_tailscale.py | import os
import re
import socket
import sys
from threading import Thread
import pytest
from .md_conf import MDConf
class TailscaleFaker:
def __init__(self, env, path):
self.env = env
self._uds_path = path
self._done = False
def start(self):
def process(self):
s... |
test_webui.py | #!/usr/bin/env python
# coding=UTF-8
import os
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
import unittest
class BasicWebUiTest(unittest.TestCase):
test_uri = "http://www.mnot.net/"
def setUp(sel... |
test_datapipe.py | import http.server
import itertools
import os
import os.path
import pickle
import random
import socketserver
import sys
import tarfile
import tempfile
import threading
import time
import unittest
import warnings
import zipfile
from functools import partial
from typing import (
Any,
Awaitable,
Dict,
Gene... |
DistributedEngine.py | #! /usr/bin/enc python
# -*- coding: utf-8 -*-
# author: Irving He
# email: 1910646@tongji.edu.cn
"""
分布式架构
"""
import copy
from datetime import datetime
from multiprocessing import set_start_method
import torch.multiprocessing as torch_mp
import multiprocessing as mp
import queue
from time import sleep
import os
... |
notebookapp.py | # coding: utf-8
"""A tornado based IPython notebook server."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import base64
import datetime
import errno
import importlib
import io
import json
import logging
import os
import r... |
code.py | # Released under the MIT License. See LICENSE for details.
#
"""Functionality for formatting, linting, etc. code."""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
from typing import TYPE_CHECKING
from efrotools.filecache import FileCache
if TYPE_CHECKING:
fro... |
messenger.py | from multiprocessing import Queue
from threading import Thread
class MessengerPostbox:
def __init__(self, messenger, source):
"""
Initialize a message feeder bound to a messenger and source
"""
self.messenger = messenger
self.source = source
def send(self, key, *args):
self.messenger.send(... |
performancetestreceiver.py | import threading
from time import sleep
from virtualisation.misc.log import Log
from virtualisation.triplestore.threadedtriplestoreadapter import ThreadedTriplestoreAdapter
from virtualisation.wrapper.wrapperoutputreceiver import AbstractReceiver
__author__ = 'Marten Fischer (m.fischer@hs-osnabrueck.de)'
class Abst... |
swaprebalance.py | import time
import datetime
import unittest
from TestInput import TestInputSingleton
import logger
from couchbase_helper.cluster import Cluster
from membase.api.rest_client import RestConnection, RestHelper
from membase.helper.bucket_helper import BucketOperationHelper
from membase.helper.cluster_helper import ClusterO... |
test3.py | # 多线程,自动创建文件夹,每个页面单独存储一个文件夹
import requests
import threading
import re
import time
import queue
import os
from bs4 import BeautifulSoup
string = 'https://www.quanjing.com/category/1286521/'
url_queue = queue.Queue()
pipei = re.compile('lowsrc="(.*?)" m=') #
def get_url(page):
for i in rang... |
gopro_server.py | import cv2
import json
import numpy as np
import os
import pickle
import RPi.GPIO as GPIO
import requests
import socket
import struct
import time
from getmac import get_mac_address
from threading import Thread
DEBUG_LOGS = False
RAW_PICTURES_FOLDER = './pictures/raw'
PROCESSED_PICTURES_FOLDER = './pictures/processed'
... |
05-join.py | import time
import threading
def myfunc(name):
print(f"myfunc started with {name}")
time.sleep(10)
print("myfunc ended")
if __name__ == '__main__':
print('main started')
#myfunc('realpython')
t=threading.Thread(target=myfunc, args=['realpython'])
t.start()
t.join()
print('main end... |
utilities.py | #!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Tests utility classes
:license: Apache License 2.0
"""
# JSON-RPC library
from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
# Standard library
import threading
# ------------------------------------------------------------------------------
# Test m... |
application.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import paho.mqtt.client as mqtt
from gpiozero import LED
from time import sleep
import json
import threading
import os
import sys
led = LED(18)
thing_name = "raspberry-pi"
shadow_topic_prefix = "$aws/things/" + thing_name + "/shadow/name/led"
INTERVAL = 60
def on_conn... |
Hiwin_RT605_ArmCommand_Socket_20190627170327.py | #!/usr/bin/env python3
# license removed for brevity
import rospy
import os
import numpy as np
from std_msgs.msg import String
from ROS_Socket.srv import *
from ROS_Socket.msg import *
from std_msgs.msg import Int32MultiArray
import math
import enum
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback = 1
#接收策略端... |
usage.py | import uuid
import time
import hashlib
import os
import getpass
import json
import logging
import socket
import sys
import platform
import multiprocessing as mp
from parsl.dataflow.states import FINAL_FAILURE_STATES
from parsl.version import VERSION as PARSL_VERSION
logger = logging.getLogger(__name__)
def async_pr... |
train.py | import os
import time
from collections import deque
from multiprocessing import Process, Value, Array, Queue
from threading import Thread
import subprocess
import settings
from sources import start_carla, restart_carla
from sources import STOP, get_hparams
from sources import run_agent, AGENT_STATE
from sources import... |
thermal-sensor.py | from connection import *
import connection, threading, socket
from datetime import datetime
value = -1
temperatureTimes = {}
with open(SOURCE_FILE, mode='r+') as csv_file:
for row in csv_file:
temperatureTimes[row.split(',')[1]] = row.split(',')[2]
def parseTemp(text):
res = ""
for i in text:
... |
test_flight.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
# "... |
mynewsplease.py | import os
import sys
import orjson
from loky import cpu_count
import logging
from w3lib.url import canonicalize_url
from newsplease.crawler import commoncrawl_crawler
from newsplease.crawler import commoncrawl_extractor
from multiprocessing import Queue, Pool, Process, active_children
import queue
FINISHED_PRODUCING... |
cb2_9_4_sol_1.py | import threading, Queue, time, sys
# Globals (start with a capital letter)
Qin = Queue.Queue()
Qout = Queue.Queue()
Qerr = Queue.Queue()
Pool = []
def report_error():
''' we "report" errors by adding error information to Qerr '''
Qerr.put(sys.exc_info()[:2])
def get_all_from_queue(Q):
''' generator to yiel... |
service.py | # encoding: utf-8
# FastCGI-to-WSGI bridge for files/pipes transport (not socket)
#
# Copyright (c) 2012 Openance SARL
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of so... |
ats.py | from ibapi import wrapper
from ibapi.client import EClient
from ibapi.contract import ContractDetails
from assets import *
import orders
from threading import Thread, Event
import logging
import argparse
class BrokerPlatform(wrapper.EWrapper, EClient):
def __init__(self, port, client_id):
wrapper.EWrapp... |
test_fullscreen.py | import threading
from .util import destroy_window, run_test
def fullscreen():
import webview
def _fullscreen(webview):
assert webview.webview_ready(10)
destroy_event.set()
t = threading.Thread(target=_fullscreen, args=(webview,))
t.start()
destroy_event = destroy_window(webview)
... |
state.py | """
The State Compiler is used to execute states in Salt. A state is unlike
an execution module in that instead of just executing a command, it
ensures that a certain state is present on the system.
The data sent to the state calls is as follows:
{ 'state': '<state module name>',
'fun': '<state function name... |
test_flight.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
# "... |
test_sys.py | import unittest, test.support
from test.support.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import locale
# count the number of test runs, used to create unique
#... |
chat_server.py | """
Created on Tue Jul 22 00:47:05 2014
@author: alina, zzhang
"""
import json
import pickle as pkl
import select
import socket
import chat_group as grp
import indexer
from chat_utils import *
# for two server
from threading import Thread
import file_server
class Server:
def __init__(self):
... |
free.py | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 3 03:57:53 2016
@author: yxl
"""
import threading
from time import time
class Free:
title = 'Free'
view = None
para = None
prgs = (None, 1)
asyn = True
def progress(self, i, n):
self.prgs = (i, n)
def run(self, para=None):
pr... |
Lidar.py | '''
雷达类
基于官方ROS驱动,本脚本只提供订阅"/livox/lidar"topic的后续处理
'''
# 为了某些情况ros驱动没有正常加载,但也可以用主程序类测试
try:
import rospy
from sensor_msgs.msg import PointCloud2
from sensor_msgs import point_cloud2
except:
print("[ERROR] ROS environment hasn't been successfully loaded.You can only use DepthQueue with saved PointCloud")... |
app.py | # -*- encoding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
import gevent.monkey
gevent.monkey.patch_all()
import argparse
import os
from functools import wraps
import time
import logging
import psutil
... |
index.py | import json
import os
import random
import requests
import socket
import time
from threading import Thread
# https://gist.github.com/butla/2d9a4c0f35ea47b7452156c96a4e7b12
def wait_for_port(port, host='localhost', timeout=5.0):
"""Wait until a port starts accepting TCP connections.
Args:
port (int): P... |
tests.py | """
Unit tests for reverse URL lookups.
"""
import sys
import threading
from admin_scripts.tests import AdminScriptTestCase
from django.conf import settings
from django.conf.urls import include, url
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
f... |
datapipe.py | '''
Copyright (c) <2018> <Pingcheng Zhang>
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, distri... |
main.py | import brain
import agent
from torch import multiprocessing as mp
from core import *
def run_agent(shared_brain, render=False, verbose=False):
"""
Run the agent.
Parameters
----------
shared_brain : brain.Brain
The shared brain the agents will use and update.
render : boolean, optiona... |
test_106_shutdown.py | #
# mod-h2 test suite
# check HTTP/2 timeout behaviour
#
import time
from threading import Thread
import pytest
from .env import H2Conf
from pyhttpd.result import ExecResult
class TestShutdown:
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
conf = H2Conf(env)
conf... |
run.py | import subprocess
import asyncio
import threading
import time
import os
startscreen =f"\033[32;1m.----------------. .----------------. .----------------. .----------------.\n| \033[34;1m.--------------. \033[32;1m|| \033[34;1m.--------------. \033[32;1m|| \033[34;1m.--------------. \033[32;1m|| \033[34;1m.----------... |
agent.py | import time
import math
from threading import Thread
import vehicle
import pygame
msgHeader = "[AGENT]: "
class Agent():
def __init__(self, ID, agentType="robot", vehicleType="car", strategyFile=None):
self.ID = str(ID)
if vehicleType.lower() == "car":
self.vehicle = vehicle.Car(self)
elif vehicleType.lo... |
main.py | import os
from queue import Queue
from threading import Thread
from urllib.parse import urlparse, parse_qs
from bottle import route, run, static_file, request
from youtube_dl import YoutubeDL
app_defaults = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'prefer... |
Hiwin_RT605_ArmCommand_Socket_20190627204140.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... |
command.py | import base64
import json
import time
import threading
import tornado.httpserver
import tornado.ioloop
import tornado.web
from basescript import BaseScript
import util
from messagestore import *
from gmailhistory import GmailHistory
class RequestHandler(tornado.web.RequestHandler):
DESC = "Gets realtime messag... |
trex_subscriber.py | #!/router/bin/python
import json
import threading
import time
import datetime
import zmq
import re
import random
import os
import signal
import traceback
import sys
from .trex_types import RC_OK, RC_ERR
#from .trex_stats import *
from ..utils.text_opts import format_num
from ..utils.zipmsg import ZippedMsg
# basic... |
vacuum.py | #!/usr/bin/python3
#Controlling Ecovacs Deebot vaccum with sucks
from sucks import *
import paho.mqtt.client as paho
import json
import random
import string
import sys
import logging
class DeebotMQTTClient:
def __init__(self, mqtt_config, ecovacs_config):
self._connected = False
self._command_... |
multidownload_xkcd.py | #! /usr/bin/env python3
# multidownload_xkcd.py - downloads XKCD comics using multiple threads
import os
import re
import threading
from os.path import basename, join
import bs4
import requests
ANSI_RED = '\033[31;m'
ANSI_RESET = '\033[0m'
def download_pages(start_num, end_num, root):
"""
Downloads all web... |
test_gc.py | import unittest
import unittest.mock
from test.support import (verbose, refcount_test,
cpython_only, start_threads,
temp_dir, TESTFN, unlink,
import_module, collect_in_thread)
from test.support.script_helper import assert_python_ok, make_scri... |
utils.py | """Utilities shared by tests."""
import collections
import contextlib
import io
import logging
import os
import re
import selectors
import socket
import socketserver
import sys
import tempfile
import threading
import time
import unittest
import weakref
from unittest import mock
from http.server i... |
ChickenVision.py | #!/usr/bin/env python3
#----------------------------------------------------------------------------
# Copyright (c) 2018 FIRST. All Rights Reserved.
# Open Source Software - may be modified and shared by FRC teams. The code
# must be accompanied by the FIRST BSD license file in the root directory of
# the project.
# ... |
replicator_manager.py | from multiprocessing import Process, Queue, Event, Manager
import time
import json
import random
import requests
from src.replicator import Replicator
class ReplicatorManager(Replicator):
def __init__(self, name, ip, port, log_server_path, log_server_lock, n_replicators=3):
super().__init__(
... |
__init__.py | '''
Python Multicopter class
Uses UDP sockets to communicate with MulticopterSim
Copyright(C) 2019 Simon D.Levy
MIT License
'''
from threading import Thread
import socket
import numpy as np
class Multicopter(object):
'''
Represents a Multicopter object communicating with MulticopterSim via UDP sock... |
main_window.py | import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import asyncio
from electrum.bitcoin import TYPE_ADDRESS
from electrum.storage import WalletStorage
from electrum.wallet import Wallet, InternalAddressCorruption
from electrum.paymentrequest import ... |
materialized_views_test.py | import collections
import re
import sys
import time
import traceback
import pytest
import threading
import logging
from flaky import flaky
from enum import Enum
from queue import Empty
from functools import partial
from multiprocessing import Process, Queue
from cassandra import ConsistencyLevel, InvalidRequest, Writ... |
limiter.py | from unittest import TestCase
import redis
from function_limiter.limiter import Limiter
from function_limiter.limiter import RateLimitExceeded
import time
from multiprocessing import Process
class TestSimpleFiveRequest(TestCase):
def test_five_call(self):
limiter = Limiter()
@limiter.limit('5/m... |
example.py | #!/usr/bin/env python
__author__ = "Gabriel Bassett"
"""
AUTHOR: {0}
DATE: <DATE>
DEPENDENCIES: <a list of modules requiring installation>
Copyright <YEAR> {0}
LICENSE:
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this ... |
test_stream.py | import gc
import threading
import unittest
import pytest
import cupy
from cupy._creation import from_data
from cupy import cuda
from cupy import testing
@testing.parameterize(
*testing.product({
'stream_name': ['null', 'ptds'],
}))
@testing.gpu
class TestStream(unittest.TestCase):
def setUp(sel... |
manager.py | from dataclasses import dataclass
import logging
import threading
import time
import traceback
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Set, Tuple
from concurrent.futures.thread import ThreadPoolExecutor
from blspy import G1Element
from chiapos import DiskProver
from chia.conse... |
http_server.py | import threading
from collections import defaultdict
from http import HTTPStatus
from http.server import HTTPServer, BaseHTTPRequestHandler
from urllib.parse import urlparse
import pytest
class TestHandler(BaseHTTPRequestHandler):
handlers = defaultdict(dict)
@classmethod
def handler(cls, method, path)... |
test.py | #!/usr/bin/env python
#
# Copyright 2008 the V8 project authors. 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
# noti... |
tcp_client.py | #!/usr/bin/env python
import sys
import logging
import socket
import struct
from threading import Event, Thread
from util import *
logger = logging.getLogger('client')
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(message)s')
STOP = Event()
def accept(port):
logger.info("accept %s", port)
... |
test_basic.py | import asyncio
from mpdispatcher import MpDispatcher, Closed
from multiprocessing import Process
import multiprocessing as mp
import pytest
import sys
from time import sleep
@pytest.fixture()
def dispatcher():
return MpDispatcher()
def receive_single_event(receiver):
l = []
def cb(arg):
l.append(arg)
rec... |
factory.py | __all__ = [
'KeyServerFactory',
'BasicKeyServer'
]
import copy
import csv
import json
import os
import sys
import types
import warnings
from collections import OrderedDict
from contextlib import ExitStack
import math
import numpy as np
import pandas as pd
from ..utils.data import get_json, get_location_df
f... |
tkGuiControl.py | import serial
import time
import threading
import sys
NMB_OF_SLIDERS = 5
#PORT = "loop://logging=debug"
PORT = "/dev/ttyACM0"
TIMEOUT = 1
if sys.version_info >= (3, 0):
from tkinter import *
def data(string):
return bytes(string, 'latin1')
else:
from Tkinter import *
def data(string): return s... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including witho... |
multiprocessing_t.py | #How can we share data between processes?
# Processes don't live in the same memory, so they don't have access to same public data and need special access
# to shared memory data. There are two shared memory objects that we can use.
#1] Value
#2] Array
from multiprocessing import Process, Value, Array, Lock
import nu... |
writer.py | import os
import time
from threading import Thread
from queue import Queue
import cv2
import numpy as np
import torch
import torch.multiprocessing as mp
from alphapose.utils.transforms import get_func_heatmap_to_coord
from alphapose.utils.pPose_nms import pose_nms, write_json
DEFAULT_VIDEO_SAVE_OPT = {
'savepath... |
file_stream.py | import base64
import binascii
import collections
import itertools
import logging
import os
import sys
import random
import requests
import threading
import time
import wandb
from wandb import util
from wandb import env
import six
from six.moves import queue
from ..lib import file_stream_utils
logger = logging.getL... |
app.py | """ Main Kivy application """
import asyncio
import os
from logging import getLogger
from threading import Thread
from sys import platform as _platform
from tesseractXplore.settings import read_settings
# Set GL backend before any kivy modules are imported
os.environ['KIVY_GL_BACKEND'] = 'sdl2'
# Set Textprovider bac... |
gpshandler.py | #!/usr/bin/python
#
# Copyright 2018 Tampere University of Technology, Pori Department
#
# 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
#
# ... |
socket_preview.py | """
sockets for cross-task communication: start threads to communicate over sockets;
independent programs can too, because sockets are system-wide, much like fifos;
see the GUI and Internet parts of the book for more realistic socket use cases;
some socket servers may also need to talk to clients in threads or processe... |
__init__.py | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 version 3 of the License, or
# (at your option) an... |
main.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import socket
import sys
import pickle
import random
import time
from threading import Thread
def toAddr(s):
parts = s.split(":")
return parts[0], int(parts[1])
class Node:
def __init__(self, index, value, crash, allnode):
self.skt = socket.soc... |
lightserver.py | import os
from signal import signal, SIGPIPE, SIG_DFL, SIGTERM
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_wtf import Form
from flask_codemirror.fields import CodeMirrorField
from wtforms.fields import SubmitField
from flask_codemirror import CodeMirror
from flask i... |
serve.py | # Copyright 2022 Cortex Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
03-tank-custom.py | #!/usr/bin/env python3
import logging
import threading
import signal
import time
import ev3dev.ev3 as ev3
import sys
from ev3dev.auto import OUTPUT_A, OUTPUT_B, OUTPUT_C, OUTPUT_D
from ev3dev.helper import MediumMotor
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(levelname)5s: %(message)s'... |
test_task_manager.py | # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
car.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ##
# @brief [py demo] car demo [robotx6 sync test]
# @author Kab Kyoum Kim (kabkyoum.kim@doosan.com)
import rospy
import os
import threading, time
import sys
sys.dont_write_bytecode = True
sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__),"... |
test_lock.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! 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... |
main1.py | from flask import Flask, render_template
from flask.ext.socketio import SocketIO, send, emit
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor
from threading import Thread
import RPi.GPIO as GPIO
import datetime
import os
GPIO.setmode(GPIO.BCM) ## Use board pin numbering
##GP... |
dynamic_teacher.py | import time
from typing import Any, Dict, Iterator, List
import copy
import torch
import torch.nn as nn
import torch.multiprocessing as mp
import traceback
from allennlp.data.data_loaders.multiprocess_data_loader import WorkerError
from allennlp.nn.util import move_to_device
from matchmaker.utils.config import *
from... |
test_ssl.py | import pytest
import threading
import socket as stdlib_socket
import ssl
from contextlib import contextmanager
from functools import partial
from OpenSSL import SSL
import trustme
from async_generator import asynccontextmanager
import trio
from .. import _core
from .._highlevel_socket import SocketStream, SocketList... |
test_auto_scheduler_measure.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... |
figures_for_supplement.py | import time
import numpy as np
import plots
import itertools
from multiprocessing import Process, Lock
from pathlib import Path
import seaborn as sns
# from matplotlib import pyplot as plt
plots.folder_root = "../results/"
plots.LEGEND = True # Set this to False to remove legends for plots
subdir_prefix = Path('figs_... |
reloader_helpers.py | import os
import sys
import signal
import subprocess
from time import sleep
from multiprocessing import Process
def _iter_module_files():
"""This iterates over all relevant Python files.
It goes through all
loaded files from modules, all files in folders of already loaded modules
as well as all files... |
way.py | import time
import math
from threading import Thread
msgHeader = "[AGENT]: "
#Constants file
import os
DISPLAY_WIDTH = 1024
DISPLAY_HEIGHT = 728
MAPS_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "maps")
STRATEGIES_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "strategies")
MEDI... |
mp03process.py | #!/usr/bin/env python
"""mp3process.py: Use multiprocessing.Process
Usage:
mp3process.py
"""
from multiprocessing import Process
import os
def info(title):
print(title)
print('module name:', __name__)
print('parent process:', os.getppid())
print('process id:', os.getpid())
def f(name):
info('fu... |
reloader.py | # (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
"""
A file monitor and server restarter.
Use this like:
..code-block:: Python
import reloader
reloader.install()
Then make sure your server... |
sync.py | """
@author axiner
@version v1.0.0
@created 2022/5/2 9:34
@abstract
@description
@history
"""
import sys
from multiprocessing import Process, Queue
from toollib import utils
try:
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
except ImportError:
raise
class Fi... |
tree.py | # CastPodder GUI -- tree code
# Copyright (c) 2005-2006 Scott Grayban and the CastPodder Team
#
# Based on edj's amazing resizable OPMLOutliner code.
# Heavily mutated by Scott.
#
# $Id: tree.py 147 2006-11-07 08:17:03Z sgrayban $
"""
CastPodder is Copright © 2005-2006 Scott Grayban
Read the file Software_License_Agr... |
energyServer.py | import web
import os
import sys
#import dynamicPopulation
import time
from threading import Thread
#from dynamicPopulation import showDynamicPopulation
import CarCounting.getDOTstream as D
import graphBackend
import staticData.foursquareCheckinData as FS
import staticData.staticTaxiData as TD
import staticData.staticCe... |
remind.py | # coding=utf-8
"""
remind.py - Sopel Reminder Module
Copyright 2011, Sean B. Palmer, inamidst.com
Licensed under the Eiffel Forum License 2.
http://sopel.chat
"""
import os
import re
import time
import threading
import collections
import codecs
from datetime import datetime
from sopel.module import commands, example... |
custom.py | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
discordgenerator.py | import undetected_chromedriver as uc
uc.install()
import os
import time
import requests
import random
import string
import sys
import threading
import datetime
import re
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.