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
9455bd0f2e53327368566fc98d40573bfe56e596
austinjhunt/dailycodingproblem
/dcp4.py
UTF-8
2,566
4.09375
4
[]
no_license
# This problem was asked by Stripe. # Given an array of integers, find the first missing positive # integer in linear time and constant space. # In other words, find the lowest # positive integer that does not exist in the array. # The array can contain duplicates and negative numbers as well. # For example, the inp...
true
6dec8a50525a4d354c87e27827214d9a91816a24
HormCodes/socialclusters
/platform_api_service/tests/test_timestamps.py
UTF-8
486
2.828125
3
[ "MIT" ]
permissive
from unittest import TestCase from src.timestamps import get_iso_timestamp_from_string, get_iso_timestamp_from_unix_timestamp class TestTimestamps(TestCase): def test_get_iso_timestamp_from_string(self): self.assertEqual('2017-04-06T15:24:15Z', get_iso_timestamp_from_string("Thu Apr 06 15:24:15 +0000 201...
true
4b5aabea83eb19cdf0c9681acd47ad5dd0a6d75e
MichelleZ/leetcode
/algorithms/python/swiminRisingWater/swiminRisingWater.py
UTF-8
937
3.3125
3
[]
no_license
#! /usr/bin/env python3 # -*- coding: utf-8 -*- # Source: https://leetcode.com/problems/swim-in-rising-water/ # Author: Miao Zhang # Date: 2021-03-09 class Solution: def swimInWater(self, grid: List[List[int]]) -> int: n = len(grid) heap = [] heapq.heappush(heap, (grid[0][0], 0 * n + 0))...
true
00b96412cee17952d1cebd67d28fc4dd0e2eb975
kayakistPh/python-vhdl-fir-filter-tutorial
/python/cocotb_test.py
UTF-8
1,527
2.5625
3
[ "MIT" ]
permissive
import cocotb from cocotb.clock import Clock from cocotb.decorators import coroutine from cocotb.triggers import Timer, RisingEdge, ReadOnly from cocotb.monitors import Monitor from cocotb.drivers import BitDriver from cocotb.binary import BinaryValue from cocotb.regression import TestFactory from cocotb.scoreboard imp...
true
7e9bcef8d3f19e3d2cdda989d77f2d0f2a0ce1b0
Jeonseoghyeon/APR
/Solving Club/3/prac.py
UTF-8
99
3.03125
3
[]
no_license
import copy x = [1,2,3] y = copy.deepcopy(x) y[0] = 3 print(x) print(y) print(id(x)) print(id(y))
true
bccb625dfa66f852f145dd1bb5d6b8c99348aabb
KevinKnott/Coding-Review
/Month 03/Week 04/Day 01/d.py
UTF-8
1,579
3.953125
4
[ "MIT" ]
permissive
# Shortest Subarray with Sum at Least K: https://leetcode.com/problems/shortest-subarray-with-sum-at-least-k/ # Given an integer array nums and an integer k, return the length of the shortest non-empty subarray of nums with a sum of at least k. If there is no such subarray, return -1. # A subarray is a contiguous part...
true
ebdf037f8069077ea8144373c49c17e572ca8454
AshBringer47/kpi_labs
/Lab 2/lab2.py
UTF-8
504
4.125
4
[ "Apache-2.0" ]
permissive
import math #Додаємо бібліотеку math try: x = float(input("Gunawardana Shiron IS-92. Please enter the value of x: ")) #Вводим значение х if x < 0: y = (-1) * x #Якщо значення менші за 0 else: y = x ** 2 #Якщо значення більші або рівні 0 print(y) #Виводим значение y except Keyboar...
true
06004e444695ab1f7ea7c3cf475912d263fdcb61
mitkin/python-isoband-polygons
/contours_isfrekvens.py
UTF-8
3,121
2.78125
3
[]
no_license
#!/usr/bin/env python import numpy as np import os import geopandas as gp import pandas as pd import rasterio as rst from contours.core import shapely_formatter as shapely_fmt from contours.quad import QuadContourGenerator from skimage.filters import gaussian def get_xy_coords(dst): """ Extract X and Y coor...
true
fca159f5fa8314b078dc0ca07463576573fd3862
mario21ic/pynamodb_demo
/main.py
UTF-8
452
3.078125
3
[]
no_license
from model import UserModel # Create Table UserModel.create_table(read_capacity_units=1, write_capacity_units=1) # Insert user = UserModel("John", "Denver") user.save() # Count print("Count:",UserModel.count()) # Query for user in UserModel.query("Smith", first_name__begins_with="J"): print(user.first_name) # ...
true
39ff58ad477b4cafc86fb1e81036f53ca1b1c3af
fultonm/deeplearning
/cnn/build_vocab.py
UTF-8
1,363
3.328125
3
[]
no_license
from os import listdir from collections import Counter from nltk.corpus import stopwords import string import re pos_train_filename = 'cleaned/pos_train.txt' neg_train_filename = 'cleaned/neg_train.txt' vocab_filename = 'vocab.txt' def load_doc(filename): """ Loads the document at the given filename """ ...
true
c3a1bd78ebee76d3bbde7f4fa26a4b0c02ce7481
BarryCam/videocolor
/videocloer.py
UTF-8
2,135
2.765625
3
[]
no_license
#!/usr/bin/env python3 import cv2 import numpy as np def extract(img,n): #显示某颜色区域 hsv=cv2.cvtColor(img,cv2.COLOR_RGB2HSV) if n==1: low=np.array([120,43,46]) up=np.array([130,255,255]) if n==2: low = np.array([40, 43, 46]) up = np.array([50, 255, 255]) if n==3: low = np.array([0,43, 46]) up = np....
true
ef483bc87dad163d4c3dac5e282fbd4b35552f36
ttungl/Coding-Interview-Challenge
/source-code/Largest Palindrome Product 479.py
UTF-8
341
3.625
4
[ "MIT" ]
permissive
# 479. Largest Palindrome Product # ttungl@gmail.com # Find the largest palindrome made from the product of two n-digit numbers. # Since the result could be very large, you should return the largest palindrome mod 1337. # Example: # Input: 2 # Output: 987 # Explanation: 99 x 91 = 9009, 9009 % 1337 = 987 # Note: ...
true
2730f788c102d735f469f1b37233ebd627cef899
handroll/handroll
/handroll/commands/scaffold.py
UTF-8
864
2.59375
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
# Copyright (c) 2017, Matt Layman from handroll.commands.base import Command, finish from handroll.i18n import _ from handroll import scaffolder class ScaffoldCommand(Command): name = 'scaffold' description = _( 'Make a new handroll site from a scaffold ' 'or list the available scaffolds') ...
true
57fc1a17fe164b69981ea81798e1114ff4adf9cc
vitordeatorreao/pyRecog
/cos_errm.py
UTF-8
762
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt from math import pi, exp import numpy as np from textwrap import wrap import matplotlib def f(x): return 1.0/(1.0+exp(-4*(x-0))) fig = plt.figure() ax = fig.add_subplot(111) X2 = np.linspace(0,2*pi,400) T2 = np.cos(X2) X3 = np.linspace(0,2*pi,50) noise = np.ra...
true
e1718c080d6080aa0353728db08a338f975fe305
mauna-ai/python-sdk
/mauna_sdk/utils.py
UTF-8
2,410
2.765625
3
[ "MIT" ]
permissive
import json import secrets import requests from binascii import hexlify from base64 import b64decode from datetime import timezone, datetime from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.primitives import padding from . import config IV = b"\x00" * 16 def _xor...
true
3ebd04f9d51fa116fdf6d65b2ad65b683889e513
apriha/lineage
/src/lineage/individual.py
UTF-8
3,344
2.796875
3
[ "LicenseRef-scancode-public-domain", "MIT", "CC0-1.0" ]
permissive
""" Class for representing individuals within the `lineage` framework. """ """ MIT License Copyright (c) 2016 Andrew Riha 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, inc...
true
69e380aad7cd62e9ca5f0ff7631692b243e58c4d
wt/clusto
/src/clusto/test/drivers/DatacenterTests.py
UTF-8
2,260
2.765625
3
[]
no_license
import clusto from clusto.test import testbase from clusto.drivers.Base import Thing from clusto.drivers.Servers import Server from clusto.drivers.Datacenter import Rack, RackU, Datacenter, Colo, Cage from clusto.exceptions import * class RackTests(testbase.ClustoTestBase): def testAddToRack(self): rac...
true
de4874196bfc2179350e19264631491a37e0a56d
TomekDominiak/podstawypythona
/choinka.py
UTF-8
2,070
3.390625
3
[]
no_license
# def choinka(h,n): # for x,y in list(zip(range(1,(n+1)),range(1,n*2,2))): # print(" "* (n-x) + "*"* y) # # choinka(1,2) # # def rysujChoinke(warstw): # max = warstw * 2 + 1 # for i in range(1, warstw + 1): # for j in range(i + 1): # znakow = 2 * j + 1 # print(' ' * ((max - znakow) // 2...
true
f0c3c261152327796dfcdc2a89354b2a76cb28da
jacobbridges/my-chaos
/Python 2.X/ZERO/Experiments/Client-Server Demo/Working Example/prog/Zam.py
UTF-8
1,323
3.8125
4
[]
no_license
class array: def __init__(self, length, value=None): self.__data = range(length) for index in range(length): self.__data[index] = value def __len__(self): return len(self.__data) def __getitem__(self, key): return self.__data[key] d...
true
f130784f8cd5ab74d9a28c139bd9935be84ba2ca
ceadoor/HacktoberFest-2020
/Python/tobinjacob_AddTwoNumbers.py
UTF-8
136
3.71875
4
[ "MIT" ]
permissive
# PROGRAM-NAME : Add two numbers # By Tobin Jacob # PROGRAM-CODE : a=input("Enter a number") b=input("Enter another number") c=a+b print(c)
true
4a3abaaeefaa16ef7ec00f603a98de89a5b96ddc
EithanHollander/ProjectEulerAnswers
/solution_43.py
UTF-8
1,195
3.640625
4
[]
no_license
from solution_15 import fact from solution_24 import get_the_permutation_in_place_of first_seven_primes = [2, 3, 5, 7, 11, 13, 17] if __name__ == '__main__': def first_three_digits_as_number(number, starting_position): # starting position starts at 0 return int(str(number)[starting_position:start...
true
a5c537b417fa33fbeabaec7c1d542cb2eb198809
ModelingKai/meeting-room-python
/tests/usecase/reservation/in_memory/test_in_memory_cancel_meeting_room_usecase.py
UTF-8
1,905
2.578125
3
[]
no_license
import dataclasses import pytest from src.domain.reservation.reservation import Reservation from src.domain.reservation.reservation_status import ReservationStatus from src.infrastructure.reservation.in_memory_reservation_repository import InMemoryReservationRepository from src.usecase.reservation.cancel_meeting_room...
true
6ba00982591e15e45ca3cb5323c592c369b9a77f
Terralego/django-template-engines
/template_engines/templatetags/pdf_tags.py
UTF-8
2,663
2.53125
3
[ "MIT" ]
permissive
import base64 from django import template from django.utils.safestring import mark_safe from template_engines.utils import get_content_url, get_extension_picture from .utils import parse_tag register = template.Library() class ImageLoaderURLNode(template.Node): def __init__(self, url, data=None, request=None, ...
true
c90153d8adb8ec2bc4ee4a7823e252ac4f48eaa8
webclinic017/alpha-4
/tests/test_alpha.py
UTF-8
4,079
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python """Tests for `alpha` package.""" import unittest import arrow import jqdatasdk as jq import omicron from omicron.core.lang import async_run from omicron.core.timeframe import tf from omicron.core.types import FrameType from omicron.models.security import Security from pandas import DataFrame ...
true
35bbd613394235d71cacc578ec6337a9c8c215b0
norskovsen/Python-og-Pita-2020
/eksempler/biblioteker/matplotlib_eks.py
UTF-8
106
3.046875
3
[]
no_license
import matplotlib.pyplot as plt xs = list(range(20)) ys = [x**2 for x in xs] plt.plot(xs, ys) plt.show()
true
6a48455e569a87f8d57330876efe7bd4972d2313
Pooooom/PythonPackage
/bubble/bubble/__init__.py
UTF-8
780
3.953125
4
[]
no_license
def bubble_sort(data): length = len(data) for i in range(len(data)-1): for j in range(len(data)-1): if (data[j] > data[j+1]): tmp = data[j] data[j] = data[j+1] data[j+1] = tmp def test(): myArray = [31, 2, 11, 23, 8, 7, 11, 14, 20] print("original:", myArray) myArray1 = myArr...
true
588b47976a66f3a250224aa39434435392b8f279
mndimitrov92/Python3_deep_dive
/Iter_gen_Project_1/solution.py
UTF-8
1,977
3.734375
4
[]
no_license
import math from functools import total_ordering @total_ordering class Polygon: def __init__(self, n_vertices, circumradius): if n_vertices < 3: raise ValueError("A polygon must have at least 3 vertices.") self._n_vertices = n_vertices self._circumradius = circumradius def __repr__(self): return f"Poly...
true
b3ad722678410e4e00162ecac73f142c89a3a163
AaronMazZZZ/CM3-Mad-Max-Meets-Skynet
/src/trajectory_tracking/src/test/trajectory/test_lissajous_trajectory.py
UTF-8
2,084
3.109375
3
[ "MIT" ]
permissive
#!/usr/bin/env python import unittest from geometry_msgs.msg import Point from trajectory.lissajous_trajectory import LissajousTrajectory class LissajousTrajectoryTest(unittest.TestCase): def setUp(self): self.trajectory = LissajousTrajectory(1, 1, 3, 2, 4) self.expected_position = Point() ...
true
210371e12a85a8255285c893c44c16a1354c058d
krsubbu/OpenCV
/6. Recording the Webcam.py
UTF-8
893
3.140625
3
[]
no_license
#importing cv2 library import cv2 #Creating a VideoCapture object capture = cv2.VideoCapture(0) #Creating a video codec >>> don't know what it is fourcc = cv2.VideoWriter_fourcc(*'XVID') #Creating a VideoWriter object with ('outpupt name',codec,frameRate,(size)) out = cv2.VideoWriter('output.mp4',fourcc,20...
true
54b03054bc81a0b3b05a9bc8296ae2340f49edd8
petermr/docanalysis
/docanalysis/ami_sections.py
UTF-8
3,571
2.59375
3
[ "Apache-2.0" ]
permissive
from abc import ABC from pathlib import Path import logging from lxml import etree as LXET from docanalysis.xml_lib import XmlLib class AMIAbsSection(ABC): """ """ logger = logging.getLogger("ami_abs_section") SECTIONS = "sections" def __init__(self) -> None: pass @classmethod ...
true
1b0630e9ed6506481832ddcd5f7704350c27ced8
Mstrange8/Linked_Structures
/course.py
UTF-8
1,271
3.875
4
[]
no_license
""" Name: Matthew Strange Class: CS2420 Date: 02/06/2021 Description: Contains class for Course objects """ class Course: """Creates class object containing course information""" def __init__(self, _number=0, _name="", _credit=0.0, _grade=0.0): if not isinstance(_number, int) or _number ...
true
70ad444c7bdf08fe5928718ac754a039f0bea7fc
easonzhang1220/RESTful_Flask_SAP_Concur
/app.py
UTF-8
1,441
2.765625
3
[ "MIT" ]
permissive
from flask import Flask from flask_restful import Api, Resource import datetime app = Flask(__name__) api = Api(app) # items example: # [{ item:{ id: 123, timestamp: 2016-01-01T23:01:01.000Z } }] # data stack items = [] def time_diffent(timestring, time_now): """ :param self: :param timestring: :ret...
true
1a694a0c0459cff19bcf799c185bf9678eefc70c
Ran4/egLan
/test_eglan.py
UTF-8
2,729
2.734375
3
[]
no_license
#!/usr/bin/env python import unittest import eglan import parsing class EgLanTests(unittest.TestCase): def test_GetArgOrEval(self): EglParser = eglan.EglParser print eglan.colored("Starting unit testing of getArgOrEval", "yellow") self.assertEqual(EglParser().getArgOrEval...
true
950b7798c8d35720875ca19ea95f871b7dc747d2
frickp/hash_table_from_scratch
/eval_hash_test.py
UTF-8
1,344
3.421875
3
[]
no_license
""" Tests for custom hash table """ import pytest from hash_table import HashTable class TestClass: """ Tests for hash table """ def test_insertion_retrieval(self): """ insert and retrieve 5 elements. Ensure key matches values """ h = HashTable(10) h.insert_key_...
true
4d1d8e60fbd5fb283c4248eb529127ba538aa953
tykelley/dm-NN
/DNN/Plots/SHMR_plots.py
UTF-8
2,094
2.625
3
[]
no_license
import pandas as pd import numpy as np import matplotlib.pyplot as plt TRUE_data = np.genfromtxt('true_halo_mass_test_set46.csv', delimiter=',', names={'True_Values', 'Original_Index'}) PREDICT_data = np.genfromtxt('NN_halo_mass_test_set46.csv', ...
true
97d0d1dc4baf5eeec66e821f84bb6aa35fe9ed1b
realcryptc/Intro-to-Programming---Python
/Labs/Lab 1/lab1.py
UTF-8
122
2.953125
3
[]
no_license
#Define functions here utilize them in a different file def add(x, y): return x + y print('Lab2 name: ' + __name__)
true
a5ac06514bfbae4761294f8e64e2bf6dd6241e37
1ncurred-da3mon/Annoying-Alarm-Clock
/RPi-Code/kill-conn
UTF-8
731
3.0625
3
[ "CC0-1.0" ]
permissive
#!/usr/bin/python3 import serial # used to communicate with the arduino ser = serial.Serial("/dev/ttyACM0", 9600, timeout=1) # make connection with arduino ser.flush() # ping arduino until one of 2 responses is received while True: ser.write(b"PING\n") line = ser.readline().decode('utf-8').rstrip() if line == "R...
true
956be7f61b9c02dddc1ca83db2ff5e4153de8bbb
GarryG6/PyProject
/String11_1.py
UTF-8
694
4.4375
4
[]
no_license
# Задача 9. Дана строка. Определить, образует ли число подстрока,начинающаяся с символа номер start и заканчивающаяся # символом номер end. st = input('Введите строку символов: ') start = int(input('Введите номер начального символа подстроки: ')) end = int(input('Введите номер конечного символа подстроки: ')) substri...
true
bbfd97459a6408d074ecb00f40ef4faee974416e
spencer602/Poker
/deck.py
UTF-8
1,801
3.953125
4
[]
no_license
''' Created on Mar 10, 2018 @author: Spencer ''' from card import Card from random import randint class Deck(): '''class representing a deck of Cards''' def __init__(self, deck_type = 'full_suited'): '''initializer, deck type to create''' self.deck = [] self.initialize(deck_type) ...
true
53f71f435b985b94cf06632a147d00c578e63506
zhuluntsai/ntucv2020
/R09521608_HW2_ver1/R09521608_HW2.py
UTF-8
2,924
3.703125
4
[]
no_license
#hw2 #R09521608 土木系電輔組 蔡瑋倫 # Write a program to generate: # (a) a binary image (threshold at 128) # (b) a histogram # (c) connected components (regions with + at centroid, bounding box) from PIL import Image import numpy as np import matplotlib.pyplot as plt filename = 'lena.bmp' img = Image.open(filename) width,...
true
bf68f4e994c90b7f4d1f11c151d00ec1b6eb79d2
0154155lizhijian/PythonSpider
/0154155/Test/pool_test.py
UTF-8
1,845
2.609375
3
[]
no_license
import requests from lxml import etree import pymysql from multiprocessing import Pool import time conn = pymysql.connect(host='localhost', user='root', passwd='123456', db='mydb', port=3306, charset='utf8') cursor = conn.cursor() headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKi...
true
8d1a84987a822b840f42e9e2e08ec67336769a5c
Aasthaengg/IBMdataset
/Python_codes/p02693/s346148359.py
UTF-8
153
3.234375
3
[]
no_license
n = int(input()) a, b = map(int, input().split()) i = 0 ans = "NG" while i <= b: if i >= a and i % n == 0: ans = "OK" i += n print(ans)
true
5f872c9e784bbaf22342f1661566e49b554cd7c6
mgcox/codingChallenges
/dataStructuresAndAlgo/bitFlip.py
UTF-8
481
3.421875
3
[]
no_license
#https://www.hackerrank.com/challenges/flipping-bits #You will be given a list of 32 bits unsigned integers. You are required to output the list of the unsigned integers you get by flipping bits in its binary representation (i.e. unset bits must be set, and set bits must be unset). #this helped http://stackoverflow.c...
true
880b94ff28e8d1af2ede909162f47c8bf4bb5927
ikeven94/Algorithm
/배열 파티션Ⅱ.py
UTF-8
742
4
4
[]
no_license
## 배열 파티션Ⅱ(Array Patition 2) ## 배열을 입력받아 output[i]가 자신을 제외한 나머지 모든 요소의 곱셈 결과가 되도록 출력 # input input = [1,2,3,4] # output # [24,12,8,6] # Caution : 나눗셈 하지않고 O(n)에 풀이 ################# # 1. ################# def productExceptSelf(x): newList = [] p = 1 for i in range(0,len(x)): # 왼쪽 곱 newL...
true
c138b7ed2503958f052eeda0e5e677c37ba58e0d
Mukosame/learn_python_the_hard_way
/ex49/skeleton/tests/sentence_tests.py
UTF-8
2,330
3.265625
3
[]
no_license
from nose.tools import * from ex49 import sentence from ex48 import lexicon def test_sentence(): obj = 'north south east' ver = 'go kill eat' sub = 'bear princess' spell_card = Sentence(sub, ver, obj) assert_equal(spell_card.subject, 'south') assert_equal(spell_card.verb, 'kill') assert_equ...
true
6dc7a316c99ce13881085f386170e95064311ac0
zl101/heart_rate_sentinel_server
/intervalavg.py
UTF-8
1,529
2.953125
3
[ "MIT" ]
permissive
import logging import datetime import numpy def intervalAvgHelper(input, patientDict, hrDict): """ Validates input and then returns average hr since a datetime :returns: -1 if not successful, otherwise the average hr """ if(not isinstance(input, type({}))): logging.error("didn't pass in d...
true
821f1bdbf5f3fe0f363401e457042b3597070de1
tangkaiyang/others
/网络爬虫开发实战/chapter05/json_test.py
UTF-8
1,335
3.359375
3
[]
no_license
# !/usr/bin/env python3 # -*- coding: utf-8 -*- # @Time : 2019/4/23 20:17 # @Author : tangky # @Site : # @File : json_test.py # @Software : PyCharm import json # str = ''' # [{ # "name": "Bob", # "gender": "male", # "birthday": "1992-10-18" # }, { # "name": "Selina", # "gender": "fem...
true
e942e8cbc72ec6a5c6da3902ef717edbc3022c4b
logonmy/analysis_dns_logaa
/server_scan/main.py
UTF-8
2,939
2.59375
3
[]
no_license
#!/usr/bin/env python # encoding:utf-8 import MySQLdb import threading import datetime # 数据库操作类 class DataBase: def __init__(self): self.host = '172.29.152.249' self.user = 'root' self.passwd = 'platform' self.charset = 'utf8' self.db_lock = threading.Lock() # 链接数据库 ...
true
508cfb1cdbf25ea42ac7e847d8d0964e586bdac8
Edjchg/TECSpace-Project-1
/interface/main_window.py
UTF-8
4,409
2.609375
3
[]
no_license
# Tutorial: https://www.youtube.com/watch?v=Oy5saLTejtY # Tutorial2: https://www.youtube.com/watch?v=DpSerOAZR9w # Tutorial3: https://www.youtube.com/watch?v=Vl0Z_0DRs_Q from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5 import uic from calcs.rocket_engine import * class ma...
true
014a7871e1781c4fd9b7673bd7bcf4897f994487
larz258/PyMisc
/useful.py
UTF-8
2,521
3.265625
3
[]
no_license
#!/usr/bin/python #Useful.py #A container of useful methods. import os; try: input = raw_input; except NameError: pass; def hello(): print ("Hello World!"); def HELPhello(): print (''' Testing Hello World function, ensures this module is installed correctly. '''); def get_files(direct...
true
3df52f248377aee6dad93af09c5a250d621c6d5b
MrHamdulay/csc3-capstone
/examples/data/Assignment_9/krdsha003/question2.py
UTF-8
1,684
3.84375
4
[]
no_license
"""Assignment 9 Question 2 Reformat text according to a specific collumn width Shaheen Karodia KRDSHA003""" import textwrap #get inputs from the user x=input("Enter the input filename:\n") y=input("Enter the output filename:\n") width=eval(input("Enter the line width:\n")) #get all the information f...
true
3d55ad2cc86a262bcd6e057cd4a1941c5c41bd98
prashantchanne12/Leetcode
/reverse first k elements.py
UTF-8
1,074
4.34375
4
[]
no_license
''' Reverse the first ‘k’ elements of a given LinkedList. ''' class Node: def __init__(self, val, next=None): self.val = val self.next = next def print_list(head): temp = head while temp is not None: print(temp.val, end='->') temp = temp.next def reverse_first_k_elemen...
true
b249d5a6933e781fc2e9719da9909e57bba8f078
GinVill/mycode
/custif/cust_if_script.py
UTF-8
1,266
3.5625
4
[]
no_license
#!/usr/bin/env python3 score = 0 index = 0 questions = ["Do you get nervous before phone calls?", "Do you sweat before turning your camera on?", "Do you enjoy Covid restrictions?", "Do you feel like television or game characters are your friends?", "Are delivery drivers your most frequent guests?", "Do you feel relie...
true
fe81f33284326befa4fdf22a980f0b944b73276f
benjamingarrett/table_maker100
/olcs4_traceback_input_n_c_1100_analysis.py
UTF-8
5,615
2.90625
3
[]
no_license
# Usage: python analysis.py <folder_w_csv> <n0> <n1> <n2> <type> # Description: Read all csv files, obtain running max and min, create and check conjectures # CSV files have three columns: n, critical cache size, cache misses # Of interest here is analysis of critical cache size # ...
true
1f9ad27849f4a0742a89017b57b2f0589b3350a8
lcxzzz0113/flunetpython
/fp_7.py
UTF-8
2,653
3.703125
4
[]
no_license
''' @Date: 2020-08-03 22:13:59 @Author: lcx @Description: ''' # 装饰器, 重复函数使用 import time def time_calc(func): print('running register(%s)' % func) # python加载模块就会执行 def warpper(*args, **kwargs): start_time = time.time() func(*args, **kwargs) exec_time = time.time() - start_time ...
true
b8875736174407cd1bbe847fdf965bf82410cad6
wassname/tensorforce
/tensorforce/core/networks/layers.py
UTF-8
15,325
2.703125
3
[ "Apache-2.0", "MIT" ]
permissive
# Copyright 2017 reinforce.io. 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 required by applicable law or...
true
27e15a056f3dde940d5a55c76e6b1fc17fd9ee1a
Kairat99/Capter4task6
/task4.6.py
UTF-8
498
3.4375
3
[]
no_license
class Home: def __init__(self, name, area): self.name = name self.area = area self.remain = 0 def bring(self, **kwargs): self.remain = self.area - sum(kwargs.values()) print (f"type of home: {self.name}") print (f"total area: {self.area}") print (f"re...
true
abbe1ac1e18a5f608b4d568ff04407dda4ffed88
hanshou101/WebTesting
/data_driven_tests/ddt_introduction.py
UTF-8
692
2.8125
3
[]
no_license
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : ddt_introduction.py @Time : 2019/8/30 10:35 @Author : Crisimple @Github : https://crisimple.github.io/ @Contact : Crisimple@foxmail.com @License : (C)Copyright 2017-2019, Micro-Circle @Desc : None """ import unittest import ddt @ddt....
true
2ef149daa9df23d2b61bd528e9bb3bdad10073a3
jbbaillet85/apprendreACoderAvecPython_FunMooc
/2_PythonCommeMachineAEcrireEtACalculer/256.py
UTF-8
1,175
4.59375
5
[]
no_license
"""Le but de cet exercice est de vérifier que vous savez lire des données en entrée avec la fonction input, les affecter à des variables et imprimer (on dit aussi afficher) une valeur grâce à la fonction print. Écrire un programme qui imprime (donc grâce à la fonction print) la moyenne arithmétique de deux nombres de t...
true
653acfb5978e6705552bc031571d1fdc9ad1aaef
Beautyi/PythonPractice
/Chapter5-Practice/test_5.2.4.py
UTF-8
74
3.390625
3
[]
no_license
#比较数字 age = 18 print(age == 18) print(age <= 18) print(age <= 10)
true
f02a4eeac16749f8ca6a203f9fa9a294327ab8aa
Denisprogrammis/opilane
/projects/Lev Petryakov/Body_22.11.py
UTF-8
1,768
3.25
3
[]
no_license
class body (): def name(): print("Tere! Olen sinu uus sõber - Python!") while 1: try: global nimi nimi = input("Sinu nimi on ? ") if nimi.isalpha() == True: break else: continue ...
true
693ca5c24dead7fb5a278e83cf2e3fe4aaa0d223
0xInfty/GrupoFWP
/wavemaker.py
UTF-8
16,810
3.796875
4
[]
no_license
# -*- coding: utf-8 -*- """ This module works as a function generator It includes: Defined functions for several waveforms incorporating a switcher to make choosing easier. A class for evaluating the multiple waveforms A class for calculating fourier partial sums and evaluating it. """ import numpy as np from scipy.s...
true
114a0226db3f767512f85bd6ca2d36c382e1f00a
jaya2991/LeetCode
/lengthofLastWord.py
UTF-8
507
3.984375
4
[]
no_license
""" Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. """ class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ s...
true
87fa302e672247b03152ea82ec0440ff3fb4aadb
Vini2/MyProjectEulerSolutions
/006 - Sum square difference/6.py
UTF-8
392
4.21875
4
[]
no_license
sum1 = 0 sum2 = 0 for i in range(1,101): sum1+=i #Calculate the sum of numbers sum2+=(i*i) #Calculate the sum of the squares of the numbers sum1 = sum1*sum1 #Calculate the square of the sum of the numbers dif = sum1 - sum2 #Calculate the difference print "The difference between the sum of the squares of t...
true
00c25fdf9aa88fcae87ff80591ce7fc75dc40bfa
jjo/src-juanjo
/python/coproc/coproc-test.py
UTF-8
142
2.734375
3
[]
no_license
#!/usr/bin/python2.5 def coproc(): while True: print (yield('mundo')) a=coproc() a.next() print a.send('hola') print a.send('hello')
true
ff975e2fb5cc197301033a542ee88695e9b6648e
costateixeira/testlist
/data_parser.py
UTF-8
975
2.75
3
[ "CC0-1.0" ]
permissive
import json import pandas as pd final_data={"data":[]} def get_data_and_create_node(datafile="data.csv"): data=pd.read_csv(datafile,encoding="iso8859_1",sep=";",keep_default_na=False) for idx,element in data.iterrows(): # if element["topic"]=="Vaccination": #test only res={} ...
true
00c0787a148274439f4638e7e0987a21716098f6
astitva98/amazonPriceScrapper
/amazonPriceScrpaaer.py
UTF-8
496
2.703125
3
[]
no_license
import requests import bs4 import sys URL = sys.argv[1] headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'} page = requests.get(URL , headers = headers) soup = bs4.BeautifulSoup(page.text , 'lxml') priceString = str(so...
true
276152f7c7e94f4221fc2bc25bd2a7d19f5b48ed
zhanghq-zhq/project1
/selenium_lianxi/通用的定位方式.py
UTF-8
824
2.828125
3
[]
no_license
from selenium.webdriver.common.by import By from selenium import webdriver from time import sleep def ty1(): # 通用定位方式1 driver = webdriver.Chrome() sleep(1) driver.maximize_window() sleep(1) driver.get('https://www.hao123.com/') sleep(1) driver.find_element(By.XPATH, '//*[@id="search"]/...
true
f6d1b876af8c81764974e255f088d4d5a8d3faae
gayoung0838/bioinfo-lecture-2021
/bioinfo_python/027.py
UTF-8
57
2.71875
3
[]
no_license
#!/usr/bin/python Seq1 = "ATGTTATAG" print(Seq1[::-1])
true
3c6c14f7804df2548b6af4091f0924b1bf98c1f4
EriChen0615/Gesture_Recognition
/prepare_ego_data/split_test_train.py
UTF-8
5,023
2.90625
3
[ "MIT" ]
permissive
import os, os.path import fnmatch import numpy as np import random import cv2 def mkdir(path): path = path.strip() path= path.rstrip("/") isExists = os.path.exists(path) if not isExists: os.makedirs(path) print(path + ' created successfully') return True else: print...
true
a2108fbb28632e95407951230b0854a3f676bc67
hamley241/seatingservice
/seatingservice/seat_assignment_script.py
UTF-8
1,362
2.6875
3
[]
no_license
import sys import os from app.controllers import Seats from events.eventprocessor import SeatAssigner from utils.logs import Logger import utils logging = Logger.get_logger() if __name__ == "__main__": help_text = "seat_assignment_script.py: error: the following arguments are required: inputfile \n ex: {} inputfi...
true
1b143ff8b9ac40be03d6474ffde6fac8b57c3bde
jlin728/Python_exercises
/multSum.py
UTF-8
453
4.25
4
[]
no_license
#Multiples #pt 1 - Prints odds from 1 to 1000. for count in range (1, 1000, 2): print count #pt 2 - Prints multiples of 5 from 5 to 1000000. for count5 in range (5, 31, 5): print count5 #Sum list prints the sum of all values in list a = [1, 2, 5, 10, 255, 3] a = [1, 2, 5, 10, 255, 3] print...
true
97d2617d2344d09de39db26245eb8add2966deee
hyolin97/bigdata_web
/python/ji3.py
UTF-8
121
2.90625
3
[ "MIT" ]
permissive
def concate_str(str1,str2): result=str1+str2 print(result) str1=input() str2=input() concate_str(str1,str2)
true
82e93bfbd401bbf32096e8ad83359a8ec8fc171a
csy1046/mypractice
/mypractice/python/word_cloud/cipin.py
UTF-8
235
2.703125
3
[]
no_license
import jieba from collections import Counter text = open('yanjiang.txt',encoding='utf-8',errors='ignore').read() text_jieba = list(jieba.cut(text)) c = Counter(text_jieba) common_c = c.most_common(100) for i in common_c: print(i)
true
67a1310a86cdbe8f27c49ace49da947e089f5e5b
sndnv/stasis
/client-cli/client_cli/render/default/devices.py
UTF-8
2,169
2.796875
3
[ "Apache-2.0" ]
permissive
"""Utility functions for rendering devices and device connections.""" from terminaltables import AsciiTable from client_cli.render import memory_size_to_str, duration_to_str, timestamp_to_iso def render(device): """ Renders the provided device. :param device: device to render :return: rendered stri...
true
f67f7704265c2e5404ca00326dfe15e7f90c7cae
jsungmin6/Algorithm
/백준/Python/알고파/슬라이딩윈도우,투포인터,누적합/1475(방 번호).py
UTF-8
308
3.4375
3
[]
no_license
''' 풀이 nums 배열을 만들고 숫자 개수를 센다. 9는 6에 카운팅 하고 나중에 2로 나눠준다. 가장 큰 max값이 set수 이다 ''' nums=[0]*10 for i in input(): i=int(i) if i == 9: nums[6]+=1 else: nums[i] +=1 nums[6] = (nums[6]+1)//2 print(max(nums))
true
ec2a028c24cfd6b2c0eb5d8859c478531c7f681b
be3sleyc/Rosalind
/Algorithms/meme.py
UTF-8
558
2.734375
3
[]
no_license
#! /usr/bin/env python #Given: A set of protein strings in FASTA format that share some motif # with minimum length 20. #Return: Regular expression for the best-scoring motif. import sys import subprocess import xml.etree.ElementTree def main(): subprocess.call(["meme", sys.argv[1], "-protein", "-nmotifs", "1", "...
true
680783a043b7c8a697f5bd045920e91749f278c5
chisyliu/PointCloudSuperResolution
/code/data_provider.py
UTF-8
10,496
2.578125
3
[]
no_license
import os import queue import threading import h5py import numpy as np def load_patch_data(h5_filename, skip_rate=1, use_randominput=True, norm=False): if use_randominput: print("use randominput, input h5 file is:", h5_filename) f = h5py.File(h5_filename) input = f['poisson_4096'][:] ...
true
bb4fcb6fddb1873f90c32b6deabb26208ce060f9
pfsmyth/april2017
/Code/dountil.py
UTF-8
113
3.046875
3
[]
no_license
# do ... until while True : num = input("Give me a number >") print num if num == 0 : break
true
b64ea7b02408d07d1debdfb4698bf8c96c30b85e
rohit-100/openCVexamples
/motion_detection.py
UTF-8
2,309
2.796875
3
[]
no_license
import cv2 as cv import numpy as np import time images_path = '/home/rohit/PycharmProjects/images/' def show_image(image, delay): delay = delay * 1000 cv.namedWindow('image', cv.WINDOW_NORMAL) cv.imshow('image', image) cv.waitKey(delay) class motiondetection: def __init__(self,frame11,frame22):...
true
dbcc5ffd18007f7de78e69dfadbc3bac2051b27b
Oleg166/Python_Algos
/Урок 3. Практическое задание/task_7.py
UTF-8
1,080
4.28125
4
[]
no_license
""" Задание_7. В одномерном массиве целых чисел определить два наименьших элемента. Они могут быть как равны между собой (оба являться минимальными), так и различаться. Пример: Исходный массив: [28, -86, 44, -37, -7, -52, -19, -3, -15, -73] Наименьший элемент: -86, встречается в этом массиве 1 раз Второй наименьший эл...
true
b047df2518e3c2652f94d0b88a854640cc096f07
nh273/davinci
/utils/scrapers/cellar-tracker-scraper/scraper_helper.py
UTF-8
625
3.109375
3
[]
no_license
import csv import time import random def write_to_csv(fields, dict_data, file): with open(file, 'a+') as f: writer = csv.DictWriter(f, fieldnames=fields) for data in dict_data: writer.writerow(data) def strip_white_space(text): """Clean up \n, \xa0 and the likes""" to_replace...
true
aed6937350050d7a3fcfdcf5809954e10e3f8cd1
alapamin/data-structures-and-algorithms
/linkedlist.py
UTF-8
972
4
4
[ "MIT" ]
permissive
class Element(object): def __init__(self, value): #creating an individual cell in a linked list self.value = value self.next = None class LinkedList(object): def __init__(self, head=None): self.head = head def append(self, newElement): current = self.head if...
true
f370939e7dceb4c5adfa70be03b001edd2444612
noiroiseauun/AI_Dominion
/proto4/env.py
UTF-8
6,674
2.90625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python """ Author: Adam White, Mohammad M. Ajallooeian, Sina Ghiassian Purpose: Code for the Gambler's problem environment from the Sutton and Barto Reinforcement Learning: An Introduction Chapter 4. For use in the Reinforcement Learning course, Fall 2017, University of Alberta """ from utils i...
true
acfee8ef610ff6c8796942f91dc55b833f4b4aa6
JLGarciaFranco/PyDropsondes
/track.py
UTF-8
1,375
2.609375
3
[]
no_license
import numpy as np import pandas as pd import datetime import os atlantic='../Data/AtlanticTrack.txt' pacific='../Data/PacificTrack.txt' #df=pd.DataFrame([],columns=['Storm Name','Datetime','Longitude','Latitude','pressure']) def readtrack(filename,basin): f=open(filename,'r') a=f.readlines() dicc={'Storm N...
true
0b215a03b3b40633e3d49527425e208210f5199a
qrogers/CardRogue
/bin/spell.py
UTF-8
262
2.578125
3
[]
no_license
import card import enum class Spell(card.Card): class Subtype(enum.Enum): FIRE = enum.auto() WATER = enum.auto() NECROMANCY = enum.auto() def __init__(self): super().__init__() self.type = card.Card.Type.SPELL
true
6053566d86f72f2400f74883566705c33be69c38
lshen1120/leetcode
/24.py
UTF-8
722
3.25
3
[]
no_license
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def swapPairs(self, head): node = head result = head prev = None while node and node.next: left = node ...
true
d2e9f9e6165f412ecb1d06785cdbe1c96c5dbbf9
youle921/assingment_programmings
/two_layers_NN/NN_main.py
UTF-8
1,197
2.59375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jun 9 23:53:55 2021 @author: youle """ import numpy as np import matplotlib.pyplot as plt from two_NN import neural_network ans, data = np.split(np.loadtxt("input_data.dat"), [1], axis = 1) one_hot_ans = np.zeros([ans.shape[0], 2]) one_hot_ans[ans.squeeze() == 0, 0] = 1 on...
true
8d5392bdf9fc3da8de49d4f5071e29421aa8a258
mononobi/pyrin
/src/pyrin/validator/handlers/misc.py
UTF-8
53,288
2.5625
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ validator handlers misc module. """ import pyrin.utils.dictionary as dict_utils from pyrin.core.globals import _, LIST_TYPES from pyrin.core.decorators import class_property from pyrin.validator.handlers.base import ValidatorBase from pyrin.validator.handlers.exceptions import ValueIsLower...
true
e552d896668b55b5032ee1c0e469987bb85970f0
NickTaporuk/python
/sys_event/sys.py
UTF-8
608
3.203125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'nick' import sys # sys.stdout.write('Введите ваше имя\n') # if len(sys.argv) != 2: # print 'Введите ваше имя\n' # name = sys.stdin.readline() print sys.argv # print dir(name) def coroutine(func): def start(*args, **kwargs): g = func(*args, ...
true
eff8e3e41c1470d79a2b72f67dbaad8dd4139a03
dpk2442/pysmith
/tests/contrib/core/test_collection.py
UTF-8
2,074
2.625
3
[]
no_license
import pytest from pysmith import BuildInfo from pysmith.contrib.core.collection import COLLECTIONS_KEY, Collection from tests.util import MockFileInfo def test_collections_key_defined(): build_info = BuildInfo() build_info.metadata[COLLECTIONS_KEY] = {} collection = Collection(collection_name="test", m...
true
8bbeb91d1f74b8bd32e610c94c33b3e4f953c195
HausReport/ClubRaiders
/craid/club/regions/SphericalRegion.py
UTF-8
2,035
2.78125
3
[ "BSD-3-Clause" ]
permissive
# Copyright (c) 2020 Club Raiders Project # https://github.com/HausReport/ClubRaiders # # SPDX-License-Identifier: BSD-3-Clause import plotly.graph_objs as go from numpy import * from craid.club.regions.Region import Region class SphericalRegion(Region): def __init__(self, _name, num, x0, y0, z0, r, colo...
true
a07628dc450fb21fa8bf665b4cd369fa98e6c489
SebKleiner/Hateful_Memes
/processing/get_image_data.py
UTF-8
2,357
2.796875
3
[ "MIT" ]
permissive
import io from google.cloud import vision import os password_file = "write here yours" # Write here yours # path = 'uploads/01235.png' def get_all(path, password_file=password_file): # Set up google vision os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = password_file client = vision.ImageAnnotatorClient(...
true
74582d9c15bb6736769d97437873b6a6bd3f56ef
MrColour/Advent_of_Code
/2020/day_20/p_2020_20_02.py
UTF-8
3,014
2.640625
3
[]
no_license
import re from collections import defaultdict input = open("input.txt").read().split("\n\n") collection = input mem = {} ids = [] count = 0 for i, item in enumerate(collection): corner = [] lines = item.split('\n') num = int(lines[0].split(' ')[1][:4]) ids += [num] mem[num] = list(map(list, lines[1:])) def...
true
49975074e1fc6e29c9ed0d3121d9684a8d93b741
YuriiKhomych/ITEA-BC
/Sergii_Davydenko/6_strings/Pw/Pw_5.py
UTF-8
157
3.21875
3
[]
no_license
# 5. Return last word from string. # result: `India` # Done string = 'AV is largest Analytics community of India'.split() print(string[(len(string) - 1)])
true
4747dfd3bc2cdf828a72d989adaecbe014ca4f02
dmslowmo/leetcode
/python/keep_multiplying_found_values_by_two/solution_test.py
UTF-8
356
2.921875
3
[]
no_license
import pytest as pytest import solution @pytest.fixture def s(): inst = solution.Solution() return inst testdata = [ ([5, 3, 6, 1, 12], 3, 24), ([2, 7, 9], 4, 4) ] @pytest.mark.parametrize('nums, original, expected', testdata) def test_happy_path(s, nums, original, expected): assert s.findFin...
true
3b9310313b1dfa236148340be58e6c9f7c6240f1
mandroid-coding/CWE
/res/imports/CWE_flow.py
UTF-8
11,683
3.109375
3
[]
no_license
class Menu: def __init__(self,board): # fetches lists # changing this for now since it doesn't seem to point to the right method... #self.parts,self.titles = MenuOptions.getOptions(board) self.parts,self.titles = MenuOptions().getMenuOptions() #Need exception handling fo...
true
bfa68e2c178adc241366811f76b398a8153d3370
chinchujohn1/python-challenge
/PyBank/raw_data/main.py
UTF-8
1,373
3.1875
3
[]
no_license
import os import csv totalMonth = 0 totalRevenue = 0 preRev = 0 totalChange = 0 averageChange = 0 maxValue = 0 maxIncrease = 0 minDecrease = 0 maxDate = "" minDate = "" # Open budget_data_1.cs\ with open("raw_data\\budget_data_1.csv", 'r') as budget: csvReader =csv.DictReader(budget) # Open...
true
2294686703e80a5765f1e16f4a2e0103b071f7c5
X-n3t/Lepus
/submodules/Permutations.py
UTF-8
3,089
2.703125
3
[ "BSD-3-Clause" ]
permissive
from time import time from termcolor import colored import utilities.MiscHelpers def permuteDash(subdomain, wordlist): results = [] for word in wordlist: results.append("-".join([word, subdomain])) results.append("-".join([subdomain, word])) if "." in subdomain: subParts = subdomain.split(".") for part ...
true
eefae169ddcbca8ea93a7c2682926bb34f25d7de
JoannaSwiderska/PycharmProjects
/day2/new_testing_file.py
UTF-8
87
2.734375
3
[]
no_license
age = 30 age2 = age + 2 print(age2) print(age) name = "Jo" temp = 7.3 nothing = None
true