max_stars_repo_path
stringlengths
4
245
max_stars_repo_name
stringlengths
7
115
max_stars_count
int64
101
368k
id
stringlengths
2
8
content
stringlengths
6
1.03M
samples/python/model_creation_sample/model_creation_sample.py
kurylo/openvino
1,127
11013459
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import sys import typing from functools import reduce import numpy as np from openvino.preprocess import PrePostProcessor from openvino.runtime import (Core, Layout, Mo...
bag/design/module.py
aalto-ele/BAG_framework
123
11013466
# -*- coding: utf-8 -*- """This module defines base design module class and primitive design classes. """ import os import abc from typing import TYPE_CHECKING, List, Dict, Optional, Tuple, Any, Type, Set, Sequence, \ Callable, Union from ..math import float_to_si_string from ..io import read_yaml from ..util.ca...
python_scripts/trees_regression.py
miwojc/scikit-learn-mooc
634
11013498
# %% [markdown] # # Decision tree for regression # # In this notebook, we present how decision trees are working in regression # problems. We show differences with the decision trees previously presented in # a classification setting. # # First, we load the penguins dataset specifically for solving a regression # probl...
codigo/Live115/pubsub.py
cassiasamp/live-de-python
572
11013504
# http://www.code2succeed.com/pub-sub/ # https://www.oreilly.com/library/view/learning-javascript-design/9781449334840/ch09s05.html # https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern#Message_filtering from typing import Dict, Set, List class Publicador: def __init__(self, topico, pub_sub): s...
TransForm_Kit/Quantization/data_loader.py
inaccel/TF2
144
11013540
# Copyright 2019 Inspur Corporation. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
tools/face/mod_json_gt_det.py
AruniRC/detectron-self-train
128
11013543
""" Subsample from CS6 GT only those images that are used in the Dets or HP JSON. srun --mem 10000 python tools/face/mod_json_gt_det.py """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import sys sys.path.app...
sim2600/asm6502.py
gmarino2048/Sim2600
114
11013562
# Copyright (c) 2014 <NAME>, Visual6502.org # # 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, publi...
goatools/anno/extensions/factory.py
flying-sheep/goatools
477
11013569
"""Annotation Extension for relational expressions. https://link.springer.com/protocol/10.1007/978-1-4939-3743-1_17 http://wiki.geneontology.org/index.php/Annotation_Extension Correlated function associations between genes and GOs containing contextual information. With contextual information identify ge...
nalaf/features/relations/entityhead.py
ashish-narwal/nalaf
103
11013600
<filename>nalaf/features/relations/entityhead.py from nalaf.features.relations import EdgeFeatureGenerator from nalaf.features.relations import TokenFeatureGenerator from nltk.stem import PorterStemmer import re class EntityHeadTokenFeatureGenerator(EdgeFeatureGenerator): """ Calculate the head token for each...
test_frame/test_qps/qps_demo_use_frame.py
DJMIN/funboost
120
11013656
<gh_stars>100-1000  """ 这个代码是模拟常规并发手段无法达到每秒持续精确运行8次函数(请求flask接口8次)的目的。 但是使用分布式函数调度框架能轻松达到这个目的。 下面的代码使用分部署函数调度框架来调度运行 request_flask_api 函数, flask_veiw_mock 接口耗时0.1秒时候,控制台每秒打印8次 hello world,非常精确的符合控频目标 flask_veiw_mock 接口耗时1秒时候,控制台每秒打印8次 hello world,非常精确的符合控频目标 flask_veiw_mock 接口耗时10秒时候控,控制台每秒打印8次 hello world,非常精确的符合控频...
smartsim/exp/ray/raycluster.py
neuralvis/SmartSim
117
11013660
<filename>smartsim/exp/ray/raycluster.py<gh_stars>100-1000 # BSD 2-Clause License # # Copyright (c) 2021, Hewlett Packard Enterprise # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistri...
Python/Examples/UR_Monitoring_CSV.py
sunoval2016/RoboDK-API
161
11013689
<gh_stars>100-1000 # This script creates a thread to monitor the position and other variables from a real UR robot and stores the data to a CSV file # With this script running, RoboDK will save a CSV file of the robot status # # Press F5 to run the script # Or visit: http://www.robodk.com/doc/en/PythonAPI/ from robolin...
python_toolbox/address_tools/shared.py
hboshnak/python_toolbox
119
11013699
<filename>python_toolbox/address_tools/shared.py # Copyright 2009-2017 <NAME>. # This program is distributed under the MIT license. '''Various objects and tools for `address_tools`.''' import re _address_pattern = re.compile( r"^(?P<address>([a-zA-Z_][0-9a-zA-Z_]*)(\.[a-zA-Z_][0-9a-zA-Z_]*)*)$" ) '''Pattern for...
core/models/classifier.py
JDAI-CV/FADA
120
11013708
import torch from torch import nn import torch.nn.functional as F from torchvision.models._utils import IntermediateLayerGetter class ASPP_Classifier_V2(nn.Module): def __init__(self, in_channels, dilation_series, padding_series, num_classes): super(ASPP_Classifier_V2, self).__init__() self.conv2d_...
api/audit/serializers.py
SolidStateGroup/Bullet-Train-API
126
11013721
<gh_stars>100-1000 from rest_framework import serializers from audit.models import AuditLog from environments.serializers import EnvironmentSerializerLight from projects.serializers import ProjectSerializer from users.serializers import UserListSerializer class AuditLogSerializer(serializers.ModelSerializer): au...
src/crawler_1.py
yuju13488/homework
332
11013722
<filename>src/crawler_1.py<gh_stars>100-1000 import requests url = 'https://www.ptt.cc/bbs/movie/index.html' response = requests.get(url) print(response.text)
src/research/power_flow/jacobian/high_speed_jacobian_csc.py
mzy2240/GridCal
284
11013727
<filename>src/research/power_flow/jacobian/high_speed_jacobian_csc.py from numba import jit from scipy.sparse import issparse from numpy import conj, abs, allclose from numpy import complex128, float64, int32 from numpy.core.multiarray import zeros, empty, array from scipy.sparse import csc_matrix, vstack, hstack, dia...
tests/data/expected/parser/openapi/openapi_parser_parse_remote_ref/with_import_format.py
adaamz/datamodel-code-generator
891
11013751
from __future__ import annotations from typing import Optional from pydantic import AnyUrl, BaseModel, conint class Problem(BaseModel): detail: Optional[str] = None instance: Optional[AnyUrl] = None status: Optional[conint(ge=100, lt=600)] = None title: Optional[str] = None type: Optional[AnyUrl...
src/ydata_quality/drift/__init__.py
poga/ydata-quality
242
11013792
""" Tools to check dataset for data drifting. """ from .engine import DriftAnalyser, ModelWrapper __all__ = [ "DriftAnalyser", "ModelWrapper" ]
hubblestack/modules/reg.py
buddwm/hubble
363
11013801
<filename>hubblestack/modules/reg.py # -*- coding: utf-8 -*- r""" Manage the Windows registry Hives ----- Hives are the main sections of the registry and all begin with the word HKEY. - HKEY_LOCAL_MACHINE - HKEY_CURRENT_USER - HKEY_USER Keys ---- Keys are the folders in the registry. Keys can have many nested subke...
hw/ip/otbn/dv/rig/rig/gens/ecall.py
Jacob-Levy/opentitan
1,375
11013818
# Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 from typing import Optional from shared.insn_yaml import InsnsFile from ..config import Config from ..program import ProgInsn, Program from ..model import Model from ..sn...
anchore/anchore_image.py
berez23/anchore
401
11013827
import json import random import shutil import subprocess from textwrap import fill import docker import sys import os import re from prettytable import PrettyTable import time import tarfile import logging import anchore_utils from anchore.util import contexts DEVNULL = open(os.devnull, 'wb') class AnchoreImage(...
mmdet/datasets/samplers/__init__.py
Qianna00/InstanceLoc
120
11013846
<gh_stars>100-1000 from .group_sampler import DistributedGroupSampler, GroupSampler __all__ = ['DistributedGroupSampler', 'GroupSampler']
postgres/datadog_checks/postgres/__init__.py
remicalixte/integrations-core
663
11013848
from .__about__ import __version__ from .postgres import PostgreSql __all__ = ['__version__', 'PostgreSql']
backend/light_head_rcnn/person_detector.py
zju-3dv/multi-person3dpose
391
11013850
<filename>backend/light_head_rcnn/person_detector.py # encoding: utf-8 """ @author: <NAME> @contact: <EMAIL> This file is an middle-ware to encapsulate light-head-rcnn for academic use. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from .light_config i...
litex/soc/doc/module.py
osterwood/litex
1,501
11013883
# # This file is part of LiteX. # # Copyright (c) 2020 <NAME> <<EMAIL>> # SPDX-License-Identifier: BSD-2-Clause from migen.fhdl.module import DUID from migen.util.misc import xdir from litex.soc.interconnect.csr_eventmanager import EventManager from litex.soc.integration.doc import ModuleDoc import textw...
cumulusci/robotframework/tests/FooTestPage.py
davisagli/CumulusCI
163
11013927
from cumulusci.robotframework.pageobjects import BasePage, pageobject @pageobject(page_type="Test", object_name="Foo__c") class FooTestPage(BasePage): def foo_keyword_1(self, message): self.builtin.log(message) return "foo keyword 1: {}".format(message)
alipay/aop/api/response/AlipayBossProdAntlegalchainOrderApplyResponse.py
antopen/alipay-sdk-python-all
213
11013936
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayBossProdAntlegalchainOrderApplyResponse(AlipayResponse): def __init__(self): super(AlipayBossProdAntlegalchainOrderApplyResponse, self).__init__() self._bas_dat...
cli/tests/pcluster/cli/test_list_official_images.py
enrico-usai/cfncluster
415
11013962
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance # with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ # or in the "LICENSE.txt" file accompa...
examples/treelstm/model.py
ruyimarone/dynet
3,307
11013975
<reponame>ruyimarone/dynet<filename>examples/treelstm/model.py import dynet as dy import numpy as np import os class TreeLSTMBuilder(object): def __init__(self, pc_param, pc_embed, word_vocab, wdim, hdim, word_embed=None): self.WS = [pc_param.add_parameters((hdim, wdim)) for _ in "iou"] self.US = ...
galaxy/importer/main.py
bmclaughlin/galaxy
904
11013980
<reponame>bmclaughlin/galaxy # (c) 2012-2018, Ansible by Red Hat # # This file is part of Ansible Galaxy # # Ansible Galaxy is free software: you can redistribute it and/or modify # it under the terms of the Apache License as published by # the Apache Software Foundation, either version 2 of the License, or # (at your ...
tests/basics/string_pep498_fstring.py
Neradoc/circuitpython
3,010
11013981
<reponame>Neradoc/circuitpython # Tests against https://www.python.org/dev/peps/pep-0498/ assert f'no interpolation' == 'no interpolation' assert f"no interpolation" == 'no interpolation' # Quoth the PEP: # Backslashes may not appear anywhere within expressions. Comments, using the # '#' character, are not allowed in...
apps/webguacamole/urls_api.py
crazypenguin/devops
300
11013983
from django.urls import path from . import views_api app_name = "webguacamole" urlpatterns = [ path('session/upload/', views_api.session_upload, name='session_upload'), ]
analysis_engine/work_tasks/run_distributed_algorithm.py
virdesai/stock-analysis-engine
819
11013988
<reponame>virdesai/stock-analysis-engine """ Running Distributed Algorithms Across Many Celery Workers Use this module to handle algorithm backtesting (tuning) or for live trading. Under the hood, this is a Celery task handler that processes jobs from a broker's messaging queue. This allows the Analysis Engine to pro...
eend/bin/make_mixture.py
lekynam2000/EEND
250
11014036
#!/usr/bin/env python3 # Copyright 2019 Hitachi, Ltd. (author: <NAME>) # Licensed under the MIT license. # # This script generates simulated multi-talker mixtures for diarization # # common/make_mixture.py \ # mixture.scp \ # data/mixture \ # wav/mixture import argparse import os from eend import kaldi_d...
src/training.py
pcheng2/SindyAutoencoders
190
11014080
<filename>src/training.py import numpy as np import tensorflow as tf import pickle from autoencoder import full_network, define_loss def train_network(training_data, val_data, params): # SET UP NETWORK autoencoder_network = full_network(params) loss, losses, loss_refinement = define_loss(autoencoder_netwo...
bumblebee_status/modules/core/ping.py
spxtr/bumblebee-status
1,089
11014092
# pylint: disable=C0111,R0903 """Periodically checks the RTT of a configurable host using ICMP echos Requires the following executable: * ping Parameters: * ping.address : IP address to check * ping.timeout : Timeout for waiting for a reply (defaults to 5.0) * ping.probes : Number of probes to send ...
tests/pypokerengine/engine/action_checker_test.py
stupps/PyPokerEngine
479
11014187
from tests.base_unittest import BaseUnitTest from pypokerengine.engine.player import Player from pypokerengine.engine.poker_constants import PokerConstants as Const from pypokerengine.engine.action_checker import ActionChecker class ActionCheckerTest(BaseUnitTest): """ the case when no action is done before """ d...
setup.py
kylejusticemagnuson/py-financial-indicators
635
11014207
from setuptools import setup, find_packages setup( name="pyti", version='0.2.2', description='Technical Indicator Library', long_description="This library contains various financial technical " "indicators that can be used to analyze financial data.", url='https://github.co...
tools/write_version_header.py
ztlevi/perfetto
933
11014218
#!/usr/bin/env python3 # Copyright (C) 2020 The Android Open Source Project # # 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...
models/psp_net.py
mylover106/pytorch-semantic-segmentation
1,328
11014258
<reponame>mylover106/pytorch-semantic-segmentation<filename>models/psp_net.py import torch import torch.nn.functional as F from torch import nn from torchvision import models from ..utils import initialize_weights from ..utils.misc import Conv2dDeformable from .config import res101_path class _PyramidPoolingModule(n...
src/sparseml/tensorflow_v1/datasets/classification/cifar.py
clementpoiret/sparseml
922
11014266
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
onnxruntime/core/flatbuffers/ort_flatbuffers_py/experimental/fbs/Model.py
toothache/onnxruntime
6,036
11014271
<gh_stars>1000+ # automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class Model(object): __slots__ = ['_tab'] @classmethod def GetRootAsModel(cls, buf, offset): n = flatbuffers.en...
examples/scripts/tabular_mar_2021.py
stjordanis/mljar-supervised
1,882
11014287
<reponame>stjordanis/mljar-supervised import pandas as pd from supervised import AutoML train = pd.read_csv("~/Downloads/tabular-playground-series-mar-2021/train.csv") test = pd.read_csv("~/Downloads/tabular-playground-series-mar-2021/test.csv") X_train = train.drop(["id", "target"], axis=1) y_train = train.target X_...
argument_parser.py
mitra052/ViewAL
126
11014292
<gh_stars>100-1000 import argparse import torch import random def parse_args(): parser = argparse.ArgumentParser(description="ViewAL") parser.add_argument('--backbone', type=str, default='mobilenet', choices=['resnet', 'xception', 'drn', 'mobilenet'], help='back...
utils/ida-genfield.py
sit/dht
365
11014318
#!/usr/bin/env python # # This script requires a recent version of python that supports long # integers (i.e. arbitrary precision integers) inv = [] # Also see ida.C field = 65537 def bitrev (v): t = v & 1; while v: t = t << 1 v = v >> 1 t = t | (v & 1) return t # Fast modular ex...
tests/test_constants.py
vyasr/scikit-build
299
11014342
import os import sys from skbuild.constants import SKBUILD_DIR, set_skbuild_plat_name, skbuild_plat_name def test_set_skbuild_plat_name(): try: previous_plat_name = skbuild_plat_name() set_skbuild_plat_name("plat-name") assert os.path.join("_skbuild", "plat-name-{}.{}".format(*sys.version...
pollbot/models/user.py
shubham-king/poll
112
11014362
<reponame>shubham-king/poll """The sqlite model for a user.""" from __future__ import annotations from sqlalchemy import Boolean, Column, ForeignKey, func from sqlalchemy.orm import relationship from sqlalchemy.types import BigInteger, DateTime, String from pollbot.db import base class User(base): """The model ...
tests/test_condensation.py
CalebBell/ht
118
11014378
<reponame>CalebBell/ht<filename>tests/test_condensation.py # -*- coding: utf-8 -*- '''Chemical Engineering Design Library (ChEDL). Utilities for process modeling. Copyright (C) 2016, 2017, 2018, 2019, <NAME> <<EMAIL>> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and ass...
docs/tutorial/sources/chapter06/run_popnet.py
GregGlickert/bmtk
216
11014387
import sys import os from bmtk.simulator import popnet from bmtk.analyzer.firing_rates import plot_rates_popnet def main(config_file): configure = popnet.config.from_json(config_file) configure.build_env() network = popnet.PopNetwork.from_config(configure) sim = popnet.PopSimulator.from_config(config...
summertime/model/single_doc/multilingual/translation_pipeline_model.py
techthiyanes/SummerTime
178
11014408
from .base_multilingual_model import MultilingualSummModel, fasttext_predict from summertime.model.base_model import SummModel from summertime.model.single_doc import BartModel from easynmt import EasyNMT class TranslationPipelineModel(MultilingualSummModel): """ A class for multilingual summarization perfor...
Chapter 4/restful_python_chapter_04_05/gamesapi/games/apps.py
Mohamed2011-bit/Building-RESTful-Python-Web-Services
116
11014430
<gh_stars>100-1000 """ Book: Building RESTful Python Web Services Chapter 4: Throttling, Filtering, Testing and Deploying an API with Django Author: <NAME> - Twitter.com/gastonhillar Publisher: Packt Publishing Ltd. - http://www.packtpub.com """ from django.apps import AppConfig class GamesConfig(AppConfig): name...
yaksok/ast_tool.py
EunDaengED/yaksok
170
11014452
import ast class MyTransformer(ast.NodeTransformer): def __init__(self, temporary_names): self.temporary_names = temporary_names def visit_has_body(self, node): for idx, expr in enumerate(node.body): if (isinstance(expr, ast.Expr) and isinstance(expr.value, ast.N...
PointRCNN/lib/net/depth_net.py
mileyan/mileyan
152
11014484
<reponame>mileyan/mileyan<filename>PointRCNN/lib/net/depth_net.py import torch import torch.optim as optim import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as transforms from torch.optim.lr_scheduler import StepLR, MultiStepLR from torch_scatter import scatter_max import math import ...
tests/test_augmentations.py
McMasterAI/RadiologyandAI-MedicalZooPytorch
995
11014497
from lib.medloaders.medical_loader_utils import generate_padded_subvolumes import torch import matplotlib.pyplot as plt import lib.augment3D as augment size = 32 from lib.medloaders.medical_image_process import load_medical_image # t1 = torch.randn(size,size,size).numpy() # t2 = torch.randn(size,size,size).numpy() b...
mnist/ColorMNIST/00_make_data.py
laura-rieger/deep-explanation-penalization
105
11014506
<filename>mnist/ColorMNIST/00_make_data.py import torch import torchvision import torchvision.datasets as datasets import sys import numpy as np import torch.utils.data as utils from tqdm import tqdm from colour import Color import os from os.path import join as oj np.random.seed(0) red = Color("red") color...
packages/pyright-internal/src/tests/samples/augmentedAssignment3.py
martindemello/pyright
4,391
11014510
# This sample tests the case where an instance variable # is assigned using only augmented assignment expressions. class ClassA: def a(self): # This should generate an error. self.val1 += 3
pyndata/tests/test_bitfield.py
mcclung/zfsp
600
11014516
<gh_stars>100-1000 import pyndata class BitFieldTests(pyndata.Struct): real = pyndata.uint16() bit1 = pyndata.BitField(real, 4, shift=0) bit2 = pyndata.BitField(real, 1, shift=4) bit3 = pyndata.BitField(real, 3, shift=5) bit4 = pyndata.BitField(real, 8, shift=8) def test_bitfield(): b = BitFie...
tools/symsrc/img_fingerprint.py
nagineni/chromium-crosswalk
231
11014518
<reponame>nagineni/chromium-crosswalk<filename>tools/symsrc/img_fingerprint.py #!/usr/bin/env python # Copyright (c) 2011 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. """Retrieves an image's "fingerprint". This is used...
config/cifar/WRNd28w10CosineClassifierRotAugRotSelfsupervision.py
alisure-fork/BF3S
130
11014520
config = {} # set the parameters related to the training and testing set num_classes = 64 data_train_opt = { "dataset_name": "CIFAR100FewShot", "nKnovel": 0, "nKbase": num_classes, "n_exemplars": 0, "n_test_novel": 0, "n_test_base": 64, "batch_size": 1, } data_train_opt["epoch_size"] = dat...
tests/test_imports.py
Ronjaa95/neurolib
258
11014536
<filename>tests/test_imports.py import unittest class TestImports(unittest.TestCase): @classmethod def setUpClass(cls): from neurolib.models.fhn import FHNModel fhn = FHNModel() fhn.run() cls.model = fhn from neurolib.utils.parameterSpace import ParameterSpace ...
res/TensorFlowPythonExamples/examples/fake_quant_with_min_max_vars/__init__.py
juitem/ONE
255
11014538
<filename>res/TensorFlowPythonExamples/examples/fake_quant_with_min_max_vars/__init__.py import tensorflow as tf import numpy as np tf.compat.v1.disable_eager_execution() in_ = tf.compat.v1.placeholder(tf.float32, shape=(1, 32, 32, 3), name="Hole") filters = np.random.uniform(low=-1., high=1, size=[5, 5, 3, 32]).ast...
examples/fixmatch/libml/augment/core.py
kihyuks/objax
715
11014555
# 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, ...
utils/train_vec.py
zhufz/nlp_research
160
11014561
<reponame>zhufz/nlp_research<gh_stars>100-1000 #-*- coding:utf-8 -*- import gensim import sys import pdb def train(sentences, save_path = "word2vec/vocabulary", embedding_size = 128): word_set = set() for word_list in sentences: for word in word_list: word_set.add(word) vocabulary_size ...
util/search.py
kbrsh/slash
102
11014579
<reponame>kbrsh/slash<gh_stars>100-1000 import numpy as np def H(k): c = 2 ** k if c == 1: return np.matrix([ [1] ]) elif c == 2: return np.matrix([ [1, 1], [1, -1] ]) else: return np.kron( np.matrix([ ...
easyreg/momentum_net.py
ebrahimebrahim/easyreg
107
11014604
from __future__ import absolute_import from __future__ import division from __future__ import print_function from .modules import * class MomentumNet(nn.Module): """ momentum generation network """ def __init__(self, low_res_factor,opt): super(MomentumNet,self).__init__() self.low_res...
tools/tagging_schemes_converter.py
woailaosang/NeuronBlocks
1,257
11014613
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT license. import sys def BIO2BIOES(input_labels_list): output_labels_list = [] for labels in input_labels_list: new_labels = [] sent_len = len(labels) for idx in range(sent_len): if "-" not...
tests/unit/commands/_utils/test_command_exception_handler.py
praneetap/aws-sam-cli
2,285
11014614
<filename>tests/unit/commands/_utils/test_command_exception_handler.py from typing import Callable from unittest import TestCase from botocore.exceptions import NoRegionError, ClientError from parameterized import parameterized from samcli.commands._utils.command_exception_handler import command_exception_handler fro...
python-modules/twisted/twisted/conch/ui/__init__.py
stormtheh4ck3r/python-for-android
267
11014616
<filename>python-modules/twisted/twisted/conch/ui/__init__.py # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. # """ twisted.conch.ui is home to the UI elements for tkconch. Maintainer: <NAME> """
qdtrack/models/losses/multipos_cross_entropy_loss.py
OceanPang/qdtrack
241
11014633
<reponame>OceanPang/qdtrack<filename>qdtrack/models/losses/multipos_cross_entropy_loss.py import torch import torch.nn as nn from mmdet.models import LOSSES, weight_reduce_loss def multi_pos_cross_entropy(pred, label, weight=None, red...
tests/helpers.py
yiwc/robotics-world
681
11014657
import numpy as np import glfw def step_env(env, max_path_length=100, iterations=1, render=True): """Step env helper.""" for _ in range(iterations): obs = env.reset() for _ in range(max_path_length): next_obs, _, done, info = env.step(env.action_space.sample()) if env._p...
platform/coredb/tests/test_executor/test_executor_subscriptions.py
admariner/polyaxon
3,200
11014709
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 applicable ...
uecli/UnrealManagerException.py
MonsterClosetGames/ue4cli
179
11014720
<filename>uecli/UnrealManagerException.py class UnrealManagerException(Exception): pass
3rdParty/boost/1.71.0/libs/python/test/crossmod_exception.py
rajeev02101987/arangodb
12,278
11014724
# Copyright (C) 2003 <NAME> LLC. Distributed under the Boost # Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy # at http://www.boost.org/LICENSE_1_0.txt) print("running...") import crossmod_exception_a import crossmod_exception_b try: crossmod_exception_b.tossit() except IndexError: ...
tests/test_dask_image/test_ndfilters/test__order.py
anlavandier/dask-image
144
11014739
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import pytest import numpy as np import scipy.ndimage import dask.array as da import dask_image.ndfilters @pytest.mark.parametrize( "da_func, extra_kwargs", [ (dask_image.ndfilters.minimum_filter, {}), (dask_image.ndfilters.med...
vyapp/stderr.py
iogf/vy
927
11014741
<reponame>iogf/vy from traceback import format_exc import logging import sys QUIET = 100 logger = logging.getLogger() def xhook(exctype, value, tb): logger.exception('', exc_info=(exctype, value, tb)) def printd(*args): logger.debug(' '.join(map(str, args))) sys.excepthook = xhook c_handler = logging....
tests/cmdline/cmd_parsetree.py
rxchen/micropython
13,648
11014757
# cmdline: -v -v -v # test printing of the parse-tree for i in (): pass a = None b = "str" c = "a very long str that will not be interned" d = b"bytes" e = b"a very long bytes that will not be interned" f = 123456789012345678901234567890 g = 123 h = f"fstring: '{b}'"
algorithms/common_funcs_moa.py
eugenevinitsky/sequential_social_dilemma_games
284
11014777
<filename>algorithms/common_funcs_moa.py<gh_stars>100-1000 import numpy as np from ray.rllib.models import ModelCatalog from ray.rllib.policy.policy import Policy from ray.rllib.utils import try_import_tf from ray.rllib.utils.annotations import override from algorithms.common_funcs_baseline import BaselineResetConfigM...
src/db-up/azext_db_up/vendored_sdks/azure_mgmt_sql/sql/operations/sync_groups_operations.py
Mannan2812/azure-cli-extensions
207
11014778
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
test/kernels/test_gaussian_symmetrized_kl_kernel.py
llguo95/gpytorch
2,673
11014809
#!/usr/bin/env python3 import unittest import torch from torch.distributions import Normal, kl_divergence from gpytorch.kernels import GaussianSymmetrizedKLKernel from gpytorch.test.base_kernel_test_case import BaseKernelTestCase class TestGaussianSymmetrizedKLKernel(unittest.TestCase, BaseKernelTestCase): def...
cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_VLAN_IFTABLE_RELATIONSHIP_MIB.py
CiscoDevNet/ydk-py
177
11014814
""" CISCO_VLAN_IFTABLE_RELATIONSHIP_MIB Cisco VLAN ifTable Relationship MIB lists VLAN\-id and ifIndex information for routed VLAN interfaces. A routed VLAN interface is the router interface or sub\-interface to which the router's IP address on the VLAN is attached. For example, an ISL, SDE, or 802.1Q encapsula...
tests/test_graphs.py
klaernie/code2flow
2,248
11014818
import io import os import sys import pygraphviz import pytest sys.path.append(os.getcwd().split('/tests')[0]) from code2flow.engine import code2flow, LanguageParams from tests.testdata import testdata LANGUAGES = ( 'py', 'js', 'mjs', 'rb', 'php', ) flattened_tests = {} for lang, tests in testd...
osf/migrations/0216_auto_20200910_1259.py
gaybro8777/osf.io
628
11014825
# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2020-09-10 12:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('osf', '0215_auto_20200819_1942'), ] operations = [ migrations.AddField( ...
model/__init__.py
aqui-tna/LM-LSTM-CRF
877
11014828
__author__ = "<NAME> and <NAME>" __credits__ = ["<NAME>", "<NAME>", "<NAME>"] __license__ = "Apache License 2.0" __maintainer__ = "<NAME>" __email__ = "<EMAIL>"
neutron/plugins/ml2/extensions/tag_ports_during_bulk_creation.py
congnt95/neutron
1,080
11014832
<reponame>congnt95/neutron<filename>neutron/plugins/ml2/extensions/tag_ports_during_bulk_creation.py # Copyright (c) 2019 <NAME> # 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 ...
mmedit/models/transformers/__init__.py
Jian137/mmediting-1
1,884
11014836
<reponame>Jian137/mmediting-1 # Copyright (c) OpenMMLab. All rights reserved. from .search_transformer import SearchTransformer __all__ = ['SearchTransformer']
src/probflow/utils/metrics.py
chiragnagpal/probflow
134
11014841
"""Metrics. Evaluation metrics * :func:`.log_prob` * :func:`.acc` * :func:`.accuracy` * :func:`.mse` * :func:`.sse` * :func:`.mae` ---------- """ __all__ = [ "accuracy", "mean_squared_error", "sum_squared_error", "mean_absolute_error", "r_squared", "true_positive_rate", "true_negative_...
src/Python/VisualizationAlgorithms/AnatomicalOrientation.py
cvandijck/VTKExamples
309
11014847
#!/usr/bin/env python # -*- coding: utf-8 -*- """ The human data file is taken from: https://github.com/Slicer/Slicer/blob/master/Base/Logic/Resources/OrientationMarkers/Human.vtp Thanks to the Slicer people for providing this. """ import vtk def main(): colors = vtk.vtkNamedColors() fileName = get_pro...
h2o-docs/src/booklets/v2_2015/source/Python_Vignette_code_examples/python_retain_common_categories.py
ahmedengu/h2o-3
6,098
11014852
bb_df = df12.interaction(['B','B'], pairwise=False, max_factors=2, min_occurrence=1) # View H2OFrame bb_df # B_B # ----- # one # one # two # other # two # two # one # other # # [8 rows x 1 column]
official/nlp/modeling/layers/kernel_attention.py
NasTul/models
82,518
11014865
# Copyright 2021 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...
modin/pandas/test/dataframe/test_iter.py
Rubtsowa/modin
7,258
11014881
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
jaqs/data/basic/position.py
WestXu/JAQS
602
11014883
# encoding:utf-8 class Position(object): """ Basic position class. Attributes ---------- symbol : str List of securities. side : str ("Long", "Short"). Positions of different sides will not be merged. cost_price : float Average cost price of current net position. ...
integration_test/version_control.py
robintw/recipy
451
11014884
""" Functions to provide information about a Git repository. """ # Copyright (c) 2015-2016 University of Edinburgh and # University of Southampton. from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_lite...
run_sort.py
twistedcubic/attention-rank-collapse
118
11014930
<filename>run_sort.py import argparse import copy import os import pathlib import pdb import sys import numpy as np import scipy import torch import torch.nn as nn from tqdm import tqdm import arguments import plot from configuration_san import SANConfig from functions import create_path from modeling_san import SANF...
py_entitymatching/tests/test_rule_based_matcher.py
kvpradap/py_entitymatching
165
11014988
<reponame>kvpradap/py_entitymatching import os from nose.tools import * import pandas as pd import unittest import py_entitymatching as em from py_entitymatching.feature.simfunctions import get_sim_funs_for_blocking from py_entitymatching.feature.tokenizers import get_tokenizers_for_blocking from py_entitymatching.fea...
examples/native_threads/check.py
panchiwalashivani/python
146
11014994
from pubnub.callbacks import SubscribeCallback from pubnub.enums import PNStatusCategory from pubnub.pnconfiguration import PNConfiguration from pubnub.pubnub import PubNub pnconfig = PNConfiguration() pnconfig.subscribe_key = 'sub-c-a41be4e8-b620-11e5-a916-0619f8945a4f' pnconfig.publish_key = 'pub-c-b525a8c0-3301-43...
pca/application/interactor.py
pcah/python-clean-architecture
278
11015000
<gh_stars>100-1000 import abc import typing as t from dataclasses import dataclass from pca.data.descriptors import reify from pca.data.validation import ( Validator, validated_by, ) from pca.exceptions import ProcessError from pca.utils.dependency_injection import ( Component, container_supplier, ...
saleor/discount/migrations/0022_sale_channel_listing.py
fairhopeweb/saleor
15,337
11015009
<reponame>fairhopeweb/saleor # Generated by Django 3.1 on 2020-09-16 11:23 import os import django.db.models.deletion from django.conf import settings from django.db import migrations, models from django.utils.text import slugify def migrate_sale_data(apps, schema): Channel = apps.get_model("channel", "Channel"...
cadl/squeezenet.py
muxgt/pycadl
398
11015021
"""SqueezeNet """ """ squeezeNet is a much smaller convolutional network, with vastly less amount of parameters. queezeNet achieves AlexNet-level accuracy on ImageNet with 50x fewer parameters. Additionally, with model compression techniques SqueezeNet can be compress to less than 0.5MB (510x smaller than AlexNet). ht...
salesman/admin/wagtail_hooks.py
dinoperovic/django-salesman
222
11015053
<filename>salesman/admin/wagtail_hooks.py from django import forms from django.shortcuts import redirect from django.urls import re_path from django.utils.formats import date_format from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy ...