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 |
|---|---|---|---|---|---|---|---|---|---|---|
fc43a38e21e12316f459ad67a837e3efcc085a77 | foxstephen/Shell-Scripts | /weather.py | UTF-8 | 491 | 3.234375 | 3 | [] | no_license | import sys
try:
import requests
except:
exit()
def parse_weather_short(weather):
lines = weather.split('\n')
parsed = ''
for _ in range(0, 7):
parsed += (lines[_] + '\n')
return parsed
if __name__ == "__main__":
if len(sys.argv) < 2:
print('Not enough arguments for weather.py')
exit()
url = 'http://wt... | true |
ba4575abb0677c336009c0f8950493612283d382 | BartMiki/AdventOfCode | /2019/day_01.py | UTF-8 | 600 | 3.703125 | 4 | [] | no_license | from math import floor
def calculate(value):
return floor(value / 3.0) - 2
def calculate_with_fuel(value):
result = floor(value / 3.0) - 2
if result <= 0:
return 0
else:
return result + calculate_with_fuel(result)
values_part_1 = None
values_part_2 = None
with open('data/day_01.txt') ... | true |
b32a4faf4593aa2449c1cc9d8b331bac829bcdc2 | cnyahia/MonteCarloMethodsStats | /assignment3/code/part2.py | UTF-8 | 2,168 | 3.59375 | 4 | [] | no_license | """
This code implements a Markov Chain Monte Carlo
algorithm for the integral given in Homework 3 -
SDS386D Monte Carlo methods in statistics (q2)
The code uses the Metropolis-Hastings algorithm
to sample from a density and evaluate an integral
@cnyahia
"""
import numpy.random as nprand
import matplotlib.pyplot as ... | true |
a7cf18a8b694bbb4a2ac2eb14e65dc78ccec01f5 | qizhixin820/APRIL | /dbdqn/dqn-qindex/src/logger.py | UTF-8 | 265 | 3.0625 | 3 | [] | no_license |
class MyLogger:
def __init__(self, path = '../data/log.txt'):
self.f = open(path, 'w')
def write(self, val_list):
for val in val_list:
self.f.write(str(val))
self.f.flush()
def close(self):
self.f.close() | true |
7b1857c86ddd303e6698c3daa7be864dddd14283 | DatGuy1/pajbot | /pajbot/utils/time_ago.py | UTF-8 | 226 | 2.515625 | 3 | [
"MIT"
] | permissive | import datetime
from .now import now
from .time_since import time_since
def time_ago(t: datetime.datetime, time_format: str = "long") -> str:
return time_since(now().timestamp(), t.timestamp(), time_format=time_format)
| true |
0058e382cc2dd3ed0df8efb8e6ddc8d576a16286 | MarianDanaila/Competitive-Programming | /LeetCode_30days_challenge/2021/June/Open the Lock.py | UTF-8 | 1,494 | 2.984375 | 3 | [] | no_license | from collections import deque
from typing import List
class Solution:
def openLock(self, deadends: List[str], target: str) -> int:
set_deadends = set()
visited = set()
for deadend in deadends:
set_deadends.add(deadend)
if "0000" in set_deadends:
return -1
... | true |
e651b71401676ce13e3ad889f709d196654e4ffe | Plan9-Archive/iru-depot | /pbm.py | UTF-8 | 1,095 | 3.40625 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math, sys
class Screen:
def __init__(self, w, h):
self.w = w
self.h = h
self.data = [[0] * w for i in range(0, h)]
self.objs = []
def add(self, obj):
self.objs.append(obj)
def __str__(self):
for obj in self.objs:
obj.plot(self)
s = "P1\n%d %d... | true |
7bd5fdadc6a6b6857f56385b54bcaf40ab97c6b0 | berooo/OCR_TextImage_Generator | /label_index_make/word_to_index.py | UTF-8 | 1,524 | 3.265625 | 3 | [] | no_license | """
说明:将字符标签转换为字典索引标签
注意:该字典中blank字符是第0索引
"""
def find_index(char_i, char_list):
for index, str_i in enumerate(char_list):
if char_i == char_list[index].strip():
return index
print(char_i)
print("没找到该字符!")
return -1
dict_path = r"D:\FengZhan\ElectricityMeter\Code\ElectricityMeter\... | true |
d0d98a26bdd6061c61a4858817e61d47d3fed33b | soyun20/Python | /try와except.py | UTF-8 | 101 | 3.21875 | 3 | [] | no_license | a="wow"
try:
print("Hello")
b=int(a)
print("World")
except:
b="Integer X."
print('Done',b)
| true |
b9038f844575c9ac4eba0334928e30a8de09be44 | Programmer7129/Face-Recognition | /Image Recognition.py | UTF-8 | 1,407 | 3.265625 | 3 | [] | no_license | """
Important Libraries to import given below.
This makes the program a lot easier and readable to a beginner.
"""
import face_recognition as fr
import cv2
imgElon = fr.load_image_file('Images/Elon Musk.jpg')
imgElon = cv2.cvtColor(imgElon, cv2.COLOR_BGR2RGB)
imgTest = fr.load_image_file('Images/Elon Test... | true |
5668d9aca30a3d500812e2e773e842202c69ba3f | tanneryilmaz/flask_website | /flask_blog/users/routes.py | UTF-8 | 6,087 | 2.65625 | 3 | [] | no_license | from flask import render_template, url_for, flash, redirect, request, Blueprint
from flask_login import login_user, current_user, logout_user, login_required
from flask_blog import db, bcrypt
from flask_blog.models import User, Post
from flask_blog.users.forms import (RegistrationForm, LoginForm, UpdateAccountForm,
... | true |
661ad42c76a9cda80ec6b6119cacfea3c1141a47 | ppd0705/leetcode | /algorithms/python/142_linked_list_cycle_II_2.py | UTF-8 | 631 | 3.46875 | 3 | [] | no_license | # Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
# a + b = l
# f = 2s
# f = s + nb
# s = nb
class Solution(object):
def detectCycle(self, head: ListNode) -> ListNode:
fast = slow = head
while True:
i... | true |
6929c914bab9249a2b000963d14c93b42182223a | j0nnnnn0/opencv | /chapter6_stackImages.py | UTF-8 | 2,063 | 2.796875 | 3 | [] | no_license | import cv2
import numpy as np
def stackImages(scale,imgArray):
rows = len(imgArray)
cols = len(imgArray[0])
rowsAvailable = isinstance(imgArray[0], list)
width = imgArray[0][0].shape[1]
height = imgArray[0][0].shape[0]
if rowsAvailable:
for x in range ... | true |
27621b513e4265505d349173cf3f9e882dd3bfa9 | NikitaInozemtsev/python-practice | /Additional tasks/practice_2/task3/f.py | UTF-8 | 116 | 3.453125 | 3 | [] | no_license | def transpose(x):
return [list(i) for i in zip(*x)]
a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(transpose(a))
| true |
e5123388095346728a398f55f0e541640630a885 | Beltrame03/Python-App | /v0.3.1/server.py | UTF-8 | 1,092 | 2.5625 | 3 | [] | no_license | import os
import socket
import json
def dump(message):
#items = {"message":"welcome"}
#with open('messages.json', 'w') as f:
#json.dump({items}, f)
l = 0
items = {}
f = open('messages.json')
Files = json.load(f)
x = 1
while (x == 1):
try:
print(F... | true |
99ba44f82406d7fdad6ce7cb63d8f6f6c081641c | dennyfan/online-judge | /pythoncode/repeatedlookup.py | UTF-8 | 623 | 3.796875 | 4 | [] | no_license | def RepeatedLookup():
ESdict={'one':'uno','dos':'two','three':'tres'}
word = input("enter word")
while word != '':
if word in ESdict:
print(f'{word} means {ESdict[word]}')
else:
print(f'{word} not in dict')
word = input('enter word')
def RepeatedLookup2(... | true |
ba652981dbf904c80568b270f42f14b426b417a1 | fhdbbk/Codes_for_Important_Algos | /stack/infixtopostfix.py | UTF-8 | 1,093 | 3.484375 | 3 | [] | no_license | from arraystack import ArrayStack
def prec(ch):
if ch == '-' or ch == '+':
return 1
elif ch == '*' or ch == '/' or ch == '%':
return 2
elif ch == '^':
return 3
def isOperand(ch):
return (ord(ch) >= ord('a') and ord(ch) <= ord('z')) or (ord(ch) >= ord('A') and ord(ch) <=... | true |
5b9fd7a4d310cf40e195b525eacc4f7ef7fcc9e4 | wenchuan/euler | /38.py | UTF-8 | 295 | 3.46875 | 3 | [] | no_license | #!/usr/bin/python
def isPandigital(s):
x = list(s)
x.sort()
r = ''
for i in x:
r += i
return r == '123456789'
for i in xrange(9876, 0, -1):
s = ''
x = 1
while len(s) < 9:
s += str(i * x)
x += 1
if isPandigital(s):
print i, s
| true |
c675ca9a747eee8b3641154a0c8ce4d188746bc3 | print-hello/SpiderDemon | /douban/douban/pipelines.py | UTF-8 | 1,362 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import json
import pymysql
class DoubanPipeline(object):
def __init__(self):
self.file = open('doubanTOP250.txt', 'w', encoding='utf-8')
def close_file(self, spider):
self.file.close()
def process_item(self, item, spider):
line = json.dumps(dict(item), ens... | true |
5c8cc7efc1cc68eb9a0887d6fd925806c12e24d4 | gjjguo/myV5 | /conftest.py | UTF-8 | 2,988 | 2.71875 | 3 | [] | no_license | #coding:utf-8
'''
测试夹具函数,实现测试用例的前置和后置
'''
# 测试夹具
import pytest
from middleware.handler import Handler
from jsonpath import jsonpath
import requests
def login(user, pwd):
"""最终返回id ,token,leave_amount"""
login_data = {"mobile_phone": user, "pwd": pwd}
res = requests.request(url=Handler.config_yaml['host'] ... | true |
6c393332ae73d276a4629aa1402b101a98773e73 | Hunt-j/python | /PP09.py | UTF-8 | 596 | 3.65625 | 4 | [] | no_license | from random import seed
from random import randint
seed(randint)
x = 1
n = int(0)
while (x == 1):
a = randint(1,9)
b = int(input("Pick a number between 1 and 9"))
if (b > a):
print("Too high!")
again = input("play again (Y or N)")
n = (n + 1)
if (b < a):
print("Too... | true |
d0ff0cd96a12add0659f9994ebc709e075dca8e7 | Oktawian-L/Archie | /ExchangeAPI/app/models.py | UTF-8 | 654 | 2.96875 | 3 | [] | no_license | import json
from datetime import datetime
class ExchangeRate:
def __init__(self, id, timestamp, PLN, EUR, GBP):
self.id = id
self.timestamp = timestamp
self.PLN = PLN
self.EUR = EUR
self.GBP = GBP
class ExchangeRateCreator:
@staticmethod
def create(data_json):
... | true |
f92d30f2980d16827711e9656ab40d366f661c1d | szbobby/python_study | /sample/OS进程与线程.py | UTF-8 | 371 | 2.859375 | 3 | [] | no_license | import os
# 用os模块的system函数来执行命令dir,执行完毕后如果返回值为0则表示执行成功。执行完毕后控制权返回给python进程。
print(os.system("dir"))
# 打开window系统的notpad程序,然后python自身进程被关闭,新建立的notpad进程继续
notepad = "c:\\windows\\notepad.exe"
os.execl(notepad,"notepad.exe")
| true |
276cce85b0517ff7e22e6171be1fdb24e622e64c | mimi1987/Python_Script_Mingle_Mangle | /file_csv_reader.py | UTF-8 | 573 | 3.28125 | 3 | [] | no_license | class FileReader():
def __init__(self, file):
self.__file = file
def lines(self):
lines = []
with open(self.__file, 'r') as file:
for line in file:
lines.append(line.strip())
return lines
class CsvReader(FileReader):
def lines(self, sep):... | true |
9e2a3017cd6ad2b12ce8bc67cb662db047e8e83d | bitnic028/EGRProduction | /application/num_to_str.py | UTF-8 | 4,896 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from decimal import Decimal
def transform(trnsfstr):
trnsfstr = ' '.join(trnsfstr.split())
trnsfstr = trnsfstr.capitalize()
return trnsfstr
def triad(number, mass, sort):
tens = number % Decimal('100')
tens = int(tens / Decimal('10'))
ed = number % Decimal('10')
... | true |
c5f0c0db49b2bea2de0f75c492c2e91a89980b76 | minaRang/test | /유지연/chapter3/greedy4.py | UTF-8 | 404 | 2.953125 | 3 | [] | no_license | # n,k = map(int, input().split())
# result=0
# while n>=k:
# while n %k !=0:
# n-=1
# result+=1
# n //=k
# result +=1
# while n>1:
# n-=1
# result +=1
# print(result)
n, k = map(int, input().split())
result=0
while True:
target=(n//k)*k
result += (n-target)
n=target
... | true |
74f203b5e66e20aec699a88b14f059b263333310 | DarthObsidian/LearningPython | /Homework2/strings.py | UTF-8 | 906 | 3.8125 | 4 | [] | no_license | import sys
import re
#read in the file
stringFile = open(sys.path[0] + '\\Strings.txt', 'r')
fullfile = stringFile.read()
stringFile.close
#make all the words lowercase
lowercase = fullfile.lower()
#split the words into a list by everything but a-z and '
splitWords = re.split(r'[^a-z\']', lowercase)
#ge... | true |
5624166d05fe63b7a7811dbf328566ac2409937b | kloniphani/Dedomena | /Sensor/SensorPubNub.py | UTF-8 | 2,065 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from pubnub.pubnub import PubNub, SubscribeListener, SubscribeCallback, PNStatusCategory
from pubnub.pnconfiguration import PNConfiguration
from pubnub.exceptions import PubNubException
import pubnub
import datetime
from time import sleep
from sense_hat import SenseHat
sense = SenseHat()
pnconf = PNConfiguration()
... | true |
6aebd8addcb75167b5c2da4f17797da1748fdece | EdgeOfNetwork/flask_api | /main.py | UTF-8 | 805 | 2.984375 | 3 | [] | no_license | from setting import *
import json
db = SQLAlchemy(app)
class Movie(db.Model):
__tablename__ = 'movides'
id = db.Column(db.Integer, primary_key=True)
year = db.Column(db.Integer, nullable=False)
genre = db.Column(db.String(80), nullable=False)
def json(self):
return {'id': self.id, 'title... | true |
fc7c4942db2a24039af6dcacc792a4dc1f4e5667 | ting-python/Python0709 | /d04/String Demo5.py | UTF-8 | 197 | 3.796875 | 4 | [] | no_license | report = '台積電目前價格每股300元,非常適合買進'
amount = 1000 # 想買 1000股(1張)
price = report[9:12]
print(price)
cost = amount * int(price) # 請算出買進成本
print(cost) | true |
ca3af954bcfa2eb60ce8edaa45e22c10431da702 | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode_contest/weekly/weekly2020/185/185_1.py | UTF-8 | 1,151 | 3.078125 | 3 | [] | no_license | class Solution(object):
def reformat(self, s):
"""
:type s: str
:rtype: str
"""
letterlist = []
numberlist = []
res = ''
for i in range(len(s)):
if s[i].isalpha():
letterlist.append(s[i])
# 此时s[... | true |
ecba5bdd49492f7eef8efb40ba584d8458c9c119 | pqok/fkw01 | /apps/user/interface/shop_link_password.py | UTF-8 | 188 | 2.734375 | 3 | [] | no_license | # 加密
def encrypt_pk(user_pk):
num = (int(user_pk) + 1024) * 1024
return num
# 解密
def deciphering_pk(encrypt_pk):
num = (int(encrypt_pk) / 1024) - 1024
return num
| true |
400f99f20b4b74cc80e31a70d2b7a7d14122898c | gaoyunqing/MetReg | /MetReg/data/data_preprocessor.py | UTF-8 | 4,853 | 3.03125 | 3 | [
"MIT"
] | permissive |
import numpy as np
import sklearn.preprocessing as prep
class Data_preprocessor():
"""a class for preprocessing data.
Implement basic preprocessing operation, including normalization,
interplot, outlier preprocessing, wavelet denoise.
# (TODO)@lilu: outlier preprocess
# (TODO)@lilu: wavelet den... | true |
fbe339ec3d5d10a3fced168efeb1d475cc1035e8 | srom/chessbot | /estimator/train/convolutional.py | UTF-8 | 4,062 | 2.8125 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
import tensorflow as tf
WIDTH = HEIGHT = 8
CHANNELS = 12
FILTERS = 10
KERNEL_SIZE = 3
STRIDES = [1, 1]
PADDING = 'SAME'
DENSE_HIDDEN_UNITS = 2048
KAPPA = 10.0 # Emphasizes f(p) = -f(q)
class ChessConvolutionalNetwork(object):
def __init__(self, learning_rate, adam_eps... | true |
4c398dc1c84891ea7ac3bd39a0c60f6fa81b40aa | daniel-reich/turbo-robot | /Q5bu2bXxXxfWtvmjy_10.py | UTF-8 | 744 | 4.34375 | 4 | [] | no_license | """
Given a string of letters in the English alphabet, return the letter that's
missing from the string. The missing letter will make the string be in
alphabetical order (from A to Z).
If there are no missing letters in the string, return `"No Missing Letter"`.
### Examples
missing_letter("abdefg") ➞ "c"
... | true |
7f93ac447d3fa5ed60b33898adec916ff69c00a8 | alan-turing-institute/misinformation-crawler | /misinformation/spiders/misinformationmixin.py | UTF-8 | 7,513 | 2.53125 | 3 | [
"MIT"
] | permissive | import datetime
import re
import uuid
from contextlib import suppress
from urllib.parse import urlparse
from w3lib.url import url_query_cleaner, canonicalize_url
from scrapy.exceptions import CloseSpider
from scrapy.http import Request
from misinformation.items import CrawlResponse
from misinformation.warc import warc_... | true |
86caa55e75f57a386105002c2073ebfe5e070487 | alyssapyros/code_stuff | /euler/homework10.py | UTF-8 | 1,064 | 3.65625 | 4 | [] | no_license |
import numpy
def get_all_primes(x):
a = range(2,x)
i = 0
while i < len(a):
# grab next prime out of list
current_prime = a[i]
multiple = 2
while current_prime * multiple <= a[-1]:
# find a multiple of your prime
not_prime = multiple * current_prime
# remove it if it's in the list
if no... | true |
4e71f5f26786239a46eb6fe21754037d34fa4799 | AnkitNigam1985/Data-Science-Projects | /Courses/CoreySchafer/corey_schafer_matplotlib_4.py | UTF-8 | 852 | 3.390625 | 3 | [] | no_license | import csv
import numpy as np
from collections import Counter
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
with open('Matplotlib_data_1.csv') as csv_data:
csv_reader=csv.DictReader(csv_data)
language_counter=Counter()
for row in csv_reader:
language_counter.update(row['Langua... | true |
00db2655f9cb4633d6088618cb5e1c1833efd0ff | elabraha/CodingInterviewQuestions | /two_egg_drop.py | UTF-8 | 3,405 | 4.25 | 4 | [] | no_license | # If an egg is dropped from above that floor, it will break. If it is dropped
# from that floor or below, it will be completely undamaged and you can drop the
# egg again.
#
# Given two eggs, find the highest floor an egg can be dropped from without
# breaking, with as few drops as possible.
def floor_egg_break(floors... | true |
ee721b21c47c545d32f3e18417a8f0ae9d77cf80 | dtran39/Programming_Preparation | /11_Queue/239_Sliding_Window_Maximum/SlidingWindowMaximum.py | UTF-8 | 2,926 | 4 | 4 | [] | no_license | '''
Problem:
- Given an array nums,
there is a sliding window of size k
which is moving from the very left of the array to the very right.
You can only see the k numbers in the window.
Each time the sliding window moves right by one position.
-------------------------------------------... | true |
97115355913dca346ad12fd35433e39bd9e97e68 | fvitt/pygview | /pygview | UTF-8 | 936 | 2.671875 | 3 | [] | no_license | #! /usr/bin/env python
from Tkinter import Tk
from Plotter import plotter
import sys, getopt
import tkFileDialog
root = Tk()
root.update()
root.withdraw()
prog_name = sys.argv[0]
argv = sys.argv[1:]
initdir = None
filepath = None
try:
opts, args = getopt.getopt(argv,"hd:f:",["initdir=","filepath="])
except ge... | true |
291947d95afad786a8a0588aeba418504902e129 | torms3/DataProvider | /python/label_transform.py | UTF-8 | 1,828 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
__doc__ = """
Label transform functions.
Kisuk Lee <kisuklee@mit.edu>, 2015-2016
"""
import numpy as np
import transform
import utils
class LabelFunction(object):
"""
Transform label.
"""
def evaluate(self, sample, key, spec):
if spec is not None:
d = dict(... | true |
130763153dbd02f36f443c4b536c34b9d5491a25 | 1024Person/LearnPy | /Day3/sencent.py | UTF-8 | 2,283 | 4.28125 | 4 | [] | no_license | # 语句
'''
if 条件判断语句
for 循环语句部分
跳转语句
if elif …… else
条件控制:
1、登录验证
2、
python:判断的变量是 空字符串,0 ,None,都默认为False
'''
# username = input()
# #空字符串
# if username:
# print('登陆成功')
# print('------------------\n\t快买吧')
# else :
# print('请稍等')
# num = 90
# if num:
# print('num :',num)
'''
如果年龄大于18,并且输入了姓名
对应一个事件
'''
ag... | true |
d7927735d88f65e95c7545c26398d1aba503ad0c | thangarajan8/misc_python | /hackers_rank/angry prof.py | UTF-8 | 349 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 6 17:36:28 2019
https://www.hackerrank.com/challenges/angry-professor/problem
@author: Thanga
"""
def angry_prof():
late_or_not = lambda i : 1 if i <= 0 else 0
k = [-1 ,-3 ,4,2]
a = 3
if len(list(filter(late_or_not, k))) < a :
return 'YES'
... | true |
7bb67682f4bc259fc65f2ae7d1b566ec62c85301 | lxl0928/learning_python | /code/python_lesson/liaoxuef/01数据类型和变量.py | UTF-8 | 1,161 | 4.25 | 4 | [
"MIT"
] | permissive | print('I\'m \"OK\"!')
print('\n')
print('I\' learning\nPython.')
print('\n')
print('\\\n\\')
print('\n')
print('\\\t\\')
print('\n')
print(r'\\\t\\')
print('\n')
print('''line1
line2
line3''')
print('\n')
print(r'''line1
line2
line3''')
print('\n')
print('\n01: ')
print(True)
print('\n02... | true |
6daf45393d13009943e60e45e3590d683ecd1bf5 | maciektr/graph_algorithms | /Lab4/test.py | UTF-8 | 916 | 2.90625 | 3 | [] | no_license | #using friends script
#https://github.com/Petroniuss/GraphAlgorithmsClass/blob/master/Laboratory/Lab_2/tester.py
from dimacs import readSolution
import os
import lab4_1
def test(func, test_directory ):
tests = [os.fsdecode(file) for file in os.listdir(test_directory)]
success = 0
print("-" * 20 + "TE... | true |
653554fd09790be08864484d0a68878d2b2d91f2 | TransformersWsz/FaceRecognization | /genRGB_notInFace_data.py | UTF-8 | 440 | 2.640625 | 3 | [] | no_license | import cv2
def genRGBPic():
camera = cv2.VideoCapture(0)
count = 0
while True:
ret, frame = camera.read()
if cv2.waitKey(1000 / 12) & 0xff == ord("q"):
break
cv2.imshow("camera", frame)
cv2.imwrite('45-%s.jpg'%(str(count)),frame)
count += 1
if co... | true |
afd5e9d8f656c558ad2f24af8f4cbda44221a3dd | ivogeorg/python-prog-asst01 | /class_example.py | UTF-8 | 774 | 3.375 | 3 | [] | no_license | class MicroBit(object):
def __init__(self):
self.LEDs = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]
self.motion = True
self.light = True
self.acceleration = 9.7
def display(self, array):
for i in range(len(array)):
fo... | true |
0885c8993574934240f10750e0e3e7361f83cb9e | ksayee/programming_assignments | /python/CodingExercises/LeetCode415.py | UTF-8 | 1,057 | 3.734375 | 4 | [] | no_license | '''
415. Add Strings
Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.
Note:
The length of both num1 and num2 is < 5100.
Both num1 and num2 contains only digits 0-9.
Both num1 and num2 does not contain any leading zero.
You must not use any built-in BigInteger library... | true |
9ad455d915e16b7f67efe1cfc56dff6675ff3ef7 | Shu-HowTing/Pytorch | /test.py | UTF-8 | 662 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Author: 小狼狗
# import torch
# x = torch.Tensor([1, 2, 3, 4])
# # x = torch.unsqueeze(x, 0)
# # print(x)
# # print(x.size())
# x = torch.unsqueeze(x, 1)
# print(x)
# print(x.size())
# import torch
# from torch.autograd import Variable
# import matplotlib.pyplot as plt
#
# x = torch.unsqueeze(to... | true |
134ae9d486ddb17da1e765487e7bce1a24db6643 | npmoores/NickMooresPsych254 | /psych254_materials/mturk/makerparser.py | UTF-8 | 7,459 | 2.59375 | 3 | [] | no_license | #!/Users/Library/Frameworks/Python.framework/Versions/2.7/bin/python
####################
#Intro and Imports##
####################
'''File: makerparser.py
Author: Nicholas P. Moores, Language and Cognition Lab
npmoores@stanford.edu
For use with the bayesentences materials found in target-materials on the ser... | true |
ea79cc6705be5470f3668f8ec859200db588a133 | Aasthaengg/IBMdataset | /Python_codes/p03141/s892626424.py | UTF-8 | 183 | 2.75 | 3 | [] | no_license | N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]
sum_B = sum([b for a, b in AB])
ans = sum(sorted([a+b for a, b in AB], reverse=True)[::2]) - sum_B
print(ans) | true |
9c00de8dc18c44ca953bed3c2baa305cd5c38f48 | judyliou/LeetCode | /python/35. Search Insert Position.py | UTF-8 | 538 | 3.734375 | 4 | [] | no_license | class Solution(object):
def searchInsert(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
left = 0
right = len(nums) - 1
while left < right:
n = int((left + right) / 2)
... | true |
c038baf516d386662cf7996022c42811ea62f697 | CRUZEAAKASH/PyCharmProjects | /section13_ObjectOrientedProgramming/OOPs.py | UTF-8 | 584 | 4.90625 | 5 | [] | no_license | # Example1: Using the simple class method to unserstand the concept
class Parrot:
#class attributes
species = "bird"
#instance attributes
def __init__(self,name,age):
self.name = name
self.age = age
#Instantiate the Parrot class
blu = Parrot("blu", 10)
woo = Parrot("woo", 15)
#Access... | true |
14a2827d60b180e7108174ef75dd4b85e9c5f8b0 | zkan/dagster | /python_modules/libraries/dagster-aws/dagster_aws/ecs/utils.py | UTF-8 | 149 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | import re
def sanitize_family(family):
# Trim the location name and remove special characters
return re.sub(r"[^\w^\-]", "", family)[:255]
| true |
d8d684d720ef29a9a389af5fe2fabf3251e2a0bc | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_199/1890.py | UTF-8 | 1,293 | 3.1875 | 3 | [] | no_license | def brute(pan , k):
times = []
lengthP = len(pan)-(k-1)
#print('inizia il trip')
for perm in perms(lengthP):
#print('permutazione',perm)
#print(pan)
pan_test = pan[:]
count = 0
for i,b in enumerate(perm):
if b == '1':
pan_tes... | true |
6b34fc60d3f04753b050cd186d37cd271c5b1b5f | mikekestemont/pandora | /pandora/utils.py | UTF-8 | 5,441 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import codecs
import re
import ConfigParser
def load_annotated_dir(directory='directory', format='.tab', extension='.txt', nb_instances=None,
include_lemma=True, include_morph=True, include_pos=True)... | true |
a9063c7fe408d5c478848c878d2b84804513bf6a | vemek/software-maid | /maidd.py | UTF-8 | 2,371 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
from subprocess import call, Popen, PIPE
from datetime import datetime
from time import sleep
import re
interval = 5 # seconds between forced standby, and timeouts for IO
apm_timeout = 30 # seconds before device will put itself to sleep
sleep_timeout = 11 # seconds till disk is put to sleep
disk... | true |
04b936b08b5bd899e40cac3b1c0ef5cad656121c | CYLAHI/TAL_Project | /TrainingData.py | UTF-8 | 1,064 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import Analyze as an
def runTraining(folderName) :
trainingFiles=[] #Liste des fichiers d'entrainement
trainingData=[] #données étudiées
pos=0
neg=0
for dir in os.walk(folderName):
... | true |
8b68076a9dc4e99d7d6f77d0470577aee4c8d071 | deepprakashp354/python | /deep.py | UTF-8 | 49 | 3.140625 | 3 | [] | no_license | for x in range(0,100):
print(x)
print("hehehhe") | true |
bc65663787308e3a912d577be3dbaf4aaa756d75 | nogicoder/simple-rsync | /function/argsparse.py | UTF-8 | 783 | 2.671875 | 3 | [] | no_license | import argparse
#create an argparse instance named parser
parser = argparse.ArgumentParser(prog="dumbrsync", description="A dumb version of \
da mighty rsync")
#define arguments that will be executed
parser.add_argument('-u', '--update', help='skip files that are newer on the \
... | true |
0d744dcbde58e954dd5fab139a5f67cef3c97d94 | mattcarp12/python-pattern-matching | /pm3.py | UTF-8 | 347 | 3.171875 | 3 | [] | no_license |
class Foo:
def __init__(self, bar: str, baz: int):
self.bar = bar
self.baz = baz
def foo_match(foo: Foo):
match foo:
case Foo(bar="Hello", baz=_):
print("Hello Foo!")
case Foo(bar=_, baz=42):
print("Foo 42!")
case Foo(bar=_, baz=_):
... | true |
b53e71b98482d7f129f395dac08100f64b8de193 | FoxFurry/PBL-2020-PYTHON | /midi_generator/midi_extender/jsonUtil.py | UTF-8 | 645 | 3.171875 | 3 | [] | no_license | def getFields(raw):
result = []
start = raw.find('"generateLen":"') + len('"generateLen":"')
end = raw.find('","source":"')
generatedLen = raw[start:end]
start = end + len('","source":"')
end = raw.find('"}')
source = raw[start:end]
result.append(generatedLen)
resu... | true |
cd8a86b19c9e721af8d3f1c8cf4d7f6318f1a152 | Choirless/smiler | /src/choirless_smiler/smiler.py | UTF-8 | 7,506 | 2.5625 | 3 | [
"MIT"
] | permissive | try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 `importlib_resources`.
import importlib_resources as pkg_resources
import argparse
import bz2
import gzip
from pathlib import Path
import cv2
import dlib
import numpy as np
import requests
from tqdm import t... | true |
576390df630a98831b91367d7d98e45f39000fe5 | devjayantmalik/PythonTutorials | /src/tutorial_13.py | UTF-8 | 7,069 | 4.8125 | 5 | [] | no_license | # ==================================================
# ==================================================
# Iterabale, Iterator, List Comprehensions,
# Generator Functions, Generator Expressions
# ==================================================
# ==================================================
# Difference... | true |
b51725e291ec4be05a76e89b20f8f5a29025d8a6 | yiswang/LeetCode | /missing-number/missing-number.py | UTF-8 | 1,416 | 3.734375 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# Author: Yishan Wang <wangys8807@gmail.com>
# File: missing-number.py
# Create Date: 2017-02-26
# Usage: missing-number.py
# Description:
#
# LeetCode problem 268. Missing Numb... | true |
e00e22c00ff984ed9886668500b2986b7597a77d | KANG-YEONWOOK/ppythonn | /ss 4-1.py | UTF-8 | 1,757 | 4.09375 | 4 | [] | no_license | money = int(input("지폐로 교환할 돈의 액수를 써주세요 : ")) ##지폐로 환산할 돈의 액수를 입력받는다
yellow = money//50000 ##5만원짜리 지폐의 개수를 나타내는 변수 yellow에
##전체 돈의 액수를 50000으로 나눈 몫을 저장한다.
rest = money%50000 ... | true |
b1d3dfd2adf556371e75aad9debdb9042edcd331 | vyskoc/python-012021 | /3/priklad15.py | UTF-8 | 474 | 3.296875 | 3 | [] | no_license | from datetime import datetime
datum = datetime.strptime(input("Zadej datum: "),"%d.%m.%Y")
kusy = int(input("Zadej počet lístků: "))
zacPrvni = datetime(2021, 7, 1)
zacDruhe = datetime(2021, 8, 11)
konDruhe = datetime(2021, 8, 31)
if datum < zacPrvni or datum > konDruhe:
print("Mimo sezónu!")
elif datum < zacDruhe... | true |
351a24e045edfcc326f4ce857cae6b0e041b76fb | ygboucherk/duino-coin | /Arduino_Code/uploadavrminer.py | UTF-8 | 1,765 | 2.796875 | 3 | [
"MIT"
] | permissive | import os
import sys
board = input("Enter your board name (Uno, Nano, Mega): ")
port = input("Enter the port where the board is: ")
def windows():
if board == "Nano" or "Uno":
os.system(f".\\avrdude\\avrdude.exe -c arduino -P {port} -p atmega328p -b 115200 -U flash:w:avrminer.hex")
print(... | true |
f072abc97cc0fc82eef4a3ad413facdbfec395c7 | daniel-reich/ubiquitous-fiesta | /kjph2fGDWmLKY2n2J_19.py | UTF-8 | 1,882 | 3.359375 | 3 | [] | no_license |
def valid_color (color):
parts_index=0
correct_parts=0
print(color)
if color[0:4] == "rgb(":
parts_index = 4
elif color[0:5] == "rgba(":
parts_index = 5
else:
return(False)
if color[-1] != ")":
return(False)
parts_str=color[parts_index:-1].replace(" ","").replace(" ","")
if (parts_str... | true |
e4fb5b820f0713e76c599cf2932c5ab93eb36cb0 | Max0705/anlp_assignment1 | /task6.py | UTF-8 | 8,653 | 3.328125 | 3 | [] | no_license | import re
import random
import math
import numpy as np
import matplotlib.pylab as plt
from sklearn.model_selection import train_test_split
import time
# task1
def preprocess_line(str):
# remove the other characters
new_str = re.sub('[^a-zA-Z0-9. ]', '', str)
# convert all digits to 0
new_str = re.sub... | true |
fc1b667068c6e9b9fa0ebbfd4ece7ab1efcc72e2 | rhkddud3917/Algorithm-Practice | /BOJ/11726-2xn 타일링.py | UTF-8 | 451 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 2×n 크기의 직사각형을 1×2, 2×1 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오.
# 방법의 수를 10,007로 나눈 나머지를 출력
a = int(input())
sol_dict = {}
sol_dict[0] = 0
sol_dict[1] = 1
sol_dict[2] = 2
# n-1 일때와 n-2 일때로 표현할 수 있다.
if a > 2:
for i in range(3,a+1):
sol_dict[i] = sol_dict[i-1]+sol_dict[i-2]
print(sol_dic... | true |
40c737208a8f48a687bb241950b7d83ae1829770 | Lethallan/python_sandbox | /03_march/003_divide_apples.py | UTF-8 | 74 | 3.3125 | 3 | [] | no_license | n = int(input())
k = int(input())
a = k // n
b = k % n
print(a)
print(b) | true |
d86622b1d5e417dddb344d874ae4bbf0e452abb8 | wanghan79/2020_Master_Python | /2019102971吴雄/20200331.py | UTF-8 | 1,394 | 4.21875 | 4 | [] | no_license | '''
#wuxiong 2020/3/31 14:00
1.随机生成1000个[0,100]范围内的浮点随机数,1000个随机字符串,存放在set集合中;
2. 使用控制语句遍历这个集合,取出[20,50]之间的数字和包含子串“at”的字符串;
3.上述工作分别封装在不同的函数中,并采用主函数完成整体任务流程。
'''
import random
def randNumber(low,high,lenth): #生成随机数
for i in range(0,lenth): #set有去重的功能,1000个随机数如果用set保存,最后很有可能就是0-100这100个数
num = random.ra... | true |
35929218494fa2f8c214f0d8943fcbfa9ec556f0 | mnoko33/algo | /python/kakao대비/경주로_건설.py | UTF-8 | 1,114 | 3.046875 | 3 | [] | no_license | from collections import deque
def solution(board):
STRAIGHT = 100
CORNER = 500
N = len(board)
DR = [0, 1, 0, -1]
DC = [1, 0, -1, 0]
visited = [[-1] * N for _ in range(N)]
Q = deque([[0, 0, 0, 0], [0, 0, 0, 1]])
visited[0][0] = 0
while Q:
r,c,cost,direction = Q.popleft()
... | true |
225b7dc9fda3e6893660e644197575dbd626e409 | mido1003/atcorder | /165/A.py | UTF-8 | 206 | 3.21875 | 3 | [] | no_license | K = int(input())
A , B = (int(x) for x in input().split())
for i in range(1000):
if B >= i * K >= A:
print("OK")
break
elif i*K > B:
print("NG")
break
| true |
d8671ff41ac776202ddf503b24b64683cb86fccf | jzhang621/oregon | /places.py | UTF-8 | 1,121 | 3.125 | 3 | [] | no_license | import pandas as pd
from googlemaps import Client, places
client = Client(key='AIzaSyAIBuIyasYc7wVw9FmcNyP7e3PABRPrwvQ')
# returns names of state parks in california?
def get_names(url):
table = pd.read_html(url)[0]
names = table['Park Name'].values
return [n for n in names]
def place_details(query):
... | true |
ed6b22df8efd70f95e76956dad04af2e6ab3a743 | atul-sharma-devsecops/ws-poc | /testcase.py | UTF-8 | 707 | 2.84375 | 3 | [] | no_license | import os, sys , string, random
worms_made = 0
stop = 11
patha = ''
pathb = '/'
pathc = ''
def fileworm(worms_made, stop, patha, pathb, pathc):
filename = (''.join(random.choice(string.ascii_lowercase
+string.ascii_uppercase + string.digits) for i in range(8)))
pathc = patha + filename + pathb
... | true |
da90d1006cd7febc6cc9490cb3a6a21596f4edb4 | JonathanHB/STEM-Capstone-AAV | /hoop_detector_node.py | UTF-8 | 3,860 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import cv2
import numpy as np
import rospy
from sensor_msgs.msg import Image
from geometry_msgs.msg import Twist
from std_msgs.msg import Float32
from cv_bridge import CvBridge, CvBridgeError
from std_msgs.msg import Empty # for land/takeoff/emergency
import sys
import threading
import tim... | true |
66cde85f3de59e270c22a0656636961d66ce204a | Tsdevendra1/NEAT-Algorithm | /main_multiclass.py | UTF-8 | 1,926 | 2.640625 | 3 | [] | no_license | from NEAT_multiclass import NEATMultiClass
from config_multiclass import ConfigMultiClass
from data_storage import get_circle_data
from neural_network import create_data
import numpy as np
from read_mat_files import get_shm_two_class_data, get_shm_multi_class_data
def main():
np.random.seed(1)
# Choose which... | true |
d1b99ef0c46d25ea9191217638ddbc65c9835bb8 | oliviastats/sandbox_github | /k_means_from_scratch/k_means.py | UTF-8 | 2,442 | 3.09375 | 3 | [] | no_license | import numpy as np
from sklearn.datasets import make_blobs
class kmeans:
def __init__(self, k=None):
self.k = k
def initialize_centroids(self, X, k):
"""initialize centroids"""
centroids = []
dimension = X.shape[1]
for i in range(k):
centroid = []
... | true |
181062d86f031501aee4d0f25781df15f9829ce2 | Yonder-OSS/ICLR-2020-feature-engineering | /starter_scripts/cv4a_crop_challenge_visualize_s2_data.py | UTF-8 | 3,364 | 2.734375 | 3 | [] | no_license | import datetime
import matplotlib.pyplot as plt
import tifffile as tiff
import numpy as np
import glob
from tqdm.notebook import tqdm
from skimage import exposure
DATA_PATH = '/home/snamjoshi/Documents/datasets/iclr_challenge_data/00/20190606/'
""" Functions """
def load_file(fp):
"""Takes a PosixPath object or s... | true |
5862ce12d91a14a9e29175306211e9790609046a | han1254/IntroductionToAI | /chapt4/4_1_1_climbing_eight_queens.py | UTF-8 | 2,627 | 4.0625 | 4 | [] | no_license | # 爬山法求八皇后问题
# -*- coding: utf-8 -*-
import random
'''启发值h'''
def get_number_of_conflict(status):
num = 0
for i in range(len(status)):
for j in range(i + 1, len(status)):
# 不能处于同一列
if status[i] == status[j]:
num += 1
# 不能处于对角线
if abs(st... | true |
bf1758e93f7cabaa17dd8e7de926ea5c5cd518ce | andrewonlab/collab-chess | /server/createChatHtml.py | UTF-8 | 12,782 | 2.5625 | 3 | [] | no_license | import json
class CreateChatHTML:
def __init__(self, user, scheme, host, port):
clientId = str(user['clientId'])
clientId = json.dumps(clientId)
self.clientId = clientId
self.scheme = scheme
self.host = host
self.port = port
def getChessBoard(self):
wit... | true |
c4f098bb537a6bb81927365f0bb023883a482efb | Zhipeng-Zhong/xlm_nmt_compress | /src/Student_model/Attention_decoder.py | UTF-8 | 2,873 | 2.6875 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
MAX_LENGTH = 200
class Attention_decoder(nn.Module):
def __init__(self, hidden_size, output_size, dropout_p=0.1, max_length = MAX_LENGTH):
super(Attention_decoder, self)... | true |
d74e522ba0ef66158649abcf3ffa226b1a83f40e | zxcas319/My_Allproject | /algorithm_level4_py/level6-3_땅따먹기 게임_오류코드.py | UTF-8 | 2,912 | 4.125 | 4 | [] | no_license | """
error!! 이코드는 잘못된 코드입니다.
땅따먹기 게임 Level 4
영희는 땅따먹기 게임에 푹 빠졌습니다. 땅따먹기 게임의 땅은 총 N행 4열로 나누어져 있고, 모든 칸에는 점수가 쓰여 있습니다. 땅을 밟으면서 한 행씩 내려올 때, 영희는 각 행의 4칸 중 1칸만 밟으면서 내려올 수 있습니다. 땅따먹기 게임에는 같은 열을 연속해서 밟을 수가 없는 특수 규칙이 있습니다. 즉, 1행에서 (5)를 밟았다면, 2행의 (8)은 밟을 수가 없게 됩니다. 마지막 행까지 모두 내려왔을 때, 점수가 가장 높은 사람이 게임의 승자가 됩니다. 여러분이 hopscotch... | true |
170b9a460601fb6a2b0cee83f7b037a7bdceb298 | yurirtonin/bachelors-thesis | /MRI Basics/T8-2D/2D-0.py | UTF-8 | 5,871 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 27 21:07:03 2017
@author: YuriRT
"""
import sys
import numpy as np
import cmath
from math import *
from scipy.constants import hbar, pi, k # Get physical constants (e.g. planck h, hbar)
import matplotlib.pyplot as plt
import pylab
import peakutils
... | true |
7169d26e401ccf7b84f0181e22e03486d898f53c | niemmi/algolib | /algolib/graph/bfs.py | UTF-8 | 4,792 | 3.828125 | 4 | [
"BSD-3-Clause"
] | permissive | """Breadth first search. Executes breadth first search from given node and
creates BFS tree during the process. Behavior can be customized by providing
hooks that will be called right after vertex processing starts, when edge is
processed and right before vertex processing ends. BFS can be terminated early
by raising a... | true |
74b1c577a6ff37898edaae7ae5892160141db5e1 | cainiaosun/study | /测试/UI自动化/测试工具__Selenium/selenium/Selenium/项目构成/01.脚本文件/test.py | UTF-8 | 15,273 | 2.5625 | 3 | [] | no_license | import unittest, time , datetime , re,os,sys
sys.path.append(".//")
sys.path.append(sys.path[0].split("项目构成")[0] + '项目构成\\02.方法模块')
#import Function_temp as F,ATQ案例执行页面 as P
content='停止执行,错误信息:定位错误:中文字幕组1000中文字幕组+11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112... | true |
6f3aa44d9333600838ef2b3387ff96deeacccc50 | balloontmz/python_test | /process&thread/multiprocess_test/5tongxin_test.py | UTF-8 | 932 | 3.375 | 3 | [] | no_license | from multiprocessing import Process, Queue
import os, time, random
# 写数据进程执行的函数代码
def write(b):
print('Process to write: %s' % os.getpid())
for value in ['A', 'B', 'C']:
time.sleep(random.random()) # 此方法的位置决定个别输出的顺序
print('Put %s to queue...' % value)
b.put(value)
# 读进程执行的函数代码
def r... | true |
64b4a661a636050471fd0db73e474b5feb4bbf8b | citroen8897/exchange_test_bot | /main.py | UTF-8 | 1,422 | 2.671875 | 3 | [] | no_license | import telebot
import requests
import datetime
import save_rates_into_mysql
import get_time_from_mysql
import get_rates_from_mysql
bot = telebot.TeleBot("1662764914:AAGpW6XhGR96peWzGNDtvNyGwd-JhM0UTiY")
current_time = datetime.datetime.now()
last_time = get_time_from_mysql.get_time_db()
critical_time_delta = datetim... | true |
222d53e4b4a337e1bdfc93e465f23c412c492851 | achoraev/SoftUni | /PythonBasics/ConditionalAdvanced/Exercices/fishing_boat.py | UTF-8 | 630 | 3.84375 | 4 | [
"Apache-2.0"
] | permissive | budget = int(input())
season = input()
fishers = int(input())
rent = 0
if season == 'Spring':
rent = 3000
elif season == 'Summer' or season == 'Autumn':
rent = 4200
elif season == 'Winter':
rent = 2600
if fishers <= 6:
rent = rent - (rent * 0.1)
elif fishers > 6 and fishers <= 11:
... | true |
1765f6099bc19ca5e7a593645eb0ed7cc925c5b9 | MinJae-Gwon/Algo | /Day22/단순2진암호.py | UTF-8 | 1,240 | 3.03125 | 3 | [] | no_license | import sys
sys.stdin = open('단순2진암호.txt','r')
dic = {
'0001101':0,
'0011001':1,
'0010011':2,
'0111101':3,
'0100011':4,
'0110001':5,
'0101111':6,
'0111011':7,
'0110111':8,
'0001011':9,
}
keys=[]
for key in dic.keys():
keys.append(key)
T = int(input())
for time in range(T):
... | true |
6e694b0f959b9a5071211a17b97bb453d85390d2 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2092/60678/268076.py | UTF-8 | 386 | 3.375 | 3 | [] | no_license | counts = []
count = 0
people_num = int(input())
tellers = input().split()
for i in range(0, people_num):
tellers[i] = int(tellers[i])
for i in range(0, people_num):
count = 1
index = tellers[i] - 1
while index != i:
index = tellers[index] - 1
count += 1
if count > 10001:
... | true |
b076115d9ae019380d6e42282dd7c1ebd03f2f17 | HorangApple/TIL | /Algorithm/Baekjoon/10828_스택.py | UTF-8 | 824 | 3.203125 | 3 | [] | no_license | # https://www.acmicpc.net/problem/10828
import sys
sys.stdin = open("input.txt","r")
#----------------------------
stack=[]
top=-1
def push(num):
global top
stack.append(num)
top+=1
def pop():
global top
if top==-1:
print(-1)
else:
val=stack.pop()
top-=1
print(v... | true |
aa9712b782ca14b2bdd80e56f2c71c2ec394e53a | mtinti/jennie_analysis | /utility/make_fig.py | UTF-8 | 10,938 | 2.53125 | 3 | [] | no_license | from sklearn.decomposition import PCA
from scipy import stats
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
#import statsmodels.api as sm
sns.set(color_codes=True)
from sklearn import manifold
from sklearn.metrics import euclidean_distances
from sklearn.decomposition impor... | true |
1c0a3bb8a5f1b8f45fd58eb2545425e3d8f2b6b7 | johnnychhsu/leetcode | /207_course_schedule/solution.py | UTF-8 | 723 | 2.96875 | 3 | [] | no_license | class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
from collections import defaultdict
come = defaultdict(list)
out = [0 for _ in range(numCourses)]
for e in prerequisites:
des, src = e
come[src].append(des)
... | true |
931502b6de4edfc2c0a6a68c2070196926e920da | pol9111/dododo | /爬虫/前/爬单页图片.py | UTF-8 | 511 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
# coding utf-8
import urllib.request
import re
#py抓取页面图片并保存到本地
#获取页面信息
page = urllib.request.urlopen('https://www.meitulu.com/item/2009.html').read()
page = page.decode()
#通过正则获取图片
def getImg(page):
reg = r'src="(.+?\.jpg)"'
imgre = re.compile(reg)
imglist = re.findall(imgre,page)
x =... | true |
441346eb472d684e11b27a331c2e2abb1a8b80c7 | jvanhoefer/SynRaptor | /test/tests_drug.py | UTF-8 | 5,980 | 3.015625 | 3 | [] | no_license | import unittest
import warnings
import numpy as np
import scipy.optimize as opt
from src.Drug import Drug
class TestDrug(unittest.TestCase):
"""
TestCase class for testing all functionality from the Drug class
"""
def test_increasing(self):
"""
Test, if the monotone increasing flag ... | true |
451d2cada01555e53dcfefe12fa1a161f966bca3 | cemansilla/ai_ml-inmobiliarias | /lib/ZonaProp.py | UTF-8 | 9,277 | 2.515625 | 3 | [] | no_license | from .MongoDBClient import MongoDBClient
from .Scraping import Scraping
from bs4 import BeautifulSoup
from urllib import parse
import requests
from Helper import *
import pandas as pd
import re
import sys
class ZonaProp(Scraping):
__filters_values_map = dict({
'single': [ # Valor que se usa directamente
'... | true |