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
company_logo.py
DomirScire/HackerRank_answers
1
23000
# DomirScire import math import os import random import re import sys import collections if __name__ == '__main__': s = sorted(input().strip()) s_counter = collections.Counter(s).most_common() s_counter = sorted(s_counter, key=lambda x: (x[1] * -1, x[0])) for i in range(0, 3): print(s_counter[i...
3.46875
3
ltr/models/loss/kl_regression.py
Jee-King/ICCV2021_Event_Frame_Tracking
15
23001
import math import torch import torch.nn as nn from torch.nn import functional as F class KLRegression(nn.Module): """KL-divergence loss for probabilistic regression. It is computed using Monte Carlo (MC) samples from an arbitrary distribution.""" def __init__(self, eps=0.0): super()._...
3
3
custom/mixins.py
luoyangC/django_template
0
23002
<reponame>luoyangC/django_template """ Basic building blocks for generic class based views. We don't bind behaviour to http method handlers yet, which allows mixin classes to be composed in interesting ways. """ from rest_framework import status from rest_framework import mixins from custom.response import JsonRespon...
2.46875
2
rl_trainer/algo/network.py
jidiai/Competition_Olympics-Curling
7
23003
<gh_stars>1-10 import torch.cuda import torch.nn as nn import torch.nn.functional as F device = 'cuda' if torch.cuda.is_available() else 'cpu' class Actor(nn.Module): def __init__(self, state_space, action_space, hidden_size=64): super(Actor, self).__init__() self.linear_in = nn.Linear(state_spa...
2.734375
3
digesters/hipchat/hipchat_notification_digester.py
paul-hammant/imapdigester
25
23004
# coding=utf-8 import arrow from bs4 import BeautifulSoup from digesters.base_digester import BaseDigester TEMPLATE = """<html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <title>Atlassian HipChat</title> </head> <body style="box-sizing: border-box; height: 100%; width: 100%;...
2.453125
2
FB2/__init__.py
Ae-Mc/FB2
3
23005
from .FictionBook2 import FictionBook2 from .Author import Author from .TitleInfo import TitleInfo from .DocumentInfo import DocumentInfo
1.195313
1
runserver.py
chintal/tendril-monitor-vendor
0
23006
<filename>runserver.py #!/usr/bin/env python # encoding: utf-8 # Copyright (C) 2015 <NAME> # Released under the MIT license. """ Simple Deployment Example ------------------------- """ from vendor_monitor import worker from twisted.internet import reactor import logging logging.basicConfig(level=logging.INFO) if...
1.34375
1
yt/frontends/ytdata/tests/test_unit.py
tukss/yt
1
23007
import os import shutil import tempfile import numpy as np from yt.loaders import load, load_uniform_grid from yt.testing import ( assert_array_equal, assert_fname, fake_random_ds, requires_file, requires_module, ) from yt.utilities.answer_testing.framework import data_dir_load from yt.visualizati...
2.28125
2
openmdao.lib/src/openmdao/lib/drivers/test/test_opt_genetic.py
mjfwest/OpenMDAO-Framework
69
23008
<gh_stars>10-100 """ Test the genetic optimizer driver """ import unittest import random from openmdao.main.datatypes.api import Float, Array, Enum, Int, Str from pyevolve import Selectors from openmdao.main.api import Assembly, Component, set_as_top, Driver from openmdao.lib.drivers.genetic import Genetic # pylin...
2.40625
2
src/db/ohlc_to_db.py
canl/algo-trading
11
23009
<reponame>canl/algo-trading import sqlite3 from datetime import datetime from sqlite3 import Error import pandas as pd from src.pricer import read_price_df DB_FILE_PATH = 'db.sqlite' def connect_to_db(db_file): """ Connect to an SQlite database, if db file does not exist it will be created :param db_file...
3.515625
4
morphs/data/localize.py
MarvinT/morphs
2
23010
<reponame>MarvinT/morphs import pandas as pd import numpy as np import morphs from six import exec_ from pathlib2 import Path from joblib import Parallel, delayed # adapted from klustakwik # NEVER POINT THIS AT SOMETHING YOU DONT TRUST def _read_python(path): assert path.exists() with open(path.as_posix(), "r...
2.125
2
app/cli/plugin/__init__.py
lonless0/flask_project
786
23011
<reponame>lonless0/flask_project<gh_stars>100-1000 from .generator import generate from .init import init
1.046875
1
labelocr/verify_ocr_app.py
tienthienhd/labelocr
2
23012
<reponame>tienthienhd/labelocr import atexit import glob import json import logging import os import shutil import sys import tkinter as tk import threading from tkinter import filedialog, messagebox import cv2 import numpy as np import pandas as pd import pygubu from PIL import Image, ImageTk from deprecated import d...
2.1875
2
cosmic-core/systemvm/patches/centos7/opt/cosmic/router/bin/cs/firewall.py
sanderv32/cosmic
64
23013
<reponame>sanderv32/cosmic<filename>cosmic-core/systemvm/patches/centos7/opt/cosmic/router/bin/cs/firewall.py<gh_stars>10-100 import logging from jinja2 import Environment, FileSystemLoader import utils class Firewall: def __init__(self, config): self.config = config self.jinja_env = Environme...
2.078125
2
MachineLearning/knn/knn.py
z8g/pettern
72
23014
<filename>MachineLearning/knn/knn.py # -*- coding: UTF-8 -*- import numpy import operator """ ================================================================================ kNN算法的步骤: 1. 计算已知类别数据集中的点与当前点之间的距离(欧式距离公式) 2. 按照距离递增次序排序 3. 选取与当前距离最小的k个点 4. 确定前k个点所在类别的出现频率 5. 返回前k个点出现频率最高的类别作为当前点的预测分类 =======================...
3.625
4
core/migrations/0012_alter_preco_categoria.py
thiagofreitascarneiro/Projeto_Fusion
0
23015
# Generated by Django 3.2.6 on 2021-09-05 19:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0011_auto_20210905_1619'), ] operations = [ migrations.AlterField( model_name='preco', name='categoria', ...
1.539063
2
Source/State/Main_Menu.py
LesterYHZ/Super-Mario-Bro-Python-Project
0
23016
<gh_stars>0 """ Main menu set up """ import pygame from .. import Setup from .. import Tools from .. import Constant as Con from ..Components import Info class MainMenu: def __init__(self): self.setup_background() self.setup_player() self.setup_cursor() self.info...
2.765625
3
user/models.py
ThePokerFaCcCe/teamwork
0
23017
<gh_stars>0 from django.utils.translation import gettext_lazy as _ from django.contrib.auth.models import AbstractUser from django.db import models from user.validators import UsernameValidator class User(AbstractUser): username = models.CharField( _("username"), max_length=36, unique=Tru...
2.46875
2
Advent2016/6.py
SSteve/AdventOfCode
0
23018
<reponame>SSteve/AdventOfCode<gh_stars>0 from collections import Counter TEST = """eedadn drvtee eandsr raavrd atevrs tsrnev sdttsa rasrtv nssdts ntnada svetve tesnvt vntsnd vrdear dvrsen enarar""" def decode(lines: list[str], wantLeast=False): result = '' for i in range(len(lines[0])): count = Count...
3.078125
3
profile_api/views.py
csalaman/profiles-rest-api
0
23019
<filename>profile_api/views.py # DRF Views types (APIView & ViewSet) # APIViews allows to write standard HTTP Methods as functions & give most control over the logic # Benefits: Perfect for implementing complex logic, calling other APIs, working with local files # Viewsets -> uses model operations for functions kist, ...
2.6875
3
examples/panflute/myemph.py
jacobwhall/panflute
361
23020
#!/usr/bin/env python import panflute as pf """ Pandoc filter that causes emphasis to be rendered using the custom macro '\myemph{...}' rather than '\emph{...}' in latex. Other output formats are unaffected. """ def latex(s): return pf.RawInline(s, format='latex') def myemph(e, doc): if type(e)==pf.Emph a...
2.390625
2
src/financial_statements/old/balance_sheet.py
LeanderLXZ/intelligent-analysis-of-financial-statements
0
23021
<filename>src/financial_statements/old/balance_sheet.py import time import threading import argparse import tushare as ts import numpy as np import pandas as pd from pandas import datetime as dt from tqdm import tqdm from utils import * with open('../../tushare_token.txt', 'r') as f: token = f.readline() ts.set_t...
2.046875
2
examples/wsgi/test.py
gelnior/couchdbkit
51
23022
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2008,2009 <NAME> <<EMAIL>> # # 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...
2.484375
2
src/comments/api/views/DetailAPIView.py
samrika25/TRAVIS_HEROKU_GIT
0
23023
<filename>src/comments/api/views/DetailAPIView.py from django.views import View from comments.models import Comment from django.http import JsonResponse from utils.decorators import fail_safe_api from utils.models import nested_model_to_dict from utils.request import parse_body, set_user from django.contrib.contenttype...
2.265625
2
src/router.py
mix2zeta/social-d
0
23024
<reponame>mix2zeta/social-d from aiohttp import web import urllib.parse from conf import settings ROUTER = { "poke_task": { "url": "/poke", "GET": "request_handle.poke_task", "POST": "request_handle.poke_task", }, "task": { "url": "/task/{task_id}", "GET": "request_h...
2.3125
2
golly_python/manager.py
golly-splorts/golly-python
0
23025
import json from .life import BinaryLife class GOL(object): team_names: list = [] columns = 0 rows = 0 def __init__(self, **kwargs): self.load_config(**kwargs) self.create_life() def __repr__(self): s = [] s.append("+" + "-" * (self.columns) + "+") for i i...
2.859375
3
surge_multiplier_mdp/__init__.py
mbattifarano/surge-multiplier-mdp
0
23026
from .mdp_value_iteration import value_iteration
1.046875
1
DiplomaProject/office/admin.py
iamgo100/diploma
0
23027
<reponame>iamgo100/diploma<gh_stars>0 from django.contrib import admin from .models import Shift, Service, Appointment class ShiftAdmin(admin.ModelAdmin): fields = ['date', 'master', 'room'] list_display = ('date', 'master', 'status') class ServicetAdmin(admin.ModelAdmin): list_display = ('service...
1.71875
2
util/query_jmx.py
perfsonar/esmond
3
23028
<gh_stars>1-10 #!/usr/bin/env python3 """ Code to issue calls to the cassandra MX4J http server and get stats. """ import os import sys from optparse import OptionParser from esmond.api.client.jmx import CassandraJMX def main(): usage = '%prog [ -U ]' parser = OptionParser(usage=usage) parser.add_option...
2.375
2
apps/accounts/management/commands/amend_hostingproviders_stats.py
BR0kEN-/admin-portal
0
23029
from django.core.management.base import BaseCommand from django.db import connection class Command(BaseCommand): help = "Add missing id column for hostingstats." def handle(self, *args, **options): with connection.cursor() as cursor: self.cursor = cursor self.cursor.execute( ...
1.984375
2
src/brain_atlas/diff_exp.py
MacoskoLab/brain-atlas
2
23030
import numba as nb import numpy as np import scipy.stats @nb.njit(parallel=True) def tiecorrect(rankvals): """ parallelized version of scipy.stats.tiecorrect :param rankvals: p x n array of ranked data (output of rankdata function) """ tc = np.ones(rankvals.shape[1], dtype=np.float64) for j i...
2.71875
3
piece.py
brouxco/quarto-solver
0
23031
class Piece(object): def __init__(self, is_tall: bool = True, is_dark: bool = True, is_square: bool = True, is_solid: bool = True, string: str = None): if string: self.is_tall = (string[0] == "1") se...
3.484375
3
tests/test_build_docs.py
simon-ritchie/action-py-script
0
23032
<reponame>simon-ritchie/action-py-script import hashlib import os import shutil from random import randint from typing import List from retrying import retry import build_docs from apysc._file import file_util from build_docs import _CodeBlock from build_docs import _CodeBlockFlake8Error from build_docs i...
2.03125
2
Generator/views.py
SmilingTornado/sfia_generator
2
23033
<reponame>SmilingTornado/sfia_generator # Create your views here. import docx import gensim import numpy as np from django.conf import settings from django.http import HttpResponse from django.shortcuts import render from docx.shared import RGBColor, Inches, Pt from nltk.tokenize import sent_tokenize, word_tokenize fr...
2.65625
3
flask_pancake/extension.py
arthurio/flask-pancake
4
23034
<gh_stars>1-10 from __future__ import annotations import abc from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Type, Union from cached_property import cached_property from .constants import EXTENSION_NAME from .registry import registry from .utils import GroupFuncType, import_from_string, load_c...
2.125
2
tests/pygithub/test_targettag.py
ktlim/sqre-codekit
0
23035
#!/usr/bin/env python3 import codekit.pygithub import github import itertools import pytest @pytest.fixture def git_author(): return github.InputGitAuthor(name='foo', email='<EMAIL>') def test_init(git_author): """Test TargetTag object instantiation""" t_tag = codekit.pygithub.TargetTag( name=...
2.4375
2
src/test/model/test_node.py
AstrorEnales/GenCoNet
2
23036
<gh_stars>1-10 import unittest from model import node class DummyNode(node.Node): def __init__(self, ids: [str], names: [str]): super().__init__(ids, names) self.primary_id_prefix = 'TEST' class TestMethods(unittest.TestCase): def test_label(self): n = DummyNode([], []) self....
3.0625
3
2020/Python/day06.py
kamoshi/Advent-of-Code
1
23037
import functools def parse_input() -> list[list[str]]: groups = [[]] with open("input.txt") as file: for line in file: line_ = line.rstrip() if len(line_) > 0: groups[-1].append(line_) else: if not groups[-1] == []: ...
3.59375
4
src/python/grpcio_tests/tests/interop/_intraop_test_case.py
txl0591/grpc
117
23038
<reponame>txl0591/grpc<filename>src/python/grpcio_tests/tests/interop/_intraop_test_case.py # Copyright 2015 gRPC authors. # # 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.a...
2.015625
2
scripts/add_vf_ids.py
rajbot/vaccinebot
2
23039
<filename>scripts/add_vf_ids.py #!/usr/bin/env python from airtable import Airtable import csv import os for var in ["AIRTABLE_API_KEY", "AIRTABLE_BASE_ID"]: if os.environ.get(var) is None: sys.exit(f"Must set {var} env var!") api_key = os.environ.get("AIRTABLE_API_KEY") base_id = os.environ.get("AIRTABL...
2.546875
3
pubmedpy/__init__.py
dhimmel/pubmedpy
7
23040
""" # Utilities for interacting with NCBI EUtilities relating to PubMed """ __version__ = "0.0.1"
0.542969
1
config/logging.py
qgerome/openhexa-app
4
23041
<reponame>qgerome/openhexa-app import json import sys import traceback from logging import Handler # Specific logging module for GCP, use json to serialize output -> work better for GKE # Can be used for further customization class GCPHandler(Handler): def emit(self, record): try: message = s...
2.375
2
sublimeText3/Packages/SublimeCodeIntel/libs/codeintel2/tdparser.py
MoAnsir/dot_file_2017
2
23042
<reponame>MoAnsir/dot_file_2017<gh_stars>1-10 """ A simple Top-Down Python expression parser. This parser is based on the "Simple Top-Down Parsing in Python" article by <NAME> (http://effbot.org/zone/simple-top-down-parsing.htm) These materials could be useful for understanding ideas behind the Top-Down approach: *...
3.328125
3
atcoder/abc/abc002_d.py
knuu/competitive-programming
1
23043
from copy import deepcopy N, M = map(int, input().split()) E = [[] for _ in range(N)] for i in range(M): x, y = map(lambda x:int(x)-1, input().split()) E[x].append(y) E[y].append(x) ans = 0 for mask in range(2**N): faction = '' for x in range(N): faction += '1' if mask&(1<<x) else '0' fl...
2.65625
3
advisor/api/urls.py
Sachin-c/api-test
0
23044
<filename>advisor/api/urls.py<gh_stars>0 from django.urls import path from advisor.api.views import ( # api_advisor_view, api_advisor_view_post, ) app_name = 'advisor' urlpatterns = [ path('admin/advisor/', api_advisor_view_post, name="post"), # path('user/<int:id>/advisor/', api_advisor_view, name="d...
1.71875
2
src/utils/config.py
mlrepa/automate-ml-with-dvc
4
23045
import box from typing import Text import yaml def load_config(config_path: Text) -> box.ConfigBox: """Loads yaml config in instance of box.ConfigBox. Args: config_path {Text}: path to config Returns: box.ConfigBox """ with open(config_path) as config_file: config = yaml....
2.921875
3
python/methylnet/visualizations.py
hossein20s/dnaMethylation
26
23046
<gh_stars>10-100 import pandas as pd import numpy as np import networkx as nx import click import pickle from sklearn.preprocessing import LabelEncoder CONTEXT_SETTINGS = dict(help_option_names=['-h','--help'], max_content_width=90) @click.group(context_settings= CONTEXT_SETTINGS) @click.version_option(version='0.1')...
2.609375
3
tests/test_sagemaker/test_sagemaker_processing.py
gtourkas/moto
5,460
23047
import boto3 from botocore.exceptions import ClientError import datetime import pytest from moto import mock_sagemaker from moto.sts.models import ACCOUNT_ID FAKE_ROLE_ARN = "arn:aws:iam::{}:role/FakeRole".format(ACCOUNT_ID) TEST_REGION_NAME = "us-east-1" class MyProcessingJobModel(object): def __init__( ...
1.71875
2
tools/sprite-editor/gui/direction_sprite_widget.py
jordsti/stigame
8
23048
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'direction_sprite_widget.ui' # # Created: Wed Jul 30 18:37:40 2014 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUt...
1.921875
2
venv/lib/python3.5/site-packages/bears/python/PEP8NotebookBear.py
prashant0598/CoffeeApp
0
23049
<gh_stars>0 import autopep8 import nbformat from coalib.bearlib.spacing.SpacingHelper import SpacingHelper from coalib.bears.LocalBear import LocalBear from dependency_management.requirements.PipRequirement import PipRequirement from coalib.results.Diff import Diff from coalib.results.Result import Result from coalib....
2.375
2
doc2cube-master/src/prel.py
sustcjudgement/Judgement_information_extraction
1
23050
import nltk import string import argparse parser = argparse.ArgumentParser(description='.') parser.add_argument('-text', help='') parser.add_argument('-meta', help='') parser.add_argument('-output', help='') args = parser.parse_args() # parser.add_argument('-iter', dest='iter', type=int, # defaul...
2.796875
3
models/__init__.py
salesforce/DataHardness
3
23051
from models.glow import Glow, GlowAdditive
1.023438
1
Logic/Helpers/ChronosTextEntry.py
terexdev/BSDS-V39
11
23052
<filename>Logic/Helpers/ChronosTextEntry.py<gh_stars>10-100 from Logic.Classes.LogicDataTables import LogicDataTables from Logic.Data.DataManager import Writer from Logic.Data.DataManager import Reader class ChronosTextEntry: def decode(self: Reader): self.readInt() self.readString() def enco...
2.140625
2
Hoofdstuk 3/animals.py
BearWithAFez/Learning-Python
0
23053
<filename>Hoofdstuk 3/animals.py<gh_stars>0 #!/usr/bin/env python3 from urllib.request import urlopen import sys # Get the animals def fetch_animals(url): """Get a list of lines (animals) from a given URL. Args: url: The URL of a utf-8 text Returns: A list of lines. """ with urlo...
3.890625
4
code/game.py
chaonan99/merge_sim
0
23054
from collections import deque import numpy as np import os from abc import ABCMeta, abstractmethod import random random.seed(42) from common import config, VehicleState from helper import Helper INFO = """Average merging time: {} s Traffic flow: {} vehicle/s Average speed: {} km/h Average fuel consumptio...
3.125
3
mundo2/ex053.py
dilsonm/CeV
0
23055
<filename>mundo2/ex053.py # Crie um programa que leia uma frase qualquer e diga se ele é um palíndromo, desconsiderando os espaços. frase = str(input('Digite uma frase: ')).strip() palavras = frase.split() junto = ''.join(palavras) inverso = '' for c in range( len(junto)-1, -1, -1): inverso += junto[c] if inverso ...
3.90625
4
scripts/show_by_content_type.py
b-cube/Response-Identification-Info
0
23056
<reponame>b-cube/Response-Identification-Info import os import glob import json for f in glob.glob('/Users/sparky/Documents/solr_responses/solr_20150922_docs/*.json'): with open(f, 'r') as g: data = json.loads(g.read()) headers = data.get('response_headers', []) if not headers: continue ...
2.59375
3
descarteslabs/workflows/models/tests/test_tile_url.py
descarteslabs/descarteslabs-python
167
23057
import pytest import datetime import json import functools from urllib.parse import urlencode, parse_qs from descarteslabs.common.graft import client as graft_client from ... import types from .. import tile_url def test_url(): base = "foo" base_q = base + "?" url = functools.partial(tile_url.tile_url...
2.375
2
backend-project/small_eod/collections/migrations/0003_auto_20200131_2033.py
WlodzimierzKorza/small_eod
64
23058
# Generated by Django 3.0.2 on 2020-01-31 20:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('collections', '0002_auto_20200109_1348'), ] operations = [ migrations.AlterField( model_name='collection', name='com...
1.703125
2
violet_services/src/service_client.py
Violet-C/EE477_Final
0
23059
<reponame>Violet-C/EE477_Final<filename>violet_services/src/service_client.py #!/usr/bin/env python import rospy # python client library for ROS from violet_services.srv import WordCount # needed message type import sys # python functions, metho...
2.421875
2
utils/util.py
Hhhhhhhhhhao/I2T2I
0
23060
# -*- coding: utf-8 -*- import os import torch from torch.autograd import Variable import numpy as np import scipy import matplotlib.pyplot as plt import cv2 import scipy.ndimage import shutil import scipy.misc as misc from PIL import Image def mkdirs(folders, erase=False): if type(folders) is not list: ...
2.359375
2
hn2pdf.py
KyrillosL/HackerNewsToPDF
0
23061
<filename>hn2pdf.py #!/usr/bin/env python """Python-Pinboard Python script for downloading your saved stories and saved comments on Hacker News. """ __version__ = "1.1" __license__ = "BSD" __copyright__ = "Copyright 2013-2014, <NAME>" __author__ = "<NAME> <http://fiandes.io/> & <NAME> <http://jdpressman.com>" import ...
3.3125
3
backend/step_functions/default.py
barak-obama/Game-Of-Life
0
23062
import itertools def next_step(board, i, j): xMin = max(0, j - 1) xMax = min(board.shape[1] - 1, j +1) yMin = max(0, i - 1) yMax = min(board.shape[0] - 1, i +1) iteration = list(itertools.product(range(yMin, yMax + 1), range(xMin, xMax+1))) iteration.remove((i,j)) sum = 0; for (k, m) i...
3.828125
4
rapid_response_xblock/models.py
HamzaIbnFarooq/rapid-response-xblock
0
23063
<reponame>HamzaIbnFarooq/rapid-response-xblock """ Rapid Response block models """ from django.conf import settings from django.db import models from django.utils.encoding import python_2_unicode_compatible from jsonfield import JSONField from model_utils.models import TimeStampedModel from opaque_keys.edx.django.mod...
2.171875
2
sched_slack_bot/reminder/sender.py
Germandrummer92/SchedSlackBot
0
23064
<gh_stars>0 import abc from sched_slack_bot.model.reminder import Reminder class ReminderSender(abc.ABC): @abc.abstractmethod def send_reminder(self, reminder: Reminder) -> None: raise NotImplementedError("Not Implemented") @abc.abstractmethod def send_skip_message(self, reminder: Reminder)...
2.546875
3
app/routes.py
systemicsmitty/TI4_battle_sim
0
23065
from flask import render_template from app import app, html_generator import app.calculator.calculator as calc from app.route_helpers import units_from_form, options_from_form, options_list, flash_errors from app.forms import InputForm from collections import defaultdict @app.route('/', methods=['GET', 'POST']) @app....
2.53125
3
code/dependancy/smaliparser.py
OmkarMozar/CUPAP
0
23066
from smalisca.core.smalisca_main import SmaliscaApp from smalisca.modules.module_smali_parser import SmaliParser from smalisca.core.smalisca_app import App from smalisca.core.smalisca_logging import log from smalisca.modules.module_sql_models import AppSQLModel import smalisca.core.smalisca_config as config import mul...
1.960938
2
modules/users_and_roles_tab.py
scrummastermind/sumologictoolbox
0
23067
<gh_stars>0 class_name = 'users_and_roles_tab' from qtpy import QtCore, QtGui, QtWidgets, uic import os import sys import re import pathlib import json from logzero import logger from modules.sumologic import SumoLogic from modules.shared import ShowTextDialog class users_and_roles_tab(QtWidgets.QWidget): def _...
2.078125
2
app.py
kecleveland/mhdn_app
0
23068
<reponame>kecleveland/mhdn_app from twarc import Twarc2, expansions from pathlib import Path import json import config import os import config appConfig = config.Config client = Twarc2(bearer_token=appConfig.bearer_token) file_path = Path(f"{appConfig.file_path}{appConfig.file_name}") def main(): # result params...
2.546875
3
src/utils/regex_utils/regex_utils.py
BichengWang/python-notebook
0
23069
import re def find_indices(): return [m.start(0) for m in re.finditer(reg, content)] def find_content(): return re.findall(reg, content) if __name__ == "__main__": content = 'an example word:cat and word:dog' reg = r'word:\w' print(find_indices()) print(find_content())
3.34375
3
tests/test_trainer/test_pipeline/test_p2p.py
DevinCheung/ColossalAI
0
23070
<filename>tests/test_trainer/test_pipeline/test_p2p.py #!/usr/bin/env python # -*- encoding: utf-8 -*- import pytest import torch import torch.distributed as dist import torch.multiprocessing as mp from colossalai.communication import (recv_backward, recv_forward, recv_tensor_met...
2.046875
2
mine.py
appenz/minebot
11
23071
<gh_stars>10-100 # # Functions for mining blocks # import itertools from javascript import require Vec3 = require('vec3').Vec3 from botlib import * from inventory import * from workarea import * class MineBot: needs_iron_pickaxe = ["Gold Ore", "Redstone Ore", "Diamond Ore", "Emerald Ore"] needs_diamond...
3.078125
3
src/the_tale/the_tale/accounts/tests/test_account_prototype.py
devapromix/the-tale
1
23072
import smart_imports smart_imports.all() class AccountPrototypeTests(utils_testcase.TestCase, personal_messages_helpers.Mixin): def setUp(self): super(AccountPrototypeTests, self).setUp() self.place_1, self.place_2, self.place_3 = game_logic.create_test_map() self.account = self.account...
2.03125
2
952/952.py
vladcto/ACMP_Answers
1
23073
inp = input().split(" ") adult = int(inp[0]) child = int(inp[1]) if adult == 0 and child == 0: print("0 0") quit() if adult == 0: print("Impossible") quit() min = 0 # К каждому взрослому один бесплатный ребенок => # "Платные дети" это разница между взрослыми и всеми детьми not_free_child = child - ad...
3.609375
4
tests/django/__init__.py
estudio89/maestro-python
0
23074
default_app_config = "tests.django.apps.MyAppConfig"
1
1
setup.py
eric-volz/defichainLibrary
1
23075
<filename>setup.py from setuptools import setup from os import path VERSION = '1.0.0' DESCRIPTION = 'Defichain Python Library' # Project URLs project_urls = { "Tracker": "https://github.com/eric-volz/DefichainPython", "Documentation": "https://docs.defichain-python.de" } this_directory = path.abspath(path.di...
1.734375
2
test/test_hdf5.py
gonzalobg/hpc-container-maker
1
23076
<filename>test/test_hdf5.py # Copyright (c) 2018, 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
2.140625
2
exercise/newfile45.py
LeeBeral/python
0
23077
<filename>exercise/newfile45.py<gh_stars>0 show databases; show tables desc table名 use database名 delete from 库名.表名 where id=5; select * from 表名 where id=5; update 表名 set age=15,home='北京' where id=5
1.710938
2
src/word2vec.py
shiroyagicorp/japanese-word2vec-model-builder
98
23078
<reponame>shiroyagicorp/japanese-word2vec-model-builder<gh_stars>10-100 import multiprocessing from gensim.models.word2vec import Word2Vec def build_gensim_w2v_model(model_path, iter_tokens, size, window, min_count): """ Parameters ---------- model_path : string Path of Word2Vec model ite...
2.625
3
companion/telegram.py
jouir/mining-companion
2
23079
<filename>companion/telegram.py import logging import os from copy import copy import requests from jinja2 import Environment, FileSystemLoader logger = logging.getLogger(__name__) absolute_path = os.path.split(os.path.abspath(__file__))[0] class TelegramNotifier: def __init__(self, chat_id, auth_key): ...
2.4375
2
forecast_lab/metrics.py
gsimbr/forecast-lab
5
23080
<reponame>gsimbr/forecast-lab import numpy import math from sklearn.metrics import mean_squared_error def root_mean_squared_error(y_true, y_pred): return math.sqrt(mean_squared_error(y_true, y_pred)) def mean_absolute_percentage_error(y_true, y_pred): return numpy.mean(numpy.abs((y_true - y_pred) / y_true)) *...
2.375
2
Python_Interview/Algorithm/step_wise.py
QAlexBall/Learning_Py
2
23081
<gh_stars>1-10 ''' 杨氏矩阵查找 在一个m行n列二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下 递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 ''' def get_value(l, r, c): return l[r][c] def find(l, x): m = len(l) - 1 n = len(l[0]) - 1 r = 0 c = n while c >= 0 and r <= m: value = get_value(l, r, c) if valu...
3.328125
3
run_create_codebuild_default.py
HardBoiledSmith/johanna
64
23082
#!/usr/bin/env python3 import json import time from run_common import AWSCli from run_common import print_message from run_create_codebuild_common import create_base_iam_policy from run_create_codebuild_common import create_iam_service_role from run_create_codebuild_common import create_managed_secret_iam_policy from ...
1.648438
2
config/test.py
nahidupa/grr
1
23083
<filename>config/test.py #!/usr/bin/env python """Configuration parameters for the test subsystem.""" import os from grr.lib import config_lib # Default for running in the current directory config_lib.DEFINE_constant_string( "Test.srcdir", os.path.normpath(os.path.dirname(__file__) + "/../.."), "The direct...
2.390625
2
wixaward/urls.py
LekamCharity/wix-projects
0
23084
<reponame>LekamCharity/wix-projects from django.urls import path urlpatterns=[ path('profile',views.profile, name='profile'), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
1.695313
2
pylogview/reader.py
CrazyIvan359/logview
0
23085
import typing as t from pylogview import datefinder from pylogview.record import LogRecord if t.TYPE_CHECKING: from pylogview.window import Window class LogReader: __slots__ = [ "_window", "filename", "_lines", "records", "_record_prefix_length", "_fd", ...
2.796875
3
zad1_6.py
kamilhabrych/python-semestr5-lista1
0
23086
<reponame>kamilhabrych/python-semestr5-lista1 x = int(input('Podaj pierwsza liczbe calkowita: ')) y = int(input('Podaj druga liczbe calkowita: ')) z = int(input('Podaj trzecia liczbe calkowita: ')) print() if x > 10: print(x) if y > 10: print(y) if z > 10: print(z)
3.515625
4
modules/bulletinGenerator_Kingsgrove.py
featherbear/swec-elvanto-automation
0
23087
from mailmerge import MailMerge import re import os.path from ElvantoAPIExtensions import Enums, Helpers from modules.__stub__ import ModuleStub class Module(ModuleStub): __VERSION__ = "1.0" __NAME__ = "bulletinGenerator_Kingsgrove" # __executeTime__ = "16:00" # __executeDay__ = "thursday" setting...
2.328125
2
class4/e3_pexpect.py
ktbyers/pynet_wantonik
2
23088
#!/usr/bin/env python ''' Simple script to execute shell command on lab router with Pexpect module. ''' import pexpect, sys, re from getpass import getpass def main(): ## Define variables ip_addr = '172.16.31.10' username = 'pyclass' port = 22 password = getpass() ## Set up connection with rou...
2.75
3
codewof/tests/utils/errors/test_MissingRequiredFieldError.py
uccser-admin/programming-practice-prototype
3
23089
<reponame>uccser-admin/programming-practice-prototype """Test class for MissingRequiredFieldError error.""" from django.test import SimpleTestCase from utils.errors.MissingRequiredFieldError import MissingRequiredFieldError class MissingRequiredFieldErrorTest(SimpleTestCase): """Test class for MissingRequiredFie...
3.53125
4
matmih/plot.py
glypher/pokemons
0
23090
"""plot.py: Utility builder class for ML plots. Uses scikit-learn code samples and framework """ __author__ = "<NAME>" __license__ = "BSD" __email__ = "<EMAIL>" import numpy as np import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import randomcolor import math from sklearn.me...
2.625
3
census_data_downloader/tables/medianage.py
JoeGermuska/census-data-downloader
170
23091
#! /usr/bin/env python # -*- coding: utf-8 -* import collections from census_data_downloader.core.tables import BaseTableConfig from census_data_downloader.core.decorators import register @register class MedianAgeDownloader(BaseTableConfig): PROCESSED_TABLE_NAME = 'medianage' UNIVERSE = "total population" ...
1.9375
2
powerfulseal/metriccollectors/prometheus_collector.py
snehalbiche/powerfulseal
1
23092
# Copyright 2018 Bloomberg Finance L.P. # # 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 i...
1.859375
2
icm/__main__.py
MCasari-PMEL/EDD-ICMGUI
0
23093
<reponame>MCasari-PMEL/EDD-ICMGUI #!/usr/bin/env python # -*- coding: utf-8 -*- import sys, os, time, serial, json import numpy as np import pyqtgraph as pg import pyqtgraph.console from PyQt5.QtCore import pyqtSignal, QObject from pyqtgraph.Qt import QtCore, QtGui from pyqtgraph.dockarea import * from icm.ui_cloc...
2.21875
2
tests/unit/plugins/widgets/conftest.py
pauleveritt/kaybee
2
23094
import dectate import pytest from kaybee.plugins.widgets.directive import WidgetDirective from kaybee.plugins.widgets.action import WidgetAction class Dummy: pass @pytest.fixture() def widgets_kb_app(): class widgets_kb_app(dectate.App): widget = dectate.directive(WidgetAction) yield widgets_k...
1.726563
2
eeyore/models/model.py
papamarkou/eeyore
6
23095
import hashlib import torch import torch.nn as nn class Model(nn.Module): """ Class representing sampleable neural network model """ def __init__(self, dtype=torch.float64, device='cpu'): super().__init__() self.dtype = dtype self.device = device def summary(self, hashsummary=False...
2.765625
3
Curso/Challenges/URI/1827SquareArrayIV.py
DavidBitner/Aprendizado-Python
0
23096
<reponame>DavidBitner/Aprendizado-Python while True: try: dados = [] matriz = [] n = int(input()) for linha in range(0, n): for coluna in range(0, n): dados.append(0) matriz.append(dados[:]) dados.clear() # Numeros na diagon...
3.84375
4
HetSANN_MRV/execute_sparse.py
xhhszc/hetsann
116
23097
import os import time import random import scipy.sparse as sp import numpy as np import tensorflow as tf import argparse from models import SpHGAT from utils import process parser = argparse.ArgumentParser() parser.add_argument('--dataset', help='Dataset.', default='imdb', type=str) parser.add_argument('--epochs', he...
2.125
2
pythontutor-ru/02_ifelse/01_minimum.py
ornichola/learning-new
2
23098
<filename>pythontutor-ru/02_ifelse/01_minimum.py ''' http://pythontutor.ru/lessons/ifelse/problems/minimum/ Даны два целых числа. Выведите значение наименьшего из них. ''' val_01 = int(input()) val_02 = int(input()) if val_01 > val_02: print(val_02) else: print(val_01)
3.625
4
src/ui/license.py
Schrut/PRT
2
23099
from PyQt5.QtWidgets import QWidget, QMessageBox class uiLicenseWindow(QMessageBox): """ The MIT License (MIT) https://mit-license.org/ """ def __init__(self, parent: QWidget): super().__init__(parent) self.parent = parent self.title = "The MIT License (MIT)" #Hardcoded License self.license = "<pre><b>...
2.25
2