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 |
|---|---|---|---|---|---|---|
taller_estructuras_de_control_selectivas/ejercicio_13.py | JMosqueraM/algoritmos_y_programacion | 0 | 9700 | # Desarrolle un un programa que reciba la fecha de nacimiento
# de una persona, y como salida, indique el nombre del signo del
# zodiaco correspondiente, ademas de su edad
def zodiaco(DD, MM):
if (((DD >= 22) and (MM == 11)) or ((DD <=21) and (MM == 12))):
return("Sagitario")
if (((DD >= 22) and (MM ==... | 3.625 | 4 |
assignment3/crawler/spiders/benchmark_spider.py | vhazali/cs5331 | 8 | 9701 | import re, scrapy
from crawler.items import *
class BenchmarkSpider(scrapy.Spider):
drop_params = True
# Spider name, for use with the scrapy crawl command
name = "benchmarks"
# Constants to get url parts
FULL, PROTOCOL, USER, PASSWORD, SUBDOMAIN, DOMAIN, TOP_LEVEL_DOMAIN, PORT_NUM, PATH, PAGE, GE... | 2.71875 | 3 |
octavia_tempest_plugin/services/load_balancer/v2/listener_client.py | NeCTAR-RC/octavia-tempest-plugin | 0 | 9702 | # Copyright 2017 GoDaddy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | 1.65625 | 2 |
ryu/gui/views/router_address_delete.py | isams1/Thesis | 3 | 9703 | import re
import logging
import httplib
import view_base
from models import rt_proxy
LOG = logging.getLogger('ryu.gui')
class RtAddrDel(view_base.ViewBase):
def __init__(self, host, port, dpid, address_id, status=None):
super(RtAddrDel, self).__init__()
self.host = host
self.port = port
... | 2.25 | 2 |
tests/util/test_helper.py | TobiasRasbold/pywrangler | 14 | 9704 | """This module contains tests for the helper module.
"""
from pywrangler.util.helper import get_param_names
def test_get_param_names():
def func():
pass
assert get_param_names(func) == []
def func1(a, b=4, c=6):
pass
assert get_param_names(func1) == ["a", "b", "c"]
assert get... | 2.578125 | 3 |
Python-Files/model_conversion/convert_to_tflite.py | jcgeo9/ML-For-Fish-Recognition | 0 | 9705 | <reponame>jcgeo9/ML-For-Fish-Recognition
# =============================================================================
# Created By : <NAME>
# Project : Machine Learning for Fish Recognition (Individual Project)
# =============================================================================
# Description : File ... | 2.859375 | 3 |
python3/sparkts/test/test_datetimeindex.py | hedibejaoui/spark-timeseries | 0 | 9706 | <reponame>hedibejaoui/spark-timeseries<gh_stars>0
from .test_utils import PySparkTestCase
from sparkts.datetimeindex import *
import pandas as pd
class DateTimeIndexTestCase(PySparkTestCase):
def test_frequencies(self):
bd = BusinessDayFrequency(1, 1, self.sc)
self.assertEqual(bd.days(), 1)
... | 2.453125 | 2 |
src/listIntersect/inter.py | rajitbanerjee/leetcode | 0 | 9707 | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def getIntersectionNode(self, headA: ListNode, headB: ListNode) -> ListNode:
seen = set()
curr = headA
while curr:
seen.add(curr)
... | 3.59375 | 4 |
photon_stream_production/tests/test_drs_run_assignment.py | fact-project/photon_stream_production | 0 | 9708 | import numpy as np
import photon_stream as ps
import photon_stream_production as psp
import pkg_resources
import os
runinfo_path = pkg_resources.resource_filename(
'photon_stream_production',
os.path.join('tests', 'resources', 'runinfo_20161115_to_20170103.csv')
)
drs_fRunID_for_obs_run = psp.drs_run._drs_fRu... | 2.109375 | 2 |
accounts/migrations/0001_initial.py | vikifox/CMDB | 16 | 9709 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-18 05:56
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('cmdb', '0001_initial'),
('appc... | 1.742188 | 2 |
autoscaler/azure.py | gabrieladt/kops-ec2-autoscaler | 0 | 9710 | import http
import logging
from typing import List, Tuple, MutableMapping
from datetime import datetime
import re
from requests.packages.urllib3 import Retry
import autoscaler.utils as utils
from autoscaler.autoscaling_groups import AutoScalingGroup
from autoscaler.azure_api import AzureApi, AzureScaleSet, AzureScale... | 2.1875 | 2 |
sort_insertion.py | rachitmishra/45 | 0 | 9711 | """
Insertion Sort
Approach: Loop
Complexity: O(n2)
"""
def sort_insertion(input_arr):
print("""""""""""""""""""""""""")
print("input " + str(input_arr))
print("""""""""""""""""""""""""")
ln = len(input_arr)
i = 1 # Assuming first element is sorted
while i < ln: # n times
c = inpu... | 4.1875 | 4 |
Python2/tareas/tarea_7.py | eveiramirez/python_class | 0 | 9712 | <reponame>eveiramirez/python_class<filename>Python2/tareas/tarea_7.py
"""
NAME
tarea_7.py
VERSION
[1.0]
AUTHOR
<NAME>
CONTACT
<EMAIL>
GITHUB
https://github.com/eveiramirez/python_class/blob/master/Python2/tareas/tarea_7.py
DESCRIPTION
Este programa contiene arrays e... | 2.84375 | 3 |
iguanas/pipeline/_base_pipeline.py | paypal/Iguanas | 20 | 9713 | <gh_stars>10-100
"""
Base pipeline class. Main rule generator classes inherit from this one.
"""
from copy import deepcopy
from typing import List, Tuple, Union, Dict
from iguanas.pipeline.class_accessor import ClassAccessor
from iguanas.utils.typing import PandasDataFrameType, PandasSeriesType
import iguanas.utils.uti... | 2.453125 | 2 |
test_activity_merger.py | AlexanderMakarov/activitywatch-ets | 0 | 9714 | import unittest
import datetime
from parameterized import parameterized
from activity_merger import Interval
from aw_core.models import Event
from typing import List, Tuple
def _build_datetime(seed: int) -> datetime.datetime:
return datetime.datetime(2000, 1, seed, seed, 0, 0).astimezone(datetime.timezone.utc)
... | 2.3125 | 2 |
pommerman/agents/player_agent.py | alekseynp/playground | 8 | 9715 | """
NOTE:
There are a few minor complications to fluid human control which make this
code a little more involved than trivial.
1. Key press-release cycles can be, and often are, faster than one tick of
the game/simulation, but the player still wants that cycle to count, i.e.
to lay a bomb!
2. When holding down ... | 3.984375 | 4 |
tests/rest/test_rest.py | sapshah-cisco/cobra | 93 | 9716 | <filename>tests/rest/test_rest.py
# Copyright 2015 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | 1.851563 | 2 |
spanglish/tests/fixtures/models/language.py | omaraljazairy/FedalAPI | 0 | 9717 | <gh_stars>0
""" fixtures that return an sql statement with a list of values to be inserted."""
def load_language():
""" return the sql and values of the insert queuery."""
sql = """
INSERT INTO Spanglish_Test.Language
(
`name`, `iso-639-1`
)
VALUES (%s, ... | 2.671875 | 3 |
main-hs2.py | tradewartracker/phase-one-product-hs2 | 0 | 9718 | import datetime as dt
from os.path import dirname, join
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
from bokeh.io import curdoc
from bokeh.layouts import column, gridplot, row
from bokeh.models import ColumnDataSource, DataRange1d, Select, HoverTool, Panel, Tabs, LinearC... | 2.328125 | 2 |
aiohttp_middlewares/https.py | alxpy/aiohttp-middlewares | 34 | 9719 | <reponame>alxpy/aiohttp-middlewares<filename>aiohttp_middlewares/https.py
"""
================
HTTPS Middleware
================
Change scheme for current request when aiohttp application deployed behind
reverse proxy with HTTPS enabled.
Usage
=====
.. code-block:: python
from aiohttp import web
from aiohtt... | 2.25 | 2 |
show/drawing.py | nohamanona/poke-auto-fuka | 5 | 9720 | <reponame>nohamanona/poke-auto-fuka<filename>show/drawing.py
import cv2
import numpy as np
class DrawingClass(object):
def __init__(self):
self.draw_command ='None'
self.frame_count = 0
def drawing(self, frame, fps, num_egg, htc_egg, state):
cv2.putText(frame, 'FPS: {:.2f}'.form... | 2.71875 | 3 |
backtest.py | YangTaoCN/IntroNeuralNetworks | 0 | 9721 | import pandas_datareader.data as pdr
import yfinance as fix
import numpy as np
fix.pdr_override()
def back_test(strategy, seq_len, ticker, start_date, end_date, dim):
"""
A simple back test for a given date period
:param strategy: the chosen strategy. Note to have already formed the model, and fitted with... | 3.34375 | 3 |
src/tespy/components/subsystems.py | jbueck/tespy | 0 | 9722 | # -*- coding: utf-8
"""Module for custom component groups.
It is possible to create subsystems of component groups in tespy. The subsystem
class is the base class for custom subsystems.
This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted
by the contributors recorded in the version control ... | 2.9375 | 3 |
fairscale/optim/oss.py | blefaudeux/fairscale | 1 | 9723 | <filename>fairscale/optim/oss.py
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
import copy
import logging
from typing import TYPE_CHECKING, Any, Callable, List, Option... | 2.09375 | 2 |
setup.py | ninezerozeronine/raytracing-one-weekend | 0 | 9724 | from setuptools import setup, find_packages
setup(
name="raytracing-one-weekend",
version="0.0.0",
author="<NAME>",
author_email="<EMAIL>",
description="A raytracer achievable in a weekend.",
url="https://github.com/ninezerozeronine/raytracing-one-weekend",
install_requires=[
"Pillo... | 1.296875 | 1 |
homepage/urls.py | r0kym/SNI-backend | 1 | 9725 | <gh_stars>1-10
"""
URLconf of the homepage
"""
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('auth', views.auth, name='auth'),
path('auth/public', views.auth_public, name='auth-public'),
path('auth/full', views.auth_full, name='aut... | 1.867188 | 2 |
srcflib/email/__init__.py | mas90/srcf-python | 0 | 9726 | """
Notification email machinery, for tasks to send credentials and instructions to users.
Email templates placed inside the `templates` directory of this module should:
- extend from `layout`
- provide `subject` and `body` blocks
"""
from enum import Enum
import os.path
from jinja2 import Environment, FileSystemLo... | 2.53125 | 3 |
nose2_example/my_package/myapp.py | dolfandringa/PythonProjectStructureDemo | 2 | 9727 | from .operations import Multiply, Add, Substract
class MyApp(object):
def __init__(self):
self.operations={'multiply': Multiply,
'add': Add,
'substract': Substract}
def do(self, operation, number1, number2):
return self.operations[operation.low... | 3.25 | 3 |
src/train_nn.py | anirudhbhashyam/911-Calls-Seattle-Predictions | 0 | 9728 | <gh_stars>0
import os
from typing import Union
import tensorflow as tf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split, KFold
import utility as ut
from variables import *
# Read the data.
train_data = pd.read_csv(os.path.join(DATA_PATH, ".... | 2.78125 | 3 |
pdserver/objects.py | Gustavo6046/polydung | 0 | 9729 | <gh_stars>0
import base64
import random
import string
import netbyte
import numpy as np
try:
import simplejson as json
except ImportError:
import json
kinds = {}
class PDObject(object):
def __init__(self, game, kind, id, pos, properties):
self.game = game
self.kind = kind
... | 2.484375 | 2 |
football/football_test.py | EEdwardsA/DS-OOP-Review | 0 | 9730 | import unittest
from players import Player, Quarterback
from possible_values import *
from game import Game
from random import randint, uniform, sample
from season import *
# TODO - some things you can add...
class FootballGameTest(unittest.TestCase):
'''test the class'''
def test_field_goal_made(self):
... | 3.609375 | 4 |
preprocessor/base.py | shayanthrn/AGAIN-VC | 3 | 9731 | <reponame>shayanthrn/AGAIN-VC
import os
import logging
import numpy as np
from tqdm import tqdm
from functools import partial
from multiprocessing.pool import ThreadPool
import pyworld as pw
from util.dsp import Dsp
logger = logging.getLogger(__name__)
def preprocess_one(input_items, module, output_path=''):
inp... | 2.15625 | 2 |
divsum_stats.py | fjruizruano/SatIntExt | 0 | 9732 | <filename>divsum_stats.py<gh_stars>0
#!/usr/bin/python
import sys
from subprocess import call
print "divsum_count.py ListOfDivsumFiles\n"
try:
files = sys.argv[1]
except:
files = raw_input("Introduce RepeatMasker's list of Divsum files with library size (tab separated): ")
files = open(files).readlines()
to... | 2.890625 | 3 |
agatecharts/charts/__init__.py | onyxfish/fever | 4 | 9733 | <gh_stars>1-10
#!/usr/bin/env python
from agatecharts.charts.bars import Bars
from agatecharts.charts.columns import Columns
from agatecharts.charts.lines import Lines
from agatecharts.charts.scatter import Scatter
| 1.179688 | 1 |
users/views.py | rossm6/accounts | 11 | 9734 | from django.contrib.auth import update_session_auth_hash
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.contrib.auth.views import (LoginView, PasswordResetConfirmView,
PasswordResetView)
from django.http import Htt... | 2.140625 | 2 |
test/core/s3_table_test_base.py | adidas/m3d-api | 24 | 9735 | <reponame>adidas/m3d-api<filename>test/core/s3_table_test_base.py
import os
from test.core.emr_system_unit_test_base import EMRSystemUnitTestBase
from test.core.tconx_helper import TconxHelper
class S3TableTestBase(EMRSystemUnitTestBase):
default_tconx = \
"test/resources/s3_table_test_base/tconx-bdp-em... | 2.234375 | 2 |
metrics/serializers.py | BrianWaganerSTL/RocketDBaaS | 1 | 9736 | from rest_framework import serializers
from metrics.models import Metrics_Cpu, Metrics_PingServer, Metrics_MountPoint, \
Metrics_CpuLoad, Metrics_PingDb
class Metrics_CpuSerializer(serializers.ModelSerializer):
class Meta:
model = Metrics_Cpu
fields = '__all__'
depth = 0
class Metrics... | 1.984375 | 2 |
sqlc/private/sqlc_toolchain.bzl | dmayle/rules_sqlc | 2 | 9737 | # Copyright 2020 Plezentek, 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... | 1.640625 | 2 |
configs/tracker_configs/new_test_20e_cam_1_new_short.py | nolanzzz/mtmct | 17 | 9738 | <reponame>nolanzzz/mtmct
root = {
"general" : {
"display_viewer" : False,
#The visible GPUS will be restricted to the numbers listed here. The pytorch (cuda:0) numeration will start at 0
#This is a trick to get everything onto the wanted gpus because just setting cuda:4 in the function cal... | 1.984375 | 2 |
tests/structures/test_generator.py | cherub96/voc | 1 | 9739 | <reponame>cherub96/voc
from ..utils import TranspileTestCase
class GeneratorTests(TranspileTestCase):
def test_simple_generator(self):
self.assertCodeExecution("""
def multiplier(first, second):
y = first * second
yield y
y *= second
... | 2.828125 | 3 |
ogusa/tax.py | hdoupe/OG-USA | 0 | 9740 | <filename>ogusa/tax.py
'''
------------------------------------------------------------------------
Functions for taxes in the steady state and along the transition path.
------------------------------------------------------------------------
'''
# Packages
import numpy as np
from ogusa import utils
'''
------------... | 2.578125 | 3 |
muse_for_anything/api/v1_api/taxonomy_items.py | baireutherjonas/muse-for-anything | 0 | 9741 | <filename>muse_for_anything/api/v1_api/taxonomy_items.py
"""Module containing the taxonomy items API endpoints of the v1 API."""
from datetime import datetime
from sqlalchemy.sql.schema import Sequence
from muse_for_anything.db.models.taxonomies import (
Taxonomy,
TaxonomyItem,
TaxonomyItemRelation,
T... | 1.84375 | 2 |
PythonDAdata/3358OS_06_Code/code6/pd_plotting.py | shijiale0609/Python_Data_Analysis | 1 | 9742 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
df = pd.read_csv('transcount.csv')
df = df.groupby('year').aggregate(np.mean)
gpu = pd.read_csv('gpu_transcount.csv')
gpu = gpu.groupby('year').aggregate(np.mean)
df = pd.merge(df, gpu, how='outer', left_index=True, right_index=True)
df = df.rep... | 3.171875 | 3 |
source/blog/migrations/0004_postcomments.py | JakubGutowski/PersonalBlog | 0 | 9743 | <filename>source/blog/migrations/0004_postcomments.py
# Generated by Django 2.0.5 on 2018-07-02 19:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_blogpost_author'),
]
operations = [
... | 1.523438 | 2 |
submissions/aising2019/a.py | m-star18/atcoder | 1 | 9744 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
n = int(readline())
h = int(readline())
w = int(readline())
print((n - h + 1) * (n - w + 1))
| 2.71875 | 3 |
CreateHalo.py | yoyoberenguer/MultiplayerGameEngine | 4 | 9745 | <filename>CreateHalo.py<gh_stars>1-10
import pygame
from NetworkBroadcast import Broadcast, AnimatedSprite, DeleteSpriteCommand
from Textures import HALO_SPRITE12, HALO_SPRITE14, HALO_SPRITE13
__author__ = "<NAME>"
__credits__ = ["<NAME>"]
__version__ = "1.0.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"... | 2.359375 | 2 |
src/dataops/pandas_db.py | ShizhuZhang/ontask_b | 0 | 9746 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import logging
import os.path
import subprocess
from collections import OrderedDict
from itertools import izip
import numpy as np
import pandas as pd
from django.conf import settings
from django.core.cache import cache
from django.db impo... | 2.3125 | 2 |
config/cf.py | rbsdev/config-client | 0 | 9747 | <gh_stars>0
from typing import Any, Dict, KeysView
import attr
from config.auth import OAuth2
from config.cfenv import CFenv
from config.spring import ConfigClient
@attr.s(slots=True)
class CF:
cfenv = attr.ib(
type=CFenv, factory=CFenv, validator=attr.validators.instance_of(CFenv),
)
oauth2 = a... | 2.203125 | 2 |
ducktape/template.py | rancp/ducktape-docs | 0 | 9748 | <reponame>rancp/ducktape-docs
# Copyright 2015 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | 2.203125 | 2 |
day4/homework/q7.py | AkshayManchanda/Python_Training | 0 | 9749 | <reponame>AkshayManchanda/Python_Training<gh_stars>0
i=input("Enter a string: ")
list = i.split()
list.sort()
for i in list:
print(i,end=' ')
| 3.5625 | 4 |
src/git_portfolio/use_cases/config_repos.py | staticdev/github-portfolio | 0 | 9750 | <filename>src/git_portfolio/use_cases/config_repos.py
"""Config repositories use case."""
from __future__ import annotations
import git_portfolio.config_manager as cm
import git_portfolio.domain.gh_connection_settings as cs
import git_portfolio.responses as res
class ConfigReposUseCase:
"""Gitp config repositori... | 2.0625 | 2 |
test/test_logic.py | mateuszkowalke/sudoku_game | 0 | 9751 | import pytest
from ..logic import Board, empty_board, example_board, solved_board
class TestBoard:
def test_create_board(self):
board = Board(example_board)
assert board.tiles == example_board
def test_solve_board(self):
board = Board(example_board)
board.solve()
asse... | 3.078125 | 3 |
src/compas_rhino/objects/_select.py | jf---/compas | 2 | 9752 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import ast
import rhinoscriptsyntax as rs
__all__ = [
'mesh_select_vertex',
'mesh_select_vertices',
'mesh_select_face',
'mesh_select_faces',
'mesh_select_edge',
'mesh_select_edges',
... | 2.3125 | 2 |
handlers/product_add.py | MuchkoM/CalorieMatchBot | 0 | 9753 | from telegram import Update
from telegram.ext import Updater, CallbackContext, ConversationHandler, CommandHandler, MessageHandler, Filters
from db import DBConnector
import re
str_matcher = r"\"(?P<name>.+)\"\s*(?P<fat>\d+)\s*/\s*(?P<protein>\d+)\s*/\s*(?P<carbohydrates>\d+)\s*(?P<kcal>\d+)"
ADD_1 = 0
def add_0(... | 2.375 | 2 |
python-packages/nolearn-0.5/build/lib.linux-x86_64-2.7/nolearn/tests/test_dataset.py | rajegannathan/grasp-lift-eeg-cat-dog-solution-updated | 2 | 9754 | <gh_stars>1-10
from mock import patch
import numpy as np
def test_dataset_simple():
from ..dataset import Dataset
data = object()
target = object()
dataset = Dataset(data, target)
assert dataset.data is data
assert dataset.target is target
@patch('nolearn.dataset.np.load')
def test_dataset_... | 2.140625 | 2 |
src/Cipher/MultiLevelCaesarDecrypt.py | EpicTofuu/Assignment | 0 | 9755 | <reponame>EpicTofuu/Assignment
import Cipher.tk
from Cipher.tk import EncryptDecryptCoord, GetChiSquared, Mode
def MultiDecrypt (message, alphabet, usables = 3, lan = "English", transformations = [], lowestchi = 9999, ogMessage = ""):
msg = ""
prev = (9999, (0, 0)) # (chi, key)
for i ... | 3.28125 | 3 |
scripts/vcf_filter.py | bunop/cyvcf | 46 | 9756 | <reponame>bunop/cyvcf<gh_stars>10-100
#!/usr/bin/env python
import sys
import argparse
import pkg_resources
import vcf
from vcf.parser import _Filter
parser = argparse.ArgumentParser(description='Filter a VCF file',
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument('input', m... | 2.453125 | 2 |
src/flocker/blueprints/red/__init__.py | Muxelmann/home-projects | 0 | 9757 | import os
from flask import Blueprint, render_template
def create_bp():
bp_red = Blueprint('red', __name__, url_prefix='/red')
@bp_red.route('/index/')
@bp_red.route('/')
def index():
return render_template('red/index.html')
return bp_red | 2.296875 | 2 |
alphacoders/__init__.py | whoiscc/alphacoders | 7 | 9758 | <reponame>whoiscc/alphacoders
#
from aiohttp.client_exceptions import ClientError
from lxml import html
from pathlib import Path
from asyncio import create_task
from functools import wraps
def start_immediately(task):
@wraps(task)
def wrapper(*args, **kwargs):
return create_task(task(*args, **kwargs)... | 2.484375 | 2 |
Python/Calculating_Trimmed_Means/calculating_trimmed_means1.py | PeriscopeData/analytics-toolbox | 2 | 9759 | # SQL output is imported as a pandas dataframe variable called "df"
# Source: https://stackoverflow.com/questions/19441730/trimmed-mean-with-percentage-limit-in-python
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import tmean, scoreatpercentile
import numpy as np
def trimmean(arr, percent):
... | 3.28125 | 3 |
scripts/data_extract.py | amichalski2/WBC-SHAP | 0 | 9760 | import os
import cv2
import random
import numpy as np
from tensorflow.keras.utils import to_categorical
from scripts.consts import class_dict
def get_data(path, split=0.2):
X, y = [], []
for directory in os.listdir(path):
dirpath = os.path.join(path, directory)
print(directory, len(os.listd... | 2.640625 | 3 |
ironic/tests/unit/drivers/test_base.py | tzumainn/ironic | 0 | 9761 | <filename>ironic/tests/unit/drivers/test_base.py
# Copyright 2014 Cisco Systems, 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.ap... | 2.078125 | 2 |
opentimesheet/profiles/tests/test_models.py | valerymelou/opentimesheet-server | 0 | 9762 | <reponame>valerymelou/opentimesheet-server
import pytest
from opentimesheet.core.tests import TenantTestCase
@pytest.mark.usefixtures("profile")
class TestProfile(TenantTestCase):
def test__str__(self):
assert (
self.profile.first_name + " " + self.profile.last_name
== self.profil... | 2.234375 | 2 |
ami/flowchart/library/Display.py | chuckie82/ami | 6 | 9763 | from ami.flowchart.library.DisplayWidgets import ScalarWidget, ScatterWidget, WaveformWidget, \
ImageWidget, ObjectWidget, LineWidget, TimeWidget, HistogramWidget, \
Histogram2DWidget
from ami.flowchart.library.common import CtrlNode
from amitypes import Array1d, Array2d
from typing import Any
import ami.graph_... | 2.4375 | 2 |
deep-rl/lib/python2.7/site-packages/OpenGL/GL/ARB/transform_feedback_instanced.py | ShujaKhalid/deep-rl | 210 | 9764 | <filename>deep-rl/lib/python2.7/site-packages/OpenGL/GL/ARB/transform_feedback_instanced.py<gh_stars>100-1000
'''OpenGL extension ARB.transform_feedback_instanced
This module customises the behaviour of the
OpenGL.raw.GL.ARB.transform_feedback_instanced to provide a more
Python-friendly API
Overview (from the spec)... | 1.726563 | 2 |
features/cpp/simple/test.py | xbabka01/retdec-regression-tests | 8 | 9765 | <filename>features/cpp/simple/test.py<gh_stars>1-10
from regression_tests import *
class TestBase(Test):
def test_for_main(self):
assert self.out_c.has_funcs('main') or self.out_c.has_funcs('entry_point')
def test_check_main_is_not_ctor_or_dtor(self):
for c in self.out_config.classes:
... | 2.390625 | 2 |
src/experiment.py | windar427/find_alpha | 0 | 9766 | <filename>src/experiment.py
from .lib.DownloadData import DownloadData
| 1.0625 | 1 |
src/__init__.py | songchenwen/icloud-drive-docker | 0 | 9767 | <filename>src/__init__.py
__author__ = '<NAME> (<EMAIL>)'
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
| 1.1875 | 1 |
test_basico.py | rafael-torraca/delivery | 0 | 9768 | <gh_stars>0
def test_one_plus_one_is_two():
assert 1 + 1 == 2 #o assert espera que algo seja verdadeiro, se for falso o teste quebrou
def test_negative_1_plus_1_is_3():
assert 1 + 1 == 3
| 3.4375 | 3 |
setup.py | rohernandezz/coldtype | 0 | 9769 | import setuptools
long_description = """
# Coldtype
### Programmatic display typography
More info available at: [coldtype.goodhertz.com](https://coldtype.goodhertz.com)
"""
setuptools.setup(
name="coldtype",
version="0.6.6",
author="<NAME> / Goodhertz",
author_email="<EMAIL>",
description="Funct... | 1.617188 | 2 |
GFOLD_problem.py | xdedss/SuccessiveConvexification | 0 | 9770 | # -*- coding: utf-8 -*-
# GFOLD_static_p3p4
min_=min
from cvxpy import *
import cvxpy_codegen as cpg
from time import time
import numpy as np
import sys
import GFOLD_params
''' As defined in the paper...
PROBLEM 3: Minimum Landing Error (tf roughly solved)
MINIMIZE : norm of landing error vector
SUBJ TO :
... | 2.578125 | 3 |
Hints.py | SarienFates/MMRandomizer | 36 | 9771 | import io
import hashlib
import logging
import os
import struct
import random
from HintList import getHint, getHintGroup, Hint
from Utils import local_path
#builds out general hints based on location and whether an item is required or not
def buildGossipHints(world, rom):
stoneAddresses = [0x938e4c, 0... | 2.4375 | 2 |
examen_2/p2/p2.py | Jhoselyn-Carballo/computacion_para_ingenieria | 0 | 9772 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 17 09:10:05 2022
@author: JHOSS
"""
from tkinter import *
def contador(accion, contador):
if accion == 'countUp':
contador == contador + 1
elif accion == 'coundDown':
contador == contador -1
elif accion == 'reset':
contador == 0
return contador
| 3.375 | 3 |
bokeh/models/tests/test_callbacks.py | ndepal/bokeh | 1 | 9773 | <reponame>ndepal/bokeh
from pytest import raises
from bokeh.models import CustomJS, Slider
def test_js_callback():
slider = Slider()
cb = CustomJS(code="foo();", args=dict(x=slider))
assert 'foo()' in cb.code
assert cb.args['x'] is slider
cb = CustomJS(code="foo();", args=dict(x=3))
assert '... | 2.265625 | 2 |
tests/test_0150-attributeerrors.py | martindurant/awkward-1.0 | 0 | 9774 | # BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE
from __future__ import absolute_import
import sys
import pytest
import numpy
import awkward1
class Dummy(awkward1.Record):
@property
def broken(self):
raise AttributeError("I'm broken!")
def test():
behavi... | 1.976563 | 2 |
scripts/preprocess.py | umd-lib/solr-irroc | 0 | 9775 | #!/user/bin/env python3
# -*- coding: utf8 -*-
#===================================================#
# cleanup.py #
# <NAME> #
# 2015-08-13 #
# #
# Dat... | 2.578125 | 3 |
ievv_opensource/demo/batchframeworkdemo/apps.py | appressoas/ievv_opensource | 0 | 9776 | from django.apps import AppConfig
from ievv_opensource import ievv_batchframework
from ievv_opensource.ievv_batchframework import batchregistry
class HelloWorldAction(ievv_batchframework.Action):
def execute(self):
self.logger.info('Hello world! %r', self.kwargs)
class HelloWorldAsyncAction(ievv_batchf... | 2.015625 | 2 |
fmoe/gates/utils.py | GODVIX/fastmoe | 0 | 9777 | <filename>fmoe/gates/utils.py<gh_stars>0
r"""
Utilities that may be used in the gates
"""
import torch
from fmoe.functions import count_by_gate
import fmoe_cuda as fmoe_native
def limit_by_capacity(topk_idx, num_expert, world_size, capacity):
capacity = torch.ones(num_expert, dtype=torch.int32,
device... | 1.914063 | 2 |
evaluate.py | DeppMeng/DANNet | 0 | 9778 | <reponame>DeppMeng/DANNet<filename>evaluate.py
import os
import torch
import numpy as np
from PIL import Image
import torch.nn as nn
from torch.utils import data
from network import *
from dataset.zurich_night_dataset import zurich_night_DataSet
from configs.test_config import get_arguments
palette = [128, 64, 128,... | 2.109375 | 2 |
decorator.py | zengboming/python | 0 | 9779 | #decorator
def now():
print "2015-11-18"
f=now
f()
print now.__name__
print f.__name__
def log(func):
def wrapper(*args,**kw):
print 'begin call %s():' %func.__name__
func(*args,**kw)
print 'end call %s():' %func.__name__
return wrapper
@log
def now1():
print now1.__name__
now1()
now1=log(now1)
now1()
def... | 3.1875 | 3 |
test/pyfrechet_visualize.py | compgeomTU/frechetForCurves | 0 | 9780 | # Author: <NAME>
# <EMAIL>
#
# Command line to run program:
# python3 pyfrechet_visualize.py
import sys, os, unittest
sys.path.insert(0, "../")
from pyfrechet.distance import StrongDistance
from pyfrechet.visualize import FreeSpaceDiagram, Trajectories
TEST_DATA = "sp500"
if TEST_DATA == "sp500":
REACHABLE_EPSIL... | 2.609375 | 3 |
py_ser_freeastro/core.py | nww2007/py_ser_freeastro | 0 | 9781 | #!/usr/bin/env python3
# vim:fileencoding=UTF-8
# -*- coding: UTF-8 -*-
"""
Created on 15 juny 2019 y.
@author: <NAME> <EMAIL>
"""
import sys
import struct
import numpy as np
from progress.bar import Bar
import logging
logging.basicConfig(format = u'%(filename)s:%(lineno)d: %(levelname)-8s [%(asctime)s] %(message)s... | 2.578125 | 3 |
sgdml_dataset_generation/readers/fchk.py | humeniuka/sGDML_dataset_generation | 0 | 9782 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__ = ["FormattedCheckpointFile"]
# # Imports
import numpy as np
import scipy.linalg as sla
from collections import OrderedDict
import re
import logging
# # Local Imports
from sgdml_dataset_generation import units
from sgdml_dataset_generation.units import... | 2.90625 | 3 |
2020_01_01/max_values/max_values.py | 94JuHo/Algorithm_study | 0 | 9783 | values = []
for i in range(9):
values.append(int(input('')))
max_value = 0
location = 0
for i in range(9):
if values[i] > max_value:
max_value = values[i]
location = i+1
print(max_value)
print(location) | 3.78125 | 4 |
fuzzywuzzy/process.py | rhasspy/fuzzywuzzy | 3 | 9784 | #!/usr/bin/env python
# encoding: utf-8
"""
process.py
Copyright (c) 2011 <NAME>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to us... | 2.390625 | 2 |
day03/day03.py | robfalck/AoC2017 | 0 | 9785 | <gh_stars>0
from __future__ import print_function, division, absolute_import
import numpy as np
INPUT = 265149
def part1(number):
skip = 2
d = 1
row = None
col = None
for shell_idx in range(1, 10000):
size = shell_idx * 2 + 1
a = d + skip
b = a + skip
c = b + ski... | 2.578125 | 3 |
core/migrations/0004_auto_20210929_2354.py | codefair114/Inventory-App-Django | 0 | 9786 | <filename>core/migrations/0004_auto_20210929_2354.py
# Generated by Django 3.2.7 on 2021-09-29 23:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20210929_2353'),
]
operations = [
mi... | 1.382813 | 1 |
nova/api/openstack/compute/legacy_v2/contrib/console_auth_tokens.py | bopopescu/nova-token | 0 | 9787 | begin_unit
comment|'# Copyright 2013 Cloudbase Solutions Srl'
nl|'\n'
comment|'# All Rights Reserved.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'... | 1.242188 | 1 |
ahrs/common/geometry.py | jaluebbe/ahrs | 184 | 9788 | <filename>ahrs/common/geometry.py
# -*- coding: utf-8 -*-
"""
Geometrical functions
---------------------
References
----------
.. [W1] Wikipedia: https://de.wikipedia.org/wiki/Ellipse#Ellipsengleichung_(Parameterform)
.. [WAE] Wolfram Alpha: Ellipse. (http://mathworld.wolfram.com/Ellipse.html)
"""
import numpy as n... | 3.9375 | 4 |
htdocs/plotting/auto/scripts100/p116.py | jamayfieldjr/iem | 1 | 9789 | """Monthly HDD/CDD Totals."""
import datetime
from pandas.io.sql import read_sql
from pyiem.plot.use_agg import plt
from pyiem.util import get_dbconn, get_autoplot_context
from pyiem.exceptions import NoDataFound
PDICT = {'cdd': 'Cooling Degree Days',
'hdd': 'Heating Degree Days'}
def get_description():
... | 2.890625 | 3 |
examples/horovod/ray_torch_shuffle.py | krfricke/ray_shuffling_data_loader | 16 | 9790 | import os
import pickle
import time
import timeit
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import torch
import tempfile
import horovod.torch as hvd
from horovod.ray import RayExecutor
from ray_shuffling_data_loader.torch_dataset import (TorchShufflingDatase... | 2.28125 | 2 |
tests/test_main/test_base/tests.py | PitonX60/django-firebird | 51 | 9791 | <reponame>PitonX60/django-firebird
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from django.conf import settings
from django.db import connection, DatabaseError
from django.db.models import F, DateField, DateTimeField, IntegerField, TimeField, CASCADE
from django.db.models.fields.related import Fo... | 2.078125 | 2 |
tests/test_past_failures.py | justinbois/eqtk | 2 | 9792 | import pytest
import numpy as np
import eqtk
def test_promiscuous_binding_failure():
A = np.array(
[
[
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
1.0,
0.0,
... | 1.945313 | 2 |
sdk/python/pulumi_azure/lb/outbound_rule.py | suresh198526/pulumi-azure | 0 | 9793 | # 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilitie... | 1.539063 | 2 |
orbit_predictor/predictors/base.py | Juanlu001/orbit-predictor | 0 | 9794 | <gh_stars>0
# MIT License
#
# Copyright (c) 2017 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, ... | 1.75 | 2 |
vilmedic/scorers/NLG/__init__.py | jbdel/vilmedic | 15 | 9795 | <reponame>jbdel/vilmedic
from .rouge import ROUGEScorer
from .bleu.bleu import BLEUScorer
from .meteor.meteor import METEORScorer
from .cider.cider import Cider
from .ciderd.ciderd import CiderD
| 0.929688 | 1 |
tests/test_liif.py | Yshuo-Li/mmediting-test | 2 | 9796 | import numpy as np
import torch
import torch.nn as nn
from mmcv.runner import obj_from_dict
from mmcv.utils.config import Config
from mmedit.models import build_model
from mmedit.models.losses import L1Loss
from mmedit.models.registry import COMPONENTS
@COMPONENTS.register_module()
class BP(nn.Module):
"""A simp... | 2.109375 | 2 |
database/signals.py | ccraddock/beiwe-backend-cc | 0 | 9797 | <gh_stars>0
from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.signals import post_save, pre_save
from django.dispatch import receiver
from database.study_models import DeviceSettings, Study, Survey, SurveyArchive
@receiver(post_save, sender=Study)... | 2.203125 | 2 |
docs/examples/notify/notify_skeleton.py | Blakstar26/npyscreen | 0 | 9798 | import npyscreen
class NotifyBaseExample(npyscreen.Form):
def create(self):
key_of_choice = 'p'
what_to_display = 'Press {} for popup \n Press escape key to quit'.format(key_of_choice)
self.how_exited_handers[npyscreen.wgwidget.EXITED_ESCAPE] = self.exit_application
self.add(npysc... | 2.375 | 2 |
practicioner_bundle/ch15-neural_style/pyimagesearch/nn/conv/minigooglenet.py | romanroson/pis_code | 1 | 9799 | # -*- coding: utf-8 -*-
"""Implementation of MiniGoogLeNet architecture.
This implementation is based on the original implemetation of GoogLeNet.
The authors of the net used BN before Activation layer.
This should be switched.
"""
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutiona... | 3.5 | 4 |