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 |
|---|---|---|---|---|---|---|---|---|---|---|
examples/language-model/vocab.py | greedyuser/kur | 867 | 1664174 | <filename>examples/language-model/vocab.py
"""
Copyright 2016 Deepgram
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 l... | 0 | 0 | 0 | 0 | 0 | 0 |
harness/tests/experiment/fixtures/keras_cb_checker.py | gh-determined-ai/determined | 1,729 | 1664179 | import io
from typing import Any, Callable, Dict, List, Optional, Set
import determined as det
import determined.keras
train_begin = "on_train_begin"
train_workload_begin = "on_train_workload_begin"
train_batch_begin = "on_train_batch_begin"
train_batch_end = "on_train_batch_end"
train_workload_end = "on_train_worklo... | 45 | 26 | 0 | 0 | 71 | 0 |
openelex/exceptions.py | Mpopoma/oe-core | 156 | 1664196 | <filename>openelex/exceptions.py<gh_stars>100-1000
class ValidationError(Exception):
"Raise in models"
class UnsupportedFormatError(Exception):
"""
Raised when trying to read from or write to an unsupported file format.
"""
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
medtype-trainer/neleval/neleval/analyze.py | vsocrates/medtype | 113 | 1664216 | <gh_stars>100-1000
from collections import Counter
from collections import namedtuple
from .document import Reader
from .evaluate import get_measure, Evaluate
from .utils import utf8_open, unicode
class _Missing(object):
def __str__(self):
return "MISSING"
MISSING = _Missing()
class LinkingError(named... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoTracker/TrackProducer/python/TrackRefitter_cfi.py | ckamtsikis/cmssw | 852 | 1664230 | <filename>RecoTracker/TrackProducer/python/TrackRefitter_cfi.py
import FWCore.ParameterSet.Config as cms
TrackRefitter = cms.EDProducer("TrackRefitter",
src = cms.InputTag("generalTracks"),
beamSpot = cms.InputTag("offlineBeamSpot"),
Fitter = cms.string('KFFittingSmootherWithOutliersRejectionAndRK'),
T... | 0 | 0 | 0 | 0 | 0 | 0 |
lte/gateway/python/magma/pipelined/app/ingress.py | nstng/magma | 539 | 1664254 | """
Copyright 2022 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES O... | 0 | 5 | 1 | 4 | 10 | 0 |
tests/epyccel/modules/python_annotations.py | dina-fouad/pyccel | 206 | 1664262 | # pylint: disable=missing-function-docstring, missing-module-docstring/
def array_int32_1d_scalar_add( x:'int32[:]', a:'int32' ):
x[:] += a
def array_int32_2d_C_scalar_add( x:'int32[:,:]', a:'int32' ):
x[:,:] += a
def array_int32_2d_F_add( x:'int32[:,:](order=F)', y:'int32[:,:](order=F)' ):
x[:,:] += y
... | 19 | 1 | 0 | 0 | 20 | 0 |
itwmm/fitting/algorithm.py | qiaone/itwmm | 192 | 1664295 | from __future__ import annotations
from collections import defaultdict
from datetime import timedelta
from time import time
import numpy as np
from scipy import sparse as sp
from menpo.visualize import bytes_str, print_progress
from .base import gradient_xy, camera_parameters_update
from .hessian import (initialize_... | 25 | 3 | 0 | 0 | 28 | 0 |
modules/dbnd/test_dbnd/orchestration/test_cmdline.py | busunkim96/dbnd | 224 | 1664325 | <reponame>busunkim96/dbnd
from __future__ import print_function
import json
import logging
import pytest
import dbnd
from dbnd import PythonTask, Task, config, dbnd_run_cmd, output, parameter
from dbnd._core.errors import (
DatabandRunError,
TaskClassAmbigiousException,
TaskClassNotFoundException,
)
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/CrawlerProcess/caching_hostname_resolver.py | FingerCrunch/scrapy | 41,267 | 1664336 | import sys
import scrapy
from scrapy.crawler import CrawlerProcess
class CachingHostnameResolverSpider(scrapy.Spider):
"""
Finishes in a finite amount of time (does not hang indefinitely in the DNS resolution)
"""
name: str = "caching_hostname_resolver_spider"
def start_requests(self):
y... | 0 | 0 | 1 | 0 | 1 | 0 |
tests/admin/clush-tests/TreeTaskTest.py | utdsimmons/ohpc | 692 | 1664371 | <filename>tests/admin/clush-tests/TreeTaskTest.py
#!/usr/bin/env python
# ClusterShell.Task tree test suite
import logging
import os
import unittest
from ClusterShell.Task import task_self
from ClusterShell.Topology import TopologyError
from TLib import HOSTNAME, make_temp_file
# live logging with nosetests --nolog... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/python/contrib/test_ethosu/cascader/test_plan.py | XiaoSong9905/tvm | 4,640 | 1664372 | <reponame>XiaoSong9905/tvm
# 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 |
python/interpret-core/interpret/blackbox/permutationimportance.py | prateekiiest/interpret | 2,674 | 1664379 | <gh_stars>1000+
# # Copyright (c) 2019 Microsoft Corporation
# # Distributed under the MIT software license
#
# import scipy as sp
# import numpy as np
#
# import sklearn.metrics
# from scipy.sparse import SparseEfficiencyWarning
#
# from ..utils import gen_name_from_class, gen_local_selector
#
# from interpret.api.bas... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/util/truncate_test.py | thecoblack/CompilerGym | 562 | 1664385 | <reponame>thecoblack/CompilerGym
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Unit tests for //compiler_gym/util:truncate."""
from compiler_gym.util.truncate import truncate, truncate_l... | 0 | 0 | 0 | 0 | 0 | 0 |
mockredis/exceptions.py | jbagot/mockredis | 188 | 1664395 | """
Emulates exceptions raised by the Redis client, if necessary.
"""
try:
# Prefer actual exceptions to defining our own, so code that swaps
# in implementations does not have to swap in different exception
# classes.
from redis.exceptions import RedisError, ResponseError, WatchError
except ImportErro... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/ml-auto-eda/tests/quantitative_analyzer_test.py | ruchirjain86/professional-services | 2,116 | 1664398 | # Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | 0 | 0 | 0 | 0 | 0 | 0 |
app/server.py | itielshwartz/sanic-nginx-docker-exmaple | 102 | 1664417 | <gh_stars>100-1000
import os
from sanic import Sanic
from sanic.response import json
from app.utils.helper import hello_world
SANIC_PREFIX = "SANIC_"
app = Sanic()
@app.route("/hello-world")
async def test(request):
return json(hello_world())
app.static('/static', './static') # while in docker files from s... | 0 | 0 | 0 | 0 | 0 | 0 |
Android/NDK/android-ndk-r20b-win/sources/cxx-stl/llvm-libc++/utils/libcxx/android/test/format.py | X018/CCTOOL | 2,151 | 1664423 | <gh_stars>1000+
import os
import lit.util # pylint: disable=import-error
from libcxx.android.executors import AdbExecutor, NoopExecutor
from libcxx.test.executor import LocalExecutor, TimeoutExecutor
import libcxx.test.format
import libcxx.android.adb as adb
class HostTestFormat(libcxx.test.format.LibcxxTestFormat... | 0 | 0 | 0 | 0 | 0 | 0 |
src/robusta/integrations/msteams/msteams_adaptive_card_files.py | kandahk/robusta | 273 | 1664426 | <reponame>kandahk/robusta<gh_stars>100-1000
from typing import List
from .msteams_adaptive_card_files_image import MsTeamsAdaptiveCardFilesImage
from .msteams_adaptive_card_files_text import MsTeamsAdaptiveCardFilesText
from ...core.reporting import FileBlock
class MsTeamsAdaptiveCardFiles():
def __init__(self)... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/.venv/lib/python3.8/site-packages/fastecdsa/tests/test_keygen.py | jtatman/katersltc-client | 219 | 1664518 | <reponame>jtatman/katersltc-client<gh_stars>100-1000
from unittest import TestCase
from ..keys import gen_private_key
class TestKeygen(TestCase):
def test_gen_private_key(self):
class FakeCurve():
def __init__(self, q):
self.q = q
class FakeRandom():
def _... | 0 | 0 | 0 | 0 | 0 | 0 |
buildifier/def.bzl | paulcavallaro/buildtools | 676 | 1664558 | <filename>buildifier/def.bzl
"""
This module is the public interface to buildifier rules
"""
load(
":buildifier.bzl",
_buildifier = "buildifier",
_buildifier_test = "buildifier_test",
)
buildifier = _buildifier
buildifier_test = _buildifier_test
| 0 | 0 | 0 | 0 | 0 | 0 |
tf_rl/controller/__init__.py | EvgenyKarikov/tensorflow-deepq | 1,094 | 1664582 | <reponame>EvgenyKarikov/tensorflow-deepq<filename>tf_rl/controller/__init__.py
from .discrete_deepq import DiscreteDeepQ
from .human_controller import HumanController
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/roots/test-ext-autosummary-recursive/package2/module.py | samdoran/sphinx | 4,973 | 1664586 | <filename>tests/roots/test-ext-autosummary-recursive/package2/module.py
from os import * # NOQA
class Foo:
def __init__(self):
pass
def bar(self):
pass
@property
def baz(self):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
django_zappa/management/commands/zappa_command.py | Miserlou/django-zappa | 563 | 1664599 | from __future__ import annotations
from __future__ import absolute_import
import boto3
import botocore
import inspect
import os
import zipfile
from django.core.exceptions import ImproperlyConfigured
from django.core.management.base import BaseCommand
from django.utils.text import slugify
from zappa.zappa import Zapp... | 1 | 3 | 14 | 0 | 18 | 0 |
z3/50_puzzle.py | Wikunia/hakank | 279 | 1664623 | <filename>z3/50_puzzle.py<gh_stars>100-1000
#!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Fifty puzzle (Martin Chlond) in Z3
#
# From Martin Chlond Integer Programming Puzzles:
# http://www.chlond.demon.co.uk/puzzles/puzzles1.html, puzzle nr. 5.
# Description : Fifty puzzle
# Source : The Puzzles of Sam L... | 0 | 0 | 0 | 0 | 0 | 0 |
Elasticsearch Service/DeleteIndices/processOldESIndicesForDeletion.py | thmasgq/aws-support-tools | 1,038 | 1664633 | <gh_stars>1000+
#!/usr/bin/python
from __future__ import print_function
import requests
import datetime
import time
import sys
from pprint import pprint
########## MAIN CODE ##########
print ("-------------------")
print ("Starting program...\n")
def get_indices():
##### Variable Declarations
esEndpoint="ht... | 0 | 0 | 0 | 0 | 0 | 0 |
malmopy/util/images.py | YupengGao/malmo-challenge | 144 | 1664634 | <gh_stars>100-1000
# Copyright (c) 2017 Microsoft Corporation.
#
# 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, mo... | 0 | 0 | 0 | 0 | 0 | 0 |
December-06/python_UjjwalPrahladka_Dec6.py | UjjwalPrahladka/A-December-of-Algorithms-2019 | 228 | 1664682 | <reponame>UjjwalPrahladka/A-December-of-Algorithms-2019
def check_for_prime(x):
if x % 2 == 0 and x != 2:
return False
else:
for i in range(3,x,2):
if x % i == 0:
return False
return True
n = int(input('Enter the value for n : '))
fib_prime = []
fib = [1,1]
w... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unittests/test_utils_metric.py | Kh4L/gluon-cv | 5,447 | 1664691 | from __future__ import print_function
import numpy as np
import gluoncv as gcv
import mxnet as mx
from mxnet import autograd, gluon
from gluoncv.utils import download, viz
def test_voc07_metric_difficult() -> object:
url = 'https://apache-mxnet.s3-accelerate.amazonaws.com/gluon/dataset/pikachu/train.rec'
idx_... | 0 | 3 | 0 | 0 | 3 | 0 |
src/orion/serving/__init__.py | obilaniu/orion | 177 | 1664712 | # -*- coding: utf-8 -*-
"""
Web server
==========
Web server related features
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
resolve.py | kokizzu/tiny-resolver | 153 | 1664714 | import dns.message
import dns.query
import dns.rdatatype
import sys
def resolve(domain) -> object:
# Start at the root nameserver
nameserver = "192.168.3.11"
while True:
reply = query(domain, nameserver)
ip = get_answer(reply)
if ip:
# Best case: we get an answer to our query and... | 0 | 5 | 0 | 0 | 5 | 0 |
pycon/finaid/migrations/0007_auto_20150903_1420.py | azkarmoulana/pycon | 154 | 1664716 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('finaid', '0006_auto_20150827_1152'),
]
operations: list[object] = [
migrations.AlterField(
... | 0 | 0 | 2 | 0 | 2 | 0 |
robot/EDA/resources/ReleaseManagementPageObject.py | SalesforceFoundation/HEDAP | 112 | 1664722 | <gh_stars>100-1000
from BaseObjects import BaseEDAPage
from EDA import eda_lex_locators
from cumulusci.robotframework.pageobjects import HomePage
from cumulusci.robotframework.pageobjects import pageobject
import time
from datetime import date
@pageobject("Home", "Release Management")
class ReleaseManagementPage(Base... | 0 | 0 | 0 | 0 | 0 | 0 |
openshift_performance/ci/scripts/get_conc_build_info.py | RH-ematysek/svt | 115 | 1664764 | <gh_stars>100-1000
import subprocess
from optparse import OptionParser
import re
import time
def run(command):
try:
output = subprocess.Popen(command, shell=True,
universal_newlines=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
... | 0 | 0 | 0 | 0 | 0 | 0 |
generators/datagenerator/output.py | honey-sangtani-c5i/retail-demo-store | 404 | 1664780 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
from __future__ import annotations
from datagenerator.segment import SegmentIdentifyEvent, SegmentTrackEvent, SegmentSender
from datagenerator.amplitude import AmplitudeIdentifyEvent, AmplitudeTrackEvent, AmplitudeSen... | 3 | 5 | 0 | 0 | 8 | 0 |
maro/event_buffer/event_linked_list.py | yangboz/maro | 598 | 1664782 | <filename>maro/event_buffer/event_linked_list.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import List, Optional, Union
from .event import AbsEvent, ActualEvent, CascadeEvent, DummyEvent
from .event_state import EventState
from .maro_events import MaroEvents
class EventLink... | 0 | 0 | 0 | 0 | 0 | 0 |
python/examples/basics.py | JLLeitschuh/DDF | 160 | 1664820 | from __future__ import unicode_literals
from ddf import DDFManager, DDF_HOME
dm = DDFManager('spark')
dm.sql('set hive.metastore.warehouse.dir=/tmp/hive/warehouse', False)
dm.sql('drop table if exists mtcars', False)
dm.sql("CREATE TABLE mtcars (mpg double, cyl int, disp double, hp int, drat double, wt double,"
... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/crispy/apps.py | falinwang/dj4e-samples | 297 | 1664829 | from django.apps import AppConfig
class CrispyConfig(AppConfig):
name: str = 'crispy'
| 0 | 0 | 1 | 0 | 1 | 0 |
test/core/test_manager.py | HerySon/timeflux | 123 | 1664865 | """Tests for manager.py"""
import os
import json
import pytest
from timeflux.core.manager import Manager
test_config = {'graphs': [{'nodes': [{'id': 'node_1', 'module': 'timeflux.nodes.random', 'class': 'Random', 'params': {'columns': 5, 'rows_min': 1, 'rows_max': 10, 'value_min': 0, 'value_max': 5, 'seed': 1}}, {'id... | 0 | 0 | 0 | 0 | 0 | 0 |
demos/moderator_bot/moderator_bot/app.py | Ixyk-Wolf/aiohttp-demos | 649 | 1664868 | <gh_stars>100-1000
import asyncio
from .server import init_application
from .settings import PROJECT_ROOT
from .utils import load_config
async def get_app():
"""Used by aiohttp-devtools for local development."""
import aiohttp_debugtoolbar
config = load_config(PROJECT_ROOT / "configs" / "base.yml")
a... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/extensions/imgviewer/__init__.py | AIllIll/hyperface-new | 184 | 1664895 | from . import app
start = app.start
logger = app.logger
| 0 | 0 | 0 | 0 | 0 | 0 |
api/config.py | pianomanx/pwndora | 112 | 1664907 | import os
class Config:
DB_SERVER_NAME = os.environ.get("DB_SERVER_NAME")
DB_USERNAME = os.environ.get("DB_USERNAME")
DB_PASSWORD = <PASSWORD>("DB_PASSWORD")
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/sharepoint/load_web_fluent_api.py | rikeshtailor/Office365-REST-Python-Client | 544 | 1664920 | <reponame>rikeshtailor/Office365-REST-Python-Client<gh_stars>100-1000
from office365.sharepoint.client_context import ClientContext
from tests import test_client_credentials, test_site_url
ctx = ClientContext(test_site_url).with_credentials(test_client_credentials)
target_web = ctx.web.get().execute_query()
print(targ... | 0 | 0 | 0 | 0 | 0 | 0 |
asr/cmd/aps/loader/lm/utils.py | DanBerrebbi/AISHELL-4 | 117 | 1664922 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright 2020 <NAME>
# License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import warnings
import torch as th
import torch.utils.data as dat
from typing import List
def filter_utts(dataset: dat.Dataset,
min_token_num: int = 4,
... | 0 | 0 | 0 | 0 | 0 | 0 |
mealie/routes/groups/__init__.py | strenkml/mealie | 1,927 | 1664930 | from fastapi import APIRouter
from . import groups
groups_router = APIRouter()
groups_router.include_router(groups.router)
| 0 | 0 | 0 | 0 | 0 | 0 |
pyti/vertical_horizontal_filter.py | dibyajyotidash/https-github.com-kylejusticemagnuson-pyti | 635 | 1664956 | from __future__ import absolute_import
import numpy as np
from pyti import catch_errors
from pyti.function_helper import fill_for_noncomputable_vals
from six.moves import range
def vertical_horizontal_filter(data, period) -> object:
"""
Vertical Horizontal Filter.
Formula:
ABS(pHIGH - pLOW) / SUM(ABS... | 0 | 1 | 0 | 0 | 1 | 0 |
finance_ml/hierarchical_clustering/allocation.py | BTETON/finance_ml | 446 | 1664961 | import numpy as np
import pandas as pd
import scipy.cluster.hierarchy as sch
from .metrics import get_corr_dist
from .quasi import get_quasi_diag
def get_rec_bipart(cov, sort_idx) -> object:
"""Compute portfolio weight by recursive bisection
Params
------
cov: pd.DataFrame
sort_idx: pd.Serie... | 0 | 4 | 0 | 0 | 4 | 0 |
boto3_type_annotations_with_docs/boto3_type_annotations/clouddirectory/paginator.py | cowboygneox/boto3_type_annotations | 119 | 1665042 | <reponame>cowboygneox/boto3_type_annotations<gh_stars>100-1000
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class ListAppliedSchemaArns(Paginator):
def paginate(self, DirectoryArn: str, SchemaArn: str = None, PaginationConfig: Dict = None) -> Dict:
"""
Cr... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/networks/demo.py | klockeph/MV3D_TF | 124 | 1665060 | import tensorflow as tf
import numpy as np
import os, sys, cv2
from VGGnet_train import *
vgg = VGGnet_train()
| 0 | 0 | 0 | 0 | 0 | 0 |
utils/exporters/blender/io_nanogi/primLamp.py | lighttransport/nano | 157 | 1665081 | from __future__ import annotations
import math
from mathutils import Vector, Matrix, Color
import bpy
from .createPlane import *
def primLamp( _obj, _dirname ) -> dict[str,dict[str,dict[str,bool] | object] | dict[str,dict[str,dict[str,list[int]] | str]] | list[str]] | dict[str,dict[str,dict[str,dict[str,list[int] | o... | 0 | 2 | 0 | 0 | 2 | 0 |
Data Structure/Array Or Vector/Binary Search/solutionByVaishnavi.py | TwinkleguptaCLS/Programmers-Community | 261 | 1665083 | def binary_search(array, y) -> object:
low_index = 0
high_index = len(array) - 1
middle = 0
while low_index <= high_index:
middle = (high_index + low_index) // 2
if array[middle] < y:
low_index = middle + 1
elif array[middle] > y:
high_index = midd... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/unit/pypyr/steps/stop_test.py | mofm/pypyr | 261 | 1665086 | """stop.py unit tests."""
import pytest
from pypyr.context import Context
from pypyr.errors import Stop
import pypyr.steps.stop
def test_step_stop():
"""Raise stop from stop."""
with pytest.raises(Stop):
pypyr.steps.stop.run_step({})
def test_step_stop_context_same():
"""Context endures on Stop.... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tutorials/scripts/compression_mnist_model.py | nbl97/nni | 2,305 | 1665131 | from pathlib import Path
root_path = Path(__file__).parent.parent
# define the model
import torch
from torch import nn
from torch.nn import functional as F
class TorchModel(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 6, 5, 1)
self.conv2 = nn.Conv2d(6, 16, ... | 0 | 1 | 0 | 0 | 1 | 0 |
LeetCode/1402_Reducing_Dishes.py | Achyut-sudo/PythonAlgorithms | 144 | 1665144 | class Solution:
def maxSatisfaction(self, satisfaction: List[int]) -> int:
satisfaction.sort(reverse=True)
ans = cur_sum = 0
for ele in satisfaction:
cur_sum += ele
if cur_sum >= 0:
ans += cur_sum
return ans; | 1 | 1 | 0 | 0 | 2 | 0 |
tests/test_transforms/test_feature_selection/test_base_feature_selection_transform.py | martins0n/etna | 326 | 1665173 | import pandas as pd
import pytest
from etna.analysis import StatisticsRelevanceTable
from etna.transforms.feature_selection import MRMRFeatureSelectionTransform
@pytest.mark.parametrize(
"features_to_use, expected_features",
(
("all", ["regressor_1", "regressor_2", "exog"]),
(["regressor_1"],... | 3 | 0 | 0 | 0 | 3 | 0 |
veriloggen/types/axi.py | jesseclin/veriloggen | 232 | 1665207 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import functools
import math
from collections import defaultdict
import veriloggen.core.vtypes as vtypes
from veriloggen.seq.seq import Seq
from veriloggen.fsm.fsm import FSM
import verilog... | 0 | 0 | 0 | 0 | 0 | 0 |
befh/core/runner.py | joshua-jd-lee/BitcoinExchangeFH | 310 | 1665232 | import logging
import multiprocessing as mp
from datetime import datetime
LOGGER = logging.getLogger(__name__)
class Runner:
"""Runner.
"""
def __init__(self, config, is_debug, is_cold):
"""Constructor.
"""
self._config = config
self._is_debug = is_debug
self._is_... | 0 | 4 | 0 | 2 | 6 | 0 |
python/seldon/pipeline/tests/test_bayes_optimizer.py | smsahu/seldon-server | 1,645 | 1665243 | <filename>python/seldon/pipeline/tests/test_bayes_optimizer.py
import unittest
from .. import bayes_optimize as bopt
import seldon.xgb as xgb
import pandas as pd
import logging
class Test_BayesOptimizer(unittest.TestCase):
def test_kfold(self):
x = xgb.XGBoostClassifier(target="target",learning_rate=0.1,... | 0 | 0 | 0 | 0 | 0 | 0 |
data/dianping/remove_duplication.py | zhangxiangxiao/Glyph | 165 | 1665259 | #!/usr/bin/python3
'''
Remove duplication from csv format file
Copyright 2015 <NAME>
Usage: python3 remove_duplication.py -i [input] -o [output]
'''
# Python 3 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_lit... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/generate-a-string-with-characters-that-have-odd-counts.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1665281 | <reponame>Sourav692/FAANG-Interview-Preparation<filename>Algo and DSA/LeetCode-Solutions-master/Python/generate-a-string-with-characters-that-have-odd-counts.py
# Time: O(n)
# Space: O(1)
class Solution(object):
def generateTheString(self, n):
"""
:type n: int
:rtype: str
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/465868_A_ThunkSpace_for_Python/recipe-465868.py | tdiprima/code | 2,023 | 1665287 | <gh_stars>1000+
class ThunkSpace(object):
"""
A ThunkSpace for Python. Assigning functions to an instance of ThunkSpace
will turn the function into a lazily evaluated attribute.
"""
def __setattr__(self, name, func):
def delete(self):
delattr(self.__class__, name)
... | 0 | 0 | 0 | 0 | 0 | 0 |
external/lemonade/dist/lemonade/acttab.py | almartin82/bayeslite | 964 | 1665296 | '''
This module implements routines use to construct the yy_action[] table.
'''
from struct import *
from ccruft import struct
# The state of the yy_action table under construction is an instance
# of the following structure.
#
# The yy_action table maps the pair (state_number, lookahead) into an
# action_number. ... | 0 | 7 | 0 | 0 | 7 | 0 |
modules/map/proto/map_speed_control_pb2.py | jiyongfeng/imap | 187 | 1665303 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: modules/map/proto/map_speed_control.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... | 0 | 0 | 0 | 0 | 0 | 0 |
course/system_operations/AMIFinder/findAMI.py | nkhanal0/aws-training-demo | 105 | 1665316 | <filename>course/system_operations/AMIFinder/findAMI.py
# Copyright 2014-2015 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://a... | 0 | 0 | 0 | 0 | 0 | 0 |
indra/tools/analyze_ontology.py | kkaris/indra | 136 | 1665341 | from collections import Counter, defaultdict
import networkx
from indra.ontology.bio import bio_ontology
def plot_problem(problem):
import matplotlib.pyplot as plt
plt.ion()
plt.figure()
G = bio_ontology.subgraph(problem)
pos = networkx.spring_layout(G)
networkx.draw_networkx(G, pos, node_colo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/flat_map_test.py | lmicra/paco | 208 | 1665364 | # -*- coding: utf-8 -*-
import pytest
import asyncio
from paco import flat_map
from .helpers import run_in_loop
@asyncio.coroutine
def coro(num) -> object:
return num * 2
def test_flat_map():
task = flat_map(coro, [1, [2, 3, 4], 5, 6, (7, [8, [(9,)]])])
results = run_in_loop(task)
results.sort()
... | 0 | 1 | 0 | 0 | 1 | 0 |
gravity/__init__.py | fossabot/fermentrack | 114 | 1665381 | default_app_config = 'gravity.apps.GravityAppConfig'
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/vm_scheduling/rule_based_algorithm/random_pick.py | yangboz/maro | 598 | 1665427 | import random
from maro.simulator import Env
from maro.simulator.scenarios.vm_scheduling import AllocateAction, DecisionPayload
from rule_based_algorithm import RuleBasedAlgorithm
class RandomPick(RuleBasedAlgorithm):
def __init__(self, **kwargs):
super().__init__()
def allocate_vm(self, de... | 2 | 1 | 3 | 0 | 6 | 0 |
zeus/web/hooks/__init__.py | conrad-kronos/zeus | 221 | 1665454 | <reponame>conrad-kronos/zeus
from .build import * # NOQA
from .change_request import * # NOQA
from .job_artifacts import * # NOQA
from .job import * # NOQA
| 0 | 0 | 0 | 0 | 0 | 0 |
src/lib/repr.py | DTenore/skulpt | 2,671 | 1665461 | import _sk_fail; _sk_fail._("repr")
| 0 | 0 | 0 | 0 | 0 | 0 |
tools/fix_pythonpath.py | pospx/external_skia | 6,304 | 1665467 | <reponame>pospx/external_skia
#!/usr/bin/env python
# Copyright (c) 2014 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.
"""Add the checkout root to sys.path, provide mechanisms for adding others."""
import os
import sy... | 0 | 0 | 0 | 0 | 0 | 0 |
code/python/src/test_lua_state.py | ShakeM/luago-book | 723 | 1665478 | from vm.lua_state import LuaState
def main():
ls = LuaState()
ls.push_boolean(True)
ls.print_stack()
ls.push_integer(10)
ls.print_stack()
ls.push_nil()
ls.print_stack()
ls.push_string('hello')
ls.print_stack()
ls.push_value(-4)
ls.print_stack()
ls.replace(3)
ls.pri... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_empty_suffix.py | Ket3r/copier | 438 | 1665486 | import copier
from .helpers import build_file_tree
def test_empty_suffix(tmp_path_factory):
root = tmp_path_factory.mktemp("demo_empty_suffix")
build_file_tree(
{
root
/ "copier.yaml": """
_templates_suffix: ""
name:
type: st... | 0 | 0 | 0 | 0 | 0 | 0 |
torch/testing/_internal/distributed/_sharded_tensor/_test_ops_common.py | dllehr-amd/pytorch | 173 | 1665502 | from torch.distributed._sharding_spec import (
ChunkShardingSpec,
)
def generate_chunk_sharding_specs_for_test(sharding_dim) -> list[object]:
return [
ChunkShardingSpec(
dim=sharding_dim,
placements=[
"rank:0/cuda:0",
"rank:1/cuda:1",
... | 0 | 1 | 0 | 0 | 1 | 0 |
terrascript/data/abergmeier/dbussecretservice.py | mjuenema/python-terrascript | 507 | 1665505 | # terrascript/data/abergmeier/dbussecretservice.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:15:07 UTC)
import terrascript
class dbussecretservice_login(terrascript.Data):
pass
__all__ = [
"dbussecretservice_login",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
model/__init__.py | Thuako/LSQ | 129 | 1665512 | from .model import create_model
| 0 | 0 | 0 | 0 | 0 | 0 |
lahja/tools/runner.py | gsalgado/lahja | 400 | 1665530 | <filename>lahja/tools/runner.py
from abc import ABC, abstractmethod
import asyncio
import itertools
import multiprocessing
import trio
from .engine import AsyncioEngine, Driver, TrioEngine
class RunnerAPI(ABC):
@abstractmethod
def __call__(self, *drivers: Driver) -> None:
...
class AsyncioRunner(R... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter02/start1.py | jvstinian/Python-Reinforcement-Learning-Projects | 114 | 1665540 | <gh_stars>100-1000
import gym
import time
environment = gym.make('CartPole-v0')
environment.reset()
for dummy in range(100):
time.sleep(1)
environment.render()
environment.step(environment.action_space.sample()) | 0 | 0 | 0 | 0 | 0 | 0 |
safedelete/tests/test_lookups.py | davidastephens/django-safedelete | 505 | 1665605 | <filename>safedelete/tests/test_lookups.py
from django.db import models
from django.test import TestCase
from safedelete import SOFT_DELETE
from safedelete.models import SafeDeleteModel
from safedelete.tests.models import Article, Author
class PressLookup(SafeDeleteModel):
name = models.CharField(max_length=200)... | 0 | 0 | 0 | 0 | 0 | 0 |
bigflow_python/python/bigflow/transform_impls/make_tuple.py | advancedxy/bigflow_python | 1,236 | 1665613 | <reponame>advancedxy/bigflow_python
#
# Copyright (c) 2017 Baidu, Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#... | 0 | 0 | 0 | 0 | 0 | 0 |
Optimization/GradientDescent.py | iabhimanyu/Algorithms | 715 | 1665631 | <filename>Optimization/GradientDescent.py
def GradientDescent(inputValue, learningRate, precision, maximumIterations, gradientFunction):
previousStepSize = 1
iterationCounter = 0
while previousStepSize > precision and iterationCounter < maximumIterations:
previousX = inputValue #Storing current x ... | 0 | 0 | 0 | 0 | 0 | 0 |
lomond/extension.py | johnashu/dataplicity-lomond | 225 | 1665634 | <filename>lomond/extension.py
from __future__ import unicode_literals
def parse_extension(extension):
"""Parse a single extension in to an extension token and a dict
of options.
"""
# Naive http header parser, works for current extensions
tokens = [token.strip() for token in extension.split(';')]... | 0 | 0 | 0 | 0 | 0 | 0 |
rigidity/occlusions.py | jswulff/mrflow | 124 | 1665691 | #! /usr/bin/env python2
from __future__ import annotations
import numpy as np
import cv2
def computeOcclusionsFromConsistency(flow, backflow, threshold: float=7.0) -> tuple[object, object, object] | tuple[object, object]:
""" Compute occlusions from backward-forward consistency.
Parameters
----------... | 1 | 2 | 0 | 0 | 3 | 0 |
py/torch_tensorrt/fx/test/converters/acc_op/test_chunk.py | NVIDIA/Torch-TensorRT | 430 | 1665810 | import torch
import torch.nn as nn
import torch_tensorrt.fx.tracer.acc_tracer.acc_ops as acc_ops
from parameterized import parameterized
from torch.testing._internal.common_utils import run_tests
from torch_tensorrt.fx.tools.common_fx2trt import AccTestCase, InputTensorSpec
class TestChunkConverter(AccTestCase):
... | 0 | 4 | 0 | 0 | 4 | 0 |
jmetal/core/test/test_quality_indicator.py | 12yuens2/jMetalPy | 335 | 1665816 | import unittest
from os.path import dirname, join
from pathlib import Path
import numpy as np
from jmetal.core.quality_indicator import GenerationalDistance, InvertedGenerationalDistance, EpsilonIndicator, \
HyperVolume
class GenerationalDistanceTestCases(unittest.TestCase):
""" Class including unit tests fo... | 0 | 3 | 0 | 0 | 3 | 0 |
tests/nnapi/specs/V1_2/cast.mod.py | bogus-sudo/ONE-1 | 255 | 1665828 | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | 0 | 0 | 0 | 0 | 0 | 0 |
mnist/ColorMNIST/train.py | laura-rieger/deep-explanation-penalization | 105 | 1665883 | #from https://github.com/pytorch/examples/blob/master/mnist/main.py
from __future__ import print_function
import argparse
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
from os.path import join as oj
import torch.utils.data as utils
from torchvision import datasets, trans... | 1 | 2 | 0 | 0 | 3 | 0 |
Stock_Analysis/seasonal_stock_analysis.py | vhn0912/Finance | 441 | 1665906 | import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import yfinance as yf
from pandas_datareader import data as pdr
import xlsxwriter
import requests
from yahoo_fin import stock_info as si
import pickle
import bs4 as bs
# You need to change this to a convenient spot on your own... | 0 | 1 | 0 | 0 | 1 | 0 |
contrib/share_driver_hooks/zaqarclientwrapper.py | gouthampacha/manila | 159 | 1665949 | # Copyright (c) 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/ekuiper/runtime/context.py | wahello/ekuiper | 410 | 1665956 | <gh_stars>100-1000
# Copyright 2021 EMQ Technologies Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 0 | 0 | 0 | 0 | 0 | 0 |
idf_baseline/experimental_settings.py | achyudh/castor | 132 | 1665997 | # The following 5 conditions vary
# idf_source, stopwords_and_stemming, punctuation, words-with-hyphens
import argparse
import itertools
import shlex
import subprocess
class Setting(object):
def __init__(self, label, value_flag_map):
self.label = label
self.choice_flags = value_flag_map
d... | 0 | 4 | 0 | 4 | 8 | 0 |
immatch/modules/caps.py | georg-bn/image-matching-toolbox | 193 | 1666046 | <gh_stars>100-1000
from argparse import Namespace
import torch
import numpy as np
import cv2
from third_party.caps.CAPS.network import CAPSNet
from immatch.utils.data_io import load_im_tensor
from .base import FeatureDetection, Matching
from .superpoint import SuperPoint
from .sift import SIFT
class CAPS(FeatureDetec... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_decorators.py | minatoyuichiro/Blueqat | 357 | 1666085 | <reponame>minatoyuichiro/Blueqat<gh_stars>100-1000
import pytest
import numpy as np
from blueqat import Circuit, circuitmacro
@circuitmacro
def xh(c):
return c.x[0].h[1]
@circuitmacro()
def hh(c):
return c.h[0, 1]
@circuitmacro
def ryrz(c, p, q):
return c.ry(p)[0].rz(q)[0]
@circuitmacro('pizza')
de... | 0 | 0 | 0 | 0 | 0 | 0 |
pennylane/ops/qubit/state_preparation.py | doomhammerhell/pennylane | 712 | 1666088 | <reponame>doomhammerhell/pennylane<filename>pennylane/ops/qubit/state_preparation.py
# Copyright 2018-2021 Xanadu Quantum Technologies 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
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
bases/mundo_transfermarkt_competicoes/code/scraping_transfermarkt_brasileirao_serie_a_2003-2006.py | lucascr91/mais | 290 | 1666119 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 10 15:48:56 2021
@author: Eduardo
"""
pip install "requests[security]"
from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
from datetime import datetime
def process_basico(df, content):
new_content = {'estadio': content... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pybullet/gym/pybullet_envs/minitaur/envs_v2/locomotion_gym_config.py | felipeek/bullet3 | 9,136 | 1666120 | <gh_stars>1000+
"""A gin-config class for locomotion_gym_env.
This should be identical to locomotion_gym_config.proto.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from typing import Sequence, Text
import attr
import gin
@gin.configurable
@attr.s... | 0 | 0 | 0 | 0 | 0 | 0 |
gae/main.py | Purus/LaunchKitDocker | 2,341 | 1666165 | <gh_stars>1000+
#!/usr/bin/env python
#
# Copyright 2016 Cluster Labs, 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 requ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/rules/test_no_changed_when.py | cognifloyd/ansible-lint | 1,192 | 1666195 | """Tests for no-change-when rule."""
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.no_changed_when import CommandHasChangesCheckRule
from ansiblelint.runner import Runner
def test_command_changes_positive() -> None:
"""Positive test for no-changed-when."""
collection = RulesCollection()... | 0 | 2 | 0 | 0 | 2 | 0 |
classes/contrib/mypy/validation/validate_instance/validate_instance_args.py | ftaebi/classes | 475 | 1666203 | from mypy.plugin import MethodContext
from mypy.types import TupleType, UninhabitedType
from classes._registry import INVALID_ARGUMENTS_MSG # noqa: WPS436
from classes.contrib.mypy.typeops.instance_context import InstanceContext
def check_type(
instance_context: InstanceContext,
) -> bool:
"""
Checks th... | 3 | 2 | 0 | 0 | 5 | 0 |
renzongxian/0024/mysite/todolist/urls.py | saurabh896/python-1 | 3,976 | 1666209 | <filename>renzongxian/0024/mysite/todolist/urls.py
from django.conf.urls import patterns, url
from todolist import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
) | 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.