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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
83384f69b9801218446203c5dc82ee92c8312e22 | Python | hima-del/Learn_Python | /13_class_and_first_class_functions/01.py | UTF-8 | 740 | 3.96875 | 4 | [] | no_license | class Dog:
species="canis familiaris"
def __init__(self,name,age):
self.name=name
self.age=age
def __str__(self):
return f"{self.name} is {self.age} years old"
def speak(self,sound):
return f"{self.name} saying {sound}"
class Bulldog(Dog):
pass
jack=Bulldog("jack... | true |
4e03313a9551fa82ce756802889528cfc53d7b4c | Python | SlowKing02/Spacy-Lemma | /Spacy_Lemma.py | UTF-8 | 1,206 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 26 09:40:19 2018
@author: slowking
"""
import pandas as pd
import spacy
nlp = spacy.load('en')
print(nlp.pipeline)
#Load Data
Texts_train_load = pd.read_csv()
Texts_train_load['spaced'] = Texts_train_load.text.apply(nlp)
Texts_test_load = pd.rea... | true |
6442270983001e67616bbbf75f03826a766cbeb2 | Python | Aasthaengg/IBMdataset | /Python_codes/p03804/s737474414.py | UTF-8 | 287 | 2.765625 | 3 | [] | no_license | import numpy as np
n, m = map(int, input().split())
a = np.array([list(input()) for _ in range(n)])
b = np.array([list(input()) for _ in range(m)])
ans = 'No'
for i in range(n-m+1):
for j in range(n-m+1):
if (a[i:m+i, j:m+j] == b).all():
ans = 'Yes'
print(ans)
| true |
d5fe427631af26324a16cfa8d2b7a2a1e4f0a3e1 | Python | archiewir/Financial-Product-Recommendation-System | /Data_sort.py | UTF-8 | 3,983 | 2.875 | 3 | [] | no_license | ### Sort Data based on complete and incomplete records ###
import pandas as pd
import csv
def checkList (list, input):
try:
list.index(input)
except ValueError:
return -1
def months (file):
m = []
with open(file, 'r') as r:
inp = csv.reader(r, delimiter=",", quotechar='|')
... | true |
6aea8bd9be4230cabd6915bf494cc872e8d777c8 | Python | MFurkan41/pythonAll | /Console/Çift Sayı mı, Tek Sayı mı/odd-even.py | UTF-8 | 361 | 3.609375 | 4 | [] | no_license | liste = [23,45,78,12,44,27,37,41,93,55,82,34,15]
def ciftmi(sayi):
if (sayi % 2 == 0):
return True
if (sayi % 2 == 1):
return False
ciftler = []
tekler = []
for i in range(0,len(liste)):
if(ciftmi(liste[i]) == True):
ciftler.append(liste[i])
elif(ciftmi(liste[i]) == False):
... | true |
72d850447dd8f78c07b98edda588510e6d7301e3 | Python | princep4/Ludo-Dice | /random_dice.py | UTF-8 | 629 | 3.125 | 3 | [] | no_license | import random
ch='y'
while ch=='y':
r=random.randint(1,6)
if r==1:
print("[ ]")
print("[ 0 ]")
print("[ ]")
if r==2:
print("[ ]")
print("[ 00 ]")
print("[ ]")
if r==3:
print("[0 ]")
print("[ 0 ]")
print("[ 0 ]")... | true |
cc93ff256d6c554db7b4fed6b84b36a1eefe7b8e | Python | hdznrrd/parseiq | /parseiq.py | UTF-8 | 7,041 | 2.6875 | 3 | [
"MIT"
] | permissive | # coding=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
"""Usage: parseiq.py dump [-o OFFSET] [-f FRAMES] FILE
parseiq.py peaksearch [-b BLOCKSIZE] [-s SKIPFRAMES] [-f FRAMES] FILE
parseiq.py search [-t THRESHOLD] FILE PATTERN_FILE
Arguments:
FILE input file (WAV, ... | true |
d85255927a481effc8a4e22134f5e0a1818dce6e | Python | yj435545879/test | /section5.py | UTF-8 | 2,834 | 3.46875 | 3 | [] | no_license | import math
class Point:
def __init__(self,x,y):
self.x = x
self.y = y
def distance(self,p2):
return math.sqrt((self.x-p2.x)**2+(self.y-p2.y)**2)
class Polygon:
def __init__(self,points=[]):
self.vertices = []
for point in points:
if isinsta... | true |
bb9892fc2d32f3008d12a02a2e6a00337ef2e298 | Python | LaurenDebruyn/aocdbc | /correct_programs/aoc2020/day_20_jurassic_jigsaw.py | UTF-8 | 8,082 | 3.328125 | 3 | [
"MIT"
] | permissive | import math
import re
import sys
from dataclasses import dataclass
from typing import (
Dict,
List,
Optional,
Set,
Tuple,
Final,
Sequence,
cast,
overload,
Union,
Iterator,
)
from icontract import require, ensure, DBC
VALID_SIDE_RE = re.compile(r"[.#]{10}") #: Express the e... | true |
6fc435e2ca95df99098cdc667140244018498162 | Python | bomethis/project_euler | /1_project_Euler.py | UTF-8 | 401 | 4.3125 | 4 | [] | no_license | # If we list all the natural numbers below 10 that are multiples of
# 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#
# Find the sum of all the multiples of 3 or 5 below 1000.
def sum_natural():
sum_num = 0
for i in range(0, 1000):
if i % 3 == 0:
sum_num += i
elif... | true |
e78e92101dab848cfeaaac848278a5b33f7d8430 | Python | icefoxen/lang | /python/practice/BitsNPieces.py | UTF-8 | 2,191 | 4.21875 | 4 | [
"MIT"
] | permissive | # Example of using a lambda form.
def makeIncrementor( n ):
"""Example of using a lambda form
"""
return lambda x: x + n
f = makeIncrementor( 50 )
f( 20 )
#####################################################################
# Documentation strings.
def func():
"""Do nothing, but document it.
... | true |
c06350ee3fee5b4febfa087998ccbdb8fef9c0d9 | Python | giripranay/PYTHON | /newmodule.py | UTF-8 | 77 | 3.1875 | 3 | [] | no_license |
def addition(a,b):
print(a+b)
def multiplication(a,b):
print(a*b)
| true |
6a3a661b6c378a3d3b16c1fcbe97658941630348 | Python | TheShubham-K/Algorithmic_Toolbox | /week2_algorithmic_warmup/6_last_digit_of_the_sum_of_fibonacci_numbers/fibonacci_sum_last_digit.py | UTF-8 | 2,373 | 3.453125 | 3 | [] | no_license | # Uses python3
import sys
import random
import time
#import numpy as np
'''
def fibonacci_sum_naive(n):
if n <= 1:
return n
previous = 0
current = 1
sum = 1
for _ in range(n - 1):
previous, current = current, previous + current
sum += current
return sum % 10
def ... | true |
32cab0421edd7144d0238571f7f05e09379225d4 | Python | waditya/HackerRank_Arrays | /05_Sparse_Arrays.py | UTF-8 | 1,720 | 3.53125 | 4 | [] | no_license | #!/bin/python3
import sys
arr_temp = input().strip().split(' ')
no_of_strings = int(arr_temp[0])
## print(no_of_strings) ## [--DEBUG--01]
##Flush the temporary array
del arr_temp
## Read the next N ('no_of_strings') from input and store it in an array
arr_strings = []
for ctr in range(no_of_strings):
arr_t =... | true |
2103cb4660abc81694cfc99e3d2f973e71867c9d | Python | limkeunhyeok/daily-coding | /programmers/Level_3/멀리 뛰기/solution.py | UTF-8 | 121 | 2.5625 | 3 | [] | no_license | def solution(n):
dp = [1, 1]
for i in range(1, n):
dp.append(dp[-1] + dp[-2])
return dp[-1] % 1234567 | true |
4b4492221c775868ee3ea2ca23a9180c2263e489 | Python | Tom-1113/python200817a | /score.py | UTF-8 | 743 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 17 14:59:15 2020
@author: USER
"""
s = float(input("請輸入成績"))
if s >=0 and s<=100:
if s>=90:
print("level A")
elif s>=80:
print("level B")
elif s>=70:
print("level C")
elif s>=60:
print("level D")
else:
... | true |
19e79239eab69da820d10db44823209081afb880 | Python | deetemples/gatech | /Functional_Annotation/create_abinitio_gff.py | UTF-8 | 5,624 | 2.5625 | 3 | [] | no_license | '''
Script for creating .gff files from ab-initio results
'''
#!/usr/bin/env python
import subprocess,os,sys
'''
Function reads in the CRISPR results
'''
def pilercr_merger(input_directory_path,pilercr_file):
#Creating input file path
input_file=input_directory_path + pilercr_file
#Creating output file path
... | true |
54bc10e5e75c940f5ef1a9c5fce4335dff47b322 | Python | margaretphillips/leetcode_stubs | /group_anagrams.py | UTF-8 | 776 | 3.828125 | 4 | [] | no_license | #given an array of string group the anagrams
#an anagram is formed by grouping the letters of a different word
#ie ...ate and tea have the same letters
def groupanagrams(arr):
n = arr
#sub = []
#sep =','
#dict = {}
for a in arr:
print('----------')
print(a)
for x in n:
... | true |
d195dee75c1f8c60ff692372420bf22430b92917 | Python | overtunned/DStar-Lite | /dstarNode.py | UTF-8 | 661 | 3 | 3 | [] | no_license | import numpy as np
class Node:
def __init__(self, key, v1, v2):
self.key = key
self.v1 = v1
self.v2 = v2
def __eq__(self, other):
return np.sum(np.abs(self.key - other.key)) == 0
def __ne__(self, other):
return self.key != other.key
def __lt__(se... | true |
d9829c4d3cc6d3ad3bff63616884b2f2db04ff86 | Python | peterhinch/micropython-radio | /radio-fast/rftest.py | UTF-8 | 1,677 | 2.609375 | 3 | [
"MIT"
] | permissive | # Tests for radio-fast module.
# Author: Peter Hinch
# Copyright Peter Hinch 2020 Released under the MIT license
# Requires uasyncio V3 and as_drivers directory (plus contents) from
# https://github.com/peterhinch/micropython-async/tree/master/v3
from time import ticks_ms, ticks_diff
import uasyncio as asyncio
impor... | true |
bf9a9b002114061bf0ada5350ffed85c0692809e | Python | ziuLGAP/2021.1-IBMEC | /exercicio3_26.py | UTF-8 | 921 | 4.03125 | 4 | [] | no_license | """
Exercicio 3-26
Luiz Guilherme de Andrade Pires
Engenharia de Computação
Matrícula: 202102623758
Data: 28/04/2021
"""
def votos(qntd):
"""Computa os votos dos usuários e informa a quantidade de votos de cada candidato"""
cand1 = 0
cand2 = 0
cand3 = 0
for _ in range(qntd):
... | true |
62f3b1e54e63ecfc6dcf4fca59ee5e5aac155da3 | Python | RJJxp/MyPythonScripts | /InClass/adjustment_homework/hw_08.py | UTF-8 | 1,770 | 3.046875 | 3 | [] | no_license | import numpy as np
if __name__ == '__main__':
# ********************************************************
# ****************** first sub-question ******************
# ********************************************************
n = 5
t = 3
V = np.mat([[7.9],
[-9.6],
[... | true |
495325d328abd8ea455aec9e647d491a532e3c21 | Python | JonathanLPoch/Gooroo-Tutoring | /Intro to Programming/prices.py | UTF-8 | 1,209 | 4.125 | 4 | [] | no_license | prices = [] #list for valid prices
while(True): #Continually take in inputs
price = input("Enter a price, 0 to end: ")
if(price.isdigit() or (price[0] == "-" and price[1:].isdigit())): #if a number, or a NEGATIVE one
num = int(price) #cast to int
if(num > 0): #if posit... | true |
25ad6da8db5df9c9b48a219b9c9f08ce6c93697f | Python | techrabbit58/LeetCode30DaysMay2020Challenge | /main/solutions/valid_perfect_square.py | UTF-8 | 1,971 | 4.34375 | 4 | [
"Unlicense"
] | permissive | """
Week 2, Day 2: Valid Perfect Square
Given a positive integer num, write a function which returns True if num is a perfect square else False.
Note:
Do not use any built-in library function such as sqrt.
Example 1:
Input: 16
Output: true
Example 2:
Input: 14
Output: false
"""
from func... | true |
71b25a0bb28007079f3a9123c77f1fddd43a7723 | Python | Artemaleks/programmeerimine | /faktoriaal.py | UTF-8 | 120 | 3.3125 | 3 | [] | no_license | n = input("factorial: ")
n = int(n)
fac = 1
i = 0
while i < n:
i += 1
fac = fac * i
print ("V6rdub",fac)
| true |
0d986d0aa1c4565c3b6040b553b4df30f847fa43 | Python | alvinsunyixiao/IlliniRM | /realsense/realsense_mac_legacy/realsense_pointcloud_demo.py | UTF-8 | 3,323 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python3
import pyrealsense as pyrs
from pyrealsense.constants import rs_option
import time
import matplotlib.pyplot as plt
def point_cloud(depth, cx=320.0, cy=240.0, fx=463.889, fy=463.889):
"""Transform a depth image into a point cloud with one point for each
pixel in the image, using the camer... | true |
2231836a55670032bfc472fd498a1adfb8359f70 | Python | ChandanBharadwaj/py-practice | /basic/range.py | UTF-8 | 558 | 3.125 | 3 | [] | no_license | '''
Created On : Tue Sep 04 2018
@author: Chandan Bharadwaj
'''
# 2.X
# for higher number range(10000000000) is not efficient. it uses more memory of ram and more time.
# to avoid this we have Xrange.
# Xrange use iterator instance internally and keeps only the current encountered item into the memory.
# 3.X
# fo... | true |
3d3f7d37fa4eb94a0fabe9a06d3e10cef7f132d2 | Python | shankar7791/MI-10-DevOps | /Personel/Harshalm/Python/Practice/9March/Prog5.py | UTF-8 | 219 | 4 | 4 | [] | no_license | str = "The Movie is Amazing and Wonderful !"
print(str.endwith("and"))
print(str.count("i"))
print(str.capatilize())
print(str.find("is"))
print(str.title())
print(str.rindex("is"))
print(str.rpartition("and"))
| true |
1fa754fd84672a2d7ef0be8ef2fcbf88d6da1df7 | Python | sachinhegde04/DS-and-Algo-Internship | /problems/17th June/ugly numbers.py | UTF-8 | 410 | 3.65625 | 4 | [] | no_license | def uglynumber(n):
ugly=[0]*n
ugly[0]=1
i2=i3=i5=0
next2=2
next3=3
next5=5
for l in range(1, n):
ugly[l]=min(next2,next3,next5)
if ugly[l] == next2:
i2+=1
next2=ugly[i2]*2
if ugly[l] == next3:
i3+=1
next3=ugly[i3]*3
if ugly[l] == next5:
i5+=1
next5=ugly[i5]*5
return ugly[-1]
... | true |
b8ecd6f025b1a3b12273e2ade400cc8eb96c193a | Python | Reims796/List_v2 | /ft_odd_even_separator_lst.py | UTF-8 | 432 | 3.0625 | 3 | [] | no_license | def ft_len(a):
b = 0
for i in a:
a += 1
return a
def ft_odd_even_separator_lst(lst):
a = 0
for i in lst:
a = a + 1
b = a
i = 0
n = []
k = []
x = [[0], [0]]
for i in range(b):
if lst[i] % 2 == 0:
n.append(lst[i])
... | true |
43ea28cbb228df149438afb23cafec1b3d64341f | Python | DYF-AI/opencv-x | /SeamlessCloning/normal_versus_mixed_clone.py | UTF-8 | 1,086 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding:utf-8 -*-
import cv2
import numpy as np
def seamless_mix_normal(image_src:str, image_dst:str):
# 1. 读取src和dst
img_src = cv2.imread(image_src)
img_dst= cv2.imread(image_dst)
# 创建mask
mask = 255 * np.ones(img_dst.shape, img_dst.dtype)
# 将src贴到dst的中心位置
width, height, channels ... | true |
e5cef50daa5226a6209f4b1d87e71ce48d950c01 | Python | oleglr/GB_Python_Algorithms | /lesson3/task5.py | UTF-8 | 976 | 4.3125 | 4 | [] | no_license | # 7. В одномерном массиве целых чисел определить два наименьших элемента. Они могут быть как равны между собой
# (оба являться минимальными), так и различаться.
import random
SIZE = 10
MIN_ITEM = 0
MAX_ITEM = 100
array = [random.randint(MIN_ITEM, MAX_ITEM) for _ in range(SIZE)]
print(f'Исходный массив: \n{array}')
... | true |
fb3e07f38e8c8b9f4540c723e8b791fafab28474 | Python | quintuskilbourn/Socket-Messenger-Py- | /messenger.py | UTF-8 | 3,244 | 3.515625 | 4 | [] | no_license | import socket
from threading import Thread
from Queue import Queue
q = Queue() #create queue to communicate between threads
#server code
def server():
q.get() #prevent... | true |
f238f9a65e8fe0cb09217e84d93727dd47842a35 | Python | stitchEm/stitchEm | /tests/pyvs/html_validator.py | UTF-8 | 848 | 3.265625 | 3 | [
"MIT",
"DOC"
] | permissive | from HTMLParser import HTMLParser
class HTMLValidator(HTMLParser):
"""
super simple html validator : check that each opening tag is closed
with respect to tag hierarchy
"""
def __init__(self):
HTMLParser.__init__(self)
def handle_starttag(self, tag, attrs):
self.tag_stack.... | true |
fde1ef022ab3a379b3f4dafeb83f67b5189467e5 | Python | akevinblackwell/Raspberry-Pi-Class-2017 | /Cell1Test.py | UTF-8 | 442 | 3.28125 | 3 | [] | no_license | '''
ButtonPush() - a function to check the status of our TicTacToe buttons
and return a cell number if one is pushed.
ButtonPushSetupSetdown(True/False) - a function that configures the GPIO pins. Call it once with True to start.
Call again when done with False.
'''
import RPi.GPIO as GPIO
... | true |
40bfaab16cbc0f3224d869ddafcb4ffcf786df30 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_96/476.py | UTF-8 | 1,527 | 3.140625 | 3 | [] | no_license |
def solve(case):
N, S, p, rest = case.split(" ", 3)
N = int(N)
S = int(S)
p = int(p)
t = [int(x) for x in rest.split(" ")]
#print N, S, p, t
possible_surprising = S
result = 0
for total in t:
if total <= 1:
# surprising not possible
... | true |
addf666200d59fbc19f52c1bc4ec73517fdc23df | Python | fengjiran/tensorflow_learning | /Inpainting/patch/celebahq/utils.py | UTF-8 | 13,296 | 2.59375 | 3 | [] | no_license | from __future__ import print_function
import yaml
import numpy as np
import tensorflow as tf
# from tensorflow.python.framework import ops
def check_image(image):
assertion = tf.assert_equal(tf.shape(image)[-1], 3, message='image must have 3 color channels')
with tf.control_dependencies([assertion]):
... | true |
c67e7296e776d7f7f6cfdb78730a651386252822 | Python | zidanlagaronda/Zidane | /Tugas_ProjeckPCD/percobaan1.py | UTF-8 | 239 | 2.609375 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread("Dane.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv2.imshow("gambar Dane original", img)
cv2.imshow("gambar Dane grayscale", gray)
cv2.waitKey(0)
cv2.destroyAllWindows()
| true |
28c5eb942814d60fed84f1de7b9c883174ba3c01 | Python | safia88/GhostPost | /ghost/models.py | UTF-8 | 666 | 2.71875 | 3 | [
"MIT"
] | permissive | """
Ghost: Boasts, Roasts
Boolean if boast or roast
Charfield for content of post
integer field for up and down votes
datetime field for submit time
"""
from django.db import models
class Post(models.Model):
is_boast = models.BooleanField(default=True)
content = models.CharField(max_length=280... | true |
ab0012ffafe259aa18c731c249cc9c9c9bbf178f | Python | jiadaizhao/LeetCode | /1001-1100/1018-Binary Prefix Divisible By 5/1018-Binary Prefix Divisible By 5.py | UTF-8 | 278 | 2.671875 | 3 | [
"MIT"
] | permissive | class Solution:
def prefixesDivBy5(self, A: List[int]) -> List[bool]:
curr = 0
result = [False] * len(A)
for i, a in enumerate(A):
curr = (curr * 2 + a) % 5
if curr == 0:
result[i] = True
return result
| true |
1df4b6285c15fc346a8fa13bb8b80163591c75ed | Python | StvnLm/100-days-of-python | /Day 1-3/Factorial.py | UTF-8 | 115 | 3.828125 | 4 | [] | no_license | def factorial(n):
product = 1
for x in range(n):
product = x * n
print(product)
factorial(10)
| true |
84bf95a45f6e6d96d998e1a1a2b0d75b5312db20 | Python | kauemenezes/Mestrado | /RNA/python-perceptron-one-layer/main.py | UTF-8 | 889 | 2.640625 | 3 | [] | no_license | import numpy as np
from perceptron import Perceptron
import datasets
dataset = datasets.get_dermatology_dataset()
hit_rates = []
no_of_attributes = dataset.shape[1] - 1
no_of_classes = len(dataset[0, no_of_attributes])
perceptron = Perceptron(no_of_classes, no_of_attributes, 'logistic')
for j in range(0, 20):
p... | true |
e956d55a10ef8a9d0c043a3e8728f2bf2bc2c2b1 | Python | mj596/blazarpp | /scripts/calcElectronEnDiss_todo/calcElectronEnDiss.py | UTF-8 | 1,328 | 2.625 | 3 | [] | no_license | import numpy as np
import sys
import math
import matplotlib.pyplot as plt
def read_data( filename ):
x=[]
y=[]
file = open(filename,'r')
for line in file.readlines():
x.append(float(line.split(" ")[0]))
y.append(float(line.split(" ")[1]))
file.close()
return np.arra... | true |
63563d9f89e1f4f12352fa63d97c472374456fae | Python | gjacopo/test-huggin | /scripts/article_analytics.py | UTF-8 | 2,513 | 3.390625 | 3 | [] | no_license | #!/usr/bin/env python3
# note the line above is useful to launch the script from the command line, e.g. using
# python -m ...
"""
Document the script, for instance:
Parse in the KNIME output an article table from the main fields of an online article parsed through
the KNIME input.
"""
from six import string_t... | true |
a001a0e01478554a6e9f1375b7fb47c56d3c04db | Python | leoleezoom/omnipod_rf | /print_packet.py | UTF-8 | 1,634 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python2
import argparse
import binascii
import json
def main(options=None):
parser = argparse.ArgumentParser(description='Print out structured version of packet (given as a hex string).')
parser.add_argument('data', metavar='data', type=str, nargs='+',
help='data as a he... | true |
e8ae9edf6ab994b6d389c71470d3eedf040bcdcc | Python | haominhe/Undergraduate | /CIS210 Computer Science I/Projects/p1/jumbler.py | UTF-8 | 2,173 | 4.0625 | 4 | [
"MIT"
] | permissive | # Solve a jumble (anagram) by checking against each word in a dictionary
# Fall 2014 Project 1, Part 2
# Authors: Haomin He
# References: Consulted with tutor Sara and Rickie.
#
# Usage: python jumbler.py jumbleword wordlist.txt
#
import argparse
def jumbler(jumble, wordlist):
"""
Print elements of wordlist ... | true |
d7739653779c61c1bfba3f2465423bb8f351b8cd | Python | iam-smjamilsagar/Digital-Time | /main.py | UTF-8 | 957 | 3.0625 | 3 | [] | no_license | import speech_recognition as sr
import pyttsx3
import datetime
listener = sr.Recognizer()
alexa = pyttsx3.init()
voices = alexa.getProperty('voices')
alexa.setProperty('voice', voices[1].id)
def talk(text):
alexa.say(text)
alexa.runAndWait()
def take_command():
try:
with sr.Microphone() as sou... | true |
043f4a35bcb80f35ebe70d56f860cfeefc35e047 | Python | ksuarz/hundred-days | /text/piglatin.py | UTF-8 | 815 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python
'''
Converts words to pig latin. This is a very naive implementation. All
non-alphanumeric, non-whitespace characters are treated as part of a word.
'''
import sys
if len(sys.argv) < 2:
print 'Usage: piglatin.py [TEXT]'
else:
# First, build up our vowels and consonants
start, end = o... | true |
4cb0518d4f238ed95d8a5524573abdb39df6c6cd | Python | Ashw0rld/rpg-code | /main.py | UTF-8 | 7,874 | 3.15625 | 3 | [] | no_license | from classes.game import Person, bcolors
from classes.magic import Spell
from classes.inventory import Item
import random
# create black magic
fire = Spell("fire", 10, 100, "black")
thunder = Spell("thunder", 10, 100, "black")
blizzard = Spell("blizzard", 10, 100, "black")
meteor = Spell("meteor", 60, 200, "b... | true |
536d3aa44b373eeb6620bd540d66ef32ff258994 | Python | jose-carlos-code/CursoEmvideo-python | /exercícios/EX_CursoEmVideo/ex078.py | UTF-8 | 279 | 3.375 | 3 | [
"MIT"
] | permissive | pos = 0
valores = list()
for v in range(1, 5+1):
pos += 1
valores.append(int(input(f'digite o valor na posição {pos}: ')))
print(f'\nvocê digitou os valores {valores}')
print(f'\no maior valor foi {max(valores)}')
print(f'\no menor valor digitado foi {min(valores)}')
| true |
18f20a9d2eb2bcb17b73b6be6f83f40eefa784e9 | Python | c0dir/Vk-Bots | /whoami.py | UTF-8 | 212 | 2.515625 | 3 | [] | no_license | import vk
if __name__ == '__main__':
with open('access_token.txt') as fp:
access_token = fp.read()
vkapi = vk.Api(access_token)
me, = vkapi.users.get()
print('{first_name} {last_name}'.format(**me))
| true |
a8342d79e189f19ede2b02f65bd13fddb5aa3c07 | Python | dezed/mantid | /Testing/SystemTests/tests/analysis/PredictPeaksTest.py | UTF-8 | 4,531 | 2.8125 | 3 | [] | no_license | # pylint: disable=no-init,too-few-public-methods
import stresstesting
from mantid.simpleapi import *
from mantid.geometry import CrystalStructure
# The reference data for these tests were created with PredictPeaks in the state at Release 3.5,
# if PredictPeaks changes significantly, both reference data and test may n... | true |
ed0ffaab0b616209ef973471cb412dcb2eaaa1e3 | Python | lvchy/ClientTools | /UABTools/bkdrhash.py | UTF-8 | 239 | 3.125 | 3 | [] | no_license | _seed = 131
def bkdrhash(str):
hashnum = 0
sz = len(str)
for i in range(sz):
hashnum = (hashnum * _seed) + ord(str[i])
return hashnum & 0x7FFFFFFF
if __name__ == "__main__":
print(bkdrhash('hello world')) | true |
c6386cbf35bbc5bf5a0f8af79cc37e40bf616be3 | Python | hilmarm/sisy_table | /main.py | UTF-8 | 745 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
from table_solver import TableSolver
from draw_table import DrawTable
from create_timetable import CreateTimetable
from parse_programm import ParseProgramm as PP
import random
def main():
# A = [[0,2], [1,3], [9,10], [4,8], [6,10], [2,6]]
my_input = 'input/program20180820'
pp = PP(... | true |
834aa52d5b1df6854946c7e478296b108a1ccd6c | Python | DL-Metaphysics/DL-LJ | /贝叶斯个性化排序/贝叶斯.py | UTF-8 | 3,333 | 2.671875 | 3 | [] | no_license | import tensorflow as tf
import numpy
import os
import random
from collections import defaultdict
#tensorflow实现BPR
def load_data(data_path):
user_ratings = defaultdict(set)#set:集合,集合无重复
max_u_id = -1
max_i_id = -1
with open(data_path,'r') as f:
for lines in f.readlines():
u,i,_,_ = l... | true |
7ebd16415511337defe5c634de51c88e9c578dbf | Python | gabriel-piedade95/Biologia_de_Sistemas | /convergencia_redes.py | UTF-8 | 1,352 | 3.171875 | 3 | [] | no_license |
def _cal_T_estados(lista, est_ant):
if est_ant == lista[est_ant]:
return 0
if est_ant not in lista:
return 1
anteriores = []
for k in range(0, len(lista)):
if lista[k] == est_ant and k != est_ant:
anteriores.append(k)
n = 1
for i in range(0, len(anteriores)):
n += _cal_T_estados(lista, anteriore... | true |
002fcfbd7061a46d64d868b1a069dea7a055af97 | Python | vivekworks/learning-to-code | /4. Discovering Computer Science/Python/Chapter 4 - Growth And Decay/Exercises 2/exercise425.py | UTF-8 | 474 | 3.609375 | 4 | [] | no_license | """
Purpose : Plot investment amount
Author : Vivek T S
Date : 02/11/2018
"""
import matplotlib.pyplot as pyplot
def invest(investment, rate, years):
amount = investment
amountList = []
amountList.append(amount)
for month in range(years*10):
amount = amount+(amount*(rate/100))+50
print(amount)
amountList.... | true |
5a4852f65ca2cb6c775f13d361323bebe625ea78 | Python | iramgee/PracticingPython | /assignment7_2.py | UTF-8 | 511 | 3.078125 | 3 | [] | no_license | # Use the file name mbox-short.txt as the file name
fname = raw_input("Enter file name: ")
fh = open(fname)
count = 0
n = 0
total = 0
for line in fh:
if not line.startswith("X-DSPAM-Confidence:") : continue
count = count + 1
pos = line.index(':')
loc = pos +1
dig = line[loc:]
n... | true |
95ce5ef8a635ff867aaf72d242e115ed60f436e6 | Python | iamsjn/CodeKata | /hackerrank/sum-vs-xor.py | UTF-8 | 494 | 3.03125 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
def get_binary(result, i):
while i > 1:
print(i % 2)
i = i // 2
# def get_xor(n, i):
# return get_binary(n) ^ get_binary(i)
# Complete the sumXor function below.
# def sumXor(n):
# count = 0
# # for i in range... | true |
bfd8dcf8a5fe881827ff6bde58fa19b7754a83cd | Python | zhaotun/python-files | /movefile.py | UTF-8 | 1,008 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding:utf8 -*-
import os
import shutil
source_path = os.path.abspath(r'F:\Face\DataSet\face_anti_spoofing\IR\IR_video\IR_Print_video2img')
target_path = os.path.abspath(r'F:\Face\DataSet\face_anti_spoofing\IR\IR_video\test')
if not os.path.exists(target_path):
os.makedirs(target_pat... | true |
4f3a28d12f8fdbf22521b395379c933d14fffd69 | Python | Natorius6/ArcadeWork | /SNOWMAN.py | UTF-8 | 888 | 3.328125 | 3 | [] | no_license | import arcade
#snowman drawing code
#size of the game window
WIDTH = 600
HEIGHT = 600
#opens the game window
arcade.open_window(WIDTH, HEIGHT, "hello")
#draws background
arcade.set_background_color(arcade.color.AIR_SUPERIORITY_BLUE)
arcade.start_render()
#draws body of the snowman
arcade.draw_circle_filled(WIDTH/... | true |
3dfed51d8404683a3f4892ff66194fac4e140193 | Python | combateer3/PN532-python-lib | /card_timer.py | UTF-8 | 1,640 | 3.359375 | 3 | [] | no_license | from multiprocessing import Process, Event, Value
import time
# this function blocks until the card has been removed
# for some number of seconds
def card_removal_wait(card_read_func, sec=1, check_interval=0.1):
card_removed = Event()
# 2 processes are spawned
# one keeps a timer
# other resets the tim... | true |
e7522fa65806f5335526e13e44093d875cd15f7e | Python | siddhujz/wikianalytics | /python/wikicrawl-v4.py | UTF-8 | 15,475 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 3 21:54:41 2017
@author: kaliis
"""
import re
import sys
import json
import string
import nltk
from imdbpie import Imdb
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.tag import StanfordNERTagger
from nltk.tag.perceptron import Perceptr... | true |
4e693ac100a6a3277fe3c15ee4bdd13e77103c9a | Python | jingyiZhang123/leetcode_practice | /array/581_shortest_unsorted_continuous_subarrary.py | UTF-8 | 1,830 | 3.859375 | 4 | [] | no_license | """
Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too.
You need to find the shortest such subarray and output its length.
Example 1:
Input: [2, 6, 4, 8, 10, 9, 15]
[4,-2, 4,... | true |
bd7e0f4ae0f8a1688b80c1ef02b8b3c9c203559d | Python | ShaneKilloran/ChessEngine | /MiniMax.py | UTF-8 | 2,766 | 3.96875 | 4 | [
"MIT"
] | permissive | ##########################
###### MINI-MAX ######
##########################
class MiniMax:
# print utility value of root node (assuming it is max)
# print names of all nodes visited during search
def __init__(self, root):
#self.game_tree = game_tree # GameTree
self.root = root # Game... | true |
0abbba473e45469f2d48ccdfd94026840bac8877 | Python | zach-fried/Data-Analysis | /sentiments.py | UTF-8 | 599 | 2.640625 | 3 | [] | no_license | from mastodon import Mastodon
# Create actual API instance
mastodon = Mastodon(
access_token = 'c6d72eee8edd1242f2aae49b78cbef3f23ba35f27775fdad90b9d9766ad5e73b',
api_base_url = 'https://mastodon.social'
)
# First toot
# mastodon.toot('Tooting via python using #mastodonpy!')
# Testing API search function
que... | true |
df7718eb08f0bcf7619f8aca6f10e54f6fce0d03 | Python | swjuno/clustor | /face_detect_opencv_haar_movie.py | UTF-8 | 1,080 | 2.578125 | 3 | [] | no_license | import cv2
face_cascade = cv2.CascadeClassifier('./data/haarcascade_frontalface_default.xml')
#mouth_cascade = cv2.CascadeClassifier('./data/haarcascade_mcs_mouth.xml')
scaler=0.4
cap =cv2.VideoCapture('./img/5.mp4')
while True:
ret, img = cap.read()
if not ret:
break
img_resize =... | true |
a6ec3ff0eba1de06169ffc89f4b3f8b2b4c34f65 | Python | iceman67/DataAnalysis | /6-10wk-openweathermap/openweathermap_json_csv2.py | UTF-8 | 1,898 | 3.171875 | 3 | [] | no_license | import requests
import json
"""#### openweathermap 결과 CSV 저장"""
def search_city_extract(city):
API_KEY = 'a070fcd8fc2db8d5d1f140466a2012b4' # initialize your key here
# call API and convert response into Python dictionary
url = f'http://api.openweathermap.org/data/2.5/weather?q={city}&APPID={API_KEY... | true |
a0154616c01fa107bff083e40b1e2cae89f75557 | Python | Wizmann/ACM-ICPC | /HackerRank/All Contests/ProjectEuler+/022.py | UTF-8 | 353 | 3.359375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | def get_score(i, s):
res = 0
for c in s:
res += ord(c) - ord('A') + 1
res *= i
return res
n = int(raw_input())
d = {}
names = sorted([raw_input() for i in xrange(n)])
for i, name in enumerate(names):
d[name] = get_score(i + 1, name)
q = int(raw_input())
for i in xrange(q):
name... | true |
520b2b0d211da3d190c9b7b816505eefd069e40c | Python | RuidongZ/LeetCode | /code/240.py | UTF-8 | 1,237 | 4 | 4 | [] | no_license | # -*- Encoding:UTF-8 -*-
# 240. Search a 2D Matrix II
# Write an efficient algorithm that searches for a value in an m x n matrix.
# This matrix has the following properties:
#
# Integers in each row are sorted in ascending from left to right.
# Integers in each column are sorted in ascending from top to bottom.
# Fo... | true |
723be6f53e67aad81b83602e18b6820a51b5a4e0 | Python | allenai/allennlp | /tests/common/params_test.py | UTF-8 | 11,067 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | import json
import os
import re
from collections import OrderedDict
import pytest
from allennlp.common.checks import ConfigurationError
from allennlp.common.params import (
infer_and_cast,
Params,
remove_keys_from_params,
with_overrides,
)
from allennlp.common.testing import AllenNlpTestCase
class T... | true |
91a59c05d6013a8b1adae55e9d2924d971a59c63 | Python | furkandv/Example | /inputalarakparolaoluşturma.py | UTF-8 | 321 | 3.859375 | 4 | [] | no_license | """
Kullanıcıdan input alarak random parola oluşturma +++
"""
import random
isim = input ("isminizi giriniz: ")
parola = " "
for i in range (random.randint(5,8)):
parola += random.choice(isim)
for i in range (random.randint(3,5)):
parola += str(random.randint(0,9))
print ("Parolanız: ",parola) | true |
9fd1e134c2d1bc99e219d40a1d6eaaef40975f50 | Python | Arjundoodle/Machine_learning | /numpy.py | UTF-8 | 1,775 | 3.0625 | 3 | [] | no_license | import numpy as np
#%%
#1D, 2D and 3D Array
arr = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
arr2 = np.array([[1, 2, 3], [4, 5, 6]])
arr3 = np.array([[[1, 2, 3], [4, 5, 6]], [[1, 2, 3], [4, 5, 6]]])
arrs=np.array(['apple', 'banana', 'cherry'])
print(arr,arr2,arr3)
#%%
print(arr[2],arr2[0][1])
#%%
print(arr[1:5])
pr... | true |
5f986386f8faad4c81cf5e5681cfcea8da25dacd | Python | kalpanasingh/rat-tools | /ratzdab/test/test_trig.py | UTF-8 | 1,535 | 2.8125 | 3 | [] | no_license | '''unit tests for ratzdab conversion utilities: trig headers'''
import unittest
import ratzdab
from rat import ROOT
class TestTRIG(unittest.TestCase):
def test_trig(self):
'''Test conversion of RAT::DS::TRIGInfo objects to and from ZDAB
TriggerInfos.
Exceptions:
* runID is no... | true |
dc3438898f76d8fa0789fb2717ff4db7d5ab7b2c | Python | Creoles/creole | /creole/cli/util.py | UTF-8 | 1,277 | 3.09375 | 3 | [] | no_license | # coding: utf-8
import os
from contextlib import contextmanager
from subprocess import check_output, check_call, CalledProcessError
@contextmanager
def cd(dir_path):
orig_dir = os.path.abspath('.')
os.chdir(dir_path)
yield
os.chdir(orig_dir)
@contextmanager
def cd_root():
"""Change working dir t... | true |
1adc536cabbfa03f1fafb20906711efe7f91aa0f | Python | databill86/advanced-statistics | /statistics/src/3-14-times-magazine.py | UTF-8 | 1,139 | 2.609375 | 3 | [] | no_license | # Import
import matplotlib.pyplot as plt
import pandas as pd
import pymc3 as pm
from scipy.stats import norm
import seaborn as sns
# Config
os.chdir("/home/jovyan/work")
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
plt.rcParams["figure.figsize"] = (12, 3)
# Preparation
data = pd.read_csv("./data/... | true |
a7819d85ba2334bfb1ab674ab9ad348c0e74a1ef | Python | Sourish1997/ray-tracing | /materials/reflective_material.py | UTF-8 | 565 | 2.859375 | 3 | [] | no_license | from .material import Material
import numpy as np
class ReflectiveMaterial(Material):
def __init__(self, amb, ref):
super().__init__(amb)
self.ref = ref
def get_color(self, point, normal, ray, lights):
c_rgb = np.zeros(3)
ambient = np.array([0.4, 0.4, 0.4])
c_rgb += se... | true |
779c99e1e8a2522397aed989080fd35023f26074 | Python | SimeonTsvetanov/Coding-Lessons | /SoftUni Lessons/Python Development/Python Advanced January 2020/Python Advanced/06. EXERCISE TUPLES AND SETS/08 - Multidimensional Lists - Exercise 2/05. Alice in Wonderland.py | UTF-8 | 4,319 | 3.609375 | 4 | [] | no_license | class Matrix:
def __init__(self, rows: int, type_data: type, separator=None):
self.rows = rows
self.type_data = type_data
self.separator = separator
self.data = Matrix.creation(self)
@property
def sum_numbers(self):
if (self.type_data == int) or (self.type_d... | true |
d4f07fb7e9c944c81377c35bb915c79248c83431 | Python | zhaoyuanjdf/LwModel2 | /models/model_base.py | UTF-8 | 1,328 | 2.625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
from keras.models import Sequential
from keras.models import load_model
class ModelBase(object):
def __init__(self):
self.model = Sequential()
def fit(self, x, y, batch_size=32, epochs=10, verbose=1, callbacks=None,
validation_split=0., validation_data=None, shuffl... | true |
60b9169d301d81293de5894b2d80d8a62eaea851 | Python | thales-mro/python-basic | /numpy/vectorized-computation/permute-axes-with-transpose-statement-high-dimension-arrays.py | UTF-8 | 198 | 3.34375 | 3 | [] | no_license | import numpy as np
X = np.arange(16).reshape((2, 2, 4))
print("Original X:")
print(X)
Y = X.transpose((1, 0, 2))
print("Rearrange with transpose:")
print(Y)
print("Default transpose:")
print(X.T) | true |
84d44a1ea8a3bf79c09b178d6b40835a602925b8 | Python | VirenS13117/Reinforcement-Learning | /Ex6/src/Stochastic_Environment.py | UTF-8 | 3,658 | 3.15625 | 3 | [] | no_license | import numpy as np
class StochasticGrid:
def __init__(self, blocks):
self.min_x = 0
self.max_x = 8
self.min_y = 0
self.max_y = 5
self.start = (3,0)
self.goal_state = (8,5)
self.actions = ["left", "right", "up", "down"]
self.curr_state = self.start
... | true |
c452a7f4e4878e5e249c5e165fdde5d561e00418 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_96/1179.py | UTF-8 | 609 | 2.6875 | 3 | [] | no_license | f = open("B-large.in")
T = int(f.readline())
out = open("B-large.out", 'w')
for i in range(T):
out.write("Case #" + str(i+1) + ": ")
line = f.readline().strip().split()
maxi = 0
N = int(line[0])
S = int(line[1])
p = int(line[2])
scores = [int(line[j]) for j in range(3... | true |
faf4d9c8292b46cd09e483cbfbba00c3e16a8aa5 | Python | air01a/pentestingtools | /crypto/genereSalt.py | UTF-8 | 1,549 | 2.5625 | 3 | [] | no_license | import hashlib
import sys
sentence=sys.argv[1]
clear=""
finalHash=""
salt1=""
combinaison=2**len(sentence)
separator=['','*',':','=','|']
def sha1(cleartext):
return hashlib.sha1(cleartext).hexdigest()
def permutation(tab):
result=[]
if len(tab)>1:
for i in range(0,len(tab)):
permute=tab[i]
tab2=tab[:]
... | true |
74cc970b7a0454472846413c9c20aae8fee1c290 | Python | xin-tian1978/signpost | /test/edison_crypto_test/data/processing/integrate.py | UTF-8 | 680 | 3.21875 | 3 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #!/usr/bin/env python3
import argparse
import csv
parser = argparse.ArgumentParser()
parser.add_argument('file', help='csv file')
parser.add_argument('start', type=float, help='start x value')
parser.add_argument('end', type=float, help='end x value')
args = parser.parse_args()
s = 0
a = []
with open(args.file) as c... | true |
c98c453cfb03efbaee6d2b147cb0d8b87288712d | Python | ceegin/Pocket-Passport | /model.py | UTF-8 | 2,525 | 2.84375 | 3 | [] | no_license | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
##############################################################################
# Model definitions
class User(db.Model):
"""User login information."""
__tablename__ = "users"
user_id = db.Column(db.Integer, autoincrement=True, primary_key=True)... | true |
80eee3b503e749bf074106681059edae8580977c | Python | eupston/Deepbeat-beatbox2midi | /utils/onset_offset.py | UTF-8 | 1,002 | 2.640625 | 3 | [
"MIT"
] | permissive | import librosa
import numpy as np
def onset_offset(sr, onset, onsetframes, silences):
##----------Converts Silences Milliseconds to frames-------
silences_frames = []
for items in silences:
silences_frames.append([round(items[0]*(sr/1000)), round(items[1]*(sr/1000))])
#---------------------------------... | true |
627f156cf4ab8c18843a9f9bc19ccbd8182d5e8a | Python | hbcbh1999/pure-LDP | /pure_ldp/frequency_oracles/direct_encoding/de_client.py | UTF-8 | 1,492 | 2.734375 | 3 | [
"MIT"
] | permissive | from pure_ldp.core import FreqOracleClient
import math
import numpy as np
import random
class DEClient(FreqOracleClient):
def __init__(self, epsilon, d, index_mapper=None):
super().__init__(epsilon, d, index_mapper)
self.update_params(epsilon, d, index_mapper)
def update_params(self, epsilon=N... | true |
6094915dc5929832722d46d950b40962cfb0775b | Python | Ganesh-sunkara-1998/Python | /Important codes/satya questions/code6.py | UTF-8 | 269 | 3.703125 | 4 | [] | no_license | ''' Write a python function to get a string which is
n (non-negitive integer) copies of a given string and return it...'''
def function(n):
#print(" copied the string:-",n)
return n
def main():
n=input("Enter your number:-")
function(n)
main()
| true |
a3734f414293d80137e0cc24d788df70d9688de2 | Python | ruxtom/csc8112 | /consumers/graphing.py | UTF-8 | 657 | 2.8125 | 3 | [] | no_license | import plotly.graph_objects as go
from time import process_time
# Creates a graph with the given data in the server/public/external_html folder
def createGraph(title, xAxis, yAxis, yAxisTitle, outputFileName):
tStart = process_time()
fig = go.Figure(data=go.Bar(x=xAxis, y=yAxis))
fig.update_layout(title=ti... | true |
ff973b1343a79269a6b9de3c27f417275b60ee7b | Python | 5l1v3r1/wargames | /cryptopals/set 4/challenge 29/run.py | UTF-8 | 2,328 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
# The matasano crypto challenges - Set 4 Challenge 29 (http://cryptopals.com/sets/4/challenges/29/)
#
# Copyright (c) 2015 - Albert Puigsech Galicia (albert@puigsech.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentati... | true |
e35c68ae2a727db7d6c38f856781b30b4a528fad | Python | Ruaman/PatternFlow | /algorithms/image/correction/main.py | UTF-8 | 704 | 2.609375 | 3 | [] | no_license | import matplotlib.pyplot as plt
from skimage import data
from PatternFlow.image.correction.correction import adjust_log
def main():
img = data.moon()
img_log = adjust_log(img)
img_inv_log = adjust_log(img, inv=True)
# config figure size
fig = plt.figure(figsize=(10, 5))
fig.add_subplot(1, 3,... | true |
bb7457407c49b8f9c9883d0b55018f95ea709fb1 | Python | krzkrusz/pageobjects | /page_object_example/tests/new_customer_page.py | UTF-8 | 3,050 | 2.625 | 3 | [] | no_license | from page_object_example.base_page import BasePage
class NewCustomerPage(BasePage):
@property
def name_text_field(self):
return self.driver.find_element_by_name('name')
@property
def gender_male_radio_button(self):
return self.driver.find_element_by_xpath('.//input[@type="radio" and @... | true |
f175443cf6eb6211eaf1b086f53f8b113da85a4b | Python | xodhx4/webcam_image_recognizer | /util.py | UTF-8 | 262 | 3.25 | 3 | [] | no_license | """Util functions for this package
"""
import os
def makepath(path):
"""Make dir if not exit.
Args:
path (string): The path to check
"""
if not os.path.exists(path):
os.mkdir(path)
print(f"Make folder : {path}")
| true |
3325e4ab645853a2d7d6de9f60103f638b15bafa | Python | naidenovaleksei/ml_cookbook | /tree_graphviz.py | UTF-8 | 1,241 | 2.96875 | 3 | [] | no_license | # Примеры визуализации дерева решений
def visualize_tree_graphviz(tree, features):
"""вариант 1 graphviz (лучше)"""
# sudo apt-get install graphviz
# sudo pip install graphviz
from graphviz import Source
from sklearn.tree import export_graphviz
# DOT формат дерева (строка)
tree_data = expo... | true |
aeb7ac2d840d856cfe90f563588e26a9e8e54b4a | Python | kwangilkimkenny/socialcalProject | /blog/templates/socialActCO2.py | UTF-8 | 848 | 3.84375 | 4 | [] | no_license | print("모든 것의 가치를 산정한다는 것은 어려운 일이다. \n하지만 모든 것은 가치가 있다. 공짜라고 진짜 가치가 없는 것은 아니다. \n공기가 없다면 생명체는 살 수 없다. \n맑은 공기를 마시시 위해서 우리가 지불해야하는 가치(비용)은 얼마가 될까. \n 이 계산기는 이러한 문제를 계산해보고 가진것들의 가치를 다시한번 생각해 보자.")
print()
x= input("activity 'the value of lowering heating by ? degree.': ")
inputA= float(x)
Valueofyear = inputA * 23 * ... | true |
a3d29d23e6bbb70bc37757b1992e2a01ed3c7189 | Python | mortenjc/lang | /python/crypto/week3.py | UTF-8 | 436 | 2.875 | 3 | [] | no_license | #!/usr/bin/python
from Crypto.Hash import SHA256
def get_bytes_from_file(filename):
return open(filename, "rb").read()
file = get_bytes_from_file("week3.mp4")
BLKSZ =1024
blocks = len(file)/BLKSZ
chunk = file[blocks*BLKSZ:]
sha = SHA256.new(chunk).digest()
for i in range(blocks):
offset = (blocks-i-1... | true |
efb9766e4dba3ec16cacdd629bdf8bab833c89ab | Python | JayeJuniper/Project-04 | /worklog_db.py | UTF-8 | 6,873 | 3.359375 | 3 | [] | no_license | from collections import OrderedDict
import datetime
import os
import re
from peewee import *
db = SqliteDatabase('worklog.db')
class Entry(Model):
employee = CharField(max_length=255, unique=False)
task_name = CharField(max_length=255, unique=False)
duration = CharField(max_length=255, unique=False)
... | true |
b71c19a80d43e2e8819d061e20ee341635ebf52e | Python | abnerrf/cursoPython3 | /3.pythonIntermediario/aula3/aula3.py | UTF-8 | 616 | 3.953125 | 4 | [] | no_license | '''
FUNÇÕES (DEF) EM PYTHON - *args **kwargs -
'''
def func(*args):
print(args)
lista = [1,2,3,4,5]
print(*lista)
print('')
#######################################
def funcao(*args):
for v in args:
print(v)
funcao(1,2,3,4,5)
#####################################
def teste(*args, **kwargs):
prin... | true |
e695246eebc9ee22426eddf2ba9233d33afdcfa8 | Python | RaulVS14/adventofcode2020 | /Day 16/day_16_functions.py | UTF-8 | 4,771 | 2.671875 | 3 | [] | no_license | import re
from helpers.helpers import read_file
def process_file(file):
row = 0
data = {}
data["rules"] = {}
key_word = False
while row < len(file):
row_match = re.match(r'(?P<key>^[a-z ]*): (?P<rule1>\d*\-\d*) or (?P<rule2>\d*\-\d*)', file[row])
if row_match:
data["ru... | true |
431633c33d2b112e2b11a681bae411e53431d5e8 | Python | anchitshrivastava/Instagram-Scrapping | /engagement_score.py | UTF-8 | 3,325 | 2.625 | 3 | [] | no_license | from instaloader import Instaloader, Profile
from instaloader.exceptions import QueryReturnedNotFoundException, LoginRequiredException,ProfileNotExistsException
import pandas as pd
# L = Instaloader()
# df = pd.read_csv("/Users/anchitshrivastava/Desktop/Tatras Data/Instagram Scrapping/Vietnam csv/Vietnam_combined_2_wit... | true |