text
stringlengths
81
112k
Returns a Python object from an Alembic migration module (script). Args: operations: instance of ``alembic.operations.base.Operations`` ident: string of the format ``version.objname`` Returns: the object whose name is ``objname`` within the Alembic migration ...
Takes an ISO-8601 string and returns a ``datetime``. def iso_string_to_python_datetime( isostring: str) -> Optional[datetime.datetime]: """ Takes an ISO-8601 string and returns a ``datetime``. """ if not isostring: return None # if you parse() an empty string, you get today's date ...
Converts a Python datetime to a string literal compatible with SQLite, including the millisecond field. def python_utc_datetime_to_sqlite_strftime_string( value: datetime.datetime) -> str: """ Converts a Python datetime to a string literal compatible with SQLite, including the millisecond field...
Converts a Python ``datetime`` that has a timezone to an ISO-8601 string with ``:`` between the hours and minutes of the timezone. Example: >>> import datetime >>> import pytz >>> x = datetime.datetime.now(pytz.utc) >>> python_localized_datetime_to_human_iso(x) '2017-08-...
For a comparison "LHS *op* RHS", transforms the LHS from a column containing an ISO-8601 date/time into an SQL ``DATETIME``, for MySQL. def isodt_lookup_mysql(lookup, compiler, connection, operator) -> Tuple[str, Any]: """ For a comparison "LHS *op* RHS", transforms the LHS from ...
Takes an instance and calculates the arguments to pass to ``__init__`` to reconstruct it. def deconstruct(self) -> Tuple[str, str, List[Any], Dict[str, Any]]: """ Takes an instance and calculates the arguments to pass to ``__init__`` to reconstruct it. """ name, path, ar...
Convert database value to Python value. Called when data is loaded from the database. def from_db_value(self, value, expression, connection, context): """ Convert database value to Python value. Called when data is loaded from the database. """ # log.debug("from_db_value...
Called during deserialization and during form ``clean()`` calls. Must deal with an instance of the correct type; a string; or ``None`` (if the field allows ``null=True``). Should raise ``ValidationError`` if problems. def to_python(self, value: Optional[str]) -> Optional[Any]: """ ...
Convert Python value to database value for QUERYING. We query with UTC, so this function converts datetime values to UTC. Calls to this function are followed by calls to ``get_db_prep_value()``, which is for backend-specific conversions. def get_prep_value(self, value): """ Con...
Further conversion of Python value to database value for QUERYING. This follows ``get_prep_value()``, and is for backend-specific stuff. See notes above. def get_db_prep_value(self, value, connection, prepared=False): """ Further conversion of Python value to database value for QUERYING...
Convert Python value to database value for SAVING. We save with full timezone information. def get_db_prep_save(self, value, connection, prepared=False): """ Convert Python value to database value for SAVING. We save with full timezone information. """ log.debug("get_db_...
Returns a sorted list of every file extension found in a directory and its subdirectories. Args: path: path to scan reportevery: report directory progress after every *n* steps Returns: sorted list of every file extension found def list_file_extensions(path: str, reportevery: int ...
Command-line processor. See ``--help`` for details. def main() -> None: """ Command-line processor. See ``--help`` for details. """ main_only_quicksetup_rootlogger(level=logging.DEBUG) parser = argparse.ArgumentParser() parser.add_argument("directory", nargs="?", default=os.getcwd()) parser...
Check which of a list of Debian packages are installed, via ``dpkg-query``. Args: packages: list of Debian package names Returns: dict: mapping from package name to boolean ("present?") def are_debian_packages_installed(packages: List[str]) -> Dict[str, bool]: """ Check which of a lis...
Ensure specific packages are installed under Debian. Args: packages: list of packages Raises: ValueError: if any are missing def require_debian_packages(packages: List[str]) -> None: """ Ensure specific packages are installed under Debian. Args: packages: list of packages...
Does the object have length 2? def validate_pair(ob: Any) -> bool: """ Does the object have length 2? """ try: if len(ob) != 2: log.warning("Unexpected result: {!r}", ob) raise ValueError() except ValueError: return False return True
Take a command (either a single command or list of arguments) and return the environment created after running that command. Note that the command must be a batch (``.bat``) file or ``.cmd`` file, or the changes to the environment will not be captured. If ``initial_env`` is supplied, it is used as the ...
Checks if ``target`` exists in ``x`` outside quotes (as defined by ``quote``). Principal use: from :func:`contains_unquoted_ampersand_dangerous_to_windows`. def contains_unquoted_target(x: str, quote: str = '"', target: str = '&') -> bool: """ Checks if ``target`` exists in...
Remove body from a message, and wrap in a message/external-body. def gut_message(message: Message) -> Message: """ Remove body from a message, and wrap in a message/external-body. """ wrapper = Message() wrapper.add_header('Content-Type', 'message/external-body', access_type=...
Clean a message of all its binary parts. This guts all binary attachments, and returns the message itself for convenience. def clean_message(message: Message, topmost: bool = False) -> Message: """ Clean a message of all its binary parts. This guts all binary attachments, and returns the message ...
Makes a hashed password (using a new salt) using ``bcrypt``. The hashed password includes the salt at its start, so no need to store a separate salt. def hash_password(plaintextpw: str, log_rounds: int = BCRYPT_DEFAULT_LOG_ROUNDS) -> str: """ Makes a hashed password (using a new salt...
Checks if a plaintext password matches a stored hash. Uses ``bcrypt``. The stored hash includes its own incorporated salt. def is_password_valid(plaintextpw: str, storedhash: str) -> bool: """ Checks if a plaintext password matches a stored hash. Uses ``bcrypt``. The stored hash includes its own inco...
(Windows only.) Create a system ODBC data source name (DSN). Args: driver: ODBC driver name kw: Driver attributes Returns: bool: was the DSN created? def create_sys_dsn(driver: str, **kw) -> bool: """ (Windows only.) Create a system ODBC data source name (DSN). Ar...
(Windows only.) Create a user ODBC data source name (DSN). Args: driver: ODBC driver name kw: Driver attributes Returns: bool: was the DSN created? def create_user_dsn(driver: str, **kw) -> bool: """ (Windows only.) Create a user ODBC data source name (DSN). Args:...
(Windows only.) Registers a Microsoft Access database with ODBC. Args: fullfilename: filename of the existing database dsn: ODBC data source name to create description: description of the database Returns: bool: was the DSN created? def register_access_db(fullfilename: str...
(Windows only.) Creates a Microsoft Access 97 database and registers it with ODBC. Args: filename: filename of the database to create dsn: ODBC data source name to create description: description of the database Returns: bool: was the DSN created? def create_and_register_a...
(Windows only.) Creates a Microsoft Access 2000 database and registers it with ODBC. Args: filename: filename of the database to create dsn: ODBC data source name to create description: description of the database Returns: bool: was the DSN created? def create_and_register...
(Windows only.) Creates a Microsoft Access database and registers it with ODBC. Args: filename: filename of the database to create dsn: ODBC data source name to create description: description of the database Returns: bool: was the DSN created? def create_and_register_acce...
Return true if all dependencies have informed this node that they'll be sending no more data (by calling _finalize()), and that they have sent at least one batch of data (by calling enqueue()) def _finalized(self): """ Return true if all dependencies have informed this node that they'll...
Compute the version identifier for this functional node using the func code and local names. Optionally, also allow closed-over variable values to affect the version number when closure_fingerprint is specified def version(self): """ Compute the version identifier for this func...
From an SQLAlchemy ORM class, creates the database table via the specified engine, using a ``CREATE TABLE`` SQL (DDL) statement. Args: engine: SQLAlchemy :class:`Engine` object ormclass: SQLAlchemy ORM class without_constraints: don't add foreign key constraints def create_table_from_o...
Download counties geojson from S3 and build spatial index and cache def mapper_init(self): """ Download counties geojson from S3 and build spatial index and cache """ self.counties = CachedCountyLookup(precision=GEOHASH_PRECISION) self.extractor = WordExtractor()
Top level runner to load State and County GeoJSON files into Mongo DB def run(self): """ Top level runner to load State and County GeoJSON files into Mongo DB """ logging.info("Starting GeoJSON MongoDB loading process.") mongo = dict(uri=self.mongo, db=self.db, collection=self.collection) ...
Load geojson file into mongodb instance def load(self, geojson, uri=None, db=None, collection=None): """ Load geojson file into mongodb instance """ logging.info("Mongo URI: {0}".format(uri)) logging.info("Mongo DB: {0}".format(db)) logging.info("Mongo Collection: {0}".format(collection...
Return formatted version string. Returns: str: string with project version or empty string. def get_version(): """ Return formatted version string. Returns: str: string with project version or empty string. """ if all([VERSION, UPDATED, any([isinstance(UPDATED, date), isinsta...
Deals with an OpenXML, including if it is potentially corrupted. Args: filename: filename to process filetypes: list of filetypes that we care about, e.g. ``['docx', 'pptx', 'xlsx']``. move_to: move matching files to this directory delete_if_not_specified_file_type: if `...
Command-line handler for the ``find_recovered_openxml`` tool. Use the ``--help`` option for help. def main() -> None: """ Command-line handler for the ``find_recovered_openxml`` tool. Use the ``--help`` option for help. """ parser = ArgumentParser( formatter_class=RawDescriptionHelpForm...
Move the file to which this class refers to a new location. The function will not overwrite existing files (but offers the option to rename files slightly to avoid a clash). Args: destination_filename: filename to move to alter_if_clash: if ``True`` (the default), append...
Checks if the file should be built or not Only skips layouts which are tagged as INCREMENTAL Rebuilds only those files with mtime changed since previous build def should_build(self, fpath, meta): """ Checks if the file should be built or not Only skips layouts which are tagged a...
Return a dict of queues in cluster and servers running them def clusterQueues(self): """ Return a dict of queues in cluster and servers running them """ servers = yield self.getClusterServers() queues = {} for sname in servers: qs = yield self.get('rhumba.server.%s...
Returns a dict of cluster nodes and their status information def clusterStatus(self): """ Returns a dict of cluster nodes and their status information """ servers = yield self.getClusterServers() d = { 'workers': {}, 'crons': {}, 'queues': {}...
Retrieve specific record by id `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html>`_ :param index: the index name to query :param id: the id of the record :param fields: the fields you what to fetch from the record (str separated by comma's) :param doc...
Check if the doc exist in the elastic search `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html>`_ :param index: the index name :param doc_type: the document type :param id: the id of the doc type :arg parent: The ID of the parent document :arg...
Get the _source of the document `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html>`_ :param index: the index name :param doc_type: the document type :param id: the id of the doc type :arg _source: True or false to return the _source field or not, or a...
Get multiple document from the same index and doc_type (optionally) by ids `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html>` :param body: list of docs with or without the index and type parameters or list of ids :param index: the name of the index ...
Update a document with the body param or list of ids `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html>`_ :param index: the name of the index :param doc_type: the document type :param id: the id of the doc type :param body: the data to update in t...
Make a search query on the elastic search `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html>`_ :param index: the index name to query :param doc_type: he doc type to search in :param body: the query :param query_params: params :arg _sourc...
The explain api computes a score explanation for a query and a specific document. This can give useful feedback whether a document matches or didn't match a specific query. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html>`_ :param index: The name of t...
Delete specific record by id `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html>`_ :param index: the index name to delete from :param doc_type: the doc type to delete from :param id: the id of the record :param query_params: params :return: ...
Adds or updates a typed JSON document in a specific index, making it searchable. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html>`_ :param index: The name of the index :param doc_type: The type of the document :param body: The document :param id...
Adds a typed JSON document in a specific index, making it searchable. Behind the scenes this method calls index(..., op_type='create') `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html>`_ :param index: The name of the index :param doc_type: The type of the...
Clear the scroll request created by specifying the scroll parameter to search. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html>`_ :param scroll_id: A comma-separated list of scroll IDs to clear :param body: A comma-separated list of scroll IDs ...
Simple abstraction on top of the :meth:`~elasticsearch.Elasticsearch.scroll` api - a simple iterator that yields all hits as returned by underlining scroll requests. By default scan does not return results in any pre-determined order. To have a standard order in the returned documents (...
Execute a query and get the number of matches for that query. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html>`_ :param index: A comma-separated list of indices to restrict the results :param doc_type: A comma-separated list of types to restrict the results ...
Perform many index/delete operations in a single API call. See the :func:`~elasticsearch.helpers.bulk` helper function for a more friendly API. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html>`_ :param body: The operation definition and data (action-data p...
Execute several search requests within the same API. `<http://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html>`_ :arg body: The request definitions (metadata-search request definition pairs), separated by newlines :arg index: A comma-separated list of...
close all http connections. returns a deferred that fires once they're all closed. def close(self): """ close all http connections. returns a deferred that fires once they're all closed. """ def validate_client(client): """ Validate that the conn...
Removes invalid coordinates (this is generally caused by importing coordinates outside of the DEM) def clean_coordinates(coords, silent=False): """ Removes invalid coordinates (this is generally caused by importing coordinates outside of the DEM) """ l1 = len(coords) coords = coords[~N.isna...
Returns a mask shrunk to the 'minimum bounding rectangle' of the nonzero portion of the previous mask, and its offset from the original. Useful to find the smallest rectangular section of the image that can be extracted to include the entire geometry. Conforms to the y-first expectations...
Extract a linear feature from a `rasterio` geospatial dataset. def extract_line(geom, dem, **kwargs): """ Extract a linear feature from a `rasterio` geospatial dataset. """ kwargs.setdefault('masked', True) coords_in = coords_array(geom) # Transform geometry into pixels f = lambda *x: ~de...
fork Provides a deferred wrapper function with a timeout function :param executable: Executable :type executable: str. :param args: Tupple of arguments :type args: tupple. :param env: Environment dictionary :type env: dict. :param timeout: Kill the child process if timeout is exceeded ...
Factory to make an :class:`.SqlGrammar` from the name of an SQL dialect, where the name is one of the members of :class:`.SqlaDialectName`. def make_grammar(dialect: str) -> SqlGrammar: """ Factory to make an :class:`.SqlGrammar` from the name of an SQL dialect, where the name is one of the members of ...
Format number to ``dp`` decimal places, optionally using a UTF-8 en dash for minus signs. def number_to_dp(number: Optional[float], dp: int, default: Optional[str] = "", en_dash_for_minus: bool = True) -> str: """ Format number to ``dp`` decimal places, op...
Writes the keys and values of a CGI form to ``stderr``. def debug_form_contents(form: cgi.FieldStorage, to_stderr: bool = True, to_logger: bool = False) -> None: """ Writes the keys and values of a CGI form to ``stderr``. """ for k in form.keys(): ...
Determines if the CGI method was ``POST``, given the CGI environment. def cgi_method_is_post(environ: Dict[str, str]) -> bool: """ Determines if the CGI method was ``POST``, given the CGI environment. """ method = environ.get("REQUEST_METHOD", None) if not method: return False return me...
Extracts a string parameter from a CGI form. Note: ``key`` is CASE-SENSITIVE. def get_cgi_parameter_str(form: cgi.FieldStorage, key: str, default: str = None) -> str: """ Extracts a string parameter from a CGI form. Note: ``key`` is CASE-SENSITIVE. ...
Extracts a string parameter from a CGI form, or ``None`` if the key doesn't exist or the string is zero-length. def get_cgi_parameter_str_or_none(form: cgi.FieldStorage, key: str) -> Optional[str]: """ Extracts a string parameter from a CGI form, or ``None`` if the key doe...
Extracts a list of values, all with the same key, from a CGI form. def get_cgi_parameter_list(form: cgi.FieldStorage, key: str) -> List[str]: """ Extracts a list of values, all with the same key, from a CGI form. """ return form.getlist(key)
Extracts a boolean parameter from a CGI form, on the assumption that ``"1"`` is ``True`` and everything else is ``False``. def get_cgi_parameter_bool(form: cgi.FieldStorage, key: str) -> bool: """ Extracts a boolean parameter from a CGI form, on the assumption that ``"1"`` is ``True`` and everything el...
Extracts a boolean parameter from a CGI form (``"1"`` = ``True``, other string = ``False``, absent/zero-length string = default value). def get_cgi_parameter_bool_or_default(form: cgi.FieldStorage, key: str, default: bool = None) -> Option...
Extracts a boolean parameter from a CGI form (``"1"`` = ``True``, other string = False, absent/zero-length string = ``None``). def get_cgi_parameter_bool_or_none(form: cgi.FieldStorage, key: str) -> Optional[bool]: """ Extracts a boolean parameter from a CGI form (``"1"``...
Extracts an integer parameter from a CGI form, or ``None`` if the key is absent or the string value is not convertible to ``int``. def get_cgi_parameter_int(form: cgi.FieldStorage, key: str) -> Optional[int]: """ Extracts an integer parameter from a CGI form, or ``None`` if the key is absent or the str...
Extracts a float parameter from a CGI form, or None if the key is absent or the string value is not convertible to ``float``. def get_cgi_parameter_float(form: cgi.FieldStorage, key: str) -> Optional[float]: """ Extracts a float parameter from a CGI form, or None if the key is ...
Extracts a date/time parameter from a CGI form. Applies the LOCAL timezone if none specified. def get_cgi_parameter_datetime(form: cgi.FieldStorage, key: str) -> Optional[datetime.datetime]: """ Extracts a date/time parameter from a CGI form. Applies the LOCAL timezone if...
Extracts a file's contents from a "file" input in a CGI form, or None if no such file was uploaded. def get_cgi_parameter_file(form: cgi.FieldStorage, key: str) -> Optional[bytes]: """ Extracts a file's contents from a "file" input in a CGI form, or None if no such file was u...
Extracts a file's name and contents from a "file" input in a CGI form. Returns ``(name, contents)``, or ``(None, None)`` if no such file was uploaded. def get_cgi_parameter_filename_and_file(form: cgi.FieldStorage, key: str) \ -> Tuple[Optional[str], Optional[bytes]]: """ Extracts a file's name...
Does a CGI form contain the key? def cgi_parameter_exists(form: cgi.FieldStorage, key: str) -> bool: """ Does a CGI form contain the key? """ s = get_cgi_parameter_str(form, key) return s is not None
Returns an environment variable's value, CGI-escaped, or ``None``. def getenv_escaped(key: str, default: str = None) -> Optional[str]: """ Returns an environment variable's value, CGI-escaped, or ``None``. """ value = os.getenv(key, default) # noinspection PyDeprecation return cgi.escape(value)...
Returns a CGI-escaped version of the value read from an INI file using :class:`ConfigParser`, or ``None``. def getconfigvar_escaped(config: configparser.ConfigParser, section: str, key: str) -> Optional[str]: """ Returns a CGI-escaped version of the value r...
Returns a :class:`cgi.FieldStorage` object from the WSGI environment. def get_cgi_fieldstorage_from_wsgi_env( env: Dict[str, str], include_query_string: bool = True) -> cgi.FieldStorage: """ Returns a :class:`cgi.FieldStorage` object from the WSGI environment. """ # http://stackoverflow...
Converts a PNG blob into a local URL encapsulating the PNG. def get_png_data_url(blob: Optional[bytes]) -> str: """ Converts a PNG blob into a local URL encapsulating the PNG. """ return BASE64_PNG_URL_PREFIX + base64.b64encode(blob).decode('ascii')
Converts a PNG blob to an HTML IMG tag with embedded data. def get_png_img_html(blob: Union[bytes, memoryview], extra_html_class: str = None) -> str: """ Converts a PNG blob to an HTML IMG tag with embedded data. """ return """<img {}src="{}" />""".format( 'class="{}" '.for...
Returns ``(contenttype, extraheaders, data)`` tuple for a PDF. def pdf_result(pdf_binary: bytes, extraheaders: TYPE_WSGI_RESPONSE_HEADERS = None, filename: str = None) -> WSGI_TUPLE_TYPE: """ Returns ``(contenttype, extraheaders, data)`` tuple for a PDF. """ extraheaders =...
Returns ``(contenttype, extraheaders, data)`` tuple for a ZIP. def zip_result(zip_binary: bytes, extraheaders: TYPE_WSGI_RESPONSE_HEADERS = None, filename: str = None) -> WSGI_TUPLE_TYPE: """ Returns ``(contenttype, extraheaders, data)`` tuple for a ZIP. """ extraheaders =...
Returns ``(contenttype, extraheaders, data)`` tuple for UTF-8 HTML. def html_result(html: str, extraheaders: TYPE_WSGI_RESPONSE_HEADERS = None) \ -> WSGI_TUPLE_TYPE: """ Returns ``(contenttype, extraheaders, data)`` tuple for UTF-8 HTML. """ extraheaders = extraheaders or [] ...
Returns ``(contenttype, extraheaders, data)`` tuple for UTF-8 XML. def xml_result(xml: str, extraheaders: TYPE_WSGI_RESPONSE_HEADERS = None) \ -> WSGI_TUPLE_TYPE: """ Returns ``(contenttype, extraheaders, data)`` tuple for UTF-8 XML. """ extraheaders = extraheaders or [] retu...
Returns ``(contenttype, extraheaders, data)`` tuple for UTF-8 text. def text_result(text: str, extraheaders: TYPE_WSGI_RESPONSE_HEADERS = None, filename: str = None) -> WSGI_TUPLE_TYPE: """ Returns ``(contenttype, extraheaders, data)`` tuple for UTF-8 text. """ extrahead...
Writes HTTP result to stdout. Args: contenttype_headers_content: the tuple ``(contenttype, extraheaders, data)`` status: HTTP status message (default ``"200 OK``) def print_result_for_plain_cgi_script_from_tuple( contenttype_headers_content: WSGI_TUPLE_TYPE, ...
Writes HTTP request result to stdout. def print_result_for_plain_cgi_script(contenttype: str, headers: TYPE_WSGI_RESPONSE_HEADERS, content: bytes, status: str = '200 OK') -> None: """ Writes HTTP r...
Simple WSGI app. Args: result: the data to be processed by ``handler`` handler: a function returning a ``(contenttype, extraheaders, data)`` tuple, e.g. ``text_result``, ``html_result`` start_response: standard WSGI ``start_response`` function status: status code (defaul...
Converts a value into an HTML-safe ``str`` (formerly, in Python 2: ``unicode``). Converts value ``v`` to a string; escapes it to be safe in HTML format (escaping ampersands, replacing newlines with ``<br>``, etc.). Returns ``""`` for blank input. def webify(v: Any, preserve_newlines: bool = True) -> s...
HTML-emboldens content, unless blank. def bold_if_not_blank(x: Optional[str]) -> str: """ HTML-emboldens content, unless blank. """ if x is None: return u"{}".format(x) return u"<b>{}</b>".format(x)
Adds hyperlinks to text that appears to contain URLs. See - http://stackoverflow.com/questions/1071191 - ... except that double-replaces everything; e.g. try with ``text = "me@somewhere.com me@somewhere.com"`` - http://stackp.online.fr/?p=19 def make_urls_hyperlinks(text: str) -> str: ...
Converts rows from an SQL query result to an HTML table. Suitable for processing output from the defunct function ``rnc_db.fetchall_with_fieldnames(sql)``. def html_table_from_query(rows: Iterable[Iterable[Optional[str]]], descriptions: Iterable[Optional[str]]) -> str: """ Con...
Underlines a heading for RST files. Args: heading: text to underline underline_char: character to use Returns: underlined heading, over two lines (without a final terminating newline) def rst_underline(heading: str, underline_char: str) -> str: """ Underlines a heading...
Writes the contents to a file, if permitted. Args: filename: filename to write content: contents to write overwrite: permit overwrites? mock: pretend to write, but don't Raises: RuntimeError: if file exists but overwriting not permitted def write_if_allowed(filename: s...
Returns the filename of the target RST file, relative to a specified index file. Used to make the index refer to the RST. def rst_filename_rel_autodoc_index(self, index_filename: str) -> str: """ Returns the filename of the target RST file, relative to a specified index file. Used to ma...
Returns the name of the Python module that this instance refers to, in dotted Python module notation, or a blank string if it doesn't. def python_module_name(self) -> str: """ Returns the name of the Python module that this instance refers to, in dotted Python module notation, or a blan...
Returns the code type annotation for Pygments; e.g. ``python`` for Python, ``cpp`` for C++, etc. def pygments_language(self) -> str: """ Returns the code type annotation for Pygments; e.g. ``python`` for Python, ``cpp`` for C++, etc. """ extension = splitext(self.source_...
Returns the text contents of an RST file that will automatically document our source file. Args: prefix: prefix, e.g. RST copyright comment suffix: suffix, after the part we're creating heading_underline_char: RST character to use to underline the hea...