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 Belp do
@moduledoc """
Belp is a simple Boolean Expression Lexer and Parser.
"""
alias Belp.{AST, InvalidCharError, SyntaxError, UndefinedVariableError}
@typedoc """
A type that describes which primitives can be used as expression.
"""
@type expr :: String.t() | charlist
@doc """
Evalua... | lib/belp.ex | 0.884962 | 0.483466 | belp.ex | starcoder |
defmodule RDF.Literal.Datatype do
@moduledoc """
A behaviour for datatypes for `RDF.Literal`s.
An implementation of this behaviour defines a struct for a datatype IRI and the semantics of its
values via the functions defined by this behaviour.
There are three important groups of `RDF.Literal.Datatype` imple... | lib/rdf/literal/datatype.ex | 0.95121 | 0.81231 | datatype.ex | starcoder |
defmodule Scenic.Primitive.Path do
@moduledoc """
Draw a complex path on the screen described by a list of actions.
## Data
`list_of_commands`
The data for a path is a list of commands. They are interpreted in order
when the path is drawn. See below for the commands it will accept.
## Styles
This ... | lib/scenic/primitive/path.ex | 0.90827 | 0.884039 | path.ex | starcoder |
defmodule Membrane.MP4.Container.ParseHelper do
@moduledoc false
use Bunch
alias Membrane.MP4.Container
alias Membrane.MP4.Container.Schema
@box_name_size 4
@box_size_size 4
@box_header_size @box_name_size + @box_size_size
@spec parse_boxes(binary, Schema.t(), Container.t()) ::
{:ok, Conta... | lib/membrane_mp4/container/parse_helper.ex | 0.519521 | 0.508666 | parse_helper.ex | starcoder |
defmodule AshCsv.DataLayer do
@moduledoc "The data layer implementation for AshCsv"
@behaviour Ash.DataLayer
alias Ash.Actions.Sort
alias Ash.Dsl.Extension
alias Ash.Filter.{Expression, Not, Predicate}
alias Ash.Filter.Predicate.{Eq, GreaterThan, In, LessThan}
@impl true
def can?(_, :read), do: true
... | lib/ash_csv/data_layer.ex | 0.785638 | 0.406685 | data_layer.ex | starcoder |
defmodule PhpAssocMap do
@doc """
Parses an associative array string (or charlist) to a key-valued map. Both single and double quotes are supported.
*Note*: If the string starts with `<?php return`, it'll be ignored
## Exemples
iex> PhpAssocMap.to_map("['key' => ['another_key' => 'value']]")
... | lib/php_assoc_map.ex | 0.612078 | 0.48871 | php_assoc_map.ex | starcoder |
defmodule LiqenCore.Accounts do
import Ecto.Query, only: [from: 2]
alias LiqenCore.Accounts.{User,
PasswordCredential,
MediumCredential}
alias LiqenCore.Repo
@moduledoc """
Manages everything related to user accounts and its authentication.
## Notes
... | lib/liqen_core/accounts/accounts.ex | 0.814717 | 0.601418 | accounts.ex | starcoder |
defmodule Bolt.Cogs.Tempban do
@moduledoc false
@behaviour Nosedrum.Command
alias Nosedrum.Predicates
alias Bolt.{
ErrorFormatters,
Events.Handler,
Helpers,
Humanizer,
ModLog,
Parsers,
Repo,
Schema.Infraction
}
alias Nostrum.Api
import Ecto.Query, only: [from: 2]
requ... | lib/bolt/cogs/tempban.ex | 0.741206 | 0.595581 | tempban.ex | starcoder |
defmodule Yum.Data do
@moduledoc """
Import food data.
The location of the data can either be set globally in the config:
config :yum, path: "path/to/data"
Or it can be explicitly passed to a function.
"""
@type translation :: %{ optional(String.t) => translation | String.t }
... | lib/yum/data.ex | 0.867401 | 0.54825 | data.ex | starcoder |
defmodule ArtemisLog.ListSessions do
use ArtemisLog.Context
import ArtemisLog.Helpers.Filter
import ArtemisLog.Helpers.Search
import Ecto.Query
alias ArtemisLog.EventLog
alias ArtemisLog.Repo
@moduledoc """
When a user logs in, they are given a `session_id` value. All actions the
user takes during ... | apps/artemis_log/lib/artemis_log/contexts/session/list_sessions.ex | 0.734024 | 0.513607 | list_sessions.ex | starcoder |
defmodule Day17 do
def part1(input) do
grid = read_grid(input)
IO.write(grid)
set = make_map_set(String.split(grid, "\n"))
find_intersections(set)
end
def part2(input) do
path = find_path(input)
operate_robot(input, path)
end
# Part 1 helpers
defp find_intersections(set) do
se... | day17/lib/day17.ex | 0.5083 | 0.485417 | day17.ex | starcoder |
defmodule RecursiveMatch do
@moduledoc """
Recursive matching
"""
@doc """
Matches given value with pattern
Returns `true` or `false`
## Parameters
- pattern: Expected pattern (use `:_` instead of `_`)
- tested: Tested value
- options: Options
* `strict`, when `true` compare using `==... | lib/recursive_match.ex | 0.884058 | 0.561335 | recursive_match.ex | starcoder |
defmodule Backpack.Moment do
defdelegate shift(term, opts), to: Backpack.Moment.Calculator
defdelegate ago(term, seconds_or_unit \\ :seconds), to: Backpack.Moment.Calculator
defdelegate from_now(term, seconds_or_unit \\ :seconds), to: Backpack.Moment.Calculator
defdelegate minutes_ago(term, minutes), to: Bac... | lib/backpack/moment.ex | 0.631253 | 0.531513 | moment.ex | starcoder |
defmodule Slugy do
@moduledoc ~S"""
A Phoenix library to generate slug for your schema fields
## Examples
Let's suppose we have a `Post` schema and we want to generate a slug from `title` field and save it to the `slug` field. To achieve that we need to call `slugify/2` following the changeset pipeline passin... | lib/slugy.ex | 0.799912 | 0.568056 | slugy.ex | starcoder |
defmodule Scenic.Primitive.Style.Paint.Color do
@moduledoc """
Fill a primitive with a single color
The color paint is used as the data for the [`:fill`](Scenic.Primitive.Style.Fill.html) style.
### Data Format
`{:color, valid_color}`
The full format is a tuple with two parameters. The first is the :co... | lib/scenic/primitive/style/paint/color.ex | 0.89906 | 0.921074 | color.ex | starcoder |
defmodule Bitcoinex.Block do
@moduledoc """
Bitcoin on-chain transaction structure.
Supports serialization of transactions.
"""
alias Bitcoinex.Block
alias Bitcoinex.Transaction
alias Bitcoinex.Utils
alias Bitcoinex.Transaction.Utils, as: ProtocolUtils
defstruct [
:version,
:prev_block,
:merkle... | server/bitcoinex/lib/block.ex | 0.79653 | 0.422117 | block.ex | starcoder |
defrecord Mix.Dep, [scm: nil, app: nil, requirement: nil, status: nil, opts: nil], moduledoc: """
This is a record that keeps information about your project
dependencies. It keeps:
* scm - a module representing the source code management tool (SCM) operations;
* app - the app name as an atom;
* requirements - a binary... | lib/mix/lib/mix/deps.ex | 0.853532 | 0.508971 | deps.ex | starcoder |
defmodule Nosedrum.Interactor do
@moduledoc """
Interactors take the role of both `Nosedrum.Invoker` and `Nosedrum.Storage` when
it comes to Discord's Application Commands. An Interactor handles incoming
`t:Nostrum.Struct.Interaction.t/0`s, invoking `c:Nosedrum.ApplicationCommand.command/1` callbacks
and resp... | lib/nosedrum/interactor.ex | 0.902233 | 0.73197 | interactor.ex | starcoder |
defmodule ExDiceRoller.Sigil do
@moduledoc """
Han dles the sigil `~a` for dice rolling. If no options are specified, the
sigil will return the compiled function based on the provided roll. Note that
variables cannot be present in the expression when invoking a roll directly
from the sigil.
Also note that ... | lib/sigil.ex | 0.888299 | 0.643651 | sigil.ex | starcoder |
defmodule Day11.Seats do
defstruct [:grid]
def new(input), do: %__MODULE__{grid: gridify(input, 0, %{})}
def stabilize(%__MODULE__{grid: grid}, opts) do
case advance(grid, opts) do
{:stable, grid} -> %__MODULE__{grid: grid}
{:change, grid} -> stabilize(%__MODULE__{grid: grid}, opts)
end
en... | year_2020/lib/day_11/seats.ex | 0.776877 | 0.724407 | seats.ex | starcoder |
defmodule Crux.Structs.Emoji do
@moduledoc """
Represents a Discord [Emoji Object](https://discord.com/developers/docs/resources/emoji#emoji-object).
Differences opposed to the Discord API Object:
- `:user` is just the user id
"""
@moduledoc since: "0.1.0"
@behaviour Crux.Structs
alias Crux.Structs... | lib/structs/emoji.ex | 0.860969 | 0.543469 | emoji.ex | starcoder |
defmodule ExUssd.Display do
@moduledoc false
@doc """
Its used to tranform ExUssd menu struct to string.
## Parameters
- `menu` - menu to transform to string
- `route` - route
- `opts` - optional session args
## Examples
iex> menu = ExUssd.new(name: "home", resolve: fn menu, _payload, _... | lib/ex_ussd/display.ex | 0.683208 | 0.472562 | display.ex | starcoder |
defmodule Eon do
@moduledoc """
Eon is a small library for using .exs files as a
document store. Files read with Eon are expected
to contain only an Elixir map as well as execute
no arbitary code unless specified to do so. Eon
can also write maps and structs to file.
Eon is useful for when you would norm... | lib/eon.ex | 0.878725 | 0.595316 | eon.ex | starcoder |
defmodule PolylineHelpers do
@moduledoc """
Helpers for working with polylines
"""
@doc """
Polylines may be too long or verbose.
this will apply the following optimizatoins:
- if the line has more than ~400 points (500 bytes), it will decrease the number
- if the polylines that are reduced have duplic... | apps/site/lib/polyline_helpers.ex | 0.764804 | 0.542076 | polyline_helpers.ex | starcoder |
defmodule Huffman.Tree do
alias Huffman.{Leaf, Node, Queue}
@type tree :: %Node{left: Node.child(), right: Node.child()}
@type serialized_tree() :: bitstring()
@doc """
build/1 takes the priority queue and transforms it into a binary tree
with the lowest priorities as leafs furthest from the root and more ... | lib/huffman/tree.ex | 0.78374 | 0.481698 | tree.ex | starcoder |
defmodule Bitcraft.BitBlock do
@moduledoc ~S"""
Defines a bit-block.
A bit-block is used to map a bitstring into an Elixir struct.
The definition of the bit-block is possible through `defblock/3`.
`defblock/3` is typically used to decode bitstring from a bit stream,
usually a binary protocol (e.g.: TCP/IP... | lib/bitcraft/bit_block.ex | 0.917263 | 0.785185 | bit_block.ex | starcoder |
defmodule Range do
@moduledoc """
Defines a range.
A range represents a sequence of one or many,
ascending or descending, consecutive integers.
Ranges can be either increasing (`first <= last`) or
decreasing (`first > last`). Ranges are also always
inclusive.
A range is represented internally as a st... | lib/elixir/lib/range.ex | 0.838531 | 0.637172 | range.ex | starcoder |
defmodule Autox.RelationUtils do
import Ecto
alias Ecto.Association.BelongsTo
alias Ecto.Association.Has
alias Ecto.Association.HasThrough
alias Autox.ChangesetUtils
@moduledoc """
For reference:
%Ecto.Association.BelongsTo{cardinality: :one, defaults: [], field: :flavor,
owner: Apiv3.RelationshipUt... | lib/autox/utils/relation_utils.ex | 0.596903 | 0.424442 | relation_utils.ex | starcoder |
defmodule Ecto.Adapters.Tds do
@moduledoc """
Adapter module for MSSQL Server using the TDS protocol.
## Options
Tds options split in different categories described
below. All options can be given via the repository
configuration.
### Connection options
* `:hostname` - Server hostname
* `:port... | lib/ecto/adapters/tds.ex | 0.894358 | 0.67252 | tds.ex | starcoder |
defmodule Timex.Duration do
@moduledoc """
This module provides a friendly API for working with Erlang
timestamps, i.e. `{megasecs, secs, microsecs}`. In addition,
it provides an easy way to wrap the measurement of function
execution time (via `measure`).
"""
alias __MODULE__
alias Timex.Types
use Tim... | lib/time/duration.ex | 0.926379 | 0.665737 | duration.ex | starcoder |
defmodule MLLP.Receiver do
@moduledoc """
A simple MLLP server.
Minimal Lower Layer Protocol (MLLP) is an application level protocol which merely defines header and
trailer delimiters for HL7 messages utilized in the healthcare industry for data interchange.
## Options
The following options are required for... | lib/mllp/receiver.ex | 0.849738 | 0.435361 | receiver.ex | starcoder |
defmodule Axon.MixedPrecision do
@moduledoc """
Utilities for creating mixed precision policies.
Mixed precision is useful for increasing model throughput at the possible
price of a small dip in accuracy. When creating a mixed precision policy,
you define the policy for `params`, `compute`, and `output`.
... | lib/axon/mixed_precision.ex | 0.936663 | 0.77343 | mixed_precision.ex | starcoder |
defmodule SafeExecEnv do
@moduledoc """
It is often desirable to run natively compiled code (C, C++, Rust, ..) from a BEAM
application via a binding. The motivation may be better performance or simply to access
an external library that already exists. The problem is that if that native code crashes
then, unli... | lib/safe_exec_env.ex | 0.657978 | 0.546496 | safe_exec_env.ex | starcoder |
defmodule Ritcoinex.Chain do
@moduledoc """
This module is a distributed database, soft realtime, and works as a
Chain of orders like be a Blockchain.
This real propuse is build a pool of "blockchains", so, each table is a
self blockchain and all can communicate with all...
"""
# FUN'S OF MNESIA -------... | lib/mnesia_chain/ritcoinex.ex | 0.598547 | 0.420451 | ritcoinex.ex | starcoder |
defmodule Crux.Rest.Opts do
@moduledoc false
@moduledoc since: "0.3.0"
alias Crux.Rest.{Opts, Request}
defstruct(
token: nil,
token_type: "Bot",
raw: false,
name: nil,
version: 8
)
@typedoc since: "0.3.0"
@type t :: %{
token: String.t(),
token_type: String.t(),
... | lib/rest/opts.ex | 0.844216 | 0.404831 | opts.ex | starcoder |
defmodule Bloodhound.Client do
alias Poison.Parser
alias Bloodhound.Utility
@doc """
Indexes a document by inferring that it's ID is within it's data map.
"""
def index(type, data), do: index(type, data.id, data)
@doc """
Adds a document to the index given it's type, ID, and a map with it's data.
"... | lib/bloodhound/client.ex | 0.58818 | 0.447581 | client.ex | starcoder |
defmodule GraphQL do
@moduledoc ~S"""
The main GraphQL module.
The `GraphQL` module provides a
[GraphQL](http://facebook.github.io/graphql/) implementation for Elixir.
## Parse a query
Parse a GraphQL query
iex> GraphQL.parse "{ hello }"
%{definitions: [
%{kind: :OperationDefinition,... | lib/graphql.ex | 0.84137 | 0.577317 | graphql.ex | starcoder |
defmodule Exqlite.Sqlite3 do
@moduledoc """
The interface to the NIF implementation.
"""
alias Exqlite.Sqlite3NIF
@type db() :: reference()
@type statement() :: reference()
@type reason() :: atom() | String.t()
@doc """
Opens a new sqlite database at the Path provided.
If `path` can be `":memory... | lib/exqlite/sqlite3.ex | 0.828384 | 0.417034 | sqlite3.ex | starcoder |
defmodule Aecore.Channel.Updates.ChannelWithdrawUpdate do
@moduledoc """
State channel update implementing withdraws in the state channel. This update can be included in ChannelOffChainTx.
This update is used by ChannelWithdrawTx for unlocking some of the state channel's tokens.
"""
alias Aecore.Account.{Acc... | apps/aecore/lib/aecore/channel/updates/channel_withdraw_update.ex | 0.860501 | 0.42057 | channel_withdraw_update.ex | starcoder |
defmodule McProtocol.DataTypes do
@moduledoc false
# For <<< (left shift) operator
use Bitwise
defmodule ChatMessage do
@moduledoc false
defstruct [:text, :translate, :with, :score, :selector, :extra,
:bold, :italic, :underligned, :strikethrough, :obfuscated, :color,
:clickEvent, :hoverEv... | lib/datatypes/datatypes.ex | 0.597608 | 0.475605 | datatypes.ex | starcoder |
defmodule Ecto.ParameterizedType do
@moduledoc """
Parameterized types are Ecto types that can be customized per field.
Parameterized types allow a set of options to be specified in the schema
which are initialized on compilation and passed to the callback functions
as the last argument.
For example, `fie... | lib/ecto/parameterized_type.ex | 0.924696 | 0.663418 | parameterized_type.ex | starcoder |
defmodule JSONRPC2 do
@moduledoc ~S"""
`JSONRPC2` is an Elixir library for JSON-RPC 2.0.
It includes request and response utility modules, a transport-agnostic server handler, a
line-based TCP server and client, which are based on [Ranch](https://github.com/ninenines/ranch)
and [shackle](https://github.com/l... | lib/jsonrpc2.ex | 0.78789 | 0.477554 | jsonrpc2.ex | starcoder |
defmodule Membrane.Endpoint do
@moduledoc """
Module defining behaviour for endpoints - elements consuming and producing data.
Behaviours for endpoints are specified, besides this place, in modules
`Membrane.Element.Base`,
`Membrane.Element.WithOutputPads`,
and `Membrane.Element.WithInputPads`.
Endpoint... | lib/membrane/endpoint.ex | 0.831622 | 0.452173 | endpoint.ex | starcoder |
defmodule SymbolicExpression.Canonical.Parser do
alias SymbolicExpression.Canonical.Parser.State
require Logger
@doc """
Parses a canonical s-expression held in a string. Returns `{:ok, result}` on
success, `{:error, reason}` when the string does not contain a valid canonical
s-expression. See [Wikipedia](... | lib/symbolic_expression/canonical/parser.ex | 0.848533 | 0.648327 | parser.ex | starcoder |
## matched at unqualified no parentheses call
@one @two 3 do
end
## matched dot call
@one two.() do
end
## matched qualified no arguments call
@one Two.three do
end
## matched qualified no parentheses call
@one Two.three 4 do
end
## matched qualified parentheses call
@one Two.three() do
end
## matched unqualified... | testData/org/elixir_lang/formatting/no_spaces_around_dot_operator.ex | 0.658527 | 0.604487 | no_spaces_around_dot_operator.ex | starcoder |
defmodule Stripe.Refund do
@moduledoc """
Work with [Stripe `refund` objects](https://stripe.com/docs/api#refund_object).
You can:
- [Create a refund](https://stripe.com/docs/api#create_refund)
- [Retrieve a refund](https://stripe.com/docs/api#retrieve_refund)
- [Update a refund](https://stripe.com/docs/ap... | lib/stripe/core_resources/refund.ex | 0.778902 | 0.475301 | refund.ex | starcoder |
defmodule Bypass do
@external_resource "README.md"
@moduledoc "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
defstruct pid: nil, port: nil
@typedoc """
Represents a Bypass server process.
"""
@type t :: %__MODULE__{pid: pid, port: n... | lib/bypass.ex | 0.843541 | 0.643693 | bypass.ex | starcoder |
defmodule Tube.Frame do
use Bitwise
@moduledoc """
Represents a full frame of the WebSocket protocol
## Struct
### `fin`
Indicates that this is the final fragment in a message. The first
fragment MAY also be the final fragment.
### `opcode`
Defines the interpretation of the "Payload data". If ... | lib/frame/frame.ex | 0.852322 | 0.821725 | frame.ex | starcoder |
defmodule AtomTweaksWeb.PageMetadata do
@moduledoc """
A system for easily setting metadata for the page before it is rendered.
If you assign some metadata to the page before it is rendered:
```
iex> PageMetadata.add(conn, foo: "bar")
iex> hd(conn.assigns.page_metadata)
[foo: "bar"]
```
And add the... | lib/atom_tweaks_web/page_metadata.ex | 0.777427 | 0.635208 | page_metadata.ex | starcoder |
defmodule Cldr.Number.Transliterate do
@moduledoc """
Transliteration for digits and separators.
Transliterating a string is an expensive business. First the string has to
be exploded into its component graphemes. Then for each grapheme we have
to map to the equivalent in the other `{locale, number_system}... | lib/cldr/number/transliterate.ex | 0.886282 | 0.787155 | transliterate.ex | starcoder |
defmodule Blockchain.Block do
@moduledoc """
This module effectively encodes a block, the heart of the blockchain.
A chain is formed when blocks point to previous blocks,
either as a parent or an ommer (uncle).
For more information, see Section 4.3 of the Yellow Paper.
"""
alias Block.Header
alias Bloc... | apps/blockchain/lib/blockchain/block.ex | 0.858006 | 0.470676 | block.ex | starcoder |
defmodule ExploringElixir do
require Logger
def episode1 do
# Emulates a hypothetical service (web service, over a TCP socket,
# another OTP process, etc.) that transforms some JSON for us ...
# but which suffers from some bugs?
f = File.read!("data/client.json")
ExploringElixir.JSONFilter.extr... | lib/exploring_elixir.ex | 0.641535 | 0.558598 | exploring_elixir.ex | starcoder |
defmodule GrapevineData.Games.Images do
@moduledoc """
Handle uploading images to remote storage for games
"""
alias GrapevineData.Games.Game
alias GrapevineData.Images
alias GrapevineData.Repo
alias Stein.Storage
@doc """
If present, upload a cover and/or hero image for a game
Only uploads a cov... | apps/data/lib/grapevine_data/games/images.ex | 0.700178 | 0.462959 | images.ex | starcoder |
defmodule Clox do
alias Timex.Date
alias Timex.DateFormat
@minute_prefix "m"
@ten_minute_prefix "T"
@hour_prefix "H"
@day_prefix "D"
@week_prefix "W"
@month_prefix "M"
@minute_conversion 60
@minute_res 1
@ten_minute_res 10
@hour_res 60
@day_res @hour_res * 24
@week_res @day_res * 7
@mo... | lib/clox.ex | 0.820649 | 0.441131 | clox.ex | starcoder |
defmodule K8s.Client.Runner.Watch do
@moduledoc """
`K8s.Client` runner that will watch a resource or resources and stream results back to a process.
"""
@resource_version_json_path ~w(metadata resourceVersion)
alias K8s.Client.Runner.Base
alias K8s.Operation
@doc """
Watch a resource or list of reso... | lib/k8s/client/runner/watch.ex | 0.888647 | 0.632531 | watch.ex | starcoder |
defmodule Exq.Redis.Connection do
@moduledoc """
The Connection module encapsulates interaction with a live Redis connection or pool.
"""
require Logger
alias Exq.Support.Config
alias Exq.Support.Redis
def flushdb!(redis) do
{:ok, res} = q(redis, ["flushdb"])
res
end
def decr!(redis, key) ... | lib/exq/redis/connection.ex | 0.695958 | 0.616503 | connection.ex | starcoder |
defmodule Zaryn.SelfRepair.Sync.BeaconSummaryHandler.NetworkStatistics do
@moduledoc false
use GenServer
alias Zaryn.PubSub
alias Zaryn.Utils
require Logger
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, opts)
end
def init(_opts) do
init_dump_dir()
unless File.exists?(d... | lib/zaryn/self_repair/sync/beacon_summary_handler/network_statistics.ex | 0.792263 | 0.419559 | network_statistics.ex | starcoder |
defmodule QueryBuilder.JoinMaker do
@moduledoc false
require Ecto.Query
@doc ~S"""
Options may be:
* `:mode`: if set to `:if_preferable`, schemas are joined only if it is better
performance-wise; this happens only for one case: when the association has a
one-to-one cardinality, it is better to join and ... | lib/join_maker.ex | 0.695648 | 0.463687 | join_maker.ex | starcoder |
defmodule IntSort do
@moduledoc """
Contains functionality for sorting and chunking integers as well as merging the
chunk files
"""
alias IntSort.Chunk
alias IntSort.IntermediateFile
@integer_file Application.get_env(:int_sort, :integer_file)
# The chunk files represent the first generation of merge f... | int_sort/lib/int_sort.ex | 0.876674 | 0.7007 | int_sort.ex | starcoder |
defmodule PayPal.Payments.Authorizations do
@moduledoc """
Documentation for PayPal.Payments.Authorizations
https://developer.paypal.com/docs/api/payments/#authorization
"""
@doc """
Show an authorization
[docs](https://developer.paypal.com/docs/api/payments/#authorization_get)
Possible returns:
... | lib/payments/authorizations.ex | 0.677367 | 0.468243 | authorizations.ex | starcoder |
defmodule Finance.Numerical.Root do
@moduledoc """
Method for finding the roots of any one-dimensional function
```
f(x) = 0
```
"""
defmodule Finance.Numerical.Iteration do
@moduledoc false
defstruct [
# function f(x)
:f,
# first derivative of f(x)
:fd,
# minimum v... | lib/numerical/root.ex | 0.895658 | 0.897964 | root.ex | starcoder |
defmodule AWS.IoTJobsDataPlane do
@moduledoc """
AWS IoT Jobs is a service that allows you to define a set of jobs — remote
operations that are sent to and executed on one or more devices connected to AWS
IoT.
For example, you can define a job that instructs a set of devices to download
and install applic... | lib/aws/generated/iot_jobs_data_plane.ex | 0.791378 | 0.455865 | iot_jobs_data_plane.ex | starcoder |
defmodule Finch do
@external_resource "README.md"
@moduledoc "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
alias Finch.PoolManager
use Supervisor
@atom_methods [
:get,
:post,
:put,
:patch,
:delete,
:head,
:... | lib/finch.ex | 0.913662 | 0.407333 | finch.ex | starcoder |
defmodule Commanded.Assertions.EventAssertions do
@moduledoc """
Provides test assertion and wait for event functions to help test applications built using Commanded.
The default receive timeout is one second.
You can override the default timeout in config (e.g. `config/test.exs`):
config :commanded,
... | lib/commanded/assertions/event_assertions.ex | 0.879101 | 0.715797 | event_assertions.ex | starcoder |
defmodule Toolshed.Top do
@default_n 10
@moduledoc """
Find the top processes
"""
defmacro __using__(_) do
quote do
import Toolshed.Top,
only: [
top: 0,
top: 1,
top_reductions: 0,
top_reductions: 1,
top_mailbox: 0,
top_mailbox: 1,... | lib/toolshed/top.ex | 0.701815 | 0.422326 | top.ex | starcoder |
defmodule Poison.MissingDependencyError do
@type t :: %__MODULE__{name: String.t()}
defexception name: nil
def message(%{name: name}) do
"missing optional dependency: #{name}"
end
end
defmodule Poison.ParseError do
alias Code.Identifier
alias Poison.Parser
@type t :: %__MODULE__{data: String.t(), ... | lib/poison/parser.ex | 0.656988 | 0.504211 | parser.ex | starcoder |
defmodule ZenMonitor.Truncator do
@moduledoc """
ZenMonitor.Truncator is used to truncate error messages to prevent error expansion issues.
## Error Expansion
At the core of ZenMonitor is a system that collects local `:DOWN` messages, batches them up and
relays them in bulk. This opens up a failure mode wh... | lib/zen_monitor/truncator.ex | 0.907481 | 0.85561 | truncator.ex | starcoder |
defmodule Credo.Check.Readability.StrictModuleLayout do
use Credo.Check,
run_on_all: true,
base_priority: :low,
explanations: [
check: """
Provide module parts in a required order.
# preferred
defmodule MyMod do
@moduledoc "moduledoc"
use Foo
... | lib/credo/check/readability/strict_module_layout.ex | 0.852706 | 0.490053 | strict_module_layout.ex | starcoder |
defmodule Unicode.GeneralCategory.Derived do
@moduledoc """
For certain operations and transformations
(especially in [Unicode Sets](http://unicode.org/reports/tr35/#Unicode_Sets))
there is an expectation that certain derived
general categories exists even though they are not
defined in the unicode characte... | lib/unicode/category/derived_category.ex | 0.880823 | 0.645588 | derived_category.ex | starcoder |
defmodule Maptu do
@moduledoc """
Provides functions to convert from "dumped" maps to Elixir structs.
This module provides functions to safely convert maps (with string keys) that
represent structs (usually decoded from some kind of protocol, like
MessagePack or JSON) to Elixir structs.
## Rationale
Ma... | lib/maptu.ex | 0.856542 | 0.677367 | maptu.ex | starcoder |
defmodule PixelFont.DSL.MacroHelper do
@moduledoc false
@doc false
@spec block_direct_invocation!(Macro.Env.t()) :: no_return()
def block_direct_invocation!(env) do
raise CompileError,
file: env.file,
line: env.line,
description: "this macro cannot be called directly"
end
@typep expr... | lib/pixel_font/dsl/macro_helper.ex | 0.71113 | 0.545528 | macro_helper.ex | starcoder |
defmodule HELF.Mailer do
@moduledoc """
Provides a way for sending emails with a list of Bamboo mailers.
It will try to send the email using the first available mailer, and then
fallback to the next whenever the current one fails.
Before using the module, you should configure the list of mailers, this
is ... | lib/helf/mailer.ex | 0.665519 | 0.435601 | mailer.ex | starcoder |
defmodule Astro do
@moduledoc "Library to calculate sunrise/set and related times given a latitude and longitude"
# ported from https://github.com/mourner/suncalc
# sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas
# date/time constants and conversions
@day_ms 1000 * 60 * 60 ... | lib/astro.ex | 0.727201 | 0.64944 | astro.ex | starcoder |
defmodule Elixium.Block do
alias Elixium.Block
alias Elixium.Utilities
alias Elixium.Transaction
alias Elixium.Store.Ledger
require Logger
@moduledoc """
Provides functions for creating blocks and mining new ones
"""
defstruct index: <<0, 0, 0, 0>>,
hash: nil,
version: <<0,... | lib/block.ex | 0.741674 | 0.493836 | block.ex | starcoder |
defmodule ExIcal.Parser do
@moduledoc """
Responsible for parsing an iCal string into a list of events.
This module contains one public function, `parse/1`.
Most of the most frequently used iCalendar properties can be parsed from the
file (for example: start/end time, description, recurrence rules, and more... | lib/ex_ical/parser.ex | 0.848078 | 0.808521 | parser.ex | starcoder |
defmodule Blur.IRC.TwitchTag do
@moduledoc """
Handle all the following tags.
https://dev.twitch.tv/docs/irc/tags/
# User
display-name: The user’s display name
badge-info: indicate the exact number of months the user has been a subscriber.
badges: Comma-separated list of chat badges and the version of ... | lib/handlers/IRC/twitch_tag.ex | 0.699254 | 0.480174 | twitch_tag.ex | starcoder |
defmodule VintageNet.Technology.Gadget do
@behaviour VintageNet.Technology
alias VintageNet.Interface.RawConfig
alias VintageNet.IP.IPv4Config
@moduledoc """
Support for USB Gadget virtual Ethernet interface configurations
USB Gadget interfaces expose a virtual Ethernet port that has a static
IP. This ... | lib/vintage_net/technology/gadget.ex | 0.767908 | 0.473901 | gadget.ex | starcoder |
defmodule NxEvision do
@moduledoc """
`NxEvision` is a bridge
between [Nx](https://github.com/elixir-nx/nx)
and [evision](https://github.com/cocoa-xu/evision).
"""
@doc """
Converts a tensor of `Nx` to `Mat` of evision (OpenCV).
The tensor assumes to be `:RGB` color space.
"""
@spec convert_nx_to_... | lib/nx_evision.ex | 0.889319 | 0.880386 | nx_evision.ex | starcoder |
defmodule FusionAuth.Users do
@moduledoc """
The `FusionAuth.Users` module provides access functions to the [FusionAuth Users API](https://fusionauth.io/docs/v1/tech/apis/users).
All functions require a Tesla Client struct created with `FusionAuth.client(base_url, api_key, tenant_id)`.
## User Fields
- t... | lib/fusion_auth/users.ex | 0.808257 | 0.470372 | users.ex | starcoder |
defmodule ExChip8.Instructions do
alias ExChip8.{Screen, Stack, Registers, Keyboard, Memory}
import Bitwise
require Logger
@chip8_default_sprite_height Application.get_env(:ex_chip8, :chip8_default_sprite_height)
@moduledoc """
Implements all chip8 instructions.
Operation code is pattern matched to c... | lib/ex_chip8/instructions.ex | 0.53437 | 0.47792 | instructions.ex | starcoder |
defmodule Uderzo.GenRenderer do
@moduledoc """
Generic rendering code. This will start a process that will render a frame
at a regular rate in a window of the indicated size. Rendering the frame is
done by calling a callback with the current window
size and height and the current mouse pointer position.
`G... | uderzo/lib/uderzo/gen_renderer.ex | 0.806396 | 0.842021 | gen_renderer.ex | starcoder |
defmodule OddJob.Queue do
@moduledoc """
The `OddJob.Queue` is a `GenServer` that manages the assignments given to the pool workers.
The `queue` receives jobs and assigns them to available workers. If all workers in a pool are
currently busy then new jobs are added to a FIFO queue to be processed as workers
... | lib/odd_job/queue.ex | 0.855248 | 0.563558 | queue.ex | starcoder |
defmodule SanbaseWeb.Graphql.AnomalyTypes do
use Absinthe.Schema.Notation
import SanbaseWeb.Graphql.Cache, only: [cache_resolve: 1, cache_resolve: 2]
alias Sanbase.Anomaly
alias SanbaseWeb.Graphql.Complexity
alias SanbaseWeb.Graphql.Middlewares.AccessControl
alias SanbaseWeb.Graphql.Resolvers.AnomalyReso... | lib/sanbase_web/graphql/schema/types/anomaly_types.ex | 0.864611 | 0.458409 | anomaly_types.ex | starcoder |
defmodule Mix.Tasks.ReadDoc do
alias ReadDoc.Options
import ReadDoc.FileSaver, only: [maybe_backup_files: 1]
import ReadDoc.DocExtractor, only: [extract_doc: 1]
@moduledoc """
## Abstract
Documentation of your project can be extracted into files containing
markers.
These markers are
<!-- begi... | lib/mix/tasks/read_doc.ex | 0.627038 | 0.426501 | read_doc.ex | starcoder |
defmodule Earmark do
@type ast_meta :: map()
@type ast_tag :: binary()
@type ast_attribute_name :: binary()
@type ast_attribute_value :: binary()
@type ast_attribute :: {ast_attribute_name(), ast_attribute_value()}
@type ast_attributes :: list(ast_attribute())
@type ast_tuple :: {ast_tag(), ast_attributes... | lib/earmark.ex | 0.849019 | 0.400105 | earmark.ex | starcoder |
defmodule Dispenser.Server.BufferServer do
@moduledoc """
A `BufferServer` is an example `GenServer` that uses `Dispenser.Buffer`.
It can receive events and send them to subscriber processes.
Subscribers can control the flow by telling the `BufferServer` how many events they want, using `ask/3`.
See `ask/3` ... | lib/dispenser/server/buffer_server.ex | 0.831827 | 0.49585 | buffer_server.ex | starcoder |
defmodule PromEx.Plug do
@moduledoc """
Use this plug in your Endpoint file to expose your metrics. The following options are supported by this plug:
* `:prom_ex_module` - The PromEx module whose metrics will be plublished through this particular plug
* `:path` - The path through which your metrics can be acce... | lib/prom_ex/plug.ex | 0.831588 | 0.574186 | plug.ex | starcoder |
defmodule ExWire.Packet.Capability.Par.WarpStatus do
@moduledoc """
Status messages updated to handle warp details.
```
**Status** [`+0x00`: `P`, `protocolVersion`: `P`, `networkId`: `P`,
`td`: `P`, `bestHash`: `B_32`, `genesisHash`: `B_32`,
`snapshot_hash`: B_32, `snapshot_number`:... | apps/ex_wire/lib/ex_wire/packet/capability/par/warp_status.ex | 0.850453 | 0.751694 | warp_status.ex | starcoder |
defmodule Homework.Merchants do
@moduledoc """
The Merchants context.
"""
import Homework.FuzzySearchHelper
import Ecto.Query, warn: false
alias Homework.Repo
alias Homework.Merchants.Merchant
@doc """
Returns the list of merchants.
## Examples
iex> list_merchants([])
[%Merchant{},... | elixir/lib/homework/merchants.ex | 0.614394 | 0.410431 | merchants.ex | starcoder |
defmodule AWS.Signer do
@moduledoc """
With code signing for IoT, you can sign code that you create for any IoT
device that is supported by Amazon Web Services (AWS). Code signing is
available through [Amazon
FreeRTOS](http://docs.aws.amazon.com/freertos/latest/userguide/) and [AWS
IoT Device
Management]... | lib/aws/signer.ex | 0.844281 | 0.496765 | signer.ex | starcoder |
defmodule CCSP.Chapter2.GenericSearch do
alias CCSP.Chapter2.PriorityQueue
alias CCSP.Chapter2.Stack
alias CCSP.Chapter2.Queue
alias CCSP.Chapter2.Node
@moduledoc """
Corresponds to CCSP in Python, Section 2.2 titled "Maze Solving"
"""
@spec linear_contains?(list(any), any) :: boolean
def linear_con... | lib/ccsp/chapter2/generic_search.ex | 0.767777 | 0.530054 | generic_search.ex | starcoder |
defmodule Timex.Format.DateTime.Formatters.Strftime do
@moduledoc """
Date formatting language defined by the `strftime` function from the Standard
C Library.
This implementation in Elixir is mostly compatible with `strftime`. The
exception is the absence of locale-depended results. All directives that imply... | lib/format/datetime/formatters/strftime.ex | 0.878751 | 0.815012 | strftime.ex | starcoder |
defmodule Blogit.Components.Posts do
@moduledoc """
A `Blogit.Component` process which can be queried from outside.
The `Blogit.Components.Posts` process holds all the posts in the blog as its
state.
This process handles the following `call` messages:
* :all -> returns all the posts of the blog as list of ... | lib/blogit/components/posts.ex | 0.719876 | 0.521167 | posts.ex | starcoder |
defmodule SvgBuilder.Font do
alias SvgBuilder.{Element, Units}
@text_types ~w(altGlyph textPath text tref tspan)a
@font_styles ~w(normal italic oblique inherit)a
@font_variants ~w(normal small-caps inherit)a
@font_weights ~w(normal bold bolder lighter inherit)a
@numeric_font_weights [100, 200, 300, 400, 50... | lib/font.ex | 0.892785 | 0.409339 | font.ex | starcoder |
defimpl Timex.Protocol, for: Tuple do
alias Timex.AmbiguousDateTime
alias Timex.DateTime.Helpers
import Timex.Macros
@epoch :calendar.datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}})
def to_julian(date) do
with {y, m, d} <- to_erl_datetime(date),
do: Timex.Calendar.Julian.julian_date(y,... | lib/datetime/erlang.ex | 0.677581 | 0.47524 | erlang.ex | starcoder |
defmodule AWS.Cloud9 do
@moduledoc """
AWS Cloud9
AWS Cloud9 is a collection of tools that you can use to code, build, run, test,
debug, and release software in the cloud.
For more information about AWS Cloud9, see the [AWS Cloud9 User Guide](https://docs.aws.amazon.com/cloud9/latest/user-guide).
AWS Cl... | lib/aws/generated/cloud9.ex | 0.874961 | 0.636988 | cloud9.ex | starcoder |
defmodule Hui.Query.Facet do
@moduledoc """
Struct related to [faceting](http://lucene.apache.org/solr/guide/faceting.html).
### Example
iex> x = %Hui.Query.Facet{field: ["type", "year"], query: "year:[2000 TO NOW]"}
%Hui.Query.Facet{
contains: nil,
"contains.ignoreCase": nil,
... | lib/hui/query/facet.ex | 0.850298 | 0.405596 | facet.ex | starcoder |
defmodule Entrance.Auth.Bcrypt do
@moduledoc """
Provides functions for hashing passwords and authenticating users using
[Bcrypt](https://hexdocs.pm/bcrypt_elixir/Bcrypt.html#content).
This module assumes that you have a virtual field named `password`, and a
database backed string field named `hashed_passwor... | lib/auth/bcrypt.ex | 0.85449 | 0.764452 | bcrypt.ex | starcoder |
defmodule Squitter.Decoding.ExtSquitter do
require Logger
import Squitter.Decoding.Utils
alias Squitter.StatsTracker
alias Squitter.Decoding.ModeS
alias Squitter.Decoding.ExtSquitter.{
TypeCode,
Callsign,
AirbornePosition,
AircraftCategory,
GroundSpeed,
AirSpeed
}
@df [17, 18]
... | squitter/lib/squitter/decoding/ext_squitter/decoder.ex | 0.520009 | 0.405684 | decoder.ex | starcoder |
defmodule Zaryn.Governance.Code.CICD.Docker do
@moduledoc """
CICD service baked by docker.
The service relies on the `Dockerfile` with two targets: `zaryn-ci` and
`zaryn-cd`.
The `zaryn-ci` target produces an image with build tools. Its goal is to
compile the source code into `zaryn_node` release. The CI... | lib/zaryn/governance/code/cicd/docker/cicd.ex | 0.709019 | 0.461623 | cicd.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.