Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elixir/lib/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ defmodule Application do
config :my_app, Databases.RepoTwo,
# Another database configuration (for the same OTP app)
ip: "localhost",
port: 20717
port: 20_717

config :my_app, my_app_databases: [Databases.RepoOne, Databases.RepoTwo]

Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/lib/calendar/date.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule Date do
iex> Date.diff(~D[2010-04-17], ~D[1970-01-01])
14716

iex> Date.add(~D[1970-01-01], 14716)
iex> Date.add(~D[1970-01-01], 14_716)
~D[2010-04-17]

iex> Date.shift(~D[1970-01-01], year: 40, month: 3, week: 2, day: 2)
Expand Down
32 changes: 16 additions & 16 deletions lib/elixir/lib/calendar/iso.ex
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ defmodule Calendar.ISO do

@type day_of_year :: 1..366
@type quarter_of_year :: 1..4
@type year_of_era :: {1..10000, era}
@type year_of_era :: {1..10_000, era}

@seconds_per_minute 60
@seconds_per_hour 60 * 60
Expand Down Expand Up @@ -652,7 +652,7 @@ defmodule Calendar.ISO do
day_fraction = time_to_day_fraction(hour, minute, second, {0, 0})

{{year, month, day}, {hour, minute, second, _}} =
case add_day_fraction_to_iso_days({0, day_fraction}, -offset, 86400) do
case add_day_fraction_to_iso_days({0, day_fraction}, -offset, 86_400) do
{0, day_fraction} ->
{{year, month, day}, time_from_day_fraction(day_fraction)}

Expand Down Expand Up @@ -784,13 +784,13 @@ defmodule Calendar.ISO do

## Examples

iex> Calendar.ISO.naive_datetime_from_iso_days({0, {0, 86400}})
iex> Calendar.ISO.naive_datetime_from_iso_days({0, {0, 86_400}})
{0, 1, 1, 0, 0, 0, {0, 6}}
iex> Calendar.ISO.naive_datetime_from_iso_days({730_485, {0, 86400}})
iex> Calendar.ISO.naive_datetime_from_iso_days({730_485, {0, 86_400}})
{2000, 1, 1, 0, 0, 0, {0, 6}}
iex> Calendar.ISO.naive_datetime_from_iso_days({730_485, {43200, 86400}})
iex> Calendar.ISO.naive_datetime_from_iso_days({730_485, {43_200, 86_400}})
{2000, 1, 1, 12, 0, 0, {0, 6}}
iex> Calendar.ISO.naive_datetime_from_iso_days({-365, {0, 86400000000}})
iex> Calendar.ISO.naive_datetime_from_iso_days({-365, {0, 86_400_000_000}})
{-1, 1, 1, 0, 0, 0, {0, 6}}

"""
Expand Down Expand Up @@ -1133,7 +1133,7 @@ defmodule Calendar.ISO do

"""
@doc since: "1.8.0"
@spec year_of_era(year) :: {1..10000, era}
@spec year_of_era(year) :: {1..10_000, era}
def year_of_era(year) when is_year_CE(year), do: {year, 1}
def year_of_era(year) when is_year_BCE(year), do: {abs(year) + 1, 0}

Expand All @@ -1159,7 +1159,7 @@ defmodule Calendar.ISO do
"""
@doc since: "1.13.0"
@impl true
@spec year_of_era(year, month, day) :: {1..10000, era}
@spec year_of_era(year, month, day) :: {1..10_000, era}
def year_of_era(year, _month, _day), do: year_of_era(year)

@doc """
Expand Down Expand Up @@ -1704,11 +1704,11 @@ defmodule Calendar.ISO do

## Examples

iex> Calendar.ISO.iso_days_to_beginning_of_day({0, {0, 86400000000}})
iex> Calendar.ISO.iso_days_to_beginning_of_day({0, {0, 86_400_000_000}})
{0, {0, 86400000000}}
iex> Calendar.ISO.iso_days_to_beginning_of_day({730485, {43200000000, 86400000000}})
iex> Calendar.ISO.iso_days_to_beginning_of_day({730_485, {43_200_000_000, 86_400_000_000}})
{730485, {0, 86400000000}}
iex> Calendar.ISO.iso_days_to_beginning_of_day({730485, {46800000000, 86400000000}})
iex> Calendar.ISO.iso_days_to_beginning_of_day({730_485, {46_800_000_000, 86_400_000_000}})
{730485, {0, 86400000000}}

