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 EctoLtree.LabelTree do
@moduledoc """
This module defines the LabelTree struct.
Implements the Ecto.Type behaviour.
## Fields
* `labels`
"""
use Ecto.Type
alias EctoLtree.LabelTree, as: Ltree
@type t :: %__MODULE__{
labels: [String.t()]
}
defstruct labels: []
@l... | lib/ecto_ltree/label_tree.ex | 0.856647 | 0.475666 | label_tree.ex | starcoder |
defmodule Utils.Build do
@moduledoc """
This module basically acts as a way to define code that will be determined at
compile time instead of runtime. It is kind of like using config.exs values
but can do much more like defining different function implementations, etc.
NOTE: PLEASE USE WITH EXTREME CAUTION... | src/apps/utils/lib/utils/build.ex | 0.7011 | 0.46217 | build.ex | starcoder |
defmodule Spell.Role do
@moduledoc """
The `Spell.Role` module defines the behaviour of a role in spell.
A role specifies the logic for handling groups of commands. A peer is started
with one or more roles, which the peer uses to configure its state and handle
its messages.
## Callbacks
A module must i... | lib/spell/role.ex | 0.753829 | 0.528533 | role.ex | starcoder |
defmodule Typelixir.FunctionsExtractor do
@moduledoc false
alias Typelixir.{PatternBuilder, TypeComparator, Utils}
# extends the given functions env map with the module name and the functions it defines
def extract_functions_file(path, env) do
ast = Code.string_to_quoted(File.read!(Path.absname(path))) ... | lib/typelixir/functions_extractor.ex | 0.694095 | 0.402686 | functions_extractor.ex | starcoder |
defmodule Sanbase.ExternalServices.Coinmarketcap.TickerFetcher do
@moduledoc ~s"""
A GenServer, which updates the data from coinmarketcap on a regular basis.
Fetches only the current info and no historical data.
On predefined intervals it will fetch the data from coinmarketcap and insert it
into a lo... | lib/sanbase/external_services/coinmarketcap/ticker_fetcher.ex | 0.588534 | 0.538437 | ticker_fetcher.ex | starcoder |
defmodule DayEleven do
@neighbours [
# three at the top
{-1, -1},
{0, -1},
{1, -1},
# two in the middle
{-1, 0},
{1, 0},
# three at the bottom
{-1, 1},
{0, 1},
{1, 1}
]
@max_count 4
def solve(input) do
input
|> build_map()
|> step_until_stable()
# |> ... | adv_2020/lib/day_11.ex | 0.563018 | 0.620363 | day_11.ex | starcoder |
defmodule FaktoryWorker.Job do
@moduledoc """
The `FaktoryWorker.Job` module is used to perform jobs in the background by sending to and fetching from Faktory.
To build a worker you must `use` the job module within a module in your application.
```elixir
defmodule MyApp.SomeWorker do
use FaktoryWorker.J... | lib/faktory_worker/job.ex | 0.765111 | 0.850841 | job.ex | starcoder |
defmodule OpenExchangeRates do
@moduledoc """
This module contains all the helper methods for converting currencies
"""
use Application
require Logger
@doc false
def start(_type, _args) do
import Supervisor.Spec, warn: false
configuration_status = check_configuration()
children = [worker(Ope... | lib/open_exchange_rates.ex | 0.88842 | 0.514583 | open_exchange_rates.ex | starcoder |
defmodule IpAccessControl do
@behaviour Plug
@moduledoc """
This Plug restricts requests so that they must come from the range of IP
addresses specified in the pipeline config. A request's IP address is deemed
to be present as `%Plug.Conn{remote_ip: _}`.
If the request IP is not allowed, the specified res... | lib/ip_access_control.ex | 0.890648 | 0.494263 | ip_access_control.ex | starcoder |
defmodule Pbkdf2 do
@moduledoc """
Elixir wrapper for the Pbkdf2 password hashing function.
For a lower-level API, see Pbkdf2.Base.
## Configuration
The following parameter can be set in the config file:
* rounds - computational cost
* the number of rounds
* 160_000 is the default
If yo... | lib/pbkdf2.ex | 0.898755 | 0.599133 | pbkdf2.ex | starcoder |
defmodule Godfist.Summoner do
@moduledoc """
Module to interact with the Summoner endpoint.
"""
alias Godfist.LeagueRates
@endpoint "/lol/summoner/v3/summoners"
@doc """
Get a summoner's data by account id.
## Example
```elixir
iex> Godfist.Summoner.by_id(:lan, id)
```
"""
@spec by_id(ato... | lib/godfist/requests/summoner.ex | 0.827131 | 0.733667 | summoner.ex | starcoder |
defmodule Streams do
@moduledoc """
Various implementations of the Caffeine Stream library.
The take/1 function from Caffeine is the best way to retrive elements.
"""
alias Caffeine.Stream
alias Caffeine.Element
@doc """
Returns a construct that repeats given number an infinite amount of times.
## E... | learning/meetup_2018_03/streams/lib/streams.ex | 0.928684 | 0.583678 | streams.ex | starcoder |
defmodule Minex.DSL do
alias Minex.Config
@doc """
Set a (global) variable by keyword list. Returns the previous values or nil if unset
```
set(a: value_a, b: value_b)
```
"""
@spec set(keyword()) :: keyword()
def set(keyword_list) when is_list(keyword_list) do
Config.set(keyword_list)
end
... | lib/minex/dsl.ex | 0.774796 | 0.82386 | dsl.ex | starcoder |
defmodule Pigpiox.GPIO do
@gpio_modes_map %{
input: 0,
output: 1,
alt0: 4,
alt1: 5,
alt2: 6,
alt3: 7,
alt4: 3,
alt5: 2
}
@gpio_modes Map.keys(@gpio_modes_map)
@inverted_gpio_modes_map for {key, val} <- @gpio_modes_map, into: %{}, do: {val, key}
@moduledoc """
This module exposes pi... | lib/pigpiox/gpio.ex | 0.83363 | 0.538741 | gpio.ex | starcoder |
defmodule Commissar.Authorization do
@moduledoc """
Authorizers add a convenient way of laying out policies in a manner that makes
it easy to read. Defining policies in a module that uses
`Commissar.Authorizer` also adds a catch-all policy that returns `:continue`,
allowing your own policies to simply focus o... | lib/commissar/authorization.ex | 0.82573 | 0.618305 | authorization.ex | starcoder |
defmodule Editor.Block.Selection do
@moduledoc """
Holds current selection in a block.
Passed from client to backend and vice-versa when executing block commands.
The ids are ids of cells in which a selection starts or ends.
The offests are indices within those cells where the selection starts or ends.
T... | lib/philtre/block/selection.ex | 0.811489 | 0.635279 | selection.ex | starcoder |
defmodule Unleash.Cache do
@moduledoc """
This module is a cache backed by an ETS table. We use it to allow for multiple
threads to read the feature flag values concurrently on top of minimizing
network calls
"""
@cache_table_name :unleash_cache
def cache_table_name, do: @cache_table_name
@doc """
... | lib/unleash/cache.ex | 0.73782 | 0.440469 | cache.ex | starcoder |
defmodule ExConfig do
@moduledoc """
Module enhancer for creating a nice place to get configuration data for
your application
To use, create a new module with something like
defmodule MyApp.Config do
use ExConfig
end
Configs under `:my_app` can be had via `MyApp.Config`'s `&fetch/2`,
... | lib/ex_config.ex | 0.911666 | 0.586345 | ex_config.ex | starcoder |
defmodule Oban.Crontab.Parser do
@moduledoc false
@doc """
Parses the given `binary` as cron.
Returns `{:ok, [token], rest, context, position, byte_offset}` or
`{:error, reason, rest, context, line, byte_offset}` where `position`
describes the location of the cron (start position) as {line, column_on_lin... | lib/oban/crontab/parser.ex | 0.841289 | 0.441613 | parser.ex | starcoder |
defmodule Simplify do
@moduledoc """
Implementation of the [Ramer–Douglas–Peucker](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm)
algorithm for reducing the number of points used to represent a curve.
The `Simplify` module contains a function `simplify` that accepts a List of
... | lib/simplify.ex | 0.923523 | 0.990678 | simplify.ex | starcoder |
defmodule Options.Depreciated do
@moduledoc """
Various functions for evaluating call options using binomial method.
"""
# annual volatility to growth rate per delta-t in years
def voltorate(volatility, dt) do
with exponent = volatility * :math.sqrt(dt) do
:math.exp(exponent)
end
end
@doc ... | lib/options/depreciated.ex | 0.67104 | 0.530419 | depreciated.ex | starcoder |
defmodule Tai.Venues.Boot do
@moduledoc """
Coordinates the asynchronous hydration of a venue:
- products
- accounts
- fees
"""
alias __MODULE__
@type venue :: Tai.Venue.t()
@spec run(venue) :: {:ok, venue} | {:error, {venue, [reason :: term]}}
def run(venue) do
venue
|> hydrate_products... | apps/tai/lib/tai/venues/boot.ex | 0.697712 | 0.45302 | boot.ex | starcoder |
defmodule Mix.Utils do
@moduledoc """
Utilities used throughout Mix and tasks.
## Conversions
This module handles two types of conversions:
* From command names to module names, i.e. how the command
`deps.get` translates to `Deps.Get` and vice-versa;
* From underscore to camelize, i.e. how the file ... | lib/mix/lib/mix/utils.ex | 0.819026 | 0.576005 | utils.ex | starcoder |
defmodule DataSpecs.Loader.Builtin do
@moduledoc """
Erlang builtin types loaders
"""
alias DataSpecs.Types
@spec any(Types.value(), Types.custom_type_loaders(), [Types.type_loader_fun()]) ::
{:error, Types.reason()} | {:ok, any()}
def any(value, _custom_type_loaders, _type_params_loaders) do
... | lib/dataspecs/loader/builtin.ex | 0.883588 | 0.487795 | builtin.ex | starcoder |
defmodule Gringotts.Gateways.Stripe do
@moduledoc """
Stripe gateway implementation. For reference see [Stripe's API documentation](https://stripe.com/docs/api).
The following features of Stripe are implemented:
| Action | Method |
| ------ | ------ |... | lib/gringotts/gateways/stripe.ex | 0.873606 | 0.65256 | stripe.ex | starcoder |
defmodule APDS9960.Register do
@moduledoc false
@doc """
Sets only specified bit values in a register value struct.
"""
@spec set_bits(struct, Enum.t()) :: struct
def set_bits(parsed_data, opts) when is_struct(parsed_data) do
struct!(parsed_data, opts)
end
@doc """
Converts a register value stru... | lib/apds9960/register.ex | 0.675444 | 0.546073 | register.ex | starcoder |
defmodule Blunt.Data.Factories.Values.Prop do
@moduledoc false
@derive {Inspect, except: [:lazy]}
defstruct [:field, :path_func_or_value, lazy: false]
alias Blunt.Data.FactoryError
alias Blunt.Data.Factories.Factory
alias Blunt.Data.Factories.Values.Prop
defimpl Blunt.Data.Factories.Value do
def dec... | apps/blunt_data/lib/blunt/data/factories/values/prop.ex | 0.693784 | 0.493775 | prop.ex | starcoder |
defmodule Ktsllex.Schemas do
@moduledoc """
This sets up the schemas as required to run.
"""
use Confex, otp_app: :ktsllex
require Logger
alias Ktsllex.FileJson
@doc """
Creates key and value schemas with schema_name on host, loading json schemas from base_schema_file
### Params
* `host` - A kaf... | lib/ktsllex/schemas.ex | 0.746971 | 0.654029 | schemas.ex | starcoder |
defmodule Grizzly.ZWave.Commands.DoorLockConfigurationReport do
@moduledoc """
This command is used to advertise the configuration parameters of a door lock device.
Params:
* `:operation_type` - the operation type at the supporting node. One of :constant_operation and :timed_operation. (required)
* `:m... | lib/grizzly/zwave/commands/door_lock_configuration_report.ex | 0.80077 | 0.441733 | door_lock_configuration_report.ex | starcoder |
defmodule Astro.Lunar do
@moduledoc """
Calulates lunar phases.
Each of the phases of the Moon is defined by the
angle between the Moon and Sun in the sky. When the Moon
is in between the Earth and the Sun, so that there is nearly a
zero degree separation, we see a New Moon.
Because the orbit of the Moo... | lib/astro/lunar.ex | 0.954372 | 0.82741 | lunar.ex | starcoder |
defmodule Operate.Tape do
@moduledoc """
Module for working with Operate tapes.
An Operate program is a tape made up of one or more cells, where each cell
contains a single atomic procedure call (known as an "Op").
When a tape is run, each cell is executed in turn, with the result from each
cell is passed... | lib/operate/tape.ex | 0.861261 | 0.704783 | tape.ex | starcoder |
defmodule Pathfinding.Grid do
@moduledoc ~S"""
Grid definition that calls to `Pathfinding.find_path` and
`Pathfinding.find_walkable` will search against. The grid is defined so its
easy to make repeated searches across it without repeatedly reconstructing it.
### Tiles, Walkability, Costs
%Pathfinding... | lib/grid.ex | 0.936387 | 0.80077 | grid.ex | starcoder |
defmodule Scitree.Config do
@type t :: %__MODULE__{}
@type learners :: :cart | :gradient_boosted_trees | :random_forest
@default_options [
maximum_model_size_in_memory_in_bytes: -1.0,
maximum_training_duration_seconds: -1.0,
random_seed: 123_456
]
defstruct learner: :gradient_boosted_trees,
... | lib/scitree/config.ex | 0.874232 | 0.494019 | config.ex | starcoder |
defmodule Exzeitable.Parameters do
@moduledoc """
Gets default parameters, replaces with module opts and then with the function opts.
Validates that parameters are valid.
"""
alias Exzeitable.HTML.Format
alias Exzeitable.Parameters.{ParameterError, Validation}
@parameters %{
query: %{required: true}... | lib/exzeitable/parameters.ex | 0.744656 | 0.428174 | parameters.ex | starcoder |
defmodule FalconPlusApi.Api.Aggreator do
alias Maxwell.Conn
alias FalconPlusApi.{Util, Sig, Api}
@doc """
* [Session](#/authentication) Required
* numerator: 分子
* denominator: 分母
* step: 汇报周期(秒为单位)
### Request
```{
"tags": "",
"step": 60,
"numerator": "$(cpu.idl... | lib/falcon_plus_api/api/aggreator.ex | 0.52902 | 0.73077 | aggreator.ex | starcoder |
defmodule Genex.Tools.Genotype do
alias Statistics.Distributions
@moduledoc """
Contains functions for generating various Genotypes.
These are most of the genotypes you will use in basic genetic algorithms.
"""
@doc """
Creates a binary geneset.
Returns `Enum.t()`.
# Parameters
- `size`: Siz... | lib/genex/tools/genotype.ex | 0.902827 | 0.750004 | genotype.ex | starcoder |
defmodule Ockam.Messaging.PipeChannel.Handshake do
@moduledoc """
Pipe channel handshake implementation
1.
Initiator creates a receiver and sends own inner address and receiver address
in the handshake message.
Return route of the handshake message contains a route to initiator receiver
2.
Responder c... | implementations/elixir/ockam/ockam/lib/ockam/messaging/pipe_channel/handshake.ex | 0.771628 | 0.435841 | handshake.ex | starcoder |
defmodule Twitter.User do
@moduledoc """
Represents the user and all the related informations
Every user in the system is represented with a server, all users are
identified by their name and so all processes are locally registered
using the same name.
When a user is mentioned for the first time a server ... | lib/user.ex | 0.716119 | 0.4436 | user.ex | starcoder |
defmodule MatchEngine do
@moduledoc """
MatchEngine is an in-memory matching/filtering engine with
Mongo-like query syntax.
The query language consists of nested Elixir "keyword list". Each
component of the query consists of a *key* part and a *value*
part. The key part is either a logic operator (and/or/... | lib/match_engine.ex | 0.936066 | 0.938632 | match_engine.ex | starcoder |
defmodule TwitterSpaceDL do
@moduledoc """
Twitter Space Audio Downloader
"""
require Logger
use GenServer
@user_agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15"
@audio_space_metadata_endpoint "https://twitter.com/i/api/graphql... | lib/twitter_space_dl.ex | 0.775477 | 0.429669 | twitter_space_dl.ex | starcoder |
defmodule Annex.Data.List1D do
@moduledoc """
The Annex.Data.List is the most basic Annex.Data.
"""
use Annex.Data
alias Annex.{
AnnexError,
Data.List2D,
Shape,
Utils
}
import Utils, only: [is_pos_integer: 1]
@type t() :: [float(), ...]
defguard is_list1D(data) when Data.is_flat_da... | lib/annex/data/list_1d.ex | 0.814754 | 0.706722 | list_1d.ex | starcoder |
defmodule Surface.Catalogue.Playground do
@moduledoc """
Experimental LiveView to create Playgrounds for catalogue tools.
## Options
Besides the buit-in options provided by the LiveView itself, a Playground also
provides the following options:
* `subject` - Required. The target component of the Playgro... | lib/surface/catalogue/playground.ex | 0.863075 | 0.484868 | playground.ex | starcoder |
defmodule Zaryn.Election.ValidationConstraints do
@moduledoc """
Represents the constraints for the validation nodes election
"""
@default_min_validation_geo_patch 3
@default_min_validations 3
defstruct [
:min_geo_patch,
:min_validation_nodes,
:validation_number
]
alias Zaryn.TransactionC... | lib/zaryn/election/constraints/validation.ex | 0.871693 | 0.610366 | validation.ex | starcoder |
defmodule Cryptopunk.Key do
@moduledoc """
Utility functions to work with keys
"""
defstruct [:type, :key, :chain_code, :depth, :index, :parent_fingerprint]
alias Cryptopunk.Utils
@type t :: %__MODULE__{}
@master_hmac_key "Bitcoin seed"
@spec new(Keyword.t()) :: t()
def new(opts) do
type = Key... | lib/cryptopunk/key.ex | 0.826747 | 0.495972 | key.ex | starcoder |
defmodule Delta.Message do
alias Updates.QueryAnalyzer.Types.Quad, as: Quad
alias SparqlServer.Router.AccessGroupSupport, as: AccessGroupSupport
@moduledoc """
Contains code to construct the correct messenges for informing
clients.
"""
@typedoc """
Type of the messages which can be sent to a client. ... | lib/delta/message.ex | 0.526586 | 0.417153 | message.ex | starcoder |
defmodule Cased.BypassTagHelper do
@moduledoc """
Provides helpers to support configuring Bypass in test `setup`.
"""
@doc """
Configure Bypass with options:
## Examples
Don't do any configuration (no-op):
```
@tag :bypass
```
Configure Bypass to return the contents of `test/fixtures/foo.json... | test/support/cased/bypass_tag_helper.ex | 0.858511 | 0.778439 | bypass_tag_helper.ex | starcoder |
defmodule Mint.WebSocket.Frame do
@moduledoc false
# Functions and data structures for describing websocket frames.
# https://tools.ietf.org/html/rfc6455#section-5.2
import Record
alias Mint.WebSocket.{Utils, Extension}
alias Mint.WebSocketError
@compile {:inline, apply_mask: 2, apply_mask: 3}
share... | lib/mint/web_socket/frame.ex | 0.712932 | 0.52342 | frame.ex | starcoder |
defmodule HedwigTrivia.Logic do
@moduledoc """
A home for the business logic of fetching/answering questions.
"""
alias HedwigTrivia.{
Answer,
GameState,
Question
}
@type force_new :: boolean()
@incorrect_prefixes [
"No. Sorry ",
"I'm afraid "
]
@correct_prefixes [
"Yes! ",
... | lib/hedwig_trivia/logic.ex | 0.64512 | 0.546012 | logic.ex | starcoder |
defmodule Cryptopunk.Mnemonic do
@moduledoc """
Implements mnemonic generation logic.
See https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
"""
@word_number_to_entropy_bits %{12 => 128, 15 => 160, 18 => 192, 21 => 224, 24 => 256}
@word_numbers Map.keys(@word_number_to_entropy_bits)
@words :c... | lib/cryptopunk/mnemonic.ex | 0.876667 | 0.470493 | mnemonic.ex | starcoder |
defmodule BlurHash do
@moduledoc """
Pure Elixir implementation of Blurhash algorithm with no additional dependencies.
Blurhash is an algorithm by <NAME> that decodes an image to a very compact (~ 20-30 bytes) ASCII string representation, which can be then decoded into a blurred placeholder image. See the main r... | lib/blur_hash.ex | 0.857723 | 0.555134 | blur_hash.ex | starcoder |
defmodule Mix.Tasks.Sfc.Gen.Init do
@moduledoc """
Generates a Surface component.
"""
use Mix.Task
@switches [template: :boolean, namespace: :string, demo: :boolean, context_app: :string]
@default_opts [template: true, namespace: "components", demo: true]
@aliases [t: :template, n: :namespace, d: :demo]
... | lib/mix/tasks/sfc.gen.init.ex | 0.677154 | 0.401834 | sfc.gen.init.ex | starcoder |
defmodule ExDebugger.Tokenizer.NestedModule do
@moduledoc false
use CommendableComments
@modulecomment """
Nested Modules require special attention when employing `use ExDebugger`. This is because by default, every module
imports `Kernel` which includes `def` and `defp` which in the interest of hijacking the... | lib/ex_debugger/tokenizer/nested_module.ex | 0.799051 | 0.845241 | nested_module.ex | starcoder |
defmodule Asteroid.Crypto.Key do
@moduledoc """
Convenience module to work with cryptographic keys
"""
import Asteroid.Utils
alias JOSE.JWK
defmodule InvalidUseError do
@moduledoc """
Error returned when a `t:key_config_entry/0` is invalid because its `:use` is invalid
`:use` must be one ato... | lib/asteroid/crypto/key.ex | 0.95363 | 0.834272 | key.ex | starcoder |
defmodule Phoenix.Tracker do
@moduledoc ~S"""
Provides distributed Presence tracking to processes.
The `Tracker` API is used as a facade for a pool of `Phoenix.Tracker.Shard`s.
The responsibility of which calls go to which `Shard` is determined based on
the topic, on which a given function is called.
Trac... | lib/phoenix/tracker.ex | 0.921623 | 0.745225 | tracker.ex | starcoder |
defmodule Plausible.Stats.Query do
defstruct date_range: nil, step_type: nil, period: nil, steps: nil, filters: %{}
def shift_back(%__MODULE__{period: "day"} = query) do
new_date = query.date_range.first |> Timex.shift(days: -1)
Map.put(query, :date_range, Date.range(new_date, new_date))
end
def shift... | lib/plausible/stats/query.ex | 0.786295 | 0.516656 | query.ex | starcoder |
defmodule ExActivity do
alias ExActivity.{Activity, Log}
@moduledoc """
Enables to log activity in a structured way to a MySQL database. The logs are saved in a *non blocking way*, to minimize overhead in your application when logging.
The actual insertion in the dabase is done by using Elixir's `Task` functi... | lib/ex_activity.ex | 0.81899 | 0.553686 | ex_activity.ex | starcoder |
defmodule Ptolemy.Engines.KV do
@moduledoc """
`Ptolemy.Engines.KV` provides a public facing API for CRUD operations for the Vault KV2 engine.
"""
alias Ptolemy.Engines.KV.Engine
alias Ptolemy.Server
@doc """
Fetches all of a secret's keys and value via the `:kv_engine` configuration.
See `fetch/2` f... | lib/engines/kv/kv.ex | 0.932707 | 0.782455 | kv.ex | starcoder |
defmodule Membrane.RTP.JitterBuffer do
@moduledoc """
Element that buffers and reorders RTP packets based on `sequence_number`.
"""
use Membrane.Filter
use Bunch
alias Membrane.{RTP, Time}
alias Membrane.RTP.Utils
alias __MODULE__.{BufferStore, Record}
require Bitwise
require Membrane.Logger
@t... | lib/membrane/rtp/jitter_buffer.ex | 0.841142 | 0.405625 | jitter_buffer.ex | starcoder |
defmodule PhoenixIntegration.Form.Tag do
alias PhoenixIntegration.Form.Common
@moduledoc false
# A `Tag` is a representation of a value-providing HTML tag within a
# Phoenix-style HTML form. Tags live on the leaves of a tree (nested
# `Map`) representing the whole form. See [DESIGN.md](./DESIGN.md) for
# m... | lib/phoenix_integration/form/tag.ex | 0.78785 | 0.538012 | tag.ex | starcoder |
defmodule Node do
@moduledoc """
Functions related to Erlang nodes.
"""
@type t :: atom
@doc """
Returns the current node. It returns the same as the built-in `node()`.
"""
@spec self :: t
def self do
:erlang.node()
end
@doc """
Returns `true` if the local node is alive; that is, if the n... | lib/elixir/lib/node.ex | 0.830594 | 0.517754 | node.ex | starcoder |
defmodule Tinymesh.Config do
import Tinymesh.Config.Packer
defmodule Error do
defexception type: nil, parameter: nil, addr: nil, message: ""
end
@serializedefaults %{
:addr => false,
:vsn => nil,
:ignorero => false
}
@unserializedefaults %{addr: false, vsn: nil}
@doc """
Seri... | lib/tinymesh/config.ex | 0.715921 | 0.55658 | config.ex | starcoder |
defmodule CredoModuleFunctionOrdering.Rule do
@moduledoc """
In a module, functions should be ordered to provide better readability
across the code base by exposing the most important functions definition types
first (e.g public ones) followed by the private functions
The order of function heirarchy in a modu... | lib/rule.ex | 0.688992 | 0.564729 | rule.ex | starcoder |
defmodule URI do
@moduledoc """
Utilities for working with and creating URIs.
"""
defstruct scheme: nil, path: nil, query: nil,
fragment: nil, authority: nil,
userinfo: nil, host: nil, port: nil
@type t :: %__MODULE__{}
import Bitwise
@doc """
Returns the default port for a g... | lib/elixir/lib/uri.ex | 0.907358 | 0.510741 | uri.ex | starcoder |
defmodule Telegex.Marked.InlineParser do
@moduledoc """
Parsing implementation of inline nodes.
"""
use Telegex.Marked.Parser
alias Telegex.Marked.{
BoldRule,
UnderlineRule,
ItalicRule,
StrikethroughRule,
LinkRule,
InlineCodeRule
}
@rule_modules [BoldRule, UnderlineRule, ItalicR... | lib/telegex/marked/parsers/inline_parser.ex | 0.553747 | 0.509459 | inline_parser.ex | starcoder |
require Record
defmodule JOSE.JWK do
@moduledoc ~S"""
JWK stands for JSON Web Key which is defined in [RFC 7517](https://tools.ietf.org/html/rfc7517).
"""
record = Record.extract(:jose_jwk, from_lib: "jose/include/jose_jwk.hrl")
keys = :lists.map(&elem(&1, 0), record)
vals = :lists.map(&{&1, [], nil},... | backend/deps/jose/lib/jose/jwk.ex | 0.826292 | 0.421195 | jwk.ex | starcoder |
defmodule IRC.Server do
use GenServer
require Logger
# =============================================================================
# Internal API
# =============================================================================
@impl true
def init(state) do
{:ok, state}
end
@doc """
Process's... | lib/server.ex | 0.646572 | 0.498962 | server.ex | starcoder |
defmodule P3 do
@moduledoc """
## Examples
iex> P3.solve(5)
4
iex> P3.solve(11)
9
iex> P3.solve(4)
-1
"""
def main do
IO.read(:line) |> String.trim() |> String.to_integer() |> solve() |> IO.puts()
end
defmodule Heap do
defstruct data: nil, comparator: nil
def ne... | lib/100/p3.ex | 0.754644 | 0.561876 | p3.ex | starcoder |
defmodule Homework.Transactions do
@moduledoc """
The Transactions context.
"""
import Ecto.Query, warn: false
import Paginator
alias Homework.Repo
alias Homework.Transactions.Transaction
@doc """
Returns the list of transactions.
## Examples
iex> list_transactions([])
[%Transaction... | elixir/lib/homework/transactions.ex | 0.741019 | 0.403097 | transactions.ex | starcoder |
defmodule QueueWrapper do
@type t() :: :queue.queue()
@moduledoc """
Elixir bindings to the erlang queue library with
a few additions, such as reduce & a means to do
equality. See the [erlang docs][docs] for more info
on the module.
In some cases function names have been given more
explict names, such... | lib/queue_wrapper.ex | 0.789599 | 0.619399 | queue_wrapper.ex | starcoder |
if Enum.any?(Application.loaded_applications(), fn {dep_name, _, _} -> dep_name === :plug end) do
defmodule Stripe.WebhookPlug do
@moduledoc """
Helper `Plug` to process webhook events and send them to a custom handler.
## Installation
To handle webhook events, you must first configure your applicat... | lib/stripe/webhook_plug.ex | 0.717606 | 0.553686 | webhook_plug.ex | starcoder |
defmodule AWS.IoTSiteWise do
@moduledoc """
Welcome to the AWS IoT SiteWise API Reference. AWS IoT SiteWise is an AWS
service that connects [Industrial Internet of Things
(IIoT)](https://en.wikipedia.org/wiki/Internet_of_things#Industrial_applications)
devices to the power of the AWS Cloud. For more informat... | lib/aws/generated/iot_site_wise.ex | 0.892691 | 0.53437 | iot_site_wise.ex | starcoder |
defmodule Noizu.SimpleObject do
@doc """
Begin configuring a Simple Object.
@example ```
defmodule Container do
use Noizu.SimpleObject
Noizu.SimpleObject.noizu_struct() do
public_field :contents
end
end
```
"""
defmacro __using__(options \\ nil) do
nmid_generator = options[:nmid_... | lib/scaffolding/simple_object.ex | 0.702734 | 0.474631 | simple_object.ex | starcoder |
defmodule BitPal.ExchangeRate do
alias BitPal.ExchangeRateSupervisor
alias BitPal.ExchangeRateSupervisor.Result
alias BitPalSchemas.Currency
alias Phoenix.PubSub
@pubsub BitPal.PubSub
@type pair :: {Currency.id(), Currency.id()}
@type t :: %__MODULE__{
rate: Decimal.t(),
pair: pair
... | lib/bitpal/exchange_rate/exchange_rate.ex | 0.865878 | 0.54583 | exchange_rate.ex | starcoder |
defmodule Astarte.Flow.Blocks.VirtualDevicePool do
@moduledoc """
This is a consumer block that takes `data` from incoming `Message`s and publishes it as an Astarte device,
interpreting the `key` as <realm>/<device_id>/<interface><path>.
The list of supported devices is configured using `start_link/1`.
"""
... | lib/astarte_flow/blocks/virtual_device_pool.ex | 0.898632 | 0.465752 | virtual_device_pool.ex | starcoder |
defprotocol Recurly.XML.Parser do
@moduledoc """
Protocol responsible for parsing xml into resources
TODO - This still has some refactoring that can be done.
"""
@doc """
Parses an xml document into the given resource
## Parameters
- `resource` empty resource struct to parse into
- `xml_doc` String... | lib/recurly/xml/parser.ex | 0.679072 | 0.435781 | parser.ex | starcoder |
defmodule Openflow.Action.NxFlowSpecLoad do
defstruct(
src: nil,
dst: nil,
n_bits: 0,
src_offset: 0,
dst_offset: 0
)
@learn_src_field 0
@learn_src_immediate 1
@learn_dst 1
alias __MODULE__
@type t :: %NxFlowSpecLoad{
src: atom(),
dst: atom(),
n_bits: no... | lib/openflow/actions/nx_flow_spec_load.ex | 0.710025 | 0.465752 | nx_flow_spec_load.ex | starcoder |
defmodule HumanName do
@moduledoc """
Documentation for HumanName.
"""
@doc """
Returns the initial for the first (given) name.
## Example
iex> HumanName.first_initial("<NAME>")
{:ok, "J"}
iex> HumanName.first_initial("Dr. Alibaster Cornelius Juniper III")
{:ok, "A"}
... | lib/human_name.ex | 0.735262 | 0.435001 | human_name.ex | starcoder |
defmodule Snitch.Data.Schema.StockLocation do
@moduledoc """
Models a store location or a warehouse where stock is stored, ready to be
shipped.
"""
use Snitch.Data.Schema
alias Snitch.Data.Schema.{Country, State, StockItem}
@typedoc """
## Fields
1. `:propagate_all_variants`
If this is set to `t... | apps/snitch_core/lib/core/data/schema/stock/stock_location.ex | 0.86411 | 0.409486 | stock_location.ex | starcoder |
defmodule Asteroid.Config do
@moduledoc """
Specification of configuration options and callbacks
"""
require Asteroid.Config.Builder
alias Asteroid.Client
alias Asteroid.Crypto
alias Asteroid.OIDC
alias Asteroid.Subject
@typedoc """
A map describing scope configuration
The map keys are the sco... | lib/asteroid/config.ex | 0.967533 | 0.810816 | config.ex | starcoder |
defmodule Calendar.Date.Parse do
@doc """
Parses ISO 8601 date strings.
The function accepts both the extended and the basic format.
## Examples
# Extended format
iex> iso8601("2016-01-05")
{:ok, %Date{year: 2016, month: 1, day: 5}}
# Basic format (the basic format does not have dash... | lib/calendar/date/parse.ex | 0.829837 | 0.500366 | parse.ex | starcoder |
defmodule Sugar.Controller do
@moduledoc """
Controllers facilitate some separation of concerns for your application's logic.
All handler actions should have an arrity of 2, with the first argument being
a `Plug.Conn` representing the current connection and the second argument
being a `Keyword` list of any p... | lib/sugar/controller.ex | 0.693369 | 0.430806 | controller.ex | starcoder |
defmodule RDF.BlankNode do
@moduledoc """
An RDF blank node (aka bnode) is a local node of a graph without an IRI.
This module can also be used as `RDF.Resource.Generator` for the generation
of random identifiers, which is using the `new/0` function.
For the generation of value-based blank nodes, you can use... | lib/rdf/blank_node.ex | 0.915842 | 0.612498 | blank_node.ex | starcoder |
defmodule Scenic.Scrollable.Hotkeys do
@moduledoc """
This module handles key mappings and keypress events for `Scenic.Scrollable` components.
"""
@typedoc """
A keycode represented by a string.
The string corresponds to the character as seen on the keyboard, rather than a numeric keycode.
Special keys a... | lib/utility/hotkeys.ex | 0.819893 | 0.569104 | hotkeys.ex | starcoder |
defmodule Harald.Transport.UART.Framing do
@moduledoc """
A framer module that defines a frame as a HCI packet.
Reference: Version 5.0, Vol 2, Part E, 5.4
"""
alias Circuits.UART.Framing
defmodule State do
@moduledoc false
defstruct frame: <<>>, remaining_bytes: nil
end
@behaviour Framing
... | lib/harald/transport/uart/framing.ex | 0.782746 | 0.545528 | framing.ex | starcoder |
defmodule EVM.MachineCode do
@moduledoc """
Functions for helping read a contract's machine code.
"""
alias EVM.{ExecEnv, MachineState, Operation}
alias EVM.Operation.Metadata
@type t :: binary()
@doc """
Returns the current instruction being executed. In the
Yellow Paper, this is often referred to ... | apps/evm/lib/evm/machine_code.ex | 0.766206 | 0.497925 | machine_code.ex | starcoder |
defmodule Ratatouille.App do
@moduledoc """
Defines the `Ratatouille.App` behaviour. It provides the structure for
architecting both large and small terminal applications. This structure
allows you to render views and update them over time or in response to user
input.
## A Simple Example
defmodule ... | lib/ratatouille/app.ex | 0.90799 | 0.666339 | app.ex | starcoder |
defmodule Nosedrum.Storage do
@moduledoc """
Storages contain commands and are used by command invokers to look up commands.
How you start a storage is up to the module itself - what is
expected is that storage modules implement the behaviours
documented in this module.
The public-facing API of storage mo... | lib/nosedrum/storage.ex | 0.850531 | 0.548613 | storage.ex | starcoder |
defmodule Blurhash do
@external_resource "README.md"
@moduledoc File.read!("README.md")
@type blurhash :: String.t()
@type pixels :: <<_::8>>
@type color :: {0..255, 0..255, 0..255}
@doc "Decode a blurhash. Returns raw pixels (8bit RGB) and average color."
@spec decode(blurhash, pos_integer(), pos_integ... | lib/blurhash.ex | 0.840684 | 0.504944 | blurhash.ex | starcoder |
defmodule AmqpDirector.Client do
@moduledoc """
The AMQP RPC Client.
This module contains functionality for an RPC client. See `AmqpDirector.client_child_spec/3` for details on how to start the RPC client.
"""
alias AmqpDirector.Definitions
@typedoc """
Options for an RPC request.
* `:ttl` - Specifie... | lib/amqp_director/client.ex | 0.888532 | 0.434041 | client.ex | starcoder |
defmodule ExPolars.Series do
@moduledoc """
Documentation for `Series`.
"""
import Kernel, except: [+: 2, -: 2, *: 2, /: 2, ==: 2, <>: 2, >: 2, >=: 2, <: 2, <=: 2]
alias ExPolars.Native
defstruct [:inner]
@type t :: ExPolars.DataFrame
@type s :: ExPolars.Series
@dtype_strs %{
0 => "i8",
1 =... | lib/ex_polars/series.ex | 0.861858 | 0.5835 | series.ex | starcoder |
defmodule Construct do
@moduledoc """
Construct internally divided into three components:
* `Construct` — defining structures;
* `Construct.Cast` — making structure instances;
* `Construct.Type` — type-coercion and custom type behaviour.
## Construct definition
defmodule StructureName do
... | lib/construct.ex | 0.855097 | 0.611382 | construct.ex | starcoder |
defmodule Ecto.Query.Builder.Select do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Escapes a select.
It allows tuples, lists and variables at the top level or a
single `assoc(x, y)` expression.
## Examples
iex> escape({1, 2}, [])
{{:{}, [], [:{}, [], [1, 2]]}, %{}}
iex> esca... | lib/ecto/query/builder/select.ex | 0.806586 | 0.482368 | select.ex | starcoder |
defmodule GGity.Scale.Shape do
@moduledoc false
alias GGity.{Draw, Labels}
alias GGity.Scale.Shape
@palette [:circle, :square, :diamond, :triangle]
defstruct transform: nil,
levels: nil,
labels: :waivers,
guide: :legend
@type t() :: %__MODULE__{}
@spec new(keyword(... | lib/ggity/scale/shape.ex | 0.840324 | 0.419916 | shape.ex | starcoder |
defmodule CCSP.Chapter3.WordSearch do
alias CCSP.Chapter3.GridLocation
alias __MODULE__, as: T
@moduledoc """
Corresponds to CCSP in Python, Section 3.4 titled "Word Search".
"""
@type t :: __MODULE__.t()
@type grid :: list(list(String.t()))
@type row :: non_neg_integer
@type column :: non_neg_integ... | lib/ccsp/chapter3/word_search.ex | 0.8398 | 0.555013 | word_search.ex | starcoder |
defmodule GoCounting do
@type position :: {integer, integer}
@type owner :: %{owner: atom, territory: [position]}
@type territories :: %{white: [position], black: [position], none: [position]}
@doc """
Return the owner and territory around a position
"""
@spec territory(board :: String.t(), position :: ... | exercises/practice/go-counting/.meta/example.ex | 0.838415 | 0.497376 | example.ex | starcoder |
defmodule EventLog do
@moduledoc """
Can host multiple streams. Stream has a log and index.
* Entries are being appended to log. There is no deletion operation.
* Entry contains the actual data, timestamp, crc and some meta data.
* Log is partitioned to segments that are named by it's least offset.
* Each... | lib/event_log.ex | 0.778355 | 0.509764 | event_log.ex | starcoder |
defmodule OMG.Performance do
@moduledoc """
OMG network child chain server performance test entrypoint. Setup and runs performance tests.
# Usage
Always `cd apps/omg_performance` before running performance tests
## start_simple_perftest runs test with 5 transactions for each 3 senders and default options.... | apps/omg_performance/lib/performance.ex | 0.873882 | 0.882731 | performance.ex | starcoder |
defmodule EWallet.ComputedBalanceFetcher do
@moduledoc """
Handles the retrieval and formatting of balances from the local ledger.
"""
alias EWalletDB.{User, MintedToken}
alias LocalLedger.Balance
@doc """
Prepare the list of balances and turn them into a suitable format for
EWalletAPI using a provider... | apps/ewallet/lib/ewallet/fetchers/computed_balance_fetcher.ex | 0.741019 | 0.407333 | computed_balance_fetcher.ex | starcoder |
defmodule DocGen.Content.Random do
use Private
@moduledoc """
Gives random videos based on the weight and lengths of videos and tags.
"""
@keyword_multiplier Application.fetch_env!(:doc_gen, :keyword_multiplier)
alias DocGen.{Content, Repo}
@doc """
Gives a random set of videos given a number of cli... | lib/doc_gen/content/random.ex | 0.857649 | 0.490175 | random.ex | starcoder |
defmodule Akd.SecureConnection do
require Logger
@moduledoc """
This module defines helper functions that are used by `Akd` to execute
a set of commands through the Secure channel, examples: ssh and scp
"""
@doc """
Takes a destination and commands and runs those commands on that destination.
## Exam... | lib/akd/helpers/secure_connection.ex | 0.774157 | 0.448547 | secure_connection.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.