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 Envy do
@key_value_delimeter "="
@moduledoc """
Provides explicit and auto loading of env files.
## Example
The following will set the `FOO` environment variable with the value of `bar`.
```
foo=bar
```
You can define comments with `#` but can't use `#` in values without wrapping
the ... | lib/envy.ex | 0.804943 | 0.849285 | envy.ex | starcoder |
defmodule ControlNode.Namespace do
@moduledoc false
@supervisor ControlNode.ReleaseSupervisor
use GenServer
require Logger
alias ControlNode.{Host, Registry}
defmodule Spec do
@typedoc """
`Namespace.Spec` defines a spec with the following attributes,
* `:tag` : Tag for the namespace (eg: `:t... | lib/control_node/namespace.ex | 0.80871 | 0.47926 | namespace.ex | starcoder |
defmodule Membrane.File.Sink do
@moduledoc """
Element that creates a file and stores incoming buffers there (in binary format).
When `Membrane.File.SeekEvent` is received, the element starts writing buffers starting
from `position`. By default, it overwrites previously stored bytes. You can set `insert?`
fi... | lib/membrane_file/sink.ex | 0.601242 | 0.508971 | sink.ex | starcoder |
defmodule Grizzly.ZWave.Commands.LearnModeSet do
@moduledoc """
This command is used to allow a node to be added to (or removed from) the network. When a node is
added to the network, the node is assigned a valid Home ID and NodeID.
Params:
* `:seq_number` - a command sequence number
* `:return_inter... | lib/grizzly/zwave/commands/learn_mode_set.ex | 0.903975 | 0.523542 | learn_mode_set.ex | starcoder |
defmodule Figlet.Parser.FontFileParser do
@moduledoc """
This module parses figlet font files identified by the path to the file.
A FIGlet file has 3 main parts:
- Headerline
- Comments
- Character Data
## [FIGcharacter Data](http://www.jave.de/figlet/figfont.html#figcharacterdata)
The FIGcharacte... | lib/figlet/parser/font_file_parser.ex | 0.535827 | 0.613439 | font_file_parser.ex | starcoder |
defmodule ExAws.S3.Crypto.AESGCMCipher do
@moduledoc """
This module wraps the logic necessary to encrypt / decrypt using [AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)
[GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode).
See the Erlang docs for [crypto_one_time_aead](https://erlang.org... | lib/ex_aws_s3_crypto/aes_gcm_cipher.ex | 0.788502 | 0.617195 | aes_gcm_cipher.ex | starcoder |
defmodule Telegraf.Serializer.LineProtocol do
@moduledoc """
Serializer for the InfluxDB Line Protocol output data format.
InfluxData recommends this data format unless another format is required for interoperability.
https://docs.influxdata.com/telegraf/v1.18/data_formats/output/influx/
"""
@behaviour Te... | lib/telegraf/serializer/line_protocol.ex | 0.793786 | 0.463444 | line_protocol.ex | starcoder |
defmodule Annex.Examples.Iris do
alias Annex.{
Data.List1D,
Dataset,
Layer.Sequence,
Utils
}
require Logger
@floats ~w(sepal_length sepal_width petal_length petal_width)a
@strings ~w(species)a
@keys @floats ++ @strings
NimbleCSV.define(IrisParser, separator: ",", escape: "\0")
def c... | examples/iris.ex | 0.573917 | 0.45175 | iris.ex | starcoder |
defmodule TrademarkFreeStrategicLandWarfare.Board do
@derive Jason.Encoder
@enforce_keys [:rows, :lookup]
defstruct rows: nil, lookup: nil
alias TrademarkFreeStrategicLandWarfare.Piece
@empty_board [
[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil],
[nil, nil, nil, nil, nil, nil, nil, nil, nil, ni... | lib/trademark_free_strategic_land_warfare/board.ex | 0.796372 | 0.544075 | board.ex | starcoder |
defmodule Aph.TTS do
@moduledoc """
TTS generation and alignment functions.
This module takes care of everything related to TTS (text-to-speech)
generation and parsing/aligning. It's also the module that introduces the most
side effects in the entire app, because it has to shell out to various programs
and... | lib/aph/tts.ex | 0.6508 | 0.417212 | tts.ex | starcoder |
defmodule Coxir.Struct.User do
@moduledoc """
Defines methods used to interact with Discord users.
Refer to [this](https://discordapp.com/developers/docs/resources/user#user-object)
for a list of fields and a broader documentation.
In addition, the following fields are also embedded.
- `voice` - a channel... | lib/coxir/struct/user.ex | 0.86342 | 0.455744 | user.ex | starcoder |
defmodule EZCalendar do
@moduledoc """
Functions for building calendars.
To use the Repo shortcut functions, add `EZCalendar` to your repo.
defmodule MyApp.Repo do
use Ecto.Repo, otp_app: :my_app
use EZCalendar
end
The following functions and their bang! variants then become av... | lib/ez_calendar.ex | 0.834845 | 0.481698 | ez_calendar.ex | starcoder |
defmodule FileSize.Byte do
@moduledoc """
A struct that represents a file size in bytes as lowest possible value, which
is a chunk of 8 bits each.
"""
use FileSize.Size, normalized_key: :bytes, default_unit: :b
@typedoc """
A type defining the available IEC units.
"""
@type iec_unit ::
:b
... | lib/file_size/byte.ex | 0.896705 | 0.579698 | byte.ex | starcoder |
defmodule Prometheus.Metric.Boolean do
@moduledoc """
Boolean metric, to report booleans and flags.
Boolean is a non-standard metric that uses untyped metric underneath.
A Boolean is typically used as a flag i.e. enabled/disabled, online/offline.
Example:
```
-module(my_fuse_instrumenter).
-export([... | astreu/deps/prometheus_ex/lib/prometheus/metric/boolean.ex | 0.949412 | 0.857231 | boolean.ex | starcoder |
defmodule RayTracer.Intersection do
@moduledoc """
This module is responsible for computing ray intersections with various shapes
"""
alias RayTracer.Shape
alias RayTracer.Ray
alias RayTracer.RTuple
alias RayTracer.World
import RayTracer.Constants
@type t :: %__MODULE__{
t: number,
object: ... | lib/intersection.ex | 0.90635 | 0.624336 | intersection.ex | starcoder |
defmodule RpiFbCapture do
use GenServer
@moduledoc """
Capture the Raspberry Pi's frame buffer
"""
@type option ::
{:width, non_neg_integer()}
| {:height, non_neg_integer()}
| {:display, non_neg_integer()}
@type format :: :ppm | :rgb24 | :rgb565 | :mono | :mono_column_scan
... | lib/rpi_fb_capture.ex | 0.845369 | 0.784567 | rpi_fb_capture.ex | starcoder |
defmodule Statifier.Statechart do
@moduledoc """
Represents a reactive system. Contains full specification.
This corresponds to the <scxml> element defined here:
https://www.w3.org/TR/scxml/#scxml
A conformant SCXML document must have at least one <state>, <parallel> or
<final> child. At system initializa... | statifier-ex/lib/statifier/statechart.ex | 0.770249 | 0.442034 | statechart.ex | starcoder |
defmodule Norm.Contract do
@moduledoc """
Design by Contract with Norm.
This module provides a `@contract` macro that can be used to define specs for arguments and the
return value of a given function.
To use contracts, call `use Norm` which also imports all `Norm` functions.
Sometimes you may want to tu... | lib/norm/contract.ex | 0.843734 | 0.495361 | contract.ex | starcoder |
defmodule Tensorflow.DeviceProperties.EnvironmentEntry do
@moduledoc false
use Protobuf, map: true, syntax: :proto3
@type t :: %__MODULE__{
key: String.t(),
value: String.t()
}
defstruct [:key, :value]
field(:key, 1, type: :string)
field(:value, 2, type: :string)
end
defmodule... | lib/tensorflow/core/protobuf/device_properties.pb.ex | 0.790328 | 0.418905 | device_properties.pb.ex | starcoder |
defmodule Xema.Builder do
@moduledoc """
This module contains some convenience functions to generate schemas.
## Examples
iex> import Xema.Builder
...> schema = Xema.new integer(minimum: 1)
...> Xema.valid?(schema, 6)
true
...> Xema.valid?(schema, 0)
false
"""
@funs ~w(
... | lib/xema/builder.ex | 0.867864 | 0.429998 | builder.ex | starcoder |
defmodule CodeFrame do
alias IO.ANSI
@moduledoc """
Generate an excerpt of a string and highlight a specific line
"""
@doc """
Generate the code frame with the given string.
## Examples
Without coloring:
```bash
iex> CodeFrame.build(myString, 5, colors: false)
4 | something
> 5 | highligh... | lib/code_frame.ex | 0.828072 | 0.75611 | code_frame.ex | starcoder |
defmodule Gyx.Environments.Gym do
@moduledoc """
This module is an API for accessing
Python OpenAI Gym methods
"""
alias Gyx.Helpers.Python
alias Gyx.Core.{Env, Exp}
alias Gyx.Core.Spaces.{Discrete, Box, Tuple}
import Gyx.Gym.Utils, only: [gyx_space: 1]
use Env
use GenServer
require Logger
defs... | lib/environments/gym/environment.ex | 0.798029 | 0.482124 | environment.ex | starcoder |
defmodule GoogleMaps.Geocode do
@moduledoc """
Perform geocoding-related lookups against the Google Maps API.
"""
use RepoCache, ttl: :timer.hours(24)
alias GoogleMaps.Geocode.Address
alias GoogleMaps.Geocode.Input
require Logger
@type t :: {:ok, nonempty_list(Address.t())} | {:error, :zero_results | ... | apps/google_maps/lib/google_maps/geocode.ex | 0.80765 | 0.574693 | geocode.ex | starcoder |
defprotocol Getypex do
@moduledoc since: "0.1.0"
@fallback_to_any true
@spec check(term) :: String.t()
def check(term)
end
defimpl Getypex, for: Tuple do
def check(_tuple), do: "Tuple"
end
defimpl Getypex, for: Integer do
def check(_integer), do: "Integer"
end
defimpl Getypex, for: Float do
def check(... | lib/typex.ex | 0.695441 | 0.406361 | typex.ex | starcoder |
defmodule Statisaur do
@moduledoc """
Statisaur - Statistics functions
This module currently contains the functions for
summary statistics.
"""
@doc """
Calculate the smallest value from a list of numbers.
### Examples
iex> Statisaur.min([1,2,3])
1
iex> Statisaur.min([5,0.5,2,3])
0.5
... | lib/statisaur.ex | 0.861334 | 0.53783 | statisaur.ex | starcoder |
defmodule Timex.DateFormat.Formatters.DefaultFormatter do
@moduledoc """
Date formatting language used by default by the `DateFormat` module.
This is a novel formatting language introduced with `DateFormat`. Its main
advantage is simplicity and usage of mnemonics that are easy to memorize.
## Directive form... | lib/dateformat/formatters/default.ex | 0.918384 | 0.832577 | default.ex | starcoder |
defmodule Grakn.Graql do
@moduledoc false
alias Grakn.Query
defmodule Datatypes do
@moduledoc false
defstruct string: :string,
long: :long,
double: :double,
boolean: :boolean,
date: :date
end
defmacro __using__([]) do
quote do
impor... | lib/grakn/graql.ex | 0.659295 | 0.430207 | graql.ex | starcoder |
defmodule Pinterex do
@moduledoc """
This is the main module of the libray. Use it to access all of the available Pinterest API calls.
## Installation and Configuration
1. Add `pinterex` to your list of dependencies in `mix.exs`.
2. Add an [application setting](https://github.com/MitjaBezensek/pinterex/blob... | lib/pinterex.ex | 0.893838 | 0.938745 | pinterex.ex | starcoder |
defmodule StarkInfra.Event do
alias __MODULE__, as: Event
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.Check
alias StarkInfra.Utils.API
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
alias StarkInfra.Utils.Parse
alias StarkInfra.CreditNote.Log, as: Credit... | lib/event/event.ex | 0.912397 | 0.557484 | event.ex | starcoder |
defmodule Resourceful.JSONAPI.Params do
@moduledoc """
Functions for converting URL parameters into `Resourceful` queries.
Additionally validates parameters when JSON:API-specific parameters are
provided such as `fields`.
While JSON:API specifically designates the format for sparse fieldsets and
sorting, f... | lib/resourceful/jsonapi/params.ex | 0.914539 | 0.716219 | params.ex | starcoder |
defmodule AirElixirSensor.Dht11 do
@moduledoc """
DHT11 sensor reader module for Raspberry.
## Examples
defmodule AirElixirSensor.Dht11.Dht11Publisher do
use AirElixirSensor.Dht11, :publisher_by_python
end
"""
def publisher_by_python do
quote do
alias AirElixirSensor.PythonErl... | lib/air_elixir_sensor/dht11/dht11.ex | 0.725065 | 0.441071 | dht11.ex | starcoder |
defmodule FileSize.Units do
@moduledoc """
A module to retrieve information about known units.
"""
alias FileSize.Bit
alias FileSize.Byte
alias FileSize.Convertible
alias FileSize.InvalidUnitError
alias FileSize.InvalidUnitSystemError
alias FileSize.Units.Info
@unit_systems [:si, :iec]
@units [... | lib/file_size/units.ex | 0.814053 | 0.527134 | units.ex | starcoder |
defmodule ExUnit.ClusteredCase.Node do
@moduledoc """
This module handles starting new nodes
You can specify various options when starting a node:
- `:name`, takes either a string or an atom, in either long or short form,
this sets the node name and id.
- `:boot_timeout`, specifies the amount of time to... | lib/node.ex | 0.861684 | 0.731898 | node.ex | starcoder |
defmodule PhoenixMarkdown do
@moduledoc """
A Markdown template engine for Phoenix. It also lets you (optionally) embed EEx tags to be evaulated on the server.
> Powered by [Earmark](https://github.com/pragdave/earmark)
## Usage
1. Add `{:phoenix_markdown, "~> 1.0"}` to your deps in `mix.exs`.
2. Ad... | lib/phoenix_markdown.ex | 0.819026 | 0.864882 | phoenix_markdown.ex | starcoder |
defmodule PrometheusTelemetry.Metrics.Ecto do
@moduledoc """
These metrics give you metrics around phoenix requests
- `ecto.query.total_time`
- `ecto.query.decode_time`
- `ecto.query.query_time`
- `ecto.query.idle_time`
"""
import Telemetry.Metrics, only: [distribution: 2]
alias Prometheus... | lib/prometheus_telemetry/metrics/ecto.ex | 0.768081 | 0.458591 | ecto.ex | starcoder |
defmodule Spherical.R1.Interval do
@moduledoc ~S"""
Represents a closed interval on ℝ¹.
"""
defstruct lo: 1.0, hi: 0.0 # Return an empty interval by default
alias __MODULE__
import Kernel, except: [length: 1]
@type t :: %Interval{lo: number, hi: number}
# API
@doc "Returns an empty interval."
... | lib/spherical/r1/interval.ex | 0.92792 | 0.803675 | interval.ex | starcoder |
defmodule Ecto.Repo do
@moduledoc """
Defines a repository.
A repository maps to an underlying data store, controlled by the
adapter. For example, Ecto ships with a Postgres adapter that
stores data into a PostgreSQL database.
When used, the repository expects the `:otp_app` and `:adapter` as
option. Th... | lib/ecto/repo.ex | 0.897332 | 0.646167 | repo.ex | starcoder |
defmodule EpicenterWeb.Test.Pages.ContactInvestigationClinicalDetails do
import ExUnit.Assertions
import Euclid.Test.Extra.Assertions, only: [assert_eq: 2]
import Phoenix.LiveViewTest
alias Epicenter.ContactInvestigations.ContactInvestigation
alias Epicenter.Test
alias EpicenterWeb.Test.Pages
alias Phoe... | test/support/pages/contact_investigation_clinical_details.ex | 0.623377 | 0.452717 | contact_investigation_clinical_details.ex | starcoder |
defmodule CodeCorps.GitHub.Adapters.Issue do
@moduledoc """
Used to adapt a GitHub Issue payload into attributes for creating or updating
a `CodeCorps.GithubIssue` and vice-versa.
"""
alias CodeCorps.{
Adapter.MapTransformer,
GitHub.Adapters.Utils.BodyDecorator,
GithubIssue,
Task
}
@gith... | lib/code_corps/github/adapters/issue.ex | 0.508788 | 0.461988 | issue.ex | starcoder |
defmodule AWS.Budgets do
@moduledoc """
The AWS Budgets API enables you to use AWS Budgets to plan your service usage,
service costs, and instance reservations.
The API reference provides descriptions, syntax, and usage examples for each of
the actions and data types for AWS Budgets.
Budgets provide you ... | lib/aws/generated/budgets.ex | 0.792464 | 0.539711 | budgets.ex | starcoder |
defmodule Annex do
@moduledoc """
Annex is a library for composing and running deep artificial
"""
alias Annex.{
Data,
Layer.Activation,
Layer.Dense,
Layer.Dropout,
Layer.Sequence,
LayerConfig,
Learner
}
@doc """
Given a list of `layers` returns a `LayerConfig` for a `Sequenc... | lib/annex.ex | 0.93276 | 0.729014 | annex.ex | starcoder |
defmodule EctoTranslate do
@moduledoc """
EctoTranslate is a library that helps with translating Ecto data. EctoTranslate can help you with returning translated values of your Ecto data attributes. For this it uses a singe table called "translations" which will contain polymorphic entries for all of your Ecto data ... | lib/ecto_translate.ex | 0.82755 | 0.483953 | ecto_translate.ex | starcoder |
defmodule Grizzly.Inclusions.InclusionRunner do
@moduledoc false
use GenServer
alias Grizzly.{Connection, Inclusions, Options, SeqNumber, Report}
alias Grizzly.Inclusions.InclusionRunner.Inclusion
alias Grizzly.Connections.AsyncConnection
alias Grizzly.ZWave.{Security, Command, DSK}
@typedoc """
At a... | lib/grizzly/inclusions/inclusion_runner.ex | 0.752649 | 0.403332 | inclusion_runner.ex | starcoder |
defmodule Kitt.Types do
@moduledoc """
Collection of custom typespec definitions for
abstracting the complexity of messages away from
the structs that define them.
"""
@type transmission_state ::
:neutral
| :park
| :forwardGears
| :reverseGears
| :reserved1... | lib/kitt/types.ex | 0.798462 | 0.646097 | types.ex | starcoder |
defmodule Copeiro do
@moduledoc """
The Copeiro package provides assertion functions that will enhance your testing experience in Elixir
"""
@doc false
def __assert_lists__(:==, left, right, any_order: true) do
left
|> Copeiro.Comparator.match_lists_in_any_order(right)
|> case do
{:error, _... | lib/copeiro.ex | 0.891746 | 0.895202 | copeiro.ex | starcoder |
defmodule CSV.Decoding.Parser do
alias CSV.EscapeSequenceError
alias CSV.StrayQuoteError
@moduledoc ~S"""
The CSV Parser module - parses tokens coming from the lexer and parses them
into a row of fields.
"""
@doc """
Parses tokens by receiving them from a sender / lexer and sending them to
the given... | lib/csv/decoding/parser.ex | 0.784567 | 0.564098 | parser.ex | starcoder |
defmodule Peerage.Via.Udp do
@moduledoc """
Use UDP multicast to find other nodes.
config :peerage, via: Peerage.Via.Udp, serves: true
ip: {0,0,0,0},
port: 45_900,
multicast_addr: {230,1,1,1}
Will both broadcast and receive node names via UDP on port 45900,
and keep track of ones... | lib/peerage/udp.ex | 0.665954 | 0.438905 | udp.ex | starcoder |
defmodule UltraDark.Validator do
alias UltraDark.Blockchain.Block
alias UltraDark.Utilities
alias UltraDark.KeyPair
alias Decimal, as: D
@moduledoc """
Responsible for implementing the consensus rules to all blocks and transactions
"""
@doc """
A block is considered valid if the index is greater... | lib/validator.ex | 0.84653 | 0.537284 | validator.ex | starcoder |
defmodule Timex.Date do
@moduledoc """
Module for working with dates.
Functions that produce time intervals use UNIX epoch (or simly Epoch) as the
default reference date. Epoch is defined as UTC midnight of January 1, 1970.
Time intervals in this module don't account for leap seconds.
Supported tasks:
... | lib/date/date.ex | 0.91467 | 0.683102 | date.ex | starcoder |
defmodule SnapFramework.Parser.Outlet do
require Logger
@moduledoc false
def run(ast, assigns) do
ast
|> parse(assigns)
end
# -----------------------------------------------
# render the list of slot component passed to the
# outlet component if it matches the slot_name
# --------------------... | lib/engine/parser/outlet.ex | 0.584983 | 0.453201 | outlet.ex | starcoder |
defmodule Circuits.SPI do
@moduledoc """
This module enables Elixir programs to interact with hardware that's connected
via a SPI bus.
"""
alias Circuits.SPI.Nif
@typedoc """
SPI bus options. See `open/2`.
"""
@type spi_option ::
{:mode, 0..3}
| {:bits_per_word, 0..16}
... | lib/spi.ex | 0.889496 | 0.696733 | spi.ex | starcoder |
defmodule Absinthe.Type.Enum.Value do
@moduledoc """
A possible value for an enum.
See `Absinthe.Type.Enum` and `Absinthe.Schema.Notation.value/1`.
"""
alias Absinthe.Type
@typedoc """
A defined enum value entry.
Generally defined using `Absinthe.Schema.Notation.value/2` as
part of a schema.
*... | lib/absinthe/type/enum/value.ex | 0.860984 | 0.561245 | value.ex | starcoder |
defmodule Excommerce.Accounts.Message do
@moduledoc """
A module for sending messages, by email or phone, to the user.
This module provides functions to be used with the Phauxth authentication
library when confirming users or handling password resets. It uses
Bamboo, with the LocalAdapter, which is a good de... | lib/excommerce/accounts/message.ex | 0.656218 | 0.475605 | message.ex | starcoder |
defmodule SenML do
@moduledoc """
Lightweight implementation of RFC 8428 Sensor Measurement Lists (SenML)
SenML Labels
+---------------+-------+------------+------------+------------+
| Name | Label | CBOR Label | JSON Type | XML Type |
+---------------+-------+------------+------------+-------... | lib/senml.ex | 0.733547 | 0.558026 | senml.ex | starcoder |
defmodule Dynamo.Template do
@moduledoc """
The template struct is responsible for keeping information about
templates to be rendered. It contains:
* `:key` - The key used to find the template;
* `:identifier` - An unique identifier for the template, like its
filesystem path. This information may be use... | lib/dynamo/templates.ex | 0.806243 | 0.580828 | templates.ex | starcoder |
defmodule SMPPEX.Pdu.ValidityPeriod do
@moduledoc ~S"""
Module for converting validity period to Unix timestamp.
Module works both with the absolute format of validity period and with the relative one.
In case of relative validity period, this module implements a naive representation of the month and year date... | lib/smppex/pdu/validity_period.ex | 0.90736 | 0.7586 | validity_period.ex | starcoder |
defmodule ClosedIntervals.Tree do
@moduledoc """
Functions to manipulate a tree of closed intervals.
Library users will often use the `ClosedIntervals` struct,
which contains a tree together with matching order and equality comparison functions.
This module contains utilities for direct manipulations on the ... | lib/closed_intervals/tree.ex | 0.901821 | 0.838018 | tree.ex | starcoder |
defmodule RulEx.Guards do
@moduledoc "Provide helper guards for use with RulEx."
@value_operands RulEx.Operands.value()
@variable_operands RulEx.Operands.variable()
@comparison_operands RulEx.Operands.comparison()
@reserved_operands RulEx.Operands.reserved()
@doc "Yield true if given expression is a valid... | lib/guards.ex | 0.796094 | 0.531209 | guards.ex | starcoder |
defmodule Oban.Cron.Expression do
@moduledoc false
@type t :: %__MODULE__{
minutes: MapSet.t(),
hours: MapSet.t(),
days: MapSet.t(),
months: MapSet.t(),
weekdays: MapSet.t()
}
defstruct [:minutes, :hours, :days, :months, :weekdays]
@dow_map %{
"SU... | lib/oban/cron/expression.ex | 0.834542 | 0.421611 | expression.ex | starcoder |
defmodule Saxy.SimpleForm do
@moduledoc ~S"""
Provides functions to parse a XML document to
[simple-form](http://erlang.org/doc/man/xmerl.html#export_simple-3) data structure.
## Data structure
Simple form is a basic representation of the parsed XML document. It contains a root
element, and all elements a... | lib/saxy/simple_form.ex | 0.893988 | 0.847842 | simple_form.ex | starcoder |
defmodule Domo.TypeEnsurerFactory.Generator.MatchFunRegistry.Tuples do
@moduledoc false
alias Domo.TypeEnsurerFactory.Precondition
alias Domo.TypeEnsurerFactory.Generator.TypeSpec
def tuple_spec?(type_spec_precond) do
{type_spec, _precond} = TypeSpec.split_spec_precond(type_spec_precond)
case type_sp... | lib/domo/type_ensurer_factory/generator/match_fun_registry/tuples.ex | 0.565539 | 0.427785 | tuples.ex | starcoder |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the Lic... | lib/adept_svg.ex | 0.914353 | 0.66884 | adept_svg.ex | starcoder |
defmodule RecurringEvents.Date do
@moduledoc """
Helper module responsible for common date manipulations.
"""
@time {0, 0, 0}
@week_days [
:monday,
:tuesday,
:wednesday,
:thursday,
:friday,
:saturday,
:sunday
]
@doc """
Shifts date by `:days`, `:weeks`, `:months` and `:year... | lib/recurring_events/date.ex | 0.884853 | 0.598723 | date.ex | starcoder |
defmodule GitGud.Maintainer do
@moduledoc """
Repository maintainer schema and helper functions.
A `GitGud.Maintainer` is used to grant `GitGud.Repo` permissions to a given `GitGud.User`.
Each repository maintainer also has a permission defining which actions he is able to perform
on the repository. Followi... | apps/gitgud/lib/gitgud/schemas/maintainer.ex | 0.836688 | 0.792785 | maintainer.ex | starcoder |
defmodule Ox.LeftistHeap do
defstruct heap: nil, leq: nil
def new(leq) when is_function(leq, 2) do
%__MODULE__{leq: leq}
end
def new(list, leq) when is_list(list) do
list
|> Enum.reduce(new(leq), fn val, acc ->
merge(new(val, leq), acc)
end)
end
def new(el, leq) do
new(leq) |> i... | lib/ox/leftist_heap.ex | 0.722331 | 0.497742 | leftist_heap.ex | starcoder |
defmodule ExcellentMigrations.Runner do
@moduledoc """
This module finds migration files in a project and detects potentially dangerous database
operations in them.
"""
alias ExcellentMigrations.{
DangersDetector,
FilesFinder
}
@type danger_type ::
:column_added_with_default
... | lib/runner.ex | 0.833663 | 0.41052 | runner.ex | starcoder |
defmodule Turbo.Ecto.Hooks.Search do
@moduledoc """
This module provides a operations that can add searching functionality to
a pipeline of `Ecto` queries. This module works by taking fields.
Inspire from: [ex_sieve](https://github.com/valyukov/ex_sieve/blob/master/lib/ex_sieve/node/grouping.ex)
"""
impor... | lib/turbo_ecto/hooks/search.ex | 0.870611 | 0.521776 | search.ex | starcoder |
defmodule Bacen.CCS.ACCS003 do
@moduledoc """
The ACCS003 message.
This message is a response from Bacen's system
about the validation of given ACCS001 message.
Also, this message reports all success and failures
from a ACCS001 message.
It has the following XML example:
```xml
<CCSArqValidcAtlzDia... | lib/bacen/ccs/accs003.ex | 0.760028 | 0.6992 | accs003.ex | starcoder |
defmodule Exercises.Chapter4.Third do
@moduledoc """
We’ve created a function that sorts the items of a list in ascending order.
Now create a Sort.descending/1 function that sorts the elements in descending order.
"""
@doc """
Sorts a list in desired order. Defaults to ascending.
Example:
iex> alias... | lang/elixir/learning-fp-with-elixir/exercises/lib/chapter4/third.ex | 0.739986 | 0.611933 | third.ex | starcoder |
defmodule LayoutOMatic.Layouts.Components.Layout do
@moduledoc """
Handles Auto-Layouts for Scenic Components.
Each Scenic component is a little different in how it's sized and positioned. While most components are positioned from it's top left most point, passing the next starting point is
a little different.... | lib/layouts/components/autolayout.ex | 0.819965 | 0.587825 | autolayout.ex | starcoder |
defmodule Membrane.RTMP.SourceBin do
@moduledoc """
Bin responsible for spawning new RTMP server.
It will receive RTMP stream from the client, parse it and demux it, outputting single audio and video which are ready for further processing with Membrane Elements.
At this moment only AAC and H264 codecs are supp... | lib/membrane_rtmp_plugin/rtmp/source/bin.ex | 0.798854 | 0.426979 | bin.ex | starcoder |
defmodule PhoenixFormAwesomplete do
alias PhoenixFormAwesomplete.GenJS
alias Phoenix.HTML
alias Phoenix.HTML.Form
@moduledoc ~S"""
PhoenixFormAwesomplete is a [Phoenix form helper](https://hexdocs.pm/phoenix_html/Phoenix.HTML.Form.html)
that utilizes Lea Verou's autocomplete / autosuggest / typeahead /
... | lib/phoenix_form_awesomplete.ex | 0.824885 | 0.684119 | phoenix_form_awesomplete.ex | starcoder |
defmodule Sippet.Core do
@moduledoc """
A behaviour module for implementing the `Sippet.Core`.
The `Sippet.Core` designates a particular type of SIP entity, i.e., specific
to either a stateful or stateless proxy, a user agent or registrar.
"""
alias Sippet.Message, as: Message
alias Sippet.Transactions,... | lib/sippet/core.ex | 0.861232 | 0.491151 | core.ex | starcoder |
defmodule Carrier do
use Application
alias Carrier.Server
@doc """
Set up the GenServer API. Should be called before usage either implicitly by
adding to `application` in `mix.exs` or explicitly by calling it directly.
"""
def start(_type, _args) do
import Supervisor.Spec, warn: false
children ... | lib/carrier.ex | 0.864925 | 0.480113 | carrier.ex | starcoder |
defmodule Redix.PubSub.Connection do
@moduledoc false
@behaviour :gen_statem
alias Redix.{ConnectionError, Protocol, Utils}
require Logger
defstruct [
:opts,
:transport,
:socket,
:continuation,
:backoff_current,
:last_disconnect_reason,
subscriptions: %{},
monitors: %{}
]... | lib/redix/pubsub/connection.ex | 0.702836 | 0.410106 | connection.ex | starcoder |
defmodule Port do
@moduledoc """
Functions related to Erlang ports.
"""
@type name :: {:spawn, charlist | binary} |
{:spawn_driver, charlist | binary} |
{:spawn_executable, charlist | atom} |
{:fd, non_neg_integer, non_neg_integer}
@doc """
Opens an Erlang p... | lib/elixir/lib/port.ex | 0.879555 | 0.512205 | port.ex | starcoder |
defmodule Stripe.Charge do
@moduledoc """
Work with [Stripe `charge` objects](https://stripe.com/docs/api#charges).
You can:
- [Create a charge](https://stripe.com/docs/api#create_charge)
- [Retrieve a charge](https://stripe.com/docs/api#retrieve_charge)
- [Update a charge](https://stripe.com/docs/api#upda... | lib/stripe/core_resources/charge.ex | 0.799951 | 0.496826 | charge.ex | starcoder |
require Utils
require Program
defmodule D14 do
@moduledoc """
--- Day 14: Space Stoichiometry ---
As you approach the rings of Saturn, your ship's low fuel indicator turns on. There isn't any fuel here, but the rings have plenty of raw material. Perhaps your ship's Inter-Stellar Refinery Union brand nanofactory ... | lib/days/14.ex | 0.761627 | 0.644854 | 14.ex | starcoder |
defmodule Commands.IntCommands do
use Memoize
alias Interp.Functions
alias Commands.GeneralCommands
require Interp.Functions
# All characters available from the 05AB1E code page, where the
# alphanumeric digits come first and the remaining characters
# ranging from 0x00 to 0xff that do not... | lib/commands/int_commands.ex | 0.684686 | 0.582699 | int_commands.ex | starcoder |
defmodule Pigpiox.Waveform do
use Bitwise
@moduledoc """
Build and send waveforms with pigpiod.
"""
@doc """
Clears all waveforms and any data added.
"""
@spec clear_all() :: :ok | {:error, atom}
def clear_all() do
case Pigpiox.Socket.command(:waveform_clear_all) do
{:ok, _} -> :ok
... | lib/pigpiox/waveform.ex | 0.870982 | 0.475118 | waveform.ex | starcoder |
defmodule MssqlexV3.Type do
@moduledoc """
Type conversions.
"""
@typedoc "Input param."
@type param ::
bitstring()
| number()
| date()
| time()
| datetime()
| Decimal.t()
@typedoc "Output value."
@type return_value ::
bitstring()
... | lib/mssqlex_v3/type.ex | 0.857291 | 0.481515 | type.ex | starcoder |
defmodule Scenic.Primitive.Transform do
@moduledoc """
Change the position, rotation, scale and more of a primitive.
Unlike html, which uses auto-layout to position items on the screen, Scenic moves primitives around using matrix transforms. This is common in video games and provides powerful control of your pr... | lib/scenic/primitive/transform/transform.ex | 0.910466 | 0.854945 | transform.ex | starcoder |
defmodule ExSDP do
@moduledoc """
This module represents the SDP Session.
Its fields directly correspond to those defined in
[RFC4566](https://tools.ietf.org/html/rfc4566#section-5)
"""
use Bunch.Access
@enforce_keys [:origin]
@optional_keys [
:email,
:encryption,
:uri,
:phone_number,... | lib/ex_sdp.ex | 0.754373 | 0.50708 | ex_sdp.ex | starcoder |
defmodule Static.NestedSet do
@moduledoc """
You can describe a tree as a `Static.NestedSet`
"""
alias Static.Folder
alias Static.Site
def populate_lnum_rnum(folder_or_site, lnum \\ 1)
def populate_lnum_rnum(%Site{} = site, lnum) do
%Site{site | lnum: lnum, rnum: lnum + 1}
end
def populate_lnu... | lib/nested_set.ex | 0.675444 | 0.595904 | nested_set.ex | starcoder |
defmodule Plug.CGI do
@moduledoc """
Primary public module for `plug_cgi`.
See [`run/1`](https://hexdocs.pm/plug_cgi/Plug.CGI.html#run/2)
below for the main entrypoint of `plug_cgi`.
This module can also be used in a supervisor since it provides a `child_spec/1`
```
children = [
{Plug.CGI, splug: MyP... | lib/plug/cgi.ex | 0.716119 | 0.738457 | cgi.ex | starcoder |
defmodule ExDebugger.Manual do
@moduledoc """
`use` `ExDebugger.Manual` provides convenience macros that users can
employ at strategic places in their code base when they feel that the
default behaviour of `use ExDebugger` is not sufficient.
Turning functionality on/off is managed by: `#{Documentation.debug_... | lib/ex_debugger/manual.ex | 0.768603 | 0.759382 | manual.ex | starcoder |
defmodule AshGraphql.Resource do
alias Ash.Changeset.ManagedRelationshipHelpers
alias Ash.Dsl.Extension
alias Ash.Query.Aggregate
alias AshGraphql.Resource
alias AshGraphql.Resource.{ManagedRelationship, Mutation, Query}
@get %Ash.Dsl.Entity{
name: :get,
args: [:name, :action],
describe: "A que... | lib/resource/resource.ex | 0.818918 | 0.697055 | resource.ex | starcoder |
defmodule Iuliia.Engine do
@moduledoc """
Engine provides main transliteration logic.
"""
@ending_length 2
@doc """
Transliterates string using chosen schema.
## Example
iex> Iuliia.translate("Юлия, съешь ещё этих мягких французских булок из Йошкар-Олы, да выпей алтайского чаю", "mvd_782")
"... | lib/iuliia/engine.ex | 0.656108 | 0.411406 | engine.ex | starcoder |
defmodule OMG.Utxo do
@moduledoc """
Manipulates a single unspent transaction output (UTXO) held be the child chain state.
"""
alias OMG.Crypto
alias OMG.State.Transaction
defstruct [:owner, :currency, :amount, :creating_txhash]
@type t() :: %__MODULE__{
creating_txhash: Transaction.tx_hash(... | apps/omg/lib/omg/utxo.ex | 0.830972 | 0.528168 | utxo.ex | starcoder |
defmodule JSONPatch do
@moduledoc ~S"""
JSONPatch is an Elixir implementation of the JSON Patch format,
described in [RFC 6902](http://tools.ietf.org/html/rfc6902).
## Examples
iex> JSONPatch.patch(%{"a" => 1}, [
...> %{"op" => "add", "path" => "/b", "value" => %{"c" => true}},
...> %{"o... | lib/json_patch.ex | 0.822439 | 0.463384 | json_patch.ex | starcoder |
defmodule ElixirLS.LanguageServer.Providers.FoldingRange.SpecialToken do
@moduledoc """
Code folding based on "special" tokens.
Several tokens, like `"..."`s, define ranges all on their own.
This module converts these tokens to ranges.
These ranges can be either `kind?: :comment` or `kind?: :region`.
"""
... | apps/language_server/lib/language_server/providers/folding_range/special_token.ex | 0.879101 | 0.425128 | special_token.ex | starcoder |
defmodule Aoc2021 do
@moduledoc """
Each function answers the puzzle for each day of [Advent of Code][1]. Each
function has doctests that solve the example input. So no spoilers in this
module. Other than the actual code that solves the puzzle of course. The code
can definitely be better as I am a novice Elix... | lib/aoc2021.ex | 0.91061 | 0.96157 | aoc2021.ex | starcoder |
defmodule Code do
defexception LoadError, file: nil do
def message(exception) do
"could not load #{exception.file}"
end
end
@moduledoc """
The Code module is responsible to manage code compilation,
code evaluation and code loading.
It complements (Erlang's code module)[1] to add behavior
w... | lib/elixir/lib/code.ex | 0.891114 | 0.535341 | code.ex | starcoder |
defmodule FnDef do
@moduledoc """
"""
defstruct [
fn_call_ast: nil,
fn_options_ast: nil
]
@doc """
Parse a function call into its parts: name and arguments
"""
def parse_fn_name_and_args({:when, _, [short_head | _]}),
do: parse_fn_name_and_args(short_head)
def parse_fn_name_and_args(sh... | lib/fn_def.ex | 0.787032 | 0.734703 | fn_def.ex | starcoder |
defmodule Digraphviz.Converter do
@moduledoc false
defmodule Document do
@moduledoc false
defstruct ~w(
digraph
subgraphs
node_converter
edge_converter
)a
end
alias Digraphviz.Types
def from(digraph) do
%Document{digraph: digraph}
end
def convert(graph, type \\ :... | lib/digraphviz/convert.ex | 0.712732 | 0.455804 | convert.ex | starcoder |
defmodule SpandexOTLP.Opentelemetry.Proto.Common.V1.AnyValue do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
value: {atom, any}
}
defstruct [:value]
oneof(:value, 0)
field(:string_value, 1, type: :string, oneof: 0)
field(:bool_value, 2, type: :bool, oneof: 0)... | lib/spandex_otlp/opentelemetry/proto/common/v1/common.pb.ex | 0.706899 | 0.527864 | common.pb.ex | starcoder |
defmodule Ash.Flow.Chart.Mermaid do
@moduledoc "Tools to render an Ash.Flow as a mermaid chart."
@opts [
expand: [
type: :boolean,
default: true,
doc: """
If the flow should be fully expanded (all `run_flow` steps will be inlined)
"""
]
]
def chart(flow, opts \\ []) do
... | lib/ash/flow/chart/mermaid.ex | 0.658088 | 0.557604 | mermaid.ex | starcoder |
defmodule Artemis.Ecto.DateMacros do
@doc """
Returns a timestamp, truncated to the given precision.
## Usage Example
Incident
|> group_by([i], [date_trunc("month", i.triggered_at)])
|> select([i], [date_trunc("month", i.triggered_at), count(i.id)])
|> Repo.all()
Returns:
[
... | apps/artemis/lib/artemis/ecto/date_macros.ex | 0.851737 | 0.478894 | date_macros.ex | starcoder |
defmodule MelodyMatch.Matchmaker.MatcherTopTrack do
@moduledoc """
Production-ready matching algorithm that matches based on
similarity of users' top tracks.
"""
@behaviour MelodyMatch.Matchmaker.MatcherBase
@maximum_diff 50
@max_location_meters 500_000
@impl true
def best_match(_, _, pool) when ma... | server/lib/melody_match/matchmaker/matcher_top_track.ex | 0.864139 | 0.503296 | matcher_top_track.ex | starcoder |
defmodule SSHTunnel do
@moduledoc ~S"""
Module for creating SSH tunnels using `:ssh`.
It provides functions to create forwarded ssh channels, similair
to how other channels can be created using `:ssh_connection`.
There are two type of channels supported
* `directtcp-ip` - Forwards a port from the client m... | lib/ssh_tunnel.ex | 0.850624 | 0.759916 | ssh_tunnel.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.