source
stringlengths
3
86
python
stringlengths
75
1.04M
subprocess_server_test.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...
_project.py
import logging import time import uuid import openpnm import numpy as np from copy import deepcopy from openpnm.utils import HealthDict, Workspace from openpnm.utils import SettingsAttr from ._grid import Tableist logger = logging.getLogger(__name__) ws = Workspace() __all__ = [ 'Project', ] class ProjectSe...
pantsd_integration_test.py
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import datetime import os import re import signal import threading import time import unittest from textwrap import dedent import pytest from pants.testutil.pants_integration_test import...
Test_1.py
import cv2 import sys import dlib import time import socket import struct import numpy as np import tensorflow as tf from win32api import GetSystemMetrics import win32gui import sys from threading import Thread, Lock import multiprocessing as mp from config import get_config import pickle import math im...
uWServer.py
#!/bin/env python3 ''' ''' # 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 ...
spinner.py
# Copyright 2020 The Pigweed 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
start_kernel.py
# start compatibility with IPython Jupyter 4.0 try: from jupyter_client import manager except ImportError: from IPython.kernel import manager # python3/python2 nonsense try: from Queue import Empty import Queue except: from queue import Empty import queue as Queue from collections import Order...
xla_client_test.py
# Lint as: python3 # 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 ...
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...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def home(): return "Bot must be working" def run(): app.run(host='0.0.0.0',port=8080) def keep_alive(): t = Thread(target=run) t.start()
page.py
from .utils import encode_attr from .control import Control from .control_event import ControlEvent import json import threading class Page(Control): def __init__(self, conn, url): Control.__init__(self, id="page") self.__conn = conn self.__conn.on_event = self.__on_event self...
run.py
''' Run app + MQTT packet handler modules using multithreading ''' import sys import threading # Add app and mqtt folders to PATH sys.path.append("./app") sys.path.append("./mqtt") # These need to be after adding to the PATH, so exclude from formatting from mqtt_main import start as mqtt_start # nopep8 from app imp...
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...
x.py
import argparse import asyncio import importlib.util import logging import warnings import os import signal import traceback from multiprocessing import get_context from typing import List, Text, Optional, Tuple, Union, Iterable import aiohttp import ruamel.yaml as yaml import rasa.cli.utils as cli_utils import rasa....
Village-Spider-Test.py
# coding: utf-8 # # 居委会信息获取爬虫测试 # 由于居委会的数据量过大,我这里用很小的数据测试其代码是否正确。 import requests from lxml import etree import csv import time import pandas as pd from queue import Queue from threading import Thread from fake_useragent import UserAgent # 下面加入了num_retries这个参数,经过测试网络正常一般最多retry一次就能获得结果 def getUrl(url,num_retries = 5...
main.py
# -*- coding: utf-8 -*- """ Created on Tue Jul 11 18:48:04 2017 @author: Yugal """ from keras.models import model_from_json from keras.preprocessing.image import ImageDataGenerator import cv2 import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np import threading fro...
benchmark.py
""" **benchmark** module handles all the main logic: - load specified framework and benchmark. - extract the tasks and configure them. - create jobs for each task. - run the jobs. - collect and save results. """ from copy import copy from enum import Enum from importlib import import_module, invalidate_caches import l...
test_nntplib.py
import io import socket import datetime import textwrap import unittest import functools import contextlib import os.path import re import threading from test import support from test.support import socket_helper from nntplib import NNTP, GroupInfo import nntplib from unittest.mock import patch try: import ssl exc...
clientserver.py
# -*- coding: UTF-8 -*- """Module that implements a different threading model between a Java Virtual Machine a Python interpreter. In this model, Java and Python can exchange resquests and responses in the same thread. For example, if a request is started in a Java UI thread and the Python code calls some Java code, t...
main_with_threading.py
from classes import ImageData from classes import AlgorithmSpace from classes.AlgorithmSpace import AlgorithmSpace from classes import AlgorithmParams from classes import FileClass from classes.FileClass import FileClass from classes import GeneticHelp from classes.GeneticHelp import GeneticHelp as GA from classes im...
test_streams.py
"""Tests for streams.py.""" import gc import os import queue import socket import sys import threading import unittest from unittest import mock try: import ssl except ImportError: ssl = None import asyncio from asyncio import test_utils class StreamReaderTests(test_utils.TestCase): DATA = b'line1\nlin...
multicore.py
import logging import random from multiprocessing import Process, Queue import cloudpickle as pickle import numpy as np from jabbar import jabbar from .multicorebase import MultiCoreSampler, get_if_worker_healthy from .singlecore import SingleCoreSampler logger = logging.getLogger("ABC.Sampler") SENTINEL = None d...
webcamstream.py
from threading import Thread import cv2 class WebcamStream: def __init__(self, src=0, name="WebcamStream"): self.stream = cv2.VideoCapture(src) (self.grabbed, self.frame) = self.stream.read() self.name = name self.stopped = False def start(self): t = Thread(target=self.update, name=self.name, args=()) ...
dosep.py
""" Run the test suite using a separate process for each test file. Each test will run with a time limit of 10 minutes by default. Override the default time limit of 10 minutes by setting the environment variable LLDB_TEST_TIMEOUT. E.g., export LLDB_TEST_TIMEOUT=10m Override the time limit for individual tests by s...
hanse_atmega_ros.py
#!/usr/bin/env python import roslib roslib.load_manifest('hanse_atmega_ros') import rospy import serial import struct import sys import exceptions from time import sleep from threading import Thread from hanse_msgs.msg import pressure from hanse_msgs.msg import temperature from hanse_msgs.msg import sollSpeed from std_...
fault_tolerance_test.py
# Lint as: python3 # 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 requ...
sumo_multi_clients.py
import os import random import subprocess import threading import time from smarts.core.utils.sumo import sumolib, traci, SUMO_PATH PORT = 8001 """ Conclusions: 1. connected clients < num-clients: SUMO will block, only start once all clients have connected. 2. connected clients > num-clients: Extra connection will b...
threadDemo.py
#! python3 # This is a test for multithreaded programs. import threading import time print('Start of program.') def takeANap(): time.sleep(5) print('WAKE UP') threadObj = threading.Thread(target=takeANap) threadObj.start() print('End of program.')
server.py
import socket import threading clients = [] nicknames = [] ip="127.0.0.1" port=55556 server=socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((ip, port)) server.listen() def broadcast(message): for client in clients: client.send(message) def handler(client): while True: t...
A3C_RNN.py
""" Asynchronous Advantage Actor Critic (A3C) + RNN with continuous action space, Reinforcement Learning. The Pendulum example. View more on my tutorial page: https://morvanzhou.github.io/tutorials/ Using: tensorflow 1.8.0 gym 0.10.5 """ import multiprocessing import threading import tensorflow as tf import numpy a...
DistortionCorrection.py
#!/usr/bin/env python #coding: utf-8 """ Tango device server for setting up pyFAI azimuthal integrator in a LImA ProcessLib. Destination path: Lima/tango/plugins/DistortionCorrection """ __author__ = "Jérôme Kieffer" __contact__ = "Jerome.Kieffer@ESRF.eu" __license__ = "GPLv3+" __copyright__ = "European Synchrotron Ra...
data_handler.py
from __future__ import division, print_function import pandas as pd import numpy as np import multiprocessing import glob import resource import time import timeit import os import ruamel.yaml as yaml from dnn_reco import misc from dnn_reco import detector class DataHandler(object): """Data handler for IceCube s...
datasets.py
import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image, ExifTags from torch.utils.data import Dataset from tqdm import tqdm from ..utils.utils import xyxy2xywh, xywh2xyxy help_url...
add_code_to_python_process.py
r''' Copyright: Brainwy Software Ltda. License: EPL. ============= Works for Windows relying on a fork of winappdbg which works in py2/3 (at least for the part we're interested in). See: https://github.com/fabioz/winappdbg (py3 branch). Note that the official branch for winappdbg is: https://github.com/MarioVilas/wi...
app_monitor.py
import time from multiprocessing import Process import os from parsl.monitoring.db_logger import get_db_logger def monitor(pid, task_id, monitoring_config, run_id): """Internal Monitors the Parsl task's resources by pointing psutil to the task's pid and watching it and its children. """ import psutil ...
kink.py
import time, subprocess, os.path, re, multiprocessing, threading, json from selenium import webdriver from selenium.common.exceptions import TimeoutException from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait class Kink: driver = None dispatcher_t...
clichat.py
import socket import random from threading import Thread from datetime import datetime from colorama import Fore, init, Back from win10toast import ToastNotifier # init colors init() # set the available colors colors = [Fore.BLUE, Fore.CYAN, Fore.GREEN, Fore.LIGHTBLACK_EX, Fore.LIGHTBLUE_EX, Fore.LIG...
named_pipe.py
""" RPC client/server implementation based on named pipe transport. """ import json import logging import os import socket import struct from threading import Thread import queue from .client import SearpcClient from .server import searpc_server from .transport import SearpcTransport from .utils import make_socket_cl...
util.py
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 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...
keylogger.py
# Date: 09/30/2018 # Author: Pure-L0G1C # Description: Keylogger from threading import Thread from pynput.keyboard import Key, Listener class Keylogger(object): def __init__(self): self.data = [] self.lastkey = None self.listener = None self.is_alive = True self.num_to_sy...
sync.py
# # Copyright (C) 2008 The Android Open Source Project # # 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 la...
recover_server.py
#!/usr/bin/env python """ Script used to recover testbed servers after reboot/upgrade/black-out. - Cleanup server - Start vms - Add topos - Deploy minigraphs """ from __future__ import print_function import argparse import collections import datetime import imp import logging import os import subprocess...
scheduler.py
import typing import select import threading import pathos.helpers as mph from .worker import Worker from .task import Task class Scheduler: def __init__(self, num_workers: int = 1) -> None: self.num_workers: int = num_workers self.result_queue = mph.mp.Queue() self.result_thread = thread...
testThreads.py
import unittest from .threads import * def f1(): pass def f2(stop_event): pass def f3(**kwargs): pass run_last = 0.05 wait_exit = 1 class WhiteBox(unittest.TestCase): def test_parameter(self): def test0(Thread): def test(func, noerror, event_name=None, kwargs=None): ...
cluster.py
""" Higher-level abstraction to start elasticsearch using the elasticsearch binary. Here's how you can use it: import time import threading cluster = ElasticsearchCluster(7541) def monitor(): cluster.wait_is_up() print('elasticsearch is up!', cluster.health()) threading.Thread(ta...
amqpdriver.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 agr...
surveillance_camera.py
''' Surveillance Camera module ''' import io import glob from http import server as httpServer import json import numpy as np import os import socketserver import time import threading from threading import Condition import picamera from picamera.array import PiMotionAnalysis class StreamingOutput(): ''' Stre...
core_agent_state_test.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 ...
jsview_3d.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from libtbx.math_utils import roundoff import traceback from cctbx.miller import display2 as display from cctbx.array_family import flex from cctbx import miller, sgtbx from scitbx import graphics_utils from scitbx import matrix im...
extract_bbox.py
import argparse import os import time from functools import partial from math import ceil from multiprocessing import Pool, Process, Queue from os.path import join, exists import numpy as np import tensorflow as tf from numpy.lib.format import read_array_header_1_0, read_magic from tqdm import tqdm from config import...
test_thread.py
# Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the Apache 2.0 License. # See the LICENSE file in the project root for more information. import sys import _thread as thread import time import unittest from iptest import is_cli, run_test, skipUnless...
io.py
# -*- coding: utf-8 -*- # Copyright (C) 2012 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause from __future__ import absolute_import, division, print_function, unicode_literals from collections import defaultdict from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, Executor, Future, _base, as_c...
process.py
from .logging import debug, exception_log from .typing import Any, List, Dict, Callable, Optional, IO import os import shutil import subprocess import threading def add_extension_if_missing(server_binary_args: List[str]) -> List[str]: if len(server_binary_args) > 0: executable_arg = server_binary_args[0] ...
crawler.py
import requests import time import json import re import os import threading from settings import KEYWORD,productdb,simildb,cookiedb from openpyxl import Workbook from multiprocessing import Process, JoinableQueue class Crawler(): def __init__(self, salenum, threadnum, logMessage, errMessage): self.db = p...
main.py
# necessary imports import socket import logging import threading import time import RPi.GPIO as GPIO import camera_stream # setup the pins to use the BCM mode and disable GPIO warnings GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) message = "" distance = 0.0 speed = 0 ultra_trig = 22 # ultrasonic trigger pin number...
twitter_bot.py
from numpy.core.defchararray import array from savedata import query_list_url_get_taxids,save_officer_detail_record_to_file_with_tax_id_and_filter_number from prepdata import return_json_from_file,get_string_date_and_arrest_type_from_arrest,save_list_to_csv,get_date_object_string_date import os import threading import...
shell.py
import io import shlex import subprocess import threading import re import signal import warnings import os NON_BLOCKING_ERROR_MESSAGE = "This method cannot be called on blocking shell commands" class ShellCommand(): """ DEPRECATED: Please use `sh.py <https://amoffat.github.io/sh/>`_ instead Abstraction...
agent_dqn.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import random import numpy as np from collections import deque, namedtuple import os import torch import torch.nn.functional as F import torch.optim as optim import math from itertools import count import gc from agent import Agent from dqn_model import DQN from dueling_dq...
yaml_dip.py
import yaml import hashlib import requests import threading import binascii from datetime import datetime def find(d, tag): """ Recurse a YAML structure for tagging. """ if tag in d: yield d[tag] for k, v in d.items(): if isinstance(v, dict): for i in find(v, tag): ...
test_gui_plate_scrolledtext.py
import cv2 import tkinter from PIL import ImageTk, Image from tkinter import ttk # import tkinter 와 다른 명령이다. from tkinter import scrolledtext from tkinter import filedialog # @@ tkinter.filedialog import threading import time import tkinter.font as tkFont def display_database(str): global flag while 1: ...
wifijammer.py
#!/usr/bin/env python import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) # Shut up Scapy from scapy.all import * conf.verb = 0 # Scapy I thought I told you to shut up import os import sys from time import sleep from threading import Thread, Lock from subprocess import Popen, PIPE from signal imp...
test_debug.py
import importlib import inspect import os import re import sys import tempfile import threading from io import StringIO from pathlib import Path from unittest import mock from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection from djan...
qa_service.py
import threading import logging from websocket_server import WebsocketServer """ WebSocket service Runs on a separate thread, supports multiple clients """ class QAService: def __init__(self, q): self.name = "" self._q = q self._answer = "" def _run_thread(self): # Initializes ...
http_com.py
from __future__ import print_function import base64 import copy import json import logging import os import random import ssl import sys import threading import time from builtins import object from builtins import str from flask import Flask, request, make_response, send_from_directory from pydispatch import dispatc...
nntest_direct.py
from __future__ import print_function import tensorflow as tf from .nn import linearND, linear from .models import * from .ioutils_direct import * import math, sys, random from collections import Counter from optparse import OptionParser from functools import partial import threading from multiprocessing import Queue i...
utils.py
import os import sys import time import random import socket import struct import inspect import threading from collections import deque from itertools import islice from tempfile import mkstemp import subprocess from logger import Logger class Utils(object): def __init__(self, dry=False, logger=None): s...
test_socket_manager.py
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import time import uuid from unittest import mock from parlai.mturk.core.socket_manager import Packet, S...
test_urllib.py
"""Regresssion tests for urllib""" import collections import urllib import httplib import io import unittest import os import sys import mimetools import tempfile from test import test_support from base64 import b64encode def hexescape(char): """Escape char as RFC 2396 specifies""" hex_repr = hex(ord(char))...
test_orchestrate.py
# Copyright 2021 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
test_kudu.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_gateway.py
import functools import time from threading import Thread import numpy as np import pytest import requests from jina.enums import CompressAlgo from jina.executors.encoders import BaseEncoder from jina.flow import Flow from tests import random_docs concurrency = 10 class DummyEncoder(BaseEncoder): def encode(se...
bmv2.py
# coding=utf-8 """ Copyright 2019-present Open Networking 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 la...
config_server.py
#!/usr/bin/env python3 import json import threading import cgi import urllib.parse import os try: from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer except ImportError: from http.server import BaseHTTPRequestHandler, HTTPServer from dcnow import CONFIGURATION_FILE, scan_mac_address class DreamPi...
monitor.py
import re import os import configparser import json import logger import select import psutil import socket import subprocess import requests import time import threading from monitor import util, resources, metrics from socket import gethostname from bottle import Bottle, response, request app = Bottle() globalWatch...
hotplug.py
# SPDX-License-Identifier: Apache-2.0 # # Copyright (C) 2021, Arm Limited and contributors. # # 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 # # ...
build.py
## @file # build a platform or a module # # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR> # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD Li...
power_monitoring.py
import random import threading import time from statistics import mean from typing import Optional from cereal import log from common.params import Params, put_nonblocking from common.realtime import sec_since_boot from selfdrive.hardware import HARDWARE from selfdrive.swaglog import cloudlog CAR_VOLTAGE_LOW_PASS_K =...
via_app_data.py
"""Bootstrap""" from __future__ import absolute_import, unicode_literals import logging from contextlib import contextmanager from functools import partial from threading import Lock, Thread from virtualenv.info import fs_supports_symlink from virtualenv.seed.embed.base_embed import BaseEmbed from virtualenv.seed.emb...
keep_alive.py
from flask import Flask from threading import Thread app = Flask('') @app.route('/') def main(): return "Running" def run(): app.run(host="0.0.0.0", port=9000) def keep_alive(): server = Thread(target=run) server.start()
test_106_shutdown.py
# # mod-h2 test suite # check HTTP/2 timeout behaviour # import time from threading import Thread import pytest from h2_conf import HttpdConf from h2_result import ExecResult class TestShutdown: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env): conf = HttpdConf(env) ...
Simulator.py
import dash import dash_core_components as dcc import dash_html_components as html from dash_callback_conglomerate import Router from dash.dependencies import Input, Output, State import dash.exceptions from threading import Thread import pandas as pd from dash.exceptions import PreventUpdate from adafruit_servokit imp...
test_poplib.py
"""Test script for poplib module.""" # Modified by Giampaolo Rodola' to give poplib.POP3 and poplib.POP3_SSL # a real test suite import poplib import asyncore import asynchat import socket import os import time import errno from unittest import TestCase, skipUnless from test import support as test_support threading ...
signals.py
from django.db.models.signals import post_save from django.dispatch import receiver from django.contrib.auth import get_user_model from todo_app.models import Verification from todo_app.tasks import send_verification_email,send_forget_password from threading import Thread # User = get_user_model() # @receiver(post_save...
gui.py
import threading from pathlib import Path from tkinter import CENTER, DISABLED, NORMAL, E, N, S, StringVar, Tk, W, filedialog, ttk from smallvid.main import Compress from smallvid import utils class CV_GUI(Tk): def __init__(self) -> None: super().__init__() self.title("Compress Video") ma...
main_window.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import atexit import os import sys import time import json import logging import signal import socket import threading import configparser import platform #from tkinter import filedialog#, ttk #import tkinter import numpy as np from . import widgets import pyqtgraph as pg...
fake.py
# This file is Copyright (c) 2010 by the GPSD project # BSD terms apply: see the file COPYING in the distribution root for details. """ gpsfake.py -- classes for creating a controlled test environment around gpsd. The gpsfake(1) regression tester shipped with GPSD is a trivial wrapper around this code. For a more int...
lisp.py
# ----------------------------------------------------------------------------- # # Copyright 2013-2019 lispers.net - Dino Farinacci <farinacci@gmail.com> # # 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...
engram.py
#!/usr/bin/env python3 import os import time import sys import sql import queue import routes import signal import threading from request_url import request_url from db import Database, WriteJob, ReadJob from result import Ok, Err, Result from flask import Flask, redirect, url_for, request ...
zmqLockServer.py
import zmq import time import sys import psutil import threading import logging import logzero from logzero import logger logzero.loglevel(logging.INFO) port = "5556" context = zmq.Context() socket = context.socket(zmq.REP) socket.bind("tcp://*:%s" % port) LOCKS = {'default': [False, 0]} def process_lock(key, messa...
fn_api_runner.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...
game.py
from tkinter import * from threading import Thread, Lock import math from agility.gait import Dynamic from cerebral.pack1.hippocampus import Android from agility.main import Agility import time, math # Robot by reference. robot = Android.robot agility = Agility(robot) # Generic crawl. crawl = Dynamic(robot) # Tkint...
test_fx.py
import builtins import contextlib import copy import functools import inspect import math import numbers import operator import os import pickle import sys import torch import traceback import warnings import unittest from math import sqrt from pathlib import Path from torch.multiprocessing import Process from torch.te...
utils.py
# Copyright 2016 deepsense.ai (CodiLime, 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 agree...
threaded_port_scanner.py
import socket import threading import sys from queue import Queue print_lock = threading.Lock() def portscan(port): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) try: con = s.connect((sys.argv[1], port)) with print_lock: print('port', port, 'is open') con.close() ...
test_memory.py
import ctypes import gc import pickle import threading import unittest import fastrlock import pytest import cupy.cuda from cupy.cuda import device from cupy.cuda import memory from cupy.cuda import stream as stream_module from cupy import testing class MockMemory(memory.Memory): cur_ptr = 1 def __init__(s...
package.py
import os import threading import uuid import yaml from django.db import models from common.models import JsonTextField from django.utils.translation import ugettext_lazy as _ from kubeoperator.settings import PACKAGE_DIR from kubeops_api.package_manage import * logger = logging.getLogger('kubeops') __all__ = ['Packa...
unit.py
import os import re import ssl import sys import json import time import shutil import socket import select import platform import tempfile import unittest import subprocess from multiprocessing import Process class TestUnit(unittest.TestCase): pardir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.p...
batch_task.py
from __future__ import print_function import os import time import numpy as np from multiprocessing import Process, Queue, Lock lock = Lock() class TaskState(object): """ Each task has three states: "Done!", "Started!", "Unstarted!" """ def __init__(self, taskname): self.taskname = taskname ...
SquidMap.py
import socket, threading, sys, ipaddress, time, os from optparse import OptionParser from scapy.all import * class Port_Scanner: def __init__(self, ip, ports): self.ip = str(ip) self.logfile = "squidmap.txt" file = open(self.logfile,"w") file.close() self.isnetwork =...
Chat Server.py
# this is the server that the clients will connect to import socket from threading import Thread import time # intial setup of the server and creation of the socket host = "128.237.162.118" ###INSERT IP ADDRESS HERE### <<<<<<<<<--------------||||||| port = 5555 s = socket.socket(socket.AF_INET, socket.SOCK_S...