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
64fd53ffeee08fb72c66451954fab9db5963c72b
dljve/CCN
/assignment1/assignment1.py
UTF-8
2,161
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- """ Computational Cognitive Neuroscience Assignment 1 TODO: Plot the decrease in training and test loss over epochs. Submit your code as a documented Jupyter notebook, which includes your figure. For development, it is advised to first implement your work in PyCharm and then port...
true
2b336b2282f914bea9d1f1e62be4e97bb7f3aee0
Carloshp11/mining
/library/modules/misc.py
UTF-8
1,059
2.96875
3
[]
no_license
from subprocess import Popen, PIPE from typing import Tuple, Union, List def join_dicts(*dicts: dict) -> dict: def join_dict_with_list(dict1: dict, ll: Tuple[dict]): return join_dict_with_list({**dict1, **ll[0]}, ll[1:]) if len(ll) > 0 else dict1 assert len([k for dict_ in dicts for k in dict_.keys()...
true
bdd4ce0c134c19e5023fa1fcc0954f2333da1d86
dutradda/apidaora
/apidaora/bodies.py
UTF-8
677
2.671875
3
[ "MIT" ]
permissive
import io from typing import IO, Optional from dictdaora import DictDaora try: import gzip except Exception: gzip = None # type: ignore class GZipFactory(DictDaora): mode: str = 'rb' compresslevel: int = 9 encoding: Optional[str] = None errors: Optional[str] = None newline: Optional[st...
true
b83204acf85699efe3076397d2f47fd3b1446436
MrZhangzhg/nsd_2018
/nsd1808/devops/day01/myfork2.py
UTF-8
132
2.796875
3
[]
no_license
import os for i in range(7): # [0, 1, 2] ret_val = os.fork() if not ret_val: print('Hello World!') exit()
true
eae9ce2eb0a1d681d66148fbf7da1018edb03558
fangbo-yuan/pynesweeper
/pynesweeper.py
UTF-8
6,380
3.421875
3
[]
no_license
#!/usr/bin/env python3 from random import randint, randrange from copy import deepcopy def make_board(width, height, num_mines): """ Makes the board and the board the user sees. """ board = [] proxy_board = [] row = [] proxy_row = [] for i in range(height): for j in range(width): proxy_row.append('_') pr...
true
7c5fc06211b2cdb311b432279b85d4b7e505a602
shivangstreak/comp
/Multithreading/Rubrik_prep/building_h2o.py
UTF-8
796
3.09375
3
[]
no_license
from threading import Barrier, Semaphore # https://leetcode.com/problems/building-h2o/ class H2O: def __init__(self): self.bar = Barrier(3) self.semaphore_oxygen = Semaphore(1) self.semaphore_hydrogen = Semaphore(2) def hydrogen(self, releaseHydrogen: 'Callable[[], None]') -> None: ...
true
7ff32249b38ceb73ade2e55ec69a4a7d5aae4de7
svetoslavastoyanova/Python_Advanced
/Functions_Exercises/07.Perfect_number.py
UTF-8
299
3.828125
4
[]
no_license
number = int(input()) def is_perfect(number): divisiors = [] for i in range(1, number): if number % i == 0: divisiors.append(i) return sum(divisiors) == number if is_perfect(number): print(f"We have a perfect number!") else: print(f"It's not so perfect.")
true
ef4dafd68d0a1d3e1200af865512c4b1aecd9fa2
mholimncube/Python
/tut1 Object Orientation and Standard Library/CompanyPayments.py
UTF-8
2,823
3.90625
4
[]
no_license
#A program that will be responsible for capturing employee payment data #23 Feb 2015 from WagedEmployee import WagedEmployee from SalariedEmployee import SalariedEmployee from Employee import Employee from Person import Person def main(): #this is the main pr...
true
a6c4040319f6eb2fd1e206ca7b294949584cf24e
TMsangohan/pymad_hzb
/pymad_hzb/TwissTools.py
UTF-8
3,460
3.390625
3
[ "BSD-3-Clause" ]
permissive
import pandas as pd from pandas.util.testing import assert_frame_equal def get_twisscolumns(tfsfile): """ Method to get the of the columns of the twiss file Parameters: ----------- tfsfile : str Twiss file Returns: -------- columns : list of str list of column names a...
true
80c4168e573c27156c81b11e427935854bca4af7
whuang67/TA_stat420
/function.py
UTF-8
13,816
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Aug 5 23:46:30 2017 @author: Wenke Huang (whuang67) """ import pandas as pd import numpy as np import os import math # from sklearn.linear_model import LinearRegression from patsy import dmatrices import scipy.stats as ss from statsmodels.stats.outliers_influe...
true
799e7a5d7ddea26282147a0038c863a71f9990f0
driscollis/talks
/Intro to PySimpleGUI/PySimpleGUI vs wxPython/image_converter.py
UTF-8
2,321
2.984375
3
[]
no_license
# image_converter.py import io import os import PySimpleGUI as sg import shutil import tempfile from create_bw import black_and_white from create_grayscale import grayscale from create_sepia import create_sepia as sepia from PIL import Image file_types = [("JPEG (*.jpg)", "*.jpg"), ("All files (*.*)", "*.*")] tmp_f...
true
238b9dd9133002518a7308390ea97a59ad6888c6
khamsoul/scara_control
/scara_gui.py
UTF-8
6,072
2.65625
3
[]
no_license
from tkinter import * import tkinter.ttk as ttk import serial as ser import serial.tools.list_ports import line_compute_time import math class SerialConnection: def __init__(self, master): self.ports = serial.tools.list_ports.comports() self.portlist = [] for self.p in self.ports: ...
true
2dd6c2cffcd803702289f8043e7b4f02529b3789
stellarlib/centaurus
/src/map/button_map.py
UTF-8
1,267
3.046875
3
[]
no_license
class ButtonMap(object): def __init__(self): self._buttons = {} self._map = {} self._groups = {} def add_button(self, button, group_id): assert self._map.get(button.map_pos) is None assert button not in self._buttons.values() self._buttons[button.button_id] =...
true
ed8ec0b2ed2c328e4e359fa13f8811c9055ad599
kacperadach/stock_market_analysis
/stock_market_analysis/Data/Trading_Days.py
UTF-8
1,689
3.1875
3
[]
no_license
import datetime # misc functions for trading days class TradingDay: @staticmethod def get_today(): if datetime.datetime.now().hour >= 18: return datetime.date.today() else: return TradingDay.get_yesterday() @staticmethod def get_last_trading_day(date):...
true
1acf479a8bf560952ad8405cee973f3ba71fa392
carnegie-dpb/biotools
/gff-feature.py
UTF-8
454
2.890625
3
[]
no_license
#!/usr/bin/python # # extract a single feature from a GFF file presumably containing many features import sys if len(sys.argv)!=4: print "gff_feature.py file.gff source feature" sys.exit(0) filename = sys.argv[1] source = sys.argv[2] feature = sys.argv[3] print "##gff-version 3" f = open(filename, 'rU') fo...
true
d1c4153792eb277de3567c98de6c427a3cc65221
MichailChatzianastasis/Graph-based_NAS_with_Operation_Embeddings
/nas_bench101.py
UTF-8
1,344
2.609375
3
[]
no_license
import sys import pickle sys.path.append('../nasbench') from nasbench import api CONV1X1 = "conv1x1-bn-relu" CONV3X3 = "conv3x3-bn-relu" MAXPOOL3X3 = "maxpool3x3" INPUT = "input" OUTPUT = "output" # Load the data from file (this will take some time) #nasbench = api.NASBench('../nasbench/nasbench_only108.tfrecord') ...
true
fafc9585d666afa904b9a408e1f88647fc716331
moritzFuchs/AdventOfCode
/2017/day16/day16_1.py
UTF-8
864
2.90625
3
[]
no_license
#input = "sample.in" input = "input.in" file = open(input, "r") l = [x for x in "abcdefghijklmnop"] #l = [x for x in "abcde"] def dance(l, moves): for x in moves: if x[0] == "s": amount = int(x[1:]) l = l[len(l)-amount:] + l[:len(l)-amount] if x[0] == "x": y ...
true
abf2415f0a68ea7847f21a2997773f42377f48d9
jdougnac/WFRP-Magic-Item-Generator
/bow.py
UTF-8
5,275
3.65625
4
[]
no_license
import random bow_list = [1, 1, 1, 2, 2, 3, 3, 4, 4, 4] bow_dict = { '1': ['Bow of Distance', 'All ranges are doubled for this bow.', 'AN', '44'], '2': ['Bow of Enchantment', 'Arrows fired from this bow count as magical.', 'AN', '44'], '3': ['Bow of Might', 'It has a Strength Rating of 1d6 + 3 ...
true
358f6f60cfec9003ff85309a622d7cdfdc2e9a6c
patricklink05/potential
/argparsetest.py
UTF-8
186
2.640625
3
[]
no_license
import argparse parser = argparse.ArgumentParser() parser.add_argument("echo", help = "echo the string you put here") print parser.parse_args() args = parser.parse_args() print args.echo
true
267f0bb258c28a237baf5336a210884637880563
Tomoka64/interview_preparation
/linked_list/linked_list_interview_questions/nth_to_last.py
UTF-8
935
4.03125
4
[]
no_license
class Node: def __init__(self, head): self.head = head self.next = None class LinkedList: def __init__(self): self.head = None def append(self, element): new_node = Node(element) if self.head == None: self.head = new_node return c...
true
00877d064a12653faed963a592a02e29b52798ce
Ankur-v-2004/Python-functions-class12
/prog4_chap5insertion.py
UTF-8
277
4.09375
4
[]
no_license
# Insertion Sort a = [70,49,31,6,65,81,68] print("Original list : ", a) for i in a: j = a.index(i) while j>0: if a[j-1] > a[j]: a[j-1], a[j] = a[j], a[j-1] else: break j = j-1 print("List after sorting : ",a)
true
b5c67f6dd135f26cb580733f0b4b75555d2b7548
RobbieZifchak/coffee-collector
/script.py
UTF-8
5,904
2.515625
3
[]
no_license
import mysql.connector import config import yelp_key import requests import json # Establish connection to database cnx = mysql.connector.connect( host = config.host, user = config.user, password = config.passwd) c = cnx.cursor() key = yelp_key.key count = 0 #Business Search Endpoint url = 'https://api....
true
339921292da60b1f34ca4fdb2d6d69521e725a32
rcshubhadeep/ts-modeling
/prepare.py
UTF-8
3,786
2.78125
3
[]
no_license
import os import argparse import numpy as np import pandas as pd parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument("dpath", type=str) INTERESTING_ACCS = ["4004", "4603", "4654", "5001", "5017", "5201", "5211", "5293", "5575", "5401", "5476"] le_curr = pd.read_excel("Sample/...
true
ab96c43586d7b5ec5cef09280c6ea261fd9e5018
rafa-ribeiro/fluent_python
/capitulo_2/examples/deques.py
UTF-8
336
3.75
4
[]
no_license
from collections import deque dq = deque(range(10), maxlen=10) print(dq) # Rotaciona os elementos, em outras palavas, retira n elementos de uma extremidade e os insere na outra, dq.rotate(3) print(dq) dq.rotate(-4) print(dq) dq.appendleft(-1) print(dq) dq.extend([11, 22, 33]) print(dq) dq.extendleft([10, 20, 30,...
true
6fc248d2f6d56f7f255a03d2dd812e9a38decfae
bambinos/bambi
/bambi/formula.py
UTF-8
3,781
3.484375
3
[ "MIT" ]
permissive
import warnings from typing import Sequence import formulae as fm class Formula: """Model formula Allows to describe a model with multiple formulas. The first formula describes the response variable and its predictors. The following formulas describe predictors for other parameters of the likelihoo...
true
f7e8e415b367216932e328a7e6df233a46ed8bc5
MANAkudo/pyhton
/4-8.py
UTF-8
214
3.5625
4
[]
no_license
print('0~100までの得点を2つ入力してください') n = int(input('1つ目の得点:')) t = int(input('2つ目の得点:')) if n and t >= 60: print('合格です') else: print('不合格です')
true
d929d962be5ffc3a9feea2b78f8f552b21c7d850
x2mercy/Leetcode_Solution
/HouseRobber/solution.py
UTF-8
257
2.625
3
[]
no_license
class Solution(object): def rob(self, nums): """ :type nums: List[int] :rtype: int """ last,now=0,0 for i in nums: last,now=now,max(last+i,now) return now
true
4d985494c0de753dda2f5633c1bc44da22342190
feiguyang/studypy34
/Base/Baselist.py
UTF-8
612
3.75
4
[]
no_license
l = [2, 4, 3, 5] str = "bcdea" def badIterable(): i = 0 iterable = ["a", "b", "c"] for item in iterable: print(i, item) i += 1 def goodIterable(): iterable = ["a", "b", "c"] for i, item in enumerate(iterable): print(i, item) #[(0, 'a'), (1, 'b'), (2, 'c')] def listIterable()...
true
9dfef93f7a7cac5006579a59dd829a96f03c0c4c
omitcn/Leetcode
/22. 括号生成/SolutionA.py
UTF-8
558
3.5
4
[]
no_license
class Solution: reslist = list() def generateParenthesis(self, n: int): rp, lp = n, n self.backtrack(lp, rp) res = self.reslist self.reslist = str() return res def backtrack(self, lp, rp, tmpstr=str()): if rp == lp == 0: self.reslist....
true
c33ee8def32ec5254059777100cf20280b05a6ae
battistowx/MCS
/mcs/utils/segmentation.py
UTF-8
9,025
2.53125
3
[ "MIT" ]
permissive
import uuid import os import numpy as np from scipy import ndimage, sparse from scipy.ndimage import binary_closing, binary_dilation from scipy.ndimage.measurements import label from skimage.morphology import disk, watershed, remove_small_objects from skimage.measure import regionprops from skimage.segmentation im...
true
981d850e8d7f1e45088c54c288d4d5264507e87a
nezlobnaya/hash-tables-project-cs
/applications/histo/histo.py
UTF-8
873
3.90625
4
[]
no_license
# Your code here with open("applications/histo/robin.txt") as f: s = f.read() import re #import regex module def hist(s): counts = {} s = s.lower() # get rid of punctuation s = re.sub(r'[^\w\s]','', s) #regular expression replacement with re.sub # iterate through each word in the sentence using...
true
295f1b0b69bc98a02ed5c7137c76319b35e4a472
PyGy05/CoinMarketCap_scrape
/coin_market_cap.py
UTF-8
5,210
3
3
[]
no_license
from scrape import lst, row, length, crypto_lst, price_lst, market_cap_lst, volume_lst, supply_lst, change_lst import csv from prettytable import PrettyTable import re from colorama import Fore, Back, Style from operator import itemgetter # print("this is price list --> ", price_lst) # # def change_color(crypto, p...
true
c63063ed71536d139b127cc48d2aae18a915e8ba
muhammad-masood-ur-rehman/Skillrack
/Python Programs/adam-number.py
UTF-8
665
4.4375
4
[ "CC0-1.0" ]
permissive
Adam number A number is said to be an Adam number if the reverse of the square of the number is equal to the square of the reverse of the number.  For example, 12 is an Adam number because the reverse of the square of 12 is the reverse of 144, which is 441, and the square of the reverse of 12 is the square of 21, whic...
true
dd137cb7a2d7296e09d5ae8e87c28b108a97cc93
MaratAG/HackerRankPy
/HR_PY_Introduction_4.py
UTF-8
313
3.734375
4
[]
no_license
# HackerRank Introduction 4 Python Division def problem_solution(a, b): # Task function print(a // b) print(a / b) def main(): # Initialization a = 0 b = 0 while (a == 0): a = int(input()) while (b == 0): b = int(input()) problem_solution(a, b) main()
true
1f2fa541de30418e6d9c7fea76b062fe6c300d2e
pansinyoung/python-lint
/443_Two_Sum_Greater_than_target.py
UTF-8
900
4.03125
4
[]
no_license
""" 443. Two Sum - Greater than target Given an array of integers, find how many pairs in the array such that their sum is bigger than a specific target number. Please return the number of pairs. Example Example 1: Input: [2, 7, 11, 15], target = 24 Output: 1 Explanation: 11 + 15 is the only pair. Example 2: Input: ...
true
d1c2b21df0152d5febadf7a7c4cd669217c21be5
fztfztfzt/PythonCase
/人民币金额打印.py
UTF-8
765
2.515625
3
[]
no_license
#coding:utf8 a=120000200009 wei = u'零壹贰叁肆伍陆柒捌玖' hou = u'零拾佰仟' con = u'零万亿' def fuck(s1,count): s = u'' for i in range(len(s1)): if s1[i] == u'0': s = wei[0]+s else : s = wei[int(s1[i])]+hou[i]+s while u'零零' in s: #print 's' s=s.replace(u'零零',u'零') ...
true
221fd7fccb8bcea01dfe208950d2fe4d4aa733c4
jceloria/dotfiles
/.local/bin/timeout
UTF-8
1,651
2.765625
3
[ "MIT" ]
permissive
#!/usr/local/bin/python """Usage: timeout.py [timeout] [command] timeout in seconds before killing [command] command is any command (and arguments) that you wish to timeout""" from __future__ import print_function import datetime import os import signal import subprocess import sys import time # how l...
true
ad8a4ec331355e18f4d3e37df77fcbe02b3c1337
HRODEV/Frequency
/Frequency/Board/ActionPanel/ActionPanel.py
UTF-8
16,633
2.921875
3
[ "MIT" ]
permissive
import Game from Board.ActionPanel.ArrowItem import * from Board.ActionPanel.BuyUnitItems import * from GameLogic.Map import Tile from GameLogic.Unit import Soldier from GameLogic.UnitFactory import getUnitPrice from Helpers import Colors from Helpers.EventHelpers import EventExist from Vector2 import Vector2 class ...
true
8b0a07c50f1d47544c58c951f4a1e08a801212c9
thegreyd/fss16kms
/code/2/think3/think3.3.py
UTF-8
131
3.765625
4
[]
no_license
# Think Python # Exercise 3.3 def right_justify(s): spaces_to_add = 70-len(s) print(" "*spaces_to_add+s) right_justify("Allen")
true
1ee611609e69a3fb89ee587648ea4d4e0d6d2b8b
chungdz/SentimentV2
/rnnforsentiment/test_model.py
UTF-8
1,207
2.59375
3
[]
no_license
from rnnforsentiment.data_process import loadfile, word2vec_load, tokenizer, get_data, batch_size import yaml from keras.models import model_from_yaml if __name__ == '__main__': print('Loading Data...') combined, y = loadfile(['../testdata/neg_test.xlsx'], ['../testdata/pos_test.xlsx'], ['../testdata/neu_test...
true
96caab9502242a4fed4b49c10000fd586c134187
jakubsztyma/OK
/greedy.py
UTF-8
1,099
3.234375
3
[]
no_license
def greedy(processorsNumber, processCount, procLength ): myArray=[] for i in range (processorsNumber): myArray.append([]) #sortowanie malejaco czasow procesow procLength.sort() procLength.reverse() proc_array=[] timer =0 # Tworzenie "tablicy procesorow" for i in range (p...
true
53812ef7d96debbbdd5e0a7808a5b6c026c06bbe
WiGram/Thesis
/markowitzOpt.py
UTF-8
3,827
3.09375
3
[]
no_license
""" Date: February 10th, 2019 Authors: Kristian Strand and William Gram Subject: Markowitz portfolio theory (MPF) Description: This script implements an algorithm to find the optimal portfolio allocation through Markowitz Portfolio Theory, i.e. optimising the Sharpe ratio. """ import numpy as np import pandas as p...
true
d37682184717ff1e6e9e7ae380819ff3369b8a51
ryzhovalex/pytools
/src/logger.py
UTF-8
1,230
3.203125
3
[]
no_license
import sys from typing import Callable, Literal, Type from loguru import logger from .singleton import Singleton class Logger(metaclass=Singleton): """ Logger tool responsible of writing all actions to logs. Simply said - it is a layer between program and loguru created for holding one loguru.logger t...
true
f090d40637f71d873bf39aaa16c625c0da7fe398
goswami-rahul/competitive-coding
/euler/57.py
UTF-8
128
3.359375
3
[]
no_license
n, d = 2, 1 ans = 0 for _ in range(1000): n, d = d, n n += d ans += len(str(n)) > len(str(d)) n += d print(ans)
true
7bfb2a8dd67ebdb9756ab6c1ae4018ffd8387862
tspeigner/pythonlearning
/py_intro/python-basics/Demos/simultaneous_assignment.py
UTF-8
360
3.9375
4
[]
no_license
#Switch b and a. Attempt 1. The Wrong Way. a=5 b=10 a=b b=a print("ATTEMPT 1. The Wrong Way.") print(a) print(b) #Switch b and a. Attempt 2. A Way that Works. a=5 b=10 temp=a a=b b=temp print("ATTEMPT 2. A Way that Works.") print(a) print(b) #Switch b and a. Attempt 3. The Python Way. a=5 b=10 a,b = b,a print("ATTEMP...
true
40ea05cb7d2be77ddf202ae00343af599ce12c86
lekshmijraj/PythonPrograms
/ExceptionHandling.py
UTF-8
124
3.015625
3
[]
no_license
try: print("Id is "+ 10) except: print("Add casting to the int value") finally: print("Completed try/ except!")
true
529527abdf1963f2894610e52261752dfd993da4
anput28/Universita
/Programmi Python/Calcolo Numerico/Programmi esame/gauss_confronto_tempi.py
UTF-8
914
2.84375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import time import algebra_lineare as al nmax = 300 n_range = range(2, nmax, 10) tempo_ottim = np.zeros(len(n_range)) tempo_non_ottim = np.zeros(len(n_range)) k = 0 for n in n_range: A = (2*np.random.random((n, n)) - 1)*2 x = np.ones(n) b = np.dot(A, x) inizio ...
true
2a2527dfdc852834b4b37caa57064550f82a6b57
eliabe71/jogo_cobra_python.04
/Cobrinha/Recordes.py
UTF-8
3,627
2.734375
3
[]
no_license
import pygame class Recordes: def __init__(self): try: pygame.init() except: print("pygame não pode ser iniciado") tela = pygame.display.set_mode((660,500)) pygame.font.init() cambria = "Cambria" f_deault = pygame.font.get...
true
0d963ac727ead4bb74555557aff19ffaa23586bd
BinaKarir-8724/HEXACO
/coreapps/models/keygenapps/cekfile.py
UTF-8
266
2.640625
3
[]
no_license
import os import pathlib pathloc = pathlib.Path.cwd() / "nem.txt" def loc(): if os.path.isfile(pathloc) == True : return True else : return False def createfile(): f = open(pathloc, mode="w+") f.close() print (loc())
true
5e9a63a110a139ee640ab54adc4dcf08f2cd58f4
pbmanis/neuronvis
/sim_result.py
UTF-8
2,924
2.859375
3
[]
no_license
import os, pickle class SimulationResult(object): """ Class used to formalize structure and storage of results from NEURON simulations. """ version = 1 def __init__(self, file_name=None): if file_name is not None: self.load(file_name) def load(self, file_name): ...
true
c6a8d4983db5deaa7379eb3b2fb6d74b1528a3bd
atops/GDOT-Flexdashboard-Report
/time_in_state_playground.py
UTF-8
2,065
2.5625
3
[]
no_license
# %% Imports import pandas as pd import pyarrow.dataset as ds import dask.dataframe as dd import time # %% Read a day's worth of wide atspm event data -- As an Arrow dataset %%time dataset = ds.dataset( 's3://gdot-spm/atspm_wide/date=2022-07-12/', format='parquet') table = dataset.scanner( columns=['Sig...
true
3c5c40fc34411a94498ac9d004ffab3336b104d6
judong93/TIL
/algorithm/0824~/0826/배열 최소합.py
UTF-8
484
2.703125
3
[]
no_license
def f(x, summ): global minv if x == N: if summ < minv: minv = summ elif summ >= minv: return else: for i in range(N): if v[i] == 0: v[i] = 1 f(x+1, summ + mat[x][i]) v[i] = 0 T = int(input()) for tc in range...
true
d81187f4ecdd5da0a8b8888432267a7003d60959
NNicolasNiz/Info
/ejercclase .py
UTF-8
1,997
3.828125
4
[]
no_license
# Me permita agregar la nota de los exámenes, teniendo en cuenta que hay dos módulos. # Debe tener un menú interactivo que permita: # Mostrar el alumno con mayor promedio # Mostrar todos los que aprobaron ambos módulos # Dado el DNI de un alumno, me muestre sus notas. def menu(): print ("1: Cargar un alumno") p...
true
e301aa075ec64a86ddc92f4d4f54c563f5822e99
JanaEndemann/random
/advent_of_code_2021/day1.py
UTF-8
192
3.34375
3
[]
no_license
def part1(lines) -> int: last = None total_deeper = 0 for line in lines: if last and line > last: total_deeper += 1 last = line return total_deeper
true
42707ab85425579994010848839b0e3864076bf4
limittox/leetcode
/Dynamic Programming/1143. Longest Common Subsequence (MEDIUM).py
UTF-8
3,902
4.0625
4
[]
no_license
""" Given two strings text1 and text2, return the length of their longest common subsequence. A subsequence of a string is a new string generated from the original string with some characters(can be none) deleted without changing the relative order of the remaining characters. (eg, "ace" is a subsequence of "abcde" wh...
true
036e3952c58f5a791be6f0b105a985e7218e65cc
MohammadOwda/file-monitoring-lic-extraction
/LPD.py
UTF-8
1,963
2.578125
3
[]
no_license
import cv2 import pytesseract import numpy as np import re import sys def getPlateNumber(imgIn): print(imgIn) image1 = cv2.imread(imgIn) #cv2.imshow('car', image1) img = cv2.cvtColor(image1, cv2.COLOR_RGB2GRAY) #cv2.imshow('car', img) ret, thresh1...
true
59821f3d51588cdd16c60c460a5dc2def3350cf1
Zalasyu/Linear-Regression
/Hmk8BME147/hmk8.py
UTF-8
9,102
3.953125
4
[]
no_license
""" Problem 1 The amounts m of a chemical compound that dissolved in 100 grams of water at various temperatures T were recorded as in Table 1. a. Using the formulas in your textbook (page 149), calculate the intercept and slope of the regression line for the sample. (10 points) b. Graph the line o...
true
7f20b1396575fb2c1c2964e49d4db6b43ad75f01
AQnat/python_basics
/dna_check_snippet.py
UTF-8
681
4.125
4
[]
no_license
def hamming_metric(father, child): distance = 0 for c in zip(child, father): cn, fn = c if cn != fn: distance += 1 return distance if __name__ == "__main__": first_dna = input("1st candidate DNA: ") second_dna = input("2nd candidate DNA: ") child_dna = input('child\...
true
27960124a096a367c4dcfd483cbfb410168cedbb
datasnakes/cookiecutter-orthoevol
/{{ cookiecutter.project_slug }}/misc/Tests and Examples/Mistune/Mistune_test.py
UTF-8
696
3.40625
3
[]
no_license
# -*- coding: utf-8 -*- """ @author: S. Hutchins Mistune is a markdown parser in pure Python with renderer features. """ # Import the modules import mistune # Create a variable for mistune.markdown m = mistune.markdown # Create a markdown file l1 = m('This is a test for **MISTUNE**!') # output: <p>I am using <stron...
true
7465c1a6fddc8009e324ce8c76d0671c9f827bff
nih-megcore/hv_protocol
/meg_stimuli_scripts/artifacts/Artifacts_MEG_FINAL.py
UTF-8
4,645
2.578125
3
[ "CC0-1.0" ]
permissive
''' Simple task to instruct subjects to make certain movements Designed to introduce artifacts into the recording - s,t to trigger the start - q to quit at most timestamp - g,a for left response - b,l for right expects word lists to be in the directory stim/ ACN c. 2018 ''' from psychopy import visual,core,event,g...
true
a7bab7cb0252eea858aab9a3ab18c397908026af
Casper-Smet/LOAN
/loan/visualization.py
UTF-8
3,466
2.703125
3
[ "MIT" ]
permissive
from mesa.visualization.ModularVisualization import VisualizationElement from mesa.visualization.modules import ChartModule from mesa.visualization.UserParam import UserSettableParameter from loan.agentfactory import AgentFactory from loan.helperagent import HelperAgent from loan.helpers import give_node_positions, no...
true
676b0fc84b1de7afe0f57ca5486e8c609b65ebab
turabhassan89/capp30254
/PA3/pa3.py
UTF-8
8,896
2.625
3
[]
no_license
from __future__ import division import pandas as pd import numpy as np from sklearn import preprocessing, cross_validation, svm, metrics, tree, decomposition, svm from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier, GradientBoostingClassifier, AdaBoostClassifier from sklearn.linear_model import Lo...
true
00c78e3ca802e9a45cf66aed32f3e09d5a982849
mariocuomo/networkx
/networkx/algorithms/shortest_paths/tests/test_greedy.py
UTF-8
912
3
3
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
import networkx as nx def heuristic(x, target): d = { 'AQ': 18, 'AN': 31, 'BA': 22, 'BO': 47, 'FI': 40, 'GE': 58, 'MI': 65, 'NA': 0, 'PG': 19, 'PI': 44, 'RM': 18, 'TO': 71 } return d[x] graph = nx....
true
04037dba146e0a7e522c4ba271c7feaebade0bb7
Negfir/Sentiment-Analysis
/main.py
UTF-8
10,371
2.8125
3
[]
no_license
import sys import os import time from nltk.stem import * import sklearn from sklearn.ensemble import VotingClassifier from nltk.corpus import stopwords from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.preprocessing import Normalizer ...
true
b1e96db965a7e774dfd719885522234a00b7820d
franciscomunoz/pyAlgoBook
/chap5-Array-Based_Sequences/R-5.12.py
UTF-8
422
4.25
4
[]
no_license
"""Find the sum of an n x n data set using comprehension syntax""" def find_sum(data): return sum([sum(sublist) for sublist in data]) if __name__ == '__main__': tests = [] tests.append([[1,7,5,8],[3,9,8,7],[1,2,3,4]]) tests.append([[4,5,6,7],[6,5,4,3],[1,8,9,3]]) for i in range(len(tests)): ...
true
667fa3020bc9bdc84a94ad841df7ee22b2205c1f
boryl/jlm-map-esp8266
/compass_hub_test.py
UTF-8
6,150
2.5625
3
[]
no_license
import paho.mqtt.client as mqtt import asyncio from gpiozero import Button, LED import json from time import sleep mqtt_topic = "status" mqtt_broker_ip = "localhost" mqtt_port = 1883 mqtt_pub_topic_direction = "direction" mqtt_pub_topic_map = "map" client = mqtt.Client() # GPIO setup btn_run = Button(10, bounce_ti...
true
52cec02790107624fe0a47664ddb546951ec11bf
justin76tan/LiCode
/playground.py
UTF-8
395
3.390625
3
[]
no_license
def is_matched(expr): left = '({[' right = ')}]' s = [] for c in expr: if c in left: s.append(c) elif c in right: if s.__len__() == 0: return False if right.index(c) != left.index(s.pop()): return False return s...
true
85b350926a0f640fd7f522af31ebc7d3ee731e6d
tr1503/LeetCode
/Math/ValidPerfectSquare.py
UTF-8
322
3.1875
3
[]
no_license
class Solution(object): def isPerfectSquare(self, num): """ :type num: int :rtype: bool """ if num == 0 or num == 1: return True guess = num / 2.0 for i in range(20): guess = (guess + num / guess) / 2.0 return int(guess) == gues...
true
17dc563bf477960ecda175d94a14d89ae4ec3572
young5552/OpenMv_Recognition
/Templatere_Recognition.py
UTF-8
2,602
2.828125
3
[]
no_license
# Untitled - By: XuChao - 周四 8月 2 2018 import time, sensor, image from image import SEARCH_EX, SEARCH_DS from pyb import UART # Reset sensor sensor.reset() # Set sensor settings sensor.set_contrast(1) sensor.set_gainceiling(16) # Max resolution for template matching with SEARCH_EX is QQVGA sensor.set_framesize(senso...
true
78c124f6361f39114f7bf6fae2989a59530c00c4
jesserockz/python-iglo
/src/iglo/helpers.py
UTF-8
144
3.03125
3
[ "MIT" ]
permissive
class Helpers(object): def int_array_to_byte_array(ints): data = bytearray() for i in ints: data.append(i % 256) return data
true
83e48eb36ad6b2603024114015a028f2279c33c8
WUZHEN1991/MutualFundAnalysis
/Model/morningstar.py
UTF-8
6,443
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models # Create your models here. #CharField(相当于varchar)、DateField(相当于datetime), max_length 参数限定长度。 #晨星基金排名 class MutualFundRating(models.Model): code = models.CharField(max_length=50) # 基金代码 name = models.Cha...
true
2dfa5a6e5de19302be72ee112bcc2bfcd05abd65
mateuslucas97/Python
/variaveis.py
UTF-8
309
4.09375
4
[]
no_license
#criando variaveis minha_variavel = "Oolá mundo" print(minha_variavel) var1 = 1 #variavel inteira var2 = 2.2 #variavel float var3 = "eu sou uma string" #variavel texttual (string) var4 = True #booleano verdadeiro var4 = False #booleano falso print(var1) print(var2) print(var3) print(var4)
true
9440a63e657acf2180f36fc1d25b9d422f76bf93
laz08/arithmetic-coding
/src/Encoder.py
UTF-8
5,737
3.015625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python # -*- coding: UTF-8 -*- import Utils import sys, unicodedata, math, collections from sets import Set ## txt: input string ## Src: Source of information (alphabet is the set of letters of 'str') ## k: precision of integers Alpha and Beta def arithmeticEncode(txt, src, k): ######################...
true
e7cf9e7fb7f0bb3cf1f13997f9f4d0cd9485f835
DreamTeam42/TenA
/parser.py
UTF-8
5,102
2.796875
3
[]
no_license
from bs4 import BeautifulSoup import requests import json import time # начальная страница для парсинга start_url = 'http://realty.dmir.ru/msk/sale/prodazha-gorodskoy-nedvizhimosti-v-moskve/' # функция парсинга ссылок на объявления def get_all_urls(url): url_list = [] # получаем html страницы page = reque...
true
85532615aed85b2007655820c4862a006054d634
AK-1121/code_extraction
/python/python_8842.py
UTF-8
141
2.953125
3
[]
no_license
# Python str not callable error &gt;&gt;&gt; mystring = "abcdefghijk" &gt;&gt;&gt; if len( mystring ) &gt; 9: ... mySlice = mystring[:8]
true
00dc29d4a14dd2bd2d37f139fdc7b4cdb26afedc
rahulsoni9/edit_bitly_excels
/src/get_full_url.py
UTF-8
618
3.1875
3
[]
no_license
import re import requests class GetFullURL(object): RE_STRING = r'http://bit\.ly/\w+' def extract_url(self, string): ''' :param str string: :return str: bitly url ''' bitly_url_re = re.compile(self.RE_STRING) return bitly_url_re.search(string) def get_fu...
true
7dfcbbabac6e2af18a3caac32ef0f44b12dd668d
PeravitK/PSIT
/WEEK6/[Midterm] Shorten.py
UTF-8
2,751
3.234375
3
[]
no_license
"""[Midterm] Shorten""" def main(): """[Midterm] Shorten""" num = int(input()) ans = '' skip = 0 while num != -1: num1 = int(input()) if (num == num1 and ans == '') or (ans == '' and num1 == -1): ans += str(num) skip += 1 if num1 == -1 and s...
true
dd2f40576bb9d59f23169ac125f2c8bef2d80062
JoshuaOakland/CurrentWorkSamples
/PythonSamples/speak_to_me_reader.py
UTF-8
1,052
3.421875
3
[]
no_license
""" A python text to speech self educating program if an unknown word is encountered, the program prompts user to say it. Eventually the program will readily digest any known language and translate it to the user's own speech. """ import sys import speak_to_me_speaker import speak_to_me_parser def main(system_arguments...
true
0702e333df0e8125f08288b28534d67df2bf948f
svishakan/Machine-Learning
/Data Preparation.py
UTF-8
8,557
3.40625
3
[]
no_license
# -*- coding: utf-8 -*- """ Data Preparation on Churning of Telecom Company (i.e. switching Network Service Provider from the specified Company) """ import os import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns os.chdir("Datasets") demo = pd.read_csv("demoDe...
true
2e43bcbf6ecd996eea5870ceb8507bede3dca794
whitebeard4708/Morse-Code-Generator
/morse1.py
UTF-8
1,282
3.609375
4
[]
no_license
import os import re import argparse ''' dot : 1 unit dash: 3 units space between dots and dashes in the same letter: 1 unit space between dots and dashes in the same word: 3 units space between words: 7 units Morse code was designed so that the length of each symbol is approximately inverse to the frequency of occurre...
true
0a9e2985df52c26596e0a4ec0b0c9a242d4c0020
ScottehMax/pyMon
/triggers/example.py
UTF-8
297
2.59375
3
[ "MIT" ]
permissive
from trigger import * class Example(Trigger): def match(self, info): return info.get('what') == '!example' def response(self, info): return 'response string' # Can also return multiple messages in the form of a list # return ['this', 'is', 'response']
true
407e858b260413cfeaaa694721944dabffd14931
gvigkannan/DS541_DeepLearning
/Visual_Question_Answering/Question_encoding.py
UTF-8
7,646
2.5625
3
[]
no_license
import sys import numpy as np from nltk.tokenize import word_tokenize import json import csv import re #params = {"input_train_json":"vqa_raw_train.json", "input_test_json": "vqa_raw_test.json" "num_ans": 1000,"output_json":"data_prepro.json"} params ={"input_train_json": "vqa_raw_train.json", #"input_test_js...
true
596905779a039b554933f5153ada55e023ac6bfc
JuanManuelHuerta/TextAnalyticsAndMining
/lesson2/l02s05.py
UTF-8
2,018
2.984375
3
[]
no_license
import sys from bs4 import BeautifulSoup import re import nltk from nltk.tree import Tree import os from nltk.parse import stanford #### Im losing the label of the subtree as I recursively traverse the tree, only leafs will keep label def traverseTree(tree): #print "Im here", tree, tree.height(), tree.label(), s...
true
ee29195045c086e182ac25d669e851d17f902274
lukasheide/fairness-comparison
/fairness/algorithms/Ben/weaklearners/nearestneighbor.py
UTF-8
224
2.78125
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
def dist(x,y): return sum((a-b)**2 for (a,b) in zip(x,y)) def nearestLearner(draw): data = [draw() for _ in range(100)] def classify(x): return min(data, key=lambda y: dist(x, y[0]))[1] return classify
true
74198b7e0455e9d52bdf0d51e898090c52fef3ea
taowuwen/codec
/python/test/test_utils.py
UTF-8
850
3.234375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from functools import wraps import time def separate_func(func): @wraps(func) def wrapper(*args, **kwargs): print() print() print("------------------------------------------------------") print("-----------{:^30}-------------".form...
true
17183b6653ef1698b333cb1eb3691f4be9391fe5
imtnd/wacate2018winter
/decision.py
UTF-8
106
2.9375
3
[]
no_license
def checkEvenNumber(num): result = False if (num %2 == 0): result = True return result
true
086ed0c373bc8fe5c3869e4ccf3a78261c2417e7
giune/DiscordMusicBot
/bot.py
UTF-8
9,534
2.71875
3
[ "Apache-2.0" ]
permissive
import discord import shutil from discord.ext import commands from discord.utils import get import youtube_dl import os from os import system import asyncio BOT_PREFIX = '.' bot = commands.Bot(command_prefix=BOT_PREFIX) current_index = 1 volumes = 15 queues = [] PlayLst = ['https://www.youtube.com/watch?v=yNC0p2RXeXM...
true
07df4bfdb5dca0be37c4551afffd46b917b05ac9
CivBase/testing-parse
/archive/flask_server/app/util/security.py
UTF-8
768
3
3
[]
no_license
""" Security management tools. """ import os import sys def install_secret_key(app, filename='secret_key'): """ Configure the SECRET_KEY from a file in the instance directory. If the file does not exist, print instructions to create it from a shell with a random key, then exit. """ filename =...
true
d85b8653df2fdfadcd62c16feb4b892c4e5d64f5
nnimish19/ml-basic-implementations
/rnn.py
UTF-8
8,812
3.21875
3
[]
no_license
# Observations: # # randomly initialising weights # Adding bias terms for each neuron> Great impact # step size = 0.95 instead 0.1 > great impact # hidden dimensions: 4(poor), 8(fine), 16(good) # regularization? Not having much effect. But if you keep, self.reg = .0001 works fine. not greater than this. import matplot...
true
305bb10ab117e2c1fd266f7661432b22d02cbc40
eknight7/cv_build18
/segmentation/color_segment.py
UTF-8
3,530
3.234375
3
[ "MIT" ]
permissive
''' color_segment.py - given a color RGB image, convert to HSV color space and play with controls to segment the image based on choice of color, get the HSV bounds for that color Author: Esha Uboweja (euboweja) ''' # Import Libraries import cv2 import numpy as np import sys hmax = 180 smax = 255 vmax = 255 # Callback ...
true
710de6d21585d8ffd9885bbb5103e3ac6d848f69
jweinell/CSC442
/challenges/ftpMakeCovert.py
UTF-8
1,972
3.109375
3
[]
no_license
#!/usr/bin/python from random import randint def toBinary(text, bits=7): binArray = [] for character in text: nonstandard = bin(ord(character))[2:] binArray.append('0' * (bits - len(nonstandard)) + nonstandard) return "".join(binArray) def intBinary(integer, length = 0): max = 2 ** le...
true
3448e003876ce432912858d05b15f1628bab6c9d
ChristofferEastcastle/Python
/Kattis/bela.py
UTF-8
272
2.921875
3
[]
no_license
values = {'A':11, 'K':4, 'Q':3, 'J':2, 'T':10, '9':0, '8':0, '7':0} dominant_values = {'A':11, 'K':4, 'Q':3, 'J':20, 'T':10, '9':0, '8':0, '7':0} suit = ['S', 'H', 'D', 'C'] first_line = input().split(' ') total_hands = int(first_line[0]) dominant_suit = first_line[1]
true
e2e16fa1a06974728d9d9610308c3ecd7b1622c6
Layto888/laylib
/laylib/default_engine.py
UTF-8
5,479
3.390625
3
[ "MIT" ]
permissive
""" Basic short documentation The DefaultEngine class is intended to be used as a base class for your main engine game class, for fast prototyping your engine and let you focus on the game logic itself. The DefaultEngine contain: ----------------------------------- [A] - PUBLIC ATTRIBUTES TO USE: -----------...
true
7ba1184243e5c7f8dae541ca7b90730cd1fc2e6a
nicholaskarlsen/FYS3150
/Project_3/code/old/solver.py
UTF-8
1,675
3.09375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # Written by Nicholas Karlsen # Python version 2.7.15 """ An ODE solver which solves for single and N-body systems for systems which is governed by which are functions of their position. """ from __future__ import division # Nobody expects the integer division import num...
true
774d4c851cad161ed37ac9191569295a95e16f67
pykili/py-204-hw1-Cultrett
/task_3/solution_3_2.py
UTF-8
313
3.328125
3
[]
no_license
# your code here for smth in 'a'*10: # your code here user_input = input() # your code here print(alphabet) alphabet = "" user_input = "" for i in range (1,11): line = input() user_input = (user_input + line) for i in user_input: if i not in alphabet: alphabet = (alphabet + i) print(alphabet)
true
b34e6c92130dee15021ee724d054d2c274292a3d
lio3867/SERS
/Fluigent_FRP/FRP/exceptions.py
UTF-8
977
2.609375
3
[]
no_license
# -*- coding: utf-8 -*- """This module contains the exceptions raised by the FRP SDK, to enable application control via try/except blocks""" from __future__ import print_function import sys import inspect class FRP_NoFlowboard(Exception): """Raised if the specified Flowboard is not connected to the comp...
true
b85629fb3b1ee5916c1d1b26283ffe3d4b8c0723
rams16592/FaceDetection-DrLevac
/face_detectionv3.py
UTF-8
6,281
2.859375
3
[]
no_license
"""http://docs.opencv.org/3.1.0/d7/d8b/tutorial_py_face_detection.html#gsc.tab=0""" import cv2 import time import os # Get the current directory we're in dir_path = os.getcwd().replace("\\", "/") cur_date = time.strftime("%d-%m_%H-%M-%S") # Load the face cascade. If it's empty, most likely not in the right spot. casca...
true
1525a181afeb36a1048c9c45782beec15d41f64a
Lyrositor/ATBP-Tools
/atbp/replays/replay.py
UTF-8
2,202
2.96875
3
[ "WTFPL" ]
permissive
# atbp-lib # Replay file tools. import yaml from ..net.protocol import GamePacketVar def var_representer(dumper, data): """ YAML Representer for the GamePacketVar class. """ return dumper.represent_sequence("!V", [data.v, data.t]) yaml.add_representer(GamePacketVar, var_representer) class...
true
57e67b6ceaaf84880510771391357d25bfbb0553
asmaamirkhan/AppliedDataScienceSpecialization
/3-AppliedMachineLearning/2-SUPERVISED-LEARNING-P1/AsmaaLogisticRegression.py
UTF-8
2,364
3.609375
4
[]
no_license
# author: Asmaa ~ 2019 # Coursera: Applied Machine Learning # WEEK2 - Supervised Learning - Logistic Regression # import libraries from sklearn.linear_model import LogisticRegression import matplotlib.pyplot as plt from adspy_shared_utilities import plot_class_regions_for_classifier_subplot import pandas as pd from sk...
true
0008e3517d474d8f0c1c12440f71e343eb46a384
babak77/recome
/recom_me/movies/views.py
UTF-8
9,377
2.515625
3
[]
no_license
from django.shortcuts import render from django.http import HttpResponse from .forms import MovieForm ,PersonForm, RatingForm #from .models import Movie, Person, Gener, Occupation from .models import Movie, Person, WorkedOn, Role import pickle try: from django.utils import simplejson as json except ImportError: ...
true