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 |
|---|---|---|---|---|---|---|---|---|---|---|
cf0c5b4f1cbfaafa1fc94a3eac88285feeb59d7a | claraj/ProgrammingLogic1150Examples | /4_loops/stop_loop_break_password_count_attempts.py | UTF-8 | 886 | 4.25 | 4 | [] | no_license | """
Enter password. Stop loop using break if password is correct
User is only allowed 4 attempts to get the password right.
"""
secret_password = 'kittens'
attempts = 0 # use this variable to count the number of attempts
while True:
password = input('Please enter the password: ')
attempts = attempts + 1 # a... | true |
e1ad7b2e4fdd799c395d7d3db7e1f54ba222668d | Kritikaag/python-challenge | /pypoll/main.py | UTF-8 | 1,266 | 3.1875 | 3 | [] | no_license | #Module for reading CSV files
import os
# Module for reading CSV files
import csv
import sys
csvpath = os.path.join('.', 'election_data.csv')
voterid_number_list = []
candidate_list = set()
max_count = 0
with open(csvpath) as csvfile:
# CSV reader specifies delimiter and variable that holds contents
... | true |
96f385b187a4071236f8ab4cb8a6f3075040156a | kykrueger/openbis | /screening/sinergia/sinergia-dropbox.py | UTF-8 | 10,943 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #! /usr/bin/env python
"""
The implementation of the Sinergia dropbox.
Sinergia data is uploaded in a format where many files are provided in a single folder containing images and a metadata file (with the ".nd" extension). The dropbox implementation takes this format, extracts metadata and converts the file str... | true |
a06f9a544f7cc428ea6f8dd43ad844277d8d83f0 | yyyyyn/PyStudyNote | /python学习手册/07异常/02细节/练习2.py | UTF-8 | 603 | 3.21875 | 3 | [] | no_license | class TraceBlock:
def message(self,arg):
print('running',arg)
def __enter__(self):
print('starting with blockk')
return self
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type is None:
print('exited normally\n')
else:
print('raise an ex... | true |
5f3013d1f1e24f8ba463145d024576dd435ffda4 | fredfgb/pyimagesearch-lesson1.4.3 | /resize.py | UTF-8 | 3,223 | 3.75 | 4 | [] | no_license | # import the necessary packages
import argparse
import imutils
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="Path to the image")
args = vars(ap.parse_args())
# load the image and show it
image = cv2.imread(args... | true |
3066149770c7dfc58d2d23dbdc5be48f1cd98d72 | griffinstiens/password-checker | /main.py | UTF-8 | 1,988 | 3.65625 | 4 | [] | no_license | import requests
import hashlib
import sys
# Making the GET request to the API and returning a runtime error if the HTTP response isn't 200 - This might not be great practice?
def data_request(query):
url = 'https://api.pwnedpasswords.com/range/' + query
res = requests.get(url)
if res.status_code != 200:
... | true |
2e1d9aee22c040bf9ff07c13a52d766928bc33d5 | kajal1122/updates-project | /app.py | UTF-8 | 1,416 | 2.546875 | 3 | [] | no_license | from flask import Flask,render_template,request
import json
import feedparser
import urllib.parse,urllib.request
app=Flask(__name__)
FEED_URLS ={"whowhatwear":"http://feeds.bbci.co.uk/news/rss.xml",
"fm":"https://fashionmagazine.com/feed/",
"gqmen":"https://www.gq.com/feed/style/rss"}
@app.r... | true |
486717dfcab15f27f8092efa75537967e020d57c | guoyanannan/High-resolution-target-detection | /GQLianzhu/Predict/TOOLS/HkjTool/H_SplitImgSets.py | UTF-8 | 1,677 | 2.703125 | 3 | [] | no_license | import os
import shutil
import random
path=r"I:\ImageSampleSets\RZ_ImgSets_Total"
def Split_Validation_Train(path):
total_path=os.path.join(path,"data")
train_path=os.path.join(path,"train")
validation_path=os.path.join(path,"validation")
for sub_dir in os.listdir(total_path):
total_sub_pat... | true |
4a990d40c7a5993be5453a6e77376e2925badba7 | Afeezmahmud1/my_pyneng | /thread_backup.py | UTF-8 | 4,744 | 2.5625 | 3 | [] | no_license | from pprint import pprint
from netmiko import (ConnectHandler,NetmikoTimeoutException,NetmikoAuthenticationException)
from paramiko.ssh_exception import SSHException
import yaml
import stdiomask
from datetime import datetime
import logging
from concurrent.futures import ThreadPoolExecutor,as_completed
def Raise_Value_E... | true |
c8b8e5da38c4422bd6f90bf00dacbd7d68687423 | Desolve/LeetCode | /1342 Number of Steps to Reduce a Number to Zero.py | UTF-8 | 598 | 3.1875 | 3 | [] | no_license | class Solution:
def numberOfSteps (self, num: int) -> int:
return bin(num).count('1') + len(bin(num)) - 3
'''
# another solution
class Solution:
def numberOfSteps (self, num: int) -> int:
res = 0
while num != 0:
res += (num & 1) + 1
num >>= 1
return res - ... | true |
48aae0a05e11dc684e60057f14328edbc6d92a73 | connordlee/data-533-lab-3-Akash-and-Connor | /club/fan/fantype.py | UTF-8 | 1,839 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
'''Module: Domestic (Inherits Fan Properties)
Attributes:
hasSeasonTickets
Functions:
Initialize Domestic Fan
updateTicketStatus
Module: International (Inherits Fan Properties)
Attributes:
Home Country
Functions:
Initialize Domestic Fan
'''
from club.fan.fan im... | true |
cefa206f649544e20bee97b24fbd3d2b46594bcb | CodingDojoOnline-Nov2016/GailD | /Wishlist/apps/myLoginReg/models.py | UTF-8 | 2,086 | 2.515625 | 3 | [] | no_license | from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Count
import bcrypt
#EMAIL_REGEX = re.compile(r'^[a-zA-Z0-9\.\+_-]+@[a-zA-Z0-9\._-]+\.[a-zA-Z]*$')
# Create your models here.
class UserManager(models.Manager):
de... | true |
4a5ea03209e1c3eab49f269b190739d2b5289325 | BonifazStuhr/OFM | /main.py | UTF-8 | 4,683 | 2.5625 | 3 | [
"MIT"
] | permissive | #Copyright (c) <year> <copyright holders>
#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, merge, publish, dis... | true |
583b24afa4eb8ba65c5818b7fcacbfa026381989 | Mesheo/U.R.I-python | /URI - 1407 Loteria de Fim de semana #5%DEerro.py | UTF-8 | 756 | 2.875 | 3 | [] | no_license | def numApareceMenosVzs(qtdVzs_cada_num, valores, numero_max):
for numero in range(1,numero_max+1):
if valores.count(numero) == min(qtdVzs_cada_num):
print(numero, end=' ')
print()
# PP
qtd_de_cartelas, qtd_numeros, numero_max = list(map(int,input().split()))
while qtd_de_cartelas != 0 ... | true |
90fd08b1d4aca5a42c8a03075d98d60ee2291ab5 | beidou9313/deeptest | /第一期/广州-Roger/task3/input&output.py | UTF-8 | 686 | 3.453125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-01-23 14:47:44
# @Author : Roger TX (425144880@qq.com)
# @Link : https://github.com/paotong999
# @Version : $Id$
import os
a='1/7\n'
s=repr(a)
print(a)
print(s)
'''
for x in range(1, 11):
print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')
... | true |
9a30e4d6317d48f3e458e16e3759f525e20f7a38 | simplybuilt007/YoutubeDownloader | /YoutubeDownloader.py | UTF-8 | 466 | 2.828125 | 3 | [] | no_license | from pytube import YouTube
#res_itag_dict = {'360p': '18', '240p': '133', '144p': '160', '720p': '247'} #itag values according to respective resolutions
dlink = input("Enter the Youtube Video Link: ")
#res = input("Enter the resolution you want to download in(Ex: 144p,240p,360p,720p): ")
yt = YouTube(dlink)
... | true |
ec699f9149729269d37dc968d2e2c6419a32333f | phpwaves/python_ds | /selection_sort.py | UTF-8 | 609 | 3.953125 | 4 | [] | no_license | def selection_sort(arr):
'''
selection sort :
Requires (n-1) passes to sort n items
For each pass max/min in proper position ans starts checking for the remaining items
'''
for slot in range(len(arr)-1, 0, -1):
maxIndex = 0
for location in range(1, slot+1):
... | true |
d051b4876d5ed28efdd860798f07fb4221b65835 | Dsoeung/CourseWork | /SystemsProgramming/Review/tokenmath.py | UTF-8 | 503 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python3
#PYTHON#
import sys
import re
#sample input
#3 2 3 4 5 6
#5 24 4 23 56
#taken from standard input stdin
#Take #'s from std int ,first one is a position, tokenize strings and add #'s at position then take average.
sum = 0
numlines = 0 #we're averaging values
for lines in sys.stdin:
tokens = li... | true |
3f2cd748bf17ff90383af3fd40f9eb6f24a12495 | rspiolirf/montana-controle-estoque | /flask-backend/repositorio_insumo_excel.py | UTF-8 | 3,721 | 3.015625 | 3 | [] | no_license | import config
import openpyxl
import sys
from pathlib import Path
from insumo import Insumo
class RepositorioInsumo:
def __init__(self):
self.LINHA_INICIAL_DADOS = 2
self.workbook = None
self.insumos = self.__Inicializar()
def ObterTodos(self):
return self.insumos
def ... | true |
45182d8f4cb4ba193482e96183e19c9409c02269 | hanwenlin/matplotlib_items | /matplotlibs_items/plot_tutorial/plt008_logarithmic.py | UTF-8 | 902 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf-8 -*-
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
import numpy as np
np.random.seed(19680801)
y = np.random.normal(loc=0.5, scale=0.4, size=1000)
y = y[(y>0)&(y<1)]
y.sort()
x = np.arange(len(y))
plt.figure()
plt.subplot(221)
plt.... | true |
6d7f705ffb2bd3cb8953be583c4d54a71266ee9a | GMLC-1-4-2/battery_interface | /src/fleet_interface.py | UTF-8 | 2,631 | 3.078125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*- {{{
#
# Your license here
# }}}
from fleet_response import FleetResponse
class FleetInterface:
"""
This class is base class for all fleets
"""
def __init__(self, *args, **kwargs):
"""
Constructor
"""
# It represents the percentage of devices wi... | true |
e0757c0fa222754c97ce05c8a793b879fc091841 | GT-2016/grunt-buddha-gt2016 | /dj_project/login/DJ_login.py | UTF-8 | 719 | 2.546875 | 3 | [] | no_license | # coding:utf-8
import requests
class DJLogin(object):
"""
Django 制作登录页面测试web请求
"""
def __init__(self, url):
'''初始化函数,传入参数 url'''
self.url = url
def get_url(self):
'''get 方法'''
dj = requests.get(self.url)
return dj
def post_url(self):
... | true |
e7cefec1f201421fc35df8d87bd48d662182e492 | miajackson/pod_4_repo | /Lavonte_Carter/nba_challenge.py | UTF-8 | 8,206 | 3.828125 | 4 | [] | no_license | print("Challenge 2.1:")
jamal_murray_3pts_made = 46
fred_vanvleet_3pts_made = 43
james_harden_3pts_made = 37
# TODO: Create variable here for number of 3 pt shots made by Fred VanVleet
# TODO: Create variable here for number of 3 pt shots made by James Harden
print("Challenge 2.2:")
print(f"In the 2020 NBA playoffs, ... | true |
e35dfc5b23e833ca12eb17477cdc55799b2c1d51 | Danielkhakbaz/Python-Fundamental | /Solving Problems Practices/app9.py | UTF-8 | 281 | 3.75 | 4 | [] | no_license | import collections
words = []
sentence = input("Enter the sentence: ").lower()
words = sentence.split(" ")
counter = collections.Counter(words)
for index, value in enumerate(counter):
print(
f"{counter.most_common()[index][0]}: {counter.most_common()[index][1]}")
| true |
f9613ddf2190c6b575edb1cc4ca4c20dca045d2b | htihle/IM_inference | /src/MapObj.py | UTF-8 | 3,962 | 2.53125 | 3 | [] | no_license | import numpy as np
from astropy.cosmology import FlatLambdaCDM
from astropy import units as u
class MapObj:
"""
Class for the map-objects which carry the info about the maps and
also the maps themselves.
"""
def __init__(self, exp_params):
self.exp_params = exp_params
self.cosmo = ... | true |
f0f7b69feff76359769821265dd1152df8f926fa | kafku/maeshori | /nlp_utils.py | UTF-8 | 1,231 | 2.953125 | 3 | [] | no_license | # coding: utf-8
from collections import defaultdict, Counter
from nltk.tokenize import word_tokenize
def create_word_dict(text,
tokenizer=word_tokenize,
idx_start_from=0,
max_vocab_size=30000,
at_least=5,
mandator... | true |
12eb7bb0a8837d8eb835b467d00ecf75e4782149 | ZwEin27/Coding-Training | /LeetCode/python/lc074.py | UTF-8 | 1,734 | 3.625 | 4 | [] | no_license | class Solution(object):
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
start = 0
end = len(matrix) - 1
return self.searchRow(matrix, 0, len(matrix) - 1, target)
def searchRow(self, mat... | true |
393c0f569219415500bfe174884909740fee302a | Tobiaswei/ECE422 | /Crypto/sol_3.2.3.py | UTF-8 | 2,127 | 2.75 | 3 | [] | no_license | import urllib2
url="http://72.36.89.198:8081/mp3/yuguang2/?"
def get_status(u):
req=urllib2.Request(u)
try:
f=urllib2.urlopen(req)
return f.code
except urllib2.HTTPError,e:
return e.code
# valid padding
def crack_block(y,b):
# Find the last oracle element
#r=[0xff]*16
... | true |
a122ccac2d46030e87452de17a73af5c822f4bf3 | Tahmed1653/PythonBasic | /Python Works/Day 5/ListExample.py | UTF-8 | 1,616 | 3.90625 | 4 | [] | no_license |
Motorcycles=['Honda','Yamaha','Suzuki']
print(Motorcycles)
print(Motorcycles[0])
print(Motorcycles[1])
print(Motorcycles[2])
#Change Data
Motorcycles[1]= 'Ducati'
print(Motorcycles)
fruits=[]
fruits.append('Mango')
fruits.append('Banana')
fruits.append('Orange')
fruits.insert(1, 'Apple')
fruits.... | true |
a9be95115c1747c49803f1b9ef80a90855657e73 | XiaohuiLee/PythonInActions | /Chapter6/code/model.py | UTF-8 | 3,506 | 2.703125 | 3 | [] | no_license | #%%
import pandas as pd
import numpy as np
import os
outputfile = os.getcwd() + "\\Chapter6\\output"
from scipy.interpolate import lagrange
inputData = "Chapter6/data/model.xls"
data = pd.read_excel(inputData)
print(data.head())
#%%
from sklearn.model_selection import train_test_split
train_col = data.columns[:-1]
t... | true |
4724acadc22fed4801330a23b3851fd883c4a845 | jreiher2003/Data-Wrangling-with-MongoDB | /Working with MongoDB/range_queries.py | UTF-8 | 791 | 2.875 | 3 | [] | no_license | from pymongo import MongoClient
from pprint import pprint
from datetime import datetime
client = MongoClient("mongodb://localhost:27017")
db = client.uda
def find():
# returns pop between 250k and 500k
# query = {"populationTotal": {"$gt": 250000, "$lte": 500000}}
# returns all city names that start with the let... | true |
500df949e5934de0821f41babe12a9b982102e63 | veeresh577/openCV | /opening and saving image.py | UTF-8 | 291 | 2.734375 | 3 | [] | no_license | import cv2
img = cv2.imread('buffer_place/images.jpg')
img = cv2.resize(img,(0,0),img,4,4) # resizing the image
while True:
cv2.imshow("Naruto",img)
if cv2.waitKey(1) & 0xFF == 27 : # waiting for i msec and closeing the image by Esc button
break
cv2.destroyAllWindows()
| true |
d2fbc5321d4c456f5032b98b1ba989f4d03e498a | liugingko/LeetCode-Python | /LeetCode_cn2/77. 组合.py | UTF-8 | 348 | 2.578125 | 3 | [] | no_license |
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
res = []
def dfs(i, tmp):
if len(tmp) == k:
res.append(tmp)
return
for j in range(i, n+1):
dfs(j+1, tmp+[j])
dfs(1, [])
return res
if __na... | true |
06cdec004d0ec1be2d9484df1994e9284522169a | kinhosz/Bia | /src/Bia/bits/queue.py | UTF-8 | 1,588 | 3.6875 | 4 | [
"MIT"
] | permissive | from threading import Lock
import warnings
class Node():
def __init__(self, data):
self.__next = None
self.__data = data
def get(self):
return self.__data
def getNext(self):
return self.__next
def setNext(self, next):
self.__next = next
class Queue():
... | true |
9069f9fce887ac3967179e62e4f1a516bb8b7c2d | aaronjau101/project-euler-answers | /problem13.py | UTF-8 | 658 | 3.21875 | 3 | [] | no_license | import csv, math
grid = []
with open('problem13file.txt') as csv_file:
csv_reader = csv.reader(csv_file)
for row in csv_reader:
grid.append(row)
numberSize = 50
tally = [];
index = 0;
carry = 0;
total = 0;
while index < numberSize or carry != 0:
if index < numberSize:
fo... | true |
7b6ed7eca460348aafdcd31de33441a15c088840 | WenyueHu/python | /进程与线程/01-继承Process创建进程.py | UTF-8 | 231 | 2.828125 | 3 | [] | no_license |
from multiprocessing import Process
import time
class MyNewProcess(Process):
def run(self):
while True:
print("---test---")
time.sleep(1)
p = MyNewProcess()
p.start()
while True:
print("---main---")
time.sleep(1)
| true |
6458fb8d2220f33b38bab816e5d316548d9eac7c | davidlares/arp-spoofing | /spoofer.py | UTF-8 | 1,724 | 2.9375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import scapy.all as scapy
def restore_defaults(dest, source):
# getting the real MACs
target_mac = get_mac(dest) # 1st (router), then (windows)
source_mac = get_mac(source)
# creating the packet
packet = scapy.ARP(op=2, pdst=dest, hwdst=target_mac, psrc=source, hwsrc=source_mac)
... | true |
dd0592445de088ae0084fc118b6e9e8eacf6a176 | lyuka/data_structure_and_algorithm_using_python | /myclinklist.py | UTF-8 | 2,478 | 3.484375 | 3 | [] | no_license | class CListNode:
def __init__( self, data ):
self.data = data
self.next = None
def traverse( listRef ):
curNode = listRef
done = listRef is None
while not done:
curNode = curNode.next
print curNode.data,
done = curNode is listRef
print ''
def searchCircularL... | true |
fb44c3fddfc3eb5a06ff2142ef12f533c04a9ca9 | bslaff/aoc2019 | /02/02a_opcodes.py | UTF-8 | 1,039 | 3.15625 | 3 | [] | no_license | import numpy as np
import argparse
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("infile", type=str, help="Path to the input file")
return parser.parse_args()
def get_prog(args):
f = open(args.infile, 'r')
prog = f.readlines()
f.close()
prog = "".join(prog)
... | true |
10fbf681430a769e85099e87524ee2a7da4c063b | diarmuidr3d/advent-of-code-2018 | /8a.py | UTF-8 | 1,114 | 3.53125 | 4 | [] | no_license | from functools import reduce
# Used to implement the tree datastructure
class Node:
def __init__(self):
self.children = []
self.metadata = []
def add_child(self, child):
self.children.append(child)
def add_metadata(self, value: int):
self.metadata.append(value)
... | true |
312d18aa04ce2441769c04fa37f9739e7e3f4639 | reXne/SA-convlstm | /convlstm_attention_hnver1.py | UTF-8 | 10,072 | 2.640625 | 3 | [] | no_license | import torch
import numpy as np
import pandas as pd
from dataset_preprocessing import data_loading_for_years, torch_data
from glob import glob
from tqdm import tqdm
from torch import optim
import torch.nn as nn
#from feature_loss import SSIM
#문제 정의 : 12 to 12 : 12주 보고 12주 예측
class self_attention(nn.Module): #se... | true |
fac77f07a0369aaa28ef3b9ce0a6d99223c55c7b | biettodev/Game-Project-Manager | /micro/view/interface.py | UTF-8 | 1,533 | 3.921875 | 4 | [
"MIT"
] | permissive | ##################################
# INTERFACE SETTINGS FOR DESKTOP #
##################################
# Int input validations function
def readInt(msg):
while True:
try:
print()
valor = int(input(msg))
except (TypeError, ValueError):
print('ERRO! Digite um núm... | true |
eb33e5228fc6487aedb478227fcde01fe43a2f93 | ElAwbery/Python-Practice | /Decorators/decorator_boilerplates.py | UTF-8 | 5,013 | 3.765625 | 4 | [] | no_license | # RealPython.com has excellent training resources on decorators
# https://realpython.com/primer-on-python-decorators/
import functools
import time
import random
# Basic pattern, easy to build on
def decorator(func):
@functools.wraps(func)
def wrapper_decorator(*args, **kwargs):
# Do something before
... | true |
da06e061a3296b97c1b5409e6b4996818ef6b173 | danzimmerman/n3ox_utils | /n3ox_utils/pynec_helpers.py | UTF-8 | 29,607 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# NEC-2 Card/Code References
# Here are some references I'm consulting while working with PyNEC. I haven't done NEC decks before, only EZNEC, so I'm learning as I go.
# http://www.antentop.org/w4rnl.001/necdeck.html
# https://www.nec2.org/part_3/cards/
# http://tmolteno.github.io/necpp/classne... | true |
7717bc3b19593439c10d1d5328ed4b0935ed1e9e | hujianli94/Python-code | /7.迭代器、生成器、装饰器/itertools模块中常用的工具函数.py | UTF-8 | 991 | 3.765625 | 4 | [] | no_license | #!/usr/bin/env python
#-*- coding:utf8 -*-
import itertools
for i in itertools.count(1,3):
#从1开始,步长为3
print(i)
if i >= 10:
break
print("".center(100,"="))
print()
x = 0
for i in itertools.cycle(['a','b']):
#无限循环seq
print(i)
x += 1
if x >= 6:
break
print()
print(list(iterto... | true |
8c464d0310ef74ca8a87c3d03f64d0157ef776b1 | vaduraes/OceanProject-2019-2020 | /Data_Wind/WindCFGeoPlot.py | UTF-8 | 1,151 | 2.640625 | 3 | [] | no_license | #Geo plot of CF for wind energy
import numpy as np
import pandas as pd
import geoplot as gplt
import geopandas as gpd
import matplotlib.colors as clrs
import matplotlib.pyplot as plt
ShapeFileCoast="./GEO_data/ne_10m_coastline.shp"
ShapeFileStates="./GEO_data/ne_10m_admin_1_states_provinces_lines.shp"
HourlyData=np.... | true |
5523338fc1e66e3daa135d5c32a95091d7869c97 | felipesilvadv/felipesilvadv-iic2233-2017-1 | /Actividades/AC03/AC03.py | UTF-8 | 3,785 | 2.953125 | 3 | [] | no_license | from collections import deque
class Camion:
def __init__(self,capacidad,urgencia):
self.productos = deque()
self.capacidad_maxima = capacidad
self.urgencia = urgencia
@property
def capacidad_actual(self):
contador = 0
for producto in self.productos:
conta... | true |
6af5cc07a0e2c8fb0f090a7929e11106e5bb0b1d | lsvih/Var-CNN--DynaFlow | /evaluate_ensemble.py | UTF-8 | 3,978 | 2.640625 | 3 | [
"MIT"
] | permissive | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
NUM_MON_SITES = 100
NUM_MON_INST_TEST = 30
NUM_MON_INST_TRAIN = 60
NUM_MON_INST = NUM_MON_INST_TEST + NUM_MON_INST_TRAIN
NUM_UNMON_SITES_TEST = 5500
NUM_UNMON_SITES_TRAIN = 3500
NUM_UNMON_SI... | true |
52f0f1466b81cbaf8dc1526ea07ef7083dcf11d5 | ob/remote | /src/remote/configuration/discovery.py | UTF-8 | 1,802 | 2.71875 | 3 | [
"BSD-2-Clause"
] | permissive | from pathlib import Path
from typing import List, Tuple
from remote.exceptions import ConfigurationError
from . import ConfigurationMedium, WorkspaceConfig
from .classic import ClassicConfigurationMedium
from .toml import TomlConfigurationMedium
CONFIG_MEDIUMS: List[ConfigurationMedium] = [ClassicConfigurationMedium... | true |
32e33d9f26a60046a116b81a1673c49348655d05 | gahyunlee/DataCamp_pjt | /DataCamp_pjt1.py | UTF-8 | 676 | 3.734375 | 4 | [] | no_license | ### trying to make a dictionary from a dataframe using iteration (for loop)
### the dictrionary has each word inside a column of a dataframe as a key
### and the number of its occurrence as its value.
import os
import pandas as pd
cwd = os.getcwd()
print(cwd) # to check where I am
os.chdir("/Users/Sophie/Downloads/s... | true |
4446739e40e7c4f581f87c176f0a5b4834a2cec2 | NiravTalaviya/Zero-Shot-Super-Resolution | /video/utils.py | UTF-8 | 1,965 | 2.765625 | 3 | [] | no_license | import numpy as np
import cv2
import tensorflow as tf
def preprocess(image, scale_fact, scale_fact_inter, CROP_SIZE=[96],
NOISE_FLAG=True, noise_std=0.0125):
image = image.astype(np.float32)
# scale down is sthe inverse of the intermediate scaling factor
scale_down = 1 / scale_fa... | true |
2d212418dbe8583bebcf8962f5696471dca238f5 | saurabh1002/Computer_Vision_Python | /grayscale.py | UTF-8 | 1,098 | 3.25 | 3 | [
"MIT"
] | permissive | from PIL import Image
import numpy as np
from matplotlib import pyplot as plt
def GrayScale(img):
"""
Converts an input color image to grayscale.
Input: numpy array of image
Output: numpy array of image conerted to Grayscale
"""
if np.ndim(img) > 2:
gray_img = np.zeros((np.shape(img)... | true |
aa06710d29c7e84d8f5af76f59f835426d203a3d | Aasthaengg/IBMdataset | /Python_codes/p02678/s206975704.py | UTF-8 | 419 | 2.921875 | 3 | [] | no_license | from collections import deque
N,M = map(int, input().split())
E = [[] for _ in range(N)]
for _ in range(M):
a,b = map(int, input().split())
E[a-1].append(b-1)
E[b-1].append(a-1)
q = deque()
q.append(0)
ans = [0]*N
while q:
par = q.popleft()
for e in E[par]:
if ans[e] > 0:
contin... | true |
86c1095f8717819d55abf2a937422ed62220c4dd | hpz123456/-xh-python_requests_Django | /InterfaceAutomationTest/realize_package/tools/read_write_Excel.py | UTF-8 | 2,445 | 2.84375 | 3 | [] | no_license | # coding=utf-8
#Excel的读写
import openpyxl
from realize_package.model.Excel_message import Excel
import os
# curPath = os.path.abspath(os.path.dirname(__file__))
# rootPath = curPath[:curPath.find("InterfaceAutomationTest\\")+len("InterfaceAutomationTest\\")] # 获取myProject,也就是项目的根路径
import sys
rootPath = ""
for i in (s... | true |
554a4853a056248406937363c8e4bf2e73828036 | Aasthaengg/IBMdataset | /Python_codes/p03617/s912320471.py | UTF-8 | 331 | 2.703125 | 3 | [] | no_license | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
q, h, s, d = map(int, readline().split())
n = int(readline())
ans = min(8 * q, 4 * h, 2 * s, d) * (n // 2) + min(4 * q, 2 * h, s) * (n % 2)
print(ans)
if __name__ == '__main__':
... | true |
bed4e58d98a03a35c9b491b2ce58b27d9c050c0b | Society-for-Internet-Blaseball-Research/salmon_lib | /salmon_lib/parsers/bse.py | UTF-8 | 6,983 | 2.859375 | 3 | [
"MIT"
] | permissive | import re
# not even gonna try to document the format for this one. perish
# jk this needs to be documented
stock_r = re.compile(
"(.+)\s+,\s+(\d+[.]\d+)\s+(\d+)\s+(\d+[.]\d+)\s+(\d+)\s+(\d+)\s+,(.+)\s+,(\d+[.]\d+)"
)
def parse_bse(file):
lines = file.readlines()
bse = {
"number_of_stocks": int(l... | true |
25646743ec156a50ba4c0fe514dc6c6fb4ce6af8 | xflr6/fileconfig | /fileconfig/meta.py | UTF-8 | 3,911 | 2.640625 | 3 | [
"MIT"
] | permissive | """Parse config, collect arguments, create instances."""
import configparser
import os
from . import stack
from . import tools
__all__ = ['ConfigMeta', 'StackedMeta']
DEFAULT = 'default'
class ConfigMeta(type):
"""Parse file, create instance for each section, return by section or alias."""
filename = Non... | true |
895dc66b1496bd5601309b184b9c2142fb0ab478 | K-Vaid/Python | /Basics/translate.py | UTF-8 | 617 | 4.09375 | 4 | [] | no_license |
"""
Code Challenge
Name:
Translate Function
Filename:
translate.py
Problem Statement:
Write a function translate() that will translate a text into "rövarspråket"
Swedish for "robber's language".
That is, double every consonant and place an occurrence of "o" in between.
Take Input fro... | true |
a79d1550f9b3a5bf421cc5caaf9fa2668213644c | iyy0v/Small-Encryption-and-Decryption-scripts | /Password Encryptor (Easy).py | UTF-8 | 335 | 3.515625 | 4 | [] | no_license |
password = input("Enter password here : ")
pwd_in_list = []
pwd_encrypted = ""
i = 0
for char in password:
pwd_in_list.append("")
pwd_in_list[i] = pwd_in_list[i] + chr( 126 - (ord(char) - 33) )
pwd_encrypted = pwd_encrypted + pwd_in_list[i]
i+=1
print("Your encrypted password is : " +... | true |
412e2bef9bcb20171db807b96bd1e1924088183c | calendula547/python_advanced_2020_softuni_bg | /python_advanced_2020/tuples_and_sets/count_symbols.py | UTF-8 | 418 | 3.96875 | 4 | [] | no_license | def count_letters(text):
letters_count_dict = {}
for letter in text:
if letter not in letters_count_dict:
letters_count_dict[letter] = 0
letters_count_dict[letter] += 1
return letters_count_dict
def print_result(letters_dict):
for k, v in sorted(letters_dict.items... | true |
7b3372748d3a5c12622c549131c8b30f4a05b7f5 | parmarjh/100day-coding-challenge | /day 7/queue/list_queue.py | UTF-8 | 239 | 3.953125 | 4 | [] | no_license | queue = []
queue.append(1)
queue.append(2)
queue.append(3)
print("Initial Queue : ",end=" ")
print(queue)
#remove elements in queue
queue.pop(0)
queue.pop(0)
queue.pop(0)
print("After removing elements in queue :",end=" ")
print(queue) | true |
87fb58052f7023ac65fec411bfacf2dc6859b320 | marcinkuzminski/pyramidpypi | /pyramidpypi/utils.py | UTF-8 | 8,099 | 2.546875 | 3 | [
"ISC"
] | permissive | import os
import re
import logging
import urllib
import urlparse
import requests
from pyramid.httpexceptions import HTTPException
from pyramid.settings import asbool
log = logging.getLogger(__name__)
_egg_info_re = re.compile(r'^([a-z0-9_.]+)-([a-z0-9_.-]+)'
'(\.tar\.gz|\.tar\.bz2|\.tar|\.... | true |
054534881ebb68b666f8b85ec96959515efd7655 | tpuser777/python_medium1 | /set_public_instance_variable.py | UTF-8 | 72 | 2.6875 | 3 | [] | no_license | tk = Person('TK')
tk.first_name = 'Kaio'
print(tk.first_name) # => Kaio
| true |
ee565a9195efefdd8a4ad0f6489f6e62baaba8d0 | marcinsieciechowicz/PycharmProjects | /python/ex31_lambdas.py | UTF-8 | 230 | 3.8125 | 4 | [] | no_license | # uzywajac lambdy i funkcji filter
# stworz liste wszystkich wielkich liter, jakie znajduja sie w podanym stringu
s = 'Wszyscy Ogladaja Gre O Tron'
#S = ['W', 'O', 'G', 'O', 'T']
S = list(filter(lambda letter: letter.isupper(), s))
print(S)
| true |
7fadfef9b4a30a34b0085b18df0518a51480f9d0 | jrmtnez/NLP-IR-UNED-at-CheckThat-2020 | /T1Ar/nlpir01/utils/read_dataset.py | UTF-8 | 8,917 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import gzip
import codecs
import json
import pandas as pd
import sys
import os
from os.path import join
import networkx as nx
import csv
from utils.tweets_graph import TweetsGraph
from utils.global_parameters import TWEETS_PATH, LABELS_PATH, TOPICS_PATH
from utils.global_parameters import TEST... | true |
079aefb36e43f4e50527acb04c35f9191ba69a2e | Coby-Sonn/coby-s-project | /project/Server/DbManager.py | UTF-8 | 6,195 | 3.203125 | 3 | [] | no_license | """Deals with checking if a DB exists' creating one and extracting or writing into the db tables."""
import sqlite3
import DbCreator
import os.path
SQLITE_FILE_PATH = 'mydb.sqlite' # name of the sqlite database file
USERINFO = 'UserInfo' # name of the table to be created
INT_TYPE = 'INTEGER' # column data type... | true |
040e15586133d68fde188a157cf520543ebc50ed | hanssdd/Log-M-tiling- | /source.py | UTF-8 | 1,061 | 2.890625 | 3 | [] | no_license | import numpy as np
# Harry's code
B=matrix([[2,-1,-3],[-1,2,-1],[-1,-1,2]])
L1=(B.inverse())[0]
L2=(B.inverse())[1]
L3=(B.inverse())[2]
R1=matrix.identity(3)-matrix(3,3,[(B.transpose())[0],[0,0,0],[0,0,0]])
R2=matrix.identity(3)-matrix(3,3,[[0,0,0],(B.transpose())[1],[0,0,0]])
R3=matrix.identity(3)-matrix(3,3,[[0,0,0... | true |
01de1c3732cd4021d0e9ae5da54bec13f1289efe | JMAgundezG/twitter-bots | /twit_utilsBot.py | UTF-8 | 3,286 | 3.171875 | 3 | [] | no_license | import time
import tweepy
import logging
import db_methods
class twit_utilsBot(object):
def __init__(self,api,screen_name):
self.bot = api
self.screen_name = screen_name
"""devuelve la palabra más usada de la lista de palabras siempre
y cuando cumpla unas reglas determinadas"""
@static... | true |
bc67a0141f939743d152653e2fecf073a33dfff6 | rick00young/CTR_Model | /FM_FFM/fm.py | UTF-8 | 3,080 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 12/3/20 15:50
# @Author : yangyongrui
# @File : fm.py
import numpy as np
from sklearn.feature_extraction import DictVectorizer
from pyfm import pylibfm
import pandas as pd
from sklearn.metrics import accuracy_score, auc, roc_auc_score
from sklearn.model_selection import train_... | true |
70f59a56f64d3e2df7d426926c1d8d0c07580f65 | QPC-database/amazon-sagemaker-edge-manager-workshop | /lab/app/windfarm.py | UTF-8 | 10,233 | 2.515625 | 3 | [
"MIT-0"
] | permissive | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import threading
import math
import random
import pywt
import numpy as np
import logging
import time
import os
from turbine import WindTurbine
from edgeagentclient import EdgeAgentClient
from ota import OTAModelUpdate
... | true |
a534d11e52604cede3f2830db64014541afa4bea | sreyansb/Codeforces | /codeforces1294c.py | UTF-8 | 1,169 | 3.078125 | 3 | [] | no_license | def findprimefactors(n):
l=[]
while(n%2==0):
l.append(2)
n//=2
for i in range(3,int(n**.5)+1,2):
while(n%i==0):
n//=i
l.append(i)
if n>2:
l.append(n)
return l
for _ in range(int(input())):
n=int(input())
k=findprimefactors(n)
... | true |
875554747ce520bf8f63a067015b3f9adb6bc80d | pkofod/vfi | /vfi/optimize_1d.py | UTF-8 | 1,102 | 2.984375 | 3 | [
"MIT"
] | permissive | import math
import numba
# constants
inv_phi = (math.sqrt(5) - 1) / 2 # 1/phi
inv_phi_sq = (3 - math.sqrt(5)) / 2 # 1/phi^2 ... | true |
e79d4a295434e4a603a407fd3714b271f145e2d7 | sagek23/Java-Training | /pythonTest/ex04.py | UTF-8 | 433 | 2.640625 | 3 | [] | no_license | import re
import requests
url = 'http://www.weather.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=108'
text = requests.get(url).text
seoul = re.findall('<city>서울</city>(.+?)</location>', text, re.DOTALL)
#re.DOTALL 정보가 여러줄에 걸쳐서 있을 때 사용
#print(seoul)
#print(type(seoul[0]))
sweather= re.findall('<tmEf>(.+?)</tmEf>.+?<t... | true |
1a3d9b58b0594d0a1b3f63d13e1df261739bd274 | lgnativs/mpython | /examples/01.显示屏/snow.py | UTF-8 | 819 | 3.421875 | 3 | [
"MIT"
] | permissive | from mpython import *
from time import sleep_ms
from random import randint
from collections import deque
class Ball():
def __init__(self):
self.x = randint(0,128)
self.y = 0
self.vx = 0
self.vy = randint(1,5)
def run(self):
self.update()
self.di... | true |
4ba34537f6417689a9cc22e456738ec5cdffb339 | IsamuYun/COVIDServer | /importData.py | UTF-8 | 13,953 | 2.65625 | 3 | [] | no_license | from pymongo import MongoClient
import pymongo
import csv
import urllib3
from datetime import datetime
import time
#mongo_client = MongoClient('mongodb://127.0.0.1:27017')
mongo_client = MongoClient('127.0.0.1:27017',
username='ruser',
password='flzx3qc',
... | true |
ae09f6922db5b7a6e634c0d9178c14478948a6c3 | lilsweetcaligula/sandbox-codewars | /solutions/python/301.py | UTF-8 | 88 | 2.671875 | 3 | [] | no_license | pattern = (lambda n:
'\n'.join(str(digit) * digit for digit in range(2, n + 1, 2))) | true |
56ea9c5de53f15ed7efdf9e43a0790981e361e99 | FrankLikuohao/ceph-tools | /models/reliability/test.py | UTF-8 | 32,744 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
#
# Ceph - scalable distributed file system
#
# Copyright (C) Inktank
#
# This is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software
# Foundation. See file COPYING.
#
"""
unit test exerci... | true |
7cff0a2389bfe337d6ceabdd415680d2602c6b2a | nod/tornado_addons | /tornado_addons/async_yield.py | UTF-8 | 2,858 | 3 | 3 | [
"Apache-2.0"
] | permissive | from types import GeneratorType
import tornado.web
class WrappedCall(object):
def __init__(self, func, *a, **ka):
self.func = func
self.a = a
self.ka = ka
self.yielding = None
def _yield_continue(self, response=None):
try: self.yielding.send(response)
except Sto... | true |
3085f2539c82c765c1be6eaec6f17b6372747f83 | Vanditg/Leetcode | /Uncommon_Words_Two_Sentences/SimpleSolution.py | UTF-8 | 1,113 | 3.96875 | 4 | [] | no_license | ##==================================
## Leetcode
## Student: Vandit Jyotindra Gajjar
## Year: 2020
## Problem: 884
## Problem Name: Uncommon Words from Two Sentences
##===================================
#
#We are given two sentences A and B. (A sentence is a string of space separated words. Each word consists onl... | true |
7f7b26222d78613b65d6d4e23db581429f712e33 | SnehuD/Python-Programs | /Operators/LogicalOp.py | UTF-8 | 190 | 3.53125 | 4 | [] | no_license | x = 10
print('\n-----------------------LOGICAL OPERATIONS-------------------------\n')
#print(x>5 and x<15)
print(5 < x < 15)
print(x > 5 or x < 15)
print(not (x > 5 or x < 15))
| true |
cd18b1f99651b4dfeb265bf317cf28e857cc4140 | sky7th/algorithm-ps | /leetcode/그래프 위상정렬 210. Course Schedule II.py | UTF-8 | 718 | 3.1875 | 3 | [] | no_license | class Solution:
def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]:
g = defaultdict(list)
indegrees = [0 for _ in range(numCourses)]
for a, b in prerequisites:
g[a].append(b)
indegrees[b] += 1
q = deque()
for node in ra... | true |
3a360446ba0e09088cac2b9c2930e00c571ee991 | jeffersondfraga/machineLearning | /classifiesAccesses.py | UTF-8 | 668 | 3.046875 | 3 | [] | no_license | from dados import loadAccess
X,Y = loadAccess()
# a abordagem utilizada foi separar os dados para treino e teste em proporação 90/10
#a taxa foi de 88.89%
trainingData = X[:90]
trainingMarkings = Y[:90]
testData = X[-9:]
testMarkings = Y[-9:]
from sklearn.naive_bayes import MultinomialNB
model = MultinomialNB()
model... | true |
306c04764b4936552ff1c2ac3934efd950b7fefe | maria2442/University. | /DD.py | UTF-8 | 171 | 2.90625 | 3 | [] | no_license |
import pandas as pd
df=pd.read_excel('123.xlsx')
print(df.shape)
df=df.dropna()
print(df.shape)
a=df.drop_duplicates()
print(a.shape)
a.to_excel("321.xlsx") | true |
90fbb1416356d23c9503be9004c639b526e35217 | sleepingsaint/DS-ALG | /ALG/bubble_sort.py | UTF-8 | 335 | 3.75 | 4 | [] | no_license | # defining the bubble sort function
def bubble_sort(lst):
for j in range(len(lst)):
for i in range(len(lst) - j - 1):
if lst[i] > lst[i+1]:
lst[i], lst[i+1] = lst[i+1], lst[i]
i += 1
return lst
# test case
sort_list = [64, 34, 25, 12, 22, 11, 90]
print(bubble_sor... | true |
08714020a296c1712b81b82bb12d3bdc0f2254be | venzosan/selected100 | /038(典型DP).py | UTF-8 | 703 | 2.890625 | 3 | [] | no_license | #標準入力設定-------------------------------
import io
import sys
_INPUT = """\
1
abc
xyb
"""
sys.stdin = io.StringIO(_INPUT)
#------------------------------------------
import itertools
import math
#import copy
#import time
#import glob
import collections
N=int(input())
X=''
Y=''
for r in range(N):
X=input()
Y=input(... | true |
fcc6b9a6d93e80f7ef4af2e00504e0b8b736bcc0 | cbg293/p2_201611115 | /w6_highlow.py | UTF-8 | 1,475 | 3.8125 | 4 | [] | no_license |
# coding: utf-8
# In[8]:
def HighLowGame():
print 'Think your number (1~10)'
print 'you have to answer question using yes or no'
FQ=raw_input("Your number is higher than 5?: ")
if FQ=="yes":
SQ1=raw_input("Your number is lower than 7?: ")
if SQ1=="yes":
print "6"
e... | true |
c3ca6ed8f6d16ebd4fa6e4dde41f2783ef32cd02 | wasuthun/KNN_PCA_GLASS | /Glass_PCA_KNN.py | UTF-8 | 1,778 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 22:07:24 2019
@author: johnpaul
"""
# K-Nearest Neighbors (K-NN)
# Importing the libraries
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('/Users/johnpaul/Downloads/Downloads/Glass.csv',sep=';')
dataset = dataset.drop(['ID... | true |
6f94aa21aae2b18a241092a109d4283288969c9d | NewStarVitaliy/yatube_project | /yatube/posts/views.py | UTF-8 | 619 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | from django.http import HttpResponse
from django.shortcuts import render
# Главная страница
def index(request):
return HttpResponse('Главная страница')
# Страница со списком мороженого
def group_posts(request, slug):
return HttpResponse('Черепашка')
# Страница с информацией об одном сорте мороженого;
# vie... | true |
a55d751036b20e385a803a59a75a751080e19670 | doyeon-kim-93/algorithm | /알고리즘7일차_0211/스위치.py | UTF-8 | 1,156 | 2.859375 | 3 | [] | no_license | N = int(input())
a = [50]
rr = list(map(int, input().split()))
arr = a + rr
people = int(input())
action = [list(map(int, input().split())) for _ in range(people)]
for i in range(people):
if action[i][0] == 1:
for j in range(1,len(arr)):
if j % action[i][1] == 0:
arr[j] ^= 1
... | true |
e4eb13d34c799cf89c284e0b6f815b9c422642b9 | previsualconsent/projecteuler | /p057-fractions.py | UTF-8 | 224 | 2.859375 | 3 | [] | no_license | from Fraction import Fraction
import sys
sys.setrecursionlimit(3000)
f = Fraction(1,2) + 1
count = 0
for i in xrange(1,1000):
f = 1/(f + 1) + 1
if len(str(f.num)) > len(str(f.den)):
count += 1
print count
| true |
251b0549a20ef7b01ed5624c8190d02edb217d9e | vitoo199/Arkanoid | /tests/test_Paddle.py | UTF-8 | 557 | 2.765625 | 3 | [] | no_license | import src.Paddle as Paddle
import pygame as pg
def test_should_not_pass_over_the_left_edge():
surface = pg.Surface((800, 600))
paddle = Paddle.Paddle((0, 550), (200, 20))
paddle.speed = 10
paddle.dir_left = True
paddle.update(surface)
assert paddle.left >= 0
def test_should_not_pass_over_th... | true |
41780d59c7e56d6e80c8a0f03ce1fef5d4db5118 | wkentaro/lecture2014w-utmi-pattern-information | /code/challenge1.py | UTF-8 | 3,019 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""Challenge1
Assignment:
* http://www.mi.t.u-tokyo.ac.jp/harada/lectures/pattern/patternreport20150116.pdf
"""
from __future__ import print_function, division
import datetime
import numpy as np
import matplotlib.pyplot as plt
__author__ = 'www.kentaro.wada@gmail.... | true |
ab8b942d66f14c3ce84fe2bba4c0e2d6e2e6f69e | dmark/advent-of-code | /2015/02/02.py | UTF-8 | 385 | 3.46875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""02.py - https://adventofcode.com/2015/day/2"""
def main():
"""main"""
floor = 0
with open("input.txt") as f:
l = f.readline()
for c in l:
if c == '(':
floor += 1
else:
floor -= 1
... | true |
82c25f47b0d20e7fcceb78df4b7c10356d575844 | javampishu/Zookeeper | /Problems (12)/Find even/task.py | UTF-8 | 78 | 3.390625 | 3 | [] | no_license | n_number = int(input())
i = 2
while n_number > i:
print(i)
i = i + 2
| true |
49d4a72dd9841cee09e272b7610db41a36c19f59 | Gitiauxx/FairEd | /source/dataset.py | UTF-8 | 1,799 | 3.09375 | 3 | [] | no_license | import pandas as pd
import numpy as np
class Chilean(object):
"""
Create a dataset class for the Chilean dataset
Sensitive attribute is either gender, school or elite
"""
def __init__(self, data_folder, sensitive=None, type='train', xmean=None, x2sum=None):
if sensitive is not None:
... | true |
6985a8b8020c0ed31b5d5d7e44b95166be89bd0c | VegasIOT/waveshare213 | /hat.py | UTF-8 | 1,064 | 2.78125 | 3 | [] | no_license | import sys
import epd2in13
import time
import Image
import ImageDraw
import ImageFont
import textwrap
def main():
epd = epd2in13.EPD()
epd.init(epd.lut_full_update)
text = textwrap.fill("test of the longest sentence you can write",width=12)
# For simplicity, the arguments are explicit... | true |
b21d8a1900763a43bf4e42378e0519191f78c146 | ekeilty17/Personal-Projects-In-Python | /Math/line_integral.py | UTF-8 | 1,544 | 2.9375 | 3 | [] | no_license | from sympy import *
from vector import *
def line_integral_param(F, x, y, z, r, (t, t_a, t_b)):
F = F.copy()
for i in range(len(F.E)):
F.E[i] = F.E[i].subs(x, r.E[0])
F.E[i] = F.E[i].subs(y, r.E[1])
F.E[i] = F.E[i].subs(z, r.E[2])
dr = r.copy()
for i in range(len(dr.E... | true |
b968a5b189b223e271334c27dadbc73d132f8d2f | metalinux91/MIT-OCW | /6.0001/ps4a.py | UTF-8 | 2,559 | 4.21875 | 4 | [] | no_license | # Problem Set 4A
# Name: <your name here>
# Collaborators:
# Time Spent: x:xx
def get_permutations(sequence):
'''
Enumerate all permutations of a given string
sequence (string): an arbitrary string to permute. Assume that it is a
non-empty string.
You MUST use recursion for this par... | true |
f53a5e2f49803eb4a60ae116ce8901fce5976ce2 | Hortmagen21/ForShare | /ServerRuner/response/requestHandler.py | UTF-8 | 936 | 3.015625 | 3 | [] | no_license | class MockFile(): # если ми не сможем прочитать файл обычним read() то видаст False
def read(self):
return False
class RequestHandler():
def __init__(self): # создали конструктор
self.contentType = "" # создавая обьект у нас есть 2 параметра contentType,contents
self.contents = Mock... | true |
b2967735ba725b04842f8ffb2a1d0b9c8c994ff4 | wavs/pfe-2011-scia | /Home/WidgetCenter/Widget/SRButton.py | UTF-8 | 1,247 | 2.515625 | 3 | [] | no_license | import SRView as SRView
import sys
sys.path[:0] = ['../../']
from GfCenter.GfCenter import *
class SRButton(SRView.SRView):
def action():
doc = "The action property."
def fget(self):
return self._action
def fset(self, value):
self._action = value
def fdel(self):
del se... | true |