source
stringlengths
3
86
python
stringlengths
75
1.04M
main.py
import OWeather, modbusslave import pandas as pd import time import threading startflag = 0 # 启动modbus从站 modbusThread = threading.Thread(target=modbusslave.main) modbusThread.start() modbusThread.join(1) # 获取需要查询的城市列表,及modbus地址 def getTarCityList(): TCL = r'tarcitylist.csv' data = pd.read_csv(...
test_menu.py
import signal import threading from queue import Queue from django.conf import settings from django.template import Template, Context from django.test import TestCase from django.test.client import RequestFactory from menu import Menu, MenuItem # XXX TODO: test MENU_HIDE_EMPTY class CustomMenuItem(MenuItem): "...
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...
gso.py
from pgso.evaluate import error, evaluate, update_velocity, update_position from multiprocessing import Manager, Process, Lock from pgso.init_particles import create_n_particles from numba import jit import numpy as np # @jit def PSO_purana(costFunc,bounds,maxiter,swarm_init=None, log=False, the_list=None): ...
multiprocessuse.py
import tornado.httpserver import tornado.ioloop import tornado.web from tornado.options import define import multiprocessing ''' 最直接的办法,用多进程调用。但是问题是每个实例只能绑定不同的端口,否则就会报错。 ''' define('port', default=8000, type=int) class IndexHandler(tornado.web.RequestHandler): def get(self): quote = {'quot...
constellation_exhibit.py
# Standard imports import configparser import datetime import logging import shutil import threading import time import os # Non-standard imports import icmplib import wakeonlan # Constellation imports import config class ExhibitComponent: """Holds basic data about a component in the exhibit""" def __init_...
hippo.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division import pygame import random import cv2 import canvas import numpy as np import itertools import time import config import play import multiprocessing import arduino_client import config black_ = 0, 0, 0 # If no activity is...
import_financials.py
#!/usr/bin/env python import argparse import bs4 import datetime import time import logging import re import requests from bs4 import BeautifulSoup import threading import common import data import Quandl #### # Setup tor to use for all imports import socks import socket import requests #socks.setdefaultproxy(proxy...
Assembler.py
try: from source.Database_generator import * from source.Taxonomy_SQLITE_Connector import Taxonomy_SQLITE_Connector from source.Metadata_SQLITE_Connector import Metadata_SQLITE_Connector except: from Database_generator import * from Taxonomy_SQLITE_Connector import Taxonomy_SQLITE_Connector fro...
test_utils.py
# Copyright © 2020 Interplanetary Database Association e.V., # BigchainDB and IPDB software contributors. # SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) # Code is Apache-2.0 and docs are CC-BY-4.0 import queue from unittest.mock import patch, call import pytest @pytest.fixture def mock_queue(monkeypatch): ...
test_autograd.py
# Owner(s): ["module: autograd"] import contextlib import gc import io import math import os import random import sys import tempfile import threading import time import unittest import uuid import warnings import operator import subprocess from copy import deepcopy from collections import OrderedDict from itertools i...
player.py
# # MythBox for XBMC - http://mythbox.googlecode.com # Copyright (C) 2011 analogue@yahoo.com # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at yo...
test_rpc.py
import os import time import socket import dgl import backend as F import unittest, pytest import multiprocessing as mp from numpy.testing import assert_array_equal from utils import reset_envs if os.name != 'nt': import fcntl import struct INTEGER = 2 STR = 'hello world!' HELLO_SERVICE_ID = 901231 TENSOR = ...
main.py
from tkinter.filedialog import askopenfilename, askdirectory, asksaveasfilename import tkinter from tkinter import messagebox from tkinter.ttk import Progressbar, Style from PIL import ImageTk, Image import time import os import sys import subprocess import threading try: from src.docs import config except Exception ...
server_launcher.py
#!/usr/bin/python import os import shutil import time from conans import SERVER_CAPABILITIES from conans.paths.simple_paths import SimplePaths from conans.server.conf import get_server_store from conans.server.crypto.jwt.jwt_credentials_manager import JWTCredentialsManager from conans.server.crypto.jwt.jwt_updown_mana...
test_SeqIO_index.py
# Copyright 2009-2017 by Peter Cock. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Unit tests for Bio.SeqIO.index(...) and index_db() functions.""" try: import sqlite3...
extcap_ot.py
#!/usr/bin/env python3 # # Copyright (c) 2019, The OpenThread 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-...
flaskwebgui.py
__version__ = "0.3.4" import os import sys import time from datetime import datetime import logging import tempfile import socketserver import subprocess as sps from inspect import isfunction from threading import Lock, Thread logging.basicConfig(level=logging.INFO, format='flaskwebgui - [%(levelname...
corescrape_thread.py
""" Core Scrape Threading Thread control for this package. """ import signal from warnings import warn from queue import Queue from threading import Thread from . import corescrape_event from core import CoreScrape from core.exceptions import CoreScrapeTimeout # pylint: disable=invalid-name, too-few-public-methods,...
threading chat client.py
import threading import socket from urllib import request INITIAL_PORT = 80 ENCODING = 'utf-8' def send(sock: socket.socket): while True: msg = input("send << ") encode = msg.encode(ENCODING) sock.send(len(encode).to_bytes(32, 'big') + encode) def recv(sock: socket.socket): while T...
MdnsListener.py
# Copyright (C) 2018 Riedel Communications GmbH & Co. KG # # Modifications Copyright 2018 British Broadcasting 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.a...
base_cli_srv.py
#!/usr/bin/python3 # Copyright 2016 ETH Zurich # # 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...
release.py
#!/usr/bin/python import re import sys import os import os.path import subprocess import shutil import tempfile from datetime import * from multiprocessing import Process from utils import * from xml.etree.ElementTree import * # TreeBuilder that preserves comments class CommentedTreeBuilder(TreeBuilder): def __init...
find_primes_mult_old.py
#!/usr/bin/python3 import sys, os, subprocess, re, time, itertools, csv from multiprocessing import Process, Manager, Pool outfile = open('output.csv', 'w') wr = csv.writer(outfile) def worker(in_queue, out_list): while True: line = in_queue.get() row = line[1].split(',') server = row[0] ...
bot.py
# coding=utf8 """ bot.py - Willie IRC Bot Copyright 2008, Sean B. Palmer, inamidst.com Copyright 2012, Edward Powell, http://embolalia.net Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> Licensed under the Eiffel Forum License 2. http://willie.dftba.net/ """ from __future__ import unicode_literals from __futu...
run_summarization.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # # 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...
_server.py
""" A Simple server used to show mpld3 images. """ import sys import threading import webbrowser import socket import itertools import random IPYTHON_WARNING = """ Note: if you're in the IPython notebook, mpld3.show() is not the best command to use. Consider using mpld3.display(), or mpld3.enable_notebook(). ...
__init__.py
# -*- coding: utf-8 -*- # Three possible modes: # 'cli': running from "wandb" command # 'run': we're a script launched by "wandb run" # 'dryrun': we're a script not launched by "wandb run" from __future__ import absolute_import, print_function __author__ = """Chris Van Pelt""" __email__ = 'vanpelt@wandb....
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...
core.py
# coding:utf-8 # # PROGRAM/MODULE: firebird-driver # FILE: firebird/driver/core.py # DESCRIPTION: Main driver code (connection, transaction, cursor etc.) # CREATED: 25.3.2020 # # The contents of this file are subject to the MIT License # # Permission is hereby granted, free of charge, to any person ...
SerialDevice.py
import serial import threading import time class SerialDevice(): _maxNameLength = 0 def __init__(self, name, serialDevicePath): self._serialDevicePath = serialDevicePath self._name = name self._rxBuf = "" self._rxBufClearable = "" self._port = self._openSerialPort(seria...
test_windows_events.py
import os import signal import socket import sys import subprocess import time import threading import unittest from unittest import mock if sys.platform != 'win32': raise unittest.SkipTest('Windows only') import _overlapped import _testcapi import _winapi import asyncio from asyncio import windows_events from a...
draw_bubbles_py_3.py
# Visualization of GTac-Hand offline # -*- coding: utf-8 -*- """ Created on Wed Nov 25 14:13:15 2020 Draw bubbles offline @author: Zeyu """ import matplotlib.pyplot as plt import matplotlib.animation as animation import pandas as pd from matplotlib.animation import FuncAnimation from matplotlib import style import num...
signaler_qt.py
#!/usr/bin/env python # encoding: utf-8 import threading import time from PySide import QtCore import zmq from zmq.auth.thread import ThreadAuthenticator from api import SIGNALS from certificates import get_frontend_certificates from utils import get_log_handler logger = get_log_handler(__name__) class SignalerQt...
plutus.py
# Plutus Bitcoin Brute Forcer # Made by Isaac Delly # https://github.com/Isaacdelly/Plutus import os import time import pickle import hashlib import binascii import multiprocessing from ellipticcurve.privateKey import PrivateKey DATABASE = r'database/' def generate_private_key(): """ Generate a random 32-byte hex...
top.py
""" TODO: 1. Refactor code so it's organized (now that I have an idea of what it'll do) 2. Add more sorting by changing stat dict to something that's easier to sort """ import os import sys import glob import pickle from decimal import Decimal import time from pprint import pprint from os import system, name fr...
dual_blob_store.py
#!/usr/bin/env python """A BlobStore proxy that writes to two BlobStores.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import logging import threading import time from future.builtins import str from future.moves import queue from typing import Cal...
run_engine.py
import asyncio from datetime import datetime import time as ttime import sys import logging from warnings import warn from inspect import Parameter, Signature from itertools import count, tee from collections import deque, defaultdict, ChainMap from enum import Enum import functools import inspect from contextlib impor...
dataset.py
# *************************************************************** # Copyright (c) 2020 Jittor. Authors: # Meng-Hao Guo <guomenghao1997@gmail.com> # Dun Liang <randonlang@gmail.com>. # All Rights Reserved. # This file is subject to the terms and conditions defined in # file 'LICENSE.txt', which is part of this...
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 CAR_VOLTAGE_LOW_PASS_K = 0.091 # LPF gain for 5s tau...
WebcamVideoStream.py
# import the necessary packages from threading import Thread import cv2 class WebcamVideoStream: def __init__(self, src=0, resolution=(1280, 720), framerate=32): # initialize the video camera stream and read the first frame # from the stream self.stream = cv2.VideoCapture(src) self...
cluster.py
# Copyright (c) 2015-2020 Avere Systems, Inc. All Rights Reserved. # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See LICENSE in the project root for license information. '''vFXT Cluster management Cookbook/examples: # A cluster is built with a service object (aws or gc...
alarm.py
# Copyright (c) 2009-2019 Tom Keffer <tkeffer@gmail.com> # See the file LICENSE.txt for your rights. """Example of how to implement an alarm in WeeWX. ******************************************************************************* To use this alarm, add the following to the weewx configuration file: [Alarm] ...
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_dash.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException from electrum_dash.bip32 import BIP32Node from electrum_dash import consta...
pair-thread.py
# this example uses a background thread to run the daemon in, also works on Windows import socket import threading from Pyro5.api import expose, Daemon, Proxy # create our own socket pair (server-client sockets that are already connected) sock1, sock2 = socket.socketpair() class Echo(object): @expose def e...
Utils.py
# # Cython -- Things that don't belong # anywhere else in particular # import os import sys import re import io import codecs from contextlib import contextmanager modification_time = os.path.getmtime def cached_function(f): cache = {} uncomputed = object() def wrapper(*args): res =...
A3C_continuous_action.py
""" Asynchronous Advantage Actor Critic (A3C) with continuous action space, Reinforcement Learning. The Pendulum example. View more on my tutorial page: https://morvanzhou.github.io/tutorials/ Using: tensorflow r1.3 gym 0.8.0 """ import multiprocessing import threading import tensorflow as tf import numpy as np imp...
scrapperGreatest.py
import requests from bs4 import BeautifulSoup import json import threading from nltk import tokenize # Constants STORY_DOMAIN = 'https://americanliterature.com' GREAT_STORIES_URL = 'https://americanliterature.com/100-great-short-stories' STORIES_FOR_CHILDREN = 'https://americanliterature.com/short-stories-for-children...
test_time.py
from test import support import decimal import enum import locale import math import platform import sys import sysconfig import time import threading import unittest try: import _testcapi except ImportError: _testcapi = None # Max year is only limited by the size of C int. SIZEOF_INT = sysconfig.get_config_v...
video_recorder.py
import random import csv import io import os import threading import time import logging import sys from sys import platform from datetime import datetime try: #Depende de la version de python from Queue import Queue, Empty except: from queue import Queue, Empty import numpy as np import cv2 from configs import ...
calculator.py
#!/usr/bin/env python3 import sys from multiprocessing import Queue,Process,Lock from datetime import datetime import getopt import configparser class Config(object): def __init__(self,filename,arg='DEFAULT'): self._filename = filename self._arg = arg self._obj = configparser.ConfigParser(...
master.py
#!/usr/bin/env python try: from gpiozero import DigitalOutputDevice from gpiozero import DigitalInputDevice, Button RPI_OK = True except: RPI_OK = False pass import webapp from signal import pause EXPLODE_TIME = 18 EXPLODE_TRACK = 3 DIM1_INTRO = 50 DIM2_INTRO = 40 DIM1_TRAIN = 35 DIM2_TRAI...
preprocessing.py
import os from collections import deque from multiprocessing import Process import cv2 as cv import dlib import numpy as np from skimage import transform as tf from tqdm import tqdm STD_SIZE = (224, 224) stablePntsIDs = [33, 36, 39, 42, 45] def shape_to_array(shape): coords = np.empty((68, 2)) ...
celery.py
import json import multiprocessing from typing import Any, Dict, List, Optional from celery import Celery from celery.result import AsyncResult from redis import Redis from typing_extensions import TypedDict from openff.bespokefit.executor.services.models import Error from openff.bespokefit.executor.utilities.typing ...
jobs.py
# -*- coding: utf-8 -*- """ jobs ~~~~~~~~~~~~~~ Jobs defined here. :copyright: (c) 2016 by fengweimin. :date: 16/8/12 """ import os import threading import time from collections import Counter import schedule from app.models import Post from app.views.public import okex_global_price_new from ap...
async_checkpoint.py
# Copyright 2018 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...
main_11_Predictors.py
import Redes.Red_LSTM_Fine as Interface import Auxiliary.preprocessingData as Data import Auxiliary.GPUtil as GPU import numpy as np import os from threading import Thread import pickle import tensorflow as tf ################################### os.environ["CUDA_VISIBLE_DEVICES"] = "0, 1, 2, 3" # To force tensorflo...
test_asyncore.py
import asyncore import unittest import select import os import socket import threading import sys import time from test import support from test.support import TESTFN, run_unittest, unlink from io import BytesIO from io import StringIO HOST = support.HOST class dummysocket: def __init__(self): self.close...
process_prometheus_metrics.py
import logging import threading import time import ipcqueue.posixmq import prometheus_client.registry from django.apps import apps from django.core.exceptions import ImproperlyConfigured from django.core.management import call_command from django.core.management.base import BaseCommand from ...backends.prometheus im...
UdpComms.py
# Created by Youssef Elashry to allow two-way communication between Python3 and Unity to send and receive strings # Feel free to use this in your individual or commercial projects BUT make sure to reference me as: Two-way communication between Python 3 and Unity (C#) - Y. T. Elashry # It would be appreciated if you se...
__init__.py
# coding=utf-8 """ User Interface Tools """ import ee import threading import pprint from . import dispatcher ASYNC = False def eprint(*args, **kwargs): """ Print EE Objects. Similar to `print(object.getInfo())` but with some magic (lol) :param eeobject: object to print :type eeobject: ee.ComputedOb...
other-sites.py
''' NERYS a universal product monitor Current Module: Other Sites Usage: NERYS will monitor specified sites for keywords and sends a Discord alert when a page has a specified keyword. This can be used to monitor any site on a product release date to automatically detect when a product has been uploaded. Use...
app.py
from src.kafka_module.kf_service import process_block_merger_kf, block_merger_request_worker#, block_merger_request_worker_ocr from anuvaad_auditor.loghandler import log_info from anuvaad_auditor.loghandler import log_error from flask import Flask from flask.blueprints import Blueprint from flask_cors import CORS from ...
base_api.py
from django.http.response import HttpResponse from django.views.decorators.http import require_http_methods from django.core.validators import URLValidator from django.core.exceptions import ValidationError from neomodel import UniqueProperty, DoesNotExist from numpy import median from copy import deepcopy from rdflib...
core.py
# <HTTPretty - HTTP client mock for Python> # Copyright (C) <2011-2021> Gabriel Falcão <gabriel@nacaolivre.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, includ...
app.py
import logging import threading import weakref from logging import getLogger, NullHandler from .helper.iter_utils import align_iterables from .root import Root logger = getLogger(__name__) logger.addHandler(NullHandler()) class App: def __init__(self): self.root_widget = Root self.root_view = No...
service.py
import os import re import sys import json import time import click import psutil import importlib import traceback import threading import subprocess import watchdog import anchore_engine.configuration.localconfig from watchdog.observers import Observer from watchdog.events import RegexMatchingEventHandler from anch...
conftest.py
import array import functools import logging import os import pytest import signal import subprocess import sys import threading import time import uuid from types import SimpleNamespace import caproto as ca import caproto.benchmarking # noqa from caproto.sync.client import read import caproto.threading # noqa impo...
server-socket.py
import socket import threading host = socket.gethostbyname(socket.gethostname()) port = 12458 # Starting the Server serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serverSocket.bind((host, port)) serverSocket.listen() # List for clients and their nicknames clients = [] nicknames = [] # We want to b...
utils.py
import codecs import json import os import shutil import stat from threading import Thread import requests import subprocess import sys import time import unittest from contextlib import contextmanager from tempfile import TemporaryDirectory from flask import request def file_content(path, binary=True): if bina...
ominibot_car_driver.py
#!/bin/usr/python3 # coding=UTF-8 #Copyright (c) 2021 Wei-Chih Lin(weichih.lin@protonmail.com) # # 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/L...
test_712_buffering.py
import datetime import re import sys import time import subprocess from datetime import timedelta from threading import Thread import pytest from h2_conf import HttpdConf class CurlPiper: def __init__(self, url: str): self.url = url self.proc = None self.args = None self.header...
estimator.py
""" """ import pickle import copy from functools import partial from multiprocessing import Process, Pipe import time from sklearn.base import BaseEstimator from sklearn.metrics import accuracy_score, r2_score from sklearn.decomposition import PCA try: from sklearn.model_selection import KFold, StratifiedKFold, Lea...
bot.py
# Copyright 2008, Sean B. Palmer, inamidst.com # Copyright © 2012, Elad Alfassa <elad@fedoraproject.org> # Copyright 2012-2015, Elsie Powell, http://embolalia.com # Copyright 2019, Florian Strzelecki <florian.strzelecki@gmail.com> # # Licensed under the Eiffel Forum License 2. from __future__ import generator_stop fr...
main.py
import webbrowser, threading from threading import Thread def setup(): setup = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab' startup = 'https://c.tenor.com/CWgfFh7ozHkAAAAC/rick-astly-rick-rolled.gif' for x in setup and startup: webbrowser.open(setup) webbrowser.open(startup) ...
worker_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
go_tool.py
from __future__ import absolute_import import argparse import copy import json import os import re import shutil import subprocess import sys import tempfile import threading import six from functools import reduce arc_project_prefix = 'a.yandex-team.ru/' std_lib_prefix = 'contrib/go/_std/src/' vendor_prefix = 'vendor...
ppo.py
import numpy as np import tensorflow as tf # import tensorflow_probability as tfp import gym import logz import os import time import inspect from multiprocessing import Process # ============================================================================================# # Utilities # =============================...
commands.py
# These are the Mailpile commands, the public "API" we expose for searching, # tagging and editing e-mail. # import copy import datetime import json import os import os.path import random import re import shlex import socket import sys import traceback import threading import time import webbrowser import mailpile.uti...
motion_led.py
import modules.constants.color_constants as color # Contains different color constants as tuples import datetime import schedule import sys import threading from modules.constants.constants import * # Local constants file from modules.request_handler import * # Local module file from modules.routines import * # Loc...
server.py
import asyncio import json import websockets import random, string import time import threading import math global all_user global parties global rooms threads = [] all_user = dict() #users online parties = dict() #parties available nr = 4#no of participants in one room avb = 0 #no of rooms rooms = dict() rooms[avb] ...
pipeline.py
""" Copyright (c) 2020 Intel 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 wri...
build_imagenet_data.py
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
__init__.py
""" Package containing the CodaLab client tools. """ import json import logging import multiprocessing import os import yaml import time from Queue import Empty class BaseConfig(object): """ Defines a base class for loading configuration values from a YAML-formatted file. """ def __init__(self, filen...
scapy_ping.py
#encoding: utf-8 import sys import os import ipaddress import multiprocessing from scapy.all import * from scapy_ping_one import scapy_ping_one def scapy_ping_scan(network): net = ipaddress.ip_network(network.decode('unicode-escape')) ip_processes = {} for ip in net: ip_addr = str(ip) pin...
Hiwin_RT605_ArmCommand_Socket_20190627184954.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...
game.py
import pygame import threading import sys from core.legacy_cube import Cube import numpy as np pygame.init() window_name = '.'.join(sys.argv[0].split('.')[:-1]) pygame.display.set_caption(window_name if window_name != '' else 'pygame') SCREEN = pygame.display.set_mode((600, 400)) done = False clock = pygame.time.Clock...
TermEmulator.py
import socket import paramiko import base64 from binascii import hexlify import getpass import os import select import socket import sys import traceback from paramiko.py3compat import u import wx class TermEmulator(): def __init__(self, output_call, auth_info): self.system = self.sysDetect() self...
installwizard.py
from functools import partial import threading import os from kivy.app import App from kivy.clock import Clock from kivy.lang import Builder from kivy.properties import ObjectProperty, StringProperty, OptionProperty from kivy.core.window import Window from kivy.uix.button import Button from kivy.uix.togglebutton impo...
ES.py
import numpy as np import tensorflow as tf from datetime import datetime import time import gym import multiprocessing as mp import scipy.stats as ss import contextlib import numpy as np @contextlib.contextmanager def temp_seed(seed): state = np.random.get_state() np.random.seed(seed) try: yield ...
classify_train_mp_ring.py
import os import time import numpy as np import numpy.random as rd import torch from Demo_deep_learning.yonv_utils import load_data_ary from Demo_deep_learning.yonv_utils import load_torch_model from Demo_deep_learning.yonv_utils import whether_remove_history from torch.nn.utils import clip_grad_norm_ """G...
28.py
from threading import Thread from time import sleep, ctime loops = [4, 2, 3] class ThreadFunc(object): def __init__(self, func, args, name=''): self.name = name self.func = func self.args = args def __call__(self): apply(self.func, self.args) def loop(nloop, nsec): pri...
gnmi_sub_on_change.py
#!/usr/bin/env python3 # Copyright 2013-present Barefoot Networks, 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...
tf_util_mod.py
import numpy as np import tensorflow as tf # pylint: ignore-module import copy import os import functools import collections import multiprocessing def switch(condition, then_expression, else_expression): """Switches between two operations depending on a scalar value (int or bool). Note that both `then_expres...
query_pipe.py
# -*- coding:utf8 -*- # File : query_pipe.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 3/19/17 # # This file is part of TensorArtist. from . import configs, utils from ...core import get_logger from ...core.utils.callback import CallbackManager from ...core.utils.meta import notnone_propert...
main.py
import sys import threading from time import sleep import cv2 import numpy as np import process from PyQt5.QtCore import QTimer from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.uic import loadUi from PyQt5.QtGui import QPixmap, QImage from beepy.make_sound import beep import pyttsx3 class Window(QMain...
main.py
#! /usr/bin/python3 from flask import Flask from flask import request from flask import jsonify from threading import Thread import RPi.GPIO as GPIO import pusherclient as PusherClient from pusher import Pusher as PusherEvent import ast import os import sys import time import pymysql.cursors from datetime import dateti...
pulsar-test.py
#!/usr/bin/env python import pulsar import sys import time import subprocess from datetime import datetime import threading from collections import defaultdict import re from gather_info_functions import * def log(text, to_file=False): global output_file time_now = datetime.now().strftime('%H:%M:%S') print...
app.py
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 import cgi import urlparse import traceback from threading import Thread from SocketServer import ThreadingMixIn from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from django.utils.simplejson import JSONEncoder from django.db.models.query import QuerySet ...
train_pg.py
#Reference: #1. https://github.com/mabirck/CS294-DeepRL/blob/master/lectures/class-5/REINFORCE.py #2. https://github.com/JamesChuanggg/pytorch-REINFORCE/blob/master/reinforce_continuous.py #3. https://github.com/pytorch/examples/blob/master/reinforcement_learning/actor_critic.py # With the help from the implementation...