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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b0bb19e9f43555db74601eddc4c566091e0f5fdb | Python | ArunkumarRamanan/CLRS-1 | /ProgrammingInterviewQuestions/23_NumberOfPaths.py | UTF-8 | 725 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 19 16:02:09 2016
@author: Rahul Patni
"""
# traversing through map
def expandMatrix(A):
l = len(A) + 2
b = len(A[0]) + 2
new_mat = []
[new_mat.append(b * [0]) for x in range(l)]
for i in range(l):
for j in range(b):
if i == 0 or ... | true |
c846d8dc7de73c077e0a7912faedabf940240afd | Python | ctaboy/SpringProjects21 | /G2P_Conversion/g2p.py | UTF-8 | 1,945 | 2.734375 | 3 | [] | no_license | """Portuguese g2p rules."""
import pynini
from pynini.lib import rewrite
from pynini.lib import pynutil
v = pynini.union("a", "e", "i", "o", "u")
acute_a = pynini.union("á")
c = pynini.union(
"b",
"c",
"ç",
"d",
"f",
"g",
"h",
"j",
"k",
"l",
"m",
"n",
"p",
"q",
... | true |
43f874af2c4f9ec43fe97291582eaa143dd5a820 | Python | daianasousa/Mensagens-Segretas | /media.py | UTF-8 | 746 | 3.921875 | 4 | [
"MIT"
] | permissive | lista = list()
soma = 0
for n in range(6):
nota = float(input(f'Digite a nota {n+1}: '))
soma += nota
lista.append(nota)
menor = min(lista)
b1 = (soma - menor) / 5
print(f'A menor nota foi {menor}')
soma1 = 0
for n in range(6):
nota = float(input(f'Digite a nota {n+7}: '))
soma1 += nota
lista.a... | true |
0c77ee05fd5363d750e2a8c0bd81552244fb337a | Python | lym/yummy-recipes-api | /models/recipe.py | UTF-8 | 1,041 | 2.734375 | 3 | [] | no_license | from models.base_model import db as DB
from .timestamp_mixin import TimestampMixin
class Recipe(TimestampMixin, DB.Model):
""" Encapsulates the business logic of a recipe in the yummy recipes
system.
A recipe belongs to a User
"""
__tablename__ = 'recipes'
id = DB.Column(DB.Integer, ... | true |
227ac51ed04640eb499d1ee88210063a8ff13bdf | Python | Ahmedk-n/SaveMiPass | /main.py | UTF-8 | 1,252 | 2.71875 | 3 | [] | no_license | import os
from db import *
from masterpass import *
import time
know_pass = input("Enter the master password : ")
if know_pass == master_password :
def menu():
print("[1] Create a new passwod ")
print("[2] Retrieve a password ")
print("[3] Find all passwords connected to an e-mail. ")
... | true |
f0a20f261282dac13e2ff03b3571563a411cb1ce | Python | altuhov-as/geekbrains-python-start-homework | /lesson_4/task_6.py | UTF-8 | 496 | 3.984375 | 4 | [] | no_license | from itertools import count, cycle
print("-" * 20, "Start Iterator First")
start_item = 3
for i in count(start_item):
if i > 10:
break
print(i)
print("-" * 20, "End Iterator First")
print()
print("-" * 20, "Start Iterator Second")
my_list = ["A", "8", 15.0, "V", "empty", 0]
max_iterations = 10
itera... | true |
386c647966f2d6e69c739683fc5eab32e531fc29 | Python | dmgolembiowski/samsung-ac-wifi-module | /firmware/proto2/osw/FrameBuilder.py | UTF-8 | 2,245 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from osw.Frame import compute_checksum, Frame
from osw.Storage import x_to_bytes
def build_frame(storage, counter, command, values):
if command is None or len(values) == 0:
raise Exception('Missing required values to build a frame')
# TODO check command
payload = bytearray... | true |
953365fe09d0a649c8452712d9e6dc91c0297e15 | Python | bananushka/ai2 | /BlokusGameInput.py | UTF-8 | 2,678 | 2.953125 | 3 | [] | no_license | from random import shuffle
from BlokusGameShape import BlokusGameShape
class IllegalShapeFileFormatException():
pass
#creates the shapes from the input file and validate the format
def makeShapes(shapesFilePath, boardSizeWithBorder):
with open(shapesFilePath) as f:
shapesList = [[int(x) for x in ... | true |
f64c7af1db3cad52401cbb209c58bf5b9c1462a1 | Python | jicewarwick/Zhihu2Markdown | /zhihu_to_markdown.py | UTF-8 | 3,139 | 3.0625 | 3 | [] | no_license | import json
import os
import re
import click
import html2text
import requests
from bs4 import BeautifulSoup
@click.command()
@click.argument('article_number')
@click.option('--save_dir', default='.', help='markdown储存地址', show_default=True)
@click.option('--image_dir', default='media', help='图片储存地址', show_default=Tru... | true |
5b6cbe94bc34776208395607d17ec570f09e96d1 | Python | sprintly/sprint.ly-services | /lookout/services/webhook.py | UTF-8 | 961 | 2.65625 | 3 | [] | no_license | import urllib2
import simplejson as json
from lookout.base import ServiceBase
class Service(ServiceBase):
"""
WebHooks
We'll hit these URLs with a POST request when a new piece of data is created
within your Sprint.ly project. More information on what we send and in what
format can be found in o... | true |
7a01b26e7791c3bfe0f8844a680fb760b3773d53 | Python | AwsafAlam/Machine_Learning | /Natural_Language_Processing/Chunking.py | UTF-8 | 1,480 | 3.109375 | 3 | [] | no_license | import nltk
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn import model_selection
from nltk.tokenize import sent_tokenize, word_tokenize, PunktSentenceTokenizer
from nltk.corpus import state_union
from nltk.stem import PorterStemmer
from nltk.stem import LancasterStemmer
'''
Consid... | true |
2f945b1662abcfe54d8ec2935e33d6e08c2a393d | Python | shubhamkharose/CODEDAEMON | /All/MAddy/py/Solution.py | UTF-8 | 506 | 2.859375 | 3 | [] | no_license | def addme(n,L,R):
su=0
for i in n:
su+=int(i)
if su>=L and su<=R:
return 1
return 0
n,q,L,R = map(int,raw_input().split())
a = [0]*n
while(q>0):
s,x,y = map(int,raw_input().split())
if s == 1:
a[x-1] = y
else:
i=1
cnt=0
b= a[x-1:y]
... | true |
06f52f2009cc63a3ee70e9d40bf63c050454512f | Python | romy2099/secret_message | /secret_message.py | UTF-8 | 738 | 2.546875 | 3 | [] | no_license | import os, re
def secret_message(prank_path):
directory_list = os.listdir(prank_path) # Returns a list type
# Loop through all the files
# for filename in directory_list:
# new_filename = re.sub('[0-9]', '', filename) # Returns a str type
# os.rename( prank_path + filename, prank_path... | true |
e07fc6cdc7cfef805fd3fa2e1104e78fc4fe800f | Python | ImperialCollegeLondon/sharpy | /sharpy/generators/__init__.py | UTF-8 | 945 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | """Generators
Velocity field generators prescribe the flow conditions for your problem. For instance, you can have an aircraft at
a prescribed fixed location in a velocity field towards the aircraft. Alternatively, you can have a free moving
aircraft in a static velocity field.
Dynamic Control Surface generators enab... | true |
636a22cdad9695ccaf9b351c6ecf74d7ba0d2301 | Python | alexandrem/ansible-openstack-config-gen | /config_parser.py | UTF-8 | 5,526 | 2.53125 | 3 | [
"MIT"
] | permissive | from os.path import basename, splitext
from datetime import datetime
from collections import OrderedDict
import re
import yaml
from oslo_config import iniparser
VERSION = "0.6.0"
class OSConfigParser(iniparser.BaseParser):
comment_called = False
values = None
section = ''
comments = []
comment... | true |
b87babf5d77415f030fa8ba6b6fba96b4340a1ac | Python | tr3yh/facebookBot | /facebookBot-Linux.py | UTF-8 | 3,122 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -------------------------------------------------------------------#
# Facebook bot v1.1: Post Random Quote from The Office #
#--------------------------------------------------------------------#
# Updates: #
# * Adde... | true |
a8e2ce5a1a3a89c6383e1c9240bd30498f03b8c9 | Python | Ashish-kumar-pradhan/python | /python basic/calculater5.py | UTF-8 | 1,798 | 4.28125 | 4 | [] | no_license |
def sub(a,b):
c=a-b
print("subtraction= ",c)
def div(a, b):
c= a / b
print("division= ",c)
def sqr(a):
c=a*a
print("square of",a," = ",c)
def cube(a):
c=a*a*a
print("cube of",a," = ",c)
def sqrt(a):
c=a**(1/2)
print("squareroot of",a," = ",c)
def cbrt(a):
c=a**(1/3)
... | true |
f73f95a58921486aad480b138ae4e6b8cfeed882 | Python | dbhaskaran1/phonenumberinfo | /phoneinfo/info/tests.py | UTF-8 | 1,212 | 2.546875 | 3 | [] | no_license | from django.test import TestCase
from django.test import Client
from models import PhoneInfo
class NumberTestCase(TestCase):
def setUp(self):
PhoneInfo.objects.create(phone_number='6786786789', country='US', carrier='AT&T')
def test_phonenumberprops(self):
num = PhoneInfo.objects.get(phone_nu... | true |
44d50632b484fb3797a82da3bf42657d2f6b4de6 | Python | Montana/travis-multivm-size-projects | /hello.py | UTF-8 | 374 | 3.15625 | 3 | [] | no_license | # All pair combinations of 2 tuples by Montana Mendy for Travis CI
test_tuple1 = (4, 5)
test_tuple2 = (7, 8)
print("The original tuple 1 : " + str(test_tuple1))
print("The original tuple 2 : " + str(test_tuple2))
res = [(a, b) for a in test_tuple1 for b in test_tuple2]
res = res + [(a, b) for a in test_tuple2 for ... | true |
5b90fe29fc4f55ddb1d7d9ea75fe8da130462e3c | Python | n18007/programming-term2 | /src/algo-p1/task20180801_q05.py | UTF-8 | 224 | 3.703125 | 4 | [] | no_license | # 型変換をしてみよう
age = 19
print("「私は", age, "歳です」")#ageを用いて「私は19歳です」と出力してください
count = 5
print(count+1)#countに1を足した値を出力してください
| true |
c2be0c25c26720b8ccf2c12804b1ff8608c92969 | Python | mohit2909/Boltzman_Generators | /deep_boltzmann/deep_boltzmann/models/mueller_potential.py | UTF-8 | 3,034 | 3.140625 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
class MuellerPotential(object):
params_default = {'k' : 1.0,
'dim' : 2}
aa = [-1, -1, -6.5, 0.7]
bb = [0, 0, 11, 0.6]
cc = [-10, -10, -6.5, 0.7]
AA = [-200, -100, -170, 15]
XX = [1, 0, -0.5, -1]
YY = [0, 0.5, 1.5, 1]
d... | true |
4951d0eb707cb2157a817f4f5af39050bb0093ca | Python | JojoN0tFound/rubik | /constants.py | UTF-8 | 1,294 | 3.015625 | 3 | [] | no_license | # General Constants
movements = ['F', 'R', 'U', 'B', 'L', 'D']
allMovements = ['F', 'R', 'U', 'B', 'L', 'D',
'F\'', 'R\'', 'U\'', 'B\'', 'L\'', 'D\'',
'F2', 'R2', 'U2', 'B2', 'L2', 'D2']
color = {
"G": "F",
"R": "R",
"O": "L",
"B": "B",
"W": "U",
"Y": "D"
}
# SuperFlip Mix for testing
hardestMix1 = "U R2... | true |
b7ecec3ef5053d41b372ba56f9e8c09156aa57d6 | Python | duxinyu123/AlgorithmProblem | /排序算法/堆排序.py | UTF-8 | 2,555 | 4.25 | 4 | [] | no_license | # 小根堆
class min_heap():
def __init__(self):
# 使用线性表存储堆数据,第一个位置不使用,用0填充
self.__data = [0]
# 往堆中插入数据
def shift_up(self, l):
i = 1
while i <= len(l):
self.__data.append(l[i-1])
cur = i
# 依次与父节点比较
while cur > 1 and self.__data[c... | true |
cdf1cf790c426cef880b36c15cd008752b3b7321 | Python | kcw8335/100days_coding_study | /0915.py | UTF-8 | 712 | 4.21875 | 4 | [] | no_license | # https://programmers.co.kr/learn/courses/30/lessons/12922#
# 수박수박수박수박수박수?
# <문제 설명>
# 길이가 n이고, 수박수박수박수....와 같은 패턴을 유지하는 문자열을 리턴하는 함수, solution을 완성하세요.
# 예를들어 n이 4이면 수박수박을 리턴하고 3이라면 수박수를 리턴하면 됩니다.
# <제한 조건>
# n은 길이 10,000이하인 자연수입니다.
def solution(n):
answer = ''
# n이 짝수일 경우
if n % 2 == 0:
answer =... | true |
2d13d5ac61356cdd6280badc4f37c3b829fc5f97 | Python | wilhemparaclet/Tp | /Tp1.py | UTF-8 | 2,282 | 3.21875 | 3 | [] | no_license | #importer les librairies
import os
import streamlit as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#Affiche le titre de l'API
st.title("Data App")
# Récupération des fichiers dans le dossier actuel
def file_selector(folder_path="./File"):
filenames = os.lis... | true |
93c361082ae9f7a1b3c1a99013e805c5bd445d45 | Python | sralli/APS-2020 | /heapq.py | UTF-8 | 897 | 2.984375 | 3 | [] | no_license | # def heap(h):
# n=len(h)
# i = (n//2)-1
# while i!=1:
# k = i
# v = h[i]
# heap1=False
# while heap1!=True and 2*k<=n:
# j = 2*k
# if j<n:
# if h[j]<h[j+1]:
# j= j+1
# if v>=h[j]:
# ... | true |
edd1de290e19d8868f085d80cbdaf28ebabcaf6e | Python | pankajps/devops-essentials | /languages/python/task_051_jira/jira.py | UTF-8 | 4,404 | 2.703125 | 3 | [] | no_license | import logging
from jira.client import JIRA
from jira import JIRAError
"""
########################################################################################################################################################
# CONSTANT_JIRA_TOKEN : JIRA token required for authentication with the JIRA server
#######... | true |
9035d8c5043a5338b35f438701303252273d26d9 | Python | rkanderson/Perception | /LevelReading/leveltxtconverter.py | UTF-8 | 942 | 3.0625 | 3 | [] | no_license | from PIL import Image
lvl = raw_input("Enter lvl id: ")
im = Image.open(lvl) #Can be many different formats.
pix = im.load()
print ("Image size="+str(im.size))
width=im.size[0]
height=im.size[1]
OUTPUT_STRING = "" #The level in the form of text!
#constants for converting pixel values to text
SPACE = (0,0,0) #Empt... | true |
3fc6e4c525b866f327f3845f7a9b9552860d6cec | Python | zouzou6900/mathematique | /exercice/EXO en Python/EXO2.py | UTF-8 | 4,017 | 3.703125 | 4 | [] | no_license | #varible
numberBloc = 8
#tableau de 26 caractere + 0
liste_lettre = ["A","B","C","D","E","F","G","H","I","J","k","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0"]
#fonction verifie que ce soit un entier positif pour deternimer le pas de deplacement dans le tableau
def pas():
while True:
try:... | true |
bd144f335f07ae93ed2400cd60977d736a26892b | Python | indigoYoshimaru/COSIM | /input_handler.py | UTF-8 | 482 | 2.71875 | 3 | [] | no_license | def handle_input(file_path):
import re
code = open(file_path).read().split("\n")
code = [exp[: (len(exp)) if exp.find(";") == -1 else exp.index(";")]
for exp in code]
code = [exp.strip() for exp in code]
code = [exp for exp in code if exp != ""]
code = " ".join(code)
code = re.su... | true |
c0230833a80335e953b8273e42ea80d15a4890cb | Python | cppopovich/CS460-Project | /beginner_tutorials/scripts/simplemovePioneer.py | UTF-8 | 5,006 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# license removed for brevity
import tf
import rospy
import math
import time
from geometry_msgs.msg import Twist
from geometry_msgs.msg import TwistWithCovariance
from nav_msgs.msg import Odometry
class simpleTest:
def __init__(self, t, end, speed):
#t is the type
self.t = t
... | true |
8ff01aba366441453171a5bbf38cb9bf8daf5e51 | Python | SyedShahSafiullaAlvi/Roll-the-Dice | /Dice Roll.py | UTF-8 | 2,090 | 4.1875 | 4 | [] | no_license | print('''
_______
/\ o o o\
/o \ o o o\_______
< >------> o /|
\ o/ o /_____/o|
\/______/ |oo|
| o |o/
|_______|/
''')
def roll(): # writing a function for dice rolling
while 1:
import random # importing random module to randomise the ... | true |
eb3c12529aa9d0cb436fef14deea90bb46f7fc81 | Python | moneymashi/python | /a07_numpy/a01_begin.py | UTF-8 | 839 | 2.875 | 3 | [] | no_license | '''
Created on 2017. 7. 25.
@author: acorn
'''
# numpy 는 install 해줘야한다.
# 방식은
# http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
# numpy‑1.13.1+mkl‑cp36‑cp36m‑win32.whl 다운
# c:\python\lib 로 copy
#
# python -m pip install [whl 파일의 경로]
# python -m pip install c:\python\lib\numpy-1.13.1+mkl-cp36-cp36m-wi... | true |
9c968c1b984370fd19b27409955ab517d4ea9beb | Python | CenterForOpenScience/SHARE | /share/metadata_formats/base.py | UTF-8 | 909 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | from abc import ABC, abstractmethod
from typing import Optional
from share.models.core import NormalizedData
from share.models.ingest import SourceUniqueIdentifier
class MetadataFormatter(ABC):
@abstractmethod
def format(self, normalized_data: NormalizedData) -> Optional[str]:
"""return a string repr... | true |
1d5b54d1b8acf5a18e52ca7420d580a2aa0643f4 | Python | alibtasdemir/BBM405_HW1 | /usaflights/ucs.py | UTF-8 | 3,947 | 2.734375 | 3 | [] | no_license | # Copyright 2019 Atikur Rahman Chitholian
#
# 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 a... | true |
f6fd222067af62aa58fa1f5db6fd58a540054d67 | Python | tehlinger/soccer_predictor | /db_builder.py | UTF-8 | 987 | 2.609375 | 3 | [] | no_license | import pandas as pd
import features_calculator as fc
from load_data import get_league
def get_team_data_per_match(year):
df = get_league(year)[-55:]
db = format_data_for_team_avg_evolution(year)
def format_data_for_team_avg_evolution(year):
df = get_league(year)
result = None
for team in df.HomeT... | true |
0ddb86f8b556d8f158de2422ff79a27ad5c600f4 | Python | osmiOTALORAGUERRERO/algorithm-design | /programs/exercise_voraz/knapsack_problem.py | UTF-8 | 433 | 3.140625 | 3 | [] | no_license | def knapSack(W, wt, val, n):
K = [[0 for x in range(W+1)] for x in range(n)]
# Build table K[][] in bottom up manner
for i in range(1,n):
for w in range(1, W+1):
wi = wt[i]
vi = val[i]
if wi <= w:
K[i][w] = max([K[i - 1][w - wi] + vi, K[i - 1][w]])... | true |
27e8af69cd121cfbddaaf070c4944bf7f530b4a6 | Python | JoneNash/improve_code | /JianZhi/30.py | UTF-8 | 861 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: leidelong
@contact: leidl8907@gmail.com
@time: 2019/2/14 14:54
"""
class Solution:
def FindGreatestSumOfSubArray(self, array):
# write code here
if(len(array)==0):
return None
matrix=[]
maxNum =max(array)
for... | true |
40662cb97bd744fd660e3c511ae18eae9acbb8be | Python | tstoof/Stralend | /statistics.py | UTF-8 | 17,685 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | # course name: Project Computational Science, University of Amsterdam
# author: Tamara Stoof
# group: Stralend
# date: 26-01-2021
# this file contains the statistic tests used
# to test if the different mitigation techniques
# had significantly different efficiencies
import json
import matplotlib.pyplot a... | true |
42d4afddaca1ceec7b4542b731a45ece99b3ebde | Python | aheldmyer/wrf_hydro_py | /wrfhydropy/core/ioutils.py | UTF-8 | 15,303 | 2.640625 | 3 | [] | no_license | import datetime
import io
import os
import pathlib
import re
import shlex
import shutil
import subprocess
import warnings
from typing import Union
import numpy as np
import pandas as pd
import xarray as xr
from boltons import iterutils
def open_nwmdataset(paths: list,
chunks: dict=None,
... | true |
9782c23d35bb119e71be6ea54a9b962a85ae6a10 | Python | y-y-huang/learn | /test.py | UTF-8 | 519 | 3.46875 | 3 | [] | no_license | class student():
def __init__(self,name,age,gender):
self.name = name
self.age = age
self.gender = gender
def show(self):
print("Name:",self.name,"Age:",self.age,"Gender:",self.gender)
a = student("Li",18,"boy")
a.show()
import re
res = re.match('......', 'li123kunhong123')
p... | true |
d90724103f30ae5f6e9aa3bd571edafc40c37347 | Python | nveenverma1/Dataquest | /Practice/15_Statistics_Intermediate/Z-scores-309.py | UTF-8 | 4,125 | 3.3125 | 3 | [] | no_license | ## 1. Individual Values ##
import pandas as pd
houses = pd.read_table('AmesHousing_1.txt')
import numpy as np
std = np.std(houses['SalePrice'], ddof=0)
mean = houses['SalePrice'].mean()
# Plotting KDE for SalePrice Column
limits = (houses['SalePrice'].min(), houses['SalePrice'].max())
houses['SalePrice'].plot.kde(... | true |
b0b1b432ff5d2e39e80cacd9e5ab74f91f75b75d | Python | oormaman/JoBot | /server/webScrapingController.py | UTF-8 | 2,445 | 2.65625 | 3 | [] | no_license | import os
from re import search
import requests
from server import jobsDBLogic
from server.jobsDBLogic import get_all_job_links_in_db, delete_job_from_db
jobWebFileNameList=["jobWeb/orgadi.py","jobWeb/one1.py","jobWeb/nisha.py","jobWeb/drushim.py","jobWeb/intel.py"]
def run_web_scraping():
for fileName... | true |
6614a79fd21160b5daa27bf83c5fc42b2bce3a0a | Python | juansalvatore/algoritmos-1 | /ejercicios/6-cadenas-de-caracteres/6.8.py | UTF-8 | 433 | 4.25 | 4 | [] | no_license | # Ejercicio 6.8. Escribir una función que reciba una cadena de unos y ceros (es decir, un número
# en representación binaria) y devuelva el valor decimal correspondiente
def binary_to_decimal(str):
binary = list(str)
count = 0
result = 0
for i in range(len(binary) - 1, -1, -1):
if binary[i] ==... | true |
396ee8c701b50042348fd7a62e4354ee0f3e60d4 | Python | Dom88Finch/recipe-scraper | /data/webscraper-pinchofyum.py | UTF-8 | 4,109 | 3.09375 | 3 | [
"MIT"
] | permissive | from bs4 import BeautifulSoup # library to parse opened html
import requests # library to open urls
import json
headers = {'User-Agent': "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15"}
# master list of all links
recipeLinkList = []
# init maste... | true |
5de3b0f1c5fa2da6b49c179352e6b36efd18fc70 | Python | facebook/pyre-check | /stubs/typeshed/typeshed/stubs/console-menu/consolemenu/validators/regex.pyi | UTF-8 | 262 | 2.5625 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | from consolemenu.validators.base import BaseValidator as BaseValidator
class RegexValidator(BaseValidator):
def __init__(self, pattern: str) -> None: ...
@property
def pattern(self) -> str: ...
def validate(self, input_string: str) -> bool: ...
| true |
28d70e4489a972641fc14dec8966928bec26ab39 | Python | riddletd/version-automation | /version.py | UTF-8 | 4,953 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
###
# To run this program, you need python 3.6.5 or higher.
###
import os
import re
import subprocess
major = 0 # release
minor = 0 # feature
patch = 0 # hotfix
uniqueVersionTag = "UNIQUE_VERSION_IDENTIFIER"
def getStdoutFromBashCommand(command):
return subprocess.check_output(command... | true |
b66b42ec0cdae90643a585c1e2bc1ef34adac3b4 | Python | HHJhhj98/hhjtest | /hhjtest/emailUtil.py | UTF-8 | 1,902 | 2.71875 | 3 | [] | no_license | # coding:utf-8
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
class emailUtil():
'''兼容163和QQ邮箱发送邮件的封装类'''
def send_mail(self,smtpserver,port,sender,psw,receiver,file_path,subject,filename):
'''兼容163和QQ邮箱发送邮件的方法
:param smtpserver: 发件服务器
... | true |
92131627a03708987c325d3633bfa2a88931e6d6 | Python | Abceus/PyTiled | /examples/Pacman/init.py | UTF-8 | 5,136 | 2.84375 | 3 | [] | no_license | import pygame
import xml.etree
import os
import PyTiled
class Ghost(PyTiled.MapObject):
def __init__(self, *args, **kwargs):
super(Ghost, self).__init__(*args, **kwargs)
class Blinky(Ghost):
def __init__(self, *args, **kwargs):
super(Blinky, self).__init__(*args, **kwargs)
class Pinky(Ghos... | true |
b85f620551db413e55e7dee2c707f76b82717031 | Python | poljkee2010/python_basics | /week_3/3.6 percents.py | UTF-8 | 171 | 3.375 | 3 | [] | no_license | percent, rub, cop = (int(input()) for _ in range(3))
total_cop = cop + rub * 100
total_cop += total_cop * percent / 100
print(int(total_cop // 100), int(total_cop % 100))
| true |
e4dcfa5b894ba24eec967582da78d6f9dd88afa5 | Python | stewartyoung/leetCodePy-easy-21-40 | /Algorithms/MajorityElement.py | UTF-8 | 197 | 3.140625 | 3 | [] | no_license | egnums = [1,2,2,2,2,3,4]
class Solution:
def MajorityElement(self, num):
# float division
return sorted(num)[len(num)//2]
test = Solution()
print(test.MajorityElement(egnums)) | true |
63952a46bbc77be7ba5c0db7d5cd501c13a6de5c | Python | jghibiki/Byte-le-Royale-2018 | /game/common/trap_types.py | UTF-8 | 3,432 | 2.6875 | 3 | [] | no_license | import random
from game.common.trap import Trap
from game.common.enums import *
def get_trap(trap_type):
if trap_type == TrapType.spike_trap:
return SpikeTrap()
elif trap_type == TrapType.pendulum_bridge:
return PendulumBridge()
elif trap_type == TrapType.falling_ceiling:
return ... | true |
f247cea84dc5fc48742bd7fa912946a495af588b | Python | moevm/bsc_nguyen_quang_hui | /keyword_assessment/russian_version/compute_pke.py | UTF-8 | 5,127 | 2.765625 | 3 | [] | no_license | import os
import sys
import csv
import math
import glob
import pickle
import gzip
import json
import bisect
import codecs
import logging
from itertools import combinations, product
from collections import defaultdict
from pke.base import LoadFile, get_stopwords, get_stemmer_func
from sklearn.feature_extraction.text ... | true |
5204b9ddf810e9f996ed38b451729b31792dfb2c | Python | requestum-team/python-microservice | /src/core/utils/async_tools.py | UTF-8 | 2,285 | 2.875 | 3 | [] | no_license | import asyncio
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
process_pool_executor = ProcessPoolExecutor()
thread_pool_executor = ThreadPoolExecutor()
def thread_pool(f):
async def wrapper(*args):
loop = asyncio.get_running_loop()
return await loop.run_in_executor(thread... | true |
44da3c3105ead9012a5566d2cd662ea13991dd73 | Python | uk-gov-mirror/ministryofjustice.content-inspection-proxy | /cip/handlers/request.py | UTF-8 | 4,221 | 2.765625 | 3 | [] | no_license | """
Handler to recreate request on target host. Terminates the pipeline.
example_config:
verify: True (default; can be also a path to CA_BUNDLE; overwritten by ENV variable CURL_CA_BUNDLE)
url: i.e. http://google.com/ (overwritten by ENV variable CIP_REQ_URL)
cert: None (default; specific cert or a list; s... | true |
620bd897f60adab1180eef67bf8da62f51d70f2e | Python | mridulrb/Basic-Python-Examples-for-Beginners | /Programs/Python/Mreplace.py | UTF-8 | 499 | 2.609375 | 3 | [] | no_license | n="Jingle bells jingle bells jingle all the way"
w="bells"
v="stars"
for i in range (0,len(n)):
if(n[i].isspace()==True):
if(n[i:i+len(w)+1]==w):
if(len(w)==len(v)):
n[i:i+len(w)+1]=v
else:
m=n+(("")*(max(len(v),len(w))-min(len... | true |
d2ff52dc74b38efade0bdd72f7bf235f39ad20e6 | Python | Abhishek2379/Heart-Disease-Predictor | /LoR.py | UTF-8 | 1,297 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 5 17:37:15 2019
@author: sd873
"""
#%%
import pandas as pd
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.metrics import confusion_matrix
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train... | true |
067ab43efc8122603ccd1daee4547db58ddf5ee0 | Python | hoslack/ninjas-lm | /progress.py | UTF-8 | 354 | 2.90625 | 3 | [] | no_license | def progress():
my_file = open("data.txt", "r+")
payload = {}
for line in my_file:
task = line.split(':')
if task[3] == 'True\n':
status = task[3][:4]
payload[task[1]] = status
elif task[3] == 'False\n':
status = task[3][:5]
payload[tas... | true |
a0dbea58527913608d2408dba81d194a6b9a4c68 | Python | dstilesr/neural-nets-dsr | /neural_nets_dsr/cost_functions/multiclass_logistic_loss.py | UTF-8 | 602 | 2.703125 | 3 | [] | no_license | import numpy as np
from .base import CostFunction
def mc_logloss(y_true: np.ndarray, y_pred: np.ndarray) -> float:
"""
Logistic loss for multiclass classifiers.
:param y_true:
:param y_pred:
:return:
"""
return - np.mean(np.sum(np.log(y_pred) * y_true, axis=0)).squeeze()
def mc_logloss_g... | true |
ecff48262158b67125e34c9cd6bb9ae1a77098ec | Python | SrGeTercero/DeteccionDeRostros | /ingresopersonas2.py | UTF-8 | 2,281 | 2.546875 | 3 | [] | no_license | import sys
import cv2
import sqlite3
import numpy as np
face_cascade = cv2.CascadeClassifier('archivos/haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
ID=0
decision=True
def insertorupdate(ID,nombrepersona,carnet):
conn=sqlite3.connect("Fasebase.db")
cmd="SELECT * FROM personas WHE... | true |
6797f98e53400f95c4438ea59d3d0fd73cf893f5 | Python | ragjapk/data_mining_assign | /assign8_SupportVectorMachines/SVM_Opti_Package/svm3.py | UTF-8 | 2,767 | 2.8125 | 3 | [] | no_license | import numpy as np
import csv
import cvxopt
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
from sklearn.model_selection import StratifiedKFold
from sklearn.model_selection import train_test_split
def create_kernel_matrix(kernel_val,... | true |
63ebbc157496dc53aee8d1898a7fd9792dede7c0 | Python | lcgong/domainics | /domainics/domobj/reshape.py | UTF-8 | 12,302 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
from collections import OrderedDict
from collections.abc import Iterable, Mapping
from decimal import Decimal
from itertools import chain as iter_chain
import sys
from ..util import NamedDict
from .typing import DAttribute
class ReshapeDescriptor:
def __get__(self, instance, owner):
... | true |
c52205548ab982bf7baebecd2ebb8660f881b672 | Python | jaidevd/pytftb | /doc/_gallery/plot_2_4_group_delay.py | UTF-8 | 771 | 2.84375 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
=================================
Group Delay Estimation of a Chirp
=================================
Constuct a chirp and estimates its `group delay
<https:/... | true |
cdd02d2854182904d3efceb54fa748e1579e83ac | Python | paul-khouri/fruitbowl | /Notes_Planning/py_files/formatting.py | UTF-8 | 230 | 3.34375 | 3 | [] | no_license | name = "Harold"
age = 16
school = "Rongotai"
assets = 14
output ='''My name is {:^10} and I am {:<6} years old
and my school is {:>13},
I have ${:.2f} in my account
'''.format(name, age, school, assets)
print(output)
| true |
0b3d70e4bb51736a38068e598f9e71193bf2e937 | Python | simrangrover5/Batch2pm | /sqliteconnect.py | UTF-8 | 602 | 3.40625 | 3 | [] | no_license | import sqlite3 as sql
db = sql.connect("student.db")
cursor = db.cursor()
#cmd = "create table student(id int(5),name varchar(100),course varchar(100))"
#cursor.execute(cmd)
while True:
id1 = int(input("Enter your id : "))
name = input("Enter your name : ")
course = input("Enter your course : ")
... | true |
bdfcac40a4bb59523b63f548148dd8cf9678b5ef | Python | anand5232/Python | /program to count word and character.py | UTF-8 | 329 | 3.4375 | 3 | [] | no_license | f=open("test.txt","w")
f.write("hello how are you ")
f.close()
f=open("test.txt","r")
data=f.read()
count=0
for i in data:
if(i==" "):
count=count+1
j=len(data)
character=j-count
print(" number of character are ",character)
print(" number of word are ",count)
f.... | true |
cbdbdc0deece9d70768b1b8f8ea9b80d0fd658ab | Python | tarekFerdous/Python_Crash_Course | /003.List/0.3.10.ex.py | UTF-8 | 547 | 4.0625 | 4 | [] | no_license | cities = ['Dhaka', 'Rajshahi', 'Barisal', 'Chattogram', 'Sylhet']
#append
cities.append('Khulna')
#insert
cities.insert(3, 'Rangpur')
#del
del cities[3]
#pop
cities.pop()
cities.pop(4)
#remove
cities.remove('Chattogram')
#sorted()
print('Sorted() ascending: ' + str(sorted(cities)))
print('Sorted() descending: ' + str(s... | true |
90000ef0494d6de2274ee0f05afe7e76db64f711 | Python | roysaurabh1308/Cryptographic-Algorithms | /RSA.py | UTF-8 | 1,079 | 3.234375 | 3 | [
"BSD-2-Clause"
] | permissive | import math
import random
def modInverse(a, m) :
m0 = m
y = 0
x = 1
if (m == 1) :
return 0
while (a > 1) :
q = a // m
t = m
m = a % m
a = t
t = y
y = x - q * y
x = t
if (x < 0) :
x = x + m0
... | true |
d820b72de746de02c762e5757345cb59fdf1ea44 | Python | PyCoderGeorge/Python-Note | /StudyPython/Day1/sys_mod.py | UTF-8 | 714 | 3.25 | 3 | [] | no_license | # Author: Junting
import sys, os
# sys.path 环境变量路径列表
# print(sys.path)
# sys.argv 获取执行脚本传递的参数,打印的是一个List列表,argv[0]一般是执行脚本的文件名
# print(sys.argv)
# os.system("dir") 用来运行shell命令,执行后结果不保存,返回的是命令的执行状态码 0 成功 非0失败
# cmd_res = os.system("dir")
# print('---->', cmd_res)
# os.popen("dir") 打开cmd命令的管道,执行的结果保存到一个... | true |
5f9d49dd1035632e6ab002cafbaa3410e692dbae | Python | Blondwolf/Animaker | /models/element.py | UTF-8 | 456 | 2.9375 | 3 | [] | no_license | from abc import ABCMeta, abstractmethod
class Element(object):
___metaclass__ = ABCMeta
@abstractmethod
def center(self):
pass
@abstractmethod
def draw(self):
pass
@abstractmethod
def add_move(self, x, y):
pass
@abstractmethod
def translate(self, x, y... | true |
773f8b9dce982b9249d251050ac2401104779d8f | Python | gmarciani/pymple | /dstruct/linkedlist.py | UTF-8 | 11,316 | 3.546875 | 4 | [
"MIT"
] | permissive | #Interface Import
from model.base.baselinkedlist import baselinkedlist
class SimpleLinkedList(baselinkedlist):
class Record:
def __init__(self, element):
self.element = element
self._next = None
def __repr__(self):
return str(sel... | true |
974c8d95b6dc48a0668e242d3a963529264858d3 | Python | LiuQuanXin/Crack_JS | /meituan_food_token.py | UTF-8 | 1,767 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# time: 18/7/31
'''美团美食token获取
思路:根据get请求的params生成一个列表(待完成),根据列表来生成token,token生成2次,逐渐完整'''
url = 'http://gz.meituan.com/meishi/'
'''print("十进制数为:", dec)
print("转换为二进制为:", bin(dec))
print("转换为八进制为:", oct(dec))
print("转换为十六进制为:", hex(dec))
'''
def get_token():
'''
与... | true |
15ab07da0ef91fc91869266a582fd1016c24d373 | Python | metamoles/metamoles | /deprecated/notebooks/test_pubchem_client.py | UTF-8 | 1,261 | 2.59375 | 3 | [
"MIT"
] | permissive |
import pandas as pd
from pandas.util.testing import assert_frame_equal
import pubchem_client
def test_cid_df_to_smiles():
"""Unit test for pubchem_client.py kegg_df_to_smiles."""
test_frame = pd.DataFrame([['EC-1.1.1.321', 'CPD-685', 1, 5363397],
['EC-1.1.1.111', '1-INDANOL', 1, 22819],
['EC-1.21.99.M2'... | true |
ca7c4d96dcbd2537876c98e895131fc617e12b22 | Python | caiqinxiong/python | /day19/bookmanager/ORM_TEST/3.外键的操作.py | UTF-8 | 1,329 | 2.734375 | 3 | [] | no_license | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bookmanager.settings")
import django
django.setup()
from app01 import models
# 基于对象的查询
# 正向查询 多_> 一
book_obj = models.Book.objects.get(pk=1)
# print(book_obj)
# print(book_obj.pub)
# 反向查询 一 _> 多
# 没有指定related_name
# 表名_set 关系管理对象
# 表名_set.all() 关系所有的对... | true |
58f3f0a02f206db15cbdfe75f0a9cc39db5d1884 | Python | maniraja1/Python | /proj1/Python-Test1/Concept/Concept_UserDict_UserList.py | UTF-8 | 302 | 2.8125 | 3 | [] | no_license |
from collections import UserDict
files = UserDict()
b=[1,2]
files.b = b
print(files.b)
print(b)
b.append(3)
print(files.b)
print(b)
files.b.append(5)
print(files.b)
print(b)
files.setdefault('a',b)
print(files.data)
files.setdefault('a',1)
print(files.data)
files.setdefault('b',1)
print(files.data) | true |
6520f717629f2705a00879545bf11516c654bafc | Python | pbarton666/PES_Python_examples_and_solutions | /solution_python1_chapter08_functions.py | UTF-8 | 2,817 | 3.75 | 4 | [] | no_license | #solution_python1_chapter08_functions.py
"""Demonstrates how to 'pass the buck' while handling exceptions. """
import pickle
import time
import os
import math
"""
Please create three functions in the same module (file). Each will take two
inputs. One file will add the numbers, another will multiply and the thir... | true |
240816803e1fe0ae345ab2a90f948e34cf4bb50c | Python | shmurygin-roman/geekbrains_lessons | /course_client_server/Практическое задание/decor.py | UTF-8 | 839 | 2.546875 | 3 | [] | no_license | """Декораторы"""
import sys
import logging
import traceback
import inspect
from config import config_client_log, config_server_log
if sys.argv[0].find('client.py') == -1:
LOGGER = logging.getLogger('server')
else:
LOGGER = logging.getLogger('client')
def log(func):
def wrapper(*args, **... | true |
8416c2807f8d83d2b158735f44a5ce6119d5dc00 | Python | ozfortress/tf2-livelogs | /daemon/livelib/sapi_data.py | UTF-8 | 4,978 | 2.609375 | 3 | [
"MIT"
] | permissive | import logging
import urllib2
import json
import keyvalues
class Steam_API(object):
def __init__(self):
self.__api_key = "SET_A_KEY_HERE"
self.__item_data_url = None
self._items_game_data = None
# get the location of the TF2 items_game file in the API using
# the GetSchema API c... | true |
a5f616ce2d7d287fb22678950b8447bc4bc76649 | Python | Otavioarp/BCC-701 | /Caderno de Exercicios/5-13.py | UTF-8 | 641 | 3.5 | 4 | [] | no_license | '''
Otávio Augusto de Rezende Pinto
Email: otaviopqsi@gmail.com
'''
def avaliapresentacao()
n = int(input('Saltos Ornamentais:\nInforme o número de competidores: '))
for i in range(0 , n ):
nj = int(input('Informe o número de juízes: '))
nome = str(input('Nome do competidor: '))
g = float(input('Grau de d... | true |
62fcb3a9936072becb049bee1d0ca2dbea14a390 | Python | aristc/French-Assembly-Webscraping | /webscraping-french-deputes.py | UTF-8 | 4,832 | 3.390625 | 3 | [] | no_license | import urllib2
import pandas as pd
from bs4 import BeautifulSoup
## STEP 1 - EXTRACT LIST OF DEPUTES BY AGE RANGE (INCLUDING CIRCONSCRIPTION, REGION, ID)
url_age = "http://www2.assemblee-nationale.fr/deputes/liste/ages/(vue)/tableau"
page_age = urllib2.urlopen(url_age)
# The full list of depute names is displayed i... | true |
e0442359862d30af90e5e0d51f4daa976bd7e230 | Python | gsakthi1/PythonExercise | /CS_LabExcrcise/pd_data_wrangling.py | UTF-8 | 5,058 | 3.046875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pylab as plt
import numpy as np
#filename = "https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DA0101EN/auto.csv"
filename = "auto.csv"
headers = ["symboling","normalized-losses","make","fuel-type","aspiration", "num-of-doors","body-style",
... | true |
8386bdee48e008438d250d891a59e68432be0499 | Python | Gaket/Words_learning | /Word lists comparing.py | UTF-8 | 1,963 | 3.828125 | 4 | [] | no_license | __author__ = 'Virt'
# -*- coding: utf-8 -*-
import re
def compare_words_lists(word_list1='Dictionaries/lingvaleo.txt', word_list2='Dictionaries/wordsteps.txt') -> int:
"""
This method compares two word lists, both must be text files,
and prints words that one list contains but another doesn't contain
... | true |
dbfb6978ebc536ca1df7c4af0ec8ab7504fe5918 | Python | hulaba/GeeksForGeeksPython | /Main.py | UTF-8 | 4,498 | 2.703125 | 3 | [] | no_license | class Main:
from Sorting.MergeSort import MergeSort
from Search.BinarySearch import BinarySearch
from Search.InterpolationSearch import InterpolationSearch
from Greedy.ActivitySelection import ActivitySelection
from Greedy.MinNumberOfPlatforms import MinNumberOfPlatforms
import datetime
from... | true |
f9983b76276abd49b8b1e222357c0f27746eb56c | Python | lomcaitlin/cst383_s21 | /labs/system-design-lab.py | UTF-8 | 2,680 | 2.90625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 7 16:10:24 2019
@author: Glenn
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import zscore
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import train_test_split
# read the data
df = pd.read... | true |
b3dae6c40093296ecfe68786400863b4df4d905e | Python | hotheat/LeetCode | /17. Letter Combinations of a Phone Number/bfs.py | UTF-8 | 802 | 3.546875 | 4 | [] | no_license | from typing import List
from collections import deque
class Solution:
def letterCombinations(self, digits: str) -> List[str]:
if len(digits) == 0:
return []
numberdict = {
'2': 'abc',
'3': 'def',
'4': 'ghi',
'5': 'jkl',
'6': '... | true |
aaf87ab7c18b5b0d82fb812a0c0f6eedaf999ffe | Python | PincukMykola/python_basics_03_21 | /hw6/phone_book.py | UTF-8 | 669 | 3.3125 | 3 | [] | no_license | """
Текстовый файл (phone_book.txt) содержит список из имен и номеров телефона.
Переписать в файл (edited_phone_book.txt) данные владельцев,
чьи имена начинаются на букву "m" либо заканчиваются на "а"
(регистр не имеет значения).
В файл записывать данные в таком формате:
1. +380501234561 - Имя
... | true |
9f2517b135790a656711810af8880dd5aad93fee | Python | Onestab/data-augmentation-coling2020 | /train.py | UTF-8 | 11,763 | 2.640625 | 3 | [
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"MIT"
] | permissive | """
Code for simple data augmentation methods for named entity recognition (Coling 2020).
Copyright (c) 2020 - for information on the respective copyright owner see the NOTICE file.
SPDX-License-Identifier: Apache-2.0
The code in this file is partly based on the FLAIR library,
(https://github.com/flairNLP/flair), lic... | true |
12de223c7d3e65e2898795aeba522ba523ea9ede | Python | tre58/Tre-Robinson | /moviepython.py | UTF-8 | 281 | 2.796875 | 3 | [] | no_license | # Trevonne M. Robinson 3/1/2018
media_type = input("What is the media type")
title = input ("What is the title")
descrip = input (" give me a brief desription")
year = (str( input(" What year did the movie come out")
rating = (float(input (" What type of rating do you give this movie 1/10")
| true |
9862123df89d46ab36a01ae6a2b29f985b47e4e1 | Python | petro-ew/test1 | /solutions/pyqt3.py | UTF-8 | 1,724 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'petro-ew'
import sys
#from os import path, curdir
from PyQt4 import QtGui, QtCore, uic
Form, Base = uic.loadUiType("pyqt3.ui")
class MyWindow(QtGui.QMainWindow, Form):
def __init__(self, parent=None):
"""
:type self: objec... | true |
48c29a4dede9c1bacc41ce987b91cc4117a04d10 | Python | bsc-wdc/dislib | /dislib/trees/data.py | UTF-8 | 14,937 | 2.625 | 3 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | import tempfile
import numpy as np
from numpy.lib import format
from pycompss.api.constraint import constraint
from pycompss.api.parameter import (
FILE_IN,
FILE_INOUT,
COLLECTION_IN,
Depth,
Type,
)
from pycompss.api.task import task
from dislib.data.array import Array
class RfBaseDataset:
"""... | true |
e9e57082d074078ecc85570619e4cfc8d950990e | Python | akshagu/Golf_cart | /pololu_ros/scripts/pololu_driver.py | UTF-8 | 12,507 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
from __future__ import division
import serial
import struct
import time
"""Pololu driver module for motor controllers using pyserial
This module handles the lower level logic of writing to a pololu motor
controller using python.
Serial reference: https://www.pololu.com/docs/0J44/6.2.1
Get Variable... | true |
ecf3adb0c9403027691b9a64650f7d70d9e95643 | Python | abhishek-ranjan-au13/python_project_abhishek_au9 | /chessengine.py | UTF-8 | 9,945 | 3.640625 | 4 | [] | no_license | """
This class is resposible for storing all the info about the current state of a chess chess.. It will also be responsible
for determining the valid moves at the current state..It will also keep a move log...
"""
class GameState():
def __init__(self):
#board is an 8x8 2-D list, each element of the line ha... | true |
049b436ff901a2aebc22256834e0f91f02c61717 | Python | AI-Pydev/cmpexcel | /cmp_excel2.py | UTF-8 | 2,178 | 3.265625 | 3 | [] | no_license | import xlrd
import os
import sys
def excel_file(arg):
if os.path.exists(arg):
wb = xlrd.open_workbook(arg)
sheet = wb.sheet_by_index(0)
rows = sheet.nrows
cols = sheet.ncols
excel_content = []
for row in range(rows):
for col in range(cols):
... | true |
a49bfa8383a6376260c95074ec86a632e01e8662 | Python | ketralnis/tinystocks | /tinystocks.py | UTF-8 | 5,527 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
import os.path
import json
import sys
import urllib2
from collections import namedtuple
from termcolor import colored
import locale
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
def get_stock_quote(ticker_symbol):
# shamelessly stolen from http://coreygoldberg.blogspot.com/2011/09/python-s... | true |
819660fe4ef75c47962389d7bc011dbfff2e0024 | Python | RicardoSousaPaiva/PPZ | /Pygame-flippy.py | UTF-8 | 41,778 | 3.734375 | 4 | [] | no_license | # Flippy (an "Othello" or "Reversi" clone)
# http://inventwithpython.com/blog
# By Al Sweigart al@inventwithpython.com
"""IMPORTANT NOTE: All of the "logic" part of this program (the code for the AI player and code that handles game play) is basically copied and pasted from the text-based Othello game that was fea... | true |
c6afa74133ef778c6ab9dbd28bc49481c1f29892 | Python | Kae7in/coursera-ml | /venv/machine-learning-ex3/ex3/display_data.py | UTF-8 | 2,031 | 3.640625 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
def display_data(X, tile_width=-1, padding=0):
"""
Display data in a nice grid
Parameters
----------
X : ndarray, shape (n_samples, sample_size)
A collection of sample data to be displayed, where n_samples is the number of samples and samp... | true |
4c0a3efdc7fc24a418c3e4add90ae181406547d1 | Python | nicoletaroman/Instructiunea-FOR | /for 4.py | UTF-8 | 140 | 2.984375 | 3 | [] | no_license | a=eval(input("dati un nr"))
b=eval(input("dati un nr"))
for nr in range(a,b+1): #inclusiv b
if nr%2!=0:
print(nr,end=" ,")
| true |
5ea5612425b26157f44e62da7adf33c83d3c787a | Python | wkwkgg/atcoder | /abc/problems110/104/c2.py | UTF-8 | 1,764 | 3.0625 | 3 | [] | no_license | from math import ceil
D, G = map(int, input().split())
Pd, Cd = [0] * D, [0] * D
for i in range(D):
Pd[i], Cd[i] = map(int, input().split())
ans = float("inf")
# 外側のループ Pd[i] を使うかどうかについてのループ
# e.g. D==2 の場合
# 0 -> 00 : 両方使わない
# 1 -> 01 : 0 番目を使う
# 2 -> 10 : 1 番目を使う
# 3 -> 11 : 両方使う
for i in range(1 << D... | true |
b6041ba69ad109e8f905377ba1de5dcaef544299 | Python | danielcorroto/projecteuler | /problem045.py | UTF-8 | 834 | 4 | 4 | [] | no_license | '''
Created on Mar 23, 2014
@author: Daniel Corroto
Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:
Triangle T_n=n(n+1)/2 1, 3, 6, 10, 15, ...
Pentagonal P_n=n(3n-1)/2 1, 5, 12, 22, 35, ...
Hexagonal H_n=n(2n-1) 1, 6, 15, 28, 4... | true |
3bd7ae5fda5a0362fbd63fdb036f73edc6a09a64 | Python | sjszues616/untitled | /asyncio_learn/test.py | UTF-8 | 187 | 2.625 | 3 | [] | no_license | import asyncio
async def count():
print('One')
await asyncio.sleep(1)
print('Two')
async def main():
await asyncio.gather(count(),count(),count())
asyncio.run(main()) | true |