小型时区实用程序

atg的Python项目详细描述


https://api.travis-ci.org/crodjer/atg.svghttps://coveralls.io/repos/crodjer/atg/badge.svg?branch=master
$ atg Mountain View
Their timezone is "America/Los_Angeles"
Their time: Sat Jul  4 07:13:34 2015
People there may be sleeping.
Convenient time slots:
    08:00 to 11:00 here i.e. 19:30 to 22:30 there
    20:30 to 22:30 here i.e. 08:00 to 10:00 there

功能

  • Get the timezone for a random address.
  • Current time anywhere.
  • Guesses about what people may be doing.
  • Helps you schedule meetings by providing you spans of convenient times.

安装

这是一个python包,可以通过pip:

# $HOME/.local/bin should be in $PATH for this to work.
$ pip install --user atg

要全局安装,请运行:

$ sudo pip install atg

用法

mountain view获取有关时间的所有信息

$ atg Mountain View
Their timezone is "America/Los_Angeles"
Their time: Sat Jul  4 07:13:34 2015
People there may be sleeping.
Convenient time slots:
    08:00 to 11:00 here i.e. 19:30 to 22:30 there
    20:30 to 22:30 here i.e. 08:00 to 10:00 there

如果你不想每次都查询时区到google的maps api,你可以 可以在进一步的请求中直接使用时区:

$ atg America/Los_Angeles

默认情况下,atg基于计算时隙来避免睡眠周期。你可以 使用--dnd对此进行自定义。例如,为了避免工作/睡眠中的干扰:

$ atg Mountain View --dnd work --dnd sleep

您还可以指定时间段应该方便的对象。默认情况下 两者都要考虑。如果您想方便地为远程位置计时:

$ atg Mountain View -c there

您也可以使用标志--convenient-for标志。如果你不在乎 远程定位的便利性:

$ atg Mountain View --convenient-for here

帮助

您始终可以通过atg -h引用命令用法。

usage: atg [-h] [--dnd {work,sleep,available}] [-c {here,there}]
           [-m MY_LOCATION] [-x {timezone,now,default,status,schedule}]
           remote [remote ...]

positional arguments:
  remote                the remote location

optional arguments:
  -h, --help            show this help message and exit
  --dnd {work,sleep,available}
                        the do not disturb activities (default: sleep)
  -c {here,there}, --convenient-for {here,there}
                        which side's convenience should be considered
                        (default: both)
  -m MY_LOCATION, --my-location MY_LOCATION
                        specify your own location (default from system time)
  -x {timezone,now,default,status,schedule}, --command {timezone,now,default,status,schedule}
                        the command for atg to execute

开发和测试

atg使用pytztzlocalenum34(用于向后兼容)作为依赖项。

要设置用于开发的内容,请创建并激活一个virtualenv,然后运行

$ pip install -e .[dev,test]
$ python setup.py develop

测试

通过以下途径运行测试:

$ nosetests

错误

可能很多。请向我们发送有关githubissue tracker的报告。补丁也很受欢迎。

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

推荐PyPI第三方库


热门话题
java如何显示因用户而异的SQLite存储数据?   转换java。sql。将映射传递给Jackon的valueToTree方法时StringNode的时间戳   从java中的列表json获取值   unicode Java字符存储在什么编码中?   java如何让Spring数据存储库中的默认方法命中缓存?   java使用readClassDescriptor()和resolveClass()来允许序列化版本控制   数组通过另一个矩阵的一部分填充矩阵   如果包含使用正则表达式的字符串,则替换父XML标记的java   java清除SharedReference中的单个变量   java将变量值从一个jsp页面传输到另一个jsp页面   java JDBC+SQLite:DriveManager不加载所需的驱动程序   相同源代码的java Kotlin构建生成不同的二进制文件   Java中的元组枚举