@@ -83,10 +83,10 @@ def latex(self):
8383
8484 @reify
8585 def css (self ):
86- """ Returns lesson-specific extra CSS.
86+ """Return lesson-specific extra CSS.
8787
88- If the lesson defines extra css , the scope of the styles is limited to ``.lesson-content``,
89- a div which contains the actual lesson content.
88+ If the lesson defines extra CSS , the scope of the styles is limited
89+ to ``.lesson-content``, which contains the actual lesson content.
9090 """
9191 css = self .info .get ("css" )
9292
@@ -200,7 +200,7 @@ def convert_url(url):
200200
201201 @staticmethod
202202 def limit_css_to_lesson_content (css ):
203- """ Returns ``css`` limited just to the ``.lesson-content`` element.
203+ """Return ``css`` limited just to the ``.lesson-content`` element.
204204
205205 This doesn't protect against malicious input.
206206 """
@@ -468,7 +468,7 @@ def _get_sessions(course, plan):
468468
469469
470470class CourseMixin :
471- """ Couple of methods common for both :class:`Course` and :class:`CourseLink`.
471+ """Methods common for both :class:`Course` and :class:`CourseLink`.
472472 """
473473
474474 @reify
@@ -506,10 +506,13 @@ def __str__(self):
506506
507507 data_filename = "info.yml" # for MultipleModelDirProperty
508508
509- # These two class attributes define what the function ``naucse.utils.forks:course_info`` returns from forks,
510- # meaning, the function in the fork looks at these lists that are in the fork and returns those.
511- # If you're adding an attribute to these lists, you have to make sure that you provide a default in
512- # the CourseLink attribute since the forks already forked will not be returning the value.
509+ # These two class attributes define what the function
510+ # ``naucse.utils.forks:course_info`` returns from forks,
511+ # meaning, the function in the fork looks at these lists
512+ # that are in the fork and returns those.
513+ # If you're adding an attribute to these lists, you have to
514+ # make sure that you provide a default in the CourseLink
515+ # attribute since existing forks don't contain the value.
513516 COURSE_INFO = ["title" , "description" , "vars" , "canonical" ]
514517 RUN_INFO = ["title" , "description" , "start_date" , "end_date" , "canonical" , "subtitle" , "derives" , "vars" ,
515518 "default_start_time" , "default_end_time" ]
@@ -583,7 +586,7 @@ def optional_convert_time(timestr):
583586
584587
585588class CourseLink (CourseMixin , Model ):
586- """ A link to a course from a separate git repo.
589+ """A link to a course from a separate git repo.
587590 """
588591
589592 link = YamlProperty ()
@@ -619,7 +622,9 @@ def base_course(self):
619622 return None
620623
621624 def render (self , page_type , * args , ** kwargs ):
622- """ Renders a page in the fork, checks the content and registers urls to freeze.
625+ """Render a page in the fork.
626+
627+ Check the content and registers URLs to freeze.
623628 """
624629 naucse .utils .views .forks_raise_if_disabled ()
625630
@@ -635,7 +640,8 @@ def render(self, page_type, *args, **kwargs):
635640 allowed_elements_parser .reset_and_feed (result .output ["content" ])
636641
637642 if "urls" in result .output :
638- # freeze urls generated by the code in fork, but only if they start with the slug of the course
643+ # Freeze URLs generated by the code in fork, but only if
644+ # they start with the slug of the course
639645 absolute_urls_to_freeze .extend ([url for url in result .output ["urls" ] if url .startswith (f"/{ self .slug } /" )])
640646
641647 return result .output
@@ -662,12 +668,14 @@ def lesson_static(self, lesson_slug, path):
662668 return filename .parent , filename .name
663669
664670 def get_footer_links (self , lesson_slug , page , ** kwargs ):
665- """ Returns links to previous page, to current session and to the next page. Each link
666- is either a dict with url and title keys or ``None``.
671+ """Return links to previous page, current session and the next page.
672+
673+ Each link is either a dict with 'url' and 'title' keys or ``None``.
667674
668- If :meth:`render_page` fails and a canonical versions is in the base repo, it's used instead
669- with a warning. This method provides the correct footer links for the page, since ``sessions``
670- is not included in the info provided by forks.
675+ If :meth:`render_page` fails and a canonical version is in the
676+ base repo, it's used instead with a warning.
677+ This method provides the correct footer links for the page,
678+ since ``sessions`` is not included in the info provided by forks.
671679 """
672680 naucse .utils .views .forks_raise_if_disabled ()
673681
@@ -728,7 +736,8 @@ def __str__(self):
728736
729737
730738class MetaInfo :
731- """ Info about the current repository. """
739+ """Info about the current repository.
740+ """
732741
733742 def __str__ (self ):
734743 return "Meta Information"
@@ -738,8 +747,10 @@ def __str__(self):
738747
739748 @reify
740749 def slug (self ):
741- """ Returns the slug of the repository based on the current branch. Returns the default if not on a branch,
742- the branch doesn't have a remote or the remote url can't be parsed.
750+ """Return the slug of the repository based on the current branch.
751+
752+ Returns the default if not on a branch, the branch doesn't
753+ have a remote, or the remote url can't be parsed.
743754 """
744755 from naucse .views import logger
745756
@@ -780,7 +791,7 @@ def slug(self):
780791
781792 @reify
782793 def branch (self ):
783- """ Returns the active branch name or master if not on a branch.
794+ """Return the active branch name, or ' master' if not on a branch.
784795 """
785796 from naucse .views import logger
786797
@@ -831,9 +842,10 @@ def meta(self):
831842
832843 @reify
833844 def safe_run_years (self ):
834- # since even the basic info about the forked runs can be broken, we need to make sure the required info
835- # is provided. If ``RAISE_FORK_ERRORS`` is set, exceptions are raised here, otherwise the run is
836- # ignored completely.
845+ # since even the basic info about the forked runs can be broken,
846+ # we need to make sure the required info is provided.
847+ # If ``RAISE_FORK_ERRORS`` is set, exceptions are raised here.
848+ # Otherwise the run is ignored completely.
837849 safe_years = {}
838850 for year , run_years in self .run_years .items ():
839851 safe_run_years = []
0 commit comments