Skip to content

Commit 05a9823

Browse files
authored
Releases v0.12.3b2 (#263)
1 parent f36a72d commit 05a9823

24 files changed

+745
-285
lines changed

bin/copyright.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
StrPattern = re.Pattern
2222

2323
CURRENT_YEAR = str(datetime.datetime.now().year)
24+
COPYRIGHT_EMPTY_LINE_RE = re.compile(r"^((?:#[^\n]*\n)+)([^\n#\"\'])")
25+
COPYRIGHT_EMPTY_LINE_SUB = r"\1\n\2"
2426

2527

2628
def main() -> None:
@@ -32,6 +34,11 @@ def main() -> None:
3234
args_parser.add_argument(
3335
"--required", action="store_true", help="The copyright is required"
3436
)
37+
args_parser.add_argument(
38+
"--fill-empty-line",
39+
action="store_true",
40+
help="Empty line needed between copyright and code",
41+
)
3542
args_parser.add_argument(
3643
"--verbose", "-v", action="store_true", help="Verbose mode"
3744
)
@@ -130,6 +137,7 @@ def main() -> None:
130137
file_name,
131138
args.required,
132139
args.verbose,
140+
args.fill_empty_line,
133141
)
134142
if not file_success:
135143
success = False
@@ -155,6 +163,7 @@ def update_file(
155163
filename: str = "<unknown>",
156164
required: bool = False,
157165
verbose: bool = False,
166+
fill_empty_line: bool = False,
158167
current_year: str = CURRENT_YEAR,
159168
) -> Tuple[bool, str]:
160169
"""Update the copyright header of the file content."""
@@ -176,6 +185,11 @@ def update_file(
176185
)
177186

178187
if two_date_match.group("to") in (last_year, current_year):
188+
copyright_space_match = COPYRIGHT_EMPTY_LINE_RE.search(content)
189+
if fill_empty_line and copyright_space_match:
190+
return False, COPYRIGHT_EMPTY_LINE_RE.sub(
191+
COPYRIGHT_EMPTY_LINE_SUB, content
192+
)
179193
return True, content
180194

181195
return False, two_date_re.sub(
@@ -190,6 +204,11 @@ def update_file(
190204
copyright_year = one_date_match.group("year")
191205

192206
if copyright_year == last_year:
207+
copyright_space_match = COPYRIGHT_EMPTY_LINE_RE.search(content)
208+
if fill_empty_line and copyright_space_match:
209+
return False, COPYRIGHT_EMPTY_LINE_RE.sub(
210+
COPYRIGHT_EMPTY_LINE_SUB, content
211+
)
193212
return True, content
194213

195214
return False, one_date_re.sub(

docs/source/base-tables.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,10 @@ open_writer 创建的 Writer 对象通过 multiprocessing 标准库传递到需
437437
>>> # 如果分区 pt=p1 或 pt=p2 不存在,将会自动创建。
438438
>>> o.write_table('test_part_table', df, partition_cols=['pt'], create_partition=True)
439439
440+
.. note::
441+
442+
``partition_cols`` 参数从 PyODPS 0.12.3 开始支持。在此之前的版本请使用 ``partitions`` 参数。
443+
440444
压缩选项
441445
~~~~~~~~
442446
为加快数据上传 / 下载速度,你可以在上传 / 下载数据时设置压缩选项。具体地,可以创建一个 ``CompressOption``

0 commit comments

Comments
 (0)