blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
d6ca7caeeee4d900b8d3b6ee71bc63da40fcb965
ShubhiJain67/MachineLearningCB
/Lecture16/SeqLSTM.py
UTF-8
5,424
2.6875
3
[]
no_license
# coding: utf-8 # In[1]: import numpy as np from matplotlib import pyplot as plt # get_ipython().magic(u'matplotlib inline') import pandas as pd import seaborn as sns import datetime import spacy import sklearn import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F #...
true
17e00fdfbb4d194c306c7522e4cf395a0cf1b044
lixiang0101/ML
/Logistic.py
UTF-8
1,082
3
3
[]
no_license
from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.linear_model import Lasso, Ridge, ElasticNet import numpy as np import pandas as pd if __name__ == '__main__': data = pd.read_csv("data/Advertising.csv")[["TV", "Radio", "Newspaper", "Sales"]] print(data.head()) X = data[["TV",...
true
fc40d7d0f501b01794d4382977c5bd415086521f
Poker-person/poligon-area-calculator
/shape_calculator.py
UTF-8
2,257
3.796875
4
[]
no_license
class Rectangle: def __init__(self, width, height): self.width = width self.height = height def __str__(self): return f"Rectangle(width={self.width}, height={self.height})" # Set width and height to atribute def set_width(self, new_width): if new_width > 0: se...
true
e900ee8ccaff0e1e0de0ac78d0312c78833f783c
vecna/Rabbisteg
/oddio/stigmetree.py
UTF-8
3,011
2.890625
3
[]
no_license
from twisted.internet import reactor from twisted.web.client import getPage # http://www.boddie.org.uk/python/HTML.html from HTMLParser import HTMLParser import urlparse """ Utilities: urlkey unique (Allen, stackoverflow) """ def urlkey(referer, url): return referer + "+" + url def unique(items): ...
true
7fda8791a147a418da164b2ebc217bb817833ba6
horiagug/AOC2018
/Day 17/AOC_17.py
UTF-8
2,086
3.09375
3
[]
no_license
import collections import sys from header import print_header def main(): print_header() sys.setrecursionlimit(3000) clay = collections.defaultdict(bool) with open('input') as f: lines = f.readlines() for line in lines: line = line.strip('\n') a, depth = line....
true
2f1dd74ddd75cddf7b30cc81246e5a6437c0a414
YUNKWANGYOU/SWE
/Midterm_Preparation/Python/DataStructure/array.py
UTF-8
338
4.53125
5
[]
no_license
# Python에서는 list를 array대신 사용한다. # 선언 a = ['math','science','computer'] # 접근 b = a[0] print(b) # 길이 print(len(b)) # for 문 활용 for i in a: print(i) #요소 추가 a.append('algorithm') print(a) # 요소 제거 - pop(index) a.pop(1) print(a) # 요소 제거 - remove(요소) a.remove('math') print(a)
true
3024be1a01204dbbb5f95808c812822ac58f2210
progrmoiz/simple-blockchain-implementation
/test_snakecoin.py
UTF-8
1,130
3.21875
3
[ "MIT" ]
permissive
from snakecoin_block import SnakeBlock def originblock(): return SnakeBlock(0, 'Origin Block', 0) def nextblock(last_block): index = last_block.index + 1 data = "Ledger " + str(index) last_hash = last_block.hash return SnakeBlock(index, data, last_hash) """ def createBlock(): n = 1 prev...
true
cff600e21f7ef2e5a5decf05bb2c43d8967319d7
oomaroomar/algosNdstrucs
/dnq/python/karatsuba/__init__.py
UTF-8
588
3.390625
3
[]
no_license
def karatsuba(x,y): """Function to multiply 2 numbers in a more efficient manner than the grade school algorithm""" xSize = len(str(x)) ySize = len(str(y)) if xSize >= 3 or ySize >= 3: return x*y n = max(xSize, ySize) nby2 = n / 2 b = x % 10**(nby2) a = (x - b)/(10**nby2) d = y % 10**(nby2) c ...
true
03ac190dd75923ed71ecbd7d243e5b3a86b05886
indrakumr/Chronic_Diseases_prediction_by_ML-master
/Decision.py
UTF-8
3,298
2.921875
3
[]
no_license
import flask import pickle import pandas as pd # Use pickle to load in the pre-trained model with open(f'model/Decisionmodel.pkl', 'rb') as f: model = pickle.load(f) # Initialise the Flask app app = flask.Flask(__name__, template_folder='templates') def multiply(Age,Sex,Sc): a=int(Age) b=i...
true
71ff161d7f861474a834f90c71f5163fb2ab9f79
LeonDong02/contest-solutions
/DMOJ/CCC/Choose your own path.py
UTF-8
827
2.9375
3
[]
no_license
from collections import deque def connected(x): if x not in visited: visited.append(x) if graph[x]: for i in graph[x]: connected(i) def distance(x): visited = [x] level = [1 for i in range(len(graph) + 1)] q = deque([x]) while q: a = q.popleft(...
true
8d258ae827947d8f31d83c70527820c64e963751
Errare-humanum-est/HeteroGen
/Deprecated/ForkTree.py
UTF-8
8,227
2.59375
3
[ "MIT" ]
permissive
# Copyright (c) 2021. Nicolai Oswald # Copyright (c) 2021. University of Edinburgh # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above co...
true
f3b4bc1de4bea8133f792baa7fd77e0bf1f9c6bb
islamfares-web/python1
/problem -1-.py
UTF-8
1,534
3.890625
4
[]
no_license
from math import sqrt class ComplexNumber(object): def __init__(self, x=0, y=0): assert (type(x) == int or type(x) == float) and (type(y) == int or type(y) == float),"Bad input!" self.x = x self.y = y def __str__(self): return str(self.x) + '+'+ str(self.y) + 'j' de...
true
00276568af22b243aac245279507c8d0826f2e41
sixfwa/computational-intelligence-cw
/coursework/GA/genetic_algorithm.py
UTF-8
6,670
2.890625
3
[]
no_license
from tools import load_data import numpy as np import operator import random import time # Load training data and targets train_data, train_targets = load_data("cwk_train") train_targets = list(train_targets) class GeneticAlgorithm: def __init__(self, pop_size, elite_size, K, upper, lower, seconds): sel...
true
541a21f9c8778439ad35977a3cb262d6044e7fe6
isha-28/Plant-Disease-Detection-Application
/tensorflow-mobilenet-which-car-is-that-master/python data management/readmat.py
UTF-8
1,042
2.921875
3
[]
no_license
from scipy.io import loadmat import pandas as pd matrix = loadmat("../cars_annos.mat") # create as many directories as the number of classes in dataset (196) import os for idx in range(matrix['class_names'].shape[1]): os.makedirs("./"+str(idx+1)) # take out class numbers and class names from annotations classNum...
true
dca0c291c98daa59d7fdc57d5cae4903c32d1f2c
Aasthaengg/IBMdataset
/Python_codes/p03472/s998787684.py
UTF-8
512
2.890625
3
[]
no_license
import heapq import math N,H = map(int,input().split()) a_ls = [0]*N b_ls =[0]*N for i in range(N): a, b = map(int,input().split()) a_ls[i] = a b_ls[i] = -b a_max = max(a_ls) heapq.heapify(b_ls) total = 0 count = 0 for i in range(len(b_ls)): b_max = -heapq.heappop(b_ls) if a_max>=b_max: ...
true
8b7a64f5841c96935666579a49bc3e8e814faf62
gparkkii/Baekjoon_Challenge
/Baekjoon_Bronze/11654.py
UTF-8
632
4.125
4
[]
no_license
# 아스키코드 구하는 문제 # 문제 : 알파벳 소문자, 대문자, 숫자 0-9중 하나가 주어졌을 때, 주어진 글자의 아스키 코드값을 출력하는 프로그램을 작성하시오. # 입력 : 알파벳 소문자, 대문자, 숫자 0-9 중 하나가 첫째 줄에 주어진다. # 출력 : 입력으로 주어진 글자의 아스키 코드 값을 출력한다. # 아스키코드 구하는 파이썬 내장함수 : # ord('문자') : 문자에 맞는 아스키코드를 반환해준다. # chr('숫자') : 숫자에 맞는 아스키코드를 반환해준다. my_askey_code = input() print(ord(my_askey_code))
true
e71c548a2d122dd508f219918808754a8cb3cc12
sivaramakrishnansr/SENSS
/Setup/Netronome/ryu/ryu-master/ryu/tests/unit/lib/test_ip.py
UTF-8
1,469
2.6875
3
[ "Apache-2.0" ]
permissive
import unittest import logging import struct import netaddr from struct import * from nose.tools import * from ryu.lib import ip LOG = logging.getLogger('test_ip') class Test_ip(unittest.TestCase): ''' test case for ip address module ''' def setUp(self): pass def tearDown(self): ...
true
de7cb8d276c519cd1d6bfb8788adbb44550db685
excrayg/coding-algos
/excrayg/leetcode/python/todo/check_if_valid_bin_tree.py
UTF-8
123
2.6875
3
[]
no_license
# Trees/Graphs # Given a head to a Graph where each Node only has 2 neighbors each, determine if it is a valid binary tree.
true
170fc8df61823ce0a5fc70ca85e00f86898c7186
SureshUppelli/Python-Scripts
/sum.py
UTF-8
336
2.984375
3
[]
no_license
from tkinter import * window = Tk() window.title("Welcome to LikeGeeks app") #lbl = Label(window, text="Hello this my first GUI Program", font=("Arial Bold", 50)) lbl = Label(window, text="Hello") lbl.grid(column=0, row=0) btn = Button(window, text="Click Me") btn.grid(column=1, row=0) window.geometry('350x200') w...
true
9f9c2f775b4365282b1d5c093504cfe0052f4de4
ym-dskr/essentials-of-ML
/Sample_code/chap02/ex2_14.py
UTF-8
89
2.875
3
[]
no_license
f = open("sample.txt") for line in f: line = line.rstrip() print(line) f.close()
true
567e758057f13277ce93ee867a5e5525246271d2
johnmalbert/Ninja_Gold
/main_app/views.py
UTF-8
2,205
2.953125
3
[]
no_license
from django.shortcuts import render, HttpResponse, redirect import random, time # Create your views here. def main(request): #check to see if key exists, if not then initialize if "gold_amount" in request.session: pass else: request.session['gold_amount'] = 0 request.session['counte...
true
7b2ca79191c5b8f4cf65adc176190470de34c3fa
Andrey-Shatunov/learnpythonthehardway
/ex42.py
UTF-8
1,674
4.15625
4
[]
no_license
## Animal is-a object (yes, sort of confusing) look at the extra credit class Animal(object): def run(self): print "I can run" def ear(self): print "I eat" ## Dog is Animal class Dog(Animal): def __init__(self, name): ## ?? self.name = name def bark(self): print...
true
4762086000f01595b5c83ad0f14a413658280670
130e/SnakeGame
/test.py
UTF-8
1,191
2.640625
3
[]
no_license
# fernival made from snakegame import SnakeGame from maze import maze import curses KEY_EXIT = 27 # define macros KEY_SPACE = 32 KEY_UP = 119 # WASD KEY_DOWN = 115 KEY_LEFT = 97 KEY_RIGHT = 100 KEY_LOST = KEY_DOWN NO_ENTRY = float('-inf') ABSORB = 1.0 MAX_ITER = 100000 HEIGHT = 8 WIDTH = 8 def g...
true
c5c1ea463ae85683f9083d7e5ea5ccf2f4dffd4c
nick-cash/spellcheck
/wordhash.py
UTF-8
216
3.15625
3
[]
no_license
from solution import word_hash while True: try: word = raw_input("> ").lower() print "Word: %s" % word print "Word hash: %s" % word_hash(word) except (EOFError): break
true
1617c8fae8c8466ef67b9cd6a89e1e0844ac1380
SergioDiaz90/holbertonschool-higher_level_programming
/0x0F-python-object_relational_mapping/11-model_state_insert.py
UTF-8
691
2.734375
3
[]
no_license
#!/usr/bin/python3 ''' script that lists all State objects that contain the letter a from the database hbtn_0e_6_usa ''' from sys import argv from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from model_state import Base, State if __name__ == "__main__": user = argv[1] passw...
true
1a2927ffaa777fb950df8d5b899d8a0e2ebf628f
lsm0729/ps
/problems/___숫자카드놀이.py
UTF-8
607
3.015625
3
[]
no_license
import sys read = sys.stdin.readline N= int(read()) ll = [list(map(int,read()[:-1])) for _ in range(N)] for num in ll: num.sort(reverse=True) n1='' n2='' is_n1 = True for n in num: if n==6: n=9 if not n1: if n==0 : print(0) break ...
true
f2a9967a28d1e6fde251ba66a2039274e842e3b0
Khushisomani/codes
/sorted list to bst.py
UTF-8
815
3.359375
3
[]
no_license
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # ...
true
af5837ab7fd786e3c8d9c551faf29b4a75056d18
ciheul/bigcrawler
/bigcrawler/pipelines.py
UTF-8
2,072
3.015625
3
[]
no_license
# Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: http://doc.scrapy.org/topics/item-pipeline.html from scrapy import log from scrapy.http import Request from scrapy.item import BaseItem from scrapy.exceptions import DropItem from HTMLParser import HTMLParser ...
true
d247eee14deed89b133af95cc7c606042d516169
DakshKalley/WeirdFlexButOkay
/wfbo.py
UTF-8
894
3.21875
3
[]
no_license
import random # Synonym lists for each word weirdSynonyms = ["weird", "odd", "bizarre", "eccentric", "funky", "kooky", "peculiar", "strange", "queer", "oddball", "uncanny", "outlandish"] flexSynonyms = ["flex", "boast", "brag", "braggadocio", "exaggeration", "vaunt", "grandiloquence"] butSynonyms = ["but", "yet"] okay...
true
a7ce8c103aebb2291f2e08d5f93a311a542e37fc
chinitacode/Python_Learning
/Algos/DP/3.Climbing_Stairs.py
UTF-8
965
4.09375
4
[]
no_license
''' --------------------------------------------- 70.Climbing Stairs [Easy] --------------------------------------------- DP (Bottom Up) Time: O(n), Space: O(n) ''' class Solution: def climbStairs(self, n: int) -> int: if n < 2: return n dp = [0]*n dp[0], dp[1] = 1, 2 for...
true
f5e971dcf305332c6f4acd59116fb3f44ae697ec
adelq/mirror
/config.py
UTF-8
385
2.59375
3
[ "MIT" ]
permissive
from modules.weather.weather import get_weather from modules.todo.todo import add_todo, list_todos from modules.music.gs import play_song # Tuple is function name, and boolean whether it should be spoken as text COMMANDS = { "weather": (get_weather, True), "what.* list": (list_todos, True), "a\w+ (.*) to m...
true
1a3e159c76e90ef78de81a055a681c4edf2d07f9
derekzhou2015/StudyPython
/Process/MultiProcess.py
UTF-8
1,241
2.640625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- 'a test class' __author__ = 'Kerwin' from multiprocessing import Process, Queue, Pool from sys import argv from subprocess import call import os,time,random if len(argv) == 1 : exit() param = argv[1][1:] def run_proc(name): print('Run child process %s(%s)...' % (...
true
6af0cfa45ae45d9b39aeabfea94b4b31c4607397
mgabris/master-thesis-attachment
/smt/utils/cli.py
UTF-8
3,349
2.75
3
[]
no_license
import argparse from config.enums import Mode, Cipher, Logic # ##### argparse enum type callables ##### def mode(string): try: value = Mode[string] except KeyError: msg = '{} is not a valid mode type'.format(string) raise argparse.ArgumentTypeError(msg) return value def cipher(...
true
eba6c666a74f3531e858afde4b23ef1e3892c342
Poojanavgurukul/python_all_programm
/python/books/book1/if_else_loop.py
UTF-8
213
3.421875
3
[]
no_license
Ordinal_list=[1,2,3,4,5,6,7,8,9] for i in Ordinal_list: if i ==1: print str(i)+"st" elif i==2: print str(i)+"nd" elif i==3: print str(i)+"rd" else: print str(i)+"th"
true
b7ca482bb1c8b5d8b71c2670f64e400a90244982
z-kidy/student_management
/management/models.py
UTF-8
1,923
2.640625
3
[]
no_license
from django.db import models class Major(models.Model): 'id primary_key' major_name = models.CharField(max_length=10) class Meta: db_table = 'Major' def __unicode__(self): return self.major_name class Classroom(models.Model): # 'id primary_key' classroom_name = models.CharFie...
true
ccdede5bcaddaf14bac3436fe81c0d568b8c7685
mjtravers/fecfile-ImageGenerator
/routes/src/log.py
UTF-8
579
2.640625
3
[]
no_license
""" This module handles logging """ import logging import sys from pythonjsonlogger import jsonlogger logger = logging.getLogger() def log_init(): formatter = jsonlogger.JsonFormatter( '{"timestamp":%(asctime),"message":%(message),' '"function_name":%(funcName),"logger_name":%(name),' ...
true
0ec5f1c0c314f7988c62101ece7f29eaaeace11b
wavetogether/wave_algorithm_challenge
/2020/2020-03/11/eugene.py
UTF-8
452
3.5
4
[]
no_license
# Runtime: 8 ms, faster than 99.06% of Python online submissions for Length of Last Word. # Memory Usage: 12 MB, less than 10.71% of Python online submissions for Length of Last Word. class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ s =...
true
ca92ad66ad7180f9c940957b45bc31062ff4ef1b
GabrielVanLoon/Projeto_Teach.me
/api/src/models/available_time.py
UTF-8
2,414
2.609375
3
[]
no_license
from django.http import QueryDict import re from src.libs.validations import is_username, is_alphanumeric, is_numeric from src.entities.available_time import AvailableTime from src.dao.available_time import AvailableTimeDAO class AvailableTimeModel: def register(self, args:QueryDict = None): available_t...
true
b82e44b36a46e9c9d8817b6cfec2019916a862d4
ilyabelyaninov/Volleyball_players-phyton-program-
/Volleyball/volley_program.py
UTF-8
582
3.21875
3
[]
no_license
from Volleyball import * volleyball_players = [] volleyball_players.append(Volleyball_player(datetime.date(1998, 5, 2), True, 'Max Maximov', 195, 87, 'VC_Kuzbass','Russia')) while True: command = input("Write a command \r\n") if command == "ADD": new_volleyball_player = Volleyball_player() ...
true
e6d278c0434c9993cb1682c8ff9f24fcf4ed4eec
jobryan/bispectrum_calculation
/lbin.py
UTF-8
522
3.125
3
[]
no_license
from pylab import * def lbin(cl,bin=10): sum = 0 binnedcl = zeros(len(cl)) for i in range(len(cl)/bin): for j in range(bin): sum += cl[j+i*bin] for j in range(bin): binnedcl[j+i*bin] = sum/float(bin) sum = 0 return binnedcl if __name__ == '__main__': ...
true
b4366eb282e4dce3c3d2f38fed64d539c38ea854
PPFilip/btc-investing
/main.py
UTF-8
2,208
2.9375
3
[ "Apache-2.0" ]
permissive
import pandas as pd import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import FuncFormatter from matplotlib import style from pandas.plotting import register_matplotlib_converters from sys import exit register_matplotlib_converters() # load data btc = pd.read_csv("data/btcusd.csv") # Index dat...
true
7fcb8f5c7d63162b640c4adc4f1eb1008083911b
gikr/paac
/utils/eval_multi_task.py
UTF-8
9,424
2.75
3
[]
no_license
import numpy as np import itertools, copy from torch.nn import functional as F import torch as th import logging, copy from .utils import BinaryClassificationStats def set_user_defined_episodes(env): """ Modify env so that every new episode starts with console dialog that asks the user to specify a new epi...
true
cde93366f91145586c1038ff3938192c7245b9e5
AdamZhouSE/pythonHomework
/Code/CodeRecords/2988/60746/311508.py
UTF-8
194
2.640625
3
[]
no_license
n=int(input()) nstr=list(input()) m=int(input()) def newstr(N,S,M): new=[] for i in range(M-1,N): new.append(S[i]) nS=''.join(new) print(nS) return 0 newstr(n,nstr,m)
true
64e315becd93329950a9ea8a6aae9a723981040f
f-dangel/backpack
/test/core/derivatives/utils.py
UTF-8
1,703
2.71875
3
[ "MIT" ]
permissive
"""Utility functions to test `backpack.core.derivatives`.""" from test.core.derivatives import derivatives_for from typing import Tuple, Type import torch from torch import Tensor from torch.nn import Module from backpack.core.derivatives.basederivatives import BaseDerivatives def get_available_devices(): """Re...
true
0b0a88398b698395e8803c01efe946674ed83392
fenekku/Masters
/Utilities/ioutils.py
UTF-8
8,149
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Input/output functions used all over """ import os from os.path import join, splitext, exists, dirname from datetime import datetime from itertools import izip import calendar import numpy as np from scipy.sparse import coo_matrix def to_file(iter_cursor, filename)...
true
2a9b45fbe07248bbdec9aeb5437d1647916e52e0
greenfox-velox/NVKrisztina
/week-06/day-3/gyak2.py
UTF-8
124
2.984375
3
[]
no_license
import random lista = [] x = random.randint(1, 10) lista.append(x) z = random.randint(1, 10) lista.append(z) print (lista)
true
4a10e0c0271ae4c9ce2db1bdbca2425201fd6e8c
amanneox/Python-Programs
/Birds.py
UTF-8
204
2.984375
3
[]
no_license
import collections def mode(arr): input() count = [0] * 6 for t in map(int, input().strip().split()): count[t] += 1 print(count.index(max(count))) mode(arr=[1, 4, 4, 4, 5, 3])
true
3974d090fa029fe01e9ccc1f37d51db7c557fc6e
Soosang-9/AI-Bot
/Server/game_word_chain/run_test.py
UTF-8
3,263
3.21875
3
[ "MIT" ]
permissive
# -*- coding:utf-8 -*- # print(""" # # *************************[ Rule ]**************************** # 1. DB에 있는 단어만 사용 가능 # 2. DB에 없는 단어를 입력 할 경우, # DB에 저장되어 다음 게임에서 사용 가능 # 3. 직접 DB를 수정하고 싶을 경우, # word_dictionary_kor.txt파일 수정 # ********************************************************...
true
ff4e656c685e5a2e38eaeba0e0633579bfb855e6
Rocamonde/savannah-framework
/savannah/core/exceptions.py
UTF-8
804
2.796875
3
[]
no_license
class SamplingUnitNotRunning(Exception): def __init__(self, msg='', *args, **kwargs): msg = 'SamplingUnit module is not currently running. ({})'.format(msg) super().__init__(msg, *args, **kwargs) class UndefinedEnvironment(Exception): pass class MisconfiguredSettings(Exception): missing = ...
true
9ddb63dd8e0a3172517cc646f27fc663b7d7d8a3
ThangNguyen97/Torch-KWT
/make_data_list.py
UTF-8
1,326
2.609375
3
[ "MIT" ]
permissive
import json from argparse import ArgumentParser from utils.dataset import get_train_val_test_split import os def main(args): train_list, val_list, test_list, label_map = get_train_val_test_split(args.data_root, args.val_list_file, args.test_list_file) with open(os.path.join(args.out_dir, "training_list.txt"...
true
d547d604da86dd3019fe8bf4abdf6756548b81bb
Alex0Young/WeeatherRobots
/getWeather.py
UTF-8
17,584
2.78125
3
[]
no_license
#encoding:UTF-8 import urllib import urllib.request import sys import json def getNowWeather(loc): # 数据字典 data = {} data['location'] = loc data['key'] = 'SKAv6x_if4JwoaNBv' url_values = urllib.parse.urlencode(data) url = "https://api.seniverse.com/v3/weather/now.json?" full_url = url + url_va...
true
6ce9cb09eba8915f28b87e48df2827a9ee98652b
itimxa/codewars_solutions
/morse_code.py
UTF-8
642
3.109375
3
[]
no_license
""" Here you can find my solution for Kata 'Decode the Morse Code, advanced', which you can find on link https://www.codewars.com/kata/54b72c16cd7f5154e9000457 """ import re def decodeBits(bits): pre_result = re.findall('1+|0+', bits.strip('0')) time = len(min(pre_result, key = lambda x: len(x))) result = '...
true
a4c214f6ebc2559aff4f7ad160672eb982b47b39
joydas65/Hackerrank-Problems
/Encryption.py
UTF-8
674
3.71875
4
[]
no_license
import math def myFunc(rows,cols,t,p): print(rows,cols) k = 1 while k <= cols: v = k - 1 while v < p: print(t[v],end = "") v += cols print(" ",end = "") k += 1 s = input...
true
f30c13df3735ef2f1eae865c874487cb99f66c9a
SebastianLomme/start-back-end-assignments
/comments/main.py
UTF-8
446
2.84375
3
[]
no_license
# Do not modify these lines __winc_id__ = "63ce21059cf34d3d8ffef497ede7e317" __human_name__ = "comments" # Add your code after this line # i will right 2 varables # one will be a number and the other will be a string number = 5 # this is a number name = "Sebastian" # this is a string """this is a multi line commo...
true
405b190347712a1d4b62a28cd24560d9ef4087df
yunfan/jyf-code
/python/hzk/hzkfonts/showhzk24
UTF-8
1,196
2.859375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys chars = sys.argv[1] chars = chars.decode("utf-8").encode("gb2312") def bin(num): assert type(num) == int, Exception("int type require") assert num >= 0, Exception("need bigger than zero") assert num < 256, Exception("only accept 1 Byte number") ...
true
83e789fa82222c5e2bc641bc9f106ac6076747b5
stroxler/clickutil
/clickutil/tests/test_args.py
UTF-8
8,203
2.875
3
[ "MIT" ]
permissive
from __future__ import print_function import pytest import click from click.testing import CliRunner from ..args import ( required_option, default_option, boolean_flag, option, boolean, get_arg_default, ) def test_boolean_flag(): runner = CliRunner() def run_suite(default_value): ...
true
0e13dce0e2baccc4618317f6868d66879b6ee1a9
lws803/cs1010_A0167
/SomeProgs/Python Stuff/Coding Assignments/programming exercise 8.py
UTF-8
1,133
3.625
4
[]
no_license
import time def bubble_sort(animal): #noElements = len(animal) - 1 #elementsSwitched = True #while elementsSwitched and noElements >= 2: #j= 0 #elementsSwitched = False #while j <= noElements - 1: #if animal[j] > animal[j+1]: #temp = animal[j] ...
true
4f9320b1e5655027f414dcec5681638ac9130966
dahymond/py_code_snippet
/scraping.py
UTF-8
1,007
3.171875
3
[]
no_license
# # Import libraries # import requests # import urllib.request # import time # from bs4 import BeautifulSoup # # Set the URL you want to webscrape from # url = 'http://candidate.fot.com.ng/' # # Connect to the URL # response = requests.get(url) # # Parse HTML and save to BeautifulSoup object # soup = BeautifulSoup(r...
true
6875d1431a0992c41157e488a1648f51b875d74c
chymaboy/aaa_python
/space_reducing.py
UTF-8
224
3.609375
4
[]
no_license
def space_reduce(string: str) -> str: # replace multiple space for single return ' '.join(string.split()) if __name__ == '__main__': space_string = input('Input string\n') print(space_reduce(space_string))
true
c06b8161f65e645b633bd6629c6be7c0bbc7f961
FilippoMB/Time-series-classification-and-clustering-with-Reservoir-Computing
/code/modules.py
UTF-8
14,116
2.875
3
[ "MIT" ]
permissive
# General imports import numpy as np import time from sklearn.linear_model import Ridge from sklearn.metrics import accuracy_score, f1_score from sklearn.decomposition import PCA from sklearn.svm import SVC from sklearn.neural_network import MLPClassifier from scipy.spatial.distance import pdist, cdist, squareform # C...
true
1fc5d09b9972507a1ab0e14f85317aae410013de
Jichao-Peng/PythonRobotics
/Localization/histogram_filter/histogram_filter.py
UTF-8
6,108
2.890625
3
[ "MIT" ]
permissive
""" Histogram Filter 2D localization example In this simulation, x,y are unknown, yaw is known. Initial position is not needed. author: Atsushi Sakai (@Atsushi_twi) """ import math import numpy as np import matplotlib.pyplot as plt import copy from scipy.stats import norm from scipy.ndimage import gaussian_filte...
true
df1edfb244c1964cefa0c03a9e8bc88586c3af01
urbainvaes/computational_stochastic_processes
/w2_monte_carlo.py
UTF-8
8,748
3
3
[]
no_license
# -*- coding: utf-8 -*- # --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.3.2 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- #+ # Copyright (c) 2020 Urbain ...
true
1b826dcd6aef76c41bbc6cae553c641611cfdfe7
Aidan-Cao/Python_Projects
/Magic_8_Ball.py
UTF-8
979
3.296875
3
[]
no_license
from tkinter import * import random array = ["It is certain.","Without a doubt" "It is decidedly so","Yes - definitely","You may rely on it",\ "As I see it, yes","Most likely yes","Yes","Signs point to yes","Reply hazy, try again","Ask again later",\ "Better not tell you now","Cannot predict now","...
true
22e3d0cc292c3960dfb23a0c45bd4c6c4d91fcf4
lujainfl/Misk-DSI-2021-01
/Learn_Py/Summary.py
UTF-8
325
2.671875
3
[]
no_license
# four main data containers # list - 1-dimensional, heterogenous type # dictionary - key/value pairs # np.array - n-dimensional, homogenous type # pd.DataFrame - 2-dimensional, collection of Series # plus these special ones # tuple - 1-dimensional, immutable, heterogenous type # Series - Special case of np.array in a ...
true
f7fb95e543eaff8253a0a747afcb43a9a6f9fe8f
datormx/PythonExercises
/Platzi100Days/calculadora_volumenes.py
UTF-8
1,147
4.0625
4
[]
no_license
from math import pi def volumen_cilindro(r, h): return pi*(r**2)*h def volumen_cubo(l): return l**3 def volumen_esfera(r): return (pi*(r**3)*4)/3 def run(): menu = """Calculadora de volúmenes: Cubo, esfera y cilindro: [C]ubo [E]sfera [Ci]lindro Inserta las letras de la figura a c...
true
b50db35038615c2f93bf70748fcdf8e8e719b372
msalman899/Python
/scripts/complex_num.py
UTF-8
1,147
3.359375
3
[]
no_license
#!/usr/bin/python from __future__ import division import math class Complex: def __init__(self, real, imaginary): self.real = real self.imaginary = imaginary def __add__(self, no): return Complex(self.real + no.real,self.imaginary + no.imaginary) def __sub__(self, no):...
true
b5ea1aca78243fdcd9bb6d7f527c9a63ec02290c
gunarevuri/prefect
/src/prefect/tasks/jupyter/jupyter.py
UTF-8
2,580
2.765625
3
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
permissive
import nbconvert import nbformat import papermill as pm from prefect import Task from prefect.utilities.tasks import defaults_from_attrs class ExecuteNotebook(Task): """ Task for running Jupyter Notebooks. In order to parametrize the notebook, you need to mark the parameters cell as described in ...
true
7dc6f81ec89e49657b820a9f7bc7863f9cde2022
JennieOhyoung/Letter-counting
/lettercount.py
UTF-8
642
3.96875
4
[]
no_license
# Open file --done # Read file (optional: close file) - done # Loop through text using char - done (essentially telling the computer to read each character on the "list") # Convert each char in lowercase - done # Find ordinal value to each char -done # Create list - done # Add counter - done # For every repeated char,...
true
45159e467d5ef9de8d95686d8c7ba09d4d81ae43
SantiagoBlascoArnaiz/Simplex
/algoritmoSímplex.py
UTF-8
18,263
3.40625
3
[]
no_license
# -*- coding:utf-8 -*- import sys from tkinter import * """" Implementation of simplex algorithm by Santiago Blasco Arnaiz """ """ Array containing all the texts printed by the program to facilitate its translation and change. """ texts = ['Las inecuaciones no están escritas correctamente.', 'Fun...
true
06eb1926875659d6281aaa08f6dda95476bf69e3
nik-malnik/Deep-Learning
/707_HW2/rbm.py
UTF-8
3,966
2.75
3
[]
no_license
import model_run import numpy as np import copy import random from matplotlib import pyplot as plt def sigmoid(z): return 1.0/(1.0 + np.exp(-z)) def h_cond_sample(x_sample, W, a, b): p = sigmoid(np.dot(W.T,x_sample) + a) return np.reshape(np.random.binomial(1,p[:,0]), (-1,1)) def x_cond_sample(h_sample, W, a, b):...
true
c4d062ed115c829bcbd97208257e936b09575e00
EmeraldE11/ProgrammingWithFunctions
/week-10/circle.py
UTF-8
1,540
4.125
4
[]
no_license
import math def main(): ## program driver - GOAL: Keep lean ## prompt user for how many circles they have numberOfCircles = integerInput("How many circles are we working with? ") areasList = loopForCircles(numberOfCircles) displayAreas(areasList) integerInput("How many circles are we working with...
true
3ee07fa49245a787d2db0990432d1239363b5dcd
comingboy0701/algorithm-learning
/sklearn/playML/preprocessing.py
UTF-8
696
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jan 21 19:32:40 2019 @author: dell """ import numpy as np class StandarScaler: def __init__(self): self.mean_ = None self.std_ = None def fit(self,X): assert X.ndim == 2 self.mean_ = np.mean(X,axis = 0) self.scale_ = np.std(X...
true
879e41e0e13d82df3cd2a39ed3d1920929c59924
ukchiji/team-project-3-matron
/selenium_test/test_Chrome/test_graph_creation.py
UTF-8
13,815
2.703125
3
[ "MIT" ]
permissive
import unittest, os from time import sleep from selenium import webdriver from testutils import EasyDriver from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys def initial_set_up_map(driver, map_name): driver.get("https://floating-shore-56001.herokuapp.c...
true
60881491faa05b9ccec2089c86ff50f41e10dcf8
leoyzeng/citation-automate
/citation automate/citation automate 2.py
UTF-8
1,951
2.546875
3
[]
no_license
# Generated by Selenium IDE import pytest import time import json from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By from selenium.webdriver.support.expected_conditions import presence_of_element_located from selenium.webdriver.support.wait import WebD...
true
138cd0200f5490bb00d207b41cd52c567a0ec621
Dizzman/BIA_logistic
/gpn_logistic_2.0-cplex_version/data_reader/calc_percent.py
UTF-8
1,983
2.78125
3
[]
no_license
from data_reader.input_data import Parameters # Ф-я возвращает пользователю состояние расчёта в процентах (очень грубая осреднённая оценка) class CalcPercent: def __init__(self): # Примерная продолжительность в сек (по результатам тестов на локальном компе) self._markers = [ 5, # re...
true
bd35c4ebd75f0901e0c2d228d054b8db0654312d
sashgorokhov-forks/stories
/tests/test_failure_reasons.py
UTF-8
23,471
2.59375
3
[ "BSD-2-Clause" ]
permissive
import pytest import examples from stories.exceptions import FailureError, FailureProtocolError def test_reasons_defined_with_list(): """We can use list of strings to define story failure protocol.""" with pytest.raises(FailureError) as exc_info: examples.failure_reasons.SimpleWithList().x() ass...
true
db4bac8d519224517775f39b1ea31dfd836beeaf
Hubertius/Python
/Split names and surnames/Split_names_and_surnames.py
UTF-8
736
3.625
4
[]
no_license
""" Wczytaj zawartość pliku. Następnie do osobnych plików (o nazwach "imiona.txt" i "nazwiska.txt") zapisz osobno imiona i nazwiska. """ list = [] with open("Names_and_surnames.txt","r",encoding = "UTF-8") as file: for line in file: list.append(tuple(line.replace("\n","").split(" "))) file.close() print...
true
5d54200279dea560980f9c555a67394da162d553
kunalbose/TextSummarizer
/textSummarizer.py
UTF-8
4,680
3.46875
3
[]
no_license
# importing libraries from nltk.corpus import stopwords from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize, sent_tokenize import bs4 as BeautifulSoup import urllib.request import streamlit as st def main(): st.title("Simple Text Summarizer") st.subheader("Text Summarizer on the go") ...
true
4795e7804df72bde2099f44b8fde6158fa98c9e0
OhMesch/Algorithm-Problems
/200-Number-of-Islands.py
UTF-8
2,012
3.578125
4
[]
no_license
# Problem: Given a 2D array representing islands and ocean # Return: The number of unique islands class Solution(object): def numIslands(self, grid): """ :type grid: List[List[str]] :rtype: int """ if grid == []: return(0) sol = 0 oceanMap = [[cha...
true
53ee1f80af459709b68c1600c0664b5ec5b855d6
jcornaz/hesso.mpri.sudokuocr
/tools.py
UTF-8
270
2.703125
3
[]
no_license
import os import numpy as np from PIL import Image def list_images(path, extension='.jpg'): return [os.path.join(path, f) for f in os.listdir(path) if f.endswith(extension)] def load_image( im_name ): return np.array( Image.open( im_name ).convert( 'L' ) )
true
17fc6f333fa3a604812cff99714d11c490bf9175
AstroDigital/sat-process
/satprocess/product.py
UTF-8
4,269
3.171875
3
[]
no_license
""" Product classes which represent files on disk and processing required """ import os from gippy import GeoImage from gippy.algorithms import indices from errors import SatProcessError class Product(object): """ A Product is some input (either files, or another series of Products) and some processi...
true
a3b08ae90b42a92b625cf476177a6c6a548a3342
Aurel509/PythonLearning
/scripts/exos/ex5.py
UTF-8
457
4.625
5
[]
no_license
#Initialisation du tableau et de la somme tableau = [] print("Donnez 10 nombres") #Boucle for, on répète 10 fois for i in range(10): #Stockage de la réponse donnée reponse = input() #On change la réponse en nombre décimal valeur = float(reponse) #Ajout de la valeur donnée dans le tableau à l'i...
true
fbc0a5bdf85721bb7c8cca8e5e46941b06b28541
vhs/VHS-LEDWall2
/python/starburst-white.py
UTF-8
1,118
2.703125
3
[]
no_license
## ## Created by Ty Eggen <tycho.eggen@gmail.com> ## import socket import sys import time import random import base64 HOST, PORT = "localhost", 9999 FIXTURES = 768 CHANNELS = (FIXTURES*3) print "FIXTURES:",FIXTURES canvas = [] for c in range(0,CHANNELS): canvas.append( 0 ) sock = socket.socket(socket.AF_INET, soc...
true
26772166743c90cbf9ad9bb19b6270b321144b83
MisterLenivec/studyPython
/different-tasks/duplicates_in_list.py
UTF-8
1,339
4.0625
4
[]
no_license
''' Напишите программу, которая принимает на вход список целых чисел и выводит на экран значения, которые повторяются в нём более одного раза. Формат ввода: Одна строка с целыми числами, разделёнными пробелом. Формат вывода: Строка, содержащая числа, разделённые пробелом. Числа не должны повторяться, порядок вывода м...
true
e0414d2e900c06d1b0427abab5b262010abe56e7
QuietGithubAccount/Raindrops
/raindrops_tests.py
UTF-8
2,132
3.171875
3
[]
no_license
import unittest from raindrops import raindrops class RaindropsTest(unittest.TestCase): #Pling tests def test_value_3(self): self.assertEqual(raindrops(3), "Pling") def test_value_9(self): self.assertEqual(raindrops(9), "Pling") def test_value_12(self): self.assertEq...
true
94b2ed1c9321308a15b06b0081908ec0202e7ed1
zolmoz/python_trening_zolmoz
/model/groupe.py
UTF-8
819
2.90625
3
[ "Apache-2.0" ]
permissive
from sys import maxsize class Groupe: def __init__(self,name=None,header=None,footer=None,id=None): self.name = name self.header = header self.footer = footer self.id = id def __repr__(self): return "%s:%s:%s:%s" % (self.id,self.name,self.header,self.footer) def __...
true
d5709e128aef49285fbf2b89d60625a636cef7e1
KevingyubinHan/Test-1
/credit evaluation_univariate/univariate/calc_variable_statistics.py
UTF-8
4,523
3.046875
3
[]
no_license
import pandas as pd import numpy as np import multiprocessing as mp def calc_variable_stats_func(x_binned_df, variable, y_df, y_column_name): """ :explain: 입력 받은 변수에 대한 statistics 결과를 반환합니다. :param dataframe x_binned_df: coarse classing 완료한 독립변수 데이터 :param string variable: 독립변수명 :param dataframe ...
true
0e5ba8eae43f16f7931f3a7d71977ae5eed0b3bd
sam0790/homework
/week 20/hw/hw.py
UTF-8
764
3.109375
3
[]
no_license
#!/usr/bin/env python import sys import nltk from nltk import tokenize from collections import Counter from nltk.tokenize import wordpunct_tokenize cats_file = open('./cats_txt.txt','r',encoding='utf-8') cats = cats_file.read().replace("\n"," ") cats_file.close() #with cats_file as cats_file: # for line in ...
true
b33185bc07edc2936668a3486bac9d27ddd7e723
adafruit/circuitpython
/tests/cpydiff/core_locals_eval.py
UTF-8
469
3.203125
3
[ "MIT", "GPL-1.0-or-later" ]
permissive
""" categories: Core,Runtime description: Code running in eval() function doesn't have access to local variables cause: MicroPython doesn't maintain symbolic local environment, it is optimized to an array of slots. Thus, local variables can't be accessed by a name. Effectively, ``eval(expr)`` in MicroPython is equivale...
true
be89bdf77535eeb91da1120420bdd3a651f391ed
kanikashridhar/Python_decorators
/simple_decoration.py
UTF-8
807
4
4
[]
no_license
import unittest # Refer https://www.datacamp.com/community/tutorials/decorators-python def uppercase_decorator(function): def wrapper(): func = function() make_uppercase = func.upper() return make_uppercase return wrapper # Using uppercase decorator @uppercase_decorator def say_hi(): return 'hello t...
true
39ad949b34b7c8d31b7cfd7350003f6678a70178
pablodanielrey/hackerone
/encrypted-pastebin/u/print_hash.py
UTF-8
177
2.609375
3
[]
no_license
import sys import binascii import common a = sys.argv[1] with open(a, 'rb') as f: hash_ = f.read() print(binascii.hexlify(hash_)) print(common.b64e(hash_).encode('utf8'))
true
0d4aa5266edc565447cb3714704014d74086a171
Hilgon2/prog
/PE9/PE9_2.py
UTF-8
638
3.390625
3
[]
no_license
import random def monopolyworp(): count = 0 value = False while not value: randomNumber1 = random.randrange(1, 7) randomNumber2 = random.randrange(1, 7) add = randomNumber1 + randomNumber2 if count == 3: print("Derde keer dubbel: naar de gevangenis!") ...
true
1a5e2c77c14f14ec7ed2369a5d75601c64f20a26
xkdgo/py_foundations_and_usage
/3_3_Regular_Expressions/3.14.re.py
UTF-8
627
3.40625
3
[]
no_license
''' Вам дана последовательность строк. В каждой строке поменяйте местами две первых буквы в каждом слове, состоящем хотя бы из двух букв. Буквой считается символ из группы \w. Sample Input: this is a text "this' !is. ?n1ce, Sample Output: htis si a etxt "htis' !si. ?1nce, ''' import sys import re regex = re.compil...
true
c4aca168d26d4272c8f1fd995420b8b043f73b7f
tamimcse/parse-bgpdump
/poptrie-16.py
UTF-8
6,426
2.515625
3
[]
no_license
from socket import inet_pton, AF_INET6 from struct import unpack import socket import struct def ip2int(addr): return struct.unpack("!I", socket.inet_aton(addr))[0] def ip6_to_integer(ip6): ip6 = inet_pton(AF_INET6, ip6) a, b = unpack(">QQ", ip6) return (a << 64) | b filenames = ["routes-293", "rout...
true
b9d970ae6eca505193b5bc3c555ac93fdd68f130
Malvtrics/ML
/tensorlflow/truncated_normal_learn.py
UTF-8
1,123
3.390625
3
[]
no_license
#tf.truncated_normal tf.truncated_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None) #函数的为随机产生大小由shape指定的,均值默认为0,方差默认为1的正太分布, #当产生数值偏离对称轴2个标准差时重新生成随机数, #即产生的随机数x在(mean-2*stddev, mean+2*stddev)之间。 #如果设置随机种子seed,那么相同的种子每次产生的随机数都相同。 #name是操作的名称 #tf.random_normal tf.random_normal(shape, mean=0.0,...
true
68d71161e41c5488d8cdae01ef9cec9d7837b1b0
gschen/where2go-python-test
/1906101001周茂林/第15周/统计全为 1 的正方形子矩阵.py
UTF-8
566
3.3125
3
[]
no_license
''' 给你一个 m * n 的矩阵,矩阵中的元素不是 0 就是 1,请你统计并返回其中完全由 1 组成的 正方形 子矩阵的个数。 示例: 输入:[[0,1,1,1],[1,1,1,1],[0,1,1,1]] 输出:15 解释: 边长为 1 的正方形有 10 个。 边长为 2 的正方形有 4 个。 边长为 3 的正方形有 1 个。 正方形的总数 = 10 + 4 + 1 = 15. ''' import numpy as np mat1 = np.array([[0,1,1,1],[1,1,1,1],[0,1,1,1]]) m, n = mat1.shape N = 0 for i in range(1, min(m, n)+1):...
true
e814b23875dc47270e7a291e3e3ba540bd552d2e
fm4d/python-sqlpuzzle
/tests/queryparts/orderbytest.py
UTF-8
3,766
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- import six import unittest from sqlpuzzle.exceptions import InvalidArgumentException from sqlpuzzle._queryparts import OrderBy class OrderByTest(unittest.TestCase): def setUp(self): self.order_by = OrderBy() class BaseTest(OrderByTest): def test_is_not_set(self): s...
true
97fe13c27e810dee22f4f718e0d3c0fcc69f6bbf
LarryGF/3dJuegos
/cli.py
UTF-8
3,042
2.53125
3
[]
no_license
import os import json import fire import asyncio from game_scraper import Scrapper try: MODULE = os.path.dirname(os.path.realpath(__file__)) except: MODULE = "" BASE_CONFIG = { "base_url": "https://www.3djuegos.com/novedades/juegos-generos/juegos/{}pf0f0f0/juegos-populares/", "thumbnail": False, "...
true
e1ddca2608e00243138f9b07484023aac3a410e3
jipgyo-3jo/project-jipgyo1
/웹 v10.24 98프로/pythonfile.py
UTF-8
2,622
2.625
3
[]
no_license
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler import datetime from dateutil.parser import parse import sys print(sys.argv) inputdate = sys.argv[1] #***************************파일을 읽고, 날짜 column생성********************************* df = pd.read_csv('SeoulGrandParkFinal.csv', engine...
true
0dc02ed8f5d7e3495077cd27386fb3b2c8d2332a
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_118/2350.py
UTF-8
873
3.359375
3
[]
no_license
############# # Google Code Jam 2013 # by Jos Kraaijeveld # @JMKraaijeveld # kaidence.org ############# import sys from math import sqrt, log10 def is_palindrome(num): old = num new = 0 while num > 0: digit = num % 10 new = new * 10 + digit num = num / 10 return new == old # Op...
true