blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
67be3b72af1d9dc28b2d7546566a6ca29c0fb186 | ravichalla/wallbreaker | /week4/score_of_parenthesis.py | UTF-8 | 1,052 | 4.3125 | 4 | [
"MIT"
] | permissive | '''
QUESTION:
856. Score of Parentheses
Given a balanced parentheses string S, compute the score of the string based on the following rule:
() has score 1
AB has score A + B, where A and B are balanced parentheses strings.
(A) has score 2 * A, where A is a balanced parentheses string.
Example 1:
Input: "()"
Output: ... | true |
912b8a3f2e2915be48289d80f7857d188f8df8f8 | JulNicole06/data-wrangling-final-project | /audit.py | UTF-8 | 1,995 | 3.296875 | 3 | [] | no_license | #!/usr/bin/python
import xml.etree.cElementTree as ET
from collections import defaultdict
import pprint
import csv
def audit_street_type(street_types, street_name, expected_list):
'''
INPUT:
street_types: initial empty dict variable to input values
street_name: street name value to evaluate
expected_lis... | true |
44d746698872d7926e0824b74334f27a1f8bf158 | catseye/NaNoGenLab | /guten-gutter/guten-gutter.py | UTF-8 | 5,993 | 2.984375 | 3 | [
"Unlicense",
"LicenseRef-scancode-public-domain"
] | permissive | #!/usr/bin/env python
"""Usage: guten-gutter.py [--output-dir DIR] FILES
Cleans the Project Gutenberg boilerplate off of the given input files.
"""
from optparse import OptionParser
import os
import re
import sys
class AbstractBaseCleaner(object):
"""Defines the protocol for "cleaner" objects."""
def clea... | true |
fae859cc0c73555a7fbdf2904ed5a3cadd1499de | eognianov/PythonProjects | /PythonBasics/exam-preparation/4. Worms World Party.py | UTF-8 | 369 | 2.921875 | 3 | [] | no_license | line = input()
teams = dict()
all_members = set()
while line != 'quit':
line = line.split('->')
name, team, score = line[0],line[1],line[2]
if not (name in all_members):
if team in teams:
teams[team][name] = score
else:
teams[team]={name:score}
all_members.ad... | true |
9476b841b947ef18eb21ab274025a06cec7534e0 | vhbsoft/elara | /scripts/automation_scripts/delayer_sim.py | UTF-8 | 2,740 | 2.546875 | 3 | [] | no_license | # 4-node-additional-delay
# Example Usage:
#when is a shaper pass a big number like 1 million to delayer arg
#when not a shaper pass a small number like 10 to the delayer
#shaper = set isShaper to True
#delayer = set isShaper to Flase
#Needed to run command line arguments in python
import os
#Directory where waf co... | true |
2194804c21a0df15a9db264086349dd9bbeb4ca9 | vini52/Exercicios_PI_Python | /ece/lista5/lista5_8.py | UTF-8 | 683 | 3.5 | 4 | [] | no_license | def montar_matriz(n:int) -> list:
m = []
linha = []
for i in range(n):
linha = input().split(' ')
m.append(linha)
return m
def somar_diagonal(m:list) -> list:
matriz = m
for i in range(len(m)):
for j in range(len(m)):
if i != j:
matriz[j][i] =... | true |
f8c9eb58b16e1a1d2807934f9a525735742011a9 | mkhairul/p2p | /filecheckmd5.py | UTF-8 | 745 | 2.921875 | 3 | [] | no_license | import md5, sys, os, time
def compute( filename, chunk = 2**20 ):
file = open( filename, 'rb' )
try:
check = md5.new()
data = file.read( chunk )
count = 1
while data:
check.update( data )
data = file.read( chunk )
return check.hexdigest()... | true |
55248d8dfcdcdd919c3db3df512f75edfd425590 | JLMengsk/leetCode | /String/0/Implement_strStr.py | UTF-8 | 1,282 | 3.9375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# @Time : 6/12/2020 12:00 AM
# @Author : Jupiter
# @Site :
# @File : Implement_strStr.py
# @Software : PyCharm
# Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
class Solution1:
def strStr(self, haystack, needle):
... | true |
f2b1b1af9c2124eee18cb44ef7da67d960e8aa6c | ajithomasv/stockanalysis | /securitylist.py | UTF-8 | 3,658 | 2.546875 | 3 | [] | no_license | import requests as requests
import pandas as pd
import json
import arrow
import re
import requests
from sqlite import SqlLite
from utils import Utility
from collections import defaultdict
class Security():
tblname = 'security'
indexcol = 'symbol'
basepath = 'c:\\ajit\\stockanalysis'
bselist = f... | true |
ffe5fcdb6b2c9997f5a0b7162eee2d52f1425008 | nik-sm/BciPy | /bcipy/feedback/visual/level_feedback.py | UTF-8 | 5,416 | 3.109375 | 3 | [
"MIT"
] | permissive | from bcipy.feedback.visual.visual_feedback import VisualFeedback
from psychopy import visual, core
from typing import Tuple
class LevelFeedback(VisualFeedback):
"""Level Feedback.
A progress bar like feedback to indicate current abilities in a BCI task. This could
be atteniveness, muscle or eye acti... | true |
74c0b5f79bbe740c2362b764766aef35599f30f0 | deizianens/8-puzzle | /search.py | UTF-8 | 3,149 | 2.9375 | 3 | [] | no_license | import numpy as np
import heapq
from queue import PriorityQueue
from collections import deque
class Search:
def __init__(self):
self.path_to_solution = []
self.states = []
self.max_search_depth = 0
self.nodes_expanded = 0
def bfs(self, puzzle_board):
frontier = deque... | true |
58d6aa729aa2ef4aa1648f012cd03c79be6ad9fb | romain-li/leetcode | /problems/0104_Maximum_Depth_of_Binary_Tree/__init__.py | UTF-8 | 335 | 2.984375 | 3 | [] | no_license | ID = '104'
TITLE = 'Maximum Depth of Binary Tree'
DIFFICULTY = 'Easy'
URL = 'https://oj.leetcode.com/problems/maximum-depth-of-binary-tree/'
BOOK = False
PROBLEM = r"""Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root
node down to the farthest le... | true |
78e9969be5c4be3d23ed27d86c28a6aea362b852 | veduardo/adn_service_api | /services/tests.py | UTF-8 | 1,783 | 2.59375 | 3 | [] | no_license | import json, unittest
from app import app
#
# In order to run the tests, run the command below:
# python -m unittest discover
#
class ServiceTestClass(unittest.TestCase):
""" Main test class """
def setUp(self):
# creates a test client
self.app = app.test_client()
# propagate the e... | true |
478c5d53161a7670b4fc0d5ec5f9fa5055b49026 | ninextycode/python_linked_list | /test.py | UTF-8 | 1,468 | 3.078125 | 3 | [] | no_license | from linked_list import LinkedList, sort_linked_list
l = LinkedList([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
print(l)
assert list(l) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
l.add_front(-99)
l.add_back(99)
l.insert(6, 50)
print(l)
assert list(l) == [-99, 0, 1, 2, 3, 4, 50, 5, 6, 7, 8, 9, 99]
n2 = l.get_i_node(3)
n2.swap_with_prev()... | true |
3159672d26703f23aa682102a382c38ad9d6451f | dschori/Ackerbot | /ackerbot_sim_ws/src/rl-navigation/navigation_gym/src/navigation_gym/positions.py | UTF-8 | 2,892 | 2.75 | 3 | [] | no_license | import numpy as np
def pos_env_train():
env = np.random.randint(0, 2)
p_x, p_y, p_z = 0.0, 0.0, 0.05
o_x, o_y, o_z, o_w = 0.0, 0.0, 0.75, 0.75
if env == 0:
choice = np.random.randint(0, 2)
if choice == 0:
p_x = np.random.uniform(-0.5, 5.5)
p_y = np.random.unifor... | true |
9edd9a9baed8b5bfeef250b71304f1667a3421b1 | gnikolaropoulos/AdventOfCode2020 | /day19/main.py | UTF-8 | 2,670 | 3.28125 | 3 | [] | no_license | import re
def get_regexes(rules):
def get_regex_str(rule_num):
if isinstance(rules[rule_num], str):
return rules[rule_num]
else:
sub_regexes = []
for match in rules[rule_num]:
sub_regexes.append(''.join([get_regex_str(option) for option in match]... | true |
70608421decc46de35f761f949d09cc8c371f6db | t-soumbou/dikukuli | /tests/stock_test.py | UTF-8 | 2,277 | 2.84375 | 3 | [] | no_license | # Python class for unit test of Client
import datetime
import unittest
from entities.stock import Stock
from dao.stock_dao import StockDao
stock_dao = StockDao()
class TestDaoCompte(unittest.TestCase):
def test_dao(self):
print("--- test ClientPersistence ")
entity = Stock(1, 5, 100, datetime.... | true |
9f938c2e193a54aa483ebb0e0451046a78229d74 | gotodoor/gotodoor | /pincodes/getlatlong.py | UTF-8 | 779 | 2.84375 | 3 | [] | no_license | #!/usr/bin/python
import json
import sys
import urllib
import os
import pprint
import yaml
usage = """
Usage: ./tweet_search.py 'keyword'
e.g ./tweet_search.py pythonforbeginners
Use "+" to replace whitespace"
e.g ./tweet_search.py "python+for+beginners"
"""
# Check that the user puts in an argument, else print the... | true |
0b2524ac23254eb3dfd3dc7132232ff79929a098 | bakasura980/Contract-Functions-Decorator-Python- | /src/contract_instance.py | UTF-8 | 4,511 | 2.625 | 3 | [] | no_license | from util import retrieve_abi_from_file, checksum_address
from web3.contract import ContractFunction
from config import CHAIN_ID, GAS, GAS_PRICE, VALUE
# ContractInstance is used for call contract functions in an easier way and if need to sign them
# It is only functions-decorator.
# Call back function is not includ... | true |
3cc80204369893bbe91eb38ee9904ea4656434ea | AidenLong/ai | /python-study/obj/extends/IceCreamStand.py | UTF-8 | 1,024 | 3.59375 | 4 | [] | no_license | # -*- coding:utf-8 -*-
from obj.task.Restaurant import Restaurant
'''
冰淇淋小店:冰其淋小店是一种特殊的餐馆。编写一个名为IceCreamStand的类,
让它继承你为完成练习1或练习4而编写的Restaurant类。这两个版本Restaurant类都可以,
挑选你更喜欢的那个即可。添加一个名为flavors的属性,用于存储一个由各种口味的冰淇淋组成的列表。
编写一个显示这些冰淇淋的方法。创建一IceCreamStand实例,并调用这个方法。
'''
class IceCreamStand(Restaurant):
def __init__(self, ... | true |
5aa70a081f9c161df40f051f33616aa0e9e473fc | xungej/MachineLearning | /Week3_Entropy/ANLY601_InClass3_XJ/mst.py | UTF-8 | 967 | 2.90625 | 3 | [
"BSD-2-Clause"
] | permissive | import numpy as np
from scipy.sparse.csgraph import minimum_spanning_tree, connected_components
def euclidean_mst(X, neighbors_estimator, verbose=2):
n_neighbors = min(2, X.shape[0])
while True:
# make sure we have a connected minimum spanning tree.
# otherwise we need to consider more neighbo... | true |
e444e3f8450863b52c9091e260c93e73f0a00b6e | GreenSlime96/seals-ui | /info.py | UTF-8 | 2,070 | 2.875 | 3 | [] | no_license | #!/usr/bin/python
"""A widget for displaying infomation.
Info -- display messages and errors
Author: J.Cupitt
Created as part of the AHRC RTI project in 2011
GNU LESSER GENERAL PUBLIC LICENSE
"""
import logging
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib
# how long to keep the bar... | true |
2b34f024157536914a3c714e4d6725bfdf945ba6 | Luolingwei/LeetCode | /DepthFirstSearch/Q694_Number of Distinct Islands.py | UTF-8 | 1,693 | 3.59375 | 4 | [] | no_license |
# 思路: 对于每个island,记录所有坐标相对起始坐标(upper left)的x,y,一样的island会有一样的坐标集合
# 可以用Set存,但是最后比较会慢,而且要转为frozenset才能用set.
# 这里可以直接将每个x,y坐标转为string存,string可以直接Hash,比较起来也更快
import collections
class Solution:
# Solution 1 dfs+frozonset
# def numDistinctIslands(self, grid):
# memo=collections.defaultdict(set)
# m... | true |
16bd74be18f34308b79ff49d526a7b855b67076c | Kirisaki124/Damsontung-Fundamentals-C4E14 | /Webmodule/web1/flaskintro/app.py | UTF-8 | 1,072 | 2.953125 | 3 | [] | no_license | from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
post_list = ["2 con than lan con", "qua nho", "anh muon gi nao","linh"]
return render_template('index.html',
article_title = "1 little duck",
posts = post_list)
... | true |
ebdcbabc6f5b664d92e61191bc2afe110921841c | qjetha/get_toggl | /get_toggl.py | UTF-8 | 2,420 | 2.53125 | 3 | [] | no_license | import requests, csv, time, config
def get_toggl_data(s, e, dir_path):
#Set Values
key = config.api_key
my_email = config.my_email
add_user = f'&user_agent={my_email}'
start = f'&since={s}'
end = f'&until={e}'
workspaces_endpoint = r'https://api.track.toggl.com/api/v8/workspaces'
reports_endpoint = r'https:/... | true |
442ad2a20aec71659ddd6f23ec02d9bc2415467a | sts-sadr/deep-learning | /perceptron.py | UTF-8 | 1,745 | 3.921875 | 4 | [] | no_license | # Python 3
import numpy as np
n = 3
x1 = np.array([[-1], [1]])
x2 = np.array([[0], [-1]])
x3 = np.array([[10], [1]])
xs = [x1, x2, x3]
y1 = 1
y2 = -1
y3 = 1
ys = [y1, y2, y3]
def classified_correctly(w, b, i):
"""
returns 1 if the ith example is classified correctly given w and b,
otherwise returns 0.
... | true |
4e77cebb1a76765105b1c80bad07cfdf934c3d3d | mrinalpande/Music_Encrypt | /note_find.py | UTF-8 | 635 | 2.859375 | 3 | [
"MIT"
] | permissive | def find_note(note,lineno):
encoding = open("./encode/C_en","r")
decode = open("output","w")
word_list = []
for line in encoding:
l = line.strip().split('\n')
word_list.append(l)
if note == 60:
print(word_list[lineno][0][0])
elif note == 62:
print(word_list[line... | true |
85dc2b0ca68e1af878a3b27f144b92253b9a87b9 | antony-wan/DD2424_deep_learning | /project/data_augmentations.py | UTF-8 | 4,497 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 18 10:30:41 2019
@author: antony
"""
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from load_cifar import get_data_set
def flip(x):
x = tf.image.random_flip_left_right(x)
x = tf.image.random_flip_up_down(x)
... | true |
e8d88554ab271288a5431722aa287a70b1644b98 | jyeoniii/algorithm | /20201201/maximum_depth_of_binary_tree.py | UTF-8 | 717 | 3.15625 | 3 | [] | no_license | # https://leetcode.com/explore/challenge/card/december-leetcoding-challenge/569/week-1-december-1st-december-7th/3551/
# December Leetcode challenge Day1
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
se... | true |
c8dd1ae5cd49cfb0711dea365756c18f4d048c09 | jxzhangjhu/NormalizingFlowNetwork | /tests/test_ml_estimator.py | UTF-8 | 4,376 | 2.84375 | 3 | [] | no_license | import tensorflow as tf
import tensorflow_probability as tfp
import pytest
import numpy as np
from estimators import NormalizingFlowNetwork, MixtureDensityNetwork, KernelMixtureNetwork
tfd = tfp.distributions
tf.random.set_seed(22)
np.random.seed(22)
def test_dense_layer_generation():
layers = NormalizingFlowNet... | true |
9cfa5fd12ab76fcf82048f3795b3f77074ff3243 | varun656/CAN | /Extra_codes/LZ4_compress.py | UTF-8 | 405 | 2.515625 | 3 | [] | no_license | import os
import lz4.frame
import zlib
import codecs
input_data = b'hello'
print(len(input_data))
compressed = lz4.frame.compress(input_data)
com_hex = codecs.encode(compressed,'hex')
print(compressed)
print(len(compressed))
print(com_hex)
data = b'hello'
print(len(data))
compressed= zlib.compress(data)
print(compre... | true |
b9c01b62167c7be2978a7a78b9d97bd03320094d | saguila/AlgoritmoA | /algoritmoA.py | UTF-8 | 3,785 | 2.90625 | 3 | [
"MIT"
] | permissive | import Queue as q
from pqdict import PQDict as pq
class AlgoritmoA:
def __init__(self,mapa,partida,objetivo,N,M):
self.partida = Casilla(partida,0,celdaPunto(partida).Hfrom(celdaPunto(objetivo)))
self.objetivo = objetivo
self.M = int(M)
self.N = int(N)
... | true |
640cc6f57b2a9b13c5f0cf60956d25412e16d7a7 | dougfunny1983/Hello_Word_Python3 | /ex087.py | UTF-8 | 857 | 4.21875 | 4 | [] | no_license | print('''########################
##Mais sobre Matriz em Python##
########################''')
print('→←'*20)
print()
matriz = [[0,0,0],[0,0,0],[0,0,0]]
for l in range(3):
for c in range(3):
matriz[c][l] = int(input(f'Digite um valor para [{l}, {c}] → '))
for l in range(3):
for c in range(3):
p... | true |
7d8d49240ff8e466cf856fa0250ac1aa5d11b2e6 | Hewii085/StudyAI | /TensorTest/TensorBasicTest/reshape_test.py | UTF-8 | 1,062 | 2.53125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
def case_three():
inputShape = np.arange(13*13*30)
inputShape = np.reshape(inputShape,[13,13,5,6]).astype(np.float32)
print(inputShape)
x = tf.placeholder(tf.float32, [13,13,5,6])
sig = tf.sigmoid(x) + 1
with tf.Session() as ... | true |
e6274816168098e754b0cf478f8155f03a9a09f2 | yosef8234/test | /python_offsec_pentest/Module 2/Making Putty Persistent.py | UTF-8 | 2,019 | 2.8125 | 3 | [] | no_license | # Python For Offensive PenTest: A Complete Practical Course By Hussam Khrais - All rights reserved
# Follow me on LinkedIn https://jo.linkedin.com/in/python2
import os # needed for getting working directory
import shutil # needed for file copying
import subprocess # needed for getting user p... | true |
a7b527550c80dc18153c42a884365e51ddb4fb42 | longuyen10119/primecoinspicking | /CoinchangeBFS.py | UTF-8 | 1,695 | 3.484375 | 3 | [] | no_license | import math
import time
def findCombiR(amount, coins, index, numCoinsAllowed):
if amount == 0:
return 1
if amount < 0:
return 0
num = 0
for coin in range(index, len(coins)):
num += findCombiR(amount-coins[coin], coins, coin)
return num
def testPrime(n):
if n == 1 or ... | true |
3ab9a96669bbfd99e0bbf5ad16293c180378d41b | AdamWu1979/dwilib | /dwi/tools/cpr_tool.py | UTF-8 | 2,307 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python3
"""Read CPR files."""
import logging
import re
import sys
import numpy as np
import dwi.files
from dwi.types import Path
def read_cpr(path):
"""Read and parse a CPR file. Return masks, which are (id, RLE data).
Note: Python 3.6.4 docs say its XML module is not secure, se we use regexp.... | true |
7907960c11899ae3dc01f46e5ddb736b5b1f3654 | Jiyeon-L/webapp | /app.py | UTF-8 | 1,060 | 2.8125 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect
app = Flask(__name__)
@app.route('/')
def index():
return render_template('main.html')
@app.route('/hello')
def hellohtml():
return render_template("hello.html")
@app.route('/method', methods=['GET', 'POST'])
def method():
if request.method == '... | true |
87d7264ad5b9587409f7814f89cffb7b37a02fd1 | cjdool/pswtest | /2_gcdlcm.py | UTF-8 | 272 | 3.375 | 3 | [] | no_license | instr = input()
inlist = instr.split()
A = int(inlist[0])
B = int(inlist[1])
if B > A:
A, B = B, A
def gcd(a, b):
if b == 0:
return a
else:
return gcd(b, a % b)
def lcm(a, b):
return int(a*b/gcd(a, b))
print(gcd(A, B))
print(lcm(A, B)) | true |
f0eafc6c091e138047cd36344a6198cf17c9ea8d | kimurakousuke/MeiKaiPython | /chap05/list0501.py | UTF-8 | 113 | 3.21875 | 3 | [] | no_license | # 判断a和b的同一性
a = int(input('整数a:'))
b = int(input('整数b:'))
print('a is b =', a is b)
| true |
2fef60db3ea085e210dedb88e4d50af4ebc4651d | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_76/808.py | UTF-8 | 320 | 2.6875 | 3 | [] | no_license | from sys import stdin
def riadok():
return map(int, stdin.readline().split())
for cas in range(int(stdin.readline())):
n = int(stdin.readline())
a = riadok()
b = reduce(lambda x, y: x ^ y, a)
print "Case #%d: " % (cas + 1),
if b != 0:
print "NO"
else:
print sum(a) - min(a)
| true |
d1e39228c89a1618c7cbfd50e39d55a94c57083c | nf-core/tools | /tests/test_launch.py | UTF-8 | 16,948 | 2.546875 | 3 | [
"MIT",
"GPL-3.0-only"
] | permissive | """ Tests covering the pipeline launch code.
"""
import json
import os
import tempfile
import unittest
from unittest import mock
import pytest
import nf_core.create
import nf_core.launch
from .utils import with_temporary_file, with_temporary_folder
class TestLaunch(unittest.TestCase):
"""Class for launch test... | true |
8b10e2e1aa0bb7e1ae295acf508c3eaed8cf0ee2 | agammsantos/Data-Science-Class-Purwadhika | /pertemuan23/pertemuan23webscrap.py | UTF-8 | 2,789 | 3.09375 | 3 | [] | no_license | # pip install beautifulsoup4
from bs4 import BeautifulSoup
# mengambil dari text html
# web='<p>Halo gaes</p>'
# x=BeautifulSoup(web,'html.parser') # menginisiasi web scrapping dengan parsing method html.parser
# # mengambil dari file html
# web=open('tes.htm','r')
# x=BeautifulSoup(web,'html.parser')
# print(x.pre... | true |
adab8ff77bd1ebda8469b02367bf482b5f163b09 | ouroboros-project/ouroboros-milestones | /milestone-02/scripts/pythontalker.py | UTF-8 | 1,526 | 2.765625 | 3 | [
"Zlib"
] | permissive | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from milestone_02_prompt.input import receive_message, receive_number, receive_confirmation
from milestone_02_prompt.out.constants import TALKER_NAME
from milestone_02_prompt import out
def main():
out.send_message(TALKER_NAME() + ": WAZAAAAAAAAAP")
while True:
... | true |
b3bfec1c5fdc832f45ae1e8e3bce329ed5ab8f08 | andersonmarquees/-uri_python | /judge_1182.py | UTF-8 | 345 | 3.328125 | 3 | [] | no_license | coluna = int(input())
op = input().upper()
matriz = []
soma = 0
for i in range(12):
line = []
for j in range(12):
valor = float(input())
line.append(valor)
matriz.append(line)
for i in range(12):
soma += matriz[i][coluna]
if op == 'S':
print("{}".format(soma))
else:
print("{:... | true |
8b09fcf8fdaf1fc929bcf6838c24b43f383eec24 | tozZzman/homework_10 | /pages/product_page.py | UTF-8 | 2,255 | 2.796875 | 3 | [] | no_license | from .base_page import BasePage
from .locators import ProductsPageLocators
from selenium.webdriver.common.by import By
import allure
class ProductPage(BasePage):
@allure.step('Добавление нового продукта')
def add_product(self, name, meta, model):
self.logger.info('Добавление нового продукта')
... | true |
1b546658990a9bfc03e63604150bbeddc94289eb | jjohnkenn/python_homework | /time.py | UTF-8 | 82 | 2.703125 | 3 | [] | no_license | import time
print("Hi my name is Joshua")
time.sleep(5)
print("I study in SJBHS") | true |
c689b6648094812e1008556ccb0e737301b890b1 | conradg/robots | /controlsExperiment/experiment.py | UTF-8 | 405 | 2.90625 | 3 | [] | no_license | import os
from week1 import square40
results = []
iterations = 10
f = open('experiment.tmp', 'w')
print "Please enter all displacement values in the format x y"
for i in range(1,iterations+1) :
square40()
prompt_str = "Enter test " + str(i) + " value: "
results.append(raw_input(prompt_str))
for i in resul... | true |
ac0e5263fd2dad279a11dd14ab2e3b82baf15be6 | tjb1092/TalosRunner | /data_Modifications.py | UTF-8 | 1,906 | 2.828125 | 3 | [] | no_license | import numpy as np
import pickle
import os
import cv2
from utils import viewData
def delete_data_file():
# Remove file and re-adjust the file numbers
file_number = input("enter the file number you wish to delete: ")
Dtypes = ("body", "head")
dataIndex = pickle.load(open("collectedData/dataIndex.p", "... | true |
b296a35963ef6023367a39fe9c88f9f18255f2c1 | vimalkkumar/Basics-of-Python | /Python Standard Library/Introduction.py | UTF-8 | 533 | 3.390625 | 3 | [] | no_license | """
* A library that can be use on any machine where you have an application using the specific language.
* Includes built-in functions and built-in imported modules
* A standard is a built-in.
* A external library is something you need to download separately from the Internet to get a special functionally.
"""
print... | true |
6ba6ff606bc5e96b7afcb88820da37ef4ad1eeeb | donno/RollyTheSnake | /engine/snake.py | UTF-8 | 4,125 | 3.65625 | 4 | [] | no_license | """
Snake - Represents the data for the Snake object.
"""
# Some helper functions and classes for dealing with managing the tail.
import math
class Joint:
def __init__(self, x, y, distance):
self.x = x
self.y = y
self.distance = distance
self.rotation = 0
def updatePosition(self, previousJoint, distance):... | true |
bdfa04229c41044555057b453dc31d9e7139ae5c | tulingfeng/v2ex_Login | /imageOCR.py | UTF-8 | 445 | 2.59375 | 3 | [] | no_license | import pytesseract
from PIL import Image
'''
旨在采用tesseract ocr来识别验证码
'''
# pytesseract.pytesseract.tesseract_cmd = 'D:/Program Files (x86)/Tesseract-OCR/tesseract'
image=Image.open("captcha.jpg")
image=image.convert("L")
# 获得指定磁盘位置的图片可以用类似:img=Image.open(r'C:\Users\libanggeng\Pictures\idcard\id_card.jpg')
print(image)
... | true |
632aa8c881ce36215ea268fb5a08d051dfd59a77 | sibichakkaravarthy/Computer-Graphics | /CG_lab_processing_6.9.18/CG_keyboard_interaction_fadeout/CG_keyboard_interaction_fadeout.pyde | UTF-8 | 437 | 2.90625 | 3 | [] | no_license | def setup():
size(800, 800);
background('#3355CC');
def draw():
fill(40, 20);
rect(0,0,width, height);
if (keyPressed==True):
fill(255);
textSize(random(10,300));
text(key,random(100,400),random(200,400));
#fill(40, 20);
#rect(0,0,width, height);
# def ... | true |
5f5926b5a6ed206bd4ad6e6350609c3f290e41de | kronerte/LCD_breakpoints_detection | /lcdbp/src/LCDBD.py | UTF-8 | 2,153 | 3.375 | 3 | [
"MIT"
] | permissive | import numpy as np
import CoordinateDescent as CD
#########################################################################################
#
# Date : 10/06/2020
# Author : Etienne Kronert
# Team : Modal - INRIA
#
#########################################################################################
class LCDBD(... | true |
c2d1339792127995aadf5218ecfc5f4569da8138 | Spyroslon/CM1208-Maths-for-Computer-Science | /Coursework/DocSearchTesting.py | UTF-8 | 952 | 2.953125 | 3 | [] | no_license | # input_file = open("set1//docs.txt", 'r')
# lines = len(input_file.readlines())
# with open("set2//docs.txt") as docs:
# for i,line in enumerate(docs):
# print("Line",i,":",line)
with open("set1//queries.txt") as queries:
for query in queries:
word_found = []
relevant = []... | true |
ef055c61547f96dd3b3a83bdf1ed699c7453fe00 | kartiktanksali/Hackerrank_Problems | /libraryfine_hackerrank.py | UTF-8 | 775 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 18:11:58 2019
@author: kartiktanksali
"""
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the libraryFine function below.
def libraryFine(d1, m1, y1, d2, m2, y2):
if d1>d2 and m1==m2 and y1==y2:
... | true |
67d10969d30f116fba3a8f8865c1219df190671f | kcl-tscm/mff | /mff/interpolation/tricube_cpp/__init__.py | UTF-8 | 9,856 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from mff.interpolation.tricube_cpp import _tricube
class Spline3D(object):
def __init__(self, x, y, z, f):
assert f.shape == (x.size, y.size, z.size), "dimensions do not match f"
assert np.all(np.diff(x) > 0) & np.all(np.diff(y) > 0) & np.all(np.diff(z) > 0), \
"x... | true |
3b6bbd828237a90df2df98e7b1e280d20a574f7c | kobeding/python | /2016/do_tcp_client.py | UTF-8 | 340 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3.5
import socket,threading
#创建一个socket:
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(('127.0.0.1',9999))
#接收欢迎消息:
print(s.recv(1024).decode('utf-8'))
for data in [b'kobe',b'james',b'wade']:
#发送数据:
s.send(data)
print(s.recv(1024).decode('utf-8'))
s.send(b'exit')
s.close() | true |
c9193340d342315cd22514d4de2047815d1160f4 | bbdhouzi/auto_nav | /pi_scripts/mapping_complete_test | UTF-8 | 892 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
import rospy
from std_msgs.msg import String
import time
import RPi.GPIO as gp
servo_pin = 18
gp.setmode(gp.BCM)
gp.setup(servo_pin, gp.OUT)
map_completed = False
def pi_chat_cb(msg):
global map_completed
rospy.loginfo(msg.data)
if msg.data == 'mapping complete':
map_comple... | true |
9097b91e8d49b559b4e3dcc088557781aadc0314 | Ovusi/Pysces_Ransomware | /Gui/gui.py | UTF-8 | 2,715 | 2.859375 | 3 | [
"MIT"
] | permissive | import tkinter
from PIL import ImageTk
import PIL.Image
from tkinter import *
def gui():
window = tkinter.Tk()
window.grid()
window.title('You have been hacked')
window.configure(background='#CC3300')
''' FIRST FRAME ########################################'''
fullframe = tkinter.Frame(window... | true |
b9cb11b62a0019aa493f9958416798ce7dbe67da | memalette/IndexReplicator | /agents/sim_ppo.py | UTF-8 | 6,780 | 2.59375 | 3 | [] | no_license | # Note: some of the functions were inspired from https://github.com/seungeunrho/minimalRL
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.distributions import Normal
from environments.sim_environment import S... | true |
f4662770c5408d9ba93776e410d2f067e9585e19 | borbware/tic80tileswap | /removeEmptiesFromMap.py | UTF-8 | 2,226 | 3.140625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import sys
import argparse
if len(sys.argv) == 1:
print("usage: python removeEmptiesFromMap.py [file]")
print("the program goes through the tilemap in [file] and replaces empty (all-black) tiles with tile 0.")
exit()
filename = sys.argv[1]
oldtile_str = sys.argv[2]
newtile_str = s... | true |
0497fcb5285decab743021c9e5bf1178b8b6ac77 | DarshAsawa/Cryptography | /substituion_cipher/hill_cipher.py | UTF-8 | 1,042 | 3.453125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
@author: dasaw
"""
def encrypt (key,message,encrypted) :
encrypted_text = []
encryptedText = ""
for i in range(3):
for j in range(1):
encrypted [i] [j]
for k in range(3):
encrypted[i][j] += (key[i][k] * message[k][j])
... | true |
7ccad54c8ab6392290ee968962e2dccdffd0a2a7 | zwjtech/java-ee | /python/src/main/java/com/changwen/python/test_100exec/test01.py | UTF-8 | 3,563 | 4.4375 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import math
# 题目:有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
# 程序分析:可填在百位、十位、个位的数字都是1、2、3、4。组成所有的排列后再去 掉不满足条件的排列。
# 程序源代码:
def test1():
for i in range(1, 5):
for j in range(1, 5):
for k in range(1, 5):
if (i != k) and (i != j) and (j != k... | true |
4ec4879c8f5ae839b2f028a6cb3e083e9a36a60d | jlothian/meraki-netbox | /meraki-netbox/get-meraki-ips.py | UTF-8 | 6,231 | 2.78125 | 3 | [] | no_license | import datetime
import os
from pprint import pprint
import ipaddress
import meraki
import pynetbox
# Either input your API key below by uncommenting line 10 and changing line 16 to api_key=API_KEY,
# or set an environment variable (preferred) to define your API key. The former is insecure and not recommended.
# For ex... | true |
eb76ea9a372c31e56c66eb7e4b913d7adc1d95ba | dohye/python_issues | /heatmap_plot.py | UTF-8 | 610 | 3.3125 | 3 | [] | no_license | # 행렬 값의 크기를 색으로 표현하고 싶을 때,(logit, pred등)
# plt.imshow
# plt.matshow
# 둘 다 되는데, x축이 아래쪽이 아닌 위쪽으로 올라가는 문제가 있었음.
# imshow는 ax.xaxis.tick_bottom()하면 깔끔하고, matshow는 여전히 여백이 남아서 더 수정이 필요했음. -> plt.imshow 사용함
def heatmap_plot(name,title):
plt.figure(figsize = (10, 6))
plt.imshow(name, cmap = plt.cm.jet, aspect = 'aut... | true |
6e87677e01ab46d0670b67a1d3acd58235cbda74 | kuronosu/numeros-primos | /core/files.py | UTF-8 | 189 | 3.09375 | 3 | [] | no_license | def save_user_numbers(lst):
with open('result.txt', 'w') as f:
f.write("Posición\t|\tNumero \n")
for l in lst:
f.write("{}\t|\t{} \n".format(l.pos, l.num))
| true |
bc169c50cbed5ac6caf26bb282cae7b54dd34aa9 | cryoMike90s/Daily_warm_up | /Basic_Part_I/ex_59_feet_inches_to_centimeters.py | UTF-8 | 311 | 4.0625 | 4 | [] | no_license | """Write a Python program to convert height (in feet and inches) to centimeters"""
def convert_me(h):
if not "," in h:
inches = float(h) * 12
cm = inches * 2.54
return print(cm)
return print("Use poin instead of comma ")
convert_me(input("Plese enter a height in foots: "))
| true |
4217387c9fce647a9f41eb3f534c9472ce93f8c2 | raghavgurbaxani/Object-Recognition--CIFAR-10--Kaggle | /Cifar_model.py | UTF-8 | 2,923 | 2.578125 | 3 | [] | no_license | import tensorflow as tf
import numpy as np
import Cifar_data_loader
STEPS=10000
BATCH_SIZE=50
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial)
def bias_variable(shape):
initial = tf.constant(0.1, shape=shape)
return tf.Variable(initial)
def co... | true |
c8e1bd613ad7789626861ac0bb1b8f0c7b9e6697 | JONNY-ME/my-kattis-solution | /whatdoesthefoxsay.py | UTF-8 | 225 | 3.03125 | 3 | [] | no_license | for _ in range(int(input())):
l = input().split()
p = []
while 1:
s = input()
if s == "what does the fox say?":
break
p.append(s.split()[-1])
for i in l:
if i not in p:
print(i, end=' ')
print() | true |
21e6956b8ddd7edcbc7c2ca49c342664d40a1893 | victormorozov1/yandex-project | /functions.py | UTF-8 | 1,073 | 2.546875 | 3 | [] | no_license | import requests
def get_request(text):
api_address = 'https://static-maps.yandex.ru/1.x/'
api_key = '40d1649f-0493-4b70-98ba-98533de7710b'
response_text = f'{api_address}/?apikey={api_key}&' + text + "&l=map"
response_text = 'https://static-maps.yandex.ru/1.x/?l=map&pt=37.6,55.6~37.601,55.6,78~37.602,... | true |
f2e333f059667887c594ee10652737ab6cca4296 | windyear/learning_python | /client.py | UTF-8 | 206 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf-8 -*-
import socket
s=socket.socket()
host=socket.gethostname()
port=1234
s.connect((host,port))
print(s.recv(1024).decode())
#test=input("Just testing:")
#raw_input() | true |
96508bd99eed2efd946ced5750dc070bc99f2bb5 | mmtaksuu/OpenCV-Python-Tutorial | /colorDetection03.py | UTF-8 | 2,790 | 2.84375 | 3 | [
"MIT"
] | permissive | from collections import deque
import numpy as np
import cv2
import imutils
def convertor(blue, green, red):
color = np.uint8([[[blue, green, red]]])
hsv_color = cv2.cvtColor(color, cv2.COLOR_BGR2HSV)
hue = hsv_color[0][0][0]
lower_range = np.array([str(hue-10), 100, 100], dtype=np.... | true |
156a28d2d8c8c38b651b842c370da6726779712d | rayturner677/lets_bowl | /dict_example.py | UTF-8 | 633 | 4 | 4 | [] | no_license | def get_word(webster):
''' (dict) -> str '''
while True:
choice = input('What word do you want to look up? ')
if choice in webster.keys():
return choice
print('not an option!')
print('choices are:', '-'.join(webster.keys()))
def main():
webster = {
"Aard... | true |
7788a0a40ff10d45dd221361932cbb01fe38ab1a | adityaranjan/KattisSolutions | /timeloop.py | UTF-8 | 90 | 3.3125 | 3 | [] | no_license | number = input()
for i in range(int(number)):
print(str(i+1) + " Abracadabra")
| true |
a79ac5f87bedfeebba930320ad92bbbbcea70ce0 | aetherith/groupcurses | /groupcurses/conversation.py | UTF-8 | 1,856 | 2.625 | 3 | [
"MIT"
] | permissive | import uuid
import time
from datetime import datetime
import urwid
from groupcurses.message import Message
class Conversation(urwid.Text):
def __init__(self, api, cid, name, conversation_type):
self.api = api
self.cid = cid
self.name = name
self.conversation_type = conversation_ty... | true |
c079c1a8a1e3c83b16ecfe06807171678a5c1589 | devinjnigro/python-homework | /PyBank/main.py | UTF-8 | 2,321 | 3.0625 | 3 | [] | no_license | from pathlib import Path
import csv
Path.cwd()
budget_data = Path('/Users/Devin/Desktop/Jupyter-Workspace/text_files/budget_data.csv')
total_months = 0
total = 0
pnl_list = []
date_list = []
change = []
greatest_increase = 0
greatest_decrease = 0
with open(budget_data, 'r') as file:
csvreader = csv.reader(file, de... | true |
60c01d14674675bcd2924abed8dfc6f3495bd1e5 | TheWindRider/YouTube-Trend | /classify_video_simple.py | UTF-8 | 2,514 | 2.53125 | 3 | [] | no_license | import numpy
import data_helpers
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
from nn_architecture import textCNN1
from global_params import Params
# Model setup using tf.estimator
def model_classify(features, labels, mode):
logits_train = textCNN1(features,... | true |
fc92367d75e4f88308dacc175378554189d20cc1 | GolamRabbani20/PYTHON-A2Z | /DATA_SCIENCE/NumPy/NUM-PY_02/Array/Splitting.py | UTF-8 | 1,427 | 3.375 | 3 | [] | no_license | import numpy as np
arr = np.array([1, 2, 3, 4, 5, 6])
newarr = np.array_split(arr, 3)
print(newarr)
arr2 = np.array([1, 2, 3, 4, 5, 6])
newarr2 = np.array_split(arr, 4)
print(newarr2)
#split can not adjust
arr3 = np.array([7,8,9,10,11,12,13,14])
newarr3 = np.split(arr3,4)
print(newarr3)
#newarr4 = np.split(arr3,5... | true |
4f1fb7fd53c9f1d9435e86e070d588899bd937b3 | apanisile/python | /user_details.py | UTF-8 | 2,400 | 3.90625 | 4 | [] | no_license | # Module containing all the functions to be used
class loan_function:
def __init__(self):
super().__init__()
def greet(fname, lname, msg="Good morning!"):
"""
This function greets to
the person with the
provided message.
If the message is not provided,
... | true |
8ed5a061e91a594d78b5291e2ecbc32c30ad917d | omiroshn/projecteuler | /2.fibonacciNumbers.py | UTF-8 | 132 | 3.109375 | 3 | [] | no_license | one = 1
two = 1
mysum = 0
while two < 4000000:
new = one + two
one = two
two = new
if two % 2 == 0:
mysum += two
print (mysum) | true |
17ca5dcc32d2a3f5d066365b50dcfe1a9cd440fc | chanismile/Paths-Research | /load_data.py | UTF-8 | 976 | 2.6875 | 3 | [] | no_license | import pandas as pd
df = pd.read_csv('data/fixed.csv',usecols=[1,2,3,5,9,10,12])
df.columns = ['x', 'y', 'obj', 'seq', 'filename', 'time' , 'delta_time']
df['time'] = pd.to_datetime(df['time'])
df['delta_time'] = pd.to_timedelta(df['delta_time'])
df['time'] += df['delta_time']
df_int = df.select_dtypes(include=['i... | true |
66698dbdb24329f87825d2e5914fa8c24425328b | yingdongo/Kaggle-Bike-Demand-Prediction | /v_count_log/data_preprocess.py | UTF-8 | 549 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 17 20:03:58 2015
@author: Ying
"""
import time
def data_preprocess(data):
i = 0
for timestamp in data['datetime']:
i += 1
date_object = time.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
data.loc[i-1, 'year'] = date_object.tm_year-2011
... | true |
ce6152965c459f855cba00b98cfb7356e293ae6a | mcpherrinm/Loo-Review | /build.py | UTF-8 | 575 | 2.578125 | 3 | [] | no_license | import os
from loo.database import init_db
init_db()
from loo.database import getsession
session = getsession()
import loo.models as models
buildings = os.listdir("maps/names/")
for building in buildings:
theb = models.Building(building, open('maps/names/' + building ).read().strip())
session.add(theb)
... | true |
0766002f68c985e884a1dd3dee9ad99f6575726e | knijesh/Neural-Networks | /weight/weights.py | UTF-8 | 634 | 2.75 | 3 | [] | no_license | import numpy as np
import math
class Weights(object):
def initWeights(self, weights, isStatus=True, weight1=None, weight2=None):
if isStatus == True:
random = np.random.RandomState(1008)
for x in range(1, len(self.architecture)):
start = self.architec... | true |
d013fd95d44f37fd0113f98ff21f77085da71000 | be-unkind/board_ucu | /board_ucu.py | UTF-8 | 4,697 | 3.375 | 3 | [
"Unlicense"
] | permissive | '''https://github.com/be-unkind/board_ucu'''
def first_check(board: list) -> bool:
'''
Every coloured cell in row must not contain the same values.
'''
res_list = []
for element in board:
temporary_list = list(element)
for element_1 in temporary_list:
if (element... | true |
655850d4d92f040aadcb25454f22ee2bf27d591c | Ali-Khodabandehlou/cons-truck-tor | /main.py | UTF-8 | 3,047 | 2.671875 | 3 | [] | no_license | import sys
import pygame
from bin.utils import config, ui, handler
from bin.maps import grid
start_x, start_y = 0, 0
_isRunning = True
_level = 0
_moves = 0
basicFont = None
keys = {
'119': 'UP',
'115': 'DOWN',
'97': 'LEFT',
'100': 'RIGHT',
'122': 'UNDO',
'111': 'PICKUP',
'112': 'DISEMBAR... | true |
ba93eb8f750af4a30f561f50b15de2e701efba66 | njpayne/pythagoras | /Archive/petclass_test.py | UTF-8 | 1,511 | 4.59375 | 5 | [] | no_license | # Create a set of commands to test out the Pet Class
import petclass # Import the file titled petclass which holds the Pet class
def main(): # Create the main function
pet_list = [] # Create an empty list which will be full of pet objects
print("Welcome to the pet management system!")
print("The system below help... | true |
0bb04b03e13496f588bbb17a8a2e6aa80b03477a | AdamZhouSE/pythonHomework | /Code/CodeRecords/2922/60660/273868.py | UTF-8 | 458 | 2.765625 | 3 | [] | no_license | import functools
t=int(input())
l = eval('[' + input().replace(' ', ',') + ']')
def add(a,b):
return a+b
aver=functools.reduce(add,l)/len(l)
m=l[::]
l.sort()
result='YES'
if (aver-int(aver)>0):
result='NO'
if len(l)%2==1 and l[t//2]!=aver:
result="NO"
x=aver-l[0]
for i in range(0,t//2):
if aver-l[i]!=x:... | true |
141db8ffb257e7435495b2896eec64eb2b31f6c7 | UBC-MDS/InstaPy | /instapy/test/test_blur.py | UTF-8 | 2,655 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | #Copyright 2018 Indiana Nikel
#Licensed under the Apache License, Version 2.0 (the "License")
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
# March 2018
# This script tests the function from blur.R.
# This script t... | true |
fb5d964b791129b6aae1c05c2af9b6003e3d8100 | z-zkagami/Python003-003 | /week04/assignment1/convert_to_pandas.py | UTF-8 | 1,210 | 2.875 | 3 | [] | no_license | import pandas as pd
import pymysql
conn = pymysql.connect(host='localhost',
user='test',
password='00000000',
port=3306,
db='testdb',
charset='utf8mb4')
# 1. SELECT * FROM data;
sql = 'SELECT * FRO... | true |
ab6e9c5fe60617950a7664d1966a6b45abb318dc | amithsaligrama/exppy | /turtles.py | UTF-8 | 3,455 | 3.03125 | 3 | [] | no_license | import turtle
x = 0
screen = turtle.Screen()
screen.bgcolor("black")
quokka = turtle.Turtle()
quokka.shape("turtle")
quokka.color("black")
penguin = turtle.Turtle()
penguin.shape("turtle")
penguin.color("black")
hen = turtle.Turtle()
hen.shape("turtle")
hen.color("black")
dog = turtle.Turtle()
dog.shape("turtle")
dog.c... | true |
d12cacee5c0cae158a0868e65523443494c3dd1f | AdrChacon/ChaCa-Progra | /Intro y Taller Progra- TEC/Proyectos/achacon-proyecto1/main.py | UTF-8 | 14,658 | 2.90625 | 3 | [] | no_license | import pygame, math, json, random, time
from pygame.locals import *
from jugador import *
from menu import *
from proyectiles import *
from trafico import *
from mapa import *
pygame.init()
pygame.display.set_caption("Desert Mayhem")
# Definicion de colores
Negro = (0,0,0)
Blanco = (255,255,255)
Gris_claro = (180,1... | true |
a70a2587530bf5bf7e368a79975a842a1d25b4ef | snehil0801/python_work | /make_chocolate.py | UTF-8 | 613 | 4.0625 | 4 | [] | no_license | #We want make a package of goal kilos of chocolate. We have small bars (1 kilo each) and big bars (5 kilos each). Return the number of small bars to use, assuming we always use big bars before small bars. Return -1 if it can't be done.
def make_chocolate(small, big, goal):
if (big*5 + small) < goal:
return(-1)
if g... | true |
7c3ac3ffb26c24e5635e88c3331122a71694fe3d | awentzonline/nyeat | /nyeat/substrate.py | UTF-8 | 1,037 | 2.609375 | 3 | [] | no_license | import numpy as np
class Substrate(object):
def __init__(self, input_dims, layer_confs, dtype=np.float32):
self.dtype = dtype
self.matrices = []
self.activations = []
last_ndims = input_dims
for ndims, activation in layer_confs:
shape = (ndims, last_ndims + 1)
... | true |
4dec5dfd7894f7879a2b7d26fc2088ec8d41f1ae | ajnart/Exercism-Python | /scrabble-score/scrabble_score.py | UTF-8 | 641 | 3.171875 | 3 | [] | no_license | ##
# EPITECH PROJECT, 2019
# scrabble-score
# File description:
# scrabble_score.py
##
def score(word: str):
one = "AEIOULNRST"
two = "DG"
three = "BCMP"
four = "FHVWY"
five = "K"
eight = "JX"
ten = "QZ"
ret = 0
for letter in word.upper():
if letter in one:
ret ... | true |
d1628c751c184b28db2be09ea5462233d12e4dc5 | joembis/weather_texter | /sample/message.py | UTF-8 | 864 | 2.921875 | 3 | [
"MIT"
] | permissive | from twilio.rest import Client
from prettytable import PrettyTable
account_sid = '' # account sid from twilio
auth_token = '' # account auth token from twilio
to_number = 'whatsapp:+44xxxxxxxxxx' # phone number
client = Client(account_sid, auth_token)
def make_message(parsed_weather):
"""takes a dict of weathe... | true |
a4b04bc1cd3f058848e55546edd3e959350d2fee | spauka/AOC2020 | /d23/d23.py | UTF-8 | 4,515 | 3.5 | 4 | [
"MIT"
] | permissive | inp = "942387615"
#inp = "389125467"
class LinkedListNode:
def __init__(self, val, prev=None, next=None):
self.val = val
self.prev = prev
self.next = next
def __repr__(self):
return f"LinkedListNode({self.prev.val} <- {self.val} -> {self.next.val})"
class CircularLinkedList:
... | true |
a6f80e097bedcf753f132c898d8d71dc892a77fc | Min-Hyuk98/deep_nlp | /11.preprocessing/13-detokenization/detokenizer.py | UTF-8 | 1,111 | 2.6875 | 3 | [] | no_license | import sys
import codecs
STR = '▁'
TWO_STR = '▁▁'
def detokenization(line):
if TWO_STR in line:
line = line.strip().replace(' ', '').replace(TWO_STR, ' ').replace(STR, '').strip()
else:
line = line.strip().replace(' ', '').replace(STR, ' ').strip()
return line
if __name__ == "__main__... | true |
f61274d0856860ff2409d1145741b8a6fcb66b4b | snowedev/baekjoon-code.plus | /baekjoon/[Bruteforce]/기초/[Brute_Force]1,2,3 더하기_재귀.py | UTF-8 | 803 | 3.875 | 4 | [] | no_license | # 1,2,3더하기 # B_9095
# 재귀함수
# 1. 불가능한 경우: 정답을 찾을 수 없는 경우(sum > goal)
# 2. 정답을 찾은 경우
# 3. 아직 답을 찾지 못한 경우: 다음 경우를 호출
# 3-1. 1을 사용 : go(count + 1, sum + 1, goal)
# 3-2. 2를 사용 : go(count + 1, sum + 2, goal)
# 3-3. 3을 사용 : go(count + 1, sum + 3, goal)
# 시간 복잡도 O(3^n)
def go(s, goal):
if s > goal:
# 불가능... | true |