Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
喜羊羊3508
Dak
提交
f1bb28a3
D
Dak
项目概览
喜羊羊3508
/
Dak
10 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dak
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f1bb28a3
编写于
1月 01, 2023
作者:
A
Ansgar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add some more type annotations
上级
daceadb7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
19 deletion
+20
-19
dak/acl.py
dak/acl.py
+5
-5
dak/add_user.py
dak/add_user.py
+2
-1
dak/admin.py
dak/admin.py
+10
-10
daklib/upload.py
daklib/upload.py
+1
-1
daklib/utils.py
daklib/utils.py
+2
-2
未找到文件。
dak/acl.py
浏览文件 @
f1bb28a3
...
...
@@ -18,12 +18,12 @@
import
os
import
sys
from
typing
import
Optional
from
typing
import
NoReturn
,
Optional
from
daklib.dbconn
import
DBConn
,
Fingerprint
,
Keyring
,
Uid
,
ACL
def
usage
(
status
=
0
)
:
def
usage
(
status
:
int
=
0
)
->
NoReturn
:
print
(
"""Usage:
dak acl set-fingerprints <acl-name>
dak acl export-per-source <acl-name>
...
...
@@ -75,7 +75,7 @@ def get_fingerprint(entry: str, session) -> Optional[Fingerprint]:
return
q
.
all
()
def
acl_set_fingerprints
(
acl_name
,
entries
):
def
acl_set_fingerprints
(
acl_name
,
entries
)
->
None
:
session
=
DBConn
().
session
()
acl
=
session
.
query
(
ACL
).
filter_by
(
name
=
acl_name
).
one
()
...
...
@@ -94,7 +94,7 @@ def acl_set_fingerprints(acl_name, entries):
session
.
commit
()
def
acl_export_per_source
(
acl_name
)
:
def
acl_export_per_source
(
acl_name
:
str
)
->
None
:
session
=
DBConn
().
session
()
acl
=
session
.
query
(
ACL
).
filter_by
(
name
=
acl_name
).
one
()
...
...
@@ -152,7 +152,7 @@ def acl_allow(acl_name, fingerprint, sources):
session
.
commit
()
def
acl_deny
(
acl_name
,
fingerprint
,
sources
)
:
def
acl_deny
(
acl_name
:
str
,
fingerprint
:
str
,
sources
:
list
[
str
])
->
None
:
tbl
=
DBConn
().
tbl_acl_per_source
session
=
DBConn
().
session
()
...
...
dak/add_user.py
浏览文件 @
f1bb28a3
...
...
@@ -20,6 +20,7 @@ add his key to the GPGKeyring
import
subprocess
import
sys
import
apt_pkg
from
typing
import
NoReturn
from
daklib
import
utils
from
daklib.dbconn
import
DBConn
,
get_or_set_uid
,
get_active_keyring_paths
...
...
@@ -33,7 +34,7 @@ Logger = None
################################################################################
def
usage
(
exit_code
=
0
)
:
def
usage
(
exit_code
:
int
=
0
)
->
NoReturn
:
print
(
"""Usage: add-user [OPTION]...
Adds a new user to the dak databases and keyrings
...
...
dak/admin.py
浏览文件 @
f1bb28a3
...
...
@@ -23,7 +23,7 @@ import collections
import
json
import
sys
from
dataclasses
import
dataclass
from
typing
import
Any
,
Callable
from
typing
import
Any
,
Callable
,
NoReturn
,
Optional
,
Sequence
import
apt_pkg
...
...
@@ -42,21 +42,21 @@ dryrun = False
################################################################################
def
warn
(
msg
)
:
def
warn
(
msg
:
str
)
->
None
:
print
(
msg
,
file
=
sys
.
stderr
)
def
die
(
msg
,
exit_code
=
1
)
:
def
die
(
msg
:
str
,
exit_code
:
int
=
1
)
->
NoReturn
:
print
(
msg
,
file
=
sys
.
stderr
)
sys
.
exit
(
exit_code
)
def
die_arglen
(
args
,
args_needed
,
msg
)
:
def
die_arglen
(
args
:
Sequence
,
args_needed
:
int
,
msg
:
str
)
->
None
:
if
len
(
args
)
<
args_needed
:
die
(
msg
)
def
get_suite_or_die
(
suite_name
,
session
=
None
,
error_message
=
None
)
:
def
get_suite_or_die
(
suite_name
:
str
,
session
=
None
,
error_message
:
Optional
[
str
]
=
None
)
->
Suite
:
suite
=
get_suite
(
suite_name
.
lower
(),
session
=
session
)
if
suite
is
None
:
if
error_message
is
None
:
...
...
@@ -65,7 +65,7 @@ def get_suite_or_die(suite_name, session=None, error_message=None):
return
suite
def
usage
(
exit_code
=
0
)
:
def
usage
(
exit_code
:
int
=
0
)
->
NoReturn
:
"""Perform administrative work on the dak database."""
print
(
"""Usage: dak admin COMMAND
...
...
@@ -192,7 +192,7 @@ Perform administrative work on the dak database.
################################################################################
def
__architecture_list
(
d
,
args
):
def
__architecture_list
(
d
,
args
)
->
NoReturn
:
q
=
d
.
session
().
query
(
Architecture
).
order_by
(
Architecture
.
arch_string
)
for
j
in
q
.
all
():
# HACK: We should get rid of source from the arch table
...
...
@@ -304,7 +304,7 @@ def component_add(args):
session
.
commit
()
def
component_rm
(
name
)
:
def
component_rm
(
name
:
str
)
->
None
:
session
=
DBConn
().
session
()
component
=
get_component
(
name
,
session
)
session
.
delete
(
component
)
...
...
@@ -316,7 +316,7 @@ def component_rm(name):
session
.
commit
()
def
component_rename
(
oldname
,
newname
)
:
def
component_rename
(
oldname
:
str
,
newname
:
str
)
->
None
:
session
=
DBConn
().
session
()
component
=
get_component
(
oldname
,
session
)
component
.
component_name
=
newname
...
...
@@ -366,7 +366,7 @@ def __suite_show(d, args):
print
(
su
.
details
())
def
__suite_add
(
d
,
args
,
addallarches
=
False
):
def
__suite_add
(
d
,
args
,
addallarches
=
False
)
->
None
:
die_arglen
(
args
,
4
,
"E: adding a suite requires at least a name and a version"
)
suite_name
=
args
[
2
].
lower
()
version
=
args
[
3
]
...
...
daklib/upload.py
浏览文件 @
f1bb28a3
...
...
@@ -412,7 +412,7 @@ class Changes:
return
NotImplemented
return
self
.
_key
()
==
other
.
_key
()
def
__lt__
(
self
,
other
)
->
bool
:
def
__lt__
(
self
,
other
:
'Changes'
)
->
bool
:
return
self
.
_key
()
<
other
.
_key
()
...
...
daklib/utils.py
浏览文件 @
f1bb28a3
...
...
@@ -37,7 +37,7 @@ import subprocess
import
errno
import
functools
from
collections.abc
import
Iterable
,
Mapping
,
Sequence
from
typing
import
NoReturn
,
Optional
,
TYPE_CHECKING
,
Union
from
typing
import
Literal
,
NoReturn
,
Optional
,
TYPE_CHECKING
,
Union
import
daklib.config
as
config
import
daklib.mail
...
...
@@ -167,7 +167,7 @@ def parse_deb822(armored_contents: bytes, signing_rules=0, keyrings=None) -> dic
################################################################################
def
parse_changes
(
filename
:
str
,
signing_rules
=
0
,
dsc_file
:
bool
=
False
,
keyrings
=
None
)
->
dict
[
str
,
str
]:
def
parse_changes
(
filename
:
str
,
signing_rules
:
Literal
[
-
1
,
0
,
1
]
=
0
,
dsc_file
:
bool
=
False
,
keyrings
=
None
)
->
dict
[
str
,
str
]:
"""
Parses a changes file and returns a dictionary where each field is a
key. The mandatory first argument is the filename of the .changes
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录