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
24efeb71f8ba789df49a9f0f9dc05bc2293bc5e4
devang191/algorithms_competitions
/codeforces/problem_set/499B.py
UTF-8
339
2.671875
3
[]
no_license
import math import sys def main(): n, m = map(int, raw_input().split()) words = {} for i in range(m): a, b = raw_input().split() words[a] = b lecture = raw_input().split() for word in lecture: if len(words[word]) < len(word): print words[word], else: print word, if __name__ == '_...
true
dbf4b9a5dc5450bbbb3d91bf4823396b1d486f0e
GrubbClub/CoderBytes
/bj_highest.py
UTF-8
2,428
3.671875
4
[]
no_license
def bj_highest(str_arr): aces = 0 #track number of aces to know how many to reduce when over 21 king = False #tracks status of face cards for comparison queen = False jack = False ten = False faces = 0 total = 0 #running total of hand highest = "" #current highest card high_value = 0 #for comparing high...
true
2d4861b6a7718cadf004f19ce46a6020078a8ed7
JoseMLopezSanz/datasets
/datasets/multinli.py
UTF-8
1,359
2.59375
3
[]
no_license
import os import pandas as pd from datasets.dowloader import maybe_download, extract_zip URL = "http://www.nyu.edu/projects/bowman/multinli/multinli_1.0.zip" DATA_FILES = { "train": "multinli_1.0/multinli_1.0_train.jsonl", "dev_matched": "multinli_1.0/multinli_1.0_dev_matched.jsonl", "dev_mismatched": "mul...
true
5a5abff1f4d111120aedcc0b95653efba2d23028
hnahlawi/skipliststructure
/multiset.py
UTF-8
7,190
3.703125
4
[]
no_license
import random from skiplist import * class Multiset(): def __init__(self): '''(Multiset) - > NoneType initiate a multiset data type. ''' # create a skiplist self.SkipList = SkipList() def __contains__(self, item): ''' (Multiset, int or float or str...
true
93f73119799246d100259172ef6c579b63b23b88
nim65s/scripts
/contacts/vcf_parser.py
UTF-8
1,664
3.046875
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python from pathlib import Path from vcards import Vcard def import_ab(filename): vcards = {} started = False content = [] with open(filename, "r") as f: lines = f.read().replace("\n ", "").replace("\n\t", "").split("\n") for line in lines: ls = line.strip() ...
true
a173b2660dc60c413efab09bc4e1f70eb479c37e
tiqwab/atcoder
/arc110/a/main.py
UTF-8
317
3.265625
3
[]
no_license
def gcd(x, y): if x > y: x, y = y, x if x == 0: return y return gcd(y % x, x) def lcm(x, y): return (x * y) // gcd(x, y) def solve(N): ans = 1; for i in range(2, N+1): ans = lcm(ans, i) print(ans + 1) if __name__ == '__main__': N = int(input()) solve(N)
true
dbba5ba2240d90728e8eff6bb36ac12c8f96e627
cnovacyu/python_practice
/automate_the_boring_stuff/Chapter9_SelectiveCopy.py
UTF-8
1,060
3.5625
4
[]
no_license
#! python3 # Walk through a folder tree and search for files with specific file # extensions. Copy the files to a new folder. import shutil, os, argparse # create args that need to be populated to run script # args for file extenstion, source directory, and destination directory # for copied specified files parser =...
true
a9ed60c145f6a4a3f57481c6d465ec29cb7c6438
saml/x
/pika_heartbeat/blocking_publisher.py
UTF-8
2,887
2.625
3
[]
no_license
import logging import os import queue import threading import time import pika import pika.exceptions _log = logging.getLogger(__name__) QUEUE_NAME = "test" HEARTBEAT = 2 def callback(channel, method, properties, body): _log.info(" [x] Received %s", body) time.sleep((HEARTBEAT + 1) * 2) def connect( ...
true
86a0fe593fe106191057c14bead6ed80c795374a
Zozoz/OnlineJudgeSite
/client.py
UTF-8
2,799
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # encoding: utf-8 import re import socket import time import config from en_de_coder import MyEncoder class Client(object): _instance = None def __new__(cls, *args, **kwargs): if not cls._instance: cls._instance = super(Client, cls).__new__( cl...
true
946943abf616cee02e818b938c69681fb965e0db
Aasthaengg/IBMdataset
/Python_codes/p02735/s412637352.py
UTF-8
713
3.09375
3
[]
no_license
import math from functools import lru_cache @lru_cache(maxsize = None) def count_change_point_min(r , c , current_color): min_values = list() if r != h-1: min_values.append(count_change_point_min(r+1, c, S[r][c])) if c != w-1: min_values.append(count_change_point_min(r, c+1, S[r][c])) i...
true
6c9842c7c02cbfdc4398724f5dbdd38983fc0075
maneeshpm/IITKBucks-Assignments
/Assignment2/signer.py
UTF-8
345
2.890625
3
[]
no_license
from Crypto.PublicKey import RSA from Crypto.Hash import SHA256 from Crypto.Signature import PKCS1_PSS plainText = input("Enter encryption text: ") keyPath = input("Enter the path of the private key: ") key = RSA.import_key(open(keyPath).read()) h = SHA256.new(plainText.encode('utf-8')) sign = PKCS1_PSS.new(key).sign...
true
976742ca11e62985f2a2fffc99eafcc0c24ebccd
nek-00-ken/check_network
/check_flux.py
UTF-8
5,029
2.5625
3
[]
no_license
import subprocess import os import getpass import json import sys import getopt from os import path # glob vars glob_binaries = ["ssh"] def check_prerequisites(): res = True for binary in glob_binaries: cmd = subprocess.Popen(["which", binary], stdout=subprocess.PIPE) if len(cmd.stdout.readli...
true
33e161deb408cb5c6cb1b08b5162eacf04127e01
wheellzArmine/SkyHead
/mMath/fpg_automation/concept_maker.py
UTF-8
1,186
2.65625
3
[]
no_license
#from campaign_maker import Campaign #from atomic_creative_maker import AtomicCreative import parameters class Concept(): def __init__(self, cursor, adv_id): self.cursor = cursor self. advertiser_id = adv_id self.concept_name = parameters.CONCEPT_NAME #self.id #self.concept_create def message_cons...
true
ea1bf3afb7de0eab360d8072d02ea1c79be0ddc6
GLARISHILDA/07-08-2021
/group_by_owners.py
UTF-8
1,068
4.125
4
[]
no_license
# Problem statement: Implement a group_by_owners function that: # i)Accepts a dictionary containing the file owner name for each file name. # ii) Returns a dictionary containing a list of file names for each owner name, in any order. class GroupbyOwners: @staticmethod def group_by_owners(file...
true
25a0ef91df1c3b849cdaa3849dbae37472943822
nusoff01/CLS_192
/wiki/coords_to_R.py
UTF-8
576
3.203125
3
[]
no_license
#go from a list of coordinates and years to a list of coordinates and freqs from collections import defaultdict import csv sourceData = "./locations/" print("Lat, Long, num") coords_list = [] with open(sourceData + 'noise_pre.csv') as csvfile: reader = csv.reader(csvfile, delimiter=',', skipinitialspace=Tr...
true
3dcb6cb64cbbd1fe6fadf6fa81f7399cacb7b992
ShaniGam/Text-Generation
/text_generator.py
UTF-8
4,304
3.078125
3
[]
no_license
# coding=utf8 from __future__ import print_function from keras.layers import Dense, Activation, Dropout from keras.layers import LSTM from keras.models import Sequential from keras.optimizers import RMSprop import numpy as np import codecs # load the files train = codecs.open('train.txt', 'r', encoding='ut...
true
b57da578e205383ae7306f8c6d4573525de902dd
RoyKwonn/Problem-Solving
/Python-for-coding-test/6-Sorting/Q23-국영수.py
UTF-8
321
3.359375
3
[]
no_license
from sys import stdin n = int(input()) data = [] for _ in range(n): temp = list(stdin.readline().split()) data.append([temp[0], int(temp[1]), int(temp[2]), int(temp[3])]) # 이름, 국, 영, 수 data.sort(key=lambda student: (-student[1], student[2], -student[3], student[0])) for x in data: print(x[0])
true
690be4439bcd6d16083f86ec9069c040f6edd373
xliu0628/data_visulization
/extend_colorbar.py
UTF-8
1,916
3.25
3
[]
no_license
## problem to be solved: extend the colorbar used in plt.contourf. ## Issue identified: extend='both', norm = MidpointNormalize(midpoint=0.) and self-defined colormap seem to contradict with each other. #%% How to define your own colormap from matplotlib.colors import LinearSegmentedColormap import matplotlib.colors...
true
45c47317420d1fb00a033071d2c0d48a2c526a6b
sharonwangg/cs411-proj
/Data_cleaning/cleaner_in.py
UTF-8
1,666
2.984375
3
[]
no_license
import requests import pprint import urllib.request as urllib import zipfile import pymysql.cursors import json ''' data={} i=0 x= requests.get('https://openlibrary.org/data/ol_dump_latest.txt.gz') with open('data1.txt', mode='rt') as f: text = f.read(1000) # Reads the first 100 character and moves pointer to 101...
true
d676800cf311c7aad155c02cdc05a6384756d3bf
vencabot/monster_collecting_jrpg
/mockups/version_5/test_abilities.py
UTF-8
1,381
3.109375
3
[]
no_license
import battlelib class Slap(battlelib.UnitAbility): def __init__(self, owner): super().__init__(owner, "Slap") def can_be_used_on(self, target): if self.owner.mp >= 2: return True return False def deal_some_damage(self, target, damage, effectiveness, battle)...
true
7d5cef79ef2e2b1b155215ab79367c14974379c9
susanacorrea/Unidad-III
/conexion con el servidor postgesql/write_blob.py
UTF-8
1,458
3.15625
3
[]
no_license
""" Autor: Susy """ #Importamos la librería psycopg2 y config (el archivo que hemos generado) import psycopg2 from config import config def write_blob(part_id, path_to_file, file_extension): """ Inserción de archivo BLOB dentro de una tabla""" #Inicializamos la variable de conexión conn = None ...
true
738a905270aacf50806e3c765e3d11d0e9eb100d
pppppwj/leetcode
/py/Apple/Linked_Lists/Add_two_numbers.py
UTF-8
1,005
3.359375
3
[]
no_license
from Linked_List import ListNode from Linked_List import Linked_List # 2 -> 4 -> 3, 5 -> 6 -> 7 def addTwoNumbers(l1, l2): temp1, temp2 = l1, l2 flag = (temp1.val+temp2.val)//10 head = ListNode((temp1.val+temp2.val) % 10) p = head temp1 = temp1.next temp2 = temp2.next while temp1 and temp...
true
c48ed1e8987c4ce6494408c6c962876071b8cc4d
verbitskyS/Face_Rec_Server
/checkData.py
UTF-8
127
2.53125
3
[]
no_license
import dataBase import numpy as np res = {0:0.5, 1:0.7, 2:0.3} print(min(res.values())) ld = [[2,6],[3,4]] print(len(ld))
true
de4b37a101142354ad681f92f995514db4df60e0
domenikjones/mcts_ai
/src/utils/engine.py
UTF-8
357
3.03125
3
[]
no_license
import math import time def get_distance(a, b): x = a[0] - b[0] y = a[1] - b[1] return math.sqrt(x ** 2 + y ** 2) def get_ms_per_frame(fps): return 10000 / fps def get_ts(): return int(round(time.time() * 1000)) def to_pygame(p): """Small hack to convert pymunk to pygame coordinates""" ...
true
adc68fd299640ade60f98d4e0a1679e55646c07a
Rthe1st/board_game_ai
/board_game/console_ui/play.py
UTF-8
2,371
3.4375
3
[]
no_license
from ..api.game import Game, MoveError from ..api import game import os def pretty_str(game, reverse=False): string = " 0 1 2 3 4\n" rows = str(game).split("\n") if reverse: rows = list(reversed(rows)) for index, row in enumerate(rows[:-1]): if reverse: row = "".join(li...
true
a42839656932b76eacf77f510f38c7be905ffe1a
analogpixel/adventOfCode2018
/day12/code2.py
UTF-8
2,241
2.859375
3
[]
no_license
#!/usr/bin/env python ## This code will get there eventually maybe? it's at least faster than code.py # but the trick is to figure out that at some point the pattern starts # repeating over and over # So i took a point in time (itteration 161) and then subtracted 50 billion # and then 1 since I started at 0, and then...
true
17ec4babacb7cad2bf95a03566d1887c82b05717
maryamkh/MyPractices
/Search_for_a_Range.py
UTF-8
2,841
3.84375
4
[]
no_license
#Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. #If target is not found in the array, return [-1, -1]. #You must write an algorithm with O(log n) runtime complexity. class Solution: def searchRange(self, nums: List[int], target: int)...
true
a7e1a7bb22bf56b85fd3c0a7a5e0b8a5d6843708
trando46/Projects
/Python/bdo_hw5.py
UTF-8
3,374
3.96875
4
[]
no_license
# Bao Tran Do # May 10, 2021 # HW5 # This algorithm is for building a max heap since we want the array to have # ascending order # Source of the algorithm https://en.wikipedia.org/wiki/Heapsort # Sort the array of the given size def heapSort(arr): length = len(arr) index0 = 0 # largest value located at th...
true
fe095c729fcca72a228b39facbc29ca4543ebd71
ardenzhan/dojo-python
/arden_zhan/Python/Python Fundamentals/compare_lists.py
UTF-8
603
4.15625
4
[]
no_license
#Compare Lists # list_one = [1,2,5,6,2] # list_two = [1,2,5,6,2] # list_one = [1,2,5,6,5] # list_two = [1,2,5,6,5,3] # list_one = [1,2,5,6,5,16] # list_two = [1,2,5,6,5] list_one = ['celery','carrots','bread','milk'] list_two = ['celery','carrots','bread','cream'] def compare(one, two): if len(one) != len(two)...
true
73b1d98111c8d07a71d907a51f6af8f0e74b48c3
arthurarj/ttdp_project
/utils/feature_extractor.py
UTF-8
953
2.90625
3
[]
no_license
import numpy as np import pandas as pd import abc # Component (Abstract) class FeatureExtractorComponent(metaclass=abc.ABCMeta): """ Define the interface for objects that can have responsibilities added to them dynamically. """ @abc.abstractmethod def getFeatures(self): pass class Feat...
true
74f42b1d8cef02c8171e7cd4a6c9205b3e7314c5
cvkm/Short-URL
/url_shortener/docs/scripts/models.py
UTF-8
1,195
2.90625
3
[]
no_license
import string from datetime import datetime from random import choices from sqlalchemy.orm import validates from extensions import db import logging from flask import flash, redirect, url_for class Link(db.Model): """ Creates the table *Link* in the database """ id = db.Column(db.Integer, primary_key=True) ...
true
778df43f7f51e95a8435b58af3cc1e5388f6e3a1
kevinneu/mycompass
/charts/CompanyInfoChart.py
UTF-8
6,491
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- import matplotlib.ticker as ticker import matplotlib.font_manager as font_manager #__font_properties__ = font_manager.FontProperties(fname='/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc') __xaxis_rate__ = 10.0 / 230.0 __yaxis_rate__ = 0.3 class CompanyInfoChart: ''' Company Basic Informati...
true
361fdcb7151d32b90182e433f0033e3801857f8e
krishnanunni-pr/Pyrhon-Django
/PYTHON_COLLECTIONS/Dictionary/dict.py
UTF-8
134
2.859375
3
[]
no_license
##a={1:2,{9:9}} #not possible b={1:2,2:{3:6}} # print(b) #key is homogeneous #key must not be dictionary # values can be dictionary
true
e76fac5aaf45d99bdeb401b7e0bcdb9dfca724d8
gerberl/skalpp
/test.py
UTF-8
3,553
2.890625
3
[ "BSD-3-Clause" ]
permissive
from skalpp import ( ScalerOHEncoderWrapper ) import numpy as np import pandas as pd from sklearn.datasets import make_regression def test_1(): """ test the scaler/encoder with some tiny toy datasets """ tiny_data = [ { 'name': 'Bizcuit', 'age': 29, 'city': 'Manchester', 'gen...
true
c35d40a5089f1ab37e6828a33cb5f48013f774a7
nekpoudom/projects
/circular_list/minCircList2.py
UTF-8
2,101
4.59375
5
[]
no_license
""" This program finds the smallest number in a constantly increasing circular list. Requirement: Make your program as fast and effcient as possible. Author: Nse Ekpoudom Created: July 11, 2018 """ def getMinVal(circularList, listLength): """ This function takes a sorted circular list (circularList) of len...
true
f55aa8edc428e594a0215692b63e78e8d93692ef
lyyljs/CheckiO_Games
/Scientific Expedition/Digit Stack/Digit_Stack.py
UTF-8
1,208
3.5625
4
[]
no_license
#!/usr/bin/env python # coding:utf-8 class DigitStack(): ''' >>> digit_stack(["PUSH 3", "POP", "POP", "PUSH 4", "PEEK",\ "PUSH 9", "PUSH 0", "PEEK", "POP", "PUSH 1", "PEEK"]) 8 >>> digit_stack(["POP", "POP"]) 0 >>> digit_stack(["PUSH 9", "PUSH 9", "POP"]) 9 >>> d...
true
c5113ccb4ecff532e6a5a5c35be8e9c372d5cbaa
erickgust/python-exercises
/mundo-01/ex014.py
UTF-8
136
3.921875
4
[]
no_license
C = float(input('Informe a temperatura em °C: ')) F = 32 + (C * 1.8) print('A temperatura de {}°C corresponde à {}°F!'.format(C, F))
true
263536260f90172e531ab3bb32820771a9fcac32
robertolegido/python_examples
/argumentos_cli.py
UTF-8
490
3.609375
4
[]
no_license
import sys #Probando una cosa print('Modulo importado sys') print('') print("Los argmentos son: ", sys.argv) print('') print('Nombre del script en ejecucion: ', sys.argv[0]) print('\n\nsuma de parametros\n\n') numero1 = sys.argv[1] numero2 = sys.argv[2] try: numero1 = float(numero1) numero2 = float(numero2) total...
true
4fbafc0e240b6e3e24526d62b8e2421421b032eb
leilahassan/introduction-python-leila
/5lesson/range_10.py
UTF-8
48
3
3
[]
no_license
values = range(11) for i in values: print(i)
true
f210b5595b80300af2d93a20583398e0801cbfb8
siyuan-tang/google_asr
/scripts/ground_truth.py
UTF-8
1,487
3.1875
3
[]
no_license
def filename_to_sentence(filename): # filename[0] if filename[0] == "b": first_word = "bin" elif filename[0] == "l": first_word = "lay" elif filename[0] == "p": first_word = "place" else: first_word = "set" # filename[1] if filename[1] == "b": second_...
true
394950af4c09e0ab1807b3f3e71e1e91e966bced
akihikoy/ay_test
/python/models/model_fit/lin_motion.py
UTF-8
1,840
3.03125
3
[]
no_license
#!/usr/bin/python #\file lin_motion.py #\brief Identifying linear motion from position observations. #\author Akihiko Yamaguchi, info@akihikoy.net #\version 0.1 #\date Jan.18, 2021 import numpy as np #Estimate the current position and velocity from time-position sequence #where we assume the linear constant v...
true
efedfb86979c0f195d74d9bfcf167e08f33b93d8
viniser/binance-toolbox-python
/spot/list_break_symbols.py
UTF-8
372
2.671875
3
[]
no_license
#!/usr/bin/env python """ Lists all symbols in BREAK status python list_break_symbols.py """ from binance.spot import Spot as Client key = '' secret = '' # For production client = Client(key, secret) response = client.exchange_info() for symbol in response['symbols']: s = symbol['symbol'] if symbol['statu...
true
185ac90e16d1e8b2772af61d7c90ccd10d6659ff
Tvashta/cp
/LeetCode/MedianStream.py
UTF-8
674
3.671875
4
[]
no_license
import heapq class MedianFinder: def __init__(self): self.maxh = [] self.minh = [] def addNum(self, num: int) -> None: heapq.heappush(self.maxh, -num) heapq.heappush(self.minh, -heapq.heappop(self.maxh)) if len(self.maxh) < len(self.minh): heapq.heappush(s...
true
c127826df076df8974f96e37caafeae55fce02d3
davidmogar/lexgen
/lexgen/trimmer.py
UTF-8
2,961
2.921875
3
[ "MIT" ]
permissive
import collections import os import random from .utils import filter_dict_by_iqr BASE_DIR = os.path.dirname(__file__) class Trimmer: def __init__(self, path): self._datasets_path = path self._females = collections.defaultdict(int) self._males = collections.defaultdict(int) self....
true
72a344dc696cbf5494b030c5949d6d51f2990c54
AthenaTheOwl/leetcode
/406_Queue Reconstruction by Height.py
UTF-8
311
3.03125
3
[]
no_license
class Solution: def reconstructQueue(self, people): """ :type people: List[List[int]] :rtype: List[List[int]] """ sp=sorted(people,key=lambda x: (x[0],-x[1]), reverse=True) result=[] for x in sp: result.insert(x[1],x) return result
true
a082aa2e6358e2d419eb83e1cc3e07881c2dba42
AmmarKamoona/RFS-Energy-Anomaly-Detection-of-Defect
/code/utils/utilis.py
UTF-8
12,448
2.65625
3
[ "MIT" ]
permissive
import numpy as np import numpy import torch import matplotlib.pyplot as plt import pandas as pd from mvtec_train import PossionMLE from utils.mvtec_utils import get_mvtec from sklearn.metrics import roc_auc_score, confusion_matrix, auc, roc_curve from sklearn.metrics import precision_recall_fscore_support as prf from ...
true
4603e0782746854f399e29f18777501975279f2b
jperez-89/contactos
/django_crud/app/aplicacion/views.py
UTF-8
3,115
2.546875
3
[]
no_license
from django.shortcuts import render, redirect from django.contrib import messages from .models import * from .forms import FormContacto from django.core.exceptions import ObjectDoesNotExist def Home(request): lstContactos = Contacto.objects.all() context = {'lstContactos': lstContactos} return render(re...
true
33d1f7d75ff3dd9e96342683db7f698a233a8989
sy1918/Manga-Text-Segmentation
/code/RectangleGenerator.py
UTF-8
1,761
3.46875
3
[ "MIT" ]
permissive
import numpy.random as random class Rectangle: def __init__(self, x, y, width, height): self.x = x self.y = y self.width = width self.height = height def intersects(self, rect): return (self.x < rect.x + rect.width and self.x + self.width > rect.x and ...
true
858564215d25f788eb73fee51af91290fcbfefa8
AkhtemWays/Algorithms-and-data-structures-coursera-specialization
/Algorithms on graphs/bfs.py
UTF-8
2,430
4.03125
4
[]
no_license
#Uses python3 # Problem Description: Task: Given an undirected graph with n vertices and m edges and two vertices u and v, compute the length of # a shortest path between u and v (that is, the minimum number of edges in a path from u to v). # Input Format: A graph is given in the standard format. The next line contains...
true
5bf54e29988c49ee898bfc9e7573233f48749f8b
Wolff09/nap
/processing/__main__.py
UTF-8
483
2.765625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys, os from process_data import process_data def main(cmd_args): if len(cmd_args) < 3: print "Usage: processing path/to/nodes/file path/to/edge/file path/to/output/file [deletion_names...]" elif not os.path.isfile(cmd_args[0]): print "Node file is no file" ...
true
482c0ebec9e7df2ab0ea1348aaa454173b23519f
freedom1810/ttud
/thuat_toan_ung_dung/c2/G-SORT-INT.py
UTF-8
236
3.4375
3
[]
no_license
# 5 # 7 4 1 2 3 n = int(input()) num_str = input().split(' ') # list_num = [int(num) for num in num_str] list_num = list(map(lambda i: int(i), num_str)) list_num.sort() for i in range(n): print(list_num[i], end = ' ')
true
e0cc0cde1712ecc426c956734c0b55672ddf583d
mohitkhosla/disease-prediction
/docs/Dataset-and-ML-Algorithm/DBSCAN/Accuracy/accuracy.py
UTF-8
851
3.078125
3
[]
no_license
"""fp= open("File.txt","r") print(fp.read())""" list_of_lists = [] with open('test2.txt') as f: for line in f: inner_list = [elt.strip() for elt in line.split(',')] # in alternative, if you need to use the file content as numbers inner_list = [(elt.strip()) for elt in line.split(',')] ...
true
395f5a897cff29f966083a774ec54d7c0abccfe4
emedd33/TKT4140-Numerisk-Beregninger
/Oving2/problem3.py
UTF-8
1,234
2.9375
3
[]
no_license
import numpy as np def PendulumHeuns(N): h = 10 / N vel = [0] velp = [0] t = [0] thetta = [85] thettap = [85] for i in range(N): thettap_app = np.radians(thetta[i])+h*func2(vel[i]) thettap.append(np.degrees(thettap_app)) velp_app = vel[i] + h*func1(vel[i],thetta[i])...
true
51770daf563d37b39dcc33cb870c66f666c82765
wyaadarsh/LeetCode-Solutions
/Python3/0371-Sum-of-Two-Integers/soln.py
UTF-8
157
2.796875
3
[ "MIT" ]
permissive
class Solution: def getSum(self, a, b): """ :type a: int :type b: int :rtype: int """ return sum((a, b))
true
1c3fbeed28c0c85acb4935f02d897befdab8eaca
bmispelon/pythonchallenge
/c12/solve.py
UTF-8
952
3.3125
3
[]
no_license
# http://www.pythonchallenge.com/pc/return/evil.html # The page contains an image: evil1.jpg # It turns out that 3 other images exist: evil2, evil3, and evil4. # The second one leads us to a new file: evil2.gfx # That file seems to be random binary data at first glance, # but it's actually five different images merged ...
true
bcccfc59e34ae58fbb47ffa7af92fdfcecb67941
p-corteszaragoza/Homework_1_108
/calc.py
UTF-8
1,384
4.59375
5
[]
no_license
# description """" Script: Simple Calculator Author: Paola Cortes Year: 2021 Functionality: Basic Mathemathical operations """ # imports # globals # functions def print_menu(): print("-" * 30) print(" PyCalc") print("-" * 30) print("[1] - Sum") print("[2] - Sub...
true
cffd5e1b03d2a407243bce94239c820286c28dda
FatimaAliyeva01/PythonThinkBigger
/Task01/Base.py
UTF-8
1,059
3.421875
3
[]
no_license
# Base classımız var və tərkibində iki property var #class Base: #prop1='Something' #prop2='Somtehing2' # Derived classımız var Base class-ından miras alır və tərkibində property yoxdur #class Derived(Base): #Base classını elə dəyişdirməyiniz lazımdır ki . #obj=Derived() #obj obyektində sadəcə prop1 property...
true
715f6a5d930fa06e83dbfd9eb85f7868d1b64429
kjw130/python-projects
/percentageCalculator/percentageCalc.py
UTF-8
3,007
4.71875
5
[]
no_license
def options(): print("Welcome to the percentage calculator, what would you like to calculate?") print("If you want to calculate what a percentage of a number is, press 1") print("If you want to increase a number by a percentage, press 2") print("If you want to find the percentage change, press 3") ...
true
821929ebfb08717f9bb315f296b8078dc1bab8f3
Elijah-M/Module11
/class_definitions/manager.py
UTF-8
4,253
3.859375
4
[]
no_license
""" Author: Elijah Morishita elmorishita@dmacc.edu 11/4/2020 This program is used for creating an example of multiple inheritance """ class Person: """Person class""" def __init__(self, lname, fname, addy=''): self._last_name = lname self._first_name = fname self._address = addy d...
true
b62690c11e824f98693afa99bdd1ceec2aba9a06
rathojohn/makemeaplaylist
/beats.py
UTF-8
552
2.59375
3
[]
no_license
import requests import json import pprint class Beats: def __init__(self): self.API_KEY = '' self.ROOT_URL = 'https://partner.api.beatsmusic.com/v1/api/' def getData(self, url): data = requests.get(url).text data = json.loads(data) return data def getArtistID(self, artistName): url = '%ssearch?q...
true
81d57d6673ced9b030141ac0a84451d7be50604b
Anastasiafrolova/Useful-Materials
/4_число сочетаний двумя вариантами.py
UTF-8
465
3.34375
3
[]
no_license
n = int(input()) k = int(input()) def factorial(n): if n == 0: return 1 if n != 0: return n * factorial(n - 1) def C(n, k): if k == 1: return n if k == n: return 1 return factorial(n) / (factorial(k) * factorial(n - k)) def Cnk(n, k): if ...
true
31886cfa2e4ee9f77e898056ea06ca742dac5a9a
lihongtao1993/TheWar
/test.py
UTF-8
227
3.015625
3
[]
no_license
import pygame pygame.init() pygame.display.set_mode(size=(300, 500)) # for event in pygame.event.get(): key = pygame.key.get_pressed() # print(key) if key[pygame.K_RIGHT]: print("向右……") print(key)
true
3f99297190b9547aae32135597c199297bc2ac18
NandeshwarVerma/envyBlackJack
/math.py
UTF-8
214
3.9375
4
[]
no_license
#MATH functions import math #always import math #infinity x=float('inf') print(x) y=float('-inf') print(y) #ISINF function - to check whether it is infinity or not print(math.isinf(x)) print(math.isinf(y))
true
e18bbb0ef1f2104a026ae3386965c607f2d6ff4b
AttiR/Python-Web_Programming
/Scorebook Project/score.py
UTF-8
591
3.609375
4
[ "MIT" ]
permissive
# Python program to organize Palyers matches and score data # Lists Concept players = ["Asad", "Umar", "Gondal", "Pankaj"] scores = [10, 4, 56, 89] # combining scores in 2D lists scorebook = [["Asad", 10], ["Umar", 4], ["Gondal", 56], ["Pankaj", 89]] print(scorebook) # Adding extra player in list scorebook.append(["...
true
24d790af457d819b74537eef1f4230487e0417d6
thegreengoat/django-python
/google-finance/google.py
UTF-8
5,070
2.71875
3
[]
no_license
# Copyright (c) 2011, Mark Chenoweth # All rights reserved. # # Redistribution and use in source and binary forms, with or without modification, are permitted # provided that the following conditions are met: # # - Redistributions of source code must retain the above copyright notice, this list of conditions # ...
true
72c2668891e9504c288d61f2db91cd2762236833
vishipayyallore/LearningPython_2019
/Intermediate/Day6/3ListComprehensionsDemos/listcomprehensiondemo2.py
UTF-8
416
4.0625
4
[ "MIT" ]
permissive
names = ["shiva", "sai", "azim", "mathews", "philips", "samule"] items = [name.capitalize() for name in names] print(items) items = [len(name) for name in names] print(items) def get_list_comprehensions(lambda_expression, value): return [lambda_expression(x) for x in range(value)] data = get_list_comprehensions...
true
a5ad1aacfb3ca308cf3f2978d0f9ebad44be02e3
lanl/ramdisk
/macRamdisk.py
UTF-8
16,313
2.9375
3
[]
no_license
""" @author: Roy Nielsen Notes: Things we need to modularize: * create * mount * unmount * detach? * format (newfs_hfs vs. diskutil) * randomize mountpoint * turn off journaling, for faster access Maybe function, or other module * Find available memory, - Linux - just read /proc - Mac - Use top's "unused" so i...
true
87b792f6e1c4ad81bfebade71b45496c01632c0a
Siddhesh-3/Python
/udemy/Numpy/Numpy.py
UTF-8
475
3.390625
3
[]
no_license
import numpy as np ''' my_list = [1,2,3,4] my_arr = np.asarray(my_list) print(my_arr) print(my_arr.dtype) print(my_arr.shape) ''' np_array = np.ones((3,5), dtype = int) print(np_array,"\n") np_range = np.arange(start = 1 , step = 3 , stop = 20) print(np_range,"\n") np_range2 = np.linspace(start = 2 , stop = 20 ,...
true
08763e3651f0878954b983ace773e7c34add5445
inishchith/DeepSpeech
/swig/Examples/test-suite/python/virtual_poly_runme.py
UTF-8
622
2.625
3
[ "LicenseRef-scancode-swig", "GPL-3.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-3.0-only", "Apache-2.0" ]
permissive
import virtual_poly d = virtual_poly.NDouble(3.5) i = virtual_poly.NInt(2) # # the copy methods return the right polymorphic types # dc = d.copy() ic = i.copy() if d.get() != dc.get(): raise RuntimeError if i.get() != ic.get(): raise RuntimeError virtual_poly.incr(ic) if (i.get() + 1) != ic.get(): rai...
true
0ccd8084cba04bc8c095272ec0f4c5150cb29d2f
haruki518/Auto_Get_URL
/test8.py
UTF-8
387
2.765625
3
[]
no_license
import requests from bs4 import BeautifulSoup url = 'https://www.google.co.jp/search' req = requests.get(url, params={'q': 'python'}) python_URL = requests.get(req.url) soup = BeautifulSoup(python_URL.text, "html.parser") for i in range(5): for a in soup.select('.g > a'): U = a.get('href').replace('/url...
true
e23ccec055e3fe84a7d839e8ac6a899489594d16
cdzm5211314/iHome
/iHome/web_html.py
UTF-8
1,512
2.75
3
[]
no_license
# -*- coding:utf-8 -*- # @Desc : # @Author : Administrator # @Date : 2019-09-19 20:35 from flask import Blueprint, current_app, make_response from flask_wtf import csrf # 创建提供静态文件的蓝图对象 html = Blueprint('web_html', __name__) # http://127.0.0.1:5000/() # http://127.0.0.1:5000/(index.html) # http://127.0.0.1:5000/(reg...
true
cc1b02268a0a11dff3cd23f8ea18b4cb824303eb
zycfcn/django18urls
/testurls/views.py
UTF-8
827
2.703125
3
[ "MIT" ]
permissive
from django.http import HttpResponse def index(request): return HttpResponse('index') def articlelist(request): return HttpResponse('articlelist') # 传过来的参数都是字符串类型 def articleyeara(request, a): # 参数a 可为任意合法字符串 return HttpResponse(a + '年文章列表') def articlemonthb(request,a, b): # 参数a, b 可为任意合法字符串, 按url ...
true
c7ce8240e3b254912ba9baca924d128bf2390247
kmurata798/spaceman
/testfile.py
UTF-8
1,319
3.578125
4
[]
no_license
from spaceman import is_word_guessed, get_guessed_word, is_guess_in_word # Tests different inputs/outputs for is_word_guessed function def test_is_word_guessed(): # Tests if the words match each other assert is_word_guessed("hello", "hello") == True assert is_word_guessed("bod", "bot") == False ass...
true
f9d49e360ad1f651f327db373736db88c684708f
Guillaume0477/Computing
/programmation concurente/pragrammation parallele_redoublante/TP5/trifusion.py
UTF-8
2,358
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jun 12 14:38:08 2017 @author: mateo.lopez Matthieu Couriol """ import multiprocessing as mp import time,sys,random from array import array import SharedArray as sa def insert(liste,obj,here): c = liste[obj] for i in range(obj,here,-1): liste[i]=liste[i-1...
true
78bbb6b0664918b80cfab53e2b38555dbcbd1b22
Appu-the-great/sentiment-analyzer-1
/tokenizer.py
UTF-8
263
3.53125
4
[]
no_license
from nltk.tokenize import sent_tokenize, word_tokenize example_text = "Hello Mr. Smith, how are you doing today? The weather is great and Python is awesome. The sky is blue." print(sent_tokenize(example_text)) print(word_tokenize(example_text))
true
ea3e3f915cd0141d88a2f0424ac8df083678d4ec
OctavioMaia/PLC_SPLN
/spln2018/usr/octavio/tp_subtitles/sync.py
UTF-8
1,504
3.375
3
[]
no_license
#!/usr/bin/python3 import fileinput, re, collections numSub = r"^([0-9])+(?!.)" #expressão regular para o número da legenda no formato srt time = r"([0-9]+[:])+[0-9]+[,][0-9]+" #exp regular para o tempo da legenda no formato srt text = r"[0-9]*['\s']?[A-Za-z]+" #exp. regular para o texto da legenda no formato srt ...
true
0a10d5d63e1a4946ccc0b4a1ca04ac9e7b58521d
ashutoshpipriye/Basic-Internet-of-Things-with-Raspberry-pi
/Servo.py
UTF-8
620
2.984375
3
[ "MIT" ]
permissive
import RPi.GPIO as GPIO import time servoPIN = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(servoPIN, GPIO.OUT) p = GPIO.PWM(servoPIN, 50) p.start(2.5) try: while True: p.ChangeDutyCycle(5) time.sleep(0.5) p.ChangeDutyCycle(7.5) time.sleep(0.5) p.ChangeDutyCycle(10) time.sleep(0.5)...
true
f02d7130a07fa96758e4431818074f9f524f7b14
HotTamatoes/Headline-Analyzer
/Model/politico_scraper.py
UTF-8
3,030
3.09375
3
[]
no_license
import requests from bs4 import BeautifulSoup import mysql.connector # website_analyzed is the name for the website website_analyzed = "" mydb = mysql.connector.connect( host="localhost", user="root", passwd="PZZwsmapE4-Uk:6" ) mycursor = mydb.cursor() sqlFormula = "" #URL to be scraped url_to_scrape = ...
true
77ba20f0c37cdb2f9ba349208ebab0117cfa70f9
BestOfZyryanovka/ping-pong
/mylife_oop3.py
UTF-8
12,078
2.90625
3
[]
no_license
import tkinter as tk from random import randint import random import copy from time import sleep class Board: # Доска. def __init__(self, size=10, time_st=0.1, boardtype='Bordered'): self.N = size self.time_st = time_st self.boardtype = boardtype self.cells = {} self....
true
0679bf7668159bc7264b5f66cfcad520bcb117fe
sunjungAn/face_Classifier
/Data/make img_data_npy.py
UTF-8
874
2.59375
3
[]
no_license
import os, re, glob import cv2 import numpy as np from sklearn.model_selection import train_test_split categories = ["female","male"] num_classes = len(categories) image_w = 28 image_h = 28 X = [] Y = [] count = 0 for idex, categorie in enumerate(categories): label = [0 for i in range(num_classes)] label[ide...
true
8ed56db30e97093d341086da127e96fd96438c47
EthanJWright/perspective
/test_files/api_test.py
UTF-8
520
2.515625
3
[]
no_license
import requests import json with open('credentials.json') as data_file: data = json.load(data_file) api_key = data['key'] text = "donald trump " url = "https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key=" + api_key payload = { 'comment':{ 'text': text }, ...
true
13f95327e0a225e00edb2ca43795cd3c4217a51e
xshen1122/Python-practice-1
/jicheng_p1.py
UTF-8
1,324
4.0625
4
[]
no_license
# jicheng_p1.py # coding: utf-8 ''' 正确的做法是采用多重继承。首先,主要的类层次仍按照哺乳类和鸟类设计: 现在,我们要给动物再加上Runnable和Flyable的功能, 只需要先定义好Runnable和Flyable的类: 3. 通过多重继承,一个子类就可以同时获得多个父类的所有功能。 === 1. Mixin 在设计类的继承关系时,通常,主线都是单一继承下来的, 例如,Ostrich继承自Bird。 但是,如果需要“混入”额外的功能,通过多重继承就可以实现, 比如,让Ostrich除了继承自Bird外,再同时继承Runnable。这种设计通常称之为Mixin。 2. Mixin的目的就...
true
8730d6b1064c67b2b6cc9b7945f08d4690e7682a
ThirasaraAriyarathna/WineOntology
/Main/botMain.py
UTF-8
3,216
2.546875
3
[]
no_license
from intentClassifier import IntentClassifier from conditionClassifier import ConditionClassifier from entityExtractor import EntityExtractor from queryGenerator import QueryGenerator from chunker import Chuncker from chunker import UnigramChunker class WineChatbot: def __init__(self): self.intentClassif...
true
b07d763d727f233297012187f4cbff94c05c4cc1
chroot-gentoo/translate-it-yourself
/view/ui_views/info_boxes.py
UTF-8
2,243
2.984375
3
[]
no_license
from PyQt5 import QtGui, QtCore, QtWidgets class MessageBoxes: # TODO: добавить в методы возможность изменять кнопки (example: info пароль слишком короткий: изменить, продолжить) def __init__(self, parent=None): self.question_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Question, 'are you sure?', ...
true
ec51e682037c07a08eb0a58546859a4cf0a1c4e8
ber01/BOJ
/Python/10886.py
UTF-8
303
3.40625
3
[]
no_license
import sys f = lambda : sys.stdin.readline().rstrip() n = int(f()) one = list() zero = list() for i in range(n): value = int(f()) if value == 1: one.append(1) else: zero.append(0) if len(zero) > len(one): print("Junhee is not cute!") else: print("Junhee is cute!")
true
dbc5b93e7fb928ca54fbc4e75f1239ef0eb5b611
AnastasiaVedernikova/NeighborsInCollegium
/all_approaches/all_approaches.py
UTF-8
2,768
3.0625
3
[]
no_license
# first schema # after deleting outliers # with k-means features # with cosine distance as features # after PCA # all models import numpy as np import pandas as pd from sklearn.cross_validation import train_test_split from sklearn.metrics.pairwise import cosine_similarity import math from sklearn.decomposition import...
true
dd008b6bfceeaf602656a05c29299f5b942474d5
HikaruEgashira/sugoroku_game
/sugoroku_cui3.py
UTF-8
3,732
3.21875
3
[]
no_license
#課題内容 https://github.com/brains-tsukuba/Info-and-Rules/blob/master/sugoroku/sugoroku3.md import random import numpy as np flag_player = False #プレイヤー数決めるときに使う flag = False #設定が完了したか+ゲーム終了 m = 1 print('---すごろくゲーム---') while flag_player == False: player = input('プレイヤー数を入力してください(2~5): ') for x in range(2,6): ...
true
728aef02915231a47c7ed49051b3fcf48515ad6b
efremfilho/pythonScripts
/intro-to-python.py
UTF-8
2,669
3.03125
3
[]
no_license
import requests import json exemplo = 10000.51 #var exemplo = 10000.51; print(exemplo) #Logger.log('o valor de exemplo é '+ exemplo) exemplo = 'efrem' exemplo = exemplo + 5 #diferente do GS exemplo = 'efrem_' #Exemplo de condicional - https://www.w3schools.com/python/python_conditions.asp if exemplo == 'efrem': ...
true
0c5f86b756ba124dfafdc95673d40efe99d53a83
aliattar83/python
/Code/Chapter 7/Examples/read_numbers.py
UTF-8
1,449
3.734375
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # # read_numbers.py # # Copyright 2013 techabyte <admin@techabyte.com.au> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version ...
true
db152ed0f64eb15b450072932432c37437e8c652
michaelb/pymosaics
/projetv2.py
UTF-8
11,237
3.125
3
[]
no_license
#!/usr/bin/env python3 """un certain projet de bpi""" # pour des élément d'UI import sys import os from time import time from random import randint from point import * from segment import * from math import floor, pi def printsegment(liste): """fonction capable d'imprimer les lignes svg pour les segments d'un...
true
fa3d0d991de38181907458fa04aa6fc75542b8e5
perseys/flask_shop
/data/goods.py
UTF-8
1,482
2.546875
3
[]
no_license
import datetime import sqlalchemy from flask import url_for from sqlalchemy_serializer import SerializerMixin from data.db_session import SqlAlchemyBase class Good(SqlAlchemyBase, SerializerMixin): __tablename__ = 'goods' id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True, autoincrement=True) ...
true
26e2afecc27b080974ac8b129d678e4a2b3efbd5
wulfebw/retro
/retro/data/ssb64_game_data.py
UTF-8
2,618
2.84375
3
[ "MIT", "LGPL-2.1-only", "MPL-1.1", "LicenseRef-scancode-mame", "GPL-1.0-or-later", "Zlib", "GPL-2.0-only", "LGPL-2.1-or-later", "MPL-2.0", "CC-PDDC", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-brian-gladman-3-clause", "BSD-3-Clause"...
permissive
import collections from retro.data.ssb64_ram import SSB64RAM class SSB64GameData: # Assume only two players. num_players = 2 def __init__(self, penalize_taking_damage=False, reward_inflicting_damage=True): self.penalize_taking_damage = penalize_taking_damage self.reward_inflicting_damage...
true
7771f023eeba8aa43b4ebb39a3851a0777773aeb
Brandon-Rozek/rltorch
/examples/acrobot_es.py
UTF-8
3,857
2.609375
3
[ "LGPL-3.0-only" ]
permissive
import gym import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical import rltorch import rltorch.network as rn import rltorch.memory as M import rltorch.env as E from rltorch.action_selector import StochasticSelector from tensorboardX import SummaryWriter from rlto...
true
a91bcbb74a163a49a53ce1640b6d31383a62936c
Suirdna/SCA-ScreenClickAi
/build/SCA/control.py
UTF-8
9,377
2.5625
3
[ "MIT" ]
permissive
import pyautogui from pynput.mouse import Button,Controller import random import time from PIL import Image class control(): MOUSE = None; IMAGE = None; W = None; H = None; MOUSE_XY = None; STATUS = True; SUPER_COORDINATE = 0; INDEX = None; OBJECT = None; KEY_CONTROL = ["w",...
true
2db28a4d4de3285afe036bba8f1b247f248bec5f
mutoulovegc/gaochuang123
/桌面/day.3/kecheng.py
UTF-8
196
3.25
3
[]
no_license
cj = int(input("请输入成绩")) cj2 = int(input("请输入成绩")) print(cj) print(cj2) if cj>=60 and cj2>=60: print("通过") elif cj<60: print("未通过") else: print("补考")
true
9600fd0c31073b1ae9f521991513d34fbd3d5810
rannuste/online_store
/app.py
UTF-8
1,534
2.59375
3
[]
no_license
from main import app, mongo from bson import json_util from bson.json_util import dumps from bson.objectid import ObjectId from flask import jsonify, request import json @app.route('/add', methods=['POST']) def add_product(): product = mongo.db.product name = request.json['name'] description =...
true
70208785b9b35171ec9a05fda0d8add5044b24ce
radicalray/YoutubeMp3withLyricsAutoTagging
/auto_lyrics_tagger.py
UTF-8
5,887
2.5625
3
[]
no_license
# encoding=utf8 import sys reload(sys) sys.setdefaultencoding('utf8') import glob import os import eyed3 import urllib2 from urllib2 import urlparse from bs4 import BeautifulSoup import traceback import re from hn2 import * from os.path import dirname, join # calculated paths for django and the site # used as starti...
true
5cbf77c7c5caf40ed0bd2c358a0e7b8dbdd4758e
aannestad/algs-engineering
/diff_problemA0.py
UTF-8
121
2.984375
3
[]
no_license
f = open("sample.in", "r") xs = list(map(int,f.read().split())) for (x,y) in zip(xs[0::2],xs[1::2]): print(abs(x-y))
true
ba370ffe1d87a704b47d1e0f4ef2d3ddf2bc81db
falva12/10-days-of-statistics
/day_2.py
UTF-8
2,657
4
4
[]
no_license
#%% #Task1. In a single toss of 2 fair (evenly-weighted) six-sided dice, # find the probability that their sum will be at most 9. def dice_probability(dice1, dice2, n): permut = [] for s1 in dice1: for s2 in dice2: permut.append(s1+s2) numerador = 0 denominador = len(permut) ...
true
2586c58bdbe5cd2723f3829107b014d88a832b8c
anquabkhan/day25
/main.py
UTF-8
1,418
3
3
[]
no_license
# import csv # data = [] # # with open('weather_data.csv') as f: # # # for data_line in f: # # # data.append(data_line) # # data = f.readlines() # with open('weather_data.csv') as file: # data = csv.reader(file) # teamprature = [] # # data2 = data[1:] # i=0 # for row in data: # ...
true