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 SSTable.Zip do
defmodule Index do
defstruct [:key, :offset]
end
defmodule ChunkAccum do
defstruct [:payload, :current_chunk, :chunk_key, :chunk_offset, :index, :current_offset]
def empty do
%__MODULE__{
payload: <<>>,
current_chunk: <<>>,
chunk_key: nil,
... | lib/august_db/sstable/zip.ex | 0.555918 | 0.486454 | zip.ex | starcoder |
defmodule Wobserver.Page do
@moduledoc """
Page management for custom commands and pages in api and wobserver.
"""
alias Wobserver.Page
@pages_table :wobserver_pages
@typedoc ~S"""
Accepted page formats.
"""
@type data ::
Page.t
| map
| {String.t, atom, fun}
| {String.t, atom, fun, ... | lib/wobserver/page.ex | 0.857798 | 0.609408 | page.ex | starcoder |
defmodule NaturalTime do
import NimbleParsec
ws = string(" ") |> repeat() |> ignore()
int2 = integer(min: 1, max: 2)
preposition =
optional(
choice([
string("in the"),
string("on the"),
string("at the"),
string("in"),
string("on"),
string("at")
]... | lib/natural_time.ex | 0.669853 | 0.505371 | natural_time.ex | starcoder |
defmodule Reaper.DataExtract.Processor do
@moduledoc """
This module processes a data source and sends its data to the output topic
"""
require Logger
alias Reaper.{
Decoder,
DataSlurper,
UrlBuilder,
Persistence
}
alias Reaper.DataExtract.{ValidationStage, SchemaStage, LoadStage}
use ... | apps/reaper/lib/reaper/data_extract/processor.ex | 0.707506 | 0.505676 | processor.ex | starcoder |
defmodule Ockam.SecureChannel.XX do
@moduledoc """
Defines the XX Key Agreement protocol.
"""
alias Ockam.Vault
defstruct [:role, :vault, :s, :e, :rs, :re, :ck, :k, :n, :h, :prologue]
@protocol_name "Noise_XX_25519_AESGCM_SHA256"
defmacro zero_padded_protocol_name do
quote bind_quoted: binding() do... | implementations/elixir/ockam/ockam/lib/ockam/secure_channel/xx.ex | 0.777173 | 0.433622 | xx.ex | starcoder |
defmodule Nerves.Grove.OLED.Display do
@moduledoc """
Seeed Studio [Grove OLED Display 96×96](http://wiki.seeedstudio.com/wiki/Grove_-_OLED_Display_1.12%22)
## Datasheet
http://garden.seeedstudio.com/images/8/82/SSD1327_datasheet.pdf
# Example
alias Nerves.Grove.OLED
{:ok, pid} = OLED.Displa... | lib/nerves_grove/oled_display.ex | 0.583441 | 0.653908 | oled_display.ex | starcoder |
defmodule Honeybadger.Utils do
@moduledoc """
Assorted helper functions used through out the Honeybadger package.
"""
@doc """
Internally all modules are prefixed with Elixir. This function removes the
`Elixir` prefix from the module when it is converted to a string.
# Example
iex> Honeybadger.Ut... | lib/honeybadger/utils.ex | 0.877254 | 0.484624 | utils.ex | starcoder |
defmodule Gobstopper.Service.Auth.Identity.Credential do
@moduledoc """
Manages the interactions with credentials.
Credential implementations will implement the given callbacks to handle the
specific credential type.
##Implementing a credential
Credentials should be implemented in a... | apps/gobstopper_service/lib/gobstopper.service/auth/identity/credential.ex | 0.912109 | 0.638399 | credential.ex | starcoder |
defmodule Grizzly.ZWave.Commands.DoorLockOperationReport do
@moduledoc """
OperationReport is used to advertise the status of a door lock
This is response to the `Grizzly.ZWave.Commands.OperationGet`
command.
Params:
* `:mode` - the door operating lock mode (required)
* `:outside_handles_mode` - a ... | lib/grizzly/zwave/commands/door_lock_operation_report.ex | 0.881755 | 0.431704 | door_lock_operation_report.ex | starcoder |
defmodule Multiverses.Registry do
@moduledoc """
This module is intended to be a drop-in replacement for `Registry`, but
not all functionality is implemented.
If universes are active, keys in the Registry will be `{universe, key}`
instead of the normal `key`. A convenience `via/2` macro has been
provided,... | lib/multiverses/registry.ex | 0.785555 | 0.719753 | registry.ex | starcoder |
defmodule Zipper do
defstruct [:current, :former]
@type dir :: :left | :right
@type t() :: %__MODULE__{current: BinTree.t(), former: [{dir, any, BinTree.t()}]}
@doc """
Get a zipper focused on the root node.
"""
@spec from_tree(BinTree.t()) :: Zipper.t()
def from_tree(bin_tree) do
%__MODULE__{curr... | elixir/zipper/lib/zipper.ex | 0.896935 | 0.717309 | zipper.ex | starcoder |
defmodule PixelFont.TableSource.Glyf.Simple do
alias PixelFont.RectilinearShape.Path, as: RSPath
defstruct ~w(last_points inst_size inst flags x_coords y_coords)a
@type t :: %__MODULE__{
last_points: [integer()],
inst_size: 0x0000..0xFFFF,
inst: binary(),
flags: [0x00..0x... | lib/pixel_font/table_source/glyf/simple.ex | 0.735167 | 0.438004 | simple.ex | starcoder |
defmodule Wadm.Model.Decoder do
@capability_component_type "capability"
@actor_component_type "actor"
alias Wadm.Model.{
ActorComponent,
CapabilityComponent,
LinkDefinition,
SpreadScaler,
WeightedTarget,
AppSpec
}
@doc """
Takes a map as returned by either of `YamlElixir`'s parse f... | wadm/lib/wadm/model/decoder.ex | 0.794544 | 0.457197 | decoder.ex | starcoder |
defmodule Dpos.Tx.MultiSig do
use Dpos.Tx, type: 4
@doc """
Sets the lifetime in seconds of the multisignature.
The lifetime must be >= 3600 and <= 259200.
"""
@spec set_lifetime(Dpos.Tx.t(), pos_integer) :: Dpos.Tx.t()
def set_lifetime(%Dpos.Tx{} = tx, ttl)
when is_integer(ttl) and ttl >= 3600 an... | lib/tx/multi_sig.ex | 0.739799 | 0.472075 | multi_sig.ex | starcoder |
defmodule Grizzly.ZWave.Commands.ScheduleEntryTypeSupportedReport do
@moduledoc """
This command is used to report the number of supported schedule slots an Entry Lock schedule device supports for each user in the system.
Params:
* `:number_of_slots_week_day` - A number from 0 – 255 that represents how many... | lib/grizzly/zwave/commands/schedule_entry_type_supported_report.ex | 0.880714 | 0.618536 | schedule_entry_type_supported_report.ex | starcoder |
defmodule Astarte.Flow.Blocks.DynamicVirtualDevicePool do
@moduledoc """
This is a consumer block that takes `data` from incoming `Message`s and publishes it as an Astarte device,
interpreting the `key` as <realm>/<device_id>/<interface><path>.
The devices are dynamically registered when their device id is fi... | lib/astarte_flow/blocks/dynamic_virtual_device_pool.ex | 0.893184 | 0.430866 | dynamic_virtual_device_pool.ex | starcoder |
defmodule Genetic do
require Integer
alias Genetic.{
Chromosome,
SelectionStrategy,
CrossoverStrategy,
MutationStrategy,
ReinsertionStrategy
}
@spec run(Genetic.Problem.t(), Keyword.t()) :: [Chromosome.t()]
def run(problem, opts \\ []) do
problem
|> initialize(opts)
|> evolve... | lib/genetic.ex | 0.784154 | 0.533641 | genetic.ex | starcoder |
defmodule Toml.Test.Assertions do
@moduledoc false
import ExUnit.Assertions
alias Toml.Test.JsonConverter
@doc """
Given a path to a TOML file, asserts that parsing succeeds and
conversion to it's JSON equivalent matches the expected result.
The expected result should be contained in a .json file of th... | test/support/assertions.ex | 0.75985 | 0.714578 | assertions.ex | starcoder |
defmodule Prometheus.Metric.Histogram do
@moduledoc """
A Histogram tracks the size and number of events in buckets.
You can use Histograms for aggregatable calculation of quantiles.
Example use cases for Histograms:
- Response latency;
- Request size.
Histogram expects `buckets` key in a metric spe... | astreu/deps/prometheus_ex/lib/prometheus/metric/histogram.ex | 0.959374 | 0.946498 | histogram.ex | starcoder |
defrecord Flect.Compiler.Syntax.Node, type: nil,
location: nil,
tokens: [],
children: [],
comments: [],
data: nil do
@moduledo... | lib/compiler/syntax/node.ex | 0.796015 | 0.568116 | node.ex | starcoder |
defmodule Dictator do
@moduledoc """
Plug that checks if your users are authorised to access the resource.
You can use it at the router or controller level:
```
# lib/my_app_web/controllers/post_controller.ex
defmodule MyApp.PostController do
plug Dictator
def show(conn, params) do
# ...
... | lib/dictator.ex | 0.840684 | 0.695519 | dictator.ex | starcoder |
defmodule Reactivity.DSL.Signal do
alias Reactivity.Quality.Context
alias Reactivity.DSL.DoneNotifier
alias ReactiveMiddleware.Registry
alias Observables.Obs
alias Observables.GenObservable
require Logger
@doc """
Creates a signal from a plain observable, operating under the globally set consistency guarante... | lib/reactivity/dsl/signal.ex | 0.67971 | 0.631836 | signal.ex | starcoder |
defmodule FIFO do
@moduledoc """
A first-in-first-out queue data structure for Elixir.
With a first-in-first-out (FIFO) queue, the first item inserted is the first
item removed. A real-life analogy is the line, or queue, at the grocery store.
The first person to get in line is the first person helped, and th... | lib/fifo.ex | 0.860574 | 0.533701 | fifo.ex | starcoder |
defmodule Gpio.Mock do
use GenServer
@behaviour Gpio
defmodule State do
@moduledoc false
defstruct pin: nil,
direction: nil,
callbacks: [],
value: 0
end
# Public API
def start_link(pin, pin_direction, opts \\ []) do
opts = Keyword.put(opts, :name, Gpi... | lib/gpio/mock.ex | 0.602997 | 0.494751 | mock.ex | starcoder |
defmodule Versioning.Schema do
@moduledoc """
Defines a versioning schema.
A versioning schema is used to change data through a series of steps from a
"current" version to a "target" version. This is useful in maintaining backwards
compatability with older versions of API's without enormous complication.
... | lib/versioning/schema.ex | 0.890663 | 0.611498 | schema.ex | starcoder |
defmodule Gringotts.Gateways.Paymill do
@moduledoc """
An Api Client for the [PAYMILL](https://www.paymill.com/) gateway.
For refernce see [PAYMILL's API (v2.1) documentation](https://developers.paymill.com/API/index)
The following features of PAYMILL are implemented:
| Action | Metho... | lib/gringotts/gateways/paymill.ex | 0.863492 | 0.558628 | paymill.ex | starcoder |
defmodule Jalaali do
@moduledoc """
Jalaali module helps converting gregorian dates to jalaali dates.
Jalaali calendar is widely used in Persia and Afganistan.
This module helps you with converting erlang and/or elixir DateTime formats to Jalaali date (and vice versa) and checking for leap years
"""
@days... | lib/jalaali.ex | 0.873242 | 0.417687 | jalaali.ex | starcoder |
defmodule ExDiceRoller.Compilers.Variable do
@moduledoc """
Handles compiling expressions that use variables.
Variables can be used to replace single letter characters in an expression
with a value, such as a number or an anonymous function that accepts list
arguments (`args` and `opts`, respectively).
Ac... | lib/compilers/variable.ex | 0.864325 | 0.677407 | variable.ex | starcoder |
defmodule Tyx.Traversal do
@moduledoc false
use Boundary, deps: [Tyx], exports: [Lookup, Typemap]
alias Tyx.Traversal.Lookup
require Logger
@callback lookup(module(), atom(), [module()] | non_neg_integer()) ::
{:error, {module, atom(), non_neg_integer()}} | {:ok, atom()}
@spec validate(Ma... | lib/tyx/traversal.ex | 0.736306 | 0.441793 | traversal.ex | starcoder |
defmodule TelemetryAsync.Handler do
@moduledoc """
GenServer that subscribes to the requested telemetry metrics. The handler will
randomly distribute requests to the ShardSupervisor Shards and re-execute the telemetry
metrics with :async prepended to the beginning.
A metric like `[:test]` will become `[:asyn... | lib/telemetry_async/handler.ex | 0.902177 | 0.469581 | handler.ex | starcoder |
defmodule MPEGAudioFrameParser.Impl do
alias MPEGAudioFrameParser.Frame
require Logger
@sync_word 0b11111111111
@initial_state %{leftover: <<>>, current_frame: nil, frames: []}
def init() do
{:ok, @initial_state}
end
def add_packet(state, packet) do
process_bytes(state, packet)
end
def pop... | lib/mpeg_audio_frame_parser/impl.ex | 0.663778 | 0.449816 | impl.ex | starcoder |
defmodule ENHL.Report do
use GenServer
@doc """
Starts a new report.
"""
def start_link(year, game_id), do: GenServer.start_link(__MODULE__, year: year, game_id: game_id)
@doc """
Returns the year of the `report`.
Returns `{:ok, year}`.
"""
def year(report), do: GenServer.call(report, :year)
@... | lib/enhl/report.ex | 0.740362 | 0.469034 | report.ex | starcoder |
defmodule Okta.IdPs do
@moduledoc """
The `Okta.IdPs` module provides access methods to the [Okta Identity Providers API](https://developer.okta.com/docs/reference/api/idps/).
All methods require a Tesla Client struct created with `Okta.client(base_url, api_key)`.
## Examples
client = Okta.Client("http... | lib/okta/idps.ex | 0.849769 | 0.410934 | idps.ex | starcoder |
defmodule AdventOfCode.Day18 do
@moduledoc ~S"""
[Advent Of Code day 18](https://adventofcode.com/2018/day/18).
"""
import AdventOfCode.Utils, only: [map_increment: 2]
@open "."
@tree "|"
@lumberyard "#"
def solve("1", input) do
grid = input |> parse_input()
Enum.reduce(1..10, grid, fn _, gri... | lib/advent_of_code/day_18.ex | 0.672224 | 0.61257 | day_18.ex | starcoder |
defmodule Absinthe.Resolution do
@moduledoc """
Information about the current resolution. It is created by adding field specific
information to the more general `%Absinthe.Blueprint.Execution{}` struct.
In many ways like the `%Conn{}` from `Plug`, the `%Absinthe.Resolution{}` is the
piece of information that... | lib/absinthe/resolution.ex | 0.883242 | 0.875148 | resolution.ex | starcoder |
defmodule Kernel.Typespec do
@moduledoc false
@doc """
Defines a type.
This macro is responsible for handling the attribute `@type`.
## Examples
@type my_type :: atom
"""
defmacro deftype(type) do
pos = :elixir_locals.cache_env(__CALLER__)
%{line: line, file: file, module: module} = __CA... | lib/elixir/lib/kernel/typespec.ex | 0.890109 | 0.501953 | typespec.ex | starcoder |
defmodule Phoenix.LiveView.Controller do
@moduledoc """
The Controller for LiveView rendering.
"""
@behaviour Plug
alias Phoenix.LiveView
@doc """
Renders a live view from a Plug request and sends an HTML response.
## Options
* `:session` - the map of session data to sign and send
to the ... | lib/phoenix_live_view/controller.ex | 0.845592 | 0.515376 | controller.ex | starcoder |
defmodule FarmbotOS.SysCalls.PinControl do
@moduledoc false
alias FarmbotOS.{Asset, Leds}
alias FarmbotOS.Firmware.Command
alias FarmbotOS.Asset.{
BoxLed,
Peripheral,
Sensor
}
require FarmbotOS.Logger
def read_cached_pin(%_{pin: number}) do
read_cached_pin(number)
end
def read_cac... | lib/os/sys_calls/pin_control.ex | 0.560854 | 0.400456 | pin_control.ex | starcoder |
defmodule ExPixBRCode.JWS.Models.JWKS do
@moduledoc """
A JWKS result following RFC https://tools.ietf.org/html/rfc7517
"""
use ExPixBRCode.ValueObject
@key_required [:kty, :kid, :x5t, :x5c, :key_ops]
@key_optional [:use, :alg, :"x5t#S256", :x5u, :n, :e, :crv, :x, :y]
@supported_algs JOSE.JWA.supports(... | lib/ex_pix_brcode/jws/models/jwks.ex | 0.815159 | 0.436982 | jwks.ex | starcoder |
defmodule RoutePatterns.RoutePattern do
@moduledoc """
Route patterns are used to describe the subsets of a route, representing different
possible patterns of where trips may serve. For example, a bus route may have multiple
branches, and each branch may be modeled as a separate route pattern per direction.
H... | apps/route_patterns/lib/route_pattern.ex | 0.817101 | 0.630329 | route_pattern.ex | starcoder |
defmodule RoboticaCommon.Strings do
@moduledoc """
Provides String parsing and evaluation functions.
"""
@doc """
Substitute {xyz} values from a dictionary in a string.
iex> import RoboticaCommon.Strings
iex> replace_values("{i}-{j}", %{"i" => "hello", "j" => "world"})
{:ok, "hello-world"}
iex> imp... | robotica_common/lib/strings.ex | 0.803868 | 0.471406 | strings.ex | starcoder |
defmodule AWS.Glacier do
@moduledoc """
Amazon Glacier is a storage solution for "cold data."
Amazon Glacier is an extremely low-cost storage service that provides
secure, durable, and easy-to-use storage for data backup and archival. With
Amazon Glacier, customers can store their data cost effectively for ... | lib/aws/glacier.ex | 0.853638 | 0.594757 | glacier.ex | starcoder |
defmodule Mix.Task.Compiler do
@moduledoc """
This module defines the behaviour for a Mix task that does compilation.
A Mix compiler task can be defined by simply using `Mix.Task.Compiler`
in a module whose name starts with `Mix.Tasks.Compile.` and defining
the [`run/1`](`c:run/1`) function:
defmodule... | lib/mix/lib/mix/task.compiler.ex | 0.831092 | 0.638673 | task.compiler.ex | starcoder |
defmodule Mix.Tasks.SendSlackUpdateNotification do
use Mix.Task
require Logger
import Ecto.Query, warn: false
alias ChatApi.{Slack, SlackAuthorizations, SlackConversationThreads}
alias ChatApi.SlackAuthorizations.SlackAuthorization
alias ChatApi.SlackConversationThreads.SlackConversationThread
@shortdoc... | lib/mix/tasks/send_slack_update_notification.ex | 0.772702 | 0.501648 | send_slack_update_notification.ex | starcoder |
defmodule RRPproxy.Deserializer do
@moduledoc """
Documentation for `RRPproxy.Deserializer` which provides deserialization helpers.
**It is used for low-level communication and should not be used directly by users of this library.**
"""
@multi_line_fields [
" procedure",
" policy",
"allowed chara... | lib/rrpproxy/deserializer.ex | 0.59408 | 0.424233 | deserializer.ex | starcoder |
defmodule UAInspector.ClientHints do
@moduledoc """
Parse and store client hint headers for usage in device detection.
"""
@type t :: %__MODULE__{
architecture: String.t() | :unknown,
bitness: String.t() | :unknown,
full_version: String.t() | :unknown,
full_version_list:... | lib/ua_inspector/client_hints.ex | 0.812421 | 0.416856 | client_hints.ex | starcoder |
defmodule Still.Preprocessor.Renderer do
@moduledoc """
Defines the basic attributes of a markup renderer.
A renderer needs to implement a `compile/2` function and an optional `ast/0`
function. When a markup file is being compiled, a module is created on
demand. This module imports all template helpers defin... | lib/still/preprocessor/renderer.ex | 0.872822 | 0.542076 | renderer.ex | starcoder |
defmodule Flop do
@moduledoc """
Flop is a helper library for filtering, ordering and pagination with Ecto.
## Usage
Derive `Flop.Schema` in your Ecto schemas.
defmodule Pet do
use Ecto.Schema
@derive {Flop.Schema,
filterable: [:name, :species], sortable: [:name, :age]... | lib/flop.ex | 0.895794 | 0.639624 | flop.ex | starcoder |
defmodule Vapor.Configuration do
@moduledoc false
# Manages a layered set of configuration values.
# Not meant to be consumed by the end user
import Norm
defstruct [
layers: %{overrides: %{}},
translations: []
]
def s do
schema(%__MODULE__{
layers: map_of(one_of([spec(is_atom()), spec(... | lib/vapor/configuration.ex | 0.861086 | 0.508483 | configuration.ex | starcoder |
defmodule AWS.Kinesis.Firehose do
@moduledoc """
Amazon Kinesis Data Firehose API Reference
Amazon Kinesis Data Firehose is a fully managed service that delivers
real-time streaming data to destinations such as Amazon Simple Storage
Service (Amazon S3), Amazon Elasticsearch Service (Amazon ES), Amazon
Red... | lib/aws/kinesis_firehose.ex | 0.936088 | 0.802052 | kinesis_firehose.ex | starcoder |
defmodule EctoEnum.Use do
@moduledoc false
alias EctoEnum.Typespec
defmacro __using__(opts) do
quote bind_quoted: [opts: opts] do
[h | _t] = opts
opts =
cond do
Keyword.keyword?(opts) ->
opts
is_binary(h) ->
Enum.map(opts, fn value -> {String... | lib/ecto_enum/use.ex | 0.781914 | 0.412885 | use.ex | starcoder |
defmodule Vega.Issue do
@moduledoc """
The issue contains the details of the history of all modifications. For each modification an issue document
is created to record all details and references that belong to the modification.
At the front end a human friendly message is rendered: The field `:msg` contains t... | lib/vega/issue/issue.ex | 0.783947 | 0.433382 | issue.ex | starcoder |
defmodule Erl2ex.Results.Collector do
@moduledoc """
Erl2ex.Results.Collector is a process that accumulates results of a
conversion run.
"""
alias Erl2ex.Results
@typedoc """
The ProcessID of a results collector process.
"""
@type t :: pid()
@typedoc """
A file identifier, which may be a f... | lib/erl2ex/results_collector.ex | 0.555194 | 0.515193 | results_collector.ex | starcoder |
defmodule Astarte.Flow.Blocks.HttpSource do
@moduledoc """
This is a producer block that generates messages by polling HTTP URLs with a GET request.
It works by specifying a `base_url` and a list of `target_paths` to perform requests on.
`HttpSource` will perform GET requests in a round robin fashion on all `... | lib/astarte_flow/blocks/http_source.ex | 0.908193 | 0.471284 | http_source.ex | starcoder |
defmodule Modbux.Rtu.Framer do
@moduledoc """
A framer for Modbus RTU frames. This framer doesn't do anything for the transmit
direction, but for receives, it will collect bytes that follows the Modbus RTU protocol,
it also execute the CRC validation and returns the frame or the error.
"""
@behaviour Circu... | lib/rtu/framer.ex | 0.562898 | 0.482673 | framer.ex | starcoder |
defmodule Faker.Vehicle.En do
import Faker, only: [sampler: 2]
alias Faker.Util
@moduledoc """
Functions for generating Vehicle related data in English
"""
@makes [
"BMW",
"Audi",
"Toyota",
"Chevy",
"Ford",
"Dodge",
"Lincoln",
"Buick",
"Honda",
"Nissan"
]
@mode... | lib/faker/vehicle/en.ex | 0.637708 | 0.428951 | en.ex | starcoder |
defmodule Scenic.Cache.Hash do
@moduledoc """
Helper functions to work with hash signatures.
Both the [`Cache.File`](Scenic.Cache.File.html) and [`Cache.Term`](Scenic.Cache.Term.html)
modules use cryptographic hash signatures to verify that files are valid before using
the data they contain.
This modules... | lib/scenic/cache/hash.ex | 0.919625 | 0.574514 | hash.ex | starcoder |
defmodule ParseTorrent do
alias ParseTorrent.Error
@moduledoc """
A module for convenient .torrent parsing
"""
defstruct(
info_hash: nil,
name: nil,
private: false,
created_at: nil,
created_by: nil,
comment: nil,
announce: [],
url_list: [],
files: [],
length: nil,
... | lib/parse_torrent.ex | 0.700997 | 0.47591 | parse_torrent.ex | starcoder |
defmodule PairingHeap do
if Application.get_env(:priority_queue, :native) do
@compile :native
@compile {:hipe, [:o3]}
end
@moduledoc """
Pairing Heap implementation
see:
http://en.wikipedia.org/wiki/Pairing_heap
A Pairing Heap is a type of heap structure with relatively simple implementation and
... | lib/pairing_heap.ex | 0.602296 | 0.533033 | pairing_heap.ex | starcoder |
defmodule ExAws.S3.DirectUpload do
@moduledoc """
Pre-signed S3 upload helper for client-side multipart POSTs, with support for using AWS Instance Roles,
which produce temporary credentials. This approach reduces the number of ENV variables to pass, among other benefits.
See:
[Browser-Based Upload using HT... | lib/ex_aws/s3/direct_upload.ex | 0.856498 | 0.752331 | direct_upload.ex | starcoder |
defmodule Extatistics.Base do
@moduledoc """
* Module to implement basic estatistics functions
"""
@type twoNumTL() :: [{number, number}]
@type numEnum() :: Enumerate.number()
@doc """
Apara o array em N posições, retirando:
- N/2 no início e N/2 no final, caso N par
- N/2 + 1 no... | lib/extatistics/base.ex | 0.83104 | 0.711431 | base.ex | starcoder |
defmodule Plymio.Fontais.Codi.State do
@moduledoc false
# note: all the keys are prefixed with 'state_'
@vekil %{
state_def_new_doc:
quote do
@doc ~S"""
`new/1` creates a new instance of the module's `struct` and, if the optional
*opts* were given, calls `update/2` with the ins... | lib/fontais/codi/state/state.ex | 0.816918 | 0.420481 | state.ex | starcoder |
defmodule Kaffy.Routes do
@moduledoc """
Kaffy.Routes must be "used" in your phoenix routes:
```elixir
use Kaffy.Routes, scope: "/admin", pipe_through: [:browser, :authenticate]
```
`:scope` defaults to `"/admin"`
`:pipe_through` defaults to kaffy's `[:kaffy_browser]`
"""
# use Phoenix.Router
d... | lib/kaffy/routes.ex | 0.707708 | 0.451387 | routes.ex | starcoder |
defmodule Apoc.Adapter.Hash do
@moduledoc """
Behaviour and functions for hashing messages.
This behaviour can be used with virtually any hashing scheme but Apoc
comes with a set of standard hashes described in
[FIPS PUB 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).
See `Apoc.Hash.SH... | lib/apoc/adapter/hash.ex | 0.88958 | 0.927953 | hash.ex | starcoder |
defmodule ScrapyCloudEx.Endpoints.Storage.Items do
@moduledoc """
Wraps the [Items](https://doc.scrapinghub.com/api/items.html) endpoint.
The Items API lets you interact with the items stored in the hubstorage backend for your projects.
"""
require Logger
import ScrapyCloudEx.Endpoints.Guards
alias Scr... | lib/endpoints/storage/items.ex | 0.891838 | 0.765681 | items.ex | starcoder |
defmodule Phoenix.PubSub.Redis do
use Supervisor
@moduledoc """
Phoenix PubSub adapter based on Redis.
To use Redis as your PubSub adapter, simply add it to your Endpoint's config:
config :my_app, MyApp.Endpoint,
pubsub: [adapter: Phoenix.PubSub.Redis,
host: "192.168.1.100", no... | lib/phoenix_pubsub_redis/redis.ex | 0.743541 | 0.402216 | redis.ex | starcoder |
defmodule VintageNetMobile.ExChat do
@moduledoc """
Send commands to your modem and get notifications
This module is used by the "monitor" modules for reporting modem and
connection status.
It can be handy to debug modems too. If you'd like to send commands and
receive notifications from the IEx prompt, h... | lib/vintage_net_mobile/ex_chat.ex | 0.670069 | 0.539105 | ex_chat.ex | starcoder |
defmodule Segment.Encoder do
@moduledoc """
Responsible to transforming structs into JSON strings.
"""
@doc """
Encodes a given struct into a JSON string.
## Options
* `drop_nil_fields`: If set to `true` all the struct `nil` fields will be
filtered out from the JSON string. Defaults to `false... | lib/segment/encoder.ex | 0.906963 | 0.473109 | encoder.ex | starcoder |
defmodule Asteroid.ObjectStore.GenericKV.Mnesia do
@moduledoc """
Mnesia implementation of the `Asteroid.ObjectStore.GenericKV` behaviour
## Options
The options (`Asteroid.ObjectStore.GenericKV.opts()`) are:
- `:table_name`: an `atom()` for the table name. No default, **mandatory**
- `:tab_def`: Mnesia's t... | lib/asteroid/object_store/generic_kv/mnesia.ex | 0.905076 | 0.856453 | mnesia.ex | starcoder |
defmodule GGity.Scale.Linetype.Discrete do
@moduledoc false
alias GGity.{Draw, Labels}
alias GGity.Scale.Linetype
@linetype_specs %{
solid: "",
dashed: "4",
dotted: "1",
longdash: "6 2",
dotdash: "1 2 3 2",
twodash: "2 2 6 2"
}
@palette [:solid, :dashed, :dotted, :longdash, :dotda... | lib/ggity/scale/linetype_discrete.ex | 0.815783 | 0.430746 | linetype_discrete.ex | starcoder |
defmodule YubikeyOTP do
@moduledoc """
YubikeyOTP is an Elixir client for validating Yubikey one-time-passwords. It can validate OTPs using Yubico's public
API or by using your own or third-party OTP validation services.
## Requirements
This module contains all the functions you'll need to authenticate Yubi... | lib/yubikey_otp.ex | 0.850825 | 0.419856 | yubikey_otp.ex | starcoder |
defmodule Asteroid.OIDC.AuthenticationEvent do
@moduledoc """
Convenience functions to work with authentication events
The `%Asteroid.OIDC.AuthenticationEvent{}` object has the following meaningful members in
its `:data` field:
- `"name"`: the event name (`t:Asteroid.AuthenticationEvent.name/0`)
- `"amr"`:... | lib/asteroid/oidc/authentication_event.ex | 0.887101 | 0.410018 | authentication_event.ex | starcoder |
# A toplevel comment.
defmodule Erl2ex.Pipeline.ExComment do
@moduledoc false
defstruct(
# List of comments, one per line. Each comment must begin with a hash "#".
comments: []
)
end
# A module attribute.
defmodule Erl2ex.Pipeline.ExAttr do
@moduledoc false
defstruct(
# Name of the attrib... | lib/erl2ex/pipeline/ex_data.ex | 0.755637 | 0.546194 | ex_data.ex | starcoder |
defmodule HamRadio.Grid do
@moduledoc """
Converts between coordinates and Maidenhead grid locators.
"""
@alphabet ~w(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
@regex ~r/[A-R]{2}[0-9]{2}($|([a-x]{2}$))/i
@type coord :: {lat :: float, lon :: float}
@type coord_bounds ::
{{lat_min :: ... | lib/ham_radio/grid.ex | 0.936829 | 0.719162 | grid.ex | starcoder |
defmodule ExQuickBooks.OAuth do
@moduledoc """
Functions for interacting with the OAuth API.
QuickBooks uses the three-legged OAuth 1.0a flow. For a human-readable
overview of the whole flow and how to implement it, see e.g.
[oauthbible.com](http://oauthbible.com/#oauth-10a-three-legged).
## Request token... | lib/exquickbooks/oauth.ex | 0.916067 | 0.826257 | oauth.ex | starcoder |
defmodule Nx.Shape do
# Conveniences for manipulating shapes internal to Nx.
@moduledoc false
@doc """
Converts a shape to an algebra document for inspection.
"""
def to_algebra(shape, names, open, close) do
# TODO: Use Enum.zip_with on Elixir v1.12
shape
|> Tuple.to_list()
|> Enum.zip(name... | lib/nx/shape.ex | 0.71113 | 0.677227 | shape.ex | starcoder |
defmodule Const do
@moduledoc """
A simple helper to define constants. Constants are defined as functions of the module and couple of helper functions are added.
```elixir
defmodule Status do
use Const, [:queued, :processed, :sent]
end
```
is equivalent to writing
```elixir
defmodule Status do
... | lib/const.ex | 0.819063 | 0.98764 | const.ex | starcoder |
defmodule Is.Validators.InRange do
@moduledoc """
In range validator (inclusive).
## Examples
iex> Is.validate(10, in_range: [1, 10])
[]
iex> Is.validate(10, in_range: [min: 1])
[]
iex> Is.validate(10, in_range: [max: 10])
[]
iex> Is.validate(10, in_range: [min: 1, m... | lib/is/validators/in_range.ex | 0.727104 | 0.684897 | in_range.ex | starcoder |
defmodule Plug.AMQP do
@moduledoc """
Adapter interface to the [AMQP RPC pattern](https://www.rabbitmq.com/tutorials/tutorial-six-elixir.html).
`Plug.AMQP` provides an [AMQP](https://www.amqp.org) interface to `Plug`.
When using `Plug.AMQP` you can write servers that answer requests sent through
an *AMQP* br... | lib/plug/amqp.ex | 0.830233 | 0.888855 | amqp.ex | starcoder |
defmodule MealTracker.FoodItem do
@moduledoc """
Represents a food item in a meal log.
## Text Formats
This module exists to translate food items between the structure representation and textual
representations. In the patterns below "Food name" represents the name of the food, "nx"
represents the number ... | lib/meal_tracker/food_item.ex | 0.817756 | 0.575051 | food_item.ex | starcoder |
defmodule Mnemonix.Features.Bump do
@name Inspect.inspect(__MODULE__, %Inspect.Opts{})
@moduledoc """
Functions to increment/decrement integer values within a store.
Using this feature will define all of its Mnemonix client API functions on your module.
Refer to `Mnemonix.Builder` for documentation on optio... | lib/mnemonix/features/bump.ex | 0.906975 | 0.410874 | bump.ex | starcoder |
defmodule Sanbase.KafkaExporter do
@moduledoc ~s"""
Module for persisting any data to Kafka.
The module exposes one function that should be used - `persist/1`.
This functions adds the data to an internal buffer that is flushed
every `kafka_flush_timeout` seconds or when the buffer is big enough.
The expor... | lib/sanbase/kafka/kafka_exporter.ex | 0.814311 | 0.543287 | kafka_exporter.ex | starcoder |
defmodule BikeBrigade.Riders.RiderSearch do
import Ecto.Query
alias BikeBrigade.Repo
alias BikeBrigade.Riders.{Rider, RiderSearch, Tag}
alias BikeBrigade.Stats.RiderStats
defstruct [
:sort_field,
:sort_order,
:preload,
offset: 0,
limit: 0,
filters: [],
page_changed: true,
qu... | lib/bike_brigade/riders/rider_search.ex | 0.757705 | 0.420124 | rider_search.ex | starcoder |
defmodule DiscordBot.Model.VoicePayload do
@moduledoc """
An object which wraps all voice control websocket messages.
"""
use DiscordBot.Model.Serializable
alias DiscordBot.Model.{
SelectProtocol,
SessionDescription,
Speaking,
VoiceHello,
VoiceIdentify,
VoicePayload,
VoiceReady
... | apps/discordbot/lib/discordbot/model/voice_payload.ex | 0.816077 | 0.419618 | voice_payload.ex | starcoder |
defmodule Grax do
@moduledoc """
The Grax API.
For now there is no API documentation.
Read about the API in the guide [here](https://rdf-elixir.dev/grax/api.html).
"""
alias Grax.{Schema, Id, Validator, ValidationError}
alias Grax.Schema.{DataProperty, LinkProperty, Struct, AdditionalStatements}
alias... | lib/grax/grax.ex | 0.626124 | 0.432723 | grax.ex | starcoder |
defmodule ElixirLS.LanguageServer.Providers.FoldingRange.Indentation do
@moduledoc """
Code folding based on indentation level
Note that we trim trailing empty rows from regions.
See the example.
"""
alias ElixirLS.LanguageServer.Providers.FoldingRange
alias ElixirLS.LanguageServer.Providers.FoldingRang... | apps/language_server/lib/language_server/providers/folding_range/indentation.ex | 0.861786 | 0.495667 | indentation.ex | starcoder |
defmodule Exmath do
def factorial(n) when n <= 1, do: 1
@doc """
Factorial will multiply n with n-1 until n <= 1.
# Example
iex> Exmath.factorial(4)
24
"""
@spec factorial(number) :: integer
def factorial(n) do
n * factorial(n-1)
end
@doc """
Combinations formula.
A formula for ... | lib/exmath.ex | 0.9245 | 0.808446 | exmath.ex | starcoder |
defmodule LoggerPapertrailBackend.Configurator do
alias LoggerPapertrailBackend.Configuration
@moduledoc """
You can config papertrail backend with an url in the form of papertrail://logs.papertrail.com:12345/my_system_name
It works with syslog:// as scheme too.
In your config, choose between
```elixir
... | lib/configurator.ex | 0.666062 | 0.440168 | configurator.ex | starcoder |
defmodule Topo.Intersects do
@moduledoc false
alias Topo.PointLine
alias Topo.PointRing
alias Topo.LineLine
alias Topo.LineRing
alias Topo.RingRing
@type geo_struct ::
%Geo.Point{}
| %Geo.MultiPoint{}
| %Geo.LineString{}
| %Geo.MultiLineString{}
| %Geo.P... | lib/topo/intersects.ex | 0.821689 | 0.441432 | intersects.ex | starcoder |
defmodule StepFlow.Step.Helpers do
@moduledoc """
The Helper Step context.
"""
@doc """
Retrieves a value on an Objecta and filtered by the key.
"""
def get_value_in_parameters(object, key) do
StepFlow.Map.get_by_key_or_atom(object, :parameters, [])
|> Enum.filter(fn param ->
StepFlow.Map.g... | lib/step_flow/step/helpers.ex | 0.798423 | 0.569344 | helpers.ex | starcoder |
alias Farmbot.BotState.Hardware, as: Hardware
alias Farmbot.BotState.Configuration, as: Configuration
defmodule Farmbot.BotState do
require Logger
@moduledoc """
Functions to modifying Farmbot's state
all in one convenient (and easy to spell) location.
"""
@doc """
Gets the current position o... | lib/bot_state/bot_state.ex | 0.848109 | 0.415699 | bot_state.ex | starcoder |
defmodule AdventOfCode2019.MonitoringStation do
@moduledoc """
Day 10 — https://adventofcode.com/2019/day/10
"""
@spec part1(Enumerable.t()) :: integer()
def part1(in_stream) do
in_stream
|> Stream.with_index()
|> Stream.map(&load_belt/1)
|> Enum.to_list()
|> List.flatten()
|> find_ma... | lib/advent_of_code_2019/day10.ex | 0.872347 | 0.459258 | day10.ex | starcoder |
defmodule LXD.Container do
alias LXD.Client
alias LXD.Utils
defp url(container_name \\ "", opts \\ []) do
exec = if(opts[:exec], do: "/exec", else: "")
state = if(opts[:state], do: "/state", else: "")
metadata = if(opts[:metadata], do: "/metadata", else: "")
["/containers", container_name, exec, ... | lib/endpoints/container.ex | 0.683208 | 0.439747 | container.ex | starcoder |
defmodule Cryppo.DerivedKey do
@moduledoc """
A struct for a derived encryption key and its derivation artefacts
A `Cryppo.EncryptedData` struct may be marked as belonging to a certain key derivation strategy
using field `key_derivation_strategy` containing the module of the key derivation.
A `Cryppo.Derive... | lib/cryppo/derived_key.ex | 0.895578 | 0.587529 | derived_key.ex | starcoder |
defmodule VintageNet.Connectivity.CheckLogic do
@moduledoc """
Core logic for determining internet connectivity based on check results
This module is meant to be used by `InternetChecker` and others for
determining when to run checks and how many failures should change the
network interface's state.
It im... | lib/vintage_net/connectivity/check_logic.ex | 0.831074 | 0.866923 | check_logic.ex | starcoder |
defmodule Commanded.Event.Mapper do
@moduledoc """
Map events to/from the structs used for persistence.
## Example
Map domain event structs to `Commanded.EventStore.EventData` structs in
preparation for appending to the configured event store:
events = [%ExampleEvent1{}, %ExampleEvent2{}]
event... | lib/commanded/event/mapper.ex | 0.874212 | 0.513668 | mapper.ex | starcoder |
defmodule Rheostat.Adapter do
@type key :: iodata
@type options :: [sample_rate: float, tags: [String.t()]]
@type on_send :: :ok | {:error, term}
## Metrix interface
@callback count(map(), String.t(), number()) :: any()
@callback sample(map(), String.t(), any()) :: any()
@callback measure(map(), String... | lib/adapter/adapter.ex | 0.892995 | 0.507995 | adapter.ex | starcoder |
defmodule Vantagex.Cryptocurrencies do
@moduledoc """
Contains functions related to the Cryptocurrencies functions from Alpha Vantage
"""
import Vantagex.Helper
alias Vantagex.Forex
@module_id "DIGITAL_CURRENCY"
@doc """
Uses Alpha Vantage's CURRENCY_EXCHANGE_RATE function.
Added here for simplici... | lib/vantagex/cryptocurrencies.ex | 0.895893 | 0.673863 | cryptocurrencies.ex | starcoder |
defmodule AdventOfCode.Solutions.Day11 do
@moduledoc """
Solution for day 11 exercise.
### Exercise
https://adventofcode.com/2021/day/11
"""
require Logger
def count_flashes(filename, steps) do
input =
filename
|> File.read!()
|> parse_input()
{num_flashes, _final_status} = c... | lib/advent_of_code/solutions/day11.ex | 0.644337 | 0.510313 | day11.ex | starcoder |
alias Graphqexl.Schema
alias Graphqexl.Schema.{
Field,
Interface,
Ref,
TEnum,
Type,
Union,
}
alias Graphqexl.Tokens
defmodule Graphqexl.Schema.Ref do
@moduledoc """
Struct holding a reference to a custom `t:Graphqexl.Schema.Ref.component/0`. Used by while parsing
a `t:Graphqexl.Schema.t/0` because it... | lib/graphqexl/schema/ref.ex | 0.657318 | 0.513851 | ref.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.