blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
79dcbcb615fe8920dfc1404f8af7f619fa51d183 | Python | adam1996/Codewars-Katas-Python | /7kyu/Find_the_divisors.py | UTF-8 | 760 | 4.375 | 4 | [] | no_license | """
Find the divisors!(7Kyu)
https://www.codewars.com/kata/544aed4c4a30184e960010f4
Create a function named divisors/Divisors that takes an integer n > 1 and returns an array with all of the integer's divisors
(except for 1 and the number itself), from smallest to largest. If the number is prime return the string '(... | true |
54698c222d31ef7964afd21ff420bd8af9dc6ced | Python | pedrosimoes-programmer/exercicios-python | /exercicios-Python/ex043.py | UTF-8 | 1,290 | 4.03125 | 4 | [
"MIT"
] | permissive | #Desenvolva uma lógica que leia o peso e a altura de uma pessoa, calcule seu Índice de Massa Corporal (IMC) e mostre seu status, de acordo com a tabela abaixo:
#- IMC abaixo de 18,5: Abaixo do Peso
#- Entre 18,5 e 25: Peso Ideal
#- 25 até 30: Sobrepeso
#- 30 até 40: Obesidade
#- Acima de 40: Obesidade Mórbida
print('-'... | true |
877a05c0f60e5034f86fa9a2de659951fced1fef | Python | mak2salazarjr/python-puzzles | /checkio/largest_histogram.py | UTF-8 | 1,289 | 4.28125 | 4 | [] | no_license | """
Input: List of all rectangles heights in histogram
Output: Area of the biggest rectangle
Example:
largest_histogram([5]) == 5
largest_histogram([5, 3]) == 6
largest_histogram([1, 1, 4, 1]) == 4
largest_histogram([1, 1, 3, 1]) == 4
largest_histogram([2, 1, 4, 5, 1, 3, 3]) == 8
How it is used: There is no way the sol... | true |
a2a7e83e220eb4aa54e594f57af2ce132dbd70b1 | Python | jnth/monitelec-reader | /monitelec_reader/log/custom.py | UTF-8 | 1,372 | 2.640625 | 3 | [] | no_license | import datetime
import logging.handlers
from logging import Formatter
from typing import Optional
class FilterOnePerMinutes(logging.Filter):
"""Only log the first message of each minutes."""
def __init__(self):
super(FilterOnePerMinutes, self).__init__(name=self.__class__.__name__.lower())
sel... | true |
71bcd832baff0fca231566007f5b069824403b39 | Python | NoaOr/GI-Project | /icarbonx_data/edit_statistics.py | UTF-8 | 770 | 3.4375 | 3 | [] | no_license | import pandas as pd
def replace_strings_to_int():
"""
The function replaces categorial values in numerical values
:return:
"""
df = pd.read_excel("statistics.xlsx")
string_values = df.gender.unique()
dic = dict(zip(string_values, range(len(string_values))))
df = df.replace(dic)
s... | true |
255fd978f15b4ee8ceac0d1b8599173f6e6a3991 | Python | RadkaValkova/SoftUni-Web-Developer | /Programming OOP Python/Exam 22082020/tests/test_room.py | UTF-8 | 720 | 3.171875 | 3 | [] | no_license | from project.rooms.room import Room
import unittest
class RoomTest(unittest.TestCase):
def setUp(self):
self.room = Room('A', 10.0, 2)
def test_initialization(self):
self.assertEqual('A', self.room.family_name)
self.assertEqual(10.0, self.room.budget)
self.assertEqual(2, self.... | true |
ff59a174dc5a742e0001d697fcf4a45e48939f91 | Python | rsuhada/code | /py/lmfit/minimizer.py | UTF-8 | 18,998 | 2.59375 | 3 | [] | no_license | """
######################################################################
# RS
This is the minimizer.py of lmfit adjusted for my needs.
Based on lmfit v0.7. for use - replace minimizer.py with this script
(don't forget to remove minimizer.pyc)
Changes should be pushed to the original.
The original minimizer.py is ... | true |
9aeff4b62a66ad3919179e7e6a0dafdcb6af8204 | Python | Ryu0w0/BERT | /model/bert/bert_layer.py | UTF-8 | 1,448 | 2.78125 | 3 | [] | no_license | """
It refers to https://huggingface.co/transformers/_modules/transformers/modeling_bert.html
"""
from torch import nn
from model.bert.bert_attention import BertAttention
from model.bert.bert_intermediate import BertIntermediate
from model.bert.bert_output import BertOutput
class BertLayer(nn.Module):
""" BertL... | true |
295e7cfd9bf9346b600df285f594b22f47b7fb9d | Python | shinv1234/data_structure | /Python3/Hash_table.py | UTF-8 | 647 | 3.5625 | 4 | [] | no_license | # Hashtable using list
class Hash_table(object):
def __init__(self, table_size = 10):
self.table_size = table_size
self._make_table()
def _make_table(self):
table = dict()
for sz in range(self.table_size):
table[sz] = []
self.table = table
def ap... | true |
212428944e5f390ecf758720e8290af236479f5e | Python | physmath17/dynamical_systems | /lorenz-system.py | UTF-8 | 1,095 | 2.671875 | 3 | [] | no_license | from runge_kutta_four import *
from numpy import sin, cos, sqrt
import numpy as np
from matplotlib import pyplot as plt
import math
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.tri as mtri
#parameters
sigma = 10
rho = 28
beta = 8/3
time = np.arange(0., 100.02, 0.05)
h = 0.02
N = 100/0.05
def plot_result... | true |
713f8c18a8da7d95ff0ac6cb46ab5cb6d7883721 | Python | s1ider/codespace-bdd | /support/ui/select.py | UTF-8 | 730 | 3.109375 | 3 | [] | no_license | from .base_element import BaseElement
class Select(BaseElement):
def __init__(self, browser, label):
locator = '//label[contains(., "{}")]/following' \
'::div/select'.format(label)
super(Select, self).__init__(browser, locator)
@property
def options(self):
# retu... | true |
a2a7cbf2d75ca714edf219c74119402a04847b32 | Python | 810410738/image | /test.py | UTF-8 | 572 | 2.859375 | 3 | [] | no_license | from PIL import Image
import numpy
from pylab import *
#读取图片到数组中
# test = Image.open('1.jpg')
# test1 = test.convert('L')
# test_band = test.getbands()
# test_band1 = test1.getbands()
# print(len(test_band))
# print(test_band[:])
# print(test.size)
# # fan xiang
# im2 = 255 - im
# im3 = (100.0/255) * im + 100
# imshow... | true |
8c6136da284ec0146d6db743dddef17c4f998675 | Python | mayankprsingh/travelling_salesman_problem | /TSP.py | UTF-8 | 7,433 | 3.046875 | 3 | [] | no_license | import itertools
import math
import sqlite3 as lite
from tkinter import Tk, Label, Button, Radiobutton, IntVar, messagebox
import tkinter as tk
import networkx as nx
import matplotlib.pyplot as plt
city = ['Ludhiana','Jalandhar','Amritsar','Chandigarh','Patiala']
lud_distance = ['0','61','140','106','93']
... | true |
05681be07798295dbdc8978203feb3e68ee2af9d | Python | baligashreya/chat | /chat.py | UTF-8 | 1,180 | 3 | 3 | [] | no_license | import operator
def a():
with open ("chat.txt", "r") as myfile:
content = myfile.readlines()
content = [x.strip() for x in content]
#print(content)
num_list = []
l1 = []
l2 = []
for w in content:
l1 = [x for x in w.split(' ')]
l2.append(l1)
#print(l2)
for ... | true |
b931d7f3bdc65e40ce8b2387b93b89ace70a3bae | Python | cyclone1517/AutomaticPoemGen | /poem/PoemGene3.py | UTF-8 | 2,475 | 3.078125 | 3 | [] | no_license | #PoemGene2: 按词性解析模板
#PoemGene3: 加入平仄和七言,分出头文件
import random
import PoemHead
#函数:从高频拆分词中取组装词
def fetchWord(wordflag, num):
word = ""
if wordflag == 'n':
word = nlist[random.randint(0, 299)]
elif wordflag == 'v':
word = vlist[random.randint(0, 299)]
if num == 1:
if random.randint... | true |
11098dfac0465e444da2d4e512c7e0739f64b9de | Python | biomanojo/supermercado | /menu_producto.py | UTF-8 | 808 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
def menu():
lista=['id nombre cantidad precio ','01 cafe 10 3500 ' ,'02 azucar 10 2500','03 arroz 15 3600','04 frijol 15 2600','05 galletas 20 3400']
datos=json.dumps(lista)
return datos
def menu_l... | true |
25cad8da0fc02e55c207c8f7fe254af0d66c1028 | Python | JIANGRENorJIANREN/scrapy_project | /doubanyingping/data_analysis.py | UTF-8 | 1,460 | 2.875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import jieba
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
import jieba.posseg as pseg
import matplotlib.pyplot as plt
# 获取数据
def get_datas(filename):
try:
with open(filename, 'r') as fp:
contents = fp.read()
return contents
except:
... | true |
8acbe7338b36eca18c4baf257fb0ed5202cd00f7 | Python | rirozizo/todaymemebot | /driver.py | UTF-8 | 2,183 | 2.875 | 3 | [] | no_license | import tweepy
import random
from datetime import datetime
today = datetime.today().strftime('%Y-%m-%d')
day = int(datetime.today().strftime('%d'))
month = int(datetime.today().strftime('%m'))
year = int(datetime.today().strftime('%Y'))
auth = tweepy.OAuthHandler("API Key", "API Secret")
auth.set_access_token("Acc... | true |
5db0b3d7e347419a53ff6be6cef5565f81cd9460 | Python | vidhuns/sample_pgm | /example_pgms/file_close.py | UTF-8 | 330 | 2.734375 | 3 | [] | no_license | import os
fp = open("C:\Vidhun\Learning\python\example_pgms\est.txt", "w+")
fp.write("inserting a line into the file")
print(fp.name)
print(fp.closed)
#s = fp.read(5)
print(fp.tell())
#print(s)
fp.close()
os.rename ("C:\Vidhun\Learning\python\example_pgms\est.txt", "C:\Vidhun\Learning\python\example_pgms\fil... | true |
5fdc54d0176104182544c61c1991ae22e1b7341c | Python | andcan/ida | /typings/tornado/options.pyi | UTF-8 | 12,227 | 2.875 | 3 | [] | no_license | """
This type stub file was generated by pyright.
"""
"""A command line parsing module that lets modules define their own options.
This module is inspired by Google's `gflags
<https://github.com/google/python-gflags>`_. The primary difference
with libraries such as `argparse` is that a global registry is used so
that... | true |
1a54390d355e2a3b039a4935f9f89d44e1c4fa2a | Python | neurale/blockchain-predictor | /neural/basic_lstm_network.py | UTF-8 | 4,167 | 2.59375 | 3 | [] | no_license | from neural_network import NeuralNetwork
import numpy as np
import math
from keras.models import Sequential
from keras.layers import *
from keras.optimizers import *
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error
class BasicLSTMNetwork(NeuralNetwork):
def __init__(self)... | true |
0a609cf3ae6f8924af324e6f76ab309885d94e94 | Python | bssrdf/pyleet | /L/LongestIncreasingSubsequence.py | UTF-8 | 5,041 | 3.75 | 4 | [] | no_license | """
Given an unsorted array of integers, find the length of longest increasing
subsequence.
For example,
Given [10, 9, 2, 5, 3, 7, 101, 18],
The longest increasing subsequence is [2, 3, 7, 101], therefore the length is 4.
Note that there may be more than one LIS combination, it is only necessary
for you to return t... | true |
27bf7bbb35cd316ce7befd8c2ede1bbd12fe02a5 | Python | KirillTim/linguistics-yandex-task | /baseline/Question.py | UTF-8 | 1,831 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class Questioner(object):
@staticmethod
def is_aux_verb(word):
return word.upper() in "AM IS ARE".split()
def get_question_word(self, word):
if word != self.get_verb_lemma(word):
return 'DOES'
else:
return 'DO'
@staticmethod
d... | true |
20902f0b20d1acae9d8e8615541bdd2be7b6f48e | Python | kakao/pycon2016apac-gawibawibo | /0813/player_kyoungyong.py | UTF-8 | 337 | 3.046875 | 3 | [
"Apache-2.0"
] | permissive | from random import choice
preReturn = ''
def show_me_the_hand(records):
if(len(records) == 0):
preReturn = choice(['gawi', 'bawi', 'bo'])
return preReturn
elif(len(records) >= 1):
if(records[0] == 'gawi'):
preReturn = 'bawo'
elif(records[0] == 'bawi'):
preReturn = 'bo'
else:
preReturn = 'gawi'
... | true |
d58dc388de36bf94468d08cdc1c898b6e271ce62 | Python | merdarking/Automation-Fruit-Catalog | /run_edited.py | UTF-8 | 2,344 | 2.8125 | 3 | [] | no_license | #! /usr/bin/python3
import os
import sys
import datetime # NEW
import reports # NEW
'''Get the description file name list in the directory'''
def get_file_list():
# Go into the path in the descriptions
path = os.path.join(os.path.dirname(sys.argv[0]),"supplier-data")
os.chdir(path)
# Get the file na... | true |
cc560b64d8a0959cd2c5e8aa931b5c6158d30700 | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc004/C/1884665.py | UTF-8 | 360 | 3.40625 | 3 | [] | no_license | def gcd(a,b):
return a if b == 0 else gcd(b,a%b)
x,y = map(int,input().split("/"))
k = gcd(x,y)
x //= k; y //= k;
flag = False
for i in range((2*x)//(y**2)-1,10000000000000):
n = i*y
m = (n*(n+1))//2 - i*x
if (n<=0 or m<=0) : continue
if (n<m) : break
print(n,m)
flag = Tr... | true |
9250e9adbed4893d3bd7c7dad44a1e662e96a7ee | Python | wfystx/LeetCodeDailyPractice | /IndexGame/56mergeIntervals.py | UTF-8 | 448 | 2.890625 | 3 | [] | no_license | #indexGame
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution:
def merge(self, intervals):
intervals.sort(key = lambda x : x[0])
res = []
for i in intervals:
if res and res[-... | true |
3f2ac7aa32c16d3f2853bdb3761ac64a6d248b42 | Python | codeinverness/AstroPi | /Data/log_data_file.py | UTF-8 | 1,684 | 2.640625 | 3 | [] | no_license | # Added heading to dataset
#Import Libraries
import datetime
from sense_hat import SenseHat
# Settings
timestamp = datetime.datetime.now()
FILENAME = ""
write_frequency = 50
# Store data until written to file
def log_data():
output_string = ",".join(str(value) for value in sense_data)
batch_data.append(output_stri... | true |
dbe0925f9f41056b9d436e29de04bee696ffdc1e | Python | veselingosp02/TPHW | /client.py | UTF-8 | 1,084 | 3.234375 | 3 | [] | no_license | import requests
import json
URL = "http://127.0.0.1:5000/api/people"
def delete(name):
requests.delete(f"{URL}{name}")
def create(name=None):
person = {"fname": name[0], "lname": name[1]}
response = requests.post(URL, json=person)
if response.ok is True:
print(response.text)
... | true |
1dd28f9eefc31cfd5c7223820aae0b3735318ff2 | Python | saboanca/workshop | /workshopDone/domain/Movie.py | UTF-8 | 2,698 | 3.390625 | 3 | [] | no_license | '''
Created on 6 mar. 2017
@author: ABoanca
'''
'''
Created on 6 mar. 2017
@author: ABoanca
'''
import re
from domain.IDObject import IDObject
from domain.ValidatorException import ValidatorException
class Movie(IDObject):
def __init__(self, objectID, name, year, website):
'''
Co... | true |
ff22db3156304d5f2b3230d0c3b88881db990831 | Python | bibiksh/Python_trainging | /2.Python_basic/Chapter08/Problem79_1.py | UTF-8 | 420 | 3.59375 | 4 | [] | no_license | #===============================================================================
# counta=0
# countb=0
# a=input()
# b=input()
# for i in a:
# counta+=1
# for i in b:
# countb+=1
# print("Larger string is:")
# if counta>countb:
# print(a)
# else:
# print(b)
#=====================================================... | true |
3f41dc727a7745e89e675c31058f0a17303fabb0 | Python | vidyarthiprashant/python-codes | /capitalize string.py | UTF-8 | 48 | 3.140625 | 3 | [] | no_license | a=input("enter string")
print(a.capitalize())
| true |
f1bfc18412a99ec45337e64ebb0a2664b766e8d5 | Python | ankitaa06/alert-tuning-tool | /alert/autoconfig.py | UTF-8 | 10,670 | 2.8125 | 3 | [] | no_license | import scipy
from scipy import stats
import numpy as np
import math
import itertools
def get_auto_config(param,internalParam,ppdrList):
"""Set docstring here.
Parameters
----------
param: dict,
this is the user parameter like start date, enddate, vertical etc
internalParam: d... | true |
91deecc9a6666419b456b9c0764158a310b29ca3 | Python | Oltier/ServerlessAtTheEdgeMeasurements | /Stats/gen_plots_edge_azure_vs_aws.py | UTF-8 | 6,640 | 2.71875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
from scipy.stats import mannwhitneyu, levene, rankdata, tiecorrect
def calc_processing_delay(row):
return row['processing_end_time'] - row['processing_start_time']
def calc_network_delay_aws(row)... | true |
c0d5ad57c54d8ff1ef20b122ea615f20de456971 | Python | pavantankasala/exercises | /Pavan/tas3_pv_classifier.py | UTF-8 | 2,182 | 3.5625 | 4 | [
"MIT"
] | permissive | """ Intial try was to extract statistical features resimbling the randomness of the feature
vector. So chose mean, variance, entropy and median as features and performed
simle classification.
Training set used was 70% of the training data and 30% was for validation ,
Used Decsion tre... | true |
a7887787a7fe636c4668c78e9ec8fc441e617f8c | Python | BryanBoni/Compilation | /dayum.py | UTF-8 | 612 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
if i%2 == 0:
print("well done bitch !")
else :
print("to bad idiot")
a = i;
b = int(input("entré la valeur de B"));
while a%b !=0 :
a, b = b, a%b
print(b)
for i in range(2,43):
a +=i;
print(a);
"""
"""
li = list()
li = [1,8,9,7,5,4998,4]
a=0
for i in li:
a+=i... | true |
e63aa33a33dca0dd7b1a036afc13ed9311c7f4ee | Python | snowdj/The-structure-of-data-and-Algorithm | /机器学习实战/kNN/简单kNN的实现/kNN.py | UTF-8 | 896 | 2.703125 | 3 | [] | no_license | from numpy import *
import operator
def createDataSet():
group = array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
label = ['A','A','B','B']
return group, label
def classify(inx, dataSet, label, k):
dataSetSize = dataSet.shape[0] #算出行数
diffMat = tile(inx, [dataSetSize, 1]) - dataSet #对应的相减
sqDiffMat ... | true |
0cb5a3286bccda37392c60435a3cf0b8538e568d | Python | yy/netconv | /netconv/encoders.py | UTF-8 | 800 | 3.203125 | 3 | [
"MIT"
] | permissive | """
encoders.py
-----------
Convert GraphData to texts.
"""
def encode_edgelist(graph, delimiter=' ', attr=False, header=False):
text = ''
if header:
text += delimiter.join([str(a) for a in graph.edge_attr[:2]])
if attr:
text += delimiter
text += delimiter.join([str(... | true |
3b2409e577ed6fa15c62616d66ee97f152d10373 | Python | MarianoSaez/Proyecto-Compu_2020 | /game.py | UTF-8 | 1,734 | 3.078125 | 3 | [] | no_license | class Game():
def __init__(self, num_players, p1, p2, diff=1, palabra='', tipo=''):
self.adivinadas = []
self.intentos = 1
self.p1 = p1
self.p2 = p2 # Posiblemente no se use
self.diff = diff
self.palabra = palabra
self.tipo = tipo
def __str__(self):
... | true |
94b25a5b4c036e7b951b10bb232ea945c419d64d | Python | tommywenjiezhang/IS609_Calculator | /Package/tests/test_calculator.py | UTF-8 | 2,181 | 3.1875 | 3 | [] | no_license | from Package.project.Calculator import Calculator
from parameterized import parameterized, parameterized_class
import unittest
from Package.project.CsvReader import CsvReader
class TestCalculator(unittest.TestCase):
@classmethod
def setUpClass(self):
self.calculator = Calculator()
@classmethod
... | true |
dac0302bb314395564bc904b009391609b843c7b | Python | wangyunpengbio/LeetCode | /51-100/053-v3-maximumSubarray.py | UTF-8 | 651 | 3.390625 | 3 | [] | no_license | class Solution:
def maxSubArray(self, nums: List[int]) -> int:
# 思想是动态规划,nums[i-1]并不是数组前一项的意思,而是到前一项为止的最大子序和,和0比较是因为只要大于0,就可以相加构造最大子序和。如果小于0则相加为0,nums[i]=nums[i],相当于最大子序和又重新计算。其实是一边遍历一边计算最大序和
# 节约的技巧和上一个思路一样,都是如果前面遍历到的子序已经变成负数就不要了,重新开始计算
for i in range(1, len(nums)):
nums[i]= num... | true |
9b8e22b9904bb6ee36d0ab6dd9580394ad894981 | Python | sabueso/python | /routerbck/bckapp.py | UTF-8 | 1,847 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
import os,datetime
################################################################################################################
##Agregar al array los routers a hacer copia
##de seguridad, generar antes claves dsa de ssh
##subirlas , e importarlas al router en cuestion
##IMPORTANTE: http://wik... | true |
e93efb0d09e9c354b36ba41378c6f021a53b7ae4 | Python | s01va/BOJ | /step_by/08/05_10250.py | UTF-8 | 261 | 2.90625 | 3 | [] | no_license | import sys
T = int(input())
for i in range(T):
H, W, N = map(int, sys.stdin.readline().rstrip().split())
Y = N % H
if Y == 0:
Y = str(H)
else:
Y = str(Y)
X = N // H
if X != N / H:
X += 1
if X < 10:
X = "0"+str(X)
else:
X = str(X)
print(Y + X) | true |
06d6d262b2e1df39d20e7b5a45f48d5ad3bdcc6e | Python | bingheimr/edX-Projects | /Problem Set 5 Problem 3.py | UTF-8 | 3,498 | 4.25 | 4 | [] | no_license | """
Problem 3 - CiphertextMessage
For this problem, the graders will use our implementation
of the Message and PlaintextMessage classes, so don't worry
if you did not get the previous parts correct.
Given an encrypted message, if you know the shift used to
encode the message, decoding it is trivial. If messag... | true |
cfe5f10109472bfe2e16262ad6c94196362607de | Python | gauravtripathi001/EIP-code | /String/Minimum Window Substring.py | UTF-8 | 596 | 3.59375 | 4 | [] | no_license | class Solution:
def minWindow(self, s: str, t: str) -> str:
l=len(t);min_value=len(s);result=""
for i in range(0,len(s)):
k=0
for j in range(i,len(s)):
if(s[j]==t[k]):
k+=1
if(k==l-1):
min_value=min(min_v... | true |
f9b1129249a38a80fb8d1875f4bfd4e7970872d6 | Python | AlwaysStudent/djangooru | /posts/utils.py | UTF-8 | 449 | 2.890625 | 3 | [
"MIT"
] | permissive | def check_duplicate(post):
look_for_duplicate = []
for i in post:
if i in look_for_duplicate:
pass
else:
look_for_duplicate.append(i)
return look_for_duplicate
def filter_tags(page_obj):
tag_name = []
for post in page_obj:
for tag in post.tags.all():... | true |
abf30b6425a1996aa42d3e736771f2fbe70b0b61 | Python | KojoAning/PYHTON_PRACTICE | /FSTRING.py | UTF-8 | 187 | 3.609375 | 4 | [] | no_license | # f string is = fast string
a= 'and i\'m '
b='stylish'
# c= 'i am srinath %s %s '%(a,b)
# c= 'i\'m srinath {0} {1}'
# n=c.format(a,b)
n = f'i\'m srinath {a} {b} {math.tan(45)}'
print(n) | true |
de6fab21086d7ffa9842bfd3d12472895380ad77 | Python | alexandreponte1/python | /automate/scriptSysAdmin/standartBiblioteca.py | UTF-8 | 67 | 2.890625 | 3 | [] | no_license | import time
now = time.localtime()
print(now)
print(now.tm_year) | true |
fb72b4ea00c4736ffc9d58698a062ebf7a9c06b5 | Python | tazbingor/learning-python2.7 | /python-basics/unit05-dictionary/py035_dict.py | UTF-8 | 1,007 | 3.84375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 17/11/17 下午8:33
# @Author : Aries
# @Site :
# @File : py035_dict.py
# @Software: PyCharm
'''
字典
'''
# 创建字典,以及字典赋值
# 1. 类似于列表和元组的赋值方式(集合)
mydict = {}
mydict = {2, 4, 6, 8}
print mydict # set([8, 2, 4, 6])
print type(mydict) # <type 'set'>
print '-' *... | true |
43d600b12bdc7d39eecfac81c889e2170280837d | Python | varundevop/varun_python | /for_ex.py | UTF-8 | 69 | 3.46875 | 3 | [] | no_license | for i in range(1, 10):
print i
else:
print "The for loop is over"
| true |
735fb96ccea5f8f90e2b4587e0e8912497c38bcb | Python | yuchandevi/ProgramPMImax | /preprocessing.py | UTF-8 | 1,045 | 3.265625 | 3 | [] | no_license | # preprocessing bahasa indonesia
# import Sastrawi package
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
# Lakukan stemming
print("1. Lakukan Stemming")
factory = StemmerFactory()
stemmer = factory.create_stemmer()
fileCorpus = open("berita3.txt", "r", encoding="utf8") #rubah corpus disini
corpusText = f... | true |
b968185257a17a96ae3f9680ec4086664f67e99e | Python | DK-afei/python | /data_analysis/matplotlib_plot_pie.py | UTF-8 | 350 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 18:08:27 2020
@author: 0xff
"""
import matplotlib.pyplot as plt
labels = ['Frogs', 'Hogs', 'Dogs', 'Logs']
sizes = [15, 30, 45, 10]
explode = [0, 0.1, 0, 0]
plt.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',shadow=False, startangle=90)
... | true |
5a8b1c852e4e5726e7902225e189161b6ae4f948 | Python | zy964c/Misc | /Py/pn_comparison.py | UTF-8 | 214 | 2.625 | 3 | [] | no_license | f = open('C:\Temp\zy964c\KAL.txt', 'r')
data = list(f)
filtered = []
for n in data:
upd = n.replace(' ', '').replace('\n', '').replace(',', '').replace('"', '')
filtered.append(upd)
print filtered
| true |
c308e2f7b650dd94ae955de276e0b702a5bc8bec | Python | kjcollins/cedar-scripts | /CEDAR/cedar_request.py | UTF-8 | 3,521 | 2.765625 | 3 | [] | no_license | # REQUESTS class imports
import requests
import urllib
class CedarRequest:
def __init__(self, host_name, api_key):
self.site = host_name
self.auth = api_key
self.request = self.http_request()
self.text = self.request.text
self.success = request_success(self.request.status_c... | true |
d36fc775b452c20124a87beb8f01f6304ec6c10c | Python | tomfa/s3-now | /src/dicts.py | UTF-8 | 1,090 | 3 | 3 | [] | no_license | import logging
from typing import Dict, Optional, Any, List
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_key_value_from_dict(data: Dict, *, keys: List[str]) -> Optional[Dict]:
keys = keys or []
pointer = data
for sub_key in keys:
if sub_key == "":
continue
... | true |
6df18f083b15b83fb294bcac742dfb3548626b78 | Python | pnxrock101/lab11 | /followOnDev.py | UTF-8 | 1,210 | 2.609375 | 3 | [] | no_license | import requests
import json
from requests.auth import HTTPBasicAuth
from getpass import getpass
from pprint import pprint
# Collect user information
username = input("Please enter your username: ")
password = getpass("Please enter your password: ")
# DevNet Sandbox URL's
baseURL = 'https://sandboxdnac.cisco.com'
auth... | true |
07ee86720d98169eff4d5e125b9791f916a4db61 | Python | hanwjdgh/MBN | /Music classification/main.py | UTF-8 | 1,028 | 2.6875 | 3 | [
"MIT"
] | permissive | import eyed3, glob, os, shutil
artists = {}
files = glob.glob("./src path/*.mp3", recursive=True)
for file_name in files:
audio = eyed3.load(file_name)
if audio.tag is None:
basename = os.path.basename(file_name)
lst = re.split("[-_]",basename)
audio.initTag()
audio.... | true |
b734eccde9dacd71b0b4431211c9c27a9c5d7cfe | Python | oaxiom/glbase3 | /bayes/learner/greedy.py | UTF-8 | 4,751 | 3.09375 | 3 | [
"MIT",
"X11-distribute-modifications-variant"
] | permissive | """Learner that implements a greedy learning algorithm"""
import time
from .. import network, result, evaluator
from ..util import *
from ..learner.base import *
class GreedyLearnerStatistics:
def __init__(self):
self.restarts = -1
self.iterations = 0
self.unimproved_iterations = 0
... | true |
3ffd5bb8307f684932edb0352326be228983b4e4 | Python | raiden-e/discord | /utils/news.py | UTF-8 | 3,179 | 2.65625 | 3 | [
"MIT"
] | permissive | import time
from datetime import datetime
import feedparser
from markdownify import markdownify as md
from . import gist
class Entry:
def __init__(self, title, text, date):
self.title = title
self.text = text
self.date = date
def __str__(self):
message = ''
clean_ti... | true |
c375ce7e34f5cc80993aed9b70d601151584c37b | Python | ald23-mod/m3c2018 | /homework/hw1/hw1_template.py | UTF-8 | 1,365 | 3.203125 | 3 | [] | no_license | """M3C 2018 Homework 1
"""
import numpy as np
import matplotlib.pyplot as plt
def simulate1(N,Nt,b,e):
"""Simulate C vs. M competition on N x N grid over
Nt generations. b and e are model parameters
to be used in fitness calculations
Output: S: Status of each gridpoint at tend of somulation, 0=M, 1=C
... | true |
54abe880b7ce900787e780e2c5ab4bbd21187e08 | Python | Mitchell-boop/gaphor | /gaphor/plugins/diagramlayout/__init__.py | UTF-8 | 7,993 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | """
This module provides a means to automatically layout diagrams.
The layout is done like this:
- First all nodes (Classes, packages, comments) on a diagram are determined
- A vertical ordering is determined based on the inheritance
- A horizontal ordering is determined based on associations and dependencies
- Th... | true |
5cbbeee910785ec517def816b451fc022d86b69d | Python | beekalam/znotes | /tests/test_FileStorage.py | UTF-8 | 4,046 | 2.71875 | 3 | [] | no_license | import os
import unittest
from datetime import datetime
from FileStorage import FileStorage
from utils import file_put_content, file_exists, read_file_content
class FileStorageTest(unittest.TestCase):
def __init__(self, methodName: str = ...) -> None:
super().__init__(methodName)
self.notes_path... | true |
5c2cda7309f56d2c52f4635ff92c3f157fbbc0e2 | Python | BenteaB/PlanBy | /Calendar/EmailReaderToPopUp.py | UTF-8 | 4,338 | 2.71875 | 3 | [] | no_license | import email
import imaplib
import re
from flask import Flask, render_template, request, jsonify
import requests
from flask_cors import CORS
import json
from datetime import date
from Errors import PlatformError, HourError
def get_body(msg):
if msg.is_multipart():
return get_body(msg.get_payload(0))
else:
... | true |
a6a1407426ece9ebe18e34d8e79743c99bc984ea | Python | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/hamming/3a67537427a845b6bc3491cfc6c1f216.py | UTF-8 | 307 | 3.5625 | 4 | [] | no_license | def hamming(a, b):
# use iterators in case of very long strings
# iterate over both lists together
# add the leftover from the longer string at the end
distance = 0
for (c_a, c_b) in zip(a, b):
if c_a != c_b:
distance += 1
distance += abs(len(a) - len(b))
return distance
| true |
23f154450b84deb87eb638b6220d1432dea8a3a5 | Python | karthikmoosha/py | /77k.py | UTF-8 | 85 | 3.515625 | 4 | [] | no_license | intgr1=int(input())
for i in range(1,intgr1+1):
if(intgr1%i==0):
print(i,end=" ")
| true |
ab112deabf33360979e86f15533f3c1c0448f5a6 | Python | WSUCS665/WSU_ALDB | /main.py | UTF-8 | 513 | 3.03125 | 3 | [
"MIT"
] | permissive | """
Tutorial: https://repl.it/talk/learn/How-to-create-an-SQLite3-database-in-Python-3/15755
"""
from modules.pysqllite import PySQLLite
from pprint import pprint
while True:
# Connect to a database
my_db = PySQLLite("database/WSU_AL.db")
statement = input("Please enter a statement: ")
my_db.execute(... | true |
278606b723fbb00f82d1e7f3a5db9d7319f1c026 | Python | Chen0Zu/MachineLearningInAction | /Mapreduce/mrMeanMapper.py | UTF-8 | 367 | 2.53125 | 3 | [] | no_license | import sys
from numpy import *
import pdb
def read_input(file):
for line in file:
yield line.rstrip()
input = read_input(sys.stdin)
# pdb.set_trace()
input = [float(line) for line in input]
numInputs = len(input)
input = mat(input)
sqInput = power(input,2)
print "%d\t%f\t%f" % (numInputs, mean(input), mean(sqInpu... | true |
b944998a23a3d29433bde680ac28bead15e4a77c | Python | Joowea/Spatial-Co-location-Pattern-Mining-Method-based-on-the-Hesitant-Fuzzy-Participation-Degree-in-Positi | /test.py | UTF-8 | 833 | 2.6875 | 3 | [] | no_license |
# h_fuzz_e 提取隶属度字符串
# h_fuzz_e_pure 提取犹豫模糊隶属度列表
# h_fuzz_e_count 获取犹豫个数
# sc 记分系数
def aac(h_fuzz_e_count, h_fuzz_e_pure):
# 犹豫个数>1 引入记分函数 —————————————————————记分系数暂写死为0—————————————————————
sc = 0.0
if h_fuzz_e_count != 1:
sum_of_h_fuzz_e1 = 0.0
sum_of_h_fuzz_e2 = 0.0
for fu_i in... | true |
7b1e97d5d478ea1d46e235e8c2d3a39af98ad9f0 | Python | SrilakshmiMaddali/PycharmProjects | /udemy/section1/filters.py | UTF-8 | 112 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
newlist = [1,2,3,4,5,6,7,8,9,20,21]
print(list(filter(lambda x: x % 2 == 0, newlist)))
| true |
62711f812cc3ae6f0929f8e0bdf2a6d4fd9a747e | Python | jpmcb/interview-problems | /ctci/3_1.py | UTF-8 | 1,563 | 4.28125 | 4 | [] | no_license | # Three in one
# --------------
# implementation: A fairly simple array that holds 3 stacks
class Multistack:
def __init__(self, stacksize):
self.numstacks = 3
self.array = [0] * (stacksize * self.numstacks)
self.sizes = [0] * self.numstacks
self.stacksize = stacksize
def push... | true |
cbd4a0901875bcf3481200b161055d9f976cee5c | Python | ny0011/algorithm | /programmers/60058_괄호변환.py | UTF-8 | 929 | 3.359375 | 3 | [] | no_license | def is_right_string(p):
stack = []
for s in p:
if s == "(":
stack.append(s)
else:
if len(stack) == 0: return False
stack.pop()
if len(stack) == 0: return True
return False
def divide_string(p):
u = ""
v = ""
count = 0
for s in p:
... | true |
49f0d0ab3d59b1199fd876c860fb863068a2e0be | Python | rociodellasala/Processor-and-analyzer-for-images | /src/GUI/modules/image_operations.py | UTF-8 | 18,199 | 2.90625 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
from PIL import Image
from math import log10, sqrt
from math import pow
MAX_PIXEL_VALUE = 255
MIN_PIXEL_VALUE = 0
L = 256
def add_grey_images(image_1_width, image_1_height, image_1, image_2_width, image_2_height, image_2):
width = int(image_1_width) if int(... | true |
d1d3189c5dd972a28f8f0f71aedb484cdf172057 | Python | TaterPropRoss/edabit-python | /milk_and_cookies.py | UTF-8 | 267 | 3.125 | 3 | [] | no_license | def time_for_milk_and_cookies(date):
Month = date.month
Day = date.day
if (Month == 12 and Day == 24):
return True
else:
return False
#is it christmas eve?
import datetime
print(time_for_milk_and_cookies(datetime.date(2013, 12, 24))) | true |
0f492f4b34ad91f54b9a48b2df268b6926b0d735 | Python | VishalSharma2001/Python-Program | /Py10.py | UTF-8 | 8,577 | 3.703125 | 4 | [] | no_license | Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
import math
>>> x=math.sqrt(25)
>>> x
5.0
>>> print(math.floor(2.8))
2
>>> print(math.ceil(2.8))
3
>>> print(math.ceil(2.1))
3
>>> print(math.po... | true |
a929f44c259fd4faee45f321be5713839b407524 | Python | PaulEG/Various-Projects | /AssyrianTaxPayments.py | UTF-8 | 4,829 | 3.21875 | 3 | [
"Artistic-2.0"
] | permissive | #The Assyrian state was composed of 27 provinces, each of which had to sumbit a fixed quota of four canonical commidities every year.
#Provinces frequently only paid a portion of their assessment. Since many of the provinces are of unclear location, one would like a
#way to calculate how similar the payment histories o... | true |
dda0d00e73a238e0f4f28882755e63eb7493733b | Python | schan3Ed/Computational-Physics | /Hw3/molecularDynamics.py | UTF-8 | 7,833 | 2.546875 | 3 | [] | no_license | import matplotlib.pyplot as plt
from scipy.special import erfinv
from matplotlib.animation import FuncAnimation
import numpy as np
import random
import math
import copy
##################### SETTINGS ########################
show_dist = False
uniform_v = False
random_position = False
uniform_position = True
boltz_v = ... | true |
7af5b1e2b140be0dfe377a16544598c4879bf40d | Python | LazarevMaxim/lab | /semestrovaya/utils.py | UTF-8 | 516 | 2.703125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
class WebUtils:
@staticmethod
def download_image(url):
r = requests.get(url, stream=True)
data = b''
if r.status_code == 200:
for chunk in r.iter_content(1024):
data += chunk
return data
... | true |
f17f90e68e25681b431f1220b6982a24e6bb491d | Python | polemon/binenc | /base16.py | UTF-8 | 590 | 3.015625 | 3 | [
"ISC"
] | permissive | #! /usr/bin/env python3
import sys
import getopt
import pprint
base16 = '0123456789ABCDEF'
# always one byte
def b16enc_block(block):
e_block = ""
e_block = e_block + base16[ ( (block[0] & 0xF0) >> 4 ) ]
e_block = e_block + base16[ (block[0] & 0x0F) ]
return e_block
# always two characters
def b... | true |
26af9261e1c9b11bc706b046b0fdf0596f4947cf | Python | etrigger/matrix-1 | /hw6.py | UTF-8 | 4,067 | 3.296875 | 3 | [] | no_license | # version code 988
# Please fill out this stencil and submit using the provided submission script.
from matutil import *
from GF2 import one
## Problem 1
# Write each matrix as a list of row lists
echelon_form_1 = [[ 1, 2, 0, 2, 0 ],
[ 0, 1, 0, 3, 4 ],
[ 0, 0, 2, 3, 4 ],
... | true |
c19cf4d8fcedeb1b6503c3741c52175df59ec6c2 | Python | yasht7/Algorithms | /4/binarysearchtree.py | UTF-8 | 4,286 | 3.578125 | 4 | [] | no_license | class TreeNode(object):
def __init__(self, key, val, left=None, right=None, parent=None):
self.key = key
self.val = val
self.leftChild = left
self.rightChild = right
self.parent = parent
def hasLeftChild(self):
return self.leftChild
def hasRightChild(self):... | true |
72bf28a99afc9f3a28bda4b9579559a4c7f7cf5b | Python | tmlrnc/axn_ml_2 | /axn/ml/market_basket_analysis/test_mba.py | UTF-8 | 6,030 | 2.5625 | 3 | [] | no_license |
from subprocess import call
#!/usr/bin/env python3
# Counselors19*
import sys
import argparse
import csv
print("start")
def lists_are_same(tsnl,csl):
i = 0
mytest = True
for ele in tsnl:
print(csl[i])
print(tsnl[i])
if tsnl[i] != csl[i] :
mytest = False
pr... | true |
3fcd14e1c53a3d2eda0d65f64f6eab1c87aca701 | Python | UWPCE-PythonCert-ClassRepos/SP_Online_PY210 | /students/chrissp/lesson04/trigrams.py | UTF-8 | 3,810 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python3
import sys
import os
import random
import string
prompt = "\n".join(("Welcome to the story maker!",
"Please input a source file name.",
">>> "))
prompt_words = "\n".join(("How many words would you like your story to be?",
">>> "))... | true |
05f1864348fe0018ef124640b6accbe6c8b88915 | Python | FaeLeFly/Programming | /Practice/11/Python/задание11.py | UTF-8 | 199 | 3.1875 | 3 | [] | no_license | import os
a=int(input())
b=int(input())
c=int(1)
if (b>=0):
while (b>0):
c*=a
b=b-1
else:
while(b<0):
c*=a
b=b+1
c=1/c
print (c)
os.system ("pause")
| true |
b409acacebfcd02e1ca8b291a81fe1316db28e16 | Python | deathweaselx86/concurrency_presentation | /processes/search.py | UTF-8 | 493 | 2.96875 | 3 | [] | no_license | import requests
from multiprocessing import Process
def search(query):
print('Searching for %s' % query)
req = requests.get('http://google.com/search', params={ 'q': query })
def get_searches(searches):
processes = []
for query in searches:
p = Process(target=search, args=(query.strip(),))
... | true |
4b287a3dea3bea4f53301115e0bf2e3c38b011f5 | Python | huosan0123/leetcode-py | /222.py | UTF-8 | 492 | 3.0625 | 3 | [] | no_license | class Solution(object):
def countNodes(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if not root:
return 0
lp, rp = root, root
lh, rh = 0, 0
while lp:
lh += 1
lp = lp.left
while rp:
rh += ... | true |
e882fb6f73f1c0cabcf8ba7e537e67fb733b1458 | Python | leejunyoung228/p | /calc.py | UTF-8 | 285 | 3.109375 | 3 | [] | no_license | def c():
n1,a,n2=input().split()
n1=int(n1)
n2=int(n2)
r=0
if a=='+': r=n1+n2
elif a=='-': r=n1-n2
elif a=='*': r=n1*n2
elif a=='/': r=n1/n2
elif a=='**': r=n1**n2
elif a=='//': r=n1//n2
elif a=='%': r=n1%n2
print(f'{n1} {a} {n2} = {r}') | true |
598c28f82ca1ed5a94e6501c2b827605e4a3fd3a | Python | KalsaHT/lc_practice | /string/5.py | UTF-8 | 1,245 | 3.265625 | 3 | [] | no_license | # coding=UTF-8
'''
@Author: httermin
@Date: 2019-12-24 12:00:29
'''
import sys
import os
sys.path.append("..")
class Solution(object):
def longestPalindrome(self, s):
"""
:type s: str
:rtype: str
"""
length = len(s)
is_palindrome_table = [[False for _ in range(length... | true |
63170caa097e40e8d3c5a3a7acf2c80300185947 | Python | Lufaja/nogmaals | /robotarm-python-2021-main/example13.py | UTF-8 | 495 | 3.140625 | 3 | [] | no_license | from RobotArm import RobotArm
robotArm = RobotArm()
robotArm.speed = 3
robotArm.randomLevel(1, 7)
# Jouw python instructies zet je vanaf hier:
for x in range(0,9):
robotArm.grab()
color = robotArm.scan()
if color != "":
for r in range(0, x + 1):
robotArm.moveRight()
robotArm.dro... | true |
0af956ee4802e0cc0ce82d1b9e86c29497e5faf2 | Python | ftao/finterpretor | /src/interpretor/ast.py | UTF-8 | 10,820 | 3.140625 | 3 | [] | no_license | #coding=utf8
#$Id$
'''
AST Moudle
抽象语法树模块,提供
# 节结点
# 叶结点
# 子/父结点查询
# 导出成图片
# 通用遍历算法
# AST 线性化?
'''
class Node:
def __init__(self, type, children=[],prod = None):
self.type = type
self.children = [x for x in children if x is not None] #filter(lambda child:isinstance(chi... | true |
0e89f86281ad0141efb539edd8847c2a121c0d3e | Python | wizzchris/PythonBasics | /oop-basics/OOP-Exercises2/MonsterInc.py | UTF-8 | 350 | 2.9375 | 3 | [] | no_license | # Psydo Code
# Do monster class
# Do student Monster Class
# I need to inhert from the monster class
from MonsterClass import Monster
from SutdentMonster import StudentMonster
james = Monster('James', 5, 'Hands')
fred = StudentMonster('fred', 5, 'Scary Hands', '4256743')
fred.setter_subjects(['Chem','bio','food tech... | true |
711edeb659406cdeb90535acb80e292fbcb76933 | Python | FlorisFok/Puplic-git | /CS50/Python/adventure/adventure.py | UTF-8 | 11,819 | 3.609375 | 4 | [] | no_license | """
THE ADVENTURE GAME,
please enter txt files in correct format
enjoy the game
for help, enter help in the game
Floris Fok
"""
from room import Room
from item import Item
from inventory import Inventory
import sys
WINNING_ROOM = 77
class Adventure():
"""
This is your Adventure game class. It should co... | true |
057680167aab1528938384bf1900caed2b5c5670 | Python | ollehu/aoc-2020 | /15/main.py | UTF-8 | 1,732 | 3.90625 | 4 | [] | no_license | """ Solution to the 15th AOC of 2020. """
from collections import deque
from sys import argv
def play_game(numbers, turns):
"""
Play the game using provided initial numbers.
Return the 2020th number.
"""
# Let board be a dict of a played number and the two last time it came up
turn = 1
... | true |
97e43cb8ae1210de5f0fad816f669b3b980f9904 | Python | manitourobotics/2012-python | /robot.py_stuff/tests/robot_test_harness.py | UTF-8 | 961 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import time
import unittest
import pygame
screen = pygame.display.set_mode((640, 400))
running = 1
while running:
event = pygame.event.poll()
if event.type == pygame.QUIT:
running = 0
screen.fill((255, 255, 255))
pygame.display.flip()
"""
Goals: Write the testing s... | true |
f03da545fd9ebefcde3e40568e7fbf0dd6b95a9b | Python | ImAlexisSaez/curso-python-desde-0 | /lecciones/18/bucles_4.py | UTF-8 | 148 | 3.140625 | 3 | [
"MIT"
] | permissive | email = input("Introduce tu email: ")
for i in email:
if i == "@":
arroba = True
break
else:
arroba = False
print(arroba)
| true |
9e1250103008e597da4fc56082824caaf541cfed | Python | velarun/Python_codes | /Algorithm/DynamicProgramming/list_dir.py | UTF-8 | 542 | 3.3125 | 3 | [] | no_license | import os
def Test1(rootDir):
list_dirs = os.walk(rootDir)
for root, dirs, files in list_dirs:
for d in dirs:
print os.path.join(root, d)
for f in files:
print os.path.join(root, f)
print("List directory with os.walk")
Test1("C:\\")
def Test2(rootDir):
... | true |
57180fc617f21856cea494ad6fca2d53bda8be14 | Python | KazukiUeno/awesomebook | /preprocess/003_aggregation/06_a/python_awesome.py | UTF-8 | 812 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | from preprocess.load_data.data_loader import load_hotel_reserve
import pandas as pd
customer_tb, hotel_tb, reserve_tb = load_hotel_reserve()
# 下の行から本書スタート
# rank関数で並び替えるために、データ型を文字列からtimestamp型に変換
# (「第10章 日時型」で解説)
reserve_tb['reserve_datetime'] = pd.to_datetime(
reserve_tb['reserve_datetime'], format='%Y-%m-%d %H:%... | true |
a813aa704156da64ecac55629b72dcab6c9f1b21 | Python | dongdong/prac | /ai/pytorch/dive_into_dl/models/ResNet.py | UTF-8 | 3,599 | 3.0625 | 3 | [] | no_license | ''' ResNet - 残差网络
- 残差块通过跨层的数据通道从而能够训练出有效的神经网络
'''
import torch
from torch import nn, optim
import torch.nn.functional as F
import utils
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class Residual(nn.Module):
'''' 残差块
- 首先,有2个有相同输出通道的3x3卷积层,
- 每个卷积层后接一个批量归一化层和ReLU激活函数... | true |
6a1ebe3d04681fd4e30b218c0a91a4f90ff159bc | Python | miguelshta21/TibiaAuto12 | /Engine/CheckWaypoint.py | UTF-8 | 577 | 2.578125 | 3 | [
"MIT"
] | permissive | from Engine.HookWindow import LocateImage
def CheckWaypoint(image, map_positions):
wpt = [0, 0]
middle_start = (map_positions[0] + 48, map_positions[1] + 48)
middle_end = (map_positions[2] - 48, map_positions[3] - 48)
wpt[0], wpt[1] = LocateImage('images/MapSettings/' + image + '.png', Precision=0.7,... | true |
437cdad3f323480a0916b4a494552e315f081f5e | Python | renegat96/chess-vision | /chess_vision.py | UTF-8 | 18,689 | 2.59375 | 3 | [
"MIT"
] | permissive | """
@authors Adam Stanford-Moore and Hristo Stoyanov
@date June 7, 2019
Stanford Universtiy CS230 Final Project
"""
import math
import argparse
import numpy as np
import random
import tensorflow as tf
from matplotlib.image import imread
from tensorflow.keras.applications.resnet50 import preprocess_input
from tensorflo... | true |
84399af70917ff8278089002b00468efdcda2852 | Python | choiHenry/shortStraddle | /model.py | UTF-8 | 2,679 | 2.90625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
dfKS200 = pd.read_csv('./kospi200_20090601_20090710.csv', header=0, encoding= 'unicode_escape',
names=['일자', '종가', '대비', '등락율','시가', '고가', '저가', '거래량', '거래대금', '상장시가총액'], index_col='일자')
print(dfKS200['종가'].describe())
plt.hi... | true |