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
3e6a400cd27ceeb70495a31cd48d3b49d5190c70
pedrovictorgf/aa-trabalho-final
/helper.py
UTF-8
1,440
3.125
3
[]
no_license
import os import re import numpy import matplotlib.pyplot as plt strassen_path = os.getcwd()+"/strassen/" traditional_path = os.getcwd()+"/traditional/" strassen_entries = os.listdir(strassen_path) traditional_entries = os.listdir(traditional_path) strassen_stats = [] traditional_stats = [] for entry in strassen_e...
true
d28d1114c577178dd636df239c73ac54f351f197
pacopablo/gp10
/gp10/util.py
UTF-8
2,524
2.625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # # Copyright (C) 2008 Sam Widmer <sam@myisteam.com> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. # # Author: Sam Widmer <sam@myisteam.com> # Modified: 2009.05.22 by John Hampton <pacopablo@p...
true
4760e9c4a123ce76de860c813ce360b2382ded8d
Marcelo-Carlos/Marcelo_Carlos_TP1_Dev_Python_SO
/question_17.py
UTF-8
239
3.515625
4
[]
no_license
#Escreva um programa em Python, usando o módulo ‘psutil’, que imprima 20 vezes, de segundo a segundo, # o percentual do uso de CPU do computador. import psutil for i in range(20): print(psutil.cpu_times_percent(interval=1))
true
87273901823e3e5930e69a34a00280eebdeee28b
bacizone/python
/ch7-machine.py
UTF-8
575
3.765625
4
[]
no_license
# Using Python builtin sorting algorithm # scores = [3, 5, 3, 7, 9, 5,676, 454, 2986, 13, 34, 64, 4, 6] # # def sort(scores): - but you do not need to define sorting function this time, as you are using the built in fucntion of Python. # scores.sort(reverse=True) # print(scores) character = 'taco' character = 'aman...
true
44dbf476246014ff0f7dcecb4e85ff2675910168
saikishore-py/python-assignment-11
/concatinate.py
UTF-8
227
3.375
3
[]
no_license
def Merge(dict1, dict2): return(dict2.update(dict1)) # Driver code dict1 = {1:10, 2:20} dict2 = {3:30, 4:40} # This return None print(Merge(dict1, dict2)) # changes made in dict2 print(dict2)
true
d6d30fd734c15f37216ff1e5e9e73d3dd5ae7682
Funnick/TIC-TAC-TOE
/v_1.py
UTF-8
936
2.84375
3
[]
no_license
def approximate_board_value(board, weights): board_features = [1] + [0] * 7 aux = [[0 for i in range(3)] for j in range(8)] for i in range(3): for j in range(3): ind = 2 if board[i][j] == 1: ind = 0 elif board[i][j] == -1: ...
true
e87bad4d6a18067e2550247c01c500b3218320ae
Matthew13479/pypowerup
/automations/intake.py
UTF-8
2,342
2.515625
3
[ "MIT" ]
permissive
from magicbot import StateMachine, state, timed_state from components.intake import Intake from components.lifter import Lifter class IntakeAutomation(StateMachine): intake: Intake lifter: Lifter def on_enable(self): if not self.intake.arms_out: self.engage(initial_state="start") ...
true
cd1bc47d0f7778e7a4abb2d63933cc6aa437f1c3
benningtonlee7/AdaIn_Style_Transfer_From_Scratch_In_Pytorch
/dataLoader.py
UTF-8
2,330
2.6875
3
[ "MIT" ]
permissive
import numpy as np from torch.utils.data import Dataset, sampler from torchvision import transforms from PIL import Image import glob # For VGG _NORMALIZE = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) class ImageDataset(Dataset): def __init__(sel...
true
72f27ecb59f48b95c24b0af7404a9ce759ae3f71
ThorstenBeitz/CODASReader
/Examples/Selecting_Channels_Time.py
UTF-8
2,112
3.03125
3
[ "MIT" ]
permissive
from CODASReader import CODASReader file_location = "ExampleFiles/20190923-T1.wdq" # intilize new CODASReader with the specififed file # this reads the file header automatically reader = CODASReader(file_location) # read file trailer reader.readTrailer() # print the number of acquired channels # channels that can be...
true
5b6896da2e990a3133e477f04cafff27dc0acc3a
yvkrishna/My-Initial-Days-Of-Coding
/Lexical_Addition.py
UTF-8
1,899
4.0625
4
[]
no_license
# Python 3 program to generate all # non-increasing sequences of sum # equals to x # Utility function to print array # arr[0..n-1] def printArr(arr, n,a,b,x): abc=[a]*len(arr) abcdef=[b]*len(arr) c=0 for j in range(0,n): if abc[j]<=arr[j] and abcdef[j]>=arr[j] : c=1 ...
true
d08214f95c14556f13b375f787cf8cd2aaa58335
ellynhan/challenge100-codingtest-study
/hall_of_fame/lysuk96/List/LTC_105.py
UTF-8
979
4.15625
4
[]
no_license
''' Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Example 1: Input: s = "A man, a plan, a canal: Panama" Output: true Explanation: "amanaplanacanalpanama" is a palindrome. Example 2: Input: s = "race a car" Output: false Explanation: "raceacar" is ...
true
531ad0653c3cfb912ce8a632df7478baecbc3866
AnnaVidali/dictionary_attack
/Program2.py
UTF-8
1,106
2.890625
3
[]
no_license
import nacl.pwhash # creates txt to write down users and their cracked passwords file3 = open("results.txt", "w") with open("hack.txt", "r") as file1: for line1 in file1: with open("popularpasswords.txt", "r") as file2: for line2 in file2: try: # verifies if...
true
e144f7125c1670287437ff56e83d0cc2cde7d8e5
Aasthaengg/IBMdataset
/Python_codes/p02403/s145466172.py
UTF-8
184
2.875
3
[]
no_license
while True: x,y = map(int,raw_input().split()) if x==0: break else: for i in xrange(x): print y*"#" print ""
true
ca68c3b4e989d5e5c934e2b853380219bc814b3a
sandeep-iitr/WebAPI_Databases_Cool_Project_2017
/LAAC/Assignments/freqanalysis.py
UTF-8
775
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jul 10 16:34:18 2017 @author: Brent Usui """ def func(): url = input() url = url.lower() key = 'abcdefghijklmnopqrstuvwxyz1234567890' myList = [] for char in key: myList.append(0) for char in url: if(key.find(char) ...
true
532de33d17daf1f62717923848085942a00721d0
International/web-scraping
/yellowpages_states/yellowpages_states/spiders/yellowpages_states.py
UTF-8
1,675
3
3
[]
no_license
#scrapy crawl yellowpages_states -o items.json -t json import scrapy import string ''' Scrap state, state name and city from yellowpages.com Example: {'city': 'Ashby', 'state': 'MA', 'state_name': 'Massachusetts'} {'city': 'Mount Washington', 'state': 'MA', 'state_name': 'Massachusetts'} ''' class Yellowpages...
true
53c019d3295f52d1cd17c55667fa2620008932c0
Yuanoung/RabbitMQ
/06Remote procedure call (RPC)/rpc_client.py
UTF-8
4,296
3.484375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 import sys import pika import uuid class FibonacciRpcClient(object): """ 消息属性 AMQP协议给消息预定义了一系列的14个属性。大多数属性很少会用到,除了以下几个: 1. delivery_mode(投递模式):将消息标记为持久的(值为2)或暂存的(除了2之外的其他任何值)。 第二篇教程里接触过这个属性,记得吧? 2. content_type(内容类型):用来描述编码的mime-type。 ...
true
e1a1fa698944dfcbc044e7d48b5f6cb022ad421b
Xueming10wu/Braveheart
/catkin_ws/src/bamboo/scripts/Serial_test.py
UTF-8
613
2.734375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import serial import rospy def main(): portname = "/dev/ttyUSB0" baudrate = 115200 try: serialPort = serial.Serial(portname, baudrate) serialPort.writeTimeout = 2 #写超时 print ("串口打开成功%s"%portname) print ("...
true
786b58a8516ecb0354375715894ad93f4d90ff52
JayshivPatel/EPQ-Code
/Other Code/Baseline Model Random Forest Version 2.py
UTF-8
1,954
3.671875
4
[]
no_license
#This section allows me to import the modules needed for this baseline model, most #importantly the Random Forest Module from sklearn.ensemble import RandomForestRegressor import pandas as pd from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split # This section allows me to im...
true
cd293a1315dca50878513bfb7ece05f77afa9790
ckampa13/Mu2e-Factory
/temp_humid_sensor/scripts/temphumid_464.py
UTF-8
1,684
2.890625
3
[]
no_license
import serial import time from time import gmtime import calendar from datetime import datetime, date, timedelta import csv import os com = 'COM12' ser = serial.Serial(com,9600) #port on computer #filepath = 'C:\\Users\\LArTPC\\Desktop\\temphumid\\data\\464_data\\' filepath = '\\\MU2E-CART1\\Users\\Public\\temp_humi...
true
0b96ad8a0dce6fdc121f958efbb7d19e86d4e601
salaschen/ACM
/Leetcode/WeeklyContests/273th/q2/sol.py
UTF-8
1,359
3.421875
3
[]
no_license
class Solution: def executeInstructions(self, n: int, startPos: [int], s: str) -> [int]: result = [] for i in range(0, len(s)): seq = s[i:] result.append(self.countMoves(n, startPos, seq)) return result def countMoves(self, n: int, startPos: [int], s) -> int: ...
true
f557b8baf09aad96673aeda2927b3deec91931a8
dpuleri/Projects
/Numbers/fib.py
UTF-8
312
3.46875
3
[ "MIT" ]
permissive
##fibonacci function for python def fib_helper(n, se): if (se[-1] >= n): return se[:-1] else: se.append(se[-1]+se[-2]) return fib_helper(n, se) def fib(n): if (n <= 0): return [1] elif (n == 1): return [1, 1] else: return fib_helper(n, [1,1])
true
ec785de54233e8efb326d901076644d162e88b2b
experience-corps/data-content-health-score
/Asset_Health_Score.py
UTF-8
6,805
2.90625
3
[]
no_license
# Import modules import numpy as np import pandas as pd import math # Load file into pandas # Input starts at row 2 mkt_lib = pd.read_csv("/Users/liyan.wang/Desktop/Hackathon/Sample Showpad Report Exports/library-marketing-content showpad-export-20190709.csv", header=0) user_act = pd.read_csv("/Users/liyan.wang/Deskt...
true
65d979c033f67727965ade9c28454104da01c5fa
gauravbdev/google-photos-takeout
/organize.py
UTF-8
3,728
3.15625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ This module extracts and does some simple cleanup of Google Photos takeout archives. WARNING: This module assumes all JSON metadata files aren't useful and deletes them by default. """ import argparse import distutils.core import fnmatch import os from wand.image import Image import zipfile...
true
c6004245ef6239b988c03a19ca7b9f09df1b9d05
jsp1256/yande_pider
/yande.py
UTF-8
2,851
2.9375
3
[]
no_license
import os # 引入文件模块 import re # 正则表达式 import urllib.request import multiprocessing # 连接网页并返回源码 def open_url(url): try: req = urllib.request.Request(url) req.add_header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " ...
true
5583a47623eafa10e78a8f0ac73acd107bf19be5
hiencb/Python
/learn/tensorflow/TensorFlow Machine Learning Cookbook 2017/AbstractRemoteData.py
UTF-8
1,051
3.03125
3
[]
no_license
import string from abc import ABCMeta, abstractmethod import nltk from nltk.corpus import stopwords class AbstractRemoteData(metaclass=ABCMeta): _stopwords_ = stopwords.words('english') def load_data(self): if not self.is_downloaded(): contents = self.download() self.write_fil...
true
2e5ca15d60bb8c9e5bae996521c8224ef89c1de8
GregorySkir/Gkime
/26.py
UTF-8
85
3.34375
3
[]
no_license
val =float(input("Enter your value: ")) val*=1.8 val+=32 round(val,2) print(val)
true
a413510dd1b2481ce2def12482969ab8eb1d298e
ssstef/covid-case_numbers
/covid_ml/covidCasePredictions/src/models/archive/neural_networks.py
UTF-8
4,234
2.875
3
[ "MIT" ]
permissive
import sys sys.path.append("src/models/") sys.path.append("src/data/") sys.path.append("data/processed") import numpy as np import pandas as pd import math from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from sklearn.preprocessing import MinMaxScaler from sklearn.metric...
true
2f5e9e0918345e570bde0c50067a3cf47275f7a5
RomainCtl/RecoFinement-engine
/src/content/application.py
UTF-8
2,640
2.921875
3
[]
no_license
from src.utils import db, clean_data, create_soup from .content import Content, ContentType import pandas as pd import numpy as np class Application(Content): content_type = ContentType.APPLICATION # For similarities between different content (different content type) cmp_column_name = "name" def re...
true
07fe8a59df4c730b0a6bad612eaca8a80e59ccfc
ApoorvaJu08/Python
/python basics/Calendar.py
UTF-8
286
3.21875
3
[]
no_license
import calendar c = calendar.TextCalendar(calendar.THURSDAY) #str = c.formatmonth(2025, 1) #print(str) #for printing calendar #4 for april month # for i in c.itermonthdays(2025, 4): # print(i) # for name in calendar.month_name: # print(name) for day in calendar.day_name: print(day)
true
cce5ddc3008c5edd78f026406d7be0c173733f30
zhengziqiang/learngit
/jupyter/ml/resize_img.py
UTF-8
650
2.984375
3
[]
no_license
import os import Image img=Image.open('/home/zzq/learngit/latex/poster/a0_portrait/figures/logo.jpg') # print img.shape def ResizeImage(filein, fileout, width, height, type): img = Image.open(filein) out = img.resize((width, height),Image.ANTIALIAS) #resize image with high-quality out.save(fileout, type) ou...
true
72e7d644e897b482fcd6f120a660384305ec91e7
Edo1108/Av2
/AV2arvoregenetica.py
UTF-8
3,376
3.65625
4
[]
no_license
import random class Entradas(): def __init__(self, valor, pesos): self.valor = int(valor) self.pesos = dict(pesos) def somatorio(entradas, peso): print(f'Peso do Somatório = {peso}') const = 0 valorDeSoma = 0 for e in entradas: valorDeSoma += e['valor'] * e['pesos'][peso]...
true
51b407edc7a54e76145da1ac1e5314c68ca6f8f4
lifeomic/phc-sdk-py
/phc/services/cohorts.py
UTF-8
3,386
2.75
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
"""A Python Module for Cohorts""" from typing import Optional from phc.base_client import BaseClient from phc import ApiResponse from urllib.parse import urlencode class Cohorts(BaseClient): """Provides acccess to PHC cohorts Parameters ---------- session : phc.Session The PHC session ru...
true
32ab5477554e96eed759015e95b87ef5f6621c8e
YesicaAcha/api_project_dev_fundamentals
/truck_delivery_yess/truck.py
UTF-8
449
2.578125
3
[]
no_license
from truck_delivery_yess.vehicle import Vehicle class Truck(Vehicle): """ Class representing a Truck """ def __init__(self, vehicle_type, name, license_plate, truck_type, model, manufacturer): super(Truck, self).__init__(vehicle_type, name) self.license_plate = license_plate self.truck...
true
29e1b361af10296ea81cfb096d31aec5b1cb3477
holyorb2/localhost
/lib/docker.py
UTF-8
981
2.9375
3
[]
no_license
#!/usr/bin/env python3 import os def parse_console_command(command): output = [] p = os.popen(command) line = True while line: line = p.readline().strip() if line: output.append(line) str = output[0] find = 'char' index = 0 result_index = [] for ch in str: if find == 'char': ...
true
85ea20bc916270de8b25c91562b91fe8f8553448
oskargonta/SeleniumEasy
/tests/test_input_formular.py
UTF-8
1,182
2.5625
3
[]
no_license
import pytest from pages.formular import FormInputData from selenium import webdriver class Testformular: @pytest.fixture() def setup(self): self.driver = webdriver.Chrome (r'C:\Users\gonta\PycharmProjects\Selenium\seleniumddemo\chromedriver.exe') self.driver.implicitly_wait (20) self....
true
96e8867fd9ff530429b08078f947dfca1952906b
agonzs11/Polinomio-del-caos
/chaospy/distributions/sampler/sequences/sobol.py
UTF-8
5,347
3.375
3
[ "MIT" ]
permissive
""" Generates samples from the `Sobol sequence`_. Sobol sequences (also called LP_T sequences or (t, s) sequences in base 2) are an example of quasi-random low-discrepancy sequences. They were first introduced by the Russian mathematician Ilya M. Sobol in 1967. These sequences use a base of two to form successively f...
true
7fdb4d9f589d6fbbd07a33ba4c27129007bbf24d
irawlinson/MCATutor
/Scraper/section.py
UTF-8
299
2.828125
3
[]
no_license
class Section: """A section with questions pertaining to a subject.""" def __init__(self, subject, questions): self._subject = subject self._questions = questions def subject(self): return self._subject def questions(self): return self._questions
true
af82e10634ac084a7717e5e74e82bf58d351d675
dtklinh/Protein-Rigid-Domains-Estimation
/venv/lib/python3.5/site-packages/csb/statistics/__init__.py
UTF-8
8,922
3.25
3
[ "MIT" ]
permissive
""" Statistics root package. This package contains a number of common statistical utilities. Sub-packages provide more specialized APIs, for example L{csb.statistics.pdf} defines the probability density object model. """ class Cumulative(object): total_mem = 1e8 def __init__(self, data): self.data ...
true
8dfc7a9477cdfd83e85be4f4a076ebd78c236ab8
erikbuck/CocosPodSixNet
/GameClient.py
UTF-8
5,977
2.609375
3
[ "BSD-3-Clause" ]
permissive
from PodSixNet.Connection import connection, ConnectionListener import sys import cocos from cocos.menu import * import pyglet ########################################################################################## class Client(ConnectionListener): """ """ def __init__(self, target, host, port): ...
true
91cd227801f2b2153918c25cb507e5f6847f7d7c
Yuna9949/hw7_cs362
/Q1/test_FizzBuzz.py
UTF-8
467
3.0625
3
[]
no_license
import unittest import FizzBuzz class TestFizzBuzz(unittest.TestCase): def test_FizzBuzz_3(self): self.assertEqual(FizzBuzz.FizzBuzz(3),'Fizz') def test_FizzBuzz_5(self): self.assertEqual(FizzBuzz.FizzBuzz(5),'Buzz') def test_FizzBuzz_15(self): self.assertEqual(FizzBuzz.FizzBuzz(1...
true
b6dcf8c2bd493a9a5f21927921f0e75b344ca93b
ck0379/GenderRecognition
/Image Preprocessing/facedectcut.py
UTF-8
2,268
2.546875
3
[]
no_license
import cv2 import numpy as np import os.path import os import random male_input_path = '/home/ubuntu/facereg/malefacedata/' female_input_path = '/home/ubuntu/facereg/femalefacedata/' male_output_path = '/home/ubuntu/facereg/mtrimdata/' female_output_path = '/home/ubuntu/facereg/fmtrimdata/' faceCascade = cv2.CascadeC...
true
2257dfaa09c026a7d303eea95d3fa0fe6ff0d556
DanielEscalante/LinkeLabData
/display_data.py
UTF-8
1,336
3.421875
3
[]
no_license
import matplotlib.pyplot as plt import csv a = [] b = [] c = [] d = [] e = [] ti = 191206062000.0 #initial time of chart, here time is econded as yymmddhhmmss tf = 191214174621.0 #final time of chart with open('data.csv','r') as csvfile: #data.csv is file created by getSixySecondAvg.py plots = csv.reader(csvfi...
true
57f993769de4e030ea8a5b35de4eae49fed910b7
LelandYan/machine_learning
/machine learning/the_machine_learning_landscape.py
UTF-8
1,569
2.671875
3
[]
no_license
# _*_ coding: utf-8 _*_ __author__ = 'LelandYan' __date__ = '2019/3/1 15:22' import matplotlib.pyplot as plt import sklearn.linear_model import matplotlib as mpl import pandas as pd import numpy as np from six.moves import urllib def prepare_country_stats(oecd_bli, gdp_per_capita): oecd_bli = oecd_bli[oecd_bli['...
true
a0ae77ed69256fd69ecf281dfc45a7223d2a736b
laurensV/brawlbot
/brawlbot.py
UTF-8
12,724
2.875
3
[]
no_license
import discord import logging import requests import getpass import urllib2 from BeautifulSoup import BeautifulSoup # Set up the logging module to output diagnostic to the console. logging.basicConfig() client = discord.Client() email = "" password = "" if not email: email = raw_input('Email: ') else: print ema...
true
f9b37e51a6d263a48f0897c05fe7c9edf00c36fc
Shelby86/Python_Work
/project1_hard.py
UTF-8
3,904
4.125
4
[]
no_license
'''' - Add a check if book has been added, alert the user - allow the user to search by title - mark a book as read using the title only (just match first instance) - delete a book by title only (just the first instance) - apparently to delete you need to overwrite the entire file - ''' while True: # Lets make ...
true
122c5ce952d6e3a3a663c56cc040deb423dcf2d7
Alfonsxh/Python
/VDO_code/statistics/Field.py
UTF-8
7,133
2.671875
3
[]
no_license
# # Copyright (c) 2018 Red Hat, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed ...
true
3d5fe30381d59c47fc429bc3a58d9db1cc3560f3
TBooker/GlobalAdaptation
/SteppingStone/bin/fstInDrifters.py
UTF-8
1,202
2.828125
3
[]
no_license
import glob, argparse import numpy as np import pandas as pd def yieldPops(directory): for g in glob.glob(directory+'/*'): yield np.array([map(float, i.strip().split() ) for i in open(g)]) def wc2pops(p1,p2): p_bar = (p1 + p2)/2. s2 = (p1 - p_bar)**2 + (p2 - p_bar)**2 if p1 == p2 == 0.0: return 'Na' return ...
true
19fe535a713a84d116e170bf0cee216a2df86e22
chris-Dog/GreyHatPython
/CH1/printf.py
UTF-8
162
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python from ctypes import * msvcrt = cdll.LoadLibrary("libc.so.6") message_string = "Hello world!\n" msvcrt.printf("Testing: %s", message_string)
true
fb64087729c48501f14b055e805b11604f04dc5e
thevyanshu/tathastu_week_of_code
/Day1/Problem1.py
UTF-8
262
3.953125
4
[]
no_license
Name = input("Enter your Name ") Branch = input("Enter your Branch ") College = input("Enter your college Name ") Gender = input("Enter your Gender ") Age = input("Enter your Age ") print(Name + "\n" + Branch + "\n" + College + "\n" + Gender + "\n" + Age)
true
5c5c587440f820759d76c80301683f1541c9798d
LaboiteNoire/PixeldeX
/Main.py
UTF-8
4,509
2.84375
3
[]
no_license
""" 12/11/2019 premiere version de l'import general deve : Mahli concu initialement pour l'architecture general c'est fonction est une fonction de gestion des ressources fichiers, qui ne prend que tres peux sur le cpu et le gpu. Elle a pour but d'eviter et de cibler les problemes qui pourraient-etre liés a tel ...
true
df00e2deddd2a7df6aeb6589337aec82d7fcf53a
kevinfsmith/foosball
/foosball.py
UTF-8
12,388
2.609375
3
[]
no_license
import os import math import itertools import csv import dateutil.parser from collections import namedtuple, defaultdict import webapp2 import webapp2_extras.sessions import jinja2 from google.appengine.ext import ndb from google.appengine.api import memcache import bz2 import pickle import datetime JINJA_ENVIRONMENT ...
true
01470489e1dfe20978b0e0ecc3a6fa10a0ace433
plao2411p/learnign-git
/probando.py
UTF-8
144
3.25
3
[]
no_license
def main(): x = 0 for i in range(0, 100000): for j in range(0, 100000): x += 0.2 print("{}".format(x)) main()
true
efc3c5c61f94dc277d59746f451156e11d86c5a5
NhatNam-Kyoto/Python-learning
/def.py/de1.py
UTF-8
531
3.796875
4
[]
no_license
#Hàm không có giá trị trả về def xinchao(ten): print('xin chao: ' + ten) xinchao('Nam') #Hàm có giá trị trả về: return,các dòng lệnh sau return cũng sẽ không được thực thi def add(num1, num2): print(num1, "+", num2,'= ',num1 + num2) return num1+num2 print('tao lao thien tac') x = add(4,6) print (x) #thêm một số khô...
true
c707df742e5cac64cba1750df8f4a17be5b0fdda
ViniciusMSoares/Lista-3
/.vscode/aa/bealtlesPy.py
UTF-8
1,081
3.515625
4
[]
no_license
def mdc(x, y) : mdc = 1 divisor = 2 while (divisor <= x and divisor <= y) : if (x % divisor == 0 and y % divisor == 0) : x = x/divisor y = y/divisor mdc *= divisor elif (x % divisor == 0) : x = x/divisor elif (y % divisor == 0) : ...
true
39a5cef7116be81a5a9024d5b07227298a3de08f
Beryl2208/CI-2
/Contest/Anagram.py
UTF-8
284
3.65625
4
[ "MIT" ]
permissive
def isAnagram(a,b): if len(a) != len(b): return False if a == b: return True for i in range(1, len(a)): temp = a[i:] + a[:i] if temp == b: return True return False print(isAnagram("bd", "bd"))
true
2c9a3316386e2c783fabb087f3fb944d8870b2b0
SlimTimDotPng/school_inf_matura
/python/14_kvadratická_rovnica.py
UTF-8
751
3.859375
4
[]
no_license
import math a = float(input("Zadaj koeficient a kvadratickej rovnice: ")) b = float(input("Zadaj koeficient b kvadratickej rovnice: ")) c = float(input("Zadaj koeficient c kvadratickej rovnice: ")) D = b**2 - 4*a*c if D < 0: print("Kvadratická rovnica nemá riešienie v R") else: if D == 0: # = je priradzovací...
true
3af758b41f401fe33efb24d52595ddecbb2e90e8
aswinleojohn/PythonOCRPdf
/ocr.py
UTF-8
890
2.59375
3
[]
no_license
import cv2 import pytesseract from pdf2image import convert_from_path, convert_from_bytes from PyPDF2 import PdfFileWriter, PdfFileReader import uuid #image = cv2.imread('DoraBootsForever.png') text = None images = convert_from_path('data.pdf') for page in images: page.save('newout.jpg', 'JPEG') image = cv2.imread...
true
64120e0db4bd6afafec455b6b10f3bd3131d158b
Dzhan85/pyneng-online-may-aug-2019
/exercises/04_data_structures/task_4_6.py
UTF-8
1,176
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- ''' Задание 4.6 Обработать строку ospf_route и вывести информацию на стандартный поток вывода в виде: Protocol: OSPF Prefix: 10.0.24.0/24 AD/Metric: 110/41 Next-Hop: 10.0.13.3 Last update: 3d18h Outbound Interface FastEthernet0/...
true
4aba7c408274f176232b9b86a132b0c2ae41988c
ElenaVasyltseva/Beetroot-Homework
/lesson_12/task_2.py
UTF-8
6,795
3.96875
4
[]
no_license
# Task 2 # Library # Write a class structure that implements a library. Classes: # 1) Library - name, books = [], authors = [] # 2) Book - name, year, author (author must be an instance of Author class) # 3) Author - name, country, birthday, books = [] # Library class # Methods: # - new_book(name: str,...
true
3f43bdfc2959ea41eada25e5ef00a51d79342616
Deanwinger/python_project
/python_fundemental/174_Partition_Equal_Subset_Sum.py
UTF-8
635
3.296875
3
[]
no_license
# leetcode 416. Partition Equal Subset Sum (Medium) # 0-1 背包问题 class Solution: def canPartition(self, nums: List[int]) -> bool: s = sum(nums) if s%2 == 1: return False s = s//2 return self.get_sub(s, nums) def get_sub(self, s, nums): n = len...
true
433d0a07a5ab9093c29d38a6f26e135f75309b4e
Aasthaengg/IBMdataset
/Python_codes/p03457/s523848058.py
UTF-8
314
3.078125
3
[]
no_license
N = int(input()) locx = 0 locy =0 time = 0 for i in range(N): t,x,y = map(int,input().split()) time = t-time dis = abs(locx-x)+abs(locy-y) if (time-dis)<0 : print("No") exit() if (time-dis)%2 == 1: print("No") exit() time = t locx = x locy = y else : print("Yes")
true
3547235cbb92f36769b5bdeaa3d6aede7fae62b8
liuliainio/liuli
/tykj-operation/tykj-operation/MarketSearchCrawler/utils/jsonutils.py
UTF-8
713
2.921875
3
[]
no_license
#-*- coding: utf-8 -*- ''' Created on Nov 28, 2013 @author: gmliao ''' def find_attr(json_obj, attr_name, attr_type): attr_values = [] if isinstance(json_obj, dict): if attr_name in json_obj and isinstance(json_obj[attr_name], attr_type): attr_values.append(json_obj[attr_name]) fo...
true
08e577a84484ef6ba3614785ce914ca0b654a1d0
jacktok/Kinematics-problem-solving-guide-program
/wordcut/analyzeTextProblem.py
UTF-8
1,040
2.703125
3
[]
no_license
# from SearchWord import Dic # from wordCut import WordCut class AnalyzeText(Dic,WordCut): """docstring for AnalyzeText""" def __init__(self, Text): super(AnalyzeText, self).__init__() super(AnalyzeText,self).set(Text) self.Text = Text wordList=super(AnalyzeText,self).wordCut() words=[] for word in word...
true
4f29b6b85e7d1596280a53471440bb10087503ce
sofiahorenstein/Project-2
/petapi.py
UTF-8
706
2.96875
3
[]
no_license
import requests import json API_KEY = "n82rLvtiyqelro1uziEkHOjNpk1Iq9MF3r0OfSBDA6bQltSExj" SECRET = "0jr9tbtWMj362Oe3ha92r4tyLe5W05bmNoKYUjrI" def _get_bearer_token(): response=requests.post("https://api.petfinder.com/v2/oauth2/token", data={ 'grant_type': 'client_credentials', 'client_id': API_...
true
e55716e801338bdc942eecd1f71424aeddf93e99
jdanray/leetcode
/minExtraChar.py
UTF-8
543
3.203125
3
[]
no_license
# https://leetcode.com/problems/extra-characters-in-a-string/ class Solution(object): def minExtraChar(self, s, dictionary): N = len(s) dictionary = set(dictionary) memo = {} def dp(start): if start >= N: return 0 if start in memo: return memo[start] sub = '' extra = 0 res = float('...
true
e921b0a4952a5165f6b62a4404df543360cc2a60
VertexToEdge/othello-server
/src/util.py
UTF-8
478
2.65625
3
[]
no_license
import struct import json def serialize(msg): body = json.dumps(msg).encode() msg_len = struct.pack('>L', len(body)) return msg_len + body def deserialize(sock): _msg_len = sock.recv(4) if len(_msg_len) < 4: raise ConnectionResetError msg_len = struct.unpack('>L', _msg_len)[0] msg...
true
ea5189d68390beb9d66975214474d2f904fa6285
keegancsmith/advent
/2020/20/20.py
UTF-8
4,276
2.9375
3
[]
no_license
#!/usr/bin/env python3 import math from collections import defaultdict data = open('input').read() size = 0 tiles = {} for lines in data.split('\n\n'): lines = lines.split() num = int(lines[1].strip(':')) size = len(lines[2:]) tile = set() for r, row in enumerate(lines[2:]): for c, v in e...
true
ae16c5c83637367e3322470d3a42ac656a918a81
Dahieniu/dadiaowuqing
/训练代码.py
UTF-8
3,808
2.671875
3
[]
no_license
from time import time from sklearn.datasets import load_files from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.naive_bayes import BernoulliNB from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix import...
true
f0f13c417fa236a2159facb4bdbdd45f1b9e6e50
martinkondra/EntregaEci2019
/load_data.py
UTF-8
3,290
2.65625
3
[]
no_license
# _*_ coding: utf-8 _*_ import os import sys import torch from torch.nn import functional as F import numpy as np import torchtext from torchtext import data from torchtext import datasets from torchtext.vocab import Vectors, GloVe, FastText import logging from nltk.tokenize import word_tokenize LOGGER = logging.getL...
true
96889224ad8ce1a02a5c339eda2531b84bb079e1
hemal-shah/CLRS
/sorting_algorithms/counting_sort/counting_sort.py
UTF-8
1,102
3.796875
4
[]
no_license
# First reading the data. fileObject = open("input.txt", "r+") data = fileObject.read() # Close the file. fileObject.close() A = list(map(int, data.split("\n"))) B = [None] * len(A) def print_array(arr, start, end): """ A helper method to print any provided list from start to end. :param arr: array to p...
true
bc5b2e5325fe3df0f9cd553699475f49ac161e6a
chenjian158978/chenjian.github.io
/download/Deploy-Kafka-And-ZP-With-K8s/whilerun.py
UTF-8
257
2.546875
3
[ "Apache-2.0" ]
permissive
# -*- coding:utf8 -*- """ @author: chenjian158978@gmail.com @date: Thu, Apr 20 2017 @time: 15:20:08 GMT+8 """ import time from datetime import datetime def main(): while 1: print datetime.now() time.sleep(60) if __name__ == '__main__': main()
true
6ddb4702f7bfd71c1b49abba23d14da23ba1395f
cznccsjd/StudySe
/WebdriverAPI/alert.py
UTF-8
562
3.59375
4
[]
no_license
#coding:utf-8 ''' 本节重点: text 返回alert/confirm/prompt的文字信息 accept 点击确认按钮 dismiss 点击取消按钮,如果有的话 send_keys 输入值,这个alert\confirm没有对话框就不能用,不然报错 ''' #用法举例: #接受警告信息 alert = driver.switch_to_alert() alert.accept() #得到文本信息打印 alert = driver.switch_to_alert() print alert.text() #取消对话框(如果有的话) alert = driver.switch_to_alert() aler...
true
4dc8944167c745341001f5e7b496fa48cf39536c
saadsaifse/3d-visualization
/src/spaceTimeCube.py
UTF-8
1,502
2.796875
3
[ "MIT" ]
permissive
import sys, os, ogr import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from datetime import datetime currentFilePath = sys.argv[0] currentFileDir = os.path.dirname(currentFilePath) gpxPath = os.path.join(currentFileDir, '..', 'data', 'muenster.gpx') absGpxPath = os.path.abspath(gpxPath) print("G...
true
20791737a22ae262b89e2d285040c950a10db011
ragebiswas/algorepo
/euler/prob11.py
UTF-8
1,085
3.359375
3
[]
no_license
def up(n, i, j): return n[i][j] * n[i-1][j] * n[i-2][j] * n[i-3][j] def down(n, i, j): return n[i][j] * n[i+1][j] * n[i+2][j] * n[i+3][j] def left(n, i, j): return n[i][j] * n[i][j-1] * n[i][j-2] * n[i][j-3] def right(n, i, j): return n[i][j] * n[i][j+1] * n[i][j+2] * n[i][j+3] ...
true
78a0a11b43e995f680466788ffc5d5fd04395391
xxcodingmasterxx/codingschool
/Homework_average.py
UTF-8
76
3.453125
3
[]
no_license
def average(x, y): result = (x + y) / 2 print(result) average(-18, 18)
true
b0fa4a28ba34c2fc2667e05ffb71927467c6aff0
emreozb/PY4E
/3-Using Python to Access Web Data/GetDATA-UsingHTML-BeautifulSoup2.py
UTF-8
552
3.21875
3
[]
no_license
from urllib.request import urlopen from bs4 import BeautifulSoup import ssl # Ignoring SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE # Asking user to input the URL url = input('Enter - ') html = urlopen(url, context=ctx).read() # Creating an or...
true
7e068821b73620a19d21237b9b6c4cd1754710a8
akaliutau/cs-problems-python
/problems/dfs/Solution394.py
UTF-8
162
2.609375
3
[ "MIT" ]
permissive
""" Stack, DFS Input: s = "3[a]2[bc]" Output: "aaabcbc" IDEA: identify recursive (repetitive) actions """ class Solution394: pass
true
b467a3ea4b5bf1b687770b7f15c212bbf496b948
hsj562/2019Fall-MLF
/solutions/hw3/prob8.py
UTF-8
2,591
3.0625
3
[]
no_license
import numpy as np import math import random as rd import matplotlib.pyplot as plt N = 0 test_N = 0 r = 0 #gd_Ein_list = [] gd_Eout_list = [] #sgd_Ein_list = [] sgd_Eout_list = [] time_list = [] def readTrainData(): global N x = [] y = [] f = open('hw3_train.dat', 'r') for line in f.readlines(): ...
true
17715033ab6ef3db602e70ef07900be85d38f32d
pumbaacave/atcoder
/Line/LRU.py
UTF-8
996
3.359375
3
[]
no_license
from collections import OrderedDict class LRUCache(OrderedDict): def get(self, key): if key not in self: raise KeyError else: val = self[key] self.move_to_end(key) return val def add(self, key, value): if key in self: self.move_to_end(key) # add or fresh the key value ...
true
04dc223f3be6990b3877930bf8a3ad1e28751690
krischer/frankenflow
/frankenflow/tasks/task.py
UTF-8
9,793
2.5625
3
[ "BSD-3-Clause" ]
permissive
import abc import datetime import functools import glob import os import shutil import socket import subprocess import time import paramiko class TaskCheckFailed(Exception): pass class TaskFailedPreStagingCheck(Exception): pass class retry(): """ Decorator that will keep retrying the operation af...
true
67a06c6eb9ba817c83ec92cab2fe426ce2431f6b
stamplong/pygitrepository
/E45.py
UTF-8
2,785
3.203125
3
[]
no_license
import random human_bag = {'rope':1,'goldcoin':47,'dagger':1,'arrow':1} ATK1 = human_bag.get("rope") + human_bag.get("dagger") + human_bag.get("arrow") global human_ATK global goldcoin global Red Red = 500 human_ATK = ATK1 + 100 goldcoin = 100 print "between human and dragon fight" print "human of ATK" name = raw_inp...
true
50439e7b4bfc562f2626ba80a4aa4542af93031f
niloysh/optimization
/cvxpy_solvers.py
UTF-8
613
3.40625
3
[ "MIT" ]
permissive
""" Run this example to check if cvxpy is working properly with external solvers such as CVXOPT and Gurobi""" import cvxpy as cp import numpy as np # Problem data. m = 30 n = 20 np.random.seed(1) A = np.random.randn(m, n) b = np.random.randn(m) # Construct the problem. x = cp.Variable(n) objective = cp.Minimize(cp....
true
a83cbdf46866ae0f2cb13e02b32268cdb86c9802
angolpow/gbhw
/Python/06/Task2.py
UTF-8
1,171
4
4
[]
no_license
""" 2. Реализовать класс Road (дорога), в котором определить атрибуты: length (длина), width (ширина). Значения данных атрибутов должны передаваться при создании экземпляра класса. Атрибуты сделать защищенными. Определить метод расчета массы асфальта, необходимого для покрытия всего дорожного полотна. Использовать форм...
true
2e6cad259f6d6a599315a627122a60e9cc8bb16b
zolatsai/opencv
/test6.py
UTF-8
1,402
2.6875
3
[]
no_license
import cv2 import numpy as np #Import only if not previously imported #import cv2 # In VideoCapture object either Pass address of your Video file # Or If the input is the camera, pass 0 instead of the video file cap = cv2.VideoCapture(0) if cap.isOpened() == False: print("Error in opening video stream or file") whi...
true
9ae18240a0f9f37a27b2fb225347eff054b1de8b
EvsWorld/JournalPhotos
/Journal_Main.py
UTF-8
3,805
2.9375
3
[]
no_license
from subprocess import check_output, call, list2cmdline import glob, shutil, os, errno, time # location = (some piece fo shit python module that converts city input to coordinates) # scriptPath is the current location of this .py file scriptPath = os.path.dirname(os.path.realpath(__file__)) # scriptPath = #Create a...
true
a0150e4b4a3846a20efadd04a7556c99afd719f5
dimpusagar91/python_tutorials
/6_classes_objectoriented/demo4.py
UTF-8
255
3.703125
4
[]
no_license
class Robot: def SayHello(self): print("Hello, I'm " + self.name) def SetName(self, name): self.name = name # print(name) if __name__ == "__main__": x = Robot() x.SetName("Python") x.SayHello()
true
946c217f00763cee62501c40b76a6863a3e831bf
RobertWilbrandt/bk5120
/bk5120/sdo.py
UTF-8
3,194
2.78125
3
[ "BSD-3-Clause" ]
permissive
"""Implementation of the sdo console command""" import argparse import inspect import cmd2 from .util import format_object_entry, int_with_radix, parse_object_entry @cmd2.with_default_category("DS301") class SdoCmd(cmd2.CommandSet): """Implementation of the sdo console command """ def __init__(self, no...
true
08a156a3320c986f3facdab7ddd23d7d12cdc391
rob-knight/qiime
/scripts/distance_matrix_from_mapping.py
UTF-8
5,135
2.734375
3
[]
no_license
#!/usr/bin/env python # File created on 23 Jul 2011 # based on beta_diversity.py from __future__ import division __author__ = "Antonio Gonzalez Pena" __copyright__ = "Copyright 2011, The QIIME Project" __credits__ = ["Antonio Gonzalez Pena", "Andrew J. King"] __license__ = "GPL" __version__ = "1.8.0-dev" __maintainer_...
true
1a130b1b9031eb227ee204e2268626b8379a7de0
The-CJ/PhaazeDB
/functions/update.py
UTF-8
5,992
2.53125
3
[ "MIT" ]
permissive
from typing import TYPE_CHECKING if TYPE_CHECKING: from utils.database import Database as PhaazeDatabase import json, math from utils.errors import MissingOfField, InvalidLimit, MissingUpdateContent, SysLoadError, ContainerNotFound, InvalidUpdateExec, SysStoreError from aiohttp.web import Request, Response from utils...
true
362c58a6d543a0d580f3d5ba174f9c2d3a998fe5
Bitterlin/easy_absence_scheduling_App
/funktionen/edit_mitarbeiter.py
UTF-8
6,709
2.625
3
[ "CC0-1.0" ]
permissive
import tkinter as tk from tkinter import messagebox from tkinter.font import Font from tkinter import ttk from tkcalendar import Calendar, DateEntry import sys import time import datetime from datetime import date from datetime import datetime import locale import sqlite3 import getpass #### Hilfe / Vorlagen | heute...
true
3aafacd2c3e9f63889114636ae310d1c6ca37f74
vijaymaddukuri/python_repo
/training/rotateArray.py
UTF-8
122
3.5
4
[]
no_license
n=[1,2,3,4,5,6,7] k=3 def rotateArray(n, k): new=n[k:]+n[:k] return new newArray=rotateArray(n,k) print(newArray)
true
909cb8d4f7923ae01d06887e3decf9d7452a441d
jsoltys88/stores-rest-api-test
/tests/base_test.py
UTF-8
1,138
2.859375
3
[]
no_license
""" Base Test This should be the parent class to each non-unit test/ It allows for instantiation of the database dynamically and makes sure that it is a new, blank database each time. """ from unittest import TestCase from app import app from db import db class BaseTest(TestCase): @classmethod def setUpCla...
true
ed77de6ea048237660be1378f7960ee907af6f5c
thsis/NIS18
/models/lda.py
UTF-8
4,463
3.359375
3
[ "MIT" ]
permissive
import numpy as np from algorithms import eigen from matplotlib import pyplot as plt class LDA(object): """ Define class for Linear Discriminant Analysis of a rank 2 array of data. LDA: Attributes: - data: - generalized eigenvectors: - generalized eigenvalues: - rotate...
true
c48b3e47b35357217848b6c58bb05560c2e12258
dan-trappolini/ADVANCE-MACHINE-LEARNING
/HW 1/Identification/match_module.py
UTF-8
4,016
3.328125
3
[]
no_license
import numpy as np from PIL import Image import matplotlib.pyplot as plt import histogram_module import dist_module def rgb2gray(rgb): r, g, b = rgb[:,:,0], rgb[:,:,1], rgb[:,:,2] gray = 0.2989 * r + 0.5870 * g + 0.1140 * b return gray # model_images - list of file names of model images # query_images...
true
8a0dae3f37b5979b67957e5a9bd5cc9b2e2f1389
The-Nature-Conservancy-NASCA/InVEST_RIOS_WaterFunds
/Dummy-RIOS-InVEST/FUNCTIONS/RIOS_Toolbox/rios_build_scenario_lulc.py
UTF-8
2,037
2.671875
3
[]
no_license
"""This module creates an LULC map given an existing LULC map and some information about the landcover transitions and activities""" import logging from osgeo import gdal from invest_natcap import raster_utils LOGGER = logging.getLogger('rios_build_scenarion_lulc') def execute(args): """This function create...
true
9b5c52b29537ac91a8f43e8bbd5e9573c439fd76
gabriellasaro/arquead-py
/arquead/database.py
UTF-8
1,630
2.796875
3
[ "MIT" ]
permissive
from os import mkdir, listdir from os.path import isdir, normpath, exists, join from arquead.collection import Collection from arquead.error import Error from arquead.info import Version class Database: def __init__(self, path): self.__path = normpath(path) def is_arquead(self): if type(s...
true
7fae769d3db2c1756db813f4364676fa8adb37f0
IntroProgramacion-P-Oct20-Feb21/trabajofinal-1bim-JamilErasmo
/semana 6/ejercicios-clase-06-1bim-JamilErasmo/ejemplos-while/Ejemplo06.py
UTF-8
387
3.765625
4
[]
no_license
suma_total = float(0) bandera = True print("Ingrese las notas de los estudiantes de su materia") while (bandera): calificacion = float(input("Ingrese calificacion: ")) suma_total = suma_total + calificacion temporal = int(input("Ingrese el valor -1 para salir del ciclo: ")) if temporal == -1: ba...
true
c1ee48a4de4c8bad9bec14fd08f025a6f629b58b
CharlesChiang1120/Leetcode
/Medium/Ugly-Number-II/Ugly-Number-II.py
UTF-8
604
2.953125
3
[]
no_license
class Solution: def nthUglyNumber(self, N: int) -> int: cache = [None] * (N+1) cache[1] = 1 min2i = min3i = min5i = 1 for n in range(2, N+1): minNumber2 = cache[min2i] * 2 minNumber3 = cache[min3i] * 3 minNumber5 = cache[min5i] * 5 ...
true
1e29e656107b2b5b9f3e7c696981fcd47827c344
woodj22/recipe-api
/tests/Integration/test_memory_store.py
UTF-8
4,062
3
3
[]
no_license
import csv import os from database.filetypes import csv_loader import pytest from database.mem_table import MemTable @pytest.fixture def create_test_file(): test_csv_file_path = 'test.csv' def _create_test_file(field_names, list_of_rows): with open(test_csv_file_path, 'w', newline='') as csvfile: ...
true
cbe45e158beb95426726750d8236dca37d17b25d
leonardohcl/Genetic-and-Evolutive-Algorithms
/InputMethods.py
UTF-8
2,399
3.359375
3
[ "MIT" ]
permissive
def readFloat(msg): while True: try: value = float(input(msg)) return value except: print('Valor invalido!') def readFloatInterval(msg, start, end): if end < start: raise Exception("Interval start must be smaller than the end") while True: try: value = float(input(msg)) if value < start or va...
true