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 Cldr.DateTime do
@moduledoc """
Provides an API for the localization and formatting of a `DateTime`
struct or any map with the keys `:year`, `:month`,
`:day`, `:calendar`, `:hour`, `:minute`, `:second` and optionally `:microsecond`.
`Cldr.DateTime` provides support for the built-in calendar
`Cale... | lib/cldr/datetime/datetime.ex | 0.936894 | 0.748812 | datetime.ex | starcoder |
if Code.ensure_loaded?(Phoenix) do
defmodule Versioning.View do
@moduledoc """
A set of functions used with `Phoenix` views.
Typically, this module should be imported into your view modules. In a normal
phoenix application, this can usually be done with the following:
defmodule YourAppWeb do... | lib/versioning/view.ex | 0.823754 | 0.617959 | view.ex | starcoder |
defmodule Game.Grid do
@moduledoc false
alias __MODULE__
alias Game.{Cell, Coordinate, Tile}
@enforce_keys [:cells, :columns, :rows, :tiles]
@columns 1..4
@rows 1..4
@vectors %{
up: %{x: 0, y: -1},
down: %{x: 0, y: 1},
left: %{x: -1, y: 0},
right: %{x: 1, y: 0}
}
defstruct [:cells, ... | lib/game/grid.ex | 0.804252 | 0.703014 | grid.ex | starcoder |
defmodule ExWire.Packet.Capability.Par.SnapshotManifest do
@moduledoc """
Respond to a GetSnapshotManifest message with either an empty RLP list or a
1-item RLP list containing a snapshot manifest
```
`SnapshotManifest` [`0x12`, `manifest` or nothing]
```
"""
import Exth, only: [maybe_decode_unsigned: ... | apps/ex_wire/lib/ex_wire/packet/capability/par/snapshot_manifest.ex | 0.815233 | 0.755005 | snapshot_manifest.ex | starcoder |
defmodule BitcrowdEcto.Assertions do
@moduledoc """
Useful little test assertions related to `t:Ecto.Changeset.t/0`.
## Example
Import this in your `ExUnit.CaseTemplate`:
defmodule MyApp.TestCase do
use ExUnit.CaseTemplate
using do
quote do
import Ecto
... | lib/bitcrowd_ecto/assertions.ex | 0.962267 | 0.521837 | assertions.ex | starcoder |
defmodule Adventofcode.Day16TicketTranslation do
use Adventofcode
alias __MODULE__.{Parser, Part1, Part2}
def part_1(input) do
input
|> Parser.parse()
|> Part1.solve()
end
def part_2(input) do
input
|> Parser.parse()
|> Part2.solve()
end
defmodule Part1 do
def solve([rules,... | lib/day_16_ticket_translation.ex | 0.577376 | 0.40645 | day_16_ticket_translation.ex | starcoder |
defmodule FeatureToggler do
import Kernel
@moduledoc """
Provides function to set/unset and check if a feature is set/unset for a user id
"""
@doc """
## Parameters
- client : client to connect to redis
- feature : String that represents the name of the feature
- user_id : Integer that represen... | lib/feature_toggler.ex | 0.802633 | 0.418192 | feature_toggler.ex | starcoder |
defmodule ExIntegrate.Core.Run do
@moduledoc """
A `Run` represents an entire CI orchestrated workflow, from start to finish.
A Run consists of many `Pipeline`s, which it runs in parallel except when they
depend on each other. Internally, the pipelines are stored in a directed
acyclic graph (DAG), and this g... | lib/ex_integrate/core/run.ex | 0.856137 | 0.60612 | run.ex | starcoder |
defmodule PowPersistentSession.Plug.Cookie do
@moduledoc """
This plug will handle persistent user sessions with cookies.
By default, the cookie will expire after 30 days. The cookie expiration will
be renewed on every request where a user is assigned to the conn. The token
in the cookie can only be used onc... | lib/extensions/persistent_session/plug/cookie.ex | 0.828523 | 0.474692 | cookie.ex | starcoder |
defmodule Dutu.GeneralFixtures do
@moduledoc """
This module defines test helpers for creating
entities via the `Dutu.General` context.
"""
import Timex,
only: [shift: 2, end_of_week: 1, end_of_month: 1, end_of_quarter: 1, end_of_year: 1]
import Dutu.DateHelpers
use Dutu.DateHelpers
@doc """
Gen... | test/support/fixtures/general_fixtures.ex | 0.623148 | 0.438004 | general_fixtures.ex | starcoder |
require Utils
defmodule D6 do
@moduledoc """
--- Day 6: Universal Orbit Map ---
You've landed at the Universal Orbit Map facility on Mercury. Because navigation in space often involves transferring between orbits, the orbit maps here are useful for finding efficient routes between, for example, you and Santa. Yo... | lib/days/06.ex | 0.824073 | 0.783119 | 06.ex | starcoder |
defmodule Plug.Session do
@moduledoc """
A plug to handle session cookies and session stores.
The session is accessed via functions on `Plug.Conn`. Cookies and
session have to be fetched with `Plug.Conn.fetch_session/1` before the
session can be accessed.
Consider using `Plug.CSRFProtection` when using `P... | lib/plug/session.ex | 0.795579 | 0.526038 | session.ex | starcoder |
defmodule Triton.Validate do
def coerce(query) do
with {:ok, query} <- validate(query) do
fields = query[:__schema__].__fields__
{:ok, Enum.map(query, fn x -> coerce(x, fields) end)}
end
end
def validate(query) do
case Triton.Helper.query_type(query) do
{:error, err} -> {:error, err... | lib/triton/validate.ex | 0.539954 | 0.442456 | validate.ex | starcoder |
defmodule Plug.RewriteOn do
@moduledoc """
A plug to rewrite the request's host/port/protocol from `x-forwarded-*` headers.
If your Plug application is behind a proxy that handles HTTPS, you may
need to tell Plug to parse the proper protocol from the `x-forwarded-*`
header.
plug Plug.RewriteOn, [:x_fo... | lib/plug/rewrite_on.ex | 0.833968 | 0.586434 | rewrite_on.ex | starcoder |
defmodule CalendarInterval do
@moduledoc """
Functions for working with calendar intervals.
"""
defstruct [:first, :last, :precision]
@type t() :: %CalendarInterval{
first: NaiveDateTime.t(),
last: NaiveDateTime.t(),
precision: precision()
}
@type precision() :: :yea... | lib/calendar_interval.ex | 0.923061 | 0.652241 | calendar_interval.ex | starcoder |
defmodule AWS.Synthetics do
@moduledoc """
Amazon CloudWatch Synthetics
You can use Amazon CloudWatch Synthetics to continually monitor your services.
You can create and manage *canaries*, which are modular, lightweight scripts
that monitor your endpoints and APIs from the outside-in. You can set up your
... | lib/aws/generated/synthetics.ex | 0.784154 | 0.475057 | synthetics.ex | starcoder |
defmodule Clickhousex.Codec.RowBinary do
alias Clickhousex.{Codec, Codec.Binary}
@behaviour Codec
@impl Codec
def response_format(), do: "RowBinaryWithNamesAndTypes"
@impl Codec
def request_format(), do: "Values"
@impl Codec
def encode(query, replacements, params) do
Clickhousex.Codec.Values.enc... | lib/clickhousex/codec/row_binary.ex | 0.612426 | 0.462352 | row_binary.ex | starcoder |
defmodule Nebulex.Cache do
@moduledoc ~S"""
Cache's main interface; defines the cache abstraction layer which is
highly inspired by [Ecto](https://github.com/elixir-ecto/ecto).
A Cache maps to an underlying implementation, controlled by the
adapter. For example, Nebulex ships with a default adapter that
im... | lib/nebulex/cache.ex | 0.932661 | 0.661977 | cache.ex | starcoder |
defmodule ChartsLive.StackedBarView do
@moduledoc """
View functions for rendering Stacked Bar charts
"""
use ChartsLive.ChartBehavior
alias Charts.Gradient
alias Charts.StackedColumnChart.Rectangle
def viewbox_height(rectangles) do
length(rectangles) * 12 + 170
end
@doc """
The function use... | lib/charts_live/views/stacked_bar_view.ex | 0.572364 | 0.417657 | stacked_bar_view.ex | starcoder |
defmodule Plug.SSL do
@moduledoc """
A plug to force SSL connections and enable HSTS.
If the scheme of a request is `https`, it'll add a `strict-transport-security`
header to enable HTTP Strict Transport Security by default.
Otherwise, the request will be redirected to a corresponding location
with the `h... | lib/plug/ssl.ex | 0.913184 | 0.722943 | ssl.ex | starcoder |
defmodule Temple.Html do
require Temple.Elements
@moduledoc """
The `Temple.Html` module defines macros for all HTML5 compliant elements.
`Temple.Html` macros must be called inside of a `Temple.temple/1` block.
*Note*: Only the lowest arity macros are documented. Void elements are defined as a 1-arity macr... | lib/temple/html.ex | 0.876324 | 0.698137 | html.ex | starcoder |
defmodule RDF.XSD.Time do
@moduledoc """
`RDF.XSD.Datatype` for XSD times.
Options:
- `tz`: this allows to specify a timezone which is not supported by Elixir's `Time` struct; note,
that it will also overwrite an eventually already present timezone in an input lexical
"""
@type valid_value :: Time.t(... | lib/rdf/xsd/datatypes/time.ex | 0.628065 | 0.548371 | time.ex | starcoder |
defmodule Membrane.H264.FFmpeg.Parser do
@moduledoc """
Membrane element providing parser for H264 encoded video stream.
Uses the parser provided by FFmpeg.
By default, this parser splits the stream into h264 access units,
each of which is a sequence of NAL units corresponding to one
video frame, and equip... | lib/membrane_h264_ffmpeg/parser.ex | 0.875341 | 0.50293 | parser.ex | starcoder |
defmodule Cldr.Calendar.Julian do
@behaviour Calendar
@behaviour Cldr.Calendar
@type year :: -9999..-1 | 1..9999
@type month :: 1..12
@type day :: 1..31
@quarters_in_year 4
@months_in_year 12
@months_in_quarter 3
@days_in_week 7
@doc """
Defines the CLDR calendar type for this calendar.
This... | lib/cldr/calendar/calendars/julian.ex | 0.911798 | 0.634034 | julian.ex | starcoder |
defmodule Dotzip.ExtraField.Unix do
@moduledoc """
This module encode and decode Unix extra field defined in section
4.5.7 of the official documentation.
"""
defstruct atime: 0, mtime: 0, uid: 0, gid: 0, var: 0
defp tag() do
<<0x00, 0x0d>>
end
defp encode_tag({:ok, data, buffer}) do
... | lib/dotzip/extra_field/unix.ex | 0.629775 | 0.635717 | unix.ex | starcoder |
defmodule EQRCode.SVG do
@moduledoc """
Render the QR Code matrix in SVG format
```elixir
qr_code_content
|> EQRCode.encode()
|> EQRCode.svg(color: "#cc6600", shape: "circle", width: 300)
```
You can specify the following attributes of the QR code:
* `background_color`: In hexadecimal format or `:t... | lib/eqrcode/svg.ex | 0.863334 | 0.875148 | svg.ex | starcoder |
defmodule Krill.Parser do
@moduledoc """
Deals with anything related to Porcelain.Process and Results
"""
require Logger
import Krill, only: [empty?: 1]
@typedoc "Standard line"
@type std_line :: {pos_integer, String.t}
@typedoc "Rules can be a string, a regular expresion or a function that returns... | lib/krill/parser.ex | 0.760117 | 0.649843 | parser.ex | starcoder |
defmodule ExAws.GameLift do
@moduledoc """
Operations on the AWS GameLift service.
http://docs.aws.amazon.com/LINK_MUST_BE_HERE
"""
alias ExAws.GameLift.Encodable
alias ExAws.GameLift.Player
import ExAws.Utils, only: [camelize_keys: 1]
@namespace "GameLift"
defp request(action, data) do
opera... | lib/ex_aws/gamelift.ex | 0.724481 | 0.433262 | gamelift.ex | starcoder |
defmodule AWS.Machinelearning do
@moduledoc """
Definition of the public APIs exposed by Amazon Machine Learning
"""
@doc """
Adds one or more tags to an object, up to a limit of 10.
Each tag consists of a key and an optional value. If you add a tag using a key
that is already associated with the ML ob... | lib/aws/generated/machinelearning.ex | 0.918574 | 0.883688 | machinelearning.ex | starcoder |
defmodule ExSDP.Origin do
@moduledoc """
This module represents the Origin field of SDP that represents the originator of the session.
If the username is set to `-` the originating host does not support the concept of user IDs.
The username MUST NOT contain spaces.
For more details please see [RFC4566 Sect... | lib/ex_sdp/origin.ex | 0.824179 | 0.519338 | origin.ex | starcoder |
defmodule Kino.VegaLite do
@moduledoc """
A kino wrapping [VegaLite](https://hexdocs.pm/vega_lite) graphic.
This kino allow for rendering regular VegaLite graphic and then
streaming new data points to update the graphic.
## Examples
chart =
Vl.new(width: 400, height: 400)
|> Vl.mark(:... | lib/kino/vega_lite.ex | 0.900832 | 0.651202 | vega_lite.ex | starcoder |
defmodule Mix.Tasks.Sbom.Cyclonedx do
@shortdoc "Generates CycloneDX SBoM"
use Mix.Task
import Mix.Generator
@default_path "bom.xml"
@moduledoc """
Generates a Software Bill-of-Materials (SBoM) in CycloneDX format.
## Options
* `--output` (`-o`): the full path to the SBoM output file (default:
... | lib/mix/tasks/sbom.cyclonedx.ex | 0.755457 | 0.425993 | sbom.cyclonedx.ex | starcoder |
defmodule Day24 do
def part1(input) do
{start_pos, goals, grid} = parse(input)
find_single_solution({start_pos, goals}, grid)
end
def part2(input) do
{start_pos, goals, grid} = parse(input)
find_all_solutions({start_pos, goals}, grid)
|> Enum.map(fn {moves0, position} ->
goals = MapSet.... | day24/lib/day24.ex | 0.633637 | 0.681223 | day24.ex | starcoder |
defmodule Ptolemy.Engines.KV.Engine do
@moduledoc """
`Ptolemy.Engines.KV` provides interaction with a Vault server's Key Value V2 secret egnine.
"""
require Logger
@doc """
Reads a secret from a remote vault server using Vault's KV engine.
"""
@spec read_secret(Tesla.Client.t(), String.t(), [version:... | lib/engines/kv/kv_engine.ex | 0.84781 | 0.414306 | kv_engine.ex | starcoder |
defmodule Membrane.Pipeline.Spec do
@moduledoc """
Structure representing topology of a pipeline. It can be returned from
`Membrane.Pipeline.handle_init/1` callback upon pipeline's initialization.
It will define a topology of children and links that build the pipeline.
## Children
Children that should be ... | lib/membrane/pipeline/spec.ex | 0.892858 | 0.658273 | spec.ex | starcoder |
defmodule EQC.StateM do
@moduledoc """
This module contains macros to be used with [Quviq
QuickCheck](http://www.quviq.com). It defines Elixir versions of Erlang
functions found in `eqc/include/eqc_statem.hrl`. For detailed documentation of the
functions, please refer to the QuickCheck documentation.
`Copy... | lib/eqc/statem.ex | 0.784897 | 0.549822 | statem.ex | starcoder |
defmodule NashvilleZoneLookup.Zoning.Zone do
@moduledoc ~S"""
A `NashvilleZoneLookup.Domain.Zone` defines and limits acceptable land use for
property within the district.
Each Zone is assigned an alphanumeric
`:code` that is unique. A Zone is often referred to as simply a "zone".
While Zones are somewhat ... | lib/nashville_zone_lookup/zoning/zone.ex | 0.737253 | 0.482612 | zone.ex | starcoder |
defmodule AWS.ApplicationDiscovery do
@moduledoc """
AWS Application Discovery Service
AWS Application Discovery Service helps you plan application migration projects.
It automatically identifies servers, virtual machines (VMs), and network
dependencies in your on-premises data centers. For more informatio... | lib/aws/generated/application_discovery.ex | 0.888027 | 0.571886 | application_discovery.ex | starcoder |
defmodule Shoehorn.Handler do
@moduledoc """
A behaviour module for implementing handling of failing applications
A Shoehorn.Handler is a module that knows how to respond to specific
applications going down. There are two types of failing applications.
The first is an application that fails to initialize and... | lib/shoehorn/handler.ex | 0.868924 | 0.614972 | handler.ex | starcoder |
defmodule Cards do
@moduledoc """
Provides methods for creating and handling a deck of Cards.
"""
@doc """
You should ignore this as it has nothing to do with the project, but rather
the result of failure to resist the urge to delete it.
"""
def hello do
"<NAME>"
end
@doc """
Please i... | lib/cards.ex | 0.593963 | 0.555797 | cards.ex | starcoder |
defmodule EVM.Gas do
@moduledoc """
Functions for interacting wth gas and costs of opscodes.
"""
alias EVM.{
Address,
Configuration,
ExecEnv,
Helpers,
MachineCode,
MachineState,
Operation
}
@type t :: EVM.val()
@type gas_price :: EVM.Wei.t()
# Nothing paid for operations o... | apps/evm/lib/evm/gas.ex | 0.819605 | 0.483283 | gas.ex | starcoder |
defmodule Bitcoin.Base58Check do
@moduledoc """
Base58Check encoding.
Base58Check is used in Bitcoin addresses and WIF.
It's a Base58 where additional 4 checksum bytes are appended to the payload
before encoding (and stripped and checked when decoding).
Checksum is first 4 bytes from the double sha256 of... | lib/bitcoin/base58_check.ex | 0.859561 | 0.420838 | base58_check.ex | starcoder |
defmodule Parsey do
@moduledoc """
A library to setup basic parsing requirements for non-complex nested
inputs.
Parsing behaviours are defined using rulesets, these sets take the format
of <code class="inline">[<a href="#t:rule/0">rule</a>]</code>. Rulesets are
matched against in the ... | lib/parsey.ex | 0.845544 | 0.680174 | parsey.ex | starcoder |
defmodule Day9 do
def run(lines) do
with input = parse_input(lines),
[p1] = part1(input),
p2 = part2(p1, input) do
"part1: #{p1} part2: #{p2}"
end
end
def part1({preamble_size, input}) do
for index <- preamble_size..(Kernel.map_size(input) - 1),
low_index = index - p... | elixir_advent/lib/day9.ex | 0.555435 | 0.66741 | day9.ex | starcoder |
defmodule Legion.Identity.Information.PersonalData do
@moduledoc """
Represents personal information of the user.
## Schema fields
- `:given_name`: A name given to a individual to differentiate them from members of such group or family. May be referred as "family name" or "forename".
- `:middle_name`: A nam... | apps/legion/lib/identity/information/personal_data.ex | 0.816918 | 0.475179 | personal_data.ex | starcoder |
defmodule Snek.Board.Point do
@moduledoc """
A struct for representing points on a board's grid.
"""
@moduledoc since: "0.1.0"
@typedoc """
A point on a board.
May be relative or absolute.
"""
@typedoc since: "0.1.0"
@type t :: {x, y}
@typedoc """
A point's X coordinate.
Smaller values are... | lib/snek/board/point.ex | 0.939262 | 0.789964 | point.ex | starcoder |
defprotocol Eml.Encoder do
@moduledoc """
The Eml Encoder protocol.
This protocol is used by Eml's compiler to convert different Elixir
data types to it's `Eml.Compiler.chunk` type.
Chunks can be of the type `String.t`, `{ :safe, String.t }`,
`Eml.Element.t`, or `Macro.t`, so any implementation of the
`... | lib/eml/encoder.ex | 0.825449 | 0.495545 | encoder.ex | starcoder |
defmodule Affine.Transforms do
@moduledoc """
This module defines all the basic transforms. These include translate, scale, and rotation for 1, 2 or 3 dimensions.
The transform library can be accessed at it's lowest level giving the best
performance and full control to the developer. An example of using the AP... | lib/affine/transforms.ex | 0.876317 | 0.859015 | transforms.ex | starcoder |
defmodule Furlong.Symbolics do
@moduledoc """
Functions for constructing constraints.
```
x = make_ref()
y = make_ref()
constraint = lte(add(x, 2), add(multiply(y, 5), 10)) # x + 2 <= 5 * y + 10
```
"""
@doc """
Multiplies a variable / term / expression with a constant.
"""
def multiply(var,... | lib/furlong/symbolics.ex | 0.871639 | 0.840423 | symbolics.ex | starcoder |
defmodule AWS.ResourceGroupsTaggingAPI do
@moduledoc """
Resource Groups Tagging API
This guide describes the API operations for the resource groups tagging.
A tag is a label that you assign to an AWS resource. A tag consists of a key and
a value, both of which you define. For example, if you have two Amaz... | lib/aws/generated/resource_groups_tagging_api.ex | 0.872768 | 0.621081 | resource_groups_tagging_api.ex | starcoder |
defmodule Day10 do
@moduledoc """
AoC 2019, Day 10 - Monitoring Station
"""
defmodule SpaceMap do
defstruct text: "", asteroids: %{}, rows: 1, cols: 1
def print(map), do: IO.puts "#{map.text}"
def print_neighbors(map) do
for c <- 0..map.cols-1 do
for r <- 0..map.rows-1 do
... | apps/day10/lib/day10.ex | 0.800341 | 0.536738 | day10.ex | starcoder |
defmodule ExPixBRCode.Payments.Models.DynamicImmediatePixPayment do
@moduledoc """
A dynamic immediate Pix payment.
This payment structure is the result of loading it from a Pix endpoint.
"""
use ExPixBRCode.ValueObject
alias ExPixBRCode.Changesets
@required [:revisao, :chave, :txid, :status]
@optio... | lib/ex_pix_brcode/payments/models/dynamic_immediate_pix_payment.ex | 0.708011 | 0.424949 | dynamic_immediate_pix_payment.ex | starcoder |
defmodule AzureFunctionsBase.Logger do
@moduledoc """
A logger for Azure Functions.
## Levels
The supported levels, ordered by precedence, are:
- `:debug` - for debug-related messages
- `:info` - for information of any kind
- `:warn` - for warnings
- `:error` - for errors
For example, `:info` takes p... | lib/azure_functions_base/logger.ex | 0.832169 | 0.455744 | logger.ex | starcoder |
defmodule TextDelta.Delta do
# Deprecated and to be removed in 2.0
@moduledoc false
alias TextDelta.Delta.{Transformation, Composition}
@doc false
def new(ops \\ []) do
ops
|> TextDelta.new()
|> unwrap()
end
@doc false
def insert(delta, el, attrs \\ %{}) do
delta
|> wrap()
|>... | lib/text_delta/backwards_compatibility_with_1.0.ex | 0.587825 | 0.486819 | backwards_compatibility_with_1.0.ex | starcoder |
defmodule ReadDoc.StateMachine do
use ReadDoc.Types
alias ReadDoc.Options
alias ReadDoc.Message
alias ReadDoc.StateMachine.Result
alias ReadDoc.StateMachine.State
import ReadDoc.DocExtractor, only: [extract_doc: 1]
@type result_t() :: Result.result_tuple()
@spec run!(list(String.t()), Options.t(), ... | lib/read_doc/state_machine.ex | 0.705278 | 0.532547 | state_machine.ex | starcoder |
defmodule Base62 do
use CustomBase, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
@moduledoc """
This module provides data encoding and decoding functions for base62 alphabet:
| Value | Encoding | Value | Encoding | Value | Encoding | Value | Encoding |
|------:|---------:|------:|-------... | lib/base62.ex | 0.819857 | 0.510802 | base62.ex | starcoder |
defmodule CCSP.Chapter4.Dijkstra do
alias __MODULE__, as: T
alias CCSP.Chapter4.DijkstraNode
alias CCSP.Chapter4.WeightedGraph
alias CCSP.Chapter4.WeightedEdge
alias CCSP.Chapter2.PriorityQueue
@moduledoc """
Corresponds to CCSP in Python, Chapter 4, titled "Graph Problems"
"""
@type a :: any
@typ... | lib/ccsp/chapter4/dijkstra.ex | 0.75037 | 0.602237 | dijkstra.ex | starcoder |
defmodule Wallaby.Element do
@moduledoc """
Defines an Element Struct and interactions with Elements.
Typically these functions are used in conjunction with a `find`:
```
page
|> find(Query.css(".some-element"), fn(element) -> Element.click(element) end)
```
These functions can be used to create new ... | lib/wallaby/element.ex | 0.807157 | 0.93784 | element.ex | starcoder |
defmodule Meeseeks.Context do
@moduledoc """
Context is available to both Meeseek's selection process and each
individual selector, and allows for selectors to build state (or receive
state from the selection mechanism).
The selection process expects an `accumulator`, `return?` boolean, and
`matches` map t... | lib/meeseeks/context.ex | 0.86034 | 0.70458 | context.ex | starcoder |
defmodule RedixPool.Config do
@moduledoc """
## Example Pool Configurations
```
# All pools listed in start_pools will be automatically
# started upon application start. Pools not started here
# can be started by adding RedixPool.redix_pool_spec(pool: pool_name)
# into a supervision tree.
config :redix... | lib/redix_pool/config.ex | 0.575588 | 0.491883 | config.ex | starcoder |
defmodule Dictionary.Type.Timestamp do
@moduledoc """
Timestamp type in ISO8601 format.
Timestamp format must be supplied for conversion to ISO8601. `nil` values will
be converted to empty strings regardless of specified string format. Empty
string values are supported as well.
See [Timex](https://hexdocs... | apps/definition_dictionary/lib/dictionary/type/timestamp.ex | 0.892723 | 0.599485 | timestamp.ex | starcoder |
defmodule Blockchain do
@moduledoc """
The blockchain
"""
alias Blockchain.Block
alias Blockchain.Extensions.SmartContracts
alias Blockchain.Hash
alias Blockchain.Transaction
alias Blockchain.TransactionIO
alias Blockchain.Wallet
@enforce_keys [:blocks, :utxo]
defstruct @enforce_keys
@typedoc... | lib/blockchain.ex | 0.839652 | 0.527621 | blockchain.ex | starcoder |
defmodule Litmus.Type.Boolean do
@moduledoc """
This type validates and converts values to booleans. It converts truthy and
falsy values to `true` or `false`.
## Options
* `:default` - Setting `:default` will populate a field with the provided
value, assuming that it is not present already. If a fie... | lib/litmus/type/boolean.ex | 0.913982 | 0.675052 | boolean.ex | starcoder |
defmodule AWS.STS do
@moduledoc """
AWS Security Token Service
The AWS Security Token Service (STS) is a web service that enables you to
request temporary, limited-privilege credentials for AWS Identity and
Access Management (IAM) users or for users that you authenticate (federated
users). This guide prov... | lib/aws/sts.ex | 0.825203 | 0.471832 | sts.ex | starcoder |
defmodule Pokerap.Url do
@moduledoc """
Holds utility functions to actually make HTTP calls
"""
alias Pokerap.Env, as: Env
#Builds option array (currently only timeouts) for HTTPoison
defp get_options() do
[timeout: Env.timeout, recv_timeout: Env.recv_timeout]
end
@doc """
Makes call to Httpois... | lib/Pokerap/Url.ex | 0.78842 | 0.505188 | Url.ex | starcoder |
defmodule Alembic.PluginManager do
@moduledoc """
Manages the list of currently enabled plugins, issuing callbacks to each
plugin's main callback module in response to client-issued requests and
mediating interactions between plugins with potentially conflicting spheres
of responsibility.
"""
use ExActor... | lib/plugin_sup.ex | 0.679498 | 0.512998 | plugin_sup.ex | starcoder |
defmodule ExDoc.Formatter.EPUB.Templates do
@moduledoc """
Handle all template interfaces for the EPUB formatter.
"""
require EEx
alias ExDoc.Formatter.HTML.Templates, as: H
@doc """
Generate content from the module template for a given `node`
"""
def module_page(config, node) do
types = H.group... | deps/ex_doc/lib/ex_doc/formatter/epub/templates.ex | 0.67694 | 0.439507 | templates.ex | starcoder |
defmodule Harald.HCI.Commands.ControllerAndBaseband.SetEventMask do
@moduledoc """
Reference: version 5.2, Vol 4, Part E, 7.3.1.
"""
alias Harald.{HCI, HCI.Commands.Command}
@type t() :: %{
event_mask: %{
inquiry_complete_event: HCI.flag(),
inquiry_result_event: HCI.flag(),... | src/lib/harald/hci/commands/controller_and_baseband/set_event_mask.ex | 0.565539 | 0.454533 | set_event_mask.ex | starcoder |
defmodule Mechanize.Form do
@moduledoc """
Encapsulates all functionalities related to form handling and submission.
You can fetch a form from a page using `Mechanize.Page` module:
```
form = Page.form_with(page, name: "login")
```
"""
alias Mechanize.Page.Element
alias Mechanize.Form.{
TextInp... | lib/mechanize/form.ex | 0.930655 | 0.909184 | form.ex | starcoder |
defmodule Day10 do
@challange_input "lib/input.txt"
alias Day10.{
Parser,
ParseResult,
Node,
Node.Configuration,
Node.Supervisor
}
def solve do
parsed = Parser.parse(read_input())
# extract & spawn the output nodes
outputs = extract_outputs(parsed)
Supervisor.spawn_nodes(:... | advent-of-code-2016/day_10/lib/day10.ex | 0.649245 | 0.555616 | day10.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule Shapt.Plug do
@moduledoc """
This plug provides two endpoints:
- GET that will that will return the current value of your toggles on runtime.
- POST that will reload the current value of your toggles on runtime.
```
plug Shapt.Plug,
path: "/toggl... | lib/shapt/plug.ex | 0.679072 | 0.636678 | plug.ex | starcoder |
defmodule Day8 do
@moduledoc """
--- Day 8: I Heard You Like Registers ---
You receive a signal directly from the CPU. Because of your recent assistance with jump instructions, it would like
you to compute the result of a series of unusual register instructions.
Each instruction consists of several parts: t... | lib/day8.ex | 0.712632 | 0.725211 | day8.ex | starcoder |
defmodule Hexate do
@moduledoc """
A simple module to convert to and from hex encoded strings.
Encodes / decodes both char-lists and strings.
"""
@doc """
Returns a hex encoded string from a char-list, string or integer.
## Examples
iex> Hexate.encode("This is a test.")
"546869732069732061... | lib/hexate.ex | 0.88754 | 0.486027 | hexate.ex | starcoder |
defmodule Versionary.Plug.VerifyHeader do
@moduledoc """
Use this plug to verify a version string in the header.
## Example
```
plug Versionary.Plug.VerifyHeader, versions: ["application/vnd.app.v1+json"]
```
If multiple versions are passed to this plug and at least one matches the
version will be co... | lib/versionary/plug/verify_header.ex | 0.877496 | 0.848471 | verify_header.ex | starcoder |
defmodule Fxnk.Map do
@moduledoc """
`Fxnk.Map` are functions that work with maps.
"""
import Fxnk.Functions, only: [curry: 1]
@doc """
Curried `assemble/2`
## Examples
iex> map = %{red: "red", green: "green", blue: "blue" }
iex> fnmap = %{
...> red: Fxnk.Flow.compose([&String.upcase/1... | lib/fxnk/map.ex | 0.921176 | 0.531027 | map.ex | starcoder |
defmodule Strava.DetailedActivity do
@moduledoc """
"""
@derive [Poison.Encoder]
defstruct [
:id,
:external_id,
:upload_id,
:athlete,
:name,
:distance,
:moving_time,
:elapsed_time,
:total_elevation_gain,
:elev_high,
:elev_low,
:type,
:start_date,
:start_... | lib/strava/model/detailed_activity.ex | 0.710628 | 0.449816 | detailed_activity.ex | starcoder |
defmodule Cardigan.Game do
alias Cardigan.{Deck, Card}
@behaviour Access
defstruct name: nil,
min_num_of_players: 1,
max_num_of_players: 20,
metadata: nil,
decks: [],
hands: [],
started: false
# Implementing the Access behaviour by deleg... | lib/cardigan/game.ex | 0.68616 | 0.506713 | game.ex | starcoder |
defmodule StatesLanguage.AST.Default do
@moduledoc false
@behaviour StatesLanguage.AST
@impl true
def create(_) do
quote location: :keep do
defdelegate call(pid, event), to: :gen_statem
defdelegate call(pid, event, timeout), to: :gen_statem
defdelegate cast(pid, event), to: :gen_statem
... | lib/states_language/ast/default.ex | 0.756042 | 0.471162 | default.ex | starcoder |
defmodule RecurringEvents.Weekly do
@moduledoc """
Handles `:weekly` frequency rule
"""
alias RecurringEvents.Date
@doc """
Returns weekly stream of dates with respect to `:interval`, `:count` and
`:until` rules. Date provided as `:until` is used to figure out week
in which it occurs, exact date is no... | lib/recurring_events/weekly.ex | 0.897607 | 0.458531 | weekly.ex | starcoder |
defmodule Grizzly.ZWave.Commands.ScheduleEntryLockDailyRepeatingSet do
@moduledoc """
This command is used to set or erase a daily repeating schedule for an
identified user who already has valid user access code.
Params:
* `:set_action` - Indicates whether to erase or modify
* `:user_identifier` - The... | lib/grizzly/zwave/commands/schedule_entry_lock_daily_repeating_set.ex | 0.881997 | 0.432902 | schedule_entry_lock_daily_repeating_set.ex | starcoder |
defmodule AWS.XRay do
@moduledoc """
AWS X-Ray provides APIs for managing debug traces and retrieving service maps
and other data created by processing those traces.
"""
@doc """
Retrieves a list of traces specified by ID.
Each trace is a collection of segment documents that originates from a single
... | lib/aws/generated/xray.ex | 0.912568 | 0.467696 | xray.ex | starcoder |
defmodule DBConnection.LogEntry do
@moduledoc """
Struct containing log entry information.
"""
defstruct [:call, :query, :params, :result, :pool_time, :connection_time, :decode_time]
@typedoc """
Log entry information.
* `:call` - The `DBConnection` function called
* `:query` - The query used by ... | teachme/deps/db_connection/lib/db_connection/log_entry.ex | 0.903916 | 0.469277 | log_entry.ex | starcoder |
defmodule Tesla.Middleware.FormUrlencoded do
@behaviour Tesla.Middleware
@moduledoc """
Send request body as `application/x-www-form-urlencoded`.
Performs encoding of `body` from a `Map` such as `%{"foo" => "bar"}` into
url encoded data.
Performs decoding of the response into a map when urlencoded and cont... | lib/tesla/middleware/form_urlencoded.ex | 0.905692 | 0.704109 | form_urlencoded.ex | starcoder |
defmodule Ecto.Adapters.SQL do
@moduledoc """
Behaviour and implementation for SQL adapters.
The implementation for SQL adapter provides a
pooled based implementation of SQL and also expose
a query function to developers.
Developers that use `Ecto.Adapters.SQL` should implement
the connection module wit... | lib/ecto/adapters/sql.ex | 0.828835 | 0.515681 | sql.ex | starcoder |
defmodule Snitch.Data.Model.HostedPayment do
@moduledoc """
Hosted Payment API and utilities.
`HostedPayment` is a concrete payment subtype in Snitch. By `create/4`ing a
HostedPayment, the supertype Payment is automatically created in the same
transaction.
"""
use Snitch.Data.Model
alias Ecto.Multi
... | apps/snitch_core/lib/core/data/model/payment/hosted_payment.ex | 0.874981 | 0.495728 | hosted_payment.ex | starcoder |
defmodule Limiter.Result do
@moduledoc """
The struct is the result of calling `Limiter.checkout/5` function.
"""
@typedoc """
Indicates if an action is allowed or rate limited.
"""
@type allowed :: boolean
@typedoc """
The number of actions that is allowed before reaching the rate limit.
"""
@t... | lib/limiter.ex | 0.885207 | 0.643665 | limiter.ex | starcoder |
defmodule Pow.Store.CredentialsCache do
@moduledoc """
Default module for credentials session storage.
A key (session id) is used to store, fetch, or delete credentials. The
credentials are expected to take the form of
`{credentials, session_metadata}`, where session metadata is data exclusive
to the sessi... | lib/pow/store/credentials_cache.ex | 0.693058 | 0.459137 | credentials_cache.ex | starcoder |
defmodule Prove do
@moduledoc """
Prove provides the macros `prove` and `batch` to write simple tests in `ExUnit`
shorter.
A `prove` is just helpful for elementary tests. Prove generates one test with
one assert for every `prove`.
The disadvantage of these macros is that the tests are containing fewer
d... | lib/prove.ex | 0.839997 | 0.929696 | prove.ex | starcoder |
defmodule Ecto.Query.BuilderUtil do
@moduledoc false
alias Ecto.Query.Query
@expand_sigils [:sigil_c, :sigil_C, :sigil_s, :sigil_S, :sigil_w, :sigil_W]
@doc """
Smart escapes a query expression.
Everything that is a query expression will be escaped, foreign (elixir)
expressions will not be escaped so ... | lib/ecto/query/builder_util.ex | 0.597608 | 0.424054 | builder_util.ex | starcoder |
defmodule Instruments.CustomFunctions do
@moduledoc """
Creates custom prefixed functions
Often, a module will have functions that all have a common prefix.
It's somewhat tedious to have to put this prefix in every call to
every metric function. Using this module can help somewhat.
When you `use` this mod... | lib/custom_functions.ex | 0.894424 | 0.793666 | custom_functions.ex | starcoder |
defmodule ExAws.Transcribe do
@moduledoc """
Operations for AWS Transcribe
"""
import ExAws.Utils, only: [camelize_keys: 2]
@version "2017-10-26"
@doc """
Starts an asynchronous job to transcribe speech to text.
Doc: <https://docs.aws.amazon.com/transcribe/latest/dg/API_StartTranscriptionJob.h... | lib/ex_aws/transcribe.ex | 0.858348 | 0.593963 | transcribe.ex | starcoder |
defmodule PixelFont.RectilinearShape.EdgeGenerator do
@moduledoc false
alias PixelFont.RectilinearShape.Edge
@spec get_edges([charlist()], Edge.orientation()) :: [[Edge.t()]]
def get_edges(bmp, orientation) do
data =
case orientation do
:horizontal -> bmp
:vertical -> bmp |> Enum.zip... | lib/pixel_font/rectilinear_shape/edge_generator.ex | 0.812533 | 0.619097 | edge_generator.ex | starcoder |
defmodule DataFrame.Statistics do
@moduledoc """
Functions with statistics processing of Frames
"""
alias DataFrame.Table
# Goal is to achieve something like this
# count 6.000000 6.000000 6.000000 6.000000
# mean 0.073711 -0.431125 -0.687758 -0.233103
# std 0.843157 0.922818 0.779887 0.97... | lib/dataframe/statistics.ex | 0.715225 | 0.446012 | statistics.ex | starcoder |
defmodule Bodyguard.Action do
@moduledoc """
Execute authorized actions in a composable way.
An Action can be built up over the course of a request, providing a means to
specify authorization parameters in the steps leading up to actually
executing the job.
When authorization fails, there is an opportunit... | lib/bodyguard/action.ex | 0.904616 | 0.417212 | action.ex | starcoder |
defmodule Membrane.RawAudio.SampleFormat do
@moduledoc """
This module defines sample formats used in `Membrane.RawAudio`
and some helpers to deal with them.
"""
use Bunch.Typespec
import Bitwise
@compile {:inline,
[
to_tuple: 1,
from_tuple: 1
]}
@l... | lib/membrane_raw_audio/sample_format.ex | 0.842199 | 0.561004 | sample_format.ex | starcoder |
defmodule ExampleWeb.Email do
@moduledoc """
A module for sending emails to the user.
This module provides functions to be used with the Phauxth authentication
library when confirming users or handling password resets.
This example uses Bamboo to email users. If you do not want to use Bamboo,
see the `Usi... | lib/example_web/email.ex | 0.871146 | 0.640031 | email.ex | starcoder |
defmodule ExMpesa.AccountBalance do
@moduledoc """
The Account Balance API requests for the account balance of a shortcode.
"""
import ExMpesa.MpesaBase
import ExMpesa.Util
@doc """
Initiates account balnce request
## Configuration
Add below config to dev.exs / prod.exs files
This asumes you ha... | lib/ex_mpesa/account_balance.ex | 0.776072 | 0.623291 | account_balance.ex | starcoder |
defmodule Callisto.GraphDB.Queryable do
alias Callisto.{Edge, Query, Triple, Vertex}
def query(adapter, cypher, parser \\ nil) do
do_query(adapter, cypher, parser)
end
# Straight up cypher string, no parser...
defp do_query(adapter, cypher, parser)
when is_binary(cypher) and is_nil(parser) do
... | lib/callisto/graph_db/queryable.ex | 0.720958 | 0.446253 | queryable.ex | starcoder |
defprotocol Gyx.Core.Spaces do
@moduledoc """
This protocol defines basic functions to interact with
action and observation spaces.
"""
alias Gyx.Core.Spaces.{Discrete, Box, Tuple}
@type space :: Discrete.t() | Box.t() | Tuple.t()
@type discrete_point :: integer
@type box_point :: list(list(float))
@... | lib/core/spaces/protocols.ex | 0.914577 | 0.708326 | protocols.ex | starcoder |
defmodule AWS.AutoScaling do
@moduledoc """
Amazon EC2 Auto Scaling
Amazon EC2 Auto Scaling is designed to automatically launch or terminate EC2
instances based on user-defined scaling policies, scheduled actions, and health
checks.
Use this service with AWS Auto Scaling, Amazon CloudWatch, and Elastic L... | lib/aws/generated/auto_scaling.ex | 0.917036 | 0.617138 | auto_scaling.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.