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 Ratatouille.Renderer do
@moduledoc """
Logic to render a view tree.
This API is still under development.
"""
alias Ratatouille.Renderer.{Canvas, Element}
@type root_element :: %Element{
tag: :view,
children: list(child_element())
}
@type child_tag ::
:ba... | lib/ratatouille/renderer.ex | 0.861829 | 0.677687 | renderer.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.92186 | 0.476945 | statix.ex | starcoder |
defmodule ElixirMock.Mock do
@moduledoc """
Contains functions that examine mocks and manipulate their state
"""
@typedoc """
Represents a mock.
This is the type mock creation functions like `ElixirMock.mock_of/2` and `ElixirMock.defmock_of/2` return. In reality,
these mocks are just modules with the sa... | lib/mock.ex | 0.880784 | 0.842539 | mock.ex | starcoder |
defmodule AdventOfCode.Day9 do
def read_preamble(number_list, preamble_size \\ 25) do
read_preamble(number_list, [], preamble_size)
end
def read_preamble([input | _], acc, 0) do
acc = Enum.reverse(acc)
{acc, input}
end
def read_preamble([number | rest], acc, count) do
read_preamble(rest, [nu... | lib/day9.ex | 0.500244 | 0.553204 | day9.ex | starcoder |
defmodule SteamEx.IGameServersService do
@moduledoc """
Methods to improve the administration of Steam Game Servers.
**NOTE**: This is a Service interface, methods in this interface should be called with the `input_json` parameter.
For more info on how to use the Steamworks Web API please see the [Web API Ove... | lib/interfaces/i_game_servers_service.ex | 0.728941 | 0.450662 | i_game_servers_service.ex | starcoder |
defmodule LiveMap do
@external_resource "./README.md"
@moduledoc """
#{File.read!(@external_resource)}
"""
require Logger
alias LiveMap.Tile
@doc deletegate_to: {Tile, :map, 5}
defdelegate tiles(latitude, longitude, zoom, width, height), to: Tile, as: :map
use Phoenix.LiveComponent
@impl Phoenix... | lib/live_map.ex | 0.802903 | 0.409427 | live_map.ex | starcoder |
defmodule DocuSign.Model.TemplateDocumentTabs do
@moduledoc """
"""
@derive [Poison.Encoder]
defstruct [
:approveTabs,
:checkboxTabs,
:companyTabs,
:dateSignedTabs,
:dateTabs,
:declineTabs,
:emailAddressTabs,
:emailTabs,
:envelopeIdTabs,
:firstNameTabs,
:formulaTab... | lib/docusign/model/template_document_tabs.ex | 0.530236 | 0.611672 | template_document_tabs.ex | starcoder |
defmodule Dinheiro do
@moduledoc """
[](https://travis-ci.org/ramondelemos/ex_dinheiro?branch=master)
[](https://coveralls.io/gith... | lib/dinheiro.ex | 0.90159 | 0.566438 | dinheiro.ex | starcoder |
defmodule Bonny.Server.Scheduler do
@moduledoc """
Kubernetes custom scheduler interface. Built on top of `Reconciler`.
The only function that needs to be implemented is `select_node_for_pod/2`. All others defined by behaviour have default implementations.
## Examples
Will schedule each unschedule pod wit... | lib/bonny/server/scheduler.ex | 0.867948 | 0.547283 | scheduler.ex | starcoder |
defmodule Cards do
@moduledoc """
Functions that allows the handling cards and decks
"""
@doc """
Creates a new list of strings that contains a deck of cards.
## Examples
iex> Cards.create_deck
["Ace of Spades", "Two of Spades", "Three of Spades", "Four of Spades",
"Five of Spades",... | lib/cards.ex | 0.839997 | 0.732305 | cards.ex | starcoder |
defmodule SSD1322 do
@moduledoc """
This module provides a serialized wrapper around a SSD1322.Device
"""
use GenServer
@doc """
Starts a connection to an SSD1322 with the given parameters, wrapped in a GenServer to serialize access to the device.
Returns an `{:ok, pid}` tuple where the pid is passed in... | lib/ssd1322.ex | 0.906599 | 0.739728 | ssd1322.ex | starcoder |
defmodule D12 do
@moduledoc """
--- Day 12: The N-Body Problem ---
The space near Jupiter is not a very safe place; you need to be careful of a big distracting red spot, extreme radiation, and a whole lot of moons swirling around. You decide to start by tracking the four largest moons: Io, Europa, Ganymede, and C... | lib/days/12.ex | 0.810291 | 0.860428 | 12.ex | starcoder |
defmodule ElixirMath do
@moduledoc """
Math library for Elixir.
"""
alias ElixirMath.PrimeGenerator
@doc ~S"""
Returns the arccosine of a number.
## Examples
iex> ElixirMath.acos(0.5)
1.0471975511965976
"""
@spec acos(float) :: float
def acos(x), do: :math.acos(x)
@doc ~S"""
Re... | lib/elixir_math.ex | 0.936663 | 0.653659 | elixir_math.ex | starcoder |
defmodule SpaceEx.Doc.DescribeType do
defmacro def_describe_type(pattern, one: singular, many: plural, short: short) do
quote do
defp describe_type(:one, unquote(pattern)), do: {unquote(singular), []}
defp describe_type(:many, unquote(pattern)), do: {unquote(plural), []}
defp describe_type(:shor... | lib/space_ex/doc.ex | 0.660172 | 0.434881 | doc.ex | starcoder |
defmodule Ecto.Adapters.Snowflake do
@moduledoc """
Adapter module for Snowflake.
It uses the Snowflake REST API to communicate with Snowflake, with an earlier version set for JSON.
There isn't an Elixir Arrow library (yet!), so it seems that setting an earlier Java version seems
to give us back JSON results... | lib/snowflake_elixir_ecto/adapters/snowflake.ex | 0.831109 | 0.532972 | snowflake.ex | starcoder |
defmodule Akd.Generator.Hook do
@moduledoc """
This module handles the generation of custom hooks which use `Akd.Hook`.
This can either directly be called, or called through a mix task,
`mix akd.gen.hook`.
This class uses EEx and Mix.Generator to fetch file contents from an eex
template and populate the in... | lib/akd/generator/hook.ex | 0.87397 | 0.878262 | hook.ex | starcoder |
defmodule Merkle do
@moduledoc """
`Merkle` module provides a macro implementing [Merkle Trees](https://en.wikipedia.org/wiki/Merkle_tree) in Elixir.
"""
@typedoc """
A cryptographic hash.
"""
@type hash :: String.t
@typedoc """
The hexadecimal representation of a cryptographic hash.
"""
@type ... | lib/merkle.ex | 0.85747 | 0.570391 | merkle.ex | starcoder |
defmodule ExPolars.DataFrame do
alias ExPolars.Native
alias ExPolars.Series, as: S
alias ExPolars.Plot
@type t :: ExPolars.DataFrame
@type s :: ExPolars.Series
defstruct [:inner]
@spec read_csv(
String.t(),
integer(),
integer(),
boolean(),
boolean(),
... | lib/ex_polars/dataframe.ex | 0.822973 | 0.479686 | dataframe.ex | starcoder |
defmodule Flop.Generators do
@moduledoc false
use ExUnitProperties
alias Flop.Filter
@dialyzer {:nowarn_function, [filter: 0, pagination_parameters: 1, pet: 0]}
@order_directions [
:asc,
:asc_nulls_first,
:asc_nulls_last,
:desc,
:desc_nulls_first,
:desc_nulls_last
]
@whitespace... | test/support/generators.ex | 0.604749 | 0.478407 | generators.ex | starcoder |
defmodule Exnoops.Chartbot do
@moduledoc """
Module to interact with Github's Noop: Chartbot
See the [official `noop` documentation](https://noopschallenge.com/challenges/chartbot) for API information including the accepted parameters.
"""
require Logger
import Exnoops.API
@noop "chartbot"
@doc """
... | lib/exnoops/chartbot.ex | 0.658088 | 0.513546 | chartbot.ex | starcoder |
defmodule Md0.ManualScanner do
@typep token :: {atom(), String.t, number()}
@typep tokens :: list(token)
@typep graphemes :: list(String.t)
@typep scan_info :: {atom(), graphemes(), number(), IO.chardata(), tokens()}
def scan_document(doc) do
doc
|> String.split(~r{\r\n?|\n})
|> Enum.zip(Stream.i... | lib/md0/manual_scanner.ex | 0.780537 | 0.417925 | manual_scanner.ex | starcoder |
defmodule MailSlurpAPI.Api.AttachmentController do
@moduledoc """
API calls for all endpoints tagged `AttachmentController`.
"""
alias MailSlurpAPI.Connection
import MailSlurpAPI.RequestBuilder
@doc """
Upload an attachment for sending using base64 file encoding. Returns an array whose first element i... | lib/mail_slurp_api/api/attachment_controller.ex | 0.834137 | 0.439447 | attachment_controller.ex | starcoder |
defmodule ContexSampleWeb.PageView do
use ContexSampleWeb, :view
alias Contex.{Dataset, BarChart, Plot, PointPlot, Sparkline}
def make_a_basic_bar_chart() do
%{dataset: dataset, series_cols: series_cols} = make_test_bar_data(10, 4)
plot_content = BarChart.new(dataset)
|> BarChart.set_val_col_names(s... | lib/contexsample_web/views/page_view.ex | 0.67971 | 0.537406 | page_view.ex | starcoder |
defmodule ElevatorState do
@moduledoc """
This module keeps track of and handles the state of the elevator.
The Genserver provides an API for outside functions to provide conditions for updating the state.
"""
use GenServer
@server_name :process_elevator
# Max acceptable elevator timeout [sec]
@elev_tim... | lib/state_machine.ex | 0.674587 | 0.491822 | state_machine.ex | starcoder |
defmodule Webhooks.Plugs.DBL do
@moduledoc """
Plug listening specifically for Webhooks from [Discord Bot List](http://discordbots.org)
See their [Docs](https://discordbots.org/api/docs#webhooks) for more informations.
Required for this to run are:
An entry in the config.exs or an environment varia... | lib/webhooks/plugs/dbl.ex | 0.717408 | 0.433052 | dbl.ex | starcoder |
defmodule Icon.Schema.Type do
@moduledoc """
This module defines a behaviour for schema types.
This types are compatible with `Icon.Schema` defined schemas.
## Behaviour
The behaviour is simplified version of `Ecto.Type`. The only callbacks to
implement are:
- `load/1` for loading the data from ICON 2... | lib/icon/schema/type.ex | 0.88731 | 0.904693 | type.ex | starcoder |
defmodule Petrovich do
@moduledoc """
Documentation for Petrovich.
Public interface to all the functions.
It can inflect first, middle, and last names.
## List of cases
Here's a quick reminder:
> nomenative: ΠΈΠΌΠ΅Π½ΠΈΡΠ΅Π»ΡΠ½ΡΠΉ
>
> genitive: ΡΠΎΠ΄ΠΈΡΠ΅Π»ΡΠ½ΡΠΉ
>
> dative: Π΄Π°ΡΠ΅Π»ΡΠ½ΡΠΉ
>
> accusative: Π²ΠΈΠ½ΠΈΡ... | lib/petrovich.ex | 0.842248 | 0.737229 | petrovich.ex | starcoder |
defmodule Gealts.Population do
@moduledoc """
Represents a population of chromosomes.
Exposes function for manipulating, evaluating, mutating, etc.
chromosomes.
"""
alias Gealts.Chromosome
alias Gealts.Evaluator
alias Gealts.Replicator
alias Gealts.Crossover
alias Gealts.Mutator
defstruct popula... | lib/gealts/population.ex | 0.891298 | 0.612599 | population.ex | starcoder |
defmodule NervesKey.Config do
@moduledoc """
This is a high level interface to provisioning and using the Nerves Key
or any ATECC508A/608A that can be configured similarly.
"""
alias ATECC508A.Configuration
# See README.md for the SlotConfig and KeyConfig values. These are copied verbatim.
@key_config <... | lib/nerves_key/config.ex | 0.818918 | 0.505066 | config.ex | starcoder |
defmodule QuizServer.Core.Quiz do
@moduledoc """
A quiz, consisting on a list of Questions to be answered, from a Template, that covers a list of inputs
"""
alias QuizServer.Core.{Question, Response}
@enforce_keys ~w[template inputs]a
defstruct template: nil,
remaining: [],
current... | apps/quiz_server/lib/core/quiz.ex | 0.710829 | 0.580233 | quiz.ex | starcoder |
defmodule Notion do
@moduledoc """
Notion is a thin wrapper around [`:telemetry`](https://github.com/beam-telemetry/telemetry) that defines functions that dispatch telemetry events, documentation, and specs for your applications events.
"""
@moduledoc_template """
`MODULE_NAME` is a thin wrapper around [`:te... | lib/notion.ex | 0.802091 | 0.443781 | notion.ex | starcoder |
defmodule Hexpm.Utils do
@moduledoc """
Assorted utility functions.
"""
@timeout 60 * 60 * 1000
import Ecto.Query, only: [from: 2]
alias Hexpm.Repository.{Package, Release, Repository}
require Logger
def secure_check(left, right) do
if byte_size(left) == byte_size(right) do
secure_check(lef... | lib/hexpm/utils.ex | 0.664214 | 0.444444 | utils.ex | starcoder |
defmodule Eigr.FunctionsController.Controllers.V1.Function do
@moduledoc """
Eigr.FunctionsController.Controllers.V1.Function: Function CRD.
## Kubernetes CRD Spec
Eigr Function CRD
### Examples
```yaml
---
apiVersion: functions.eigr.io/v1
kind: Function
metadata:
name: shopping-cart # Mandator... | lib/eigr_functions_controller/controllers/v1/function.ex | 0.894167 | 0.643917 | function.ex | starcoder |
defmodule Pummpcomm.Session.Tuner do
@moduledoc """
This module is responsible for scanning the known US or WW pump frequencies and searching for the best one for a given
pump. It samples 5 times in each of the 25 frequency steps within the range and measures the average rssi. The
frequency which results in 5 s... | lib/pummpcomm/session/tuner.ex | 0.744656 | 0.52829 | tuner.ex | starcoder |
defmodule Crutches.Format.Number do
alias Crutches.Option
@moduledoc ~s"""
Formatting helper functions for numbers.
This module contains various helper functions that should be of use to you
when writing user interfaces or other parts of your application that have
to deal with number formatting.
Simply... | lib/crutches/format/number.ex | 0.895967 | 0.506713 | number.ex | starcoder |
defmodule EWallet.TransferGate do
@moduledoc """
Handles the logic for a transfer of value between two addresses.
"""
alias EWallet.TransferFormatter
alias LocalLedger.Entry
alias EWalletDB.Transfer
@doc """
Gets or inserts a transfer using the given idempotency token and other given attributes.
## ... | apps/ewallet/lib/ewallet/gates/transfer_gate.ex | 0.782455 | 0.403949 | transfer_gate.ex | starcoder |
defmodule ZipZip do
@moduledoc File.read!("README.md")
@initial_position -1
@enforce_keys [:l, :r, :current, :size]
# credo:disable-for-next-line
defstruct @enforce_keys ++ [position: @initial_position]
@opaque t :: %__MODULE__{
l: [term] | [],
current: term,
r: [term]... | lib/zipper.ex | 0.826011 | 0.527377 | zipper.ex | starcoder |
defmodule Parallel do
@moduledoc """
This module contains some often-needed variants of Elixir's `Enum`
functions, naively implemented as concurrent variants. Every `List` item
will be processed in a separate erlang process, so use this only if the
individual task takes longer than a simple calculatio... | lib/parallel.ex | 0.855399 | 0.635915 | parallel.ex | starcoder |
defmodule MetarMap.LdrSensor do
use GenServer
alias MetarMap.Gpio
# The duration to force 0 output to discharge the capacitor
@pulse_duration_ms 100
# The duration after the pulse to wait for a rising edge
@read_duration_ms 600
# Process to notify of LDR changes
@notify_server MetarMap.StripControll... | lib/metar_map/ldr_sensor.ex | 0.705886 | 0.468061 | ldr_sensor.ex | starcoder |
defmodule Asteroid.Token.AuthorizationCode do
import Asteroid.Utils
alias Asteroid.Context
alias Asteroid.Client
alias Asteroid.Token
@moduledoc """
Authorization code structure
## Field naming
The `data` field holds the token data. The following field names are standard and are used
by Asteroid:
... | lib/asteroid/token/authorization_code.ex | 0.907994 | 0.62309 | authorization_code.ex | starcoder |
defmodule Honeybee do
@moduledoc """
A `Honeybee` router provides a DSL (Domain specific language) for defining http routes and pipelines.
Using Honeybee inside a module will make that module pluggable.
When called The module will attempt to match the incoming request to the routes defined inside the router.
... | lib/honeybee.ex | 0.926678 | 0.874507 | honeybee.ex | starcoder |
defmodule Game.Board do
@moduledoc """
Board struct definition and utility functions to work with them.
"""
alias __MODULE__
alias GameError.BadSize
@typedoc """
Walkable board cell
"""
@type tile :: {non_neg_integer(), non_neg_integer()}
@typedoc """
Cell where heroes cannot walk in.
"""
@... | apps/heroes_server/lib/game/board.ex | 0.908552 | 0.6702 | board.ex | starcoder |
defmodule HoneylixirTracing.Propagation do
@moduledoc """
Module responsible for enabling trace propagation.
Propagation can be used to pass trace information between Processes within the
same application or serialized to be sent to other services for distributed tracing.
"""
defstruct [:dataset, :trace_i... | lib/honeylixir_tracing/propagation.ex | 0.715225 | 0.403244 | propagation.ex | starcoder |
defmodule Kantele.MiniMap.Connections do
@moduledoc """
Struct for tracking if a cell has a connection to another node
"""
@derive Jason.Encoder
defstruct [:north, :south, :east, :west, :up, :down]
end
defmodule Kantele.MiniMap.Cell do
@moduledoc """
Cell of the MiniMap
Tracks a room's position and w... | lib/kantele/mini_map.ex | 0.809653 | 0.663616 | mini_map.ex | starcoder |
defmodule PhoenixIntegration.Form.TreeCreation do
@moduledoc false
# The code in this module converts a Floki representation of an HTML
# form into a tree structure whose leaves are Tags: that is, descriptions
# of a form tag that can provide values to POST-style parameters.
# See [DESIGN.md](./DESIGN.md) fo... | lib/phoenix_integration/form/tree_creation.ex | 0.722233 | 0.454714 | tree_creation.ex | starcoder |
defprotocol ForgeSdk.Display do
@moduledoc """
Display protocol. This is to show the data structure in various places.
"""
@fallback_to_any true
@type t :: ForgeSdk.Display.t()
@doc """
Convert a data structure to
"""
@spec display(t(), boolean()) :: any()
def display(data, expand? \\ false)
end
... | lib/forge_sdk/protocol/display.ex | 0.628293 | 0.483466 | display.ex | starcoder |
defmodule Generator do
@moduledoc false
@units [:year, :month, :week, :day, :hour, :minute, :second, :millisecond, :microsecond]
@calendars [
Calendar.ISO,
Cldr.Calendar.Coptic
# Use Cldr.Calendar.Ethiopic again when a new version of the package is released.
# Cldr.Calendar.Ethiopic
]
def na... | test/support/generator.ex | 0.789234 | 0.781664 | generator.ex | starcoder |
defmodule Rambla do
@moduledoc """
Interface for the message publishing through `Rambla`.
`Rambla` maintains connection pools with a dynamix supervisor.
It might be read from the config _or_ passed as a parameter in a call to
`Rambla.start_pools/1`. The latter expects a keyword list of pools to add,
each d... | lib/rambla.ex | 0.892539 | 0.619989 | rambla.ex | starcoder |
defmodule LocalBroadcast.Broadcaster do
@moduledoc """
Broadcasts the presence of this MCAM on the local network as
a UDP multicast every 15 seconds. Also listens for such broadcasts and
records them in the `LocalBroadcast.McamPeerRegisterEntry`.
There seems to be an occasional issue with the socket not rec... | apps/local_broadcast/lib/local_broadcast/broadcaster.ex | 0.684264 | 0.430506 | broadcaster.ex | starcoder |
defmodule Sanity.Components.Image do
@moduledoc """
For rendering a [Sanity image asset](https://www.sanity.io/docs/assets).
## Examples
use Phoenix.Component
# ...
# Example of image asset returned by Sanity CMS API
assigns = %{
image: %{
_id: "image-da994d9e87efb226... | lib/sanity/components/image.ex | 0.892938 | 0.613729 | image.ex | starcoder |
defmodule Zaryn.PubSub do
@moduledoc """
Provide an internal publish/subscribe mechanism to be aware of the new transaction in the system.
This PubSub is used for each application which deals with new transaction enter after validation,
helping to rebuild their internal state and fast read-access (as an in mem... | lib/zaryn/pub_sub.ex | 0.822973 | 0.403743 | pub_sub.ex | starcoder |
defmodule Farmbot.Regimen.NameProvider do
@moduledoc """
Provides global names for running regimens as started by the
RegimenSupervisor.
# Example
```
%Regimen{} = reg = Farmbot.Asset.get_regimen_by_id(123, 100)
via = Farmbot.Regimen.NameProvider.via(reg)
pid = GenServer.whereis(via)
```
"""
... | lib/farmbot/regimen/name_provider.ex | 0.712832 | 0.770896 | name_provider.ex | starcoder |
defmodule Api.PINGenerator do
@moduledoc """
GenServer for generating PIN's
"""
@enforce_keys [:available]
defstruct available: nil, taken: MapSet.new()
@type t :: %__MODULE__{available: MapSet.t(), taken: MapSet.t()}
@num_digits 4
@range 0..((:math.pow(10, @num_digits) |> round()) - 1)
@max_num_pi... | api/lib/api/pin_generator.ex | 0.829077 | 0.435841 | pin_generator.ex | starcoder |
defmodule Day21 do
def part_one() do
boss = %Day21.Player{hit_points: 103, damage: 9, armor: 2}
outfits()
|> Enum.sort_by(&cost_of/1)
|> Enum.find(fn outfit ->
player = Enum.reduce(outfit, %Day21.Player{hit_points: 100, damage: 0, armor: 0}, fn item, player -> Day21.Player.add_item(player, item... | year_2015/lib/day_21.ex | 0.540196 | 0.483526 | day_21.ex | starcoder |
defmodule Adventofcode2018.Six do
import NimbleParsec
coordinate =
integer(min: 1)
|> ignore(string(", "))
|> integer(min: 1)
defparsecp(:coordinate, coordinate)
@file_lines File.read!("data/6.txt")
|> String.split("\n", trim: true)
def first do
coordinates = coordinates()
... | lib/six.ex | 0.652352 | 0.55429 | six.ex | starcoder |
defmodule Game.Format.Template do
@moduledoc """
Template a string with variables
"""
@doc """
Render a template with a context
Variables are denoted with `[key]` in the template string. You can also
include leading spaces that can be collapsed if the variable is nil or does
not exist in the context.
... | lib/game/format/template.ex | 0.890795 | 0.419886 | template.ex | starcoder |
defmodule Tensorflow.NewReplaySession do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
devices: Tensorflow.ListDevicesResponse.t() | nil,
session_handle: String.t()
}
defstruct [:devices, :session_handle]
field(:devices, 1, type: Tensorflow.ListDevicesRes... | lib/tensorflow/core/protobuf/replay_log.pb.ex | 0.814238 | 0.582105 | replay_log.pb.ex | starcoder |
defmodule OMG.Performance.ByzantineEvents.Generators do
@moduledoc """
Provides helper functions to generate spenders for perftest,
Streams transactions, utxo positions and blocks using data from Watcher.
"""
alias OMG.Eth
alias OMG.Eth.RootChain
alias OMG.State.Transaction
alias OMG.Utxo
alias OMG.... | apps/omg_performance/lib/omg_performance/byzantine_events/generators.ex | 0.849222 | 0.401189 | generators.ex | starcoder |
defmodule EctoExtras.Repo do
@moduledoc """
Helper functions for Ecto.Repo
"""
require Ecto.Query
defmacro __using__(opts) do
quote bind_quoted: [opts: opts] do
def first(queryable, order_by \\ nil)
def first(queryable, order_by) do
queryable |> Ecto.Query.first(order_by) |> one()
... | lib/ecto_extras/repo.ex | 0.854445 | 0.57687 | repo.ex | starcoder |
defmodule Protobuf.JSON.Encode do
@moduledoc false
alias Protobuf.JSON.{EncodeError, Utils}
@compile {:inline,
encode_field: 3,
encode_key: 2,
maybe_repeat: 3,
encode_float: 1,
encode_enum: 3,
safe_enum_key: 2}
@doc false
@spec to_enco... | lib/protobuf/json/encode.ex | 0.605566 | 0.408336 | encode.ex | starcoder |
defmodule Logger.Utils do
@moduledoc false
@doc """
Truncates a `chardata` into `n` bytes.
There is a chance we truncate in the middle of a grapheme
cluster but we never truncate in the middle of a binary
code point. For this reason, truncation is not exact.
"""
@spec truncate(IO.chardata(), non_neg_i... | lib/logger/lib/logger/utils.ex | 0.834306 | 0.584508 | utils.ex | starcoder |
defmodule Plug.Parsers.MULTIPART do
@moduledoc """
Parses multipart request body.
## Options
All options supported by `Plug.Conn.read_body/2` are also supported here.
They are repeated here for convenience:
* `:length` - sets the maximum number of bytes to read from the request,
defaults to 8_000... | lib/plug/parsers/multipart.ex | 0.793986 | 0.480174 | multipart.ex | starcoder |
defmodule ExSieve.Config do
@moduledoc """
Struct with `ExSieve` configuration options.
"""
defstruct ignore_errors: true, max_depth: :full, except_predicates: nil, only_predicates: nil
@typedoc """
`ExSieve` configuration options:
* `:ignore_errors` - when `true` recoverable errors are ignored. Reco... | lib/ex_sieve/config.ex | 0.896791 | 0.618795 | config.ex | starcoder |
defmodule Gyx.Trainers.TrainerSarsa do
@moduledoc """
This module describes an entire training process,
tune accordingly to your particular environment and agent
"""
use GenServer
alias Gyx.Core.Exp
require Logger
@enforce_keys [:environment, :agent]
defstruct env_name: nil, environment: nil, agent:... | lib/trainers/trainer_sarsa.ex | 0.841744 | 0.593727 | trainer_sarsa.ex | starcoder |
defmodule Serum.TemplateLoader do
@moduledoc """
This module handles template loading and preprocessing.
"""
import Serum.Util
alias Serum.Build
alias Serum.Error
alias Serum.Renderer
@type state :: Build.state
@doc """
Reads, compiles, and preprocesses the site templates.
May return a new sta... | lib/serum/template_loader.ex | 0.70477 | 0.425605 | template_loader.ex | starcoder |
defmodule Ash.Notifier.PubSub do
@publish %Ash.Dsl.Entity{
name: :publish,
target: Ash.Notifier.PubSub.Publication,
describe: """
Configure a given action to publish its results over a given topic.
If you have multiple actions with the same name (only possible if they have different types),
u... | lib/ash/notifier/pub_sub/pub_sub.ex | 0.899484 | 0.863852 | pub_sub.ex | starcoder |
defmodule BggXmlApi2.Item do
@moduledoc """
A set of functions for searching and retrieving information on Items.
"""
import SweetXml
alias BggXmlApi2.Api, as: BggApi
@enforce_keys [:id, :name, :type, :year_published]
defstruct [
:id,
:name,
:type,
:year_published,
:image,
:thu... | lib/bgg_xml_api2/item.ex | 0.749637 | 0.455925 | item.ex | starcoder |
defmodule Membrane.Element.Action do
@moduledoc """
This module contains type specifications of actions that can be returned
from element callbacks.
Returning actions is a way of element interaction with
other elements and parts of framework. Each action may be returned by any
callback (except for `c:Membr... | lib/membrane/element/action.ex | 0.920486 | 0.521776 | action.ex | starcoder |
defmodule Stripe.StripeCase do
@moduledoc """
This module defines the setup for tests requiring access to a mocked version of Stripe.
"""
use ExUnit.CaseTemplate
def assert_stripe_requested(expected_method, path, extra \\ []) do
expected_url = build_url(path, Keyword.get(extra, :query))
expected_bod... | test/support/stripe_case.ex | 0.805403 | 0.45308 | stripe_case.ex | starcoder |
defmodule Radex.Writer.JSON.Example do
@moduledoc """
Generate example files
"""
alias Radex.Writer
alias Radex.Writer.Example
@behaviour Example
@doc """
Generate and write the example files
"""
@spec write(map, Path.t()) :: :ok
@impl Radex.Writer.Example
def write(metadata, path) do
met... | lib/radex/writer/json/example.ex | 0.782621 | 0.441553 | example.ex | starcoder |
defmodule JOSE do
@moduledoc ~S"""
JOSE stands for JSON Object Signing and Encryption which is a is a set of
standards established by the [JOSE Working Group](https://datatracker.ietf.org/wg/jose).
JOSE is split into 5 main components:
* `JOSE.JWA` - JSON Web Algorithms (JWA) [RFC 7518](https://tools.ietf... | backend/deps/jose/lib/jose.ex | 0.89295 | 0.776114 | jose.ex | starcoder |
defmodule Artour.Public do
@moduledoc """
The Public context.
"""
import Ecto.Query, warn: false
alias Artour.Repo
alias Artour.Post
alias Artour.Tag
alias Artour.Category
# alias Artour.Image
alias Artour.PostImage
# alias Artour.PostTag
@doc """
Returns the list of posts.
"""
def list... | apps/artour/lib/artour/public/public.ex | 0.712332 | 0.414129 | public.ex | starcoder |
defmodule Ockam.Protocol do
@moduledoc """
Message payload protocol definition and helper functions
See Ockam.Protocol.Stream and Ockam.Stream.Workers.Stream for examples
"""
alias Ockam.Bare.Extended, as: BareExtended
@enforce_keys [:name]
defstruct [:name, :request, :response]
@type extended_schema(... | implementations/elixir/ockam/ockam/lib/ockam/protocol/protocol.ex | 0.870831 | 0.480783 | protocol.ex | starcoder |
defmodule NodePing.Accounts do
@moduledoc """
Manage your NodePing account and subaccounts
"""
import NodePing.HttpRequests
import NodePing.Helpers
@api_url "https://api.nodeping.com/api/1"
@doc """
Get information about your NodePing account or subaccount
## Parameters
- `token` - NodePing API... | lib/accounts.ex | 0.828973 | 0.450541 | accounts.ex | starcoder |
defmodule EctoHomoiconicEnum do
@moduledoc """
Support for defining enumerated types.
See `EctoHomoiconicEnum.defenum/2` for usage.
"""
defmodule ConflictingTypesError do
defexception [:message]
def exception({module, mappings}) do
if expected = prominent(histogram(mappings)) do
confl... | lib/ecto_homoiconic_enum.ex | 0.878594 | 0.546315 | ecto_homoiconic_enum.ex | starcoder |
defmodule RallyApi.RallyCollection do
import RallyApi
import RallyApi.Rallyties, only: [collectable_types: 0, wrap_attributes_with_rally_type: 2]
alias RallyApi.OperationResult
@doc """
Returns the collection specified for the given artifact
## Examples:
```
RallyApi.RallyCollection.read(client, "h... | lib/rally_api/rally_collection.ex | 0.818628 | 0.845113 | rally_collection.ex | starcoder |
defmodule FloUI.Icon.Button do
@moduledoc """
## Usage in SnapFramework
Render a button with an icon.
data is a string for the tooltip.
``` elixir
<%= component FloUI.Icon.Button,
"tooltip text",
id: :btn_icon
do %>
<%= component FloUI.Icon,
{:flo_ui, "path_to_icon"}
%>
<%... | lib/icons/icon_button/icon_button.ex | 0.701611 | 0.477189 | icon_button.ex | starcoder |
defmodule ZXCVBN.TimeEstimates do
@moduledoc """
Calculate various attacking times
"""
def estimate_attack_times(guesses) do
crack_times_seconds = %{
online_throttling_100_per_hour: guesses / (100 / 3600),
online_no_throttling_10_per_second: guesses / 10,
offline_slow_hashing_1e4_per_seco... | lib/zxcvbn/time_estimates.ex | 0.676406 | 0.453625 | time_estimates.ex | starcoder |
defmodule Ofex do
alias Ofex.{BankAccount, CreditCardAccount, InvalidData, Signon, SignonAccounts}
import SweetXml
require Logger
@moduledoc """
Documentation for Ofex.
"""
@doc """
Validates and parses Open Financial Exchange (OFX) data.
`data` will need to be supplied as a string. Each message se... | lib/ofex.ex | 0.735547 | 0.472683 | ofex.ex | starcoder |
defmodule Crawly.DataStorage do
@moduledoc """
Data Storage, is a module responsible for storing crawled items.
On the high level it's possible to represent the architecture of items
storage this way:
ββββββββββββββββββββ
β β β------------------β
... | lib/crawly/data_storage/data_storage.ex | 0.583559 | 0.564158 | data_storage.ex | starcoder |
defmodule EQC.Pulse do
@copyright "Quviq AB, 2014-2016"
@moduledoc """
This module defines macros for using Quviq PULSE with Elixir. For more
information about the compiler options see the QuickCheck documentation.
See also the [`pulse_libs`](http://hex.pm/packages/pulse_libs) package for
instrumented ver... | lib/eqc/pulse.ex | 0.821188 | 0.483587 | pulse.ex | starcoder |
defmodule AWS.CodeStar do
@moduledoc """
AWS CodeStar
This is the API reference for AWS CodeStar.
This reference provides descriptions of the operations and data types for the
AWS CodeStar API along with usage examples.
You can use the AWS CodeStar API to work with:
Projects and their resources, by c... | lib/aws/generated/code_star.ex | 0.86212 | 0.582075 | code_star.ex | starcoder |
defmodule Mpesa do
@moduledoc """
Documentation for `Mpesa`.
"""
@doc false
def get_url do
if Application.get_env(:mpesa, :env) === "sandbox" do
"https://sandbox.safaricom.co.ke"
else
"https://api.safaricom.co.ke"
end
end
@doc false
def authorize do
url = get_url() <> "/oau... | lib/mpesa.ex | 0.713831 | 0.488283 | mpesa.ex | starcoder |
defmodule BikeBrigade.Locations.Location do
use BikeBrigade.Schema
import Ecto.Changeset
alias BikeBrigade.Geocoder
alias BikeBrigade.Locations.LocationNeighborhood
@fields [:coords, :address, :city, :postal, :province, :country, :unit, :buzzer]
@user_provided_fields [:address, :unit, :buzzer]
schema "... | lib/bike_brigade/locations/location.ex | 0.758958 | 0.434701 | location.ex | starcoder |
defmodule Accounting.Account do
@moduledoc """
An account data structure and functions.
"""
alias Accounting.AccountTransaction
@type setup :: %__MODULE__{
number: account_number,
description: String.t,
conversion_balance: integer,
}
@opaque t :: %__MODULE__{
number: account_number,
... | lib/accounting/account.ex | 0.832373 | 0.486575 | account.ex | starcoder |
defmodule Aecore.Tx.SignedTx do
@moduledoc """
Module defining the Signed transaction
"""
alias Aecore.Account.Account
alias Aecore.Chain.{Chainstate, Identifier}
alias Aecore.Keys
alias Aecore.Tx.{DataTx, SignedTx}
alias Aeutil.{Bits, Hash, Serialization}
require Logger
@typedoc "Structure of th... | apps/aecore/lib/aecore/tx/signed_tx.ex | 0.882807 | 0.414069 | signed_tx.ex | starcoder |
defmodule LoadedBike.Waypoint do
use LoadedBike.Web, :model
# is_current, is_previous, url are virtual attrs we populate on the view
@derive {Poison.Encoder, only: [:title, :lat, :lng, :is_current, :is_previous, :is_finish, :url]}
schema "waypoints" do
field :title, :string
field :description,... | lib/loaded_bike/models/waypoint.ex | 0.656548 | 0.571886 | waypoint.ex | starcoder |
defmodule BigchaindbEx.Transaction.Output do
@moduledoc """
Represents a transaction output.
"""
alias BigchaindbEx.{Fulfillment, Crypto}
alias BigchaindbEx.Fulfillment.Ed25519Sha512
@max_amount :math.pow(9 * 10, 18)
@enforce_keys [:amount, :public_keys, :fulfillment]
@type t :: %__MODULE__{
am... | lib/bigchaindb_ex/transaction/output.ex | 0.873066 | 0.471406 | output.ex | starcoder |
defmodule HPAX do
@moduledoc """
Support for the HPACK header compression algorithm.
This module provides support for the HPACK header compression algorithm used mainly in HTTP/2.
## Encoding and decoding contexts
The HPACK algorithm requires both
* an encoding context on the encoder side
* a deco... | lib/hpax.ex | 0.904033 | 0.650578 | hpax.ex | starcoder |
defmodule ExLimiter.Storage.PG2Shard.Worker do
@moduledoc """
Simple Genserver for implementing the `ExLimiter.Storage` behavior for a set
of buckets.
Buckets are pruned after 10 minutes of inactivity, and buckets will be evicted
if a maximum threshold is reached. To tune these values, use:
```
config ... | lib/ex_limiter/storage/pg2_shard/worker.ex | 0.837088 | 0.861945 | worker.ex | starcoder |
defmodule Phoenix.Endpoint do
@moduledoc """
Defines a Phoenix endpoint.
The endpoint is the boundary where all requests to your
web application start. It is also the interface your
application provides to the underlying web servers.
Overall, an endpoint has three responsibilities:
* to provide a wra... | lib/phoenix/endpoint.ex | 0.922229 | 0.448306 | endpoint.ex | starcoder |
defmodule AWS.ElastiCache do
@moduledoc """
Amazon ElastiCache
Amazon ElastiCache is a web service that makes it easier to set up, operate, and
scale a distributed cache in the cloud.
With ElastiCache, customers get all of the benefits of a high-performance,
in-memory cache with less of the administrativ... | lib/aws/generated/elasticache.ex | 0.827061 | 0.611469 | elasticache.ex | starcoder |
defmodule Membrane.BlankVideoGenerator do
@moduledoc """
Element responsible for generating black screen as raw video.
"""
use Membrane.Source
alias Membrane.Caps.Matcher
alias Membrane.RawVideo
alias Membrane.{Buffer, Time}
@supported_caps {RawVideo, pixel_format: Matcher.one_of([:I420, :I422]), ali... | lib/blank_video_generator.ex | 0.885916 | 0.414306 | blank_video_generator.ex | starcoder |
defmodule TerraeMagnitudem.Measurements do
use GenServer
## ------------------------------------------------------------------
## Attribute Definitions
## ------------------------------------------------------------------
@server __MODULE__
@samples_table TerraeMagnitudem.Measurements.Samples
@number_of... | lib/terrae_magnitudem/measurements.ex | 0.570331 | 0.592224 | measurements.ex | starcoder |
defmodule Conceal do
@moduledoc """
Provides an easy way to encrypt and decrypt a string using the AES-CBC-256 algorithm.
It runs roughly this functions in order to return a encrypt base64-encoded string:
`base64(iv + aes_cbc256(sha256(key), iv, data))`
## Usage
```elixir
key = "my_secret_key"
data =... | lib/conceal.ex | 0.8415 | 0.866754 | conceal.ex | starcoder |
defmodule Exmqttc do
use GenServer
@moduledoc """
`Exmqttc` provides a connection to a MQTT server based on [emqttc](https://github.com/emqtt/emqttc)
"""
@typedoc """
A PID like type
"""
@type pidlike :: pid() | port() | atom() | {atom(), node()}
@typedoc """
A QoS level
"""
@type qos :: :qos... | lib/exmqttc.ex | 0.844232 | 0.433262 | exmqttc.ex | starcoder |
defmodule List do
# This avoids crashing the compiler at build time
@compile {:autoload, false}
@moduledoc """
Linked lists hold zero, one, or more elements in the chosen order.
Lists in Elixir are specified between square brackets:
iex> [1, "two", 3, :four]
[1, "two", 3, :four]
Two lists c... | libs/exavmlib/lib/List.ex | 0.893338 | 0.696568 | List.ex | starcoder |
defmodule Imago do
def test_image() do
(
__ENV__.file
|> Path.dirname) <> "/../test_image.jpg"
end
@doc """
Since we use a 8x8 image, doctests would be polluted with
lists of 4 * 64 integers. This ensures validity and conciseness.
The real methods do return a list of integers.
"""
def s... | lib/imago.ex | 0.786049 | 0.535038 | imago.ex | starcoder |
defmodule Sanbase.Signal.Trigger.TrendingWordsTriggerSettings do
@moduledoc ~s"""
Trigger settings for trending words signal.
The signal supports the following operations:
1. Send the list of trending words at predefined time every day
2. Send a signal if some word enters the list of trending words.
3. Se... | lib/sanbase/signals/trigger/settings/trending_words_trigger_settings.ex | 0.818047 | 0.668312 | trending_words_trigger_settings.ex | starcoder |
defmodule AWS.ECR do
@moduledoc """
Amazon Elastic Container Registry
Amazon Elastic Container Registry (Amazon ECR) is a managed container image
registry service.
Customers can use the familiar Docker CLI, or their preferred client, to push,
pull, and manage images. Amazon ECR provides a secure, scalabl... | lib/aws/generated/ecr.ex | 0.893878 | 0.526404 | ecr.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.