source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
xla_client_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... |
ConvertToUTF8.py | # -*- coding: utf-8 -*-
import sublime, sublime_plugin
import sys
import os
if sys.version_info < (3, 0):
from chardet.universaldetector import UniversalDetector
NONE_COMMAND = (None, None, 0)
ST3 = False
else:
from .chardet.universaldetector import UniversalDetector
NONE_COMMAND = ('', None, 0)
ST3 = True
impor... |
tcpcollection.py | from SocketServer import BaseRequestHandler, TCPServer
from itertools import repeat
import threading
import multiprocessing
import pickle
import socket
import time
import traceback
import itertools
class _noplogger(object):
""" a fake logger that does nothing
"""
def debug(self, *args, **kwargs):
... |
streaming_popen.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2017, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... |
portscan.py | # some build in module ..
import queue
import socket
import threading
from queue import Queue
target =input("Type IP Address : ") # take ip address from the user
goal = input("how many port you want to scan : ")
# limite those written in range function ..
queue=Queue()
port_open =[] # ... |
view_tk.py | import os
import queue
import re
import time
import tkinter as tk
import tkinter.filedialog as tkfd
import tkinter.simpledialog as tksd
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42 # Edit plots with Illustrator
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg import FigureCanva... |
example3.py | import threading
import random; random.seed(0)
import time
def update(pause_period):
global counter
with count_lock:
current_counter = counter # reading in shared resource
time.sleep(pause_period) # simulating heavy calculations
counter = current_counter + 1 # updating shared resource
... |
map_folios.py | from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.renderers import TemplateHTMLRenderer
from django.core.management import call_command
from django.db import transaction
from cantusdata.models.folio import Folio
from cantusdata.models.manuscript import Manuscript
... |
flood.py | #!/usr/bin/env python3
#Code by LeeOn123
import random
import socket
import threading
print("--> C0de By OIDOP.co <--")
print("#-- TCP/UDP FLOOD --#")
ip = str(input(" Host/Ip:"))
port = int(input(" Port:"))
choice = str(input(" UDP(y/n):"))
times = int(input(" Packets per one connection:"))
threads = int(input(" Thre... |
manager.py | import time
import logging
from multiprocessing import Event, Process, get_logger
from pythontools.workermanager.workers import Worker, TimedWorker
from pythontools.workermanager.helpers import WorkerFactory
from pythontools.workermanager.errors import WorkerManagerError
class WorkerManager:
WORKERS = "workers"
... |
server.py | import socket
import threading
from time import sleep
server_main_address = ('', 6666)
server_assist_address = ('', 7777)
main_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
main_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
main_socket.bind(server_main_address)
assist_socket = socket.sock... |
plugin.py | import base64
import re
import threading
from binascii import hexlify, unhexlify
from functools import partial
from electrum.util import bfh, bh2u
from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey,
public_key_to_p2pkh, EncodeBase58Check,
... |
session.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2017, deepsense.io
#
# 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 applicab... |
test_capi.py | # expected: fail
# 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 __future__ import with_statement
import sys
import time
import random
import unittest
from test import test_support
try:
import thread
impor... |
collect_types.py | """
This module enables runtime type collection.
Collected information can be used to automatically generate
mypy annotation for the executed code paths.
It uses python profiler callback to examine frames and record
type info about arguments and return type.
For the module consumer, the workflow looks like that:
1) c... |
run_designs.py | # Copyright 2020 Efabless Corporation
#
# 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... |
enterprise_backup_restore_test.py | import re
import copy
import json
from random import randrange, randint
from threading import Thread
from Cb_constants import constants
from couchbase_helper.cluster import Cluster
from membase.helper.rebalance_helper import RebalanceHelper
from couchbase_helper.documentgenerator import BlobGenerator, DocumentGenerato... |
random_search.py | """
Random Search implementation
"""
from hops import util
from hops import hdfs as hopshdfs
from hops import tensorboard
from hops import devices
import pydoop.hdfs
import threading
import six
import datetime
import os
import random
run_id = 0
def _launch(sc, map_fun, args_dict, samples, direction='max', local_lo... |
Market.py | """EnergyMarket.py
A multi-independant-processes simulation about the energy market."""
from matplotlib import pyplot as plt
from matplotlib import animation
from multiprocessing import Value, Array, Process
from threading import Lock, Thread, current_thread
from signal import signal, SIGINT, SIGUSR1, SIGUSR2
from sy... |
engine.py | """"""
import importlib
import sys
import traceback
from datetime import datetime
from pathlib import Path
from threading import Thread
from typing import Sequence, Any
from pandas import DataFrame
from vnpy.event import Event, EventEngine
from vnpy.trader.constant import Direction, Offset, OrderType, Interval
from ... |
pydualsense.py |
# needed for python > 3.8
import os, sys
if sys.platform.startswith('win32') and sys.version_info >= (3,8):
os.add_dll_directory(os.getcwd())
import hid # type: ignore
from .enums import (LedOptions, PlayerID, PulseOptions, TriggerModes, Brightness) # type: ignore
import threading
class pydualsense:
def __in... |
test_client.py | import os
import pytest
import time
import sys
import logging
import queue
import threading
import _thread
from unittest.mock import patch
import numpy as np
from ray.util.client.common import OBJECT_TRANSFER_CHUNK_SIZE
import ray.util.client.server.server as ray_client_server
from ray.tests.client_test_utils import c... |
app.py | # -*- coding: utf-8 -*-
from flask import Flask
from flask import jsonify
from flask import url_for
from flask import redirect
import datetime as dt
from calendar import timegm as timestamp
from calais import get_semantic_data
from generator import PeekableGenerator
from storyful import search_storyful
from afp impo... |
test_change_notify.py | # -*- coding: utf-8 -*-
# Copyright: (c) 2019, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
import pytest
import threading
import uuid
from smbprotocol._text import (
to_native,
)
from smbprotocol.connection import (
Connection,
)
from s... |
subproc_vec_env.py | import multiprocessing
from collections import OrderedDict
from typing import Sequence
import gym
import numpy as np
from myGym.stable_baselines_mygym.common.vec_env.base_vec_env import VecEnv, CloudpickleWrapper
def _worker(remote, parent_remote, env_fn_wrapper):
parent_remote.close()
env = env_fn_wrapper.... |
ComputeNodeTest.py | ##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... |
lag.py | import threading, random, time
ramm = {}
next_k = 100
def maths():
global ramm
while 1:
ramm[int(random.randint(11111111111, 999999999999999))] = ramm
ramm[int(random.randint(11111111111, 999999999999999))] = int(random.randint(11111111111, 999999999999999))*int(random.randint(11111111111, 9... |
Routes.py | from typing import List
from Tools import check_connection
from threading import Thread
from flask import request
from flask_apscheduler import APScheduler
import flask
import Tools
import FR as LANG
# Const
from Config import API_START_URI
def configureRoutes(app: flask.Flask, devices: dict, scheduler: APSchedule... |
snapshot_backup.py | #!/usr/bin/env python3
import sys, os, logging, boto3, requests, textwrap
from botocore.config import Config
from time import sleep
from ctypes import CDLL
from socket import gethostname
from argparse import ArgumentParser
from multiprocessing import Process, Queue
from retrying import retry
__version__='0.1'
try:
... |
ui.py | """Provides abstract and concrete UI classes
An abstract UI is defined that can be provided by either a CLI
interface or a QT interface. Both examples are provided
Classes:
* :class:`DICEAuthenticatorListener`
* :class:`DICEAuthenticatorUI`
* :class:`ConsoleAuthenticatorUI`
* :class:`QTAuthenticatorUI`
"""
"""
... |
power_monitoring.py | import random
import threading
import time
from statistics import mean
from cereal import log
from common.params import Params, put_nonblocking
from common.realtime import sec_since_boot
from selfdrive.hardware import HARDWARE
from selfdrive.swaglog import cloudlog
PANDA_OUTPUT_VOLTAGE = 5.28
CAR_VOLTAGE_LOW_PASS_K =... |
5.py | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 09:53:44 2020
@author: lenovouser
"""
import tensorflow as tf
import multiprocessing as mp
import numpy as np
import os, shutil
TRAINING = True
# training data
x = np.linspace(-1, 1, 100)[:, np.newaxis]
noise = np.random.normal(0, 0.1, size=x.shape)
y = np.power(x,... |
compare.py | import sys
import os
sys.path.append(os.path.abspath("."))
sys.dont_write_bytecode = True
__author__ = "bigfatnoob"
import numpy as np
import pandas as pd
import time
import multiprocessing
from Queue import Queue
from utils import lib, cache, logger
from sos.function import Outputs
from misconceptions.common impor... |
analysis_subprocess.py | #####################################################################
# #
# /analysis_subprocess.py #
# #
# Copyright 2013, Monash University ... |
serial_connection.py | import serial
from thonny.plugins.micropython.connection import MicroPythonConnection, ConnectionFailedException
import threading
import time
from serial.serialutil import SerialException
import logging
import platform
import sys
from textwrap import dedent
class SerialConnection(MicroPythonConnection):
def __ini... |
example_web.py | from PyWeComSpy.service import SpyService
from flask.json import jsonify, request
from time import sleep
from flask_cors import CORS
import random
from queue import Queue
from threading import Thread
app = SpyService(__name__, key="ba31e59e9574332cdc7ee6198a725c70")
CORS(app, supports_credentials=True) # 允许跨域
send_q... |
server.py | '''
Created on 23.08.2016
@author: rustr
'''
import select
import socket
from threading import Thread
import time
import struct
import sys
from .base_client_socket import *
from .actuator_socket import *
if (sys.version_info > (3, 0)):
python_version = 3
else:
python_version = 2
class Server(object):
... |
test_worker.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import shutil
import signal
import subprocess
import sys
import time
import zlib
from datetime import datetime, timedelta
from multiprocessing import Process
from time import ... |
validation.py | from __future__ import print_function
from __future__ import absolute_import
import os
import re
import sys
import shutil
import subprocess
import urllib.request
import multiprocessing
import ROOT
ROOT.gROOT.SetBatch(True)
ROOT.PyConfig.IgnoreCommandLineOptions = True
from . import plotting
from . import html
# Mapp... |
receiver.py | from vidstream import StreamingServer
import threading
receiver = StreamingServer('192.168.10.1', 3846)
t = threading.Thread(target=receiver.start_server)
t.start()
while input("") != 'STOP':
continue
receiver.stop_server() |
index.py | # 进程学习
from multiprocessing import Process
import os
import time
num = 0
data = []
def task_1(name):
global num
tasks = ['看书', '学习', '打游戏']
for i in tasks:
time.sleep(0.5)
num += 1
data.append(num)
print('进程名: {}, 任务:{} 进程:{} 父进程:{} num:{} data:{}'.format(
nam... |
utils.py | from __future__ import absolute_import, division, print_function
from collections import OrderedDict, defaultdict
import contextlib
import fnmatch
import hashlib
import json
from locale import getpreferredencoding
import libarchive
import logging
import logging.config
import mmap
import operator
import os
from os.path... |
test_execute.py | # coding: utf-8
from contextlib import contextmanager
import re
import threading
import weakref
import sqlalchemy as tsa
from sqlalchemy import bindparam
from sqlalchemy import create_engine
from sqlalchemy import create_mock_engine
from sqlalchemy import event
from sqlalchemy import func
from sqlalchemy import inspe... |
fuchsia.py | # Copyright (C) 2018 Google Inc. 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 ... |
scaffold_ash.py | import multiprocessing
import time
import webbrowser
from urllib.parse import urlparse
from src.BusinessCentralLayer.middleware.redis_io import RedisClient
from src.BusinessCentralLayer.middleware.subscribe_io import detach
from src.BusinessCentralLayer.setting import REDIS_SECRET_KEY, CRAWLER_SEQUENCE, logger
from sr... |
command.py | # Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import argparse
import enum
import logging
import os
import re
import resource
import signal
import subprocess
import threading
from ... |
lambda_executors.py | import os
import re
import json
import time
import logging
import threading
import subprocess
# from datetime import datetime
from multiprocessing import Process, Queue
try:
from shlex import quote as cmd_quote
except ImportError:
# for Python 2.7
from pipes import quote as cmd_quote
from localstack import ... |
test_mongos_ha.py | # Copyright 2013 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
resnet50_waa.py | """
Copyright 2019 Xilinx 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 writing, software
di... |
data_creation_game.py | #!/usr/bin/env python3
"""Main script for gaze direction inference from webcam feed."""
import argparse
import os
import queue
import threading
import time
import coloredlogs
import cv2 as cv
import numpy as np
import tensorflow as tf
import tensorflow.compat.v1 as tf
import pyautogui
import random
tf.disable_v2_behav... |
src.py | import os
import sys
import datetime
import numpy as np
import scipy.stats as stats
import pandas as pd
import multiprocessing
class detector(object):
def __init__(self, file_name, period, n_cycles, **kwargs):
self.config = {
"EPS": 1e-5,
"STAGGER": False,
"USE_Z_SCORE"... |
dev_test_dex_print.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# File: example_binance_dex.py
#
# Part of ‘UNICORN Binance WebSocket API’
# Project website: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api
# Documentation: https://oliver-zehentleitner.github.io/unicorn-binance-websocket-api
# PyPI: https://pypi.... |
speedtestvps.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015 Matt Martz
# 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.or... |
test_bucket.py | # -*- coding: utf-8 -*-
import threading
from circuitbreaker.bucket import Bucket
COUNT = 100000
def runner(bucket):
for _ in xrange(COUNT):
bucket.add_fail(1)
def test_single_thread():
"""
测试单线程下增加数量是否正确
:return:
"""
b = Bucket()
for _ in xrange(COUNT):
b.add_fail(1)
... |
custom_iterator.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 Takuma Yagi <tyagi@iis.u-tokyo.ac.jp>
#
# Distributed under terms of the MIT license.
from __future__ import division
from collections import namedtuple
import multiprocessing
from multiprocessing import sharedctypes
import signal
imp... |
ucef.py | # -*- coding: utf-8 -*-
import urllib3, requests, re, time, random, sys, argparse, colorama, os, bs4, html5lib, tqdm, cloudscraper
from bs4 import BeautifulSoup
from pathlib import Path
from banner import banner
sys.stdout.write(banner())
email=input(" \033[1;96mUDEMY EMAIL : \033[1;93m")
password=input(" ... |
uploader.py | import argparse
import fcntl
import functools
import logging
import os
import re
import socket
import subprocess
import sys
import tempfile
import threading
import time
import contextlib
import shutil
import time
from shotgun_api3_registry import connect
from . import filmstrip as process
log = logging.getLogger(__... |
server.py | import sys
from select import select
from socket import socket
from threading import Thread
from time import sleep
from typing import Union
import requests
from paramiko import AutoAddPolicy, RSAKey, SSHClient
from paramiko.channel import Channel
from paramiko.transport import Transport
from expose.helpers.auxiliary ... |
SocketServer.py | import socket
from Component.Handler.eventHook import EventHook
import threading
class SocketServer (object):
port = 63342
host = socket.gethostbyname(socket.gethostname())
_socketHandler = EventHook()
_p2pHandler = EventHook()
_isSocketUp = False
def __init__(self,serverPort):... |
safe_t.py | from binascii import hexlify, unhexlify
import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bip32 import BIP32Node
from electrum import constants
from electr... |
OSC_recieve_serial_send.py | import serial #requires pySerial
import OSC #requires pyOSC
import time, threading
receiveAddress = ('0.0.0.0', 9000)
server = OSC.OSCServer(receiveAddress) #set up the OSC server
server.addDefaultHandlers() #not really necessary
def yamahaHandler(address, typetag, value, source): #a function for the Yamaha receiver... |
TcpServer.py | import socket
import threading
import argparse
def serveClient(clientToServeSocket, clientIPAddress, portNumber):
# to receive data from client
clientRequest = clientToServeSocket.recv(4096)
print "[!] Received data from the client (%s:%d):%s" % (clientIPAddress, portNumber, clientRequest)
# reply back to cl... |
portable_runner.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
eval_multipro.py | # System libs
import os
import argparse
from distutils.version import LooseVersion
from multiprocessing import Queue, Process
# Numerical libs
import numpy as np
import math
import torch
import torch.nn as nn
from scipy.io import loadmat
# Our libs
from config import cfg
from dataset import ValDataset
from models impor... |
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... |
deadlock.py | '''
I do not apology, and you do not apology.
For me: only if you apology, will I apology
For you: only if I apology, will you apology
'''
import threading
import time
my_lock=threading.Lock()
your_lock=threading.Lock()
def i():
'''
1. I am determined to not apology
2. if you apology, ... |
test_logging.py | # Copyright 2001-2017 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
TestFixtures.py | from fastapi_wrapper import cli
import json
import unittest # https://docs.python.org/2/library/unittest.html
class FastAPIWrapperTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def testFastAPIWrapper(self):
'''
### Test FastAPI Wrapper
'... |
collective_ops_test.py | # Copyright 2020 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 applicab... |
test_http.py | # -*- encoding: utf-8 -*-
import collections
import email.parser
import platform
import socket
import threading
import time
import pytest
import six
from six.moves import BaseHTTPServer
from six.moves import http_client
import ddtrace
from ddtrace import compat
from ddtrace.profiling import exporter
from ddtrace.prof... |
timing.py | """Time related utilities."""
import pytz
import sys
import os
import re
import collections
import functools
import time
import datetime
import threading
class TimeoutException(Exception):
"""Timeout exception error."""
pass
class TimeoutExceptionInfo(object):
"""
Holds timeout exception informatio... |
fn_api_runner.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
test_sync.py | import asyncio
import functools
import multiprocessing
import sys
import threading
import time
from concurrent.futures import ThreadPoolExecutor
from functools import wraps
from unittest import TestCase
import pytest
from asgiref.compatibility import create_task, get_running_loop
from asgiref.sync import ThreadSensit... |
cluster_multiprocessing_1_test.py | # Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
portable_runner.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
manager.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... |
client.py | import xmlrpclib
import threading
import httplib
import functools
from sys import hexversion
OPTIONS = {'CONFIGURED': False, 'TIMEOUT': 20}
def configure(opts):
if not OPTIONS['CONFIGURED']:
try: # support for django
import django.conf
OPTIONS.update(django.conf.settings.PYAPNS_CONFIG)
OPTIONS... |
avatar-test.py | #!/usr/local/bin/python
##
# TODO:
#
##
#import
import os
import time
import shutil
import subprocess
import getpass
import glob
import autoreport
from multiprocessing import Process
from optparse import OptionParser
import config
#variables
numberOfRuns = 2
numberOfClients = 2
testName = "avatar-test"
#folder co... |
test_app.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# test_app.py
#
# Copyright 2020 Bruce Schubert <bruce@emxsys.com>
#
# MIT License
#
# 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... |
stm32uart.py | # Copyright 2017 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 stm32 usb endpoint."""
from __future__ import print_function
import os
import select
import sys
import t... |
evaluation_worker.py | '''This module is responsible for launching evaluation jobs'''
import argparse
import json
import logging
import os
import time
from threading import Thread
import rospy
from rl_coach.base_parameters import TaskParameters
from rl_coach.core_types import EnvironmentSteps
from rl_coach.data_stores.data_store import Sync... |
pool.py | import logging
import os
import random
import signal
import sys
import time
import traceback
from datetime import datetime
from uuid import uuid4
import collections
from multiprocessing import Process
from multiprocessing import Queue as MPQueue
from queue import Full as QueueFull, Empty as QueueEmpty
from django.con... |
pingback.py | # PingBack oci.dll malware client using icmp packets for its comms protocol
# Lloyd Macrohon <jl.macrohon@gmail.com>
import socket
import threading
import time
import os
import tty
import termios
import fcntl
import traceback
import click
from scapy.all import *
from collections import namedtuple
OciPayload = namedt... |
Hiwin_RT605_ArmCommand_Socket_20190627160311.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 *
import math
import enum
pos_feedback_times = 0
mode_feedback_times = 0
msg_feedback = 1
#接收策略端命令 用Socket傳輸至控制端電腦
import socket
##多執行序
i... |
main.py | from threading import Timer, Thread
import time
import os
import sys
def kill():
print("TLE")
exit(1)
testCases = int(sys.argv[1])
timeLimit = int(sys.argv[2])
def runCode(timeout):
if os.system("csc /source/code.cs -out:/source/code.exe 2> /source/out/compile_out.txt > /source/out/compile_error.txt") !=... |
email.py | #-*- coding=utf-8 -*-
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from . import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_current_o... |
__init__.py | # Copyright 2019 TerraPower, LLC
#
# 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 writi... |
async_01.py | '''回调函数实现异步'''
import threading
import time
def longIo(callback):
'''模拟耗时操作'''
def run(cb):
print('开始耗时操作')
time.sleep(5)
print('结束耗时操作')
cb('jpy is a good boy')
# 开辟线程执行耗时操作
threading.Thread(target=run, args=(callback,)).start()
def on_finish(data):
print('开始执行... |
internet_stream_player.py | import gi
import sys
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib
import os
import time
import threading
import logging
class InternetStreamPlayer():
def __init__(self, url=None):
self.url = url
Gst.init(sys.argv)
self.loop = GLib.MainLoop()
self.state = Gst.... |
build_pretraining_dataset.py | # coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
nn_test.py | # Copyright 2021 The Flax Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
interpreter.py | # Copyright 2019 The Meson development 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 applicable law or agreed to ... |
Gmail.py | from apiclient import errors
import threading
import time
import RPi.GPIO as GPIO
import GmailAuthorization
PIN = 35
CHECK_INTERVAL = 30
service = None
unread_count = 0
def refresh():
global unread_count
try:
messages = service.users().messages().list(userId='me', q='is:inbox + is:unread').execute()... |
analyzer.py | """Module containing logic used by the web app for repository analysis."""
import re
from threading import Thread
from itertools import chain
from fastlog import log
from psycopg2 import Error as PG_Error
from easy_postgres import Connection as pg_conn
from engine.preprocessing.repoinfo import RepoInfo
from engine.pre... |
dag_processing.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... |
EWSO365.py | import random
import string
from typing import Dict
import dateparser
import chardet
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import sys
import traceback
import json
import os
import hashlib
from io import StringIO
import logging
import warnings
import email... |
server.py | from __future__ import annotations
from ssl import SSLContext
from types import SimpleNamespace
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
Optional,
Type,
Union,
)
from sanic.models.handler_types import ListenerType
if TYPE_CHECKING:
from sanic.app import ... |
build_image_data.py | """Converts image data to TFRecords file format with Example protos.
The image data set is expected to reside in JPEG files located in the
following directory structure.
data_dir/label_0/image0.jpeg
data_dir/label_0/image1.jpg
...
data_dir/label_1/weird-image.jpeg
data_dir/label_1/my-image.jpeg
...
where th... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum.util import bfh, bh2u, UserCancelled, UserFacingException
from electrum.bip32 import BIP32Node
from electrum import constants
from electrum.i18n import... |
test_smtplib.py | import asyncore
import email.utils
import socket
import smtpd
import smtplib
import StringIO
import sys
import time
import select
import unittest
from test import test_support
try:
import threading
except ImportError:
threading = None
HOST = test_support.HOST
def server(evt, buf, serv):
serv.listen(5)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.