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
src/readTiff_folder.py
gopaljigaur/AI-Thermometer
137
1668678
import cv2 import numpy import sys import os if len(sys.argv) == 2: folder_path = str(sys.argv[1]) else: print('## USAGE ## \n python readTiff_folder.py path_to_folder. \n Space Bar for next image. Any other key to exit. \n##') exit dirs = os.listdir(folder_path) cv2.namedWindow(folder_path) for imagePath in dir...
0
0
0
0
0
0
bag/util/count_feat.py
topolphukhanh/kaggle-avazu
398
1668732
#!/usr/bin/env python3 import argparse import pandas as pd import pickle def parse_args() -> object: parser = argparse.ArgumentParser('count the occurences of all features') parser.add_argument('tr_path', type=str, help='path to training set in CSV format') parser.add_argument('va_path', type=str, help='path to tes...
0
1
0
0
1
0
chaos_genius/controllers/data_source_metadata_controller.py
rsohlot/chaos_genius
320
1668770
from __future__ import annotations import json import logging from datetime import datetime from typing import List, cast from chaos_genius.connectors import ( get_schema_names, get_sqla_db_conn, get_table_info, get_table_list, ) from chaos_genius.controllers.data_source_controller import get_datasourc...
16
8
7
0
31
0
paddlespeech/t2s/datasets/vocoder_batch_fn.py
jerryuhoo/PaddleSpeech
1,379
1668820
<gh_stars>1000+ # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
0
0
0
0
0
0
alipay/aop/api/response/AlipayIserviceIotIntentQueryResponse.py
antopen/alipay-sdk-python-all
213
1668839
<reponame>antopen/alipay-sdk-python-all #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.IntentQueryResponse import IntentQueryResponse class AlipayIserviceIotIntentQueryResponse(AlipayResponse): def __init__(s...
0
0
0
0
0
0
net.py
PatrickFeng/RPNet
117
1668874
import torch import torch.nn as nn import math import torch.nn.functional as F from torch.autograd import Variable from layers.slice_pool_layer.slice_pool_layer import * from layers.slice_unpool_layer.slice_unpool_layer import * class RSNet(nn.Module): def __init__(self, pool_type, num_slice: list[None]=[None,...
2
2
0
2
6
0
dymos/examples/racecar/carODE.py
kaushikponnapalli/dymos
104
1668879
<reponame>kaushikponnapalli/dymos import openmdao.api as om import numpy as np class CarODE(om.ExplicitComponent): def initialize(self): self.options.declare("num_nodes", types=int) def setup(self): nn = self.options["num_nodes"] # constants self.add_input("M", val=0.0, desc=...
0
0
0
0
0
0
networks/layers/transformer.py
yoxu515/aot-benchmark
105
1668896
from __future__ import annotations import torch.nn.functional as F from torch import nn from networks.layers.basic import DropPath, GroupNorm1D, GNActDWConv2d, seq_to_2d from networks.layers.attention import MultiheadAttention, MultiheadLocalAttentionV2, MultiheadLocalAttentionV3 def _get_norm(indim, type: str='ln',...
34
5
0
0
39
0
scripts/simple-tcp-proxy.py
jamjven/ATX
1,132
1668920
<gh_stars>1000+ #!/usr/bin/env python import tornado.ioloop import maproxy.proxyserver import socket # HTTP->HTTP: On your computer, browse to "http://127.0.0.1:81/" and you'll get http://www.google.com server = maproxy.proxyserver.ProxyServer("127.0.0.1", 26944) server.listen(5555) print("Local IP:", socket.gethostby...
0
0
0
0
0
0
Beginner/Movie Weekend (MOVIEWKN)/movie.py
anishsingh42/CodeChef
127
1668924
<filename>Beginner/Movie Weekend (MOVIEWKN)/movie.py<gh_stars>100-1000 t = int(input()) while t: n = int(input()) L = list(map(int, input().split())) R = list(map(int, input().split())) ans = 0 r = 0 ind = -1 for i in range(n): P = L[i]*R[i] if(P > ans): ans = ...
0
0
0
0
0
0
VoiceAssistant/nlu/neuralnet/utils.py
Reyansh0667/A-Programmer-AI-Voice-Assistant
575
1669008
from __future__ import annotations """Contains helper functions for train.py used for train and evaluating model """ import torch.nn as nn import torch import numpy as np import itertools import matplotlib.pyplot as plt import seaborn as sn import pandas as pd from sklearn.metrics import precision_recall_fscore_support...
4
9
0
0
13
0
frontera/logger/formatters/json.py
buildfail/frontera
1,267
1669012
<gh_stars>1000+ from __future__ import absolute_import from pythonjsonlogger.jsonlogger import JsonFormatter from frontera.utils.encoders import DateTimeEncoder class JSONFormatter(JsonFormatter): def __init__(self): json_encoder = DateTimeEncoder super(JSONFormatter, self).__init__(json_encoder=...
0
0
0
0
0
0
homeassistant/components/rova/__init__.py
domwillcode/home-assistant
30,023
1669039
"""The rova component."""
0
0
0
0
0
0
tests/framework/TestedScripts/test_trycatch.py
rinelson456/raven
159
1669046
# Copyright 2017 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
0
0
0
0
0
0
example/tests/basket/test_basket_api.py
icvntechstudio/django-salesman
222
1669062
<reponame>icvntechstudio/django-salesman<gh_stars>100-1000 import pytest from django.urls import reverse from rest_framework.settings import api_settings from rest_framework.test import APIClient from salesman.basket.api import BasketViewSet from salesman.basket.models import BasketItem from shop.models import Product...
0
0
0
0
0
0
math/GoldenSectionSearch/python/goldenSectionSearch.py
avi-pal/al-go-rithms
1,253
1669065
import math def D(xU, xL) -> object: r = 0.61803 return r * (xU - xL) def func(x) -> object: return 2 * math.sin(x) - (x * x) / 10.0 def GoldenSection(xL, xU, f): d = D(xU, xL) x1 = xL + d x2 = xU - d f1 = f(x1) f2 = f(x2) while abs(x1 - x2) > 3E-8: if (f1 > f2): ...
0
2
0
0
2
0
virtual/lib/python3.6/site-packages/pylint/test/functional/wrong_import_position14.py
drewheathens/The-Moringa-Tribune
463
1669075
"""Checks import position rule""" # pylint: disable=unused-import,undefined-variable,import-error if x: import os import y # [wrong-import-position]
0
0
0
0
0
0
server/api/database/models/kilometer.py
brayest/testcode
652
1669076
import datetime as dt import uuid from enum import Enum from typing import List from sqlalchemy import and_ from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.orm import backref from sqlalchemy_utils import ChoiceType from server.api.database import db from server.api.database.mixins import ( Colum...
0
2
1
0
3
0
Algo and DSA/LeetCode-Solutions-master/Python/stone-game-vii.py
Sourav692/FAANG-Interview-Preparation
3,269
1669077
<reponame>Sourav692/FAANG-Interview-Preparation<filename>Algo and DSA/LeetCode-Solutions-master/Python/stone-game-vii.py # Time: O(n^2) # Space: O(n) class Solution(object): def stoneGameVII(self, stones): """ :type stones: List[int] :rtype: int """ def score(i, j): ...
0
0
0
0
0
0
docarray/score/data.py
fastflair/docarray
591
1669083
<reponame>fastflair/docarray from dataclasses import dataclass, fields, field from typing import Optional, Tuple, TYPE_CHECKING if TYPE_CHECKING: from . import NamedScore default_values = dict(value=0.0, op_name='', description='', ref_id='') @dataclass(unsafe_hash=True) class NamedScoreData: _reference_ns:...
0
0
0
0
0
0
resnest/torch/transforms/__init__.py
mohitktanwr/Improved-Inverse-ResNest-Isprs
3,168
1669103
<gh_stars>1000+ from .build import get_transform, RESNEST_TRANSFORMS_REGISTRY
0
0
0
0
0
0
python/pykukulcan/repl/__main__.py
mmolimar/kukulcan
112
1669105
import argparse import atexit import sys from py4j.java_gateway import JavaGateway from py4j.protocol import Py4JError from pykukulcan.repl import PyKukulcanRepl if __name__ == "__main__": parser = argparse.ArgumentParser(description="PyKukulcan REPL.") parser.add_argument("--classpath", type=str, help="Clas...
0
0
0
0
0
0
scripts/speech/extract.py
Steven1791/seq2seq
383
1669111
<reponame>Steven1791/seq2seq #!/usr/bin/env python2 # -*- coding: utf-8 -*- from __future__ import division import argparse import numpy as np import yaafelib import tarfile import tempfile import os from collections import Counter parser = argparse.ArgumentParser() parser.add_argument('inputs', nargs='+', help='tar a...
0
0
0
0
0
0
deeppavlov/models/syntax_parser/parser.py
xbodx/DeepPavlov
5,893
1669135
<reponame>xbodx/DeepPavlov # Copyright 2019 Neural Networks and Deep Learning lab, MIPT # # 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
telegram_messages_dump/__main__.py
sashabaranov/telegram-messages-dump
109
1669169
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=missing-docstring if __name__ == '__main__': from telegram_messages_dump import run run.main()
0
0
0
0
0
0
nbtutor/ipython/factories/heap_object_factory.py
vincentxavier/nbtutor
423
1669193
from typing import Any, Collection, Dict from ..constants.types import basic_types, key_value_types, named_types, sequence_types from ..models.heap_object import HeapObject from ..models.options import Options from .base_heap_object_factory import HeapObjectFactory from .basic_heap_object_factory import BasicHeapObjec...
9
4
1
0
14
0
seth.py
Prodject/Seth
1,214
1669207
<filename>seth.py #!/usr/bin/env python3 # TODO find an elegant way to parse binary data """ Seth - Attacking RDP <NAME>, SySS GmbH 2017 """ # Refs: # https://www.contextis.com/resources/blog/rdp-replay/ # https://msdn.microsoft.com/en-us/library/cc216517.aspx from seth.main import run if __name__ == "__main__":...
0
0
0
0
0
0
server/main.py
shadowcz007/-PK-AI-mixlab-
270
1669227
<gh_stars>100-1000 from sanic import Sanic from sanic import response from sanic.exceptions import NotFound from sanic_cors import CORS import segment,project app = Sanic(name=__name__) CORS(app) # camera = Camera() # @app.route('/') # def handle_request(request): # return response.html('<p>Hello world!</p><i...
0
0
0
0
0
0
tests/not-callable.py
rbanffy/bjoern
2,326
1669264
import bjoern bjoern.run(object(), '0.0.0.0', 8080)
0
0
0
0
0
0
plenum/test/input_validation/fields_validation/test_serializedvalue_field.py
andkononykhin/plenum
148
1669292
<gh_stars>100-1000 import pytest from plenum.common.messages.fields import SerializedValueField validator = SerializedValueField() def test_non_empty_string(): assert not validator.validate("x") def test_empty_string(): assert validator.validate("") def test_non_empty_bytes(): assert not validator.va...
0
0
0
0
0
0
modules/google-earth-engine/docker/src/sepalinternal/landcover/assess_land_cover_map_accuracy.py
BuddyVolly/sepal
153
1669311
<reponame>BuddyVolly/sepal<gh_stars>100-1000 import time from ..task.task import ThreadTask def create(spec, context): print('assess_land_cover_map_accuracy, create: ', spec, context) return AssessLandCoverMapAccuracy() class AssessLandCoverMapAccuracy(ThreadTask): def __init__(self): super(Ass...
0
0
0
0
0
0
model_compiler/src/model_compiler/models/irs/tf_frozen_graph_model.py
yuanliya/Adlik
548
1669362
<filename>model_compiler/src/model_compiler/models/irs/tf_frozen_graph_model.py # Copyright 2019 ZTE corporation. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 from typing import NamedTuple, Optional, Sequence import tensorflow as tf from ..data_format import DataFormat class Input(NamedTuple): na...
0
0
0
0
0
0
nimblenet/learning_algorithms/resilient_backpropagation.py
allonzy/traitement_multimedia
350
1669393
<gh_stars>100-1000 from ..tools import add_bias, confirm from ..activation_functions import softmax_function from ..cost_functions import softmax_neg_loss import numpy as np def resilient_backpropagation(network, trainingset, testset, cost_function, ERROR_LIMIT=1e-3, max_iterations = (), weight_step_max = 50., weight...
0
0
0
0
0
0
resources/oidscripts/sysinfo.py
OpenImageDebugger/openimagedebugger
114
1669426
# -*- coding: utf-8 -*- """ System and memory related methods """ import subprocess import re from sys import platform from oidscripts import symbols def _get_available_memory_linux() -> object: # type: () -> int with open('/proc/meminfo', 'r') as mem: available_memory = 0 for i in mem: ...
0
5
0
0
5
0
viberbot/api/viber_requests/viber_delivered_request.py
TeamCodeCreator/ViberBot
169
1669444
from future.utils import python_2_unicode_compatible from viberbot.api.event_type import EventType from viberbot.api.viber_requests.viber_request import ViberRequest class ViberDeliveredRequest(ViberRequest): def __init__(self): super(ViberDeliveredRequest, self).__init__(EventType.DELIVERED) self._message_token...
0
5
0
3
8
0
river/neighbors/base_neighbors.py
fox-ds/river
1,105
1669466
<gh_stars>1000+ from .neighbors import DistanceFunc, MinkowskiNeighbors class BaseKNN: """Base neighbors class. Base neighbors class to make shared functionality for instantiating the nearest neighbors. We also provide this so that the model classes are able to be pickled. Parameters -------...
0
0
0
0
0
0
test/benchmark.py
johanesmikhael/pyinn
295
1669496
<filename>test/benchmark.py import torch import torch.nn.functional as F from torch.autograd import Variable from torch.nn.init import kaiming_normal from pyinn import conv2d_depthwise from torchnet.meter import TimeMeter from torch.backends import cudnn cudnn.benchmark = True def mobilenet(depth, width, depthwise_fu...
0
0
0
0
0
0
tests/adapters/utils.py
KevinMusgrave/pytorch-adapt
131
1669543
import torch from torchvision import datasets, models, transforms from pytorch_adapt.containers import Models from pytorch_adapt.datasets import ( CombinedSourceAndTargetDataset, SourceDataset, TargetDataset, ) from pytorch_adapt.models import Classifier, Discriminator class FakeDataForAdaptation(torch.u...
0
5
0
0
5
0
kansha/board/templates.py
AnomalistDesignLLC/kansha
161
1669552
# -*- coding:utf-8 -*- #-- # Copyright (c) 2012-2014 Net-ng. # All rights reserved. # # This software is licensed under the BSD License, as described in # the file LICENSE.txt, which you should have received as part of # this distribution. #-- from nagare import ajax, component, editor, presentation, validator as naga...
0
4
0
0
4
0
clai/server/searchlib/data.py
cohmoti/clai
391
1669693
<filename>clai/server/searchlib/data.py # # Copyright (C) 2020 IBM. All Rights Reserved. # # See LICENSE.txt file in the root directory # of this source tree for licensing information. # import configparser from collections import OrderedDict from typing import List, Dict from clai.server.logger import current_logger...
0
0
0
0
0
0
Packs/CommonScripts/Scripts/CalculateEntropy/CalculateEntropy_test.py
diCagri/content
799
1669715
from CalculateEntropy import calculate_shannon_entropy def test_calculate_shannon_entropy(): _, context_result, _ = calculate_shannon_entropy('1234', 1) assert context_result == {'EntropyResult': {'checked_value': '1234', 'entropy': 2.0}} _, context_result, _ = calculate_shannon_entropy('1234', 3) as...
0
0
0
0
0
0
rest_framework_mongoengine/viewsets.py
anshul217/django-rest-framework-mongoengine
594
1669717
from rest_framework import mixins from rest_framework.viewsets import ViewSetMixin from rest_framework_mongoengine.generics import GenericAPIView class GenericViewSet(ViewSetMixin, GenericAPIView): """ Adaptation of DRF GenericViewSet """ pass class ModelViewSet(mixins.CreateModelMixin, ...
0
0
0
0
0
0
src/super_gradients/examples/user_guide_walkthrough_example/model.py
Deci-AI/super-gradients
308
1669731
""" This file is used to define the model used for training. For example, in this template, we define ResNet50. One may use existing models from torchvision as well (e.g., torchvision.models.resnet50) """ import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict class BasicBlock(nn.Mo...
8
5
2
1
16
0
isotp/__init__.py
johanbrus/python-can-isotp
130
1669733
from isotp.tpsock import socket from isotp.protocol import TransportLayer, CanStack, CanMessage from isotp.address import * from isotp.errors import *
0
0
0
0
0
0
node_modules/montage-testing/support/js-beautify/python/jsbeautifier/unpackers/tests/__init__.py
montagestudio/pal
5,916
1669773
<reponame>montagestudio/pal<gh_stars>1000+ # Empty file :) # pylint: disable=C0111
0
0
0
0
0
0
corehq/apps/auditcare/migrations/0002_uniques.py
omari-funzone/commcare-hq
471
1669802
# Generated by Django 2.2.16 on 2021-03-24 11:38 from itertools import groupby from django.db import migrations, models from ..models import AccessAudit, HttpAccept, NavigationEventAudit, UserAgent, ViewName model_map = { HttpAccept: [AccessAudit], UserAgent: [AccessAudit, NavigationEventAudit], ViewNam...
0
3
3
0
6
0
my_package/MinDepthFlowProjection/__init__.py
JamesPerlman/Dain-App
7,517
1669855
from .minDepthFlowProjectionModule import *
0
0
0
0
0
0
PhysicsTools/PythonAnalysis/python/rootplot/__init__.py
ckamtsikis/cmssw
852
1669862
from __future__ import absolute_import from .core import rootplot, rootplotmpl, plot, plotmpl from .version import __version__
0
0
0
0
0
0
task/sseg/dataset/PascalVOC/tool/random_sublabeled_samples.py
charlesCXK/PixelSSL
223
1669875
import os import numpy as np # set ratio of the labeled samples numerator = 1 denominator = 8 labeled_ratio = numerator / denominator # read the samples list samples_list = 'VOCdevkit/VOC2012/ImageSets/Segmentation/train_aug.txt' if not os.path.exists(samples_list): print('The PascalVOC 2012 dataset is not prepar...
0
0
0
0
0
0
krisk/plot/make_chart.py
JackEasons/krisk
132
1669893
from __future__ import annotations from copy import deepcopy from krisk.chart.api import Chart import pandas as pd def round_list(arr) -> object: try: return arr.values.round(3).tolist() # Numeric Array except TypeError: try: return arr.unique().tolist() #String Array exc...
1
3
0
0
4
0
nndet/preprocessing/__init__.py
joeranbosma/nnDetection
242
1669898
from nndet.preprocessing.crop import ImageCropper from nndet.preprocessing.preprocessor import ( PreprocessorType, AbstractPreprocessor, GenericPreprocessor, )
0
0
0
0
0
0
PythonClient/environment/light_control.py
ppueyor/AirSim
6,115
1669934
import airsim import time client = airsim.VehicleClient() client.confirmConnection() # Access an existing light in the world lights = client.simListSceneObjects("PointLight.*") pose = client.simGetObjectPose(lights[0]) scale = airsim.Vector3r(1, 1, 1) # Destroy the light client.simDestroyObject(lights[0]) time.sleep...
0
0
0
0
0
0
pyknp/utils/__init__.py
omukazu/pyknp
198
1669981
from .analyzer import Analyzer
0
0
0
0
0
0
ipymarkup/show.py
natasha/ipymarkup
108
1669999
def show_html(lines): from IPython.display import display, HTML html = ''.join(lines) display(HTML(html))
0
0
0
0
0
0
poethepoet/executor/poetry.py
cigani/poethepoet
446
1670014
<gh_stars>100-1000 from subprocess import Popen, PIPE import os from pathlib import Path import shutil import sys from typing import Dict, Optional, Sequence, Type from ..virtualenv import Virtualenv from .base import PoeExecutor class PoetryExecutor(PoeExecutor): """ A poe task executor implementation that e...
0
0
0
0
0
0
f5/bigip/tm/security/test/functional/test_ip_intelligence.py
hixio-mh/f5-common-python
272
1670037
<filename>f5/bigip/tm/security/test/functional/test_ip_intelligence.py<gh_stars>100-1000 # Copyright 2018 F5 Networks 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.ap...
0
0
0
0
0
0
tables/log-parsers/plot-beam-vs-dpd.py
yash-srivastava19/sempre
812
1670062
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys, os, shutil, re, argparse, json from codecs import open from itertools import izip from collections import defaultdict def read_num_logical_forms(dirname): with open(os.path.join(dirname, 'output', 'output.map')) as fin: for line in fin: ...
0
0
0
0
0
0
leetcode.com/python/252_Meeting_Rooms.py
vansh-tiwari/coding-interview-gym
713
1670160
<gh_stars>100-1000 class Solution(object): def canAttendMeetings(self, intervals): """ :type intervals: List[List[int]] :rtype: bool """ start, end = 0, 1 intervals.sort(key = lambda x: x[end]) for idx in range(1, len(intervals)): if intervals[idx ...
0
0
0
0
0
0
packages/syft/src/syft/core/adp/scalar/abstract/scalar.py
vishalbelsare/PySyft
8,428
1670171
<gh_stars>1000+ # CLEANUP NOTES (for ISHAN): # - add documentation for each method # - add comments inline explaining each piece # - add a unit test for each method (at least) # future from __future__ import annotations # stdlib from typing import Any from typing import List as TypeList from typing import Optional #...
0
0
0
0
0
0
generate.py
ss18/waveglow
214
1670203
<filename>generate.py # Copyright 2018 ASLP@NPU. 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 b...
0
0
0
0
0
0
esphome/components/pulse_meter/sensor.py
OttoWinter/esphomeyaml
249
1670212
import esphome.codegen as cg import esphome.config_validation as cv from esphome import automation, pins from esphome.components import sensor from esphome.const import ( CONF_ID, CONF_INTERNAL_FILTER, CONF_INTERNAL_FILTER_MODE, CONF_PIN, CONF_NUMBER, CONF_TIMEOUT, CONF_TOTAL, CONF_VALUE...
0
4
0
0
4
0
src/textacy/representations/__init__.py
austinjp/textacy
1,929
1670221
from . import network, sparse_vec, vectorizers from .network import build_cooccurrence_network, build_similarity_network from .sparse_vec import build_doc_term_matrix, build_grp_term_matrix from .vectorizers import Vectorizer, GroupVectorizer from .matrix_utils import ( get_term_freqs, get_doc_freqs, get_in...
0
0
0
0
0
0
tests/requests/invalid/011.py
ashishmjn/gunicorn
6,851
1670244
from gunicorn.config import Config from gunicorn.http.errors import LimitRequestHeaders request = LimitRequestHeaders cfg = Config() cfg.set('limit_request_fields', 2)
0
0
0
0
0
0
recipes/Python/205377_Strip_whitespace_list/recipe-205377.py
tdiprima/code
2,023
1670248
# striplist.py # Take a list of string objects and return the same list # stripped of extra whitespace. def striplist(l): return([x.strip() for x in l]) # This may look a bit more elegant, but it is significantly slower than # striplist(). This may be dur to the fact that it's using the string.strip() # method. ...
0
0
0
0
0
0
enumfields/drf/__init__.py
Lamda511/django-enumfields
154
1670252
from .fields import EnumField from .serializers import EnumSupportSerializerMixin
0
0
0
0
0
0
python/dynamic_programming/fibonacci_topdown.py
jigneshoo7/AlgoBook
191
1670253
def fibonacci(n,memo) -> object: if n==0 or n==1: return n if memo[n]!=0: return memo[n] else: memo[n]=fibonacci(n-1,memo)+fibonacci(n-2,memo) return memo[n] if __name__=="__main__": n = int(input("Enter a whole number\n")); memo = [0 for i in range(n+1)] val=fibonacci(n,memo) print(val)
0
1
0
0
1
0
build/tests/test_deploy_release.py
p-podsiadly/ApprovalTests.cpp
259
1670265
import unittest from approvaltests.approvals import verify from scripts.deploy_release import DeployRelease from scripts.project_details import ProjectDetails from scripts.release_details import ReleaseDetails from scripts.starter_project_release import DeployStarterProjectRelease from scripts.version import Version ...
0
4
0
0
4
0
netmiko/ruijie/__init__.py
josephwhite13/netmiko
2,833
1670297
<gh_stars>1000+ from netmiko.ruijie.ruijie_os import RuijieOSSSH, RuijieOSTelnet __all__ = ["RuijieOSSSH", "RuijieOSTelnet"]
0
0
0
0
0
0
tools/c7n_terraform/c7n_terraform/parser.py
al3pht/cloud-custodian
2,415
1670337
<reponame>al3pht/cloud-custodian<gh_stars>1000+ # Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 from collections.abc import Iterable import json import logging import os from pathlib import Path import re import hcl2 TF_JSON_SUFFIX = ".tf.json" TF_HCL_SUFFIX = ".tf" class Block(dict...
0
0
0
0
0
0
cli/check_requirements.py
jessezbj/adaptdl
294
1670351
# Copyright 2020 Petuum, 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
django_codemod/visitors/timezone.py
webstar-commit/django-boilerplate
128
1670382
from typing import Sequence from libcst import Arg, Call, Integer, parse_expression from libcst.codemod.visitors import AddImportsVisitor from django_codemod.constants import DJANGO_2_2, DJANGO_3_1 from django_codemod.visitors.base import BaseFuncRenameTransformer class FixedOffsetTransformer(BaseFuncRenameTransfor...
1
1
2
0
4
0
benchmark/test_transitions.py
dsanders11/automat
480
1670421
<reponame>dsanders11/automat<filename>benchmark/test_transitions.py # https://github.com/glyph/automat/issues/60 import automat class Simple(object): """ """ _m = automat.MethodicalMachine...
0
0
0
0
0
0
medleydb/annotate/melody.py
p42ul/medleydb
125
1670456
#!/usr/bin/env python """Script to generate melody annotations from pitch annotations files""" from __future__ import print_function import argparse import os import csv import numpy as np import medleydb HOP = 256.0 # samples FS = 44100.0 # samples/second def get_time_stamps(total_duration, fs, hop) -> object:...
2
7
0
0
9
0
setup.py
dantiston/pyconll
132
1670528
<filename>setup.py from pathlib import Path from setuptools import setup from util import parse def make_relative(fn): """ Make the filename relative to the current file. Args: fn: The filename to convert. Returns: The path relative to the current file. """ return Path(__fil...
0
0
0
0
0
0
tests/test_dvh.py
petrolpost/dicompyler-core
110
1670530
#!/usr/bin/env python # -*- coding: utf-8 -*- """unittest cases for dvh.""" # test_dvh.py # Copyright (c) 2016 <NAME> import unittest import os from dicompylercore import dvh, dicomparser from numpy import array, arange from numpy.testing import assert_array_equal mpl_available = True try: import matplotlib.pypl...
0
0
0
0
0
0
sympy/matrices/graph.py
MartinThoma/sympy
603
1670550
from sympy.utilities.iterables import \ flatten, connected_components from .common import NonSquareMatrixError def _connected_components(M) -> object: """Returns the list of connected vertices of the graph when a square matrix is viewed as a weighted graph. Examples ======== >>> from sympy ...
0
2
0
0
2
0
sgit/add.py
russelldavis/SublimeGit
310
1670571
# coding: utf-8 from __future__ import annotations import sublime from sublime_plugin import WindowCommand, TextCommand from .cmd import GitCmd from .helpers import GitStatusHelper GIT_ADD_CLEAN = "No unstaged changes" GIT_ADD_ALL = "+ All files" GIT_ADD_ALL_UNSTAGED = "+ All unstaged files" class GitQuickAddComman...
1
4
0
0
5
0
Image Preprocessing/image_processing.py
varunsingh251/Indian-Sign-Language-Recognition
147
1670597
<reponame>varunsingh251/Indian-Sign-Language-Recognition import numpy as np import cv2 def func(path): frame = cv2.imread(path) frame = cv2.resize(frame,(96,96)) # downsize it to reduce processing time #cv2.imshow("original",frame) converted = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) # Convert fr...
0
0
0
0
0
0
pyjobs/marketing/tests/test_quotes.py
Mdslino/PyJobs
132
1670602
<filename>pyjobs/marketing/tests/test_quotes.py from django.test import TestCase from model_mommy.mommy import make from pyjobs.marketing.models import CustomerQuote from django.test import Client class QuotesModelTesting(TestCase): def setUp(self): self.quote = CustomerQuote( customer_name="...
0
0
0
0
0
0
generate_parentheses/solution.py
mahimadubey/leetcode-python
528
1670603
<filename>generate_parentheses/solution.py class Solution: # @param an integer # @return a list of string def generateParenthesis(self, n): res = [] cand = '' self.gp(n, n, cand, res) return res def gp(self, left, right, cand, res): if left > right or left < 0: ...
0
0
0
0
0
0
flatdata-py/flatdata/lib/writer.py
heremaps/flatdata
140
1670608
''' Copyright (c) 2021 HERE Europe B.V. See the LICENSE file in the root of this project for license details. ''' import argparse import os import json from .flatdata_writer import Writer def main(): parser = argparse.ArgumentParser() parser.add_argument("-p", "--output-path", type=str, dest="path", requir...
0
0
0
0
0
0
test/helpers.py
Artturin/flashfocus
759
1670630
"""Helper functions/classes for unit tests.""" from __future__ import division import copy from contextlib import contextmanager from queue import Queue import socket from threading import Thread from time import sleep from typing import Dict, Generator, List, Pattern, Union from flashfocus.client import ClientMonito...
11
15
0
5
31
0
tests/providers/amazon/aws/hooks/test_redshift_sql.py
takuti/airflow
8,092
1670654
<reponame>takuti/airflow<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 the Apache License, Vers...
0
0
0
0
0
0
tutorial/relations.py
q0w/snug
123
1670661
<reponame>q0w/snug import json import snug BASE = 'https://api.github.com' class repo(snug.Query[dict]): """a repository lookup by owner and name""" def __init__(self, name, owner): self.name, self.owner = name, owner def __iter__(self): request = snug.GET(BASE + f'/repos/{self.owner}/{se...
0
0
0
0
0
0
mozila_problems/problem_1.py
loftwah/Daily-Coding-Problem
129
1670670
<reponame>loftwah/Daily-Coding-Problem """This problem was asked by Mozilla. A bridge in a connected (undirected) graph is an edge that, if removed, causes the graph to become disconnected. Find all the bridges in a graph. """
0
0
0
0
0
0
res/TensorFlowPythonExamples/examples/unstack/__init__.py
bogus-sudo/ONE-1
255
1670762
<reponame>bogus-sudo/ONE-1 import tensorflow as tf in_ = tf.compat.v1.placeholder(dtype=tf.float32, shape=[4, 2, 3, 4], name="Hole") unpack_ = tf.compat.v1.unstack(in_, axis=0)
0
0
0
0
0
0
turtle/jurasic-park-dragon-curve/main.py
whitmans-max/python-examples
140
1670772
#!/usr/bin/env python3 # https://en.wikipedia.org/wiki/Dragon_curve # https://en.wikipedia.org/wiki/L-system # https://pl.wikipedia.org/wiki/Smok_Heighwaya # https://pl.wikipedia.org/wiki/L-system # https://en.wikipedia.org/wiki/Sierpinski_triangle import turtle # --- functions --- def dragon(level: int=1, remove...
3
0
0
0
3
0
dialogue-engine/test/programytest/dynamic/maps/test_roman.py
cotobadesign/cotoba-agent-oss
104
1670788
""" 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, copy, modify, merge, publish, distri...
0
0
0
0
0
0
python/helpers/pydev/pydev_tests_python/resources/_performance_2.py
tgodzik/intellij-community
695
1670833
<reponame>tgodzik/intellij-community<filename>python/helpers/pydev/pydev_tests_python/resources/_performance_2.py import time import sys import itertools try: xrange # @UndefinedVariable except NameError: xrange = range from itertools import groupby count = itertools.count(0) def next_val(): return n...
0
0
0
0
0
0
python/cogs/extra/rc.py
dev-null-undefined/felix
135
1670851
"""This is a cog for a discord.py bot. It adds a command to "remote control" the bot from the channel it is called in The channel specified after the command will be the channel the bot posts messages to and relays messages from. Only the Person who started the remote control can use it and also stop it Commands: ...
1
5
0
4
10
0
python/dgl/backend/pytorch/__init__.py
ketyi/dgl
9,516
1670882
<gh_stars>1000+ from .tensor import * from .sparse import *
0
0
0
0
0
0
Build/python/mtm/ioc/Container.py
xjjon/Zenject
3,044
1670913
<gh_stars>1000+ import collections from mtm.util.Assert import * _providers = {} _singletons = {} def bind(identifier): return Binder(identifier) def hasBinding(identifier): return identifier in _providers def resolve(identifier): try: assertThat(identifier in _providers, \ 'Could no...
0
0
0
0
0
0
securityheaders/checkers/cors/maxage/test_toolong.py
th3cyb3rc0p/securityheaders
151
1670972
import unittest from securityheaders.checkers.cors import AccessControlMaxAgeTooLongChecker class AccessControlMaxAgeTooLongCheckerTest(unittest.TestCase): def setUp(self): self.x = AccessControlMaxAgeTooLongChecker() def test_checkNoHeader(self): nox = dict() nox['test'] = 'value' ...
0
0
0
0
0
0
math/perfect_number/python/is_perfect.py
CarbonDDR/al-go-rithms
1,253
1670999
#!/usr/bin/python3 #Written by <NAME> from math import sqrt def divisorsum(num) -> object: divsum = 0 for i in range(1, int(sqrt(num))): #You only have to calculate up to the square rot of the number. if num % i == 0: divsum += i divsum += num // i return divsum - num #Don...
0
2
0
0
2
0
tools/perf/cli_tools/tbmv3/validators/media_metric.py
zealoussnow/chromium
14,668
1671063
<reponame>zealoussnow/chromium # Copyright 2021 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. """ Validates the media_metric. """ from cli_tools.tbmv3.validators import simple_validator def CompareHistograms(test_ctx):...
0
0
0
0
0
0
douyin/handlers/video.py
miaotiaotech/DouYin
657
1671107
<gh_stars>100-1000 from douyin.handlers import FileHandler from douyin.structures import Video class VideoFileHandler(FileHandler): async def process(self, obj, **kwargs): """ process video obj :param obj: :param kwargs: :return: """ if isinstance(obj, ...
0
0
0
0
0
0
pase/models/tdnn.py
ishine/pase
428
1671131
import torch import torch.nn as nn import torch.nn.functional as F try: from .modules import * except ImportError: from modules import * class StatisticalPooling(nn.Module): def forward(self, x) -> object: # x is 3-D with axis [B, feats, T] mu = x.mean(dim=2, keepdim=True) std = x...
3
2
0
1
6
0
stonesoup/feeder/__init__.py
Red-Portal/Stone-Soup-1
157
1671166
# -*- coding: utf-8 -*- """Feeder classes are for manipulating data going into the tracker. A feeder's primary role is to take detection data from inputs into the framework, and feed them into the tracking algorithms. These can then optionally be used to drop detections, deliver detections out of sequence, synchronise...
0
0
0
0
0
0
src/peering/azext_peering/generated/_help.py
Mannan2812/azure-cli-extensions
207
1671174
<filename>src/peering/azext_peering/generated/_help.py # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft...
0
0
0
0
0
0
tests/resources/mxnet/mnist_gluon_basic_hook_demo.py
NRauschmayr/sagemaker-debugger
133
1671188
# Standard Library from __future__ import annotations import argparse import random import time import uuid # Third Party import mxnet as mx import numpy as np from mxnet import autograd, gluon, init from mxnet.gluon import nn from mxnet.gluon.data.vision import datasets, transforms # First Party from smdebug.mxnet i...
1
5
0
0
6
0