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 |
|---|---|---|---|---|---|---|
QGrain/ui/NNResolverSettingWidget.py | yuriok/QGrain | 4 | 22400 | <filename>QGrain/ui/NNResolverSettingWidget.py
__all__ = ["NNResolverSettingWidget"]
import pickle
import numpy as np
import torch
from PySide2.QtCore import QSettings, Qt
from PySide2.QtWidgets import (QCheckBox, QComboBox, QDialog, QDoubleSpinBox,
QGridLayout, QLabel, QSpinBox)
from ... | 2.25 | 2 |
week3_greedy_algorithms/6_maximum_number_of_prizes/different_summands.py | thegautamkumarjaiswal/Algorithm-s_ToolBox_Solutions | 0 | 22401 | # Uses python3
n = int(input())
if n == 1:
print(1)
print(1)
quit()
W = n
prizes = []
for i in range(1, n):
if W>2*i:
prizes.append(i)
W -= i
else:
prizes.append(W)
break
print(len(prizes))
print(' '.join([str(i) for i in prizes])) | 3.296875 | 3 |
town/migrations/0002_shop.py | Snowman88/DODOTOWN | 1 | 22402 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('town', '0001... | 1.875 | 2 |
testing/scipy_distutils-0.3.3_34.586/command/build_clib.py | fireballpoint1/fortranTOpy | 1 | 22403 | """ Modified version of build_clib that handles fortran source files.
"""
import os
import string
import sys
import re
from glob import glob
from types import *
from distutils.command.build_clib import build_clib as old_build_clib
from distutils.command.build_clib import show_compilers
from scipy_distutils import log... | 2.03125 | 2 |
mayan/apps/web_links/migrations/0004_make_labes_unique.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 22404 | <reponame>nattangwiwat/Mayan-EDMS-recitation<filename>mayan/apps/web_links/migrations/0004_make_labes_unique.py
from django.db import migrations
def operation_make_labels_unique(apps, schema_editor):
WebLink = apps.get_model(app_label='web_links', model_name='WebLink')
for web_link in WebLink.objects.using(s... | 2.171875 | 2 |
ansible-devel/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/module_args.py | satishcarya/ansible | 0 | 22405 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2016 <NAME> <<EMAIL>>
# Copyright (C) 2016 Rackspace US, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License... | 1.851563 | 2 |
events/migrations/0003_invitation_detail.py | ebar0n/mishteh | 0 | 22406 | <gh_stars>0
# Generated by Django 2.2 on 2019-10-13 19:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("events", "0002_auto_20191013_1712")]
operations = [
migrations.AddField(
model_name="invitation",
name="detail",
... | 1.679688 | 2 |
pygitscrum/print.py | thib1984/pygitscrum | 2 | 22407 | """
print scripts
"""
from termcolor import colored
from pygitscrum.args import compute_args
import colorama
def print_resume_list(list_to_print, message):
"""
print list summary
"""
if len(list_to_print) > 0:
print("")
print(
my_colored(
message + " : ",
... | 3.1875 | 3 |
test/_test_compute_m.py | yiruiliu110/eegnn | 0 | 22408 | import torch
from estimation import compute_m
i = [[0, 1, 1, 2],
[2, 0, 2, 1]]
v_z = [3, 4, 5, 2]
v_c = [0, 1, 1, 0]
z = torch.sparse_coo_tensor(i, v_z, (3, 3))
c = torch.sparse_coo_tensor(i, v_c, (3, 3))
max_K = 10
m = compute_m(z, c, max_K)
print(m) | 2.34375 | 2 |
test/SMSGateway_test.py | S2Innovation/ds-s2i-smsgateway | 0 | 22409 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the SMSGateway project
#
#
#
# Distributed under the terms of the MIT license.
# See LICENSE.txt for more info.
"""Contain the tests for the SMSGateway for PANIC."""
# Path
import sys
import os
path = os.path.join(os.path.dirname(__file__), os.pard... | 2.234375 | 2 |
simfile/_private/serializable.py | garcia/simfile | 22 | 22410 | <filename>simfile/_private/serializable.py<gh_stars>10-100
from abc import ABCMeta, abstractmethod
from io import StringIO
from typing import TextIO
class Serializable(metaclass=ABCMeta):
@abstractmethod
def serialize(self, file: TextIO) -> None:
"""
Write the object to provided text file obj... | 3.046875 | 3 |
Flask/Lezione4/webapp/project/serate/templates/serate/forms.py | nick87ds/MaterialeSerate | 12 | 22411 | from time import strftime
from flask_wtf import FlaskForm
from wtforms import (
Form,
validators,
StringField,
IntegerField,
SubmitField,
BooleanField,
SelectField,
TextAreaField,
)
| 1.898438 | 2 |
intered/bin/django-admin.py | allenallen/interedregistration | 0 | 22412 | #!/home/allen/Documents/TamarawTechProjects/interedregistration/intered/bin/python3
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| 1 | 1 |
generate_hamming_command.py | zoeleeee/mnist_challenge | 0 | 22413 | <filename>generate_hamming_command.py
import numpy as np
import os
path = 'preds'
files = os.listdir(path)
lst = []
for f in files:
if f.find('_0_HASH') == -1:
continue
if f.find('CW') == -1:
continue
if f.find('low')==-1 and f.find('high')==-1 and f.find('mix')==-1:
continue
if... | 2.265625 | 2 |
benchmarks/benchmarks/reflect.py | dcortie/refnx | 32 | 22414 | import os.path
import numpy as np
import pickle
from .common import Benchmark
from refnx.analysis import CurveFitter, Objective, Parameter
import refnx.reflect
from refnx.reflect._creflect import abeles as c_abeles
from refnx.reflect._reflect import abeles
from refnx.reflect import SLD, Slab, Structure, ReflectModel,... | 2.078125 | 2 |
app/__init__.py | annerachael/fifth_year_project | 0 | 22415 | <filename>app/__init__.py
# app/__init__.py
from flask import Flask
from redis import Redis
from rq_scheduler import Scheduler
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
"""
This file shall contain configurations... | 2.375 | 2 |
automation/openwebsites.py | abrahammachuki/dnav3-code | 0 | 22416 | <reponame>abrahammachuki/dnav3-code<filename>automation/openwebsites.py
import webbrowser
website = ['site1', 'site2', 'site3', 'site4']
for i in range(len(website)):
site = 'http://' + website[i]
webbrowser.open(site) | 2.953125 | 3 |
hedger/tournament.py | dmalison/hedger | 0 | 22417 | <reponame>dmalison/hedger
import hedger
from hedger import Result
class Tournament:
def __init__(self, entries):
self._entries = entries
self._brackets = self._get_brackets()
self._brackets_info = self._get_brackets_info()
@property
def entries(self):
return self._entries
... | 2.84375 | 3 |
src/tentaclio/clients/sqla_client.py | datavaluepeople/tentaclio | 12 | 22418 | """Provide sql connection using sqlalchemy.
This client is used for convinience when using different sql
providers and unifying the client creation. We do not intent to rewriter sqlalchemy.
"""
import contextlib
from typing import Container, Generator, Optional, Union
import pandas as pd
from sqlalchemy.engine import... | 2.703125 | 3 |
polls/views.py | agustinsuana/mysite | 0 | 22419 | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.template import loader
from .models import Question
from django.http import Http404
def index(request):
#last_questions_list = Question.objects.order_by('-pub_date')[:5]
#template = loader.get_template("poll... | 2.21875 | 2 |
cctk/file.py | ekwan/cctk | 10 | 22420 | import os
from abc import ABC, abstractmethod
class File(ABC):
"""
Abstract class representing text files.
"""
@abstractmethod
def __init__(self):
pass
@staticmethod
def write_file(filename, text, overwrite_existing=True):
"""
Writes output text to a file.
... | 4.09375 | 4 |
elif_bayindir/phase_1/python_basic_1/day_4/q8.py | CodedLadiesInnovateTech/-python-challenge-solutions | 6 | 22421 | # Question 8
# Print even numbers in a list, stop printing when the number is 237
numbers = [
386, 462, 47, 418, 907, 344, 236, 375, 823, 566, 597, 978, 328, 615, 953, 345,
399, 162, 758, 219, 918, 237, 412, 566, 826, 248, 866, 950, 626, 949, 687, 217,
815, 67, 104, 58, 512, 24, 892, 894, 767, 553, 8... | 4.03125 | 4 |
encode_morse.py | cmanagoli/github-upload | 0 | 22422 | # Author: <NAME>
import sys as sys
# Morse code dictionary
char_to_dots = {
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.',
'S': '...', 'T':... | 2.578125 | 3 |
self_implement_learning_to_adapt/maml_rl.py | chi6/Model-based-meta-learning-rl | 2 | 22423 | import tensorflow as tf
import numpy as np
from self_implement_learning_to_adapt.model import construct_fc_weights,construct_inputs,construct_loss,forward_fc
from self_implement_learning_to_adapt.batch_sampler import ParrallelSampler
from self_implement_learning_to_adapt.vectorized_sampler import VectorizedSampler
from... | 1.765625 | 2 |
DeepRTS/__init__.py | cair/deep-rts | 144 | 22424 | try:
from DeepRTS import Engine
except ImportError:
import Engine
try:
from DeepRTS.Engine import Map, UnitManager, Constants, Player
from DeepRTS.Engine import Constants
except ImportError:
from Engine import Map, UnitManager, Constants, Player, Constants
| 1.320313 | 1 |
openprocurement/auctions/swiftsure/utils.py | bdmbdsm/openprocurement.auctions.swiftsure | 0 | 22425 | # -*- coding: utf-8 -*-
from logging import getLogger
from pkg_resources import get_distribution
from openprocurement.auctions.core.plugins.contracting.base.utils import (
check_auction_status
)
from openprocurement.auctions.core.utils import (
cleanup_bids_for_cancelled_lots, check_complaint_status,
remov... | 2.3125 | 2 |
src/plugins/bilibili/__init__.py | shinnenijou/JiBot | 0 | 22426 | <reponame>shinnenijou/JiBot<gh_stars>0
# -*- coding: utf-8 -*-
# Python STL
from time import time, sleep
import asyncio
from collections import deque
# Third-party
from bilibili_api import Credential, comment
import nonebot
from nonebot.log import logger
from nonebot import on_command, require
from nonebot.permission i... | 1.515625 | 2 |
rlzoo/common/build_rlbench_env.py | tensorlayer/RLzoo | 750 | 22427 | <reponame>tensorlayer/RLzoo
import sys
from collections import OrderedDict
import numpy as np
from gym import spaces
from pyrep.const import RenderMode
from pyrep.objects.dummy import Dummy
from pyrep.objects.vision_sensor import VisionSensor
from rlbench.environment import Environment
from rlbench.action_m... | 1.976563 | 2 |
scripts/generate/xgboost_.py | thomas-young-2013/automl_space | 2 | 22428 | <gh_stars>1-10
import numpy as np
from ConfigSpace import ConfigurationSpace
from ConfigSpace.hyperparameters import UniformFloatHyperparameter, \
UniformIntegerHyperparameter, UnParametrizedHyperparameter
import argparse
import pickle as pkl
import os
import sys
sys.path.insert(0, '.')
from scripts.utils import c... | 2.203125 | 2 |
OnStage/player_chair.py | IanDCarroll/xox | 0 | 22429 | import sys
from Training.observer_abilities import *
from Training.cortex_3x3_caddy import *
class Player(Observer):
def __init__(self, marker_code):
self.ui = None
self.marker_code = marker_code
def get_enemy_code(self):
if self.marker_code == 10:
return 1
return ... | 2.828125 | 3 |
content_f_conditions/ex45_multiple_conditions.py | Alyssonmach/learning-python-with-codes | 3 | 22430 | <gh_stars>1-10
requested_toppings = ['mushrooms', 'extra cheese']
if 'mushrooms' in requested_toppings:
print("Adding mushrooms.")
if 'pepperoni' in requested_toppings:
print("Adding pepperoni.")
if 'extra cheese' in requested_toppings:
print("Adding extra cheese.")
print("\nFinished making your first piz... | 3.15625 | 3 |
blog/models.py | njuaplusplus/j0shua | 0 | 22431 | <reponame>njuaplusplus/j0shua
#!/usr/local/bin/python
# coding=utf-8
from django.db import models
from django.utils.translation import ugettext as _
from markdown import markdown
from django.contrib.auth.models import User
from uuslug import uuslug
from django import forms
from pagedown.widgets import PagedownWidget
#... | 2.1875 | 2 |
sw_edit.py | nellore/deidentify | 0 | 22432 | <gh_stars>0
#!/usr/bin/env python
"""
sw_edit.py
Deidentifies SW_SUMMARY.csv and SW_MINUTE.csv in LABS 2 data; these files
cannot be deidentified properly by date_eliminator.py. This script replaces
dates with days since first day.
This software is licensed under the MIT License.
Copyright (c) 2016 <NAME>
Permiss... | 2.390625 | 2 |
pwas/__init__.py | cgreencode/pwas | 19 | 22433 | <filename>pwas/__init__.py<gh_stars>10-100
from .genotype import GenotypingManager | 1.210938 | 1 |
CNN_freq.py | vishnubk/ml_tutorial_pulsars | 0 | 22434 | <reponame>vishnubk/ml_tutorial_pulsars
from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
from sklearn.metrics import confusion_matrix, f1_score, precision_score, recall_s... | 2.765625 | 3 |
src/config/contents.py | miloszowi/everyone-mention-telegram-bot | 13 | 22435 | # markdownv2 python-telegram-bot specific
joined = '{} joined group `{}`'
not_joined = '{} is already in group `{}`'
left = '{} left group `{}`'
not_left = '{} did not join group `{}` before'
mention_failed = 'There are no users to mention'
no_groups = 'There are no groups for this chat'
# html python-telegram-bot spe... | 3.1875 | 3 |
portal/libs/utils.py | Artis-Physis/utopia-cms | 8 | 22436 | <reponame>Artis-Physis/utopia-cms<filename>portal/libs/utils.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from hashlib import md5
import re
import smtplib
from django.conf import settings
from django.http import HttpResponseBadRequest
def remove_spaces(s):
inline_tags = 'a|b|i|u|em|span|strong|sup|sub|tt|font|small|... | 2.265625 | 2 |
Python_OO/DelegarAcessoAtributos.py | Madara701/Python_OO | 0 | 22437 | <reponame>Madara701/Python_OO
class A:
def fazer_algo(self):
print("Palmeiras")
def outro(self):
print("campeão")
class B:
def __init__(self):
self.a = A()
def fazer_algo(self):
#delega para self.a
return self.a.fazer_algo()
def outro(self):
#delegand... | 3.703125 | 4 |
app/main.py | sebastian-hatala-leanix/chain-reaction-event | 0 | 22438 | import cv2
import numpy as np
from numpy.linalg import norm
import requests
def _get_image_frame(camera) -> np.ndarray:
_, frame = camera.read()
return frame
def _convert_frame_to_hsv(frame: np.ndarray) -> np.ndarray:
return cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
def _post_to_michi() -> None:
try:
... | 3.015625 | 3 |
habitat_baselines/utils/gym_adapter.py | srama2512/habitat-api | 355 | 22439 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict, Optional, Union
import gym
import numpy as np
from gym import spaces
... | 2.453125 | 2 |
TopicExtractor/src/SampleFlaskApp/app.py | npnkbabu/mymlproject | 0 | 22440 | from flask import Flask, render_template, Response
from topicsconsumer import TopicsConsumer
import math
import time
import queue
import threading
import json
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def searchTopic():
return render_template('base.html')
@app.route('/topics', methods=['GET'... | 2.421875 | 2 |
runsc/test/build_defs.bzl | dna2fork/gvisor | 2 | 22441 | <gh_stars>1-10
"""Defines a rule for runsc test targets."""
load("@io_bazel_rules_go//go:def.bzl", _go_test = "go_test")
# runtime_test is a macro that will create targets to run the given test target
# with different runtime options.
def runtime_test(**kwargs):
"""Runs the given test target with different runtim... | 2.015625 | 2 |
python/akg/ms/utils.py | tianjiashuo/akg | 286 | 22442 | <filename>python/akg/ms/utils.py
# Copyright 2019-2021 Huawei Technologies Co., Ltd
#
# 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 r... | 1.726563 | 2 |
foursight_core/sqs_utils.py | 4dn-dcic/foursight-core | 0 | 22443 | from datetime import datetime
import boto3
import json
from .stage import Stage
class SQS(object):
"""
class SQS is a collection of utils related to Foursight queues
"""
def __init__(self, foursight_prefix):
self.stage = Stage(foursight_prefix)
def invoke_check_runner(self, runner_input)... | 2.34375 | 2 |
setup.py | sabraha2/shadho | 0 | 22444 | #!/usr/bin/env python
import os
from setuptools import setup
from setuptools.command.install import install
LONG_DESCRIPTION = ""
with open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r') as f:
LONG_DESCRIPTION = f.read()
setup(
name='shadho',
version='0.4.3.post2',
description='Hyperparam... | 1.3125 | 1 |
foyer/tests/test_gmso_forcefield.py | jennyfothergill/foyer | 62 | 22445 | <reponame>jennyfothergill/foyer
import difflib
import glob
import os
import gmso
import mbuild as mb
import pytest
from pkg_resources import resource_filename
from foyer.exceptions import FoyerError
from foyer.general_forcefield import Forcefield
from foyer.tests.base_test import BaseTest
from foyer.tests.utils impor... | 1.84375 | 2 |
visualize/usecases/get_user_info.py | RevanthRyo/Alize | 160 | 22446 | <filename>visualize/usecases/get_user_info.py
import requests
from django.conf import settings
from visualize.utils.api import Client
class GetUserInfo(object):
"""
GetUserInfo :
params : username
response :
{
"login": "torvalds",
"id": 1024025,
"avatar_url": "https://avatars0.githubusercon... | 1.992188 | 2 |
FusionIIIT/applications/counselling_cell/migrations/0002_auto_20210501_1036.py | sabhishekpratap5/sonarcubeTest2 | 1 | 22447 | <filename>FusionIIIT/applications/counselling_cell/migrations/0002_auto_20210501_1036.py<gh_stars>1-10
# Generated by Django 3.1.5 on 2021-05-01 10:36
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('globals', '0003_auto_... | 1.320313 | 1 |
config.py | KodeInWork/openue_exp | 0 | 22448 | import os
class config():
input_dir = ''
max_len = '128'
pretrain_model_dir = ''
home_dir = os.getcwd() + '/'
data_dir = home_dir + 'raw_data/ske/'
tf_serving_addr = '127.0.0.1:8501'
bert_vocab_dir = home_dir + 'pretrained_model/chinese_wwm_ext_L-12_H-768_A-12/vocab.txt'
bert_config_dir ... | 1.65625 | 2 |
ipfsApi/__init__.py | dardevelin/python-ipfs-api | 1 | 22449 | from __future__ import absolute_import
from .client import *
__version__ = '0.2.2'
| 1.101563 | 1 |
leprikon/models/useragreement.py | leprikon-cz/leprikon | 4 | 22450 | <gh_stars>1-10
from django.db import models
from django.utils.translation import ugettext_lazy as _
from ..conf import settings
class UserAgreement(models.Model):
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
primary_key=True,
verbose_name=_("user"),
related_name="agreeme... | 1.796875 | 2 |
fair-api-datasets-update.py | RossBarnie/fair-api-beta-utilities | 3 | 22451 | import json
import sys
import os
import requests
from datasets.diff_helper import DiffHelper
from common.constants import BASE_HEADERS, FAIR_API_ENDPOINT, SSL_VERIFY, FAIR_URL, DRY_RUN
def dataset_url(code):
return f"{FAIR_API_ENDPOINT}{code}"
def get_request(dataset_code):
resp = requests.get(
datase... | 2.65625 | 3 |
scripts/convert_excel_files_to_json.py | sheecegardezi/sifra | 0 | 22452 | import os
import json
from collections import OrderedDict
import pandas as pd
def write_json_to_file(json_data, json_file_path):
parsed = json.loads(json_data)
parsed = json.dumps(parsed, indent=4, sort_keys=True)
obj = open(json_file_path, 'w')
obj.write(parsed)
obj.close()
# replace " with ' ... | 2.78125 | 3 |
QUANTAXIS/example/DataFetcher.py | cyy1229/QUANTAXIS | 0 | 22453 | <reponame>cyy1229/QUANTAXIS
from QUANTAXIS import QA_fetch_stock_day_adv, QA_fetch_stock_list_adv, QA_fetch_stock_day_full_adv, QA_Setting
import pandas as pd
QASETTING = QA_Setting()
DATABASE = QASETTING.client.quantaxis
# def getAllTradeCal():
# return pd.DataFrame(DATABASE.trade_date.find({"is_open": 1}))
c... | 2.6875 | 3 |
temp-uplift-submission/sparkml/adult_spark.py | damslab/reproducibility | 4 | 22454 | <filename>temp-uplift-submission/sparkml/adult_spark.py
import sys
import time
import numpy as np
import scipy as sp
import pandas as pd
import math
import warnings
from pyspark.sql import SparkSession
from pyspark import StorageLevel
from pyspark.ml.feature import Normalizer
from pyspark.ml.feature import StringIndexe... | 2.65625 | 3 |
populate/entities/SmellEmission.py | Odeuropa/knowledge-graph | 0 | 22455 | <reponame>Odeuropa/knowledge-graph<filename>populate/entities/SmellEmission.py
import re
from .Entity import Entity
from .SmellSource import SmellSource
from .ontologies import ODEUROPA
class SmellEmission(Entity):
def __init__(self, seed, smell, source='', carrier='', lang='en'):
super().__init__(seed)
... | 2.171875 | 2 |
constants.py | duongntbk/ToyMachineLearning | 0 | 22456 | # -*- coding: utf-8 -*-
MNIST_DATASET_PATH = 'raw_data/mnist.pkl.gz'
TEST_FOLDER = 'test/'
TRAIN_FOLDER = 'train/'
MODEL_FILE_PATH = 'model/recognizer.pickle'
LABEL_ENCODER_FILE_PATH = 'model/label_encoder.pickle'
# Manual
DEMO_HELP_MSG = '\n' + \
'Input parameter is incorrect\n' + \
'Display ... | 2.046875 | 2 |
python3/cut_the_sticks.py | ahavrylyuk/hackerrank | 0 | 22457 | <gh_stars>0
#! /usr/bin/env python
def cut_the_sticks(a):
cuts = []
while len(a) > 0:
cutter = a.pop()
if cutter == 0:
continue
for i in range(len(a)):
a[i] -= cutter
cuts.append(len(a) + 1)
return cuts
if __name__ == '__main__':
_ = input()
... | 3.21875 | 3 |
ex01_search.py | tbaptista/pacman | 1 | 22458 | <gh_stars>1-10
# coding: utf-8
# -----------------------------------------------------------------------------
# Copyright (c) 2015 <NAME>
# All rights reserved.
# -----------------------------------------------------------------------------
"""
Path-finding exercise using the pac-man game. Using the mouse, choose a t... | 3.265625 | 3 |
site_search/tests/test_permissions.py | AccentDesign/djangocms-site-search | 1 | 22459 | # -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.test import TestCase
from cms.api import assign_user_to_page, create_page
from ..helpers import get_request
from ..views import SearchResultsView
class PermissionsTestCase(TestCase):
def set... | 2.21875 | 2 |
FSO_Comm_Demo.py | MansourM61/FSO-Comm-GnuRadio-Module | 6 | 22460 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: FSO Communication Block Modules Test
# Author: <NAME>
# Description: Modules from FSO_Comm are used in a simple FSO comunication link including various channel effects.
# Generated: T... | 2.046875 | 2 |
Script/WDI_writer_functions.py | Riemer1818/Cattlelyst_wikibase_2021 | 0 | 22461 | <filename>Script/WDI_writer_functions.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from wikidataintegrator import wdi_core, wdi_login
import logging
import pickle
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, Laboratory of Systems and Synthetic Biology"
__credits__ = ["<NAME>", "<NAME>"]
__lice... | 2.765625 | 3 |
kitt/callbacks.py | David-Ciz/kitt | 0 | 22462 | <reponame>David-Ciz/kitt
import heapq
import logging
import os
from tensorflow.keras.callbacks import Callback
class ModelCheckpoint(Callback):
def __init__(
self,
filepath: str,
monitor: str,
mode: str = "max",
save_every_n_epochs: int = None,
save_n_best=1,
... | 2.421875 | 2 |
migrations/versions/2018_03_30_1f4385bac8f9_change_activity_picture_paths_to_file_.py | tch1bo/viaduct | 11 | 22463 | <filename>migrations/versions/2018_03_30_1f4385bac8f9_change_activity_picture_paths_to_file_.py<gh_stars>10-100
"""Change activity picture paths to file ids.
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2018-03-30 16:01:56.532893
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects impor... | 1.921875 | 2 |
fapistrano/signal.py | liwushuo/fapistrano | 18 | 22464 | <filename>fapistrano/signal.py
# -*- coding: utf-8 -*-
from functools import wraps
from .utils import run_function
class Signal(object):
def __init__(self, name, doc=''):
self.name = name
self.doc = doc
self.receivers = {}
class Namespace(dict):
def signal(self, name, doc=None):
... | 2.734375 | 3 |
Pyon exercicios/Exercicios/011.py | alefbispo/Exercicios-do-curso-de-Python | 0 | 22465 | <reponame>alefbispo/Exercicios-do-curso-de-Python
#pedir a altura e a largura de uma parede e dizer quantos litros de tinta vai gastar sabendo que cada litro de tinta pinta 2m2
altura = float(input('Qual a altura da parede? '))
largura = float(input('Qual a largura da parede? '))
area = altura * largura
tinta = (altur... | 4.0625 | 4 |
textutils/pages/views.py | sohanur-shanto/Django-Play-With-Text | 2 | 22466 | <filename>textutils/pages/views.py<gh_stars>1-10
from django.http import HttpResponse
from django.shortcuts import render
def funwithmath(request):
return render (request, 'funwithmath.html') | 1.796875 | 2 |
main.py | fthome/repetier_ui | 0 | 22467 | # -*-coding:Utf-8 -*
from repetier_ui import *
import time
import set_ifttt
from FUTIL.my_logging import *
my_logging(console_level = DEBUG, logfile_level = INFO)
HD = repetier_printer (repetier_api(api_key='<KEY>'),'HD')
sys.path.insert(0,'/home/pi')
import iftt_key
ifttt0 = set_ifttt.ifttt(iftt_key.key)
def wa... | 2.21875 | 2 |
cows/model/wms.py | cedadev/cows | 2 | 22468 | # BSD Licence
# Copyright (c) 2009, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.
# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
# This software may be distributed un... | 2 | 2 |
utilities/prev_projects/DATAFIT/VIEW/WINDOWSVIEW/GraphView.py | Saldenisov/pyconlyse | 0 | 22469 | <filename>utilities/prev_projects/DATAFIT/VIEW/WINDOWSVIEW/GraphView.py<gh_stars>0
from PyQt5.Qt import QMainWindow
from prev_projects.DATAFIT.UTILITY.OBSERVER import GraphObserver
from prev_projects.DATAFIT.UTILITY.META import Meta
from prev_projects.DATAFIT.VIEW.UI import Ui_GraphWindow
class GraphView(QMainWindow... | 1.882813 | 2 |
src/normalizer.py | lucassouzamatos/water-potability-ai | 0 | 22470 | import pandas as pd
class Normalizer:
csv_data = 'dataset/water_potability.csv' # file from work data
def __init__(self) -> None:
self.dataset = pd.read_csv(self.csv_data)
self.__normalize_data__()
self.__separate__()
'''
@ convert all info to number
'''
def __normalize_data__(self) -> Non... | 3.265625 | 3 |
CoProcessing/PythonCatalyst/Testing/Cxx/outputcheck.py | brown-ccv/paraview-scalable | 2 | 22471 | <reponame>brown-ccv/paraview-scalable<filename>CoProcessing/PythonCatalyst/Testing/Cxx/outputcheck.py
import sys
if len(sys.argv) != 2:
print("command is 'python <vtk file>'")
sys.exit(1)
from paraview.simple import *
proxy = OpenDataFile(sys.argv[1])
r = proxy.GetClientSideObject()
r.Update()
g = r.GetOutpu... | 2.390625 | 2 |
mrl/g_models/generative_base.py | DarkMatterAI/mrl | 4 | 22472 | <gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/09_generative_models.generative_base.ipynb (unless otherwise specified).
__all__ = ['GenerativeModel', 'beam_search']
# Cell
from ..imports import *
from ..torch_imports import *
from ..torch_core import *
from ..layers import *
# Cell
class Generative... | 2.234375 | 2 |
desafios/des003/des003_p03.py | brenoedl0/python | 0 | 22473 | nota1 = float(input('nota 1: '))
nota2 = float(input('nota 2: '))
media = (nota1 + nota2)/2
print('A media entre a nota 1 e a nota 2 é {}'.format(media))
| 3.890625 | 4 |
rio_tiler/mosaic/methods/defaults.py | vincentsarago/rio-tiler | 77 | 22474 | <reponame>vincentsarago/rio-tiler
"""rio_tiler.mosaic.methods.defaults: default mosaic filling methods."""
import numpy
from .base import MosaicMethodBase
class FirstMethod(MosaicMethodBase):
"""Feed the mosaic tile with the first pixel available."""
def __init__(self):
"""Overwrite base and init F... | 2.9375 | 3 |
apps/render_data_.py | ckxz/PIFu | 0 | 22475 | <reponame>ckxz/PIFu
import os, sys
import random
import argparse
from pathlib import Path
from tqdm import tqdm
import cv2
import math
import pyexr
import shutil
import numpy as np
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.ap... | 1.984375 | 2 |
venv/lib/python3.8/site-packages/webargs/__init__.py | mrunix1998/booking-flights-system | 1 | 22476 | # -*- coding: utf-8 -*-
from distutils.version import LooseVersion
from marshmallow.utils import missing
# Make marshmallow's validation functions importable from webargs
from marshmallow import validate
from webargs.core import dict2schema, ValidationError
from webargs import fields
__version__ = "5.3.2"
__version_... | 1.929688 | 2 |
scripts/imageio_remove_bin-script.py | shfkdroal/Robot-Learning-in-Mixed-Adversarial-and-Collaborative-Settings | 1 | 22477 | #!C:\Users\stpny\Downloads\grasp_public-master\grasp_public-master\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'imageio==2.5.0','console_scripts','imageio_remove_bin'
__requires__ = 'imageio==2.5.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] =... | 1.617188 | 2 |
mw2fcitx/build_dict.py | outloudvi/mw2fcitx | 67 | 22478 | import logging
import sys
from .pipeline import MWFPipeline
def build(config):
config["source"] = config["source"] or {}
config["tweaks"] = config["tweaks"] or []
config["converter"] = config["converter"] or {}
config["generator"] = config["generator"] or []
pipeline = MWFPipeline(config["source"... | 2.09375 | 2 |
pythonweb/user/views.py | onwebbe/rasiberryPiWebManager | 0 | 22479 | from django.shortcuts import render
from django.http import HttpResponse
import json
# Create your views here.
def info(request):
userInfo = {
'id': '4291d7da9005377ec9aec4a71ea837f',
'name': '天野远子',
'username': 'admin',
'password': '',
'avatar': '/avatar2.jpg',
'status': 1,
'telephone': ... | 2.0625 | 2 |
WHI_long_term_size_distr_including_fresh_emissions_plotting.py | annahs/atmos_research | 2 | 22480 | import matplotlib.pyplot as plt
import numpy as np
from scipy.optimize import curve_fit
from matplotlib import dates
import os
import pickle
from datetime import datetime
from pprint import pprint
import sys
import math
import traceback
import time
os.chdir('C:/Users/<NAME>/Documents/Data/WHI long term record/coating... | 2.375 | 2 |
Estrutura_Decisao/pair_or_odd.py | M3nin0/supreme-broccoli | 0 | 22481 | <reponame>M3nin0/supreme-broccoli<filename>Estrutura_Decisao/pair_or_odd.py
num = int(input("Insira um numero para descobrir se este é par ou impar: "))
if num % 2 == 0:
print("Este numero é par")
else:
print("Este numero é impar")
| 4.0625 | 4 |
pos_multie_print/config/docs.py | ashish-greycube/pos_multie_print | 0 | 22482 | """
Configuration for docs
"""
# source_link = "https://github.com/[org_name]/pos_multie_print"
# docs_base_url = "https://[org_name].github.io/pos_multie_print"
# headline = "App that does everything"
# sub_heading = "Yes, you got that right the first time, everything"
def get_context(context):
context.brand_html =... | 1.632813 | 2 |
src/import_hook/__init__.py | zthxxx/sniputils | 0 | 22483 | <filename>src/import_hook/__init__.py
from .import_track import *
from .reimportable import *
| 1.210938 | 1 |
check_performance.py | 5laps2go/xbrr | 0 | 22484 | <filename>check_performance.py
import os
import shutil
import pyfbi
from xbrr.edinet.client.document_client import DocumentClient
from xbrr.edinet.reader.reader import Reader
from xbrr.edinet.reader.doc import Doc
from xbrr.edinet.reader.aspects.finance import Finance
@pyfbi.target
def check():
_dir = os.path.joi... | 2.15625 | 2 |
pe3.py | ChrisCalderon/project-euler | 1 | 22485 | PRIMES = [3]
def next_prime():
num = PRIMES[-1] + 2 # odd + 2 is the next odd, don't check evens for primality
is_prime = False
while True:
lim = num**0.5 # don't check for prime factors larger than this
for p in PRIMES:
if p > lim:
is_prime = True
... | 4.15625 | 4 |
backend/puzzle/apps.py | mductran/puzzle | 0 | 22486 | from django.apps import AppConfig
class PuzzleConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'puzzle'
| 1.257813 | 1 |
cryptoquant/api/okex/futures_api.py | studyquant/StudyQuant | 74 | 22487 | from .client import Client
from .consts import *
class FutureAPI(Client):
def __init__(self, api_key, api_secret_key, passphrase, use_server_time=False, first=False):
Client.__init__(self, api_key, api_secret_key, passphrase, use_server_time, first)
# query position
def get_position(self):
... | 2.515625 | 3 |
advent_of_code_2017/day 14/solution.py | jvanelteren/advent_of_code | 1 | 22488 | #%%
# read full assignment
# think algo before implementing
# dont use a dict when you need a list
# assignment is still = and not ==
# dont use itertools when you can use np.roll
# check mathemathical functions if the parentheses are ok
# networkx is awesome
# sometimes while true is better than just too small for loo... | 2.75 | 3 |
binyard/general_diff.py | giprayogo/binyard | 0 | 22489 | <reponame>giprayogo/binyard
#!/usr/bin/env python
import math
import argparse
from fractions import Fraction
parser = argparse.ArgumentParser()
parser.add_argument('filename')
parser.add_argument('--column', '-c', required=True)
parser.add_argument('--error-column', '-e')
args = parser.parse_args()
filename = args.f... | 2.90625 | 3 |
challenges/challenge1_test.py | jamiejamiebobamie/CS-2.2-Advanced-Recursion-and-Graphs | 0 | 22490 |
import unittest
from challenge1 import *
"""class Test_Read_Graph_Method(unittest.TestCase):
def __init__(self):
super(TestingClass, self).__init__()
self.filepath = "graph_data.txt"
self.vertices, self.edges = read_graph(filepath)
def test_read(self):
self.assertTrue(self.v... | 3.578125 | 4 |
utils.py | twerkmeister/tacotron2 | 0 | 22491 | import numpy as np
from scipy.io.wavfile import read
import torch
def get_mask_from_lengths(lengths):
max_len = torch.max(lengths).item()
if torch.cuda.is_available():
ids = torch.arange(0, max_len, out=torch.cuda.LongTensor(max_len))
else:
ids = torch.arange(0, max_len, out=torch.LongTens... | 2.640625 | 3 |
plugins/_Post_Process/_XAI/lime_tabular_batch.py | isabella232/nnc-plugin | 0 | 22492 | <gh_stars>0
# Copyright 2021,2022 Sony Group 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 applicable ... | 2.0625 | 2 |
examples/applications/plot_circuits.py | ImportanceOfBeingErnest/networkx | 1 | 22493 | #!/usr/bin/env python
# circuits.py - convert a Boolean circuit to an equivalent Boolean formula
#
# Copyright 2016 <NAME> <<EMAIL>>.
#
# This file is part of NetworkX.
#
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
# information.
"""
========
Circuits
========
Convert a Boolean circuit to a... | 3.71875 | 4 |
torchtools/tensors/tensor_group.py | cjwcommuny/torch-tools | 0 | 22494 | <reponame>cjwcommuny/torch-tools
from typing import Dict, Tuple
import torch
from torch import Tensor
from torchtools.tensors.function import unsqueeze
class TensorGroup:
def __init__(self, tensors: Dict[str, Tensor], check_validity: bool=True):
self.tensors = tensors
if check_validity:
... | 2.640625 | 3 |
merlinservices/urls.py | USGS-WiM/merlin_django | 0 | 22495 | <gh_stars>0
from django.urls import path
from django.conf.urls import url, include
from django.views.generic.base import TemplateView
from merlinservices import views
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
from rest_framework_bulk.routes import BulkRouter
#r... | 1.835938 | 2 |
model.py | bruchano/StockPricePrediction | 0 | 22496 | <gh_stars>0
import torch
import torch.nn.functional as F
import datetime as dt
import pandas_datareader
class FullyConnected(torch.nn.Module):
def __init__(self, in_features, out_features, dropout=0.):
super().__init__()
self.fc = torch.nn.Linear(in_features, out_features)
self.n... | 2.609375 | 3 |
python/paddle/fluid/tests/unittests/test_python_bf16_numpy_datatype.py | L-Net-1992/Paddle | 11 | 22497 | <filename>python/paddle/fluid/tests/unittests/test_python_bf16_numpy_datatype.py<gh_stars>10-100
# Copyright (c) 2022 PaddlePaddle 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 ... | 2.640625 | 3 |
tests/api/v2/test_datasources.py | droessmj/python-sdk | 2 | 22498 | <reponame>droessmj/python-sdk
# -*- coding: utf-8 -*-
"""
Test suite for the community-developed Python SDK for interacting with Lacework APIs.
"""
import pytest
from laceworksdk.api.v2.datasources import DatasourcesAPI
from tests.api.test_base_endpoint import BaseEndpoint
# Tests
@pytest.fixture(scope="module")
d... | 2.03125 | 2 |
src/expand_mnist.py | whalsey/misc | 0 | 22499 | <reponame>whalsey/misc
"""expand_mnist.py
~~~~~~~~~~~~~~~~~~
Take the 50,000 MNIST training images, and create an expanded set of
250,000 images, by displacing each training image up, down, left and
right, by one pixel. Save the resulting file to
../data/mnist_expanded.pkl.gz.
Note that this program is memory intens... | 2.796875 | 3 |