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 |
|---|---|---|---|---|---|---|---|---|---|---|
692cb526333449b53c90116abb209b172acac6e1 | srp2210/PythonBasic | /dp_w3resource_solutions/file-io/20_program_to_generate_26_files_bases_on_alhabets.py | UTF-8 | 342 | 3.171875 | 3 | [] | no_license | """
* @author: Divyesh Patel
* @email: pateldivyesh009@gmail.com
* @date: 26/05/20
* @decription: Write a Python program to generate 26 text files named A.txt, B.txt, and so on up to Z.txt.
"""
import string
alphas = string.ascii_uppercase
for each in alphas:
filename = each + '.txt'
with open(filename, 'w') ... | true |
0caa0fc9cc0fde34df44ea73ed06046e2fad4dcb | duncangeere/vpype | /vpype/primitives.py | UTF-8 | 2,449 | 3.484375 | 3 | [
"MIT"
] | permissive | """
.. module:: vpype
"""
import math
import numpy as np
__ALL__ = ["line", "rect", "circle"]
def line(x0: float, y0: float, x1: float, y1: float) -> np.ndarray:
"""Build a line from two points
Args:
x0: line start X coordinate
y0: line start Y coordinate
x1: line end X coordinate
... | true |
40cd519a4274464bad163cc69e31ca7481f33063 | Amit0417/PythonDev | /Practice/practice.py | UTF-8 | 424 | 3.796875 | 4 | [] | no_license | def pal(a):
mid = (len(a) - 1) // 2
start = 0
last = len(a) - 1
flag = 0
while (start <= mid):
if (a[start] == a[last]):
start +=1
last -=1
else:
flag = 1
break;
if(flag==0):
print("The enterd sting is palindrome")
els... | true |
699264cee0930045ec99df66350127e5d3a8accd | yyqlk/magical-python | /算法的Python实现/选择排序.py | UTF-8 | 331 | 3.75 | 4 | [] | no_license | def select_sort(alist):
n = len(alist)
for min_pointer in range(n-1):
for i in range(min_pointer+1, n):
if alist[min_pointer] > alist[i]:
alist[min_pointer], alist[i] = alist[i], alist[min_pointer]
if __name__ == '__main__':
alist = [1, 44, 5, 2, 8, 49]
print(alist)
select_sort(alist)
prin... | true |
42f7958c4e63426fa5a5366c3af2a11b381977f0 | BigfooTsp/Practicas_pygame | /ejemplos/juego_mario/mario_07.py | UTF-8 | 4,783 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''================================================================
Práctica de tutorial de pygame youtube (hackerseingenieros)
python 3.4 y pygame 1.9.2b
#================================================================'''
# Módulos
import sys, pygame
from pygame.local... | true |
94031d23bbc6a3966337dfb3071466241de8c536 | annusgit/memory_lstm | /extracodes/testing.py | UTF-8 | 4,523 | 2.890625 | 3 | [] | no_license |
"""
Learn torch by example
"""
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
from torch import optim
from torch.tensor import Tensor
import torch.nn.functional as F
from torchvision import datasets, transforms
class Net(nn.Module):
def __init__(se... | true |
c728512025722ca1f3c46b5bd400fd61e793ae16 | devolo/adaptavist | /adaptavist/_helper.py | UTF-8 | 2,342 | 2.984375 | 3 | [
"MIT"
] | permissive | """Helper methods used by the module."""
import getpass
import os
from typing import Any, Dict, List
def get_executor() -> str:
"""Get executor name."""
build_url = os.environ.get("BUILD_URL")
jenkins_url = os.environ.get("JENKINS_URL")
is_jenkins = build_url and jenkins_url and build_url.startswith(... | true |
679667e3e1126167f14ed9384c8efcbab8aeffcd | bkko79/codility-examples | /py/passingCars.py | UTF-8 | 256 | 2.8125 | 3 | [] | no_license | def solution(A):
# write your code in Python 3.6
result = 0
sum = 0
for i in range(len(A)):
if A[i] == 0 : sum += 1
if A[i] == 1 : result += sum
if result > 1000000000 : return -1
return result
| true |
a822b7c5150f4d424bd9287c2d5276ea156ffc1c | JohnElyson/Quick-Programs | /GerenciamentoDeFuncionarios.py | UTF-8 | 3,902 | 3.171875 | 3 | [] | no_license | # -*- coding: cp1252 -*-
import pygame, random
Meses = ['Janeiro', 'Fevereiro', 'Mar篧, 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembo', 'Outubro', 'Novembro', 'Dezembro']
NumerodoMes = 1
MesAtual = Meses[NumerodoMes-1]
i = 1
Clientes = []
class Pessoa():
def __init__(self,Nome):
self.Nome = None
... | true |
31f670f62908dfb21c52ea49325b5c7ced5cd7a3 | shinz4u/CTCI | /Python/linkedlists/linkedlist.py | UTF-8 | 2,495 | 3.921875 | 4 | [] | no_license | class LinkedList:
def __init__(self, data=None):
self.head = Node(data)
def add_node_tail(self, new_data=None):
new_node = Node(new_data)
node = self.head
while node.next:
node = node.next
else:
node.next = new_node
def add_node_head(self, ne... | true |
308583e7b49ecf587e048ecaa61bf9510d21fdda | cuzai/pythonStudy | /sql/queryAdv.py | UTF-8 | 1,121 | 3.015625 | 3 | [] | no_license | import simplejson as json
from tinydb import TinyDB, Query, where
db = TinyDB('databases/database.db')
users = db.table('users')
todos = db.table('todos')
Users = Query()
Todos = Query()
# 여러가지 조회방법
# print(users.search(Users.id == 7))
# print(users.search(Users['id'] == 7))
# print(users.search(where... | true |
775183caf6bbad4d209e149c73b3b365d0a51846 | nehaj27/Gender-Recognition- | /button.py | UTF-8 | 646 | 3.046875 | 3 | [] | no_license |
from tkinter import *
from tkinter import ttk
from tkinter.filedialog import askopenfilename
file1= open("int","w+")
root = Tk( )
#This is where we lauch the file manager bar.
def OpenFile():
name = askopenfilename(initialdir="C:/Users/Batman/Documents/Programming/tkinter/",
filetyp... | true |
9d7374c689738611b593f071860859ebc55710b8 | alexandermayerl/pythonGrundlagenSPL | /Python_Grundlagen1.py | UTF-8 | 733 | 4.53125 | 5 | [] | no_license | print("Taschenrechner (+, -, *, /, **)")
zahl1 = float(input("Bitte die erste Zahl eingeben"))
zahl2 = float(input("Bitte die zweite Zahl eingeben"))
operation = input("+, -, *, /, oder ** rechnen ?")
if(operation == "+"):
summe = zahl1 + zahl2
print("Summe = ", summe)
if(operation == "-"):
differen... | true |
52ea419c918e1592d1806a6329dc2b432a570312 | killstyles/my_love | /7-16/ProgressBar.py | UTF-8 | 244 | 3.15625 | 3 | [] | no_license | # 进度条
import time
import sys
for i in range(11):
# print('\r{}% '.format(i * 10) + '##' * i + '--' *(10 - i))
sys.stdout.write('{:3.0f}% '.format(i * 10) + '##' * i + '--' *(10 - i) + '\r')
time.sleep(1)
sys.stdout.flush()
print('\n')
| true |
04b93ff2189a7b70ba7f78fcbdc044852a4146ba | Linka39/pythonStudy | /strFormat.py | UTF-8 | 780 | 3.65625 | 4 | [] | no_license | # 花括号代表参数的插入位置
print("{0} love {1}.{2}".format("I", "linka", "39"))
# 关键字参数使用
print("{a} love {b}.{c}".format(a="You", b="linka",c= "39"))
# %格式化字符串ascii代码
print('%c' % 97)
print('%d + %d = %d' % (4, 5, 4 + 5))
# 格式化为科学计数法
print('%e' % (422222222))
# 左边代表打印占的位数,小数点后代表取的位数,d为整数形十进制,f为小数形式,e为科学计数法,默认右对齐,加号表示左对齐
print('%5... | true |
bf112425908c4ed8a2cde5b16fab3994682c4206 | flipsideview/pyCiscoSpark | /example2.py | UTF-8 | 555 | 3.125 | 3 | [
"MIT"
] | permissive | #Example searches rooms for "Test Room", finds the id, and then posts a test message "python test message1"
import pyCiscoSpark
import sys
def search (values, searchFor):
for k in values["items"]:
print (k["title"])
if (k["title"] == searchFor) : return k["id"]
return None
accesstoken="Beare... | true |
a3866d30cc34d94323f3ea0f4b35fa7d2d22c1dc | theailabs-in/mask_rcnn | /custom.py | UTF-8 | 1,923 | 2.515625 | 3 | [
"MIT"
] | permissive | import os
import sys
import urllib
import shutil
import numpy as np
# Root directory of the project
ROOT_DIR = os.path.abspath(".")
# Import Mask RCNN
sys.path.append(ROOT_DIR) # To find local version of the library
from mrcnn.config import Config
from mrcnn import model as modellib, utils
#Custom model url to down... | true |
1ccb9840f858fe21ddfabac3b6dfcd2750608adb | vik-y/bmtc | /scraper/getBusStops/getRoute.py | UTF-8 | 2,209 | 3.265625 | 3 | [] | no_license | '''
Source of data: MyBMTCS and https://github.com/openbangalore/bmtc
how it works?
Picks the buses from busroutes.csv
Gets their route from mybmtc in form of json
Start from while loop to understand the flow complete
1) Searches if the bus is present in the local files
2) If the bus is not found locally then loo... | true |
fcbdcc4fbb9979454f36431aadc20407e1fb326b | React-Learning-Lambda/Intro-Python-II | /src/adv.py | UTF-8 | 4,830 | 3.625 | 4 | [] | no_license | from room import Room
from player import Player
# Declare all the rooms
room = {
'outside': Room("Outside the Cave Entrance",
"North of you, the cave mount beckons", 'outside', ['stick', 'stone']),
'foyer': Room("in the Foyer", """Dim light filters in from the south. Dusty
passages r... | true |
d102d72f0890390905c20a1f0688a8edc76d9d8c | ZX1209/gl-algorithm-practise | /leetcode-gl-python/leetcode-427-建立四叉树.py | UTF-8 | 4,956 | 3.90625 | 4 | [] | no_license | # leetcode-427-建立四叉树.py
# 我们想要使用一棵四叉树来储存一个 N x N 的布尔值网络。网络中每一格的值只会是真或假。树的根结点代表整个网络。对于每个结点, 它将被分等成四个孩子结点直到这个区域内的值都是相同的.
# 每个结点还有另外两个布尔变量: isLeaf 和 val。isLeaf 当这个节点是一个叶子结点时为真。val 变量储存叶子结点所代表的区域的值。
# 你的任务是使用一个四叉树表示给定的网络。下面的例子将有助于你理解这个问题:
# 给定下面这个8 x 8 网络,我们将这样建立一个对应的四叉树:
# 由上文的定义,它能被这样分割:
# 对应的四叉树应该像下面这样,每个结点由... | true |
a686bebd2244b22b22df676af3d94988a9bb99ba | sowmiyaragupathi/python | /assignment3.py | UTF-8 | 111 | 2.515625 | 3 | [] | no_license | a=1001
b=101
c=199.99
print("bill_id:",type(a))
print("customer_id:",type(b))
print("bill_amount Rs:",type(c))
| true |
3b1fae16267f15ea0becf37bf73aec0de2f58aa0 | Easyshop/Easyshop | /src/easyshop.order/easyshop/order/adapters/item_management.py | UTF-8 | 5,087 | 2.546875 | 3 | [] | no_license | # Zope imports
from zope.interface import implements
from zope.component import adapts
from zope.component import getMultiAdapter
# easyshop imports
from easyshop.catalog.adapters.property_management import getTitlesByIds
from easyshop.core.interfaces import ICartManagement
from easyshop.core.interfaces import IData
f... | true |
f68b74f90bb9160696ebabd4368c40dac909bbea | maheshhingane/LeetCode | /Algorithms/Medium/ContainsDuplicate.py | UTF-8 | 568 | 3.1875 | 3 | [] | no_license | """
https://leetcode.com/problems/contains-duplicate-iii/description/
"""
class Solution(object):
def containsNearbyAlmostDuplicate(self, nums, k, t):
"""
:type nums: List[int]
:type k: int
:type t: int
:rtype: bool
"""
for start in range(0, len(nums)):
... | true |
91fcc2baed821252c3bba7e9ca23d9c21839e42b | dem-esgal/-kaggle-mercedec | /DeepLearningMain.py | UTF-8 | 9,163 | 2.625 | 3 | [] | no_license | # This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/... | true |
df90e73a7d9b0e663aaa07d9d5ccaea4b64a404b | LangInteger/code-snippet | /spring-statistic/spring_statistic/data_integrator/SpringAirports.py | UTF-8 | 2,213 | 3.1875 | 3 | [
"MIT"
] | permissive | """
Statistic of airports Spring Airline reaches
"""
import json
from spring_statistic.utils import IOUtils
from spring_statistic.utils.const import CountryConst, AirportConst
def format_airport(original_airport):
return {AirportConst.FIELD_CITY_NAME: original_airport[1][1], AirportConst.FIELD_AIRPORT_CODE: or... | true |
bf45783a9a7b4e780b8c1cdcf9c569874c2d02dd | kp646576/hacker-rank | /algorithms/strings/camel-case.py | UTF-8 | 261 | 3.390625 | 3 | [] | no_license | #!/bin/python
import sys
def wordCount(s):
count = 1
for c in s:
if c.upper() == c:
count += 1
print count
def wordCount2(s):
regex = r"[A-Z]"
print(len(re.findall(regex, s)) + 1)
s = raw_input().strip()
wordCount(s)
| true |
8557237b1c3c0cee7434c044eb618d84f9dd57ac | SaketJNU/deep-learning | /experiments/Version1/helpers.py | UTF-8 | 8,652 | 2.578125 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import altair as alt
import tensorflow as tf
import keras
#from tensorflow.examples.tutorials.mnist import input_data
from keras.datasets import fashion_mnist
import os
# Helper to get the labels for each c... | true |
90927939153cc368a910e27d9d251b5cb6260ab8 | dagss/oomatrix | /examples/testbed.py | UTF-8 | 365 | 2.609375 | 3 | [] | no_license | import oomatrix as om
import numpy as np
from oomatrix import Matrix, compute, explain
def ndarray(shape, dtype=np.double):
return np.arange(np.prod(shape), dtype=dtype).reshape(shape)
n = 10
A = om.Matrix(ndarray((n, n)), 'A')
D = om.Matrix(3 * np.ones(n), 'D', diagonal=True)
u = ndarray((n, 1))
expr = A * D *... | true |
af564d5704edfc5b51251695d8ab9e5f70d77214 | Xynoclafe/leetcode | /easy/univalueBinaryTree.py | UTF-8 | 607 | 3.40625 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isUnivalTree(self, root: TreeNode) -> bool:
def dfs(node, parent):
if node == None:
retu... | true |
325598f367c014c9840eec4f7aa802fd5b178dd7 | achmadafriza/DDP1 | /Lab 04/Lab03_Achmad Afriza Wibawa_1906315821_FE.py | UTF-8 | 1,594 | 4.09375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 18 16:18:16 2019
@author: achmad.afriza
"""
# -----------------------------------beginning of program------------------------------------------------------------
print('Lab 03\n')
print('From decimal to binary')
print('----------------------')
# read the use... | true |
6f5c13ebf3fdbca866003fa41287b73e18c99be2 | mej571/MCTF-video-coding | /src/create_zero_texture.py | UTF-8 | 1,096 | 2.6875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: iso-8859-15 -*-
# Create a file with texture where each pixel is 128.
import sys
from arguments_parser import arguments_parser
from colorlog import ColorLog
import logging
#import colorlog
import struct
log = ColorLog(logging.getLogger("create_zero_texture"))
log.setLevel('ERROR'... | true |
6980938c5997e2bde085337da0d8a709f049072a | xcabezaderadiox/EDD_Paradigmas | /Documentos/Python/Diagramacion/Ejercicios/5/9 y 10 5.py | UTF-8 | 291 | 3.796875 | 4 | [] | no_license | lista = []
Cantidad = int(input("Por favor ingrese la cantidad de numeros a ingresar:"))
n = 1
while n <= Cantidad:
lista.append(int(input("Ingrese numero: ")))
n = n + 1
print ("El menor numero de la lista es: "(min(lista)))
print ("El mayor numero de la lista es: "(max(lista)))
| true |
264ffab157ebf9501815e12c4f2ca20837439e36 | tflatebo/random-teams-bg | /test/test_util.py | UTF-8 | 4,058 | 2.921875 | 3 | [
"MIT"
] | permissive | # system packages
import unittest, pickledb, time, glob, os
# what we are testing
from random_teams_bg.util import is_hard_link, is_soft_link, is_recent_file, get_random_file, get_google_photo_list
class TestRandomTeamsBG(unittest.TestCase):
@classmethod
def setUpClass(self):
self.src_dir = "test/dat... | true |
c84b7228e08c9fdd3cb6aeae2b309cf9526e44fb | armaaar/lost_children_backend | /face_registerar/utils/mark_faces.py | UTF-8 | 1,578 | 2.828125 | 3 | [] | no_license | import json
import cv2
from numpy import ndarray
from face_registerar.models.kid_face import KidFace
_mark_settings: dict = {
'padding': 5,
'thickness': 2,
'font_scale': 0.6,
'label_height': 20,
'color': (0, 255, 0),
'text_color': (255, 255, 255)
}
def mark_faces(image: ndarray, faces: list[K... | true |
0cc950f7181c949383c25f012ecbe961bfefd55f | vivekbwaj/Python_Projects | /Python-SeleniumFramework/unittest/Testsuite_selenium/Emails.py | UTF-8 | 862 | 2.703125 | 3 | [] | no_license | import unittest
from selenium import webdriver
import os
class Emails(unittest.TestCase):
@classmethod
def setUpClass(cls):
print("I will run only once before all tests")
driverLocation = "E:\Python-SeleniumFramework\python_behave_Framework\dependencies"
os.environ["webdriver.gecko.dri... | true |
3c46c43750c231c8fb0b8205976d139146164bc8 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2420/60781/256303.py | UTF-8 | 209 | 2.921875 | 3 | [] | no_license | import random
n=int(input())
a=1
while(True):
L = a
R = n-L
if '0' not in str(L) and '0' not in str(R):
print([L,R])
break
a+=1
| true |
0ec2b75805c8a3339ed67908663723c9e7d8696d | BarVolunteering/anyway | /anyway/parsers/rss_sites.py | UTF-8 | 2,035 | 2.59375 | 3 | [
"MIT"
] | permissive | import requests
from bs4 import BeautifulSoup
from anyway.models import NewsFlash
from anyway.parsers import timezones
def parse_walla(rss_soup, html_soup):
description = rss_soup.description.get_text()
author = html_soup.find("div", class_="author").get_text()
# we still need html here since lxml strip... | true |
97f5dd09e58c558b9ea8e5cc9f762d900c5c4a35 | psych-214-fall-2016/diagnostics-01 | /data/data_hashes.py | UTF-8 | 2,000 | 3.328125 | 3 | [] | no_license | """data_hashes.py
A collection of functions manages hases to data download.
See test_* functions in this directory for the nose tests.
"""
from __future__ import print_function, division
import hashlib
import os
import pdb
import json
def generate_file_md5(filename, blocksize=2**20):
"""Generate the md5 hash ... | true |
23866fda8fb16aacd9db56ddc0c0bca24cb6bc15 | LilianYe/boring-things | /pat/a1027.py | UTF-8 | 458 | 3.0625 | 3 | [] | no_license | # a1027
num_list = map(int, raw_input().split())
prst = '#'
def numtostr(num):
if num < 10:
return str(num)
if num == 10:
return 'A'
if num == 11:
return 'B'
if num == 12:
return 'C'
for num in num_list:
if num < 13:
prst = prst + '0'
prst = prst + nu... | true |
49cd64e07bae6aac4c45c9f741b9aef98d880676 | ShiFengZeng/ZeroJudge_py | /d475.py | UTF-8 | 276 | 3 | 3 | [] | no_license | import sys
for line in sys.stdin:
a, n = map(lambda x: int(x), line.split())
if a == n == 0:
count = 0
for line2 in sys.stdin:
count += 1
print('All Over. Exceeded 65536 lines!') # 測資有誤
break
print(int(a ** n)) | true |
6d5abf5048c63c29456a52bcd251f565a78fce4e | jiangyanglinlan/Data-Structures-and-Algorithms | /leetcode/回溯/46_Permutations.py | UTF-8 | 606 | 3.3125 | 3 | [] | no_license | class Solution:
def permute(self, nums):
result = []
if nums is None or len(nums) == 0:
return []
l = []
self.permute_helper(result, l, nums)
return result
def permute_helper(self, result, l, nums):
if len(l) == len(nums):
new_list = l.co... | true |
10741d5e52886ea846d9d1e0f758c869d49006d4 | SonakshiGrover/EN.601.615_DatabasesCourseProject | /SpatialMap.py | UTF-8 | 486 | 2.96875 | 3 | [
"MIT"
] | permissive | # code for building heatmap and scatter plot
import gmplot
import pandas as pd
df = pd.read_csv("heatmapData.csv")
Latitude_newlist = df.Latitude
Longitude_newlist = df.Longitude
gmap = gmplot.GoogleMapPlotter(39.066,-76.622,10)
# heatmap plot
gmap.heatmap(Latitude_newlist , Longitude_newlist)
# scatte... | true |
54ad800ae74521adc29365efbcedf094529ae890 | Zumbalamambo/FaceRecognitionHero | /proof_of_the_concept/game/face_classification.py | UTF-8 | 2,820 | 2.6875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from statistics import mode
import cv2
import numpy as np
from keras.models import load_model
from utils.datasets import get_labels
from utils.inference import apply_offsets
from utils.inference import detect_faces
from utils.inference import load_detection_model
from utils.preprocessor impor... | true |
33b11d230a5d72a1139742c235989f30f254a0c5 | christophkimy/christian_hackerrank | /arithmetic_1.py | UTF-8 | 149 | 3.59375 | 4 | [] | no_license | # https://www.hackerrank.com/challenges/python-arithmetic-operators/problem?isFullScreen=false
a = 3
b = 2
print(a + b)
print(a - b)
print(a * b)
| true |
47b4a6d97eee9f4f10146ce487c084f7b006f1af | jh-lau/leetcode_in_python | /02-算法思想/设计/155.最小栈.py | UTF-8 | 1,114 | 4.3125 | 4 | [] | no_license | """
@Author : liujianhan
@Date : 2020/3/25 上午11:35
@Project : leetcode_in_python
@FileName : 155.最小栈.py
@Description : 设计一个支持 push,pop,top 操作,并能在常数时间内检索到最小元素的栈。
push(x) -- 将元素 x 推入栈中。
pop() -- 删除栈顶的元素。
top() -- 获取栈顶元素。
getMin() -- 检索栈中的最小元素。
"""
# 80ms, 16.5MB
class M... | true |
c67e63a91d40f288a6c0afb3621cd799f0f7454c | Garvys/PingPongSkill | /pingpongskill/pingpongskill.py | UTF-8 | 3,552 | 3.359375 | 3 | [
"MIT"
] | permissive | # -*-: coding utf-8 -*-
""" Skeleton Snips skill. """
import re
import json
import os
import datetime
from text2num import text2num
from collections import defaultdict
FORMAT = '%Y.%m.%dT%H:%M:%S'
class PingPongSkill(object):
""" Skeleton Snips skill. """
def __init__(self):
pass
def handle_lo... | true |
9ab9cd5cc1d7875e939847b57434d8540732d56d | mingfeisun/EngagementRLfD | /scripts/node_strategy.py | UTF-8 | 6,621 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python
import qi
import sys
import numpy
import time
import random
from naoqi import ALProxy
from naoqi import ALModule
from naoqi import ALBroker
from const import INTENSITY_THRESHOLD
SURPRISE = 0
HAPPY = 1
NEUTRAL = 2
SAD = 3
conjunctions = ["Ah", "Oh", "Nice", "Hmm", "Er"]
surprise_word... | true |
94eb1a6313c9acea9e420f7d4585085447ac9cb9 | FabienRoger/Name-Generators | /main.py | UTF-8 | 4,733 | 2.671875 | 3 | [] | no_license | # coding: utf-8
from datacreator import *
from models import *
from namegen import *
dc = DataCreator()
vocab,dic = dc.get_vocab()
vocab_size = len(vocab)
rnn = get_simple_rnn(vocab_size,learning_rate=0.01)
rnn2 = get_rnn(vocab_size,50,learning_rate=0.01)
rnn3 = get_rnn(vocab_size,100,learning_rate=0.01)
lstm = get_l... | true |
991a5b5c3746bb89814a89f7236dbeedb11cd99b | PollyMG/Python-Advanced | /3.Multidimensional Lists/Lab/4.sum_matrix_columns.py | UTF-8 | 478 | 3.515625 | 4 | [] | no_license | rows, columns = [int(x) for x in input().split(', ')]
matrix = []
for row in range(rows):
matrix.append([int(x) for x in input().split()])
# for col in range(columns):
# current_sum = 0
# for row in range(rows):
# current_sum += matrix[row][col]
# print(current_sum)
columns_sum = [0] * columns... | true |
c0bfc649d493f158fe9ef1e60a45fb4f911ec240 | SeniorDerpyDev/AdventOfCode | /2019/python/day4.py | UTF-8 | 798 | 3.359375 | 3 | [] | no_license | def has_two_consecutive(s):
return any(l == r for (l, r) in zip(s[:-1], s[1:]))
def never_decrease(s):
return all(l <= r for (l, r) in zip(s[:-1], s[1:]))
def groups(s):
l = len(s)
i, j = 0, 0
while i < l:
while j < l and s[i] == s[j]:
j += 1
yield s[i:j]
... | true |
476e0f1f4ff6a11c1e8e503266ae8437ee619fc4 | louis-25/FinalProject-raspberry | /getWeather.py | UTF-8 | 583 | 2.6875 | 3 | [] | no_license |
import geolocation as location
import requests, json
def main():
result = location.main()
r1 = result[0]
r2 = result[1]
r3 = result[2]
lat = result[3]
lon = result[4]
#url = requests.get("https://corona-114.kro.kr/speaker/weather?lat=%s&lon=%s" %(lat, lon))
url = "https://corona-114.kro.kr/speaker/getWeathe... | true |
eebd9a09406b2cced158d75b2b0aeff7a1278895 | i-chatterjee/AIMLExperiments | /SimpleNN_DataClassification.py | UTF-8 | 10,027 | 3.71875 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Neural network (with one hidden layer) from scratch ##
# #### Purpose of the neural network : 2 class classification ####
# ### Learning objective: various activation functions, compute cross entropy loss, forward & backward propagation, random initialization ###
# ### Input... | true |
39270a1ba721cd57318e32ffc675a6054bf692d7 | onolunose/Mapping | /volcanomap.py | UTF-8 | 614 | 2.78125 | 3 | [] | no_license | import folium
import pandas
data = pandas.read_csv("volcano.txt")
lat = list(data["LAT"])
lon= list(data["LON"])
elev=list(data["ELEV"])
def icon_colour(elevation):
if elevation <900:
return "red"
elif 900<=elevation<2500:
return "pink"
else:
return "blue"
map =folium.Map(location=[9... | true |
3dd35b44dfe4cce14421401bf9e0ab7628a08d48 | Ryangbowen/Python3 | /018 - d - 0 - b.py | UTF-8 | 318 | 3.5625 | 4 | [] | no_license | def bases(*x):
temp = []
for each in x:
temp.append(each)
print('提取输入:',temp)
temp1 = 0
temp2 = temp.pop()
for other in range(len(temp)):
temp1 += temp[other]
print(temp[other])
print('除去最后一个的和:',temp1)
y = temp1 * temp2
print(y)
| true |
769988c46717e533be6dc1bb0b89f44b615480bb | kienvu58/chord-sequence-modelling | /test/test_get_note_set.py | UTF-8 | 2,845 | 2.546875 | 3 | [] | no_license | from src.preprocess_data import get_note_set
import pytest
@pytest.mark.parametrize("quality,major,form,figbass,changes,expected", [
# augmented sixth
("Ger", True, None, "6", None, [8, 0, 3, 6]),
("It", True, None, "6", None, [8, 0, 6]),
("Fr", True, None, "6", None, [8, 0, 2, 6]),
# dominant mi... | true |
7e6616979e5f156cf62f1de1b7addf43757b136f | OJP98/escalabilidad-w5 | /Escalabilidad.py | UTF-8 | 3,439 | 3.921875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # W5 - Escalabilidad
#
# * Oscar Juárez - 17315
# * Computación paralela y distribuida
# * Fecha: 11/02/2021
#
# Programa interactivo de python que permite analizar si un programa es escalable, tomando en cuenta su Speedup, Eficiencia y un dominio creciente.
# **Funciones úti... | true |
488f412d158d817939bf5ff2128330520d3200b8 | David-Chatelard/ICC-UnB | /Lista 6 icc/Questão_D(2).py | UTF-8 | 387 | 2.90625 | 3 | [] | no_license | N = int(input())
L = input().split()
L1 = L[:]
c = 0
for _ in range(5):
B, D, Q = input().split()
a = L.index(B)
for _ in range(int(Q)):
if D == 'D':
L[a], L[a+1] = L[a+1], L[a]
a += 1
else:
L[a-1], L[a] = L[a], L[a-1]
a -= 1
fo... | true |
a1f1607733726c7dc7dc415d20980a4dc3627f49 | chirateep/algorithm-coursera-course2 | /week3_hash_tables/6_matching_with_mismatches/matching_with_mismatches.py | UTF-8 | 1,731 | 2.96875 | 3 | [] | no_license | # python2
import sys
from collections import namedtuple
m1 = 1000000007
m2 = 1000000009
x = 1121044
Answer = namedtuple('answer_type', 'i j len')
def solve(k, text, pattern):
result = []
for i in range(len(text) - len(pattern) + 1):
s = t[i: i + len(pattern)]
for _ in range(k):
... | true |
836bdd10a0cba205c27a0690148d39c1cbedcf03 | SuzuTakahiro/SampleProject | /Frame/frameSample.py | UTF-8 | 2,426 | 3.5 | 4 | [] | no_license | from tkinter import *
import tkinter.ttk as ttk
class FrameSampleApp(ttk.Frame):
def __init__(self, app):
super().__init__(app)
self.pack()
firstFrame =ttk.Frame(app,width =600,height=300)
firstFrame.pack()
flatframe = ttk.Frame(firstFrame,width =200,height=200,padding=(5... | true |
a8e2c19d0b8283df8c21c60973f8be93d7af520a | Adhunikr13/Python-mini-projects | /Python_ramdom_codes/Q2.py | UTF-8 | 236 | 3.734375 | 4 | [] | no_license | def is_leapyear():
year = int(input("Please Enter the Year Number you wish: "))
if (( year%400 == 0)or (( year%4 == 0 ) and ( year%100 != 0))):
return True
else:
return False
c = is_leapyear()
print(c) | true |
6cb111bd89fb7c4532b9a7747f5abda9c7a24530 | Akshat1276NSP/CBJRWDhome_assignment | /Python revision full course/29.py | UTF-8 | 535 | 3.671875 | 4 | [] | no_license | a = input("ENTER THE PHRASE AND I WILL TELL YOU WHETHER IT IS A SPAM OR NOT: ")
spam1 = "make a lot of money"
spam2 = "buy now"
spam3 = "subscribe this"
spam4 = "click this"
if (a == spam1) or (a == spam1.capitalize()) or (a == spam1.upper()) or (a == spam2) or (a == spam2.capitalize()) or (a == spam2.upper()) or (a... | true |
56d649153c021965530cbed3ebb1605b26347ad6 | todofixthis/data-providers | /data_providers/__init__.py | UTF-8 | 15,450 | 2.828125 | 3 | [
"MIT"
] | permissive | import typing
from abc import ABCMeta, abstractmethod as abstract_method
from collections import defaultdict as default_dict
from data_providers.exceptions import with_context
__all__ = [
'BaseDataProvider',
'DataProvider',
'MutableDataProviderMixin',
]
TKey = typing.TypeVar('TKey', bound=typing.Hashable... | true |
cb03e794e84cd9be7cda1a360e46fc6f787d7913 | ericmjl/nxviz | /examples/circos/edge_color.py | UTF-8 | 894 | 3.375 | 3 | [
"MIT"
] | permissive | """
Shows different edge colors. Either categorial/ordinal or continuous
"""
import matplotlib.pyplot as plt
import networkx as nx
from nxviz.plots import CircosPlot
nodelist = [("a"), ("b"), ("c"), ("d"), ("e"), ("f")]
edgelist1 = [
("a", "b", {"weight": 0.1}),
("a", "c", {"weight": 0.2}),
("b", "d", {"we... | true |
fe9a3a844f04240529797d30ce10bbe60fb5fe44 | yasuharu519/nlp100 | /ch1/09.py | UTF-8 | 484 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import random
STR="I couldn't believe that I could actually understand what I was reading : the phenomenal power of the human mind ."
def shuf(str_):
a = list(str_)
random.shuffle(a)
return "".join(a)
def convert(str_):
return " ".join(
[x if len(x) ... | true |
baacadf918439b55b087df43ffe53c1846651b12 | jdavid54/micropython | /pwm_pin.py | UTF-8 | 241 | 3.328125 | 3 | [] | no_license | import machine
p12 = machine.Pin(12)
# Then create the PWM object using:
pwm12 = machine.PWM(p12)
#You can set the frequency and duty cycle using:
# set values
pwm12.freq(500)
pwm12.duty(512)
pwm12
# get values
pwm12.freq()
pwm12.duty() | true |
c0a87be4369ac3786c000f545f93d15b71c7d205 | HanKin2015/Machine_to_DeepingLearning | /Competition/Kaggle/Titanic/Titanic走过的弯路.py | UTF-8 | 5,724 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 24 20:32:30 2017
@author: HanKin
"""
#导入numpy库和pandas库。
import numpy as np
import pandas as pd
#从sklearn库中导入预处理模块Imputer
#导入自动生成训练集和测试集的模块train_test_split
#导入预测结果评估模块classification_report
from sklearn.preprocessing import Imputer
from sklearn.model_selectio... | true |
5fa2b308490adcc104b8f0c702e3d1e869218e09 | dragen1860/Network2 | /cub.py | UTF-8 | 5,728 | 2.703125 | 3 | [] | no_license | import os
import torch
from torch.utils.data import Dataset
from torchvision.transforms import transforms
import numpy as np
import collections
from PIL import Image
import csv
import random
from scipy import io
from torch.utils.data import DataLoader
class Cub(Dataset):
"""
images.mat['images'][0,0]: 1-11788
imag... | true |
3309f096847b7470b06d5c50e95269a46c983d9e | code-harvey/MicroEarthQuake | /config/config.py | UTF-8 | 1,975 | 2.640625 | 3 | [] | no_license | """
代码功能:
主要方法:RequestDataConfig();EqDetectorConfig();DLTraditionModelConfig();Config()
"""
# 功能: 从配置文件中读取配置信息
class RequestDataConfig(object):
def __init__(self):
self.jopens_host = '10.51.141.18'
self.request_time = 3600 * 1 # 请求数据时间间隔,每隔多久请求一次数据
self.monitor_station_txt = 'conf... | true |
1da1951038203dc10f001f028c960cfd2dae88e5 | lbu0413/python-study | /SWEA-PYTHON-BASIC-1/6253.py | UTF-8 | 252 | 3.328125 | 3 | [] | no_license | # https://www.daleseo.com/python-int-bases/
# 다음의 결과와 같이 10진수를 2진수로 변환하는 프로그램을 작성하십시오.
# 입력
# 9
# 출력
# 1001
n = input()
# print(bin(int(n)).replace("0b", ""))
print(format(int(n), "b"))
| true |
1b31dbba2a4d25adb615e8cd56a63938ff4bbec3 | security-notes/workspace | /2020/WaniCTF/Find_a_Number/solver.py | UTF-8 | 351 | 2.59375 | 3 | [] | no_license | from pwn import *
conn = remote('number.wanictf.org',60000)
n_min, n_max = 0, 500000
while True:
conn.recvuntil('input:')
mid = (n_min + n_max) // 2
conn.sendline(str(mid))
msg = str(conn.recvlines(2))
if 'small' in msg:
n_min = mid
elif 'big' in msg:
n_max = mid
else:
... | true |
521e2036e1503634eba8c7b6888d0e499675cd42 | dgrashof/Snippets | /ml_feature_selection.py | UTF-8 | 1,662 | 2.78125 | 3 | [] | no_license | def feature_selection(xtrain,ytrain,xtest,ytest):
from xgboost import XGBClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.feature_selection import SelectFromModel
import pandas as pd
init_model = XGBClassifier(random_state = 42)
init_model.fit(xtrain,ytrain)
# make predictions f... | true |
4ffc17ddab7f52fecb4b14e100b87ec12cd02e36 | swapnil96/Online-Judge-Contest | /CF_Div356/b.py | UTF-8 | 706 | 3.109375 | 3 | [] | no_license |
a = map(int, raw_input().split())
b = map(int, raw_input().split())
temp1 = b[:(a[1] - 1)]
temp2 = b[a[1]:]
len1 = len(temp1)
len2 = len(temp2)
#print temp1, temp2, len1
if b[a[1] - 1] == 0:
count = 0
else:
count = 1
if len1 > len2:
temp1.reverse()
#print temp2
for i in xrange(len2):
if temp2[i] == 1 and te... | true |
52f2785d0e7a27b3c1a23944802b3644f41505c8 | ankiphr09/Coding | /Data_Structure/Array/Arrangement Rearrangement/Rearrange positive and negative numbers with constant extra space.py | UTF-8 | 4,354 | 4.3125 | 4 | [] | no_license | # # A simple solution is to use another array. We copy all elements of original array to new array. We then traverse the new array and copy all negative and positive elements back in original array one by one. This approach is discussed here. The problem with this approach is that it uses auxiliary array and we’re not ... | true |
abd7c78726369b055e4448d54e19321f4a39c818 | cimarieta/war-tlfw-simulation | /utils/selmig.py | UTF-8 | 2,240 | 2.90625 | 3 | [] | no_license | # coding: utf-8
import numpy as np
import eigenvalue as eg
import numpy.linalg as LA
from itertools import chain, izip
from fitness import *
from math import factorial
def comb(n, k):
if n < k:
return 0.
return float(factorial(n))/(factorial(k)*factorial(n-k))
def winning_prob(alpha, k, n):
"""
... | true |
2721a588ea489315d72db44300a7b18fba1882f2 | zuizeze/datahub | /metadata-ingestion/src/datahub/utilities/sql_formatter.py | UTF-8 | 331 | 2.65625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause",
"MIT"
] | permissive | import logging
from typing import Any
import sqlparse
logger = logging.getLogger(__name__)
def format_sql_query(query: str, **options: Any) -> str:
try:
return sqlparse.format(query, **options)
except Exception as e:
logger.debug(f"Exception:{e} while formatting query '{query}'.")
re... | true |
417911e2f9f41304547426df7d34d05dd3534ed4 | EugeneStill/PythonSeleniumFundamentals | /loggingDemo/LoggingFormat.py | UTF-8 | 636 | 3.203125 | 3 | [] | no_license | """
Logging Format
https://docs.python.org/3/library/logging.html#logrecord-attributes
https://docs.python.org/3/library/time.html#time.strftime
"""
import logging
#asctime adds date/time to the log
#datefmt lets us specify how we want the date formatted
#%I is for 12 hour clock, %H would be for 24 hour clock
#%p is A... | true |
7c9941631490967f7e83bef6eb8025e1e91b5645 | smohamed7/pythonbasics | /variables.py | UTF-8 | 175 | 3.59375 | 4 | [] | no_license | #variable is a named storage location
#creating a variable to store my name
myName="suleiman"
print(myName)
#crearing a variable to hold a random numer
myAge=20
print(myAge) | true |
a0ce0c74bc1a43e5ac224628592428c8093ff0d2 | madanaman/smartcalculator | /Problems/Oral exam/task.py | UTF-8 | 668 | 3.234375 | 3 | [] | no_license | from collections import deque
no_of_recs = int(input())
commands_queue = deque()
students_queue = deque()
for i in range(0, no_of_recs):
command = input()
if command.startswith("READY"):
students_queue.appendleft(command.split(" ")[1])
elif command.startswith("EXTRA") or command.startswith("PASSED"... | true |
eb36c1490b2277fadba9857d10691ccaa3a3d056 | amrithamat/python | /pythonprogrms/flow controls/looping satements/for/basic.py | UTF-8 | 72 | 3.296875 | 3 | [] | no_license | for i in range(0,11):
print(i)
for j in range(0,11,2):
print(j) | true |
f4125447c18f7f5979bb27f21a21408a3978f92d | arodriguezhidalgo/ML_utils | /Classifiers.py | UTF-8 | 5,239 | 2.6875 | 3 | [] | no_license | def classifiers(classifier_name, seed, n_iter_search):
import random
from sklearn.multiclass import OneVsRestClassifier
random.seed(seed)
if classifier_name == 'knn':
from sklearn.neighbors import KNeighborsClassifier
clf = KNeighborsClassifier();
param_dist = {
'n_... | true |
60d184167c97db1cf6171ce42e58fea468d60013 | EmadGhazal/py-numerics | /lorenz.py | UTF-8 | 2,604 | 2.75 | 3 | [] | no_license | import numpy as np
import numpy.linalg as LA
from math import *
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from mpl_toolkits.mplot3d import Axes3D
from mfourrk import mfourrk as solve
def sim(t, w1, w2):
x1 = w1[:, 0]
y1 = w1[:, 1]
z1 = w1[:, 2]
... | true |
a8dcf97d1fc240be9cf7dad72e4c4618cfe87063 | GregSzopinski/nn-from-scratch | /nn/optimizers.py | UTF-8 | 852 | 3.5 | 4 | [] | no_license | class Optimizer(object):
"""
Base class for a neural network optimizer.
"""
def __init__(self, lr: float = 0.01):
"""
Every optimizer must have an initial learning rate.
"""
self.lr = lr
def step(self) -> None:
"""
Every optimizer must implement the ... | true |
3cbad58b0c986285e75c64389ee5855466f50d19 | jfly/jfly.github.io | /misc/ipp-passport/piece.py | UTF-8 | 1,163 | 2.875 | 3 | [] | no_license | from memoize import memoize
from pixel_thing import PixelThing
class Piece(PixelThing):
all_pieces = tuple()
def __init__(self, pixel_str, char):
super().__init__(pixel_str)
self.char = char
Piece.all_pieces = tuple(Piece.all_pieces + tuple([self]))
def getPrintablePixel(self):
... | true |
91470993c5a140bfb6e63cb6958e0e7c83d49fc0 | south-coast-science/scs_core | /src/scs_core/gas/a4/a4_calibrated_datum_vC.py | UTF-8 | 5,524 | 2.71875 | 3 | [
"MIT"
] | permissive | """
Created on 9 Dec 2020
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
The A4CalibratedDatum is designed to provide a model training data set that encapsulates the calibration of the
electrochemical sensor - cal_x_v is only relevant to sensors with NO2 cross-sensitivity.
"""
from collections import Ord... | true |
ba6278ace031609764632e564431c4d57ecb0e01 | daniloroddrigues/webpyfast | /webpyfast/blogs/tests/test_model_category.py | UTF-8 | 540 | 2.921875 | 3 | [] | no_license | from django.test import TestCase
from webpyfast.blogs.models import Category
class CategoryModelTest(TestCase):
def setUp(self):
self.obj = Category(
title='Título da Categoria',
slug='titulo-da-categoria'
)
self.obj.save()
def test_create(self):
"""De... | true |
13ff0d551e03714e9c8e4e382d9e5f07dd61077d | Tanmai2002/Pycharm-Projects | /Trail/Image Blending.py | UTF-8 | 1,044 | 3.015625 | 3 | [] | no_license | import cv2
import numpy as np
t=6
apple=cv2.imread('apple.jpg')
orange=cv2.imread('orange.jpg')
apple_copy=apple.copy()
orange_copy=orange.copy()
#Gaussian Pyramid
gauA=[apple_copy]
gauO=[orange_copy]
for i in range(t):
apple_copy=cv2.pyrDown(apple_copy)
orange_copy=cv2.pyrDown(orange_copy)
gauA.append(app... | true |
495e13422999e3c7069e0aba167bf76d3c0433bc | dgellerup/laminar | /test/test_iter_flow.py | UTF-8 | 1,508 | 3.171875 | 3 | [
"MIT"
] | permissive | import pytest
import numpy as np
import itertools
from laminar import laminar
def test_iterflow_basic():
"""
Basic tests from the tutorial.
"""
import numpy as np
import pandas as pd
from laminar import laminar
from laminar import laminar_examples as le
result = laminar.iter_flow(le.si... | true |
e765f939251f4288f149ac2e26b351df3e285f6d | TimothySjiang/leetcodepy | /Solution_118.py | UTF-8 | 465 | 2.890625 | 3 | [] | no_license | class Solution:
def generate(self, numRows: int) -> List[List[int]]:
result = []
i = 0
while i < numRows:
buff = []
if i > 0:
buff2 = [0] + result[-1] + [0]
for i in range(len(buff2) - 1):
buff.append(buff2[i] + buff... | true |
220f8a3694f0dde1c55a6c6618e8a92224d7edba | microsoft/iqsharp | /src/Python/qsharp-core/qsharp/projects.py | UTF-8 | 1,328 | 3.140625 | 3 | [
"LicenseRef-scancode-generic-cla",
"GPL-1.0-or-later",
"LLVM-exception",
"MPL-2.0",
"LGPL-2.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LGPL-3.0-only",
"Python-2.0",
"CC-BY-SA-4.0",
"LicenseRef-scancode-python-cwi",
"CC0-1.0",
"ISC",
"LGPL-2.1-or-later",
"Apache-2.0... | permissive | #!/bin/env python
# -*- coding: utf-8 -*-
##
# projects.py: Abstraction to represent the list of projects.
##
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
##
from typing import Iterable, Tuple
## LOGGING ##
import logging
logger = logging.getLogger(__name__)
## CLASSES ##
class Project... | true |
bcfaf694623e13194daf95b238bfccff1a5d47e4 | Nimbelungen/projet1-1157 | /Modelisation/variables.py | UTF-8 | 2,303 | 3.046875 | 3 | [] | no_license | from formulas import *
# -- Barge --
barge_x = 0.5 # [m] Barge length
barge_y = 0.5 # [m] Barge width
barge_z = 0.1 # [m] Barge height
barge_mass = 0.1 # [kg] Barge mass
# -- Grue --
# - First Piece -
grue1_x = 0.15 # [m] Grue First Piece length
grue1_z = 0.05 # [m] Grue First Piece height
grue1_mass = 0.05 #... | true |
f9d2584c2f702b665011798f75383eb369534dbe | djeanne/codewars-by-jo | /python/maxdiflen.py | UTF-8 | 256 | 3.078125 | 3 | [] | no_license | def mxdiflg(a1, a2):
if len(a1) == 0 or len(a2) == 0:
return -1
else:
x = []
for item in a1:
x.append(len(item))
y = []
for item in a2:
y.append(len(item))
z = []
for a in x:
for b in y:
z.append(abs(a - b))
return max(z) | true |
62b9eb7823b54407b52cf6f9b31e6304383985a0 | taekang1618/pythonscheduler | /app.py | UTF-8 | 1,855 | 2.53125 | 3 | [] | no_license | from flask import Flask, render_template,\
request, redirect, url_for, json, jsonify
import datetime
import requests
import logging
import json
from pprint import pprint
from flask import jsonify
from flask import Markup
# Create app
app = Flask(__name__)
@app.route('/getSchedule', methods=['GET'])
def index():
d... | true |
cdc3f0642c9f46d5e4a5711c692b5e5ffedce0e3 | Matthew-Tuazon/Backend-Workout-App-Squad | /testDB.py | UTF-8 | 8,868 | 2.640625 | 3 | [] | no_license | from flask import Flask, request, jsonify, Response
from functools import wraps
import json
from pymongo import MongoClient
from bson import ObjectId
from bson.json_util import loads, dumps
import datetime
import os
import random
app = Flask(__name__)
class JSONEncoder(json.JSONEncoder):
def default(self, o):
... | true |
296983563a97521505b67b83fc35e6613294de43 | Waym1ng/pythonWorkScript | /list_to_tree.py | UTF-8 | 2,393 | 3.9375 | 4 | [] | no_license | '''
列表形式的数据转换成树结构(以parent_id的方式),转换的结果,children字段嵌套的形式,适用于前端树形结构的渲染
'''
def list_to_tree(data):
root = []
node = []
# 初始化数据,获取根节点和其他子节点list
for d in data:
d["choice"] = 0
if d.get("parent_id") == 0:
root.append(d)
else:
node.append(d)
# print("root---... | true |
c9848dde6fb87b58949c94d3cfc2a90e78e4ec53 | kungtesheng/mlgm | /mlgm/algo/maml.py | UTF-8 | 9,487 | 2.625 | 3 | [
"MIT"
] | permissive | """Simple MAML implementation.
Based on algorithm 1 from:
Finn, Chelsea, Pieter Abbeel, and Sergey Levine. "Model-agnostic meta-learning
for fast adaptation of deep networks." Proceedings of the 34th International
Conference on Machine Learning-Volume 70. JMLR. org, 2017.
https://arxiv.org/pdf/1703.03400.pdf
"""
impo... | true |
e80fa2dff643d9222fb54951e516def0b3aece92 | msadour/german_memo | /core/backend/common/exceptions/user.py | UTF-8 | 534 | 2.765625 | 3 | [] | no_license | """User exceptions module."""
class AuthenticationError(Exception):
"""Class AuthenticationError."""
def __init__(self, message):
"""Check email format.
Args:
message:
"""
self.message = message
super().__init__(self.message)
class UpdateError(Exception)... | true |
e6e219b00438ffe3879125b5fe0f0bc47153df66 | okornoe/Hangman | /Topics/String formatting/Tax brackets/main.py | UTF-8 | 432 | 3.8125 | 4 | [] | no_license | income = int(input())
percentage = 0
taxable = 0
if 0 <= income <= 15527:
percentage = 0
taxable = 0
elif 15528 <= income <= 42707:
percentage = 15
taxable = 0.15 * income
elif 42708 <= income <= 132406:
percentage = 25
taxable = 0.25 * income
elif income >= 132407:
percentage = 28
taxa... | true |
cc3ac831959d9e6d85c9c43d6d5ce8e16ba04818 | alex5010/trill | /application/database.py | UTF-8 | 9,768 | 2.515625 | 3 | [] | no_license | from application.models import *
from application import db
from werkzeug.security import generate_password_hash, check_password_hash
from operator import itemgetter
import sys
import datetime
SKILL_TYPE_GDS = 1
SKILL_TYPE_SKILL = 2
SKILL_TYPE_KNOWLEDGE= 3
ONE_SKILL = 1
TWO_SKILLS = 2
THREE_SKILLS = 3
DEFAULT_PROFI... | true |
a41d74f6b3f4240d679b6dea9ae4a805ff1f2410 | SushiPython/dict | /main.py | UTF-8 | 2,680 | 2.59375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
from flask import Flask, redirect, render_template, request
import os
from random_words import RandomWords
from wiktionaryparser import WiktionaryParser
parser = WiktionaryParser()
r = RandomWords()
merriamKey = os.getenv('merriam')
app = Flask(__name__)
@app.route('/'... | true |
3c09cd6d9d320a47170b356088da97794ef7f57c | DaniloMarques1/URI | /1156.py | UTF-8 | 105 | 3.515625 | 4 | [] | no_license | s = 1
denon = 2
for i in range(3, 40, 2):
s = s + i / denon
denon *= 2
print("{:.2f}".format(round(s))) | true |