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 |
|---|---|---|---|---|---|---|---|---|---|---|
meta/utils.py | peterth3/django-meta | 392 | 196142 | import contextlib
try:
from asgiref.local import Local
except ImportError:
from threading import local as Local # noqa: N812
_thread_locals = Local()
@contextlib.contextmanager
def set_request(request):
"""
Context processor that sets the request on the current instance
"""
_thread_locals._r... | 0 | 1 | 0 | 0 | 1 | 0 |
config/config.py | elementary-data/elementary | 282 | 196151 | import os
from typing import Union
from utils.ordered_yaml import OrderedYaml
ordered_yaml = OrderedYaml()
class Config(object):
SLACK: str = 'slack'
NOTIFICATION_WEBHOOK: str = 'notification_webhook'
WORKFLOWS: str = 'workflows'
CONFIG_FILE_NAME: str = 'config.yml'
def __init__(self, config_dir... | 2 | 6 | 4 | 0 | 12 | 0 |
saleor/account/migrations/0041_permissions_to_groups.py | fairhopeweb/saleor | 15,337 | 196178 | from __future__ import annotations
import re
from collections import defaultdict
from django.db import migrations
def add_users_to_groups_based_on_users_permissions(apps, schema_editor):
"""Add every user to group with "user_permissions" if exists, else create new one.
For each user, if the group with the e... | 0 | 4 | 2 | 0 | 6 | 0 |
setup.py | rickynilsson/astroquery | 577 | 196186 | <filename>setup.py<gh_stars>100-1000
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import sys
# Workaround for https://github.com/pypa/pip/issues/6163
sys.path.insert(0, os.path.dirname(__file__))
import ah_bootstrap
import builtins
builtins._ASTROPY_SETUP_ = True
... | 0 | 0 | 0 | 0 | 0 | 0 |
deepy/trainers/controllers.py | uaca/deepy | 260 | 196225 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
from collections import OrderedDict, defaultdict
class TrainingController(object):
"""
Abstract class of training controllers.
"""
def bind(self, trainer):
"""
:type trainer: deepy.trainers.base.NeuralTra... | 6 | 5 | 0 | 2 | 13 | 0 |
tests/util/test_file_parser.py | Keendata/impala | 746 | 196236 | <reponame>Keendata/impala<gh_stars>100-1000
# 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, ... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/publish_http.py | iss-lab/dcos-commons | 201 | 196270 | <filename>tools/publish_http.py
#!/usr/bin/env python3
#
# Hosts artifacts via a local HTTP service.
# Produces a universe, and puts it in a host dir, then runs an HTTP server against that dir.
#
# Env:
# HTTP_DIR (default: /tmp/dcos-http-<pkgname>/)
# HTTP_HOST (default: 172.17.0.1, which is the ip of the VM when ... | 0 | 0 | 0 | 0 | 0 | 0 |
Ryven/packages/auto_generated/zipapp/nodes.py | tfroehlich82/Ryven | 2,872 | 196278 |
from NENV import *
import zipapp
class NodeBase(Node):
pass
class _Copy_Archive_Node(NodeBase):
"""
Copy an application archive, modifying the shebang line."""
title: str = '_copy_archive'
type_: str = 'zipapp'
init_inputs: list[object] = [
NodeInputBP(label='archive'),
... | 0 | 0 | 30 | 0 | 30 | 0 |
binance_f/model/countdowncancelall.py | vinayakpathak/Binance_Futures_python | 640 | 196287 | class CountdownCancelAll:
def __init__(self):
self.symbol: str = ""
self.countdownTime: int = 0
@staticmethod
def json_parse(json_data) -> object:
result = CountdownCancelAll()
result.symbol = json_data.get_string("symbol")
result.countdownTime = json_data... | 0 | 1 | 0 | 2 | 3 | 0 |
pypy/module/array/interp_array.py | m4sterchain/mesapy | 381 | 196298 | from __future__ import annotations
from rpython.rlib import jit, rgc
from rpython.rlib.buffer import RawBuffer
from rpython.rlib.objectmodel import keepalive_until_here
from rpython.rlib.rarithmetic import ovfcheck, widen
from rpython.rlib.unroll import unrolling_iterable
from rpython.rtyper.annlowlevel import llstr
fr... | 8 | 53 | 2 | 3 | 66 | 0 |
env/lib/python3.5/site-packages/passlib/utils/compat/__init__.py | Udolf15/recommedMeMovies | 172 | 196305 | from __future__ import annotations
"""passlib.utils.compat - python 2/3 compatibility helpers"""
#=============================================================================
# figure out what we're running
#=============================================================================
#-------------------------------... | 1 | 32 | 0 | 0 | 33 | 0 |
flask__webservers/cookies/test.py | gil9red/SimplePyScripts | 117 | 196317 | <filename>flask__webservers/cookies/test.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import requests
session = requests.Session()
rs = session.get('http://127.0.0.1:5001/get-cookies')
print(rs, rs.url)
print(rs.headers)
print(rs.cookies)
print(rs.json())
"""
<Response [200]> http://... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ploomber/util/default.py | lgfunderburk/ploomber | 2,141 | 196319 | from __future__ import annotations
"""
Functions to determine defaults
Layouts
-------
TODO: make sure soopervisor documentation also uses these two terms (simple and
packaged)
There are two layouts that can be used, simple and package.
Simple
------
A project composed of a pipeline.yaml and optionally extra pipeline... | 13 | 15 | 0 | 0 | 28 | 0 |
genbmm/genbmm/sparse.py | harvardnlp/cascaded-generation | 122 | 196326 | <gh_stars>100-1000
import torch
has_cuda = False
try:
import _genbmm
has_cuda = True
except ImportError:
pass
def banddiag(orig_x, lu, ld, fill=0):
s1 = list(orig_x.shape)
s2 = list(orig_x.shape)
x = orig_x
s1[-2] = lu
s2[-2] = ld
x = torch.cat(
[
torch.zeros(... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577509_Flattening_lists/recipe-577509.py | tdiprima/code | 2,023 | 196351 | <reponame>tdiprima/code
def flatten(lst):
if lst:
car,*cdr=lst
if isinstance(car,(list,tuple)):
if cdr: return flatten(car) + flatten(cdr)
return flatten(car)
if cdr: return [car] + flatten(cdr)
return [car]
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_ram.py | nikhil153/codecarbon | 346 | 196358 | import unittest
import numpy as np
from codecarbon.external.hardware import RAM
# TODO: need help: test multiprocess case
class TestRAM(unittest.TestCase):
def test_ram_diff(self):
ram = RAM(tracking_mode="process")
for array_size in [
# (10, 10), # too small to be noticed
... | 0 | 0 | 0 | 0 | 0 | 0 |
data/free_st_chinese_mandarin_corpus.py | yeyupiaoling/MASR | 126 | 196409 | <filename>data/free_st_chinese_mandarin_corpus.py
import argparse
import functools
import codecs
import os
from utility import download, unpack
from utility import add_arguments, print_arguments
URL_ROOT = 'http://www.openslr.org/resources/38'
DATA_URL = URL_ROOT + '/ST-CMDS-20170001_1-OS.tar.gz'
MD5_DATA = 'c28ddfc8e... | 0 | 0 | 0 | 0 | 0 | 0 |
softlearning/environments/gym/wrappers/normalize_action.py | pedrodbs/mbpo | 362 | 196415 | <filename>softlearning/environments/gym/wrappers/normalize_action.py
import gym
from gym import spaces
import numpy as np
__all__ = ['NormalizeActionWrapper']
class NormalizeActionWrapper(gym.ActionWrapper):
"""Rescale the action space of the environment."""
def action(self, action):
if not isinsta... | 0 | 0 | 0 | 0 | 0 | 0 |
ckanext/example_iconfigurer/tests/test_iconfigurer_toolkit.py | gg2/ckan | 2,805 | 196430 | # encoding: utf-8
import pytest
import ckan.plugins.toolkit as toolkit
@pytest.mark.usefixtures("clean_db")
class TestIConfigurerToolkitAddCkanAdminTab(object):
"""
Tests for toolkit.add_ckan_admin_tab used by the IConfigurer interface.
"""
def test_add_ckan_admin_tab_updates_config_dict(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/hpelm/tests/unittest_elm.py | mohyunho/ENAS_ELM | 187 | 196435 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 15 22:04:41 2016
@author: akusok
"""
import os
import tempfile
from unittest import TestCase
import numpy as np
import sys
from hpelm import ELM
class TestCorrectness(TestCase):
def test_AddNeurons_WorksWithLongType(self):
if sys.version... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_forms.py | AnomalistDesignLLC/kansha | 161 | 196443 | # -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
import logging
import unittest
from nagare import database
from elixir imp... | 0 | 0 | 0 | 0 | 0 | 0 |
ppcls/arch/backbone/model_zoo/tnt.py | Adgeros/PaddleClas | 3,763 | 196447 | # copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | 39 | 9 | 0 | 0 | 48 | 0 |
AppServer/lib/django-1.4/tests/modeltests/model_formsets/models.py | loftwah/appscale | 790 | 196471 | import datetime
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
class Meta:
ordering: tuple[str] = ('name',)
def __unicode__(self) -> object:
return self.name
class BetterAuthor(Author):
write_speed = models.IntegerField()
class Boo... | 0 | 18 | 6 | 0 | 24 | 0 |
test-framework/test-suites/integration/tests/ansible/test_stacki_box_info.py | sammeidinger/stack | 123 | 196473 | class TestStackiBoxInfo:
def test_no_name(self, run_ansible_module):
result = run_ansible_module("stacki_box_info")
assert result.status == "SUCCESS"
assert result.data["changed"] == False
assert len(result.data["boxes"]) == 2
def test_with_name(self, run_ansible_module):
result = run_ansible_module("sta... | 0 | 0 | 0 | 0 | 0 | 0 |
h2o-py/tests/testdir_persist/pyunit_persistence.py | kernelrich/h2o-3 | 6,098 | 196495 | <filename>h2o-py/tests/testdir_persist/pyunit_persistence.py
import h2o
import os
from h2o.exceptions import H2OValueError
from h2o.persist import set_s3_credentials
from tests import pyunit_utils
def s3_access_test():
access_key_id = os.environ['AWS_ACCESS_KEY_ID']
secret_access_key = os.environ['AWS_SECRE... | 0 | 0 | 0 | 0 | 0 | 0 |
m2-modified/ims/common/agentless-system-crawler/crawler/plugins/systems/dockerps_host_crawler.py | CCI-MOC/ABMI | 108 | 196503 | import logging
from icrawl_plugin import IHostCrawler
from utils.dockerutils import exec_dockerps
from utils.features import DockerPSFeature
logger = logging.getLogger('crawlutils')
class DockerpsHostCrawler(IHostCrawler):
def get_feature(self) -> str:
return 'dockerps'
def crawl(self, **kwargs):
... | 0 | 1 | 0 | 0 | 1 | 0 |
lib/noti/slack_noti.py | DefenceLogic/Osmedeus | 3,602 | 196522 | <gh_stars>1000+
import os
import json
import sys
import random
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import slack
from lib.core import utils
'''
Sending message to Slack
'''
def slack_monitor(options, filename, monitor_type='new'):
try:
if options.get('SLACK_MONITO... | 0 | 0 | 0 | 0 | 0 | 0 |
tabulator/writers/csv.py | BCODMO/tabulator-py | 224 | 196524 | <reponame>BCODMO/tabulator-py
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import six
import unicodecsv
from ..writer import Writer
from .. import helpers
# Module API
class CSVW... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow_similarity/classification_metrics/classification_metric.py | phillips96/similarity | 706 | 196544 | <reponame>phillips96/similarity
# Copyright 2021 The TensorFlow 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... | 0 | 0 | 0 | 0 | 0 | 0 |
content/test/gpu/gpu_tests/path_util.py | google-ar/chromium | 777 | 196577 | # Copyright (c) 2015 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.
import os
import sys
def GetChromiumSrcDir() -> object:
return os.path.abspath(os.path.join(
os.path.dirname(__file__), os.pardir, os.pardir, o... | 0 | 2 | 0 | 0 | 2 | 0 |
macro_benchmark/DeepInterest/din/infer.py | songhappy/ai-matrix | 180 | 196580 | import os
import time
import pickle
import random
import numpy as np
import tensorflow as tf
import sys
from input import DataInput, DataInputTest
from model import Model
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--batch_size", type=int, default=256, help="inference batch size")
args = pa... | 0 | 1 | 0 | 0 | 1 | 0 |
unsupervised/coherence.py | jmparelman/dynamic-nmf | 269 | 196586 | # --------------------------------------------------------------
from __future__ import annotations
class ModelSimilarity:
'''
Uses a model (e.g. Word2Vec model) to calculate the similarity between two terms.
'''
def __init__( self, model ):
self.model = model
def similarity( self, ranking_i, ranking_j ) -> ... | 0 | 3 | 0 | 0 | 3 | 0 |
mmdet/models/necks/fpn_carafe.py | evgps/mmdetection_trashcan | 12,377 | 196605 | from __future__ import annotations
import torch.nn as nn
from mmcv.cnn import ConvModule, build_upsample_layer, xavier_init
from mmcv.ops.carafe import CARAFEPack
from ..builder import NECKS
@NECKS.register_module()
class FPN_CARAFE(nn.Module):
"""FPN_CARAFE is a more flexible implementation of FPN. It allows mo... | 5 | 3 | 0 | 0 | 8 | 0 |
warp/tests/test_grad.py | NVIDIA/warp | 306 | 196608 | <gh_stars>100-1000
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/optional_attrs.py | flying-sheep/goatools | 477 | 196640 | <reponame>flying-sheep/goatools<gh_stars>100-1000
"""Test the loading of the optional GO term fields."""
# https://owlcollab.github.io/oboformat/doc/GO.format.obo-1_4.html
__copyright__ = "Copyright (C) 2010-2018, <NAME>, <NAME>, All rights reserved."
__author__ = "<NAME>"
import os
import sys
import re
import timei... | 0 | 0 | 0 | 0 | 0 | 0 |
jet_django/deps/rest_framework/documentation.py | lukejamison/jet-dasboard | 193 | 196641 | <reponame>lukejamison/jet-dasboard<gh_stars>100-1000
from django.conf.urls import include, url
from jet_django.deps.rest_framework.renderers import (
CoreJSONRenderer, DocumentationRenderer, SchemaJSRenderer
)
from jet_django.deps.rest_framework.schemas import SchemaGenerator, get_schema_view
from jet_django.deps.... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/vera/lock.py | andersop91/core | 22,481 | 196642 | <reponame>andersop91/core
"""Support for Vera locks."""
from __future__ import annotations
from typing import Any
import pyvera as veraApi
from homeassistant.components.lock import (
DOMAIN as PLATFORM_DOMAIN,
ENTITY_ID_FORMAT,
LockEntity,
)
from homeassistant.config_entries import ConfigEntry
from homea... | 0 | 0 | 0 | 0 | 0 | 0 |
sequana/utils/datatables_js.py | khourhin/sequana | 138 | 196685 | # coding: utf-8
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# <NAME> <<EMAIL>>,
# <<EMAIL>>
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# ... | 5 | 18 | 0 | 1 | 24 | 0 |
modules/nltk_contrib/tiger/query/result.py | h4ck3rm1k3/NLP-project | 123 | 196714 | <reponame>h4ck3rm1k3/NLP-project
# -*- coding: utf-8 -*-
# Copyright © 2007-2008 Stockholm TreeAligner Project
# Author: <NAME> <<EMAIL>>
# Licensed under the GNU GPLv2
"""This module contains classes for building result sets for TIGERSearch queries .
The result builder classes evaluate a TigerSearch query based on th... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/vis.py | tanyinghui/Minimal-Hand-pytorch | 158 | 196716 | <filename>utils/vis.py
import matplotlib.pyplot as plt
def plot3d(joints_,ax, title=None):
joints = joints_.copy()
ax.plot(joints[:, 0], joints[:, 1], joints[:, 2], 'yo', label='keypoint')
ax.plot(joints[:5, 0], joints[:5, 1],
joints[:5, 2],
'r',
label='thumb')
... | 0 | 0 | 0 | 0 | 0 | 0 |
tracing/tracing/value/legacy_unit_info.py | tingshao/catapult | 1,894 | 196744 | <filename>tracing/tracing/value/legacy_unit_info.py
# Copyright 2019 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.
# Python port of legacy_unit_info.html. This is a mapping of various units
# reported by gtest perf tests... | 0 | 0 | 0 | 0 | 0 | 0 |
egs/fisher_callhome_spanish/s5/local/train_get_lattices.py | LanceaKing/kaldi | 116 | 196788 | <filename>egs/fisher_callhome_spanish/s5/local/train_get_lattices.py
#!/usr/bin/env python
# Copyright 2014 <NAME>. Apache 2.0
from __future__ import print_function
import os
import sys
import subprocess
latticeLocation = {1:"/export/a04/gkumar/kaldi-trunk/egs/fishcall_es/j-1/latjosh-2/lattices-pushed/",
2:"/expor... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_triangles.py | hawkaa/trimesh | 1,882 | 196799 | <filename>tests/test_triangles.py
try:
from . import generic as g
except BaseException:
import generic as g
class TrianglesTest(g.unittest.TestCase):
def test_barycentric(self):
for m in g.get_meshes(4):
# a simple test which gets the barycentric coordinate at each of the three
... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/FluidDynamicsApplication/python_scripts/apply_mass_conservation_check_process.py | lkusch/Kratos | 778 | 196815 | from __future__ import absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
import KratosMultiphysics
import KratosMultiphysics.FluidDynamicsApplication as KratosFluid
def Factory(settings, Model) -> object:
if( not isinstance(settings, KratosMultiphysics.Parameters) )... | 0 | 1 | 0 | 0 | 1 | 0 |
createosmanomaly.py | leidix/images-to-osm | 487 | 196817 | import sys
sys.path.append("Mask_RCNN")
import os
import sys
import glob
import osmmodelconfig
import skimage
import math
import imagestoosm.config as osmcfg
import model as modellib
import visualize as vis
import numpy as np
import csv
import QuadKey.quadkey as quadkey
import shapely.geometry as geometry
import shape... | 0 | 6 | 2 | 0 | 8 | 0 |
tests/test_draw.py | mrtrkmn/yellowbrick | 3,662 | 196841 | <gh_stars>1000+
# tests.test_draw
# Tests for the high-level drawing utility functions
#
# Author: <NAME> <<EMAIL>>
# Created: Sun Aug 19 11:21:04 2018 -0400
#
# ID: test_draw.py [dd915ad] <EMAIL> $
"""
Tests for the high-level drawing utility functions
"""
###########################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/pants/option/alias_test.py | yoav-orca/pants | 1,806 | 196846 | <reponame>yoav-orca/pants<filename>src/python/pants/option/alias_test.py<gh_stars>1000+
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from typing import ContextManager
import pytest
from pants.opt... | 0 | 0 | 0 | 0 | 0 | 0 |
src/python/grpcio_tests/tests/unit/framework/common/test_control.py | samotarnik/grpc | 2,151 | 196872 | <filename>src/python/grpcio_tests/tests/unit/framework/common/test_control.py
# Copyright 2015 gRPC 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/lice... | 0 | 0 | 0 | 0 | 0 | 0 |
data/transcoder_evaluation_gfg/python/SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS_1.py | mxl1n/CodeGen | 241 | 196884 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( x , y , z ) -> object :
if ( not ( y / x ) ) :
return y if ( not ( y / z ) ) else z
return x if ( n... | 0 | 1 | 0 | 0 | 1 | 0 |
virtual/lib/python3.9/site-packages/bs4/dammit.py | Mzazi25/Gallery | 1,077 | 196958 | <reponame>Mzazi25/Gallery
# -*- coding: utf-8 -*-
"""Beautiful Soup bonus library: Unicode, Dammit
This library converts a bytestream to Unicode through any means
necessary. It is heavily based on code from <NAME>'s Universal
Feed Parser. It works best on XML and HTML, but it does not rewrite the
XML or HTML to reflec... | 0 | 0 | 0 | 0 | 0 | 0 |
jmilkfansblog/api/hooks.py | xiaoyh121/program | 176 | 196966 | <filename>jmilkfansblog/api/hooks.py
from pecan import hooks
# class DBHook(hooks.PecanHook):
# """Create a db connection instance."""
#
# def before(self, state):
# """Excute the DBHook.before() before handle the restful request."""
# state.request.db_conn = db_api.get_session()
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_loadorder.py | amimo/androguard | 4,084 | 196969 | <gh_stars>1000+
from androguard.core.bytecodes.dvm_types import TypeMapItem
import unittest
class LoadOrderTest(unittest.TestCase):
def testLoadOrder(self):
load_order = TypeMapItem.determine_load_order()
ordered = sorted(load_order, key=lambda i: load_order[i])
dependencies = TypeMapItem... | 0 | 0 | 0 | 0 | 0 | 0 |
fhir/resources/tests/test_substance.py | cstoltze/fhir.resources | 144 | 196987 | <filename>fhir/resources/tests/test_substance.py
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Substance
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from .. import fhirtypes ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_optimization.py | lei-liu1/OCTIS | 340 | 196990 | """Tests for `octis` package related to Hyper-parameter optimization"""
import json
import os
import pytest
from skopt.space.space import Real
from octis.dataset.dataset import Dataset
from octis.evaluation_metrics.coherence_metrics import Coherence
from octis.evaluation_metrics.classification_metrics import F1Score... | 0 | 8 | 0 | 0 | 8 | 0 |
Tests/test_genericmeth.py | aisk/ironpython3 | 1,872 | 197027 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import os
import unittest
from iptest import IronPythonTestCase, is_cli, run_test, skipUnlessIronPython
@skipU... | 0 | 0 | 0 | 0 | 0 | 0 |
pywinusb/hid/winapi.py | j3hyde/pywinusb | 157 | 197034 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
from __future__ import absolute_import
import ctypes
from ctypes import Structure, Union, c_ubyte, c_long, c_ulong, c_ushort, \
c_wchar, c_void_p, c_uint
from ctypes import byref, POINTER, sizeof
from ctypes.wintypes impo... | 1 | 7 | 26 | 1 | 35 | 0 |
examples/libtest/imports/enum/Late.py | takipsizad/pyjs | 739 | 197056 |
def getLate() -> object:
v = Late(**{})
return v
class Late():
value: str = 'late'
| 0 | 1 | 1 | 0 | 2 | 0 |
lithops/tests/test_map.py | rigazilla/lithops | 158 | 197061 | <reponame>rigazilla/lithops
#
# (C) Copyright IBM Corp. 2020
#
# 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 applicab... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/envoy_headersplit/replace_includes_test.py | lopter-dbx/envoy | 218 | 197063 | <filename>tools/envoy_headersplit/replace_includes_test.py
# Lint as: python3
"""Tests for replace_includes."""
import unittest
from unittest import mock
import os
from pathlib import Path
import replace_includes
class ReplaceIncludesTest(unittest.TestCase):
def test_to_classname(self):
# Test file name with ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/core/cube/test_constants.py | jorisvandenbossche/kartothek | 171 | 197065 | from kartothek.core.cube.constants import KTK_CUBE_UUID_SEPERATOR
from kartothek.core.dataset import _validate_uuid
def test_uuid_seperator_valid():
assert _validate_uuid(KTK_CUBE_UUID_SEPERATOR)
| 0 | 0 | 0 | 0 | 0 | 0 |
build/lib/Tuchart/Graph.py | NeveBee/TuChart | 801 | 197066 | #-*- coding:utf-8 -*-
from __future__ import annotations
from pyecharts import Kline, Line, Page,Overlap,Bar,Pie,Timeline
from pandas import DataFrame as df
import re
import tushare as ts
import time
import pandas as pd
try:
xrange # Python 2
except NameError:
xrange = range # Python 3
def calculat... | 0 | 7 | 0 | 0 | 7 | 0 |
src/ansiblelint/rules/TaskNoLocalAction.py | ResilienceCare/ansible-lint | 484 | 197087 | # Copyright (c) 2016, Tsukinowa Inc. <<EMAIL>>
# Copyright (c) 2018, Ansible Project
from ansiblelint.rules import AnsibleLintRule
class TaskNoLocalAction(AnsibleLintRule):
id: str = 'deprecated-local-action'
shortdesc: str = "Do not use 'local_action', use 'delegate_to: localhost'"
description: str = 'Do... | 1 | 1 | 6 | 0 | 8 | 0 |
fuse/accessfs.py | rohankumardubey/allura | 113 | 197092 | #!/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 ... | 2 | 19 | 2 | 8 | 31 | 0 |
ex08.py | Rajab322/lpthw | 329 | 197099 | <reponame>Rajab322/lpthw<filename>ex08.py
formatter = "{} {} {} {}"
print(formatter.format(1, 2, 3, 4))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format(
"I had this th... | 0 | 0 | 0 | 0 | 0 | 0 |
spirit/core/tests/tests_middleware.py | Ke-xueting/Spirit | 974 | 197107 | # -*- coding: utf-8 -*-
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
from django.urls import reverse
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponseRedirect, HttpResponse
from django.conf import settings
from .. import middl... | 0 | 2 | 0 | 0 | 2 | 0 |
tensorflow/python/distribute/parallel_device/saving.py | computationalartist/tensorflow | 190,993 | 197116 | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1 | 4 | 0 | 0 | 5 | 0 |
mayan/apps/documents/signals.py | eshbeata/open-paperless | 2,743 | 197120 | <filename>mayan/apps/documents/signals.py
from __future__ import unicode_literals
from django.dispatch import Signal
post_version_upload = Signal(providing_args=('instance',), use_caching=True)
post_document_type_change = Signal(
providing_args=('instance',), use_caching=True
)
post_document_created = Signal(prov... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/http_client.py | msabramo/diesel | 224 | 197139 | <filename>examples/http_client.py
# vim:ts=4:sw=4:expandtab
'''Simple http client example.
Check out crawler.py for more advanced behaviors involving
many concurrent clients.
'''
from diesel import Application, Loop, log, quickstart, quickstop
from diesel.protocols.http import HttpClient
def req_loop():
for path... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdeploy/codebase/mmseg/models/segmentors/encoder_decoder.py | grimoire/mmdeploy | 746 | 197144 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn.functional as F
from mmdeploy.core import FUNCTION_REWRITER
@FUNCTION_REWRITER.register_rewriter(
func_name='mmseg.models.segmentors.EncoderDecoder.simple_test')
def encoder_decoder__simple_test(ctx, self, img, img_meta, **kwargs) -> object:
"""... | 0 | 1 | 0 | 0 | 1 | 0 |
src/sage/groups/matrix_gps/binary_dihedral.py | UCD4IDS/sage | 1,742 | 197146 | <filename>src/sage/groups/matrix_gps/binary_dihedral.py<gh_stars>1000+
"""
Binary Dihedral Groups
AUTHORS:
- <NAME> (2016-02): initial version
"""
# ****************************************************************************
# Copyright (C) 2016 <NAME> <tscrimsh at umn.edu>
#
# This program is free software: ... | 0 | 0 | 0 | 0 | 0 | 0 |
cmds/appv.py | r0ck3rt/metarget | 295 | 197150 | <gh_stars>100-1000
"""
Application Vulnerabilities Commands
"""
import collections
import operator
import utils.table as table
import utils.color_print as color_print
import utils.checkers as checkers
import utils.filters as filters
import config
import cmds.internal as internal_cmds
from core.vuln_app_manager import... | 0 | 0 | 0 | 0 | 0 | 0 |
app/analyzers/informants/vwap.py | ferreiramarcelo/telegram-crypto-signals | 1,857 | 197151 | <reponame>ferreiramarcelo/telegram-crypto-signals
""" VWAP Indicator
"""
import math
import numpy
import pandas
from talib import abstract
from analyzers.utils import IndicatorUtils
class VWAP(IndicatorUtils):
def analyze(self, historical_data, period_count=15):
"""Performs a VWAP analysis on the histo... | 0 | 0 | 0 | 0 | 0 | 0 |
ptsemseg/loss/__init__.py | stooloveu/pytorch-semseg | 3,348 | 197177 | import logging
import functools
from ptsemseg.loss.loss import (
cross_entropy2d,
bootstrapped_cross_entropy2d,
multi_scale_cross_entropy2d,
)
logger = logging.getLogger("ptsemseg")
key2loss = {
"cross_entropy": cross_entropy2d,
"bootstrapped_cross_entropy": bootstrapped_cross_entropy2d,
"mu... | 0 | 1 | 0 | 0 | 1 | 0 |
testing/example_scripts/fixtures/custom_item/conftest.py | JarnoRFB/pytest | 2,479 | 197229 | <gh_stars>1000+
import pytest
class CustomItem(pytest.Item):
def runtest(self):
pass
class CustomFile(pytest.File):
def collect(self):
yield CustomItem.from_parent(name="foo", parent=self)
def pytest_collect_file(path, parent):
return CustomFile.from_parent(fspath=path, parent=parent)
| 0 | 0 | 0 | 0 | 0 | 0 |
originalFiles/helper_data_scannet_prepare.py | LaureenK/3D-BoNet_LK | 385 | 197232 | <gh_stars>100-1000
from plyfile import PlyData, PlyElement
import numpy as np
import os
import json
import shutil
import csv
### nyu40 class
CLASS_LABELS = ['wall','floor','cabinet', 'bed', 'chair', 'sofa', 'table', 'door', 'window', 'bookshelf', 'picture', 'counter', 'blinds',
'desk', 'shelves', 'curt... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/ghc-paths/defs.bzl | guibou/rules_haskell | 222 | 197238 | <filename>tools/ghc-paths/defs.bzl
load("@bazel_skylib//lib:paths.bzl", "paths")
def _add_data_impl(ctx):
(_, extension) = paths.split_extension(ctx.executable.executable.path)
executable = ctx.actions.declare_file(
ctx.label.name + extension,
)
ctx.actions.symlink(
output = executable,... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/torrenttelik_plugin.py | sergelevin/aceproxy | 182 | 197254 | <gh_stars>100-1000
__author__ = 'miltador'
'''
Torrent-telik.com Playlist Downloader Plugin
(based on ytv plugin by ValdikSS)
http://ip:port/torrent-telik || http://ip:port/torrent-telik/?type=ttv = torrent-tv playlist
http://ip:port/torrent-telik/?type=mob_ttv = torrent-tv mobile playlist
http://ip:port/torrent-telik/... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/sysmonitor.py | anagar20/keras_tools | 347 | 197269 | import time
import datetime
import numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict
import psutil
import threading
from pynvml import (nvmlInit,
nvmlDeviceGetCount,
nvmlDeviceGetHandleByIndex,
nvmlDeviceGetUtilizationRates,
... | 1 | 1 | 1 | 2 | 5 | 0 |
froide/publicbody/migrations/0033_auto_20210203_1554.py | xenein/froide | 198 | 197274 | # Generated by Django 3.1.4 on 2021-02-03 14:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("publicbody", "0032_auto_20201221_1953"),
]
operations: list[object] = [
migrations.RenameField(
model_name="foila... | 0 | 0 | 2 | 0 | 2 | 0 |
03-dict-set/support/hashdiff.py | matteoshen/example-code | 5,651 | 197277 | <reponame>matteoshen/example-code
import sys
MAX_BITS = len(format(sys.maxsize, 'b'))
print('%s-bit Python build' % (MAX_BITS + 1))
def hash_diff(o1, o2):
h1 = '{:>0{}b}'.format(hash(o1), MAX_BITS)
h2 = '{:>0{}b}'.format(hash(o2), MAX_BITS)
diff = ''.join('!' if b1 != b2 else ' ' for b1, b2 in zip(h1, h2)... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/distributed/ddp/compare/python_ddp.py | xiaohanhuang/pytorch | 60,067 | 197303 | <gh_stars>1000+
import functools
import torch
import torch.distributed as dist
import torch.nn as nn
class PythonDDP(nn.Module):
"""
Python only implementation for DistributedDataParallel module.
Unlike the production DistributedDataParallel which relies on many C++ core
utils to manage gradient distr... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/python/kernel_tests/math_ops/cross_grad_test.py | EricRemmerswaal/tensorflow | 190,993 | 197309 | # 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... | 0 | 0 | 0 | 0 | 0 | 0 |
Programming Languages/Python/Theory/100_Python_Exercises/Exercises/Exercise 1/1.py | jaswinder9051998/Resources | 101 | 197319 | <gh_stars>100-1000
#What will this script produce?
#A: 3
a = 1
a = 2
a = 3
print(a)
| 0 | 0 | 0 | 0 | 0 | 0 |
keras_xlnet/tokenizer.py | SchenbergZY/keras-xlnet | 183 | 197326 | <filename>keras_xlnet/tokenizer.py
import unicodedata
import sentencepiece as spm
__all__ = ['Tokenizer']
class Tokenizer(object):
SPM_UNDERLINE = '▁'
SYM_UNK = 0
SYM_BOS = 1
SYM_EOS = 2
SYM_CLS = 3
SYM_SEP = 4
SYM_PAD = 5
SYM_MASK = 6
SYM_EOD = 7
SYM_EOP = 9
def __init... | 0 | 0 | 0 | 0 | 0 | 0 |
qf_lib/common/enums/matplotlib_location.py | webclinic017/qf-lib | 198 | 197340 | <filename>qf_lib/common/enums/matplotlib_location.py
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
pygrametl/drawntabletesting/__init__.py | ssrika17/pygrametl | 259 | 197344 | from __future__ import annotations
"""This module contains classes and functions for defining preconditions and
postconditions for database state. The conditions can be used in unit tests
to efficiently evaluate the expected database state.
"""
# Copyright (c) 2021, Aalborg University (<EMAIL>)
# All rights rese... | 10 | 27 | 1 | 5 | 43 | 0 |
data_capture/schedules/fake_schedule.py | mepsd/CLAC | 126 | 197353 | <gh_stars>100-1000
import csv
import logging
from io import StringIO
from django import forms
from django.core.exceptions import ValidationError
from django.template.loader import render_to_string
from contracts.models import EDUCATION_CHOICES as _EDUCATION_CHOICES
from .base import BasePriceList, min_price_validator... | 0 | 0 | 0 | 0 | 0 | 0 |
grr/server/grr_response_server/instant_output_plugin_test.py | khanhgithead/grr | 4,238 | 197398 | <filename>grr/server/grr_response_server/instant_output_plugin_test.py
#!/usr/bin/env python
# Lint as: python3
"""Tests for grr.lib.output_plugin."""
import io
from absl import app
from grr_response_core.lib import rdfvalue
from grr_response_server import export
from grr_response_server.output_plugins import test_p... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/routers/test_workiary.py | upwork/python-upwork | 150 | 197411 | <gh_stars>100-1000
import upwork
from upwork.routers import workdiary
from unittest.mock import patch
@patch.object(upwork.Client, "get")
def test_get_workdiary(mocked_method):
workdiary.Api(upwork.Client).get_workdiary("company", "date", {})
mocked_method.assert_called_with("/team/v3/workdiaries/companies/co... | 0 | 0 | 0 | 0 | 0 | 0 |
opentuner/driverbase.py | jansel/opentuner | 278 | 197415 | from __future__ import annotations
from opentuner.resultsdb.models import *
class DriverBase(object):
"""
shared base class between MeasurementDriver and SearchDriver
"""
def __init__(self,
session,
tuning_run,
objective,
tuning_run_... | 3 | 2 | 0 | 0 | 5 | 0 |
deprecated/fleet_x/examples/bert_app.py | hutuxian/FleetX | 170 | 197416 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
pypower/case118.py | Bengt/PYPOWER | 221 | 197426 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Power flow data for IEEE 118 bus test case.
"""
from numpy import array
def case118() -> object:
"""Power flow data for IEEE 118 bus test case.
Please... | 0 | 1 | 0 | 0 | 1 | 0 |
problems/49/problem_49.py | r1cc4rdo/daily_coding_problem | 158 | 197436 | <reponame>r1cc4rdo/daily_coding_problem
def coding_problem_49(arr):
"""
Given an array of numbers, find the maximum sum of any contiguous subarray of the array.
For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would take elements
42, 14, -5, and 86. Given th... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_document.py | francolq/iepy | 813 | 197455 | <gh_stars>100-1000
from iepy.preprocess.ner.base import FoundEntity
from .factories import SentencedIEDocFactory, GazetteItemFactory
from .manager_case import ManagerTestCase
class TestDocumentInvariants(ManagerTestCase):
def test_cant_set_different_number_of_synparse_than_sentences(self):
doc = Sentenc... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pudl/analysis/state_demand.py | Wheelspawn/pudl | 285 | 197477 | """
Predict state-level electricity demand.
Using hourly electricity demand reported at the balancing authority and utility
level in the FERC 714, and service territories for utilities and balancing
autorities inferred from the counties served by each utility, and the utilities
that make up each balancing authority in... | 36 | 17 | 3 | 0 | 56 | 0 |
LeetCode/python3/775.py | ZintrulCre/LeetCode_Archiver | 279 | 197506 | class Solution:
def isIdealPermutation(self, A) -> bool:
"""
:type A: List[int]
:rtype: bool
"""
size, m = len(A), 0
for i in range(size - 2):
m = max(m, A[i])
if m > A[i + 2]:
return False
return True
| 0 | 1 | 0 | 0 | 1 | 0 |
L1TriggerConfig/RPCTriggerConfig/test/checkRPCConnections.py | ckamtsikis/cmssw | 852 | 197509 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
process = cms.Process("check")
# rpc geometry
process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
process.load("Geometry.MuonCommonData.muonIdealGeometryXML_cfi")
process.load("Geometry.RPCGeometry.rpcGeometry_cfi")
process.load("L1Trigg... | 0 | 0 | 0 | 0 | 0 | 0 |
temboardui/model/tables.py | missmoiselle/temboard | 294 | 197546 | from sqlalchemy.sql import text
from sqlalchemy.schema import (
MetaData,
Table,
Column,
CheckConstraint,
ForeignKeyConstraint
)
from sqlalchemy.types import (
Integer,
UnicodeText,
BigInteger,
Boolean,
)
metadata = MetaData()
roles = Table(
'roles', metadata,
Column('role... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/util/migrations/0002_complaintbouncemeta_permanentbouncemeta_transientbounceemail.py | dimagilg/commcare-hq | 471 | 197589 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-01-27 17:01
from __future__ import unicode_literals
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dep... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/test_issue4.py | dbajar/segno | 254 | 197618 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2020 -- <NAME>
# All rights reserved.
#
# License: BSD License
#
"""\
Test against issue #4.
<https://github.com/heuer/segno/issues/4>
"""
from __future__ import unicode_literals, absolute_import
from segno import consts, encoder
def test_issue_4():
qr = encoder.en... | 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.