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 Tox.Period do
@moduledoc """
A `Period` struct and functions.
The Period struct contains the fields `year`, `month`, `week`, `day`, `hour`,
`minute` and second. The values for the fields represent the amount of time
for a unit. Expected `second`, all values are integers equal or greater than
`0`.... | lib/tox/period.ex | 0.952959 | 0.789883 | period.ex | starcoder |
defmodule Data.Events do
@moduledoc """
Eventing layer
An event looks like this:
```json
{
"type": "room/entered",
"actions": [
{
"type": "communications/emote",
"delay": 0.5,
"options": {
"message": "[name] glances up from reading his paper",
}
... | lib/data/events.ex | 0.74055 | 0.701968 | events.ex | starcoder |
defmodule Model.Transfer do
@moduledoc """
Transfer specifies additional rules and overrides for a transfer. See
[GTFS `transfers.txt`](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#transferstxt)
"""
use Recordable, [
:from_stop_id,
:to_stop_id,
:transfer_type,
:m... | apps/model/lib/model/transfer.ex | 0.928595 | 0.664506 | transfer.ex | starcoder |
defmodule Bintreeviz.Positioner.WS do
@moduledoc """
Module to do the positioning following the WS algorithm. As described in the original paper,
this algorithm works with two loops to keep the algorithm performing in O(N).
"""
@behaviour Bintreeviz.Positioner
# internal struct to keep track of positioning... | lib/positioner/ws.ex | 0.886282 | 0.670622 | ws.ex | starcoder |
defmodule ExYarn do
@moduledoc """
ExYarn is a small library for parsing [Yarn](https://yarnpkg.com/) lockfiles in Elixir. Only the version 1 of Yarn
lockfiles is currently supported.
The library allows you to parse either to a plain Elixir map, or to a utility type, `ExYarn.Lockfile`, which makes
manipulati... | lib/ex_yarn.ex | 0.751739 | 0.480479 | ex_yarn.ex | starcoder |
defmodule PowerControl do
@moduledoc """
`PowerControl` is a library that enables runtime configuration of embedded linux for power conservation or performance via native elixir.
## Getting Started
If using `shoehorn`, add `:power_control` to your shoehorn apps in your `config.exs`:
```elixir
config :sho... | lib/power_control.ex | 0.916025 | 0.82251 | power_control.ex | starcoder |
defmodule Hui.Http do
@moduledoc """
A behaviour module for handling HTTP requests and responses.
This module is responsible for dispatching Solr request encapsulated in `t:Hui.Http.t/0` struct.
It underpins the core functions of `Hui`, as well as provides default implementation and
built-in HTTP client capa... | lib/hui/http.ex | 0.903387 | 0.785802 | http.ex | starcoder |
defmodule Day25 do
def part1(input) do
{:ok, [machine], "", _, _, _} = TuringParser.turing(input)
compiled_machine = TuringCompiler.compile(machine)
compiled_machine.run()
end
end
defmodule TuringCompiler do
def compile({initial_state, steps, actions}) do
ast = compile(initial_state, steps, actio... | day25/lib/day25.ex | 0.596081 | 0.68854 | day25.ex | starcoder |
defmodule EView.Renders.Root do
@moduledoc """
This module converts map to a structure that corresponds
to [Nebo #15 API Manifest](http://docs.apimanifest.apiary.io/) response structure.
"""
alias EView.Renders.{Meta, Error}
@doc """
Render response object or error description following to our guidelines... | lib/eview/renders/root_render.ex | 0.786377 | 0.487856 | root_render.ex | starcoder |
defmodule ExUnit.CaptureIO do
@moduledoc ~S"""
Functionality to capture IO for testing.
## Examples
defmodule AssertionTest do
use ExUnit.Case
import ExUnit.CaptureIO
test "example" do
assert capture_io(fn -> IO.puts("a") end) == "a\n"
end
test "another... | lib/ex_unit/lib/ex_unit/capture_io.ex | 0.918895 | 0.789518 | capture_io.ex | starcoder |
defmodule Etl do
require Logger
@type stage :: Supervisor.child_spec() | {module(), arg :: term()} | module() | Etl.Stage.t()
@type dictionary :: term()
@type t :: %__MODULE__{
stages: [Etl.stage()],
pids: [pid],
subscriptions: [GenStage.subscription_tag()]
}
defstruct ... | lib/etl.ex | 0.756042 | 0.420659 | etl.ex | starcoder |
defmodule PathGlob do
@moduledoc """
Implements glob matching using the same semantics as `Path.wildcard/2`, but
without any filesystem interaction.
"""
import PathGlob.Parser
import NimbleParsec, only: [defparsecp: 3]
if System.version() >= "1.11" && Code.ensure_loaded?(Mix) && Mix.env() == :test do
... | lib/path_glob.ex | 0.846133 | 0.481576 | path_glob.ex | starcoder |
defmodule Sanbase.Signal.Validation.Target do
def valid_target?("default"), do: :ok
def valid_target?(%{user_list: int}) when is_integer(int), do: :ok
def valid_target?(%{watchlist_id: int}) when is_integer(int), do: :ok
def valid_target?(%{text: text}) when is_binary(text), do: :ok
def valid_target?(%{wor... | lib/sanbase/signals/trigger/validation/target_validation.ex | 0.667581 | 0.414217 | target_validation.ex | starcoder |
defmodule TextDelta.Document do
@moduledoc """
Document-related logic like splitting it into lines etc.
"""
alias TextDelta.Operation
@typedoc """
Reason for an error.
"""
@type error_reason :: :bad_document
@typedoc """
Line segments.
Each line has a delta of the content on that line (minus `... | lib/text_delta/document.ex | 0.873929 | 0.510985 | document.ex | starcoder |
defmodule GenMagic.Server do
@moduledoc """
Provides access to the underlying libmagic client, which performs file introspection.
The Server needs to be supervised, since it will terminate if it receives any unexpected error.
"""
@behaviour :gen_statem
alias GenMagic.Result
alias GenMagic.Server.Data
... | lib/gen_magic/server.ex | 0.857917 | 0.510313 | server.ex | starcoder |
defmodule Minio.Helper do
@doc "HMAC-SHA256 hash computation helper"
def hmac(key, data),
do: :crypto.mac(:hmac,:sha256, key, data)
@doc "SHA256 hash computation helper"
def sha256(data),
do: :crypto.hash(:sha256, data)
@doc "encode data into hex code"
def hex_digest(data),
do: Base.encode16(... | lib/minio/helper.ex | 0.726814 | 0.433682 | helper.ex | starcoder |
defmodule Engine.Fee.Fetcher.Updater do
@moduledoc """
Decides whether fees will be updated from the fetched fees from the feed.
"""
alias Engine.Fee
alias Engine.Fee.Fetcher.Updater.Merger
@type can_update_result_t :: {:ok, Fee.full_fee_t()} | :no_changes
# Internal data structure resulted from merge ... | apps/engine/lib/engine/fee/fetcher/updater.ex | 0.869894 | 0.433742 | updater.ex | starcoder |
defmodule Openmaize.Config do
@moduledoc """
This module provides an abstraction layer for configuration.
The following are valid configuration items.
| name | type | default |
| :----------------- | :----------- | ---------------: |
| crypto_mod | module |... | lib/openmaize/config.ex | 0.791861 | 0.62395 | config.ex | starcoder |
defmodule Pie.State do
@moduledoc """
Pipeline state handling.
- At any given moment the state can be evaluated to extract a result
- An invalid pipeline can not be updated
"""
defstruct valid?: true,
track_updates?: false,
update_count: 0,
updates: [],
initi... | lib/pie/state.ex | 0.888671 | 0.528716 | state.ex | starcoder |
defmodule File.Stream do
@moduledoc """
Defines a `File.Stream` struct returned by `File.stream!/3`.
The following fields are public:
* `path` - the file path
* `modes` - the file modes
* `raw` - a boolean indicating if bin functions should be used
* `line_or_bytes` - ... | lib/elixir/lib/file/stream.ex | 0.83056 | 0.465934 | stream.ex | starcoder |
defmodule Kino do
@moduledoc """
Client-driven interactive widgets for Livebook.
Kino is the library used by Livebook to render rich and interactive
output directly from your Elixir code.
Kino renders any data structure that implements the `Kino.Render`
protocol, falling back to the `inspect/2` representa... | lib/kino.ex | 0.876251 | 0.830663 | kino.ex | starcoder |
defmodule AWS.Directory do
@moduledoc """
AWS Directory Service
AWS Directory Service is a web service that makes it easy for you to setup and
run directories in the AWS cloud, or connect your AWS resources with an existing
on-premises Microsoft Active Directory.
This guide provides detailed information ... | lib/aws/generated/directory.ex | 0.857753 | 0.434161 | directory.ex | starcoder |
defmodule AdaptableCostsEvaluatorWeb.ComputationController do
use AdaptableCostsEvaluatorWeb, :controller
use OpenApiSpex.ControllerSpecs
import AdaptableCostsEvaluatorWeb.Helpers.AuthHelper, only: [current_user: 1]
alias AdaptableCostsEvaluator.Computations
alias AdaptableCostsEvaluator.Computations.Comput... | lib/adaptable_costs_evaluator_web/controllers/computation_controller.ex | 0.776199 | 0.403067 | computation_controller.ex | starcoder |
defmodule AWS.Macie do
@moduledoc """
Amazon Macie Classic
Amazon Macie Classic has been discontinued and is no longer available.
A new Amazon Macie is now available with significant design improvements and
additional features, at a lower price and in most Amazon Web Services Regions.
We encourage you to... | lib/aws/generated/macie.ex | 0.74382 | 0.410136 | macie.ex | starcoder |
defmodule Iyzico.Inquiry do
@moduledoc false
@doc false
defstruct [ :bin, :conversation_id, :price, :currency ]
@type currency :: :try
@type t :: %__MODULE__{
bin: binary,
conversation_id: binary,
price: number,
currency: currency
}
end
defimpl Iyzico.IOListConvertible, for: Iyzico.Inqui... | lib/endpoint/bin_inquiry.ex | 0.775009 | 0.717136 | bin_inquiry.ex | starcoder |
defmodule RDF.Triple do
@moduledoc """
Helper functions for RDF triples.
An RDF Triple is represented as a plain Elixir tuple consisting of three valid
RDF values for subject, predicate and object.
"""
alias RDF.{Statement, PropertyMap}
@type t :: {Statement.subject(), Statement.predicate(), Statement.... | lib/rdf/triple.ex | 0.870865 | 0.71039 | triple.ex | starcoder |
defmodule DataMatrix.MappingMatrix do
@moduledoc false
@size Code.eval_file("lib/datamatrix/static/mapping_matrix_size.tuple") |> elem(0)
@doc """
"""
def get_mapping_matrix(version) do
{nrow, ncol} = elem(@size, version)
{mapping, _} =
generate_placement_path(nrow, ncol)
|> Enum.flat_... | lib/datamatrix/mapping_matrix.ex | 0.641535 | 0.609466 | mapping_matrix.ex | starcoder |
defmodule Plymio.Option.Utility do
@moduledoc ~S"""
Utility Function for Managing (Keyword) Options ("opts")
## Documentation Terms
In the documentation there are terms, usually in *italics*, used to mean the same thing (e.g. *opts*).
### opts
*opts* is a `Keyword`.
### derivable opts
*derivable ... | lib/option/utility.ex | 0.867401 | 0.683736 | utility.ex | starcoder |
defmodule ExRtmidi.Input do
@moduledoc """
Contains methods that initialize and interface with input ports.
Things of note:
- init/1 should not be called frequently. Ideally, it should be called once at app boot (see comments)
- If you add a listener, do so before opening the port (per RtMidi C++ docs)
- L... | lib/ex_rtmidi/input.ex | 0.532911 | 0.42173 | input.ex | starcoder |
defmodule Cadet.Assessments.Query do
@moduledoc """
Generate queries related to the Assessments context
"""
import Ecto.Query
alias Cadet.Assessments.{Answer, Assessment, Question, Submission}
@doc """
Returns a query with the following bindings:
[submissions_with_xp_and_grade, answers]
"""
@spec ... | lib/cadet/assessments/query.ex | 0.833697 | 0.466724 | query.ex | starcoder |
defmodule Livebook.Notebook.Explore.Utils do
@moduledoc false
@doc """
Defines a module attribute `attr` with notebook info.
"""
defmacro defnotebook(attr, props) do
quote bind_quoted: [attr: attr, props: props] do
{path, notebook_info} = Livebook.Notebook.Explore.Utils.fetch_notebook!(attr, props)... | lib/livebook/notebook/explore.ex | 0.860296 | 0.610279 | explore.ex | starcoder |
defmodule Geometrics.OpenTelemetry.Logger do
@moduledoc """
Capture crashes and exits with open spans. This helps to capture problems where a
system is overloaded or under-optimized, and timeouts occur. Timeout errors (in Ecto,
or when `call`ing into GenServers) typically trigger `exit` instead of raising excep... | lib/geometrics/open_telemetry/logger.ex | 0.847005 | 0.487612 | logger.ex | starcoder |
defmodule DBConnection.Sojourn do
@moduledoc """
A `DBConnection.Pool` using sbroker.
### Options
* `:pool_size` - The number of connections (default: `10`)
* `:broker` - The sbroker callback module (see `:sbroker`,
default: `DBConnection.Sojourn.Timeout`)
* `:broker_start_opts` - Start options ... | throwaway/hello/deps/db_connection/lib/db_connection/sojourn.ex | 0.838647 | 0.444565 | sojourn.ex | starcoder |
defmodule Quark.Compose do
@moduledoc ~S"""
Function composition is taking two functions, and joining them together to
create a new function. For example:
## Examples
iex> sum_plus_one = compose([&(&1 + 1), &Enum.sum/1])
...> sum_plus_one.([1,2,3])
7
In this case, we have joined `Enum.sum... | lib/quark/compose.ex | 0.871174 | 0.685555 | compose.ex | starcoder |
defmodule BSV.VarInt do
@moduledoc """
A VarInt is an integer encoded as a variable length binary value. It is a
format used throughout Bitcoin to represent the length of binary data in a
compact form.
"""
alias BSV.Serializable
@max_int64 18_446_744_073_709_551_615
@typedoc "VarInt binary"
@type t(... | lib/bsv/var_int.ex | 0.894942 | 0.600452 | var_int.ex | starcoder |
defmodule Ecto.Schema do
@moduledoc ~S"""
Defines a schema for a model.
A schema is a struct with associated metadata that is persisted to a
repository. Every schema model is also a struct, that means that you work
with models just like you would work with structs.
## Example
defmodule User do
... | lib/ecto/schema.ex | 0.907967 | 0.666388 | schema.ex | starcoder |
defmodule GuardianJwks.SecretFetcher do
@moduledoc """
An implementation of `Guardian.Token.Jwt.SecretFetcher` for reading public JWKS URLs.
This secret fetcher is intended to be used when you are _verifying_ a token is signed with
a well known public key. It only implements the `before_verify/2` callback prov... | lib/guardian_jwks/secret_fetcher.ex | 0.836955 | 0.494202 | secret_fetcher.ex | starcoder |
defmodule Path do
@moduledoc """
This module provides conveniences for manipulating or
retrieving file system paths.
The functions in this module may receive a char list or
a binary as argument and will return a value of the same
type.
The majority of the functions in this module do not
interact with ... | lib/elixir/lib/path.ex | 0.78899 | 0.475423 | path.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule Guardian.Plug.EnsureAuthenticated do
@moduledoc """
This plug ensures that a valid token was provided and has been verified on the request.
If one is not found, the `auth_error` will be called with `:unauthenticated`
This, like all other Guardian plugs, requ... | lib/guardian/plug/ensure_authenticated.ex | 0.852552 | 0.821403 | ensure_authenticated.ex | starcoder |
defmodule PipeHelpers do
@moduledoc """
Helper for piping data
"""
@doc """
Wrap into ok tuple
## Example
iex> socket = "socket"
...> socket |> ok()
{:ok, "socket"}
"""
def ok(val) do
{:ok, val}
end
@doc """
Wrap into noreply tuple (genserver and phoenix socket format)
... | lib/pipe_helpers.ex | 0.806738 | 0.406361 | pipe_helpers.ex | starcoder |
defmodule Game do
@enforce_keys [:players, :turns, :last_player, :token_length]
defstruct @enforce_keys
@board_bound 0..2
def new_game(%Player{token: player_one_token} = player_one,
%Player{token: player_two_token} = player_two,
token_length) do
%Game{players: %{player_one: playe... | lib/game.ex | 0.625667 | 0.625138 | game.ex | starcoder |
defmodule Stripe.InvoiceItem do
@moduledoc """
## Attributes
- `id` - `String`
- `object` - `String`, value is "invoiceitem"
- `livemode` - `Boolean`
- `amount` - `Integer`
- `currency` - `String`
- `customer` - `String`
- `date` - `Tuple`
- `proration` - `Boolean` - Whether or not the invoice ite... | lib/stripe/invoice_item.ex | 0.79546 | 0.40248 | invoice_item.ex | starcoder |
defmodule Mutiny do
@moduledoc """
Functions for generating database commands that enforce immutability.
"""
alias Ecto.Migration.Table
alias Mutiny.Adapter
@doc """
Injects shorthand Mutiny functions that implicitly pass the specified
`adapter`. These functions include:
* `protect/1` - Makes a tab... | lib/mutiny.ex | 0.889117 | 0.469642 | mutiny.ex | starcoder |
defmodule CobolToElixirCase do
import ExUnit.CaptureIO
alias CobolToElixir.Util
require ExUnit.Assertions
require Logger
defmacro __using__([]) do
quote do
use ExUnit.Case
import CobolToElixirCase
end
end
@doc """
Compiles the cobol code and ensures there are no errors/warnings
... | test/support/cobol_to_elixir_case.ex | 0.532911 | 0.514217 | cobol_to_elixir_case.ex | starcoder |
defmodule RecoverableStream do
@moduledoc """
By extracting evaluation of the source stream into a separate process
`RecoverableStream` provides a way to isolate upstream errors
and recover from them.
This module contains public API.
"""
defmodule TasksPool do
@moduledoc """
A default `Supervis... | lib/recoverable_stream.ex | 0.854551 | 0.592784 | recoverable_stream.ex | starcoder |
defmodule Composer.AST do
@moduledoc """
Converts the custom AST into elixir AST
"""
@doc """
Converts the custom AST into elixir AST
## Example
iex> Composer.AST.do_convert({ :+, [ 10, 20 ] })
{:+, [context: Composer.AST, import: Kernel], [ 10, 20 ]}
"""
def do_convert({ :block, args }) do
... | apps/composer/lib/ast.ex | 0.711331 | 0.595669 | ast.ex | starcoder |
defmodule FalconPlusApi.Api.Nodata do
alias Maxwell.Conn
alias FalconPlusApi.{Util, Sig, Api}
@doc """
* [Session](#/authentication) Required
### Request
```{
"tags": "",
"step": 60,
"obj_type": "host",
"obj": "docker-agent",
"name": "testnodata",
"mock": ... | lib/falcon_plus_api/api/nodata.ex | 0.539711 | 0.716814 | nodata.ex | starcoder |
defmodule Bunch.Access do
@moduledoc """
A bunch of functions for easier manipulation on terms of types implementing `Access`
behaviour.
"""
import Kernel, except: [get_in: 2, put_in: 2, update_in: 3, get_and_update_in: 3, pop_in: 2]
use Bunch
@compile {:inline, map_keys: 1}
@gen_common_docs fn fun_na... | lib/bunch/access.ex | 0.816882 | 0.450541 | access.ex | starcoder |
defmodule AlertProcessor.ExtendedTime do
@moduledoc """
ExtendedTime is for saving schedule-related times while accounting for fact that a "day" of a schedule stretches into the next actual day. I.E. a trip that leaves at 11:30pm on Jan 1 and another that leaves at 12:30am on Jan 2 are both counted as part of the J... | apps/alert_processor/lib/extended_time.ex | 0.91985 | 0.654574 | extended_time.ex | starcoder |
defmodule Mix.Local.Installer do
@moduledoc """
This module implements pieces of functionality shared by the archive- and escript-related
tasks.
"""
@doc """
Checks that the argument given to install is supported by the respective module.
"""
@callback check_path_or_url(String.t) :: :ok | {:error, Stri... | lib/mix/lib/mix/local/installer.ex | 0.730963 | 0.417687 | installer.ex | starcoder |
defmodule Astarte.Core.Mapping.ValueType do
@behaviour Ecto.Type
@mapping_value_type_double 1
@mapping_value_type_doublearray 2
@mapping_value_type_integer 3
@mapping_value_type_integerarray 4
@mapping_value_type_longinteger 5
@mapping_value_type_longintegerarray 6
@mapping_value_type_string 7
@mapp... | lib/astarte_core/mapping/value_type.ex | 0.758063 | 0.578418 | value_type.ex | starcoder |
defmodule HT16K33 do
@moduledoc """
API for working with HT16K33 14-segment display backpacks
"""
use Bitwise
alias Circuits.I2C
@type backpack_state :: %{
ref: I2C.bus(),
addr: integer
}
@i2c_code "i2c-1"
# Default address for HT16K33 - up to 0x77
@addr 0x70
@doc """
... | lib/hT16K33.ex | 0.858748 | 0.444324 | hT16K33.ex | starcoder |
defimpl Timex.Protocol, for: NaiveDateTime do
@moduledoc """
This module implements Timex functionality for NaiveDateTime
"""
alias Timex.AmbiguousDateTime
import Timex.Macros
@epoch_seconds :calendar.datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}})
def now(), do: NaiveDateTime.utc_now()
def ... | lib/datetime/naivedatetime.ex | 0.773901 | 0.625838 | naivedatetime.ex | starcoder |
defmodule AWS.Polly do
@moduledoc """
Amazon Polly is a web service that makes it easy to synthesize speech from
text.
The Amazon Polly service provides API operations for synthesizing
high-quality speech from plain text and Speech Synthesis Markup Language
(SSML), along with managing pronunciations lexic... | lib/aws/polly.ex | 0.864811 | 0.415077 | polly.ex | starcoder |
defmodule Credo.Code.Scope do
@moduledoc """
This module provides helper functions to determine the scope name at a certain
point in the analysed code.
"""
alias Credo.Code.Block
alias Credo.Code.Module
@def_ops [:def, :defp, :defmacro]
def mod_name(nil), do: nil
def mod_name(scope_name) do
na... | lib/credo/code/scope.ex | 0.605916 | 0.423279 | scope.ex | starcoder |
defmodule Exenv do
@moduledoc """
Loads env vars using an adapter-based approach.
Exenv dynamically assigns env vars on application start using whatever adapters
have been configured to run. By default, Exenv is setup to use the included
`Exenv.Adapters.Dotenv` adapter - loading env vars from a `.env` file i... | lib/exenv.ex | 0.873889 | 0.612527 | exenv.ex | starcoder |
defmodule Grizzly.ZWave.Commands.NetworkManagementMultiChannelEndPointReport do
@moduledoc """
Command use to advertise the number of Multi Channel End Points
Params:
* `:seq_number` - the sequence number for this command
* `:node_id` - the node id in question
* `:individual_end_points` - the number of in... | lib/grizzly/zwave/commands/network_management_multi_channel_end_point_report.ex | 0.889742 | 0.50653 | network_management_multi_channel_end_point_report.ex | starcoder |
defmodule Puid.Entropy do
@moduledoc """
[Entropy](https://en.wikipedia.org/wiki/Entropy_(information_theory)) related calculations
The implementation is based on mathematical approximations to the solution of what is often
referred to as the [Birthday
Problem](https://en.wikipedia.org/wiki/Birthday_problem... | lib/puid/entropy.ex | 0.933817 | 0.757884 | entropy.ex | starcoder |
defmodule Hangman.Pass do
@moduledoc """
Module defines types `Pass.key` and `Pass.t`
Returns result of pass runs as distinguished by initial
`:start` or subsequent `:guessing` modes.
Pass data is a group of the pass size, the letter frequency tally,
and relevant data on final word information.
Given ... | lib/hangman/pass.ex | 0.880116 | 0.836955 | pass.ex | starcoder |
defmodule FloUI.Scrollable.ScrollBar do
@moduledoc """
Scroll bars are meant to be used within the Scrollable.Container component, but you can use them to build your own scrollable containers.
The following events are emitted.
``` elixir
{:register_scroll_bar, direction, scroll_bar_state}
{:update_scroll_... | lib/scrollable/scroll_bar.ex | 0.88311 | 0.6735 | scroll_bar.ex | starcoder |
defmodule Jerboa.Params do
@moduledoc """
Data structure representing STUN message parameters
"""
alias Jerboa.Format.Header.Type.{Class, Method}
alias Jerboa.Format.Body.Attribute
defstruct [:class, :method, :identifier, attributes: [],
signed?: false, verified?: false]
@typedoc """
The... | lib/jerboa/params.ex | 0.86267 | 0.52141 | params.ex | starcoder |
defmodule Ash do
@moduledoc """
Ash Framework

## ALPHA NOTICE
Ash is in alpha. The package version is 1.0.0+, and most of the time that means stable, but in this case it _does not_. The 2.0 release will be the sta... | lib/ash.ex | 0.864081 | 0.854156 | ash.ex | starcoder |
defmodule AWS.SSM do
@moduledoc """
AWS Systems Manager
AWS Systems Manager is a collection of capabilities that helps you automate
management tasks such as collecting system inventory, applying operating
system (OS) patches, automating the creation of Amazon Machine Images
(AMIs), and configuring operati... | lib/aws/generated/ssm.ex | 0.880361 | 0.643329 | ssm.ex | starcoder |
defmodule HAP.ValueStore do
@moduledoc """
Defines the behaviour required of a module that wishes to act as the backing data store
for a given HomeKit characteristic
# Simple Value Store
To implement a value store for a simple value whose value does not change asynchronously,
you must implement the `c:get... | lib/hap/value_store.ex | 0.915167 | 0.80651 | value_store.ex | starcoder |
defmodule ClusterEC2.Strategy.Tags do
@moduledoc """
This clustering strategy works by loading all instances that have the given
tag associated with them.
All instances must be started with the same app name and have security groups
configured to allow inter-node communication.
config :libcluster,
... | lib/strategy/tags.ex | 0.851351 | 0.547283 | tags.ex | starcoder |
defmodule Magpie.InteractiveRoomChannel do
@moduledoc """
Channel for maintaining lobbies in interactive experiments which require multiple participants to with each other.
The client should make use of the presence_diff event to decide if a game can be started.
"""
use MagpieWeb, :channel
alias Magpie.Ex... | lib/magpie_web/channels/interactive_room_channel.ex | 0.656328 | 0.412057 | interactive_room_channel.ex | starcoder |
use Croma
defmodule Antikythera.Memcache do
@moduledoc """
Easy-to-use in-memory cache for each executor pool.
#{inspect(__MODULE__)} behaves as a key-value storage.
Cached key-value pairs are internally stored in ETS.
It accepts arbitrary (but not too large) terms as both keys and values.
## Usage
... | lib/util/memcache.ex | 0.81283 | 0.51812 | memcache.ex | starcoder |
defmodule BitcoinSimulator.BitcoinCore do
alias BitcoinSimulator.BitcoinCore.{Blockchain, Mining, Network, RawTransaction, Wallet}
# Block Chain
def newBlockchain, do: Blockchain.newBlockchain()
def hashOfBestBlock(blockchain), do: Blockchain.hashOfBestBlock(blockchain)
def hashBlockheader(header), do: B... | lib/APIsimulator/coreApp.ex | 0.686265 | 0.529081 | coreApp.ex | starcoder |
defmodule Twirp.Plug do
@moduledoc """
Provides a plug that takes service and handler module. If the request is
directed at the "twirp" endpoint then the plug will intercept the conn and
process it. Otherwise it allows the conn to pass through. This is a deviation
from the twirp specification but it allows us... | lib/twirp/plug.ex | 0.666497 | 0.638046 | plug.ex | starcoder |
defmodule Phoenix.PubSub.Local do
@moduledoc """
PubSub implementation for handling local-node process groups.
This module is used by Phoenix pubsub adapters to handle
their local node subscriptions and it is usually not accessed
directly. See `Phoenix.PubSub.PG2` for an example integration.
"""
use Gen... | lib/phoenix/pubsub/local.ex | 0.771542 | 0.408159 | local.ex | starcoder |
defmodule Day2 do
@doc """
This will calculate the wrapping paper needed for presents.
## Examples
iex> Day2.main("2x3x4")
58
iex> Day2.main("1x1x10")
43
"""
def main(input) do
input
|> strip_whitespace
|> get_measurements([])
|> get_total_square_footage(0)
end
@doc """
This will calc... | advent2015/lib/day2.ex | 0.61115 | 0.499573 | day2.ex | starcoder |
defmodule <%= components_module %>.Icon do
use <%= web_module %>, :component
@moduledoc ~S"""
## icons
The `<.icons name="..." />` component is an adapter function to easily use other
icon packages within heex.
the `icons/0` function is only used for the catalog.
## icon default type
The icon defau... | priv/templates/gen.components/components/icon.ex | 0.745213 | 0.736969 | icon.ex | starcoder |
defmodule JaSerializer.EctoErrorSerializer do
alias JaSerializer.Formatter.Utils
@moduledoc """
The EctoErrorSerializer is used to transform Ecto changeset errors to JSON API standard
error objects.
If a changeset is past in without optional error members then the object returned will
only contain: sourc... | lib/ja_serializer/ecto_error_serializer.ex | 0.811377 | 0.713307 | ecto_error_serializer.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 assert and refute receive timeouts are one second.
You can override the default timeout in config (e.g. `config/test.exs`):
... | lib/commanded/assertions/event_assertions.ex | 0.903715 | 0.743494 | event_assertions.ex | starcoder |
defmodule Benchee.Scenario do
@moduledoc """
Core data structure representing one particular case (combination of function and input).
Represents the combination of a particular function to benchmark (also called "job" defined
by `job_name` and `function`) in combination with a specific input (`input_name` and... | lib/benchee/scenario.ex | 0.883494 | 0.831964 | scenario.ex | starcoder |
defmodule Distillery.Releases.Appup.Transform do
@moduledoc """
A transform is an appup compilation pass which receives a list of appup instructions,
along with metadata about those instructions, such as the source application,
the source and target versions involved, and an optional list of configuration optio... | lib/distillery/releases/appup/transform.ex | 0.905123 | 0.546375 | transform.ex | starcoder |
defmodule ResxJSON.Decoder do
@moduledoc """
Decode JSON string resources into erlang terms.
### Media Types
Only JSON types are valid. This can either be a JSON subtype or suffix.
Valid: `application/json`, `application/geo+json`, `application/json-seq`
If an error is being returne... | lib/resx_json/decoder.ex | 0.915978 | 0.629561 | decoder.ex | starcoder |
defmodule Segments do
defstruct decoder: %{},
encoder: %{},
output: 0
@type t :: %__MODULE__{
decoder: %{MapSet.t() => integer()},
encoder: %{integer() => MapSet.t()},
output: integer()
}
@spec t_m2(String.t())::[MapSet.t]
defp t_m2(input) do
String.split(input)
... | lib/segments.ex | 0.769773 | 0.630557 | segments.ex | starcoder |
defmodule Rig.Config do
@moduledoc """
Rig module configuration that provides `settings/0`.
There are two ways to use this module
### Specify a list of expected keys
```
defmodule Rig.MyExample do
use Rig.Config, [:some_key, :other_key]
end
```
`Rig.Config` expects a config entry similar to th... | lib/rig/config.ex | 0.864925 | 0.798796 | config.ex | starcoder |
defmodule Mnemonex do
use Application
@process :mnx_coder
@moduledoc """
Mnemonex application
"""
@typedoc """
A keyword list with output formatting options
- `name`: registered process name (default: `:mnx_coder`)
- `as_list`: return a list of unformatted words (default: `false`)
- `words_per_... | lib/mnemonex.ex | 0.883179 | 0.471588 | mnemonex.ex | starcoder |
defmodule Data.Event do
@moduledoc """
In game events that NPCs will be listening for
Valid kinds of events:
- "room/entered": When a character enters a room
- "room/heard": When a character hears something in a room
- "combat/tick": What the character will do during combat
"""
import Data.Type
imp... | lib/data/event.ex | 0.848157 | 0.511656 | event.ex | starcoder |
require Utils
require Program
defmodule D9 do
@moduledoc """
--- Day 9: Sensor Boost ---
You've just said goodbye to the rebooted rover and left Mars when you receive a faint distress signal coming from the asteroid belt. It must be the Ceres monitoring station!
In order to lock on to the signal, you'll need ... | lib/days/09.ex | 0.62395 | 0.761937 | 09.ex | starcoder |
defmodule Xgit.Repository.Storage do
@moduledoc ~S"""
Represents the persistent storage for a git repository.
Unless you are implementing an alternative storage architecture or implementing
plumbing-level commands, this module is probably not of interest to you.
## Design Goals
Xgit intends to allow repo... | lib/xgit/repository/storage.ex | 0.898707 | 0.521654 | storage.ex | starcoder |
defmodule TinyColor.RGB do
@moduledoc """
Represents a color in the for of red, green, blue, and optional alpha
"""
import TinyColor.Normalize
defstruct red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0
@doc ~S"""
Returns a string representation of this color. hex is only supported if alpha == 1.0
## Examp... | lib/tiny_color/spaces/rgb.ex | 0.881155 | 0.640313 | rgb.ex | starcoder |
defmodule TicTacToe.Game do
@moduledoc """
The state of a tic tac toe game.
Create a new state with `new_game`. Once a game has been created you
can `query` a position on the board, place new marks on the board or query
whose turn it is. If the game has finished `winner` should return the winning
player, o... | lib/tictactoe/game.ex | 0.897006 | 0.953013 | game.ex | starcoder |
defmodule JOSEUtils.JWKS do
@moduledoc """
Convenience function to work with JWK sets
"""
alias JOSEUtils.{JWA, JWK}
@type t :: [JWK.t()]
@doc """
Filters the JWKS using a key selector `t:JWK.key_selector/0`
"""
@spec filter(t(), JWK.key_selector()) :: t()
def filter(jwks, key_selector),
do: ... | lib/jose_utils/jwks.ex | 0.887064 | 0.427935 | jwks.ex | starcoder |
defmodule Zap do
@moduledoc """
Native ZIP archive creation with chunked input and output.
Erlang/OTP provides the powerful `:zip` and `:zlib` modules, but they can only create an archive
all at once. That requires _all_ of the data to be kept in memory or written to disk. What if
you don't have enough space... | lib/zap.ex | 0.912194 | 0.878939 | zap.ex | starcoder |
defmodule FormatParser.Audio do
alias __MODULE__
@moduledoc """
An Audio struct and functions.
The Audio struct contains the fields format, sample_rate_hz, num_audio_channels, intrinsics and nature.
"""
defstruct [
:format,
:sample_rate_hz,
:num_audio_channels,
nature: :audio,
intrins... | lib/format_parser/audio.ex | 0.862308 | 0.606702 | audio.ex | starcoder |
defmodule HashRing.Utils do
@moduledoc false
require Logger
@type pattern_list :: [String.t() | Regex.t()]
@type blacklist :: pattern_list
@type whitelist :: pattern_list
@doc """
An internal function for determining if a given node should be
included in the ring or excluded, based on a provided black... | lib/utils.ex | 0.691914 | 0.412382 | utils.ex | starcoder |
defmodule ISOBMFFLang do
@moduledoc """
ISO based media file format derived formats such as Apples MOV and MPEG's MP4 pack language infromation in 16bit binaries.
How these language codes are packed varies though from format to format, Apple has a table of QuickTime language codes that
they enforce in the MOV f... | lib/isobmff_lang.ex | 0.856242 | 0.466967 | isobmff_lang.ex | starcoder |
defmodule MishkaDatabase.CRUD do
@moduledoc """
## Simplified CRUD macro using Ecto
With this module, you can easily implement CRUD-related items in your file wherever you need to build a query.
These modules and their sub-macros were created more to create a one-piece structure, and you can implement your own... | apps/mishka_database/lib/helpers/crud.ex | 0.725065 | 0.748812 | crud.ex | starcoder |
defmodule ETS.Set do
@moduledoc """
Module for creating and interacting with :ets tables of the type `:set` and `:ordered_set`.
Sets contain "records" which are tuples. Sets are configured with a key position via the `keypos: integer` option.
If not specified, the default key position is 1. The element of the ... | lib/ets/set.ex | 0.920553 | 0.883739 | set.ex | starcoder |
defmodule RatError.Formatter do
@moduledoc """
Formats a RAT error.
Formatter is used to retrieve the error Map result by formatting the
parameters (error code, message, environment variables and so on) with the
specified Structure (see 'config/*.exs' for detail).
"""
alias RatError.Structure
@env_ke... | lib/rat_error/formatter.ex | 0.801936 | 0.413448 | formatter.ex | starcoder |
defmodule GenQueue do
@moduledoc """
A behaviour module for implementing queues.
GenQueue relies on adapters to handle the specifics of how the queues
are run. At its most simple, this can mean simple FIFO queues. At its
most advanced, this can mean full async job queues with retries and
backoffs. By provi... | lib/gen_queue.ex | 0.906723 | 0.538983 | gen_queue.ex | starcoder |
defmodule StarkInfra.IssuingBin do
alias __MODULE__, as: IssuingBin
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
Groups IssuingBin related functions
"""
@doc """
The IssuingBin obje... | lib/issuing_bin/issuing_bin.ex | 0.858541 | 0.595257 | issuing_bin.ex | starcoder |
defmodule Flect.Logger do
@moduledoc """
Provides logging facilities for the various Flect tools.
If the `:flect_event_pid` application configuration key is set for the
`:flect` application, log messages will be sent as `{:flect_stdout, msg}`
(where `msg` is a binary) to that PID instead of being p... | lib/logger.ex | 0.857321 | 0.549882 | logger.ex | starcoder |
defmodule Prelude.Map do
@moduledoc "Functions operating on `maps`."
@doc """
Group a map by an array of keys
Provide a list of maps, and a list of keys to group by. All maps must
have all the group_by fields, other fields can vary.
For example:
iex> Prelude.Map.group_by(
...> [%{name: "sti... | lib/prelude/map.ex | 0.791539 | 0.563348 | map.ex | starcoder |
defmodule Lua do
alias Lua.{Chunk, Error, State}
@doc "Encodes an Elixir term as a Lua value."
@spec encode(nil | boolean | number | binary | atom) :: nil | boolean | float | binary
def encode(term)
def encode(nil), do: nil
def encode(false), do: false
def encode(true), do: true
def encode(value) w... | lib/lua.ex | 0.821975 | 0.479077 | lua.ex | starcoder |
defmodule ConsulKv.Client do
@moduledoc """
The client for Consul KV store.
There are several configuration options for the client:
- consul_recv_timeout (default: 5000)
the timeout for receive response from the server side
- consul_connect_timeout (default: 5000)
the timeout for connect co... | lib/consul_kv/client.ex | 0.856663 | 0.433682 | client.ex | starcoder |
defmodule ChoreRunner.Chore do
@moduledoc """
Behaviour and DSL for chores.
"""
require ChoreRunner.DSL
alias ChoreRunner.{DSL, Input}
defstruct id: nil,
mod: nil,
logs: [],
values: %{},
task: nil,
reporter: nil,
started_at: nil,
... | lib/chore_runner/chore.ex | 0.86053 | 0.884039 | chore.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.