Browse Source

Minor refactor of codelet.

Add:
    bitshift/codelet.py
        -complete docstrings, add filename to Codelet constructor.
tags/v1.0^2
Severyn Kozak 10 years ago
parent
commit
20b518fccc
1 changed files with 18 additions and 16 deletions
  1. +18
    -16
      bitshift/codelet.py

+ 18
- 16
bitshift/codelet.py View File

@@ -4,37 +4,39 @@ class Codelet(object):
"""
A source-code object with code metadata and composition analysis.

:ivar code: (string) A containing the raw source code.
:ivar language: (string) The inferred language of `code`.
:ivar author: (string) The
:ivar url: The url of the (page containing the) source code.
:ivar date_created: The date the code was published.
:ivar date_modified: The date the code was last modified.
:ivar code: (str) A containing the raw source code.
:ivar filename: (str, or None) The filename of the snippet.
:ivar language: (str, or None) The inferred language of `code`.
:ivar author: (str, or None) The name of the code's author.
:ivar url: (str) The url of the (page containing the) source code.
:ivar date_created: (str, or None) The date the code was published.
:ivar date_modified: (str, or None) The date the code was last modified.
"""

def __init__(self, code, author, language, code_url, author_url,
date_created, date_modified):
def __init__(self, code, filename, author, language, code_url, author_url,
date_created, date_modified):
"""
Create a Codelet instance.

:param code: The raw source code.
:param filename: The filename of the code, if any.
:param author: The author of the code.
:param language: The inferred language.
:param code_url: The url of the (page containing the) source code.
:param author_url: The url of the code author's public profile on the
framework said code was retrieved from.
:param date_created: The date the code was published.
:param date_modified: The date the code was last modified.

:type code: string
:type language: string
:type author: string
:type url: string
:type date_created: string
:type date_modified: string
:type code: str
:type filename: str, or None
:type language: str, or None
:type author: str, or None
:type url: str
:type date_created: str, or None
:type date_modified: str, or None
"""

self.code = code
self.filename = filename
self.author = author
self.language = language
self.code_url = code_url


Loading…
Cancel
Save