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 |
|---|---|---|---|---|---|---|
exercises/solution_F4.py | dataXcode/IPP | 0 | 48100 | house = [ ['hallway', 14.35],
['kitchen', 15.0],
['living room', 19.0],
['bedroom', 12.5],
['bathroom', 8.75] ]
# Code the for loop
for x in house:
print(str(x[0]) + ' area is ' + str(x[1]) + 'm')
| 3.75 | 4 |
user/models.py | isakcodes/website | 0 | 48101 | import uuid
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
from django.core.exceptions import ValidationError
from django.db import models
from django.utils import timezone
from versatileimagefield.fields import VersatileImageField
from app.utils import is_email_organiser
from user.enums ... | 2.3125 | 2 |
level_3/module/dragon_module.py | yogeshwari-vs/2D-Paramotoring-Pygame | 2 | 48102 | <gh_stars>1-10
import math
import os
import pygame
import random
from level_3.module import background_module
from level_3.module import foreground_module
from level_3.module import player_module
class Dragon():
"""
Describes dragon obstacles.
"""
# Loading dragon images
num_of_imgs = 7
list_of_lists = []
pat... | 3.296875 | 3 |
alembic/versions/9e04ca8f19e8_removed_wishlist_item_unique_name_.py | kirill-kundik/py-Junction-Backend | 0 | 48103 | <gh_stars>0
"""removed wishlist item unique name constraint
Revision ID: 9e04ca8f19e8
Revises: <PASSWORD>
Create Date: 2019-11-16 16:50:49.691635
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9e04ca8f19e8'
down_revision = '<PASSWORD>'
branch_labels = None
de... | 1.054688 | 1 |
pyramid_debugtoolbar/tests/test_init.py | rollbar/pyramid_debugtoolbar | 0 | 48104 | import unittest
from pyramid import testing
class Test_parse_settings(unittest.TestCase):
def _callFUT(self, settings):
from pyramid_debugtoolbar import parse_settings
return parse_settings(settings)
def test_it(self):
panels = ('pyramid_debugtoolbar.tests.test_init.DummyPanel\n'
... | 2.609375 | 3 |
Server/manage.py | lanlian7/MyServer | 0 | 48105 | <reponame>lanlian7/MyServer
#-*- coding:utf-8-*-
from app import app
__author__='Doris'
__date__='2017.4.16'
__version__='1.0'
"""
call function run to start web test
"""
if __name__ == '__main__':
app.run(debug=True)
| 1.414063 | 1 |
vuln_server/vulnerabilities/subprocess_vuln.py | denny00786/CASoftwareDevelopment | 1 | 48106 | import subprocess
from vuln_server.outputgrabber import OutputGrabber
from flask import request, redirect, render_template
class SubprocessVuln():
def bypass(self):
if request.method == 'POST':
# Check if data is not empty, post forms has all params defined
# which may be empty a... | 2.34375 | 2 |
tests/test_resource.py | luhn/pyramid-resource | 1 | 48107 | import pytest
from pyramid_resource import Resource
def test_default_lookup():
class SubResource(Resource):
pass
class MyResource(Resource):
__children__ = {
"sub": SubResource,
}
root = MyResource("request")
sub = root["sub"]
assert isinstance(sub, SubResour... | 2.53125 | 3 |
setup.py | not-raspberry/planningpoker | 0 | 48108 | #!/usr/bin/env python3
"""Planningpoker project setup."""
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
# Requirements specified up to the minor version to allow bugfixes to be automatic... | 1.601563 | 2 |
news_cqu.py | Tiangewang0524/cqu_spider | 0 | 48109 | """
爬取原网页的html,过滤新闻内容并重新拼接,保留原网页样式。
"""
import pymysql
import datetime
import requests
from lxml import etree
import pdfkit
import os
import time
import json
import re
# 敏感词过滤类,AC自动机
import Ac_auto
# 任务id
task_id = 2
# 爬取的地址和名称
spider_url = 'https://news.cqu.edu.cn/newsv2/'
spider_name = '重大新闻网'
# 爬虫程序爬取主页和首页的运行日期
... | 2.609375 | 3 |
simple_mean_calculator.py | MumuNiMochii/Dumb_Dump | 1 | 48110 | <gh_stars>1-10
lst = []
num = int(input("Input the number of items: "))
for n in range(num):
# Arguments for Ordinal Numbers in a Set
ord = str(n+1)
if n == 0:
ord += "st"
elif n == 1:
ord += "nd"
elif n == 2:
ord += "rd"
else:
ord += "th"
numbers = int(input(... | 3.921875 | 4 |
update_description.py | ronioncloud/zimatise | 5 | 48111 | import pandas as pd
import os
import shutil
def get_list_zips_file_path(folder_path):
list_file_path_zip = []
for root, _, files in os.walk(folder_path):
for file_ in files:
file_lower = file_.lower()
if file_lower.endswith(tuple(['.zip', '.rar', '.7z'])):
file... | 2.765625 | 3 |
tests/cases/doc/test_parametrize_alt.py | broglep-work/python-pytest-cases | 213 | 48112 | # Authors: <NAME> <<EMAIL>>
# + All contributors to <https://github.com/smarie/python-pytest-cases>
#
# License: 3-clause BSD, <https://github.com/smarie/python-pytest-cases/blob/master/LICENSE>
import pytest
from pytest_cases import parametrize_with_cases
def case_sum_one_plus_two():
a = 1
b = 2
... | 2.953125 | 3 |
botutils/adds.py | Xinverse/BOTC-Bot | 1 | 48113 | """Contains functions to handle roles and permissions"""
import ast
import configparser
import globvars
Config = configparser.ConfigParser()
Config.read("config.INI")
LOBBY_CHANNEL_ID = Config["user"]["LOBBY_CHANNEL_ID"]
SERVER_ID = Config["user"]["SERVER_ID"]
ALIVE_ROLE_ID = Config["user"]["ALIVE_ROLE_ID"]
DEAD_ROL... | 2.53125 | 3 |
__main__.py | glofflive/podpiska | 0 | 48114 | # -*- coding: utf-8 -*-
from settings import *
from messages import *
from functions import *
import time
import random
import sqlite3
from aiogram import asyncio
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
from aiogram.utils.helper import Helper, HelperMo... | 1.851563 | 2 |
src/sensationdriver/message.py | sebastianludwig/SensationDriver | 0 | 48115 | import asyncio
import time
import itertools
from . import pipeline
from . import protocol
class Splitter(pipeline.Element):
def __init__(self, downstream=None, logger=None):
super().__init__(downstream=downstream, logger=logger)
self.buffer = bytes()
self.buffer_length = 0
self.st... | 2.671875 | 3 |
chatServer/chatServerConstants.py | odeke-em/restAssured | 1 | 48116 | # Author: <NAME> <<EMAIL>>,
# <NAME> <<EMAIL>>
# Copyright (c) 2014
# Table name strings
MESSAGE_TABLE_KEY = "Message"
RECEIPIENT_TABLE_KEY = "Receipient"
MESSAGE_MARKER_TABLE_KEY = "MessageMarker"
MAX_NAME_LENGTH = 60 # Arbitrary value
MAX_BODY_LENGTH = 200 # Arbitrary value
MAX_ALIAS_LENGTH = 60 # Arbitrar... | 1.125 | 1 |
pytest-verbose-parametrize/tests/integration/parametrize_ids/tests/unit/test_duplicates.py | RaiVaibhav/pytest-plugins | 282 | 48117 | import pytest
@pytest.mark.parametrize(('x', 'y', ), [(0, [1]), (0, [1]), (str(0), str([1]))])
def test_foo(x, y):
assert str([int(x) + 1]) == y
| 2.609375 | 3 |
tests/ut/python/parallel/test_auto_parallel_two_bn.py | tjulitianyi1997/mindspore | 2 | 48118 | import numpy as np
from mindspore import context
import mindspore as ms
import mindspore.nn as nn
from mindspore.ops import operations as P
from mindspore import Tensor
from mindspore.common.api import _executor
from tests.ut.python.ops.test_math_ops import VirtualLoss
from mindspore.parallel import set_algo_parameters... | 2.125 | 2 |
modules/web_caller.py | tkh/test-examples | 2 | 48119 | <filename>modules/web_caller.py
import requests
GOOGLE_URL = 'http://www.google.com'
def get_google():
return requests.get(GOOGLE_URL)
| 2.421875 | 2 |
laygo/generators/serdes/ser_2to1_halfrate_layout_generator_woM5.py | tinapiao/Software-IC-Automation | 26 | 48120 | <filename>laygo/generators/serdes/ser_2to1_halfrate_layout_generator_woM5.py<gh_stars>10-100
#!/usr/bin/python
########################################################################################################################
#
# Copyright (c) 2014, Regents of the University of California
# All rights reserved.
#... | 1.242188 | 1 |
pile.py | yehudareisler/risky-game | 3 | 48121 | import random
from card import Card, CardType
class Pile:
def __init__(self, cards):
self.cards = cards
def __getitem__(self, key):
return self.cards[key]
def __str__(self):
representation = f'Pile with {len(self.cards)} cards:\n'
for card in self.cards:
rep... | 3.53125 | 4 |
custom_components/home_connect_neo/sensor.py | FlavorFx/bsh_home_connect | 0 | 48122 | <reponame>FlavorFx/bsh_home_connect
"""Sensor for Home Connect"""
import logging
from homeassistant.helpers.entity import Entity # pylint: disable=import-error, no-name-in-module
from .const import DOMAIN
from .entity import HomeConnectEntity
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass, ... | 2.1875 | 2 |
www/cgi-bin/udpipe.py | alvelvis/Interrogat-rio | 0 | 48123 | <gh_stars>0
#!/usr/bin/env python3
print('Content-type:text/html\n\n')
import os
import cgi, cgitb
cgitb.enable()
import estrutura_dados
import functions
modelo = functions.modelo
udpipe = functions.udpipe
html = '<html><head><script src=\"../interrogar-ud/jquery-latest.js\"></script><script src=\"../interrogar-ud/r... | 2.46875 | 2 |
app/__init__.py | paulmunyao/Daily-Dossier-News | 0 | 48124 | from flask import Flask
from config import DevelopmentConfig
app = Flask(__name__)
app.config.from_object(DevelopmentConfig)
from app import routes,errors | 1.695313 | 2 |
tensorflow-keras-lab/99. lecture_code/classificationEx.py | hojeong3709/RL | 0 | 48125 | import tensorflow as tf
import numpy as np
tf.set_random_seed(777)
data = np.loadtxt('data-04-zoo.csv', delimiter=',', dtype=np.float32)
x_data = data[:, 0:-1]
y_data = data[:, [-1]]
x = tf.placeholder(dtype=tf.float32, shape=[None, 16])
y = tf.placeholder(dtype=tf.int32, shape=[None, 1])
y_ont_hot = tf.one_hot(y, 7)... | 2.6875 | 3 |
baekjoon/python/findPrimeNumberInRange.py | yskang/AlgorithmPractice | 0 | 48126 | <filename>baekjoon/python/findPrimeNumberInRange.py
# Prime Number
# https://www.acmicpc.net/problem/2581
import sys
rl = lambda:sys.stdin.readline()
start = int(rl())
end = int(rl())
if start == 1:
start = 2
target = list(range(2, end+1))
s = 2
while True:
target = list(filter(lambda x: x % s != 0, ... | 3.390625 | 3 |
dlib_face_detector.py | IS2AI/thermal-facial-landmarks-detection | 4 | 48127 | # USAGE
# python dlib_face_detector.py --images dataset/gray/test/images --detector models/dlib_face_detector.svm
# import the necessary packages
from imutils import face_utils
from imutils import paths
import numpy as np
import imutils
import argparse
import imutils
import time
import dlib
import cv2
import os
# c... | 2.890625 | 3 |
ObejctDetection.py | siddharthSharma102/YOLOv3 | 0 | 48128 | <reponame>siddharthSharma102/YOLOv3
# Before giving the image to the YOLO we need to create a blob, which is a way of extracting features.
import cv2
import numpy as np
# Load YOLO Algorithm.
net = cv2.dnn.readNet("D:/PYTHON/Resume Proj/YOLO/yolov3.weights",
"D:/PYTHON/Resume Proj/YOLO/... | 3.4375 | 3 |
parse_genbank_file_data.py | tmavrich/mavrich_hatfull_nature_micro_2017 | 1 | 48129 | <filename>parse_genbank_file_data.py
#To extract all features and/or header information in a genbank file
#<NAME>
#Import modules
import os, sys, time, csv
from Bio import SeqIO
from Bio.Alphabet import IUPAC
from ete3 import NCBITaxa
# Verify the correct arguments are provided, otherwise print description of the ... | 3.21875 | 3 |
test_func.py | indofanat/inliner | 72 | 48130 | from inliner import inline
class SillyGetterSetter(object):
def __init__(self, stuff):
self.stuff = stuff
@inline
def setStuff(self, obj):
self.stuff = obj
@inline
def getStuff(self):
return self.stuff
@inline
def add_stuff(x, y):
return x + y
def add_lots_of_number... | 3.15625 | 3 |
src/asphalt/serialization/marshalling.py | Asphalt-framework/asphalt-serialization | 0 | 48131 | <filename>src/asphalt/serialization/marshalling.py
from __future__ import annotations
from typing import Any
from asphalt.core import qualified_name
def default_marshaller(obj: Any) -> Any:
"""
Retrieve the state of the given object.
Calls the ``__getstate__()`` method of the object if available, other... | 2.640625 | 3 |
tests/test_store_creation.py | bjoernmeier/storefact | 16 | 48132 | <gh_stars>10-100
from storefact._store_creation import create_store
import pytest
def test_create_store_azure(mocker):
# Mock HAzureBlockBlobStore also here, becase otherwise it will try to inherit from
# the mock object `mock_azure` created below, which will fail.
mock_hazure = mocker.patch("storefact._h... | 2.09375 | 2 |
app/views/users.py | MatheusMullerGit/api-rest-flask-jwt-authentication | 0 | 48133 | <filename>app/views/users.py
from werkzeug.security import generate_password_hash
from app import db
from flask import request, jsonify
from ..models.users import Users, user_schema, users_schema
def get_users():
name = request.args.get('name')
if name:
users = Users.query.filter(Users.name.like(f'%{n... | 2.671875 | 3 |
recipes/Python/580741_ctypes_CDLL_automatic_errno/recipe-580741.py | tdiprima/code | 2,023 | 48134 | import ctypes
class CDLL_errno(ctypes.CDLL):
class _FuncPtr(ctypes._CFuncPtr):
_flags_ = ctypes._FUNCFLAG_CDECL | ctypes._FUNCFLAG_USE_ERRNO
_restype_ = ctypes.c_int
def __call__(self, *args):
ctypes.set_errno(0)
try:
return ctypes._CFuncPtr.__call_... | 2.375 | 2 |
CH02/2.5.py | MonoHaru/Deep-Learning-from-Scratch_2 | 0 | 48135 | # 2.5 정리
# 이번 장에서는 자연어를 대상으로,
# 특히 컴퓨터에게 '단어의 의미'를 이해하기 위한 주제로 진행함
# 시소러스 기법
'''
단어들의 관련성을 사람이 수작업으로 하나씩 정의한다.
이 작업은 매우 힘들고 (느낌의 미세한 차이를 나타낼 수 없다 등) 표현력에도 한계가 있다.
'''
# 통계 기반 기법
'''
말뭉치로부터 단어의 의미를 자동으로 추출하고, 그 의미를 벡터로 표현한다.
구체적으로
1. 단어의 동시발생 행렬을 만든다.
2. PPMI 행렬로 변환한다.
3. 안정... | 2.640625 | 3 |
encrypt.py | mtlynch/simple-encrypt | 0 | 48136 | <filename>encrypt.py
#!/usr/bin/python3
import argparse
import base64
from cryptography import fernet
from cryptography.hazmat import backends
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf import pbkdf2
import getpass
import secrets
import sys
def _derive_key(password: byt... | 2.765625 | 3 |
mixly_arduino/sample/mixpy/人工智能Py/09词法分析-2.py | wecake/Mixly_Arduino | 118 | 48137 | <filename>mixly_arduino/sample/mixpy/人工智能Py/09词法分析-2.py<gh_stars>100-1000
import aip
client = aip.AipNlp("Enter Your APP_ID", "Enter Your API_KEY", "Enter Your SECRET_KEY")
word= {"r":"代词", "v":"动词", "nr":"名词"}
s = ""
for i in client.lexer("我爱米思齐", options={})["items"]:
s = s + i["item"]
s = s + "【"
s = s... | 2.859375 | 3 |
gen_page.py | gerardrbentley/knowledge-graph | 1 | 48138 | <filename>gen_page.py
import argparse
import os
from datetime import datetime
def gen_frontmatter(path, title):
return f"""---
path: "/{path}"
date: "{datetime.now().strftime("%Y-%m-%d")}"
title: "{title}"
tags: ['{title}']
excerpt: "Notes on {title}"
---
{title} is a very interesting topic!
"""
def main()... | 2.90625 | 3 |
tests/test_signature_handler.py | dmuhs/web3data-py | 8 | 48139 | <gh_stars>1-10
from itertools import product
import pytest
import requests_mock
from web3data.chains import Chains
from web3data.exceptions import APIError
from web3data.handlers.token import TokenHandler
from . import API_PREFIX, CHAINS, HEADERS, RESPONSE
LIMITED_CHAINS = (
Chains.BCH,
Chains.BSV,
Chai... | 2.078125 | 2 |
data/bug_dataset.py | happygirlzt/soft_alignment_model_bug_deduplication | 2 | 48140 | <filename>data/bug_dataset.py<gh_stars>1-10
"""
Each dataset has bug report ids and the ids of duplicate bug reports.
"""
class BugDataset(object):
def __init__(self, file):
f = open(file, 'r')
self.info = f.readline().strip()
self.bugIds = [id for id in f.readline().strip().split()]
... | 2.6875 | 3 |
orm_sqlfan/libreria/migrations/0004_auto_20191125_0518.py | rulotr/djangorm_sqlfan | 2 | 48141 | <filename>orm_sqlfan/libreria/migrations/0004_auto_20191125_0518.py
# Generated by Django 2.2.7 on 2019-11-25 05:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('libreria', '0003_auto_20191125_0515'),
]
operations = [
migrations.Remov... | 1.359375 | 1 |
specs/test_blocks.py | geyang/gym-sawyer | 4 | 48142 | from cmx import doc
import gym
import numpy as np
from env_wrappers.flat_env import FlatGoalEnv
from sawyer.misc import space2dict, obs2dict
def test_start():
doc @ """
# Sawyer Blocks Environment
## To-do
- [ ] automatically generate the environment table
We include the following domain... | 2.234375 | 2 |
schedule.py | adelhult/welcome-bot | 1 | 48143 | from colorhash import ColorHash
from discord import Embed, Colour
from requests import get
from ics import Calendar
import arrow
URL = "https://cloud.timeedit.net/chalmers/web/public/ri6Y73QQZ55Zn6Q14854Q8Z85640y.ics"
def get_timeline():
c = Calendar(get(URL).text)
return c.timeline
def day(offset):
"""... | 2.984375 | 3 |
string/1408_string_matching_in_an_array/1408_string_matching_in_an_array.py | zdyxry/LeetCode | 6 | 48144 | <gh_stars>1-10
from typing import List
class Solution:
def stringMatching(self, words: List[str]) -> List[str]:
words.sort(key=len) #by size in ascending order
ans = []
for i, word in enumerate(words):
for j in range(i+1, len(words)):
if word in words[j]:
... | 3.59375 | 4 |
CFG.py | abduallahmohamed/Social-Implicit | 3 | 48145 | CFG = {
"spatial_input": 2,
"spatial_output": 2,
"temporal_input": 8,
"temporal_output": 12,
"bins": [0, 0.01, 0.1, 1.2],
"noise_weight": [0.05, 1, 4, 8],
"noise_weight_eth": [0.175, 1.5, 4, 8],
}
| 0.960938 | 1 |
tests/h/services/flag_test.py | pombredanne/h | 2,103 | 48146 | <reponame>pombredanne/h
import pytest
from h import models
from h.services import flag
class TestFlagServiceFlagged:
def test_it_returns_true_when_flag_exists(self, svc, flag):
assert svc.flagged(flag.user, flag.annotation) is True
def test_it_returns_false_when_flag_does_not_exist(self, svc, user, ... | 2.171875 | 2 |
app/backend/gwells/views/bulk.py | bcgov/gwells | 37 | 48147 | <gh_stars>10-100
"""
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 writing, so... | 1.773438 | 2 |
spiel/segmentation/__init__.py | adoxography/SPieL | 1 | 48148 | <gh_stars>1-10
"""
spiel.segmentation
Module for segmenting strings into morphemes
"""
from spiel.segmentation.features import Featurizer
from spiel.segmentation.constraints import ConstraintSegmenter
| 1.304688 | 1 |
Important_data/Thesis figure scripts/arccos.py | haakonvt/LearningTensorFlow | 5 | 48149 | <reponame>haakonvt/LearningTensorFlow<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
rc('lines', linewidth=2)
rc('font', family='serif')
rc('legend',**{'fontsize':14}) # Font ... | 2.6875 | 3 |
build/lib/MICTI/Kmeans.py | insilicolife/micti | 0 | 48150 | import numpy as np
import pandas as pa
import time
from sklearn.metrics import pairwise_distances
from scipy.sparse import csr_matrix
class Kmeans:
def __init__(self,data,k,geneNames,cellNames,cluster_label=None,seed=None):
self.data=data
self.k=k
self.geneNames=geneNames
self.cellN... | 2.953125 | 3 |
src/aws_environments/migrations/0019_environmentvariable.py | chiliseed/hub | 0 | 48151 | <filename>src/aws_environments/migrations/0019_environmentvariable.py<gh_stars>0
# Generated by Django 3.0.2 on 2020-03-18 18:28
from django.db import migrations, models
import django.db.models.deletion
import fernet_fields.fields
class Migration(migrations.Migration):
dependencies = [
("organizations",... | 1.617188 | 2 |
discourse_form/models.py | cinai/teacher_discourse_form | 0 | 48152 | from django.db import models
from sessions_coding.models import Classroom_session,Subject,Axis,Skill,Learning_goal,Copus_code
DIALOGIC_CHOICES = (
('Autoritativo', 'Autoritativo'),
('Dialogico', 'Dialógico'),
('NA', 'NA'),
)
class Discourse_form(models.Model):
session = models.ForeignKey(Classroom_ses... | 2.234375 | 2 |
hw4/sequence_peptide_leaderboard.py | leskin-in/mipt-bioalgo | 0 | 48153 | #!/usr/bin/env python3
def main():
lb_size = int(input())
spectrum = list(map(int, input().split()))
result = sequence_peptide(spectrum, lb_size)
print('-'.join(list(map(str, result))))
AMINO_MASSES = [57, 71, 87, 97, 99, 101, 103, 113, 114, 115, 128, 129, 131, 137, 147, 156, 163, 186]
def _attach... | 3.796875 | 4 |
src/exploration.py | nikhilnrng/german-credit-risk | 1 | 48154 | <gh_stars>1-10
import pandas
import preprocessing
from defines import Types, Metadata
def print_pivot_tables(data, metadata, numerical=False):
for column in metadata.COLUMNS:
if not numerical and column.TYPE is Types.NUMERICAL or column.CATEGORIES is None:
continue
df_column = pandas.D... | 2.984375 | 3 |
smores/utils.py | 2087829p/smores | 0 | 48155 | <filename>smores/utils.py
__author__ = '<NAME>'
import threading
import numpy as np
from constants import *
import math
import time
import constants as c
def split_into(l, n):
'Splits the list into smaller lists with n elements each'
for i in xrange(0, len(l), n):
yield l[i:i + n]
def fit_in_range(mi... | 2.640625 | 3 |
src/python/search/search.py | adolphlwq/java-algorithms | 4 | 48156 | <filename>src/python/search/search.py
import pytest
def sequence_search(alist, item):
pos = 0
found = False
while pos<len(alist) and not found:
if item == alist[pos]:
found = True
break
pos += 1
return found
@pytest.mark.parametrize("test_input, item, expecte... | 3.578125 | 4 |
villaProductSdk/products.py | thanakijwanavit/villa-product-sdk | 2 | 48157 | <reponame>thanakijwanavit/villa-product-sdk<gh_stars>1-10
# AUTOGENERATED! DO NOT EDIT! File to edit: product-sdk.ipynb (unless otherwise specified).
__all__ = ['FunctionNames', 'ProductSdk', 'querySingleProduct', 'ProductsFromList', 'queryList']
# Cell
from botocore.config import Config
from s3bz.s3bz import S3, Req... | 1.828125 | 2 |
PhysicsTools/RecoAlgos/python/allSuperClusterCandidates_cfi.py | ckamtsikis/cmssw | 852 | 48158 | import FWCore.ParameterSet.Config as cms
allSuperClusterCandidates = cms.EDProducer("ConcreteEcalCandidateProducer",
src = cms.InputTag("hybridSuperClusters"),
particleType = cms.string('gamma')
)
| 1.109375 | 1 |
apps/RedSencerCamera/redcenser_camera.py | ucchiemonster/rspi_iot_samples | 1 | 48159 | #!/usr/bin/python
# coding:utf-8
import sys
sys.path.append('./libs')
import RPi.GPIO as GPIO
from time import sleep
#from libs import snapshot as snap
import snapshot as snap
#from libs import aws_iot_pub as iot
import aws_iot_pub as iot
import commands
#import system
#from subprocess import check_call
import Confi... | 2.34375 | 2 |
temapi/api/loaders/loader.py | Leviosar/temapi | 9 | 48160 | <gh_stars>1-10
import json
from temapi.commons.paths import OUTPUTS_DIR
class Loader:
file = None
def __init__(self):
assert self.file is not None
_file = OUTPUTS_DIR / self.file
with _file.open() as f:
data = json.load(f)
self.setup(data)
def setup(self, ... | 2.4375 | 2 |
virtual/lib/python3.6/site-packages/djreservation/migrations/0002_auto_20160903_0030.py | igihozo-stella/smart-parking | 0 | 48161 | <reponame>igihozo-stella/smart-parking
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-03 06:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('djreservation', '0001_... | 1.65625 | 2 |
rmgweb/database/views.py | ReactionMechanismGenerator/RMG-website | 10 | 48162 | <filename>rmgweb/database/views.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# #
# RMG Website - A Django-powered website for Reaction Mechanism Generator ... | 1.273438 | 1 |
bluebottle/bb_tasks/views.py | maykinmedia/bluebottle | 0 | 48163 | <gh_stars>0
from django.db.models.query_utils import Q
from rest_framework import generics
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from bluebottle.bluebottle_drf2.permissions import IsAuthorOrReadOnly
from bluebottle.utils.serializers import DefaultSerializerMixin
from bluebottle.bb_projects.p... | 1.960938 | 2 |
schema/Dimension1/Advection/equation_type.py | pylbm/pylbm_ui | 3 | 48164 | # Authors:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD 3 clause
# from pydantic import BaseModel
import sympy as sp
from ...symbol import Symbol
from ...equation_type import EquationType
class Transport1D(EquationType):
name = 'Advection with constant velocity'
u = S... | 2.28125 | 2 |
setup.py | nkzmsb/logtools | 0 | 48165 | <filename>setup.py<gh_stars>0
"""
To make dist folder
$ python setup.py sdist
"""
from setuptools import setup, find_packages
setup(
name = "logtools"
, version = "0.0.12"
, packages = find_packages()
, zip_safe=False
, author = "nkzmsb"
, url = "https://github.com/nkzmsb/logtools"
, ... | 1.546875 | 2 |
examples/Cu_MSSPEC/Cu.py | ase2sprkkr/ase2sprkkr | 1 | 48166 | #!/usr/bin/env python
import glob
import logging
import os
import sys
from msspec.calculator import MSSPEC
from msspec.utils import get_atom_index
from msspec.utils import hemispherical_cluster
from msspec.utils import SPRKKRPotential
from ase2sprkkr.sprkkr.calculator import SPRKKR
from ase.build import bulk
loggin... | 1.875 | 2 |
src/Classes/Install.py | TheBossProSniper/electric-windows | 210 | 48167 | ######################################################################
# INSTALL #
######################################################################
from Classes.Metadata import Metadata
class Install:
"""
Stores data about an installation for us... | 2.625 | 3 |
lib/subdomains.py | bbhunter/ODIN | 533 | 48168 | <reponame>bbhunter/ODIN
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
This module contains everything needed to hunt for subdomains, including collecting certificate
data from Censys.io and crt.sh for a given domain name.
The original crt.sh code is from PaulSec's unofficial crt.sh API. That project can be
found her... | 2.703125 | 3 |
snmp/datadog_checks/snmp/models.py | 01100010011001010110010101110000/integrations-core | 0 | 48169 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
"""
Define our own models and interfaces for dealing with SNMP data.
"""
from typing import Any, Sequence, Tuple, Union
from .exceptions import CouldNotDecodeOID
from .pysnmp_types import ObjectIdentity, Objec... | 2.4375 | 2 |
telegram_bot.py | decinval/download_youtube | 1 | 48170 | <gh_stars>1-10
from token_keys import key_telegram
import telebot
import pytube
import os
bot = telebot.TeleBot(key_telegram)
video = None
def create_keyboard(yt):
buttons = []
keyboard = telebot.types.InlineKeyboardMarkup(row_width=1)
i = 0
for stream in yt.streams.filter(progressive='True'):
... | 2.578125 | 3 |
arkouda/client.py | vasslitvinov/arkouda | 0 | 48171 | <gh_stars>0
import zmq, json, os, secrets
from typing import Mapping, Optional, Tuple, Union
import warnings, pkg_resources
from arkouda import security, io_util
__all__ = ["verbose", "pdarrayIterThresh", "maxTransferBytes",
"AllSymbols", "set_defaults", "connect", "disconnect",
"shutdown", "get_... | 1.734375 | 2 |
dd_invitation/admin.py | datadealer/dd_auth | 0 | 48172 | # -*- coding: utf-8 -*-
from dd_invitation import models
from django.contrib import admin
class TokenAdmin(admin.ModelAdmin):
list_display = ('value', 'consumed', 'created')
ordering = ('-created',)
class Media:
js = ('dd_invitation.js',)
admin.site.register(models.Token, TokenAdmin)
| 1.710938 | 2 |
pyti/double_exponential_moving_average.py | dibyajyotidash/https-github.com-kylejusticemagnuson-pyti | 635 | 48173 | from __future__ import absolute_import
from pyti import catch_errors
from pyti.exponential_moving_average import (
exponential_moving_average as ema
)
def double_exponential_moving_average(data, period):
"""
Double Exponential Moving Average.
Formula:
DEMA = 2*EMA - EMA(EMA)
"""
catch... | 2.8125 | 3 |
9_functions/9_keywordArguments.py | qaidjohar/PythonCourse | 0 | 48174 | <reponame>qaidjohar/PythonCourse<gh_stars>0
def fullName(first_name, last_name):
return f'Your first name is {first_name} and last name is {last_name}'
print(fullName(first_name = 'Qaidjohar', last_name = 'Jawadwala'))
# name = fullName('Qaidjohar','Jawadwala')
# print(name) | 3.5 | 4 |
src/mop/azure/comprehension/resource_management/vnets.py | robertfischer3/python-mop | 1 | 48175 | <gh_stars>1-10
from configparser import ConfigParser
from dotenv import load_dotenv
from mop.azure.utils.create_configuration import (
CONFVARIABLES,
change_dir,
OPERATIONSPATH,
)
from mop.framework.azure_connections import request_authenticated_azure_session
class VNet:
def __init__(self):
l... | 1.890625 | 2 |
core/plugins/PluginLoader.py | smclt30p/PCS | 0 | 48176 | import importlib
import os
from PyQt5.QtCore import QSettings
class Continue(BaseException):
pass
class PluginLoader:
loadedPlugins = []
loaded = False
settings = QSettings("plugins.ini", QSettings.IniFormat)
@staticmethod
def getLoadedPlugins():
"""
This returns instance... | 2.3125 | 2 |
slowfast/models/custom_video_model_builder.py | gabrielsluz/SlowFast | 0 | 48177 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""A More Flexible Video models."""
import math
import torch
import torch.nn as nn
from .build import MODEL_REGISTRY
from .monet import Monet
@MODEL_REGISTRY.register()
class Linear(nn.Module):
"""
Simple linea... | 2.609375 | 3 |
util/undervolt/setup.py | haller218/MyDotFiles | 2 | 48178 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os.path import dirname, join
from setuptools import setup
import doctest
def test_suite():
return doctest.DocTestSuite('undervolt')
setup(
name='undervolt',
version='0.2.9',
description='Undervolt Intel CPUs under Linux',
long_des... | 1.523438 | 2 |
tests/test_cli.py | jwilges/monocat | 1 | 48179 | <filename>tests/test_cli.py
import logging
import sys
from contextlib import ExitStack
from unittest import TestCase
from unittest.mock import DEFAULT as DEFAULT_MOCK
from unittest.mock import MagicMock, patch
from monocat import cli
class TestConfigureLogging(TestCase):
# TODO: Reduce `_configure_logging` test... | 2.59375 | 3 |
src/inference.py | PenelopeCorsica/deep-orientation | 8 | 48180 | <filename>src/inference.py
# -*- coding: utf-8 -*-
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import argparse as ap
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn
from scipy.stats import norm
from scipy.stats import circmean, circstd
import tensorflow.keras.backend as K
from deep_orientati... | 2.015625 | 2 |
news_api/app.py | rdoume/News_API | 9 | 48181 | <filename>news_api/app.py
# -*- coding: utf-8 -*-
"""
App runner
"""
# System imports
# Third-party imports
import falcon
# from falcon_cors import CORS
# Local imports
from news_api.endpoints.models import SimpleSearch, TopEntities, TopClusters
from news_api.connectors.postgres import Postgres
# Create resources
... | 1.75 | 2 |
backslash/lazy_query.py | yotamr/backslash-python | 0 | 48182 | import collections
import requests
from sentinels import NOTHING
from ._compat import xrange, iteritems
class LazyQuery(object):
def __init__(self, client, path=None, url=None, query_params=None, page_size=100):
super(LazyQuery, self).__init__()
self._client = client
if url is None:
... | 2.328125 | 2 |
tests/unit/common/etl/transformers/test_specimen_library.py | ambrosejcarr/matrix-service | 0 | 48183 | <reponame>ambrosejcarr/matrix-service
import unittest
from unittest import mock
from matrix.common.aws.redshift_handler import TableName
from matrix.common.etl.transformers.specimen_library import SpecimenLibraryTransformer
class TestSpecimenLibraryTransformer(unittest.TestCase):
def setUp(self):
self.tr... | 2.328125 | 2 |
risc_control/src/coop_traj1.py | riscmaster/risc_maap | 1 | 48184 | <reponame>riscmaster/risc_maap
#!/usr/bin/env python
'''======================================================
Created by: <NAME>
Last updated: January 2015
File name: coop_tarj1.py
Organization: RISC Lab, Utah State University
Notes:
the AR Drone will fly back and forth in ... | 1.960938 | 2 |
guandu.py | shazihao/nextdoo | 0 | 48185 | print('thats good') | 1.140625 | 1 |
models/modules.py | chldkato/Tacotron-pytorch | 4 | 48186 | <gh_stars>1-10
import torch, librosa
import numpy as np
from torch.nn import Module, Linear, ReLU, Dropout, Conv1d, ModuleList, BatchNorm1d, GRU, MaxPool1d, Sigmoid, Softmax, Tanh
from util.hparams import *
from copy import deepcopy
class prenet(Module):
def __init__(self, input_dim):
super(prenet, self).... | 2.546875 | 3 |
python/toolkit.py | rjlasko/pst | 0 | 48187 | #!/usr/bin/env python
def wakeHost(hostname, nmap_file):
from Hacks import nmap
from wakeonlan import wol
for mac in nmap.getMac(hostname, nmap_file):
wol.send_magic_packet(mac)
def getLocalIps():
d = getInterfaceIpDict()
for (ifaceName, addresses) in d.iteritems():
for addy in addresses:
if addy not ... | 2.734375 | 3 |
src/xleapp/log/__init__.py | flamusdiu/xleapp | 10 | 48188 | import importlib.util
import logging
import logging.config
import os
import typing as t
from pathlib import Path
import yaml
import xleapp.globals as g
from ..helpers.utils import generate_program_header
StrPath = t.Union[str, os.PathLike[str]]
class ProcessFileFilter(logging.Filter):
def filter(self, recor... | 2.109375 | 2 |
pystratis/api/voting/requestmodels/schedulevotewhitelisthashrequest.py | TjadenFroyda/pyStratis | 8 | 48189 | from pydantic import Field
from pystratis.api import Model
from pystratis.core.types import uint256
# noinspection PyUnresolvedReferences
class ScheduleVoteWhitelistHashRequest(Model):
"""A request model for the voting/schedulevote-whitelist endpoint.
Args:
hash_id (uint256): The hash to whitelist.
... | 2.40625 | 2 |
test/conftest.py | janjoswig/CNN | 4 | 48190 | <filename>test/conftest.py
import pytest
import numpy as np
try:
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
SKLEARN_FOUND = True
except ModuleNotFoundError:
SKLEARN_FOUND = False
from cnnclustering import cluster
from cnnclustering._primitive_types import P_AINDEX
fr... | 2.25 | 2 |
geo_service.py | felixwoestmann/gold_digger | 2 | 48191 | address_coordinate_cache = {}
def calculate_distance_address_store(address, store):
address_latitude, address_longitude = get_coordinates_for_address(address)
return calculate_distance_between_coordinates(address_latitude, address_longitude, store.latitude, store.longitude)
def calculate_distance_between_co... | 3.578125 | 4 |
simsi_transfer/simsi_output.py | kusterlab/SIMSI-Transfer | 0 | 48192 | import os
import logging
from pathlib import Path
import pandas as pd
from simsi_transfer.merging_functions import merge_with_msmsscanstxt, merge_with_summarytxt, merge_with_msmstxt
logger = logging.getLogger(__name__)
def export_annotated_clusters(annotated_clusters, mainpath, pval):
export_csv(annotated_clus... | 2.546875 | 3 |
manimpy/right_angle.py | Jin-Yuhan/manimpy | 1 | 48193 | # from @cigar666
# cgnb!!!!
from manimlib.imports import *
class RightAngle(VGroup):
CONFIG = {
'size': 0.25,
'stroke_color': WHITE,
'stroke_width': 3.2,
'fill_color': BLUE,
'fill_opacity': 0.5,
'on_the_right': True,
}
def __init__(self, corner=ORIGIN, ang... | 2.578125 | 3 |
server/inquest/users/views.py | lucasOlivio/inquest | 0 | 48194 | from django.conf import settings
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework import mixins, viewsets
from rest_framework.permissions import AllowAny
from inquest.users.models import User
from inquest.users.permissions import IsUserOrRead... | 2.046875 | 2 |
python/day10_challenge1.py | BKreisel/Advent-of-Code-2018 | 0 | 48195 | from collections import namedtuple
from re import compile
from sys import exit as sysexit
from typing import List
from util import read_input
DAY = 10
UPPER_LIMIT = 25000
Point = namedtuple("Point", ["x", "y"])
Star = namedtuple("Star", ["position", "velocity"])
line_re = compile(r"position=<(?P<x>[-\s\d]+),(?P<y>[-\... | 3.40625 | 3 |
scripts/import_from_wj.py | dujiajun/jcourse_api | 7 | 48196 | import csv
from django.contrib.auth.models import User
from jcourse_api.models import Course, Review, FormerCode, Semester
f = open('./data/2021_wenjuan.csv', mode='r', encoding='utf-8-sig')
csv_reader = csv.DictReader(f)
q = []
users = User.objects.filter(username__istartswith='工具人')
for row in csv_reader:
try:... | 3.046875 | 3 |
monte_carlo_tree_search/constants.py | TomaszOdrzygozdz/gym-splendor | 1 | 48197 | INFINITY = 10 ** 4 | 1.34375 | 1 |
AtCoder/ABC069/C.py | takaaki82/Java-Lessons | 1 | 48198 | iN = int(input())
a_list = list(map(int, input().split()))
multi4 = len([a for a in a_list if a % 4 == 0])
odd_num = len([a for a in a_list if a % 2 != 0])
even_num = len(a_list) - odd_num
not4 = even_num - multi4
if not4 >0 :
if odd_num <= multi4:
print("Yes")
else:
print("No")
else:
if... | 3.4375 | 3 |
problem0171.py | kmarcini/Project-Euler-Python | 0 | 48199 | <gh_stars>0
###########################
#
# #171 Finding numbers for which the sum of the squares of the digits is a square - Project Euler
# https://projecteuler.net/problem=171
#
# Code by <NAME>
#
###########################
| 2.375 | 2 |