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 |
|---|---|---|---|---|
src/radish/step_testing/__init__.py | radish-bdd/radish2 | 182 | 12611088 | """
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
|
core/migrations/0089_projects_to_project__alter_created_by.py | simpsonw/atmosphere | 197 | 12611098 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-05-17 16:34
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
def move_projects_to_project(apps, schema_editor):
Project = apps.get_model('core', 'Project'... |
src/oscar/management/commands/oscar_find_duplicate_emails.py | QueoLda/django-oscar | 4,639 | 12611099 | <filename>src/oscar/management/commands/oscar_find_duplicate_emails.py
from collections import Counter
from django.core.management.base import BaseCommand
from oscar.core.compat import get_user_model
User = get_user_model()
class Command(BaseCommand):
help = ('Finds email addresses that are used by more than o... |
wagtailmenus/tests/models/pages.py | cazgp/wagtailmenus | 329 | 12611107 | from datetime import date
from django.db import models
from django.http import Http404
from django.template.response import TemplateResponse
from wagtail.admin.edit_handlers import (
FieldPanel, MultiFieldPanel, PublishingPanel
)
from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtai... |
Algo and DSA/LeetCode-Solutions-master/Python/all-elements-in-two-binary-search-trees.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 12611148 | # Time: O(n)
# Space: O(h)
# Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def getAllElements(self, root1, root2):
"""
:type root1: TreeNode
:type root2... |
golem/report/execution_report.py | Sunil-Rathore/golem | 171 | 12611172 | import base64
import errno
import json
import os
from golem.core import utils
from golem.core.project import Project
from golem.report import test_report
from golem.test_runner.conf import ResultsEnum
def execution_report_default():
params = utils.ImmutableKeysDict(browsers=[],
... |
python/paddle/fluid/tests/unittests/ir/inference/test_trt_matmul_quant_dequant.py | wwqgtxx/Paddle | 17,085 | 12611180 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
test-data/unit/plugins/type_anal_hook.py | Phlogistique/mypy | 12,496 | 12611185 | from typing import Optional, Callable
from mypy.plugin import Plugin, AnalyzeTypeContext
from mypy.types import Type, TypeList, AnyType, CallableType, TypeOfAny
# The official name changed to NoneType but we have an alias for plugin compat reasons
# so we'll keep testing that here.
from mypy.types import NoneTyp
clas... |
rebuild_classifier_table.py | RomeroLaura/Axelrod | 596 | 12611188 | <gh_stars>100-1000
import os
from axelrod import all_strategies
from axelrod.classifier import all_classifiers, rebuild_classifier_table
if __name__ == "__main__":
# Change to relative path inside axelrod folder
rebuild_classifier_table(all_classifiers, all_strategies)
|
napari/components/experimental/monitor/__init__.py | MaksHess/napari | 1,345 | 12611197 | <reponame>MaksHess/napari
"""Monitor service."""
from ._monitor import monitor
from ._utils import numpy_dumps
|
test/cctest/testcfg.py | hgl888/v8-3.17.16.2 | 140 | 12611199 | <reponame>hgl888/v8-3.17.16.2
# Copyright 2008 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# ... |
lib/bindings/samples/server/utils/loop.py | tlalexander/stitchEm | 182 | 12611249 | <reponame>tlalexander/stitchEm
import threading
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
class Loop(threading.Thread):
"""Calls a function every interval seconds:
t = Loop(30.0, f, args=[], kwargs={})
t.start()
t.cancel() ... |
pythainlp/corpus/__init__.py | Gorlph/pythainlp | 569 | 12611265 | # -*- coding: utf-8 -*-
"""
Corpus related functions.
Access to dictionaries, word lists, and language models.
Including download manager.
"""
__all__ = [
"corpus_path",
"corpus_db_path",
"corpus_db_url",
"countries",
"download",
"get_corpus",
"get_corpus_db",
"get_corpus_db_detail",
... |
cyvcf2/__main__.py | grahamgower/cyvcf2 | 307 | 12611270 | <reponame>grahamgower/cyvcf2
import sys
from .cli import cyvcf2 as cli
"""
cyvcf2.__main__
~~~~~~~~~~~~~~~~~~~~~
The main entry point for the command line interface.
Invoke as ``cyvcf2`` (if installed)
or ``python -m cyvcf2`` (no install required).
"""
if __name__ == "__main__":
# exit using whatever exit code t... |
CalibTracker/SiPixelTools/python/SiPixelErrorsCalibDigis_cfi.py | ckamtsikis/cmssw | 852 | 12611294 | import FWCore.ParameterSet.Config as cms
siPixelErrorsDigisToCalibDigis = cms.EDAnalyzer("SiPixelErrorsDigisToCalibDigis",
saveFile = cms.untracked.bool(True),
outputFilename = cms.string('myResults.root'),
SiPixelProducerLabelTag = cms.InputTag("siPixelCalibDigis")
)
|
leetcode/282.expression-add-operators.py | geemaple/algorithm | 177 | 12611308 | class Solution(object):
def __init__(self, *args, **kwargs):
self.num = None
self.target = None
def addOperators(self, num, target):
"""
:type num: str
:type target: int
:rtype: List[str]
"""
if num is None or len(num) == 0:
return []... |
heat/tests/convergence/framework/scenario.py | noironetworks/heat | 265 | 12611333 | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... |
tests/test_model/test_backbone/test_repvgg_backbone.py | ZJCV/PyCls | 110 | 12611338 | # -*- coding: utf-8 -*-
"""
@date: 2021/2/2 下午5:02
@file: test_repvgg_backbone.py
@author: zj
@description:
"""
import torch
from zcls.model.backbones.vgg.repvgg_backbone import RepVGGBackbone
def test_repvgg_backbone():
model = RepVGGBackbone()
print(model)
data = torch.randn(1, 3, 224, 224)
outp... |
setup.py | hafixo/afctl | 131 | 12611339 | <reponame>hafixo/afctl
from setuptools import setup, find_packages
from os import path
import versioneer
with open('requirements.txt') as f:
required = f.read().splitlines()
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_des... |
python/oneflow/support/async_util.py | wangyuyue/oneflow | 3,285 | 12611344 | """
Copyright 2020 The OneFlow 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 applicable law or agr... |
var/spack/repos/builtin/packages/py-yahmm/package.py | kkauder/spack | 2,360 | 12611374 | <reponame>kkauder/spack
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyYahmm(PythonPackage):
"""YAHMM is a HMM package for Python, impl... |
setup.py | xiazhaokang/vnpy | 323 | 12611406 | <filename>setup.py
"""
vn.py - By Traders, For Traders.
The vn.py project is an open-source quantitative trading framework
that is developed by traders, for traders.
The project is mainly written in Python and uses C++ for low-layer
and performance sensitive infrastructure.
Using the vn.py project, institutional inv... |
src/oci/certificates_management/models/update_certificate_authority_config_details.py | ezequielramos/oci-python-sdk | 249 | 12611421 | <reponame>ezequielramos/oci-python-sdk<filename>src/oci/certificates_management/models/update_certificate_authority_config_details.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 a... |
metadata-ingestion/tests/unit/test_mce_builder.py | pramodbiligiri/datahub | 3,586 | 12611436 | import datahub.emitter.mce_builder as builder
from datahub.metadata.schema_classes import (
DataFlowInfoClass,
DatasetPropertiesClass,
DatasetSnapshotClass,
MetadataChangeEventClass,
OwnershipClass,
)
def test_can_add_aspect():
dataset_mce: MetadataChangeEventClass = builder.make_lineage_mce(
... |
recipes/Python/577339_Random_Passwords/recipe-577339.py | tdiprima/code | 2,023 | 12611442 | <filename>recipes/Python/577339_Random_Passwords/recipe-577339.py
import random
import string
import time
def mkpass(size=16):
chars = []
chars.extend([i for i in string.ascii_letters])
chars.extend([i for i in string.digits])
chars.extend([i for i in '\'"!@#$%&*()-_=+[{}]~^,<.>;:/?'])
passwd ... |
scipy/fftpack/_basic.py | jake-is-ESD-protected/scipy | 9,095 | 12611451 | <gh_stars>1000+
"""
Discrete Fourier Transforms - _basic.py
"""
# Created by <NAME>, August,September 2002
__all__ = ['fft','ifft','fftn','ifftn','rfft','irfft',
'fft2','ifft2']
from scipy.fft import _pocketfft
from ._helper import _good_shape
def fft(x, n=None, axis=-1, overwrite_x=False):
"""
Re... |
koku/masu/test/external/downloader/aws/__init__.py | rubik-ai/koku | 157 | 12611454 | """AWS downloader tests."""
import random
import string
import faker
def fake_aws_account_id():
"""Generate a dummy AWS AwsAccount ID for testing purposes."""
return "".join(random.choice(string.digits) for _ in range(12))
def fake_arn(account_id="", service="fakeservice", region="", resource_separator=":"... |
tests/chainer_tests/testing_tests/test_function_link.py | zjzh/chainer | 3,705 | 12611457 | import unittest
import numpy
import pytest
import six
import chainer
from chainer import initializers
from chainer import testing
from chainer import utils
import chainerx
# Utilities for contiguousness tests.
#
# These tests checks incoming array contiguousness.
# As it's not possible to assume contiguousness of i... |
ctools/utils/log_helper.py | XinyuJing/DI-star | 267 | 12611487 | <reponame>XinyuJing/DI-star<filename>ctools/utils/log_helper.py
'''
Copyright 2020 Sensetime X-lab. All Rights Reserved
Main Function:
1. log helper, used to help to save logger on terminal, tensorboard or save file.
2. CountVar, to help counting number.
'''
import json
import logging
import numbers
import os
... |
scripts/sptk/compute_dpcl_label.py | unanan/setk | 280 | 12611488 | #!/usr/bin/env python
# wujian@2019
"""
Compute labels for DC (Deep Clustering) training:
-1 means silence
0...N for each speaker
"""
import argparse
import numpy as np
from libs.opts import StftParser
from libs.data_handler import SpectrogramReader, NumpyWriter
from libs.utils import get_logger, EPSILON
lo... |
OmniDB/OmniDB_app/include/Session.py | lejmr/OmniDB | 2,982 | 12611519 | import OmniDB_app.include.Spartacus as Spartacus
import OmniDB_app.include.Spartacus.Database as Database
import OmniDB_app.include.Spartacus.Utils as Utils
import OmniDB_app.include.OmniDatabase as OmniDatabase
import uuid
from datetime import datetime,timedelta
from django.contrib.sessions.backends.db import SessionS... |
setup.py | Trowsing/tapioca-wrapper | 362 | 12611526 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import re
import os
import sys
description = """
Tapioca provides an easy way to make explorable Python API wrappers.
APIs wrapped by Tapioca follow a simple interaction patte... |
lldb/test/API/commands/statistics/basic/TestStats.py | rarutyun/llvm | 2,338 | 12611533 | import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test(self):
self.build()
lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpe... |
tools/c7n_azure/c7n_azure/resources/mysql.py | vkubyshko/cloud-custodian | 2,415 | 12611537 | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from c7n_azure.provider import resources
from c7n_azure.resources.arm import ArmResourceManager
@resources.register('mysql')
class MySQL(ArmResourceManager):
"""Azure MySQL Server Resource
:example:
Returns all MySQL servers... |
test/fixture/python_scanner/nested1/nested2/nested3/imports_parent_module.py | Valkatraz/scons | 1,403 | 12611548 | <gh_stars>1000+
from .. import module
|
CMSIS/DSP/SDFTools/examples/example5/main.py | DavidLesnjak/CMSIS_5 | 2,293 | 12611551 | <filename>CMSIS/DSP/SDFTools/examples/example5/main.py
import sched as s
import matplotlib.pyplot as plt
from matplotlib import cm
import matplotlib.animation as animation
import cmsisdsp as dsp
import numpy as np
import cmsisdsp.fixedpoint as f
import cmsisdsp.mfcc as mfcc
import scipy.signal as sig
from cmsisdsp.da... |
aredis_om/checks.py | gowthamparuchuru/redis-om-python | 195 | 12611571 | from functools import lru_cache
from typing import List
from aredis_om.connections import get_redis_connection
@lru_cache(maxsize=None)
async def check_for_command(conn, cmd):
cmd_info = await conn.execute_command("command", "info", cmd)
return None not in cmd_info
@lru_cache(maxsize=None)
async def has_re... |
python_code/order.py | compile-run-Ali/SIMS | 254 | 12611615 | from __future__ import division
import os,cv2,helper,time,scipy.io
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.contrib.layers.python.layers import initializers
from spatial_transformer import transformer
import numpy as np
import numpy.matlib
training_phase = False
if(training_phase... |
care/facility/migrations/0063_merge_20200402_1402.py | gigincg/care | 189 | 12611618 | <gh_stars>100-1000
# Generated by Django 2.2.11 on 2020-04-02 14:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('facility', '0062_auto_20200402_1336'),
('facility', '0062_populate_facility_in_patient'),
]
operations = [
]
|
examples/download_df.py | Yook74/dash-extensions | 250 | 12611620 | <filename>examples/download_df.py<gh_stars>100-1000
import dash
import pandas as pd
import dash_html_components as html
from dash.dependencies import Output, Input
from dash_extensions import Download
from dash_extensions.snippets import send_data_frame
# Example data.
df = pd.DataFrame({'a': [1, 2, 3, 4], 'b': [2, 1... |
alipay/aop/api/domain/TemplateStyleInfoDTO.py | snowxmas/alipay-sdk-python-all | 213 | 12611625 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class TemplateStyleInfoDTO(object):
def __init__(self):
self._background_id = None
self._banner_img_id = None
self._banner_url = None
self._bg_color = None
self.... |
pgoapi/protos/pogoprotos/data/quests/multi_part_quest_pb2.py | aroo135/pgoapi | 842 | 12611691 | <reponame>aroo135/pgoapi<filename>pgoapi/protos/pogoprotos/data/quests/multi_part_quest_pb2.py<gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/data/quests/multi_part_quest.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from ... |
parakeet/models/tacotron2.py | zh794390558/DeepSpeech | 501 | 12611704 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
tests/threaded/test_thread.py | simatei/toolbelt | 544 | 12611711 | """Module containing the tests for requests_toolbelt.threaded.thread."""
try:
import queue # Python 3
except ImportError:
import Queue as queue
import threading
import unittest
import uuid
try:
from unittest import mock
except ImportError:
import mock
import requests.exceptions
from requests_toolbelt... |
tools/scripts/update_assets_metadata.py | rotkehlchenio/rotkehlchen | 137 | 12611720 | <gh_stars>100-1000
#!/usr/bin/env python
import hashlib
import json
import re
import sys
from pathlib import Path
src_dir = Path(__file__).parent.parent.parent / 'rotkehlchen'
ASSETS_JSON = src_dir / 'data/all_assets.json'
ASSETS_META = src_dir / 'data/all_assets.meta'
ASSETS_TEST = src_dir / 'tests/unit/test_assets.p... |
src/genie/libs/parser/iosxe/tests/ShowLispInstanceIdEthernetServer/cli/equal/golden_output_3_expected.py | balmasea/genieparser | 204 | 12611723 | expected_output = {
"instance_id": {
4097: {"lisp": 0},
4099: {"lisp": 0},
4100: {"lisp": 0},
8188: {
"lisp": 0,
"site_name": {
"site_uci": {
"any-mac": {
"last_register": "never",
... |
lib/ch.py | Pandinosaurus/videoavatars | 531 | 12611724 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import numpy as np
import chumpy as ch
import scipy.sparse as sp
from chumpy.utils import col
class sp_dot(ch.Ch):
terms = 'a',
dterms = 'b',
def compute_r(self):
return self.a.dot(self.b.r)
def compute(self):
# To stay consistent wit... |
scripts/build/runner/printonly.py | AnthonyDiGirolamo/connectedhomeip | 3,495 | 12611747 | # Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
pypy/module/test_lib_pypy/cffi_tests/cffi0/test_verify.py | m4sterchain/mesapy | 381 | 12611748 | # Generated by pypy/tool/import_cffi.py
import py, re
import sys, os, math, weakref
from cffi import FFI, VerificationError, VerificationMissing, model, FFIError
from pypy.module.test_lib_pypy.cffi_tests.support import *
lib_m = ['m']
if sys.platform == 'win32':
#there is a small chance this fails on Mingw via en... |
tests/functional/startup.py | bianhaoyi/necache | 351 | 12611756 | __doc__ = '''
Testing the various startup parameters.
'''
__author__ = "<NAME> <<EMAIL>>"
__version__ = "0.1-1.45"
import os
import sys
import time
import subprocess
try:
from lib import memcache
except ImportError:
print "Check your sys.path setting to include lib/memcache.py."
sys.exit()
try:
import ... |
venv/Lib/site-packages/debugpy/launcher/output.py | ajayiagbebaku/NFL-Model | 695 | 12611795 | <gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import codecs
import os
import sys
import threading
from debug... |
test/tests/fun.py | RangelReale/libpypa | 152 | 12611802 | def fun(a, b, k=None, *argc, **kwargs):
pass
|
tests/test_50_server.py | brunato/pysaml2 | 249 | 12611811 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import copy
import os
from contextlib import closing
from six.moves.urllib.parse import parse_qs
import uuid
import re
from saml2.cert import OpenSSLWrapper
from saml2.sigver import make_temp, DecryptError, EncryptError, CertificateError
from saml2.assertion ... |
nbterm/format.py | vrthra-forks/nbterm | 568 | 12611817 | import json
from pathlib import Path
from typing import Optional
from .cell import Cell
class Format:
nb_path: Path
save_path: Optional[Path]
def read_nb(self) -> None:
with open(self.nb_path) as f:
self.json = json.load(f)
self.set_language() # type: ignore
self.ce... |
fairseq/data/noising.py | kayoyin/DialogueMT | 651 | 12611831 | <filename>fairseq/data/noising.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import numpy as np
from fairseq.data import data_utils
class WordNoising(object):
"""Gen... |
blueoil/converter/core/data_types.py | msakai/blueoil | 248 | 12611850 | <filename>blueoil/converter/core/data_types.py
# -*- coding: utf-8 -*-
# Copyright 2018 The Blueoil 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:... |
hpccm/templates/sed.py | robertmaynard/hpc-container-maker | 340 | 12611878 | # Copyright (c) 2018, NVIDIA 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 appli... |
tests/daemon/unit/test_dockerize.py | vishalbelsare/jina | 15,179 | 12611914 | import platform
from daemon.dockerize import Dockerizer
import pytest
@pytest.mark.parametrize(
'value, expected',
(['Linux', '//var/run/docker.sock'], ['Darwin', '/var/run/docker.sock']),
)
def test_sock(value, expected, monkeypatch):
monkeypatch.setattr(platform, 'system', lambda: value)
assert Doc... |
pex/pex_warnings.py | ShellAddicted/pex | 2,160 | 12611938 | <reponame>ShellAddicted/pex<filename>pex/pex_warnings.py<gh_stars>1000+
# coding=utf-8
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
import warnings
from pex.typing import TYPE_CHECKING
if TYP... |
tests/unit/modules/nxos/nxos_n93k.py | waynegemmell/salt | 9,425 | 12611944 | <reponame>waynegemmell/salt
"""
:codeauthor: <NAME> <<EMAIL>>
"""
# Copyright (c) 2018 Cisco and/or its affiliates.
#
# 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.apa... |
softdelete/admin/forms.py | RedMoon32/django-softdelete | 242 | 12611961 | from django.forms import *
from softdelete.models import *
from softdelete.forms import *
import logging
class SoftDeleteObjectAdminForm(ModelForm):
deleted = BooleanField(required=False)
class Meta:
model = SoftDeleteObject
exclude = ('deleted_at',)
def __init__(self, *args, **kwargs... |
nautobot/circuits/api/views.py | psmware-ltd/nautobot | 384 | 12611970 | <gh_stars>100-1000
from django.db.models import Prefetch
from rest_framework.routers import APIRootView
from nautobot.circuits import filters
from nautobot.circuits.models import Provider, CircuitTermination, CircuitType, Circuit
from nautobot.core.api.views import ModelViewSet
from nautobot.dcim.api.views import Path... |
client/deploy_hdfs.py | jzmq/minos | 365 | 12611976 | <filename>client/deploy_hdfs.py
import deploy_utils
import parallel_deploy
import service_config
import subprocess
import sys
import time
from log import Log
ALL_JOBS = ["journalnode", "zkfc", "namenode", "datanode"]
SHELL_COMMAND_INFO = {
"dfs": ("org.apache.hadoop.fs.FsShell",
"run a filesystem command on ... |
httpx/_compat.py | jleven/httpx | 8,523 | 12611984 | <reponame>jleven/httpx
"""
The _compat module is used for code which requires branching between different
Python environments. It is excluded from the code coverage checks.
"""
import ssl
import sys
# `contextlib.asynccontextmanager` exists from Python 3.7 onwards.
# For 3.6 we require the `async_generator` package fo... |
chapter3/yield_psychologist.py | haru-256/ExpertPython3_Source | 112 | 12611997 | <gh_stars>100-1000
def psychologist():
print('Please tell me your problems')
while True:
answer = (yield)
if answer is not None:
if answer.endswith('?'):
print("Don't ask yourself too much questions")
elif 'good' in answer:
print("Ahh tha... |
h2o-docs/src/booklets/v2_2015/source/GBM_Vignette_code_examples/gbm_examplerun.py | ahmedengu/h2o-3 | 6,098 | 12612000 | # Now, train the GBM model:
from h2o.estimators.gbm import H2OGradientBoostingEstimator
# Load the data and prepare for modeling
airlines_hex = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/airlines/allyears2k_headers.zip")
# Generate random numbers and create training, validation, testing s... |
reverb/dataset_test.py | wookayin/reverb | 569 | 12612002 | # Lint as: python3
# Copyright 2019 DeepMind Technologies Limited.
#
# 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 ap... |
files/managers/upload_module.py | wkma/bk-sops | 881 | 12612025 | <filename>files/managers/upload_module.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you... |
torchsde/_core/adjoint_sde.py | emaballarin/torchsde | 984 | 12612046 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
Python3/1288.py | rakhi2001/ecom7 | 854 | 12612056 | __________________________________________________________________________________________________
sample 84 ms submission
class Solution:
def removeCoveredIntervals(self, intervals: List[List[int]]) -> int:
if not intervals: return 0
intervals.sort()
L, R = intervals[0]
for i in ran... |
examples/textbook/gravity_gravity.py | rknop/amuse | 131 | 12612060 | #from __future__ import print_function
import numpy
from amuse.units import units
from amuse.units import quantities
from amuse.units import constants
from amuse.units import nbody_system
from amuse.ext.bridge import bridge
from amuse.community.phigrape.interface import PhiGRAPE
from amuse.community.ph4.interface impor... |
FAS_challenge_CVPRW2020/Track1 Multi-modal/model1_2_pytorch/models/CDCNs.py | Turing311/CDCN | 463 | 12612072 | <filename>FAS_challenge_CVPRW2020/Track1 Multi-modal/model1_2_pytorch/models/CDCNs.py
import math
import torch
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from torch import nn
from torch.nn import Parameter
import pdb
import numpy as np
class Conv2d_cd(nn.Module):
def __init__(self... |
tests/unit/command/test_get_url.py | lucasalavapena/dvc | 9,136 | 12612073 | <filename>tests/unit/command/test_get_url.py
from dvc.cli import parse_args
from dvc.command.get_url import CmdGetUrl
def test_get_url(mocker):
cli_args = parse_args(["get-url", "src", "out", "-j", "5"])
assert cli_args.func == CmdGetUrl
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.Repo.g... |
loss_fn/base_criteria.py | apple/ml-cvnets | 209 | 12612092 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import torch
from torch import nn, Tensor
import argparse
from typing import Any
class BaseCriteria(nn.Module):
def __init__(self, *args, **kwargs):
super(BaseCriteria, self).__init__()
self.ep... |
snippets/06 - Reshaping data6.py | joshuagottardogalvani/pandas-tutorial | 183 | 12612116 | colnames = ['date'] + [item for pair in zip(hours, ['flag']*24) for item in pair]
data = pd.read_csv("data/BETR8010000800100hour.1-1-1990.31-12-2012",
sep='\t', header=None, na_values=[-999, -9999], names=colnames) |
chromium/tools/telemetry/telemetry/internal/browser/tab.py | wedataintelligence/vivaldi-source | 925 | 12612121 | <gh_stars>100-1000
# Copyright 2012 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.
from telemetry.internal.browser import web_contents
from telemetry.internal.image_processing import video
DEFAULT_TAB_TIMEOUT = 60
clas... |
firefighter/update/common/buildbot/builder.py | tingshao/catapult | 2,151 | 12612136 | <filename>firefighter/update/common/buildbot/builder.py
# Copyright 2015 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.
import urllib
from common.buildbot import builds
from common.buildbot import network
def Builders(... |
disabled-challenges/SBTP/poller/for-release/machine.py | pingjuiliao/cb-multios | 473 | 12612149 | #!/usr/bin/env python
#
# Copyright (C) 2014
# <NAME> <<EMAIL>>
# Narf Industries <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limit... |
alipay/aop/api/domain/TuitionCertificate.py | antopen/alipay-sdk-python-all | 213 | 12612157 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.TuitionUserName import TuitionUserName
class TuitionCertificate(object):
def __init__(self):
self._certificate_no = None
self._certificate_type = None
... |
juriscraper/opinions/united_states_backscrapers/federal_special/cit_2003.py | EvandoBlanco/juriscraper | 228 | 12612172 | <filename>juriscraper/opinions/united_states_backscrapers/federal_special/cit_2003.py
# Scraper for the United States Court of International Trade
# CourtID: cit
# Court Short Name: Ct. Int'l Trade
# Neutral Citation Format: Ct. Int'l Trade No. 12-1
from juriscraper.OpinionSite import OpinionSite
import re
import time
... |
docs/settings.py | simonkern/django-crispy-forms | 2,347 | 12612182 | <reponame>simonkern/django-crispy-forms
import os
SITE_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)))
TEMPLATE_LOADERS = (
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
)
TEMPLATE_DIRS = os.path.join(SITE_ROOT, "templates")
INSTALLED_APPS = "... |
detection/RetinaFace/rcnn/utils/save_model.py | dwhite54/insightface | 12,377 | 12612191 | <filename>detection/RetinaFace/rcnn/utils/save_model.py<gh_stars>1000+
import mxnet as mx
def save_checkpoint(prefix, epoch, arg_params, aux_params):
"""Checkpoint the model data into file.
:param prefix: Prefix of model name.
:param epoch: The epoch number of the model.
:param arg_params: dict of str... |
checkov/kubernetes/checks/ApiServerAuthorizationModeNode.py | niradler/checkov | 4,013 | 12612220 | from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.kubernetes.base_spec_check import BaseK8Check
class ApiServerAuthorizationModeNode(BaseK8Check):
def __init__(self):
id = "CKV_K8S_75"
name = "Ensure that the --authorization-mode argument includes Node"
categ... |
homeassistant/components/airnow/__init__.py | MrDelik/core | 30,023 | 12612221 | """The AirNow integration."""
import datetime
import logging
from aiohttp.client_exceptions import ClientConnectorError
from pyairnow import WebServiceAPI
from pyairnow.conv import aqi_to_concentration
from pyairnow.errors import AirNowError
from homeassistant.config_entries import ConfigEntry
from homeassistant.cons... |
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings/test.py | thorgate/django-project-template | 123 | 12612227 | from settings.local import *
SEND_EMAILS = False
DATABASES["default"]["TEST"] = {
"NAME": "{{ cookiecutter.repo_name }}_test",
}
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
# - {%- if cookiecutter.frontend_style == SPA %}
# Use session in tests to make api login easier
REST_FRAMEWORK["DEF... |
moldesign/_tests/test_geometry.py | Autodesk/molecular-design-toolkit | 147 | 12612241 | """ Tests geometry routines
"""
from builtins import range
import random
import itertools
import pytest
import numpy as np
import moldesign as mdt
from moldesign import units as u
from . import helpers
registered_types = {}
__PYTEST_MARK__ = 'internal' # mark all tests in this module with this label (see ./conft... |
whatlies/language/_convert_lang.py | nth-attempt/whatlies | 325 | 12612264 | <filename>whatlies/language/_convert_lang.py
from typing import Union, List
import tensorflow_text # noqa: F401
import tensorflow as tf
import tensorflow_hub as tfhub
from whatlies.embedding import Embedding
from whatlies.embeddingset import EmbeddingSet
from whatlies.language._common import SklearnTransformerMixin,... |
src/qrcode/pyqart/art/target.py | lapinozz/ArtCoder | 525 | 12612269 | # Added at : 2016.8.3
# Author : 7sDream
# Usage : Target point(contain point and image pixel info).
__all__ = ['Target']
class Target(object):
def __init__(self, y, x, fill, contrast, point):
self._y = y
self._x = x
self._fill = fill
self._contrast = contrast
self._p... |
saleor/graphql/attribute/bulk_mutations.py | fairhopeweb/saleor | 15,337 | 12612293 | <filename>saleor/graphql/attribute/bulk_mutations.py
import graphene
from ...attribute import models
from ...core.permissions import PageTypePermissions
from ..core.mutations import ModelBulkDeleteMutation
from ..core.types.common import AttributeError
class AttributeBulkDelete(ModelBulkDeleteMutation):
class Ar... |
local/make_vctk_wav.py | ishine/pytorch-kaldi-neural-speaker-embeddings | 141 | 12612294 | import os
import sys
path
|
Python3/1161.py | rakhi2001/ecom7 | 854 | 12612299 | __________________________________________________________________________________________________
Runtime: 388 ms
Memory Usage: 18.5 MB
class Solution:
def maxLevelSum(self, root: TreeNode) -> int:
mapping = {}
self.helper(mapping, root, 1)
max_val, max_level = -9999999, 0
for level... |
lldb/test/API/commands/expression/namespace_local_var_same_name_obj_c/TestNamespaceLocalVarSameNameObjC.py | mkinsner/llvm | 2,338 | 12612332 | <filename>lldb/test/API/commands/expression/namespace_local_var_same_name_obj_c/TestNamespaceLocalVarSameNameObjC.py
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestNamespaceLocalVarSameNameObjC(TestBase):
mydir = TestBase.com... |
src/examples/freeswitch/inbound/inbound_concurrent_dialer_server.py | mknecht/plivoframework | 151 | 12612348 | <filename>src/examples/freeswitch/inbound/inbound_concurrent_dialer_server.py
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Plivo Team. See LICENSE for details.
from plivo.core.freeswitch.inboundsocket import InboundEventSocket
from plivo.core.errors import ConnectError
from plivo.utils.logger import StdoutLogger
impo... |
modules/nltk_contrib/refexpr/constraint.py | h4ck3rm1k3/NLP-project | 123 | 12612352 | #!/usr/bin/python
#
# Copyright 2005 <NAME> <<EMAIL>>
# Originally licensed under the GNU General Public License
#
# Relicensed with permission 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 a... |
samples/classification.py | dimdano/flops-counter.pytorch | 1,932 | 12612362 | import argparse
import sys
import torch
import torchvision.models as models
from ptflops import get_model_complexity_info
pt_models = {'resnet18': models.resnet18,
'resnet50': models.resnet50,
'alexnet': models.alexnet,
'vgg16': models.vgg16,
'squeezenet': models.s... |
gpytorch/lazy/identity_lazy_tensor.py | llguo95/gpytorch | 188 | 12612363 | <gh_stars>100-1000
#!/usr/bin/env python3
from typing import Optional, Tuple
import torch
from torch import Tensor
from ..utils.broadcasting import _mul_broadcast_shape
from ..utils.getitem import _compute_getitem_size, _is_noop_index
from ..utils.memoize import cached
from .diag_lazy_tensor import ConstantDiagLazyT... |
zerver/webhooks/transifex/view.py | BillyMagarali/zulip | 17,004 | 12612369 | # Webhooks for external integrations.
from typing import Optional
from django.http import HttpRequest, HttpResponse
from zerver.decorator import webhook_view
from zerver.lib.exceptions import UnsupportedWebhookEventType
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_suc... |
smtbx/ab_initio/development/electron_density_distribution.py | dperl-sol/cctbx_project | 155 | 12612371 | from __future__ import absolute_import, division, print_function
from scitbx.array_family import flex
def find_delta(rho_map, tol):
""" Find delta as hinted on fig. 1 of ref. [1] in module charge_flipping """
rho = rho_map.real_map_unpadded().as_1d()
max_rho = flex.max(rho)
rho /= max_rho
sorting = flex.sort... |
tests/transport/test_tcp.py | g-r-a-n-t/py-libp2p | 315 | 12612383 | from multiaddr import Multiaddr
import pytest
import trio
from libp2p.network.connection.raw_connection import RawConnection
from libp2p.tools.constants import LISTEN_MADDR
from libp2p.transport.exceptions import OpenConnectionError
from libp2p.transport.tcp.tcp import TCP
@pytest.mark.trio
async def test_tcp_listen... |
ui/webui/resources/js/cr/ui/compiled_resources2.gyp | google-ar/chromium | 777 | 12612385 | <filename>ui/webui/resources/js/cr/ui/compiled_resources2.gyp
# Copyright 2015 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.
{
'targets': [
{
'target_name': 'alert_overlay',
'dependencies': [
'..... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.