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
64d915718b35b9e99bb6d926e96ddc01c17ef4b0
kamyu104/LeetCode-Solutions
/Python/longest-subsequence-repeated-k-times.py
UTF-8
1,373
3
3
[ "MIT" ]
permissive
# Time: O(n * (n/k)!) # Space: O(n) import collections class Solution(object): def longestSubsequenceRepeatedK(self, s, k): """ :type s: str :type k: int :rtype: str """ def check(s, k, curr): if not curr: return True i = 0 ...
true
ad90a6be6af5f11129263eb9c8370c87dc72d9f7
pylaligand/advent_code_2020
/02/main.py
UTF-8
1,291
3.328125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python import argparse from collections import namedtuple import re Entry = namedtuple('Entry', ['password', 'char', 'ref_one', 'ref_two']) def parse_entry(raw_entry): pattern = '(\d+)-(\d+) (\w): (\w+)' match = re.match(pattern, raw_entry) if not match: raise Exception('Could not pa...
true
5d721be16da7b74a379df11d427c77c51b1a06ba
Henry-Benito/sudokuB
/unit_test/test_backtracking.py
UTF-8
1,743
2.890625
3
[]
no_license
import unittest import sys sys.path.append("..\src\\algorithms") from backtracking import Backtracking class TestBacktracking(unittest.TestCase): def setUp(self): self.easy = "003020600900305001001806400008102900700000008006708200" + \ "002609500800203009005010300" self.normal...
true
34f739396243781f18277495ce098df151f85909
YadaYuki/cracking-coding-interview-python
/3/animal-shelter.py
UTF-8
1,732
3.9375
4
[]
no_license
#3.6 from linked_list import LinkedListUnidirectional,NodeUnidirectional import random CAT = 0 DOG = 1 class AnimalShelter: def __init__(self): self.data = LinkedListUnidirectional(CAT) def enqueue(self,animal:int): self.data.append_node(animal) return def dequeue_any(self): ...
true
2219a67618b784db637800b665c008f98c7603c1
HimaAppali/Python
/conditions.py
UTF-8
152
3.828125
4
[]
no_license
n = int(input("Number: ")) print(n, type(n)) if n > 0: print('n is +ve') elif n < 0: print('n is -ve') else: print('n is Zero')
true
580c6848475f4e3024ebc9e1d8aed69cde0874cb
jonathan-brezin/lit-lib
/libpy/lib/singleton.py
UTF-8
1,823
2.90625
3
[]
no_license
import sysutils as su def _copy(self): msg = "'{}' is a singleton class: no copy allowed!" raise AssertionError(msg.format(self.__class__.__name__)) def _deepcopy(self, memo): msg = "'{}' is a singleton class: no deep copy allowed!" raise AssertionError(msg.format(self.__class__.__name__)) def _i...
true
610f1173683a649ff118fa60e1254d8e7228a2cc
vaijinath-waghmare/CS50_Python_Lecture01
/python/functions.py
UTF-8
154
3.546875
4
[]
no_license
def square(x): return x * x; def main(): for i in range(11): print("{} square is {}".format(i,square(i))); if ( __name__ == "__main__"): main()
true
8d9e0699d2630a91d38ba58990d4bc8c97d3602b
ehliang/myo-unlock
/Myo_unlock.py
UTF-8
5,640
2.671875
3
[ "MIT" ]
permissive
#This program takes simple input from the Mio to unlock a complex password string and log in to email #Further developement would allow it to log into social media accounts/computerss #A program by Ethan Liang from __future__ import print_function import myo as libmyo; libmyo.init() import time import sys import smtp...
true
9d6f87757cf2e81af5299e41de3d94f6004bcf7e
nguyenchithien/cs224s-accent-conversion
/tf/simple_feedforward.py
UTF-8
7,129
2.65625
3
[]
no_license
from time import time, gmtime, strftime import numpy as np import os import random import matlab.engine import scipy.io.wavfile as wav from python_speech_features import mfcc import tensorflow as tf from utils.general_utils import get_minibatches, batch_multiply_by_matrix from utils.fast_dtw import get_dtw_series f...
true
ffcb18fd01487418d8475e088f4ad38700c9cf30
ClaudioSiqueira/Exercicios-Python
/Exercicios Python/ex012.py
UTF-8
295
3.234375
3
[ "MIT" ]
permissive
preço = float(input('Qual é o preço do produto ? R$')) desconto = float(input('Qual é a porcentagem do desconto ?')) calculo = preço * desconto/100 final = preço - calculo print('O produto que custava {} reais, fica por {} reias com o desconto de {}%'.format(preço, final, desconto))
true
981f07a20805d145d19b1472cc1560e4c327b36b
alexcatmu/CFGS_DAM
/PRIMERO/python/ejercicio50 aeropuertobien.py
UTF-8
711
2.65625
3
[]
no_license
import os #programa aeropuerto #variables frase = "" frase2 = "" fraseF = "" i = 0 aux = 0 contador = 0 vuelta = False #codigo frase = "hola caracola" contador = 0 while (True): if (i ==len(frase)): i = 0 aux = i while (contador < len(frase)): contador += 1 if (aux ...
true
e551652ed8e37a764ce68a10747e3c29a3fe1e94
lux182/instagram-scraper
/instagram_scraper/tests/test_instagram.py
UTF-8
1,796
2.71875
3
[ "Unlicense" ]
permissive
import unittest import os import shutil import tempfile import requests_mock from instagram_scraper import InstagramScraper from instagram_scraper.constants import * class InstagramTests(unittest.TestCase): def setUp(self): fixtures_path = os.path.join(os.path.dirname(__file__), 'fixtures') self.r...
true
b827f460a27979d417d1d07adbaebb57735681a4
Mogg01/tutorials
/ml_containers/neuron_types.py
UTF-8
2,037
2.53125
3
[]
no_license
# from tensorflow.keras import Model, Sequential # from tensorflow.keras.layers import Dense, Flatten, InputLayer, Reshape import numpy as np from keras import Model, Sequential from keras.layers import Dense, Flatten, InputLayer, Reshape, Conv2D class PathNeuron(Model): def __init__(self): super(PathNeur...
true
033c77ea9181e2d21648c092372b7e613bc9e7ce
bettybhzhou/InstaF_Python
/InstaF_Python/laplacian_edge_detecting.py
UTF-8
649
2.96875
3
[ "MIT" ]
permissive
import numpy as np import skimage.io def laplacian_edge_detecting(input_image, output_image): ''' Perform laplacian filtering on the image to get the secondary derivitive of the image matrix, based on the defined input path Inputs ----- input_path: string, path for an image file in .png format ...
true
c6296b2aeae1bc2c321d0eb3e14bfc9e97127207
jamesamrundle/Teaching-Code
/testturdle.py
UTF-8
5,458
3.421875
3
[]
no_license
import turtle ### code for visual teaching tool for introductory coding skills ######### running as is, lets user draw simple rectagles for maps. clicking upper left corner and lower right corner to draw rectangle ###if map is drawn, and user uses original control methods (excluding forward) and created move(turtle,bl...
true
a1104206bcd27bd31555df5ba6e643cf3bae9dee
akshat1198/keyTrace
/code.py
UTF-8
388
2.84375
3
[]
no_license
import cv2 import matplotlib.pyplot as plt image = cv2.imread('key.jpg') key = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) #the following are filters, change the #values to allow/block certain colors min = (0, 0, 0) max = (255,255,150) filtered_key = cv2.inRange(key, min, max) plt.subplot(1, 2, 1) plt.imshow(key) pl...
true
42acac516372e9595c002a0c16c049878ac818f2
Oloshka/PyLaTeX
/pylatex/table.py
UTF-8
1,866
3.28125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ pylatex.table ~~~~~~~ This module implements the class that deals with tables. :copyright: (c) 2014 by Jelte Fennema. :license: MIT, see License for more details. """ from .utils import dumps_list from .base_classes import BaseLaTeXContainer from collections import Co...
true
cc03d0e4c3875389940b9cfd28e661fdc6e1f627
KratosMultiphysics/Kratos
/applications/FluidDynamicsApplication/python_scripts/symbolic_generation/compressible_navier_stokes/src/defines.py
UTF-8
1,157
3.0625
3
[ "BSD-3-Clause" ]
permissive
import sympy class CompressibleNavierStokesDefines: matrix_format = None vector_format = None @classmethod def SetFormat(cls, language): formats = { 'python': ("{name}[{i},{j}]", "{name}[{i}]"), 'c' : ("{name}({i},{j})", "{name}({i})") } if language...
true
171df28127032ea9f3106367920bf28bde0f26b9
teamzz111/Python-Solutionary
/CHAPTER-1/Python overview - pg 14/5.py
UTF-8
251
3.578125
4
[ "Unlicense" ]
permissive
# How many years would it take to travel to Andromeda Galaxy # Var declarations andromeda_away = 2900000.0 light_year_perMile = 5.878 * 10 ** 12 # Code away_mile = andromeda_away * light_year_perMile result = away_mile / 65 # Result print(result)
true
fde0d890c9c76b75a47170f0e0f3e265745d5c91
fewtrem/NeuralModels
/Core/STDPPlotter.py
UTF-8
641
3.296875
3
[]
no_license
''' Created on 18 Feb 2016 @author: s1144899 ''' import numpy as np, math def STDPDist(x,beta): #return x/(5*np.power(x,2)+1) # Old function (too symetrical peak) #return x*np.power(np.e,-beta*x*x) return x*np.power(np.e,-beta*np.power(np.abs(x),0.5)) import matplotlib.pyplot as plt def addToPlot(...
true
e3752eed4011d883e65e71049582037431a7fba8
LittleBitApps/WiFi-led-control
/Example_server_Flask/post_request_trial.py
UTF-8
151
2.5625
3
[]
no_license
import requests r = requests.post("http://localhost:5000/color", data={'color': "ff45ff"}) print(r.status_code, r.reason) print(r.text[:300] + '...')
true
50ce0085c6fac6e305b889f37211e7fc7107feed
hacktoolkit/code_challenges
/companies/facebook/smallworld/smallworld2.py
UTF-8
4,192
3.53125
4
[ "MIT" ]
permissive
""" smallworld2.py author: Jonathan Tsai <hello@jontsai.com> date: 2009.04.23 Facebook Engineering Puzzle - It's A Small World Usage: python smallworld2.py FILE This problem is a k-Nearest Neighbor problem This file uses a straightforward, O(n^2) approach """ import sys import getopt class Usage(...
true
bdec30d3b252e04335e00d0ab2b52d3472ecb402
zhangjinqiaoSimon/alien_invasion
/coreboard.py
UTF-8
2,199
3.15625
3
[]
no_license
import pygame.font from pygame.sprite import Group from ship import Ship class Scoreboard(): def __init__(self,ai_settings,screen,stats): #初始化显示得分涉及的属性 self.screen = screen self.screen_rect = screen.get_rect() self.ai_settings = ai_settings self.stats = stats #设置显示得分的字体和颜色 self.text_color = (30,30,30...
true
0aa12786bc85fcda3c1fc43d60aee364d2b7ec90
seeseeatre/RL_Covering_Path
/gym-master/gym/envs/box2d/test_car_racing.py
UTF-8
967
2.59375
3
[ "MIT" ]
permissive
import os import shutil from gym.envs.box2d.car_racing import CarRacing def manual_check_of_not_allowing_touching_tracks(): path = './touching_tracks_tests' # Check if dir exists TODO if os.path.isdir(path): # Remove files TODO shutil.rmtree(path) # Create dir TODO os.mkdir(path) ...
true
e245b98f2439c00a5e2b63d05912f92bf76b9501
nupurkmr9/compare_gan
/compare_gan/architectures/aux_network.py
UTF-8
3,375
2.53125
3
[ "Apache-2.0" ]
permissive
"""Implementation of auxiliary network.""" from compare_gan.architectures.abstract_arch import _Module from compare_gan.architectures.arch_ops import linear import tensorflow as tf # Non-Linear 2 layer MLP Network class Aux_Network_v1(_Module): """Aux Network architecture""" def __init__(self, name="aux_network...
true
ede3108eff662b6a26fca69d02107af58b9e18c4
zhouyangpkuer/simdbatch-memory
/traffic/latency_batchsize.py
UTF-8
678
2.59375
3
[]
no_license
f_raw = open("latency_batchsize_raw.dat", "r") f_draw = open("latency_batchsize.txt", "w") # batchsize = [32, 64, 128, 256, 512, 768, 1024, 1280, 1536, 1792, 2048] for i in xrange(0,7): a = 0.0 b = 0.0 c = 0.0 d = 0.0 l = f_raw.readline().split() l = f_raw.readline().split() l = f_raw.readline().split() a ...
true
f87529622dc4d14906cdf6d1e1b4904495dea917
taowangtu/scrapingDemo
/scrapingDemo/bs_decode_demo.py
UTF-8
349
2.9375
3
[]
no_license
""" 使用BeautifulSoup和python3.x对文档进行utf-8编码 """ from bs4 import BeautifulSoup from urllib.request import urlopen bsObj=BeautifulSoup(urlopen("https://en.wikipedia.org/wiki/Python"),"lxml") content=bsObj.find("div",{"id":"mw-content-text"}).get_text() content=bytes(content,"UTF-8") content=content.decode("utf-8") print(...
true
113efe4e2209a2e4070919aaabdb3a4e5e3f42aa
insight-infrastructure/nukikata
/tests/render/test_default_extensions.py
UTF-8
2,432
2.5625
3
[ "BSD-3-Clause" ]
permissive
"""Verify Jinja2 filters/extensions are available from pre-gen/post-gen hooks.""" import os import freezegun import pytest from cookiecutter.main import cookiecutter @pytest.fixture(autouse=True) def freeze(): """Fixture. Make time stating during all tests in this file.""" freezer = freezegun.freeze_time("2...
true
783dd1efcbaa72bee0b7599e41bad74577b60a63
etal/cnvkit
/skgenome/tabio/tab.py
UTF-8
935
3.390625
3
[ "Apache-2.0" ]
permissive
"""I/O for tab-delimited format with an initial header row. Column names match the target class attributes. At least "chromosome", "start", and "end" are required. """ import logging import pandas as pd def read_tab(infile): """Read tab-separated data with column names in the first row. The format is BED-l...
true
ddfc58bdafbb989871712c43003b2ff73d5d1de7
whisperH/AlgorithmsAndMeachineLearning
/RecursionAndDivision/divideInteger.py
UTF-8
2,885
3.734375
4
[]
no_license
''' 整数划分问题: n:需要划分的正数 maxAddFactory:划分因子中数值最大的因子 a.=========================m无限制============================== 1.当 n 或者 maxAddFactory 有一个小于1时,该问题无法划分,0种组合。 2.当 n 或者 maxAddFactory 有一个为1时,就只有一种可能,即全由 1 组成 3.当 n < maxAddFactory 时,此时最大的划分因子为 n 而非 maxAddFactory 4.当 n = maxAddFactory 时,4.1 + 4.2 的结果 4.1...
true
3f733a267bef50992b04e1e09f2f193ddaaf97d5
Kauko/kiigameEditorServer
/server.py
UTF-8
9,239
2.765625
3
[ "BSD-3-Clause" ]
permissive
import os from flask import (Flask, request, send_from_directory, abort, jsonify, render_template) from werkzeug import secure_filename VERBOSE = True UPLOAD_FOLDER = 'static/uploads' # Folder where resources that are shared between all games are stored COMMONS_FOLDER = 'static/commons' JAVASCRIPT_F...
true
27422f1b804997d5463260790f8f79c0a2c79a9b
jjrsoong/warmup_project
/scripts/wall_follower.py
UTF-8
4,065
3.1875
3
[]
no_license
#!/usr/bin/env python3 import rospy #msg needed for /scan from sensor_msgs.msg import LaserScan # msgs needed for /cmd cmd_vel from geometry_msgs.msg import Twist from geometry_msgs.msg import Vector3 from math import radians # How close we will get to wall. distance = 0.5 class WallFollower(object): def __in...
true
a1c757acbb70adeb368811efec32b5100da2d17a
daigoor/devi
/control.py
UTF-8
1,194
2.96875
3
[]
no_license
#!/usr/bin/env python """control.py: controls all the movements of the vehicle & camera motors.""" __author__ = "DaiGooR" __copyright__ = "Copyright 2019, DaiGooR" import constants import controls.vehicle as vehicle import controls.camera as camera class Vehicle(): def move(self, direction, movement): ...
true
2699363467c427f897df7f8738b8198f55a9e0d0
bopopescu/Python-13
/Bibliotecas-Python/tkinter - João ribeiro/015 - definir e alterar propriedades de um label.py
UTF-8
1,216
3.484375
3
[]
no_license
from tkinter import * def fun(n): if n: label2['text'] = 'Acionei a função' label2['font'] = 'Cambria 20' for item in label2.keys(): print(item, ' : ', label2[item]) else: label2['text'] = 'frase de teste' label2['font'] = 'Calibri 20' for item in la...
true
0fb17c5221e38882f722ccaa3187e2e376673416
mcclosr5/Python-code
/count_102.py
UTF-8
152
3.328125
3
[]
no_license
#!/usr/bin/env python3 def count_letters(s): if len(s) == 0: return 0 else: return len(s) + count_letters(s[len(s):])
true
7f2c47610942ac2f09195710835114946ac36196
JadeHendricks/learn-python
/variables-and-datatypes.py
UTF-8
301
3.734375
4
[]
no_license
character_name = "John" character_age = 35 is_Male = True print('There once was a man named' + character_name + ', ') print('he was ' + character_age + ' years old. ') character_name = "Mike" print('He really liked the name ' + character_name + ', ') print('but didnt like being ' + character_age)
true
62490e10ec74a64605a26b5be52501e1a186f678
13leaf/exercises
/leetcode/python/easy/isomorphic_strings.py
UTF-8
561
3.390625
3
[]
no_license
#https://leetcode.com/problems/isomorphic-strings/ class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ def compilePattern(s): containChars = {} i = 0 pattern = [] for x in...
true
e663676d65454d628e84305a240f9a8d42188e33
missmaelyss/npuzzle
/npuzzle.py
UTF-8
14,228
3.0625
3
[]
no_license
#!/usr/bin/env python # -*-coding:Utf-8 -* import pickle from tkinter import * from collections import OrderedDict import time class variable: def __init__(self, val): self.variable = val def Change(self, newVal): self.variable = newVal def Add(self, add): self.variable += add def Int(self): retu...
true
4e8fcd9e7e250a20d7d055dd2a13f8fc9ffe1887
mack/machine-learning
/NN/inputs.py
UTF-8
557
2.953125
3
[]
no_license
import graph class placeholder(object): """ Represents a placeholder input node thats provided a value when computing output of a graph """ def __init__(self): self.consumers = [] # add to global var _default_graph graph._default_graph.placeholders.append(self) class Varia...
true
96cfa639ea53aa7f010bba56912e811fc0a11982
armaanhammer/pseduo-IRC
/scratch/second test/tms.py
UTF-8
2,322
3.03125
3
[]
no_license
# -*- coding: utf-8 -*- # simple illustration client/server pair; client program sends a string # to server, which echoes it back to the client (in multiple copies), # and the latter prints to the screen # this is the server import argparse import socket import sys print ('script started') stored_exception=None de...
true
d7ccc4e1884687825bb6a936e902f2697580a157
JohnVanNote/heap-pqueue
/make_heap.py
UTF-8
225
2.921875
3
[]
no_license
#!/usr/bin/env python class Heap: def __init__( self ): self.heap = [] def __init__( self, heap ): if heap == [] or None: self.heap = [] return for items in heap: self.heap.insert( items )
true
41dd8df6f59da6709d6ecbfc2eff68cbdc78ce84
lucasSaavedra123/informaticaGeneral
/Practica/Practica 6/Ejercicio 6.py
UTF-8
795
3.484375
3
[]
no_license
def validacion(n): while not n - int(n) == 0: n = float(input("ERROR!:")) return int(n) def ordenarLst(lst): for i in range(len(lst)): for ix in range(len(lst)): if lst[i] < lst[ix]: memoria = lst[i] lst[i] = lst[ix] ...
true
2c36d2e38eff1e28f25d620dfd0edeecf01d37c3
zjj609/ProjectEulerPractices
/before50/p41.py
UTF-8
420
3.203125
3
[]
no_license
''' lis = {} n = 1000000000 for i in xrange(2,n): print i if not i in lis: lis[i] = 1 k = i*2 while k < n: lis[k] = 0 k += i print k ''' import math def IsPrime(a): if a <= 1: return False for i in xrange(2,int(math.sqrt(a)) + 1): if a % i == 0: return False return True for x in xrange(7654...
true
e88af57f0a07787f5a9cab3ec79e9e0707406ac8
maoxx241/code
/Sort_Colors/Sort_Colors.py
UTF-8
986
3.125
3
[]
no_license
class Solution: def sortColors(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ # count=[0,0,0] # for num in nums: # count[num]+=1 # count[1]+=count[0] # count[2]+=count[1] # ...
true
0ebe9aea0ed5c87df0b4ce55fc9a8e6f961515fb
wilsonvetdev/IS211_Assignment9
/nfl_spreads.py
UTF-8
408
2.90625
3
[]
no_license
import requests from bs4 import BeautifulSoup from pprint import pprint if __name__ == '__main__': url = 'http://www.footballlocks.com/nfl_point_spreads.shtml' page_response = requests.get(url) page = page_response.content soup = BeautifulSoup(page, 'html.parser') table_rows = soup.selec...
true
f7630c73d45f099a918d4f0b8c3356a17b28f289
supamunkey/Competitive-Programming
/src/codewars/python/PokemonGoBeta.py
UTF-8
1,299
3.25
3
[]
no_license
def pidgeyToCandy(pidgey, candy): pass def pidgeyCalc(pidgey, candy): expSum = 0 if candy < 12: candy_needed = 12 - candy if pidgey > candy_needed: candy += candy_needed pidgey -= candy_needed print "There was a difficiency from the start" p...
true
84a9fe84ca8cca57324509fd71dd7239ca39d62a
gugarosa/opytimizer
/examples/math/general_purpose.py
UTF-8
375
3.171875
3
[ "Apache-2.0" ]
permissive
import opytimizer.math.general as g # Creates a list for pairwising individuals = [1, 2, 3, 4] # Creates pairwise from list for pair in g.n_wise(individuals, 2): # Outputting pairs print(f"Pair: {pair}") # Performs a tournmanet selection over list selected = g.tournament_selection(individuals, 2) # Outputti...
true
b695d234851c0b91e89de2a653ac2735c3118718
seObando19/holbertonschool-higher_level_programming
/0x06-python-classes/1-square.py
UTF-8
291
3.421875
3
[]
no_license
#!/usr/bin/python3 """ Write a class Square that defines a square. """ class Square: """ function inizialited """ def __init__(self, size): self.__size = size """ Square that defines a square """ def retrieve(self): return self.__size ** 2
true
cbdfa6fd69d38f24e29d83f86daa4403ebbf6fe6
doesnotcompute10/HexagonTurtleIllusion
/InfiniteHexagonChoice.py
UTF-8
813
3.515625
4
[]
no_license
import turtle loop=200 turtle.speed(20000) turtle.showturtle() for i in range(0,68): for j in range(0, 3): turtle.forward(loop) turtle.right(60) turtle.forward(10) turtle.right(1) loop = loop-3 turtle.penup() turtle.home() turtle.pendown() loop=200 for i in range(0,68): ...
true
f6445aa0d4fcd3fbff30f73a3c7bd69cd40180c2
emkcosta/HRNet-Human-Bird-Pose-Estimation
/lib/core/evaluate.py
UTF-8
4,420
2.578125
3
[ "MIT" ]
permissive
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # ------------------------------------------------------------------------------ from __future__ import absolute_import from __futu...
true
017f8ea18fcbe240ed6f7a93eb330fced9f0efc6
dmicanzerofox/workshop-koans
/workshopkoans/factories/views.py
UTF-8
1,247
2.546875
3
[]
no_license
from abc import abstractmethod, ABCMeta import json from django.http import HttpResponse from django.shortcuts import render def post_retriever(request): """ Given a network and a post_id retrieves data using that networks API for the post_id :param request: :return: """ network = request...
true
0e0a449ec56907bb7a654690c0ae35cf46472c56
TamaWilson/FOTOXOP
/photo/views.py
UTF-8
10,836
2.703125
3
[]
no_license
from django.core.files.storage import FileSystemStorage from django.views.decorators.csrf import csrf_exempt from django.shortcuts import render, redirect, render_to_response from PIL import Image import PIL.ImageOps from PIL import ImageEnhance #Função chamada ao requisitar a view do index def index(request): #...
true
54a7fe6be50069d3679c851f4c2814df4b843841
shoriwe/Tools
/Pythonista/KB_shortcuts/functions_eval/crunch.py
UTF-8
1,590
3.296875
3
[ "MIT" ]
permissive
from string import ascii_letters, digits, punctuation, whitespace from time import time class Crunch: def __init__(self, letras=ascii_letters + digits + punctuation + whitespace, remover=''): self.letras = letras for caracter in remover: self.letras.replace(caracter, '') self.tam...
true
0ba5448d52382a684a7fb8eee71695430041ee6a
pharmaDB/dailymed_data_processor
/spl/history.py
UTF-8
2,754
2.953125
3
[ "Apache-2.0" ]
permissive
import concurrent.futures import os import requests from utils.logging import getLogger _logger = getLogger(__name__) class SplHistoryResponse: """ Used to retrieve and process a DailyMed setid's history JSON data. https://dailymed.nlm.nih.gov/dailymed/services/v2/spls/{set_id}/history """ BAS...
true
ea007c8f4b499227c4ca8f23eef7a4903acd0966
waikato-datamining/wai-bynning
/src/wai/bynning/binners/_Binner.py
UTF-8
1,872
3.375
3
[ "MIT" ]
permissive
from abc import abstractmethod from typing import Generic, Iterator, Iterable, Tuple from .._Bin import Bin from .._Binning import Binning from .._typing import KeyType, LabelType, ItemType class Binner(Generic[KeyType, LabelType]): """ Interface for classes which sort binnable items into bins via their ...
true
128252dfeda046ff68444a4ed97fb05fff43433d
juanengml/Sistema_de_Monitoramento_de_Salas_GPIOT-UTFPR-TD
/mqtt/app.py
UTF-8
2,220
2.890625
3
[]
no_license
import numpy as np import pandas as pd from random import shuffle from flask import Flask,render_template,request import pygal from pygal.style import DarkStyle # "bloco/E/lab/302/SENSOR/JANELA/1" def entrada(): passagem = pd.read_csv('passagem.csv') tamanho = len(passagem) atual = (np.array(passagem[tamanho-1:...
true
a345df9eec51737b3a4244e3f533746d59ee739e
Annihilater/interview
/eight_sorting_algorithms/__init__.py
UTF-8
1,899
3.5625
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2019/12/18 6:03 下午 # @Author: yanmiexingkong # @email : yanmiexingkong@gmail.com # @File : __init__.py import copy import random import time from typing import List def bubble_sort(l: List) -> List: if len(l) == 0 or len(l) == 1: return l for i...
true
094a6dc584afcf6d02419208d63a7c98ccaa20a1
GabrielVioli/Classifica-o-de-vinhos
/vinhos.py
UTF-8
977
3.078125
3
[]
no_license
import pandas as pd from pandas.core.frame import DataFrame from sklearn.model_selection import train_test_split from sklearn.ensemble import ExtraTreesClassifier main_file = pd.read_csv(r'C:\Users\gabri\OneDrive\Área de Trabalho\code\format_files\vinho.csv') dataframe = DataFrame(main_file) dataframe['style'] = dat...
true
47f12865a2e35482002f13660efe9681594c9c54
yinxingren0219/RaptorQ-Python
/raptorq/tables.py
UTF-8
730
3.046875
3
[]
no_license
from __future__ import with_statement import csv import bisect #Section 5.6, Table 2 # K' -> (J(K'), S(K'), H(K'), W(K')) def load_56t2(): table_data = dict() with open('table_5_6_t2.txt', 'rb') as f: reader = csv.reader(f, delimiter='|') for row in reader: table_data[...
true
5f29f7f344874aaed6345d96be27e59fdad53062
Moneystuff55/Sprint-1
/Robot Upgrade.py
UTF-8
6,479
3.171875
3
[]
no_license
import sqlite3 conn = sqlite3.connect('RoboData.db') c = conn.cursor() def create_table(): c.execute('CREATE TABLE IF NOT EXISTS roboData (Zero REAL, One REAL) ') def data_entry1(): c.execute("INSERT INTO roboData VALUES(1,9)") conn.commit() def data_entry0(): c.execute("INSERT INTO roboData VALUES(...
true
9f3c5967b59f2a081b08f212d074059d12cf4ff9
touilleMan/briefcase
/tests/commands/update/test_update_app.py
UTF-8
3,006
2.78125
3
[ "BSD-3-Clause" ]
permissive
def test_update_app(update_command, first_app): "If the app already exists, it will be updated" update_command.update_app(update_command.apps['first']) # The right sequence of things will be done assert update_command.actions == [ ('code', update_command.apps['first']), ] # App conten...
true
fbe7418d3e0885abf25c1c6ddf8ff56327ca7681
Nooruz2203/Chapter1-Part2-Task5
/Task5.py
UTF-8
324
3.984375
4
[]
no_license
print ("Number of students in first class: ") a = int(input()) print ("Number of students in second class: ") b = int(input()) print ("Number of students in third class: ") c = int(input()) x = a+b+c y = (x // 2)+(x % 2) print("Total number of students :", x, "students") print("The number of desks we need", y, "desks...
true
6b1d86b4212e69fc06e87474469eb99e01ba6fb1
ry3s/atcoder
/abc032/a.py
UTF-8
350
3.390625
3
[]
no_license
import math def gcd(m, n): x = max(m, n) y = min(m, n) if x % y == 0: return y else: while x % y != 0: z = x % y x = y y = z else: return z a = int(input()) b = int(input()) n = int(input()) lcm = (a * b) // gcd(a, b) x = math....
true
db771a736d2ad6368a2786ea7aa9b0bbff2d8d21
Harshxz62/CourseMaterials
/SEM 5/Python Application Programming/Unit 2/regex.py
UTF-8
1,801
3.171875
3
[]
no_license
''' Metacharacters (Need to be escaped) .[]{}()^$|?*+\ ''' import re text_to_search = """ tanishqvyas0692gmail.com 1234567890101 22-2-2--2-2 a222-333-444 111-222-444 000-003-787 abcdefghijklmnoq """ # pattern = re.compile( WRITE UR PATTERN HERE) pattern = re.compile(r"a(\d{3})[-](\d{3})[-](\d{3})") pattern...
true
d48f1dce4f905f771b9080ecb47b9f429e384379
Bhaney44/Math
/Remainders.py
UTF-8
197
3.71875
4
[]
no_license
#Remainders #In Python % is a modulus #Returns the remainder when the first operancd is divided by the second u = 17 % 6 print(u) p = 12 % 6 print(p) r = 18 % 6 print(r) v = 9 % 6 print(v)
true
b8a82744835b40c8ee38f7c0c41aad2f53025d33
lmasikl/jira-to-gsheets
/google_adapter.py
UTF-8
1,128
2.5625
3
[]
no_license
# -*- coding:utf-8 -*- from __future__ import unicode_literals from googleapiclient import discovery from httplib2 import Http from oauth2client.service_account import ServiceAccountCredentials class Adapter(object): scope = ['https://www.googleapis.com/auth/drive'] def __init__(self, credentials_json, shee...
true
1aefe4aada48773a4a8a26410f82a478076a7116
holdeelocks/Intro-Python-II
/src/adv.py
UTF-8
4,444
3.46875
3
[]
no_license
from room import Room from player import Player from item import Item, Weapon # Declare all the rooms room = { 'outside': Room("Outside Cave Entrance", "North of you, the cave mount beckons"), 'foyer': Room("Foyer", """Dim light filters in from the south. Dusty passages run north an...
true
aa4236af96f789d3f3a663a22a8b8d81d4b9f499
crodriguezmer/DM_examples
/behavior/wmitcbehavior.py
UTF-8
8,270
2.71875
3
[]
no_license
# coding: utf-8 ## script set up # import all the necesary modules import pandas as pd import numpy as np import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt import statsmodels.api as sm, statsmodels.formula.api as smf from os import chdir, getcwd from glob import glob from scipy impo...
true
d513d1c7a1482e7123463fc44d4efed05af9a196
oc0de/pyEPI
/9/13.py
UTF-8
648
3.34375
3
[]
no_license
from binary_tree_node import BinaryTreeNode def reconstruct_preorder(preorder): def reconstruct_preorder_helepr(preorder_iter): subtree_key = next(preorder_iter) if subtree_key is None: return None left_subtree = reconstruct_preorder_helepr(preorder_iter) right_subtree = reconstruc...
true
5e268295976761ec862293a0b2b28a6a40a6a583
WKD622/author-identification-rnn
/library/network/output_manager.py
UTF-8
4,194
2.546875
3
[]
no_license
import datetime import os import torch from library.helpers.files.files_operations import append_to_file, create_directory, create_file class OutputManager: EPOCH = 'epoch' LOSS = 'loss' ACCURACY = 'accuracy' MODEL = 'model' RESULTS_FILENAME = 'results.csv' NETWORK_INFO_FILENAME = 'network_i...
true
088209da55e4914c099545739b3d3a37cfcaf204
Rodrigo-P-Nascimento/Python
/ex113.py
UTF-8
863
4.3125
4
[]
no_license
def leiaInt(msg): while True: try: n = int(input(msg)) except (ValueError, TypeError): print("\033[31mERRO! Digite um valor inteiro válido.\033[m") continue except KeyboardInterrupt: print("A entrade de dados foi intenrrompida pelo usuá...
true
eda1bbba6d915d260309108fa9078d16f8e6b82a
wang8063/Python
/ex3e.py
UTF-8
627
3.9375
4
[]
no_license
import math def gcd(a,b): if a>b: r=a%b if r != 0: a=b b=r while a%b!=0: r=a%b a=b b=r else: b=a return(b) def main(): a=abs(int(input("enter first value: "))) while a!="": ...
true
53f8150fa707857f9399ee914a2d6e4e3c157bf6
joonluvschipotle/baekjoon
/1546.py
UTF-8
232
3.359375
3
[]
no_license
n = int(input()) dfdf = input().split() list1 = [] for i in range(0,n): list1.append(int(dfdf[i])) maxi = max(list1) total = 0 for i in range(0,n): total += (list1[i]/maxi)*100 ans = total/n print("%.2f" % round(ans,2))
true
15160a99b8ddfcb5e960f60d47d76f1dd4609934
jenniferjadon/Jenni
/natur.py
UTF-8
58
3.09375
3
[]
no_license
r=int(input()) a=0 for i in range(0,r+1): a=a+i print(a)
true
514bdf6f7c9216c8f6b32308107e08fe74e161c4
princebaretto99/Recipe_Scraper
/Scrapers/all_recipes.py
UTF-8
4,347
3
3
[]
no_license
# Scraping Recipes - All Recipes import html from urllib.request import Request,urlopen from bs4 import BeautifulSoup as soup import pandas as pd import numpy as np import json base_url = 'https://www.allrecipes.com/recipes/?page=' recipe_titles = [] recipe_img_links = [] recipe_ingredients = [] recipe_intructions =...
true
b1df2a48662e837a387b4883f28195737038c4fa
therocket290/set_card_finder_EDGETPU
/set_finder_EDGETPU_script.py
UTF-8
8,410
2.53125
3
[]
no_license
#import stuff import cv2 import tflite_runtime.interpreter as tflite import numpy as np import matplotlib.pyplot as plt #import IPython.display as display from PIL import Image import os #from keras.preprocessing.image import load_img from numpy import asarray import pandas as pd from itertools import combinations ...
true
48dc778415f1c58f3f8bc3bb13b23989e2dd19c6
yoncho/OpenCV-code
/studio_on_video_opencv.py
UHC
1,106
2.578125
3
[]
no_license
import cv2 import numpy as np capture = cv2.VideoCapture("testvideo.avi") width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT)) videoWriter = cv2.VideoWriter() isWrite = False while True: ret, frame = capture.read() if(capture.get(cv2.CAP_PROP_POS...
true
ea6528180e0ae9d6a10df6d3aa5813782a9eb44c
iangow/se_features
/fls/fls_functions.py
UTF-8
877
2.84375
3
[]
no_license
import nltk, re from collections import Counter from ling_features import fog, fog_agg, fls, tone_count # Function to aggregate fog over a list of texts def tone_agg(texts, prefix=""): counter = Counter() for text in texts: counter.update(tone_count(text)) return { (prefix + key):counter[key...
true
7d5182dce9492dae69b311952453f2f025b01274
tusharkailash/GeeksForGeeksProblems
/Sorting_Algorithms/merge_sort.py
UTF-8
2,097
4.75
5
[]
no_license
### MergeSort ### #https://www.youtube.com/watch?v=TzeBrDU-JaY #Pseudo code: # MergeSort(arr[], l, r) # If r > l # 1. Find the middle point to divide the array into two halves: # middle m = (l+r)/2 # 2. Call mergeSort for first half: # Call mergeSort(ar...
true
a242ecc8e64a237693ef77d82cfc8aa2cb74616e
zhuqiangLu/leetcode
/KMP.py
UTF-8
2,077
3.1875
3
[]
no_license
class Solution: def strStr(self, haystack: str, needle: str) -> int: def findNext(pat): # nex[i] mean the longgest prefix == suffix before i-th char in pat patLen = len(pat) k = -1 j = 0 nex = [0 for _ in range(patLen)] ...
true
f09d63c0ee37ada7cf6d6b508afcc3b262122a11
daphshez/codejam
/2020toio/q1.py
UTF-8
653
3.75
4
[]
no_license
t = int(input()) for i in range(1, t + 1): s = input() available_capital_o = 0 available_small_o = 0 count = 0 for c in reversed(s): if c == 'i': if available_small_o > 0: available_small_o -= 1 else: available_capital_o -= 1 if...
true
ea681d6deb8bc70b480c3726f7dd692c7716fa63
tarun201/news
/ml_python/app.py
UTF-8
3,940
2.65625
3
[]
no_license
from flask import Flask,jsonify import json import serpy from flask_restful import Api, Resource, reqparse import mysql.connector import pandas as pd #news.head(); from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import linear_kernel from stop_words import get_stop_words import ...
true
b9bfcd0ea2d5a8bd1412f73bd5958db9f74ee62b
realnoobie/dirganize
/dirganize/cli.py
UTF-8
1,592
2.765625
3
[ "MIT" ]
permissive
"""Command line interface for dirganize.""" import logging import os from typing import Optional import typer from rich.logging import RichHandler from dirganize import __version__ from dirganize.dirganize import dirganize app = typer.Typer(add_completion=False) def version_callback(value: bool): """Show curr...
true
420a3932a3e0dcc0eebdae3e8019a5161d630e7f
benmoose/Gatekeeper
/gatekeeper/db/verification/interface/verification_code_layer_test.py
UTF-8
2,246
2.65625
3
[]
no_license
from datetime import datetime, timedelta import pytest import pytz from django.db import IntegrityError from ..models.verification_code import VerificationCode from .verification_code_layer import ( create_verification_code, get_active_verification_codes_for_phone_number, invalidate_verification_code, ) ...
true
163b8579a841a3c3e9a965b16998f0974ee231e5
yuliachen/Single-blind-test-of-airplane-based-hyperspectral-methane-detection-via-controlled-releases
/github_version/functions/LOESS.py
UTF-8
10,535
3.015625
3
[]
no_license
import numpy as np import pandas as pd import scipy from github_version.functions.parity import * from scipy.stats import norm def loc_eval(x, b): """ Evaluate `x` using locally-weighted regression parameters. Degree of polynomial used in loess is inferred from b. `x` is assumed to be a scalar. """...
true
dc024ef0c757cbb3b9780e4968ce369fd6a9ff53
ftrcn/python
/föyler/ardisik_toplam.py
ISO-8859-1
278
2.96875
3
[]
no_license
# -*- coding: cp1254 -*- #!/usr/bin/python def ardisik_toplam(n): x=0 if n>0 and type(n)==type(int(n)): while n: x=x+n n=n-1 print x else: print "Ltfen pozitif bir tamsayi giriniz."
true
a12f22d963c1caf7d93e66160877d5ec798de802
rangelrey/timeSeriesAnalysis
/timesSeriesAnalysis.py
UTF-8
150,465
3.953125
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Numpy Reminders: # Let's have a look at some of the most basic numpy concepts that we will use in the more advanced sections # In[1]: import numpy as np import datetime as datetime from matplotlib import dates import pandas as pd # ## Numpy Creating data # In order to te...
true
52ad2987aa7a25dfd9dd2de1b6aa3e4a6360f347
jpolache/codewars
/rdw.py
UTF-8
389
3.09375
3
[]
no_license
def remove_duplicate_words(s): op = [] for item in s.split(): if item not in op: op.append(item) return " ".join(op) remove_duplicate_words("alpha beta beta gamma gamma gamma delta alpha beta beta gamma gamma gamma delta") remove_duplicate_words("my cat is my cat fat") ''' def remove_...
true
8bd3aeedcbe0e137d989b6cd9a9d9d04b3a8a549
ndau/commands
/bin/predict.py
UTF-8
8,453
2.984375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python # ----- ---- --- -- - # Copyright 2019 Oneiro NA, Inc. All Rights Reserved. # # Licensed under the Apache License 2.0 (the "License"). You may not use # this file except in compliance with the License. You can obtain a copy # in the file LICENSE in the source distribution or at # https://www...
true
5f7a80507a6e1bd4fa469ede421ee68e979fac69
npithani/internet-techology
/it_project1/client.py
UTF-8
3,319
2.8125
3
[]
no_license
import threading import time import random import sys import socket # get command line arguments parameter1 = sys.argv[1] parameter2 = sys.argv[2] parameter3 = sys.argv[3] rsHostname = parameter1 rsListenPort = parameter2 tsListenPort = parameter3 def client(): # Read hostnames into an array, line-by-line from...
true
26b083f1ee4923cf346c17ac5858a657d5bb4284
AngeloESFM/All_programs
/Funciones_de_las_ cadenas.py
UTF-8
1,417
4.5625
5
[]
no_license
#TRABAJAMOS CON CADENAS DE TEXTO # Las cadenas pueden ser tratadas como listas cadena = "Hola AcademiaCoder" # H o l a A c a d e m i a C o d e r # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # ... -3 -2 -1 # Se escoge la posición que queremos mostrar entre corchetes # nombre...
true
2c7575fb3492595bb97e9f2cb42d945c955efd28
algorithm005-class01/algorithm005-class01
/Week_06/G20190343020242/LeetCode_37_0242.py
UTF-8
2,524
3.453125
3
[]
no_license
# # @lc app=leetcode.cn id=37 lang=python3 # # [37] 解数独 # # https://leetcode-cn.com/problems/sudoku-solver/description/ # # algorithms # Hard (58.24%) # Likes: 292 # Dislikes: 0 # Total Accepted: 16.9K # Total Submissions: 28.7K # Testcase Example: '[["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5"...
true
761a32c9b576b7aa5f66bd8e869fe27a771cb200
DaToo-J/NotesForBookAboutPython
/剑指offer/linkList/25_mergeTwoLists.py
UTF-8
986
4.125
4
[]
no_license
''' 输入两个递增排序的链表,合并这两个链表并使新链表中的节点仍然是递增排序的。 示例1: 输入:1->2->4, 1->3->4 输出:1->1->2->3->4->4 限制: ''' class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: ''' 1. 遇到的问题,一开始想着同时比较`l1,l2` 2. 但是,最后的结果回溯不到头节点,所以利用python复制的特点,让`res`和`cur`在初始化的时候就“绑定”在一起,`cur`作为指针向前移,`res`作为伪头节点,好在最后返回结果的时候...
true
6fa0d1858186e3fdaa87e22e743b70527855a4d4
tortoise/tortoise-orm
/tests/test_inheritance.py
UTF-8
612
2.578125
3
[ "Apache-2.0" ]
permissive
from tests.testmodels import MyAbstractBaseModel, MyDerivedModel from tortoise.contrib import test class TestInheritance(test.TestCase): async def test_basic(self): model = MyDerivedModel(name="test") self.assertTrue(hasattr(MyAbstractBaseModel(), "name")) self.assertTrue(hasattr(model, "c...
true
39eeebe2f27568c135e9ec8326e1905583e2c5a8
yongxuUSTC/challenges
/linked-list-split.py
UTF-8
1,409
4.625
5
[]
no_license
''' Question: Split a linked list into two list with odd and even values. Retain the order of value and solve with no additional space. ''' class LinkedList: def __init__(self,data): self.data = data self.next = None def insert(self,node): current = self while(current.next is not None): current = curren...
true
e2f9fbf4c22e6db61a083ed78b602641b9269145
heolinyjung/B531_finalProject
/source/decisionTree.py
UTF-8
18,289
3.265625
3
[]
no_license
import math import json import numpy as np import random import re """ recipes param is a list of dictionaries each dict in the list is a recipe with keys id, cuisine, and ingredients (strings) id is assigned to the recipe id (int) cuisine is assigned to the cuisine type (string) ingredients is assigned to the list of...
true
b7ab7a32b918edaf31d23db7d46a966c2581be53
aragorn1025/mask-rcnn
/src/utilities/tools/file.py
UTF-8
638
2.859375
3
[]
no_license
import os def check_directory(key, root): if root == None: raise ValueError('The root of the %s directory should be set.' % key) if not os.path.isdir(root): raise IOError('The %s directory is not found.' % key) def check_file(key, root): if root == None: raise ValueError('The root ...
true
0661bf1fa0ac997276938ee764a570d0b3d17cec
Ryzzuh/string_matcher
/main.py
UTF-8
1,152
2.859375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import pandas as pd pd.set_option('display.max_columns', 500) pd.set_option('display.max_colwidth', 1000) pd.set_option('display.width', 1000) pd.options.display.max_rows = 100 import os cwd = os.getcwd() import jellyfish as jf import math import re def main(): """ Mai...
true
c34ba6bcf12d428f6bb6ed4c785326e87873846e
vipulshah31120/PythonClassesByCM
/DailyClasses/01-03-2021/json_ex2.py
UTF-8
721
3.3125
3
[]
no_license
import json fruits = ["apple","banana"] person = {"fname":"Vipul", "lname":"Shah", "fruits":fruits} str = json.dumps(person) print(str) cars = ["BMW", "Pagani", "Konigsegg", "LaFerrari"] Myself = ["I have these cars :",cars] Mycars = json.dumps(Myself) print(Mycars) x = '{"name":"Niklaus", "age":"Immortal"...
true
a014dcbf97ba91a1ea468021b6e8d4dfcaedad7b
COLA-Laboratory/A-python-package-to-MOEA
/Algorithm/NSGAII/NSGAIISelection.py
UTF-8
3,696
2.921875
3
[]
no_license
import numpy as np import random def tournamentSelection(Pop,N): tournament = 2 a = round(N/2) pop_candidate = np.zeros(tournament) pop_rank = np.zeros(tournament) pop_cd = np.zeros(tournament) pop_parent = [] for i in range(a): for j in range(tournament): pop_candidate[...
true