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 Mulix do
@moduledoc """
µlix (Mulix) is a genetic programming toolkit for Elixir. It implements a vaguely [Push
3.0](http://faculty.hampshire.edu/lspector/push3-description.html)-like virtual machine.
## Description of the execution process
`Op`s define virtual machine instructions / operations, a... | lib/mulix.ex | 0.816918 | 0.783658 | mulix.ex | starcoder |
defmodule Pummpcomm.PumpModel do
@moduledoc """
Model-specific options and information
"""
# Types
@typedoc """
Model number of a pump as an integer
"""
@type pump_model :: non_neg_integer
@typedoc """
Return how many turns the pump motor takes to deliver 1U of insulin
"""
@type strokes_per_u... | lib/pummpcomm/pump_model.ex | 0.889637 | 0.510374 | pump_model.ex | starcoder |
defmodule Debounce do
@moduledoc """
A process-based debouncer for Elixir.
## What is a debouncer?
A debouncer is responsible for calling a function with a delay, but if that
function is called multiple times within the delay period, the time is reset
and delay is counted again. In other words, the functi... | lib/debounce.ex | 0.820001 | 0.498718 | debounce.ex | starcoder |
defmodule Benchmarks.GoogleMessage3.Message22853 do
@moduledoc false
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{
field22869: Benchmarks.GoogleMessage3.Enum22854.t(),
field22870: [non_neg_integer],
field22871: [float | :infinity | :negative_infinity | :nan],
field... | bench/lib/datasets/google_message3/benchmark_message3_2.pb.ex | 0.768081 | 0.481881 | benchmark_message3_2.pb.ex | starcoder |
defmodule DefUnitExample do
@moduledoc """
SI Units using watts and watt hours for energy
Includes constants useful for aerodynamics
This is an example of the use of DefUnit
"""
use DefUnit
@doc_from_operator ~S"""
Convert from other units to core units used for calculations.
If a core unit is s... | test/support/def_unit_example.ex | 0.881251 | 0.844216 | def_unit_example.ex | starcoder |
defmodule Premailex.Util do
@moduledoc """
Module that contains utility functions.
"""
@type html_tree :: Premailex.HTMLParser.html_tree()
@type needle :: binary | html_tree
@doc """
Traverses tree searching for needle, and will call provided function on
any occurances.
If the function returns {:ha... | lib/premailex/util.ex | 0.797083 | 0.563948 | util.ex | starcoder |
defmodule Dawdle do
@moduledoc """
API for the Dawdle messaging system.
"""
@type argument :: any()
@type callback :: (argument() -> any())
@type duration :: non_neg_integer()
@type event :: struct()
@type handler :: module()
@doc """
Signals an event.
The event is encoded and enqueued and will... | lib/dawdle.ex | 0.886608 | 0.802826 | dawdle.ex | starcoder |
defmodule TelemetryMetricsTelegraf.Telegraf.ConfigAdviser do
@moduledoc """
Generates telegraf aggregators config from `Telemetry.Metrics` definitions.
* `Telemetry.Metrics.Distribution` - [histogram](https://github.com/influxdata/telegraf/tree/master/plugins/aggregators/histogram).
* `Telemetry.Metrics.LastVa... | lib/telemetry_metrics_telegraf/telegraf/config_adviser.ex | 0.880727 | 0.64961 | config_adviser.ex | starcoder |
defmodule Mix.Tasks.Compile.Elixir do
use Mix.Task.Compiler
@recursive true
@manifest "compile.elixir"
@moduledoc """
Compiles Elixir source files.
Elixir is smart enough to recompile only files that have changed
and their dependencies. This means if `lib/a.ex` is invoking
a function defined over `li... | lib/mix/lib/mix/tasks/compile.elixir.ex | 0.814385 | 0.400339 | compile.elixir.ex | starcoder |
defmodule AWS.Kinesis do
@moduledoc """
Amazon Kinesis Data Streams Service API Reference
Amazon Kinesis Data Streams is a managed service that scales elastically for
real-time processing of streaming big data.
"""
alias AWS.Client
alias AWS.Request
def metadata do
%AWS.ServiceMetadata{
ab... | lib/aws/generated/kinesis.ex | 0.941419 | 0.629461 | kinesis.ex | starcoder |
defmodule SpeediviewUI.Component.OnScreenKeyboard do
@moduledoc """
The Keyboard component provides two styles of keyboard: a full querty keyboard and a numeric pad.
To use this component in your scene add it to a graph with ScenicUI.Keyboard.add_to_graph/3. You
can use one of the provided keyboard layouts by ... | lib/speediview_ui/components/on_screen_keyboard.ex | 0.896016 | 0.471527 | on_screen_keyboard.ex | starcoder |
defmodule Forth do
@opaque word :: integer | String.t()
@opaque actions :: %{name: String.t(), action: Function.t()}
@opaque stack :: [word]
@opaque evaluator :: {stack, actions}
@non_words ~r/[^\s \x00\x01]+/
@doc """
Create a new evaluator.
"""
@spec new() :: evaluator
def new() do
{
[... | exercism/forth/forth.ex | 0.719679 | 0.487734 | forth.ex | starcoder |
defmodule Calendarize do
@moduledoc """
A small utility that generates a calendar month array given a date.
"""
alias Date
alias Timex
@type build_options :: [week_start: Timex.Types.weekstart()]
@doc """
Generates a calendar month array given a date. Currently, `week_start` is the only option, and i... | lib/calendarize.ex | 0.902512 | 0.645616 | calendarize.ex | starcoder |
defmodule Credo.Execution.ExecutionTiming do
@moduledoc """
The `ExecutionTiming` module can help in timing the execution of code parts and
storing those timing inside the `Credo.Execution` struct.
"""
use GenServer
alias Credo.Execution
@doc """
Runs the given `fun` and prints the time it took with ... | lib/credo/execution/execution_timing.ex | 0.887229 | 0.547525 | execution_timing.ex | starcoder |
defmodule NewRelic.Plug.Repo do
@moduledoc """
Defines a module that provides instrumented methods for a standard `Ecto.Repo`.
```
defmodule MyApp.Repo do
use Ecto.Repo, otp_application: :my_app
defmodule NewRelic do
use NewRelic.Plug.Repo, repo: MyApp.Repo
end
end
```
Anywhere that t... | lib/new_relic/plug/repo.ex | 0.893474 | 0.753002 | repo.ex | starcoder |
defmodule Nostrum.Util do
@moduledoc """
Utility functions
"""
alias Nostrum.{Api, Constants, Snowflake}
alias Nostrum.Shard.Session
alias Nostrum.Struct.WSState
require Logger
@doc """
Helper for defining all the methods used for struct and encoding transformations.
## Example
``` Elixir
No... | lib/nostrum/util.ex | 0.899707 | 0.744285 | util.ex | starcoder |
defmodule Membrane.RTP.H264.Depayloader do
@moduledoc """
Depayloads H264 RTP payloads into H264 NAL Units.
Based on [RFC 6184](https://tools.ietf.org/html/rfc6184).
Supported types: Single NALU, FU-A, STAP-A.
"""
use Membrane.Filter
require Membrane.Logger
alias Membrane.Buffer
alias Membrane.Eve... | lib/rtp_h264/depayloader.ex | 0.767036 | 0.400251 | depayloader.ex | starcoder |
defmodule Nostrum.Cache.GuildCache do
@table_name :nostrum_guilds
@moduledoc """
Functions for retrieving guild states.
The ETS table name associated with the Guild Cache is `#{@table_name}`.
Besides the methods provided here, you can call any other ETS methods
on the table.
"""
alias Nostrum.Cache.Ma... | lib/nostrum/cache/guild_cache.ex | 0.821403 | 0.613613 | guild_cache.ex | starcoder |
defmodule Ecto.Pools.SojournBroker do
@moduledoc """
Start a pool of connections using `sbroker`.
### Options
* `:pool_name` - The name of the pool supervisor
* `:pool_size` - The number of connections to keep in the pool (default: 10)
* `:min_backoff` - The minimum backoff on failed connect in mill... | deps/ecto/lib/ecto/pools/sojourn_broker.ex | 0.751603 | 0.503052 | sojourn_broker.ex | starcoder |
defmodule Day16 do
@moduledoc """
AoC 2019, Day 16 - Flawed Frequency Transmission
"""
@doc """
After 100 phases of FFT, what are the first eight digits in the final output list?
"""
def part1 do
Util.priv_file(:day16, "day16_input.txt")
|> File.read!()
|> String.trim()
|> fft(100)
|>... | apps/day16/lib/day16.ex | 0.715821 | 0.451447 | day16.ex | starcoder |
defmodule Kcl do
@moduledoc """
pure Elixir NaCl crypto suite substitute
The `box` and `unbox` functions exposed here are the equivalent
of NaCl's:
- `crypto_box_curve25519xsalsa20poly1305`
- `crypto_box_curve25519xsalsa20poly1305_open`
"""
@typedoc """
shared nonce
"""
@type nonce :: binary
... | lib/kcl.ex | 0.847669 | 0.511473 | kcl.ex | starcoder |
defmodule Rotn do
@moduledoc """
Rotn takes a compatible binary and an integer value and rotates
the corresponding characters of the binary by the integer value
around a circle of ASCII values from 32 - 126 inclusive.
"""
@doc ~S"""
Returns an `{:ok, "encoded string"}` tuple.
## Examples
iex> R... | lib/rotn.ex | 0.932538 | 0.40439 | rotn.ex | starcoder |
defmodule FeedexUi.Cache.PushState do
alias FeedexUi.Cache.UiState
@moduledoc """
Persistent store for User's PushState.
The PushState is simply the user's UiState at a given moment in time, with a
mostly-unique (we use a truncated hash string) hash value as a lookup key.
The idea here is to post an upd... | apps/feedex_ui/lib/feedex_ui/cache/push_state.ex | 0.652131 | 0.4474 | push_state.ex | starcoder |
defmodule Chunky.Grid do
@moduledoc """
Functions for creating and manipulating a two dimenesional grid.
Internally the grid is ordered as lists of lists, rather than a single list.
"""
defstruct [:data, :width, :height]
alias Chunky.Grid
def new(width, height, fun)
when is_integer(width) and is... | lib/grid.ex | 0.848784 | 0.796411 | grid.ex | starcoder |
defmodule Akd.Fetch.Git do
@moduledoc """
A native Hook module that comes shipped with Akd.
This module uses `Akd.Hook`.
Provides a set of operations that fetch source code using `git` to a destination,
checks out a given branch (defaults to `master`) and pulls the latest version
of the branch on the dest... | lib/akd/base/fetch/git.ex | 0.842798 | 0.57946 | git.ex | starcoder |
defmodule Utils.Table do
def comparison_examples do
[
%{comparison: "5 === 5", result: true},
%{comparison: "5 === 5.0", result: false},
%{comparison: "5 == 5.0", result: true},
%{comparison: "5 === 4", result: false},
%{comparison: "5 > 4", result: true},
%{comparison: "4 > 5"... | utils/lib/table.ex | 0.649579 | 0.643728 | table.ex | starcoder |
defmodule Snitch.Tools.Validations do
@moduledoc """
A bunch of data validations for `Ecto.Changeset`.
## Note
All validations in this module are check ONLY the value present under the
`:changes` key in the `Ecto.Changeset.t()`.
The validations are non-strict, and will not complain if the key is not
pr... | apps/snitch_core/lib/core/tools/validations.ex | 0.856782 | 0.449876 | validations.ex | starcoder |
defmodule Nebulex.RPC do
@moduledoc """
RPC utilities for distributed task execution.
This module uses supervised tasks underneath `Task.Supervisor`.
"""
@typedoc "Task callback"
@type callback :: {module, atom, [term]}
@typedoc "Group entry: node -> callback"
@type node_callback :: {node, callback}
... | lib/nebulex/rpc.ex | 0.814754 | 0.408719 | rpc.ex | starcoder |
defmodule Stargate.Producer.QueryParams do
@moduledoc """
This modules provides the function to generate query parameters
for establishing a producer connection to a topic with Pulsar.
"""
@doc """
Generates a query parameter string to apped to the URL and path
parameters when creating a Stargate.Produce... | lib/stargate/producer/query_params.ex | 0.706798 | 0.44903 | query_params.ex | starcoder |
defmodule Gyx.Qstorage.QGenServer do
@moduledoc """
This module is intended to be used as a Q table representation.
It is based on a single GenServer process, using a Map to hold Q table data
as part of process state.
Note that this is a hand made version of an Agent OTP implementation,
which would be prefe... | lib/qstorage/qlocalstatemap.ex | 0.745954 | 0.61891 | qlocalstatemap.ex | starcoder |
defmodule ServerComms.Ws.WebsocketHandler do
@moduledoc """
Communicates with the server, primarily sending camera images up to form the MPEG stream.
Uses the traditional Jermy Ong Websocket client but forked [here](https://github.com/paulanthonywilson/websocket_client)
as some of the Erlang is deprecated.
... | apps/server_comms/lib/server_comms/ws/websocket_handler.ex | 0.820254 | 0.432303 | websocket_handler.ex | starcoder |
defmodule EspEx.EventTransformer do
@moduledoc """
Helps converting from and to a raw event. A raw event is basically a map as
it comes from the database.
It's a behavior (fill-in the types for callbacks)
It can be "used" with `use EspEx.EventTransformer` which would:
- @behavior EspEx.EventTransformer
... | lib/esp_ex/event_transformer.ex | 0.76856 | 0.436142 | event_transformer.ex | starcoder |
defmodule Forcex.Client do
defstruct access_token: nil,
api_version: "36.0",
token_type: nil,
endpoint: "https://login.salesforce.com",
services: %{}
require Logger
@doc """
Initially signs into Force.com API.
Login credentials may be supplied. Order for loca... | lib/forcex/client.ex | 0.757794 | 0.653065 | client.ex | starcoder |
defmodule DayFour do
def solve(input) do
input
|> String.split("\n\n", trim: true)
|> Stream.map(&construct_passport/1)
|> Stream.map(&validate_passport/1)
|> Enum.count(& &1)
end
@docp """
Constructs a keyword list from string of passport data.
"""
defp construct_passport(string) do
... | adv_2020/lib/day_4.ex | 0.555676 | 0.451327 | day_4.ex | starcoder |
defmodule Grizzly.ZWave.Commands.ConfigurationBulkSet do
@moduledoc """
This command is used to set the value of one or more configuration parameters.
Params:
* `:default` - This field is used to specify if the default value is to be restored for the specified configuration
parameters. Us... | lib/grizzly/zwave/commands/configuration_bulk_set.ex | 0.917617 | 0.569673 | configuration_bulk_set.ex | starcoder |
defmodule Robotica.Devices.Lifx do
@moduledoc """
Provides LIFX support functions.
"""
alias RoboticaCommon.Strings
defmodule HSBKA do
@moduledoc "A color with alpha channel"
@type t :: %__MODULE__{
hue: integer(),
saturation: integer(),
brightness: integer(),
... | robotica/lib/robotica/devices/lifx.ex | 0.852307 | 0.512815 | lifx.ex | starcoder |
defmodule Extensor.Tensor do
@moduledoc """
This is a simple wrapper struct for a tensorflow tensor. It holds the
data type, shape (dimensions), and binary data buffer for a tensor.
The layout of the buffer is the same as what is used in tensorflow -
row-major dimension ordering with native endian byte order... | lib/extensor/tensor.ex | 0.878855 | 0.953144 | tensor.ex | starcoder |
defmodule Sanbase.Alert.Trigger.EthWalletTriggerSettings do
@moduledoc ~s"""
The EthWallet alert is triggered when the balance of a wallet or set of wallets
changes by a predefined amount for a specified asset (Ethereum, SAN tokens, etc.)
The alert can follow a single ethereum address, a list of ethereum addre... | lib/sanbase/alerts/trigger/settings/eth_wallet_trigger_settings.ex | 0.749637 | 0.401981 | eth_wallet_trigger_settings.ex | starcoder |
defmodule FlowAssertions.MapA do
use FlowAssertions.Define
alias FlowAssertions.Messages
alias FlowAssertions.{MiscA,EnumA}
@moduledoc """
Assertions that apply to Maps and structures and sometimes to keyword lists.
`assert_fields/2` and `assert_same_map/3` are the most important.
"""
@doc """
Test... | lib/map_a.ex | 0.913828 | 0.873323 | map_a.ex | starcoder |
defmodule CSQuery.Expression do
@moduledoc """
A representation of an expression in the AWS CloudSearch structured query
syntax.
"""
alias CSQuery.{FieldValue, OperatorOption}
@typedoc "Valid operator names."
@type operators :: :and | :near | :not | :or | :phrase | :prefix | :range | :term
@typedoc "... | lib/csquery/expression.ex | 0.880752 | 0.646314 | expression.ex | starcoder |
defmodule Geocalc.DMS do
@moduledoc """
The `Geocalc.DMS` is a struct which contains degrees, minutes, seconds and cardinal direction.
Also have functions to convert DMS to decimal degrees.
"""
@enforce_keys [:hours, :minutes, :seconds, :direction]
defstruct [:hours, :minutes, :seconds, :direction]
... | lib/geocalc/dms.ex | 0.920504 | 0.884189 | dms.ex | starcoder |
defmodule Sanbase.Auth.Hmac do
@moduledoc """
What is HMAC? HMAC is a way to combine a key and a hashing function in a way
that's harder to attack.
HMAC does not encrypt the message.
The HMAC calculation is the following:
`HMAC(K,m) = H((K' ⊕ opad) || H ((K' ⊕ ipad)||m))`
where
- H is a cryptographi... | lib/sanbase/auth/apikey/hmac.ex | 0.825976 | 0.628778 | hmac.ex | starcoder |
defmodule ExampleSupervisor do
def start do
# List comprehension creates a consumer per cpu core
children =
for i <- 1..System.schedulers_online(),
do: Supervisor.child_spec({ExampleConsumer, []}, id: {:consumer, i})
Supervisor.start_link(children, strategy: :one_for_one)
end
end
defmo... | examples/cache.ex | 0.672009 | 0.424591 | cache.ex | starcoder |
defmodule Alerts.Cache.Store do
@moduledoc """
A process that maintains a few ETS tables. The tables are
* :alert_id_to_alerts - a set with has the "alert_id" as the key and
and %Alerts.Alert{} as the value.
* :route_id_and_type_to_alert_ids - a bag with "route_id" and "route_type" as keys and "alert_id" ... | apps/alerts/lib/cache/store.ex | 0.730578 | 0.594993 | store.ex | starcoder |
defmodule AWS.AutoScaling do
@moduledoc """
With Application Auto Scaling, you can configure automatic scaling for your
scalable AWS resources. You can use Application Auto Scaling to accomplish
the following tasks:
<ul> <li> Define scaling policies to automatically scale your AWS resources
</li> <li> Sc... | lib/aws/autoscaling.ex | 0.918635 | 0.543045 | autoscaling.ex | starcoder |
defmodule Wabbit.Queue do
@moduledoc """
Functions to operate on Queues.
"""
import Wabbit.Record
alias Wabbit.Utils
@doc """
Declares a queue.
The optional `queue` parameter is used to set the name. If set to an
empty string (default), the server will assign a name. Besides the
queue name, the ... | lib/wabbit/queue.ex | 0.85446 | 0.474509 | queue.ex | starcoder |
defmodule SimpleCipher do
@a_ordinal ?a
@alphabet Enum.to_list(?a..?z)
@alphabet_length length(@alphabet)
defguardp non_lower_alpha?(text_char) when not (text_char in @alphabet)
@doc """
Given a `plaintext` and `key`, encode each character of the `plaintext` by
shifting it by the corresponding letter in... | elixir/simple-cipher/lib/simple_cipher.ex | 0.789071 | 0.571826 | simple_cipher.ex | starcoder |
defmodule Noizu.MnesiaVersioning.Tasks.Install do
@moduledoc """
The Install Tasks creates the initial Mnesia schema and inserts the necessary record keeping tables for tracking schema versioning.
If you already have an existing schema you may run with the `--skip-schema` option to only insure the tracking table... | lib/mnesia_versioning/tasks/install.ex | 0.803444 | 0.839306 | install.ex | starcoder |
defmodule Trifolium.Species do
@moduledoc """
Module to be used to interact with Trefle [Species](https://docs.trefle.io/reference/#tag/Species) related endpoints.
"""
alias Trifolium.Config
alias Trifolium.API
@endpoint_path "api/v1/species/"
@http_client Config.http_client()
@doc """
List eve... | lib/trifolium/endpoints/species.ex | 0.873728 | 0.822118 | species.ex | starcoder |
defmodule Remit.UsernamesFromMentions do
import Ecto.Query
alias Remit.{Comment, Commit, Repo}
# Partially from: https://github.com/shinnn/github-username-regex/blob/master/index.js
@mention_re ~r/
(?<=^|\W) # The ?<= is a lookbehind: We must be at start of string, or following a non-word character.
@... | lib/remit/usernames_from_mentions.ex | 0.611382 | 0.537648 | usernames_from_mentions.ex | starcoder |
defmodule CritWeb.Fomantic.ListProducing do
use Phoenix.HTML
import CritWeb.Fomantic.Helpers
@moduledoc """
This module creates HTML that delivers list values to a controller action.
For example, producing a list of ideas like %{"ids" => ["0", "5", "10"]
"""
@doc """
Like `multiple_select`, but more c... | lib/crit_web/views/fomantic/list_producing.ex | 0.702632 | 0.420689 | list_producing.ex | starcoder |
defmodule SurfaceBootstrap4.Table do
@moduledoc """
Bootstrap4 table component.
A table can be created by setting a source `data` to it and defining
columns using the `SurfaceBootstrap4.Table.Column` component.
"""
use Surface.Component
@doc "The data that populates the table"
prop data, :list, requi... | lib/surface_boostrap4/table.ex | 0.814459 | 0.463626 | table.ex | starcoder |
defmodule EctoCassandra.Query do
@types [
:ascii,
:bigint,
:blob,
:boolean,
:counter,
:date,
:decimal,
:double,
:float,
:inet,
:int,
:smallint,
:text,
:time,
:timestamp,
:timeuuid,
:tinyint,
:uuid,
:varchar,
:varint,
]
@cassandra_ke... | lib/ecto_cassandra/query.ex | 0.587588 | 0.416975 | query.ex | starcoder |
defmodule AdventOfCode.Day13 do
@moduledoc false
use AdventOfCode
@empty_cell " "
@filled_cell "█"
def part1(input) do
{grid, instructions} = preprocess_input(input)
grid
|> fold(Enum.at(instructions, 0))
|> Enum.count(fn {_, v} -> v == @filled_cell end)
end
def part2(input) do
{gr... | lib/day13.ex | 0.672547 | 0.479443 | day13.ex | starcoder |
defmodule Memento.Schema do
require Memento.Mnesia
@moduledoc """
Module to interact with the database schema.
For persisting data, Mnesia databases need to be created on disk. This
module provides an interface to create the database on the disk of the
specified nodes. Most of the time that is usually th... | lib/memento/schema.ex | 0.744842 | 0.859487 | schema.ex | starcoder |
defmodule QRCode.Placement do
@moduledoc """
A patterns are a non-data element of the QR code that is required
by the QR code specification, such as the three finder patterns in
the corners of the QR code matrix.
It contains function patterns (finder patterns, timing patterns,
separators, alignment pattern... | lib/qr_code/placement.ex | 0.853715 | 0.688428 | placement.ex | starcoder |
defmodule DogStat do
@moduledoc """
This module provides helper functions to persist meaningful metrics to StatsD or DogstatsD servers.
Code is based on [Statix](https://github.com/lexmag/statix) library.
"""
use GenServer
alias DogStat.Packet
@type key :: iodata
@type options :: [sample_rate: float, ... | lib/dogstat.ex | 0.916521 | 0.531878 | dogstat.ex | starcoder |
defmodule CQL.QueryParams do
@moduledoc """
Represents a CQL query/execute statements parameters
"""
import CQL.DataTypes.Encoder
require Bitwise
defstruct [
consistency: :one,
values: nil,
skip_metadata: false,
page_size: nil,
paging_state: nil,
serial_consistency: nil,
timest... | lib/cql/query_params.ex | 0.702428 | 0.500122 | query_params.ex | starcoder |
defmodule USGovData.Parser do
@doc """
Parses a file using specific parser module
"""
@spec parse_file(String.t(), atom, Keyword.t()) ::
{:ok, [term]} | {:error, non_neg_integer, atom}
def parse_file(path, parser, opts \\ []) do
file_opts = parse_file_opts(path, opts)
drop_errors = parse_dro... | lib/usgov_data.ex | 0.613352 | 0.463444 | usgov_data.ex | starcoder |
defmodule CFG do
@moduledoc """
This top-level namespace holds all the functionality for working with CFG.
You'll normally interact with configurations using the Config submodule.
"""
alias ComplexNum.Cartesian, as: Complex
defmodule Location do
defstruct line: 1, column: 1
@typedoc """
This t... | lib/cfg.ex | 0.930443 | 0.77193 | cfg.ex | starcoder |
defmodule CastParams do
@moduledoc """
Plug for casting request params to defined types.
## Usage
```elixir
defmodule AccountController do
use AppWeb, :controller
use CastParams
# define params types
# :category_id - required integer param (raise CastParams.NotFound if not exists)
# :we... | lib/cast_params.ex | 0.821403 | 0.688403 | cast_params.ex | starcoder |
defmodule Cryptozaur.Utils do
alias Cryptozaur.{Repo, Connector}
@max_substitutions_in_prepare_statement 65535
defmacro amazing_success(value) do
quote do
{:ok, unquote(value)}
end
end
defmacro extreme_failure(reason) do
quote do
{:error, unquote(reason)}
end
end
def drop_m... | lib/cryptozaur/utils.ex | 0.583203 | 0.443781 | utils.ex | starcoder |
defmodule AWS.PinpointSMSVoiceV2 do
@moduledoc """
Welcome to the *Amazon Pinpoint SMS and Voice, version 2 API Reference*.
This guide provides information about Amazon Pinpoint SMS and Voice, version 2
API resources, including supported HTTP methods, parameters, and schemas.
Amazon Pinpoint is an Amazon W... | lib/aws/generated/pinpoint_sms_voice_v2.ex | 0.844905 | 0.550184 | pinpoint_sms_voice_v2.ex | starcoder |
defmodule Square.Payments do
@moduledoc """
Documentation for `Square.Payments`.
"""
@doc """
Retrieves a list of payments taken by the account making the request.
```
def list_payments(client,
[
begin_time: nil,
end_time: nil,
sort_order: nil,
cursor: nil,
location_id: nil,
to... | lib/api/payments_api.ex | 0.932829 | 0.877529 | payments_api.ex | starcoder |
defmodule TwitterStream do
@moduledoc """
TwitterStream is a GenServer that can be invoked manually via `start_link/1` or
added as a `child_spec/1` to a supervision tree.
"""
use GenServer
alias TwitterStream.{Auth, Decoder}
@doc """
Start a twitter stream process given [Twitter Streaming API](https:/... | lib/twitter_stream.ex | 0.894578 | 0.806396 | twitter_stream.ex | starcoder |
defmodule RateTheDub.ETagCache do
@moduledoc """
A Tesla middleware for caching requests based on ETags. Cached data is stored
in the database as `CachedPages`.
This is primarially to reduce the load on Jikan and to be a good neighbor and
all that, as well as to speed up the site by reducing API calls.
Ca... | lib/ratethedub/etag_cache.ex | 0.847274 | 0.448547 | etag_cache.ex | starcoder |
defmodule Absinthe.Execution.Variables do
# Handles the logic around building and validating variable values for an
# execution.
@moduledoc false
alias Absinthe.Type
alias Absinthe.Language
alias Absinthe.Execution
defstruct raw: %{}, processed: %{}
# Build a variables map from the variable definiti... | lib/absinthe/execution/variables.ex | 0.703855 | 0.42922 | variables.ex | starcoder |
defmodule Bonny.Server.Reconciler do
@moduledoc """
Creates a stream that, when run, streams a list of resources and calls `reconcile/1`
on the given controller for each resource in the stream in parallel.
## Example
reconciliation_stream = Bonny.Server.Reconciler.get_stream(controller)
Task.async... | lib/bonny/server/reconciler.ex | 0.865039 | 0.415373 | reconciler.ex | starcoder |
defmodule Mix.Config do
# TODO: Convert them to hard deprecations on v1.13
@moduledoc deprecated: "Use Config and Config.Reader instead"
@moduledoc ~S"""
A simple configuration API and functions for managing config files.
This module is deprecated, use the modules `Config` and `Config.Reader`
from Elixir'... | lib/mix/lib/mix/config.ex | 0.615897 | 0.499512 | config.ex | starcoder |
defmodule MatrixReloaded do
@moduledoc """
Documentation for Matrix Reloaded library.
This a library is focusing only on updating, rearranging, getting/dropping
row/column of a matrix. Also contains a few matrix operations like addition,
subtraction or multiplication. Anyway if you need make fast operations ... | lib/matrix_reloaded.ex | 0.8789 | 0.928279 | matrix_reloaded.ex | starcoder |
defmodule UnblockMeSolver.Move.Helper do
alias UnblockMeSolver.Move.Helper
@moduledoc false
@doc """
Moves a block right and returns a tuple {blocked_block, updated_problem}
of the block in the way (nil if no block is in the way) and the updated
problem (assuming it was succesful)
## Examples
ie... | lib/unblock_me_solver/move/helper.ex | 0.8119 | 0.518059 | helper.ex | starcoder |
defmodule Elastic.Document.API do
@moduledoc ~S"""
The Document API provides some helpers for interacting with documents.
The Document API extracts away a lot of the repetition of querying /
indexing of a particular index. Here's an example:
```
defmodule Answer do
@es_type "answer"
@es_index "ans... | lib/elastic/document/api.ex | 0.90703 | 0.944125 | api.ex | starcoder |
defmodule Earmark do
@moduledoc """
# Earmark—A Pure Elixir Markdown Processor
## Dependency
{ :earmark, "> x.y.z" }
## Usage
### API
html_doc = Earmark.to_html(markdown)
html_doc = Earmark.to_html(markdown, options)
(See the documentation for `to_html` for options)
### Command lin... | deps/earmark/lib/earmark.ex | 0.756447 | 0.48249 | earmark.ex | starcoder |
defmodule Plug.Telemetry.ServerTiming do
@behaviour Plug
@moduledoc """
This plug provide support for [`Server-Timing`][st] header that allows to
display server-side measurements in browser developer tools and access it
programatically via Performance API in JavaScript.
## Usage
Just add it as a plug i... | lib/plug_telemetry_server_timing.ex | 0.914434 | 0.769254 | plug_telemetry_server_timing.ex | starcoder |
defmodule PowPersistentSession.Plug.Cookie do
@moduledoc """
This plug will handle persistent user sessions with cookies.
The cookie and token will expire after 30 days. The token in the cookie can
only be used once to create a session.
If an assigned private `:pow_session_metadata` key exists in the conn w... | lib/extensions/persistent_session/plug/cookie.ex | 0.837454 | 0.45641 | cookie.ex | starcoder |
defmodule WeebPotion.Struct.Client do
defstruct token_type: :Wolke, token: nil, application_name: nil, version: nil, environment: "dev", headers: nil
@typedoc """
This type represents the client needed to authenticate requests and hold small pieces of information. The keys are as follows:
* `:token_type` - A... | lib/weebpotion/struct/client.ex | 0.918031 | 0.814901 | client.ex | starcoder |
defmodule GGity.Geom.Point do
@moduledoc false
alias GGity.{Geom, Plot}
@type t() :: %__MODULE__{}
@type plot() :: %Plot{}
@type record() :: map()
@type mapping() :: map()
defstruct data: nil,
mapping: nil,
stat: :identity,
position: :identity,
key_glyph:... | lib/ggity/geom/point.ex | 0.891261 | 0.61594 | point.ex | starcoder |
defmodule Xpeg do
@moduledoc """
XPeg is a pure Elixir pattern matching library. It provides macros to compile
patterns and grammars (PEGs) to Elixir function which will parse a string and
collect selected parts of the input. PEGs are not unlike regular expressions,
but offer more power and flexibility, and... | lib/xpeg.ex | 0.872904 | 0.662278 | xpeg.ex | starcoder |
defmodule Re.PriceSuggestions do
@moduledoc """
Module for suggesting prices according to stored factors
"""
NimbleCSV.define(PriceSuggestionsParser, separator: ",", escape: "\"")
alias Re.{
Listing,
PriceSuggestions.Factors,
PriceSuggestions.Request,
Repo,
User
}
import Ecto.Query
... | apps/re/lib/price_suggestions/price_suggestions.ex | 0.638385 | 0.40204 | price_suggestions.ex | starcoder |
defmodule Kiq.Worker do
@moduledoc """
Defines a behavior and macro to guide the creation of worker modules.
Worker modules do the work of processing a job. At a minimum they must define
a `perform` function, which will be called with the arguments that were
enqueued with the `Kiq.Job`.
## Defining Worker... | lib/kiq/worker.ex | 0.832781 | 0.520009 | worker.ex | starcoder |
defmodule XDR.Union do
@moduledoc """
This module manages the `Discriminated Union` type based on the RFC4506 XDR Standard.
"""
@behaviour XDR.Declaration
alias XDR.UnionError
defstruct [:discriminant, :arms, :value]
@type discriminant :: XDR.Enum.t() | XDR.Int.t() | XDR.UInt.t() | struct()
@type ar... | lib/xdr/union.ex | 0.929256 | 0.434041 | union.ex | starcoder |
defmodule OpentelemetryOban do
@moduledoc """
OpentelemetryOban uses [telemetry](https://hexdocs.pm/telemetry/) handlers to create
`OpenTelemetry` spans for Oban events. The Oban telemetry events that are used are documented [here](https://hexdocs.pm/oban/Oban.Telemetry.html).
## Usage
Add in your applicati... | lib/opentelemetry_oban.ex | 0.810066 | 0.466967 | opentelemetry_oban.ex | starcoder |
defmodule Google.Protobuf.Type do
@moduledoc false
alias Pbuf.Decoder
import Bitwise, only: [bsr: 2, band: 2]
@derive Jason.Encoder
defstruct [
name: "",
fields: [],
oneofs: [],
options: [],
source_context: nil,
syntax: 0
]
@type t :: %__MODULE__{
name: String.t,
fields: [... | lib/protoc/google/protobuf/type.pb.ex | 0.729038 | 0.596991 | type.pb.ex | starcoder |
defmodule BlueBird.Controller do
@moduledoc """
Defines macros used to add documentation to api routes.
## Usage
Use `api/3` in your controllers. Optionally add the `apigroup/1` or
`apigroup/2` macro to your controllers.
defmodule MyApp.Web.UserController do
use BlueBird.Controller
al... | lib/blue_bird/controller.ex | 0.861086 | 0.5919 | controller.ex | starcoder |
defmodule AWS.Organizations do
@moduledoc """
AWS Organizations API Reference
AWS Organizations is a web service that enables you to consolidate your
multiple AWS accounts into an *organization* and centrally manage your
accounts and their resources.
This guide provides descriptions of the Organizations ... | lib/aws/organizations.ex | 0.798658 | 0.572842 | organizations.ex | starcoder |
defmodule Csvto.Type do
@base ~w(integer float boolean string binary decimal naive_datetime datetime date time)a
@composite ~w(array)a
def base_types(), do: @base
def primitive?({composite, _}) when composite in @composite, do: true
def primitive?(base) when base in @base, do: true
def primitive?(co... | lib/csvto/type.ex | 0.675978 | 0.468669 | type.ex | starcoder |
defmodule Zookeeper.DataWatch do
use GenServer
@moduledoc """
Watches a node for data updates and sends an event to the specified
watcher each time it changes
The event will also be sent the very first time its
registered to get the data.
If the node does not exist, then the event will be sent with
... | lib/zookeeper/recipe/data_watch.ex | 0.706089 | 0.458773 | data_watch.ex | starcoder |
defmodule MangoPay.Dispute do
@moduledoc """
Functions for MangoPay [dispute](https://docs.mangopay.com/endpoints/v2.01/disputes#e176_the-dispute-object) object.
"""
use MangoPay.Query.Base
set_path "disputes"
@doc """
Get a dispute.
## Examples
{:ok, dispute} = MangoPay.Dispute.get(id)
"""
... | lib/mango_pay/dispute.ex | 0.664976 | 0.46721 | dispute.ex | starcoder |
defmodule Plug.Upload do
@moduledoc """
A server that manages uploaded files.
Uploaded files are stored in a temporary directory
and removed from the directory after the process that
requested the file dies.
During the request, those files are represented with
the Plug.Upload struct that contains three ... | lib/plug/upload.ex | 0.68437 | 0.429788 | upload.ex | starcoder |
defmodule Oli.Activities.Realizer.Logic.Expression do
@moduledoc """
Represents a logical expression of the general form:
<<fact>> <<operator>> <<value>>
The supported facts are attached objectives, attached tags, activity type
and full text.
Four supported operators exist in two pairs: "equals", "doesNo... | lib/oli/activities/realizer/logic/expression.ex | 0.869963 | 0.824214 | expression.ex | starcoder |
defmodule Swiss.Map do
@moduledoc """
A few extra functions to deal with Maps.
"""
@doc """
Applies defaults to a map.
## Examples
iex> Swiss.Map.defaults(%{a: 42}, %{b: 12})
%{a: 42, b: 12}
iex> Swiss.Map.defaults(%{a: 42}, %{a: 44, b: 12})
%{a: 42, b: 12}
iex> Swiss.Map.... | lib/swiss/map.ex | 0.902982 | 0.686567 | map.ex | starcoder |
defmodule Alembic.Translator.Minecraft do
@moduledoc """
Translates between packets (as represented internally by Alembic) and the
actual, raw data that gets sent over a socket.
"""
@behaviour Alembic.Translator
alias Alembic.Translator.Minecraft.Packets
@doc """
Reads the next byte to come over the... | lib/minecraft/translator.ex | 0.651355 | 0.484929 | translator.ex | starcoder |
defmodule Playground.Scenario.Counters.Many do
use Playground.Scenario
def scenario_type do
{:iterations, Stream.map(10..20, &round(:math.pow(2, &1)))}
end
def scenario_banner do
"""
Scenario: Comparison of Counters in ETS vs Atomics
Tasks:
- Sequentially update <count> ETS counters
... | lib/playground/scenario/counters/many.ex | 0.731442 | 0.617787 | many.ex | starcoder |
defmodule Resty do
@moduledoc """
This module makes it easy for Resty's modules to get default configuration
values.
All of these values can be changed in your config.exs file in order to
globally change the way Resty works.
"""
@doc """
Return the *default headers* that are going to be sent for every... | lib/resty.ex | 0.843927 | 0.652311 | resty.ex | starcoder |
defmodule Opencensus.Trace do
@moduledoc """
Macros to help Elixir programmers use OpenCensus tracing.
"""
@doc """
Wrap the given block in a child span with the given label/name and optional attributes.
Sets `Logger.metadata/0` with `Opencensus.Logger.set_logger_metadata/0` after changing the span
cont... | lib/opencensus/trace.ex | 0.84317 | 0.837686 | trace.ex | starcoder |
defmodule MMDB2Decoder do
@moduledoc """
MMDB2 file format decoder.
## Usage
To prepare lookups in a given database you need to parse it
and hold the result available for later usage:
iex(1)> database = File.read!("/path/to/database.mmdb")
iex(2)> {:ok, meta, tree, data} = MMDB2Decoder.parse_da... | lib/mmdb2_decoder.ex | 0.871884 | 0.688505 | mmdb2_decoder.ex | starcoder |
defmodule ExthCrypto.ECIES.Parameters do
@moduledoc """
Returns one set of the Standard ECIES parameters:
* ECIES using AES128 and HMAC-SHA-256-16
* ECIES using AES256 and HMAC-SHA-256-32
* ECIES using AES256 and HMAC-SHA-384-48
* ECIES using AES256 and HMAC-SHA-512-64
"""
defstruct mac: nil,
... | apps/exth_crypto/lib/ecies/parameters.ex | 0.899646 | 0.49292 | parameters.ex | starcoder |
defmodule Descisionex.PaymentMatrix do
@moduledoc """
https://en.wikipedia.org/wiki/Decision-matrix_method
"""
alias Descisionex.{PaymentMatrix, Helper}
defstruct matrix: [],
variants: [],
variants_num: 0,
possible_steps: [],
possible_steps_num: 0,
... | lib/algorithms/payment_matrix.ex | 0.89468 | 0.564399 | payment_matrix.ex | starcoder |
defmodule Holidays.Define do
use GenServer
alias Holidays.DateCalculator.DateMath
def start_link() do
GenServer.start_link(__MODULE__, [], name: __MODULE__)
end
def holiday(name, %{month: month, day: day, regions: regions}) do
GenServer.cast(__MODULE__, {:add_entry, :static, {name, month, day, regi... | lib/holidays/define.ex | 0.694821 | 0.40698 | define.ex | starcoder |
defmodule Surface.API do
@moduledoc false
@types [:any, :css_class, :list, :event, :children, :boolean, :string, :date,
:datetime, :number, :integer, :decimal, :map, :fun, :atom, :module,
:changeset, :form]
@private_opts [:action, :to]
defmacro __using__([include: include]) do
arities... | lib/surface/api.ex | 0.694924 | 0.612773 | api.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.