Question

I've read most that I can on the error and I can't see how it pertains to this class I'm writing.

# 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)

It complains on these lines:

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

Solution

You have 'empty' functions before each of those 4. Add a pass statement to those:

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

def checkout(self):
    #t
    pass

def _write_cfg(self):
    #t
    pass

def _read_cfg(self):
    #t
    pass
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top