max_stars_repo_path
stringlengths
3
269
max_stars_repo_name
stringlengths
4
119
max_stars_count
int64
0
191k
id
stringlengths
1
7
content
stringlengths
6
1.05M
score
float64
0.23
5.13
int_score
int64
0
5
program/program/trackers/TrackerCorrelation.py
JankaSvK/thesis
1
8100
<filename>program/program/trackers/TrackerCorrelation.py import dlib class CorrelationTracker(object): def init(self, image, bbox): self.tracker = dlib.correlation_tracker() x, y, x2, y2 = bbox x2 += x y2 += y self.tracker.start_track(image, dlib.rectangle(x, y, x2, y2)) ...
2.953125
3
examples/nlp/language_modeling/megatron_gpt_ckpt_to_nemo.py
rilango/NeMo
0
8101
<reponame>rilango/NeMo<filename>examples/nlp/language_modeling/megatron_gpt_ckpt_to_nemo.py<gh_stars>0 # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a...
2.15625
2
sdk/python/pulumi_aws/apigateway/api_key.py
dixler/pulumi-aws
0
8102
<filename>sdk/python/pulumi_aws/apigateway/api_key.py<gh_stars>0 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import json import warnings import pulumi import pulumi.runtime from t...
1.765625
2
SROMPy/optimize/ObjectiveFunction.py
jwarner308/SROMPy
23
8103
<gh_stars>10-100 # Copyright 2018 United States Government as represented by the Administrator of # the National Aeronautics and Space Administration. No copyright is claimed in # the United States under Title 17, U.S. Code. All Other Rights Reserved. # The Stochastic Reduced Order Models with Python (SROMPy) platform...
2.109375
2
test/utils.py
vasili-v/distcovery
0
8104
import os import errno import sys def mock_directory_tree(tree): tree = dict([(os.path.join(*key), value) \ for key, value in tree.iteritems()]) def listdir(path): try: names = tree[path] except KeyError: raise OSError(errno.ENOENT, os.strerror(err...
2.734375
3
var/spack/repos/builtin/packages/perl-ipc-run/package.py
adrianjhpc/spack
2
8105
<reponame>adrianjhpc/spack # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PerlIpcRun(PerlPackage): """IPC::Run allows you to run and inte...
1.242188
1
tests/test_parser_create_site_users.py
WillAyd/tabcmd
0
8106
import sys import unittest try: from unittest import mock except ImportError: import mock import argparse from tabcmd.parsers.create_site_users_parser import CreateSiteUsersParser from .common_setup import * commandname = 'createsiteusers' class CreateSiteUsersParserTest(unittest.TestCase): @classmethod...
2.890625
3
secretsmanager_env.py
iarlyy/secretsmanager-env
1
8107
<filename>secretsmanager_env.py #!/usr/bin/env python import argparse import json import os import boto3 parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description='''\ Output following the defined format. Options are: dotenv - dotenv style [default] expo...
2.671875
3
109.py
juandarr/ProjectEuler
0
8108
<reponame>juandarr/ProjectEuler """ Finds the number of distinct ways a player can checkout a score less than 100 Author: <NAME> """ import math def checkout_solutions(checkout,sequence,idx_sq,d): ''' returns the number of solution for a given checkout value ''' counter = 0 for double in d: ...
3.265625
3
src/tevatron/tevax/loss.py
vjeronymo2/tevatron
95
8109
<filename>src/tevatron/tevax/loss.py import jax.numpy as jnp from jax import lax import optax import chex def _onehot(labels: chex.Array, num_classes: int) -> chex.Array: x = labels[..., None] == jnp.arange(num_classes).reshape((1,) * labels.ndim + (-1,)) x = lax.select(x, jnp.ones(x.shape), jnp.zeros(x.shape...
2.03125
2
setup.py
kinnala/gammy
0
8110
import os from setuptools import setup, find_packages import versioneer if __name__ == "__main__": def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() meta = {} base_dir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(base_dir, 'gammy', '_m...
1.4375
1
fast-ml/main.py
gabrielstork/fast-ml
1
8111
<gh_stars>1-10 import root if __name__ == '__main__': window = root.Root() window.mainloop()
1.226563
1
application/recommendations/__init__.py
QualiChain/qualichain_backend
0
8112
<gh_stars>0 from flask import Blueprint recommendation_blueprint = Blueprint('recommendations', __name__) from application.recommendations import routes
1.304688
1
predictors/scene_predictor.py
XenonLamb/higan
83
8113
# python 3.7 """Predicts the scene category, attribute.""" import numpy as np from PIL import Image import torch import torch.nn.functional as F import torchvision.transforms as transforms from .base_predictor import BasePredictor from .scene_wideresnet import resnet18 __all__ = ['ScenePredictor'] N...
2.640625
3
python_test.py
jackKiZhu/mypython
0
8114
<gh_stars>0 from flask import Flask, render_template, request from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = "mysql://root:mysql@127.0.0.1:3306/python_github" app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True db = SQLAlchemy(app) class User(db.Model): id = ...
2.671875
3
src/etc/gec/3.py
iml1111/algorithm-study
0
8115
from collections import deque def solution(N, bus_stop): answer = [[1300 for _ in range(N)] for _ in range(N)] bus_stop = [(x-1, y-1) for x,y in bus_stop] q = deque(bus_stop) for x,y in bus_stop: answer[x][y] = 0 while q: x, y = q.popleft() for nx, ny in ((x-1, y), (x+1, y)...
3.296875
3
python/tree/0103_binary_tree_zigzag_level_order_traversal.py
linshaoyong/leetcode
6
8116
<gh_stars>1-10 class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def zigzagLevelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ if not root: ...
3.484375
3
plaso/parsers/winreg_plugins/usbstor.py
berggren/plaso
2
8117
<filename>plaso/parsers/winreg_plugins/usbstor.py # -*- coding: utf-8 -*- """File containing a Windows Registry plugin to parse the USBStor key.""" from __future__ import unicode_literals from plaso.containers import events from plaso.containers import time_events from plaso.lib import definitions from plaso.parsers ...
2.265625
2
damn_vulnerable_python/evil.py
CodyKochmann/damn_vulnerable_python
1
8118
''' static analyzers are annoying so lets rename eval ''' evil = eval
1.164063
1
rltoolkit/rltoolkit/acm/off_policy/ddpg_acm.py
MIMUW-RL/spp-rl
7
8119
import numpy as np import torch from torch.nn import functional as F from rltoolkit.acm.off_policy import AcMOffPolicy from rltoolkit.algorithms import DDPG from rltoolkit.algorithms.ddpg.models import Actor, Critic class DDPG_AcM(AcMOffPolicy, DDPG): def __init__( self, unbiased_update: bool = False, cu...
2.15625
2
pyroute/poi_osm.py
ftrimble/route-grower
0
8120
#!/usr/bin/python #---------------------------------------------------------------- # OSM POI handler for pyroute # #------------------------------------------------------ # Copyright 2007, <NAME> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Lic...
2.046875
2
pelutils/logger.py
peleiden/pelutils
3
8121
<gh_stars>1-10 from __future__ import annotations import os import traceback as tb from collections import defaultdict from enum import IntEnum from functools import update_wrapper from itertools import chain from typing import Any, Callable, DefaultDict, Generator, Iterable, Optional from pelutils import get_timestam...
2.453125
2
tests/test_metrics.py
aaxelb/django-elasticsearch-metrics
5
8122
<gh_stars>1-10 import mock import pytest import datetime as dt from django.utils import timezone from elasticsearch_metrics import metrics from elasticsearch_dsl import IndexTemplate from elasticsearch_metrics import signals from elasticsearch_metrics.exceptions import ( IndexTemplateNotFoundError, IndexTempla...
2.078125
2
6 kyu/SumFibs.py
mwk0408/codewars_solutions
6
8123
<reponame>mwk0408/codewars_solutions<filename>6 kyu/SumFibs.py from functools import lru_cache @lru_cache def fib(n): return n if n<2 else fib(n-1)+fib(n-2) def sum_fibs(n): return sum(j for j in (fib(i) for i in range(n+1)) if j%2==0)
3.359375
3
tests/unit/test_iris_helpers.py
jvegreg/ESMValCore
0
8124
<filename>tests/unit/test_iris_helpers.py """Tests for :mod:`esmvalcore.iris_helpers`.""" import datetime import iris import numpy as np import pytest from cf_units import Unit from esmvalcore.iris_helpers import date2num, var_name_constraint @pytest.fixture def cubes(): """Test cubes.""" cubes = iris.cube....
2.53125
3
geo_regions.py
saeed-moghimi-noaa/Maxelev_plot
0
8125
<filename>geo_regions.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Geo regions for map plot """ __author__ = "<NAME>" __copyright__ = "Copyright 2017, UCAR/NOAA" __license__ = "GPL" __version__ = "1.0" __email__ = "<EMAIL>" import matplotlib.pyplot as plt from collections import defaultdict defs = defaultd...
2.359375
2
figures/plot_log_figure_paper.py
davidADSP/deepAI_paper
21
8126
<reponame>davidADSP/deepAI_paper import numpy import matplotlib.pyplot as plt fig_convergence = plt.figure(1,figsize=(12,6)) x = numpy.loadtxt('log_deepAI_paper_nonlin_action_long.txt') plt.subplot(122) plt.plot(x[:,0]) plt.xlim([0,500]) plt.ylim([-10,200]) plt.xlabel('Steps') plt.ylabel('Free Action') plt.axvline(x...
2.40625
2
setup.py
matiasgrana/nagios_sql
0
8127
<gh_stars>0 #! python3 # Help from: http://www.scotttorborg.com/python-packaging/minimal.html # https://docs.python.org/3/distutils/commandref.html#sdist-cmd # https://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # https://docs.python.org/3.4/tutorial/modules.html # Install it with python ...
2.171875
2
textnn/utils/test/test_progress_iterator.py
tongr/TextNN
1
8128
import io import sys from textnn.utils import ProgressIterator #inspired by https://stackoverflow.com/a/34738440 def capture_sysout(cmd): capturedOutput = io.StringIO() # Create StringIO object sys.stdout = capturedOutput # and redirect stdout. cmd() ...
2.65625
3
reach.py
NIKH0610/class5-homework
0
8129
import os import numpy as np import pandas as pd housing_df = pd.read_csv(filepath_or_buffer='~/C:\Users\nikhi\NIKH0610\class5-homework\toys-datasets\boston')
2.421875
2
queries/general_queries.py
souparvo/airflow-plugins
0
8130
def insert_metatable(): """SQL query to insert records from table insert into a table on a DB """ return """ INSERT INTO TABLE {{ params.target_schema }}.{{ params.target_table }} VALUES ('{{ params.schema }}', '{{ params.table }}', {{ ti.xcom_pull(key='hive_res', task_ids=params.count_inserts)[0...
2.671875
3
pyvisa_py/highlevel.py
Handfeger/pyvisa-py
1
8131
# -*- coding: utf-8 -*- """Highlevel wrapper of the VISA Library. :copyright: 2014-2020 by PyVISA-py Authors, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ import random from collections import OrderedDict from typing import Any, Dict, Iterable, List, Optional, Tuple, Union, cast fr...
2.09375
2
detectron/utils/webly_vis.py
sisrfeng/NA-fWebSOD
23
8132
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import cv2 import numpy as np import os import math from PIL import Image, ImageDraw, ImageFont from caffe2.python import workspace from detectron.core.config import cf...
2.21875
2
salt/runner.py
StepOneInc/salt
1
8133
# -*- coding: utf-8 -*- ''' Execute salt convenience routines ''' # Import python libs from __future__ import print_function from __future__ import absolute_import import collections import logging import time import sys import multiprocessing # Import salt libs import salt.exceptions import salt.loader import salt.m...
2.25
2
.venv/lib/python3.8/site-packages/poetry/core/_vendor/lark/__pyinstaller/__init__.py
RivtLib/replit01
1
8134
# For usage of lark with PyInstaller. See https://pyinstaller-sample-hook.readthedocs.io/en/latest/index.html import os def get_hook_dirs(): return [os.path.dirname(__file__)]
1.601563
2
pong-pg.py
s-gv/pong-keras
0
8135
<filename>pong-pg.py # Copyright (c) 2019 <NAME>. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import sys import numpy as np import gym import tensorflow as tf from tensorflow.keras.models import Sequential, Model from tensorflow.keras.laye...
2.40625
2
dexp/cli/dexp_commands/crop.py
JoOkuma/dexp
0
8136
import click from arbol.arbol import aprint, asection from dexp.cli.defaults import DEFAULT_CLEVEL, DEFAULT_CODEC, DEFAULT_STORE from dexp.cli.parsing import _get_output_path, _parse_channels, _parse_chunks from dexp.datasets.open_dataset import glob_datasets from dexp.datasets.operations.crop import dataset_crop @c...
2
2
morse_DMT/write_dipha_file_3d_revise.py
YinuoJin/DMT_loss
1
8137
import sys from matplotlib import image as mpimg import numpy as np import os DIPHA_CONST = 8067171840 DIPHA_IMAGE_TYPE_CONST = 1 DIM = 3 input_dir = os.path.join(os.getcwd(), sys.argv[1]) dipha_output_filename = sys.argv[2] vert_filename = sys.argv[3] input_filenames = [name for nam...
2.359375
2
microservices/validate/tools/validates.py
clodonil/pipeline_aws_custom
0
8138
""" Tools para validar o arquivo template recebido do SQS """ class Validate: def __init__(self): pass def check_validate_yml(self, template): """ valida se o arquivo yml é valido """ if template: return True else: return False def che...
2.875
3
MetropolisMCMC.py
unrealTOM/MC
4
8139
import numpy as np import matplotlib.pyplot as plt import math def normal(mu,sigma,x): #normal distribution return 1/(math.pi*2)**0.5/sigma*np.exp(-(x-mu)**2/2/sigma**2) def eval(x): return normal(-4,1,x) + normal(4,1,x) #return 0.3*np.exp(-0.2*x**2)+0.7*np.exp(-0.2*(x-10)**2) def ref(x_star,x): #normal...
3.171875
3
gfwlist/gen.py
lipeijian/shadowsocks-android
137
8140
<reponame>lipeijian/shadowsocks-android #!/usr/bin/python # -*- encoding: utf8 -*- import itertools import math import sys import IPy def main(): china_list_set = IPy.IPSet() for line in sys.stdin: china_list_set.add(IPy.IP(line)) # 输出结果 for ip in china_list_set: print '<item>' + st...
2.5625
3
Specialization/Personal/SortHours.py
lastralab/Statistics
3
8141
name = "mail.txt" counts = dict() handle = open(name) for line in handle: line = line.rstrip() if line == '': continue words = line.split() if words[0] == 'From': counts[words[5][:2]] = counts.get(words[5][:2], 0) + 1 tlist = list() for key, value in counts.items(): ...
3.234375
3
core/simulators/carla_scenario_simulator.py
RangiLyu/DI-drive
0
8142
import os from typing import Any, Dict, List, Optional import carla from core.simulators.carla_simulator import CarlaSimulator from core.simulators.carla_data_provider import CarlaDataProvider from .srunner.scenarios.route_scenario import RouteScenario, SCENARIO_CLASS_DICT from .srunner.scenariomanager.scenario_mana...
2.53125
3
bin/run.py
Conengmo/python-empty-project
0
8143
import myproject myproject.logs(show_level='debug') myproject.mymod.do_something()
1.375
1
development/simple_email.py
gerold-penz/python-simplemail
16
8144
<filename>development/simple_email.py #!/usr/bin/env python # coding: utf-8 # BEGIN --- required only for testing, remove in real world code --- BEGIN import os import sys THISDIR = os.path.dirname(os.path.abspath(__file__)) APPDIR = os.path.abspath(os.path.join(THISDIR, os.path.pardir, os.path.pardir)) sys.path.inser...
2.8125
3
features/hdf_features.py
DerekYJC/bmi_python
0
8145
<reponame>DerekYJC/bmi_python ''' HDF-saving features ''' import time import tempfile import random import traceback import numpy as np import fnmatch import os, sys import subprocess from riglib import calibrations, bmi from riglib.bmi import extractor from riglib.experiment import traits import hdfwriter class Save...
2.25
2
common/irma/common/exceptions.py
vaginessa/irma
0
8146
<reponame>vaginessa/irma # # Copyright (c) 2013-2018 Quarkslab. # This file is part of IRMA 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 in the top-level directory # of this distribu...
1.914063
2
tf_crnn/libs/infer.py
sunmengnan/city_brain
0
8147
<reponame>sunmengnan/city_brain import time import os import math import numpy as np from libs import utils from libs.img_dataset import ImgDataset from nets.crnn import CRNN from nets.cnn.paper_cnn import PaperCNN import shutil def calculate_accuracy(predicts, labels): """ :param predicts: encoded predict ...
2.203125
2
Day 2/Day_2_Python.py
giTan7/30-Days-Of-Code
1
8148
#!/bin/python3 import math import os import random import re import sys # Complete the solve function below. def solve(meal_cost, tip_percent, tax_percent): tip = (meal_cost * tip_percent)/100 tax = (meal_cost * tax_percent)/100 print(int(meal_cost + tip + tax + 0.5)) # We add 0.5 because...
3.984375
4
modules/templates/RLPPTM/tools/mis.py
nursix/rlpptm
1
8149
# -*- coding: utf-8 -*- # # Helper Script for Mass-Invitation of Participant Organisations # # RLPPTM Template Version 1.0 # # Execute in web2py folder after code upgrade like: # python web2py.py -S eden -M -R applications/eden/modules/templates/RLPPTM/tools/mis.py # import os import sys from core import s3_format_dat...
1.851563
2
data/train/python/22aec8fbe47f7975a1e7f4a0caa5c88c56e4a03e__init__.py
harshp8l/deep-learning-lang-detection
84
8150
def save_form(form, actor=None): """Allows storing a form with a passed actor. Normally, Form.save() does not accept an actor, but if you require this to be passed (is not handled by middleware), you can use this to replace form.save(). Requires you to use the audit.Model model as the actor is passed to th...
3.4375
3
engine/test_sysctl.py
kingsd041/os-tests
0
8151
# coding = utf-8 # Create date: 2018-11-05 # Author :Hailong def test_sysctl(ros_kvm_with_paramiko, cloud_config_url): command = 'sudo cat /proc/sys/kernel/domainname' feed_back = 'test' client = ros_kvm_with_paramiko(cloud_config='{url}/test_sysctl.yml'.format(url=cloud_config_url)) stdin, stdout, st...
1.992188
2
paprika_sync/core/management/commands/import_recipes_from_file.py
grschafer/paprika-sync
0
8152
import json import logging from django.core.management.base import BaseCommand from django.db import transaction from paprika_sync.core.models import PaprikaAccount from paprika_sync.core.serializers import RecipeSerializer, CategorySerializer from paprika_sync.core.utils import log_start_end logger = logging.getLo...
2.09375
2
scripts/update_asp_l1.py
sot/mica
0
8153
#!/usr/bin/env python # Licensed under a 3-clause BSD style license - see LICENSE.rst import mica.archive.asp_l1 mica.archive.asp_l1.main()
0.867188
1
pair.py
hhgarnes/python-validity
0
8154
<reponame>hhgarnes/python-validity<gh_stars>0 from time import sleep from proto9x.usb import usb from proto9x.tls import tls from proto9x.flash import read_flash from proto9x.init_flash import init_flash from proto9x.upload_fwext import upload_fwext from proto9x.calibrate import calibrate from proto9x.init_db import ...
2.34375
2
output/models/ms_data/element/elem_q017_xsd/elem_q017.py
tefra/xsdata-w3c-tests
1
8155
from dataclasses import dataclass, field @dataclass class FooTest: class Meta: name = "fooTest" value: str = field( init=False, default="Hello" ) @dataclass class Root: class Meta: name = "root" foo_test: str = field( init=False, default="Hello",...
2.9375
3
contrib_src/predict.py
modelhub-ai/mic-dkfz-brats
1
8156
import json import os from collections import OrderedDict from copy import deepcopy import SimpleITK as sitk from batchgenerators.augmentations.utils import resize_segmentation # resize_softmax_output from skimage.transform import resize from torch.optim import lr_scheduler from torch import nn import numpy as np impor...
2.09375
2
plot/finderror.py
architsakhadeo/Offline-Hyperparameter-Tuning-for-RL
0
8157
<reponame>architsakhadeo/Offline-Hyperparameter-Tuning-for-RL import os basepath = '/home/archit/scratch/cartpoles/data/hyperparam/cartpole/offline_learning/esarsa-adam/' dirs = os.listdir(basepath) string = '''''' for dir in dirs: print(dir) subbasepath = basepath + dir + '/' subdirs = os.listdir(subbasepath) for ...
2.203125
2
src/pybacked/zip_handler.py
bluePlatinum/pyback
0
8158
import os import shutil import tempfile import zipfile def archive_write(archivepath, data, filename, compression, compressionlevel): """ Create a file named filename in the archive and write data to it :param archivepath: The path to the zip-archive :type archivepath: str :param data: The data t...
4.0625
4
src/query_planner/abstract_scan_plan.py
imvinod/Eva
1
8159
<filename>src/query_planner/abstract_scan_plan.py """Abstract class for all the scan planners https://www.postgresql.org/docs/9.1/using-explain.html https://www.postgresql.org/docs/9.5/runtime-config-query.html """ from src.query_planner.abstract_plan import AbstractPlan from typing import List class AbstractScan(Abs...
2.8125
3
tests/tools/test-tcp4-client.py
jimmy-huang/zephyr.js
0
8160
# !usr/bin/python # coding:utf-8 import time import socket def main(): print "Socket client creat successful" host = "192.0.2.1" port = 9876 bufSize = 1024 addr = (host, port) Timeout = 300 mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mySocket.settimeout(Timeout) ...
3.15625
3
kinto/__main__.py
s-utsch/kinto
0
8161
import argparse import sys from cliquet.scripts import cliquet from pyramid.scripts import pserve from pyramid.paster import bootstrap def main(args=None): """The main routine.""" if args is None: args = sys.argv[1:] parser = argparse.ArgumentParser(description="Kinto commands...
2.59375
3
apis/admin.py
JumboCode/GroundWorkSomerville
0
8162
from django.contrib import admin from django.contrib.auth.models import User from .models import Vegetable, Harvest, Transaction, Merchandise, MerchandisePrice from .models import PurchasedItem, UserProfile, VegetablePrice, StockedVegetable from .models import MerchandisePhotos admin.site.register(Vegetable) admin.sit...
1.429688
1
tests/unit/media/test_synthesis.py
AnantTiwari-Naman/pyglet
0
8163
<gh_stars>0 from ctypes import sizeof from io import BytesIO import unittest from pyglet.media.synthesis import * local_dir = os.path.dirname(__file__) test_data_path = os.path.abspath(os.path.join(local_dir, '..', '..', 'data')) del local_dir def get_test_data_file(*file_parts): """Get a file from the test da...
2.453125
2
Ejercicio/Ejercicio7.py
tavo1599/F.P2021
1
8164
<filename>Ejercicio/Ejercicio7.py<gh_stars>1-10 #Datos de entrada num=int(input("Ingrese un numero: ")) # Proceso if num==10: print("Calificacion: A") elif num==9: print("Calificacion: B") elif num==8: print("Calificacion: C") elif num==7 and num==6: print("Calificacion: D") elif num<=5 and num>=0: print("Califica...
3.5625
4
2015/day-2/part2.py
nairraghav/advent-of-code-2019
0
8165
<gh_stars>0 ribbon_needed = 0 with open("input.txt", "r") as puzzle_input: for line in puzzle_input: length, width, height = [int(item) for item in line.split("x")] dimensions = [length, width, height] smallest_side = min(dimensions) dimensions.remove(smallest_side) second_smallest_side = min(dimensions) ...
3.625
4
Algorithm.Python/Alphas/GreenblattMagicFormulaAlgorithm.py
aaronwJordan/Lean
0
8166
<filename>Algorithm.Python/Alphas/GreenblattMagicFormulaAlgorithm.py<gh_stars>0 # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this ...
2.171875
2
hw2/deeplearning/style_transfer.py
axelbr/berkeley-cs182-deep-neural-networks
0
8167
<gh_stars>0 import numpy as np import torch import torch.nn.functional as F def content_loss(content_weight, content_current, content_target): """ Compute the content loss for style transfer. Inputs: - content_weight: Scalar giving the weighting for the content loss. - content_current: features ...
2.84375
3
submissions/available/Johnson-CausalTesting/Holmes/fuzzers/Peach/Transformers/Encode/HTMLDecode.py
brittjay0104/rose6icse
0
8168
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import xml.sax.saxutils from Peach.transformer import Transformer class HtmlDecode(Transformer): """Decode HTML en...
1.9375
2
src/archive/greatcircle.py
AuraUAS/aura-core
8
8169
<gh_stars>1-10 # From: http://williams.best.vwh.net/avform.htm#GCF import math EPS = 0.0001 d2r = math.pi / 180.0 r2d = 180.0 / math.pi rad2nm = (180.0 * 60.0) / math.pi nm2rad = 1.0 / rad2nm nm2meter = 1852 meter2nm = 1.0 / nm2meter # p1 = (lat1(deg), lon1(deg)) # p2 = (lat2(deg), lon2(deg)) def course_and_dist(p1,...
2.65625
3
app/__init__.py
JoeCare/flask_geolocation_api
0
8170
<filename>app/__init__.py import connexion, os from connexion.resolver import RestyResolver from flask import json from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow # Globally accessible libraries db = SQLAlchemy() mm = Marshmallow() def init_app(): """Initialize the Connexion ap...
2.203125
2
RIPv2-Simulation/Router.py
vkmanojk/Networks-VirtualLAN
0
8171
''' Summary: Program that implements a routing deamon based on the RIP version 2 protocol from RFC2453. Usage: python3 Router.py <router_config_file> Configuration File: The user supplies a router configuration file of the format: [Setting...
2.96875
3
atlaselectrophysiology/extract_files.py
alowet/iblapps
0
8172
<filename>atlaselectrophysiology/extract_files.py from ibllib.io import spikeglx import numpy as np import ibllib.dsp as dsp from scipy import signal from ibllib.misc import print_progress from pathlib import Path import alf.io as aio import logging import ibllib.ephys.ephysqc as ephysqc from phylib.io import ...
2.359375
2
site_settings/models.py
shervinbdndev/Django-Shop
13
8173
from django.db import models class SiteSettings(models.Model): site_name = models.CharField(max_length=200 , verbose_name='Site Name') site_url = models.CharField(max_length=200 , verbose_name='Site URL') site_address = models.CharField(max_length=300 , verbose_name='Site Address') site_phone = mode...
2.015625
2
examples/basics/visuals/line_prototype.py
3DAlgoLab/vispy
2,617
8174
# -*- coding: utf-8 -*- # vispy: gallery 10 # Copyright (c) Vispy Development Team. All Rights Reserved. # Distributed under the (new) BSD License. See LICENSE.txt for more info. import sys import numpy as np from vispy import app, gloo, visuals from vispy.visuals.filters import Clipper, ColorFilter from vispy.visual...
2.328125
2
h1st/tests/core/test_schemas_inferrer.py
Mou-Ikkai/h1st
2
8175
from unittest import TestCase from datetime import datetime import pyarrow as pa import numpy as np import pandas as pd from h1st.schema import SchemaInferrer class SchemaInferrerTestCase(TestCase): def test_infer_python(self): inferrer = SchemaInferrer() self.assertEqual(inferrer.infer_schema(1)...
2.65625
3
c_core_librairies/exercise_a.py
nicolasessisbreton/pyzehe
1
8176
""" # refactoring Refactoring is the key to successfull projects. Refactor: 1) annuity_factor such that: conversion to integer is handled, no extra printing 2) policy_book into a class such that: a function generates the book and the premium stats and visualizations functions are avalaible 3) book_report su...
2.203125
2
util/util.py
harshitAgr/vess2ret
111
8177
"""Auxiliary methods.""" import os import json from errno import EEXIST import numpy as np import seaborn as sns import cPickle as pickle import matplotlib.pyplot as plt sns.set() DEFAULT_LOG_DIR = 'log' ATOB_WEIGHTS_FILE = 'atob_weights.h5' D_WEIGHTS_FILE = 'd_weights.h5' class MyDict(dict): """ Dictionar...
2.703125
3
services/apiRequests.py
CakeCrusher/voon-video_processing
0
8178
from github import Github def parseGithubURL(url): splitURL = url.split('/') owner = splitURL[3] repo = splitURL[4] return { "owner": owner, "repo": repo } def fetchRepoFiles(owner, repo): files = [] g = Github('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') repo = g.get_rep...
2.84375
3
utils/tricks.py
HouchangX-AI/Dialog-Solution
3
8179
<gh_stars>1-10 #-*- coding: utf-8 -*- import codecs import random from utils.global_names import GlobalNames, get_file_path def modify_tokens(tokens): new_tokens = [] pos = 0 len_ = len(tokens) while pos < len_: if tokens[pos] == "[": if pos+2 < len_ and tokens[pos+2] == "]": ...
2.671875
3
test/functional/test_device.py
Jagadambass/Graph-Neural-Networks
0
8180
<gh_stars>0 from graphgallery.functional import device import tensorflow as tf import torch def test_device(): # how about other backend? # tf assert isinstance(device("cpu", "tf"), str) assert device() == 'cpu' assert device("cpu", "tf") == 'CPU' assert device("cpu", "tf") == 'cpu' asser...
2.6875
3
py_hanabi/card.py
krinj/hanabi-simulator
1
8181
<gh_stars>1-10 # -*- coding: utf-8 -*- """ A card (duh). """ import random import uuid from enum import Enum from typing import List from py_hanabi.settings import CARD_DECK_DISTRIBUTION __author__ = "<NAME>" __email__ = "<EMAIL>" class Color(Enum): RED = 1 BLUE = 2 GREEN = 3 YELLOW = 4 WHITE =...
3.15625
3
facetools/test/testcases.py
bigsassy/django-facetools
2
8182
import types import django.test.testcases from django.conf import settings from facetools.models import TestUser from facetools.common import _create_signed_request from facetools.test import TestUserNotLoaded from facetools.signals import sync_facebook_test_user, setup_facebook_test_client from facetools.common impor...
2.0625
2
setup.py
d2gex/distpickymodel
0
8183
import setuptools import distpickymodel def get_long_desc(): with open("README.rst", "r") as fh: return fh.read() setuptools.setup( name="distpickymodel", version=distpickymodel.__version__, author="<NAME>", author_email="<EMAIL>", description="A shared Mongoengine-based model librar...
1.78125
2
credentials_test.py
tinatasha/passwordgenerator
0
8184
<reponame>tinatasha/passwordgenerator import unittest from password import Credentials class TestCredentials(unittest.TestCase): """ Class to test behaviour of the credentials class """ def setUp(self): """ Setup method that defines instructions """ self.new_credentials ...
3.234375
3
homework_08/calc_fitness.py
ufpa-organization-repositories/evolutionary-computing
0
8185
<gh_stars>0 def calc_fitness(pop): from to_decimal import to_decimal from math import sin, sqrt for index, elem in enumerate(pop): # só atribui a fitness a cromossomos que ainda não possuem fitness # print(elem[0], elem[1]) x = to_decimal(elem[0]) y = to_decimal(elem[1]) ...
3.265625
3
pichetprofile/__init__.py
jamenor/pichetprofile
2
8186
<gh_stars>1-10 # -*- coding: utf-8 -*- from oopschool.school import Student,Tesla,SpecialStudent,Teacher from oopschool.newschool import Test
0.953125
1
leetcode/group2/461.py
HPluseven/playground
1
8187
<filename>leetcode/group2/461.py class Solution: def hammingDistance(self, x: int, y: int) -> int: xor = x ^ y distance = 0 while xor: if xor & 1: distance += 1 xor = xor >> 1 return distance class Solution: def hammingDistance(self, x: i...
3.890625
4
rdl/data_sources/DataSourceFactory.py
pageuppeople-opensource/relational-data-loader
2
8188
<reponame>pageuppeople-opensource/relational-data-loader import logging from rdl.data_sources.MsSqlDataSource import MsSqlDataSource from rdl.data_sources.AWSLambdaDataSource import AWSLambdaDataSource class DataSourceFactory(object): def __init__(self, logger=None): self.logger = logger or logging.getLog...
2.3125
2
ch05/ch05-02-timeseries.py
alexmalins/kagglebook
13
8189
# --------------------------------- # Prepare the data etc. # ---------------------------------- import numpy as np import pandas as pd # train_x is the training data, train_y is the target values, and test_x is the test data # stored in pandas DataFrames and Series (numpy arrays also used) train = pd.read_csv('../in...
3.234375
3
server/WitClient.py
owo/jitalk
1
8190
<reponame>owo/jitalk #!/usr/bin/env python # -*- coding: utf-8 -*- import wit import json class WitClient(object): """docstring for WitClient""" _access_token = '<KEY>' def __init__(self): wit.init() def text_query(self, text): res = json.loads(wit.text_query(text, WitClient._access_token)) return res["o...
2.421875
2
HackerRank/Python/Easy/E0036.py
Mohammed-Shoaib/HackerRank-Problems
54
8191
<filename>HackerRank/Python/Easy/E0036.py # Problem Statement: https://www.hackerrank.com/challenges/itertools-combinations-with-replacement/problem from itertools import combinations_with_replacement S, k = input().split() for comb in combinations_with_replacement(sorted(S), int(k)): print(''.join(comb))
3.5
4
visual_genome/models.py
hayyubi/visual-genome-driver
0
8192
<reponame>hayyubi/visual-genome-driver """ Visual Genome Python API wrapper, models """ class Image: """ Image. ID int url hyperlink string width int height int """ def __init__(self, id, url, width, height, coco_id, flickr_id): self.id = id ...
2.65625
3
python-scripts/plot_delay.py
GayashanNA/my-scripts
0
8193
<filename>python-scripts/plot_delay.py<gh_stars>0 import csv import matplotlib.pyplot as plt import time PLOT_PER_WINDOW = False WINDOW_LENGTH = 60000 BINS = 1000 delay_store = {} perwindow_delay_store = {} plotting_delay_store = {} filename = "output-large.csv" # filename = "output.csv" # filename = "output-medium.c...
2.953125
3
python_scripts/BUSCO_phylogenetics/rename_all_fa_seq.py
peterthorpe5/Methods_M.cerasi_R.padi_genome_assembly
4
8194
<filename>python_scripts/BUSCO_phylogenetics/rename_all_fa_seq.py #!/usr/bin/env python # author: <NAME> September 2015. The James Hutton Insitute, Dundee, UK. # title rename single copy busco genes from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from Bio import SeqIO import os from sys import stdin,argv i...
3.25
3
video/rest/compositionhooks/delete-hook/delete-hook.6.x.py
afeld/api-snippets
3
8195
# Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console api_key_sid = 'SKXXXX' api_key_secret = 'your_api_key_secret' client = Client(api_key_sid, api_key_secret) did_delete = client.video\ .c...
2.21875
2
global_info.py
AkagiYui/AzurLaneTool
0
8196
from time import sleep debug_mode = False time_to_exit = False exiting = False exit_code = 0 def get_debug_mode(): return debug_mode def trigger_exit(_exit_code): global time_to_exit, exit_code exit_code = _exit_code time_to_exit = True sleep(0.1)
2.21875
2
advesarial_text/data/data_utils_test.py
slowy07/tensorflow-model-research
0
8197
from __future__ import absoulte_import from __future__ import division from __future__ import print_function import tensorflow as tf from data import data_utils data = data_utils class SequenceWrapperTest(tf.test.TestCase): def testDefaultTimesteps(self): seq = data.SequenceWrapper() t1 = seq....
2.328125
2
headlesspreview/apps.py
arush15june/wagtail-torchbox
0
8198
from django.apps import AppConfig class HeadlesspreviewConfig(AppConfig): name = 'headlesspreview'
1.117188
1
LipSDP/solve_sdp.py
revbucket/LipSDP
1
8199
<reponame>revbucket/LipSDP import argparse import numpy as np import matlab.engine from scipy.io import savemat import os from time import time def main(args): start_time = time() eng = matlab.engine.start_matlab() eng.addpath(os.path.join(file_dir, 'matlab_engine')) eng.addpath(os.path.join(file_dir,...
2.125
2