"""
Expand All @@ -1724,11 +1724,11 @@ defmodule Calendar.ISO do

## Examples

iex> Calendar.ISO.iso_days_to_end_of_day({0, {0, 86400000000}})
iex> Calendar.ISO.iso_days_to_end_of_day({0, {0, 86_400_000_000}})
{0, {86399999999, 86400000000}}
iex> Calendar.ISO.iso_days_to_end_of_day({730485, {43200000000, 86400000000}})
iex> Calendar.ISO.iso_days_to_end_of_day({730_485, {43_200_000_000, 86_400_000_000}})
{730485, {86399999999, 86400000000}}
iex> Calendar.ISO.iso_days_to_end_of_day({730485, {46800000000, 86400000000}})
iex> Calendar.ISO.iso_days_to_end_of_day({730_485, {46_800_000_000, 86_400_000_000}})
{730485, {86399999999, 86400000000}}

"""
Expand Down Expand Up @@ -1888,7 +1888,7 @@ defmodule Calendar.ISO do

def shift_time_unit({_days, _day_fraction} = iso_days, value, unit)
when unit in [:second, :millisecond, :microsecond, :nanosecond] or is_integer(unit) do
ppd = System.convert_time_unit(86400, :second, unit)
ppd = System.convert_time_unit(86_400, :second, unit)
add_day_fraction_to_iso_days(iso_days, value, ppd)
end

Expand Down Expand Up @@ -1937,7 +1937,7 @@ defmodule Calendar.ISO do
}) do
[
month: year * 12 + month,
second: week * 7 * 86400 + day * 86400 + hour * 3600 + minute * 60 + second,
second: week * 7 * 86_400 + day * 86_400 + hour * 3600 + minute * 60 + second,
microsecond: microsecond
]
end
Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/lib/file.ex
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ defmodule File do
File.touch("/fakedir/b.txt", {{2018, 1, 30}, {13, 59, 59}})
{:error, :enoent}

File.touch("/tmp/a.txt", 1544519753)
File.touch("/tmp/a.txt", 1_544_519_753)
#=> :ok

"""
Expand Down Expand Up @@ -733,7 +733,7 @@ defmodule File do
File.touch!("/fakedir/b.txt", {{2018, 1, 30}, {13, 59, 59}})
** (File.Error) could not touch "/fakedir/b.txt": no such file or directory

File.touch!("/tmp/a.txt", 1544519753)
File.touch!("/tmp/a.txt", 1_544_519_753)

"""
@spec touch!(Path.t(), erlang_time() | posix_time()) :: :ok
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/lib/kernel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6375,7 +6375,7 @@ defmodule Kernel do

With a timeout:

iex> to_timeout(5400000)
iex> to_timeout(5_400_000)
5400000
iex> to_timeout(:infinity)
:infinity
Expand Down
4 changes: 2 additions & 2 deletions lib/elixir/lib/process.ex
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ defmodule Process do
@spec flag(:min_bin_vheap_size, non_neg_integer) :: non_neg_integer
@spec flag(:min_heap_size, non_neg_integer) :: non_neg_integer
@spec flag(:priority, priority_level) :: priority_level
@spec flag(:save_calls, 0..10000) :: 0..10000
@spec flag(:save_calls, 0..10_000) :: 0..10_000
@spec flag(:sensitive, boolean) :: boolean
@spec flag(:trap_exit, boolean) :: boolean
defdelegate flag(flag, value), to: :erlang, as: :process_flag
Expand All @@ -858,7 +858,7 @@ defmodule Process do

