Codestyle: Start comments with space

We didn't really discuss this one, but apparently it's in PEP8 so I'd better do it.

Contributes to issue CURA-844.
This commit is contained in:
Ghostkeeper 2016-04-28 12:15:43 +02:00
parent 0e92929be4
commit 7ad2fbc95d
3 changed files with 19 additions and 19 deletions

View file

@ -26,9 +26,9 @@ class MachineInstance:
# \param serialised A string with the contents of a machine instance file.
def __init__(self, serialised):
config = configparser.ConfigParser(interpolation = None)
config.read_string(serialised) #Read the input string as config file.
config.read_string(serialised) # Read the input string as config file.
#Checking file correctness.
# Checking file correctness.
if not config.has_section("general"):
raise SettingsError.InvalidFormatError("general")
if not config.has_option("general", "version"):
@ -37,7 +37,7 @@ class MachineInstance:
raise SettingsError.InvalidFormatError("general/name")
if not config.has_option("general", "type"):
raise SettingsError.InvalidFormatError("general/type")
if int(config.get("general", "version")) != 1: #Explicitly hard-code version 1, since if this number changes the programmer MUST change this entire function.
if int(config.get("general", "version")) != 1: # Explicitly hard-code version 1, since if this number changes the programmer MUST change this entire function.
raise SettingsError.InvalidVersionError("Version upgrade intermediary version 1")
self._type_name = config.get("general", "type")
@ -58,13 +58,13 @@ class MachineInstance:
# \return A serialised form of this machine instance, serialised in
# version 2 of the file format.
def exportVersion2(self):
import VersionUpgrade21to22 #Import here to prevent circular dependencies.
config = configparser.ConfigParser(interpolation = None) #Build a config file in the form of version 2.
import VersionUpgrade21to22 # Import here to prevent circular dependencies.
config = configparser.ConfigParser(interpolation = None) # Build a config file in the form of version 2.
config.add_section("general")
config.set("general", "name", self._name)
config.set("general", "type", self._type_name)
config.set("general", "version", "2") #Hard-code version 2, since if this number changes the programmer MUST change this entire function.
config.set("general", "version", "2") # Hard-code version 2, since if this number changes the programmer MUST change this entire function.
if self._variant_name:
config.set("general", "variant", self._variant_name)
if self._key:

View file

@ -27,13 +27,13 @@ class Profile:
parser = configparser.ConfigParser(interpolation = None)
parser.read_string(serialised)
#Check correctness.
# Check correctness.
if not parser.has_section("general"):
raise SettingsError.InvalidFormatError("general")
if not parser.has_option("general", "version") or int(parser.get("general", "version")) != 1: #Hard-coded profile version here. If this number changes the entire function needs to change.
raise SettingsError.InvalidVersionError("Version upgrade intermediary version 1")
#Parse the general section.
# Parse the general section.
self._name = parser.get("general", "name")
self._type = parser.get("general", "type", fallback = None)
if "weight" in parser["general"]:
@ -50,13 +50,13 @@ class Profile:
else:
self._material_name = None
#Parse the settings.
# Parse the settings.
self._settings = {}
if parser.has_section("settings"):
for key, value in parser["settings"].items():
self._settings[key] = value
#Parse the defaults and the disabled defaults.
# Parse the defaults and the disabled defaults.
self._changed_settings_defaults = {}
if parser.has_section("defaults"):
for key, value in parser["defaults"].items():
@ -73,11 +73,11 @@ class Profile:
# \return A serialised form of this profile, serialised in version 2 of
# the file format.
def exportVersion2(self):
import VersionUpgrade21to22 #Import here to prevent circular dependencies.
import VersionUpgrade21to22 # Import here to prevent circular dependencies.
config = configparser.ConfigParser(interpolation = None)
config.add_section("general")
config.set("general", "version", "2") #Hard-coded profile version 2
config.set("general", "version", "2") # Hard-coded profile version 2
config.set("general", "name", self._name)
if self._type:
config.set("general", "type", self._type)
@ -107,7 +107,7 @@ class Profile:
if self._disabled_settings_defaults:
VersionUpgrade21to22.VersionUpgrade21to22.translateSettingNames(self._disabled_settings_defaults)
config.add_section("disabled_defaults")
disabled_defaults_string = str(self._disabled_settings_defaults[0]) #Must be at least 1 item, otherwise we wouldn't enter this if statement.
disabled_defaults_string = str(self._disabled_settings_defaults[0]) # Must be at least 1 item, otherwise we wouldn't enter this if statement.
for item in self._disabled_settings_defaults[1:]:
disabled_defaults_string += "," + str(item)

View file

@ -1,10 +1,10 @@
# Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.VersionUpgrade import VersionUpgrade #Superclass of the plugin.
from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin.
from . import MachineInstance #To upgrade machine instances.
from . import Profile #To upgrade profiles.
from . import MachineInstance # To upgrade machine instances.
from . import Profile # To upgrade profiles.
## Converts configuration from Cura 2.1's file formats to Cura 2.2's.
#
@ -28,7 +28,7 @@ class VersionUpgrade21to22(VersionUpgrade):
# not of the correct format.
def upgradeProfile(self, serialised):
profile = Profile.importVersion1(serialised)
if not profile: #Invalid file format.
if not profile: # Invalid file format.
return None
return profile.exportVersion2()
@ -42,10 +42,10 @@ class VersionUpgrade21to22(VersionUpgrade):
@staticmethod
def translateSettings(settings):
for key, value in settings.items():
if key == "speed_support_lines": #Setting key was changed for 2.2.
if key == "speed_support_lines": # Setting key was changed for 2.2.
del settings[key]
settings["speed_support_infill"] = value
if key == "retraction_combing": #Combing was made into an enum instead of a boolean.
if key == "retraction_combing": # Combing was made into an enum instead of a boolean.
settings[key] = "off" if (value == "False") else "all"
return settings