blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
c58db5b127628c57c2fb4a05209acbe0bd9e0932 | Rynant/project-euler | /pe026.py | UTF-8 | 449 | 3.375 | 3 | [] | no_license | def answer():
'''
Find the value of d 1000 for which 1/d contains the longest recurring cycle in
its decimal fraction part.
'''
largest_repeat = (3, 1)
for d in range(7, 1000, 2):
if not d % 5: continue
cycle = 1
while 10**cycle % d != 1: cycle += 1
if cycle... | true |
6e724df0ccaf4d787197f4feb8764d08e4f6c587 | 8576/zhangbing_nlp | /generate_train_data_v2.py | UTF-8 | 10,943 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Author: zhangbing
Date: 2018.12.14
The scritp is used pre-processing data of nlp tasks.
1. Vocabulary is needed. Generally, it's a dict type, so-called token2id
2. Convert corporas to numbers according to vocabulary
3. Featue of every item must be same length. "pad_sequen... | true |
d87302e2273b6ff60fb7946b944c71d64052dd98 | Absherr/adventofcode | /day18/solution_first_task.py | UTF-8 | 2,606 | 3.140625 | 3 | [] | no_license | from collections import defaultdict
from utils import is_int, load_instructions
def solve_first_task(filename):
registers = defaultdict(int)
last_played = None
instructions = load_instructions(filename)
instruction_pointer = 0
while instruction_pointer < len(instructions):
instruction = ... | true |
f12ec0c34dfa23981c0575388a28790f96d044f9 | vamshi-krishna-prime/breakfast_bot | /breakfast_bot_approach_2.py | UTF-8 | 1,731 | 3.953125 | 4 | [] | no_license | import time
def compare(longstring, shortstring):
index=0
longstring=longstring.lower()
while index < len(longstring):
if longstring[index: index + len(shortstring)] == shortstring:
return True
index += 1
return False
def take_order():
while True:
response= inpu... | true |
498185f2aa32a5ab44657ea3f36d94bceceaf172 | iwhoyoung/HUtils | /file_utils.py | UTF-8 | 1,600 | 2.859375 | 3 | [] | no_license | import os
import cv2
import pandas as pd
from PIL import Image
def read_csv_path(path):
return pd.read_csv(path)
def read_csv(path, file_name):
return pd.read_csv(path + (r'/%s.csv' % file_name))
def save_csv_file(dataset, path, file_name, header=True, index=False):
if not os.path.exi... | true |
9954df774162f7cec9709478ba7e3d7bdca0f4ce | altareen/csp | /08Dictionaries/exercjse02.py | UTF-8 | 354 | 3 | 3 | [] | no_license | # Exercise 2, page 124
weekdays = {}
fhand = open("mailbox.txt")
for line in fhand:
line = line.rstrip()
if line.startswith("From "):
line = line.split()
day = line[2]
if day not in weekdays:
weekdays[day] = 1
else:
qty = weekdays[day]
weekdays... | true |
62be765164ee3c406cab632b6d542d5802839458 | sarang0414/Learn-Python-Modules | /wget.py | UTF-8 | 306 | 2.828125 | 3 | [] | no_license | from urllib.request import urlopen
response = urlopen('https://www.google.com/')
data = response.read()
print(data)
url_list = 'https://www.google.com/'.split('/')
print(url_list)
if url_list[-1] == '':
name = 'index.html'
else:
name = url_list[-1]
f = open(name,'w')
f.write(str(data))
f.close() | true |
598db1cdc0b96146aed902bcd10303399be15678 | Aleks-Ya/yaal_examples | /Building+/Docker+/DockerImage+/Application+/AirFlow/dags/description_markdown.py | UTF-8 | 830 | 3.125 | 3 | [] | no_license | """
Add a Markdown description to a DAG or a task.
The description is shown in “Graph View” for DAGs, “Task Details” for tasks.
Doc: https://airflow.readthedocs.io/en/latest/concepts.html#documentation-notes
"""
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import dateti... | true |
d3727216179b809ab4a5fd13dda0847923ac5c38 | BasPH/airflow-db | /src/airflow_db/hooks/postgres.py | UTF-8 | 1,495 | 2.640625 | 3 | [] | no_license | from typing import Tuple, List, Any
import psycopg2
from airflow_db.hooks.db import DbHook
from psycopg2.extras import RealDictCursor
class PostgresHook(DbHook):
def __init__(self, conn_id):
super().__init__()
self._conn_id = conn_id
self._cursor_kwargs = {"cursor_factory": RealDictCursor... | true |
6a1fa60577c9afad215b5f13401e5aae40e8576b | ABradwell/Automated-Creatures | /Simulated life, Draft Three, Interaction.py | UTF-8 | 26,016 | 2.984375 | 3 | [] | no_license | #######IMPORTING PACKAGES##############
from graphics import *
from random import *
from itertools import product
import os
import time
import time
def common (landconnect):
### Three possible situations
currentcolor = randint(1, 1000)
color = 'blue'
#Situation 1, there is no color as... | true |
08baf9578dd976f2b83d1f3ce2f977012e6a8eba | 664743503/code_share | /python/hm_python/07_语法进阶/my_05_多值参数.py | UTF-8 | 334 | 3.828125 | 4 | [] | no_license | # 参数前面有一个*,表示是元组参数
# 参数前面有两个*,表示是字典参数
def demo(num, *nums, **person):
print(num)
print(nums)
print(person)
demo(1000)
demo(1, #第一个参数num
2, 3, 4, #第二个参数nums
name="xiaoming", age=18, gender=True) # 第三个参数person
| true |
d04b296a953c829368203c5f218ccada9f15b13e | yoviagustian/FP_ProgJar2020_E1 | /hur/bingo/tes.py | UTF-8 | 463 | 3.515625 | 4 | [] | no_license | matrix = []
duamatrix = [None, None]
if not matrix:
for i in range(5): # A for loop for row entries
a =[]
for j in range(5): # A for loop for column entries
a.append(int(input()))
matrix.append(a)
for i in range(5):
for j in range(5):
print(matrix... | true |
66dfe1e3e1a07cd090e84aaa3582290351eaf32b | Jmg-21/aws-ms-react-flask-postgress-docker-haproxy | /api-service/database.py | UTF-8 | 2,741 | 2.609375 | 3 | [] | no_license | import psycopg2
class Database(object):
connection = None
def get_connection(cls, new=False):
"""Creates return new Singleton database connection"""
if new or not cls.connection:
cls.connection = psycopg2.connect(
dbname='postgres',
use... | true |
ce3990afeaa40092dd203fbaa1a1d60ccec8acf9 | GustHer98/EmtechProyect | /Proyecto 2/Analisis_02_Hernandez_Arce_Gustavo.py | UTF-8 | 7,569 | 3.296875 | 3 | [] | no_license | import csv
#lectura del archivo csv convirtiendolo en una lista
#de diccionarios
def lectura():
lista=[]
with open("synergy_logistics_database.csv", "r", encoding="utf-8") as archivo:
lector=csv.DictReader(archivo)
for linea in lector:
lista.append(linea)
return lista
#función ... | true |
a204021349e3442906f1c6c3823ac2c75b973a2d | PhillipLeeHub/python-algorithm-and-data-structure | /leetcode/876_Middle of_the_Linked_List_Easy.py | UTF-8 | 1,105 | 3.96875 | 4 | [
"MIT"
] | permissive | '''
876. Middle of the Linked List Easy
Given the head of a singly linked list, return the middle node of the linked list.
If there are two middle nodes, return the second middle node.
Example 1:
Input: head = [1,2,3,4,5]
Output: [3,4,5]
Explanation: The middle node of the list is node 3.
Example 2:
Input: hea... | true |
504279b24a7b5734a748c1db8e4a3a03928c6544 | jme2103/visualization-tools | /o-lines.py | UTF-8 | 2,368 | 3.234375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
def add_arrow_to_line2D(
axes, line, arrow_locs=[0.2, 0.4, 0.6, 0.8],
arrowstyle='-|>', arrowsize=1, transform=None):
"""
Add arrows to a matplotlib.lines.Line2D at selected locati... | true |
f315a239d15dab4f287ecd4e8ca1389b57e0d137 | dbluiett/python_code | /grapevine_test.py | UTF-8 | 1,538 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import os
import random
import sys
import pandas as pd
import numpy as np
# test dictionary of dictionaries similar to json file
swe_dict = {"mem111":"Desi","mem112":"Laura"}
test_dict = dict({"SWE":swe_dict,"NDNYC":{"mem11... | true |
d732d2fe3145cf24377cfd89a04e5e1444f83b89 | setiahartono/python-telegram-bot-setiahartono | /message_handlers.py | UTF-8 | 1,599 | 2.671875 | 3 | [] | no_license | import utils
from telegram import ReplyKeyboardRemove
def get_reply(text):
reply = None
replies = {
"help": "/help: Show command list\n/sholat: Show prayer time\n/bop: Show random dog pics",
"cancel": "Command cancelled",
}
try:
reply = replies[text.lower()]
except KeyErr... | true |
d46af3d413278e66bb15af32fc531c7d48a39e70 | Raunaka/guvi | /min.py | UTF-8 | 98 | 2.875 | 3 | [] | no_license | a,b=input().split()
a=int(a)
b=int(b)
mi=1
ma=a-b
if a == 1:
print(1,2)
else:
print(1,ma)
| true |
6235417905d1c67a8a1f5a8859cc5ceef0882824 | rdesgagn/PyWeatherStation | /weather/units/pressure.py | UTF-8 | 4,008 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
#
# See __doc__ for an explanation of what this module does
#
# See __usage__ for an explanation of runtime arguments.
#
# -Christopher Blunck
#
import sys
__author__ = 'Christopher Blunck'
__email__ = 'chris@wxnet.org'
__revision__ = '$Revision: 1.6 $'
__doc__ = 'pressure rela... | true |
865465a2ce6c3f1f352603daa4cb2f810c089174 | jw-io/UdacityMovieProject | /entertainment_center.py | UTF-8 | 1,123 | 2.921875 | 3 | [] | no_license | import media
import fresh_tomatoes
def main():
"""Creation of Movie objects to be displayed on website."""
iron_man = media.Movie(
"Iron Man 3",
"https://images-na.ssl-images-amazon.com/images/M/MV5BMTkzMjEzMjY1M15BMl5BanBnXkFtZTcwNTMxOTYyOQ@@._V1_SY1000_SX700_AL_.jpg", # noqa
... | true |
53287917bca0fd30c4e0fb1a0c15d1f554f2cb2d | debajyotiroyc/Tkinter-learning | /GUI_PRAC6.py | UTF-8 | 547 | 3.21875 | 3 | [] | no_license | from tkinter import *
import tkinter.messagebox as tmsg
root=Tk()
root.title("RadioButton Window")
def place():
tmsg.showinfo("Place",f"You are from {var.get()}")
Label(root,text="Where are you from?",font="arial 20 bold",fg="blue",bg="red").pack(side=TOP,padx=5)
lst=["India","USA","England","Japan","Egy... | true |
8ccb83bd18ebb2b387602352a7803152a756ab6f | AlcionePereira/sem07parte02 | /milhar.py | UTF-8 | 862 | 3.375 | 3 | [] | no_license | def numeros(x):
if n == 99:
return'0'
elif n == 1001:
return'2'
elif d and c in par and u in impar:
return'2'
elif c in par and d and u in impar:
return'1'
elif c in impar and u in par and d in par:
return'2'
elif c a... | true |
ae463b7ef4f5769f405af0056f66e023e07007b6 | mitodl/open-discussions | /notifications/notifiers/exceptions.py | UTF-8 | 408 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | """Notifier exceptions"""
class NotifierException(Exception):
"""Exception sending notification"""
class InvalidTriggerFrequencyError(NotifierException):
"""The trigger frequency is invalid"""
class UnsupportedNotificationTypeError(NotifierException):
"""The notification type was invalid"""
class Ca... | true |
41cf4a1d7b95516ee04a7225cf03b0d2e1e673d8 | crileiton/curso_python | /7 Manejo de excepciones/3 Multiples excepciones.py | UTF-8 | 1,471 | 4.28125 | 4 | [] | no_license | # Es posible definir distintas excepciones eso podemos hacerlo gracias a que cuando ocurre un error
# dentro del try cada excepcion tiene su propio identificador, si lo capturamos y lo guardamos en una variable
# podriamos hacer un truco para mostrar el nombre de la excepción...asi
"""
try:
n = input("Introduce un ... | true |
86edfe09c02f83c19c9865c3ba54cf85bec1ae65 | ToshineeBhasin/Python-Programs | /no_divide_by_another_no.py | UTF-8 | 564 | 4.3125 | 4 | [] | no_license | '''
Created on 30-Jul-2020
@author: Toshinee Bhasin
'''
#python program to display number divide by another number
my_list = []
n = int(input("Enter total number of element :"))
print("Enter numbers :")
for i in range(0,n):
ele=int(input())
my_list.append(ele)
# use anonymous function to filt... | true |
fde1bdb5702a1a24505f766415b0fd365a3cf50a | agustinvalenci2/game3 | /Juego/fps.py | UTF-8 | 466 | 3.21875 | 3 | [] | no_license | import time
fps = 5
skipticks = 1/(fps*1.0)
i= 0
nextsnap=time.clock()
print( skipticks, fps)
while (True):
tim= time.clock()
i=i+1
# this prints the fps
#'print 'Fps at start',i, 1/(time.time()-tim)
# this is the sleep that limits the fps
nextsnap+=skipticks
sleeptime = nextsnap-time.clock(... | true |
6736404fa2079c9b9cae8c4634ddb8a3eed2d2e2 | adx59/Quizlet-Worder | /make_list.py | UTF-8 | 777 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python
from PyDictionary import PyDictionary
class NoDefinition(Exception):
pass
def make_list(wordlist: list):
"""Makes a term: definiton list.
make_list(wordlist) -> ([str, str, str], [str, str, str])"""
terms, definitions = [], []
dictionary = PyDictionary()
for wor... | true |
b1659486ab9f960284797f68b91ee351f2e2c0c9 | Cognonto/cowpoke | /autoFill.py | UTF-8 | 2,058 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 22 12:29:55 2020
@author: mike
"""
from ipywidgets import *
def autoFill(opts=[''], val='',txt='',placehold='Please type here...',callback=False):
opts.append('')
def dropFunc(value):
if (value.new in opts):
dropClose()
if (callab... | true |
5ac51cc7ab61347b25b9b0d59b1595a5743bcb13 | RemiLehe/mkl_fft | /mkl_fft/tests/test_speed.py | UTF-8 | 2,399 | 2.5625 | 3 | [
"MIT"
] | permissive | from __future__ import division, print_function
import time
import numpy as np
from mkl_fft import fft, ifft, rfft, irfft, fft2
if __name__ == "__main__":
import time
n_iter = 200
M = 1
N = 2**14
sqrtN = int(np.sqrt(N))
scrambled=False
np.seterr(all='raise')
algos = {
... | true |
f6281164235c2c0bf8caf552856b63ea2750b88c | simgyojin/Part-Time-Job | /출근 입력 프로그램/출근입력.py | UTF-8 | 5,020 | 3.3125 | 3 | [] | no_license | from openpyxl import Workbook
import openpyxl
from datetime import date
from datetime import datetime
from datetime import time
import os
print('='*60)
print('근무관리 시스템입니다. 문의사항은 교진이한테 물어보세영~')
# 기존파일
work_file = openpyxl.load_workbook('근무관리.xlsx')
#make_excel_sheet(take_date()[1], work_file)
# 워크시트 얻는 함수
def make_exc... | true |
0b5a8ecb5491479a1a260e1c03bd6f74e7774ef7 | dfischer/Tier | /Tier.py | UTF-8 | 21,046 | 2.703125 | 3 | [] | no_license | # interpreter for the Tier language
# All in one file to make things easier when running (no need to have multiple modules)
# Language and interpreter created by Brian Neville 21/12/19
import os
import sys
import argparse
import fnmatch
from collections import defaultdict
import re
from random import randint
... | true |
6e56aeb72ecf275640aef185dc996268c46c429b | EduardoLucas-Creisos/Python-exercises | /Exercícios sobre fundamentos/ex28.py | UTF-8 | 520 | 4.59375 | 5 | [
"MIT"
] | permissive | #Exercício Python 028: Escreva um programa que faça o computador "pensar" em um número inteiro entre 0 e 5 e peça para o usuário tentar descobrir qual foi o número escolhido pelo computador. O programa deverá escrever na tela se o usuário venceu ou perdeu.
import random
num = random.randint(0, 5)
n = int(input('Tente a... | true |
2e6c627a55f64774d32087cb4d7084531337fae2 | asad-mahmood/moviesApp | /app.py | UTF-8 | 7,756 | 3.03125 | 3 | [] | no_license | import numpy as np
import pandas as pd
import streamlit as st
from pandas_profiling import ProfileReport
from streamlit_pandas_profiling import st_profile_report
import plotly.express as px
# Web App Title
st.set_page_config(page_title='Movie Explorer',
layout='wide')
st.title("Movie E... | true |
79bde5ecda8e72bccf94bc2bb52132150c2a3b96 | drstrng/synapse | /synapse/threads.py | UTF-8 | 4,591 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | import os
import time
import sched
import functools
import threading
import traceback
from synapse.compat import queue
from synapse.compat import sched
from synapse.eventbus import EventBus
def worker(meth, *args, **kwargs):
thr = threading.Thread(target=meth,args=args,kwargs=kwargs)
thr.setDaemon(True)
... | true |
cc3a59ab8e268bea8b6ed599dd23f43858b0cee3 | chendddong/OSSU | /Harvard_CS50_Intro/Week 8/Lecture 8/store/application.py | UTF-8 | 718 | 2.59375 | 3 | [] | no_license | from flask import Flask, redirect, render_template, request, session, url_for
app = Flask(__name__)
app.secret_key = "shhh"
@app.route("/", methods=["GET", "POST"])
def store():
if request.method == "POST":
for item in ["foo", "bar", "baz"]:
if item not in session:
session[item... | true |
d4ceb2fde2cf2abd6a0d31982c961658d8e32aa8 | 139bercy/secret_stat | /main.py | UTF-8 | 1,138 | 2.671875 | 3 | [] | no_license | import pandas as pd
from aggregation import Version4SafeAggregation
def apply_secret_stat(dataframe: pd.DataFrame,
columns_to_check: list,
list_aggregation: list,
dominance: int = 85,
frequence: int = 3) -> dict:
specific_agg... | true |
84496ffe2a245078dc2f1b06813edc33da4b0d1b | sruthy-github/sruthy-python-files | /collections/dictionary/1.py | UTF-8 | 246 | 2.921875 | 3 | [] | no_license | #dictionary
#dic={}
#keyvalue players
dic={"name":"luminar","location":"Kakkanad","course":"python","mark":120,"data":10.5}
print(dic["location"])
dic["mark"]+=30
print(dic)
#delete
dic.pop("data")
#del dic["data"]
print(dic)
print("name" in dic) | true |
2f7a486ea3f56b2ac46b6ae5404c21aa11c3a4e0 | nzisouli/NFS | /client.py | UTF-8 | 3,079 | 2.84375 | 3 | [] | no_license | from clientNFS import *
from time import *
def Main():
print "==========================="
print "Get directory service info "
#address = raw_input("Address: ")
address = "192.168.1.2"
port = int(raw_input("Port: "))
mynfs_set_srv_addr(address, port)
print "==========================="
secs = int(raw_input("... | true |
c426d805d498f5c877c70c660a94bdddc76cdfd8 | yuta346/Algorithms | /LeetCode/subsets.py | UTF-8 | 771 | 3.8125 | 4 | [] | no_license | # Given an integer array nums of unique elements, return all possible subsets (the power set).
# The solution set must not contain duplicate subsets. Return the solution in any order.
# Example 1:
# Input: nums = [1,2,3]
# Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
# Example 2:
# Input: nums = [0]
# Output:... | true |
60b71f7774df2e480b7fb86b3e5cde3aba758094 | ietheredge/VisionEngine | /VisionEngine/utils/perceptual_loss.py | UTF-8 | 787 | 2.515625 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
import numpy as np
import numba
def make_perceptual_loss_model(input_shape, layers=[13]):
loss_model = tf.keras.applications.VGG16(
weights="imagenet", include_top=False, input_shape=input_shape
)
loss_model.trainable = False
for layer in loss_model.layers:
laye... | true |
78aed58689bbd197926130147e48784c87607d7b | tarunsuresh/Data-Visuallsation | /scatterPlot.py | UTF-8 | 235 | 2.671875 | 3 | [] | no_license | import pandas as pd
import plotly.express as px
df = pd.read_csv("CovidData.csv")
fig = px.scatter(df, x="date", y="cases",
size="cases",color="country",
size_max=15,title="Covid Cases")
fig.show() | true |
2227fa41ed9adb08c2e568dfd59f63a157a24426 | Saummya/Python-Mini-Projects | /Ram_Navmi_Wishes.py | UTF-8 | 1,753 | 3.21875 | 3 | [
"MIT"
] | permissive |
#Wish your peers Ram Navmi in this unique way..
for i in range(3):
for j in range(i+1):
print("*", end=" ")
print()
for i in range(5):
for j in range(i+1):
print("*", end=" ")
#if(j==0 or j==i or i==7):
#print("*", end=" ")
... | true |
0da5c563652c94cd21d5be18ead96e976c08d2b6 | irshadkhan248/JavaPythonAndroidMysqlCode | /irshad dir/kamal/demo_python/python/L4/ArraySort.py | UTF-8 | 276 | 3.71875 | 4 | [] | no_license | import array
n=int(input("enter number of element :"))
num=array.array('i',[])
for i in range(n):
ele=int(input("enter element :"))
num.append(ele)
print(num)
for i in range(n):
for j in range(i+1,n):
if num[i]>num[j]:
num[i],num[j]=num[j],num[i]
print(num) | true |
077bf9f5535d2d9102fdd3ae8fc2986f9cee3fbe | qizhu8/CSCI6230-project | /PythonClasses/ECC_Class.py | UTF-8 | 4,524 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python3
import numpy as np
import PythonClasses.Number_Package as npkg
class ECC(object):
"""docstring for ECC."""
def __init__(self, poly_coeff=None, N=-1):
self.poly_coeff = None
self.N = -1
self.set_poly_coeff(poly_coeff)
self.set_modulo(N)
def __str__(se... | true |
c99b556ab4d1d2f2e95b935aa03023dcfd034b8c | archibate/game-devel | /game.py | UTF-8 | 4,117 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
from VectorClass import Vec2d
from math import *
cursor = 'mousecursor.png'
sprite = 'fugu.png'
if True:
background = 'sushiplate.jpg'
screen = ((640, 480), DOUBLEBUF | NOFRAME, 32)
else:
background = None
screen... | true |
903fbe52be3f4ca0498b80b4c9967296740b6dfa | bluvory/Python_for_coding_test | /ch08/8-3.py | UTF-8 | 459 | 3.390625 | 3 | [] | no_license | # 분할 정복 Divide and Conquer 알고리즘
# 탑다운 Top-Down 방식 (하향식)
# 재귀 함수를 이용하여 다이나믹 프로그래밍 소스코드를 작성하는 방법은 큰 문제를 해결하기 위해 작은 문제를 호출한다
# 호출되는 함수 확인
d = [0]*100
def pibo(x):
print('f('+str(x)+')', end=' ')
if x==1 or x==2:
return 1
if d[x] != 0:
return d[x]
d[x] = pibo(x-1) + pibo(x-2)
return d[x]
pibo(6) | true |
625e5acaebc7d4e231c8e781efde4ac7d3ae9725 | LadyFelix/Examen-parcialAEP | /ejercicio2.py | UTF-8 | 399 | 3.84375 | 4 | [] | no_license | #hacer que el sistema genere un
#numero aleatorio entre 1 y 10. Luego
# hacer que el usuario adivine el numero. La
#aplicacion debe terminar cuando el usuario adivine.
import random,os
os.system("cls")
a = random.randint(1,10)
while True:
b = int(input("Adivine el numero de 1 a 10:"))
if a == b:
pri... | true |
e565e3a440ee66114322dfc4f09d18d955337d81 | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_1_neat/16_0_1_harihariharan_Sheep_code.py | UTF-8 | 566 | 3.484375 | 3 | [] | no_license | def extract_digit(number):
str_num = str(number)
digits = []
for num in str_num:
digits.append(int(num))
return digits
def fetch_count(x):
cur_iter = x
digit_set = set()
while True:
digits = extract_digit(cur_iter)
for digit in digits:
digit_set.add(digit)
if len(digit_set) == 10:
return str(cur_i... | true |
cd270d5dfe57b4914f16291083368ada8f9fd71e | kev-in-ta/CARIS-PAW-RT-terrain-classification | /USSSensorLib.py | UTF-8 | 3,860 | 2.828125 | 3 | [] | no_license | """
Author: Kevin Ta
Date: 2019 June 26th
Purpose: This Python library runs the ultrasonic sensors.
1. AJ-SR04M-1 - Ultrasonic Sensor
2. AJ-SR04M-2 - Ultrasonic Sensor
"""
# IMPORTED LIBRARIES
import RPi.GPIO as GPIO
import time, threading
import numpy as np
import os, sys
from m... | true |
c1dbd119e39eed67503326aa3ed36775ffefc9a2 | karolinanikolova/SoftUni-Software-Engineering | /2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/08-Text-Processing/02_Exercises/03-Extract-File-1 .py | UTF-8 | 536 | 4.28125 | 4 | [
"MIT"
] | permissive | # 3. Extract File
# Write a program that reads the path to a file and subtracts the file name and its extension.
path = input()
for index in range(len(path)-1, 0, -1):
if path[index] == ".":
start_index_extension = index + 1
end_index_filename = index - 1
elif path[index] == "\\":
sta... | true |
5b53e69a217900dd47aeef174d4727495c1da47d | sakinala1006/number-guessing | /guess.py | UTF-8 | 2,186 | 4.09375 | 4 | [] | no_license | import random
def generate_hint(number_generated, number_guessed):
options = ['multiples', 'differences']
hint_type = random.choice(options)
if hint_type == 'multiples':
multiple_list = [(number_generated * i) for i in range(2, 10)]
print(str(random.choice(multiple_list)) + " is a multiple!")
else:
diff = ... | true |
8b4ab5a94ab5b50cf2ec19a335a97a37bbd524de | ChoKyuWon/SchoolProjects | /MachineLearning/hw1/models/LinearRegression.py | UTF-8 | 2,006 | 3.28125 | 3 | [
"MIT"
] | permissive | import numpy as np
class LinearRegression:
def __init__(self, num_features):
self.num_features = num_features
self.W = np.zeros((self.num_features, 1))
def train(self, x, y, epochs, batch_size, lr, optim):
final_loss = None # loss of final epoch
# Training should b... | true |
0894f8dd2694a1b3d8eb0c5bb08d702e37256e89 | scorphus/advent-of-code-2020 | /aoc/day13/__init__.py | UTF-8 | 882 | 2.90625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of Advent of Code 2020
# https://github.com/scorphus/advent-of-code-2020
# Licensed under the BSD-3-Clause license:
# https://opensource.org/licenses/BSD-3-Clause
# Copyright (c) 2020, Pablo S. Blum de Aguiar <scorphus@gmail.com>
from sympy.ntheory.mo... | true |
78c2fb7203f090238e0e78ab01c510af14af6c18 | hn5092/learn_python | /microsoft_online/com/learn/basic/decoratordemo/__init__.py | UTF-8 | 219 | 2.703125 | 3 | [] | no_license |
#1.设计一个装饰器 在装饰器参数为("root")的时候 执行某些方法 在参数为其他参数的时候执行另外的方法
def root():
print "run root"
def zookeeper():
print "run zookeeper"
| true |
82b3472a4a222a291edb8fccad321006dbcf7264 | sayed07/sayed | /count.py | UTF-8 | 76 | 3.28125 | 3 | [] | no_license | bj=int(input())
count=0
while bj>0:
count+=1
bj=bj//10
print(count)
| true |
61a44f5032d85a4086be45355698ffd6dd65d2bf | UniSurreyIoT/SAX-LDA | /logic/ldaConfig.py | UTF-8 | 1,700 | 2.625 | 3 | [] | no_license | import datetime
from pprint import pprint
import string
__author__ = 'Daniel Puschmann'
def make_alphabets(feature_descriptions, alphabet_size):
print "making alphabet with size %i" %alphabet_size
alphabet_start = 0
alphabets = {}
print "features"
pprint(feature_descriptions)
for k... | true |
cb540a800b39b036cd4d54c24a348b781955e250 | constanzaurzua/06Tarea | /parte2.py | UTF-8 | 2,606 | 3.3125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Este script resuelve un problema simple de diffusion en 1D.
La ecuación a resover es:
dn/dt = gama * d2n/dx2 + un - un^3;
n(0,x) = np.random.uniform(low=-0.3, high=0.3, size=N_steps);
n(t, 0) = 0 n(t, 1) = 0
'''
from __future__ import division
import nump... | true |
e2144622719f0f5974b46e785d5314d75ff7b3f0 | timbuckwho/cfb-pickem | /pickem/predictor.py | UTF-8 | 950 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import os
import argparse
def grey_code_index(n):
'''returns the index of the bit (indexed from 0) flipped from
the (n-1)th grey code to the nth grey code
'''
return one_bit_location(grey_code(n)^grey_code(n-1))
def one_bit_location(n):
'''Converts to binary strin... | true |
f8b340f1445367c2a6ea4964abcf57b8f87e3ce8 | PetarV-/telesign | /preprocess/dataset.py | UTF-8 | 517 | 3.640625 | 4 | [
"MIT"
] | permissive | # A dictionary that maps phone number IDs
# to PhoneNumber classes - top level data class.
class Dataset():
def __init__(self):
self.nums = dict()
def __getitem__(self, key):
return self.nums[key]
def __setitem__(self, key, val):
self.nums[key] = val
def __str__(self):
... | true |
28b3e85f9eb96ff2ab99f1b1ac4c09e1ab44b835 | ymsk-sky/atcoder | /abc015/b.py | UTF-8 | 173 | 2.75 | 3 | [] | no_license | n=int(input())
l=list(map(int,input().split()))
s=0
i=0
for a in l:
if a!=0:
s+=a
else:
i+=1
n-=i
if s%n==0:
print(s//n)
else:
print(s//n+1)
| true |
6f2b18ae7224a0d308d234e3e48029b5556b2aa6 | akhYalda/snippets | /tdt4117/e3/t4.py | UTF-8 | 741 | 2.65625 | 3 | [] | no_license | import functions
def main(dictionary, tfidf_model, tfidf_corpus, matrix_sim, lsi_matrix, lsi_model, paragraphs):
# Task 4.1
query = "How taxes influence economics".lower()
query = functions.process(query)
query = dictionary.doc2bow(query)
# Task 4.2
tfidf_index = tfidf_model[query]
# Tas... | true |
c2b77d3183e127acaf4895a05baf5d46346b2d95 | damanncarlos/Ocelot | /ocelot/transformations/cutoff/markets.py | UTF-8 | 3,267 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from ..utils import nonreference_product, get_single_reference_product
from ..uncertainty import scale_exchange
import logging
logger = logging.getLogger('ocelot')
def constrained_market_allocation(dataset):
"""Perform constrained market allocation on a dataset.
A constrained market ... | true |
af73773b50abaa8cbc114072a3e11a3c7c58b44c | feifeiyuan/feifeiyuan | /cgi-bin/index.py | UTF-8 | 484 | 2.828125 | 3 | [] | no_license | #!/usr/bin/python
#coding=utf-8
import os
print("Content-type: text/html\r\n\r\n")
print("<meta charset=\"utf-8\">")
print("<b>Enviroment</b></br>")
print("<ul>")
for param in os.environ.keys():
print("<li><span style='color:green'>%20s</span>: %s</br></li>"%(param, os.environ[param]))
print("</ul>")
print("<html>")... | true |
9c09b16c513d9b5151fab333dcabb2d0d0782c3b | nhatsmrt/AlgorithmPractice | /LeetCode/1078. Occurrences After Bigram/Solution.py | UTF-8 | 355 | 3.484375 | 3 | [] | no_license | class Solution:
def findOcurrences(self, text: str, first: str, second: str) -> List[str]:
# Time and Space Complexity: O(|text|)
words = text.split(" ")
ret = []
for i in range(len(words) - 2):
if words[i] == first and words[i + 1] == second:
ret.append... | true |
a4ee858598f82e8da4e23d785a9832573211ecf9 | NaveenChengappa/E2E_learning_RC | /E2E_RPi_code/delete_recordings.py | UTF-8 | 1,309 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Dec 19 21:54:17 2020
@brief : Deletes all images and files generated
@author: Naveen Chengappa
"""
import os
import glob
"""
Path Init
"""
image_path = '/home/pi/E2E_learning_RT/cam_images/*.jpg'
image_csv_path = '/home/pi/E2E_learning_RT/CSV_files/image_names.csv'
rover_da... | true |
657d9ccbcba8ed8b39eccff95119fe8d1a087394 | noFloat/RED | /RewardBasedExplorationDecay.py | UTF-8 | 17,424 | 3.171875 | 3 | [] | no_license | """ inspired from https://gym.openai.com/evaluations/eval_lEi8I8v2QLqEgzBxcvRIaA/ """
import os
import pandas as pd
import numpy as np
from torch.utils.tensorboard import SummaryWriter
from tqdm import trange
import glob
import gym
from collections import deque
class EpisodicAgent(object):
"""
Episodic agent ... | true |
9127918db3271d2c4dd8ce0ab229d295f6260c68 | hag007/bnet | /src/runners/jactivemodules_greedy_runner.py | UTF-8 | 3,526 | 2.546875 | 3 | [] | no_license | """Calculate differentially expressed genes using EdgeR from bioconductor.
http://bioconductor.org/packages/2.5/bioc/html/edgeR.html
Usage:
count_diffexp.py <count_file>
"""
import sys
sys.path.insert(0, '../')
import os
import subprocess
import src.constants as constants
from src.utils.scripts import format_s... | true |
3e96c9b83c361b9579e74d637ab2b94f984a8808 | 815220601/scb14 | /xiangwo7.py | UTF-8 | 2,563 | 3.1875 | 3 | [] | no_license | import requests
import openpyxl
def read_data(filename,sheetname):#定义函数封装
wb = openpyxl.load_workbook(filename) #加载工作簿
# print(wb)
sheet = wb[sheetname]
#获取表单
max_row = sheet.max_row #获取最大行数
# print(max_row)
case_list=[] #创建一个空列表存放测试用例
for i in range(2,max_row+1):
dict1 = dic... | true |
49bbbc8ade935fa4d873a447e31a198dc6be826b | bootchk/freehandTool | /freehandTool/segmentString/cuspness.py | UTF-8 | 1,912 | 3.1875 | 3 | [] | no_license | '''
Copyright 2012 Lloyd Konneker
This is free software, covered by the GNU General Public License.
'''
class Cuspness(object):
'''
A cache of cuspness.
Cuspness is a property between two adjacent segments in a string.
Cuspness is the opposite of colinear.
A synonym is "smoothness", with opposite values... | true |
70a4f0b086f82dfcd55deec17fb1ff38272de708 | stjordanis/sudoku-solver-1 | /sudokubot/solver.py | UTF-8 | 668 | 3.15625 | 3 | [
"MIT"
] | permissive | from utils import search , display, grid_values, row_units
import sys
def solve(grid, format='string'):
if len(grid) != 81:
print 'ERROR: Sudoku length is not proper'
sys.exit()
values = search(grid_values(grid))
if '' in values.values():
print 'INFO: Invalid Sudoku'
sy... | true |
b97586756284aaf8ea4644c4d74fdfbcde9fce0e | AndresHG/UCM | /Python/Ejercicio2Python.py | UTF-8 | 1,098 | 4.34375 | 4 | [] | no_license | #Pedimos el mes por primera vez al usuario
mes = input("Introduzca el nombre del mes: ")
#Utilizamos un bucle while ya que en el ejemplo, se hacen varias peticiones al usuario
#El bucle termina cuando pulsamos 0
while mes != "0":
#Utilizamos la función lower() que nos pasa un string a todo minúsculas
... | true |
ea20047b71540fd56b4ffd04c33be06e38b9d395 | harshnarang8/cs771a2 | /solver_GD.py | UTF-8 | 6,772 | 2.8125 | 3 | [] | no_license | import numpy as np
from scipy.sparse import csr_matrix
import sys
from sklearn.datasets import load_svmlight_file
import random
from datetime import datetime
import math
from tqdm import tqdm
def h(n):
return 1;
def cal(evaluator, w):
temp = csr_matrix(np.ones(evaluator.shape)) - evaluator; # 1 - evaluator
... | true |
93e4a2cdc98df1669bb2afe2e4d76dc6877c0231 | bernatesquirol/soccer-dashboard | /last_minute.py | UTF-8 | 1,296 | 3.125 | 3 | [] | no_license | import pandas as pd
competitions = ['England', 'France', 'Germany', 'Spain', 'Italy']
minutes = 2
for competition in competitions:
events = pd.read_json('events/events_{}.json'.format(competition)).set_index('id')
# events_shot = events[events.eventName == 'Shot']
# del events
# last minutes events
... | true |
71c18cbed1823fbe14cdd950844a24ad3f1c4f03 | joedellamorte/PythonPyromaniacs | /course.py | UTF-8 | 3,955 | 2.953125 | 3 | [] | no_license | __author__ = 'NicholasArnold'
class Course:
def __init__(self, title, code, section, typ, cred, location, days, time,
instructor, notes=None):
"""
:param title: Title of course: 'Eng Compt ++'
:param course: Code for course in 'ENG EK 128'
:param section... | true |
3ab2a43c99a61d7d1138537e361cebee26b725c8 | acunning1/bbmap | /methods.py | UTF-8 | 4,227 | 3.15625 | 3 | [] | no_license | ############################################
# methods.py for bbmap.py
# Broadbandmap.gov API requester
#
# Created by Andy Cunningham
# 5/8/17
############################################
# Import libraries
import argparse
import requests
import csv
import numpy as math
# Create IncomeRequester object
class IncomeRe... | true |
38634bc085670cde4292233fa80a4e1fb53e9ced | joshavenue/python_notebook | /gcd.py | UTF-8 | 418 | 4.0625 | 4 | [
"Unlicense"
] | permissive | def gcd(m,n):
if n == 0:
return m
else:
return gcd(n, m % n)
def iterative_gcd(num1, num2):
min = num1 if num1 < num2 else num2
largest_factor = 1
for i in range(1, min + 1):
if num1 % i == 0 and num2 % i == 0:
largest_factor = i
return largest_factor
def main():
for num1 in range(1, 101):
for nu... | true |
da9c553da4b3b8fde96965d1c1ca1a8bf01287ff | huynguyenxyz/huynguyen-fundamental-c4t4 | /session03/ramdomnumber.py | UTF-8 | 103 | 3.0625 | 3 | [] | no_license | from random import randint
numb = randint(0,100)
print ("A random number (0-100) : {0}".format(numb)) | true |
3068bed3f5f353a74fe7cd78ce98cc420df8c123 | nastyc0de/unipython | /POO/ProyectoPC/Raton.py | UTF-8 | 477 | 3.296875 | 3 | [] | no_license | from DispositivosEntradas import DispositivoEntrada as DE
class Raton(DE):
contador = 0
def __init__(self, marca, tipo_entrada):
Raton.contador += 1
self._id = Raton.contador
super().__init__(marca, tipo_entrada)
def __str__(self):
return f'{self._id}, {self._marc... | true |
bfa994e126debc704b697a40927b536927e8a85d | youngung/mpl-lib3 | /src/lib/axes_label.py | UTF-8 | 8,875 | 2.5625 | 3 | [] | no_license | ## Collection of axes labels
def __ehkl__(ax,ft=15,iopt=0):
"""
elastic strain (hkl) vs macroscopic flow
"""
if iopt==0:
ax.set_xlabel(r'$\Sigma_{11}$ [MPa]',dict(fontsize=ft))
ax.set_ylabel(r'$\varepsilon^{hkl}$',dict(fontsize=ft))
elif iopt==1:
ax.set_ylabel(r'$\Sigma_{11}$... | true |
38412e53f59118df8349b36b4c47ba87d043fd01 | nextasycds/StormCoat | /LED/lightning.py | UTF-8 | 846 | 2.515625 | 3 | [] | no_license | import board
import time
import neopixel
#one lightning flash
def plumeLight(strip, firstpixel):
for a in range(44):
strip[a+firstpixel]=(255, 255, 255)
strip.show()
for a in range(44):
strip[a+firstpixel]=(0, 0, 0)
strip.show()
for a in range(44):
strip[a+firstpixel]=(255... | true |
0c9b950b7577aa72562b6957888ff085fa7622f3 | iSaint06/iterative-prisoners-dilemma | /team0.py | UTF-8 | 956 | 3.609375 | 4 | [] | no_license | ####
# Each team's file must define four tokens:
# team_name: a string
# strategy_name: a string
# strategy_description: a string
# move: A function that returns 'c' or 'b'
####
team_name = 'Mr G' # Only 10 chars displayed.
strategy_name = 'Im guessing'
strategy_description = 'History'
def move(my... | true |
0db20d2504be35f5dfa80a07c429d0fac4c831d3 | rekhacse/python-basics | /listform.py | UTF-8 | 181 | 3.15625 | 3 | [] | no_license | a=[10,20,30,40,60]
print(a[0])
b=['a','b','c']
print(b[1])
#list can contains either number or string only.string must be given in strings. both cannot be defined in the same list.
| true |
0cc1c49682c68aedb595d7e5220de99990851bc8 | hgarbeil/new_england | /ny_unemp.py | UTF-8 | 1,575 | 2.546875 | 3 | [] | no_license |
import pandas as pd
import geopandas
import folium
import json
import numpy as np
import webbrowser
import io
import geopandas as gpd
county_geo = r'../us-counties.json'
#with open(county_geo, 'r') as f:
# get_id = json.load(f)
geo = gpd.read_file(county_geo)
geo.info()
df_sample = pd.read_csv('https://raw.githubus... | true |
8d9861f85cf8358bce71e0b4b49820db38c49156 | ThomasMott/Python | /RandomPlayerNoAssignment.py | UTF-8 | 336 | 3.484375 | 3 | [] | no_license | import random
num = 0
playNum = []
play = []
lineUp = []
num = int(input("how many players?"))
for i in range(1,num + 1):
playNum.append(i)
for j in range(1,num + 1):
play.append(str('player ' + str(j)))
random.shuffle(playNum)
for k in range(0,num):
print(str(play[k]) + " is " + st... | true |
8e5157f9a144e6a75d61e3b3c765d8da7e3f0235 | Nocommas555/TurtlePatformer | /tools/collider_drawer/collider_drawer.py | UTF-8 | 6,442 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | '''Tool for drawing colliders onto sprites and autogenerating img_descr.json'''
import json
import os
import tkinter as tk
# init globals
sprite_names = []
sprites = []
sprites_resized = []
target_sprite = 0
sprite_tk_image = None
sprite_scale = 1
colliders = []
curr_collider_id = 0
collider_types = [["rigid", "#bb0... | true |
208b024cba5c05e1c1d2d3a210e4c0f41edcd24b | GDalonso/BBallReferencePlayoffSeriesScraper | /models/PlayoffSeries.py | UTF-8 | 3,638 | 2.8125 | 3 | [] | no_license | from constants import WINS_NECESSARY_BY_SERIES_LENGTH, NBA_CHAMPS
from datetime import datetime
class PlayoffSeries:
def __init__(self, series_name, winner, loser, games=[], best_of_series=7):
self.series_name = series_name
self.winner = winner
self.loser = loser
self.games = games... | true |
c8d532e47ffec98eb61237535051e591221356c6 | MarcusRenshaw/Fusion-MSc | /length_decay_rate.py | UTF-8 | 2,468 | 2.78125 | 3 | [] | no_license | from pictry import *
from scipy.signal import argrelextrema
import numpy as np
import matplotlib.pyplot as plt
import datetime as dt
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import os
length=[]
decay_rate = []
for y in [6,8,10,12,14,16,18,24,48]:
gradients = []
... | true |
48e4a704afdde508d40e84fe402ff71254aede6b | Mykrobe-tools/mykrobe-atlas-tracking-client | /tracking_client/models/validated/event.py | UTF-8 | 272 | 2.546875 | 3 | [] | no_license | from tracking_client import Event
class ValidatedEvent(Event):
@Event.duration.setter
def duration(self, duration):
if not isinstance(duration, int):
raise ValueError("duration must be an integer")
Event.duration.fset(self, duration) | true |
4846eea1b0a832bf9ca5acef4a1da0a45eb46851 | gp1204270657/pytest | /common/Request.py | UTF-8 | 3,626 | 2.546875 | 3 | [] | no_license | import requests
from urllib3.exceptions import InsecureRequestWarning
from common.generate_sign import generate_sig,timestamp
from common import Log
log = Log.MyLog()
class Request():
def get_request(self, url, data,verify=False):
"""
Get请求
:param url:
:param data:
:return:... | true |
c1ea12bc2e019af743b4fa44eb491800c82fbaf5 | icanardahan/d3gcSrPClJMha9T8 | /happyCustomers.py | UTF-8 | 6,846 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('darkgrid')
from sklearn.preprocessing import LabelEncoder
import warnings
warnings.filterwarnings('ignore')
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
... | true |
69f2704767cac4028822d7f3610270338ff868e3 | YaroslavRybalchenko/Python | /Kata/Pete the baker/Pete.py | UTF-8 | 253 | 3.125 | 3 | [] | no_license | def cakes(recipe, available):
number=float('inf')
for x in recipe:
if x in available:
temp=available[x]//recipe[x]
if temp<number:
number=temp
else:
return 0
return(number)
| true |
5f12db4bef547fdbac43fa3c981f65f538f6e61e | yerihyo/foxylib | /foxylib/tools/finance/forex/tests/test_forex_tool.py | UTF-8 | 663 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | import logging
from decimal import Decimal
from pprint import pprint
from unittest import TestCase
import pytest
from foxylib.tools.finance.forex.forex_tool import ForexTool
from foxylib.tools.log.foxylib_logger import FoxylibLogger
class TestForexTool(TestCase):
@classmethod
def setUpClass(cls):
Fo... | true |
84424e477ba9d89f9421c8bf56cd0123c9159811 | ZR-Huang/AlgorithmsPractices | /Leetcode/Others/654_Maximum_Binary_Tree.py | UTF-8 | 514 | 3.578125 | 4 | [
"BSD-3-Clause"
] | permissive | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def constructMaximumBinaryTree(self, nums: List[int]) -> TreeNode:
if not nums:
return None
max_value = max(nums)
max_index = nums.... | true |
fd5c2f1c5435e44bf1916259b75f3fa706be95ae | iandorsey00/geodata | /geodata/datainterface/GeoVector.py | UTF-8 | 14,345 | 2.765625 | 3 | [
"MIT"
] | permissive | '''
Vectors used to compare one geography's demographic characteristics with
others. The closer the Euclidean distance between the vectors, the more
similar the geographies. Scores are determined based on a normalization process
for demographic data.
'''
from tools.geodata_safedivision import gdsd
from tools.geodata_t... | true |
9d967100759a5facd7b179fb204576c222e7738d | defuz/p2py | /translator.py | UTF-8 | 449 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
class Processor(object):
def __init__(self, scope):
self.scope = scope
def process(self, node):
if isinstance(node, (list, tuple)):
result = []
for n in node:
r = self.process(n)
if isinstance(r, (list, tuple)):
result.extend(r)
else:
resu... | true |
1b4b6ef421e66a082d186c6f0b8c01ca6343e338 | srp2210/PythonBasic | /dp_w3resource_solutions/basic-part-1/39_calculate_compound_interest.py | UTF-8 | 486 | 3.59375 | 4 | [] | no_license | """
* @author Divyesh Patel
* @email pateldivyesh009@gmail.com
* @create date 20-05-2020 07:24:36
* @modify date 20-05-2020 07:24:36
* @desc Write a Python program to compute the future value of a specified principal amount,
rate of interest, and a number of years.
"""
def calculate_compounded_interest(... | true |
977e856c5931508aeeb9fe318e3fae68aef93db6 | lcsm29/project-euler | /py/py_0407_idempotents.py | UTF-8 | 548 | 3.015625 | 3 | [
"MIT"
] | permissive | # Solution of;
# Project Euler Problem 407: Idempotents
# https://projecteuler.net/problem=407
#
# If we calculate a2 mod 6 for 0 ≤ a ≤ 5 we get: 0,1,4,3,4,1. The largest
# value of a such that a2 ≡ a mod 6 is 4. Let's call M(n) the largest value of
# a < n such that a2 ≡ a (mod n). So M(6) = 4. Find ∑ M(n) for 1 ≤ ... | true |
af593c0ee166a1b84e9f99e64b9eb3cb7e90c37f | Token523/CurrentParser | /BrookesParser.py | UTF-8 | 618 | 2.765625 | 3 | [] | no_license |
#### opening the eletrophysiology file
import csv
from copy import deepcopy
import matplotlib.pyplot as plt
import numpy as np
from numpy import genfromtxt
data = genfromtxt('C:\\Users\\sbmiller\\Documents\\Workspace\\Python\\Data.csv', delimiter=',')
TimeArray = []
temp = []
Datatemp = []
SectionArray = []
count = 0... | true |
cda35e24bf5701e23d392da536744eadd2c2c7f2 | sergiocorato/anviz-sync | /anviz_sync/progress.py | UTF-8 | 4,159 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
anviz_progress.progress
~~~~~~~~~~~~~~~~~~~~~~~
Module that contains a ProgressBar object definition.
:copyright: (c) 2014 by Augusto Roccasalva.
:license: BSD, see LICENSE for more details.
"""
import sys
# Fancy progress ala (pacman-color) ArchLinux
_colors = {
... | true |