source
stringlengths
3
86
python
stringlengths
75
1.04M
kahip.py
''' Run Kahip with input knn graph to produce graph partition. Create DataNodes from Kahip results. Many functionalities here are superceded by kmkahip.py. ''' import _init_paths import sys import os import os.path as osp import create_graph import torch #torch.multiprocessing.set_start_method("spawn") import numpy as...
sensor.py
from pms5003 import PMS5003 import pandas as pd import time from multiprocessing import Process import os from generate_sound import * if __name__ == '__main__': print("Read and sonify PM data. Press Ctrl+C to exit!") # Configure the PMS5003 for Enviro+ pms5003 = PMS5003( device='/dev/ttyAMA0', ...
virtualIotDevice.py
import mcrpc import os from dotenv import load_dotenv import re from flask import Flask, request from flask_restful import Resource, Api, reqparse import ast import random import time import threading #create IoT class class iot: #define class initiation def __init__(self): #initiate sensors list ...
__init__.py
from threading import Thread import requests from requests.auth import HTTPBasicAuth import logging import contextlib try: from http.client import HTTPConnection # py3 except ImportError: from httplib import HTTPConnection # py2 class APIException(Exception): def __init__(self, status, message='Unknown HTTP Err...
oauth.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import time import uuid import string import codecs import logging import threading # pylint: disable=import-error from six.moves.urllib.parse import urlparse, parse_qs from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer fr...
rcmd.py
import paramiko import sys import getpass import os from threading import Thread def rcmd(host, passwd, cmd, user='root', port=22): ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(host, username=user, password=passwd, port=port) stdin, stdout, stderr = s...
advanced_client.py
import multiprocessing from hurricane import SlaveNode def run_node(): client = SlaveNode(debug=True, master_node='127.0.0.1') client.initialize() client.wait_for_initialize() while True: task_data = client.wait_for_task() print("[*] Task name: " + str(task_data["name"])) clie...
web_agent.py
import logging import time import threading import queue import json import copy import socket import mimetypes import chess import chess.pgn from flask import Flask, send_from_directory from flask_sockets import Sockets from gevent import pywsgi from geventwebsocket.handler import WebSocketHandler mimetypes.add_ty...
features.py
""" Features """ import collections import gensim import glove import itertools import json import math import logging import nltk import numpy as np import os import pandas import re import sh import string import sys import tempfile import threading import urllib from more_itertools import chunked, pairwise from que...
app.py
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
users.py
from flask import Blueprint, redirect, url_for, render_template, flash, request, current_app from flask_login import current_user, login_required, login_user, logout_user from .. import bcrypt, hashing from ..forms import SearchForm, UpdatePasswordForm, LoginForm, RegisterForm, ChangeUserLevelForm, DeleteUserForm, Sub...
app.py
from __future__ import absolute_import import logging import os import threading import zmq from pymisp import PyMISP from dxlbootstrap.app import Application from dxlclient import ServiceRegistrationInfo from dxlclient.message import Event from dxlmispservice._requesthandlers import MispServiceRequestCallback # Conf...
test_rsocket.py
import py, errno, sys from rpython.rlib import rsocket from rpython.rlib.rsocket import * import socket as cpy_socket from rpython.translator.c.test.test_genc import compile def setup_module(mod): rsocket_startup() def test_ipv4_addr(): a = INETAddress("localhost", 4000) assert a.get_host() == "127.0.0.1...
face2rec2.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
test.py
import json import os.path as p import random import socket import threading import time import logging import io import string import avro.schema import avro.io import avro.datafile from confluent_kafka.avro.cached_schema_registry_client import CachedSchemaRegistryClient from confluent_kafka.avro.serializer.message_s...
docker_beacon_scan_flask.py
""" CONFIG """ TIME_SCAN = 5 NAME_FILE_BEACON = "json_beacon_scan.json" """ Clases """ # https://github.com/bowdentheo/BLE-Beacon-Scanner class Beacon_Obj(object): mac = str() rssi = int() uuid = str() tx_power = int() major = int() minor = int() tipo = str() empresa = str() ...
eeg.py
# -*- coding: utf8 -*- # # CyKIT v2 - 2018.Jan.29 # ======================== # Emokit Written by Cody Brocious # Emokit Written by Kyle Machulis # CyKIT Written by Warren # Contributions by Severin Lemaignan # Contributions by Sharif Olorin # Contributions by Bill Schumacher # Contributions by CaptainSmiley # imp...
ParametrizeCamera_FileAccess.py
# -- coding: utf-8 -- import time import sys import threading import msvcrt from ctypes import * sys.path.append("../MvImport") from MvCameraControl_class import * # 为ProgressThread线程定义一个函数 def progress_thread(cam=0, nMode=0): stFileAccessProgress = MV_CC_FILE_ACCESS_PROGRESS() memset(byref(stFileAccessProg...
API.py
from .classes import Authentication, Device_Keys_Response, Event, Room_Preset, State, User from .parsers import parse_event, parse_room_events, parse_state, parse_device_keys_response from .e2ee import Olm from .exceptions import * from typing import Any, Dict, List, Mapping import threading import requests from time i...
sublist3r.py
# modules in standard library import re import sys import os import time import hashlib import random import multiprocessing import threading import socket import json from collections import Counter import urllib.parse as urlparse import urllib.parse as urllib # external modules from subdomain import ...
callbacks_test.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...
syn_scan.py
""" Continuously sends out SYN packets. """ import itertools import random import scapy.all as sc import threading import time from host_state import HostState from parse_available_ports import get_port_list import utils # pylint: disable=no-member SYN_SCAN_SOURCE_PORT = 44444 SYN_SCAN_SEQ_NUM = 44444 class Syn...
tests.py
############################################################################## # # Copyright (c) 2004 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
schedules.py
import os, sys, time, datetime import threading import django base_apth = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # print(base_apth) # 将项目路径加入到系统path中,这样在导入模型等模块时就不会报模块找不到了 sys.path.append(base_apth) os.environ['DJANGO_SETTINGS_MODULE'] ='base_django_api.settings' django.setup() fro...
GetData.py
import requests import threading import queue import bs4 import time import codecs import DataBaseManager import winsound cityListO = codecs.open("CityList.info","r","utf-8") cityList = [item.strip('\r') for item in cityListO.read().split('\n')] cityListO.close() DataBase = DataBaseManager.DBHandler("DATA...
graphicsCrawlerDisplay.py
# graphicsCrawlerDisplay.py # ------------------------- # Licensing Information: Please do not distribute or publish solutions to this # project. You are free to use and extend these projects for educational # purposes. The Pacman AI projects were developed at UC Berkeley, primarily by # John DeNero (denero@cs.berkeley...
multiple_client_windows.py
# coding=utf-8 """ filename: multiple_client_windows.py author: zhancongc@icloud.com description: 多客户端架构 """ import sys import time import Queue import select import threading import importlib import configparser import multiprocessing sys.path.append("..") from app.utils.login_handler import ProtocolDict from app.util...
sdk_worker.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...
Scale.py
import serial import itertools from typing import List, Tuple, Union, Deque from collections import deque from threading import Thread, Event import time from asyncio import sleep import logging from datetime import datetime from serial.serialutil import PARITY_EVEN from vosekast_control.Log import LOGGER from random i...
main.py
import urllib.request import datetime import threading import os import shutil import requests from bs4 import BeautifulSoup ARG_TYPES = [ 'Affirmatives', 'Case Negatives', 'Counterplans', 'Disadvantages', 'Impact Files', 'Kritik Answers', 'Kritiks', 'Politics', 'Theory', 'Topic...
scheduler_job.py
# pylint: disable=no-name-in-module # # 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, Versio...
test_concurrent_futures.py
from test import support # Skip tests if _multiprocessing wasn't built. support.import_module('_multiprocessing') # Skip tests if sem_open implementation is broken. support.skip_if_broken_multiprocessing_synchronize() from test.support import hashlib_helper from test.support.script_helper import assert_python_ok imp...
client.py
__version__ = '0.0.1' import os.path import urllib.parse import urllib.request, urllib.parse, urllib.error from threading import Thread, RLock import logging logger = logging.getLogger('onvif') logging.basicConfig(level=logging.INFO) logging.getLogger('suds.client').setLevel(logging.CRITICAL) import suds.sudsobject ...
dispatcher.py
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2018 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
test_event_based_scheduler.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
rabbitplus.py
def _async_call(fn): """ 内部异步调用 :param fn: :return: """ import threading def wrapper(*args, **kwargs): threading.Thread(target=fn, args=args, kwargs=kwargs).start() return wrapper class RabbitConsumer: """ RabbitMQ Simple Consumer """ def __init__(self, host:...
versionupdater.py
import time import pythoncom import pywintypes from manuallogin import * from PyQt5 import QtWidgets from multiprocessing import Process from PyQt5.QAxContainer import QAxWidget sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__)))) from utility.setting import OPENAPI_PATH class Window(QtWidgets...
multiprocessing__Tkinter__in_other_process.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' def go(name): import tkinter as tk app = tk.Tk() app.minsize(150, 50) mw = tk.Label(app, text='Hello, ' + name) mw.pack(fill='both', expand=True) app.mainloop() if __name__ == '__main__': from multiprocessing impor...
camect.py
# Based on https://github.com/camect/camect-py # Modified from the original to work with Python 2 and Indigo import base64 import json import logging import ssl import sys import time import requests import websocket import threading requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.Ins...
test_client.py
# -*- mode: python -*- """pdb-attach tests for client API.""" from __future__ import unicode_literals import errno import signal import socket from multiprocessing import Process, Queue try: import queue except ImportError: import Queue as queue try: from test.support.socket_helper import find_unused_por...
rqt_carla_control.py
#!/usr/bin/env python # # Copyright (c) 2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. # """ RQT Plugin to control CARLA """ import os import threading from python_qt_binding import loadUi # pylint: disable=import-error fr...
main.py
import requests import json import pyttsx3 # text to audio import speech_recognition as sr import re import threading import time from datetime import date from datetime import datetime api_key = "tV3nQTyNdwgG" project_token = "tXhAMN_ZBbPh" run_toker = "tT5p-PGTeFtb" alreadyUpdated = False dateUpdated = date(2021, ...
traybar.py
import os from .win32_adapter import * import threading import uuid class SysTrayIcon(object): """ menu_options: tuple of tuples (menu text, menu icon path or None, function name) menu text and tray hover text should be Unicode hover_text length is limited to 128; longer text will be truncat...
get-panw-config.py
#!/usr/bin/env python3 ''' Remove nargs='*' from firewalls arg and split to make compatible with Golang calls and Comment out stdin.isatty() code block ''' '''Get firewall configuration get_panw_config.py Author: David Cruz (davidcruz72@gmail.com) Python version >= 3.6 Required Python packages: Netmiko F...
_runner.py
# Copyright 2015 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 writing...
fgoGui.py
import json,os,sys from threading import Thread from PyQt6.QtCore import Qt,pyqtSignal from PyQt6.QtGui import QAction from PyQt6.QtWidgets import QApplication,QInputDialog,QMainWindow,QMenu,QMessageBox,QStyle,QSystemTrayIcon import fgoKernel from fgoIniParser import IniParser from fgoMainWindow import Ui_fgoMainWindo...
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...
run_point.py
import multiprocessing as mp import sys import tigl3.configuration import tigl3.tigl3wrapper import tixi3.tixi3wrapper from PyQt5.QtCore import * from PyQt5.QtWidgets import * from GUI.workflow import design_workflow from GUI.workflow.main_workflow import work_flow_monitor from Utils.data_objects.workflow_placeholders...
qactabase.py
import datetime import json import os import re import sys import threading import time import copy import uuid import pandas as pd import pymongo import requests from qaenv import (eventmq_amqp, eventmq_ip, eventmq_password, eventmq_port, eventmq_username, mongo_ip, mongo_uri) import QUANTAXIS as Q...
client_final.py
import numpy as np import os, time import cv2, dlib from filterpy.kalman import KalmanFilter from new.assign import * import requests from multiprocessing import Queue, Process from threading import Thread, Timer from new.config import cfg import argparse from compare import success, precesion class Track(): """ T...
test_threading_handler.py
import threading import unittest import mock from nose.tools import assert_raises from nose.tools import eq_ from nose.tools import raises class TestThreadingHandler(unittest.TestCase): def _makeOne(self, *args): from kazoo.handlers.threading import SequentialThreadingHandler return SequentialThr...
main.py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import os import threading import time from image_processor import ImageProcessor from task_publisher import TaskPublisher def _get_environment_variable(key, example_value): value = os.getenv(key) if va...
test_threading.py
try: from builtins import object except ImportError: pass import time from threading import Thread import logging from transitions.extensions import MachineFactory from transitions.extensions.nesting import NestedState from .test_nesting import TestTransitions as TestsNested from .test_core import TestTransit...
utils.py
import registry import threading import time import requests import socket import hashlib from . import app ORCHESTRATOR_ENDPOINT = app.config.get('ORCHESTRATOR_ENDPOINT') class ProcessPool(object): """A pool of processes""" def __init__(self): self._pool = {} def add(self, user, session, proc):...
player2.py
# BrewV written by Aditya Dubey """ ____ __ __ / __ )__________ _ __| | / / / __ / ___/ _ \ | /| / /| | / / / /_/ / / / __/ |/ |/ / | |/ / /_____/_/ \___/|__/|__/ |____/ """ import platform import os import sys import time #from pymediainfo import MediaInfo from PyQt...
add_csv_to_postgres_and_match.py
# This script demonstrates how to go from a csv of addresses # to that table in postgres # to matched uprns, including multithreading # We might want to do this is we want to restart the address matcher (i.e. write results to the database as we go # rather than doing everything in memory import pandas as pd from addr...
repairer.py
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Martin Barisits, <mar...
way.py
import time import math from threading import Thread msgHeader = "[AGENT]: " #Constants file import os DISPLAY_WIDTH = 1024 DISPLAY_HEIGHT = 728 MAPS_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "maps") STRATEGIES_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "strategies") MEDI...
test_async.py
import random import pathlib import json import subprocess import threading import time import os import re import pytest from paho.mqtt import client as mqtt_client from openfunction.function_context import FunctionContext from openfunction.async_server import AsyncApp TEST_PAYLOAD = {"data": "hello world"} APP_ID=...
test_concurrent_futures.py
from test import support from test.support import import_helper from test.support import threading_helper # Skip tests if _multiprocessing wasn't built. import_helper.import_module('_multiprocessing') from test.support import hashlib_helper from test.support.script_helper import assert_python_ok import contextlib im...
run_py_tests.py
#!/usr/bin/env python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """End to end tests for ChromeDriver.""" import base64 import json import math import optparse import os import shutil import socket i...
log.py
# -*- coding: utf-8 -*- """ lantz.log ~~~~~~~~~ Implements logging support for Lantz. :copyright: 2015 by The Lantz Authors :license: BSD, see LICENSE for more details. """ import pickle import select import socket import struct import logging import threading from logging import DEBUG, INFO, W...
main.py
""" MIT License Copyright (c) 2021 FirestormFan / SRPN Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, m...
v7_decompiled.py
#Decompiled At:Sat Mar 14 12:04:06 2020 import os, sys, time, datetime, random, hashlib, re, threading, json, getpass, urllib, cookielib from multiprocessing.pool import ThreadPool try: import mechanize except ImportError: os.system('pip2 install mechanize') try: import requests except ImportError: o...
manager.py
#!/usr/bin/env python3 import datetime import importlib import os import sys import fcntl import errno import signal import shutil import subprocess import textwrap import time import traceback from multiprocessing import Process from typing import Dict, List from common.basedir import BASEDIR from common.spinner imp...
ircthread.py
#!/usr/bin/env python # Copyright(C) 2011-2016 Thomas Voegtlin # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, m...
test_threaded_import.py
# This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # ra...
fit_job_handler.py
import logging import multiprocessing import os import pickle import sys import numpy from .datasets_handler import DatasetsHandler from .exception import ModelAlreadyFit from .temporary_data_handler import ( LEVEL_SET_KEY, MASK_KEY, SIGNED_DIST_KEY, TemporaryDataHandler,) from lsml.gradient import masked_gradien...
scoring_functions.py
#!/usr/bin/env python from __future__ import print_function, division import numpy as np from rdkit import Chem from rdkit import rdBase from rdkit.Chem import AllChem from rdkit import DataStructs from sklearn import svm import time import pickle import re import threading import pexpect from fp_func import fp_func fr...
smartEmergencySwitch.py
import pifacedigitalio buttons = [ False, False, False, False ] pifacedigital = None; state = "" def set_state(new_state): global state, buttons, pifacedigital if state is new_state: return else: state = new_state print("State: " + state); if new_state == "ON": pif...
email.py
import os from threading import Thread from flask_mail import Message from flask import current_app from . import app, mail def send_async_email(app, msg): with app.app_context(): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender=sender,...
install_utils.py
import getopt import re import subprocess import sys import threading import time import os from couchbase_helper.cluster import Cluster sys.path = [".", "lib"] + sys.path import testconstants from remote.remote_util import RemoteMachineShellConnection, RemoteUtilHelper from membase.api.rest_client import RestConnecti...
roomba.py
from __future__ import division from os import kill, getpid from redis import StrictRedis, WatchError from multiprocessing import Process from threading import Thread from msgpack import Unpacker, packb try: from types import TupleType except ImportError: eliminated_in_python3 = True from time import time, slee...
main_window.py
import re import os import sys import time import datetime import traceback from decimal import Decimal import threading import electrum from electrum.bitcoin import TYPE_ADDRESS from electrum import WalletStorage, Wallet from electrum_gui.kivy.i18n import _ from electrum.paymentrequest import InvoiceStore from electr...
train.py
# -*- coding: utf-8 -*- # # train.py # # Copyright 2020 Amazon.com, Inc. or its affiliates. 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/...
test_cuda.py
from itertools import repeat, chain, product from typing import NamedTuple import collections import gc import io import os import pickle import queue import sys import tempfile import threading import unittest import torch import torch.cuda import torch.cuda.comm as comm from torch import multiprocessing as mp from t...
test_xmlrpc.py
# Adapted for Jython from CPython 2.7 test.test_xmlrpc import base64 import datetime import gc import sys import time import unittest import xmlrpclib import SimpleXMLRPCServer import mimetools import httplib import socket import StringIO import os import re from test import test_support try: import threading exce...
Queue.py
import abc from threading import Thread import time from typing import Any from redis import StrictRedis import pika from uuid import uuid4 from .exceptions import EmptyQueueException class Queue(metaclass=abc.ABCMeta): def __init__(self, name: str): """Make this be a new queue. Args: ...
compare_Wchain_sgd.py
import qiskit import numpy as np import sys sys.path.insert(1, '../') import qtm.base, qtm.constant, qtm.nqubit, qtm.fubini_study, qtm.encoding import importlib import multiprocessing importlib.reload(qtm.base) importlib.reload(qtm.constant) importlib.reload(qtm.onequbit) importlib.reload(qtm.nqubit) importlib.reload(q...
_handler.py
from numpy import array from time import perf_counter, sleep from multiprocessing import Process, Manager, Array from types import SimpleNamespace from ..parsers.low_level import LowLevelParser from ..utils._pos_profiles import p2p_cos_profile from ..robots._default.constants import POSITION_GAINS, DAMPING_GAINS, INIT...
test.py
import json import random import re import string import threading import time from multiprocessing.dummy import Pool import pytest from helpers.client import QueryRuntimeException from helpers.cluster import ClickHouseCluster cluster = ClickHouseCluster(__file__) node1 = cluster.add_instance('node1', ...
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_...
context.py
# coding=utf-8 # Licensed Materials - Property of IBM # Copyright IBM Corp. 2015,2017 """ Context for submission of applications. ******** Overview ******** The main function is :py:func:`submit` to submit a :py:class:`~streamsx.topology.topology.Topology` to a Streaming Analytics service or IBM® Streams instance fo...
multiprocessings.py
# from multiprocessing import Process # # # def PrintSquare(x): # return x*x # # # def CheckPrime(x): # for i in range(2, x): # if x % 2 == 0: # print("{} number not a prime number".format(x)) # break # else: # print("{} is a prime number".format(x)) # # if __name__ =...
test_partition_20.py
import threading import pytest from base.partition_wrapper import ApiPartitionWrapper from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel, CheckTasks from common.code_mapping import PartitionErrorMessage prefix = ...
queue_example.py
import threading from queue import Queue import time import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s [%(threadName)s] %(message)s') def consumer(e, q): while not e.is_set(): message = q.get() time.sleep(0.1) logging.debug('consume {0}'.format(mess...
PyBirthdayWish.py
#!/usr/bin/python3 import os,random from threading import Thread from time import sleep from termcolor import colored from playsound import playsound from config import * # Importing module specified in the config file art = __import__(f'arts.{artFile}', globals(), locals(), ['*']) def replaceMultiple(mainString, ...
spool.py
# Copyright (C) 2013 Sony Mobile Communications AB. # All rights, including trade secret rights, reserved. import os import sys import time import signal import multiprocessing import ave.cmd from ave.workspace import Workspace from ave.spool import Spool, make_spool def t1(): pretty = '%s t1' % __file__ ...
image_test.py
import contextlib import json import shutil import socket import tarfile import tempfile import threading import pytest import six from six.moves import BaseHTTPServer from six.moves import socketserver import docker from .. import helpers BUSYBOX = helpers.BUSYBOX class ListImagesTest(helpers.BaseTestCase): ...
manager.py
#!/usr/bin/env python3 import os import time import sys import fcntl import errno import signal import shutil import subprocess import datetime import textwrap from typing import Dict, List from selfdrive.swaglog import cloudlog, add_logentries_handler from common.basedir import BASEDIR from common.hardware import HAR...
tests.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...
nc_grpc_server.py
"""This is test gRPC server implemented to test the gRPC client""" from __future__ import print_function from concurrent import futures import time import math import logging import sys import os import argparse import signal import grpc import subprocess import select import threading import nc_grpc_pb2 import nc...
chess.py
# # Copyright 2000-2025 riteme # import sys import time import socket import threading from math import * from sfml.window import * from sfml.graphics import * from sfml.system import * class Game(object): WINDOW_WIDTH = 570 WINDOW_HEIGHT = 570 WINDOW_TITLE = "Chess" CHESS_RADIUS = 15 POINT_R...
Receiver.py
import socket from threading import Thread import pickle from PIL import Image from matplotlib import pyplot as plt # needs to be the same on the client PORT_NUMBER = 8089 UP_BOARD_IP = 'localhost' #'192.168.12.1' actually I don't know what address to put here global color_image global depth_image import socket ...
demo_theme.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import print_function import os import sys import time import curses import locale import threading from types import MethodType from collections import Counter from vcr import VCR from six.moves.urllib.parse import ...
c3po.py
# Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: # - Thomas Beermann, <t...
session_test.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...
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...
alterations.py
import random import time import threading import pygame import sys # Default values of signal timers defaultGreen = {0: 10, 1: 10, 2: 10, 3: 10} defaultRed = 150 defaultYellow = 5 signals = [] noOfSignals = 4 currentGreen = 0 # Indicates which signal is green currently nextGreen = (currentGreen + 1) % noOfSignals ...
highpassprocessor.py
############################################################################### # Highpass Filter # Urs Utzinger 2022 ############################################################################### ############################################################################### # Imports ###############################...