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
22b9a525b587962ae110d19a402462ff43a88bc3
utabe/aoc
/2020/16/16.py
UTF-8
1,691
3.03125
3
[]
no_license
import itertools from collections import defaultdict rules, my_ticket, nearby_tickets = [section.split('\n') for section in open('input.in').read().split('\n\n')] my_ticket = [int(i) for i in my_ticket[1].split(',')] nearby_tickets = [list(map(int,ticket.split(','))) for ticket in nearby_tickets[1:]] valid_nums = set...
true
b722b3d798e7b833416382527c294f4ceab57b71
raksitov/TextWorld
/models/util.py
UTF-8
3,610
2.65625
3
[]
no_license
import numpy as np def words_to_ids(words, word_ids): ids = [] for word in words: try: ids.append(word_ids[word]) except KeyError: ids.append(word_ids['<UNK>']) return ids def preproc(s, str_type='None', tokenizer=None, lower_case=True): if s is None: return ['nothing'] s = s.repla...
true
74f3b2489f6ac67fde39384a5026e25b9b842c2f
abhinavrk/arkstock
/arkstock/diversify/helper.py
UTF-8
14,127
3.40625
3
[ "MIT" ]
permissive
''' This module provides helper functions that extract information from stocks and diversify a portfolio ''' from sklearn.decomposition import RandomizedPCA as PCA from collections import namedtuple from typing import List, Dict import numpy as np _ndarray = np.ndarray '''type alias for improved code clarity''' _neste...
true
b46802c6fae5a145d0b3aac823b6abba202e766b
siliconcortex/curiousweb
/est/cellular.py
UTF-8
5,730
3.109375
3
[]
no_license
import random_handler as ran import math import random import constants_conversions as c import interpolation import sympy as sym x, y, z, t = sym.symbols('x y z t', real = True) class jma_5_121: def __init__(self, *args, **kwargs): area = c.area(ran.main(2000), 'km2') radius = c.length(r...
true
9e3e734bc05d6ff71016e3757702801574f690f2
Cribbee/gofree130
/persona/m/rec.py
UTF-8
2,732
2.609375
3
[]
no_license
#encoding:utf8 import codecs import numpy as np import os def get_id_to_name(fn): dic = {} with codecs.open(fn, 'r', encoding='utf8') as f: for line in f: items = line.strip().split('\t') dic[int(items[0])] = items[1] return dic def get_name_to_id(fn): dic = {} with...
true
a99d985f52e7c125cc238258cb1757189d549aea
ranjithkumar121/Data_Structure
/tree_traversal.py
UTF-8
935
3.984375
4
[]
no_license
class node: def __init__(self,item): self.left=None self.right=None self.val=item def inorder(self,root): if root: self.inorder(root.left) print(str(root.val) + "->",end=" ") self.inorder(root.right) def postorder(self,root)...
true
f758c550f7e26f9e3276930492cbde9fbfb063d9
shreyastalamakki/CSE_231_Projects
/proj06.py
UTF-8
6,494
4.25
4
[]
no_license
############################################################################### # Computer Project Number 6: Password Cracking Program. # 1. Prompts the user for the name of an existing file with possible passwords. # 2. Prompts the user for the name of an existing password protected zip file. # 3. (1) and (2) are repe...
true
43e133de462d04441e971ae100644c8b4b8e657c
HenkVanAsselt/pyagw
/src/station.py
UTF-8
1,690
2.71875
3
[]
no_license
##@file STATION.PY ##@brief Station handler ##@AUTH Henk van Asselt, PA3BTL # # HIST: 20030411 # import logging stationlist = [] #----------------------------------------------------------------------------# # CLASS: Station #----------------------------------------------------------------------------# cla...
true
b652e3ab573f17ff85e62a4ef17a69953263fadd
patrickconnors23/AudioFeatureClusterer
/models/agglomerativeCluster.py
UTF-8
507
2.90625
3
[]
no_license
from sklearn.cluster import AgglomerativeClustering class agglomerativeCluster(): """ https://scikit-learn.org/stable/modules/generated/sklearn.cluster.AgglomerativeClustering.html#sklearn.cluster.AgglomerativeClustering """ def __init__(self, k): self.model = AgglomerativeClustering(n_clusters...
true
ef3907044919a91b0e2d7d12350891b55964bdd8
Wirless/cl1mb3r
/climber.py
UTF-8
1,232
3.125
3
[]
no_license
# Climber 1.0 # codename ^ # | # | # | # | import pygame class Climber(pygame.sprite.Sprite): def __init__(self, color, size, pos): """ initialize Climber object as an actor that will interact with the scene. prop -> map :type pos: object *xy ...
true
aa12ba14e83c97ac65a90ecbac6ff1e9b6b5d8d7
ControlEverythingCommunity/CE_PYTHON_LIB
/DS620.py
UTF-8
2,571
3.0625
3
[]
no_license
# Distributed with a free-will license. # Use it any way you want, profit or free, provided it fits in the licenses of its associated works. # DS620 # This code is designed to work with the DS620_I2CS I2C Mini Module available from ControlEverything.com. # https://www.controleverything.com/content/Temperature?sku=D...
true
7cd6e899328f8cc5e2c57d1c35e1224a4f240704
daniel-reich/ubiquitous-fiesta
/59kkN3yDnFKHYfgMm_6.py
UTF-8
267
3.40625
3
[]
no_license
def best_friend(txt, a, b): answer = True for i in range(len(txt)): if txt[i] == a: try: if txt[i+1] and txt[i+1] == b: answer = True else: return False except IndexError: return False return answer
true
b78b9e814d1d3880431b1a266635d8a3a4038677
ldw200012/Machine-Learning
/offcourse_practice/DataVisualization/Seaborn.py
UTF-8
1,303
2.53125
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns dat = sns.load_dataset("anscombe") # sns.relplot(x="x", y="y", hue="dataset", data=dat) # sns.catplot(x="x", y="y", hue="dataset", data=dat) dat2 = sns.load_dataset("attention") # sns.catplot(x="attention", y="s...
true
24c8155bc45d155fccc49f375327e5897e6b7064
otoomueez/abdulMueez
/abdulMueez/Day 4/testCode5.py
UTF-8
473
3.234375
3
[]
no_license
names = ["Kwame", "Stephen", "Ama", "Esi"] length = map(len, names) print(length) lengths = [3,5,6,8,9] def sqr(x): return x**2 # square = map(sqr, lenghts) # sqrlengths = map(sqr, names) lengths = map(len, names) sqrlength = map(sqr, length) sqrlens = map((lambda x : x**3), length) # print(*sqr...
true
8f5c2ea5886779af6fd7d7860944095e0bc8b93f
yangakandeni/employee-management-app
/tests/test_task_2.py
UTF-8
662
3.09375
3
[]
no_license
from functions import create_new_employees, display_employees from unittest import TestCase from task_1 import Employee class AddNewEmployeesTestCase(TestCase): def setUp(self): Employee(name="Mike", employee_id="12345", department="Engineering", job_title="Developer") return super().setUp() ...
true
9cb8b9befba85a4ca5f1f045af8262f41f3f03b5
bigyun/pythonclass
/access.py
UTF-8
9,369
2.75
3
[]
no_license
#!/usr/bin/python # coding: utf-8 import sys, os, urllib2, json,re,time reload(sys) sys.setdefaultencoding('utf8') import datetime,time from functools import wraps #此程序处理nginx日志,得到省份,省份访问量 #判断函数执行时间 def fn_timer(function): @wraps(function) def function_timer(*args, **kwargs): t0 = time.time(...
true
06ee5fab9c8662c4f2aedc6db9ed10b97a26639d
wadsworj/pokemon_clone_python
/Tutorial 6 - Rooms and NPCs/game_view/battle.py
UTF-8
3,553
2.875
3
[]
no_license
import pygame import config import math import utilities class Battle: def __init__(self, screen, monster, player): self.screen = screen self.monster = monster self.player = player def load(self): pass def render(self): self.screen.fill(config.WHITE) #fon...
true
375f5e211261d2c23e616df9e46cb27aec8eb94b
AntoineNOUMA/pythonTranslator
/translator.py
UTF-8
7,258
3.765625
4
[]
no_license
# -*-coding:utf-8 -*- """ DESCRIPTION This web service written in Python allows you to translate a string into the language of your choice. To do this, we ask you to fill out a form containing 2 inputs: - An input to write a string. - An input to select the language of translation. Once you have written your st...
true
8fa646e44d7638ec3545074bbce67fd04c875db5
excelmm/adventofcode2020
/19/pset19a.py
UTF-8
892
2.828125
3
[]
no_license
from os import terminal_size import re def main(): with open("input.txt", "r") as f: rulesinput, texts = f.read().split("\n\n") rulesinput = rulesinput.split("\n") texts = texts.split("\n") rules = {} for i in rulesinput: name = i.split(": ")[0] ruleset = i.spli...
true
ea4a4a8c884e425258c739466c013c566b8e9a8f
callum-mccracken/gaussian_processes
/kriging.py
UTF-8
11,594
2.671875
3
[]
no_license
""" Ordinary Kriging Example ======================== First we will create a 2D dataset together with the associated x, y grids. """ import matplotlib as mpl mpl.rcParams.update(mpl.rcParamsDefault) import pickle import numpy as np import pykrige.kriging_tools as kt from pykrige.uk import UniversalKriging from pykrig...
true
f22c9a541e66ba05d1af5d888cd0282f5464834a
snailuncle/scrapyBaidustocks
/tongcheng58/vim快捷键.py
UTF-8
511
2.625
3
[]
no_license
# i 插入光标前一个字符 # I 插入行首 # # a 插入光标后一个字符 # A 插入行末 # # o 向下新开一行,插入行首 # O 向上新开一行,插入行首 # # gg 文本头部 # G 文本尾部 # # 当前行下移 dd删除 o向下新开一行 p黏贴 # # v选择 y复制 # :n,$s/vivian/sky/g #替换第 n 行开始到最后一行中每一行所有 vivi...
true
8df444087a84a6e9d8e984d682cb4e2892ae06c6
baejinsoo/algorithm_study
/algorithm_study/graph/팀 결성.py
UTF-8
637
3.421875
3
[]
no_license
def check_team(team, x): if team[x] != x: team[x] = check_team(team, team[x]) return team[x] def union_team(team, a, b): a = check_team(team, a) b = check_team(team, b) if a < b: team[b] = a else: team[a] = b N, M = map(int, input().split()) team = [0] * (N + 1) for ...
true
a6f0bab71ae9bbac272a67b27e0315c3a5e20ec3
Ricardo16X/EDD_2S2019_P1_201700524
/SNAKE/CircularDobleEnlazada.py
UTF-8
3,011
3.078125
3
[]
no_license
import os #reporte de usuarios registrados en el juego class nodoCDEnlazada(): def __init__(self,nombre): self.nombre = nombre self.siguiente = None self.anterior = None class CDEnlazada(): def __init__(self): self.ancla = nodoCDEnlazada(None) self.ultimo = self....
true
a1800cd6704a994ec227834afdea655d6f122aec
cecilia824/datasciencecoursera
/XMLparsing.py
UTF-8
663
3.59375
4
[]
no_license
import urllib.request, urllib.parse, urllib.error import xml.etree.ElementTree as ET location = input('Enter location: ') print('Retrieving ',location) html = urllib.request.urlopen(location).read() print('Retrieved ', len(html),'characters') tree = ET.fromstring(html) #轉化data這string為樹狀圖 lst = tree.findal...
true
48867067545b4d51d7b7402b66ab418c32893121
Di0rdan/board-game-monitor
/bot/base.py
UTF-8
566
2.59375
3
[]
no_license
import abc import telegram.ext class BaseHandle(metaclass=abc.ABCMeta): @abc.abstractmethod def __init__(self): pass @abc.abstractmethod def __call__(self, update: telegram.Update, context: telegram.ext.CallbackContext) -> None: raise NotImplementedError("__call__ method should be i...
true
f4f185d1c891b9377f574f60b7715db6172517ff
mihaic/psyneulink
/Scripts/Examples/Rumelhart Semantic Network.py
UTF-8
2,914
2.5625
3
[ "Apache-2.0" ]
permissive
import psyneulink as pnl import numpy as np import typecheck as tc # This script implements the following network, first described in Rumelhart and Todd # (Rumelhart, D. E., & Todd, P. M. (1993). Learning and connectionist representations. Attention and performance XIV: # Synergies in experimental psychology, artific...
true
e96866e4858c08bd426e4c29e4137b26e9e52fe8
zslari/Data_Structures_Algorithms_Python
/Linked_Lists_and_Stacks/stack_ADT.py
UTF-8
873
3.875
4
[]
no_license
""" Stack Class implemented as ADT from Node Class """ from node_ADT import Node class Stack: """ Stack Class using Linked List of Nodes """ def __init__(self): self.head = None def isEmpty(self): return self.head is None def peek(self): return None if self.isEmpty() else s...
true
779d951fd197f695882180a3048891a7cac4d516
jiangshen95/UbuntuLeetCode
/FizzBuzz.py
UTF-8
579
3.140625
3
[]
no_license
class Solution: def fizzBuzz(self, n): """ :type n: int :rtype: List[str] """ # return ['FizzBuzz' if i % 5 == 0 and i % 3 == 0 else 'Fizz' if i % 3 == 0 # else 'Buzz' if i % 5 == 0 else str(i) for i in range(1, n + 1)] # return ['Fizz' * (not i % 3) +...
true
d3949517db6e27cab816e575e9b53f91173b90f3
Mayuri0612/30_days_of_python
/Day7/Func.py
UTF-8
401
3.546875
4
[]
no_license
def func(text): print(text) msg_template = """Hello {name}, Thank you for joining {website}. We are very happy to have you with us. """ def format_msg(my_name = "Justin", my_website = "abc.com"): my_msg = msg_template.format(name = my_name, website = my_website) #print(my_msg) return my_msg names =...
true
1ee5af27041e4b6b17e998a08ed21f2a8632343f
Tukamotosan/TurnTakeSrc
/Test.py
UTF-8
1,948
2.765625
3
[]
no_license
# -*- coding:utf-8 -*- """ This is test script that calculate eq.(1) by using Runge-kuttta method. """ __author__ = 'mamoru' import numpy as np import theano.tensor as T from theano import function from theano import Param from theano import pp import matplotlib.pyplot as plt def dvdt(t, v, M, D1, f1,...
true
ae8ea88ff8f3f8e10bf63572e6233ea26a396c12
DaronKihn/python_lab
/python_lab_1/5_1_ostrov_nevezeniya.py
UTF-8
344
3.625
4
[]
no_license
print("Введите день, месяц и год рождения аборигена:") day = int(input()) month = int(input()) year = int(input()) c = year // 100 year %= 100 if month <= 2: month = month + 10 else: month = month - 2 print((day + ((13 * month - 1) // 5) + year + (year // 4 + c // 4 - 2 * c + 777)) % 7)
true
6a081366121d6b629e37ad67485d07dff604c233
prisnormando/waterbutler
/tests/providers/github/test_exceptions.py
UTF-8
787
2.765625
3
[ "LicenseRef-scancode-free-unknown", "Apache-2.0" ]
permissive
import pytest from waterbutler.providers.github import exceptions class TestExceptionSerialization: @pytest.mark.parametrize('exception_class', [ (exceptions.GitHubUnsupportedRepoError), ]) def test_tolerate_dumb_signature(self, exception_class): """In order for WaterButlerError-inherit...
true
bce7a2e3123cf2b42b130607b38ebff6f42658f6
kellanfan/python
/test/40-类的property.py
UTF-8
1,013
3.625
4
[ "Apache-2.0" ]
permissive
# pylint: disable=no-member # -*- encoding: utf-8 -*- ''' @File : classh1.py @Time : 2019/06/03 15:20:14 @Author : Kellan Fan @Version : 1.0 @Contact : kellanfan1989@gmail.com @Desc : None ''' # here put the import lib class Student(object): def __init__(self, sco): self._score = sc...
true
3c1281c83872178623a17034a475f2f3b395ef74
hongmengwang/tgou_tester
/com/tgou/tester/oversea.py
UTF-8
3,836
3.015625
3
[]
no_license
# coding=UTF-8 from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.by import By import time class OverSeaTester: __driver = "" __page_name = "跨境直购" __sleep = 2 def __init__(self, webdriver): print...
true
17acb67ebdc4d084b1d7f3e16066246eb75389f2
medhajon/HackUTD-2021
/my_bot.py
UTF-8
6,380
2.796875
3
[]
no_license
# import Discord Package import discord from discord.ext import commands from datetime import timedelta, datetime import os import json import random import time import asyncio # client (our Bot) client = commands.Bot(command_prefix='--') @client.command(name='!assign') async def version(context): myEmbed = di...
true
dd9b7adbf61d881b247540405c0fe255da5c6cc7
shuntaka9576/dotfiles
/tmux/powerline/sound
UTF-8
1,494
3
3
[]
no_license
#!/usr/local/bin/python3 import subprocess from distutils.util import strtobool def exec_osascript(): subproc = subprocess.run( ["osascript", "-e", "get volume settings"], stdout=subprocess.PIPE ) return subproc class sound: def __init__(self): subproc = exec_osascript() soud...
true
ef6b8f9f3b7d55c852e69dc66dec80a9e583ccbd
Lyasinkovska/BeetRootPython
/lesson_6/task_1_asterisk.py
UTF-8
546
3.953125
4
[]
no_license
""" Сделайте словарь дней недели {1: "Monday", 2:... } в общем словарь. И потом "переверните" чтоб было {"Monday": 1, ... """ days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] # option 1 days_of_week = {i: day for i, day in zip(range(1, 8), days)} print(days_of_week) # option 2 week...
true
7cda16b021776e63997ad92df61d3207a72f43dd
narrasubbarao/practise
/INheritance/Demo10.py
UTF-8
300
3.375
3
[]
no_license
class A: def __init__(self,idno,name): self.__idno = idno self.__name = name def show(self): print(self.__idno) print(self.__name) class B(A): def display(self): print(self.__idno) print(self.__name) x = B(101,"Ravi") x.show() x.display()
true
31aa16bdd429b1681505113adc131220afc742ca
robbykukurs/practice-python-org-exercises
/17-webscraper-beautiful-soup-find-titles.py
UTF-8
609
3.375
3
[]
no_license
#requests is a built in module. To check the available python modules, #just go to python3, then do help, then type "modules" and hit enter #requests allows us to download content of a website as HTML url1 = "https://www.dailymail.co.uk/home/index.html" url2 = "https://www.nytimes.com/" import requests r = requests.get...
true
a42ad2ae49e93f108dbc16e43775e3bb136254ad
KaayYoung/Computer-Network
/assignment/packet.py
UTF-8
2,151
2.921875
3
[]
no_license
# packet.py SEQ = 0 ACK_NUM = 1 FLAG = 2 DATA = 3 CHECKSUM = 4 TIMER = 5 FLAG_SYN = 0b100 FLAG_ACK = 0b010 FLAG_FIN = 0b001 def new_packet(seq, ack_num, syn, ack_bit, fin, data): flag = 0b000 if syn: flag = flag | FLAG_SYN if ack_bit: flag = flag | FLAG_ACK if fin: flag = fla...
true
8c6eaae26063041aa11f20004c4183fd19036951
wook2014/orthonome
/OrthologPair_sw_scoring.py
UTF-8
2,825
2.53125
3
[]
no_license
#!/usr/bin/python """ usage: OrthologPair_sw_scoring.py [G1G2.SW] [G2G1.SW] [MSOAR2_result] [MS_scores] """ # OrthologPair2Scores <BLASTPOUTPUT- Tab delim format> <Pairs of genes> <output> # # Copyright 2014 Rahul Vivek Rane <rahulvrane@gmail.com> # # This program is free software; you can redistribute it and/or ...
true
83297fb23f49122fba4855ef6d2a830fb3af94e6
AmirjonQodirov/TikSta-android
/scripts/execSQL_Creator.py
UTF-8
1,161
2.65625
3
[ "MIT" ]
permissive
all_tags = open('result.txt', 'r', encoding='utf-8') data = all_tags.read().strip().split('\n') insta_map = dict() for line in data: if line == '': continue tag, index = line.split(',') insta_map[tag] = index tiktok_map = dict() tiktok_file = open("tags_from_tiktok.txt", 'r', encoding='utf-8') tiktok_tags =...
true
6ecbb550b2ce0da3128736cb0c889be4254a4ba9
truerandom/genetic_xss
/grammar.py
UTF-8
8,856
2.8125
3
[]
no_license
import requests # comunicacion http from requests.utils import quote # codificacion import random # generacion de numeros aleatorios import urllib # coneccion con el server import sys # comunicacion con el os import webbrowser # manejo de navegadores from bs4 import BeautifulSoup # analisis de codigo from tidy...
true
e1c69b56369b3b6aea59f0af902305c1793909cb
vodchella/NoveltyAssistant
/dinner.py
UTF-8
1,792
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- import urllib import lxml.html from remote_functions import get_dinner_paths from constants import * def get_dinner_html(): try: ufile = urllib.urlopen(DINNER_HTML) if ufile.info().gettype() == 'text/html': return ufile.read() except: ...
true
15a4347d83f00f6101d9a0df151d1fb889ce1b1b
waylybaye/solog
/blog/tests.py
UTF-8
1,675
2.546875
3
[]
no_license
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase from django.te...
true
18add673b6b54821b7bc0f207e697ad6fc440da4
kiritomo2424/self_taugh
/self_8.py
UTF-8
161
3.03125
3
[]
no_license
#1 import statistics nums = [] for i in range(0,100): nums.append(i) a = statistics.pvariance(nums) print(a) #2 import cubed x = cubed.cube(3) print(x)
true
215e79bb5ead5a83a4fdf0e1dd8fbb4dcf10f662
pizzicatomania/pythonClass
/강사 소스/pythonTest/n.py
UTF-8
435
3.296875
3
[]
no_license
class Test: def __init__(self, x=0, y=0): print("init call.") self.a =x self.b =y def setData(self, x, y): #멤버함수... self.a = x self.b = y def show(self): print(self.a,self.b) if __name__ == '__main__': obj = Test(10,20) #객체생성( 멤버데이터의 초기화를 자동호출되는 함수(생성자함수)...
true
924e2713bed6a64056db32b55379b4e6b7bb3c2c
NicolasNin/sc2stalk
/web/starcraftstalk/starcraftHistory/checkdb.py
UTF-8
8,331
2.546875
3
[]
no_license
from .useapi import Useapi from .models import * def consistencyMHDB(player): useapi=Useapi() MH=useapi.getPlayerMatchHistory(player.path,player.alternate_path) if MH!=[]: gamesdb=Games.objects.filter(path=player.path) for g in MH: if gamesdb.filter(date=g["date"]).exists(): ...
true
7c03a72df98830aa5d1eb3971977832ccbe9440f
jmukher1/HMM-VAE
/eval_utils.py
UTF-8
1,920
2.84375
3
[]
no_license
""" Define necessary functions for evaluation. """ import torch import editdistance def get_phn_mapping_table(): """ Build the phoneme mapping table. Sequences are mapped from 61 to 39 phonemes during evaluation. This mapping is a standard recipe taken from the Kaldi TIMIT s5 recipe: https://githu...
true
d8fd425bb403b26cfeae80faad37a1774ea7f5bc
prezentini/estudo_python
/calculadora.py
UTF-8
478
4.125
4
[]
no_license
calcular = input('Calcular (s/n)? ') while calcular == 's': x = float(input('x: ')) op = input('operador: ') y = float (input('y: ')) if op == '+': resultado = x - y elif op == '*': resultado = x * y elif op == '/': if y == 0: print('Divisão por zero!\n') continue ...
true
8151924af1adc81923b96a12d1a260a52cee668f
conan-io/conan
/conans/server/rest/bottle_plugins/http_basic_authentication.py
UTF-8
1,545
2.640625
3
[ "MIT" ]
permissive
import base64 from collections import namedtuple from bottle import HTTPResponse from conans.server.rest.bottle_plugins.authorization_header import AuthorizationHeader class UserPasswordPair(namedtuple('UserPasswordPair', ['user', 'password'])): """ Simple tuple for store user and pass """ pass class Http...
true
6aef21650f4566ef55fcc01220580540f7e93b5d
hoangthuc701/LeetCode-Solutions
/66.plus-one.py
UTF-8
661
3.296875
3
[]
no_license
# Author: Nguyen Hoang Thuc # Link: https://leetcode.com/problems/plus-one class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ a = 1 num = 0 lens = len(digits) for i in range(lens-1, -1, -1):...
true
8ddd8053b6162564d0798b9aef8359316dcc3d77
SabithaSubair/Luminar_PythonDjangoProjects_May
/samplepgms/bankpgm.py
UTF-8
209
3.5625
4
[]
no_license
a=int(input("enter the initial amount:")) print("Initial Amount : ",a) b=int(input("enter the withdrawal amount:")) c=a-b print("Balance:",c) d=int(input("enter the deposit amount:")) e=c+d print("Balance:",e)
true
696596fab7b1c1a402552561be1eef7acb5e1acd
alirezacha/Courses
/Python/Project - 2/02.Expense_Program/api.py
UTF-8
1,455
2.984375
3
[]
no_license
#NABEGHEHA.COM import sqlite3 as db from datetime import datetime conn = db.connect('spent.db') c = conn.cursor() def init(): # initialize a new table to store date c.execute('''CREATE TABLE IF NOT EXISTS expenses ( amount REAL, category TEXT, message T...
true
4c500f861af21e63c9180b1920920a09cf543021
barustnt/interface-gui
/bb.py
UTF-8
222
2.578125
3
[]
no_license
from tkinter import * import os root = Tk() theLabel = Label(root, text="Folow the putun please") theLabel.pack() photo = PhotoImage(file="ind.png") label=Label(root, image=photo) label.pack() root.mainloop()
true
19791e6cd36a9b64733596001ec30f8a10d4cb07
nyborr/OpenKattisProblems
/sibice.py
UTF-8
75
2.90625
3
[]
no_license
x = int(input().split()) sum = 0 for i in range(x): x = input()
true
4e05e38aa98bf3de5409c3c76a4092a6db7772bb
Gorgious56/MazeGenerator
/maze_generator/maze/algorithm/algorithms/voronoi_division.py
UTF-8
2,967
2.671875
3
[]
no_license
from math import hypot from .maze_algorithm import ( MazeAlgorithm, shuffle, randrange, UnionFind, ) class VoronoiDivision(MazeAlgorithm): name = "Voronoi Division" settings = ["room_size"] def __init__(self, grid, props=None, *args, **kwargs): super().__init__(grid=grid, props=pr...
true
4df539efa8b90e596472e7cb755c3ac60e0f589d
tl32rodan/Deep_Learning_Lab_4-Conditional_Sequence_to_Sequence_VAE
/source_code/scores.py
UTF-8
779
2.765625
3
[]
no_license
from nltk.translate.bleu_score import SmoothingFunction, sentence_bleu #compute BLEU-4 score def compute_bleu(output, reference): cc = SmoothingFunction() if len(reference) == 3: weights = (0.33,0.33,0.33) else: weights = (0.25,0.25,0.25,0.25) return sentence_bleu([reference], output,we...
true
ce3b77da77fe7d87281c573ae89cf59c1b90d609
fgolemo/mcdp
/src/mcdp_lang_utils/where_utils.py
UTF-8
2,061
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- import sys from contracts.utils import check_isinstance from contracts.utils import raise_desc def printable_length_where(w): """ Returns the printable length of the substring """ if sys.version_info[0] >= 3: # pragma: no cover stype = str else: stype = unicode ...
true
ea87595248e931d0d8d331951bed156f613b6fc1
ctran25/spring-2015-homeworks
/submissions/Homework-5/scrape_solution.py
UTF-8
10,204
2.578125
3
[ "MIT", "CC-BY-4.0" ]
permissive
#!/usr/bin/python # -*- coding: utf-8 -*- import os import sys import time import argparse import logging import requests from BeautifulSoup import BeautifulSoup log = logging.getLogger(__name__) log.setLevel(logging.ERROR) loghandler = logging.StreamHandler(sys.stderr) loghandler.setFormatter(logging.Formatter("[%(...
true
2cd76dc31a7b27d803c553541027f7b329a53e9c
vikul-gupta/wv-python-exercises
/mountain_heights_3.py
UTF-8
1,395
4.09375
4
[]
no_license
#Create a dictionary with mountain names as keys and elevations (m and ft) as values. #Loop through the names and elevations in meters using a function to get the elevation in feet. #Print out just the names, just the elevations (in meters and feet), and both. mtn_m = {'Mount Everest': 8848, 'K2': 8611, 'Kangchenjunga...
true
ade263bb28c4c7329f66e11737e76d4fe28bbcae
BenjaminPeter/admixfrog
/admixfrog/utils/states.py
UTF-8
5,082
3.125
3
[]
no_license
from itertools import chain import yaml class States(object): """class to track different states""" def __init__( self, state_ids, homo_states=None, het_states=None, roh_states=None, est_inbreeding=False, ): """get info about which states to include...
true
fc400085dc6a1ad81a58662de5563d59cabcb472
gobleg/neural-circuits
/circuit.py
UTF-8
1,792
2.875
3
[]
no_license
import sys import os import numpy as np def OrCircuit(X): n = X.shape[0] if n == 1: return X X1 = np.array([]) for i in range(0, n, 2): X1 = np.append(X1, X[i] or X[i+1]) return AndCircuit(X1) def AndCircuit(X): n = X.shape[0] if n == 1: return X X1 = np.array([...
true
df16c3709ef30a7230cb8408e180575ca8d8a52c
horahh/reconocimientodepatrones
/pca_skit_galaxias_filters.py
UTF-8
12,300
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import urllib2 import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA import os,sys from skimage.color import rgb2gray from skimage import io, filter from skimage import img_as_float from skimage.transform import rotate from skimage.filter import gaussian_filter...
true
4b18036ff366af283335782a3c3f449c0a7a2541
AdamZhouSE/pythonHomework
/Code/CodeRecords/2949/60694/264255.py
UTF-8
73
3.421875
3
[]
no_license
l = input().split() l.pop() for ele in l[::-1]: print(ele, end=" ")
true
f725e34da0af94160f9e6a7334bac6e338d892dd
eduardo-gualberto/redes-t4
/slip.py
UTF-8
4,974
3.03125
3
[]
no_license
from typing import NamedTuple import re class CamadaEnlace: ignore_checksum = False def __init__(self, linhas_seriais): """ Inicia uma camada de enlace com um ou mais enlaces, cada um conectado a uma linha serial distinta. O argumento linhas_seriais é um dicionário no formato ...
true
57f0292726b1ac8400fde9d1c81a16e088f3ef3a
sharon-0303/python-programs
/testprimef.py
UTF-8
189
3.09375
3
[]
no_license
num=int(input()) for i in range(2,num+1): if(num%i==0): print(num) for j in range(2,(i//2+1)): if(i%j==0): break
true
80dabb40bdca4d58d8c4bdaf3f66247333da6968
marxMT/desafioNubimetrics
/desafio/desafio9.py
UTF-8
488
2.984375
3
[]
no_license
from datetime import datetime,timedelta def generateLastDaysPaths(date, days): lista=[] url_base = "https://important@location/" date_inicial = datetime.strptime(date, "%Y%m%d")-timedelta(days) for i in range(days): date_inicial+=timedelta(1) url = url_base +date_inicial.strftim...
true
9948a436557784169b0d067a946d28592442f1ac
LenX21/pycharmforcheckio
/ElectronicStation/Army_Battles.py
UTF-8
1,196
3.8125
4
[]
no_license
class Army: ''' The battles occur according to the following principles: at first, there is a duel between the first warrior of the first army and the first warrior of the second army. As soon as one of them dies - the next warrior from the army that lost the fighter enters the duel, and the survivi...
true
259954307828944c53c4914416d09a8cbd9b91a2
SCUZxin/DiDiTaxi
/file2csv/weather.py
UTF-8
1,314
3.140625
3
[]
no_license
import pandas as pd import os dirPath = 'E:\\data\\DiDiData\\training_set\\weather_data\\' fileList = os.listdir(dirPath) # 得到目录下的文件名列表 fileList.sort() # 得到的文件列表按文件名排序 # 对目录下所有的文件进行操作(遍历以及写成csv) for i in range(len(fileList)): fileName = fileList[i] filePath = os.path.join("%s%s" % (dirPath, fileList[i]))...
true
7704d7b58dc9fc530f272953700d102b3acaabda
annikajaakson/Koodilaager-2017-Team-1
/Player.py
UTF-8
2,282
3.359375
3
[]
no_license
import pygame up_img = pygame.image.load("yles.png") down_img = pygame.image.load("alla.png") left_img = pygame.image.load("vasak.png") right_img = pygame.image.load("parem.png") rotation = {-1: left_img, 1: right_img, -2: up_img, 2: down_img} class Player: def __init__(self, x, y, resolution, mapn): sel...
true
7218d8a08208b4cc8cebd0abf89c0526bdcf32f4
RajithaFernando/Socket-Programming
/main.py
UTF-8
323
2.578125
3
[]
no_license
import signal # Allow socket destruction on Ctrl+C import sys def shutdownServer(sig, unused): """ Shutsdown server from a SIGINT recieved signal """ server.shutdown() sys.exit(1) signal.signal(signal.SIGINT, shutdownServer) server = server() server.start() print("Press Ctrl+C to shut down server....
true
93d48f2230086e3bf1cfdda6195c69a14eefe675
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_206/1629.py
UTF-8
899
2.953125
3
[]
no_license
testcases = int(raw_input('')); for case in range(testcases): dest, num = raw_input('').split(' '); dest = int(dest); num = int(num); horses = []; for i in range(num): pos, vel = raw_input('').split(' '); pos = int(pos); vel = int(vel); horses.append((pos, vel)); horses.sort() horses = horses[::-1]; times ...
true
1daaa29b291d2c3a41d267ca24baf84718f4c0b5
JuanOrmaza/MetodosComputacionales
/S5C1/plotsS5C1.py
UTF-8
263
2.578125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt datos = np.genfromtxt('datos.txt') plt.clf() plt.figure() plt.plot(datos[:,0], datos[:,1], label='coseno') plt.legend() plt.plot(datos[:,0], datos[:,2], label='derivada') plt.legend() plt.savefig('S5C1PLOT.pdf')
true
e00857e52a04104e187c94bbdcf8a7492dfca9bf
phu-n-tran/LeetCode
/monthlyChallenge/2020-05(mayChallenge)/5_29_CourseSchedule.py
UTF-8
5,427
3.734375
4
[]
no_license
# -------------------------------------------------------------------------- # Name: Course Schedule (graph approach) # Author(s): Phu Tran # -------------------------------------------------------------------------- """ There are a total of numCourses courses you have to take, labeled from 0 to numCo...
true
b024cea0a32d69361fa64f30c032e79359a881bd
kanik9/Plotly-and-Dash
/components and callback/Ex1-InteractiveComponents.py
UTF-8
1,255
3.328125
3
[]
no_license
####### # Objective: Create a dashboard that takes in two or more # input values and returns their product as the output. ###### # Perform imports here: import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output # Launch the application: app = dash...
true
4a775f99d8dfd4f834a4199095b9be21edf0f4c8
kientn123/data-wrangle-openstreetmaps-data_1
/KienNguyen_p2_code.py
UTF-8
10,521
2.828125
3
[]
no_license
# coding: utf-8 # In[9]: # Author: Kien Nguyen import xml.etree.ElementTree as ET import pprint import json import re import codecs # Check to see if there is any non-5-digit format, and count the number of 5-digit format and the other # 5 digig format postal_re = re.compile(r'^[0-9]{5}$') num_short_format = 0 num...
true
e2fb0f6ccf79b8ff4e975813dc3311a3fb3222b1
yummychuit/TIL
/0_startcamp/day4/try.py
UTF-8
195
2.609375
3
[]
no_license
import webbrowser keywords = ['초밥', '비빔밥'] for keyword in keywords: url = 'https://www.google.com/search?q=' + keyword + '맛집' webbrowser.open_new(url)
true
1db49cf2d89c96e61c92980f2f296c9346847f58
jprashant21/ElNeuKGQA
/entity_linking/precision_priority_system.py
UTF-8
5,867
2.703125
3
[ "MIT" ]
permissive
import re from pathlib import Path from typing import Optional, List, Union, Dict, Set import nltk from nltk.corpus import stopwords from dataset_tools import QuestionCase from entity_linking.base_entitity_linking_system import EntityLinkingDict from entity_linking.ensemble_entity_linking_system import EnsembleEntity...
true
685facd1e278817475aff91542afbc2622fc9c7e
walkerzh0/python
/study/15_oop/obj.py
GB18030
701
3.8125
4
[]
no_license
#!/usr/bin/python #coding=utf-8 # class Cat: def __init__(self, name): self.name = name def eat(self): print "Сè" def drink(self): print "Сèˮ" def printInfo(self): print "Name is ", self.name tom = Cat("tom") #ִұ,,tomøö tom.eat() tom.drink() jarr.printInfo() jarr = Cat("jarr") #ִұ,,jarrøö jarr.e...
true
624c91920cf593c3dcc5f022505a24c2f03a82ba
jizheair/algo
/mergeInterval.py
UTF-8
1,018
3.359375
3
[]
no_license
class Interval: def __init__(self, s=0, e=0): self.start = s self.end = e class Solution: # @param intervals, a list of Intervals # @param newInterval, a Interval # @return a list of Interval def insert(self, intervals, newInterval): # find the smallest interval such that ne...
true
f12501d56b563622789c5782425b317303ca59a2
cangyan/gitlab-statistics
/main.py
UTF-8
4,309
2.609375
3
[]
no_license
#!/usr/bin/python import gitlab import xlwt import os #用户git账户的token private_token = os.environ['token'] #git地址 private_host = os.environ['host'] #提交代码的域账户名称1 author_email = os.environ['author_email'].split(',') start_time = os.environ['start_time'] end_time = os.environ['end_time'] filter_project = os.environ['p...
true
d8ca4ae2596fa0748eb9906c335b0a509a345b95
vrii14/PPL_Assignments
/Assignment_1/armstrong.py
UTF-8
345
3.640625
4
[]
no_license
n1 = int(input("Enter starting number of the range: ")) print(type(n1)) n2 = int(input("Enter last number in the range: ")) armstrong = [] for i in range(n1, n2+1): number = [int(d) for d in str(i)] #print (number) sum = 0 for j in number: sum = sum + j**3 if sum == i: armstrong.appe...
true
1a11902d02f492ba1542db0d667a3d7e101d31ee
LouisYLWang/leetcode_python
/26.remove-duplicates-from-sorted-array.py
UTF-8
523
2.796875
3
[]
no_license
# # @lc app=leetcode id=26 lang=python3 # # [26] Remove Duplicates from Sorted Array # class Solution: def removeDuplicates(self, nums: List[int]) -> int: #num_sum = 0 i = 0 if len(nums) == 1: return len(nums) else: while i < len(nums): if i > ...
true
9d4ec609e496a5629e95542573ed941ea78ecf21
mengyuwei290/Leecode
/169.Binary Tree Maximum Path Sum/Binary_Tree_Maximum_Path_Sum.py
UTF-8
682
3.296875
3
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def maxPathSum(self, root): """ :type root: TreeNode :rtype: int """ self.max_va...
true
b12f6ce70dcd4b3f606d754acba023b116495af5
tuggawaugh/Harshil595
/rwmidterm-4.py
UTF-8
4,063
2.78125
3
[]
no_license
# coding: utf-8 # In[1]: import pandas as pd import matplotlib matplotlib.use("TkAgg") import matplotlib.pyplot as plt from pandas_datareader import data as web from flask import Flask,redirect,url_for from flask import request from iexfinance import Stock import plotly import plotly.plotly as plty import plotly.gr...
true
7364f01bb21603b3191bf0811f00b0bf022bae9e
XiaohanLiang/data_classification
/analyse.py
UTF-8
3,053
2.9375
3
[]
no_license
# # @Function: This function was used to analyse the resulting data # 1. Transfer spiking time into spiking rate # 2. Deploy 5% inhibition method # 3. Calculate the Euclidean-distance to find 5 nearest neighbor # # @Mention: This version will not have verification step, # we...
true
a641e0c0da82388d443b2eb43a307179fc60de37
PApostol/TFLMonitor
/src/monitor.py
UTF-8
2,655
2.78125
3
[]
no_license
""" Main file for monitoring """ import argparse import datetime import glob import logging import os import threading import time from plotting import plot_all_trackers from scraping import save_tracker, update_tracker class PlotThread(threading.Thread): def __init__(self, name, source_path, interval): ...
true
5a87994d884876f9e909d0549e8bc7efc5e64b9f
hengrumay/100-women-flask-app
/helpers/makeDFfromJson.py
UTF-8
1,300
2.6875
3
[]
no_license
def makeDFfromJson(ibm_out): """ Reformat Json output from IBM API call via Speech Recognition with relevant parameters as a pandaDataFrame --------------------------------------------------------------------------- ## Example use: # from makeDFfromJson import makeDFfromJson # DF0 = mak...
true
3abe7b625756dfc9aec2d5b36f93120e202f8e5f
carloszo/Carlos_python
/Crawler/redtube_download.py
UTF-8
2,415
2.546875
3
[]
no_license
#!/usr/bin/python #-*- coding:utf8 -*- from bs4 import BeautifulSoup as bs import urllib,re,json,os,time url= 'https://www.redtube.com/2723252' def html_downloader(url): return urllib.urlopen(url).read() def parser(html_content): soup = bs(html_content, 'html.parser', from_encoding='utf8') links = soup.fi...
true
06b4ea6b982fe50a6c9bd4ab927ce2d198d8e6ec
SanjeevkMishra/Generic_Training_Python_INFY
/Fundamental Programming Part 1/Assignment_Set-4/find_common_characters.py
UTF-8
880
3.53125
4
[]
no_license
''' Problem Statement Write a python program to display all the common characters between two strings. Return -1 if there are no matching characters. Note: Ignore blank spaces if there are any. Perform case sensitive string comparison wherever necessary. Solution: ''' #lex_auth_012693825794351104168 def find_common_c...
true
e92bf54296c5adb166cd3209ecbb17eaad17204f
kylebarron/earthengine-py-notebooks
/JavaScripts/ImageCollection/FilteredComposite_qgis.py
UTF-8
1,031
3.0625
3
[ "MIT" ]
permissive
import ee from ee_plugin import Map # Filter an image collection by date and region to make a # median pixel composite. # # See also: ClippedComposite, which crops the output image # instead of filtering the input collection. # Filter to only include images intersecting Colorado or Utah. polygon = ee.Geometry.Polyg...
true
7cfd600fbebe194e23a9c37582424fb7ec40cd28
BohdanVey/LAProject
/fastmultiplication.py
UTF-8
3,835
3.40625
3
[]
no_license
import random import time """ It work only with square matrix """ def new_matrix(r, c): """Create a new matrix filled with zeros.""" matrix = [[0 for row in range(r)] for col in range(c)] return matrix def direct_multiply(x, y): if len(x[0]) != len(y): return "Multiplication is not possible!"...
true
99405b4bd0a756c18567a7083013fa47dd2d787a
sayali-bamhande/PythonAssignments
/pythonPrograms/Assignment_2/Assignment2_1.py
UTF-8
343
3.59375
4
[]
no_license
from Assignment_2.Arithmatic import * def PerformOperation(n1, n2): print(Add(n1, n2)) print(Sub(n1, n2)) print(Mult(n1, n2)) print(Div(n1, n2)) if __name__ == '__main__': print("Enter first number : ") num1 = int(input()) print("Enter second number : ") num2 = int(input()) Perfo...
true
6f4442c89d223eeeb619e7b2ac40e78bc126f894
ollieennis1966/Group-Studies-
/Cloud_latest.py
UTF-8
13,994
2.953125
3
[]
no_license
from Vector import Vector import numpy as np import matplotlib.pyplot as plt import random from math import sqrt, pi, exp, log10, sin, cos N = int(1e4) # Number of atoms in cloud M = 1.443e-25 # Mass of Rb-87 atom hbar = 1.055e-34 # Planck's reduced constant c = 3e8 # Speed of light in a vacuum k = 1.38e-2...
true
c3d5ea04135d497f43eeba4c0ab15a464e8f20c6
fumiyo0607/my_study
/azest/main_0722.py
UTF-8
17,516
2.625
3
[]
no_license
import pandas as pd import psycopg2 # 接続情報 connection_config = { 'host': '211.1.237.174', 'port': '5432', 'database': 'pushdb', 'user': 'apuser', 'password': 'apuser2018' } # 接続 connection = psycopg2.connect(**connection_config) # mainスクリプト # 各月のデータをDataFrame化 data_for_tableau_2019_02 = fetch_m...
true
f397ce156cadab31fb34ca2fc07a6251c7f00b36
VesnaTrivic/Programsko-inzenjerstvo
/3Vjezba.py
UTF-8
3,025
3.1875
3
[]
no_license
rj = {"a": "alfa", "b": "beta", "o": "omega"} '''print(rj) for k,v in rj.items(): print(k,v)''' import bisect class UredjeniRjecnik(object): def __init__(self, rjecnik = None): self.__kljucevi = [] self.__rjecnik = () if rjecnik is not None: if is...
true
4785e876c9a1140a81726e918696ed616a641132
ljyljy/bachelor-thesis
/BachelorThesis/metrics.py
UTF-8
5,770
3.140625
3
[]
no_license
''' AUTHOR(S): Nicklas Hansen, Michael Kirkegaard Compute performance values for validation and evaluations using TP, FP, TN, FN confusion matrix. This module also extracts those values given a predicted time series yhat and a score series y. ''' from numpy import * import settings def compute_score(y, yhat, timecol...
true
04c83cdde8d8e99697f673d55cdee9b07ded294d
sguba1/Python-Project
/ExtractUsersInfo.py
UTF-8
2,110
2.90625
3
[]
no_license
import CommonFunctions import NavigateAndLogin import Logout import openpyxl from openpyxl.styles import Font def extractUsersInfo(): driver = NavigateAndLogin.LoginApp() wk = openpyxl.Workbook() sh = wk.active sh.title = "User Information" sh['A1'] = 'Username' sh['A1'].font = ...
true
88b384e8c29701b424da792bd81649adc4c0dba4
gsittyz/self_study
/66021/q3.py
UTF-8
2,310
3.09375
3
[]
no_license
import numpy as np passage_name = [" "] + "1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split() def print_space(space, max_i): for i in range(max_i): for j in range(10): print(passage_name[int(space[i][j])], end="") print("\n", end="") def q3(filename): ...
true