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 |
|---|---|---|---|---|---|---|---|---|---|---|
b21e64c39741df5c1174312acd74e109666e3839 | ashjambhulkar/objectoriented | /coding patterns/topological sort/topological_sort.py | UTF-8 | 1,679 | 3.40625 | 3 | [] | no_license | import collections
def topological_sort(vertices, edges):
sortedOrder = []
if vertices <= 0:
return sortedOrder
inDegree = { i: 0 for i in range(vertices)}
graph = { i: [] for i in range(vertices)}
# building the graph and indegree(incoming arrows)
for edge in edges:
parent, child = edge[0... | true |
738cb2f90211810c1bd91d7aab7bd961e483432c | cs-richardson/encryption-mando210 | /caesar.py | UTF-8 | 1,150 | 4.75 | 5 | [] | no_license | '''
This program asks the user for the key and the plain text that the user would
like to encrypt using Caesar’s cipher.
Precondition: the key must be a positive integer
Postcondition: the printed value should be the encrypted line
Miki Ando
'''
# Gets the key and the plain text from the user
k = int(input("Key: "... | true |
1df97d777f7b6595713b44a85233e763eb60752d | zajurin/myScraper | /thirdOne.py | UTF-8 | 493 | 2.71875 | 3 | [] | no_license | # import pyperclip, re # Importing the libraries(this case: regex and pyperclip)
# # Create phone regex.
# phoneRegex = re.compile(r'''(
# (\d{3}|\(\d{3}\))? # area code
# (\s|-|\.)? # separator
# (\d{3}) # first 3 digits
# (\s|-|\.) # separator
# (\d{4}) # last 4 digits
# (\s*(ext|x|e... | true |
b6899369f97bbc5e8b8b0fb905ab10bcc7d87638 | patryklaskowski/Google_Image_Downloader | /google_image_downloader.py | UTF-8 | 11,677 | 2.625 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import requests
import os
import shutil
import time
import sys
################################################################################
def python_version_check():
print(... | true |
97c2c0c42138308c9119caad7abe0ebd8adae7da | surimLee/Python_study_ | /0317_1.py | UTF-8 | 257 | 3.15625 | 3 | [] | no_license | from tkinter import *
window = Tk()
canvas = Canvas(window, width=400, height=300)
canvas.pack()
id=canvas.create_oval(10, 100, 50, 150, fill="green")
def move_right(event):
canvas.move(id, 5, 0)
canvas.bind_all('<KeyPress-Right>', move_right) | true |
947d20905133f61b851cd3c2e1e85fbdc416b2c5 | luozhiping/leetcode | /middle/combination_sum_ii.py | UTF-8 | 2,312 | 3.34375 | 3 | [] | no_license | # 40. 组合总和 II
# https://leetcode-cn.com/problems/combination-sum-ii/
class Solution(object):
def combinationSum2(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
if not candidates:
return []
... | true |
6e5d2518b8b8f030b0718dea616cad631ecb77fb | 836426094/News_study_Environmental_Protection | /操作access2.py | GB18030 | 1,902 | 3.21875 | 3 | [] | no_license | # -*-coding:utf-8-*-
import pyodbc
# ݿ⣨ҪԴ,connect()һ Connection
# cnxn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=.\data\goods.mdb')
cnxn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=E:\\ؼ20181223-20181230\data.mdb')
# cursor()ʹøӴأһααĶ
crsr = cnxn.cursor()
... | true |
23519d6e1cb71f3791f160ec9246260f17dd0cc4 | renjieliu/leetcode | /0001_0599/156.py | UTF-8 | 842 | 3.375 | 3 | [] | no_license | # Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def upsideDownBinaryTree(self, root: 'Optional[TreeNode]') -> 'Optional[TreeNode]':
if root == None:
... | true |
937ceba7f73add8c857eec65dbd2e5fc094f53d6 | pateljulin/Stock-Management-Portfolio | /test_portfolio.py | UTF-8 | 2,266 | 3.046875 | 3 | [] | no_license | import unittest
from Portfolio import Portfolio
"""
Before running test make sure all "_portfolio.txt" files are empty or deleted.
"""
class TestPortfolio(unittest.TestCase):
def test_get_file_path(self):
p1 = Portfolio(first_name="John", last_name="Doe")
p2 = Portfolio(first_name="Susan", last_nam... | true |
5c12e496289ac27ebfedb1607c8ec9c708194849 | soniloi/vindironta | /adventure/inventory.py | UTF-8 | 1,451 | 2.75 | 3 | [] | no_license | from adventure.element import Labels, NamedDataElement
from adventure.item import Item
from adventure.item_container import ItemContainer
class Inventory(NamedDataElement, ItemContainer):
ATTRIBUTE_DEFAULT = 0x1
def __init__(self, inventory_id, attributes, labels, capacity, location_ids=[]):
NamedDataElement.__i... | true |
86e3414acd06d5251fe9840c067a8ea9b29ec6be | Hamil1/Python-Course---Practice-4 | /index.py | UTF-8 | 1,490 | 3.390625 | 3 | [] | no_license | import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to a SQLite database """
conn = None
try:
conn = sqlite3.connect(db_file)
print("Successfully connected")
return conn
except Error as e:
print(e)
return con... | true |
65717dcc00b82c474da3c737b5da930913b92439 | hnathehe2/ENGR-102 | /Lab0911/ex2.py | UTF-8 | 616 | 3.4375 | 3 | [] | no_license | # By submitting this assignment, all team members agree to the following:
# “Aggies do not lie, cheat, or steal, or tolerate those who do”
# “I have not given or received any unauthorized aid on this assignment”
#
# Names: Shion Ito
# Hanh Nguyen
# Anh Hoang
# Matthew Witkowski
# Section: ... | true |
611bdf2a166933140f409109fbde4592ff7991d5 | AyanUpadhaya/LibraryManagerApp | /app.py | UTF-8 | 3,174 | 3.125 | 3 | [] | no_license | #Library management System app
#import neccessary libraries
import sqlite3
from tkinter import*
import PIL.Image
from PIL import ImageTk
from PIL.Image import *
from tkinter import messagebox as ms
from AddBook import*
from ViewBooks import*
from IssueBook import*
from ReturnBook import*
from DeleteBook import*
from O... | true |
48b441a70010ec9dc7d91ac0029ca675a5e301ee | vicentsasi/UPV-ComputerScience-ETSINF | /PER/ENTREGA_PER_2/visualizaciones/parseAndShowGaussian.py | UTF-8 | 2,076 | 2.953125 | 3 | [] | no_license |
import numpy as np
import pandas as pd
import seaborn as sns; sns.set()
import math as m
import os
import matplotlib
from matplotlib import pyplot as plt
#ejeX = [1e-10, 1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1,9e-1]
ejeX = [1,5,10,15,20,25,30,31,32,34,35,36,37,38,39,40,41,42,43,45,46,47,48,49,50,55,60,... | true |
a5e79241d352edc425768eee484a64c3ebe80ba8 | yukinarit/pyserde | /examples/recursive.py | UTF-8 | 346 | 2.671875 | 3 | [
"MIT"
] | permissive | from dataclasses import dataclass
from typing import Optional
from serde import from_dict, serde, to_dict
@dataclass
class Recur:
f: Optional["Recur"]
serde(Recur)
def main() -> None:
f = Recur(Recur(Recur(None)))
print(to_dict(f))
print(from_dict(Recur, {"f": {"f": {"f": None}}}))
if __name__ ... | true |
337578a4dcb643770130d04f9bc2d0d7687c8e0e | rchermanteev/made-algorithms-2020-hw | /HW_14_Basic_algorithms_on_strings/Task_3.py | UTF-8 | 909 | 3.4375 | 3 | [] | no_license | import sys
CHARACTER_OUTSIDE_ALPHABET = "#"
def search_substring_in_string(substr: str, string: str):
mod_string = substr + CHARACTER_OUTSIDE_ALPHABET + string
len_substr = len(substr)
prefix_list = [0] * len(mod_string)
answer = []
for i in range(1, len(mod_string)):
k = prefix_list[i - ... | true |
98e44e70f334da423c57cadac8ff5cbca46c15c9 | gfurlich/Projects | /Digital_Research_Journal/post_stats.py | UTF-8 | 14,939 | 2.75 | 3 | [] | no_license | #-------------------------------------------------------------------------------------#
#
# File : post_stats.py
# Author : Greg Furlich
# Date Created : 2019-02-28
#
# Purpose: To track submissions to my Digital Research Journal and what Categories were worked on.
#
# ... | true |
f9fb8c89a3998efb7df0b951cb1a4a44075afd5b | Hugo-Oliveira-RD11/aprendendo-PYTHON-iniciante | /download-deveres/para-aulas-do-curso-em-video/aula10a.py | UTF-8 | 162 | 3.515625 | 4 | [
"MIT"
] | permissive | n = str(input('qual e o seu nome?'))
if n == 'hugo':
print('que nome bonito em...')
else:
print('que nome ruim!!')
print('tenha um bom dia {}'.format(n))
| true |
be87454d6246f094ff67cc9e0336e4f681299530 | jhsunderland/empyer | /empyer/simulate/simulate_patterns.py | UTF-8 | 4,547 | 3.140625 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.interpolate import RectBivariateSpline
from empyer.misc.image import rotate
from empyer.misc.kernels import shape_function,sg,random_rotation
def cartesian_to_ellipse(center, angle, lengths):
"""Converts a grid of points to equivalent elliptical points for a spline interpolation
... | true |
80d5fca1b22b359e8e6066b63504960be2de967d | Markz666/513final | /SVM.py | UTF-8 | 1,730 | 2.890625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import csv as csv
from sklearn.neighbors import KNeighborsClassifier
from sklearn.decomposition import RandomizedPCA
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from sklearn import svm
# Load the data
train_raw=pd.... | true |
2a5275e8e8c957507e769d2d53131d299616303d | rdashr/jhu-bfx | /605.620_bfx algo/project 2/probe.py | UTF-8 | 1,525 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
'''
probe module: Probing with linear or quadratic (in one method). Both will handle
wrapping. The probe() method will output collisions, addresses accessed, and
key stored.
'''
def probe(hash_table, key, hash_value, scheme, f_l):
if scheme.collision_scheme == "linear":
c1 = 1
c2 = 0
... | true |
fd7313850a35c561e4a7f83897107a27885f2c1b | satyavani462/Django-Batch5 | /25-08-2020/multilevel.py | UTF-8 | 257 | 3.21875 | 3 | [] | no_license | ##multilevel inheritance
class A:
def classA():
print("im from classA")
class B(A):
def classB():
print("im from classB")
class C(B):
def classC():
print("im from classC")
obj=C
obj.classB()
obj.classC()
| true |
3275b20e6500eede2e839f8abce8dcb77c991574 | mohamedScikitLearn/Recsys-frontend | /combine_hybrid_recs/hybridcalculator.py | UTF-8 | 3,192 | 3 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# Recsys-frontend, Copyright (c) 2013, Simon Dooms
# http://github.com/sidooms/recsys-frontend
# MIT License
#
import math
import sys
class HybridCalculator:
the_db = None
algos_rec_item = None
def __init__(self, the_db):
self.the_db = the_db
# Rounds the value ... | true |
e3a820004d204794fb28a8602672219fc1dcddee | christian-miljkovic/interview | /CrackingCodingInterview/GraphTrees/CheckBalanced.py | UTF-8 | 989 | 4.0625 | 4 | [] | no_license | """
Chapter 4
Problem: Check if Binary Tree is Balanced
"""
import sys
sys.path.append('../../DataStructures')
from BinaryTree import Node as TreeNode
def isBalanced(root):
try:
isBalancedInternal(root)
return True
except:
return False
def isBalancedInternal(root):
if root ==... | true |
d236d61c0c845d56c8c7ba9e340443cc51b54123 | Knowledge-Precipitation-Tribe/Neural-network | /code/Ensemble-Learning/Regression.py | UTF-8 | 2,078 | 3 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-#
'''
# Name: Regression
# Description: 集成学习用于回归,将多个个体学习器的结果最后做一个平均用于输出
# Author: super
# Date: 2020/6/5
'''
import numpy as np
import matplotlib.pyplot as plt
from keras.datasets import boston_housing
from keras.models import Sequential
from keras.layers import Dense
from... | true |
72d37dae46184f130eee571a8d195341993ddd9f | JLew15/Python | /chapter3examples.py | UTF-8 | 325 | 2.84375 | 3 | [] | no_license | testResults = "Pass"
#print("Testing 1,2,3" + " "+testResults)
score = 100
print(type(score))
print("Score:",score,sep=",",end=" ")
print("Score:",score,sep=",",end="\n")
print("Score:",score,sep=",",end=" ")
print("Score:",score,sep=",",end=" ")
print("Score:",score,sep=",",end="a")
print("Score:",score,sep=",",end=... | true |
f28a1d511b7ec8fd4d6f95c36c77aa232bdbcaf6 | shnlmn/Rhino-Grasshopper-Scripts | /IronPythonStubs/release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewCellFormattingEventArgs.py | UTF-8 | 1,626 | 2.71875 | 3 | [
"MIT"
] | permissive | class DataGridViewCellFormattingEventArgs(ConvertEventArgs):
"""
Provides data for the System.Windows.Forms.DataGridView.CellFormatting event of a System.Windows.Forms.DataGridView.
DataGridViewCellFormattingEventArgs(columnIndex: int,rowIndex: int,value: object,desiredType: Type,cellStyle: DataGridViewCellStyle... | true |
7378b0184af7e89ed6719a21d7f394d3df69e470 | hryamzik/debinterface | /dnsmasqRange.py | UTF-8 | 4,531 | 2.640625 | 3 | [] | no_license | import socket
import toolutils
class DnsmasqRange(object):
'''
Basic dnsmasq conf of the more file which holds the ip ranges
per interface.
Made for handling very basic dhcp-range options
'''
def __init__(self, path, backup_path=None):
self._config = {}
self._path ... | true |
6cce9dbf311d26acaa0a4cb910169bc0cd056ac1 | bernardusrendy/cbr | /rekognisi-Oktagon/train_CNN.py | UTF-8 | 2,241 | 2.890625 | 3 | [] | no_license | # Importing Keras libraries dan packages
from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
# Anti OSError: broken data stream when reading image file
from PIL import Image, ImageFile
ImageFile.LOAD_... | true |
885fdd6f81050b19904445e500b6cd502e1c3627 | mchlrhw/aoc | /python/tests/year_2018/test_day_01.py | UTF-8 | 1,867 | 2.984375 | 3 | [] | no_license | from operator import add, sub
import pytest
from aoc.year_2018.day_01 import apply_changes, find_duplicate_frequency
from aoc.year_2018.day_01 import parse_frequency_changes, InvalidChange
from aoc.year_2018.day_01.data import puzzle_input
def test_invalid_change_direction():
with pytest.raises(InvalidChange):
... | true |
3edf8ba4cedb2f2da6e0e320124534120c08216b | exercism/python | /exercises/practice/collatz-conjecture/.articles/performance/code/Benchmark.py | UTF-8 | 1,182 | 3.71875 | 4 | [
"Python-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | import timeit
def steps_if(number):
if number <= 0:
raise ValueError("Only positive integers are allowed")
counter = 0
while number != 1:
if number % 2 == 0:
number /= 2
else:
number = number * 3 + 1
counter += 1
return counter
def steps_recursio... | true |
57d6128435fe059caa5d6502d5f9b4163004ec0e | cbragdon93/contigFinder | /getContigs_evaluation.py | UTF-8 | 1,440 | 3.625 | 4 | [] | no_license | # import third party modules
from random import sample
import time
# import in-house modules
from getContigs import getContigs
'''
This script evaluates the getContigs function I wrote up
I scale up the length of the list I get contigs from.
It's assumed that the list you pass into getContigs()
is already sorted, so n... | true |
fe21356c669fbd9beca79512c0ea8b4855a993e0 | ThreePointFive/aid1907_0814 | /aid1907/leetcode_test/最短连续非空子数组/test.py | UTF-8 | 871 | 3.484375 | 3 | [] | no_license | '''求解最短非空连续组数组
示例 1:
输入:A = [1], K = 1
输出:1
示例 2:
输入:A = [1,2], K = 4
输出:-1
示例 3:
输入:A = [2,-1,2], K = 3
输出:3
提示:
1 <= A.length <= 50000
-10 ^ 5 <= A[i] <= 10 ^ 5
1 <= K <= 10 ^ 9
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/shortest-subarray-with-sum-at-least-k
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。'''
def fun(A,K)... | true |
925a6007e4c582e37dfc77f419d51841949c4782 | ankitshrivastava958/pythonbasics | /methodsinpython.py | UTF-8 | 199 | 3.34375 | 3 | [] | no_license | greet = 'hello'
print(greet.capitalize());
print(greet.upper());
print(greet);
l = ['a','b','c'];
#print(l.upper())
print('hOrse'.lower())
h = 'horse';
print(h.replace('h','m'));
print(h.index('h'))
| true |
ea3de7eb100f5e1354dc26c3eef56cc9e88d195a | mserylak/pypsrfits | /pypsrfits.py | UTF-8 | 8,313 | 2.734375 | 3 | [
"AFL-3.0"
] | permissive | #!/usr/bin/env python
# Copyright (C) 2017 by Paul Demorest and Maciej Serylak
# Licensed under the Academic Free License version 3.0
# This program comes with ABSOLUTELY NO WARRANTY.
# You are free to modify and redistribute this code as long
# as you do not remove the above attribution and reasonably
# inform recipi... | true |
02c8e570ab12115bb86f62a0335d467ef2eba4a6 | adavis100/adventofcode2018 | /08/day8a.py | UTF-8 | 1,016 | 3.546875 | 4 | [] | no_license |
def main():
with open("input.txt") as file:
input = file.read()
nums = [int(val) for val in input.split()]
head = build_tree(nums)
print(head)
print('metadata = {}'.format(head.get_metadata_count()))
def build_tree(nums):
num_children = nums.pop(0)
num_metadata = nums.pop(0)
... | true |
f6ad9beb93e70a1c49fe6d85645f4ce9ce9a34f5 | gleb-lobastov/algorithms | /lection1/task3_fibbonaci_big.py | UTF-8 | 1,491 | 3.84375 | 4 | [] | no_license | """
Даны целые числа 1 ≤ n ≤ 10^18 и 2 ≤ m ≤ 10^5, необходимо найти остаток от деления n-го числа Фибоначчи на m.
"""
def fib(n):
last_pair = 0, 1
if n in last_pair:
return n
for _ in range(n - 1):
last_pair = last_pair[1], sum(last_pair)
return last_pair[1]
def pisano(m):
"""... | true |
7b3d74436d9a6b78e79d2151ebc1dc45742ae273 | shahinmg/PyTrx | /PyTrx/Images.py | UTF-8 | 19,898 | 2.921875 | 3 | [
"MIT"
] | permissive | #PyTrx (c) is licensed under a MIT License.
#
#You should have received a copy of the license along with this
#work. If not, see <https://choosealicense.com/licenses/mit/>.
"""
The Images module contains the object-constructors and functions for: (1)
Importing and handling image data, specifically RBG, one-ban... | true |
1afab2090616875a4be1ec00442eb53b859ab2dc | varshanth/SparkMLvsSparklingWater | /datasets/create_cats_dogs_dataset.py | UTF-8 | 1,793 | 3.046875 | 3 | [] | no_license | '''
The CSV file is being created by using the cats-dogs image dataset taken from kaggle. https://www.kaggle.com/c/dogs-vs-cats/data
'''
from keras.preprocessing.image import load_img, img_to_array
from keras.applications.vgg16 import preprocess_input
from keras.applications import VGG16
from keras.models import Model... | true |
cbdacdf3342118246ad9cfd972aba29ec1ef04e8 | webclinic017/trading-backtest-lib-python | /backtest_us_stocks_example.py | UTF-8 | 1,509 | 2.578125 | 3 | [] | no_license | from algorithms.RuleBasedAlgorithm import RuleBasedAlgorithm
from backtest_execution.TradeActionInstruction import TradeActionInstruction
from backtest_execution.expressions.expression_shortcuts import sma, const
from backtest_execution.trade_action_operators.trade_action_shortcuts import close_position, on_market_open... | true |
038f62146cb3a99d3ba2a3edd13270448e39f7ed | numpy/numpy | /numpy/_build_utils/process_src_template.py | UTF-8 | 1,694 | 2.703125 | 3 | [
"Zlib",
"BSD-3-Clause",
"MIT",
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import sys
import os
import argparse
import importlib.util
def get_processor():
# Convoluted because we can't import from numpy.distutils
# (numpy is not yet built)
conv_template_path = os.path.join(
os.path.dirname(__file__),
'..', 'distutils', 'conv_template.py'
... | true |
1a1e972d115febbb174b5467f996f1f0f1bde76e | MahirMuzahid/Big_Mart_Sales_Predictor | /Bitg_Mart_Sales_Prediction.py | UTF-8 | 2,961 | 2.9375 | 3 | [] | no_license | #Import Plugins
from sklearn import svm
import csv
from sklearn.model_selection import train_test_split
from sklearn import datasets
from sklearn import metrics
import seaborn as sns
import pandas as pd
import numpy as np
#taking data
test_data = pd.read_csv('Test.csv')
train_data = pd.read_csv('Train.cs... | true |
66cb1e326b63a86a57ab7b344917843943470b1b | spencerSunLingWei/Python_start_up | /individual_circles.py | UTF-8 | 717 | 3.34375 | 3 | [] | no_license | import pygame,random
pygame.init()
screen = pygame.display.set_mode([600,600])
pygame.display.set_caption("My First Pygame Project")
keepGoing=True
hasDrawn = True
WHITE = (255,255,255)
RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)
colorList = [RED,GREEN,BLUE]
while keepGoing:
for event in pygame.event.get(... | true |
95fb28a607ac9b3bf045918ebe33d4f76d99f3e2 | jedzej/tietopythontraining-basic | /students/medrek_tomasz/lesson_08_regular_expressions/unit_tests_email_validator.py | UTF-8 | 1,496 | 2.65625 | 3 | [] | no_license | import pytest
from email_validator import email_validator
@pytest.mark.parametrize("test_input, expected", [
# Examples taken from: https://en.wikipedia.org/wiki/Email_address#Examples
# ommitted localhost domains.
(r"jsimple@example.com", True),
(r"very.common@example.com", True),
(r"disposable.s... | true |
e5cbe6b223112a6cfdd0a16dfb5857447dfbb0b8 | boshijingang/CCompiler | /preprocessor.py | UTF-8 | 3,373 | 2.640625 | 3 | [] | no_license | class Context:
def __init__(self, visited_files=None, defines=None):
self.visited_files = visited_files if visited_files is not None else []
self.defines = defines if defines is not None else {}
self.if_stacks = [True]
def last_if(self):
return self.if_stacks[-1]
def end_i... | true |
abf9ebcd0f4d65266e24931a8ad5a71b9453eea6 | cosensible/Knapsack | /solver.py | UTF-8 | 1,441 | 3.375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from mbo import MBO
class Knapsack(object):
def __init__(self,input_data):
lines = input_data.split('\n')
firstLine = lines[0].split()
self.item_num = int(firstLine[0])
self.capacity = int(firstLine[1])
self.values = []
self.weights = []
... | true |
cb074619423982beb67fd9af296cac56e58b0fdd | paulin-mipt/madidea_audiocensor | /censorer.py | UTF-8 | 1,695 | 2.578125 | 3 | [] | no_license | import io
import os
import numpy as np
from ml import analyzer
from pydub import AudioSegment
from google_cloud_cens import get_timestamps_from_gc
class Censorer:
def __init__(self, use_google_cloud=True):
self.use_google_cloud = use_google_cloud
self.censor_beep = AudioSegment.from_wav('./censor-... | true |
391de7b49e4bc9276e49a4932a7dc699b433f271 | chriswill88/holbertonschool-web_back_end | /0x01-python_async_function/2-measure_runtime.py | UTF-8 | 357 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python3
'''
module contains function for task 2
'''
import asyncio
import time
wait_n = __import__('1-concurrent_coroutines').wait_n
def measure_time(n: int, max_delay: int) -> float:
"""measures execution time for function"""
start_time = time.time()
asyncio.run(wait_n(n, max_delay))
r... | true |
b71221bc2471c84eb0ecc1811c009aa0753f950d | m-shihata/iti-labs | /python/lab4/01.py | UTF-8 | 356 | 3.5625 | 4 | [] | no_license | # Define a class attribute”color” with a default value white. I.e., Every Vehicle should bewhite.
class Vehicle:
color = "White" # <- Solution
def __init__(self, name, max_speed, mileage):
self.name = name
self.max_speed = max_speed
self.mileage = mileage
class Bus(Vehicle):
pass... | true |
a433a2eba4e40eef240adcb431ce509859c2b5e2 | paapu88/Image2Characters | /rekkariDetectionSave.py | UTF-8 | 10,116 | 2.953125 | 3 | [] | no_license | """
Returns rectangles containing possible licence plates from a given image
for parameters see
http://docs.opencv.org/3.0-beta/modules/objdetect/doc/cascade_classification.html
python3 rekkariDetectionSave.py 0-751.jpg
(there must be trained classifiier file, assumption is 'rekkari.xml' )
"""
import numpy as np
impo... | true |
54d4f03381e728254f4f6e3fe9c5ba3507971711 | eagerdeveloper/coursera-datascience | /Assignment1-Twitter-Sentiment-Analysis/problem4/frequency.py | UTF-8 | 1,588 | 3.203125 | 3 | [] | no_license | import sys
import json
import string
terms = {}
total_term_occurrences = 0
def calculate_term_frequency(tweet_file):
# 1. Read all tweets from file
for line in tweet_file.readlines():
tweet = json.loads(line)
# 2. Go through each result and calculate term occurrences
tweet_key = "... | true |
3c4ec628097b33c8084f546f9d06b0f5728e77c4 | Dave-mash/Questioner-api | /app/tests/v1/utils/test_meetup_validator.py | UTF-8 | 1,738 | 3.109375 | 3 | [
"MIT"
] | permissive | """
This module tests the meetup_validator endpoint
"""
import unittest
from app.api.v1.utils.question_validators import MeetupValidator
class TestQuestionsValidator(unittest.TestCase):
def setUp(self):
""" Initializes app """
self.meetup = {
"topic": "a meetup",
"descript... | true |
ac80824de60808372e9550a9b7a00275e05f1247 | riniguez91/year-13 | /bubble-and-insertion-sort.py | UTF-8 | 676 | 4.03125 | 4 | [] | no_license | '''array = [1,2,3,4,5,6,7,5]
for j in range(len(array)):
if array[j] == 5:
print("Found at index no." + str(j))
else:
print("Not found")'''
def bubbleSort(a):
for i in range(1,len(a)):
for j in range(1,len(a)):
if a[j-1] > a[j]:
a[j-1],a[j] = a[j],a[j-1]
print("Sorted list" , a)
bubbl... | true |
ef2c7fd1b7588143f2b9005f7b3b270ff16489a6 | tba109/timing_studies | /3_icecube_scope/bessel_compare.py | UTF-8 | 1,265 | 3.046875 | 3 | [] | no_license | import scipy.signal as signal
import matplotlib.pyplot as plt
import numpy as np
# b, a = signal.butter(4, 100, 'low', analog=True)
# w, h = signal.freqs(b, a)
# plt.plot(w, 20 * np.log10(np.abs(h)), color='silver', ls='dashed')
b1, a1 = signal.bessel(2, 125, 'low', analog=True)
w1, h1 = signal.freqs(b1, a1)
b2, a2 = ... | true |
03ffa50bd228e391c68e5ef30dc7bfb7b0aaf79f | lorewalker-chen/python-learn | /Chapter4/numbers.py | UTF-8 | 215 | 4.09375 | 4 | [] | no_license | #利用range()生成一系列数字,从第一个参数开始数,到第二个参数前一个
for value in range(1, 5):
print(value)
#利用range()生成数字列表
numbers = list(range(1, 6))
print(numbers) | true |
b67ed70799ef2c9488b8d85417b09d27ac62e313 | Bob-Arctor/mleaning-pythonista | /logreg.py | UTF-8 | 5,662 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 7 12:07:55 2016
@author: AKononov
logistic regression class
"""
import numpy as np
import matplotlib.pyplot as plt
from tools import *
import learner
class LogReg(learner.Learner):
def __init__(self):
super(LogReg, self).__init__()
self.weights = np.atleast_2d([]... | true |
f42851f8f1736a2fd8e540c16de2e62d0a49bb58 | elpablos/ProjectEuler | /0026/script.py | UTF-8 | 576 | 3.984375 | 4 | [] | no_license | # Problem 26 - Reciprocal cycles
import math
import time as T
class Counter:
# ctor
def __init__(self):
None
def fraction(self, num, limit):
res = list()
temp = 1
inc = 0
while temp % num != 0 and inc < limit:
res.append(temp / num)
temp = (temp % num) * 10
inc += 1
... | true |
98264a5e7160b223cba0be257106b967f2611a61 | yk-hts/AtCoder | /c_86.py | UTF-8 | 266 | 3.125 | 3 | [] | no_license | n = int(input())
now = [0,0,0]
for i in range(n):
s = list(map(int,input().split()))
time = s[0] - now[0]
dis = abs(s[1] - now[1]) + abs(s[2] - now[2])
if time < dis or (time-dis)%2 == 1:
print("No")
exit()
now = s
print("Yes")
| true |
44899ad03dd1292bff3b606f254f47ff780cde39 | wxhheian/ptcb | /ch2/ex2_9.py | UTF-8 | 1,528 | 3.96875 | 4 | [] | no_license | #处理Unicode字符串,确保所有字符串在底层有相同的表示
#在Unicode中,某些字符能够用多个合法的编码表示
#Unicode字符串标准化表示
import unicodedata
def nor_unicode():
s1 = 'Spicy Jalape\u00f1o' #\u表示unicode编码
s2 = 'Spicy Jalapen\u0303o'
print(s1,s2)
print(s1 == s2)
print(len(s1),len(s2))
t1 = unicodedata.normalize('NFC',s1) #... | true |
6831b7036e21ab47458df2c8534d0176842076c4 | choprashweta/classifier-bias | /notebooks/twitter_politeness_gender_swap.py | UTF-8 | 3,924 | 2.5625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import os
import scipy
import sys
import dlatk
from functools import reduce
import pronoun_transformation.pronoun_transformation_pipeline as pronoun_pp
from pronoun_transformation.swap_gender_pronouns import SWAP_DICTIONARY
pd... | true |
f536d998593806c3bf13f43692a75cf8556cda43 | salauddintapu/Codeforces_PS | /158A.py | UTF-8 | 309 | 3.40625 | 3 | [] | no_license | detail = input()
details = list(map(int, detail.split()))
n = details[0]
k = details[1]
mark_input = input()
count = 0
if n >= k:
marks = list(map(int, mark_input.split()))
for value in marks:
if value >= marks[k-1] and value > 0:
count += 1
print(count)
else:
print(count) | true |
9b5bf05959f20484fe8635b9a9741b8166fb87af | rakeshrrnav/Python-Data-Structures-Week-4 | /exercise 10.2.py | UTF-8 | 721 | 3.578125 | 4 | [] | no_license | name = input("Enter file:")#input file name
handle = open(name)#open the file
data1=list()#creating an empty list
data2=dict()#creating an empty dictionary
for line in handle:#for every line in file
if not line.startswith("From "):#if it doesn't startswith From
continue
else:
line=line.s... | true |
739246ad362e173ab332608d5eae76b39c7b479c | williamhatch/pymarkdown | /pymarkdown/core.py | UTF-8 | 7,209 | 2.53125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | from __future__ import absolute_import, division, print_function
import doctest
import re
from contextlib import contextmanager
from .compatibility import StringIO, unicode
import itertools
import sys
import os
from toolz.curried import pipe, map, filter, concat
def process(text):
""" Replace failures in docstri... | true |
dc3b1c74523d81fc9682121b648c959f2acc4cc4 | diogopinheiro13/PhyloMissForest | /tree_func_com_non.py | UTF-8 | 6,157 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: Diogo Pinheiro
Script that creates each decision tree for the non bootstrap configuration.
"""
import numpy as np
import random
conta_ties = 0
# Here the user should define the decision tree parameters.
class Node:
def __init__(self, x, y, idxs, min_leaf=0.01, max_... | true |
0de19366fdba5f7885bf1464a9be42a3220a0e09 | nseyedtalebi/export-roi | /omero_exportml/exportml/img_from_roi.py | UTF-8 | 11,762 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Slightly modified this code:
https://github.com/openmicroscopy/omero-example-scripts/processing_scripts/New_Images_From_ROIs.py
Begin original:
This is a modified version of Alex Herbert's original script.
This script has been modified so it can be used
with OMERO version 5.2.x or newer.
Se... | true |
1a48f8da0908c0635a8c196263b7fa038c4be6cb | SafonovMikhail/python_000577 | /001146StepikPyBegin/Stepik001146PyBeginсh09p03st01THEORY01_20210127.py | UTF-8 | 454 | 3.703125 | 4 | [
"Apache-2.0"
] | permissive | s = 'foO BaR BAZ quX'
print('s.capitalize():', s.capitalize())
# Символы, не являющиеся буквами алфавита, остаются неизменными
s = 'foo123#BAR#.'
print(s.capitalize())
s = 'FOO Bar 123 baz qUX'
print(s.swapcase())
s = 'the sun also rises'
print(s.title())
s = "what's happened to ted's IBM stock?"
print(s.title())
s = '... | true |
e4efd631054a8688b4704477a01c1a09cf5d9178 | y-aiba/dp_py | /adapter/sample1/banner.py | UTF-8 | 238 | 3.5 | 4 | [] | no_license | class Banner:
def __init__(self, string: str):
self.string = string
def show_with_paren(self) -> None:
print("(" + self.string + ")")
def show_with_aster(self) -> None:
print("*" + self.string + "*")
| true |
23e6b657f274185a82f1ce2cacc92f8e7dc37d70 | 17714196157/hbase_search | /service/actions/opt.py | UTF-8 | 1,545 | 2.875 | 3 | [] | no_license |
def init_map_field(df, type_db):
"""
函数功能: 接口输入字段 映射成 数据库db里的字段名
字段名映射成对应那个列族的那个字段
df 是需要输入的字段映射关系
:return:
"""
map_field ={}
for n in df.index:
if type_db == "hbase":
hbase_filename = "{f}.{name}".format(f=df.at[n, 'hbase列族'], name=df.at[n, 'hbase字段名'])\
... | true |
6a8c5bc7f0da8b45568d9d313ea2324865798424 | gmansir/Thesis | /PlanetAnalysisWrapper.py | UTF-8 | 4,110 | 2.734375 | 3 | [] | no_license | import os
import pdb
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from Planet_Analysis import PlanetAnalysis
class PlanetAnalysisWrapper:
def __init__(self, **kwargs):
# os.system('%run Planet_Analysis')
self.planets = ['Neptune', 'Titan', 'Enceladus',... | true |
c17279552a6cf8bba0fbb03241037548bca39308 | kikeelectronico/Homeware-LAN | /back/homewareMQTT.py | UTF-8 | 1,984 | 2.546875 | 3 | [
"MIT"
] | permissive | import requests
import json
import paho.mqtt.publish as publish
import paho.mqtt.client as mqtt
from data import Data
import hostname
#Init the data managment object
data_conector = Data()
#Constants
TOPICS = ["device/control", "homeware/alive"]
########################### MQTT reader ###########################
de... | true |
fd29878c4a3789b3a7b8e47594a3285beeb6f707 | andraskohlmann/experiments | /model/autoencoder.py | UTF-8 | 2,234 | 2.703125 | 3 | [] | no_license | from tensorflow.python.keras import Input
from tensorflow.python.keras.layers import LSTM, Reshape, TimeDistributed, Conv2D, Conv2DTranspose
def encoder(input_layer, encoder_setup, trainable=True):
x = input_layer
for filters, kernel_size, strides in encoder_setup:
x = Conv2D(filters=filters, kernel_s... | true |
c4e57062d07e3b027b8758af910e1afa39e21129 | moncadajohn/python | /manexo_archivos_II.py | UTF-8 | 1,128 | 3.96875 | 4 | [] | no_license | from io import open
#archivo_texto=open("archivo.txt","r") # a de append
#archivo_texto.write("\nsiempre es una buena ocasión para estudiar python")
"""
archivo_texto.seek(10)
print(archivo_texto.read())
archivo_texto.seek(0)
print(archivo_texto.read(11)) ##con esta opción nos permite leer hasta determinada posición
... | true |
b0697b553a36ec11faf725889afef02e2061d6bd | RRRoger/FirstProject | /ftputils.py | UTF-8 | 1,835 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import time
import tarfile
import os
from ftplib import FTP
def ftpconnect(host, username, password, port=21):
ftp = FTP()
# ftp.set_debuglevel(2)
ftp.connect(host, port)
ftp.login(username, password)
return ftp
# 从ftp下载文件
def download_file(ftp, remotepath, localpath, buf... | true |
b6b008670ddbc23b0549c14aa73a84b7ed5305d5 | dojinkimm/AlgorithmPractice | /programmers/bruteforce_num_baseball.py | UTF-8 | 2,800 | 3.40625 | 3 | [] | no_license | # 숫자 야구 - 완전탐색
def solution(baseball):
answer, strike, ball = 0, 0, 0
for i in range(123, 988):
num1 = str(i)
if '0' in num1:
continue
if num1[0] is num1[1] or num1[0] is num1[2] or num1[1] is num1[2]:
continue
flag = True
for b in baseball:
... | true |
f0a498d64c5c40f44943bd4d6876b18d79367e8c | tomsonsgs/DGEDT-senti-master | /bucket_iterator.py | UTF-8 | 6,520 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import math
import random
import torch
import numpy
class BucketIterator(object):
def __init__(self, data, batch_size, other=None, sort_key='text_indices', shuffle=True, sort=False):
self.shuffle = shuffle
self.sort = sort
self.sort_key = sort_key
self.batch... | true |
730f8cc2ed950e3e00676612b431f67a22ee388c | screbec/Overwintering-fires | /pre_algorithm/modscag_ldos.py | UTF-8 | 7,816 | 2.921875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Computes the first snow-free day of the season
of each pixel using MODSCAG snow fraction Tiffs
Requirements: a continuous time series of all days of spring
of all MODSCAG snow fraction tiles needed for the study area
for each year analysed
i.e. here tiles h10v02 - h13v02 between Julian day ... | true |
effb00251c8156e21f5487765e7b69a896b27002 | dayusor/code-jam-practice | /2008/round1A/problem.py | UTF-8 | 1,076 | 3.296875 | 3 | [] | no_license | def get_struct_from_file(file_name):
""" Get struct from the file as follow:
[
[3, [1, 2, 3], [4, 5, 6]], ..., [2, [1, 2,], [1, 2]]
]
"""
with open(file_name, 'r') as fh:
file_list = fh.readlines()
# lets remove newline character for each element
file_list = [file_li... | true |
c14aefe6a2562c8658dee5e981527a17c97c232b | katochanchal11/BestEnlistInternship | /Day 10/task10.py | UTF-8 | 1,176 | 4.34375 | 4 | [] | no_license | # Exercise 1 - Write a Python program for all the cases which can check a string contains only a certain set of characters (in this case a-z, A-Z and 0-9).
import re
def characters(string):
char = re.compile(r'[^a-zA-Z0-9.]')
string = char.search(string)
return not bool(string)
print(characters(input(... | true |
815c8376a0cece17281288c169d2103154912427 | biowdl/biowdl-input-converter | /src/biowdl_input_converter/__init__.py | UTF-8 | 5,851 | 2.515625 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2019 Leiden University Medical Center
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | true |
cea29d592a348151d1ac7041d90738c62ef6b7bb | mlaricobar/feature_engine | /feature_engine/encoding/ordinal.py | UTF-8 | 4,134 | 3.21875 | 3 | [
"BSD-3-Clause"
] | permissive | # Authors: Soledad Galli <solegalli@protonmail.com>
# License: BSD 3 clause
import pandas as pd
from feature_engine.encoding.base_encoder import BaseCategoricalTransformer
from feature_engine.variable_manipulation import _define_variables
class OrdinalEncoder(BaseCategoricalTransformer):
"""
The OrdinalCateg... | true |
ee14eebbf3c6d24cdb1a0d118894fd06e815ac3c | learntoautomateforfuture/PythonProject | /6_Dictionary/32_Copy_Dictionaries.py | UTF-8 | 519 | 4.25 | 4 | [] | no_license | # copy() method is used to make a copy of a dictionary
dict1 = {
"name": "Tom",
"age": 35,
"number": 175,
}
mydict = dict1.copy()
print(mydict)
# dict() method is also used to make a copy of a dictionary
dict1 = {
"name": "Tom",
"age": 35,
"number": 175,
}
mydict = dict(dict1)
print(mydict)
# ... | true |
5fc1b9e6a030cdc5cac9813b65296ffb8bb59b41 | weevington/leetcode_solutions | /P20ValidParentheses/valid_parentheses.py | UTF-8 | 1,435 | 4.25 | 4 | [] | no_license | class Solution:
def isValid(self, s: str) -> bool:
"""
Determines if a given string containing just the characters '(', ')',
'{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
- Open brackets are closed by the same type of bracket... | true |
6932d8f3ad0ca0d62442f353f6d6b53ca86e5ba4 | Coslate/LeetCode | /P15_3Sum/Python/my_imp/main.py | UTF-8 | 287 | 3.046875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
from solution import Solution
def main():
sol = Solution()
nums = [-1, 0, 1, 2, -1, -4]
ans = sol.threeSum(nums)
print(f"nums = {nums}")
print(f"ans = {ans}")
#---------------Execution---------------#
if __name__ == '__main__':
main()
| true |
ca5bac69a74c754c41f82187646331c87900ce42 | JanZW/Estimation-Theory | /max-likelyhood.py | UTF-8 | 3,906 | 3.546875 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
#Problem 1
#Part 1
def create_multivariat(mean, cov, n,show):
"""create_multivariat returns np.ndarray of 2 feature vectors of a
Gaussian multivariate distribution.
mean: 1-D array-like of length N; determines the mean ... | true |
41ddc2bb932ae5f6329e7addd00480f566811f48 | siddhantkakkar/s.kakkar | /askthe expert.py | UTF-8 | 1,082 | 2.953125 | 3 | [] | no_license | import random
import turtle as t
t.bgcolor('yellow')
caterpiller = t.Turtle()
caterpiller.shape('square')
caterpiller.color('red')
caterpiller.speed(0)
caterpiller.penup()
caterpiller.hideturtle()
leaf = t.Turtle()
leaf_shape = ((0, 0), (14, 2), (18, 16), (20, 20), (6, 18), (2, 14))
t.register_shape('leaf', ... | true |
173a6854f5e1431d13c7095df6ee624a18eb683b | baites/examples | /coding/cracking/chapter4/ex4.3.py | UTF-8 | 589 | 3.390625 | 3 | [] | no_license |
import math
def make_btree(s):
ex = math.ceil(math.log(len(s)+1)/math.log(2))
t = [None]*(2**ex-1)
def find_root(s, i, j, n=0):
nonlocal t
print(i, j)
if j - i == 1:
return s[i]
l = 2*n+1
if j - i == 2:
t[l] = s[i]
t[n] = s[j-1]... | true |
4c7f63dc64d22d279a06e1aa26bb55b895d94ac4 | BVlad917/Fundamentals-of-Programming | /Assignment 11/player/computer.py | UTF-8 | 693 | 3.703125 | 4 | [] | no_license | from player.player import Player
class Computer(Player):
"""
Computer player that will use a strategy.
"""
def __init__(self, symbol, board, strategy):
super().__init__(symbol, board)
self.__strategy = strategy
def move(self, column, value):
"""
Method... | true |
6f0897b2a7ddbe21b7bcb1afaf2ea293dd5e5aee | acertainKnight/TimeGAN | /metrics/fidelitytest.py | UTF-8 | 1,547 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.keras.layers import GRU, Dense
from tensorflow.keras.metrics import AUC
from tensorflow.keras import Sequential
import numpy as np
import matplotlib.pyplot as plt
def fidelity(ori, gen, show=True):
ori_idx = int(len(ori) * .8)
gen_idx = int(len(gen) * .8)
x_train =... | true |
ac21407a7155186182a5eaa0fad8aa45ddc0b1df | Xazratxon/tin | /tin.py | UTF-8 | 6,492 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
from time import sleep
import requests
import openpyxl
count_find = 0
start_index = 2
file = input("Enter path: ") # воодим путь к входному файлу
def get_data(tin):
global count_find
options = webdriver.ChromeOptions() # задание стандартных настроек для chromdriver
opti... | true |
579749b9d0094737f74f52923d78c2f64daa31b9 | joansekamana/FunMooc | /UpyLab_6_2.py | UTF-8 | 205 | 3.15625 | 3 | [] | no_license | def calcul_prix(produits, catalogue):
prix = 0
for nom_produit in produits:
if nom_produit in catalogue:
prix += produits[nom_produit] * catalogue[nom_produit]
return prix
| true |
91533279fd3a82b86f90b90e55275fef10a27538 | ankit141189/bing | /codes/process.py | UTF-8 | 1,039 | 3.015625 | 3 | [] | no_license | def about():
print "Process the Microsoft Hackathon Files."
def read_tsv_file(filename):
lines = open(filename).read().split("\n")[:-1]
documents = []
for line in lines:
fields = line.split("\t")
document = {}
document["record_id"] = int(fields[0])
document["topic_id"] = int(fields[1])
... | true |
f1b7cef83667b34a0d7e5c855253903ca6815b56 | BartekPodgorski/Python | /Python_Syntax_training/stare/obiekty.py | UTF-8 | 137 | 2.78125 | 3 | [] | no_license | a = 4
print(a.bit_length())
listSample = [1,4,512,32]
listSample2 = listSample
listSample2.append(465)
a = 5
b = a
b = 7
| true |
cac71072cee3940d718ed6d818e8ab514053be8a | augaazeon/mkzhan-scrapy | /mkzhan/spiders/beforeTheFall.py | UTF-8 | 926 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from scrapy import Spider,Request
from mkzhan.items import beforeTheFallItem
class BeforethefallSpider(Spider):
name = 'beforeTheFall'
# allowed_domains = ['']
start_urls = ['https://www.mkzhan.com/211879/']
def parse(self, response):
for chapter_url in response.xpath('... | true |
eb7ad4d0fe9d6c526e377e9cdb4e92a2575d624b | fionakim/code_lib | /rMATS.3.2.5/bin/trimFastq.py | UTF-8 | 2,608 | 2.9375 | 3 | [] | no_license | #
## this program trims fastq file to the given length
#
### import necessary libraries
import re, os, sys, logging, time, datetime;
### checking out the number of arguments
if (len(sys.argv) < 4):
print('Not enough arguments!!');
print ('It takes at least 3 arguments.');
print ('Usage:\n\tProgramName inp... | true |
ebf237ea93009f7f5722b722589222ff14dbc8a0 | limapedro2002/PEOO_Python | /Lista_03/Gabriela Campos/questao 1.py | UTF-8 | 116 | 2.875 | 3 | [] | no_license | def numero(*args):
N = []
N += args
print(len(N),sum(N))
numero(1,2,2,3,4,5)
numero()
numero(1,2,2,3)
| true |
14ff0d24703511c39822285c6417676164a9805e | dibyo007dev/mini_amaze | /app.py | UTF-8 | 1,166 | 2.65625 | 3 | [] | no_license | from flask import Flask,render_template,request,url_for,redirect,session
app = Flask(__name__)
app.secret_key= 'its_a_session_secret_key'
@app.route('/')
def home():
return render_template('index.html')
@app.route('/about.html')
def about():
return render_template('about.html')
@app.route('/contact.html')
... | true |
33f35a5ad071d0315e90c0bbd40febae00a0bbd3 | shoaib4330/Final_year_project | /fyp_nn/fyp/ensemble.py | UTF-8 | 2,647 | 2.703125 | 3 | [] | no_license | import cv2
from sklearn.cluster import KMeans
import numpy as np
def object_by_contours(image_in):
image_input = image_in.copy()
countours = cv2.findContours(image_input, mode = cv2.RETR_EXTERNAL, method = cv2.CHAIN_APPROX_SIMPLE, offset=(0, 0))
return None
def kmeans_color_segmented_images(image_in):
... | true |
7e849046ad117e9815b581778cfc46c674b5e674 | jkgit-creator/Amazon-Price-Tracker | /mail.py | UTF-8 | 779 | 3.171875 | 3 | [] | no_license | import smtplib
def send_mail(URL, title):
"""
Sends an email stating that the product is below target price. Provides a link to the page.
Parameters:
URL: a url link
title(string): the title of the product
"""
server = smtplib.SMTP('smtp.gmail.com', 587)
server.eh... | true |
23ee6d07dc68c039010f64e273ed1d583063c18c | nathantheinventor/solved-problems | /hackerrank/Roads and Libraries/disjointSet.py | UTF-8 | 446 | 3.078125 | 3 | [] | no_license | partition = [-1] * n
def root(elem):
tmp = []
while partition[elem] >= 0:
tmp.append(elem)
elem = partition[elem]
for i in tmp:
partition[i] = elem
return elem
def join(x, y):
a, b = root(a), root(b)
if a == b:
return
if partition[a] > partition[b]:
... | true |
98a2953c3cb1813b53de69360bcd2e06552005b4 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/1536.py | UTF-8 | 562 | 2.765625 | 3 | [] | no_license | #
if __name__ == "__main__":
f = open('qr1.in')
out = open('qr1.out', 'w')
nTestCase = int(f.readline().rstrip())
for testCase in range(nTestCase):
smax, distributeLevels = f.readline().rstrip().split(' ')
nStandUp = 0
nInvited = 0
nowLevel = 0
for level in distributeLevels:
nLevel = int(level)
if ... | true |