blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
451bfa96d0af93952e584c990c03fa3d00ab6b61
Python
amslabtech/semantickitti2bag
/utils.py
UTF-8
2,558
2.703125
3
[ "MIT" ]
permissive
import numpy as np class LabelDataConverter: """Convert .label binary data to instance id and rgb""" def __init__(self, labelscan): self.convertdata(labelscan) def convertdata(self, labelscan): self.semantic_id = [] self.rgb_id = [] for counting in range(len...
true
4273ff9335ca3edc301e1295e6d7fe91cfbb5d52
Python
kurtshiple/03-Python-Budget-and-Election-Data
/Homework3:local/python-challenge-master/PyBank/mainb.py
UTF-8
2,460
3.359375
3
[]
no_license
#dependencies import os import csv #this is the most effective way of reading in a csv file csvpath = os.path.join('..','PyBank','budget_data.csv') with open(csvpath, newline='') as csvfile: csvreader = csv.reader(csvfile,delimiter=',') csv_header = next(csvreader) #print(f"CSV_Header = {csv_header}")...
true
b51411dd4110fc14ed5e496bae62b6add9dc035e
Python
mathewssabu/luminarpythonprograms
/advancedpython/functional programming/ducktyping.py
UTF-8
391
3.453125
3
[]
no_license
class Shift: def start(self): print("start in shift") def accelerate(self): print("accelerate in shift") class Innova: def start(self): print("start in innova") def accelerate(self): print("accelerate in innova") class Person: def drive(self,ob): ob.start() ...
true
1588f115cc1be8e37087f7d1cf666cece638edc6
Python
BigBossWill/UniversoDiscreto
/O que sao redes neurais/perceptron_video1.py
ISO-8859-1
2,960
3.90625
4
[]
no_license
# -*- coding: cp1252 -*- import numpy as np from random import * def escolheValoresRandomicos(): x1 = randint(0, 1) #fator dinheiro x2 = randint(0, 1) #fator amigos/namorado(a) x3 = randint(0, 1) #fator distncia #quanto maior o valor, mais se motiva a ir com $$$ w1 = randint(0, 8) ...
true
24caa7d122b22936851207020b872851d7958678
Python
krishnapriyaps/CCA_175_Study
/pyspark/distinctField.py~
UTF-8
577
2.96875
3
[]
no_license
## Python script to find distinct of values under a feild in csv file from pyspark import SparkConf,SparkContext conf = SparkConf().setAppName("Distinct Type"); sc = SparkContext(conf=conf) dataRDD = sc.textFile("hdfs://quickstart.cloudera:8020/user/cloudera/spark/testData_customers_10.csv") dataRDD2 = dataRDD.ma...
true
804d619d85fc72ebd6c765d4897d71bcc48db0b4
Python
7nic7/Wine-Classification
/wine_AutoEncoder.py
UTF-8
6,108
2.8125
3
[]
no_license
import pandas as pd import numpy as np from keras.models import Model from keras.layers import Dense,Input from sklearn import preprocessing from keras.losses import binary_crossentropy from keras.optimizers import adadelta import tensorflow as tf import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, a...
true
25c3b325333dbbaa69470ccdf9dece5a2d985910
Python
NSLS-II/sirepo-bluesky
/sirepo_bluesky/utils/__init__.py
UTF-8
838
2.71875
3
[ "BSD-3-Clause" ]
permissive
import numpy as np sigma_to_fwhm = 2 * np.sqrt(2 * np.log(2)) def get_beam_stats(image, x_extent, y_extent): n_y, n_x = image.shape image_sum = image.sum() if image.sum() > 0: X, Y = np.meshgrid(np.linspace(*x_extent, n_x), np.linspace(*y_extent, n_y)) mean_x = np.sum(X * image) / image...
true
ee248e9fb1434f5d41ebb9923186a8205c7990bf
Python
trevordjones/artistic_photos
/artistic/photo/palette.py
UTF-8
1,057
2.703125
3
[]
no_license
from matplotlib.colors import to_hex import numpy as np import pandas as pd from pathlib import Path from skimage import color as converter from skimage.io import imread from skimage.transform import resize from sklearn.cluster import KMeans ROOT = Path(__file__).parent FILE_PATH = ROOT.joinpath('temp') def palette(s...
true
2fe93a0a293c2b4f76b5755d1d013ef03c0cc823
Python
Soumitra-Mandal/ML-and-pyfiles
/CV(img,vid,mnist).py
UTF-8
5,809
2.90625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Sat Jul 6 13:01:36 2019 @author: Soumitra """ """ Computer Vision conda install -c conda-forge opencv """ import cv2 img=cv2.imread(r"E:\wp\avengers-endgame-1920x1080-minimal-art-4k-18264.jpg") cv2.imshow("lena",img) cv2.waitKey(0) cv2.destroyAllWindows() print(im...
true
62f5bfeaf5652b4512792dccba179fbc16813c54
Python
LittleRichard/learntocode
/python101/006_boolean_and_if_else.py
UTF-8
3,362
4.3125
4
[]
no_license
import random # import is how you tell python that you want to use a library in a script # 'True' is a python KEYWORD, and should NEVER EVER be used as a variable # note how the code editor uses a different color for True than print print(f'True is {True}, duh') # True is a 'boolean' type, in addition to the #...
true
4e09962f934d447c24500eb31f0d9a10555ac80f
Python
pantchayan/Chess-engine-A.I.
/stockfish_self_play.py
UTF-8
435
2.625
3
[]
no_license
import chess import chess.engine engine = chess.engine.SimpleEngine.popen_uci(r'C:\Users\ishaa\Desktop\chess_engine\stockfish-11-win\Windows\stockfish_20011801_x64.exe') board = chess.Board() moves = 0 while ((not board.is_game_over()) and moves<10): result = engine.play(board, chess.engine.Limit(time=0.1)) b...
true
7654fb3fa8121b6efd687c21cc68cd76d3c41842
Python
Denisfench/openclean-core
/tests/engine/object/test_vocabulary_objects.py
UTF-8
1,450
2.53125
3
[ "BSD-3-Clause" ]
permissive
# This file is part of the Data Cleaning Library (openclean). # # Copyright (C) 2018-2021 New York University. # # openclean is released under the Revised BSD License. See file LICENSE for # full license details. """Unit tests for (de-)serialization of controlled vocabulary handles.""" from openclean.engine.object.vo...
true
ffa20dc6bccc548dafc1e0e6d64fb28a6e30ff5d
Python
shubhamkumar27/Leetcode_solutions
/77. Combinations.py
UTF-8
605
3.40625
3
[]
no_license
''' Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] ''' class Solution: def combine(self, n: int, k: int): nums = [i for i in range(1, n+1)] result = [] ...
true
89fd527e4b24a2843e4ae3a968dffd7b7cb34cdf
Python
ahmetzekiertem/Time-Series-Analysis-with-Python
/Recurrent Neural Network/rnn_example.py
UTF-8
1,875
2.828125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 18 18:03:48 2020 @author: mac """ import keras import matplotlib.pyplot as plt import pandas as pd import numpy as np df = pd.read_csv('Miles_Traveled.csv',index_col ='DATE' ,parse_dates=True) df.index.freq = 'MS' df.columns = ['Value'] from s...
true
f921f2b5afb69cd4df2d24816f42bfde23d5f833
Python
Mattielew/Python
/python_fundamentals/HW/HW19.py
UTF-8
1,399
4.09375
4
[]
no_license
#!/usr/bin/python #-*- coding: utf-8 -*- #=============================================================================== # # FILE: HW19.py # # USAGE: ./ # # DESCRIPTION: More functions with variables and some math # # OPTIONS: --- # REQUIREMENTS: --- # BUGS: --- # NOTES: --- # ...
true
9b4598940a3075ad0abc83b95840533784568738
Python
shreyas269/programming
/problems/spoj/adding_reverse_numbers.py
UTF-8
364
3.9375
4
[]
no_license
# I learnt that: Slicing in lists def reverse(n): n_str = str(n) # a[start:stop:step] -> slice operator return int(n_str[::-1]) def main(): t = int(input()) for i in range(t): n, m = input().split() n, m = int(n), int(m) sum = reverse(reverse(n) + reverse(m)) print...
true
4869b7462899e34b487c89079458629c9805a1c3
Python
s26mehta/DataStructures
/queue.py
UTF-8
1,622
3.609375
4
[]
no_license
class Queue: def __init__(self, maxSize): self.items = [] self.maxSize = maxSize self.startIndex = 0 self.endIndex = 0 self.size = 0 def size(self): return self.size def isEmpty(self): return len(self.items) == 0 def enqueue(self, item): ...
true
76f79c64644649ec8b9724e02e1abd49b5b79c78
Python
elbertHome/myStudy
/python/PycharmProjects/TestProject/flatternDict.py
UTF-8
798
2.96875
3
[]
no_license
#!/usr/local/bin/python # -*- coding: UTF-8 -*- def flatdict(dictData, path, dictRst): for curkey, curval in dictData.items(): if isinstance(curval, dict): if curval: flatdict(curval, path + curkey + "/", dictRst) else: dictRst[path + curkey] = "" ...
true
73cb22f48c1b624d9d2124211c68b030ce1eba66
Python
SaeedSarabchi/coding_interview_prep
/Chapter 1/1.py.py
UTF-8
897
3.921875
4
[]
no_license
def question1(input_string): alphabet_hash_table = {} for ch in input_string: char = ch.lower() if 'a' <= char <= 'z': if char in alphabet_hash_table: alphabet_hash_table[char] += 1 else: alphabet_hash_table[char] = 1 if len(alphabet_h...
true
6b410eed7700ec99f13cc585cf32e994262c1914
Python
sethtroisi/league-of-data
/Scripts/graph_model_stats.py
UTF-8
7,325
2.921875
3
[]
no_license
import numpy as np import matplotlib.pyplot as pyplot from matplotlib.widgets import Slider import random import util # Common styling 'Patch' for text TEXT_PROBS = dict(boxstyle='round', facecolor='#abcdef', alpha=0.5) # Plot general data about accuracy, logloss, number of samples. def plotData(blocks, times, samp...
true
3fef5d68d2a6838023c4bae498e43cee69d04fec
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_135/1739.py
UTF-8
866
3.46875
3
[]
no_license
#!/usr/bin/env python3 ################################################################################ def read_int(): return int(input()) def read_words(): return input().split() def read_ints(): return map(int,read_words()) def read_floats(): return map(float,read_words()) #############################...
true
834788b1c978b659ffe5e70c399cd3340c4f941c
Python
Wuuusq/python_data_structures
/DS1-introduction/jinzhi.py
UTF-8
3,106
3.921875
4
[]
no_license
''' # 十进制转二进制,除二倒序取余 from pythonds.basic.stack import Stack def divide2(desNumber): s = Stack() while desNumber > 0: rem = desNumber % 2 s.push(rem) desNumber = desNumber//2 binString = "" while not s.isEmpty(): binString = binString + str(s.pop()) return binStrin...
true
f9e9d6212c138462a48611163b07dc9eafefebf6
Python
evgenypim/python_playground
/MagicList/MagicList.py
UTF-8
1,588
4
4
[]
no_license
#!/usr/bin/env python3 from dataclasses import dataclass @dataclass class Person: age: int = 1 class MagicList(list): """MagicList class. List like class that implements a simplified list by skipping boundary checks when possible. """ def __init__(self, cls_type=None): if (cls_typ...
true
683eea4860bd9900fbbd5c71bc6b5fe7dbd25cc8
Python
dkamianskii/OptimizationLabs
/Course Porject/CoursePrj.py
UTF-8
3,879
3
3
[]
no_license
import numpy as np def f(x): return 2 * x[0] ** 2 + 3 * x[1] ** 2 + np.sin(2 * x[0] + 7 * x[1]) / 49 + 3 * x[0] + 2 * x[1] def grad_f(x): return np.array( [4 * x[0] + 2 * np.cos(2 * x[0] + 7 * x[1]) / 49 + 3, 6 * x[1] + 7 * np.cos(2 * x[0] + 7 * x[1]) / 49 + 2]) def golden_slice(func, segment, eps...
true
0361c59522f505f1b3555077ab4696d4dd95a655
Python
darthkenobi5319/ICP-HW
/HW2/hw5.py
UTF-8
3,144
4.4375
4
[]
no_license
# Homework #5 # In all the exercises that follow, insert your code directly in this file # and immediately after each question. # # IMPORTANT NOTES: # # 1) THIS IS A PROGRAMMING COURSE. :-) THIS MEANS THAT THE ANSWERS TO THESE QUESTIONS # ARE MEANT TO BE DONE IN CODE AS MUCH AS POSSIBLE. E.G., WHEN A QUESTION SAYS "C...
true
5397ba9c9f8ff720ecb0d5dc35813c7d2ded4d39
Python
yujun001/YouTube_DNN
/rank/model.py
UTF-8
7,938
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2017/1/10 9:12 # @Author : RIO # @desc: 排序部分 import tensorflow as tf from tensorflow.contrib import layers from utils.config import SuperPrams from rank.data_process import get_batch from utils.utils import list2array class Args(SuperPrams): def __init__(self, is_training=Tru...
true
206965da3725319f64d95b4ce0d2269b2c6315b5
Python
DahliaSR/ChIO-Striped-Words
/striped_words.py
UTF-8
796
3.5625
4
[]
no_license
import re from string import ascii_lowercase VOWELS = "aeiouy" def checkio(text): words = re.findall(re.compile(r'\b[^\W\d]{2,}\b'), text.lower()) transl_to = ''.join('1' if char in VOWELS else '0' for char in ascii_lowercase) translator = str.maketrans(ascii_lowercase, transl_to) translated_words = ...
true
b055e05ef855d163d748ce7a266ca9a1249200d4
Python
kgiroux/computer_vison
/codes/segmentation/exercises/green_screen.py
UTF-8
1,849
2.53125
3
[]
no_license
import numpy as np import cv2 import matplotlib.pyplot as plt plt.ion() # Open the alpaca video gs_cap = cv2.VideoCapture('../ressources/green_screen_Alpaca.mov') # Open the milky way video bg_cap = cv2.VideoCapture('../ressources/milky_way.mp4') # If you want to write the video # ret, gs_frame = gs_cap....
true
18af4b6583ffaaf6860b4f066c069be0a48bc222
Python
VizardEdward/ant-colony
/main.py
UTF-8
2,283
2.9375
3
[ "MIT" ]
permissive
import os from pathlib import Path from dotenv import load_dotenv from ant import Ant from world import World import matplotlib.pyplot as plt def read_world(): file = open("path.in", "rt") nodes_number, globally_pheromones, evaporation = tuple(file.readline().strip().split(" ")) world = World(int(nodes_...
true
c571a635b984ede1eb2e5a12d90019ee00748e8b
Python
lakshay1704/Python
/alphabetic product.py
UTF-8
1,040
3.84375
4
[]
no_license
''' Problem 42. Find the alphabetic word product Created by Cody Team in Cody Challenge If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ... z=26. Assume the input will be a single word, although it may mixed case. Note that A=a=1 an...
true
118fe84810c577826d551ac43de7dd0835d8c2cb
Python
Pistaco/Shogi
/src/backend/tablero/Pocisiones.py
UTF-8
1,342
2.78125
3
[]
no_license
from piezas.Excepciones import Vacio from piezas.mixin import Solicitud class Casilla: def __init__(self, x, y): self.x = int(x) self.y = int(y) self.bando = None self.pieza = None self.tuple = (self.x, self.y) @classmethod def veryficate(clc, data, tablero): ...
true
2ed51a4335cd8e7e889244e759de8df258371966
Python
fsuarezj/sxmalerts
/server/alert_spider/spiders/forecast_spider.py
UTF-8
1,838
2.921875
3
[]
no_license
import scrapy class ForecastSpider(scrapy.Spider): name = "forecast" start_urls = [ 'http://www.meteosxm.com/weather/forecast/' ] def _parse_paragraphs(self, data, i, name): result = '' if data[i].xpath('.//strong[contains(., "' + name + '")]'): # If it's not in th...
true
01c01f1f7be608b4c355ea896ac868b20d57ddd8
Python
jtpils/object-reconstruction
/test.py
UTF-8
486
2.640625
3
[ "MIT" ]
permissive
import os import cv2 import time import masking from masking import draw_mask_on_video infile = "input.mp4" outfile = "output.avi" model = masking.load_model() print("Loaded model") cap = cv2.VideoCapture(infile) w = int(cap.get(3)) h = int(cap.get(4)) #output = cv2.VideoWriter(outfile, cv2.VideoWriter_fourcc('M'...
true
c376cfa2e702eeb7f48062810f2d60056f51f31f
Python
alextercete/robotcv
/computer_vision.py
UTF-8
4,201
3
3
[]
no_license
import math import cv KEY_ESC = 27 WINDOW_MAIN = 'Camera' class ComputerVision: @classmethod def get_capture(cls, camera_index): return cv.CaptureFromCAM(camera_index) @classmethod def create_window(cls): cv.NamedWindow(WINDOW_MAIN) @classmethod def grab_frame(cls, capture):...
true
b7e1e661311ad889c489a36fa2fe93b63519d22d
Python
bittorf/calculusvaporis
/cavoasm.py
UTF-8
2,751
3.015625
3
[]
no_license
#!/usr/bin/python """Assembler for the Calculus Vaporis CPU.""" import sys, re def words(fileobj): for line in fileobj: line = re.sub(';.*', '', line) for word in line.split(): yield word instructions = { '.': 0, '-': 1, '|': 2, '@': 3, '!': 4, 'nop': 5 } nbits = 12 def bit(n): r...
true
312aa0ba524c47eb0d2d970045788521a77caa01
Python
dlcheng/Neff_Alpha
/main.py
UTF-8
1,443
2.59375
3
[]
no_license
# This routine can calculate the effective index N_eff defined as # N_eff = 3(-dlog\sigma^2(M, z)/dlogM - 1) # The definition is consistent for scale free case of either Gaussian and Top-hat # window function. Here we implement only the Top-hat window for general power spectrum. # ...
true
2b6ede1f518a78c1e10ee3fc128d87948fa84df2
Python
kiilkim/book_duck
/pythonPractice/pnuPY/0710/choice_module.py
UTF-8
539
2.859375
3
[]
no_license
import main_module as m # 입력하고 출력을 나눠보면 된다. #메뉴 선택 칸 def print_choice(): choice = input(''' 다음 중 작업하실 메뉴를 입력하세요. I - 고객 정보 입력 C - 현재 고객 정보 출력 P - 이전 고객 정보 출력 N - 다음 고객 정보 출력 U - 고객 정보 수정 D - 고객 정보 삭제 F - 고객 정보 검색 Q - 프로그램 종료 ''').upper() print(choice) return choice...
true
3b8cb38abb2e4bd9d501a9364cd95da2154c9a15
Python
daguniko/nlp100
/week7/py/test062.py
UTF-8
975
2.75
3
[]
no_license
#! /Users/sudo/.virtualenvs/hoge/bin/python2 # -*-coding:utf-8-*- #(62) 61で作成した各ファイルから,名詞句(文節中の名詞の連接)を抜き出して,個別のファイルに格納せよ. #regular expression part import CaboCha import os import re #set cabocha c = CaboCha.Parser("-f1") files = os.listdir("../data/cabocha/"); prog = re.compile("\w.txt") readlist = [] for file in fi...
true
c359241d41aa512a9bb3515c758dbb0baf910a0c
Python
Improbus/DrexelCourseWork
/CS265/A2/getFlightStatus.py
UTF-8
2,791
2.984375
3
[]
no_license
#!/usr/bin/python import urllib import sets URL = 'http://www.phl.org/cgi-bin/fidsarrival.pl' sock = urllib.urlopen( URL ) doc = sock.readlines() sock.close() AmericanFlights = [] ContinentalFlights = [] DeltaFlights = [] NorthwestFlights = [] SouthwestFlights = [] UnknownFlights = [] UsairFlights = [] FlightDictio...
true
6b7124609896a75b9b4d5eb1ac8bd3151c8b294a
Python
MiguelCF06/holbertonschool-higher_level_programming
/0x0F-python-object_relational_mapping/2-my_filter_states.py
UTF-8
606
2.921875
3
[]
no_license
#!/usr/bin/python3 """ Script that takes in an argument and displays all values in the states table of hbtn_0e_0_usa where name matches the argument. """ import MySQLdb import sys if __name__ == "__main__": db = MySQLdb.connect(host="localhost", port=3306, user=sys.argv[1], passwd=sys.arg...
true
7da4d33a127b3f983acd77f20e0f2145b51c8b23
Python
Hazem-Atya/learning_python
/firstProject/dictionaries.py
UTF-8
902
3.828125
4
[]
no_license
d = dict() d['name'] = 'Hazem' d['age'] = 21 print(d) print(d['age']) counts = dict() names = ['Hazem', 'Safa', 'Hazem', 'Sihem', 'Safa', 'Hazem'] # for name in names: # if name not in counts: # counts[name] = 1 # else: # counts[name] = counts[name] + 1 # # print(counts) # Deuxième méthode co...
true
1a2c3d1d4e3547200ce6965c7530361d81a10643
Python
tgfbikes/python
/CS-1410/ticketmaster.py
UTF-8
2,230
3.609375
4
[]
no_license
# Three different types of tickets: concert, movie, sporting # All tickets have in common: price, seat number, venue(location), date, time. # Concert tickets: artist name # Move tickets: movie title, move rating # Sporting tickets: 2 teams (whatever vs. whatever) class Ticket: def __init__(self, price, sea...
true
865e0fb947712896209ca1660e557c5ed4f9eda9
Python
SaraSchim/DNA-project
/analysis_commands/find_all.py
UTF-8
514
3.53125
4
[]
no_license
import re # finds all the indices where the sub-sequence appears. class FindAll: # data = [<seq_to_find_in>, <seq_to_be_found>] def __init__(self, data): self.seq_to_find_in = data[0] self.seq_to_be_found = data[1] def execute(self): indexes = [m.start() for m in re.finditer('(?=...
true
1ea1e306661498a12a11d4fb9afeaa64a91ddcaf
Python
juniortheory/python-programming
/unit-4/myfile.py
UTF-8
293
3.421875
3
[]
no_license
''' grade = 80 if grade > 80: print("A") elif grade >= 60: print("B") else: print("C") ''' from random import randint answer = randint(1,10) guess = int(input("please enter your guess: ")) if guess == answer: print("You are correct") else: print("try again")
true
9bc5722114e80b7d67d25c76fea1d763395be175
Python
jirka007/Don-Robot
/don/memory/redisbacked.py
UTF-8
1,561
2.609375
3
[]
no_license
from don.memory import Memory as BaseMemory import redis class Memory(BaseMemory): def __init__(self, cfg={}, prefix="bot"): self.redis = redis.Redis(**cfg) self.prefix = prefix def load(self, dump): obj = json.loads(dump) for key,val in obj['me'].items(): self.rem...
true
55ba1abbe3f853ad55bc4352193925180d9ee83c
Python
paturiku-p/workoutizer
/wizer/tests/end2end/test_end2end.py
UTF-8
1,323
2.5625
3
[ "MIT" ]
permissive
import os import time from multiprocessing import Process import requests app_url = "127.0.0.1:8001" http_url = f"http://{app_url}" timeout = 10 def _runserver(): os.system(f"wkz manage 'runserver {app_url} --noreload'") def _get_site_status_code(url): return requests.get(url=url).status_code def test_w...
true
e6887c8ea5b0ebfaa9c4713b4d0c15e7bc18308c
Python
ausaki/data_structures_and_algorithms
/leetcode/count-number-of-teams/384466068.py
UTF-8
640
2.96875
3
[]
no_license
# title: count-number-of-teams # detail: https://leetcode.com/submissions/detail/384466068/ # datetime: Sat Aug 22 11:19:54 2020 # runtime: 88 ms # memory: 13.9 MB class Solution: def numTeams(self, rating: List[int]) -> int: n = len(rating) result = 0 for i in range(1, n - 1): ...
true
417a0d62feaf4c3df5f00cdcce27b3978eeb90be
Python
Chetna-Gupta/Click-Stream-data-analysis
/dw_create.py
UTF-8
3,221
2.671875
3
[]
no_license
import pandas as pd from pandas.tseries.holiday import USFederalHolidayCalendar as calendar import numpy as np def explore_time(ts): day= ts.days sec=ts.seconds if day >= 0: total= sec else: total=0 return total def hr_func(ts): return ts.hour column_names_buys= ['buys_sid','...
true
eacb6526e0b1ec28a64a901a4caaeb79a48f8ae1
Python
Justin4587/holbertonschool-higher_level_programming
/0x11-python-network_1/7-error_code.py
UTF-8
320
3.046875
3
[]
no_license
#!/usr/bin/python3 """I'm going to put a comment here """ if __name__ == "__main__": import requests from sys import argv resp = requests.get(argv[1]) stat = resp.status_code if stat == requests.codes.ok: print("{}".format(resp.text)) else: print("Error code: {}".format(stat))
true
d78b7c2d96521995a3b35d13f4253ade9c88b7a8
Python
Global19/rDnaTools
/src/pbrdna/fasta/utils.py
UTF-8
968
2.546875
3
[]
no_license
from pbcore.io.FastaIO import FastaReader, FastaWriter def fasta_count( fasta_file ): count = 0 try: for record in FastaReader( fasta_file ): if len(record.sequence) > 0: count += 1 except: return 0 return count def fasta_names( fasta_file ): return set(...
true
42216bcb6b83d90131b71f436a20ed3094523c2f
Python
dxaviud/mini-canvas
/draw.py
UTF-8
2,521
3.15625
3
[]
no_license
from tkinter import Tk, Canvas from PIL import ImageGrab class Drawing(): def __init__(self): self.__save_count = 1 def display(self): root = Tk() canvas = Canvas(root, width=500, height=500) canvas.grid(row=0, column=0) brush_shape = "square" brush_thickne...
true
04a5b53f8e33b344b9c265d914290e52d3a39353
Python
Fondamenti18/fondamenti-di-programmazione
/students/1811290/homework02/program02.py
UTF-8
2,215
2.78125
3
[]
no_license
def pianifica(fcompiti,insi,fout): lista_xID=[] import re with open(fcompiti,encoding='utf-8') as f: for linea in f: stringa_caratteri_alfabetici=' '.join(re.findall("[a-zA-Z]+", str(linea))) stringa_caratteri_numerici=' '.join(re.findall('[0-9]+',str(linea))) ...
true
58681df844380e5b3b9ca0a2f36bc18426824a6b
Python
badmutex/wasq
/wasq/Cell.py
UTF-8
4,459
2.78125
3
[]
no_license
import pxul import numpy as np import itertools import cPickle as pickle import os class Cells(object): def __init__(self, initial, labels): assert len(initial) == len(labels), '|cells| = {} but |labels| = {}'.format(len(initial), ...
true
343b9de8ea632f55abd63004e0f59fa7aebc92ad
Python
shreya-sinha9/InternshipWork
/Automation_Work/Codes/Task5_Disc_Plot_acc_3rd_level(msg)_count/myClass.py
UTF-8
5,599
2.875
3
[]
no_license
import re import matplotlib.pyplot as plt from collections import defaultdict class Error: def __init__(self, days, file): self.days = days self.file = file def error_day(self, file, days, msg_counts, msg_id_link): f = open(file, 'r') lines = f.readlines() f.close() ...
true
92c88471e546fd9717ac5b41b0200a93ca2dd0c3
Python
renovate-bot/python-game-servers
/samples/snippets/list_clusters.py
UTF-8
1,777
2.53125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # Copyright 2020 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
true
d7bf182e910adad728223f3b4b45fb8e4545bc95
Python
DeadlyShanx/CTI110
/Turtle JJ.py
UTF-8
459
3.4375
3
[]
no_license
import turtle turtle.forward(150) turtle.left(180) turtle.forward(75) turtle.left(90) turtle.forward(150) turtle.right(90) turtle.forward(100) turtle.penup() turtle.forward(100) turtle.pendown() turtle.right(90) turtle.forward(150) turtle.left(90) turtle.forward(75) turtle.right(180) turtle.forwar...
true
25664e5046f858dd287ee7becc93d99b38855333
Python
backtrackbaba/035-check-common-item
/build.py
UTF-8
181
2.734375
3
[]
no_license
def solution(list1, list2): for i in list2: if i in list1: return True else: return False list1 = [] list2 = [] solution(list1, list2)
true
9c0117d8d101d0e590166c8eea1bf1fd02bddf00
Python
Liszt777/leetcode
/easy/P02.py
UTF-8
926
4.15625
4
[]
no_license
# 给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。 # # 示例 1: # 输入: 123 # 输出: 321 # # 示例 2: # 输入: -123 # 输出: -321 # # 示例 3: # 输入: 120 # 输出: 21 # 注意:假设我们的环境只能存储得下 32 位的有符号整数,则其数值范围为 [−231, 231 − 1]。请根据这个假设,如果反转后整数溢出那么就返回0 # O(logX) O(1) class Solution: def reverse(self, x): """ :param x: int :return: in...
true
15b90dbc505c57f19d70a6c3420dac18c4026fb9
Python
ArpitaVB/Independent-Projects_
/Twitter_Sentiment Analysis/Count_TweetListener.py
UTF-8
1,376
2.578125
3
[]
no_license
import tweepy import socket import json from tweepy import OAuthHandler from tweepy import Stream from tweepy.streaming import StreamListener consumer_key='c0Vq5CO8jWx2Zs0qjLomWjiT4' consumer_secret='ViiNIcfmmohx1wUSukbXyLw2RwwaMVWdOZ9k7bJAQrtHJYZT04' access_token ='780368384810639360-9IpTgcFdSKxub5w90LT7gZNiEo2edjK' ...
true
4ded9af6d1a27b2310781c536d44ace82ff013cc
Python
JorgeEstrada1/programacion
/Practico_1/Ejercicio 8.py
UTF-8
190
3.578125
4
[]
no_license
num1 = int(input("Ingresa un numero: ")) num2 = int(input("Ingresa un numero: ")) num3= 0 for i in range (num1+1,num2): i = sum(range(num1+1,num2)) num3 = i print(f"la suma es {i}")
true
c58ec87069d5588d263ab6f1aef835440845b7ab
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_135/2397.py
UTF-8
492
3.375
3
[]
no_license
#!/usr/bin/python for i in range(int(input())): first = int(input()) cards1 = [ map(int, input().split()) for _ in range(4) ] second = int(input()) cards2 = [ map(int, input().split()) for _ in range(4) ] candidate = set(cards1[first-1]) & set(cards2[second-1]) if len(candidate) == 1: re...
true
d029c2e79ec7e08c76614bcf8ddadc31c9657ba1
Python
thomas-brth/ERA5_display_app
/utils/features/subpanels.py
UTF-8
5,769
2.765625
3
[]
no_license
# Sub-pannels module, to be used inside main panels ############# ## Imports ## ############# # wxPython import import wx # matplotlib import from matplotlib import pyplot as plt from mpl_toolkits.basemap import Basemap # Other imports import os import json ############### ## Constants ## ############### ########...
true
74dd1a2e20beb8eae40225d1d8a582638a6961ff
Python
mamta31/bot-o-mat
/main.py
UTF-8
4,190
3.046875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This Module for to select robot assign work to robot. """ import os import config import csv import random import time import sys class Main: # init method or constructor def __init__(self, name): self.name = name self.get_...
true
7beef5c09673cc1dfb5144f97d33205f958866e6
Python
TechAccelerator2019/PythonInjection
/Day 2/01_lists_and_dicts/04_sorting.py
UTF-8
414
4.15625
4
[]
no_license
mixed_list = [5, 19, 8, 11, 14, 1, 34, 6] # sorted() returns a new sorted list from any sequence print(sorted(mixed_list)) # list.sort() will sort the actual list object. mixed_list.sort() print(mixed_list) numbers_dict = {5: "Five", 3: "Three", 1: "One", 2: "Two", 4: "Four"} # Print the dictionary values ordered ...
true
4b3c947bfeeff91a0258f3c4dba698ee20da1909
Python
gofna/Speech2Text
/Merge_xml.py
UTF-8
8,113
2.6875
3
[]
no_license
import glob import xml.etree.ElementTree as ET import os import csv from operator import itemgetter import wavSpliter from os import listdir import os.path def get_id(row_attrib): need_to_cut = row_attrib['{http://nite.sourceforge.net/}id'] lst = need_to_cut.split('.') return int(lst[2].rep...
true
df88466f05cede852c7c67422ae6bb743a4e3721
Python
Jotaherrer/WebScraping
/scrapper.py
UTF-8
6,610
3.0625
3
[]
no_license
from urllib import * import datetime as dt import pandas as pd import os, time, urllib, xlwings as xw from bs4 import BeautifulSoup link = 'https://finance.yahoo.com/' link_stock = 'https://finance.yahoo.com/quote/AAPL?p=AAPL' """ Pasos: 1) Import urllib 2) Request al servidor de destino 3) Indicar cual es el servido...
true
141dafe75182a8d3c064ce2292f0c8745f871e9d
Python
ghleokim/algorithm
/190905/solvingclub_0906_rotate.py
UTF-8
397
2.921875
3
[]
no_license
def rotate(B): NB = [row[::-1] for row in [*zip(*B)]] return NB def myJoin(S): return ''.join([*map(str,S)]) for T in range(int(input())): N = int(input()) B = [[*map(int,input().split())] for _ in range(N)] B1 = rotate(B); B2 = rotate(B1); B3 = rotate(B2) print('#{}'.format(T+1), end...
true
b546d47b35fd2fab5812db238fe08d12351ade5d
Python
alphacsc/alphacsc
/alphacsc/other/swm.py
UTF-8
5,088
3.1875
3
[ "BSD-3-Clause" ]
permissive
""" Code adopted from Voytek Lab package neurodsp: https://github.com/voytekresearch/neurodsp/blob/master/neurodsp/shape/swm.py The sliding window matching algorithm identifies the waveform shape of neural oscillations using correlations. """ # Authors: Scott Cole # Mainak Jas <mainak.jas@telecom-paristech.f...
true
c532e25f09aca4a6eb3429ea6d70d324c6c8ec4a
Python
757217469/ML
/20210203_聚类算法/05_案例五_层次聚类(BIRCH)算法参数比较.py
UTF-8
2,678
2.828125
3
[]
no_license
# coding=utf-8 from itertools import cycle from time import time import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import colors from sklearn.preprocessing import StandardScaler from sklearn.cluster import Birch from sklearn.datasets.samples_generator import make_blobs mpl.rcP...
true
9d0fbfceadbc63b584dd5e7ef122fe55fae9f12d
Python
jh16g15/ili9341_parallel_controller
/software/convert_png_to_hex.py
UTF-8
1,182
2.8125
3
[]
no_license
# Based on Ben Eater's Image conversion code seen here # https://www.youtube.com/watch?v=uqY3FMuMuRo from PIL import Image IMAGE_LOC = "D:/Documents/vivado/ili9341_parallel_controller/resources/edited/" IMAGE_NAME = "bike" IMAGE_EXT = ".png" IMAGE_WIDTH = 240 IMAGE_HEIGHT = 320 PADDED_WIDTH = 256 # pad out to 256 wi...
true
ac2c55b6970d28e9bfbcade88591b1d49c229b6f
Python
wargile/learning
/Python/ami_summer_camp/math/neiron.py
UTF-8
1,005
3.46875
3
[]
no_license
__author__ = 'Sergey Ivanychev' def nersum2(x1,x2,w1,w2): return w1*x1+w2*x2 def main(): x = [] y = [] w11 = [] w21 = [] err = 1 w11 = 0.5 w21 = 0.5 while (err>0.01) or (err < -0.01): x = list(map(int, input().split())) sum = nersum2(x[0],x[1], w11, w2...
true
10211c7b1be53428f131b1ccace50608b25d2849
Python
romanannaev/python
/1.py
UTF-8
265
2.84375
3
[]
no_license
import random def look_meh(look_meh): return random.choice(look_meh) spider = ["1 gold", "копыта", "ноги"] adger = ["10 gold", "mech", "shlem"] look = [spider, adger, adger] pocket = [] for i in look: pocket.append(look_meh(i)) print (pocket)
true
a5e120edc8ece4ac3175ce1751b02cd7eac493a7
Python
xanxerus/luna-the-giant
/Gravity.py
UTF-8
1,272
3.171875
3
[]
no_license
#!/usr/bin/env pypy '''Gravity''' from math import radians, cos, acos, sin, sqrt #givens LUNAR_SCALE_FACTOR = 1.448417e+08 female_height = 1.622 mass = 1.570981e+26 female_mass = 51.7 furman_lat, furman_lon = radians(34.922753), radians(-82.441248) utd_lat, utd_lon = radians(32.989924), radians(-96.751620) earth_r...
true
86ea42e0ece7b46b82e7fac3f1dfbba89d1acdb2
Python
PranavSPandya/Python-Scripting-Commands
/Control Loops.py
UTF-8
1,023
3.9375
4
[]
no_license
#Loop Commands i=10 ''' print("A") "label1": print("label1") goto label1 print("Ahead of label1") while i>00: print("This is",i) i-=1 if i==7: print("Continue") continue print("It will continue the iterat...
true
a9a185db06734412b40fa5d288afdacf73ad1eee
Python
saviola777/userdocker
/userdocker/helpers/cmd.py
UTF-8
2,113
2.84375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from ..config import ARGS_ALWAYS, ARGS_DEFAULT from .logger import logger from .parser import split_into_arg_and_value, join_arg_and_value def init_cmd(args) -> list: """Initialize the command. The command is built using - executor and subcommand, - ARGS_ALWAYS, - user ar...
true
0cf82effa257624bc9bdea25f3a85c28b2d26644
Python
iyinyueweb/iyinyue
/boxes/start.py
UTF-8
9,566
2.984375
3
[]
no_license
__author__ = 'Administrator' import pygame from pygame.locals import * from sys import exit from boxes.vector import Vector sprite_image_filename = 'img/2.png' background_image_filename = 'img/1.png' mouse_image_filename = 'img/2.png' SCREEN_SIZE = (640, 480) def hello_world(): pygame.init() # 初始化 screen =...
true
fe3d15c7803b48edcc182fc45e782c48f5e5af87
Python
Carlloos-Sillva/Linguagem-de-Programacao-Python-LISTA-2
/Calculadora.py
UTF-8
1,114
4.5
4
[]
no_license
# Calculadora em Python operacao = '' while operacao != "sair": print() operacao = input(" Qual operacao desejada - soma, sub, mult, div ou sair: ") if operacao == "sair": break numero_1 = float(input(" Digite primeiro número: ")) numero_2 = float(input(" Digite segundo número: "...
true
d84b4f457d2f03448380df0720e32477306613c5
Python
Den4200/pyfrost
/frost/server/storage/base.py
UTF-8
5,533
3.234375
3
[ "MIT" ]
permissive
import json from typing import Any, Dict, Optional from frost.server.storage.exceptions import DuplicateValueError class Base: """The base model for data storage. """ @classmethod def search(cls, item: Any) -> Any: """Searches the saved data for a specific item. :param item: The ite...
true
e3c7ac4ff98dfe803ddd05ed784f2f492b4a2919
Python
1lilyal1/SearchImageFragment
/SearchImageFragment/SearchImageFragment.py
UTF-8
1,798
2.625
3
[]
no_license
from PIL import ImageGrab import os import time import cv2 import numpy as np import time; from tqdm import tqdm # Search for an image by fragment # Поиск изображения # SoursePicture - большое изображение в котом введётся поиск по фрагменту # template - фрагмент def FindImage(SoursePicture, template): img_rgb =...
true
a28c6a2beae5ecffc6376b27ece80701008a10c7
Python
lluxury/codewars
/Digital Root.py
UTF-8
873
4.03125
4
[ "MIT" ]
permissive
from functools import reduce def digital_root(n): ''' >>> digital_root(942) 15 ''' if n < 10: return n mylist = list(str(n)) sum = reduce(lambda x, y: int(x)+int(y), mylist) return digital_root(sum) # reduce 不再是基本函数,需要导入 # map 接收函数,序列,反回数列 map(f, [1, 2...
true
7e0ceef8454ab83f57bc022cf126b5477f0602c1
Python
dairantzis/BBK_Introduction-to-Computer-Systems_2021
/Week 06/Week 6_Exercise 2.6.1_Marathon example.py
UTF-8
854
3.921875
4
[]
no_license
# Marathon training assistant. import math # This function converts a number of minutes and seconds into just seconds. def total_seconds(min, sec): return min * 60 + sec # This function calculates a speed in miles per hour given # a time (in seconds) to run a single mile. def speed(time): return 3600 / time ...
true
dea93676ed962d2b609f3927b59060e7509ffd82
Python
fp-computer-programming/cycle-3-labs-p22jdiao
/lab_5-1.py
UTF-8
176
2.796875
3
[]
no_license
# Author: JD 10/04/2021 # int(a) # NameError # int("a") # ValueError # "a" + 2 # TypeError # import date # ModuleNotFoundError # print("I am a happy camper!) # SyntaxError
true
46807daad9826571a143597d8fa7691919fd6015
Python
mariusbrataas/pistachio
/testing_data/quicktest_data.py
UTF-8
948
3.03125
3
[ "MIT" ]
permissive
import numpy as np def non_sequential(): x = np.array([[0,0,0,0,0,0,0,0,0,0], [1,1,1,1,1,1,1,1,1,1], [1,0,1,0,1,0,1,0,1,0], [0,1,0,1,0,1,0,1,0,1]]) y = np.array([[0,1,0,1,0,1,0,1,0,1], [0,0,1,1,0,0,1,1,0,0], [0,0,0,1,1,1,0,0,0,1], ...
true
a135cce717d46795b63fe654da654bc752afee2b
Python
zhangrui1997/Verificationcode
/image/getimage.py
UTF-8
475
2.515625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/1/8 16:23 # @Author : 张瑞 # @Site : # @File : getimage.py # @Software: PyCharm import requests import time def getimg(): url = 'http://xk1.ahu.cn/CheckCode.aspx' for i in range(20): print('正在下载{}张验证码:'.format(i+1)) vcode = re...
true
e7a81736c57f0502636af3b24b9968df9013d505
Python
alex3kv/PythonWebinar
/Lesson6/Task4.py
UTF-8
4,454
3.84375
4
[]
no_license
# Реализуйте базовый класс Car. У данного класса должны быть следующие # атрибуты: speed, color, name, is_police (булево). А также методы: go, stop, # turn(direction), которые должны сообщать, что машина поехала, остановилась, # повернула (куда). Опишите несколько дочерних классов: TownCar, SportCar, # WorkCar, Poli...
true
f76f1054d5faa9c84af42efb0703274467cbeb6a
Python
nickyd88/esports-dfs
/matchup_tests.py
UTF-8
3,318
2.515625
3
[]
no_license
import pandas as pd from data_cleaner import GetAllRecent from position_model import CreateExpectedValueFunctionByCol from agg_functions import GetWeightedFptAverages from namemap import GetNameMap from starters_reader import getStarters import csv df = GetAllRecent() df['position_weight'] = 1 pos_avg_weights = GetWe...
true
6edcfed7a39467e8754ce1555c7784b3993452d7
Python
erfaliel/learn_python
/2-Iterations_et_Comprehensions__Basic__/iterators.py
UTF-8
421
3.84375
4
[]
no_license
# parcourir une liste print("Parcours d'une liste: ") liste =[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] for elem in liste: print(elem) # parcourir une chaine avec filtre print("\n Parcours d'une chaine avec filtre: ") chaine = "Bonjour les ZER0S" for lettre in chaine: if lettre in "AEIOUYaeiouy": # si lettre est une voyelle ...
true
11768592dd6a4af6859a1db3ff2ba39320498f04
Python
SpaceAzur/smartsolman_api
/data/dev/SparseMatrixSimilarity/full_model2/pretreatment_MatrixSimilarityCy.py
UTF-8
14,332
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- from gensim import corpora, models, similarities from collections import defaultdict import scipy import os, sys, pandas as pd, numpy as np, time, json, pickle, marshal, csv, re, unidecode, Levenshtein from operator import itemgetter import heapq, scipy.sparse, math, random from classes.normalis...
true
135096758479789c7c038aee3f6bcbef84beb5ee
Python
msaidzengin/pythonEgitimi
/10-PDF and CSV files/03-jsonFiles.py
UTF-8
367
2.96875
3
[]
no_license
import json colors = { 'red': 'kırmızı', 'green': 'yeşil', 'blue': 'mavi', 'yellow': 'sarı', 'orange': 'turuncu', 'purple': 'mor' } with open('colors.json', 'w', encoding='utf-8') as f: json.dump(colors, f, ensure_ascii=False, indent=4) with open('colors.json', 'r', encoding='utf-8') as...
true
5d8c4b4fe896d8340f277cad8b307f5105d1ba6d
Python
Zahidsqldba07/python_exercises-1
/exercise_17.py
UTF-8
288
4
4
[ "MIT" ]
permissive
''' Write a Python program to test whether a number is within 100 of 1000 or 2000 ''' def near_thousand(num): return ((abs(1000 - num) <= 100) or (abs(2000 - num) <= 100)) print(near_thousand(1100)) print(near_thousand(1230)) print(near_thousand(2000)) print(near_thousand(1980))
true
e16bad6ee1d3208a5c6a24e3569ca9747e98593b
Python
nimra/module_gen
/nodes/Ramsundar18TensorFlow/C_Chapter2/A_IntroducingTensors/C_Tensors/index.py
UTF-8
7,774
3.59375
4
[]
no_license
# Lawrence McAfee # ~~~~~~~~ import ~~~~~~~~ from modules.node.HierNode import HierNode from modules.node.LeafNode import LeafNode from modules.node.Stage import Stage from modules.node.block.CodeBlock import CodeBlock as cbk from modules.node.block.ImageBlock import ImageBlock as ibk from modules.node.block.MarkdownB...
true
f7533202ee943c410c4dfb61624ccdcab73dbf39
Python
stcolema/BIF30806_AdvBioinformatics
/Rosalind/Prob 4 - Reverse Complement/reverse_complement.py
UTF-8
717
3.765625
4
[]
no_license
#!/usr/bin/env python3 import sys def reverse_complement(sequence, DNA = True): """Finds the reveerse complement of a DNA or RNA sequence. Key inputs: sequence --- a nucleic acid sequence with each base represented by single characters. DNA --- a boolean denoting sequence being DNA or RNA (false is RNA). """ ...
true
9847373aa0a085ed9df6840ae368b9ecd823ac85
Python
tanjinP/corrections
/frontend/tests/test_user_repository.py
UTF-8
2,107
2.671875
3
[]
no_license
import unittest import boto3 from moto import mock_dynamodb2 from lib.data.user_repository import UserRepository def create_mock_user_table(dynamodb): table = dynamodb.create_table( TableName='UserMock', KeySchema=[ { 'AttributeName': 'username', 'KeyType': 'HASH...
true
d7728ef8eb1c0b60ee32cd191b9fcb369cc4deca
Python
zzhu24/Data-Mining-Project
/zzhu24_assign4/code/DecisionTree.py
UTF-8
7,094
3.21875
3
[]
no_license
""" Name: Zhiyu Zhu NetID: zzhu24 """ """ Used Python3 in this file: Command Used as: python3 DecisionTree.py training-file test-file """ """ Used the structure of Binary Tree!!!! """ import os import sys """ Following two function to find the gini index value for splitting attribute: """ def single_gini(training_...
true
418f1ccd2372b60d559b35c4176672709cbc9a3a
Python
omer19-meet/meet2017y1lab4
/fruit_sorter.py
UTF-8
238
3.3125
3
[ "MIT" ]
permissive
n_frt = input('what fruit am I storing?') if n_frt == 'apple': print(' Bin 1') elif n_frt == 'orange' : print('Bin 2') elif n_frt == 'olive': print( 'bin 3') else: print('i dont recognise this fruit :-( , try again')
true
d1669717d0683a464d8f1e9cb10cfd94d3d6e796
Python
paulofreitas/lab
/codegolf/python/prime-factors.py
UTF-8
158
2.671875
3
[]
no_license
x=raw_input();n=int(x);f=[];c=f.count;d=2 while n>1: while n%d==0:f+=[d];n/=d d+=1 print x+':',' '.join((`n`,`n`+'^'+`c(n)`)[c(n)>1]for n in sorted(set(f)))
true
5eb8660ef9a553bdd8e098b9c9903a52d37d0c9b
Python
kjx336/Sparkle
/ClassLib/Messageset.py
UTF-8
621
3.046875
3
[ "MIT" ]
permissive
class MessageSet(): def __init__(self,messagelist): self.score = 0 self.MessageList = messagelist self.host=self.MessageList[0].host self.number=self.MessageList[0].number def __str__(self): return "host: " + self.host + "\nmessagelist: " + str(len(self.MessageList)) + " ...
true
513155c3430827e4b3b1dcfd44d98c4d709b1d41
Python
yingsihao/image-vae
/data.py
UTF-8
1,969
2.53125
3
[]
no_license
import os import pickle import numpy as np from torch.utils.data import Dataset from hparams import hp from utils.shell import mkdir def truncate_data(inputs): outputs = [] for data in inputs: if len(data) < 16 or len(data) > hp.max_length: continue data = np.minimum(data, 1024) ...
true
c950605e19169e2373df88f884874b5c0e26a34e
Python
AEADataEditor/replication-template
/tools/csv2md.py
UTF-8
723
3.1875
3
[ "CC-BY-4.0" ]
permissive
#!/usr/bin/python3 # Tool to convert arbitrary CSV to Markdown import csv import os import sys # get the CSV filename from the first command-line argument csv_file = sys.argv[1] # derive the Markdown filename from the CSV filename md_file = csv_file.replace('.csv', '.md') # read the CSV file using csv.DictReader wi...
true
e62010e416af12036ee52c10de66b0d4076e35f0
Python
banana6742/machinelearning
/2_html.py
UTF-8
3,058
2.640625
3
[]
no_license
#import the BS4 from bs4 import BeautifulSoup #import the web scraping example htmlxfile as per your location Hfile ="C:/Users/banan/Desktop/webscrape/webhtml.html" with open(Hfile,"r") as organization: soup = BeautifulSoup(organization,"html.parser") #view the contents from the soup print(soup.contents) #sear...
true