source
stringlengths
3
86
python
stringlengths
75
1.04M
runner.py
import glob from queue import Queue from threading import Thread import pandas as pd import torch from tqdm import tqdm import os parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.sys.path.insert(0,parentdir) from training.model import BaselineModel class ParallelExperimentRunner: def...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
crop_image.py
import os import numpy as np from PIL import Image from multiprocessing import Process, Value counter = Value('i', 0) SOURCE = '/home/arthur/Programs/datasets/ISIC_2017_RESIZED/ISIC_2017_TEST' DESTINATION = '/home/arthur/Programs/datasets/ISIC_2017_RESIZED/ISIC_2017_TEST' def chunkIt(seq, num): avg = len(seq) / ...
SPOR_BASIC_4.py
#!/usr/bin/env python3 import sys import os import time import subprocess from itertools import product from threading import Thread import TEST import TEST_FIO import TEST_LIB import TEST_LOG import TEST_SETUP_POS arrayId = 0 volId = 1 current_test = 0 run_time = 0 ################################################...
jupyter_notebook_config.py
# Configuration file for jupyter-notebook. #------------------------------------------------------------------------------ # Application(SingletonConfigurable) configuration #------------------------------------------------------------------------------ ## This is an application. ## The date format used by logging f...
youtube-dl.py
# Import Required Modules import tkinter as tk from pyyoutube import Api from pytube import YouTube from threading import Thread from tkinter import messagebox from decouple import config def get_list_videos(): global playlist_item_by_id # Clear ListBox list_box.delete(0, "end") # Create API Object ...
StartScan.py
import threading import time import os import sys import bluetooth._bluetooth as bluez import wifi import base64 import paho.mqtt.client as mqtt import socket import csv import json import random import struct os.system('sudo systemctl start bluetooth') ################################################################...
common.py
"""Test the helper method for writing tests.""" from __future__ import annotations import asyncio import collections from collections import OrderedDict from contextlib import contextmanager from datetime import datetime, timedelta import functools as ft from io import StringIO import json import logging import os imp...
test_radius.py
# RADIUS tests # Copyright (c) 2013-2016, Jouni Malinen <j@w1.fi> # # This software may be distributed under the terms of the BSD license. # See README for more details. from remotehost import remote_compatible import binascii import hashlib import hmac import logging logger = logging.getLogger() import os import sele...
prepare_data.py
''' Pre-processing: prepare_data in LPD-Net generate KNN neighborhoods and calculate feature as the feature matrix of point Reference: LPD-Net: 3D Point Cloud Learning for Large-Scale Place Recognition and Environment Analysis, ICCV 2019 author: Chuanzhe Suo(suo_ivy@foxmail.com) created: 10/26/18 ''' import os i...
replay_logs.py
import multiprocessing import math import pandas import visdom # find $directory -type f -name "*.in" class LogParser(object): def __init__(self, file_path): self._file_path = file_path @staticmethod def chunks(l, n): return [l[i:i + n] for i in range(0, len(l), n)] def _do_job(sel...
signal.py
from multiprocessing import Process, Queue import os, time, random def write(q): for value in ['A', 'B', 'C']: print 'Put %s to queue...' % value q.put(value) time.sleep(random.random()) def read(q): while True: value = q.get(True) print 'Get %s from queue.' % value if...
test_debug.py
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
observable.py
from collections import defaultdict, deque from queue import Queue, Empty from threading import Thread, Lock import sys import threading import time import traceback _EVENT_HISTORY_LENGTH = 8 _DEBUG_EVENTS = True main_event_queue = Queue() class Event: def __init__(self, *, source, name, args=[], kwargs={}, trac...
threadutils.py
# Copyright 2016 VMware, 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 law or a...
bank_account_test.py
import sys import threading import time import unittest from bank_account import BankAccount class BankAccountTest(unittest.TestCase): def test_newly_opened_account_has_zero_balance(self): account = BankAccount() account.open() self.assertEqual(account.get_balance(), 0) def test_can_...
consumers.py
"""Django Channel consumers (for forwarding data only).""" from channels.generic.websocket import WebsocketConsumer import websocket import threading from django.conf import settings from .models import Container class TunnelConsumer(WebsocketConsumer): """Setup tunnel to the websocket behind the proxy.""" ...
test.py
from time import sleep import socket import threading '''import dominate def create_doc(): doc = dominate.document(title="My favorite page") with doc: with tags.div(): tags.attr(cls="body") tags.p("lorem ipsum") ''' def echo_server(host, port): with socket.socket() as s: ...
motiontracker_tcp.py
"""Bluetooth motion tracker module. Copyright 2017 Mark Mitterdorfer Class to read from a Bluetooth MPU6050 device. Obtain acceleration, angular velocity, angle and temperature """ import threading import socket import re class MotionTracker(object): """Class to track movement from TCP Mobile device. """ ...
flaskserver.py
# -*- coding: cp1252 -*- #Copyright Milkey Mouse 2015 from multiprocessing.managers import BaseManager from HTMLParser import HTMLParser from flask import render_template from flask.ext.gzip import Gzip from celery import Celery from celery import task from flask import request from celery.task.control import inspect i...
getting_started.py
import threading def my_func(thread_number): print(f"my_func called by thread N°{thread_number}") def main(): threads = [] for i in range(10): t = threading.Thread(target=my_func, args=(i,)) threads.append(t) t.start() t.join() if __name__ == "__main__": main() ...
test_rest_v2_0_0.py
import json import os import random import string import subprocess import sys import time import unittest from multiprocessing import Process import requests from dateutil.parser import parse from test.apiv2.rest_api import Podman PODMAN_URL = "http://localhost:8080" def _url(path): return PODMAN_URL + "/v2.0...
io.py
# coding: utf-8 # pylint: disable=invalid-name, protected-access, fixme, too-many-arguments, W0221, W0201, no-self-use, no-member """NDArray interface of mxnet""" from __future__ import absolute_import from collections import OrderedDict, namedtuple import re import sys import ctypes import logging import threading i...
server.py
# -*- coding: utf-8 -*- # Python module: ModbusServer class (ModBus/TCP Server) from . import constants as const from .utils import test_bit, set_bit import socket import struct from threading import Lock, Thread # for python2 compatibility try: from socketserver import BaseRequestHandler, ThreadingTCPServer exc...
mcafee_esm_case_polling.py
# -*- coding: utf-8 -*- # pragma pylint: disable=unused-argument, no-self-use # (c) Copyright IBM Corp. 2010, 2020. All Rights Reserved. """Polling implementation""" import logging import time import json import calendar import jinja2 from datetime import datetime from threading import Thread from os.path import join,...
indicator.py
#!/usr/bin/env python try: import RPi.GPIO as GPIO except Exception as e: GPIO = None import time import os import apa102 import time import yaml import threading import numpy from gpiozero import LED try: import queue as Queue except ImportError: import Queue as Queue audiosetup='' ROOT_PATH = os.p...
mecanum_bot_controller.py
#! /usr/bin/env python3 import sys import serial import threading from time import sleep import numpy as np import tf2_ros import rclpy from rclpy.node import Node from rclpy.qos import qos_profile_system_default from rclpy.qos import qos_profile_services_default from geometry_msgs.msg import TransformStamped from ...
test_telnetlib.py
import socket import select import threading import telnetlib import time import contextlib from unittest import TestCase from test import support HOST = support.HOST def server(evt, serv): serv.listen(5) evt.set() try: conn, addr = serv.accept() except socket.timeout: pass finall...
scylla-artifacts.py
#!/usr/bin/python import os import re import logging import threading from pkg_resources import parse_version from avocado import Test from avocado import main from avocado.utils import distro from avocado.utils import process from avocado.utils import path from avocado.utils import service from avocado.utils import ...
thumb_pdf.py
""" Use imagemagick to convert all pfds to a sequence of thumbnail images requires: sudo apt-get install imagemagick """ import datetime import os, sys import threading import time import shutil from subprocess import Popen from utils import Config, get_left_time_str def create_thumbnail(thread_number, pdf_path, thu...
api_music.py
import aiohttp, json, re, os, uuid, math, urllib, threading, re import http.cookiejar as HC from .shaonianzhentan import fetch_info, fetch_json from homeassistant.helpers.network import get_url # 全局请求头 HEADERS = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55....
multi_processing.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from multiprocessing import Process import os # 子进程要执行的代码 def run_proc(name): print('Run child process %s (%s)...' % (name, os.getpid())) if __name__ == '__main__': print('Parent process %s.' % os.getpid()) p = Process(target=run_proc, args=('test',)) ...
massban.py
from py_compile import _get_default_invalidation_mode import threading, queue, random from requests_futures.sessions import FuturesSession import discum class banclass: def __init__(self, user, guild, channel): self.user = user self.guild = guild self.channel = channel d...
test_storage.py
# Copyright 2019 The KRules 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 writing,...
rdd.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
camerareceiver.py
# Copyright (c) 2019, Bosch Engineering Center Cluj and BFMC organizers # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright notice, ...
del_vlc_log.py
import os from sys import platform def RemoveWinVlcLogFiles(*args): ''' Removes all VLC log files within pyradio config directory on Windows. Files currently in use will not be deleted. ''' if platform.startswith('win'): adir = args[0] # print('config = "{}"'.format(adir))...
cleanup.py
""" sentry.runner.commands.cleanup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import, print_function from datetime import timedelta from uuid import uuid4 import click from djan...
channel_handler.py
"""presenter channel manager module""" # -*- coding: UTF-8 -*- # # ======================================================================= # # Copyright (C) 2018, Hisilicon Technologies Co., Ltd. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted...
process_test.py
# -*- coding: utf-8 -*- import unittest import numpy as np from multiprocessing import Process, Pipe import os, sys sys.path.insert(0, os.getcwd()) import rodentia COMMAND_ACTION = 0 COMMAND_TERMINATE = 1 def worker(conn): env = rodentia.Environment(width=84, height=84, bg_color...
main.py
# -*- coding: utf-8 -*- import sentry_sdk import logging from logzero import logger as log from sentry_sdk.integrations.logging import LoggingIntegration from telegram.ext import Updater, JobQueue from telegram.utils.request import Request import appglobals import routing import settings from components import admin...
test_dispatcher.py
from __future__ import print_function, division, absolute_import import errno import multiprocessing import os import shutil import subprocess import sys import threading import warnings import inspect import numpy as np from numba import unittest_support as unittest from numba import utils, jit, generated_jit, type...
server.py
""" Support for a local MQTT broker. For more details about this component, please refer to the documentation at https://home-assistant.io/components/mqtt/#use-the-embedded-broker """ import asyncio import logging import tempfile import threading from homeassistant.components.mqtt import PROTOCOL_311 from homeassista...
testrunner.py
#!/usr/bin/env python3 import base64 import gzip from http.client import BadStatusLine import os import urllib.request, urllib.error, urllib.parse import sys import threading from os.path import basename, splitext from multiprocessing import Process from pprint import pprint sys.path = ["lib", "pytests", "pysystests"]...
ui_tests.py
# -*- coding: utf-8 -*- """Tests for the user interface.""" # # (C) Pywikibot team, 2008-2020 # # Distributed under the terms of the MIT license. # # NOTE FOR RUNNING WINDOWS UI TESTS # # Windows UI tests have to be run using the tests\ui_tests.bat helper script. # This will set PYTHONPATH and PYWIKIBOT_DIR, and then r...
h2o_objects.py
import sys, getpass, os, psutil, time, requests, errno, threading, inspect, shlex import h2o_os_util, h2o_print as h2p, h2o_args import h2o_nodes from h2o_test import \ tmp_dir, tmp_file, flatfile_pathname, spawn_cmd, find_file, verboseprint, \ dump_json, log, check_sandbox_for_errors import json, platform, re ...
raw_frame_scene.py
# from @RY-Givenchy # # Copyright: 2020 niedong # Raw frame operation scene for manim # from manimlib.scene.scene import Scene from manimlib.constants import * import threading import time class RawFrameScene(Scene): CONFIG = { "num_frames": 0, "msg_flag": True } def write_frame(self, f...
Code-01-Single_thread_program_execution.py
''' DEVELOPER NAME : BALAVIGNESH.M IMPLEMENTED DATE: 16-11-2018 ''' import threading class SingleThread: @staticmethod def ExtraInfo(): print("Mark Antony is the next Emprorer of the Rome") single = SingleThread() s = threading.Thread(target = single.ExtraInfo()) s.start()
search_short_ids.py
# -*- coding: utf-8 -*- """ This module holds functions capable of scrap resuling shortIds of a query into the lattes curriculum database. It is known that we need those shortIds in order to get the longIds, which we need to get the xml curriculum. """ import re import time import datetime import requests import argpar...
movie.py
#A* ------------------------------------------------------------------- #B* This file contains source code for the PyMOL computer program #C* Copyright (c) Schrodinger, LLC. #D* ------------------------------------------------------------------- #E* It is unlawful to modify or remove this copyright notice. #F* -------...
bouncing_ball_v3.py
import pygame import threading from empty_display import EmptyDisplay import lib.colors as Color WIDTH = 0 HEIGHT = 1 class Ball(pygame.sprite.Sprite): def __init__(self, color, width, height, initial_x_coordinate, initial_y_coo...
__init__.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
test_socket.py
import unittest from test import support from test.support import os_helper from test.support import socket_helper from test.support import threading_helper import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform...
high-level-test.py
#!/usr/bin/python3 import argparse import datetime import os import threading import time import sqlite3 import sys from collections import defaultdict from configobj import ConfigObj from multiprocessing.pool import ThreadPool from socket import gethostname import testutils # watches file growth for the files in i...
sdk_worker_main.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
v1_test_rest_v1_0_0.py
import json import os import shlex import signal import string import subprocess import sys import time import unittest from collections.abc import Iterable from multiprocessing import Process import requests from dateutil.parser import parse PODMAN_URL = "http://localhost:8080" def _url(path): return PODMAN_UR...
02-Real-Time.py
# Databricks notebook source # MAGIC %md-sandbox # MAGIC # MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;"> # MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px"> # MAGIC </div> # COMMAND ---------- # M...
server.py
# Server class for server-client mode import socket import time import os import threading import signal from dave.common.davelogger import DaVELogger from dave.common.misc import make_dir, get_dirname from dave.mprobo.environ import EnvFileLoc #---------------------------------- class mProboServer(object): ''' ...
web_app.py
import logging import click from flask import Flask from threading import Thread def secho(text, file=None, nl=None, err=None, color=None, **styles): pass def echo(text, file=None, nl=None, err=None, color=None, **styles): pass click.echo = echo click.secho = secho log_flask = logging.getLogger('werkzeug') log...
main.py
from concurrent.futures import ThreadPoolExecutor, as_completed from multiprocessing import Process, Queue import queue import logging from src.address_validators_testing_util.settings import LOGGING_CONFIG from src.address_validators_testing_util.validator_tester import ValidatorTester logging.config.dictConfig(LOGG...
stl_capture_test.py
#!/router/bin/python from .stl_general_test import CStlGeneral_Test, CTRexScenario from trex_stl_lib.api import * import os, sys import pprint import zmq import threading import time import tempfile import socket from scapy.utils import RawPcapReader from nose.tools import assert_raises, nottest def ip2num (ip_str): ...
momr_run_manager.py
import os import queue import time import momr_udp_server from concurrent.futures import ThreadPoolExecutor import threading import momr import configparser import tkinter as tk from tkinter import ttk from tkinter import messagebox class MomrManager(threading.Thread): def __init__(self): threading.Thread...
Tarea1.py
import threading import random import time #Maximo de sillas que se desea tener en el cubiculo sillas= 5 #Maximo de dudas que se desea que tenga un alumno maximo_dudas=3 #Lista que guardara a los alumnos alumnos_con_dudas = [] #Lista que guardara el numero de dudas que tiene cada alumno lista_dudas=[] #Mutex que u...
net_scheme1.py
import tensorflow as tf import numpy as np import cv2 from threading import Thread #import ipdb #------------------------------------------------------------------------------- def smooth_l1_loss(x): square_loss = 0.5*x**2 absolute_loss = tf.abs(x) return tf.where(tf.less(absolute_loss, 1.), square_loss...
plugin_event_multiplexer.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...
ranking.py
import datacommons as dc import json import urllib import sys import threading import os.path threadedp = False US_dcid = "country/USA" statVarConfig = None allStatVars = [] def readVars (file): f = open(file) jsstr = f.read() f.close() statVarConfig = json.loads(jsstr) for svc in statVarConfig: ...
optimizer_tcp_manager.py
import yaml import os import subprocess import socket import json import logging import time import math import pkg_resources from threading import Thread from retry import retry from .solver_response import SolverResponse class OptimizerTcpManager: """Client for TCP interface of parametric optimizers This c...
parcel_id_extractor.py
# -*- coding: utf-8 -*- import os import threading from queue import Queue from string import ascii_uppercase, digits import requests from bs4 import BeautifulSoup SEARCH_URL = "http://qpublic9.qpublic.net/la_orleans_alsearch.php?" \ "searchType=owner_name&INPUT={}&BEGIN={}" Q = Queue() class ParcelI...
tests.py
# Unit tests for cache framework # Uses whatever cache backend is set in the test settings file. import copy import io import os import pickle import re import shutil import tempfile import threading import time import unittest from unittest import mock from django.conf import settings from django.core ...
TestPooledPg.py
"""Test the PooledPg module. Note: We don't test performance here, so the test does not predicate whether PooledPg actually will help in improving performance or not. We also assume that the underlying SteadyPg connections are tested. Copyright and credit info: * This test was contributed by Christoph Zwerschke """...
main.py
# ============================================================================================ # MIT License # Copyright (c) 2020 Konstantinos Bourantas # 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 th...
scaler.py
""" Central component of this autoscaling system. @author: fernandez """ import math from time import time, sleep from conpaas.services.webservers.manager.autoscaling import log from conpaas.services.webservers.manager.autoscaling.performance import StatUtils from conpaas.services.webservers.manager.autoscaling.cost...
parallel.py
import os import sys import glob import time from multiprocessing import Process import random import subprocess import shlex from pathlib import Path #You don't really need this file, unless you are trying to run the translation in parallel def split_file(num_of_files, input_file): f = open(input_file, encodin...
classifier_rpc_worker_subsets_with_multiproc_single_image.py
"""An example of how to use your own dataset to train a classifier that recognizes people. """ # MIT License # # Copyright (c) 2016 David Sandberg # # 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 S...
base.py
#!/usr/bin/env python # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
__init__.py
from .conf import settings from .conf import inputConfiguration from .mainprocessor import MainProcessor import os import sys import logging from . import fileutils import subprocess import threading import datetime from lxml import etree import urllib from pyramid.request import Request from pyramid.response import Re...
multiprocessinglog.py
from logging.handlers import RotatingFileHandler import multiprocessing, threading, logging, sys, traceback class MultiProcessingLog(logging.Handler): def __init__(self, filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=0): logging.Handler.__init__(self) # In case our call to Ro...
region.py
from __future__ import with_statement from .. import Lock, NeedRegenerationException from ..util import NameRegistry from . import exception from ..util import PluginLoader, memoized_property, coerce_string_conf from .util import function_key_generator, function_multi_key_generator from .api import NO_VALUE, CachedValu...
test_random.py
from __future__ import division, absolute_import, print_function import warnings import numpy as np from numpy.testing import ( assert_, assert_raises, assert_equal, assert_warns, assert_no_warnings, assert_array_equal, assert_array_almost_equal, suppress_warnings ) from numpy import ra...
main.py
import pdb import time import os import subprocess import re import random import json import numpy as np import glob from tensorboard.backend.event_processing.event_accumulator import EventAccumulator import socket import argparse import threading import _thread import signal from datetime import datetime import csv ...
test_upload.py
import unittest import requests from tests.utils import get_complex_replay_list, download_replay_discord LOCAL_URL = 'http://localhost:8000' class RunningServerTest(unittest.TestCase): replay_status = [] @classmethod def setUpClass(cls): pass # start_server() # cls.thread = Thre...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable from PyQt5.QtCore import QRect, QEventLoo...
HarmonyHub.py
import polyinterface,sys,logging,yaml,re from traceback import format_exception from threading import Thread,Event from harmony_hub_nodes import HarmonyDevice,HarmonyActivity from harmony_hub_funcs import ip2long,long2ip,get_valid_node_name,get_file from pyharmony import client as harmony_client from sleekxmpp.excepti...
main.py
import time #from multiprocessing import Pool #from multiprocessing import freeze_support from threading import Thread import numpy as np import random import win32gui, win32con CONFIGFILE = '.\lwp.conf' class DriftWords: def __init__(self): self.Words = [] self.Coors = [] self...
processor_gtos.py
import logging from threading import Thread from ..models.model_factory import load_inference_model from ..graph_processing.amr_loading import split_amr_meta logger = logging.getLogger(__name__) class ProcessorGTOS(object): def __init__(self, config, disabled=False): self.model_dir = config['gtos...
rest_primitives.py
# Licensed Materials - Property of IBM # Copyright IBM Corp. 2016,2017 import logging import requests import queue import threading import time import json import re from pprint import pprint, pformat from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(In...
y_cable_helper.py
""" y_cable_helper.py helper utlities configuring y_cable for xcvrd daemon """ import datetime import os import re import threading from importlib import import_module from sonic_py_common import daemon_base, logger from sonic_py_common import multi_asic from sonic_y_cable import y_cable_vendor_mapping from ...
test_html.py
from functools import partial from importlib import reload from io import BytesIO, StringIO import os from pathlib import Path import re import threading from urllib.error import URLError import numpy as np import pytest from pandas.compat import is_platform_windows from pandas.errors import ParserError import pandas...
run_unittests.py
#!/usr/bin/env python3 # Copyright 2016-2017 The Meson development team # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by ...
tarea1.py
import time from random import randint, random, uniform from threading import Semaphore, Thread semaf = Semaphore(0) # Inicializamos semáforo en 1 mutex = Semaphore(0) # Inicializamos semáforo en 1 def semaforo(semaf, color): # while True: if color == 0: # 0 es rojo print("semaforo en rojo") ...
SqlLogger.py
from datetime import datetime from multiprocessing.context import Process from injector import inject from infrastructor.IocManager import IocManager from infrastructor.data.DatabaseSessionManager import DatabaseSessionManager from infrastructor.data.Repository import Repository from infrastructor.dependency.scopes im...
test_sources.py
# # Runtime Tests for Source Modules # import contextlib import ctypes import http.server import json import os import socketserver import subprocess import tempfile import threading import pytest import osbuild.objectstore import osbuild.meta import osbuild.sources from osbuild import host from .. import test def...
installwizard.py
# Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import os import sys import threading import traceback from typing import Tuple, List, Callable, NamedTuple, Optional from PyQt5.QtCore i...
test_decimal.py
# Copyright (c) 2004 Python Software Foundation. # All rights reserved. # Written by Eric Price <eprice at tjhsst.edu> # and Facundo Batista <facundo at taniquetil.com.ar> # and Raymond Hettinger <python at rcn.com> # and Aahz (aahz at pobox.com) # and Tim Peters """ These are the test cases for the Decim...
process.py
import youtube_dl import os import threading import logging import json import requests import hot logger = logging.getLogger("RaspberryCast") volume = 0 def launchvideo(url, config, sub=False): setState("2") os.system("echo -n q > /tmp/cmd &") # Kill previous instance of OMX if config["new_log"]: ...
mp_classify.py
#!/usr/bin/env python # Copyright 2019 Xilinx Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
core.py
import os import sys import warnings from threading import Thread from contextlib import suppress from astropy import units as u from panoptes.pocs.base import PanBase from panoptes.pocs.observatory import Observatory from panoptes.pocs.state.machine import PanStateMachine from panoptes.utils import current_time from...
test_flush.py
import time import pdb import threading import logging from multiprocessing import Pool, Process import pytest from milvus import IndexType, MetricType from utils import * dim = 128 index_file_size = 10 collection_id = "test_flush" DELETE_TIMEOUT = 60 nprobe = 1 tag = "1970-01-01" top_k = 1 nb = 6000 tag = "partition...
kernel.py
from queue import Queue from threading import Thread from ipykernel.kernelbase import Kernel import re import subprocess import tempfile import os import os.path as path class RealTimeSubprocess(subprocess.Popen): """ A subprocess that allows to read its stdout and stderr in real time """ def __init...
c41_attack_rsa_unpadded_message_recovery.py
#!/usr/bin/env python3 # # Implement unpadded message recovery oracle # # Nate Lawson says we should stop calling it "RSA padding" and start calling # it "RSA armoring". Here's why. # # Imagine a web application, again with the Javascript encryption, taking # RSA-encrypted messages which (again: Javascript) aren't padd...