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 Snitch.Data.Model.TaxCategory do
@moduledoc """
Model functions Tax Category.
"""
use Snitch.Data.Model
import Ecto.Changeset
alias Ecto.Multi
alias Snitch.Core.Tools.MultiTenancy.MultiQuery
alias Snitch.Data.Schema.TaxCategory
@doc """
Creates a TaxCategory in the db with the supplied ... | apps/snitch_core/lib/core/data/model/tax_category.ex | 0.890157 | 0.513059 | tax_category.ex | starcoder |
defmodule Blockchain.Account do
@moduledoc """
Represents the state of an account, as defined in Section 4
of the Yellow Paper.
"""
alias MerklePatriciaTree.Trie
@empty_keccak BitHelper.kec(<<>>)
@empty_trie MerklePatriciaTree.Trie.empty_trie_root_hash()
# State defined in Section 4.1 of the Yellow P... | lib/blockchain/account.ex | 0.793706 | 0.481454 | account.ex | starcoder |
defmodule Vapor.Provider.Dotenv do
@moduledoc """
The dotenv config provider will look for a `.env` file and load all of
the values for that file. The values can be written like so:
```
DATABASE_URL=https://localhost:9432
PORT=4000
REDIS_HOST=1234
```
If the file can't be found then this provider wi... | lib/vapor/providers/dotenv.ex | 0.837288 | 0.782205 | dotenv.ex | starcoder |
defmodule Marshall do
@moduledoc """
data marshalls.
"""
def fetch(data) do
case(data) do
[{"td", [{"style", "white-space:nowrap"}], ["USDOT Number"]}, {"td", [], [":"]}, _] ->
fetch_dot(data)
[{"td", [{"style", "white-space:nowrap"}], ["MC #"]}, {"td", [], [":"]}, _] ->
fetch_... | lib/marshall.ex | 0.513668 | 0.652435 | marshall.ex | starcoder |
defmodule ExSaga.Stepper do
@moduledoc """
"""
alias ExSaga.{ErrorHandler, Event, Hook, Retry, Stage, State, Stepable}
@doc """
"""
@callback handle_sublevel_step(stepable :: Stepable.t(), event :: Event.t(), opts :: Stepable.opts()) ::
Stepable.stage_result() | Stepable.step_result() | nil
... | lib/ex_saga/stepper.ex | 0.826467 | 0.458773 | stepper.ex | starcoder |
defmodule RDF.PrefixMap do
@moduledoc """
A mapping a prefix atoms to IRI namespaces.
`RDF.PrefixMap` implements the `Enumerable` protocol.
"""
alias RDF.IRI
@type prefix :: atom
@type namespace :: IRI.t()
@type coercible_prefix :: atom | String.t()
@type coercible_namespace :: RDF.Vocabulary.Name... | lib/rdf/prefix_map.ex | 0.919895 | 0.578448 | prefix_map.ex | starcoder |
defmodule Kino.ETS do
@moduledoc """
A widget for interactively viewing an ETS table.
## Examples
tid = :ets.new(:users, [:set, :public])
Kino.ETS.new(tid)
Kino.ETS.new(:elixir_config)
"""
@doc false
use GenServer, restart: :temporary
alias Kino.Utils.Table
defstruct [:pid]
@t... | lib/kino/ets.ex | 0.688259 | 0.505981 | ets.ex | starcoder |
defmodule Example_Registry do
def start do
{:ok, _} = Registry.start_link(keys: :unique, name: Registry.ViaTest)
name = {:via, Registry, {Registry.ViaTest, "agent"}}
{:ok, _} = Agent.start_link(fn -> 0 end, name: name)
Agent.get(name, & &1)
Agent.update(name, &(&1 + 3))
Agent.get(name, & &1)
... | lib/beam/registry/registry.ex | 0.543227 | 0.453443 | registry.ex | starcoder |
defmodule GenFSM.Behaviour do
@moduledoc """
This module is a convenience for defining GenFSM callbacks in Elixir.
A finite state machine (FSM) is responsible for reacting to events received;
GenFSM is an OTP behaviour that encapsulates common FSM
functionalities.
## Example
Below is an example of a Ge... | lib/elixir/lib/gen_fsm/behaviour.ex | 0.802052 | 0.687374 | behaviour.ex | starcoder |
defmodule Ash.Api.Dsl do
@resource %Ash.Dsl.Entity{
name: :resource,
describe: "A reference to a resource",
target: Ash.Api.ResourceReference,
args: [:resource],
examples: [
"resource MyApp.User"
],
schema: [
resource: [
type: :atom,
required: true,
doc:... | lib/ash/api/dsl.ex | 0.850918 | 0.677454 | dsl.ex | starcoder |
defmodule AWS.STS do
@moduledoc """
AWS Security Token Service
AWS Security Token Service (STS) enables you to request temporary,
limited-privilege credentials for AWS Identity and Access Management (IAM) users
or for users that you authenticate (federated users).
This guide provides descriptions of the ... | lib/aws/generated/sts.ex | 0.930648 | 0.60399 | sts.ex | starcoder |
defmodule ExRabbitMQ.AST.Consumer.GenServer do
@moduledoc """
AST holding module for the consumer behaviour when the surrounding consumer is a GenServer.
"""
@doc """
Produces part of the AST for the consumer behaviour when the consumer is a GenServer.
It holds GenServer handle_info callbacks and a few def... | lib/ex_rabbit_m_q/a_s_t/consumer/gen_server.ex | 0.77193 | 0.411052 | gen_server.ex | starcoder |
defmodule Cldr.Calendar.Base.Month do
@moduledoc false
alias Cldr.Calendar.Config
alias Cldr.Calendar.Base
alias Calendar.ISO
alias Cldr.Math
@days_in_week 7
@quarters_in_year 4
@months_in_quarter 3
@weeks_in_quarter 13
@iso_week_first_day 1
@iso_week_min_days 4
@january 1
defmacro __using_... | lib/cldr/calendar/base/month.ex | 0.718496 | 0.505188 | month.ex | starcoder |
defmodule Vantagex.TechnicalIndicators do
@moduledoc """
Contains functions related to the technical indicator functions from Alpha Vantage
"""
import Vantagex.Helper
@doc """
Uses Alpha Vantage's SMA function.
Returns the simple moving average (SMA) values.
Args:
* `symbol` - The name of the secu... | lib/vantagex/technical_indicators.ex | 0.96217 | 0.989161 | technical_indicators.ex | starcoder |
defmodule RemoteDockers.NodeConfig do
@enforce_keys [:hostname, :port]
defstruct [:hostname, :port, :ssl, :label]
@default_port 2376
@doc """
Build configuration with defaults
default:
```
hostname: "localhost"
port: #{@default_port}
```
## Example:
```elixir
iex> NodeConfig.new()
... | lib/node_config.ex | 0.775265 | 0.840193 | node_config.ex | starcoder |
defmodule Cloudinary.Transformation.Effect.Tint do
@moduledoc false
import Cloudinary.Transformation.Color
defguardp is_truthy(as_boolean) when as_boolean not in [false, nil]
defguardp is_amount(amount) when amount <= 100 and amount >= 0
defguardp is_position(position) when position <= 100 and position >= 0
... | lib/cloudinary/transformation/effect/tint.ex | 0.835852 | 0.518241 | tint.ex | starcoder |
defmodule Cldr.UnknownLocaleError do
@moduledoc """
Exception raised when an attempt is made to use a locale not configured
in `Cldr`. `Cldr.known_locale_names/1` returns the locale names known to `Cldr`.
"""
defexception [:message]
def exception(message) do
%__MODULE__{message: message}
end
end
de... | lib/cldr/exception.ex | 0.879568 | 0.42182 | exception.ex | starcoder |
defmodule CCSP.Chapter4.Graph do
alias __MODULE__, as: T
alias CCSP.Chapter4.Edge
@moduledoc """
Corresponds to CCSP in Python, Chapter 4, titled "Graph problems"
This module may be a good candidate to use a gen server.
Also good candidate for converting lists to maps for better lookup times
"""... | lib/ccsp/chapter4/graph.ex | 0.733738 | 0.724164 | graph.ex | starcoder |
defmodule URI do
@moduledoc """
Utilities for working with and creating URIs.
"""
defrecord Info, [scheme: nil, path: nil, query: nil,
fragment: nil, authority: nil,
userinfo: nil, host: nil, port: nil]
import Bitwise
@ports [
{ "ftp", 21 },
{ "http", 80 },
... | lib/elixir/lib/uri.ex | 0.850872 | 0.564639 | uri.ex | starcoder |
defmodule ExAlgo.Tree.BinarySearchTree do
@moduledoc """
Implements a binary search tree.
"""
@type key_type :: any()
@type value_type :: any()
@type key_fn :: (value_type() -> key_type())
@type leaf :: nil
@type t() :: %__MODULE__{
data: value_type(),
left: t() | leaf(),
r... | lib/ex_algo/tree/binary_search_tree.ex | 0.910809 | 0.566288 | binary_search_tree.ex | starcoder |
defmodule Alchemy.Webhook do
@moduledoc """
"""
alias Alchemy.Discord.Webhooks
alias Alchemy.{Embed, User}
import Alchemy.Discord.RateManager, only: [send_req: 2]
@type snowflake :: String.t()
@type t :: %__MODULE__{
id: snowflake,
guild_id: snowflake | nil,
channel_id: sno... | lib/Structs/webhook.ex | 0.882168 | 0.645874 | webhook.ex | starcoder |
defmodule Day15.ChitonMap do
defstruct map: %{}, dimensions: {0, 0}, scale: 1
@doc """
Parse puzzle input to generate a map from locations to Chiton risk level.
"""
def parse(input) do
{map, {y_max, x_max}} =
for {line, y} <- String.split(input, "\n", trim: true) |> Enum.with_index(),
{nu... | day15/solver.ex | 0.856122 | 0.742842 | solver.ex | starcoder |
defmodule Flowr.Automation do
@moduledoc """
The Automation context.
"""
import Ecto.Query, warn: false
alias Flowr.Repo
alias Flowr.Automation.Flow
alias Flowr.Automation.Action
alias Flowr.Automation.JSONTemplate
@doc """
Returns the list of flows.
## Examples
iex> list_flows()
... | lib/flowr/automation/automation.ex | 0.841191 | 0.529872 | automation.ex | starcoder |
defmodule Manic do
@moduledoc """


 rates from [Alpha Vantage](www.alphavantage.co/documentation/#fx).
"""
alias AlphaVantage.Gateway
@doc """
Returns the realtime exchange rate for any pair of digital currency (e.g., Bitcoin) and physical currency (e... | lib/alpha_vantage/forex.ex | 0.928971 | 0.809125 | forex.ex | starcoder |
defmodule Level10.Games.GameServer do
@moduledoc """
This module contains the logic for the servers that store the state of each
game.
Each server is initialized with an empty Game struct, and then messages sent
to the server will either read from that struct or manipulate it in different
ways.
This mod... | lib/level10/games/game_server.ex | 0.773345 | 0.457864 | game_server.ex | starcoder |
defmodule Astro do
@moduledoc """
Functions for basic astronomical observations such
as sunrise, sunset, solstice, equinox, moonrise,
moonset and moon phase.
"""
alias Astro.{Solar, Lunar, Location, Time, Math, Guards}
import Astro.Math, only: [
sin: 1,
cos: 1,
atan_r: 2,
tan: 1,
mo... | lib/astro.ex | 0.95635 | 0.685647 | astro.ex | starcoder |
defmodule Kino.SmartCell do
@moduledoc ~S'''
An interface for defining custom smart cells.
A smart cell is a UI wizard designed for producing a piece of code
that accomplishes a specific task. In other words, a smart cell is
like a code template parameterized through UI interactions.
This module builds on... | lib/kino/smart_cell.ex | 0.903676 | 0.548794 | smart_cell.ex | starcoder |
defmodule AWS.SSO do
@moduledoc """
AWS Single Sign-On Portal is a web service that makes it easy for you to
assign user access to AWS SSO resources such as the user portal. Users can
get AWS account applications and roles assigned to them and get federated
into the application.
For general information ab... | lib/aws/sso.ex | 0.780495 | 0.422922 | sso.ex | starcoder |
defmodule ShopifyAPI.REST do
@moduledoc """
Provides core REST actions for interacting with the Shopify API.
Uses an `AuthToken` for authorization and request rate limiting.
Please don't use this module directly. Instead prefer the higher-level modules
implementing appropriate resource endpoints, such as `Sh... | lib/shopify_api/rest.ex | 0.840259 | 0.455925 | rest.ex | starcoder |
defmodule StaffNotesWeb.LayoutView do
@moduledoc """
View functions for the site's main page layout.
"""
use StaffNotesWeb, :view
alias StaffNotes.Accounts.User
@typedoc """
The application name as an atom.
"""
@type app_name :: atom
@typedoc """
The link information as a tuple of the author's ... | lib/staff_notes_web/views/layout_view.ex | 0.860706 | 0.759716 | layout_view.ex | starcoder |
defmodule Sanbase.Utils.ListSelector.Transform do
import Sanbase.DateTimeUtils
def args_to_filters_combinator(args) do
(get_in(args, [:selector, :filters_combinator]) || "and")
|> to_string()
|> String.downcase()
end
def args_to_base_projects(args) do
case get_in(args, [:selector, :base_projec... | lib/sanbase/utils/list_selector_transform.ex | 0.596903 | 0.593285 | list_selector_transform.ex | starcoder |
defmodule WxWinObj.API do
require Logger
@moduledoc """
An API to make using WxWindowObject simpler, and tomake sure any errors are
reported in the callers code.
"""
@doc """
Create a new window and optionally show it.
- **windowSpec**: The name of the module containing the window specification (see ... | lib/ElixirWx/WxWindowObjectApi.ex | 0.852767 | 0.670676 | WxWindowObjectApi.ex | starcoder |
defmodule Stargate.Receiver.Processor do
@moduledoc """
Defines a `Stargate.Receiver.Processor` module as a GenStage
process under the consumer or reader supervision tree.
The processor stage performs the message handling step for all
messages received on the connection by storing and calling the
applicati... | lib/stargate/receiver/processor.ex | 0.888402 | 0.510619 | processor.ex | starcoder |
defmodule DarknetToOnnx.Helper do
@moduledoc """
Helper class used for creating tensors
(partially ported from: https://github.com/onnx/onnx/blob/master/onnx/helper.py)
"""
use Agent, restart: :transient
@onnx_opset_version 15
@onnx_ir_version 8
alias DarknetToOnnx.Mapping
alias Onnx.ModelProto,... | lib/darknet_to_onnx/helper.ex | 0.871939 | 0.563138 | helper.ex | starcoder |
defmodule CodeCorps.GitHub.Adapters.Comment do
@moduledoc ~S"""
Used to convert between GitHub data which represents a GitHub Issue Comment
and `CodeCorps.Comment` as well as `CodeCorps.GithubComment` attributes.
"""
alias CodeCorps.{
Adapter.MapTransformer,
Comment,
GithubComment,
GitHub.Ad... | lib/code_corps/github/adapters/comment.ex | 0.500488 | 0.581897 | comment.ex | starcoder |
defmodule Alembic.Translator.Minecraft.Packets do
@moduledoc """
Contains Elixir-ized definitions of each useful client->server packet type,
including the data types to expect when attempting to decode the payload of
a packet of that type.
"""
import Alembic.Translator.Minecraft.Macros
defpacket 0x00, [... | lib/minecraft/packets.ex | 0.670608 | 0.490358 | packets.ex | starcoder |
defmodule AlphaVantage.FundamentalData do
@moduledoc """
A set of functions for fetching various temporal dimensions covering key financial metrics, income statements, balance sheets, cash flow, and other fundamental data points from [Alpha Vantage](www.alphavantage.co/documentation/#fundamentals).
"""
alias A... | lib/alpha_vantage/fundamental_data.ex | 0.920137 | 0.879095 | fundamental_data.ex | starcoder |
defmodule Donut.GraphQL.Identity.Credential do
use Donut.GraphQL.Schema.Notation
@desc "The type of credential"
enum :credential_type do
value :email
end
@desc "The state of a given authentication credential"
mutable_object :credential do
immutable do
field :type, n... | apps/donut_graphql/lib/donut.graphql/identity/credential.ex | 0.692226 | 0.408188 | credential.ex | starcoder |
defmodule ExWire.Sync do
@moduledoc """
This is the heart of our syncing logic. Once we've connected to a number
of peers via `ExWire.PeerSupervisor`, we begin to ask for new blocks from
those peers. As we receive blocks, we add them to our
`ExWire.Struct.BlockQueue`.
If the blocks are confirmed by enough ... | apps/ex_wire/lib/ex_wire/sync.ex | 0.758421 | 0.49109 | sync.ex | starcoder |
defmodule Direction do
def vertical?(direction), do: direction == :up or direction == :down
def horizontal?(direction), do: direction == :right or direction == :left
end
defmodule Vector do
@type t :: %__MODULE__{
direction: :up | :right | :down | :left,
magnitude: integer
}
@enfor... | lib/days/03.ex | 0.864096 | 0.900092 | 03.ex | starcoder |
defmodule VimCompiler.Parser do
alias VimCompiler.Ast
import VimCompiler.Helpers.LeexHelpers, only: [tokenize: 2]
def parse(str) do
with tokens <- skip_ws(tokenize(str, with: :lexer)) do
parse(tokens, %Ast.Tree{})
end
end
def parse([], result_tree) do
{:ok, Ast.Tree.finalize(result_tree)}
... | lib/vim_compiler/parser.ex | 0.634656 | 0.514034 | parser.ex | starcoder |
defmodule Util.HexParser do
@moduledoc """
This module defines some helper functions for playing around with raw memory from a ROM.
"""
use Bitwise
@block_size 16
def convert_file(input_file, output_file) do
output_file
|> File.open!([:write], handle_file(input_file))
end
def calculate_check... | lib/util/hex_parser.ex | 0.558207 | 0.463019 | hex_parser.ex | starcoder |
defmodule CSSEx.Helpers.Shared do
@moduledoc false
alias CSSEx.Helpers.Error
@appendable_first_char CSSEx.Helpers.SelectorChars.appendable_first_char()
@line_terminators CSSEx.Helpers.LineTerminators.code_points()
# increment the column token count
def inc_col(data, amount \\ 1)
def inc_col(%{column: c... | lib/helpers/shared.ex | 0.700792 | 0.540742 | shared.ex | starcoder |
defmodule ChexDigits.Rule do
@moduledoc """
`%Rule{
digits: list,
input_alphabet: list,
output_alphabet: list,
module: integer | nil,
module_type: atom,
weights: list | non_neg_integer,
weight_alignment: atom,
per_term_function: function
}`
`digits`: a List of digits for which t... | lib/rule.ex | 0.884688 | 0.843251 | rule.ex | starcoder |
defmodule SteamEx.ISteamEconomy do
@moduledoc """
A secondary interface to interact with the [Steam Economy](https://partner.steamgames.com/doc/features/inventory/economy).
See also: [IGameInventory](https://partner.steamgames.com/doc/webapi/IGameInventory).
For more info on how to use the Steamworks Web API p... | lib/interfaces/i_steam_economy.ex | 0.685107 | 0.550849 | i_steam_economy.ex | starcoder |
defmodule RDF.XSD.Boolean do
@moduledoc """
`RDF.XSD.Datatype` for XSD booleans.
"""
@type valid_value :: boolean
@type input_value :: RDF.Literal.t() | valid_value | number | String.t() | any
use RDF.XSD.Datatype.Primitive,
name: "boolean",
id: RDF.Utils.Bootstrapping.xsd_iri("boolean")
alias ... | lib/rdf/xsd/datatypes/boolean.ex | 0.897863 | 0.603406 | boolean.ex | starcoder |
defprotocol Timber.Eventable do
@moduledoc """
Converts a data structure into a `Timber.Event.t`. This is called on any data structure passed
in the `:event` metadata key passed to `Logger`.
For example, this protocol is how we're able to support maps:
```elixir
event_data = %{customer_id: "xiaus1934", am... | lib/timber/eventable.ex | 0.923782 | 0.892281 | eventable.ex | starcoder |
defmodule Rummage.Ecto.Hook.Paginate do
@moduledoc """
`Rummage.Ecto.Hook.Paginate` is the default pagination hook that comes with
`Rummage.Ecto`.
This module provides a operations that can add pagination functionality to
a pipeline of `Ecto` queries. This module works by taking a `per_page`, which
it uses... | lib/rummage_ecto/hooks/paginate.ex | 0.797281 | 0.857828 | paginate.ex | starcoder |
defmodule Muster.Game do
alias Muster.Game.{Grid, Tile}
@type status :: :waiting_for_players | :on | :won | :lost | :stopped
@type player :: :player1 | :player2
@type t :: %__MODULE__{
status: status(),
players: [player()],
current_player: player() | nil,
grid: Grid.t()... | apps/muster/lib/muster/game.ex | 0.751557 | 0.468608 | game.ex | starcoder |
defmodule Cluster.Strategy.Kubernetes.DNSSRV do
@moduledoc """
This clustering strategy works by issuing a SRV query for the kubernetes headless service
under which the stateful set containing your nodes is running.
For more information, see the kubernetes stateful-application [documentation](https://kubernete... | lib/strategy/kubernetes_dns_srv.ex | 0.851968 | 0.731754 | kubernetes_dns_srv.ex | starcoder |
defmodule Radixir.Core.API do
@moduledoc false
# @moduledoc """
# Submits requests to Core API.
# """
alias Radixir.Util
@type body :: map
@type options :: keyword
@type error_message :: String.t()
@doc """
Submits request to `/network/configuration`.
## Parameters
- `options`: Keyword list... | lib/radixir/core/api.ex | 0.912964 | 0.643875 | api.ex | starcoder |
defmodule Mix.Tasks.Do do
use Mix.Task
@shortdoc "Executes the tasks separated by plus"
@moduledoc """
Executes the tasks separated by `+`:
mix do compile --list + deps
The plus should be followed by at least one space before and after.
## Examples
The example below prints the available compil... | lib/mix/lib/mix/tasks/do.ex | 0.664431 | 0.453685 | do.ex | starcoder |
defmodule Elixium.Validator do
alias Elixium.Block
alias Elixium.Utilities
alias Elixium.KeyPair
alias Elixium.Store.Ledger
alias Elixium.BlockEncoder
alias Elixium.Store.Oracle
alias Elixium.Transaction
@moduledoc """
Responsible for implementing the consensus rules to all blocks and transactions
... | lib/validator.ex | 0.718397 | 0.476884 | validator.ex | starcoder |
defmodule Bitcoin.Protocol.Messages.Block do
@moduledoc """
The block message is sent in response to a getdata message which requests transaction information from a block hash.
The SHA256 hash that identifies each block (and which must have a run of 0 bits) is calculated from the first 6
fields of this s... | lib/bitcoin/protocol/messages/block.ex | 0.879755 | 0.710415 | block.ex | starcoder |
defmodule ContentSecurityPolicy.Plug.AddSourceValue do
@moduledoc """
Plug which adds a source value to the given directive.
This plug must be run after the `ContentSecurityPolicy.Setup` plug, or it
will raise an exception.
## Example Usage
In a controller or router:
plug ContentSecurityPolicy.Set... | lib/content_security_policy/plug/add_source_value.ex | 0.895925 | 0.489931 | add_source_value.ex | starcoder |
defmodule Toastr.Notifier do
@moduledoc """
Helper to make useful notifications to be used in LiveView.
It implements the to_flash/2 function to put flashes on the socket.
## Examples
```elixir
defmodule MyWeb.Notifier do
use Toastr.Notifier, MyWeb.Gettext
defp model_name(%My.Accounts.User{name:... | lib/toastr/notifier.ex | 0.742608 | 0.632006 | notifier.ex | starcoder |
if Code.ensure_loaded?(Ecto) do
defmodule PromEx.Plugins.Ecto do
@moduledoc """
This plugin captures metrics emitted by Ecto. Be sure that your PromEx module is listed before your Repo module
in your supervision tree so that the Ecto init events are not missed. If you miss those events the dashboard
v... | lib/prom_ex/plugins/ecto.ex | 0.813127 | 0.690813 | ecto.ex | starcoder |
defmodule FlowAssertions do
@moduledoc """
This is a library of assertions for Elixir's ExUnit. It emphasizes two things:
1. Making tests easier to scan by capturing frequently-used assertions in
functions that can be used in a pipeline.
This library will appeal to people who prefer this:
```elixir
... | lib/flow_assertions.ex | 0.878419 | 0.938463 | flow_assertions.ex | starcoder |
defmodule Model.Prediction do
@moduledoc """
The predicted `arrival_time` and `departure_time` to/from a stop (`stop_id`) at a given sequence (`stop_sequence`)
along a trip (`trip_id`) going a direction (`direction_id`) along a route (`route_id`).
See [GTFS Realtime `FeedMesage` `FeedEntity` `TripUpdate` `Trip... | apps/model/lib/model/prediction.ex | 0.894824 | 0.692181 | prediction.ex | starcoder |
defmodule Plymio.Codi.Pattern.Proxy do
@moduledoc ~S"""
The *proxy* patterns manage the *vekil*.
See `Plymio.Codi` for an overview and documentation terms.
## Pattern: *proxy_fetch*
The *proxy_fetch* pattern fetches the *forom* of one or more *proxies* in the
*vekil*.
*proxy_fetch* maps directly to a ... | lib/codi/pattern/proxy/proxy.ex | 0.826116 | 0.403508 | proxy.ex | starcoder |
defmodule Livebook.LiveMarkdown.MarkdownHelpers do
@doc """
Reformats the given markdown document.
"""
@spec reformat(String.t()) :: String.t()
def reformat(markdown) do
markdown
|> EarmarkParser.as_ast()
|> elem(1)
|> markdown_from_ast()
end
@doc """
Extracts plain text from the given ... | lib/livebook/live_markdown/markdown_helpers.ex | 0.706899 | 0.515498 | markdown_helpers.ex | starcoder |
defmodule Placid.Response.Rendering do
defmodule UnsupportedResponseTypeError do
@moduledoc """
Error raised when a rendering engine cannot be found
for a specified response content type.
"""
defexception [ :message ]
end
defmodule Engine do
@moduledoc false
@type data :: Keyword... | lib/placid/response/rendering.ex | 0.899114 | 0.471892 | rendering.ex | starcoder |
defmodule Prometheus.Metric.Counter do
@moduledoc """
Counter is a Metric that represents a single numerical value that only ever
goes up. That implies that it cannot be used to count items whose number can
also go down, e.g. the number of currently running processes. Those
"counters" are represented by `Prom... | astreu/deps/prometheus_ex/lib/prometheus/metric/counter.ex | 0.915224 | 0.901314 | counter.ex | starcoder |
defmodule Nookal.Utils do
@moduledoc false
def extract_fields([{field, key, type} | rest], payload, acc) do
case Map.fetch(payload, key) do
{:ok, value} ->
with {:ok, cast_value} <- cast(value, type) do
extract_fields(rest, payload, %{acc | field => cast_value})
end
:erro... | lib/nookal/utils.ex | 0.775817 | 0.400779 | utils.ex | starcoder |
defmodule LiveElement.Renderer do
@moduledoc false
defmacro __before_compile__(env) do
render? = Module.defines?(env.module, {:render, 1})
root = Path.dirname(env.file)
filename = template_filename(env)
templates = Phoenix.Template.find_all(root, filename)
case {render?, templates} do
{t... | lib/live_element/renderer.ex | 0.5794 | 0.412471 | renderer.ex | starcoder |
defmodule AdventOfCode.Solutions.Day03 do
@moduledoc """
Solution for day 3 exercise.
### Exercise
https://adventofcode.com/2021/day/3
"""
require Logger
alias AdventOfCode.Utils
def energy_consumption(filename) do
[gamma, epsilon] =
filename
|> File.read!()
|> parse_file()
... | lib/advent_of_code/solutions/day03.ex | 0.731346 | 0.540803 | day03.ex | starcoder |
defmodule JOSEVirtualHSM do
@moduledoc """
Virtual JOSE HSM for signing JWSes and decrypting JWEs
It is a virtual HSM in the sense that keys private keys for signing and decrypting are not
available to other processes, and are particularly protected against leaking:
- there are stored in a private ETS
- pr... | lib/jose_virtual_hsm.ex | 0.72487 | 0.50415 | jose_virtual_hsm.ex | starcoder |
defmodule AWS.WorkSpaces do
@moduledoc """
Amazon WorkSpaces Service
Amazon WorkSpaces enables you to provision virtual, cloud-based Microsoft
Windows and Amazon Linux desktops for your users.
"""
@doc """
Associates the specified IP access control group with the specified
directory.
"""
def asso... | lib/aws/work_spaces.ex | 0.875095 | 0.439386 | work_spaces.ex | starcoder |
defmodule SpandexPhoenix do
@moduledoc """
A Plug wrapper for use in a Plug.Router or Phoenix.Endpoint to trace the entire request with Spandex.
> NOTE: If you want to `use` this in combination with `Plug.ErrorHandler` or
similar "wrapper" plugs, this one should be last so that it traces the
effects of the o... | lib/spandex_phoenix.ex | 0.856152 | 0.782912 | spandex_phoenix.ex | starcoder |
defmodule Multipipe do
@moduledoc """
Macros to augment the default pipe, allowing multiple parameter pipes and
pipes into arbitrary inputs.
Our first example of using multiple parameter pipes sets the first parameter
as "Hello", the second as "World", and pipes them into the string
concatenation function ... | lib/multipipe.ex | 0.89019 | 0.759292 | multipipe.ex | starcoder |
defmodule Rox.Batch do
@moduledoc """
Module for performing atomic write operations on a database.
"""
alias Rox.{DB, ColumnFamily, Utils, Native}
alias __MODULE__
@typedoc "A reference to a batch operation"
@type t :: %__MODULE__{operations: [op]}
defstruct operations: []
@typep op ::
... | lib/rox/batch.ex | 0.913941 | 0.447219 | batch.ex | starcoder |
defmodule Mux.Data.Metrics do
@moduledoc """
This module provides functions that interact with the `metrics` endpoints, which includes a bulk
of the data product's statistical data.
Note, these API documentation links may break periodically as we update documentation titles.
- [Breakdowns](https://docs.mux.c... | lib/mux/data/metrics.ex | 0.894797 | 0.594051 | metrics.ex | starcoder |
defmodule Integer do
@moduledoc """
Functions for working with integers.
"""
import Bitwise
@doc """
Determines if `integer` is odd.
"""
defguard is_odd(integer) when is_integer(integer) and (integer &&& 1) == 1
@doc """
Determines if an `integer` is even.
"""
defguard is_even(integer) when i... | samples/Elixir/integer.ex | 0.850282 | 0.477371 | integer.ex | starcoder |
defmodule Adventofcode.Day09MarbleMania do
use Adventofcode
alias Adventofcode.Circle
@enforce_keys [:last, :marbles, :players]
defstruct turn: 0, last: 0, marbles: nil, players: {}
def winning_score(input) do
input
|> new
|> play
end
def winning_score_times_hundred(input) do
input
... | lib/day_09_marble_mania.ex | 0.721743 | 0.530297 | day_09_marble_mania.ex | starcoder |
defmodule EQRCode.ReedSolomon do
@moduledoc false
import Bitwise
@rs_block %{
# version => {error_code_len, data_code_len, remainder_len}
1 => {07, 019, 0},
2 => {10, 034, 7},
3 => {15, 055, 7},
4 => {20, 080, 7},
5 => {26, 108, 7},
6 => {18, 068, 7},
7 => {20, 078, 0}
}
@for... | lib/eqrcode/reed_solomon.ex | 0.663124 | 0.471041 | reed_solomon.ex | starcoder |
defmodule PidController do
@moduledoc """
Documentation for PidController.
## Controller action
By default, the controller will produce a direct control action, meaning that
an increasing error term will result in an increasing control value.
If the controller action is set to `:reverse`, an increasing er... | lib/pid_controller.ex | 0.862598 | 0.536495 | pid_controller.ex | starcoder |
defmodule GrassHopper do
@moduledoc """
GrassHopper is a tiny abstraction over GenServer, that helps building
dynamically scheduled recursive processes. It allows to efficiently jump
along timestamps and perform user defined actions. Think of a librarian
going through the list of borrowed books and calling th... | lib/grass_hopper.ex | 0.754779 | 0.468183 | grass_hopper.ex | starcoder |
defmodule Geocalc.Calculator.Area do
@moduledoc false
alias Geocalc.{Calculator, Point, Shape}
@pi :math.pi()
def point_in_area?(area, point) do
coord = to_cartesian_in_plane(area, point)
geometric_function(area, coord) > 0
end
def point_outside_area?(area, point) do
coord = to_cartesian_in_... | lib/geocalc/calculator/area.ex | 0.857976 | 0.922062 | area.ex | starcoder |
require Logger
defmodule ExoSQL do
@moduledoc """
Creates a Generic universal parser that can access many tabular databases,
and perform SQL queries.
The databases can be heterogenic, so you can perform searches mixing
data from postgres, mysql, csv or Google Analytics.
For example:
```
iex> {:ok,... | lib/exosql.ex | 0.749271 | 0.796728 | exosql.ex | starcoder |
defmodule GenAMQP do
@moduledoc """
GenAMQP is a library to create easily Publish/Subscribe and RPC style in AMQP by defining some settings and using a friendly macro
In the settings file put:
```elixir
config :gen_amqp,
connections: [
{:static, StaticConnSup, ConnHub, "amqp://guest:gu... | lib/gen_amqp.ex | 0.770465 | 0.858837 | gen_amqp.ex | starcoder |
defmodule Volley do
@moduledoc """
GenStage and Broadway producers for EventStoreDB
Volley provides a GenStage producer `Volley.InOrderSubscription` and a
GenStage/Broadway producer `Volley.PersistentSubscription`. Both of these
subscription producers can read a stream from beginning to end and then
keep u... | lib/volley.ex | 0.785103 | 0.593433 | volley.ex | starcoder |
defmodule Base do
import Bitwise
@moduledoc """
This module provides data encoding and decoding functions
according to [RFC 4648](http://tools.ietf.org/html/rfc4648).
This document defines the commonly used base 16, base 32, and base
64 encoding schemes.
## Base 16 alphabet
| Value | Encoding | ... | lib/elixir/lib/base.ex | 0.663996 | 0.668366 | base.ex | starcoder |
defmodule AWS.Importexport do
@moduledoc """
AWS Import/Export Service
AWS Import/Export accelerates transferring large amounts of data between
the AWS cloud and portable storage devices that you mail to us. AWS
Import/Export transfers data directly onto and off of your storage devices
using Amazon's high... | lib/aws/importexport.ex | 0.712032 | 0.495117 | importexport.ex | starcoder |
defmodule PgRanges.NumRange do
@moduledoc """
Wraps a `Postgrex.Range` and casts to a PostgreSQL `numrange` type.
"""
use PgRanges
@type t :: %__MODULE__{
lower: float(),
lower_inclusive: boolean(),
upper: float(),
upper_inclusive: boolean()
}
@doc false
@... | lib/pg_ranges/numrange.ex | 0.90485 | 0.430806 | numrange.ex | starcoder |
defmodule Statux.Transitions do
@moduledoc """
Handles evaluation and execution of a Transition from one to another or the same status.
"""
alias Statux.Models.EntityStatus
alias Statux.Models.Status
require Logger
@doc """
Pass in an entity state, a list of options and the name of the status
... | lib/Statux/transitions.ex | 0.733738 | 0.492371 | transitions.ex | starcoder |
defmodule ExUnit.Callbacks do
@moduledoc %B"""
This module defines four callbacks: `setup_all`, `teardown_all`,
`setup` and `teardown`.
Those callbacks are defined via macros and each one can optionally receive a
keyword list with metadata, usually referred to as `context`. The callback
may optionally put ... | lib/ex_unit/lib/ex_unit/callbacks.ex | 0.828454 | 0.607721 | callbacks.ex | starcoder |
defmodule Goodoo do
@moduledoc """
Goodoo is a simple, robust, and highly customizable health check solution written in Elixir.
Goodoo works by periodically checking the availablity of the sub-systems based
on your configuration, and provides a few APIs to retrieves the report.
To start using Goodoo, create... | lib/goodoo.ex | 0.756627 | 0.428592 | goodoo.ex | starcoder |
defmodule AttributeRepository.Search do
@moduledoc """
Callback for searching resources
"""
@type search_result :: [search_entry()]
@type search_entry :: {AttributeRepository.resource_id(), AttributeRepository.resource()}
@doc """
Search for resources using the filter.
The search filter syntax is th... | lib/attribute_repository/search.ex | 0.897179 | 0.607256 | search.ex | starcoder |
defmodule Kino.JS.Live do
@moduledoc ~S'''
Introduces state and event-driven capabilities to JavaScript
powered kinos.
Make sure to read the introduction to JavaScript kinos in
`Kino.JS` for more context.
Similarly to static kinos, live kinos involve a custom JavaScript
code running in the browser. In f... | lib/kino/js/live.ex | 0.882212 | 0.755569 | live.ex | starcoder |
defmodule AisFront.Units.Angle do
alias __MODULE__
alias AisFront.Protocols.Convertible
defstruct value: %Decimal{}, unit: :rad
@si_unit :rad
@unit_si_ratio %{rad: 1, dd: :math.pi |> Decimal.cast |> Decimal.div(180)}
@standard_units Map.keys(@unit_si_ratio)
@compound_degree_units [:dm, :dms]
def si_u... | lib/ais_front/units/angle.ex | 0.852568 | 0.695364 | angle.ex | starcoder |
defmodule ExRabbitMQ.Consumer do
@moduledoc """
A behaviour module that abstracts away the handling of RabbitMQ connections and channels.
It abstracts the handling of message delivery and acknowlegement.
It also provides hooks to allow the programmer to wrap the consumption of a message without having to dire... | lib/ex_rabbit_m_q/consumer.ex | 0.885854 | 0.811974 | consumer.ex | starcoder |
defprotocol Calendar.ContainsDate do
@doc """
Returns a Calendar.Date struct for the struct in question
"""
def date_struct(data)
end
defmodule Calendar.Date do
@moduledoc """
The Date module provides a struct to represent a simple date: year, month and day.
"""
@doc """
Takes a Date struct and retu... | data/web/deps/calendar/lib/calendar/date.ex | 0.806777 | 0.679059 | date.ex | starcoder |
defmodule Membrane.Element.GCloud.SpeechToText.SamplesQueue do
@moduledoc false
alias Membrane.Payload
@type samples_num :: non_neg_integer()
defstruct q: Qex.new(), total: 0, limit: :infinity
@opaque t :: %__MODULE__{
q: Qex.t({samples_num(), Payload.t()}),
total: samples_num(),
... | lib/gcloud_speech_to_text/samples_queue.ex | 0.924253 | 0.588121 | samples_queue.ex | starcoder |
defmodule ExDhcp.Utils do
@moduledoc """
Utilities that make the DHCP module easy to use. Typespecs for data types
and binary and string conversions for ip and mac addresses
"""
@typedoc "erlang-style ip addresses"
@type ip4 :: :inet.ip4_address
@typedoc "mac addresses in the same style as the erlang i... | lib/ex_dhcp/utils.ex | 0.847495 | 0.776072 | utils.ex | starcoder |
defmodule Herald.Message do
@moduledoc """
Defines the behaviour to Message Schemas.
Message Schemas are the structs which represents data
exchanged using a Broker queue.
Any message which you expect receive or send
in your application must be represented by a module,
and this module must `use/2` `Heral... | lib/herald/message.ex | 0.886377 | 0.800185 | message.ex | starcoder |
defmodule AWS.ServiceQuotas do
@moduledoc """
Service Quotas is a web service that you can use to manage many of your AWS
service quotas.
Quotas, also referred to as limits, are the maximum values for a resource, item,
or operation. This guide provide descriptions of the Service Quotas actions that
you ca... | lib/aws/generated/service_quotas.ex | 0.859 | 0.631992 | service_quotas.ex | starcoder |
defmodule TradeIndicators.ATR do
use TypedStruct
alias __MODULE__, as: ATR
alias __MODULE__.Item
alias TradeIndicators.MA
alias TradeIndicators.Util, as: U
alias Decimal, as: D
alias List, as: L
alias Enum, as: E
alias Map, as: M
typedstruct do
field :list, List.t(), default: []
field :peri... | lib/atr.ex | 0.547948 | 0.465934 | atr.ex | starcoder |
defmodule Crux.Structs.Snowflake.Parts do
@moduledoc """
Custom non discord api struct representing a deconstructed Discord snowflake.
## Structure of the Parts
| Field | Bits | Number of Bits | Description |
| :---------... | lib/structs/snowflake.ex | 0.840128 | 0.698355 | snowflake.ex | starcoder |
defmodule Goldie.Utils do
@moduledoc """
Misc utils
"""
@doc """
min of two numbers
"""
@spec min(number, number) :: number()
def min(x, y) when x < y, do: x
def min(_x, y), do: y
@doc """
max of two numbers
"""
@spec max(number, number) :: number()
def max(x, y) when x > y, do: x
def ma... | lib/goldie/utils.ex | 0.734596 | 0.517693 | utils.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.