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 |
|---|---|---|---|---|---|---|---|---|---|---|
357acd3f0eba7b82d296b30d9506d0c1d77b7a83 | sguazt/connect4 | /connect4.py | UTF-8 | 7,907 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# Copyright 2015 Marco Guazzone (marco.guazzone@gmail.com)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... | true |
799f0aed1b832c62a84fe13abd76bba34247e981 | sam-roth/autobind | /tests/test_module.py | UTF-8 | 3,329 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive |
import module
import pytest
def test_constructor():
# TODO: constructor docstrings
k = module.Keywords(1, 'abcd', 'efg')
assert k.foo == 1
assert k.bar == 'abcd'
assert k.baz == 'efg'
def test_constructor_docstring():
doc = module.Keywords.__doc__.strip()
assert doc == '(foo: int, bar: const char *, baz: std:... | true |
9be6449cc380a07cd9dd974273df2ba785320edc | Vishnuprasad-Panapparambil/Luminar-Python | /my_works/my_work_dictionary/dictionary_in_dictionary.py | UTF-8 | 231 | 2.6875 | 3 | [] | no_license | dict={101:{"name":"vishnu","desig":"developer"},102:{"name":"yedhu","desig":"analyst"},103:{"name":"anu","desig":"analyst"}}
print(dict)
dict1={}
lst=[]
for k,v in dict.items():
dict1=v
lst.append(v)
print(dict1)
print(lst) | true |
ee582c1e485ed660ce5ccbd1ab5c495deacc2a90 | Aliensixteen/py | /2326 你吃胖了吗?.py | UTF-8 | 258 | 2.890625 | 3 | [] | no_license | a,b = [float(i) for i in input().split()]
bmi = a / (b **2)
if bmi < 18.5 :
print('偏瘦')
if 18.5 <= bmi < 24 :
print('正常')
if 24 <= bmi < 28 :
print('偏胖')
if 28 <= bmi < 30 :
print('肥胖')
if 30 <= bmi :
print('重度肥胖') | true |
04bddff15a1ab80dfe59e66c731ccbdbe9e3b9cc | susong987/rascil | /util/pol_aprojection_sympy.py | UTF-8 | 1,185 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | from sympy import *
from sympy.physics.quantum import Dagger
init_printing(use_unicode=True)
# Need the following to fold the conjugates. See
# https://stackoverflow.com/questions/48754975/simplification-of-derivative-of-square-using-sympy
from sympy.core.rules import Transform
fold_conjugates = Transform(lambda f: 2... | true |
9b0cf2b668fbc0193881a062d5fdd3ace8dbc04f | GauravRoy48/MNIST-Digit-Recognition | /segregator_train_set.py | UTF-8 | 2,324 | 3.34375 | 3 | [] | no_license | #####################################################################################
# Creator : Gaurav Roy
# Date : 12 June 2019
# Description : The code creates .png files from the pixel matrix of dataset
# and splits them into the corresponding folder.
###############################... | true |
93842bab244ed52230c318c491008c435745f8e9 | jjm7/DLFinalProj | /feature_creator.py | UTF-8 | 7,672 | 2.640625 | 3 | [] | no_license | import sqlite3
import dataset
from datetime import datetime
import collections
import numpy as np
# from fixNames import vectorizeList #uncomment
import random
def write_features_to_csv():
data_dir = 'data_1/'
businesses = get_valid_businesses()
business_ids = [] # to hold list of business_ids
j=1
for row in busi... | true |
3f1c153860591b22d0fcd289fbf91b93f6b33543 | keyi/Leetcode_Solutions | /Algorithms/Python/Different-Ways-to-Add-Parentheses.py | UTF-8 | 1,164 | 3.078125 | 3 | [] | no_license | class Solution(object):
def diffWaysToCompute(self, input):
"""
:type input: str
:rtype: List[int]
"""
def getExp(tokens):
nums, ops, temp = [], [], 0
for x in tokens:
if x.isdigit():
temp = 10 * temp + int(x)
... | true |
0199367ac23ae5b9a94bd7ac886c7de2baaa1026 | anushka23g/Twitter-sentiment-Analysis | /twitter.py | UTF-8 | 1,376 | 3.046875 | 3 | [] | no_license | #import numpy as np
import pandas as pd
from textblob import TextBlob
"""
def processTweet(self,tweet):
tweet = re.sub(r'\&\w*;', '', tweet)
tweet = re.sub('@[^\s]+','',tweet)
tweet = re.sub(r'\$\w*', '', tweet)
tweet = re.lower()
tweet =re.sub(r'\s\s+', ' '... | true |
f3152d0268172100083c378b551dd82fb14f09bb | edoardore/ShootLessSketchMore | /DataUtils/prepare_data.py | UTF-8 | 517 | 2.65625 | 3 | [] | no_license | import urllib.request
def download(nums=''):
with open(nums+".txt", "r") as f:
classes = f.readlines()
classes = [c.replace('\n', '').replace(' ', '_') for c in classes]
print(classes)
base = 'https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/'
for c in classes:
cls... | true |
aadae3cd9e7c5d6e706dfde3f1bb3564d1661f09 | rumd3x/PSP-POC | /dev-mocks/pspnet.py | UTF-8 | 2,320 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Wrapper which exports the pspnet API on non-PSP systems."""
__author__ = "Per Olofsson, <MagerValp@cling.gu.se>"
import time, thread
from socket import gethostbyname, gethostname
class Error(Exception):
"""Base class for exceptions in this module."""
def __init__(self, value):
... | true |
76c0fd2c7f9ffd1552ff0022a15ba2ae307ba788 | weitingchou/jagereye | /framework/jagereye/streaming/modules/display_modules.py | UTF-8 | 2,354 | 2.984375 | 3 | [] | no_license | """Modules to display video streams."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
from jagereye.streaming.modules.base import IModule
class DisplayModule(IModule):
"""The video stream displaying module.
The stream displaying mod... | true |
0686770c200d4fe8e1c101dcff51738c55dd0d26 | gisselleroldan/Digital-Crafts | /Python/Labs/py102.py | UTF-8 | 689 | 4.28125 | 4 | [] | no_license | # lists
# myAnimals = ["horse", "dog", "cat", "pot belly pig"]
# myAnimals[1] = "wolf"
# myAnimals[3] = "cow"
# print(myAnimals)
# numAnimals = len(myAnimals) #4
# print(numAnimals)
#to do list
# todos = ["walk the dog", "pick the kids up", "grocery shopping"]
# index = 0
# complete = ""
# while True:
# ... | true |
54d336966c3517f650488440accc8cc49d3765ae | yuningning520/yuningning520 | /Translate-zhcn-6.2.30.py | UTF-8 | 62,937 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Leatrix Plus 6.2.30 zhCN
# Leatrix Plus translation script
from __future__ import unicode_literals
# String replacement function
def ReplaceFunc(findReplacePairs):
inF = open(filePath, "rb")
fContent = unicode(inF.read(), "utf-8")
inF.close()
for pair in findReplac... | true |
e91d3883635cd8ddc1d2281e9c899dbbfae4091a | MrHamdulay/csc3-capstone | /examples/data/Assignment_4/brdlia004/boxes.py | UTF-8 | 688 | 3.640625 | 4 | [] | no_license | def print_square():
print(5*"*")
for i in range(5-2):
print("*"+" "*(5-2)+"*")
print(5*"*")
def print_rectangle(width, height):
print(width*"*")
for i in range(height-2):
print("*"+" "*(width-2)+"*")
print(width*"*")
def get_rectangle (width, height):
if height... | true |
6525c1619f09fa50dd99a0db881093b14b3b30b8 | philipco/mcm-bidirectional-compression | /src/deeplearning/NnModels.py | UTF-8 | 9,358 | 2.890625 | 3 | [
"MIT"
] | permissive | """
Created by Philippenko, 26th April 2021.
All neural network use for DL.
"""
import torch
from torch import nn
import torch.nn.functional as F
import torch.nn.init as init
from torch.nn.modules.loss import _WeightedLoss
from torchvision.models.squeezenet import Fire
class LogisticLoss(_WeightedLoss):
"""This ... | true |
52ad17f92d582f0b79d3597dc4971e26495037bd | zzx04025/EE660_FINAL_PROJECT | /Trainfeature_nm.py | UTF-8 | 1,929 | 3.390625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
Linear Regression Example
=========================================================
This example uses the only the first feature of the `diabetes` dataset, in
order to illustrate a two-dimensional plot of this regre... | true |
6361f5cd8e2691396063d96f51a521a4b4a8ab0b | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_200/2267.py | UTF-8 | 976 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
T = int(input())
for t in range(1, T + 1):
N = int(input())
S = str(N)[::-1]
LIMIT = len(S) - 1
flipped = False
for d in range(len(S)):
S = str(N)[::-1]
LIMIT = len(S) - 1
for i in range(LIMIT):
if S[i] < sorted(S[i+1:])[::-1][0]:
... | true |
383af83790510dc30bd3740b9d5fa886d9144782 | freelawproject/juriscraper | /juriscraper/opinions/united_states/state/arizctapp_div_2.py | UTF-8 | 1,646 | 2.703125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | """
Scraper for Court of Appeals of Arizona, Division 2
CourtID: arizctapp_div_2
Court Short Name: arizctapp_div_2
Author: Andrei Chelaru
Reviewer: mlr
History:
2014-07-23: Created by Andrei Chelaru
2021-12-10: URL changed to recent opinions page, satsuki-chan
"""
from juriscraper.lib.string_utils import clean... | true |
ce1400b639048e0de6fc4d4df746046d089b9b4a | programmer2215/Login-project | /User.py | UTF-8 | 320 | 2.84375 | 3 | [] | no_license | class User:
def __init__(self, username, emailid, password):
self.username = username
self.emailid = emailid
self.password = password
def validpass(self, password):
if self.password == password:
return True
else:
return False
| true |
dd7443469cf450c43e5b63e444376c49b9f46578 | StudyForCoding/BEAKJOON | /16_DynamicProgramming1/Step04/wowo0709.py | UTF-8 | 312 | 2.96875 | 3 | [
"MIT"
] | permissive | t = int(input())
waveband = [0]*101
waveband[0:4] = [1,1,1,2,2]
for test in range(t):
n = int(input())
if n in range(waveband.index(0)):
print(waveband[n-1])
continue
for wb in range(waveband.index(0),n):
waveband[wb] = waveband[wb-1] + waveband[wb-5]
print(waveband[n-1]) | true |
1d35d5a5bd596b619c04398f5db5651990b9f1ab | vigneshpalanivelr/python-pattern-programs | /Pattern Program numeric pyramid.py | UTF-8 | 311 | 3.234375 | 3 | [] | no_license | def pattern_num_pyramid():
n = int(input("Enter the number: "))
b = ""
for i in range(1, n+1):
a = i
print(str(b) + str(a))
b += str(a)
a += 1
for j in range(n-1, 0, -1):
print(b[:j])
pattern_num_pyramid()
"""
1
12
123
1234
123
12
1
"""
| true |
bc6f474f4a4449d50ea09f041bb57b973e2a0ebc | m7catsue/Scrapy_douban_movie | /doubanmovie/middlewares.py | UTF-8 | 796 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import logging
import random
from scrapy.downloadermiddlewares.useragent import UserAgentMiddleware
from scrapy.utils.project import get_project_settings # To get settings from settings.py
class RandomUserAgentMiddleware(UserAgentMiddleware):
"""
从user_ag... | true |
5e9a9b84f3bea3f6d9a3b70763e2493685a2f7fb | hilalsidhic/python_basics | /average.py | UTF-8 | 169 | 3.359375 | 3 | [] | no_license | number1=input("enter 3 numbers")
number2=input()
number3=input()
average=((int(number1)+int(number2)+int(number3))/3)
print("average of three number is :"+str(average)) | true |
587bb3601c06ae11412112ecca6bddbdff7c3564 | nezra/Picorder | /ui/widgets/background.py | UTF-8 | 1,998 | 2.703125 | 3 | [] | no_license | from ui.widgets.sprite import LcarsWidget
import pygame
import config
from pygame.font import Font
from ui import colours
class LcarsBackground(LcarsWidget):
def update(self, screen):
screen.blit(self.image, self.rect)
self.dirty = False
def handleEvent(self, event, clock):
pas... | true |
9ebdc3f3263f67a28e489364502f60dd1527b6ad | mounirchebbi/holbertonschool-higher_level_programming | /0x0B-python-input_output/3-to_json_string.py | UTF-8 | 180 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python3
"""function from string-to-JSON """
import json
def to_json_string(my_obj):
"""Return the JSON representation of a string"""
return json.dumps(my_obj)
| true |
63866e5b590525d79d6d1f5a6e3c9fdf00e61cf6 | abzcoding/aptdetector | /tests/test_cuckoo.py | UTF-8 | 902 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | """docstring"""
import unittest
from bs4 import BeautifulSoup
def test_cuckoo():
with open("tests/test_cuckoo.html") as f:
soup = BeautifulSoup(f.read(), 'html.parser')
information = soup.find(id="information")
print("--------------informations--------------")
for ch in information... | true |
fc0e417818809c0367d5420e148a7c6af7af9d66 | HongDaeYong/codingStudy | /tobby/6.greedy/05.py | UTF-8 | 241 | 2.671875 | 3 | [] | no_license | def solution(routes):
answer = 1
routes.sort()
m = 30001
for r in routes :
if r[0] > m :
answer += 1
m = r[1]
if r[1] < m :
m = r[1]
return answer | true |
5d6a80602e597e87ea3a8ff97b7f0854fa5db371 | jamesjiang52/Advent-of-Code-2018 | /Days/Day 5 - Alchemical Reduction/Part 2.py | UTF-8 | 1,124 | 3.671875 | 4 | [
"MIT"
] | permissive | def length_reduced(string_list):
continue_ = True
while continue_:
continue_ = False
i = 0
while i < len(string_list) - 1:
if string_list[i].islower():
if string_list[i + 1] == string_list[i].upper():
del string_list[i:i + 2]
... | true |
ffc41ff5ecdae6f29bf010d3c815ce5cb1580793 | viveksingh407/TestGit | /testgit.py | UTF-8 | 369 | 2.90625 | 3 | [] | no_license | import os
def print_hello_world():
test = 'Hello World!!!'
file_path = os.path.join('D:\\TestApplications\\TestGit', "test_hello_world.txt")
with open(file_path, 'wb') as test_file:
test_file.write(test)
with open(file_path, 'r') as test_file:
test = test_file.read()
print test
if ... | true |
1af43a1ffe6bc07d07296f18585cd8d6815a4900 | robot-nan/GameLogParse | /statistics_tables/loss_analyse/user_level_lost_state.py | UTF-8 | 4,590 | 2.625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""
整体用户等级流失情况
注册时间 开始时间 20100919 结束时间 20100920
查询时间 开始时间 20100920 结束时间 20100923
"查询说明:
1.若输入注册时间,则查询表示查询注册玩家在查询时间段活跃用户的信息
2.若不输入注册时间,则查询表示查询在查询时间段的活跃用户信息"
游戏分区 总区服/一区/二区 (可以查单独的渠道,也可以查所有渠道,区服之间可进行多个同时选择)
渠道名称 所有 (可以查单区,也可以查所有区,渠道之间可进行多个同时选择)
整体用户等级流失情况
等级 停留人数 留存人数 流失人数 到达人数 等级流失率
1 65 9 5... | true |
9baf883e9c2c8bfb08c7fe20824a55a4ec36c419 | gabbygege/python_course2 | /course 2/fungsi.py | UTF-8 | 494 | 4.03125 | 4 | [] | no_license | #hitung luas segitiga
alas = 10
tinggi = 6
luas_segitiga = alas * tinggi / 2
print(f'Segitiga dengan alas ={alas} dan tinggi ={tinggi} memiliki luas ={luas_segitiga}')
alas = 20
tinggi = 2
luas_segitiga = alas * tinggi / 2
print(f'Segitiga dengan alas ={alas} dan tinggi ={tinggi} memiliki luas ={luas_segitiga}')
#fun... | true |
cf64d46b2c953d6a135fb2859f99e151b6b740b1 | Carlzkh/CrazyPythonNotes | /exercise/four/4.8.py | UTF-8 | 375 | 3.8125 | 4 | [] | no_license | """
8、打印出所有的“水仙花数” 所谓“水仙花数”,是指 一个三位数,其各位数字的立方和等
于该数本身 例如, 153是 个“水仙花数”,因为 153=1^3+5^3+3^3
"""
for i in range(100, 1000):
a = i // 100
b = (i // 10) % 10
c = i % 10
if a*a*a + b*b*b + c*c*c == i:
print('这个是水仙花数:', i)
| true |
5dbdbda8baffb22205ec483454991c4eee7296ab | ForritunarkeppniFramhaldsskolanna/Keppnir | /2021/problems/teningasafn/submissions/accepted/atli.py | UTF-8 | 671 | 2.84375 | 3 | [] | no_license | #!python3
mod = 10 ** 9 + 7
n, k = [int(x) for x in input().strip().split()]
fct = [1 for i in range(k + 2)]
for i in range(1, k + 2):
fct[i] = fct[i - 1] * i % mod
B = [1 for i in range(k + 1)]
for i in range(1, k + 1):
sm = 0
for j in range(i):
sm += fct[i + 1] * pow(fct[j], -1, mod) * pow(fct[... | true |
0bef908c85cf2009a238a8841c09d5e912d9303c | QuentinDuval/PythonExperiments | /thorough/ImageOverlap.py | UTF-8 | 2,181 | 4.03125 | 4 | [] | no_license | """
https://leetcode.com/problems/image-overlap/
Two images A and B are given, represented as binary, square matrices of the same size.
(A binary matrix has only 0s and 1s as values.)
We translate one image however we choose (sliding it left, right, up, or down any number of units), and place it on top
of the other i... | true |
b1f16c387abf066e287aa5e233c7f93142d96df4 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_96/1353.py | UTF-8 | 812 | 2.96875 | 3 | [] | no_license | import sys
def getByS(b):
return (b-2)/3+2
def getByNS(b):
return (b-1)/3+1
n = int(sys.stdin.readline())
for i in range(n):
line = sys.stdin.readline()
line = line[:-1].split()
scores = []
for l in line:
scores.append(int(l))
n = scores[0]
s = scores[1]
p = scores[2]
... | true |
1336afe44919b862cf304e2232328c7ff27cc46f | Pandinosaurus/ensae_teaching_cs | /src/ensae_teaching_cs/faq/faq_matplotlib.py | UTF-8 | 14,576 | 3.34375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
@file
@brief Quelques problèmes récurrents avec `matplotlib <http://matplotlib.org/>`_.
"""
import numpy
def graph_style(style='ggplot'): # pragma: no cover
"""
Changes :epkg:`matplotlib` style.
@param style style
.. faqref::
:tag: matplotlib
:... | true |
60ce644f398326795f784d4b10aa0e44d5abfa52 | miguel-kjh/Facility-location | /solver.py | UTF-8 | 5,278 | 2.859375 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
from collections import namedtuple
from gurobipy import *
import math
import re
Point = namedtuple("Point", ['x', 'y'])
Facility = namedtuple("Facility", ['index', 'setup_cost', 'capacity', 'location'])
Customer = namedtuple("Customer", ['index', 'demand', 'location'])
def ... | true |
0c2ae2e546eac9e202e1aec0f2faf062747bdb2d | Monamounika/Python | /Percentage.py | UTF-8 | 153 | 3.609375 | 4 | [] | no_license | num1=int(input("Enter the num :"))
num2=int(input("enter the percentage :"))
num3=(num1*num2)/100+num1
print(num2,"%of",num1,"is:",num3)
print(num3/12) | true |
c14cb262808eb5bc759f4c7e9637235691005ead | kkondo1981/rnn-lang-model | /ptb/gentext.py | UTF-8 | 3,918 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
RNN言語モデルによる文章生成
[Usage] python ./ptb/gentext.py
- 実行前にlearn.pyでモデルを学習・保存しておくこと。
実行時のディレクトリ構成は、下記想定:
```
current dir(*)
|
├── ptb
| └── gentext.py : this script
|
└── model : model dir
```
上記以外の構成で実行する場合には、適宜PATHの値を修正して実行すること。
"""
import re
import numpy as np
import ... | true |
703a44443af081ba1281fa48512743950f3ff1e5 | vitorinoguilherme/python-learning | /curso-01-python/exercicios/desafio-30-numParOuImpar.py | UTF-8 | 242 | 3.90625 | 4 | [] | no_license | """
numParOuImpar.py - Informa se o número digitado é par ou ímpar
autor: Guilherme Vitorino
04.04.20 - 21h44min
"""
numero = int(input("Informe um número: "))
if numero % 2 == 0:
print("Número é Par.")
else:
print("Número é Impar.") | true |
9c4f8faf3e4fe8e6a8243ba1777c6be21191568c | TayeeChang/algorithm | /滑动窗口/findAnagrams.py | UTF-8 | 1,610 | 3.65625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2021/4/25 14:04
# @Author : haojie zhang
# 438. 找到字符串中所有字母异位词
"""
给定一个字符串 s 和一个非空字符串 p,找到 s 中所有是 p 的字母异位词的子串,返回这些子串的起始索引。
字符串只包含小写英文字母,并且字符串 s 和 p 的长度都不超过 20100。
说明:
字母异位词指字母相同,但排列不同的字符串。
不考虑答案输出的顺序。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/find-all-anagrams-in-a-string... | true |
073913a74d61e08baa9dfae67635c2c3532e8194 | linzimu/sword2offer | /binary_tree/sword2offer_17.py | UTF-8 | 695 | 3.515625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def HasSubtree(self, pRoot1, pRoot2):
# write code here
if not pRoot1 or not pRoot2:
return False
tmp1 = self.HasSubtree(pRo... | true |
a24afaacec0261025833ccd81358ba2676731d50 | cbernet/cmgtools-lite | /H2TauTau/python/harvest/dataset.py | UTF-8 | 3,715 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python
import os
import subprocess
import re
import shutil
import fnmatch
import pprint
from backends import lyonXRD
class Dataset(object):
info_pattern = re.compile(r'.*(\d{6})/(.*)/(.*)/(.*)$')
def __init__(self, path_or_info, subdirs='*', tgzs='*',
fhandler=lyonXRD):... | true |
5a43e096b5c956d8142d780160a03b601afeeb5e | victomteng1997/SENA_project_Ethereum | /Ethereum/test.py | UTF-8 | 169 | 2.53125 | 3 | [] | no_license | f = open('test.html','r')
content = f.readlines()
f.close()
print(content)
final = content[0].split('\\n')
f = open('new_test.html','w')
f.writelines(final)
f.close()
| true |
997818fa6e7a092f4fc70de35a83e609236f63fd | JoaoPauluu/Edutech | /Desafio da festa do Edvaldo/desafio_da_festa.py | UTF-8 | 6,993 | 3.40625 | 3 | [] | no_license | from time import sleep
usuario_admin = False
fichas_usuario = 0
caixa_geral = 1000
jogos = {
'Milho Verde': 0,
'Sonho': 0,
'Churrasquinho': 0,
'Morango': 0,
'Correio Elegante': 0,
'Pebolim': 0,
'Tiro ao Alvo': 0,
'Fliperama': 0,
'Cadeia': 0,
'Pipoca': 0
}
jogos_lista = list(jogo... | true |
89d91f8d236a66928dcfa82b34d6bd02946c40b8 | klin1344/AidenLabComputationalChallenge | /Challenge1A/sol1a.py | UTF-8 | 1,591 | 3.90625 | 4 | [] | no_license | """
Aiden Lab Computational Challenge 1A
Author: Kevin Lin
"""
import sys
import itertools
import math
def can_reach_value(lower_bound, upper_bound, target, buckets):
"""
Given a lower bound, upper bound, target value, and list of buckets, generates
Cartesian products of from length lower_bound to upper_bound wit... | true |
aa486d3f34947aa59d58df0c1cfcbac9a2e278ab | Aasthaengg/IBMdataset | /Python_codes/p02921/s561338081.py | UTF-8 | 128 | 3.25 | 3 | [] | no_license | def main():
s = input()
t = input()
count=0
for i in range(0,3):
if s[i]==t[i]:
count+=1
print(count)
main() | true |
00fb2481339d6e5582447a0d3aa66665a23236c7 | saierding/leetcode-and-basic-algorithm | /leetcode/二叉树/Binary Tree Zigzag Level Order Traversal.py | UTF-8 | 1,476 | 4.28125 | 4 | [] | no_license | # 103. Binary Tree Zigzag Level Order Traversal
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# 和广度遍历一样的思路,就是在判断一下是否是奇数层或者偶数层即可
# 迭代就是将每一层的node存储进一个队列。
# 当还存在queue时,循环这个队列,将上一层的node出队列并且将这一层的左子树右子树进队列。
def zigzagL... | true |
17fce2146ac1589de81bd9e04bdf69787117123d | PBarna/Codecool | /python-data-visualisation-lutra_nebouxii-master/gif.py | UTF-8 | 190 | 2.6875 | 3 | [] | no_license | from PIL import Image, ImageDraw
img = Image.new('RGBA',(100, 100))
draw = ImageDraw.Draw(img)
draw.ellipse((25, 25, 75, 75), fill=(255, 0, 0))
img.save('test.gif', 'GIF', transparency=0) | true |
4b142a1d89e2a24130eb9a7149abd83e82526eba | vitorkei/IME-USP | /IA/lista 3/teste.py | UTF-8 | 490 | 2.90625 | 3 | [] | no_license | if __name__ == '__main__':
d = {}
e = {'(3, 3)' : 3, '(4, 4)' : 100}
print "e"
print e
print "\nfor i in e"
for i in e:
print "i = ", i
print "\nfor i in e.items()"
for i in e.items():
print i
print"\nfor i in e: print e[i]"
for i in e:
print e[i]
print "\nd ", d
d['(1, 1)'] = 0
e ... | true |
d817444707f97493a750d74a59a9fb0d4224c9a1 | vishalbelsare/argonet | /lib/preprocessing/gft_preprocess.py | UTF-8 | 7,529 | 2.953125 | 3 | [] | no_license | ''' Preprocess Google Flu Trends data for each US state that has ILI data.
The relevant time period for GFT in this study is 2012-09-30 to 2015-08-09.
There are four options to scale GFT to state ILI over this time period:
in-sample: GFT over this period is directly scaled to the corresponding ILI.
fixe... | true |
cde9a9333c83456d31a45730d7b07ba0ef78363a | Dasem/psu | /cripta/utils/step.py | UTF-8 | 489 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
# coding: utf8
import sys
if ('help' in sys.argv):
print('Using: ./step.py [osn] [deg] [mod]')
exit(0)
if (len(sys.argv) == 4):
osn = int(sys.argv[1])
deg = int(sys.argv[2])
mod = int(sys.argv[3])
else:
deg=int(input('Input deg: '))
osn=int(input('Input osnovanie: '... | true |
f301d169724f8c617af5fd1128ff024e40b4b037 | AdityaSingh17/HackerRank-Solutions | /Python/09. Errors and Exceptions/02. Incorrect Regex/Solution.py | UTF-8 | 232 | 3.34375 | 3 | [
"MIT"
] | permissive | # Incorrect Regex
# Problem Link: https://www.hackerrank.com/challenges/incorrect-regex/problem
import re
for _ in range(int(input())):
try:
re.compile(input())
print("True")
except:
print("False")
| true |
8488d3f66108809e90fc97875d50eb72911b5ddc | Sherkdavid/kubernetes_project | /web/web.py | UTF-8 | 862 | 2.84375 | 3 | [] | no_license | from flask import Flask
import time
import redis
import json
app = Flask(__name__)
def getResultForKey(key):
#get all entries stored in (time, polarity) tuple
entries = db.lrange(key,0,-1)
polarity = 0.0
i = 0.0
for entry in entries:
polarity+=float(eval(entry.decode("utf-8"))[1])
... | true |
8cbefc0934d8e2921ad598d034728e24e514b6dd | FabianSuarezBotero/TrabajosPython | /py4_comprension/sumatoria.py | UTF-8 | 107 | 2.921875 | 3 | [] | no_license | A = [4, 6, 8]
B = [2, 2, 2]
C = [1, 2, 3]
n=len(A)
print (sum(((A[i]*B[i])+C[i])for i in range (n))+n**2) | true |
ee2e5b9d56f0c197554329c77bfc6e96f78ea865 | CD3/pyArrhenius | /ArrheniusIntegral.py | UTF-8 | 3,768 | 2.875 | 3 | [] | no_license | #! /usr/bin/python
import mpmath as mp
import numpy as np
from scipy.optimize import brentq,minimize,minimize_scalar
import multiprocessing as mproc
def ArrheniusIntegralTrapezoid(t,T,A,Ea):
'''
Calculates the Arrhenius integral for a time-dependent temperature profile for a
given set of A and Ea coefficients us... | true |
c1ace7c529f0135e97ffd157f981021a9bfbcc00 | coderlongren/Scrapy | /myPython/tieba_spider.py | UTF-8 | 1,453 | 2.9375 | 3 | [
"MIT"
] | permissive | #-*- coding:utf-8 -*-
# 识别中文
import urllib2
import requests
import sys
def load_page(url):
'''
get html of url
'''
user_agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36"
headers = {"User-Agent":user_agent}
'''
req... | true |
0d33f102bf7519afb01680818743a55bfe936806 | r-fle/ccse2019 | /level1.py | UTF-8 | 1,592 | 4.53125 | 5 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
from pathlib import Path
ANSWER = "dunno_yet"
###########
# level 1 #
###########
print("Welcome to Level 1.")
print("ASCII, encodings. Letters into numbers. Numbers into letters.")
print("---\n")
"""
A fundamental computer science concept is that of encoding
How do we represent some useful o... | true |
6eda12ab8b80ac980cfd14e6d78732e6908bddfa | HaziqyWqjiq/MyProjectPython | /Programme Result/Revers.py | UTF-8 | 39 | 2.890625 | 3 | [] | no_license | name = 'Coklat'
print(name[ : : -1]) | true |
475bf22b0b13db6eab72682dd36968e9b9e635f3 | lch172061365/Computational-Physics | /Project4/4e.py | UTF-8 | 3,540 | 3.109375 | 3 | [] | no_license | import time
import numpy as np
from numpy.random import rand
import matplotlib.pyplot as plt
def init_state(N):
''' generates a random spin configuration for initial condition'''
# np.random.randint(2, size=(N,N)) generate random number and return as a list
state = 2*np.random.randint(2, size=(N... | true |
14e07f770acc37cf8147702c727cb311b2473c5d | mdash12/covid_analysis_mapreduce | /SparkCovid19_1.py | UTF-8 | 1,410 | 3.109375 | 3 | [] | no_license | import sys
from datetime import datetime
from pyspark import SparkContext, SparkConf
import time
def valid_date(word):
try:
curdate = datetime.strptime(word[0],"%Y-%m-%d")
if date_begin.value <= curdate and curdate <= date_end.value:
return (word[1],int(word[3]))
except:
print("Exception invalid entry in... | true |
dce3d8fa66fffca0562a84228d0ceb1a9c35a6c0 | Krish-Mahajan/Python-Codes | /CrackingtheCodingInterview/Tree&Graphs/Vertex.py | UTF-8 | 1,455 | 3.078125 | 3 | [] | no_license | '''
Created on Jan 9, 2016
@author: Krish
'''
import sys
import os
import unittest
class Vertex(object):
def __init__(self,key):
self.id=key
self.connectedTo={}
self.color='white'
self.distance=sys.maxsize
self.pred=None
self.discovery=0
self.finish=... | true |
534afc2ba900b732178b0cf25cef66c2efeb27b0 | rashidulhasanhridoy/Prime-Number-Problem-in-Python-3 | /Prime1.py | UTF-8 | 323 | 3.984375 | 4 | [
"Apache-2.0"
] | permissive | #this program will check a number is prime or not.
N = int(input(''))
for i in range(N):
X = int(input(''))
if X == 1:
print(X, 'Not Prime')
else:
for i in range(2, X):
if X % i == 0:
print(X, 'Prime')
break
else:
print(X, 'Prim... | true |
e860b786de76aeca53656a188f6e1d6826de84d1 | ingconti/python_exercises_polimi | /Ex_session_02/code/ex2.1_find_vowels_for_and_in.py | UTF-8 | 293 | 4.125 | 4 | [] | no_license | #Write a program that receives in input a string value and outputs the number of uppercase vowels it contains:
s = str(raw_input())
len = len(s)
upperCaseVowels = "AIOUE"
vowelsCount = 0
for i in range(0, len):
if s[i] in upperCaseVowels:
vowelsCount+=1
print(str(vowelsCount))
| true |
573a5c95d11db2dddbf7f137589d281fb42b182b | gaqzi/ansible-inventory | /ansible_inventory/utils.py | UTF-8 | 1,130 | 2.734375 | 3 | [] | no_license | import datetime
from functools import wraps
import json
import os
def file_cache(cache_file, timeout=300):
def decorator(func):
''' http://stackoverflow.com/a/1594484/68035 '''
@wraps(func)
def wrapped(self=None):
now = int(datetime.datetime.now().strftime('%s'))
st... | true |
bbe3f3da17d25406424a0efda6500a11a76ac953 | myers/winship_schedule | /export_winship_schedule_to_google_calender.py | UTF-8 | 1,897 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python3
import datetime
import time
import winship_schedule
import google_calender
WINSHIP_HOUSE_CALENDER_ID = 'maski.org_rphaqm5b55daqion1cubolqfpk@group.calendar.google.com'
def list_calenders():
service = google_calender.get_calender_service()
res = service.calendarList().list().execute()
... | true |
57ac381983475b17dd7c83666c7d54aab39c9da4 | xaviranik/HackerRank | /python/strings/design_door_mat.py | UTF-8 | 402 | 3.25 | 3 | [] | no_license | n, m = list(map(int, input().split()))
cm = 1
mid = int(n/2) + 1
for i in range(1, n+1):
if i == mid:
x = int((m - 7)/2)
print('-' * x + 'WELCOME' + '-' * x)
elif i < mid:
x = int((m - 3 * cm)/2)
print('-' * x + '.|.' * cm + '-' * x)
cm += 2
elif i > mid:
cm ... | true |
a63eabd37411530f04b13ffbe9071d8544081494 | srilekha-peace/Linked-List | /Check if two linked lists are identical.py | UTF-8 | 1,296 | 3.890625 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.dfield = data
self.afield = None
class Linkedlist:
def __init__(self):
self.head = None
def insert(self, data):
new_node = Node(data)
if self.head is None:
self.head = new_node
return
new_no... | true |
f73c94a58661558f44e0a0698254cef5877646fe | RajVhora/GSTR2A-File-Merger | /GenerateCombinedFiles.py | UTF-8 | 658 | 2.890625 | 3 | [] | no_license | import pandas as pd
import os
Header = ["GSTIN of supplier","Trade/Legal name of the Supplier","Invoice number","Invoice type","Invoice Date","Invoice Value (₹)","Place of supply","Supply Attract Reverse Charge","Rate (%)","Taxable Value (₹)","Integrated Tax (₹)","Central Tax (₹)","State/UT tax (₹)","Cess (₹)","C... | true |
085d4bb1f901cc84bf5e74670bac0068e48524fa | pradelson95/Game- | /prueba.py | UTF-8 | 943 | 3.125 | 3 | [] | no_license | from time import sleep
import random
import colorama
list = ["piedra", "papel", "tijeras"]
Jugar = input("\033[1;34m\n[*] Elige entre (piedra, papel o tijeras): " + "\033[1;m")
Ataque = random.choice(list)
if Jugar=="piedra" and Ataque=="papel":
print("Evaluando juego")
sleep(2)
print("Pied... | true |
5652b3977605d73dc1c1c88d01f76da6c96ae25d | aceiii/advent-of-code-2016 | /day10a.py | UTF-8 | 2,075 | 3.125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import re
from collections import defaultdict
class Bot(object):
def __init__(self):
self.values = []
self.low_to = None
self.high_to = None
def __repr__(self):
return "{0}".forma... | true |
33c0c05e7d72970c20744495b03b5651638fb3f8 | jssellars/API_test_WooCommerce | /Helpers/request.py | UTF-8 | 2,693 | 2.65625 | 3 | [] | no_license | from woocommerce import API
import configparser
from os.path import join, dirname
config = configparser.ConfigParser()
config.read(join(dirname(__file__), 'config.cfg'))
class Request:
def __init__(self):
"""
http://woocommerce.github.io/woocommerce-rest-api-docs/
"""
consumer_ke... | true |
6463b20b63a7e39e1a421fa918b7fce6b15558a1 | hew-and-eye/markov-stories | /python-backend/mkst/mkst.tornardo.py | UTF-8 | 1,552 | 2.5625 | 3 | [] | no_license | import tornado.ioloop
import tornado.web
import json
from mkst_request_handlers.StoryListHandler import StoryListHandler
from mkst_request_handlers.CreateStoryHandler import CreateStoryHandler
# just leaving this here just in case I need a stripped down request handler as an example
class MainHandler(tornado.web.Requ... | true |
f9964d5a4df5224746ff4f73227c8a5cbbb464c1 | rcakes/surg_res_proficiency | /analyze_data.py | UTF-8 | 3,758 | 2.9375 | 3 | [] | no_license | # system libraries
import numpy as np
import json
from collections import Counter
#from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy import Column, Integer, String, Date
# project libraries
from resident import Resident
from attending import Attending
from case import Case
from database import D... | true |
f6b0d35ee609ce8562df86ffac62a83d868701e0 | atamanje/SPENVIS_NG_py | /apidemo2.py | UTF-8 | 2,289 | 2.640625 | 3 | [] | no_license | import sapi
import random
import string
import time
def randomword(length):
return ''.join(random.choice(string.lowercase) for i in range(length))
# Some variables must be defined by the user here.
## User name. Should be the same than the one in the config file.
username = 'iggg'
## Project name where the execut... | true |
515a4dfd1afbec79295f50acc8b559cf2052f87b | mitrofun/topverbs | /topverbs/console.py | UTF-8 | 2,463 | 3.28125 | 3 | [
"MIT"
] | permissive | import sys
import collections
class Colors:
HEADER = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
RED = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def output_horizontal_bold_bolder(style, length_bolder):
sys.stdout.write(style)
pr... | true |
6bd2f1866d501ac781f6688f533a840f70205f66 | hilla4/facial-testing | /python/Add_encode.py | UTF-8 | 3,635 | 2.890625 | 3 | [] | no_license | # USAGE
# import the necessary packages
from imutils.video import VideoStream
import imutils
import time
from imutils import paths
import face_recognition
import pickle
import cv2
import os
name = input("Enter Name of the person: ")
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__fil... | true |
b7628a6d1c593e0b61e313bef353f16553863058 | akosasante/Quizbowl-Packet-Reader | /testing gui.py | UTF-8 | 3,762 | 2.875 | 3 | [] | no_license | from Tkinter import *
import pymysql
import msvcrt
import time
import re
import random
# initiates variables for pymysql connection
connection = pymysql.connect(host="localhost",
user="root",
password="island",
db="quizbowl",
charset="utf8",
cursorclass=pymysql.cursors.DictCursor)
# initiates the cursor and then sele... | true |
ef101b673ca4c50c44d86ffd39b656d88156a19a | alexander-matsievsky/HackerRank | /All_Domains/Python/Sets/py-set-mutations.py | UTF-8 | 703 | 2.9375 | 3 | [
"MIT"
] | permissive | import sys
def window(iterable, n):
window = []
for x in iterable:
if len(window) >= n:
yield window
window = []
window.append(x)
if len(window) > 0:
yield window
[_, A, _, *operations] = list(sys.stdin)
A = set(map(int, A.strip().split(' ')))
operations =... | true |
903e392118b12010ce73ff164d84fd56ea3b6576 | tsvaditya27/iotlab | /PHT Sensors.py | UTF-8 | 485 | 2.578125 | 3 | [] | no_license | import sys
import BME280lib as BME
import time
sys.path.append('/home/pi/Adafruit-Raspberry-Pi-Python-Code-legacy/Adafruit_MCP230xx')
while True:
(chip_id,chip_version) = BME.readBME280ID()
print "Chip ID :", chip_id
print "Version :", chip_version
temperature, pressure, humidity = B... | true |
49e3f414331568f43c65f4fb23c2aae6e74cce6e | odonnell31/python-mathematics | /calculate/nudge_points.py | UTF-8 | 1,768 | 3 | 3 | [] | no_license | import math
import random
from django.contrib.gis.db.models.query import GeoQuerySet
def nudge_points(geoqueryset, point_attribute_name='point', radius=0.0001):
"""
A utility that accepts a GeoQuerySet and nudges slightly apart any
identical points.
Nothing is returned.
By default, the distance of the move i... | true |
e47d7656a82f4dbb41622e62c08c7e5c78ed0164 | Akzhan12/pp2 | /TSIS 1/3.py | UTF-8 | 39 | 3.203125 | 3 | [] | no_license | x = 5
y = "John"
print (x)
print (y) | true |
0a1d5c92ea4bec17c8029f304bff06e65d92f2ed | Faiznurullah/HacktoberFest-Python | /codes/textToSpeech.py | UTF-8 | 535 | 3.28125 | 3 | [] | no_license | # IMPORTING MODULE
import pyttsx3
# INITIALIZING AND SETTING PROPERTIES
eng = pyttsx3.init()
# print(eng.getProperty("rate"))
eng.setProperty("rate", 125)
voices = eng.getProperty("voices")
while 1:
text = input("Enter the text u want to hear: ")
voiceChoice = int(input("\nPlease select the gender of the u wa... | true |
490317c3df13bf94f3735bfb896527196e1c4723 | arunkarthik1406/airbnb | /airbnb analysis.py | UTF-8 | 1,909 | 3.015625 | 3 | [] | no_license | import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
os.chdir('/users/arunkarthik/Downloads')
pd.set_option('display.max_rows',1000)
pd.set_option('display.max_columns',1000)
pd.set_option('display.width',1000)
d... | true |
0dc4cf606959b2ee3739917ed46d5c74b0b44d30 | MwlLj/scriptbase | /get_md5.py | UTF-8 | 521 | 3.109375 | 3 | [] | no_license | # encoding=utf8
import hashlib
import file_encoding
class CGetMd5(object):
def __init__(self):
self.m_md5 = None
def calc_md5(self, src):
self.m_md5 = hashlib.md5()
if type(src) == type(""):
self.m_md5.update(src.encode("utf8"))
else:
self.m_md5.update(... | true |
f71b455cc6df6f9b82e994aecce5168130fa9158 | caiocaldeira3/t20-roll20-sheet | /scripts/power/create_power_template.py | UTF-8 | 691 | 2.671875 | 3 | [] | no_license | import sys
import pyperclip as pyclip
from pathlib import Path
base_path = Path(__file__).resolve().parent
sys.path.append(str(base_path.parent.parent))
import base
print("Cole aqui o ID do poder que irá criar o template:")
print("(Caso CTRL-V não cole o ID do poder recomendo testar CTRL+SHIFT+V)")
power_id = inpu... | true |
975d00d9f27187ec06101c32fdf8845172f32abc | nilzmoradi94/ABSA-TF | /src/utils.py | UTF-8 | 382 | 2.84375 | 3 | [] | no_license | from collections import Counter
def freq_dist(tokens):
c = Counter()
for t in tokens:
c.update(t)
return c
def w_index(counter, start_idx=3):
w_idx = {w: i + start_idx for i, (w, c) in enumerate(counter.most_common())}
return w_idx
def df2feats(df, colname, w_idx):
data = df[colname]... | true |
4f246b7e3263063472565f06eb940556f037e3ab | lanecatm/AlgoTrading | /quant_analysis/LinearVWAPQuantAnalysisUnitTest.py | UTF-8 | 2,197 | 2.59375 | 3 | [] | no_license | # -*- encoding:utf-8 -*-
# ==============================================================================
# Filename: VWAPQuantAnalysisUnitTest.py
# Author: Xiaofu Huang
# E-mail: lanecatm@sjtu.edu.cn
# Last modified: 2016-11-04 16:00
# Description: VWAPQuantAnalysis单元测试
# =============================================... | true |
2c42b31bd6f5e978fb26bd9f8328816be6da739b | mirror-less/pySCATMECH | /pySCATMECH/local.py | UTF-8 | 3,900 | 2.921875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | import SCATPY
from pySCATMECH.model import *
from pySCATMECH.mueller import *
class Local_BRDF_Model(Model):
"""
A class for handling local BRDF Models (ones that return differential
scattering cross section of isolated particles
"""
def __init__(self, *args, **kwargs):
"""
Create ... | true |
7f97672ce3aea2d865bdf0309fc47cd5a7c210f8 | yu4763/CodingInterview | /1.배열_문자열/1.2.py | UTF-8 | 376 | 3.0625 | 3 | [] | no_license | from collections import Counter
if __name__ == '__main__':
s1 = input()
s2 = input()
counter1 = Counter(s1)
counter2 = Counter(s2)
if counter1-counter2:
print("순열관계가 아님")
else:
print("순열관계")
#itertools, permutations 을 이용해 순열모두 만들어서 check도 가능
#list(map("".join, permutation(str... | true |
2dd8703dcd68ee8001f72393524efed61f277e93 | Aurora-yuan/Leetcode_Python3 | /1013 将数组分成和相等的三个部分/1013 将数组分成和相等的三个部分.py | UTF-8 | 517 | 3.421875 | 3 | [] | no_license | #label: maths difficulty: easy
"""
思路:
从头到尾 线性扫描,如果能找到当前这一段的和cur==target,那就给count + 1, 然后归零cur
如果扫完了发现刚好有三个count,就代表True。
"""
class Solution:
def canThreePartsEqualSum(self, A: List[int]) -> bool:
target = sum(A) // 3
cur = 0
count = 0
for i in A:
cur += i
... | true |
06b97dd7b2bbcb35f5edad5608aee80a99269731 | Wimplex/BinarySegmentationNet | /execute.py | UTF-8 | 2,320 | 2.8125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
# Функция отрисовки примеров после предсказания
def plot_samples(samples, y_true, y_pred):
fig, axes = plt.subplots(2, 5)
i = 0
for row in axes:
for... | true |
899b0e0f5e7159261178501f1f8875638d678fe8 | GabriellaSassoli/Advent_code_2020 | /venv/Day_1/Day_1.py | UTF-8 | 801 | 3.859375 | 4 | [] | no_license |
def two_product (numbers):
for i in range(len(numbers)):
for j in range(i,len(numbers)):
if ( numbers[i] + numbers[j] == 2020):
product = numbers[i] * numbers[j]
return product
def three_product(num):
for i in range(len(numbers)):
for j in range(i,... | true |
6aa49a16605e73725406bd3da0db335d4ebdb274 | James-Wetton/Py-Artificial-Intelligence | /old.py | UTF-8 | 1,623 | 3.453125 | 3 | [] | no_license | import time
import glob
import os
x = 1
used = input("Have you used this Database before, Y/N? ")
time.sleep(x)
if used == ('Y'):
usernamecheck = 0
while usernamecheck == 0:
username = input("What name was your account entered under? ")
if username == ("restart"):
break
... | true |
4f0f55348b75254a6743d80ac6233edf1bd03d75 | almeynman/coupon_club | /coupon_scraper/coupon_scraper/spiders/besmart_spider.py | UTF-8 | 2,932 | 2.640625 | 3 | [] | no_license | from datetime import datetime
from scrapy.http import Request
from scrapy.spider import Spider
from scrapy.selector import Selector
from coupon_scraper.items import DealItem
from coupon_scraper.spiders.utils import clean_extract, get_numbers_from_string, drop_html_tags
# def clean_extract(some_selector,xpath_of_info... | true |
232acac3b2a9424e04d5ddad61129fa7d06c6d34 | awesome-archive/python-utils | /make_mosaic.py | UTF-8 | 1,342 | 3.046875 | 3 | [
"MIT"
] | permissive | import numpy as np
import math
def find_rectangle(n):
max_side = int(math.sqrt(n))
for h in range(2, max_side+1)[::-1]:
w = n // h
if (w * h) == n:
return (w,h)
return (n, 1)
# should work for 1d and 2d images, assumes images are square but can be overriden
def make_mosaic(ima... | true |
4487e72aec21da5133563b3c40a19c70f83a32d3 | jbj88817/PythonEx | /pythonic/c7.py | UTF-8 | 384 | 3.984375 | 4 | [] | no_license | # len 和 bool 能影响 class bool取值
class Test:
# pass
def __len__(self):
print('len called')
return 0 # 有了这个0就返回 False
def __bool__(self):
print('bool called')
return False # 有了这个bool函数,len就不能控制返回了
test = Test()
print(len(test))
print(bool(None))
print(bool([]))
print(bool... | true |
ddc57eb1c82a1c69c7e13fe127253bcd4d2954b3 | hwaminkim/TIL | /leetcode/295_find-median-from-data-stream/sol3.py | UTF-8 | 2,109 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | """
https://leetcode.com/problems/find-median-from-data-stream/
Using min & max heap for keeping smaller & larger values.
Main Idea:
While keeping the median value, we can dump other values in two lists -
the smaller and the larger. However, the order of input can be arbitrary,
so we should mainta... | true |
5a06b312bdeeead382d514aef2e8cf5c0d610621 | panyanyany/Python_100_Exercises | /exercises_031_to_040/036/m1.py | UTF-8 | 486 | 3.375 | 3 | [] | no_license | class TestClass:
pass
v1 = 1
v2 = 1.0
v3 = 'hello'
v4 = TestClass()
print('type(v1) = {}'.format(type(v1)))
print('type(v2) = {}'.format(type(v2)))
print('type(v3) = {}'.format(type(v3)))
print('type(v4) = {}'.format(type(v4)))
print('type(TestClass) = {}'.format(type(TestClass)))
print('-' * 20)
print('type(v... | true |