Inlined by the compiler.
"""
@spec flag(pid, :save_calls, 0..10000) :: 0..10000
@spec flag(pid, :save_calls, 0..10_000) :: 0..10_000
defdelegate flag(pid, flag, value), to: :erlang, as: :process_flag

@doc """
Expand Down
2 changes: 1 addition & 1 deletion lib/elixir/pages/getting-started/erlang-libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ The [`:rand`](`:rand`) has functions for returning random values and setting the
```elixir
iex> :rand.uniform()
0.8175669086010815
iex> _ = :rand.seed(:exs1024, {123, 123534, 345345})
iex> _ = :rand.seed(:exs1024, {123, 123_534, 345_345})
iex> :rand.uniform()
0.5820506340260994
iex> :rand.uniform(6)
Expand Down
10 changes: 5 additions & 5 deletions lib/ex_unit/lib/ex_unit/formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,16 @@ defmodule ExUnit.Formatter do

## Examples

iex> format_times(%{run: 10000, async: nil, load: nil})
iex> format_times(%{run: 10_000, async: nil, load: nil})
"Finished in 0.01 seconds (0.00s async, 0.01s sync)"

iex> format_times(%{run: 10000, async: nil, load: 20000})
iex> format_times(%{run: 10_000, async: nil, load: 20_000})
"Finished in 0.03 seconds (0.02s on load, 0.00s async, 0.01s sync)"

iex> format_times(%{run: 10000, async: nil, load: 200_000})
iex> format_times(%{run: 10_000, async: nil, load: 200_000})
"Finished in 0.2 seconds (0.2s on load, 0.00s async, 0.01s sync)"

iex> format_times(%{run: 100_000, async: 50000, load: 200_000})
iex> format_times(%{run: 100_000, async: 50_000, load: 200_000})
"Finished in 0.3 seconds (0.2s on load, 0.05s async, 0.05s sync)"

"""
Expand All @@ -215,7 +215,7 @@ defmodule ExUnit.Formatter do
end

defp normalize_us(nil), do: 0
defp normalize_us(us), do: div(us, 10000)
defp normalize_us(us), do: div(us, 10_000)

defp format_us(us) do
if us < 10 do
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_unit/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ defmodule ExUnit.MixProject do
slowest: 0,
slowest_modules: 0,
stacktrace_depth: 20,
timeout: 60000,
timeout: 60_000,
trace: false,
after_suite: [],
repeat_until_failure: 0,
Expand Down
4 changes: 2 additions & 2 deletions lib/ex_unit/test/ex_unit_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ defmodule ExUnitTest do
output = capture_io(fn -> ExUnit.run() end)
assert output =~ "** (ExUnit.TimeoutError) test timed out after 5ms"
after
ExUnit.configure(timeout: 60000)
ExUnit.configure(timeout: 60_000)
end

test "reports slow tests" do
Expand Down Expand Up @@ -281,7 +281,7 @@ defmodule ExUnitTest do
config = ExUnit.configuration()
assert config[:trace]
assert config[:max_cases] == 1
assert config[:timeout] == 60000
assert config[:timeout] == 60_000
end

test "sets trace when slowest is enabled" do
Expand Down
2 changes: 1 addition & 1 deletion lib/logger/lib/logger/formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ defmodule Logger.Formatter do
> discarded.
"""

@type date :: {1970..10000, 1..12, 1..31}
@type date :: {1970..10_000, 1..12, 1..31}
@type time_ms :: {0..23, 0..59, 0..59, 0..999}
@type date_time_ms :: {date, time_ms}

Expand Down
2 changes: 1 addition & 1 deletion lib/logger/test/logger/formatter_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule Logger.FormatterTest do
assert truncate(~c"ol" ++ "á", 4) == ~c"ol" ++ "á"

# :infinity
long_string = String.duplicate("foo", 10000)
long_string = String.duplicate("foo", 10_000)
assert truncate(long_string, :infinity) == long_string
end

Expand Down
2 changes: 1 addition & 1 deletion lib/logger/test/logger/utils_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ defmodule Logger.UtilsTest do
end

test "with :infinity truncate" do
long_string = String.duplicate("foo", 10000)
long_string = String.duplicate("foo", 10_000)
assert scan_inspect(~c"~ts", [long_string], :infinity) == {~c"~ts", [long_string]}
end
end
4 changes: 2 additions & 2 deletions lib/mix/lib/mix/tasks/deps.partition.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ defmodule Mix.Tasks.Deps.Partition do

clients =
Enum.map(1..count//1, fn _ ->
with {:ok, client} <- :gen_tcp.accept(socket, 15000),
{:ok, message} <- :gen_tcp.recv(client, 0, 15000) do
with {:ok, client} <- :gen_tcp.accept(socket, 15_000),
{:ok, message} <- :gen_tcp.recv(client, 0, 15_000) do
:inet.setopts(client, active: true)
index = message |> String.trim() |> String.to_integer()
%{port: Map.fetch!(ports, index), index: index, socket: client}
Expand Down
2 changes: 1 addition & 1 deletion lib/mix/lib/mix/tasks/profile.cprof.ex
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ defmodule Mix.Tasks.Profile.Cprof do
Other caveats are the impossibility to call count trace BIFs, since breakpoints can
only be set on BEAM code; functions calls performed by `:cprof` are not traced; the
maximum size of a call counter is equal to the host machine's word size
(for example, 2147483647 in a 32-bit host).
(for example, `2_147_483_647` in a 32-bit host).
"""

@typedoc """
Expand Down