max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
ckanext/example_theme/v09_snippet/plugin.py | okfde/ckankrzn | 2,805 | 3257239 | <filename>ckanext/example_theme/v09_snippet/plugin.py<gh_stars>1000+
../v08_custom_helper_function/plugin.py | 0 | 0 | 0 | 0 | 0 | 0 |
demos/imagetagger/imagetagger/routes.py | hzlmn/aiohttp-demos | 649 | 3257275 | import pathlib
from aiohttp import web
from .views import SiteHandler
PROJECT_PATH = pathlib.Path(__file__).parent
def init_routes(app: web.Application, handler: SiteHandler) -> None:
add_route = app.router.add_route
add_route('GET', '/', handler.index, name='index')
add_route('POST', '/predict', hand... | 2 | 1 | 0 | 0 | 3 | 0 |
python-bitwise-operators/stegano/encoder.py | syberflea/materials | 3,682 | 3257276 | """
Secret file encoder.
"""
import pathlib
from typing import Iterator
from .bitmap import Bitmap
class EncodingError(Exception):
pass
class SecretFile:
"""Convenience class for serializing secret data."""
def __init__(self, path: pathlib.Path):
self.path = path
self.filename = path.... | 3 | 3 | 0 | 0 | 6 | 0 |
libp2p/network/connection/exceptions.py | swedneck/py-libp2p | 315 | 3257298 | from libp2p.io.exceptions import IOException
class RawConnError(IOException):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/settings/stacked/__init__.py | abdulniyaspm/django-split-settings | 826 | 3257339 | from split_settings.tools import include
include('base.py')
| 0 | 0 | 0 | 0 | 0 | 0 |
test/mitmproxy/addons/test_keepserving.py | 0x7c48/mitmproxy | 24,939 | 3257369 | <reponame>0x7c48/mitmproxy<filename>test/mitmproxy/addons/test_keepserving.py
import asyncio
import pytest
from mitmproxy.addons import keepserving
from mitmproxy.test import taddons
from mitmproxy import command
class Dummy:
def __init__(self, val: bool):
self.val = val
def load(self, loader):
... | 0 | 0 | 0 | 0 | 0 | 0 |
requests_kerberos/compat.py | henry0312/requests-kerberos | 5,079 | 3257379 | """
Compatibility library for older versions of python
"""
import sys
# python 2.7 introduced a NullHandler which we want to use, but to support
# older versions, we implement our own if needed.
if sys.version_info[:2] > (2, 6):
from logging import NullHandler
else:
from logging import Handler
class NullHa... | 0 | 0 | 0 | 0 | 0 | 0 |
iSearch/word_sql.py | louisun/iSearch | 255 | 3257417 | #!/usr/bin/env python
# coding=utf-8
from __future__ import annotations
import json
import re
import sqlite3
import os
from termcolor import colored
DEFAULT_PATH = os.path.join(os.path.expanduser('~'), '.iSearch')
CREATE_TABLE_WORD = '''
CREATE TABLE IF NOT EXISTS Word
(
name TEXT PRIMARY KEY NOT NULL,
use... | 0 | 6 | 0 | 0 | 6 | 0 |
DETM-master/plot_word_evolution.py | jmichellec/VU-Athena-Covid-Project | 108 | 3257445 | import scipy.io
import matplotlib.pyplot as plt
import data
import pickle
import numpy as np
beta = scipy.io.loadmat('./beta_100.mat')['values'] ## K x T x V
print('beta: ', beta.shape)
with open('un/min_df_100/timestamps.pkl', 'rb') as f:
timelist = pickle.load(f)
print('timelist: ', timelist)
T = len(timel... | 0 | 0 | 0 | 0 | 0 | 0 |
core/plugin_manager.py | evandrocoan/Javatar | 142 | 3257469 | <filename>core/plugin_manager.py
import copy
class PluginMenu:
def __init__(self, menu):
self.menu = copy.deepcopy(menu)
def add_menu(self, menu_name, menu):
if menu_name in self.menu:
return
self.menu[menu_name] = menu
def add_item(self, menu_name, item, action, inde... | 0 | 0 | 0 | 0 | 0 | 0 |
smartmin/users/migrations/0001_initial.py | nickhargreaves/smartmin | 166 | 3257500 | <filename>smartmin/users/migrations/0001_initial.py
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... | 0 | 0 | 0 | 0 | 0 | 0 |
shap/actions/_optimizer.py | zduey/shap | 16,097 | 3257518 | import queue
import numpy as np
import warnings
import copy
from ._action import Action
class ActionOptimizer():
def __init__(self, model, actions):
self.model = model
warnings.warn("Note that ActionOptimizer is still in an alpha state and is subjust to API changes.")
# actions go into mut... | 1 | 1 | 0 | 1 | 3 | 0 |
python_modules/libraries/dagster-msteams/dagster_msteams/resources.py | rpatil524/dagster | 4,606 | 3257531 | from dagster import Bool, Field, Float, StringSource, resource
from dagster_msteams.client import TeamsClient
@resource(
{
"hook_url": Field(
StringSource,
description="""To send messages to MS Teams channel, an incoming webhook has to
be created. The incoming w... | 0 | 1 | 0 | 0 | 1 | 0 |
Python/guess game.py | OluSure/Hacktoberfest2021-1 | 225 | 3257549 | '''
Made by : <NAME>
github ID : AunMuhammad1
'''
'''
Game rule*
1). Enter you name.
2). You have 5 number of tries for guessing.
'''
my_name = input("Enter your name: \t")
if my_name.isnumeric():
my_name = str(my_name)
else:
print("Please enter you name in string..")
tries = 0
total_tries = 5... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/providers.py | myWorkshop123/fastapi-admin | 636 | 3257552 | from fastapi import Depends, Form
from starlette.requests import Request
from fastapi_admin.depends import get_current_admin, get_resources
from fastapi_admin.models import AbstractAdmin
from fastapi_admin.providers.login import UsernamePasswordProvider
class LoginProvider(UsernamePasswordProvider):
async def pa... | 5 | 1 | 0 | 0 | 6 | 0 |
tools/cr/cr/base/buildtype.py | kjthegod/chromium | 2,151 | 3257564 | <reponame>kjthegod/chromium
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A module for the basic build type support in cr."""
import cr
class BuildType(cr.Plugin, cr.Plugin.Type):
"""Base class f... | 0 | 0 | 0 | 0 | 0 | 0 |
graphlearn/python/gsl/tests/test_gsl_traverse.py | amznero/graph-learn | 1,088 | 3257612 | <reponame>amznero/graph-learn
# Copyright 2021 Alibaba Group Holding Limited. 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/LICEN... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/docs/python/generate_dlib_listing.py | yatonon/dlib-face | 2,695 | 3257620 | <reponame>yatonon/dlib-face
from __future__ import print_function
import dlib
import inspect
def make_listing_files():
fc = open('classes.txt', 'w')
ff = open('functions.txt', 'w')
for obj in dir(dlib):
if obj[0] == '_':
continue
name = 'dlib.'+obj
isclass = inspect.is... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/adaptive_sync/adaptive_sync.py | cuiboyuan/plato | 135 | 3257653 | <filename>examples/adaptive_sync/adaptive_sync.py<gh_stars>100-1000
"""
A federated learning client with support for Adaptive Synchronization Frequency.
Reference:
<NAME>, et al. "GIFT: Towards Accurate and Efficient Federated
Learning withGradient-Instructed Frequency Tuning," found in papers/.
"""
import os
os.env... | 0 | 0 | 0 | 0 | 0 | 0 |
example.py | neosun100/screenpoint | 460 | 3257655 | import screenpoint
import cv2
# Load input images.
screen = cv2.imread('example/screen.png', 0)
view = cv2.imread('example/view.jpg', 0)
# Project centroid.
x, y, img_debug = screenpoint.project(view, screen, True)
# Write debug image.
cv2.imwrite('example/match_debug.png', img_debug) | 0 | 0 | 0 | 0 | 0 | 0 |
bin/kenshin-restart.py | PinkDiamond1/Kenshin | 219 | 3257676 | #!/usr/bin/env python
# coding: utf-8
'''
目前 kenshin 不支持动态加载配置,在配置变更时需要重启,此脚本用于重启所有 kenshin 实例。
$ sudo kenshin-restart.py
'''
import re
import time
import glob
from subprocess import check_output
class Status(object):
def __init__(self, status, pid, time):
self.status = status
self.pid = pid
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/base_circuitpython/base_cp_constants.py | julianrendell/vscode-python-devicesimulator | 151 | 3257691 | <filename>src/base_circuitpython/base_cp_constants.py<gh_stars>100-1000
class CLUE_STATE:
BUTTON_A = "button_a"
BUTTON_B = "button_b"
PRESSED_BUTTONS = "pressed_buttons"
SEA_LEVEL_PRESSURE = "sea_level_pressure"
TEMPERATURE = "temperature"
PROXIMITY = "proximity"
GESTURE = "gesture"
HUMI... | 0 | 0 | 0 | 0 | 0 | 0 |
learn_to_infer/util.py | deepneuralmachine/google-research | 23,901 | 3257886 | <reponame>deepneuralmachine/google-research
# coding=utf-8
# Copyright 2021 The Google Research 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... | 0 | 0 | 0 | 0 | 0 | 0 |
src/dataloaders/mnist5.py | Prathyusha-Akundi/Adversarial-Continual-Learning | 237 | 3257891 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from __future__ import print_function
from PIL import Image
import torch
import numpy as np... | 3 | 3 | 0 | 12 | 18 | 0 |
corpus/python.py | hissssst/falcon | 653 | 3257922 | <filename>corpus/python.py
def dump_args(func):
"This decorator dumps out the arguments passed to a function before calling it"
argnames = func.func_code.co_varnames[:func.func_code.co_argcount]
fname = func.func_name
def echo_func(*args,**kwargs):
print fname, ":", ', '.join(
'%s=%r... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/adhoc-layout/setup.py | wjsi/pytest-cov | 1,204 | 3257952 | from setuptools import find_packages
from setuptools import setup
setup(
name='example',
packages=find_packages(include=['example'])
)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_symbols_catalog.py | avneet-toor-bq/ion-python | 202 | 3257959 | <filename>tests/test_symbols_catalog.py<gh_stars>100-1000
# Copyright 2016 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at:
#
# http://... | 0 | 0 | 0 | 0 | 0 | 0 |
7.5/Add to plugins folder/Code editor/icons/icon4.py | taotaoqqq/Python_editor | 237 | 3257974 | <filename>7.5/Add to plugins folder/Code editor/icons/icon4.py
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.9.1)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x11\x6f\
\x89\
\x50\x4e\x47\x0d\x... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/builtin_specifications_examples/example_AvoidBlastMatches.py | simone-pignotti/DnaChisel | 124 | 3257981 | <filename>examples/builtin_specifications_examples/example_AvoidBlastMatches.py
"""Example of use for AvoidBlastMatches.
In this example we create a 1000bp random sequence, then edit out every match
with E. coli that is 14bp or longer.
"""
import os
from genome_collector import GenomeCollection
from dnachisel import ... | 0 | 0 | 0 | 0 | 0 | 0 |
documentation/test_python/content/content/__init__.py | Ryan-rsm-McKenzie/m.css | 367 | 3257990 | """Yes so this is module summary, not shown in the output"""
import enum
from . import docstring_summary, submodule
class Class:
"""And this class summary, not shown either"""
@classmethod
def class_method(a, b):
"""This function is a class method"""
@staticmethod
def static_method(cls, ... | 2 | 4 | 10 | 0 | 16 | 0 |
embedding-calculator/src/exceptions.py | Precistat/CompreFace | 1,779 | 3257996 | # Copyright (c) 2020 the original author or 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 applicabl... | 0 | 0 | 11 | 0 | 11 | 0 |
manifold_flow/distributions/normal.py | selflein/manifold-flow | 199 | 3258017 | from __future__ import annotations
"""Implementations of Normal distributions."""
import numpy as np
import torch
from manifold_flow import distributions
from manifold_flow.utils import various
class StandardNormal(distributions.Distribution):
"""A multivariate Normal with zero mean and unit covariance."""
... | 5 | 13 | 0 | 0 | 18 | 0 |
tools/wptrunner/wptrunner/browsers/edge_webdriver.py | meyerweb/wpt | 14,668 | 3258045 | from .base import NullBrowser # noqa: F401
from .edge import (EdgeBrowser, # noqa: F401
EdgeDriverWdspecExecutor, # noqa: F401
check_args, # noqa: F401
browser_kwargs, # noqa: F401
executor_kwargs, # noqa: F401
env_extr... | 0 | 0 | 0 | 0 | 0 | 0 |
EveryDay/AboutJoke.py | roceys/tools_python | 130 | 3258082 | <reponame>roceys/tools_python
#!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: xag
@license: Apache Licence
@contact: <EMAIL>
@site: http://www.xingag.top
@software: PyCharm
@file: AboutJoke.py
@time: 4/19/19 16:30
@description:TODO
"""
import requests
from random import randint
impor... | 0 | 0 | 0 | 0 | 0 | 0 |
cyphercat/utils/utils.py | arafin-lab/model_inversion_experiments | 101 | 3258088 | from __future__ import annotations
from __future__ import print_function
# Dictionary printer
def print_dict(dct):
for key, value in sorted(dct.items(), reverse=True):
print("{}: {}".format(key, value))
# Set string printer
def set_to_string(iset: object | None=None) -> object:
sstr = ', '.join([str... | 2 | 2 | 0 | 0 | 4 | 0 |
hawkpost/wsgi.py | sergeimellow/hawkpost | 930 | 3258090 | <filename>hawkpost/wsgi.py
"""
WSGI config for hawkpost project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from raven.contrib.django.raven_compat.middleware.wsgi impo... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/geodata/i18n/unicode_properties.py | Fillr/libpostal | 3,489 | 3258150 | <reponame>Fillr/libpostal
'''
scripts.py
This code uses the latest copy of Scripts.txt from unicode.org
to generate a C file (and header) defining which script every character
belongs to.
'''
import csv
import os
import requests
import re
import sys
import tempfile
import requests
import subprocess
from cStringIO im... | 0 | 0 | 0 | 0 | 0 | 0 |
script/scpUpload.py | psh0502/packtpub-crawler | 796 | 3258156 | <reponame>psh0502/packtpub-crawler
from os.path import exists
import magic
from utils import thread_loader
from logs import *
import paramiko
from scp import SCPClient
class ScpUpload(object):
"""
"""
def __init__(self, config):
self.__config = config
self.info = {}
def __guess_info(s... | 0 | 0 | 0 | 0 | 0 | 0 |
app/utils/__init__.py | duzhangqiong/AutoLine | 249 | 3258173 | <filename>app/utils/__init__.py
# -*- coding: utf-8 -*-
__author__ = "苦叶子"
"""
公众号: 开源优测
Email: <EMAIL>
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
stock-filters/test_.py | bennettdc/MCEdit-Unified | 237 | 3258246 | from pymclevel.materials import BlockstateAPI
from pymclevel import nbt
import numpy
def perform(level, box, options):
block_api = level.materials.blockstate_api
assert isinstance(block_api, BlockstateAPI)
print block_api.idToBlockstate(251, 1)
root = nbt.TAG_Compound()
data = nbt.TAG_Compound()
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/contrib/scrapy/monitors/test_warning_count_monitor.py | lonly7star/spidermon | 405 | 3258275 | from spidermon.contrib.scrapy.monitors import (
WarningCountMonitor,
SPIDERMON_MAX_WARNINGS,
)
from spidermon import MonitorSuite
def new_suite() -> object:
return MonitorSuite(monitors=[WarningCountMonitor])
def test_warning_monitor_should_fail_zero(make_data):
"""WarningCount should fail if the # ... | 0 | 1 | 0 | 0 | 1 | 0 |
inceptor/engine/component/CallComponent.py | whitefi/inceptor | 743 | 3258296 | <gh_stars>100-1000
from config.Config import Config
from engine.component.TemplateModuleComponent import TemplateModuleComponent
from enums.Language import Language
class CallComponent(TemplateModuleComponent):
def __init__(self, code=None):
placeholder = Config().get("PLACEHOLDER", "CALL")
super(... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/python/bl_rna_manual_reference.py | rbabari/blender | 365 | 3258301 | <reponame>rbabari/blender
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program 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 2
# of the License, or (at your option) any later version.
#
... | 0 | 0 | 0 | 0 | 0 | 0 |
codigo/Live60/exemplo_6.py | cassiasamp/live-de-python | 572 | 3258306 | class MeuErro(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self) -> str:
return f'Meu erro foi crer que estar ao seu lado bastaria: {self.msg}'
raise MeuErro('Batatinha quando nasce')
| 0 | 1 | 0 | 0 | 1 | 0 |
slimta/logging/queuestorage.py | slimta/python-slimta | 141 | 3258309 | <filename>slimta/logging/queuestorage.py
# Copyright (c) 2012 <NAME>
#
# 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, c... | 0 | 0 | 0 | 0 | 0 | 0 |
Operators/ExampleFaceDetectOperator/FaceDetectOperator.py | Caius-Lu/Savior | 108 | 3258366 | <filename>Operators/ExampleFaceDetectOperator/FaceDetectOperator.py
from abc import ABC
import cv2
import numpy as np
from Operators.DummyAlgorithmWithModel import DummyAlgorithmWithModel
from Operators.ExampleFaceDetectOperator.PostProcessUtils import get_anchors, regress_boxes
from Utils.GeometryUtils import center... | 0 | 0 | 0 | 0 | 0 | 0 |
onedrived/od_models/bidict.py | r-gorajski/onedrived-dev | 869 | 3258410 | try:
from bidict import loosebidict
except ImportError:
import bidict
class loosebidict(bidict.bidict):
on_dup_val = bidict.OVERWRITE
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/utils/test_log.py | henrywu2019/BentoML | 3,451 | 3258416 | import logging
from bentoml.utils.log import configure_logging
def test_configure_logging_default():
configure_logging()
bentoml_logger = logging.getLogger("bentoml")
assert bentoml_logger.level == logging.INFO
assert bentoml_logger.propagate is False
assert len(bentoml_logger.handlers) == 2
... | 0 | 0 | 0 | 0 | 0 | 0 |
tick/survival/sccs/__init__.py | sumau/tick | 411 | 3258475 | <filename>tick/survival/sccs/__init__.py
# License: BSD 3 clause
import tick.base
from .batch_convolutional_sccs import BatchConvSCCS
from .stream_convolutional_sccs import StreamConvSCCS
__all__ = [
"BatchConvSCCS", "StreamConvSCCS"
]
| 0 | 0 | 0 | 0 | 0 | 0 |
raspi3/securitycam.py | igarag/homesecurity | 150 | 3258486 | from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2, time, os
#import send_email
import queue
import numpy as np
import sys
sys.path.append(os.getcwd()+'/common/')
from config import * #h264_folder, mp4_folder, motion_threshold,log_dir,log_file,countfile
from file_manager import FileManagerTh... | 0 | 0 | 0 | 0 | 0 | 0 |
core/apps/capture_node_api/models/capture.py | near-feign/pcapdb | 244 | 3258501 | <reponame>near-feign/pcapdb
import os
import shutil
import subprocess
import tempfile
import time
from django.conf import settings
from django.db import models
import logging
log = logging.getLogger(__name__)
__author__ = 'pflarr'
SUDO_CMDS = settings.SITE_ROOT/'core'/'bin'/'sudo'
MOUNT_UUID_CMD = SUDO_CMDS/'mount_b... | 0 | 0 | 0 | 0 | 0 | 0 |
datahub/black_list_sql.py | cogitate3/stock | 3,401 | 3258511 | # -*-coding=utf-8-*-
# 股市黑名单
from configure.settings import llogger,DATA_PATH,DBSelector
import os
import codecs
logger = llogger('log/blacklist.log')
def create_tb(conn):
cmd = '''CREATE TABLE IF NOT EXISTS `tb_blacklist` (DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,CODE VARCHAR(6) PRIMARY KEY,NAME VARCHAR(60),REA... | 0 | 2 | 0 | 0 | 2 | 0 |
djangoerp/core/tests/test_decorators.py | xarala221/django-erp | 345 | 3258515 | <reponame>xarala221/django-erp
#!/usr/bin/env python
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHAL... | 0 | 0 | 0 | 0 | 0 | 0 |
src/main/python/rlbot/gui/design/car_customisation.py | whokRL/RLBot | 408 | 3258530 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'car_customisation.ui'
#
# Created by: PyQt5 UI code generator 5.11
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_LoadoutPresetCustomiser(object):
def set... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tutorial1/tests/test_client_server.py | agronholm/asphalt | 226 | 3258531 | <reponame>agronholm/asphalt
# isort: off
from asyncio import AbstractEventLoop
import pytest
from _pytest.capture import CaptureFixture
from asphalt.core import Context
from echo.client import ClientComponent
from echo.server import ServerComponent
def test_client_and_server(
event_loop: AbstractEventLoop, cap... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/example_subprocess_files.py | WY-Wang/pySOT | 180 | 3258544 | """
.. module:: example_subprocess_files
:synopsis: Example of an external objective function with input text files
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import logging
import os.path
from subprocess import PIPE, Popen
import numpy as np
from poap.controller import ProcessWorkerThread, ThreadController
from pySOT... | 0 | 1 | 0 | 0 | 1 | 0 |
hipi/utils.py | deepneuralmachine/google-research | 23,901 | 3258546 | <filename>hipi/utils.py
# coding=utf-8
# Copyright 2021 The Google Research 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
#
# Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
library/explorerhat/__init__.py | pimoroni/explorer-hat-lib | 156 | 3258574 | <gh_stars>100-1000
"""[explorerhat]
API library for Explorer HAT and Explorer HAT Pro, Raspberry Pi add-on boards"""
import atexit
import signal
import time
from sys import version_info
try:
from smbus import SMBus
except ImportError:
if version_info[0] < 3:
raise ImportError("This library requires p... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractWwaraitaiWordpressCom.py | fake-name/ReadableWebProxy | 193 | 3258587 | <filename>WebMirror/management/rss_parser_funcs/feed_parse_extractWwaraitaiWordpressCom.py
def extractWwaraitaiWordpressCom(item):
'''
Parser for 'wwaraitai.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
ret... | 0 | 0 | 0 | 0 | 0 | 0 |
src/colormaps/bin/colorMaptoSLD.py | nasa-gibs/onearth | 131 | 3258610 | <reponame>nasa-gibs/onearth<filename>src/colormaps/bin/colorMaptoSLD.py
#!/usr/bin/env python3
# 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
model_zoo/flags.py | ModelZoo/ModelZoo | 191 | 3258636 | # Copyright 2017 The Abseil Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 35 | 4 | 0 | 0 | 39 | 0 |
ds-bifurcationdiagram-numerical-logistic-map.py | RachidStat/PyCX | 176 | 3258648 | from pylab import *
def initialize():
global x, result
x = 0.1
result = []
def observe():
global x, result
result.append(x)
def update():
global x, result
x = r * x * (1 - x)
def plot_asymptotic_states():
initialize()
for t in range(100): # first 100 steps are di... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/tdw/FBOutput/Keyboard.py | felixbinder/tdw | 307 | 3258653 | <filename>Python/tdw/FBOutput/Keyboard.py
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: FBOutput
import tdw.flatbuffers
class Keyboard(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsKeyboard(cls, buf, offset):
n = tdw.flatbuffers.encode.Get(tdw.flatbu... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/1297.py | rakhi2001/ecom7 | 854 | 3258672 | <gh_stars>100-1000
__________________________________________________________________________________________________
sample 68 ms submission
class Solution:
def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) -> int:
return next((i for x, i in collections.Counter(s[i-minSize:i] for i in ... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/share/doc/networkx-2.6.3/examples/drawing/plot_custom_node_icons.py | AisahAlfiyatusR/Image_Retrieval_Heroku | 10,024 | 3258674 | <gh_stars>1000+
"""
=================
Custom node icons
=================
Example of using custom icons to represent nodes with matplotlib.
Images for node icons courtesy of www.materialui.co
"""
import matplotlib.pyplot as plt
import networkx as nx
import PIL
# Image URLs for graph nodes
icons = {
"router": "i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_core_lexer.py | 9seconds/hrss | 124 | 3258710 | # -*- coding: utf-8 -*-
import pytest
import concierge.core.exceptions as exceptions
import concierge.core.lexer as lexer
def make_token(indent_lvl: int=0) -> object:
token_name = "a{0}".format(0)
return lexer.Token(indent_lvl, token_name, [token_name], token_name, 0)
@pytest.mark.parametrize(
"inpu... | 1 | 1 | 0 | 0 | 2 | 0 |
localgraphclustering/cpp/densest_subgraph_cpp.py | vishalbelsare/LocalGraphClustering | 106 | 3258712 | # A python wrapper for MQI
# ai,aj - graph in CSR
# n - number of nodes in the graph
# R - seed set
# nR - number of nodes in seed set
# actual_length - number of nodes in the optimal subset
# ret_set - optimal subset with the smallest conductance
from operator import itemgetter
import numpy as np
from numpy.ctypeslib... | 0 | 3 | 0 | 0 | 3 | 0 |
src/visitpy/visit_flow/visit_flow_vpe/src/__init__.py | visit-dav/vis | 226 | 3258713 | # Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
# Project developers. See the top-level LICENSE file for dates and other
# details. No copyright assignment is required to contribute to VisIt.
"""
file: __init__.py
author: <NAME> <<EMAIL>>
created: 3/28/2012
description:
Init for 'vi... | 0 | 0 | 0 | 0 | 0 | 0 |
pyNastran/converters/panair/to_p3d.py | ACea15/pyNastran | 293 | 3258738 | import os
import pyNastran
from pyNastran.converters.panair.panair_grid import PanairGrid
PKG_PATH = pyNastran.__path__[0]
def run():
infilename = os.path.join(PKG_PATH, 'converters', 'panair', 'M100', 'M100.inp')
model = PanairGrid(log=None, debug=True)
model.read_panair(infilename)
p3d_name = 'M100.... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/_base_/post_processing/oneeuro.py | ykk648/mmhuman3d | 472 | 3258740 | <gh_stars>100-1000
smooth_cfg = dict(type='oneeuro', min_cutoff=0.004, beta=0.7)
| 0 | 0 | 0 | 0 | 0 | 0 |
rtdl/__init__.py | ppmdatix/rtdl | 298 | 3258750 | <gh_stars>100-1000
"""Revisiting Tabular Deep Learning."""
__version__ = '0.0.10.dev0'
from .functional import geglu, reglu # noqa
from .modules import ( # noqa
GEGLU,
MLP,
CategoricalFeatureTokenizer,
CLSToken,
FeatureTokenizer,
FTTransformer,
MultiheadAttention,
NumericalFeatureTok... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/e2e/workloads/app/jenkins/test_jenkins.py | annagitel/ocs-ci | 130 | 3258756 | import logging
import pytest
from ocs_ci.framework.testlib import E2ETest, workloads
from ocs_ci.ocs.jenkins import Jenkins
from ocs_ci.ocs.constants import STATUS_COMPLETED
log = logging.getLogger(__name__)
@pytest.fixture(scope="function")
def jenkins(request) -> object:
jenkins = Jenkins()
def teardown... | 2 | 1 | 0 | 0 | 3 | 0 |
hypo_test/patterns.py | phorward/python-minifier | 301 | 3258783 | import ast
import keyword
import string
from hypothesis import assume
from hypothesis.strategies import lists, sampled_from, recursive, text, composite, one_of, none, booleans, integers
@composite
def name(draw) -> object:
n = draw(text(alphabet=string.ascii_letters, min_size=1, max_size=3))
assume(n not in ... | 0 | 11 | 0 | 0 | 11 | 0 |
test/espnet2/torch_utils/test_set_all_random_seed.py | texpomru13/espnet | 5,053 | 3258831 | from espnet2.torch_utils.set_all_random_seed import set_all_random_seed
def test_set_all_random_seed():
set_all_random_seed(0)
| 0 | 0 | 0 | 0 | 0 | 0 |
test/itest_send2.py | tnakagawa/lit | 560 | 3258836 | <gh_stars>100-1000
import testlib
def run_test(env):
bc = env.bitcoind
lit = env.lits[0]
lit2 = env.lits[1]
# First figure out where we should send the money.
addr = lit.make_new_addr()
print('Got lit1 address:', addr)
# Send a bitcoin.
bc.rpc.sendtoaddress(addr, 1)
env.generate_b... | 0 | 0 | 0 | 0 | 0 | 0 |
linked_list/josephus_circle.py | x899/algorithms | 472 | 3258838 | from __future__ import annotations
""" Josephus Circle using circular linked list
URL: https://www.geeksforgeeks.org/josephus-circle-using-circular-linked-list/
There are n people standing in a circle waiting to be executed. The
counting out begins at some point in the circle and proceeds around the
ci... | 0 | 3 | 0 | 2 | 5 | 0 |
textwrap__examples/dedent_examples.py | gil9red/SimplePyScripts | 117 | 3258873 | <reponame>gil9red/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from textwrap import dedent
text = """\
Съешь ещё этих мягких французских
булок, да выпей же чаю
"""
print(repr(text))
print(repr(dedent(text)))
print()
def foo():
"""
Съешь ещё этих мягких ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/core/tests/sources/test_source.py | luizoti/toga | 1,261 | 3258874 | <filename>src/core/tests/sources/test_source.py
from unittest import TestCase
from unittest.mock import Mock
from toga.sources import Source
class SourceTests(TestCase):
def test_listeners(self):
listener1 = Mock()
source = Source()
source.add_listener(listener1)
self.assertListE... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/server/forms.py | GiftLee/devops | 300 | 3258876 | <reponame>GiftLee/devops
from django import forms
class ChangeUserForm(forms.Form):
userid = forms.IntegerField(label="用户ID")
username = forms.CharField(label="用户名", max_length=128)
password = forms.CharField(label="密码", max_length=32)
domain = forms.CharField(label="AD域", max_length=256, required=Fal... | 0 | 0 | 0 | 0 | 0 | 0 |
grove/ising/__init__.py | mkeshita/grove | 229 | 3258883 | # Ising code init
| 0 | 0 | 0 | 0 | 0 | 0 |
src/convtools/utils.py | KDWSS/convtools-ita | 174 | 3258937 | <reponame>KDWSS/convtools-ita
"""Helpers live here: like:
- recently used cache
- options ctx manager
"""
import sys
import threading
import typing
if sys.version_info[:2] == (3, 6):
GenericMeta = typing.GenericMeta
else:
class GenericMeta(type):
pass
class BaseCtxMeta(GenericMeta):
def __ini... | 0 | 0 | 0 | 0 | 0 | 0 |
Vecihi/Backend/vecihi/ask/models.py | developertqw2017/migrationDjango | 220 | 3258940 | from __future__ import unicode_literals
from django.db import models
from vecihi.users.models import User
class Question(models.Model):
whom = models.ForeignKey(User)
question = models.CharField(max_length=100, blank=False, null=False)
created_at = models.DateTimeField(auto_now_add=True)
def __unicode__(self... | 0 | 4 | 0 | 0 | 4 | 0 |
caffe2/python/layers/add_bias.py | KevinKecc/caffe2 | 585 | 3258950 | <filename>caffe2/python/layers/add_bias.py
# Copyright (c) 2016-present, Facebook, 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
STM32F1/libraries/USBComposite/scripts/showhids.py | kiki-lamb/Arduino_STM32 | 2,405 | 3258952 | from pywinusb import hid
hid.core.show_hids()
| 0 | 0 | 0 | 0 | 0 | 0 |
emails/testsuite/transformer/test_parser.py | MrTango/python-emails | 348 | 3258961 | # encoding: utf-8
from __future__ import print_function
from emails.transformer import HTMLParser
def test_parser_inputs() -> object:
def _cleaned_body(s) -> object:
for el in ('html', 'body', 'head'):
s = s.replace('<%s>' % el, '').replace('</%s>' % el, '').replace('<%s/>' % el, '')
... | 0 | 2 | 0 | 0 | 2 | 0 |
configurations/management.py | michael-k/django-configurations | 566 | 3258967 | from . import importer
importer.install(check_options=True)
from django.core.management import (execute_from_command_line, # noqa
call_command)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_components.py | monalivadje/climt | 116 | 3258988 | from __future__ import annotations
import pytest
import abc
import os
import sys
from glob import glob
import xarray as xr
import numpy as np
import logging
from climt import (
HeldSuarez, GrayLongwaveRadiation,
Frierson06LongwaveOpticalDepth, GridScaleCondensation,
BergerSolarInsolation, SimplePhysics, RRT... | 5 | 48 | 0 | 0 | 53 | 0 |
src/oci/apigateway/models/rate_limiting_policy.py | Manny27nyc/oci-python-sdk | 249 | 3259006 | <reponame>Manny27nyc/oci-python-sdk
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache... | 0 | 0 | 0 | 0 | 0 | 0 |
promgen/plugins.py | kackey0-1/promgen | 913 | 3259010 | <filename>promgen/plugins.py
# Copyright (c) 2017 LINE Corporation
# These sources are released under the terms of the MIT license: see LICENSE
import logging
from pkg_resources import working_set
logger = logging.getLogger(__name__)
def discovery():
return working_set.iter_entry_points('promgen.discovery')
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | MasterScott/Formasaurus | 132 | 3259046 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import io
import lxml.html
import pytest
from formasaurus.classifiers import DEFAULT_DATA_PATH
from formasaurus.storage import Storage
LOGIN_PAGE = b'''
<html>
<body>
<form method=POST action="/login">
Username... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/tradfri/__init__.py | liangleslie/core | 30,023 | 3259085 | """Support for IKEA Tradfri."""
from __future__ import annotations
from datetime import datetime, timedelta
from typing import Any
from pytradfri import Gateway, RequestError
from pytradfri.api.aiocoap_api import APIFactory
from pytradfri.command import Command
from pytradfri.device import Device
from homeassistant.... | 9 | 5 | 5 | 0 | 19 | 0 |
mmedit/models/backbones/encoder_decoders/encoders/resnet.py | Jian137/mmediting-1 | 1,884 | 3259108 | # Copyright (c) OpenMMLab. All rights reserved.
from __future__ import annotations
import torch.nn as nn
import torch.utils.checkpoint as cp
from mmcv.cnn import (build_activation_layer, build_conv_layer,
build_norm_layer, constant_init, kaiming_init)
from mmcv.runner import load_checkpoint
from m... | 29 | 11 | 3 | 1 | 44 | 0 |
code/markdown2/test/test.py | Endres/Letterpress | 291 | 3259123 | #!/usr/bin/env python
# Copyright (c) 2007-2008 ActiveState Software Inc.
# License: MIT (http://www.opensource.org/licenses/mit-license.php)
"""The markdown2 test suite entry point."""
import os
from os.path import exists, join, abspath, dirname, normpath
import sys
import logging
import testlib
log = logging.getL... | 0 | 0 | 0 | 0 | 0 | 0 |
lambda-integration-tests/python/main.py | bahildebrand/aws-lambda-rust-runtime | 2,008 | 3259141 | <gh_stars>1000+
def handler(event, context):
return {
"message": event["command"].upper()
} | 0 | 0 | 0 | 0 | 0 | 0 |
alembic/versions/58cdd82df884_added_assign_columns.py | Cellington1/hot-tasking-manager | 465 | 3259152 | <filename>alembic/versions/58cdd82df884_added_assign_columns.py
"""Added assign columns
Revision ID: 58cdd82df884
Revises: 3<PASSWORD>
Create Date: 2014-06-19 16:12:49.986840
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'b54ce37bde0'
from alembic import op
import sqlalchemy as sa
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/other/ext/stepcode/src/exp2python/examples/unitary_schemas/test_where_rule.py | dservin/brlcad | 262 | 3259155 | # This file was generated by exp2python. You probably don't want to edit
# it since your modifications will be lost if exp2python is used to
# regenerate it.
import sys
from SCL.SCLBase import *
from SCL.SimpleDataTypes import *
from SCL.ConstructedDataTypes import *
from SCL.AggregationDataTypes import *
from SCL.Ty... | 0 | 3 | 0 | 0 | 3 | 0 |
densenet/densenet121.py | siposcsaba89/tensorrtx | 3,964 | 3259161 | import os
import sys
import struct
import argparse
import numpy as np
import pycuda.autoinit
import pycuda.driver as cuda
import tensorrt as trt
BATCH_SIZE = 1
INPUT_H = 224
INPUT_W = 224
OUTPUT_SIZE = 1000
INPUT_BLOB_NAME = "data"
OUTPUT_BLOB_NAME = "prob"
EPS = 1e-5
WEIGHT_PATH = "./densenet121.wts"
ENGINE_PATH =... | 1 | 10 | 0 | 0 | 11 | 0 |
xiblint/rules/no_attributed_string_colors.py | gabriellanata/xiblint | 488 | 3259169 | from xiblint.rules import Rule
from xiblint.xibcontext import XibContext
class NoAttributedStringColors(Rule):
"""
Ensures attributed strings don't specify colors.
"""
def check(self, context): # type: (XibContext) -> None
for element in context.tree.findall(".//color"):
# Skip <c... | 0 | 0 | 0 | 0 | 0 | 0 |
control_and_ai/function_approximation_q_learning.py | julianxu/Rockets | 275 | 3259236 | <gh_stars>100-1000
"""
Author: <NAME>
Date: 10/05/2017
Description: Function Approximation Q-Learning.
"""
import _pickle
import numpy as np
from constants import *
class FunctionApproximation():
""" Q-Learning implementation. """
def __init__(self, state, low_discretization, load=None, epsilon=0.1, alpha... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_PypeS/test_pype.py | michelebucelli/vmtk | 217 | 3259243 | ## Program: VMTK
## Language: Python
## Date: January 10, 2018
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PAR... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.