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 |
|---|---|---|---|---|---|---|---|---|---|---|
7320cdc450ad7f06a07e69497fd4ac9df7ac5a07 | vacancy/Jacinle | /jacinle/io/network.py | UTF-8 | 2,543 | 2.71875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : network.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 01/19/2017
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import os
import os.path as osp
import hashlib
from six.moves import urllib
from .common im... | true |
f1494efd58954c160db005821a8c44130d26e233 | aantti/haystack | /test/test_table_reader.py | UTF-8 | 3,472 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | import pandas as pd
from haystack.schema import Document
from haystack.pipelines.base import Pipeline
def test_table_reader(table_reader):
data = {
"actors": ["brad pitt", "leonardo di caprio", "george clooney"],
"age": ["57", "46", "60"],
"number of movies": ["87", "53", "69"],
"... | true |
98a3ebb413d5adea53ab10d704295f027bbabc41 | ebi-ait/s3-to-webin-utils | /cli.py | UTF-8 | 5,547 | 2.546875 | 3 | [] | no_license | import argparse
from contextlib import closing
from fnmatch import fnmatch
from os import listdir, remove, rename
from os.path import join, exists
import shutil
CHECKSUMS_FILE_NAME = 'checksums.csv'
WEBIN_MANIFEST_FILE_NAME = ''
class UploadUtils:
def __init__(self, secure_key, webin_user, s3_root='/mnt/s3Load/'... | true |
834039f1a8f140b0e32aabcaa0a49833b9680a53 | zhangliang-04/YoungNMT | /ynmt/modules/attentions/multihead_attention.py | UTF-8 | 2,939 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) Jason Young (杨郑鑫).
#
# E-Mail: <AI.Jason.Young@outlook.com>
# 2020-03-31 22:04
#
# This source code is licensed under the Apache-2.0 license found in the
# LICENSE file in the root directory of this source tree.
import math
import torch
class MultiHea... | true |
269d60b23938055c28068da61692c54897d564b6 | stasi009/TestDrivenLearn | /Python/TestPandas2/test_testing.py | UTF-8 | 3,869 | 3.28125 | 3 | [] | no_license |
import unittest
import numpy as np
import numpy.testing as npt
import pandas as pd
import pandas.util.testing as pdt
def ensure_frame_equal(actual_frame,expect_values,expect_columns,expect_index):
npt.assert_allclose(expect_values,actual_frame.values)
npt.assert_array_equal(expect_columns,actual_frame.column... | true |
bf4f512b307eb62b80eb8465b22a7d02e763ceb1 | Cielquan/WTForms-Validators | /tests/conftest.py | UTF-8 | 1,997 | 2.734375 | 3 | [] | no_license | import pytest
@pytest.fixture
def dummy_form():
return DummyForm()
@pytest.fixture
def dummy_field():
return DummyField
@pytest.fixture
def cbx_ticked(dummy_field):
cbx = dummy_field()
cbx.raw_data = ["y"]
cbx.data = True
cbx.label = "Checkbox_true"
return cbx
@pytest.fixture
def cbx... | true |
ea2f34d4a249cef4b1a84ded9421eabf88303d22 | ryannjohnson/scripts | /caldav/upsert_todos.py | UTF-8 | 2,318 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Adds tasks to a CalDAV todo list if they don't already exist.
```bash
$ export $(cat .env | xargs)
$ python3 upsert_todos.py "Wash dishes" "Do laundry"
```
"""
import caldav
from datetime import datetime, timedelta
import icalendar
import os
import platform
import random
import sys
from ty... | true |
f10d4e1e4ab32b3c5a3c07b65234301ab4f6ec7d | sarte3/pj5 | /tips2.py | UTF-8 | 618 | 2.984375 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# 한글처리
from matplotlib import font_manager, rc
fontname = font_manager.FontProperties(fname='malgun.ttf').get_name()
rc('font', family=fontname)
# 과제
# 1. 팁의 히스토그램과 상자그림을 하나의 화면에 나타내세요
tips = sns.load_dataset('tips')
fig = plt.figure(figsize=... | true |
e08a4d016ffbdf5ee792935d7cf7d8d26257a79f | wuchengyangcn/influence-maximization | /python/5.py | UTF-8 | 5,233 | 2.703125 | 3 | [] | no_license | import networkx as nx
import random
import time
import numpy as np
try:import Queue as q
except:import queue as q
class data:
graph=nx.DiGraph();
def __init__(self,file):
self.name=file;
infile=open(self.name+'.txt');
buffer=infile.readline();
if (buffer.find('Directed')==2):flag... | true |
a57e432737e4d3a56f48436a3cd2382a5a62b26f | d1sd41n/holbertonschool-machine_learning | /unsupervised_learning/0x01-clustering/3-optimum.py | UTF-8 | 1,247 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
"""[summary]
Returns:
[type]: [description]
"""
import numpy as np
kmeans = __import__('1-kmeans').kmeans
variance = __import__('2-variance').variance
def optimum_k(X, kmin=1, kmax=None, iterations=1000):
"""[summary]
Args:
X ([type]): [description]
kmin (int, opti... | true |
1990fd99a103d4721906d58a44edbc990f876666 | Meenu-ravi/Hacker_rank_Strings | /Make_it_anagram | UTF-8 | 331 | 3.1875 | 3 | [] | no_license | #!/bin/python
import sys
from collections import Counter
acount = Counter(raw_input().strip())
bcount = Counter(raw_input().strip())
print sum((acount - bcount).values() + (bcount - acount).values())
##Another code
counts = Counter(raw_input().strip())
counts.subtract(raw_input().strip())
print sum(map(abs, counts.v... | true |
570a9e7b385d91923c0e56975b70c3bbcab9224d | Mamonbo/math-puzzle | /Chap-1/Mat_Frank.py | UTF-8 | 529 | 3.171875 | 3 | [] | no_license | #coding=UTF-8
# Matthew Frank の漸化式
# gcdが1または素数になることが証明されている
import fractions
TRIAL=100
Ainit=7
for idx in range(1,TRIAL):
if idx==1:
a=Ainit
print('a(1) = {}'.format(a))
else:
tmp_gcd=fractions.gcd(idx,a_prev)
a=a_prev+tmp_gcd
printmoji='a({0}) = {1} + gcd({gcd_a},{... | true |
060c9943ea063660025be09c86dd7baf32f62181 | cheapjack/RF-Craft | /HelloCanary.py | UTF-8 | 2,738 | 2.640625 | 3 | [
"MIT",
"WTFPL"
] | permissive | #!/usr/bin/python
# Send messages to a CanaryMod server with RasperryJuice1.3 plugin
from mcpi import minecraft
from mcpi import block
from time import sleep
import serial
#mc = minecraft.Minecraft.create("127.0.0.1")
#mc = minecraft.Minecraft.create(server.address)
mc = minecraft.Minecraft.create()
# By default the... | true |
0cab1c1ec2054b41ce4f1d47d6052031e632ae00 | Huijuan2015/leetcode_Python_2019 | /97. Interleaving String.py | UTF-8 | 1,015 | 3.125 | 3 | [] | no_license | class Solution(object):
def isInterleave(self, s1, s2, s3):
"""
:type s1: str
:type s2: str
:type s3: str
:rtype: bool
"""
#dp[i][j] : 0~i, 0~j 可以组成k: i+j+1
# k-1: i+j
# dp[i-1][j] and s1[i-1] == s3[i+j]
# or dp[i][j-1] and s2[j-1] == s... | true |
85bab08c301550d56b9d0a78ed363b0907820449 | jlmedina123/codingforfun | /dynamic/longestcommonsubseq.py | UTF-8 | 776 | 3.828125 | 4 | [] | no_license | '''
https://www.techiedelight.com/longest-common-subsequence/
longest subsequence that is common in two sequences
The longest common subsequence (LCS) is the problem of finding the longest subsequence that is present in given two sequences in the same order. i.e. find a longest sequence which can be obtained from the... | true |
9431a2d5ad9d7747a959b7c58eb3b1d466e9c074 | calebeof/TecnicasEstruturasAvancadas | /material/códigos/bfsGrafos.py | UTF-8 | 668 | 2.578125 | 3 | [] | no_license | grafo = [[0, 0, 1, 0, 1, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 1, 0, 1],
[0, 1, 0, 0, 1, 0, 0, 1],
[1, 0, 1, 0, 1, 0, 0, 0],
[0, 0, 0, 1, 0, 1, 0, 0]]
vertices = 8
origem = 5
destino = 6
mar... | true |
73c072190902288df91dd200ae2de8bec26094d7 | wenchma14/python-ex | /array/ex19.py | UTF-8 | 142 | 2.78125 | 3 | [] | no_license | from array import array
a = array("I", (12,25))
print("Array buffer start address in memory and number of elements.")
print(a.buffer_info())
| true |
59991b193a7aaffe7e0ca7c41c460d1252c5beb4 | ar929ra/mlroots | /mlroots/utils/utils.py | UTF-8 | 1,610 | 2.890625 | 3 | [
"MIT"
] | permissive | # This file implements utility functions used across all the other
# modules
#
# Part of mlroots, a project to implement well-known machine learning
# algorithms from scratch
#
# Originally authored by Adams Rosales <adamisto92@gmail.com>
#
# Licensed under MIT License (see LICENSE.txt for details)
import numpy as np... | true |
0e91727759da5065343a0f3704c0f84b4a5e65f6 | GitOfCharlie/Python_MachineLearning | /Test/NumpyTest.py | UTF-8 | 2,623 | 3.734375 | 4 | [] | no_license | import numpy as np
# 2-2ndarray简介
lst = [[1, 2, 3], [4, 5, 6]]
# 创建ndarray对象
np_list = np.array(lst)
print(type(np_list)) # <class 'numpy.ndarray'>
# 定义类型
np_list = np.array(lst, dtype=np.uint)
# 属性
print(np_list.shape) # (2,3) 2行3列
print(np_list.ndim) # 维数,2
print(np_list.dtype) # 类型
print(np_list.itemsize) #... | true |
442a9d574985d18c1e967a264225097992775e60 | MihaelaPapa/LearnPythonTheHardWay | /ex12.py | UTF-8 | 242 | 4.21875 | 4 | [] | no_license | # Learn Python 3 the Hard Way
# Exercise 12
#print("Hello!")
age = input("How old are you? ")
height = input("How tall are you? ")
weight = input("How much do you weight? ")
print(f"So you are {age} old, {height} tall and {weight} heavy.")
| true |
5036f2780c34b44ac31090bf78f4eb0cae358a3b | mccallkaley/Week3_day1hw | /Regex_project.py | UTF-8 | 869 | 3.578125 | 4 | [] | no_license | """
Expected Output
Abraham Lincoln
Andrew P Garfield
Connor Milliken
Jordan Alexander Williams
None
None
"""
# ([A-Z][a-z]+) 1st capuring group Capital char followed by lower
# + matches the previous token between one and unlimited times, as many times as possible, giving back as needed (greedy
# ([A-Z][a-z]*) 2nd... | true |
0fe5e576e1226c4fa4ae7fa0acf75de7903d0275 | kahartma/eeggan | /eeggan/data/preprocess/util.py | UTF-8 | 666 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | # Author: Kay Hartmann <kg.hartma@gmail.com>
import numpy as np
from eeggan.data.dataset import Data
from eeggan.data.preprocess.normalize import normalize_data
def create_onehot_vector(targets, n_classes) -> np.ndarray:
targets_onehot = np.zeros((targets.shape[0], n_classes))
for c in range(n_classes):
... | true |
15135f6b0e004ea2a0fb2b28df999d67c4dff647 | bimri/programming_python | /chapter_6/biggest.py | UTF-8 | 670 | 3.609375 | 4 | [
"MIT"
] | permissive | "A Quick Game of “Find the Biggest Python File”"
'''
Quick: what’s the biggest Python source file on your computer? This was the query
innocently posed by a student in one of my Python classes. Because I didn’t know either,
it became an official exercise in subsequent classes, and it provides a good example of
ways to ... | true |
c957b0d71dbda1225a470b115d409e1c46f24b68 | shamine07/FST-M1 | /Python/Activities/Activity9.py | UTF-8 | 254 | 3.640625 | 4 | [] | no_license | list1 = [2,1,1,3,2] #1,1
list2 = [1,2,1,2,14] #2,2
final_list = []
for i in list1:
if i%2 != 0:
final_list.append(i)
for i in list2:
if i%2 == 0:
final_list.append(i)
print("Final list is: " + str(final_list)) | true |
1ab0cd99ed93a8aa4a6789c0b63f670bb39718da | bwdvolde/advent-of-code-2019 | /day07/intcode.py | UTF-8 | 1,999 | 3.140625 | 3 | [] | no_license | OPCODE_ADDITION = 1
OPCODE_MULTIPLICATION = 2
OPCODE_INPUT = 3
OPCODE_OUTPUT = 4
OPCODE_JUMP_IF_TRUE = 5
OPCODE_JUMP_IF_FALSE = 6
OPCODE_LESS_THAN = 7
OPCODE_EQUALS = 8
OPCODE_STOP = 99
def run(program):
program = program[:]
ip = 0
while program[ip] != OPCODE_STOP:
opcode = program[ip]
ins... | true |
2e3c834f4d00e1ea8424f9b120ee00c925526a49 | HomeBrain-ARG/DeepReinforcementLearningProjects | /p3_collab-compet/env.py | UTF-8 | 1,606 | 2.84375 | 3 | [] | no_license | """ environment """
import numpy as np
from unityagents import UnityEnvironment
class Env(object):
""" tennis environment from unity """
def __init__(self,no_graphic=True, train_mode=True, seed=2):
""" init memeber variables """
self.env = UnityEnvironment(file_name='Tennis_Linux/Tennis.x86... | true |
4d157408f698c47820534a17cf0612c417307a4e | mdorner/autotablet | /monitor_accel.py | UTF-8 | 3,575 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
"""
Copyright (C) 2015 Michael G. Dorner
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
This program is... | true |
11030ed4cc4ab678613c0bec3212afa9f1c151a0 | i-cluster/Study | /0322_N-Queen.py | UTF-8 | 722 | 2.796875 | 3 | [] | no_license | # SWEA 2806
# https://bit.ly/391iMSa
def location(k, s, d, loc):
global cnt
if not k: cnt += 1
else:
i, j = loc[0], loc[1]
while i < n:
while j < n:
if not xy[0][i] and not xy[1][j] and i + j not in s and i - j not in d:
xy[0][i], xy[1][j] = 1... | true |
3261ae17473bb35d4a6850a262b687809ef23c8b | vkelk/PatentsView-DB | /Scripts/XMLParsers/db_pgsql.py | UTF-8 | 9,728 | 2.5625 | 3 | [] | no_license | import logging
import sys
import time
import psycopg2
import psycopg2.extras
from psycopg2.extensions import AsIs
from psycopg2.extras import execute_values
import settings
class db_connection(object):
"""
Main class for db connection
"""
def file_check(self, file):
zip_filename = file['url'... | true |
dd8971621fd9d48ad4a8633a7947713574649f14 | JohnPaton/engl_ish | /engl_ish.py | UTF-8 | 21,610 | 3.390625 | 3 | [] | no_license | #from nltk import sent_tokenize, word_tokenize
import numpy as np
from matplotlib import pyplot as plt
from copy import deepcopy
import pandas as pd
import random
#import newspaper
import pickle
import os
import seaborn as sns
class Distribution():
'''
A discrete distribution of states. Two distributions are a... | true |
e1c69fd3dba839bdaeabcffb7ecab2d191162951 | trivedipratul/BFS-2 | /PA_61.py | UTF-8 | 1,279 | 3.328125 | 3 | [] | no_license | #LC 994 - Rotting Oranges
#Time Complexity - O(m*n)
#Space Complexity - O(m*n)
from collections import deque
class Solution(object):
def orangesRotting(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
def isValid(x,y):
return x >=0 and y >= ... | true |
c4cb9a64a81a369336cede85fe7173c49d53d0b6 | vpnagraj/numerator | /lambda_function.py | UTF-8 | 4,498 | 3.140625 | 3 | [] | no_license | """
this skill queries the numbers api for a fact about a given number
http://numbersapi.com/
"""
import json
import urllib2
# --------------- Helpers that build all of the responses ----------------------
def build_speechlet_response(title, output, reprompt_text, should_end_session):
return {
'outputSpee... | true |
7c8ff12e75acbf2bde534b1f4e2e313d56465509 | jessiechouuu/Human-Pose-Estimation-Using-FCN | /lsp_scripts/croptest.py | UTF-8 | 2,823 | 2.515625 | 3 | [] | no_license | import numpy as np
import cv2
#_/_/_/ xs: read image & joint _/_/_/
img = cv2.imread('data/LSP/images/im00489.jpg')
line = 'im00489.jpg,0.0,-24.0428222474,0.0,-24.0428222474,0.0,-24.0428222474,142.208841219,151.1135902,119.14554136,181.864656679,120.807761169,223.598246901,0.0,-24.0428222474,0.0,-24.0428222474,0.0,... | true |
1451a38e5dfd43d647e0beb4114d2dd66ab740d6 | zizu1985/100daysOfCoding_Python | /day3/practice_2_3.py | UTF-8 | 359 | 3.71875 | 4 | [] | no_license | import sys
a = int(input("Please take value for a "))
b = int(input("Please take value for b "))
c = int(input("Please take value for c "))
msg = "It is a perfect triangle"
if (c ** 2) != ((a ** 2) + (b ** 2)):
print("This is not a triangle")
sys.exit(1)
if a % 3 != 0 or b % 4 != 0 or c % 5 != 0:
msg = "... | true |
971eac24ceeb9fbc08a8cb69bf5322018f920ae4 | IkuyaYamada/atcoder | /practice/ABC049C_Daydream.py | UTF-8 | 1,139 | 3.671875 | 4 | [] | no_license | #ABC049C_Daydream.py
s = input()
d, d_er, e, e_er = ("dream", "dreamer", "erase", "eraser")
def daydream(string):
while len(string) > 7:
if string[:6] == e_er and (string[6] != "a" or string[6:] == ""):
if string[6:] == "":
return("YES")
else:
string = string[6:]
elif string[:7] == d_er and (st... | true |
282be57e6dfcdf8b8f2b323770da20e184a9b27f | wildparky/meta-api | /meta.py | UTF-8 | 1,579 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
MIN_HITS = 2
MIN_BASES = 4
BASES = ['A', 'C', 'G', 'T']
# returns the amount of hits in a given string
def hitscount(line: str) -> int:
count = 0
for base in BASES:
count += line.count(base*MIN_BASES)
return count
# receives a... | true |
89865e02d67a889c8bb0197018429609154987ed | marcotini/plantgateway | /plantgw/__init__.py | UTF-8 | 4,427 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | ##############################################
#
# This is open source software licensed under the Apache License 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
##############################################
import paho.mqtt.client as mqtt
from plantgw.sensor import Sensor
import os
import yaml
import logging
impo... | true |
05574c6b1664612b98c536b18646bca42fc597b6 | DKU-STUDY/Algorithm | /LeetCode/Greedy/Group_the_People_Given_the_Group_Size_They_Belong_To/sangmandu.py | UTF-8 | 773 | 3.875 | 4 | [] | no_license | '''
https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to/
Group the People Given the Group Size They Belong To
dictionary 사용
'''
class Solution(object):
def groupThePeople(self, groupSizes):
dic = {}
for idx, val in enumerate(groupSizes):
dic.setdefault(val,... | true |
b66283416a6f8bbca759bf0b75cbea077201fd7d | utterworks/fast-bert | /container/bert/download_pretrained_models.py | UTF-8 | 1,411 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | import argparse
from pathlib import Path
from tqdm import tqdm
import requests
import urllib3
from transformers import AutoModel, AutoTokenizer
def download_pretrained_files(model_name, location):
try:
model_path = model_name.replace("/", ":")
model = AutoModel.from_pretrained(model_name)
... | true |
8161f4f8edde7afa73319cafa43bbebaf82c4a84 | Dawson557/Glass_Moldcode_Recognition | /utils/pull_labels.py | UTF-8 | 794 | 2.578125 | 3 | [] | no_license | import os
folder_name = r'C:\Users\admin\Desktop\Moldcode_Network\Bottle_Dataset\rotated_test'
with os.scandir(folder_name) as folder:
for file in folder:
if (file.name.endswith('.bmp')):
filepath = folder_name + os.sep + file.name[:-4] + ".txt"
label = ''
if os.path.exists(filepath):
with open(filepa... | true |
7098a157cacc9ab80179fb0d7b9bcf9a2e509df8 | itsolutionscorp/AutoStyle-Clustering | /all_data/exercism_data/python/simple-cipher/92dd905377504d04a84bf3a95be103b8.py | UTF-8 | 1,294 | 3.328125 | 3 | [] | no_license | from random import SystemRandom
class Cipher:
ALPHABETS = 'abcdefghijklmnopqrstuvwxyz'
def __init__(self, key=None):
def random_key(length=100):
rand = SystemRandom()
return ''.join([rand.choice(self.ALPHABETS) for i in range(length)])
if key is None:
self.k... | true |
e53dc69e8586608fe9cc7d1e60b2644716a3bb12 | anoadragon453/matrix-cribbage | /storage.py | UTF-8 | 2,919 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | import sqlite3
import os.path
latest_db_version = 0
class Storage(object):
def __init__(self, db_path):
"""Setup the database
Runs an initial setup or migrations depending on whether a database file has already
been created
Args:
db_path (str): The name of the databa... | true |
16de7b5dacb1b7e92bbd97cb5711d5ed79b3abeb | gullabi/long-audio-aligner | /utils/check_ts.py | UTF-8 | 2,603 | 2.546875 | 3 | [] | no_license | import json
import os
import subprocess
from math import floor
def segment_cue(audio, cue, audio_tool='ffmpeg'):
seek = floor(cue['start'])
start = cue['start'] - seek
end = cue['end']
duration = end - cue['start']
basename = '.'.join(os.path.basename(audio).split('.')[:-1])
... | true |
31d20cb939ecb038860badd77e18672d7bb3bcaf | myselfmjs/python | /python/bdbk/crawler_main.py | UTF-8 | 1,774 | 2.828125 | 3 | [] | no_license | # coding:utf-8
from python.bdbk import html_outputer, html_parser, html_downloader, url_manager
# import url_manager, html_downloader, html_parser, html_outputer
print("爬虫百度百科调度入口")
# 创建爬虫类
class SpiderMain(object):
# 初始化 url管理器 html下载器 解析器 输出器
def __init__(self):
self.urls = url_manager.UrlManager(... | true |
53fedb59e5e6265e4869d6a9b4b510d2fd0d6db1 | RAMIVAR/Grupo32 | /area y perimetro.py | UTF-8 | 261 | 3.90625 | 4 | [] | no_license | #area y perimetro de un cuadrado
def area_perimetro (lado):
area = lado * lado
perimetro = lado * 4
print("el area del cuadrado es: ",area)
print("el perimetro del cuadrado es: ",perimetro)
area_perimetro(lado = int(input ("ingrese medida: ")))
| true |
2d6a756f2e8f90b409a76164406efc833a2a43c3 | Cheereus/PythonMemory | /LaoJiu/20200713.py | UTF-8 | 700 | 4.03125 | 4 | [] | no_license | '''
@Description:
@Author: 陈十一
@Date: 2020-07-10 09:54:42
@LastEditTime: 2020-07-13 10:32:20
@LastEditors: 陈十一
'''
print("请输入1-26之间的数字:")
# 生成所有大写字母
characters = [chr(i) for i in range(65,91)]
# 储存输入
number = int(input())
# 储存输入
output = ''
# 长度为1的时候特殊处理一下
if number == 1:
print("A")
elif number > 1 and number ... | true |
a51f267080911706cb8c8158e50a673fa798938d | Infinidat/infi.logging | /src/infi/logging/slow_greenlets.py | UTF-8 | 1,874 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Slow greenlet logging utility
"""
import gevent
import greenlet
from functools import partial
from .globals import get_time, get_logger
_slow_greenlet_max_duration = 1.0
_last_switch_time = None
def _switch_time_tracer(logger, event, args):
if event not in ('switch', 'throw'):
# from greenlet docs: ... | true |
0142f8fc4d33354cac3147b58bb50ce5121640b0 | Edjchg/Some-useful-numerical-methods | /15DiferenciasDivididas/diferenciasDivididas.py | UTF-8 | 991 | 3.171875 | 3 | [] | no_license | import numpy as np
import sympy as sy
from sympy import symbols
def diferenciasDivididas(vectorX,vectorY):
contador = 0
n = len(vectorX)
vectorDiferencias = difAux(vectorX,vectorY)
resultado = 0
while contador != n-1:
resultado += vectorDiferencias[contador]*multiplicacio... | true |
09cbd2e1b49695ef02daaacf458f5793a8298451 | alentoghostflame/StupidAlentoBot | /alento_bot/storage_module/storage_manager.py | UTF-8 | 1,407 | 2.65625 | 3 | [
"MIT"
] | permissive | from alento_bot.storage_module.managers import ConfigManager, CacheManager, GuildManager, UserManager
from alento_bot.storage_module.formats import ConfigData
from pathlib import Path
import logging
logger = logging.getLogger("main_bot")
class StorageManager:
def __init__(self):
self._loaded: bool = Fal... | true |
95ac2db1ff93af1080fc758597f8b6b2ce59a603 | hahnchuljung/Python_Basic4beginners | /C.Various_File_Format_Read_Write/C03a.NetCDF_file_header_info.py3.py | UTF-8 | 1,255 | 2.90625 | 3 | [] | no_license | """
Print header information of NetCDF file
Both NetCDF3 and NetCDF4 formats are supported.
"""
import sys
import numpy as np
import os.path
from subprocess import call
from netCDF4 import Dataset
def open_netcdf(fname):
if not os.path.isfile(fname):
print("File does not exist:"+fname)
sys.exi... | true |
b50a54ee4714236979127da3eccf77f63cdc14a6 | ThibaultLanthiez/streamlit_app_soyhuce | /myapp.py | UTF-8 | 1,056 | 2.703125 | 3 | [] | no_license | import streamlit as st
from PIL import Image
import pandas as pd
from tensorflow.keras.models import load_model
import numpy as np
st.write("""
# Web application : humpback whale identification
""")
# Chargement de l'image
uploaded_file = st.file_uploader("Upload a file",type=['jpg','png','jpeg'])
if u... | true |
898622c90c255e58b563eec8f73f75b2225470f8 | souravs17031999/100dayscodingchallenge | /arrays/sum_n_divisible.py | UTF-8 | 1,079 | 4.34375 | 4 | [] | no_license | # Program for finding sum of n digit numbers divisible by p
# logic is to firstly find out the first and last number of that required range, like for 1 digit - it's 1 to 10, then for two digit, it's 10 to 100 , similary 100-to 1000 for three digit numbers.
# Then the second thing is that can find out the first number ... | true |
89bbba350ab42dca6676a3da3123316d4bab1645 | vplisboa/calculoNumerico | /Metodos/MetodoGradienteDescendente.py | UTF-8 | 7,319 | 3.28125 | 3 | [] | no_license | from tkinter import *
from decimal import *
from sympy import *
from time import *
#caso de teste x**4 − 3*x**3 + 2 ; gama = 0.01 ; precisao = 0.00001 ; v0 = 6
#TODO verificar o que acontece quando o gama muda e quando a precisão muda.
#TODO acertar o sobre, nome da função e ajuda.
class MenuMetodoGradienteDescendent... | true |
71847c95194213fb65b851652befafd8515a6016 | R1tom/HotelManagement | /hotelex.py | UTF-8 | 15,947 | 3.078125 | 3 | [] | no_license | import random
class hotel:
def rooms(s):
global count,ac_room,non_ac_room,avail_room
print(" ________ _______ ________ ____ __ ")
print("|| ||| ||| ||| | ||||||||| ||||")
print("|| ||||| ||| ||||| ||| ||||| ||| || |||||||... | true |
a266c4004e2dd93d578a55afbd0a386226865e75 | kotaroooo0/casper-voting | /py/weighted_voting.py | UTF-8 | 1,819 | 3.03125 | 3 | [] | no_license | # 重み付き投票のシュミレーション
import random
%matplotlib inline
import matplotlib.pyplot as plt
# パラメータ
alpha = 0.5
delta = 0.001
la = 12
lr = 0.01
q = 2 / 3
m = 10
# return: 攻撃されていないvalidatorの重み / 全てのvalidatorの重み
def weighted_approval_votes(validators):
non_attacked_validator_weight = 0
all_validator_weight = 0
for ... | true |
3b97fdf18d00b447c43d54cd0318581efdf37485 | zhaoxuyan/LeetCode_Python | /014_Longest_Common_Prefix.py | UTF-8 | 976 | 3.984375 | 4 | [] | no_license | # Example 1:
# Input: ["flower","flow","flight"]
# Output: "fl"
# Example 2:
# Input: ["dog","racecar","car"]
# Output: ""
# Explanation: There is no common prefix among the input strings.
class Solution:
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""... | true |
2604eb28b6cb90482241b4751cab70f366f45a24 | Chunar5354/Monitor_pi | /motor_pi/server/into_db.py | UTF-8 | 1,177 | 2.875 | 3 | [] | no_license | import pymysql
from sql_helper import Helper
class Motor():
def __init__(self):
# instance into_db object
self.db = Helper(host='',
user='Chunar',
password='chun.0927',
database='raspberrypi',
port=... | true |
2e0eccd2ca7a0ea7fc05dde28d4f5762ccfa95d8 | silnrsi/pysilfont | /examples/chaindemo.py | UTF-8 | 1,983 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
''' Demo of how to chain calls to multiple scripts together.
Running
python chaindemo.py infont outfont --featfile feat.csv --uidsfile uids.csv
will run execute() against psfnormalize, psfsetassocfeat and psfsetassocuids passing the font, parameters
and logger objects from one call to the next.... | true |
ac8457340d5078b85fb246d88e15f9cbd6fa50d1 | elthran/UDK | /app/helpers/metadata.py | UTF-8 | 3,589 | 3.078125 | 3 | [] | no_license | class Buildings:
Human = {
"House": {"Singular": "Homestead",
"Plural": "Homesteads",
"Gold": 65,
"Wood": 20,
"Stone": 0,
"Output": 5,
"Description": "Each percent of land increases your birth rate by... | true |
66aa227c8ade4aa7bd6563a3eb476311b2a4d237 | vodanhbk95/Age-Gender-Classification | /process_imdb-wiki/train_test_split.py | UTF-8 | 375 | 2.796875 | 3 | [] | no_license | # Importing dependencies
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
# Loading the data
data = pd.read_csv('data_afad.csv')
# data_filtered = data[data['age'] != -1]
train, test = train_test_split(data, test_size = 0.3, random_state=0)
train.to_csv('train_afad.csv', i... | true |
a4ca401fbc8409f4b209ff6c525ff159b71dd000 | JerryBian/mfe | /src/package/sqlpackageparser.py | UTF-8 | 3,836 | 2.71875 | 3 | [
"MIT"
] | permissive | import os
import datetime
import xml.etree.ElementTree as ET
from package.sqlpackage import SqlPackage
from package.sqlpackagesetting import SqlPackageSetting
class SqlPackageParserException(Exception):
pass
class SqlPackageParser(object):
@staticmethod
def parse(root: str) -> SqlPackage:
if n... | true |
75dfc91baad9a0dcfc356a26a764cf57b652e4d0 | Ineshkumar/Work-Forsk | /DAY 4/untitled5.py | UTF-8 | 129 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 15 13:26:21 2018
@author: inesh
"""
a=10
def add(x):
return x+a
a=3
add(2)
| true |
a1df5360e6ffaef4fc0a98d1ee447e247631c9c1 | Aasthaengg/IBMdataset | /Python_codes/p03059/s004398796.py | UTF-8 | 117 | 2.96875 | 3 | [] | no_license | a, b , t = map(int, input().split())
time = a
count = 0
while time <= t + 0.5:
count += b
time += a
print(count) | true |
69db3cfde3bbf6a4cdbe6de6c686715e5e47dca0 | duk-37/mvs-out-of-context | /find_faces.py | UTF-8 | 1,412 | 3.15625 | 3 | [
"Unlicense"
] | permissive | from PIL import Image
import face_recognition
import os
cdir = 'frames'
os.mkdir('images')
counter = 0
for video in os.listdir(cdir):
best_image = None
biggest_x = 0
biggest_y = 0
for filename in os.listdir(cdir + '/' + video):
fn = cdir + '/' + video + '/' + filename
print('Next im... | true |
1c2fa7eaeac6c6c0a68ae65a667aa05c73ef57ef | srijarkoroy/Unsupervised_Learning_Algorithms | /association/apriori/apriori.py | UTF-8 | 2,197 | 3.484375 | 3 | [] | no_license | from itertools import combinations
from collections import defaultdict
from operator import itemgetter
class Apriori:
def __init__(self,data,threshold,mincount):
'''
Initializing Apriori class
'''
self.data = data
self.threshold = threshold
self.mincount = mincount
... | true |
8e7d04b3e303b9c4bcbf2c63f3858010e6fa0cd5 | mamunm/data_science_algorithms | /coding_prep/classic/sum_even_numbers_after_query.py | UTF-8 | 523 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python
# -*-coding: utf-8 -*-
#SCRIPT: sum_even_numbers_after_query.py
#AUTHOR: Osman Mamun
#DATE CREATED: 05-29-2019
def sum_even_after_queries(A, queries):
out = []
even_sum = sum(i for i in A if i%2==0)
for q in queries:
if A[q[1]] % 2 == 0:
even_sum -= A[q[1]]
... | true |
39e012a52c05c0cbeea00c2fa90e50b424378081 | mrbalikci/udemy-breakdown | /udemny.py | UTF-8 | 1,603 | 3.796875 | 4 | [] | no_license | # Udemy - Web Course Breakdown
# import modules
import os
import csv
file_path = os.path.join('resources', 'WebDevelopment2.csv')
# Create a Python application that reads the data on Udemy Web Development offerings.
# Empty lists
title = []
price = []
subscriber_count = []
number_of_reviews = []
course_lenght =... | true |
1bd6e58e254e1fb8411eea2f043ef77218aa8a3b | manoldonev/python-bin | /tests/test_data_types_bst.py | UTF-8 | 4,992 | 3.328125 | 3 | [
"MIT"
] | permissive |
"""Test Cases"""
from dataStructures.data_types_bst import BinarySearchTree
def test_bst_insert():
tree = BinarySearchTree()
tree.insert(5)
tree.insert(1)
tree.insert(3)
tree.insert(4)
tree.insert(2)
tree.insert(6)
assert tree.root.key == 5
assert tree.root.left.key == 1
ass... | true |
8396df8bea56862b85638c27cad0a24dfabfdd72 | satoshi6380/Hangman | /Hangman/task/hangman/hangman.py | UTF-8 | 1,137 | 3.96875 | 4 | [] | no_license | # Write your code here
import random
from string import ascii_lowercase
li = ('python', 'java', 'kotlin', 'javascript')
answer = random.choice(li)
word = '-' * len(answer)
typed = set()
print('H A N G M A N')
while input('Type "play" to play the game, "exit" to quit:') != 'play':
if 'exit':
exit()
count... | true |
688ea6a0d89e63d79bf1913c7e29f5c40084d13f | ov7a/jjb | /tokens_buffer.py | UTF-8 | 457 | 2.9375 | 3 | [] | no_license | class TokensBuffer:
def __init__(self, max_memory=None):
self.last_id = 0
self.ids = dict()
self.counter = 0
self.max_memory = max_memory
def get_id(self, token):
id = self.ids.get(token)
if id is None:
id = self.last_id
self.ids[token] = id
self.last_id += 1
self.counter += 1
if self.ma... | true |
d046bfdcf42b69e925b5dd75e3be75113d4369ee | moshoulix/ZOJ | /1202.py | UTF-8 | 578 | 3.328125 | 3 | [] | no_license | # 有各种容量的金库和相同容量的钻石,问组合数,钻石不同,容量相同的金库相同
from scipy.special import comb, perm
from collections import Counter
try:
while 1:
x = int(input())
y = list(map(int, input().split(' ')))
Sum = 0
res = 1
for i in y:
Sum += i
for i in y:
res *= comb(Sum... | true |
95d9679265dd278433f8867571ee4d1590cf85c9 | natemago/adventofcode2017 | /day19_series_of_tubes/solution.py | UTF-8 | 2,350 | 3.25 | 3 | [] | no_license | def read_input(f):
grid = []
with open(f) as inpf:
for line in inpf:
grid.append([c for c in line])
return grid
MN = {(-1,0):'up', (0,1):'right', (1,0):'down', (0,-1):'left'}
def follow_diagram(diagram):
moves = [[-1,0], [0,1], [1,0], [0,-1]] # up, right, down, left
y... | true |
a9a9c5da9b71958bd6316497d08847fa9f18d780 | Nisar-1234/Data-structures-and-algorithms-1 | /LinkedList/Circular LL/Questions/Count nodes in Circular LL.py | UTF-8 | 1,527 | 3.65625 | 4 | [] | no_license | class Node():
def __init__(self,data):
self.data = data
self.next = None
class LinkedList():
def __init__(self):
self.head = None
def printList(self):
if self.head is None:
print("The LinkedList is empty")
else:
slow = self.head... | true |
9ae757e4f988316d1d6c08387025460b780bcda1 | hrkim28/TCT | /20190129/TCT_20190129_KimJinKwui.py | UTF-8 | 2,881 | 3.453125 | 3 | [] | no_license | #TCT_20190129_KimJinKwui.py
def printArithmeticOper(inputStr):
calcNum = inputStr.replace(" ","")
while ( isExistsArithmetic(calcNum, '/') or isExistsArithmetic(calcNum, '*') or isExistsArithmetic(calcNum, '+') or isExistsArithmetic(calcNum, '-') ):
if ( isExistsArithmetic(calcNum, '/') or isExistsAri... | true |
138a110cd8f1337171702f33ac3643c7e74cf6d9 | widgetti/solara | /solara/website/pages/api/file_drop.py | UTF-8 | 962 | 2.875 | 3 | [
"MIT"
] | permissive | """
# FileDrop
"""
import textwrap
import solara
from solara.components.file_drop import FileInfo
from solara.website.utils import apidoc
@solara.component
def Page():
content, set_content = solara.use_state(b"")
filename, set_filename = solara.use_state("")
size, set_size = solara.use_state(0)
def ... | true |
2d176d3267ca51fded69aba9c6f4c384111d3b5d | przemub/mynt | /mynt/containers.py | UTF-8 | 6,314 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
from collections import OrderedDict
from datetime import datetime
import yaml
from mynt.exceptions import ConfigurationException
from mynt.fs import Directory
from mynt.utils import get_logger, normpath, URL
logger = get_logger('mynt')
class Configuration(dict):
def __init__(self, str... | true |
6c113c882147f015cffcc1a33daf2d0a34376288 | KigulaJesse/simplex-calculator | /1.py | UTF-8 | 369 | 2.578125 | 3 | [] | no_license | tableau = [
[0.0, -2.0, 1.0, 1.0, -1.0, 0.0, 2.0],
[1.0, 5.0, 1.0, 0.0, 1.0, 0.0, 8.0],
[0.0, 30.0, 1.0, 0.0, 8.0, 1.0, 64.0]
]
s = [[str(e) for e in row] for row in tableau]
lens = [max(map(len, col)) for col in zip(*s)]
fmt = '\t'.join('{{:{}}}'.format(x) for x in lens)
table = [fmt.fo... | true |
cb4f2aa215173ace3a58bf52d126df9775d7e60a | cuiyi0501/Jdata-machine-learning-competetion | /model4.py | UTF-8 | 4,721 | 2.78125 | 3 | [] | no_license | import pandas as pd
import func_pack
from sklearn import linear_model
from sklearn.model_selection import cross_val_score
from datetime import datetime
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
import numpy as np
'''
strategy: linear regression + cv
step:
1. groupby([user_id',... | true |
257aa355c82d9b83f81d14de1d700372ff0ae3c1 | Daipuwei/Introduction-to-Machine-Learning-Based-on-Mathematical-Principles-with-Python | /Chapter5/Voice_Classification/VoiceClassification.py | UTF-8 | 5,646 | 2.90625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/12/11 8:55
# @Author : DaiPuWei
# E-Mail : 771830171@qq.com
# blog : https://blog.csdn.net/qq_30091945
# @Site : 中国民航大学北教25实验室506
# @File : Voice_Classification.py
# @Software: PyCharm
from SoftmaxRegression.SoftmaxRegression import... | true |
db675b01635474f23c0ae60efb50dc258df553a8 | flynncowell/dalekbot-1 | /dalek/controller_lite.py | UTF-8 | 13,291 | 2.609375 | 3 | [
"MIT"
] | permissive | if __name__ == "__main__":
'''
This if statement is needed for testing, to locate the modules needed
if we are running the file directly.
'''
import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
import RPi.GPIO as GPIO
import os.path
import ... | true |
36f3dcf23a8cb5e3627913be932741e00eba4c40 | PyPlym/PyPlymGeo | /readSensorsData.py | UTF-8 | 2,649 | 3.625 | 4 | [] | no_license | '''
Created on 26 Apr 2017
@author: T
'''
import csv
from CoordConversions_Func import lon_lat_to_utm
import matplotlib.pyplot as plt
def readAndroSensor(fileToRead, sensorColumn = 12):
''' Reads data from Andro sensor in csv file
:param arg1: file name or path to read
:param arg2: number representin... | true |
7c8a622b9c82b74ebe9fc6d7866f53de6eb8237e | eanopolsky/advent-of-code-2019 | /04/find2.py | UTF-8 | 678 | 3.15625 | 3 | [] | no_license | #!/usr/bin/python
import re
prog = re.compile(r'.*(.)\1')
def checkpossible(i):
#no doubles
if prog.match(str(i)) == None:
return False
istr = str(i)
if not ((istr[0] == istr[1] != istr[2]) or (istr[0] != istr[1] == istr[2] != istr[3]) or (istr[1] != istr[2] == istr[3] != istr[4]) or (istr[2]... | true |
64a04b777c1e723faba0ffd9cd05fe9cb7267a7a | 2020rkessler/main-folder | /meeting.py | UTF-8 | 345 | 3.578125 | 4 | [] | no_license | import random
matrix = [[random.randint(0,100) for col in range(5)] for row in range(5)]
print(matrix)
def col_sum(matrix,num):
sum = 0
for row in range (len(matrix)):
for col in range (len(matrix)):
if col == num:
sum = sum + matrix[row][col]
print(sum)
# call the func... | true |
5bf864bbfffb954b733c96f19b3e52a2b3e8c199 | google/ffn | /ffn/training/augmentation.py | UTF-8 | 7,228 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2017 Google Inc.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | true |
7a7207e53886575fc76f5a49bf1f32bc143f2615 | jush1ro/votebot | /src/sqlite_wrapper.py | UTF-8 | 3,962 | 3 | 3 | [
"MIT"
] | permissive | import sqlite3
from dataclasses import dataclass
from datetime import datetime
from functools import wraps
from sqlite3 import Error
@dataclass
class PollData:
poll_id: int
poll_type: str
chat_id: int
subject_user_id: int
object_user_id: int
datetime: datetime
def __str__(self):
r... | true |
1883c5ee80d61810760df0e7ef472ca089bb99c0 | Th3Lourde/l33tcode | /problemSets/top75/139.py | UTF-8 | 1,070 | 3.53125 | 4 | [] | no_license | '''
Given a string s, return t/f depending on
if s can be composed of the elements of wordDict,
you can use the same words from wordDict multiple times
applepenapple
l
r
{
a
ap
app
appl
apple
p
e
n
}
'''
class Solution:
def wordBreak(self, s, wordDict):
wordSet = set()
prefixSet = set()
... | true |
34d8f3e1bcd70ccea170a2b8f7ba4d25ee5ab0a3 | brndnmtthws/mother-of-dragons | /tests/test_firmware.py | UTF-8 | 477 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | from pytest import fixture
from mother_of_dragons.firmware import Firmware
import tempfile
import os
@fixture
def tempdir():
return os.path.join(tempfile.gettempdir(), 'test_firmware_fetch')
def test_firmware_fetch(tempdir):
f = Firmware(tempdir)
url = 'https://www.google.com/robots.txt'
filename = ... | true |
7f6a10d70d2ef648558a415522622bb66ab105e1 | SagiElfassi/IRIS | /indeed_scraper.py | UTF-8 | 4,306 | 2.953125 | 3 | [] | no_license | import requests
import numpy as np
from bs4 import BeautifulSoup
from datetime import timedelta, datetime
from utils import get_digits
def get_job_description(link):
"""
This function gets full job description given the link to the job opening.
:param link: url to specific job listing, string
:return:... | true |
866071b64b6da383ff492d2823864ab83ced830c | MonikaMarinova/BlackJackMM | /BJ_gameplay.py | UTF-8 | 4,062 | 4.09375 | 4 | [] | no_license | from Deck import Deck
from Hand import Hand
from Chips import Chips
playing = True
deck = None
player_hand = None
dealer_hand = None
def take_bet(chips):
while True:
try:
chips.bet = int (input("Please enter your bet: "))
except ValueError:
print("Value Error, input must ... | true |
d182a62f387528e17117f031d81c7e6daa143569 | Volvagia356/toucon-game | /randomizer/randomize.py | UTF-8 | 1,830 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | import csv
import random
import json
from collections import OrderedDict
questions = list(csv.DictReader(open("questions.csv"), ('question', 'answer')))
nodes = list(csv.DictReader(open("nodes.csv"), ('node', 'x', 'y')))
remaining_questions = csv.DictWriter(open("remaining.csv", 'w'), ('question', 'answer'))
mapinfo ... | true |
cee39fe2746a41775677da71bda54a0bfea26064 | VladimirRech/python | /pandas/csv_filters.py | UTF-8 | 722 | 3.90625 | 4 | [] | no_license | #
# vários exemplos de filtros
#
from collections import Counter
import pandas as pd
filename = 'csv_date.csv'
# lendo o arquivo
df = pd.read_csv(filename, sep=';')
# convertendo para uma lista
lst = df['date'].tolist()
# Realiza contagem armazenando em um dictionary
counter = Counter(lst)
# converter dictionary para... | true |
6413f2ac1b26e7160b60fbfa49ed762d5fbbe141 | maria-gorbacheva/PY_Prof_HW_3 | /Задание_1_вариант_1.py | UTF-8 | 650 | 3.09375 | 3 | [] | no_license |
from datetime import datetime
def logger(function):
def oncall(*args, **kwargs):
dict = {'call_date': datetime.isoformat(datetime.now()),
'func_name': function.__name__,
'args': args,
'kwargs': kwargs,
'result': function(*args, **kwargs)}
... | true |
cf0f10e97f045db6a5d53e5e4b03ebe06e87b23a | shreya2592/GeeksForGeeks | /Linked-List/LLExample2.py | UTF-8 | 318 | 3.453125 | 3 | [
"MIT"
] | permissive | #Implement the ordered list
from OrderedList import OrderedList
mylist=OrderedList()
mylist.add(14)
mylist.add(18)
mylist.add(25)
mylist.add(28)
mylist.add(4)
mylist.add(1)
mylist.add(7)
mylist.add(27)
print (mylist.size())
print (mylist.search(25))
mylist.remove(27)
print(mylist.size())
print(mylist.search(27))
| true |
f1e83b1d067439abb995ab6973cccf7f7efdb95a | pdonorio/challenges | /10_persistence.py | UTF-8 | 1,048 | 3.640625 | 4 | [] | no_license | """
# Because 3*9 = 27, 2*7 = 14, 1*4=4 and 4 has only one digit.
>>> persistence(39)
3
# Because 9*9*9 = 729, 7*2*9 = 126, 1*2*6 = 12, and finally 1*2 = 2
>>> persistence(999)
4
# Because 4 is already a one-digit number.
>>> persistence(4)
0
# Python 3.8+
import math
def persistence(digit: int):
counter = 0
... | true |
f19d4cdd360754660d58171f5008d37d41715960 | LYSHN/python-100-day | /day-096/image-open.py | UTF-8 | 594 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: 闲欢
"""
from PIL import Image
from io import BytesIO
import requests
# 打开图像文件
im = Image.open('cat.jpg')
# 打印图像的格式、大小、模式
print(im.format, im.size, im.mode)
# 从文件流中打开图像
r = requests.get('http://f.hiphotos.baidu.com/image/pic/item/b151f8198618367aa7f3cc7424738... | true |
9027cb0ae194139b9043a2479b15850fa14a64a7 | VUB-HYDR/2020_Sterl_etal_RSER | /code/REVUB_Python_A_Suriname_Sterl_etal_2020.py | UTF-8 | 8,894 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 16 08:35:12 2020
@author: ssterl
"""
##########################
#### REVUB initialise ####
##########################
# REVUB model © 2019 CIREG project
# Author: Sebastian Sterl, Vrije Universiteit Brussel
# This code accompanies the paper "Turbines of the Caribbean: D... | true |
42299525f191acc49db3421e63dc9b4d8a7e0b0e | Hootrix/boohe_foods | /main.py | UTF-8 | 4,002 | 2.546875 | 3 | [] | no_license | # coding=utf-8
"""获取薄荷健康食物信息
写入mongodb数据库 boohe_food.foods_detail
接口参数:
https://github.com/ai6552254636/Foods/blob/master/app/src/main/java/lanou/foodpies/%E6%8E%A5%E5%8F%A3%E6%96%87%E4%BB%B6
https://apps.apple.com/cn/app/id918422658
食物排名:
https://food.boohee.com/fb/v1/food_rankings/12.json
"""
import pymongo,requ... | true |
6148d384d0c53578f6eac0326ff93795981445a4 | CinnamonXI/PY4E | /ex_02/ex_02_02.py | UTF-8 | 132 | 3.75 | 4 | [] | no_license | #2.2 compute pay per hour
hrs = input("Enter Hours:")
rate = input("Enter rate per hour")
print("Pay:", float(hrs)*float(rate)) | true |
2b59438611d4ecec51b6f769d0402a91c3027092 | JonasBarros1998/ecommerce | /photoExplorer/errors/IAuthenticationMongoDb.py | UTF-8 | 1,001 | 2.71875 | 3 | [] | no_license | import os
from pathlib import Path
from dotenv import load_dotenv
from abc import ABC, abstractmethod
load_dotenv()
env_path = Path('.') / '.env'
class IAuthenticationMongoDb(ABC):
def __init__(self):
super().__init__()
@abstractmethod
def authentication(self):
usernameMongoDb = ... | true |
9558d5df4553e2d4ce8f053362eebafd4bd49a55 | OniDaito/PythonCourse | /bomberman/part7/square.py | UTF-8 | 2,057 | 3.609375 | 4 | [] | no_license | import pyglet
class GridSquare():
''' This text is special as it forms the description
of the class that is automagically read out with the __doc__
command '''
allows_movement = False
# This is the constructor. This takes an xpos and ypos of the
# grid and whether or not bomberman can m... | true |