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 |
|---|---|---|---|---|---|---|
aospy_user/calcs/mse_from_hypso_budget.py | spencerahill/aospy-obj-lib | 3 | 55300 | <gh_stars>1-10
"""MSE budget functions, with height computed using hypsometric equation."""
from indiff.advec import Upwind
from indiff.deriv import LatCenDeriv, LonCenDeriv
from .. import LAT_STR, LON_STR, PLEVEL_STR
from .advection import (zonal_advec_upwind, merid_advec_upwind,
horiz_advec_u... | 2.109375 | 2 |
YP/wardrobe.py | HelloAgni/Algorithm | 0 | 55301 | def counting_sort(array):
"""
В первой строке задано количество предметов в гардеробе: n <= 1000000
Во второй строке даётся массив, в котором указан цвет для каждого предмета.
Розовый цвет обозначен 0, жёлтый — 1, малиновый – 2.
Вывести в строку через пробел цвета предметов в правильном порядке.
... | 4.3125 | 4 |
Basic/HelloWorld.py | lishan1047/PythonTeachingSample | 0 | 55302 | # Print Hello World in Screen.
print("Hello World!")
| 1.820313 | 2 |
codes/plots.py | Wenupi/protoplanetary_disks | 0 | 55303 | #PLOTS
##################################################
#if(plot_opacity == True):
# p_plot = np.linspace(2.0,6.0,21)
# a_plot = np.logspace(np.log10(0.001),np.log10(10.),21)
#
# EXT_plot = EXT(a_plot,p_plot)
# ALB_plot = ALB(a_plot,p_plot)
#
# plt.close()
# fig = plt.figure()
# ax = fig.ad... | 2.109375 | 2 |
_vk.py | alnsokolov/soc_recon | 0 | 55304 | <reponame>alnsokolov/soc_recon
import vk_api
import os
import cache
def auth(check_saved=1):
def tfa_handler():
code = input("[!] 2FA detected! Please enter code you've just received: ")
return code, 0
def inner_auth(i_login=None, i_password=None, tfa=tfa_handler):
session = vk_api.Vk... | 2.78125 | 3 |
exercicios python/ex017.py | fabiano-filho/python | 0 | 55305 | <filename>exercicios python/ex017.py
from math import sqrt
catetoO = float(input('Qual o comprimento do cateto oposto? '))
catetoa = float(input('Qual o comprimento do cateto adjacente? '))
hipotenusa = sqrt(catetoO ** 2 + catetoa ** 2)
print('O valor da hipotenusa é {:.2f}'.format(hipotenusa))
| 4.03125 | 4 |
viberio/handlers/users/start.py | bostud/Viber_bot | 0 | 55306 | <filename>viberio/handlers/users/start.py<gh_stars>0
from aiogram.types import ParseMode
from aiogram.utils.markdown import hbold
from asyncpg import exceptions
from keyboards.default import menu_uk_kb_show
from aiogram import types
from loader import dp, db
from functions.functions import if_plus_in_phone
@dp.messag... | 2.28125 | 2 |
tests3/issue802.py | TmaxTW/pyodbc | 2,419 | 55307 | """
This tests ensures that there is no memory leakage
when params.cpp:ExecuteMulti function does conversion of Unicode to Bytes.
In ExecuteMulti function after DoExecute label
SQLExecute returns
One scenario where SQLParamData function will be used is when there is a varchar(max),
a parameter with an unknown size i... | 2.375 | 2 |
scripts/slave/recipe_modules/chromium_android/tests/run_java_unit_test_suite.py | bopopescu/chromium-build | 0 | 55308 | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'chromium',
'chromium_android',
'recipe_engine/json',
]
def RunSteps(api):
api.chromium.set_config('chromium')
api.chromium_androi... | 1.5625 | 2 |
pde/grids/boundaries/tests/test_axis.py | xuanxu/py-pde | 0 | 55309 | <filename>pde/grids/boundaries/tests/test_axis.py<gh_stars>0
'''
.. codeauthor:: <NAME> <<EMAIL>>
'''
import itertools
import pytest
from ... import UnitGrid
from ..local import BCBase
from ..axis import BoundaryPair, get_boundary_axis
def test_boundary_pair():
""" test setting boundary conditions for whole ax... | 2.4375 | 2 |
modules/city/player.py | tellurion-code/tellurion-bot-py | 9 | 55310 | <reponame>tellurion-code/tellurion-bot-py
import discord
import random
import math
import copy
import modules.city.globals as global_values
class Unit:
def __init__(self, owner):
self.owner = owner
self.level = 0
self.used = False
self.decoration = random.choice(global_values.tile_decorations)
class Player:... | 3.046875 | 3 |
2017/D03/D03Q1.py | buchasia/advent-of-code | 0 | 55311 | <filename>2017/D03/D03Q1.py
def solveQuestion(value):
n = -1
total = 0
while total < value:
n += 1
total = 4*n*n - 4*n + 1
n = n - 1
minSpiralVal = 4*n*n - 4*n + 1
difference = value - minSpiralVal
# if difference is more than n - 1
if difference < n:
retu... | 3.578125 | 4 |
src/models/decoders.py | yizhe-ang/vi-lab | 1 | 55312 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Bernoulli
from src.models.nns import Decoder
class ConvDecoder(nn.Module):
def __init__(self, z_dim):
super().__init__()
self.z_dim = z_dim
self.decoder = Decoder(
128,
... | 2.71875 | 3 |
src/main/python/setup.py | wong-justin/quick-bible | 0 | 55313 | <reponame>wong-justin/quick-bible
'''Setup (one-time) to prepare data for gui.'''
import constants
# import sys
# sys.path.insert(0, '../env/Lib/site-packages')
from striprtf.striprtf import rtf_to_text
import requests
import glob
import re
import json
from io import BytesIO
from zipfile import ZipFile
# from time i... | 2.8125 | 3 |
commands/dev/roles.py | adl212/Lacan-NTSport-Source-Code | 1 | 55314 | '''Add roles to a server'''
from discord.ext import commands
from packages.utils import Embed, ImproperType
import requests, json, os
import discord
class Command(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def roles(self, ctx):
#return a... | 2.96875 | 3 |
publishconf.py | thimy/getudata | 0 | 55315 | #!/usr/bin/env python
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'https://getudata.org'
RELATIVE_URLS = False
FEED_DOMAIN = SITEURL
FEED_ALL_ATOM = 'feeds/all.atom'
CATEGORY_FEED_ATOM = 'feeds/%s.atom'
ARTICLE_URL = 'blog/{date:%Y}/{date:%m}/{date:%d}/{slug}/'
CATEGORY_URL =... | 1.617188 | 2 |
server/chat/consumers.py | Vamshi399/project_management_tool | 0 | 55316 | import json
from channels.generic.websocket import AsyncWebsocketConsumer
#from asgiref.sync import await_to_sync
from chat.services import chat_save_message
class ChatConsumer(AsyncWebsocketConsumer):
""" handshake websocket front end """
room_name = None
room_group_name = None
async def connect(s... | 2.65625 | 3 |
src/helpers/print_blocker.py | manpen/nemo-eva | 1 | 55317 | <reponame>manpen/nemo-eva<filename>src/helpers/print_blocker.py<gh_stars>1-10
import os
import sys
class PrintBlocker(object):
'''
A context manager that blocks output for its scope.
'''
def __init__(self, *args, **kw):
self._orig = [sys.stdout, sys.stderr]
self._orig_fileno = [os.dup... | 2.96875 | 3 |
friendships/listeners.py | BattleWoLFz99/Twitchain | 0 | 55318 | <reponame>BattleWoLFz99/Twitchain<gh_stars>0
def friendship_changed(sender, instance, **kwargs):
# import 写在函数里面避免循环依赖
from friendships.services import FriendshipService
FriendshipService.invalidate_following_cache(instance.from_user_id)
| 1.640625 | 2 |
arithmetic_03/test/test_sexy_pairs.py | njoroge33/py_learn | 0 | 55319 | <filename>arithmetic_03/test/test_sexy_pairs.py
import pytest
from ..sexy_pairs import get_sexy_pairs
@pytest.mark.parametrize('limit, expected', [
(12, [(5, 11)]),
(20, [(5, 11), (7, 13), (11, 17), (13, 19)]),
(32, [(5, 11), (7, 13), (11, 17), (13, 19), (17, 23), (23, 29)])
])
def test_get_sexy_pairs(li... | 2.34375 | 2 |
migrations/versions/f7570724d06d_increase_length_of_artist_name_column.py | mukul-mehta/C-3PO | 34 | 55320 | """Increase length of artist name column
Revision ID: <KEY>
Revises: <KEY>8
Create Date: 2020-12-27 00:44:46.286228
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f<PASSWORD>'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
... | 1.546875 | 2 |
apps/sso/organisations/views/__init__.py | g10f/sso | 3 | 55321 | <filename>apps/sso/organisations/views/__init__.py
import csv
import logging
from urllib.parse import urlunsplit
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.core.exceptions import PermissionDenied
from d... | 1.523438 | 2 |
Aula35/controller/frameworkfe_controller.py | marcelabbc07/TrabalhosPython | 0 | 55322 | from dao.squad_dao import SquadDao
from model.squad import Squad
from controller.squad_controller import SquadController
class FrameworkFrontEndController:
dao=FrameworkFrontEndDao()
squad_controller=SquadController()
def listar_todos(self):
return self.dao.listar_todos()
def buscar_por_id(se... | 2.140625 | 2 |
packages/arb-compiler-evm/arbitrum/evm/contract_templates.py | JesseAbram/arbitrum | 1 | 55323 | <filename>packages/arb-compiler-evm/arbitrum/evm/contract_templates.py
# Copyright 2019-2020, Offchain Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org... | 1.5 | 2 |
ranger/commands.py | rusito-23/vifm-powerline | 1 | 55324 | <gh_stars>1-10
#!/bin/python3
# Author: <NAME>
# Notes: Custom commands for the Ranger terminal file manager
# -- IMPORTS
import os
import subprocess
import ranger
# -- COMMON CONSTANTS
NULL_ERR="2> /dev/null"
MATCH="\( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \)"
FIND="find -L {} {} -prune -o {} -print"
FZ... | 2.5625 | 3 |
biblehub/styling.py | joshpetit/biblehub | 4 | 55325 | <reponame>joshpetit/biblehub
class COLORS:
header = "\033[4m"
red = "\033[31m"
green = "\033[32m"
blue = "\033[34m"
normal = "\033[0m"
def format_verse(reference, text) -> str:
return "{blue}{reference}{normal} \n{verse}\n".format(
blue=COLORS.blue, reference=reference,
normal=... | 3.265625 | 3 |
thing/admin.py | Gillingham/evething | 33 | 55326 | from django.contrib import admin
from thing.models import APIKey, BlueprintInstance, Campaign, Character, CharacterConfig, Corporation, \
Alliance, APIKeyFailure, Asset, AssetSummary, BlueprintComponent, Blueprint, CorpWallet, \
TaskState, CharacterDetails, Contract, UserProfile, Transaction, JournalEntry, Colo... | 1.960938 | 2 |
sparse_operation_kit/sparse_operation_kit/embeddings/get_embedding_op.py | ShaunHeNJU/DeepRec-1 | 292 | 55327 | """
Copyright (c) 2021, NVIDIA 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 law or agreed to in ... | 2.125 | 2 |
asgard/api/__main__.py | pabarros/asgard-api | 3 | 55328 | from asgard.app import app
from asgard.handlers import http
app.run()
| 1.109375 | 1 |
lib/yatzy/dice.py | joelbm24/Yatzy | 2 | 55329 | <filename>lib/yatzy/dice.py<gh_stars>1-10
from lib.yatzy.die import Die
class Dice():
def __init__(self):
self.dice = [Die() for i in range(5)]
self.has_rolled = False
self.roll_amount = 0
def roll(self):
dice = [die for die in self.dice if die.kept == False]
self.has_r... | 3.296875 | 3 |
docker_sdk_api/domain/exceptions/job_exception.py | BMW-InnovationLab/BMW-Semantic-Segmentation-Training-GUI | 20 | 55330 | from domain.exceptions.application_error import ApplicationError
class ContainerNotFound(ApplicationError):
def __init__(self, additional_message: str = '', container_name: str = ''):
super().__init__("Container Name Not Found ", additional_message + '{}'.format(container_name))
class JobNotStarted(Appl... | 2.390625 | 2 |
lib/tf/math_test.py | rusty1s/embedded_gcnn | 74 | 55331 | import numpy as np
from numpy.testing import assert_equal
import scipy.sparse as sp
import tensorflow as tf
from .math import (sparse_scalar_multiply, sparse_tensor_diag_matmul,
_diag_matmul_py, _diag_matmul_transpose_py)
from .convert import sparse_to_tensor
class MathTest(tf.test.TestCase):
... | 2.421875 | 2 |
basic_input.py | Wrbrgrgl/python-with-dad | 0 | 55332 | <gh_stars>0
#!python
""" playing with some basic inut and output """
import sys
# arguments = set(sys.argv)
# print "Passed in {} arguments, with {} unique ones, they are :".format(len(sys.argv)), len(arguments))
my_peoples = set()
print "Passed in {} arguments, they are:".format(len(sys.argv) - 1)
for arg in xrange(1... | 3.09375 | 3 |
src/prepare-environment.py | bjoern-hempel/pytorch-classification | 0 | 55333 | #!/usr/bin/env python
import os
import pprint
import sys
# pretty printer settings
pp = pprint.PrettyPrinter(indent=4)
# the label
label = 'all'
# the used ratio
ratio = '90_10'
# specify the classifier path
classifier_path = 'food/binary/unbalanced'
# source path
source = 'data/prepared/{}/{}/{}'.format(classifi... | 2.84375 | 3 |
Gem/PythonTests/Automated/test_suites/periodic/OpeningFileSourceLocation_test.py | incisor/o3de-atomtest | 2 | 55334 | """
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import os
import pytest
from Automated.atom_utils import hydra_test_utils as hydra
from Automated.atom_utils.a... | 1.914063 | 2 |
docassemble/IntegratedTesting/virtual_court_support.py | plocket/docassemble-IntegratedTesting | 0 | 55335 | <gh_stars>0
from docassemble.base.functions import define, defined, value, comma_and_list, word, comma_list, DANav, url_action, showifdef
from docassemble.base.util import Address, Individual, DAEmpty, DAList, Thing, DAObject, Person, date_difference
from docassemble.assemblylinewizard.interview_generator import map_n... | 2.734375 | 3 |
MainBoilerPlate.py | okfde/bundesrat-scraper | 10 | 55336 | import pdfcutter
import helper
import json #For writing PDF Link JSON File
import os #To check if PDF Link JSON File exists
#get_session is main method for parsing session to Senats/Bundesrats Texts dict
class MainExtractorMethod:
#In: Can't init TextExtractorHolder before (missing paras in get_beschluesse_text),... | 2.8125 | 3 |
NeptuneMonitor.py | gregtyminski/Behavioral-Clonning | 0 | 55337 | import neptune
from tensorflow.keras.callbacks import BaseLogger
class NeptuneMonitor(BaseLogger):
def __init__(self, name, api_token, prj_name, params: tuple = None):
assert api_token is not None
assert prj_name is not None
super(BaseLogger, self).__init__()
self.my_name = name
... | 2.4375 | 2 |
plugins/syntax_dev/completions.py | thom1729-forks/PackageDev | 288 | 55338 | <gh_stars>100-1000
import re
import sublime
import sublime_plugin
from ..lib.scope_data import COMPILED_HEADS
from ..lib import syntax_paths
from ..lib import inhibit_word_completions
__all__ = (
'SyntaxDefCompletionsListener',
'PackagedevCommitScopeCompletionCommand'
)
# a list of kinds used to denote the... | 2.0625 | 2 |
app/devices.py | AutomationPanda/device-registry | 5 | 55339 | <reponame>AutomationPanda/device-registry
"""
This module provides a blueprint for device resources.
The resources cover basic CRUD operations.
"""
# --------------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------... | 2 | 2 |
Algorithms/Hashing.py | avyayjain/Python_Scripts | 20 | 55340 | class Solution:
# @param A : list of integers
# @return an integer
def solve(self, A):
s = set(A)
if len(s) == len(A):
return -1
for i in A:
if A.count(i) > 1:
return i
else:
return -1
| 3.125 | 3 |
server/app/test/test_post_err.py | OHMORIYUSUKE/d-anime-mylist-backend | 1 | 55341 | <filename>server/app/test/test_post_err.py
from fastapi.testclient import TestClient
from sqlalchemy import create_engine
from .config import client, DANIME_MYLISTPAGE_BASE_URL, invalid_id_page, invalid_id_db, invalid_url, id
"""
例外テスト
"""
# POST
# id が不正(mylistが存在しない)
def test_post_invalid_url_1():
... | 2.609375 | 3 |
pfn.py | jd-s/OSIS-helper | 0 | 55342 | <filename>pfn.py
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-i", "--input", dest="filename",
help="read footnotes input", metavar="FILE", required=True)
parser.add_argument("-w", "--write", dest="filenameOut",
help="write footnotes to fi... | 3.21875 | 3 |
chapter2/wok/master/wok/core/cmd/constants.py | chris-zen/phd-thesis | 1 | 55343 | <reponame>chris-zen/phd-thesis
# Environment variables
ENV_PROJECT_PATH = "PROJECT_PATH"
ENV_FLOW_PATH = "FLOW_PATH"
ENV_SCRIPT_PATH = "SCRIPT_PATH"
ENV_PLATFORM_SCRIPT_PATH = "PLATFORM_SCRIPT_PATH"
# Contexts
CTX_EXEC = "exec" | 1.078125 | 1 |
color.py | thaidem/selenium-training-po | 0 | 55344 | <gh_stars>0
from selenium.webdriver.support.color import Color
print(Color.from_string('#00ff33').rgba)
print(Color.from_string('rgb(1, 255, 3)').hex)
print(Color.from_string('blue').rgba)
| 2.796875 | 3 |
merc/features/rfc1459/kill.py | merc-devel/merc | 4 | 55345 | from merc import errors
from merc import feature
from merc import message
class KillFeature(feature.Feature):
NAME = __name__
install = KillFeature.install
@KillFeature.register_user_command
class Kill(message.Command):
NAME = "KILL"
MIN_ARITY = 2
def __init__(self, nickname, reason, *args):
self.nic... | 2.34375 | 2 |
colour/__init__.py | canavandl/colour | 1 | 55346 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Colour
======
**Colour** is a **Python** colour science package implementing a comprehensive
number of colour theory transformations and algorithms.
Subpackages
-----------
- adaptation: Chromatic adaptation transformations.
- algebra: Algebra utilities.
- appe... | 2.65625 | 3 |
exporter/operators/delete_export_collection.py | drewcassidy/blender-tools | 311 | 55347 | """Operator to delete an Export Collection by name."""
from bpy.props import StringProperty
from bpy.types import Operator
from ..functions import get_export_collection_by_name
class EmbarkDeleteExportCollection(Operator): # pylint: disable=too-few-public-methods
"""Deletes the named Export Collection, but lea... | 2.5625 | 3 |
benchmark/datasets/shakespeare/shakespeare.py | FederalLab/benchmark-lightly | 0 | 55348 | <filename>benchmark/datasets/shakespeare/shakespeare.py
# @Author : FederalLab
# @Date : 2021-09-26 10:19:57
# @Last Modified by : <NAME>
# @Last Modified time: 2021-09-26 10:19:57
# Copyright (c) FederalLab. All rights reserved.
import os
from ..simulation_dataset import SimulationDataset
fr... | 2.609375 | 3 |
pipelines/dwi_noddi/dwi_noddi_pipeline.py | aramis-lab/clinica_pipeline_noddi | 0 | 55349 | # coding: utf8
import clinica.pipelines.engine as cpe
class DwiNoddi(cpe.Pipeline):
"""NODDI model for corrected DWI datasets."""
def check_custom_dependencies(self):
"""Check dependencies that can not be listed in the `info.json` file.
"""
pass
def get_input_fields(self):
... | 2.25 | 2 |
jira_bot.py | LeonStoldt/JiraBot-for-Mattermost | 1 | 55350 | import sys
from mattermostdriver import Driver
from jira import JIRA
from datetime import datetime
import urllib3
import json
import re
import webhook
import requests
def getAdjustDict():
adjust_dict = {'h1\. ': '## ',
'h2\. ': '## ',
'h3\. ': '### ',
'h4\.... | 2.140625 | 2 |
test/test_types.py | yilei/cerealizer | 0 | 55351 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Cerealizer
# Copyright (C) 2005-2006 <NAME>
#
# This program is free software.
# It is available under the Python licence.
import imp
import unittest
import cerealizer
class TestBasicType(unittest.TestCase):
def setUp(self):
self.obj = [1, 2, "jiba"]
... | 2.453125 | 2 |
debug/servotest.py | Plasmakatt/farmerextreme | 0 | 55352 | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
p = GPIO.PWM(11,50)
p.start(7.5)
try:
while True:
# MID
#p.ChangeDutyCycle(7.5)
#time.sleep(1)
# LEFT
p.ChangeDutyCycle(20)
time.sleep(1)
# RIGHT
... | 2.921875 | 3 |
tests/unicode/unicode_index.py | learnforpractice/micropython-cpp | 13,648 | 55353 | <filename>tests/unicode/unicode_index.py
print("Привет".find("т"))
print("Привет".find("П"))
print("Привет".rfind("т"))
print("Привет".rfind("П"))
print("Привет".index("т"))
print("Привет".index("П"))
| 1.898438 | 2 |
src/lstm_vae/trainers.py | hsmohammed/lstm_vae | 0 | 55354 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 22 13:13:06 2021
@author: hossam
"""
from base import BaseTrain
import numpy as np
import matplotlib.pylab as plt
from matplotlib.pyplot import savefig
from scipy.stats import multivariate_normal
class vaeTrainer(BaseTrain):
def __init__(self, ... | 2.1875 | 2 |
ats_helpers.py | Mondrik/atseo | 0 | 55355 | import astropy.io.fits as pft
import numpy as np
from astropy.time import Time
import itertools
from astropy.stats import sigma_clipped_stats
from scipy.signal import convolve
def group_image_pairs(file_list, by_next=False, by_exptime=False):
if by_next:
image_pair_lists = [[file_list[2*i], file_list[2*i+... | 2.171875 | 2 |
pixelpuncher/player/migrations/0020_auto_20160604_1602.py | ej2/pixelpuncher | 0 | 55356 | <reponame>ej2/pixelpuncher
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-04 16:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('player', '0019_avatarlayer_playerav... | 1.59375 | 2 |
pytexcount/tests.py | pierre-24/pytexcount | 0 | 55357 | import unittest
import pytexcount.parser as P
from pytexcount.count import WordCounter
class LexerTestCase(unittest.TestCase):
def test_lexer_base(self):
expected = [
P.Token(P.TokenType.CHAR, 'a'),
P.Token(P.TokenType.SPACE, ' '),
P.Token(P.TokenType.BACKSLASH, '\\')... | 3 | 3 |
src/rez/tests/test_imports.py | maxnbk/rez | 0 | 55358 | <filename>src/rez/tests/test_imports.py
# Copyright Contributors to the Rez project
#
# 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
#
# Unle... | 1.929688 | 2 |
db_models.py | fablab-ka/strichliste | 0 | 55359 | <filename>db_models.py
from peewee import *
database = SqliteDatabase('datenbank.db')
class UnknownField(object):
def __init__(self, *_, **__): pass
class BaseModel(Model):
class Meta:
database = database
class Customer(BaseModel):
id = AutoField()
email = TextField(null=True, unique=True)
... | 2.9375 | 3 |
package/utils/image.py | MikeCun/PersonReID | 1 | 55360 | <gh_stars>1-10
import numpy as np
from PIL import Image
import cv2
from os.path import dirname as ospdn
from .file import may_make_dir
def make_im_grid(ims, n_rows, n_cols, space, pad_val):
"""Make a grid of images with space in between.
Args:
ims: a list of [3, im_h, im_w] images
n_rows: num of r... | 3.0625 | 3 |
config.py | LaktionovVladyslav/HelpexApp | 0 | 55361 | import os
class Config:
SQLALCHEMY_TRACK_MODIFICATIONS = False
CSRF_ENABLED = True
FLASK_DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'mysql+mysqlconnector://root:root@localhost:8889/lak_db')
DATABASE_URL = os.environ.get('CLEARDB_DATABASE_URL', 'mysql+mysqlconnector://roo... | 1.773438 | 2 |
qual_id/groups/minimal.py | gabrielbarker/qual-id | 9 | 55362 | <gh_stars>1-10
from ..categories import *
from .group import Group
class Minimal(Group):
_name = "minimal"
_categories = [
Adjective,
Animal,
Bird,
Cake,
Color,
Food,
Fruit,
Geography,
Instrument,
Planet,
Tea,
Vehi... | 2 | 2 |
libs/yowsup/yowsup/yowsup/layers/protocol_chatstate/protocolentities/chatstate.py | akshitpradhan/TomHack | 22 | 55363 | from yowsup.structs import ProtocolEntity, ProtocolTreeNode
class ChatstateProtocolEntity(ProtocolEntity):
'''
INCOMING
<chatstate from="<EMAIL>">
<{{composing|paused}}></{{composing|paused}}>
</chatstate>
OUTGOING
<chatstate to="<EMAIL>">
<{{composing|paused}}></{{composing|paused}}... | 2.5625 | 3 |
Testing/Elements.py | freder/PageBotExamples | 5 | 55364 | <filename>Testing/Elements.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T E X A M P L E S
#
# Copyright (c) 2017 <NAME> <https://github.com/thomgb>
# www.pagebot.io
# Licensed under MIT conditions
#
# ... | 2.359375 | 2 |
test_script/test_sav_h5py_mha_multilabel.py | zyxwvu321/CT_seg | 2 | 55365 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 12 09:36:00 2019
@author: minjie
"""
import SimpleITK as sitk
import numpy as np
from pathlib import Path
import os
import cv2
import pydicom
import h5py
from scipy.ndimage import binary_dilation
fn1 = 'resources/CT/01/data/A_1.mha'
fn2 = 'resour... | 2.15625 | 2 |
server.py | martinetd/pipes-and-paper | 2 | 55366 | import asyncio
import argparse
import http
import json
import os
import time
import subprocess
import sys
import websockets
def check(rm_hostname):
try:
model = subprocess.run(
[
"ssh",
"-o",
"ConnectTimeout=2",
rm_hostname,
... | 2.515625 | 3 |
RpiRoombaCode/manualControl.py | wangfanxin/UVBot | 0 | 55367 | from pynput import keyboard
from pycreate2 import Create2
import time
#Robot initialization________________________________________________________________
if __name__ == "__main__":
port = '/dev/ttyUSB0'
baud = {
'default': 115200,
'alt': 19200 # shouldn't need this unless you accidentally s... | 2.90625 | 3 |
avrofilter/avrofilter.py | CAIDA/hermes-avrofilter | 0 | 55368 | # Copyright 2019 The Regents of the University of California.
#
# 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.703125 | 2 |
aperturesynthesis2.py | harsimranss/Summer-Research-Project-Code | 0 | 55369 | <gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
# Setting initial variables
#speed of light
c=3*(10**8)
# boltzman constant
kb=1.38*(10**-23)
#integration Time in Seconds
int_time=10**(-3)
# centre of frequency range in Hz
freq_centre=3*(10**9)
# baseline length ... | 2.515625 | 3 |
bin/config.py | database64128/rclone | 18,121 | 55370 | <filename>bin/config.py
#!/usr/bin/env python3
"""
Test program to demonstrate the remote config interfaces in
rclone.
This program can simulate
rclone config create
rclone config update
rclone config password - NOT implemented yet
rclone authorize - NOT implemented yet
Pass the desired action ... | 2.71875 | 3 |
nozomi/http/character.py | thatch/nozomi | 0 | 55371 | """
Nozomi
Character Module
author: <EMAIL>
"""
from nozomi.temporal.time import NozomiTime
from nozomi.security.ip_address import IpAddress
from nozomi.http.user_agent import UserAgent
from nozomi.http.accept_language import AcceptLanguage
from nozomi.http.headers import Headers
from nozomi.ancillary.configuration imp... | 2.15625 | 2 |
main.py | the-lay/ulauncher-spotify-api | 36 | 55372 | # Fix for #17 (and ulauncher's #703): explicitly defining Gdk version
import gi
gi.require_version('GLib', '2.0')
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
gi.require_version('GObject', '2.0')
gi.require_version('Gio', '2.0')
gi.require_version('GdkX11', '3.0')
gi.require_version('GdkPixbuf', '2... | 1.34375 | 1 |
tests/__init__.py | smsapicom/smsapicom-contacts-python-client | 0 | 55373 | <filename>tests/__init__.py<gh_stars>0
# -*- coding: utf-8 -*-
import unittest
import pkgutil
import requests
from smsapicontacts.compat import is_py26
from tests.doubles import request_fake, TestContactsApi
requests.request = request_fake
api_username = 'must_not_be_empty'
api_password = '<PASSWORD>'
class Cont... | 2.5 | 2 |
aiohappybase/connection.py | python-happybase/aiohappybase | 14 | 55374 | """
AIOHappyBase connection module.
"""
import os
import logging
from typing import AnyStr, List, Dict, Any
from thriftpy2.contrib.aio.transport import (
TAsyncBufferedTransportFactory,
TAsyncFramedTransportFactory,
)
from thriftpy2.contrib.aio.protocol import (
TAsyncBinaryProtocolFactory,
TAsyncComp... | 2.40625 | 2 |
aoj/26/aoj2600.py | knuu/competitive-programming | 1 | 55375 | N, W, H = map(int, input().split())
row, col = [0] * (H + 1), [0] * (W + 1)
for _ in range(N):
x, y, w = map(int, input().split())
row[max(0, y - w)] += 1
row[min(H, y + w)] -= 1
col[max(0, x - w)] += 1
col[min(W, x + w)] -= 1
for i in range(H):
row[i + 1] += row[i]
for i in range(W):
col[i ... | 2.84375 | 3 |
mir_proj/songs/migrations/0006_song_spotify_id.py | gegiantas/MIR-mobile-app | 0 | 55376 | # Generated by Django 3.1.7 on 2021-03-09 12:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('songs', '0005_auto_20210309_1203'),
]
operations = [
migrations.AddField(
model_name='song',
name='spotify_id',
... | 1.664063 | 2 |
Contributions/PowerRecursion.py | sattwik21/Hacktoberfest2021-1 | 215 | 55377 | <reponame>sattwik21/Hacktoberfest2021-1<filename>Contributions/PowerRecursion.py<gh_stars>100-1000
# Calculates a^b
def power(a, b):
if b == 0:
return 1
b -= 1
return a*power(a, b)
x = int(input())
y = int(input())
print(power(x, y))
| 3.015625 | 3 |
d6p1.py | Maselkov/advent-of-code | 0 | 55378 | <filename>d6p1.py
import sys
data = []
# The default recursion limit is too low for us
# This is probably an extremally inelegant solution. Oh well.
sys.setrecursionlimit(10000000)
ROOT_NAME = "COM"
def find_children(identifier):
children = []
for parent, child in data:
if parent == identifier:
... | 2.953125 | 3 |
routines/show.py | fuzzythecat/ROI-Detection | 3 | 55379 | import sys
sys.path.append("../modules/")
import numpy as np
import matplotlib.pyplot as plt
from skimage import feature
from utils import conf
if __name__ == "__main__":
filename = conf.dir_data_temp + "slice.npy"
img = np.load(filename)
filename = conf.dir_data_mask + "endocardial_mask.npy"
endoca... | 2.34375 | 2 |
bayes_implicit_solvent/continuous_parameter_experiments/test_predict.py | openforcefield/bayes-implicit-solvent | 4 | 55380 | <reponame>openforcefield/bayes-implicit-solvent<gh_stars>1-10
import numpy as np
from bayes_implicit_solvent.molecule import Molecule
from simtk import unit
def sample_path_to_unitted_snapshots(path_to_npy_samples):
xyz = np.load(path_to_npy_samples)
traj = [snapshot * unit.nanometer for snapshot in xyz]
... | 2.09375 | 2 |
ptpy/extensions/sony.py | coon42/sequoia-ptpy | 46 | 55381 | '''This module extends PTPDevice for Sony devices.
Use it in a master module that determines the vendor and automatically uses its
extension. This is why inheritance is not explicit.
'''
from contextlib import contextmanager
from construct import Container, Struct, Range, Computed, Enum, Array, PrefixedArray, Pass, Ex... | 2.53125 | 3 |
alphaconf/arg_parser.py | kmagusiak/alphaconf | 0 | 55382 | import functools
import itertools
from typing import Callable, Dict, Iterable, List, Union
from omegaconf import DictConfig, MissingMandatoryValue, OmegaConf
class InvalidArgumentError(Exception):
"""Invalid argument on command line"""
pass
class OptionHandler:
"""Handling an option"""
arg: List[... | 2.984375 | 3 |
lrp/__init__.py | nielsrolf/tensorflow-lrp | 9 | 55383 | <gh_stars>1-10
from .train import *
from .evaluate_rule import *
from . import data
| 0.988281 | 1 |
Multiple Linear Regression.py | Hassenamri005/Startups-profit-Application-using-Multiple-Linear-Regression | 2 | 55384 | <reponame>Hassenamri005/Startups-profit-Application-using-Multiple-Linear-Regression<filename>Multiple Linear Regression.py
#import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
#i... | 3.78125 | 4 |
moneyland/settings_prod.py | namlook/moneyland | 1 | 55385 | <filename>moneyland/settings_prod.py
from .settings import *
DEBUG = False
ALLOWED_HOSTS = ["*"]
STATIC_ROOT = "/home/moneyland/moneyland/public"
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
PIPELINE['CSS_COMPRESSOR'] = 'pipeline.compressors.NoopCompressor'
PIPELINE['JS_COMPRESSOR'] = 'pipeline.compresso... | 1.101563 | 1 |
common_utils.py | khanfarhan10/SmartGoogleForms | 3 | 55386 | <filename>common_utils.py
!pip install kaggle
import os
def get_size(path = os.getcwd()):
print("Calculating Size: ",path)
total_size = 0
#if path is directory--
if os.path.isdir(path):
print("Path type : Directory/Folder")
for dirpath, dirnames, filenames in os.walk(path):
for f... | 2.46875 | 2 |
tensorboard/data/server/pip_package/install.py | Digitaltransform/tensorboard | 6,139 | 55387 | <reponame>Digitaltransform/tensorboard<gh_stars>1000+
# 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.o... | 2.15625 | 2 |
backend_final/apartacho/properties/apps.py | cenavia/skylynx | 3 | 55388 | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class PropertiesConfig(AppConfig):
name = 'apartacho.properties'
verbose_name = _("Properties")
| 1.304688 | 1 |
presidio-analyzer/tests/test_uk_nhs.py | kant/presidio | 0 | 55389 | from analyzer import matcher, common_pb2
from tests import *
fieldType = common_pb2.FieldTypes()
fieldType.name = common_pb2.FieldTypesEnum.Name(common_pb2.UK_NHS)
types = [fieldType]
def test_valid_uk_nhs():
num = '401-023-2137'
results = match.analyze_text(num, types)
assert len(results) == 1
asser... | 2.796875 | 3 |
examples/agent_ml5_v2/agent_ml5_v2.py | jensstrabo/CAMD | 33 | 55390 | <reponame>jensstrabo/CAMD
# Copyright Toyota Research Institute 2019
from camd.campaigns.base import Campaign
from sklearn.neural_network import MLPRegressor
from camd.agent.stability import AgentStabilityML5
from camd.analysis import StabilityAnalyzer
from camd.experiment.base import ATFSampler
from camd.utils.data i... | 2.53125 | 3 |
Basic/Calculate Factorial of A Number/SolutionByEnthusiastDeveloper.py | rajethanm4/Programmers-Community | 261 | 55391 | '''
Program Description: Calculate factorial of a given number
'''
def calculate_factorial(n):
if n == 0:
return 1
if n < 0:
raise ValueError
fact = 1
for x in range(1,n+1):
fact *= x
return fact
print('N = ', end='')
try:
result = calculate_factorial(int(input()))
print('Output =', result)
except Val... | 4.375 | 4 |
tests/__init__.py | jmosbacher/rframe | 0 | 55392 | """Unit test package for rframe."""
| 0.878906 | 1 |
Advance_Python/Class_&_Objects/constructor_overriding.py | siddharth-143/Python | 0 | 55393 | <reponame>siddharth-143/Python
class A:
def __init__(self):
print('base class constructor ')
class B(A):
def __init__(self):
super().__init__()
print('child class constructor ')
b1=B()
| 3.8125 | 4 |
tira-application/src/tira/urls.py | maexe/tira | 0 | 55394 | <reponame>maexe/tira
from django.urls import path
from . import views
from . import actions
urlpatterns = [
path('', views.index, name='index'),
path('task', views.index, name='tasks'),
path('tasks', views.index, name='tasks'),
path('task/<str:task_id>', views.task_detail, name='task-detail'),
pat... | 2.015625 | 2 |
tests/framework/test_settings.py | praus/shapy | 54 | 55395 | import unittest
import imp
import sys
import shapy
class TestSettings(unittest.TestCase):
def setUp(self):
self.settings = imp.new_module('test_settings')
sys.modules.update(test_settings=self.settings)
setattr(self.settings, 'UNITS', 'override')
setattr(self.settings, 'NEW_OPTION'... | 2.71875 | 3 |
chapter-5/11. Math_quiz.py | KwabenaYeboah/Solved-python-programming-Challenges-Source-code | 0 | 55396 | #This program displays a simple math quiz
import random
def main():
number1 = random.randint(1,350)
number2 = random.randint(1,350)
correct_answer = calculate_correct_answer(number1,number2)
print('\t',number1,'\n+\t',number2)
question = int(input('Enter the answer : '))
check_answer(question,c... | 3.9375 | 4 |
network/Reptile/Basic01.py | walkingtyphoon/Python-workspace | 0 | 55397 | from urllib import request
from urllib import parse
head = request.urlopen("https://mp.weixin.qq.com/s?__biz=MzU3NTc0NzE0Mw==&mid=2247483739&idx=1&sn"
"=e62a61120c73ebb93029a2897ca60ccd&chksm"
"=fd1f2473ca68ad658b9b0388e6fc122951812ba08ada771f3acc4f1f25953de92df837f21795&m... | 2.734375 | 3 |
make_tsne_figs.py | lightonai/contrastive-embeddings-for-neural-architectures | 13 | 55398 | <filename>make_tsne_figs.py
import argparse
parser = argparse.ArgumentParser(description='Generate prediction plot based on subset of samples')
parser.add_argument('path_EPDJMs', type=str)
parser.add_argument('task', choices=['CIFAR10', 'CIFAR100', 'ImageNet16'])
parser.add_argument('search_space', choices=['201', 'na... | 2.15625 | 2 |
geryonfuse/logger/geryon_logger.py | diegojromerolopez/geryon-fs | 0 | 55399 | <filename>geryonfuse/logger/geryon_logger.py
import configparser
import logging
def __get_logging_level(level: str) -> int:
level_uppercase = level.upper()
if level_uppercase == "CRITICAL" or level_uppercase == "FATAL":
return logging.CRITICAL
if level_uppercase == "ERROR":
return logging.... | 2.359375 | 2 |