source
stringlengths
3
86
python
stringlengths
75
1.04M
scan.py
# -*- coding: utf-8 -*- from functools import partial from multiprocessing import Process import multiprocessing as mp import sys import os import platform import unicodedata # https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Multiprocessing # Module multiprocessing is organized differently in Python 3.4+ try: ...
baseline_merge.py
# -*- coding: utf-8 -*- """ Created on Tue Dec 17 19:59:45 2019 @author: jack """ import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) # import xgboost as xgb from sklearn.model_selection import StratifiedKFold import gc import os from keras.utils import to_catego...
tasks.py
from __future__ import with_statement import inspect import sys import textwrap from fabric import state from fabric.utils import abort, warn, error from fabric.network import to_dict, normalize_to_string, disconnect_all from fabric.context_managers import settings from fabric.job_queue import JobQueue from fabric.ta...
dokku-installer.py
#!/usr/bin/env python2.7 import cgi import json import os import re import SimpleHTTPServer import SocketServer import subprocess import sys import threading VERSION = 'v0.11.4' hostname = '' try: command = "bash -c '[[ $(dig +short $HOSTNAME) ]] && echo $HOSTNAME || wget -q -O - icanhazip.com'" hostname = s...
monitoring.py
import os import socket import pickle import logging import time import datetime import zmq import queue from multiprocessing import Process, Queue from parsl.utils import RepresentationMixin from parsl.monitoring.message_type import MessageType from typing import Optional try: from parsl.monitoring.db_manager ...
cmp_migrate_thread.py
from compliance_standards import cmp_compare, cmp_get, cmp_add from sdk.color_print import c_print from tqdm import tqdm import threading def migrate(tenant_sessions: list, logger): ''' Accepts a list of tenant session objects. Gets a list of the top level compliance standards that are missing and migrate...
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 ===================================================== Developed and maintained by the Spyder Proj...
tcpudp.py
import socketserver from multiprocessing import Process, Pool import time from concurrent.futures.thread import ThreadPoolExecutor from concurrent.futures.process import ProcessPoolExecutor class MyTCPHandler(socketserver.BaseRequestHandler): """ The request handler class for our server. It is instantiat...
thread.py
from threading import Thread def async_func(func): def wrapper(*args, **kwargs): thread = Thread(target=func, args=args, kwargs=kwargs) thread.start() return wrapper
test_deferred_stream_handler.py
import logging import multiprocessing import signal import subprocess import sys import time import pytest from salt._logging.handlers import DeferredStreamHandler from salt.utils.nb_popen import NonBlockingPopen from saltfactories.utils.processes import terminate_process from tests.support.helpers import CaptureOutpu...
test_socket.py
import unittest from test import support import errno import io import itertools import socket import select import tempfile import time import traceback import queue import sys import os import platform import array import contextlib from weakref import proxy import signal import math import pickle import struct impo...
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...
workload.py
import datetime import threading import yaml from .session_group import SessionGroup class Workload: def __init__(self, session_cls, config_filename, *args): with open(config_filename) as config_file: config = yaml.safe_load(config_file) now = datetime.datetime.now() self._session_groups = [ ...
simple_server.py
import threading import socket host = socket.gethostbyname(socket.gethostname()) port = 9090 s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind((host,port)) s.listen(5) clients = [] nicknames = [] def trans(mess): for client in clients: client.send(mess) def handle_connection(client): ...
emergency_tool.py
from route.tool.func import * from route.tool.mark import load_conn2, namumark try: set_data = json.loads(open('data/set.json').read()) except: if os.getenv('NAMU_DB') != None: set_data = { "db" : os.getenv('NAMU_DB') } else: print('DB name (data) : ', end = '') new_json = ...
test_server.py
from __future__ import unicode_literals import os.path import threading import time from future.builtins import str import zmq from zmq.eventloop import ioloop, zmqstream import tornado.testing ioloop.install() def test_server_creation(): from pseud import Server user_id = b'echo' server = Server(user_...
rotator.py
#! /usr/bin/env python3 """ Object file for class interfacing with antenna rotator author: Marion Anderson date: 2018-06-17 file: rotator.py """ from __future__ import absolute_import, print_function import os import time from multiprocessing import Lock, Process import pigpio class RotatorClassException(Excep...
repo.py
import os from dataclasses import dataclass, field from threading import Thread from typing import Dict, List, Union import cli from plib import Path from . import vpn no_pull_changes_message = "Already up to date." def ask_push(): response = cli.prompt("Commit message", default=False) return response de...
bacnet.py
''' Copyright (c) 2016, Battelle Memorial Institute 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, this list of conditions ...
distributed-helloworld.py
import sys import os import math import tensorflow as tf from kubernetes import client, config import socket import fcntl import struct import time import threading # these globals are used to bootstrap the TF cluster myindex = -99 ps_hosts = [] worker_hosts = [] def get_ip_address(ifname): s = socket.socket(sock...
test_impl_rabbit.py
# Copyright 2013 Red Hat, 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 agre...
docserver.py
from __future__ import print_function import flask import os import threading import time import webbrowser from tornado.wsgi import WSGIContainer from tornado.httpserver import HTTPServer from tornado.ioloop import IOLoop _basedir = os.path.join("..", os.path.dirname(__file__)) app = flask.Flask(__name__, static...
menu_screen.py
import curses import math import os import traceback import threading import time import random import getpass import json import sqlite3 import string import re import completer import datetime class CursedMenu(object): #TODO: name your plant '''A class which abstracts the horrors of building a curses-based m...
core.py
from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController import threading, random import esp, client as clientlib # $Connection portal IP = "192.168.100.245" RECV_HEADER = 1024 # Recv thread controls global recv_thread_status recv_thread_status = True global latest_recv_messag...
test_ipc_provider.py
import os import pathlib import pytest import socket import tempfile from threading import ( Thread, ) import time import uuid from web3.auto.gethdev import ( w3, ) from web3.middleware import ( construct_fixture_middleware, ) from web3.providers.ipc import ( IPCProvider, ) @pytest.fixture def jsonrp...
main.py
import sys import queue import threading import json import collections import time import logging logging.basicConfig(level=logging.DEBUG, filename='/Users/tmssmith/StS_AI/AI_test/log.log') def read_stdin(input_queue): """Read lines from stdin and write them to a queue :param input_queue: A queue, to which ...
Ts.py
import BONDS from BONDS import * from akad.ttypes import * from multiprocessing import Pool, Process from time import sleep import pytz, datetime, pafy, time, timeit, random, sys, ast, re, os, json, subprocess, threading, string, codecs, requests, tweepy, ctypes, urllib, wikipedia from datetime import timedelta, date ...
focuser.py
import os from abc import ABCMeta from abc import abstractmethod from threading import Event from threading import Thread import numpy as np from scipy.ndimage import binary_dilation from astropy.modeling import models from astropy.modeling import fitting from panoptes.pocs.base import PanBase from panoptes.utils.tim...
service.py
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is govered by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd """Prediction service for Monorail. """ import logging import os import sklearn import pickle i...
util.py
# # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # import codecs from collections import deque import contextlib import csv from glob import iglob as std_iglob import io import json import logging import os import py_compile import re import socket try: import ssl...
test_ssl.py
# Test the support for SSL and sockets import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import tempfile import urllib.request import traceback import asyncore import weakref import platform import functools ssl =...
gui.py
import cairo import gi import threading import time gi.require_version('Gtk', '3.0') gi.require_version('Gdk', '3.0') from gi.repository import Gtk from gi.repository import Gdk from gi.repository.GdkPixbuf import Pixbuf, InterpType from sand.gui_module import GUIComponent from sand.modules.memory.sensor import Memo...
controller.py
"""This module handles the view and model interactions.""" import time from bokeh.io import curdoc from threading import Thread import view import model import computation doc = curdoc() LOOP_TIME = 1000 class PlotContainer: def __init__(self, figure, sources, idx=0): self.figure = figure self....
collective_ops_test.py
# Copyright 2020 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 applicab...
python_port_scanner_threaded.py
#!/bin/python """ python_port_scanner_threaded.py Purpose: Python-based TCP port scanner Author: Cody Jackson Date: 2/16/2018 ######################## Version 0.1 Initial build """ import argparse import socket import threading def connection_scan(target_ip, target_port): """Attempts to create a socket co...
thread_01.py
# thread_01.py # 실행을 멈추려면 ctrl+break import threading import time def client_thread(clientname, sec): while True: print("{} - 지연 {} ".format(clientname, sec)) time.sleep(sec) clientA = threading.Thread(target=client_thread, args=("clientA", 0.1)) clientB = threading.Thread(target=client_thread, a...
test_cluster_connection_pool.py
# -*- coding: utf-8 -*- # python std lib import os import re import time from threading import Thread # rediscluster imports from rediscluster.connection import ( ClusterConnectionPool, ClusterReadOnlyConnectionPool, ClusterConnection, UnixDomainSocketConnection) from rediscluster.exceptions import RedisClust...
test_cmd_execution.py
import os import subprocess import threading import time from unittest import mock import pytest from ffmpy import FFExecutableNotFoundError, FFmpeg, FFRuntimeError def test_invalid_executable_path(): ff = FFmpeg(executable="/tmp/foo/bar/ffmpeg") with pytest.raises(FFExecutableNotFoundError) as exc_info: ...
extrapgui.py
# This file is part of the Extra-P software (http://www.scalasca.org/software/extra-p) # # Copyright (c) 2020, Technical University of Darmstadt, Germany # # This software may be modified and distributed under the terms of a BSD-style license. # See the LICENSE file in the base directory for details. import argparse i...
quick_chats.py
import flatbuffers import multiprocessing import queue from threading import Thread from rlbot.messages.flat import QuickChat from rlbot.messages.flat import QuickChatSelection from rlbot.utils.logging_utils import get_logger from rlbot.utils.structures.utils import create_enum_object """ Look for quick chats from ...
_gnupg.py
# Copyright (c) 2008-2011 by Vinay Sajip. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of cond...
utils.py
import subprocess import warnings from pathlib import Path from queue import Queue from subprocess import PIPE, Popen from threading import Thread from typing import Any, Dict, Iterable, List, Optional, Tuple, Union import pydantic from python_on_whales.download_binaries import download_buildx PROJECT_ROOT = Path(__...
influxenv.py
import time import spur import json import logging import pycurl import threading from StringIO import StringIO errorRetry = 50 numThreads = 20 testDelayAdder = 10 class InfluxEnv(object): def __init__(self,ip1,ip2,ip3,username,password,pem): self.errorRetry = errorRetry self.numThreads = numThrea...
test_core.py
# # SensApp::Storage # # Copyright (C) 2018 SINTEF Digital # All rights reserved. # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. # from unittest import TestCase from mock import MagicMock from threading import Thread from storage.settings...
servidor.py
import ssl import threading import socket from client import client from database import * from private_message import * #import functools as fun #import asyncio host = '192.168.2.26' port = 4004 clients = [] online_client_sockets = [SSLSocket] def broadcast(client_sender:client,message:str) -> None: ...
generate-dataset-canny.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author : Hongzhuo Liang # E-mail : liang@informatik.uni-hamburg.de # Description: # Date : 20/05/2018 2:45 PM # File Name : generate-dataset-canny.py import numpy as np import sys import pickle from dexnet.grasping.quality import PointGraspMetrics3D from...
pscan.py
#!/usr/bin/python3 #Title: pscan.py #Author: ApexPredator #License: MIT #Github: https://github.com/ApexPredator-InfoSec/pscan #Description: This script performs a ping sweep to find active hosts and then performs a port scan on the active hosts. import argparse import os import subprocess import socket import multipro...
BWSI_FrontSeat.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jul 17 16:18:55 2021 This is the simulated Sandshark front seat @author: BWSI AUV Challenge Instructional Staff """ import sys from BWSI_Sandshark import Sandshark from BWSI_BuoyField import BuoyField from Sandshark_Interface import SandsharkServer ...
test_multi_task_helper.py
# built in libraries import threading import multiprocessing import collections def process_runner(error_ret, func, *args, **kwargs): """ info: will run the task :param error_ret: list: away to return an error :param func: function :param args: tuple :param kwargs: dict :return: """ ...
test_s3boto3.py
import gzip import pickle import threading from datetime import datetime from textwrap import dedent from unittest import mock, skipIf from urllib.parse import urlparse from botocore.exceptions import ClientError from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core....
resnet50.py
''' 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 agreed to in writing, software di...
tornadosrv.py
"""Async web request example with tornado. Requests to localhost:8888 will be relayed via 0MQ to a slow responder, who will take 1-5 seconds to respond. The tornado app will remain responsive duriung this time, and when the worker replies, the web request will finish. A '.' is printed every 100ms to demonstrate th...
gnupg.py
""" A wrapper for the 'gpg' command:: Portions of this module are derived from A.M. Kuchling's well-designed GPG.py, using Richard Jones' updated version 1.3, which can be found in the pycrypto CVS repository on Sourceforge: http://pycrypto.cvs.sourceforge.net/viewvc/pycrypto/gpg/GPG.py This module is *not* forward-...
cmd.py
import subprocess from utlz import func_has_arg, namedtuple CmdResult = namedtuple( typename='CmdResult', field_names=[ 'exitcode', 'stdout', # type: bytes 'stderr', # type: bytes 'cmd', 'input', ], lazy_vals={ 'stdout_str': lambda self: self.stdout.d...
pyrep.py
from pyrep.backend import vrep, utils from pyrep.objects.object import Object from pyrep.objects.shape import Shape from pyrep.textures.texture import Texture from pyrep.errors import PyRepError import os import sys import time import threading from threading import Lock from typing import Tuple, List class PyRep(obj...
app.py
""" A REST API for Salt =================== .. py:currentmodule:: salt.netapi.rest_cherrypy.app .. note:: This module is Experimental on Windows platforms and supports limited configurations: - doesn't support PAM authentication (i.e. external_auth: auto) - doesn't support SSL (i.e. disable_ssl: Tru...
VideoShow.py
from threading import Thread import cv2 class VideoShow: """ Class that continuously shows a frame using a dedicated thread. """ def __init__(self, frame=None,source = None): self.frame = frame self.stopped = False self.source = source def start(self): Thread(target...
watchdog.py
import time import threading class WatchDog(object): def __init__(self, timeout_func, timeout_in_seconds=10): self.last_activity = time.time() self.timeout_in_seconds = timeout_in_seconds self.timeout_func = timeout_func def run(self): watchdog_thread = threading.Thread(targe...
Main_Client.py
import socket, selectors, threading, sys import tkinter as tk import Message_Client, gui from Custom_Errors import * def start_connection(host,port,name): addr = (host, port) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setblocking(False) sock.connect_ex(addr) # Connecting to server ...
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...
test_sys.py
from test import support from test.support.script_helper import assert_python_ok, assert_python_failure import builtins import codecs import gc import locale import operator import os import struct import subprocess import sys import sysconfig import test.support import textwrap import unittest import warnings # coun...
core.py
import logging import multiprocessing as mp import os import time import typing as t from gunicorn.app.base import Application from gunicorn.pidfile import Pidfile from dimensigon import defaults from dimensigon.exceptions import DimensigonError from dimensigon.use_cases.base import TerminateInterrupt from dimensigon...
basetelescope.py
import threading from typing import Dict, Any, Tuple, Union, List from astropy.coordinates import SkyCoord, ICRS, AltAz import astropy.units as u import logging from pyobs.interfaces import ITelescope, IFitsHeaderProvider from pyobs.modules import Module from pyobs.mixins import MotionStatusMixin, WeatherAwareMixin, ...
liscain.py
import tftpy import logging import ipaddress import threading import lib.db import sqlalchemy.orm import tasks from sqlalchemy import and_ from devices import remap_to_subclass from devices.device import Device from devices.ciscoios import CiscoIOS from io import StringIO from lib.config import config from lib.switchst...
__init__.py
import ast import logging import io import os import platform import queue import re import subprocess import sys import textwrap import threading import time import tokenize import traceback import webbrowser from queue import Queue from textwrap import dedent from time import sleep from tkinter import ttk from thonny...
kb_transytServer.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import json import os import random as _random import sys import traceback from getopt import getopt, GetoptError from multiprocessing import Process from os import environ from wsgiref.simple_server import make_server import requests as _requests from json...
radipy.py
import base64 import datetime import subprocess import sys import threading import time from pathlib import Path from xml.etree import ElementTree as ET import click import requests from prettytable import PrettyTable DATE = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d-%H') TMP_PATH = Path('./tmp').r...
runSelectionSequence.py
from __future__ import division, print_function import ROOT from PhysicsTools.NanoAODTools.postprocessing.framework.postprocessor import PostProcessor from PhysicsTools.NanoAODTools.postprocessing.framework.datamodel import Collection, Object from PhysicsTools.NanoAODTools.postprocessing.framework.eventloop import Mod...
UDP_server_Threaded.py
#! /usr/bin/env python ############################################################################### # UDP_server_Threaded.py # # Threaded UDP server # # NOTE: Any plotting is set up for output, not viewing on screen. # So, it will likely be ugly on screen. The saved PDFs should look # better. # # Create...
data_handler.py
from config import command_ledger, data_ledger import time from PyQt5 import QtWidgets, QtCore, QtGui from yahoofinancials import YahooFinancials from dicttoxml import dicttoxml import xmltodict from xml.dom.minidom import parseString import threading import windows.popups.popup_handler as ph import datetime as dt ''...
pureblood.py
#!/usr/bin/python # -*- coding: utf-8 -*- """ Script Created By: Cr4sHCoD3 Github: https://github.com/cr4shcod3 FB Page: https://facebook.com/cr4shcod3.py Youtube: https://www.youtube.com/channel/UCEw5DaWEUY0XeUOTl1U2LKw Buy Me A Coffee: https://www.buymeacoffee.com/f4a5kJcyl Google Plu...
WebServer.py
import os import io import re import six import sys import gzip import glob import time import json import base64 urllib = six.moves.urllib from six.moves.urllib.parse import quote from six.moves.urllib.request import url2pathname import socket import datetime import traceback import threading from six.moves.queue impo...
m1013x2_no_sync.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # ## # @brief [py demo] muliti robot sync test # @author Kab Kyoum Kim (kabkyoum.kim@doosan.com) import rospy import os import threading, time import sys sys.dont_write_bytecode = True sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__),"../../...
run.py
#!/usr/bin/env python3 # encoding: utf-8 """ Usage: python [options] Options: -h,--help 显示帮助 -a,--algorithm=<name> 算法 specify the training algorithm [default: ppo] -c,--copys=<n> 指定并行训练的数量 ...
fs_based.py
#! python2.7 """Filesytem-based process-watcher. This is meant to be part of a 2-process system. For now, let's call these processes the Definer and the Watcher. * The Definer creates a graph of tasks and starts a resolver loop, like pypeflow. It keeps a Waiting list, a Running list, and a Done list. It then communica...
test_remote2.py
import os import threading import time import unittest from multiprocessing import Process from jina.logging import get_logger from jina.main.parser import set_gateway_parser, set_pea_parser, set_pod_parser from jina.peapods.pod import GatewayPod, BasePod from jina.peapods.remote import RemotePea, PodSpawnHelper, PeaS...
util_envs.py
import numpy as np import multiprocessing as mp import gym def _child(id, pipe): """ Event loop run by the child processes """ env = gym.make(id) try: while True: command = pipe.recv() # command is a tuple like ("call" | "get", "name.of.attr", extra args...) ...
magma_base.py
import math import os import random import time import threading from Cb_constants.CBServer import CbServer from cb_tools.cbstats import Cbstats from remote.remote_util import RemoteMachineShellConnection from storage.storage_base import StorageBase from storage_utils.magma_utils import MagmaUtils class MagmaBaseTes...
indexq.py
import datetime import logging import sys import os import gzip import shutil import random import json import threading import time from multiprocessing.pool import ThreadPool from multiprocessing import Process, JoinableQueue from functools import partial from SolrClient.exceptions import * class IndexQ(): ...
hopandhack.py
#!/usr/bin/env python from deps.psexec import * from deps.wmiexec import * from deps.smbexec import * from deps.secretsdump import * from deps.smb_exploit1 import * from deps.goldenPac import * from signal import alarm, signal, SIGALRM, SIGKILL from subprocess import Popen, PIPE import threading import smbexec2 from S...
SurveillanceSystem.py
# Surveillance System Controller. # Brandon Joffe # 2016 # Copyright 2016, Brandon Joffe, 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/l...
test_consumer_group.py
import collections import logging import threading import time import pytest from kafka.vendor import six from kafka.conn import ConnectionStates from kafka.consumer.group import KafkaConsumer from kafka.coordinator.base import MemberState, Generation from kafka.structs import TopicPartition from test.fixtures impor...
switch_component.py
"""This module contains the SwitchComponent type.""" import threading from raspy.argument_null_exception import ArgumentNullException from raspy.invalid_operation_exception import InvalidOperationException from raspy.object_disposed_exception import ObjectDisposedException from raspy.components.switches import switch...
umb_producer.py
#!/usr/bin/env python2 import base64 import json import logging import ssl import subprocess import sys import threading import click import requests from rhmsg.activemq.producer import AMQProducer from rhmsg.activemq.consumer import AMQConsumer # Expose errors during signing for debugging logging.basicConfig(stream...
doh-cache-fork.py
#!/usr/bin/env python3 import asyncio import types, time import random, struct import argparse, logging import dns.resolver import dns.message import socket import threading import multiprocessing as mp import aioprocessing as aiomp import multiprocessing.managers # Attempt to use uvloop if installed for extra perform...
kingdom_monkeys.py
""" Codemonk link: https://www.hackerearth.com/practice/algorithms/graphs/depth-first-search/practice-problems/algorithm/kingdom-of-monkeys/ This is the story in Zimbo, the kingdom officially made for monkeys. Our Code Monk visited Zimbo and declared open a challenge in the kingdom, thus spoke to all the monkeys: You ...
impl_rabbit.py
# Copyright 2011 OpenStack Foundation # # 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 l...
run.py
import cv2 import threading import sys from PyQt5 import QtWidgets from PyQt5 import QtGui from PyQt5 import QtCore import visualize running = False def run(): global running cap = cv2.VideoCapture(0) width = cap.get(cv2.CAP_PROP_FRAME_WIDTH) height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT) label.resiz...
tnode.py
import paramiko import threading import sys import os import time import container import tutils import exceptions # Utility function to run ssh def ssh_exec_thread(ssh_object, command): print "run: " + command stdin, stdout, stderr = ssh_object.exec_command(command) out = stdout.readlines() print out ...
porn_prediction.py
import sys,os sys.path.append("..") import numpy as np import tensorflow as tf from example import bert_classifier_estimator from bunch import Bunch from data_generator import tokenization from data_generator import tf_data_utils from model_io import model_io from example import feature_writer, write_to_tfrecords, clas...
main.py
#! /usr/bin/env python import importlib import os import logging import tempfile import signal import shutil import time import sys import threading import json import optparse import email import subprocess import hashlib import yaml import requests import coloredlogs import alexapi.config import alexapi.tunein as ...
monitor_all_redis.py
import datetime import threading import redis import config class Monitor(): def __init__(self, connection_pool): self.connection_pool = connection_pool self.connection = None def __del__(self): try: self.reset() except: pass def reset(self): ...
multistart_solvers.py
""" This module defines solvers that use multiple starting points in order to have a higher chance at finding the global minimum. """ from . import utils, logging from .solvers import Solver, default_solver import numpy as np import scipy as sp import scipy.optimize from qsrs import native_from_object import time from ...
idf_monitor.py
#!/usr/bin/env python # # esp-idf serial output monitor tool. Does some helpful things: # - Looks up hex addresses in ELF file with addr2line # - Reset ESP32 via serial RTS line (Ctrl-T Ctrl-R) # - Run "make (or idf.py) flash" (Ctrl-T Ctrl-F) # - Run "make (or idf.py) app-flash" (Ctrl-T Ctrl-A) # - If gdbstub output is...
trustedcoin.py
#!/usr/bin/env python # # Electrum - Lightweight Bitcoin Client # Copyright (C) 2015 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...
_wsio.py
# -*- coding: utf-8 -*- from ._events import EventEmitter import websocket import Queue as queue import _packet import threading import signal import six original_signal_handler = None connected_clients = [] OPCODE_CONT = 0x0 OPCODE_TEXT = 0x1 OPCODE_BINARY = 0x2 OPCODE_CLOSE = 0x8 OPCODE_PING = 0x9 OPCODE_PONG = 0...
events.py
from threading import Thread class Events: def _handle(self, function: object, wrapper: object) -> None: data = function() while True: _data = function() if data != _data: wrapper(_data) data = _data def listen(self, *args: object) -> ob...
test_ai2thor_wrapper.py
""" Tests related to the ai2thor environment wrapper. """ import random import threading import time import unittest import warnings import ai2thor.controller from gym_ai2thor.envs.ai2thor_env import AI2ThorEnv class TestAI2ThorEnv(unittest.TestCase): """ General environment generation tests """ def ...
issue_6642.py
#!/usr/bin/env python # https://bugs.python.org/issue6642 import os, sys, time, threading def worker(): childpid = os.fork() if childpid != 0: # Parent waits for child. os.waitpid(childpid, 0) else: # Child spawns a daemon thread and then returns immediately. def daemon():...
dirstructure.py
from __future__ import print_function from __future__ import absolute_import ################################################################################ # RelMon: a tool for automatic Release Comparison # https://twiki.cern.ch/twiki/bin/view/CMSPublic/RelMon # # # ...