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 Saltpack.Armor do
@moduledoc """
Armoring
"""
@armorer BaseX.prepare_module(
"Base62Armor",
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
32
)
@typedoc """
A keyword list with formatting options
- `app`: the application nam... | lib/saltpack/armor.ex | 0.818483 | 0.722967 | armor.ex | starcoder |
defmodule SurfaceBootstrap.Modal do
use Surface.LiveComponent
alias SurfaceBootstrap.Button
alias Surface.Components.Raw
@moduledoc """
The Bootstrap **modal**, with various configuration options.
This component relies on Bootstrap Native and requires to follow the instructions in the Readme file to use.... | lib/surface_bootstrap/modal.ex | 0.674908 | 0.611701 | modal.ex | starcoder |
defmodule Meeseeks.Selector.XPath.Expr.Helpers do
@moduledoc false
alias Meeseeks.{Context, Document}
@nodes Context.nodes_key()
@other_nums [:NaN, :Infinity, :"-Infinity"]
# eq_fmt
def eq_fmt(x, y, document) when is_list(x) or is_list(y) do
nodes_fmt(x, y, document)
end
def eq_fmt(x, y, docume... | lib/meeseeks/selector/xpath/expr/helpers.ex | 0.682362 | 0.442456 | helpers.ex | starcoder |
defmodule Cashtrail.Contacts.Address do
@moduledoc """
This is an `Ecto.Schema` struct that represents an address of the contact.
## Fields
* `:id` - The unique id of the address.
* `:street` - street part of the address.
* `:number` - number part of the address.
* `:complement` - complement part of the... | apps/cashtrail/lib/cashtrail/contacts/address.ex | 0.839158 | 0.753625 | address.ex | starcoder |
defmodule APIacAuthBearer.Validator.JWT do
@moduledoc """
An implementation of [RFC9068 - JSON Web Token (JWT) Profile for OAuth 2.0 Access Tokens](https://tools.ietf.org/html/draft-ietf-oauth-access-token-jwt-07).
This validator accepts the following options:
- `:issuer` **[mandatory]**: an OAuth2 issuer whos... | lib/validator/jwt.ex | 0.844377 | 0.441673 | jwt.ex | starcoder |
defmodule HL7.V2_3_1.Segments.OM1 do
@moduledoc false
require Logger
alias HL7.V2_3_1.{DataTypes}
use HL7.Segment,
fields: [
segment: nil,
sequence_number_test_observation_master_file: nil,
producers_test_observation_id: DataTypes.Ce,
permitted_data_types: nil,
specimen_requi... | lib/hl7/2.3.1/segments/om1.ex | 0.630002 | 0.441793 | om1.ex | starcoder |
defmodule MhZ19 do
@moduledoc File.read!("./README.md") |> String.replace(~r/^# .+\n\n/, "")
use GenServer
alias Circuits.UART
@commands [
co2_concentration: <<0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79>>
]
@typedoc """
MhZ19 GenServer start_link options
* `:name` - a name for the GenSe... | lib/mh_z19.ex | 0.75183 | 0.703282 | mh_z19.ex | starcoder |
defmodule Rtmp.Handshake.DigestHandshakeFormat do
@moduledoc """
Functions to parse and validate RTMP handshakes based on flash client versions
and SHA digests. This handshake is required for supporting H.264 video.
Since no documentation of this handshake publicly exists from Adobe, this
was created by ref... | apps/rtmp/lib/rtmp/handshake/digest_handshake_format.ex | 0.612541 | 0.525917 | digest_handshake_format.ex | starcoder |
defmodule Militerm.Systems.SimpleResponse do
@moduledoc ~S"""
The response system allows NPCs to map text string patterns to
events. This is a fairly generic system, so the scripting needs to
supply the string being matched as well as the set of matches. The
returned event is then triggered by the scr... | lib/militerm/systems/simple_response.ex | 0.705886 | 0.401512 | simple_response.ex | starcoder |
defmodule Jerboa.Format.HeaderLengthError do
@moduledoc """
Error indicating STUN message with header of invalid length
STUN messages have a fixed header of 20 bytes, so any message
shorter than that will produce this error when passed to
`Jerboa.Format.decode/1`.
Exception struct fields:
* `:binary` ... | lib/jerboa/format/exceptions.ex | 0.895308 | 0.644868 | exceptions.ex | starcoder |
defmodule AadhaarValidator do
@dihedral_group [
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[1, 2, 3, 4, 0, 6, 7, 8, 9, 5],
[2, 3, 4, 0, 1, 7, 8, 9, 5, 6],
[3, 4, 0, 1, 2, 8, 9, 5, 6, 7],
[4, 0, 1, 2, 3, 9, 5, 6, 7, 8],
[5, 9, 8, 7, 6, 0, 4, 3, 2, 1],
[6, 5, 9, 8, 7, 1, 0, 4, 3, 2],
[7, 6, 5, 9, 8... | lib/aadhaar_validator.ex | 0.534127 | 0.55923 | aadhaar_validator.ex | starcoder |
defmodule Microdata.Item do
@moduledoc """
`Microdata.Item` structs are read from a `Microdata.Document`'s source.
"""
defstruct types: nil, id: nil, properties: nil
@type t :: %Microdata.Item{
types: MapSet.t(String.t()),
id: URI.t(),
properties: [Microdata.Property.t()]
... | lib/microdata/item.ex | 0.920442 | 0.78469 | item.ex | starcoder |
defmodule SqlParser do
@moduledoc "Turns strings of SQL into Elixir data."
@doc """
Break the given SQL string `s` into tokens.
Return the list of tokens. SQL keywords, operators, etc. are represented
as Elixir keywords. Identifiers and literals are represented as pairs,
`{:token_type, value}`. The token ... | jorendorff+elixir/lib/SqlParser.ex | 0.849504 | 0.559802 | SqlParser.ex | starcoder |
defmodule Microformats2 do
@moduledoc """
A [microformats2](http://microformats.org/wiki/microformats2) parser for elixir.
"""
alias Microformats2.Helpers
@doc """
Parse a document either by URL or by content. Returns a microformats2 parsing structure or `:error`.
## Parameters
* `content_or_url` ... | lib/microformats2.ex | 0.785185 | 0.449453 | microformats2.ex | starcoder |
defmodule FalconPlusApi.Api.Dashboard do
alias Maxwell.Conn
alias FalconPlusApi.{Util, Sig, Api}
@doc """
* [Session](#/authentication) Required
### Request
```
{
"screen_id": 953,
"title": "laiwei-test-graph1",
"endpoints": ["laiweiofficemac"],
"counters": ["v... | lib/falcon_plus_api/api/dashboard.ex | 0.698227 | 0.750758 | dashboard.ex | starcoder |
defmodule Vex.Validators.Exclusion do
@moduledoc """
Ensure a value is not a member of a list of values.
## Options
* `:in`: The list.
* `:message`: Optional. A custom error message. May be in EEx format
and use the fields described in "Custom Error Messages," below.
The list can be provided in ... | lib/vex/validators/exclusion.ex | 0.799638 | 0.52007 | exclusion.ex | starcoder |
defmodule Andy.Profiles.Rover.GMDefs.Eating do
@moduledoc "The GM definition for :eating"
alias Andy.GM.{GenerativeModelDef, Intention, Conjecture}
import Andy.GM.Utils
def gm_def() do
%GenerativeModelDef{
name: :eating,
conjectures: [
conjecture(:chewing),
conjecture(:found_fo... | lib/andy/profiles/rover/gm_defs/eating.ex | 0.616936 | 0.415166 | eating.ex | starcoder |
defmodule Sanbase.Utils.Transform do
@doc ~s"""
Transform the maps from the :ok tuple data so the `key` is renamed to `new_key`
## Examples:
iex> Sanbase.Utils.Transform.rename_map_keys({:ok, [%{a: 1}, %{a: 2}]}, old_key: :a, new_key: :b)
{:ok, [%{b: 1}, %{b: 2}]}
iex> Sanbase.Utils.Transform.... | lib/sanbase/utils/transform.ex | 0.805441 | 0.686547 | transform.ex | starcoder |
defmodule CacheMoney do
@moduledoc """
Handles caching values under different cache names, can expire keys
"""
use GenServer
@default_timeout 5000
@typedoc """
The name of the cache, used for namespacing multiple caches on the same adapter.
Can be either a binary or an atom, but will always be conver... | lib/cache_money.ex | 0.890564 | 0.562597 | cache_money.ex | starcoder |
defmodule Claritas do
use Bitwise
@moduledoc """
Claritas lighten or darken color (hexadecimal) by integer value.
"""
@doc """
Shift brightness (up or down) of the given hexadecimal `color` by integer value `brightness_change`.
Parameters:
`color`: color in hexadecimal format (#RRGGBB)
`brightnes... | lib/claritas.ex | 0.919498 | 0.856872 | claritas.ex | starcoder |
defmodule Chunky.Sequence.OEIS.Multiples do
@moduledoc """
Sequences from the [Online Encyclopedia of Integer Sequences](https://oeis.org) dealing with multiples
and additions.
## Available Sequences
### Multiples of an integer
- `create_sequence_a008585/1` - A008585 - a(n) = 3*n.
- `create_sequen... | lib/sequence/oeis/multiples.ex | 0.859678 | 0.82485 | multiples.ex | starcoder |
defmodule Serum.Fragment do
@moduledoc """
Defines a struct representing a page fragment.
## Fields
* `file`: Source path. This can be `nil` if created internally.
* `output`: Destination path
* `metadata`: A map holding extra information about the fragment
* `data`: Contents of the page fragment
"""
... | lib/serum/fragment.ex | 0.806396 | 0.486332 | fragment.ex | starcoder |
defmodule OT.Text.Application do
@moduledoc """
The application of a text operation to a piece of text.
CodeSandbox custom version to ignore error_mismatch, as JS doesn't provide the deletion material
"""
alias OT.Text, as: Text
alias Text.Operation
alias Text.JSString
@typedoc """
The result of an... | lib/ot/text/application.ex | 0.833155 | 0.573589 | application.ex | starcoder |
defmodule MobileNumberFormat.SaxParser do
@behaviour Saxy.Handler
def handle_event(:start_document, _prolog, state) do
{:ok, state}
end
def handle_event(:end_document, _data, state) do
{:ok, state}
end
def handle_event(:start_element, {"territory", attributes}, {[], territories}) do
territory... | lib/sax_parser.ex | 0.541894 | 0.487063 | sax_parser.ex | starcoder |
defmodule Exception do
@moduledoc """
Several convenience functions to work and pretty print
exceptions and backtraces.
"""
# Normalize an exception converting Erlang exceptions
# to Elixir style exceptions. This is meant to be used
# internally.
@doc false
def normalize(exception) when is_exception(... | lib/elixir/lib/exception.ex | 0.684686 | 0.457379 | exception.ex | starcoder |
defmodule Snitch.Data.Model.Promotion.OrderEligibility do
@moduledoc """
Defines functions for order level checks while checking if
a promotion can be applied to the order.
"""
use Snitch.Data.Model
alias Snitch.Data.Model.PromotionAdjustment
@valid_order_states ~w(delivery address)a
@success_message "... | apps/snitch_core/lib/core/data/model/promotion/order_eligibility.ex | 0.846356 | 0.524882 | order_eligibility.ex | starcoder |
defmodule Mix.Tasks.Nlp.PosTagger.Train do
@moduledoc """
This task trains and optionally tests a part-of-speech tagger
using files containing tokenized text and POS tags.
The trained model will be JSON-encoded and saved to
the specified target file; it can be loaded by reading
the target file, JSON decodi... | lib/mix/tasks/nlp/pos_tagger/train.ex | 0.818483 | 0.52756 | train.ex | starcoder |
defmodule Slackerton.Trivia.Store do
use GenServer
require Logger
defstruct [ active: MapSet.new(), recently_asked: MapSet.new(), quiz: Map.new(), winners: Map.new() ]
def start_link(_) do
GenServer.start_link(__MODULE__, %__MODULE__{}, name: __MODULE__)
end
def init(state) do
{:ok, state }
end... | lib/slackerton/trivia/store.ex | 0.536556 | 0.42662 | store.ex | starcoder |
defmodule TripUpdates do
@moduledoc """
Responsible for converting lists of BoardingStatus structs into an enhanced TripUpdates JSON feed
The basic TripUpdates feed is a Protobuf, documented here: https://developers.google.com/transit/gtfs-realtime/guides/trip-updates
The enhanced JSON feed takes the Protobuf... | apps/commuter_rail_boarding/lib/trip_updates.ex | 0.635675 | 0.448185 | trip_updates.ex | starcoder |
defmodule Digraph do
@moduledoc """
`Digraph` is a struct-based implementation of `:digraph`.
## Notes
This will not enforce the `:acyclic` option.
"""
use Boundary, deps: [], exports: []
alias Digraph.{Edge, Vertex}
@behaviour Access
defstruct vertices: %{},
edges: %{},
... | lib/digraph.ex | 0.908145 | 0.606906 | digraph.ex | starcoder |
defmodule SpeechMarkdown.Grammar do
@moduledoc """
This is the nimble-parsec grammar for the subset of the Speech Markdown
language supported by this library. The parser is tolerant of any string
inputs, but poorly-specified constructs will simply be output as string
values. Results are returned as an ast con... | lib/speech_markdown/grammar.ex | 0.807802 | 0.407864 | grammar.ex | starcoder |
defmodule Mongo.Collection do
@moduledoc """
This module provides some boilerplate code for a better support of structs while using the
MongoDB driver:
* automatic load and dump function
* reflection functions
* type specification
* support for embedding one and many structs
* support for `a... | lib/mongo/collection.ex | 0.8812 | 0.603289 | collection.ex | starcoder |
defmodule RateLimitETS do
@moduledoc """
Abstract module for interacting with ETS tables that track state for all the scopes.
ETS (Erlang Term Storage) is an in-memory database for Erlang, it provides a robust in-memory
store for Elixir and Erlang objects. This in-memory property and the ownership model where
... | lib/rate_limit_ets.ex | 0.772101 | 0.561936 | rate_limit_ets.ex | starcoder |
defmodule ExState do
defstruct pos: 0, regs: nil, proc: nil, p_id: nil, messages_sent: 0, final_pid: nil
end
defmodule Day18 do
@moduledoc """
You discover a tablet containing some strange assembly code labeled simply "Duet". Rather than bother the sound card
with it, you decide to run the code yourself. Unfor... | lib/day18.ex | 0.70619 | 0.839175 | day18.ex | starcoder |
defmodule EWallet.TransactionConsumptionFetcher do
@moduledoc """
Handles any kind of retrieval/fetching for the TransactionConsumptionGate.
All functions here are only meant to load and format data related to
transaction consumptions.
"""
alias EWalletDB.{Transaction, TransactionConsumption}
@spec get(... | apps/ewallet/lib/ewallet/fetchers/transaction_consumption_fetcher.ex | 0.80954 | 0.445891 | transaction_consumption_fetcher.ex | starcoder |
defmodule ExRabbitMQ.Config.Connection do
@moduledoc """
A structure holding the necessary information about a connection to a RabbitMQ node.
#### Connection configuration example:
```elixir
# :connection is this connection's configuration name
config :exrabbitmq, :my_connection_config,
# username fo... | lib/ex_rabbit_m_q/config/connection.ex | 0.876957 | 0.612049 | connection.ex | starcoder |
defmodule ProcessFun do
@moduledoc """
Ok, let's have a bit of play from `iex` to get a feel for processes. Let's start from `iex`.
```
iex -S mix
> pid = spawn(fn -> IO.puts("Hello matey") end)
```
You'll say "Hello matey" printed out. `pid` is the Process ID.
```
> Process.alive?(pid)
false
... | lib/process_fun.ex | 0.802013 | 0.948298 | process_fun.ex | starcoder |
defmodule AMQP.Exchange do
@moduledoc """
Functions to operate on Exchanges.
"""
import AMQP.Core
alias AMQP.Channel
@doc """
Declares an Exchange. The default Exchange type is `direct`.
AMQP 0-9-1 brokers provide four pre-declared exchanges:
* Direct exchange: (empty string) or `amq.direct`
*... | lib/amqp/exchange.ex | 0.787441 | 0.552902 | exchange.ex | starcoder |
defmodule Turbo.Ecto do
@moduledoc """
A rich ecto component, including search sort and paginate. https://hexdocs.pm/turbo_ecto
## Example
### Category Table Structure
| Field | Type | Comment |
| ------------- | ------------- | --------- |
| `name` | string | |
### Product Table Structure... | lib/turbo_ecto.ex | 0.83772 | 0.85318 | turbo_ecto.ex | starcoder |
defmodule Cizen.Effects.Race do
@moduledoc """
An effect to run a race for the given effects.
## Anonymous race
perform %Race{
effects: [
effect1,
effect2
]
}
# If effect2 resolves faster than effect1 with :somevalue,
# the race returns the :somevalue
... | lib/cizen/effects/race.ex | 0.796055 | 0.495361 | race.ex | starcoder |
defmodule Commanded.Middleware.Uniqueness do
@behaviour Commanded.Middleware
@moduledoc """
Documentation for Commanded.Middleware.Uniqueness.
"""
@default_partition __MODULE__
defprotocol UniqueFields do
@fallback_to_any true
@doc """
Returns unique fields for a command as a list of tuples... | lib/commanded/middleware/uniqueness.ex | 0.847842 | 0.502991 | uniqueness.ex | starcoder |
# import Scenic.Primitives, only: [group: 3, rect: 3]
# import FloUI.Scrollable.Components, only: [scroll_bars: 3]
# alias Scenic.Graph
# alias Scenic.Primitive
# alias Scenic.Math.Vector2
# alias FloUI.Scrollable.Hotkeys
# alias FloUI.Scrollable.Drag
# alias FloUI.Scrollable.Wheel
# alias FloUI.Sc... | lib/scrollbar/scrollable.ex | 0.826292 | 0.57344 | scrollable.ex | starcoder |
defmodule SvgBuilder.Painting do
alias SvgBuilder.Element
alias SvgBuilder.Units
@moduledoc """
Handles filling, stroking and marker symbols.
https://www.w3.org/TR/SVG11/painting.html
Fill and stroke can be assigned `t:paint_t/0` type values.
The meanings of these values are as follows:
* `:current`... | lib/painting.ex | 0.895013 | 0.524212 | painting.ex | starcoder |
defmodule Furlex.Parser do
@doc """
Parses the given HTML, returning a map structure of structured
data keys mapping to their respective values, or an error.
"""
@callback parse(html :: String.t) :: {:ok, Map.t} | {:error, Atom.t}
@doc """
Extracts the given tags from the given raw html according to
t... | lib/furlex/parser.ex | 0.850515 | 0.433202 | parser.ex | starcoder |
defmodule ElixirScript.FindUsedFunctions do
@moduledoc false
alias ElixirScript.State, as: ModuleState
@doc """
Takes a list of entry modules and finds modules they use along with
documenting the functions used. The data collected about used functions
is used to filter only the used functions for compilati... | lib/elixir_script/passes/find_used_functions.ex | 0.514156 | 0.48377 | find_used_functions.ex | starcoder |
defmodule Filterable.Ecto.Helpers do
@moduledoc ~S"""
Contains macros which allow to define widely used filters.
use Filterable.Ecto.Helpers
Example:
defmodule PostFilters do
use Filterable.DSL
use Filterable.Ecto.Helpers
field :author
field :title
paginate... | lib/filterable/ecto/helpers.ex | 0.739422 | 0.431764 | helpers.ex | starcoder |
defmodule Ecto.Schema.Metadata do
@moduledoc """
Stores metadata of a struct.
The fields are:
* `state` - the state in a struct's lifetime, e.g. :built, :loaded, :deleted
* `source` - the database source of a model, which is the source specified
in schema by default or custom source when building ... | lib/ecto/schema.ex | 0.92731 | 0.630799 | schema.ex | starcoder |
defmodule ExTermbox.EventManager do
@moduledoc """
This module implements an event manager that notifies subscribers of
keyboard, mouse and resize events received from the termbox API.
Internally, the event manager is managing a NIF-based polling routine and
fanning out polled events to subscribers. It works... | lib/ex_termbox/event_manager.ex | 0.756447 | 0.509947 | event_manager.ex | starcoder |
defmodule AntikytheraCore.TemplateEngine do
@moduledoc """
This is an implementation of `EEx.Engine` that auto-escape dynamic parts within HAML templates.
"""
use EEx.Engine
alias Antikythera.TemplateSanitizer
def init(_opts), do: {:safe, ""}
def handle_body({:safe, iodata}) do
q =
quote do
... | core/web/template_engine.ex | 0.627837 | 0.406155 | template_engine.ex | starcoder |
defmodule NewRelic.Telemetry.Plug do
use GenServer
@moduledoc """
Provides `Plug` instrumentation via `telemetry`.
Plug pipelines are auto-discovered and instrumented.
We automatically gather:
* Transaction metrics and events
* Transaction Traces
* Distributed Traces
You can opt-out of this instr... | lib/new_relic/telemetry/plug.ex | 0.757301 | 0.716051 | plug.ex | starcoder |
defmodule Phoenix.Endpoint do
@moduledoc """
Defines a Phoenix endpoint.
The endpoint is the boundary where all requests to your
web application start. It is also the interface your
application provides to the underlying web servers.
Overall, an endpoint has three responsibilities:
* It provides a wr... | lib/phoenix/endpoint.ex | 0.902204 | 0.529142 | endpoint.ex | starcoder |
defmodule ArrowWeb.DisruptionController.Index do
@moduledoc """
Builds and executes the database queries for the disruptions index.
"""
alias Arrow.{Adjustment, Disruption, Repo}
alias ArrowWeb.DisruptionController.Filters
import Ecto.Query
@spec all(Filters.t() | nil) :: [Disruption.t()]
def all(filt... | lib/arrow_web/controllers/disruption_controller/index.ex | 0.756447 | 0.401482 | index.ex | starcoder |
defmodule Game.TileGenerator do
alias Game.Repo
alias Game.Tile
alias Game.Region
defp calculate_height(
{coordinates, tile},
calculated_tiles,
neighbors,
remaining_tiles,
boundary_tiles
)
when map_size(neighbors) > 0 do
calculated_and_boundary_til... | lib/game/generators/tile_generator.ex | 0.559651 | 0.656803 | tile_generator.ex | starcoder |
defmodule ScrapyCloudEx.Endpoints.Helpers do
@moduledoc false
require Logger
alias ScrapyCloudEx.HttpAdapter.{RequestConfig, Response}
alias ScrapyCloudEx.HttpAdapters.Default, as: DefaultAdapter
@typep param :: {atom, any}
# parameter naming in the API is a bit inconsistent where multi-words variables ... | lib/endpoints/helpers.ex | 0.819424 | 0.40589 | helpers.ex | starcoder |
defmodule Harald.Transport do
@moduledoc """
A server to manage lower level transports and parse bluetooth events.
"""
use GenServer
alias Harald.{HCI, LE}
@type adapter_state :: map
@type command :: binary
@type namespace :: atom
defmodule State do
@moduledoc false
@enforce_keys [:adapter,... | lib/harald/transport.ex | 0.782205 | 0.438725 | transport.ex | starcoder |
defmodule Tesla.Middleware.Compression do
@moduledoc """
Compress requests and decompress responses.
Supports "gzip" and "deflate" encodings using erlang's built-in `:zlib` module.
## Example usage
```
defmodule MyClient do
use Tesla
plug Tesla.Middleware.Compression, format: "gzip"
end
```
... | lib/tesla/middleware/compression.ex | 0.913266 | 0.706924 | compression.ex | starcoder |
defmodule AlertProcessor.TimeFrameComparison do
@moduledoc """
module used to compare between subscription timeframe maps
and alert timeframe maps. maps contain keys identifying
the day type being checked along with a start and end second
of day to be able to create a range to check for an intersection.
"""... | apps/alert_processor/lib/rules_engine/time_frame_comparison.ex | 0.841403 | 0.585605 | time_frame_comparison.ex | starcoder |
defmodule Absinthe.GraphqlWS.Socket do
@moduledoc """
This module is used by a custom websocket, which can then handle connections from a client
implementing the [GraphQL over WebSocket protocol](https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md)
## Options
* `schema` - required - The Absinthe... | lib/absinthe/graphql_ws/socket.ex | 0.906166 | 0.511717 | socket.ex | starcoder |
defmodule Membrane.Libnice.Bin do
@moduledoc """
Bin used for establishing ICE connection, sending and receiving messages.
### Architecture and pad semantic
Both input and output pads are dynamic ones.
One instance of Libnice Bin is responsible for handling only one ICE stream which can have
multiple compo... | lib/membrane_libnice_plugin/ice_bin.ex | 0.869507 | 0.508788 | ice_bin.ex | starcoder |
defmodule Exq.Middleware.Telemetry do
@moduledoc """
This middleware allows you to subscribe to the telemetry events and
collect metrics about your jobs.
### Exq telemetry events
The middleware emit three events, same as what `:telemetry.span/3` emits.
* `[:exq, :job, :start]` - Is invoked whenever a job ... | lib/exq/middleware/telemetry.ex | 0.803135 | 0.613815 | telemetry.ex | starcoder |
defmodule Pushest do
@moduledoc ~S"""
Pushest is a Pusher library leveraging Elixir/OTP to combine server and client-side Pusher features.
Abstracts un/subscription, client-side triggers, private/presence channel authorizations.
Keeps track of subscribed channels and users presence when subscribed to presence c... | lib/pushest.ex | 0.866994 | 0.66594 | pushest.ex | starcoder |
defmodule RayTracer.Cube do
@moduledoc """
This module defines cube operations
"""
alias RayTracer.Shape
use Shape
alias RayTracer.RTuple
alias RayTracer.Matrix
alias RayTracer.Material
alias RayTracer.Intersection
@type t :: %__MODULE__{
transform: Matrix.matrix,
inv_transform: Matrix.ma... | lib/cube.ex | 0.876423 | 0.541954 | cube.ex | starcoder |
defmodule Strukt do
@moduledoc """
"""
import Kernel, except: [defstruct: 1, defstruct: 2]
import Strukt.Field, only: [is_supported: 1]
@doc """
See `c:new/1`
"""
@callback new() :: {:ok, struct()} | {:error, Ecto.Changeset.t()}
@doc """
This callback can be overridden to provide custom initializ... | lib/strukt.ex | 0.869396 | 0.44746 | strukt.ex | starcoder |
defmodule Xgit.Util.TrailingHashDevice do
@moduledoc false
# Creates an `iodevice` process that supports git file formats with a trailing
# SHA-1 hash.
# When reading, the trailing 20 bytes are interpreted as a SHA-1 hash of the
# remaining file contents and can be verified using the `valid_hash?/1` functio... | lib/xgit/util/trailing_hash_device.ex | 0.969018 | 0.632446 | trailing_hash_device.ex | starcoder |
defmodule Holobot.Holofans.Videos do
@moduledoc """
Holofans videos caching server and client API module.
"""
use GenServer, shutdown: 10_000
require Logger
require Memento
alias Holobot.Holofans.{Client, Video}
@type video_status() :: :new | :live | :upcoming | :past | :missing
@cache_limit 1000
... | lib/holobot/holofans/videos.ex | 0.694303 | 0.415254 | videos.ex | starcoder |
defmodule Irc.Message.Params do
@moduledoc """
The parameters part of an IRC message.
While there's no inherent reason to treat trailing and middle parameters
separately, they are stored separately to provide the guarantee that
message = message |> Params.decode |> Params.encode. If all you want is a
simpl... | lib/irc/message/params.ex | 0.736306 | 0.511046 | params.ex | starcoder |
defmodule Crux.Rest.Endpoints.Generator do
@moduledoc false
@moduledoc since: "0.3.0"
# Module used to generate endpoint functions via (nested) macros.
# Example
# defmodule Test do
# use Crux.Rest.Endpoints.Generator
# route "/foo/:foo_id"
# route "/bar" do
# route "foo/:foo_id"
# end
... | lib/rest/endpoints/generator.ex | 0.782122 | 0.547646 | generator.ex | starcoder |
defmodule Advent.Y2021.D12 do
@moduledoc """
https://adventofcode.com/2021/day/12
"""
@typep cave :: String.t()
@typep cave_system :: %{cave() => MapSet.t()}
@doc """
How many paths through this cave system are there that visit small caves at
most once?
"""
@spec part_one(Enumerable.t()) :: non_ne... | lib/advent/y2021/d12.ex | 0.74055 | 0.424591 | d12.ex | starcoder |
defmodule GenRetry.Task do
@moduledoc ~S"""
Provides `async/2`, which operates like `Task.async/1` with retry
capability.
"""
@doc ~S"""
Works like `Task.async`, but with retry. Returns a regular `%Task{}` usable
with the rest of the functions in `Task`.
`opts` are GenRetry options.
The `:respond_t... | lib/gen_retry/task.ex | 0.821044 | 0.489564 | task.ex | starcoder |
defmodule MuonTrap.Options do
@moduledoc """
Validate and normalize the options passed to MuonTrap.cmd/3 and MuonTrap.Daemon.start_link/3
This module is generally not called directly, but it's likely
the source of exceptions if any options aren't quite right. Call `validate/4` directly to
debug or check opti... | lib/muontrap/options.ex | 0.790934 | 0.516047 | options.ex | starcoder |
defmodule Plenario.DataSetQueries do
import Ecto.Query
import Geo.PostGIS, only: [
st_contains: 2,
st_intersects: 2
]
import Plenario.QueryUtils
alias Plenario.{
DataSet,
DataSetQueries,
User
}
def list, do: from d in DataSet
def get(id) do
case Regex.match?(~r/^\d+$/, "#{id... | lib/plenario/queries/data_set_queries.ex | 0.531209 | 0.664378 | data_set_queries.ex | starcoder |
defmodule Re.Listings.Highlights.Scores do
@moduledoc """
Define listing profile pattern for highlight eligibility and
set score to allow highlight ordering.
"""
alias Re.{
Filtering,
Listings.Queries,
Repo
}
def order_highlights_by_scores(listings) do
options = %{
max_id: get_max_... | apps/re/lib/listings/highlights/scores.ex | 0.710729 | 0.48377 | scores.ex | starcoder |
defmodule BitPal.BCH.KeyTree do
@moduledoc """
This module implements BIP-0032: derivation of private and public keys from a
public or private master key (see: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
The idea is quite simple. This module implements two functions:
- to_public(private) ... | lib/bitpal/bch/keytree.ex | 0.897139 | 0.678247 | keytree.ex | starcoder |
defmodule SoftBank.Account do
@moduledoc """
An Account represents accounts in the system which are of _asset_,
_liability_, or _equity_ types, in accordance with the "accounting equation".
Each account must be set to one of the following types:
| TYPE | NORMAL BALANCE | DESCRIPTION ... | lib/repos/Bank/Account.ex | 0.868102 | 0.648327 | Account.ex | starcoder |
defimpl Timex.Protocol, for: Tuple do
alias Timex.Types
import Timex.Macros
@epoch :calendar.datetime_to_gregorian_seconds({{1970,1,1},{0,0,0}})
@spec to_julian(Types.date | Types.datetime) :: integer
def to_julian({y,m,d}) when is_date(y,m,d) do
Timex.Calendar.Julian.julian_date(y, m, d)
end
def to... | elixir/codes-from-books/little-elixir/cap8/blitzy/deps/timex/lib/datetime/erlang.ex | 0.843219 | 0.418994 | erlang.ex | starcoder |
defmodule Nerves.Firmware do
@moduledoc """
API for upgrading and managing firmware on a Nerves device.
Handles firmware for a single block device (like /dev/mmcblk0). Delegates a
lot to <NAME>leth's excellent [fwup](https://github.com/fhunleth/fwup).
Provides:
- Firmware upgrades
- Firmware status
- ... | lib/firmware.ex | 0.781747 | 0.456531 | firmware.ex | starcoder |
defmodule Kernel.ParallelCompiler do
@moduledoc """
A module responsible for compiling files in parallel.
"""
@doc """
Compiles the given files.
Those files are compiled in parallel and can automatically
detect dependencies between them. Once a dependency is found,
the current file stops being compile... | lib/elixir/lib/kernel/parallel_compiler.ex | 0.777975 | 0.475301 | parallel_compiler.ex | starcoder |
defmodule AdventOfCode2019 do
@moduledoc """
AdventOfCode2019 is a a set of solutions to Advent of Code 2019 in Elixir!
"""
@doc """
Run the specified day with supplied input.
Example:
iex> ["12", "14", "1969", "100756"] |> AdventOfCode2019.stream_lines("1.1")
34_241
"""
@spec stream_lines(Enume... | lib/advent_of_code_2019.ex | 0.721743 | 0.447279 | advent_of_code_2019.ex | starcoder |
defmodule Riptide do
@moduledoc """
Riptide is a data first framework for building realtime applications. Riptide makes building snappy, realtime applications a breeze by letting you think purely in terms of your data and functionally about what should happen when it changes.
"""
@internal %{internal: true}
... | packages/elixir/lib/riptide.ex | 0.874144 | 0.48499 | riptide.ex | starcoder |
defmodule Cloudinary.Transformation.Expression do
@moduledoc """
The expression representation for conditional transformation, using user-defined variables
and/or giving values with arithmetic expression.
See `Cloudinary.Transformation.expression/1` to know the usage.
"""
@type t :: %__MODULE__{
... | lib/cloudinary/transformation/expression.ex | 0.887021 | 0.517815 | expression.ex | starcoder |
defmodule Estated.Property.Valuation do
@moduledoc "Valuation details as provided by a proprietary valuation algorithm."
@moduledoc since: "0.2.0"
import Estated.CastHelpers, only: [cast_date: 1]
defstruct [
:value,
:high,
:low,
:forecast_standard_deviation,
:date
]
@typedoc "Valuatio... | lib/estated/property/valuation.ex | 0.86995 | 0.450722 | valuation.ex | starcoder |
defmodule Hui.U do
@moduledoc """
Struct and functions related to Solr updating.
"""
defstruct [:doc, :commitWithin, :overwrite, :optimize, :commit,
:waitSearcher, :expungeDeletes, :maxSegments, :rollback,
:delete_id, :delete_query]
@typedoc """
Struct and functions related to ... | lib/hui/u.ex | 0.808294 | 0.650592 | u.ex | starcoder |
defmodule Jackalope.Handler do
@moduledoc """
Behaviour defining callbacks triggered during the MQTT life-cycle
The jackalope handler is stateless, so if state is needed one could
route the messages to stateful processes, and inform the system
about connection and subscription state.
Most of the callbacks... | lib/jackalope/handler.ex | 0.844473 | 0.446736 | handler.ex | starcoder |
defmodule Runlet.Cmd.Valve do
@moduledoc "Asynchronously start/stop the event stream"
defstruct tref: nil,
open: true,
dropped: 0
@doc """
Allows dynamically starting/stopping the event stream using the
start/stop commands. While stopped, events are discarded.
"""
@spec exec(Enum... | lib/runlet/cmd/valve.ex | 0.673943 | 0.412087 | valve.ex | starcoder |
defmodule RegexToStrings do
@moduledoc ~S"""
Get the strings a regex will match.
"""
@unsupported_metacharacters [".", "*", "+", ",}"]
@doc ~S"""
Get the strings a regex will match.
"""
def regex_to_strings(regex_string) do
maybe_regex_to_strings(regex_string, raise: false)
end
def regex_to_s... | lib/regex_to_strings.ex | 0.555676 | 0.574156 | regex_to_strings.ex | starcoder |
defmodule Dissolver do
@moduledoc """
# Dissolver
### NOTE: This is a wip repo. So be warned there maybe be bugs.
This project is a fork of https://github.com/elixirdrops/kerosene.
I thought to take it over because it does not look as if its being activly developed
and I wanted more features.
TODO: ... | lib/dissolver.ex | 0.653016 | 0.807499 | dissolver.ex | starcoder |
defmodule Day25 do
def part1(input) do
grid = parse(input)
Stream.iterate(grid, &move/1)
|> Stream.with_index
|> Stream.drop_while(&elem(&1, 0))
|> Enum.take(1)
|> hd
|> elem(1)
end
defp move(grid) do
case move_one(grid, :east) do
nil ->
move_one(grid, :south)
... | day25/lib/day25.ex | 0.512449 | 0.512998 | day25.ex | starcoder |
defmodule Nerves.Runtime.Log.SyslogParser do
@moduledoc """
Functions for parsing syslog strings
"""
@type severity ::
:alert | :critical | :debug | :emergency | :error | :informational | :notice | :warning
@type facility ::
:kernel
| :user_level
| :mail
| :... | lib/nerves_runtime/log/syslog_parser.ex | 0.531696 | 0.85446 | syslog_parser.ex | starcoder |
defmodule Kaffe.Subscriber do
@moduledoc """
Consume messages from a single partition of a single Kafka topic.
Assignments are received from a group consumer member, `Kaffe.GroupMember`.
Messages are delegated to `Kaffe.Worker`. The worker is expected to cast back
a response, at which time the stored offset... | lib/kaffe/group_member/subscriber/subscriber.ex | 0.858674 | 0.569613 | subscriber.ex | starcoder |
defmodule Beeline.Config do
@moduledoc false
@producer_schema Beeline.Producer.schema()
@schema [
name: [
doc: """
The GenServer name for the topology. The topology will build on this
name, using it as a prefix.
""",
type: :atom
],
producers: [
doc: """
A li... | lib/beeline/config.ex | 0.807499 | 0.476762 | config.ex | starcoder |
defmodule KinesisClient.Stream.AppState do
@moduledoc """
The AppState is where the information about Stream shards are stored. ShardConsumers will
checkpoint the records, and the `KinesisClient.Stream.Coordinator` will check here to determine
what shards to consume.
"""
def initialize(app_name, opts \\ []... | lib/kinesis_client/stream/app_state.ex | 0.753013 | 0.464537 | app_state.ex | starcoder |
defmodule Locations.GeoEncode.Lookup do
@moduledoc """
Entry point to perform a lookup using the OpenStreetMap Nominatim service
"""
require Logger
alias Locations.External.HttpClient
@url "https://nominatim.openstreetmap.org/search?"
@format "&format=geojson&addressdetails=0"
@doc """
Geo encode ... | lib/locations/geo_encode/lookup.ex | 0.727782 | 0.400075 | lookup.ex | starcoder |
defmodule Sanbase.Billing.GraphqlSchema do
@moduledoc ~s"""
Contains functions that help examining the GraphQL schema.
It allows you to work easily with access logic of queries.
"""
alias Sanbase.Billing.Product
alias Sanbase.Metric
require SanbaseWeb.Graphql.Schema
# NOTE: In case of compile time er... | lib/sanbase/billing/graphql_schema.ex | 0.823328 | 0.42937 | graphql_schema.ex | starcoder |
defmodule RlStudy.MDP.State do
@typedoc """
Custom type of State.
"""
@type t :: %RlStudy.MDP.State{row: integer, column: integer}
defstruct row: -1, column: -1
@doc """
# Examples
iex> RlStudy.MDP.State.new()
%RlStudy.MDP.State{}
"""
@spec new :: RlStudy.MDP.State.t()
def new() do
... | lib/mdp/state.ex | 0.711531 | 0.64692 | state.ex | starcoder |
defmodule Braintree.Plan do
@moduledoc """
Plans represent recurring billing plans in a Braintree merchant account.
The API for plans is read only.
For additional reference see:
https://developers.braintreepayments.com/reference/request/plan/all/ruby
"""
use Braintree.Construction
alias Braintree.HTT... | lib/plan.ex | 0.864253 | 0.452234 | plan.ex | starcoder |
defmodule Axon.Training do
@moduledoc """
Abstractions for training machine learning models.
"""
require Axon
require Axon.Updates
@doc false
def step({_, _} = model, {_, _} = update), do: step(model, update, [])
@doc """
Represents a single training step.
The first two arguments are tuples:
... | lib/axon/training.ex | 0.929047 | 0.766403 | training.ex | starcoder |
defmodule Timex.TimezoneInfo do
@moduledoc """
All relevant timezone information for a given period, i.e. Europe/Moscow on March 3rd, 2013
Notes:
- `full_name` is the name of the zone, but does not indicate anything about the current period (i.e. CST vs CDT)
- `abbreviation` is the abbreviated name for t... | lib/timezone/timezone_info.ex | 0.919285 | 0.604195 | timezone_info.ex | starcoder |
defmodule DomainEvent do
@moduledoc """
Events represent a fact inside the domain, it is the representation of a decision or a state change that a system want
to notify to its subscribers. Events represents facts that nobody can change, so events are not intentions or requests
of anything, An example may be and... | lib/reactive_commons/api/domain_event.ex | 0.743354 | 0.486027 | domain_event.ex | starcoder |
defmodule AWS.CloudWatchEvents do
@moduledoc """
Amazon EventBridge helps you to respond to state changes in your AWS resources.
When your resources change state, they automatically send events into an event
stream. You can create rules that match selected events in the stream and route
them to targets to t... | lib/aws/generated/cloud_watch_events.ex | 0.88258 | 0.434221 | cloud_watch_events.ex | starcoder |
defmodule Surface.Compiler.ParseTreeTranslator do
@behaviour Surface.Compiler.NodeTranslator
alias Surface.IOHelper
alias Surface.Compiler.Helpers
def handle_init(state), do: state
def handle_expression(expression, meta, state) do
{{:expr, expression, to_meta(meta)}, state}
end
def handle_comment(... | lib/surface/compiler/parse_tree_translator.ex | 0.592431 | 0.406803 | parse_tree_translator.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.