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
claf/learn/tensorboard.py
GMDennis/claf
225
52200
<gh_stars>100-1000 import os from tensorboardX import SummaryWriter from claf import nsml class TensorBoard: """ TensorBoard Wrapper for Pytorch """ def __init__(self, log_dir): if not os.path.exists(log_dir): os.makedirs(log_dir) self.writer = SummaryWriter(log_dir=log_dir) ...
2.421875
2
code/test.py
Rise-group/masonry_diaphragm_prediction
1
52201
<reponame>Rise-group/masonry_diaphragm_prediction<filename>code/test.py import configparser import os from glob import glob import keras_metrics as km import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import tensorflow as tf from keras import Model from keras import backend ...
2.015625
2
nadlogar/students/context_processors.py
LenartBucar/nadlogar
0
52202
<reponame>LenartBucar/nadlogar<gh_stars>0 from .models import StudentGroup def my_groups(request): if request.user.is_authenticated: return { "my_groups": StudentGroup.objects.filter(user=request.user), } else: return {}
2.140625
2
core/src/zeit/magazin/sources.py
rickdg/vivi
5
52203
<gh_stars>1-10 import zeit.cms.content.sources class ArticleRelatedLayoutSource(zeit.cms.content.sources.XMLSource): product_configuration = 'zeit.magazin' config_url = 'article-related-layout-source' default_filename = 'article-related-layouts.xml' attribute = 'id'
1.273438
1
telegram_bot/chat.py
nichmorgan/iCalvin
0
52204
from IA.model import model from telegram.ext import Updater, CommandHandler, MessageHandler, Filters import logging import json TOKEN = json.load(open('telegram_bot/token.json'))['token'] updater = Updater(token=TOKEN, use_context=True) dispatcher = updater.dispatcher logging.basicConfig(format='%(asctime)s - %(name...
2.15625
2
matrixprofile/algorithms/regimes.py
MORE-EU/matrixprofile
262
52205
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals range = getattr(__builtins__, 'xrange', range) # end of py2 compatability boilerplate import numpy as np...
2.40625
2
202-happy-number/202-happy-number.py
jenndryden/coding-challenges
0
52206
class Solution: def isHappy(self, n: int) -> bool: seen = {} while True: if n in seen: break counter = 0 for i in range(len(str(n))): counter += int(str(n)[i]) ** 2 seen[n] = 1 n = counter counte...
3.09375
3
Table.py
JonLinC07/Poker
0
52207
from Dealer import Dealer from Player import Player from Card import Card class Table: def __init__(self, players, board=[], pot=0): self.players = players self.board = board self.pot = pot # def table_status(self):
2.703125
3
lightautoml/validation/gpu/gpu_iterators.py
Rishat-skoltech/LightAutoML_GPU
2
52208
"""Tabular iterators.""" from typing import Optional from typing import Tuple from typing import Union from typing import cast import cupy as cp from lightautoml.dataset.gpu.gpu_dataset import CupyDataset from lightautoml.dataset.gpu.gpu_dataset import CudfDataset from lightautoml.dataset.gpu.gpu_dataset import Dask...
2.53125
3
Scripts/MembraneValidation.py
krm15/ACME
4
52209
<filename>Scripts/MembraneValidation.py<gh_stars>1-10 #!/usr/bin/python # Filename : var.py import sys, os # Default arguments current = os.getcwd() # Define executable Preprocess = "/home/krm15/bin/GITROOT/ACME/bin/membraneSegmentationEvaluation" MembranePreprocess = "~/GITROOT/ACME/Data/Test/Input/Preprocess/10.mh...
2.21875
2
arcade_solutions/the_core/christmas_tree.py
nickaigi/automatic-dollop
0
52210
def christmas_tree(n, h): tree = ['*', '*', '***'] start = '*****' for i in range(n): tree.append(start) for j in range(1, h): tree.append('*' * (len(tree[-1]) + 2)) start += '**' foot = '*' * h if h % 2 == 1 else '*' * h + '*' tree += [foot for i in range(n)] ...
4
4
maskrcnn_benchmark/modeling/roi_heads/cost_volum_v11_head/submodule.py
pwllr/IDA-3D
78
52211
<filename>maskrcnn_benchmark/modeling/roi_heads/cost_volum_v11_head/submodule.py<gh_stars>10-100 from __future__ import print_function import torch import torch.nn as nn import torch.utils.data from torch.autograd import Variable import torch.nn.functional as F import math import numpy as np def convbn(in_planes, out_...
2.078125
2
setup.py
tomprimozic/scribe-python
0
52212
<reponame>tomprimozic/scribe-python ''' Scribe client ============= This is a Python client for scribe that can be installed using pip:: pip install facebook-scribe Usage ----- Connect to ``HOST:9999`` using *Thrift*:: from scribe import scribe from thrift.transport import TTransport, TSocket from...
2.203125
2
nortok/tokenizers.py
Froskekongen/nortok
0
52213
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from nltk.tokenize import TweetTokenizer from nltk.stem.snowball import SnowballStemmer import numpy as np from collections import defaultdict,Counter import logging as logger from nortok.stopwords import get_norwegian_stopwords import pickle import gzip def dd_def(): ...
2.78125
3
saleor/account/templatetags/account_utils.py
TropicalBastos/saleor-courses
4
52214
from django import template from django.utils.translation import pgettext from django.templatetags.static import static from django.template.defaultfilters import safe, truncatechars register = template.Library() @register.filter() def safe_truncate(string, arg): return truncatechars(safe(string), arg)
1.640625
2
tests/ocean.py
jsasaki-utokyo/pyfvcom
52
52215
import numpy.testing as test import numpy as np from unittest import TestCase from PyFVCOM.ocean import * class OceanToolsTest(TestCase): def setUp(self): """ Make a set of data for the various ocean tools functions """ self.lat = 30 self.z = np.array(9712.02) self.t = np.array(4...
2.734375
3
contrail_provisioning/common/keepalived_setup.py
atsgen/contrail-provisioning
2
52216
#!/usr/bin/python # # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # import os import sys import argparse import netaddr import netifaces import ConfigParser import platform from fabric.api import local from contrail_provisioning.common.base import ContrailSetup from contrail_provisioning.compute.n...
2.171875
2
teste.py
lucascz37/PySoccer
0
52217
<filename>teste.py from PySoccer.leagues.LeagueBase import LeagueBase league = LeagueBase() test = league.leaderboard('italy_serie_a') for t in test.teams: print(t)
2.296875
2
AdventOfCode/Day6.py
btrzcinski/AdventOfCode
0
52218
def turn_on_lights(lights, begin, end): for x in range(begin[0], end[0]+1): for y in range(begin[1], end[1]+1): lights[x][y] = True def turn_off_lights(lights, begin, end): for x in range(begin[0], end[0]+1): for y in range(begin[1], end[1]+1): lights[x][y] = False def ...
3.3125
3
tests/test_scipy_stats.py
miltondp/clustermatch-gene-expr
0
52219
<filename>tests/test_scipy_stats.py import numpy as np from scipy import stats from clustermatch.scipy.stats import rank def test_rank_no_duplicates(): data = np.array([0, 10, 1, 5, 7, 8, -5, -2]) expected_ranks = stats.rankdata(data, "average") observed_ranks = rank(data) np.testing.assert_array_e...
2.828125
3
simplemooc/accounts/models.py
WesGtoX/simplemooc
3
52220
<reponame>WesGtoX/simplemooc import re from django.db import models from django.core import validators from django.conf import settings from django.contrib.auth.models import ( AbstractBaseUser, PermissionsMixin, UserManager ) class User(AbstractBaseUser, PermissionsMixin): # Nome de usuário padrão, que tam...
2.28125
2
project/migrations/0007_auto_20210910_1326.py
RawAnimal/esm
0
52221
# Generated by Django 3.2.7 on 2021-09-10 17:26 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('project', '0006_auto_20210910_1323'), ] operations = [ migrations.AlterField( model_name='project', name='project_ad...
1.53125
2
benders-decomposition/src/input/input_data.py
grzegorz-siekaniec/benders-decomposition-gurobi
6
52222
import json from typing import List from .customer import Customer from .facility import Facility class InputData: def __init__(self, facilities: List[Facility], customers: List[Customer]): self.facilities = facilities self.customers = customers def supply(self, facility_name) -> float: ...
3.65625
4
cogs/ClientInfo.py
ssuniie/yeongbot
1
52223
<reponame>ssuniie/yeongbot import discord from discord.ext import commands from datetime import datetime, timedelta from pytz import timezone AUTHOR_ICON = 'https://i.ibb.co/tMbrntz/jang-wonyoung-nationality-cover2.jpg' tz_bangkok = timedelta(hours=7) # Bangkok's Timezone (GMT +7) class ClientInfo(commands.Cog): ...
2.65625
3
applications/facemask/inference_main_app.py
mrn-mln/neuralet
1
52224
from configs.config_handler import Config from libs.core import FaceMaskAppEngine as CvEngine from ui.web_gui import WebGUI as UI from argparse import ArgumentParser def main(): """ Creates config and application engine module and starts ui :return: """ argparse = ArgumentParser() argparse.add...
2.53125
3
c.py
Toqozz/yarn-python
0
52225
<reponame>Toqozz/yarn-python from configparser import RawConfigParser from os.path import expanduser parser = RawConfigParser() parser.read(expanduser('~') + '/.config/yarn/config') #[lemonbar] xpos = parser.getint('lemonbar', 'xpos') ypos = parser.getint('lemonbar', 'ypos') gap = parser.getint('lemonbar', 'gap') dir...
2.03125
2
mvdnet/evaluation/__init__.py
qiank10/MVDNet
51
52226
from .robotcar_evaluation import RobotCarEvaluator
1.054688
1
str/add_gene+threshold_to_EH_column_headings2.py
ccmbioinfo/crg
7
52227
#!/usr/bin/env python3 import argparse #################################### ### Parse command-line arguments ### parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("EH_filename", type=str) parser.add_argument("disease_locus_filename", type=str) args = parser.p...
3.015625
3
apidaora/myapp.py
sarincr/Python-Web-Frameworks-and-Template-Engines
0
52228
<filename>apidaora/myapp.py<gh_stars>0 from apidaora import appdaora, route @route.get('/') def hello_controller(name: str) -> str: return f'Hello World!' app = appdaora(hello_controller)
2.0625
2
lab/src/bombe/marian_nmt.py
techiaith/docker-marian-nmt
0
52229
<filename>lab/src/bombe/marian_nmt.py from collections import ChainMap from functools import partial from importlib import resources as ir from itertools import repeat from numbers import Number from pathlib import Path from typing import Dict, List, Optional, Sequence, Tuple, Union import io import random import shuti...
2.109375
2
tests/test_adapters.py
ScreenPyHQ/screenpy
8
52230
<filename>tests/test_adapters.py import logging from screenpy.narration.adapters.stdout_adapter import StdOutAdapter, StdOutManager def prop(): """The revolver in the foyer!""" pass class TestStdOutManager: def test__outdent(self): manager = StdOutManager() manager.depth = [] m...
2.625
3
broker/broker.py
Max00355/ByteMail-1
4
52231
import ssl import socket import json import threading import landerdb class Broker: def __init__(self): self.port = 4321 self.db = landerdb.Connect("nodes.db") def main(self): s = ssl.socket() s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(("", self.port...
2.625
3
source/py4dlib/utils.py
andreberg/py4dlib
18
52232
<gh_stars>10-100 # -*- coding: utf-8 -*- # # utils.py # py4dlib # # Created by <NAME> on 2012-09-28. # Copyright 2012 Berg Media. All rights reserved. # # <EMAIL> # # pylint: disable-msg=F0401 '''py4dlib.utils -- utility toolbelt for great convenience.''' import os import warnings __version__ = (0, 6) __dat...
2.0625
2
examples/apps/shot_detection/shot_detect.py
keunhong/scanner
1
52233
<filename>examples/apps/shot_detection/shot_detect.py from scannerpy import Database, DeviceType, Job from scannerpy.stdlib import readers from scipy.spatial import distance from subprocess import check_call as run import numpy as np import cv2 import math import sys import os.path sys.path.append(os.path.dirname(os.pa...
2.78125
3
src/you_get/cli_wrapper/player/__main__.py
adger-me/you-get
46,956
52234
<reponame>adger-me/you-get #!/usr/bin/env python ''' WIP def main(): script_main('you-get', any_download, any_download_playlist) if __name__ == "__main__": main() '''
1.414063
1
tests/conftest.py
lsst-sqre/squash-rest-api
0
52235
<reponame>lsst-sqre/squash-rest-api<gh_stars>0 """squash-api pytest fixtures.""" import os import pymysql import pytest import redis from squash.config import Development from squash.models import UserModel # timeout in seconds to get the docker services running DOCKER_SERVICE_TIMEOUT = 120 def is_mysql_responsiv...
2.203125
2
deploy.py
AbdullahAbdelhakeem6484/ITI_Graduation_Project1_SISR_BY_GAN
4
52236
<filename>deploy.py import streamlit as st from PIL import Image import cv2 import numpy as np import pandas as pd #import tensorflow as tf #from tensorflow import keras import glob import os import random from numpy import asarray from itertools import repeat import imageio from imageio import i...
2.734375
3
main.py
stillmatic/plaitpy
438
52237
from __future__ import print_function from src import cli from os import environ as ENV PROFILE=False if PROFILE: print("PROFILING") import cProfile cProfile.run("cli.main()", "restats") import pstats p = pstats.Stats('restats') p.strip_dirs().sort_stats('cumulative').print_stats(50) else: ...
2.046875
2
app/response_processor.py
ONSdigital/ras-rabbit-adaptor-service
1
52238
from base64 import standard_b64decode import logging import os import requests from requests.adapters import HTTPAdapter from requests.exceptions import ConnectionError from urllib3.util.retry import Retry from sdc.rabbit.exceptions import BadMessageError, RetryableError from sdc.crypto.decrypter import decrypt as sdc...
2.15625
2
apps/forms-flow-ai/forms-flow-api/tests/conf/__init__.py
saravanpa-aot/SBC_DivApps
132
52239
"""Test-Suite for the configuration system."""
1.078125
1
Python/Problem036.py
SethDeVries/My-Project-Euler
1
52240
<filename>Python/Problem036.py import math #Sum of all doubly palindromic numbers count = 0 numDecInt = 0 numDecStr = '0' numBinStr = '0' for x in range(0,1000000): numDecInt += 1 numBinStr = bin(numDecInt) numBinStr = numBinStr.replace("0b","") numDecStr = str(numDecInt) if (int(numDecStr) == i...
3.484375
3
tests/test_adaptor/test_transformer.py
richlewis42/pandas-learn
1
52241
<gh_stars>1-10 #! /usr/bin/env python # -*- coding: utf-8 -*- # # This file is part of pandas-learn # https://github.com/RichLewis42/pandas-learn # # Licensed under the MIT license: # http://www.opensource.org/licenses/MIT # Copyright (c) 2015, <NAME> <<EMAIL>> """ tests.test_adaptor.transformer ~~~~~~~~~~~~~~~~~~~~~~...
2.96875
3
tacotron2/datasets/length_sort_sampler.py
DashaSerdyuk/tacotron2
1
52242
from torch.utils.data import Sampler import numpy as np def get_chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n] def flatten(l): return [item for sublist in l for item in sublist] class LengthSortSampler(Sampler): def __init__(self, data_source, bs): super().__init__(data_s...
2.5
2
gui/MPVGUI.py
LXG-Shadow/BilibiliGetFavorite
60
52243
<gh_stars>10-100 from tkinter import ttk import tkinter as tk from plugins import mpv_lib class MPVGUI(): MAX_VOLUME = 128 instance = None @staticmethod def getInstance(): return MPVGUI.instance def __init__(self, gui): self.gui: gui.GUI = gui self.widget = ttk.Frame(self...
2.484375
2
backtester/strategy/strategy.py
unbalancedparentheses/backtester_options
91
52244
import math import numpy as np class Strategy: """Options strategy class. Takes in a number of `StrategyLeg`'s (option contracts), and filters that determine entry and exit conditions. """ def __init__(self, schema): self.schema = schema self.legs = [] self.conditions = []...
3.53125
4
delivery/delivery/ext/site/__init__.py
alisonamerico/curso-flask
0
52245
<filename>delivery/delivery/ext/site/__init__.py from delivery.ext.site.main import bp def init_app(app): app.register_blueprint(bp)
1.40625
1
edgelm/examples/textless_nlp/gslm/metrics/asr_metrics/misc/bleu_utils.py
guotao0628/DeepNet
1
52246
""" TODO: the code is take from Apache-2 Licensed NLTK: make sure we do this properly! Copied over from nltk.tranlate.bleu_score. This code has two major changes: - allows to turn off length/brevity penalty --- it has no sense for self-bleu, - allows to use arithmetic instead of geometric mean """ impor...
2.84375
3
lib/gruvi/sync.py
geertj/gruvi
47
52247
<gh_stars>10-100 # # This file is part of Gruvi. Gruvi is free software available under the # terms of the MIT license. See the file "LICENSE" that was provided # together with this source file for the licensing terms. # # Copyright (c) 2012-2014 the Gruvi authors. See the file "AUTHORS" for a # complete list. from __...
2.125
2
Exercise05/5-20c.py
ywyz/IntroducingToProgrammingUsingPython
0
52248
<gh_stars>0 ''' @Date: 2019-09-10 20:36:03 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors: ywyz @LastEditTime: 2019-09-10 20:41:39 ''' for number in range(1, 7): spacenumber = 6 - number while spacenumber >= 0: print(" ", end=" ") spacenumber -= 1 n = numbe...
3.421875
3
sdpremote/config.py
gudn/sdpremote
0
52249
<reponame>gudn/sdpremote from dynaconf import Dynaconf, Validator settings = Dynaconf( envvar_prefix="SDP_REMOTE", settings_files=['settings.toml', '.secrets.toml'], validators=[ Validator('intro', default='sdpremote', is_type_of=str), Validator('debug', default=False, is_type_of=bool), ...
1.773438
2
Tutorial-2/tut_2.py
NikhilMunna/Computer-Vision
0
52250
<reponame>NikhilMunna/Computer-Vision # USAGE # python tut_2.py --image tetris_blocks.png import argparse import imutils import cv2 class Tetris(): def __init__(self,image): self.image = image def show_image(self): cv2.imshow("Image", self.image) cv2.waitKey(0) def convert...
3.546875
4
ncachefactory/nodetable.py
luckylyk/ncachefactory
1
52251
<reponame>luckylyk/ncachefactory<gh_stars>1-10 from PySide2 import QtWidgets, QtGui, QtCore from maya import cmds import maya.OpenMaya as om from ncachefactory.qtutils import get_icon from ncachefactory.nodes import filtered_dynamic_nodes, create_dynamic_node from ncachefactory.cachemanager import filter_connected_cac...
1.71875
2
0. labos/data.py
drakipovic/deep-learning
0
52252
<gh_stars>0 import math import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import accuracy_score, precision_score, recall_score class Random2DGaussian(object): min_x = 0 max_x = 10 min_y = 0 max_y = 10 def __init__(self): self.mean = [(self.max_x-self.min_x) * np...
2.859375
3
original_server/routes/routes_todo_ajax.py
Rolling-meatballs/web_sever
0
52253
from models.todo_ajax import TodoAjax from web_framework import ( current_user, html_response, json_response, ) from utils import log def index(request): u = current_user(request) return html_response('todo_ajax_index.html') def all(request): todos = TodoAjax.all() todos = [t.__dict__ f...
2.109375
2
service/migrations/0005_auto_20210902_1522.py
theonlykingpin/snapfoodclone
11
52254
<reponame>theonlykingpin/snapfoodclone # Generated by Django 3.2 on 2021-09-02 10:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('service', '0004_alter_service_address'), ] operations = [ migrations.RemoveField( model_nam...
1.78125
2
sites/supporters/anime_name.py
leptoid/anime-dl
2
52255
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import subprocess def crunchyroll_name(anime_name, episode_number, resolution): anime_name = str(anime_name).replace("039T", "'") # rawName = str(animeName).title().strip().replace("Season ", "S") + " - " + \ # str(episode_number...
2.515625
3
feedback/admin.py
alekam/django-feedback
1
52256
<reponame>alekam/django-feedback<filename>feedback/admin.py<gh_stars>1-10 from django.contrib import admin from feedback.models import Feedback class FeedbackAdmin(admin.ModelAdmin): list_display = ['name', 'email', 'message', 'time'] search_fields = ['email', 'message'] list_filter = ['time', ] date_...
1.5625
2
uralex-export.py
kasyrj/uralex-export
0
52257
#!/usr/bin/env python3 #-*- coding=utf-8 -*- ## export phylogenetic data from UraLex basic vocabulary dataset import sys def checkPythonVersion(): if (sys.version_info[0] < 3): print("Python 3 is needed to run this program.") sys.exit(1) checkPythonVersion() import os import io import ar...
2.9375
3
examples/hierarchical_sparse_grid_test/sparse_hierachical_test.py
wedeling/FabUQCampaign
1
52258
<filename>examples/hierarchical_sparse_grid_test/sparse_hierachical_test.py import os import easyvvuq as uq import numpy as np import chaospy as cp import fabsim3_cmd_api as fab def exact_sobols_poly_model(): """ Exact Sobol indices for the polynomial test model """ S_i = np.zeros(d) for i in rang...
2.375
2
scripts/callmultiplier.py
tomunger/pythonnet.embedingtest
3
52259
import clr from PythonNetTest import Multiplier def multiplyThese (a, b): m = Multiplier() return m.Multiply(a, b) # print "3 * 5: " + str(multiplyThese(3.0, 5.0))
2.96875
3
test.py
sletort/pointpointgame
0
52260
<gh_stars>0 import random foo = ['battery', 'correct', 'horse', 'staple'] secure_random = random.SystemRandom() print(secure_random.choice(foo))
2.78125
3
tests/test_running.py
Zaab1t/simple-language
0
52261
<reponame>Zaab1t/simple-language import functools import pytest from simplelang import ast_tree, tokenizer, objects from simplelang.run import Interpreter # run a bunch of code in the same interpreter and context @pytest.fixture(scope='function') def run_code(): interp = Interpreter() def run(code): ...
2.453125
2
wagtail_svgmap/tests/utils.py
sylvainblot/wagtail-svgmap
13
52262
import os EXAMPLE_SVG_PATH = os.path.join(os.path.dirname(__file__), 'example.svg') IDS_IN_EXAMPLE_SVG = {'red', 'yellow', 'blue', 'green'} IDS_IN_EXAMPLE2_SVG = {'punainen', 'keltainen', 'sininen', 'vihrea'} with open(EXAMPLE_SVG_PATH, 'rb') as infp: EXAMPLE_SVG_DATA = infp.read() EXAMPLE2_SVG_DATA = ( EXAM...
2.34375
2
thestuff/deck_of_cards/card_counting_trainer.py
b3nj5m1n/recycle-bin
0
52263
import deck_of_cards from deck_of_cards import CountingSystemHiLo, DeckOfCards import random from time import sleep from dataclasses import dataclass import rich from rich.console import Console from rich.panel import Panel from rich.markdown import Markdown from rich.text import Text from rich.layout import Layout fro...
2.921875
3
argos/libs/clients/ontology.py
daedafusion/django-argos
0
52264
from django.conf import settings import requests from argos.libs.discovery import Discovery __author__ = 'mphilpot' class OntologyClient(object): def __init__(self, token, url=None): if url is None: discovery = Discovery() self.url = discovery.get_url("ontology") else: ...
2.28125
2
Iris on GCP/Saved_Dataset.py
NikhilNandoskar/Iris-on-GCP
0
52265
#Imports import pandas as pd import pickle from sklearn import datasets def dataset(): iris_data = datasets.load_iris() # Loads the Iris Dataset X = iris_data.data y = iris_data.target # Creating Dataframes df_data = pd.DataFrame(X, columns=['sepal_length', 'sepal_width','petal_length','...
3.359375
3
TrainingDataFromSgfValue.py
stefanpeidli/GoNet
6
52266
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Sat Nov 18 12:27:16 2017 @author: <NAME> This script reads sgf files from a file directory, converts them into pairs of "current board - next move" and stores them either in a dictionary or in a sqlite3 database. """ import os from collections import defaultdict ...
3.0625
3
samples/basicJob/basicJobHandler.py
eoin-obrien/aws-iot-device-sdk-python
0
52267
<gh_stars>0 from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient from threading import Lock import logging import time import json import argparse timeout = 5 pendingJob = True runningJobLock = Lock() # Custom job start-next callback def customJobCallback_StartNext(payload, responseStatus, token): # payloa...
2.390625
2
second-analysis-steps/code/building-decays/00.start.py
mesmith75/starterkit-lessons
0
52268
from Configurables import DaVinci from GaudiConf import IOHelper DaVinci().InputType = 'DST' DaVinci().TupleFile = 'DVntuple.root' DaVinci().PrintFreq = 1000 DaVinci().DataType = '2012' DaVinci().Simulation = True # Only ask for luminosity information when not using simulated data DaVinci().Lumi = not DaVinci().Simula...
1.921875
2
tools/profiling/microbenchmarks/bm_diff/bm_speedup.py
eaglesunshine/grpc_learn
1
52269
# Copyright 2017, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
1.617188
2
openprescribing/matrixstore/connection.py
annapowellsmith/openpresc
91
52270
<gh_stars>10-100 import os.path import sqlite3 import urllib.parse from .serializer import deserialize from .sql_functions import MatrixSum class MatrixStore(object): def __init__(self, sqlite_connection, filename=":memory:"): self.connection = sqlite_connection # `cache_key` attributes are used ...
2.71875
3
code/utils.py
Melykuti/COVID-19
5
52271
import os, math import numpy as np import pandas as pd import matplotlib.pyplot as plt #from matplotlib.collections import PatchCollection from sklearn import linear_model from pandas.plotting import register_matplotlib_converters register_matplotlib_converters() from importlib import reload # Constants #files = ['tim...
3.046875
3
tests/monitors/collectd_nginx/nginx_test.py
swipswaps/signalfx-agent
1
52272
""" Tests for the collectd/nginx monitor """ from contextlib import contextmanager from functools import partial as p import pytest from tests.helpers.agent import Agent from tests.helpers.assertions import has_datapoint_with_dim, tcp_socket_open from tests.helpers.metadata import Metadata from tests.helpers.util imp...
2.203125
2
corehq/warehouse/migrations/0001_initial.py
dborowiecki/commcare-hq
0
52273
<filename>corehq/warehouse/migrations/0001_initial.py # Generated by Django 1.10.7 on 2017-05-16 11:35 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( ...
1.75
2
Curso_Python/laco_for.py
FranciscoCabrita1/Cabrita
5
52274
numeros = [] for n in range(1,101): numeros.append(n) print(numeros)
3.328125
3
render_static/tests/bad_pattern.py
bckohan/django-static-templates
5
52275
import re from django.urls import path from render_static.tests.views import TestView class Unrecognized: regex = re.compile('Im not normal') class NotAPattern: pass urlpatterns = [ path('test/simple/', TestView.as_view(), name='bad'), NotAPattern() ] urlpatterns[0].pattern = Unrecognized()
2.203125
2
ws/ws.py
usc-isi-i2/mydig-webservice
2
52276
<gh_stars>1-10 from app_base import * from app_misc import * from app_data import * from app_project import * from app_tag import * from app_field import * from app_table import * from app_annotation import * from app_spacy import * from app_glossary import * from app_search import * from app_action import * def ensu...
2.015625
2
Problems/sibice.py
ramonrwx/kattis
1
52277
from math import hypot n, w, h = (int(x) for x in input().split()) def fits_in_box(nums: list[int]) -> None: longest = hypot(w, h) for num in nums: print('DA') if num <= longest else print('NE') fits_in_box(int(input()) for _ in range(n))
3.828125
4
src/repobee_plug/hook.py
gauravagrwal/repobee
39
52278
"""Hook specifications and containers.""" import collections import enum from typing import Optional, Mapping, Any import pluggy # type: ignore from repobee_plug import log hookspec = pluggy.HookspecMarker(__package__) hookimpl = pluggy.HookimplMarker(__package__) class Status(enum.Enum): """Status codes enu...
2.484375
2
scitag/service.py
esnet/flowd
0
52279
import datetime import logging import fcntl import importlib import os import pkgutil import sys import multiprocessing as mp import queue import signal import scitag import scitag.settings import scitag.plugins import scitag.backends import scitag.stun.services from scitag.config import config log = logging.getLogg...
2.015625
2
tests/test_openapi_schema.py
quaternionmedia/fastapi-crudrouter
686
52280
<reponame>quaternionmedia/fastapi-crudrouter from pytest import mark from tests import CUSTOM_TAGS POTATO_TAGS = ["Potato"] PATHS = ["/potato", "/carrot"] PATH_TAGS = { "/potato": POTATO_TAGS, "/potato/{item_id}": POTATO_TAGS, "/carrot": CUSTOM_TAGS, "/carrot/{item_id}": CUSTOM_TAGS, } class TestOpe...
2.546875
3
omdatabase/lib/kobas/kb/create_table.py
bioShaun/OMdatabase
0
52281
#!/usr/bin/env python def organism(con): con.executescript( ''' CREATE TABLE Organisms ( abbr TEXT PRIMARY KEY, name TEXT ); ''') def species(con): con.executescript( ''' CREATE TABLE Genes ( gid TEXT PRIMARY KEY, name TEXT ); CREATE TABLE GeneEntrezGeneIds ( gid TE...
2.40625
2
lib/CynUtil.py
cynay/CynCrypto
0
52282
<reponame>cynay/CynCrypto """ Module Docstring Docstrings: http://www.python.org/dev/peps/pep-0257/ """ __author__ = '<NAME> (<EMAIL>)' __copyright__ = 'Copyright (c) 20xx <NAME>' __license__ = 'WTFPL' __vcs_id__ = '$Id$' __version__ = '0.1' #Versioning: http://www.python.org/dev/peps/pep-0386/ # ## Code goes here. #...
2.609375
3
Section23_Visitor/VisitorRefined/DoubleExpression.py
enriqueescobar-askida/Kinito.Python
1
52283
class DoubleExpression: def __init__(self, value): self.value = value def accept(self, visitor): visitor.visit(self)
2.015625
2
setup.py
randydu/py-json-serialize
0
52284
from setuptools import setup with open("README.md", "r") as fh: long_description = fh.read() setup(name="py-json-serialize", version="0.10.0", description = "json serialize library for Python 2 and 3", long_description = long_description, long_description_content_type="text/markdown", url="ht...
1.476563
1
bin/calc_bbc.py
hasibaasma/alfpy
19
52285
<gh_stars>10-100 #! /usr/bin/env python # Copyright (c) 2016 <NAME>, combio.pl import argparse import sys from alfpy import bbc from alfpy.utils import distmatrix from alfpy.utils import seqrecords from alfpy.utils.data.seqcontent import get_alphabet from alfpy.version import __version__ def get_parser(): pars...
2.65625
3
spotlight/filesystem.py
lanl/stitch
2
52286
<reponame>lanl/stitch """ This module contains functions for managing files. """ import os import shutil import sys def mkdir(run_dir, change=False): """ Makes a directory and optionally changes into it. Parameters ---------- run_dir : str Path of directory to create. change : bool ...
3.09375
3
BotForGithub.py
AnantDoesntExist/TradeBot
0
52287
<filename>BotForGithub.py from __future__ import print_function from bs4 import BeautifulSoup import requests import re import schedule import time from datetime import datetime import os.path from googleapiclient.discovery import build from google.oauth2 import service_account import os import urllib.reques...
2.515625
3
keras_nets/AlexNet.py
pkucarey/dl_frameworks_nets_models
0
52288
<filename>keras_nets/AlexNet.py # -*- coding: utf-8 -*- from keras.layers import Convolution2D, MaxPooling2D, ZeroPadding2D from keras.layers import Flatten, Dense, Dropout from keras.layers import Input from keras.models import Model from keras import regularizers from keras import backend as K from keras_nets.utils.C...
2.703125
3
deprecated/thermobalance.py
mdbartos/RIPS
1
52289
<reponame>mdbartos/RIPS import math import numpy as np def T_c(I, T_amb, V, D, R_list, N_cond=1, T_range=[298,323,348], a_s=0.9, e_s=0.9, I_sun=900.0, temp_factor=1, wind_factor=1, n_iter=10): """ %% TO BE ASSIGNED T_line % line temperature (C) T_surf % line surface temperatu...
2.5
2
tools/help-center-exporter/print-articles.py
mpillar/zendesk-tools
2
52290
<gh_stars>1-10 """ Python script to print all zendesk domain articles as a single entity. Useful for checking global formatting properties or your articles. N.B. this python app currently does not have a wrapper script. """ import sys from zendesk.api import DomainConfiguration from zendesk.api import HelpCenter fro...
2.578125
3
app/recipe/tests/test_tags_api.py
leo-hoet/recipe-app-api
0
52291
<gh_stars>0 from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from recipe.tests.test_recipe_api import sample_recipe, sample_tag from core.models import Tag from recipe.serializer...
2.515625
3
cookschedule/urls.py
yuxuan-bill/Cook-Scheduler
0
52292
<reponame>yuxuan-bill/Cook-Scheduler from django.urls import path from . import views app_name = 'cookschedule' urlpatterns = [ path('', views.index, name='index'), path('login/', views.login, name='login'), path('logout/', views.logout, name='logout'), path('change_password/', views.change_password, ...
1.679688
2
src/python/pants/backend/codegen/protobuf/go/rules_integration_test.py
bastianwegge/pants
0
52293
<filename>src/python/pants/backend/codegen/protobuf/go/rules_integration_test.py # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations from textwrap import dedent from typing import Iterable import pytest ...
1.671875
2
python/get-accounting.py
owainkenwayucl/thomas-accounting
0
52294
<filename>python/get-accounting.py #!/usr/bin/env python3 ''' This is a fundamentally terrible piece of programming. If this is still in use in 2018 something has gone wrong. Anyway, this is a main script that calls out to other things that: 1. Gets the amount of credit charged in Gold. 2. Get...
3.484375
3
ref_backtrack.py
robchambers/coding_interview_ref_algos
0
52295
""" Backtracking ref impls see https://leetcode.com/problems/permutations/discuss/18284/Backtrack-Summary%3A-General-Solution-for-10-Questions!!!!!!!!-Python-(Combination-Sum-Subsets-Permutation-Palindrome) """ import random def subsets(arr): def backtrack(tmp, start, end): ret.append(tmp[:]) f...
3.4375
3
api/uwkgm/database/database/graph/triples/add.py
ichise-laboratory/uwkgm
0
52296
"""Add triples to the graph database The UWKGM project :copyright: (c) 2020 Ichise Laboratory at NII & AIST :author: <NAME> """ from typing import Tuple from dorest.managers.struct import generic from dorest.managers.struct.decorators import endpoint from database.database.graph import default_graph_uri @endpoint...
2.453125
2
test/agenda_test.py
chalothon/CLIPS_1
0
52297
<gh_stars>0 import unittest from clips import Environment, CLIPSError, Strategy, SalienceEvaluation DEFTEMPLATE = """(deftemplate template-fact (slot template-slot)) """ DEFRULE = """(defrule MAIN::rule-name (declare (salience 10)) (implied-fact implied-value) => (assert (rule-fired))) """ DEFTEMPLAT...
2.53125
3
tests/test_swarmclient.py
muexxl/swarmmaster
0
52298
# -*- coding: utf-8 -*- import swarmmaster from nose.tools import * import unittest sc = swarmmaster.SwarmClient(1) class TestSwarmClient(unittest.TestCase): """Basic test cases.""" def test_sc_id (self): assert sc.id == 1 def test_sc_writebuffer (self): sc.tx_buffer.clear() s...
2.421875
2
tees/ExampleBuilders/FeatureBuilders/WordVectorFeatureBuilder.py
sbnlp/2017BioNLPEvaluation
1
52299
import sys sys.path.append("..") from FeatureBuilder import FeatureBuilder from Utils.Libraries.wvlib_light.lwvlib import WV import Utils.Settings as Settings class WordVectorFeatureBuilder(FeatureBuilder): def __init__(self, featureSet, style=None): FeatureBuilder.__init__(self, featureSet, style) ...
2.484375
2