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 Cog.Pipeline.Tracker do
@pipelines :cog_pipelines
@max_records 500
@short_id_length 15
alias Cog.Events.Util
require Record
Record.defrecordp :pipeline, [id: nil, pid: nil, user: nil, text: nil, count: 0, state: :running, started: nil, finished: nil]
@doc "Configures ETS tables"
def init(... | lib/cog/pipeline/tracker.ex | 0.550124 | 0.491578 | tracker.ex | starcoder |
defmodule Meeseeks.Result do
@moduledoc """
Results are the product of running selections on a document, and package
together a node id and the `Meeseeks.Document` for which that id is
valid.
Results are generally used in one of two ways: either data, such as an
element's tag, is extracted from a result, o... | lib/meeseeks/result.ex | 0.905477 | 0.503235 | result.ex | starcoder |
defmodule Nostrum.Struct.User.Flags do
@moduledoc """
Struct representing the flags a user account can have
"""
import Bitwise
defstruct staff: false,
partner: false,
hypesquad_events: false,
bug_hunter_level_1: false,
hypesquad_bravery: false,
hyp... | lib/nostrum/struct/user/flags.ex | 0.836354 | 0.420302 | flags.ex | starcoder |
defmodule ExState do
@moduledoc """
`ExState` loads and persists workflow execution to a database through Ecto.
The `ExState.Execution` is built through the subject's `:workflow`
association.
## Setup
defmodule ShipmentWorkflow do
use ExState.Definition
workflow "shipment" do
... | lib/ex_state.ex | 0.836955 | 0.489198 | ex_state.ex | starcoder |
defmodule Astro.Utils do
@moduledoc false
import Astro.Guards
@radians_to_degrees 180.0 / :math.pi()
def to_degrees(radians) do
radians * @radians_to_degrees
end
def to_radians(degrees) do
degrees / @radians_to_degrees
end
@doc """
Calculates the modulo of a number (integer, float).
No... | lib/astro/utils.ex | 0.921939 | 0.78785 | utils.ex | starcoder |
defmodule Univrse.Recipient do
@moduledoc """
A Univrse Recipient is a structure attached to an `t:Univrse.Envelope.t/0`
that helps the intended recipient(s) decrypt the encrypted payload.
An encrypted Envelope may contain one or multiple Recipient structures.
Where the Envelope is intended for a single rec... | lib/univrse/recipient.ex | 0.889864 | 0.682437 | recipient.ex | starcoder |
defmodule BankAccount do
@moduledoc """
A bank account that supports access from multiple processes.
"""
@typedoc """
An account handle.
"""
@opaque account :: pid
defp manage_account({:closed, balance}, _any_command) do
{{:error, :account_closed}, {:closed, balance}}
end
defp manage_account... | elixir/bank-account/lib/bank_account.ex | 0.811863 | 0.484807 | bank_account.ex | starcoder |
defprotocol Bamboo.Formatter do
@moduledoc ~S"""
Converts data to email addresses.
Implementations of the `Bamboo.Formatter` protocol convert a given data
structure to a two item tuple of `{name, address}` or an address string. The
`opts` argument is a map with the key `:type` and a value of `:from`, `:to`,
... | lib/bamboo/formatter.ex | 0.909267 | 0.648884 | formatter.ex | starcoder |
defmodule Transpose1 do
def transpose(m) do
attach_row(m, [])
end
@doc """
Given a matrix and a result, make the first row into a column,
attach it to the result, and then recursively attach the
remaining rows to that new result.
When the original matrix has no rows remaining, the result
mat... | triangles/lib/transpose.ex | 0.681303 | 0.877109 | transpose.ex | starcoder |
defmodule Scholar.Metrics do
@moduledoc """
Metric functions.
Metrics are used to measure the performance and compare
the performance of any kind of classifier in
easy-to-understand terms.
All of the functions in this module are implemented as
numerical functions and can be JIT or AOT compiled with
an... | lib/scholar/metrics.ex | 0.905652 | 0.770357 | metrics.ex | starcoder |
defmodule Stache.Tokenizer do
@moduledoc false
defmodule State do
@moduledoc false
defstruct [
line: 0,
pos: 0,
pos_start: 0,
start: 0,
buffer: "",
mode: :text,
delim_start: {"{{", 2},
delim_end: {"}}", 2},
tokens: []
]
end
@default_delimeters {... | lib/tokenizer.ex | 0.742702 | 0.445891 | tokenizer.ex | starcoder |
defmodule Astarte.Core.Mapping.EndpointsAutomaton do
alias Astarte.Core.Mapping
@doc """
returns `:ok` and an endpoint for a given `path` using a previously built automata (`{transitions, accepting_states}`).
if path is not complete one or more endpoints will be guessed and `:guessed` followed by a list of en... | lib/astarte_core/mapping/endpoints_automaton.ex | 0.876443 | 0.624966 | endpoints_automaton.ex | starcoder |
defmodule Plug.Static do
@moduledoc """
A plug for serving static assets.
It expects two options on initialization:
* `:at` - the request path to reach for static assets.
It must be a binary.
* `:from` - the filesystem path to read static assets from.
It must be a binary, containi... | lib/plug/static.ex | 0.830937 | 0.555073 | static.ex | starcoder |
defmodule Mix.Releases.App do
@moduledoc """
Represents important metadata about a given application.
"""
defstruct name: nil,
vsn: nil,
applications: [],
included_applications: [],
start_type: nil,
path: nil
@type start_type :: :permanent | :tempor... | lib/mix/lib/releases/models/app.ex | 0.830697 | 0.42913 | app.ex | starcoder |
defmodule JISHOCALLER do
@moduledoc """
Wrapper for the Jisho API found on https://jisho.org/
Search for a word both in Japanese and English and return the result.
"""
@doc """
Search by a word or a term. Returns a JSON result from the call.
Parameters:
- Word or term: "String"
Result:
- A li... | lib/jishocaller.ex | 0.869452 | 0.593256 | jishocaller.ex | starcoder |
defmodule Appsignal.Ecto do
@moduledoc """
Integration for logging Ecto queries
If you're using Ecto 3, attach `Appsignal.Ecto` to Telemetry query events in
your application's `start/2` function:
```
:telemetry.attach(
"appsignal-ecto",
[:my_app, :repo, :query],
&Appsignal.Ecto.handle_event/4,... | lib/appsignal/ecto.ex | 0.879244 | 0.777342 | ecto.ex | starcoder |
defmodule AstraeaVirgoWeb.SubmissionView do
use AstraeaVirgoWeb, :view
@moduledoc """
Response for Submission API
"""
@doc """
Response
## index.json
Response for index Contest API: `GET /api/submissions`
Response: list of Object
| field | type | required | descript |
|... | lib/virgo_web/views/submission_view.ex | 0.763307 | 0.686035 | submission_view.ex | starcoder |
defmodule Bolt.Sips.Internals.PackStream.DecoderV2 do
@moduledoc false
_module_doc = """
Bolt V2 has specification for decoding:
- Temporal types:
- Local Date
- Local Time
- Local DateTime
- Time with Timezone Offset
- DateTime with Timezone Id
- DateTime with Timezone Offset
- Dura... | lib/bolt_sips/internals/pack_stream/decoder_v2.ex | 0.824956 | 0.635435 | decoder_v2.ex | starcoder |
defmodule D6 do
@moduledoc """
--- Day 6: Custom Customs ---
As your flight approaches the regional airport where you'll switch to a much larger plane, customs declaration forms are distributed to the passengers.
The form asks a series of 26 yes-or-no questions marked a through z. All you need to do is identif... | lib/days/06.ex | 0.802052 | 0.72783 | 06.ex | starcoder |
defmodule Rummage.Phoenix do
@moduledoc """
`Rummage.Phoenix` is a support framework for `Phoenix` that can be used to manipulate
`Phoenix` collections and `Ecto` models with Search, Sort and Paginate operations.
It accomplishes the above operations by using `Rummage.Ecto`, to paginate `Ecto`
queries and add... | lib/rummage_phoenix.ex | 0.768212 | 0.692967 | rummage_phoenix.ex | starcoder |
defmodule Mix.Tasks.Ecto.Squash do
use Mix.Task
require Logger
import Mix.Generator
import Mix.Ecto
import Mix.EctoSQL
@shortdoc "Squashes several migrations into one"
@aliases [
r: :repo,
t: :to,
y: :yes
]
@switches [
to: :integer,
yes: :boolean,
repo: [:string, :keep],
... | lib/mix/tasks/ecto.squash.ex | 0.710929 | 0.451931 | ecto.squash.ex | starcoder |
defmodule SseParser do
@moduledoc """
Server sent event parser acording to w3c using NimbleParsec
ref: https://www.w3.org/TR/2009/WD-eventsource-20090421
ABNF:
```abnf
stream = [ bom ] *event
event = *( comment / field ) end-of-line
comment = colon *any-char end-of-line
... | lib/sse_parser.ex | 0.813831 | 0.570511 | sse_parser.ex | starcoder |
defmodule ExWire.Packet.Capability.Eth.Status do
@moduledoc """
Status messages establish a proper Eth Wire connection, and verify the two
clients are compatable.
```
**Status** [`+0x00`: `P`, `protocolVersion`: `P`, `networkId`: `P`,
`td`: `P`, `bestHash`: `B_32`, `genesisHash`: `B_32`]
Inf... | apps/ex_wire/lib/ex_wire/packet/capability/eth/status.ex | 0.833731 | 0.832645 | status.ex | starcoder |
defmodule VistaClient.Extractors do
@moduledoc """
Helper functions to extract and convert certain attributes from a parsed JSOM
map. For example, IDs are transmitted as strings by VISTA, so we're converting
them to integers.
## Synopsis
iex> VistaClient.Extractors.extract_id %{"ID" => "1001"}
... | lib/structs/extractors.ex | 0.804943 | 0.474936 | extractors.ex | starcoder |
defmodule Commanded.Aggregate.Multi do
@moduledoc """
Use `Commanded.Aggregate.Multi` to generate multiple events from a single
command.
This can be useful when you want to emit multiple events that depend upon the
aggregate state being updated.
## Example
In the example below, money is withdrawn from ... | lib/commanded/aggregates/multi.ex | 0.89301 | 0.607721 | multi.ex | starcoder |
defmodule Square.Locations do
@moduledoc """
Documentation for `Square.Locations`.
"""
@doc """
Provides information of all locations of a business.
Most other Connect API endpoints have a required `location_id` path parameter.
The `id` field of the `Location` map returned by this endpoint correspond to... | lib/api/locations_api.ex | 0.919967 | 0.831006 | locations_api.ex | starcoder |
defmodule Crux.Structs.Presence do
@moduledoc """
Represents a Discord [Presence Object](https://discord.com/developers/docs/topics/gateway#presence-update-presence-update-event-fields).
Differences opposed to the Discord API Object:
- `:user` is just the user id
"""
@moduledoc since: "0.1.0"
@behavio... | lib/structs/presence.ex | 0.783575 | 0.544499 | presence.ex | starcoder |
defmodule Clover.Robot do
@moduledoc """
A Robot.
"""
use GenStateMachine, callback_mode: [:handle_event_function, :state_enter]
@callback handle_connected(connection_state :: map, data :: data()) ::
{:ok, data()} | {:error, Clover.Error}
@callback init(arg :: any, data :: any) :: GenServer.o... | lib/robot/robot.ex | 0.663996 | 0.419648 | robot.ex | starcoder |
defprotocol Timber.Contextable do
@moduledoc """
Converts a data structure into a `Timber.Context.t`. This is called on any data structure passed
in the `Timber.add_context/1` function.
For example, this protocol is how we're able to support `Keyword.t` types:
```elixir
Timber.add_context(build: %{version... | lib/timber/contextable.ex | 0.920012 | 0.889241 | contextable.ex | starcoder |
defmodule Logger.Translator do
@moduledoc """
Default translation for Erlang log messages.
Logger allows developers to rewrite log messages provided by
Erlang applications into a format more compatible with Elixir
log messages by providing a translator.
A translator is simply a tuple containing a module a... | lib/logger/lib/logger/translator.ex | 0.784938 | 0.400573 | translator.ex | starcoder |
defmodule AWS.Polly do
@moduledoc """
Amazon Polly is a web service that makes it easy to synthesize speech from text.
The Amazon Polly service provides API operations for synthesizing high-quality
speech from plain text and Speech Synthesis Markup Language (SSML), along with
managing pronunciations lexicon... | lib/aws/generated/polly.ex | 0.884888 | 0.542742 | polly.ex | starcoder |
defmodule DynamicSupervisor do
@moduledoc ~S"""
A supervisor that starts children dynamically.
The `Supervisor` module was designed to handle mostly static children
that are started in the given order when the supervisor starts. A
`DynamicSupervisor` starts with no children. Instead, children are
started o... | lib/elixir/lib/dynamic_supervisor.ex | 0.879432 | 0.515925 | dynamic_supervisor.ex | starcoder |
defmodule Mix.Tasks.Phx.Gen.Context do
@shortdoc "Generates a context with functions around an Ecto schema"
@moduledoc """
Generates a context with functions around an Ecto schema.
mix phx.gen.context Accounts User users name:string age:integer
The first argument is the context module followed by the s... | assets/node_modules/phoenix/lib/mix/tasks/phx.gen.context.ex | 0.859605 | 0.503479 | phx.gen.context.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.856197 | 0.450903 | env.ex | starcoder |
defmodule Benchee.Formatters.Console do
@moduledoc """
Formatter to transform the statistics output into a structure suitable for
output through `IO.write` on the console.
"""
@behaviour Benchee.Formatter
alias Benchee.Suite
alias Benchee.Formatters.Console.{Memory, RunTime}
def format(suite), do: fo... | lib/benchee/formatters/console.ex | 0.865281 | 0.853119 | console.ex | starcoder |
defmodule AdventOfCode.Day14 do
@mask_regex ~r/^mask = ([01X]{36})$/
@mem_assignment ~r/^mem\[(\d+)\] = (\d+)$/
def convert_to_binary(num) do
default_binary = (for x <- 0..35, do: {x, 0}) |> Enum.into(%{})
{_, bin} =
num
|> :erlang.integer_to_list(2)
|> Enum.reverse()
|> Enum.redu... | lib/day14.ex | 0.530723 | 0.562207 | day14.ex | starcoder |
defmodule Mix.Tasks.Absinthe.Schema.Json do
require Logger
use Mix.Task
import Mix.Generator
@shortdoc "Generate a schema.json file for an Absinthe schema"
@default_filename "./schema.json"
@moduledoc """
Generate a schema.json file
## Usage
absinthe.schema.json [FILENAME] [OPTIONS]
The ... | lib/mix/tasks/absinthe.schema.json.ex | 0.834373 | 0.46035 | absinthe.schema.json.ex | starcoder |
defmodule Cashtrail.QueryBuilder do
@moduledoc """
This module is responsible to generate queries for contexts to filter and
search by schema fields.
"""
import Ecto.Query
@doc """
Returns a `Ecto.Query` with the queries based on the given filters and
allowed fields, or the given `Ecto.Queryable` with... | apps/cashtrail/lib/cashtrail/query_builder.ex | 0.866627 | 0.600481 | query_builder.ex | starcoder |
defmodule Bamboo.Mailer do
@moduledoc """
Functions for delivering emails using adapters and delivery strategies.
Adds `deliver_now/1` and `deliver_later/1` functions to the mailer module it
is used by.
Bamboo [ships with several adapters][available-adapters]. It is also possible
to create your own adapte... | lib/bamboo/mailer.ex | 0.727879 | 0.491761 | mailer.ex | starcoder |
defmodule AWS.Shield do
@moduledoc """
AWS Shield Advanced
This is the *AWS Shield Advanced API Reference*.
This guide is for developers who need detailed information about the AWS Shield
Advanced API actions, data types, and errors. For detailed information about AWS
WAF and AWS Shield Advanced features... | lib/aws/generated/shield.ex | 0.872768 | 0.610831 | shield.ex | starcoder |
defmodule Tournamex do
@moduledoc """
# Tournamex
Simple package for managing online tournament system.
Tournamex only has a function for generating matchlist from list.
We will add functions gradually.
"""
@doc """
Generates a matchlist.
"""
@spec generate_matchlist([integer()]) :: {:ok, [any()]} ... | tournamex/lib/tournamex.ex | 0.600657 | 0.426919 | tournamex.ex | starcoder |
defmodule ExCubicIngestion.Schema.CubicLoad do
@moduledoc """
Contains information on the objects passing through the 'incoming' S3 bucket, as well
their status while transitioning through the various steps in the data pipeline process.
"""
use Ecto.Schema
import Ecto.Query
alias Ecto.Changeset
alias ... | ex_cubic_ingestion/lib/ex_cubic_ingestion/schema/cubic_load.ex | 0.734405 | 0.452234 | cubic_load.ex | starcoder |
defmodule ExDimensions.Math do
@moduledoc """
This module contains the required macros to perform math on unit quantities.
It must be `use`d in the current scope for the math functions to work properly.
Math on standard values will still work as expected if this module is `use`d.
Using these math functions w... | lib/ex_dimensions/math.ex | 0.808861 | 0.836421 | math.ex | starcoder |
defmodule Blockchain.Transaction.Validity do
@moduledoc """
This module is responsible for transaction validation,
as defined in the Yellow Paper.
"""
alias Block.Header
alias Blockchain.{Account, Chain, Transaction}
alias MerklePatriciaTree.Trie
@doc """
Validates the validity of a transaction that... | apps/blockchain/lib/blockchain/transaction/validity.ex | 0.835484 | 0.447581 | validity.ex | starcoder |
defmodule Roger.Partition.Worker do
@moduledoc """
Handles the decoding and execution of a single job.
Besides running the job, various administrative tasks need to be
performed as well, namely:
- Check whether the job has not been cancelled in the meantime
- Check whether another job is currently runni... | lib/roger/partition/worker.ex | 0.608594 | 0.560373 | worker.ex | starcoder |
defmodule Day02.Coder do
@moduledoc """
Functions for parsing Incode programs.
"""
@doc """
Sets up the data for, executes and returns the result of the gravity assist program.
"""
def calculate_result(noun, verb) do
"./intcode.txt"
|> Aoc.get_file_list_values()
|> execute_program([{1, noun},... | day_02/lib/day02/coder.ex | 0.80038 | 0.439988 | coder.ex | starcoder |
defmodule ExVatcheck.VIESClient.XMLParser do
@moduledoc """
A module for parsing XML responses from VIES client requests into Elixir maps.
"""
@type response :: %{
country_code: binary,
vat_number: binary,
request_date: binary,
valid: boolean,
name: binary | ni... | lib/ex_vatcheck/vies_client/xml_parser.ex | 0.736306 | 0.583441 | xml_parser.ex | starcoder |
defmodule Max do
@moduledoc """
A matrix library in pure Elixir based on `:array`.
[Erlang array documentation](http://erlang.org/doc/man/array.html)
## Examples
iex> matrix = Max.new(5, 5, default: 2) # 5x5 matrix with default value 2
iex> Max.get(matrix, {0, 0})
2
iex> matrix = Max.... | lib/max.ex | 0.941088 | 0.708061 | max.ex | starcoder |
defmodule AWS.Marketplace.Metering do
@moduledoc """
AWS Marketplace Metering Service
This reference provides descriptions of the low-level AWS Marketplace
Metering Service API.
AWS Marketplace sellers can use this API to submit usage data for custom
usage dimensions.
**Submitting Metering Records**
... | lib/aws/marketplace_metering.ex | 0.753467 | 0.40642 | marketplace_metering.ex | starcoder |
defmodule BioMonitor.Routine do
use BioMonitor.Web, :model
@moduledoc """
Model used to define routines.
"""
alias BioMonitor.LogEntry
alias BioMonitor.Repo
@log_types %{reading_error: "reading_error", base_cal: "base_cal", acid_cal: "acid_cal", temp_change: "temp_change", system_error: "system_error"... | web/models/routine.ex | 0.615897 | 0.473779 | routine.ex | starcoder |
defmodule GuardGen do
@moduledoc """
GuardGen provides macro that can be used as guard test to generates
type-checks.
iex> require GuardGen
iex> GuardGen.is_valid(is_atom: :atom)
true
See `is_valid/1`
"""
alias GuardGen.CheckError
@type checklist :: keyword
@keys Application.get_e... | lib/guard_gen.ex | 0.864239 | 0.551574 | guard_gen.ex | starcoder |
defmodule Axon.Activations do
@moduledoc """
Activation functions.
Activation functions are element-wise, (typically) non-linear
functions called on the output of another layer, such as
a dense layer:
x
|> dense(weight, bias)
|> relu()
Activation functions output the "activation" or how... | lib/axon/activations.ex | 0.931634 | 0.916409 | activations.ex | starcoder |
defmodule Stripe.Plan do
@moduledoc """
Work with Stripe plan objects.
You can:
- Create a plan
- Retrieve a plan
- Update a plan
- Delete a plan
Does not yet render lists or take options.
Stripe API reference: https://stripe.com/docs/api#plan
"""
@type t :: %__MODULE__{}
defstruct [
:... | lib/stripe/plan.ex | 0.764056 | 0.498718 | plan.ex | starcoder |
defmodule Que.Persistence do
@moduledoc """
Provides a high-level API to interact with Jobs in Database
This module is a behaviour that delegates calls to the specified
adapter. It has been designed in a way that it's easy to write
custom adapters for other databases or stores like Redis, even
though there... | lib/que/persistence/persistence.ex | 0.808219 | 0.560523 | persistence.ex | starcoder |
defmodule AMQPX.SharedChannel do
@moduledoc """
A reference-counted lifetime tracker for AMQP channels.
A wrapper around channels that allows several processes to share it and
disposes of it when the last registered user exits.
## Motivation
Applications are normally encouraged to allocate as many AMQP c... | lib/amqpx/shared_channel.ex | 0.737725 | 0.452657 | shared_channel.ex | starcoder |
defmodule PasetoPlug do
@moduledoc """
Documentation for PasetoPlug.
"""
import Plug.Conn
@type paseto_key :: {binary(), binary()} | binary()
@doc """
Main entrypoint for whenever the plug is loaded. It is expected that you will
pass in a function capable of returning a binary key (for local) or keyp... | lib/paseto_plug.ex | 0.891428 | 0.472501 | paseto_plug.ex | starcoder |
defmodule FunLand.Applicative do
@doc """
A structure is Applicative if it is Appliable, as well as having the ability to create a new structure from any value, by `new`ping it.
Being able to create `new`, `apply` and `map` means that we can create new structures with some values, transform them and (partially o... | lib/fun_land/applicative.ex | 0.752195 | 0.878575 | applicative.ex | starcoder |
for {module, alg} <- [{Argon2, "Argon2"}, {Bcrypt, "Bcrypt"}, {Pbkdf2, "Pbkdf2"}] do
if Code.ensure_loaded?(module) do
mod = Module.concat(Comeonin, module)
defmodule mod do
@moduledoc """
Password hashing module using the #{alg} algorithm.
For more information about the #{alg} algorithm, s... | lib/comeonin/base.ex | 0.822011 | 0.492981 | base.ex | starcoder |
defmodule Pathex.Lenses.Any do
@moduledoc """
Private module for `any()` lens
> see `Pathex.Lenses.any/0` documentation
"""
@spec any() :: Pathex.t()
def any do
fn
:view, {%{} = map, func} ->
:maps.iterator(map)
|> :maps.next()
|> case do
:none -> :error
... | lib/pathex/lenses/any.ex | 0.898353 | 0.4016 | any.ex | starcoder |
defmodule AWS.DirectConnect do
@moduledoc """
AWS Direct Connect links your internal network to an AWS Direct Connect
location over a standard 1 gigabit or 10 gigabit Ethernet fiber-optic
cable. One end of the cable is connected to your router, the other to an
AWS Direct Connect router. With this connection ... | lib/aws/direct_connect.ex | 0.872007 | 0.54462 | direct_connect.ex | starcoder |
defmodule Topo.LineLine do
@moduledoc false
alias Topo.Util
@spec relate(list, list) :: atom
def relate(a, b) do
do_linestring_intersects_linestring(a, b)
end
@spec contains?(list, list) :: boolean
def contains?([], _), do: false
def contains?([_], _), do: false
def contains?([a1, a2 | rest], ... | lib/topo/line_line.ex | 0.724383 | 0.578984 | line_line.ex | starcoder |
defmodule Iteraptor.Array do
@moduledoc """
Array emulation implementing `Access` behaviour. Index in array is zero-based.
`Array` is the "go to" array data structure in Elixir. An array can be
constructed using `Array.new/{0,1}`:
iex> Iteraptor.Array.new()
#Array<[]>
iex> Iteraptor.Array... | lib/iteraptor/array.ex | 0.873377 | 0.694529 | array.ex | starcoder |
defmodule StepFlow.WorkflowDefinitions.WorkflowDefinition do
@moduledoc """
The WorkflowDefinition context.
"""
use Ecto.Schema
import Ecto.Changeset
require Logger
alias StepFlow.Repo
alias StepFlow.Rights.Right
alias StepFlow.WorkflowDefinitions.ExternalLoader
alias StepFlow.WorkflowDefinitions.W... | lib/step_flow/workflow_definitions/workflow_definition.ex | 0.608361 | 0.442998 | workflow_definition.ex | starcoder |
defmodule MonoRepo do
@moduledoc """
The MonoRepo library offers you a pattern of developing your applications in a
mono repository and a set of functions to do it easily.
With mono repo pattern your umbrella applications can nest other mono or umbrella
applications. The library is split in 3 modules named a... | lib/mono_repo.ex | 0.725746 | 0.725527 | mono_repo.ex | starcoder |
defmodule Day9 do
@moduledoc """
--- Day 9: Stream Processing ---
A large stream blocks your path. According to the locals, it's not safe to cross the stream at the moment because it's
full of garbage. You look down at the stream; rather than water, you discover that it's a stream of characters.
You sit for... | lib/day9.ex | 0.565899 | 0.663875 | day9.ex | starcoder |
defmodule EdExplorer.Octicons do
@moduledoc """
Octicons are a scalable set of icons handcrafted with <3 by GitHub.
This module is designed to operate identically to the [Node module][octicons-node] of the same
name.
[octicons-node]: https://www.npmjs.com/package/octicons
"""
@type t :: map
@doc fal... | lib/ed_explorer/octicons.ex | 0.83471 | 0.512144 | octicons.ex | starcoder |
defmodule Perspectives do
defmodule PointOfView do
@enforce_keys [:date, :person, :health, :slope]
defstruct [:date, :person, :health, :slope]
@type signed_byte :: -127..128
@type date :: Time.t()
@type person :: String.t()
@type range :: signed_byte()
@type t :: %__MODULE__{
date... | backend/lib/perspectives.ex | 0.752559 | 0.433082 | perspectives.ex | starcoder |
defmodule Amenities.Maps do
@moduledoc """
Map helpers
"""
alias Amenities.Funcs
alias Amenities.Monies
defdelegate atomify(map), to: Prelude.Map
defdelegate stringify(map), to: Prelude.Map
@doc """
Returns a map with nil values omitted
"""
@spec compact_if(struct() | map(), boolean()) :: map()... | lib/amenities/maps.ex | 0.873451 | 0.445771 | maps.ex | starcoder |
defmodule GenStage.Dispatcher do
@moduledoc """
This module defines the behaviour used by `:producer` and
`:producer_consumer` to dispatch events.
When using a `:producer` or `:producer_consumer`, the dispatcher
may be configured on init as follows:
{:producer, state, dispatcher: GenStage.BroadcastDis... | deps/gen_stage/lib/gen_stage/dispatcher.ex | 0.924313 | 0.638842 | dispatcher.ex | starcoder |
defmodule AWS.Shield do
@moduledoc """
Shield Advanced
This is the *Shield Advanced API Reference*.
This guide is for developers who need detailed information about the Shield
Advanced API actions, data types, and errors. For detailed information about WAF
and Shield Advanced features and an overview of ... | lib/aws/generated/shield.ex | 0.87168 | 0.547343 | shield.ex | starcoder |
defmodule AtomTweaks.Ecto.Markdown do
@moduledoc """
An `Ecto.Type` that handles the conversion between a Markdown-formatted string in the database and
a `AtomTweaks.Markdown` struct in memory.
Use this as the type of the database field in the schema:
```
defmodule AtomTweaks.Tweaks.Tweak do
use Ecto.... | lib/atom_tweaks/ecto/markdown.ex | 0.832883 | 0.832917 | markdown.ex | starcoder |
defmodule Eactivitypub.Types do
defmodule ID do
@moduledoc """
A hash of a User for ETS.
"""
@enforce_keys [:created, :nonce]
defstruct created: nil, nonce: nil
@type t :: %__MODULE__{
created: DateTime.t(),
nonce: integer()
}
@spec create :: t()
def... | lib/eactivitypub/types.ex | 0.867233 | 0.425098 | types.ex | starcoder |
defmodule Chex.Chexers do
@moduledoc """
The Chexers context.
"""
import Ecto.Query, warn: false
alias Chex.Repo
alias Chex.Chexers.SlackChex
@doc """
Returns the list of slackchex.
## Examples
iex> list_slackchex()
[%SlackChex{}, ...]
"""
def list_slackchex do
Repo.all(Slack... | apps/chex/lib/chex/chexers/chexers.ex | 0.794544 | 0.447219 | chexers.ex | starcoder |
defmodule Gateway.Bridge do
@moduledoc """
Implements the Litebridge protocol as a server.
Litebridge is a protocol running over websockets
that uses the gateway as a server and the rest
component as a client to share information between.
"""
require Logger
@behaviour :cowboy_websocket
defmodule St... | lib/bridge/websocket.ex | 0.58166 | 0.402128 | websocket.ex | starcoder |
defmodule Harnais.Runner.Suite.Map.Helper do
@moduledoc false
def runner_suite_map_new_old_tuple(v) do
{v, :new_value}
end
def runner_suite_map_value() do
42
end
def runner_suite_map_passthru(v) do
v
end
end
defmodule Harnais.Runner.Suite.Map do
@moduledoc false
require Harnais.Runner... | lib/harnais/runner/suite/map.ex | 0.549278 | 0.586523 | map.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.886107 | 0.471649 | connection.ex | starcoder |
defmodule AWS.Support do
@moduledoc """
AWS Support
The AWS Support API reference is intended for programmers who need detailed
information about the AWS Support operations and data types. This service
enables you to manage your AWS Support cases programmatically. It uses HTTP
methods that return results ... | lib/aws/support.ex | 0.875121 | 0.645085 | support.ex | starcoder |
defmodule DoomFire.FireState do
use GenServer
def update_whole_state(column, {state, row, update_function}) do
new_state = update_function.(row, column, state)
{new_state, row, update_function}
end
def update_row(row, {state, width, update_function}) do
{new_state, _, _} =
Enum.reduce(0..wid... | playground/elixir-algorithm-render-in-terminal/lib/fire_state.ex | 0.668447 | 0.459561 | fire_state.ex | starcoder |
defmodule ExImageInfo.Types.TIFF do
@moduledoc false
@behaviour ExImageInfo.Detector
# https://en.wikipedia.org/wiki/TIFF
require Bitwise
@mime "image/tiff"
@ftype_ii "TIFFII"
@ftype_mm "TIFFMM"
@signature_ii << "II", 0x2A00::size(16) >>
@signature_mm << "MM", 0x002A::size(16) >>
## Public API... | lib/ex_image_info/types/tiff.ex | 0.636579 | 0.475605 | tiff.ex | starcoder |
defmodule ScrapyCloudEx.Endpoints.Storage.Logs do
@moduledoc """
Wraps the [Logs](https://doc.scrapinghub.com/api/logs.html) endpoint.
The logs API lets you work with logs from your crawls.
"""
import ScrapyCloudEx.Endpoints.Guards
alias ScrapyCloudEx.Endpoints.Helpers
alias ScrapyCloudEx.Endpoints.Sto... | lib/endpoints/storage/logs.ex | 0.815122 | 0.691484 | logs.ex | starcoder |
defmodule AWS.WorkSpaces do
@moduledoc """
Amazon WorkSpaces Service
Amazon WorkSpaces enables you to provision virtual, cloud-based Microsoft
Windows and Amazon Linux desktops for your users.
"""
@doc """
Associates the specified connection alias with the specified directory to enable
cross-Region r... | lib/aws/generated/work_spaces.ex | 0.874279 | 0.49109 | work_spaces.ex | starcoder |
defmodule ZenMonitor.Local.Connector do
@moduledoc """
`ZenMonitor.Local.Connector` performs a variety of duties. For every remote that a the local
is interested in monitoring processes on there will be a dedicated `ZenMonitor.Local.Connector`.
This collection of Connectors are managed by a `GenRegistry` regis... | lib/zen_monitor/local/connector.ex | 0.923541 | 0.72337 | connector.ex | starcoder |
defmodule Faker.Phone.EnGb do
import Faker, only: [samplerp: 2]
@moduledoc """
This follows the rules of
[Telephone numbers in the United Kingdom](https://en.wikipedia.org/wiki/Telephone_numbers_in_the_United_Kingdom).
"""
@prefixes %{
"International dialling" => ["0"],
"Geographic numbers with ar... | lib/faker/phone/en_gb.ex | 0.550366 | 0.593786 | en_gb.ex | starcoder |
defmodule Elastic.HTTP do
@moduledoc ~S"""
Used to make raw calls to Elastic Search.
Each function returns a tuple indicating whether or not the request
succeeded or failed (`:ok` or `:error`), the status code of the response,
and then the processed body of the response.
For example, a request like this:
... | lib/elastic/http.ex | 0.901554 | 0.801392 | http.ex | starcoder |
defmodule Kitto.Notifier do
@moduledoc """
Module responsible for broadcasting events across connections.
"""
use Supervisor
import Agent, only: [start_link: 2, update: 2, get: 2]
@doc """
Starts the notifier supervision tree
"""
def start_link, do: Supervisor.start_link(__MODULE__, :ok, name: :not... | lib/kitto/notifier.ex | 0.808521 | 0.487978 | notifier.ex | starcoder |
defmodule PaEss.Utilities do
@moduledoc """
Some simple helpers for working with the PA/ESS system
"""
require Logger
@space "21000"
@abbreviation_replacements [
{~r"\bOL\b", "Orange Line"},
{~r"\bBL\b", "Blue Line"},
{~r"\bRL\b", "Red Line"},
{~r"\bGL\b", "Green Line"},
{~r"\bNB\b", ... | lib/pa_ess/utilities.ex | 0.57069 | 0.509093 | utilities.ex | starcoder |
defmodule Crony.DualMap do
use Brex.Result
alias __MODULE__
@compile {:inline, deassociated_right_for: 2, deassociated_left_for: 2}
defstruct left: %{},
right: %{}
@type t(left, right, val) :: %DualMap{
left: %{required(left) => {val, right}},
right: %{required(right) => {v... | lib/crony/dual_map.ex | 0.724675 | 0.601359 | dual_map.ex | starcoder |
defmodule Zaryn.OracleChain do
@moduledoc """
Manage network based oracle to verify, add new oracle transaction in the system and request last udpate.any()
ZARYN Price is the first network Oracle and it's used for many algorithms such as: transaction fee, node rewards, smart contracts
"""
alias __MODULE__.M... | lib/zaryn/oracle_chain.ex | 0.807233 | 0.483405 | oracle_chain.ex | starcoder |
defmodule Estructura do
@moduledoc ~S"""
`Estructura` is a set of extensions for Elixir structures,
such as `Access` implementation, `Enumerable` and `Collectable`
implementations, validations and test data generation via `StreamData`.
`Estructura` simplifies the following
* `Access` implementation ... | lib/estructura.ex | 0.930142 | 0.920576 | estructura.ex | starcoder |
defmodule Cat.Either do
@moduledoc """
Either `left` or `right`.
Implements protocols:
* `Functor`
* `Applicative`
* `Monad`
"""
alias Cat.Maybe
defmodule Left do
@enforce_keys [:v]
defstruct [:v]
end
defmodule Right do
@enforce_keys [:v]
defstruct [:v]
end
@type lef... | lib/cat/data/either.ex | 0.881066 | 0.599602 | either.ex | starcoder |
defmodule ContentSecurityPolicy do
@moduledoc """
Provides functions for interacting with Content Security Policies.
A Content Security Policy is a header which determines which assets the
browser is allowed to retrieve.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP for more in depth
documenta... | lib/content_security_policy.ex | 0.92427 | 0.414188 | content_security_policy.ex | starcoder |
defmodule Regex do
@moduledoc ~S"""
Regular expressions for Elixir built on top of Erlang's `re` module.
As the `re` module, Regex is based on PCRE
(Perl Compatible Regular Expressions). More information can be
found in the [`re` documentation](http://www.erlang.org/doc/man/re.html).
Regular expressions i... | lib/elixir/lib/regex.ex | 0.92792 | 0.766206 | regex.ex | starcoder |
defmodule Opencensus.Plug.Trace do
@moduledoc """
Template method for creating `Plug` to trace your `Plug` requests.
## Usage
1. Create your own `Plug` module:
```elixir
defmodule MyApp.TracingPlug do
use Opencensus.Plug.Trace
end
```
2. Add it to your pipeline, ex. for Phoenix:
... | lib/opencensus/plug/trace.ex | 0.807271 | 0.810854 | trace.ex | starcoder |
defmodule RDF.XSD.Datatype.Test.Case do
use ExUnit.CaseTemplate
alias RDF.XSD
using(opts) do
datatype = Keyword.fetch!(opts, :datatype)
datatype_name = Keyword.fetch!(opts, :name)
datatype_iri =
Keyword.get(opts, :iri, RDF.NS.XSD.__base_iri__ <> datatype_name)
valid = Keyword.get(opts, :... | test/support/xsd_datatype_case.ex | 0.7586 | 0.721204 | xsd_datatype_case.ex | starcoder |
defmodule MapSets do
use Koans
@intro "My name is Set, MapSet."
@set MapSet.new([1, 2, 3, 4, 5])
koan "I am very similar to a list" do
assert Enum.fetch(@set, 0) == {:ok, 1}
end
koan "However, I do not allow duplication" do
new_set = MapSet.new([1, 1, 2, 3, 3, 3])
assert MapSet.size(new_set... | lib/koans/09_map_sets.ex | 0.79538 | 0.489748 | 09_map_sets.ex | starcoder |
defmodule Cadet.Test.Seeds do
@moduledoc """
This module contains functions that seed more complex setups into the DB for tests.
"""
import Cadet.Factory
@doc """
This sets up the common assessments environment by inserting relevant entries into the DB.
Returns a map of the following format:
%{
acc... | test/support/seeds.ex | 0.717507 | 0.465873 | seeds.ex | starcoder |
defmodule DawdleDB.Handler do
@moduledoc """
Defines a handler for database events on a single table.
To define an event handler, `use DawdleDB.Handler` and provide a Ecto schema
type that you wish to handle. Then, override the callbacks
`c:handle_insert/1`, `c:handle_update/2`, `c:handle_delete/1`,
as app... | lib/dawdle_db/handler.ex | 0.848109 | 0.590691 | handler.ex | starcoder |
defmodule ElhexDelivery.PostalCode.Navigator do
use GenServer
alias ElhexDelivery.PostalCode.{Cache, Store}
alias :math, as: Math
#@radius 6371 #km
@radius 3959
def init(init_arg) do
{:ok, init_arg}
end
def start_link do
GenServer.start_link(__MODULE__, [], name: :postal_code_navigator)
en... | lib/postal_code/navigator.ex | 0.755186 | 0.482368 | navigator.ex | starcoder |
defmodule Spear.ExpectationViolation do
@moduledoc """
A structure representing how an append request's expectations were violated
## Expectations
A client may exert expectations on write requests which will fail the request
if violated. Any of these values may be passed to the `:expect` option of
`Spear.... | lib/spear/expectation_violation.ex | 0.868548 | 0.683155 | expectation_violation.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule Guardian.Plug do
@moduledoc """
Provides functions for the implementation module for dealing with
Guardian in a Plug environment
```elixir
defmodule MyApp.Tokens do
use Guardian, otp_app: :my_app
# ... snip
end
```
Your implement... | lib/guardian/plug.ex | 0.733356 | 0.796372 | plug.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.