本文整理汇总了Python中pycodestyle.readlines方法的典型用法代码示例。如果您正苦于以下问题:Python pycodestyle.readlines方法的具体用法?Python pycodestyle.readlines怎么用?Python pycodestyle.readlines使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycodestyle
的用法示例。
在下文中一共展示了pycodestyle.readlines方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_file
# 需要导入模块: import pycodestyle [as 别名]
# 或者: from pycodestyle import readlines [as 别名]
def load_file(self):
if self.filename in ("stdin", "-", None):
self.filename = "stdin"
self.lines = pycodestyle.stdin_get_value().splitlines(True)
else:
self.lines = pycodestyle.readlines(self.filename)
if not self.tree:
self.tree = ast.parse("".join(self.lines))
示例2: get_lines
# 需要导入模块: import pycodestyle [as 别名]
# 或者: from pycodestyle import readlines [as 别名]
def get_lines(filename):
if filename in ('stdin', '-', None):
return stdin_utils.stdin_get_value().splitlines(True)
else:
return pep8.readlines(filename)
示例3: _load_source
# 需要导入模块: import pycodestyle [as 别名]
# 或者: from pycodestyle import readlines [as 别名]
def _load_source(self):
"""Loads the file in a way that auto-detects source encoding and deals
with broken terminal encodings for stdin.
Stolen from flake8_import_order because it's good.
"""
if self.filename in ("stdin", "-", None):
self.filename = "stdin"
self.lines = stdin_utils.stdin_get_value().splitlines(True)
else:
self.lines = pycodestyle.readlines(self.filename)
if not self.tree:
self.tree = ast.parse("".join(self.lines))
示例4: load_file
# 需要导入模块: import pycodestyle [as 别名]
# 或者: from pycodestyle import readlines [as 别名]
def load_file(self):
"""Loads the file in a way that auto-detects source encoding and deals
with broken terminal encodings for stdin.
Stolen from flake8_import_order because it's good.
"""
if self.filename in ("stdin", "-", None):
self.filename = "stdin"
self.lines = pycodestyle.stdin_get_value().splitlines(True)
else:
self.lines = pycodestyle.readlines(self.filename)
if not self.tree:
self.tree = ast.parse("".join(self.lines))
示例5: get_file_contents
# 需要导入模块: import pycodestyle [as 别名]
# 或者: from pycodestyle import readlines [as 别名]
def get_file_contents(self):
if self.filename in ('stdin', '-', None):
return stdin_get_value().splitlines(True)
else:
if self.lines:
return self.lines
else:
return readlines(self.filename)