Comments (4)
class MyActor(Actor):
"""
This is a lengthy
multiline docstring.
"""
name = 'my_actor'
def process(self):
"""Short one-line docstring."""
mutliline_string_variable = (
'I am a multiline string.\n'
'This is my second line.'
)
from leapp-repository.
@vinzenz, @shaded-enmity, on Cabal we have agreed on the following multiline string formatting, which is actually incorrect as it includes whitespaces you most of the times don't want:
class MyClass():
multiline_attribute = '''
I hold some lengthy
multiline string.
'''
Take a look if you fancy the alternative formatting I used in the previous comment. I think it's better than:
mutliline_string_variable = 'I am a multiline string.\n' \
'This is my second line.'
I fear neither look pythonic enough for you. If so, propose another.
from leapp-repository.
What about this for multiline strings?
multiline_string = ('first line',
'second line')
And regarding multiline docstring, why not use PEP257? I.e. for one liner a phrase (ending in a period) with opening and closing quotes on the same line and for multi-line docstring the first line would be the same phrase, followed by a blank line, followed by a more elaborate description:
class SimpleClass(Object):
"""This is a simple class."""
class ComplicatedClass(Object):
"""
This is a more complicated class.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc porta sed
urna venenatis faucibus. Phasellus at bibendum ligula, a posuere metus.
"""
from leapp-repository.
The multiline_string
you propose is actually a tuple. So, yeah, in general I'm for the parenthesis version as I mentioned two comments above.
As to the use of PEP257, the thing is that it allows a bit of variations: "The summary line may be on the same line as the opening quotes or on the next line."
We'll allow just "on the next line". I guess that's the only difference. So I'll leave the PEP257 in the contribution guidelines, and just mention this one difference.
So, to wrap it up, here's the string & docstring formatting:
class MyActor(Actor):
"""
Start with a single-line brief summary of the actor (under the triple quotes).
Leave a blank line below the summary and then describe the actor's behaviour
here in detail.
"""
name = 'my_actor'
def process(self):
"""This is a simple method."""
complicated_method()
def complicated_method():
"""
This is a more complicated method.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc porta sed
urna venenatis faucibus. Phasellus at bibendum ligula, a posuere metus.
"""
mutliline_string = (
'I am a multiline string.\n'
'This is my second line.'
)
from leapp-repository.
Related Issues (20)
- CentOS 7,9 to Almalinux: missing named-user-options.conf HOT 7
- package leapp-upgrade-el7toel8-1:0.16.0-6.el7.elevate.8.noarch conflicts with leapp-upgrade-el8toel9 provided by leapp-upgrade-el8toel9-0.17.0-3.el8.noarch when upgrade almalinux 8 to 9 HOT 13
- Why does Leapp upgrade fails with 'NameError: global name 'dnf' is not defined' ? HOT 1
- NameError: global name 'dnf' is not defined HOT 1
- pes-events.json license HOT 5
- Leapp does not detect qemu64 CPU incompatibility with CentOS-9 HOT 4
- efibootmgr exit code 5 during leapp efi_finalization_fix HOT 2
- Unexpected format of target version: 7 HOT 3
- Enhancement: Support for luks encrypted root and non root filesystems HOT 6
- Leapp fails to detect all the ceph encrypted volumes HOT 1
- Current x86-64 microarchitecture is unsupported even though all flags are present HOT 14
- el8toel9: PostgreSQL upgrade warning even when using PostgreSQL 13 on EL8 HOT 1
- how to excluding a package during the upgrade process. HOT 1
- Package "X" from local repository "Y" has incorrect checksum HOT 5
- sysstat doesn't upgrade generated 7 data files correctly to 8 HOT 2
- Dependency Dashboard
- leapp preupgrade errors on OracleLinux 8 HOT 1
- leapp upgrade does not respect --target version HOT 3
- feature request: support custom content inside upgrade initramfs HOT 6
- "Detected custom leapp actors or files" false positive HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leapp-repository.