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 Map do
@moduledoc """
A `Dict` implementation that works on maps.
Maps are key-value stores where keys are compared using
the match operator (`===`). Maps can be created with
the `%{}` special form defined in the `Kernel.SpecialForms`
module.
For more information about the functions in this mo... | lib/elixir/lib/map.ex | 0.680348 | 0.666066 | map.ex | starcoder |
defmodule GenEvent.Behaviour do
@moduledoc """
This module is a convenience for defining GenEvent callbacks in Elixir.
GenEvent is an OTP behaviour that encapsulates event handling functionality.
## Example
Below is an example of a GenEvent that stores notifications
until they are fetched:
defmodu... | lib/elixir/lib/gen_event/behaviour.ex | 0.678647 | 0.413862 | behaviour.ex | starcoder |
defmodule Seren.Player do
@moduledoc """
The Player context.
"""
import Ecto.Query, warn: false
alias Seren.Repo
alias Seren.Player.Track
@doc """
Returns the list of tracks.
## Examples
iex> list_tracks()
[%Track{}, ...]
"""
def list_tracks do
Repo.all(Track)
end
def li... | lib/seren/player/player.ex | 0.843009 | 0.545225 | player.ex | starcoder |
defprotocol Phoenix.HTML.FormData do
@moduledoc """
Converts a data structure into a [`Phoenix.HTML.Form`](`t:Phoenix.HTML.Form.t/0`) struct.
"""
@doc """
Converts a data structure into a [`Phoenix.HTML.Form`](`t:Phoenix.HTML.Form.t/0`) struct.
The options are the same options given to `form_for/4`. It
... | lib/phoenix_html/form_data.ex | 0.911559 | 0.692044 | form_data.ex | starcoder |
defmodule AshPostgres.DataLayer do
@manage_tenant %Ash.Dsl.Section{
name: :manage_tenant,
describe: """
Configuration for the behavior of a resource that manages a tenant
""",
examples: [
"""
manage_tenant do
template ["organization_", :id]
create? true
update? ... | lib/data_layer.ex | 0.935942 | 0.52074 | data_layer.ex | starcoder |
defmodule Absinthe.Type.Union do
@moduledoc """
A unions is an abstract type made up of multiple possible concrete types.
No common fields are declared in a union. Compare to `Absinthe.Type.Interface`.
Because it's necessary for the union to determine the concrete type of a
resolved object, you must either... | deps/absinthe/lib/absinthe/type/union.ex | 0.858422 | 0.881615 | union.ex | starcoder |
defmodule Slack do
@moduledoc """
Slack is a genserver-ish interface for working with the Slack real time
messaging API through a Websocket connection.
To use this module you'll need a valid Slack API token. You can find your
personal token on the [Slack Web API] page, or you can add a new
[bot integration... | lib/slack.ex | 0.824073 | 0.820073 | slack.ex | starcoder |
defmodule Bolt.Sips.Metadata do
@moduledoc false
defstruct [:bookmarks, :tx_timeout, :metadata]
@type t :: %__MODULE__{
bookmarks: [String.t()],
tx_timeout: non_neg_integer(),
metadata: map()
}
alias Bolt.Sips.Metadata
@doc """
Create a new metadata structure.
Data... | lib/bolt_sips/metadata.ex | 0.803829 | 0.492371 | metadata.ex | starcoder |
defmodule Elastix.Bulk do
@moduledoc """
The bulk API makes it possible to perform many index/delete operations in a single API call.
[Elastic documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html)
"""
import Elastix.HTTP, only: [prepare_url: 2]
alias Elastix.{HTTP, ... | lib/elastix/bulk.ex | 0.839718 | 0.472318 | bulk.ex | starcoder |
defmodule AWS.Synthetics do
@moduledoc """
Amazon CloudWatch Synthetics
You can use Amazon CloudWatch Synthetics to continually monitor your
services. You can create and manage *canaries*, which are modular,
lightweight scripts that monitor your endpoints and APIs from the
outside-in. You can set up your ... | lib/aws/synthetics.ex | 0.809953 | 0.595875 | synthetics.ex | starcoder |
defmodule Yyzzy.Enum do
### Protocols and Behaviors: Enum
## Note, this implementation might have to change if we want fully qualified uids..
defimpl Enumerable, for: Yyzzy do
def count(yyzzy) do
{:ok, Enum.reduce(yyzzy,0,fn _x, acc -> acc + 1 end) }
end
@doc """
entities are in a tree lik... | lib/yyzzy/enum.ex | 0.610453 | 0.405154 | enum.ex | starcoder |
defmodule ElixirBoilerplateWeb.Errors do
alias Ecto.Changeset
alias ElixirBoilerplateWeb.Errors.View
@doc """
Generates a human-readable block containing all errors in a changeset. Errors
are then localized using translations in the `ecto` domain.
For example, you could have an `ecto.po` file in the frenc... | lib/elixir_boilerplate_web/errors/errors.ex | 0.819424 | 0.622631 | errors.ex | starcoder |
defmodule Flop do
@moduledoc """
Flop is a helper library for filtering, ordering and pagination with Ecto.
## Usage
The simplest way of using this library is just to use
`Flop.validate_and_run/3` and `Flop.validate_and_run!/3`. Both functions
take a queryable and a parameter map, validate the parameters,... | lib/flop.ex | 0.806853 | 0.617686 | flop.ex | starcoder |
defmodule PersistentList.Day02 do
alias PersistentList.Day02, as: List
defstruct [:head, :tail]
defimpl String.Chars, for: PersistentList.Day02 do
def to_string(list), do: "[" <> stringify(list) <> "]"
defp stringify(%List{head: nil}), do: ""
defp stringify(
%List{
head: hea... | persistent_list/lib/persistent_list/day02.ex | 0.583441 | 0.461502 | day02.ex | starcoder |
defmodule Meeseeks.Selector.Combinator do
@moduledoc """
Combinator structs package some method for finding related nodes and a
`Meeseeks.Selector` to be run on found nodes.
For instance, the css selector `ul > li` contains the combinator `> li`,
which roughly translates to "find a node's children and match ... | lib/meeseeks/selector/combinator.ex | 0.900717 | 0.726013 | combinator.ex | starcoder |
defmodule Protobuf.Parser do
defmodule ParserError do
defexception [:message]
end
def parse_files!(files, options \\ []) do
files
|> Enum.flat_map(fn path ->
schema = File.read!(path)
parse!(path, schema, options)
end)
|> finalize!(options)
end
def parse_string!(file, string,... | lib/exprotobuf/parser.ex | 0.592077 | 0.485722 | parser.ex | starcoder |
defmodule HelloOperator.Controller.V1.Greeting do
@moduledoc """
HelloOperator: Greeting CRD.
## Kubernetes CRD Spec
By default all CRD specs are assumed from the module name, you can override them using attributes.
### Examples
```
# Kubernetes API version of this CRD, defaults to value in module name... | lib/hello_operator/controllers/v1/greeting.ex | 0.88499 | 0.824108 | greeting.ex | starcoder |
defmodule Holidefs.Definition.Rule do
@moduledoc """
A definition rule has the information about the event and
when it happens on a year.
"""
alias Holidefs.Definition.CustomFunctions
alias Holidefs.Definition.Rule
defstruct [
:name,
:month,
:day,
:week,
:weekday,
:function,
... | lib/holidefs/definition/rule.ex | 0.852752 | 0.433382 | rule.ex | starcoder |
defmodule Unicode.EastAsianWidth do
@moduledoc """
Functions to introspect Unicode
east asian width categories for binaries
(Strings) and codepoints.
"""
@behaviour Unicode.Property.Behaviour
alias Unicode.Utils
@east_asian_width_categories Utils.east_asian_width()
|> Ut... | lib/unicode/east_asia_width.ex | 0.933726 | 0.670744 | east_asia_width.ex | starcoder |
defmodule ELA.Matrix do
alias ELA.Vector, as: Vector
@moduledoc"""
Contains operations for working with matrices.
"""
@doc"""
Returns an identity matrix with the provided dimension.
## Examples
iex> Matrix.identity(3)
[[1, 0, 0],
[0, 1, 0],
[0, 0, 1]]
"""
@spec i... | lib/matrix.ex | 0.913233 | 0.677904 | matrix.ex | starcoder |
defmodule ETSMap do
@moduledoc """
`ETSMap` is a [`Map`](http://elixir-lang.org/docs/stable/elixir/Map.html)-like
Elixir data structure that is backed by an
[ETS](http://www.erlang.org/doc/man/ets.html) table.
*If you are not familiar with ETS, you should first familiarize yourself with
it before using thi... | lib/ets_map.ex | 0.875001 | 0.777025 | ets_map.ex | starcoder |
defmodule AWS.Transcribe do
@moduledoc """
Operations and objects for transcribing speech to text.
"""
@doc """
Creates a new custom language model.
Use Amazon S3 prefixes to provide the location of your input files. The time it
takes to create your model depends on the size of your training data.
""... | lib/aws/generated/transcribe.ex | 0.908405 | 0.566318 | transcribe.ex | starcoder |
defmodule GrowthBook.Config do
@moduledoc """
A set of helper functions to convert config maps to structs.
This module is used to convert the configuration maps that are retrieved from GrowthBook's API
(or your local cache) to values that can be used directly with the `GrowthBook.Context` module.
"""
alia... | lib/growth_book/config.ex | 0.912304 | 0.558628 | config.ex | starcoder |
defmodule Stopsel.Builder do
@moduledoc """
DSL to build a Stopsel router.
A router is declared using the `router/2` macro.
Within this macro you can declare commands, scopes and `Stopsel`.
The commands defined in the router will be used to route the messages
to the appropriate functions defined in other ... | lib/stopsel/builder.ex | 0.909327 | 0.891055 | builder.ex | starcoder |
defmodule Adventofcode2016.Solution.Day1 do
alias Adventofcode2016.Solution.Struct.Position
@input "L1, L3, L5, L3, R1, L4, L5, R1, R3, L5, R1, L3, L2, L3, R2, R2, L3, L3, R1, L2, R1, L3, L2, R4, R2, L5, R4, L5, R4, L2, R3, L2, R4, R1, L5, L4, R1, L2, R3, R1, R2, L4, R1, L2, R3, L2, L3, R5, L192, R4, L5, R4, L1, R... | lib/solutions/day1.ex | 0.661595 | 0.775307 | day1.ex | starcoder |
defmodule Excoverage.Settings do
@moduledoc """
Module provides application settings
"""
@args [
help: :boolean,
all: :boolean,
function: :boolean,
line: :boolean,
branch: :boolean,
include_folders: :string,
ignore_files: :string,
detailed_report: :boolean,
general_report: :boolen... | lib/settings.ex | 0.673621 | 0.423428 | settings.ex | starcoder |
use Croma
defmodule Antikythera.Crypto do
@doc """
Checks equality of the given two binaries in constant-time to avoid [timing attacks](http://codahale.com/a-lesson-in-timing-attacks/).
"""
defun secure_compare(left :: v[binary], right :: v[binary]) :: boolean do
if byte_size(left) == byte_size(right) do
... | lib/util/crypto.ex | 0.828592 | 0.487063 | crypto.ex | starcoder |
defmodule AWS.Textract do
@moduledoc """
Amazon Textract detects and analyzes text in documents and converts it into
machine-readable text.
This is the API reference documentation for Amazon Textract.
"""
alias AWS.Client
alias AWS.Request
def metadata do
%AWS.ServiceMetadata{
abbreviation... | lib/aws/generated/textract.ex | 0.917635 | 0.674955 | textract.ex | starcoder |
defmodule Regulator.Limit.AIMD do
@moduledoc """
Loss based dynamic limit algorithm. Additively increases the concurrency
limit when there are no errors and multiplicatively decrements the limit
when there are errors.
To use this regulator you must specify a "target average latency". Regulator collects
mea... | lib/regulator/limit/aimd.ex | 0.884978 | 0.757481 | aimd.ex | starcoder |
defmodule Quantum.Job do
@moduledoc """
This Struct defines a Job.
## Usage
The struct should never be defined by hand. Use `Acme.Scheduler.new_job/0` to create a new job and use the setters mentioned
below to mutate the job.
This is to ensure type safety.
"""
alias Crontab.CronExpression
@enfor... | lib/quantum/job.ex | 0.904173 | 0.525917 | job.ex | starcoder |
defmodule RedisGraph do
@moduledoc """
Provides the components to construct and interact with Graph
entities in a RedisGraph database.
This library uses [Redix](https://github.com/whatyouhide/redix) to
communicate with a redisgraph server.
To launch ``redisgraph`` locally with Docker, use
```bash
doc... | lib/redis_graph.ex | 0.909684 | 0.86916 | redis_graph.ex | starcoder |
defmodule Hook do
@moduledoc """
An interface to define and leverage runtime resolution.
In various module and function docs it is common to document options like so:
> # Options
>
> - `:option1_name` - `type`. # since no default is specified, this option is required
> - `:option2_name` - `type`. Descri... | lib/hook.ex | 0.881653 | 0.579073 | hook.ex | starcoder |
defmodule ExUUID do
@moduledoc """
UUID generator according to [RFC 4122](https://www.ietf.org/rfc/rfc4122.txt).
"""
import ExUUID.Impl,
only: [
uuid: 3,
uuid: 5,
timestamp: 0,
clock_sequence: 0,
node_id: 0,
random_node_id: 1,
hash: 3
]
alias ExUUID.Impl
... | lib/ex_uuid.ex | 0.898461 | 0.758734 | ex_uuid.ex | starcoder |
defmodule Elixush.Instructions.Common do
@moduledoc "Common instructions that operate on many stacks."
import Elixush.PushState
@doc "Takes a type and a state and pops the appropriate stack of the state."
def popper(type, state), do: pop_item(type, state)
@doc """
Takes a type and a state and duplicates t... | lib/instructions/common.ex | 0.665954 | 0.557905 | common.ex | starcoder |
defmodule Ueberauth.Strategy.Gitlab do
@moduledoc """
Provides an Ueberauth strategy for Gitlab. This is based on the GitHub
strategy.
## Configuration
Create a [Gitlab application](https://gitlab.com/profile/applications), and
write down its `client_id` and `client_secret` values.
... | lib/ueberauth/strategy/gitlab.ex | 0.695131 | 0.427098 | gitlab.ex | starcoder |
defmodule Oban.Peer do
@moduledoc """
The `Peer` module maintains leadership for a particular Oban instance within a cluster.
Leadership is used by plugins, primarily, to prevent duplicate work accross nodes. For example,
only the leader's `Cron` plugin will insert new jobs. You can use peer leadership to exte... | lib/oban/peer.ex | 0.846324 | 0.498657 | peer.ex | starcoder |
defmodule ExCell do
@moduledoc """
ExCell is used to split larger views in smaller cells that can be reused and
easily packaged with Javascript and CSS.
A cell consists of a couple of files:
```
cells
|- avatar
| |- template.html.eex
| |- view.html.eex
| |- style.css (optional)
| |- index.js ... | lib/ex_cell/ex_cell.ex | 0.810554 | 0.829077 | ex_cell.ex | starcoder |
defmodule MarcoPolo.FetchPlan do
@moduledoc """
Provides facilities for traversing links to OrientDB records.
"""
alias MarcoPolo.RID
defmodule RecordNotFoundError do
@moduledoc """
Raised when a record is not found in a set of linked records.
"""
defexception [:message]
end
@doc """
... | lib/marco_polo/fetch_plan.ex | 0.876125 | 0.782205 | fetch_plan.ex | starcoder |
defmodule Structex.Load.Seismic do
@moduledoc """
Functions to calculates the seismic load.
The seismic load can be defined by following 3 ways.
## As a static load
The instant difinition without modal characteristics.
## As an input acceleration history
The time dependent continuous momentary accelera... | lib/structex/load/seismic.ex | 0.947113 | 0.77053 | seismic.ex | starcoder |
defmodule Aecore.Tx.Transaction do
@moduledoc """
Behaviour that states all the necessary functions that every custom transaction,
child tx of DataTx should implement to work correctly on the blockchain
"""
alias Aecore.Tx.DataTx
@typedoc "Arbitrary map holding all the specific elements required
by the sp... | apps/aecore/lib/aecore/tx/transaction.ex | 0.860325 | 0.432123 | transaction.ex | starcoder |
defmodule PlugCheckup.Options do
@moduledoc """
Defines the options which can be given to initialize PlugCheckup.
"""
defstruct json_encoder: nil,
timeout: :timer.seconds(1),
checks: [],
error_code: 500,
pretty: true,
time_unit: :microsecond
@type t... | lib/plug_checkup/options.ex | 0.847463 | 0.407805 | options.ex | starcoder |
defmodule ChangesetHelpers do
@moduledoc ~S"""
Provides a set of helpers to work with Changesets.
"""
@doc ~S"""
Validates the result of the comparison of
* two fields (where at least one is a change) or
* a change and a value, where the value is an integer, a `Date`, a `Time`,
a `DateTime` or ... | lib/changeset_helpers.ex | 0.872171 | 0.809389 | changeset_helpers.ex | starcoder |
defmodule Trunk.State do
@moduledoc """
This module defines a `Trunk.State` struct and provides some helper functions for working with that state.
## Fields
The following fields are available in the state object. Some values are filled in during processing.
- `filename` - The base filename of the file being ... | lib/trunk/state.ex | 0.917159 | 0.908618 | state.ex | starcoder |
defmodule Rollbax.Client do
@moduledoc false
# This GenServer keeps a pre-built bare-bones version of an exception (a
# "draft") to be reported to Rollbar, 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/rollbax/client.ex | 0.641984 | 0.410786 | client.ex | starcoder |
defmodule LangTags.Tag do
@moduledoc """
Tags registered according to the rules in [RFC3066](https://tools.ietf.org/html/rfc3066)
Please note that this *tags* appears in records whose *type* is either 'grandfathered'
or 'redundant' and contains a tag registered under [RFC3066](https://tools.ietf.org/html/rfc... | lib/lang_tags/tag.ex | 0.738292 | 0.484014 | tag.ex | starcoder |
defmodule Cleanser do
@moduledoc """
Documentation for Cleanser.
"""
@doc """
Email Validation
## Examples
iex> Cleanser.validate_email("<EMAIL>")
:ok
iex> Cleanser.validate_email("<EMAIL>")
{:error, "spambox.me is an invalid domain"}
iex> Cleanser.validate_email("blocked.... | lib/cleanser.ex | 0.842313 | 0.438184 | cleanser.ex | starcoder |
defmodule Mimic.Module do
alias Mimic.{Cover, Server}
@moduledoc false
def original(module), do: "#{module}.Mimic.Original.Module" |> String.to_atom()
def clear!(module) do
:code.purge(module)
:code.delete(module)
:code.purge(original(module))
:code.delete(original(module))
:ok
end
de... | lib/mimic/module.ex | 0.588889 | 0.447158 | module.ex | starcoder |
defmodule SurfaceBulma.Form.Utils do
def input_classes(assigns, other_classes \\ [])
def input_classes(assigns, other_classes) when is_binary(other_classes) do
input_classes(assigns, [other_classes])
end
def input_classes(assigns, other_classes) do
["input"] ++
other_classes ++
[
"... | lib/surface_bulma/form/utils.ex | 0.506836 | 0.430985 | utils.ex | starcoder |
defmodule Plug.AMQP.Conn do
@moduledoc """
Adapter for AMQP to Plug.Conn
This adapter partially implements the Plug.Conn.Adapter behaviour, with the
following caveats:
* `c:Plug.Conn.Adapter.send_file/6`, `c:Plug.Conn.Adapter.send_chunked/3` and
`c:Plug.Conn.Adapter.chunk/2` raise, because there is no s... | lib/plug/amqp/conn.ex | 0.781372 | 0.444625 | conn.ex | starcoder |
defmodule XQLite3.Query do
defstruct [
:name,
:statement,
:ref,
:column_names,
:column_types
]
alias XQLite3.Result
alias __MODULE__, as: Query
defimpl DBConnection.Query do
def parse(query, _opts) do
query
end
def describe(query, _opts) do
query
end
@sp... | lib/xqlite3/query.ex | 0.771499 | 0.442938 | query.ex | starcoder |
defmodule Adventofcode.IntcodeComputer do
alias __MODULE__.{Computer, Parameter, Program}
defmodule Parameter do
@enforce_keys [:value, :mode]
defstruct [:value, :mode]
def new(value, 0), do: new(value, :positional)
def new(value, 1), do: new(value, :immediate)
def new(value, 2), do: new(value... | lib/intcode_computer.ex | 0.69451 | 0.562357 | intcode_computer.ex | starcoder |
defmodule Brex.Result.Mappers do
@moduledoc """
Tools for combining `Enum` and result tuples.
"""
import Brex.Result.Base
alias Brex.Result.Base
@type s(x) :: Base.s(x)
@type t(x) :: Base.t(x)
@type p() :: Base.p()
@type s() :: Base.s()
@type t() :: Base.t()
@typedoc """
The type `t:Enum.t/0`... | lib/result/mappers.ex | 0.850391 | 0.500549 | mappers.ex | starcoder |
defmodule Bencoder.Decode do
@doc """
Decodes a binary and translates it into elixir objects.
Returns the decoded element.
`number` -> `Integer`
`string` -> `String`
`list` -> `List`
`dict` -> `Map`
"""
@spec decode(binary) :: term
def decode(data) do
{:ok, decoded, _} = data |> :binary.b... | lib/bencoder/decoder.ex | 0.880707 | 0.678177 | decoder.ex | starcoder |
defmodule Geohash do
@moduledoc ~S"""
Drop in replacement fot the Elixir native [Geohash encode/decode library](https://hexdocs.pm/geohash/) implemented as a NIF
## Basic Usage
```elixir
iex(1)> Geohash.encode(42.6, -5.6, 5)
"ezs42"
iex(1)> Geohash.encode(42.6, -5.6, 11)
"ezs42e44yx9"
iex(1)> Geo... | lib/geohash.ex | 0.796609 | 0.825062 | geohash.ex | starcoder |
defmodule Randex do
@moduledoc """
Randex is a regex based random string generator.
## Example
```elixir
iex(1)> Randex.stream(~r/(1[0-2]|0[1-9])(:[0-5]\d){2} (A|P)M/) |> Enum.take(10)
["10:53:29 AM", "02:54:11 AM", "09:23:04 AM", "10:41:57 AM", "11:42:13 AM",
"10:27:37 AM", "06:15:18 AM", "03:09:58 AM"... | lib/randex.ex | 0.797281 | 0.803983 | randex.ex | starcoder |
defmodule Bolt.Sips.ResponseEncoder do
@moduledoc """
This module provides functions to encode a query result or data containing Bolt.Sips.Types
into various format.
For now, only JSON is supported.
Encoding is handled by protocols to allow override if a specific implemention is required.
See targeted p... | lib/bolt_sips/response_encoder.ex | 0.888879 | 0.55917 | response_encoder.ex | starcoder |
defmodule Geocoder.Providers.OpenCageData do
use Tesla
plug(Tesla.Middleware.BaseUrl, "https://maps.googleapis.com")
plug(Tesla.Middleware.Query,
key: Application.fetch_env!(:geocoder, Geocoder.Providers.OpenCageData)[:key],
pretty: 1
)
plug(Tesla.Middleware.JSON)
@path_geocode "/geocode/v1/json... | lib/geocoder/providers/open_cage_data.ex | 0.657209 | 0.432842 | open_cage_data.ex | starcoder |
defmodule Calypte.Engine.NaiveFirst do
@moduledoc """
Implements naive algorithm for finding applicable rules.
It uses basic tree search first match algorithm for finding applicable node using type optimization.
"""
alias Calypte.{Binding, Graph, Rule, Utils}
alias Calypte.Ast.{Relation, Var}
import Uti... | lib/calypte/engine/naive_first.ex | 0.77768 | 0.481881 | naive_first.ex | starcoder |
defmodule Genex.Tools.Benchmarks.SymbolicRegression do
@moduledoc """
Provides benchmark functions for Symbolic Regression programs with Genetic Programming.
These functions haven't been tested. More documentation/testing is coming later.
"""
@doc """
Kotanchek benchmark.
Returns ```math```.
# Param... | lib/genex/tools/benchmarks/symbolic_regression.ex | 0.911323 | 0.968768 | symbolic_regression.ex | starcoder |
defmodule Kalevala.Output.Tables.Tag do
@moduledoc false
defstruct [:name, attributes: %{}, children: []]
def append(tag, child) do
%{tag | children: tag.children ++ [child]}
end
end
defmodule Kalevala.Output.Tables do
@moduledoc """
Process table tags into ANSI tables
Processes 3 tags, `{table}`,... | lib/kalevala/output/tables.ex | 0.862511 | 0.844409 | tables.ex | starcoder |
defmodule Absinthe.Utils do
@doc """
Camelize a word, respecting underscore prefixes.
## Examples
With an uppercase first letter:
```
iex> camelize("foo_bar")
"FooBar"
iex> camelize("foo")
"Foo"
iex> camelize("__foo_bar")
"__FooBar"
iex> camelize("__foo")
"__Foo"
iex> camelize("_foo")
... | lib/absinthe/utils.ex | 0.881863 | 0.690076 | utils.ex | starcoder |
defmodule System do
@moduledoc """
The `System` module provides functions that interact directly
with the VM or the host system.
## Time
The `System` module also provides functions that work with time,
returning different times kept by the system with support for
different time units.
One of the comp... | lib/elixir/lib/system.ex | 0.929248 | 0.619183 | system.ex | starcoder |
defmodule MailgunEx.Opts do
@moduledoc """
Generate API options based on overwritten values, as well as
any configured defaults.
Please refer to `MailgunEx` for more details on configuring this library,
the know what can be configured.
"""
@doc """
Merge the `provided_opts` with the configured options... | lib/mailgun_ex/opts.ex | 0.843622 | 0.464355 | opts.ex | starcoder |
defmodule Interp.Functions do
alias Interp.Globals
defmacro is_iterable(value) do
quote do: is_map(unquote(value)) or is_list(unquote(value))
end
@doc """
Checks whether the given value is 'single', which means that it is
either an integer/float/string. Since the only types allowed b... | lib/interp/functions.ex | 0.534855 | 0.655708 | functions.ex | starcoder |
defmodule Phoenix.LiveView.Router do
@moduledoc """
Provides LiveView routing for Phoenix routers.
"""
@cookie_key "__phoenix_flash__"
@doc """
Defines a LiveView route.
A LiveView can be routed to by using the `live` macro with a path and
the name of the LiveView:
live "/thermostat", Thermost... | lib/phoenix_live_view/router.ex | 0.88912 | 0.626038 | router.ex | starcoder |
defmodule Membrane.Core.Child.PadController do
@moduledoc false
alias Membrane.Core.Child.{PadModel, PadSpecHandler}
alias Membrane.{LinkError, Pad}
require Membrane.Core.Child.PadModel
require Membrane.Logger
@type state_t :: Membrane.Core.Bin.State.t() | Membrane.Core.Element.State.t()
@spec validat... | lib/membrane/core/child/pad_controller.ex | 0.852522 | 0.408808 | pad_controller.ex | starcoder |
defmodule Exoml do
@moduledoc """
A module to decode/encode xml into a tree structure.
The aim of this parser is to be able to represent any xml document as a tree-like structure,
but be able to put it back together in a sane way.
In comparison to other xml parsers, this one preserves broken stuff.
The go... | lib/exoml.ex | 0.858941 | 0.433862 | exoml.ex | starcoder |
defmodule Saxy.Handler do
@moduledoc ~S"""
This module provides callbacks to implement SAX events handler.
"""
@doc ~S"""
Callback for event handling.
This callback takes an event type, an event data and `user_state` as the input.
The initial `user_state` is the third argument in `Saxy.parse_string/3` ... | lib/saxy/handler.ex | 0.89388 | 0.751032 | handler.ex | starcoder |
defmodule AWS.AuditManager do
@moduledoc """
Welcome to the Audit Manager API reference.
This guide is for developers who need detailed information about the Audit
Manager API operations, data types, and errors.
Audit Manager is a service that provides automated evidence collection so that
you can contin... | lib/aws/generated/audit_manager.ex | 0.766818 | 0.562237 | audit_manager.ex | starcoder |
defmodule ExPng.Image.Drawing do
@moduledoc """
Utility module to hold functions related to drawing on images.
"""
@type coordinate_pair :: {pos_integer, pos_integer}
alias ExPng.{Color, Image}
@doc """
Colors the pixel at the given `{x, y}` coordinates in the image the provided
color.
"""
@spec ... | lib/ex_png/image/drawing.ex | 0.896146 | 0.810704 | drawing.ex | starcoder |
defmodule Set do
@moduledoc ~S"""
Generic API for sets.
This module is deprecated, use the `MapSet` module instead.
"""
@moduledoc deprecated: "Use MapSet instead"
@type value :: any
@type values :: [value]
@type t :: map
# TODO: Remove by 2.0
message = "Use the MapSet module for working with se... | lib/elixir/lib/set.ex | 0.51562 | 0.425187 | set.ex | starcoder |
defmodule AWS.ElasticLoadBalancing do
@moduledoc """
Elastic Load Balancing
A load balancer can distribute incoming traffic across your EC2 instances.
This enables you to increase the availability of your application. The load
balancer also monitors the health of its registered instances and ensures that
... | lib/aws/generated/elastic_load_balancing.ex | 0.922408 | 0.613902 | elastic_load_balancing.ex | starcoder |
defmodule Holobot.Holofans.Channels do
@moduledoc """
Holofans channels caching server and client API module.
"""
use GenServer, shutdown: 10_000
require Logger
require Memento
alias Holobot.Holofans.{Channel, Client}
require Logger
@cache_update_interval 3_600_000
def start_link(init_args \\ ... | lib/holobot/holofans/channels.ex | 0.835936 | 0.408188 | channels.ex | starcoder |
defmodule Blockchain.Transaction do
@moduledoc """
This module encodes the transaction object,
defined in Section 4.2 of the Yellow Paper.
We are focused on implementing 𝛶, as defined in Eq.(1).
"""
alias Block.Header
alias Blockchain.Account.Repo
alias Blockchain.{Chain, Contract, MathHelper, Transac... | apps/blockchain/lib/blockchain/transaction.ex | 0.863103 | 0.465995 | transaction.ex | starcoder |
defmodule Regulator do
@moduledoc """
Adaptive concurrency limits.
"""
alias Regulator.Regulators
alias Regulator.LimiterSup
alias Regulator.Limits
alias Regulator.Buffer
alias Regulator.Telemetry
alias Regulator.Monitor
@type token :: map()
@type result :: {:ok, term()}
| {:error... | lib/regulator.ex | 0.79649 | 0.422892 | regulator.ex | starcoder |
defmodule Nookal do
@moduledoc """
This module provides function to work with [Nookal API](https://nookal.com).
`Nookal` uses [`mint`](https://hex.pm/packages/mint) as the HTTP client.
Please be noted that the functions in this module are very coupled to Nookal
API itself which can be changed at any time. P... | lib/nookal.ex | 0.842118 | 0.535038 | nookal.ex | starcoder |
defmodule Artemis.CacheInstance do
use GenServer, restart: :transient
require Logger
alias Artemis.CacheEvent
defmodule CacheEntry do
defstruct [:data, :inserted_at, :key]
end
@moduledoc """
A thin wrapper around a cache instance. Supports multiple cache drivers.
Encapsulates all the applicatio... | apps/artemis/lib/artemis/cache/cache_instance.ex | 0.824497 | 0.546073 | cache_instance.ex | starcoder |
defmodule Plymio.Codi.Pattern.Other do
@moduledoc ~S"""
This module collects the *other*, simple patterns.
See `Plymio.Codi` for an overview and documentation terms.
## Pattern: *form*
The *form* pattern is a convenience to embed arbitrary code.
Valid keys in the *cpo* are:
| Key | Aliases |
| :---... | lib/codi/pattern/other/other.ex | 0.849738 | 0.602939 | other.ex | starcoder |
defmodule ElixirSense.Plugins.Ecto.Schema do
@moduledoc false
alias ElixirSense.Core.Introspection
alias ElixirSense.Plugins.Option
alias ElixirSense.Plugins.Util
alias ElixirSense.Providers.Suggestion.Matcher
# We'll keep these values hard-coded until Ecto provides the same information
# using docs' me... | lib/elixir_sense/plugins/ecto/schema.ex | 0.850701 | 0.558568 | schema.ex | starcoder |
defmodule Exmoji.EmojiChar do
@moduledoc """
EmojiChar is a struct represents a single Emoji character and its associated
metadata.
## Fields
* `name` - The standardized name used in the Unicode specification to
represent this emoji character.
* `unified` - The primary unified codepoint ID for the emo... | lib/exmoji/emoji_char.ex | 0.903628 | 0.433921 | emoji_char.ex | starcoder |
defmodule Geocoder.Providers.GoogleMaps do
use HTTPoison.Base
use Towel
@endpoint "https://maps.googleapis.com/"
def geocode(opts) do
request("maps/api/geocode/json", extract_opts(opts))
|> fmap(&parse_geocode/1)
end
def geocode_list(opts) do
request_all("maps/api/geocode/json", extract_opts(... | lib/geocoder/providers/google_maps.ex | 0.582491 | 0.51312 | google_maps.ex | starcoder |
defmodule Cldr.Currency.Backend do
@moduledoc false
def define_currency_module(config) do
require Cldr
require Cldr.Currency
module = inspect(__MODULE__)
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [module: module, backend: backend, config: c... | lib/cldr/backend.ex | 0.927252 | 0.583174 | backend.ex | starcoder |
defmodule ExRajaOngkir.Cost do
alias ExRajaOngkir.Request
defstruct [
:weight_unit,
:courier_code,
:courier_name,
:description,
:service_name,
:estimates,
:params
]
def calculate!(from, to, weight, courier, opts \\ []) do
{:ok, result} = calculate(from, to, weight, courier, opt... | lib/ex_raja_ongkir/cost.ex | 0.668988 | 0.501343 | cost.ex | starcoder |
defmodule Cldr.Calendar.Duration do
@moduledoc """
Functions to create and format a difference between
two dates, times or datetimes.
The difference between two dates (or times or datetimes) is
usually defined in terms of days or seconds.
A duration is calculated as the difference in time in calendar
un... | lib/cldr/calendar/duration.ex | 0.958943 | 0.910704 | duration.ex | starcoder |
defmodule SMPPEX.ESME do
@moduledoc """
This is a module for launching an `SMPPEX.Session` implementation as an ESME.
To start an ESME one generally should do the following.
1. Implement an `SMPPEX.Session` behaviour.
```elixir
defmodule MyESMESession do
use SMPPEX.Session
# ...Callback impleme... | lib/smppex/esme.ex | 0.843782 | 0.840783 | esme.ex | starcoder |
defmodule Pcal do
defstruct month: 1, year: 2018, output: "output.pdf"
@moduledoc """
Documentation for Pcal.
"""
@pcal_command "pcal"
@pdf_converter_command "ps2pdf"
@script "bin/generate_pdf"
@doc """
Check if pcal command exists.
## Examples
iex> {:ok, path} = Pcal.command_exists?
... | lib/pcal.ex | 0.770076 | 0.443781 | pcal.ex | starcoder |
defmodule Webapp.Regions do
@moduledoc """
The Regions context.
"""
import Ecto.Query, warn: false
alias Webapp.Repo
alias Webapp.{
Regions.Region,
Hypervisors.Hypervisor
}
@doc """
Returns the list of regions.
## Examples
iex> list_regions()
[%Region{}, ...]
"""
def li... | lib/webapp/regions/regions.ex | 0.84955 | 0.408306 | regions.ex | starcoder |
defmodule AWS.WorkDocs do
@moduledoc """
The WorkDocs API is designed for the following use cases:
<ul> <li> File Migration: File migration applications are supported for
users who want to migrate their files from an on-premises or off-premises
file system or service. Users can insert files into a user dire... | lib/aws/generated/work_docs.ex | 0.773473 | 0.454593 | work_docs.ex | starcoder |
defmodule Grizzly.ZWave.Commands.ConfigurationPropertiesReport do
@moduledoc """
This command is used to advertise the properties of a configuration parameter.
Params:
* `:param_number` - This field is used to specify which configuration parameter (required)
* `read_only` - This field is used to indica... | lib/grizzly/zwave/commands/configuration_properties_report.ex | 0.885767 | 0.60542 | configuration_properties_report.ex | starcoder |
defmodule Nerves.Hub do
@moduledoc """
Implements a hierarchical key-value store with
publish/watch semantics at each node of the hierarchy.
A specific location on a hub is called a __point__, a
term borrowed from SCADA and DCS industrial control
systems. Points are defined by a __path__, which is a
li... | lib/hub.ex | 0.853821 | 0.849784 | hub.ex | starcoder |
defmodule LevelWeb.Schema.Mutations do
@moduledoc false
use Absinthe.Schema.Notation
@desc "Interface for payloads containing validation data."
interface :validatable do
field :success, non_null(:boolean)
field :errors, list_of(:error)
resolve_type fn _, _ -> nil end
end
@desc "A validation e... | lib/level_web/schema/mutations.ex | 0.869936 | 0.423518 | mutations.ex | starcoder |
defmodule Bokken.Gamification do
@moduledoc """
The Gamification context.
"""
import Ecto.Query, warn: false
alias Bokken.Repo
alias Bokken.Accounts
alias Bokken.Gamification.Badge
alias Bokken.Gamification.BadgeNinja
alias Bokken.Uploaders.Emblem
@doc """
Returns the list of badges.
Takes a... | lib/bokken/gamification.ex | 0.842976 | 0.4831 | gamification.ex | starcoder |
defmodule Imgex do
@moduledoc """
Provides functions to generate secure Imgix URLs.
"""
@doc """
Provides configured source information when it's not passed explicitly to
`url/3` or `proxy_url/3`.
"""
def configured_source,
do: %{
token: Application.get_env(:imgex, :secure_token),
domai... | lib/imgex.ex | 0.918439 | 0.451387 | imgex.ex | starcoder |
defmodule GameApp.Game do
@moduledoc """
`GameApp.Game` defines a struct that encapsulates game state as well as many
functions that advance the game state based on actions that players can take.
"""
alias __MODULE__, as: Game
alias GameApp.{Player, Round}
alias GameApp.Config, as: GameConfig
require ... | apps/game/lib/game/state/game.ex | 0.871352 | 0.520618 | game.ex | starcoder |
defmodule Membrane.RTP do
@moduledoc """
This module provides caps struct for RTP packet.
"""
@typedoc """
RTP payload type that is statically mapped to encoding and clock rate.
"""
@type static_payload_type_t :: 0..95
@typedoc """
RTP payload type that can be dynamically mapped to encoding and cloc... | lib/membrane/rtp.ex | 0.796055 | 0.494385 | rtp.ex | starcoder |
defmodule IntermodalContainers.ContainerNumber.Parser do
alias IntermodalContainers.ContainerNumber
alias IntermodalContainers.ContainerNumber.Alphabet
@type result() :: {:ok, %ContainerNumber{}} | {:error, String.t()}
@spec parse(String.t()) :: result()
def parse(code) when byte_size(code) == 11 do
par... | lib/intermodal_containers/container_number/parser.ex | 0.773901 | 0.487917 | parser.ex | starcoder |
defmodule ParallelEnum do
@moduledoc """
Some parallel processing function
inspired by https://gist.github.com/padde/b350dbc81f458898f08417d804e793aa
"""
@doc """
Map all element of a list and execute the given function on it in parallel.
If the function raise an error during one process still ge... | lib/parallel_enum.ex | 0.654122 | 0.528838 | parallel_enum.ex | starcoder |
--
-- This example uses mockup data to send a map objects to the template parser.
--
include std/map.e
include std/filesys.e
include std/search.e
include mvc/template.e
if search:ends( "examples", current_dir() ) then
-- make sure we can find our templates
-- if we're in the 'examples' directory
set_template_path(... | examples/example2.ex | 0.585694 | 0.535341 | example2.ex | starcoder |
defmodule Credo.Check.Readability.ModuleDoc do
@moduledoc """
Every module should contain comprehensive documentation.
Many times a sentence or two in plain english, explaining why the module
exists, will suffice. Documenting your train of thought this way will help
both your co-workers and your future-self.... | lib/credo/check/readability/module_doc.ex | 0.656548 | 0.503723 | module_doc.ex | starcoder |
defmodule Bintreeviz.Factory do
@moduledoc false
alias Bintreeviz.Node
def build(:simple) do
Node.new("Root",
left_child:
Node.new("Node A",
left_child: Node.new("Node C"),
right_child: Node.new("Node D")
),
right_child:
Node.new("Node B",
lef... | test/support/factory.ex | 0.656328 | 0.409221 | factory.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.