gpt4 book ai didi

python - PEP8 E112 不应该出现缩进错误?

转载 作者:行者123 更新时间:2023-11-30 23:37:33 29 4
gpt4 key购买 nike

我已经阅读了有关该错误的大部分内容,但我看不出它与我正在编写的这个类有何关系。

# Copyright (C) 2013 Marco Ceppi <marco@ceppi.net>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os
import ConfigParser

from bzrlib.bzrdir import BzrDir


class Mr:
def __init__(self, directory=False, config=False, trust_all=False):
self.directory = directory or os.getcwd()
self.control_dir = os.path.join(self.directory, '.bzr')
self.trust_all = trust_all
self.config_file = config or os.path.join(self.directory, '.mrconfig')

if self._check_repository_exists():
if not config or not os.path.exists(config):
raise Exception('No .mrconfig specified')
cp = ConfigParser.ConfigParser()
self.config = ConfigParser.read(config)
self.bzr_dir = BzrDir.open(self.directory)
else:
self.config = ConfigParser.RawConfigParser()
self.bzr_dir = BzrDir.create(self.directory)
self.bzr_dir.create_repository(shared=True)

def update(self):
#print 'Not today'

def add(self, name=False, repository='lp:charms'):
if not name:
raise Exception('No name provided')

def checkout(self):
#t

def remove(self, name=False):
if not name:
raise Exception('No name provided')

def _write_cfg(self):
#t

def _read_cfg(self):
#t

def _check_repository_exists(self):
# Eventually do more checks to make sure it is a shared repository
# and not a branch, etc.
return os.path.exists(self.control_dir)

它提示这些行:

def add(self, name=False, repository='lp:charms'):
def remove(self, name=False):
def _read_cfg(self):
def _check_repository_exists(self):

最佳答案

在这 4 个函数之前都有“空”函数。向这些函数添加 pass 语句:

def update(self):
#print 'Not today'
pass

def checkout(self):
#t
pass

def _write_cfg(self):
#t
pass

def _read_cfg(self):
#t
pass

关于python - PEP8 E112 不应该出现缩进错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15438950/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com