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 Datix.Time do
@moduledoc """
A `Time` parser using `Calendar.strftime` format-string.
"""
@doc """
Parses a time string according to the given `format`.
See the `Calendar.strftime` documentation for how to specify a format-string.
## Options
* `:calendar` - the calendar to build the `Time... | lib/datix/time.ex | 0.927421 | 0.938801 | time.ex | starcoder |
defmodule NeuralNetwork.Neuron do
defstruct in_conn: %{}, out_conn: [],
output: 0, forward_err_derivs: %{}
use GenServer
alias NeuralNetwork.Neuron
alias NeuralNetwork.Connection
alias NeuralNetwork.Sigmoid
alias NeuralNetwork.Backpropagation
def create do
{:ok, pid} = GenServer.start_l... | lib/neural_network/neuron.ex | 0.716913 | 0.498352 | neuron.ex | starcoder |
defmodule Ecto.Query.Util do
@moduledoc """
This module provide utility functions on queries.
"""
alias Ecto.Queryable
alias Ecto.Query.Query
alias Ecto.Query.JoinExpr
alias Ecto.Query.AssocJoinExpr
@doc """
Validates the query to check if it is correct. Should be called before
compilation by the ... | lib/ecto/query/util.ex | 0.80038 | 0.498108 | util.ex | starcoder |
defmodule SpryCov.Files do
@doc """
Returns the list of files and/or directories given to `mix test`
## Examples
iex> mix_test_files()
iex> mix_test_files(["test"])
[]
iex> mix_test_files(["test", "--cover"])
[]
iex> mix_test_files(["test", "test/spry_cov/utils_test.exs"])... | lib/spry_cov/files.ex | 0.763748 | 0.465387 | files.ex | starcoder |
defmodule GrovePi.Buzzer do
@moduledoc """
Control a Grove buzzer. While a buzzer can be controlled solely using
`GrovePi.Digital`, this module provides some helpers.
Example usage:
```
iex> {:ok, buzzer} = GrovePi.Buzzer.start_link(3)
:ok
iex> GrovePi.Buzzer.buzz(3)
:ok
```
"""
use GenServer
... | lib/grovepi/buzzer.ex | 0.906213 | 0.831485 | buzzer.ex | starcoder |
defmodule AshPolicyAuthorizer.Policy do
@moduledoc false
# For now we just write to `checks` and move them to `policies`
# on build, when we support nested policies we can change that.
defstruct [
:condition,
:policies,
:bypass?,
:checks,
:description,
:access_type
]
@type t :: %__M... | lib/ash_policy_authorizer/policy.ex | 0.675978 | 0.533701 | policy.ex | starcoder |
defmodule Sneex.Memory do
@moduledoc """
This module wraps memory access.
"""
defstruct [:data]
use Bitwise
@opaque t :: %__MODULE__{
data: binary()
}
@spec new(binary()) :: __MODULE__.t()
def new(data) when is_binary(data) do
%__MODULE__{data: data}
end
@spec raw_data(... | lib/sneex/memory.ex | 0.730866 | 0.514766 | memory.ex | starcoder |
defmodule Ecto.Repo do
@moduledoc """
This module is used to define a repository. A repository maps to a data
store, for example an SQL database. A repository must implement `url/0` and
set an adapter (see `Ecto.Adapter`) to be used for the repository.
When used, the following options are allowed:
* `:ada... | lib/ecto/repo.ex | 0.900492 | 0.498779 | repo.ex | starcoder |
defmodule Exq.Api do
@moduledoc """
Interface for retrieving Exq stats.
Pid is currently Exq.Api process.
"""
def start_link(opts \\ []) do
Exq.start_link(Keyword.put(opts, :mode, :api))
end
@doc """
List of queues with jobs (empty queues are deleted).
Expected args:
* `pid` - Exq.Api proc... | lib/exq/api.ex | 0.867345 | 0.535766 | api.ex | starcoder |
defmodule Lixie.Cog do
@moduledoc """
A behaviour module for defining a set of functionality that can be loaded and unloaded.
## Important notes
This behaviour assumes the module is a GenServer, and the use macro will call
`GenServer.__using__`.
Do not manually un/register commands. Return the command re... | lib/lixie/cog.ex | 0.835718 | 0.500122 | cog.ex | starcoder |
defmodule Riemannx.Connections.Batch do
@moduledoc """
The batch connector is a pass through module that adds batching functionality
on top of the existing protocol connections.
Batching will aggregate events you send and then send them in bulk in
intervals you specify, if the events reach a certain size you... | lib/riemannx/connections/batch.ex | 0.837554 | 0.792384 | batch.ex | starcoder |
defmodule MangoPay.BankAccount do
@moduledoc """
Functions for MangoPay [bank account](https://docs.mangopay.com/endpoints/v2.01/bank-accounts#e24_the-bankaccount-object) API.
"""
use MangoPay.Query.Base, "bankaccounts"
@doc """
Get a bank account of a user.
## Examples
{:ok, client} = MangoPay.B... | lib/mango_pay/bank_account.ex | 0.63341 | 0.424233 | bank_account.ex | starcoder |
defmodule Tradehub.Trade do
@moduledoc """
This module uses to fetch trade, orders information of the chain.
"""
import Tradehub.Raising
@doc """
Requests orders of the given account
## Examples
iex> Tradehub.Trade.get_orders("swth1fdqkq5gc5x8h6a0j9hamc30stlvea6zldprt6q")
"""
@spec get_ord... | lib/tradehub/trade.ex | 0.884514 | 0.457016 | trade.ex | starcoder |
defmodule Weather.TableFormatter do
import Enum, only: [each: 2, map: 2, map_join: 3, max: 1 ]
@doc """
Takes a list of row data, where each row is a HashDict, and a list of
headers. Prints a table to STDOUT of the data from each row
identified by each header. E.g. each header identifies a column,
and tho... | prag-programing/Part1/ch13proj/weather/lib/weather/table_formatter.ex | 0.867612 | 0.782663 | table_formatter.ex | starcoder |
defmodule Mazes.HexagonalMaze do
@behaviour Mazes.Maze
# hexes in the maze are arranged to have a flat top and bottom
# the rows are zig-zag
# ___ ___
# /1,1\___/3,1\___
# \___/2,1\___/4,1\
# /1,2\___/3,2\___/
# \___/2,2\___/4,2\
# \___/ \___/
@impl true
def new(opts) do
radius = ... | lib/mazes/hexagonal_maze.ex | 0.708717 | 0.622588 | hexagonal_maze.ex | starcoder |
defmodule StarkInfra.PixReversal do
alias __MODULE__, as: PixReversal
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.Utils.Parse
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
Groups PixReversal related functions
"""... | lib/pix_reversal/pix_reversal.ex | 0.909232 | 0.629305 | pix_reversal.ex | starcoder |
defmodule AdventOfCode2019.IntcodeComputer do
@moduledoc """
The Intcode Computer is used in the following days
- Day 2 — https://adventofcode.com/2019/day/2
- Day 5 — https://adventofcode.com/2019/day/5
- Day 7 — https://adventofcode.com/2019/day/7
- Day 9 — https://adventofcode.com/2019/day/9
- Day 11 —... | lib/advent_of_code_2019/intcode_computer.ex | 0.768125 | 0.482429 | intcode_computer.ex | starcoder |
defmodule Artemis.Helpers.BulkAction do
defmodule Result do
defstruct data: [],
errors: []
end
@moduledoc """
Iterate over a list of records, calling the passed function for each. Return
a standardized result set.
Options include:
halt_on_error: boolean (default false)
When tr... | apps/artemis/lib/artemis/helpers/bulk_action.ex | 0.835484 | 0.631921 | bulk_action.ex | starcoder |
defmodule Aoc2021.Day3 do
@moduledoc """
See https://adventofcode.com/2021/day/3
"""
defmodule Part1 do
@moduledoc false
@spec gamma([{any, {integer, integer}}]) :: integer
def gamma(list) do
digits_to_number(list, &gamma_digit/1)
end
@spec epsilon([{any, {integer, integer}}]) :: in... | lib/aoc2021/day3.ex | 0.79858 | 0.560072 | day3.ex | starcoder |
defmodule Pass.ResetPassword do
@moduledoc """
Handles password resets by generating, verifying, and redeeming JWTs.
The idea is that you would use `Pass.ResetPassword.generate_token/1` to
create a JWT that you could then send to the user (probably in a link in an
email).
When the user accesses your inter... | lib/pass/actions/reset_password.ex | 0.733929 | 0.584242 | reset_password.ex | starcoder |
defmodule Oli.Delivery.Attempts.PageLifecycle.AttemptState do
@moduledoc """
The complete state of a page attempt
resource_attempt - The resource attempt record itself
attempt_hierarchy - The state of the activity attempts required for rendering
"""
alias Oli.Delivery.Attempts.Core.ResourceAttempt
ali... | lib/oli/delivery/attempts/page_lifecycle/attempt_state.ex | 0.812793 | 0.625181 | attempt_state.ex | starcoder |
defmodule WechatPay.JSAPI do
@moduledoc """
The **JSAPI** payment method.
[Official document](https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_1)
## Example
Set up a client:
```elixir
{:ok, client} = WechatPay.Client.new(
app_id: "the-app_id",
mch_id: "the-mch-id",
api_key: "the-... | lib/wechat_pay/payment_methods/jsapi.ex | 0.790813 | 0.580798 | jsapi.ex | starcoder |
defmodule Plymio.Codi.Pattern.Struct do
@moduledoc ~S"""
The *struct* patterns create a range of transform functions for a module's struct.
See `Plymio.Codi` for an overview and documentation terms.
## Set and Unset Fields
These patterns use *the unset value*
(see `Plymio.Fontais.Guard.the_unset_value/0`... | lib/codi/pattern/struct/struct.ex | 0.893968 | 0.739446 | struct.ex | starcoder |
defmodule EllipticCurve.Utils.Integer do
@moduledoc false
use Bitwise
def modulo(x, n) do
rem(x, n)
|> correctNegativeModulo(n)
end
defp correctNegativeModulo(r, n) when r < 0 do
r + n
end
defp correctNegativeModulo(r, _n) do
r
end
def ipow(base, p, acc \\ 1)
def ipow(base, p, ... | lib/utils/integer.ex | 0.824356 | 0.544378 | integer.ex | starcoder |
defmodule Nostrum.Struct.Component do
@moduledoc """
Components are a framework for adding interactive elements to the messages your app or bot sends. They're accessible, customizable, and easy to use. There are several different types of components; this documentation will outline the basics of this new framework ... | lib/nostrum/struct/component.ex | 0.896518 | 0.76344 | component.ex | starcoder |
defmodule Membrane.FLV do
@moduledoc """
Format utilities and internal struct definitions for Membrane FLV Plugin
"""
@typedoc """
List of audio codecs supported by the FLV format.
"""
@type audio_codec_t() ::
:pcm
| :adpcm
| :MP3
| :pcmle
| :nellymoser_1... | lib/membrane_flv_plugin/format.ex | 0.789558 | 0.473536 | format.ex | starcoder |
defmodule NervesHub.Client do
@moduledoc """
A behaviour module for customizing if and when firmware updates get applied.
By default NervesHub applies updates as soon as it knows about them from the
NervesHub server and doesn't give warning before rebooting. This let's
devices hook into the decision making p... | lib/nerves_hub/client.ex | 0.801315 | 0.751648 | client.ex | starcoder |
defmodule Stripe.Coupon do
@moduledoc """
Work with Stripe coupon objects.
You can:
- Create a coupon
- Retrieve a coupon
- Update a coupon
- Delete a coupon
- list all coupons
Stripe API reference: https://stripe.com/docs/api#coupons
"""
@type t :: %__MODULE__{}
defstruct [
:id, :objec... | lib/stripe/coupon.ex | 0.733547 | 0.476153 | coupon.ex | starcoder |
defmodule WeatherflowTempest.Protocol do
@moduledoc """
The Weatherflow Protocol has a lot of magic fields. This parses and converts them to make the returned objects more intelligible.
Byte-effecient arrays are unpacked into named fields based on the protocol docs published by Weathperflow.
The following fie... | lib/weatherflow_tempest/protocol.ex | 0.835785 | 0.583856 | protocol.ex | starcoder |
defmodule WxDefines do
@moduledoc """
```
The definitions from the WxErlang header files, plus definitions of colours.
To use these definitions in your module, add "use WxDefines" at the top of the
module.
Note that the module also imports the Bitwise module so that the "|||" and "&&&"
binary operators ... | lib/wxDefines.ex | 0.590071 | 0.521167 | wxDefines.ex | starcoder |
defmodule ExRabbit do
@moduledoc """
ExRabbit is a module that conveniently manages your connection to RabbitMQ and its channels for you.
## How it works
For each module given to act as a consumer, it will assert the exchange, queue, binding and qos according to the
output of the `config/0` callback on your... | lib/ex_rabbit.ex | 0.890103 | 0.555857 | ex_rabbit.ex | starcoder |
defmodule Pow.Store.Backend.MnesiaCache.Unsplit do
@moduledoc """
GenServer that handles network split recovery for
`Pow.Store.Backend.MnesiaCache`.
This should be run on node(s) that has the `Pow.Store.Backend.MnesiaCache`
GenServer running. It'll subscribe to the Mnesia system messages, and listen
for `:... | lib/pow/store/backend/mnesia_cache/unsplit.ex | 0.836454 | 0.536434 | unsplit.ex | starcoder |
defmodule ControlNode.Namespace.Workflow do
@moduledoc false
alias ControlNode.{Namespace, Release}
defmodule Data do
@moduledoc false
@type t :: %__MODULE__{
namespace_spec: Namespace.Spec.t(),
release_spec: Release.Spec.t(),
release_state: Release.State.t(),
... | lib/control_node/namespace/workflow.ex | 0.715225 | 0.483039 | workflow.ex | starcoder |
defmodule IndifferentAccess do
@moduledoc """
Transforms a map into a struct or map supporting indifferent access.
Primary intended usage is via `IndifferentAccess.Plug`, see docs there.
"""
alias IndifferentAccess.Params
@doc """
Returns a struct or map accessible by Atom keys with several configurati... | lib/indifferent_access.ex | 0.846308 | 0.458834 | indifferent_access.ex | starcoder |
defmodule ExDockerCompose.Subcommands do
@moduledoc """
A module that is the source of truth for the supported subcommands on `docker-compose`.
as well as how they should be used.
"""
@supported_subcommands [
:build, :bundle, :config, :create,
:down, :events, :exec, :help,
:images, :kill, :logs, ... | lib/ex_docker_compose/subcommands.ex | 0.692434 | 0.588771 | subcommands.ex | starcoder |
defmodule Fixerio do
@moduledoc """
Provides access to Fixer.io like API with support for multiple endpoint
to use as fallback.
"""
import Fixerio.API
alias Fixerio.Config
@doc """
Gets the latest conversion rates. Uses the `/latest` API endpoint.
parameters:
* `options` (optioal): Map with opti... | lib/fixerio.ex | 0.895808 | 0.548613 | fixerio.ex | starcoder |
defmodule Google.Bigtable.V2.ReadRowsRequest do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
table_name: String.t(),
app_profile_id: String.t(),
rows: Google.Bigtable.V2.RowSet.t(),
filter: Google.Bigtable.V2.RowFilter.t(),
rows_limit: i... | lib/grpc/data/bigtable.pb.ex | 0.748444 | 0.462837 | bigtable.pb.ex | starcoder |
defmodule Mix.Tasks.Deps do
use Mix.Task
import Mix.Dep, only: [loaded: 1, format_dep: 1, format_status: 1, check_lock: 2]
@shortdoc "List dependencies and their status"
@moduledoc ~S"""
List all dependencies and their status.
Dependencies must be specified in the `mix.exs` file in one of
the followin... | lib/mix/lib/mix/tasks/deps.ex | 0.776114 | 0.471406 | deps.ex | starcoder |
defmodule UltraDark.Blockchain.Block do
alias UltraDark.Blockchain.Block
alias UltraDark.Utilities
alias UltraDark.Transaction
alias Decimal, as: D
defstruct index: nil,
hash: nil,
previous_hash: nil,
difficulty: nil,
nonce: 0,
timestamp: nil,
... | lib/block.ex | 0.797281 | 0.713057 | block.ex | starcoder |
defmodule Raem.Instituicoes do
@moduledoc """
The Instituicoes context.
"""
import Ecto.Query, warn: false
alias Raem.Repo
alias Raem.Instituicoes.Instituicao
@doc """
Returns the list of instituicoes.
## Examples
iex> list_instituicoes()
[%Instituicao{}, ...]
"""
def list_instit... | RAEM/raem/lib/raem/instituicoes/instituicoes.ex | 0.770162 | 0.416292 | instituicoes.ex | starcoder |
defmodule Content.Audio.Predictions do
@moduledoc """
Module to convert a Message.Predictions.t() struct into the
appropriate audio struct, whether it's a NextTrainCountdown.t(),
TrainIsArriving.t(), TrainIsBoarding.t(), or TrackChange.t().
"""
require Logger
require Content.Utilities
alias Content.Aud... | lib/content/audio/predictions.ex | 0.742328 | 0.432363 | predictions.ex | starcoder |
defmodule PhoenixIntegration do
@moduledoc """
Lightweight server-side integration test functions for Phoenix. Works within the existing
Phoenix.ConnTest framework and emphasizes both speed and readability.
## Configuration
### Step 1
You need to tell phoenix_integration which endpoint to use. Add the fo... | lib/phoenix_integration.ex | 0.76869 | 0.8288 | phoenix_integration.ex | starcoder |
defmodule Concentrate.Filter.FakeTrips do
@moduledoc "Fake implementation of Filter.GTFS.Trips"
def route_id("trip"), do: "route"
def route_id(_), do: nil
def direction_id("trip"), do: 1
def direction_id(_), do: nil
end
defmodule Concentrate.Filter.FakeCancelledTrips do
@moduledoc "Fake implementation of ... | test/support/filter/fakes.ex | 0.596551 | 0.402803 | fakes.ex | starcoder |
defmodule GraphQL.Node do
@moduledoc """
Functions to create all different types of nodes of a GraphQL operation.
Usually, this module should not be used directly, since it is easier to use
the function from `GraphQL.QueryBuilder`.
"""
@enforce_keys [:node_type]
defstruct node_type: nil,
name... | lib/graphql/node.ex | 0.924866 | 0.89058 | node.ex | starcoder |
defmodule Glock.Conn do
@moduledoc """
Defines the glock connection struct that serves as
the configuration state of an initialized glock process.
The struct tracks all configuration settings and arguments
passed into the connection when it is initialized and provides
common default values for all settings... | lib/glock/conn.ex | 0.717408 | 0.414277 | conn.ex | starcoder |
defmodule ExSchedule do
@moduledoc """
Module providing a way to declare actions happening on an interval basis.
Defining a schedule
```
defmodule YourApp.Schedules.Developer do
use ExSchedule
schedule every: {6, :hours} do
Developer.eat(:pizza)
end
schedule every: :hour, first_in: {... | lib/ex_schedule.ex | 0.900355 | 0.917303 | ex_schedule.ex | starcoder |
defmodule AdventOfCode.Y2021.Day2 do
@moduledoc """
--- Day 2: Dive! ---
Now, you need to figure out how to pilot this thing.
It seems like the submarine can take a series of commands like forward 1, down 2, or up 3:
forward X increases the horizontal position by X units.
down X increases the dep... | lib/y_2021/d2/day2.ex | 0.823186 | 0.911731 | day2.ex | starcoder |
defmodule Stripe.Charges do
@moduledoc """
Handles charges to the Stripe API.
(API ref: https://stripe.com/docs/api#charges)
Operations:
- create
- update
- get one
- list
- count
- refund
- refund partial
"""
@endpoint "charges"
@doc """
Creates a charge for a customer or card. Yo... | lib/stripe/charges.ex | 0.83193 | 0.852014 | charges.ex | starcoder |
defmodule BST do
@moduledoc """
Handles operations for working with binary search trees.
"""
@modes ~w(in_order pre_order post_order reverse)a
alias BST.Node
@doc """
Creates new node
## Examples
iex> BST.new(2)
%BST.Node{data: 2}
"""
def new(data, left \\ nil, right \\ nil) do
... | lib/bst.ex | 0.917082 | 0.767167 | bst.ex | starcoder |
defmodule Cldr.PluralRules.Extract do
@moduledoc """
Extract all the plural rules for many locales from the CLDR file that defines them.
"""
@doc """
Extract all the plural rules for many locales from the CLDR file that defines them.
"""
def from(file) do
{xml, _} = :xmerl_scan.file(file)
allRul... | lib/cldr/plural_rules/extract.ex | 0.857052 | 0.793626 | extract.ex | starcoder |
defmodule AstraeaVirgoWeb.ErrorView do
use AstraeaVirgoWeb, :view
@moduledoc """
Response for Error Request
"""
defp server_error_message(:internal), do: "Internal Server Error"
defp server_error_message(:backwards_clock), do: "Generate ID Error"
defp server_error_message(_), do: "Returned Error by Cach... | lib/virgo_web/views/error_view.ex | 0.814901 | 0.661141 | error_view.ex | starcoder |
defmodule Disco.Query do
@moduledoc """
The query specification.
A query in `Disco` is a struct which has the fields representing potential parameters
for the query itself.
This module defines a behaviour with a set of default callback implementations to execute
a query on an aggregate.
## Define a que... | lib/disco/query.ex | 0.9191 | 0.930584 | query.ex | starcoder |
defmodule NashvilleZoneLookup.Zoning.LandUseCondition do
@moduledoc ~S"""
The conditions under which a `NashvilleZoneLookup.Domain.LandUse` can be performed.
Many `NashvilleZoneLookup.Domain.LandUse` are unconditionally permitted ("Permitted by
right" in Nashville's terminology) for a particular
`NashvilleZo... | lib/nashville_zone_lookup/zoning/land_use_condition.ex | 0.886002 | 0.647171 | land_use_condition.ex | starcoder |
defmodule Rubbergloves.Annotatable do
@moduledoc"""
Add simple annotations to elixir methods which can be used later to do some funkiness see https://medium.com/@cowen/annotations-in-elixir-450015ecdd97
## Usage
```
defmodule Example do
use Rubbergloves.Annotatable, [:bar, :foo]
@bar tru... | lib/annotations/annotatable.ex | 0.849207 | 0.827863 | annotatable.ex | starcoder |
defmodule Robotica.Scheduler.Sequence do
@moduledoc """
Load and process a schedule sequence
"""
require Logger
alias Robotica.Config.Loader
if Application.compile_env(:robotica_common, :compile_config_files) do
@filename Application.compile_env(:robotica, :sequences_file)
@external_resource @file... | robotica/lib/robotica/scheduler/sequence.ex | 0.699254 | 0.512144 | sequence.ex | starcoder |
defprotocol Db.Backend do
@doc """
When implementing access to a new type of database, a struct containing query information should be created.
The db framework has a module generate a query and returns it to route through the protocol.
Whatever is returned by execute will be returned to the client unless the ... | lib/db.ex | 0.74055 | 0.434641 | db.ex | starcoder |
defmodule ExSozu do
@moduledoc """
Provides the main API to interface with Sōzu and handles the connection.
## Answers
Answers from Sōzu should be handled in a `GenServer.handle_info/2` callback.
Messages will be in these formats:
{:answer, %ExSozu.Answer{status: :ok}}
{:answer, %ExSozu.Answer... | lib/exsozu.ex | 0.673621 | 0.400925 | exsozu.ex | starcoder |
import Kernel, except: [apply: 3]
defmodule Ecto.Query.Builder.CTE do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Escapes the CTE name.
iex> escape(quote(do: "FOO"), __ENV__)
"FOO"
"""
@spec escape(Macro.t, Macro.Env.t) :: Macro.t
def escape(name, _env) when is_bitstring(name), do:... | lib/ecto/query/builder/cte.ex | 0.730963 | 0.407746 | cte.ex | starcoder |
defmodule Phoenix.Endpoint.Cowboy2Adapter do
@moduledoc """
The Cowboy2 adapter for Phoenix.
## Endpoint configuration
This adapter uses the following endpoint configuration:
* `:http` - the configuration for the HTTP server. It accepts all options
as defined by [`Plug.Cowboy`](https://hexdocs.pm/p... | lib/phoenix/endpoint/cowboy2_adapter.ex | 0.846038 | 0.449272 | cowboy2_adapter.ex | starcoder |
defmodule Retex.Node.Type do
@moduledoc """
The NodeType if part of the alpha network, the discrimination part of the network
that check if a specific class exists. If this is the case, it propagates the activations
down to the select node types. They will select an attribute and check for its existance.
"""
... | lib/nodes/type_node.ex | 0.73848 | 0.487978 | type_node.ex | starcoder |
defmodule Mix.Tasks.Scenic.New.Example do
@moduledoc """
Generates a starter Scenic application.
This is the easiest way to set up a new Scenic project.
## Install `scenic.new`
```bash
mix archive.install hex scenic_new
```
## Build the Starter Application
First, navigate the command-line to the... | lib/mix/tasks/new_example.ex | 0.886525 | 0.755975 | new_example.ex | starcoder |
defmodule GenEvent.Stream do
@moduledoc """
Defines a `GenEvent` stream.
This is a struct returned by `stream/2`. The struct is public and
contains the following fields:
* `:manager` - the manager reference given to `GenEvent.stream/2`
* `:timeout` - the timeout between events, defaults to `:infinit... | lib/elixir/lib/gen_event/stream.ex | 0.727298 | 0.46035 | stream.ex | starcoder |
defmodule Mix.Tasks.Compile.Asn1 do
@moduledoc """
A mix compiler for the ASN.1 format leveraging Erlang's `:asn1_ct`.
Once installed, the compiler can be enabled by changing project configuration in `mix.exs`:
def project() do
[
# ...
compilers: [:asn1] ++ Mix.compilers(),
... | lib/mix/tasks/compile.asn1.ex | 0.737442 | 0.444685 | compile.asn1.ex | starcoder |
defmodule Macro.Env do
@moduledoc """
A struct that holds compile time environment information.
The current environment can be accessed at any time as
`__ENV__/0`. Inside macros, the caller environment can be
accessed as `__CALLER__/0`.
An instance of `Macro.Env` must not be modified by hand. If you need ... | lib/elixir/lib/macro/env.ex | 0.902303 | 0.537284 | env.ex | starcoder |
defmodule Linguist.MemorizedVocabulary do
alias Linguist.Cldr.Number.Cardinal
alias Linguist.Compiler
alias Linguist.{LocaleError, NoTranslationError}
defmodule TranslationDecodeError do
defexception [:message]
end
@moduledoc """
Defines lookup functions for given translation locales, binding intero... | lib/linguist/memorized_vocabulary.ex | 0.787073 | 0.482185 | memorized_vocabulary.ex | starcoder |
defmodule Cldr.Eternal.Priv do
@moduledoc false
# This module contains code private to the Eternal project, basically just
# providing utility functions and macros. Nothing too interesting to see here
# beyond shorthands for common blocks.
# we need is_table/1
import Cldr.Eternal.Table
alias Cldr.Eternal... | lib/cldr/eternal/priv.ex | 0.603348 | 0.489381 | priv.ex | starcoder |
defmodule Phoenix.Tracker.State do
@moduledoc """
Provides an ORSWOT CRDT.
"""
alias Phoenix.Tracker.{State, Clock}
@type name :: term
@type topic :: String.t
@type key :: term
@type meta :: map
@type ets_id :: :ets.tid
@type clock :: pos_integer
@type tag ... | lib/phoenix/tracker/state.ex | 0.865494 | 0.429429 | state.ex | starcoder |
defmodule ElixirSense.Core.Normalized.Code.CursorContext do
@moduledoc false
@doc """
Receives a string and returns the cursor context.
This function receives a string with incomplete Elixir code,
representing a cursor position, and based on the string, it
provides contextual information about said positi... | lib/elixir_sense/core/normalized/code/cursor_context.ex | 0.786418 | 0.563918 | cursor_context.ex | starcoder |
defmodule Plug.Cowboy do
@moduledoc """
Adapter interface to the Cowboy2 webserver.
## Options
* `:ip` - the ip to bind the server to.
Must be either a tuple in the format `{a, b, c, d}` with each value in `0..255` for IPv4,
or a tuple in the format `{a, b, c, d, e, f, g, h}` with each value in ... | lib/plug/cowboy.ex | 0.908442 | 0.553867 | cowboy.ex | starcoder |
defmodule Ueberauth.Strategy.Slack do
@moduledoc """
Implements an ÜeberauthSlack strategy for authentication with slack.com.
When configuring the strategy in the Üeberauth providers, you can specify some defaults.
* `uid_field` - The field to use as the UID field. This can be any populated field in the info ... | lib/ueberauth/strategy/slack.ex | 0.802478 | 0.669154 | slack.ex | starcoder |
defmodule Algae.Internal do
@moduledoc false
@type ast() :: {atom(), any(), any()}
@doc """
Construct a data type AST
"""
@spec data_ast(module() | [module()], ast()) :: ast()
def data_ast(lines) when is_list(lines) do
{field_values, field_types, specs, args, defaults} = module_elements(lines)
... | lib/algae/internal.ex | 0.73173 | 0.466846 | internal.ex | starcoder |
defmodule StaffNotesWeb.SlidingSessionTimeout do
@moduledoc """
Module `Plug` that times out the user's session after a period of inactivity.
Because this project uses [OAuth](https://oauth.net/), our application's permissions can be
revoked by the owner of the account and our app would never know. By periodic... | lib/staff_notes_web/plugs/sliding_session_timeout.ex | 0.847463 | 0.696694 | sliding_session_timeout.ex | starcoder |
defmodule Exq.Redis.JobStat do
@moduledoc """
The JobStat module encapsulates storing system-wide stats on top of Redis
It aims to be compatible with the Sidekiq stats format.
"""
require Logger
alias Exq.Support.{Binary, Process, Job, Time}
alias Exq.Redis.{Connection, JobQueue}
def record_processed_... | lib/exq/redis/job_stat.ex | 0.654453 | 0.507141 | job_stat.ex | starcoder |
defmodule AWS.SFN do
@moduledoc """
AWS Step Functions
AWS Step Functions is a service that lets you coordinate the components of
distributed applications and microservices using visual workflows.
You can use Step Functions to build applications from individual
components, each of which performs a discre... | lib/aws/sfn.ex | 0.919967 | 0.820577 | sfn.ex | starcoder |
defmodule RDF do
@moduledoc """
The top-level module of RDF.ex.
RDF.ex consists of:
- modules for the nodes of an RDF graph
- `RDF.Term`
- `RDF.IRI`
- `RDF.BlankNode`
- `RDF.Literal`
- the `RDF.Literal.Datatype` system
- a facility for the mapping of URIs of a vocabulary to Elixir modules ... | lib/rdf.ex | 0.897749 | 0.880951 | rdf.ex | starcoder |
defmodule Bonny.Config do
@moduledoc """
Operator configuration interface
"""
@doc """
Kubernetes API Group of this operator
"""
@spec group() :: binary
def group do
default = "#{project_name()}.example.com"
Application.get_env(:bonny, :group, default)
end
@doc """
The name of the operat... | lib/bonny/config.ex | 0.843348 | 0.470676 | config.ex | starcoder |
import Kojin.Id
defmodule Kojin.Pod.PodType do
@moduledoc """
A set of functions for defining _Plain Old Data_ types (i.e. POD Types).
"""
alias Kojin.Pod.PodType
use TypedStruct
@typedoc """
A `Kojin.Pod.PodType` defines a type that can be used to type fields
in objects and arrays in a schema.
- ... | lib/kojin/pod/pod_type.ex | 0.86988 | 0.538437 | pod_type.ex | starcoder |
defmodule Betazoids.Collector do
@moduledoc """
Betazoids.Collector is a process that collects stats from the Betazoids
messenger group
It uses Betazoids.Facebook to interact with the Facebook Graph API.
Collector consists to taking a short-lived token and extending it to a
long-lived token. This token i... | lib/betazoids/collector.ex | 0.773174 | 0.525673 | collector.ex | starcoder |
defmodule Square.Customers do
@moduledoc """
Documentation for `Square.Customers`.
"""
@doc """
Lists a business's customers.
```
def list_customers(client, [cursor: nil, sort_field: nil, sort_order: nil])
```
### Parameters
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
... | lib/api/customers_api.ex | 0.936146 | 0.791338 | customers_api.ex | starcoder |
defmodule ExDoc.Language do
@moduledoc false
@typep spec_ast() :: term()
@typedoc """
The map has the following keys:
* `:module` - the module
* `:docs` - the docs chunk
* `:language` - the language callback
* `:id` - module page name
* `:title` - module display title
* `:type` -... | lib/ex_doc/language.ex | 0.885455 | 0.688141 | language.ex | starcoder |
defmodule Jeeves.Service do
@moduledoc """
Implement a service consisting of a pool of workers, all running in
their own application.
### Prerequisites
You'll need to add poolboy to your project dependencies.
### Usage
To create the service:
* Create a module that implements the API you want. Thi... | lib/jeeves/service.ex | 0.826397 | 0.736614 | service.ex | starcoder |
defmodule Ash.Query.Operator.LessThan do
@moduledoc """
left < right
Does not simplify, but is used as the simplification value for
`Ash.Query.Operator.LessThanOrEqual`, `Ash.Query.Operator.GreaterThan` and
`Ash.Query.Operator.GreaterThanOrEqual`.
When comparing predicates, it is mutually exclusive with `... | lib/ash/query/operator/less_than.ex | 0.871235 | 0.661371 | less_than.ex | starcoder |
defmodule Timex.Ecto.DateTimeWithTimezone.Query do
@moduledoc """
Timex.Ecto.DateTimeWithTimezone ist ein zusammengesetzter Datentyp `{dt:datetimetz, tz:timezone}`. Beim Vergleich
von diesen Datentypen muss man immer den `dt`-Teil dieses Datentyps vergleichen, ansonsten wird nur die String
Repräsentation vergli... | lib/timex/ecto/datetimetz_query.ex | 0.918063 | 0.716842 | datetimetz_query.ex | starcoder |
defmodule ApiVersioner.SetVersion do
@moduledoc """
`ApiVersioner.SetVersion` is a *plug* module for setting an API version.
The module allows the API version identifier to be stored inside of the
`:assigns` map within the `%Plug.Conn{}` structure.
Identification of a requested API version is done by... | lib/set_version.ex | 0.869341 | 0.411229 | set_version.ex | starcoder |
defmodule EWallet.BalanceFetcher do
@moduledoc """
Handles the retrieval and formatting of balances from the local ledger.
"""
alias EWalletDB.{Token, User}
alias LocalLedger.Wallet
@spec all(map()) :: {:ok, %EWalletDB.Wallet{}} | {:error, atom()}
@doc """
Prepare the list of balances and turn them in... | apps/ewallet/lib/ewallet/fetchers/balance_fetcher.ex | 0.742048 | 0.430566 | balance_fetcher.ex | starcoder |
defmodule Elidactyl.ChangesetCase do
use ExUnit.CaseTemplate
using do
quote do
import unquote(__MODULE__), only: [
assert_invalid: 2, assert_invalid: 3,
assert_valid: 1, assert_valid: 2
]
end
end
@doc """
Asserts that the given changeset is invalid, and that when the asse... | test/support/changeset_case.ex | 0.707809 | 0.559741 | changeset_case.ex | starcoder |
defmodule Mux.Data.RealTime do
@moduledoc """
This module provides functions that interact with the `real-time` endpoints
Note, these API documentation links may break periodically as we update documentation titles.
- [Dimensions](https://api-docs.mux.com/#real-time-get)
- [Metrics](https://api-docs.mux.com/... | lib/mux/data/real_time.ex | 0.915691 | 0.587884 | real_time.ex | starcoder |
defmodule VintageNetWiFi.Utils do
@moduledoc """
Various utility functions for handling WiFi information
"""
@doc "Converts 1 to true, 0 to false"
def bit_to_boolean(1), do: true
def bit_to_boolean(0), do: false
@type frequency_info() :: %{
band: VintageNetWiFi.AccessPoint.band(),
ch... | lib/vintage_net_wifi/utils.ex | 0.81309 | 0.63375 | utils.ex | starcoder |
defmodule Proj.Geodesic do
@moduledoc """
Provides functions to solve problems involving geodesic lines.
Common problems this can solve:
- Finding the distance between two locations
- Finding the bearings between two locations
- Finding the resulting location after moving `x` metres forwards facing a
... | lib/proj/geodesic.ex | 0.920745 | 0.837021 | geodesic.ex | starcoder |
defmodule Day1 do
@moduledoc """
Compute the Manhattan distance between two points given a path.
"""
@doc """
Compute manhattan distance of steps specified in a file"
"""
def distance_file(file_path), do: distance(File.read!(file_path))
@doc """
Given a string of steps, compute the manhattan distanc... | day1/lib/day1.ex | 0.846197 | 0.799011 | day1.ex | starcoder |
defmodule Exglicko2.Player do
@moduledoc """
A single entity that can take part in a game.
Players have a `:rating`, `:deviation`, and `:volatility`.
"""
@e 2.71828182845904523536028747135266249775724709369995
@convergence_tolerance 0.000001
@glicko_conversion_factor 173.7178
@unrated_glicko_rating 150... | lib/exglicko2/player.ex | 0.936973 | 0.623721 | player.ex | starcoder |
defmodule Openstex.Swift.V1 do
@moduledoc ~S"""
Helper functions to assist in building requests for openstack compatible swift apis.
Builds a request in a format that subsequently is easily modified. The request may ultimately be sent to
an openstack/swift compliant api with a library such as `:hackney`. See
... | lib/openstex/swift/v1.ex | 0.873963 | 0.419172 | v1.ex | starcoder |
defmodule ExUnit.CaseTemplate do
@moduledoc """
Defines a module template to be used throughout your test suite.
This is useful when there are a set of setup callbacks or a set
of functions that should be shared between test modules.
Let's imagine that you create a `MyCase` module that calls `use
ExUnit.C... | lib/ex_unit/lib/ex_unit/case_template.ex | 0.851119 | 0.641892 | case_template.ex | starcoder |
defmodule Lapin.Connection do
@moduledoc """
RabbitMQ connection handler
This module handles the RabbitMQ connection. It also provides a behaviour for
worker module implementation. The worker module should use the `Lapin.Connection`
behaviour and implement the callbacks it needs.
When using the `Lapin.Con... | lib/lapin/connection.ex | 0.85223 | 0.478041 | connection.ex | starcoder |
defmodule RateLimit do
@moduledoc """
RateLimit provides an API for rate limiting HTTP requests based on the requester IP.
"""
use GenServer
@doc """
Setup rate limiting for a specific scope.
We use scopes to allow namespacing of rate limiting, so multiple consumers can
use the same rate limit gen_se... | lib/rate_limit.ex | 0.817319 | 0.529203 | rate_limit.ex | starcoder |
defmodule Tock do
@moduledoc """
Tock is a library for mocking remote function calls made by `Task.Supervisor`.
## Usage
When working in a distributed system `Task.Supervisor` provides a mechanism
for calling functions on a remote node.
{ MyRemoteTaskSupervisor, remote_node }
|> Task.Supervisor... | lib/tock.ex | 0.914123 | 0.620406 | tock.ex | starcoder |
defmodule RDF.Turtle.Encoder.State do
@moduledoc false
alias RDF.{BlankNode, Description}
def start_link(data, base, prefixes) do
Agent.start_link(fn -> %{data: data, base: base, prefixes: prefixes} end)
end
def stop(state) do
Agent.stop(state)
end
def data(state), do: Agent.get(state, & &1.da... | lib/rdf/serializations/turtle_encoder_state.ex | 0.63023 | 0.553686 | turtle_encoder_state.ex | starcoder |
defmodule RF69.Frequency do
@moduledoc false
import RF69.Util, only: [write_reg: 3]
@type t() ::
314
| 315
| 316
| 433
| 434
| 435
| 863
| 864
| 865
| 866
| 867
| 868
| 869
... | lib/rf69/frequency.ex | 0.656878 | 0.454048 | frequency.ex | starcoder |
defmodule Delaunay.Utils do
use Bitwise
@moduledoc """
Documentation for Delaunay.Utils
"""
@doc """
pseudoAngle: Monotonically increases with real angle, but doesn't need expensive trigonometry
"""
def pseudoAngle(dx, dy) do
p = dx / (abs(dx) + abs(dy))
(if (dy > 0), do: 3 - p, else: 1 + p) /... | lib/delaunay/utils.ex | 0.620852 | 0.468365 | utils.ex | starcoder |
defmodule AstraeaVirgoWeb.OrganizationView do
use AstraeaVirgoWeb, :view
@moduledoc """
Response for Organization API
"""
@doc """
Response
## index.json
Response for index Organization API: `GET /api/organizations`
Response: list of Object
| field | type | required | null | descript ... | lib/virgo_web/views/organization_view.ex | 0.73077 | 0.660866 | organization_view.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.