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 |
|---|---|---|---|---|---|---|---|---|---|---|
bython/logger.py | sairam4123/bython | 387 | 1782508 | import sys
class Logger(object):
""" Logger class. Writes errors and info to the cmd line. """
def __init__(self, verbose: bool=False):
"""
Initialize a logger object.
Args:
verbose (boolean): If True, the logger will print all status
... | 1 | 0 | 0 | 0 | 1 | 0 |
analysis/subtoken_reuse_stats.py | s1530129650/convolutional-attention | 128 | 1782513 | <reponame>s1530129650/convolutional-attention<filename>analysis/subtoken_reuse_stats.py<gh_stars>100-1000
import json
import sys
from collections import Counter
from itertools import chain
if __name__ == "__main__":
if len(sys.argv) < 2:
print 'Usage <input_file>'
sys.exit(-1)
input_file = sys... | 0 | 0 | 0 | 0 | 0 | 0 |
service/learner/learner.py | lcrh/falken | 213 | 1782517 | # Copyright 2021 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, ... | 3 | 5 | 1 | 2 | 11 | 0 |
openrasp_iast/core/model/config_model.py | G3G4X5X6/openrasp-iast | 380 | 1782522 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from __future__ import annotations
"""
Copyright 2017-2020 Baidu 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/licen... | 0 | 3 | 0 | 0 | 3 | 0 |
robomimic/scripts/generate_config_templates.py | akolobov/robomimic | 107 | 1782529 | """
Helpful script to generate example config files for each algorithm. These should be re-generated
when new config options are added, or when default settings in the config classes are modified.
"""
import os
import json
import robomimic
from robomimic.config import get_all_registered_configs
def main():
# sto... | 0 | 0 | 0 | 0 | 0 | 0 |
open-codegen/opengen/constraints/cartesian.py | elsuizo/optimization-engine | 253 | 1782572 | from . import constraint
from typing import List
class CartesianProduct(constraint.Constraint):
def __init__(self, segments: List[int], constraints: List[constraint.Constraint]):
"""
Construct a Cartesian product of constraints by providing a list of sets
and their dimensions as follows: ... | 2 | 6 | 0 | 0 | 8 | 0 |
src/greenletio/core.py | miguelgrinberg/greenletio | 131 | 1782655 | import asyncio
import functools
import sys
from greenlet import greenlet, getcurrent
class GreenletBridge:
def __init__(self):
self.bridge_greenlet: None = None
def run(self):
async def async_run():
gl = getcurrent().parent
coro = gl.switch()
while gl and c... | 0 | 7 | 0 | 1 | 8 | 0 |
skl2onnx/common/utils_checking.py | xiaowuhu/sklearn-onnx | 323 | 1782765 | # SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from inspect import signature
from collections import OrderedDict
def check_signature(fct, reference, skip: object | None=None) -> object:
"""
Checks that two functions have the same signature
(same parameter names).
Raises an ... | 1 | 2 | 0 | 0 | 3 | 0 |
L1Trigger/RegionalCaloTrigger/python/l1RctValidation_cfi.py | ckamtsikis/cmssw | 852 | 1782864 | import FWCore.ParameterSet.Config as cms
l1RctValidation = cms.EDAnalyzer("L1RCTRelValAnalyzer",
rctRegionsLabel = cms.InputTag("rctDigis"),
rctEmCandsLabel = cms.InputTag("rctDigis")
)
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/r/test_colon.py | hajime9652/observations | 199 | 1782874 | <filename>tests/r/test_colon.py<gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.colon import colon
def test_colon():
"""Test module colon.py by downloading
colon.csv and t... | 0 | 0 | 0 | 0 | 0 | 0 |
addons/metadata.themoviedb.org.python/python/lib/tmdbscraper/__init__.py | RetroFlix/retroflix.repo | 420 | 1782875 | <reponame>RetroFlix/retroflix.repo<gh_stars>100-1000
def get_imdb_id(uniqueids):
imdb_id = uniqueids.get('imdb')
if not imdb_id or not imdb_id.startswith('tt'):
return None
return imdb_id
# example format for scraper results
_ScraperResults = {
'info',
'ratings',
'uniqueids',
'cast... | 0 | 0 | 0 | 0 | 0 | 0 |
BMP280/python/BMP280_test.py | kellerjustin/rpi-examples | 126 | 1782878 | <reponame>kellerjustin/rpi-examples
#!/usr/bin/python
# Depends on Adafruit Python BMP from <NAME>:
# https://github.com/bastienwirtz/Adafruit_Python_BMP
import Adafruit_BMP.BMP280 as BMP280
sensor = BMP280.BMP280()
print 'Temperature: {0:0.2f} *C'.format(sensor.read_temperature())
print 'Barometric Pressure: {0:0.2... | 0 | 0 | 0 | 0 | 0 | 0 |
loss/consistency_loss.py | iamreallyi9/cd | 1,205 | 1782879 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn as nn
from utils.torch_helpers import _device
from utils.geometry import (
pixel_grid,
focal_length,
project,
pixels_to_points,
reproject_points,
sample,
)
def select_tensors(x) -> object:
... | 5 | 8 | 0 | 0 | 13 | 0 |
mimic3benchmark/__init__.py | vadim0x60/mimic3-benchmarks | 580 | 1782884 | import mimic3benchmark.mimic3csv
import mimic3benchmark.subject
import mimic3benchmark.preprocessing
import mimic3benchmark.util
| 0 | 0 | 0 | 0 | 0 | 0 |
Chapter08/tcp_chat.py | trappn/Mastering-GUI-Programming-with-Python | 138 | 1782904 | <filename>Chapter08/tcp_chat.py<gh_stars>100-1000
import sys
from PyQt5 import QtWidgets as qtw
from PyQt5 import QtNetwork as qtn
from PyQt5 import QtCore as qtc
class TcpChatInterface(qtc.QObject):
"""Network interface for chat messages."""
port = 7777
delimiter = '||'
received = qtc.pyqtSignal(str... | 0 | 0 | 0 | 0 | 0 | 0 |
graphql_compiler/tests/schema_transformation_tests/test_rename_query.py | kensho-technologies/graphql-compiler | 521 | 1782912 | # Copyright 2019-present Kensho Technologies, LLC.
from textwrap import dedent
import unittest
from graphql import parse
from graphql.language.printer import print_ast
from ...exceptions import GraphQLValidationError
from ...schema_transformation.rename_query import rename_query
from ...schema_transformation.rename_s... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/image/Image_gan/gan/wav2lip/module.py | AK391/PaddleHub | 8,360 | 1782937 | <reponame>AK391/PaddleHub<gh_stars>1000+
# Copyright (c) 2021 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... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/preconditioning.py | pierreablin/autoptim | 101 | 1782945 | <filename>tutorials/preconditioning.py
# Author: <NAME> <<EMAIL>>
# License: MIT
# An example about preconditioning: the problem is to minimize
# || y - X.dot(beta)|| ** 2 + lambda * || beta || ** 2.
# The Hessian of the problem is 2 * (X^TX + lambda * Id).
# For approximately decorellated X, it is well approximated b... | 0 | 0 | 0 | 0 | 0 | 0 |
train.py | ZihaoWang-233/CAMP_iccv19 | 116 | 1782949 | <reponame>ZihaoWang-233/CAMP_iccv19<filename>train.py
import pickle
import os
import time
import shutil
import torch
import yaml
from easydict import EasyDict
import data
from vocab import Vocabulary # NOQA
from model import CAMP
from evaluation import i2t, t2i, AverageMeter, LogCollector, encode_data
import loggin... | 0 | 0 | 0 | 0 | 0 | 0 |
raspberryturk/core/data/raw_pixels_extractor.py | Dzhuks/raspberryturk | 169 | 1782984 | <gh_stars>100-1000
import numpy as np
from raspberryturk.core.data.feature_extractor import FeatureExtractor
from sklearn.preprocessing import normalize
class RawPixelsExtractor(FeatureExtractor):
def extract_features(self, square):
return (square.raw_img.flatten() / 127.5) - 1.0
| 0 | 0 | 0 | 0 | 0 | 0 |
src/oci/data_safe/data_safe_client_composite_operations.py | Manny27nyc/oci-python-sdk | 249 | 1782999 | # 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 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | 90 | 30 | 0 | 0 | 120 | 0 |
Chapter16/extract_from_tag.py | add54/ADMIN_SYS_PYTHON | 116 | 1783019 | import requests
from bs4 import BeautifulSoup
page_result = requests.get('https://www.imdb.com/news/top?ref_=nv_nw_tp')
parse_obj = BeautifulSoup(page_result.content, 'html.parser')
top_news = parse_obj.find(class_='news-article__content')
top_news_a_content = top_news.find_all('a')
print(top_news_a_content)
| 0 | 0 | 0 | 0 | 0 | 0 |
datasketch/hashfunc.py | sergiiz/datasketch | 1,771 | 1783042 | import hashlib
import struct
def sha1_hash32(data) -> object:
"""A 32-bit hash function based on SHA1.
Args:
data (bytes): the data to generate 32-bit integer hash from.
Returns:
int: an integer hash value that can be encoded using 32 bits.
"""
return struct.unpack('<I', hashlib.s... | 0 | 2 | 0 | 0 | 2 | 0 |
opt/config.py | bj80heyue/One_Shot_Face_Reenactment | 183 | 1783070 | # -*- coding: utf-8 -*-
import argparse
import torch
class BaseOptions():
def __init__(self):
"""Reset the class; indicates the class hasn't been initailized"""
self.initialized: bool = False
def initialize(self, misc_arg) -> object:
# data set
misc_arg.add_argument('--batch_s... | 0 | 2 | 0 | 1 | 3 | 0 |
splearn/decomposition/truncated_svd.py | dtrckd/sparkit-learn | 1,219 | 1783112 | from __future__ import annotations
from operator import add
import numpy as np
import scipy.linalg as ln
import scipy.sparse as sp
# from pyspark import AccumulatorParam
from sklearn.decomposition import TruncatedSVD
from sklearn.utils.extmath import safe_sparse_dot
from ..base import SparkBroadcasterMixin
from ..rdd... | 9 | 8 | 1 | 0 | 18 | 0 |
Basic/Convert Decimal To Binary/SolutionByVaishnavi.py | rajethanm4/Programmers-Community | 261 | 1783113 | #To convert decimal to binary number
def decimalToBinary(num):
if num > 1:
decimalToBinary(num//2)
print(num%2,end='')
num = int(input('Decimal No= '))
decimalToBinary(num)
| 0 | 0 | 0 | 0 | 0 | 0 |
RecoEcal/EgammaClusterProducers/python/egammaSimpleAnalyzer_cfi.py | ckamtsikis/cmssw | 852 | 1783129 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
#
# simple analyzer to make histos within a framework job off the super clusters in the event
# Author: <NAME>, University of Rome & INFN
#
egammaSimpleAnalyzer = cms.EDAnalyzer("EgammaSimpleAnalyzer",
xMaxHist = cms.double(60.... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_tracing.py | MJ111/profiling | 2,287 | 1783137 | <gh_stars>1000+
# -*- coding: utf-8 -*-
import sys
import pytest
from _utils import factorial, find_stats, foo
from profiling.stats import RecordingStatistics
from profiling.tracing import TracingProfiler
def test_setprofile():
profiler = TracingProfiler()
assert sys.getprofile() is None
with profiler:
... | 0 | 0 | 0 | 0 | 0 | 0 |
stonesoup/platform/__init__.py | Red-Portal/Stone-Soup-1 | 157 | 1783154 | # -*- coding: utf-8 -*-
from .base import Platform, MovingPlatform, FixedPlatform, MultiTransitionMovingPlatform
__all__ = ['Platform', 'MovingPlatform', 'FixedPlatform', 'MultiTransitionMovingPlatform']
| 0 | 0 | 0 | 0 | 0 | 0 |
code/feature_extractor/for_image_data/models.py | jiaruonan/transferlearning | 9,657 | 1783156 | <gh_stars>1000+
import torch
import torch.nn as nn
import backbone
class Network(nn.Module):
def __init__(self, base_net='alexnet', n_class=31):
super(Network, self).__init__()
self.n_class = n_class
self.base_network = backbone.network_dict[base_net]()
self.classifier_layer = nn.L... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/salsa/__init__.py | hase1128/dragonfly | 675 | 1783170 | <filename>examples/salsa/__init__.py<gh_stars>100-1000
"""
Demo on the Shrunk Additive Least Squares Approximations method (SALSA) for high
dimensional regression.
-- <EMAIL>
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/lib_util.py | CuteChibiko/TalkingData | 109 | 1783171 | from __future__ import annotations
import sys
# this script makes it possible to describe a model in one argument.
default_target = 'model=LGBM_feat=lgbmBest_categoricalThreVal=10000_validation=subm_params=-,gbdt,0.45,0.04,188,7,auc,20,5,0,70,76,binary,0,0,32.0,1.0,200000,1,0'
target = ''
def get_opt(name,default: o... | 1 | 3 | 0 | 0 | 4 | 0 |
Chapter07/video_test.py | trappn/Mastering-GUI-Programming-with-Python | 138 | 1783178 | from PyQt5.QtCore import *
from PyQt5.QtMultimedia import *
app = QCoreApplication([])
for camera_info in QCameraInfo.availableCameras():
print('Camera: ', camera_info.deviceName())
camera = QCamera(camera_info)
r = QMediaRecorder(camera)
print('\tAudio Codecs: ', r.supportedAudioCodecs())
print('... | 0 | 0 | 0 | 0 | 0 | 0 |
mms/metrics/unit.py | dhanainme/multi-model-server | 527 | 1783195 | <reponame>dhanainme/multi-model-server
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
# http://www.apache.org/licenses... | 0 | 0 | 0 | 0 | 0 | 0 |
model_search/single_trainer_test.py | dywsjtu/model_search | 3,315 | 1783221 | # Copyright 2021 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, ... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/munge_make_log.py | Hirni-Meshram2/cython-blis | 185 | 1783229 | <gh_stars>100-1000
import os
import sys
import json
os_name = sys.argv[1]
arch_name = sys.argv[2]
print(json.dumps({"environment": dict(os.environ)}))
for line in sys.stdin:
if 'flatten-headers.py' in line:
continue
line = line.replace('include/' + arch_name, 'include/' + os_name + '-' + arch_name)
... | 0 | 0 | 0 | 0 | 0 | 0 |
the-waf-apigateway/python/the_waf_apigateway/apigateway.py | mttfarmer/serverless | 1,627 | 1783264 | <reponame>mttfarmer/serverless
from aws_cdk import (
aws_cloudformation as cfn,
aws_logs as cw_logs,
aws_lambda as _lambda,
aws_apigateway as api_gw,
core
)
class Apigateway(cfn.NestedStack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope,... | 0 | 0 | 0 | 0 | 0 | 0 |
Exscript/stdlib/connection.py | saveshodhan/exscript | 226 | 1783265 | <filename>Exscript/stdlib/connection.py
#
# Copyright (C) 2010-2017 <NAME>
# The MIT License (MIT)
#
# 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 l... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/r_privacy/app.py | mainyordle/reddit2telegram | 187 | 1783298 | #encoding:utf-8
subreddit = 'privacy'
t_channel = '@r_privacy'
def send_post(submission, r2t) -> object:
return r2t.send_simple(submission)
| 0 | 1 | 0 | 0 | 1 | 0 |
konoha/__init__.py | altescy/konoha | 149 | 1783336 | """__init__.py."""
from importlib_metadata import version
from konoha.sentence_tokenizer import SentenceTokenizer # NOQA
from konoha.word_tokenizer import WordTokenizer # NOQA
__version__ = version("konoha")
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/train_tvbr.py | mengzaiqiao/TVBR | 126 | 1783337 | import sys
sys.path.append("../")
import argparse
import math
import os
from ray import tune
from tqdm import tqdm
from beta_rec.core.train_engine import TrainEngine
from beta_rec.models.tvbr import TVBREngine
from beta_rec.utils.constants import MAX_N_UPDATE
from beta_rec.utils.monitor import Monitor
def parse_a... | 0 | 2 | 0 | 0 | 2 | 0 |
recipes/Python/440481_Strips_XMLHTML_Tags_from_string/recipe-440481.py | tdiprima/code | 2,023 | 1783360 | #!/usr/bin/python
# Routine by <NAME>
# Submitted on 26 Aug 2005
# This routine is allowed to be put under any license Open Source (GPL, BSD, LGPL, etc.) License
# or any Propriety License. Effectively this routine is in public domain. Please attribute where appropriate.
def strip_ml_tags(in_text) -> object:
"""Des... | 0 | 1 | 0 | 0 | 1 | 0 |
humble_api/__init__.py | wahrwolf/hb-downloader | 195 | 1783367 | __author__ = "<NAME>, <NAME>"
__copyright__ = "Copyright 2014 <NAME>, 2016 <NAME>"
__license__ = "MIT"
__all__ = ["Events", "HumbleApi", "HumbleHash"]
| 0 | 0 | 0 | 0 | 0 | 0 |
osint_scraper/conftest.py | Necrno/osint-scraper | 314 | 1783484 | <reponame>Necrno/osint-scraper
"""Fixture and request setup for test."""
from pyramid.config import Configurator
import pytest
from osint_scraper.scripts.recon_handler import recon_handler
def main(global_config, **settings):
"""Function returns a Pyramid WSGI application."""
config = Configurator(setting... | 0 | 0 | 0 | 0 | 0 | 0 |
reward_function.py | QasimWani/CityLearn | 202 | 1783510 | <reponame>QasimWani/CityLearn<filename>reward_function.py
"""
This function is intended to wrap the rewards returned by the CityLearn RL environment, and is meant to
be modified at will. This reward_function takes all the electrical demands and carbon intensity of all the buildings and turns them into one or multipl... | 0 | 0 | 0 | 0 | 0 | 0 |
qcfractal/alembic/versions/c05d63683601_fix_indices_base_result_molecule.py | MolSSI/dqm_server | 113 | 1783536 | <filename>qcfractal/alembic/versions/c05d63683601_fix_indices_base_result_molecule.py
"""Add/fix some indices on base_result and molecule
Revision ID: c05d63683601
Revises: 5be555fe9dc0
Create Date: 2021-03-04 11:29:11.780381
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/_downloads/4f734847a595a9639b8ed8924a649062/parallelism_tutorial.py | woojinsong/PyTorch-tutorials-kr | 221 | 1783600 | <filename>docs/_downloads/4f734847a595a9639b8ed8924a649062/parallelism_tutorial.py
# -*- coding: utf-8 -*-
"""
멀티-GPU 예제
==================
데이터 병렬 처리(Data Parallelism)는 미니-배치를 여러 개의 더 작은 미니-배치로
자르고 각각의 작은 미니배치를 병렬적으로 연산하는 것입니다.
데이터 병렬 처리는 ``torch.nn.DataParallel`` 을 사용하여 구현합니다.
``DataParallel`` 로 감쌀 수 있는 모듈은 배치 차원(ba... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/squad/run_finetuning.py | uds-lsv/bert-stable-fine-tuning | 107 | 1783606 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# 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 cop... | 0 | 0 | 0 | 0 | 0 | 1 |
lib/utils/subprocess.py | kruda/DetectAndTrack | 1,007 | 1783627 | ##############################################################
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
##############################################################
fro... | 1 | 1 | 0 | 0 | 2 | 0 |
dependencies/quex-0.34.1/quex/DEFINITIONS.py | lavrod/grit-engine | 109 | 1783648 | <reponame>lavrod/grit-engine
#! /usr/bin/env python
# Quex is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
#... | 0 | 0 | 0 | 0 | 0 | 0 |
src/third_party/dpkt/dpkt/ntp.py | ashumeow/pcaphar | 115 | 1783659 | <reponame>ashumeow/pcaphar<filename>src/third_party/dpkt/dpkt/ntp.py
# $Id: ntp.py 48 2008-05-27 17:31:15Z yardley $
"""Network Time Protocol."""
import dpkt
# NTP v4
# Leap Indicator (LI) Codes
NO_WARNING = 0
LAST_MINUTE_61_SECONDS = 1
LAST_MINUTE_59_SECONDS = 2
ALARM_CONDITION = 3
# Mode Codes
RESERVED = 0
SY... | 0 | 0 | 0 | 0 | 0 | 0 |
inventory/apps.py | nathandarnell/sal | 215 | 1783674 | <gh_stars>100-1000
from django.apps import AppConfig
class InventoryAppConfig(AppConfig):
name = "inventory"
| 0 | 0 | 0 | 0 | 0 | 0 |
models.py | pku7yang/structured | 145 | 1783676 | <reponame>pku7yang/structured<filename>models.py
import tensorflow as tf
from neural import dynamicBiRNN, LReLu, MLP, get_structure
import numpy as np
class StructureModel():
def __init__(self, config):
self.config = config
t_variables = {}
t_variables['keep_prob'] = tf.placeholder(tf.fl... | 0 | 0 | 0 | 0 | 0 | 0 |
softlearning/models/utils.py | pedrodbs/mbpo | 299 | 1783756 | def build_metric_learner_from_variant(variant, env, evaluation_data) -> object:
sampler_params = variant['sampler_params']
metric_learner_params = variant['metric_learner_params']
metric_learner_params.update({
'observation_shape': env.observation_space.shape,
'max_distance': sampler_params[... | 0 | 1 | 0 | 0 | 1 | 0 |
corehq/apps/cloudcare/tests/test_doc_tests.py | dimagilg/commcare-hq | 471 | 1783772 | <reponame>dimagilg/commcare-hq
import doctest
import corehq.apps.cloudcare.views
def test_view_doctests():
results = doctest.testmod(corehq.apps.cloudcare.views)
assert results.failed == 0, results
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/kvs_compression_flags.py | efeslab/hse | 558 | 1783894 | #!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2021 Micron Technology, Inc. All rights reserved.
from contextlib import ExitStack
from hse2 import hse
from utility import lifecycle, cli
hse.init(cli.CONFIG)
try:
with ExitStack() as stack:
kvdb_ctx = lifecycle.KvdbContext... | 0 | 0 | 0 | 0 | 0 | 0 |
quantlib/test/test_parse_ql_version_string.py | bpmbank/pyql | 488 | 1783905 | <gh_stars>100-1000
from .unittest_tools import unittest
from quantlib.util.version import parse_ql_version_string
class TestParseQlVersionString(unittest.TestCase):
def test_match_valid(self):
version = parse_ql_version_string("1.2")
self.assertEqual(version, (1, 2, None, None))
version... | 0 | 0 | 0 | 0 | 0 | 0 |
kivystudio/components/emulator_area/__init__.py | hashfx/kivystudio | 165 | 1783929 | from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.behaviors import ToggleButtonBehavior
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
from kivy.properties import ObjectProperty, StringProperty
fr... | 0 | 1 | 0 | 1 | 2 | 0 |
vendor/distribute-0.6.34/setuptools/command/register.py | hmoody87/heroku-buildpack-python-ffmpeg-lame | 790 | 1783946 | from distutils.command.register import register as _register
class register(_register):
__doc__ = _register.__doc__
def run(self):
# Make sure that we are using valid current name/version info
self.run_command('egg_info')
_register.run(self)
| 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/W3D2_DynamicNetworks/solutions/W3D2_Tutorial2_Solution_cec4906e.py | raxosiris/course-content | 2,294 | 1783990 | <gh_stars>1000+
"""
Discussion:
Here we observe a paradoxical effect; if we inject excitatory current to the I
population, the r_I goes down, whereas when we inject inhibitory current, the r_I
increases. Recall that we inject a constant excitatory current to the E population,
which also drives, indirectly, the I popu... | 0 | 0 | 0 | 0 | 0 | 0 |
4-Object_Detection/RPN/utils.py | haigh1510/TensorFlow2.0-Examples | 1,775 | 1784000 | <gh_stars>1000+
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : utils.py
# Author : YunYang1994
# Created date: 2019-10-19 23:04:24
# Description :
#
#=========... | 0 | 0 | 0 | 0 | 0 | 0 |
evaluate_retrieval.py | Callidior/semantic-embeddings | 238 | 1784008 | <filename>evaluate_retrieval.py
import numpy as np
import numexpr as ne
import argparse, pickle, os.path
from collections import OrderedDict
from datasets import get_data_generator
from class_hierarchy import ClassHierarchy
try:
from tqdm import tqdm
except ImportError:
def tqdm(it, **kwargs):
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/play_sound_globally.py | upgradeQ/OBS-Studio-Python-Scripting-Cheatsheet | 116 | 1784017 | <gh_stars>100-1000
# based on https://gist.github.com/Palakis/2b7a0e872c66d209050f6e01b60f1c94
import obspython as S
mediaSource = None # Null pointer
outputIndex = 63 # Last index
def play_sound():
mediaSource = S.obs_source_create_private(
"ffmpeg_source", "Global Media Source", None
)
... | 0 | 0 | 0 | 0 | 0 | 0 |
doc/labs/datasets/viz_volume_grid.py | bpinsard/nipy | 236 | 1784055 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Use Mayavi to visualize the structure of a VolumeGrid
"""
from enthought.mayavi import mlab
import numpy as np
from enthought.tvtk.api import tvtk
dims = (4, 4, 4)
x, y, z = np.mgrid[0.:dims[0], 0:di... | 0 | 0 | 0 | 0 | 0 | 0 |
torchelie/nn/__init__.py | maxferrari/Torchelie | 117 | 1784056 | <filename>torchelie/nn/__init__.py
from .reshape import Reshape, Lambda
from .conv import *
from .debug import Debug, Dummy
from .noise import Noise
from .vq import VQ, MultiVQ
from .imagenetinputnorm import ImageNetInputNorm
from .withsavedactivations import WithSavedActivations
from .maskedconv import MaskedConv2d, T... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/alchemyapp/models.py | sarahboyce/factory_boy | 1,932 | 1784072 | # Copyright: See the LICENSE file.
"""Helpers for testing SQLAlchemy apps."""
from sqlalchemy import Column, Integer, Unicode, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
session = scoped_session(sessionmaker())
engine = create_engine... | 0 | 0 | 5 | 0 | 5 | 0 |
survae/transforms/bijections/coupling/coupling.py | alisiahkoohi/survae_flows | 262 | 1784119 | <reponame>alisiahkoohi/survae_flows
import torch
from survae.transforms.bijections import Bijection
class CouplingBijection(Bijection):
"""Transforms each input variable with an invertible elementwise bijection.
This input variables are split in two parts. The second part is transformed conditioned on the fi... | 0 | 0 | 0 | 0 | 0 | 0 |
quantsbin/__init__.py | quantsbin/Quantsbin | 132 | 1784138 | """
Code is still in its development phase.
Developer: Quantsbin (Jasmeet)
Last Modified Date: 4th March 2018
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
checkov/kubernetes/checks/resource/k8s/k8s_check_utils.py | pmalkki/checkov | 4,013 | 1784151 | from typing import List
def extract_commands(conf: dict) -> (List[str], List[str]):
commands: List[str] = conf.get("command")
if not commands:
return [], []
values = []
keys = []
for cmd in commands:
if cmd is None:
continue
if "=" in cmd:
firstEqual... | 1 | 1 | 1 | 0 | 3 | 0 |
src/c3nav/api/models.py | johnjohndoe/c3nav | 132 | 1784184 | <gh_stars>100-1000
import string
from django.conf import settings
from django.db import models
from django.utils.crypto import constant_time_compare, get_random_string
from django.utils.translation import ugettext_lazy as _
class Token(models.Model):
"""
Token for log in via API
"""
user = models.For... | 0 | 0 | 0 | 0 | 0 | 0 |
snips_nlu/tests/test_probabilistic_intent_parser.py | CharlyBlavier/snips-nlu-Copy | 3,764 | 1784228 | from __future__ import unicode_literals
import io
from future.utils import itervalues
from mock import patch
from snips_nlu.constants import (
RES_ENTITY, RES_INTENT, RES_INTENT_NAME, RES_SLOTS, RES_VALUE,
RANDOM_STATE)
from snips_nlu.dataset import Dataset
from snips_nlu.exceptions import IntentNotFoundErro... | 0 | 6 | 0 | 0 | 6 | 0 |
docs/source/conf.py | Takaaki-Inaba/ucx | 689 | 1784238 | # -*- coding: utf-8 -*-
#
# Copyright (C) Mellanox Technologies Ltd. 2019. ALL RIGHTS RESERVED.
# Copyright (C) Arm Ltd. 2021. ALL RIGHTS RESERVED.
#
# See file LICENSE for terms.
#
#
# Project information
#
project = u'OpenUCX'
copyright = u'2019, UCF'
author = u'UCF'
#
# General options
#
extensions ... | 0 | 1 | 0 | 0 | 1 | 0 |
sdk/attestation/azure-security-attestation/tests/test_policy_getset_async.py | rsdoherty/azure-sdk-for-python | 2,728 | 1784249 | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------... | 1 | 6 | 0 | 0 | 7 | 0 |
misc/1_UMAP_create_data_set_collapsed_091020.py | justinshenk/simba | 172 | 1784293 | <reponame>justinshenk/simba
import os, glob
import pandas as pd
########### READ IN DATA ###########
filesFolder =
outputPath =
features2removeFile =
classifierName =
filesFound = glob.glob(filesFolder + '/*.csv')
counter = 0
concatDf = pd.DataFrame()
features2remove = pd.read_csv(features2removeFile)
... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/incidents/migrations/0002_auto_20181122_1103.py | seanlefevre/openduty | 145 | 1784323 | <filename>apps/incidents/migrations/0002_auto_20181122_1103.py
# Generated by Django 2.1.3 on 2018-11-22 11:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('services', '0001_initial'),
('inc... | 0 | 0 | 0 | 0 | 0 | 0 |
tg/support/middlewares.py | sergiobrr/tg2 | 812 | 1784325 | from tg.request_local import Request, Response
import logging
log = logging.getLogger(__name__)
class SeekableRequestBodyMiddleware(object):
def __init__(self, app):
self.app = app
def _stream_response(self, data):
try:
for chunk in data:
yield chunk
final... | 0 | 3 | 0 | 0 | 3 | 0 |
jd_login/Method_Second/Config.py | rua-aaa/awesome-python-login-model | 5,857 | 1784423 | <filename>jd_login/Method_Second/Config.py
"""
Config.py
配置文件
"""
settings = {
#一天申请的限制个数
'maxApplyNum' : 300 ,
#试用类型
#家用电器737 手机数码652 电脑办公670 家居家装1620 服饰鞋包1315 生鲜美食12218 钟表奢品5025 家庭清洁15901 食品饮料1320
'cids' : ['737', '652' ,'670', '1620', '1315', '12218' ,'5025' , '15901' ,'1320' ,] ,
#申请商品价格下限 ... | 0 | 0 | 0 | 0 | 0 | 0 |
dynamic_models/models.py | wieczorek1990/django-dynamic-models | 122 | 1784429 | <reponame>wieczorek1990/django-dynamic-models<filename>dynamic_models/models.py
from django.core.exceptions import FieldDoesNotExist, ValidationError
from django.db import models
from django.utils.text import slugify
from dynamic_models import config, cache, compat
from dynamic_models.factory import ModelFactory
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
agilegan/architectures/generator_discriminator.py | open-mmlab/MMGEN-FaceStylor | 122 | 1784433 | <reponame>open-mmlab/MMGEN-FaceStylor
import random
import mmcv
import torch
from mmgen.models.architectures.common import get_module_device
from mmgen.models.architectures.stylegan.generator_discriminator_v2 import \
StyleGANv2Generator
from mmgen.models.builder import MODULES
@MODULES.register_module()
class S... | 0 | 0 | 0 | 0 | 0 | 0 |
refinery/bnpy/bnpy-dev/bnpy/util/IOUtil.py | csa0001/Refinery | 103 | 1784466 | <filename>refinery/bnpy/bnpy-dev/bnpy/util/IOUtil.py
import numpy as np
def flatstr2np( xvecstr ):
return np.asarray( [float(x) for x in xvecstr.split()] )
def np2flatstr( X, fmt="% .6f" ):
return ' '.join( [fmt%(x) for x in np.asarray(X).flatten() ] )
| 0 | 0 | 0 | 0 | 0 | 0 |
observations/r/sleepstudy.py | hajime9652/observations | 199 | 1784499 | <filename>observations/r/sleepstudy.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def sleepstudy(path):
"""Reaction ... | 0 | 0 | 0 | 0 | 0 | 0 |
Utils/constants.py | shridpant/azure-linux-extensions | 266 | 1784504 | LibDir = "/var/lib/waagent"
Openssl = "openssl"
os_release = "/etc/os-release"
system_release = "/etc/system-release"
class WALAEventOperation:
HeartBeat: str = "HeartBeat"
Provision: str = "Provision"
Install: str = "Install"
UnInstall: str = "UnInstall"
Disable: str = "Disable"
Enable: str ... | 0 | 0 | 9 | 0 | 9 | 0 |
modules/rtorrent.py | scambra/HTPC-Manager | 422 | 1784532 | #!/usr/bin/env python
from __future__ import annotations
from __future__ import division
import htpc, cherrypy, logging, xmlrpclib, base64
from cherrypy.lib.auth2 import require, member_of
from htpc.helpers import serve_template, fix_basepath, striphttp
class RTorrent(object):
def __init__(self):
self.log... | 7 | 11 | 0 | 0 | 18 | 0 |
components/uvoice/get_open_source.py | wstong999/AliOS-Things | 4,538 | 1784546 | #!/usr/bin/env python
import os, sys
print("the script is " + sys.argv[0])
print("current dir is " + os.getcwd())
cur_dir = os.getcwd()
script_dir = sys.path[0]
script1_dir = os.path.join(script_dir, "codec", "opensource", "pvaac")
script2_dir = os.path.join(script_dir, "codec", "opensource", "pvmp3")
os.chdir(script... | 0 | 0 | 0 | 0 | 0 | 0 |
code/python/lib/mayavi_utils.py | americast/ml-hypersim | 1,246 | 1784558 | <filename>code/python/lib/mayavi_utils.py
#
# For licensing see accompanying LICENSE.txt file.
# Copyright (C) 2020 Apple Inc. All Rights Reserved.
#
from pylab import *
import mayavi.mlab
def points3d_color_by_scalar(positions, scalars, sizes=None, mode="sphere", scale_factor=1.0, colormap="jet", opacity=1.0):
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/stub/cmemcached.py | mubashshirjamal/code | 1,582 | 1784576 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
from cPickle import dumps, loads
__all__ = ['DIST_MODULA', 'DIST_CONSISTENT', 'DIST_CONSISTENT_KETAMA',
'Client']
DIST_MODULA = 0
DIST_CONSISTENT = 1
DIST_CONSISTENT_KETAMA = 2
(BEHAVIOR_NO_BLOCK, BEHAVIOR_TCP_NODELAY, BEHAVIOR... | 19 | 22 | 0 | 0 | 41 | 0 |
tools/darknet/yolov4.py | Karybdis/mmdetection-mini | 834 | 1784583 | # -*- coding:utf-8 -*-
from __future__ import annotations
from collections import OrderedDict
import torch.nn as nn
from mmdet.models.utils import brick as vn_layer
# https://github.com/AlexeyAB/darknet/wiki/YOLOv4-model-zoo
class Yolov4(nn.Module):
# 用于递归导入权重
custom_layers: tuple[object, object, object, obje... | 4 | 1 | 1 | 2 | 8 | 0 |
alipay/aop/api/domain/AuthFieldSceneDTO.py | antopen/alipay-sdk-python-all | 213 | 1784593 | <filename>alipay/aop/api/domain/AuthFieldSceneDTO.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AuthFieldSceneDTO(object):
def __init__(self):
self._scene_code = None
self._scene_desc = None
@property
def scene_co... | 0 | 0 | 0 | 0 | 0 | 0 |
api/data_refinery_api/management/commands/post_downloads_summary.py | AlexsLemonade/refinebio | 106 | 1784616 | import datetime
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils import timezone
import requests
from data_refinery_common.models import Dataset, DatasetAnnotation
def post_downloads_summary(days, channel):
start_time = timezone.now() - datetime.timedelta(d... | 0 | 1 | 1 | 0 | 2 | 0 |
custom_components/meross_lan/select.py | patrick-blom/meross_lan | 117 | 1784641 | from __future__ import annotations
from homeassistant.components.select import (
DOMAIN as PLATFORM_SELECT,
SelectEntity
)
from .merossclient import const as mc # mEROSS cONST
from .meross_entity import _MerossEntity, platform_setup_entry, platform_unload_entry
async def async_setup_entry(hass: object, con... | 8 | 3 | 2 | 0 | 13 | 0 |
riprova/errors.py | EdwardBetts/riprova | 114 | 1784642 | <filename>riprova/errors.py
# -*- coding: utf-8 -*-
from .exceptions import NotRetriableError
class ErrorWhitelist(object):
"""
Stores an error whitelist and provides a simple interface for whitelist
update and mutation.
Arguments:
errors (set|list|tuple[Exception]): optional list of error ex... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/Rhino/DocObjects/__init___parts/CoordinateSystem.py | htlcnn/ironpython-stubs | 182 | 1784693 | <gh_stars>100-1000
class CoordinateSystem(Enum,IComparable,IFormattable,IConvertible):
"""
Defines enumerated values for coordinate systems to use as references.
enum CoordinateSystem,values: Camera (1),Clip (2),Screen (3),World (0)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <=... | 0 | 0 | 0 | 0 | 0 | 0 |
teaminterface/lib/mailer.py | aprilsanchez/ictf-framework | 110 | 1784696 | <reponame>aprilsanchez/ictf-framework
from config import config
import sendgrid
from sendgrid.helpers.mail import *
import smtplib
from email.mime.text import MIMEText
ACCT_VERIFIED_SUBJECT = "Your iCTF Team Account has been verified!"
ACCT_VERIFIED_MSG = """
Hello!
The academic status of the iCTF account for your te... | 0 | 0 | 0 | 0 | 0 | 0 |
py_backwards/const.py | graingert/py-backwards | 338 | 1784733 | from collections import OrderedDict
TARGETS = OrderedDict([('2.7', (2, 7)),
('3.0', (3, 0)),
('3.1', (3, 1)),
('3.2', (3, 2)),
('3.3', (3, 3)),
('3.4', (3, 4)),
('3.5', (3, 5)),
... | 0 | 0 | 0 | 0 | 0 | 0 |
artemis/emotions.py | StanfordGeometryLab/artemis | 254 | 1784742 | """
Mostly some constants & very simple function to encode/handle the emotion attributes of ArtEmis.
The MIT License (MIT)
Originally created at 02/11/20, for Python 3.x
Copyright (c) 2021 <NAME> (ai.stanford.edu/~optas) & Stanford Geometric Computing Lab
"""
ARTEMIS_EMOTIONS = ['amusement', 'awe', 'contentment', 'e... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/test_models/test_pix2pix.py | plutoyuxie/mmgeneration | 718 | 1784757 | import copy
import torch
from mmcv.runner import obj_from_dict
from mmgen.models import GANLoss, L1Loss, build_model
from mmgen.models.architectures.pix2pix import (PatchDiscriminator,
UnetGenerator)
def test_pix2pix():
# model settings
model_cfg = dict(
... | 0 | 0 | 0 | 0 | 0 | 0 |
psutil_example/disc_used_DIFF/main.py | DazEB2/SimplePyScripts | 117 | 1784761 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install tabulate
from tabulate import tabulate
from common import get_disc_list, get_disc_used, get_human_sizes, get_row_for, load_snapshot_raw_disc_used
disc_list = get_disc_list()
disc_list_raw = get_disc_used(disc_l... | 0 | 0 | 0 | 0 | 0 | 0 |
test/modules/tls/test_01_apache.py | tititiou36/httpd | 2,529 | 1784785 | <gh_stars>1000+
import pytest
from .conf import TlsTestConf
class TestApache:
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
TlsTestConf(env=env).install()
assert env.apache_restart() == 0
def test_01_apache_http(self, env):
assert env.is_live(env.http... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/contrib/structured_model/python/core_test.py | aalbersk/DeepRec | 292 | 1784791 | <reponame>aalbersk/DeepRec
"""Tests for Structured Model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.structured_model.python.core import *
from tensorflow.python.framework import constant_op
from tensorflow.python.ops import ... | 0 | 0 | 0 | 0 | 0 | 0 |
sympy/parsing/autolev/_antlr/autolevlexer.py | utkarshdeorah/sympy | 8,323 | 1784837 | <gh_stars>1000+
# *** GENERATED BY antlr4, DO NOT EDIT BY HAND ***
#
# Generated from Autolev.g4 by ANTLR 4.7.1
#
# Generated with antlr4
# antlr4 is licensed under the BSD-3-Clause License
# https://github.com/antlr/antlr4/blob/master/LICENSE.txt
from __future__ import print_function
from antlr4 import *
from io... | 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.