source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
psychopyfreezeapp.py | from PyQt5.QtWidgets import QMainWindow, QFileDialog, QLabel, QPushButton, QWidget, QMessageBox, QLineEdit
from PyQt5.QtCore import QSize
from psychopyfreezelib import PsychopyFreezeLib
import os
import threading
class PsychopyFreezeApp(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
... |
plotter.py | import rospy
import numpy as np
from sensor_msgs.msg import Image
from std_srvs.srv import SetBool, SetBoolResponse
import cv2
from cv_bridge import CvBridge
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
import matplotlib
import threading
class Plotter:
'''Publish... |
ts_mon_config.py | # Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper for inframon's command-line flag based configuration."""
from __future__ import print_function
import argparse
import contextlib
import multi... |
cpuinfo.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2014-2019, Matthew Brennan Jones <matthew.brennan.jones@gmail.com>
# Py-cpuinfo gets CPU info with pure Python 2 & 3
# It uses the MIT License
# It is hosted at: https://github.com/workhorsy/py-cpuinfo
#
# Permission is hereby granted, free of charge, to an... |
core.py | # -*- coding: utf-8 -*-
#
# 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
... |
test_datasets.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... |
utils.py | from bitcoin.rpc import RawProxy as BitcoinProxy
from btcproxy import BitcoinRpcProxy
from collections import OrderedDict
from decimal import Decimal
from ephemeral_port_reserve import reserve
from lightning import LightningRpc
import json
import logging
import lzma
import os
import random
import re
import shutil
impo... |
test_base.py | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
import collections
import ctypes
import unittest
from decimal import Decimal
import threading
import ijson
from ijson import common, compat
from ijson.compat import b2s, IS_PY2
import warnings
JSON = b'''
{
"docs": [
{
"null": null,
"bo... |
diskcache_manager.py | import platform
from dash_labs.plugins.long_callback.managers import BaseLongCallbackManager
class DiskcacheCachingCallbackManager(BaseLongCallbackManager):
def __init__(self, cache, cache_by=None, expire=None):
import diskcache
if not isinstance(cache, diskcache.Cache):
raise ValueEr... |
base_consumer.py | # -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/8/8 0008 13:11
"""
所有中间件类型消费者的抽象基类。使实现不同中间件的消费者尽可能代码少。
整个流程最难的都在这里面。因为要实现多种并发模型,和对函数施加20运行种控制方式,所以代码非常长。
"""
import typing
import abc
import copy
from pathlib import Path
# from multiprocessing import Process
import datetime
# noinspection PyUnresolvedReference... |
gossip.py | import sys
import time
import socket
import threading
class Gossip:
infected_nodes = set()
def __init__(self, host:str, port:int, connected_nodes:set):
'''
Inicializa las variables a utilizar e inicia los hilos.
Espera el host, el puerto y los puertos conectados a el.
'''
... |
data_utils.py | """
Miscellaneous functions manage data.
Date: September 2018
Author: Ignacio Heredia
Email: iheredia@ifca.unican.es
Github: ignacioheredia
"""
import os
import threading
from multiprocessing import Pool
import queue
import subprocess
import warnings
import base64
import numpy as np
import requests
from tqdm import ... |
Parallel_methods.py | #!/usr/bin/python
import multiprocessing as mp
import numpy as np
import time
data = ""
list_method = ["no", "starmap", "parallel"]
def main_script():
global min_check
global max_check
if __name__ == '__main__':
restart = ""
method = ""
method_chosen = False
... |
detect.py | # detect.py
import os
import base64
import json
import pyaudio
import pygame
import requests
import wave
import time
import datetime
import numpy as np
from pocketsphinx import LiveSpeech
from multiprocessing import Process
import psutil
CHUNK = 1024 # 每个缓冲区的帧数
FORMAT = pyaudio.paInt16 # 采样位数
CHANNE... |
__init__.py | import hashlib
import platform as _platform_module
import os
from copy import copy, deepcopy
from contextlib import _RedirectStream, suppress
from functools import wraps
from io import StringIO
from threading import Thread
from typing import BinaryIO, Callable, Generator, Iterable, List, Tuple, TypeVar
is_being_run_fro... |
menu.py | #!/usr/bin/python3
import time
import sys
import glob
import serial
import re
import threading
import queue
import os
from logging import getLogger, StreamHandler, FileHandler, Formatter, DEBUG
logger = getLogger(__name__)
logger.setLevel(DEBUG)
stream_formatter = Formatter('%(message)s')
stream_handler = StreamHand... |
_exploit_generation.py | """
filename: _exploit_generation.py
author: ww9210
This plugin is used to reproduce the gadget chain and generate concrete payload discovered in previous phase.
We do not generate concrete payload during exploration because such constraint solving will eat a lot of memeoy space
This file does not handle the detail of ... |
demo09.py | # -*- coding: utf-8 -*-
from multiprocessing import Process, freeze_support
def f():
print('hello world')
if __name__ == '__main__':
freeze_support()
Process(target=f).start()
|
thread_utils.py | # This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2011-2015, Michigan State University.
# Copyright (C) 2015-2016, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fol... |
run_nvmf.py | #!/usr/bin/env python3
from json.decoder import JSONDecodeError
import os
import re
import sys
import argparse
import json
import zipfile
import threading
import subprocess
import itertools
import configparser
import time
import uuid
from collections import OrderedDict
import paramiko
import pandas as pd
import rpc
... |
reset2.py | #!/usr/bin/env python
from scapy.all import *
import argparse
import time
import threading
timer1=0.0
timer2=0.0
timer1_set=False
timer2_set=False
tcpData1={}
tcpData2={}
def watchdog():
global timer1_set
global timer2_set
global timer1
global timer2
global tcpData1
global tcpData2
print... |
tpu_estimator.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... |
scripts.py | # -*- coding: utf-8 -*-
"""
This module contains the function calls to execute command line scripts
"""
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import functools
import logging
import os
import signal
import sys
import threading
import time
import traceback
from ra... |
imap.py | """
Display number of unread messages from IMAP account.
Configuration parameters:
allow_urgent: display urgency on unread messages (default False)
auth_scope: scope to use with OAuth2 (default 'https://mail.google.com/')
auth_token: path to where the pickled access/refresh token will be saved
afte... |
nng.py | """
Provides a Pythonic interface to cffi nng bindings
"""
import logging
import threading
import atexit
import pynng
from ._nng import ffi, lib
from .exceptions import check_err
from . import options
from . import _aio
logger = logging.getLogger(__name__)
__all__ = '''
ffi
Bus0
Pair0
Pair1
Pull0 Push0
Pub0 Sub0
... |
webhook.py | from bottle import route, run, request, response, default_app
import json
import msbot.constants
import msbot.mslib
import msbot.msdb
import requests
import time
import msbot.settings
import sqlite3
from threading import Thread
db_file = msbot.settings.DB_LOCATION
# Helpers
def send_message(sender_psid, response):
... |
server.py | # Date: 06/01/2018
# Author: Pure-L0G1C
# Description: Server
import ssl
import socket
from os import path
from lib import const
from time import sleep
from queue import Queue
from OpenSSL import crypto
from random import SystemRandom
from threading import Thread, RLock
from . lib import session, shell, i... |
okcoinGateway.py | # encoding: UTF-8
'''
vn.okcoin的gateway接入
注意:
1. 前仅支持USD和CNY的现货交易,USD的期货合约交易暂不支持
'''
import os
import json
from datetime import datetime
from copy import copy
from threading import Condition
from queue import Queue
from threading import Thread
from vnpy.api.okcoin import vnokcoin
from vnpy.trade... |
QRLJacker.py | #!/usr/bin/env python
#-*- encoding:utf-8 -*-
#Author: @D4Vinci
import base64 ,time ,os ,urllib ,sys ,threading
from binascii import a2b_base64
def clear():
if os.name == "nt":
os.system("cls")
else:
os.system("clear")
try:
from PIL import Image
import selenium, requests, configparser
from selenium import we... |
test_monitor.py | from __future__ import annotations
import asyncio
import sys
import time
from contextlib import contextmanager
from threading import Thread
from typing import Generator
import pytest
from pytest_mock import MockerFixture
import loopmon
@contextmanager
def with_event_loop() -> Generator[asyncio.AbstractEventLoop, N... |
globalhook.py | # -*- coding: utf-8 -*-
import ctypes
from os.path import join, dirname, abspath
INVALID_VALUE = 0xffff
WM_IMESUPPORT_SET_INLINE_POSITION = -1
imesupport_dll = None
def setup(arch_x64, dll_dir=dirname(dirname(abspath(__file__)))):
# Default DLL location: ../imesupport_hook_xxx.dll
global imesupport_dll
... |
dev_orb_plugin.py | #!/usr/bin/python
import os
import sys
import pickle
import time
import subprocess
import threading
import shutil
from pyon.public import CFG
class DataAgentPrototype():
def __init__(self, plugin):
self.sampling_gl = None
self.sampling_gl_done = None
self.plugin = plugin
self.str... |
base_touch.py | # -*- coding: utf-8 -*-
import threading
import time
import six
from six.moves import queue
from airtest.utils.logger import get_logger
from airtest.utils.snippet import (on_method_ready, ready_method, reg_cleanup, kill_proc)
LOGGING = get_logger(__name__)
class BaseTouch(object):
"""
A super class for Mini... |
minecraft.py | import asyncio
import dotenv as de
import multiprocessing as mp
import multiprocessing.connection as mpc
import os
import re
import subprocess as sp
import threading
import time
__all__ = ['Minecraft']
# Consts
DISCORD_MSG_LEN_MAX = 1990 # Leave a little room for error
# Load Env
de.load_dotenv()
SECRET = str.encode... |
kblogging.py | """
Common narrative logging functions.
To log an event with proper metadata and formatting use 'log_event':
You can also do free-form logs, but these will be ignored by
most upstream consumers.
"""
__author__ = 'Dan Gunter <dkgunter@lbl.gov>'
__date__ = '2014-07-31'
import collections
import logging
from logging ... |
control.py | import asyncio
import os
import logging
from time import sleep
import aiohttp
from aiohttp import web
from threading import Thread
log = logging.getLogger(__name__)
def do_restart():
""" This is the (somewhat) synchronous method to use to do a restart.
It actually starts a thread that does the restart. `__w... |
rewind.py | import logging
import os
import shlex
import six
import subprocess
from threading import Lock, Thread
from .connection import get_connection_cursor
from .misc import parse_history, parse_lsn
from ..async_executor import CriticalTask
from ..dcs import Leader
logger = logging.getLogger(__name__)
REWIND_STATUS = type(... |
websocket.py | """
websocket - WebSocket client library for Python
Copyright (C) 2010 Hiroki Ohtani(liris)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, ... |
jsview_3d.py |
# TODO:
# - cached scenes
from __future__ import division
from libtbx.math_utils import roundoff
from cctbx.miller import display2 as display
from cctbx.array_family import flex
from scitbx import graphics_utils
from cctbx import miller
from libtbx.utils import Sorry
from websocket_server import WebsocketServer
impo... |
httpd.py | import hashlib
import os
import threading
from http.server import HTTPServer
from RangeHTTPServer import RangeRequestHandler
class TestRequestHandler(RangeRequestHandler):
checksum_header = None
def end_headers(self):
# RangeRequestHandler only sends Accept-Ranges header if Range header
# is ... |
test_threading_local.py | import unittest
from doctest import DocTestSuite
from test import test_support
import threading
import weakref
import gc
class Weak(object):
pass
def target(local, weaklist):
weak = Weak()
local.weak = weak
weaklist.append(weakref.ref(weak))
class ThreadingLocalTest(unittest.TestCase):... |
host-scanner.py | import ipaddress
import os
import socket
import struct
import sys
import threading
import time
SUBNET = '192.168.0.0/24'
# Signature to check in ICMP responses
MESSAGE = 'YAAAAAS'
class IP:
''' The struct module provides format characters to specify the sctructure of the binary data.
We use these format ... |
ray.py | #! /usr/bin/env python
# Copyright (c) 2019 Uber Technologies, 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 a... |
hdfs_utils.py | # Copyright (c) 2018 PaddlePaddle 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 app... |
multiprocessing_interprocess_communication_IPC.py | import time
import multiprocessing
result = []
def calc_square(numbers):
print('Calculating squares:')
for n in numbers:
print('square of {}: {}'.format(n, n * n))
result.append(n * n)
print('result within process: {}'.format(result))
if __name__ == '__main__':
arr = [2, 3, 8, 9]
... |
flib.py | from os import rename, path
from io import BytesIO
from random import randint
from time import sleep
import json
import tempfile
import os
import threading
from foxtrot.fconcmd import FConCommander
# DNS Resolver
import dns.resolver
import dns.update
import dns.query
import dns.tsigkeyring
from dns.tsig import HMAC_S... |
connection.py | import crypttools as crypt
import socket
import threading
import pickle
import handle
import time
class ErrorDisconnectedFromServer(Exception):
pass
class ErrorReceivingMessage(Exception):
pass
class ErrorSendingMessage(Exception):
pass
class ErrorMessageNotFromServer(Exception):
pass
class ErrorCo... |
bitcoind.py | import decimal
import json
import logging
import os
import threading
from cheroot.wsgi import Server
from decimal import Decimal
from ephemeral_port_reserve import reserve
from flask import Flask, request, Response
from test_framework.authproxy import AuthServiceProxy, JSONRPCException
from test_framework.utils import... |
service_streamer.py | # coding=utf-8
# Created by Meteorix at 2019/7/13
import logging
import multiprocessing
import os
import threading
import time
import uuid
import weakref
import pickle
from queue import Queue, Empty
from typing import List
from redis import Redis
from .managed_model import ManagedModel
TIMEOUT = 1
TIME_SLEEP = 0.001... |
multipro-1.py | #/usr/bin/env python
#coding=utf8
"""
# Author: kellanfan
# Created Time : Tue 18 Jul 2017 08:32:38 PM CST
# File Name: multipro-1.py
# Description:
"""
import os, urllib2
from multiprocessing import Process
urllist = ['http://www.jianshu.com/u/347ae48e48e3', 'https://stackedit.io/', 'http://man.chinaunix.net/develo... |
util.py | # Electrum - Lightweight SmartCash 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 limitation the rights... |
run_gate.py | # -*- coding: utf-8 -*-
#!/usr/bin/env python
import sys
import threading
import time
import logging
import logging.config
from slackbot import settings
from slackbot.bot import Bot
from ircbot.ircbot import IrcBot
def main():
kw = {
'format': '[%(asctime)s] %(message)s',
'datefmt': '%m/%d/%Y %H:... |
interfaces.py | import queue
from threading import Lock, Thread
class WorkerThread:
def __init__(self, dispatcher, data):
self.dispatcher = dispatcher
self.data = data
def run(self, dispatcher):
raise NotImplementedError
class Node:
def finishPipeline(self):
# Creates the... |
lnglat_homography.py | # Copyright (C) 2018-2019 David Thompson
#
# This file is part of Grassland
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of Grassland, including this file, may be copied, modified,
# propagated, or distributed except according to the ter... |
model.py | import glob
import json
import copy
import importlib
import threading
import logging
from logging.handlers import RotatingFileHandler
import pytz
#for tables
import numpy
import numpy as np
import datetime
import dateutil.parser
import sys
import os
import time
import uuid
import hashlib
import random
import traceback... |
manager.py | # Copyright 2018 IBM Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
Addressbook_server.py | # Import of libraries
import socket # Import main socket library
import atexit # Execute smething before exit
import multiprocessing # For multiple sockets
from Utils import * # General program utilities
from Database import Database
class Socket:
def __init__(self, port, db, pr, ui):
self.ui = ui
self.db = db
... |
crawler_multi_thread.py | # SJTU EE208
import threading
import queue
import string
import time
import re
import sys
import os
try:
from lxml import etree
from bs4 import BeautifulSoup
except ImportError:
print('Requirements not satisfied! Please run: pip install -r requirements.txt')
import urllib.request
import urllib.error
imp... |
gasprice.py | import os
import click
import logging
import pandas as pd
from time import sleep
from threading import Thread
from collections import deque
from statistics import mean
from itertools import chain
from web3 import Web3, HTTPProvider
from web3.middleware import geth_poa_middleware
from sanic import Sanic, response
from r... |
pep.py | import html
import inspect
import subprocess
import os
import re
import tempfile
import json
import traceback
import pprint
import threading
import time
import linecache
import pathlib
from urllib.parse import urlparse
from zipfile import ZipFile
from collections import defaultdict
import sublime_plugin
import sublim... |
aupy2.py | #!/usr/bin/env python
"""Aupy 2.0
Author: Paul deGrandis
Created: June 02 2008
Requires Python 2.5
Copyright (c) 2008 Paul deGrandis // aupy.org
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 w... |
SCPT_web_intf.py | from flask import Flask,render_template,request,send_file,Response,url_for
from btc_exploit import rsz_exploit, raw_tx
from google_dorking.google_dorl import GooGle_Dork
from vunlseac import cve, vlunse, gtfobins
from Phishing import test_cli22
import subprocess as sp
from os import system
import multiprocessing
from c... |
refactor.py | # Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Refactoring framework.
Used as a main program, this can refactor any number of files and/or
recursively descend down directories. Imported as a module, this
provides infrastructure to write your own refactoring too... |
server_rpc.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/server/server_rpc.py
#
# 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... |
event_bus.py | import json
import logging
import threading
from typing import List, Type
from kafka import KafkaConsumer
from fractal.core.command_bus.command_bus import CommandBus
from fractal.core.event_sourcing.event import ReceivingEvent
from fractal.core.event_sourcing.event_bus import EventBus
from fractal.core.event_sourcing... |
multiproc_camera.py | import os
import io
import time
import multiprocessing as mp
from queue import Empty
import picamera
from PIL import Image
class QueueOutput(object):
def __init__(self, queue, finished):
self.queue = queue
self.finished = finished
self.stream = io.BytesIO()
def write(self, buf):
... |
dist_autograd_test.py | import sys
import threading
import time
from enum import Enum
import random
import torch
import torch.nn as nn
from datetime import timedelta
import torch.distributed as dist
import torch.distributed.autograd as dist_autograd
import torch.distributed.rpc as rpc
import torch.testing._internal.dist_utils
from torch.autog... |
watch.py | from telegram.ext import CommandHandler, run_async
from telegram import Bot, Update
from bot import Interval, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, dispatcher, LOGGER
from bot.helper.ext_utils.bot_utils import setInterval
from bot.helper.telegram_helper.message_utils import update_all_messages, sendMessage... |
region.py | from __future__ import with_statement
import datetime
from functools import partial
from functools import wraps
from numbers import Number
import threading
import time
from decorator import decorate
from . import exception
from .api import CachedValue
from .api import NO_VALUE
from .backends import _backend_loader
f... |
compress_images.py | import re
from PIL import Image
import pandas as pd
import os
import threading
from_dir = '/media/tsamsiyu/985A6DDF5A6DBAA0/Users/Dmitry/Downloads/full-frames.tar/full-frames/rtsd-frames'
to_base_dir = 'images'
meta_csv_path = 'materials/full-gt.csv'
img_name_regex = re.compile('^autosave(\d\d)_(\d\d)_(\d\d\d\d)_(.+\... |
CTANLoad.py | #!/usr/bin/python3.8
# -*- coding: utf-8 -*-
# please adjust these two lines if necessary
# CTANLoad.py
# (C) Günter Partosch, 2019/2021
# Es fehlen noch bzw. Probleme:
# - unterschiedliche Verzeichnisse für XML- und PDF-Dateien? (-)
# - GNU-wget ersetzen durch python-Konstrukt; https://pypi.org/project/python3-wget... |
yeet_speech.py | #!/usr/bin/env python
import sys
sys.path.append("./snowboy/examples/Python/")
import snowboydecoder_arecord as snowboydecoder
import subprocess
import signal
import io
#import sys
import os
import serial
import multiprocessing
import time
import math
import json
import numpy as np
from ctypes import c_bool
from decima... |
flask_threaded_rpc_client.py | """
Example of a Flask web application using RabbitMQ for RPC calls.
"""
import threading
from time import sleep
import amqpstorm
from amqpstorm import Message
from flask import Flask
APP = Flask(__name__)
class RpcClient(object):
"""Asynchronous Rpc client."""
def __init__(self, host, username, password, ... |
main_window.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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... |
2021-08-10.py | from job.nwalker import NWalker
from multiprocessing import Process
from random import randint
from util.run import Run
import wandb
from job.nclimber import NClimber
from rl_ctrnn.ctrnn import Ctrnn
COLORS = {
1: "red",
2: "orange",
3: "yellow",
4: "lime",
6: "green",
8: "teal",
9: "cyan"... |
main_window.py | # ElectrumSV - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
# Copyright (C) 2019 ElectrumSV developers
#
# 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 restricti... |
service.py | import os
import re
import sys
import time
import click
import psutil
import importlib
import threading
import subprocess
import anchore_engine.configuration.localconfig
from watchdog.observers import Observer
from watchdog.events import RegexMatchingEventHandler
import anchore_manager.util
import anchore_manager.uti... |
cvgen.py | #!/usr/bin/env python3
import sys
if not (sys.version_info[0] >= 3 and sys.version_info[1] >= 5):
raise Exception("This program needs Python 3.5 or newer to be executed.")
if len(sys.argv) < 2:
raise Exception("This program needs a JSON file to be passed as first command line parameter.")
from os.path import join,... |
datamanager.py | import argparse
import logging
import os
from multiprocessing import Process
import pandas as pd
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from fooltrader import settings
from fooltrader.api import event
from fooltrader.api.finance import get_balance_sheet_items, ... |
test_wsgiref.py | from unittest import mock
from test import support
from test.test_httpservers import NoLogRequestHandler
from unittest import TestCase
from wsgiref.util import setup_testing_defaults
from wsgiref.headers import Headers
from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler
from wsgiref import ut... |
framereader.py | # pylint: skip-file
import json
import os
import pickle
import queue
import struct
import subprocess
import tempfile
import threading
from functools import wraps
import numpy as np
from aenum import Enum
from lru import LRU
import _io
from tools.lib.cache import cache_path_for_file_path
from tools.lib.exceptions impo... |
__init__.py | import collectd
import xattr
import os
import psutil
import threading
import time
import uuid
try:
from os import scandir
except ImportError:
from scandir import scandir
CVMFS_ROOT = '/cvmfs'
PLUGIN_NAME = 'cvmfs'
CONFIG_DEFAULT_MEMORY = True
CONFIG_DEFAULT_MOUNTTIME = True
CONFIG_DEFAULT_INTERVAL = -1
CONFI... |
test_examples.py | # Copyright 2017 MongoDB, 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, so... |
popup.pyw | import os, random as rand, tkinter as tk, time, json, pathlib, webbrowser, ctypes, threading as thread
from tkinter import *
from tkinter import messagebox
from itertools import count, cycle
from PIL import Image, ImageTk
#Start Imported Code
#Code from: https://code.activestate.com/recipes/460509-get-the-actua... |
scan_web_banner.py | #/usr/bin/env python
#-*-coding=utf-8-*-
# __author__ = 'Zline'
import requests
import re
from threading import Thread,Lock
import time
import sys
import chardet
import netaddr
import struct
import socket
lock = Lock()
def ip2int(addr):
return struct.unpack("!I", socket.inet_aton(addr))[0]
def int2ip(addr)... |
search_engine.py | from gensim.models import word2vec, doc2vec
from threading import Thread
from time import sleep
import numpy as np
from wiki_pubmed_fuzzy.ontology import get_ontology
import fuzzywuzzy.process as fuzzy_process
from fuzzywuzzy import fuzz
from wiki_pubmed_fuzzy import wiki
from wiki_pubmed_fuzzy import pubmed
from sr... |
model_pipelining_classify_image.py | # Lint as: python3
# Copyright 2020 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 agr... |
main.py | # -*- coding: utf-8 -*-
#qpy:main.py
#qpy:webapp:StoryChain
#qpy:fullscreen
#qpy://localhost:8080
"""
以上代码运行时将会用 WebView 以全屏模式打开 localhost:8080
"""
from bottle import template, request, response, redirect, HTTPResponse
from bottle import Bottle, ServerAdapter
from bottle import debug
import sqlite3
from os import pa... |
lock_context_manager.py | """
menggunakan lock/mutex untuk mengsinkronisasi akses ke shared resource
"""
import threading, time, random
counter = 0
lock = threading.Lock() # lock untuk mendapatkan akses ke shared resource
def worker(name):
global counter
for _ in range(10):
with lock: # lock resource, loc... |
__init__.py | # -*- coding: utf-8 -*-
#
import asyncio
from abc import ABCMeta, abstractmethod
import aiohttp
import requests
import json
from pyldapi_client.functions import *
try:
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except ImportError:
pass
class LoadedRegister(object):
"""
... |
server.py | import socket
import threading
PORT = 9090
HOST = socket.gethostbyname(socket.gethostname()) #local host
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))
clients = []
def start():
"""
Thread to accept clients
:return: None
"""
server.listen()... |
irc.py | """Easy to use module for connection to IRC."""
from __future__ import annotations
import logging
import textwrap
import threading
from logging import Logger
from queue import Queue
from threading import Event, Thread
from time import sleep
from typing import Generator, Optional, Set, Type
from irc.exception import ... |
train_pg.py | import numpy as np
import tensorflow as tf
import gym
import logz
import scipy.signal
import os
import time
import inspect
from multiprocessing import Process
#============================================================================================#
# Utilities
#====================================================... |
sniffer.py | # coding: utf-8
import scapy.all as scapy
import threading
import logging
logger = logging.getLogger(__name__)
class StopSniffing(Exception):
"""StopSniffing may raised while processing a packet to indicate stop the sniffer."""
class Sniffer:
"""
Sniffer is the core component of the traffic capture frame... |
tieba_signin.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pprint
import http.cookiejar as cookiejar
import requests
import pickle
import execjs
import time
import random
import getpass
import sys, os
from tkinter import *
import tkinter.messagebox as messagebox
from threading import Thread
from PIL import Image
from io im... |
robotremoteserver.py | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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
#
# ... |
keep_alive.py | from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Your bot is alive!"
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start() |
__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
pywebview is a lightweight cross-platform wrapper around a webview component that allows to display HTML content in its
own dedicated window. Works on Windows, OS X and Linux and compatible with Python 2 and 3.
(C) 2014-2018 Roman Sirokov and contributors
Licensed under B... |
fattree4.py | # Copyright (C) 2016 Huang MaChi at Chongqing University
# of Posts and Telecommunications, China.
# Copyright (C) 2016 Li Cheng at Beijing University of Posts
# and Telecommunications. www.muzixing.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... |
sample_augmentation_trajectories.py | '''Sample partial/full trajectories starting from a list of previously failed tasks.'''
import os
import sys
sys.path.append(os.path.join(os.environ['ALFRED_ROOT']))
sys.path.append(os.path.join(os.environ['ALFRED_ROOT'], 'gen'))
import time
import multiprocessing as mp
import subprocess
import json
import random
imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.