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 |
|---|---|---|---|---|
hail/python/test/hail/expr/test_functions.py | tdeboer-ilmn/hail | 789 | 12605287 | import hail as hl
import scipy.stats as spst
import pytest
def test_deprecated_binom_test():
assert hl.eval(hl.binom_test(2, 10, 0.5, 'two.sided')) == \
pytest.approx(spst.binom_test(2, 10, 0.5, 'two-sided'))
def test_binom_test():
arglists = [[2, 10, 0.5, 'two-sided'],
[4, 10, 0.5, ... |
ltr/helpers/ranklib_result.py | tanjie123/hello-ltr | 109 | 12605296 |
import re
class RanklibResult:
""" A result of ranklib training, either for a
single training operation
(where trainingLogs is just set, and has a single item)
or k-folds cross validation
(where the foldResults/kcv are set; with a result for
each fold that is run """
... |
tools/compute_bottleneck.py | agarwalutkarsh554/dataset | 4,359 | 12605309 | #!/usr/bin/env python
#
# Copyright 2016 The Open Images 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
#
# U... |
singleton__using_abc.py | DazEB2/SimplePyScripts | 117 | 12605326 | <filename>singleton__using_abc.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: https://stackoverflow.com/a/39186313/5909792
from abc import ABC
def singleton(real_cls):
class SingletonFactory(ABC):
instance = None
def __new__(cls, *args, **kwargs):
... |
bambi/priors/__init__.py | yannmclatchie/bambi | 793 | 12605338 | <gh_stars>100-1000
"""Classes to represent prior distributions and methods to set automatic priors"""
from .prior import Prior
from .scaler_mle import PriorScalerMLE
from .scaler_default import PriorScaler
__all__ = [
"Prior",
"PriorScaler",
"PriorScalerMLE",
]
|
toad/nn/trainer/history_test.py | brianWeng0223/toad | 325 | 12605387 | import torch
import numpy as np
from .history import History
def test_history_log():
history = History()
for i in range(10):
history.log('tensor', torch.rand(3, 5))
assert history['tensor'].shape == (30, 5)
|
tests/test_timeline_clock.py | rvega/isobar | 241 | 12605397 | <reponame>rvega/isobar<filename>tests/test_timeline_clock.py<gh_stars>100-1000
""" Unit tests for isobar """
import isobar as iso
import pytest
import time
def test_timeline_clock_accuracy():
#--------------------------------------------------------------------------------
# 480 ticks per beat @ 125bpm = 1 ti... |
tools/third_party/html5lib/html5lib/tests/test_encoding.py | meyerweb/wpt | 2,479 | 12605466 | <filename>tools/third_party/html5lib/html5lib/tests/test_encoding.py
from __future__ import absolute_import, division, unicode_literals
import os
import pytest
from .support import get_data_files, test_dir, errorMessage, TestData as _TestData
from html5lib import HTMLParser, _inputstream
def test_basic_prescan_len... |
kivymd/tools/packaging/pyinstaller/__init__.py | ibrahimcetin/KivyMD | 1,111 | 12605478 | <gh_stars>1000+
"""
PyInstaller hooks
=================
Add ``hookspath=[kivymd.hooks_path]`` to your .spec file.
Example of .spec file
=====================
.. code-block:: python
# -*- mode: python ; coding: utf-8 -*-
import sys
import os
from kivy_deps import sdl2, glew
from kivymd import ... |
flametree/DiskFileManager.py | Edinburgh-Genome-Foundry/Flametree | 165 | 12605483 | import os
import shutil
class DiskFileManager:
"""Reader and Writer for disk files.
target
A directory on the disk. If it doesn't exist, it will be created.
replace
If the ``target`` directory exists, should it be completely replaced
or simply appended to ?
"""
def __init__(s... |
pymagnitude/third_party/allennlp/modules/seq2seq_encoders/pass_through_encoder.py | tpeng/magnitude | 1,520 | 12605487 | <filename>pymagnitude/third_party/allennlp/modules/seq2seq_encoders/pass_through_encoder.py
from __future__ import absolute_import
#overrides
import torch
from allennlp.modules.seq2seq_encoders.seq2seq_encoder import Seq2SeqEncoder
class PassThroughEncoder(Seq2SeqEncoder):
u"""
This class allows you to speci... |
django/contrib/messages/storage/__init__.py | pomarec/django | 285 | 12605520 | from django.conf import settings
from django.utils.module_loading import import_by_path as get_storage
# Callable with the same interface as the storage classes i.e. accepts a
# 'request' object. It is wrapped in a lambda to stop 'settings' being used at
# the module level
default_storage = lambda request: get_stor... |
recipes/Python/456362_relative_import_shortcut/recipe-456362.py | tdiprima/code | 2,023 | 12605543 | import os
import sys
def pythonImport(name):
current_path = os.path.dirname(os.path.abspath(__file__))
base_name = os.path.basename(current_path).split('.')[0]
sys.path[:] = [path for path in sys.path
if os.path.abspath(path) != os.path.abspath(current_path)]
original_module = sys.m... |
Chapter09/image_scope_demo.py | kennartfoundation/flask_10 | 173 | 12605545 | import tkinter as tk
class App(tk.Tk):
def __init__(self):
super().__init__()
tk.Label(self, image=tk.PhotoImage(file='smile.gif')).pack()
smile = tk.PhotoImage(file='smile.gif')
tk.Label(self, image=smile).pack()
self.smile = tk.PhotoImage(file='smile.gif')
tk.Label... |
cfgov/v1/management/commands/sync_image_storage.py | Colin-Seifer/consumerfinance.gov | 156 | 12605623 | from django.core.management.base import BaseCommand
from wagtail.images import get_image_model
from ._sync_storage_base import SyncStorageCommandMixin
class Command(SyncStorageCommandMixin, BaseCommand):
def get_storage_directories(self):
return ["images", "original_images"]
def get_queryset(self):... |
mmwave/tracking/gtrack_unit.py | gimac/OpenRadar | 275 | 12605634 | import numpy as np
import copy
from . import ekf_utils
gtrack_MIN_DISPERSION_ALPHA = 0.1
gtrack_EST_POINTS = 10
gtrack_MIN_POINTS_TO_UPDATE_DISPERSION = 3
gtrack_KNOWN_TARGET_POINTS_THRESHOLD = 50
# GTRACK Module calls this function to instantiate GTRACK Unit with desired configuration parameters.
# Function retur... |
testing/MLDB-1884-timestamp-consistency.py | kstepanmpmg/mldb | 665 | 12605717 | #
# MLDB-1884-timestamp-consistency.py
# <NAME>, 2016-08-12
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
from mldb import mldb, MldbUnitTest, ResponseException
class Mldb1884TimestampConsistency(MldbUnitTest): # noqa
def test_null(self):
res = mldb.get('/v1/query', q="... |
language-python-test/test/features/closures/closure_update_free_var.py | wbadart/language-python | 137 | 12605746 | def f():
x = 5
def g(y):
print (x + y)
g(1)
x = 6
g(1)
x = 7
g(1)
f()
|
challenges/8.7.Keyword_Arguments/main.py | pradeepsaiu/python-coding-challenges | 141 | 12605760 | <reponame>pradeepsaiu/python-coding-challenges<gh_stars>100-1000
def keyword_argument_example(your_age, **kwargs):
return your_age, kwargs
### Write your code below this line ###
about_me = "Replace this string with the correct function call."
### Write your code above this line ###
print(about_me)
|
tests/test_praw_scrapers/test_live_scrapers/test_utils/test_StreamGenerator.py | JosephLai241/Reddit-Scraper | 318 | 12605777 | """
Testing `StreamGenerator.py`.
"""
import os
import praw
import types
from dotenv import load_dotenv
from urs.praw_scrapers.live_scrapers.utils import StreamGenerator
class Login():
"""
Create a Reddit object with PRAW API credentials.
"""
@staticmethod
def create_reddit_object():
l... |
lib/det_opr/cascade_roi_target.py | niqbal996/CrowdDetection | 252 | 12605789 | # -*- coding: utf-8 -*-
import megengine as mge
import megengine.random as rand
import megengine.functional as F
import numpy as np
from config import config
from det_opr.utils import mask_to_inds
from det_opr.bbox_opr import box_overlap_opr, bbox_transform_opr, box_overlap_ignore_opr
def cascade_roi_targ... |
aps/sse/bss/sepformer.py | ishine/aps | 117 | 12605804 | <reponame>ishine/aps<gh_stars>100-1000
# Copyright 2021 <NAME>
# License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import torch as th
import torch.nn as nn
import torch.nn.functional as tf
from aps.transform.asr import TFTransposeTransform
from aps.asr.transformer.encoder import TransformerEncoder
from... |
visual-concepts/scripts/script_cat_annotation_files.py | wenhuchen/ethz-bootstrapped-captioner | 167 | 12605808 | <filename>visual-concepts/scripts/script_cat_annotation_files.py<gh_stars>100-1000
import json
with open('../data/captions_train2014.json', 'rt') as f:
j1 = json.load(f)
with open('../data/captions_val2014.json', 'rt') as f:
j2 = json.load(f)
assert(j1['info'] == j2['info'])
assert(j1['type'] == j2['type'])
asser... |
tests/bitcoin/test_bitcoin.py | febuiles/two1-python | 415 | 12605841 | import arrow
from calendar import timegm
from two1.bitcoin.block import Block
from two1.bitcoin.crypto import HDKey
from two1.bitcoin.crypto import HDPrivateKey
from two1.bitcoin.crypto import HDPublicKey
from two1.bitcoin.crypto import PrivateKey
from two1.bitcoin.crypto import PublicKey
from two1.bitcoin.hash import ... |
rpython/jit/backend/arm/test/test_del.py | nanjekyejoannah/pypy | 381 | 12605849 |
from rpython.jit.backend.arm.test.support import JitARMMixin
from rpython.jit.metainterp.test.test_del import DelTests
class TestDel(JitARMMixin, DelTests):
# for the individual tests see
# ====> ../../../metainterp/test/test_del.py
pass
|
release/stubs.min/Grasshopper/Kernel/Types/__init__.py | htlcnn/ironpython-stubs | 182 | 12605878 | # encoding: utf-8
# module Grasshopper.Kernel.Types calls itself Types
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# no functions
# classes
class Complex(object):
"""
Complex(rea... |
lte/gateway/python/magma/kernsnoopd/tests/byte_counter_tests.py | nstng/magma | 539 | 12605883 | """
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... |
oandapyV20-examples-master/src/instruments_list.py | cdibble2011/OANDA | 127 | 12605904 | # -*- coding: utf-8 -*-
"""retrieve the tradable instruments for account."""
import json
import oandapyV20
import oandapyV20.endpoints.accounts as accounts
from exampleauth import exampleAuth
accountID, token = exampleAuth()
client = oandapyV20.API(access_token=token)
r = accounts.AccountInstruments(accountID=accoun... |
tests/test_model.py | dgilland/sqlservice | 166 | 12605924 | from unittest import mock
import sqlalchemy as sa
from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import DeclarativeMeta
from sqlservice import as_declarative, core, declarative_base
from sqlservice.model import ModelBase, ModelMeta
from .fixtures import AModel, CModel, DModel, is_subdict, parametriz... |
eeauditor/processor/outputs/json-output.py | kbhagi/ElectricEye | 442 | 12605943 | #This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you un... |
lldb/packages/Python/lldbsuite/test/tracking.py | LaudateCorpus1/llvm-project | 765 | 12605958 | <reponame>LaudateCorpus1/llvm-project
#!/usr/bin/env python
import os
import os.path
import datetime
import re
import sys
sys.path.append(os.path.join(os.getcwd(), 'radarclient-python'))
def usage():
print "Run this from somewhere fancy"
print "Install pycurl and radarclient"
print "To install radarclient... |
5]. Projects/Desktop Development/GUI Projects/08). Scientific_Calculator/Scientific_Calculater.py | Utqrsh04/The-Complete-FAANG-Preparation | 6,969 | 12605961 | from tkinter import *
from tkinter import messagebox as tmsg
import math
import tkinter.messagebox
root = Tk()
root.title("Scientific Calculater--")
root.wm_iconbitmap("cal.ico")
root.configure(background = "powder blue")
root.geometry("495x590+40+40")
root.resizable(width=False, height=False)
calc = Frame(root)
calc... |
src/chapter-5/app.py | luizyao/pytest-chinese-doc | 283 | 12605965 | <filename>src/chapter-5/app.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
'''
Author: <NAME> (<EMAIL>)
Created Date: 2019-10-10 16:38:48
-----
Last Modified: 2019-10-10 17:04:12
Modified By: <NAME> (<EMAIL>)
-----
THIS PROGRAM IS FREE SOFTWARE, IS LICENSED UNDER MIT.
A short and simple permissive license with condi... |
office365/sharepoint/utilities/upload_status.py | rikeshtailor/Office365-REST-Python-Client | 544 | 12606036 | <reponame>rikeshtailor/Office365-REST-Python-Client
from office365.runtime.client_value import ClientValue
class UploadStatus(ClientValue):
pass
|
plans/forms.py | tejas1106/django-plans | 112 | 12606078 | <gh_stars>100-1000
from django import forms
from django.core.exceptions import ValidationError
from django.forms.widgets import HiddenInput
from django.utils.translation import gettext
from .models import BillingInfo, Order, PlanPricing
from .utils import get_country_code
class OrderForm(forms.Form):
plan_pricin... |
yotta/lib/fsutils_win.py | headlessme/yotta | 176 | 12606098 | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# !!! FIXME: this implementation uses NTFS junctions points:
# http://msdn.microsoft.com/en-gb/library/windows/desktop/aa365006%28v=vs.85%29.aspx
# These don't work when linking a non-local volume (for examp... |
featuretools/tests/plugin_tests/utils.py | ridicolos/featuretools | 942 | 12606105 | <gh_stars>100-1000
import os
import subprocess
import sys
def import_featuretools(level=None):
c = ''
if level:
c += 'import os;'
c += 'os.environ["FEATURETOOLS_LOG_LEVEL"] = "%s";' % level
c += 'import featuretools;'
return python('-c', c)
def install_featuretools_plugin():
pwd... |
indy_node/test/request_handlers/rich_schema/test_all_rich_schema_handlers.py | Rob-S/indy-node | 627 | 12606119 | import copy
import json
import random
import pytest
from indy_common.authorize.auth_constraints import AuthConstraintForbidden
from indy_common.constants import RS_ID, RS_TYPE, RS_NAME, RS_VERSION, RS_CONTENT, ENDORSER, JSON_LD_ID_FIELD, \
JSON_LD_TYPE_FIELD
from indy_node.server.request_handlers.domain_req_handl... |
tools/deploy/main.py | bopopescu/peloton | 617 | 12606221 | <reponame>bopopescu/peloton<gh_stars>100-1000
#!/usr/bin/env python
import argparse
from cluster import Cluster
def parse_args():
parser = argparse.ArgumentParser(description="Script to deploy Peloton")
parser.add_argument(
"-c",
"--config",
required=True,
help="The cluster c... |
vedastr/models/bodies/sequences/transformer/unit/attention/builder.py | csmasters/vedastr | 475 | 12606266 | <reponame>csmasters/vedastr<gh_stars>100-1000
from vedastr.utils import build_from_cfg
from .registry import TRANSFORMER_ATTENTIONS
def build_attention(cfg, default_args=None):
attention = build_from_cfg(cfg, TRANSFORMER_ATTENTIONS, default_args)
return attention
|
migrations/versions/27d55d03f753_add_count_column_upgrade_step.py | chaos-genius/chaos_genius | 320 | 12606282 | <reponame>chaos-genius/chaos_genius
"""Add Count column & upgrade step
Revision ID: 27d55d0<PASSWORD>
Revises: e<PASSWORD>
Create Date: 2022-06-08 14:29:57.525557
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2<PASSWORD>'
down_revision = 'e3<PASSWORD>'
branc... |
jarbas/core/migrations/0014_add_suspicions_and_probability_to_reimbursements.py | vbarceloscs/serenata-de-amor | 3,001 | 12606303 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-08 13:03
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0013_create_model_reimbursement'),
]... |
migrations/versions/2020_04_13_3a87adc2088b_user_statistics_tracking.py | tigerdar004/RweddingPoll | 112 | 12606333 | <gh_stars>100-1000
"""User statistics tracking
Revision ID: <KEY>
Revises: 7de7ec98049b
Create Date: 2020-04-13 22:11:20.064789
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "7de7ec98049b"
branch_labels = None
depends_on = None
def u... |
datadog_checks_tests_helper/datadog_test_libs/utils/mock_dns.py | mchelen-gov/integrations-core | 663 | 12606372 | import os
from contextlib import contextmanager
from datadog_checks.dev import run_command
@contextmanager
def mock_local(src_to_dest_mapping):
"""
Mock 'socket' to resolve hostname based on a provided mapping.
This method has no effect for e2e tests.
:param src_to_dest_mapping: Mapping from source h... |
lib/models/modules.py | sibeiyang/sgmn | 130 | 12606404 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from model_utils import NormalizeScale
class AttendRelationModule(nn.Module):
def __init__(self, dim_vis_feat, visual_init_norm, jemb_dim, dim_lang_feat, jemb_dropout):
super(AttendRelationModule, self).__init__()
... |
fabfile.py | SurvivorT/SRTP | 489 | 12606420 | #!/usr/bin/env python
#
# File: fabfile.py
#
# Created: Wednesday, August 24 2016 by rejuvyesh <<EMAIL>>
# License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html>
#
from fabric.api import cd, put, path, task, shell_env, run, env, local, settings
from fabric.contrib.project import rsync_project
import os.path
from tim... |
slick_reporting/forms.py | ryaustin/django-slick-reporting | 258 | 12606533 | from __future__ import unicode_literals
from django import forms
class OrderByForm(forms.Form):
order_by = forms.CharField(required=False)
def get_order_by(self, default_field=None):
"""
Get the order by specified by teh form or the default field if provided
:param default_field:
... |
Wenshu_Project/Wenshu/items.py | juvu/Wenshu_Spider | 197 | 12606535 | <filename>Wenshu_Project/Wenshu/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class WenshuCaseItem(scrapy.Item):
# define the fields for your item here like:
casecourt = scrapy.Fie... |
backend/www/test/update_follower_test.py | xuantan/viewfinder | 645 | 12606561 | # Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Tests update_follower method.
"""
__author__ = ['<EMAIL> (<NAME>)']
import mock
from copy import deepcopy
from viewfinder.backend.base.util import SetIfNotNone
from viewfinder.backend.db.db_client import DBKey
from viewfinder.backend.db.device import Device
f... |
src/whylogs/cli/__init__.py | cswarth/whylogs | 603 | 12606617 | <gh_stars>100-1000
from .cli import cli, main
from .demo_cli import main as demo_main
__ALL__ = [
cli,
main,
demo_main,
]
|
tests/sparseml/pytorch/utils/test_ssd_helpers.py | clementpoiret/sparseml | 922 | 12606622 | <filename>tests/sparseml/pytorch/utils/test_ssd_helpers.py
# 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:... |
django_codemod/commands.py | webstar-commit/django-boilerplate | 128 | 12606638 | from abc import ABC
from typing import List, Type
import libcst as cst
from libcst.codemod import (
CodemodContext,
ContextAwareTransformer,
VisitorBasedCodemodCommand,
)
class BaseCodemodCommand(VisitorBasedCodemodCommand, ABC):
"""Base class for our commands."""
transformers: List[Type[Context... |
eland/utils.py | szabosteve/eland | 335 | 12606658 | <filename>eland/utils.py
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "Licen... |
plugins/dbnd-airflow-export/src/dbnd_airflow_export/metrics.py | busunkim96/dbnd | 224 | 12606668 | <reponame>busunkim96/dbnd
from collections import defaultdict
from contextlib import contextmanager
from functools import wraps
from timeit import default_timer
import flask
class MetricCollector(object):
def __init__(self):
self.d = None
@contextmanager
def use_local(self):
if self.d is... |
src/encoded/tests/test_upgrade_chip_peak_enrichment_quality_metric.py | procha2/encoded | 102 | 12606679 | <reponame>procha2/encoded<filename>src/encoded/tests/test_upgrade_chip_peak_enrichment_quality_metric.py
import pytest
def test_upgrade_chip_peak_enrichment_quality_metric_1_2(upgrader, chip_peak_enrichment_quality_metric_1):
value = upgrader.upgrade(
"chip_peak_enrichment_quality_metric",
chip_pe... |
tests/test_typeclass/test_typed_dict.py | ftaebi/classes | 475 | 12606681 | import sys
import pytest
from typing_extensions import TypedDict
from classes import typeclass
if sys.version_info[:2] >= (3, 9): # noqa: C901
pytestmark = pytest.mark.skip('Only python3.7 and python3.8 are supported')
else:
class _User(TypedDict):
name: str
registered: bool
class _User... |
base_agent/stop_condition.py | kandluis/droidlet | 669 | 12606693 | <reponame>kandluis/droidlet
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
class StopCondition:
def __init__(self, agent):
self.agent = agent
def check(self) -> bool:
raise NotImplementedError("Implemented by subclass")
class NeverStopCondition(StopCondition):
def __init__(sel... |
backend/tests/data/github/auth/test_main.py | rutvikpadhiyar000/github-trends | 157 | 12606743 | import unittest
from src.constants import TEST_TOKEN as TOKEN, TEST_USER_ID as USER_ID
from src.data.github.auth.main import get_unknown_user
class TestTemplate(unittest.TestCase):
def test_get_unknown_user_valid(self):
user_id = get_unknown_user(TOKEN)
self.assertEqual(user_id, USER_ID)
def... |
rotkehlchen/chain/ethereum/modules/makerdao/__init__.py | rotkehlchenio/rotkehlchen | 137 | 12606750 | __all__ = ['MakerdaoDsr', 'MakerdaoVaults']
from .accountant import MakerdaoAccountant # noqa: F401
from .decoder import MakerdaoDecoder # noqa: F401
from .dsr import MakerdaoDsr
from .vaults import MakerdaoVaults
|
base/site-packages/captchas/fields.py | edisonlz/fastor | 285 | 12606766 | import random
from django.conf import settings
from django import forms
from django.utils.translation import ugettext as _
from captchas.widgets import CaptchaWidget
from Captcha import PersistentFactory
from factory import CacheFactory
class CaptchaField(forms.CharField):
"""
Captcha form field
Origi... |
src/analyzer/lexicon/validator_test.py | nogeeky/turkish-morphology | 157 | 12606767 | # coding=utf-8
# Copyright 2019 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
cli.py | ParikhKadam/frankenstein | 344 | 12606794 | <filename>cli.py<gh_stars>100-1000
import os, sys
from core.project import Project
from optparse import OptionParser, OptionGroup
def project_main(options, args):
p = Project(options.projectName, allow_create=options.projectCreate)
if options.deleteGroup:
p.group_delete(options.deleteGroup)
if o... |
tests/framework/ROM/TimeSeries/SyntheticHistory/TrainingData/generateFourier.py | rinelson456/raven | 159 | 12606853 | <reponame>rinelson456/raven<filename>tests/framework/ROM/TimeSeries/SyntheticHistory/TrainingData/generateFourier.py<gh_stars>100-1000
# Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... |
zentral/contrib/mdm/app_manifest.py | janheise/zentral | 634 | 12606854 | from hashlib import md5
import logging
import subprocess
from defusedxml.ElementTree import fromstring, ParseError
logger = logging.getLogger("zentral.contrib.mdm.app_manifest")
MD5_SIZE = 10 * 2**20 # 10MB
def read_distribution_info(package_file):
try:
cp = subprocess.run(["xar", "-f", package_file.... |
ufora/cumulus/test/TestBase.py | ufora/ufora | 571 | 12606855 | # Copyright 2015 Ufora 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 law or agreed to i... |
tutorials/stock-wallet/microservices/wallet/src/__init__.py | bhardwajRahul/minos-python | 247 | 12606880 | __author__ = ""
__email__ = ""
__version__ = "0.1.0"
from .aggregates import (
Ticker,
Wallet,
)
from .cli import (
main,
)
from .commands import (
WalletCommandService,
)
from .queries import (
WalletQueryService,
WalletQueryServiceRepository,
)
|
djangoerp/menus/utils.py | xarala221/django-erp | 345 | 12606908 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PART... |
spacy/lang/ja/tag_orth_map.py | snosrap/spaCy | 22,040 | 12606923 | from ...symbols import DET, PART, PRON, SPACE, X
# mapping from tag bi-gram to pos of previous token
TAG_ORTH_MAP = {
"空白": {" ": SPACE, " ": X},
"助詞-副助詞": {"たり": PART},
"連体詞": {
"あの": DET,
"かの": DET,
"この": DET,
"その": DET,
"どの": DET,
"彼の": DET,
"此の": ... |
torchnca/__init__.py | brentyi/nca | 337 | 12606934 | <filename>torchnca/__init__.py
"""A PyTorch implementation of Neighbourhood Components Analysis.
"""
from torchnca.nca import NCA
|
examples/from-wiki/simple_rgb2gray.py | hesom/pycuda | 1,264 | 12606944 | #!python
__author__ = 'ashwin'
import pycuda.driver as drv
import pycuda.tools
import pycuda.autoinit
from pycuda.compiler import SourceModule
import numpy as np
import scipy.misc as scm
import matplotlib.pyplot as p
mod = SourceModule \
(
"""
#include<stdio.h>
#define INDEX(a, b) a*256+b
__global__ vo... |
fastreid/config/__init__.py | NTU-ROSE/fast-reid | 2,194 | 12606951 | <reponame>NTU-ROSE/fast-reid
# encoding: utf-8
"""
@author: l1aoxingyu
@contact: <EMAIL>
"""
from .config import CfgNode, get_cfg, global_cfg, set_global_cfg, configurable
__all__ = [
'CfgNode',
'get_cfg',
'global_cfg',
'set_global_cfg',
'configurable'
]
|
coremltools/converters/mil/frontend/tensorflow/__init__.py | freedomtan/coremltools | 2,740 | 12606988 | # Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools._deps import _HAS_TF_1
# suppress TensorFlow stdout prints
import os
import logging... |
desktop/core/ext-py/django_celery_results-1.0.4/django_celery_results/migrations/0002_add_task_name_args_kwargs.py | maulikjs/hue | 5,079 | 12607008 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2017-10-26 16:06
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_celery_results', '0001_initial'),
]
operations = [
m... |
metadata-ingestion/src/datahub_provider/_lineage_core.py | cuong-pham/datahub | 1,603 | 12607088 | <reponame>cuong-pham/datahub<gh_stars>1000+
from datetime import datetime
from typing import TYPE_CHECKING, Dict, List
import datahub.emitter.mce_builder as builder
from datahub.api.entities.dataprocess.dataprocess_instance import InstanceRunResult
from datahub.configuration.common import ConfigModel
from datahub.util... |
2-Basical_Models/Logistic_Regression.py | haigh1510/TensorFlow2.0-Examples | 1,775 | 12607143 | #! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : Logistic_Regression.py
# Author : YunYang1994
# Created date: 2019-03-08 22:28:21
# Description :
#
#===========... |
research/tests_attacks.py | majacQ/fragattacks | 1,104 | 12607160 | <gh_stars>1000+
# Copyright (c) 2020, <NAME> <<EMAIL>>
#
# This code may be distributed under the terms of the BSD license.
# See README for more details.
from fraginternals import *
class AmsduInject(Test):
"""
Inject a frame identical to the one the station would receive when performing
the A-MSDU attack by inje... |
talkgenerator/util/language_util.py | korymath/talk-generator | 110 | 12607173 | <filename>talkgenerator/util/language_util.py
""" Module providing language-related operations to manipulate strings"""
import logging
import re
import string
import inflect
import nltk
logger = logging.getLogger("talkgenerator")
def check_and_download():
required_corpus_list = ["tokenizers/punkt", "taggers/ave... |
src/features/migrations/0017_auto_20200607_1005.py | augustuswm/flagsmith-api | 1,259 | 12607196 | # Generated by Django 2.2.12 on 2020-06-07 10:05
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('environments', '0012_auto_20200504_1322'),
('segments', '0007_auto_20190906_1416'),
('features', '0016_auto_... |
buildroot/support/testing/tests/package/sample_python_rpi_gpio.py | superm1/operating-system | 349 | 12607210 | try:
import RPi.GPIO # noqa
except RuntimeError as e:
assert(str(e) == 'This module can only be run on a Raspberry Pi!')
else:
raise RuntimeError('Import succeeded when it should not have!')
|
cosrlib/sources/metadata.py | commonsearch/cosr-back | 141 | 12607235 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function, unicode_literals
from cosrlib.sources import Source
class MetadataSource(Source):
""" Reads an intermediate dump of document metadata generated by
--plugin plugins.dump.DocumentMetadata
"""
already_parsed = True... |
test/dml_decision_tree/decision_tree_discrete.py | Edelweiss35/deep-machine-learning | 708 | 12607245 | from __future__ import division
import numpy as np
import scipy as sp
from dml.DT import DTC
X=np.array([
[0,0,0,0,8],
[0,0,0,1,3.5],
[0,1,0,1,3.5],
[0,1,1,0,3.5],
[0,0,0,0,3.5],
[1,0,0,0,3.5],
[1,0,0,1,3.5],
[1,1,1,1,2],
[1,0,1,2,3.5],
[1,0,1,2,3.5],
[2,0,1,2,3.5],
[2,0,1,1,3.5],
[2,1,0,1,3.5],
[2,1,0,2,3.5],
[2,0,0,0... |
poco/utils/measurement.py | HBoPRC/Poco | 1,444 | 12607259 | # coding=utf-8
def point_inside(p, bounds):
return bounds[3] <= p[0] <= bounds[1] and bounds[0] <= p[1] <= bounds[2]
|
python/interpret_community/widget/__init__.py | Nanthini10/interpret-community | 338 | 12607262 | <gh_stars>100-1000
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
"""Module for Explanation Dashboard widget."""
from .explanation_dashboard import ExplanationDashboard
__all__ = ['Exp... |
gltbx/glu.py | dperl-sol/cctbx_project | 155 | 12607273 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
import boost_adaptbx.boost.python as bp
ext = bp.import_ext("gltbx_glu_ext")
from gltbx_glu_ext import *
|
HSequences_bench/tools/opencv_matcher.py | bankbiz/Key.Net | 162 | 12607289 | import cv2
import numpy as np
class OpencvBruteForceMatcher(object):
name = 'opencv_brute_force_matcher'
distances = {}
distances['l2'] = cv2.NORM_L2
distances['hamming'] = cv2.NORM_HAMMING
def __init__(self, distance='l2'):
self._matcher = cv2.BFMatcher(self.distances[distance])
... |
google_problems/problem_47.py | loftwah/Daily-Coding-Problem | 129 | 12607314 | """This problem was asked by Google.
You're given a string consisting solely of (, ), and *. * can represent either a (, ), or an empty string.
Determine whether the parentheses are balanced.
For example, (()* and (*) are balanced. )*( is not balanced.
""" |
tests/test_transforms/test_encoders/test_mean_segment_encoder_transform.py | Pacman1984/etna | 326 | 12607318 | import numpy as np
import pandas as pd
import pytest
from etna.datasets import TSDataset
from etna.metrics import R2
from etna.models import LinearMultiSegmentModel
from etna.transforms import MeanSegmentEncoderTransform
@pytest.mark.parametrize("expected_global_means", ([[3, 30]]))
def test_mean_segment_encoder_fit... |
alipay/aop/api/domain/WorldTicketType.py | antopen/alipay-sdk-python-all | 213 | 12607337 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class WorldTicketType(object):
def __init__(self):
self._ticket_type_code = None
self._ticket_type_desc = None
self._ticket_type_name = None
@property
... |
extensions/timers.py | FeliciaXmL/ipython_extensions | 333 | 12607345 | <reponame>FeliciaXmL/ipython_extensions
# coding: utf-8
"""Extension for simple stack-based tic/toc timers
Each %tic starts a timer,
each %toc prints the time since the last tic
`%tic label` results in 'label: ' being printed at the corresponding %toc.
Usage:
In [6]: %tic outer
...: for i in range(4):
...: ... |
tests/lib/test_iceil.py | bogdanvuk/pygears | 120 | 12607369 | <gh_stars>100-1000
import math
import pytest
from pygears.lib import iceil
from pygears.lib.verif import directed
from pygears.sim import sim
from pygears.lib.verif import drv
from pygears.typing import Uint
@pytest.mark.parametrize('div', [1, 2, 4, 8])
def test_directed(sim_cls, div):
seq = list(range(256 - div... |
tests/test_aws.py | ukwa/mrjob | 1,538 | 12607377 | # -*- coding: utf-8 -*-
# Copyright 2016-2018 Yelp
# Copyright 2019 Yelp and Contributors
#
# 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
#
# Un... |
corehq/ex-submodules/soil/tests/test_get_task_status.py | dimagilg/commcare-hq | 471 | 12607393 | import datetime
from django.test import SimpleTestCase, override_settings
from soil.progress import get_task_status, TaskStatus, TaskProgress, STATES
@override_settings(CELERY_TASK_ALWAYS_EAGER=False)
class GetTaskStatusTest(SimpleTestCase):
def test_missing(self):
self.assertEqual(get_task_status(self.... |
3]. Competitive Programming/09]. HackerRank/2]. Tutorials/1]. 30 Days of Code/Python/Day_01.py | MLinesCode/The-Complete-FAANG-Preparation | 6,969 | 12607408 | # 2nd Solution
i = 4
d = 4.0
s = 'HackerRank '
a = int(input())
b = float(input())
c = input()
print(i+a)
print(d+b)
print(s+c) |
recipes/Python/577893_Securely_processing_Twilio_requests/recipe-577893.py | tdiprima/code | 2,023 | 12607467 | <reponame>tdiprima/code
# A decorator that lets you require HTTP basic authentication from visitors.
# <NAME> <<EMAIL>> 2011
# Use however makes you happy, but if it breaks, you get to keep both pieces.
# Post with explanation, commentary, etc.:
# http://kelleyk.com/post/7362319243/easy-basic-http-authentication-with-... |
lab-experiment/helper_functions/visual_degrees.py | robtu328/texture-vs-shape | 687 | 12607510 | #!/usr/bin/env python
#script to calculate visual degrees of experiment.
#copied from: http://osdoc.cogsci.nl/miscellaneous/visual-angle/
from math import atan2, degrees
h = 30.2 # Monitor height in cm
d = 100 # Distance between monitor and participant in cm
r = 1200 # Vertical resolution of the monitor
size_in_px =... |
papers/NeurIPS20-SVT/exp2_align_var.py | samellem/autodp | 158 | 12607516 | import numpy as np
import math
import scipy
from autodp import rdp_bank, dp_bank, fdp_bank, utils
from autodp.mechanism_zoo import LaplaceMechanism, LaplaceSVT_Mechanism,StageWiseMechanism
from autodp.transformer_zoo import Composition
import matplotlib.pyplot as plt
from scipy.stats import norm, laplace
from scipy.spe... |
utils/adapthresh.py | yyu1/SurfaceNet | 117 | 12607521 | import numpy as np
import copy
import os
import sys
import time
import itertools
import sparseCubes
import denoising
def access_partial_Occupancy_ijk(Occ_ijk, shift, D_cube):
"""
access 1/2, 1/4, 1/8 of the cube's Occupancy_ijk,
at the same time, translate the origin to the shifted array.
For exampl... |
libraries/botbuilder-core/botbuilder/core/skills/_skill_handler_impl.py | andreikop/botbuilder-python | 388 | 12607551 | <filename>libraries/botbuilder-core/botbuilder/core/skills/_skill_handler_impl.py<gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from uuid import uuid4
from logging import Logger
from typing import Callable
from botbuilder.core import Bot, BotAdapter, T... |
src/backend/db/init_db.py | ddddhm1/LuWu | 658 | 12607605 | from core import config
from crud.crud_user import user
from schemas.user import UserCreate
# make sure all SQL Alchemy models are imported before initializing DB
# otherwise, SQL Alchemy might fail to initialize relationships properly
# for more details: https://github.com/tiangolo/full-stack-fastapi-postgresql/issue... |
Hackerrank_problems/Sales by Match/solution.py | gbrls/CompetitiveCode | 165 | 12607617 | #!/bin/python3
import math
import os
import random
import re
import sys
# Complete the sockMerchant function below.
def sockMerchant(n, ar):
ar2 = []
ar1 =sorted(ar)
pair = 0
numb = 0
# The while loop is used so that the index in ar1[numb] does not go out of index limit.
# First I ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.