max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
models/loss_helper.py | Co1lin/Group-Free-3D | 174 | 1697688 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
from .losses import smoothl1_loss, l1_loss, SigmoidFocalClassificationLo... | 15 | 4 | 0 | 0 | 19 | 0 |
test.py | bcicen/wikitables | 305 | 1697695 | <reponame>bcicen/wikitables<filename>test.py
import json
import unittest
import mwparserfromhell as mwp
from wikitables import ftag, WikiTable
class TestWikiTables(unittest.TestCase):
def _load(self, source, lang='en'):
raw_tables = mwp.parse(source).filter_tags(matches=ftag('table'))
return Wi... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fpgadataflow/test_fpgadataflow_addstreams.py | mmrahorovic/finn | 109 | 1697705 | # Copyright (c) 2020, Xilinx
# 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 notice, this
# list of conditions and the follow... | 0 | 2 | 0 | 0 | 2 | 0 |
wouso/utils/add_races.py | AlexandruGhergut/wouso | 117 | 1697719 | <reponame>AlexandruGhergut/wouso
#!/usr/bin/env python
# To test, run from parent folder using a command such as:
# PYTHONPATH=../:. python utils/add_races.py utils/sample-data/sample-race-list.csv
import sys
import csv
import wouso.utils.user_util
def main():
if len(sys.argv) != 2:
print 'Usage: python ... | 0 | 0 | 0 | 0 | 0 | 0 |
securityheaders/checkers/cors/alloworigin/test_null.py | th3cyb3rc0p/securityheaders | 151 | 1697729 | <filename>securityheaders/checkers/cors/alloworigin/test_null.py
import unittest
from securityheaders.checkers.cors import AccessControlAllowOriginNullChecker
class AccessControlAllowOriginNullCheckerTest(unittest.TestCase):
def setUp(self):
self.x = AccessControlAllowOriginNullChecker()
def test_chec... | 0 | 0 | 0 | 0 | 0 | 0 |
pymba/camera.py | acoathup/pymba | 107 | 1697762 | from ctypes import byref, sizeof, c_uint32
from typing import Optional, List, Callable
import gc
from .vimba_object import VimbaObject
from .vimba_exception import VimbaException
from .frame import Frame
from . import vimba_c
SINGLE_FRAME = 'SingleFrame'
CONTINUOUS = 'Continuous'
def _camera_infos() -> List[vimba_... | 0 | 0 | 0 | 0 | 0 | 1 |
vlcp/utils/walkerlib.py | hubo1016/vlcp | 252 | 1697773 | '''
Created on 2018/7/12
:author: hubo
'''
from vlcp.utils.exceptions import WalkKeyNotRetrieved
def ensure_keys(walk, *keys) -> object:
"""
Use walk to try to retrieve all keys
"""
all_retrieved = True
for k in keys:
try:
walk(k)
except WalkKeyNotRetrieved:
... | 0 | 1 | 0 | 0 | 1 | 0 |
kws_streaming/layers/spectrogram_cutout.py | deepneuralmachine/google-research | 23,901 | 1697780 | <filename>kws_streaming/layers/spectrogram_cutout.py
# coding=utf-8
# Copyright 2021 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... | 0 | 0 | 0 | 0 | 0 | 0 |
DPGAnalysis/Skims/python/reco_skim_cfg_mod_350.py | ckamtsikis/cmssw | 852 | 1697801 | import FWCore.ParameterSet.Config as cms
process = cms.Process('RERECO')
# this is to avoid the postpathendrun probem with same process name (only with http reader)
process.options = cms.untracked.PSet(
IgnoreCompletely = cms.untracked.vstring('Configuration')
# SkipEvent = cms.untracked.vstring('Configuration... | 0 | 0 | 0 | 0 | 0 | 0 |
Ch4/iris.py | jason-168/MLCode | 146 | 1697810 |
# Code from Chapter 4 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with no warranty ... | 0 | 0 | 0 | 0 | 0 | 0 |
dbus-mongo-extractor/mongo_connector/QueueElement.py | JunZCn/DBus | 1,232 | 1697831 | # -*- coding: utf-8-*-
import logging
LOG = logging.getLogger(__name__)
# 记录kafka 发送是否成功的状态类
# 3个状态:
# 1 Init when message send,
# 2 Ok when message send success
# 3 Fail when message send fail
# key: oplog timestamp 64bit
class QueueElement(object):
INIT = 0
OK = 1
FAIL = -1
def... | 0 | 0 | 0 | 0 | 0 | 0 |
viper/core/ui/cmd/stats.py | acd62081/viper | 1,131 | 1697835 | <reponame>acd62081/viper<gh_stars>1000+
# -*- coding: utf-8 -*-
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
from collections import defaultdict
from viper.common.abstracts import Command
from viper.common.utils import convert_size
from viper... | 0 | 0 | 0 | 0 | 0 | 0 |
controllers/nessus.py | noraj/Kvasir | 194 | 1697858 | # encoding: utf-8
##--------------------------------------#
## Kvasir
##
## (c) 2010-2014 Cisco Systems, Inc.
## (c) 2015 <NAME>
##
## Nessus controller
##
## Author: <NAME> <<EMAIL>>
##--------------------------------------#
from skaldship.metasploit import msf_get_config
from skaldship.nessus import nessus_get_confi... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/clang/scripts/download_lld_mac.py | mtk-watch/android_external_v8 | 2,151 | 1697875 | <reponame>mtk-watch/android_external_v8<filename>tools/clang/scripts/download_lld_mac.py<gh_stars>1000+
#!/usr/bin/env python
# Copyright 2017 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.
"""Script to download lld/mac f... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/Lib/site-packages/prometheus_client/twisted/_exposition.py | ajayiagbebaku/NFL-Model | 2,729 | 1697886 | <filename>venv/Lib/site-packages/prometheus_client/twisted/_exposition.py<gh_stars>1000+
from __future__ import absolute_import, unicode_literals
from twisted.internet import reactor
from twisted.web.wsgi import WSGIResource
from .. import exposition, REGISTRY
MetricsResource = lambda registry=REGISTRY: WSGIResource... | 0 | 0 | 0 | 0 | 0 | 0 |
main.py | leyiweb/Adversarially-Learned-Anomaly-Detection | 125 | 1697897 | #! python3
import argparse
import importlib
import logging
import os
import shutil
import urllib3
import zipfile
# import data
# Logging
console = logging.StreamHandler()
console.setLevel(logging.INFO)
console.setFormatter(logging.Formatter('[%(asctime)s %(levelname)-3s @%(name)s] %(message)s', datefmt=... | 0 | 1 | 0 | 0 | 1 | 0 |
app/modules/auth/parameters.py | IsmaelJS/test-github-actions | 1,420 | 1697910 | # encoding: utf-8
# pylint: disable=wrong-import-order
"""
Input arguments (Parameters) for Auth resources RESTful API
-----------------------------------------------------------
"""
from flask_login import current_user
from flask_marshmallow import base_fields
from flask_restplus_patched import PostFormParameters
from... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/cli/util/exceptions.py | nparkstar/nauta | 390 | 1697972 | #
# Copyright (c) 2019 Intel Corporation
#
# 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... | 1 | 0 | 0 | 0 | 1 | 0 |
tensorflow_federated/python/program/value_reference.py | tensorflow/federated | 1,918 | 1697976 | <filename>tensorflow_federated/python/program/value_reference.py
# Copyright 2021, The TensorFlow Federated 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... | 0 | 0 | 0 | 0 | 0 | 0 |
server/config/settings_local_template.py | paulu/opensurfaces | 137 | 1698021 | ##
## LOCAL DJANGO SETTINGS
##
##
## IMPORTANT SETTINGS
##
# If True, errors will be presented to the user in the browser, and all queries
# will be stored in memory -- so don't leave the server running for too long
# with DEBUG enabled.
#
# If False, errors will be emailed to you (using ADMINS, below).
DEBUG = True
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/generate_session_tweet_csv.py | loklak/wp-easy-twitter-plugin | 1,846 | 1698069 | <reponame>loklak/wp-easy-twitter-plugin
import csv
import readline # noqa
import sys
from datetime import timedelta
import pytz
import requests
from dateutil import parser
event_identifier = sys.argv[1]
event_url = 'https://api.eventyay.com/v1/events/' + event_identifier
event = requests.get(event_url).json()
even... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/build/v2/test/core_parallel_multifile_actions_2.py | jmuskaan72/Boost | 198 | 1698083 | #!/usr/bin/python
# Copyright 2008 <NAME>, <NAME>
# Copyright 2011 <NAME>
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Added to guard against a bug causing targets to be used before they
# themselves have f... | 0 | 0 | 0 | 0 | 0 | 0 |
barbican/tests/plugin/test_castellan_secret_store.py | openstack/barbican | 177 | 1698084 | # Copyright (c) 2018 Red Hat, 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 in writ... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/dataset_processing/process_degli_data.py | madhukarkm/NeMo | 4,145 | 1698085 | <gh_stars>1000+
# Copyright (c) 2020, 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 r... | 0 | 0 | 0 | 0 | 0 | 0 |
hooks/explorer.py | NirLevy98/PyHook | 126 | 1698092 | from PyHook import wait_for_process, on_credential_submit, log
import frida
import sys
hook_process_name = "explorer"
def logger(message):
log(hook_process_name, message)
def wait_for():
hook()
def hook():
try:
logger("Trying To Hook Into Explorer")
session = frida.attach("explorer.ex... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/common/test_op/ascend/apply_proximal_gradient_descent.py | tianjiashuo/akg | 286 | 1698095 | # Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# 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 agre... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/test_jupyterlab_pyflyby.py | sflicht/pyflyby | 159 | 1698111 | """
Jupyterlab-pyflyby extension related test
Some of these test do not need the full extension installed so we put them here.
"""
from pyflyby._comms import _reformat_helper
import pytest
# insert between marker
a = (
"""
import before as b
# THIS CELL WAS AUTO-GENERATED BY PYFLYBY
import middle as m
# END ... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/loss/clipped_weighted_huber_loss.py | nkxingxh/waifu2x-chainer | 150 | 1698127 | <reponame>nkxingxh/waifu2x-chainer<filename>lib/loss/clipped_weighted_huber_loss.py
import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class ClippedWeightedHuberLoss(function.Function):
def __init__(self, weight, delta=0.1, clip=(0.0, 1.0)):
self.weig... | 0 | 0 | 0 | 0 | 0 | 0 |
machina/algos/gail.py | krish-dx/machina | 302 | 1698156 | from __future__ import annotations
"""
This is an implementation of Generative Adversarial Imiation Learning
See https://arxiv.org/abs/1606.03476
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from machina import loss_functional as lf
from machina import logger
from machina.algos import trpo, ... | 19 | 2 | 0 | 0 | 21 | 0 |
alipay/aop/api/response/AlipayEbppCommunityPubkeyQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 1698224 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.AccessPublicKey import AccessPublicKey
class AlipayEbppCommunityPubkeyQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayEbppCommunityPubkeyQ... | 0 | 2 | 0 | 2 | 4 | 0 |
pynetdicom/tests/test_dul.py | Jesse-Back/pynetdicom | 274 | 1698238 | """DUL service testing"""
import logging
import socket
import threading
import time
import pytest
from pynetdicom import AE, debug_logger, evt
from pynetdicom.dul import DULServiceProvider
from pynetdicom.pdu import (
A_ASSOCIATE_RQ, A_ASSOCIATE_AC, A_ASSOCIATE_RJ,
A_RELEASE_RQ, A_RELEASE_RP, P_DATA_TF, A_AB... | 0 | 2 | 0 | 0 | 2 | 0 |
redditBotColorize/image_util.py | ForeverRecompin/reddit_crawlers | 422 | 1698269 | from PIL import Image, ImageStat
import numpy as np
def is_color_image(file, thumb_size=50, MSE_cutoff=140, adjust_color_bias=True):
try:
pil_img = Image.open(file)
except:
print 'Couldn\'t open file %s'%file
return False
np_img = np.array(pil_img)
if len(np_img.shape) > 2 and ... | 0 | 0 | 0 | 0 | 0 | 0 |
lore/estimators/xgboost.py | timgates42/lore | 1,549 | 1698278 | from __future__ import annotations
from __future__ import absolute_import
import inspect
import logging
import warnings
import threading
import lore.env
import lore.estimators
from lore.util import timed, before_after_callbacks
lore.env.require(
lore.dependencies.XGBOOST +
lore.dependencies.SKLEARN
)
import ... | 45 | 7 | 0 | 1 | 53 | 0 |
megnet/cli/meg.py | liuxiaotong15/megnet | 367 | 1698284 | <reponame>liuxiaotong15/megnet
#!/usr/bin/env python
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
A master convenience script with many tools for vasp and structure analysis.
"""
import argparse
import sys
from difflib import SequenceMatcher
from pathlib import Path... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unittests/modules/test_reg.py | buddwm/hubble | 363 | 1698290 | # -*- coding: utf-8 -*-
import hubblestack.modules.reg as reg
import hubblestack.utils.win_reg
from hubblestack.exceptions import CommandExecutionError
from tests.support.helpers import random_string
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.suppo... | 0 | 1 | 0 | 0 | 1 | 0 |
django_quicky/templatetags/introspection.py | sametmax/django-quicky | 149 | 1698295 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
"""
Tag to use python introspection in a Django template
"""
from django import template
register = template.Library()
@register.filter
def getattr(obj, args) -> object:
"""
Try to get an attribute from an object.
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_density_SphereVoxelization.py | SyedZiaul/freud | 172 | 1698306 | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pytest
from SphereVoxelization_fft import compute_2d, compute_3d
import freud
matplotlib.use("agg")
class TestSphereVoxelization:
def test_random_points_2d(self):
width = 100
r_max = 10.0
num_points = 10
... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/radiotherm/switch.py | mib1185/core | 30,023 | 1698311 | """Support for radiotherm switches."""
from __future__ import annotations
from typing import Any
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEnt... | 8 | 8 | 1 | 2 | 19 | 0 |
iotbx/command_line/pdb_split_models.py | dperl-sol/cctbx_project | 155 | 1698312 | from __future__ import absolute_import, division, print_function
# LIBTBX_SET_DISPATCHER_NAME iotbx.pdb.split_models
from libtbx.utils import Sorry, Usage, null_out
import os
import sys
master_phil = """
split_models
.short_caption = Split multi-model PDB file
.caption = This utility will separate a multi-model P... | 0 | 0 | 0 | 0 | 0 | 1 |
third_party/tlslite/scripts/tls.py | nagineni/chromium-crosswalk | 231 | 1698367 | <filename>third_party/tlslite/scripts/tls.py
#! python
import sys
import os
import os.path
import socket
import thread
import time
import httplib
import BaseHTTPServer
import SimpleHTTPServer
try:
from cryptoIDlib.api import *
cryptoIDlibLoaded = True
except:
cryptoIDlibLoaded = False
if __name__ != "__... | 0 | 0 | 0 | 0 | 0 | 0 |
cd4ml/problems/problem_base.py | ericnagler/CD4ML-Scenarios | 113 | 1698376 | from time import time
import numpy as np
from cd4ml.get_encoder import get_trained_encoder
from cd4ml.logger.fluentd_logging import FluentdLogger
from cd4ml.model_tracking import tracking
from cd4ml.model_tracking.validation_metrics import get_validation_metrics
from cd4ml.utils.problem_utils import Specification
from ... | 7 | 11 | 0 | 11 | 29 | 0 |
tests/sensors/test_ball_location_and_reward.py | LaudateCorpus1/holodeck | 518 | 1698379 | <reponame>LaudateCorpus1/holodeck
import uuid
import holodeck
import pytest
cfg = {
"name": "test_ball_location_and_reward",
"world": "CupGame",
"main_agent": "sphere0",
"agents": [
{
"agent_name": "sphere0",
"agent_type": "SphereAgent",
"sensors": [
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/regressiontests/templates/alternate_urls.py | kix/django | 790 | 1698391 | <filename>tests/regressiontests/templates/alternate_urls.py
# coding: utf-8
from __future__ import absolute_import
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
# View returning a template response
(r'^template_response_view/$', views.template_response_view),
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/annotate/train/scripts/populate_db.py | Granular-data/cloudless | 325 | 1698410 | <filename>src/annotate/train/scripts/populate_db.py
import argparse
import glob
import os
import shutil
from osgeo import gdal
from PIL import Image as pImage
import numpy as np
from django.apps import apps
from django.conf import settings
def import_images(dirname, chunk_size=256):
"""
Given a directory wi... | 0 | 0 | 0 | 0 | 0 | 0 |
pyftdi/serialext/protocol_unix.py | marcjordan2112/pyftdi | 345 | 1698419 | # Copyright (c) 2008-2016, <NAME> <<EMAIL>>
# Copyright (c) 2016, <NAME> <<EMAIL>>
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
# this file has not been updated for a while, so coding style needs some love
#pylint: disable-msg=broad-except
#pylint: disable-msg=attribute-defined-outside-init
#pylint... | 4 | 6 | 3 | 0 | 13 | 0 |
models/language_translation/tensorflow/transformer_lt_official/inference/fp32/infer_ab.py | yangw1234/models-1 | 357 | 1698420 | #
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 Intel Corporation
#
# 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 app... | 0 | 3 | 0 | 0 | 3 | 0 |
tests/neptune/new/internal/artifacts/test_serializer.py | Raalsky/neptune-client | 254 | 1698438 | <reponame>Raalsky/neptune-client
#
# Copyright (c) 2021, Neptune Labs Sp. z o.o.
#
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
pogom/pgoapi/protos/POGOProtos/Settings/InventorySettings_pb2.py | tier4fusion/pogom-updated | 2,557 | 1698439 | <gh_stars>1000+
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Settings/InventorySettings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
vstruct/defs/__init__.py | rnui2k/vivisect | 716 | 1698448 | <filename>vstruct/defs/__init__.py
# Import all local structure modules for resolve()
import vstruct.defs.elf
import vstruct.defs.pe
import vstruct.defs.win32
| 0 | 0 | 0 | 0 | 0 | 0 |
src/backend/api/api_trusted_parsers/json_alliance_selections_parser.py | bovlb/the-blue-alliance | 266 | 1698468 | from typing import AnyStr, List
from pyre_extensions import safe_json
from backend.common.datafeed_parsers.exceptions import ParserInputException
from backend.common.models.alliance import EventAlliance
from backend.common.models.keys import TeamKey
from backend.common.models.team import Team
class JSONAllianceSele... | 1 | 1 | 2 | 0 | 4 | 0 |
neurst/layers/metric_layers/__init__.py | ishine/neurst | 208 | 1698469 | <reponame>ishine/neurst
from collections import namedtuple
METRIC_REDUCTION = namedtuple(
"metric_reduction", "SUM MEAN")(0, 1)
REGISTERED_METRICS = dict()
def register_metric(name, redution):
if name in REGISTERED_METRICS:
raise ValueError(f"Metric {name} already registered.")
REGISTERED_METRIC... | 0 | 0 | 0 | 0 | 0 | 0 |
framework/Runners/PassthroughRunner.py | rinelson456/raven | 159 | 1698479 | # 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | 0 | 3 | 0 | 1 | 4 | 0 |
FW/edk2-ws/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5/src/util/confvalidator/validator.py | daxx-linux/edk-Lab_Material_FW | 372 | 1698487 | '''
Created on Jan 25, 2010
@author: tsitkova
'''
import os
import sys
import re
import yaml
from optparse import OptionParser
from confparser import ConfParser
class Rule(object):
def __init__(self):
pass
def validate(self,node):
(path,dirs,avs) = node
class Validator(object):
... | 0 | 0 | 0 | 0 | 0 | 0 |
problems/30/solution_30.py | r1cc4rdo/daily_coding_problem | 158 | 1698541 | <reponame>r1cc4rdo/daily_coding_problem
def coding_problem_30(arr):
"""
You are given an array of non-negative integers that represents a two-dimensional elevation map where each element
is unit-width wall and the integer is the height. Suppose it will rain and all spots between two walls get filled
up.... | 0 | 0 | 0 | 0 | 0 | 0 |
lyrebird/mock/blueprints/apis/snapshot.py | Hanlen520/lyrebird | 737 | 1698544 | <filename>lyrebird/mock/blueprints/apis/snapshot.py
import uuid
import traceback
from pathlib import Path
from flask import redirect, send_file
from lyrebird import application
from lyrebird.version import VERSION
from flask_restful import Resource, request
from urllib.parse import urlencode
from lyrebird.mock import c... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/maximum-product-difference-between-two-pairs.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1698554 | # Time: O(n)
# Space: O(1)
class Solution(object):
def maxProductDifference(self, nums) -> object:
"""
:type nums: List[int]
:rtype: int
"""
largest, smallest = [0]*2, [float("inf")]*2
for x in nums:
if x >= largest[0]:
largest[:] = [x, l... | 0 | 1 | 0 | 0 | 1 | 0 |
maistra/vendor/com_googlesource_chromium_v8/wee8/tools/clang/scripts/goma_link_unit_tests.py | knm3000/proxy | 575 | 1698571 | <gh_stars>100-1000
#! /usr/bin/env python3
# Copyright (c) 2020 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.
# Unit tests for goma_link.
#
# Usage:
#
# tools/clang/scripts/goma_link_unit_tests.py
#
# A coverage report... | 0 | 0 | 0 | 0 | 0 | 0 |
colossus/apps/templates/tests/factories.py | CreativeWurks/emailerpro | 372 | 1698621 | import factory
from colossus.apps.templates.models import EmailTemplate
class EmailTemplateFactory(factory.DjangoModelFactory):
name = factory.Sequence(lambda n: f'campaign_{n}')
class Meta:
model = EmailTemplate
| 0 | 0 | 0 | 0 | 0 | 0 |
blog/migrations/0003_auto_20200105_1611.py | regulusweb/wagtail_blog | 274 | 1698659 | # Generated by Django 2.2.9 on 2020-01-05 16:11
from django.db import migrations
import modelcluster.fields
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('blog', '0002_auto_20190605_1104'),
]
operations: list[object] = [
migrations.AlterField(
... | 0 | 0 | 2 | 0 | 2 | 0 |
artemis/general/pareto_efficiency.py | wouterkool/artemis | 235 | 1698668 | from artemis.general.should_be_builtins import all_equal
__author__ = 'peter'
import numpy as np
def is_pareto_efficient_dumb(costs) -> object:
"""
:param costs: An (n_points, n_costs) array
:return: A (n_points, ) boolean array, indicating whether each point is Pareto efficient
"""
is_efficient ... | 0 | 4 | 0 | 0 | 4 | 0 |
gluoncv/data/kinetics700/classification.py | RafLit/gluon-cv | 5,447 | 1698675 | <gh_stars>1000+
# pylint: disable=line-too-long,too-many-lines,missing-docstring
"""Kinetics700 video action recognition dataset.
Code adapted from https://github.com/open-mmlab/mmaction and
https://github.com/bryanyzhu/two-stream-pytorch"""
import os
from ..video_custom import VideoClsCustom
__all__ = ['Kinetics700']... | 0 | 0 | 0 | 0 | 0 | 0 |
alf/networks/preprocessor_networks.py | www2171668/alf | 175 | 1698700 | # Copyright (c) 2020 Horizon Robotics and ALF Contributors. 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... | 0 | 0 | 0 | 0 | 0 | 1 |
bad_cases/A_24_ports_switch/main.py | howl-anderson/MicroTokenizer | 136 | 1698708 | from MicroTokenizer import dag_tokenizer
dag_tokenizer.graph_builder.build_graph("二十四口交换机")
dag_tokenizer.graph_builder.write_graphml("output.graphml")
| 0 | 0 | 0 | 0 | 0 | 0 |
vibora/router/router.py | mnxzyw/vibora | 6,238 | 1698722 | <gh_stars>1000+
import base64
import hashlib
import re
import uuid
from collections import deque
from typing import get_type_hints
from inspect import iscoroutinefunction, isbuiltin, signature
from .parser import PatternParser
from ..limits import RouteLimits
from ..utils import clean_route_name, clean_methods
from ..e... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Tests/TestData/PydStdLib/Package/__init__.py | techkey/PTVS | 404 | 1698728 | import Package._testcapi
if False:
from Package import EphemeralReference
select = EphemeralReference
select = 123
select = str
| 0 | 0 | 0 | 0 | 0 | 0 |
ddtrace/contrib/botocore/patch.py | melancholy/dd-trace-py | 308 | 1698731 | <reponame>melancholy/dd-trace-py
"""
Trace queries to aws api done via botocore client
"""
import base64
import json
import botocore.client
from ddtrace import config
from ddtrace.vendor import wrapt
from ...constants import ANALYTICS_SAMPLE_RATE_KEY
from ...constants import SPAN_MEASURED_KEY
from ...ext import Span... | 0 | 0 | 0 | 0 | 0 | 0 |
components/datasets/HuggingFace/Load_dataset/component.py | nostro-im/pipelines | 2,860 | 1698763 | from typing import NamedTuple
from kfp.components import create_component_from_func, OutputPath
def load_dataset_using_huggingface(
dataset_name: str,
dataset_dict_path: OutputPath('HuggingFaceDatasetDict'),
) -> NamedTuple('Outputs', [
('splits', list),
]):
from datasets import load_dataset
dat... | 2 | 1 | 0 | 0 | 3 | 0 |
python_modules/libraries/dagster-k8s/dagster_k8s_tests/unit_tests/test_example_executor_mode_def.py | dbatten5/dagster | 4,606 | 1698766 | # start_marker
from dagster import ModeDefinition, default_executors, pipeline
from dagster_k8s import k8s_job_executor
@pipeline(mode_defs=[ModeDefinition(executor_defs=default_executors + [k8s_job_executor])])
def k8s_pipeline():
pass
# end_marker
def test_mode():
assert k8s_pipeline
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AntfarmProjectTargetInfo.py | antopen/alipay-sdk-python-all | 213 | 1698770 | <filename>alipay/aop/api/domain/AntfarmProjectTargetInfo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AntfarmProjectTargetInfo(object):
def __init__(self):
self._current_donation_count = None
self._donation_target_id = No... | 0 | 0 | 0 | 0 | 0 | 0 |
taskflow/patterns/linear_flow.py | JonasMie/taskflow | 299 | 1698797 | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! 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... | 1 | 3 | 0 | 0 | 4 | 0 |
tf_encrypted/keras/models/__init__.py | wqruan/tf-encrypted | 825 | 1698803 | <gh_stars>100-1000
"""Keras models in TF Encrypted."""
from __future__ import absolute_import
from .sequential import Sequential
from .sequential import clone_model
from .sequential import model_from_config
__all__ = [
"Sequential",
"model_from_config",
"clone_model",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
application/operator/NGSI-LD-Adapter/module/common_utilities/rest_client.py | jason-fox/fogflow | 102 | 1698808 | from __future__ import annotations
from flask import Flask, abort, request
import sys,os
sys.path.append('/opt/ngsildAdapter/module')
import json
import pickle
import datetime
import io
import requests
from consts import constant
from LogerHandler import Handler
import logging
class Rest_client:
def __init__(self,... | 0 | 2 | 0 | 0 | 2 | 0 |
autokeras/tasks/time_series_forecaster_test.py | mizolotu/tiny_ml | 4,704 | 1698813 | # Copyright 2020 The AutoKeras 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 i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_change.py | Zuehlke/ConfZ | 129 | 1698848 | <reponame>Zuehlke/ConfZ
import pytest
from confz import ConfZ, ConfZDataSource, depends_on
class Config1(ConfZ):
attr: int
CONFIG_SOURCES = ConfZDataSource(data={"attr": 1})
class Config2(ConfZ):
attr: int
CONFIG_SOURCES = ConfZDataSource(data={"attr": 2})
def test_change_sources():
# singl... | 0 | 0 | 0 | 0 | 0 | 0 |
txdav/xml/rfc5842.py | backwardn/ccs-calendarserver | 462 | 1698852 | ##
# Copyright (c) 2005-2017 Apple Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | 0 | 0 | 11 | 0 | 11 | 0 |
examples/simple/hello.py | sorphin/py2app | 193 | 1698862 | <filename>examples/simple/hello.py
import sys, os
import pprint
print(__file__)
__version__ = '1.0'
def somefunc():
print ("Hello from py2app")
print ("frozen: %s"%(repr(getattr(sys, "frozen", None)),))
import __main__
print (__main__.__file__)
print ("sys.path: %s"%(sys.path,))
print ("sys... | 0 | 0 | 0 | 0 | 0 | 0 |
libcloudforensics/providers/kubernetes/enumerations/base.py | jaegeral/cloud-forensics-utils | 241 | 1698876 | # -*- coding: utf-8 -*-
# Copyright 2021 Google 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 ... | 36 | 31 | 2 | 0 | 69 | 0 |
examples/circle.py | felixkosmalla/stpyv8 | 216 | 1698882 | <reponame>felixkosmalla/stpyv8
#!/usr/bin/env python
# circle.py - call a method in a javascript class from python
import STPyV8
with STPyV8.JSContext() as ctxt:
ctxt.eval("""
class Circle {
constructor(radius) {
this.radius = radius;
}
get area() {
return this.calcArea()
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ui/uidef.py | JayHeng/-NXP-MCUBootUtility | 174 | 1698897 | import wx
import sys, os
kToolRunMode_Entry = 0
kToolRunMode_Master = 1
kToolRunMode_SblOta = 2
kBootSeqColor_Invalid = wx.Colour( 64, 64, 64 )
kBootSeqColor_Optional = wx.Colour( 166, 255, 255 )
kBootSeqColor_Active = wx.Colour( 147, 255, 174 )
kBootSeqColor_Failed = wx.Colour( 255, 0, 0 )
kConnectStage_Rom ... | 0 | 0 | 0 | 0 | 0 | 0 |
respx/handlers.py | shadchin/respx | 297 | 1698925 | from typing import Any, Callable
import httpx
class TransportHandler:
def __init__(self, transport: httpx.BaseTransport) -> None:
self.transport = transport
def __call__(self, request: httpx.Request) -> httpx.Response:
if not isinstance(request.stream, httpx.SyncByteStream): # pragma: nocov... | 8 | 6 | 0 | 0 | 14 | 0 |
applications/ParticleMechanicsApplication/python_scripts/assign_initial_velocity_to_particle_process.py | lkusch/Kratos | 778 | 1698934 | <gh_stars>100-1000
import KratosMultiphysics
import KratosMultiphysics.ParticleMechanicsApplication as KratosParticle
def Factory(settings, Model):
if(not isinstance(settings, KratosMultiphysics.Parameters)):
raise Exception("expected input shall be a Parameters object, encapsulating a json string")
re... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/apollo/util/skvbc_exceptions.py | definitelyNotFBI/utt | 340 | 1698975 | <reponame>definitelyNotFBI/utt<filename>tests/apollo/util/skvbc_exceptions.py
# Concord
#
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
#
# This product is licensed to you under the Apache 2.0 license (the "License").
# You may not use this product except in compliance with the Apache 2.0 License.
#
# This pro... | 0 | 0 | 0 | 0 | 0 | 0 |
test/means/test_zero_mean.py | llguo95/gpytorch | 2,673 | 1699049 | <reponame>llguo95/gpytorch<filename>test/means/test_zero_mean.py
#!/usr/bin/env python3
import unittest
from gpytorch.means import ZeroMean
from gpytorch.test.base_mean_test_case import BaseMeanTestCase
class TestZeroMean(BaseMeanTestCase, unittest.TestCase):
def create_mean(self):
return ZeroMean()
| 0 | 0 | 0 | 0 | 0 | 0 |
ch05_clustering/audio_segmentation.py | duchce/TensorFlow | 4,893 | 1699054 | import tensorflow as tf
import numpy as np
from bregman.suite import *
k = 4
segment_size = 50 # out of 24,526
max_iterations = 100
chromo = tf.placeholder(tf.float32)
max_freqs = tf.argmax(chromo, 0)
def get_chromogram(audio_file) -> object:
F = Chromagram(audio_file, nfft=16384, wfft=8192, nhop=2205)
ret... | 0 | 6 | 0 | 0 | 6 | 0 |
tests/pulls/test_ticket.py | mubashshirjamal/code | 1,582 | 1699072 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from tests.base import TestCase
from vilya.models.pull import PullRequest
from vilya.models.ticket import Ticket, TicketComment
from vilya.models.linecomment import PullLineComment
from tests.utils import mkdtemp, setup_repos
from vilya.models.consts import LINECOMMENT_INDEX_EMPT... | 0 | 0 | 0 | 0 | 0 | 0 |
src/metric/nlspnmetric.py | zzangjinsun/NLSPN_ECCV20 | 181 | 1699171 | """
Non-Local Spatial Propagation Network for Depth Completion
<NAME>, <NAME>, <NAME>, <NAME> and <NAME>
European Conference on Computer Vision (ECCV), Aug 2020
Project Page : https://github.com/zzangjinsun/NLSPN_ECCV20
Author : <NAME> (<EMAIL>)
===============================================... | 0 | 1 | 0 | 2 | 3 | 0 |
alipay/aop/api/response/AntMerchantExpandIndirectSourceQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 1699173 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AntMerchantExpandIndirectSourceQueryResponse(AlipayResponse):
def __init__(self):
super(AntMerchantExpandIndirectSourceQueryResponse, self).__init__()
self._indirect_... | 0 | 2 | 0 | 2 | 4 | 0 |
do_wide_and_deep_networks_learn_the_same_things/cifar_train.py | xxdreck/google-research | 23,901 | 1699190 | # coding=utf-8
# Copyright 2021 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... | 11 | 9 | 0 | 0 | 20 | 0 |
tests/styles/parser/token_parser_tests.py | cockcrow/python-mammoth | 557 | 1699204 | <reponame>cockcrow/python-mammoth
from nose.tools import istest, assert_equal
from mammoth.styles.parser.tokeniser import Token, TokenType
from mammoth.styles.parser.token_parser import decode_escape_sequences, parse_identifier, parse_string
from mammoth.styles.parser.token_iterator import TokenIterator
@istest
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
components/partition_table/gen_empty_partition.py | lovyan03/esp-idf | 8,747 | 1699207 | <reponame>lovyan03/esp-idf<gh_stars>1000+
#!/usr/bin/env python
#
# generates an empty binary file
#
# This tool generates an empty binary file of the required size.
#
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/576727_Pure_PythimplementatiPEP_380_yield/recipe-576727.py | tdiprima/code | 2,023 | 1699219 | from compat.functools import wraps as _wraps
from sys import exc_info as _exc_info
class _from(object):
def __init__(self, EXPR):
self.iterator = iter(EXPR)
def supergenerator(genfunct) -> object:
"""Implements PEP 380. Use as:
@supergenerator
def genfunct(*args):
try:
... | 0 | 1 | 0 | 0 | 1 | 0 |
envi/tests/test_symstore.py | pombredanne/vivisect | 716 | 1699232 | import envi.symstore.resolver as e_sym_resolv
import unittest
class SymResolverTests(unittest.TestCase):
def setUp(self):
self.symres = e_sym_resolv.SymbolResolver()
def test_sym(self):
fname, base, size, width = ('foo', 0x1234, 0x5678, 4)
fres = e_sym_resolv.FileSymbol(fname, base, s... | 0 | 0 | 0 | 0 | 0 | 0 |
art/attacks/poisoning/perturbations/__init__.py | monshri/adversarial-robustness-toolbox | 1,350 | 1699254 | """
Module providing perturbation functions under a common interface
"""
from art.attacks.poisoning.perturbations.image_perturbations import (
add_pattern_bd,
add_single_bd,
insert_image,
)
| 0 | 0 | 0 | 0 | 0 | 0 |
se/main.py | vr8hub/tools | 985 | 1699324 | """
This file contains the entry point for the `se` command.
"""
import argparse
import importlib
import pkgutil
import sys
from typing import List
import se.commands
def get_commands() -> List[str]:
"""
Helper function to generate a list of available commands from all of the submodules in the se.cmd package
"""... | 0 | 2 | 0 | 0 | 2 | 0 |
SMPyBandits/Arms/RestlessArm.py | balbok0/SMPyBandits | 309 | 1699329 | """
author: <NAME>
Restless arm, i.e. arms with mean value which change at each round
"""
try:
from . import Arm, Bernoulli, Binomial, UnboundedExponential, UnboundedGaussian, Constant, UnboundedPoisson
except ImportError:
from Arm import Arm
from Bernoulli import Bernoulli
from Binomial import Binomial... | 3 | 1 | 0 | 0 | 4 | 0 |
butterfree/transform/transformations/transform_component.py | fossabot/butterfree | 208 | 1699339 | <gh_stars>100-1000
"""Transform Abstract Class."""
from abc import ABC, abstractmethod
from typing import Any, List
from pyspark.sql import DataFrame
class TransformComponent(ABC):
"""Defines an abstract class for Transform entities.
Attributes:
parent: parent transform component.
"""
def _... | 0 | 0 | 0 | 0 | 0 | 0 |
onnx2torch/node_converters/registry.py | niobeus/onnx2torch | 144 | 1699347 | <reponame>niobeus/onnx2torch
import logging
from typing import Callable
from typing import NamedTuple
from onnx import defs
from onnx2torch.onnx_graph import OnnxGraph
from onnx2torch.onnx_node import OnnxNode
from onnx2torch.utils.common import OperationConverterResult
_LOGGER = logging.getLogger(__name__)
_CONVERT... | 0 | 0 | 0 | 0 | 0 | 0 |
pyNastran/converters/nastran/nastran_to_surf.py | ACea15/pyNastran | 293 | 1699353 | from __future__ import annotations
"""
defines:
- clear_out_solids(bdf_filename, bdf_filename_out=None,
equivalence=True, renumber=True, equivalence_tol=0.01)
- nastran_to_surf(bdf_filename, pid_to_element_flags, surf_filename,
renumber_pids=None, line_map=None,
... | 10 | 3 | 0 | 0 | 13 | 0 |
wrappers/Python/CoolProp/tests/test_Props.py | pauliacomi/CoolProp | 520 | 1699372 | import unittest
from CoolProp.CoolProp import PropsSI
import CoolProp
import numpy as np
def test_input_types():
for Fluid in ['Water']:
for Tvals in [0.5 * PropsSI(Fluid, 'Tmin') + 0.5 * PropsSI(Fluid, 'Tcrit'),
[PropsSI(Fluid, 'Tmin') + 1e-5, PropsSI(Fluid, 'Tcrit') - 1e-5],
... | 0 | 0 | 0 | 0 | 0 | 0 |
100-200q/128.py | rampup01/Leetcode | 990 | 1699376 | <reponame>rampup01/Leetcode
'''
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
Your algorithm should run in O(n) complexity.
Example:
Input: [100, 4, 200, 1, 3, 2]
Output: 4
Explanation: The longest consecutive elements sequence is [1, 2, 3, 4]. Therefore its... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.