blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
cc001ebeea64f8ffee05e0218af1dcca0d8603ed | Python | Seetha1231/datastucture | /queue.py | UTF-8 | 218 | 3.375 | 3 | [] | no_license | class queue :
def __init__(self):
self.ar=[]
def enqueue(self,n):
self.ar.insert(0,n)
return len(self.ar)
def dequeue(self):
try:
return (self.ar.pop(),len(self.ar))
except IndexError:
return (-1,0)
| true |
25a521c324fe0f7d47e09f57cd879a31dc0a8218 | Python | Denpeer/TweetMatch | /WebServer/App/data/tweet_mining.py | UTF-8 | 5,005 | 2.953125 | 3 | [] | no_license | import tweepy
from tweepy import Cursor
import unicodecsv
from unidecode import unidecode
import sys
import os
# The following 3 functions simulate a progress bar in the terminal output
# title = string shown before progress bar
# 0 <= x <= 100 amount of progress made
def startProgress(title):
global progress_x
... | true |
1954245c80d333896cd285713521a9c6a28882ec | Python | cse031sust02/my-python-playground | /oop/polymorphism.py | UTF-8 | 3,861 | 4.53125 | 5 | [] | no_license | # What is Polymorphism? :
# =============================
#
# Polymorphism is derived from two Greek words: poly(many) and
# morphs(forms). So polymorphism means "many forms".
# Polymorphism gives a way to use a class exactly like its parent so
# there’s no confusion with mixing types. But each child class can
# defin... | true |
b4c76c0b05ec1aea23c122d6b2f1b148ef0f8d49 | Python | AartiBhagtani/Algorithms | /ctci/trees/Least_Common_Ancestor.py | UTF-8 | 637 | 3.78125 | 4 | [] | no_license | # Least common ancestor
# problem 4.8
class Node:
def __init__(self, data):
self.val = data
self.left = None
self.right = None
def LCA(node, data1, data2):
if node == None:
return None
if node.val == data1 or node.val == data2:
return node
left = LCA(node.left, data1, data2)
right = LCA(n... | true |
1248c203cc7292631559b564bd11ca06aa83884c | Python | vgswn/AI | /ai/Codes/Project/first/mlhello.py | UTF-8 | 178 | 2.515625 | 3 | [] | no_license | from sklearn import tree
features=[[140,1],[130,1],[150,0],[170,0]]
labels=[0,0,1,1]
clf=tree.DecisionTreeClassifier()
clf=clf.fit(features,labels)
print(clf.predict([[120, 0]])) | true |
ebabb3b644cd7f4adf7eeaad49133c9d5bbd89b3 | Python | Sniper970119/MemoryAssistInPython | /src/Server/SystemTools/ConfFileRead/configFileRead.py | UTF-8 | 1,252 | 2.5625 | 3 | [
"MIT",
"ICU"
] | permissive | # -*- coding:utf-8 -*-
from src.Server.Conf.config import *
from src.Server.SystemTools.ConfFileRead.Tools import readConfigFile
from src.Server.SystemTools.ConfFileRead.Tools import saveConfigFile
class ConfigFileRead():
def __init__(self, fileName='./conf/server.ini'):
self.readConfigFileTools = readC... | true |
8f25326be0b603ab2cfa97f3c8f12b7982863f67 | Python | clovery410/mycode | /python/chapter-2/lab8-rlist-1.py | UTF-8 | 856 | 3.53125 | 4 | [] | no_license | class Rlist(object):
class EmptyList(object):
def __len__(self):
return 0
empty = EmptyList()
def __init__(self, first, rest=empty):
self.first = first
self.rest = rest
def rlist_to_list(rlist):
"""Take an RLIST and returns a Python list with the same elements.
... | true |
544e4608219caabd9d33f1947787949764c389fd | Python | nolleh/leetcode | /algorithm/l2/17.letter-combinations-of-a-phone-number.py | UTF-8 | 841 | 3.25 | 3 | [] | no_license | class Solution:
def permu(self, ind, digits, ans, ds, mapping):
if len(ds) == len(digits):
ans.append(ds)
return
for i in range(len(mapping[digits[ind]])):
ds += list(mapping[digits[ind]])[i]
self.permu(ind + 1, digits, ans, ds, mapping)
d... | true |
c1c96ec0c396544695181a0fb50a390866ede067 | Python | WaugZ/opencv_py_tutorial | /hello.py | UTF-8 | 579 | 2.625 | 3 | [] | no_license | import numpy as np
import cv2
import matplotlib.pyplot as plt
m = cv2.imread("C:\\Users\\38345\\Desktop\\map.jpg")
h, w = m.shape[:2]
m = cv2.resize(m, (int(w / 2), int(h / 2)))
h, w = m.shape[:2]
# plt.imshow(m)
# plt.show()
src_pt = np.float32([[0, 0], [100, 0], [0, 100], [100, 100]])
# src_pt1 = np.array([[0, 0], ... | true |
33d6dae491c3f96420da9cbf536846d61fd77935 | Python | ValeraB1100/lesson_for_python | /lwsson3/task5.py | UTF-8 | 1,391 | 4.03125 | 4 | [] | no_license | # 5. Программа запрашивает у пользователя строку чисел, разделенных пробелом. При нажатии Enter должна
# выводиться сумма чисел. Пользователь может продолжить ввод чисел, разделенных пробелом и снова нажать Enter.
# Сумма вновь введенных чисел будет добавляться к уже подсчитанной сумме. Но если вместо числа вводится сп... | true |
75e1cde011aaa22700d67abe7fef4accd6c19f49 | Python | eleleung/automating-simulations | /gpar_tinker.py | UTF-8 | 838 | 2.515625 | 3 | [] | no_license | import sys
import random
dir_name = "/Users/EleanorLeung/Documents/thesis"
x_pos = 8
def change_velocity(particle_num: int, new_x: float, new_y: float, new_z: float):
with open(f'{dir_name}/week9/envs/{particle_num}/gpar.para', 'r') as file:
data = file.readlines()
data[1] = f'{new_x} {new_y} {new_z... | true |
17bd1c3e8ce85c6f3caa9263feb11b023e416eed | Python | xuxingtiancai/python | /util/LinkedList.py | UTF-8 | 1,445 | 3.421875 | 3 | [] | no_license | __author__ = 'xuxing'
import unittest
#node
class ListNode:
def __init__(self, val):
self.val = val
self.next = None
def __str__(self):
return str(self.val)
#iter
class ListNodeIter():
def __init__(self, node):
self.node = node
def __iter__(self):
return self
... | true |
0c6f1e1d02ce7483578d8fd9f78f3739a2c083cb | Python | aitorlomu/SistemasGestores | /EjerciciosPython2_AitorLopez/1.py | UTF-8 | 581 | 3.640625 | 4 | [] | no_license | a=float(input('Introduce el valor de a '))
b=float(input('Introduce el valor de b '))
c=float(input('Introduce el valor de c '))
d=float(input('Introduce el valor de d '))
e=float(input('Introduce el valor de e '))
f=float(input('Introduce el valor de f '))
comp = a * e - b * d
if comp != 0 :
x = (e * c - b * f)... | true |
a5b373a99b5a7cffdaf9eefd39b92e6aafc56917 | Python | jklynch/mothur-evaluate-ml | /evaluate_svm.py | UTF-8 | 7,769 | 2.6875 | 3 | [] | no_license | """
usage: python evaluate_svm.py shared-file-path design-file-path
"""
import argparse
import numpy as np
import matplotlib.pylab as pylab
import sklearn.svm
import sklearn.preprocessing
import sklearn.grid_search
import sklearn.cross_validation
import sklearn.metrics
import mothur_files
def evaluate_svm():
... | true |
406966b45e33e0908ef84983f4f67ade0a64a7a7 | Python | Manaether/AdventOfCode | /2020/04/main.py | UTF-8 | 2,472 | 2.875 | 3 | [] | no_license | import time
import re
ecl_value = ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]
def validateECL(value):
return value in ecl_value
def validatePID(value):
return re.compile("^[0-9]{9}$").match(value)
def validateEYR(value):
return int(value) <= 2030 and int(value) >= 2020
def validateHCL(value):... | true |
37010e9ac49dc7c5a44540e4575af6b1f62eb129 | Python | WisChang005/technews_tw | /tests/crawlers/test_inside.py | UTF-8 | 961 | 2.75 | 3 | [
"MIT"
] | permissive | import json
import logging
import pytest
from technews.crawlers import inside
crawlers = inside.Inside()
@pytest.mark.parametrize("browser_page", [0, 1, 3, 5])
def test_inside_page_response(browser_page):
news_data = crawlers.get_news(browser_page)
_print_first_news_data(news_data)
assert "timestamp" ... | true |
6746f49daedbe3f2ffe823f6ab7964e6cfc547b9 | Python | gothack329/sirius.py | /create_dict.py | UTF-8 | 294 | 2.71875 | 3 | [] | no_license | from itertools import product
import os
keywords = ['121','0']
lens = len(keywords)
dic = open('password.txt','a+')
for i in range(2,6):
outlist = list(product(keywords[:lens],repeat=i))
for j in outlist:
result = ''.join([v for v in j])
dic.write(result+'\n')
dic.close()
os._exit(1)
| true |
b86f32604e1297571f9673e248b911bb92215b3a | Python | mluzarow/lotto | /lotto.py | UTF-8 | 36,045 | 3.09375 | 3 | [] | no_license | from bs4 import BeautifulSoup # For making the soup
import urllib2 # For comms
import turtle # For drawing
import os # Dealing with the OS
import sys # Exit
import logging # Error logging
import re # Minor text parsing
from colorama import init
from colorama import Fore, Back, Style
#region Defines
VERSION_MAJOR = 0
... | true |
52f6ea64a2941db45e3d40173a943797f4704e9b | Python | UBC-MDS/522-Workflows-Group-414 | /src/split_and_clean.py | UTF-8 | 4,922 | 3.4375 | 3 | [
"CC-BY-2.5",
"MIT"
] | permissive | # authors: Tejas Phaterpekar
# Date written: 01-25-2020
# This script takes in the ASD adults dataset.It then splits the data into training and test sets,
# before proceeding to clean missing values and erroneous column/values.
'''This script takes in the ASD adults dataset.
It then splits the data into training and... | true |
0fb2cec5b4c856028921de68155613b31edf1d21 | Python | greg008/PythonEPS | /W3R/String/4.py | UTF-8 | 483 | 4.28125 | 4 | [] | no_license | """
4. TO DO Write a Python program to get a string from a given string where all
occurrences of its first char have been changed to '$',
except the first char itself.
Sample String : 'restart'
Expected Result : 'resta$t'
"""
def change_str(string):
new_string = ""
for i in range(len(string)):
if i !=... | true |
7735980bbebbe524335fdfee3b902e885718fd81 | Python | AnkitKumar82/CodeCloneDetection | /GetFiles.py | UTF-8 | 473 | 2.765625 | 3 | [] | no_license | import os
import sys
import Config
def getAllFilesUsingFolderPath():
folderPath = Config.dirPath
allFilesInFolder = []
if os.path.exists(folderPath):
fileNames = os.listdir(folderPath)
for fileName in fileNames:
if fileName.split(".")[-1] != "java":
... | true |
dd0457808c44a3a163d63d93f8465f28d38cde8e | Python | anuragcs/PythonRailwayReservation | /tripdetail.py | UTF-8 | 2,992 | 2.75 | 3 | [] | no_license | def tripint():
## sizeofrec=20
## with open("C:\\datafile\\cba.dat",'wb') as file:
print("Ale Destinations")
print("1 for Dehradun to Amritsar")
print("2 for Delhi to Bengaluru")
print("3 for Jammu to Lucknow")
print("4 for Jaipur to Alwar")
print("5 for Amritsar to... | true |
33fa5ec2fb3b20604d8383aadb2a48c11cb603c2 | Python | niejn/selenium_test | /re_help/lxml_parse1.py | UTF-8 | 222 | 2.515625 | 3 | [] | no_license | import requests
import lxml
from lxml import html
r = requests.get('http://gun.io')
tree = lxml.html.fromstring(r.content)
elements = tree.get_element_by_id('frontsubtext')
for el in elements:
print(el.text_content()) | true |
7c49aae6e146897e498c73e89cdae01644ba0514 | Python | ap632638/python_codes | /listsort.py | UTF-8 | 636 | 3.34375 | 3 | [] | no_license | n=int(input("Enter total no. of elements for main list:"))
print("Enter ",n," elements in list:")
lmain=[]
lsub=[]
lsm=[]
lgr=[]
lfinal=[]
for i in range(n):
lmain.append(int(input()))
lmain.sort()
s=int(input("Enter total no. of elements for sub list:"))
print("Enter ",s," elements in sublist:")
for i in ... | true |
a7bce49cf81421adadcc3b938f1375eaeab4ff22 | Python | iansedano/codingame_solutions | /techi.io_courses/genetic_algorithms.py | UTF-8 | 4,595 | 3.8125 | 4 | [] | no_license | # GENETIC ALGORITHMS
import random
import sys
from answer import is_answer, get_mean_score # this is the string that the program is searching to match.
alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !'."
def get_letter():
return random.choice(alphabet)
def create_chromosome(size):
chromoso... | true |
cd185529b3ad31dbd992ec94d1c890def87e6741 | Python | ridho9/crypto-cli | /crypto_cli/util/filter_running.py | UTF-8 | 113 | 3.46875 | 3 | [] | no_license | from sys import stdin
for c in stdin.read():
if c.isalpha():
c = c.lower()
print(c, end="")
| true |
23ea4b775a740c756da6851920b868e259e0ce6e | Python | franklsf95/spider | /parsing/parser.py | UTF-8 | 7,355 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
from bs4 import BeautifulSoup
import dateutil.parser
from db.models import *
import logging
from urllib.parse import urlparse
# Set up logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
class LinkedInParser(object):
"""
A LinkedIn HTML parser.
"""
... | true |
c8ac272a2da0047b45c690d0228f68b8e750edb4 | Python | LewPeng97/NLP-Daily | /word2vec.py | UTF-8 | 850 | 2.515625 | 3 | [] | no_license | import warnings
warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')
import logging
import gensim
from gensim.models import word2vec
from gensim import models
def main():
data_path_1 = './data/dict/法律通用词典.txt'
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(mess... | true |
ee61dd2fc2ccb52f6fa9f9021910a421ebb5591d | Python | mliu420/abides | /cli/ticker_plot.py | UTF-8 | 6,955 | 2.53125 | 3 | [
"BSD-3-Clause"
] | permissive | import ast
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import pandas as pd
import os
import sys
from joblib import Memory
# Auto-detect terminal width.
pd.options.display.width = None
pd.options.display.max_rows = 1000
pd.options.display.max_colwidth = 200
# Initialize a persistent memc... | true |
e9849df8c6217a1965fed1fc9be7dec55133d78c | Python | davehedengren/exercism_python | /anagram/anagram.py | UTF-8 | 225 | 3.140625 | 3 | [] | no_license | def detect_anagrams(word,a_list):
anagrams = []
for a in a_list:
if ((sorted(word.lower())) == sorted(a.lower())
and word.lower() != a.lower()):
anagrams.append(a)
return anagrams
| true |
5a4f20b383fc5de4b2dad2f59ab2914fbd0157e7 | Python | 4d4c/web_enumeration | /resolve_domains.py | UTF-8 | 3,544 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
import ipaddress
import os
import sys
from argparse import ArgumentParser
import dns.resolver
from lumberjack.lumberjack import Lumberjack
class ResolveDomains():
IP_FILENAME = "ips.txt"
DOMAIN_IP_FILENAME = "domains_ips.csv"
UNRESOLVED_FILENAME = "unresolved.txt"
def __init... | true |
d20c232413c2de9e121af4d753c48faed2c501b2 | Python | abhijithneilabraham/kodekochikode-hackathon | /Google_MapsAPI/Distance_between_coordinates.py | UTF-8 | 410 | 2.984375 | 3 | [] | no_license | import googlemaps
gmaps = googlemaps.Client(key='********************') #API_Key
LatO = input("Origin Latitude :")
LongO = input("Origin Longitude :")
LatD = input("Destination Latitude :")
LongD = input("Destination Longitude :")
distance = gmaps.distance_matrix([str(LatO) + " " + str(LongO)], [str(LatD) + " " + st... | true |
7d0a69a0a947764a2acf1a486901bf6e5de6c39f | Python | badbye/ORM | /myorm/test.py | UTF-8 | 896 | 2.65625 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 16/1/19 上午10:45
@author: yalei
'''
from field import *
from model import Model
from expr import Expr
class User(Model):
__table__ = 'user'
id = IntegerField()
char = CharField()
date = DateField()
def __repr__(self):
return '... | true |
fe35c3b5551973a1fb1ecca67f56f195886124a3 | Python | amlalejini/lalejini_checkio_ws | /home/median/median.py | UTF-8 | 1,252 | 4.0625 | 4 | [] | no_license | #!/usr/bin/python
'''
Task:
For this mission, you are given a non-empty array of natural numbers (X).
With it, you must separate the upper half of the numbers from the lower half
and find the median.
Input: An array as a list of integers.
Output: The median as a float or an integer.
'''
def verbose_checkio(data):
... | true |
758c44827e0dfc1f3608f38bad0fcada19fc359e | Python | TengounPlan/Sr.Cotorre-discord-edition | /e_cards/search.py | UTF-8 | 1,354 | 3.09375 | 3 | [] | no_license | from core.utils import is_lvl
def use_ec_keywords(cards: list, key_list: str):
"""
Filtra cartas de encuentro según los caracteres del string dado
:param cards: Lista de cartas
:param key_list: Argumentos dados
:return:
"""
filtered_cards = cards
for char in key_list.lower():
i... | true |
2ab97cadaadcb6a0019408157e17a6bc2f2c56d7 | Python | Nabellaleen/dosye | /dosye/files.py | UTF-8 | 1,567 | 3.15625 | 3 | [] | no_license | # Import from external libraries
from path import Path
from werkzeug.utils import secure_filename
class FilesManagerException(Exception):
pass
class FolderConfigException(FilesManagerException):
def __init__(self):
self.message = (
"UPLOAD_FOLDER not found - Please check "
"... | true |
dc0ce6a20059b009ff77d7eab4714715130dc7ae | Python | nacro711072/smooth_location_trajectory | /algorithm/__init__.py | UTF-8 | 1,386 | 3.40625 | 3 | [] | no_license | import util
import math
def min_distance(data_list, max_d=30.0):
pre = data_list[0]
new_points = [pre]
for i in range(1, len(data_list)):
curr = data_list[i]
distance = util.latlon_distance(pre[0], pre[1], curr[0], curr[1])
if distance < max_d:
continue
else:
... | true |
d0ef0502ac1458b1ca1494f5ee70e51c27137f36 | Python | raymondem1/hot-or-not-ai | /roastScript.py | UTF-8 | 896 | 2.515625 | 3 | [] | no_license | import requests
import pyttsx3
from better_profanity import profanity
engine = pyttsx3.init()
eb =""
def roast():
global eb
context = "Your mom is a hoe.\nYou are the proof that God makes mistakes\nYou make me want to go blind\nDo us a favor and stay inside\nYou look like an anti cigaretts commerci... | true |
b4970a5e5c6badcfedea39593b06d2ab1b50fb0e | Python | nxhuy-github/code_20201031 | /code_20201031/streamlit_20200308/first_app.py | UTF-8 | 1,079 | 3.625 | 4 | [] | no_license | import streamlit as st
import numpy as np
import pandas as pd
import time
st.title('My first app')
st.write("Here's our first attempt at using data to create a table:")
st.write(pd.DataFrame({
'first_column': [1,2,3,4],
'second_column': [10,20,30,40]
}))
df = pd.DataFrame({
'first_column': [1,2,3,4],
... | true |
46ee4e758882b88e29e0fbd80840fd2754f218d5 | Python | sy1wi4/ASD-2020 | /searching/binary_search_recursive.py | UTF-8 | 222 | 3.578125 | 4 | [] | no_license | def binSearch(tab,val,p,k):
if(p<=k):
s=(p+k)//2
if(tab[s]==val): return s
elif(tab[s]>val): return binSearch(tab,val,p,s-1)
else: return binSearch(tab,val,s+1,k)
else: return None
| true |
09ec0c830590c3c5fdbaf0da409def02c22fde6e | Python | jacquerie/leetcode | /leetcode/0077_combinations.py | UTF-8 | 365 | 3.265625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import itertools
class Solution:
def combine(self, n, k):
return [list(el) for el in itertools.combinations(range(1, n + 1), k)]
if __name__ == "__main__":
solution = Solution()
assert [
[1, 2],
[1, 3],
[1, 4],
[2, 3],
[2, 4],
... | true |
161012239a7ee36dc986922e62737d624def594e | Python | mmreis/pdTransformers | /pdTransformers/lags.py | UTF-8 | 4,915 | 2.828125 | 3 | [] | no_license | from sklearn.base import BaseEstimator, TransformerMixin
import pandas as pd
import warnings
class InsertLags(BaseEstimator, TransformerMixin):
"""
Insert lags using shift method
:param lags: : dict, dictionary with reference of the columns and number of lags for each column
Example:
fro... | true |
5e3aa86d130f52be1e3d91eff069ea0631d175c5 | Python | oceanbei333/leetcode | /1394.找出数组中的幸运数.py | UTF-8 | 406 | 2.96875 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=1394 lang=python3
#
# [1394] 找出数组中的幸运数
#
# @lc code=start
class Solution:
def findLucky(self, arr: List[int]) -> int:
counter = collections.Counter(arr)
if any(counter[val]==val for val in counter):
return int( max(not counter[val]==val or val for val in coun... | true |
12bd4f20b6754a0fe61361af4b3aa5db082dac68 | Python | to-yuki/pythonLab-v3 | /sample/8/GmailAT.py | UTF-8 | 1,177 | 2.953125 | 3 | [] | no_license | import gmail # GMail簡易送信モジュール
import getpass
# Gmailアカウント情報
sendUsername = None #'from_user@gmail.com'
sendUserPassword = None #'from_user_password'
# メール送信パラメータ
subject = '件名'
toAddr = None #'to_user@gmail.com'
body = '本文'
# メールサーバに接続して、ログインとメール送信
try:
print('メール送信開始')
# ユーザ名とパスワードの入力
print('MailAccount... | true |
14744acaece5efc82528cd736f654d693cc5f7b2 | Python | largomst/HackerRank-Algorithms | /Week of Code/Repeated String.py | UTF-8 | 199 | 3.046875 | 3 | [] | no_license | #!/bin/python3
import sys
s = input().strip()
n = int(input().strip())
time = sum([1 for i in s if i == 'a']) * (n // len(s))
time += sum([1 for i in range(n % len(s)) if s[i] == 'a'])
print(time)
| true |
f3a67b210cd21d1d9b11ef07b18b821faa888a68 | Python | MacHu-GWU/angora-project | /angora/filesystem/winzip.py | UTF-8 | 5,390 | 3.703125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module description
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A data/file compress utility module. You can easily programmatically add files
and directorys to zip archives. And compress arbitrary binary content.
- :func:`zip_a_fol... | true |
bf4b9d3b15f8105ae4bab4ab6a42db2f71bfaf16 | Python | KimMinjun7/Work | /data_functions_solar.py | UTF-8 | 2,790 | 2.6875 | 3 | [] | no_license | import pvlib
import pymysql
import numpy as np
import pandas as pd
class Data:
def __init__(self):
print('Start: Data\n')
def _print_start(self, content):
print(f'Start: {content}')
def _print_end(self, content):
print(f'End: {content}\n')
de... | true |
15662f7f62b063903c2f9eefcea956e805977ced | Python | littlecoon/EffectivePython | /article8.py | UTF-8 | 1,608 | 4.4375 | 4 | [] | no_license | 编写高质量python代码的方法8:不要使用含有两个以上表达式的列表推导
除了基本的用法之外,列表推导也支持多重循环。例如,要把矩阵(也就是二维列表)简化成一维列表,使原来的每个单元格都成为新列表中的普通元素。这个功能采用包含两个for表达式的列表推导即可实现,这些for表达式会按照从左至右的顺序来评估。
上面这个例子简单易易懂,这就是多重循环的合理用法。还有一种包含多重循环的合理用法,那就是根据输入列表来创建有两层深度的新列表。例如,我们要对二维矩阵的每个单元格取平方,然后用这些平方值构建新的矩阵。由于要多使用一对中括号,所以实现该功能的代码会经上例稍微复杂一点,但依然不难理解。
如果表达式里还有一层循环,那么列表推导就会变得... | true |
2b935e5adaff4b4a32970b170b39816e99663da1 | Python | svvchen/siteblocker | /media_blocker.py | UTF-8 | 2,342 | 3 | 3 | [] | no_license | import time
from datetime import datetime
import os
import fileinput
import re
import secrets
class Blocker:
def __init__(self):
# starting with an initial set of sites that the user can modify
self.blocked_sites = ["www.youtube.com", "www.facebook.com", "www.reddit.com", "www.linkedin.com"]
d... | true |
604d830f1b8e2f8fca5eebdde7b8958f791b7e9b | Python | moxy37/NodePiAlpha | /TestListen.py | UTF-8 | 462 | 3.28125 | 3 | [] | no_license | #!/usr/bin/python
import serial, string
output = " "
ser = serial.Serial('/dev/ttyACM0', 9600)
print("Starting")
while True:
while output != "":
output = ser.readline()
output = output[:-2]
o = output.split(' ')
lat = ''
lon = ''
#print(o)
for x in range(0, len(o)):
if o[x] != '':
if lat =... | true |
1b1d83708786e53a5e2252d212d401e7c34185ff | Python | lxjack/Python_Code | /data_struct/Llist/link_list_test.py | UTF-8 | 15,664 | 3.84375 | 4 | [] | no_license | #_*_ coding: utf-8 _*_
import unittest
from link_list import Llist
from link_list import LinkedListOperateError
class LlistTest(unittest.TestCase):
'''my linked list unittest'''
def setUp(self):
pass
def tearDown(self):
pass
def test_is_empty_list(self):
"case1:test is_empty... | true |
e70499e70ef2ffb505795f703964c821776c0987 | Python | olivierdarchy/python_lab | /pgcd.py | UTF-8 | 1,888 | 3.765625 | 4 | [] | no_license | # Made to stay sharp in python:
#
# Exercice : design an algorithm to evaluate the pgcd of two natural integers
# - input: a, b for a, b € N*
# - output: pgcd
#
# by Olivier Darchy
# created the 23th of September,2017
def eval_pgcd(a, b) :
"""
Evaluate and return the greatest comon divisor of two number.
... | true |
64db57507d2128bd79a12548f97b4fb1cbde0fdd | Python | TimP4w/dva | /Exercise 1/dva_hs19_ex1.py | UTF-8 | 9,596 | 3.140625 | 3 | [] | no_license | import numpy as np
import numpy.polynomial.polynomial as poly
import pandas as pd
import os
from scipy import interpolate
from bokeh.layouts import layout
from bokeh.io import show
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.plotting import figure
from bokeh.palettes import RdYlBu
from bokeh.transfo... | true |
4d9a33d8ada159a001db08b084de3f9452e70f90 | Python | xiewendan/algorithm | /leetcode/00 common.py | UTF-8 | 197 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
# __author__ = xiaobao
# __date__ = 2019/11/14 12:01:42
# desc: 用于描述常用模块
import sys
print(sys.maxsize) # 正无穷大
print(-sys.maxsize) # 负无穷大 | true |
24ef6f6a988dc81cbeb6f828f34dee12ebc42b40 | Python | salimregragui/python_poker | /player.py | UTF-8 | 11,489 | 3.65625 | 4 | [] | no_license | import deck
class Player:
"""Player Class"""
def __init__(self, money, name):
self.hand = []
self.money = money
self.name = name
self.state = "Playing"
self.status = ""
self.current_call = 0
def calling(self, money_to_call):
if self.mone... | true |
d175fc282eeb2cf90d03af361cb4942a448d738d | Python | masatomix/ai-samples | /samples/nlp/MecabFacade.py | UTF-8 | 2,604 | 3.140625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import MeCab
from logging import getLogger
log = getLogger(__name__)
class MecabFacade(object):
"""
MecabのFacade。実行結果を表形式で返すメソッドを提供
https://www.masatom.in/pukiwiki/%BC%AB%C1%B3%B8%C0%B8%EC%BD%E8%CD%FD/%B7%C1%C2%D6%C1%C7%B2%F2%C0%CF%A5%A8%A5%F3%A5%B8%A5%F3Me... | true |
624fff85e6872f08a56420423bb8b2f71d6c22a3 | Python | majorbriggs/python_training | /decorators_tags.py | UTF-8 | 1,026 | 4 | 4 | [] | no_license | from functools import wraps
def tags(tag_name):
def tags_decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
result = func(*args, **kwargs)
return "<{tag_name}>{result}</{tag_name}>".format(tag_name=tag_name, result=result)
return wrapper
return tags_deco... | true |
0717b3e13c1d80dbbd2397fce002c89536d6f1d1 | Python | ctensmeyer/formCluster | /preprocessing/image/line_detect_lib.py | UTF-8 | 7,371 | 2.890625 | 3 | [] | no_license |
import Image
from collections import deque
import sys
# Enum
START = 0
BETWEEN = 1
CONSEC = 2
GAP = 3
LABELING = 4
END = 5
# Constants
BLACK = 0
WHITE = 255
# Configurations
CONSEC_THRESHOLD = 70
MAX_GAP = 3
COLOR_LABEL = (0, 255, 0)
SMOOTH_KERNEL = 7
class CC:
def __init__(self, im, label, coords):
self.i... | true |
c06a32dcb3e5d91f4aa722270de0cd6829a80e7d | Python | ozkriff/misery | /misery/ast.py | UTF-8 | 3,127 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- coding: utf-8 -*-
# See LICENSE file for copyright and license details
'''
Asbtract Syntax Tree
'''
from misery import (
misc,
)
class Module(object):
def __init__(
self,
import_list=None,
decl_list=None,
):
self.import_list = misc.tolist(import_list)
self... | true |
62ae332a7b51185f9b995d8f2ff5a54e6513b14b | Python | kautsiitd/Competitive_Programming | /CodeChef/Long/August 2017/HILLJUMP.py | UTF-8 | 576 | 2.609375 | 3 | [] | no_license | n,q = map(int,raw_input().split())
a = map(int,raw_input().split())
for _ in range(q):
Q = map(int,raw_input().split())
if Q[0] == 1:
current,k = Q[1]-1,Q[2]
lastBig = a[current]
lastBigIndex = current
while(current<n and k>0 and current - lastBigIndex <= 100):
if a[... | true |
4c757a960ce6ff776062bf6d969b8dd0a55c823d | Python | manxisuo/MachineLearningLibDIY | /algo.py | UTF-8 | 1,637 | 2.875 | 3 | [] | no_license | # encoding: utf-8
from typing import Tuple
from time import time
import numpy as np
from numpy import ndarray
from tool import CachedFunc
class History:
"""表示模型训练过程的历史记录"""
def __init__(self, loss_list, consuming_time):
self.loss_list = loss_list # 每次迭代后的损失函数的值的列表
self.consuming_time = consum... | true |
01193520f4ca41afc35c5bd4e34b2f1ccaf42527 | Python | VireshDoshi/pd_test | /PerspectumDiagnostics.py | UTF-8 | 2,721 | 3.953125 | 4 | [] | no_license | #!/usr/bin/env python
import itertools
def strings_appear_in_multiple_lists(list_in):
""" This method will print out the list of Strings appearing in multiple
Lists.
Input: List of Lists ( 1..n)
Output: String
"""
# establish the size of the list
list_in_len = len(list_in)
# set the... | true |
7f9421337bb1cb24b9b79b9fe14e0621faf2d8ac | Python | Jalabre1995/PasswordChecker | /checkmypass.py | UTF-8 | 1,690 | 3.515625 | 4 | [] | no_license | import requests
import hashlib
import sys
#API key for pwnedpasswords.com. The api is working when it runs a 200 in the command line, but if not then raise a runtimeError
def request_api_data(query_char):
url = 'https://api.pwnedpasswords.com/range/' + query_char
res = requests.get(url)
if res.status_cod... | true |
3ad9a37e9e171f8ce39f37f8c3144b8607c507e5 | Python | Aasthaengg/IBMdataset | /Python_codes/p02743/s099779834.py | UTF-8 | 155 | 2.734375 | 3 | [] | no_license | from decimal import *
import math
getcontext().prec=1000
a,b,c=map(int,input().split())
if a+b+2*Decimal(a*b).sqrt()<c:
print("Yes")
else:
print("No")
| true |
6e6e31ae85c91b104c6398fe84aeedb99585c379 | Python | nuonuozi/Python- | /Python_Primer/LogisticRegressionModel.py | UTF-8 | 2,846 | 3.171875 | 3 | [] | no_license | #导入相关包
import pandas as pd
import numpy as np
#创建特征列表
column_names=['Sample code number','Clump Thickness','Uniformity Cell Size','Uniformity of Cell Shape','Marginal Adhesion','Single Epithelial Cell Size','Bare Nuclei','Bland Chromatin','Normal Nucleoli','Mitoses','Class']
#从互联网读取指定数据
data=pd.read_csv('https://arch... | true |
ae8b2127a1eb26bc78f417d0a8ba665ce0776835 | Python | ericsperanza/ST | /WarmColdDiffBZ.py | UTF-8 | 6,053 | 2.671875 | 3 | [] | no_license | # WarmColdDiff.py
from __future__ import print_function
import openpyxl
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import matplotlib.dates as mdates
from scipy import interpolate
from scipy import signal
from scipy.stats import ttest_ind
from scipy.stats import pearsonr
import numpy as np
import ... | true |
500d211b2130056f2e80339145858f5cb1aca547 | Python | tekemperor/snsync | /simplenote_sync/config.py | UTF-8 | 2,803 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | """
Configuration settings for snsync
"""
# pylint: disable=W0702
# pylint: disable=C0301
import os
import collections
import configparser
class Config:
"""
Config Object
"""
def __init__(self, custom_file=None):
"""
Defult settings and the like.
"""
self.h... | true |
c1a524d57adab1f93d3e7c7264e74e99238803f2 | Python | najibelkihel/python-crash-course | /Chapter 4 Working with Lists - Lessons/magicians.py | UTF-8 | 1,081 | 4.21875 | 4 | [] | no_license | players = ['magic', 'lebron', 'kobe']
# use of for LOOP to apply printing to each player within player variable.
for player in players:
print(player)
# for LOOP has been defined, and each item from the 'players' loop has been
# stored in a new variable called 'player'.
# for every player in the players list
# ... | true |
96c554bf88f06840ca97e905d0933f4ed198963e | Python | pylinx64/wen_python_16 | /wen_python_16/list_1.py | UTF-8 | 261 | 3.46875 | 3 | [] | no_license | colors=['red', 'purple', 'blue', 'orange', 'yellow']
print(colors)
print(colors[0])
print(colors[1])
print(colors[2])
print(colors[3])
i = 0
list_len = len(colors)
while i < list_len:
print(colors[i])
i = i + 1
for i in colors:
print(i)
| true |
460b02658fd4daa49b589e472205c76c173eace4 | Python | DeyanGrigorov/Python-Advanced | /Multidimensional_lists./2x2.py | UTF-8 | 452 | 3.21875 | 3 | [] | no_license | m, n = list(map(int, input().split(' ')))
matrix = [[''] * n for i in range(m)]
num_squares = 0
for i in range(m):
row = input().split(' ')
for j in range(n):
matrix[i][j] = row[j]
if i - 1 >= 0 and j - 1 >= 0:
if matrix[i][j] == matrix[i][j - 1] and \
matrix[i][j]... | true |
a0d1497a9d31f1eaa704ea31e9477de9222470dc | Python | SomeoneSerge/cf | /345/b.py | UTF-8 | 351 | 2.90625 | 3 | [] | no_license | # ATTENTION:
# never attend codeforces if u're drunk
n = int(input())
a = sorted([int(x) for x in input().split()])
c = dict()
for x in a: c[x] = c[x]+1 if x in c else 1
uniq = sorted(c.keys())
C=0
while n>0:
t = 0
for u in uniq:
if c[u] == 0:
continue
c[u] -= 1
n -= 1
... | true |
d8d5bdcd989aa05469402a1984955ec355908973 | Python | AngelSosaGonzalez/IntroduccionMachineLearning | /Machine Learning/IntroduccionML/Preprocesamiento/AgrupaDatos.py | UTF-8 | 1,864 | 4 | 4 | [] | no_license | """ Agrupacio de datos: El agrupamiento de datos o binning en ingles, es un método de preprocesamiento de datos y consiste en agrupar valores
en compartimientos. En ocasiones este agrupamiento puede mejorar la precisión de los modelos predictivos y, a su vez, puede mejorar la
comprensión de la distribución de los dat... | true |
40cdc642cc22d2dafc3d5121f6e06f0074dd035a | Python | Sitarweb/Python_study | /pythontutor_5/num_8.py | UTF-8 | 472 | 3.703125 | 4 | [] | no_license | #Дана строка, в которой буква h встречается как минимум два раза.
# Разверните последовательность символов, заключенную между первым и последним появлением буквы h, в противоположном порядке.
s = input()
a = s[:s.find("h") + 1]
b = s[s.find("h") + 1 : s.rfind("h")]
c = s[s.rfind("h"):]
s = a + b[::-1] + c
print(s) | true |
c466a59dae7fd36e68e782b0e6e2826f22d37d99 | Python | busisd/PythonPractice | /ImageGradient.py | UTF-8 | 441 | 3.109375 | 3 | [] | no_license | from PIL import Image
MAX_X = 400
MAX_Y = 400
pic = Image.new("RGB", (MAX_X, MAX_Y))
pic_pix = pic.load()
for i in range(0, MAX_X):
for j in range(0, MAX_Y):
color_R = 255 - int(255*(i/(MAX_X-1)))
color_G = int(255*(j/(MAX_Y-1)))
color_B = int(255*(i/(MAX_X-1))/2) + int(255*(j... | true |
8cc006c910d08a16b716929f7250137b36e1c152 | Python | daniel-reich/ubiquitous-fiesta | /jzCGNwLpmrHQKmtyJ_0.py | UTF-8 | 101 | 3.171875 | 3 | [] | no_license |
def parityAnalysis(num):
digit_sum = sum(int(i) for i in str(num))
return digit_sum%2 == num%2
| true |
6b52c1116933018a1e200fc036c7acf7300971d7 | Python | weiaicunzai/blender_shapenet_render | /render_helper.py | UTF-8 | 6,938 | 3.375 | 3 | [] | no_license | """render_helper.py contains functions that processing
data to the format we want
Available functions:
- load_viewpoint: read viewpoint file, load viewpoints
- load_viewpoints: wrapper function for load_viewpoint
- load_object_lists: return a generator of object file pathes
- camera_location: return a tuple contains ... | true |
781ef8d3e860ed00e74e21feddc8660049f96006 | Python | sfade070/keras_min | /activations/activations.py | UTF-8 | 550 | 3.015625 | 3 | [] | no_license | import numpy as np
def relu(x):
return np.maximum(x, 0)
def linear(x):
return x
def sigmoid(x):
out1 = np.exp(-x)
out = 1 / (1 + out1)
return out
def softmax_function(x):
expo = np.exp(x)
expo_sum = np.sum(np.exp(x))
return expo / expo_sum
def softplus_function(x):
expo = np... | true |
d52d5520348aae755fd718313ea5e49aeb0a6fa3 | Python | tanujdhiman/OpenCV | /Click image and read data from Image/click_image.py | UTF-8 | 356 | 2.890625 | 3 | [] | no_license | import cv2
import matplotlib.pyplot as plt
cap = cv2.VideoCapture(0)
if cap.isOpened():
ret, frame = cap.read()
print(ret)
print(frame)
else:
ret = False
img1 = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
plt.imshow(img1)
plt.title('Image Camera-1')
plt.xticks([])
plt.yticks([])
plt.sho... | true |
c5def224e5d2e9fa2b3eaebf05bad467bfaf70f9 | Python | MegEngine/MegEngine | /lite/pylite/megenginelite/utils.py | UTF-8 | 8,702 | 2.71875 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import threading
import warnings
import numpy as np
from .base import *
from .struct import *
from .tensor import *
class TensorBatchCollector:
"""
A tensor utils is used to collect many single batch tensor to a multi batch
size tensor, when the multi batch size tensor collect fi... | true |
ea172dbb588454af7e81cb36c4edee39287c3aba | Python | suwendtc/dash-table-enhanced | /demo.py | UTF-8 | 1,835 | 2.59375 | 3 | [] | no_license | import sys
sys.path.insert(0, r"/mnt/c/Users/Super Bruce/Desktop/tornado/dash/test/dash_table_enhanced")
import dash
import dash_table
import dash_html_components as html
from dash.dependencies import Input, Output
import pandas as pd
from collections import OrderedDict
from datetime import datetime as dt
... | true |
0f6431dd74d067cd5f102ae829f85142d85fc58f | Python | jolugama/python3-tutorial-by-examples | /e08listas.py | UTF-8 | 1,054 | 3.9375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
https://www.youtube.com/watch?v=I1a7piALq60&index=7&list=PLpOqH6AE0tNiK7QN6AJo_3nVGQPc8nLdM
codigo facilito
'''
class E8:
'''
Listas, los arrays en javascript
'''
def __init__(self):
mi_lista = ['una string', 4.2, 56, False]
print(mi_... | true |
daff705c6ebe4ae69980f28820fc869bd4b67446 | Python | LegenDu/MachineLearning-BasicAlgorithms | /Clustering/KMeans.py | UTF-8 | 6,340 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
import math
import pandas as pd
import random
import sys
np.random.seed(2)
# In[2]:
def loadDermatologyDataset():
filename ="Datasets/dermatologyData.csv"
return pd.read_csv(filename, header=None).to_numpy()... | true |
df585a44013dd164b869c2bb1c0c14c1336dbffb | Python | alexandrucanavoiu/local_check_ssl_expiration_date | /check_ssl.py | UTF-8 | 5,625 | 2.859375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
#
# Local Check SSL expiration date
#
# Last Modified: 2020-11-10
#
# Usage: SSL Check [-h] [-v] -c CRITICAL -w WARNING -p PATH -e EXTENSION
#
# Outputs:
#
# CRITICAL: example.org expired on 2020-10-02, example2.org will expire on 2020-11-13 - 3 day(s) left
# WARNING: example2.org will expire on ... | true |
8a61e3c407a5ff13b531ba494ed4dac46f29b8f0 | Python | paalso/hse_python_course | /3/3-5.py | UTF-8 | 850 | 3.84375 | 4 | [] | no_license | # https://www.coursera.org/learn/python-osnovy-programmirovaniya/programming/HO43Q/okrughlieniie-po-rossiiskim-pravilam
# Округление по российским правилам
# По российский правилам числа округляются до ближайшего целого числа,
# а если дробная часть числа равна 0.5, то число округляется вверх.
# Дано неотрицатель... | true |
a6051db2296640c832fa26e6c18f400e1c2ce503 | Python | gregone/collectives-flask2 | /collectives/utils/export.py | UTF-8 | 3,385 | 2.828125 | 3 | [] | no_license | from openpyxl import load_workbook
from openpyxl.writer.excel import save_virtual_workbook
from flask import current_app
import json
from ..models import Event
class DefaultLayout:
ACTIVITIES = 'A8'
TITLE = 'D8'
DESCRIPTION = 'A10'
LEADER_NAME = 'E11'
LEADER_PHONE = 'E12'
LEADER_EMAIL = 'E13... | true |
ab9b5edddf3f3d9a8e09da729fe10abbe7e4fedb | Python | HoeYeon/Algorithm | /Python_Algorithm/codeforce/1181B.py | UTF-8 | 193 | 2.671875 | 3 | [] | no_license | l = int(input());
s = input()
j = l//2
i = j+1
while j>0 and s[j]=='0':j-=1
while i<l and s[i]=='0':i+=1
print(min(int(s[0 if i>=l else i:])+int(s[:i]), int(s[j:])+int(s[: l if j==0 else j])))
| true |
af644c81b9b5f38f1a7d31824e7f30b370cfef01 | Python | kundor/canta | /canta/theme/ani_model.py | UTF-8 | 5,474 | 2.625 | 3 | [] | no_license | #! /usr/bin/python -O
# -*- coding: utf-8 -*-
#
# CANTA - A free entertaining educational software for singing
# Copyright (C) 2007 S. Huchler, A. Kattner, F. Lopez
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... | true |
3fe49c58ae92d857007b62fd30a232e01b060504 | Python | tawender/Python_Programs | /charge per charge/HVcharge_q_verification.py | UTF-8 | 14,023 | 2.671875 | 3 | [] | no_license | import visa
import numpy
import threading
import time
import Queue
from matplotlib import pyplot as plot
import os.path
import sys
sys.path.append("T:\python programs\modules")
import Instruments
import pyNIDAQ
class data_plots(object):
def __init__(self,path):
self.plot_number = 1
self.path = pa... | true |
636e8bb6aa5ca59f049f76a26a2fc5589c0bea23 | Python | Jackrwal/Draughts-Game-AI | /Draughts/Move.py | UTF-8 | 1,236 | 3.5625 | 4 | [] | no_license | class Move:
__doc__ = "An object to contain the information relative to a move in a Draughts game"
__player = ""
__piece = object
__target = ""
__score = -1
# used for tracking sequences of moves
__next = object
__prev = object
# constructs a Move object
# player - The Playe... | true |
9ea4afce7f09df7adbd9ced5a7ec61fa51801f31 | Python | michaeldashiell/Job-Interview-Tests-Python- | /fizzBUZZ.py | UTF-8 | 341 | 3.546875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 10:41:59 2020
@author: Michael
"""
###
count = 0
while count < 100:
count = count + 1
if count % 15 == 0:
print('fizzbuzz')
elif count % 3 == 0:
print('fizz')
elif count % 5 == 0:
print('buzz')
else:
... | true |
be55f5ac4cad7a1ea0b2fcb3ecd0cbee71ed4f22 | Python | nulipinbobuyanqi/APITestFramework | /Utils/operation_yml.py | UTF-8 | 1,990 | 2.984375 | 3 | [] | no_license | # coding:utf-8
# @Author: wang_cong
# @File: operation_yml.py
# @Project: AutoCreateCaseTool
# @Time: 2021/5/21 15:51
import os
def get_yaml_data(yaml_path, yaml_file_name):
"""
读取yaml文件,返回一个dict类型的数据
:param yaml_path: yaml文件所在路径,不含最后一个"/"符号
:param yaml_file_name: yaml文件名称,不含".yaml"后缀名
:return: 返回... | true |
ff320966c434452a38a2bfbf4a776d8b609520a0 | Python | acedit/Python_kurs | /week2'3/sum_divisors.py | UTF-8 | 118 | 3.5 | 4 | [] | no_license | n=input("Enter n:")
n=int(n)
suma=0
for delitel in range(1,n):
if n%delitel==0:
suma+=delitel
print(suma)
| true |
1e164de79039e7fde41b089bb9b83ce61ccc0129 | Python | wangzaogen/python_learn | /static/cmd.py | UTF-8 | 593 | 3.078125 | 3 | [] | no_license | import os
import sched
import time
from datetime import datetime
schedule = sched.scheduler(time.time, time.sleep)
def tip(inc):
os.system("msg * 是时候喝口水动一动了")
print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
schedule.enter(inc, 0, tip, (inc,))
def main(inc=60):
# enter四个参数分别为:间隔事件、优先级(用于同时间到达的两个事件... | true |
1039558c67005f61f83ef3dbddc58ca341c772c5 | Python | alexbodin/EENX15_Machinelearning | /coordiantes.py | UTF-8 | 2,556 | 3.125 | 3 | [] | no_license |
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import random
import cv2
import os
# returns the image data from a file-path
def load_img_from_file(path):
img = cv2.imread(path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return img
# input: an image to locate boxes in
# output: li... | true |
326461dc09f243bc2d7b2b1c01556489f046e2b9 | Python | byAbaddon/Basics-Course-Python-March-2020 | /Exam - 28 and 29 March 2020/02. Cat Walking/02. Cat Walking.py | UTF-8 | 378 | 3.546875 | 4 | [] | no_license | minutes = int(input())
day_walk = int(input())
calories = int(input())
all_walk = minutes * day_walk
burnet_calories = all_walk * 5
if calories / 2 <= burnet_calories:
print(f'Yes, the walk for your cat is enough. Burned calories per day: {burnet_calories}.')
else:
print(f'No, the walk for your cat is n... | true |
99b5ca86df1b78848acb868103a4ab0ec66e743b | Python | ilgazyuksel/data_engineering_capstone | /scripts/global_temperatures.py | UTF-8 | 1,873 | 2.765625 | 3 | [] | no_license | """
Global temperatures etl script.
"""
from pyspark.sql import DataFrame
from utils.helper import add_decade_column
from utils.io import (
create_spark_session,
get_config_path_from_cli,
provide_config,
read_with_meta,
write_with_meta
)
def rename(df: DataFrame) -> DataFrame:
"""
Rename ... | true |
ed49452befaeb881e5f8a55d6b4a33c353c96446 | Python | artheadsweden/python_advanced_nov_17 | /day2/async_idea4.py | UTF-8 | 2,653 | 3.21875 | 3 | [] | no_license | from collections import deque
from math import sqrt
import time
class Task:
next_id =0
def __init__(self, routine):
self.id = Task.next_id
Task.next_id += 1
self.routine = routine
class Scheduler:
def __init__(self):
self.runnable_tasks = deque()
self.complete... | true |
5adca2e50a59259b2f57600269a62470891940af | Python | madisonchamberlain/connect_n | /connectn.py | UTF-8 | 6,931 | 3.609375 | 4 | [] | no_license | #Make empty board
def make_board(num_rows: int, num_cols: int, blank_char: str) -> list:
board = []
for row_number in range(num_rows):
row = [blank_char] * num_cols
board.append(row)
return board
def display_game_state(board: list) -> None:
print(end=' ')
for col_num in range(len(bo... | true |
5d7303f0b84591eaeab8cdfe4ad85fb7b482303d | Python | solstice333/Arymatic | /lib/settings.py | UTF-8 | 14,079 | 3.234375 | 3 | [] | no_license | from lib.custom_exceptions import *
from collections.abc import Mapping
import json
import re
class Settings(Mapping):
"""class for accessing settings"""
_REPAT = r'(?P<pat>.*?):re(:(?P<flag>[AILMSX]+))?$'
@staticmethod
def _get_type_to_one_of():
"""return a dict of string types to one of method"... | true |
61075e62e16bfb41fb47f04b9662a7cacee4b901 | Python | devindhaliwal/EEG-Plots | /EEG Plot - User Choice Color Electrode Type/eeg_user_choice_plot.py | UTF-8 | 3,133 | 3.515625 | 4 | [] | no_license | import pandas as pd
import plotly.express as px
# function to display user choice menu and get correct option
def menu():
choice = input("Which category of electrodes would you like highlighted?\n1. None\n2. Peripheral Electrodes"
"\n3. 10-20 Electrodes\n4. 10-10 Electrodes\n5. Quit\nEnter numbe... | true |