Skip to content

Commit c2ca8db

Browse files
committed
moves docstrings to after functions are defined
1 parent aaec881 commit c2ca8db

File tree

1 file changed

+49
-51
lines changed

1 file changed

+49
-51
lines changed

src/loadsave.jl

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -41,57 +41,9 @@ add_loader
4141
add_saver
4242

4343

44-
"""
45-
- `load(filename)` loads the contents of a formatted file, trying to infer
46-
the format from `filename` and/or magic bytes in the file.
47-
- `load(strm)` loads from an `IOStream` or similar object. In this case,
48-
the magic bytes are essential.
49-
- `load(File(format"PNG",filename))` specifies the format directly, and bypasses inference.
50-
- `load(f; options...)` passes keyword arguments on to the loader.
51-
"""
52-
load
53-
54-
"""
55-
Some packages may implement a streaming API, where the contents of the file can
56-
be read in chunks and processed, rather than all at once. Reading from these
57-
higher-level streams should return a formatted object, like an image or chunk of
58-
video or audio.
59-
60-
- `loadstreaming(filename)` loads the contents of a formatted file, trying to infer
61-
the format from `filename` and/or magic bytes in the file. It returns a streaming
62-
type that can be read from in chunks, rather than loading the whole contents all
63-
at once
64-
- `loadstreaming(strm)` loads the stream from an `IOStream` or similar object. In this case,
65-
the magic bytes are essential.
66-
- `load(File(format"PNG",filename))` specifies the format directly, and bypasses inference.
67-
- `load(f; options...)` passes keyword arguments on to the loader.
68-
"""
69-
loadstreaming
70-
71-
"""
72-
- `save(filename, data...)` saves the contents of a formatted file,
73-
trying to infer the format from `filename`.
74-
- `save(Stream(format"PNG",io), data...)` specifies the format directly, and bypasses inference.
75-
- `save(f, data...; options...)` passes keyword arguments on to the saver.
76-
"""
77-
save
78-
79-
"""
80-
Some packages may implement a streaming API, where the contents of the file can
81-
be written in chunks, rather than all at once. These higher-level streams should
82-
accept formatted objects, like an image or chunk of video or audio.
83-
84-
- `savestreaming(filename, data...)` saves the contents of a formatted file,
85-
trying to infer the format from `filename`.
86-
- `savestreaming(Stream(format"PNG",io), data...)` specifies the format directly, and bypasses inference.
87-
- `savestreaming(f, data...; options...)` passes keyword arguments on to the saver.
88-
"""
89-
savestreaming
90-
91-
9244
for fn in (:load, :loadstreaming, :save, :savestreaming)
93-
@eval $fn(s::Union{AbstractString,IO}, data...; options...) =
94-
$fn(query(s), data...; options...)
45+
@eval $fn(s::@compat(Union{AbstractString,IO}), args...; options...) =
46+
$fn(query(s), args...; options...)
9547
end
9648

9749
function save(s::Union{AbstractString,IO}; options...)
@@ -139,7 +91,6 @@ for fn in (:loadstreaming, :savestreaming)
13991
end
14092
end
14193

142-
14394
# Fallbacks
14495
for fn in (:load, :loadstreaming)
14596
@eval function $fn{F}(q::Formatted{F}, args...; options...)
@@ -183,6 +134,53 @@ for fn in (:save, :savestreaming)
183134
end
184135
end
185136

137+
"""
138+
- `load(filename)` loads the contents of a formatted file, trying to infer
139+
the format from `filename` and/or magic bytes in the file.
140+
- `load(strm)` loads from an `IOStream` or similar object. In this case,
141+
the magic bytes are essential.
142+
- `load(File(format"PNG",filename))` specifies the format directly, and bypasses inference.
143+
- `load(f; options...)` passes keyword arguments on to the loader.
144+
"""
145+
load
146+
147+
"""
148+
Some packages may implement a streaming API, where the contents of the file can
149+
be read in chunks and processed, rather than all at once. Reading from these
150+
higher-level streams should return a formatted object, like an image or chunk of
151+
video or audio.
152+
153+
- `loadstreaming(filename)` loads the contents of a formatted file, trying to infer
154+
the format from `filename` and/or magic bytes in the file. It returns a streaming
155+
type that can be read from in chunks, rather than loading the whole contents all
156+
at once
157+
- `loadstreaming(strm)` loads the stream from an `IOStream` or similar object. In this case,
158+
the magic bytes are essential.
159+
- `load(File(format"PNG",filename))` specifies the format directly, and bypasses inference.
160+
- `load(f; options...)` passes keyword arguments on to the loader.
161+
"""
162+
loadstreaming
163+
164+
"""
165+
- `save(filename, data...)` saves the contents of a formatted file,
166+
trying to infer the format from `filename`.
167+
- `save(Stream(format"PNG",io), data...)` specifies the format directly, and bypasses inference.
168+
- `save(f, data...; options...)` passes keyword arguments on to the saver.
169+
"""
170+
save
171+
172+
"""
173+
Some packages may implement a streaming API, where the contents of the file can
174+
be written in chunks, rather than all at once. These higher-level streams should
175+
accept formatted objects, like an image or chunk of video or audio.
176+
177+
- `savestreaming(filename, data...)` saves the contents of a formatted file,
178+
trying to infer the format from `filename`.
179+
- `savestreaming(Stream(format"PNG",io), data...)` specifies the format directly, and bypasses inference.
180+
- `savestreaming(f, data...; options...)` passes keyword arguments on to the saver.
181+
"""
182+
savestreaming
183+
186184
function has_method_from(mt, Library)
187185
for m in mt
188186
if getmodule(m) == Library

0 commit comments

Comments
 (0)