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 |
|---|---|---|---|---|---|---|---|---|---|---|
ryu/tests/integrated/test_add_flow_v12_actions.py | umkcdcrg01/ryu_openflow | 269 | 3344764 | # Copyright (C) 2012 Nippon Telegraph and Telephone 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 appli... | 2 | 3 | 1 | 1 | 7 | 0 |
recommenders/datasets/mind.py | aeroabir/recommenders | 10,147 | 3344773 | <reponame>aeroabir/recommenders<gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import os
import random
import logging
import json
import numpy as np
import re
from tqdm import tqdm
from nltk.tokenize import RegexpTokenizer
from recommenders.datasets.downlo... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/odrive/pyfibre/fibre/shell.py | deafloo/ODrive | 1,068 | 3344786 | <gh_stars>1000+
import sys
import platform
import threading
import fibre
async def discovered_device(device,
interactive_variables, discovered_devices,
mount, shutdown_token, logger):
"""
Handles the discovery of new devices by displaying a
message and makin... | 0 | 0 | 0 | 0 | 0 | 0 |
submodules/GAN_stability/gan_training/eval.py | aleksandryessin/graf | 269 | 3344793 | from __future__ import annotations
import torch
from GAN_stability.gan_training.metrics import inception_score
class Evaluator(object):
def __init__(self, generator, zdist, ydist, batch_size: int=64,
inception_nsamples: int=60000, device: object | None=None):
self.generator = generator
... | 4 | 2 | 0 | 0 | 6 | 0 |
open/Edgecortix/code/mobilenetv2/SingleStream/python/backend_tflite.py | ctuning/inference_results_v1.1 | 388 | 3344797 | <filename>open/Edgecortix/code/mobilenetv2/SingleStream/python/backend_tflite.py
"""
tflite backend (https://github.com/tensorflow/tensorflow/lite)
"""
# pylint: disable=unused-argument,missing-docstring,useless-super-delegation
from threading import Lock
try:
# try dedicated tflite package first
import tfli... | 0 | 0 | 0 | 0 | 0 | 0 |
supervisor/utils/codenotary.py | agners/hassio | 584 | 3344805 | <filename>supervisor/utils/codenotary.py
"""Small wrapper for CodeNotary."""
# pylint: disable=unreachable
import asyncio
import hashlib
import json
import logging
from pathlib import Path
import shlex
from typing import Optional, Union
import async_timeout
from . import clean_env
from ..exceptions import CodeNotary... | 0 | 0 | 0 | 0 | 0 | 0 |
src/scenic/simulators/webots/guideways/__init__.py | abol-karimi/Scenic | 141 | 3344808 | """World model for road intersection scenarios in Webots.
This is a more specialized version of the :doc:`scenic.simulators.webots.road` model which also includes guideway information from the `Intelligent Intersections Toolkit <https://github.com/ucbtrans/intelligent_intersection>`_.
.. raw:: html
<h2>Submodules... | 0 | 0 | 0 | 0 | 0 | 0 |
util/update-copyright.py | hyu-iot/gem5 | 765 | 3344848 | <reponame>hyu-iot/gem5
#!/usr/bin/env python
# Copyright (c) 2020 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a ... | 0 | 0 | 0 | 0 | 0 | 0 |
tensorflow/compiler/tests/placeholder_test.py | EricRemmerswaal/tensorflow | 190,993 | 3344892 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 0 | 0 | 0 | 0 | 0 | 0 |
torchreid/losses/incidence_xent_loss.py | Danish-VSL/deep-person-reid | 244 | 3344921 | from .incidence_loss import IncidenceLoss
from .cross_entropy_loss import CrossEntropyLoss
from torchreid.utils.environ import get_env_or_raise
def IncidenceXentLoss(num_classes, use_gpu: bool=True, label_smooth: bool=True) -> object:
beta = get_env_or_raise(float, 'incidence_beta', 'beta')
incidence_loss =... | 2 | 2 | 0 | 0 | 4 | 0 |
joeynmt/builders.py | kobeyy/joeynmt | 563 | 3344922 | # coding: utf-8
"""
Collection of builder functions
"""
from typing import Callable, Optional, Generator
import torch
from torch import nn
from torch.optim.lr_scheduler import _LRScheduler, ReduceLROnPlateau, \
StepLR, ExponentialLR
from torch.optim import Optimizer
from joeynmt.helpers import ConfigurationError
... | 17 | 7 | 0 | 4 | 28 | 0 |
sentry_sdk/_types.py | cmalek/sentry-python | 1,213 | 3344940 | <filename>sentry_sdk/_types.py
try:
from typing import TYPE_CHECKING as MYPY
except ImportError:
MYPY = False
if MYPY:
from types import TracebackType
from typing import Any
from typing import Callable
from typing import Dict
from typing import Optional
from typing import Tuple
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
mmdet/models/dense_heads/embedding_rpn_head.py | Joanna0123/QueryInst | 326 | 3344970 | <filename>mmdet/models/dense_heads/embedding_rpn_head.py
import torch
import torch.nn as nn
from mmcv.runner import BaseModule
from mmdet.models.builder import HEADS
from ...core import bbox_cxcywh_to_xyxy
@HEADS.register_module()
class EmbeddingRPNHead(BaseModule):
"""RPNHead in the `Sparse R-CNN <https://arxiv... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/dash-soccer-analytics/ids.py | JeroenvdSande/dash-sample-apps | 2,332 | 3344981 | IDS = {
"SNAPSHOT_ID": "SNAPSHOT_ID",
"LOCATION": "LOCATION",
"GRAPH-1": "GRAPH-1",
"GRAPH-2": "GRAPH-2",
"GRAPH-3": "GRAPH-3",
}
| 0 | 0 | 0 | 0 | 0 | 0 |
vendor/github.com/elastic/beats/metricbeat/tests/system/test_system.py | caibaoying/axtx_beats | 115 | 3345010 | from __future__ import annotations
import re
import sys
import unittest
import metricbeat
import getpass
import os
SYSTEM_CPU_FIELDS = ["cores", "idle.pct", "iowait.pct", "irq.pct", "nice.pct",
"softirq.pct", "steal.pct", "system.pct", "user.pct"]
SYSTEM_CPU_FIELDS_ALL = ["cores", "idle.pct", "id... | 1 | 0 | 0 | 0 | 1 | 0 |
pyannote/metrics/base.py | pyannote/pyannote-metrics | 137 | 3345044 | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2012-2019 CNRS
# 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 limita... | 4 | 15 | 0 | 1 | 20 | 0 |
alipay/aop/api/response/AlipayMarketingCdpAdvertiseReportQueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 3345068 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayMarketingCdpAdvertiseReportQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayMarketingCdpAdvertiseReportQueryResponse, self).__init__()
self._click... | 0 | 9 | 0 | 9 | 18 | 0 |
isso/core.py | EchedeyLR/isso | 4,326 | 3345098 | <gh_stars>1000+
# -*- encoding: utf-8 -*-
from __future__ import print_function
import time
import logging
import threading
import multiprocessing
try:
import uwsgi
except ImportError:
uwsgi = None
import _thread as thread
from flask_caching.backends.nullcache import NullCache
from flask_caching.backends.s... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/SocketConnection.py | gprime31/http-request-smuggling | 224 | 3345112 | # MIT License
# Copyright (c) 2020 <NAME>
# 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, modify, merge, publish... | 1 | 3 | 0 | 5 | 9 | 0 |
tests/test043.py | takipsizad/pyjs | 739 | 3345114 | def test():
for i, j in pairs:
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
scrapy/utils/benchserver.py | FingerCrunch/scrapy | 41,267 | 3345123 | <reponame>FingerCrunch/scrapy
import random
from urllib.parse import urlencode
from twisted.web.server import Site
from twisted.web.resource import Resource
class Root(Resource):
isLeaf = True
def getChild(self, name, request):
return self
def render(self, request):
total = _getarg(req... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/feature_engineering/gradient_feature_selector/test_memory.py | dutxubo/nni | 9,680 | 3345136 | <reponame>dutxubo/nni
import os
LIBSVM_DATA = {
"rcv1" : "https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/rcv1_train.binary.bz2",
"colon-cancer" : "https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/covtype.libsvm.binary.bz2",
"gisette" : "https://www.csie.ntu.edu.tw/~cjlin/libsv... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/garage/sampler/test_vec_worker.py | blacksph3re/garage | 1,500 | 3345140 | <reponame>blacksph3re/garage
import pprint
import pytest
from garage.envs import GridWorldEnv
from garage.experiment.task_sampler import EnvPoolSampler
from garage.np.policies import ScriptedPolicy
from garage.sampler import LocalSampler, VecWorker, WorkerFactory
SEED = 100
N_EPS = 5
MAX_EPISODE_LENGTH = 9
@pytest... | 0 | 0 | 0 | 0 | 0 | 0 |
soft_sort/matrix_factorization/qmfq.py | deepneuralmachine/google-research | 23,901 | 3345155 | # 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... | 9 | 9 | 0 | 0 | 18 | 0 |
fuzzinator/call/test_runner_subprocess_call.py | akosthekiss/fuzzinator | 202 | 3345164 | <filename>fuzzinator/call/test_runner_subprocess_call.py<gh_stars>100-1000
# Copyright (c) 2016-2021 <NAME>, <NAME>.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
im... | 0 | 0 | 0 | 0 | 0 | 0 |
vdirsyncer/sync/exceptions.py | edvfb9/vdirsyncer | 888 | 3345175 | from .. import exceptions
class SyncError(exceptions.Error):
"""Errors related to synchronization."""
class SyncConflict(SyncError):
"""
Two items changed since the last sync, they now have different contents and
no conflict resolution method was given.
:param ident: The ident of the item.
... | 0 | 2 | 9 | 0 | 11 | 0 |
test/util/helpers.py | sailfishos-mirror/mako | 207 | 3345178 | <reponame>sailfishos-mirror/mako<filename>test/util/helpers.py
import contextlib
import pathlib
import re
import time
from unittest import mock
from test.util.fixtures import module_base
def flatten_result(result):
return re.sub(r"[\s\r\n]+", " ", result).strip()
def result_lines(result):
return [
... | 0 | 0 | 0 | 0 | 0 | 0 |
dialogue-engine/test/programytest/aiml_tests/get_tests/test_get_aiml.py | cotobadesign/cotoba-agent-oss | 104 | 3345199 | from __future__ import annotations
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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, c... | 1 | 1 | 0 | 0 | 2 | 0 |
readthedocs/payments/utils.py | yarons/readthedocs.org | 2,092 | 3345213 | <reponame>yarons/readthedocs.org
# -*- coding: utf-8 -*-
"""
Payment utility functions.
These are mostly one-off functions. Define the bulk of Stripe operations on
:py:class:`readthedocs.payments.forms.StripeResourceMixin`.
"""
import structlog
import stripe
from django.conf import settings
stripe.api_key = sett... | 0 | 0 | 0 | 0 | 0 | 0 |
faasmcli/faasmcli/util/env.py | kubasz/faasm | 278 | 3345228 | <filename>faasmcli/faasmcli/util/env.py
from os import makedirs, environ
from os.path import dirname, realpath, join, exists, expanduser
from faasmtools.build import FAASM_LOCAL_DIR
def _get_dir(variable, default):
env_val = environ.get(variable)
return env_val if env_val else default
HOME_DIR = expanduser... | 0 | 0 | 0 | 0 | 0 | 0 |
stable_baselines/trpo_mpi/utils.py | 757670303037/stable-baselines | 3,681 | 3345229 | import numpy as np
def add_vtarg_and_adv(seg, gamma, lam):
"""
Compute target value using TD(lambda) estimator, and advantage with GAE(lambda)
:param seg: (dict) the current segment of the trajectory (see traj_segment_generator return for more information)
:param gamma: (float) Discount factor
:p... | 0 | 0 | 0 | 0 | 0 | 0 |
configs/_base_/models/res2net50-w48-s2.py | YuxinZou/mmclassification | 1,190 | 3345259 | model = dict(
type='ImageClassifier',
backbone=dict(
type='Res2Net',
depth=50,
scales=2,
base_width=48,
deep_stem=False,
avg_down=False,
),
neck=dict(type='GlobalAveragePooling'),
head=dict(
type='LinearClsHead',
num_classes=1000,
... | 0 | 0 | 0 | 0 | 0 | 0 |
var/spack/repos/builtin/packages/py-secretstorage/package.py | LiamBindle/spack | 2,360 | 3345263 | <reponame>LiamBindle/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 PySecretstorage(PythonPackage):
"""Python bindings to FreeDeskt... | 0 | 0 | 0 | 0 | 0 | 0 |
tkinter/scrolled-frame-canvas/example-scrolledframe-with-scrollbar-ind-different-place.py | whitmans-max/python-examples | 140 | 3345270 | from __future__ import annotations
import tkinter as tk
from PIL import Image, ImageTk
class ScrolledFrame(tk.Frame):
def __init__(self, parent, vertical: bool=True, horizontal: bool=False):
super().__init__(parent)
# canvas for inner frame
self._canvas = tk.Canvas(self)
self._ca... | 3 | 0 | 0 | 2 | 5 | 0 |
a07_Transformer/a2_predict_classification.py | sunshinenum/text_classification | 7,723 | 3345285 | # -*- coding: utf-8 -*-
#prediction using model.
#process--->1.load data(X:list of lint,y:int). 2.create session. 3.feed data. 4.predict
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import tensorflow as tf
import numpy as np
from a2_transformer_classification import Transformer
from data_util_zhihu i... | 2 | 3 | 0 | 0 | 5 | 0 |
tools/marvin/marvin/deployDataCenter.py | ycyun/ablestack-cloud | 1,131 | 3345290 | <filename>tools/marvin/marvin/deployDataCenter.py<gh_stars>1000+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fixtures/config-scheduler5.py | fredstro/mrq | 745 | 3345300 | import datetime
import os
SCHEDULER_INTERVAL = 1
SCHEDULER_TASKS = []
for i in range(7):
SCHEDULER_TASKS.extend([
{
"path": "tests.tasks.general.MongoInsert",
"params": {
"weekday": i,
"later": False
},
"weekday": i,
"dailytime": datetime.datetime.... | 0 | 0 | 0 | 0 | 0 | 0 |
torch_geometric/datasets/aminer.py | Kenneth-Schroeder/pytorch_geometric | 12,651 | 3345311 | <filename>torch_geometric/datasets/aminer.py<gh_stars>1000+
from typing import Optional, Callable, List
import os
import os.path as osp
import shutil
import torch
from torch_sparse import coalesce, transpose
from torch_geometric.data import (InMemoryDataset, HeteroData, download_url,
... | 0 | 0 | 0 | 0 | 0 | 0 |
roles/viasite-ansible.zsh/molecule/default/tests/test_default.py | Eagle-Technologies/build_a_phish | 219 | 3345322 | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_bundles_when(host):
c = host.file('/root/.zshrc').content
assert 'test/in-list' in c
assert 'test/not-in-list' not in c
de... | 0 | 0 | 0 | 0 | 0 | 0 |
redbot/message/headers/x_download_options.py | Malvoz/redbot | 167 | 3345347 | #!/usr/bin/env python
from redbot.message import headers
from redbot.speak import Note, categories, levels
from redbot.type import AddNoteMethodType
class x_download_options(headers.HttpHeader):
canonical_name: str = "X-Download-Options"
list_header: bool = True
deprecated: bool = False
valid_in_requ... | 1 | 1 | 9 | 0 | 11 | 0 |
models/blocks.py | kuramin/KPConv-PyTorch | 451 | 3345348 | #
#
# 0=================================0
# | Kernel Point Convolutions |
# 0=================================0
#
#
# ----------------------------------------------------------------------------------------------------------------------
#
# Define network blocks
#
# ---------------------------... | 9 | 28 | 0 | 6 | 43 | 0 |
floyd/development/local.py | longhuei/floyd-cli | 162 | 3345359 | <reponame>longhuei/floyd-cli
import click
import floyd
from floyd.log import configure_logger
from floyd.main import check_cli_version, add_commands
@click.group()
@click.option('-v', '--verbose', count=True, help='Turn on debug logging')
def cli(verbose):
"""
Floyd CLI interacts with FloydHub server and exe... | 0 | 0 | 0 | 0 | 0 | 0 |
functest/example_quad.py | Luvideria/lightmetrica-v3 | 101 | 3345389 | # ---
# jupyter:
# jupytext:
# cell_metadata_json: true
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.3.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
#... | 0 | 0 | 0 | 0 | 0 | 0 |
sympy/plotting/plot_implicit.py | iamabhishek0/sympy | 445 | 3345462 | from __future__ import annotations
"""Implicit plotting module for SymPy
The module implements a data series called ImplicitSeries which is used by
``Plot`` class to plot implicit plots for different backends. The module,
by default, implements plotting using interval arithmetic. It switches to a
fall back algorithm i... | 7 | 7 | 1 | 0 | 15 | 0 |
nipy/labs/glm/glm.py | bpinsard/nipy | 236 | 3345478 | <filename>nipy/labs/glm/glm.py<gh_stars>100-1000
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import absolute_import
import numpy as np
import scipy.stats as sps
from . import kalman
from ..utils import mahalanobis
from nipy.algorith... | 0 | 0 | 0 | 0 | 0 | 0 |
test/time_feature/test_features.py | Xiaoxiong-Liu/gluon-ts | 2,648 | 3345486 | # 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/LICENSE-2.0
#
# or in the "license... | 5 | 0 | 0 | 0 | 5 | 0 |
server/base/management/commands/runworkers.py | arubdesu/zentral | 634 | 3345541 | <gh_stars>100-1000
import json
import logging
from multiprocessing import Process
import random
import time
import yaml
from django.core.management.base import BaseCommand
from zentral.core.queues.workers import get_workers
logger = logging.getLogger("zentral.server.base.management.commands.runworkers")
class Comma... | 0 | 0 | 0 | 0 | 0 | 0 |
networks/models/aot.py | yoxu515/aot-benchmark | 105 | 3345558 | from __future__ import annotations
import torch.nn as nn
from networks.encoders import build_encoder
from networks.layers.transformer import LongShortTermTransformer
from networks.decoders import build_decoder
from networks.layers.position import PositionEmbeddingSine
class AOT(nn.Module):
def __init__(self, cfg... | 5 | 5 | 0 | 0 | 10 | 0 |
designate/tests/unit/api/test_api_v2.py | mrlesmithjr/designate | 145 | 3345559 | <reponame>mrlesmithjr/designate
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# Author: <NAME> <<EMAIL>>
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ethereum_optimized/tangerine_whistle/trie_utils.py | newtonproject/newchain-specs | 102 | 3345571 | <gh_stars>100-1000
"""
Optimized Trie Utility Functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..contents:: Table of Contents
:backlinks: none
:local:
Introduction
------------
This module contains utility functions needed by the optimized state.
"""
from typing import Tuple
from ethereum import rlp
from ethereum... | 0 | 0 | 0 | 0 | 0 | 0 |
gluon/gluoncv2/models/deeplabv3.py | naviocean/imgclsmob | 2,649 | 3345573 | from __future__ import annotations
"""
DeepLabv3 for image segmentation, implemented in Gluon.
Original paper: 'Rethinking Atrous Convolution for Semantic Image Segmentation,' https://arxiv.org/abs/1706.05587.
"""
__all__ = ['DeepLabv3', 'deeplabv3_resnetd50b_voc', 'deeplabv3_resnetd101b_voc', 'deeplabv3_resne... | 40 | 15 | 0 | 0 | 55 | 0 |
pur/exceptions.py | kmu/pip-update-requirements | 559 | 3345623 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
pur.exceptions
~~~~~~~~~~~~~~
:copyright: (c) 2016 <NAME>.
:license: BSD, see LICENSE for more details.
"""
class StopUpdating(Exception):
"""Stop updating a requirements file and exit."""
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
ding/entry/application_entry_trex_collect_data.py | Hcnaeg/DI-engine | 464 | 3345714 | <gh_stars>100-1000
import argparse
import torch
from typing import Union, Optional, List, Any
from functools import partial
import os
from copy import deepcopy
from ding.config import compile_config, read_config
from ding.worker import EpisodeSerialCollector
from ding.envs import create_env_manager, get_vec_env_settin... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/onnx2pytorch/convert/test_maxpool.py | Robust-Robots/onnx2pytorch | 147 | 3345724 | import io
import onnx
import pytest
import torch
from onnx2pytorch.convert import ConvertModel
from torch import nn
class UsedIndices(nn.Module):
def __init__(self):
super().__init__()
self.mp = nn.MaxPool2d(
kernel_size=[3, 3],
stride=[2, 2],
ceil_mode=True,
... | 0 | 2 | 0 | 0 | 2 | 0 |
scripts/train_intelligent_expert.py | m-smith/babyai | 411 | 3345743 | #!/usr/bin/env python3
from __future__ import annotations
"""
Train an agent using an intelligent expert.
The procedure starts with a small set of training demonstrations, and
iteratively grows the training set by some percentage. At every step, the new
demos used to grow the training set are demos the agent is curre... | 1 | 4 | 0 | 0 | 5 | 0 |
cpt/test/unit/ci_manager_test.py | SamsonBox/conan-package-tools | 153 | 3345756 | <filename>cpt/test/unit/ci_manager_test.py<gh_stars>100-1000
import unittest
import os
from cpt.test.utils.tools import TestBufferConanOutput
from cpt.packager import ConanMultiPackager
from cpt.ci_manager import CIManager
from conans import tools
from cpt.printer import Printer
class CIManagerTest(unittest.TestCase... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/pycryptodomex-3.9.7/lib/Cryptodome/Hash/SHAKE128.py | yetsun/hue | 5,079 | 3345808 | # ===================================================================
#
# Copyright (c) 2015, Legrandin <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source... | 3 | 4 | 1 | 1 | 9 | 0 |
remote_flow/metaflow/prepare_dataset.py | JSpenced/you-dont-need-a-bigger-boat | 356 | 3345815 | import os
import json
from enum import Enum
from data_processing.connectors.sf_connector import SFSelfClosingNamespaceConnection
class Actions(int, Enum):
start: int = 0
end: int = 1
add: int = 2
remove: int = 3
purchase: int = 4
detail: int = 5
pageview: int = 6
def prepare_dataset() -... | 0 | 4 | 7 | 0 | 11 | 0 |
snippets/range/range.py | peterbe/govspy | 106 | 3345831 | <reponame>peterbe/govspy<filename>snippets/range/range.py
names = ["Peter", "Anders", "Bengt"]
for i, name in enumerate(names):
print("{}. {}".format(i + 1, name))
| 0 | 0 | 0 | 0 | 0 | 0 |
contrib/opencensus-ext-ocagent/tests/test_trace_exporter.py | Flared/opencensus-python | 650 | 3345834 | # Copyright 2018, OpenCensus 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 w... | 1 | 1 | 0 | 1 | 3 | 0 |
deformable_helper.py | ankitshah009/Object_Detection_Tracking | 328 | 3345843 | <reponame>ankitshah009/Object_Detection_Tracking
# coding=utf-8
# helper function for deformable conv
import tensorflow as tf
def _to_bc_h_w(x, x_shape):
"""(b, h, w, c) -> (b*c, h, w)"""
x = tf.transpose(x, [0, 3, 1, 2])
x = tf.reshape(x, (-1, x_shape[1], x_shape[2]))
return x
def _to_b_h_w_n_c(x, x_shape):
... | 0 | 0 | 0 | 0 | 0 | 0 |
talk_about_random_splits/probing/split_by_length_threshold_main.py | DionysisChristopoulos/google-research | 23,901 | 3345857 | <filename>talk_about_random_splits/probing/split_by_length_threshold_main.py<gh_stars>1000+
# 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 L... | 0 | 0 | 0 | 0 | 0 | 0 |
leveldb_mcpe/setup.py | bennettdc/MCEdit-Unified | 237 | 3345868 | <reponame>bennettdc/MCEdit-Unified<gh_stars>100-1000
from setuptools import setup
from distutils.extension import Extension
import os.path
import sys
extra_compile_args = ["-DDLLX="]
extra_link_args = []
define_macros = []
runtime_library_dirs = []
library_dirs = []
libraries = []
include_dirs = []
if sys.platform ==... | 0 | 0 | 0 | 0 | 0 | 0 |
uncalled/index.py | skovaka/nanopore_aligner | 489 | 3345903 | <reponame>skovaka/nanopore_aligner
#!/usr/bin/env python
# MIT License
#
# Copyright (c) 2018 <NAME> <<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, includin... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_data/test_feature_validator.py | Louquinze/auto-sklearn | 6,390 | 3345906 | <gh_stars>1000+
import numpy as np
import pandas as pd
from pandas.api.types import is_numeric_dtype
import pytest
from scipy import sparse
import sklearn.datasets
import sklearn.model_selection
from autosklearn.data.feature_validator import FeatureValidator
# Fixtures to be used in this class. By default all el... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/functional/test_serialization.py | diadochos/elfi | 166 | 3345909 | <gh_stars>100-1000
import pickle
import numpy as np
from elfi.client import ClientBase
from elfi.examples import ma2
from elfi.executor import Executor
from elfi.model.elfi_model import ComputationContext
def test_pickle_ma2():
m = ma2.get_model()
d = m.get_reference('d')
np.random.seed(0)
res1 = d... | 0 | 0 | 0 | 0 | 0 | 0 |
thespian/test/test_requireCapability.py | dendron2000/Thespian | 210 | 3345910 | from thespian.actors import requireCapability
class TestUnitRequireCapability(object):
@requireCapability('asdf')
class req1: pass
def test_oneReq(self):
capcheck = TestUnitRequireCapability.req1.actorSystemCapabilityCheck
assert not capcheck({}, 0)
assert not capcheck({'asdf':F... | 0 | 1 | 0 | 0 | 1 | 0 |
malaya_speech/train/model/fastspeech/layer.py | ishine/malaya-speech | 111 | 3345913 | <reponame>ishine/malaya-speech<filename>malaya_speech/train/model/fastspeech/layer.py
import tensorflow as tf
def get_initializer(initializer_range=0.02):
"""Creates a `tf.initializers.truncated_normal` with the given range.
Args:
initializer_range: float, initializer range for stddev.
Returns:
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_derivations.py | PROShiZ/python-hdwallet | 188 | 3345918 | <reponame>PROShiZ/python-hdwallet
#!/usr/bin/env python3
import pytest
from hdwallet.cryptocurrencies import BitcoinMainnet
from hdwallet.derivations import (
Derivation, BIP32Derivation, BIP44Derivation, BIP49Derivation, BIP84Derivation, BIP141Derivation
)
from hdwallet.exceptions import SemanticError
def test... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/others/deepes.py | jkren6/PARL | 3,172 | 3345921 | # 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 app... | 0 | 4 | 0 | 0 | 4 | 0 |
posts/templatetags/battle.py | ujlbu4/vas3k.club | 496 | 3345925 | <filename>posts/templatetags/battle.py
from django import template
from django.template import loader
register = template.Library()
battle_stats_template = loader.get_template("posts/widgets/battle_stats.html")
def _is_argument_for_side(comment, side):
for_side = comment.metadata and comment.metadata.get("battl... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/project/organisations/serializers.py | wildfish/django-rest-framework-docs | 487 | 3345938 | from rest_framework import serializers
from project.organisations.models import Organisation, Membership
from project.accounts.serializers import UserProfileSerializer
class MembershipSerializer(serializers.ModelSerializer):
class Meta:
model = Membership
fields: tuple[str, str, str] = ('joined', ... | 0 | 1 | 5 | 0 | 6 | 0 |
data_management/generate_lila_sas_urls.py | dnarqq/WildHack | 402 | 3345951 | #
# Generate read-only SAS URLs for all LILA containers, to facilitate partial downloads.
#
# The results of this script end up here:
#
# http://lila.science/wp-content/uploads/2020/03/lila_sas_urls.txt
#
# Update: that file is manually maintained now, it can't be programmatically generated
#
#%% Imports
from azure.s... | 0 | 0 | 0 | 0 | 0 | 0 |
athena/brain.py | ddugovic/hey-athena-client | 336 | 3345954 | """
The "Brain" class handles most of Hey Athena's processing.
To listen for input, use ``brain.inst.run()``
"""
from __future__ import print_function
import traceback
import os
import re
import yaml
from athena import settings, stt, tts, apis, mods, log
inst = None
try:
input = raw_input # Pyt... | 1 | 4 | 0 | 1 | 6 | 0 |
onedrived/od_tasks/start_repo.py | r-gorajski/onedrived-dev | 869 | 3345957 | <filename>onedrived/od_tasks/start_repo.py<gh_stars>100-1000
import logging
import os
from . import base
from . import merge_dir
class StartRepositoryTask(base.TaskBase):
"""A simple task that bootstraps the syncing process of a Drive.
It checks if the root path is a directory, and if so, create a task to me... | 0 | 0 | 0 | 0 | 0 | 0 |
det3d/datasets/kitti/eval_hooks.py | PatrickChoDev/CSA-3D | 1,318 | 3345976 | <gh_stars>1000+
import os
import os.path as osp
import numpy as np
import torch
import torch.distributed as dist
from det3d import datasets, torchie
from det3d.torchie.parallel import collate_kitti, scatter
from det3d.torchie.trainer import Hook
from det3d.utils.dist.dist_common import (
all_gather,
get_rank,
... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/python/frugal/util/headers.py | ariasheets-wk/frugal | 144 | 3346002 | # Copyright 2017 Workiva
# 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
#... | 0 | 4 | 0 | 0 | 4 | 0 |
scale/job/test/messages/test_uncancel_jobs.py | kaydoh/scale | 121 | 3346021 | <reponame>kaydoh/scale
from __future__ import unicode_literals
import datetime
import django
from django.utils.timezone import now
from django.test import TransactionTestCase
from job.messages.uncancel_jobs import UncancelJobs
from job.models import Job
from job.test import utils as job_test_utils
from recipe.test i... | 0 | 0 | 0 | 0 | 0 | 0 |
src/db.py | jhy1000/github | 255 | 3346028 | # coding: utf-8
import redis
def get_redis() -> object:
redis_conf = {
'host': '127.0.0.1',
'port': 6379,
'db': 0
}
pool = redis.ConnectionPool(host=redis_conf['host'], port=redis_conf['port'], db=redis_conf['db'])
return redis.StrictRedis(connection_pool=pool)
REDIS = get_red... | 0 | 1 | 0 | 0 | 1 | 0 |
src/feedparser/datetimes/korean.py | kannkyo/tweet-space-security-news | 1,452 | 3346042 | <reponame>kannkyo/tweet-space-security-news
# Copyright 2010-2021 <NAME> <<EMAIL>>
# Copyright 2002-2008 <NAME>
# All rights reserved.
#
# This file is a part of feedparser.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are me... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/interleaved_cc_info/interleaved_cc_info_test.bzl | yesudeep/rules_rust | 349 | 3346047 | """Unittests for rust rules."""
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//rust:defs.bzl", "rust_library")
def _interleaving_cc_link_order_test_impl(ctx) -> object:
env = analysistest.begin(ctx)
tut = analysistest.target_under_test(e... | 0 | 1 | 0 | 0 | 1 | 0 |
bookwyrm/management/commands/deduplicate_book_data.py | mouse-reeve/fedireads | 270 | 3346056 | <reponame>mouse-reeve/fedireads
""" PROCEED WITH CAUTION: uses deduplication fields to permanently
merge book data objects """
from django.core.management.base import BaseCommand
from django.db.models import Count
from bookwyrm import models
def update_related(canonical, obj):
"""update all the models with fk to ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/handling/daemons/test_timer_triggering.py | tavaresrodrigo/kopf | 855 | 3346070 | import logging
import kopf
async def test_timer_is_spawned_at_least_once(
resource, dummy, caplog, assert_logs, k8s_mocked, simulate_cycle):
caplog.set_level(logging.DEBUG)
@kopf.timer(*resource, id='fn', interval=1.0)
async def fn(**kwargs):
dummy.mock()
dummy.kwargs = kwargs
... | 0 | 0 | 0 | 0 | 0 | 0 |
libs/ft.py | Lee6903/galerkin-transformer | 106 | 3346096 | from __future__ import annotations
import math
import os
import sys
import numpy as np
import torch
import torch.nn.functional as F
from scipy.sparse import csr_matrix, diags, identity
from scipy.sparse import hstack as sparse_hstack
from scipy import interpolate
from torch import nn
from torch.nn.modules.loss import ... | 92 | 32 | 0 | 7 | 131 | 0 |
datasets/coco2seq.py | OmkarThawakar/SeqFormer-1 | 223 | 3346110 | <filename>datasets/coco2seq.py
# ------------------------------------------------------------------------
# SeqFormer data loader
# ------------------------------------------------------------------------
# Modified from Deformable VisTR (https://github.com/Epiphqny/VisTR)
# --------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
prometeo/linalg/blasfeo_wrapper.py | kokizzu/prometeo | 509 | 3346129 | from ctypes import *
import os
bw = CDLL(os.path.dirname(__file__) + '/../lib/blasfeo/libblasfeo.so')
class blasfeo_dmat(Structure):
_fields_: list[tuple[str, object]] = [ ("m", c_int),
("n", c_int),
("pm", c_int),
("cn", c_int),
("pA", POINTER(c_double)),
... | 0 | 0 | 2 | 0 | 2 | 0 |
Tests/test_tcf.py | cwensley/ironpython2 | 1,872 | 3346140 | <reponame>cwensley/ironpython2
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import unittest
from iptest import run_test
globals()["gblvar"] = 1
def setvar(... | 0 | 0 | 0 | 0 | 0 | 0 |
homeassistant/components/file/__init__.py | domwillcode/home-assistant | 30,023 | 3346150 | """The file component."""
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayOfflineTrade.py | snowxmas/alipay-sdk-python-all | 213 | 3346174 | <filename>alipay/aop/api/domain/AlipayOfflineTrade.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOfflineTrade(object):
def __init__(self):
self._actual_order_time = None
self._amount = None
... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | jholloway7/python-gcm | 281 | 3346176 | <reponame>jholloway7/python-gcm<filename>setup.py
from setuptools import setup
setup(
name='python-gcm',
version='0.4',
packages=['gcm'],
license='The MIT License (MIT)',
author='<NAME>',
author_email='<EMAIL>',
url='http://blog.namis.me/python-gcm/',
description='Python client for Goog... | 0 | 0 | 0 | 0 | 0 | 0 |
preprocess/compare_two_file.py | Bermuhz/DataMiningCompetitionFirstPrize | 128 | 3346177 | file_name_1 = "../original_data//prediction_gdbt.csv"
file_name_2 = "../original_data//prediction_ada.csv"
lines_1 = open(file_name_1).readlines()
lines_2 = open(file_name_2).readlines()
total_line_num = len(lines_1)
diff_line_num = 0
for line_1, line_2 in zip(lines_1, lines_2):
predict_1 = line_1.strip("\r\n").spl... | 0 | 0 | 0 | 0 | 0 | 0 |
src/exabgp/configuration/announce/path.py | pierky/exabgp | 1,560 | 3346183 | <filename>src/exabgp/configuration/announce/path.py
# encoding: utf-8
"""
announce/label.py
Created by <NAME> on 2017-07-05.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from exabgp.protocol.ip import NoNextHop
from exabgp.rib.change import Change
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
lit_nlp/components/citrus/lemon_test.py | noahcb/lit | 2,854 | 3346184 | <reponame>noahcb/lit
# 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 ag... | 0 | 0 | 0 | 0 | 0 | 0 |
office365/sharepoint/webhooks/subscription_information.py | theodoriss/Office365-REST-Python-Client | 544 | 3346194 | from __future__ import annotations
from datetime import datetime, timedelta
from office365.runtime.client_value import ClientValue
class SubscriptionInformation(ClientValue):
"""Parameter class for webhook Update and Create REST operations."""
def __init__(self, notification_url, resource, expiration_dateti... | 1 | 1 | 0 | 2 | 4 | 0 |
tests/apitests/python/test_p2p.py | PushkarJ/harbor | 12,706 | 3346218 | <filename>tests/apitests/python/test_p2p.py
from __future__ import absolute_import
import unittest
import urllib
import sys
from testutils import ADMIN_CLIENT, TEARDOWN, harbor_server, suppress_urllib3_warning
from library.base import _random_name
from library.base import _assert_status_code
from library.project imp... | 0 | 0 | 0 | 0 | 0 | 0 |
thefuck/rules/apt_get.py | HiteshMah-Jan/thefuck | 75,504 | 3346221 | from __future__ import annotations
from types import ModuleType
from thefuck.specific.apt import apt_available
from thefuck.utils import memoize, which
from thefuck.shells import shell
try:
from CommandNotFound import CommandNotFound
enabled_by_default = apt_available
if isinstance(CommandNotFound, Modul... | 0 | 4 | 0 | 0 | 4 | 0 |
flaskbb/configs/default.py | ppker/flaskbb | 1,140 | 3346231 | # -*- coding: utf-8 -*-
"""
flaskbb.configs.default
~~~~~~~~~~~~~~~~~~~~~~~
This is the default configuration for FlaskBB that every site should have.
You can override these configuration variables in another class.
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more ... | 0 | 0 | 46 | 0 | 46 | 0 |
tools/wptserve/wptserve/utils.py | eltociear/wpt | 575 | 3346244 | <filename>tools/wptserve/wptserve/utils.py
import socket
from .logger import get_logger
def isomorphic_decode(s):
"""Decodes a binary string into a text string using iso-8859-1.
Returns `str`. The function is a no-op if the argument already has a text
type. iso-8859-1 is chosen because it is an 8-bit e... | 0 | 0 | 0 | 0 | 0 | 0 |
odps/ml/algolib/tests/test_algo_build.py | Emersonxuelinux/aliyun-odps-python-sdk | 412 | 3346248 | # encoding: utf-8
# Copyright 1999-2017 Alibaba Group Holding 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 b... | 0 | 0 | 0 | 0 | 0 | 0 |
neutron/db/uplink_status_propagation_db.py | congnt95/neutron | 1,080 | 3346261 | <reponame>congnt95/neutron
# 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 ... | 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.