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 Mix.Tasks.Compile.Tyx do
# credo:disable-for-this-file Credo.Check.Readability.Specs
require Logger
use Boundary, classify_to: Tyx.Mix
use Mix.Task.Compiler
alias Mix.{Project, Task.Compiler, Utils}
alias Tyx.Mix.Typer
@preferred_cli_env :dev
@manifest_events "tyx_events"
@moduledoc """... | lib/tyx/mix/tasks/compile/tyx.ex | 0.75037 | 0.690337 | tyx.ex | starcoder |
defmodule Flop.Cursor do
@moduledoc """
Functions for encoding, decoding and extracting cursor values.
"""
@doc """
Encodes a cursor value.
iex> Flop.Cursor.encode(%{name: "Peter", email: "<EMAIL>"})
"g3QAAAACZAAFZW1haWxtAAAACnBldGVyQG1haWxkAARuYW1lbQAAAAVQZXRlcg=="
"""
@doc since: "0.8.0"
... | lib/flop/cursor.ex | 0.871338 | 0.44348 | cursor.ex | starcoder |
defmodule ExVault.Response do
@moduledoc """
Structs for the most common Vault API response formats.
Generally, the data of a response is available in a `ExVault.Response.Logical`
struct wrapped in a `ExVault.Response.Success` struct. Errors are represented
with the `ExVault.Response.Error` struct.
"""
... | lib/exvault/response.ex | 0.751557 | 0.528473 | response.ex | starcoder |
import Kernel, except: [inspect: 1]
import Inspect.Algebra
defprotocol Inspect do
@moduledoc """
The `Inspect` protocol is responsible for converting any Elixir
data structure into an algebra document. This document is then
formatted, either in pretty printing format or a regular one.
The `inspect/2` functi... | lib/elixir/lib/inspect.ex | 0.765681 | 0.60133 | inspect.ex | starcoder |
defmodule Absinthe.Phase.Document.Result do
@moduledoc false
# Produces data fit for external encoding from annotated value tree
alias Absinthe.{Blueprint, Phase, Type}
use Absinthe.Phase
@spec run(Blueprint.t | Phase.Error.t, Keyword.t) :: {:ok, map}
def run(%Blueprint{} = bp, _options \\ []) do
re... | deps/absinthe/lib/absinthe/phase/document/result.ex | 0.830216 | 0.519826 | result.ex | starcoder |
defmodule Explorer.Shared do
# A collection of **private** helpers shared in Explorer.
@moduledoc false
def backend_from_options!(opts) do
case Keyword.fetch(opts, :backend) do
{:ok, backend} when is_atom(backend) ->
backend
{:ok, other} ->
raise ArgumentError,
":ba... | lib/explorer/shared.ex | 0.834339 | 0.494812 | shared.ex | starcoder |
defmodule Plug.Router do
@moduledoc ~S"""
A DSL to define a routing algorithm that works with Plug.
It provides a set of macros to generate routes. For example:
defmodule AppRouter do
use Plug.Router
plug :match
plug :dispatch
get "/hello" do
send_resp(conn, 200... | lib/plug/router.ex | 0.895611 | 0.567757 | router.ex | starcoder |
defmodule BitcoinSimulator.BitcoinCore.Wallet do
defmodule Wallet do
defstruct [
spent_addresses: [],
unspent_addresses: Map.new(),
unspent_balance: 0.0
]
end
defmodule Address do
defstruct [
public_key: nil,
private_Key: nil,
address: nil,
value: 0.0,
... | lib/bitcoin_simulator/bitcoin_core/wallet.ex | 0.661923 | 0.512144 | wallet.ex | starcoder |
defmodule Adoptoposs.Search do
@moduledoc """
The search context provides functions for finding projects by language tag,
and name.
"""
import Ecto.Query, warn: false
alias Adoptoposs.Repo
alias Adoptoposs.Submissions.Project
alias Adoptoposs.Tags.Tag
def find_projects(query, offset: offset, limit:... | lib/adoptoposs/search.ex | 0.622918 | 0.429848 | search.ex | starcoder |
defmodule Pathex.Builder.Setter do
@moduledoc """
Module with common functions for updaters
"""
import Pathex.Common, only: [list_match: 2, pin: 1]
# Helpers
# Non variable
def create_setter({:map, key}, tail) do
pinned = pin(key)
quote do
%{unquote(pinned) => value} = map ->
%{m... | lib/pathex/builder/setter.ex | 0.589126 | 0.586227 | setter.ex | starcoder |
defmodule Sanbase.MapUtils do
def replace_lazy(map, key, value_fun) do
case Map.has_key?(map, key) do
true -> Map.put(map, key, value_fun.())
false -> map
end
end
@doc ~s"""
Return a subset of `left` map that has only the keys that are also present in `right`.
#### Examples:
iex> San... | lib/map_utils.ex | 0.782829 | 0.570391 | map_utils.ex | starcoder |
defmodule UserCounter.Impl do
@moduledoc "'Private' implementation for UserCounter"
@regions [:north_america, :south_america, :africa, :europe, :asia, :australia]
@default_regions_to_users Map.new(@regions, fn region -> {region, MapSet.new()} end)
defstruct region_to_users: @default_regions_to_users, heartbea... | lib/gen_server_example/user_counter_impl.ex | 0.764935 | 0.430686 | user_counter_impl.ex | starcoder |
defmodule EctoSearcher.Sorter do
@moduledoc """
Module for sorting
## Usage
```elixir
sortable_fields = [:name, :description]
sorted_query = EctoSearcher.Sorter.sort(SomeEctoModel, %{"field" => "name", "order" => "desc"}, sortable_fields)
MySuperApp.Repo.all(sorted_query)
```
"""
@allowed_order_va... | lib/ecto_searcher/sorter.ex | 0.827166 | 0.670554 | sorter.ex | starcoder |
defmodule Grizzly.Packet.HeaderExtension do
@moduledoc """
Functions for working with the header extension
in a Z/IP Packet.
"""
alias Grizzly.Packet.HeaderExtension.{
ExpectedDelay,
BinaryParser,
InstallationAndMaintenanceGet,
InstallationAndMaintenanceReport,
EncapsulationFormatInfo
}... | lib/grizzly/packet/header_extension.ex | 0.832713 | 0.417628 | header_extension.ex | starcoder |
defmodule CrissCrossDHT.RoutingTable.Distance do
@moduledoc false
require Bitwise
@doc """
TODO
"""
def closest_nodes(nodes, target, n) do
closest_nodes(nodes, target)
|> Enum.slice(0..n)
end
def closest_nodes(nodes, target) do
Enum.sort(nodes, fn x, y ->
xor_cmp(x.hashed_id, y.hash... | lib/criss_cross_dht/routing_table/distance.ex | 0.577614 | 0.514034 | distance.ex | starcoder |
defmodule Rummage.Ecto do
@moduledoc """
Rummage.Ecto is a light weight, but powerful framework that can be used to alter Ecto
queries with Search, Sort and Paginate operations.
It accomplishes the above operations by using `Hooks`, which are modules that
implement `Rummage.Ecto.Hook` behavior. Each operatio... | lib/rummage_ecto.ex | 0.775095 | 0.827689 | rummage_ecto.ex | starcoder |
defmodule AdventOfCode.Day11 do
@moduledoc false
use AdventOfCode
defmodule Point, do: defstruct(value: nil, coordinates: nil, neighbors: [])
def part1(input), do: preprocess_input(input) |> step(0, 99) |> elem(1)
def part2(input, grid \\ nil, current_step \\ 0) do
grid =
(grid || preprocess_inpu... | lib/day11.ex | 0.642769 | 0.546859 | day11.ex | starcoder |
defmodule InetTcp_dist do
@moduledoc """
This module replaces the standard `:inet_tcp_dist` from Erlang and introduces a new function call
to replace DNS lookups for Erlang Distribution. The EPMD module is required to have this function
implemented. It is not checked during compilation since the callback is don... | lib/inet_tcp_dist.ex | 0.627951 | 0.401746 | inet_tcp_dist.ex | starcoder |
defmodule AWS.WAF.Regional do
@moduledoc """
This is the *AWS WAF Regional API Reference* for using AWS WAF with Elastic
Load Balancing (ELB) Application Load Balancers. The AWS WAF actions and
data types listed in the reference are available for protecting Application
Load Balancers. You can use these actio... | lib/aws/waf_regional.ex | 0.841891 | 0.685785 | waf_regional.ex | starcoder |
defmodule Kuddle.Decoder do
@moduledoc """
Tokenizes and parses KDL documents into kuddle documents.
"""
alias Kuddle.Value
alias Kuddle.Node
import Kuddle.Tokenizer
import Kuddle.Utils
@typedoc """
Parsed tokens from the Tokenizer, these will be processed and converted into the final nodes for
th... | lib/kuddle/decoder.ex | 0.766556 | 0.67852 | decoder.ex | starcoder |
import TypeClass
defclass Witchcraft.Monoid do
@moduledoc ~S"""
Monoid extends the semigroup with the concept of an "empty" or "zero" element.
## Type Class
An instance of `Witchcraft.Monoid` must also implement `Witchcraft.Semigroup`,
and define `Witchcraft.Monoid.empty/1`.
Semigroup [append/2]
... | lib/witchcraft/monoid.ex | 0.763351 | 0.551574 | monoid.ex | starcoder |
defmodule Mox.Server do
@moduledoc false
use GenServer
@timeout 30000
# API
def start_link(_options) do
GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
end
def add_expectation(owner_pid, key, value) do
GenServer.call(__MODULE__, {:add_expectation, owner_pid, key, value}, @timeout)
en... | lib/mox/server.ex | 0.5769 | 0.412353 | server.ex | starcoder |
defmodule Phoenix.Component do
@moduledoc """
API for function components.
A function component is any function that receives
an assigns map as argument and returns a rendered
struct built with the `~H` sigil.
Here is an example:
defmodule MyComponent do
use Phoenix.Component
# Opt... | lib/phoenix_component.ex | 0.88143 | 0.589894 | phoenix_component.ex | starcoder |
defmodule Membrane.RTP.Parser do
@moduledoc """
Identifies RTP/RTCP packets, then tries to parse RTP packet (parsing header and preparing payload)
and forwards RTCP packet to `:rtcp_output` pad unchanged.
## Encrypted packets
In case of SRTP/SRTCP the parser tries to parse just the header of the RTP packet a... | lib/membrane/rtp/parser.ex | 0.845528 | 0.546073 | parser.ex | starcoder |
defmodule RedixPool do
@moduledoc """
This module provides an API for using `Redix` through a pool of workers.
## Overview
`RedixPool` is very simple, it is merely wraps `Redix` with a pool of `Poolboy`
workers. All function calls get passed through to a `Redix` connection.
Please see the [redix](https:/... | lib/redix_pool.ex | 0.898813 | 0.425426 | redix_pool.ex | starcoder |
defmodule OMG.Watcher.ExitProcessor.Finalizations do
@moduledoc """
Encapsulates managing and executing the behaviors related to treating exits by the child chain and watchers
Keeps a state of exits that are in progress, updates it with news from the root chain, compares to the
state of the ledger (`OMG.State`... | apps/omg_watcher/lib/omg_watcher/exit_processor/finalizations.ex | 0.714329 | 0.591959 | finalizations.ex | starcoder |
defmodule AWS.CodeCommit do
@moduledoc """
AWS CodeCommit
This is the *AWS CodeCommit API Reference*.
This reference provides descriptions of the operations and data types for AWS
CodeCommit API along with usage examples.
You can use the AWS CodeCommit API to work with the following objects:
Reposito... | lib/aws/generated/code_commit.ex | 0.883676 | 0.601886 | code_commit.ex | starcoder |
defmodule DataMiner.Apriori do
@moduledoc """
Documentation for `Apriori` Algorithm Implementation.
"""
@transactions_file Path.expand("../data/transactions_items.txt")
@frequencies_file Path.expand("../data/items_frequencies.txt")
@result_save_file Path.expand("../results/apriori_frequents.txt")
@doc "... | data_miner/lib/apriori.ex | 0.842992 | 0.61503 | apriori.ex | starcoder |
defmodule Bitcoinex.Secp256k1.Point do
@moduledoc """
Contains the x, y, and z of an elliptic curve point.
"""
@type t :: %__MODULE__{
x: integer(),
y: integer(),
z: integer()
}
@enforce_keys [
:x,
:y
]
defstruct [:x, :y, z: 0]
defguard is_point(term)
... | lib/secp256k1/point.ex | 0.851135 | 0.584153 | point.ex | starcoder |
defmodule AWS.S3 do
@moduledoc """
<p/>
"""
@doc """
This operation aborts a multipart upload. After a multipart upload is
aborted, no additional parts can be uploaded using that upload ID. The
storage consumed by any previously uploaded parts will be freed. However,
if any part uploads are currently ... | lib/aws/s3.ex | 0.79732 | 0.48438 | s3.ex | starcoder |
defmodule Rondo.State do
defstruct [:descriptor, :partial, :children, :cache, :root]
defmodule Pointer do
defstruct [:path]
end
def init(nil, descriptor, component_path, store) do
init(%__MODULE__{cache: %{}}, descriptor, component_path, store)
end
def init(%{descriptor: descriptor} = state, descr... | lib/rondo/state.ex | 0.622 | 0.609088 | state.ex | starcoder |
defmodule Adventofcode.Day22SporificaVirus do
use Adventofcode
@enforce_keys [:grid, :width, :height, :burst]
defstruct grid: MapSet.new(),
width: 0,
height: 0,
position: {0, 0},
direction: {0, -1},
burst: {0, nil},
infections: 0
def burs... | lib/day_22_sporifica_virus.ex | 0.645343 | 0.614105 | day_22_sporifica_virus.ex | starcoder |
defmodule Quantum.Scheduler do
@moduledoc """
Defines a quantum Scheduler.
When used, the quantum scheduler expects the `:otp_app` as option.
The `:otp_app` should point to an OTP application that has
the quantum runner configuration. For example, the quantum scheduler:
defmodule MyApp.Scheduler do
... | lib/quantum/scheduler.ex | 0.879529 | 0.470007 | scheduler.ex | starcoder |
defmodule Timex.Timezone.Dst do
@moduledoc """
Rules for determining if a datetime falls within a daylight savings period.
"""
alias Timex.Date, as: Date
alias Timex.DateTime, as: DateTime
alias Timex.TimezoneInfo, as: TimezoneInfo
@doc """
Check if the provided datetime is in daylight sav... | lib/timezone/timezone_dst.ex | 0.787727 | 0.686413 | timezone_dst.ex | starcoder |
defmodule GitOps.Commit do
@moduledoc """
Manages the structure, parsing, and formatting of commits.
Using `parse/1` you can parse a commit struct out of a commit message
Using `format/1` you can format a commit struct in the way that the
changelog expects.
"""
import NimbleParsec
defstruct [:type, :... | lib/git_ops/commit.ex | 0.658527 | 0.405243 | commit.ex | starcoder |
defmodule Surface.Compiler do
@moduledoc """
Defines a behaviour that must be implemented by all HTML/Surface node translators.
This module also contains the main logic to translate Surface code.
"""
alias Surface.Compiler.Parser
alias Surface.IOHelper
alias Surface.AST
alias Surface.Compiler.Helpers
... | lib/surface/compiler.ex | 0.781497 | 0.429908 | compiler.ex | starcoder |
defmodule Shopix.Schema.Order do
use Ecto.Schema
alias Shopix.Schema.{Order, LineItem}
schema "orders" do
has_many :line_items, LineItem, on_replace: :delete
field :email, :string
field :first_name, :string
field :last_name, :string
field :company_name, :string
field :address_1, :strin... | lib/shopix/schema/order.ex | 0.502197 | 0.41478 | order.ex | starcoder |
defmodule OliWeb.Common.Hierarchy.HierarchyPicker do
@moduledoc """
Hierarchy Picker Component
A general purpose curriculum location picker. When a new location is selected,
this component will trigger an "HierarchyPicker.update_selection" event to the parent liveview
with the new selection.
### Multi-Pub... | lib/oli_web/live/common/hierarchy/hierarchy_picker.ex | 0.69285 | 0.410018 | hierarchy_picker.ex | starcoder |
defmodule Xfile do
@moduledoc """
`Xfile` contains augmentations of the built-in `File` module, including the
support of streams, the recursive listing of files, counting lines, grep, and
programmatic filtering.
"""
@doc """
Like the venerable command-line utility, `grep` searches lines in the given file... | lib/xfile.ex | 0.865437 | 0.566258 | xfile.ex | starcoder |
defmodule Tub.Absinthe.Schema do
@moduledoc """
Generate Absinthe Schema
Usage:
```elixir
name = "q1"
doc = "hello world"
params = [
{:f1, :string, nullable: false, doc: "arg1"},
{:f1, :string, nullable: true, doc: "arg2"},
]
return = :list_blocks
meta = notation: "OcapApi.GQL.Notation.Bit... | lib/gen/absinthe/schema.ex | 0.702836 | 0.67875 | schema.ex | starcoder |
defmodule RDF.XSD.Numeric do
@moduledoc """
Collection of functions for numeric literals.
"""
@type t :: module
alias RDF.{XSD, Literal}
alias Elixir.Decimal, as: D
import Kernel, except: [abs: 1, floor: 1, ceil: 1]
defdelegate datatype?(value), to: Literal.Datatype.Registry, as: :numeric_datatype?
... | lib/rdf/xsd/datatypes/numeric.ex | 0.928733 | 0.789356 | numeric.ex | starcoder |
defmodule Resx.Producers.Data do
@moduledoc """
A producer to handle data URIs.
Resx.Producers.Data.open("data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D")
### Media Types
If an error is being returned when attempting to open a data URI due to
`{ :invalid_reference, "invalid media... | lib/resx/producers/data.ex | 0.835114 | 0.470919 | data.ex | starcoder |
defmodule OMG.Utxo.Position do
@moduledoc """
Representation of a UTXO position in the child chain, providing encoding/decoding to/from formats digestible in `Eth`
and in the `OMG.DB`
"""
# these two offset constants are driven by the constants from the RootChain.sol contract
@input_pointer_output_type 1
... | apps/omg/lib/omg/utxo/position.ex | 0.855384 | 0.480966 | position.ex | starcoder |
defmodule DateTimeParser.Serial do
@moduledoc false
def parse(string) do
if String.contains?(string, ".") do
with {float, _} <- Float.parse(string) do
{:ok, [serial: float], nil, nil, nil, nil}
end
else
with {integer, _} <- Integer.parse(string) do
{:ok, [serial: integer],... | lib/serial.ex | 0.790207 | 0.422654 | serial.ex | starcoder |
if Code.ensure_loaded?(:pbkdf2) do
defmodule Cloak.Fields.PBKDF2 do
@moduledoc """
A custom `Ecto.Type` for deriving a key for fields using
[PBKDF2](https://en.wikipedia.org/wiki/PBKDF2).
PBKDF2 is **more secure** than `Cloak.Fields.HMAC` and
`Cloak.Fields.SHA256` because it uses [key
stretch... | lib/cloak/fields/pbkdf2.ex | 0.861494 | 0.567337 | pbkdf2.ex | starcoder |
defmodule Type.Opaque do
@moduledoc """
a wrapper for opaqueness.
"""
@enforce_keys [:module, :name, :params, :type]
defstruct @enforce_keys
@type t :: %__MODULE__{
module: module,
name: atom,
params: [Type.t],
type: Type.t
}
import Type, only: [builtin: 1]
defimpl Type.Properties... | lib/type/opaque.ex | 0.541773 | 0.567128 | opaque.ex | starcoder |
defmodule Mix.Tasks.Ggity.Visual.Geom.Text do
@shortdoc "Launch a browser and draw sample text geom plots."
@moduledoc @shortdoc
use Mix.Task
alias GGity.{Examples, Plot}
@default_browser "firefox"
@doc false
@spec run(list(any)) :: any()
def run([]), do: run([@default_browser])
def run(argv) do
... | lib/mix/tasks/ggity_visual_geom_text.ex | 0.879367 | 0.400661 | ggity_visual_geom_text.ex | starcoder |
defmodule Upvest.API do
@moduledoc """
Shared utilities for interacting with the Upvest API.
It contains shared implementations of endpoints methods for
creating, listing, retrieving and deleting resources. Where possible,
transforms the raw result from the Upvest API into a final struct. This is achieved ... | lib/upvest/api.ex | 0.849691 | 0.437343 | api.ex | starcoder |
defmodule IEx.History do
@moduledoc false
alias IEx.History
defstruct queue: :queue.new(), size: 0, start: 1
@doc """
Initializes IEx history state.
"""
def init(), do: %History{}
@doc """
Appends one entry to the history.
"""
def append(%History{} = state, entry, limit) do
{collect?, stat... | lib/iex/lib/iex/history.ex | 0.781747 | 0.448124 | history.ex | starcoder |
defmodule NorwegianIdNumber do
@moduledoc """
Useful information extracted from Norwegian national identification number.
From 2017, checksum is included to the personal number and no longer validated.
"""
@type id_type :: :fh_number | :d_number | :h_number | :birth_number
defstruct [:id_type, :birth_da... | lib/norwegian_id_number.ex | 0.791459 | 0.550305 | norwegian_id_number.ex | starcoder |
defmodule Validix.Pipeline do
alias Validix.Source
alias Validix.Stage
alias Validix.Type
@protocol_fun_arity 5
## Generate a static pipeline from the app config
pipeline = Application.get_env(:validix, :pipeline, [])
@spec pipeline() :: [Stage.t]
def pipeline() do
unquote(pipeline)
end
... | lib/validix/pipeline.ex | 0.586523 | 0.461017 | pipeline.ex | starcoder |
defmodule Metalove.MediaParser do
alias Metalove.MediaParser.ID3
@moduledoc false
def extract_id3_metadata(filename) do
bytes = File.read!(filename)
ID3.parse(bytes)
end
end
defmodule Metalove.MediaParser.ID3 do
@moduledoc """
ID3 parser for podcast relevant metadata.
"""
@doc """
Parse ... | lib/metalove/media_parser.ex | 0.719482 | 0.443179 | media_parser.ex | starcoder |
defprotocol Workex.Aggregate do
@moduledoc """
Specifies the protocol used by `Workex` behaviour to aggregate incoming messages.
"""
@doc "Value that contains aggregated messages which are passed to the worker process."
@type value :: any
@doc "Adds the new item to the aggregate."
@spec add(t, any) :: t... | lib/workex/aggregate.ex | 0.905424 | 0.599632 | aggregate.ex | starcoder |
defmodule Absinthe.Language.IDL do
@moduledoc false
alias Absinthe.{Schema, Language, Type}
@spec to_idl_ast(atom) :: Language.Document.t
def to_idl_ast(schema) do
%Language.Document{
definitions: Enum.map(Enum.reject(Absinthe.Schema.types(schema), &Absinthe.Type.built_in?/1), &to_idl_ast(&1, schema... | lib/absinthe/language/idl.ex | 0.54819 | 0.437463 | idl.ex | starcoder |
defmodule Exvalidate.Rules.Between do
@moduledoc """
The field under validation must have a size between the given min and max.
- Strings: length is between those values.
- Numerics: value is between those values.
- Lists: length of array is between those values.
- Tuple: length of tuple is between those v... | lib/workflow/rules/between.ex | 0.903651 | 0.972467 | between.ex | starcoder |
defmodule Phoenix.View do
alias Phoenix.Html
alias Phoenix.Naming
@moduledoc """
Serves as the base view for an entire Phoenix application view layer
Users define `App.Views` and `use Phoenix.View`. The main view:
* Serves as a base presentation layer for all views and templates
* Wires up the Temp... | lib/phoenix/view.ex | 0.87068 | 0.427516 | view.ex | starcoder |
defmodule Membrane.AAC.Parser.Helper do
@moduledoc false
# Resources:
# https://wiki.multimedia.cx/index.php/ADTS
use Bunch
alias Membrane.{AAC, Buffer, Time}
@header_size 7
@crc_size 2
@spec parse_adts(binary, AAC.t(), AAC.Parser.timestamp_t(), %{
samples_per_frame: AAC.samples_per_frame_t(... | lib/membrane/aac/parser/helper.ex | 0.79158 | 0.441613 | helper.ex | starcoder |
defmodule Requiem do
@moduledoc """
## Description
This is Elixir framework for running QuicTransport(WebTransport over QUIC) server.
- https://w3c.github.io/webtransport/
- https://tools.ietf.org/html/draft-vvv-webtransport-quic-02
This library depends on [cloudflare/quiche](https://github.com/cloudflar... | lib/requiem.ex | 0.799833 | 0.806243 | requiem.ex | starcoder |
defmodule Tracer do
@moduledoc """
**Tracer** is a tracing framework for elixir which features an easy to use high level interface, extensibility and safety for using in production.
To run a tool use the `run` command. Tracing only happens when the tool is running.
All tools accept the following parameters:
... | lib/tracer.ex | 0.9026 | 0.798187 | tracer.ex | starcoder |
defmodule Infer.Ecto.Query.Builder do
@moduledoc """
Internal data structure to keep track of all context needed to translate complex Infer
rules to Ecto queries.
## Context switches
### Evaluate rule on other subject
- Can not access existing aliases
- Reset path
- Keep only next alias index
### ... | lib/infer/ecto/query/builder.ex | 0.776284 | 0.437283 | builder.ex | starcoder |
defmodule VintageNetMobile.Modem.UbloxTOBYL2 do
@behaviour VintageNetMobile.Modem
@moduledoc """
# u-blox TOBY-L2 support
The u-blox TOBY-L2 is a series of LTE Cat 4 modules with HSPA+ and/or 2G
fallback. Here's an example configuration:
```elixir
VintageNet.configure(
"ppp0",
%{
type: Vi... | lib/vintage_net_mobile/modem/ublox_TOBY_L2.ex | 0.819713 | 0.730866 | ublox_TOBY_L2.ex | starcoder |
defmodule XmlJson.SaxHandler do
@moduledoc """
A generic Sax handler that creates a basic JSON version out of an XML document
"""
@behaviour Saxy.Handler
def parse_string(xml) do
case Saxy.parse_string(xml, __MODULE__, []) do
{:ok, _} = ok ->
ok
{:halt, state, rest} ->
{:erro... | lib/xml_json/sax_handler.ex | 0.751739 | 0.414336 | sax_handler.ex | starcoder |
defmodule Jeff.Command.LedSettings do
@moduledoc """
Reader LED control command
OSDP v2.2 Specification Reference: 6.10
Temporary Control Code Values
| Code | Description
|------|----------------------------------------------------------------------------------------------------------------------|
| 0x... | lib/jeff/command/led_settings.ex | 0.786541 | 0.568895 | led_settings.ex | starcoder |
defmodule Codenamex.Game.Dictionary do
@moduledoc """
This module manages the game dictionary.
We can fetch words from this module with a call to fetch/1.
"""
@words [
"Hollywood",
"Screen",
"Play",
"Marble",
"Dinosaur",
"Cat",
"Pitch",
"Bond",
"Greece",
"Deck",
"S... | lib/codenamex/game/dictionary.ex | 0.589835 | 0.604545 | dictionary.ex | starcoder |
defmodule LindaEx do
@moduledoc """
GenServer implementation of Linda-style tuple spaces.
Uses an ETS table internally.
"""
@type space :: :ets.tab
@type template :: tuple | :ets.match_spec | :'_'
use GenServer
@spec start_link(atom) :: GenServer.on_start
def start_link(name) do
GenServer.star... | lib/lindaex/tuple_space.ex | 0.79653 | 0.612194 | tuple_space.ex | starcoder |
defmodule Jsonpatch do
@moduledoc """
A implementation of [RFC 6902](https://tools.ietf.org/html/rfc6902) in pure Elixir.
The patch can be a single change or a list of things that shall be changed. Therefore
a list or a single JSON patch can be provided. Every patch belongs to a certain operation
which influ... | lib/jsonpatch.ex | 0.912292 | 0.510374 | jsonpatch.ex | starcoder |
defmodule Noizu.UserSettings.Setting do
@type t :: %__MODULE__{
setting: atom,
stack: Map.t,
}
defstruct [
setting: nil,
stack: %{}
]
#--------------------------------------------
# append/4
#--------------------------------------------
... | lib/user_settings/setting.ex | 0.677047 | 0.486027 | setting.ex | starcoder |
defmodule ScrapyCloudEx.Endpoints.Storage.JobQ do
@moduledoc """
Wraps the [JobQ](https://doc.scrapinghub.com/api/jobq.html) endpoint.
The JobQ API allows you to retrieve finished jobs from the queue.
"""
import ScrapyCloudEx.Endpoints.Guards
alias ScrapyCloudEx.Endpoints
alias ScrapyCloudEx.Endpoints.... | lib/endpoints/storage/job_q.ex | 0.912456 | 0.829871 | job_q.ex | starcoder |
defmodule Snmp.Agent do
@moduledoc """
Use this module to generate an Agent module you can insert in your supervision
tree.
## DSL
See `Snmp.Agent.DSL`.
## Configuration
When using this module, you need to provide `:otp_app` option. Agent
environment will be get with: `Application.get_env(<otp_app>,... | lib/snmp/agent.ex | 0.868702 | 0.692278 | agent.ex | starcoder |
defmodule Tai.Venues.Boot do
@moduledoc """
Coordinates the asynchronous hydration of a venue:
- products
- asset balances
- fees
"""
alias Tai.Venues.Boot
@type adapter :: Tai.Venues.Adapter.t()
@spec run(adapter :: adapter) :: {:ok, adapter} | {:error, {adapter, [reason :: term]}}
def run(%Tai... | apps/tai/lib/tai/venues/boot.ex | 0.723505 | 0.438545 | boot.ex | starcoder |
defmodule Meca do
use GenServer
@moduledoc """
Module for communicating and controlling a Mecademic Robot over TCP.
## Example
{:ok, pid} = Meca.start(%{host: '127.0.0.1', port: 10000})
Meca.activate_robot(pid)
Meca.home(pid)
Meca.set_blending(pid, 0)
Meca.set_joint_vel(pid, 10... | lib/meca.ex | 0.811265 | 0.556159 | meca.ex | starcoder |
defmodule Membrane.MP4.MovieBox.TrackBox do
@moduledoc """
A module containing a set of utilities for assembling an MPEG-4 track box.
The track box (`trak` atom) describes a single track of a presentation. This description includes
information like its timescale, duration, volume, media-specific data (media ha... | lib/membrane_mp4/movie_box/track_box.ex | 0.896863 | 0.513059 | track_box.ex | starcoder |
defmodule Linkify.Parser do
@moduledoc """
Module to handle parsing the the input string.
"""
alias Linkify.Builder
@invalid_url ~r/(\.\.+)|(^(\d+\.){1,2}\d+$)/
@match_url ~r{^(?:\W*)?(?<url>(?:https?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~%:\/?#[\]@!\$&'\(\)\*\+,;=.]+$)}u
@get_scheme_host ~r{^\W*(?<sch... | lib/linkify/parser.ex | 0.601828 | 0.427576 | parser.ex | starcoder |
defmodule BankAccount do
@moduledoc """
An example bank account aggregate root.
It demonstrates returning either an `{:ok, aggregate}` or `{:error, reason}` tuple from the public API functions on success or failure.
Following this approach allows strict pattern matching on success and failures.
An error ind... | test/example/bank_account.ex | 0.879276 | 0.816699 | bank_account.ex | starcoder |
defmodule ExPixBRCode.Payments.Models.DynamicImmediatePixPayment do
@moduledoc """
A dynamic immediate Pix payment.
This payment structure is the result of loading it from a Pix endpoint.
"""
use ExPixBRCode.ValueObject
alias ExPixBRCode.Changesets
@required [:revisao, :chave, :txid, :status]
@optio... | lib/ex_pix_brcode/payments/models/dynamic_immediate_pix_payment.ex | 0.731251 | 0.441673 | dynamic_immediate_pix_payment.ex | starcoder |
defprotocol Sanbase.Alert.Settings do
@moduledoc ~s"""
A protocol that must be implemented by all trigger settings.
Every trigger has settings that define how it is evaluated, how it's cached
and how to check if the evaluated alert is triggered.
After creating the module 3 things should be done in order to ... | lib/sanbase/alerts/trigger/trigger.ex | 0.884458 | 0.456289 | trigger.ex | starcoder |
defmodule AWS.ECS do
@moduledoc """
Amazon EC2 Container Service (Amazon ECS) is a highly scalable, fast,
container management service that makes it easy to run, stop, and manage
Docker containers on a cluster of EC2 instances. Amazon ECS lets you launch
and stop container-enabled applications with simple AP... | lib/aws/ecs.ex | 0.911979 | 0.620593 | ecs.ex | starcoder |
defmodule Geo.JSON.Decoder do
@moduledoc false
alias Geo.{
Point,
PointZ,
LineString,
Polygon,
MultiPoint,
MultiLineString,
MultiPolygon,
MultiPolygonZ,
GeometryCollection
}
defmodule DecodeError do
@type t :: %__MODULE__{message: String.t(), value: any}
defexcepti... | lib/geo/json/decoder.ex | 0.858852 | 0.63583 | decoder.ex | starcoder |
defmodule PlugAttack.Rule do
@moduledoc """
Defines various rules that can be used inside the `PlugAttack.rule/2` macro.
"""
@doc """
The simplest rule that always allows the request to pass.
If `value` is truthy the request is allowed, otherwise next rules are
evaluated.
"""
@spec allow(term) :: Pl... | lib/rule.ex | 0.884377 | 0.628194 | rule.ex | starcoder |
defmodule Commanded.EventStore do
@moduledoc """
Defines the behaviour to be implemented by an event store adapter to be used by Commanded.
"""
alias Commanded.EventStore.{EventData, RecordedEvent, SnapshotData}
@type stream_uuid :: String.t()
@type start_from :: :origin | :current | integer
@type expec... | lib/commanded/event_store/event_store.ex | 0.916335 | 0.513425 | event_store.ex | starcoder |
defmodule Cldr.Timezone do
@moduledoc """
Functions to map between the CLDR short time zone code and the
IANA timezone names.
The Unicode [locale](https://unicode.org/reports/tr35/#Locale)
[extension U](https://unicode.org/reports/tr35/#u_Extension)
allows the specification of the time zone requested for t... | lib/cldr/timezone.ex | 0.857127 | 0.494263 | timezone.ex | starcoder |
defmodule Braintree.Merchant.Account do
@moduledoc """
Represents a merchant account in a marketplace.
For additional reference, see:
https://developers.braintreepayments.com/reference/response/merchant-account/ruby
"""
use Braintree.Construction
alias Braintree.HTTP
alias Braintree.ErrorResponse, as... | lib/merchant/account.ex | 0.896457 | 0.460956 | account.ex | starcoder |
defmodule MailgunLogger.Event do
@moduledoc """
Event data to store in the database.
Mailgun api output:
```
%{
"campaigns" => [],
"envelope" => %{
"sender" => "<EMAIL>",
"targets" => "<EMAIL>",
"transport" => "smtp"
},
"event" => "accepted",
"flags" => %{
"is-auth... | lib/mailgun_logger/events/event.ex | 0.651798 | 0.441011 | event.ex | starcoder |
defmodule WebSockex.Frame do
@moduledoc """
Functions for parsing and encoding frames.
"""
import Bitwise
@type opcode :: :text | :binary | :close | :ping | :pong
@type close_code :: 1000..4999
@typedoc "The incomplete or unhandled remainder of a binary"
@type buffer :: bitstring
@typedoc "This is... | lib/websockex/frame.ex | 0.604049 | 0.418935 | frame.ex | starcoder |
defmodule AdventOfCode.Y2020.Day14 do
@bits 36
def test_data() do
"""
mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X
mem[8] = 11
mem[7] = 101
mem[8] = 0
"""
|> String.split("\n", trim: true)
end
def test_data2() do
"""
mask = 000000000000000000000000000000X1001X
mem[42] = ... | lib/2020/day14.ex | 0.583322 | 0.492127 | day14.ex | starcoder |
defmodule Timex.Time do
@moduledoc """
This module provides a friendly API for working with Erlang
timestamps, i.e. `{megasecs, secs, microsecs}`. In addition,
it provides an easy way to wrap the measurement of function
execution time (via `measure`).
"""
alias Timex.Types
use Timex.Constants
import T... | lib/time/time.ex | 0.886838 | 0.774647 | time.ex | starcoder |
defmodule Scenic.Scrollable.Acceleration do
@moduledoc """
Module for calculating the scroll speed for `Scenic.Scrollable` components.
"""
alias Scenic.Math.Vector2
@typedoc """
Shorthand for `t:Scenic.Math.vector_2/0`.
Consists of a tuple containing the x and y numeric values.
"""
@type v2 :: Sceni... | lib/utility/acceleration.ex | 0.946001 | 0.898944 | acceleration.ex | starcoder |
defmodule Arangoex.Graph do
@moduledoc """
This module contains functions used to manage graph structures, vertex document collections, and edge document
collections.
"""
@doc """
Add an edge definition to the given graph.
The `conn` parameter is an ArangoDB connection PID. The `graph_name` paramter is... | lib/arangoex/graph.ex | 0.93396 | 0.767363 | graph.ex | starcoder |
defmodule Level10.StateHandoff do
@moduledoc """
Whenever a SIGTERM is received, this GenServer is used to store the state of
the games on the local node across the entire cluster so that it can be
replicated in new nodes once this one goes down.
"""
use GenServer
require Logger
alias Level10.StateHan... | lib/level10/state_handoff.ex | 0.66454 | 0.484075 | state_handoff.ex | starcoder |
defmodule Helios.Router.Aggregate do
@moduledoc false
alias Helios.Router.Aggregate
@default_param_key "id"
@doc """
The `Phoenix.Router.Resource` struct. It stores:
* `:path` - the path as string (not normalized)
* `:commands` - the commands to which only this aggregate should repspond to
* `:p... | lib/helios/router/aggregate.ex | 0.688049 | 0.406391 | aggregate.ex | starcoder |
defmodule Predicator.Machine do
@moduledoc """
A Machine Struct is comprised of the instructions set, the current stack, the instruction pointer and the context struct.
iex>%Predicator.Machine{}
%Predicator.Machine{instructions: [], stack: [], instruction_pointer: 0, context: nil, opts: []}
"""
alias P... | lib/predicator/machine.ex | 0.739046 | 0.541894 | machine.ex | starcoder |
defmodule Surface.LiveView do
@moduledoc """
A wrapper component around `Phoenix.LiveView`.
Since this module is just a wrapper around `Phoenix.LiveView`, you
cannot define custom properties for it. Only `:id` and `:session`
are available. However, built-in directives like `:for` and `:if`
can be used norm... | lib/surface/live_view.ex | 0.909782 | 0.409988 | live_view.ex | starcoder |
defmodule ExOAPI.EctoTypes.TypedEnum do
defmacro __before_compile__(_env) do
# these are inserted in the before_compile hook to give opportunity to the
# implementing module to define additional variations
quote do
def cast(_), do: :error
def dump(_), do: :error
defp get_term(data), do: ... | lib/ex_oapi/parser/ecto_types/typed_enum.ex | 0.738386 | 0.543711 | typed_enum.ex | starcoder |
defmodule MetarMap.Timeline do
defstruct transitions: [], latest_value: nil, interpolate_fun: nil
defmodule Transition do
defstruct [:start_at, :start_value, :end_at, :end_value]
end
def init(initial_value, interpolate_fun) do
%__MODULE__{latest_value: initial_value, interpolate_fun: interpolate_fun}
... | lib/metar_map/timeline.ex | 0.847527 | 0.624737 | timeline.ex | starcoder |
defmodule Benchee.Benchmark.Runner do
@moduledoc """
Internal module "running" a scenario, measuring all defined measurements.
"""
# This module actually runs our benchmark scenarios, adding information about
# run time and memory usage to each scenario.
alias Benchee.{Benchmark, Configuration, Scenario, ... | lib/benchee/benchmark/runner.ex | 0.842831 | 0.433142 | runner.ex | starcoder |
defmodule AWS.Evidently do
@moduledoc """
You can use Amazon CloudWatch Evidently to safely validate new features by
serving them to a specified percentage of your users while you roll out the
feature.
You can monitor the performance of the new feature to help you decide when to
ramp up traffic to your us... | lib/aws/generated/evidently.ex | 0.829077 | 0.505005 | evidently.ex | starcoder |
defmodule StrawHat.Review.Reactions do
@moduledoc """
Interactor module that defines all the functionality for Reactions management.
"""
use StrawHat.Review.Interactor
alias StrawHat.Review.Reaction
@doc """
Gets the list of reactions.
"""
@spec get_reactions(Scrivener.Config.t() | keyword()) :: Scr... | lib/straw_hat_review/reactions/reactions.ex | 0.88521 | 0.428114 | reactions.ex | starcoder |
defmodule Trigger do
@moduledoc """
A simple way to sync between processes.
"""
@enforce_keys [:ref, :receiver]
defstruct [:ref, :receiver]
@typedoc """
A Trigger data type.
"""
@opaque t() :: %Trigger{
ref: reference(), # unique reference for the trigger
receiver: Process.dest(), # ... | lib/trigger.ex | 0.925162 | 0.535584 | trigger.ex | starcoder |
defmodule State.Stop do
@moduledoc """
State for Stops. Supervises a cache as well as workers
for the R* tree for geo lookups.
"""
use Supervisor
alias Model.{Stop, WGS84}
alias State.{Route, RoutesPatternsAtStop, ServiceByDate, StopsOnRoute}
@worker_count 5
@type filter_opts :: %{
optiona... | apps/state/lib/state/stop.ex | 0.800224 | 0.446977 | stop.ex | starcoder |
defmodule Multiset do
@moduledoc """
Functions for working with [multisets](https://en.wikipedia.org/wiki/Multiset), i.e. sets allowing
multiple instances of values.
The number of instances of a value in a multiset is called the _multiplicity_ of the value.
The `Multiset` is represented internally as a stru... | lib/multiset.ex | 0.943595 | 0.865452 | multiset.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.