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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
b54f28492b8e41c019e5cd22f2c6f519b09c2cec | Python | matheusgcdj/uri-solutions | /iniciante/1009.py | UTF-8 | 281 | 3.109375 | 3 | [] | no_license | #
# Uian Sol Gorgonio <sol.uian@gmail.com>
# Feb 6 2015
# 1009 - Salario com Bonus
# https://www.urionlinejudge.com.br/judge/pt/problems/view/1009
#
# ad-hoc
#
nome = raw_input()
salario = float(raw_input())
vendas = float(raw_input())
total = salario + vendas * 0.15
print 'TOTAL = R$ %.2f' % total
| true |
335d44f26c468c4c764af927d04b2b6ca4da2e02 | Python | yxu1998/miscellaneous-stuffs | /hw1.py | UTF-8 | 3,644 | 3.765625 | 4 | [] | no_license | # hw1_skel.py
# PUT YOUR NAME HERE
# Skeleton by Prof. Shai (sshai@wesleyan.edu), Sep 3 2018
"""
You can either enter your solution in this file and submit through Moodle, or print the file and write down your answers
(you can give it to me directly during Tuesday lecture or leave it in the box outside my office).
If ... | true |
113cdb9924e95e0f03ac8a09c0a34f6c05f82314 | Python | hortont424/contrasty | /src/log.py | UTF-8 | 960 | 3.125 | 3 | [
"BSD-2-Clause"
] | permissive | import time
import termcolor
class Priority:
FATAL = 4
HIGH = 3
NORMAL = 2
LOW = 1
@classmethod
def getColor(cls, priority):
return {cls.FATAL: "red", cls.HIGH: "yellow", cls.NORMAL: "green", cls.LOW: "white"}[priority]
def log(str, priority=Priority.NORMAL):
if not hasattr(log, "... | true |
59d4252ea020c8848738e81747406e6a4b4916fd | Python | tmu-nlp/100knock2016 | /osaki/chapter04/knock37.py | UTF-8 | 912 | 2.65625 | 3 | [] | no_license | #-*- coding:utf-8 -*-
import re
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
fp=FontProperties(fname='/Library/Fonts/Yu Gothic Bold.otf')
from collections import defaultdict
d=defaultdict(lambda:0)
dw=defaultdict(lambda:0)
l=list()
c=0
x=[1,2,3,4,5,6,7,8,9,10]
y=[]
label=[]
for li... | true |
3cfbb9a28a150a76b3e282cd1fcbc09f0fbf0764 | Python | yywecanwin/PythonLearning | /day08/05.__str__方法.py | UTF-8 | 1,347 | 4.34375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# author:yaoyao time:2020/1/29
class Student:
def __init__(self,name,age,gender):
self.name = name
self.age = age
self.gender = gender
pass
def study(self,course):
print(f"学习{course}")
pass
"""
是一个魔法方法,比较特殊:
1.这个方法必须返回一... | true |
0e8cffe54c4e804c09f8b2d5394b8c1a024d54c7 | Python | carlozamagni/py-Injection | /broker.py | UTF-8 | 2,319 | 2.9375 | 3 | [] | no_license | __author__ = 'cazamagni'
'''
class Broker(object):
providers = {}
@classmethod
def register_provider(cls, key, class_name, as_singleton=False):
if as_singleton:
cls.providers[key] = class_name()
else:
cls.providers[key] = class_name
@classmethod
... | true |
3171aa30ea7900879348bd190e82fcd26b678796 | Python | kuri-megane/notify-raspberry-pi-status | /slack.py | UTF-8 | 1,901 | 2.78125 | 3 | [
"MIT"
] | permissive | import requests
import credentials
from log import Log
SLACk_URL = 'https://slack.com/api/'
SLACK_MESSAGE_ENDPOINT = 'chat.postMessage'
SLACK_FILE_ENDPOINT = 'files.upload'
SLACK_CHANNEL = credentials.SLACK_CHANNEL
SLACK_TOKEN = credentials.SLACK_TOKEN
class Notify:
def __init__(self, **kwargs):
self.s... | true |
090a61d39176fbce1d053d9b5b30e5bc336f3d75 | Python | FiodorGrecu/Exercises | /introduction_and_environment/data_types_and_control_flow/3_set_difference/Solution/solution.py | UTF-8 | 94 | 2.703125 | 3 | [] | no_license | # Code your solution here
set_1 = {1,3,2}
set_2 = {2,3,1}
result = set_1 & set_2
print(result) | true |
2ca8e01fe441c17304cc084309c6defbce6829a5 | Python | saranshkmr/IrisRecognition | /WriteStringToFile.py | UTF-8 | 516 | 2.796875 | 3 | [] | no_license | import pickle
def writeNow(stringArray,outFileName):
with open(outFileName,'wb')as fp:
pickle.dump(stringArray,fp)
def writeStringToFile(stringArray):
indexFile = open("indexFile.txt", "r")
indexString = indexFile.read()
#print(indexString,"--------hello-----------------")
i = str(int(not(i... | true |
0b4c1ddc73955a8a9df1db90f5047728c7d79b0d | Python | kimdieu/nguyenkimdieu-fundamental-c4e19 | /Fundamental/Session3/enter_a_number.py | UTF-8 | 249 | 3.609375 | 4 | [] | no_license | from random import randint
y = int(input("Enter a number "))
original_y = y
counting = True
count = 0
while y > 0:
y = y // 10
# if y == 0:
# counting = False
count += 1
print("{0} has {1} digit(s)".format(original_y, count))
| true |
022274549663e327c358904d089ec02570462a9a | Python | KonroyZhu/shipping_project | /idx_project/monthly/modules/trainin/loader.py | UTF-8 | 891 | 2.734375 | 3 | [] | no_license | class Loader:
def __init__(self):
self.root="../../data/"
self.sentencePath="../../data/sentenceSeg"
self.tagPath="../../data/tag"
def load(self,name):
List = open(self.root+name).readlines()
return List
def loadSentence(self):
sentenceList = open(self.s... | true |
e209cab29b3864a29b66ae51735357dfc519af19 | Python | danb0b/code_photobooth | /python/photobooth/make_pdf.py | UTF-8 | 2,684 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Feb 22 20:15:07 2019
@author: danaukes
"""
import numpy
import cairo
import math
import time
import os
def make_pdf(image):
height, width, channels = image.shape
imagesurface = cairo.ImageSurface.create_for_data(image, cairo.FORMAT_RGB24, width, height)
pa... | true |
855f38ec8d234e2d5401d85a8cbbe565fa4ff424 | Python | Gldkslfmsd/concordance-crawler | /ConcordanceCrawler/core/eng_detect/samples/french.py | UTF-8 | 4,111 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
samples = [
"""Le français est une langue indo-européenne de la famille des langues
romanes. Le français s'est formé en France (variété de la « langue d’oïl »,
qui est la langue de la partie du nord) et est aujourd'hui parlé sur tous
les continents par environ 274 millions de personnes1,5 dont 2... | true |
cdc2a4c83a1fe89350c9eadc7e1ace526cfe148b | Python | Anshikaverma24/meraki-list-questions | /meraki list ques/q1.py | UTF-8 | 163 | 3.515625 | 4 | [] | no_license | # wap to count the number of elements without using len() function
numbers=[50, 40, 23, 70, 56, 12, 5, 10, 7]
count=0
for i in (numbers):
count+=1
print(count) | true |
ad4f66c8255ca0f2e7fc4478a83b4189b32d72dd | Python | kali-physi-hacker/KaliDb | /passTest.py | UTF-8 | 229 | 2.640625 | 3 | [] | no_license | import sys, msvcrt
password = ''
while True:
x = msvcrt.getch()
if x == '\r':
break
sys.stdout.write("*")
password += x
if x == '\b':
password += '\010'
print '\n'+password
| true |
78fd3f49a8ea1bb949659ea9de945c67fe4319bc | Python | youaresherlock/PythonPractice | /TornadoPractice/userapp/models/user.py | UTF-8 | 875 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | #!usr/bin/python
# -*- coding:utf8 -*-
class UserModel(object):
users = {
1: {'name': 'zhang', 'age': 10},
2: {'name': 'wang', 'age': 12},
3: {'name': 'li', 'age': 20},
4: {'name': 'zhao', 'age': 30},
}
@classmethod
def get(cls, user_id):
return cls.users[user_... | true |
250a77406f377323404185f7cae769d74f519e5a | Python | SilviuVultureanu/Projects | /011 London Weather Data/script.py | UTF-8 | 1,102 | 3.15625 | 3 | [] | no_license | import codecademylib3_seaborn
import pandas as pd
import numpy as np
from weather_data import london_data
print(london_data.columns)
print(london_data.head(40000))
temp=london_data['TemperatureC']
average_temp = round(np.mean(temp),2)
temperature_var = round(np.var(temp),2)
print(average_temp)
print(temperature_var)
... | true |
4d37da73f70182e0848fe56bfb0ab8542101e978 | Python | DLunin/pygraphmodels | /graphmodels/inference/inference.py | UTF-8 | 2,477 | 2.609375 | 3 | [
"MIT"
] | permissive | from ..factor import IdentityFactor
import numpy as np
from functools import reduce
import operator
def random_ordering(dgm, target):
return np.random.permutation(target)
class InferenceStrategy:
def __init__(self, gm):
self.gm = gm
@property
def arguments(self):
return list(self.gm.... | true |
594dd97869b7bf70da7f7fb32bf027e1c5f2b249 | Python | ezekieltech/Python-Skills | /BS4ReSeaborn.py | UTF-8 | 4,092 | 3.28125 | 3 | [] | no_license | # requests for fetching html of website
from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# Make the GET request to a url
url = "http://www.cleveland.com/metro/index.ssf/2017/12/case_western_reserve_university_president... | true |
41c5452a8af019ed7e0eda6936a55bc809f4ec7f | Python | dennissv/aoc-2020 | /9.py | UTF-8 | 617 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 14:29:26 2020
@author: dennis
"""
from itertools import combinations
l = [int(x) for x in open('data/9.txt').read().splitlines()]
def is_sum(p, x):
if x in {sum(comb) for comb in combinations(p, 2)}:
return True
return False
ans1 = [l[i] for i in ra... | true |
6371a368440fa2d5daeacdf9720da6509d35402c | Python | harvineet/SocialMirror | /cvsplit_auprc/randomForestScikit.py | UTF-8 | 1,535 | 2.703125 | 3 | [] | no_license | import numpy as np
from pandas import *
from sklearn.ensemble import RandomForestClassifier
def read_arff(f):
from scipy.io import arff
data, meta = arff.loadarff(f)
return DataFrame(data)
def kfold(clr,X,y,folds=10):
from sklearn.cross_validation import StratifiedKFold
from sklearn import metrics
auc_sum=0
c... | true |
21c8e847ffe00981d68ca094df8d9f2ffc2eb7a5 | Python | ispark25/space-invaders | /vae/data_loader.py | UTF-8 | 2,149 | 2.921875 | 3 | [] | no_license | # https://stanford.edu/~shervine/blog/keras-how-to-generate-data-on-the-fly
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import os
import gzip
from keras.utils import Sequence
def get_generators(root, ratio, batch_size=... | true |
08f4572a325759413c4ce2a6ef4387323b0ea2cd | Python | shg9411/algo | /algo_py/boj/bj9375.py | UTF-8 | 362 | 2.9375 | 3 | [] | no_license | import sys
input = sys.stdin.readline
tc = int(input())
for _ in range(tc):
n = int(input())
clothes = dict()
for _ in range(n):
small, mid = input().split()
if mid in clothes:
clothes[mid] += 1
else:
clothes[mid] = 1
res = 1
for var in clothes.value... | true |
9b67b719af85c3d3ac7d017b3045281f756c3ce1 | Python | gcmadhan/Face-ID-from-webcam-or-Video | /face_detection.py | UTF-8 | 1,909 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sn
import sys, os
from mtcnn.mtcnn import MTCNN
import cv2
#Global variables & MTCNN detector
#detector = MTCNN()
#result = detector.detect_faces(image)
detect = cv2.CascadeClassifier(cv2.data.haarcascades + "haar... | true |
ff2a05464fa0a5cfb153419c16cb2932cff24f4f | Python | ifiddes/notch2nl_kmer_debruijn | /src/kmerModel.py | UTF-8 | 7,243 | 3.1875 | 3 | [] | no_license | from abstractIlpSolving import SequenceGraphLpProblem
from collections import Counter
from itertools import izip
import pulp, logging
class Block(object):
"""
Represents one block (one weakly connected component)
Each block may have anywhere from 1 to n paralogs represented in
it. Initialized by passin... | true |
f5b49fad583bbb42f595866510dbf5048bbd1fef | Python | kwawrzyniak92/kurs_codeme | /Dzien 5/karty.py | UTF-8 | 515 | 3.5 | 4 | [] | no_license | #sprawdzenie czy to jest karta
#sprawdzenie czy to jest prawidlowy numer karty (ilość cyfr 13, 16 lub 15)
def card_check(number):
return number.isdecimal() and len(number) in [13, 15, 16]
card_number = input('Podaj numer karty ')
#sprawdzenie czy wiza - poczatek od 4
if len(card_number) in [13, 16] and ca... | true |
d2a9a72e0023c7175ea24e7b8d146debae5c0845 | Python | geohotweb/programing | /ecuaciones/parentesis.py | UTF-8 | 337 | 3.703125 | 4 | [] | no_license | #Este programa determina si el caracter introducido es un parentesis y de no ser asi manda un mensaje dicinedo que no lo es.
#!/usr/bin/python
#_*_ conding: utf8 _*_
car = input('Introduzca el caracter requerido: ')
if car == ():
print('Es un parentesis')
if car == exit:
else:
print('El caracter introducido no es... | true |
80fdb1b904f08248b64b5d56b5c3f0272aa8b737 | Python | Shawonskh/Robotics | /lab10/Marker.py | UTF-8 | 992 | 3.34375 | 3 | [] | no_license | class Marker:
# A marker includes an id number and corner coordinates. The coordinates can be
# accessed in several ways:
# marker.x1 gets the x-coordinate of the first corner, and similarly for other
# coordinates.
# marker.x gets a list of all x-coordinates
# marker.corners is a list of coordinate pairs for al... | true |
622b205f43463a293592b2475e61c56cddc31512 | Python | NatalieP-J/AST326 | /Lab 3 Data/circle_temp.py | UTF-8 | 242 | 2.625 | 3 | [] | no_license | import pylab
pylab.axes()
cir = pylab.Circle((0,0), radius=0.75)
pylab.gca().add_patch(cir)
#cir = pylab.Circle((.5,.5), radius=0.25, alpha =.2, fc='b')
#pylab.gca().add_patch(cir)
pylab.axis('scaled')
pylab.savefig("circle.png")
pylab.show() | true |
10e488a637dac2cd483c56f2995b8cbe697f1dd4 | Python | ybear90/codekata_ps | /week3/day1.py | UTF-8 | 1,304 | 4.15625 | 4 | [] | no_license | """
문제
두 개의 input에는 복소수(complex number)가 string 으로 주어집니다.
복소수란 a+bi 의 형태로, 실수와 허수로 이루어진 수입니다.
input으로 받은 두 수를 곱해서 반환해주세요.
반환하는 표현도 복소수 형태의 string 이어야 합니다.
복소수 정의에 의하면 (i^2)는 -1 이므로 (i^2) 일때는 -1로 계산해주세요.
* 제곱 표현이 안 되어 i의 2제곱을 (i^2)라고 표현했습니다.
예제 1:
Input: "1+1i", "1+1i"
Output: "0+2i"
설명:
(1 + i) * (1 + i) = 1 + i + ... | true |
2988bc42c10c04530815afd84cacb3e20316cac9 | Python | brandoshmando/py_crm | /crm.py | UTF-8 | 2,800 | 2.84375 | 3 | [] | no_license | import sys
import prompt_text
import rolodex
from contact import Contact
from IPython import embed
class Crm:
def __init__(self, name):
self.name = name
self.rolodex = rolodex.Rolodex()
self.main_prompt()
def main_prompt(self):
while True:
self.clear_term()
self.print_prompt(prompt_tex... | true |
9c74ec4035be80201f0f9f12e60a550d1392c82e | Python | michal1000w/simpleNeuralNetPython | /main.py | UTF-8 | 3,862 | 2.8125 | 3 | [] | no_license | from Matrix import Matrix
import NeuralNetwork
import NeuNet
import Import
from colorama import init, Fore, Back, Style
def hidden_Layout(data:str):
output = Matrix(data)
return output
def Beep(duration = 0.40):
import winsound
frequency = 800
Duration = int(1000 * duration)
winsound.Beep(... | true |
f3bb5a4d31210824356f7beead5069b8912212b9 | Python | Splatter-dev/Curso-em-Video-Python | /Mundo_2/aula_012/ex038.py | UTF-8 | 499 | 4.34375 | 4 | [] | no_license | # Comparar 2 numeros e falar qual é o maior ou se são iguais
print('\nOlá. Seja bem-vindo(a) ao programa de comparação de numeros.')
numero1 = int(input('\nDigite o valor do primeiro numero: '))
numero2 = int(input('Digite o valor do segundo numero: '))
if numero1 > numero2:
numeromaior = numero1
print('\nO ... | true |
cfc54f11f9983b81808bbeb824213f3f6ba01432 | Python | pdnooteboom/PO-dinocysts | /OFES/OFESplots/figure 4/process/process_before_plot.py | UTF-8 | 6,289 | 2.578125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 30 13:48:07 2019
@author: nooteboom
"""
import numpy as np
import math
def find_down(array,value):
if(value>=array[0]):
array = [n-value for n in array]
idx = np.array([n for n in array if n<0]).argmax()
else:
idx = np.nan
return idx... | true |
2a1970e847980f0f2a366e4c3137a3b2b8318359 | Python | Eustaceyi/Leetcode | /516. Longest Palindromic Subsequence.py | UTF-8 | 1,078 | 3.390625 | 3 | [] | no_license | class Solution:
def longestPalindromeSubseq(self, s: str) -> int:
'''
First we initialize a l x l matrix,
for each entry dp[i][j] means the longest subseq from i to j (both inclusive) that is palindrome
and we fill the diag with 1,
then we process other area:
1. if s... | true |
c90197bbd02ab53d74d5e6d3c9def26b42fb7f2b | Python | dalehuangzihan/vidBarcodeReader | /OpenCV_Tutorials/basic_operations_on_images_tutorial.py | UTF-8 | 1,681 | 3.265625 | 3 | [] | no_license | import numpy as np
import cv2
img = cv2.imread('messi5.jpg') # is an image matrix
img3 = cv2.imread('opencv-logo.png') # is an image matrix
print(img.shape) # prints a touple of number of rows, columns, and channels
print(img.size) # prints the total number of pixels in the image
print(img.dtype) # prints Image datat... | true |
eb48e9538062fe8ca930985bc04cd2b14adb7707 | Python | pburakov/hack_week_py | /server.py | UTF-8 | 1,958 | 2.6875 | 3 | [] | no_license | import pygame
from flask import Flask, request, abort, make_response
from neopixel import *
from scipy import misc
from config import *
from utils import blink_onboard_led, reset_onboard_led
# Init preview screen
if not NO_PREVIEW:
pygame.display.set_mode((SCREEN_X * P_MFACTOR, SCREEN_Y * P_MFACTOR))
# Init sock... | true |
74d8d4efe66e2d2d572ea63cdc6a18b06e09fec9 | Python | jamieapps101/imageResizer | /resize.py | UTF-8 | 1,797 | 3.125 | 3 | [] | no_license | #!/usr/bin/python3
from PIL import Image
import sys,os
args = sys.argv
nArgs = len(sys.argv)
xScale = 0.5
yScale = 0.5
if(nArgs == 2):
pathArg = sys.argv[1]
imageRef = Image.open(pathArg)
imageSize = imageRef.size
print("Current image size: {}".format(imageSize))
newImageSize = (int(imageSize[0]... | true |
1cef76793a4bf37a250a571e816f2148bf2d7791 | Python | ElonGame/beat-smash | /Beatmap Algorithm/bmaFunctions.py | UTF-8 | 1,360 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
import time
import sys
from collections import Counter
keysList = ['Space', 'J', 'F', 'K', 'D', 'J K', 'D F', 'F J', 'D K', 'D Space', 'F Space', 'J Space', 'K Space', 'D J', 'F K', 'D F J', 'F J K', 'D J K', 'D F K', 'D F Space', 'Space J K', 'D Space K', 'F Space J', 'D Space J', 'F Space K', 'D F ... | true |
d9d56601c505a52b08c84c7c6b6e228bd1a376dd | Python | amylearnscode/CISP300 | /Lab 2-6.py | UTF-8 | 1,513 | 4.34375 | 4 | [] | no_license | #Amy Gonzales
#2/7/2019
#This program uses functions and variables
#the main function
def main():
print ('Welcome to the meal calculator program')
print #prints a blank line
mealPrice= input_meal()
tip= calc_tip(mealPrice)
tax= calc_tax(mealPrice)
total= calc_total(mealPrice, tip... | true |
008c5140fa32e5cc18b9d1b411dcbf5675d7b407 | Python | yanxurui/keepcoding | /python/algorithm/leetcode/671.py | UTF-8 | 1,280 | 3.46875 | 3 | [] | no_license | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def findSecondMinimumValue(self, root: TreeNode) -> int:
if root.left or root.right:
assert root.left and root.right
... | true |
d26171c0a60c2a130e21d2d59d6bc5bdf7558990 | Python | AndreasGeiger/hackerrank-python | /Strings/minion game.py | UTF-8 | 520 | 3.65625 | 4 | [
"MIT"
] | permissive | def minion_game(string):
string = string.lower()
scoreStuart = 0
scoreKevin = 0
vowels = 'aeiou'
for j, i in enumerate(string):
if i not in vowels:
scoreStuart += len(string) - j
if i in vowels:
scoreKevin += len(string) - j
if scoreStuart > scoreKevin:
... | true |
26fedbe6c8fab86f09dc9311a81be54c26d93ec7 | Python | RiddhiRex/Leetcode | /Insert into a Cyclic Sorted List.py | UTF-8 | 783 | 3.5625 | 4 | [] | no_license | '''
# Definition for a Node.
class Node:
def __init__(self, val, next):
self.val = val
self.next = next
'''
class Solution:
def insert(self, head, insertVal):
"""
:type head: Node
:type insertVal: int
:rtype: Node
"""
if head==None:
he... | true |
01091ee2f33a45c369191100a32802d6d092b862 | Python | JinSakuma/flask-reading-records | /flask-reading-records-v1/web/views.py | UTF-8 | 662 | 2.625 | 3 | [] | no_license | # web/views.py
from web import app, db
from web.forms import BookForm
from web.models import Book
from flask import render_template, redirect, url_for
@app.route('/')
def index():
books = Book.query.all()
return render_template('index.html', books=books)
@app.route('/register', methods=['GET','POST'])
def reg... | true |
25475e2ce642f69599b60ebdda5c98ef279d8d22 | Python | samanthamedrano/lps_compsci. | /class_samples/5-1_Files/chooseHaiky.py | UTF-8 | 646 | 4 | 4 | [] | no_license | # this opens both of the haiku files so they are ready to be used.
myThirdHaiku = open('haiku3.txt', 'r')
myFourthHaiku = open('haiku4.txt', 'r')
print('Hello, welcome to Haiku reader!')
print('Choose between the following:')
print('(3):A haiku about food.')
print('(4):A haiku about Supernatural.')
# this is for when... | true |
aeb6b28fb3984b7e3983751552c55c9b6c9a5392 | Python | goginenigvk/PythonSep_2019 | /PlusModules/logs.py | UTF-8 | 819 | 3.046875 | 3 | [] | no_license | # Logging Module
# import logging
# DEBUG -10
# INFO -20
# WARNING -30
# ERROR -40
# CRICTICAL=50
#---> 5 bathes - one - transfer the data from db to another db, read all data, - one
import logging
logging.debug('This is in debgug log message') # debug mode - developer
logging.info('thiis is info log') # spec... | true |
5bf6a41160c966461b483da8b4ee7f309709f989 | Python | YLNN2/Pygame2 | /1.py | UTF-8 | 516 | 3.0625 | 3 | [] | no_license | import pygame
size = width, height = 300, 300
screen = pygame.display.set_mode(size)
running = True
x_pos = 0
while running:
events = pygame.event.get()
for event in events:
if event.type == pygame.QUIT:
running = False
# отрисовка и изменение свойств объектов
screen.fill((0, 0, ... | true |
800a7cdfbab2f98031af28eaa3bae7284eca5e0a | Python | bmiomi/SisTerminal | /Modulo/Factura.py | UTF-8 | 1,669 | 2.609375 | 3 | [] | no_license | from .Cliente import Clientes
from .Ventas import VentaProductos
class factura:
__iva=12
def __init__(self,CodigoCliente):
self.codigo=4444
self.serie=3333
def __str__(self):
return f'{self.codigo},{self.serie} {self.obj_cliente.get_Nombre} {self.Obj_venta._Cesta_Venta}'
def getCabecera(sel... | true |
51d08e92b9a7dd7e1fa02d9485961ce5d7158b8e | Python | snehashis1997/Poisoning-Attacks-on-Algorithmic-Fairness | /SecML/src/secml/ml/classifiers/sklearn/c_classifier_knn.py | UTF-8 | 4,064 | 3.28125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | """
.. module:: KNeighborsClassifier
:synopsis: K-Neighbors classifier
.. moduleauthor:: Battista Biggio <battista.biggio@unica.it>
.. moduleauthor:: Marco Melis <marco.melis@unica.it>
.. moduleauthor:: Ambra Demontis <ambra.demontis@unica.it>
"""
from sklearn import neighbors
from secml.array import CArray
from s... | true |
5b5856759c7a1a2132b5f075cb56c903603ea08b | Python | valuks/kukne | /convert.py | UTF-8 | 1,151 | 2.59375 | 3 | [] | no_license |
# -*- coding: utf-8 -*-
import json
fr = 'source/produktiLG.txt'
to = 'static/js/data/products.lg.js'
# {'id': 1, 'name': 'Augļi un ogas', 'products': [
# {'id': 1, 'name': 'Āboli', 'calories': 49, 'protein': 0, 'hydrates': 12, 'fat': 0, 'cholesterol': 0},
# {'id': 2, 'name': 'Ananāss', 'calories': 49, 'prot... | true |
266d8e560aaade98dfe5c305b29614087018c37b | Python | Anaconda-Platform/anaconda-project | /anaconda_project/project_file.py | UTF-8 | 7,360 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... | true |
ba8fe69c9395c3dadc0ea7c0f34555cd6816422b | Python | sakurafisch/learn | /Python/Nether.py | UTF-8 | 2,889 | 2.75 | 3 | [] | no_license | import random, math, time
import mcpi.block as block
import mcpi.minecraft as minecraft
mc=minecraft.Minecraft.create()
mc.postToChat("Coded by ice1000")
mc.postToChat("Nether Wolrd!")
mc.postToChat("Wait for the God!!")
dis = 3
(x1,y1,z1) = mc.player.getPos()
x = x1-dis
z = z1-dis
height = y1-dis
whi... | true |
3d438f19426d884ece6f360a9292c05e3f18e4c8 | Python | yokabicarpmaz/ME462_ControlSystemsTools | /Webots Simulations/Four Bar/controllers/four_bar_controller/four_bar_controller.py | UTF-8 | 896 | 3.234375 | 3 | [] | no_license | from controller import Robot, Motor, PositionSensor
import sys
import numpy as np
desired_angle=180 #give input from here
#desired angle of green link, with respect to ground
timestep = 8
robot = Robot()
sensor=robot.getPositionSensor("sensor")
sensor.enable(timestep)
motor = robot.getMotor("servo1... | true |
0937440865890145ccc851ea9027e451f2feada9 | Python | bcbabrich/CS682FinalProject | /results_grapher.py | UTF-8 | 2,398 | 2.9375 | 3 | [] | no_license | from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def print_3d_graph_of(points, width, height, title) :
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
print('points',points)
# (learning rate, batch size, accuracy)
samples = [(p[0],p[1],p[2]) for p in p... | true |
d499e1c5b99681952a6865113358750aed74257a | Python | nithinj/CodingPuzzles | /HackerRank/xoring_ninja.py | UTF-8 | 762 | 2.765625 | 3 | [] | no_license | from sys import stdin
import math
def calc_modulo(n):
exp = 0
for i in range(calc_modulo.starting_count, n + 1):
if calc_modulo.starting_count == 0 and (1 << i) > mod_const:
calc_modulo.starting_count = i
if exp == 0:
exp = (1 << i) % mod_const
else:
... | true |
774bbabd4b5d0d957ba54e8d84e31b17ab9cba76 | Python | ABoLei/Z-Project | /ZLogTest.py | UTF-8 | 392 | 2.578125 | 3 | [] | no_license | from PythonLog import zLogger
import logging
LogPath = 'your log file path. ex:C:\\'
clsLog = zLogger(LogPath, 1,"ChenYu")
clsLog.write("info","Test My Log");
#取得同一個 Logging Name 就可以使用同一個 logging 寫入,無須作物件傳遞的動作
#log 就可以直接寫入同一個log檔裡(log1.log)
log = logging.getLogger("ChenYu")
log.info("This is outside Message.") | true |
a58fc06484a1abd318ae4f5ce63de36c753cf11a | Python | Camebush/aes-cbc-encrypt-file-with-pycryptodome | /aes-encryption.py | UTF-8 | 2,240 | 2.90625 | 3 | [] | no_license | import timeit, hashlib, sys, os
from Cryptodome.Cipher import AES
from Cryptodome.Util import Padding
def encryptText(password, IV, msg):
key = hashlib.sha256(password.encode()).digest()
cipher = AES.new(key, AES.MODE_CBC, IV)
padded_message = Padding.pad(msg.encode(),16)
encrypted_message ... | true |
d6c89304dc6fd65bce7466376c9dacb3d1b41d33 | Python | Yasin-Shah/dataquest-projects | /Project 10 - Transforming Data with Python/domains.py | UTF-8 | 215 | 2.703125 | 3 | [] | no_license | import read
data = read.load_data()
# Get the 100 most submitted domains
domains = data['url'].value_counts()
domains = domains[:100]
for name, row in domains.items():
print("{0}: {1}".format(name, row))
| true |
ca853a8b6437aeb55a9c45fb841613c0161a6572 | Python | G0PALAKRISHNAN/python | /WinUIAutomation/WinUIPackages/WinAutomateMSWord.py | UTF-8 | 519 | 2.671875 | 3 | [] | no_license | import win32com.client as win32
from time import sleep
RANGE = range(3,8)
def Word():
xl = win32.gencache.EnsureDispatch("Word.Application")
doc = Word.Documents.Add()
Word.Visible =True
sleep(1)
rng = doc.Range(0,0)
rng.InsertAfter("Hacking word with Python\r\n\r\n")
sleep(1)
for i i... | true |
ca960af862373d7a4bb1c2c1ef90e2c671f94b76 | Python | fernandoremor/gfxlcd | /gfxlcd/driver/xpt2046/xpt2046.py | UTF-8 | 2,521 | 2.546875 | 3 | [
"MIT"
] | permissive | """XPT2046 touch pabel driver"""
import RPi.GPIO # pylint: disable=I0011,F0401
from gfxlcd.abstract.touch import Touch
class XPT2046(Touch):
"""XPT2046 class"""
def __init__(self, width, height, int_pin=None, callback=None, cs_pin=None, spi=0, speed=1000000):
super().__init__(width, height, int_pin, ... | true |
792e12fa54f8a66d07e538bce8228c3e0d903f3d | Python | braune13/dbsystems_hmwk6 | /files/.~c9_invoke_bO74sM.py | UTF-8 | 2,680 | 3.0625 | 3 | [] | no_license | #Created by Erica Braunschweig (braune)
import sys
import method_one_revamped as method_one
import method_two
import method_three
import cost_class
#Global list to hold queries and their parameters (will be a list of lists)
queries_params = []
#========================================================================... | true |
af5ec76db386335695ce614e9504c0e39ff4a82c | Python | veniversum/pandemaniac | /strategies/freeforall/communities.py | UTF-8 | 2,770 | 2.875 | 3 | [] | no_license | import heapq
import numpy as np
import networkx as nx
def get_exf_dict(adj_list):
exf_dict = {}
for node, adj in adj_list.items():
exf = 0.
clusters = []
cluster = set(adj)
cluster.add(node)
for n in adj:
dj = len(set(adj_list[n]).difference(cluster))
... | true |
3dde5aa7a65c532a7671cd2d4c135e38010a4092 | Python | Daniil-Budnik/TourOperator | /TourOperator.py | UTF-8 | 18,561 | 2.609375 | 3 | [] | no_license | # --------------------------------------------------------------------------------------------------
import os.path as PH
import json as JS
import os
import sqlite3 as SQL
# --------------------------------------------------------------------------------------------------
# Класс хранения объектов
class Da... | true |
8062ee6b21301d81f5706cbfc0bd9996ec499076 | Python | Khalil-Zaman/SnakeGameAI | /tfsnake.py | UTF-8 | 10,531 | 2.953125 | 3 | [] | no_license | import numpy as np
import sys
from random import randint, uniform as randfloat
np.set_printoptions(formatter={'float': lambda x: "{0:0.5f}".format(x)})
import tensorflow as tf
grid = [3, 3]
layers = 20 # Including input and output
dim = grid[0] * grid[1]
fname = "tf_brains/" + str(grid[0]) + "x" + str(grid[1]) + "/... | true |
1281ca41070599dc79904daadbf3d7b494a6ce0b | Python | 7azumi/PythonWorkspace | /Spider/5_Data_Storage/关系型数据库存储/MySQL storage.py | UTF-8 | 781 | 3.015625 | 3 | [] | no_license | import pymysql
# 连接MySQL,并查询版本号及所有数据库
db = pymysql.connect(host='localhost', user='root', password='Fl+13+Mysql', port=3306)
cursor = db.cursor()
cursor.execute('SELECT VERSION()')
data = cursor.fetchone()
print('VERSION: ',data)
# cursor.execute('CREATE DATABASE IF NOT EXISTS spiders DEFAULT CHARACTER SET UTF8')
curs... | true |
ccaacbfcc91abd4b78392b037ac34637e03ba918 | Python | articuly/Self-study | /程序基础/logic_if.py | UTF-8 | 397 | 4 | 4 | [] | no_license | a = 12
b = 30
if b > a:
print("hello")
if b < 31:
print("you are ritht")
age = int(input("请输入你的年龄:"))
print(type(age))
print(age)
if age < 21:
print("你不能吸烟")
elif age == 21:
print("你快可以吸烟了")
elif age > 60:
print("你很老了,请不要再吸烟了!")
elif 21 < age <= 60:
print("你可以吸烟")
else:
print("输入有误")
| true |
9c05b9d8a82ebb77d1f6bdb8a957253e885e7151 | Python | rahul444/nfl-draft-valuation | /scrape_transaction.py | UTF-8 | 2,358 | 2.90625 | 3 | [] | no_license | import bs4 as bs
import urllib.request
import re
def get(year):
trades = [year]
URL = 'http://www.prosportstransactions.com/football/DraftTrades/Years/' + str(year) + '.htm'
source = urllib.request.urlopen(URL).read()
soup = bs.BeautifulSoup(source, 'lxml')
for tr in soup.find_all("tr"):
tr... | true |
1131534ca111850f94aeb6e2b94ce26f338dcab4 | Python | Zayat/blockchain-models-simulator | /src/bcns/chain.py | UTF-8 | 2,278 | 3.046875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- mode: python; coding: utf-8; fill-column: 80; -*-
class Chain(object):
__slots__ = (
'blocks', # List of blocks (representing the blockchain).
'_block_pos', # Map of block hashes to their position in the chain.
)
def __init__(self, genesis_block):
... | true |
3e01eddf7e98c66bbc74a13fb22357852c107de4 | Python | Tobias-Schoch/SSS | /Versuch2/data/old/task3.2.py | UTF-8 | 1,048 | 3.0625 | 3 | [
"MIT"
] | permissive | import numpy as np
import cv2
# ------------------------------ Aufgabe3.2 ------------------------------ #
white_minus_black = np.zeros((480, 640))
whiteavg = cv2.imread('data/whiteaverage.png')
blackavg = cv2.imread('data/blackaverage.png')
for y in range(0, 480):
for z in range(0, 640):
r1, g1, b1 ... | true |
00ed53cc3b34bdb55623c5c49616087a140ea398 | Python | PdxCodeGuild/class_platypus | /Code/Mitchell/Python Labs/lab21.py | UTF-8 | 1,843 | 3.96875 | 4 | [] | no_license | import re
import operator
word_count = {}
pair_count = {}
#Opens and copies the text of a book's .txt file
with open('MobyDick.txt', 'r') as f:
#Reads the file and converts it to lowercase
input_file = f.read().lower()
#Strips punctuation and stores words in list
word_list = re.compile('\w+').findall(in... | true |
ca3eaba2721890af9005cb5a31aa4aa305ffcbf0 | Python | fabreeze/fabreeze | /learning_journal.py | UTF-8 | 3,364 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# # Journal
#
# by /u/fabreeze <br>
# created on Dec 8, 2014
# <markdowncell>
# ##### Info about version control
#
# [git syntax tutorial](http://nbviewer.ipython.org/github/demotu/BMC/blob/master/notebooks/VersionControlGitGitHub.ipynb)
# <ma... | true |
1d500b20b88d417eb705855e97eb1902a890ba73 | Python | SecurityInEmergingEnvironments/MLSF | /cli/cli.py | UTF-8 | 2,646 | 2.6875 | 3 | [] | no_license | '''
AUTHORS: Cody Burkard, Julio Perez
University of Washington, Bothell
Security in Emerging Environments
A command line interface for the MLSF framework. Aims to provide
useful functionality for a user to quickly run tests on an
application and interpret the results.
'''
import cmd
from simC... | true |
33255788a90eec1632acb2093deaeb1711089fe9 | Python | votti/PyLaTeX | /pylatex/base_classes/containers.py | UTF-8 | 4,993 | 3.34375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
This module implements LaTeX base classes that can be subclassed.
.. :copyright: (c) 2014 by Jelte Fennema.
:license: MIT, see License for more details.
"""
from collections import UserList
from pylatex.utils import dumps_list
from contextlib import contextmanager
from pylatex.base_cl... | true |
aa21a516bcfc3374c70f039f111911780b759edf | Python | zhangfengwe/python | /python/study/python13_16/python16/die/makedie.py | UTF-8 | 1,975 | 3.609375 | 4 | [] | no_license | # 随机摇骰子,绘画柱形图
import matplotlib
import matplotlib.pyplot as plt
from python.study.python13_16.python16.die.die import Die
# 标题中文显示为方框解决办法
# 第一种
chinfo = matplotlib.font_manager.FontProperties(fname='C:/Windows/Fonts/simsun.ttc')
# 第二种
matplotlib.rcParams['font.sans-serif'] = [u'SimHei']
matplotlib.rcParams['axes.uni... | true |
8a491d5597b52c0690dcd9b7a8bbdf12870f8f09 | Python | chien-wei/LeetCode | /0280_Wiggle_Sort.py | UTF-8 | 465 | 3.34375 | 3 | [] | no_license | class Solution:
def wiggleSort(self, nums):
ns = sorted(nums)
l = len(ns)
mi = l // 2 + (1 if l % 2 == 1 else 0)
fst, snd = ns[:mi], ns[mi:][::-1]
print(fst, snd)
res = []
for i in range(len(snd)):
res.append(fst[i])
res.append(snd[i])
... | true |
978e8b4a0a3eeb8e793e8e65c95b12a54ee6b4be | Python | wilsonsamarques/OpenCV | /BasicFunctions.py | UTF-8 | 604 | 2.75 | 3 | [] | no_license | import cv2
import numpy as np
kernel = np.ones((5, 5), np.uint8)
print(kernel)
path = "resources/lena.png"
img = cv2.imread(path)
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
imgBlur = cv2.GaussianBlur(imgGray, (7,7), 0)
imgCanny = cv2.Canny(imgBlur, 100, 200)
imgDilation = cv2.dilate(imgCanny, kernel, iteratio... | true |
4091647168a4d18fcf5d4fde0a81f9158841beb3 | Python | sbnlp/2017BioNLPEvaluation | /tees/ExampleBuilders/FeatureBuilders/BioInferOntologyFeatureBuilder.py | UTF-8 | 2,864 | 2.546875 | 3 | [
"MIT"
] | permissive | """
BioInfer ontology based features
"""
__version__ = "$Revision: 1.2 $"
import sys, os
try:
import xml.etree.cElementTree as ET
except ImportError:
import cElementTree as ET
import Utils.ElementTreeUtils as ETUtils
from FeatureBuilder import FeatureBuilder
g_bioInferFileName = "../../../BioInfer/data/bioinf... | true |
c426abed6553f8034a6f4ab9885e8c773a19303a | Python | woutster/wikipedia_infobox_parser | /scraper.py | UTF-8 | 3,996 | 2.84375 | 3 | [] | no_license | import scraperwiki
import re
import sys
import urllib2
import yaml
import pprint
"""
article_title = sys.argv[1]
if len(sys.argv) > 2:
box_title = sys.argv[2]
# allow box title to be capitalized or not
box_title = '[' + box_title[0].lower() + box_title[0].upper() + ']' + box_title[1:]
else:
box_title ... | true |
7bb46201997f666c53784bb007bad7bd6cce812f | Python | andreplacet/reiforcement-python-tasks | /exe3.py | UTF-8 | 192 | 4.25 | 4 | [] | no_license | # Exercicio 3
lista = []
for _ in range(2):
num = int(input(f'{_ + 1}º - Informe um número: '))
lista.append(num)
print(f'A soma dos valores digitados é igual á: {sum(lista)}')
| true |
1f7bd0fe6186ee999e5d67c85b6262a4f69c3a9d | Python | codeacade/py-random | /projecteuler/09.py | UTF-8 | 615 | 4.03125 | 4 | [] | no_license |
## https://projecteuler.net/problem=9
################################################################################################
## A Pythagorean triplet is a set of three natural numbers, a < b < c, for which a2 + b2 = c2
## For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2.
## There exists exactly one Pythagor... | true |
eb7e2013917a0e3d68ecac1c43f5628efe4105e6 | Python | predatory123/byhytest | /webdrivers/spider/urllib/test9.py | UTF-8 | 952 | 2.625 | 3 | [] | no_license | from urllib import request,error
if __name__ == '__main__':
url = 'http://www.baidu.com'
try:
# 1.使用head方法模拟UA
# headers = {}
# headers['User-Agent'] = 'Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6... | true |
21b5d0bd99e26df4f6ef3267db969fe719b1d01b | Python | JOJI05/Assaigments-of-school | /06.py | UTF-8 | 578 | 3.40625 | 3 | [] | no_license | import random
import time
X = [1, 1, 2, 3, 3]
anser_array = []
X_num = len(X)
epo = 0
while epo <= 100 * X_num:
Sum = 0
for i in range(X_num):
Sum += X[i] * 10 ** i
anser_array.append(Sum)
X = random.sample(X, X_num)
epo += 1
anser_array = sorted(list(set(anser_array)))
print("Enumerate!!!")... | true |
8b4068baa13dba128c475bbdc575be0f5de2da1c | Python | gaiaverse/Gaia-EDR3-selection-function | /TestingScripts/GenerateSphHarm_decomposed.py | UTF-8 | 5,182 | 2.703125 | 3 | [] | no_license | """ Compute the real-valued spherical harmonics for nested Healpix maps. """
import sys
import numpy as np, healpy as hp, scipy.stats
import h5py, tqdm
from numba import njit
@njit
def sphharm_sum_quick(alm, _lambda, azimuth, m, lmax, jpix, Nring, F):
"""
alm - ndarray - (Nmode)
_lambda - ndarray - (Nmod... | true |
449dcdaad9f8731347c8a8be193358b35e0fcd79 | Python | ANDREWTENAJEROS/python-calculator-act-1 | /1st excer.py | UTF-8 | 347 | 4.28125 | 4 | [] | no_license | num1 = int(input("Enter 1st number:"))
num2 = int (input("Enter 2nd number:"))
ans = int(input("[1]add [2]modulo [3]multipy [4]divide: "))
if ans == 1:
print("sum: ",num1 + num2)
elif ans == 2:
print("remainder: ",num1 % num2)
elif ans == 3:
print("product: ",num1 * num2)
elif ans == 4:
print(... | true |
9a4990cdfd85d719712f56a1bb99be7b48f8efd6 | Python | loredana-stirbu/27...01... | /suma0.py | UTF-8 | 118 | 3.046875 | 3 | [] | no_license | x=0
n=list(str(input("dati numarul: ")))
print(n)
for i in range(len(n)):
x+=int(n[i])
print(x)
| true |
e09ebff2b496ab945c8dfece819b3cd19f0cf5b1 | Python | ABE-Mark45/Legendre-Polynomials-Generator | /main.py | UTF-8 | 871 | 2.890625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
x = np.linspace(-1, 1, 100)
p = []
n = 30
for i in range(n):
Y = np.zeros_like(x)
c = 1
j = 1
if i % 2 == 0:
Y += 1
j = 0
else:
Y = x.copy()
while(j < i):
c *= (j-i)*... | true |
7cc0042aed07248140580ea41b1554b8a44318e3 | Python | s-light/LEDBoard_CP_tester | /mapping.py | UTF-8 | 4,479 | 3 | 3 | [
"MIT"
] | permissive | """Mapping."""
__doc__ = """
mapping.py - Mapping.
some mapping helpers.
"""
"""
The MIT License (MIT)
Copyright (c) 2020 Stefan Krüger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without... | true |
1603daf62ff5c0bde87a08f180646801a56c5dd9 | Python | ghPRao/facial_recognition | /src/fr_image_crop.py | UTF-8 | 1,191 | 3.234375 | 3 | [] | no_license | import argparse
import cv2
# parse arguments
pa = argparse.ArgumentParser()
pa.add_argument("-i", "--image", type=str, default="../data/Tropical-tree.jpeg",
help="image directory")
args = vars(pa.parse_args())
# spatioal dimension of the image.
image = cv2.imread(args["image"])
(h, w) = image.shape[:2]
cv2.imshow("O... | true |
648c6ea141c1dd231e0873ffb5ed6149467d97cf | Python | gusDuarte/notificador | /notificador-ceibal-notifier/notifier/web_service_conexion.py | UTF-8 | 3,978 | 2.90625 | 3 | [] | no_license | #! /usr/bin/python
# -*- coding:utf-8 -*-
# web_service_conexion.py V2.0
# Author: Matias Basso <mbasso@plan.ceibal.edu.uy>
#---------------------------------------------------------------------------------
# Genera la conexion al Web service de Ceibal para solicitar las Notificaciones.
#------------------------------... | true |
3e4b12bf4d4d21630a027d7dd16519d8197cc5c8 | Python | mattrestine/python_lessons | /stripping_names.py | UTF-8 | 142 | 3.671875 | 4 | [] | no_license | name = " MatthewRestine "
print(name)
print("lstrip: " + name.lstrip())
print("strip: " + name.strip())
print("rstrip: " + name.rstrip())
| true |
e8ae1f2a666c1042cb6459b1b2b17a188028eca9 | Python | lianggangscu/helloworld | /helloworld.py | UTF-8 | 225 | 3.328125 | 3 | [] | no_license | #!/usr/bin/env python3
#Filename:hellworld.py
'''
print "helloworld" in screen
'''
def hello(name):
print("hello world {0}".format(name))
if __name__=="__main__":
name = input('please input your name:')
hello(name)
| true |
f6452b919ecb1e4cf99ca92891ed182038242fcf | Python | renchao7060/studynotebook | /基础学习/p6_os模块使用.py | UTF-8 | 201 | 2.59375 | 3 | [] | no_license | import sys
import os
ostype=sys.platform
if ostype=='linux3' or ostype=='linux2':
cmd='clear'
os.system('clear')
print(cmd,'\n')
else:
cmd='cls'
os.system('cls')
print(cmd,'\n')
| true |
bd4318cfcd32edf3f8f4ebd1c10c015a59f75232 | Python | elissabj/analisisAlgortimos | /Python/lcs.py | UTF-8 | 570 | 3.28125 | 3 | [] | no_license |
def nuevaMatriz(n, m):
matriz = []
for i in range (n):
a = [-1]*m
matriz.append(a)
return matriz
lista_listas = nuevaMatriz (1200,1200)
def lcs (i, j):
if i == 0 or j == 0:
return 0
if(lista_listas[i][j] != -1):
return lista_listas[i][j]
lista_... | true |
4fea9737fc9914ef7dda11dee1fd377dca323178 | Python | Shroedingercat/unsupervised-landmarks-thousand-landmarks-contest | /make_augmentation.py | UTF-8 | 2,047 | 2.828125 | 3 | [] | no_license | import tqdm
import numpy as np
from PIL import Image
def make_augmentation(landmark_file_name="/home/nasorokin11/Data/Data/data/train/landmarks.csv", train_path="/home"
"/nasorokin11/Data/Data/data/train"
... | true |
e44ef939624b81de1c95f769dff873e2912828c9 | Python | AlenAlic/galacursussen | /backend/util.py | UTF-8 | 744 | 2.59375 | 3 | [] | no_license | from datetime import timezone, datetime
from backend.values import DATETIME_FORMAT
from random import choice
import string
def format_euro(price):
if price > 0:
return '€{:,.2f}'.format(price)
return '€0,00'
def utc_to_local(utc_dt):
return utc_dt.replace(tzinfo=timezone.utc).astimezone(tz=None)... | true |
ec83900f51aec1cc5ea02e27826d00986cbba6c0 | Python | pingz1988/Python | /ftp上传/upload.py | UTF-8 | 3,855 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import configparser
from ftplib import FTP
import time
'''
def get_fn_cmd(dir):
cmd_fn = ((r"ls -l %s|grep ^- |wc -l") % dir)
return cmd_fn
def get_upload_cmd(dir):
cmd = ((r"ls -rt %s | tail -1000") % dir)
return cmd
'''
de... | true |
08f57a6951a2fdd32a55cad674f00db0d98ea1ba | Python | nico2rdj/AStar-PathFinding-pygame | /Base-AStar-PathFinding.py | UTF-8 | 9,761 | 3 | 3 | [
"MIT"
] | permissive | import sys, math, random
import pygame
import pygame.draw
import numpy
__screenSize__ = (1600,1280)
__cellSize__ = 20
__gridDim__ = tuple(map(lambda x: int(x/__cellSize__), __screenSize__))
__wallcolor = (10,10,10)
def getColorCell(n):
if n == -1:
return (0,200,0)
if n == 0:
return (255,255,2... | true |
3efa1a40b2a9d992baf7774fc63b29fc04513c58 | Python | muskankumarisingh/loop | /harshad number.py | UTF-8 | 184 | 3.640625 | 4 | [] | no_license | num=int(input("enter the number"))
sum=0
i=num
while num>0:
rem=num%10
sum=sum+rem
num=num//10
if i%sum==0:
print("i is a harshad number")
else:
print("i is not a harshad number") | true |
66dabf3e65bc5585c889f6c1e1321f49df45009e | Python | agiridharan/Course-Work | /Introduction-to-AI-A-Statistical-Approach/HW4/hw4part3.py | UTF-8 | 1,165 | 2.640625 | 3 | [] | no_license | import numpy as np
np.set_printoptions(threshold = np.inf)
traindata = np.loadtxt("hw4train.txt", dtype = int)
testdata = np.loadtxt("hw4test.txt", dtype = int)
datas = []
for i in range(6):
data = np.empty([len(traindata), 820], dtype = int)
data[:] = traindata
for entry in data:
if entry[-1] == (i+1... | true |
112a8546bd9825a763589be0fbb2b11e74b1c340 | Python | Cheryl-Tsui/D002-2019 | /L3/L3_Q1.py | UTF-8 | 2,145 | 4.46875 | 4 | [] | no_license | # D002 Lesson 3
# Q1: Warm up exercise
# a) Go Dutch
from math import *
people = int(input("How many people are sharing the bill?\n"))
bill = float(input("How much is the bill?\n"))
print("Kevin paid the bill first. But Kevin only has 100 dollar notes")
print("So Kevin is going to paid $%d." % (ceil(bill/10... | true |