max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
tests/bugfixes/nosetests/test_redis.py | kerokim/HTTPretty | 1,253 | 12717328 | import os
import requests
import httpretty
try:
from redis import Redis
except ImportError:
Redis = None
from unittest import skipUnless
def redis_available():
if Redis is None:
return False
params = dict(
host=os.getenv('REDIS_HOST') or '127.0.0.1',
port=int(os.getenv('REDI... |
nlpre/identify_parenthetical_phrases.py | thoppe/NLPre | 186 | 12717330 | import collections
from .Grammars import parenthesis_nester
import logging
import string
class identify_parenthetical_phrases(object):
"""
Parser to identify abbreviations of phrases found in a parenthesis, ex.
Health and Human Services (HHS) and Office of the Director (OD).
"""
def __init__(sel... |
securityheaders/models/xxssprotection/xxssprotection.py | th3cyb3rc0p/securityheaders | 151 | 12717345 | from securityheaders.models import SecurityHeader
from securityheaders.models.xxssprotection import XXSSProtectionDirective
from securityheaders.models.annotations import *
@requiredheader
@description('This header sets the configuration for the cross-site scripting filter built into most browsers. The recommended val... |
controller/deis/wsgi.py | yun-an/deis | 3,375 | 12717346 | <reponame>yun-an/deis
"""
WSGI config for deis project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``... |
tests/test_json_fields.py | trevorbox/prom2teams | 180 | 12717354 | import unittest
import os
import json
from prom2teams.teams.alert_mapper import map_prom_alerts_to_teams_alerts
from prom2teams.prometheus.message_schema import MessageSchema
from prom2teams.app.sender import AlertSender
from deepdiff import DeepDiff
class TestJSONFields(unittest.TestCase):
TEST_CONFIG_FILES_PAT... |
paas-ce/paas/login/ee_official_login/oauth/google/backends.py | renmcc/bk-PaaS | 767 | 12717362 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
waveform_analysis/weighting_filters/__init__.py | pirun/waveform_analysis | 125 | 12717421 | <reponame>pirun/waveform_analysis<filename>waveform_analysis/weighting_filters/__init__.py
from .ABC_weighting import *
from .ITU_R_468_weighting import *
|
TensorFlow_v1/test_pb.py | leimao/Graph_Frozen_Load_TensorFlow | 200 | 12717424 | <reponame>leimao/Graph_Frozen_Load_TensorFlow<gh_stars>100-1000
import tensorflow as tf
import numpy as np
import argparse
from cifar import CIFAR10
from utils import model_accuracy
from tensorflow.python.framework import tensor_util
# If load from pb, you may have to use get_tensor_by_name heavily.
class CNN(objec... |
examples/subs.py | tgolsson/appJar | 666 | 12717466 | <reponame>tgolsson/appJar
import sys
sys.path.append("../")
from appJar import gui
def login(btn):
app.hideSubWindow("Login")
app.show()
def stopSub(btn=None):
return False
app = gui()
app.addLabel("la", "la")
app.startSubWindow("Login")
app.setStopFunction(stopSub)
app.addLabel("l2", "Login Window")
a... |
release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/AnalyticalRigidLinksOption.py | htlcnn/ironpython-stubs | 182 | 12717475 | class AnalyticalRigidLinksOption(Enum,IComparable,IFormattable,IConvertible):
"""
Specifies how Rigid Links will be made for the Analytical Model.
enum AnalyticalRigidLinksOption,values: Disabled (1),Enabled (0),FromColumn (2)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==... |
tests/test_img_path_utils.py | weblucas/mseg-semantic | 391 | 12717477 | #!/usr/bin/python3
from pathlib import Path
from mseg_semantic.utils.img_path_utils import (
dump_relpath_txt,
get_unique_stem_from_last_k_strs
)
_ROOT = Path(__file__).resolve().parent
def test_dump_relpath_txt():
""" """
jpg_dir = f'{_ROOT}/test_data/test_imgs_relpaths'
txt_output_dir = f'{_ROOT}/test_data/te... |
programs/pyeos/tests/python/rpctest/rpctest.py | learnforpractice/pyeos | 144 | 12717500 | from eoslib import *
code = N('rpctest')
def sayHello():
n = N('rpctest')
id = N('name')
name = read_action()
print('hello', name)
itr = db_find_i64(n, n, n, id)
if itr >= 0: # value exist, update it
old_name = db_get_i64(itr)
print('hello,', old_name)
db_update_i64(it... |
gen2-triangulation/visualizer.py | ibaiGorordo/depthai-experiments | 381 | 12717515 | import pygame
from pygame.locals import DOUBLEBUF, OPENGL, RESIZABLE
import math
import numpy as np
from OpenGL.GL import glLineWidth, glBegin, GL_LINES, glColor3f, glVertex3fv, glEnd, glPointSize, GL_POINTS, glVertex3f, \
glScaled, GLfloat, glGetFloatv, GL_MODELVIEW_MATRIX, glRotatef, glTranslatef, glClear, GL_COL... |
3d/scripts/generate_snapshot.py | chrisdearman/splitflap | 2,138 | 12717575 | #!/usr/bin/env python
# Copyright 2015-2016 <NAME> and the splitflap contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... |
spectre/factors/feature.py | rajach/spectre | 302 | 12717596 | <reponame>rajach/spectre
"""
@author: Heerozh (<NAME>)
@copyright: Copyright 2019-2020, Heerozh. All rights reserved.
@license: Apache 2.0
@email: <EMAIL>
"""
import warnings
from .datafactor import DatetimeDataFactor
from .factor import CrossSectionFactor, CustomFactor
from .basic import Returns
from ..parallel import... |
nginx-amplify-agent.py | dp92987/nginx-amplify-agent | 308 | 12717627 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import platform
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__credits__ = [] # check amplify/agent/main.py for the actual credits list
# Detect old Centos6... |
test/test_workbook.py | rimishra-equinix/document-api-python | 263 | 12717669 | import unittest
import os.path
from tableaudocumentapi import Datasource, Workbook
TEST_ASSET_DIR = os.path.join(
os.path.dirname(__file__),
'assets'
)
EPHEMERAL_FIELD_FILE = os.path.join(
TEST_ASSET_DIR,
'ephemeral_field.twb'
)
SHAPES_FILE = os.path.join(
TEST_ASSET_DIR,
'shapes_test.twb'
)
... |
carla/models/api/mlmodel.py | jayanthyetukuri/CARLA | 140 | 12717670 | from abc import ABC, abstractmethod
from typing import Union
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.base import BaseEstimator
from carla.data.api import Data
class MLModel(ABC):
"""
Abstract class to implement custom black-box-model for a given dataset with enc... |
docs/conf.py | ChronicallySerious/Rootex | 166 | 12717721 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
pqdm/__init__.py | dangercrow/pqdm | 129 | 12717733 | <reponame>dangercrow/pqdm
"""Top-level package for Parallel TQDM."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
|
adi_analyze/utils/JVMUtils_test.py | Bertlk/ADI | 226 | 12717756 | <filename>adi_analyze/utils/JVMUtils_test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/3 8:38 下午
# @Author : kewen
# @File : JVMUtils_test.py.py
import unittest
from utils.JVMUtils import convertBaseType, convertObjectDesc, convertArray, convertClassDesc, convertMethodDesc
class Test(uni... |
owl/apps/mnist/mnist_cnn.py | jjzhang166/minerva | 561 | 12717761 | import sys
import time
import argparse
import numpy as np
import mnist_io
import owl
import owl.elewise as ele
import owl.conv as conv
lazy_cycle = 4
class MNISTCNNModel:
def __init__(self):
self.convs = [
conv.Convolver(0, 0, 1, 1),
conv.Convolver(2, 2, 1, 1),
];
s... |
mayan/apps/documents/tests/test_copying.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 12717762 | from mayan.apps.common.tests.mixins import ObjectCopyTestMixin
from mayan.apps.testing.tests.base import BaseTestCase
from .mixins.document_mixins import DocumentTestMixin
class DocumentTypeCopyTestCase(
DocumentTestMixin, ObjectCopyTestMixin, BaseTestCase
):
auto_upload_test_document = False
def setUp(... |
flow-python/megflow/func_op.py | MegEngine/MegFlow | 303 | 12717766 | #!/usr/bin/env python
# coding=utf-8
from .registry import register
import inspect
from functools import partial
import re
class Context:
def __init__(self, **entries):
self.__dict__.update(entries)
def name_convert_to_camel(name):
contents = re.findall('_[a-z]+', name)
for content in set(content... |
Megatron-LM/scripts/presplit_sentences_json.py | weilianglin101/DeepSpeedExamples | 309 | 12717794 | """
Usage:
python scripts/presplit_sentences_json.py <original loose json file> <output loose json file>
"""
import sys
import json
import nltk
nltk.download('punkt')
input_file = sys.argv[1]
output_file = sys.argv[2]
line_seperator = "\n"
with open(input_file, 'r') as ifile:
with open(output_file, "w") as ofil... |
src/python/tensorflow_cloud/utils/tf_utils.py | haifeng-jin/cloud | 342 | 12717795 | <filename>src/python/tensorflow_cloud/utils/tf_utils.py
# Copyright 2020 Google LLC. 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/license... |
moldesign/models/__init__.py | Autodesk/molecular-design-toolkit | 147 | 12717846 | <reponame>Autodesk/molecular-design-toolkit
from .openmm import *
from .pyscf import *
from .models import *
from .toys import *
from .amber import *
from .openbabel import *
from .nwchem import *
from .qmmm import * |
sofi/ui/fontawesomeicon.py | screamingskulls/sofi | 402 | 12717852 | <gh_stars>100-1000
from .element import Element
class FontAwesomeIcon(Element):
"""Implements a Font Awesome Icons"""
def __init__(self, name=None, size=None, fixed=False, animation=None,
rotate=None, flip=None, border=False, pull=None,
cl=None, ident=None, style=None, attrs=... |
libpyclingo/clingo/tests/test_application.py | potassco/gringo | 423 | 12717875 | '''
Test clingo's Application class.
'''
from typing import Any, Callable, List, Sequence, Tuple
from unittest import TestCase
from tempfile import NamedTemporaryFile
from multiprocessing import Process, Queue
import os
import re
from .util import _MCB
from ..core import MessageCode
from ..application import Applicat... |
dashboard/app/rules/conditions/email.py | robertsimmons514/isthislegit | 282 | 12717891 | from app.rules import Condition
class EmailCondition(Condition):
''' EmailCondition matches an attribute of the EmailReport.
This is done by a simple regex.'''
def match(report, field, value):
pass
|
backend/src/baserow/contrib/database/export/handler.py | cjh0613/baserow | 839 | 12717976 | import logging
import uuid
from io import BytesIO
from os.path import join
from typing import Optional, Dict, Any, BinaryIO
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.files.storage import default_storage
from django.db import transaction
from django.utils import ti... |
bin/process_all.py | seralf/tate_collection | 330 | 12718054 | '''
Go through all artwork jsons and produce an index for
level0, level1, level2
Outputs a json collection
Does not preserve relationships between the levels
'''
import json
from os import walk
# use dict to elimiate duplicated entries as new entries
# are added as {'value of id': 'value of name'}
level0 = {}
... |
global_var.py | NightFurySL2001/CJK-character-count | 125 | 12718074 | global cjk_list
global unicode_list
global cjk_jian_list
global cjk_jian_fan_list
global cjk_fan_list
global cjk_count
global unicode_count
import os, sys
global main_directory
#if packaged by pyinstaller
#ref: https://stackoverflow.com/questions/404744/determining-application-path-in-a-python-exe-gen... |
TaobaoCrawler(new)/save_mysql_redis.py | wangbl11/ECommerceCrawlers | 3,469 | 12718116 | import pymysql
import redis
from config import *
def save_mysql_redis(res_list):
pass
|
kornia/augmentation/_3d/geometric/__init__.py | Ishticode/kornia | 418 | 12718155 | from kornia.augmentation._3d.geometric.affine import RandomAffine3D
from kornia.augmentation._3d.geometric.center_crop import CenterCrop3D
from kornia.augmentation._3d.geometric.crop import RandomCrop3D
from kornia.augmentation._3d.geometric.depthical_flip import RandomDepthicalFlip3D
from kornia.augmentation._3d.geome... |
auto_make.py | xiaodotgua/renderer.gua | 315 | 12718173 | <gh_stars>100-1000
import os
import sys
import time
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
class AutoMake(PatternMatchingEventHandler):
patterns = ["*.h", "*.cpp"]
def process(self, event):
os.system('make osx')
def on_modified(self, even... |
tests/config/test_graphics_state.py | sourya-deepsource/pdf-annotate | 137 | 12718189 | # -*- coding: utf-8 -*-
from unittest import TestCase
import pytest
from pdfrw import PdfDict
from pdfrw import PdfName
from pdf_annotate.config import constants
from pdf_annotate.config.graphics_state import GraphicsState
class TestGraphicsState(TestCase):
def test_blank(self):
pdf_dict = GraphicsStat... |
tfne/encodings/codeepneat/__init__.py | githealthy18/Tensorflow-Neuroevolution | 121 | 12718195 | # Import CoDeepNEAT module package
from tfne.encodings.codeepneat import modules
# Import modules
from tfne.encodings.codeepneat.codeepneat_genome import CoDeepNEATGenome
from tfne.encodings.codeepneat.codeepneat_blueprint import CoDeepNEATBlueprint
|
QUANTAXIS/QAData/level2.py | B34nK0/QUANTAXIS | 6,322 | 12718247 |
"""
字段 含义 数据类型 说明
SecurityID 证券代码 STRING
DateTime 日期时间 NUMBER 20151123091630
PreClosePx 昨收价 NUMBER(3)
OpenPx 开始价 NUMBER(3)
HighPx 最高价 NUMBER(3)
LowPx 最低价 NUMBER(3)
LastPx 最新价 NUMBER(3)
TotalVolumeTrade 成交总量 NUMBER 股票:股 基金:份 债券:手指数:手
TotalValueTrade 成交总金额 NUMBER(2) 元
InstrumentStatus 交易状态 STRING
BidPrice[10] 申买十价 NUM... |
runway/config/models/__init__.py | avosper-intellaegis/runway | 134 | 12718299 | <reponame>avosper-intellaegis/runway
"""Runway & CFNgin config models."""
|
util/pynoise/base_noise.py | Reytuag/non-stationary_texture_syn | 351 | 12718302 | import constants
def _integer_surround(number):
"""Return the 2 closest integers to number, smaller integer first."""
if number > 0:
return int(number), int(number) + 1
else:
return int(number) - 1, int(number)
def _interpolate(first, second, between):
return first + (second - first)... |
AppServer/lib/django-1.4/tests/regressiontests/special_headers/urls.py | loftwah/appscale | 790 | 12718310 | # coding: utf-8
from __future__ import absolute_import
from django.conf.urls import patterns
from django.views.generic.list_detail import object_detail
from . import views
from .models import Article
urlpatterns = patterns('',
(r'^special_headers/article/(?P<object_id>\d+)/$', object_detail, {'queryset': Article... |
nni/nas/pytorch/base_trainer.py | dutxubo/nni | 9,680 | 12718328 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from abc import ABC, abstractmethod
class BaseTrainer(ABC):
@abstractmethod
def train(self):
"""
Override the method to train.
"""
raise NotImplementedError
@abstractmethod
def validate(self):
... |
catalyst/core/runner.py | tadejsv/catalyst | 206 | 12718365 | from typing import Any, Dict, Mapping, Optional
from abc import ABC, abstractmethod
from collections import defaultdict, OrderedDict
import torch
from torch.utils.data import DataLoader, DistributedSampler
from catalyst.core.callback import Callback, ICallback
from catalyst.core.engine import Engine
from catalyst.cor... |
src/GridCal/update.py | mzy2240/GridCal | 284 | 12718367 | import subprocess
import sys
import pkg_resources
from GridCal.__version__ import __GridCal_VERSION__
def find_latest_version(name='GridCal'):
"""
Find the latest version of a package
:param name: name of the Package
:return: version string
"""
latest_version = str(subprocess.run([sys.executab... |
tests/utils.py | d-hoke/py-pdf-parser | 186 | 12718404 | import re
from typing import NamedTuple, Callable, Dict, List, Optional, Union
from py_pdf_parser.components import PDFElement, PDFDocument, ElementOrdering
from py_pdf_parser.sectioning import Section
from pdfminer.layout import LTComponent
from py_pdf_parser.common import BoundingBox
from py_pdf_parser.loaders imp... |
psdaq/psdaq/pyxpm/surf/devices/intel/_EM22xx.py | ZhenghengLi/lcls2 | 134 | 12718412 | <gh_stars>100-1000
#-----------------------------------------------------------------------------
# This file is part of the 'SLAC Firmware Standard Library'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanfor... |
backpack/extensions/curvmatprod/ggnmp/pooling.py | jabader97/backpack | 395 | 12718449 | <reponame>jabader97/backpack
from backpack.core.derivatives.avgpool2d import AvgPool2DDerivatives
from backpack.core.derivatives.maxpool2d import MaxPool2DDerivatives
from backpack.extensions.curvmatprod.ggnmp.ggnmpbase import GGNMPBase
class GGNMPAvgPool2d(GGNMPBase):
def __init__(self):
super().__init__... |
2021.03.12-linux-iscsi/detect_iscsi_vuln.py | jeffball55/NotQuite0DayFriday | 756 | 12718471 | <reponame>jeffball55/NotQuite0DayFriday
#!/usr/bin/env python
# I
# ,I~
# II7 __ __ _____ _ _
# ,: :I+7~ : \ \ / / / ____| (_) | |
# ~~ 77+?7 ,== ... |
terrascript/provider/DTherHtun/idm.py | mjuenema/python-terrascript | 507 | 12718477 | <filename>terrascript/provider/DTherHtun/idm.py
# terrascript/provider/DTherHtun/idm.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:19:03 UTC)
import terrascript
class idm(terrascript.Provider):
"""Terrafrom Provider for Redhat IDM"""
__description__ = "Terrafrom Provider for Redhat IDM"
... |
app/extensions/default_view/__init__.py | Allen7D/mini-shop-server | 533 | 12718546 | <reponame>Allen7D/mini-shop-server
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2020/6/9.
"""
from importlib import import_module
from flask import current_app, render_template, redirect
from app.core.error import APIException
__author__ = 'Allen7D'
def apply_default_view(app):
'''
:param app: Flask... |
icevision/models/ross/efficientdet/prediction.py | ai-fast-track/mantisshrimp | 580 | 12718557 | __all__ = ["predict", "predict_from_dl", "convert_raw_predictions", "end2end_detect"]
from icevision.imports import *
from icevision.utils import *
from icevision.core import *
from icevision.data import *
from icevision.models.utils import _predict_from_dl
from icevision.models.ross.efficientdet.dataloaders import *
... |
gunicorn/tests/test_metadata.py | vbarbaresi/integrations-core | 663 | 12718572 | <reponame>vbarbaresi/integrations-core<gh_stars>100-1000
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import pytest
from datadog_checks.gunicorn import GUnicornCheck
from .common import CHECK_NAME, CONTAINER_NAME, GUNICORN_VERSION, INSTANCE
# TODO: Test... |
src/streaming_prices.py | doc-jem/oandapyV20-examples | 127 | 12718588 | # -*- coding: utf-8 -*-
"""Streaming price data.
demonstrate the PricingStream request and convenient handling of data using Pydantic.
Usage:
streaming_prices.py --instrument <instrument> [--instrument <instrument>] [--nice] [--timeout <timeout>] [--count <count>]
Options:
--nice json indente... |
office365/sharepoint/userprofiles/followedItem.py | wreiner/Office365-REST-Python-Client | 544 | 12718615 | from office365.runtime.client_value import ClientValue
class FollowedItem(ClientValue):
pass
|
freenom_dns_updater/exception/add_error.py | anhdhbn/Freenom-dns-updater | 160 | 12718625 | <reponame>anhdhbn/Freenom-dns-updater
from .dns_record_base_exception import DnsRecordBaseException
class AddError(DnsRecordBaseException):
pass
|
pyatv/auth/hap_pairing.py | Jacobs4/pyatv | 532 | 12718627 | <reponame>Jacobs4/pyatv
"""Abstraction for authentication based on HAP/SRP."""
import binascii
from enum import Enum, auto
from typing import Optional, Tuple
from pyatv import exceptions
# pylint: disable=invalid-name
class AuthenticationType(Enum):
"""Supported authentication type."""
Null = auto()
""... |
tests/functional/regressions/test_issue213.py | remorses/tartiflette-whl | 530 | 12718661 | import pytest
from tartiflette import Resolver, create_engine
_SDL = """
type Query {
hello(name: String = "Unknown"): String
bye(name: String! = "Unknown"): String
}
"""
@pytest.fixture(scope="module")
async def ttftt_engine():
@Resolver("Query.hello", schema_name="test_issue213")
async def resolve_que... |
platypush/backend/nodered/runner.py | RichardChiang/platypush | 228 | 12718673 | <reponame>RichardChiang/platypush
import json
from pynodered import node_red
from platypush.context import get_plugin
# noinspection PyUnusedLocal
@node_red(name='run', title='run', category='platypush', description='Run a platypush action')
def run(node, msg):
msg = msg['payload']
if isinstance(msg, bytes):... |
tessagon/core/rotate_tile_generator.py | virtualritz/tessagon | 199 | 12718691 | <reponame>virtualritz/tessagon
from tessagon.core.tile_generator import TileGenerator
from tessagon.core.abstract_tile import AbstractTile
class RotateTileGenerator(TileGenerator):
# This generates tiles that are rotated from a regular
# grid arrangement.
def __init__(self, tessagon, **kwargs):
su... |
vmoe/partitioning_test.py | google-research/vmoe | 205 | 12718703 | <reponame>google-research/vmoe
# Copyright 2022 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
medium/flask-testing/locustfile.py | saneravi/ML_Stuff | 209 | 12718711 | <filename>medium/flask-testing/locustfile.py
# Third party modules
from locust import HttpUser, between, task
class MyWebsiteUser(HttpUser):
wait_time = between(5, 15)
@task
def load_main(self):
self.client.get("/")
|
testing/utilities/client.py | boidolr/git-code-debt | 213 | 12718721 | import json
from typing import TYPE_CHECKING
import flask.testing
import pyquery
class Response:
"""A Response wraps a response from a testing Client."""
def __init__(self, response):
self.response = response
@property
def text(self):
return self.response.data.decode(self.response.c... |
core/utils/farthest_points_torch.py | AlbertoRemus/GDR_Net | 132 | 12718725 | # https://github.com/NVlabs/latentfusion/blob/master/latentfusion/three/utils.py
import torch
from torch.nn import functional as F
def farthest_points(
data,
n_clusters: int,
dist_func=F.pairwise_distance,
return_center_indexes=True,
return_distances=False,
verbose=False,
init_center=True,... |
zentral/contrib/osquery/views/file_categories.py | arubdesu/zentral | 634 | 12718743 | <reponame>arubdesu/zentral<gh_stars>100-1000
import logging
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.urls import reverse_lazy
from django.views.generic import CreateView, DeleteView, DetailView, ListView, UpdateView
from zentral.contrib.osquery.forms import FileCategoryForm
from zentra... |
kedro/extras/datasets/tracking/__init__.py | daniel-falk/kedro | 2,047 | 12718756 | """Dataset implementations to save data for Kedro Experiment Tracking"""
__all__ = ["MetricsDataSet", "JSONDataSet"]
from contextlib import suppress
with suppress(ImportError):
from kedro.extras.datasets.tracking.metrics_dataset import MetricsDataSet
with suppress(ImportError):
from kedro.extras.datasets.tr... |
tests/stream/test_stream_3.py | vaartis/python-lz4 | 193 | 12718767 | import lz4.stream
import pytest
import sys
_1KB = 1024
_1MB = _1KB * 1024
_1GB = _1MB * 1024
def compress(x, c_kwargs):
c = []
with lz4.stream.LZ4StreamCompressor(**c_kwargs) as proc:
for start in range(0, len(x), c_kwargs['buffer_size']):
chunk = x[start:start + c_kwargs['buffer_size']]... |
warp/sim/import_snu.py | addy1997/warp | 306 | 12718776 | # Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... |
atp-auto-core-open/atp/engine/api_report.py | rebecca1202/testAuto | 130 | 12718839 | <reponame>rebecca1202/testAuto<filename>atp-auto-core-open/atp/engine/api_report.py
# -*- coding:utf-8 -*-
import datetime
from atp.api.comm_log import logger
from atp.api.mysql_manager import (
ApiTestReportManager as arm, ApiTestcaseInfoManager as atim,
ApiTestcaseMainManager as atmm
)
from atp.utils.tools ... |
intro/summary-exercises/examples/plot_optimize_lidar_complex_data.py | zmoon/scipy-lecture-notes | 2,538 | 12718868 | """
The lidar system, data (2 of 2 datasets)
========================================
Generate a chart of more complex data recorded by the lidar system
"""
import numpy as np
import matplotlib.pyplot as plt
waveform_2 = np.load('waveform_2.npy')
t = np.arange(len(waveform_2))
fig, ax = plt.subplots(figsize=(8, 6)... |
doc/make_doc_plots.py | varman-m/eeg_notebooks_doc | 154 | 12718880 | """Create the images for the FOOOF documentation."""
import shutil
import numpy as np
import matplotlib.pyplot as plt
from fooof import FOOOF, FOOOFGroup
from fooof.sim.gen import gen_power_spectrum
from fooof.plts.utils import check_ax
from fooof.plts.spectra import plot_spectrum
from fooof.utils.download import lo... |
upvote/gae/modules/upvote_app/api/web/users_test.py | iwikmai/upvote | 453 | 12718902 | # Copyright 2017 Google Inc. 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 a... |
rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py | m4sterchain/mesapy | 381 | 12718917 | <filename>rpython/jit/backend/llsupport/test/test_zrpy_gc_direct.py
from rpython.jit.backend.detect_cpu import getcpuclass
from rpython.jit.tool.oparser import parse
from rpython.jit.metainterp.history import JitCellToken, NoStats
from rpython.jit.metainterp.history import BasicFinalDescr, BasicFailDescr
from rpython.j... |
HLTrigger/HLTfilters/test/hltHighLevel.py | ckamtsikis/cmssw | 852 | 12718931 | <filename>HLTrigger/HLTfilters/test/hltHighLevel.py
import FWCore.ParameterSet.Config as cms
process = cms.Process('TEST')
process.options = cms.untracked.PSet(
wantSummary = cms.untracked.bool(True)
)
process.load('FWCore.MessageService.MessageLogger_cfi')
process.MessageLogger.cerr.INFO = cms.untracked.PSet(
... |
test_matterport.py | kopetri/LayoutNetv2 | 166 | 12718942 | from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
print("PyTorch Version: ",torch.__version__)
import pickle
import os
import scipy.io as sio
import cv2
from model import *
from pano import get_ini_cor
from pano_op... |
test/SIM_test_ip/Modified_data/next_level.py | gilbertguoze/trick | 647 | 12718961 |
test.ip.c_pointer_types.cpp[0][0][0] = ["Cat" , "Dog"]
test.ip.c_pointer_types.cpp[0][0][1] = ["Horse"]
|
Bio/Alphabet/__init__.py | lukasz-kozlowski/biopython | 2,856 | 12718973 | <reponame>lukasz-kozlowski/biopython
# Copyright 2000-2002 by <NAME>.
# Revisions copyright 2007-2010 by <NAME>.
# All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that... |
recipes/Python/578851_BentleyKnuth_problem/recipe-578851.py | tdiprima/code | 2,023 | 12718993 | # bentley_knuth.py
# Author: <NAME> - http://www.dancingbison.com
# Version: 0.1
# The problem this program tries to solve is from the page:
# http://www.leancrew.com/all-this/2011/12/more-shell-less-egg/
# Description: The program Bentley asked Knuth to write:
# Read a file of text, determine the n most frequently ... |
saleor/payment/gateways/adyen/tests/webhooks/test_get_or_create_adyen_partial_payments.py | victor-abz/saleor | 1,392 | 12719000 | <filename>saleor/payment/gateways/adyen/tests/webhooks/test_get_or_create_adyen_partial_payments.py
from decimal import Decimal
from ...webhooks import get_or_create_adyen_partial_payments
def test_get_or_create_adyen_partial_payments_with_additional_actions_response(
payment_adyen_for_checkout,
):
# given
... |
addon-sdk-1.17/python-lib/cuddlefish/util.py | hankduan/firefoxExtension | 102 | 12719012 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
IGNORED_FILE_PREFIXES = ["."]
IGNORED_FILE_SUFFIXES = ["~", ".swp"]
IGNORED_DIRS = [".git", ".svn", ".hg"]
def filter_... |
cloudbaseinit/tests/plugins/windows/test_azureguestagent.py | andia10240/cloudbase-init | 160 | 12719031 | <reponame>andia10240/cloudbase-init<filename>cloudbaseinit/tests/plugins/windows/test_azureguestagent.py
# Copyright (c) 2017 Cloudbase Solutions Srl
#
# 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... |
lldb/packages/Python/lldbsuite/test/lang/cpp/thread_local/TestThreadLocal.py | medismailben/llvm-project | 456 | 12719042 | <gh_stars>100-1000
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
lldbinline.MakeInlineTest(__file__, globals(),
lldbinline.expectedFailureAll(oslist=[
"windows", "linux", "netbsd"]))
|
example/example_brotli_project.py | dish59742/brotlicffi | 111 | 12719066 | """A simple project that is compatible with both
'brotli' C bindings and 'brotlicffi' CFFI bindings
"""
import sys
try:
import brotlicffi as brotli
except ImportError:
import brotli
def main():
data = sys.argv[1].encode("utf-8")
print(f"Compressing data: {data}")
compressor = brotli.Compressor(... |
h2o-py/tests/testdir_algos/glm/pyunit_random_attack_medium.py | ahmedengu/h2o-3 | 6,098 | 12719087 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import print_function
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
import random
def random_attack():
def cointoss():
return random.randint(0, 1)
def attack(family, train, valid,... |
core/models/utils.py | zuimeiyujianni/MobileStyleGAN.pytorch | 540 | 12719092 | import torch
class NoiseManager:
def __init__(self, noise, device, trace_model=False):
self.device = device
self.noise_lut = {}
if noise is not None:
for i in range(len(noise)):
if not None in noise:
self.noise_lut[noise[i].size(-1)] = noise[... |
37_First_Neural_Style_Transfer/01_float32/03_weight_quantization.py | khanfarhan10/PINTO_model_zoo | 1,529 | 12719095 | ### tensorflow==2.2.0
import tensorflow as tf
# Weight Quantization - Input/Output=float32
converter = tf.lite.TFLiteConverter.from_saved_model('saved_model_mosaic')
converter.optimizations = [tf.lite.Optimize.OPTIMIZE_FOR_SIZE]
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS,tf.lite.OpsSet.SELE... |
gen/tests/conftest.py | makkes/dcos | 2,577 | 12719099 | import os
import pytest
import dcos_installer.config_util
@pytest.fixture(autouse=True)
def mock_installer_latest_complete_artifact(monkeypatch):
monkeypatch.setattr(
dcos_installer.config_util,
'installer_latest_complete_artifact',
lambda _: {'bootstrap': os.getenv('BOOTSTRAP_ID', '1234... |
dwitter/templatetags/to_gravatar_url.py | moonrisewarrior/dwitter | 714 | 12719104 | <reponame>moonrisewarrior/dwitter<filename>dwitter/templatetags/to_gravatar_url.py
import hashlib
from django import template
register = template.Library()
@register.filter
def to_gravatar_url(email):
return ('https://gravatar.com/avatar/%s?d=retro' %
hashlib.md5((email or '').strip().lower().encode(... |
shub/version.py | PyExplorer/shub | 111 | 12719152 | <filename>shub/version.py<gh_stars>100-1000
from __future__ import absolute_import
import click
import shub
@click.command(help="Show shub version")
def cli():
click.echo(shub.__version__)
|
aliyun-python-sdk-gdb/aliyunsdkgdb/request/v20190903/CreateDBInstanceRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 12719161 | <filename>aliyun-python-sdk-gdb/aliyunsdkgdb/request/v20190903/CreateDBInstanceRequest.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... |
scripts/readHeader.py | andrei-markeev/ts2c | 1,097 | 12719181 | #!/usr/bin/python
import sys
import CppHeaderParser
import json
import pprint
import re
cppHeader = CppHeaderParser.CppHeader(sys.argv[1])
#pp = pprint.PrettyPrinter(indent=4)
#pp.pprint(cppHeader)
#sys.exit(0)
def convertType(type):
if type == "int":
return "number"
elif type == "con... |
pyautogui__keyboard__examples/hotkey_change_state.py | DazEB2/SimplePyScripts | 117 | 12719245 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
RUN_COMBINATION = 'Ctrl+Shift+R'
QUIT_COMBINATION = 'Ctrl+Shift+T'
AUTO_ATTACK_COMBINATION = 'Ctrl+Shift+Space'
BOT_DATA = {
'AUTO_ATTACK': False,
}
def change_auto_attack():
BOT_DATA['AUTO_ATTACK'] = n... |
salt/_modules/metalk8s_sysctl.py | SaintLoong/metalk8s | 255 | 12719263 | <reponame>SaintLoong/metalk8s
# -*- coding: utf-8 -*-
"""
Execution module to handle MetalK8s sysctl.
"""
import configparser
import pathlib
from salt.exceptions import CommandExecutionError
import salt.utils.files
__virtualname__ = "metalk8s_sysctl"
# Order in this list defines the precedence
SYSCTL_CFG_DIRECTORIE... |
src/masonite/packages/Package.py | StevenMHernandez/masonite | 1,816 | 12719271 | <reponame>StevenMHernandez/masonite<filename>src/masonite/packages/Package.py
import os
class Package:
def __init__(self):
self.root_dir = ""
self.name = ""
self.config = ""
self.commands = []
self.views = []
self.migrations = []
self.controller_locations = ... |
alipay/aop/api/response/AnttechBlockchainSignIndexCreateResponse.py | antopen/alipay-sdk-python-all | 213 | 12719279 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AnttechBlockchainSignIndexCreateResponse(AlipayResponse):
def __init__(self):
super(AnttechBlockchainSignIndexCreateResponse, self).__init__()
self._publish_success =... |
src/tools/plot_episode.py | shahid313/embedding-propagation | 184 | 12719298 | <reponame>shahid313/embedding-propagation<filename>src/tools/plot_episode.py<gh_stars>100-1000
import pylab
def plot_episode(episode, classes_first=True):
sample_set = episode["support_set"].cpu()
query_set = episode["query_set"].cpu()
support_size = episode["support_size"]
query_size = episode["query_... |
nidaqmx/_task_modules/triggers.py | stafak/nidaqmx-python | 252 | 12719326 | <reponame>stafak/nidaqmx-python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import ctypes
import numpy
from nidaqmx._lib import lib_importer, wrapped_ndpointer, ctypes_byte_str
from nidaqmx.system.physical_channel... |
opytimizer/optimizers/misc/__init__.py | anukaal/opytimizer | 528 | 12719338 | <gh_stars>100-1000
"""An evolutionary package for all common opytimizer modules.
It contains implementations of miscellaneous-based optimizers.
"""
from opytimizer.optimizers.misc.aoa import AOA
from opytimizer.optimizers.misc.cem import CEM
from opytimizer.optimizers.misc.doa import DOA
from opytimizer.optimizers.mis... |
allennlp_models/lm/util/beam_search_generators/__init__.py | shunk031/allennlp-models | 402 | 12719344 | from .beam_search_generator import BeamSearchGenerator
from .transformer_beam_search_generator import TransformerBeamSearchGenerator
|
gs/monitor2/apps/plugins/layouts/status_layout.py | leozz37/makani | 1,178 | 12719355 | # Copyright 2020 Makani Technologies 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.