-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 568636d
Showing
73 changed files
with
9,610 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 614d4a05f8b85be2064defc40be7dc21 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" data-content_root="../../../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>hygiene.payload.boxing.boxing — hygiene latest documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../../../_static/pygments.css?v=7254e0c9" /> | ||
<link rel="stylesheet" type="text/css" href="../../../../_static/css/theme.css?v=19f00094" /> | ||
|
||
|
||
<!--[if lt IE 9]> | ||
<script src="../../../../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="../../../../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script src="../../../../_static/documentation_options.js?v=c6e86fd7"></script> | ||
<script src="../../../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script src="../../../../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../../../../index.html"> | ||
|
||
<img src="../../../../_static/hygiene.png" class="logo" alt="Logo"/> | ||
</a> | ||
<div class="version"> | ||
v0.0.9 | ||
</div> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<!-- Local TOC --> | ||
<div class="local-toc"></div> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../../../index.html">hygiene</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../../../index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">hygiene.payload.boxing.boxing</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for hygiene.payload.boxing.boxing</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">from</span> <span class="nn">hygiene.util.formatters.single</span> <span class="kn">import</span> <span class="n">json</span><span class="p">,</span> <span class="n">yaml</span> | ||
<span class="kn">from</span> <span class="nn">hygiene.util.builders</span> <span class="kn">import</span> <span class="n">csv</span> | ||
<span class="kn">import</span> <span class="nn">os</span> | ||
|
||
<div class="viewcode-block" id="Payload"> | ||
<a class="viewcode-back" href="../../../../hygiene.payload.boxing.html#hygiene.payload.boxing.boxing.Payload">[docs]</a> | ||
<span class="k">class</span> <span class="nc">Payload</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> The `Payload` class is responsible for formatting and delivering data based on the specified format.</span> | ||
<span class="sd"> It supports CSV and JSON formats and can handle data in the form of dictionaries, lists, and strings.</span> | ||
<span class="sd"> """</span> | ||
|
||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">path</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">fmt</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Initializes the `Payload` object with the provided data, output path, and format.</span> | ||
|
||
<span class="sd"> :param data: The data to be formatted and delivered.</span> | ||
<span class="sd"> :param path: The path where the formatted data will be saved (only applicable for CSV format).</span> | ||
<span class="sd"> :param fmt: The format in which the data should be formatted (e.g., 'csv' or 'json').</span> | ||
<span class="sd"> """</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">output_path</span> <span class="o">=</span> <span class="n">path</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">fmt</span> <span class="o">=</span> <span class="n">fmt</span> | ||
|
||
<div class="viewcode-block" id="Payload.deliver"> | ||
<a class="viewcode-back" href="../../../../hygiene.payload.boxing.html#hygiene.payload.boxing.boxing.Payload.deliver">[docs]</a> | ||
<span class="k">def</span> <span class="nf">deliver</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Formats and delivers the data based on the specified format.</span> | ||
|
||
<span class="sd"> :return: The formatted data.</span> | ||
<span class="sd"> """</span> | ||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">fmt</span> <span class="o">==</span> <span class="s1">'csv'</span><span class="p">:</span> | ||
<span class="n">form</span> <span class="o">=</span> <span class="n">csv</span><span class="o">.</span><span class="n">DataFormatter</span><span class="p">(</span><span class="n">fmt</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fmt</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="n">output_path</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">output_path</span><span class="p">))</span> | ||
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">form</span><span class="o">.</span><span class="n">format</span><span class="p">(),</span> <span class="s1">'r'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="n">f</span><span class="o">.</span><span class="n">readlines</span><span class="p">()</span> | ||
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="p">(</span><span class="nb">dict</span><span class="p">,</span> <span class="nb">list</span><span class="p">)):</span> | ||
<span class="n">form</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">DataFormatter</span><span class="p">(</span><span class="n">fmt</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fmt</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> | ||
<span class="k">return</span> <span class="n">form</span><span class="o">.</span><span class="n">format</span><span class="p">()</span> | ||
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span> | ||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">data</span> | ||
<span class="k">try</span><span class="p">:</span> | ||
<span class="n">form</span> <span class="o">=</span> <span class="n">yaml</span><span class="o">.</span><span class="n">DataFormatter</span><span class="p">(</span><span class="n">fmt</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fmt</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="nb">dict</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">))</span> | ||
<span class="k">except</span><span class="p">:</span> | ||
<span class="n">form</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">DataFormatter</span><span class="p">(</span><span class="n">fmt</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">fmt</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">data</span><span class="p">)</span> | ||
<span class="k">return</span> <span class="n">form</span><span class="o">.</span><span class="n">format</span><span class="p">()</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2023, Prismadic, LLC.</p> | ||
</div> | ||
|
||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" data-content_root="../../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>hygiene.singleton — hygiene latest documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=7254e0c9" /> | ||
<link rel="stylesheet" type="text/css" href="../../_static/css/theme.css?v=19f00094" /> | ||
|
||
|
||
<!--[if lt IE 9]> | ||
<script src="../../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="../../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script src="../../_static/documentation_options.js?v=c6e86fd7"></script> | ||
<script src="../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script src="../../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../../index.html"> | ||
|
||
<img src="../../_static/hygiene.png" class="logo" alt="Logo"/> | ||
</a> | ||
<div class="version"> | ||
v0.0.9 | ||
</div> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<!-- Local TOC --> | ||
<div class="local-toc"></div> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../index.html">hygiene</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">hygiene.singleton</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for hygiene.singleton</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">from</span> <span class="nn">hygiene.payload</span> <span class="kn">import</span> <span class="n">boxing</span> | ||
|
||
<div class="viewcode-block" id="Singleton"> | ||
<a class="viewcode-back" href="../../hygiene.html#hygiene.singleton.Singleton">[docs]</a> | ||
<span class="k">class</span> <span class="nc">Singleton</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> A utility class that provides access to the 'boxing' module from the 'payload' package.</span> | ||
<span class="sd"> """</span> | ||
|
||
<div class="viewcode-block" id="Singleton.boxing"> | ||
<a class="viewcode-back" href="../../hygiene.html#hygiene.singleton.Singleton.boxing">[docs]</a> | ||
<span class="nd">@staticmethod</span> | ||
<span class="k">def</span> <span class="nf">boxing</span><span class="p">():</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Returns the 'boxing' module from the 'payload' package.</span> | ||
<span class="sd"> </span> | ||
<span class="sd"> :return: The 'boxing' module.</span> | ||
<span class="sd"> """</span> | ||
<span class="k">return</span> <span class="n">boxing</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2023, Prismadic, LLC.</p> | ||
</div> | ||
|
||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.