code stringlengths 114 1.05M | path stringlengths 3 312 | quality_prob float64 0.5 0.99 | learning_prob float64 0.2 1 | filename stringlengths 3 168 | kind stringclasses 1
value |
|---|---|---|---|---|---|
defmodule Nostrum.Struct.User do
@moduledoc ~S"""
Struct representing a Discord user.
## Mentioning Users in Messages
A `Nostrum.Struct.User` can be mentioned in message content using the `String.Chars`
protocol or `mention/1`.
```Elixir
user = %Nostrum.Struct.User{id: 120571255635181568}
Nostrum.Api... | lib/nostrum/struct/user.ex | 0.899334 | 0.692525 | user.ex | starcoder |
defmodule LastCrusader.Webmentions.Sender do
@moduledoc """
Schedules webmentions to be send
It first checks of the origin exists before sending webmentions. It will retry this check every minute until it reaches the configured number of tries.
"""
alias LastCrusader.Micropub
alias Webmentions
require Lo... | lib/last_crusader/webmentions/webmentions_sender.ex | 0.699768 | 0.453685 | webmentions_sender.ex | starcoder |
defmodule AntlPhonenumber.Range do
@moduledoc """
Defines a range of phone numbers.
"""
defstruct first: nil, last: nil, iso_country_code: nil
@type t :: %__MODULE__{
first: String.t(),
last: String.t(),
iso_country_code: String.t()
}
@doc """
Creates a new range.
... | lib/antl_phonenumber/range.ex | 0.823151 | 0.464902 | range.ex | starcoder |
defmodule Neotomex.Grammar do
@moduledoc """
# Neotomex.Grammar
A Neotomex PEG grammar specifies a directed graph of definitons.
It consists of:
- A set of definitions, where each definition consists of an
`identifier` and an `expression`.
e.g. `Definition <- Identifier '<-' Expression`
- The root... | lib/neotomex/grammar.ex | 0.772917 | 0.945273 | grammar.ex | starcoder |
defmodule Concentrate.Encoder.GTFSRealtimeHelpers do
@moduledoc """
Helper functions for encoding GTFS-Realtime files.
"""
alias Concentrate.{StopTimeUpdate, TripDescriptor, VehiclePosition}
import Calendar.ISO, only: [date_to_string: 4]
@type trip_group :: {TripDescriptor.t() | nil, [VehiclePosition.t()],... | lib/concentrate/encoder/gtfs_realtime_helpers.ex | 0.840226 | 0.567517 | gtfs_realtime_helpers.ex | starcoder |
defmodule PlayfabEx.Server.PlayerDataManagement do
use Interface
@doc """
Deletes the users for the provided game. Deletes custom data, all account linkages, and statistics.
[online docs](https://api.playfab.com/documentation/server/method/DeleteUsers)
"""
@spec delete_users(map()) :: {:ok, map} | {:error... | lib/server/player_data_management.ex | 0.783036 | 0.421611 | player_data_management.ex | starcoder |
defmodule Kernel.Typespec do
@moduledoc """
This is the module that converts Elixir typespecs
to Erlang typespecs syntax. Everytime @spec, @type
and @typep are used they proxy to the functions
in this module.
"""
defmacro deftype(name, options // []) do
_deftype(name, true, __CALLER__, options)
end... | lib/elixir/lib/kernel/typespec.ex | 0.67822 | 0.456652 | typespec.ex | starcoder |
defmodule CpuUtil do
@moduledoc """
CPU utility functions.
Functions to read and calculate CPU utilization for a given process.
NOTE: Only *nix systems supported.
"""
require Logger
@type proc_pid_stat :: %{
# process id
pid: integer(),
# filename of the executable
... | lib/cpu_util.ex | 0.829216 | 0.483831 | cpu_util.ex | starcoder |
defmodule LastfmArchive.Utils do
@moduledoc false
@data_dir Application.get_env(:lastfm_archive, :data_dir, "./archive_data/")
@metadata_file ".archive"
@file_io Application.get_env(:lastfm_archive, :file_io)
@doc """
Generate {from, to} daily time ranges for querying Last.fm API based on
the first and... | lib/utils.ex | 0.727007 | 0.590573 | utils.ex | starcoder |
defmodule Still.Utils do
@moduledoc """
Collection of utility functions.
"""
alias Still.SourceFile
@doc """
Returns the modified time of a given file. Errors if the file does not exist.
"""
def get_modified_time!(path) do
path
|> File.stat!()
|> Map.get(:mtime)
|> Timex.to_datetime()
... | lib/still/utils.ex | 0.877424 | 0.432003 | utils.ex | starcoder |
defmodule Playwright.Helpers.Serialization do
@moduledoc false
import Playwright.Extra.Map
def deserialize(value) when is_map(value) do
case value do
%{a: array} ->
Enum.map(array, fn item ->
deserialize(item)
end)
%{b: boolean} ->
boolean
%{n: number} ->... | lib/playwright/helpers/serialization.ex | 0.808823 | 0.536981 | serialization.ex | starcoder |
defmodule Openflow.Action.Output do
@moduledoc """
Action for sends packets out `port_number`.
"""
defstruct port_number: 0,
max_len: :no_buffer
alias __MODULE__
@type port_no ::
0..0xFFFFFFFF
| :max
| :in_port
| :table
| :normal
| :... | lib/openflow/actions/output.ex | 0.86031 | 0.572215 | output.ex | starcoder |
defmodule Request.Validator.Plug do
alias Plug.Conn
alias Request.Validator
alias Request.Validator.Rules
import Plug.Conn
@doc ~S"""
Init the Request.Validation.Plug with an optional error callback
and handlers with their corresponding request validator module.
```elixir
plug Request.Validation.Pl... | lib/plug.ex | 0.743447 | 0.506408 | plug.ex | starcoder |
defmodule Phoenix.View do
@moduledoc """
Defines the view layer of a Phoenix application.
The view layer contains conveniences for rendering templates,
including support for layouts and encoders per format.
## Examples
Phoenix defines the view template at `lib/your_app_web.ex`:
defmodule YourAppWe... | lib/phoenix/view.ex | 0.915257 | 0.516839 | view.ex | starcoder |
defmodule Ueberauth.Strategy.EVESSO.OAuth do
@moduledoc """
Implements OAuth2 for EVE SSO v2 with JWT.
Include your `client_id` and `secret_key` in your config:
```elixir
config :ueberauth, Ueberauth.Strategy.EVESSO.OAuth,
client_id: System.get_env("EVE_SSO_CLIENT_ID"),
client_secret: System.get_env... | lib/ueberauth/strategy/evesso/oauth.ex | 0.769773 | 0.67173 | oauth.ex | starcoder |
defmodule Coinbase.Pro.REST.Request do
@moduledoc """
Module responsible for wrapping logic of the HTTP requests
issues to the Coinbase Pro API.
## Example
```elixir
alias Coinbase.Pro.REST.{Context,Request}
# Obtain these values from Coinbase
context = %Context{key: "...", secret: "...", passphrase: ... | lib/coinbasepro_rest/request.ex | 0.864896 | 0.534491 | request.ex | starcoder |
defmodule CbLocomotion.Locomotion do
@moduledoc """
The main interface for moving the robot. Interacts with the two stepper motors
to move the robot forward, back, left, right, stop, and set the rate at which
both motors turn.
"""
@name __MODULE__
use GenServer
alias CbLocomotion.StepperMotor
def st... | apps/cb_locomotion/lib/cb_locomotion/locomotion.ex | 0.67822 | 0.504394 | locomotion.ex | starcoder |
defmodule Affine.Generator do
@moduledoc """
Module enclosing the high level transform creating capabilities.
An easy API for creating and using Affine transforms uses the flexibility
provided in Elixir to more elegantly define the transforms. This requires a bit more processing but generally would not be a bu... | lib/affine/generator.ex | 0.932607 | 0.974459 | generator.ex | starcoder |
defmodule Benchmark.Stats.HistogramOpts do
defstruct num_buckets: 32, growth_factor: 0.0, base_bucket_size: 1.0, min_value: 0
end
defmodule Benchmark.Stats.HistogramBucket do
defstruct low_bound: 0, count: 0
end
defmodule Benchmark.Stats.Histogram do
defstruct buckets: [],
min: nil,
max:... | benchmark/lib/benchmark/stats/histogram.ex | 0.786869 | 0.528412 | histogram.ex | starcoder |
defmodule Terp.Evaluate do
@doc """
This module contains the core evaluation logic.
"""
alias Terp.Error
alias Terp.ModuleSystem
alias Terp.Value
alias Terp.Evaluate.Arithmetic
alias Terp.Evaluate.Boolean
alias Terp.Evaluate.Environment
alias Terp.Evaluate.Function
alias Terp.Evaluate.List, as: Te... | lib/evaluate/evaluate.ex | 0.699973 | 0.436262 | evaluate.ex | starcoder |
defmodule Weather.Weather do
@moduledoc """
Handle fetching of weather forecast data from the Forecast.io web service.
"""
alias HTTPotion.Response
alias Weather.Weather
@user_agent Application.get_env :weather, :user_agent
@forecast_api_url Application.get_env :weather, :forecast_io_web_service_url
@... | lib/weather/weather.ex | 0.876291 | 0.48121 | weather.ex | starcoder |
[1, x, 4, y] = [1, 2, 4, 8]
IO.puts x
IO.puts y
insert = [2, 4, 8]
full = [1, insert, 16, 32]
IO.inspect full
neat = List.flatten(full)
IO.inspect neat
a = [1, 2, 4]
b = [8, 16, 32]
IO.inspect [a, b] # [[1, 2, 4], [8, 16, 32]]
IO.inspect Enum.concat(a, b) # [1, 2, 4, 8, 16, 32]
IO.inspect a ++ b ... | other/lists.ex | 0.538012 | 0.668352 | lists.ex | starcoder |
defmodule Membrane.Core.Element.DemandController do
@moduledoc false
# Module handling demands incoming through output pads.
use Bunch
alias Membrane.Core.CallbackHandler
alias Membrane.Core.Child.PadModel
alias Membrane.Core.Element.{ActionHandler, State}
alias Membrane.Element.CallbackContext
alias... | lib/membrane/core/element/demand_controller.ex | 0.777046 | 0.438905 | demand_controller.ex | starcoder |
defmodule Membrane.ICE.Handshake do
@moduledoc """
Behaviour that specifies functions that have to be implemented in order to perform handshake
after establishing ICE connection.
One instance of this module is responsible for performing handshake only for one component.
"""
@type t :: module
@typedoc "... | lib/membrane_ice_plugin/handshake/handshake.ex | 0.871844 | 0.439086 | handshake.ex | starcoder |
defmodule Zippy.ZBinTree do
@moduledoc """
This module implements Zipper binary trees, that allow you to traverse them in two directions.
This module is a port of <NAME>'s [“Zippers”](https://github.com/ferd/zippers) library, under the MIT licence.
"""
alias __MODULE__
## Type declarations
@typep ... | lib/zippy/ZBinTree.ex | 0.889325 | 0.578865 | ZBinTree.ex | starcoder |
defmodule Calcinator.Resources do
@moduledoc """
A module that exposes Ecto schema structs
"""
alias Alembic.{Document, Error, Source}
alias Calcinator.Resources.{Page, Sorts}
# Types
@typedoc """
ID that uniquely identifies the `struct`
"""
@type id :: term
@typedoc """
Pagination informati... | lib/calcinator/resources.ex | 0.921065 | 0.449091 | resources.ex | starcoder |
defmodule Sanbase.Signal.SignalAdapter do
@behaviour Sanbase.Signal.Behaviour
import Sanbase.Signal.SqlQuery
import Sanbase.Utils.Transform, only: [maybe_unwrap_ok_value: 1, maybe_apply_function: 2]
alias Sanbase.Signal.FileHandler
alias Sanbase.ClickhouseRepo
@aggregations FileHandler.aggregations()
@... | lib/sanbase/signal/signal_adapter.ex | 0.662251 | 0.472562 | signal_adapter.ex | starcoder |
defmodule PhoenixPresenceList do
@moduledoc """
Documentation for PhoenixPresenceList.
"""
@doc """
Sync the given presence list using a diff of presence join and leave events.
Returns the updated presence list. In case information on leaves and joins
is needed, have a look at `apply_diff/2`.
## Exam... | lib/phoenix_presence_list.ex | 0.85555 | 0.454593 | phoenix_presence_list.ex | starcoder |
defmodule Day7 do
def run_part1() do
AOCHelper.read_input()
|> Solution.count_bags_containing(:shiny_gold)
end
def run_part2() do
AOCHelper.read_input()
|> Solution.count_bags_inside_bag(:shiny_gold)
end
def debug_sample() do
[
"light red bags contain 1 bright white bag, 2 muted ye... | aoc-2020/day7/lib/day7.ex | 0.63114 | 0.503052 | day7.ex | starcoder |
defmodule Mix.Task do
@moduledoc """
A simple module that provides conveniences for creating,
loading and manipulating tasks.
A Mix task can be defined by simply using `Mix.Task`
in a module starting with `Mix.Tasks.` and defining
the `run/1` function:
defmodule Mix.Tasks.Hello do
use Mix.Ta... | lib/mix/lib/mix/task.ex | 0.840259 | 0.649273 | task.ex | starcoder |
defmodule Forth.Builtins do
alias Forth.Exceptions
defmodule Internals do
def block_eval(block_tuple, stack, closure \\ %{})
def block_eval([], stack, _),
do: stack
def block_eval([{:capture, capture_list}|rest], stack, closure) do
{next_stack, next_closure} = create_closure(capture_list, ... | lib/forth/builtins.ex | 0.655887 | 0.414721 | builtins.ex | starcoder |
defmodule Ash.SatSolver do
@moduledoc false
alias Ash.Filter
alias Ash.Filter.{Expression, Not, Predicate}
def strict_filter_subset(filter, candidate) do
case {filter, candidate} do
{%{expression: nil}, %{expression: nil}} ->
true
{%{expression: nil}, _candidate_expr} ->
true
... | lib/sat_solver.ex | 0.710829 | 0.442938 | sat_solver.ex | starcoder |
defmodule Mint.HTTP do
@moduledoc """
Processless HTTP connection data structure and functions.
Single interface for `Mint.HTTP1` and `Mint.HTTP2` with support for version
negotiation and proxies.
## Usage
To establish a connection with a given server, use `connect/4`. This will
return an opaque data s... | lib/mint/http.ex | 0.925672 | 0.753784 | http.ex | starcoder |
defmodule ExploringElixir.Benchmark.Map do
def match do
%{dates: dates, atoms: atoms} = init_maps()
count = 1000
Benchee.run %{
"Function header matching" =>
fn -> function_headers(dates, atoms, count, count) end,
"Inline matching" =>
fn -> inline_match(dates, atoms, count, co... | lib/exploring_elixir/e002/benchmark_map.ex | 0.598312 | 0.62385 | benchmark_map.ex | starcoder |
defmodule Exq.Manager.Server do
@moduledoc """
The Manager module is the main orchestrator for the system.
It is also the entry point Pid process used by the client to interact
with the Exq system.
It's responsibilities include:
* Handle interaction with client and delegate to responsible sub-system
... | lib/exq/manager/server.ex | 0.690142 | 0.694516 | server.ex | starcoder |
defmodule Mix.Tasks.Hex.Docs do
use Mix.Task
@shortdoc "Fetches or opens documentation of a package"
@moduledoc """
Fetches or opens documentation of a package.
If no version is specified, defaults to version used in the current mix project.
If called outside of a mix project or the dependency is not use... | lib/mix/tasks/hex.docs.ex | 0.77552 | 0.408129 | hex.docs.ex | starcoder |
defmodule Phoenix.Tracker.Clock do
@moduledoc false
alias Phoenix.Tracker.State
@type context :: State.context()
@type clock :: {State.name(), context}
@doc """
Returns a list of replicas from a list of contexts.
"""
@spec clockset_replicas([clock]) :: [State.name()]
def clockset_replicas(clockset) ... | lib/phoenix/tracker/clock.ex | 0.886506 | 0.424531 | clock.ex | starcoder |
defmodule Mastermind.Strategy do
@moduledoc """
Break the code using Knuth's Algorithm
"""
alias Mastermind.Game
alias Mastermind.Core
@colours [:red, :blue, :green, :black, :orange, :yellow]
@possible_scores %{
{0,0} => 0,
{0,1} => 0,
{0,2} => 0,
{0,3} => 0,
{0,4} => 0,
{1,0} =... | lib/strategy.ex | 0.727975 | 0.571946 | strategy.ex | starcoder |
defmodule Tuple do
@moduledoc """
Functions for working with tuples.
Tuples are ordered collection of elements; tuples can contain elements of any
type, and a tuple can contain elements of different types. Curly braces can be
used to create tuples:
iex> {}
{}
iex> {1, :two, "three"}
... | lib/elixir/lib/tuple.ex | 0.878978 | 0.73077 | tuple.ex | starcoder |
defmodule Vessel.Reducer do
@moduledoc """
This module contains the implementation of the Reducer behaviour for Vessel.
We implement a Pipe and simply group keys to their values on the fly and pass
them through in batches to the `reduce/3` implementation. We keep the order of
values received just to make sur... | lib/vessel/reducer.ex | 0.875807 | 0.600335 | reducer.ex | starcoder |
defmodule Plaid.Institutions do
@moduledoc """
Functions for Plaid `institutions` endpoint.
"""
import Plaid, only: [make_request_with_cred: 4, validate_cred: 1, validate_public_key: 1]
alias Plaid.Utils
@derive Jason.Encoder
defstruct institutions: [], request_id: nil, total: nil
@type t :: %__MODU... | lib/plaid/institutions.ex | 0.790166 | 0.630301 | institutions.ex | starcoder |
defmodule Waffle.Processor do
@moduledoc ~S"""
Apply transformation to files.
Waffle can be used to facilitate transformations of uploaded files
via any system executable. Some common operations you may want to
take on uploaded files include resizing an uploaded avatar with
ImageMagick or extracting a sti... | lib/waffle/processor.ex | 0.87464 | 0.700972 | processor.ex | starcoder |
defmodule Sugar.Controller.Helpers do
@moduledoc """
All controller actions should have an arrity of 2, with the
first argument being a `Plug.Conn` representing the current
connection and the second argument being a `Keyword` list
of any parameters captured in the route path.
Sugar bundles these response h... | lib/sugar/controller/helpers.ex | 0.890473 | 0.669806 | helpers.ex | starcoder |
defmodule AWS.SecurityHub do
@moduledoc """
Security Hub provides you with a comprehensive view of the security state of
your AWS environment and resources.
It also provides you with the readiness status of your environment based on
controls from supported security standards. Security Hub collects security ... | lib/aws/generated/security_hub.ex | 0.848062 | 0.607256 | security_hub.ex | starcoder |
defmodule Membrane.Pad.Data do
@moduledoc """
Struct describing current pad state.
The public fields are:
- `:accepted_caps` - specification of possible caps that are accepted on the pad.
See `Membrane.Caps.Matcher` for more information. This field only applies to elements' pads.
- `:availability` ... | lib/membrane/pad_data.ex | 0.878874 | 0.657624 | pad_data.ex | starcoder |
defmodule Adventofcode.Day04GiantSquid do
use Adventofcode
alias __MODULE__.{Parser, Solver, State}
def part_1(input) do
input
|> Parser.parse()
|> State.new()
|> Solver.solve(:part_1)
end
def part_2(input) do
input
|> Parser.parse()
|> State.new()
|> Solver.solve(:part_2)
... | lib/day_04_giant_squid.ex | 0.668231 | 0.447219 | day_04_giant_squid.ex | starcoder |
defmodule Mix.Tasks.Validation.Gen do
@moduledoc false
use Mix.Task
@shortdoc "Generates the ExUnit tests to cover the validation suite"
@skip ~w{05-033 05-034 05-037 05-038 05-042 06-001 06-002 06-003 06-004}
@groups %{
"TestRelatePP" => %{file_name: "point_point_a", module_name: "PointPointA"},
... | lib/mix/tasks/generate_validation_suite.ex | 0.7413 | 0.510802 | generate_validation_suite.ex | starcoder |
defmodule GBTree.Shim do
alias :gb_trees, as: GB
@opaque t :: GB.tree()
@opaque t(key, value) :: GB.tree(key, value)
@type item :: any
@typedoc """
Anything you can compare with the standard `<`, `>=` etc.
"""
@type comparable :: any()
@typedoc """
All keys in the tree must be comparable, and sh... | lib/mulix/data_types/gb_tree.ex | 0.844329 | 0.503662 | gb_tree.ex | starcoder |
defmodule EQC.Component.Callouts do
@copyright "Quviq AB, 2016"
@moduledoc """
This module contains functions to be used with [Quviq
QuickCheck](http://www.quviq.com). It defines an Elixir version of the callout
language found in `eqc/include/eqc_component.hrl`. For detailed documentation
of the macros, pl... | lib/eqc/component/callouts.ex | 0.80871 | 0.512327 | callouts.ex | starcoder |
defmodule Sagax.Next.Test.Assertions do
alias Sagax.Test.Log
import ExUnit.Assertions
defmacro assert_saga(saga, pattern) do
quote do
if match?({%ExUnit.AssertionError{}, _}, unquote(saga).last_result) do
{error, stacktrace} = unquote(saga).last_result
reraise error, stacktrace
e... | test/support/next/assertions.ex | 0.735167 | 0.734286 | assertions.ex | starcoder |
defmodule LocalTimestamps do
@moduledoc """
Timestamps in local time for Ecto `timestamps()` columns.
Generate Ecto timestamps in local time.
Use this library if:
- you're using MS SQL Server
- you want timestamp columns (`updated_at`, `inserted_at`) to be stored in local time in a `datetimeoffset(n)` col... | lib/local_timestamps.ex | 0.860193 | 0.610221 | local_timestamps.ex | starcoder |
defmodule Gradient.TestHelpers do
alias Gradient.Types, as: T
@examples_path "test/examples"
@examples_build_path "test/examples/_build"
@spec load(String.t()) :: T.forms()
def load(beam_file) do
beam_file = String.to_charlist(Path.join(@examples_build_path, beam_file))
{:ok, {_, [abstract_code: {:... | test/support/helpers.ex | 0.785061 | 0.646509 | helpers.ex | starcoder |
defmodule HELF.Flow do
cond do
System.get_env("HELF_FLOW_FORCE_SYNC") ->
@driver HELF.Flow.Driver.Sync
System.get_env("HELF_FORCE_SYNC") ->
@driver HELF.Flow.Driver.Sync
true ->
case Application.get_env(:helf, :driver, :async) do
:sync ->
@driver HELF.Flow.Driver.Syn... | lib/helf/flow.ex | 0.703346 | 0.691654 | flow.ex | starcoder |
defmodule Sippet.Transports.UDP.Plug do
@moduledoc """
A `Sippet.Transports.Plug` implementing a UDP transport.
The UDP transport consists basically in a listening process, this `Plug`
implementation itself, and a pool of senders, defined in
`Sippet.Transports.UDP.Sender`, managed by `poolboy`.
The `start... | lib/sippet/transports/udp/plug.ex | 0.827759 | 0.438665 | plug.ex | starcoder |
defmodule Function do
@moduledoc """
A set of functions for working with functions.
Anonymous functions are typically created by using `fn`:
iex> add = fn a, b -> a + b end
iex> add.(1, 2)
3
Anonymous functions can also have multiple clauses. All clauses
should expect the same number of a... | lib/elixir/lib/function.ex | 0.905184 | 0.788339 | function.ex | starcoder |
defmodule Irc.Message.Command do
@moduledoc """
A simple type representing the finite set of valid command and reply codes
This type essentially functions as an Enumeration, so while it is technically
just an atom, only a specific set of atoms are considered valid, and
attempting to use invalid values will r... | lib/irc/message/command.ex | 0.552419 | 0.422862 | command.ex | starcoder |
defmodule Glicko do
@moduledoc """
Provides the implementation of the Glicko rating system.
See the [specification](http://www.glicko.net/glicko/glicko2.pdf) for implementation details.
## Usage
Get a player's new rating after a series of matches in a rating period.
iex> results = [Result.new(Player... | lib/glicko.ex | 0.909593 | 0.612744 | glicko.ex | starcoder |
defmodule BigchaindbEx.Condition.ThresholdSha256 do
@moduledoc """
THRESHOLD-SHA-256: Threshold gate condition using SHA-256.
Threshold conditions can be used to create m-of-n multi-signature groups.
Threshold conditions can represent the AND operator by setting the threshold
to equal the number... | lib/bigchaindb_ex/condition/threshold.ex | 0.905769 | 0.539287 | threshold.ex | starcoder |
defmodule PredictedSchedule.Display do
import Phoenix.HTML.Tag, only: [tag: 1, content_tag: 2, content_tag: 3]
import SiteWeb.ViewHelpers, only: [format_schedule_time: 1]
alias Schedules.Schedule
alias Predictions.Prediction
@doc """
Returns the HTML to display a PredictedSchedule's time.
For the commut... | apps/site/lib/predicted_schedule/display.ex | 0.783533 | 0.53279 | display.ex | starcoder |
defmodule Wand.CLI.Commands.Add.Help do
@moduledoc false
def help(:banner) do
"""
Add elixir packages to wand.json
### Usage
**wand** add [package] [package] ... [flags]
## Examples
```
wand add ex_doc mox --test
wand add poison --git="https://github.com/devinus/poison.git"
wan... | lib/cli/commands/add/help.ex | 0.813757 | 0.811527 | help.ex | starcoder |
defmodule Edeliver.Relup.Instructions.SuspendRanchAcceptors do
@moduledoc """
This upgrade instruction suspends the ranch acceptors
to avoid that new connections will be accepted. It will be
inserted right after the "point of no return". When the
upgrade is done, the
`Edeliver.Relup.Instructions... | lib/edeliver/relup/instructions/suspend_ranch_acceptors.ex | 0.668556 | 0.456591 | suspend_ranch_acceptors.ex | starcoder |
defmodule EctoNestedChangeset do
@moduledoc """
This module defines function for manipulating nested changesets.
All functions take a path as the second argument. The path is a list of atoms
(for field names) and integers (for indexes in lists).
"""
import Ecto.Changeset
alias Ecto.Association.NotLoade... | lib/ecto_nested_changeset.ex | 0.88846 | 0.457258 | ecto_nested_changeset.ex | starcoder |
defmodule Geometry.Polygon do
@moduledoc """
A polygon struct, representing a 2D polygon.
A none empty line-string requires at least one ring with four points.
"""
alias Geometry.{GeoJson, LineString, Polygon, WKB, WKT}
defstruct rings: []
@type t :: %Polygon{rings: [Geometry.coordinates()]}
@doc "... | lib/geometry/polygon.ex | 0.941721 | 0.701048 | polygon.ex | starcoder |
defmodule Ofex.BankAccount do
alias Ofex.Transaction
import Ofex.Helpers
import SweetXml
@doc """
Parses `BANKMSGSRSV1` message set for bank account data.
* `:account_number`
* `:balance`
* `:balance_date` `Date` representation (i.e. `~D[2017-01-27]`)
* `:currency` 3 letter ISO-4217 currency identif... | lib/bank_account.ex | 0.681621 | 0.746116 | bank_account.ex | starcoder |
defmodule EtsDeque.Server do
@moduledoc ~S"""
EtsDeque.Server is a GenServer wrapper around an EtsDeque.
It provides safe access to a deque from multiple processes,
ensuring each operation on the deque is atomic.
## Example
iex> {:ok, pid} = EtsDeque.Server.start_link(size: 3)
iex> :ok = EtsDequ... | lib/ets_deque/server.ex | 0.814496 | 0.410372 | server.ex | starcoder |
defmodule Algae.Tree.BinarySearch do
@moduledoc """
Represent a `BinarySearch` tree.
## Examples
iex> alias Algae.Tree.BinarySearch, as: BSTree
...>
...> BSTree.Node.new(
...> 42,
...> BSTree.Node.new(77),
...> BSTree.Node.new(
...> 1234,
...> BSTree... | lib/algae/tree/binary_search.ex | 0.916876 | 0.558026 | binary_search.ex | starcoder |
defmodule StatementsReader.CLI do
@moduledoc """
This main module of the app and is mostly handy at passing options
for the app.
"""
@doc """
The main/1 function that starts the script.
It takes parameters of type one word string
which serves as the options.
"""
@spec main(String.t()) :: String.t()... | lib/cli.ex | 0.677367 | 0.438845 | cli.ex | starcoder |
defmodule StatesLanguage do
@moduledoc """
A macro to parse [StatesLanguage](https://states-language.net/spec.html) JSON and create :gen_statem modules
"""
alias StatesLanguage.{AST, Graph, SchemaLoader}
alias Xema.Validator
require Logger
@schema :states_language
|> :code.priv_dir()
... | lib/states_language.ex | 0.88839 | 0.574096 | states_language.ex | starcoder |
defmodule Raxx.BasicAuth do
@moduledoc """
Add protection to a Raxx application using Basic Authentication.
*Basic Authentication is specified in RFC 7617 (which obsoletes RFC 2617).*
This module provides helpers for submitting and verifying credentials.
### Submitting credentials
A client (or test case... | lib/raxx/basic_auth.ex | 0.828384 | 0.413714 | basic_auth.ex | starcoder |
defmodule Recurly do
@moduledoc """
## Getting Started
This documentation is a work in progress. Please consider contributing.
For now, Read each section on this page.
After reading these sections, these modules may be a good place to start digging.
- `Recurly.Resource` module responsible for creating, u... | lib/recurly.ex | 0.837885 | 0.711807 | recurly.ex | starcoder |
defmodule Juvet.Bot do
@moduledoc """
Bot is a macro interface for working with a bot that is connected to chat services.
## Example
```
defmodule MyBot do
use Juvet.Bot
end
```
"""
defmacro __using__(_) do
quote do
use GenServer
use Juvet.ReceiverTarget
# Client API
... | lib/juvet/bot.ex | 0.900234 | 0.758645 | bot.ex | starcoder |
defmodule Geometry.WKB do
@moduledoc false
alias Geometry.Hex
alias Geometry.WKB.Parser
@compile {:inline, byte_order: 2}
@spec byte_order(Geometry.endian(), Geometry.mode()) :: <<_::8>>
def byte_order(:xdr, :hex), do: "00"
def byte_order(:ndr, :hex), do: "01"
def byte_order(:xdr, :binary), do: <<0::... | lib/geometry/wkb.ex | 0.883902 | 0.568566 | wkb.ex | starcoder |
defmodule Mix.Tasks.Comb.Benchmark do
use Mix.Task
def compare(description, function, args, n \\ 5) do
# these functions return either an enum or integer
[t0, t] = for module <- [Comb.Naive, Comb] do
{time, _} = :timer.tc fn ->
for _ <- 1..n do
case apply(module, function,... | lib/mix/tasks/comb/benchmark.ex | 0.562177 | 0.580768 | benchmark.ex | starcoder |
defmodule GenStage do
@moduledoc ~S"""
Stages are data-exchange steps that send and/or receive data
from other stages.
When a stage sends data, it acts as a producer. When it receives
data, it acts as a consumer. Stages may take both producer and
consumer roles at once.
## Stage types
Besides taking ... | large_file.ex | 0.878939 | 0.830834 | large_file.ex | starcoder |
defmodule Cased do
@moduledoc """
Documentation for Cased.
"""
import Norm
defmodule ConfigurationError do
@moduledoc false
defexception message: "invalid configuration", details: nil
@type t :: %__MODULE__{
message: String.t(),
details: nil | any()
}
def ... | lib/cased.ex | 0.804367 | 0.495972 | cased.ex | starcoder |
if match?({:module, AMQP.Channel}, Code.ensure_compiled(AMQP.Channel)) do
defmodule Mix.Tasks.Rambla.Rabbit.Exchange do
@shortdoc "Operations with exchanges in RabbitMQ"
@moduledoc since: "0.6.0"
@moduledoc """
Mix task to deal with exchanges in the target RabbitMQ.
This is helpful to orchestrate... | lib/mix/tasks/rabbit_exchange.ex | 0.764364 | 0.457743 | rabbit_exchange.ex | starcoder |
defmodule Kong.API do
@moduledoc """
Provides access to the Kong endpoints for API management.
Consult the Kong Admin API documentation for more information about the API object properties
"""
@endpoint "/apis"
import Kong, only: [get: 1, get: 3, post: 2, patch: 2, put: 2, delete: 1]
@doc """
Adds a... | lib/api.ex | 0.771972 | 0.563918 | api.ex | starcoder |
defmodule Day03.Pathfinder do
@moduledoc """
Functions for pathing routes.
"""
def list_wire_paths([wire_path_1, wire_path_2]) do
path_1 = get_path_coordinates(wire_path_1)
path_2 = get_path_coordinates(wire_path_2)
{path_1, path_2}
end
def map_wire_paths({path_1, path_2}) do
{map_points(... | day_03/lib/day03/pathfinder.ex | 0.756717 | 0.5867 | pathfinder.ex | starcoder |
defmodule River.Frame.Headers do
alias River.Frame
defstruct padding: 0,
headers: [],
header_block_fragment: <<>>,
exclusive: false,
stream_dependency: nil,
weight: nil
defmodule Flags do
defstruct [:end_stream, :end_headers, :padded, :priority]
... | lib/river/frame/headers.ex | 0.509032 | 0.41837 | headers.ex | starcoder |
defmodule Airbax.Client do
@moduledoc false
# This GenServer keeps a pre-built bare-bones version of an exception (a
# "draft") to be reported to Airbrake, which is then filled with the data
# related to each specific exception when such exception is being
# reported. This GenServer is also responsible for a... | lib/airbax/client.ex | 0.609175 | 0.424531 | client.ex | starcoder |
defmodule Coingecko.Coin do
@doc """
List all supported coins id, name and symbol.
Example:
iex> Coingecko.Coins.list
{:ok, {[...]}}
"""
def list do
Request.one("coins/list")
end
@doc """
List all supported coins price, market cap, volume, and market related data
Example:
iex> Coingec... | lib/coingecko/coin.ex | 0.731059 | 0.534552 | coin.ex | starcoder |
defmodule Theta.CMS do
@moduledoc """
The CMS context.
"""
import Ecto.Query, warn: false
alias Theta.{Account, PV, Repo, Upload}
alias Theta.CMS.{Taxonomy, Term, Article, Qa, ArticleTag}
@doc """
Returns the list of taxonomy.
## Examples
iex> list_taxonomy()
[%Taxonomy{}, ...]
"""... | apps/theta/lib/theta/cms.ex | 0.837753 | 0.433562 | cms.ex | starcoder |
defmodule Base85.Encode do
@moduledoc """
Implements encoding functionality for Base85 encoding.
"""
# Encoding basically can't fail, so non-!-versions are trivial.
import Base85.{Charsets, Padding}
@typedoc "available character sets"
@type charset() :: Base85.Charsets.charset()
@typedoc "available p... | lib/base85/encode.ex | 0.927651 | 0.451689 | encode.ex | starcoder |
defmodule Riak.Ecto do
@moduledoc """
Adapter module for Riak, using a map bucket_type to store models.
It uses `riakc` for communicating with the database and manages
a connection pool using `poolboy`.
## Features
* WIP
"""
@behaviour Ecto.Adapter
alias Riak.Ecto.NormalizedQuery
alias Riak.Ecto.... | lib/riak_ecto.ex | 0.777342 | 0.466299 | riak_ecto.ex | starcoder |
defmodule AshPhoenix.FilterForm do
defstruct [
:id,
:resource,
:transform_errors,
name: "filter",
valid?: false,
negated?: false,
params: %{},
components: [],
operator: :and,
remove_empty_groups?: false
]
alias AshPhoenix.FilterForm.Predicate
require Ash.Query
@new_op... | lib/ash_phoenix/filter_form/filter_form.ex | 0.836621 | 0.643259 | filter_form.ex | starcoder |
defmodule CanUdp.Server do
@moduledoc """
UDP CAN connection to a VIU board with CAN interfaces.
Receives and sends CAN frames in a UDP format.
## How?
This process creates a server.
Then when the first UDP packet is received, the address of the sender is set as the destination.
Subsequently, all messag... | apps/app_udpcan/lib/server.ex | 0.627038 | 0.500427 | server.ex | starcoder |
defmodule Pdf2htmlex do
@moduledoc """
Provides functions to convert PDF documents to HTML.
The command line tool [pdf2HtmlEX](http://coolwanglu.github.io/pdf2htmlEX/) must be installed and needs to be
added to your PATH.
## Examples
iex(1)> Pdf2htmlex.open("test/fixtures/simple.pdf") |> Pdf2h... | lib/pdf2htmlex.ex | 0.707506 | 0.527256 | pdf2htmlex.ex | starcoder |
defmodule Sqlitex.Statement do
alias Sqlitex.Row
@moduledoc """
Provides an interface for working with sqlite prepared statements.
Care should be taken when using prepared statements directly - they are not
immutable objects like most things in Elixir. Sharing a statement between
different processes can ca... | deps/sqlitex/lib/sqlitex/statement.ex | 0.908373 | 0.816991 | statement.ex | starcoder |
defmodule WhistlerNewsReader.Parallel do
@moduledoc """
Runs a number of jobs (with an upper bound) in parallel and
awaits them to finish.
Code from https://github.com/hexpm/hex/blob/88190bc6ed7f4a95d91aa32a4c2fb642febc02df/lib/hex/parallel.ex
"""
use GenServer
require Logger
def start_link(name, op... | lib/whistler_news_reader/parallel.ex | 0.693784 | 0.427935 | parallel.ex | starcoder |
defmodule Helper.Utils.Map do
@moduledoc """
utils functions for map structure
"""
@doc """
map atom value to upcase string
e.g:
%{hello: :world} # -> %{hello: "WORLD"}
"""
def atom_values_to_upcase(map) when is_map(map) do
map
|> Enum.reduce(%{}, fn {key, val}, acc ->
case val !== true... | lib/helper/utils/map.ex | 0.77806 | 0.638427 | map.ex | starcoder |
defmodule SanbaseWeb.Graphql.Resolvers.PriceResolver do
require Logger
import SanbaseWeb.Graphql.Helpers.CalibrateInterval, only: [calibrate: 6]
alias Sanbase.Price
alias Sanbase.Model.Project
@total_market "TOTAL_MARKET"
@total_erc20 "TOTAL_ERC20"
@doc """
Returns a list of price points for the giv... | lib/sanbase_web/graphql/resolvers/price_resolver.ex | 0.819641 | 0.475971 | price_resolver.ex | starcoder |
defmodule Snowflake do
@moduledoc """
Functions that work on Snowflakes.
"""
@behaviour Ecto.Type
def type, do: :string
@discord_epoch 1_420_070_400_000
@typedoc """
The type that represents snowflakes in JSON.
In JSON, Snowflakes are typically represented as strings due
to some languages not b... | lib/yourbot/snowflake.ex | 0.925676 | 0.825695 | snowflake.ex | starcoder |
defmodule SpandexOTLP.Opentelemetry.Proto.Metrics.V1.AggregationTemporality do
@moduledoc false
use Protobuf, enum: true, syntax: :proto3
@type t ::
integer
| :AGGREGATION_TEMPORALITY_UNSPECIFIED
| :AGGREGATION_TEMPORALITY_DELTA
| :AGGREGATION_TEMPORALITY_CUMULATIVE
fie... | lib/spandex_otlp/opentelemetry/proto/metrics/v1/metrics.pb.ex | 0.734596 | 0.477981 | metrics.pb.ex | starcoder |
defmodule Day07.Coder do
@moduledoc """
Functions for parsing Incode programs.
"""
@doc """
Executes the gravity assist program.
## Examples
iex> Day07.Coder.execute_program([3,9,8,9,10,9,4,9,99,-1,8], 8)
1
"""
def execute_program(codes, input_value) do
codes
|> build_codes_map()
... | day_07/lib/day07/coder.ex | 0.805785 | 0.645036 | coder.ex | starcoder |
defmodule ExotelEx.HttpMessenger do
@behaviour ExotelEx.Messenger
@endpoint "https://api.exotel.com/v1/Accounts/"
@ets_bucket_name "exotel-rate-limited-api"
# Public API
@doc """
The send_sms/4 function sends an sms to a
given phone number from a given phone number.
## Example:
```
iex(1)>... | lib/exotel_ex/messengers/http_messenger.ex | 0.756358 | 0.651999 | http_messenger.ex | starcoder |
defmodule Tune.Matcher do
@limit 30
@limit_tracks_per_artist 5
@artist_score 5
@track_score 2.5
def basic_match(%{id: id}, %{id: id2}, _) when id == id2, do: %{}
def basic_match(
%{artists: origin_artists, tracks: origin_tracks},
%{artists: target_artists, tracks: target_tracks},
n... | lib/tune/matcher.ex | 0.535341 | 0.613989 | matcher.ex | starcoder |
defmodule Example do
alias Example.NS.EX
alias RDF.{IRI, Description, Graph}
import ExUnit.Assertions
@compile {:no_warn_undefined, Example.NS.EX}
defmodule User do
use Grax.Schema
@compile {:no_warn_undefined, Example.NS.EX}
schema EX.User do
property name: EX.name(), type: :string
... | test/support/example_schemas.ex | 0.742235 | 0.535827 | example_schemas.ex | starcoder |
defmodule Access do
@moduledoc """
Dictionary-like access to data structures via the `foo[bar]` syntax.
This module also empowers `Kernel`s nested update functions
`Kernel.get_in/2`, `Kernel.put_in/3`, `Kernel.update_in/3` and
`Kernel.get_and_update_in/3`.
## Examples
Out of the box, Access works with ... | lib/elixir/lib/access.ex | 0.854854 | 0.637807 | access.ex | starcoder |
defmodule Club.AggregateCase do
@moduledoc """
This module defines the test case to be used by aggregate tests.
"""
use ExUnit.CaseTemplate
using aggregate: aggregate do
quote bind_quoted: [aggregate: aggregate] do
@aggregate_module aggregate
import Club.Factory
import Club.Fixture
... | test/support/aggregate_case.ex | 0.824214 | 0.693992 | aggregate_case.ex | starcoder |
defmodule Layout do
@moduledoc """
The Layout module helps solve some of the difficulties in creating charts
and graphs. It provides an easy approach to defining the various parts of
charts such as axis, plot area, gridlines, titles, etc.
A layout is simply a list of each chart area in one direction. For an ... | lib/layout.ex | 0.893764 | 0.991015 | layout.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.