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 |
|---|---|---|---|---|---|---|
app/util/auth2.py | FSU-ACM/Contest-Server | 8 | 6400 | """ util.auth2: Authentication tools
This module is based off of util.auth, except with the action
paradigm removed.
"""
from flask import session
from app.models import Account
from app.util import course as course_util
# Session keys
SESSION_EMAIL = 'email'
def create_account(email: str, password: str, f... | 3.078125 | 3 |
FeView/pstaticwidget.py | motiurce/FeView | 10 | 6401 | from PyQt5.QtWidgets import *
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
class PstaticWidget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self... | 2.515625 | 3 |
pyallocation/solvers/exhaustive.py | julesy89/pyallocation | 0 | 6402 | <gh_stars>0
import numpy as np
from pymoo.core.algorithm import Algorithm
from pymoo.core.population import Population
from pymoo.util.termination.no_termination import NoTermination
from pyallocation.allocation import FastAllocation
from pyallocation.problem import AllocationProblem
def exhaustively(problem):
a... | 2.28125 | 2 |
config.py | yasminbraga/ufopa-reports | 0 | 6403 | import os
class Config:
CSRF_ENABLED = True
SECRET_KEY = 'your-very-very-secret-key'
SQLALCHEMY_DATABASE_URI = 'postgresql:///flask_template_dev'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = True
class Development(Config):
ENV = 'development'
DEBUG = True
TESTING = False
... | 1.765625 | 2 |
heat/api/openstack/v1/views/stacks_view.py | noironetworks/heat | 265 | 6404 | <reponame>noironetworks/heat
#
# 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... | 1.835938 | 2 |
pykrev/formula/find_intersections.py | Kzra/pykrev | 4 | 6405 | import itertools
import numpy as np
import pandas as pd
def find_intersections(formula_lists,group_labels,exclusive = True):
"""
Docstring for function pyKrev.find_intersections
====================
This function compares n lists of molecular formula and outputs a dictionary containing the intersections... | 3.53125 | 4 |
Create Playlist.py | j4ck64/PlaylistDirectories | 0 | 6406 | import os
import glob
import shutil
from tinytag import TinyTag
""" root = 'C:/'
copy_to = '/copy to/folder'
tag = TinyTag.get('C:/Users/jchap/OneDrive/Pictures/(VERYRAREBOYZ) (feat. $ki Mask The Slump God and Drugz).mp3')
print(tag.artist)
print('song duration: '+str(tag.duration))
"""
f = []
f=glob.gl... | 2.765625 | 3 |
PyBank/main.py | Alexis-Kepano/python_challenge | 0 | 6407 | #import modules
import os
import csv
#input
csvpath = os.path.join('Resources', 'budget_data.csv')
#output
outfile = os.path.join('Analysis', 'pybankstatements.txt')
#declare variables
months = []; total_m = 1; net_total = 0; total_change = 0; monthly_changes = []; greatest_inc = ['', 0]; greatest_dec = ['', 0]
#open... | 3.265625 | 3 |
bot/constants/messages.py | aasw0ng/thornode-telegram-bot | 15 | 6408 | <gh_stars>10-100
from enum import Enum
from constants.globals import HEALTH_EMOJIS
NETWORK_ERROR = '😱 There was an error while getting data 😱\nAn API endpoint is down!'
HEALTH_LEGEND = f'\n*Node health*:\n{HEALTH_EMOJIS[True]} - *healthy*\n{HEALTH_EMOJIS[False]} - *unhealthy*\n' \
f'{HEALTH_EMOJIS[N... | 2.75 | 3 |
src/interactive_conditional_samples.py | RanHerOver/cometaai | 0 | 6409 | <reponame>RanHerOver/cometaai
import random
import fire
import json
import os
import numpy as np
import tensorflow as tf
import pytumblr
import mysql.connector
import datetime
from random import seed
import model, sample, encoder
def interact_model(
model_name='1558M',
seed=None,
nsamples=1,
batch_size... | 2.203125 | 2 |
desktop/core/ext-py/pyasn1-0.1.8/pyasn1/compat/iterfunc.py | kokosing/hue | 422 | 6410 | <filename>desktop/core/ext-py/pyasn1-0.1.8/pyasn1/compat/iterfunc.py
from sys import version_info
if version_info[0] <= 2 and version_info[1] <= 4:
def all(iterable):
for element in iterable:
if not element:
return False
return True
else:
all = all
| 2.453125 | 2 |
src/cms/carousels/serializers.py | UniversitaDellaCalabria/uniCMS | 6 | 6411 | from rest_framework import serializers
from cms.api.serializers import UniCMSContentTypeClass, UniCMSCreateUpdateSerializer
from cms.medias.serializers import MediaSerializer
from . models import Carousel, CarouselItem, CarouselItemLink, CarouselItemLinkLocalization, CarouselItemLocalization
class CarouselForeignK... | 2.046875 | 2 |
demos/colorization_demo/python/colorization_demo.py | mzegla/open_model_zoo | 0 | 6412 | #!/usr/bin/env python3
"""
Copyright (c) 2018-2021 Intel Corporation
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 applic... | 1.804688 | 2 |
swagger_client/models/transfer.py | chbndrhnns/ahoi-client | 0 | 6413 | # coding: utf-8
"""
[AHOI cookbook](/ahoi/docs/cookbook/index.html) [Data Privacy](/sandboxmanager/#/privacy) [Terms of Service](/sandboxmanager/#/terms) [Imprint](https://sparkassen-hub.com/impressum/) © 2016‐2017 Starfinanz - Ein Unternehmen der Finanz Informatik # noqa: E501
OpenAPI sp... | 1.984375 | 2 |
external/trappy/tests/test_caching.py | vdonnefort/lisa | 1 | 6414 | # Copyright 2015-2017 ARM Limited, Google and contributors
#
# 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 applica... | 1.875 | 2 |
src/mf_horizon_client/client/pipelines/blueprints.py | MF-HORIZON/mf-horizon-python-client | 0 | 6415 | from enum import Enum
class BlueprintType(Enum):
"""
A blueprint is a pipeline template in horizon, and must be specified when creating a new pipeline
Nonlinear
===============================================================================================================
A nonlinear pipeline co... | 2.640625 | 3 |
pyChess/olaf/views.py | An-Alone-Cow/pyChess | 0 | 6416 | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render
from django.urls import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.utils import timezone
from olaf.models import *
from olaf.forms import *
from... | 2.015625 | 2 |
ce_vae_test/main_cetrainer.py | fgitmichael/SelfSupevisedSkillDiscovery | 0 | 6417 | <reponame>fgitmichael/SelfSupevisedSkillDiscovery<gh_stars>0
from __future__ import print_function
import argparse
import torch
import torch.utils.data
import matplotlib.pyplot as plt
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
from torchvision.utils imp... | 1.992188 | 2 |
appr/commands/logout.py | sergeyberezansky/appr | 31 | 6418 | <filename>appr/commands/logout.py
from __future__ import absolute_import, division, print_function
from appr.auth import ApprAuth
from appr.commands.command_base import CommandBase, PackageSplit
class LogoutCmd(CommandBase):
name = 'logout'
help_message = "logout"
def __init__(self, options):
su... | 2.515625 | 3 |
musica/apps.py | webnowone/albumMusical | 1 | 6419 | <reponame>webnowone/albumMusical<gh_stars>1-10
from django.apps import AppConfig
class MusicaConfig(AppConfig):
name = 'musica'
| 1.296875 | 1 |
tzwhere/tzwhere.py | tuxiqae/pytzwhere | 115 | 6420 | <reponame>tuxiqae/pytzwhere
#!/usr/bin/env python
'''tzwhere.py - time zone computation from latitude/longitude.
Ordinarily this is loaded as a module and instances of the tzwhere
class are instantiated and queried directly
'''
import collections
try:
import ujson as json # loads 2 seconds faster than normal jso... | 2.796875 | 3 |
tests/home_assistant/custom_features.py | jre21/mindmeld | 1 | 6421 | <filename>tests/home_assistant/custom_features.py<gh_stars>1-10
from mindmeld.models.helpers import register_query_feature
@register_query_feature(feature_name='average-token-length')
def extract_average_token_length(**args):
"""
Example query feature that gets the average length of normalized tokens in the q... | 2.84375 | 3 |
source/statuscodes.py | woody2371/fishbowl-api | 6 | 6422 | #!/usr/bin/python
# -*- coding: utf-8 -*-
def getstatus(code):
if code == "1000":
value = "Success!"
elif code == "1001":
value = "Unknown Message Received"
elif code == "1002":
value = "Connection to Fishbowl Server was lost"
elif code == "1003":
value = "Some Requests ... | 2.21875 | 2 |
app/src/server/hoge/hoge_api.py | jacob327/docker-flask-nginx-uwsgi-mysql | 0 | 6423 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# [Import start]
from flask import Blueprint, jsonify
# [Import end]
app = Blueprint(
'hoge',
__name__,
url_prefix='/hoge'
)
@app.route('/test')
def hoge():
return "\nhogehoge"
| 2.21875 | 2 |
preinstall_setup/makedeb-11.0.1-1-stable/src/makedeb/utils/missing_apt_dependencies.py | chipbuster/Energy-Languages-Setup | 0 | 6424 | #!/usr/bin/env python3
import apt_pkg
import sys
from apt_pkg import CURSTATE_INSTALLED, version_compare
from operator import lt, le, eq, ge, gt
# Function mappings for relationship operators.
relation_operators = {"<<": lt, "<=": le, "=": eq, ">=": ge, ">>": gt}
# Set up APT cache.
apt_pkg.init()
cache = apt_pkg.Ca... | 2.515625 | 3 |
cohorts_proj/datasets/migrations/0009_auto_20200824_0617.py | zferic/harmonization-website | 1 | 6425 | # Generated by Django 3.0.7 on 2020-08-24 06:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('datasets', '0008_auto_20200821_1427'),
]
operations = [
migrations.AddField(
model_name='rawdar',
name='AsB',
... | 1.726563 | 2 |
test_hello.py | skvel/pynet_testx | 0 | 6426 | <gh_stars>0
print "Hello World!"
print "Trying my hand at Git!"
print "Something else"
for i in range(10):
print i
| 2.828125 | 3 |
tasks/views.py | TheDim0n/ProjectManager | 0 | 6427 | <reponame>TheDim0n/ProjectManager<filename>tasks/views.py<gh_stars>0
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic import DetailView, ListView
from projects.models import Project
from status.models import Sta... | 2.203125 | 2 |
smoke/noaa/get_smokeplume_counts.py | minnieteng/smoke_project | 0 | 6428 | import os
import math
import time
import geohash
import geojson
from geojson import MultiLineString
from shapely import geometry
import shapefile
import numpy
import datetime as dt
import pandas as pd
import logging
logger = logging.getLogger(__name__)
source_shape_file_path = "C:/temp/2018/"
threshold = 60*60
cols = ... | 2.3125 | 2 |
notes/OOBall/OOBall/main-demo.py | KRHS-GameProgramming-2015/Manpac | 0 | 6429 | import pygame_sdl2
pygame_sdl2.import_as_pygame()
import pygame
import os
import random
import math
from Ball import Ball
def save_state(balls):
"""
Saves the game state.
"""
stateString = ""
with open("state.txt", "w") as f:
for ball in balls:
stateString += "{} {} {} {} {}".f... | 3.140625 | 3 |
sprt.py | vdbergh/pentanomial | 3 | 6430 | from __future__ import division
import math, copy
import argparse
from brownian import Brownian
import scipy
import LLRcalc
class sprt:
def __init__(self, alpha=0.05, beta=0.05, elo0=0, elo1=5, elo_model="logistic"):
assert elo_model in ("logistic", "normalized")
self.elo_model = elo_model
... | 2.734375 | 3 |
tools/hci_throughput/hci.py | t3zeng/mynewt-nimble | 0 | 6431 | <reponame>t3zeng/mynewt-nimble<filename>tools/hci_throughput/hci.py
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you ... | 1.53125 | 2 |
examples/dataproc/query.py | populationgenomics/analysis-runner | 0 | 6432 | """Simple Hail query example."""
import click
import hail as hl
from bokeh.io.export import get_screenshot_as_png
from analysis_runner import output_path
GNOMAD_HGDP_1KG_MT = (
'gs://gcp-public-data--gnomad/release/3.1/mt/genomes/'
'gnomad.genomes.v3.1.hgdp_1kg_subset_dense.mt'
)
@click.command()
@click.op... | 2.515625 | 3 |
ptpip/ptpip.py | darkarnium/ptpip | 0 | 6433 | <filename>ptpip/ptpip.py
import uuid
import time
import socket
import struct
class PtpIpConnection(object):
"""docstring for PtpIP"""
def __init__(self):
super(PtpIpConnection, self).__init__()
self.session = None
self.session_events = None
self.session_id = None
self.... | 2.890625 | 3 |
examples/morpho.py | jaideep-seth/PyOpenWorm | 0 | 6434 | <gh_stars>0
"""
How to load morphologies of certain cells from the database.
"""
#this is an expected failure right now, as morphology is not implemented
from __future__ import absolute_import
from __future__ import print_function
import PyOpenWorm as P
from PyOpenWorm.context import Context
from PyOpenWorm.worm import... | 2.515625 | 3 |
corehq/apps/app_manager/tests/test_form_workflow.py | kkrampa/commcare-hq | 1 | 6435 | <reponame>kkrampa/commcare-hq
from __future__ import absolute_import
from __future__ import unicode_literals
from django.test import SimpleTestCase
from corehq.apps.app_manager.const import (
AUTO_SELECT_RAW,
AUTO_SELECT_CASE,
WORKFLOW_FORM,
WORKFLOW_MODULE,
WORKFLOW_PREVIOUS,
WORKFLOW_ROOT,
... | 1.890625 | 2 |
tensorflow/python/compiler/tensorrt/model_tests/model_handler.py | sboshin/tensorflow | 0 | 6436 | # Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.53125 | 2 |
Python/Python Evaluation/solution.py | arpitran/HackerRank_solutions | 0 | 6437 | <filename>Python/Python Evaluation/solution.py
eval(input("Enter a expression ")) | 2.390625 | 2 |
kpca_iris.py | syamkakarla98/Kernel-PCA-Using-Different-Kernels-With-Classification | 10 | 6438 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# load dataset into Pandas DataFrame
df = pd.read_csv("D:\Python_programs\ML\Iris Data\KPCA\iris.csv")
#df.to_csv('iris.csv')
from sklearn.preprocessing import StandardScaler
features = ['sepal length', 'sepal width', 'petal length... | 3.171875 | 3 |
Python/libraries/recognizers-date-time/recognizers_date_time/date_time/italian/dateperiod_extractor_config.py | felaray/Recognizers-Text | 0 | 6439 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import List, Pattern
from recognizers_text.utilities import RegExpUtility
from recognizers_number.number import BaseNumberParser
from recognizers_number.number.italian.extractors import ItalianIntegerExtractor,... | 2.296875 | 2 |
pydbrepo/drivers/sqlite.py | danteay/pydbrepo | 2 | 6440 | <filename>pydbrepo/drivers/sqlite.py
"""SQLite Driver implementation."""
# pylint: disable=R0201
import os
import sqlite3
from typing import Any, AnyStr, List, NoReturn, Optional, Tuple
from pydbrepo.drivers.driver import Driver
class SQLite(Driver):
"""SQLite Driver connection class.
Environment variable... | 3.109375 | 3 |
Modules/BatchNormND.py | EmilPi/PuzzleLib | 52 | 6441 | <reponame>EmilPi/PuzzleLib
import numpy as np
from PuzzleLib import Config
from PuzzleLib.Backend import gpuarray, Blas
from PuzzleLib.Backend.Dnn import batchNormNd, batchNormNdBackward
from PuzzleLib.Variable import Variable
from PuzzleLib.Modules.Module import ModuleError, Module
class BatchNormND(Module):
def... | 2.203125 | 2 |
python/testData/editing/enterInIncompleteTupleLiteral.after.py | jnthn/intellij-community | 2 | 6442 | <filename>python/testData/editing/enterInIncompleteTupleLiteral.after.py
xs = ('foo', 'bar',
'baz'<caret> | 1.34375 | 1 |
model/server/server.py | waltzofpearls/reckon | 8 | 6443 | <reponame>waltzofpearls/reckon<filename>model/server/server.py
from concurrent import futures
from forecaster.prophet import Forecaster as ProphetForecaster
from multiprocessing import Event, Process, cpu_count
from pythonjsonlogger import jsonlogger
import contextlib
import grpc
import logging
import model.api.forecas... | 2.1875 | 2 |
test/test_setupcall.py | jhgoebbert/jupyter-libertem-proxy | 0 | 6444 | def test_setupcall():
"""
Test the call of the setup function
"""
import jupyter_libertem_proxy as jx
print("\nRunning test_setupcall...")
print(jx.setup_libertem())
| 2.03125 | 2 |
launchpad/launch/worker_manager.py | LaudateCorpus1/launchpad | 0 | 6445 | <gh_stars>0
# Copyright 2020 DeepMind Technologies Limited. 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 ... | 2.21875 | 2 |
mmdeploy/backend/tensorrt/init_plugins.py | hanrui1sensetime/mmdeploy | 1 | 6446 | <gh_stars>1-10
# Copyright (c) OpenMMLab. All rights reserved.
import ctypes
import glob
import logging
import os
def get_ops_path() -> str:
"""Get path of the TensorRT plugin library.
Returns:
str: A path of the TensorRT plugin library.
"""
wildcard = os.path.abspath(
os.path.join(
... | 2.296875 | 2 |
reagent/test/world_model/test_seq2reward.py | dmitryvinn/ReAgent | 0 | 6447 | <reponame>dmitryvinn/ReAgent
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import os
import random
import unittest
from typing import Optional
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
from parameterized import ... | 1.867188 | 2 |
models_SHOT_convex/syn30m03hfsg.py | grossmann-group/pyomo-MINLP-benchmarking | 0 | 6448 | <gh_stars>0
# MINLP written by GAMS Convert at 01/15/21 11:37:33
#
# Equation counts
# Total E G L N X C B
# 1486 571 111 804 0 0 0 0
#
# Variable counts
# x b i s1s s2... | 1.507813 | 2 |
backend/tests/test_resources.py | sartography/star-drive | 0 | 6449 | <reponame>sartography/star-drive
import unittest
from flask import json
from tests.base_test import BaseTest
from app import db, elastic_index
from app.model.resource import Resource
from app.model.resource_category import ResourceCategory
from app.model.resource_change_log import ResourceChangeLog
from app.model.use... | 2.328125 | 2 |
kolibri/core/auth/management/commands/sync.py | reubenjacob/kolibri | 0 | 6450 | <filename>kolibri/core/auth/management/commands/sync.py
import json
import logging
import math
import re
from contextlib import contextmanager
from django.core.management import call_command
from django.core.management.base import CommandError
from morango.models import Filter
from morango.models import InstanceIDMode... | 1.726563 | 2 |
warp.py | RezaFirouzii/fum-delta-vision | 0 | 6451 | import math
import imageio
import cv2 as cv
import numpy as np
import transformer
def fix_rotation(img):
img_copy = img.copy()
img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
rows, cols = img.shape
img = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY_INV, 15, 9)
kernel = cv.g... | 2.40625 | 2 |
sdssobstools/boss_data.py | sdss/ObserverTools | 0 | 6452 | <reponame>sdss/ObserverTools<filename>sdssobstools/boss_data.py
#!/usr/bin/env python3
"""
A tool to grab a single BOSS image and pull a few items from its header. It is
used in bin/sloan_log.py, but it could be used directly as well.
"""
import argparse
from pathlib import Path
from astropy.time import Time
import fi... | 2.203125 | 2 |
capitulo-08/ex13b.py | bryan-lima/exercicios-livro-introd-prog-python-3ed | 3 | 6453 | # Altere o Programa 8.20 de forma que o usuário tenha três chances de acertar o número
# O programa termina se o usuário acertar ou errar três vezes
# Programa 8.20 do livro, página 184
# Programa 8.20 - Adivinhando o número
#
# import random
#
# n = random.randint(1, 10)
# x = int(input('Escolha um número entre 1 e 1... | 4.09375 | 4 |
slogviz/config.py | mariusfrinken/slogviz | 1 | 6454 | <reponame>mariusfrinken/slogviz
# -*- coding: utf-8 -*-
"""This sub module provides a global variable to check for checking if the non-interactive argument was set
Exported variable:
interactive -- False, if the main the non-interactive argument was set, True, if it was not set
"""
global interactive
interactive = ... | 1.5 | 2 |
setup.py | shb84/ATM76 | 0 | 6455 | import setuptools
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name="atm76",
version="0.1.0",
author="<NAME>",
a... | 1.640625 | 2 |
agent/check_plugins/download_speed.py | indigos33k3r/god-eye | 1 | 6456 | import logging
import asyncio
from agent.check_plugins import AbstractCheckPlugin
# Do khong biet dung thu vien asyncio ntn ca nen em dung thu vien request
# python
import requests
import sys
import time
from datetime import datetime
logger = logging.getLogger(__name__)
class Download(AbstractCheckPlugin):
@as... | 2.375 | 2 |
Setup Rich Text Editor/mysite/main/urls.py | AyemunHossain/Django | 2 | 6457 | <reponame>AyemunHossain/Django
from django.urls import path
from . import views
app_name = "main"
urlpatterns = [
path("",views.homepage,name="homepage")
] | 1.8125 | 2 |
GA/train.py | jcordell/keras-optimization | 1 | 6458 | <gh_stars>1-10
"""
Utility used by the Network class to actually train.
Based on:
https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py
"""
from keras.datasets import mnist, cifar10
from keras.models import Sequential
from keras.layers import Dense, Dropout
from keras.utils.np_utils import to_catego... | 3.234375 | 3 |
tests/integration/agenda/test_models.py | rolandgeider/OpenSlides | 0 | 6459 | <reponame>rolandgeider/OpenSlides
from openslides.agenda.models import Item
from openslides.core.models import CustomSlide
from openslides.utils.test import TestCase
class TestItemManager(TestCase):
def test_get_root_and_children_db_queries(self):
"""
Test that get_root_and_children needs only one... | 2.21875 | 2 |
ssl_context_builder/http_impl/requests_wrapper/secure_session.py | mbjahnoon/ssl_context_builder | 1 | 6460 | import weakref
import os
import requests
import ssl
from ssl import SSLContext
import logging
from ssl_context_builder.builder.builder import SslContextBuilder
from ssl_context_builder.http_impl.requests_wrapper.ssl_adapter import SslAdapter
class RequestsSecureSession:
def __init__(self, ssl_context: SSLContex... | 2.484375 | 2 |
tiny_scripts/select_cifar_10.py | jiaqiangwjq/python_workhouse | 0 | 6461 | <reponame>jiaqiangwjq/python_workhouse
'''
Selected cifar-10. The .csv file format:
class_index,data_index
3,0
8,1
8,2
...
'''
import pickle
import pandas as pd
file = 'E:\pycharm\LEARN\data\cifar-10\cifar-10-batches-py\\test_batch'
with open(file, 'rb') as f:
dict = pickle.load(f, encoding='bytes')
dict.keys... | 3.125 | 3 |
codebox/scripts/fixture.py | disqus/codebox | 5 | 6462 | # Ghetto Fixtures
from codebox import app
from codebox.apps.auth.models import User
from codebox.apps.snippets.models import Snippet
from codebox.apps.organizations.models import Organization, OrganizationMember
from flask import g
client = app.test_client()
_ctx = app.test_request_context()
_ctx.push()
app.preproces... | 2.234375 | 2 |
corehq/apps/linked_domain/tests/test_views.py | akashkj/commcare-hq | 0 | 6463 | <filename>corehq/apps/linked_domain/tests/test_views.py
from unittest.mock import Mock, patch
from django.test import SimpleTestCase
from corehq.apps.domain.exceptions import DomainDoesNotExist
from corehq.apps.linked_domain.exceptions import (
DomainLinkAlreadyExists,
DomainLinkError,
DomainLinkNotAllowe... | 2.328125 | 2 |
LanguageBasics/functions/import_eg.py | Vamsi-TM/jubilant-train | 0 | 6464 | import function_exercise_01 as st
st.sandwich_toppings('meatballs', 'salad')
| 1.0625 | 1 |
pyingest/parsers/zenodo.py | golnazads/adsabs-pyingest | 1 | 6465 | <reponame>golnazads/adsabs-pyingest
#!/usr/bin/python
#
#
from __future__ import absolute_import
import json
import re
import logging
from .datacite import DataCiteParser
class WrongPublisherException(Exception):
pass
class ZenodoParser(DataCiteParser):
def get_references(self, r):
# as of version... | 1.953125 | 2 |
src/fullnode.py | AmeyaDaddikar/vjtichain | 1 | 6466 | import json
import time
from functools import lru_cache
from multiprocessing import Pool, Process
from threading import Thread, Timer
from typing import Any, Dict, List
from datetime import datetime
import hashlib
import inspect
import requests
import waitress
from bottle import BaseTemplate, Bottle, request, response,... | 2.078125 | 2 |
deepexplain/tf/v1_x/main.py | alexus37/MasterThesisCode | 1 | 6467 | <filename>deepexplain/tf/v1_x/main.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from tensorflow.python.framework import ops
from collections import OrderedDict
import warnings, logging
from deepexplain.tf.v1_x import constants
... | 2.0625 | 2 |
util/mem_usage.py | robinupham/cnn_lensing | 0 | 6468 | <gh_stars>0
"""
Get the memory usage of a Keras model.
From https://stackoverflow.com/a/46216013.
"""
def get_model_memory_usage(batch_size, model):
"""
Get the memory usage of a Keras model in GB.
From https://stackoverflow.com/a/46216013.
"""
import numpy as np
try:
from keras impo... | 2.84375 | 3 |
hexrd/distortion/distortionabc.py | glemaitre/hexrd | 27 | 6469 | import abc
class DistortionABC(metaclass=abc.ABCMeta):
maptype = None
@abc.abstractmethod
def apply(self, xy_in):
"""Apply distortion mapping"""
pass
@abc.abstractmethod
def apply_inverse(self, xy_in):
"""Apply inverse distortion mapping"""
pass
| 3.09375 | 3 |
setup.py | statisticianinstilettos/recommender_metrics | 0 | 6470 | import io
import os
from setuptools import setup
def read(file_name):
"""Read a text file and return the content as a string."""
with io.open(os.path.join(os.path.dirname(__file__), file_name),
encoding='utf-8') as f:
return f.read()
setup(
name='recmetrics',
url='https://gi... | 2.640625 | 3 |
run_classifier.py | wj-Mcat/model-getting-started | 0 | 6471 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | 2 | 2 |
module2-sql-for-analysis/rpg_db.py | TobyChen320/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 6472 | <reponame>TobyChen320/DS-Unit-3-Sprint-2-SQL-and-Databases
import sqlite3
import os
import psycopg2
from dotenv import load_dotenv
load_dotenv()
DB_NAME2 = os.getenv("DB_NAME3")
DB_USER2 = os.getenv("DB_USER3")
DB_PASS2 = os.getenv("DB_PASS3")
DB_HOST2 = os.getenv("DB_HOST3")
conn = psycopg2.connect(dbname=DB_NAME2,... | 3.171875 | 3 |
sws_comp_wiki_gen.py | moff-wildfire/sws-battlefy | 1 | 6473 | <reponame>moff-wildfire/sws-battlefy
import battlefy_data
import battlefy_wiki_linkings
from datetime import datetime
from operator import itemgetter
from pathlib import Path
import calcup_roster_tracking
def create_sidebar(data, wiki_name):
sidebar = '{{Infobox league' + '\n'
sidebar += '|liquipediatier=' +... | 2.203125 | 2 |
utilidades/texto.py | DeadZombie14/chillMagicCarPygame | 0 | 6474 | import pygame
class Texto:
def __init__(self, screen, text, x, y, text_size = 20, fuente = 'Calibri', italic = False, bold= False, subrayado= False, color = (250, 240, 230), bg = [] ):
self.screen = screen
fg = color
self.coord = x, y
#load font, prepare values
f... | 3.171875 | 3 |
training_xgboost_model.py | MighTy-Weaver/Inefficient-AC-detection | 2 | 6475 | # This is the code to train the xgboost model with cross-validation for each unique room in the dataset.
# Models are dumped into ./models and results are dumped into two csv files in the current work directory.
import argparse
import json
import math
import os
import pickle
import warnings
from typing import Tuple
i... | 2.734375 | 3 |
setup.py | editorconfig/editorconfig-core-py | 70 | 6476 | import os
from setuptools import setup
# Read the version
g = {}
with open(os.path.join("editorconfig", "version.py"), "rt") as fp:
exec(fp.read(), g)
v = g['VERSION']
version = ".".join(str(x) for x in v[:3])
if v[3] != "final":
version += "-" + v[3]
setup(
name='EditorConfig',
versio... | 1.78125 | 2 |
vaping/config.py | josephburnett/vaping | 0 | 6477 | <filename>vaping/config.py<gh_stars>0
import re
import munge
def parse_interval(val):
"""
converts a string to float of seconds
.5 = 500ms
90 = 1m30s
**Arguments**
- val (`str`)
"""
re_intv = re.compile(r"([\d\.]+)([a-zA-Z]+)")
val = val.strip()
total = 0.0
for ... | 2.890625 | 3 |
sktime/annotation/tests/test_all_annotators.py | Rubiel1/sktime | 1 | 6478 | # -*- coding: utf-8 -*-
"""Tests for sktime annotators."""
import pandas as pd
import pytest
from sktime.registry import all_estimators
from sktime.utils._testing.estimator_checks import _make_args
ALL_ANNOTATORS = all_estimators(estimator_types="series-annotator", return_names=False)
@pytest.mark.parametrize("Est... | 2.375 | 2 |
raspberry-pi-camera/cam.py | AlexMassin/mlh-react-vr-website | 1 | 6479 | <gh_stars>1-10
picamera import PiCamera
from time import sleep
import boto3
import os.path
import subprocess
s3 = boto3.client('s3')
bucket = 'cambucket21'
camera = PiCamera()
#camera.resolution(1920,1080)
x = 0
camerafile = x
while True:
if (x == 6):
x = 1
else:
x = x + 1
camera.start_preview()
camera.start_recordi... | 2.125 | 2 |
Part_3_advanced/m04_datetime_and_timedelta/datetime_formats/example_1.py | Mikma03/InfoShareacademy_Python_Courses | 0 | 6480 | <reponame>Mikma03/InfoShareacademy_Python_Courses<filename>Part_3_advanced/m04_datetime_and_timedelta/datetime_formats/example_1.py<gh_stars>0
from datetime import datetime
def run_example():
moment_in_time = datetime.fromordinal(256)
print(moment_in_time)
print(moment_in_time.toordinal())
print(momen... | 3.1875 | 3 |
examples/scripts/segmentation/nnet3-segmenter.py | mxmpl/pykaldi | 916 | 6481 | #!/usr/bin/env python
from __future__ import print_function
from kaldi.segmentation import NnetSAD, SegmentationProcessor
from kaldi.nnet3 import NnetSimpleComputationOptions
from kaldi.util.table import SequentialMatrixReader
# Construct SAD
model = NnetSAD.read_model("final.raw")
post = NnetSAD.read_average_poster... | 2.203125 | 2 |
src/dataset.py | HeegyuKim/CurseFilter | 0 | 6482 | <reponame>HeegyuKim/CurseFilter
from cProfile import label
from matplotlib.pyplot import text
import pandas as pd
import numpy as np
from tokenizers import Tokenizer
import torch
from torch.utils.data import Dataset, DataLoader
from typing import Dict, Any, Tuple
from datasets import load_dataset
class DataFrameDatas... | 2.453125 | 2 |
helper_tools/raspi_OMX-Player_Howto_demo.py | stko/Schnipsl | 0 | 6483 | <gh_stars>0
#!/usr/bin/python
# mp4museum.org by <NAME> 2019
import os
import sys
import glob
from subprocess import Popen, PIPE
import RPi.GPIO as GPIO
FNULL = open(os.devnull, "w")
# setup GPIO pin
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(13, GPIO.IN, pull_up_down ... | 2.609375 | 3 |
dash_app/compare_alg.py | zeyu2001/ICT1002-Python | 1 | 6484 | """
Comparison between the efficiency of the Boyer-Moore algorithm and the naive substring search algorithm.
The runtimes for both algorithms are plotted on the same axes.
"""
import matplotlib.pyplot as plt
import numpy as np
import string
import time
import random
from bm_alg import boyer_moore_match, naive_match
#... | 3.671875 | 4 |
TSIS_3/3774.py | GMKanat/PP2_spring | 0 | 6485 | ans = dict()
pairs = dict()
def create_tree(p):
if p in ans:
return ans[p]
else:
try:
res = 0
if p in pairs:
for ch in pairs[p]:
res += create_tree(ch) + 1
ans[p] = res
return res
except:
pass... | 3.53125 | 4 |
italicizer.py | Dorijan-Cirkveni/Miniprojects | 0 | 6486 | def italicize(s):
b = False
res = ''
for e in s:
if e == '"':
if b:
res += '{\\i}' + e
else:
res += e + '{i}'
b=not b
else:
res += e
return res
def main():
F=open('test_in.txt','r')
X=F.read()
F... | 3.859375 | 4 |
maps/views.py | WPRDC/neighborhood-simulacrum | 0 | 6487 | import json
from typing import Type, TYPE_CHECKING
from django.core.exceptions import ObjectDoesNotExist
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework import viewsets, filters
from rest_framework.exceptions import NotFound
from rest_framew... | 1.851563 | 2 |
magma/operators.py | Kuree/magma | 0 | 6488 | from magma import _BitType, BitType, BitsType, UIntType, SIntType
class MantleImportError(RuntimeError):
pass
class UndefinedOperatorError(RuntimeError):
pass
def raise_mantle_import_error_unary(self):
raise MantleImportError(
"Operators are not defined until mantle has been imported")
def r... | 2.53125 | 3 |
src/sultan/result.py | bquantump/sultan | 0 | 6489 | <gh_stars>0
import subprocess
import sys
import time
import traceback
from queue import Queue
from sultan.core import Base
from sultan.echo import Echo
from threading import Thread
class Result(Base):
"""
Class that encompasses the result of a POpen command.
"""
def __init__(self, process, commands,... | 2.671875 | 3 |
great_expectations/cli/datasource.py | orenovadia/great_expectations | 0 | 6490 | <filename>great_expectations/cli/datasource.py<gh_stars>0
import os
import click
from .util import cli_message
from great_expectations.render import DefaultJinjaPageView
from great_expectations.version import __version__ as __version__
def add_datasource(context):
cli_message(
"""
========== Datasources ... | 2.390625 | 2 |
python/crawler/downloader.py | rgb-24bit/code-library | 0 | 6491 | # -*- coding: utf-8 -*-
"""
Provide download function by request
"""
from datetime import datetime
import logging
import time
import urllib.parse
import requests
from bs4 import BeautifulSoup
class Throttle(object):
"""Throttle downloading by sleeping between requests to same domain."""
de... | 3.328125 | 3 |
medium/151.py | pisskidney/leetcode | 0 | 6492 | #!/usr/bin/python
class Solution(object):
def reverseWords(self, s):
if s == '':
return s
res = []
i = len(s) - 2
while i >= -1:
if s[i] == ' ' or i == -1:
word = ''
j = i + 1
while j < len(s) and s[j] != ' ':
... | 3.65625 | 4 |
src/keycloak/connection.py | ecederstrand/python-keycloak | 0 | 6493 | # -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (C) 2017 <NAME> <<EMAIL>>
#
# 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 t... | 2.078125 | 2 |
2020/23.py | Valokoodari/advent-of-code | 2 | 6494 | <gh_stars>1-10
#!venv/bin/python3
cs = [int(c) for c in open("inputs/23.in", "r").readline().strip()]
def f(cs, ts):
p,cc = {n: cs[(i+1)%len(cs)] for i,n in enumerate(cs)},cs[-1]
for _ in range(ts):
cc,dc = p[cc],p[cc]-1 if p[cc]-1 > 0 else max(p.keys())
hc,p[cc] = [p[cc], p[p[cc]], p[p[p[cc]]... | 2.234375 | 2 |
run.py | jakewright/home-automation-device-registry | 15 | 6495 | <gh_stars>10-100
# Import the application
from device_registry import app
# Run the application in debug mode
app.run(host='0.0.0.0', port=int(app.config['PORT']), debug=True)
| 1.617188 | 2 |
dvc/utils/stage.py | Abrosimov-a-a/dvc | 0 | 6496 | import yaml
from ruamel.yaml import YAML
from ruamel.yaml.error import YAMLError
try:
from yaml import CSafeLoader as SafeLoader
except ImportError:
from yaml import SafeLoader
from dvc.exceptions import StageFileCorruptedError
from dvc.utils.compat import open
def load_stage_file(path):
with open(path,... | 2.609375 | 3 |
CAMPODETIRO/test.py | Arguel/old-projects | 0 | 6497 | entrada = input("palabra")
listaDeLetras = []
for i in entrada:
listaDeLetras.append(i)
| 3.6875 | 4 |
demos/nn_classification_demo.py | fire-breathing-rubber-lemons/cs207-FinalProject | 0 | 6498 | import numpy as np
from pyad.nn import NeuralNet
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
np.random.seed(0)
data = load_breast_cancer()
X_train, X_test, y_train, y_test = train_test_split(
data.data, data.target, train_size=0.8, random_state=0
)
nn = Ne... | 3.109375 | 3 |
mgatemp.py | zobclub/chapter8 | 1 | 6499 | from microbit import *
I2CADR = 0x0E
DIE_TEMP = 0x0F
while True:
i2c.write(I2CADR, bytearray([DIE_TEMP]))
d = i2c.read(I2CADR, 1)
x = d[0]
if x >=128:
x -= 256
x += 10
print(x)
sleep(500) | 2.78125 | 3 |