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
b29e213feb8bcf612c627b667637a8967f2e6f39
Tiagoeem/floodprediction
/pythonify.py
UTF-8
1,109
2.65625
3
[]
no_license
import os import re from subprocess import PIPE, run # Get paths from all staged files command = 'git diff --cached --name-only' files = run(command.split(' '), stdout=PIPE).stdout.decode('unicode_escape') \ .encode('latin1').decode('utf-8').replace('"', '').splitlines() for file in files: # Check whether...
true
efd0b4aeba991492669faa20c326a994f41f2d4f
jenntang1/holbertonschool-higher_level_programming
/0x0F-python-object_relational_mapping/8-model_state_fetch_first.py
UTF-8
630
2.90625
3
[]
no_license
#!/usr/bin/python3 """ 8. First state """ if __name__ == "__main__": from sys import argv from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from model_state import Base, State engine = create_engine('mysql+mysqldb://{}:{}@localhost/{}'.format( ...
true
57b05976aed5ea5d4ff1b3c9535bf7f21928ece7
christinehoward/Udacity_Data_Analyst_Nanodegree
/notes_and_quizzes/bivariate_data_exploration.py
UTF-8
19,150
3.453125
3
[]
no_license
plt.scatter(data = feul_econ, x = 'displ, y = 'comb); plt.xlabel('Displacement') plt.ylabel('Comb. fuel effec.'); # seaborn's scatterplot instead of matplotlib sb.regplot(data = feul_econ, x = 'displ, y = 'comb); plt.xlabel('Displacement') plt.ylabel('Comb. fuel effec.'); # can also turn off the line: sb.regplot(data ...
true
3f2a88196083273323166302982514f676d08c67
crichard2/libro
/capitulo9.py
UTF-8
1,367
3.96875
4
[]
no_license
#capitulo 9: archivos #en vez de escribir la direccion, mejor usar la funcion path del modulo os, para juntar los nombres de las carpetas #asi vana funcionar sin importar el sistema operativo donde se corran import os os.path.join("Users","bob","st.txt") #ojo que falta algo que poner antes que User # r obre archuv...
true
a96de63b586d5e8a5e3cef126a8fff5bb45420ef
Benson1198/31-Days-of-CP
/Day 9/Minimum Distances(Hackerrank).py
UTF-8
423
3.1875
3
[]
no_license
#!/bin/python3 import sys n = int(input().strip()) A = [int(A_temp) for A_temp in input().strip().split(' ')] def minimumDistances(a): min_dist = -1 if len(set(a)) == 1 and len(a) > 1: return 1 for j in range(len(a) - 1, -1, -1): dist = j - a.index(a[j]) if 0 < dist < min_dist or...
true
829998d0a6147ef2a515c520e600e593f4da580a
wjpappa5/Python
/Minis/Wrestling.py
UTF-8
1,339
3.65625
4
[]
no_license
import os import csv # Path to collect data from the Resources folder path = "/Users/williampappas/Desktop/GitLab/01-Class-Activities/03-Python/3/Activities/08-HW_WrestlingWithFunctions/Resources/WWE-Data-2016.csv" wrestlerData = os.path.join(path) def print_percentages(wrestlerData): name = str(wrestlerDa...
true
dd86388eb0f1e2ab362a7f26e4ec97138543b23a
lowRISC/opentitan
/util/otbn_build.py
UTF-8
11,593
2.5625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python3 # Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 """Build software running on OTBN Each assembly source file is first assembled with otbn_as.py. All resulting objects are then linked with otbn_ld.py...
true
67c60770ddd8dd9f4a0389a7bfc704076cfc7491
Peritract/adventofcode
/2020/day_22.py
UTF-8
2,190
3.8125
4
[]
no_license
# I neede a hint for this one, because I did not read the question properly; that's on me. import re from copy import deepcopy def load_input(source="input.txt"): data = {} with open(source, 'r') as file: text = file.read() chunks = text.split('\n\n') for chunk in chunks: data[int(re.s...
true
ce1f4ae9e802f8b43230ab98047f4f4b2841f92a
CarnunMP/Sprint-Challenge--Algorithms
/recursive_count_th/count_th.py
UTF-8
673
4.25
4
[]
no_license
''' Your function should take in a single parameter (a string `word`) Your function should return a count of how many occurences of ***"th"*** occur within `word`. Case matters. Your function must utilize recursion. It cannot contain any loops. ''' def count_th(word): # base case: word is "" if word == "": ...
true
ce1fb03a63e44592cdd9a51ad180b96ecc1730c0
hardhary/PythonByExample
/Challenge_103.py
UTF-8
415
4.21875
4
[]
no_license
#103 Adapt program 102 to display the names and ages of all the people in the list but do not show their shoe size. def displayname(): names = {} for i in range(4): name = input('Enter a name: ') age = int(input('Enter age: ')) size = int(input('Enter shoe size: ')) names[name]...
true
43c220175d4a44efad70d81b4395ffbe29a62e88
akrherz/DEV
/igniterealtime/find_bad_content.py
UTF-8
2,356
2.9375
3
[ "Apache-2.0", "MIT" ]
permissive
"""Figure out what cruft within Jive is causing API crashes""" import sys import requests API = "https://igniterealtime.jiveon.com/api/core/v3" JIVEUSER = "akrherz" JIVEPASS = sys.argv[1] def apiget(url): """Get what we need""" try: req = requests.get(url, auth=(JIVEUSER, JIVEPASS)) if req.s...
true
ea6c35adcb239884f45f871df2c92a333485f3a3
marinapm90/E-vitalos
/Proyecto/scrapping_web.py
UTF-8
1,427
2.984375
3
[]
no_license
from bs4 import BeautifulSoup import pandas as pd import requests import numpy as np # Esta función debería dividirla en dos, una para scrappear la web y otra para crear el dataframe. def get_table_additives(): url_web = "https://e-aditivos.com/" response = requests.get(url_web) soup = BeautifulSoup(resp...
true
df26aa87b8631b81dc5343e5b303042d31e746ce
srp33/ShinyLearner
/Analysis/CleanConvertData.py
UTF-8
1,869
2.78125
3
[ "MIT" ]
permissive
import sys inFilePath = sys.argv[1] outFilePath = sys.argv[2] attributes = [] dataLines = [] with open(inFilePath) as inFile: for line in inFile: line = line.strip() if len(line) == 0: continue if line.startswith("%"): continue if line.lower().startswith...
true
8ddf7692c6b162ba75d6b1f38a2c96d1b95cc4c4
RJPlog/aoc-2020
/day14/python/ceedee666/day14.py
UTF-8
2,454
3.109375
3
[ "MIT" ]
permissive
from pathlib import Path from functools import reduce from operator import add import typer app = typer.Typer() def read_input_file(input_file_path): p = Path(input_file_path) with p.open() as f: lines = f.readlines() program = [] for line in lines: op, val = line.strip().split(" ...
true
e9279c98c057bd68e4c656a7bc56d16b0c3fd1cf
gitgudjimjim/capstone
/Jim_Capstone/JimCapstone/capapp/web_scraped_info.py
UTF-8
10,957
2.71875
3
[]
no_license
from requests import get from requests.exceptions import RequestException from contextlib import closing from bs4 import BeautifulSoup def simple_get(url): """ Attempts to get the content at `url` by making an HTTP GET request. If the content-type of response is some kind of HTML/XML, return the text c...
true
c6d9c1d573dfc5eaeb9b0fdd35c9f883d37e239d
UchihaSean/LeetCode
/0523/ContinuesSubarraySum.py
UTF-8
589
2.796875
3
[]
no_license
class Solution(object): def checkSubarraySum(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ for i in range(len(nums) - 1): if nums[i] == 0 and nums[i + 1] == 0: return True if k == 0: return False m...
true
09a32d297ada4d7c26272ccf268fc7c964503b63
mehulnagar12/Home-automation-makeathon
/app/controller/led_controller.py
UTF-8
295
2.96875
3
[]
no_license
import modules.led as led #Turn all LEDs ON def turnAllOn(): for i in range(1,4): led.setLED(i, 100) #Turn all LEDs OFF def turnAllOff(): for i in range(1,4): led.setLED(i, 0) #task is in the format (led_num, value) def turnLED(task): led.setLED(task[0], task[1])
true
1b9858c86c6c7f05c8d21e466f459dbec8defe49
LaRimadora/Punksoup
/gen/markov.py
UTF-8
771
3.078125
3
[]
no_license
#!/usr/bin/env python3 import markovify as markov with open("./texts_all.txt") as f: text = f.read() text_model = markov.Text(text) for i in range(5): print(text_model.make_sentence() + '\n') for i in range(3): print(text_model.make_short_sentence(140) + '\n') # import markovify import nltk import re ...
true
c267820b91b6ab984f5f19264eb7d5e492b02d36
omaskery/lizard-monitor
/lizard-mon-csv.py
UTF-8
3,530
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 from lizard_mon import results import dateutil.parser import datetime import argparse import typing import json import csv CSV_HEADER_SEPARATOR = ":" OVERALL_HEADER_PREFIX = "overall" TARGET_HEADER_PREFIX = "tgt" HEADER_TIMESTAMP = "timestamp" HEADER_NLOC = "nloc" HEADER_VIOLATIONS = "violatio...
true
8d223d72ab066cd960aba0eaa45c137c3b29042f
paulot/codeforces
/583b.py
UTF-8
448
2.859375
3
[]
no_license
n, nums, v, i, tl = int(raw_input()), map(int, raw_input().split()), set(), 0, True t = 0 while len(v) < n: if i == n and tl: i = n-1 tl = False t += 1 elif i == -1 and not tl: i = 0 tl = True t += 1 if tl: if len(v) >= nums[i] and not i in v: ...
true
b6705d383216231ae6aef1ffee12bdbfeb3254a8
pbakalov/python_stuff
/json_test.py
UTF-8
239
2.640625
3
[]
no_license
from pylab import * import json #name_str = '\"name" : "Self_Energy\"' name_str = '"name" : "Self_Energy"' name_str = '{'+name_str+'}' print name_str name_json= json.loads(name_str) print name_json name = name_json["name"] print name
true
6577f110cbf6d4978b0c5dd585dc7e8e90816680
ip-tools/patent-similarity
/subTreeTrainer.py
UTF-8
3,943
2.609375
3
[]
no_license
from uRAE_lib import * import random from similarityMatrix import * from flattenTree import * from dynamicPooling import * from embeddingTree import * from patentNumberClassifier import * from SRHM import * import math import nltk from datetime import datetime import cloud PATENT_DATA = "photovoltaic_05.c...
true
4a7fa43fdce440b8ddb7fefb3ab003fb55e3a739
cliodhnaharrison/CA117Lab
/Lab 05.1 - Sample Lab Exam 1/runners_51.py
UTF-8
1,000
3.234375
3
[]
no_license
import sys def time_to_seconds(minutes, seconds): result = minutes*60 result += seconds return result def seconds_to_time(seconds): minutes = str(seconds // 60) seconds = str(seconds % 60) if len(seconds) == 1: seconds = "0" + seconds else: pass original_time = minutes + ":" + seconds return original_t...
true
0f1c44caccac90070cdb0b995fc1309638d8198b
albertommartinez/programacion2019-20
/Python3/Alternativas/ej7.py
UTF-8
909
4.59375
5
[]
no_license
# -*- coding: utf-8 -*- #Realiza un algoritmo que calcule la potencia, para ello #pide por teclado la base y el exponente. Pueden ocurrir tres cosas: #-El exponente sea positivo, sólo tienes que imprimir la potencia. #-El exponente sea 0, el resultado es 1. #-El exponente sea negativo, el resultado es 1/potenci...
true
e9d4bc21117be4d7a4d71c5645cb3b05653ffa3e
LallahK/GP_Equation_Generator
/Parser.py
UTF-8
1,655
2.984375
3
[]
no_license
from GP_Algos import GeneticProgram f = None gp = None index = 0 def parseFile(a): global f global gp f = open(a, "r") gp = GeneticProgram() parseFunctions() f.close() def parseFunctions(): funcs = 0 line = f.readline() if not line[:11] == "Functions: ": err("Funct...
true
79160fa2cfe7934c150da2f9146c60f8a546f59c
ShantanuBal/Code
/Scripts/palind_string.py
UTF-8
568
2.984375
3
[]
no_license
word = "XABACYUSABAL" def find(): global word a = [each for each in word] b = a[::-1] a.insert(0,'0') b.insert(0,'0') print "a:", a print "b:", b opt = [] for i in range(len(word)+1): opt.append( [0] * (len(word)+1) ) for i in range(1,len(word)+1): for j in range(1,len(word)+1): if a[i] == b[j]: o...
true
529fc01a11eb1f0a3b2f9f52d5b84048dcad7ca3
databill86/cortex-1
/examples/iris-classifier/models/tensorflow_model.py
UTF-8
2,101
2.515625
3
[ "Apache-2.0" ]
permissive
# sources copied/modified from https://github.com/tensorflow/models/blob/master/samples/core/get_started/ import tensorflow as tf from sklearn import datasets, metrics from sklearn.metrics import classification_report, confusion_matrix from sklearn.datasets import load_iris from sklearn.model_selection import train_te...
true
c7a6f2fc7dd0b81111a4adc84e3ddf07f9931ed1
petergade/minesweeper-python
/src/MineSweeper/mainscreen.py
UTF-8
9,006
2.828125
3
[]
no_license
import pygame import common import sys from os import path from gamestate import GameState from sprites import Brick, Emoji, Explosion, SpriteSheet class MainScreen: def __init__(self, difficulty: common.Difficulty): self.hide_board = True # parametr pro testovani, zda se ma zobrazovat zakryta nebo odkry...
true
26eeb2a025c648220ad86e23dc7216ad9a44498d
RMD-5024/zzquant
/core/py/zzquant/fetcher/margin_trading_crawler.py
UTF-8
1,360
2.65625
3
[]
no_license
# coding: utf-8 """ 上证交易所,深圳交易所获取数据 融资融券: http://www.sse.com.cn/market/othersdata/margin/sum/ http://www.szse.cn/disclosure/margin/margin/index.html """ from core.py.zzquant.util import date_util import pandas as pd _sh_url = 'http://www.sse.com.cn/market/dealingdata/overview/margin/a/rzrqjygk{}.xls' _sz_url = 'htt...
true
56b39a807bb7089f81bc15f44f4bcb4d54087481
KDJ-Projects/Login-screen
/main.py
UTF-8
8,101
2.953125
3
[]
no_license
import os from tkinter import * from PIL import ImageTk, Image master = Tk() master.title("Banking App") # Variables temp_register_name = StringVar() temp_register_age = StringVar() temp_register_gender = StringVar() temp_register_password = StringVar() temp_login_name = StringVar() temp_login_password = StringVar(...
true
9bfe1c6dce7f8675b99b63c8e7822a477ec3eef2
joseant1234/store_django
/products/views.py
UTF-8
1,824
2.640625
3
[]
no_license
from django.shortcuts import render from django.db.models import Q from django.views.generic.list import ListView from .models import Product from django.views.generic.detail import DetailView # por utilizar ListView es necesario definir el template_name y queryset, pues sino utilizar por valores por defecto definidos...
true
7d023f102e24903ff82a242ee0714329d3866910
msmajiet/Playground
/traversingtree2.py
UTF-8
1,527
3.171875
3
[]
no_license
tree = { 'abc': { 'def': 1, 'ghi': { 'jkl': 1 }, 'xyz': 1, 'qwerty': { 'test': { 'fred': 1, 'bob': 1 } } } } def traverse_dict(datastr, valuein): # found = "False" # while (found == 0): for k in datastr.keys(): if (valuein...
true
73d2acc0bffeb3c1790f0bfd26228b185eb7d73b
xiavan405/misc
/lobstr-tools/iter-getreads
UTF-8
3,609
2.8125
3
[]
no_license
#!/usr/bin/env python ''' Takes a list of loci (lobSTR output will work) and will print read information for each read. (Might be a little infromation dense, would be a good idea to only overall read information like averages instead of each individual read). Adding more samples also significantly increases the amo...
true
1cfd1ec0c97df4cb2700f91d5418180139c4640e
eishkumar/dumypro
/q2.py
UTF-8
112
3.078125
3
[]
no_license
#a=input('enter string ') #print(a[ : :-1]) a=input('enter a string') def rev(b): print(b[ : :-1]) rev(a)
true
24e12cea767b721a9bad49ff1ef8fd7c768e9f88
allenwian/ai
/Analysis.py
UTF-8
347
2.765625
3
[]
no_license
import matplotlib.pyplot import numpy as np import pandas as pd from sklearn import linear_model df = pd.read_csv('stock_data.csv', header=None).T df.columns = df.iloc[0] df = df.iloc[1:] #predicting the differences ys = df['GOOG'].diff() clf.fit(df.iloc[1:150], ys[1:150]) ys_pred = clf.predict(df.iloc[150:]) clf.sco...
true
2304f11679488b68c6da3c0469f239c356ddede5
oandersonx/AnPIng.-
/ClientNode/AnalisaPalavra.py
UTF-8
164
2.515625
3
[]
no_license
from spellchecker import SpellChecker def analisaPalavra(msg): spell = SpellChecker() erradas = spell.unknown(msg) return list(erradas)
true
a9601433aefbb2fae032a2feebc3d4ef56994ee9
GeovaneNarciso/POO_ADS2018.2_MOD2
/Atv_D/atv_d.py
UTF-8
1,616
3.625
4
[]
no_license
class ventilador: def __init__(self, marca, modelo): self.marca = marca self.modelo = modelo self.energia = False self.girar = False self.velocidade = 0 def __str__(self): if self.energia: print("\nEnergia: Ligado") if self.gira...
true
894191cc08604235d1c63b4738cf2bdea5a4bca8
unsung107/Algorithm_study
/D4/5247 연산.py
UTF-8
686
2.8125
3
[]
no_license
from collections import deque for ro in range(int(input())): N, M = map(int,input().split()) visited = [False] * 1000001 queue = deque() queue.append((N, 0)) while queue: num, depth = queue.popleft() if visited[num]: continue visited[num] = True ...
true
233ccd603c4fc61e17f80e0c0179853407c6e8c7
SiegeOder/PythonHomework
/final_task/pycalc/pycalc.py
UTF-8
1,303
2.640625
3
[]
no_license
from argparse import ArgumentParser from pycalc.constants_and_operations import (CONSTANTS, FUNCTIONS) from pycalc.expression_calculator import calculate_expression from pycalc.expression_parser import parse_expression from pycalc.module_appender import import_all_modules from pycalc.valid_checks import (check_express...
true
634affbc396aef4399918c164db19fda13b97acd
nsk324/TIL
/남수경/0821/스택삽입삭제.py
UTF-8
173
3.421875
3
[]
no_license
stack = [] stack.append(1) print(stack) stack.append(2) print(stack) # stack.append(3) print(stack) print(stack.pop()) print(stack.pop()) print(stack.pop()) print(stack)
true
5b9798d04d3284ae6b9420b2959bb15e6f83e28d
mwlussier/leaf_classification
/src/models/logistic_regression_classifier.py
UTF-8
1,242
2.796875
3
[ "MIT" ]
permissive
import numpy as np from sklearn.linear_model import LogisticRegression from src.models.vanilla_classifier import VanillaClassifier class Logit(VanillaClassifier): """ LOGIT Classifier ================== Child class implementing Logistic Regression (LOGIT) classifying model. Attributes =====...
true
0f168a7e05813ab80db1dbe1dbf7e809e4b1da9e
pbychikhin/certutils
/ansible_letsencrypt/scripts/install_IIS_cert.py
UTF-8
7,787
2.609375
3
[]
no_license
import argparse import sys import os import logging import clr from pathlib import Path sys.path.append(os.path.join(os.environ["WINDIR"], "System32", "inetsrv")) clr.AddReference("Microsoft.Web.Administration") from System.Security.Cryptography import X509Certificates from Microsoft.Web.Administration import ServerMa...
true
c87da762eda60a8ae9f1eabd454d8d7dd2e44713
vedrankolka/APR
/dz4/analyzer.py
UTF-8
2,389
2.640625
3
[ "Apache-2.0" ]
permissive
import numpy as np import pandas import matplotlib.pyplot as plt bf_3_bit_schaffers = np.load('zad3_data/3_variables_bitvector_schaffers.npy') bf_6_bit_schaffers = np.load('zad3_data/6_variables_bitvector_schaffers.npy') bf_3_double_schaffers = np.load('zad3_data/3_variables_doubles_schaffers.npy') bf_6_double_schaffe...
true
a2725903bf0f742b0886248e63abfc5e522892f0
fdasilva59/examples
/pix2pix_pipelines_tf2.0/test_pix2pix.py
UTF-8
6,387
2.609375
3
[ "Apache-2.0" ]
permissive
from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import app from absl import flags from utils import get_dataset, decode_tfrecords_example, normalize, save_image #KFP-NEST-IMPORT from model import Generator #KFP-NEST-IMPORT # ------------------...
true
d1c839f28f2bc65d622904540503b750fd45ef95
alexey-voloshin-ddi/search-app
/utils.py
UTF-8
4,137
2.609375
3
[]
no_license
import logging from collections import OrderedDict from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.conf import settings from django.db.models import Count from django.core.cache import cache from pandas import DataFrame from apps.search.models import EmergencyModal from apps...
true
f487d922fe9ae6fc4141470ab753b3fe0765f886
neilswainston/PythonClub
/liv/1 Introduction/test_script.py
UTF-8
294
3.6875
4
[ "MIT" ]
permissive
# Simple test script. # I'm a comment, by the way. I'm human-readable stuff that Python ignores. # But, I'm very useful for documenting and adding hints to my code. # Anything that you write after a hashtag is a comment. print('Hello, Python Club!') print('5 squared is...') print(5**2) 6**2
true
6e8f3695ec3657bbd241676558eedc3d49bb2278
JoaoVitorAzevedo/UFSCar
/2018 - 2/Teoria dos Grafos/praticas/codigo/script_prufer.py
UTF-8
1,793
3.484375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import networkx as nx import matplotlib.pyplot as plt # utlizada para realizar a plotagem do grafo def plot_weighted_graph(G): """ Descrição --------- Plota um grafo ponderado G. """ plt.figure(); # obter posição dos nós pos = nx.spring_layout(G); # plotar v...
true
3b3117714fbdc1417751c895c28f8bbb8a2b9030
eshanim/python
/textadventure.py
UTF-8
4,373
3.890625
4
[]
no_license
start = """ You open your eyes and look around. You are not in your room. You are not in your bed. In front of you is a simple sign with two arrows: North or South. There is nowhere to go except for those two directions. As you take a step forward, you hear a booming voice. It says, 'Choose wisely if you want to surviv...
true
94d4b9897502127909eca367ff8bb941a664ced5
TaeYeon-kim-ai/python_basic
/01. string/string_03.py
UTF-8
414
3.875
4
[]
no_license
''' scanf("%s", str);를 사용하면 공백이후의 문자를 입력받지 못한다. 공백이 있는 문자열을 입력받아 출력해보자. 입력 공백이 포함된 문자열이 입력된다. (최대길이 30) 출력 입력받은 문자열을 그대로 출력한다. 입력 예시 black sheep wall 출력 예시 black sheep wall ''' word = str(input()) print(word)
true
18ae1da3ef8fabb0addc422ed58c28e17b085dde
evgeniy-arapov/geekbrains-python-base
/lesson16/main.py
UTF-8
1,474
2.8125
3
[]
no_license
import inspect import os import random import sys from core import get_list, create_dir, create_file, rename, delete, save_log, copy, change_dir current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parent_dir = os.path.dirname(current_dir) sys.path.insert(0, parent_dir) from lessons6...
true
04f5d9c7cbb6366ca5357e5b47e6f763f51ff26f
caitaozhan/LeetCode
/greedy/1710.maximum-units-on-a-truck.py
UTF-8
510
2.8125
3
[]
no_license
# # @lc app=leetcode id=1710 lang=python3 # # [1710] Maximum Units on a Truck # # @lc code=start class Solution: def maximumUnits(self, boxTypes: List[List[int]], truckSize: int) -> int: boxTypes.sort(key=lambda x: -x[1]) ans = 0 for num, unit in boxTypes: if num < truckSize: ...
true
e7287b3ce99e9dbaef3a7f9c010290da14f3d7c6
dougblack/optix
/optix/views.py
UTF-8
4,468
3.5625
4
[]
no_license
from optix import View class RowView(View): """ A RowView is used to organize a series of items on one line So: RowView(x, y, ['one', 'two', 'three', 'four']) would draw: one | two | three | four """ padding = 1 separator = '|' align = 'center' def __init__(self,...
true
04dc7a634181ce819d94a50d2759a311dcdb12de
CerberusLatrans/NightOwlYOLO
/dataset.py
UTF-8
3,756
3.140625
3
[]
no_license
""" Creates a Pytorch dataset to load the Pascal VOC dataset """ import torch import os import pandas as pd from PIL import Image import json from ast import literal_eval dir_path = os.path.dirname(os.path.realpath(__file__)) class VOCDataset(torch.utils.data.Dataset): def __init__( self, ...
true
82d04cd946ceaff576265cb2b9922e2ef2fa9bf1
DarioBernardo/hackerrank_exercises
/heap/kth_smalles_element_in_sorted_matrix.py
UTF-8
3,121
3.65625
4
[]
no_license
""" """ from typing import List, Tuple def heapify_up(h: List[Tuple[int, int, int]]): child = len(h) - 1 parent = (child - 1) // 2 while h[child][0] < h[parent][0] and parent >= 0: h[parent], h[child] = h[child], h[parent] child = parent parent = (child - 1) // 2 def heapify_dow...
true
17689286f5ad2d24e48a33bddab290a32ae9a46c
leetcode-notes/daily-algorithms-practice
/leetcode/1221_split_stirng_balanced_strings.py
UTF-8
700
3.40625
3
[ "Unlicense" ]
permissive
class Solution: def balancedStringSplit(self, s: str) -> int: r, l = 0, 0 count = 0 for ch in s: if ch == "R": r += 1 elif ch == "L": l += 1 if l == r and l != 0: count += 1 r = 0 ...
true
d1954e4210af497e3d6d6ef893b46a1cb48d1406
thibaultclem/python-example
/python-data-structure/string-basic.py
UTF-8
1,398
5.03125
5
[]
no_license
# # Learn basics about String in Python # # A String is a sequence of characters (can use simple or double quotes) str1 = "Hello" str2 = "MJ" # Concatenate a String concat = str1 + " " + str2 print concat # Convert String to number str3 = "22" mj = int(str3) + 1 print mj # Reading a String enter by user name = ra...
true
afb9d9a961ec485f8ed0cef198821870bb1e22cc
atwilson0729/vislab
/Plots/Weather_and_olympics_plots/Part4_group_line_and_multi-line.py
UTF-8
9,007
2.75
3
[]
no_license
import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import pandas as pd import plotly.graph_objs as go # Load CSV file from Datasets folder # Added ../ because my folder structure is different df1 = pd.read_csv('../../Datasets/Coronavi...
true
f445ab6807fc2e14ff27cd670b9c18f75d6c4790
Michael-Afton/starter-game
/main.py
UTF-8
371
2.546875
3
[]
no_license
scene.set_background_color(10) crewmate = sprites.create(assets.image(""" CREWMATE """), SpriteKind.player) imposter = sprites.create(assets.image(""" IMPOSTOR """), SpriteKind.enemy) crewmate.set_position(16, 24) controller.player1.move_sprite(crewmate) controller.player2.move_sprite(imposter) crewmate.set_sta...
true
514014ee2ceb7fe05c21f13c8e8951043194af7b
ervishuu/Basic-Python
/task19.py
UTF-8
144
3.65625
4
[]
no_license
#python program to return sum of two number using function def sum(x,y): # function header return x+y #return x,y= 10,20 print(sum(x,y))
true
ce77606b126c1a2d722802a862191f1c6c3f8e00
CharnyshMM/mzi
/lab3/rsa.py
UTF-8
4,855
3.5625
4
[]
no_license
import random import sys R_LO, R_UP = 500, 2000 RANDOM_NUMBERS_FILE = 'primes.txt' PRIVATE_KEYS_FILE = "private_keys.txt" PUBLIC_KEYS_FILE = "public_keys.txt" HELP_TEXT = """ USAGE: * encryption: python rsa.py enc filename_to_read [filename_to_take_keys_from] * decryption: python rsa.py dec filename_to_...
true
ad74bd06f9454851ac26f75e5303c9b0af87183c
ZuyiWang/learning_note
/TensorBoard/TensorBoard_Setup.py
UTF-8
5,398
2.703125
3
[]
no_license
from torch.utils.tensorboard import SummaryWriter import matplotlib.pyplot as plt import numpy as np import torch.nn.functional as F import torchvision import torch import CIFAR_10 # default `log_dir` is "runs" - we'll be more specific here writer = SummaryWriter('./runs/fashion_mnist_experiment_1') # get some rando...
true
cd8d4a64675919fad1b470cfe6142f2c0757818b
luisPerez19/Colaboracion-Diplomado
/python/Juego Snake/snake.py
UTF-8
4,607
3.78125
4
[]
no_license
import turtle import time # importa el modulo tiempo import random posponer = 0.1 #Marcador score = 0 high_score = 0 #creacion y configuracion de la ventana wn = turtle.Screen() wn.title("Snake") wn.bgcolor("black") wn.setup(width = 600, height = 600) wn.tracer(0) #cabeza de la serpiente, creacion de elemento grafi...
true
30a04aa0e52d798d87fc5a09a5d097e0f49104af
deepakpawade/MSDSDA_Assignments
/Python/Assignment_8_sept_2021/countCharacter.py
UTF-8
372
3.734375
4
[]
no_license
test_str = input("Enter a string : ") # using naive method to get count # of each element in string all_freq = {} for i in test_str: if i in all_freq: all_freq[i] += 1 else: all_freq[i] = 1 # printing result print ("Count of all characters in given string is :\n " ...
true
bb3651c10cdaf02aba415e1a62f4502949392c33
ewinsutriandi/ewinsutriandi.github.io
/kuli/dasprog-1819/tugas-mhs/Kelas SI/YENI LAELATUN HASANAH/Tugas1.py
UTF-8
460
3.625
4
[]
no_license
saya = input('masukkan berat badan anda (kg)') rekan = input('masukkan berat badan rekan anda(kg)') rekan = int(rekan) saya = int(saya) hasil1 = rekan-saya hasil2 = saya-rekan if rekan > saya: kategori = 'anda lebih ringan',int(hasil1),'kg dari pada rekan anda' elif saya > rekan: kategori = 'anda lebih be...
true
3f274d7715cb208c622e23bd5325bd6c1218cd75
stkr1623/Snake-Game
/snake.py
UTF-8
1,930
3.4375
3
[]
no_license
from turtle import Turtle class Snake: def __init__(self): self.snake_body = [] self.new_snake() self.head = self.snake_body[0] def new_snake(self): for i in range(3): new_turtle = Turtle(shape="square") new_turtle.color("white...
true
f4959e729ff2bdc4a02d94cc48e48432a999c617
chiehminwei/taggerflow_cn
/parameters.py
UTF-8
12,991
2.6875
3
[]
no_license
import logging import collections import re import numpy as np import tensorflow as tf from features import * from util import * class ParameterReader(object): def readline(self, line): raise NotImplementedError("Subclasses must implement this!") def get_result(self): raise NotImplementedErr...
true
8400c650c30fcb5453ae51b65e1a95db2c4f2c76
tiatmed/computing
/p02/q10_find_largest.py
UTF-8
43
3.34375
3
[]
no_license
n = 1 while n**3 < 12000: n+=1 print(n)
true
c9f7d102134933027e5be378f84a4551eb63e42b
Maksim-Junior/crypto_bot
/parser.py
UTF-8
3,758
2.546875
3
[]
no_license
from selenium import webdriver from db import search_currency, id_for_parser class CryptoParse: def __init__(self, url, bot=None): self.driver = webdriver.Chrome() self.driver.minimize_window() self.url = url self.bot = bot def __del__(self): self.driver.close() a...
true
b30b330aa34c1a911e4273c014e304f6797040c3
TronicLT/saga
/saga/models/model_trainer.py
UTF-8
18,283
2.609375
3
[]
no_license
# coding=utf-8 import types import torch import torch.nn as nn from torch.utils import data from saga.data.datasets import ArrayDataset from saga.utils.callbacks import Callback, History, ProgressBar, Callbacks from saga.utils.general_utils import check_attribute from saga.utils.metrics import check_metric from saga....
true
9379275e4dc95c1c4183862d8235a4da7aa13922
jareddf/numerical_computing
/Applications/JobSearch/job_solutions.py
UTF-8
2,463
2.734375
3
[ "CC-BY-3.0" ]
permissive
import scipy as sp from discretelognorm import discretelognorm from matplotlib import pyplot as plt #Problem 1 Solution============================================================ #N = 500 #w = sp.linspace(0,100,N) #w = w.reshape(N,1) #u = lambda c: sp.sqrt(c) #util_vec = u(w) #alpha = 0.5 #alpha_util = u(alpha*w) #al...
true
75721de57e9b85d0071975f28ca8d6eb46c0b85a
Mamunahmed33/PythonLearning
/src/rangeAndWhile.py
UTF-8
190
3.65625
4
[]
no_license
for x in range(10): print(x) print("\n") for x in range(5, 10): print(x) print("\n") for x in range(10, 20, 2): print(x) i = 10 print("\n") while i < 15: print(i) i+=1
true
482786f14489e34316edfc223830ca7602fea847
pekarj/Ummm
/kenlm_prepro/scripts/sanitize_unicode.py
UTF-8
568
2.765625
3
[]
no_license
#!/usr/bin/env python import sys import unicodedata def sanitize(c): category = unicodedata.category(c)[0] if category == 'C': # remove control characters return ' ' if category == 'Z': # replace all spaces by normal ones return ' ' return c #sys.setdefaultencoding("utf-8") for line i...
true
8022245e456be5a8d3c35dac5af48b45848eaf3a
krmlsy/app-test-core
/src/main/java/ai/test/com/tr/python/library/process.py
UTF-8
237
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Jul 22 12:51:15 2018 @author: KULUSOY """ import sys def sum(x,y): z = x + y print(z) return z a = int(sys.argv[1]) b = int(sys.argv[2]) sum(a, b)
true
f0fb031c7ee3e4c61db67dd18ee8e64d2d4adc5a
creuter23/fs-tech-artist
/Staff/mclavan/old/mecScripts/myDev/ceb_quickSdkGUI_v3.py
UTF-8
15,449
2.53125
3
[]
no_license
''' -------------------------------------------------------------------------------- ///////////////////////////// ceb_quickSdkGUI_v3.py //////////////////////////// -------------------------------------------------------------------------------- Title: Quick SDK Creator by: Craig Buchanan How to Run: import ceb_q...
true
edaaf12ab92d225ceb572ce9e31b55c3d339c4c4
professor-python/2016-december
/p2.py
UTF-8
151
3.4375
3
[]
no_license
lst = [1, -17, 233] lst = sorted(lst, reverse=True) print(lst) print( sorted( ['b', 'arc', 'z'], key=lambda i:len(i) ) )
true
d538d6c7770a7462f65993a2c7779d8f81d4db7d
skrimix/adbutils
/tests/test_reverse.py
UTF-8
411
2.78125
3
[ "MIT" ]
permissive
# coding: utf-8 # import time import adbutils def test_reverse(device: adbutils.AdbDevice): """ Test commands: adb reverse --list adb -s xxxxx reverse --list """ device.reverse("tcp:12345", "tcp:4000") exists = False for item in device.reverse_list(): if item.remot...
true
35297c22422d0fd530c4e96f83f3c764238abea8
allybrannon/week1_thursday
/while_loop_2.py
UTF-8
98
3.546875
4
[]
no_license
title = "Today is Thursday!" count = 0 while count < len(title): print(title) count += 1
true
a280418a82b42ecdc534f6ffe53a259ac3c8887a
choderalab/openmmtools
/openmmtools/multistate/utils.py
UTF-8
11,919
3.03125
3
[ "MIT" ]
permissive
#!/usr/local/bin/env python # ============================================================================== # MODULE DOCSTRING # ============================================================================== """ Multistate Utilities ==================== Sampling Utilities for the YANK Multistate Package. A collecti...
true
5de2391bcb8ccc3d7cc1ecc4e7d240b725f9949b
greeshma0601/Python-Language
/Lists/Iterating through Lists - Python.py
UTF-8
2,521
4.59375
5
[]
no_license
''' Iterating through Lists - Python You have been familiar with Lists in Python. Diving deep will be more interesting in Python Lists. Let's have a look to iterating over a list. You can use for and while loop to iterate through list elements as below: For loop: for i in range(1, len(arr), 1): print (arr[i]) OR...
true
82a1f5c831cc3694eeb337b81288234158b8166c
xtarp/untitled11
/Hello.py
UTF-8
14,593
3.875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -* # age = int(input()) # if age >= 18: # print('adult') # else: # print('teenager') # a = 'ABC' # b = a # a = 'XYZ' # print(b) #list#list是一种有序的集合,可以随时添加和删除其中的元素。 # classmates = ['Michael', 'Bob', 'Tracy'] # print(classmates) # print(len(classmates)) # print(classm...
true
91b0057a7b6b12075211e1deac0fa6a7221012cc
ejlb/LSHash
/tests/test_code.py
UTF-8
444
2.921875
3
[ "MIT" ]
permissive
import lshash import numpy as np def test_code(): """ test codes are of the correct length and work with multiple hash tables """ l = lshash.LSHash(10, 20) assert len(l.code(np.random.randn(20))) == 1 assert len(l.code(np.random.randn(20))[0]) == 10 l = lshash.LSHash(10, 20, num_hashtables=3) ...
true
a6ab9669cbde22b41352951c7b256e5c8e555da6
gmagostini/SQLAssignment3
/A3_205791.py
UTF-8
7,867
3.4375
3
[ "MIT" ]
permissive
import psycopg2 import random import sys from time import time_ns TABLE_LENGTH = 1000000 def get_random_string(length): # Random string with the combination of lower and upper case letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','X','Y','Z','a','b','c','d','e','f','g'...
true
7b18758ed28dd26aa97ea40e5db1c4ede85d581c
kukaiN/Sudoku_solver
/app/__init__.py
UTF-8
2,975
3.015625
3
[]
no_license
from flask import Flask, render_template, request import exact_cover_solver as ecs app = Flask(__name__) @app.route("/") @app.route("/index") def index(): return render_template("index.html") @app.route("/solution", methods=["GET", "POST"]) def solution(): if request.method == "POST": print(request....
true
b259a478b857e11b45d4072da37da0673d7df808
abhipr1/StockForcastEngine
/utils/create_lagged_series.py
UTF-8
1,856
3.125
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- import datetime import numpy as np import pandas as pd import pandas_datareader.data as web import logging def create_lagged_series(symbol, start_date, end_date, lags=5): """ This creates a pandas DataFrame that stores the percentage returns of the adjusted closing value of a ...
true
5e09eb183347c77bffa99c79361e9ecc3ae11e98
NatSuraden/Problem-Solving-01
/3D/1.py
UTF-8
161
3.3125
3
[]
no_license
def rever_slicing(s): return s[::-1] input_str = 'INE-KMUNTB' if __name__ == "__main__": print('Reverse String using slicing =',rever_slicing(input_str))
true
fb2a278dfc49a25a1f2b5da64221a4af8039f73a
zshaked000/Math-4300-Algorithms-Projects
/Math 4300/Project/pythonpractice/join.py
UTF-8
159
3.28125
3
[]
no_license
with open(filename, "r") as txt: for line in txt: recipients.append(line) #new line ",".join(recipients) print(recipients)
true
1279c4bc2e57cd6708e567554f1ad18ca9817a55
haozx2014/psilocybin-microstates
/src/helpers.py
UTF-8
2,497
2.859375
3
[]
no_license
""" Set of helpers. (c) Nikola Jajcay """ import logging import os import time from functools import wraps PROJECT_ROOT = os.path.normpath( os.path.join(os.path.abspath(__file__), "..", "..", "..") ) CODE_ROOT = os.path.join(PROJECT_ROOT, "code") DATA_ROOT = os.path.join(PROJECT_ROOT, "data") RESULTS_ROOT = os.p...
true
e312cf58aa81c7aea61d33a62fbf246409b73976
pipi0425/PowWow
/POWWOW.py
UTF-8
2,149
2.5625
3
[]
no_license
from tkinter import * from PIL import ImageTk, Image from random import randint import json import subprocess import client as clt def open_rule_pdf(): subprocess.Popen("./asset/PowWow Rule.pdf", shell=True) def clicked(t1, t2, t3, btn): arg = [("ID", t1.get()), ("addr", t2.get()), ("port", t3.get())] l...
true
804b69e0e402f87c84d635b2e801469a2e2f70d4
itaybia/pyharmony
/harmony/HarmonyConnectionClient.py
UTF-8
1,660
2.84375
3
[ "BSD-3-Clause" ]
permissive
"""Client class for connecting to the Logitech Harmony.""" import logging import time import socket import select import threading LOGGER = logging.getLogger(__name__) class HarmonyConnectionClient(): def __init__(self, port): self.listenPort = port[0] def start_client_loop(self): ...
true
296d1c574d9f030f9ba3700ef99371f0870637c2
ponl/m2py
/m2py/segmentation/persistence_watershed_algorithm.py
UTF-8
4,716
2.71875
3
[ "Apache-2.0" ]
permissive
import numpy as np class PersistenceWatershed(object): def __init__(self, arr): self.WSHED = 0 self.INIT = -1 self.arr = arr self.dim = self.arr.shape self.lab = np.empty(self.dim, dtype=int) self.lab.fill(self.INIT) self.dual = {} self.current_label...
true
a92cf193ee90858fdec38a556903b2b354013138
mukulietlucknow/Python-Opps-Code
/solve_task_using_class.py
UTF-8
382
4
4
[]
no_license
n = str(input("your name please : ")) a = int(input("your age please : ")) m = int(input("your marks please : ")) class Student : def __init__ (self , n,a,m): self.name = n self.marks = m self.age = a def display(self): print ("My name : ", self.name) print ("My age : ", self.age) print ("My marks : ...
true
92187bfaf1b900e160a0db5b15c27755ac2d4fba
DeepikaAa1003/python-challenge
/PythonHomework/PyPoll/main.py
UTF-8
3,151
3.65625
4
[]
no_license
# Open the CSV file # Ignore the header # Read the csv file to create 3 lists for VoterId, County and candidate # sum the VoterID dictionary to calculate the total number of votes cast # Complete list of candidates who received votes - Unique count of Candidate dictionary # The percentage of votes each candidate won ...
true
0370a9b18f192dd9c903cb03145411fb9819222b
zolaneta/todo_flask_application
/app/models.py
UTF-8
946
2.515625
3
[]
no_license
from app import db class Todo (db.Model): __tablename__ = "todo" id = db.Column('id', db.Integer, primary_key=True) category_id = db.Column('category_id', db.Integer, db.ForeignKey('category.id')) priority_id = db.Column('priority_id', db.Integer, db.ForeignKey('priority.id')) description = db.Colu...
true
bb70b19e081fe771566cafb7254f840e89671e7d
Huchengxi/Programming-Exericises
/python_high_level/class_high/instance_type.py
UTF-8
201
3.15625
3
[]
no_license
# -*- coding:utf-8 -*- class A: pass class B(A): pass b = B() # isinstance会自动搜寻继承链 print(isinstance(b, B)) print(isinstance(b, A)) print(type(b) is B) print(type(b) is A)
true
3cd7c819abf9a536419dc0deb40e2bfd2707f9e1
Aasthaengg/IBMdataset
/Python_codes/p02415/s702573806.py
UTF-8
284
3.640625
4
[]
no_license
uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' lowers = 'abcdefghijklmnopqrstuvwxyz' s = str(input()) for i in range(len(s)): if s[i] in uppers: print(s[i].lower(), end='') elif s[i] in lowers: print(s[i].upper(), end='') else: print(s[i], end='') print('')
true
419671dca7c76216131a376a4197a59f9798c5b8
Torla/IdeaSim
/IdeaSim/Simulation.py
UTF-8
2,420
2.59375
3
[]
no_license
from enum import Enum import simpy from IdeaSim.Manager import Manager from IdeaSim.Resources import Resources, Resource class Simulation(simpy.Environment): class Logger: def __init__(self, env): self.env = env self.enabled = True class Type(Enum): NORMAL = ...
true
bf0204a8652db4645f95f6a6616105efd08da6db
AjayKrP/Machine-Learning
/MLBook/7 Committee/bagging.py
UTF-8
1,750
3.125
3
[ "MIT" ]
permissive
# Code from Chapter 7 of Machine Learning: An Algorithmic Perspective # by Stephen Marsland (http://seat.massey.ac.nz/personal/s.r.marsland/MLBook.html) # You are free to use, change, or redistribute the code in any way you wish for # non-commercial purposes, but please maintain the name of the original author. # Thi...
true
a63fc201635928608163958832a0fca314c60afc
TorreBarnes/coding-practice
/SQL/Establishing-Database-Connection/db-connection-hw.py
UTF-8
1,984
3.15625
3
[]
no_license
import sqlite3 import pprint import sys # Open database connection database = sqlite3.connect("JobSearch.db") # prepare a cursor object using cursor() method cursor = database.cursor() #(MySQLdb.cursors.DictCursor) # execute SQL query using execute() method. #cursor.execute("SELECT Name FROM names") # Fetch names...
true
078ec9c81850b01476837db595dc1774a4127098
bj730612/Bigdata
/01_Jump_to_Python/Chapter04/165.py
UTF-8
88
2.890625
3
[]
no_license
f = open('새파일.txt', 'r', encoding='utf-8') data = f.read() print(data) f.close()
true
c1cbcd06a80175ff6423f7f011de330f92647a40
shurui91/nlp_tryouts
/homework1/nblearn.py
UTF-8
2,262
2.765625
3
[]
no_license
import os, fnmatch, glob, json, sys ham_dictionary = {} spam_dictionary = {} combine_dictionary = {} ham = 0 spam = 0 inputpath = sys.argv[1] # 'Spam or Ham\train\' for root, dirs, files in os.walk(inputpath): # for ham files for file in files: if file.endswith("ham.txt"): ham += 1 filepath = os.path.join(r...
true