本文整理匯總了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)