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 Forma do
@moduledoc """
Applies typespecs to JSON-like data.
This module can parse JSON-like data (such as maps with key strings)
into a more structured form by trying to map it to conform to a
module's typespec.
This can generally be useful when interfacing with external data
sources that pro... | lib/forma.ex | 0.78345 | 0.628664 | forma.ex | starcoder |
defmodule AWS.Kinesis do
@moduledoc """
Amazon Kinesis Data Streams Service API Reference
Amazon Kinesis Data Streams is a managed service that scales elastically
for real-time processing of streaming big data.
"""
@doc """
Adds or updates tags for the specified Kinesis data stream. Each time you
inv... | lib/aws/kinesis.ex | 0.945758 | 0.740761 | kinesis.ex | starcoder |
defmodule Stripe.Subscription do
@moduledoc """
Work with Stripe subscription objects.
You can:
- Create a subscription
- Retrieve a subscription
- Update a subscription
- Delete a subscription
Does not yet render lists or take options.
Stripe API reference: https://stripe.com/docs/api#subscriptio... | lib/stripe/subscription.ex | 0.791781 | 0.581719 | subscription.ex | starcoder |
defmodule ExDns.Resource do
@moduledoc """
Manages resource records.
4.1.3. Resource record format
The answer, authority, and additional sections all share the same
format: a variable number of resource records, where the number of
records is specified in the corresponding count field in the header.
Eac... | lib/ex_dns/resource.ex | 0.619701 | 0.579817 | resource.ex | starcoder |
defmodule Coxir.Struct.Message do
@moduledoc """
Defines methods used to interact with channel messages.
Refer to [this](https://discord.com/developers/docs/resources/channel#message-object)
for a list of fields and a broader documentation.
In addition, the following fields are also embedded.
- `guild` - ... | lib/coxir/struct/message.ex | 0.886868 | 0.439026 | message.ex | starcoder |
defmodule Req do
require Logger
@external_resource "README.md"
@moduledoc "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
@doc """
Makes a GET request.
See `request/3` for a list of supported options.
"""
@doc api: :high_level
... | lib/req.ex | 0.867471 | 0.488527 | req.ex | starcoder |
defmodule Versioning do
@moduledoc """
Versionings allow data to be changed to different versions of itself.
A the heart of our versioning is the `Versioning` struct. A `Versioning` struct
contains the following fields:
- `:current` - The current version that our data represents.
- `:target` - The ver... | lib/versioning.ex | 0.934058 | 0.743098 | versioning.ex | starcoder |
defmodule Ptolemy.Provider do
@moduledoc """
`Ptolemy.Provider` defines behaviours for implementing a configuration provider.
The source that `Ptolemy.Loader` pulls values from are defined
by providers. Each provider is responsible for retrieving a value, given a query.
Once implemented, a provider can suppl... | lib/provider.ex | 0.912709 | 0.914673 | provider.ex | starcoder |
defmodule Timex.Utils do
@moduledoc false
@doc """
Determines the current version of OTP running this node. The result is
cached for fast lookups in performance-sensitive functions.
## Example
iex> rel = Timex.Utils.get_otp_release
...> '\#{rel}' == :erlang.system_info(:otp_release)
true
... | lib/timex/utils.ex | 0.837985 | 0.451689 | utils.ex | starcoder |
defmodule RecurringEvents do
@moduledoc """
*RecurringEvents* is an Elixir library providing recurring events support
(duh!).
It loosely follows
[iCal Recurrence rule specification](http://www.kanzaki.com/docs/ical/rrule.html)
[RFC 2445](https://tools.ietf.org/html/rfc2445).
iex> RecurringEvents.tak... | lib/recurring_events.ex | 0.876132 | 0.612657 | recurring_events.ex | starcoder |
defmodule SnowplowTracker.Events.Helper do
@moduledoc """
This module contains the implementations of
function used to set the default values in the payload.
"""
@uuid_version 4
@rfc_4122_variant10 2
@doc """
Generate a v4 UUID string to uniquely identify an event
"""
@spec generate_uuid() :: Stri... | lib/snowplow_tracker/events/helper.ex | 0.775987 | 0.42057 | helper.ex | starcoder |
defmodule StarkInfra.IssuingHolder do
alias __MODULE__, as: IssuingHolder
alias StarkInfra.IssuingRule
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.API
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
Groups ... | lib/issuing_holder/issuing_holder.ex | 0.897622 | 0.551091 | issuing_holder.ex | starcoder |
defmodule Skooma do
require Logger
alias Skooma.Basic
def valid?(data, schema, path \\ []) do
results =
cond do
is_atom(schema) ->
valid?(data, [schema], path)
is_tuple(schema) ->
validate_tuple(data, schema, path)
Keyword.keyword?(schema) ->
vali... | lib/skooma.ex | 0.507812 | 0.465934 | skooma.ex | starcoder |
defmodule XDR.IntError do
@moduledoc """
This module contains the definition of `XDR.IntError` exception that may be raised by the `XDR.Int` module.
"""
defexception [:message]
@impl true
@doc """
Create a `XDR.IntError` exception with the message of the `error_type` passed.
"""
def exception(:not_i... | lib/xdr/error.ex | 0.927937 | 0.591251 | error.ex | starcoder |
defmodule Pixie.Extension do
@moduledoc """
Used to implement Bayeux extensions, which can be used to filter or change
incoming messages and the responses sent back to the client.
For example:
```elixir
defmodule AuthenticationExtension do
use Pixie.Extension
def incoming %Event{message: %{ext: %{... | lib/pixie/extension.ex | 0.824603 | 0.636621 | extension.ex | starcoder |
defmodule Absinthe.Phase.Document.Validation.FieldsOnCorrectType do
@moduledoc false
# Validates document to ensure that all fields are provided on the correct type.
alias Absinthe.{Blueprint, Phase, Phase.Document.Validation.Utils, Schema, Type}
use Absinthe.Phase
@doc """
Run the validation.
"""
@... | lib/absinthe/phase/document/validation/fields_on_correct_type.ex | 0.760562 | 0.417093 | fields_on_correct_type.ex | starcoder |
defmodule Holidefs.Holiday do
@moduledoc """
A holiday itself.
"""
alias Holidefs.DateCalculator
alias Holidefs.Definition.Rule
alias Holidefs.Holiday
alias Holidefs.Options
defstruct [:name, :raw_date, :observed_date, :date, informal?: false]
@type t :: %Holidefs.Holiday{
name: String.t(... | lib/holidefs/holiday.ex | 0.846101 | 0.42937 | holiday.ex | starcoder |
defmodule JPMarc.Leader do
@moduledoc """
Tools for working with JPMARC Leader
"""
@typedoc """
Type that represents `JPMarc.Leader` struct
This constructed with `:length` as integer, `:status` as String, `:type` of String, `:level` as String, `:base` as integer, `:encoding` String, `:format` Stri... | lib/jpmarc/leader.ex | 0.897666 | 0.44734 | leader.ex | starcoder |
defmodule Ecto.Type do
@moduledoc """
Defines functions and the `Ecto.Type` behaviour for implementing
custom types.
A custom type expects 4 functions to be implemented, all documented
and described below. We also provide two examples of how custom
types can be used in Ecto to augment existing types or pro... | lib/ecto/type.ex | 0.93035 | 0.683989 | type.ex | starcoder |
defmodule Quill.Encoder do
@moduledoc """
Documentation for Quill.Encoder.
"""
# Encode output as Logfmt
def encode(map, config = %{log_format: :logfmt}) do
map
|> force_map()
|> ordered_keywords(config)
|> Logfmt.encode()
end
# Encode output as JSON
def encode(map, %{log_format: :json... | lib/encoder/encoder.ex | 0.67854 | 0.408159 | encoder.ex | starcoder |
defmodule Distro do
@moduledoc """
This modules handels the information that shall be passed between the different nodes. The GenServer keeps
a map of all the orders for all the elevators. The map is sorted by keys, the keys are the names of the
different nodes that the node can reach.
Communications is han... | lib/distro.ex | 0.840717 | 0.597021 | distro.ex | starcoder |
defmodule MCTS.Zipper do
@moduledoc """
A zipper tree.
"""
alias MCTS.{Breadcrumb, Node}
@enforce_keys [:focus]
defstruct(focus: nil, breadcrumbs: [])
@type t :: %__MODULE__{focus: Node.t(), breadcrumbs: [Breadcrumb.t()]}
@spec root?(__MODULE__.t()) :: boolean()
def root?(zipper = %__MODULE__{}) d... | apps/mcts/lib/mcts/zipper.ex | 0.838101 | 0.453322 | zipper.ex | starcoder |
defmodule Sanbase.Signal.ResultBuilder.Transformer do
defmodule Data do
@derive Jason.Encoder
defstruct [
:identifier,
:current,
:previous,
:previous_average,
:absolute_change,
:percent_change
]
defimpl String.Chars, for: __MODULE__ do
def to_string(data), do... | lib/sanbase/signals/trigger/settings/result_builder/transformer.ex | 0.785432 | 0.431944 | transformer.ex | starcoder |
defmodule Cldr.Calendar.Conversion do
@moduledoc false
# This is a private module used only
# by ex_cldr during the consolidation phase
# of the CLDR base data
def convert_eras_to_iso_days(calendar_data) do
Enum.map(calendar_data, fn {calendar, content} ->
{calendar, adjust_eras(content)}
end)... | lib/cldr/utils/calendar_conversion.ex | 0.778733 | 0.532851 | calendar_conversion.ex | starcoder |
defmodule Day10 do
defmodule Pos do
defstruct x: 0, y: 0
end
@spec angle(Pos.t(), Pos.t()) :: float
def angle(base, pos) do
# Y goes down and measuring angles clockwise from UP. Hence odd delta's
angle = ElixirMath.atan2(pos.x - base.x / 1, base.y - pos.y / 1)
if angle < 0, do: angle + 2 * :mat... | lib/day10.ex | 0.765725 | 0.646809 | day10.ex | starcoder |
defmodule Mollie.Customers.Mandates do
import Mollie
alias Mollie.Client
@moduledoc """
Mandates allow you to charge a customer’s credit card, PayPal account or bank account recurrently.
It is only possible to create mandates for IBANs and PayPal billing agreements with this API.
To create mandates for cr... | lib/mollie/customers/mandates.ex | 0.727879 | 0.559049 | mandates.ex | starcoder |
defmodule Csp.MinConflicts do
@moduledoc """
[Min-conflicts](https://en.wikipedia.org/wiki/Min-conflicts_algorithm) algorithm implementation,
with Tabu search to allow overcoming local minimums.
"""
@doc """
Solves `csp` with min-conflicts algorithm, using tabu search to overcome local minimums.
## Opti... | lib/csp/min_conflicts.ex | 0.757346 | 0.805058 | min_conflicts.ex | starcoder |
defmodule HashRing.Managed do
@moduledoc """
This module defines the API for working with hash rings where the ring state is managed
in a GenServer process.
There is a performance penalty with working with the ring this way, but it is the best approach
if you need to share the ring across multiple processes,... | lib/managed_ring.ex | 0.914851 | 0.627837 | managed_ring.ex | starcoder |
defmodule BitwiseIp.Block do
@moduledoc """
A struct representing a range of bitwise IP addresses.
Since 1993, [classless inter-domain routing
(CIDR)](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) has
been the basis for allocating blocks of IP addresses and efficiently routing
between them.... | lib/bitwise_ip/block.ex | 0.948894 | 0.946547 | block.ex | starcoder |
defmodule Journey.Step do
@moduledoc ~S"""
The data structure for defining a step in a process.
## Example: Using Journey.Step to Define a Process
iex> _process = %Journey.Process{
...> process_id: "horoscopes-r-us",
...> steps: [
...> %Journey.Step{name: :first... | lib/step.ex | 0.610918 | 0.730362 | step.ex | starcoder |
defmodule Maple do
@moduledoc """
The purpose of this module is to parse a GraphQL schema and to dynamically create
easy to use client code functions at compile time with which a user can execute queries and
mutations on a GraphQL endpoint.
The module takes options from the configuration:
```
config :ma... | lib/maple.ex | 0.759939 | 0.79653 | maple.ex | starcoder |
defmodule Collision.Polygon.RegularPolygon do
@moduledoc """
A regular polygon is equiangular and equilateral -- all
angles and all sides be equal. With enough sides,
a regular polygon tends toward a circle.
"""
defstruct sides: 3, radius: 0, rotation_angle: 0.0, midpoint: %{x: 0, y: 0}, polygon: nil
ali... | lib/collision/polygon/regular_polygon.ex | 0.932622 | 0.951774 | regular_polygon.ex | starcoder |
defmodule RayTracer.RTuple do
@moduledoc """
This module wraps basic vector/point operations
"""
import __MODULE__.Helpers
@type t :: %__MODULE__{
values: list()
}
@type vector :: t
@type point :: t
defstruct values: {}
@spec sub(t, t) :: t
def sub(a, b) do
a |> zip_map(b, &(&1 - &2)) ... | lib/r_tuple.ex | 0.906787 | 0.651112 | r_tuple.ex | starcoder |
defmodule StateChart.Document.State do
use StateChart.Definition do
field(:string, :id, 1)
field(:ref, :ref, 2)
enum Type, :type, 3, [
basic: 0,
composite: 1,
parallel: 2,
history: 3,
initial: 4,
final: 5
]
repeated(:ref, :initials, 4, [:initial])
repeated(S... | lib/state_chart/document/state.ex | 0.517327 | 0.488039 | state.ex | starcoder |
defmodule Stargate.Supervisor do
@moduledoc """
This module defines a top-level supervisor for your Stargate client.
It takes a keyword list of configuration values for connecting to the
cluster and any producers, readers, or consumers desired, and orchestrates
the starting of the process registry and the web... | lib/stargate/supervisor.ex | 0.806281 | 0.439807 | supervisor.ex | starcoder |
defmodule Cloak.Cipher do
@moduledoc """
A behaviour for encryption/decryption modules. Use it to write your own custom
Cloak-compatible cipher modules.
## Example
Here's a sample custom cipher that adds "Hello, " to the start of every
ciphertext, and removes it on decryption.
defmodule MyCustomCip... | lib/cloak/ciphers/cipher.ex | 0.845049 | 0.408955 | cipher.ex | starcoder |
defmodule Sanbase.Metric.Behaviour do
@moduledoc ~s"""
Behaviour describing a MetricAdapter module.
A MetricAdapter module describes how metrics and metadata for them are fetched.
After a new MetricAdapter module is created, in order to expose it through
the Sanbase.Metric module, it should be added to the l... | lib/sanbase/metric/behaviour.ex | 0.883337 | 0.403743 | behaviour.ex | starcoder |
defmodule Nerves.NetworkInterface do
require Logger
@moduledoc """
This module exposes a simplified view of Linux network configuration to
applications.
## Overview
This module should be added to a supervision tree or started via the
`start_link/0` call. Once running, the module provides functions to... | lib/nerves_network_interface.ex | 0.87819 | 0.487734 | nerves_network_interface.ex | starcoder |
defmodule ExOneroster.Web.DemographicView do
use ExOneroster.Web, :view
alias ExOneroster.Web.DemographicView
def render("index.json", %{demographics: demographics}) do
%{data: render_many(demographics, DemographicView, "demographic.json")}
end
def render("show.json", %{demographic: demographic}) do
... | lib/ex_oneroster/web/views/demographic_view.ex | 0.548674 | 0.603494 | demographic_view.ex | starcoder |
defmodule TimeZoneInfo.Worker do
@moduledoc false
# Holds the state for `TimeZoneInfo` and starts the initial update and when
# configured the automatic updates.
use GenServer
alias TimeZoneInfo.Updater
alias TimeZoneInfo.UtcDateTime
@timeout 3 * 60 * 1_000
@doc """
Starts a worker for `TimeZoneI... | lib/time_zone_info/worker.ex | 0.877036 | 0.546496 | worker.ex | starcoder |
defmodule Calendar.DateTime.Parse do
import Calendar.ParseUtil
@secs_between_year_0_and_unix_epoch 719528*24*3600 # From erlang calendar docs: there are 719528 days between Jan 1, 0 and Jan 1, 1970. Does not include leap seconds
@doc """
Parses an RFC 822 datetime string and shifts it to UTC.
Takes an RFC... | lib/calendar/date_time/parse.ex | 0.835383 | 0.531209 | parse.ex | starcoder |
defmodule Sneex.Address.CycleCalculator do
@moduledoc """
This module provides the mechanism to run through all of the modifiers for calculating the total cycles.
It also provides various constructors for building modifiers.
"""
alias Sneex.Cpu
use Bitwise
defstruct [:cycles, :check_func]
@type t :: %... | lib/sneex/address/cycle_calculator.ex | 0.814385 | 0.410077 | cycle_calculator.ex | starcoder |
defmodule Textmatrix.Line do
@moduledoc """
%Textmatrix.Line{} describes a single line in the Matrix.
A line buffer consist of character slots which can either hold a single
character or nil.
"""
# the default filling character is a space
@default_empty_char 32
alias Textmatrix.Line
@type t() :: %Li... | lib/textmatrix/line.ex | 0.80077 | 0.57532 | line.ex | starcoder |
defmodule Mix.Tasks.Pseudoloc do
@moduledoc """
Mix task for pseudolocalizing the `Gettext` data files.
```
$ mix pseudoloc priv/gettext
```
"""
use Mix.Task
alias Gettext.PO
alias Gettext.PO.{PluralTranslation, Translation}
alias Mix.Shell
@shortdoc "Creates a pseudolocalized translation"
... | lib/mix/tasks/pseudoloc.ex | 0.774455 | 0.569314 | pseudoloc.ex | starcoder |
defmodule NotQwerty123.RandomPassword do
@moduledoc """
Module to generate random passwords.
Users are often advised to use random passwords for authentication.
However, creating truly random passwords is difficult for people to
do well and is something that computers are usually better at.
This module pr... | lib/not_qwerty123/random_password.ex | 0.728555 | 0.551272 | random_password.ex | starcoder |
defmodule VistaClient.Session do
@derive Jason.Encoder
@moduledoc """
Struct to represent an Session.
# Definition _Sessions_
A scrrening show of a film in a cinema on a
screen at a certain time. This is what people book tickets for.
# JSON example:
```
{
"ID": "1001-14164",
"CinemaId": ... | lib/structs/session.ex | 0.641871 | 0.71108 | session.ex | starcoder |
defmodule Scitree.Validations do
@moduledoc """
Validations to ensure data is consistent and in the
format expected by Yggdrasil.
"""
alias Scitree.Config
@type data :: {{String.t(), atom(), [term()]}}
@spec validate(data, Config.t(), list()) ::
:ok
| {:error, atom}
| {:err... | lib/scitree/validations.ex | 0.830594 | 0.555556 | validations.ex | starcoder |
defmodule JsonSchema.Parser.ErrorUtil do
@moduledoc """
Contains helper functions for reporting parser errors.
"""
alias JsonSchema.{Parser, Types}
alias Parser.{ParserError, Util}
@doc """
Returns the name of the type of the given value.
## Examples
iex> get_type([1,2,3])
"list"
... | lib/parser/error_util.ex | 0.843863 | 0.406921 | error_util.ex | starcoder |
defmodule ZenMonitor.Local.Dispatcher do
@moduledoc """
`ZenMonitor.Local.Dispatcher` is a GenStage Consumer responsible for throttled delivery of down
messages.
`ZenMonitor.Local` acts as a GenStage Producer, it stores all of the down messages that need to
be dispatched based off of what has been enqueued b... | lib/zen_monitor/local/dispatcher.ex | 0.913039 | 0.649801 | dispatcher.ex | starcoder |
defmodule QueryBuilder.Extension do
@moduledoc ~S"""
Use this module to create an extension module to `QueryBuilder` for app specific query utilities.
Use your query builder extension module wherever you would normally use `QueryBuilder`
Example:
```
defmodule MyApp.QueryBuilder do
use QueryBuilder.Ext... | lib/query_builder/extension.ex | 0.918407 | 0.574723 | extension.ex | starcoder |
defmodule MvOpentelemetry do
@moduledoc """
Top level module for Opentelemetry instrumentation, as used at Mindvalley.
Used to publish Opentelemetry events to applicable processors, for example
to Honeycomb.
Opentelemetry resources and processor are configured outside of the scope
of this module, use Opent... | lib/mv_opentelemetry.ex | 0.909506 | 0.811041 | mv_opentelemetry.ex | starcoder |
defmodule FlubGw do
@moduledoc """
FlubGw: a gateway system for distributing Flub outside of a node network.
# Some definitions
**Channel**
A channel is as defined for `Flub.sub`.
**Route**
A route is a connection between two endpoints. A route is created with a
channel to subscribe to on the local e... | lib/flub_gw.ex | 0.869784 | 0.423875 | flub_gw.ex | starcoder |
defmodule Logger.Backends.Gelf do
@moduledoc """
GELF Logger Backend
A logger backend that will generate Graylog Extended Log Format messages. The
current version only supports UDP messages.
## Configuration
In the config.exs, add gelf_logger as a backend like this:
```
config :logger,
backends:... | lib/logger/backends/gelf.ex | 0.705481 | 0.816845 | gelf.ex | starcoder |
defmodule Cldr.Number.Parser do
@moduledoc """
Functions for parsing numbers and currencies from
a string.
"""
@type per :: :percent | :permille
@number_format "[-+]?[0-9]([0-9_]|[,](?=[0-9]))*(\\.?[0-9_]+([eE][-+]?[0-9]+)?)?"
@doc """
Scans a string in a locale-aware manner and returns
a list of ... | lib/cldr/number/parse.ex | 0.905317 | 0.699729 | parse.ex | starcoder |
defmodule Rolodex.Mocks.User do
use Rolodex.Schema
@configs [
private: :boolean,
archived: :boolean,
active: :boolean
]
schema "User", desc: "A user record" do
field(:id, :uuid, desc: "The id of the user", required: true)
field(:email, :string, desc: "The email of the user", required: true... | test/support/mocks/schemas.ex | 0.707101 | 0.405684 | schemas.ex | starcoder |
defmodule Flippant do
@moduledoc """
Feature toggling for Elixir applications.
Flippant defines features in terms of `actors`, `groups`, and `rules`:
* **Actors** - Typically an actor is a `%User{}` or some other persistent
struct that identifies who is using your application.
* **Groups** - Groups iden... | lib/flippant.ex | 0.853898 | 0.495239 | flippant.ex | starcoder |
defmodule Plug.Builder do
@moduledoc """
Conveniences for building plugs.
This module can be `use`-d into a module in order to build
a plug pipeline:
defmodule MyApp do
use Plug.Builder
plug Plug.Logger
plug :hello, upper: true
# A function from another module can be pl... | deps/plug/lib/plug/builder.ex | 0.920231 | 0.477554 | builder.ex | starcoder |
defmodule ExDoc.Markdown do
@moduledoc """
Transform a given document in MarkDown to HTML
ExDoc supports the following MarkDown parsers:
* [Hoedown][]
* [Earmark][]
* [Pandoc][]
If you don't offer any preference via `config/config.exs`. ExDoc will try to
find one of the earlier MarkDown parsers. Othe... | lib/ex_doc/markdown.ex | 0.758511 | 0.690937 | markdown.ex | starcoder |
defmodule AWS.Redshift do
@moduledoc """
Amazon Redshift
## Overview
This is an interface reference for Amazon Redshift.
It contains documentation for one of the programming or command line interfaces
you can use to manage Amazon Redshift clusters. Note that Amazon Redshift is
asynchronous, which mean... | lib/aws/generated/redshift.ex | 0.904598 | 0.636099 | redshift.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule Versioning.Controller do
@moduledoc """
A set of functions used with `Phoenix` controllers.
Typically, this module should be imported into your controller modules. In a normal
phoenix application, this can usually be done with the following:
defmodul... | lib/versioning/controller.ex | 0.842944 | 0.524577 | controller.ex | starcoder |
defmodule EEx.Engine do
@moduledoc ~S"""
Basic EEx engine that ships with Elixir.
An engine needs to implement all callbacks below.
This module also ships with a default engine implementation
you can delegate to. See `EEx.SmartEngine` as an example.
"""
@type state :: term
@doc """
Called at the b... | lib/eex/lib/eex/engine.ex | 0.782746 | 0.551091 | engine.ex | starcoder |
defmodule Zaryn.Mining.TransactionContext.NodeDistribution do
@moduledoc false
@doc """
Split the previous storage nodes into groups to distribute fairly
the storage nodes involved, avoiding nodes overlapping if possible
## Examples
iex> NodeDistribution.split_storage_nodes([
...> %Node{last_... | lib/zaryn/mining/transaction_context/node_distribution.ex | 0.722037 | 0.438184 | node_distribution.ex | starcoder |
defmodule Benchmarks.GoogleMessage3.Message34390 do
@moduledoc false
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{
field34452: [Benchmarks.GoogleMessage3.Message34387.t()]
}
defstruct [:field34452]
field :field34452, 1, repeated: true, type: Benchmarks.GoogleMessage3.Message34387
e... | bench/lib/datasets/google_message3/benchmark_message3_1.pb.ex | 0.879121 | 0.458894 | benchmark_message3_1.pb.ex | starcoder |
defmodule Eml.Element do
@moduledoc """
`Eml.Element` defines the struct that represents an element in Eml.
In practice, you will mostly use the element macro's instead of
directly creating `Eml.Element` structs, but the functions in this
module can be valuable when querying, manipulating or transforming
`... | lib/eml/element.ex | 0.778691 | 0.542136 | element.ex | starcoder |
defmodule Ymlr do
@moduledoc """
Encodes data into YAML documents using the `Ymlr.Encoder`.
Every document starts with a separator ("---") and can be enhanced with comments.
"""
alias Ymlr.Encoder
@type document :: Encoder.data | {binary(), Encoder.data} | {[binary()], Encoder.data}
@doc """
Encodes ... | lib/ymlr.ex | 0.865622 | 0.573977 | ymlr.ex | starcoder |
defmodule OMG.JSONRPC.ExposeSpec do
@moduledoc """
`use OMG.JSONRPC.ExposeSpec` to expose all @spec in the runtime via YourModule.get_specs()
NOTE: this is a stripped down version of ExposeSpec. The original one parsed `@spec` annotations automatically
This version requires to give and maintain `@expose_spec... | apps/omg_jsonrpc/lib/expose_spec.ex | 0.849472 | 0.803829 | expose_spec.ex | starcoder |
defmodule Ecto.Query.SelectBuilder do
@moduledoc false
alias Ecto.Query.BuilderUtil
@doc """
Escapes a select.
It allows tuples, lists and variables at the top level or a
single `assoc(x, y)` expression.
## Examples
iex> escape({ 1, 2 }, [])
{ :{}, [], [ :{}, [], [1, 2] ] }
iex> es... | lib/ecto/query/select_builder.ex | 0.831383 | 0.458046 | select_builder.ex | starcoder |
defmodule HelloFinance.Currency do
@required_keys [:code, :value]
@enforce_keys @required_keys
defstruct @required_keys
@codes [
:AED,
:AFN,
:ALL,
:AMD,
:ANG,
:AOA,
:ARS,
:AUD,
:AWG,
:AZN,
:BAM,
:BBD,
:BDT,
:BGN,
:BHD,
:BIF,
:BMD,
:BND,
... | lib/hello_finance/currency.ex | 0.617743 | 0.585871 | currency.ex | starcoder |
if Code.ensure_loaded?(Ecto) do
defmodule LoggerJSON.Ecto do
@moduledoc """
Implements the behaviour of `Ecto.LogEntry` and sends query as a string
to Logger with additional metadata:
* query.execution_time_μs - the time spent executing the query in microseconds;
* query.decode_time_μs - the ... | lib/logger_json/ecto.ex | 0.845942 | 0.466967 | ecto.ex | starcoder |
defmodule AWS.SESv2 do
@moduledoc """
Amazon SES API v2
Welcome to the Amazon SES API v2 Reference.
This guide provides information about the Amazon SES API v2, including supported
operations, data types, parameters, and schemas.
[Amazon SES](https://aws.amazon.com/pinpoint) is an AWS service that you c... | lib/aws/generated/sesv2.ex | 0.80406 | 0.5169 | sesv2.ex | starcoder |
defmodule Braintree.HTTP do
@moduledoc """
Base client for all server interaction, used by all endpoint specific
modules.
This request wrapper coordinates the remote server, headers, authorization
and SSL options.
Using `Braintree.HTTP` requires the presence of three config values:
* `merchant_id` - Br... | lib/http.ex | 0.865722 | 0.429788 | http.ex | starcoder |
defmodule Braintree do
@moduledoc """
A native Braintree client library for Elixir. Only a subset of the API is
supported and this is a work in progress. That said, it is already uned in
production, and any modules that have been implemented can be used.
For general reference please see:
https://developers... | lib/braintree.ex | 0.745028 | 0.47457 | braintree.ex | starcoder |
defmodule JOSEUtils.JWS do
@moduledoc """
Convenience functions to work with signed JWTs
"""
alias JOSEUtils.{JWA, JWK}
@typedoc """
Serialized JWS signed token
For instance:
"<KEY>"
"""
@type serialized :: String.t()
defmodule MalformedError do
defexception message: "malformed JWS"
... | lib/jose_utils/jws.ex | 0.894427 | 0.41745 | jws.ex | starcoder |
defmodule EctoTablestore.Repo do
@moduledoc ~S"""
Defines a repository for Tablestore.
A repository maps to an underlying data store, controlled by `Ecto.Adapters.Tablestore` adapter.
When used, the repository expects the `:otp_app` option, and uses `Ecto.Adapters.Tablestore` by
default. The `:otp_app` sho... | lib/ecto_tablestore/repo.ex | 0.902871 | 0.841696 | repo.ex | starcoder |
defmodule LocalLedger.CachedBalance do
@moduledoc """
This module is an interface to the abstract balances stored in DB. It is responsible for caching
balances and serves as an interface to retrieve the current balances (which will either be
loaded from a cached balance or computed - or both).
"""
alias Lo... | apps/local_ledger/lib/local_ledger/cached_balance.ex | 0.835047 | 0.481515 | cached_balance.ex | starcoder |
defmodule ESpec.Context do
@moduledoc """
Defines macros 'context', 'describe', and 'example_group'.
Defines macros for 'skip' and 'focus' example groups
"""
@aliases ~w(describe example_group)a
@skipped ~w(xcontext xdescribe xexample_group)a
@focused ~w(fcontext fdescribe fexample_group)a
@doc """
... | lib/espec/context.ex | 0.696991 | 0.513485 | context.ex | starcoder |
defmodule AWS.Personalize do
@moduledoc """
Amazon Personalize is a machine learning service that makes it easy to add
individualized recommendations to customers.
"""
@doc """
Creates a batch inference job. The operation can handle up to 50 million
records and the input file must be in JSON format. For... | lib/aws/generated/personalize.ex | 0.89258 | 0.660008 | personalize.ex | starcoder |
defmodule ElixirScript.Compiler do
@moduledoc """
The entry point for the ElixirScript compilation process.
Takes the given module(s) and compiles them and all modules
and functions they use into JavaScript.
Will also take a path to Elixir files
"""
@doc """
Takes either a module name, list of module ... | lib/elixir_script/compiler.ex | 0.822474 | 0.436562 | compiler.ex | starcoder |
defmodule Scenic.Primitive.Sprites do
@moduledoc """
Draw one or more sprites from a single source image.
## Overview
The term "sprite" means one or more subsections of a larger image
that get rendered to the screen. You can do many things with sprites
including animations and zooming in and out of an im... | lib/scenic/primitive/sprites.ex | 0.937712 | 0.90205 | sprites.ex | starcoder |
defmodule Akd.Fetch.Scp do
@moduledoc """
A native Hook module that comes shipped with Akd.
This module uses `Akd.Hook`.
Provides a set of operations that fetch source code using `scp` from a given
source to a destination.
Ensures to cleanup and empty the desination directory. (Doesn't run this by
defa... | lib/akd/base/fetch/scp.ex | 0.866486 | 0.630201 | scp.ex | starcoder |
defmodule CasAgent do
@moduledoc """
Implement Compare and Set using an ETS table to solve read concurrency
and an Agent to control write concurrency (the actual CAS).
"""
@doc """
Start the ETS table and the Agent before anything
"""
def start do
:ets.new(:CAS_table, [:public,:set,:named_ta... | lib/cas_agent.ex | 0.856677 | 0.801354 | cas_agent.ex | starcoder |
defmodule JsonapiPaginator do
@moduledoc """
Simple pagination links renderer for the JSON API
"""
@doc """
Render links based on the data, given in params map
```
%{
base_url: base_url,
page_number: page_number,
page_size: page_size,
total_pages: total_page... | lib/jsonapi_paginator.ex | 0.715424 | 0.421998 | jsonapi_paginator.ex | starcoder |
defmodule ScatterSwap.Scatterer do
@moduledoc """
Functions for rearranging the order of each digit in a reversable way. Uses
the sum of the digits in the passed list (which doesn't change regardless of
their order) as a key to record how they were scattered.
"""
use Bitwise
alias ScatterSwap.Util
@... | lib/scatter_swap/scatterer.ex | 0.774498 | 0.637186 | scatterer.ex | starcoder |
defmodule Ports.Rumble.Board.Overlaps do
alias Ports.Rumble.Tile
alias Ports.Rumble.Board.Common
@fix_overlap_precision 30
def fix_overlap_precision(), do: @fix_overlap_precision
@spec overlaps_any(number(), number(), %{any() => Tile.t()}) :: any()
def overlaps_any(x, y, tiles) do
Enum.reduce_while(Ma... | harbor/lib/ports/rumble/board/overlaps.ex | 0.632843 | 0.480905 | overlaps.ex | starcoder |
defmodule Chankins.Generator do
@moduledoc """
Generator is used to render templete files and dynamic data with different render engines based on file extensions.
Even multiple rendering runs are supported. For a file like "layout.md.eex" the EExEngine is used in the first run and
the MarkdownEngine in a ... | lib/chankins/generator/generator.ex | 0.653127 | 0.59408 | generator.ex | starcoder |
defmodule RdbParser.RedisList do
@moduledoc false
alias RdbParser.RedisString
# Encodings for ziplist members. This is a single byte that determines how the
# length is encoded in the following bytes.
@enc_8 254
@enc_16 192
@enc_24 240
@enc_32 208
@enc_64 224
# @eof 255
@doc """
Returns {list... | lib/rdb_parser/redis_list.ex | 0.744471 | 0.436382 | redis_list.ex | starcoder |
defmodule Kl.Reader do
require IEx
def tokenise(expr) do
expr
|> String.replace(~r/([\(\)])/, " \\1 ") # NOTE: replaces also "(", ")" inside strings
|> split
end
def split(expr) do
Enum.reduce(
String.split(expr, ~r/("[^"]*")/, include_captures: true),
[],
fn(s, acc) ->
... | lib/reader.ex | 0.535584 | 0.4099 | reader.ex | starcoder |
defmodule Vapor.Provider.Dotenv do
@moduledoc """
The dotenv config provider will look for a `.env` file and load all of
the values for that file. The values can be written like so:
```
DATABASE_URL=https://localhost:9432
PORT=4000
REDIS_HOST=1234
```
Multiline variables can be written using bash-st... | lib/vapor/providers/dotenv.ex | 0.799521 | 0.781997 | dotenv.ex | starcoder |
defmodule Annex.Layer.Activation do
@moduledoc """
The Activation layer is the Annex.Layer that is responsible for
applying an activation function to the data during the feedforward
and supplying the gradient function (derivative) of the activation
function to the Backprops during backpropagation.
"""
use... | lib/annex/layer/activation.ex | 0.894812 | 0.621756 | activation.ex | starcoder |
defmodule Example.IdSpecs do
alias Example.{User, Post, Comment}
alias Grax.Id
import ExUnit.Assertions
defmodule FlatNs do
use Grax.Id.Spec
namespace "http://example.com/", prefix: :ex do
end
end
defmodule FlatNsWithVocabTerms do
use Grax.Id.Spec
alias Example.NS.EX
namespace ... | test/support/example_id_specs.ex | 0.789842 | 0.583352 | example_id_specs.ex | starcoder |
defmodule Currencyconverter.Transaction do
@moduledoc """
The Transaction context.
"""
import Ecto.Query, warn: false
alias Currencyconverter.Repo
alias Currencyconverter.Transaction.Transactions
@doc """
Returns the list of transactions.
## Examples
iex> list_transactions()
[%Transac... | lib/currencyconverter/transactions.ex | 0.913729 | 0.412116 | transactions.ex | starcoder |
defmodule Edeliver.Relup.Instruction do
@moduledoc """
This behaviour can be used to provide custom instructions to modify the relup.
They can be used in the implementations of
of the `Edeliver.Relup.Modifcation` behaviour.
Example:
defmodule Acme.Relup.LogUpgradeInstruction do
use Ed... | lib/edeliver/relup/instruction.ex | 0.847227 | 0.451568 | instruction.ex | starcoder |
defmodule Xgit.Repository.Plumbing do
@moduledoc ~S"""
Implements the "plumbing"-level commands for a git repository.
The functions in this module, like the "plumbing" commands in command-line
git, are typically not of interest to an end-user developer. Instead, these
are the raw building-block operations th... | lib/xgit/repository/plumbing.ex | 0.885841 | 0.469703 | plumbing.ex | starcoder |
defmodule Redex.Protocol.Parser do
import NimbleParsec
import Injector
inject Redex.Protocol
alias Redex.Protocol.State
@callback parse(State.t()) :: {:ok, [binary], State.t()} | {:error, any}
crlf = string("\r\n")
empty_bulk_string = string("$0\r\n\r\n") |> replace("")
short_bulk_strings =
for... | lib/redex/protocol/parser.ex | 0.536313 | 0.430477 | parser.ex | starcoder |
defmodule AdventOfCode.Day08 do
@moduledoc false
use AdventOfCode
def part1(input) do
preprocess_input(input)
|> Enum.map(&Enum.at(&1, 1))
|> List.flatten()
|> Enum.map(&String.length/1)
|> Enum.frequencies()
|> Enum.filter(&Enum.member?([2, 3, 4, 7], elem(&1, 0)))
|> Enum.map(&elem(&... | lib/day08.ex | 0.682785 | 0.452294 | day08.ex | starcoder |
defmodule OMG.Watcher.ExitProcessor.Request do
@moduledoc """
Encapsulates the state of processing of `OMG.Watcher.ExitProcessor` pipelines
Holds all the necessary query date and the respective response
NOTE: this is highly experimental, to test out new patterns to follow when doing the Functional Core vs Im... | apps/omg_watcher/lib/omg_watcher/exit_processor/request.ex | 0.72662 | 0.421671 | request.ex | starcoder |
defmodule Blockchain.Blocktree do
@moduledoc """
Blocktree provides functions for adding blocks to the
overall blocktree and forming a consistent blockchain.
"""
defmodule InvalidBlockError do
defexception [:message]
end
alias Blockchain.{Block, Chain}
defstruct best_block: nil
@type t :: %__MO... | apps/blockchain/lib/blockchain/blocktree.ex | 0.83929 | 0.567487 | blocktree.ex | starcoder |
defmodule EctoFlaggableEnum do
@moduledoc """
Provides `defenumf/2` macro for defining an Flaggable Enum Ecto type.
"""
@doc """
Defines an enum custom `Ecto.Type`.
It can be used like any other `Ecto.Type` by passing it to a field in your model's
schema block. For example:
import EctoFlaggableEn... | lib/ecto_flaggable_enum.ex | 0.824462 | 0.527621 | ecto_flaggable_enum.ex | starcoder |
defmodule NcsaHmac.Authentication do
alias NcsaHmac.PlugConnSigner
@authorization_regexp ~r/\w+ ([^:]+):(.+)$/
@accepted_algorithms [:sha512, :sha384, :sha256]
@moduledoc """
The Authentication module provides functions for validating an HMAC signature on a web request.
"""
@doc """
Authenticate the h... | lib/ncsa_hmac/authentication.ex | 0.763175 | 0.621728 | authentication.ex | starcoder |
defmodule Exbee.TxResultFrame do
@moduledoc """
Received upon completion of a `Exbee.TxFrame` or `Exbee.ExplicitTxFrame`. The
`:status` attribute indicates whether the transmission was successful.
Possible status values include:
* `:ok` (`0x00`)
* `:mac_ack_failure` (`0x01`)
* `:cca_failure` (`0x0... | lib/exbee/frames/tx_result_frame.ex | 0.816589 | 0.431464 | tx_result_frame.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.