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 |
|---|---|---|---|---|---|---|---|---|---|---|
plugin/sampleID/sampleID_plugin.py | iontorrent/TS | 125 | 177825 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright (C) 2013 Ion Torrent Systems, Inc. All Rights Reserved
# NOTE: This plugin uses litle of barcodes.json as it makes its own alignments for sample tracking targets
import sys
import os
import subprocess
import json
import time
import traceback
from glob import glob
f... | 0 | 0 | 0 | 0 | 0 | 0 |
yasa/numba.py | HKH515/yasa | 187 | 177828 | """
This file contains Numba-accelerated functions used in the main detections.
"""
import numpy as np
from numba import jit
__all__ = []
#############################################################################
# NUMBA JIT UTILITY FUNCTIONS
#######################################################################... | 0 | 5 | 0 | 0 | 5 | 0 |
tests/test_pca.py | christopherjenness/ML-lib | 109 | 177846 | <filename>tests/test_pca.py
import ML.pca as pca
import data
import numpy as np
def test_PCA():
X = data.tall_matrix_data()
pc = pca.PCA()
pc.fit(X)
target_x = [3.26739191, 1.52451635, 1]
np.testing.assert_array_almost_equal(pc.transformed_X[0, :],
target_x... | 0 | 0 | 0 | 0 | 0 | 0 |
mlir/python/mlir/dialects/_scf_ops_ext.py | undingen/BOLT | 2,338 | 177857 | <gh_stars>1000+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
try:
from ..ir import *
except ImportError as e:
raise RuntimeError("Error loading imports from ex... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/LeetCode/Python3/20.py | timxor/leetcode-journal | 854 | 177869 | <filename>solutions/LeetCode/Python3/20.py
__________________________________________________________________________________________________
32ms
class Solution:
def isValid(self, s: 'str') -> 'bool':
v = []
d = {']':'[', ')':'(', '}':'{'}
for i in range(len(s)):
if s[i] in d.va... | 0 | 0 | 0 | 0 | 0 | 0 |
src/olympia/scanners/migrations/0027_add_group_result_id_and_task_count_to_scannerqueryrule.py | shashwatsingh/addons-server | 843 | 177897 | <reponame>shashwatsingh/addons-server
# Generated by Django 2.2.10 on 2020-02-25 11:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scanners', '0026_auto_20200217_1528'),
]
operations = [
migrations.AddField(
model_name='... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_util_parser.py | cyberdefensegrp/margaritashotgun | 198 | 177922 | <gh_stars>100-1000
import pytest
import os
import sys
from margaritashotgun.util import parser
@pytest.fixture
def tcp_parser_object():
return parser.ProcNetTcpParser()
def test_split_every_n():
tcp_parser = tcp_parser_object()
test_input = '0F02000A'
expected_output = ['0F', '02', '00', '0A']
o... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/django-1.4/django/contrib/localflavor/mk/mk_choices.py | MiCHiLU/google_appengine_sdk | 790 | 177940 | <reponame>MiCHiLU/google_appengine_sdk
# -*- coding: utf-8 -*-
"""
Macedonian municipalities per the reorganization from 2004.
"""
from django.utils.translation import ugettext_lazy as _
MK_MUNICIPALITIES = (
('AD', _(u'Aerodrom')),
('AR', _(u'Aračinovo')),
('BR', _(u'Berovo')),
('TL', _(u'Bitola')),
... | 0 | 0 | 0 | 0 | 0 | 0 |
z3/all_equal.py | Wikunia/hakank | 279 | 177946 | <reponame>Wikunia/hakank<gh_stars>100-1000
#!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Global constraint all_equal in Z3
#
# From Global Constraint Catalogue
# http://www.emn.fr/x-info/sdemasse/gccat/Call_equal.html
# """
# Constraint
#
# all_equal(VARIABLES)
#
# Purpose
#
# Enforce all variables of the... | 0 | 0 | 0 | 0 | 0 | 0 |
ImageNet/pkl/example.py | mhilmiasyrofi/AT_HE | 107 | 177950 | <reponame>mhilmiasyrofi/AT_HE
def countjson():
import pickle
names = ['pgd','pgdHE']
for name in names:
epoch = 70
with open("{}_1000_t_epoch{}.pkl".format(name, epoch), "rb") as f:
weight_clean = pickle.load(f)
with open("{}_1000_adv_t_epoch{}.pkl".format(name, epoch), "rb") as g:
weight_adv = p... | 0 | 0 | 0 | 0 | 0 | 0 |
app/lib/conf.py | nurely/lxdui | 589 | 177964 | from app import __metadata__ as meta
from configparser import ConfigParser, ExtendedInterpolation
from pathlib import Path
from shutil import copy
import os
import io
import logging
log = logging.getLogger(__name__)
APP = meta.APP_NAME
'''
This component is responsible for configuration management.
If this is the fir... | 0 | 9 | 0 | 1 | 10 | 0 |
test/test_system/test_network.py | esabouraud/gphotos-sync | 1,390 | 177979 | from pathlib import Path
from unittest import TestCase
from unittest.mock import patch, Mock
from requests.exceptions import HTTPError
from requests import Session
from test.test_account import TestAccount
from gphotos.LocalData import LocalData
import test.test_setup as ts
photos_root = Path("photos")
original_get =... | 2 | 1 | 0 | 0 | 3 | 0 |
scripts/automation/trex_control_plane/interactive/trex/examples/astf/astf_error_logging_plugin.py | timgates42/trex-core | 956 | 177989 | <filename>scripts/automation/trex_control_plane/interactive/trex/examples/astf/astf_error_logging_plugin.py
import astf_path
class ErrorLogger():
def __init__(self, name, allowed_errors):
self.iteration_counter = 0
self.name = name
self.client_allowed_errors = set(allowed_errors['client'])... | 0 | 0 | 0 | 0 | 0 | 0 |
numba/tests/test_retargeting.py | auderson/numba | 6,620 | 178068 | from __future__ import annotations
import unittest
from contextlib import contextmanager
from numba import njit
from numba.core import errors, cpu, utils, typing
from numba.core.descriptors import TargetDescriptor
from numba.core.dispatcher import TargetConfigurationStack
from numba.core.retarget import BasicRetarget
... | 0 | 30 | 2 | 0 | 32 | 0 |
tests/serializers/test_by_field.py | gcollard/lightbus | 178 | 178095 | <reponame>gcollard/lightbus
import pytest
from lightbus.message import EventMessage
from lightbus.serializers.by_field import ByFieldMessageSerializer, ByFieldMessageDeserializer
pytestmark = pytest.mark.unit
def test_by_field_serializer():
serializer = ByFieldMessageSerializer()
serialized = serializer(
... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/pytorch/vit/test_vit.py | payoto/graphcore_examples | 260 | 178097 | <gh_stars>100-1000
# Copyright (c) 2021 Graphcore Ltd. 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 requ... | 0 | 0 | 0 | 0 | 0 | 0 |
frontends/mrxl/mrxl/__init__.py | pbonh/calyx | 109 | 178112 | """The MrXL compiler and interpreter"""
__version__ = "0.1.0"
| 0 | 0 | 0 | 0 | 0 | 0 |
Configuration/Generator/python/EtaBToJpsiJpsi_forSTEAM_13TeV_cfi.py | ckamtsikis/cmssw | 852 | 178120 | <filename>Configuration/Generator/python/EtaBToJpsiJpsi_forSTEAM_13TeV_cfi.py<gh_stars>100-1000
# Only for Trigger Study
import FWCore.ParameterSet.Config as cms
from Configuration.Generator.PythiaUESettings_cfi import *
generator = cms.EDFilter("Pythia6GeneratorFilter",
pythiaHepMCVerbosity = cms.untracked.bool(False)... | 0 | 0 | 0 | 0 | 0 | 0 |
ssm/extensions/mp_srslds/observations_ext.py | GrohLab/ssm | 208 | 178125 | <reponame>GrohLab/ssm
import copy
import warnings
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.special import gammaln, digamma, logsumexp
from autograd.scipy.special import logsumexp
from ssm.util import random_rotation, ensure_args_are_lists, \
logistic, logit, one_hot
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
timm/optim/sgdp.py | xuritian317/pytorch-image-models | 17,769 | 178140 | from __future__ import annotations
"""
SGDP Optimizer Implementation copied from https://github.com/clovaai/AdamP/blob/master/adamp/sgdp.py
Paper: `Slowing Down the Weight Norm Increase in Momentum-based Optimizers` - https://arxiv.org/abs/2006.08217
Code: https://github.com/clovaai/AdamP
Copyright (c) 2020-present N... | 8 | 1 | 0 | 0 | 9 | 0 |
tensorflow_probability/python/internal/numerics_testing.py | jakee417/probability-1 | 3,670 | 178219 | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 1 | 13 | 0 | 0 | 14 | 0 |
scratchpad/20191013_get_all_data.py | R-fred/awesome-streamlit | 1,194 | 178220 | import requests
def get_all_data() -> object:
root = "https://raw.githubusercontent.com/patidarparas13/Sentiment-Analyzer-Tool/master/Datasets/"
data = requests.get(root + "imdb_labelled.txt").text.split("\n")
data += requests.get(root + "amazon_cells_labelled.txt").text.split("\n")
data += requests.... | 0 | 1 | 0 | 0 | 1 | 0 |
corehq/apps/case_search/migrations/0007_auto_20170522_1506.py | dimagilg/commcare-hq | 471 | 178221 | # Generated by Django 1.10.7 on 2017-05-22 15:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('case_search', '0006_remove_casesearchconfig__config'),
]
operations: list[object] = [
migrations.CreateModel(
... | 0 | 0 | 2 | 0 | 2 | 0 |
examples/flask_whylabs_example/api/views.py | cswarth/whylogs | 603 | 178240 | <reponame>cswarth/whylogs<filename>examples/flask_whylabs_example/api/views.py<gh_stars>100-1000
""" View functions for every endpoint. """
import app
from api.utils import get_prediction, initialize_logger
from flask import Blueprint, request
from flask_pydantic import validate
from schemas import FeatureVector
from u... | 0 | 0 | 0 | 0 | 0 | 0 |
image_classification/DeiT/tests/test_mixup.py | no-name-xiaosheng/PaddleViT | 993 | 178256 | <gh_stars>100-1000
# Copyright (c) 2021 PPViT 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 req... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/draw/svg/test_clip.py | rianmcguire/WeasyPrint | 4,512 | 178326 | <gh_stars>1000+
"""
weasyprint.tests.test_draw.svg.test_clip
----------------------------------------
Test clip-path attribute.
"""
import pytest
from ...testing_utils import assert_no_logs
from .. import assert_pixels
@assert_no_logs
def test_clip_path():
assert_pixels('clip_path', 9, 9, '''
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/api/messaging/test_messaging.py | Priyankk18k/python-amazon-sp-api | 213 | 178348 | <gh_stars>100-1000
from sp_api.api.messaging.messaging import Messaging
from sp_api.base import Marketplaces
| 0 | 0 | 0 | 0 | 0 | 0 |
filtration/utils.py | Katsuyuki-Tomita/tomy | 133 | 178367 | # Author: <NAME>
# Date: 26/06/2018
# Project: TdaToolbox
try: from filtration.imports import *
except: from imports import *
# Time delay embedded procedure
# val refers to a 1D time-serie
# step corresponds to the time-delay
# dimension is the dimension of the time-delay embedding
# point_size refers to the dim... | 3 | 1 | 0 | 0 | 4 | 0 |
tests/integration/cli/setup_test.py | gamechanger/dusty | 421 | 178371 | <gh_stars>100-1000
from mock import patch
from ...testcases import DustyIntegrationTestCase
from dusty import constants
from dusty.config import save_config_value
class TestSetupCLI(DustyIntegrationTestCase):
def setUp(self):
super(TestSetupCLI, self).setUp()
save_config_value(constants.CONFIG_SE... | 0 | 0 | 0 | 0 | 0 | 0 |
40/credit_fraud_analysis.py | dunjin/DataAnalysisInAction | 656 | 178392 | # -*- coding:utf-8 -*-
# 使用逻辑回归对信用卡欺诈进行分类
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import itertools
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, precision_recall_... | 2 | 0 | 0 | 0 | 2 | 0 |
src/oci/core/models/drg_route_distribution_statement.py | Manny27nyc/oci-python-sdk | 249 | 178393 | <filename>src/oci/core/models/drg_route_distribution_statement.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_models/test_general_gnn.py | JonaBecher/spektral | 2,145 | 178420 | <reponame>JonaBecher/spektral<filename>tests/test_models/test_general_gnn.py
from spektral import models
from tests.test_models.core import MODES, run_model
config = {
"model": models.GeneralGNN,
"modes": [MODES["SINGLE"], MODES["DISJOINT"], MODES["MIXED"]],
"kwargs": {"output": 32, "connectivity": "cat", ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/demo11.py | kobylkinks/LightAutoML | 766 | 178568 | <reponame>kobylkinks/LightAutoML
#!/usr/bin/env python
# coding: utf-8
import shutil
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split
from lightautoml.automl.presets.text_presets import TabularNLPAutoML
from lightautoml.tasks ... | 0 | 0 | 0 | 0 | 0 | 0 |
fexm/docker_scripts/docker_wrapper.py | fgsect/fexm | 105 | 178589 | <gh_stars>100-1000
import sh
from sh import docker
class DockerWrapper(object):
"""
This class wraps docker calls to a certain image.
"""
def __init__(self, docker_image: str):
"""
:param docker_image: The name of the docker image. It should already exist.
"""
self.doc... | 0 | 0 | 0 | 0 | 0 | 0 |
src/warehouse/goodreads_staging_queries.py | Nikhil19Joshi/GoodReads_ETL_Data_Pipeline | 984 | 178701 | <gh_stars>100-1000
import configparser
from pathlib import Path
config = configparser.ConfigParser()
config.read_file(open(f"{Path(__file__).parents[0]}/warehouse_config.cfg"))
# Setup configs
staging_schema = config.get('STAGING', 'SCHEMA')
s3_processed_zone = 's3://' + config.get('BUCKET', 'PROCESSED_ZONE')
iam_rol... | 0 | 0 | 0 | 0 | 0 | 0 |
lec9.py | ashayathalye/videos | 280 | 178735 | <reponame>ashayathalye/videos
from lib import *
audio = Audio('MIT-Missing-Semester-lec-mit-0000-2020jan28-1405-Adhoc Section_1.mp4', delay=5/30)
tracking = Fullscreen('MIT-Missing-Semester-lec-mit-0000-2020jan28-1405-Adhoc Section_1.mp4')
screen_only = Fullscreen('MIT-Missing-Semester-lec-mit-0000-2020jan28-1405-Adho... | 0 | 0 | 0 | 0 | 0 | 0 |
torch_geometric/nn/acts.py | NucciTheBoss/pytorch_geometric | 12,651 | 178744 | <reponame>NucciTheBoss/pytorch_geometric<gh_stars>1000+
def swish(x):
return x * x.sigmoid()
| 0 | 0 | 0 | 0 | 0 | 0 |
droidlet/perception/semantic_parsing/nsp_transformer_model/model_output.py | ali-senguel/fairo | 669 | 178752 | <reponame>ali-senguel/fairo<filename>droidlet/perception/semantic_parsing/nsp_transformer_model/model_output.py
from dataclasses import dataclass
from typing import Optional, Tuple
import torch
# from transformers.file_utils import ModelOutput
from collections import OrderedDict, UserDict
from typing import Any, Bina... | 0 | 0 | 0 | 0 | 0 | 0 |
benchmarks/benchmarks/location.py | JackKelly/pvlib-python | 695 | 178754 | """
ASV benchmarks for location.py
"""
import pandas as pd
import pvlib
from pkg_resources import parse_version
def set_solar_position(obj):
obj.location = pvlib.location.Location(32, -110, altitude=700,
tz='Etc/GMT+7')
obj.times = pd.date_range(start='20180601', fr... | 0 | 0 | 0 | 0 | 0 | 0 |
kth_largest_element_in_an_array/solution2.py | mahimadubey/leetcode-python | 528 | 178768 | """
Find the kth largest element in an unsorted array. Note that it is the kth
largest element in the sorted order, not the kth distinct element.
For example,
Given [3,2,1,5,6,4] and k = 2, return 5.
Note: You may assume k is always valid, 1 <= k <= array's length.
"""
class Solution(object):
def findKthLargest... | 0 | 0 | 0 | 0 | 0 | 0 |
dotsandboxes/pit-dotsandboxes.py | user01/alpha-zero-general | 2,836 | 178784 | <reponame>user01/alpha-zero-general<gh_stars>1000+
import os
import numpy as np
import Arena
from MCTS import MCTS
from utils import dotdict
from dotsandboxes.DotsAndBoxesGame import DotsAndBoxesGame
from dotsandboxes.DotsAndBoxesPlayers import HumanDotsAndBoxesPlayer, RandomPlayer, GreedyRandomPlayer
from dotsandboxes... | 0 | 0 | 0 | 0 | 0 | 0 |
code/models/py_utils/roi_extractors/ops/__init__.py | 360iQ/CPNDet | 191 | 178794 | from .roi_align import RoIAlign, roi_align
__all__ = ['RoIAlign', 'roi_align'] | 0 | 0 | 0 | 0 | 0 | 0 |
examples/create_site_sample.py | Radabaugh/tableau_tools | 179 | 178806 | # -*- coding: utf-8 -*-
from tableau_tools import *
import time
server = 'http://127.0.0.1'
username = ''
password = ''
new_site_content_url = 'test_site'
new_site_name = 'Sample Test Site'
# Choose the API version for your server. 2019.3 = TableauRestApiConnection35
default = TableauServerRest(server=server, usern... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/suites/0_stateless/20+_others/20_0005_mysql_auth.py | b41sh/databend | 1,556 | 178831 | <gh_stars>1000+
#!/usr/bin/env python3
import os
import mysql.connector
import sys
CURDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(CURDIR, '../../../helpers'))
from native_client import NativeClient
from native_client import prompt
log = None
mydb = mysql.connector.connect(host... | 0 | 0 | 0 | 0 | 0 | 0 |
Compiler/Parser.py | makolath/BF-it | 104 | 178849 | from __future__ import annotations
from .Exceptions import BFSyntaxError, BFSemanticError
from .Token import Token
from .General import is_token_literal
class Parser:
"""
Used to easily iterate tokens
"""
def __init__(self, tokens):
self.tokens = tokens
self.current_token_index: int = ... | 4 | 5 | 0 | 1 | 10 | 0 |
nngen/sim.py | RyusukeYamano/nngen | 207 | 178881 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from . import verilog
__intrinsics__ = ('set_header', 'get_header',
'set_global_offset', 'set_global_addrs',
'set_global_addr_map', 'write_global_addr_map', 'load_global_ad... | 5 | 1 | 0 | 0 | 6 | 0 |
cupy/testing/_attr.py | Onkar627/cupy | 6,180 | 178958 | import os
from cupy.testing._pytest_impl import is_available, check_available
if is_available():
import pytest
_gpu_limit = int(os.getenv('CUPY_TEST_GPU_LIMIT', '-1'))
def gpu(*args, **kwargs) -> object:
return pytest.mark.gpu(*args, **kwargs)
def cudnn(*args, **kwargs) -> object:
... | 0 | 5 | 0 | 0 | 5 | 0 |
corehq/project_limits/rate_counter/interfaces.py | dimagilg/commcare-hq | 471 | 178974 | import abc
class AbstractRateCounter(metaclass=abc.ABCMeta):
@abc.abstractmethod
def get(self, scope):
raise NotImplementedError()
@abc.abstractmethod
def increment(self, scope, delta):
raise NotImplementedError()
@abc.abstractmethod
def increment_and_get(self, scope, delta):... | 0 | 0 | 0 | 0 | 0 | 0 |
models/criterion.py | kaizhang1215/MTTR | 516 | 178978 | """
Modified from DETR https://github.com/facebookresearch/detr
"""
import torch
from torch import nn
from misc import nested_tensor_from_tensor_list, get_world_size, interpolate, is_dist_avail_and_initialized
from .segmentation import dice_loss, sigmoid_focal_loss
from utils import flatten_temporal_batch_dims
class ... | 0 | 8 | 0 | 0 | 8 | 0 |
nnet/run/srl/run.py | SaidehNK/sr | 193 | 178992 | from __future__ import annotations
from nnet.models.srl import *
from nnet.run.runner import *
from nnet.ml.voc import *
from nnet.run.srl.run import *
from nnet.run.srl.util import *
from nnet.run.srl.decoder import *
from functools import partial
from nnet.run.srl.read_dependency import get_adj
import nnet.run.srl.c... | 0 | 11 | 0 | 3 | 14 | 0 |
catalog/admin.py | nathandarnell/sal | 215 | 179005 | <reponame>nathandarnell/sal
from django.contrib import admin
from catalog.models import *
def business_unit(obj):
return obj.machine_group.business_unit.name
class BusinessUnitFilter(admin.SimpleListFilter):
title = 'Business Unit'
parameter_name = 'business_unit'
def lookups(self, request, model_a... | 0 | 0 | 0 | 0 | 0 | 0 |
misc/wapiti-2.3.0/wapitiCore/report/xmlreportgenerator.py | sapientgov/openfda-travel | 377 | 179028 | <reponame>sapientgov/openfda-travel<filename>misc/wapiti-2.3.0/wapitiCore/report/xmlreportgenerator.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the Wapiti project (http://wapiti.sourceforge.net)
# Copyright (C) 2008-2013 <NAME>
#
# Original authors :
# <NAME>
# <NAME>
# Copyright (C) 2008 In... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/RecruitVoucherRule.py | alipay/alipay-sdk-python-all | 213 | 179031 | <reponame>alipay/alipay-sdk-python-all<filename>alipay/aop/api/domain/RecruitVoucherRule.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class RecruitVoucherRule(object):
def __init__(self):
self._denomination_percent_max = None
s... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/train_pifu.py | lingtengqiu/Open-PIFuhd | 191 | 179037 | '''
@author:<NAME>
@name:Open-Pifu
'''
import sys
sys.path.append("./")
from opt import opt
from mmcv import Config
import os
from torch.utils.data import DataLoader
import torch.nn as nn
from engineer.datasets.loader.build_loader import train_loader_collate_fn,test_loader_collate_fn
from engineer.datasets.... | 0 | 0 | 0 | 0 | 0 | 0 |
magnum/conf/certificates.py | ajmadsen/magnum | 319 | 179045 | # 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, software
# distributed under the... | 0 | 1 | 0 | 0 | 1 | 0 |
questions/max-area-of-island/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 179104 | <reponame>marcus-aurelianus/leetcode-solutions<gh_stars>100-1000
"""
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.
Find the maximum area of an island ... | 0 | 0 | 0 | 0 | 0 | 0 |
nose2/tests/functional/support/scenario/dundertest_attribute/test.py | deeplow/nose2 | 637 | 179108 | <reponame>deeplow/nose2
import unittest
class TestDunderTest(unittest.TestCase):
__test__ = False
def test_a(self):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
tests.py | anhdhbn/Freenom-dns-updater | 160 | 179122 | <gh_stars>100-1000
import os
import sys
import glob
import unittest
if __name__ == '__main__':
test_files = glob.glob(os.path.join("freenom_dns_updater", 'test', 'test_*.py'))
module_strings = [test_file[0:len(test_file)-3].replace(os.sep, '.') for test_file in test_files]
suites = [unittest.defaultTestLoa... | 0 | 0 | 0 | 0 | 0 | 0 |
ts_datasets/ts_datasets/anomaly/smap.py | ankitakashyap05/Merlion | 2,215 | 179139 | #
# Copyright (c) 2021 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
from __future__ import annotations
import os
import sys
import csv
import ast
import logging
import ... | 2 | 2 | 1 | 0 | 5 | 0 |
docs/figures/meta/meta.py | Hengle/MemoryProfiler | 184 | 179146 | <reponame>Hengle/MemoryProfiler
#!/usr/bin/env python
if __name__ == "__main__":
import os.path as p
filepath = p.join(p.dirname(p.abspath(__file__)), 'meta.json')
import json
fp = open('meta.dot', 'w+')
fp.write('digraph\n{\n')
fp.write(' bgcolor=transparent;\n')
data = json.load(fp=ope... | 0 | 0 | 0 | 0 | 0 | 0 |
documentation/test_python/pybind_signatures/false_positives.py | Ryan-rsm-McKenzie/m.css | 367 | 179221 | <gh_stars>100-1000
# This shouldn't be treated as a pybind signature
def reset():
"""resets everything. Shouldn't be picked as a pybind signature."""
| 0 | 0 | 0 | 0 | 0 | 0 |
gcloud/analysis_statistics/migrations/0001_initial.py | brookylin/bk-sops | 881 | 179228 | # Generated by Django 2.2.24 on 2021-11-01 03:46
from django.db import migrations, models
class Migration(migrations.Migration):
initial: bool = True
dependencies: list[object] = []
operations: list[object] = [
migrations.CreateModel(
name="TaskflowExecutedNodeStatistics",
... | 0 | 0 | 3 | 0 | 3 | 0 |
tests/unit/viz/popups/test_popup_list.py | CartoDB/cartoframes | 236 | 179236 | from cartoframes.viz import popup_element
from cartoframes.viz.popup import Popup
from cartoframes.viz.popup_list import PopupList
popup_list = PopupList({
'click': [popup_element('value_1'), popup_element('value_2')],
'hover': [popup_element('value_1'), popup_element('value_3')]
})
class TestPopupList(object):
... | 0 | 0 | 0 | 0 | 0 | 0 |
custom_components/dahua/models.py | lpdescamps/dahua | 114 | 179320 | from dataclasses import dataclass, InitVar
from typing import Any
@dataclass(unsafe_hash=True)
class CoaxialControlIOStatus:
speaker: bool = False
white_light: bool = False
api_response: InitVar[Any] = None
def __post_init__(self, api_response):
if api_response is not None:
self.s... | 0 | 0 | 3 | 0 | 3 | 0 |
d6tflow/tasks/torch.py | Mozin/d6tflow | 1,004 | 179372 | <reponame>Mozin/d6tflow<gh_stars>1000+
from d6tflow.tasks import TaskData
from d6tflow.targets.torch import PyTorchModel
class PyTorch(TaskData):
"""
Task which saves to .pt models
"""
target_class = PyTorchModel
target_ext = '.pt'
| 0 | 0 | 0 | 0 | 0 | 0 |
typed_python/module_test.py | APrioriInvestments/typed_python | 105 | 179391 | # Copyright 2017-2019 typed_python Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 0 | 0 | 0 | 0 | 0 | 0 |
training/recep_field.py | Pandinosaurus/Spiking-Neural-Network | 755 | 179416 | <filename>training/recep_field.py
####################################################### README #########################################################
# This file consists of function that convolves an image with a receptive field so that input to the network is
# close to the form perceived by our eyes.
######... | 0 | 0 | 0 | 0 | 0 | 0 |
University-of-Toronto-Crafting-Quality-Code/pset1_unittest_test_cases/test_swap_k.py | Sam-Gao-Xin/Courses- | 622 | 179452 | <reponame>Sam-Gao-Xin/Courses-
import a1
import unittest
class TestSwapK(unittest.TestCase):
""" Test class for function a1.swap_k. """
# Add your test methods for a1.swap_k here.
def test_swap_k_example_1(self):
"""Test nswap_k with [] and 2."""
actual = a1.swap_k([], 2)
expecte... | 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/formplayer_api/smsforms/signals.py | dimagilg/commcare-hq | 471 | 179456 | from django.dispatch import Signal
"""
When an xform is received, either from posting or when finished playing.
"""
xform_received = Signal(providing_args=["form"])
"""
When a form is finished playing (via the SMS apis)
"""
sms_form_complete = Signal(providing_args=["session_id", "form"])
| 0 | 0 | 0 | 0 | 0 | 0 |
samples/vsphere/contentlibrary/vmcapture/vm_template_capture.py | restapicoding/VMware-SDK | 589 | 179464 | #!/usr/bin/env python
"""
* *******************************************************
* Copyright VMware, Inc. 2016, 2018. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIO... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/provider/hashicorp/cloudinit.py | mjuenema/python-terrascript | 507 | 179486 | # terrascript/provider/hashicorp/cloudinit.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:14:09 UTC)
import terrascript
class cloudinit(terrascript.Provider):
"""terraform-provider-cloudinit"""
__description__: str = "terraform-provider-cloudinit"
__namespace__: str = "hashicorp"
... | 0 | 0 | 7 | 0 | 7 | 0 |
packages/pyright-internal/src/tests/samples/subscript2.py | Jasha10/pyright | 3,934 | 179498 | # This sample tests various forms of subscript expressions for
# syntax and semantic (type) errors.
from typing import List, TypeVar
_T = TypeVar("_T", list, tuple)
def func1(p1: List[int], p2: _T):
a1 = p1[0]
reveal_type(a1, expected_text="int")
a2 = p1[:]
reveal_type(a2, expected_text="list[int]"... | 0 | 0 | 0 | 0 | 0 | 0 |
IORawData/CaloPatterns/test/pattern_source.py | ckamtsikis/cmssw | 852 | 179511 | <reponame>ckamtsikis/cmssw<filename>IORawData/CaloPatterns/test/pattern_source.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("PatternSource")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
process.load('Configuration/StandardSequences/FrontierConditions_GlobalTag_cff... | 0 | 0 | 0 | 0 | 0 | 0 |
test/nnUNetV1/loss_functions/lovasz_loss.py | jianhuasong/medical-image-segmentation2 | 2,774 | 179533 | import torch
import torch.nn as nn
#from torch.autograd import Function
def lovasz_grad(gt_sorted) -> object:
"""
Computes gradient of the Lovasz extension w.r.t sorted errors
See Alg. 1 in paper
"""
p = len(gt_sorted)
gts = gt_sorted.sum()
intersection = gts - gt_sorted.float().cumsum(0)... | 1 | 4 | 0 | 0 | 5 | 0 |
pygithub3/tests/resources/test_issues.py | minichate/python-github3 | 107 | 179574 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from unittest import TestCase
from pygithub3.resources.issues import Label
class TestLabel(TestCase):
def test_is_valid_color(self):
valid_colors = ['BADa55', 'FF42FF', '45DFCA']
for color in valid_colors:
self.assertTrue(Label.is_valid... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/tests/test_remote_resource.py | lhuett/insights-core | 121 | 179596 | <filename>insights/tests/test_remote_resource.py
from cachecontrol.cache import DictCache
from insights.core.remote_resource import RemoteResource, CachedRemoteResource
from insights.tests.mock_web_server import TestMockServer
import sys
import pytest
GOOD_PAYLOAD = b'Successful return from Mock Service'
NOT_FOUND = b... | 0 | 0 | 0 | 0 | 0 | 0 |
pythainlp/summarize/mt5.py | Gorlph/pythainlp | 569 | 179611 | # -*- coding: utf-8 -*-
"""
Summarization by mT5 model
"""
from transformers import T5Tokenizer, MT5ForConditionalGeneration
from typing import List
class mT5Summarizer:
def __init__(
self,
model_size: str = "small",
num_beams: int = 4,
no_repeat_ngram_size: int = 2... | 7 | 1 | 0 | 0 | 8 | 0 |
docs/graph_first_paint.py | jumper385/TimeChart | 224 | 179619 | # start, prepare data, data ready, finish, FMP
FP_DATA = {
'Chart.JS': [
[32.4, 45.1, 297.6, 1042.4, 1054.8],
[33.6, 43.4, 285.1, 1041.6, 1064.5],
[30.9, 40.9, 292.7, 1036.2, 1056.8],
],
'TimeChart': [
[29.9, 57.2, 255.2, 288.3, 853.2],
[36.2, 43.9, 236.9, 271.5, 837.... | 0 | 0 | 0 | 0 | 0 | 0 |
graph4nlp/pytorch/test/link_prediction/model.py | cminusQAQ/graph4nlp | 1,269 | 179636 | import torch
import torch.nn as nn
import torch.nn.functional as F
from layers import GraphConvolution
from ...modules.prediction.classification.link_prediction.ConcatFeedForwardNNLayer import (
ConcatFeedForwardNNLayer,
)
from ...modules.prediction.classification.link_prediction.ElementSumLayer import ElementSum... | 0 | 4 | 0 | 0 | 4 | 0 |
proselint/checks/misc/usage.py | kerri-hicks/proselint | 4,163 | 179643 | <reponame>kerri-hicks/proselint
"""Elementary Rules of Usage.
---
layout: post
source: Strunk & White
source_url: ???
title: Elementary Rules of Usage
date: 2014-06-10 12:31:19
categories: writing
---
Strunk & White say:
1. Form the possessive singular of nouns by adding 's.
2. In a series of three... | 0 | 0 | 0 | 0 | 0 | 0 |
wagtail/contrib/routable_page/__init__.py | brownaa/wagtail | 8,851 | 179677 | default_app_config = 'wagtail.contrib.routable_page.apps.WagtailRoutablePageAppConfig'
| 0 | 0 | 0 | 0 | 0 | 0 |
Geometry/MTDGeometryBuilder/python/mtdParameters_cff.py | ckamtsikis/cmssw | 852 | 179690 | from Geometry.MTDGeometryBuilder.mtdParameters_cfi import mtdParameters
from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
dd4hep.toModify(mtdParameters, fromDD4hep = True)
| 0 | 0 | 0 | 0 | 0 | 0 |
datasets/single_dataset.py | chaiyujin/AudioDVP | 200 | 179720 | <gh_stars>100-1000
import os
import pickle
from PIL import Image
import torch
from torchvision import transforms
from utils import util
from datasets.base_dataset import BaseDataset
class SingleDataset(BaseDataset):
def __init__(self, opt):
BaseDataset.__init__(self, opt)
self.image_list = util.... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/keras/backend/mxnet_operator_test.py | kalyc/keras-apache-mxnet | 300 | 179725 | <filename>tests/keras/backend/mxnet_operator_test.py
import pytest
import numpy as np
import tempfile
from keras import backend as K
from keras import Model
from keras.layers import Input, Dense, Activation, BatchNormalization
pytestmark = pytest.mark.skipif(K.backend() != 'mxnet',
rea... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/r_crackwatch/app.py | mainyordle/reddit2telegram | 187 | 179761 | <filename>reddit2telegram/channels/r_crackwatch/app.py
#encoding:utf-8
subreddit = 'crackwatch'
t_channel = '@r_crackwatch'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| 0 | 0 | 0 | 0 | 0 | 0 |
decode-encode/macosx-linux/main-unzip.py | whitmans-max/python-examples | 140 | 179812 |
# date: 2019.04.18
# Bartlomiej 'furas' Burek
#
# https://stackoverflow.com/questions/16467479/normalizing-unicode
#
#
import os
import zipfile
import unicodedata
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('filename', help='zip file with MAC OS X names')
args = parser.parse_args()
def co... | 0 | 1 | 0 | 0 | 1 | 0 |
talib/stream.py | aberja/ta-lib | 6,581 | 179817 | import talib._ta_lib as _ta_lib
from ._ta_lib import __TA_FUNCTION_NAMES__
for func_name in __TA_FUNCTION_NAMES__:
globals()[func_name] = getattr(_ta_lib, "stream_%s" % func_name)
| 0 | 0 | 0 | 0 | 0 | 0 |
corehq/ex-submodules/couchforms/migrations/0008_auto_20200701_0742.py | dimagilg/commcare-hq | 471 | 179848 | <reponame>dimagilg/commcare-hq
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-07-01 07:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('couchforms', '0007_auto_20191210_2206'),
]
operatio... | 0 | 0 | 0 | 0 | 0 | 0 |
exts/omni.warp/omni/warp/scripts/extension.py | NVIDIA/warp | 306 | 179866 | <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 |
lambdo/Topology.py | asavinov/lambdo | 287 | 179891 | <filename>lambdo/Topology.py<gh_stars>100-1000
__author__="<NAME>"
import json
import copy
from lambdo.utils import *
from lambdo.resolve import *
from lambdo.transform import *
from lambdo.Workflow import *
from lambdo.Table import *
from lambdo.Column import *
import logging
log = logging.getLogger('lambdo.topolo... | 0 | 0 | 0 | 0 | 0 | 0 |
dm_control/mjcf/skin_test.py | h8907283/dm_control | 2,863 | 179895 | <gh_stars>1000+
# Copyright 2020 The dm_control Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 0 | 0 | 0 | 0 | 0 | 0 |
paper-plotting/surgery.py | twistedcubic/attention-rank-collapse | 118 | 179903 | from __future__ import annotations
import torch.nn as nn
import torch
import math
class NoSkipBertSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=confi... | 13 | 8 | 0 | 1 | 22 | 0 |
tests/zoomus/components/user/test_cust_create.py | dolohow/zoomus | 178 | 179941 | <reponame>dolohow/zoomus
import unittest
from zoomus import components, util
import responses
def suite():
"""Define all the tests of the module."""
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(CustCreateV1TestCase))
return suite
class CustCreateV1TestCase(unittest.TestCase):
d... | 0 | 0 | 0 | 0 | 0 | 0 |
src/Classes/Config.py | TheBossProSniper/electric-windows | 210 | 179955 | <reponame>TheBossProSniper/electric-windows
from utils import confirm, find_existing_installation, copy_to_clipboard, is_admin, get_install_flags
from tempfile import gettempdir
from sys import platform
from subprocess import Popen, PIPE
from Classes.PathManager import PathManager
from Classes.Metadata import Metadata
... | 0 | 0 | 0 | 0 | 0 | 0 |
vint/linting/config/config_filenames.py | tmsanrinsha/vint | 538 | 180012 | CONFIG_FILENAMES = [
'.vintrc.yaml',
'.vintrc.yml',
'.vintrc',
]
| 0 | 0 | 0 | 0 | 0 | 0 |
hs_core/task_utils.py | hydroshare/hydroshare | 178 | 180026 | <gh_stars>100-1000
from celery.task.control import inspect
from celery.result import AsyncResult
from django.db import transaction
from hs_core.models import TaskNotification
import logging
logger = logging.getLogger('django')
celery_inspector = inspect()
def _retrieve_task_id(job_name, res_id, job_dict):
"""... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_strategy_api.py | mahi97/evosax | 102 | 180034 | import jax
from evosax import Strategies
from evosax.problems import ClassicFitness
def test_strategy_ask(strategy_name) -> None:
# Loop over all strategies and test ask API
rng = jax.random.PRNGKey(0)
popsize = 20
strategy = Strategies[strategy_name](popsize=popsize, num_dims=2)
params = strategy... | 0 | 2 | 0 | 0 | 2 | 0 |
test_project/apps/test_app/migrations/0001_initial.py | hjalves/django-wpadmin | 207 | 180040 | <reponame>hjalves/django-wpadmin
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('authors', '0001_initial'),
migrations.swappable_dependency(settings... | 0 | 0 | 0 | 0 | 0 | 0 |
attalos/dataset/wordvectors/wrapper.py | millertime145/attalos | 101 | 180043 | from abc import ABCMeta, abstractmethod
class WordVectorWrapper:
__metaclass__ = ABCMeta
def __init__(self, w2v_model):
self.w2v_model = w2v_model
self.vocab = self.get_vocab()
self.word_vector_shape = self.get_word_vector_shape()
@abstractmethod
def get_vocab(self):
... | 0 | 1 | 0 | 0 | 1 | 0 |
recipes/Python/335555_Storage_store_informatiabout/recipe-335555.py | tdiprima/code | 2,023 | 180109 | from __future__ import annotations
class PrefixStorage(object):
"""Storage for store information about prefixes.
>>> s = PrefixStorage()
First we save information for some prefixes:
>>> s["123"] = "123 domain"
>>> s["12"] = "12 domain"
Then we can retrieve prefix information by full key
... | 1 | 1 | 0 | 2 | 4 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.