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 |
|---|---|---|---|---|---|---|---|---|---|---|
3331cdeb09ab2d0accb9e292478fc4b73366da26 | yokolet/tranquil-beach-python | /tranquil-beach/sorting_searching/sorted_arrays_median.py | UTF-8 | 996 | 2.828125 | 3 | [] | no_license | class SotredArraysMedian:
def findMedianSortedArrays(self, nums1: 'List[int]', nums2: 'List[int]') -> float:
if len(nums1) > len(nums2):
nums1, nums2 = nums2, nums1
m, n = len(nums1), len(nums2)
if m == 0:
return (nums2[(n - 1) // 2] + nums2[n // 2]) / 2
... | true |
570e6e8a0168325aab266e5b8264bdcba9424282 | EllieZhao/python-utils | /summary_ranges.py | UTF-8 | 735 | 3.390625 | 3 | [] | no_license | class Solution:
# @param {integer[]} nums
# @return {string[]}
def summaryRanges(self, nums):
if not nums:
return []
l = []
begin = nums[0]
end = begin
for item in nums[1:]:
if item == end + 1:
end = item
else:
... | true |
52248675695ced1508c1a9abce38f1c98d323c7c | navjotsingh003/palindrome | /palindrome.py | UTF-8 | 199 | 4.21875 | 4 | [] | no_license | nav = input('Enter name: ')
nav1 = str(nav) #we are changing the variable to string
if nav1 == nav1[::-1]:
print('It is palindrome')
else:
print('It is not palindrome')
| true |
9f0d27ec6cc99f1a4cb844b5eceb9158e109f261 | tejaswaroop2000/Malaria_detection | /malaria.py | UTF-8 | 1,078 | 2.78125 | 3 | [] | no_license | import cv2
import numpy as np
import pandas as pd
import csv
image = cv2.imread('s1.jpg')
#cv2.imshow("Original", image)
cv2.waitKey(0)
blur = cv2.blur(image,(5,5),5) # (9 x 9) filter is used
#cv2.imshow('Blurred', blur)
#cv2.waitKey(0)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
ret,threshold = ... | true |
af2548ae9150b436055fb7e68e2b506f5f411911 | KilianB95/Flex | /Python-Extra/01-Turtle/kilian.py | UTF-8 | 355 | 4.03125 | 4 | [] | no_license | import turtle
turtle.speed(0)
turtle.bgcolor("black")
turtle.pencolor("red")
turtle.fillcolor("blue")
turtle.begin_fill()
for x in range(36):
turtle.forward(150)
turtle.right(90)
turtle.forward(250)
turtle.right(90)
turtle.forward(150)
turtle.right(90)
turtle.forward(250)
turtle.left(5... | true |
2dcc2368a64bb0dcf8e5d24f383a4df6ac3f890a | artemkin/sandbox | /fme/tests/test.py | UTF-8 | 821 | 2.78125 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/python
import sys
from subprocess import Popen, PIPE
def _unidiff_output(expected, actual):
"""
Helper function. Returns a string containing the unified diff of two multiline strings.
"""
import difflib
expected=expected.splitlines(1)
actual=actual.splitlines(1)
diff=difflib.u... | true |
13cfb185424bf696e89e0d5113f3d17aedf5d5d8 | 0verk1ll/Algorithms-1 | /misc/GCD.py | UTF-8 | 703 | 4.28125 | 4 | [
"WTFPL"
] | permissive | """
Greatest common divisor(GCD) of two integers X and Y is the largest integer that divides both X and Y.
References :
https://en.wikipedia.org/wiki/Euclidean_algorithm
https://proofwiki.org/wiki/Euclidean_Algorithm
http://stackoverflow.com/questions/6005582/how-does-the-euclidean-algorithm-work
Algorithm :
* If X... | true |
bab8d9e60b2444d0b8afff8941c68900bc76862a | CoCode2018/Refresher | /Python/笨办法学Python3/Exercise 4.py | UTF-8 | 2,112 | 3.65625 | 4 | [] | no_license | """
variables
n.可变因素,变数( variable的名词复数 )
nothing more than
仅仅、只不过
lousy
adj.讨厌的;污秽的;多虱的;不清洁的
memories
n.记忆力( memory的名词复数 );记忆中的事物;记忆系统;记忆容量
they'd == they had
他们会、他们过去曾经
they'd == they would
他们愿意
stuck
v.刺(stick 的过去式及过去分词)
adj.动不了的;被卡住的;被…缠住的;被…难住的,不知所措
taught
v.教育;教( teach的过去式和过去分词 ... | true |
d82066dfefd8613d3b42e4172ddae1517d335144 | masashi-y/depccg | /depccg/semantics/ccg2lambda/nltk2json.py | UTF-8 | 2,068 | 2.609375 | 3 | [
"MIT"
] | permissive |
from nltk.sem.logic import *
from .logic_parser import lexpr
from .nltk2normal import remove_true
def run(expression):
if not isinstance(expression, Expression):
expression = lexpr(expression)
expression = remove_true(expression)
return _run(expression)
def _run(expression):
if isinstance(e... | true |
6ff4d1666445e063ec2f230a0ea773e5d3ef0ba6 | greatjunekim/py | /무작위 게임 즐기기:기회를 이용하자/RockPaperScissors.py | UTF-8 | 830 | 3.703125 | 4 | [] | no_license | import random
choices = ["바위","보","가위"]
while True:
player = input("가위, 바위, 보 중 하나를 선택하세요(또는 종료로 게임을 종료합니다.")
if player == "종료":
break
computer = random.choice(choices)
print("나 ",player," 컴퓨터 ",computer,"야")
if player == computer:
print("동점")
elif player == "바위":
if co... | true |
1c9b2504fe6fa353f26493f41a289f6e5a38d3ee | takumiw/AtCoder | /ABC102/C.py | UTF-8 | 362 | 2.796875 | 3 | [] | no_license | import sys
readline = sys.stdin.readline
def main():
N = int(readline())
A = list(map(int, readline().rstrip().split()))
Ai = [a-i-1 for i, a in enumerate((A))]
Ai.sort()
if N % 2 == 1:
b = Ai[N//2]
else:
b = (Ai[N//2-1] + Ai[N//2]) / 2
print(int(sum([abs(a-b) for a in Ai])... | true |
fcca4351bdbe430a4ebc4a351a06801cd5cb622b | plutoese/workrobot | /workrobot/libs/statmodel/class_lm.py | UTF-8 | 4,121 | 3.109375 | 3 | [] | no_license | # coding=UTF-8
"""
=========================================
回归分析——最小二乘法类
=========================================
:Author: glen
:Date: 2016.8.4
:Tags: regression ols
:abstract: 用OLS进行回归分析
**类**
==================
Reg
用OLS进行回归分析的主类
**使用方法**
==================
**示范代码**
==================
"""
import re
from... | true |
d8f92b12961a9ec62f521d648309a2a14500e544 | nazariyv/leetcode | /solutions/easy/island_perimeter/main.py | UTF-8 | 1,764 | 2.84375 | 3 | [] | no_license | from typing import List, TypeVar
from random import random
from solutions.minions import Stack
T = TypeVar('T')
class Solution:
def islandPerimeter(self, grid: List[List[int]]) -> int:
s: Stack = Stack()
m, n = len(grid), len(grid[0])
if m == n == 1: return 4
mn = m * n
p... | true |
2b74842d82e6eb3da3841c5e3f5f6b94c1d0b6b4 | bhimeshchauhan/ML-SentimentClassifier | /sentiment/src/tokenizer.py | UTF-8 | 822 | 2.75 | 3 | [
"MIT"
] | permissive | import re
import csv
file = open("training_data.csv", "r")
reader = csv.reader(file, delimiter='+')
tokenize = {}
labels = {}
feature = {}
for row in reader:
print("looping ", len(row), " ", row)
if len(row)==1:
row.append('-1,,,,,,,')
labels.setdefault(row[1], 0)
print("debug")
labels[ro... | true |
e31c1510f06fccd1582a89a8883b923064cc0f84 | julienawilson/data-structures | /src/insertion_sort.py | UTF-8 | 1,228 | 3.140625 | 3 | [
"MIT"
] | permissive | """Insertion sort."""
def insertion_sort(some_list):
"""It sorts."""
if not hasattr(some_list, "__iter__"):
raise(TypeError)
idx = 0
while idx < len(some_list) - 1:
if some_list[idx] > some_list[idx + 1]:
some_list[idx], some_list[idx + 1] = some_list[idx + 1], some_list[id... | true |
fd434b8dc7156d5639b8c2967a2a2860b41ec4c9 | avesk/battlesnake-python | /app/main.py | UTF-8 | 2,361 | 2.953125 | 3 | [] | no_license | import bottle
import os
import random
from astar import AStar
@bottle.route('/')
def static():
return "the server is running"
@bottle.post('/start')
def start():
data = bottle.request.json
game_id = data.get('game_id')
head_url = '%s://%s/static/head.png' % (
bottle.request.urlparts.scheme,
... | true |
a645520b09cdfd106be84b1464249a72d37ceb57 | reddyprasade/Python-Basic-For-All-3.x | /Pattern/Small_Alphabetical/Printing_Small_k.py | UTF-8 | 157 | 3.90625 | 4 | [
"MIT"
] | permissive | for row in range(7):
for col in range(4):
if col==0 or row+col==4 or row-col==3:
print('*', end = ' ')
else:
print(' ', end = ' ')
print()
| true |
0a5fae5fe68c482beb0e82fd310bd0ce758978d2 | Salbina-A/python405 | /is simmetric 3.1.py | UTF-8 | 158 | 3.34375 | 3 | [] | no_license | def symm_str(inp_str):
for i in range(len(inp_str)):
if inp_str == inp_str[::-1]:
return True
else:
return False
print(symm_str("121"))
| true |
92039c3889b52aae7b0e155daf4f7633679669f3 | SebastienGorgoni/Quantitative_Asset_Risk_Management_1 | /Project 1/Assignment1_Group19_code.py | UTF-8 | 12,240 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 12 10:52:47 2021
"""
## Import librairies
#####################
import os
import pandas as pd
import numpy as np
from scipy.stats import skew, kurtosis
from scipy.optimize import minimize
import matplotlib.pyplot as plt
from matplotlib import style
... | true |
b4bd931a01ab293183f9bf7b1a4d53c7d8d2fd96 | sauravgsh16/DataStructures_Algorithms | /g4g/DS/Queues/Implementation/4_LRU_cache.py | UTF-8 | 2,184 | 3.96875 | 4 | [] | no_license | ''' Implementation of a LRU cache '''
class Node(object):
def __init__(self, key, val):
self.key = key
self.val = val
self.next = None
self.prev = None
def __str__(self):
return '{0}: {1}'.format(self.key, self.val)
class LRUCache(object):
def __init__(self, cap... | true |
6706ce743a4d7782fcd8d262a31c9884e4127f2c | mikepschneider/circuitpy_ms | /CIRCUITPY/blinkdemo.py | UTF-8 | 1,372 | 2.875 | 3 | [
"MIT"
] | permissive | import board
import digitalio
from nonblocking_timer import nonblocking_timer
from digitalio import DigitalInOut, Direction, Pull
import neopixel
import touchio
RED = 0x100000 # (0x10, 0, 0) also works
YELLOW=(0x10, 0x10, 0)
GREEN = (0, 0x10, 0)
AQUA = (0, 0x10, 0x10)
BLUE = (0, 0, 0x10)
PURPLE = (0x10, 0, 0x10)
BLACK... | true |
25d9a9be922dc307e946b52eedaf0e1c756a089a | CaiZhongheng1987/algorithm_questions_and_codes | /leetcode045/test_Jump_Game_II.py | UTF-8 | 2,175 | 4.03125 | 4 | [] | no_license | # 给定一个非负整数数组,你最初位于数组的第一个位置。
#
# 数组中的每个元素代表你在该位置可以跳跃的最大长度。
#
# 你的目标是使用最少的跳跃次数到达数组的最后一个位置。
#
# 示例:
#
# 输入: [2,3,1,1,4]
# 输出: 2
# 解释: 跳到最后一个位置的最小跳跃数是 2。
# 从下标为 0 跳到下标为 1 的位置,跳 1 步,然后跳 3 步到达数组的最后一个位置。
# 说明:
#
# 假设你总是可以到达数组的最后一个位置。
class Solution:
def jump(self, nums):
"""
:type nums: List[int]
... | true |
ca7ff9180ec56d8745f59175c68aa2338c16e2c5 | c-yan/atcoder | /arc/arc020/arc020b-1.py | UTF-8 | 480 | 3.0625 | 3 | [
"MIT"
] | permissive | from collections import Counter
n, c, *a = map(int, open(0).read().split())
c1 = Counter(a[::2])
c2 = Counter(a[1::2])
for i in range(1, 11):
if i not in c1:
c1[i] = 0
if i not in c2:
c2[i] = 0
a = c1.most_common(2)
b = c2.most_common(2)
x = (n + 1) // 2
y = n - x
if a[0][0] != b[0][0]:
... | true |
872ee4f2db3a36606cee2b73c03179b0e0a86461 | tillmanntristanbosch/hive | /lib/window_menu.py | UTF-8 | 3,353 | 2.71875 | 3 | [] | no_license | import pygame
import variables as v
import button
import colors as c
import window_hvsh, window_hvsc, window_cvsc, window_settings
import game as g
pygame.init()
clock = pygame.time.Clock()
# Welcome to hive !
# for insights of processing times use the follwing pattern to check code for its needed processing time:
... | true |
f5b2075f8358ca82e4a7eff88036f33528c6cd5d | dibachi/ME179P | /Python Algorithms/f1.py | UTF-8 | 217 | 2.96875 | 3 | [] | no_license | #f1.py
def computeLineThroughTwoPoints(p1,p2):
if p1.size != 2 or p2.size != 2:
status = 'point input arguments must be in two dimensional space'
else:
status = 'it\'s fine'
print(status)
| true |
463304396c62ad1feb66963335739cbc2c0eb242 | aidan0328/D150 | /Light_control.py | UTF-8 | 1,806 | 3.109375 | 3 | [] | no_license | import serial
import time
class LightControl:
def __init__(self,baudrate,port = '/dev/ttyUSB0'):
try:
self.ser = serial.Serial()
self.ser.port = port
self.ser.baudrate = baudrate
self.ser.bytesize = serial.EIGHTBITS #number of bits per bytes
se... | true |
620ea86d533efdee7c1fcf2522bb9a1b42e6f947 | windstonp/Python-4-Everybody | /Tuples/Tuples.py | UTF-8 | 349 | 3.28125 | 3 | [
"MIT"
] | permissive |
file = './text.txt'
openFile = open(file)
dictionary = dict()
for line in openFile :
words = line.split()
for word in words :
dictionary[word] = dictionary.get(word,0) + 1
temp = list()
for k,v in dictionary.items() :
newt = (v,k)
temp.append(newt)
temp =sorted(temp, reverse=True)
for v,k... | true |
6d996607cc203922dd7fa5073d8683b84287b001 | salvadorhmutec/python_curse | /session03/031_try_utf8.py | UTF-8 | 192 | 3.515625 | 4 | [] | no_license | # encoding: utf-8
try:
n = input("Dividend: ")
d = input("divisor: ")
print (n / d)
except Exception, err:
print ("Error found: {}".format(err))
finally:
print ("Finish")
| true |
8230c4164cb481b06175cd929cd49560d5a4770a | lewy95/DebutPython | /basic/oop/theOop_player.py | UTF-8 | 429 | 3.453125 | 3 | [] | no_license | class Player:
"""这是一个运动员类"""
def __init__(self, name, number):
# self.属性 = 形参
self.name = name
self.number = number
def __str__(self):
return "Name is %s and number is %s" % (self.name, self.number)
def defend(self):
"""防守"""
print("running")
def s... | true |
9d83c1aae721cbb6a76e9dcbe605338b7bb42b90 | Vivekasr/python-algorithms-hackerrank | /TimeConversion.py | UTF-8 | 1,015 | 3.140625 | 3 | [] | no_license | import sys
def timeConversion(s):
lst = []
for timestr in s:
lst.append(timestr)
if (s[8]+s[9]) == ('PM'):
if 0<int(lst[0]+lst[1])<12:
newtimehour=int(lst[0]+lst[1])+12
newtime = str(newtimehour) + s[2] + s[... | true |
a9ff80bad8f86cb24f657232fdec3d40dc1946be | MonikaDvorackova/intenzivni_kurz_Pythonu | /zamestnanec.py | UTF-8 | 1,850 | 3.125 | 3 | [] | no_license | class Zamestnanec:
def vybrat_dovolenou(self, pocet_dni):
if pocet_dni <= self.__dny_dovolene:
self.__dny_dovolene = self.__dny_dovolene - pocet_dni
return "Užij si to."
else:
return "To už je moc."
def __str__(self):
text = f"Zaměstnanec se jmenuje {s... | true |
19892866fe7cd601b6f66be2f0646d15b06d8bb0 | Iceberry-qdd/python_exercise | /day4/4.py | UTF-8 | 388 | 3.75 | 4 | [] | no_license | """
猜数字
"""
import random
answer=random.randint(1,100)
counter=0
while True:
counter+=1
number=int(input('请输入:'))
if number<answer:
print('大一点')
elif number>answer:
print('小一点')
else:
print('恭喜你答对了!')
break
print('你总共猜了%d次'%counter)
if counter>7:
print('你的智商余额不足') | true |
3509a3afec8c3cc3bf707bb6100990e85e3247d2 | Yuandjom/Automate-the-Boring-stuff-with-Python | /Chapter 7 Pattern Matching with Regular Expressions/findallmethod.py | UTF-8 | 438 | 2.9375 | 3 | [] | no_license | import re
phoneRegex = re.compile(r'\d\d\d-\d\d\d-\d\d\d\d') #has no group , (r'') the r means raw string
mo = phoneRegex.findall('CELL: 415-444-9999 WORK : 212-555-9000')
print(mo) # no need gorup
# return ['415-444-9999', '212-555-9000']
phoneRegex = re.compile(r'(\d\d\d)-(\d\d\d-\d\d\d\d)') #has groups
mo = pho... | true |
31c6a5d7a01566eebc5826003c4c68a4f0b35193 | jonasmzsouza/fiap-tdsr-ctup | /20200522/Lista6Exerc04While.py | UTF-8 | 661 | 4.375 | 4 | [] | no_license | # lista6CT-2020.pdf
# Exercício 4
# Escreva uma função que recebe duas Strings: frase e letras; a frase representa um conjunto de caracteres e letras alguns caracteres.
# Sua função deverá substituir cada caracter c contido na frase pelo caracter * se este caracter c estiver presente em letras.
def substitui(frase, l... | true |
2669080e1a75e45f411115eeb3a7cdad47567c70 | pratikroy/Facerecognition | /FaceNet/detect_face.py | UTF-8 | 7,060 | 2.75 | 3 | [
"MIT"
] | permissive | import time
import pickle
from PIL import Image
from os import listdir
from os.path import isdir
from os import remove
from numpy import load
from numpy import asarray
from numpy import expand_dims
from numpy import savez_compressed
from mtcnn.mtcnn import MTCNN
from keras.models import load_model
from matplotlib impor... | true |
4b70bf133458e2016f90d4a37052a6b6f787333e | Treadco/cannon_bowel | /triangle.py | UTF-8 | 1,941 | 2.640625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# this defaults to python 2 on my machine
# (c) 2017 Treadco software.
#
# python version of the fuzzy rbm
# supports the non-fuzzy version.
#
#
license ='''
Copyright (c) 2017 Treadco LLC, Amelia Treader, Robert W Harrison
Permission is hereby granted, free of charge, to any person obtaining a co... | true |
5a348a1a2f3698d2f11d679e54bc6dbd61da3ca2 | Torxed/Scripts | /python/yubikey_gen.py | UTF-8 | 1,440 | 2.703125 | 3 | [] | no_license | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import yubico
import os
import binascii
import string
from Crypto.Cipher import AES
def Program():
try:
yk = yubico.find_yubikey(debug=False)
print("Version : %s " % yk.version())
except yubico.yubico_exception.YubicoError as e:
print("ERROR: ... | true |
c6855358dd1ba57c3f991d977bb53d16432ed394 | grilo/hollywood | /hollywood/system.py | UTF-8 | 1,384 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import time
import threading
import logging
import sys
import signal
import hollywood.actor
import hollywood.exceptions
# Clean shutdown with ctrl-c
def signal_handler(sig, frame):
System.halt()
sys.exit(1)
signal.signal(signal.SIGINT, signal_handler)
class System(object):
addre... | true |
40020e9c00c5d17700749ac485d75323e09ec38e | Nymrinae/EPITECH-Projects | /Mathematics/200/208dowels/main.py | UTF-8 | 1,005 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from print import *
from maths import *
from errors import *
args = checkArgs()
x = [[]]
Ox = [0]
Tx = [0]
# Fill x/Ox/Tx
for i, c in enumerate(args):
if (c >= 10 or (i != len(args) and Ox[-1] >= 10 and Ox[-1] >= args[i + 1])):
x.append([])
Ox.append(0)
T... | true |
b4b78cb00126962e61ac05d5791c321373fa4602 | JosafatV/asmRSA | /High Level/encodeRSA.py | UTF-8 | 5,643 | 3.375 | 3 | [] | no_license | # Instituto Tecnologico de Costa Rica
# Arquitectura de Computadores 1
#
# RSA encryption and decryption
#
# Josafat Vargas
# 21 of March, 2019
from fileCoder import fileManager
from fileCoder import encodeNoFile
from fileCoder import decodeNoFile
import math
import random
import datetime
# Finds the prime numbers b... | true |
d6c0ea1a17022d4973e3dfb61b87aea0e5a2a391 | kris4416/PythonL | /Apply_Fun_List.py | UTF-8 | 433 | 4.34375 | 4 | [] | no_license | # Create a List
regimentNames = ['Night Riflemen', 'Jungle Scouts', 'The Dragoons', 'Midnight Revengence', 'Wily Warriors']
# For loop that goes through list and capitalise
regimentNamesCapitalized = []
for i in regimentNames:
regimentNamesCapitalized.append(i.upper())
# Print the list of Capitalized
print(regime... | true |
c87bec0f93ffdf327e5e302031e60e3bff7656f9 | thecodearrow/Algorithms | /Data Stuctures/Disjoint Sets/MST.py | UTF-8 | 1,322 | 3.40625 | 3 | [] | no_license |
#https://www.spoj.com/problems/MST/
import sys
from collections import defaultdict
try:
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
except:
pass
class DisjointSet():
def __init__(self,n):
self.parent=[]
self.rank=[]
for i in range(n+1):
self... | true |
74e529921a55d612be67db47d256c879abad91aa | CompuCell3D/CompuCell3D | /cc3d/core/PyCoreSpecs.py | UTF-8 | 263,555 | 2.765625 | 3 | [] | no_license | """
Defines python-based core specification classes
"""
# todo: add automatic type checks of spec parameter sets
# todo: add to source code doc autogen
# todo: add to python reference manual
from abc import ABC
from contextlib import AbstractContextManager
import itertools
import os
from typing import Any, Callable, ... | true |
16e521d6961ba90eab0181a31f74702e3defcc79 | lmregus/Portfolio | /python/coding_bat/make_bricks/make_bricks.py | UTF-8 | 224 | 2.71875 | 3 | [
"MIT"
] | permissive | #########################
# #
# Developer: Luis Regus #
# #
#########################
def make_bricks(small, big, goal):
return goal <= (small +big *5) and goal % 5 <= small
| true |
8fa1e93b070ee2f051292202c82439df043340bd | DaHuO/Supergraph | /codes/CodeJamCrawler/16_0_2_neat/16_0_2_Luke_Skye_pancakes.py | UTF-8 | 976 | 2.625 | 3 | [] | no_license | fr=open("output.txt","w")
fo=open("B-large.in","r")
t=int(fo.readline())
def flip(a):
a=a[::-1]
a=list(a)
for i in range(len(a)):
if a[i]=='-':
a[i]='+'
else:
a[i]='-'
return "".join(a)
t1=1
while t1<=t:
s=fo.readline().strip()
count=0;
... | true |
72ac0e8b7867e5b6a455198660995a8266b4ecf1 | gdurin/mokas | /iniConnector.py | UTF-8 | 5,261 | 2.53125 | 3 | [
"CC-BY-3.0"
] | permissive | # Connector to the ini file using the factory pattern
# The idea is to create a connector
# for experimental and simulation data
# which is transparent and does not require any user input
# except for the ini file
import os,sys
import configparser
import colorsys
import numpy as np
def from_string(s, s_type='float')... | true |
a7dfbeb2601e55992752b57c31f2418d59416d8b | Muhammadali-gold/python-portfolio | /python-projects/Main.py | UTF-8 | 418 | 3.0625 | 3 | [] | no_license | from HackerRank import *
# Main
print()
# assert reverseInPlace('abc') == 'cba'
# assert duplicateCharactersV3("aaasssgasa,4ncxsuki.vxrudaasad") == 'asxud'
# assert check_two_string_is_anagram("ali", "lia") == True
# assert findAllPermutationsOfString("ab") == ['ab','ba']
# assert reverseWithRecursion("asasdasdZ") == ... | true |
62242359925f4998fe44dfdb765c254d50d8337a | MikeFez/RPi-Offline-Data-Logger | /rpi_offline_data_logger.py | UTF-8 | 7,116 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python3
import requests
import pickle
import os
import sys
from datetime import datetime
from time import sleep
import pysftp
import traceback
import socket
version = "0.1"
data_points = []
event_log = []
# determine system to allow for testing when not running live
running_on_pi = sys.platform.startswith... | true |
2ad9da6691d33dfdf2a9889880f0bf9cddb1860b | zwimer/Text-Transformation | /src/markdown_sanitizer.py | UTF-8 | 1,526 | 3.4375 | 3 | [] | no_license | """
This file contains the class MarkdownParser.
This file is meant to sanitize markdown to extract the plain
text it represents.
"""
from text_sanitizer import TextSanitizer
import string
import re
class MarkdownSanitizer(TextSanitizer):
"""
This class is a TextSanitizer which also sanitizes markdown
"... | true |
2ef081f1d66275c88785db85b07e2291fe444444 | antoprinciya/python | /39.py | UTF-8 | 55 | 2.65625 | 3 | [] | no_license | sums0=list(map(int,input().split()))
print(max(sums0))
| true |
62f20467d1e83827d581ef037cf07b9e14ea1551 | cyrilckurian/pythonbasicprograms | /stack program2.py | UTF-8 | 788 | 4.28125 | 4 | [] | no_license | #Simple stack program (manage employee data)
Employee=[]
c="y"
while(c=="y"):
print("1.PUSH")
print("2.POP")
print("3.Display")
choice=int(input("Enter your choice:"))
if(choice==1):
e_id=input("Enter employee no")
ename=input("enter the employee name:")
emp=(e_id,... | true |
fd7382e75a29d7b8bcff23eebb0c48ff9f63578c | MihirSeth/CodeWars | /WhoLikesIt.py | UTF-8 | 859 | 3.71875 | 4 | [] | no_license | def likes(names):
length = len(names)-2
length = str(length)
if len(names) >= 4:
name1 = names[0]
name2 = names[1]
likes4 = name1 + ', ' + name2 + ' and ' + length + ' others like this'
return likes4
elif len(names) == 1:
name1 = names[0]
lik... | true |
11d3affce1d807b7b3b1ae25a6f9d44f39a6f795 | mvimplis2013/machine-learning-python | /messageKit/rabbitmq/asynchronous_consumer.py | UTF-8 | 10,354 | 2.84375 | 3 | [] | no_license | import functools
import logging
import argparse
import time
import pika
from pika.exchange_type import ExchangeType
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) -35s %(lineno) -5d: %(message)s')
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
LOGGER = logging.getLogger(__name__)
... | true |
9d4e5c0ec39c3d479e498908bf39149c2762eecd | afarahi/Ay190 | /ws3-hw3/In-Class/In-Class-1.py | UTF-8 | 1,023 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
from matplotlib.pyplot import *
from numpy import *
from matplotlib import rc
from NumIntegral import *
from math import *
n = 200;
xGridCount=zeros(n+1,int)
ErrSR=zeros(n+1)
ErrTR=zeros(n+1)
for i in range(0, n+1):
xGridCount[i] = 10 + 10*i;
for j in range(0, n+1):
x = linspace(0.0, pi, xG... | true |
f597fa81ca5bb6059b34b8ec69afd319a42d672a | ZSPASOV/softuni-python-fundamentals | /01-Basic-Syntax-Conditional-Statements-and-Loops-Lab/05-Patterns-v1.py | UTF-8 | 130 | 3.515625 | 4 | [] | no_license | number = int(input())
for i in range(0, number + 1, 1):
print('*' * i)
for j in range (number - 1, -1, -1):
print('*' * j) | true |
5f35c90ae1a7a6a7241823610b92da2a5369b0f7 | painter1/replication | /jeff/cmip_gc.py | UTF-8 | 20,301 | 2.890625 | 3 | [] | no_license | #!/usr/apps/esg/cdat6.0a/bin/python
# Simple garbage collector for replicated CMIP5 data.
# This moves data to another directory. Deletion should not happen until someone
# has looked over the purportedly obsolete data.
# Before running this script, do a harvest (ingest) and run a verify to update the replication
# ... | true |
a013a95ebb5759f7dc00c47f0ad32839880bd6b8 | letuchiy-force/ray_casting_proj | /map.py | UTF-8 | 698 | 2.609375 | 3 | [] | no_license | from settings import *
# здесь идет создание карты поверхностей
# также карта создается и для мини-радара
text_map = [
'111111111111',
'1......1...1',
'1..111.2.1.1',
'1.2..1..11.1',
'1..2....1..1',
'1..222.111.1',
'1....1.....1',
'1111111111111'
]
world_map = {}
mini_map = set()
for ... | true |
ee6311cdbc061270ad92af86c772743496993411 | intelemetry/malware-crawler | /MalwareCrawler/src/utils/oletools/olemeta.py | UTF-8 | 2,776 | 2.5625 | 3 | [
"MIT",
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
"""
olemeta.py
olemeta is a script to parse OLE files such as MS Office documents (e.g. Word,
Excel), to extract all standard properties present in the OLE file.
Usage: olemeta.py <file>
olemeta project website: http://www.decalage.info/python/olemeta
olemeta is part of the python-o... | true |
4deb72f778ffa1952d15f8309f0973c45daa4635 | rlworkgroup/garage | /src/garage/envs/task_onehot_wrapper.py | UTF-8 | 6,265 | 3.109375 | 3 | [
"MIT"
] | permissive | """Wrapper for appending one-hot task encodings to individual task envs.
See `~TaskOnehotWrapper.wrap_env_list` for the main way of using this module.
"""
import akro
import numpy as np
from garage import EnvSpec, EnvStep, Wrapper
class TaskOnehotWrapper(Wrapper):
"""Append a one-hot task representation to an ... | true |
2776c07c9fd89444063e5af1e4acf47ce9d28185 | rihter007/Po-znaikaDemo | /web_server/auxiliary/extract_7char_lens.py | UTF-8 | 209 | 2.75 | 3 | [] | no_license | import codecs
f = codecs.open('dict_7chars.txt', 'w', 'cp1251')
for line in codecs.open('dict_nouns.txt', 'r', 'cp1251'):
if 7 + 2 <= len(line) and len(line) <= 10 + 2: # 2 is CrLf
f.write(line) | true |
bb900669e386f7e4104ec212ee647242a86d16d0 | Isaac-Lee/BOJ-Algorithm | /Python_Solutions/11443.py | UTF-8 | 687 | 2.9375 | 3 | [] | no_license | import sys
input = sys.stdin.readline
n, b = 2, int(input())
m = [[1, 1], [1, 0]]
mod = 1000000007
def product(s, m1, m2):
answer = [[0 for _ in range(s)] for _ in range(s)]
for i in range(s):
for j in range(s):
for k in range(s):
answer[i][j] += m1[i][k] * m2[k][j]
... | true |
1aec9397867717858310a8d260295b7dac5083c5 | findcongwang/leetcode | /problems/largest_triangle_area/solution.py | UTF-8 | 520 | 3.1875 | 3 | [] | no_license | from itertools import combinations
class Solution:
def largestTriangleArea(self, points: List[List[int]]) -> float:
max_area = 0
def area_from_points(p1, p2, p3):
one = p1[0]*p2[1]+p2[0]*p3[1]+p3[0]*p1[1]
two = p1[1]*p2[0]+p2[1]*p3[0]+p3[1]*p1[0]
... | true |
2cc4ee140cdcea5fe0206a339acd3ff3f8f7dedb | JonathanWaterhouse/Maestro | /MaestroApp.py | UTF-8 | 19,691 | 2.53125 | 3 | [] | no_license | import os
import sqlite3
import subprocess
from MainUI import Ui_MainWindow
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import *
from SVGDisplay import *
from Schedule import Schedule
from TableModels import *
from TextDisplay import *
__author__ = 'Jonathan Waterhouse'
#class MaestroUi(Ui_MainWindow, QMainWi... | true |
e371ee4ba2cb663f14547042396edd65557a8f2a | UWPCE-PythonCert-ClassRepos/220-Advanced-Summer-2019 | /students/jsward/lesson08/assignment/inventory.py | UTF-8 | 3,078 | 3.5625 | 4 | [] | no_license | # pylint: disable=C0103
# pylint: disable=W0703
"""
inventory.py
CSV replacement
"""
import datetime
import functools
import logging
import sys
log_format = "%(asctime)s\t%(message)s"
formatter = logging.Formatter(log_format)
file_handler = logging.FileHandler("inventory_{}.log".format(datetime.datetime.now().strft... | true |
1df188532085407dac5fb69a0a5103028e19ee4a | MaximeBastion/PythonExercices | /Part 1/exo2-if-else-argument-print-input.py | UTF-8 | 1,454 | 4.40625 | 4 | [] | no_license | """
1. Créer une fonction qui affiche dans la console si un age passé en paramètre est considéré majeur ou mineur.
Indice: utilise print(string) pour afficher du texte dans la console.
"""
#Solution
"""
def estMajeur(age):
if age >= 18:
print("Vous êtes majeur")
else:
print("Vous êtes mineur"... | true |
4e9a743a1df45e80634aacd80fef0ab34f88deae | imaginaryusername/electron_cash_scheduled_payments_plugin | /scheduled_payments/util.py | UTF-8 | 1,065 | 2.9375 | 3 | [
"MIT"
] | permissive | import datetime
DISPLAY_AS_AMOUNT = 1
DISPLAY_AS_ADDRESS = 2
DISPLAY_AS_DATETIME = 3
class ValueFormatter:
def __init__(self, window):
self.window = window
self.wallet = window.wallet
def format_contact(self, address):
if address in self.wallet.contacts.keys():
con... | true |
7867dc4beef40459364c57e7734b5a9d96398e79 | vishalbelsare/Meme-Propagation-Agent-Based-Model | /run.py | UTF-8 | 1,252 | 2.9375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 12:13:19 2020
@author: metalcorebear
"""
from model import propagation_model
import model_params
import argparse
import os
#import pandas as pd
# Specify arguments
def get_path():
parser = argparse.ArgumentParser()
parser.add_argument('-o', '-... | true |
202292bb683db2d99457169cc31cd38d307c3f2b | django-group/python-itvdn | /домашка/essential/lesson 6/Dmytro Marianchenko/t_1_1.py | UTF-8 | 144 | 3.34375 | 3 | [] | no_license | string1 = set(input("Enter some string:\n>> "))
string2 = set(input("And another string:\n>> "))
eq_str = set(string1 & string2)
print(*eq_str)
| true |
d118de6fb2d8f15c8b4dbe25fbe7e991eaa608b6 | Lucaspvo/CI061_RedesDeComputadoresII | /lista.py | UTF-8 | 99 | 3.234375 | 3 | [] | no_license | lista = ['laranja', 'banana', 'uva']
lista.sort()
for item in lista:
print item.capitalize()
| true |
1b37fd86402252cecd42284d6bd6fbab066754b1 | leosampaio/scene-designer | /builders/layers/feature_extractors.py | UTF-8 | 17,720 | 2.921875 | 3 | [
"MIT"
] | permissive | import tensorflow as tf
def build_VGG19_feature_extractor(input_shape):
x = tf.keras.Input(shape=input_shape)
base_model = VGG19(weights='imagenet',
include_top=False)
outputs = []
out = x
for layer in base_model.layers:
out = layer(out)
if layer.name in ['bl... | true |
a81db568545aecf47b64c33b805d3cd8bb3763f5 | vbnin/Sandbox | /Tkinter test/utils/ressources_tkinter.py | UTF-8 | 895 | 2.71875 | 3 | [] | no_license | #python v3.6.1
# -*- coding: utf-8 -*-
import subprocess
import platform
import threading
from time import sleep
system = "windows"
# threads = []
def color():
global color
color = "yellow"
return color
def Op_Sys():
if platform.system().lower() == system:
return True
else:
retur... | true |
34e11cee0bf28e9eacc5fdfe2c890822fbab6c9c | emerald2-0/hex-base64-py | /b64_encoder.py | UTF-8 | 655 | 3.515625 | 4 | [] | no_license | import codecs
import time
def hex_to_base64():
hexa_input = input("Enter the hex code here: ")
time.sleep(0.4)
print("Converting to base64...")
time.sleep(0.4)
b64_result = codecs.encode(codecs.decode(hexa_input, 'hex'), 'base64').decode()
print("Conversion complete...")
return b64_result
print(... | true |
a289a7b2d90d2cb581af434a2863990fb69c441d | avinash-oza/home-projects | /other_scripts/google_calendar_events/add_gcal_events.py | UTF-8 | 2,768 | 3.046875 | 3 | [] | no_license | import argparse
import logging
from datetime import timedelta
import pandas as pd
from gcsa.event import Event
from gcsa.google_calendar import GoogleCalendar
logging.basicConfig(level=logging.INFO,
format="[%(asctime)s] %(levelname)s %(message)s"
)
logger = logging.getLogger(... | true |
753369001854e7c4bf9cbe4b0acdc90a632c3044 | mtlehmicke/The-Tech-Academy-Coding-Projects | /Python Projects/askDirectoryGUI.py | UTF-8 | 363 | 3.046875 | 3 | [] | no_license | from tkinter import filedialog
from tkinter import *
def browseButton():
filename = filedialog.askdirectory()
directoryText.insert('1.0', filename)
master = Tk()
browse = Button(text='Directory', command=browseButton)
browse.grid(row=0, column=1)
directoryText = Text(master, height=2, width=30)
directoryTex... | true |
d2fd64b3515a93906781ea4efbc7f60fc5ab8d66 | Ducbx/algorithm-training | /Green/L04P07.py | UTF-8 | 279 | 3.71875 | 4 | [] | no_license | def check_symmetry(n):
n_str = str(n)
n_length = len(n_str)
range_counter = n_length // 2
for counter in range(0, range_counter):
if n_str[counter] != n_str[-counter-1]:
return 'NO'
return 'YES'
n = int(input())
print(check_symmetry(n))
| true |
fb89ebce5d785ccaee58ca248760f1f0a7be6ae4 | gmadigan/LQ2Analysis | /SysTableStats.py | UTF-8 | 2,144 | 2.5625 | 3 | [] | no_license | import sys, os
import re
import json
cleantablefile = sys.argv[1]
years = ["2016","2017","2018"]
year = [s for s in cleantablefile.split("/")[0].split("_") if s in years][0]
outPath = "/".join(cleantablefile.split("/")[:-1])
outJson = outPath+"/CleanTableStats_"+year+".json"
allStats = {}
with open(cleantablefile,... | true |
297194d156b7c50f4ba271638911c16c363304e7 | garcia/synctools | /synctools/commands/clicktrack.py | UTF-8 | 6,820 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from decimal import Decimal
import math
import os
import random
import wave
from synctools import command
__all__ = ['ClickTrack']
class ClickTrack(command.SynctoolsCommand):
title = 'Click track'
description = 'generate a click track WAV file'
fields = [
{
... | true |
001297f576219410532b2e7968e65e644e1be401 | pmduc2012/pythonbasic | /Lesson 4/BT3 - Tuple.py | UTF-8 | 205 | 3.5625 | 4 | [] | no_license | numList = [9, 3, 2, 5, 6, 8, 11]
num1 = []
num2 = []
for i in numList:
if i <= 5:
num1.append(i)
else:
num2.append(i)
num1.sort()
num2.sort()
Result = (num1, num2)
print(Result) | true |
0653bd4619d029afce71af8a267cf140005e61d5 | sarahdudek/Chicago-Rideshare-Analysis | /Cleaning_Code/full_trips_cleanup.py | UTF-8 | 1,208 | 2.515625 | 3 | [] | no_license | ############################## This script has been disposed because the VM doesn't have enough memory ##################
############################## Having more memory OR splitting this script could solve that problem, but the DW would need adjusting ##################
import pandas as pd
full_trips = pd.read_csv... | true |
d3f0f67e923d38675fb4ca38fd161b4729436812 | IlyaBuryan/GB_algorithms_and_structures | /Lesson5/task_1.py | UTF-8 | 4,528 | 3.890625 | 4 | [] | no_license | """
1. Пользователь вводит данные о количестве предприятий, их наименования и прибыль
за 4 квартала (т.е. 4 отдельных числа) для каждого предприятия.
Программа должна определить среднюю прибыль (за год для всех предприятий)
и вывести наименования предприятий, чья прибыль выше среднего и отдельно
вывести наименования пр... | true |
7227cf8d842cb18947c0e7e0c4b8fc56ba1263f4 | philscher/gkc-tools | /IntegralCode/convergencePlot.py | UTF-8 | 694 | 2.578125 | 3 | [] | no_license | from pylab import *
import gkcStyle
fig = gkcStyle.newFigure(ratio="2.33:1", basesize=12)
Nx = array([ 33., 65., 127., 197., 257., 369., 513., 713.])
omega = [ -0.260 - 0.004j , - 0.218 + 0.061j, -0.229 + 0.082j, -0.233 + 0.0882j, - 0.235 + 0.0905j, -0.237 + 0.09267j, -0.238 + 0.094j, -0.239 + 0.0949j]
# Frequency
s... | true |
05b71b685b24e70ab2491389de90f151ad911331 | odinfor/leetcode | /pythonCode/tree/getTree.py | UTF-8 | 232 | 2.640625 | 3 | [] | no_license | class TreeNode:
def __init__(val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def Tree(nodeList):
if not nodeList:
return TreeNode()
class Tree:
| true |
37b2a1811150a476fe35d427c4cf3f3b1be68fd2 | jesseniagonzalezv/Training_Perusat | /prepare_data/Perusat-1/create_dataset_Perusat_2.py | UTF-8 | 5,937 | 2.890625 | 3 | [] | no_license | """
Create the Perusat dataset
Images with RGBNIR bands
Input:
Original dataset:
The images from PeruSAT-1 satellite in .TIF format with a size approximately of 6000X6000size, 4 bands
Labels were create with QGIS and defined by hand and also using the filter_mask_1step.py
Output:
Dataset: 915 images of 4 bands (R... | true |
0eee07b0ecd9cfcd543f1759ce996948adee17d0 | MoonKuma/TensorFlowTest | /SVM_test/testSvm.py | UTF-8 | 1,758 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : testSvm.py
# @Author: MoonKuma
# @Date : 2018/9/7
# @Desc : test Svm using an internet example
import numpy as npy
from sklearn import svm
from sklearn.model_selection import train_test_split
def iris_type(s):
it = {'Iris-setosa': 0, 'Iris-versicolor': 1... | true |
59ad93d84bdb156fe3808b011ff31b31322041cb | Hu-chi/OpenCV_zero2one | /Exercise_Gasyori100knock/Question_21_31/ans_21to31.py | UTF-8 | 7,951 | 2.765625 | 3 | [] | no_license | import cv2
import numpy as np
from matplotlib import pyplot as plt
def histogram_normalization(img: np.ndarray, limit_l: int = 0, limit_r: int = 255) -> np.ndarray:
if limit_r < limit_l:
limit_l, limit_r = limit_r, limit_l
height, width = img.shape[:2]
channel = None if len(img.shape) < 3 else img... | true |
91738654e46d564d041fe91b81fd77d35bfd1abf | Jhonathanalvesbr/URI | /INICIANTE/1019 - Conversão de Tempo.py | ISO-8859-1 | 343 | 3.71875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
'''
Escreva a sua soluo aqui
Code your solution here
Escriba su solucin aqu
'''
n = int(input())
if n >= 3600:
y = n / 3600
y = int(y)
n = n - (y*3600)
else:
y = int(0)
if n >= 60 and n < 3600:
x = n / 60
x = int(x)
n = n - (x*60)
else:
x = int(0)
print ("%d:"%y+"... | true |
ddd09c7772f37600982d99c9a51268f3ba1b8600 | GabrielEstevam/icpc_contest_training | /uri/uri_python/iniciante/p1101.py | UTF-8 | 395 | 3.453125 | 3 | [] | no_license | entry = input().split(" ")
a = int(entry[0])
b = int(entry[1])
while a > 0 and b > 0:
menor = a
maior = b
if a > b:
menor = b
maior = a
saida = ""
soma = 0
for i in range(menor, maior+1):
saida += str(i)+" "
soma += i
saida += "Sum="+str(soma)
print(saida)... | true |
d12cb5e3f782d3d0dfa7d50435a0de5ebadc03f1 | Ricyteach/candemaker | /src/candemaker/cid/linedef/general.py | UTF-8 | 832 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | from collections import namedtuple as nt
Field = nt('Field', 'name spec default')
def line(**field_defs):
'''Return a cid file line definition composed of a tuple of fields'''
return tuple(Field(n, s, d) for n, (s, d) in field_defs.items())
def defaults(linedef):
'''Generate the defaults from a line defi... | true |
2c8c597b0526b5ea6f57c9ff3d192a9a8db06ec1 | prathimacode-hub/Swipe-Past-Your-Tetris | /tetris.py | UTF-8 | 8,484 | 3.359375 | 3 | [
"MIT"
] | permissive | #Carlos Gonzalez
#cggonzal
#Section C
from tkinter import *
import random
import copy
def init(data):
#Seven "standard" pieces (tetrominoes)
iPiece = [
[ True, True, True, True]
]
jPiece = [
[ True, False, False ],
[ True, True, True]
]
lPiece = [
[ ... | true |
643161f99c19f189eeab6421e863de80693874a8 | Arx247/Arnas-2332-oop-labs | /Lab 4/P4.py | UTF-8 | 552 | 3.953125 | 4 | [] | no_license | # Arnas Oonsadao, 633040233-2
"""
Lab 4 Errors and Exceptions: Problem 4 'Using Debugger'
"""
def enter_integer():
sum = 0
count = 0
average = 0 #add average = 0
while True: #use debug
try:
n = int(input("Enter an integer:"))
if n < 0:
break
su... | true |
abaf5cda556eb4bfc3bdfecf0ed45f9e4603d5ab | luk9400/kodowanie | /list3/decoder.py | UTF-8 | 3,009 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
""" LZW decoder """
import sys
from FibonacciCode import FibonacciCode
def elias_gamma(code):
codes = []
counter = 0
idx = 0
while idx < len(code):
if code[idx] == "0":
counter += 1
idx += 1
else:
codes.append(int(code[idx : idx + c... | true |
39bd321d10c4c5ee667df7717439f5dce7503000 | wishuuu/myprojects | /Sieć neuronowa z interfejsem graficznym/gui.py | UTF-8 | 3,411 | 2.578125 | 3 | [] | no_license | import PyQt5.QtWidgets as qtw
from PyQt5.QtWidgets import QApplication, QVBoxLayout, QWidget, QPushButton, QLabel, QLineEdit, QInputDialog
from PyQt5.QtGui import QPainter, QPen
from PyQt5.QtCore import QSize, Qt, QLine, QPoint,QRect
import sys
from net_managment import create_net, load_data, train, test
class Net(qt... | true |
f6a69a57bb1a7d87446bdb41b4bd6af224439a8d | farhad-dalirani/AUT_Neural_Networks | /Assignment_6/load_jordan.py | UTF-8 | 2,555 | 2.875 | 3 | [] | no_license | from jordan import *
if __name__ == '__main__':
import matplotlib.pyplot as plt
from read_dataset import read_dataset
from errors import mse
# read dataset, col 0
col_i = read_dataset(ith_col=5)
trainX = col_i[0:10000, :]
validX = col_i[10000:13000, :]
testX = col_i[13000:23... | true |
40f5f4fe71556cddd2350d7c64d0e8f9208c9081 | daisySSSS/basic_algo | /test_tree_tranverse.py | UTF-8 | 656 | 3.09375 | 3 | [] | no_license | from tree_tranverse import Tree, inorder_tranverse_recursive,inorder_tranverse_iterative,preorder_tranverse_recursive,preorder_tranverse_iterative,postorder_tranverse_recursive,postorder_tranverse_iterative
root = Tree(value=0)
root.left = Tree(value=1)
root.right = Tree(value=2)
root.left.left = Tree(value=3)
r... | true |
b7ea466c3030ecdcd75ef20e837403091081fed3 | gokadroid/Python3Examples | /gradingStudents.py | UTF-8 | 2,035 | 3.96875 | 4 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'gradingStudents' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts INTEGER_ARRAY grades as parameter.
#
def gradingStudents(grades):
# Write your code here
for i in range(0,... | true |
d6179ef47cc171654cdd178b2ed61a8ac2214750 | bluvory/Com_programming1 | /final/0612(내장함수내장모듈).py | UTF-8 | 4,336 | 3.703125 | 4 | [] | no_license |
# 내장함수
# abs(x) 절댓값
abs(3)=3 , abs(-3)=3
# pow(x, y) x의 y제곱 = x**y
pow(2, 4)=16 , pow(3, 3)=27
# sum() 합
sum([1, 2, 3])=6
# hex(x) 16진수(0x : 16진수)
hex(234)='0xea' , hex(3)='0x3'
# all 모두가 참인가
all([1,2,3])=True , all([1,2,3,0])=False -> 0이 False이기때문에
# any 적어도 하나는 참인가
any([1,2,3,0])=True , any([0, ""])=False
# d... | true |
c10ab9fa0e9d0a0bf16c1b9428eb8856ff919f56 | dayoladejo/SwarmOptimization | /test_functions/test_functions.py | UTF-8 | 5,683 | 2.734375 | 3 | [
"MIT"
] | permissive | #
# file: test_functions.py
#
# Test the standard functions
#
# RTK, 07-Aug-2020
# Last update: 08-Aug-2020
#
################################################################
import sys
import time
import pickle
sys.path.append("../")
from PSO import *
from DE import *
from RO import *
from GWO import *
from J... | true |
10e5672bcfe1e2a7ae4bedc582e9bb95a872f893 | anjiang2016/MM3D | /box2cloud.py | UTF-8 | 3,410 | 2.6875 | 3 | [] | no_license | from pptk_show import *
# 生成一些随机点
#pointcloud=np.random.rand(10,3)
def get_vertex(xyz,theta,dim):
print(dim.shape)
w=dim[0,0]
h=dim[0,1]
l=dim[0,2]
vertex=np.zeros([8,4])
vertex[0,:]=np.array([0.5*w,0.5*h,0.5*l,1])
vertex[1,:]=np.array([-0.5*w,0.5*h,0.5*l,1])
vertex[2,:]=np.array([-... | true |
c264f819b6b7e7048e15df952375319bbffd53d4 | han-shang/AID_2010 | /thread.py | UTF-8 | 380 | 3.15625 | 3 | [] | no_license | from threading import Thread, Event
msg = ""
e = Event()
def person():
print("杨子荣前来拜山头")
global msg
msg = "天王盖地虎"
e.set()
t = Thread(target=person)
t.start()
print("说对口令是自己人")
e.wait()
if msg == "天王盖地虎":
print("宝塔镇河妖")
print("确认过眼神,你是对的人")
else:
print("打死他")
| true |
3843541e26aa390d0652c533aa57d5c3f059122a | kimwlsgh97/mycode_2019 | /crawling/sel_pint_img.py | UTF-8 | 2,488 | 2.796875 | 3 | [] | no_license | from selenium import webdriver
import requests
import time
from tqdm import tqdm
def pint_login(driver): #핀터레스트 로그인
URL = "https://www.pinterest.co.kr/"
driver.get(URL)
time.sleep(1)
driver.find_element_by_xpath('//*[@id="__PWS_ROOT__"]/div/div/div/div/div[3]/div/div[1]/div/div/div[2]/button/div').c... | true |