source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
autonomous_v6.py | import car
import cv2
import numpy as np
import os
import serial
import socket
import threading
import time
from imutils.object_detection import non_max_suppression
from keras.layers import Dense, Activation
from keras.models import Sequential
import keras.models
dir_log = []
SIGMA = 0.33
stop_classifier = cv2.Cascad... |
supervisor.py | # Copyright 2016 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... |
views.py | """Defines a number of routes/views for the flask app."""
from functools import wraps
import io
import os
import sys
import shutil
from tempfile import TemporaryDirectory, NamedTemporaryFile
import time
from typing import Callable, List, Tuple
import multiprocessing as mp
import zipfile
from flask import json, jsonif... |
grid_minimizer.py | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 10 00:08:57 2019
@author: Nate
"""
from simpletransformers.classification import ClassificationModel
import pandas as pd
from sklearn.utils import shuffle
from sklearn.metrics import f1_score, accuracy_score
from skopt import gp_minimize
from skopt.space import Real, Int... |
Threaded.py | import paramiko, sys, os, socket, termcolor
import threading, time
stop_flag = 0
def ssh_connect(password, code=0):
global stop_flag
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy)
try:
ssh.connect(host, port=22, username=username, password=password)
... |
debuggee.py | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import atexit
import os
import struct
import subprocess
import sys
impo... |
settings_20210906114807.py | """
Django settings for First_Wish project.
Generated by 'django-admin startproject' using Django 3.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathli... |
main1.py | # run on your system
# new file
#test
import socket
import requests
import threading
import json
import datetime
import time
import netifaces as ni
import random
import pymongo
import hashlib
from blockchain import Blockchain
import sys
import _thread
ip = "http://192.168.43.168:5000"
page = "/ul"
login_p = '/logi'... |
pccold.py | # coding: utf-8
"""
===================================================
__
_______ ______ ______ _____ | | ___
| __ || ___| | ___| / \ | | ___| |
| ___|| |____ | |____ | o || |... |
gs_utils.py | #!/usr/bin/python
# pylint: disable=C0301
"""
Copyright 2014 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Utilities for accessing Google Cloud Storage, using the boto library (wrapper
for the XML API).
API/library references:
- https://developers.goog... |
robot_video_stream.py |
"""
RobotVideoStream 中的部分代码 和 libh264decoder 来自 dji-sdk/RoboMaster-SDK
详见 https://github.com/dji-sdk/RoboMaster-SDK/tree/master/sample_code/RoboMasterEP/stream
"""
import queue
import socket
import threading
import time
import cv2
import numpy as np
from PIL import Image as PImage
import libh264decoder
from . im... |
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... |
mqtt.py | """
JADS 2020 Data-Driven Food Value Chain course
Introduction to Sensors
Minimal MQTT client demo - demonstrates ease of use.
Makes use of the open http://www.mqtt-dashboard.com/index.html
And yes, globals are evil ;)
"""
import threading
import paho.mqtt.client as mqtt
import os
def on_conne... |
dialog.py | import threading
from time import sleep
import sys
import gi
gi.require_version('Gtk','3.0')
from gi.repository import Gtk
#Author : Reebal Javed Khan
# used to display some text/info passed as second argument to python executable
# example
# python dialog.py hello
# will display hello in a window for 1 seco... |
__init__.py | # ============================================================================
# FILE: __init__.py
# AUTHOR: Philip Karlsson Gisslow <philipkarlsson at me.com>
# License: MIT license
# ============================================================================
import neovim
import time
import threading
from nvgdb.nv... |
horikun.py | import win32gui, win32api, win32con
import time, random
import tkinter
import os, sys
import threading, inspect, ctypes
# 包装:pyinstaller -F -w horikun.py
# <editor-fold desc="horikun: 基本的界面及功能">
"""
常量定义
"""
TITLELIST = [": v1.1.8", ":最新版!(大概)", ": Hello World", ":持续更新中",
":扫地洗衣", ":偷袭暗杀",... |
test_enum.py | import enum
import inspect
import pydoc
import sys
import unittest
import sys
import threading
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, Flag, IntFlag, unique, auto
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
from test import support
from ... |
PuppetExecutor.py | #!/usr/bin/env python2.6
'''
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
"Licens... |
Run.py | """
"""
import time
import numpy as np
from threading import Thread
from TPD.MassSpec_Functions import thread_read_masses
from TPD.Eurotherm_Functions import thread_send_mV_setpoint,read_Temp_value
# from TPD.Gui import emergency_stop
from TPD.Header_info import write_data, header_info
import pyqtgraph as pg
from queu... |
functions.py | #
# This file is part of khmer, http://github.com/ged-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see doc/LICENSE.txt.
# Contact: khmer-project@idyll.org
#
# pylint: disable=missing-docstring
import threading
import khmer.utils
def bu... |
data.py | import os
import cv2
import random
import tempfile
import numpy as np
from Queue import Queue
from threading import Thread
from .base_provider import VideosDataset, DataProvider
class Data(VideosDataset):
def __init__(self, name, paths, normalization, sequence_length,
crop_size, num_classes, queue_si... |
test_transaction.py | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
import time
import pytest
import dns.name
import dns.rdataclass
import dns.rdatatype
import dns.rdataset
import dns.rrset
import dns.transaction
import dns.versioned
import dns.zone
class DB(dns.transaction.TransactionManager):
def __i... |
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... |
state.py | """
The State Compiler is used to execute states in Salt. A state is unlike
an execution module in that instead of just executing a command, it
ensures that a certain state is present on the system.
The data sent to the state calls is as follows:
{ 'state': '<state module name>',
'fun': '<state function name... |
__init__.py | import gc
import threading
import time
from collections import deque
import itertools
# maximum from all old periods is being promoted to next one
DOWSER_MAXENTRIES = [12, 120, 60, 60]
DOWSER_TICKS = [5, 6, 48, 28]
DOWSER_NAMES = ["1m", "1h", "1d", "4w"]
class Dowser(object):
"""
A working thread to gather t... |
BuildReport.py | ## @file
# Routines for generating build report.
#
# This module contains the functionality to generate build report after
# build all target completes successfully.
#
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made a... |
handlers.py | # Copyright 2001-2016 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 perm... |
run_service.py | # -*- coding: utf-8 -*-
"""
Copyright (C) 2017 Sebastian Golasch (plugin.video.netflix)
Functions for starting the service
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
import threading
from socket import gaierror
from resources.lib.common import select_port, get_local_stri... |
play.py | # https://github.com/openai/gym/blob/master/gym/envs/classic_control/pendulum.py
# https://mspries.github.io/jimmy_pendulum.html
#!/usr/bin/env python3
import math
import time
import grpc
import torch
import os, sys
import numpy as np
current_path = os.path.dirname(os.path.realpath(__file__))
PROJECT_HOME = os.path.... |
test_sharedmodel.py | import time
import threading
def acquire_and_keep(s):
with s:
time.sleep(1)
class TestSharedModel:
def test_wait_if_locked(self, init_shared_model):
"""
Check if a thread has to wait if the model in
already in use.
"""
s = init_shared_model("TEST", "TEST")
... |
test_networking.py |
import contextlib
import enum
import itertools
import json
import logging
import subprocess
import threading
import time
import uuid
from collections import deque
import pytest
import requests
import retrying
import test_helpers
from dcos_test_utils import marathon
from dcos_test_utils.helpers import assert_respons... |
scriptHotSpot.py | #!/usr/bin/python3
import sys, posix, time, binascii, socket, select, multiprocessing
import hashlib, time
class ApiRos:
"Routeros api"
def __init__(self, sk):
self.sk = sk
self.currenttag = 0
def login(self, username, pwd):
for repl, attrs in self.talk(["/login"]):
... |
projectUtils.py | """
This module contains utility functions used internally by the rtcloud services
"""
import os
import sys
import re
import time
import zlib
import hashlib
import logging
import getpass
import requests
import threading
from pathlib import Path
from base64 import b64encode, b64decode
import rtCommon.utils as utils
from... |
prescience_client.py | # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Copyright 2019 The Prescience-Client Authors. All rights reserved.
import json
import os
from multiprocessing import Process, Queue
import pycurl
import re
import shutil
import time
import urllib.parse
import io
fr... |
multiprocesses.py | from multiprocessing.managers import BaseManager
from multiprocessing import Process, JoinableQueue
from time import sleep
import os
import signal
import dill
class ProcessPool:
"""
Class which enables multiprocess calls to custom functions
"""
class Shared:
"""
Object shared between ... |
test_threading_2.py | # testing gevent's Event, Lock, RLock, Semaphore, BoundedSemaphore with standard test_threading
from __future__ import with_statement
setup_ = '''from gevent import monkey; monkey.patch_all()
from gevent.event import Event
from gevent.lock import RLock, Semaphore, BoundedSemaphore
from gevent.thread import allocate_lo... |
graph_maker.py | import os, time, multiprocessing, math, random, torch, h5py, glob
from simPDF_xyz import *
from mendeleev import element
import numpy as np
import pandas as pd
import networkx as nx
from tqdm import tqdm
from shutil import copyfile
from diffpy.srreal.overlapcalculator import OverlapCalculator
from diffpy.srreal.pdfcalc... |
server.py | from flask import Flask, render_template, request, jsonify
from flask_cors import CORS, cross_origin
from multiprocessing import Process
import json
import boto3
import time
import paramiko
import os
import io
import warnings
app = Flask(__name__)
CORS(app)
SERVER_NAME = os.getenv('SERVER_NAME', 'On Demand Minecraft ... |
ActualBot.py | import os
import time
import base64
import shutil
import socket
import random
import ftplib
import paramiko
import win32api
import platform
import win32con
import win32gui
import threading
import win32file
import subprocess
import win32console
from Queue import Queue
from Crypto.Cipher import XOR, AES
... |
wait_for_ready_example.py | # Copyright 2019 The gRPC 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 writ... |
object_detect.py | #python3 main.py --bin ssd_mobilenet/MobileNetSSD_deploy.bin --xml ssd_mobilenet/MobileNetSSD_deploy.xml --labels ssd_mobilenet/labels.txt --conf_threshold=0.4
#python3 main.py --bin ssd_resnet50/saved_model.bin --xml ssd_resnet50/saved_model.xml --labels ssd_resnet50/labels.txt --conf_threshold=0.1
#python3 main.py ... |
Day4.py | import os
import time
import threading
import pyautogui
print("Integration Testing (Day 4) ...")
os.system("mvn compile")
os.chdir("./target/classes")
validAcc = " ../../ValidAccList.txt "
transSumDir = "../../TransactionFiles/"
master = " ../../Master.txt "
def runJava(session, arg1, arg2):
os.system("java mai... |
common.py | """Test the helper method for writing tests."""
import asyncio
import functools as ft
import json
import logging
import os
import uuid
import sys
import threading
from collections import OrderedDict
from contextlib import contextmanager
from datetime import timedelta
from io import StringIO
from unittest.mock import M... |
posix.py | from __future__ import unicode_literals
import fcntl
import os
import random
import signal
import threading
import time
from prompt_toolkit.terminal.vt100_input import InputStream
from prompt_toolkit.utils import DummyContext, in_main_thread
from prompt_toolkit.input import Input
from .base import EventLoop, INPUT_TIM... |
main.py |
# coding:utf-8
from distutils import archive_util
import sys
import requests
from bs4 import BeautifulSoup
import multiprocessing
import re
import os
import time
from config import Config, Host, OutputDir
from utils import getWebHost, removeN, trim
# 通过章节的url下载内容,并返回下一页的url
def get_ChartTxt(baseUrl, url, title, num,... |
LD.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Author : 'Victor'
# E-mail : linxianwusx@gmail.com
# Date : '2015/10/11'
# Version : 0.3
#
import Queue
import ConfigParser
import os
import requests
import threading
import cchardet
import re
import sqlite3 as sq
import time
import jsonpickle
NUM = 0
mutex... |
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 - ... |
service.py | import asyncio
import logging
import threading
import time
from typing import List, Callable, Optional, Dict, Awaitable
from uuid import uuid4
from antarest.core.interfaces.eventbus import Event, IEventBus
from antarest.eventbus.business.interfaces import IEventBusBackend
logger = logging.getLogger(__name__)
class ... |
core_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... |
test_client.py | import asyncio
from collections import deque
from contextlib import suppress
from functools import partial
import gc
import logging
from operator import add
import os
import pickle
import psutil
import random
import subprocess
import sys
import threading
from threading import Semaphore
from time import sleep
import tra... |
test_events.py | """Tests for events.py."""
import collections.abc
import concurrent.futures
import functools
import io
import os
import platform
import re
import signal
import socket
try:
import ssl
except ImportError:
ssl = None
import subprocess
import sys
import tempfile
import threading
import time
import errno
import uni... |
discovery_service.py | ################################################################################
# Copyright (C) 2016-2020 Abstract Horizon
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License v2.0
# which accompanies this distribution, and is available at
# http... |
func.py | import threading, time, sys, os, socket
import getpass
from diggi_orchestration import *
from diggi_build import *
#Which process to debug
#setup key exchange beforehand
#ssh-keygen -t rsa # ENTER to every field
#ssh-copy-id myname@somehost
ownip = (([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] ... |
fake_pebble.py | # Copyright 2021 Canonical Ltd.
#
# 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, s... |
DNSRequestReflector.py | #!/usr/bin/python
from scapy.all import *
from threading import *
from optparse import OptionParser
#import time
import socket
def queryDnsServer(targetHost,dnsServer):
answer = IP(dst=dnsServer,src=targetHost)/UDP()/DNS(rd=1,qd=DNSQR(qname="www.thepacketgeek.com")) #just fire the packet ;)
send(answe... |
test_sys.py | # -*- coding: iso-8859-1 -*-
import unittest, test.test_support
import sys, cStringIO
class SysModuleTest(unittest.TestCase):
def test_original_displayhook(self):
import __builtin__
savestdout = sys.stdout
out = cStringIO.StringIO()
sys.stdout = out
dh = sys.__... |
tube_loader.py | from pytube import YouTube
from tkinter import *
from tkinter.filedialog import askdirectory
from tkinter.messagebox import showinfo
from threading import *
file_size = 0
# to show the progress of download
def progress_of_download(stream=None, chunk=None, bytes_remaining=None):
global file_size
#... |
threading_semaphore_demo03.py | # -*- coding: utf-8 -*-
import threading
import time
import random
semaphore = threading.Semaphore(value=0)
def consumer():
print("consumer is waiting")
semaphore.acquire()
print("Consumer notify: consumerd item number {}".format(item))
def producer():
global item
time.sleep(10)
item = ran... |
robot.py | # This is an example program showing different methods of controlling motors, servos, and Neopixels.
# It works with a Rock Candy or PiHut PS3 controller.
# The left stick controls the speed and direction of both motors - push up to go forwards, down for backwards and left or right to steer.
# The right stick directly ... |
ShifterRunner.py | import os
from threading import Thread
from subprocess import Popen, PIPE
from select import select
class ShifterRunner:
"""
This class provides the container interface for Docker.
"""
def __init__(self, logger=None):
"""
Inputs: config dictionary, Job ID, and optional logger
... |
RicardoBackend.py | import multiprocessing
import argparse
import signal
import sys
import redis
from Interfaces import commandlineinterface
from Interfaces import flaskinterface
from RicardoHandler import serialmanager
from RicardoHandler import telemetryhandler
from RicardoHandler import telemetrylogger
# Argument Parsing
ap = argp... |
trainer.py | #!/usr/bin/env python3
########################################################################################
#
# Name: Trains a sniffer on what non-padded responses correspond to submitted
# hash prefixes.
#
# Written by Matt Weir
#
# This program is free software; you can redistribute it and/or
... |
request.py | import sys
import requests
import threading
import traceback
from lxml import etree
from photo_dl.log import log
from requests.adapters import HTTPAdapter
from photo_dl.config import headers
from photo_dl.config import timeout
from photo_dl.config import max_retries
from photo_dl.config import threads as _thread_size
... |
EncodingDataParallel.py | # -*- coding: utf-8 -*-
# @Author : DevinYang(pistonyang@gmail.com)
"""Refers to 'https://github.com/zhanghang1989/PyTorch-Encoding/blob/master/encoding/parallel.py'"""
__all__ = ['EncodingDataParallel', 'EncodingCriterionParallel']
import threading
import torch
import functools
import torch.cuda.comm as comm
from tor... |
mailbox.py | import poplib, email, re, datetime, pytz, threading, time, os, random
from django.db import models
from django.conf import settings
from urllib.parse import quote
from models import ticket, uploaded_file
class OneEmail(models.Model):
uniqueid = models.CharField("Unique ID: ", max_length=100, null=False, blank=Fal... |
lock_ex.py | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# lock_ex.py
#
# An example of using a lock to synchronize access to shared data
import threading
X = 0 # A shared Value
COUNT = 1000000
# Primarily used to synchronize threads so that only one thread can make modifications to shared data at any give... |
client.py | #-------------Boilerplate Code Start-----
import socket
from tkinter import *
from threading import Thread
import random
from PIL import ImageTk, Image
screen_width = None
screen_height = None
SERVER = None
PORT = None
IP_ADDRESS = None
playerName = None
canvas1 = None
canvas2 = None
nameEntry = None
nameWindow = ... |
Final.pyw | import multiprocessing
import os
import sys
import time
import pythoncom
import pyHook
import win32con
import win32clipboard
import win32gui
import win32ui
import wmi
def take_screenshot():
# Gather the desktop information
desktop=win32gui.GetDesktopWindow()
left, top, right, bottom=win32gui.GetWindowR... |
mirrored.py | """
Utility functions to retrieve information about available services and setting up security for the Hops platform.
These utils facilitates development by hiding complexity for programs interacting with Hops services.
"""
import os
from hops import devices, tensorboard, hdfs
from hops.experiment_impl.util import ex... |
incident_detector.py | # Copyright (c) 2021, eQualit.ie inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import logging
import threading
import time
from sqlalchemy.sql.functions import sysdate
from baskerville.db import set_up_db... |
UsbReceiver.py | import threading
import Queue
from UsbReceiver import UsbReceiver
class Cmds():
def __init__(self, normalizedVoltage, secondCommand):
self.NormalizedVoltage = normalizedVoltage
self.SecondCommand = secondCommand
class Tlm():
def __init__(self):
self.Positon = 0.0
self.Velocity ... |
runtests.py | #!/usr/bin/env python3
# vim:ts=4:sw=4:et:
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import json
import math
import multiprocessing
import os
import os.path
import r... |
parallel.py | import contextlib
import itertools
import sys
import threading
import traceback
from typing import Any, Callable, Dict, Iterator, List, Tuple, TypeVar
import pytest
from determined import core
T = TypeVar("T")
class Execution:
"""
parallel.Execution is a tool for writing easy threading-based parallel tests... |
gui.py | import tkinter as tk
from tkinter import Entry
from inter import *
import threading
class gui:
def __init__(self):
self.root = tk.Tk()
self.root.title('Problem Picker')
self.inter = inter(self)
self.buttons={}
self.labels ={}
self.tags =set()
self.tagoption = ... |
test_regrtest.py | """
Tests of regrtest.py.
Note: test_regrtest cannot be run twice in parallel.
"""
import contextlib
import glob
import io
import os.path
import platform
import re
import subprocess
import sys
import sysconfig
import tempfile
import textwrap
import time
import unittest
from test import libregrtest
from test import su... |
test_utils.py | # -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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 require... |
kb_cutadaptServer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, Inva... |
tts.py | from __future__ import annotations
import threading
import time
from queue import Queue
from typing import Callable, List, Tuple
import accessible_output2.outputs.auto
from .log import exception
class _TTS:
_end_time = None
def __init__(self, wait_delay_per_character):
self.o = accessible_output2... |
notebookapp.py | """A tornado based Jupyter notebook server."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import notebook
import asyncio
import binascii
import datetime
import errno
import functools
import gettext
import hashlib
import hmac
import importlib
import inspect
imp... |
train.py | #!/usr/bin/env python
"""Train models."""
import os
import signal
import torch
import onmt.opts as opts
import onmt.utils.distributed
from onmt.utils.misc import set_random_seed
from onmt.utils.logging import init_logger, logger
from onmt.train_single import main as single_main
from onmt.utils.parse import ArgumentPa... |
IntegrationTests.py | from __future__ import absolute_import
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import importlib
import multiprocessing
import percy
import time
import unittest
class IntegrationTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(IntegrationTests, c... |
daemon_repl.py | import os
import threading
import logging
import time
log_filename = 'logs/'+'repl.log'
logging.basicConfig(filename = log_filename,filemode = 'a',level=logging.DEBUG,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger('daemon_repl.py')
class Backup_Data:
def __init__(self):
s... |
test_concurrent_futures.py | import test.support
# Skip tests if _multiprocessing wasn't built.
test.support.import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
test.support.import_module('multiprocessing.synchronize')
from test.support.script_helper import assert_python_ok
import contextlib
import itertools
imp... |
Chap10_Example10.16.py | from threading import Thread
def disp():
print('Display function')
threadobj = Thread(target = disp) # D0
print("Before setting thread as daemon: ", threadobj.isDaemon())# D1
threadobj.setDaemon(True)# D2
print("After setting thread as daemon: ", threadobj.isDaemon())# D3
|
sublime_text.py | import os
from devops_tools.system import SYSTEM
BUILD_SYSTEM="""
{
"working_dir": "${project_path}",
"target": "statiskit",
"file_regex": "^\\\\[Build error - file \\"(...*?)\\" at line ([0-9]*), (.*)\\\\]$",
"linux":
{
"cmd": "bash -c 'source {{ prefix }}/bin/activate {{ environment }} &... |
tools.py | import click
import gzip
from json import dumps
from multiprocessing import Manager, Process
import socket
from struct import pack
from yaspin import yaspin
from util.data_looper import DataLooper
from util.data_packet import DataPacket
from workers.recorder import worker
@click.group()
def cli():
'''
Rec... |
core.py | # from IPython.core.magic import (Magics, magics_class, line_magic, cell_magic)
# Limitations:
# -> Cannot update canvas width / height by updating the global variables width / height.
# Need to use size() method or canvas object.
import threading
import time
from math import pi
import re
from IPython.display i... |
ProcessMonitor.py | import multiprocessing
from multiprocessing import Process
import logging
import time
import datetime
import subprocess
import psutil
import os
import sys
from cloudscheduler.lib.db_config import Config
class ProcessMonitor:
config = None
processes = {}
process_ids = {}
static_process_ids = {}
dyn... |
main2.py | #!/usr/bin/env python3
import argparse
from collections import Counter
from multiprocessing import set_start_method
import pdb
import re
import sys
import time
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional as F
import torch... |
run_video_cap_service.py | import pathlib
import subprocess
import time
import os
import sys
import logging
import threading
from service import registry
logging.basicConfig(level=10, format="%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s")
log = logging.getLogger("run_video_cap")
def main():
root_path = pathlib.Path(__file__).... |
results_2_07_code.py | import tensorflow as tf
from tensorflow.keras.layers import Dense, Conv2D, MaxPooling2D, Dropout, Flatten
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.callbacks import Callback
import numpy as np
import matplotlib.pyplot as plt
f... |
test_engine_py3k.py | import asyncio
import inspect as stdlib_inspect
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import delete
from sqlalchemy import event
from sqlalchemy import exc
from sqlalchemy import func
from sqlalchemy import inspect
from sqlalchemy import Integer
from sqlalchemy import selec... |
__init__.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from sys import path
from pathlib import Path
from sys import argv
from nsz.nut import Print
from os import listdir, _exit, remove
from time import sleep
from nsz.Fs import Nsp, Hfs0, factory
from nsz.BlockCompressor import blockCompress
from nsz.SolidCompressor import s... |
test_mvar.py | # Copyright (c) 2018 Gabriele Baldoni.
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/l... |
project.py | import datetime
import time
import wikipedia
import webbrowser
from multiprocessing import Process
class userinput():
def time(self):
hour = int(datetime.datetime.now().hour)
if hour >= 0 and hour < 12:
print("Good Morning Sir")
... |
testing.py | import os, sys
import argparse
MY_PATH = os.path.dirname(os.path.abspath(__file__))
if __name__ == '__main__':
# path = os.path.join(train.DEFAULT_DATA_PATH, 'emnist')
# torchvision.datasets.EMNIST(path, split='letters', download=True, train=True)
# mp.freeze_support()
#... |
virtual_mirror_tristan_node.py | #!/usr/bin/env python
import rospy
import cv2
from cv_bridge import CvBridge, CvBridgeError
from sensor_msgs.msg import CompressedImage, Image
from duckietown_msgs_tristan.msg import FlipDirection
import numpy as np
import threading
class VirtualMirrorNode(object):
def __init__(self):
self.node_name = "Vir... |
ddos_attack.py | """
ddos_attack.py
- This script is used to demo a distributed denial of service attack
- Pytest along with several other copies of this script can be used to achieve a larger load
> pytest -n 10 # 10 being the number of scripts/workers
"""
import socket
import threading
# IP address of the ta... |
anti_debug.py | import os
import sys
import time
import httpx
import winreg
import psutil
import threading
import subprocess
class AntiDebug:
inVM = False
def __init__(self):
self.running = True
self.processes = list()
self.blackListedPrograms = ["httpdebuggerui.exe","wireshark.exe","fiddler.exe","reg... |
StepperMotor.py | ##################################
## Author: Jakub Tomaszewski ##
## Stepper Motor Control Class ##
## Company: A4BEE ##
##################################
import subprocess
import yaml
import time
from threading import Thread
import logging
class stepper_motor:
def __init__(self, mapping_value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.