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 |
|---|---|---|---|---|---|---|---|---|---|---|
9065d49ef732b37ba9ed0cf8e7bcacb446b5722a | bharathtintitn/HackerRankProblems | /HackerRankProblems/maximumsubarray.py | UTF-8 | 257 | 3.234375 | 3 | [] | no_license | import pdb
class Solution(object):
def maxSubArray(self, nums):
array = [0]
for i in xrange(len(nums)):
array.append(nums[i]+array[i])
print "array:", array
a = Solution()
a.maxSubArray([-2,1,-3,4,-1,2,1,-5,4])
| true |
8e28af1c79dfec3128379664f4223c5396e4c6c6 | SimmonsChen/LeetCode | /公司真题/BOSS/最短路径和.py | UTF-8 | 1,056 | 3.15625 | 3 | [] | no_license | # @param grid int整型二维数组 二维数组
# @param x int整型
# @param y int整型
# @return int整型
class Solution:
def solution(self, grid, x, y):
if not grid:
return 0
if x == 0 and y == 0:
return grid[x][y]
row = len(grid)
col = len(grid[0])
dp = [[0 for _ in range(col)... | true |
d6742d2251647fe23ece563600e80766471edf59 | AnastasiiaDm/Python_Hillel_Nickisaev | /15-matrix.py | UTF-8 | 1,143 | 3.25 | 3 | [] | no_license | from random import randint
size = 10
matrix = [[randint(1, 50) for _ in range(size)] for _ in range(size)]
def show(lst):
tmp = [0] * size
for i in range(size):
for j in range(size):
print('{:>4}'.format(lst[i][j]), end='')
tmp[j] += lst[i][j]
print()
for i in ra... | true |
1b52cffff98af2b2d1f39e06118a0a64ba32216f | Gaurav-Pande/DataStructures | /leetcode/stack_and_queues/moving_avg.py | UTF-8 | 495 | 3.984375 | 4 | [
"MIT"
] | permissive | # Author: Gaurav Pande
## Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.
class MovingAverage(object):
def __init__(self, size):
self.size = size
self.queue = []
def next(self, val):
if not self.queue or len(self.queue) <... | true |
1dca7aaeecea462a72297b8b5bd8d6c5997ffddf | rexhzhang/LeetCodeProbelms | /String/LeetCode205_IsomorphicStrings.py | UTF-8 | 1,202 | 4.0625 | 4 | [] | no_license | """
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving the order of characters. No
two characters may map to the same character but a char... | true |
673e4c22746bea77b5bb9294f234c3b365a3bc8b | kimgy0/Python_Practice | /IF_FOR_WHILE/FOR_4_ScoreCalc_Continue.py | UTF-8 | 218 | 3.40625 | 3 | [] | no_license | #점수로 합,불 따지기 continue문
marks=[90,25,67,45,80]
number=0
for mark in marks:
number+=1
if mark < 60:
continue
print("{0}번 학생 축하합니다. 합격입니다.".format(number)) | true |
a8581c1f2803850c5130299150e79d5ced31138b | arofiqimaulana/Datacamp-Course | /Intermediate Network Analysis in Python/chapter3.py | UTF-8 | 3,604 | 3.765625 | 4 | [] | no_license | ################################# Introduction to graph difference #################################
G1.edges()
G2.edges()
nx.difference(G1,G2)
nx.difference(G2,G1)
################################# Task 1 (List of graphs)
import networkx as nx
months = range(4, 11)
# Initialize an empty list: Gs
Gs = []
for month... | true |
82f03094147043de5cfd4e59ecd396b804556505 | thehimel/data-structures-and-algorithms-udacity | /m02c04-trees/i13e00_tree_traversal_dfs_recursion.py | UTF-8 | 3,357 | 4.875 | 5 | [] | no_license | """
Solution using Recursion
Tree Traversal Logic
Visit: V
Left: L
Right: R
Pre-order traversal: VLR (V at the beginning)
In-order traversal: LVR (V in the middle)
Post-order traversal: LRV (V at last)
Time Complexity: O(n)
Auxiliary Space: If we don’t consider size of stack for function calls
then O(1) otherwise O(... | true |
dd69701f2a47585497b7a114f5d71ae6b58aef60 | kongq1983/pythondemo | /mytuple/mytuple.py | UTF-8 | 217 | 3.859375 | 4 | [] | no_license | # 元组创建后,就不能改变
t = (1,2,3,4,5)
# 5
print(len(t))
t= t + (6,7)
print(t)
# 1
print(t[0])
# 第3个位置
print(t.index(4))
# 4的出现次数
print(t.count(4))
# 报错 不可变
# t[2]=10
| true |
9c4748b7f0281a026f2e5a85e0357cb3f75b12b9 | yizhang7210/Syllable | /server/grips/services/grips.py | UTF-8 | 3,415 | 2.75 | 3 | [
"MIT"
] | permissive | from grips.models import grips as grips_dao
from grips.models import user_grips as user_grips_dao
from users.services import users as user_service
def get_by_id(grip_id):
return grips_dao.get_by_id(grip_id)
def get_by_search(user_email, search_term):
return grips_dao.search(get_all_visible_by_user(user_email)... | true |
5697dc98db1dfd32bd454643fcb87867b59e13a8 | ashleyhma/hb-challenges | /easy/remove-duplicates/remove_duplicates.py | UTF-8 | 659 | 3.640625 | 4 | [] | no_license | """ Remove duplicates in a list
For example::
>>> remove_duplicates([6, 9, 7, 9, 2, 6, 0])
[6, 9, 7, 2, 0]
>>> remove_duplicates([])
[]
>>> remove_duplicates([6, 9, 7])
[6, 9, 7]
"""
def remove_duplicates(items):
"""Remove duplicates in the list items and return that list."""
chec... | true |
08fc4064035243b223d1533a7a96484c4f7dff1e | sergeyglazyrindev/amigrations | /amigrations/migrations.py | UTF-8 | 6,220 | 2.609375 | 3 | [
"MIT"
] | permissive | from __future__ import unicode_literals
import time
from pathlib import Path
import os
import re
import importlib
package = 'amigrations'
def _get_all_migrations_from_folder(migration_folder):
"""Simply checks folder for files which ends with up.sql
:param migration_folder: Path to migration folder
:typ... | true |
8ca0d8ba244a90696f4d86f1f0270be65d6bc693 | stevefusaro/spread | /test_spread_picks.py | UTF-8 | 713 | 2.796875 | 3 | [] | no_license |
from game import Game
from spread import _get_spread_picks
def test_sorts_by_spread():
kwargs = {
'away_team': 'NYG',
'away_score': 5,
'home_team': 'DAL',
'home_score': 6,
'spread_float': 15.0,
'spread_dir': '+',
}
games = []
spread_floats = [4.5, 1.5, ... | true |
b4269234baa64abb0c7b2849feab8356fa49554b | unamatasanatarai/projecteuler | /034_digital_factorials.py | UTF-8 | 495 | 3.390625 | 3 | [] | no_license | from math import factorial
def sum_factorions():
cache = {}
for x in range(0, 10):
cache[str(x)] = factorial(x)
limit = 7 * cache.get("9") + 1
tot = 0
for num in range(3, limit):
if num == sum(cache.get(i) for i in str(num)):
tot += num
return tot
def solve():
r... | true |
4bd5cb7076200c7dd2092f1b334ec168116bacaf | claypilat/AI-Python-Projects | /Neural Networks/NNMovieReviews.py | UTF-8 | 713 | 2.65625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
data = keras.datasets.imdb
(train_data, train_labels), (test_data, test_labels) = data.load_data(num_words = 10000)
print(train_data[0])
#grabs the tuples
word_index = data.get_word_index()
#k for key, v for val... | true |
9905c6e85d3a0640506ea3c17c3aca8badddf221 | vithal-4u/OneStopPySpark | /src/com/pyspark/poc/functions/DataFrameBasics.py | UTF-8 | 1,855 | 3.296875 | 3 | [] | no_license | '''
Created on 09-Jun-2020
Basic operation on DataFrames
@author: kasho
'''
from com.pyspark.poc.utils.BaseConfUtils import BaseConfUtils
conf = BaseConfUtils()
sparkSess = conf.createSparkSession("DataFrameBasics")
df = sparkSess.read.json("D:/Study_Document/GIT/OneStopPySpark/resources/people.json")
df.show()
''... | true |
1c7b0ce1f2d9199db2d3f12aa22d54dccef91548 | Alef-Martins/Exercicios_python_mundo-2 | /Mundo 2/ex052.py | UTF-8 | 435 | 4.625 | 5 | [
"MIT"
] | permissive | #Fça um programa que leia um número inteiro e diga se ele é primo ou não
num = int(input('Digite um número: '))
tot = 0
for c in range(1, num + 1):
if num % c == 0:
print(f'\033[33m{c}', end=' ')
tot += 1
else:
print(f'\033[31m{c}', end=' ')
print(f'\nO número {num} foi divisível {tot} v... | true |
a0ce90398261b0fdd395ffd9e0e0d159d3dab0ac | rich-03/LeetPractice | /Problem1491/Problem1491.py | UTF-8 | 291 | 3.40625 | 3 | [] | no_license | from typing import List
class Solution:
def average(self, salary: List[int]) -> float:
mins = min(salary)
maxs = max(salary)
ttl = 0
for i in salary:
if i not in [mins, maxs]:
ttl += i
return ttl / (len(salary) - 2)
| true |
1b5740882fa7ef73a2429feb4e57d6b6460763d9 | DanielSank/observed | /observed_test.py | UTF-8 | 10,795 | 3.59375 | 4 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import itertools
import observed
from observed import observable_function, observable_method
import pytest
def get_caller_name(caller):
"""Find the name of a calling (i.e. observed) object.
Args:
caller: The observed object which is calling an observer.
Returns:
The name of the caller. ... | true |
1ce5abeddce01c5bd37a6843f3a793c48e0562c3 | KangPilGyu/Algo-Study | /[2019년 10월 시작]/[5주차]브루트포스/[강필규][5주차][백준_7568_덩치].py | UTF-8 | 326 | 3.203125 | 3 | [] | no_license | n = int(input())
array = [0 for i in range(n)]
rank = [1 for i in range(n)]
for i in range(n):
array[i] = list(map(int, input().split()))
for i in range(n):
for j in range(n):
if i == j:
continue
if (array[i][0] < array[j][0] and array[i][1] < array[j][1]):
rank[i] += 1;
print(' '.join(str(e) for e in r... | true |
9bff264ffcabe8472d5af5bf85fcce2e063123f2 | baraileesuraj/python-concepts | /CSV and Json/complex.py | UTF-8 | 689 | 2.96875 | 3 | [] | no_license | import csv
import requests
import json
import urllib
file=['./resources/data.csv','./resources/new.csv']
line=0
for f in file:
with open(f,'r') as csvfile:
csvreader=csv.reader(csvfile)
with open('./resources/newrandom1234.csv','a') as new:
csvwriter = csv.writer(new, delimiter=',')
... | true |
e5950a9a7165d16bb39aef84a22492d42e53ca80 | rushi963/Natural_Language_Processing | /Assignment 1/loss_func.py | UTF-8 | 5,218 | 3.21875 | 3 | [] | no_license | import tensorflow as tf
def cross_entropy_loss(inputs, true_w):
"""
==========================================================================
inputs: The embeddings for context words. Dimension is [batch_size, embedding_size].
true_w: The embeddings for predicting words. Dimension of true_w is [batc... | true |
af5c4272ce0aa80cc71ed7ed268968c1a14644c7 | Pereirics/Exercicios_Curso_Python | /ex071.py | UTF-8 | 586 | 3.71875 | 4 | [] | no_license | print('=' * 30)
print(' ' * 10, 'BANCO BCP')
print('=' * 30)
n = int(input('Quanto quer levantar? € '))
if n < 0:
while n < 0:
print('Valor incorreto! Tente novamente.')
n = int(input('Quanto quer levantar? € '))
n50 = n // 50
n20 = n % 50 // 20
n10 = n % 50 % 20 // 10
n5 = n % 50 % 20 % 10 // 5
n... | true |
fb61c8f03f233765382785fc3db92b128ab4ed96 | Kamalkvaishnav/thefirstgame | /The War.py | UTF-8 | 4,500 | 3.296875 | 3 | [] | no_license | import pygame, random
pygame.init()
screen = pygame.display.set_mode((800,600))
# Background image
Background = pygame.image.load("Woodbg.jpg")
# name of the game
pygame.display.set_caption("The War")
# Happy man
happy_x = 0
happy_y = 530
happy_x_val = 0
happy_img = pygame.image.load("Happyman.png")... | true |
a2633ae4f630793ac1e157be3aeb902841953a3e | bradmdesign/PY4E-UoM | /Course 3 - Using Python to Access Web Data/json1.py | UTF-8 | 339 | 3.25 | 3 | [] | no_license | import json
data = ''' {
"name" : "Chuck",
"phone" : {
"type": "intl",
"number" : "+1 234 412 4122"
},
"email" : {
"hide" : "yes"
}
}'''
info = json.loads(data)
#info is like a dictionary
print('Name:',info["name"])
print('Hide:',info["email"]["hide"])
print('Phone:',info[... | true |
c4047663d5b60f1585ef32ff5e09962b19bf7aca | sshamilton/iq-graphing | /old/iq-transform.py | UTF-8 | 1,694 | 3.21875 | 3 | [
"MIT"
] | permissive | #program to convert raw IQ file to csv to test in Paraview
# Written by Stephen Hamilton
# 31 Dec 2019
import sys
import struct
import math
import pdb
def main():
#Check to see if a filename was given
if (len(sys.argv) < 2):
print("Please specify a file name to read.")
exit(1)
infi... | true |
214ede49b93c9c93d0cf5eb3a19b141f00789c88 | chrisg1622/language-model | /language_model/model/metrics/custom_metric.py | UTF-8 | 1,107 | 2.5625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.python import keras
class SparseCategoricalAccuracy(keras.metrics.Metric):
def __init__(self, name='sparse_categorical_accuracy', **kwargs):
super(SparseCategoricalAccuracy, self).__init__(name=name, **kwargs)
self.count = self.add_weight(name='count', init... | true |
b2713ddaa4881a64ae839635b0d49f510e37eeee | zembrzuski/andrewng-coursera-python | /python/xoxo.py | UTF-8 | 5,573 | 2.859375 | 3 | [] | no_license | import numpy as np
def first_column_to_zeros(inp):
return np.column_stack((np.zeros(len(inp)), np.delete(inp, 0, 1)))
def compute_cost_with_regularization(hypothesis, Y, llambda, theta_first_layer, theta_second_layer):
thetas_1st = np.array(theta_first_layer)
thetas_2nd = np.array(theta_second_layer)
... | true |
695c1b6189096e1396869fa7df02bf4387387f0d | berglundma/MP1_ENU4134_F18 | /Python/Error.py | UTF-8 | 2,565 | 3.09375 | 3 | [] | no_license | import numpy as np
def R2(corr, exp):
sum_total = 0
n_corr = len(corr)
n_exp = len(exp)
if n_corr == n_exp:
corr_mean = np.mean(corr)
corr_std = np.std(corr)
exp_mean = np.mean(exp)
exp_std = np.std(exp)
<<<<<<< HEAD
for n in range(0, n_corr-1):
||||||| merged commo... | true |
f5d14a8cff54922875153861e2b96f979ce1e48e | lfcruzUDES/csv_manipulator | /exec.py | UTF-8 | 769 | 3.171875 | 3 | [] | no_license | from os import listdir, path, system
from utils import functions
from utils.menu import instructions
def start():
instructions()
path_file = None
while True:
path_file = input("Ingresa la ruta al archivo: ")
if path.isdir(path_file):
break
else:
print('La ... | true |
b65156d05fc637f8996f82d1802721867098d2d3 | rsenseman/nand2tetris | /10_11/JackParser.py | UTF-8 | 19,214 | 2.640625 | 3 | [] | no_license | # Developed for project 10 of nand2tetris course
from pathlib import Path
import re
import sys
from JackTokenizer import Tokenizer
from SymbolTable import SymbolTable
from JackTokenizer import Tokenizer
from xml.etree.ElementTree import ElementTree, Element, SubElement, XML, dump, tostring, tostringlist
import xml.dom.... | true |
04932686fed15c8ba0f9491880927d1e40f6fccd | maxwellberkowitz/delirium | /splitting_data.py | UTF-8 | 7,585 | 3.328125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from filling_missing_data import fill_and_average
np.random.seed(7000000) # Generate the same labels every time, split into train/cv/test set consistently
def get_data_with_labels():
"""
Loads the data and attaches labels to it.
:return: A data frame with all the d... | true |
9b26fcafa36a83872ee2717d824134f0e601d9e8 | jangbigom91/nomadPython | /nomadPython/Keyword Argument.py | UTF-8 | 457 | 4.53125 | 5 | [] | no_license | # Keyword Argument
# 인자의 위치에 상관없이 인자의 이름에 따라 결정
def plus(a, b):
return a + b
result = plus(b=30, a=1)
print(result)
def say_hello(name, age):
return f"Hello {name} you are {age} years old"
hello = say_hello(age="12", name="nico")
print(hello)
def say_hi(name, age, gender):
return "Hello " + name + " you are "... | true |
4db9ad5693b516f4a92a51010a97fe1c03306bb1 | kohnakagawa/ghidra_scripts | /ghidra9.2.1_pyi/ghidra/app/cmd/module/MergeFolderCmd.pyi | UTF-8 | 1,405 | 2.546875 | 3 | [
"MIT"
] | permissive | import ghidra.framework.cmd
import ghidra.framework.model
import java.lang
class MergeFolderCmd(object, ghidra.framework.cmd.Command):
"""
Command to merge a Folder with its Parent folder. Immediate children of
the folder are moved to its parent.
"""
def __init__(self, treeName: unicode, fol... | true |
f7d409eb43534f3084c7a2ab8d681ae82ab5a533 | jackinf/aoc2019 | /day02/part2.py | UTF-8 | 569 | 3.078125 | 3 | [] | no_license | from typing import List
from day02.part1 import solve_part1
def solve_part2(inputs: List[int]) -> int:
for i in range(0, 100):
for j in range(0, 100):
copied_inputs = inputs[:]
copied_inputs[1] = i
copied_inputs[2] = j
solution = solve_part1(copied_inputs)
... | true |
920ca390ae9c4ccc1252832a4b44c919fc23e1f9 | crisgiovanoni/python-exercises | /python_intro_exercise.py | UTF-8 | 8,206 | 3.84375 | 4 | [] | no_license | 99.9 == float
"False" == string
False == boolean
'0' == string
0 == integer
True == boolean
'True' == string
[{}] == list
{'a': []} == dictionary
# What data type would best represent:
A term or phrase typed into a search box? == string
If a user is logged in? =
A discount amount to apply to a user/'s shopping cart? =... | true |
3216658c4f967fe1cd2ca9e1ce2555fd70da5c06 | Sogoodday-kbl/pythonProject | /Homework20210316/send.py | UTF-8 | 153 | 2.703125 | 3 | [] | no_license |
def send_money():
send_money = 1000
print("发工资"+str(send_money)+"元")
return send_money
if __name__ == '__main__':
send_money() | true |
6982aa80672f921c91b068d40ad8bac649566d94 | humorson/computational_physics_N2014301020037 | /exercise_03/move_myname.py | UTF-8 | 409 | 2.8125 | 3 | [] | no_license | import os
import time
myname=["##### # # #####"," # # # # "," # # # "," # # # ","##### # #####"]
space=' '
x=0
while x<50:
print(space*x+myname[0])
print(space*x+myname[1])
print(space*x+myname[2])
print(space*x+myname[3])
print(space... | true |
532c6a8a1f3af2dd0cb8951f3b4e145995b12253 | oceanbei333/leetcode | /685.冗余连接-ii.py | UTF-8 | 1,042 | 3.015625 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=685 lang=python3
#
# [685] 冗余连接 II
#
# @lc code=start
class Solution:
def findRedundantDirectedConnection(self, edges: List[List[int]]) -> List[int]:
f = dict()
def find(x: int) -> int:
f.setdefault(x, x)
if f[x] != x:
f[x] = find(... | true |
94d458357d07346e0efc4bc1cffa6cb7fbf10e52 | PaulGutkovich/FlappyBirdAI | /game.py | UTF-8 | 5,429 | 3.234375 | 3 | [] | no_license | import pygame
from pygame.locals import *
import time
import random
# Bird class
class Bird():
def __init__(self, surface, image, width, height):
self.surface = surface
self.image = pygame.transform.scale(image, (width, height))
self.r = 20
self.g = 0.7
self.x = 200
self.y = 20
self.v_y = 0
self.a... | true |
035c602dac3c0a79196392a93fa1419041a3fc19 | fakahil/prysm | /prysm/propagation.py | UTF-8 | 4,707 | 3 | 3 | [
"MIT"
] | permissive | """Numerical optical propagation."""
from .mathops import engine as e
from ._richdata import RichData
from .fttools import pad2d
def prop_pupil_plane_to_psf_plane(wavefunction, Q, incoherent=True, norm=None):
"""Propagate a pupil plane to a PSF plane and compute the grid along which the PSF exists.
Parameter... | true |
e41add4d83a50377460b6fc6e32042b852d0edaa | BrutishGuy/ADAGP | /Driver.py | UTF-8 | 1,774 | 3.015625 | 3 | [] | no_license | from GA import *
import time
__author__ = 'Victor Gueorguiev'
def main():
print("HP model training using Genetic Algorithms\nRun commencing...\n...")
# parameters, remember to set these!!
population_size = 500
monomer_length = 150
number_h = 75
generations = 3000
iterations... | true |
2820bf708c22c7069f939d03edee144cc1f0f90e | Rexhaif/active_learning_toolbox | /actleto/annotator/ui_widget.py | UTF-8 | 7,381 | 2.53125 | 3 | [
"MIT"
] | permissive | from .annotator_widget import AnnotatorWidget
from ipywidgets import Button, VBox, HBox, Label
import pandas as pd
import numpy as np
import logging
from threading import Timer
import os
logger = logging.getLogger('actleto')
def prep_log(obj):
return '\n' + str(obj)
class EvaluationCallbackLogging:
def _... | true |
0a6a9c0914bc36169ec8705e4d364636261f3a30 | dofany/python300 | /21_30_파이썬 문자열/26.문자열 다루기.py | UTF-8 | 176 | 3.453125 | 3 | [] | no_license | # 25번 문제의 전화번호를 아래와 같이 모두 붙여 출력하세요.
# 실행 예
# 01011112222
phone_number = "010-1111-2222"
print(phone_number.replace("-","")) | true |
1620ac8d85fac1c94ff930cb1fa218bfaee81930 | taylorme9481/oop-parking-garage | /driver.py | UTF-8 | 1,135 | 3.203125 | 3 | [] | no_license | from ParkingGarage import ParkingGarage
import time
test = ParkingGarage()
while True:
time.sleep(0.5)
command = input(""" Welcome to the Rangers Lot. Would you like to park, pay, or leave?:
""").lower()
if command == 'park':
if not test.parkingSpaces:
print("sorry no mor... | true |
86634eed1847220d80f3e3e832d90405ae760081 | Anu-Tomy/web-caesar | /caesar.py | UTF-8 | 314 | 3.421875 | 3 | [] | no_license | import helpers
def encrypt(message, rot):
"""
Ceaser encryption.
"""
#if type(message) != type(''):
# raise TypeError
#if type(rot) != type(1):
# raise TypeError
retText = ''
for char in message:
retText += helpers.rotate_character(char, rot)
return retText
| true |
f5f689e3904cbf245cb0322b4cbef7be82b9419f | georgenardes/PDS | /aula_11/cancela_eco/cancela_eco.py | UTF-8 | 1,884 | 2.859375 | 3 | [] | no_license | import numpy as np
from numpy import pi, cos, sin, log10
import matplotlib.pyplot as plt
from matplotlib.pyplot import plot, subplot, xlabel, ylabel, title, grid, axis, figure, show
from scipy.signal import freqz
sample_rate = 8000
# numero de coefs
n = 160
# inicia vetor de coefs
wn = np.zeros(n, dtype=np.float64)... | true |
5b4a9b50e850f021bc6e3c67da113a77cb0b9d61 | mihneagiurgea/pysandbox | /mtg/test/test_creature_state.py | UTF-8 | 2,705 | 3.125 | 3 | [] | no_license | import unittest
from creature_state import CreatureState
from factories import CreatureTypeFactory, CreatureStateFactory
class TestCreatureState(unittest.TestCase):
SERIALIZATION_FIXTURES = ('1/1 (TA)', '1/1 (A)', '1/1 (B#5)', '2/3 (T)', '0/7')
def test_equality(self):
creature_type = CreatureTypeFa... | true |
5ce0d7cd80b39233ef7bcd329579ad8a24f1d9c9 | rapgamesamliu/some_random_project | /my_application/streaming_api.py | UTF-8 | 9,724 | 2.671875 | 3 | [] | no_license | '''
streaming_api.py
Written May 17-20, 2011 by Josiah Carlson
Released under the GNU GPL v2
available: http://www.gnu.org/licenses/gpl-2.0.html
Other licenses may be available upon request.
Given a Redis server and a task queue implementation, this code implements the
equivalent of Twitter's streaming API as specif... | true |
81d05ec3ee1a96e94fc7bccb1ddee38729718deb | theomatas/SQL_2 | /projet_SQL2/src/lib/pages/fen_clean.py | UTF-8 | 365 | 2.546875 | 3 | [] | no_license | from tkinter import *
def main(self,M):
self.unload()
for i in M:
try:
i.destroy()
except:
try:
i.get_ent().destroy()
except:
try:
self.canvas.delete(i.get_ent())
except:
... | true |
216d7d71498ed739379867396f99d243617b1e70 | maiamcc/punbot | /punbot.py | UTF-8 | 8,303 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import nltk
from random import choice, random
import os
import re
import sys
import zulip
from punme import PUNME_LIST
nltk.data.path.append('./nltk_data/')
DEFAULT_PUN_CHANCE = 0.50 # number between 0 and 1 -- probability of making a pun off a valid msg
HELP_MSG = """Hi, I'm punbot, here for... | true |
424bf3042ac31cec7140f652e824a9d50d258889 | LongLiveCHIEF/docker-pi-gpio | /dockergpio/dockergpio.py | UTF-8 | 611 | 2.84375 | 3 | [] | no_license | from periphery import GPIO
def LED(gpiochip, pin):
try:
led = GPIO(gpiochip, pin, "out")
return led
except TypeError as e:
print('{}'.format(e))
except LookupError:
print('GPIO line was not found by the provided name')
except:
print('unknown error occurred')
def... | true |
65208514976eedb895ca7fbbada2fcf1f590d1fd | HeavyTech/Star-Ship-Fighter | /src/StarShipFighterFinal/StarShipFighter.py | UTF-8 | 21,129 | 3.3125 | 3 | [] | no_license | import pygame
from pygame.locals import *
from StarShipFighterFinal.BigExplosion import BigExplosion
from StarShipFighterFinal.SmallExplosion import SmallExplosion
from StarShipFighterFinal.Bullet import Bullet
from StarShipFighterFinal.Enemy import Enemy
from StarShipFighterFinal.Fighter import Fighter
from StarShipF... | true |
5476bffa06d15106d50e92b798b3ce028c760506 | Conor12345/Euler | /Euler2 41-80/problem_52.py | UTF-8 | 256 | 3.078125 | 3 | [] | no_license | #'sorted(set(list(str(i))))
current = 2
while True:
for i in range(2,7):
if sorted(set(list(str(current)))) != sorted(set(list(str(current * i)))):
break
print(current, current * 2)
x = input(" ")
current += 1 | true |
ff0b2f58194ded5bfe1b9f30ec4330aff0601aa5 | kuzovkov/python_labs | /2/task_2.5.py | WINDOWS-1251 | 544 | 3.53125 | 4 | [] | no_license | #
def quit():
print " q"
c=raw_input()
if c=='':
c='1'
c=c[0]
if c =='q':
return True
else:
return False
def main():
num=raw_input(' : ')
if num=='':
num=0
num=int(float(num))
q=0
for i in range(1,num+1):
... | true |
1abcb5049fe72b8e25c6f34fc609fa64fc9535a5 | jtlai0921/AEL019100 | /AEL019100_習題解答/lesson022/22.6.py | UTF-8 | 151 | 2.90625 | 3 | [] | no_license | def fun():
try:
fun.__count += 1
except AttributeError:
fun.__count = 1
print(fun.__count)
for i in range(10):
fun()
| true |
50e487ba9961818c6dfd1a393651fda41e7d0852 | graceunji/jump_to_python | /exercise/duplicate_numbers.py | UTF-8 | 661 | 4 | 4 | [] | no_license | # 0~9의 문자로 된 숫자를 입력받았을 때, 이 입력값이 0~9의 모든 숫자를 각각 한 번씩만 사용한 것인지 확인하는 함수를 작성하시오.
'''
입력 예시: 0123456789 01234 01234567890 6789012345 012322456789
출력 예시: True False False True False
'''
def is_duplicate_numbers(s):
for n in range(0, 10):
if s.find(str(n)) == -1 or s.count(str(n)) != 1:
return Fal... | true |
380e0be33a68471596f988b88db96421db4c31eb | excellink/KomonoFunc | /replace_file/replace_files.py | UTF-8 | 586 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# replace_files
# 功能:用于批量复制替换产生的同名文件
# 使用说明:将需要拷贝和替换的文件名写入copylist.txt中,每一行放一组用","分隔
# 如:file,file
import os
import shutil
f = open(r'D:/copylist.txt','r')
for line in f.readlines():
src,dst = line.strip().split(",")
path_src = os.path.join(r"E:/source/generated", src)
path_dst = os.path.j... | true |
75a3a8dee2a358efe01220578ac3a70cfbe607ea | shobhitsabharwal/Machine-Learning-Using-Python-and-R | /Multiple regresison: Python.py | UTF-8 | 2,009 | 2.859375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 21 19:13:30 2018
@author: Shobhit Sabharwal
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#import dataset
dataset = pd.read_csv("50_Startups.csv")
x=dataset.iloc[:,:-1].values
y=dataset.iloc[:,4].values
#Encoding categorical data
from sklea... | true |
cf8593397be08091b665119a92aa32c54904b386 | raedkit/fracdiff | /fracdiff/torch/functional.py | UTF-8 | 4,382 | 2.90625 | 3 | [
"BSD-3-Clause"
] | permissive | from typing import Optional
import torch
from torch import Tensor
from fracdiff.fdiff import fdiff_coef as fdiff_coef_numpy
def fdiff_coef(d: float, window: int) -> torch.Tensor:
"""Returns sequence of coefficients in fracdiff operator.
Args:
d : float
Order of differentiation.
... | true |
3058259f5d4e037370ab9bdabd12ddf621d85000 | skaiser/roadmap-to-html | /main.py | UTF-8 | 15,261 | 2.53125 | 3 | [] | no_license | import re
import data
import json
from bs4 import BeautifulSoup
from bs4.element import Tag, NavigableString
STYLE_MAP_PATH = 'stylemap.txt'
RAW_OUTPUT = 'roadmap-to-html/raw_index.html'
OUTPUT_PATH = 'roadmap-to-html/nice_index.html'
TOC_CLASSES = {'toc1', 'toc2', 'toc3', 'toc4'}
TOC_CONTENT_SIGNIFIER = "_Toc"
CHA... | true |
0899a99a088c7fc3b8a1e9411c578276beeb4ecd | bryancarl7/project2-soteria | /server/api.py | UTF-8 | 1,955 | 2.75 | 3 | [] | no_license | """
api.py
===============================================================================
Last Modified: 1 June 2020
Modification By: Bryan Carl
Creation Date: 22 May 2020
Initial Author: Bryan Carl
===============================================================================
"""
from data.bestTime import bestTime
f... | true |
a258e35bd81de8acf6be8166f68616909770bd3d | Abdulrahimch/problemSet | /easy/Two_sum_BST.py | UTF-8 | 472 | 3.6875 | 4 | [] | no_license | # Input: root = [5,3,6,2,4,null,7], k = 9
# Output: true
# sorted_l = [2,3,4,5,6,10] target=9
# exp: [1,5,9,16,20,30]
def sum_two_digits(l, target):
l.sort()
left = 0
right = len(l) -1
while left < right:
if l[left] + l[right] == target:
return left, right
if l[left] + l[rig... | true |
e704b7a595df92220ef3408a6d9d125936c64db8 | Fischerfredl/muperconfs | /backend/lib/redis_cache.py | UTF-8 | 686 | 2.59375 | 3 | [] | no_license | import json
import logging
import redis
from lib.config import redis_port, redis_host
r = redis.StrictRedis(host=redis_host, port=redis_port, db=0)
warned = False
def set_cache(key, data, expires=None):
try:
r.set(key, json.dumps(data))
if expires:
r.expire(key, expires)
except r... | true |
5d89e376b3e99cf8d0dc517aed5a4336341c5eb0 | TedYav/CodingChallenges | /practice/partition.py | UTF-8 | 927 | 3.625 | 4 | [] | no_license | def test(arr,expected,tc_num):
print("TC# %d" % tc_num)
result = partition(arr)
assert result == expected, "TC# %d\tGOT: %r EXPECTED: %r" % (tc_num,result,expected)
print("PASS")
def test_partition():
test([],[],1)
test([1,2],[1,2],2)
test([2,1],[1,2],3)
test([3,2,1],[1,2,3],4)
test([1,2,3],[1,2,3],5)
test([... | true |
b1a2c01454faccc47cf93007c524baef67c060e8 | zifengcheng/Essay-Scoring | /metrics.py | UTF-8 | 3,236 | 3.265625 | 3 | [] | no_license | #coding = utf-8
import numpy as np
def pearson(pred_score, true_score):
pred_avg = np.average(pred_score)
true_avg = np.average(true_score)
num, n1, n2 = 0.0, 0.0, 0.0
for pred_t, true_t in zip(pred_score, true_score):
num += (pred_t - pred_avg) * (true_t - true_avg)
n1 += (pred_t - p... | true |
84ab83d8847900ee73c7a6bb6ff41bf74f1dba58 | imyzx2017/iCaRL_Experiments | /Outlier_Detection_0618.py | UTF-8 | 14,699 | 2.734375 | 3 | [] | no_license | import numpy as np
from pyod.models.knn import KNN
from pyod.models.sod import SOD
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
from sklearn.ensemble import IsolationForest
import h5py
def stringToArray(string):
temp_list = string.split(';')
temp_list.pop()
code_len = len(te... | true |
8175345e942f442a378bd6c86876d1cc92aefcdd | falkzach/CSCI595-Deep-Knowledge-Transfer | /HW3/mnist_deep.py | UTF-8 | 5,363 | 2.84375 | 3 | [] | no_license | from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
# weight initializesrs
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)
#... | true |
b062683ff28efdea916f47164563f0117dd5bad5 | yejikk/Algorithm | /알고리즘실습/김예지_0214/종이붙이기.py | UTF-8 | 438 | 3.734375 | 4 | [] | no_license | import sys
sys.stdin = open('종이붙이기.txt')
def rectangle(num):
for i in range(2, num+1):
# 10씩 늘어날 때, 가로의 경우와 세로의 경우를 따져서 계산해줌
square.append(square[i-1] + 2*square[i-2])
return square[num-1]
test = int(input())
for tc in range(1, test+1):
N = int(input())
num = N // 10
square = [1, ... | true |
2507972d92ad6f50131c118d0bd6cf5a39b07613 | KlemenKrenker/SchoolProjects | /Introduction to BioInformatics/2_Variables.py | UTF-8 | 402 | 3.5625 | 4 | [] | no_license | # Introduction to Bioinformatics 2019/20
# 2 - Variables and Some Arithmetic
from math import pow
from h_read import FileReader
# returns hypotenuse value (type: int)
def hypotenuse(a, b):
return int(pow(a, 2) + pow(b, 2))
if __name__ == '__main__':
data = FileReader('dataset.txt')
data_lis... | true |
f5a557972ef34618a7b01a35ae3a5abfbcd3c191 | allenxzy/Data-and-Structures-and-Alogrithms | /python_data/Chapter 12/C/C-12.36.py | UTF-8 | 222 | 3.234375 | 3 | [] | no_license | #-*-coding: utf-8 -*-
"""
Consider the voting problem from Exercise C-12.34, but now suppose the
integers 1 to k are used to identify k < n candidates. Design an O(n)-time
algorithm to determine who wins the election.
""" | true |
1fdcf1ab8402ed5d3427888cb6d94162b18313f8 | PatrickHuembeli/QuCumber | /utils/2qubits_complexpurestate.py | UTF-8 | 6,041 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
import sys
import random
import cmath
import math as m
import argparse
# Local unitaries
H = (1./m.sqrt(2))*np.asarray([[1.,1.],[1.,-1.]]) # Base X
K = (1./m.sqrt(2))*np.asarray([[1.,-1j],[1,1j]]) # Base Y
I = np.asarray([[1.,0.],[0.,1.]]) # Identity
# Print the wavefunction on screen
def ... | true |
edf5507d44847c5b24cd1bf278c0b457d6691c21 | Alekseyyy/ctfs | /infosec/2020/brixelctf/challenges/programming/Keep walking/implementation.py | UTF-8 | 277 | 2.75 | 3 | [] | no_license |
# implementation.py
# this was written to solve the "Keep walking..." challenge
# By Aleksey
# - github.com/Alekseyyy
# - medium.com/@EpsilonCalculus
x, y, p = 1, 1, 1
a = None
while x <= 525:
a = x * y + p + 3
p = a
x += 1
y += 1
print("brixelCTF{" + str(a) + "}")
| true |
6a43c8967e05f240ca50057520a5bc4151d2431d | GauthamAjayKannan/guvi | /mergeandsort.py | UTF-8 | 121 | 2.890625 | 3 | [] | no_license | #mergeandsort
n=int(input())
r=[]
for i in range(n):
a=list(map(int,input().split(" ")))
r.extend(a)
print(*sorted(r))
| true |
85f52b1514bca7927b7cb44bf7197eac80811703 | sharon200102/Spectral-Clustering | /spectral_clustering.py | UTF-8 | 1,714 | 3.453125 | 3 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
from numpy import linalg as LA
"""D is the degree matrix(based on the weights) of the Adjacency matrix inserted, the Laplacien is the result of the
substraction between D and the Adjacency matrix.
After calculating the Laplacien, the partition... | true |
e8e8ab25320301a305431038e38f0f58a35328f5 | Andrey27936/practicum_1 | /8.py | UTF-8 | 622 | 3.546875 | 4 | [] | no_license | """
Имя проекта: practicum_1
Номер версии: 1.0
Имя файла: 8.ру
Автор: 2020 © А.И. Баскаков, Челябинск
Лицензия использования: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/deed.ru)
Дата создания: 16/12/2020
Описание: Задача 8.
#версия Python: 3.9
"""
a = int(input("Введите число для про... | true |
19ca9b1e61e1c33935267915a7a7f12b819bdfd4 | GGniya/2019.01.07 | /获取分类下的所有图片.py | UTF-8 | 1,369 | 3.09375 | 3 | [] | no_license | import requests #获取网页源码
from lxml import etree #解析网页源码
import os #os=operation = 操作系统=查看CPU/硬盘/创建文件夹/.....
# 获取某个网页源码
url = "http://www.ivsky.com/tupian/"
content = requests.get(url).text
# print(content)
# 使用etree解析源码 ,使用xpath提取数据
root = etree.HTML(content)
big_category = root.xpath("//ul[@class='tpmenu']/li/... | true |
d76e7d1eb86216318d5c6449782da7240d8a5074 | mansikapoor333/redwinetasting | /results.py | UTF-8 | 1,230 | 2.6875 | 3 | [] | no_license | import numpy as np
import pandas as pd
df = pd.read_csv(r"C:\Users\kapoor\Desktop\winequality-red.csv", sep=';')
X = df[list(df.columns)[:-1]]
y = df['quality']
X = np.append(arr = np.ones(X.shape[0],1), values = X, axis = 1)
X_opt = X[:, [0,1,2,4,6,8,9,10,11]]
from sklearn.model_selection import train_test_... | true |
b6688220c2f38c5e6e3e7a43f7a5ca14d3870912 | mudouasenha/TestesProjetos | /topico_modulos.py | UTF-8 | 2,678 | 3.71875 | 4 | [] | no_license | #geralmente dar import em todos os arquivos antes de iniciar o código
#import em todo o codigo
import modulo1
#importação seletiva
#importa somente a funcao jamelao
from doce import jamelao():
# Bibliotecas que não estão no python:
# Math
#uso de math
import math #importa tudo
from math import ceil, sqrt #importa s... | true |
4754b47ccd5121aa3600a311c5c34d19b1fd5250 | adambemski/book_think_in_python | /chapter_2.py | UTF-8 | 1,307 | 4.1875 | 4 | [] | no_license | """
Exercise 2.2
"""
import datetime
import math
import time
# 2.2.1
radius = 5
bowl_volume = (4 / 3) * math.pi * (radius ** 3)
print(f'2.2.1\tWolume of bowl: {bowl_volume:.2f}')
# 2.2.2
"""
What is the price for getting 60 books?
Official price is 24.95 and bookstories - have 40% discount.
Sending costs are 3 at fi... | true |
6851f9a1124e5a3e2e3360249cccd68b5acb27e8 | hamishHay/GeodesicPython | /calc_least_squares_weights.py | UTF-8 | 3,764 | 2.765625 | 3 | [] | no_license | import matplotlib as mpl
mpl.use('Agg')
import ReadGrid
import numpy as np
from numpy import deg2rad
import h5py
import sys
import matplotlib.pyplot as plt
import matplotlib.tri as tri
from scipy.sparse import csr_matrix
# from shapely.geometry import Polygon
def main():
N = int(sys.argv[1]) # geodesic grid... | true |
f5ff7711dab50f9d69573a8eb75d7c663bb315c1 | diamondstone/project-euler | /python/pe98.py | UTF-8 | 1,794 | 3.421875 | 3 | [] | no_license | import itertools as it
def removeduplicates(list1): #takes as input a sorted list, returns a new list consisting of the old list with repetitions removed
if list1==[]: return []
list2=[]
old=list1[0]
list2.append(old)
for i in range(1,len(list1)):
if list1[i]!=old:
old=list1[i]
... | true |
dfecc5dfd28e1c5e0fdee20c6914b802aa62db2e | cha-boy-nate/NBA_Player_Optimization | /main.py | UTF-8 | 1,465 | 3.625 | 4 | [] | no_license | import csv
import time
#Class creates class data type with their playerID, name. value, and age
class player:
name = ''
playerID = ''
value = 0
weight = 0
def __init__(self, playerID, name, value, weight):
self.playerID = playerID
self.name = name
self.value = value
self.weight = weight
def main():
data... | true |
4a1f6b58f2e45df12de2f79877ffadd735af866e | vamsikrishna6668/class-examples | /random number.py | UTF-8 | 437 | 3.46875 | 3 | [] | no_license | import random
print('start of your pgm')
while True:
n =int(input('enter a number b/w 1 to 10:'))
i =random.randint(1,10)
if n!=i:
print('enter your number',n)
print('enter random number',i)
print('your guess is wrong')
continue
print('enter your number',n)
pr... | true |
743c1ebd8548076ebcdc5640c3b7644e78607a45 | mulhearn/classwork | /phy116c/lab5_fourier/code/serial_driver.py | UTF-8 | 1,908 | 3.5625 | 4 | [] | no_license | #
# serial_driver.py
# by Michael Mulhearn
#
# An example program for acquiring data from an Arduino over the serial link and
# graphically displaying it with SciPy.
#
# 1) Opens a serial connection (you will probably need to adjust this)
# 2) Waits for Arduino init message.
# 3) Waits for user to press enter to acqu... | true |
5c422247594b7f9ad0f71a47baad4a18c0ea7698 | github-anki/CSP | /model/Constraint.py | UTF-8 | 1,522 | 3.25 | 3 | [] | no_license | from abc import ABC, abstractmethod
from itertools import combinations
from typing import Callable, List
class Constraint(ABC):
def __init__(self, variables):
self.variables = variables
@abstractmethod
def satisfied(self, assignment):
...
class SingleConstraint(Constraint):
def __init... | true |
993b329d4e6a636c8dcf0bcce5c2da9970395847 | host1812/gsa-admin-toolkit | /connector_exceptions.py | UTF-8 | 3,204 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
#
# Copyright 2008 Google Inc. All Rights Reserved.
#
# 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
#... | true |
d2dcb3020e5bf6e01786ae46474a67c9e4bc8483 | wwwmurphy/Scalable-Dtree | /dtree/print_tree_gv.py | UTF-8 | 2,671 | 3.40625 | 3 | [] | no_license | """
Create draw commands in 'dot'/graphviz language format.
Output can be run through this command:
dot -Tpdf -O file.dot
"""
label_fmt = "\"%s\" -> \"%s\" [label = \"%s\"]\n"
label_fmt_s= "\"%s\" -> \"%s\"\n"
box_fmt = "\"%s\" [shape = \"box\"]\n"
circle_fmt = "\"%s\" [shape = \"circle\"]\n"
labe... | true |
3f60dc099979f8eb787f44fb302ea30524025767 | hibfnv/Python-learning | /sample01.py | UTF-8 | 64 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
x=['Fruit']
y='Apple'
x.append(y)
print x
| true |
44878792c179f033b8ac37103dc5ec636600cfa8 | sankaku/deep-learning-from-scratch-py | /ch05/ReluLayer.py | UTF-8 | 641 | 3.484375 | 3 | [
"MIT"
] | permissive | import numpy as np
class ReluLayer:
def __init__(self):
self.mask = None
def forward(self, x):
"""x: NumPy array"""
self.mask = (x > 0)
return x * self.mask
def backward(self, dout):
"""dout: NumPy array"""
return dout * self.mask
if __name__ == '__main_... | true |
4b4659f176b02f14ec98d249c89fa2f8843adae6 | agneszhangmeng/deep | /dp_ai/seaborn/seaborn_test.py | UTF-8 | 908 | 2.625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from datetime import datetime
ddf = pd.read_csv("/Users/estherzhang/Downloads/sales_2017-2.csv")
# property = pd.read_csv("/Users/estherzhang/Downloads/sku_property-2.csv")
# skulist_1 = property['sku'].unique()
# cate = property['category'].unique()
charger = pd.read_csv("/Use... | true |
0ee7a5858a9d06438ec9e454f900e63a8237ce37 | svinkapeppa/image_recognition | /task_01/cs231n/classifiers/linear_svm.py | UTF-8 | 2,112 | 3.5 | 4 | [
"MIT"
] | permissive | import numpy as np
def svm_loss_naive(W, X, y, reg):
"""
Structured SVM loss function, naive implementation (with loops).
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
- X: A numpy... | true |
6e7afd9bae23b1977a82154c146c651c2a78895d | pawelpe90/self-taught-programmer | /rozdzial_03/python_lst008.py | UTF-8 | 82 | 2.578125 | 3 | [] | no_license | import math
# długość przekątnej
l = 4
w = 10
d = math.sqrt(l**2 + w**2) | true |
568bb822426c83cf7e7d855f0ce6c0fbc95fdc4b | sembug/losango_py | /test_losango.py | UTF-8 | 754 | 3 | 3 | [] | no_license | from losango import centralizar, linha, intervalo, text, monta_losango
def test_centralizar():
assert centralizar("0", 5) == "..0.."
assert centralizar("0", 3) == ".0."
def test_intervalo():
assert intervalo(0) == (0,)
assert intervalo(1) == (0, 1, 0)
assert intervalo(2) == (0, 1, 2, 1, 0)
a... | true |
e82803d9a1045886b8fe7a14adc3268abf29b16e | abhinavm24/LocalEPaper | /pdf_merger.py | UTF-8 | 779 | 3.015625 | 3 | [] | no_license | from PyPDF2 import PdfFileMerger
import os
merger = PdfFileMerger()
def main():
pdfs = ['1.pdf', '2.pdf']
FileMerger(pdfs, "/home/gugli/Documents/script_py/Dainik_Jagron/01.pdf")
print check_valid_pdf('1.pdf')
def check_valid_pdf(file_path):
# dir_path = os.path.dirname(os.path.realpath(__file__))
# file_p... | true |
941f2f7c2887d57533acd781334c40b15e9cf61b | moontree/leetcode | /version1/432_All_O`one_Data_Structure.py | UTF-8 | 3,299 | 4.4375 | 4 | [] | no_license | """
Implement a data structure supporting the following operations:
Inc(Key) - Inserts a new key with value 1.
Or increments an existing key by 1. Key is guaranteed to be a non-empty string.
Dec(Key) - If Key's value is 1, remove it from the data structure.
Otherwise decrements an existing key by 1.
If the... | true |
cf530c6e728d1cef7371e0791a46163d4ffbe186 | Armani07/Dev--Proj | /mxorc_deploy.py | UTF-8 | 12,123 | 2.5625 | 3 | [] | no_license | """Deploys or removes a specified folder of Bash scripts to/from hosts."""
import argparse
import logging
import ConfigParser
from socket import gaierror
from os import listdir
from os.path import isfile, join, dirname
from hashlib import md5
import paramiko
from paramiko import SSHException
import mxorc_logger
THIS_D... | true |
02c5a242647d019adcf726d3c1ee5f8d27d06ea2 | tejuafonja/mlcysec2019 | /utils.py | UTF-8 | 3,257 | 2.53125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader, Dataset, TensorDataset
def imshow(img):
npimg = img.numpy()
plt.imshow(np.transpose(npimg, (1, 2, 0)))
plt.show()
def transform_adv_origin_pair_to_dataloader(data_pair, batch_size=32, shuffle=False):
... | true |
b5ddd97254a82f84e20323be9d715d3c1e5f0402 | MrRaisin/SFO2 | /JSON postcode SF.py | UTF-8 | 6,666 | 2.65625 | 3 | [] | no_license | import json
import http.client
import urllib.request
import argparse
import platform
import sys
import time
#import usb.core
#import usb.util
FEED_PAST_CUTTER = b'\n' * 5
USB_BUSY = 66
PIPSTA_USB_VENDOR_ID = 0x0483
PIPSTA_USB_PRODUCT_ID = 0xA053
def printmain(txtprt):
"""The main loop of the... | true |
5d9a5ab9876aef726d6657d8d7f4787ce405b4fd | alighazal/secure_email | /main.py | UTF-8 | 10,755 | 2.546875 | 3 | [] | no_license | import os
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
from send import *
from db import *
from receive import *
from server import create_user, sign_up, verify_user
def generate_public_private_key_pair():
keysizes = [1024, 2048, 4096 ]
k... | true |