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 Model.Vehicle do
@moduledoc """
Vehicle represents the current status of a vehicle.
"""
use Recordable, [
:id,
:trip_id,
:stop_id,
:route_id,
:direction_id,
:label,
:latitude,
:longitude,
:bearing,
:speed,
:current_status,
:current_stop_sequence,
:u... | apps/model/lib/model/vehicle.ex | 0.903146 | 0.655169 | vehicle.ex | starcoder |
defmodule Exredis do
@moduledoc """
Redis client for Elixir
"""
defmacro __using__(_opts) do
quote do
import Exredis
end
end
@type reconnect_sleep :: :no_reconnect | integer
@type start_link :: { :ok, pid } | { :error, term }
@doc """
Connect to the Redis server using a connecti... | lib/exredis.ex | 0.737064 | 0.444685 | exredis.ex | starcoder |
defmodule AWS.ManagedBlockchain do
@moduledoc """
<p/> Amazon Managed Blockchain is a fully managed service for creating and
managing blockchain networks using open source frameworks. Blockchain
allows you to build applications where multiple parties can securely and
transparently run transactions and share ... | lib/aws/managed_blockchain.ex | 0.836187 | 0.488466 | managed_blockchain.ex | starcoder |
defmodule SteamEx.IPlayerService do
@moduledoc """
Provides additional methods for interacting with Steam Users.
See [ISteamUser](https://partner.steamgames.com/doc/webapi/ISteamUser) for the primary interface.
**NOTE:** This is a Service interface, methods in this interface should be called with the `input_j... | lib/interfaces/i_player_service.ex | 0.782704 | 0.474266 | i_player_service.ex | starcoder |
defmodule ExAws.S3.Upload do
@moduledoc """
Represents an AWS S3 Multipart Upload operation
## Examples
```
"path/to/big/file"
|> S3.Upload.stream_file
|> S3.upload("my-bucket", "path/on/s3")
|> ExAws.request! #=> :done
```
"""
@enforce_keys ~w(bucket path src)a
defstruct [
:src,
:buck... | lib/ex_aws/s3/upload.ex | 0.858229 | 0.749706 | upload.ex | starcoder |
defmodule Mtpo.Guesses.Guess do
use Ecto.Schema
import Ecto.Changeset
alias Mtpo.Guesses.Guess
alias Mtpo.Rounds
@value_regex ~r/^(?<min>\d+)?[\.:]?(?<sec>\d\d)[:\.](?<frac>\d\d)$/
schema "guesses" do
field :value, :string
belongs_to :user, Mtpo.Users.User
belongs_to :round, Mtpo.Rounds.Round
... | lib/mtpo/guesses/guess.ex | 0.668664 | 0.402128 | guess.ex | starcoder |
defmodule X509.RDNSequence do
@moduledoc """
Convenience functions for creating `:rdnSquence` tuples, as defined in
Erlang's `:public_key` module as the `issuer_name()` type, and representing
the X.509 RDNSequence type. RDNSequences are primarily used for the Subject
and Issuer fields of certificates, as well... | lib/x509/rdn_sequence.ex | 0.86738 | 0.581125 | rdn_sequence.ex | starcoder |
defmodule AutoApi.DashboardLightsState do
@moduledoc """
Keeps Dashboard Lights state
"""
alias AutoApi.{CommonData, State}
use AutoApi.State, spec_file: "dashboard_lights.json"
@type light_name ::
:high_beam
| :low_beam
| :hazard_warning
| :brake_failure
... | lib/auto_api/states/dashboard_lights_state.ex | 0.695131 | 0.404155 | dashboard_lights_state.ex | starcoder |
defmodule Default do
defmodule Types do
import AttribTools
@compile :inline_list_funcs
@type stack_to_type :: %{Stack.name() => Type.t()}
require Type
@doc """
The default phenome stack names and types
"""
@spec phenome_stack_to_type() :: %{Stack.name() => Type.t()}
attrib_and_... | lib/mulix/vm/default.ex | 0.654122 | 0.604749 | default.ex | starcoder |
defmodule Cldr.Print.Format do
@moduledoc false
import Cldr.Print.Transform
alias Cldr.Number.Format.Meta
def format("d" = type, format, options) do
backend = Keyword.get(options, :backend, Cldr.Print.Backend)
formatter = Module.concat(backend, Number.Formatter.Decimal)
meta = meta_from_format(typ... | lib/format.ex | 0.591959 | 0.416945 | format.ex | starcoder |
defmodule OMG.Eth.RootChain.AbiFunctionSelector do
@moduledoc """
We define Solidity Function selectors that help us decode returned values from function calls
"""
# workaround for https://github.com/omgnetwork/elixir-omg/issues/1632
def start_exit() do
%ABI.FunctionSelector{
function: "startExit"... | apps/omg_eth/lib/omg_eth/root_chain/abi_function_selector.ex | 0.630002 | 0.480479 | abi_function_selector.ex | starcoder |
defmodule Money.Currency do
@moduledoc """
Provides currency support to `Money`
Some useful helper methods include:
* `get/1`
* `get!/1`
* `exists?/1`
* `to_atom/1`
* `name/1`
* `name!/1`
* `symbol/1`
* `symbol!/1`
* `all/0`
A helper function exists for each currency using... | lib/money/currency.ex | 0.889385 | 0.624952 | currency.ex | starcoder |
defmodule Ace.HTTP.Service do
@moduledoc """
Run a `Raxx.Server` application for HTTP/1.x and HTTP/2 clients
**NOTE:** Ace services are served over a secure transport layer TLS(SSL),
therefore `:cert` + `:key` or `:certfile` + `:keyfile` are required options.
Starting a service will start and manage a cohor... | lib/ace/http/service.ex | 0.882314 | 0.573201 | service.ex | starcoder |
defmodule Yams.Server.Connection.Authenticator do
@moduledoc """
This module is responsible for creating tasks that start TLS on sockets and
perform authentication of the remote device using the supplied client certificate.
"""
use Task
import Ecto.Query, only: [from: 2]
alias Yams.Database.CertAuth
ali... | lib/server/connection/authenticator.ex | 0.736021 | 0.423786 | authenticator.ex | starcoder |
defmodule TomlElixir.Validator do
@moduledoc """
Parse and validate toml returned by parse
"""
alias TomlElixir.Error
@doc """
Validate toml and parse it to proper format
"""
@spec validate(list) :: list
def validate([]), do: []
def validate([{:table, to} | tail]) do
[{:table, Enum.map(to, &to_... | lib/toml_elixir/validator.ex | 0.770637 | 0.770896 | validator.ex | starcoder |
defmodule Statix do
@moduledoc """
Writer for [StatsD](https://github.com/etsy/statsd)-compatible servers.
To get started with Statix, you have to create a module that calls `use
Statix`, like this:
defmodule MyApp.Statix do
use Statix
end
This will make `MyApp.Statix` a Statix connecti... | lib/statix.ex | 0.921565 | 0.55254 | statix.ex | starcoder |
defmodule SmartCity.Dataset do
@moduledoc """
Struct defining a dataset definition and functions for retrieving key elements
of the dataset for handling.
```javascript
const Dataset = {
"id": "", // UUID
"business": { // Project Open Data Metadata Schema v1.1
"authorEm... | lib/smart_city/dataset.ex | 0.818011 | 0.819605 | dataset.ex | starcoder |
defmodule Aoc.Day01 do
@moduledoc false
import Aoc.Utils
@spec run(1 | 2) :: number
def run(1), do: solve1(get_input(1))
def run(2), do: solve2(get_input(1))
@spec solve1(binary) :: number
def solve1(input) do
String.split(input, ", ", trim: true)
|> Enum.reduce({{0, 0}, :north}, fn e, acc ->
... | lib/aoc/day01.ex | 0.723016 | 0.820218 | day01.ex | starcoder |
defmodule Meilisearch.Documents do
@moduledoc """
Collection of functions used to manage documents.
[MeiliSearch Documentation - Documents](https://docs.meilisearch.com/references/documents.html)
"""
alias Meilisearch.HTTP
@doc """
Get one document by id.
([ref.](https://docs.meilisearch.com/referenc... | lib/meilisearch/documents.ex | 0.675015 | 0.425546 | documents.ex | starcoder |
use Bitwise
require Logger
defmodule FlexId do
@moduledoc """
Generator for distributed time-based ids.
Ids are composed of 4 value:
- time in ms
- rolling sequence counter
- partition used to segratate ids; this could be hard-coded by node or geo-region
or be a hash to shard data by user
-... | lib/flexid.ex | 0.921992 | 0.538801 | flexid.ex | starcoder |
defmodule Akd.Build.Docker do
@moduledoc """
A native Hook module that comes shipped with Akd.
This module uses `Akd.Hook`.
Provides a set of operations that build an elixir app in a Docker container
using a specified `Dockerfile` at a deployment's `build_at` destination.
This hook assumes that there is ... | lib/akd/base/build/docker.ex | 0.858926 | 0.5752 | docker.ex | starcoder |
defmodule JaSerializer.Serializer do
@moduledoc """
A Behaviour for defining JSON-API.org spec complaint payloads.
The following callbacks are available:
* `id/2` - Return ID of struct to be serialized.
* `type/2` - Return string type of struct to be serialized.
* `attributes/2` - A map of attribute... | lib/ja_serializer/serializer.ex | 0.872034 | 0.557815 | serializer.ex | starcoder |
defmodule ExPesa.Mpesa.B2c do
@moduledoc """
Business to Customer (B2C) API enables the Business or organization to pay its customers who are the end-users of its products or services.
Currently, the B2C API allows the org to perform around 3 types of transactions: SalaryPayments, BusinessPayments or Promotio... | lib/ex_pesa/Mpesa/b2c.ex | 0.788868 | 0.817756 | b2c.ex | starcoder |
defmodule AWS.EMR do
@moduledoc """
Amazon EMR is a web service that makes it easier to process large amounts of
data efficiently.
Amazon EMR uses Hadoop processing combined with several Amazon Web Services
services to do tasks such as web indexing, data mining, log file analysis,
machine learning, scient... | lib/aws/generated/emr.ex | 0.864525 | 0.581481 | emr.ex | starcoder |
defmodule Cast do
@moduledoc """
This module provides macros to generate elixir code from C AST.
# Usage
First you need to generate an XML representation of C AST thanks to
[castxml](https://github.com/CastXML) (version >= 0.2), in GCC mode (other
modes may be supported in the future).
`castxml` has ma... | lib/cast.ex | 0.88782 | 0.792022 | cast.ex | starcoder |
defmodule Day11 do
import Intcode
def from_file(path) do
File.read!(path)
|> String.split(",")
|> Enum.map(&Integer.parse/1)
|> Enum.map(&(elem(&1, 0)))
end
def robot(program, initial_color) do
robot_execute(execute(initial_state(program, [initial_color])), {{0, 0}, 0}, [])
end
def ro... | lib/day11.ex | 0.52829 | 0.491456 | day11.ex | starcoder |
defmodule BroadwayRedis.Producer do
@moduledoc """
A GenStage producer that continuously receives messages from a Redis list.
This implementation follows the [Reliable Queue](https://redis.io/commands/rpoplpush#pattern-reliable-queue) pattern
outlined in the Redis documentation.
## Options
* `:redis_in... | lib/broadway_redis/producer.ex | 0.888345 | 0.51879 | producer.ex | starcoder |
defmodule Tai.VenueAdapters.Deribit.Product do
@time_unit :millisecond
def build(instrument, venue_id) do
symbol = instrument.instrument_name |> to_symbol
status = instrument |> to_status
type = instrument |> to_type
listing = Timex.from_unix(instrument.creation_timestamp, @time_unit)
expiry = ... | apps/tai/lib/tai/venue_adapters/deribit/product.ex | 0.648911 | 0.436682 | product.ex | starcoder |
defmodule PlugAttack do
@moduledoc ~S"""
A plug building toolkit for blocking and throttling abusive requests.
PlugAttack is a set of macros that can be used to build a plug to protect
your web app from bad clients. It allows safelisting, blocklisting and
throttling based on arbitrary properties of the reque... | lib/plug_attack.ex | 0.798776 | 0.49762 | plug_attack.ex | starcoder |
defmodule Bench do
@moduledoc """
Runs a benchmark.
This benchmark works by having a parent node start two children, and once the parent node receives a message it will
pass it to all the nodes it's connected to. Each child may also have two children, or none. Thus, sending a message
into the node cluster wi... | lib/bench.ex | 0.746878 | 0.691015 | bench.ex | starcoder |
defmodule Graph.Reducers.Bfs do
@moduledoc """
This reducer traverses the graph using Breadth-First Search.
"""
use Graph.Reducer
@doc """
Performs a breadth-first traversal of the graph, applying the provided mapping function to
each new vertex encountered.
NOTE: The algorithm will follow lower-weigh... | lib/graph/reducers/bfs.ex | 0.897061 | 0.708692 | bfs.ex | starcoder |
defmodule LogWatcher.Tasks.Session do
@moduledoc """
Defines a Session struct for use with schemaless changesets.
Sessions are not stored in a SQL database.
A session represents a directory on the file system that will
contain the executable scripts, data and log files necessary to
perform long running tas... | apps/log_watcher/lib/log_watcher/tasks/session.ex | 0.815526 | 0.470128 | session.ex | starcoder |
defmodule Aeutil.Scientific do
@moduledoc """
Converts integer to scientific notation.
It's used for storing the target in blocks and recalculating the next target
"""
use Bitwise
@highest_target_int 0xFFFF000000000000000000000000000000000000000000000000000000000000
@spec scientific_to_integer(integer(... | apps/aeutil/lib/scientific.ex | 0.696578 | 0.738669 | scientific.ex | starcoder |
defmodule BufEdit do
@moduledoc """
Programmable buffer editor, similar in concept to [ed](https://en.wikipedia.org/wiki/Ed_(text_editor)).
`BufEdit` reads a file into memory and provides a flexible API for editing it and writing
it back to a file.
Consider the following mix.exs file:
```elixir
defmodu... | lib/buf_edit.ex | 0.889409 | 0.862815 | buf_edit.ex | starcoder |
defmodule Ada.CLI.Markup do
@moduledoc """
This module defines semantic helpers that can be used to format
CLI-based reports.
It includes (among other things) titles, headings, paragraphs (with support
for wrapping text), lists and bars.
The recommended usage pattern is to build lists of elements and then... | lib/ada/cli/format/markup.ex | 0.868395 | 0.500366 | markup.ex | starcoder |
defmodule AWS.ElasticBeanstalk do
@moduledoc """
AWS Elastic Beanstalk
AWS Elastic Beanstalk makes it easy for you to create, deploy, and manage
scalable, fault-tolerant applications running on the Amazon Web Services
cloud.
For more information about this product, go to the [AWS Elastic
Beanstalk](htt... | lib/aws/elastic_beanstalk.ex | 0.831383 | 0.504883 | elastic_beanstalk.ex | starcoder |
defmodule Piazza.Crypto.License do
@moduledoc """
Genserver for managing the license verification lifecycle. The
protocol is basically:
1. On start, decode the license and pass to either on_failure or on_verify depending
on the result.
2. At a fixed interval, reverify the license, in case it's expired/... | lib/crypto/license.ex | 0.800848 | 0.727395 | license.ex | starcoder |
defmodule Nerves.Grove.OLED.Display do
@moduledoc """
Seeed Studio [Grove OLED Display 96×96](http://wiki.seeedstudio.com/wiki/Grove_-_OLED_Display_1.12%22)
## Datasheet
http://garden.seeedstudio.com/images/8/82/SSD1327_datasheet.pdf
# Example
alias Nerves.Grove.OLED
{:ok, pid} = OLED.Displa... | lib/nerves_grove/oled_display.ex | 0.590897 | 0.461927 | oled_display.ex | starcoder |
defmodule RDF.XSD.String do
@moduledoc """
`RDF.XSD.Datatype` for XSD strings.
"""
@type valid_value :: String.t()
use RDF.XSD.Datatype.Primitive,
name: "string",
id: RDF.Utils.Bootstrapping.xsd_iri("string")
alias RDF.XSD
def_applicable_facet XSD.Facets.MinLength
def_applicable_facet XSD.F... | lib/rdf/xsd/datatypes/string.ex | 0.647018 | 0.506469 | string.ex | starcoder |
defmodule GGity.Geom.Segment do
@moduledoc false
alias GGity.{Draw, Geom, Plot}
@type t() :: %__MODULE__{}
@type plot() :: %Plot{}
@type record() :: map()
@type mapping() :: map()
defstruct data: nil,
mapping: nil,
stat: :identity,
position: :identity,
ke... | lib/ggity/geom/segment.ex | 0.891525 | 0.606935 | segment.ex | starcoder |
defmodule Centaurus.Types do
@moduledoc """
A collection of types used throughout Centaurus.
The types are split into several different modules based on expected usage.
"""
@typedoc """
The socket type.
"""
@opaque socket :: reference
@typedoc """
The stream type.
"""
@opaque stream :: ref... | lib/centaurus/types.ex | 0.660391 | 0.521167 | types.ex | starcoder |
defmodule Pushito do
use Application
@moduledoc ~s"""
Pushito is an APNs library over the HTTP/2 API. This is the Main module and the one you should use in your applications.
## Connect to APNs
In order to create connections we will use `Pushito.connect/1` function. It only has one argument which is the co... | lib/pushito.ex | 0.854111 | 0.851459 | pushito.ex | starcoder |
defmodule Hrx do
@moduledoc """
# HRX
[Human Readable Archive](https://github.com/google/hrx) parser for Elixir.
HRX files are useful for loading data for a test suite where creating multiple
files is not desired. The HRX format is easy to read and manually edit for quicker iteration.
For more informati... | lib/hrx.ex | 0.742795 | 0.894835 | hrx.ex | starcoder |
defmodule Breezex.Util do
@moduledoc """
Module responsible for transforming arguments for requests.
"""
@spec bang_output({:ok, any, any}) :: {any, any}
@doc """
Unwraps request responses, raising if there's an error
"""
def bang_output({:ok, body, headers}), do: {body, headers}
def bang_output({:er... | lib/breezex/util.ex | 0.863348 | 0.404272 | util.ex | starcoder |
defmodule Absinthe.Adapter do
@moduledoc """
Absinthe supports an adapter mechanism that allows developers to define their
schema using one code convention (eg, `snake_cased` fields and arguments), but
accept query documents and return results (including names in errors) in
another (eg, `camelCase`).
Adap... | lib/absinthe/adapter.ex | 0.925129 | 0.846926 | adapter.ex | starcoder |
defmodule Rollbax.Logger do
@moduledoc """
A module that can be used to report crashes and exits to Rollbar.
In Elixir and Erlang, crashes from GenServers and other processes are reported through
`:error_logger`. When installed, this module installs an `:error_logger` handler that can be
used to report such ... | lib/rollbax/logger.ex | 0.846974 | 0.627666 | logger.ex | starcoder |
defmodule Ockam.Worker.Authorization do
@moduledoc """
Helper functions to configure worker message authorization.
Usage:
```
def is_authorized(message, _state)
Authorization.from_addresses(message, ["one", "two"])
end
```
Pipelining helpers:
```
def is_authorized(message, state)
Authoriza... | implementations/elixir/ockam/ockam/lib/ockam/worker/authorization.ex | 0.787727 | 0.844473 | authorization.ex | starcoder |
defmodule Sim.Laboratory.InVitro do
@moduledoc """
All in one server for testing simulations.
Data, SimLoop and Access are all here, if the server crashes the whole state is loss.
"""
use GenServer, restart: :transient
require Logger
alias Phoenix.PubSub
@sim_interval 1000
def start_link(opts \\ [... | apps/sim/lib/sim/laboratory/in_vitro.ex | 0.634656 | 0.494202 | in_vitro.ex | starcoder |
defmodule Example_Str do
def start do
range = 1..10
stream = Stream.map(range, &(&1 * 5))
Enum.map(stream, &(&1 + 4))
end
def start2 do
stream = 1..10
|> Stream.map(&IO.inspect(&1))
|> Stream.map(&(&1 * 3))
|> Stream.map(&IO.inspect(&1))
Enum.to_list(stream)
end
def start3 do... | lib/beam/stream/stream.ex | 0.50415 | 0.582788 | stream.ex | starcoder |
defmodule GroundStationWeb.SimulatorLive do
use Phoenix.LiveView
@tick 30
@tick_seconds @tick / 1000
def render(assigns) do
Phoenix.View.render(GroundStationWeb.PageView, "simulator.html", assigns)
end
def mount(session, socket) do
if connected?(socket), do: :timer.send_interval(@tick, self(), :t... | lib/groundstation_web/live/simulator_live.ex | 0.588061 | 0.48054 | simulator_live.ex | starcoder |
defmodule Chess.Game.Board do
alias Chess.Game.Board
alias Chess.Piece
defstruct field: %{}
def new() do
coordinates = for x <- 1..8, y <- 1..8, do: {x, y}
field = Enum.reduce(coordinates, %{}, fn x, acc -> Map.put(acc, x, nil) end)
|> Map.put({1, 1}, %Piece.Rook{color: :white})
... | lib/chess/game/board.ex | 0.543106 | 0.656104 | board.ex | starcoder |
defmodule BSV.Script do
@moduledoc """
Module for parsing, serialising and building Scripts.
Script is the scripting language built into Bitcoin. Transaction outputs each
contain a "locking script" which lock a number of satoshis. Transaction inputs
contain an "unlocking script" which unlock the satoshis con... | lib/bsv/script.ex | 0.883469 | 0.562657 | script.ex | starcoder |
defmodule XDR.Enum do
@moduledoc """
This module manages the `Enumeration` type based on the RFC4506 XDR Standard.
"""
@behaviour XDR.Declaration
alias XDR.EnumError
defstruct [:declarations, :identifier]
@typedoc """
`XDR.Enum` structure type specification.
"""
@type t :: %XDR.Enum{declarations... | lib/xdr/enum.ex | 0.920808 | 0.417984 | enum.ex | starcoder |
defmodule Roll35Core.Util do
@moduledoc """
Utility functions for the Roll35Core.
"""
alias Roll35Core.Types
@doc """
Roll a random item from a list.
If the list is a list of maps with `weight` and `value` keys, then
we make a weighted selection based on that info and return the
value. Otherwise, t... | apps/roll35_core/lib/roll35_core/util.ex | 0.849971 | 0.453141 | util.ex | starcoder |
defmodule Fiet.RSS2.Engine do
defmodule ParsingError do
defexception [:reason]
def message(%__MODULE__{reason: reason}) do
format_message(reason)
end
defp format_message({:not_atom, root_tag}) do
"unexpected root tag #{inspect(root_tag)}, expected \"rss\""
end
end
@moduledoc """... | lib/fiet/rss2/engine.ex | 0.852307 | 0.495667 | engine.ex | starcoder |
defmodule D2 do
@moduledoc """
--- Day 2: Password Philosophy ---
Your flight departs in a few days from the coastal airport; the easiest way down to the coast from here is via toboggan.
The shopkeeper at the North Pole Toboggan Rental Shop is having a bad day. "Something's wrong with our computers; we can't l... | lib/days/02.ex | 0.578329 | 0.766774 | 02.ex | starcoder |
defmodule Retex do
@moduledoc false
@type t() :: %Retex{}
alias Retex.{Node, Protocol, Fact, Token}
alias Node.{
Type,
Test,
Select,
PNode,
BetaMemory
}
@type action :: %{given: list(Retex.Wme.t()), then: list(Retex.Wme.t())}
@type network_node :: Type.t() | Test.t() | Select.t() | ... | lib/retex.ex | 0.808105 | 0.453867 | retex.ex | starcoder |
defmodule Icon.Schema.Types.Transaction do
@moduledoc """
This module defines a transaction.
A transaction has the following keys:
Key | Type | Description
:------------ | :------------------------------------------------- | :----------
`blockHash` ... | lib/icon/schema/types/transaction.ex | 0.920254 | 0.778607 | transaction.ex | starcoder |
defmodule DataMorph.Struct do
@moduledoc ~S"""
Contains `from_rows/3` function that defines a struct and return structs
created from rows, and `defmodulestruct/2` macro to define a struct.
"""
@doc ~S"""
Defines a struct from given `kind` alias and list of `fields`.
When called a second time with additi... | lib/data_morph/struct.ex | 0.772659 | 0.631495 | struct.ex | starcoder |
defmodule Frettchen.Span do
@moduledoc """
Spans are data structures that collect information
which gets sent to a reporter. They are usually
initialized and added to a Trace process which can
handle the life cycle management. Tags and logs
can be added to Spans to provide additional information.
Spans ca... | lib/frettchen/span.ex | 0.768863 | 0.576482 | span.ex | starcoder |
defmodule Akd.Publish.Distillery do
@moduledoc """
A native Hook module that comes shipped with Akd.
This module uses `Akd.Hook`.
Provides a set of operations that copies a built distillery release from
the `build_at` location to `publish_to` destination, and then publishes
the release (by uncompressing t... | lib/akd/base/publish/distillery.ex | 0.870879 | 0.496155 | distillery.ex | starcoder |
defmodule AWS.SMS do
@moduledoc """
Amazon Server Migration Service automates the process of migrating servers
to EC2.
"""
@doc """
The CreateReplicationJob API is used to create a ReplicationJob to
replicate a server on AWS. Call this API to first create a ReplicationJob,
which will then schedule per... | lib/aws/sms.ex | 0.744006 | 0.460774 | sms.ex | starcoder |
defmodule Ecto.Query.API do
@moduledoc """
This module lists all functions allowed in the query API.
* Comparison operators: `==`, `!=`, `<=`, `>=`, `<`, `>`
* Boolean operators: `and`, `or`, `not`
* Inclusion operator: `in/2`
* Search functions: `like/2` and `ilike/2`
* Null check functions: `... | lib/ecto/query/api.ex | 0.865082 | 0.863363 | api.ex | starcoder |
defmodule Geometry.MultiPolygonM do
@moduledoc """
A set of polygons from type `Geometry.PolygonM`
`MultiPointM` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> MultiPolygonM.new([
...> PolygonM.new([
...> LineStringM.new([
..... | lib/geometry/multi_polygon_m.ex | 0.931361 | 0.604107 | multi_polygon_m.ex | starcoder |
defmodule Membrane.MP4.Muxer.CMAF.Segment.Helper do
@moduledoc false
use Bunch
@spec get_segment(map(), non_neg_integer()) :: {:ok, map(), map()} | {:error, :not_enough_data}
def get_segment(state, duration) do
with {:ok, segment_part_1, state} <- collect_duration(state, duration),
{:ok, segment_p... | lib/membrane_mp4/muxer/cmaf/segment_helper.ex | 0.875235 | 0.581006 | segment_helper.ex | starcoder |
defmodule Gringotts.Gateways.Paymill do
@moduledoc """
[PAYMILL][home] gateway implementation.
For refernce see [PAYMILL's API (v2.1) documentation][docs].
The following features of PAYMILL are implemented:
| Action | Method |
| ------ | ------ |
... | lib/gringotts/gateways/paymill.ex | 0.877161 | 0.847021 | paymill.ex | starcoder |
defmodule Tuple do
@moduledoc """
Functions for working with tuples.
Please note the following functions for tuples are found in `Kernel`:
* `elem/2` - accesses a tuple by index
* `put_elem/3` - inserts a value into a tuple by index
* `tuple_size/1` - gets the number of elements in a tuple
Tuples... | lib/elixir/lib/tuple.ex | 0.903655 | 0.827828 | tuple.ex | starcoder |
defmodule Maru.Params.Types.List do
@moduledoc """
Buildin Type: List
## Parser Arguments
* `:unique` - whether unique the data in list with `Enum.uniq`
* `true` - unique the list
* `false` (default) - do NOT unique the list
* `:string_strategy` - how to parse a string value
*... | lib/maru/params/types/list.ex | 0.770076 | 0.601974 | list.ex | starcoder |
defmodule Membrane.Audiometer.Peakmeter.Amplitude do
@moduledoc false
alias Membrane.RawAudio
@doc """
Finds frame within given payload that has the highest amplitude for any of its channels.
On success, it returns `{:ok, {values, rest}}`, where:
* `values` is a list of amplitudes per channel expressed ... | lib/membrane_element_audiometer/amplitude.ex | 0.88916 | 0.642783 | amplitude.ex | starcoder |
defmodule AWS.ElasticInference do
@moduledoc """
Elastic Inference public APIs.
"""
@doc """
Describes the locations in which a given accelerator type or set of types is
present in a given region.
"""
def describe_accelerator_offerings(client, input, options \\ []) do
path_ = "/describe-accelerato... | lib/aws/generated/elastic_inference.ex | 0.745306 | 0.414751 | elastic_inference.ex | starcoder |
defmodule Meeseeks.XPath do
@moduledoc """
Compile XPath 1.0 selector syntax into `Meeseeks.Selector`s.
## Supported Syntax
Supports almost all XPath 1.0 syntax with a few notable exceptions.
### No top-level filter expressions
Due to the way Meeseeks selection works, top-level filter expressions like
... | lib/meeseeks/xpath.ex | 0.864768 | 0.812347 | xpath.ex | starcoder |
defmodule Talib.SMA do
@moduledoc ~S"""
Defines a Simple Moving Average.
## History
Version: 1.0
Source: https://qkdb.wordpress.com/2013/04/22/simple-moving-average/
Audited by:
| Name | Title |
| :----------- | :---------------- |
| | |
"""... | lib/talib/sma.ex | 0.91668 | 0.65185 | sma.ex | starcoder |
# based on XKCD 287 - https://xkcd.com/287/
defmodule Item do
@moduledoc """
Defines a struct for a menu item with a name and price
"""
@type t :: %__MODULE__{
name: String.t,
price: Money.t
}
defstruct name: "", price: Money.new(1)
@type menu() :: [t, ...]
@spec new(String.t, Money.t) :: ... | lib/item.ex | 0.838828 | 0.505066 | item.ex | starcoder |
defmodule MoneroAddress do
@moduledoc """
MoneroAddress implements functions decoding and validating Monero base58 encoded addresses.
Monero uses different address format than bicoin. The address contains 1 byte network prefix,
2 32 byte public keys - spend key and view key and 4 byte checksm. Address is encode... | lib/monero_address.ex | 0.748076 | 0.475849 | monero_address.ex | starcoder |
defmodule RTL.Playlist do
alias RTL.Playlist.Segment
alias RTL.Videos
# Outputs a list of matching Segment structs (ie. video clips)
def build_playlist(project, tags) do
tags |> Enum.each(& RTL.Helpers.assert_keys(&1, allowed: [:name]))
Videos.list_videos(project: project, coded: true, having_tags: ta... | lib/rtl/playlist/playlist.ex | 0.695028 | 0.473292 | playlist.ex | starcoder |
defmodule RDF.Namespace do
@moduledoc """
A behaviour for resolvers of atoms to `RDF.IRI`s.
Currently there's only one type of such namespaces: `RDF.Vocabulary.Namespace`,
but other types are thinkable and might be implemented in the future, eg.
namespaces for JSON-LD contexts.
"""
alias RDF.IRI
impo... | lib/rdf/namespace.ex | 0.801042 | 0.561365 | namespace.ex | starcoder |
defmodule OpentelemetryProcessPropagator do
@moduledoc """
`OpentelemetryProcessPropagator` provides helpers for dealing
with context propagation across process boundaries.
## Context Propagation
Erlang and Elixir do not have a mechanism for transparently passing
context between processes. This requires t... | propagators/opentelemetry_process_propagator/lib/opentelemetry_process_propagator.ex | 0.914544 | 0.855791 | opentelemetry_process_propagator.ex | starcoder |
defmodule Correcthorse.Password do
@moduledoc """
Generates lists of random words with `words/2` that can be used to make
a password with `to_password/3`.
"""
@max_minimum_words 50
@words (case Mix.env() do
:test -> StubWords
_ -> Correcthorse.Words.WordsImpl
end)
@doc... | apps/correcthorse/lib/correcthorse/password.ex | 0.792544 | 0.478651 | password.ex | starcoder |
defmodule Advent20.Passport do
@moduledoc """
Day 4: Passport Processing
"""
# Set up a stream of passport inputs
defp passport_input_stream(input_filename) do
input_filename
|> File.stream!()
|> Stream.map(&String.trim/1)
|> Stream.chunk_by(&(&1 == ""))
|> Stream.reject(&(&1 == [""]))
... | lib/advent20/04_passport.ex | 0.684053 | 0.42182 | 04_passport.ex | starcoder |
defmodule FunWithFlags do
@moduledoc """
FunWithFlags, the Elixir feature flag library.
This module provides the public interface to the library and its API is
made of three simple methods to enable, disable and query feature flags.
In their simplest form, flags can be toggled on and off globally.
More a... | lib/fun_with_flags.ex | 0.82226 | 0.583203 | fun_with_flags.ex | starcoder |
defmodule Json do
def encode!(object, conv \\ []) do
prepare!(object, conv)
|> Poison.encode!()
end
def prepare!(object, conv \\ []) do
do_encode(object, conv_validate(conv))
end
defp conv_validate(conv) do
Keyword.merge([big_x: true, all_hex: false], conv)
end
def decode!(binary) do
... | lib/json.ex | 0.558568 | 0.545104 | json.ex | starcoder |
defmodule PlugProxy do
@moduledoc """
A plug for reverse proxy server.
PlugProxy pipeline the request to the upstream, and the response will be sent with
[ranch](https://github.com/ninenines/ranch) transport which is highly efficient.
## Options
- `:upstream` - Upstream URL string. Additional path and ... | lib/plug_proxy.ex | 0.811863 | 0.527073 | plug_proxy.ex | starcoder |
defmodule HL7.V2_5_1.Segments.OBR do
@moduledoc false
require Logger
alias HL7.V2_5_1.{DataTypes}
use HL7.Segment,
fields: [
segment: nil,
set_id_obr: nil,
placer_order_number: DataTypes.Ei,
filler_order_number: DataTypes.Ei,
universal_service_identifier: DataTypes.Ce,
... | lib/hl7/2.5.1/segments/obr.ex | 0.61057 | 0.408542 | obr.ex | starcoder |
defmodule AWS.DevOpsGuru do
@moduledoc """
Amazon DevOps Guru is a fully managed service that helps you identify anomalous
behavior in business critical operational applications.
You specify the AWS resources that you want DevOps Guru to cover, then the
Amazon CloudWatch metrics and AWS CloudTrail events re... | lib/aws/generated/dev_ops_guru.ex | 0.87251 | 0.441011 | dev_ops_guru.ex | starcoder |
defmodule Bolt.Sips.Internals.Error do
@moduledoc false
defexception [:message, :code, :connection_id, :function, :type]
@type t :: %__MODULE__{
message: String.t(),
code: nil | any(),
connection_id: nil | integer(),
function: atom(),
type: atom()
}
@d... | lib/bolt_sips/internals/error.ex | 0.727879 | 0.426232 | error.ex | starcoder |
defmodule JiffyEx do
@moduledoc """
An Elixir module that wraps the Erlang jiffy library.
Provides `encode!/1`, `encode!/2`, `encode/1`, `encode/2`, `decode!/1`, `decode!/2`, `decode/1`, `decode/2` functions for encoding and decoding JSON values.
*Note: The jiffy functions by default all raise exceptions, so ... | lib/jiffy_ex.ex | 0.92342 | 0.679903 | jiffy_ex.ex | starcoder |
defmodule Nerves.Package.Platform do
@moduledoc """
Defines the Nerves package platform behaviour
This behaviour is implemented on a module that would be used to construct
an artifact for a nerves package. Nerves packages are prioritized to be
compiled before any other dependencies, therefore, a package plat... | lib/nerves/package/platform.ex | 0.835416 | 0.772316 | platform.ex | starcoder |
defmodule AleRFM69.HW do
@moduledoc false
use Bitwise, only_operators: true
# Convert a frequency entered by the user into the coresponding value for the register
def freq_to_register(freq) when freq < 100000000, do: freq_to_register freq * 10
def freq_to_register(freq) do
<<f1, f2, f3>> = <<round(freq /... | lib/ale_rfm69/hw.ex | 0.567457 | 0.409457 | hw.ex | starcoder |
defmodule ExUnit.AssertionError do
@no_value :ex_unit_no_meaningful_value
defexception left: @no_value,
right: @no_value,
message: @no_value,
expr: @no_value
@doc """
Indicates no meaningful value for a field.
"""
def no_value do
@no_value
end
end... | lib/ex_unit/lib/ex_unit/assertions.ex | 0.919527 | 0.848408 | assertions.ex | starcoder |
defmodule ExqBatch do
alias ExqBatch.Internal
alias ExqBatch.Utils
@moduledoc """
ExqBatch provides a building block to create complex workflows using
Exq jobs. A batch monitors a group of Exq jobs and creates callback
job when all the jobs are processed.
## Telemetry
The following telemetry events a... | lib/exq_batch.ex | 0.917349 | 0.849472 | exq_batch.ex | starcoder |
defmodule Unicode.Script do
@moduledoc """
Functions to introspect Unicode
scripts for binaries
(Strings) and codepoints.
"""
@behaviour Unicode.Property.Behaviour
alias Unicode.Utils
@scripts Utils.scripts()
|> Utils.remove_annotations()
@doc """
Returns the map of Unicode
scripts... | lib/unicode/script.ex | 0.905961 | 0.430746 | script.ex | starcoder |
defmodule ForthVM.Words.IO do
@moduledoc """
IO words
"""
alias ForthVM.Process
# ---------------------------------------------
# IO side effects
# ---------------------------------------------
@doc """
set-io-device: ( name -- ) set the current IO device to the value on the top of the data_stack
... | lib/forthvm/words/io.ex | 0.798501 | 0.644987 | io.ex | starcoder |
defmodule RayTracer.Tasks.Chapter9 do
@moduledoc """
This module tests camera from Chapter 9
"""
alias RayTracer.RTuple
alias RayTracer.Sphere
alias RayTracer.Plane
alias RayTracer.Canvas
alias RayTracer.Material
alias RayTracer.Color
alias RayTracer.Light
alias RayTracer.World
alias RayTracer.... | lib/tasks/chapter9.ex | 0.915186 | 0.652954 | chapter9.ex | starcoder |
defmodule Binary do
@moduledoc """
Functions to operate on binaries.
Wrappers of erlang's `:binary`, functions that try to mimic `String` behaviour
but on bytes, and some very simple functions that are here just to make
piping operations on binaries easier.
"""
@doc """
Convert list of bytes into bina... | lib/binary.ex | 0.897102 | 0.641507 | binary.ex | starcoder |
defmodule Moonsugar.Maybe do
@moduledoc """
The Maybe module contains functions that help create and interact with the maybe type. The Maybe type is represented as either `{:just, value}` or `:nothing`.
"""
@doc """
Helper function to create a just tuple.
## Examples
iex> Maybe.just(3)
{:just... | lib/maybe.ex | 0.831622 | 0.570301 | maybe.ex | starcoder |
defmodule Farmbot.Regimen.Manager do
@moduledoc "Manages a Regimen"
use Farmbot.Logger
use GenServer
alias Farmbot.CeleryScript
alias Farmbot.Asset
alias Asset.Regimen
import Farmbot.Regimen.NameProvider
import Farmbot.System.ConfigStorage,
only: [
get_config_value: 3
]
defmodule Erro... | lib/farmbot/regimen/manager.ex | 0.620622 | 0.475544 | manager.ex | starcoder |
defmodule Phoenix.Socket.Transport do
@moduledoc """
API for building transports.
This module describes what is required to build a Phoenix transport.
The transport sits between the socket and channels, forwarding client
messages to channels and vice-versa.
A transport is responsible for:
* Implement... | lib/phoenix/socket/transport.ex | 0.883783 | 0.558026 | transport.ex | starcoder |
defmodule Axon.CompilerError do
defexception [:exception, :graph]
@impl true
def message(%{graph: %Axon{op: op}, exception: exception}) do
op_inspect =
if is_atom(op) do
Atom.to_string(op)
else
"#{inspect(op)}"
end
"""
error while building prediction for #{op_inspec... | lib/axon/compiler.ex | 0.663887 | 0.433262 | compiler.ex | starcoder |
defmodule AWS.SSM do
@moduledoc """
Amazon EC2 Systems Manager is a collection of capabilities that helps you
automate management tasks such as collecting system inventory, applying
operating system (OS) patches, automating the creation of Amazon Machine
Images (AMIs), and configuring operating systems (OSs)... | lib/aws/ssm.ex | 0.859428 | 0.543227 | ssm.ex | starcoder |
defmodule Exsm.Transitions do
@moduledoc """
This is a GenServer that controls the transitions for a struct
using a set of helper functions from Exsm.Transition
It's meant to be run by a supervisor.
"""
alias Exsm.Transition
@invalid_transitions_error "Invalid transitions defined"
@doc false
def tr... | lib/exsm/transitions.ex | 0.76973 | 0.663307 | transitions.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.