模板python程序

propyte的Python项目详细描述


比重

简介

这是一个与python程序和实用程序相关联的模板。

设置

sudo pip install propyte

设置FestivaleSpeak,pico tts和 deep_throat用于语音 能力。

sudo apt install     \
    festival         \
    espeak           \
    libttspico0      \
    libttspico-utils \
    libttspico-data
sudo pip install deep_throat

为电报消息设置电报和电报信使cli 能力。

sudo su -
apt install         \
    libreadline-dev \
    libconfig-dev   \
    libssl-dev      \
    lua5.2          \
    liblua5.2-dev   \
    libevent-dev    \
    libjansson-dev  \
    libpython-dev   \
    make

cd /usr/share
git clone --recursive https://github.com/vysheng/tg.git
cd tg
./configure
make
cd ..
chmod -R 755 tg/

为UML表示设置Pylint和Graphviz

sudo apt install graphviz libgraphviz-dev python-dev
sudo pip install pylint pygraphviz

设置带有pushbullet消息的lxplus

设置PushBullet帐户,创建访问令牌并存储 文件~/.pushbullet中的pushBullet标记。在上安装pushbullet 移动设备。

MinicondA2用作环境。默认情况下,安装miniconda 在~/miniconda2处,miniconda2安装路径在path前面 在~/.bashrc中。

wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
chmod 755 Miniconda2-latest-Linux-x86_64.sh
./Miniconda2-latest-Linux-x86_64.sh

exportPATH=""${HOME}"/miniconda2/bin:$PATH"
pip install propyte
propyte_alert.py --text="hello world"

propyte_loop_alert_on_new_users.py

此脚本循环监视新用户连接(使用 psutil.users())并发送一个警报(使用pushBullet)is any are 检测。

走私

可以使用函数smuggle导入web模块。用这个 适当考虑安全性的功能。

shijian_test=propyte.smuggle(URL="https://raw.githubusercontent.com/wdbm/shijian/master/shijian.py")sys_test=propyte.smuggle(module_name="sys")

导入Ganzfeld,静音

上下文管理器函数import_ganzfeld可用于导入 使模块与命令行选项和 论据。这对root很有用。

withpropyte.import_ganzfeld():fromROOTimport*

上下文管理器函数silence可用于使某些 代码。

用户交互

有多种功能可用于用户交互: get_keystrokeget_y_or_nget_inputget_input_time_limitedpauseinterrogate

命令

函数engage_command可用于运行bash命令 在前台或后台使用子流程。

语音

函数say可用于使用数字生成语音 包括Festival、Espeak、Pico TTS和 喉咙很深。

通知

电报

该模块提供电报信息功能。它可以发送和 接收电报信息。它使用telegram、telegram cli和 皮特格。

为了使用电报功能,确保电报和 正在运行telegram cli。函数start_messaging_Telegram 如果未检测到telegram cli正在运行,则尝试启动它。

/usr/share/tg/bin/telegram-cli     \
    -R                             \
    -W                             \
    -P 4458\
    -k /usr/share/tg/tg-server.pub \
    --json                         \
    --permanent-peer-ids           \
    --permanent-peer-ids           \
    --disable-output               \
    --daemonize

信息的发送方式如下:

importpropytepropyte.start_messaging_Telegram()propyte.send_message_Telegram(recipient="@wbreadenmadden",text="hi")

消息接收可以通过以下方式进行:

import propyte
propyte.start_messaging_Telegram()
propyte.start_receiving_messages_Telegram()

可以通过多种方式访问接收到的消息 函数参数。

propyte.get_messages_received_Telegram()
propyte.get_last_message_received_Telegram()
propyte.get_text_last_message_received_Telegram()

按钮

消息可以按如下方式发送:

importpropytepropyte.start_messaging_Pushbullet()propyte.send_message_Pushbullet(recipient="alice@neutronmail.ch",title="alert",text="This is an alert.")propyte.send_message_Pushbullet(recipients=["alice@neutronmail.ch"],title="alert",text="This is an alert.")propyte.send_message_Pushbullet(recipient="alice@neutronmail.ch",title="price alert",filepath="prices.png")

新用户上的propyte循环警报。py

此脚本在检测到新用户或用户时发送pushbullet警报 变化。

UML

python项目的uml图可以使用pylint和 格拉夫维兹。这可以通过在中执行bash脚本UML.sh 项目的工作目录。这将执行以下操作 命令:

project_name="${PWD##*/}"
pyreverse -my -A -o png -p ${project_name} **.py

这将生成两个图像,classes_propyte.pngpackages_propyte.png。类图像是 项目的类,它们各自的数据属性(带类型), 他们各自的方法和继承。包图像是 表示项目的模块依赖项。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
添加到Linkedlist后int与Integer的java比较不起作用   服务器启动时来自tomcat的java通知回调   在java中如何将float转换为double?   使用Java数据Bean连接到Siebel时出错   我如何反对像Java这样的强类型语言中的Ducktyping呢?   运行vert的json。x与java安全管理器   java大O表示法解释嵌套while循环   配置My gradle java项目找不到log4j2。json   验证我需要编写一个包含特殊字符和0到9的数字的java字符串来验证密码   java Univocity解析器:从这里调用函数无效:parserSettings。选择字段(*some_function*);   java在MVC上应用TDD   运行时的java按钮开关   Java8:如何流式处理int数组、提取低位字节和创建字节数组   linux无法在从Java启动的子进程中为SIGQUIT设置信号处理程序   Gradle具有真正混合的java和scala源代码