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 |
|---|---|---|---|---|---|---|---|---|---|---|
ogb_examples/nodeproppred/ogbn-proteins/unimp_cross_feat/dataset/random_partition_dataset.py | zbmain/PGL | 1,389 | 3352490 | <gh_stars>1000+
# 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 r... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/modules/io_related/test_io_StringIO.py | aisk/ironpython3 | 1,872 | 3352501 | <reponame>aisk/ironpython3
# 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.
##
## Test the io.StringIO
## based on cStringIO_test.py
##
import unittest
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/fahclient.py | beornf/salt-contrib | 111 | 3352512 | # -*- coding: utf-8 -*-
from __future__ import annotations
'''
Support for FAHClient
'''
from __future__ import absolute_import
import os
import salt.utils
def __virtual__() -> bool | str:
'''
Only load the module if FAHClient is installed
'''
if salt.utils.which('FAHClient'):
return 'fahclie... | 0 | 11 | 0 | 0 | 11 | 0 |
utils/optimization.py | UltronAI/Neural-SLAM | 562 | 3352515 | <reponame>UltronAI/Neural-SLAM<filename>utils/optimization.py<gh_stars>100-1000
import inspect
import re
from torch import optim
def get_optimizer(parameters, s):
"""
Parse optimizer parameters.
Input should be of the form:
- "sgd,lr=0.01"
- "adagrad,lr=0.1,lr_decay=0.05"
"""
if "... | 0 | 0 | 0 | 0 | 0 | 0 |
PathPlanning/DStarLite/d_star_lite.py | duken72/PythonRobotics | 15,431 | 3352516 | <filename>PathPlanning/DStarLite/d_star_lite.py
"""
D* Lite grid planning
author: vss2sn (<EMAIL>+<EMAIL>)
Link to papers:
D* Lite (Link: http://idm-lab.org/bib/abstracts/papers/aaai02b.pd)
Improved Fast Replanning for Robot Navigation in Unknown Terrain
(Link: http://www.cs.cmu.edu/~maxim/files/dlite_icra02.pdf)
Imple... | 0 | 0 | 0 | 0 | 0 | 0 |
boto/ec2/elb/attributes.py | Yurzs/boto | 5,079 | 3352555 | <reponame>Yurzs/boto
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# tribute, subli... | 0 | 0 | 0 | 0 | 0 | 0 |
testapp/app/app/tests/test_views.py | HomesteadCabinet/django-baton | 620 | 3352560 | import json
from baton.views import GetAppListJsonView
from django.contrib.auth.models import Permission, User
from django.test import TestCase
from django.urls import reverse
class TestBatonViews(TestCase):
def setUp(self):
self.user = User.objects.create_user(
'user', email='<EMAIL>', passw... | 0 | 0 | 0 | 0 | 0 | 0 |
photogrammetry_importer/utility/timing_utility.py | clayne/Blender-Addon-Photogrammetry-Importer | 452 | 3352568 | <gh_stars>100-1000
import time
class StopWatch(object):
"""Class to measure computation times."""
def __init__(self):
self.last_t = time.time()
def reset_time(self):
"""Reset the stop watch to the current point in time."""
self.last_t = time.time()
def get_elapsed_time(self)... | 0 | 0 | 0 | 0 | 0 | 0 |
src/openvr/tracked_devices_actor.py | risa2000/pyopenvr | 204 | 3352572 | <gh_stars>100-1000
#!/bin/env python
# file tracked_devices_actor.py
import time
from ctypes import cast, c_float, c_void_p, sizeof
import numpy
from OpenGL import GL
from OpenGL.GL.shaders import compileShader, compileProgram
from OpenGL.arrays import vbo
from OpenGL.GL.EXT.texture_filter_anisotropic import GL_TEXT... | 0 | 0 | 0 | 0 | 0 | 0 |
zoo/squeezenet/squeezenet_complex_c.py | Pandinosaurus/keras-idiomatic-programmer | 833 | 3352595 | <reponame>Pandinosaurus/keras-idiomatic-programmer
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | 0 | 0 | 0 | 0 | 0 | 0 |
cross3d/migrate/imagesequence.py | vedantirb/cross3d | 129 | 3352611 | <reponame>vedantirb/cross3d
import os
import re
# define the default environment variables
OS_TYPE = ''
if (os.name == 'posix'):
OS_TYPE = 'Linux'
elif (os.name == 'nt'):
OS_TYPE = 'Windows'
elif (os.name == 'osx'):
OS_TYPE = 'MacOS'
def imageSequenceFromFileName(fileName):
r"""
Gets a list of files that belong ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_visualize_pathways.py | Bertware/transitfeed | 647 | 3352614 | <filename>tests/test_visualize_pathways.py
import os.path
import unittest
import visualize_pathways
def get_file_contents(filename):
with open(filename, 'rb') as f:
return f.read()
class TestVisualizePathways(unittest.TestCase):
def test_gtfs_to_graphviz(self):
testdata_dir = os.path.join(o... | 0 | 0 | 0 | 0 | 0 | 0 |
models/course_test.py | noryb009/rmc | 164 | 3352617 | import rmc.models as m
import rmc.test.lib as testlib
class CourseTest(testlib.FixturesTestCase):
def assertResultsEquals(self, results, expected):
self.assertItemsEqual([course['id'] for course in results], expected)
def test_search(self):
# Test empty search
results, has_more = m.C... | 0 | 0 | 0 | 0 | 0 | 0 |
src/networkx/readwrite/tests/test_leda.py | MarletteFunding/aws-kube-codesuite | 184 | 3352659 | <gh_stars>100-1000
#!/usr/bin/env python
from nose.tools import *
import networkx as nx
import io,os,tempfile
class TestLEDA(object):
def test_parse_leda(self):
data="""#header section \nLEDA.GRAPH \nstring\nint\n-1\n#nodes section\n5 \n|{v1}| \n|{v2}| \n|{v3}| \n|{v4}| \n|{v5}| \n\n#edges section\n7 \n... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/strings/ulcase.py | Fryguy/py2rb | 124 | 3352667 |
s = "aBcddEzUh"
print(s)
s = s.upper()
print(s)
s = s.lower()
print(s)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/fork/Burners/test_yburner.py | AqualisDAO/curve-dao-contracts | 217 | 3352669 | <reponame>AqualisDAO/curve-dao-contracts<gh_stars>100-1000
import pytest
from brownie import Contract
@pytest.fixture(scope="module")
def burner(YBurner, alice, receiver):
yield YBurner.deploy(receiver, receiver, alice, alice, {"from": alice})
y_unwrap = (
("0xC2cB1040220768554cf699b0d863A3cd4324ce32", "y/y... | 0 | 0 | 0 | 0 | 0 | 0 |
fhir/resources/DSTU2/communication.py | cstoltze/fhir.resources | 144 | 3352673 | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Communication
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import Any, Dict
from typing import List as ListType
from pydantic import Field, root_validator
from . import fhirtypes
from .backboneelement import BackboneElement
f... | 1 | 1 | 16 | 0 | 18 | 0 |
ffcv/fields/decoders.py | neuroailab/ffcv | 1,969 | 3352718 | from .basics import FloatDecoder, IntDecoder
from .ndarray import NDArrayDecoder
from .rgb_image import RandomResizedCropRGBImageDecoder, CenterCropRGBImageDecoder, SimpleRGBImageDecoder
from .bytes import BytesDecoder
__all__ = ['FloatDecoder', 'IntDecoder', 'NDArrayDecoder', 'RandomResizedCropRGBImageDecoder',
... | 0 | 0 | 0 | 0 | 0 | 0 |
crabageprediction/venv/Lib/site-packages/fontTools/varLib/builder.py | 13rianlucero/CrabAgePrediction | 2,705 | 3352719 | from fontTools import ttLib
from fontTools.ttLib.tables import otTables as ot
# VariationStore
def buildVarRegionAxis(axisSupport) -> object:
self = ot.VarRegionAxis()
self.StartCoord, self.PeakCoord, self.EndCoord = [float(v) for v in axisSupport]
return self
def buildVarRegion(support, axisTags) -> object:
ass... | 3 | 12 | 0 | 0 | 15 | 0 |
tests/testmigrationsapp/models.py | vicpopov/django-partial-index | 114 | 3352721 | """Models for tests."""
from __future__ import unicode_literals
from django.db import models
from partial_index import PartialIndex, PQ, PF
class User(models.Model):
name = models.CharField(max_length=50)
def __str__(self) -> object:
return self.name
class Room(models.Model):
name = models.C... | 0 | 2 | 3 | 0 | 5 | 0 |
pyknon/pc_sets.py | otfreetime/pyknon | 184 | 3352810 | PC_SETS = {
'3-1': [0, 1, 2],
'3-10': [0, 3, 6],
'3-11': [0, 3, 7],
'3-12': [0, 4, 8],
'3-2': [0, 1, 3],
'3-3': [0, 1, 4],
'3-4': [0, 1, 5],
'3-5': [0, 1, 6],
'3-6': [0, 2, 4],
'3-7': [0, 2, 5],
'3-8': [0, 2, 6],
'3-9': [0, 2, 7],
'4-1': [0, 1, 2, 3],
'4-10': [0, ... | 0 | 0 | 0 | 0 | 0 | 0 |
netbox/extras/lookups.py | TheFlyingCorpse/netbox | 4,994 | 3352884 | from django.db.models import CharField, Lookup
class Empty(Lookup):
"""
Filter on whether a string is empty.
"""
lookup_name: str = 'empty'
def as_sql(self, qn, connection) -> tuple[object, object]:
lhs, lhs_params = self.process_lhs(qn, connection)
rhs, rhs_params = self.process_... | 0 | 1 | 1 | 0 | 2 | 0 |
torchx/cli/test/cmd_describe_test.py | LaudateCorpus1/torchx | 101 | 3352888 | <reponame>LaudateCorpus1/torchx
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import unittest
from unittest.mock impor... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_fcm.py | nakanin/airnotifier | 558 | 3352892 | from __future__ import annotations
from pushservices.fcm import FCMClient
import unittest
import sys
from unittest.mock import MagicMock, patch
from util import json_decode
def mocked_tornado_http(*args, **kwargs) -> object:
class HTTP:
async def fetch(self, url, **kwargs) -> object:
body = kw... | 0 | 4 | 0 | 0 | 4 | 0 |
container_provis/old/mldbami.py | kstepanmpmg/mldb | 665 | 3352896 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# **********
# Filename: mldbami.py
# Description: Transform a Ubuntu 12.04 machine into the MLDB AMI
# Author: <NAME>
# Creation Date: April 01, 2015
# Revision Date: June 15, 2015
# **********
# General imports
import sys
import cuisine
import s... | 0 | 0 | 0 | 0 | 0 | 0 |
ibrnet/criterion.py | QiuhongAnnaWei/IBRNet | 254 | 3352935 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 0 | 1 | 0 | 0 | 1 | 0 |
pyperformance/benchmarks/bm_2to3.py | cvautounix/pyperformance | 266 | 3352963 | import glob
import os.path
import sys
import pyperf
if __name__ == "__main__":
runner = pyperf.Runner()
runner.metadata['description'] = "Performance of the Python 2to3 program"
args = runner.parse_args()
datadir = os.path.join(os.path.dirname(__file__), 'data', '2to3')
pyfiles = glob.glob(os.p... | 0 | 0 | 0 | 0 | 0 | 0 |
gobbli/model/mtdnn/src/gobbli_train.py | awesome-archive/gobbli | 276 | 3352986 | from __future__ import annotations
import argparse
import csv
import json
import logging
import os
from datetime import datetime
import torch
from data_utils.log_wrapper import create_logger
from data_utils.metrics import compute_acc, compute_cross_entropy
from data_utils.utils import set_environment
from mt_dnn.gobbl... | 2 | 5 | 0 | 0 | 7 | 0 |
atest/testdata/keywords/type_conversion/FutureAnnotations.py | phil-davis/robotframework | 7,073 | 3353007 | from __future__ import annotations
from collections.abc import Mapping
from numbers import Integral
from typing import List
def concrete_types(a: int, b: bool, c: list):
assert a == 42, repr(a)
assert b is False, repr(b)
assert c == [1, 'kaksi'], repr(c)
def abcs(a: Integral, b: Mapping):
assert a =... | 9 | 0 | 0 | 0 | 9 | 0 |
scripts/prepare_megadepth_valid_list.py | jiangwei221/COTR-1 | 283 | 3353012 | <filename>scripts/prepare_megadepth_valid_list.py
import os
import json
import tables
from tqdm import tqdm
import numpy as np
def read_all_imgs(base_dir):
all_imgs = []
for cur, dirs, files in os.walk(base_dir):
if 'imgs' in cur:
all_imgs += [os.path.join(cur, f) for f in files]
all_... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/libs/indexer/src/indexer/controller.py | yetsun/hue | 5,079 | 3353016 | <reponame>yetsun/hue<gh_stars>1000+
#!/usr/bin/env python
# -- coding: utf-8 --
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under... | 0 | 0 | 0 | 0 | 0 | 0 |
iotbx/logfiles.py | dperl-sol/cctbx_project | 155 | 3353017 |
from __future__ import annotations
from __future__ import absolute_import, division, print_function
import cStringIO
import sys, os, re
from six.moves import zip
def check_bin_format(bin):
try :
d_max, d_min = float(bin[0]), float(bin[1])
except ValueError as e :
raise RuntimeError("%s\nOffending values: ... | 3 | 23 | 0 | 10 | 36 | 0 |
tests/test_memory.py | primecoin/wasmtime-py | 140 | 3353018 | import unittest
from wasmtime import *
class TestMemory(unittest.TestCase):
def test_new(self):
store = Store()
ty = MemoryType(Limits(1, None))
assert(not ty.is_64)
memory = Memory(store, ty)
self.assertEqual(memory.type(store).limits, Limits(1, None))
self.assert... | 0 | 0 | 0 | 0 | 0 | 0 |
Packs/CrowdStrikeOpenAPI/Integrations/CrowdStrikeOpenAPI/CrowdStrikeOpenAPI.py | diCagri/content | 799 | 3353029 | <reponame>diCagri/content
import demistomock as demisto
from CommonServerPython import *
# flake8: noqa: E501
class Client:
def __init__(self, params: Dict):
self.cs_client = CrowdStrikeClient(params)
def add_role_request(self, domain_mssprolerequestv1_resources):
data = assign_params(resourc... | 0 | 0 | 0 | 0 | 0 | 0 |
macro_benchmark/SegLink/tool/convert_caffe_model/convert_caffemodel_to_ckpt.py | songhappy/ai-matrix | 180 | 3353039 | <filename>macro_benchmark/SegLink/tool/convert_caffe_model/convert_caffemodel_to_ckpt.py
import sys, os
import tensorflow as tf
import joblib
import numpy as np
import argparse
parentdir = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(parentdir, '../../seglink'))
import model_cnn
parser = argparse.Argumen... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow2/tf2cv/models/fdmobilenet.py | naviocean/imgclsmob | 2,649 | 3353047 | <filename>tensorflow2/tf2cv/models/fdmobilenet.py
"""
FD-MobileNet for ImageNet-1K, implemented in TensorFlow.
Original paper: 'FD-MobileNet: Improved MobileNet with A Fast Downsampling Strategy,'
https://arxiv.org/abs/1802.03750.
"""
__all__ = ['fdmobilenet_w1', 'fdmobilenet_w3d4', 'fdmobilenet_wd2', 'fdm... | 0 | 0 | 0 | 0 | 0 | 0 |
pcbmode/utils/component.py | Hylian/pcbmode | 370 | 3353055 | #!/usr/bin/python
import os
import pcbmode.config as config
import copy
# pcbmode modules
from . import utils
from . import messages as msg
from .shape import Shape
from .style import Style
from .footprint import Footprint
class Component():
"""
"""
def __init__(self, refdef, component):
"""
... | 0 | 6 | 0 | 0 | 6 | 0 |
pose_trackers/lighttrack/unit_test/test_utils_io_folder.py | rcourivaud/video-to-pose3D | 574 | 3353071 | '''
Author: <NAME>
E-mail: <EMAIL>
Dec, 2016
'''
import io
import os
import shutil
import sys
sys.path.append(os.path.abspath("../utils/"))
from utils_io_folder import *
def test_create_folder() -> bool:
folder_path = "../temp_folder/"
if os.path.exists(folder_path):
shutil.rmtree(folde... | 1 | 5 | 0 | 0 | 6 | 0 |
tests/test_signals.py | textioHQ/PynamoDB | 1,586 | 3353111 | import unittest.mock
import pytest
from pynamodb.connection import Connection
from pynamodb.signals import _FakeNamespace
from pynamodb.signals import pre_dynamodb_send, post_dynamodb_send
try:
import blinker
except ImportError:
blinker = None
PATCH_METHOD = 'pynamodb.connection.Connection._make_api_call'
... | 0 | 0 | 0 | 0 | 0 | 0 |
lfs/catalog/apps.py | michael-hahn/django-lfs | 345 | 3353119 | <reponame>michael-hahn/django-lfs<gh_stars>100-1000
from django.apps import AppConfig
class LfsCatalogAppConfig(AppConfig):
name = 'lfs.catalog'
def ready(self):
from . import listeners # NOQA
| 0 | 0 | 0 | 0 | 0 | 0 |
utils_nlp/models/pretrained_embeddings/glove.py | gohanlon/nlp | 4,407 | 3353126 | <filename>utils_nlp/models/pretrained_embeddings/glove.py
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Functions to help users load and extract GloVe pretrained embeddings."""
import os
import zipfile
from gensim.models import KeyedVectors
from gensim.scripts.glove... | 0 | 0 | 0 | 0 | 0 | 0 |
tf/test_one_char.py | deeperic/SpikeFlow | 158 | 3353151 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#deeperic
import os.path
import time
from datetime import datetime
import numpy as np
import tensorflow as tf
import glob
from PIL import Image
import sys
import spikeflow
import ocr_model
import helper
#import input_data
# Basic model parameters as external flags.... | 0 | 0 | 0 | 0 | 0 | 0 |
gsheetsdb/__init__.py | tim-werner/gsheets-db-api | 176 | 3353154 | <reponame>tim-werner/gsheets-db-api
from gsheetsdb.db import connect
from gsheetsdb.exceptions import (
DataError,
DatabaseError,
Error,
IntegrityError,
InterfaceError,
InternalError,
NotSupportedError,
OperationalError,
ProgrammingError,
Warning,
)
__all__ = [
'connect',
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/docs_snippets_crag/docs_snippets_crag_tests/concepts_tests/configuration_tests/test_run_config.py | geoHeil/dagster | 4,606 | 3353197 | import yaml
from dagster.utils import file_relative_path
from docs_snippets_crag.concepts.configuration.make_values_resource_any import basic_result
from docs_snippets_crag.concepts.configuration.make_values_resource_config_schema import (
different_values_job,
)
def test_make_values_resource_any():
assert ba... | 0 | 0 | 0 | 0 | 0 | 0 |
challenges/CTTP/poller/for-release/machine.py | pingjuiliao/cb-multios | 473 | 3353210 | #!/usr/bin/env python
#
# Copyright (C) 2014
# <NAME> <<EMAIL>>
# Narf Industries <<EMAIL>>
#
# 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 limit... | 0 | 11 | 0 | 0 | 11 | 0 |
image-translation/munit/models.py | AaratiAkkapeddi/nnabla-examples | 228 | 3353225 | # Copyright 2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#... | 59 | 20 | 0 | 0 | 79 | 0 |
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/expression_command/test/TestExprs.py | Polidea/SiriusObfuscator | 427 | 3353280 | """
Test many basic expression commands and SBFrame.EvaluateExpression() API.
Test cases:
o test_many_expr_commands:
Test many basic expression commands.
o test_evaluate_expression_python:
Use Python APIs (SBFrame.EvaluateExpression()) to evaluate expressions.
o test_expr_commands_can_handle_quotes:
Throw some ... | 0 | 0 | 0 | 0 | 0 | 0 |
enas_lm/src/child.py | deepneuralmachine/google-research | 23,901 | 3353310 | # 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
#
# Unless required by applicab... | 2 | 8 | 0 | 0 | 10 | 0 |
web/migrations/0002_auto_20190807_1908.py | nonomal/oh-my-rss | 270 | 3353320 | <reponame>nonomal/oh-my-rss
# Generated by Django 2.2 on 2019-08-07 11:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='article',
name=... | 0 | 0 | 0 | 0 | 0 | 0 |
wtfml/metrics/classification.py | Mo5mami/wtfml | 283 | 3353371 | <gh_stars>100-1000
"""
Classification metrics
__author__: <NAME>
"""
import numba
import numpy as np
from sklearn import metrics as skmetrics
class ClassificationMetrics:
def __init__(self):
"""
init class for classification metrics
"""
self.metrics = {
"accuracy": self... | 0 | 0 | 0 | 0 | 0 | 0 |
natlas-server/app/errors/responses.py | purplesecops/natlas | 500 | 3353385 | from flask import Response, render_template
from .errors import NatlasServiceError
def json_response(err: NatlasServiceError) -> Response:
return Response(
err.get_json(), err.status_code, content_type="application/json; charset=utf-8"
)
def html_response(err: NatlasServiceError) -> Response:
r... | 4 | 4 | 0 | 0 | 8 | 0 |
wagtail/admin/tests/pages/test_bulk_actions/test_bulk_publish.py | nickmoreton/wagtail | 8,851 | 3353398 | <reponame>nickmoreton/wagtail
from unittest import mock
from django.contrib.auth.models import Permission
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from wagtail.admin.views.pages.bulk_action... | 0 | 0 | 0 | 0 | 0 | 0 |
PaddleNLP/Research/MRQA2019-D-NET/server/ernie_server/pdnlp/toolkit/placeholder.py | XiaoguangHu01/models | 1,319 | 3353400 | <filename>PaddleNLP/Research/MRQA2019-D-NET/server/ernie_server/pdnlp/toolkit/placeholder.py
#encoding=utf8
from __future__ import print_function
import os
import six
import ast
import copy
import numpy as np
import paddle.fluid as fluid
class Placeholder(object):
def __init__(self):
self.shapes = []
... | 0 | 0 | 0 | 0 | 0 | 0 |
thespian/system/admin/test/test_localConvention.py | godaddy/Thespian | 210 | 3353406 | from thespian.actors import ActorAddress, ActorSystemConventionUpdate
from thespian.system.messages.convention import (ConventionRegister,
ConventionDeRegister,
ConventionInvite)
from thespian.system.admin.convention impor... | 6 | 31 | 0 | 0 | 37 | 0 |
tests/st/control/test_recrusive_fun.py | PowerOlive/mindspore | 3,200 | 3353413 | <reponame>PowerOlive/mindspore
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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 |
Allura/allura/model/project.py | apache/allura | 113 | 3353450 | # coding=utf-8
# 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,... | 25 | 85 | 15 | 0 | 125 | 0 |
src/datasets/filesystems/hffilesystem.py | WojciechKusa/datasets | 10,608 | 3353472 | from __future__ import annotations
from pathlib import PurePath
from typing import Optional
import fsspec
from fsspec import AbstractFileSystem
from huggingface_hub.hf_api import DatasetInfo
from ..utils.file_utils import get_authentication_headers_for_url, hf_hub_url
class HfFileSystem(AbstractFileSystem):
"""... | 5 | 3 | 2 | 1 | 11 | 0 |
tracer/android_tracer.py | XTechnologyTR/appmon | 1,392 | 3353476 | #!/usr/bin/python
###
# Copyright (c) 2016 <NAME>.
#
# 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 ... | 0 | 4 | 0 | 0 | 4 | 0 |
modules/ducktests/tests/ignitetest/tests/control_utility/baseline_test.py | vvteplygin/ignite | 4,339 | 3353512 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | 2 | 1 | 1 | 0 | 4 | 0 |
onnx2pytorch/operations/gather.py | Creation-Labs-AI/onnx2pytorch | 546 | 3353520 | import torch
from torch import nn
class Gather(nn.Module):
def __init__(self, dim: int=0):
self.dim = dim
self.selection = [slice(None) for _ in range(dim)]
super().__init__()
def forward(self, input: torch.Tensor, indices: torch.Tensor) -> object:
selection = self.selection +... | 3 | 1 | 0 | 0 | 4 | 0 |
tools/wrap-commit-msg.py | ozyb/aom | 2,151 | 3353535 | <reponame>ozyb/aom
#!/usr/bin/env python
##
## Copyright (c) 2016, Alliance for Open Media. All rights reserved
##
## This source code is subject to the terms of the BSD 2 Clause License and
## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
## was not distributed with this source code in th... | 0 | 0 | 0 | 0 | 0 | 0 |
securityheaders/checkers/csp/__init__.py | th3cyb3rc0p/securityheaders | 151 | 3353563 | <filename>securityheaders/checkers/csp/__init__.py
from .checker import CSPChecker
from .checkerro import CSPReportOnlyChecker
from .deprecateddirective import CSPDeprecatedDirectiveChecker
from .deprecateddirective_ro import CSPReportOnlyDeprecatedDirectiveChecker
from .flashobjectivewhitelistbypass import CSPFlashObj... | 0 | 0 | 0 | 0 | 0 | 0 |
torchbenchmark/models/Background_Matting/test_pre_process.py | Chillee/benchmark | 384 | 3353583 | <filename>torchbenchmark/models/Background_Matting/test_pre_process.py
import numpy as np
import cv2, pdb, glob, argparse
MAX_FEATURES = 500
GOOD_MATCH_PERCENT = 0.15
def alignImages(im1, im2,masksDL):
# Convert images to grayscale
im1Gray = cv2.cvtColor(im1, cv2.COLOR_BGR2GRAY)
im2Gray = cv2.cvtColor(im2, cv2.C... | 0 | 0 | 0 | 0 | 0 | 0 |
lessons/python/debugging/test_splitter_full.py | vmzhang/studyGroup | 105 | 3353604 | <gh_stars>100-1000
import unittest
def splitter(the_list):
return splitter_e(the_list)
def splitter_a(x):
"""
Return nothing useful just to prevent errors
"""
return ()
def splitter_b(x):
"""
Only work for the simple case
"""
return ([1], 2, [3])
def splitter_c(x):
"""
A ... | 0 | 0 | 0 | 0 | 0 | 0 |
objectModel/Python/cdm/persistence/persistence_layer.py | rt112000/CDM | 884 | 3353606 | <reponame>rt112000/CDM
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
import importlib
import json
from collections import OrderedDict
from typing import Any, Optional, TYPE_CHECKING
from cdm.enums import CdmO... | 0 | 0 | 0 | 0 | 0 | 0 |
basic/inlines/parser.py | neechadi/django-basic-apps | 548 | 3353616 | <filename>basic/inlines/parser.py
from django.template import TemplateSyntaxError
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.http import Http404
from django.utils.encoding import smart_unicode
from django.template.loader import render_to_string
from django.ut... | 0 | 0 | 0 | 0 | 0 | 0 |
app/prediction_controller.py | nthparameter/ci_edit | 229 | 3353625 | <filename>app/prediction_controller.py
# Copyright 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | vinissimus/guillotina | 173 | 3353630 | <filename>setup.py
# -*- coding: utf-8 -*-
from setuptools import Extension
from setuptools import find_packages
from setuptools import setup
long_description = open("README.rst").read() + "\n"
changelog = open("CHANGELOG.rst").read()
found = 0
for line in changelog.splitlines():
if len(line) > 15 and line[-1] ==... | 0 | 0 | 0 | 0 | 0 | 0 |
src/skiptracer/skiptracer.py | EdwardDantes/skiptracer | 912 | 3353666 | <reponame>EdwardDantes/skiptracer<filename>src/skiptracer/skiptracer.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
#!/usr/bin/env python
from __future__ import print_function
import pkg_resources
import sys
import signal
import json
import ast
try:
import __builtin__ as bi
except BaseException:
import builtins... | 0 | 0 | 0 | 0 | 0 | 0 |
neo/Utils/NeoTestCase.py | volekerb/neo-python | 387 | 3353671 | from unittest import TestCase
from unittest.case import _BaseTestCaseContext
import logging
import collections
import asyncio
from neo.logging import log_manager
from mock import MagicMock
class _CapturingHandler(logging.Handler):
"""
A logging handler capturing all (raw and formatted) logging output.
"""... | 2 | 6 | 0 | 0 | 8 | 0 |
script/plot_window.py | 72ohit/gandissect | 1,711 | 3353676 | # Plot bar chart of 20-unit ablations in conference room of
# conference room ablation
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
data = [
# ('conference ', 0.025092652067542076, 0.00843511987477541),
('conference ', 0.5683056116104126),
# ('ki... | 0 | 0 | 0 | 0 | 0 | 0 |
app/ch16_mongodb/final/pypi_org/nosql/licenses.py | tbensonwest/data-driven-web-apps-with-flask | 496 | 3353677 | <filename>app/ch16_mongodb/final/pypi_org/nosql/licenses.py
import datetime
import mongoengine
class License(mongoengine.Document):
id = mongoengine.StringField(primary_key=True)
created_date = mongoengine.DateTimeField(default=datetime.datetime.now)
description = mongoengine.StringField()
meta = {
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/openfermion/transforms/opconversions/binary_codes.py | bene1337/OpenFermion | 1,291 | 3353691 | <gh_stars>1000+
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | 0 | 0 | 0 | 0 | 0 | 0 |
igibson/utils/data_utils/ext_object/scripts/step_5_visualizations.py | suresh-guttikonda/iGibson | 360 | 3353698 | import argparse
import json
import os
import subprocess
from shutil import which
import numpy as np
from PIL import Image
from transforms3d.euler import euler2quat
import igibson
from igibson.objects.articulated_object import ArticulatedObject
from igibson.render.mesh_renderer.mesh_renderer_settings import MeshRender... | 0 | 0 | 0 | 0 | 0 | 0 |
support/buildbot/generate_headers.py | PlayBoy31/metamod-source | 205 | 3353701 | <gh_stars>100-1000
# vim: set ts=8 sts=2 sw=2 tw=99 et:
import re
import os, sys
import subprocess
argv = sys.argv[1:]
if len(argv) < 2:
sys.stderr.write('Usage: generate_headers.py <source_path> <output_folder>\n')
sys.exit(1)
SourceFolder = os.path.abspath(os.path.normpath(argv[0]))
OutputFolder = os.path.normp... | 0 | 0 | 0 | 0 | 0 | 0 |
vstruct/qt/__init__.py | rnui2k/vivisect | 716 | 3353728 | <filename>vstruct/qt/__init__.py<gh_stars>100-1000
'''
Some utils for QT code which uses vstruct...
'''
import vqt.tree as vq_tree
from PyQt5.QtWidgets import *
from vqt.main import idlethreadsync
class VQStructNamespacesView(vq_tree.VQTreeView):
def __init__(self, parent=None):
vq_tree.VQTreeView.__ini... | 0 | 0 | 0 | 0 | 0 | 0 |
hal_fuzz/hal_fuzz/handlers/fuzz.py | diagprov/hal-fuzz | 117 | 3353750 | from unicorn.arm_const import *
from .. import native
def parse_fuzzed_irqs(entries) -> object:
allowed_irqs = set()
print("Parsing fuzzable irq configuration")
for name, int_or_range_string in entries.items():
# print("[PARSE FUZZED IRQs] Looking at entry: {} -> {}".format(name, int_or_range_strin... | 0 | 3 | 0 | 0 | 3 | 0 |
scripts/ui/image_viewer.py | sparsebase/facebook360_dep | 221 | 3353756 | <reponame>sparsebase/facebook360_dep
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""Front end display for the threshold interaction models for the UI.
D... | 0 | 0 | 0 | 0 | 0 | 0 |
src/components/uniformExportGenerator/uniformExportGenerator.py | t3kt/raytk | 108 | 3353770 | # noinspection PyUnreachableCode
if False:
# noinspection PyUnresolvedReferences
from _stubs import *
def buildExportTable(dat: 'DAT', uniformTable: 'DAT'):
dat.clear()
dat.appendRow(['path', 'parameter', 'value'])
path = str(parent().par.Exportpath)
arrayIndex = int(parent().par.Firstarrayindex)
vectorIndex = ... | 10 | 0 | 0 | 0 | 10 | 0 |
how_fast_is_sort.py | CvanderStoep/VideosSampleCode | 285 | 3353791 | from __future__ import annotations
import operator
import random
import string
import time
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from itertools import product
import matplotlib.axes
import matplotlib.figure
import matplotlib.pyplot as plt
import numpy as np
from pandas import Dat... | 12 | 21 | 12 | 0 | 45 | 0 |
homeassistant/components/remote_rpi_gpio/__init__.py | MrDelik/core | 30,023 | 3353804 | <reponame>MrDelik/core<filename>homeassistant/components/remote_rpi_gpio/__init__.py
"""Support for controlling GPIO pins of a Raspberry Pi."""
from gpiozero import LED, DigitalInputDevice
from gpiozero.pins.pigpio import PiGPIOFactory
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing impo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/article_examples/B_detail_plot.py | ATayls/DnaFeaturesViewer | 391 | 3353831 | from A_linear_plot import CustomTranslator
translator = CustomTranslator()
graphic_record = translator.translate_record("plasmid.gb")
cropped_record = graphic_record.crop((6320, 6350))
cropped_record.ticks_resolution = 5 # One tick every 5 nucleotides
ax, _ = cropped_record.plot(figure_width=6)
cropped_record.plot_se... | 0 | 0 | 0 | 0 | 0 | 0 |
Lib/lib2to3/fixes/fix_unicode.py | shawwn/cpython | 52,316 | 3353840 | r"""Fixer for unicode.
* Changes unicode to str and unichr to chr.
* If "...\u..." is not unicode literal change it into "...\\u...".
* Change u"..." into "...".
"""
from ..pgen2 import token
from .. import fixer_base
_mapping = {"unichr" : "chr", "unicode" : "str"}
class FixUnicode(fixer_base.BaseFix):
BM_c... | 0 | 1 | 2 | 0 | 3 | 0 |
tasks/tts/dataset_utils.py | leminhnguyen/NATSpeech | 561 | 3353856 | from __future__ import annotations
import torch.optim
import torch.utils.data
import numpy as np
import torch
import torch.optim
import torch.utils.data
import torch.distributions
from utils.audio.pitch.utils import norm_interp_f0, denorm_f0
from utils.commons.dataset_utils import BaseDataset, collate_1d_or_2d
from uti... | 3 | 7 | 0 | 3 | 13 | 0 |
examples/pix2pose/train.py | ManuelMeder/paz | 300 | 3353864 | import os
import glob
import argparse
import numpy as np
import time
from tensorflow.keras.callbacks import CSVLogger
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.layers import Input
from tensorflow.keras.models import Model
from paz.abstract import GeneratingSequence
from paz.abstract.sequence ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_parse.py | vishwas1234567/OpenBCI_Python | 414 | 3353885 | from unittest import TestCase, main, skip
import mock
from openbci.utils import (Constants,
OpenBCISample,
ParseRaw,
sample_packet,
sample_packet_standard_raw_aux,
sample_packet_accel_... | 0 | 0 | 0 | 0 | 0 | 0 |
cfgov/ask_cfpb/documents.py | Colin-Seifer/consumerfinance.gov | 156 | 3353887 | <filename>cfgov/ask_cfpb/documents.py
from django_elasticsearch_dsl import Document, fields
from django_elasticsearch_dsl.registries import registry
from ask_cfpb.models.answer_page import AnswerPage
from search.elasticsearch_helpers import (
environment_specific_index,
ngram_tokenizer,
synonym_analyzer,
)... | 0 | 0 | 0 | 0 | 0 | 0 |
tiler/tiler-scripts/tests/test_tiler.py | Geovation/tiler | 134 | 3353893 | import unittest
import sys, os
import shutil
import time
import psycopg2
import SocketServer
import threading
from handler import TestHandler
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) # Insanity for getting parent folder in path
from tiler import get_config, tiles_from_config
from sh... | 0 | 0 | 0 | 0 | 0 | 0 |
cms/tests/test_plugin_renderers.py | Mario-Kart-Felix/django-cms | 1,110 | 3353905 | from __future__ import annotations
from django.test.utils import override_settings
from cms.api import add_plugin, create_page
from cms.models import CMSPlugin
from cms.plugin_rendering import (
ContentRenderer,
LegacyRenderer,
StructureRenderer,
)
from cms.test_utils.testcases import CMSTestCase
class T... | 3 | 1 | 0 | 0 | 4 | 0 |
python_modules/dagster/dagster/core/snap/config_types.py | dbatten5/dagster | 4,606 | 3353957 | <gh_stars>1000+
from dagster import check
from dagster.config.snap import ConfigSchemaSnapshot, snap_from_config_type
from dagster.core.definitions.pipeline import PipelineDefinition
from dagster.utils import merge_dicts
def build_config_schema_snapshot(pipeline_def):
check.inst_param(pipeline_def, "pipeline_def"... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/nnapi/specs/V1_2/prelu_broadcast_float_1_nnfw.mod.py | periannath/ONE | 255 | 3353974 | <gh_stars>100-1000
# model
model = Model()
i1 = Input("op1", "TENSOR_FLOAT32", "{1, 2, 2, 3}") # a vector of input
i2 = Input("op2", "TENSOR_FLOAT32", "{1, 1, 1, 3}") # a vector of alpha
i3 = Output("op3", "TENSOR_FLOAT32", "{1, 2, 2, 3}") # a vector of output
model = model.Operation("PRELU", i1, i2).To(i3)
# Example ... | 0 | 0 | 0 | 0 | 0 | 0 |
macarico/data/types.py | hal3/macarico | 121 | 3353996 | <gh_stars>100-1000
from __future__ import division, generators, print_function
import macarico
from macarico.data.vocabulary import NoVocabulary
class Sequences(macarico.Example):
def __init__(self, tokens, labels, token_vocab, label_vocab):
if isinstance(token_vocab, int): token_vocab = NoVocabulary(toke... | 0 | 0 | 0 | 0 | 0 | 0 |
robogym/envs/rearrange/datasets/objects/utils.py | 0xflotus/robogym | 288 | 3354017 | <reponame>0xflotus/robogym
from typing import Dict
from numpy.random.mtrand import RandomState
from robogym.utils.env_utils import get_function
def get_object_datasets(object_config: Dict[str, dict], random_state: RandomState):
datasets = {}
for key in object_config:
datasets[key] = get_function(obj... | 0 | 0 | 0 | 0 | 0 | 0 |
src/redirect.py | peterblazejewicz/webcomponents.org | 309 | 3354029 | import webapp2
class Redirect(webapp2.RequestHandler):
def get(self, path):
self.redirect(uri='https://www.webcomponents.org/%s' % path, permanent=True)
# pylint: disable=invalid-name
app = webapp2.WSGIApplication([
webapp2.Route(r'/<path:.*>', handler=Redirect),
], debug=True)
| 0 | 0 | 0 | 0 | 0 | 0 |
src/amuse/support/codes/channel.py | rknop/amuse | 131 | 3354041 | import warnings
from amuse.rfi.channel import *
warnings.warn("amuse.support.codes.channel has moved to amuse.rfi.channel", DeprecationWarning)
| 0 | 0 | 0 | 0 | 0 | 0 |
evaluation/metrics.py | LLLjun/learn-to-cluster | 620 | 3354061 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from sklearn.metrics.cluster import (contingency_matrix,
normalized_mutual_info_score)
from sklearn.metrics import (precision_score, recall_score)
__all__ = ['pairw... | 0 | 0 | 0 | 0 | 0 | 0 |
PythonCode/test/test_fortune.py | konny0311/algorithms-nutshell-2ed | 522 | 3354062 | import unittest
from adk.fortune import Voronoi, Point, Arc
import random
class TestFortuneMethods(unittest.TestCase):
def perturb(self, points):
for i in range(len(points)):
pt = points[i]
points[i] = (pt[0] + random.random(), pt[1] + random.random())
def valid(s... | 0 | 1 | 0 | 0 | 1 | 0 |
pyvcloud/vcd/org.py | lrivallain/pyvcloud | 168 | 3354086 | <reponame>lrivallain/pyvcloud
# VMware vCloud Director Python SDK
# Copyright (c) 2014-2018 VMware, 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://ww... | 0 | 0 | 0 | 0 | 0 | 0 |
SettingComponents/Components/QLabel.py | Satanepigone/osr2mp4-app | 262 | 3354120 | <reponame>Satanepigone/osr2mp4-app<gh_stars>100-1000
from PyQt5.QtWidgets import QLabel
class ParentTitle(QLabel):
def __init__(self, default_fontsize=1, color="white"):
super().__init__()
self.default_width = 1
self.default_height = 1
self.default_fontsize = default_fontsize
self.color = color
self.setS... | 0 | 0 | 0 | 0 | 0 | 0 |
pandas_ml/skaccessors/cross_decomposition.py | matsavage/pandas-ml | 305 | 3354131 | <reponame>matsavage/pandas-ml<gh_stars>100-1000
#!/usr/bin/env python
from pandas_ml.core.accessor import _AccessorMethods
class CrossDecompositionMethods(_AccessorMethods):
"""
Accessor to ``sklearn.cross_decomposition``.
"""
_module_name = 'sklearn.cross_decomposition'
_method_mappe... | 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.