Skip to content

Commit

Permalink
Remove unnecessary name qualification in examples (#45898)
Browse files Browse the repository at this point in the history
Co-authored-by: Lilith Hafner <Lilith.Hafner@gmail.com>
  • Loading branch information
LilithHafner and Lilith Hafner authored Jul 6, 2022
1 parent 22c6eea commit b73bf86
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 77 deletions.
6 changes: 3 additions & 3 deletions stdlib/Dates/src/Dates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ For time zone functionality, see the TimeZones.jl package.
julia> dt = DateTime(2017,12,31,23,59,59,999)
2017-12-31T23:59:59.999
julia> d1 = Date(Dates.Month(12), Dates.Year(2017))
julia> d1 = Date(Month(12), Year(2017))
2017-12-01
julia> d2 = Date("2017-12-31", Dates.DateFormat("y-m-d"))
julia> d2 = Date("2017-12-31", DateFormat("y-m-d"))
2017-12-31
julia> Dates.yearmonthday(d2)
julia> yearmonthday(d2)
(2017, 12, 31)
julia> d2-d1
Expand Down
6 changes: 3 additions & 3 deletions stdlib/Dates/src/accessors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ week of 2004.
# Examples
```jldoctest
julia> Dates.week(Date(1989, 6, 22))
julia> week(Date(1989, 6, 22))
25
julia> Dates.week(Date(2005, 1, 1))
julia> week(Date(2005, 1, 1))
53
julia> Dates.week(Date(2004, 12, 31))
julia> week(Date(2004, 12, 31))
53
```
"""
Expand Down
38 changes: 19 additions & 19 deletions stdlib/Dates/src/adjusters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Truncates the value of `dt` according to the provided `Period` type.
# Examples
```jldoctest
julia> trunc(Dates.DateTime("1996-01-01T12:30:00"), Dates.Day)
julia> trunc(DateTime("1996-01-01T12:30:00"), Day)
1996-01-01T00:00:00
```
"""
Expand All @@ -43,7 +43,7 @@ Adjusts `dt` to the Monday of its week.
# Examples
```jldoctest
julia> Dates.firstdayofweek(DateTime("1996-01-05T12:30:00"))
julia> firstdayofweek(DateTime("1996-01-05T12:30:00"))
1996-01-01T00:00:00
```
"""
Expand All @@ -59,7 +59,7 @@ Adjusts `dt` to the Sunday of its week.
# Examples
```jldoctest
julia> Dates.lastdayofweek(DateTime("1996-01-05T12:30:00"))
julia> lastdayofweek(DateTime("1996-01-05T12:30:00"))
1996-01-07T00:00:00
```
"""
Expand All @@ -75,7 +75,7 @@ Adjusts `dt` to the first day of its month.
# Examples
```jldoctest
julia> Dates.firstdayofmonth(DateTime("1996-05-20"))
julia> firstdayofmonth(DateTime("1996-05-20"))
1996-05-01T00:00:00
```
"""
Expand All @@ -91,7 +91,7 @@ Adjusts `dt` to the last day of its month.
# Examples
```jldoctest
julia> Dates.lastdayofmonth(DateTime("1996-05-20"))
julia> lastdayofmonth(DateTime("1996-05-20"))
1996-05-31T00:00:00
```
"""
Expand All @@ -110,7 +110,7 @@ Adjusts `dt` to the first day of its year.
# Examples
```jldoctest
julia> Dates.firstdayofyear(DateTime("1996-05-20"))
julia> firstdayofyear(DateTime("1996-05-20"))
1996-01-01T00:00:00
```
"""
Expand All @@ -126,7 +126,7 @@ Adjusts `dt` to the last day of its year.
# Examples
```jldoctest
julia> Dates.lastdayofyear(DateTime("1996-05-20"))
julia> lastdayofyear(DateTime("1996-05-20"))
1996-12-31T00:00:00
```
"""
Expand All @@ -145,10 +145,10 @@ Adjusts `dt` to the first day of its quarter.
# Examples
```jldoctest
julia> Dates.firstdayofquarter(DateTime("1996-05-20"))
julia> firstdayofquarter(DateTime("1996-05-20"))
1996-04-01T00:00:00
julia> Dates.firstdayofquarter(DateTime("1996-08-20"))
julia> firstdayofquarter(DateTime("1996-08-20"))
1996-07-01T00:00:00
```
"""
Expand All @@ -168,10 +168,10 @@ Adjusts `dt` to the last day of its quarter.
# Examples
```jldoctest
julia> Dates.lastdayofquarter(DateTime("1996-05-20"))
julia> lastdayofquarter(DateTime("1996-05-20"))
1996-06-30T00:00:00
julia> Dates.lastdayofquarter(DateTime("1996-08-20"))
julia> lastdayofquarter(DateTime("1996-08-20"))
1996-09-30T00:00:00
```
"""
Expand Down Expand Up @@ -221,13 +221,13 @@ pursue before throwing an error (given that `f::Function` is never satisfied).
# Examples
```jldoctest
julia> Date(date -> Dates.week(date) == 20, 2010, 01, 01)
julia> Date(date -> week(date) == 20, 2010, 01, 01)
2010-05-17
julia> Date(date -> Dates.year(date) == 2010, 2000, 01, 01)
julia> Date(date -> year(date) == 2010, 2000, 01, 01)
2010-01-01
julia> Date(date -> Dates.month(date) == 10, 2000, 01, 01; limit = 5)
julia> Date(date -> month(date) == 10, 2000, 01, 01; limit = 5)
ERROR: ArgumentError: Adjustment limit reached: 5 iterations
Stacktrace:
[...]
Expand All @@ -248,10 +248,10 @@ pursue before throwing an error (in the case that `f::Function` is never satisfi
# Examples
```jldoctest
julia> DateTime(dt -> Dates.second(dt) == 40, 2010, 10, 20, 10; step = Dates.Second(1))
julia> DateTime(dt -> second(dt) == 40, 2010, 10, 20, 10; step = Second(1))
2010-10-20T10:00:40
julia> DateTime(dt -> Dates.hour(dt) == 20, 2010, 10, 20, 10; step = Dates.Hour(1), limit = 5)
julia> DateTime(dt -> hour(dt) == 20, 2010, 10, 20, 10; step = Hour(1), limit = 5)
ERROR: ArgumentError: Adjustment limit reached: 5 iterations
Stacktrace:
[...]
Expand Down Expand Up @@ -291,13 +291,13 @@ arguments are provided, the default step will be `Millisecond(1)` instead of `Se
# Examples
```jldoctest
julia> Dates.Time(t -> Dates.minute(t) == 30, 20)
julia> Time(t -> minute(t) == 30, 20)
20:30:00
julia> Dates.Time(t -> Dates.minute(t) == 0, 20)
julia> Time(t -> minute(t) == 0, 20)
20:00:00
julia> Dates.Time(t -> Dates.hour(t) == 10, 3; limit = 5)
julia> Time(t -> hour(t) == 10, 3; limit = 5)
ERROR: ArgumentError: Adjustment limit reached: 5 iterations
Stacktrace:
[...]
Expand Down
8 changes: 4 additions & 4 deletions stdlib/Dates/src/periods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,16 @@ Reduces the `CompoundPeriod` into its canonical form by applying the following r
# Examples
```jldoctest
julia> Dates.canonicalize(Dates.CompoundPeriod(Dates.Hour(12), Dates.Hour(13)))
julia> canonicalize(Dates.CompoundPeriod(Dates.Hour(12), Dates.Hour(13)))
1 day, 1 hour
julia> Dates.canonicalize(Dates.CompoundPeriod(Dates.Hour(-1), Dates.Minute(1)))
julia> canonicalize(Dates.CompoundPeriod(Dates.Hour(-1), Dates.Minute(1)))
-59 minutes
julia> Dates.canonicalize(Dates.CompoundPeriod(Dates.Month(1), Dates.Week(-2)))
julia> canonicalize(Dates.CompoundPeriod(Dates.Month(1), Dates.Week(-2)))
1 month, -2 weeks
julia> Dates.canonicalize(Dates.CompoundPeriod(Dates.Minute(50000)))
julia> canonicalize(Dates.CompoundPeriod(Dates.Minute(50000)))
4 weeks, 6 days, 17 hours, 20 minutes
```
"""
Expand Down
40 changes: 20 additions & 20 deletions stdlib/Dates/src/query.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ Return 366 if the year of `dt` is a leap year, otherwise return 365.
# Examples
```jldoctest
julia> Dates.daysinyear(1999)
julia> daysinyear(1999)
365
julia> Dates.daysinyear(2000)
julia> daysinyear(2000)
366
```
"""
Expand All @@ -114,7 +114,7 @@ Return the day of the week as an [`Int64`](@ref) with `1 = Monday, 2 = Tuesday,
# Examples
```jldoctest
julia> Dates.dayofweek(Date("2000-01-01"))
julia> dayofweek(Date("2000-01-01"))
6
```
"""
Expand Down Expand Up @@ -159,10 +159,10 @@ the given `locale`. Also accepts `Integer`.
# Examples
```jldoctest
julia> Dates.dayname(Date("2000-01-01"))
julia> dayname(Date("2000-01-01"))
"Saturday"
julia> Dates.dayname(4)
julia> dayname(4)
"Thursday"
```
"""
Expand All @@ -179,10 +179,10 @@ in the given `locale`. Also accepts `Integer`.
# Examples
```jldoctest
julia> Dates.dayabbr(Date("2000-01-01"))
julia> dayabbr(Date("2000-01-01"))
"Sat"
julia> Dates.dayabbr(3)
julia> dayabbr(3)
"Wed"
```
"""
Expand All @@ -209,13 +209,13 @@ month, etc.` In the range 1:5.
# Examples
```jldoctest
julia> Dates.dayofweekofmonth(Date("2000-02-01"))
julia> dayofweekofmonth(Date("2000-02-01"))
1
julia> Dates.dayofweekofmonth(Date("2000-02-08"))
julia> dayofweekofmonth(Date("2000-02-08"))
2
julia> Dates.dayofweekofmonth(Date("2000-02-15"))
julia> dayofweekofmonth(Date("2000-02-15"))
3
```
"""
Expand All @@ -240,10 +240,10 @@ function.
# Examples
```jldoctest
julia> Dates.daysofweekinmonth(Date("2005-01-01"))
julia> daysofweekinmonth(Date("2005-01-01"))
5
julia> Dates.daysofweekinmonth(Date("2005-01-04"))
julia> daysofweekinmonth(Date("2005-01-04"))
4
```
"""
Expand Down Expand Up @@ -569,10 +569,10 @@ Return the full name of the month of the `Date` or `DateTime` or `Integer` in th
# Examples
```jldoctest
julia> Dates.monthname(Date("2005-01-04"))
julia> monthname(Date("2005-01-04"))
"January"
julia> Dates.monthname(2)
julia> monthname(2)
"February"
```
"""
Expand All @@ -588,7 +588,7 @@ Return the abbreviated month name of the `Date` or `DateTime` or `Integer` in th
# Examples
```jldoctest
julia> Dates.monthabbr(Date("2005-01-04"))
julia> monthabbr(Date("2005-01-04"))
"Jan"
julia> monthabbr(2)
Expand All @@ -606,13 +606,13 @@ Return the number of days in the month of `dt`. Value will be 28, 29, 30, or 31.
# Examples
```jldoctest
julia> Dates.daysinmonth(Date("2000-01"))
julia> daysinmonth(Date("2000-01"))
31
julia> Dates.daysinmonth(Date("2001-02"))
julia> daysinmonth(Date("2001-02"))
28
julia> Dates.daysinmonth(Date("2000-02"))
julia> daysinmonth(Date("2000-02"))
29
```
"""
Expand All @@ -626,10 +626,10 @@ Return `true` if the year of `dt` is a leap year.
# Examples
```jldoctest
julia> Dates.isleapyear(Date("2004"))
julia> isleapyear(Date("2004"))
true
julia> Dates.isleapyear(Date("2005"))
julia> isleapyear(Date("2005"))
false
```
"""
Expand Down
Loading

0 comments on commit b73bf86

Please sign in to comment.