File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 3838
3939
4040class File :
41+ """Represents a single file within a mystb.in paste.
42+
43+ Attributes
44+ -----------
45+ filename: :class:`str`
46+ The file's name.
47+ content: :class:`str`
48+ The file's contents.
49+ syntax: Optional[:class:`str`]
50+ The file's syntax, if given.
51+ lines_of_code: Optional[:class:`int`]
52+ The lines of code within the file.
53+ character_count: Optional[:class:`int`]
54+ The character count of the file.
55+
56+
57+ .. note::
58+ The ``lines_of_code`` and ``character_count`` come from the API and should not be provided by the user.
59+ """
60+
4161 __slots__ = (
4262 "filename" ,
4363 "content" ,
@@ -58,7 +78,7 @@ def __init__(
5878 self .filename : str = filename
5979 self .content : str = content
6080 self .syntax : Optional [str ] = syntax
61- self .lines_of_code : int = lines_of_code or len ( content .split ("\n " ) )
81+ self .lines_of_code : int = lines_of_code or content .count ("\n " )
6282 self .character_count : int = character_count or len (content )
6383
6484 @classmethod
You can’t perform that action at this time.
0 commit comments