source
stringlengths
3
86
python
stringlengths
75
1.04M
data_loader.py
import numpy as np import time import random import torch.nn as nn import torch import math import os import sys sys.path.insert(0, 'data_util') import pickle from torch.multiprocessing import Process, Queue from torch.autograd import Variable from formula import NodeType, Node from utils import split_list COMM_OP = {...
start_subscribers.py
from project.model.subscriber.baby_monitor_subscriber import BabyMonitorSubscriber from project.model.subscriber.smartphone_subscriber import SmartphoneSubscriber from project.model.subscriber.smart_tv_subscriber import SmartTvSubscriber from multiprocessing import Process from time import sleep subscriber_list = [] s...
collect.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
agent.py
from __future__ import annotations import asyncio import io import json import time from threading import Thread from typing import Dict, IO, Iterator, List, Optional, Tuple import aiohttp import requests from botovod.agents import Agent, Attachment, Chat, Keyboard, Location, Message from .types import (TelegramAttac...
accumulators.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...
simpleimp.py
#*****************************************************************************# #* Copyright (c) 2004-2008, SRI International. *# #* All rights reserved. *# #* ...
chrome_test_server_spawner.py
# 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. """A "Test Server Spawner" that handles killing/stopping per-test test servers. It's used to accept requests from the device to spawn and kill instances of ...
sim.py
#!/usr/bin/env python3 import csv import numpy import multiprocessing def sigmoid(x): return 1.0/(1.0+numpy.exp(-(x-5.0))) def sim_func(q,alpha1,alpha2,Nalpha1,Nalpha2): #parameters time_pitch=1.0 #ms save_pitch=10 save_pitch_weight=1000 simlen_sec=900.0 simlen=int(simlen_sec*1000.0/time_...
cronjobs.py
#!/usr/bin/env python """Cron management classes.""" from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import logging import sys import threading import time from future.utils import iterkeys from grr_response_core import config from grr_response_core.lib...
test_mcrouter_basic.py
# Copyright (c) 2015, Facebook, 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. An additional grant # of patent rights can be found in the PATENTS file in the same directory. from __future__ import absolute_...
tx_recv_interactive.py
#!/usr/bin/env python # # 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 # "...
p_executer.py
# -*- encoding: utf-8 -*- ''' Current module: pyrunner.p_executer Rough version history: v1.0 Original version to use v1.1 add 'launch_mobile' function v2.1 reconstitute this module with unittest and support mutil runner ******************************************************************** @AUTHO...
__init__.py
#!/usr/bin/env python # Software License Agreement (BSD License) # # Copyright (c) 2012, Fraunhofer FKIE/US, Alexander Tiderko # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributi...
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, PARAMS from common.android im...
Device.py
# -*- coding: utf-8 -*- """ This file contains functions that are capable to access internal device information and features. -SSHFS information -Username -Shared directory -File access -Capability -Linux and iOS -Bluetooth -Camera -Battery -Camera access """ from selenium import webdriver from ...
testprogram.py
#! /usr/bin/python3 # The MIT License (MIT) # # Copyright(c) 2021, Damien Feneyrou <dfeneyrou@gmail.com> # # 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 witho...
conftest.py
import sys from http.server import HTTPServer from threading import Event from threading import Thread import pytest from library.python.envoy_requests.common.engine import Engine from test.python.echo_server import EchoServerHandler @pytest.fixture(scope="session") def http_server_url(): Engine.build() ip...
test_util.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2017 theloop, 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 req...
script_animations.py
import random, time, sys, string, threading, os, queue from alive_progress import alive_bar def repeated_guesses(target): chars = string.ascii_letters + string.digits + ' ' current_guess = len(target) * ['*'] for count, char in enumerate(target): while current_guess[count] != char: cur...
player.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: omi # @Date: 2014-07-15 15:48:27 # @Last Modified by: omi # @Last Modified time: 2015-01-30 18:05:08 ''' 网易云音乐 Player ''' # Let's make some noise import subprocess import threading import time import os import random import re from ui import Ui from storage...
kbsync.py
# Keyboard Synchronization import arachnoid as ara #import win32api, win32con from pynput import keyboard import os, sys print('PID: {}'.format(ara.get_pid())) IP_ADDR = '192.168.1.94'#'43.33' PORT_NUMBER = 5555 #KB_LAYOUT = win32api.GetKeyboardLayout() ''' def get_key_strokes(from_=0, to=250): return l...
python_cheatsheet.py
import sys import math import random import threading import time from functools import reduce # ----- INTRO ----- # Python tutorial from Derek Banas # Python files end with the extension .py # Print to the console # Python statements terminate with a newline print("Hello World") # Accept user input and store it in a...
plot_from_pp_geop_height_pot_temp_and_wind_diff_mean_state.py
""" Load pp, plot and save 8km difference """ import os, sys #%matplotlib inline #%pylab inline import matplotlib #matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from matplotlib import rc from matplotlib.font_manager import FontProperties from matplotlib import rcParams from mpl_t...
parallel.py
# Parallel implementation for sampling a multi-order echelle spectrum. Because the likelihood # calculation is independent for each order, the runtime is essentially constant regardless # of how large a spectral range is used. # Additionally, one could use this to fit multiple stars at once. import argparse parser = ...
AddSquaresMultiThreadingMany.py
import time, os import threading as th import multiprocessing as mp import random #Create 18 random numbers NUMBEROFNUMBERS = 8 def square_number(idx, number, results): pid = os.getpid() threadName = th.current_thread().name processName = mp.current_process().name #Print Starting Statement prin...
bot.py
import os import re import time from functools import wraps from threading import Thread from slackclient import SlackClient import redis as _redis from hermes.util import Util class Bot: default_config = { "SLACK_TOKEN": os.environ.get("SLACK_TOKEN"), "REDIS_HOST": os.environ.get("REDIS_HOST",...
pool_thread.py
from multiprocessing import Pool import datetime et = datetime.datetime.now() # def f(x): # return x*x # if __name__ == '__main__': # p = Pool(5) # print(p.map(f, [1, 2, 3])) #from __future__ import print_function # from multiprocessing import Process # import os # def info(title): # print (title) #...
__init__.py
# # Copyright (C) 2018-2019 Nippon Telegraph and Telephone Corporation. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from grpc import aio from . import taish_pb2 from . import taish_pb2_grpc import asyncio from queue import Queue ...
utils.py
# From http://www.pyimagesearch.com/2015/12/21/increasing-webcam-fps-with-python-and-opencv/ import cv2 from threading import Thread class WebcamVideoStream: def __init__(self, src, width, height): # initialize the video camera stream and read the first frame # from the stream src = -1 ...
ue_mac.py
""" Copyright 2020 The Magma Authors. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
mavlink_gcs_tests_master.py
# mavlink_camera_tests.py # # Air Cam Pro 2021 # This is tests for python mavlink for camera control # It uses snippets and code from the sources given below # REV 1.1 23-12-2021 1700 # # Mark Jacobsen # mark@syriaairlift.org # # example mavlink GUI # https://github.com/markdjacobsen/hellomav # # Joystick readers and ...
test_distributed_sampling.py
import dgl import unittest import os from dgl.data import CitationGraphDataset from dgl.distributed import sample_neighbors, find_edges from dgl.distributed import partition_graph, load_partition, load_partition_book import sys import multiprocessing as mp import numpy as np import backend as F import time from utils i...
my_module.py
import os import rospy import rospkg import threading from qt_gui.plugin import Plugin from python_qt_binding import loadUi from python_qt_binding import QtWidgets from std_msgs.msg import Bool class MyPlugin(Plugin): def __init__(self, context): super(MyPlugin, self).__init__(context) # Give QO...
main3.py
import tensorflow as tf from gym import wrappers import make_env import numpy as np import random from ReplayMemory import ReplayMemory from ExplorationNoise import OrnsteinUhlenbeckActionNoise as OUNoise from actorcriticv2 import ActorNetwork,CriticNetwork #from actorcriticv1 import Brain, Worker from Train import tra...
main.queue.py
from time import sleep import threading from storage_mysqldb import connect_db, create_table, insert_db from input_thread import getPatientInfo, readSensorData import alert_system import output import queue def getAllInfo(): while True: sleep(2) # get data PatientInfo = getPatientInfo() ...
load_test_client.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
gps3threaded.py
#!/usr/bin/env python3.5 # coding=utf-8 """Threaded gps3 client""" from __future__ import print_function from threading import Thread from time import sleep try: # This kludge to get around imports with files and directories the same name. import gps3 # Python 3 except ImportError: from . import gps3 # Pyt...
app.py
from flask import Flask, render_template, request, redirect, url_for, jsonify from dataclasses import dataclass from flask_sqlalchemy import SQLAlchemy import pyperclip import psutil import time import json from datetime import datetime from multiprocessing import Process, Value from hashlib import sha256 import signa...
mainwindow.py
# -*- coding: utf-8 -*- # # Copyright © Spyder Project Contributors # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) """ Spyder, the Scientific Python Development Environment ===================================================== Developped and maintained by the Spyder Pro...
exposition.py
#!/usr/bin/python from __future__ import unicode_literals import base64 import os import socket import sys import threading from contextlib import closing from wsgiref.simple_server import make_server, WSGIRequestHandler from prometheus_client import core from prometheus_client import openmetrics try: from BaseH...
agent.py
# Copyright 2022 The Flax 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 wri...
views.py
import logging import re import subprocess import os import sys import traceback import time import json import copy import random import numpy as np import pandas as pd import math import base64 import urllib3 import hashlib from io import BytesIO from datetime import datetime, timedelta from threading import Thread,...
__init__.py
""" The ``python_function`` model flavor serves as a default model interface for MLflow Python models. Any MLflow Python model is expected to be loadable as a ``python_function`` model. In addition, the ``mlflow.pyfunc`` module defines a generic :ref:`filesystem format <pyfunc-filesystem-format>` for Python models and...
openface_detector.py
import cv2 as cv import util import threading import detect_it_all_bot import time from faces_util import detect_faces from sklearn.svm import SVC from sklearn.preprocessing import LabelEncoder, Normalizer import openface_util import pandas as pd import numpy as np from scipy.spatial import distance class OpenfaceDet...
tray_log.py
# (C) unresolved-external@singu-lair.com released under the MIT license (see LICENSE) import copy import datetime import os import threading import time import win32con import win32gui import common def threaded_function(thread_data, thread_static): while not thread_data.stop: update_hwnd = None with threa...
platform.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2018-2021 Accenture Technology # # 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 #...
Hiwin_RT605_ArmCommand_Socket_20190627164143.py
#!/usr/bin/env python3 # license removed for brevity import rospy import os import numpy as np from std_msgs.msg import String from ROS_Socket.srv import * from ROS_Socket.msg import * from std_msgs.msg import Int32MultiArray import math import enum pos_feedback_times = 0 mode_feedback_times = 0 msg_feedback = 1 #接收策略端...
story.py
import web import disk from bs4 import BeautifulSoup from urllib.parse import urlparse, urljoin import itertools import threading import re import datetime import dateutil.parser import math import statistics def words_of_entries(entries): words = 0 for p in entries: words += len(p.get_text().split()...
test_forward.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...
build_imagenet_data.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Copyright 2021 Giovanni Dispoto # # 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 ...
scheduler.py
import time import multiprocessing from loguru import logger from proxypool.components.getter import Getter from proxypool.components.tester import Tester from proxypool.components.server import app from proxypool.setting import TESTER_ENABLED, GETTER_ENABLED, SERVER_ENABLED, TESTER_CYCLE, GETTER_CYCLE, API_HOST,...
server.py
#Code adapted from optional lecture import socket import threading from queue import Queue from Database.DatabaseManager import * HOST = "localhost" # put your IP address here if playing on multiple computers PORT = 50011 BACKLOG = 3 server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((HOST,PORT)...
__init__.py
import redis import sys import time from hoocron_plugin import HoocronHookBase from threading import Thread from queue import Queue, Empty class RedisHook(HoocronHookBase): def __init__(self): self.th = None self.redis_path = None self.redis_list = None self.redis = None # Redis con...
thread_handler.py
from ezeeai.core.runner import Runner import time import psutil from multiprocessing import Process, Queue from ..utils.sys_ops import find_free_port, change_checkpoints from ..config import config_reader import threading import logging import subprocess logging.basicConfig(level=logging.DEBUG, fo...
observer.py
import threading import mutex import rospy from diagnostic_msgs.msg import DiagnosticArray, DiagnosticStatus class Observer(object): def __init__(self, name, loop_rate_hz=1): self._name = name self._rate = rospy.Rate(loop_rate_hz) self._seq = 1 self._lock = threading.Lock() ...
elasticsearch-stress-test.py
#!/usr/bin/env python # # Stress test tool for elasticsearch # Written by Roi Rav-Hon @ Logz.io (roi@logz.io) # import signal import sys # Using argparse to parse cli arguments import argparse # Import threading essentials from threading import Lock, Thread, Condition, Event # For randomizing import string from ra...
treasury_service.py
import config import account_helper import node_rpc_helper import os import json from bottle import post, request, response, get, route, static_file from threading import Thread import requests def setHeaders(): response.content_type = 'application/json' response.headers['Access-Control-Allow-Origin'] = '*' ...
swift_t.py
''' Sample Executor for integration with SwiftT. This follows the model used by `EMEWS <http://www.mcs.anl.gov/~wozniak/papers/Cancer2_2016.pdf>`_ to some extent. ''' from concurrent.futures import Future import logging import uuid import threading import queue import multiprocessing as mp from ipyparallel.serialize...
server.py
# Copyright (c) Microsoft Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
Translator.py
import asyncio import json import os import shutil import threading import zipfile import aiohttp import requests from Util import Configuration, GearbotLogging, Emoji LANGS = dict() BOT = None def initialize(bot_in): global BOT BOT = bot_in load_translations() def load_translations(): directory = ...
test_cymj.py
import pytest from numbers import Number from io import BytesIO, StringIO import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal from mujoco_py import (MjSim, MjSimPool, load_model_from_xml, load_model_from_path, MjSimState, ignore_mujoco...
cartwrap.py
import subprocess import io from threading import Thread from queue import Queue import re import math def reader(pipe, pipe_name, queue): try: with pipe: for line in iter(pipe.readline, b''): queue.put((pipe_name, line)) finally: queue.put(None) # This function inv...
e2e.py
""" This is an end to end release test automation script used to kick off periodic release tests, running on Anyscale. The tool leverages app configs and compute templates. Calling this script will run a single release test. Example: python e2e.py --test-config ~/ray/release/xgboost_tests/xgboost_tests.yaml --test-...
python.thread.py
import threading import time event = threading.Event() def lighter(): count = 0 event.clear() # 初始者为绿灯 while True: if 5 < count <= 10: event.clear() # 红灯,清除标志位 print("red light is on... ") elif count > 10: event.set() # 绿灯,设置标志位 count = 0...
wait_for_topics.py
# Copyright 2021 Open Source Robotics Foundation, 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...
test_collection_count.py
import pdb import pytest import logging import itertools from time import sleep import threading from multiprocessing import Process from milvus import IndexType, MetricType from utils import * dim = 128 index_file_size = 10 add_time_interval = 3 tag = "1970-01-01" nb = 6000 class TestCollectionCount: """ par...
postfix_message_info.py
import collections import re import os import time import king_phisher.plugins as plugin_opts import king_phisher.server.database.manager as db_manager import king_phisher.server.database.models as db_models import king_phisher.server.fs_utilities as fs_utilities import king_phisher.server.plugins as plugins import ki...
process_level.py
#!/usr/bin/python2 # TODO # - Dont assume WGS84, instead read from input layer. # - Find a better way to separate different same object type with multiple # geometry types. import subprocess import multiprocessing as mp from osgeo import osr from osgeo import ogr import sys import fnmatch import os import time import...
find_spots_server.py
from __future__ import annotations import http.server as server_base import json import logging import multiprocessing import sys import time import urllib.parse import libtbx.phil from cctbx import uctbx from dxtbx.model.experiment_list import ExperimentListFactory from libtbx.introspection import number_of_processo...
managers.py
# # Module providing the `SyncManager` class for dealing # with shared objects # # multiprocessing/managers.py # # Copyright (c) 2006-2008, R Oudkerk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are m...
threading.py
"""A threading based handler. The :class:`SequentialThreadingHandler` is intended for regular Python environments that use threads. .. warning:: Do not use :class:`SequentialThreadingHandler` with applications using asynchronous event loops (like gevent). Use the :class:`~kazoo.handlers.gevent.Sequential...
__init__.py
# !/usr/bin/env python # -*- coding: utf-8 -*- # 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, merge, publ...
parallel.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2019 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ Parallel """ from __future__ import absolute_import from __future__ import unicode_literals from __future__ import prin...
FTP_photogrammetry_Client.py
''' * * FTP Client to pull images from FTP server * hosted on RPi for 3D image reconstruction. * * AUTHOR : Mohammad Odeh * DATE WRITTEN : Aug. 10th, 2018 Year of Our Lord * LAST CONTRIBUTION DATE : Aug. 14th, 2018 Year of Our Lord * ''' # Import modules from time ...
fifo.py
import threading import time mutex = threading.Semaphore(1) procesos = [['A', 'B', 'C', 'D', 'E'], [3, 5, 2, 5, 5], [0, 1, 3, 9, 12], [0, 0, 0, 0, 0]] resultados = [['T', 'E', 'P'], [0, 0, 0], [0, 0, 0]] tiempo_espera = procesos[2][0] tiempo_total = 0 def proceso(proc_actual): global procesos actual = proceso...
threads.py
# Sleeping doesn't block one complete process, it blocks one thread. By the POSIX/Linux/UNIX # definitions a process (for instance one python program) may include multiple threads which all # share the same memory, but behave like other processes would in all other ways. # This means processes are more seperated than ...
robotLibrary.py
# Copyright 2020 Jan Feitsma (Falcons) # SPDX-License-Identifier: Apache-2.0 #!/usr/bin/env python3 # # Python library for on-robot commands. import sys, os, signal import traceback import logging import readline from time import sleep import threading try: import EnvironmentField except: print("warning: Env...
batcher.py
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # Modifications Copyright 2017 Abigail See # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
stats.py
#!/usr/bin/env python3 # coding=utf-8 # # Python Script # # Copyleft © Manoel Vilela # # import pandas as pd # sudo pip install pandas import numpy as np # sudo pip install numpy from distutils.spawn import find_executable from optparse import OptionParser from os import path import os import time import iterto...
__init__.py
#!/usr/bin/env python """ fs.tests: testcases for the fs module """ from __future__ import with_statement # Send any output from the logging module to stdout, so it will # be captured by nose and reported appropriately import sys import logging logging.basicConfig(level=logging.ERROR, stream=sys.stdout) from ...
api.py
import json import time import random import threading import signal import os from vk_api.http_util import HttpUtil from urllib.parse import urlparse, parse_qs from vk_api.logger import Logger from vk_api.tokenizer import Tokenizer class VkApi: def __init__(self, options): """ ...
split_video.py
from multiprocessing.context import Process import os import glob from moviepy.editor import VideoFileClip path = "../GRID/" origin = "../video_org" file = "GRID_files.txt" def get_duration(filename): clip = VideoFileClip(filename) return clip.duration def run(origins, videos, dests): clips = [] ...
massReport.py
from colored import fg, attr import requests import threading import time import random r = fg(241) # Setup color variables r2 = fg(255) b = fg(31) w = fg(15) def start(): token = input(f"\n {r2}[{b}?{r2}] Token: ") guildId = input(f" {r2}[{b}?{r2}] Server Id: ") channelId = input(f" {r2}[{b}?{r2}] Channe...
tst_flash.py
import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) from lib_utils import * from lib_leds import LEDS import time import threading leds = LEDS() threading.Thread(target=leds.flash).start() leds.flash_on() t_start = time.time() while time.time() - t_start < 60: time.sleep(0.5) leds.off() leds....
redshift.py
# pylint: disable=C0111,R0903 """Displays the current color temperature of redshift Requires the following executable: * redshift """ import threading import bumblebee.input import bumblebee.output import bumblebee.engine def is_terminated(): for thread in threading.enumerate(): if thread.name == "...
pserve.py
# (c) 2005 Ian Bicking and contributors; written for Paste # (http://pythonpaste.org) Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license.php # # For discussion of daemonizing: # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731 # # Code taken also from QP: http://www.mems-exch...
main.py
# -*- coding: utf-8 -*- """ author: ZSAIm github: https://github.com/ZSAIm/iqiyi-parser """ import gui import wx, time, sys import GUIEventBinder import socket import threading import flow import handler from handler.logs import STDRedirect import io socket.setdefaulttimeout(3) def main(): threading.Thread(...
main.py
import requests, zlib, hashlib, json import time, threading import logging import random from multiprocessing.pool import ThreadPool from enum import Enum class GameConstants: RUBLES = '5449016a4bdc2d6f028b456f' DOLLARS = '5696686a4bdc2da3298b456a' EURO = '569668774bdc2da2298b4568' Therapist = '54c...
AMTP.py
import socket import sys import threading class Message_from_server: def __init__(self,raw_message): lines = raw_message.split("\n") self.response_code = int(lines[0]) self.headers = {} for i in range(1,len(lines)): parts = lines[i].split(":") self.headers[pa...
06_semaphore.py
import threading def worker(i, semaphore): assert isinstance(semaphore, threading.Semaphore) semaphore.acquire() print('Working', i) semaphore = threading.Semaphore(0) n_workers = 10 for i in range(n_workers): t = threading.Thread(target=worker, args=(i, semaphore,)) t.start() for i in range(n_...
2.Multiprocessing.Lock.py
# -*- coding: utf-8 -*- import multiprocessing import sys def worker_with(lock, f): with lock: fs = open(f, 'a+') n = 10 while n > 1: fs.write("Lockd acquired via with\n") n -= 1 fs.close() def worker_no_with(lock, f): lock.acquire() ...
hierarchy.py
# Copyright 2019 Sebastian Kahl # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
_logs.py
from __future__ import annotations import itertools import logging import os import shlex import subprocess import sys import threading from datetime import datetime, timedelta from pathlib import Path from typing import Any, TextIO, cast import porcupine from porcupine import dirs log = logging.getLogger(__name__) ...
apd.py
#!/usr/bin/python import sys import time import argparse from datetime import datetime import socket import multiprocessing THREADS_NUMBER = 8 args = {} startupMessages = [] services = { 22: 'SSH', 80: 'HTTP', 443: 'HTTPS' } #TODO: This is an example list, read this from a file later def splitChunks(a, n): ...
a3c.py
import gym import multiprocessing import threading import numpy as np import os import shutil import matplotlib.pyplot as plt import tensorflow as tf #PARAMETERS OUTPUT_GRAPH = True # safe logs RENDER=True # render one worker LOG_DIR = './log' # savelocation for logs N_WORKERS = multi...
station_scan.py
from multiprocessing import Process class Station_Scan(): def __init__(self, settings, channels): self.config = settings self.channels = channels self.chanscan = Process(target=self.runscan) def scan(self): print("Channel Scan Requested by Client.") try: s...
file_stream.py
import base64 import binascii import collections import itertools import logging import os import sys import random import requests import threading import time from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Tuple import wandb from wandb import util from wandb import env import six from six.mo...
TServer.py
# Copyright (c) Facebook, Inc. and its affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
client.py
from sys import maxsize import threading import grpc import protobuffer_pb2 as game import protobuffer_pb2_grpc as rpc from engine_revised import Engine from queue import Queue address = 'localhost' port = 50051 class Client(): def __init__(self, id:str, engine: Engine): self.id = id self.eng...
miniterm.py
#!/home/sincgrid-ubuntu/Desktop/jupyterNotebook/PhySyncEnv/bin/python # # Very simple serial terminal # # This file is part of pySerial. https://github.com/pyserial/pyserial # (C)2002-2015 Chris Liechti <cliechti@gmx.net> # # SPDX-License-Identifier: BSD-3-Clause import codecs import os import sys import threading ...