blob_id
large_string
language
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
2cbe147eaa879f496cfa8f57646c8f13e5688a84
Python
cmartinezbjmu/DatosEnormes
/Script/mapReduce/Reuters/taxis/reducer-1.py
UTF-8
1,262
2.96875
3
[]
no_license
#!/usr/bin/env python import sys import operator from collections import Counter tipo_veh = '' destino = '' dia_semana = '' dic_principal = dict() conteo_destinos = dict() for entrada in sys.stdin: entrada.strip() try: tipo_veh, dia_semana, destino = entrada.split(',') destino = destino.spli...
true
0d74a4311d188d16e18c5d0af6429fe786ac0c52
Python
kaulraghav/Top-Interview-Questions
/1. Easy/2. Strings/3. First Unique Character in a String.py
UTF-8
469
4
4
[]
no_license
#Dictionary + .index() function #Time: O(n), Space: O(1) class Solution: def firstUniqChar(self, s: str) -> int: dict = {} for i in range(len(s)): if s[i] not in dict: dict[s[i]] = 0 dict[s[i]] += 1 for k, v in dict.item...
true
d54cfe61bda47f78f28fafd6522e2cb72965e42e
Python
rocky-ye/NLP
/predict.py
UTF-8
2,224
3.078125
3
[]
no_license
import gensim, os from joblib import load # load models count_vect = load('./models/CountVectorizer.joblib') tfidf_transformer = load('./models/TfidfTransformer.joblib') clf = load('./models/bestModel.joblib') def clean_doc(text, vocab): """ turn a text doc into clean tokens Args: text (Pandas Series...
true
2d6475ca9dc30b0e546a6b990a2aa587fa91ef99
Python
SmileXDrus/Selenium-Python_autotests
/ExplicitWaitExp.py
UTF-8
897
2.640625
3
[]
no_license
from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as ec from selenium import webdriver #Настройка opt = webdriver.ChromeOptions() opt.add_experimental_option('w3c', False) #Подключение dr = webdriver.Chrome(chr...
true
9317d3b716d5a43a940bcee25f1088db4604c88f
Python
kapootot/projects
/py_scripts/src/sort.py
UTF-8
237
3.40625
3
[]
no_license
a = [7, 1, 3, 5, 2, 8] # a = [1, 7, 3, 5, 2, 8] def my_sort(arr): min_val = arr[0] max_val = [arr[len(arr)]-1] i = 0 while i < len(a): if a[i] < min_val: a[a.index(min_val)] = a[i] a[i]
true
8bfbbb0d8870921f91583940dbac85cc6b0dae75
Python
AurelC2G/practice
/googlecodejam/2018/1B/Transmutation/code.py
UTF-8
963
2.640625
3
[]
no_license
import sys import itertools import math import collections import functools sys.setrecursionlimit(10000) def inputInts(): return map(int, raw_input().split()) def consumeOne(what): if G[what]: G[what] -= 1 return True if reserved[what]: # we are trying to produce this, there must...
true
d3b1bc2a52cbce04f477570ffeab8eac2394ec24
Python
taesookim0412/Python-Algorithms
/2020_/05/LeetCode/11M_NumberOfIslands.py
UTF-8
1,766
3.671875
4
[]
no_license
from typing import List #05-21-2020_ #Runtime: 156 ms, faster than 41.77% of Python3 online submissions for Number of Islands. #Memory Usage: 15 MB, less than 9.40% of Python3 online submissions for Number of Islands. #https://leetcode.com/problems/number-of-islands #Interesting finds: #The order for the recursive st...
true
a795fd09015b1840afdba949021b23b83cb0d24e
Python
karlos88/learn-python-the-hard-way
/ex05/ex05.py
UTF-8
1,575
3.796875
4
[]
no_license
name = 'Zed A. Shaw' age = 35 # not a lie height = 74 # inches height_cm = height * 2.54 weight = 180 # lbs weight_kg = weight * 0.454 eyes = 'Blue' teeth = 'White' hair = 'Brown' print("Let's talk about %s." % name) print("He's %d inches tall." % height) print("He's %d pounds heavy." % weight) print("Actually that's ...
true
89d660083c67f616966ad5bfc80d4f91871c1f75
Python
chris-r-harwell/dsp
/Prework_5.1/q24StringFrontBack.py
UTF-8
832
3.8125
4
[]
no_license
#!/bin/env python3 import os import sys # Complete the function below. def front_back(s1, s2): """ INPUT: two strings OUTPUT: a-front + b-front + a-back + b-back where -front and -back are the strings split in half with an extra char in front for those with an odd number of characters. """ ...
true
8ecd4cc877f53debe45e3cdee9c6d46a9c59f12f
Python
rsoundrapandi/pythonProject1
/Ifelse.py
UTF-8
1,460
4.125
4
[]
no_license
# # def Leap(year): # if (year % 4) == 0: # if (year % 100) == 0: # if (year % 400) == 0: # print("leap year") # else: # print("Not a leap year") # else: # print("Not a leap year") # else: # print("Not a leap year") # #...
true
249c399ed616febc28cca89ea124531b6117f6dc
Python
smpio/gunicorn
/gunicorn/metrics/store.py
UTF-8
1,996
2.734375
3
[ "HPND", "MIT" ]
permissive
import time import pickle from collections import namedtuple class MetricsStore(object): Item = namedtuple('Item', ['metric_name', 'metric_type', 'tags', 'value']) def __init__(self, log): self.data = {} self.log = log def __getstate__(self): return self.data def __setstate_...
true
6bc696866e5b064da851e32fcfefbac270e06d8c
Python
ib407ov/LABS---11
/Завдання 1.py
UTF-8
3,169
3.765625
4
[]
no_license
# # конструктор без параметрів, конструктор з параметрами, конструктор копіювання; # введення/виведення елементів вектора; # визначення довжини вектора; # нормування вектора; # порівняння з іншим вектором; # перевантаження операторів + (додавання векторів), – (віднімання векторів), * (знаходження скалярного добут...
true
84d02f0f17bc5f92c9b010dab07824d17774a1c5
Python
yigalirani/leetcode
/20190501_google_phone_interview_question.py
UTF-8
1,473
2.90625
3
[]
no_license
''' sorry attempt to automaticalt convert to iteration. idea: can this def get_alloc_f() def flat_runner(input,f): stack=[] ` ans.append(input) cache={} while(stack): top=stack.pop() ans = cache.get(top,None) if ans: if len(stack)==0: ret...
true
f53df7fcd50e5e3c37054fc3f17f343aa9935c6e
Python
mangalagb/Leetcode
/Medium/ArrayNesting.py
UTF-8
1,334
3.859375
4
[]
no_license
# A zero-indexed array A of length N contains all integers from 0 to N-1. Find and return # the longest length of set S, where S[i] = {A[i], A[A[i]], A[A[A[i]]], ... } # subjected to the rule below. # # Suppose the first element in S starts with the selection of element A[i] of index = i, # the next element in S s...
true
7a276883ba18a820c8258b0bb6d1f168d6e6e25b
Python
PyMarcus/Jogo_da_forca
/game/baseGame.py
UTF-8
693
3.703125
4
[]
no_license
from presents import Start from colorama import Fore class Base: """ Base of the game """ def __init__(self, nome, life = 100): self.nome = nome self.life = life def setLife(self, lif): self.life -= lif return print(f"Player {str(self.nome)} -- life: {str(round(self...
true
3a8b10b41f75e8bfdded430c80fe77b58fff683b
Python
xiaohai2016/StatRank
/analysis.py
UTF-8
2,412
2.859375
3
[]
no_license
"""Data anlysis and visualization script(s)""" from __future__ import print_function import numpy as np from sklearn.decomposition import PCA from sklearn.manifold import TSNE import matplotlib.pyplot as plt import seaborn as sns import click from data_loader import load_microsoft_dataset def tsne_fit(feature_vectors...
true
62f49dc02c5ee44296cc73bd2b1a0f652329e7f5
Python
konstantinAriel/RayTracer
/scr/WignerDistrib/getTimeDate.py
UTF-8
192
3.109375
3
[]
no_license
import datetime now = datetime.datetime.now() print ("Current year: %d" % now.year) print ("Current month: %d" % now.month) print ("Current day: %d" % now.day) print ('Current day:', now.day)
true
f0cb75586236360a0511dccb7a340eb19a79a953
Python
Dupeydoo/DRAG
/DRAGProj/forms/custominputform.py
UTF-8
4,011
2.875
3
[]
no_license
from django import forms from DRAG.datacontext import context """ A module containing the form class and recipes to make the custom beat input form. Author: James Version: 1.0.0 See: forms.Form, DRAGProj.views """ instrument_choices = ( (1, "Hi-Hat"),...
true
8134355096ebc5c06860ffc87ead0c07350a83ea
Python
Bharanij27/bharanirep
/Pys84.py
UTF-8
53
2.953125
3
[]
no_license
import math n=float(input()) c=math.ceil(n) print(c)
true
df1cc09629ae505580adcc27e0f7cf1005d2413d
Python
rcarbal/Bible-it-Python-server
/constants/periods.py
UTF-8
1,936
2.625
3
[]
no_license
GENERAL_BIBLICAL_PERIODS = [ # Periods of the Bible from Adams synchronological chart # The Anti Diluvian Period # { # 'position': 1, # 'name': 'The Anti Diluvian', # 'first_year': -4004, # 'last_year': -2348 # }, { 'position': 1, 'nam...
true
614e13fef86fc5528ed43679e0a1112f14f6d09c
Python
HarrysDev1ce/ccc
/2019/j3.py
UTF-8
839
3.921875
4
[ "MIT" ]
permissive
repeated_count = int(input()) encoded_lines = [] for _ in range(repeated_count): line = input() pairs = [] # Position in line i = 0 # We use a `while` loop as we may increment `i` within the loop body. while i < len(line): repeated_count = 0 c = line[i] # Increment the ...
true
e24d514b88f33042a27ea20a98fce8bbad7a4704
Python
medeiroscwb/curso_em_video_python
/A 8 - Utilizando Módulos.py
UTF-8
1,523
3.6875
4
[]
no_license
''' Utilizando Módulos: Módulos são programas feitos em python que trazem uma série de funcionalidades e soluções que já foram testadas e aprovadas pela comunidade Python. Podemos importar um módulo, ou biblioteca utilizando o comando IMPORT. É convencionado importar os módulos necessários nas primeiras linahs do ...
true
767539cf8d4b5a5e7fc020978dfea770eeb04848
Python
jiamin0329/sjtuaero_post
/cfdppparser.py
UTF-8
16,758
2.765625
3
[]
no_license
#!/usr/local/bin/python ####################################################### # File description ####################################################### # This class is used to parse infos produced in CFD++. # Get toltal/inviscid/viscous drag, lift and moment # from following files: # 1. case.log => ge...
true
ca13f7ef900457342dd4ce38115e149065935031
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_74/289.py
UTF-8
521
2.984375
3
[]
no_license
#!/usr/bin/env python from sys import argv def solve(v): p = [1,1] t = [0,0] s = 0 while v: x,y = v.pop(0) d = 1+max(0,abs(p[x]-y)-t[x]) s += d p[x] = y t[x] = 0 t[1-x] += d return s f = open(argv[1],'r') n = int(f.readline()) for x in xran...
true
7e0b1398e550c7bb6a50d99bf1b0e974e9fb9ca6
Python
RebeccaNacshon/ETL_Implementation
/ETL/program/server.py
UTF-8
3,394
2.921875
3
[]
no_license
import logging import socket from database.sqlite_program import Database from heartbeat.heartbeat import Heartbeat from exception import corrupted_file_exception import jsocket.tserver import time logger = logging.getLogger("jsocket.example_servers") count = 1 """ custom server which inherits ThreadedServer and impl...
true
0c84b47c773a38fa630b0e224f1df9f6fffc25be
Python
siddharth1k/git-project
/Program2.py
UTF-8
121
4
4
[]
no_license
#FIRST PROGRAM print ("Enter any number:") x = int(input('')) if x>5: print (x) else: print (" no Less than 5")
true
adb0be95f150810514ef9c36ddc8e174e206f48f
Python
Andremarcucci98/Python_udemy_geek_university
/Capitulos/Secao_13/Exercicios_13/exercicio_25_agenda_turbinada/agenda.py
UTF-8
3,207
3.46875
3
[]
no_license
from time import sleep from typing import List from Capitulos.Secao_13.Exercicios_13.exercicio_25_agenda_turbinada.models.contato import Contato agenda: List[Contato] def main() -> None: menu() def menu() -> None: print('========================') print('======== Agenda ========') print('=========...
true
ecb0248986465e57c3dc08ade4bebd96732eb0b6
Python
jakudapi/aoc2017
/day08-1.py
UTF-8
2,001
3.9375
4
[]
no_license
''' --- Day 8: I Heard You Like Registers --- You receive a signal directly from the CPU. Because of your recent assistance with jump instructions, it would like you to compute the result of a series of unusual register instructions. Each instruction consists of several parts: the register to modify, whether to incre...
true
b139575e646b96bd12500ea20aed10d697b67d4f
Python
spegesilden/kattis
/r2/r.py
UTF-8
70
3.078125
3
[]
no_license
line = input().split() r = int(line[0]) s = int(line[1]) print(2*s-r)
true
71a1a6f6f1940f97da933c7fc07c66bd812765fb
Python
mauryanidhi/Fake-news-classification
/fake_news_machine_learning.py
UTF-8
4,865
3.15625
3
[]
no_license
import pandas as pd df=pd.read_csv('train.csv') df.head() #Drop Nan Values df=df.dropna() ## Get the Independent Features X=df.drop('label',axis=1) ## Get the Dependent features y=df['label'] X.shape y.shape messages=X.copy() messages['title'][1] messages.reset_index(inplace=True) import n...
true
b3aa022074dbcac5d4ea2bf4f22c0e3e65f5d6b8
Python
Mayberry2021/cursed_comment_filter
/db_controller.py
UTF-8
4,392
2.921875
3
[]
no_license
import sqlite3 import time class db_controller(object): def __init__(self, db_name): self.db = sqlite3.connect(db_name) self.curs = self.db.cursor() def checking_duplicate(self, content): # 댓글 중복 검사 sql = 'SELECT content FROM comment_set WHERE content==?' result = self.curs.execute(sql, [content]) if (not...
true
c9779a06f01b040aaa50c5d42d9d5cb64326fd40
Python
osmanmusa/LCSIA
/models/AtoW_grad.py
UTF-8
3,740
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ file : AtoW_grad.py author: Xiaohan Chen email : chernxh@tamu.edu date : 2019-02-20 """ import numpy as np import tensorflow as tf import utils.train from utils.tf import get_subgradient_func, bmxbm, mxbm class AtoW_grad(object): """Docstrin...
true
aa6fa4cdf1b7f7dfa21845ba9a65ae8cbfca7bc0
Python
cukejianya/leetcode
/array_and_strings/check_straight_line.py
UTF-8
588
3.4375
3
[]
no_license
class Solution: def checkStraightLine(self, coordinates: List[List[int]]) -> bool: prev_x, prev_y = coordinates.pop(0) slope = None for coord in coordinates: curr_x, curr_y = coord denominator = (curr_x - prev_x) if denominator: curr_slope ...
true
6fbc97cdfb8c491a9ebdb507eb7fa46fa921467c
Python
mad-ops/AdventOfCode
/day03/2020_code.py
UTF-8
801
3.390625
3
[]
no_license
import os # look mah, im a straight line # flipping along x # y = 3x scriptdir = os.path.dirname(os.path.abspath(__file__)) with open(os.path.join(scriptdir,'2020_input.txt')) as slopes: track = [x.strip() for x in slopes.readlines()] def ski(track, m): count, tree, width = 0, 0, None for row in track[1:]...
true
66f8d68ad5d2eea77c7b54cc184d69a854f4d36d
Python
spettiett/dsc-capstone-project-v2-online-ds-pt-061019
/flatiron_stats.py
UTF-8
5,772
3.0625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#flatiron_stats import numpy as np import scipy.stats as stats from scipy.stats import anderson import matplotlib.pyplot as plt def monte_carlo_test(var1, var2, popl, col): """Non-Normal Distribution - Non-Parametric Tests: Using Monte Carlo Test""" print(f"Non-Parametric Tests: Using Monte Carlo Test") p...
true
54d0459b082babf9b07b7f112f7e639e13c04e6c
Python
ejohnso9/programming
/codeeval/chal_121/chal_121.py
UTF-8
1,096
2.84375
3
[]
no_license
#!/usr/bin/env python import sys """ Solution for codeeval challenge #121 (LOST IN TRANSLATION) https://www.codeeval.com/open_challenges/121/ AUTHOR: Erik Johnson DATE: 2015-NOV-16 """ """ def build_map(lines): d = {} # rv for i in range(3): enc = lines[i].rstrip() dec = lin...
true
3546cf42938b48a93005de90e76d758232d1386e
Python
geezardo/codechef
/compete/ISCC2018/T21.py
UTF-8
109
3.1875
3
[ "MIT" ]
permissive
t = int(input()) for i in range(t): (m, n) = [int(x) for x in input().split()] print((n * m) % 3)
true
bc903328114d9caaa36ac36eff323d8ff4c17c72
Python
dbbrandt/short_answer_granding_capstone_project
/calc_ngrams.py
UTF-8
377
2.578125
3
[]
no_license
import pandas as pd from similarity import calculate_containment answers = pd.read_csv('data/sag2/answers.csv', dtype={'id':str}) questions = pd.read_csv('data/sag2/questions.csv', dtype={'id':str}) n = [1,2] ngrams = calculate_containment(questions, answers, n) df = pd.DataFrame(ngrams, columns=['1','2','correct']...
true
052a0b9bd82c713b13bc862a0287b84484396652
Python
raphelemmanuvel/airflow-dags
/sample.py
UTF-8
580
3.0625
3
[]
no_license
from airflow.operators import bash_operator from airflow.operators import python_operator def greeting(): import logging logging.info('Hello World!') # An instance of an operator is called a task. In this case, the # hello_python task calls the "greeting" Python function. hello_python =...
true
1097d7470a0c7492796e6734406121b77511151c
Python
TRHX/Python3-Spider-Practice
/JSReverse/passport_yhd_com/yhd_login.py
UTF-8
1,476
2.515625
3
[]
no_license
# ================================== # --*-- coding: utf-8 --*-- # @Time : 2021-10-09 # @Author : TRHX # @Blog : www.itrhx.com # @CSDN : itrhx.blog.csdn.net # @FileName: yhd_login.py # @Software: PyCharm # ================================== import execjs import requests login_url = 'https://passport.yhd.c...
true
c8a1ee5cbde3e3e2ec18f9d52de5309bb14bbbc0
Python
dacapo1142/clustering-tools
/tools/nmi_str.py
UTF-8
648
2.515625
3
[]
no_license
from sklearn.metrics.cluster import normalized_mutual_info_score import sys from collections import deque file1, file2 = sys.argv[1:3] v1 = deque() v2 = deque() d = dict() reindex = 0 with open(file1) as f: for cid, line in enumerate(f): vlabels = line.strip().split() v1.extend([cid] * len(vlabels...
true
dbd82650037fd2ef8af35fb49b5063782691e5bd
Python
KimYeong-su/programmers
/python/DFS_BFS/tripRoute.py
UTF-8
728
2.90625
3
[]
no_license
def solution(tickets): global answer answer = [] N = len(tickets) visit = [False] * N def check(tickets, visit, result): global answer if False not in visit: answer.append(result) return for i in range(N): if visit[i]: continue ...
true
5503e5181cb5adfc7b4bfafe7979dea2389defbd
Python
tatiaris/tatiame-old
/coding_problems/project_euler/2.py
UTF-8
566
4.21875
4
[]
no_license
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. # ...
true
ecae1ca3d4bb7cbdcd335a2be20b993b601d3ac8
Python
ttomchy/LeetCodeInAction
/greedy/q861_score_after_flipping_matrix/solution.py
UTF-8
1,003
3.3125
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- """ FileName: solution.py Description: Author: Barry Chow Date: 2020/12/7 3:13 PM Version: 0.1 """ import math class Solution: def matrixScore(self, A): m = len(A) n = len(A[0]) #行变换,第1列的值,全部换成1 for i in range(m): if A[i][0]...
true
d5f6f0aded9246414167679cd073eac227ddf3c0
Python
Franklin-Wu/project-euler
/p066.py
UTF-8
4,138
3.6875
4
[]
no_license
# Diophantine equation # # Consider quadratic Diophantine equations of the form: # x^2 - D * y^2 = 1 # # For example, when D = 13, the minimal solution in x is 649^2 - 13 * 180^2 = 1. # # It can be assumed that there are no solutions in positive integers when D is square. # # By finding minimal solutions in x for D =...
true
2ef3200efefbf94d32cf8478380db41ed3899eef
Python
Noronha1612/wiki_python-brasil
/Estruturas de Decisão/ex10.py
UTF-8
326
4.03125
4
[]
no_license
print("""\33[32mEm que turno você estuda? [M] Matutino [V] Vespertino [N] Noturno""") esc = input('Sua opção: ').upper()[0] print('\33[1;33m') if esc == 'M': print('Bom dia!') elif esc == 'V': print('Boa tarde!') elif esc == 'N': print('Boa noite!') else: print('\33[1;31mValor inválido.') print('\33[m...
true
e7f5da98411d75e57988c0a94f85c754bdd69089
Python
yurilifanov/random
/alice_and_mathematics/py/test.py
UTF-8
489
3.046875
3
[]
no_license
M = 10 ** 9 + 7 A = (M - 1) // 2 B = 2 X = 1 Y = (1 - A) // 2 assert A * X + B * Y == 1, 'Test 1 failed.' x = 2 * M a = x % A b = x % B assert (b * X * A + a * Y * B) % (M - 1) == x % (M - 1), 'Test 2 failed.' from scipy.special import binom def binom_mod2(n, k): N = format(n, '032b') K = format(k, '032b') ...
true
ba264963e12d83427af836b60c96e41c28705628
Python
joab40/Alpha
/lib/walpha_question_class.py
UTF-8
788
2.84375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- try: import wolframalpha except ImportError: print 'You need wolframalpha in %s ',libpath sys.exit(1) import sys reload(sys) sys.setdefaultencoding('utf8') class alpha(object): def __init__(self, key): #creating object self....
true
c7e5d5b84491c15e36f05192539938a1f0de21b4
Python
BlancaCalvo/Apps2_Scifact
/label_evaluation.py
UTF-8
2,697
2.75
3
[]
no_license
import argparse import jsonlines from sklearn.metrics import f1_score, precision_score, recall_score, confusion_matrix parser = argparse.ArgumentParser() parser.add_argument('--corpus', type=str, default='data/corpus.jsonl', required=False) parser.add_argument('--dataset', type=str, default='data/claims_dev.jsonl', r...
true
13e068a124e8148cdeeaea2e06d2d79fb7a27aaa
Python
nikuzuki/I111_Python_samples
/2/20.py
UTF-8
140
2.84375
3
[]
no_license
# べき乗の計算 a = 1 for i in range(1, 10000001): # 1~10,000,000 a *= 293 b = a % 1000 # 下三桁 print("answer="+str(b))
true
f16eefd79ff2116ef2333352eb7a40496dd0ab72
Python
Gabriel-ino/python_basics
/senha.py
UTF-8
481
4.09375
4
[]
no_license
senha = str(input('Crie uma senha: ')) cont = 1 while True: ent = str(input('Digite aqui a sua senha para entrar:')) while ent != senha: ent = str(input('Senha errada, tente novamente.')) cont += 1 if cont > 3: print('BLOQUEADO! VOCÊ ESTÁ IMPEDIDO DE ACESSAR.') q...
true
512059e7466758e086532102b9d8d5b3debc517a
Python
shadmanrafid/Machine-Learning
/Decision_Tree.py
UTF-8
7,419
3.15625
3
[]
no_license
import csv import sys import os def str_column_to_int(Input_list, i): for row in Input_list: row[i] = int(row[i].strip()) def make_prediction(node, row): if row[node['field']] < node['value']: # predicting which class the data will belong to if type(node['left_branch']) ...
true
416f03774482b9df4aef166db3fb1cf3438d7998
Python
bn-d/project_euler
/000-100/047/main.py
UTF-8
883
3.265625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import sys import math sys.path.insert(0, '../../') import util def primes_num(n): cur = n cur_div = 2 count = 0 while True: if cur % cur_div == 0: count += 1 while cur % cur_div == 0: cur = int(cur / cur_div) if cur == 1:...
true
3bf83198b99783e87691d7e73e2e3bbdacbb5f9d
Python
PhilipWafula/k2-connect-python
/k2connect/webhooks.py
UTF-8
3,715
2.75
3
[ "Python-2.0" ]
permissive
""" This module handles the creation of webhook subscriptions. It creates a subscription to receive webhooks for a particular event_type. """ from k2connect import exceptions from k2connect import json_builder from k2connect import service from k2connect import validation WEBHOOK_SUBSCRIPTION_PATH = 'webhook-subscript...
true
a1a62b3666088dae910431c0375a4d8fe708cb7a
Python
HenriqueSamii/Assessment-Fundamentos-de-Programa-o-com-Python
/AssesmentPython2.py
UTF-8
336
3.921875
4
[]
no_license
#Usando o Thonny, escreva um programa em Python que some todos os números pares de 1 até um dado n, inclusive. #O dado n deve ser obtido do usuário. No final, escreva o valor do resultado desta soma. holder = 0 geter = int(input("Número - ")) for items in range(0,geter+1,2): #print(items) holder += items p...
true
223fbd331a4ac305111f5fca14b82ffb9a37f7da
Python
FERARMAO/github_ci
/main.py
UTF-8
116
2.546875
3
[]
no_license
""" Add function example """ def add(var1, var2): """My two numbers adding function""" return var1 + var2
true
d0a5dadab996207dc4f2ed5076d450eaea8dbfe0
Python
john-zcliu/Kattis-1
/plowking.py
UTF-8
363
2.765625
3
[]
no_license
n, m = map(int, input().split()) ans = 0 currNode = 2 currWeight = 1 while currNode <= n: ans += currWeight currWeight = currWeight+1 m = m-1 edgesWasted = max(0, currNode-2) edgesNeeded = n-currNode edgesWasted = min(edgesWasted, m-edgesNeeded) m -= edgesWasted currWeight += edgesWast...
true
f3b27fc720442e6b60e6746a4d0b03e31bfc94b3
Python
edizquierdo/ToddALife2020
/src/diff_steep_runscript.py
UTF-8
291
2.53125
3
[]
no_license
import os import time import sys reps = int(sys.argv[1]) n=15 k=6 for steep_checks in range(1, n+1): print("Number of genes being checked in steepLearn: {}".format(steep_checks)) os.system('time python simulate.py '+str(k)+' '+str(reps)+' '+str(steep_checks)+' &') time.sleep(1)
true
c4d8fc45490f1341a9e06418ec13ad22f9ee725f
Python
ishmam-hossain/problem-solving
/leetcode/1261_find_elements_in_contaminated_bin_tree.py
UTF-8
953
3.78125
4
[]
no_license
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class FindElements: def __init__(self, root: TreeNode): self.elements = set() def fix_tree(head): if head is None: r...
true
c2a295f3eb8f70ddfc47b38d610ea30535580115
Python
chuandong/python
/tcpser.py
UTF-8
547
2.515625
3
[]
no_license
#!/usr/bin/python from socket import * from time import ctime HOST = '127.0.0.1' PORT = 60536 ADDR = (HOST, PORT) BUFSIZE = 1024 sersocket = socket(AF_INET, SOCK_STREAM, 0) sersocket.bind(ADDR) sersocket.listen(5) while True: print('waiting connection ...', ADDR) tcpclisocket, addr = sersocket.accept() ...
true
67349e2c227e95b44fc6bd31eed61af3355754b9
Python
malcolmmmm/sscanner
/sscanner.py
UTF-8
1,960
2.875
3
[]
no_license
import requests def main(social, infile, outfile): with open(infile,'r') as f: name=f.read().split('\n') possible_user = list() for i in range(1,len(name)): try: url = (social+name[i]) r = requests.post(url) if r.status_code == 404: possible_user.append(str(name[i])) print('test['+str(i)+'] '+na...
true
e26229f020d99ab3574bc5ff877607dc8ecc3e5d
Python
hussainsultan/filedrop
/app/auth.py
UTF-8
1,692
2.6875
3
[ "MIT", "Apache-2.0" ]
permissive
from flask import current_app, request, abort from functools import wraps from ipaddress import ip_address as ip_address_orig from ipaddress import ip_network as ip_network_orig def ip_address(address): """Wrap ip_network method from ipaddress module to automatically force utf8 string (it's required as this l...
true
97d50632f36a4d2bb1ff37d209b62840e843a704
Python
wyjwl/lintcode
/35searchInsert.py
UTF-8
179
3.46875
3
[]
no_license
def searchInsert(nums, target): if len(nums) == 0: return 0 for i in range(0, len(nums)): if nums[i] >= target: return i return len(nums)
true
dbc3c3c7d37ce98899f56370c484bf11703c55e3
Python
oxovu/point_clouds_optimization
/triang.py
UTF-8
1,375
2.890625
3
[]
no_license
from scipy.spatial import Delaunay import numpy as np import matplotlib.pyplot as plt import pcl from mpl_toolkits.mplot3d import Axes3D from plotXYZ import plot_bounds def main(): # оптимизированное облако cloud1 = pcl.load('data/lamppost2.pcd') # начальное облако cloud2 = pcl.load('data/lamppost.pcd...
true
db69d6b300b71d1687a8e9b9be743d4743312be8
Python
nixawk/hello-python3
/PEP/pep-008-02-A Foolish Consistency is the Hobgoblin of Little Minds.py
UTF-8
1,735
3.609375
4
[]
no_license
#!/usr/bin/python # A Foolish Consistency is the Hobgoblin of Little Minds # One of Guido's key insights is that code is read much more often than # it is written. The guidelines provided here are intended to improve # the readability of code and make it consistent across the wide spectrum # of Python code. As PEP 20...
true
d28760a2a14cfff28a6998f02de7b933e7fa0051
Python
Aasthaengg/IBMdataset
/Python_codes/p04029/s871525461.py
UTF-8
42
2.59375
3
[]
no_license
n = int(input()) print(int((1/2)*n*(n+1)))
true
ae009b186405f7807e23d0cd0d59a3ec0421cba3
Python
Jinmin-Goh/LeetCode
/Solved/0145/0145_recursive.py
UTF-8
824
3.453125
3
[]
no_license
# Problem No.: 145 # Solver: Jinmin Goh # Date: 20200126 # URL: https://leetcode.com/problems/binary-tree-postorder-traversal/ import sys # recursive solution of postorder traversal # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = Non...
true
8367d9f7bd7d401da3034238a780338cd29687c0
Python
Aasthaengg/IBMdataset
/Python_codes/p02263/s724543127.py
UTF-8
449
3.25
3
[]
no_license
#!/usr/bin/env python3 if __name__ == '__main__': a = input().split(' ') b = [] for i in a: if i == '+': tmp = b.pop(-1) + b.pop(-1) b.append(tmp) elif i == '-': p = b.pop(-1) tmp = b.pop(-1) - p b.append(tmp) elif i == '*...
true
d167dce4eb44dc270bc64abd6db3ec7f67f94d57
Python
yzwgithub/TeachPython
/AI/AI基础/class_23/class_23_04.py
UTF-8
715
3.59375
4
[]
no_license
# 导入绘图模块 import matplotlib.pyplot as plt # 构建数据 GDP = [12406.8, 13908.57, 9386.87, 9143.64] # 中文乱码的处理 plt.rcParams['font.sans-serif'] = ['SimHei'] # 解决负号'-'显示为方块的问题 plt.rcParams['axes.unicode_minus'] = False # 绘图 plt.barh(range(4), GDP, align='center', color='orange', alpha=0.5) # 添加轴标签 plt.xlabel('GDP') # 添加标题 plt.t...
true
28be9c865a8756194e23fcdb502c249fbef71e75
Python
ahwitz/conductAtHome
/beat.py
UTF-8
2,152
2.625
3
[]
no_license
from __future__ import division import pygame.midi import music21 import time from threading import Thread, Timer from multiprocessing import Process, Queue import serial import re import math import sys import traceback import collections def serialTempoWatcher(initTempo, eventQueue): ser = serial.Serial("/dev/ttyAC...
true
a8d7c44cec679dfbe0f48bebb5ee3efa703bc4e0
Python
sunildkumar/ConnectFour
/connect_four.py
UTF-8
3,727
3.296875
3
[]
no_license
import numpy as np from Piece import Piece from PlacementState import PlacementState class ConnectFour: def __init__(self): self.COLS = 7 self.ROWS = 6 self.MIN_COL_INDEX = 0 self.MAX_COL_INDEX = self.COLS-1 self.MIN_COL_CAPACITY = 0 self.MAX_COL_CAPACITY = ...
true
b5f811b938c8fd4f6f85d4aeb99f9ed1986a729e
Python
rot11/nginx_logs_analyzer
/timeX.py
UTF-8
1,186
2.546875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # # time.py # # Copyright 2014 Stazysta <Stazysta@STAZYSTA-KOMP> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the ...
true
511bdb5f275d5a91f36e6409fe8a837db197c293
Python
dsdshcym/LeetCode-Solutions
/algorithms/set_matrix_zeroes.py
UTF-8
775
3.109375
3
[]
no_license
#+TAG: NEEDS_IMPROVE class Solution(object): def setZeroes(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ if (matrix == []): return matrix N = len(matrix) M = len(matrix[0]...
true
dd904c643ac6aa94aab28a356e882b8986335e4a
Python
speedbug78/BlueOS
/Tools/GUI/BlueOS_tasks.py
UTF-8
1,204
2.609375
3
[ "MIT" ]
permissive
import BlueOS_schedule import BlueOS_timeline import BlueOS_support import random # Container class to hold task related information class Tasks: def __init__( self, canvas ): self.task_info = {} self.task_schedule = [] self.timeline_block = BlueOS_timeline.Timeline_Block( canvas ) def...
true
b4accf31bf3d5ca0e1e590ae104ffd1d4ad3c187
Python
rufi156/kryptoS52019-2020
/8elgamal/elgamal.py
UTF-8
5,128
2.5625
3
[]
no_license
import random import argparse, sys, os GEN = "elgamal.txt" PRIV = "private.txt" PUB = "public.txt" PLAIN = "plain.txt" CRYPTO = "crypto.txt" DECRYPT = "decrypt.txt" MSG = "message.txt" SIG = "signature.txt" VER = "verify.txt" def NWD(a, b): if b != 0: return NWD(b, a % b ) return a def modInverse(a, ...
true
42070bbc859e0b5da6a873fb565df36b3b71b785
Python
cms-sw/cms-bot
/generate-json-performance-charts
UTF-8
4,593
2.578125
3
[]
no_license
#! /usr/bin/env python from __future__ import print_function from optparse import OptionParser from os import listdir from os import path import re import json #------------------------------------------------------------------------------------------------------------ # This script reads a list of the workflows, step...
true
14c596f2216e6ca752184737af2e51620dc756b3
Python
DesLandysh/My100daysPath
/009_of_100/day_9_Blind_Bit_program_for_one_PC_multiusers.py
UTF-8
616
3.921875
4
[]
no_license
# blind bit program def clear(): print("\n"*20) print("Welcome to the blind bit program") blind_bit = {} next_person = True while next_person: name = input("Enter your name: ").capitalize() bit = int(input("What's your bit? $")) blind_bit[name] = bit if input("Is there another person to bit? yes/...
true
6d5f2490fef9894328193b887f7571ee604fc05a
Python
Dershowitz011/randphone
/randphone.py
UTF-8
2,113
3.71875
4
[]
no_license
"""Generate a random valid US phone number.""" import random def phone(): valid = False while not valid: # Generate a random phone number. number = [random.randint(0, 9) for i in range(10)] # Assume it is valid. valid = True # The format of an area code is NXX, where...
true
2eeec35929bdf5b4263bed87cfd9d9090e1454e9
Python
TimeWz667/LitReviewer
/reviewer/summary.py
UTF-8
986
2.640625
3
[ "MIT" ]
permissive
from io import BytesIO import matplotlib.pyplot as plt from wordcloud import * __author__ = 'TimeWz667' __all__ = ['make_word_cloud'] EscapeWords = ['background','methods','results','conclusions','included', 'used','used','using','use','compared','may','associated', 'will','conducted','...
true
f5266c85c7fc1fea8c0138ce081e177f3d351ac2
Python
williamroque/profero
/src/pagamentos_garantias_package/profero/presentation/slides/dados-operacao/slide.py
UTF-8
8,402
2.625
3
[]
no_license
from pptx.util import Cm, Pt from pptx.enum.shapes import MSO_SHAPE from pptx.enum.text import PP_ALIGN, MSO_ANCHOR from pptx.dml.color import RGBColor from profero.framework.presentation.slide import Slide as FSlide from profero.framework.presentation.row import Row from profero.framework.presentation.cell import Cel...
true
42c9f91b2c32d9cc14ca80bc51e7b3456c8b1cf5
Python
scarecrow1123/Advent-Of-Code
/2015/Day13/13.py
UTF-8
1,014
3.125
3
[]
no_license
import re ip = open("13.txt").read() lines = ip.splitlines() arr = {"Alice": {"me": 0}, "Bob": {"me": 0}, "Carol": {"me": 0}, "David": {"me": 0}, "Eric": {"me": 0}, "Frank": {"me": 0}, "George": {"me": 0}, "Mallory": {"me": 0}, "me": {"Alice": 0, "Bob": 0, "Carol": 0, "David": 0, "Eric": 0, "Frank": 0, "George": 0, "Ma...
true
0922a86c318b54376b9fc4576c816b8eba9dc419
Python
sysboy/aoc
/2020/day12/part01.py
UTF-8
874
3.421875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ AOC day 12 """ from collections import deque import sys ins = [] with open(sys.argv[1]) as fd: for line in fd: ins.append([line[0],int(line[1:])]) facing = deque(['E','S','W','N'],maxlen=4) location = [0,0] x = 0 y = 1 for i in ins: direction = i[0] steps = i[1] ...
true
96bf7e02291bc8ce157c88a487bb644437480d3d
Python
ImNaman/CL3
/A2/a2.py
UTF-8
896
3.21875
3
[]
no_license
import threading import xml.etree.ElementTree as et def getdata(filename): xmltree=et.parse(filename) root= xmltree.getroot() print root.tag a=[] for child in root: a.append(int(child.text)) print child.tag, child.text print a return a def partition(first, last): pivot=a[first] i=first+1 j=last while ...
true
c9396fe1e482df4ca62fbfbaa994d862376330dd
Python
sheh2431/CV_hw-2
/hw2_4/new_baseline.py
UTF-8
3,693
2.75
3
[]
no_license
import os import sys import numpy as np from sklearn.neighbors import KNeighborsClassifier from sklearn.manifold import TSNE from sklearn.decomposition import PCA import torchvision.models as models from torchvision import transforms from torchvision.datasets import ImageFolder import torch import torch.nn as nn import...
true
25b1e0bb8a702c955f5d09b4b4c6d54b73057c22
Python
taiswelling/ifpi_algoritimos
/SEMANA 3 E 4-questões URI/URI_1019.py
UTF-8
146
3.296875
3
[]
no_license
N = int(input('')) hora= N//3600 resto = N%3600 minutos = resto//60 resto2 = resto%60 print('{}:{}:{}'. format(hora,minutos, resto2))
true
d06687af82d5cd910207fcbde9f142af900d20be
Python
FranArleynDynamicDuo/problemas_modelos_lineales
/Problema_2/main.py
UTF-8
5,132
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- from simulacion import iniciar_simulacion from commons.estadistica import error_95_prcnt def problema(numero_simulaciones): print "" print "********************************************************************************" print "********************************** Problema 2 ******...
true
59ded83b07f2bff2cc27082e25fcc4fa85e10925
Python
kuznesashka/dlcourse.ai
/Assignment 2/model.py
UTF-8
4,408
3.234375
3
[ "MIT" ]
permissive
import numpy as np from layers import FullyConnectedLayer, ReLULayer, softmax_with_cross_entropy, l2_regularization class TwoLayerNet: """ Neural network with two fully connected layers """ def __init__(self, n_input, n_output, hidden_layer_size, reg): """ Initializes the neural network ...
true
8ea9969315e91d256302085ba735891034d67bc3
Python
jeffreyjxh/dse14-finding-venusian-volcanoes
/ballooncalc.py
UTF-8
1,952
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue May 03 11:29:28 2016 @author: Chaggai """ def ballooncalc(mpayload, hbal, molarmgas, buoyancyperc): import VenusAtmosphere as atm #get atmospheric contstants Tatm, Patm, rhoatm, GravAcc=atm.VenusAtmosphere30latitude(hbal) Patm=Patm*10**5 rhogas = Pa...
true
49763d334f29dfbc162cb1dd0e26792d8dcd7beb
Python
TariqAHassan/EasyMoney
/tests/easy_tests.py
UTF-8
14,074
2.828125
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python3 """ Public API Unit Testing for EasyMoney ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ # Imports import os import sys import unittest import pandas as pd # Allow access to modules sys.path.insert(0, os.path.abspath(".")) sys.path.insert(0, os.path.abspath("../")) # Import the tool from...
true
425b99d2126835db78b63125d6f2769108c8437e
Python
christopherlorenz/CS420_project
/test_codes/lu_row_pivot.py
UTF-8
1,401
2.640625
3
[]
no_license
import numpy as np size = 4 A = np.random.rand(size, size) U = np.array(A) L = np.eye(size) P = np.eye(size) P_new = np.eye(size) for i in range(size): # if need to permute => permute and store permutation on P """ if U[i,i] < 1e-5: max_pivot = i for j in range(i+1,size): if abs(U[j,i]) > abs(U[ma...
true
916999fefde9da2ebfd49e57ab7f1aef36a2650e
Python
anis-campos/macgyver
/gui/level/level.py
UTF-8
2,532
3.234375
3
[]
no_license
from typing import List import pygame from pygame.sprite import Group from gui import BLUE from gui.tiles.floor import Floor from gui.tiles.floor_type import FloorType from gui.tiles.wall import Wall from model.labyrinth import Labyrinth, TileType class Level: """ This is a generic super-class used to define a ...
true
dccec16f525a3d380fc0c0fac207938476913047
Python
duyminhnguyen97/GenePrioritization
/SNP_finder/tool.py
UTF-8
3,955
2.84375
3
[]
no_license
import pandas as pd # function to get gene def get_gene(input_set, data_set): snp_input = pd.read_csv('../SNP_finder/input/split_by_chr/' + input_set, engine = 'python') data_input = pd.read_csv('../SNP_finder/train_data/' + data_set, engine = 'python') result = pd.DataFrame(data = None, columns = ['snp_gap_id', '...
true
f7c615252dfb39a549d618067b066f9c4a99314f
Python
cold-turkey-developer/refactoring_2nd_ed_example
/Ch1/test/test_statement.py
UTF-8
748
3
3
[]
no_license
import unittest from utils import import_json_file from statement import statement class TestStatement(unittest.TestCase): def setUp(self): self.invoice = import_json_file("invoices.json") self.plays = import_json_file("plays.json") def test_statement_correct(self): result_expected = ...
true
840313531a84e497e851ed4560d842ac51a04ad7
Python
Rodolfo-SFA/FirstCodes
/ex048.py
UTF-8
108
3.390625
3
[ "MIT" ]
permissive
s = 0 for c in range(1, 500): if (c % 2) > 0 and (c % 3) == 0: print(c) s += c print(s)
true
2a707957c4ad38620afc051dd5cabe1bd34be5d6
Python
abrehamgezahegn/somehow-I-python
/oop/operator_overloading.py
UTF-8
1,029
3.984375
4
[]
no_license
class Vector: def __init__(self, a,b): self.a = a self.b = b def __add__(self , other): return Vector(self.a + other.a , self.b + other.b) def __mul__(self, other): a = self.a * other.a b = self.b * other.b return Vector(a,b) def get_vector(self...
true
77c149a646f358236dcd349ab5f95ac81e5133c6
Python
Xiang-Gu/Should-ALL-Temporal-Difference-Learning-Use-Emphasis
/MountainCar_Control/Tile_Coding/Tilecoder.py
UTF-8
3,620
3.515625
4
[]
no_license
# 2-D tile coding # It is used to construct (binary) features for 2-D continuous state/input space + 1-D discrete action spacce # for linear methods to do function approximation import math import numpy as np # The following three lines are subject to change according to user need # -- numTilings, x_start, x_ra...
true
7beb0ad3ebbe8026973409862812fe054b1cbcde
Python
suxin1/image_processing
/image_derivatives.py
UTF-8
860
2.6875
3
[]
no_license
from PIL import Image import numpy as np import pylab as plt from scipy.ndimage import filters import os from utils.imtools import get_imlist imlist = get_imlist(os.getcwd() + "/images") def derivatives(image): im = np.array(image.convert('L')) sigma = 1 imx = np.zeros(im.shape) # filters.sobel(im,...
true
ed8167d4924bb178d7f3b1123b4d74b7e7a8f4e8
Python
jeisson-Tellez/ciclo_1
/Actividades echas clase 3/archivo_clase_3.py
UTF-8
5,337
3.859375
4
[]
no_license
#___________________CAPTURA DE DATOS________________________________________________ # # primera forma de captura de datos en python # # se utilizas un print y luego el imput guardandolo en una variable # #print("Escriba su nombre") # #Nombre=input() # #segunda forma, se guarda todo en una sola linea # #nombre=input...
true
1a05b78b47e53370747ea2e29f9179388649c95e
Python
OCM-Lab-PUC/switch-chile
/python_utility_scripts/db_timepoints_sampler.py
UTF-8
2,170
2.59375
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- # Copyright 2016 The Switch-Chile Authors. All rights reserved. # Licensed under the Apache License, Version 2, which is in the LICENSE file. # Operations, Control and Markets laboratory at Pontificia Universidad # Católica de Chile. """ Script to populate the timescales_population_timepoints ...
true
56e0f5bac2e764890fabf7746f8f8a83c255044e
Python
alexandrosanat/graph-neural-networks
/zacharys_karate_club/model.py
UTF-8
9,366
2.65625
3
[]
no_license
from collections import namedtuple import networkx as nx from networkx import read_edgelist, set_node_attributes, to_numpy_matrix import pandas as pd from numpy import array import torch import torch.nn as nn import torch.optim as optim import matplotlib.pyplot as plt import numpy as np DataSet = namedtuple( 'Da...
true