blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
0ec685d0c4d508ff04896dfaba15cb82f823c41d | Python | SimonSlominski/Pybites_Exercises | /Pybites/375/test_combinations.py | UTF-8 | 2,256 | 3.328125 | 3 | [] | no_license | from itertools import product
import pytest
from combinations import generate_letter_combinations
@pytest.mark.parametrize(
"digits, expected",
[
("2", ["a", "b", "c"]),
("23", ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]),
(
"79",
[
... | true |
a2e4b400e69f8296aad93f6f5e17879198980241 | Python | coucoulesr/advent-of-code-2019 | /01-Rocket-Equation/01-2-Soln.py | UTF-8 | 472 | 3.40625 | 3 | [] | no_license | import math
def moduleFuelReq(mass):
output = math.floor(mass/3) - 2
return output if output > 0 else 0
def main():
fuel_required = 0
next_fuel = 0
with open("01-input") as file:
for line in file:
next_fuel = moduleFuelReq(int(line))
while next_fuel > 0:
... | true |
fe7b4f771154bfc36367868e72707786673ab66f | Python | covidwatchorg/CircuitPythonExperimenter | /ble_print.py | UTF-8 | 1,481 | 2.734375 | 3 | [] | no_license | # printing advertising packets and support formatting
import _bleio
import ble_gaen_scanning
# ======================================================
# Functions to help with printing a generic advertising packet.
def hex_of_bytes(bb):
s = ""
count = 0
for b in bb:
s += (" {:02x}".format(b))
... | true |
0c2c327bb3597ac06e474286d05d0ac908fb7de0 | Python | whigg/HyperHeuristicKnapsack | /knapsack/genetic.py | UTF-8 | 1,587 | 3.09375 | 3 | [
"MIT"
] | permissive | import random as rnd
import algorithms as algs
import knapsack.hyper.single.problem as ksp
def simple_state_generator_ksp(dimension):
state = []
for i in range(0, dimension):
random_boolean = False if rnd.randint(0, 1) == 0 else True
state.append(random_boolean)
return state
def initial... | true |
c008e73eeb247c527a1008a5a7563944d6ce77ee | Python | void-memories/APS-Code-Base | /Assignment/20_camelCase.py | UTF-8 | 145 | 2.953125 | 3 | [] | no_license | import re
def main():
patt = re.compile(r'[A-Z]')
string = input()
print(len(patt.findall(string))+1)
if __name__ == "__main__":
main() | true |
c5e588c192a1d754e192b46a9dd1717437f45d8f | Python | fisch321/uband-python-s2 | /homeworks/B20769/homework1/B20769_feiyu_day5_homework.py | UTF-8 | 5,694 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import codecs
import os
import sys
reload(sys)
sys.setdefaultencoding('utf8')
#1. 读取文件
#根据“-”再次划分单词:['aa', 'aaa-bbb-sds'] => ['aa', 'aaa', 'bbb', 'sds']
def word_split(words):
new_list = []
for word in words:
if '-' not in word:
new_list.append(word)
else:
... | true |
f2453a83c9d38086702c4e3fec2a9b8486dd0657 | Python | wangyendt/LeetCode | /Hard/297. Serialize and Deserialize Binary Tree/Serialize and Deserialize Binary Tree.py | UTF-8 | 1,577 | 3.453125 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: Wayne
@contact: wangye.hope@gmail.com
@software: PyCharm
@file: Serialize and Deserialize Binary Tree
@time: 2019/8/29 16:53
"""
import sys
sys.path.append('..')
from Tools.BinaryTree import *
class Codec:
def serialize(self, root):
"""Encodes a tre... | true |
22dc659f188c63a22baac9d0638212917ee58d0c | Python | ankaan/dice | /dice_probability/die_test.py | UTF-8 | 9,759 | 2.703125 | 3 | [] | no_license | from dice_probability.die import Die, LazyDie
from dice_probability.die import DieParseException, from_string, pool_from_string, fastsum
from django.test import TestCase
class TestDie(TestCase):
def test_init(self):
for d in (Die,LazyDie):
self.assertEquals(d(0).probability(),[1.0])
self.assertEqua... | true |
6674f364967428f01b295eb4386e8002fedf37d7 | Python | nbnbhattarai/qpapers | /qpapers/scienceopen.py | UTF-8 | 3,027 | 2.625 | 3 | [] | no_license | import requests
import json
from datetime import datetime
from .article import Article
class ScienceOpenSearch(object):
NAME = 'SCIENCEOPEN'
ROOT_URL = 'https://www.scienceopen.com'
def __init__(self, *args, **kwargs):
self.url = self.ROOT_URL + '/search-servlet'
self.keyword = kwargs.ge... | true |
a33212c98531a033578232a74aa84a9e79d3c69c | Python | steven0301/Translate-and-Summarize-Text | /start.py | UTF-8 | 3,271 | 2.609375 | 3 | [] | no_license | from gensim.summarization.summarizer import summarize
from newspaper import Article
from flask import Flask, render_template, request, jsonify
from googletrans import Translator
import json
import pdftotext
import urllib
from urllib.error import URLError, HTTPError
import io
from pathlib import Path
import tempfile
cl... | true |
7b5543d3cc0b3e732ee78ad86ee6ce8c8b8582ac | Python | raykunal2021/SDET_Selenium | /alerts.py | UTF-8 | 1,529 | 3.015625 | 3 | [] | no_license | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
import time
driver=webdriver.Chrome(ChromeDriverManager().instal... | true |
916894d40ad8c18b4af1d39580e233120a8c04da | Python | jawozele/Python_Files | /Lists.py | UTF-8 | 376 | 3.984375 | 4 | [] | no_license | # A program that stores a List of cars. The output is displayed with all cars saved on
cars = ['Mercedes Benz',
'Toyota',
'BMW',
'Hyundai',
'Mitsubishi',
'Land Rover',
'Audi',
'Ford Focus']
#print(cars[0])
#print(cars[1:4])
#print(len(cars))
cars.sort()
ca... | true |
fcd65a1995c8e7ffa79dd1aaf83ee314e54f297b | Python | neurospin/pySnpImpute | /pysnpimpute/imputation.py | UTF-8 | 3,873 | 2.53125 | 3 | [
"LicenseRef-scancode-cecill-b-en"
] | permissive | # -*- coding: utf-8 -*-
"""
Defines a set of functions to run the imputation using Impute2.
The module requires Impute2 to be installed.
"""
import os
import pysnpimpute
from pysnpimpute.utils import (check_installation_of_required_softwares,
check_chromosome_name,
... | true |
453cd742d0933bee7d1ca3baa27e65e1013f4a8a | Python | homebysix/grahamgilbert-recipes | /ShardOverTimeProcessor/ShardOverTimeProcessor.py | UTF-8 | 7,078 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/local/autopkg/python
#
"""See docstring for ShardOverTimeProcessor class"""
from __future__ import absolute_import, division, print_function
import datetime
import sys
from autopkglib import Processor, ProcessorError
__all__ = ["ShardOverTimeProcessor"]
DEFAULT_CONDITION = "shard"
DEFAULT_DELAY_HOURS = 0
D... | true |
a4cadb46aaa9304168c671497ce34605c3854f5c | Python | manoelsslima/datasciencedegree | /tarefas/tarefa01/e01q03.py | UTF-8 | 285 | 4.09375 | 4 | [] | no_license | '''
Faça um programa que peça um número para o usuário (string), converta-o para float e depois imprima-o na tela. Você consegue fazer a mesma coisa, porém convertendo para int?
'''
numero_str = input('Informe um número: ')
numero_float = float(numero_str)
print(numero_float)
| true |
96a0fde6393b2d792fc17543720ba0414c621f10 | Python | Yangqqiamg/Python-text | /基础学习/python_work/Chapter 9/text.py | UTF-8 | 3,527 | 4.03125 | 4 | [] | no_license | #one
class Dog():
"""docstring for dog"""
def __init__(self, name, age):
self.name = name
self.age = age
def sit(self):
print(self.name.title() + " is now sitting. ")
pass
def roll_over(self):
print(self.name.title() + " rolled over! ")
pass
#two
my_dog = Dog('willie', 7)
print("My dog's name is " + ... | true |
8353697b7d39a0ce64c99db7e0eb8752fae0c9be | Python | nijjumon/py | /basic/math.py | UTF-8 | 496 | 3.796875 | 4 | [] | no_license | import math
a=input("enter length")
b=input("enter base")
c=input("enter hypotenuse")
a=float(a)
b=float(b)
c=float(c)
if a==0 or b==0 or c==0:
print("invalid input")
elif a+b>c and b+c>a and a+c>b:
perimeter=a+b+c
s=perimeter/2
area=math.sqrt(s*(s-a)*(s-b)*(s-c))
# print("the area and perimeter o... | true |
165e1011593a8b974cff25dbee6fff1f9384f878 | Python | ultrajedinotreal/pprac | /helloworld.py | UTF-8 | 184 | 3.3125 | 3 | [] | no_license | a = int(input("Enter the number of hellos you need to fuck off"))
i=0
for i in range ( a):
print("HELLO THERE")
print("General Kenobi")
print("You are a bold one")
| true |
0af065722bb5dc739a4cdaefc91613f3dcceb025 | Python | MohammedAlJaff/1MD120_Deep_Learning_for_Image_Analysis_Assignments | /assignment_1/.ipynb_checkpoints/ex_1_4_model_1-checkpoint.py | UTF-8 | 2,009 | 3.171875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from maj_linear_model import LinearRegressionModel, standarize_data
from load_auto import load_auto
if __name__ =='__main__':
# Load automobile data-set
Xraw, y = load_auto()
# Standardize data matrix
X = standarize_data(Xraw)
horsepower_c... | true |
766c810eacbf2826e62dd8e2c9c4c7c327f14991 | Python | nymwa/ante2 | /tunimi/tokenizer.py | UTF-8 | 811 | 2.984375 | 3 | [] | no_license | import re
from .vocabulary import Vocabulary
class Tokenizer:
def __init__(self):
self.vocab = Vocabulary()
self.proper_pattern = re.compile(r'^([AIUEO]|[KSNPML][aiueo]|[TJ][aueo]|W[aie])n?(([ksnpml][aiueo]|[tj][aueo]|w[aie])n?)*$')
def convert(self, x):
if x in self.vocab.indices:
... | true |
bbbd7dc7131651d5d571194b058f8373c5ffe86a | Python | superwj1990/AdCo | /VOC_CLF/dataset.py | UTF-8 | 1,855 | 3.03125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 23:23:51 2019
@author: Keshik
"""
import torchvision.datasets.voc as voc
class PascalVOC_Dataset(voc.VOCDetection):
"""`Pascal VOC <http://host.robots.ox.ac.uk/pascal/VOC/>`_ Detection Dataset.
Args:
root (string): Root directory of the VOC Da... | true |
b9f79d7608c0882f7c3f01e64711067438048f94 | Python | kamillk/Homework2 | /resistance.py | UTF-8 | 2,212 | 2.734375 | 3 | [] | no_license | import sys
import xml.dom.minidom
import time
from matrixops import floyd_warshall
from copy import deepcopy
doc = xml.dom.minidom.parse(sys.argv[1])
elements = doc.getElementsByTagName('net')
number = elements.length;
d = [[float("+inf") for x in range(number+1)] for y in range(number+1)]
for i in range(1,number+1)... | true |
5d9cc23c0f49805122d8bfdf4c39154df281af1b | Python | MoShrank/code-design-python-task | /zahlenraten.py | UTF-8 | 309 | 4.03125 | 4 | [] | no_license | goal_number = 100
def check_number(x):
if x == goal_number:
print("congratulations. You won, Your number is right")
elif goal_number < x:
print("the number is lower")
else:
print("the number is higher")
inp = input("guess the number: ")
inp = int(inp)
check_number(inp)
| true |
472b600312d435e2476fe5977a407e08a6fe5c33 | Python | MiekoHayasaka/Python_Training | /day0210/lesson3.py | UTF-8 | 143 | 3.546875 | 4 | [] | no_license | def sumof(n):
if n <= 1:
return n
else:
return n*sumof(n-1)
num=int(input('正の整数>'))
ans=sumof(num)
print(ans)
| true |
bf8f3c2c8176999a747f9f27bf1ff7891a9c8f80 | Python | csun87/dworp | /tests/test_agent.py | UTF-8 | 1,592 | 2.8125 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright 2018, The Johns Hopkins University Applied Physics Laboratory LLC
# All rights reserved.
# Distributed under the terms of the Modified BSD License.
from dworp.agent import *
import unittest
class IdentifierHelperTest(unittest.TestCase):
def test(self):
# trivial test that serves as an example... | true |
6e42a3363e6a3f4e04f0a9d0d3706fa7d4a313d0 | Python | mlarkin00/mslarkin-experiments | /gae-budget-alert/main.py | UTF-8 | 2,782 | 2.65625 | 3 | [] | no_license | import base64
import json
import os
import logging
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
PROJECT_ID = os.getenv('GCP_PROJECT')
APP_NAME = f"{PROJECT_ID}"
#Which alert threshold should trigger the shutdown (e.g. 100% of set budget)
TRIGGER_THRESHOLD = 1.0
def check_ap... | true |
69c5fd7d6874709e24f44ed06c4fd3a008502806 | Python | AngelLiang/programming-in-python3-2nd-edition | /py3book31/py31eg/findduplicates-m.py | UTF-8 | 2,969 | 2.515625 | 3 | [
"MIT",
"GPL-3.0-only",
"GPL-1.0-or-later",
"LGPL-2.0-or-later"
] | permissive | #!/usr/bin/env python3
# Copyright (c) 2008-11 Qtrac Ltd. All rights reserved.
# This program or module 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, or
# (at your option) an... | true |
6678465514f55498980a1f70ab70d669d8ea8815 | Python | Johanjimenez97/Estructura-de-Datos-1 | /tabla2.py | UTF-8 | 1,139 | 2.640625 | 3 | [] | no_license | class Generador:
def generaTabla(self, tabla):
codigo = ""
for t in tabla:
codigo = codigo + "<tr>"
for j in t.split(","):
if j == 'Oro':
j= '<img src="static/img/Oro.jpg" width="50px" heigth="50px">'
elif j== 'Plata... | true |
f5714a6f0eff91cbb48a8d20a6409ae100eecf4e | Python | chishu-amenomoriS/wiktionary-tools | /python/research/countlines-BytesIO.py | UTF-8 | 406 | 2.75 | 3 | [
"CC0-1.0"
] | permissive | import bz2, io
with open("streamlen.tsv") as f:
target = f.readline().strip()
slen = [int(line) for line in f.readlines()]
lines = 0
with open(target, "rb") as f:
for length in slen:
with io.BytesIO(f.read(length)) as b:
with bz2.open(b, "rt", encoding="utf-8") as t:
wh... | true |
8c7a52caf91014fcce8fab8139b0368e0492e748 | Python | surferek/Machine-Learning | /cleaning_data.py | UTF-8 | 2,469 | 3.71875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# Examples of cleaning data methods in Python and some introduction into preprocessing
# Libraries
import numpy as np
import pandas as pd
# And also sklearn
# Reading data to DataFrame ===================================================
dataFrame = pd.read_csv("MyData")
# Detecting missi... | true |
7df38c62717b882f6a93c359a9771b8fc576c87c | Python | c0mmand3r3/twitter_covid19 | /examples/data_split_example.py | UTF-8 | 1,987 | 2.78125 | 3 | [] | no_license | """
- Author : Anish Basnet
- Email : anishbasnetworld@gmail.com
- Date : Tuesday, July 13, 2021
"""
import os
import pandas as pd
from tweeter_covid19.utils import mkdir
TOTAL_SET = 10
if __name__ == '__main__':
read_path = os.path.join('data', 'original', 'covid19_tweets_refactor.csv')
write_path = os.... | true |
096ae6b9cf256dc77d1b9ceda8990e03a63e3d15 | Python | ye-spencer/RunTracker | /src/runner.py | UTF-8 | 7,661 | 2.578125 | 3 | [] | no_license | from os import path
from os import rename
from os import mkdir
from os import listdir
from re import match
from platform import system
FIELDEVENTS = ["Long Jump", "Triple Jump", "Pole Vault", "Discus", "Shotput", "High Jump"]
global NoneType
NoneType = 56725649176543423.456215
#return None
#param String... | true |
7c6207f137d9b410ee0dacb36ea4eeb281885a9a | Python | gonzalezcjj/andsp | /andsp_dwb_dump.py | UTF-8 | 986 | 2.75 | 3 | [] | no_license | import sqlite3
import json
import codecs
conn = sqlite3.connect('content.sqlite')
cur = conn.cursor()
cur.execute('''SELECT d.year,
d.population_value
FROM Country AS c,
Indicator AS i,
Data AS d
WHERE i.indicator_id = d.i... | true |
aef56cccf3fb49eab9e9a7d705769bf4d35b1f8c | Python | ljm516/python-repo | /algorithm/knn/knn_algorithm.py | UTF-8 | 3,439 | 3.515625 | 4 | [
"Apache-2.0"
] | permissive | import csv
import math
import operator
import sys
from random import random
'''
实现 knn 算法:
1. 数据处理: 打开 csv 文件获取数据,将原始数据分为测试数据和训练数据
2. 相似性度量: 计算每两个数据实例之间的距离
3. 近邻查找: 找到 k 个与当前数据最近的邻居
4. 结果反馈: 从近邻实例反馈结果
5. 精度评估: 统计预测精度
'''
# 从文件加载数据集
def load_data_set(data_file, split_rate):
training_set = []
test_set = ... | true |
6e506a56c67263268fdaedd54e8387c66b5e0808 | Python | Emerson53na/exercicios-python-3 | /029 Radar eletrônico.py | UTF-8 | 288 | 3.78125 | 4 | [] | no_license | n = float(input('Qual é a velocidade atual do carro? km/h'))
valor = n*7-80*7
if n <= 80:
print('\033[32m Tenha um bom dia! Dirija com segurança.\033[m')
elif n >= 81:
print('\033[33m Você está indo muito rápido.\n\033[31mSua multa é de R${:.2f}\033[m'.format(valor))
| true |
224586cac64daa3ad807d60cdd46ea31c526ea5c | Python | Voprzybyo/Python | /Classes/Calculator/ComplexCalculator_V1.py | UTF-8 | 2,795 | 4.28125 | 4 | [] | no_license | #! /usr/bin/env python
import math
class Complex:
# Constructor
def __init__(self, realpart=0.0, imagpart=0.0):
self.r = realpart
self.i = imagpart
# Conjugate of complex number (imaginary part negation)
def conjugate(self):
self.i = -self.i
# Method that returns comple... | true |
5cdc90a578a8ba5e2c362ab7ff84242cb90c3109 | Python | mbouthemy/datathon-energy | /src/get_score.py | UTF-8 | 541 | 3.46875 | 3 | [] | no_license | # Calculate the score of the index of each dataframe
# Assign the score A+ for the top 20%, A for 30%, B for 30% and C for 20%
def get_score_column(df, column_name):
"""
Get the score of the dataframe based on the column name.
"""
# Get the rank of the consumption.
rank = 'Rank' + column_name
... | true |
9ae875fe31bbefc35e35ce1ca97afd447c7c82e1 | Python | Impresee/lar-annotator | /pai/utils.py | UTF-8 | 5,199 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 2 13:20:00 2018
@author: jsaavedr
"""
from . import basic
from . import bw
import skimage.measure as measure
import skimage.morphology as morph
import cv2
import numpy as np
#%%
def extractLAR(check_image):
"""
check_image must come in g... | true |
817a7fcd4bb1f71b21e68150b9d4543d08b8bd79 | Python | yenertuz/push_swap | /checker.py | UTF-8 | 674 | 3.03125 | 3 | [] | no_license | #!/usr/local/bin/python3.7
import ps_functions as ps
try:
f = open("numbers")
numbers_string = f.read()
f.close()
except:
print("checker.py: could not open \"numbers\"")
exit(-1)
try:
f = open("ops")
ops_string = f.read()
f.close
except:
print("checker.py: could not open \"ops\"")
exit(-1)
numbers_list = ... | true |
bd5459fbe7edd3564b4b9aedc604456976ee7a3c | Python | junpenglao/Planet_Sakaar_Data_Science | /Miscellaneous/twitter_demo.py | UTF-8 | 2,120 | 2.5625 | 3 | [
"MIT"
] | permissive | """
https://twitter.com/junpenglao/status/928206574845399040
"""
import pymc3 as pm
import numpy as np
import matplotlib.pylab as plt
L = np.array([[2, 1]]).T
Sigma = L.dot(L.T) + np.diag([1e-2, 1e-2])
L_chol = np.linalg.cholesky(Sigma)
with pm.Model() as model:
y = pm.MvNormal('y', mu=np.zeros(2), chol=L_chol, s... | true |
cab2d5f6fc61c42887737cee1361004ee4fe5b06 | Python | Busymeng/MyPython | /Python for Research/2.2_NumPy-Student.py | UTF-8 | 8,870 | 3.96875 | 4 | [] | no_license | #####################################################################
## Introduction to NumPy Arrays
##
"""
* NumPy is a Python module designed for scientific computation.
* NumPy arrays are n-dimensional array objects.
- They are used for representing vectors and matrices.
- NumPy arrays ... | true |
015edec03648055fb46698e036e9c1d3829135e2 | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/hamming/631c999c8eae43dba437e8ef0ba97c7d.py | UTF-8 | 321 | 3.671875 | 4 | [] | no_license | def hamming(first, second):
hamming = 0
if(len(first) < len(second)):
a = first
b = second
elif(len(first) > len(second)):
b = first
a = second
else:
a = first
b = second
hamming = len(b) - len(a)
for i in range(len(a)):
if(a[i] != b[i]):
hamming += 1
return hamming... | true |
7b023de700615ef82a8f8d968652cd3eba2b250e | Python | belenalegre/Santander | /src/EjercicioPython.py | UTF-8 | 1,399 | 3.21875 | 3 | [] | no_license | import csv
class Parser():
def __init__(self, srcPath):
self.srcPath = srcPath
self.filename = srcPath.split('.')[0]
def analyseLines(self, lines):
cols = len(lines[0])
correct_lines = [ l for l in lines if len(l)==cols]
wrong_lines = [l for l in lines if... | true |
eb32f2c307eb4c18721b072bdb30a61754fedfc6 | Python | MrTrustworthy/game_of_life | /gol/grid.py | UTF-8 | 3,674 | 3.234375 | 3 | [
"MIT"
] | permissive | __author__ = 'MrTrustworthy'
from gol.x_utils import Position
from typing import List, Union
class Field:
def __init__(self, position: Position, passable: bool, passing_cost: Union[int, None], objects):
self.passable = passable
self.passing_cost = passing_cost if passable else None
if no... | true |
8b83d67fc90e20e95da8fb3e166c7bf1fe2926ae | Python | jobby/project-euler | /python/problem56.py | UTF-8 | 144 | 2.96875 | 3 | [] | no_license | def digitsum(n):
return sum(map(lambda s:int(s), str(n)))
print max(map(digitsum, [(a ** b) for a in range(1,100) for b in range(1,100)]))
| true |
051bdb55ec8ca1b1fee7886c0b2f8b9935dc4799 | Python | frairefm/UOC_DataScience_TipologiaCicleDades | /PRAC1_code.py | UTF-8 | 7,998 | 2.78125 | 3 | [] | no_license | from bs4 import BeautifulSoup, NavigableString
import requests
import pandas as pd
def get_soup(url):
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
return soup
# Extracts the links to every review edition
def get_links():
links = list()
h2s = soup.findAll('h2', class_... | true |
fabcd7adde7d619666b4b9b2566c1e83d628d7d2 | Python | gleisonbs/trackings-report | /reports/mau_report.py | UTF-8 | 1,285 | 2.84375 | 3 | [] | no_license | from trackings import Trackings
from utils.date import get_date_range, get_month_from_date, get_months
from utils.logger import log_error
from dateutil.relativedelta import relativedelta
from pprint import pprint
from time import sleep
from datetime import datetime
from collections import defaultdict
class MAUReport:... | true |
35a8ae6d20ebc0d2e05f8f3f469c358a6761485e | Python | anandav/NSE-OptionChain-Importer | /mydatabase.py | UTF-8 | 2,088 | 2.6875 | 3 | [] | no_license | import sqlite3
import os
import database
import configparser
from config import AppConfig
class databaseprovider:
def __init__(self, data):
self.data = data
# self.config = configparser.ConfigParser()
# self.config.read("config.ini")
def GetConnection(self):
conn = sqlite3.con... | true |
3299ad33b4c616d338a11c74af5763850507dfba | Python | rafaelbaur/SistemaPPGI | /ppgi/util.py | UTF-8 | 1,062 | 2.625 | 3 | [] | no_license | from django.utils.datetime_safe import datetime
def getPeriodo(mes):
if mes >= 1 and mes <= 3:
periodo = 1
elif mes >= 4 and mes <=6:
periodo = 2
elif mes >= 7 and mes <= 9:
periodo = 3
elif mes >= 10 and mes <= 12:
periodo = 4
return periodo
def getPe... | true |
03a755dc1b00735e2f659ccc6aa0314e7342f0eb | Python | bhatiakomal/pythonpractice | /Udemy/Hierarchical_Inheritance.py | UTF-8 | 869 | 3.3125 | 3 | [] | no_license | '''class Father:
def showF(self):
print("Father Class method")
class Son(Father):
def showS(self):
print("Son Class method")
class Daughter(Father):
def showD(self):
print("Daughter Class method")
s=Son()
s.showS()
s.showF()
d=Daughter()
d.showF()
d.showD()'''
class Father:
def ... | true |
82d2d58bd1b45e852647f892abc365ebd46e869b | Python | ophidianwang/PyWorkspace | /od_package/od_module01.py | UTF-8 | 1,104 | 3.5625 | 4 | [] | no_license | # encoding: utf-8
class od_class01(object):
"""Summary of class here.
Longer class information....
Longer class information....
Attributes:
likes_spam: A boolean indicating if we like SPAM or not.
eggs: An integer count of the eggs we have laid.
name: name of instance
"""
co... | true |
8114270c6aad87ac9ea7891791ff58fa37427f8d | Python | kkrauss2/qbb2016-answers | /week-11/comparison.py | UTF-8 | 3,045 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import division
import sys
from matplotlib import pyplot as plt
from scipy.cluster.hierarchy import dendrogram, linkage, cophenet, leaves_list
from scipy.cluster.hierarchy import leaves_list as leafy
from scipy.spatial.distance import pdist
from scipy.cluster.vq import kmeans2 a... | true |
9fc4f0028a8ecdf623b1459246d9ee431f992fe4 | Python | Muskelbieber/PS2_remote_to_arduino | /PS2_remote_turtle.py | UTF-8 | 1,834 | 3.5 | 4 | [] | no_license | ##############
## Script listens to serial port and does stuff
##############
## requires pySerial to be installed
import serial
import turtle
from PS2_remote_data import serial_port,\
baud_rate,\
button_to_signal,\
signal_to_button, signal_to_int
ser = serial.Serial(serial_port, baud_rate)
#The Information func... | true |
2af04bd9ccaa403694885001514b96d2adb256d4 | Python | devkumar24/30-Days-of-Code | /Day 6 Review/code.py | UTF-8 | 399 | 3.4375 | 3 | [] | no_license | # Enter your code here. Read input from STDIN. Print output to STDOUT
test_cases = int(input())
for i in range(test_cases):
input_str = input()
for j in range(len(input_str)):
if j%2 == 0:
print(input_str[j],end = "")
print(end = " ")
for j in range(len(input_str)):
if j%2 !=... | true |
9f69c856885d9b39cc390da189f61b1674c9a63c | Python | MariaLitvinova/autotesting-with-python | /module2/test7_explicit_wait.py | UTF-8 | 949 | 3.140625 | 3 | [] | no_license | from selenium import webdriver
import time
import math
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
def calc(x):
return str(math.log(abs(12*math.sin(int(x)))))
try:
link = "http://suninjul... | true |
ec70c6d087b91c4f0b4f253849950fa4c4308236 | Python | jacklisp/motion-planning-playground | /algorithms/Probablistics Planners/rrt_family_algorithms.py | UTF-8 | 10,489 | 3.390625 | 3 | [
"MIT"
] | permissive | import random
import numpy as np
import math
import copy
import matplotlib.pyplot as plt
show_animation = True
class RRTFamilyPlanners():
def __init__(self, start, goal, obstacleList, randArea, expandDis=0.5, goalSampleRate=10, maxIter=200):
self.start = Node(start[0], start[1])
self.goal = Node(goal[0], g... | true |
49a96a36ac7a962c1e0d00b5747699f62f4d9999 | Python | MarioMiranda98/Curso-Python | /Interfaces/PrimeraInterfaz.pyw | UTF-8 | 344 | 3.0625 | 3 | [] | no_license | from tkinter import *
#primero construir la raiz (frame)
raiz = Tk()
raiz.title("Ventana de prueba") #Asignar titulo
raiz.resizable(0, 0) #Evitar que sea redimensionable
#raiz.iconbitmap("Ruta") //Para poner otro icono
raiz.geometry("650x350") #Para dar medidas
raiz.config(bg = "blue") #Para cambiar el fondo
raiz.mai... | true |
5caf6e3dfee856906d3c146afcd31f475d5f2b8f | Python | MrShashankBisht/Python-basics- | /control_Statement/nestedForloop.py | UTF-8 | 67 | 2.953125 | 3 | [] | no_license | for i in range(1,50,5):
for j in range(i,30):
print (j) | true |
728d8ddf06cb13b425684e1fb57ac904bf5938f0 | Python | wanghq/oss-copy | /functions/initMultipartUpload/test_index.py | UTF-8 | 1,034 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import logging
import os
import string
import unittest
from .index import calc_groups
class TestIndex(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestIndex, self).__init__(*args, **kwargs)
def test_calc_groups(self):
cases = [
# total_si... | true |
29c20047994da6047c4e916c44b267bf35cdc3c7 | Python | Denisov-AA/Python_courses | /HomeWork/Lection8_TestWork/Task_2.py | UTF-8 | 135 | 3.609375 | 4 | [] | no_license | def my_reversed(somelist:list):
reversed_list = somelist[::-1]
return reversed_list
print(my_reversed([1, 2, 3, 4, 5, 6, 7]))
| true |
0ef54a279c101714b03f23beb739734dc5cee4de | Python | Yeshwanthyk/algorithms | /leetcode/253-meeting-rooms/253_meeting_rooms_ii.py | UTF-8 | 824 | 3.96875 | 4 | [] | no_license | """Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
Example 1:
Input: [[0, 30],[5, 10],[15, 20]]
Output: 2
Example 2:
Input: [[7,10],[2,4]]
Output: 1
"""
import heapq
def meeting_room(intervals):
... | true |
f3882cde49fef82cd62c84d33c14936580b0a0c5 | Python | ammumal/2021-1_Learning_Study | /Stack과 Queue/9012 괄호.py | UTF-8 | 797 | 3.453125 | 3 | [] | no_license | #testcase 입력받기
n = int(input())
PS = [input() for i in range(n)]
#괄호 검사와 답 저장을 위한 list생성
stack = []
answer = []
#괄호 검사
for i in range(n):
for j in range(len(PS[i])):
#PS가 (면 스택에 저장
if PS[i][j] == '(':
stack.append('(')
#PS가 )일 경우 stack에 저장되어있던 ( 삭제, stack이 비어있을 경우 break해서 NO에 걸릴 수 ... | true |
a5e5c80ed38558f08ecb7c3eb1c4a166a1bed0d0 | Python | RShveda/pygame-practice | /catch-ball-game/catch_ball.py | UTF-8 | 658 | 2.53125 | 3 | [] | no_license | import pygame
from models import load_scores
from views import blank_screen
from controllers import user_controller_tick, system_controller_tick
import constants as cons
def main():
"""
Main function of the module which is responsible for variables initialisation
and game event loop.
"""
pygame.in... | true |
03cd03a9253731fec3e7f3745e841a8e537c3f7f | Python | efvaldez1/Advanced-Deep-Learning-with-Keras | /chapter9-drl/dqn-cartpole-9.3.1.py | UTF-8 | 8,505 | 3.140625 | 3 | [
"MIT"
] | permissive | """Trains a DQN to solve CartPole-v0 problem
"""
from keras.layers import Dense, Input
from keras.models import Model
from keras.optimizers import Adam, RMSprop
from collections import deque
import heapq
import numpy as np
import random
import argparse
import sys
import gym
from gym import wrappers, logger
class D... | true |
f567e81824b0485212695e4e5f0fff322cdce0ec | Python | WihlkeJulius/JWLTcolab | /m_engine.py | UTF-8 | 2,154 | 3.203125 | 3 | [] | no_license | #
# Mongoengine är det paket som hanterar kopplingen till MongoDB
from mongoengine import *
# Det här skapar en koppling till databasen 'systemet2' lokalt på din dator
connect('systemet2')
#Det här är en definition av hur ett dokument av typen Vara ser ut, jag har valt sju saker av de 30 som finns i filen
... | true |
06877c1852dd0e363395a63ce8ba0d671398d49b | Python | CSUBioinformatics1801/Python_Bioinformatics_ZYZ | /Exp6/list_test.py | UTF-8 | 561 | 3.25 | 3 | [
"MIT"
] | permissive | a=input('input multinums splitted ori_listy ",":')
ori_list=a.split(',')
n=0
for c in ori_list:
ori_list[n]=int(c)
n+=1
print("origin list:",ori_list)
x=eval(input('input a num:'))
x_index=ori_list.index(x)
if 0<x_index<len(ori_list):
print('max adjcent num:',ori_list[x_index-1],ori_list[x_index+1])
if x in... | true |
08bbbdcba129130a0f20af201af09a256bcf9461 | Python | Amada91/Valentines-with-Python | /valentine.py | UTF-8 | 4,172 | 2.984375 | 3 | [
"MIT"
] | permissive | # =====================================================================
# Title: Valentines with Python
# Author: Niraj Tiwari
# =====================================================================
import os
import numpy as np
from wordcloud import WordCloud, STOPWORDS
import imageio
import matplotlib.pypl... | true |
19cebd43cf45d31d4ddd4e2fa926ea32265b3290 | Python | cltrudeau/purdy | /purdy/colour/urwidco.py | UTF-8 | 5,657 | 2.640625 | 3 | [
"MIT"
] | permissive | from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Token, Whitespace, Punctuation, Text, Literal
from purdy.parser import FoldedCodeLine, token_ancestor
# =============================================================================
# Urwid Colourizer
_code_palette = {... | true |
64a15837d59be63689799da54c288c3ee7aaa988 | Python | zhy0/dmarket_rl | /dmarket/agents.py | UTF-8 | 8,913 | 3.734375 | 4 | [
"MIT"
] | permissive | import numpy as np
class MarketAgent:
"""
Market agent implementation to be used in market environments.
Attributes
----------
role: str, 'buyer' or 'seller'
reservation_price: float
Must be strictly positive.
name: str, optional (default=None)
Name of the market agent. If... | true |
daa11d5d9354b5a92e86165000b5cd0d5ab4465f | Python | yufengvac/one | /test/one.py | UTF-8 | 148 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
file = open("test.txt", "r")
count = 0
for line in file.readlines():
count = count + 1
print(count)
print(line)
| true |
5d83caf939bbb00d2ff85f7c63dd60e956b3ccb7 | Python | ym0179/bit_seoul | /ml/m13_kfold_estimators2.py | UTF-8 | 5,037 | 2.890625 | 3 | [] | no_license | #Day12
#2020-11-24
# 리그레서 모델들 추출
import pandas as pd
from sklearn.model_selection import train_test_split, KFold, cross_val_score
from sklearn.metrics import r2_score
from sklearn.utils.testing import all_estimators
import warnings
warnings.filterwarnings('ignore')
boston = pd.read_csv('./data/csv/boston_house_pric... | true |
1d057bc95b84a9bd20c65312b9932a3788e21286 | Python | kanwalbir/poker_sols | /main.py | UTF-8 | 3,545 | 3.859375 | 4 | [] | no_license | #-----------------------------------------------------------------------------#
# PACKAGE AND MODULE IMPORTS #
#-----------------------------------------------------------------------------#
"""
Other Python file imports.
"""
from create_deck import create_deck
from dea... | true |
ed51c7733c5c43339625e26a53329df0e2c05fbe | Python | rodolforicardotech/pythongeral | /pythonparazumbis/Lista01/PPZ01.py | UTF-8 | 208 | 4.09375 | 4 | [] | no_license | # 1) Faça um programa que peça dois
# números inteiros e imprima a soma desses dois números
n1 = int(input('Informe o primeiro número: '))
n2 = int(input('Informe o segundo número: '))
print(n1 + n2) | true |
c8acbf969aa0275cbfd9291653e79cb07e2cd365 | Python | rodrigodg1/redes | /Sockets/Python/TCP-Server.py | UTF-8 | 1,263 | 3.671875 | 4 | [] | no_license | from socket import *
# Define a porta do servidor
serverPort = 12000
# Cria um novo socket do tipo TCP (SOCK_STREAM) e endereçamento IPv4 (AF_INET)
serverSocket = socket(AF_INET, SOCK_STREAM)
# Associa o socket ao endereço IP e porta especificados
serverSocket.bind(("10.62.9.237", serverPort))
# Define o socket par... | true |
bb354cf209cf2120bbda46c37c51e1a8893d15c2 | Python | NewWisdom/Algorithm | /파이썬으로 시작하는 삼성 SW역량테스트/2. 정렬/11651.py | UTF-8 | 839 | 3.75 | 4 | [] | no_license | """
문제
2차원 평면 위의 점 N개가 주어진다. 좌표를 y좌표가 증가하는 순으로, y좌표가 같으면 x좌표가 증가하는 순서로 정렬한 다음 출력하는 프로그램을 작성하시오.
입력
첫째 줄에 점의 개수 N (1 ≤ N ≤ 100,000)이 주어진다. 둘째 줄부터 N개의 줄에는 i번점의 위치 xi와 yi가 주어진다. (-100,000 ≤ xi, yi ≤ 100,000) 좌표는 항상 정수이고, 위치가 같은 두 점은 없다.
출력
첫째 줄부터 N개의 줄에 점을 정렬한 결과를 출력한다.
예제 입력 1
5
0 4
1 2
1 -1
2 2
3 3
예제 출력 1
1 -1
1 2... | true |
b34bbd88665e2959f184a80fe461ce314895b2e1 | Python | Richard-D/python_excrise | /类和实例.py | UTF-8 | 1,273 | 3.6875 | 4 | [] | no_license | class Student(object):
def __init__(self,name,score):
self.name = name
self.score = score
def print_score(self):
print("%s: %s" %(self.name, self.score))
bart = Student("denghuang","97")
print("我们来看看未实例化的信息 ", Student) #一个类
print("我们来看看实例化后的信息 ", bart) #一个对象
lisa = Student("lisa","99"... | true |
562acf55734f4d1215d5100d24027565b2079038 | Python | davidvaguilar/FundamentosPython | /src/basico/ejercicio020/Ejercicio020.py | UTF-8 | 378 | 3.53125 | 4 | [] | no_license | '''
Created on 05-05-2016
@author: David
'''
if __name__ == '__main__':
print ("ESTE PROGRAMA CALCULA SU SALARIO SEMANAL ")
print ("Ingrese el valor hora")
valorHora = int(input())
print("Ingrese la cantidad de Horas trabajadas")
cantidadHora = int(input())
salario = valorHora * ca... | true |
cb2ea93b9fe8a8db3234d14e1b7b25219996b733 | Python | mkachuee/sentiment-discovery | /model/model.py | UTF-8 | 14,186 | 2.546875 | 3 | [] | no_license | import pdb
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from apex import RNN
class RNNModel(nn.Module):
"""Container module with an encoder, a recurrent module, and a decoder."""
def __init__(self, rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, ... | true |
667a8cd5709651c9a48e02dbe9fafd57d7648c1f | Python | maddox/home-assistant | /tests/helpers/test_entity.py | UTF-8 | 2,258 | 2.65625 | 3 | [
"MIT"
] | permissive | """
tests.test_helper_entity
~~~~~~~~~~~~~~~~~~~~~~~~
Tests the entity helper.
"""
# pylint: disable=protected-access,too-many-public-methods
import unittest
import homeassistant.core as ha
import homeassistant.helpers.entity as entity
from homeassistant.const import ATTR_HIDDEN
class TestHelpersEntity(unittest.Tes... | true |
64051e1b30d8065f8b47acb58fa10ff65011d094 | Python | VictorCastao/Curso-em-Video-Python | /Desafio01.py | UTF-8 | 112 | 3.390625 | 3 | [
"MIT"
] | permissive | print ("============Desafio 1============")
nome = input ("Digite seu nome: ")
print ("Seja bem vindx," , nome)
| true |
a3e023676f2702aaf8d3907eca310462ecc45403 | Python | luvkrai/learnings | /custom_exceptions.py | UTF-8 | 224 | 3.6875 | 4 | [] | no_license |
class myexception(Exception):
def __init__(self, message, errors):
super().__init__(message)
self.errors = errors
try:
raise myexception("hello","my error")
except myexception as e:
print(e)
print(e.errors) | true |
24e27095d424238016503bf239e515f5e70765be | Python | flyteorg/flytesnacks | /examples/type_system/type_system/typed_schema.py | UTF-8 | 1,939 | 3.546875 | 4 | [
"Apache-2.0"
] | permissive | # %% [markdown]
# (typed_schema)=
#
# # Typed Columns in a Schema
#
# ```{eval-rst}
# .. tags:: DataFrame, Basic, Data
# ```
#
# This example explains how a typed schema can be used in Flyte and declared in flytekit.
# %%
import pandas
from flytekit import kwtypes, task, workflow
# %% [markdown]
# Flytekit consists of... | true |
85a8b55ea656520d8c6b904cf39af474bf2cfc83 | Python | ZCCFighting/picture | /Pca.py | UTF-8 | 2,656 | 2.6875 | 3 | [] | no_license | import cv2 as cv
import numpy as np
img=cv.imread('DJI_0024binary0.tif')
h, w, _ = img.shape
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
ret, binary = cv.threshold(gray, 150, 255, cv.THRESH_BINARY)
image, contours, hierarchy = cv.findContours(binary,cv.RETR_TREE,cv.CHAIN_APPROX_SIMPLE)
#cv.drawContour(image,contours,-1... | true |
4b14803e4fa4e38ddaf6e3c95bf3d742309916f5 | Python | lakshmana8121/hire_lakshman | /Basepage/basepage01.py | UTF-8 | 1,501 | 2.578125 | 3 | [] | no_license | from selenium import webdriver
import time
class base:
Select_vaccination_service_xpath="//button[text()='Vaccination Services']"
Select_search_vaccination_center_xpath='//*[@id="mat-menu-panel-0"]/div/ul/li[2]/a'
search_District_id='mat-tab-label-0-1'
select_state_button_id="mat-select-0"
Select_... | true |
3d4e2407c8a4699373293d01861a06912a19e31c | Python | TaigoKuriyama/atcoder | /problem/abc150/c/main.py | UTF-8 | 331 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
import itertools
l = list(range(1, int(input()) + 1))
p = list(map(int, input().split()))
q = list(map(int, input().split()))
cnt_a = 1
cnt_b = 1
for i in itertools.permutations(l):
if list(i) == p:
a = cnt_a
if list(i) == q:
b = cnt_b
cnt_a += 1
cnt_b += 1
print(a... | true |
1ccb54f74d7fa36a0e2f4aadb2a80b4b90fbf57a | Python | alpha-kwhn/Baekjun | /GONASOO/8611.py | UTF-8 | 346 | 3.203125 | 3 | [] | no_license | def conv(k,m):
r = ""
while True:
a = k % m
k //= m
r = str(a) + r
if k < m: r = str(k) + r
if k//m < 1: return int(r)
n = int(input()); flag = True
for i in range(2,11):
t = str(conv(n, i))
if t[::-1] == t:
print(i, t)
flag = Fals... | true |
386b576c4da9740e1ba7a7fc58b4152d81bfd1c3 | Python | globocom/dojo | /2021_01_06/dojo_test.py | UTF-8 | 2,098 | 3.234375 | 3 | [
"MIT"
] | permissive | import unittest
from dojo import get_dimensions, build_matrix
class DojoTest(unittest.TestCase):
def test_get_dimensions1(self):
self.assertEquals(get_dimensions("ifmanwasmeanttostayonthegroundgodwouldhavegivenusroots"), (7,8))
def test_get_dimensions2(self):
self.assertEquals(get_dimensions("... | true |
ffd68ef1dc65319700d680a038714eb3ae2d0fd9 | Python | qmnguyenw/python_py4e | /geeksforgeeks/python/easy/29_5.py | UTF-8 | 2,677 | 3.40625 | 3 | [] | no_license | Program to calculate the Round Trip Time (RTT)
**Round trip time(RTT)** is the length of time it takes for a signal to be
sent plus the length of time it takes for an acknowledgement of that signal to
be received. This time therefore consists of the propagation times between the
two point of signal.
On th... | true |
19013691b0f53d265f11ecfe850f1af6d15e0c6e | Python | ajstocchetti/apartment-temps | /test.py | UTF-8 | 1,893 | 2.96875 | 3 | [] | no_license | import time
import board
import adafruit_dht
from influxdb import InfluxDBClient
# Initial the dht device, with data pin connected to:
DHT_TYPE = adafruit_dht.DHT22
DHT_PIN = board.D4
dhtDevice = DHT_TYPE(DHT_PIN)
minF = 65
lowFreq = 30 # seconds
regFreq = 240 # seconds
errorFreq = 6 # seconds
client = InfluxDBCl... | true |
2eb81e2e3046ca036f17160fd83ea4ddd906dfcb | Python | Eomys/SciDataTool | /SciDataTool/Methods/DataND/_set_values.py | UTF-8 | 532 | 2.671875 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | from SciDataTool.Classes._check import check_dimensions, check_var
from numpy import squeeze, array
def _set_values(self, value):
"""setter of values"""
if type(value) is int and value == -1:
value = array([])
elif type(value) is list:
try:
value = array(value)
except:
... | true |
f3a714916f77449708e44052e23162373c2daad1 | Python | YunHao-Von/Mathematical-Modeling | /手写代码/第2章 数据处理与可视化/Pex2_48_1.py | UTF-8 | 268 | 2.609375 | 3 | [] | no_license | from scipy.stats import binom
import matplotlib.pyplot as plt
import numpy as np
n,p=5,0.4
x=np.arange(6);y=binom.pmf(x,n,p)
plt.subplot(1,2,1);plt.plot(x,y,'ro')
plt.vlines(x,0,y,'k',lw=3,alpha=0.5)
plt.subplot(1,2,2);plt.stem(x,y,use_line_collection=True)
plt.show() | true |
4950661cd5b799efb99e2f6717f21e3ce1a804cb | Python | kaphka/catconv | /catconv/stabi.py | UTF-8 | 4,337 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | """This modules provides functions to process the music catalog provided by
the Staatsbibliothek Berlin"""
import copy
import os
import re
import ocrolib
import ujson
import glob as g
import os.path as op
# import ujson
TIF_PAGES_GLOB = "{name}{batch}/TIF/????????{ext}"
PAGES_GLOB = "{name}{batch}/????????{ext}"
c... | true |
6894e381690c5f063c351917c8f9edaf6603c778 | Python | process-intelligence-research/SFILES2 | /Flowsheet_Class/nx_to_sfiles.py | UTF-8 | 40,844 | 2.921875 | 3 | [
"MIT"
] | permissive | import random
import networkx as nx
import re
import numpy as np
random.seed(1)
"""
Exposes functionality for writing SFILES (Simplified flowsheet input line entry system) strings
Based on
- d’Anterroches, L. Group contribution based process flowsheet synthesis, design and modelling, Ph.D. thesis.
Technical Univer... | true |
7777a0c5b220d4aa3a7c2664f562c8890c3f1287 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2847/60724/237142.py | UTF-8 | 198 | 3 | 3 | [] | no_license | s=int(input())
numbers=input().split()
numbers=[int(x) for x in numbers]
rank=input().split()
rank=[int(y) for y in rank]
res=0
for k in range(rank[0]-1,rank[1]-1):
res=res+numbers[k]
print(res) | true |
598ea3382cef27b48e73ecb7985ffa521221b402 | Python | irvalchev/3MW-Simple-App | /site_summary/views.py | UTF-8 | 1,594 | 2.578125 | 3 | [] | no_license | from django.shortcuts import render
from site_summary.models import Site, SiteEntry
def sites(request):
sites_list = Site.objects.all()
context = {'sites_list': sites_list}
return render(request, 'sites.html', context)
def site_details(request, site_id):
site = Site.objects.filter(id=site_id)
s... | true |
575ef4a34c23afaf7ded8c466559f5ca371a7799 | Python | correosdelbosque/tsl | /utils/distances.py | UTF-8 | 17,477 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
import json
import math
import matplotlib.pyplot as plt
import networkx as nx
import numpy
import os
import sys
# Read in movie JSON files.
movies_dir = "../example-scripts/parsed"
outdir = "/wintmp/movie/graph5/"
def get_movies( movies_dir ):
'''Returns a hash keyed on movie title whose b... | true |
fc91d4a9f06a02e3cd50fe9df396376898dd4bdb | Python | ricard0ff/stuffy | /random/compare and sum.py | UTF-8 | 634 | 3.84375 | 4 | [] | no_license | alist1 = [1,4,5,6]
alist2 = [1,10,3,4,5,6]
def get_sum(alist,number_sum):
item = set()
alist.sort()
for index, valueouter in enumerate(alist):
try:
item.add(valueouter)
if (number_sum - valueouter) in item:
#then we have an item that will get us to the sum
... | true |
b5130fca37f06040a0061eb7989f426c1324bd25 | Python | nimbis/cmsplugin-tabs | /cmsplugin_tabs/tests.py | UTF-8 | 411 | 2.546875 | 3 | [] | no_license | from django.test import TestCase
from models import Tab, TabHeader
class TabsTest(TestCase):
"""
Simple CRUD test for cmsplugin-tabs
"""
def setUp(self):
self.tab = Tab()
self.tab.title = "Test Tab"
self.header = TabHeader()
def test_plugin(self):
self.assertEqual... | true |
511cb208914563a65538d1bb00da1d6d4b297901 | Python | windorchidwarm/py_test_project | /hugh/cyan/test/test_fun.py | UTF-8 | 406 | 3.609375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File : test_fun.py
# Author: chen
# Date : 2020-04-27
def adder(x):
def wrapper(y):
return x + y
return wrapper
adder5 = adder(5)
print(adder5(adder5(6)))
def f(): pass
print(type(f()))
s = "I love Python"
ls = s.split()
ls.reverse()
print(ls)
mytupl... | true |
03300abbd0cc6571b4180aab1a83cca8eece40d7 | Python | nextdesusu/Learn-Python | /SICP/examples/ex1_27.py | UTF-8 | 2,078 | 3.296875 | 3 | [] | no_license | from random import randrange
def fast_prime(n, times):
even = lambda x: x % 2 == 0
remainder = lambda x, y: x % y
square = lambda x: x * x
random = randrange(1, n)
test_it = lambda func, a, n: func(a, n, n) == a
def check(n, start):
if start < n:
if tes... | true |