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 |
|---|---|---|---|---|---|---|---|---|---|---|
tradingbot/trading_bot.py | stungkit/TradingBot | 218 | 3310221 | import logging
import traceback
from datetime import datetime as dt
from pathlib import Path
from typing import List, Optional
import pytz
from .components import (
Backtester,
Configuration,
MarketClosedException,
MarketProvider,
NotSafeToTradeException,
TimeAmount,
TimeProvider,
Trad... | 14 | 10 | 5 | 0 | 29 | 0 |
client/workflows/examples-without-verta/scripts/pytorch-lstm.py | stefan-petrov-toptal/modeldb | 624 | 3310250 | <reponame>stefan-petrov-toptal/modeldb
"""LSTM Recurrent Network (PyTorch)"""
import os
import json
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as func
import torch.optim as optim
import torch.utils.data as data_utils
# load data from CSV file into a NumPy mapping
data = np.loa... | 0 | 0 | 0 | 0 | 0 | 0 |
skfda/ml/clustering/__init__.py | jiduque/scikit-fda | 147 | 3310273 | """Clustering."""
from ._hierarchical import AgglomerativeClustering
from ._kmeans import BaseKMeans, FuzzyCMeans, KMeans
from ._neighbors_clustering import NearestNeighbors
| 0 | 0 | 0 | 0 | 0 | 0 |
wasmtime/_types.py | primecoin/wasmtime-py | 140 | 3310281 | from . import _ffi as ffi
from wasmtime import WasmtimeError
from ctypes import byref, POINTER, pointer
from typing import Union, List, Optional, Any
class ValType:
_ptr: "pointer[ffi.wasm_valtype_t]"
_owner: Optional[Any]
@classmethod
def i32(cls) -> "ValType":
ptr = ffi.wasm_valtype_new(ffi... | 37 | 63 | 19 | 4 | 123 | 0 |
faasmcli/faasmcli/tasks/config.py | kubasz/faasm | 278 | 3310290 | from invoke import task
from faasmcli.util.config import get_faasm_config
@task
def create(ctx):
"""
Set up skeleton Faasm config
"""
get_faasm_config()
| 0 | 0 | 0 | 0 | 0 | 0 |
corehq/apps/toggle_ui/migrations/0002_toggleaudit.py | omari-funzone/commcare-hq | 471 | 3310292 | # Generated by Django 2.2.16 on 2020-11-23 15:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial: bool = True
dependencies: list[tuple[str, str]] = [
('toggle_ui', '0001_reconcile_commtrack_flags'),
]
operations: list[object] = [
migrations.C... | 0 | 0 | 3 | 0 | 3 | 0 |
pyanomaly/core/hook/functions/ocae_hooks.py | YuhaoCheng/PyAnomaly | 102 | 3310299 | """
@author: <NAME>
@contact: yuhao.cheng[at]outlook.com
"""
import os
import pickle
import cv2
import torch
import mmcv
import numpy as np
from collections import OrderedDict
from torch.utils.data import DataLoader
from pyanomaly.datatools.evaluate.utils import psnr_error, oc_score
from pyanomaly.core.ut... | 0 | 1 | 0 | 0 | 1 | 0 |
imaginaire/generators/spade.py | hw07216/imaginaire | 3,308 | 3310310 | <filename>imaginaire/generators/spade.py<gh_stars>1000+
# Copyright (C) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, check out LICENSE.md
import functools
import math
import types
import numpy as n... | 0 | 0 | 0 | 0 | 0 | 0 |
OracleWebCenterContent/dockerfiles/12.2.1.4/container-scripts/setCaptureTopology.py | MarkkuPekkarinen/docker-images | 5,519 | 3310322 | #!/usr/bin/python
# Copyright (c) 2021, Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl
#
# ==============================================
import sys
admin_name = os.environ['ADMIN_USERNAME']
admin_pass = os.environ['<PASSWORD>']
ad... | 0 | 0 | 0 | 0 | 0 | 0 |
CommonTools/RecoAlgos/python/trackingParticleConversionRefSelector_cfi.py | ckamtsikis/cmssw | 852 | 3310326 | from CommonTools.RecoAlgos.trackingParticleConversionRefSelectorDefault_cfi import trackingParticleConversionRefSelectorDefault as _trackingParticleConversionRefSelectorDefault
trackingParticleConversionRefSelector = _trackingParticleConversionRefSelectorDefault.clone()
from Configuration.ProcessModifiers.premix_stage... | 0 | 0 | 0 | 0 | 0 | 0 |
zentral/core/stores/backends/datadog.py | janheise/zentral | 634 | 3310329 | from __future__ import annotations
from datetime import datetime
import json
import logging
import re
import requests
import time
import zlib
from urllib.parse import urlencode
from zentral.core.events import event_from_event_d
from zentral.core.stores.backends.base import BaseEventStore
logger = logging.getLogger('z... | 21 | 16 | 4 | 4 | 45 | 0 |
plex_mpv_shim/menu.py | aelfa/plex-mpv-shim | 231 | 3310336 | from __future__ import annotations
from queue import Queue, LifoQueue
from .bulk_subtitle import process_series
from .conf import settings
from .utils import mpv_color_to_plex
from .video_profile import VideoProfileManager
from .svp_integration import SVPManager
import time
import logging
log = logging.getLogger('menu... | 2 | 3 | 0 | 7 | 12 | 0 |
myia/monomorphize.py | strint/myia | 222 | 3310346 | <gh_stars>100-1000
"""Monomorphization algorithm.
Monomorphization creates a separate function for each type signature the
function may be called with.
"""
from collections import defaultdict
from dataclasses import dataclass, replace as dc_replace
from functools import reduce
from itertools import count
from typing ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/association/__init__.py | Dreamsorcerer/sqlalchemy | 5,383 | 3310351 | """
Examples illustrating the usage of the "association object" pattern,
where an intermediary class mediates the relationship between two
classes that are associated in a many-to-many pattern.
.. autosource::
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
chapter10/10-3.py | alberthao/Python-Crash-Course-Homework | 138 | 3310361 | <gh_stars>100-1000
name = input("What's your name? ")
filename = 'guest.txt'
with open(filename, 'w') as f:
f.write(name) | 0 | 0 | 0 | 0 | 0 | 0 |
costcla/metrics/costs.py | eldrin/CostSensitiveClassification | 195 | 3310366 | """Metrics to assess performance on cost-sensitive classification tasks
given class prediction and cost-matrix
Functions named as ``*_score`` return a scalar value to maximize: the higher
the better
Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
"""
# Authors: <NA... | 0 | 3 | 0 | 0 | 3 | 0 |
Lib/test/bugs/pr208.py | jeff5/jython-whinchat | 577 | 3310414 | # PR#208, calling apply with bogus 3rd argument
def test(x):
return x
assert 7 == apply(test, (7,))
assert 7 == apply(test, (), {'x': 7})
try:
apply(test, (1,), 7)
print 'TypeError expected'
except TypeError:
pass
try:
apply(test, (1,), {7:3})
print 'TypeError expected'
except TypeError:
... | 0 | 0 | 0 | 0 | 0 | 0 |
azure-kusto-data/tests/test_streaming_query.py | mitsuo0114/azure-kusto-python | 134 | 3310419 | <reponame>mitsuo0114/azure-kusto-python
import os
from io import StringIO
import pytest
from azure.kusto.data._models import WellKnownDataSet, KustoResultRow, KustoResultColumn
from azure.kusto.data.aio.response import KustoStreamingResponseDataSet as AsyncKustoStreamingResponseDataSet
from azure.kusto.data.aio.strea... | 0 | 0 | 0 | 0 | 0 | 0 |
mindspore/lite/examples/export_models/models/NetworkInNetwork.py | PowerOlive/mindspore | 3,200 | 3310449 | <filename>mindspore/lite/examples/export_models/models/NetworkInNetwork.py<gh_stars>1000+
# Copyright 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
#
... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/src/baserow/contrib/database/views/view_types.py | lucastm/baserow | 839 | 3310474 | <reponame>lucastm/baserow<filename>backend/src/baserow/contrib/database/views/view_types.py<gh_stars>100-1000
from django.urls import path, include
from rest_framework.serializers import CharField
from baserow.api.user_files.serializers import UserFileField
from baserow.core.user_files.handler import UserFileHandler
... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/decorator5.py | Jasha10/pyright | 3,934 | 3310484 | # This sample tests the logic that determines whether
# an unannotated decorator should allow the decorated
# function type (and docstring) to pass through unmodified.
def simple_decorator(method) -> object:
def wrapper(*args, **kw) -> object:
result = method(*args, **kw)
return result
return... | 4 | 4 | 0 | 0 | 8 | 0 |
python/tools/recorded-call-graph-metrics/tests/python-src/problem-2.py | vadi2/codeql | 4,036 | 3310532 | def func(func_arg) -> object:
print("func")
def func2() -> object:
print("func2")
return func_arg()
func2()
def nop():
print("nop")
pass
func(nop)
"""
Needs handling of LOAD_DEREF. Disassembled bytecode looks like:
6 8 LOAD_DEREF 0 (func_arg)
... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/import/pkg6/__init__.py | sebastien-riou/micropython | 13,648 | 3310543 | from .x import *
print("init")
| 0 | 0 | 0 | 0 | 0 | 0 |
Data Structures/Trees/BST.py | siddhi-244/CompetitiveProgrammingQuestionBank | 931 | 3310553 | from __future__ import annotations
'''
IMPLEMENTATION OF BINARY SEARCH TREE (BST)
Binary Search Tree is a special type of binary tree where:
1. The value of all the nodes in the left sub-tree is less than or equal to the value of the root.
2. The value of all the nodes in the right sub-tree is greater t... | 3 | 4 | 0 | 0 | 7 | 0 |
tick/hawkes/simulation/tests/hawkes_kernel_0_test.py | sumau/tick | 411 | 3310561 | <filename>tick/hawkes/simulation/tests/hawkes_kernel_0_test.py
# License: BSD 3 clause
import unittest
from tick.hawkes import HawkesKernel0
class Test(unittest.TestCase):
def setUp(self):
self.hawkes_kernel_0 = HawkesKernel0()
def test_HawkesKernel0_str(self):
"""...Test HawkesKernel0 stri... | 0 | 0 | 0 | 0 | 0 | 0 |
codigo/Live118/composition/exemplo_1.py | cassiasamp/live-de-python | 572 | 3310567 | def pipeline(*filters) -> object:
def inner(value) -> object:
final_value = value
for filter in reversed(filters):
final_value = filter(final_value)
return final_value
return inner
def limpa_texto(text) -> object:
return text.replace('\n', '')
def troca_eh_massa(text... | 0 | 7 | 0 | 0 | 7 | 0 |
Hermes/tests/test_cassandra.py | loftwah/appscale | 790 | 3310582 | from __future__ import annotations
import asyncio
import pytest
from mock import MagicMock, patch
from appscale.hermes.producers import cassandra_stats
def future(value: object | None=None) -> object:
future_obj = asyncio.Future()
future_obj.set_result(value)
return future_obj
MULTINODE_STATUS = b"""Datacen... | 1 | 1 | 0 | 0 | 2 | 0 |
chaos_genius/views/download_view.py | rsohlot/chaos_genius | 320 | 3310601 | from __future__ import annotations
from flask import Blueprint, Response, jsonify, request
from chaos_genius.controllers.kpi_controller import get_kpi_data_from_id
from chaos_genius.core.rca.rca_utils.api_utils import (
kpi_line_data,
rca_analysis,
rca_hierarchical_data_all_dims,
)
from chaos_genius.utils.... | 2 | 4 | 0 | 0 | 6 | 0 |
packages/pyright-internal/src/tests/samples/callable2.py | Jasha10/pyright | 3,934 | 3310619 | <reponame>Jasha10/pyright<gh_stars>1000+
# This sample tests the assignment of generic callables
# to concrete callable types.
from asyncio.futures import Future
from asyncio.tasks import ensure_future
from typing import Any, Awaitable, Callable, Iterable, Sequence, TypeVar
_T1 = TypeVar("_T1")
def my_min(__iterab... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/models/test_weights.py | bonlime/pytorch-tools | 155 | 3310621 | <gh_stars>100-1000
## test that imagenet pretrained weights are valid and able to classify correctly the cat and dog
import torch
import pytest
import numpy as np
from PIL import Image
from pytorch_tools.utils.preprocessing import get_preprocessing_fn
from pytorch_tools.utils.visualization import tensor_from_rgb_imag... | 0 | 0 | 0 | 0 | 0 | 0 |
encoders.py | spicesouls/onelinepy | 148 | 3310630 | import sys, base64, codecs, binascii
def getjsonlist() -> object:
payloads = {
"one_line":{
"hex":"oneline_hex",
"base64":"oneline_b64",
"base32":"oneline_b32",
"gunzip*":"oneline_gzip",
"rot13*":"oneline_rot13",
},
"powershell... | 0 | 9 | 0 | 0 | 9 | 0 |
test_animation.py | mannyfin/PythonLabView | 489 | 3310634 | <filename>test_animation.py
import sys
import time
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
import pyqtgraph as pg
class App(QtGui.QMainWindow):
def __init__(self, parent=None):
super(App, self).__init__(parent)
#### Create Gui Elements ###########
self.mainbox = QtGui.QW... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_reward_functions/test_reward_functions.py | RaviPandey33/gym-electric-motor-1 | 179 | 3310677 | from __future__ import annotations
import numpy as np
import pytest
from gym_electric_motor import RewardFunction
from ..testing_utils import DummyReferenceGenerator, DummyPhysicalSystem, DummyConstraintMonitor
class MockRewardFunction(RewardFunction):
"""Mock RewardFunction that only implements the basics to te... | 3 | 2 | 0 | 0 | 5 | 0 |
commands/__init__.py | idxn/sublime-robot-framework-assistant | 103 | 3310691 | <reponame>idxn/sublime-robot-framework-assistant<filename>commands/__init__.py
from .command_logging import LogCommands
from .index_open_tab import IndexOpenTabCommand
from .jump_to_keyword import JumpToKeyword
from .on_save_create_table import OnSaveCreateTable
from .open_log_file import OpenLogFile
from .query_c... | 0 | 0 | 0 | 0 | 0 | 0 |
fastapi_sqlmodel_typer/__main__.py | tzengwei/fastapi-sqlmodel-typer | 123 | 3310699 | # pragma: no cover
from .cli import cli
main = cli
if __name__ == "__main__": # pragma: no cover
main()
| 0 | 0 | 0 | 0 | 0 | 0 |
travis_cargo.py | huonw/travis-cargo | 201 | 3310701 | from __future__ import annotations
from __future__ import print_function
import argparse
import os, sys, subprocess, json, re
def run(*args, **kwargs):
# use the current environment, but override the vars the caller
# specified
env = os.environ.copy()
env.update(kwargs.get('env', {}))
ret = subpro... | 2 | 8 | 0 | 0 | 10 | 0 |
experiment/preprocessor/splitter.py | seonglae/commit-autosuggestions | 303 | 3310720 | <reponame>seonglae/commit-autosuggestions<gh_stars>100-1000
# Copyright 2020-present <NAME>
#
# 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
... | 0 | 0 | 0 | 0 | 0 | 0 |
pysteps/tests/test_motion_lk.py | leabeusch/pysteps | 285 | 3310751 | <gh_stars>100-1000
# coding: utf-8
"""
"""
import pytest
import numpy as np
from pysteps import motion, verification
from pysteps.tests.helpers import get_precipitation_fields
lk_arg_names = (
"lk_kwargs",
"fd_method",
"dense",
"nr_std_outlier",
"k_outlier",
"size_opening",
"decl_scale",... | 0 | 0 | 0 | 0 | 0 | 0 |
xfeat/selector/_filter.py | Drunkar/xfeat | 304 | 3310767 | <gh_stars>100-1000
"""Filter-based feature selection methods."""
from typing import List
from logging import getLogger
from sklearn.feature_selection import chi2
from sklearn.feature_selection import f_classif
from sklearn.feature_selection import f_regression
from sklearn.feature_selection import mutual_info_classif
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/program/test_extract.py | augusto-herrmann/frictionless-py | 247 | 3310801 | import json
import yaml
from typer.testing import CliRunner
from frictionless import program, extract, Detector, helpers
runner = CliRunner()
IS_UNIX = not helpers.is_platform("windows")
# General
def test_program_extract():
result = runner.invoke(program, "extract data/table.csv")
assert result.exit_code ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/test/java/com/google/devtools/build/skydoc/testdata/proto_format_test/input.bzl | jobechoi/bazel | 16,989 | 3310803 | """Input file for proto format test"""
def check_function(foo):
"""Runs some checks on the given function parameter.
This rule runs checks on a given function parameter.
Use `bazel build` to run the check.
Args:
foo: A unique name for this rule.
"""
pass
example = provider(
doc =... | 0 | 0 | 0 | 0 | 0 | 0 |
example/utils.py | jose-carmona/keras-transformer | 555 | 3310807 | import math
import warnings
import h5py
from keras import Model
def load_optimizer_weights(model: Model, model_save_path: str):
"""
Loads optimizer's weights for the model from an HDF5 file.
"""
with h5py.File(model_save_path, mode='r') as f:
if 'optimizer_weights' in f:
# Build t... | 7 | 3 | 0 | 0 | 10 | 0 |
modules/ducktests/tests/ignitetest/services/utils/ssl/connector_configuration.py | vvteplygin/ignite | 4,339 | 3310826 | <reponame>vvteplygin/ignite
# 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 the Apache License, Version 2.0
# (the ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/debug_ex_advanced.py | martinpeck/locust-plugins | 242 | 3310850 | # a more in-depth example of how to use run_single_user in combination with init method, and then stop the test immediately
from locust import task, HttpUser, events
from locust.exception import StopUser
from locust_plugins import run_single_user
from locust_plugins import listeners
import time
class MyUser(HttpUser)... | 0 | 0 | 0 | 0 | 0 | 0 |
petl/test/io/test_pandas.py | OptionMetrics/petl | 495 | 3310851 | <filename>petl/test/io/test_pandas.py
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import sys
import petl as etl
from petl.test.helpers import ieq
from petl.io.pandas import todataframe, fromdataframe
try:
# noinspection PyUnresolvedReferences
import pandas as p... | 0 | 0 | 0 | 0 | 0 | 0 |
src/_dependencies/objects/enum.py | dry-python/dependencies | 175 | 3310863 | from enum import Enum
from inspect import isclass
from _dependencies.exceptions import DependencyError
def _is_enum(name, dependency):
if (
not name.endswith("_class")
and isclass(dependency)
and issubclass(dependency, Enum)
):
message = enum_template.format(name=name)
... | 0 | 0 | 0 | 0 | 0 | 0 |
venv/lib/python3.7/site-packages/allauth/socialaccount/providers/spotify/urls.py | vikram0207/django-rest | 6,342 | 3310887 | <reponame>vikram0207/django-rest
from allauth.socialaccount.providers.oauth.urls import default_urlpatterns
from .provider import SpotifyOAuth2Provider
urlpatterns = default_urlpatterns(SpotifyOAuth2Provider)
| 0 | 0 | 0 | 0 | 0 | 0 |
mne/tests/test_defaults.py | stevemats/mne-python | 1,953 | 3310903 | from copy import deepcopy
import pytest
from numpy.testing import assert_allclose
from mne.defaults import _handle_default
from mne.io.base import _get_scaling
def test_handle_default():
"""Test mutable default."""
x = deepcopy(_handle_default('scalings'))
y = _handle_default('scalings')
z = _handle_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fast_tests/test_aimsun_api.py | SHITIANYU-hue/flow | 805 | 3310924 |
import flow.config as config
import flow.utils.aimsun.constants
from flow.utils.aimsun.api import FlowAimsunAPI
from flow.utils.aimsun.struct import InfVeh
import unittest
import os
import subprocess
import numpy as np
class TestConstants(unittest.TestCase):
"""Tests for various aspect of the Aimsun constants in... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/hikari/internal/test_enums.py | sabidib/hikari | 520 | 3310925 | # -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021 davfsa
#
# 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 right... | 0 | 24 | 0 | 0 | 24 | 0 |
tests/oauth2/rfc6749/endpoints/test_utils.py | braedon/oauthlib | 954 | 3310942 | import urllib.parse as urlparse
def get_query_credentials(uri) -> object:
return urlparse.parse_qs(urlparse.urlparse(uri).query,
keep_blank_values=True)
def get_fragment_credentials(uri) -> object:
return urlparse.parse_qs(urlparse.urlparse(uri).fragment,
keep_blank_values=True)
| 0 | 2 | 0 | 0 | 2 | 0 |
examples/simple.py | vishalbelsare/skpro | 112 | 3310945 | <filename>examples/simple.py
from sklearn.datasets.base import load_boston
from sklearn.model_selection import train_test_split
from skpro.baselines import DensityBaseline
from skpro.metrics import log_loss
# Load boston housing data
X, y = load_boston(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_sp... | 0 | 0 | 0 | 0 | 0 | 0 |
holidays/countries/czechia.py | m-ganko/python-holidays | 654 | 3310961 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ry... | 0 | 0 | 0 | 0 | 0 | 0 |
third_party/tests/Opentitan/util/i2csvg.py | parzival3/Surelog | 1,375 | 3311010 | #!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Command-line tool to convert i2c to svg
"""
import argparse
import logging as log
import sys
from pathlib import PurePath
import pkg_resources ... | 0 | 0 | 0 | 0 | 0 | 0 |
calvin/actorstore/systemactors/std/Compare.py | gabrielcercel/calvin-base | 334 | 3311015 | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... | 0 | 1 | 4 | 0 | 5 | 0 |
tests/tensorflow/test_bn_adaptation.py | MaximProshin/nncf | 136 | 3311024 | from __future__ import annotations
"""
Copyright (c) 2022 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 ap... | 5 | 3 | 0 | 0 | 8 | 0 |
modules/system-audio/conanfile.py | alexa/aac-sdk | 139 | 3311030 | <filename>modules/system-audio/conanfile.py
from conans import ConanFile
import logging, json, os
class AutoSdkModulePkg(ConanFile):
python_requires = "aac-sdk-tools/1.0"
python_requires_extend = "aac-sdk-tools.BaseSdkModule"
module_name = "system-audio"
module_requires = ["core", "alexa"]
# the pa... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/ja/test_02_09.py | Jette16/spacy-course | 2,085 | 3311057 | <filename>exercises/ja/test_02_09.py<gh_stars>1000+
def test():
assert 'spacy.load("ja_core_news_md")' in __solution__, "中サイズのモデルをロードしましたか?"
assert "doc[7].vector" in __solution__, "正しいベクトルを取得しましたか?"
__msg__.good("Well done!次章では、単語ベクトルを用いたdoc、スパン、トークン間の類似度の予測を行います。")
| 0 | 0 | 0 | 0 | 0 | 0 |
dependency-lock/check.py | bmwcarit/joynr | 151 | 3311080 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# #%L
# %%
# Copyright (C) 2021 BMW Car IT GmbH
# %%
# 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 | 0 | 0 | 0 | 0 | 0 |
tests/test_dns.py | PyO3/tokio | 239 | 3311082 | # Copied from the uvloop project. If you add a new unittest here,
# please consider contributing it to the uvloop project.
#
# Portions copyright (c) 2015-present MagicStack Inc. http://magic.io
import socket
import pytest
@pytest.mark.parametrize(
'args', [(('example.com', 80), {}),
(('example.c... | 0 | 0 | 0 | 0 | 0 | 0 |
esphome/components/mitsubishi/climate.py | OttoWinter/esphomeyaml | 249 | 3311127 | import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import climate_ir
from esphome.const import CONF_ID
CODEOWNERS = ["@RubyBailey"]
AUTO_LOAD = ["climate_ir"]
mitsubishi_ns = cg.esphome_ns.namespace("mitsubishi")
MitsubishiClimate = mitsubishi_ns.class_("MitsubishiClimate", cl... | 0 | 0 | 0 | 0 | 0 | 0 |
nsenter/__main__.py | dalazx/python-nsenter | 130 | 3311172 | <gh_stars>100-1000
from nsenter import main
main()
| 0 | 0 | 0 | 0 | 0 | 0 |
helper.py | sanghuynh1501/speech_denoising_tensorflow | 184 | 3311205 | from __future__ import annotations
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
# LEAKY RELU UNIT
def lrelu(x) -> object:
return tf.maximum(0.2*x,x)
# GENERATE DILATED LAYER FROM 1D SIGNAL
def signal_to_dilated(signal, dilation, n_channels) -> tuple[object, object]:
shap... | 1 | 8 | 0 | 0 | 9 | 0 |
test/test_image_streamer_build_plan.py | nabhajit-ray/oneview-ansible | 108 | 3311206 | #!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2016-2017) Hewlett Packard Enterprise Development LP
#
# 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 | 0 | 0 | 0 | 0 | 0 |
app/src/thirdparty/telemetry/web_perf/metrics/blob_timeline_unittest.py | ta2edchimp/big-rig | 925 | 3311245 | <gh_stars>100-1000
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from collections import namedtuple
from telemetry.internal.results import page_test_results
from telemetry.page import pa... | 0 | 0 | 0 | 0 | 0 | 0 |
idea/tests/banner_tests.py | mikiec84/idea-box | 111 | 3311252 | <gh_stars>100-1000
import datetime
from django.test import TestCase
from idea import models, views
def get_relative_date(delta_days=0):
return datetime.date.today() + datetime.timedelta(days=delta_days)
class BannerTest(TestCase):
def test_timebound_banner(self):
yesterday = get_relative_date(-1)
... | 0 | 0 | 0 | 0 | 0 | 0 |
interop_2016/ex3_loops/simple_for.py | fallenfuzz/pynet | 528 | 3311290 |
my_list = [1, 2, 9, 'whatever', True, []]
for element in my_list:
print element
| 0 | 0 | 0 | 0 | 0 | 0 |
kubestrike/batch_v1api.py | tpoindessous/kubestrike | 779 | 3311312 | <filename>kubestrike/batch_v1api.py
import requests
class BatchV1Api(object):
def __init__(self, service_url, token=''):
self.service_url = service_url
self.token = token
self.api_end_point = 'apis/batch/v1'
self.url = self.service_url + "/" + str(self.api_end_point)
self.s... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/process_perf_combined.py | cohortfsllc/cohort-cocl2-sandbox | 2,151 | 3311332 | #!/usr/bin/python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
import sys
# Combine chromium-style perf log output from multiple runs.
# Input is text *containing* the chrome buildbo... | 0 | 2 | 0 | 0 | 2 | 0 |
Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/nnvm/tests/python/unittest/test_top_level2.py | mengkai94/training_results_v0.6 | 1,872 | 3311341 | <gh_stars>1000+
import nnvm.symbol as sym
def test_conv2d():
x = sym.Variable('x')
y = sym.conv2d(x, channels=3, kernel_size=(3, 3),
name="y", use_bias=False)
assert y.list_input_names() == ["x", "y_weight"]
def test_max_pool2d():
x = sym.Variable('x')
y = sym.max_pool2d(x, poo... | 0 | 0 | 0 | 0 | 0 | 0 |
my/rss/feedly.py | aluhrs13/HPI | 1,026 | 3311344 | <reponame>aluhrs13/HPI
"""
Feedly RSS reader
"""
from my.config import feedly as config
from pathlib import Path
from typing import Sequence
from ..core.common import listify, get_files
from .common import Subscription
def inputs() -> Sequence[Path]:
return get_files(config.export_path)
import json
@listif... | 0 | 0 | 0 | 0 | 0 | 0 |
python/python-eval/src/server.py | san0808/websitesVulnerableToSSTI | 288 | 3311409 | <reponame>san0808/websitesVulnerableToSSTI<filename>python/python-eval/src/server.py
# for this we need to install flask
from flask import *
app = Flask(__name__)
@app.route('/',methods=['GET', 'POST'])
def base():
expression = "1+1"
if request.method == 'POST':
if request.form['expression']:
exp... | 0 | 0 | 0 | 0 | 0 | 0 |
spytest/apis/switching/udld.py | shubav/sonic-mgmt | 132 | 3311443 | <filename>spytest/apis/switching/udld.py
from spytest import st
from spytest.utils import filter_and_select
from tabulate import tabulate
import apis.system.basic as basic_obj
import time
from apis.system.rest import config_rest, delete_rest, get_rest
from utilities.utils import get_interface_number_from_name
def prin... | 0 | 0 | 0 | 0 | 0 | 0 |
old/ex8_1_unet_cifar10_org.py | soyoung9306/-3-keras | 200 | 3311451 | #######################################################################################
# unet_conv_cifar10rgb_mc.py
# Convlutional Layer UNET with RGB Cifar10 dataset and Class with Keras Model approach
#######################################################################################
#import matplotlib
#matplotl... | 6 | 6 | 0 | 0 | 12 | 0 |
ps2000aExamples/ps2000aSigGen.py | shikajiro/picosdk-python-wrappers | 114 | 3311479 | #
# Copyright (C) 2018 Pico Technology Ltd. See LICENSE file for terms.
#
# PicoScope 2000 (A API) Series Signal Generator Example
# This example demonstrates how to use the PicoScope 2000 Series (ps2000a) driver API functions to set up the signal generator to do the following:
#
# 1. Output a sine wave
# 2. O... | 0 | 0 | 0 | 0 | 0 | 0 |
hoomd/data/local_access_gpu.py | XT-Lee/hoomd-blue | 204 | 3311481 | # Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""Implement local access classes for the GPU."""
from hoomd import _hoomd
from hoomd.data.local_access import (
ParticleLocalAccessBase, BondLocalAccessBas... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/client.py | switchdin/pyslack | 116 | 3311483 | # coding: utf-8
import datetime
import unittest
from mock import Mock, patch
import pyslack
class ClientTest(unittest.TestCase):
token: str = "my token"
@patch('requests.post')
def test_post_message(self, r_post):
"""A message can be posted to a channel"""
client = pyslack.SlackClient(... | 0 | 0 | 1 | 0 | 1 | 0 |
www/tests/compression/test_deflate.py | raspberrypieman/brython | 5,926 | 3311499 | <reponame>raspberrypieman/brython
import zlib
import deflate
import lz77
compresser = zlib.compressobj(wbits=15)
text = """Pleurez, doux alcyons, ô vous, oiseaux sacrés,
Oiseaux chers à Thétis, doux alcyons, pleurez.
Elle a vécu, Myrto, la jeune Tarentine.
Un vaisseau la portait aux bords de Camarine.
Là l'hymen, le... | 0 | 0 | 0 | 0 | 0 | 0 |
src/crypto/crypto_ops_builder/ref10CommentedCombined/test.py | simplixcurrency/simplix | 7,521 | 3311515 | import os
l = "(((int) (s[0] | s[1] | s[2] | s[3] | s[4] | s[5] | s[6] | s[7] | s[8] | s[9] | s[10] | s[11] | s[12] | s[13] | s[14] | s[15] | s[16] | s[17] | s[18] | s[19] | s[20] | s[21] | s[22] | s[23] | s[24] | s[25] | s[26] | s[27] | s[28] | s[29] | s[30] | s[31]) - 1) >> 8) + 1;"
os.system("sed -i 's/crypto_verif... | 0 | 0 | 0 | 0 | 0 | 0 |
pylayers/util/tests/test_geomutil.py | usmanwardag/pylayers | 143 | 3311520 | # -*- coding:Utf-8 -*-
import pylayers.util.geomutil as geu
import pylayers.util.plotutil as plu
import shapely.geometry as shg
import numpy as np
from numpy.testing import (TestCase, assert_almost_equal, assert_raises, assert_equal, assert_, run_module_suite)
class Tesgeu(TestCase):
def test_onb(self):
pr... | 0 | 0 | 0 | 0 | 0 | 0 |
sandbox/test_posting.py | kanishkaSun26/netwulf | 279 | 3311521 | from netwulf.tools import bind_positions_to_network
import networkx as nx
if __name__ == "__main__":
import pprint
pp = pprint.PrettyPrinter(indent=4)
G = nx.Graph()
G.add_nodes_from(range(10))
G.add_nodes_from("abcde")
G.add_edges_from([("a","b")])
from netwulf import visualize
prop... | 0 | 0 | 0 | 0 | 0 | 0 |
commands/nick.py | nstra111/autovc | 177 | 3311526 | from __future__ import annotations
import utils
import functions as func
from commands.base import Cmd
help_text = [
[
("Usage:", "<PREFIX><COMMAND> `name`"),
("Description:",
"Set a nickname for yourself that will be used only in voice channel names, "
"if `@@creator@@` is in the... | 0 | 1 | 0 | 0 | 1 | 0 |
evaluation/vg_evaluation.py | Deanplayerljx/bottom-up-attention.pytorch | 210 | 3311536 | from __future__ import annotations
import os, io
import numpy as np
import copy
import torch
import logging
import pickle as cPickle
import itertools
import contextlib
from pycocotools.coco import COCO
from collections import OrderedDict
from fvcore.common.file_io import PathManager
import detectron2.utils.comm as co... | 5 | 4 | 0 | 4 | 13 | 0 |
tests/test_io/test_out1.py | leonardt/magma | 167 | 3311563 | from magma import *
from magma.testing import check_files_equal
def test():
class main(Circuit):
name = "main"
io = IO(O=Out(Bit))
wire(1, io.O)
compile("build/out1", main, output="verilog")
assert check_files_equal(__file__, "build/out1.v", "gold/out1.v")
| 0 | 0 | 0 | 0 | 0 | 0 |
auxiliary/dataset.py | tirilsu/PoseFromShape | 162 | 3311586 | <filename>auxiliary/dataset.py<gh_stars>100-1000
import torch.utils.data as data
import os
from os.path import join, basename
import torch
import torchvision.transforms as transforms
import numpy as np
from PIL import Image, ImageFilter
import pandas as pd
import cv2
import math
import pymesh
# Lighting noise transfo... | 0 | 0 | 0 | 0 | 0 | 0 |
text_generation/train_tf2.py | Ashafix/NLP | 103 | 3311590 | import os
from collections import Counter
import numpy as np
import tensorflow as tf
flags = tf.compat.v1.app.flags
flags.DEFINE_string('train_file', 'oliver.txt', 'text file to train LSTM')
flags.DEFINE_integer('seq_size', 32, 'sequence length')
flags.DEFINE_integer('batch_size', 16, 'batch size')
flags.DEFINE_inte... | 0 | 6 | 0 | 0 | 6 | 0 |
alignment/heatmapReg/symbol/sym_heatmap.py | dwhite54/insightface | 12,377 | 3311620 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import mxnet as mx
import numpy as np
from config import config
ACT_BIT = 1
bn_mom = 0.9
workspace = 256
memonger = False
def Conv(**kwargs) -> object:
body = mx.sym.Convolution(**kwargs)
return body
... | 21 | 22 | 0 | 3 | 46 | 0 |
modules/nltk_contrib/scripttranscriber/documents.py | h4ck3rm1k3/NLP-project | 123 | 3311630 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
## 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 a... | 0 | 0 | 0 | 0 | 0 | 0 |
pajbot/web/routes/base/user.py | UVClay/SkookumBot | 145 | 3311635 | from __future__ import annotations
from flask import render_template
from pajbot.managers.db import DBManager
from pajbot.models.roulette import Roulette
from pajbot.models.user import User
def init(app) -> object | tuple[object, int]:
@app.route("/user/<login>")
def user_profile(login) -> object | tuple[obj... | 0 | 2 | 0 | 0 | 2 | 0 |
CountingGridsPy/EngineToBrowseCloudPipeline/surveyData.py | csbuja/browsecloud | 159 | 3311663 | <reponame>csbuja/browsecloud<gh_stars>100-1000
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class SurveyData(object):
def __init__(self, alias, title, abstract, responseId, surveyId, link, image):
self.alias = alias
self.title = title
self.a... | 0 | 0 | 0 | 0 | 0 | 0 |
pythonparse/jvm/src/test/resources/pythonparse/parse.py | joprice/fastparse | 929 | 3311684 | <reponame>joprice/fastparse
import sys
import ast
ast.parse(open(sys.argv[1]).read()) | 0 | 0 | 0 | 0 | 0 | 0 |
snapx/snapx/classes/_nodeiter.py | ruth-ann/snap-python | 242 | 3311705 | <reponame>ruth-ann/snap-python<gh_stars>100-1000
"""Defines private classes for vairous iterators
"""
from snap import TIntV, TFltV, TStrV
from collections.abc import Generator
class _BaseIterator:
def __init__(self, it):
if not isinstance(it, Generator):
raise TypeError('Expected Generator, bu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_fields.py | 666asd/pfp | 194 | 3311723 | #!/usr/bin/env python
# encoding: utf-8
import os
try:
from StringIO import StringIO
# StringIO does not exist in python3
except ImportError as e:
from io import StringIO
import struct
import sys
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import pfp
import pfp.errors
f... | 0 | 0 | 0 | 0 | 0 | 0 |
metakernel/magics/tests/test_file_magic.py | StephanRempel/metakernel | 276 | 3311739 | <filename>metakernel/magics/tests/test_file_magic.py
import os
from metakernel.tests.utils import get_kernel
def test_file_magic():
kernel = get_kernel()
kernel.do_execute("""%%file TEST.txt
LINE1
LINE2
LINE3""", False)
assert os.path.exists("TEST.txt")
with open("TEST.txt") as fp:
lines = fp... | 0 | 0 | 0 | 0 | 0 | 0 |
aliyun-python-sdk-green/aliyunsdkgreen/__init__.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 3311748 | <reponame>yndu13/aliyun-openapi-python-sdk
__version__ = '3.6.5' | 0 | 0 | 0 | 0 | 0 | 0 |
learn2learn/__init__.py | Brikwerk/learn2learn | 1,774 | 3311751 | <gh_stars>1000+
#!/usr/bin/env python3
from ._version import __version__
from . import algorithms
from . import data
from . import gym
from . import text
from . import vision
from . import optim
from . import nn
from .utils import *
| 0 | 0 | 0 | 0 | 0 | 0 |
streamalert_cli/rule_table.py | cninja1/streamalert | 2,770 | 3311758 | <gh_stars>1000+
"""
Copyright 2017-present Airbnb, 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... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/losses.py | tansyab1/LightNetPlus | 240 | 3311760 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #
# LightNet++: Boosted Light-weighted Networks for Real-time Semantic Segmentation
# ---------------------------------------------------------------------------------------------------------------- #
# Co... | 21 | 12 | 0 | 0 | 33 | 0 |
challenges/3.1.Assignment_Operator/main.py | pradeepsaiu/python-coding-challenges | 141 | 3311795 | ### Write your code below this line. ###
### Write your code above this line. ###
print("Hello, my name is " + my_name)
| 0 | 0 | 0 | 0 | 0 | 0 |
vilya/models/tips.py | mubashshirjamal/code | 1,582 | 3311807 | <reponame>mubashshirjamal/code
# -*- coding: utf-8 -*-
import random
tips = (
(u'用f这个快捷键就可以fork项目了哦', ''),
(u'用p这个快捷键就可以发起pullrequest了哦', ''),
(u'Code上的项目现在已经有了Hook功能了,你是否尝试过?', '/code/hooks'),
(u'Code的徽章系统已经上线了', '/people/qingfeng/'),
(u'Code上面已经可以看到代码提交频次的图表了', '/code/graph'),
(u'Code上面已经可以看... | 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.