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 |
|---|---|---|---|---|
hardware/constraints/VM_848x480.py | mfkiwl/icestation-32 | 117 | 11059916 | <reponame>mfkiwl/icestation-32<gh_stars>100-1000
ctx.addClock("clk_2x", 33.75)
ctx.addClock("clk_1x", 16.88)
|
cocotb/_sim_versions.py | lavanyajagan/cocotb | 350 | 11059963 | # Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
"""
Classes to compare simulation versions.
These are for cocotb-internal use only.
.. warning::
These classes silently allow comparing versions of different simulators.
"""
... |
tools/kapture_upgrade_1_0_to_1_1_orphan_features.py | v-mehta/kapture | 264 | 11059964 | <filename>tools/kapture_upgrade_1_0_to_1_1_orphan_features.py
#!/usr/bin/env python3
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
Convert kapture data in version 1.0 to version 1.1 (only orphan features)
"""
import logging
import argparse
import path_to_kapture # noqa: F401
import kapture.uti... |
easyrobust/easyrobust/losses/__init__.py | thu-ml/realsafe | 107 | 11060009 | <filename>easyrobust/easyrobust/losses/__init__.py
from .prob_compact_loss import HardProbCompactLoss, SoftProbCompactLoss
from .ceb_loss import Conditional_Entropy_Bottleneck |
tests/test_attributes.py | michaeljoseph/changes | 135 | 11060026 | import pytest
from changes import attributes
from . import context
@pytest.mark.skip('bumpversion')
def test_extract_attribute(python_module):
assert '0.0.1' == attributes.extract_attribute('test_app', '__version__')
@pytest.mark.skip('bumpversion')
def test_replace_attribute(python_module):
attributes.re... |
examples/httpserver/http_server1.py | dendron2000/Thespian | 210 | 11060047 | <reponame>dendron2000/Thespian
"""Initial http server.
Wakes up each check period and accepts new incoming sockets and
services existing sockets. All sockets are managed by the main
server actor. When a complete HTTP request has been received, it is
sent to the Handler actor (provided at startup); the Handle... |
src/acconeer/exptool/clients/multiwrap.py | crzdg/acconeer-python-exploration | 117 | 11060049 | <filename>src/acconeer/exptool/clients/multiwrap.py<gh_stars>100-1000
import numpy as np
from acconeer.exptool.clients.base import BaseClient, ClientError
class MultiClientWrapper(BaseClient):
def __init__(self, clients, **kwargs):
kwargs["squeeze"] = False
super().__init__(**kwargs)
self... |
frontend/src/tags/views.py | ANRGUSC/I3-core | 104 | 11060082 | <gh_stars>100-1000
from django.shortcuts import render
# Create your views here.
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from analytics.models import TagView
from .models import Tag
class TagDetailView(DetailView):
model = Tag
def get_context_data(self, ... |
recipes/Python/81611_Roman_Numerals/recipe-81611.py | tdiprima/code | 2,023 | 11060147 | <filename>recipes/Python/81611_Roman_Numerals/recipe-81611.py<gh_stars>1000+
def int_to_roman(input):
"""
Convert an integer to Roman numerals.
Examples:
>>> int_to_roman(0)
Traceback (most recent call last):
ValueError: Argument must be between 1 and 3999
>>> int_to_roman(-1)
Traceback (most ... |
macarico/base.py | bgalbraith/macarico | 121 | 11060213 | from __future__ import division, generators, print_function
import sys
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.autograd import Variable as Var
if True:
# check version
vers = torch.__version__.split('.')
major = int(vers[0])
minor = int(vers[1])
assert... |
web_console_v2/api/fedlearner_webconsole/dataset/sparkapp/pipeline/analyzer.py | Hsy-Intel/fedlearner | 772 | 11060279 | # Copyright 2021 The FedLearner 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... |
docs/labs/lab03/notebook/solutions/best_fit_line_scratch.py | lingcog/2019-CS109A | 442 | 11060316 | <reponame>lingcog/2019-CS109A
def best_fit_line_scratch(x, y, b0, b1, title):
# font size
f_size = 18
best_fit = b0 + b1 * x
# make the figure
fig, ax = plt.subplots(1,1, figsize=(8,5)) # Create figure object
# set axes limits to make the scale nice
ax.set_xlim(np.min(x), np.max(x... |
example/my_tasks/data_prepare.py | 12860/dlflow | 156 | 11060389 | from dlflow.utils.sparkapp import SparkBaseApp
from dlflow.mgr import task, config
from dlflow.tasks import TaskNode
from pathlib import Path
from absl import logging
import pandas as pd
import requests
_HDFS_FEATURE_DIR = "$HDFS_WORKSPACE/features/TAG=$FEATURE_TAG" \
"/<dt=$FEATURE_DATE:yyyy/mm/... |
nider/mixins/__init__.py | rockykitamura/nider | 123 | 11060393 | <filename>nider/mixins/__init__.py
from .img_components_mixins import AlignMixin
from .text_mixins import MultilineTextMixin
|
imgviz/data/__init__.py | penguinflys/imgviz | 171 | 11060417 | # flake8: noqa
from .arc2017 import arc2017
from .kitti import kitti_odometry
from .lena import lena
from .middlebury import middlebury
from .voc import voc
|
python/example_code/kinesis/streams/dg_stockticker.py | iconara/aws-doc-sdk-examples | 5,166 | 11060449 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Purpose
Shows how to use the AWS SDK for Python (Boto3) with the Amazon Kinesis API to
generate a data stream. This script generates data for several of the _Windows
and Aggregation_ examples in the Amazon K... |
myia/operations/prim_scalar_tanh.py | strint/myia | 222 | 11060455 | """Definitions for the primitive `scalar_tanh`."""
import math
from ..lib import (
UniformPrimitiveInferrer,
assert_scalar,
bprop_to_grad_transform,
)
from ..xtype import Number
from . import primitives as P
def pyimpl_scalar_tanh(x: Number) -> Number:
"""Implement `scalar_tanh`."""
assert_scala... |
restrain_jit/cpy_compat.py | thautwarm/restrain-jit | 116 | 11060460 | import sys
import types
from restrain_jit.abs_compiler import instrnames as InstrNames
from bytecode import Bytecode, Instr
from importlib import _bootstrap
from importlib._bootstrap import ModuleSpec
from importlib.abc import Loader
from contextlib import contextmanager
from importlib._bootstrap_external import PathFi... |
PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonPhotons_cff.py | ckamtsikis/cmssw | 852 | 11060480 | import FWCore.ParameterSet.Config as cms
from PhysicsTools.PatAlgos.producersLayer1.photonProducer_cff import *
# (must be decleared after PAT sequence Yen-Jie)
from RecoHI.HiEgammaAlgos.HiEgammaIsolation_cff import *
makeHeavyIonPhotons = cms.Sequence(
# reco pre-production
hiEgammaIsolationSequence *
pa... |
test/run/t431.py | timmartin/skulpt | 2,671 | 11060511 | print "\nSTRINGS"
s = 'hello'
print ('h' in s) == True
print ('H' in s) == False
print ('e' not in s) == False
print ('L' not in s) == True
print ('hello' + ' world') == 'hello world'
print 'a'*3 == 'aaa'
print 2*'hello' == 'hellohello'
s = '01234'
print s[4] == '4'
print s[-1] == '4'
print s[0:3] == s[:3] == s[None:3]... |
Utils/data_downloaders.py | arafin-lab/model_inversion_experiments | 101 | 11060543 | import os, shutil
import urllib.request
import zipfile
import tarfile
# For LibriSpeech download
import codecs
import fnmatch
import requests
import subprocess
import unicodedata
from tensorflow.python.platform import gfile
def get_tiny_imagenet(datasets_dir):
if os.path.isdir(os.path.join(datasets_dir,'ti... |
libs/detectors/x86/detector.py | AlexRogalskiy/smart-social-distancing | 113 | 11060544 | <gh_stars>100-1000
from libs.detectors.utils.ml_model_functions import get_model_json_file_or_return_default_values
class Detector:
"""
Detector class is a high level class for detecting object using x86 devices.
When an instance of the Detector is created you can call inference method and feed your
i... |
crawler/code_base/crawler-0.5.4/build/lib/crawler/messaging.py | gaybro8777/CiteSeerX | 108 | 11060553 | #!/usr/bin/env python
import sys
import pickle
import datetime
from threading import Thread
from Queue import Empty
import logging
import stomp
class Message(object):
def __init__(self):
self.info = ""
self.time_stamp = datetime.datetime.now()
def __str__(self):
return "[%s]... |
speakeasy/winenv/api/kernelmode/ndis.py | dtrizna/speakeasy | 816 | 11060603 | <gh_stars>100-1000
# Copyright (C) 2020 FireEye, Inc. All Rights Reserved.
import speakeasy.winenv.defs.nt.ddk as ddk
import speakeasy.winenv.defs.nt.ntoskrnl as nt
import speakeasy.winenv.defs.ndis.ndis as ndis
from .. import api
NDIS_STATUS_FAILURE = 0xC0000001
NDIS_STATUS_SUCCESS = 0x00000000
NDIS_STATUS_RESOUR... |
tests/__init__.py | ruinernin/trakt.py | 147 | 11060609 | from __future__ import absolute_import, division, print_function
from trakt import Trakt
import logging
# Enable DEBUG Logging
logging.basicConfig(level=logging.DEBUG)
# Setup client defaults
Trakt.configuration.defaults.client(
id='mock-client_id',
secret='mock-client_secret'
)
|
common/src/stack/probepal/pylib/probe_sles_11_12.py | kmcm0/stacki | 123 | 11060657 | import pathlib
from stack.probepal.common import PalletInfo, Probe
class SLES_11_12_Probe(Probe):
'''
This prober is intended to look for and parse a `content` file which indicates a sles11/12 pallet.
The contents of such a file look like this, though the keys change between sles11 and 12:
CONTENTSTYLE 11
... |
examples/integrations/sklearn/k_means_clustering.py | anukaal/opytimizer | 528 | 11060677 | import numpy as np
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.datasets import load_digits
from opytimizer import Opytimizer
from opytimizer.core import Function
from opytimizer.optimizers.swarm import PSO
from opytimizer.spaces import SearchSpace
# Loads digits dataset
digits = load_d... |
ch09/book.py | ricjuanflores/practice-of-the-python | 319 | 11060681 | <filename>ch09/book.py
import warnings
# Initial version
class Book:
def __init__(self, data):
self.title = data['title'] # <1>
self.subtitle = data['subtitle']
if self.title and self.subtitle: # <2>
self.display_title = f'{self.title}: {self.subtitle}'
elif self.tit... |
2021/CVE-2021-37678/vultarget/src/CreateExampleModel.py | hjyuan/reapoc | 421 | 11060685 | import tensorflow as tf
print('Se carga un set de datos que Google da como ejemplo para clasificación de imágenes\n\n')
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
print('\n\nSe crea un modelo de ML con una red neuronal p... |
addons/Sprytile-6b68d00/rx/linq/observable/partition.py | trisadmeslek/V-Sekai-Blender-tools | 733 | 11060727 | <reponame>trisadmeslek/V-Sekai-Blender-tools
from rx import Observable
from rx.internal import extensionmethod
from rx.internal.utils import adapt_call
@extensionmethod(Observable)
def partition(self, predicate):
"""Returns two observables which partition the observations of the
source by the given function. ... |
python-threatexchange/tests/test_common.py | b-bold/ThreatExchange | 997 | 11060793 | <reponame>b-bold/ThreatExchange
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import threatexchange.common
class TestCommon(unittest.TestCase):
def test_camel_case_to_underscore(self):
assert threatexchange.common.camel_case_to_underscore("AbcXyz") == "abc_xyz"
|
elex/api/__init__.py | jameswilkerson/elex | 183 | 11060838 | from .models import (
APElection,
Candidate,
BallotMeasure,
CandidateReportingUnit,
ReportingUnit,
Race,
Elections,
Election
)
from .delegates import (
CandidateDelegateReport,
DelegateReport
)
from .trends import (
BaseTrendReport,
USGovernorTrendReport,
USSenateTren... |
jorldy/test/manager/test_metric_manager.py | zenoengine/JORLDY | 300 | 11060845 | from manager.metric_manager import MetricManager
def test_metric_manager():
metric_manager = MetricManager()
mock_results = [
{
"mock_metric1": 1.0,
"mock_metric2": 2.0,
},
{
"mock_metric1": 1.0,
"mock_metric2": 2.0,
},
{... |
messaging/filters.py | maznu/peering-manager | 127 | 11060877 | <filename>messaging/filters.py
import django_filters
from django.db.models import Q
from messaging.models import Contact, ContactAssignment, ContactRole, Email
from utils.filters import (
BaseFilterSet,
ContentTypeFilter,
CreatedUpdatedFilterSet,
NameSlugSearchFilterSet,
TagFilter,
)
__all__ = ("C... |
pylearn2/utils/tests/test_utlc.py | ikervazquezlopez/Pylearn2 | 2,045 | 11060896 | # Right now this file just tests that the utlc module can be imported
from pylearn2.utils import utlc
|
labgraph/zmq_node/tests/test_zmq_node.py | Yunusbcr/labgraph | 124 | 11060915 | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import asyncio
import os
import time
from multiprocessing import Process
from typing import List, Sequence
import pytest
import zmq
from ...graphs import (
AsyncPublisher,
Config,
Connections,
Graph,
Module,
Node,
... |
apps/bible/utils/choices.py | goztrk/django-htk | 206 | 11060926 | # Python Standard Library Imports
# HTK Imports
from htk.utils.enums import get_enum_choices
def get_bible_book_choices():
from htk.apps.bible.enums import BibleTestament
choices = get_enum_choices(BibleTestament)
return choices
|
dbReports/iondb/security/api.py | konradotto/TS | 125 | 11060972 | <filename>dbReports/iondb/security/api.py
# Copyright (C) 2017 Ion Torrent Systems, Inc. All Rights Reserved
import logging
from iondb.rundb.authn import IonAuthentication
from iondb.security.models import SecureString
from tastypie import fields
from tastypie.http import HttpApplicationError
from tastypie.resources im... |
tools/nsp_scripts/fix_model_args.py | ali-senguel/fairo | 669 | 11061000 | import pickle
"""
Set the args paths to relative to droidlet root in serialized args
for loading semantic parsing models.
"""
model_args_path = (
"../../droidlet/artifacts/models/nlu/ttad_bert_updated/caip_test_model_args.pk"
)
model_args = pickle.load(open(model_args_path, "rb"))
print(model_args)
model_args.da... |
octavia/tests/unit/cmd/test_interface.py | zhangi/octavia | 129 | 11061014 | # Copyright 2021 Red Hat, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
doc/basic_example.py | MidtownFellowship/libsaas | 155 | 11061017 | from __future__ import print_function
from libsaas.services import github
# use basic authentication to create a token for libsaas
basic = github.GitHub('<EMAIL>', '<PASSWORD>')
auth = basic.authorizations().create({'scopes': 'repo,gist',
'note': 'libsaas example'})
# use token... |
PR_BCI_team/Team_StarLab/DKHan/examples/eeg_dg/main_analysis.py | PatternRecognition/OpenBMI | 217 | 11061033 | import sys
sys.path.append('../')
from torch.utils.data import Dataset
import os
import argparse
import models
from train_eval import *
import utils
import torch.cuda
import hyperparameter as hp
def exp(args,fold_idx, train_set,valid_set, test_set):
path = args.save_root + args.result_dir
seed =args.seed
... |
tests/test_service/test_cov_bv.py | amih90/bacpypes | 240 | 11061063 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test Binary Value COV Services
------------------------------
"""
import unittest
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
from bacpypes.apdu import (
SubscribeCOVRequest, SimpleAckPDU,
ConfirmedCOVNotificationRequest, UnconfirmedCOVNo... |
diffrax/misc/misc.py | FedericoV/diffrax | 377 | 11061117 | <gh_stars>100-1000
import typing
from typing import Optional, Tuple
import jax
import jax.flatten_util as fu
import jax.lax as lax
import jax.numpy as jnp
from ..custom_types import Array, PyTree, Scalar
_itemsize_kind_type = {
(1, "i"): jnp.int8,
(2, "i"): jnp.int16,
(4, "i"): jnp.int32,
(8, "i"): ... |
defplorex/transformer/__init__.py | trendmicro/defplorex | 120 | 11061120 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Trend Micro Incorporated
# 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. Redistributions of source code must retain the abo... |
gradsflow/callbacks/wandb.py | arvindmuralie77/gradsflow | 253 | 11061138 | # Copyright (c) 2022 GradsFlow. 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 ... |
src/textureoptim/optim.py | hjwdzh/AdversarialTexture | 146 | 11061203 | <filename>src/textureoptim/optim.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
import argparse
import glob
import cv2
import numpy as np
import pickle
import random
import colle... |
jax_verify/src/ibp.py | lberrada/jax_verify | 109 | 11061216 | <filename>jax_verify/src/ibp.py
# coding=utf-8
# Copyright 2021 The jax_verify 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
#
# ... |
third_party/gsutil/third_party/apitools/samples/fusiontables_sample/fusiontables_v1/fusiontables_v1.py | tingshao/catapult | 2,151 | 11061244 | <gh_stars>1000+
#!/usr/bin/env python
"""CLI for fusiontables, version v1."""
# NOTE: This file is autogenerated and should not be edited by hand.
import code
import os
import platform
import sys
from apitools.base.protorpclite import message_types
from apitools.base.protorpclite import messages
from google.apputils... |
tapas/retrieval/tfidf_baseline_utils.py | Martin36/tapas | 816 | 11061256 | <reponame>Martin36/tapas
# coding=utf-8
# Copyright 2019 The Google AI Language Team 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.... |
veriloggen/thread/pool.py | akmaru/veriloggen | 232 | 11061283 | from __future__ import absolute_import
from __future__ import print_function
import os
import sys
import veriloggen.core.vtypes as vtypes
from veriloggen.fsm.fsm import FSM
from .thread import Thread
def to_thread_pool(*threads):
if not threads:
raise ValueError('no thread specified.')
if len(threa... |
algorithms/mini-max-sum.py | gajubadge11/HackerRank-1 | 340 | 11061291 | #!/bin/python3
# stupid O(n^2) algorithm
import math
import sys
def miniMaxSum(arr):
sum_min = math.inf
sum_max = -math.inf
sum_temp = 0
for exclude in range(len(arr)):
sum_temp = 0
for ind, elem in enumerate(arr):
if ind == exclude:
continue
... |
checkov/terraform/checks/resource/aws/DBInstanceLogging.py | niradler/checkov | 4,013 | 11061304 | <filename>checkov/terraform/checks/resource/aws/DBInstanceLogging.py
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck
from typing import Any
from checkov.common.models.consts import ANY_VALUE
class DBIns... |
kythe/go/test/tools/empty_corpus_checker/empty_corpus_test.bzl | wcalandro/kythe | 1,168 | 11061305 | <filename>kythe/go/test/tools/empty_corpus_checker/empty_corpus_test.bzl
def empty_corpus_test(name, entries, allowed_corpora = []):
"""Instantiates a test that ensures all vnames in `entries` have a non-empty corpus."""
args = ["$(location %s)" % entries]
if len(allowed_corpora) > 0:
args.append("... |
test/test_demultiplex.py | khourhin/sequana | 138 | 11061312 | <reponame>khourhin/sequana<filename>test/test_demultiplex.py<gh_stars>100-1000
from sequana.demultiplex import StatsFile
from sequana import sequana_data
from easydev import TempFile
import os
def test_stats_file():
data = sequana_data("test_demultiplex_Stats.json")
s = StatsFile(data)
with TempFile() as ... |
rlpy/Agents/__init__.py | okkhoy/rlpy | 265 | 11061329 | <reponame>okkhoy/rlpy
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .TDControlAgent import Q_Learning, SARSA
# for compatibility of old scrip... |
alg/pategan/data_generator.py | DaraOrange/mlforhealthlabpub | 171 | 11061358 | """PATE-GAN: Generating Synthetic Data with Differential Privacy Guarantees Codebase.
Reference: <NAME>, <NAME>, <NAME>,
"PATE-GAN: Generating Synthetic Data with Differential Privacy Guarantees,"
International Conference on Learning Representations (ICLR), 2019.
Paper link: https://openreview.net/forum?id=S1zk9iRqF... |
diagrams/openstack/packaging.py | kenichiro-kimura/diagrams | 17,037 | 11061369 | <reponame>kenichiro-kimura/diagrams
# This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OpenStack
class _Packaging(_OpenStack):
_type = "packaging"
_icon_dir = "resources/openstack/packaging"
class LOCI(_Packaging):
_icon = "loci.png"
class Puppet(_Packaging):
_ico... |
networks/encoders/mobilenetv3.py | yoxu515/aot-benchmark | 105 | 11061382 | """
Creates a MobileNetV3 Model as defined in:
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>. (2019).
Searching for MobileNetV3
arXiv preprint arXiv:1905.02244.
"""
import torch.nn as nn
import math
from utils.learning import freeze_params
def _make_divisible(v, divis... |
tests_integration/test_minilib.py | timgates42/paver | 270 | 11061383 | <reponame>timgates42/paver<filename>tests_integration/test_minilib.py
from unittest2 import TestCase
from os import chdir, getcwd, pardir, environ
from os.path import join, dirname, exists
from shutil import rmtree, copyfile
from subprocess import check_call, PIPE, STDOUT, CalledProcessError
import sys
from zipfile im... |
Project 14 -- Deep Cardiac Segmentation/tests/test_dataset.py | Vauke/Deep-Neural-Networks-HealthCare | 274 | 11061396 | from __future__ import division, print_function
import unittest
import numpy as np
from rvseg import dataset
class TestDataset(unittest.TestCase):
def test_generator(self):
self._test_generator(mask='inner')
self._test_generator(mask='outer')
self._test_generator(mask='both')
def tes... |
odin/handlers/execution_handler/abstract_execution_handler.py | gsamarakoon/Odin | 103 | 11061504 | from abc import ABCMeta, abstractmethod
class AbstractExecutionHandler(object):
"""Abstract Execution Handler Class
The execution handler abstract class handles the interaction between a set
of order objects generated by a portfolio and the ultimate set of fill
objects that actually occur in the mar... |
src/jazzit/__init__.py | Sangarshanan/lmao | 719 | 11061567 | <gh_stars>100-1000
from .utils import _in_notebook
_in_notebook = _in_notebook()
if _in_notebook:
from .jupyter.magic import JupyterJazz
def load_ipython_extension(ipython):
ipython.register_magics(JupyterJazz)
from .jazz import WaitingTrack as waiting_track # noqa
from .jazz import ErrorTrack as ... |
tests/test_sortedsets.py | ShadowJonathan/txredisapi | 104 | 11061570 | <gh_stars>100-1000
# coding: utf-8
# Copyright 2009 <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 law... |
tests/test_simple_program.py | asnt/moderngl | 916 | 11061573 | <reponame>asnt/moderngl
import unittest
import moderngl
from common import get_context
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.ctx = get_context()
cls.vertex_shader = '''
#version 330
uniform mat4 Mvp;
in vec4 vertex;
... |
pajbot/modules/clr_overlay/showemote.py | JoachimFlottorp/pajbot | 128 | 11061575 | <reponame>JoachimFlottorp/pajbot
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Optional, Set
import logging
from pajbot.models.command import Command, CommandExample
from pajbot.modules import BaseModule, ModuleSetting
from pajbot.modules.clr_overlay import CLROverlayModule
if TYPE... |
backend/test/integration/test_profiles.py | restato/bunnybook | 131 | 11061587 | <filename>backend/test/integration/test_profiles.py
import pytest
from test.integration.utils import send_friendship_request, get_relationship, \
cancel_outgoing_friend_request, accept_friendship_request, remove_friend, \
reject_friendship_request, get_friends, become_friends, get_mutual_friends, \
get_fri... |
PhysicsTools/PatAlgos/python/recoLayer0/metCorrections_cff.py | ckamtsikis/cmssw | 852 | 11061588 | <filename>PhysicsTools/PatAlgos/python/recoLayer0/metCorrections_cff.py
import FWCore.ParameterSet.Config as cms
#from PhysicsTools.PatAlgos.recoLayer0.jetCorrFactors_cfi import *
from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import *
from JetMETCorrections.Type1MET.correctionTermsCaloMet_cff impo... |
neuralhydrology/modelzoo/basemodel.py | DavidChoi76/neuralhydrology | 144 | 11061601 | <gh_stars>100-1000
from typing import Dict, Optional, Callable
import torch
import torch.nn as nn
from neuralhydrology.utils.config import Config
from neuralhydrology.utils.samplingutils import sample_pointpredictions
class BaseModel(nn.Module):
"""Abstract base model class, don't use this class for model train... |
seldom/utils/send_extend.py | defnngj/pyse | 250 | 11061696 | from XTestRunner import SMTP as XSMTP
from XTestRunner import DingTalk as XDingTalk
from seldom.running.config import BrowserConfig
from seldom.utils import file
class SMTP(XSMTP):
def sendmail(self, to, subject=None, attachments=None, delete=False):
"""
seldom send email
:param to:
... |
tlshCluster/pylib/printCluster.py | pombredanne/tlsh | 557 | 11061720 | <filename>tlshCluster/pylib/printCluster.py
#################################################################
# TLSH is provided for use under two licenses: Apache OR BSD. Users may opt to use either license depending on the license
# restictions of the systems with which they plan to integrate the TLSH code.
#
# Apach... |
src/api/dcps/python/test/TestStringTypes.py | brezillon/opensplice | 133 | 11061741 | #
# Vortex OpenSplice
#
# This software and documentation are Copyright 2006 to TO_YEAR ADLINK
# Technology Limited, its affiliated companies and licensors. All rights
# reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... |
src/Quadruped/Core/kinematics.py | chinmaynehate/Venom | 157 | 11061743 | import sys
sys.path.insert(0, "..")
import numpy as np
import constants as k
import math
def getInverse(x,y,z):
l1 = k.linkLength[0] #5.5
l01= k.linkLength[1] #0
l2 = k.linkLength[2] #~
l3 = k.linkLength[3] #~
r1 = l01
r2 = l2
r3 = l3
z+=l1 #Shift of Origin
#p... |
src/module/attention/dot_attention.py | PirateX0/MAMS-for-ABSA | 203 | 11061775 | <filename>src/module/attention/dot_attention.py
from src.module.attention.attention import Attention
class DotAttention(Attention):
def __init__(self, dropout=0):
super(DotAttention, self).__init__(dropout)
def _score(self, query, key):
"""
query: FloatTensor (batch_size, num_queries,... |
contrib/python/tests/test_cubrid.py | eido5/cubrid | 253 | 11061790 | <reponame>eido5/cubrid<gh_stars>100-1000
import unittest
import _cubrid
from _cubrid import *
import time
class DatabaseTest(unittest.TestCase):
driver = _cubrid
connect_args = ('CUBRID:localhost:33000:demodb:::', 'public', '')
connect_kw_args = {}
def setUp(self):
pass
def t... |
Python/PartitionList.py | TonnyL/Windary | 205 | 11061798 | <filename>Python/PartitionList.py
# Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.
#
# You should preserve the original relative order of the nodes in each of the two partitions.
#
# For example,
# Given 1->4->3->2->5->2 and x = 3,
# return ... |
tests/test_simple_framebuffer.py | asnt/moderngl | 916 | 11061839 | <reponame>asnt/moderngl
import unittest
import moderngl
from common import get_context
class TestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.ctx = get_context()
cls.max_samples = cls.ctx.info['GL_MAX_SAMPLES']
def test_framebuffer_color_attachment(self):
rbo ... |
utils/envs/gridenv.py | davidwitten/rl-agents | 342 | 11061840 | <reponame>davidwitten/rl-agents
import numpy as np
from gym import Env, spaces
from gym.envs.registration import register
from gym.utils import seeding
class GridEnv(Env):
REWARD_CENTER = [10, 10]
REWARD_RADIUS = 5
config = {
"use_diagonals": False,
"stochasticity": 0
}
def __ini... |
deepneuro/postprocessing/statistics.py | ysuter/DeepNeuro | 113 | 11061843 | <filename>deepneuro/postprocessing/statistics.py
import csv
import numpy as np
from skimage.measure import label
from deepneuro.postprocessing.postprocessor import Postprocessor
from deepneuro.utilities.util import add_parameter
class ErrorCalculation(Postprocessor):
def load(self, kwargs):
# Naming p... |
clusterman/exceptions.py | akshaysharma096/clusterman | 281 | 11061874 | <reponame>akshaysharma096/clusterman<filename>clusterman/exceptions.py
# Copyright 2019 Yelp 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/LICENS... |
packages/pyright-internal/src/tests/samples/loops14.py | martindemello/pyright | 4,391 | 11061886 | <reponame>martindemello/pyright
# This sample tests a loop that modifies a variable through type narrowing.
from typing import Literal, Union
class State:
def confirm_dialog(self) -> Union["State", bool]:
return False
state = State()
t0: Literal["State"] = reveal_type(state)
for _ in range(1):
res... |
pyGeno/tools/SecureMmap.py | ealong/pyGeno | 309 | 11061926 | <gh_stars>100-1000
import mmap
class SecureMmap:
"""In a normal mmap, modifying the string modifies the file. This is a mmap with write protection"""
def __init__(self, filename, enableWrite = False) :
self.enableWrite = enableWrite
self.filename = filename
self.name = filename
f = open(filename, 'r+... |
tests/test_partitioning.py | lumaku/ctc-segmentation | 157 | 11061938 | <reponame>lumaku/ctc-segmentation
#!/usr/bin/env false
# encoding: utf-8
# Copyright 2020, Technische Universität München; <NAME>
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Test functions for partitioning helper functions."""
from ctc_segmentation import get_partitions
def test_get_partitions()... |
atlas/foundations_internal/src/test/test_staged_module_internal_loader.py | DeepLearnI/atlas | 296 | 11062009 | <gh_stars>100-1000
import unittest
from foundations_internal.staged_module_internal_loader import StagedModuleInternalLoader
from foundations.stage_connector_wrapper import StageConnectorWrapper
class TestStagedModuleInternalLoader(unittest.TestCase):
class MockModule(object):
def __init__(self):
... |
migration/migrator/migrations/system/20180628235136_course_args.py | elihschiff/Submitty | 411 | 11062057 | from pathlib import Path
def _replace(install_path, old, new):
installed_migrations = install_path / 'migrations' / 'course'
if installed_migrations.is_dir():
for entry in installed_migrations.iterdir():
if entry.is_dir() or not entry.name.endswith('.py'):
continue
... |
xam/preprocessing/binning/equal_frequency.py | topolphukhanh/xam | 357 | 11062068 | <gh_stars>100-1000
"""
Equal frequency binning
"""
import numpy as np
from sklearn.utils import check_array
from .base import BaseUnsupervisedBinner
class EqualFrequencyBinner(BaseUnsupervisedBinner):
def __init__(self, n_bins=5):
super().__init__()
# Properties
self.n_bins = n_bins
... |
Dragon/python/dragon/vm/tensorflow/ops/control_flow_ops.py | neopenx/Dragon | 212 | 11062070 | <reponame>neopenx/Dragon<filename>Dragon/python/dragon/vm/tensorflow/ops/control_flow_ops.py
# --------------------------------------------------------
# TensorFlow for Dragon
# Copyright(c) 2017 SeetaTech
# Written by <NAME>
# --------------------------------------------------------
__all__ = ['equal']
import dragon... |
book/graphs/word_ladder_test.py | Web-Dev-Collaborative/algos | 153 | 11062074 | <reponame>Web-Dev-Collaborative/algos
import unittest
from word_ladder import traverse, word_graph
class TestCorrectness(unittest.TestCase):
def assert_path_to_find_word(self, from_word, to_word, expected_path):
for word, path in traverse(word_graph, from_word):
if expected_path:
... |
src/gui.py | albertz/music-player | 132 | 11062120 | # MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2012, <NAME>, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
from __future__ import print_function
import appinfo
from TaskSystem import do_in_mainthread
im... |
envi/ieee754.py | rnui2k/vivisect | 716 | 11062131 | <reponame>rnui2k/vivisect<filename>envi/ieee754.py
import math
import envi.exc as e_exc
# tuples of (Exponent bitlen, Exponent Bias)
ieee754_formats = {
16: (5, 0xF),
32: (8, 0x7F),
64: (11, 0x3FF),
80: (15, 0x3FFF), # non-implicit j bit
# At least on intel, don't go beyond 80 bits (even that'... |
threatbus/backbonespecs.py | GTrunSec/threatbus | 212 | 11062162 | <reponame>GTrunSec/threatbus<gh_stars>100-1000
from dynaconf import Validator
from dynaconf.utils.boxing import DynaBox
from multiprocessing import JoinableQueue
import pluggy
from typing import List
hookspec = pluggy.HookspecMarker("threatbus.backbone")
@hookspec
def run(config: DynaBox, logging: DynaBox, inq: Join... |
gaphor/ui/tests/test_elementeditor.py | MartinIIOT/gaphor | 867 | 11062166 | <reponame>MartinIIOT/gaphor
import pytest
from gaphor.ui.elementeditor import ElementEditor
class DiagramsStub:
def get_current_view(self):
return None
@pytest.fixture
def diagrams():
return DiagramsStub()
class DummyProperties(dict):
def set(self, key, val):
self[key] = val
def tes... |
px/px_process.py | walles/px | 149 | 11062174 | import logging
import datetime
import operator
import os
import re
import pwd
import six
import errno
import subprocess
import dateutil.tz
from . import px_commandline
from . import px_exec_util
import sys
if sys.version_info.major >= 3:
# For mypy PEP-484 static typing validation
from typing import Dict ... |
orator/orm/relations/__init__.py | vimox-shah/orator-repo-0.9v | 1,484 | 11062176 | # -*- coding: utf-8 -*-
from .relation import Relation
from .has_one import HasOne
from .has_many import HasMany
from .belongs_to import BelongsTo
from .belongs_to_many import BelongsToMany
from .has_many_through import HasManyThrough
from .morph_one import MorphOne
from .morph_many import MorphMany
from .morph_to imp... |
src/gamesbyexample/barca.py | spp2/PythonStdioGames | 736 | 11062193 | """Barca, by <NAME> <EMAIL>
A chess-variant where each player's mice, lions, and elephants try to
occupy the watering holes near the center of the board.
Barca was invented by <NAME> http://playbarca.com
More info at https://en.wikipedia.org/wiki/Barca_(board_game)
"""
import sys
# Set up the constants:
SQUARE_PLAYE... |
mode/examples/Topics/File IO/LoadFile1/LoadFile1.pyde | timgates42/processing.py | 1,224 | 11062242 | <reponame>timgates42/processing.py<gh_stars>1000+
"""
LoadFile 1
Loads a text file that contains two numbers separated by a tab ('\t').
A new pair of numbers is loaded each frame and used to draw a point on the screen.
"""
index = 0
def setup():
global lines
size(200, 200)
background(0)
stroke(255)
... |
voctogui/lib/audioleveldisplay.py | 0xflotus/voctomix | 521 | 11062249 | import math
import cairo
from gi.repository import Gtk, GLib
class AudioLevelDisplay(Gtk.DrawingArea):
"""Displays a Level-Meter of another VideoDisplay into a GtkWidget"""
__gtype_name__ = 'AudioLevelDisplay'
MARGIN = 4
CHANNEL_WIDTH = 8
LABEL_WIDTH = 20
def __init__(self):
self.le... |
python/interpret_community/adapter/__init__.py | gaugup/interpret-community | 338 | 11062271 | <filename>python/interpret_community/adapter/__init__.py
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
"""Defines adapters for converting feature importance values to an explanation."""... |
encoder/abcnn.py | zhufz/nlp_research | 160 | 11062274 | #-*- coding:utf-8 -*-
import tensorflow as tf
import numpy as np
import pdb
from common.layers import get_initializer
from encoder import EncoderBase
import copy
#refer:https://github.com/galsang/ABCNN/blob/master/ABCNN.py
class ABCNN(EncoderBase):
def __init__(self, **kwargs):
"""
Implmenentaion ... |
openmdao/visualization/n2_viewer/tests/gui_test_models/double_sellar.py | friedenhe/OpenMDAO | 451 | 11062357 | <filename>openmdao/visualization/n2_viewer/tests/gui_test_models/double_sellar.py
import openmdao.api as om
from openmdao.test_suite.components.double_sellar import DoubleSellar
prob = om.Problem()
model = prob.model = DoubleSellar()
# each SubSellar group converges itself
g1 = model.g1
g1.nonlinear_solver = om.Newto... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.