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
82baf84b91c496b38a3994bcac7f0384ccea93af
CongWeilin/DGCN
/layers.py
UTF-8
1,887
2.5625
3
[]
no_license
import torch import torch.nn as nn from initialization_utils import uniform, zeros class GraphConv(nn.Module): def __init__(self, n_in, n_out, bias=False): super(GraphConv, self).__init__() self.n_in = n_in self.n_out = n_out self.linear = nn.Linear(n_in, n_out, bias=bias) ...
true
381b238a6dbbeeb7040614402e08d15f198e4885
chanho0912/AI_Programming
/SimpleCNN/YourAnswer.py
UTF-8
12,162
2.6875
3
[]
no_license
#-*- coding: utf-8 -*- import numpy as np import random from collections import OrderedDict from utils import numerical_gradient import torch.nn as nn def softmax(x): softmax_output = None s = np.max(x, axis=1)[:, np.newaxis] e_x = np.exp(x - s) div = np.sum(e_x, axis=1)[:, np.newaxis] softmax_o...
true
af93bac27fecafbf140e8d7df3c88095cbc2a7a9
kyoungwhankim/Algorithms
/Algorithm_Quizzes/Programmers/코딩테스트 연습(Coding Test Practice Quizzes)/DFS,BFS/여행 경로(Trip Route)/여행 경로(Trip Route).py
UTF-8
1,667
3.359375
3
[]
no_license
def create_travel(travel, tickets): # 각 공항에서 출발하는 티켓의 리스트를 담은 딕셔너리 생성 for element in tickets: if element[0] not in travel: travel[element[0]] = [] travel[element[0]].append(element[1]) for airport in travel.values(): airport.sort() return travel def back...
true
d459c9d9a7d5c080da98a9c25214a6a5676b540e
evidawei/Hacktoberfest2021-2
/Python/calendar.py
UTF-8
133
3.375
3
[ "MIT" ]
permissive
import calendar year =int( input("Enter Year: ")) month = int( input("Enter the month number: ")) print(calendar.month(year,month))
true
f2f75f5853ec1793cb7b966fc4b551a2f2e7c49c
kislak/corsera_data
/assignment3/join.py
UTF-8
900
2.96875
3
[]
no_license
import MapReduce import sys """ Word Count Example in the Simple Python MapReduce Framework """ mr = MapReduce.MapReduce() # ============================= # Do not modify above this line def mapper(record): # key: document identifier # value: document contents table = record[0] order_id = record[1] ...
true
2164e878d6c36f6c26a679a9328fd324bfd010fc
CamiloBallesteros94/reservoirpy
/reservoirpy/welllogspy/tracks/dntrack.py
UTF-8
5,663
2.875
3
[ "MIT" ]
permissive
import matplotlib.pyplot as plt import pandas as pd import numpy as np def dntrack(df: pd.DataFrame, rho: str = None, ntr: str = None, lims: list = None, lime: bool = False, dtick: bool =False, fill: bool =True, fontsize: int=8, ...
true
dbfb3b62b6f83283ff357cece4178d4b148a4cf4
Swizec/Generative-poetry
/old-approach/constants.py
UTF-8
3,755
2.703125
3
[]
no_license
# refenced from http://www.zompist.com/kitlong.html#phono CONSONANTS = {'articulation': ['labial', # lips (w), lips + teeth (f) 'dental', # teeth (th, French or Spanish t) 'alveolar', # behind the teeth (s, English t, Spanish r) ...
true
7b136a9c7db9329ff6b332542b0dccfa86959c1a
HananBahy/pac-man-game
/funcs.py
UTF-8
10,121
2.71875
3
[]
no_license
from math import * from OpenGL.GL import * from OpenGL.GLU import * from OpenGL.GLUT import * from time import sleep import random import sys from sound import * import pygame def rect(tex_id, xo, yo, xf, yf): #used to wrap monsters on quad glBindTexture(GL_TEXTURE_2D, tex_id) #used to wr...
true
aaf466ff814e47e760b77dbbd8162a4bbb956703
akegalj/algorithms_playground
/codility/FrogRiverOne.py
UTF-8
236
2.671875
3
[]
no_license
def solution(X, A): # write your code in Python 2.7 bucket = set() for x in xrange(len(A)): bucket.add(A[x]) if len(bucket) == X and min(bucket) == 1 and max(bucket) == X: return x return -1
true
d582a196033b902e7b048e3c6295a9cb584d0330
yuvalsolaz/image-embedding
/src/create-dataset.py
UTF-8
870
2.859375
3
[]
no_license
import os, sys from pathlib import Path from icrawler.builtin import BaiduImageCrawler, GoogleImageCrawler, BingImageCrawler def start_crawler(path:Path, search_text, num_images): crawler = BaiduImageCrawler( feeder_threads=2, parser_threads=2, downloader_threads=4, ...
true
52e00ad4297753a739e86f47db389c6814c78ca5
arosRodrigo/Devops
/Python/para_Zumbis/exec2-Telefonia Tchau.py
UTF-8
1,056
3.921875
4
[]
no_license
''' Problema Abaixo de 200 minutos, a empresa cobra 0,20. Entre 200 e 400 minutos, o preço é 0,18 acima de 400, o preço é 0,15 Calcule a conta de telefone Obs.: se mais que 800, cobrar 0.08 ''' ''' #alternativa de solução 1 minutos = int(input('Quantos minutos foram utilizados?')) if minutos < 20...
true
509b937c49b050aae3a6b0af178ac7d464ed784e
Bharti20/python_if-else
/if-else.py
UTF-8
179
3.125
3
[]
no_license
num=int(input()) if num<10: print("10 se chhota hai") elif num>10 and num<20: print("20 se chota hai") elif num>20: print("20 se chota hai") else: print("invalid")
true
5db61535f55080dc28281dbb9f993391f3b6d253
MaciejSiara/simple-yaml-validator
/validator.py
UTF-8
257
2.515625
3
[]
no_license
from scanner import * from parser import * #input_string = ''' #x := 5; #y := x; #PRINT 64; #''' input_string = ''' version: "3.9" ''' print input_string scanner = Scanner(input_string) print(scanner.tokens) parser = Parser(scanner) parser.start()
true
cc31764f1e0dfb16bbb8e52032d7540f6fe32369
mcalleromero/webminery_project
/crawler/viralstories_crawler.py
UTF-8
2,433
3
3
[]
no_license
import urllib.robotparser import time import scrapy class ViralStoriesSpider(scrapy.Spider): """ViralStories crawler created to extract news titles """ name = 'ViralStoriesSpider' starting_url_ = "http://viralstories.in/" sections_ = [] dict_ = {} dict_text_ = {} visited_ = set() d...
true
84ca7b28208325d264246da7a5632b3af05bddf2
tangxu1995/ProxyPool
/Proxy/ProxyCrawler.py
UTF-8
3,596
2.515625
3
[]
no_license
# ProxyPool/Proxy/ProxyCrawler.py import re from lxml import etree from Util.WebRequest import web_request __author__ = 'tangxu' class ProxyMetaclass(type): def __new__(cls, name, bases, attrs): count = 0 attrs['__CrawlFunc__'] = [] for k, v in attrs.items(): if 'Proxy_' in k:...
true
fe9635a25cae5963c76a7606fd93a3a3144742d0
Akasurde/Algorithms
/Binary Tree/connect_nodes_extending_level_order_traversal.py
UTF-8
1,423
3.90625
4
[]
no_license
# -*- coding: UTF-8 -*- # Connect nodes at same level, extending level order traversal import binary_tree class Node(object): def __init__(self, data=None, left=None, right=None, nextRight=None): self.data = data self.left = left self.right = right self.nextRight = nextRight class Queue_Node(object): def ...
true
5d5ea042aaccf17df79bf4368b0efbdfdc38a895
hmallen/gpsdataparser
/python/GPS_DataParser_Synchronous_INPUTTEST.py
UTF-8
2,606
3.265625
3
[]
no_license
""" GPS Log Parser """ import serial import time from time import strftime, localtime def parseLog(): gpsDataType = gpsDataSelect() if gpsDataType == 1: gpsNameTag = '-GPGGA' elif gpsDataType == 2: gpsNameTag = '-GPRMC' addr = '/dev/ttyACM0' baud = 57600 fname = 'logs/GPS...
true
226e8ebf0b9c6d805bd20c9b716e4aa606f63369
rgliuca/NBA-stats
/NBA_stats_Lab1_solution.py
UTF-8
1,149
3.359375
3
[]
no_license
import json with open('nba-teams-better-pretty.json','r') as json_file: team_stats=json.load(json_file) with open('nba-players-better-pretty.json','r') as json_file: player_stats = json.loads(json_file) info={ 'PTS':'Top 3 Scoring Teams:', # category:message 'FG_PCT':'Top 3 Goal Perc...
true
ae0c2a383d05d3be4be6bbe3aac9a702b9320455
RLesser/nimsum
/nimsum.py
UTF-8
2,537
3.765625
4
[]
no_license
#!/usr/bin/python ''' Rules of Nim Sum Set of objects, of a set amount of colors 2 player game players take turns taking as many objects as they want all of one color goal is to be the last one to pick up ''' import random import players from game import Game def retrieveColorDict(autoRandom = False): colorDic...
true
6e0c958131be1ab6e3d8d41d4c11af216b320dee
zizudana/python-BOJ
/300/1676.py
UTF-8
191
3.078125
3
[]
no_license
n = int(input()) result = 1 if n > 0: for i in range(1,n+1): result *= i st = list(map(int, reversed(str(result)))) num = 0 for i in st: if i != 0: break num += 1 print(num)
true
2441a7f98d281299e35527d79cae38394b39a766
IdoSpringer/TCR-PEP-Classification
/random_peptide_sampling/main.py
UTF-8
8,363
2.515625
3
[ "MIT" ]
permissive
import cProfile, pstats from random_peptide_sampling.train_lstm import * from random_peptide_sampling.models import * from random_peptide_sampling import handle_data as hd from random_peptide_sampling.handle_params import arguments # TODO: shugay data runs # TODO: confusion matrix def main(): """ num_lstm: ...
true
1c0d8cc4212c410d1f3f0ea92f0ae0be87b5c188
ranadheer314/Machine-Learning
/CSS559Assignment3/Perceptron.py
UTF-8
1,934
3.15625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[59]: import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # ![image.png](attachment:image.png) # In[116]: #store all the arrays in the numpy array X_init=np.array([[2,1,1,-1,0,2],[1,0,0,1,2,0],[2,-1,-1,1,1,0],[1,4,0,1,2,1],[1,-1,...
true
b40b8f633b4f9dde2537dfe9deb6480e6ef125c4
luozj1020/Decision-Tree
/决策树ver2/CreateDecisionTreeO.py
UTF-8
1,643
3.296875
3
[]
no_license
def create_decision_tree(data, attributes, target_attr, fitness_func,call_count): call_count += 1 print("call_count:", call_count) data = data[:] vals = [record[target_attr] for record in data] default = majority_value(data, target_attr) # If the dataset is empty or the attributes li...
true
112c4f98c54a1806f20637700e9c610bbdbaff9c
kayodeomotoye/Code_Snippets
/movie_budget.py
UTF-8
1,604
3.296875
3
[]
no_license
from datetime import date from operator import attrgetter from typing import Dict, Sequence, NamedTuple, Counter class MovieRented(NamedTuple): title: str price: int date: date RentingHistory = Sequence[MovieRented] STREAMING_COST_PER_MONTH = 12 STREAM, RENT = 'stream', 'rent' def rent_or_stream( ...
true
6e979a1e583f83350bf3fc1489106ded10a7e13e
pranaymarella/Halo-Code-Challenge
/views.py
UTF-8
9,085
2.515625
3
[ "MIT" ]
permissive
import json import string import random import os import httplib2 import requests # Flask Imports from flask import Flask, render_template, request, redirect, url_for, jsonify from flask import abort, g, flash, Response, make_response from flask import session as login_session from flask_httpauth import HTTPBasicAuth ...
true
d1a18003ae0a0697d417fd9bcd5b34e7865be287
xuzhenkang/Probabilistic-Matrix-Factorization
/pmf/Probabilistic-Matrix-Factorization.py
UTF-8
11,154
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from numpy import linalg as LA from numpy import * from loadData import load_rating_data, spilt_rating_dat from writeResult import write_data, write_pred_data class PMF(object): def __init__(self, num_feat=10, epsilon=1, _lambda=0....
true
68c9c8f483db0436c2ee2e6f659a4de0673d4b9c
NatalieIsupova/ftyers.github.io
/2018-komp-ling/practicals/unigram_pos_tagger_fourth_practical/wiktionary.py
UTF-8
1,285
2.765625
3
[]
no_license
import sys def strip_html(h): o = '' inTag = False for c in h: if c == '<': inTag = True continue if c == '>': inTag = False continue if not inTag: ...
true
ac938332f5a9975279015b521ca776b25a66b9e9
anjalirai13/Python
/pythonDataTypes.py
UTF-8
835
3.921875
4
[]
no_license
# Python Data types num = 100 print "num is ", num, "and type is ", type(num), "is it int", type(num) is int welcomeStr = "Hello Python" print "str is ", welcomeStr, "and type is ", type(welcomeStr) sampleList = ['abcd', 786, 2.23, 'john', 70.2] print "list is ", sampleList, "and type is ", type(sampleList) sample...
true
626fe287f8468e3717e162b0d3998b632b7dd289
MikePeri/DoS---Lab
/Attack(Scapy).py
UTF-8
1,069
2.5625
3
[]
no_license
#!/usr/local/bin/python3.8 from scapy.layers.inet import IP, TCP from scapy.sendrecv import send import time import random from ipaddress import IPv4Address def random_ip_address(): bits = random.getrandbits(32) # generates an integer with 32 random bits addr = IPv4Address(bits) # instances ...
true
eba0af11db2db8f8db7043afd877c6237d3bfd6b
ancte0721/sdk-python
/tests/test/BasicNetworkTest.py
UTF-8
1,672
2.59375
3
[]
no_license
from abc import abstractmethod class NetworkTestDescriptor: def __init__( self, network_class, deterministic_public_key, expected_mainnet_address_network_pair, expected_testnet_address_network_pair): # pylint: disable=too-many-function-args ...
true
76a0c7fce92b9cf25699ec45b7779b435f394b6e
AdrianAlbrecht/WD
/Kolos_nr_1/z8.py
UTF-8
406
3.28125
3
[]
no_license
#ściezka jakiej musiałem użyć do pliku, aby mi zadziałało: './Kolos_nr_1/z8.txt' def z8(): plik=open('z8.txt','r') imiona={} for line in plik: li=line.split("\n") if li[0] in imiona.keys(): imiona[str(li[0])]+=1 else: imiona[str(li[0])]=1 for key,value in ...
true
e9ca7df65cb0851299848523b7b26264778f8963
isharajan/my_python_program
/sqrofary.py
UTF-8
326
3.828125
4
[]
no_license
#Given an array of integers A sorted in non-decreasing order, # return an array of the squares of each number, also in sorted non-decreasing order. def sqrofno(n): return n*n def sqrarr(a): sqrl =[] for n in a: res = sqrofno(n) sqrl.append(res) return sorted(sqrl) a =[-4,-1,0,3,10] output = sqrarr(a) print(o...
true
6e2813d8cb6233323fc1fbc571e7537d78728e50
Bharathkumar-nb/Poco-Localization
/poco/main/media/course_1/module_8/assessmentFiles/challenge_8.py
UTF-8
2,295
3.15625
3
[]
no_license
#Module 5 #Challenge 8 ''' wrangled_loan_status_column = [1 if row['Loan_Status'] == 'Y' else 0 for row in loan_table] {'Property_Area': 'Urban', 'Loan_ID': 'LP001002', 'CoapplicantIncome': '0', 'LoanAmount': '', 'Self_Employed': 'No', 'Married': 'No', 'ApplicantIncome': '5849', 'Loan_Amount_Term': '360', 'Gender...
true
c7ceed0d04a26d94366ac3a01e41c5e3c002df05
victorygod/FasterRCNN
/roi_pooling.py
UTF-8
743
2.515625
3
[]
no_license
import tensorflow as tf import numpy as np def Roi_pooling(input_tensor, output_shape = [4, 4]): shape = tf.shape(input_tensor) box = tf.cast([[0, 0, 1, 1],[0.5,0.5,1,1]], tf.float32) return tf.image.crop_and_resize(input_tensor, boxes = box, box_ind = [0, 0], crop_size = output_shape, method="bilinear") input_te...
true
f1d1b9b5904f9a1b773e2ad47141e29281aafd1e
alvaroolt/Examen-Abril
/examenSegundoTrimestrePython/Rectangulo.py
UTF-8
1,956
4.1875
4
[]
no_license
# -*- coding: utf-8 -*- ''' Created on 5 abr. 2019 Crea la clase Rectángulo de forma que: • Un objeto de esta clase se construye pasándole el ancho y el alto. Ninguno de los dos atributos puede ser menor o igual a cero ni mayor que diez, en esos casos se debe lanzar la excepción ArithmeticException. • Mediante g...
true
ec17e6358cdb93fff1425f05b72e09da9f5215e6
pei223/auto_apidoc_gen
/app/utils/pyyaml_util.py
UTF-8
777
2.703125
3
[]
no_license
from collections import OrderedDict from typing import Dict import yaml import codecs def _adjust_ordereddict_to_yaml(): def represent_odict(dumper, instance): return dumper.represent_mapping("tag:yaml.org,2002:map", instance.items()) yaml.Dumper.ignore_aliases = lambda *args: True yaml.add_repr...
true
e99869def1c4148ae4ffd3f7f54ba2dab084261d
psj8532/problem_solving
/BOJ/기타/게임1072.py
UTF-8
553
3.109375
3
[]
no_license
import math def solution(total, win, pov): answer = max_game = 10000000000 left, right = 1, max_game while left <= right: mid = (left + right) // 2 curr_pov = math.floor((win + mid) * 100 // (total + mid)) if curr_pov == pov: left = mid + 1 else: ans...
true
c07a147f1c164169c0bfe00963abb40d07c68167
Sophia-Baker/TV-Shows-Deployment
/shows_app/models.py
UTF-8
3,418
2.671875
3
[]
no_license
from django.db import models import re import bcrypt # Create your models here. class UserManager(models.Manager): def validate(self, postData): errors = {} if len(postData['first_name']) < 3: errors['first_name'] = 'First Name must be at least 2 characters' if len(postData['las...
true
5d3517020c54480bd9622f7d8606d0444fac88bb
maria-myrto/inference-aggregated
/deriv_LV2.py
UTF-8
960
2.8125
3
[]
no_license
#============================================================================== # returns derivative of aggregate LV (KF2) system for use in the ode solver # inputs # y: matrix of the elements of the system # t: time points # c: matrix of parameters #=====================================================================...
true
34a7b3e9670741ed246e046c5309feb50e8762f1
tristan-gueguen/python-chess
/test_invalid_move_check.py
UTF-8
291
2.828125
3
[]
no_license
from board import main def test_cant_move_if_check(): b = main.Board() b.add_piece('k', 'd4', is_white=True) b.add_piece('p', 'c5', is_white=True) b.add_piece('b', 'b6', is_white=False) moves = [m.to_string() for m in b.get_possible_moves()] assert 'c6' not in moves
true
3966b9794ef425cdb8cccfcf5caa132d5a13b2db
umfranzw/multicellular-grn
/vis/ColourPicker.py
UTF-8
1,014
2.65625
3
[]
no_license
from PySide2.QtWidgets import * from PySide2.QtGui import * from PySide2.QtCore import * class ColourPicker(): kelly_colour_vals = (0x222222, 0xf3c300, 0x875692, 0xf38400, 0xa1caf1, 0xbe0032, 0xc2b280, 0x848482, 0x008856, 0xe68fac, 0x0067a5, 0xf99379, 0x604e97, 0xf6a600, 0xb3446c, 0xdcd300, 0x882d17, 0x8db600, 0x6...
true
4b3db5b2652c8a355144a50ed32f613952315859
shreyasnbhat/video-summarizer
/generateImage.py
UTF-8
3,092
2.640625
3
[]
no_license
import pandas as pd import cv2 import numpy as np from pyCAIR import cropByColumn import sys import os from collections import defaultdict from .metadata import * METADATA_FILE = "metadata.csv" META_MAP = defaultdict(list) # Stores Metadata of First Frame of each scene def processVideoMetaData(metapath, videoSourceP...
true
7d019a01de3c09e54055c2ffbaf683b3e21b36ac
chubkey3/DMOJ
/ccc11j5.py
UTF-8
907
3.265625
3
[]
no_license
from itertools import combinations def search(friend, d): #print(friend, d) return d[friend] def get_combs(k): a = [x for x in range(1, k+1)] b = [] for x in range(2, k+1): b += list(map(list, list(combinations(a, x)))) return b n = int(input()) friends = {} for x...
true
9df0da1867495c1c73b9a8818bdfb5d91129016d
Pushan-Gore/Game-Server
/server.py
UTF-8
4,322
3.328125
3
[]
no_license
import random from collections import deque from twisted.python import log from twisted.internet import protocol from twisted.application import service from twisted.protocols import basic from protocol import JsonReceiver from game import Game, GameError import simplejson as json class GameProtocol(JsonReceiver): ...
true
d40125150c557b7b076454a64708be7bfb7b08bc
Justin-Teng/HackerRank
/Algorithms/Sorting/Easy/quicksort1.py
UTF-8
657
3.09375
3
[ "MIT" ]
permissive
#!/bin/python3 import math import os import random import re import sys # Complete the quickSort function below. def quickSort(arr): pivot = arr[0] left = [] middle = [] right = [] for x in arr: if x < pivot: left.append(x) elif x == pivot: middle.append(x) ...
true
f6b30f347a7202394ad12f4cc7fc18fda1cf8855
PAYNE1Z/python-learn
/luffycity-s8/第三模块_面向对象_网络编程基础/面向对象/18_自定义元类控制类的实例化行的应用.py
UTF-8
1,674
3.765625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # Author: Payne Zheng <zzuai520@live.com> # Date: 2019/6/6 # Location: DongGuang # Desc: do the right thing # 实现单例模式(相同特性的对象只创建一个) # 方式一:类中定义方法 class MySQL: __instance = None def __init__(self): self.host = 'localhost' self.port = 330...
true
fdb61c25a52571a4a4468f02907af3a66afb76e9
rajatgirotra/study
/pythonTutorial/drf_tutorial/snippets/mixins.py
UTF-8
1,105
2.5625
3
[]
no_license
from django.http import JsonResponse from django.views.generic import ListView from .serializers import Snippet, SnippetSerializer class JSonResponseMixin(object): """ A mixin that can be used to render Json responses. """ def render_to_json_response(self, context, **response_kwargs): """ Convert con...
true
e709ef7f418d7af581872cc4a758ae1b24e71ccb
KhotynyukSergey/itechart
/homework1.py
UTF-8
2,053
3.84375
4
[]
no_license
'''#task1 n = int(input()) count = 0 for i in range(1,n+1): for j in range(0,i): if count<n: print(i) count+=1 ''' '''#task2 n = int(input("Введите количество элементов списка: ")) lst=[] while n: lst.append(int(input())) n-=1 print("Список состоит из чисел : " + str(lst)...
true
f9a3476cc8bf8048e3da96b131b6944b122890a4
igimot/learning
/Python/1w/14.py
UTF-8
73
3.28125
3
[]
no_license
inputNumb = int(input()) outputNumb = 1 - inputNumb print(outputNumb)
true
120ffc547bf7286b1b0a9918a18b6cd0ba4cdff4
Aasthaengg/IBMdataset
/Python_codes/p03331/s658058420.py
UTF-8
239
3.15625
3
[]
no_license
n = int(input()) sum = float('inf') for i in range(1, n): k = 0 for j in range(len(str(i))): k += float(str(i)[j]) for l in range(len(str(n-i))): k += float(str(n-i)[l]) sum = min(sum, k) print(int(sum))
true
8d45bad78694a056e637ea73bd8fb32ea16e847c
rok-strongo/python0104
/homework5.py
UTF-8
1,095
3.171875
3
[]
no_license
user_input_1=int(input("input first num:")) user_input_2=int(input("input second num:")) user_input_3=int(input("input third num:")) user_input_4=int(input("input fourth num:")) if user_input_1%2!=0 and user_input_2%2!=0 and user_input_3%2!=0 and user_input_4%2!=0: print('not found') else: while max(user_input...
true
bfd578ea993e0a416b93f1ef896e2aec90dc0de7
tifv/jeolm
/source/jeolm/utils/ordering.py
UTF-8
1,867
2.875
3
[]
no_license
import re from collections import OrderedDict import logging logger = logging.getLogger(__name__) from typing import ( TypeVar, Any, Callable, Sequence, Mapping, List, Tuple, Pattern, ) V = TypeVar('V') KeyFunc = Callable[[str], Any] def natural_keyfunc( string: str, *, _digit_regex: Pattern = re.compil...
true
fd94936a442c9fa56604781bef923436f5e2ed8a
mytarget-test-team/seismograph
/seismograph/ext/builder/signature.py
UTF-8
828
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- from ...utils import pyv from .exceptions import ConfigurationError class Signature(object): def __init__(self, *args, **kwargs): self.args = args self.kwargs = kwargs def create_signatures(option_value): def create_signature(v): if isinstance(v, Signature):...
true
a503ce94cbec93bbb373a001028f2cd9e71f7bb4
anvesh-vankayala/Data-Structures-and-Algorithms
/RangeQuery/2-D/RangeSum3.py
UTF-8
6,582
3.40625
3
[]
no_license
# -*- coding: utf-8 -*- """ using data structure quad tree @author: Anvesh """ class Range: def __init__(self,i1,j1,i2,j2): self.i1 =i1 self.j1 =j1 self.i2 =i2 self.j2 =j2 class TreeNode: def __init__(self,i1,j1,i2,j2,val): ...
true
138b4cc4ea76b7d5469355cfbc8bee4144542450
DarKovPl/learning-python-intermediate-level
/07_ErrorHandling/126_MultipleErrorsHandle.py
UTF-8
2,432
2.953125
3
[]
no_license
import requests import os import shutil # clients = { # "INFO": 0.5, # "DATA": 0.2, # "SOFT": 0.2, # "INTER": 0.1, # "OMEGA": 0.0 # } # # my_client = input("Enter client's name: ").upper() # total_cost = 7200 # # try: # ratio = float(input('Enter new ratio: ')) # print(f'The default % ratio...
true
2daa5abbd1c232396dd16c5d97c8eecaa63cd174
ggreviews/labtech
/codility_solutions/countingelements.frogriverone.py
UTF-8
499
3.046875
3
[]
no_license
def solution(X, A): solution_dict = {} current_time = -1 if len(A) == 1: if A[0] == 1: return 0 else: return -1 for i in range(0, len(A)): #print("{i} is {item}".format(i=i,item=A[i])) if A[i] <= X: solution_dict[A[i]] = 1 ...
true
4194435e510660c769443c93165f5d0f752730a3
airaider/python_algo_study
/level 2/조이스틱.py
UTF-8
909
3.015625
3
[]
no_license
def solution(name): answer = 0 limit = len(name) visit=[0]*limit for i in range(limit): dis = min(ord(name[i])-ord('A'), ord('Z')-ord(name[i])+1) visit[i]=dis print(visit) cur = 0 lc = rc = cur answer=visit[0] visit[0]=0 while sum(visit)!=0: cnt=0 ...
true
57fbe2e294732ab15a2aaa9e20fa45d172f77354
hanv698/PythonDjangoLuminar
/kwargs/nested_dict/student.py
UTF-8
517
3.28125
3
[]
no_license
f=open("student","r") students={} for lines in f: id,name,total,course=lines.rstrip("\n").split(",") if id not in students: students[id]={"id":id,"name":name,"total":total,"course":course} def print_data(**kwargs): #print(kwargs) id=kwargs["id"] if id in students: print(students[...
true
63a86f4a383ab16d734ac914bbc5ad003927964a
Tusharr08/codechef-problems
/yet-another-mex.py
UTF-8
1,038
3.453125
3
[]
no_license
try: t=int(input()) def displaysublist(A): # store all the sublists B = [[ ]] # first loop for i in range(len(A) + 1): # second loop for j in range(i + 1, len(A) + 1): # slice the subarray ...
true
6bfc16f264e63a5a4c65083582c1919bed3054a7
nuthanmr/Python-Projects
/main_tree.py
UTF-8
447
3.5
4
[]
no_license
from tree import Tree employee_password={} password=100 print("Welcome To Tree Census Committee") while True: print("Hey!What Would You Like To Do?\n\n\ 1.Add Employees\n\ 2.Create Password\n\ 3.Reset Password\n\ 4.Exit\n") choice=int(input("Enter Your Choice:")) if choice==1: employee_name=input("Ente...
true
4ed2ce28a9bb5119236de15ae5d8be296ff87b04
j-lazo/lumen_segmentation
/models/Unet_based/Unet.py
UTF-8
2,359
2.703125
3
[ "CC0-1.0" ]
permissive
from tensorflow.keras.layers import * import tensorflow as tf from tensorflow.keras.models import Model def conv_block(tensor, nfilters, size=3, padding='same', initializer="he_normal"): x = Conv2D(filters=nfilters, kernel_size=(size, size), padding=padding, kernel_initializer=initializer)(tensor) x = BatchNo...
true
13f400f846e9b814526a5984a20e98266043a7a1
whatsupinternet/mind_trash
/parser.py
UTF-8
423
2.546875
3
[]
no_license
import urllib2 import re import codecs from bs4 import BeautifulSoup outputfile = codecs.open("output.txt", "w", "utf-8") inputfile = codecs.open("big.html", "r", "utf-8") soup = BeautifulSoup(inputfile) soup.encode('utf-8') paragraphs = soup.find_all('span') for p in paragraphs: if p.string != 'None' and p.string...
true
34f7f55568fb76043866f64b2a07cf0530bb0fcb
DiksonSantos/Curso_Do_Guanabara
/035_Analisando_Triangulo.py
UTF-8
359
3.65625
4
[]
no_license
comp = float(input('Insira o Segmento A:')) comp_2 = float(input('Insira o Segmento B:')) comp_3 = float(input('Insira o Segmento C:')) if comp < comp_2 + comp_3 and comp_2 < comp + comp_3 and comp_3 < comp + comp_2: print('Os Segmentos Acima Podem Formar Um Triangulo!') else: print('Os Segmentos Apresent...
true
84e2f633b80d4e3ee0573750fa12c64560d404af
relevance-estimation/rel_est
/relevant_moment_result.py
UTF-8
3,125
2.59375
3
[]
no_license
import sys from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * class App(QMainWindow): def __init__(self): super().__init__() self.title = 'Редактирование рекламы' self.left = 0 self.top = 0 self.width = 840 self.height = 680 ...
true
7faee107869c5dde544a22d0a23c70bb8e012f8b
Delphik/pytut
/pytut_4_lists_sets_tuples.py
UTF-8
1,758
3.90625
4
[]
no_license
# @author Delphik # https://www.youtube.com/watch?v=W8KRzm-HUcc courses = ['History', 'Math', 'Physics', 'Comp-Sci'] courses_2 = ['Art', 'Education'] nums = [1, 5, 2, 4, 3] print(courses) print(len(courses)) print(courses[3]) print(courses[-1]) print(courses[0:2]) print(courses[2:]) courses.append('Art') print(cour...
true
013f3de7d86bd7c9b2d8cdf67d13e603d5752951
nirajkale/pynetwork
/pynetwork/backend.py
UTF-8
6,005
2.765625
3
[ "Apache-2.0" ]
permissive
import socket import json import re import threading extract_re = lambda r,s: re.search(r,s).group() str_to_bytes = lambda message: message.encode(encoding = 'utf-8') bytes_to_str = lambda _bytes: _bytes.decode("utf-8") default_chunk_size = 8* 1024 def int_to_bytes(i: int, header_size:int = 8) -> bytes: return...
true
8cc0a9e2bf4a7fbbffac55a232aff3104291b7fc
jwarndt/uspy
/uspy/sampling/create_image_chips_from_points.py
UTF-8
17,996
2.671875
3
[ "MIT" ]
permissive
import random import os import argparse import time import numpy as np from osgeo import ogr from osgeo import osr from osgeo import gdal """ Script for generating image chips centered on random points that fall within the input shapefile's features. In this case, the image chips do not neccessarily fall ...
true
263803da2148752e7b3e95fb5cfd8cf19e2f68f6
molker/python-class
/udemy/ztm-python-course/basics/tricky-counter.py
UTF-8
160
4.09375
4
[]
no_license
# counter # exercise: loop through the list and print the total sum my_list = [1,2,3,4,5,6,7,8,9,10] total = 0 for num in my_list: total += num print(total)
true
2d465c6842840d76d56bb0da47d35b89edbea901
opendata-heilbronn/daten-stadt-heilbronn
/abfahrtszeiten_check/extractor.py
UTF-8
2,757
2.84375
3
[ "CC-BY-4.0" ]
permissive
import io import re from pdfminer.converter import TextConverter from pdfminer.pdfinterp import PDFPageInterpreter from pdfminer.pdfinterp import PDFResourceManager from pdfminer.pdfpage import PDFPage import urllib.request def controller(): # seem to be the most important lines lines = [1,5,8,10,11,12,13...
true
06300a7eb48ba5c6d0df6b7c4944d4947edf3578
creamk87/test_develop
/second_python/oo_work1.py
UTF-8
1,720
3.109375
3
[]
no_license
#!/Library/Frameworks/Python.framework/Versions/3.7/bin python3 """ __project_ = 'Test_Develop' __file_name__ = 'oo_work1' __author__ = 'creamk' __time__ = '2020/8/8 21:44' __product_name = PyCharm # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ...
true
d61f28e24f7633c189e937fdaa4cdacb6aa693dd
KshitizSethia/AcroDisam
/server/AcronymExpanders/Expander_LDA_cossim.py
UTF-8
2,424
2.703125
3
[]
no_license
from gensim.matutils import cossim from AcronymExpanders import AcronymExpanderEnum from AcronymExpanders.AcronymExpander import PredictiveExpander import TextTools from string_constants import min_confidence class Expander_LDA_cossim(PredictiveExpander): """ Expand acronyms based on their cosine similarity ...
true
a9af9b1b394543f8f1d96ef746a44f80ea062ac1
RagenPatel/Python-Tests
/random.py
UTF-8
281
3.375
3
[]
no_license
import random for i in range(5,0,-1): print(random.randint(1,10)) print("i val : "+str(i)) import sys while not False: print("Type exit to quit.") response = input() if response == "exit": sys.exit() print('You typed ' + response + ".")
true
d32fb685c617d5f2d260d0c6d25c965cc3a3b645
pr1s0n/learn_python3
/5st_day/func_ab.py
UTF-8
514
3.703125
4
[]
no_license
def functionA(fn): print('A') fn() return 'fkit' @functionA ''' 即functionA修饰B,程序将会完成两步操作: 1.将functionB作为functionA的参数,也即是此时functionB = fn,执行functionA时 fn()=>functionB(),输出"B"。 2.将functionB替换成functionA()执行后的结果,即functionA()的返回值'fkit' 整个流程为:先输出functionA()的第一个A,然后是fn()输出B,接着是functionB()打印返回值fkit ''' def f...
true
db3060979cbb69bb9781724b4da6cb7d3eb23f27
mateusrmoreira/Curso-EM-Video
/desafios/desafio56.py
UTF-8
727
4.03125
4
[]
no_license
""" Desenvolva um programa que peça nome, idade e sexo de quatro pessoas e no final mostre: A média de idade O nome do homem mais velho e quantas mulheres tem menos de 21 anos """ homem = '' mulher = 0 media = 0 maior = 0 for i in range(0,4): nome = input('Qual é o seu nome? ') idade = int(input('Digite...
true
97de76858053f911d33aea58b24d6bb9fc2083a3
Mayankjha997/Compress_decompress
/compress_decompress/encrypt_decrypt.py
UTF-8
4,668
3.125
3
[]
no_license
import heapq import os class binarytreenode: def __init__(self,value,freq): self.value = value self.freq = freq self.left = None self.right = None def __lt__(self, other): return self.freq < other.freq def __eq__(self, other): return self.freq == other.freq ...
true
87fba2b5767d3c3dee0d5f4fa23d8645ad73e78c
machine-learning-2018-2019-fasilkom-ui/Unnamed00
/PCA.py
UTF-8
2,513
3.265625
3
[]
no_license
import functools as ftools import numpy as np import pandas as pd class PCA: def __init__(self, verbose=True): self.data = None self.threshold = 0.95 self.verbose = verbose def calculate_mean(self, arr): return ftools.reduce(lambda x,y: x+y, arr)/len(arr) def calculate_cen...
true
e2ee17169e284b755ab733a5b31ec9fed7dce596
FauxFaux/observatory
/scan/NMapOutputToList.py
UTF-8
882
2.84375
3
[]
no_license
import os, sys """Called by control script, passed in the grepable nmap results, which it crudely hacks into a file called IPList, and sends over to the cert grabber.""" def getOpen(filename): res = [] f = open(filename, 'r') for line in f.readlines(): if "open" in line: res.append(line[lin...
true
fb974831c4a1c42e5d6bc1e3fad6acf55a6e46c8
Aasthaengg/IBMdataset
/Python_codes/p02678/s222801862.py
UTF-8
580
2.828125
3
[]
no_license
import copy N, M = map(int, input().split()) res = [[] for i in range(N+5)] for i in range(M) : a,b = map(int, input().split()) a -= 1 b -= 1 res[a].append(b) res[b].append(a) pre = [-1] * N dist = [-1] * N d = 1 dl = [] pre[0] = 0 dist[0] = 0 dl.append(0) while(len(dl) != 0) : a = dl[0]...
true
027fbb93a31ce5eed9d5ea43910a38359cd4c638
python-yc/pycharm_script
/requests模块/4.3、响应response之解析json.py
UTF-8
225
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- import requests import json rsp = requests.get('http://httpbin.org/get') res1 = json.loads(rsp.text) # 太麻烦 res2 = rsp.json() # 直接获取json数据 print(res1 == res2) # True print(res2)
true
747891a324c7ac2010c46b2619ffa0bbadd1baff
denzelb5/Python-exercises
/pizza slicing.py
UTF-8
232
3
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 24 15:44:08 2019 @author: denisebaker """ pizzas = ['mushroom', 'hawaiian', 'pepperoni', 'sausage', 'cheese'] new_pizzas =pizzas.append('ham') print(new_pizzas)
true
74b41295c40a50034da12b8ba8b786160c7e09f1
larrydarrelc-archive/boat
/backend/message.py
UTF-8
291
2.53125
3
[]
no_license
#coding: utf-8 EVENT_SEPARATOR = ':' FRAME_END = '\n' def serialize(event_name, event_data): return '%s%s%s%s' % (event_name, EVENT_SEPARATOR, event_data, FRAME_END) def parse(raw): raw = raw.strip(FRAME_END) event = raw.split(':') return event[0], ':'.join(event[1:])
true
c0a72957d0fca5a721dc8382ac383c69d78bca4e
Aakaash897/ML-Algorithms-for-Classification
/Code/naiveBayes.py
UTF-8
1,928
2.609375
3
[]
no_license
from sklearn import metrics from sklearn.naive_bayes import BernoulliNB from sklearn.externals import joblib from scipy.stats import randint import pandas as pd #Code for Dataset - 1 dataset = pd.read_csv("ds1Train.csv",header=None) valset = pd.read_csv("ds1Val.csv",header=None) testset = pd.read_csv("ds1...
true
bd0b23ad722ba6d54e21e97c86d4fc10799ff37c
kevrodg/lpthw
/ex4b.py
UTF-8
159
3.8125
4
[]
no_license
_salary = 45000 _raise = .02 _new_salary = _salary + (_salary * _raise) print "Your current salary is:", _salary print "Your new salary will be:", _new_salary
true
2df380464942c17b79172c7c50448fec10531786
jsacharuk/PDF-Cleanup
/PDF_Cleanup.py
UTF-8
701
2.90625
3
[]
no_license
from PyPDF2 import PdfFileReader import os def rename_pdfs(): path=input("Please enter your path: ") os.chdir(path) for filename in os.listdir(path): if filename.endswith(".pdf"): inputPdf=PdfFileReader(open(filename, "rb")) if inputPdf.isEncrypted: inputPdf....
true
eda5400bd253dc4b4b5d05537e71256e82a95401
lalocho/lab6b
/lab6b.py
UTF-8
3,413
3.1875
3
[]
no_license
import time from queue import Queue from GraphAM import GraphAM from GraphAL import GraphAL,DisjointSetForest # prints a minimal spanning tree for a directed graph def topological_sort(graph): start_time = time.clock() all_in_degrees = [] sort_result = [] # q = Queue() for i in range(Gr...
true
094a11bc77352073ca01dea150b6944126a8f403
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_199/1319.py
UTF-8
876
3.515625
4
[]
no_license
def process(): t = int(input()) # read a line with a single integer for i in range(1, t + 1): p, w = [s for s in input().split(" ")] window_size = int(w) pancakes = [-1 if s == '-' else 1 for s in p] flips = get_flips(pancakes, window_size) print("Case #{}: {}".fo...
true
35b8c7b97f01155823c049321da9877f39474190
ProgramowanieAplikacjiWebowych/OpenTrello-flask
/modules/database/crud/crud_card.py
UTF-8
938
2.546875
3
[]
no_license
from modules.database.base import Session from modules.database.models.ot_card_t import Card def add_card(card): if not isinstance(card, Card): return status_code = 201 session = Session() try: session.add(card) except: session.rollback() status_code = 409 final...
true
eb443269ac98ee9b284a79d5f88e1d0be5cb314b
Athilas-Silva/fpoo
/Aula19/exemplo3_while/Exemplo 3 While.py
UTF-8
130
4.25
4
[]
no_license
num = int(input("Digite um número: ")) i = 1 while i <= 5: print('O número {} é igual a {}'.format(i, num)) i+= 1
true
f2ec53da362a9196335f61dc648eea8c66fff363
sachal6/battleshipAI
/Board.py
UTF-8
3,347
3.5625
4
[]
no_license
import numpy as np import random from enum import Enum class BoardStates(Enum): ''' Enumeration of possible board states ''' CARRIER = 6 BATTLESHIP = 5 CRUISER = 4 SUBMARINE = 3 DESTROYER = 2 MISS = 1 EMPTY = 0 @property def is_ship(self): return self not in (B...
true
6858c72a08941d6375446af742b5e40f821882fa
sayantansls/vcf-generator
/src/vcf_generator/version4/test_vcf_generator.py
UTF-8
6,250
2.78125
3
[]
no_license
""" author : sayantan (sayantan.ghosh@strandls.com) Unit testing for classes and functions in the script - vcf_generator_ver4.py """ import unittest import vcf_generator_ver4 import vcf_utils test_genomic_build = '37' test_entry = { "gene": "BRCA1", "genomicHgvs": "g.41215907C>T", "chrom": "chr17", "position": ...
true
11710493c5afcc845789f4424db9e07fd56e58bb
taypham/register-database-api
/register_database_api/routes/transaction_api.py
UTF-8
5,299
2.671875
3
[ "Apache-2.0" ]
permissive
from flask import Blueprint, request, jsonify, abort import psycopg2 import os import uuid from random import randint transaction_api = Blueprint('transaction_api', __name__) DATABASE_URL = os.environ['DATABASE_URL'] def parse_transaction_info(record_list): data_list = [] for record in record_list: d...
true
9220f34d753e060530e8b812a2591536dd786827
SlimShady15042000/Music-Generation
/gen_music.py
UTF-8
4,217
2.671875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[5]: from music21 import converter, instrument, note, chord, stream import glob import pickle import numpy as np from keras.utils import np_utils # In[7]: with open('notes', 'rb') as f: notes = pickle.load(f) # In[8]: n_vocab = len(set(notes)) # In[10]: #...
true
1d7ed8111b4e5cdce22242fac2ca36469148df54
rajrkane/LLL
/LLL.py
UTF-8
3,189
3.40625
3
[]
no_license
"""LLL.py: Implements the LLL Algorithm originally developed by Lenstra, Lenstra, Lovasz in 1982. Python 2.7.""" import sys import json import numpy as np from numpy import linalg as la __author__ = "Raj Kane" __version__ = "Spring 2019" basis = np.array(json.loads(sys.argv[1])).astype(float) # Initialize the basis ...
true
13d4156045fd998097a787c363f478d32d0d2ed9
korea7030/pythonwork
/dbn_algorithm/greedy/practice9.py
UTF-8
1,061
3.375
3
[]
no_license
# -*- coding: utf-8 -*- """ 무지의 먹랑 라이브(p. 316) """ from queue import PriorityQueue def solution(food_times, k): # 섭취해야할 음식이 없다면 -1 if sum(food_times) <= k: return -1 q = PriorityQueue() for i in range(len(food_times)): q.put((food_times[i], i+1)) # (food_times, index) sum_value =...
true
c3b573257b9923480038ddadf469d2223353804a
wsgan001/PyFPattern
/Data Set/bug-fixing-3/00abe6dbe7e8670d53741df0fc3eaded84b2d080-<get_inject_map_command>-bug.py
UTF-8
915
2.609375
3
[]
no_license
def get_inject_map_command(existing, key, value): commands = [] existing_maps = existing.get('inject_map', []) for maps in value: if (not isinstance(maps, list)): maps = [maps] if (maps not in existing_maps): if (len(maps) == 2): command = 'inject-map ...
true
e84144da155c7cdae1d3e6d37b8c355cca251b35
RooTender/wikidocker
/wikidocker/qualifier/__init__.py
UTF-8
3,713
3.453125
3
[]
no_license
import json from tqdm import tqdm from collections import Counter import operator from nltk.tokenize import RegexpTokenizer from nltk.stem.snowball import SnowballStemmer import numpy as np class Qualifier: def __init__(self): self.classes = self.read_data("classes.json") self.train_dicts = self....
true
732d2984ee10dfef7b84224935927c43f6264694
fkfouri/Algorithms
/Sort/merge_sort/merge_sort.py
UTF-8
1,269
3.78125
4
[]
no_license
def merge(A, p, q, r): n1 = q - p + 1 n2 = r - q # create temp arrays L = [0] * (n1) #Left R = [0] * (n2) #Right for i in range(0 , n1): L[i] = A[p + i] #indexacao no python comeca por zero for j in range(0 , n2): R[j] = A[q + 1 + j] #indexacao no python comeca por ...
true
7eeeefea1266ffe7c0e873bf40f7f62d0444c7fb
jkunkle/ReinforcementLearning
/TicTacToe/game.py
UTF-8
2,430
3.15625
3
[]
no_license
import argparse import random import player import json def main( ) : run_game(1000) def run_game( n_games ) : x_player = player.player( 1 ) o_player = player.player( 2 ) piece_order = [1, 2] player_order = [x_player, o_player] results = [] first_player = random.randint(0, 1) ...
true
8f34bf42291689375d83136d0f88cc2e11178115
zx490336534/python-Basics
/8.类概念,定义,属性,继承多态/面向对象.py
UTF-8
4,428
4.25
4
[]
no_license
#01类的概念、定义、属性、继承 #回顾 ''' 1.内置函数:enumerate filter map zip 2.变量的作用域:global nonlocal 3.闭包:函数中嵌套函数 4.递归:终止条件 递归推导式 ''' #面向对象 ''' 图书管理系统: 1.图书:10000本 2.管理员:50个 3.读者:1000个 ''' #类的定义:类是对现实生活中,具有共同特征的事物的抽象 class Animal(object): '''定义一个动物类''' pass #object:基类,任何类都要继承object #python3中继承object类可写可不写 class Animal: ...
true
ab58ea1bee09e09ce74335add92174c59cd530ca
Lanceolata/code
/algorithms/algorithms-python/leetcode_easy/Question_144_Convert_BST_to_Greater_Tree.py
UTF-8
496
3
3
[]
no_license
#!/usr/bin/python # coding: utf-8 from TreeNode import * class Solution(object): def convertBST(self, root): """ :type root: TreeNode :rtype: TreeNode """ sum = [0] self.convertBSTHelp(root, sum) return root def convertBSTHelp(self, root, sum): ...
true