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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ebaf1a3b8d691b0712f450da76b3726ccd345d9b | Python | Jelle12345/Python-3 | /oefeningen.py | UTF-8 | 2,238 | 3.640625 | 4 | [] | no_license | contacten = {}
def main():
menu()
keuze = input("Maak een keuze")
while keuze != 's':
if keuze == 'm':
nieuw_contact()
elif keuze == 't':
toon_contacten()
elif keuze == 'v':
verwijder_contact()
elif keuze == 'a':
contact_aanpas... | true |
995fe5f30b068e5d137f3765243bb975d3b237ad | Python | imucici/my-learning-note | /LeetCode/week3/389. Find the Difference.py | UTF-8 | 325 | 3.15625 | 3 | [] | no_license | class Solution:
def findTheDifference(self, s: str, t: str) -> str:
counts = [0 for _ in range(26)]
for c in s:
counts[ord(c) - ord("a")] += 1
for c in t:
index = ord(c) - ord("a")
counts[index] -= 1
if counts[index] < 0:
retu... | true |
3f0509def5a7d68227d33ba015bf515b0ef835fe | Python | vbirdchong/LearnPython | /algorithm/bead_sort.py | UTF-8 | 600 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python
# coding:utf-8
try:
from itertools import zip_longest
except:
try:
from itertools import izip_longest as zip_longest
except:
zip_longest = lambda *args: map(None, *args)
def beadsort(l):
print l
# cl = columns([[1] * e for e in l])
# print "cl"
# print cl
# print "columns"
#... | true |
46c93b1282fdf1752ff5018510408f2f5b1eafe9 | Python | pedro1hen1/treinamento | /lista_04/ex23.py | UTF-8 | 1,878 | 3.9375 | 4 | [] | no_license | # /bin/env python
# -*- encode: utf-8 -*-
__author__ = '@pedro1hen1'
# exercicio 23
"""Em uma competição de ginástica, cada atleta recebe votos de sete jurados.
A melhor e a pior nota são eliminadas. A sua nota fica sendo a média dos votos
restantes. Você deve fazer um programa que receba o nome do ginasta e as notas d... | true |
b04f9c82e133b0bf91c87258f06b5e6da4391154 | Python | Alexflames/water | /tppython/t21Grigoriev.py | UTF-8 | 4,482 | 3.5 | 4 | [] | no_license | # Классы: печатное издание, журнал, книга, учебник
class Paper:
def __init__(self, publisher, year, title):
self.publisher = publisher
self.year = year
self.title = title
class Magazine(Paper):
def __init__(self, publisher, year, title, number, month):
super().__init__(publishe... | true |
9d89a3e2538364646699ef4290ba12fa4e8c8dbe | Python | EhsanAghazadeh/pytorch-GAN-timeseries | /models/convolutional_models.py | UTF-8 | 5,584 | 2.96875 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
class Chomp1d(nn.Module):
def __init__(self, chomp_size):
super(Chomp1d, self).__init__()
self.chomp_size = chomp_size
def forward(self, x):
return x[:, :, :-self.chomp_size].contiguous()
class TemporalBlock(nn... | true |
a430fb678de1c63cecdc68c7ae4a49958d466297 | Python | miracode/data-structures | /insertion_sort.py | UTF-8 | 1,273 | 4.5625 | 5 | [
"MIT"
] | permissive |
def insertion_sort(array):
"""
Sort an input array with insertion sort algorithm
The insertion sort algorithm compares an element with the preceeding
ordered element to determine whether the two should be swapped. This will
continue until the preceeding element is no longer greater than the
c... | true |
401d07729a699f58064b9ae121c9231df3b66b38 | Python | arkavo/Maxwell-ecosystem | /tests/charge_core.py | UTF-8 | 2,361 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import numba
from numba import cuda
from vectors import*
@cuda.jit
def add_field(r,q,space):
tx = cuda.threadIdx.x
ty = cuda.threadIdx.y
bw = cuda.blockDim.x
pos = int(tx + ty*bw)
dist2 = 0.0
for i in range(2):
dist2 += (r[i] - (tx*i+ty*(1-i)))**2
dist2 = dist2**... | true |
1b0e4495d095bf77067c6c9e49b866aeec39892d | Python | zolfaShefreie/carpet_factory | /factory_info_action.py | UTF-8 | 12,417 | 2.890625 | 3 | [] | no_license | import address_graph
import math
class info_func:
picture_matrix=[]
result_grath_coloring=[]
min_list_coloring=[]
address=address_graph.address_graph()
def __init__(self):
pass
def default_matrix_multiplication(self,a, b):
new_matrix = [[a[0][0] * b[0][0] + a[0][1] * b... | true |
444499766a3f4a77f919a1bf36eab79e0e649561 | Python | abhesrivas/code-mixed-embeddings | /CMEmbeddings/scraper/demo.py | UTF-8 | 1,788 | 3 | 3 | [] | no_license | from scraper import AdvancedSearchScraper
import sys
import string
import re
def is_ascii(s):
return all(ord(c) < 128 for c in s)
def scrape_tweets(word, count, start, end):
if(start==0 and end==0):
name = "scraped/"+word+".txt"
ass = AdvancedSearchScraper(word, count)
tweets = ass.scrape()
with open(n... | true |
6c9d65ffb0273803ba8cb449977c44a76346ff72 | Python | rdeyanski/BestBank | /Bank/Functions.py | UTF-8 | 52,206 | 2.921875 | 3 | [] | no_license | import pickle
import matplotlib.pyplot as plt
import numpy as np
from datetime import datetime
from Bank.Acc_Classes import DepositAccount, CreditAccount, MortgageAccount
from Bank.Transactions import Deposit, Withdraw
from Bank.Updates import UserUpdate, AccountUpdate, TransferUpdate
from Bank.User_Classes im... | true |
99e79eb6ecdf4c5570333b93c078e7307cdc56db | Python | nikhilchandrapoddar099/Spam_mail_Classifier | /main.py | UTF-8 | 2,099 | 2.703125 | 3 | [] | no_license |
#for mail Extraction online
import pandas as pd
import pickle
from flask import Flask, render_template, request
import re
import nltk
nltk.download("stopwords")
from nltk.corpus import stopwords
from nltk.stem.porter import PorterStemmer
app = Flask(__name__)
@app.route('/')
def student():
return ren... | true |
f33f191a4fc8de8928f9341414b4e97ae32a4ae4 | Python | kalimuthu123/CapAI | /tests/test_utils.py | UTF-8 | 1,467 | 2.921875 | 3 | [
"MIT"
] | permissive | import os
from ln2sql.parser import Parser
from ln2sql.stopwordFilter import StopwordFilter
BASE_PATH = os.path.dirname(os.path.dirname(__file__)) # Project directory.
STOPWORDS_PATH = os.path.join(BASE_PATH, 'ln2sql/stopwords/')
def test_parser_sort_length():
input_list = ['len2 len2', 'len1', 'len3 len3 len3... | true |
cadff361cc26943685cdbdbc25212156f725e1bc | Python | sugacom/AllOfTestFiles | /triangle.py | UTF-8 | 207 | 3.75 | 4 | [] | no_license | class Triangle:
def __init__(self, b, h):
self.base = b
self.height = h
def cal_area(self):
return self.base * self.height / 2
tri1 = Triangle(3, 5)
print(tri1.cal_area())
| true |
d735781cab4d4b347421b30e1cf6cd8a0bc124aa | Python | arjunlohan/Password-Hacker | /Password Hacker.py | UTF-8 | 2,950 | 2.65625 | 3 | [] | no_license | # write your code here
import sys
import socket
import itertools
import json
from datetime import datetime
def letters(word):
if len(word) == 1:
return [word.lower(), word.upper()]
return [f"{j}{i}" for j in letters(word[0]) for i in letters(word[1:])]
a_z = [chr(x) for x in range(ord('a'), ord('z') + ... | true |
3d81ff8f1c734699d8d97fdc2e9b8977b1b094aa | Python | daliagachc/sara-cluster | /sara_cluster/util.py | UTF-8 | 1,064 | 2.609375 | 3 | [] | no_license | # project name: sara-cluster
# created by diego aliaga daliaga_at_chacaltaya.edu.bo
from useful_scit.imps import *
def hist_better(ds,col,**dp_qwargs):
# col = NCONC01
ds1 = ds[[col]].to_dataframe()
ds2 = ds1.dropna()
q1,q2 = ds2.quantile([.02,.98]).values
lg = np.logspace(np.log10(q1),np.log10(... | true |
cdfb642c12c3a4777f79368bc0ffaa2b0328b853 | Python | mhfarahani/WikiRacer | /src/WikiRacer.py | UTF-8 | 5,322 | 3.234375 | 3 | [] | no_license | import sys
import wikipedia
import json
from collections import deque
#from flask import Flask
import networkx as nx
#import matplotlib.pyplot as plt
import time
from bs4 import BeautifulSoup
from urllib.request import urlopen
import re
def GetTitles(title,verbose=True):
"""
Given a title o... | true |
f111c4b56bfd7a144d625f0102520e71a9129a8f | Python | rjgcabrera/CS21A | /Empty.py | UTF-8 | 394 | 2.59375 | 3 | [] | no_license | # -----------------------------------------------------------------------------
# Name: empty
# Purpose: empty exception for stack ADT
#
# Author: Raymond Cabrera
#
# Created: 10/04/2013
# -----------------------------------------------------------------------------
class Empty(Exception):
"""
... | true |
31b18a29bfcf356dde3176575570e43a5aa8f83b | Python | cpatrizio88/A405 | /python/nchaparrday4/Day4.py | UTF-8 | 1,637 | 3.3125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import scipy.io
def probfv(C,a,v, T):
f_v = (C*v**2)*np.exp(1.0*(-a*v**2)/(2))
return f_v
def calc_testmean(v, fv):
testmean = 0
for i in range(len(v)):
testmean = testmean + v[i]*fv[i]
return testmean
#Constants and Factors
k_B = 1.... | true |
30aaa28cf42bbc43060988ce8c7ea24cf72c1bb5 | Python | anhnn2010/scrapy | /caring/caring/spiders/caring_1.py | UTF-8 | 4,769 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from ..items import CityItem, CountryItem, CompanyItem
class Caring1Spider(scrapy.Spider):
name = 'caring_1'
# allowed_domains = ['caring.com']
start_urls = ['https://www.caring.com/']
def parse(self, response):
list_state_hrefs = response.xpath("//*[@id=... | true |
1a2149840f48aa23b84f5d3d0ff4530585b1c403 | Python | cloew/WiiCanDoIt-Framework | /src/GameEventParser/GameEventLogger.py | UTF-8 | 384 | 2.515625 | 3 | [] | no_license | import time
import os
import pickle
class GameEventLogger:
# Filehandle
logfile = None
def __init__(self):
path = os.path.dirname(os.path.abspath(__file__)) + "/gameEventLog/" + str(time.time()) + ".txt"
self.logfile = open(path, "wb")
def log(self, funcParams):
pickle.dump(funcParams, self.logfile, pickl... | true |
4c9da353eea5fba461175962f51a2915b8b9e546 | Python | vkvasu25/leetcode | /amazon/count_pairs_in_sorted_array.py | UTF-8 | 1,022 | 4.28125 | 4 | [] | no_license | """
https://www.youtube.com/watch?v=bptRLm3OiV8
given an array of numbers in sorted order
count the pairs of numbers whose sum is less than X
for example: [2,4,6,8,9], the x=14
"""
class Solution:
# this one is simple but slow with complexity O(n2)
def count_pairs(self, array, x):
count = 0
for... | true |
8a4aec9df71de538ce74a8329c3f1484d2ea42f6 | Python | chenchals/interview_prep | /amazon/binary_tree_level_order_traversal.py | UTF-8 | 1,107 | 3.578125 | 4 | [] | no_license | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def levelOrder(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
if not roo... | true |
12ae3e230711c635a750592e4057e98059571076 | Python | jbloomfeld/cs591finalproject | /data/DataPrep.py | UTF-8 | 4,726 | 3.265625 | 3 | [] | no_license | import numpy as np
import networkx as nx
import collections as c
import matplotlib.pyplot as plt
### Load Datasets
# Read the Les Miserables co-occurrence graph.
graphLM = nx.read_gml('lesmis.gml')
matrixLM = nx.to_scipy_sparse_matrix(graphLM)
# Layout a graph using the spring force algorithm.
nx.draw_spring(graphLM... | true |
78765f2f64b6cb111c73e1143b3dd992c2908beb | Python | charles-lau520/python_study | /00_python_test/string.py | UTF-8 | 563 | 3.390625 | 3 | [] | no_license | #开发人员 :
#_+_coding: UTF-8_*_
#开发团队 : LC_Group
#开发人员 :
#开发时间 : 2020/8/24 16:21
#文件名称 : string.py
#开发工具 : PyCharm
a = "I LOVE PYTHON"
list = a.split()
print(list)
new_a = "-".join(list)
print(new_a)
b = "I LIKE {0} AND {1}".format("APPLE","ORANGE")
print(b)
# 占位符长度
# {0:10} 10个占位符
# {1:>15} 15个占位符并右对齐
b ... | true |
6814b32d50b3d5e83a7804600a9071a8c5af739f | Python | regisb/edx-lint | /test/plugins/pylint_test.py | UTF-8 | 4,313 | 2.90625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """Infrastructure for testing pylint plugins."""
import re
import textwrap
import warnings
from pylint.__pkginfo__ import numversion as pylint_numversion
from pylint.lint import Run
from pylint.reporters import CollectingReporter
def find_line_markers(source):
"""Find line markers in program source.
Return... | true |
477e8a2c82af26f45cf57eff3d43475371d0bfc0 | Python | ethanhinch/AdventofCode2020 | /Day 2/PWPhilosophy.py | UTF-8 | 991 | 3.8125 | 4 | [] | no_license | #Take inputs from file and store them
def getInputs():
inputs = []
f = open("day2.txt", "r")
for x in f: inputs.append(x)
return inputs
#Convert the input strings into usable form:
# Integer lower and upper bounds, the restricted letter and the password
def parse(string):
sections = string.split('... | true |
98784a5979116472595c5d32c9e5a6e836983028 | Python | breuerfelix/twitch-viewer-bot | /proxies/hideme.py | UTF-8 | 1,986 | 2.71875 | 3 | [
"MIT"
] | permissive | import csv
import time
import sys
if __name__ == "__main__":
from utils import test_proxy, validate_ip
else:
from .utils import test_proxy, validate_ip
# export list from https://hidemy.name/en/proxy-list as csv
FILENAME = "hideme_proxy_export.csv"
def start_hideme_thread(callback):
get_new = _init_prox... | true |
9bf874b452733c72a3b64749ac8ab382d36d2a38 | Python | FrankieZhen/Lookoop | /Image/OpenCV/Chapter5-笔记.py | UTF-8 | 2,007 | 2.703125 | 3 | [] | no_license | # 2018-9-6
# OpenCV3 计算机视觉 Python语言实现
# Github : https://github.com/techfort/pycv
# 英文教程: https://docs.opencv.org/3.2.0/d6/d00/tutorial_py_root.html
# 中文翻译: https://www.cnblogs.com/Undo-self-blog/p/8423851.html
# opencv中文教程: https://www.kancloud.cn/aollo/aolloopencv/272892
# 第五章笔记
import numpy as np
import matplotlib.p... | true |
e8921d1f41753ee07242366aea5a1db4ac5ac5b4 | Python | anagharumade/ML-Projects | /Machine-Learning-with-Python-R/Data Preprocessing/Feature_Scaling.py | UTF-8 | 1,166 | 3.109375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 14 17:06:08 2017
@author: absol
"""
import pandas as pd
#importing dataset
data = pd.read_csv('data.csv')
#Splitting dataset into Dependent and independent variables
X = data.iloc[:, :-1].values
Y = data.iloc[:, 3].values
#Dealing with missing values
from sklearn.prep... | true |
5187abacea26139fe8f93da4576ade47cdca9917 | Python | devesh-bhushan/python-assignments | /assignment-1/Q-8 class_marks.py | UTF-8 | 656 | 3.828125 | 4 | [] | no_license | """
program to calculate average marks and pecentage
"""
sub_1 = eval(input("enter the marks obtained in subject 1"))
sub_2 = eval(input("enter the marks obtained in subject 2"))
sub_3 = eval(input("enter the marks obtained in subject 3"))
sub_4 = eval(input("enter the marks obtained in subject 4"))
sub_5 = eval(input... | true |
6659c5be5ce014b9258020c4b7441e6c034f1b89 | Python | LauraSiobhan/beginning_python_jul2021 | /exercise_13_1.py | UTF-8 | 433 | 4 | 4 | [] | no_license | my_string = 'hello world'
# print out "hello"
print(my_string[:5])
# print out "world"
print(my_string[6:])
# print it backwards
print(my_string[::-1])
my_list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
my_slice = my_list[2:7]
print(my_slice)
new_list = my_list
new_list[3] = 'z'
print(my_list)
my_list = ['a'... | true |
55c39385ada91f723982c0e62433f23fe3dc0b1b | Python | Woodman5/ncc_calc | /src/stuff/count_sections.py | UTF-8 | 9,197 | 2.96875 | 3 | [
"MIT"
] | permissive | import pprint
import re
regex = r"[^\d-]+"
pp = pprint.PrettyPrinter(width=38, compact=True)
blength = int(input('Длина моста в мм: '))
gap_qty = int(input('Количество деформационных швов: '))
print('Укажите ширину деформационных швов слева направо через пробел.\nЕсли все одинаковые, укажите ширину 1 раз.')
while Tr... | true |
e0dc0f048626a027db37f22d610536fd6a720e7b | Python | jaspalsingh92/TestAutomation-1 | /framework/Shared/css_utils.py | UTF-8 | 7,611 | 2.9375 | 3 | [] | no_license | # css_utils.py
import re
import logging
from Utils.ssh_util import SshUtil
logger = logging.getLogger('framework')
test_logger = logging.getLogger('test')
###### CSS Utilities ######
def log_assert(test, error):
"""
If test is false, write error message to log and assert.
:param test: Some sort of t... | true |
97d0d2120b76fc91f4dc0124e7608ba070b85076 | Python | AdamC66/01---Reinforcing-Exercises-Programming-Fundamentals | /fundamentals.py | UTF-8 | 1,377 | 4.625 | 5 | [] | no_license | import random
# from random import randrange
# Exercise 1
# Create an emotions dict, where the keys are the names of different human emotions and the values are the degree to which the emotion is being felt on a scale from 1 to 3.
# Exercise 2
# Write a Person class with the following characteristics:
# name (string)... | true |
a053e676c5adf5e03eb158e30b088f0cf6b64cc6 | Python | roman-4erkasov/coursera-data-structures-algorithms | /prj01_algorithmic_toolbox/week03wrk02_max_loot.py | UTF-8 | 1,829 | 4.3125 | 4 | [] | no_license | # Uses python3
"""
Task. The goal of this code problem is to implement an algorithm for the fractional knapsack problem.
Input Format. The first line of the input contains the number 𝑛 of items and the capacity 𝑊 of a knapsack. The next 𝑛 lines define the values and weights of the items. The 𝑖-th line contains inte... | true |
b66f42fb3a613b8789654642e59884921f6d608e | Python | lsst-camera-dh/pybench-ccd-reb | /camera/generic/rebxml.py | UTF-8 | 14,449 | 2.609375 | 3 | [] | no_license | #! /usr/bin/env python
#
# LSST
# Python minimal interface for the REB FPGA
# XML IO
#
from lxml import etree
from fpga import *
class XMLParser(object):
def __init__(self):
self.channels_desc = {}
self.channels = {}
self.parameters_desc = {}
self.parameters = {}
self.fu... | true |
472b233732864fef2bf95a94e3369c46d6efa08e | Python | mahikajain3/dlime_experiments | /explainer_base.py | UTF-8 | 5,650 | 2.640625 | 3 | [
"MIT"
] | permissive | import numpy as np
from boruta import BorutaPy
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import Ridge, lars_path
from sklearn.utils import check_random_state
class LimeBase(object):
def __init__(self,
kernel_fn,
verbose=False,
r... | true |
69bb31017fada8da3a1dd17de5161895db175328 | Python | HxLyn3/Machine-Learning | /05 Neural Network/5.8/test.py | UTF-8 | 2,529 | 2.796875 | 3 | [] | no_license | """
- Author: Haoxin Lin
- E-mail: linhx36@outlook.com
- Date: 2020/11/25
- Brief: Test Self-Organizing Network with watermelon dataset 3.0alpha
"""
import xlrd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from SOM import SOM
# load data
data = xlrd.open_workbook('../WTM... | true |
d78041298d13b948c3c9ba8fb46bee854145b6fe | Python | bmasoumi/BioInfoMethods | /NaiveExactMatching.py | UTF-8 | 4,395 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 11 10:31:09 2018
@author: Beeta
Implementation of exact matching algorithms
- Naive Exact Matching(Brute Force)
"""
def readFASTA(filename):
genome = ''
with open(filename, 'r') as f:
for line in f:
if not line[0] == '>... | true |
0e341e8d134c21a6461e8bd2cd0592c6f105b6fd | Python | realqnn/GoogleML-learn | /validation.py | UTF-8 | 4,720 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
使用多个特征而非单个特征来进一步提高模型的有效性
调试模型输入数据中的问题
使用测试数据集检查模型是否过拟合验证数据
"""
import math
from IPython import display
from matplotlib import cm
from matplotlib import gridspec
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
from sklearn import metrics
import tens... | true |
9be339d0949286e23b23bf1de06326b61e645e95 | Python | javid-aliyev/Todo-list-application-Python | /app.py | UTF-8 | 4,067 | 2.625 | 3 | [] | no_license | import sys
import hashlib
import tools
import db_creator
from task import Task
from account import Account
class App:
def __init__(self, argv):
self._argv = argv
self.id2task = {}
self.account = "guest" # current account
self.main()
def _id2task(self, tasks):
"""Returns a dict where key is index, value i... | true |
2f55793e6d7b9b1850ef296c49ccfa7ac2affdbd | Python | stevewfogarty/todo-api-fastapi | /model/model.py | UTF-8 | 414 | 2.640625 | 3 | [
"MIT"
] | permissive | from pydantic import BaseModel
from datetime import datetime
from typing import NewType, Optional
# Declare a new type of variable ID
ID = NewType("id", int)
class Task(BaseModel):
"""
Definition of components of a task
"""
summary: str
priority: int
# due_date: Optional[datetime]
class T... | true |
9745361200c4745ac9af12e47df52f7a6f478e4b | Python | ingwplanchez/Python | /Program_35_Anidamiento3.py | UTF-8 | 469 | 2.640625 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: James Marshall
#
# Created: 21/04/2012
# Copyright: (c) James Marshall 2012
# Licence: <your licence>
#---------------------------------------------------------------------------... | true |
892617551092658a4e327acedb1ad1db220db69d | Python | harinisridhar1310/Guvi | /Count_digit.py | UTF-8 | 72 | 2.96875 | 3 | [] | no_license | #harini
a=int(input())
c=0
while(a>0):
b=a%10
c=c+1
a=a//10
print(c)
| true |
8e35a9deb46afc08933a81b2ea801fd73b18dbb6 | Python | code1077/Python_practice_AOFI_1718 | /obregon-avila-steven/ejercicio6.py | UTF-8 | 301 | 3.546875 | 4 | [] | no_license |
numero = 0
bucle = "Si"
while bucle == "Si":
numero = int(input("Introduce el numero que quieras:\n"))
if (numero % 2 == 0):
print("Este numero es par")
if (numero % 2 != 0):
print("Este numero es inpar")
bucle = input ("Quieres añadir mas datos a la tabla?: si/no ?\n")
if bucle != "Si": | true |
7a92868d87b1d77c277463e08315ea58fc3a2973 | Python | jrodriguezballester/inicioPython2 | /ejercicio3.py | UTF-8 | 604 | 4.46875 | 4 | [] | no_license | ''' Ejercicio 3
Escribir una función filtrar_palabras() que tome una lista de palabras y un entero n, y
devuelva las palabras que tengan más de n carácteres.'''
def filtar_palabras(palabras, n):
palabras_mayores = []
for palabra in palabras:
if len(palabra) > n:
palabras_mayores.append(pal... | true |
6cc9637815cd81be9a884f173cf76db3b079809d | Python | arnaudmm/django-bootstrap5 | /tests/test_bootstrap_pagination.py | UTF-8 | 2,163 | 2.671875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | from django.core.paginator import Paginator
from django_bootstrap5.utils import url_replace_param
from tests.base import BootstrapTestCase
class PaginatorTestCase(BootstrapTestCase):
def test_url_replace_param(self):
self.assertEqual(url_replace_param("/foo/bar?baz=foo", "baz", "yohoo"), "/foo/bar?baz=yo... | true |
cad5dd0dc7d6655858421499a723926104174146 | Python | whyang78/machineLearning-base | /AdaBoost/simple/病马疝气死亡率.py | UTF-8 | 1,738 | 2.984375 | 3 | [] | no_license | import numpy as np
from sklearn.ensemble import AdaBoostClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import GridSearchCV
def loadDataSet(fileName):
numFeat = len((open(fileName).readline().split('\t')))
dataMat = []; labelMat = []
fr = open(fileName)
for line ... | true |
f8edc5b64c85be353575496fe32838741527f893 | Python | teamwork523/Tools | /data/boxErrorBarWithCategories.py | UTF-8 | 1,766 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
import sys, math
# convert the data into box error bar plot based on
def getMedian(li):
# assume li sorted
length = len(li)
if length == 0:
return None
elif length == 1:
return li[0]
if length % 2 == 0:
return float(li[int(length / 2)] + li[int(leng... | true |
20655507caad922cd618cc2c018fe44eab9a5d1d | Python | shuwenyue/Terminal_talk | /voice.py | UTF-8 | 3,381 | 3.265625 | 3 | [] | no_license | class Voice:
cmdDict = {'copy' : 'cp',
'cp' : 'cp',
'move' : 'mv',
'rename' : 'mv',
'make directory' : 'mkdir',
'list' : 'ls',
'ls' : 'ls',
'remove' : 'rm',
'change directory' : 'cd',
'cd' : 'cd',
... | true |
a6a45f9491deebc14dcd5761248f0cf59fc71167 | Python | nd1511/beer | /recipes/clustering/utils/gmm-train.py | UTF-8 | 3,008 | 2.59375 | 3 | [
"MIT"
] | permissive |
'Train a HMM with a given alignments.'
import random
import numpy as np
import torch
import argparse
import sys
import beer
import pickle
import logging
import os
log_format = "%(asctime)s %(levelname)s: %(message)s"
logging.basicConfig(level=logging.INFO, format=log_format)
def main():
parser = argparse.Argu... | true |
9c4642126876201ba910749fd7812f76f15d9c5d | Python | HelsinkiGroup5/Hackathon | /rto.py | UTF-8 | 11,200 | 3.3125 | 3 | [
"MIT"
] | permissive | import numpy as np
class MotionExplorer:
"""
Aim at exploring motions, represented as sampled observations of a n-dimensional input vector.
This stream of vectors describe a vector space in which the Mahalanobis distance is used to
assess the distance of new samples to previously seen samples. Everyti... | true |
00582004e5397ac8064b355e0019f89538d9061b | Python | FitCoderOfficial/Bible_Scraper | /instagram.py | UTF-8 | 1,150 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
import requests
import time
import json
import os
import csv
# Chrome의 경우 | 아까 받은 chromedriver의 위치를 지정해준다.
driver = webdriver.Chrome('D:\Works\PG_Works\Bible_Scraper\chromedriver')
# 암묵적으로 웹 자원 로드를 위해 3초까지 기다려 준다.
drive... | true |
05810cd900ba6aa894357bb25b570c601ae0a660 | Python | jeroenarens/Apps4Ghent_Bib | /Apps4Ghent_Library/apps4ghent/forms.py | UTF-8 | 626 | 2.703125 | 3 | [] | no_license | from django import forms
#This form is used for the purpose of the REC, here a form is created where you can choose your birth year (decade) and sex (M/F)
DECADE_CHOICES = [(1940,'1940'),(1950,'1950'),(1960,'1960'),(1970,'1970'),(1980,'1980'),(1990,'1990'),(2000,'2000')]
SEX_CHOICES = [('M','Male'),('V','Female')]
CAT... | true |
570606e8d44b01b11f6c84f8583ce195c70224cf | Python | harshi12/AI_On_The_Edge_Platform | /models/iris/app/predict_cl.py | UTF-8 | 1,097 | 2.796875 | 3 | [] | no_license | import pandas as pd
import json
import sys
import requests
test_data = sys.argv[1]
IP = input("Enter server IP:")
test_data = pd.read_csv(test_data, header = None)
test_data = test_data.iloc[1:,:-1]
request_str = {"signature_name": "predict","instances":[]}
for index,row in test_data.iterrows():
temp = {"sepal_len... | true |
f53f9489a17f55be8659df1a8cc472a3cdfdd7e2 | Python | rcc-uchicago/rcc-intro | /scripts/python_pool.py | UTF-8 | 374 | 3.046875 | 3 | [] | no_license | '''
A simple code to demonstrate how to use multiple cores to speed up
a program.
This code is going to use 4 cores to calculate eigen vectors of 4 random matrices.
'''
import numpy
from multiprocessing import Pool
from itertools import repeat
num_cores = 4
pool = Pool(num_cores)
pool.map(numpy.linal... | true |
eff1e16cd1e32684d38179c9a24f395df1805f32 | Python | xulzee/LeetCodeProjectPython | /48. Rotate Image.py | UTF-8 | 1,657 | 3.609375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/2/27 16:02
# @Author : xulzee
# @Email : xulzee@163.com
# @File : 48. Rotate Image.py
# @Software: PyCharm
from typing import List
class Solution:
def rotate1(self, matrix: List[List[int]]) -> None:
"""
Do not return anything, modify matrix in-place ... | true |
790b32a9dbdb61babbaf6fd8b50965556f98b31d | Python | adrn/longslit | /scripts/init_pipeline.py | UTF-8 | 2,466 | 2.6875 | 3 | [
"MIT"
] | permissive | # coding: utf-8
""" Initialize the 1D spectral reduction pipeline. """
# Standard library
import os
from os.path import abspath, expanduser, exists, join
import sys
# Third-party
import yaml
# Package
from longslit.log import logger
def main(name, rootpath):
rootpath = abspath(expanduser(rootpath))
if not... | true |
5b376b580bd83c28d60cc0883c1135bf03e0d83f | Python | noika/pyladies.hw | /210piskvorky.py | UTF-8 | 220 | 3.375 | 3 | [] | no_license | pole = 20*"-"
def tah(pole, cislo_policka, symbol):
"""Vrátí herní pole s daným symbolem umístěným na danou pozici"""
return pole[:cislo_policka-1] + symbol + pole[cislo_policka +1:]
print(tah(pole, 20, "o"))
| true |
9a843afc20d497970d2d2856260e7a6936fa7be3 | Python | trevor91/algorithm | /beakjoon/9376.py | UTF-8 | 1,801 | 2.875 | 3 | [] | no_license | import sys, re
from heapq import heappush, heappop
read = lambda: sys.stdin.readline()
def check(x,y):
if x == 0 or y == 0 or x == w-1 or y == w-1:
return(True)
return(False)
def go(i):
while prisoners:
wall, (cur_x, cur_y) = heappop(prisoners)
print(wall, (cur_x, cur_y), visited[i])
if check(cur_x,cur_y)... | true |
4147bf499a6ae26cdf23d08897df9958417c2b37 | Python | MtTsai/Leetcode | /python/131.palindrome_partitioning.py | UTF-8 | 520 | 3.171875 | 3 | [] | no_license | class Solution(object):
def partition(self, s):
"""
:type s: str
:rtype: List[List[str]]
"""
out = []
def find(string, curr, out):
if string == '':
out.append(curr)
else:
for i in range(len(string)):
... | true |
949982f9039d9f4dbbf3fd0a6e08e47382434247 | Python | kcc/sanitizers | /address-sanitizer/tools/kernel_test_parse.py | UTF-8 | 5,493 | 2.65625 | 3 | [
"NCSA",
"MIT",
"LLVM-exception",
"Apache-2.0"
] | permissive | """
Parser for unit test output in kernel logs.
Each test should write special messages to kernel log:
##### TEST_START <test_name> denotes the beginning of the test log
##### TEST_END <test_name> denotes the finnish of the test log
##### FAIL <reason> denotes the test failed
##### ASSERT '<regex>' - we should search ... | true |
7b4f644a64edbb4d68c1b47e5c2112a26f082756 | Python | rpural/DailyCodingProblem | /Daily Coding Problem/findPatterns.py | UTF-8 | 579 | 3.6875 | 4 | [] | no_license | #! /usr/bin/env python3
''' Daily Coding Problem
This problem was asked by Microsoft.
Given a string and a pattern, find the starting indices of all occurrences of
the pattern in the string. For example, given the string "abracadabra" and the
pattern "abr", you should return [0, 7].
'''
import re
teststring = "a... | true |
8d45c718874bf3177a788ebde3f04f05645cee83 | Python | Shashvat6264/flappy_bird | /sprites.py | UTF-8 | 1,720 | 3.078125 | 3 | [] | no_license | # Sprite classes for the platformer game
import pygame as pg
import random
from settings import *
from graphics import *
class Player(pg.sprite.Sprite):
def __init__(self, game):
pg.sprite.Sprite.__init__(self)
self.game = game
self.g = Graphics()
self.image = pg.Surface((70,70))
... | true |
5ff459002d8930742ff638ea1063a8ac70c2c602 | Python | brunadelmourosilva/cursoemvideo-python | /mundo2/ex054_idade.py | UTF-8 | 630 | 4.1875 | 4 | [] | no_license | #Exercício Python 54: Crie um programa que leia o ano de nascimento de sete pessoas.
#No final, mostre quantas pessoas ainda não atingiram a maioridade e quantas já são maiores.
from datetime import date
atual = date.today().year
contJovem = 0
contAdulto = 0
for i in range(1, 7+1):
y = int(input('Insira o ano de n... | true |
ab010a0525dc5cb56da30839259a7157551ca887 | Python | OnaiNet/rgt_3.14 | /bwilkes/code/CreateAndSendJson.py | UTF-8 | 498 | 2.578125 | 3 | [] | no_license | import sys
import json
import requests
headers = {'Content-type': 'application/json'}
json_string = '{"message": "' + str(sys.argv[1:]) + '"}'
#print(json_string)
json_string = json_string.replace("[","")
#print(json_string)
json_string = json_string.replace("]","")
#print(json_string)
json_string = json_string.r... | true |
5311273b7d6dbf457da83c2bcc83695400f152d9 | Python | Supercap2F/PiCAM | /src/PiCAM3.py | UTF-8 | 5,212 | 2.671875 | 3 | [] | no_license | from Tkinter import *
import ttk
import threading
from picamera import PiCamera
import tkMessageBox
class App:
def __init__(self,master):
#self.grid();
# Make a canvas where a camera preview will be
#self.CanvasPreview = Canvas(master,width=200,height=200);
#self.CanvasPreview.grid(... | true |
fe6e9123eeaa721958248e20ef6c5fbac069aa0a | Python | knakamor/projects | /OOP/src/test_war.py | UTF-8 | 1,595 | 3.390625 | 3 | [] | no_license | import nose.tools as n
from deck import Card
from war import War
from war_player import Player
def test_player_init():
player = Player("name")
n.assert_equal(len(player), 0)
n.assert_is_none(player.play_card())
def test_player_receive_play():
player = Player("name")
card = Card("J", "c")
playe... | true |
78bcb9864ee620ae3b9f2ab23854cb8b5f0d69f6 | Python | vikas456/uteats | /parser.py | UTF-8 | 6,442 | 2.59375 | 3 | [] | no_license | from datetime import datetime
from urllib2 import urlopen as uReq
from bs4 import BeautifulSoup as soup
from flask import Flask, render_template, url_for
app = Flask(__name__)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
@app.route("/")
def main():
time = str(datetime.now().time().hour)
day = datetime.today()... | true |
8ea00784102a8d3db6cc189f2d0c805ebbcce92c | Python | kingdelee/LeePy | /PyQT5/MyPyqtTest/singal/up/t4.py | UTF-8 | 1,329 | 3.21875 | 3 | [] | no_license | import sys
from PyQt5.QtWidgets import *
from functools import partial
class WinForm(QMainWindow):
def __init__(self, parent=None):
super(WinForm, self).__init__(parent)
# 实例化两个按钮
button1 = QPushButton('Button1')
button2 = QPushButton('Button2')
# todo 第一种方法
# 单击信号... | true |
704762ea8c4e69dc812925ec1ffbe38e850adb7b | Python | EdgarHE/Iot-Design | /PiChat.py | UTF-8 | 2,127 | 3.046875 | 3 | [] | no_license | #!python2
import thread
import time
import SocketServer
import socket
import sys
class MyTCPHandler(SocketServer.BaseRequestHandler):
"""
The request handler class for our server.
It is instantiated once per connection to the server, and must
override the handle() method to implement commu... | true |
1829321bf3757b19cdc896b38b7fcdfae0301d3c | Python | jiax1994/Physics-simulations | /lab3/fig.py | UTF-8 | 2,098 | 4.125 | 4 | [] | no_license | '''ceci est un programme qui calcule et affiche les positions de y en fonction de x selon les différents angles, il y a deux graphiques
'''
#importation de module numpy et la librairie matplotlib
import numpy as np
import matplotlib.pyplot as plt
#définir la fonction de la trajectoire de projectile
def trajec... | true |
052e63527e59231b4bc36c311a11c0e6ce8bc5c5 | Python | mfmakahiya/empath-on-movie-reviews | /python scripts/empath on movie reviews.py | UTF-8 | 2,757 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
###############################################################################
# This script applies empath on movie reviews
###############################################################################
# Load libraries
import os
import logging
from empath import Empath
import pandas as pd
... | true |
12f9ed119a12ec6503a1fd579cb5d8469e4ed616 | Python | 10bddoolittle/LEDGrid | /Display_Module.py | UTF-8 | 1,855 | 3.34375 | 3 | [] | no_license | import time
from Display.GPIOModule import GPIOModule
from Display.LEDArray import LEDArray
class Display:
#active_cols = []
def __init__(self,rowgpios,colgpios):
self.numrows = len(rowgpios)
self.numcols = len(colgpios)
self.led_array = LEDArray(self.numrows, self.numcols)
self... | true |
47c12e07691391859faf0e25297030cf40fb1908 | Python | JeffDing/Python_Music | /utils/Decorator.py | UTF-8 | 528 | 2.84375 | 3 | [] | no_license | from functools import wraps
import re
import time
def Count(func, *args, **kwargs):
"""
统计音乐播放信息
:param f:
:param args:
:param kwargs:
:return:
"""
@wraps(func)
def wrapper(path, *args, **kwargs):
with open("log.txt", "a") as f:
# 写入当前时间及播放音乐名称
... | true |
1f2b1c8cd974c8713d0c223c2fc173c8da062a0b | Python | Fangziqiang/AppiumTesting | /src/unitTest使用方法.py | UTF-8 | 5,094 | 3.484375 | 3 | [] | no_license | #unittest培训后总结记录
今天在给同学们上了自动化测试单元框架unittest之后,突发奇想,要总结下自己今天上的课程内容。于是有了下面的一幕:
首先,今天上课的目标是要学会关于unittest框架的基本使用及断言、批量执行。
第一个,unittest是什么:
为了让单元测试代码能够被测试和维护人员更容易地理解,最好的解决办法是让开发人员遵循一定的规范来编写用于测试的代码,
所以说unittest就随机缘而生,又因为用的人多了,所以逐渐的变成了python的单元测试标准。unittest单元测试框架不仅可以适
用于单元测试,还可以适用WEB自动化测试用例的开发与执行,该测试框架可组织执行... | true |
68be00ab15037580f7965d61ee75aaea25b03e7c | Python | saw1998/ML-from-scratch | /decision_tree/17CH10065_ML_A2/Task2/Task2_A.py | UTF-8 | 1,700 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_csv("../dataset/dataset_A.csv")
#initialization and data manupulation
thetas=np.random.randn(12)
y=df['quality']
del df['quality']
df.insert(0,'fixed',np.ones(y.size))
############### main algorithm #######... | true |
44acf1540ff3b01a76d3c45654ab0e01b0cd0221 | Python | rossor/data-import | /src/gpg.py | UTF-8 | 673 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from subprocess import call
import logging
import os.path
def decrypt(gpgbin, source, destination):
"Return error string upon failure; or None"
if not os.path.isfile(gpgbin):
logging.critical("{} not found".format(gpgbin))
raise IOError("{} not found".format(gpgbin))
ppfile = os.path.... | true |
4f5b582eda0d414d5bdc5ae85c0fcbeff0b4612a | Python | googleapis/python-api-core | /tests/unit/test_timeout.py | UTF-8 | 7,046 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | true |
7d82076b3ab664ea5c8d8f64c74df9b68c48cca9 | Python | ComradeMudkipz/lwp3 | /Chapter 2/compoundInterestCalculator.py | UTF-8 | 176 | 3.546875 | 4 | [] | no_license | # compoundInterestCalculator.py
# A compound interest calculator.
P = int(10000)
n = int(12)
r = float(0.8)
t = int(input("How many years? "))
print(P * (1 + r / n) ** n * t)
| true |
861ceeec149805b6026005543f4be5f2868720f6 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_209/ch8_2020_08_14_13_04_52_381177.py | UTF-8 | 59 | 2.53125 | 3 | [] | no_license | def calcula_posicao (so,v,t):
p = so + v*t
return p | true |
528cc3932d89e6d8473da72e1bbaf5af25dc531b | Python | beelzebielsk/image-deformation | /draw.py | UTF-8 | 5,904 | 2.828125 | 3 | [
"MIT"
] | permissive | import tkinter
from tkinter import ttk
from PIL import ImageTk, Image
import numpy as np
import os
from deformation import deform
# Listener callbacks
def listenClick(event):
global w, current, new, deformButton
print('Clicking', event.x, event.y)
for pt in new:
point = w.coords... | true |
a0774cf3007ab7bb3a7cea02e9dd6dd828266ae0 | Python | Hakkim-s/Learn_Data_Science | /Data Visualisation/Sample Excersice/Abul's Assignment.py | UTF-8 | 2,086 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[8]:
from statistics import mode
mode([5, 17, 23, 31, 43, 49, 57, 17, 57, 17])
# In[11]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# In[12]:
train_data=pd.read_csv("Standard Metropolitan Areas Data - train_data - data.csv")
# In[62]:
... | true |
75fab5b118d37353f3c76a342d5bfa09bf3693a8 | Python | DeepHiveMind/Demo_Noflo_Data | /GraphPlot.py | UTF-8 | 247 | 2.859375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import sys
import io
data_string = sys.argv[1]
data = io.StringIO(data_string)
df = pd.read_csv(data, sep=",")
df.plot(kind='bar',x='quantity',y='unit price',color='red')
plt.show()
| true |
295b2cb3bc6311a369c2e1e5c8818fc9e67895a0 | Python | christophmeyer/longboard-pothole-detection | /pothole_model/preprocessing/preprocess_data.py | UTF-8 | 3,712 | 2.78125 | 3 | [
"MIT"
] | permissive | import argparse
import pandas as pd
import numpy as np
import os
from shutil import copyfile
from preprocessing.convert_images import read_grayscale
from sklearn.model_selection import train_test_split
from model.train import ModelConfig
def read_annotated_capture_data(input_dir):
"""
Loops over all capture d... | true |
f287d1e1ac0cbc3a2d7367bc514c01cd18815c5b | Python | david30907d/soph | /demos/utils.py | UTF-8 | 2,785 | 3.125 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import re
import jieba
import logging
from functools import partial
jieba.setLogLevel(logging.INFO)
PUNCTS_PATTERN = re.compile(ur"[.,;:!?'\"~\[\]\(\)\{\}_—。….,;、:!?‘’“”〕《》【】〖〗()「」~]")
SPACES_PATTERN = re.compile(ur"[\r\n\t\u00a0 ]")
SENT_SEP = u'。,!?~;:.,!?:;'
def encode_from_unicode(text):
"... | true |
a944e0c837c86fa14101c4f98c07ad01b3905efd | Python | lucas-alcantara/perl_vs_python | /read_and_write.py | UTF-8 | 1,184 | 3.8125 | 4 | [] | no_license | # Read and Write Files Row by Row in Python
# Import os module for system function
import os
# Input file name
iris_in = "iris.csv"
# Output file name
iris_out = "iris.tsv"
# URL
url = "http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"
# Download and save iris dataset
# -s Silent mode. Do... | true |
a19e78dd0821f6b1e0f4fa5a53cfc5d7f6533bc3 | Python | dougjaso/amazon-connect-snippets | /python/remote-control-center/GetConfigLambda/lambda_function.py | UTF-8 | 6,055 | 2.6875 | 3 | [
"MIT-0"
] | permissive | import boto3
import os
import time
from boto3.dynamodb.conditions import Key, Attr
'''
SAMPLE CONNECT INVOCATION EVENTS
Get a single Message with language code in attributes:
{
"Name": "ContactFlowEvent",
"Details": {
"ContactData": {
"Attributes": {
"LanguageCode": "es"
... | true |
d59983e808d95f795d7eea3c1bda105d6472032a | Python | sripathisridhar/acav100m | /evaluation/code/models/video_model_builder.py | UTF-8 | 8,544 | 2.515625 | 3 | [
"MIT"
] | permissive | """Visual Conv models."""
import torch
import torch.nn as nn
import math
from models import head_helper, resnet_helper, stem_helper
from models.build import MODEL_REGISTRY
# Number of blocks for different stages given the model depth.
_MODEL_STAGE_DEPTH = {18: (2, 2, 2, 2), 34: (3, 4, 6, 3), 50: (3, 4, 6, 3), 101: (... | true |
616262c4788f287bdf469ff77461ef5dbcca0150 | Python | surajdidwania/Deep-Learning-Projects | /Self_Organizing_Maps/somdp.py | UTF-8 | 1,020 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Importing the dataset
dataset = pd.read_csv('Credit_Card_Applications.csv')
X = dataset.iloc[:,:-1].values
y = dataset.iloc[:,-1].values
#Festure Scaling
from sklearn.preprocessing import StandardScaler,MinMaxScaler
sc= M... | true |
f51257a9a215d76c1640e21da4734ce9ce61b14c | Python | zhbngchen/USACO | /contest/herding.py | UTF-8 | 459 | 2.96875 | 3 | [] | no_license | fin = open("herding.in", 'r')
fout = open("herding.out", 'w')
a, b, c = map(int, fin.readline().split())
distAB = b - a
distBC = c - b
if distAB == 1 and distBC ==1:
best = 0
worst = 0
else:
if distAB == 2 or distBC == 2:
best = 1
else:
best = 2
if distAB < distBC:
maxDist =... | true |
541f2f0e47018eb50e9dbb0308c86312252dc465 | Python | trevbhatt/bengali | /grad-cam.py | UTF-8 | 13,684 | 2.640625 | 3 | [] | no_license | '''Command to run:
python grad-cam.py --image-path 'sample_4.pickle' --use-cuda --model 'storage/models/consonant_diacritic.pth' --label 'label_4_vowel.pickle'
'''
import argparse
import cv2
import numpy as np
import torch
from torch.autograd import Function
from torchvision import models
import torch.nn as nn
import... | true |
b6e99339bac4a56aeb175a5dabe3b009751c5abd | Python | infantinoalex/AI-Final-Project | /Source/Board.py | UTF-8 | 12,169 | 3.6875 | 4 | [] | no_license | """
Contains the Board class
The Board is the place where all the tiles are played; it starts off empty, and
then holds every word which gets played throughout the game
"""
import numpy as np
from Tile import Tile
from Anchor import Anchor
from Word import Word
from Words import Words
class Board :
def __init... | true |
3c4b3a6199e925be395044e989719eeb826cfbe7 | Python | jbernrd2/Talbot_Effect | /Data_Reader.py | UTF-8 | 1,346 | 3.828125 | 4 | [] | no_license | ###################### Code for opening Data files ############################
# This code takes a data file from a PDE solution, and returns the real and
# imaginary parts of the solution, as well as the position that each of these
# data points as an array
##########################################################... | true |
8510d003d5da6cf2e4b8f9bfa3b473ce59f14ade | Python | josefondrej/medical-ide-poc | /dev_utils/parse_drg_catalogue.py | UTF-8 | 477 | 2.640625 | 3 | [
"MIT"
] | permissive | from pandas import read_excel, set_option
set_option("display.max_columns", 20)
set_option("display.width", 500)
catalogue_path = "SwissDRG-Version_10_0_Fallpauschalenkatalog_AV_2021_2021.xlsx"
df = read_excel(catalogue_path, sheet_name="Akutspitäler", skiprows=7)
df = df.iloc[:, [0, 2]]
df.columns = ["code", "text"]
... | true |
9217807182adfd5967309c87f53a346b0507e5bc | Python | adamafriansyahb/algorithm-practice | /reverse_linkedlist.py | UTF-8 | 341 | 3.5 | 4 | [] | no_license | # HackerRank Challange: Reverse a Linked List - Problem Solving -> Data Structures
def reverse_llist(head):
current = head
prev = None
after = current.next
while current:
after = current.next
current.next = None
prev = current
current = after
# Prev is returned as ... | true |
34cd3c1d2627721f196af0996e2691d4fd7916fe | Python | sreisig/math561-final | /preprocess.py | UTF-8 | 765 | 2.796875 | 3 | [] | no_license | import pandas as pd
def extract_eco1_windspeed_fuelmoisture():
"""
Extracts average windspeed and fuel moisture by level 1 ecoregion (data originally segmented by level 3 ecoregion)
Assumes that fm_ws_monthly_ecn.csv has been moved from Nagy's repo into data/
"""
df = pd.read_csv('./data/fm_ws_mont... | true |
588f8643e171d9c40bbbd739dd83af738d1da71f | Python | Reinelin/password_retry | /password.py | UTF-8 | 264 | 3.46875 | 3 | [] | no_license | password = 'a123456'
i = 3
while i > 0:
i = i - 1
pwd = input('please enter password:')
if pwd == 'a123456':
print('succesful login')
break
else:
print('wrong password')
if i > 0:
print( i ,'more chance')
else:
print('no more chance')
| true |
369e29adcf464645f572777948d926e61a5055c5 | Python | jatinmayekar/Kalman_Filter | /s_3_e2_time.py | UTF-8 | 804 | 3.546875 | 4 | [
"MIT"
] | permissive | # importing the required module
import timeit
# code snippet to be executed only once
mysetup = "from math import sqrt"
# code snippet whose execution time is to be measured
mycode = '''
def solution(ranks):
# write your code in Python 3.6
count = 0 #initialize counter for num of soldiers who can report to some... | true |