Skip to content

Commit

Permalink
Allow converting data types when copying.
Browse files Browse the repository at this point in the history
  • Loading branch information
orenbenkiki committed Apr 8, 2024
1 parent c9b2bd6 commit 5bcf4f2
Show file tree
Hide file tree
Showing 8 changed files with 356 additions and 43 deletions.
2 changes: 1 addition & 1 deletion docs/v0.1.0/.documenter-siteinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-07T18:07:22","documenter_version":"1.3.0"}}
{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-08T15:21:56","documenter_version":"1.3.0"}}
80 changes: 77 additions & 3 deletions docs/v0.1.0/copies.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,10 @@ <h1 id="Copies">
source::DafReader,
name::AbstractString,
[rename::Maybe{AbstractString} = nothing,
dtype::Maybe{Type{T}} = nothing,
default::Union{StorageScalar, Nothing, UndefInitializer} = undef,
overwrite::Bool = false]
)::Nothing
)::Nothing where {T &lt;: StorageScalarBase}
</code>
</pre>
<p>Copy a scalar with some
Expand All @@ -304,6 +305,8 @@ <h1 id="Copies">
</code>. If
<code>rename
</code> is specified, store the scalar using this new name. If
<code>dtype
</code> is specified, the data is converted to this type. If
<code>overwrite
</code> (not the default), overwrite an existing scalar in the target.
</p>
Expand Down Expand Up @@ -377,10 +380,11 @@ <h1 id="Copies">
name::AbstractString,
[reaxis::Maybe{AbstractString} = nothing,
rename::Maybe{AbstractString} = nothing,
dtype::Maybe{Type{T}} = nothing,
default::Union{StorageScalar, StorageVector, Nothing, UndefInitializer} = undef,
empty::Maybe{StorageScalar} = nothing,
overwrite::Bool = false]
)::Nothing
)::Nothing where {T &lt;: StorageScalarBase}
</code>
</pre>
<p>Copy a vector from some
Expand All @@ -404,6 +408,8 @@ <h1 id="Copies">
</code> is specified, store the vector using this axis. If
<code>rename
</code> is specified, store the vector using this name. If
<code>dtype
</code> is specified, the data is converted to this type. If
<code>overwrite
</code> (not the default), overwrite an existing vector in the target.
</p>
Expand Down Expand Up @@ -437,11 +443,12 @@ <h1 id="Copies">
[rows_reaxis::Maybe{AbstractString} = nothing,
columns_reaxis::Maybe{AbstractString} = nothing,
rename::Maybe{AbstractString} = nothing,
dtype::Maybe{Type{T}} = nothing,
default::Union{StorageScalar, StorageVector, Nothing, UndefInitializer} = undef,
empty::Maybe{StorageScalar} = nothing,
relayout::Bool = true,
overwrite::Bool = false]
)::Nothing
)::Nothing where {T &lt;: StorageScalarBase}
</code>
</pre>
<p>Copy a matrix from some
Expand Down Expand Up @@ -471,6 +478,8 @@ <h1 id="Copies">
</code> are specified, store the vector using these axes. If
<code>rename
</code> is specified, store the matrix using this name. If
<code>dtype
</code> is specified, the data is converted to this type. If
<code>overwrite
</code> (not the default), overwrite an existing matrix in the target. The matrix is stored with the same
<code>relayout
Expand Down Expand Up @@ -511,6 +520,7 @@ <h1 id="Copies">
destination::DafWriter,
source::DafReader
[empty::Maybe{EmptyData} = nothing,
dtypes::Maybe{DataTypes} = nothing,
overwrite::Bool = false,
relayout::Bool = true]
)::Nothing
Expand Down Expand Up @@ -544,6 +554,10 @@ <h1 id="Copies">
<code>(rows_axis, columns_axis, property) =&gt; entry
</code> for specifying an empty value for a matrix property. The order of the axes for matrix properties doesn&#39;t matter (the same empty value is automatically used for both axes orders).
</p>
<p>If
<code>dtype
</code> is specified, the copied data of the matching property is converted to the specified data type.
</p>
</div>
</section>
</article>
Expand Down Expand Up @@ -601,6 +615,60 @@ <h1 id="Copies">
</div>
</section>
</article>
<article class="docstring">
<header>
<a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring">
</a>
<a class="docstring-binding" id="Daf.Copies.DataTypes" href="#Daf.Copies.DataTypes">
<code>Daf.Copies.DataTypes
</code>
</a>
<span class="docstring-category">Type
</span>
</header>
<section>
<div>
<p>Specify the data type to use for overriding properties types in a
<code>Daf
</code> data set. This is a dictionary with an
<a href="formats.html#Daf.Formats.DataKey">
<code>DataKey
</code>
</a> specifying for which property we specify a value to, and the data type to use.
</p>
<div class="admonition is-info">
<header class="admonition-header">Note
</header>
<div class="admonition-body">
<p>Due to Julia&#39;s type system limitations, there&#39;s just no way for the system to enforce the type of the pairs when initializing this dictionary. That is, what we&#39;d
<strong>like
</strong> to say is:
</p>
<pre>
<code class="nohighlight hljs">DataTypes = AbstractDict{DataKey, Type{T}} where {T &lt;: StorageScalarBase}
</code>
</pre>
<p>But what we are
<strong>forced
</strong> to say is:
</p>
<pre>
<code class="nohighlight hljs">DataTypes = AbstractDict
</code>
</pre>
<p>That&#39;s
<strong>not
</strong> a mistake. Even
<code>DataTypes = AbstractDict{Key, T &lt;: StorageScalarBase} where {Key, T &lt;: StorageScalarBase}
</code> fails to work, as do all the (many) possibilities for expressing &quot;this is a dictionary where the key or the value can be one of several things&quot; Sigh. Glory to anyone who figures out an incantation that would force the system to perform
<strong>any
</strong> meaningful type inference here.
</p>
</div>
</div>
</div>
</section>
</article>
<h2 id="Index">
<a class="docs-heading-anchor" href="#Index">Index
</a>
Expand All @@ -617,6 +685,12 @@ <h2 id="Index">
</a>
</li>
<li>
<a href="copies.html#Daf.Copies.DataTypes">
<code>Daf.Copies.DataTypes
</code>
</a>
</li>
<li>
<a href="copies.html#Daf.Copies.EmptyData">
<code>Daf.Copies.EmptyData
</code>
Expand Down
6 changes: 6 additions & 0 deletions docs/v0.1.0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,12 @@ <h1 id="Index">
</a>
</li>
<li>
<a href="copies.html#Daf.Copies.DataTypes">
<code>Daf.Copies.DataTypes
</code>
</a>
</li>
<li>
<a href="copies.html#Daf.Copies.EmptyData">
<code>Daf.Copies.EmptyData
</code>
Expand Down
Binary file modified docs/v0.1.0/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/v0.1.0/search_index.js

Large diffs are not rendered by default.

Loading

0 comments on commit 5bcf4f2

Please sign in to comment.