CLSLQ

clslq

clslq package

Subpackages

clslq.notion package
Submodules
clslq.notion.blocks module
clslq.notion.databases module
database()
clslq.notion.pages module
clslq.notion.searchall module
Module contents
clslq.templates package
Submodules
clslq.templates.monthreport module
clslq.templates.weekreport module
Module contents

Submodules

clslq.cli module

cli

click.group(name=’main’)

clslq.cli_clslq_notion module

cli_month(client, clsconfig, remove, force, send)

Generate work report every month

参数
  • client (object) – Notion client instance

  • clsconfig (dict) – Config instance of .clslq.json

  • remove (bool) – Remove dumped files or not

  • force (bool) – Force generate or not

  • send (bool) – Send email or not

cli_week(client, clsconfig, excel, remove, force, send)

Generate work report every week

参数
  • client (object) – Notion client instance

  • clsconfig (dict) – Config instance of .clslq.json

  • excel (bool) – Support dump excel or not

  • remove (bool) – Remove dumped files or not

  • force (bool) – Force generate or not

  • send (bool) – Send email or not

clslq.cli_clslq_pip module

cli_clslq_pip

Usage: clslq pip [OPTIONS]

The wrapper for pip, use local pypi as default.

Options:
-t, --trusted-host TEXT

The trusted mirror host, default: tuna mirror.

-i, --pypi TEXT

The pypi mirror url, default use: https://pypi.org/

-h, --help

Show this message and exit.

clslq.cli_clslq_upgrade module

clslq.cli_clslq_venv module

clslq.cli_git module

clslq.cli_notion_backup module

clslq_notion_backup

Notion client in python, notion-py is required

Usage: clslq notion_backup [OPTIONS]

clslq.clslq_notion_export module

exporter(client, clsconfig)

Get week tasks, dump them into month table

Search all pages and child pages that are shared with the integration.

The results may include databases. The query parameter matches against the page titles. If the query parameter is not provided, the response will contain all pages (and child pages) in the results.

The filter parameter can be used to query specifically for only pages or only databases.

clslq.clslq_notion_mreport module

class MonthReport(wbname)

基类:clslq.clslq_notion_report.Report

belongs(date)
block_common_types(client, b)
block_list_children(client, block, tag, level=0)

Recursive function

block_parse_table(client, b)
block_parse_table_cell_properties(properties, key)
content_parse_richtext(item, text)

Parse Notion Column content

参数
  • item (dict) – Notion Column content

  • text (str) – Unicode string means column title

返回

Cell result

返回类型

str

content_parse_state(item)
content_parse_title(item)
content_parse_type(item)
img_url_to_base64(url)
init(title, user, department, force)
property mtitle
parse_week_tasks(database, weekdatestr)
render_block_items(client, page)
render_block_list(client, block, tag, level)

Recurisve <ol><ul><li> tags management

render_directions(database)
render_duties(database)
render_html(title)

Render html form template

Note that some of the email display methods only support inline-css style, This method support inline-css for table headers and rows.

参数

title (str) – Title of html and email subject

render_itor_database(client, dbid, title, database, force)
render_maintainance(database)
render_maintarget(database)
render_patent(database)
render_programming_work(database)
render_reading_books(client, database)
render_reading_share(database)
render_review(database)
render_study_html(title)

Render html form template

Note that some of the email display methods only support inline-css style, This method support inline-css for table headers and rows.

参数

title (str) – Title of html and email subject

render_study_note(client, database)
render_teamtarget(database)
render_techissues(database)
render_technology(database)
week_belongs(sdate, edate)

clslq.clslq_notion_report module

class Report(wbname)

基类:object

Base class of Report

参数

object (wbname) – Workbook name, generated document file name

property now
remove_files()

Removes all generated files

render_html_without_inline_css(title, df)

Render html form template, use pandas

Note that some of the email display methods only support inline-css style, This method does not use any inline-css for table headers and rows.

Deprecated

参数
  • title (str) – Title of html and email subject

  • df (object) – Pandas DataFrame object

send_email(config, title)

Send report email to receivers defined in .clslq.json

参数
  • config (dict) – Loaded json object from .clslq.json

  • title (str) – Unicode string as email subject

send_study_email(config, title, email_html)

Send report email to receivers defined in .clslq.json

参数
  • config (dict) – Loaded json object from .clslq.json

  • title (str) – Unicode string as email subject

clslq.clslq_notion_wreport module

class WeekReport(wbname)

基类:clslq.clslq_notion_report.Report

content_parse_richtext(item, text)

Parse Notion Column content

参数
  • item (dict) – Notion Column content

  • text (str) – Unicode string means column title

返回

Cell result

返回类型

str

content_parse_state(item, row)
content_parse_title(item)
content_parse_type(item, row)
excel_worksheet_dump(wbname, database)
excel_worksheet_fill(item, row)
pandas_df_fill(database)
render_html(clsconfig, title, database)

Render html form template

Note that some of the email display methods only support inline-css style, This method support inline-css for table headers and rows.

参数
  • title (str) – Title of html and email subject

  • df (object) – Pandas DataFrame object

set_worksheet_head(head)

Set sheet head

参数

head (worksheet head) – string

set_worksheet_title()

openpyxl 不支持按列设置样式

week_belongs(sdate, edate)

clslq.version module

1.3.2

Module contents

About clslq

这算是个人工具集,最早我用shell整理自己的快捷工具集,很长一段时间里,跨平台是一个问题。

对于初学Python的我来讲,需要通过一个项目来逐步打开世界之门。

clslq的名称,来自于随手一按,后面的工具都是这个命令的子命令,比如

clslq notion -f # 从Notion中生成当周的工作日志
clslq venv # 在当前目录下创建python virtualenv

FAQ of clslq

1、clslq项目要完善哪些内容?

  • 收集个人常用命令行,集成到clslq中

  • 新增一些效率子命令

License

MIT License

Copyright (c) 2021 Connard Lee

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.