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 Phoenix.PubSub.PG2 do @moduledoc """ Phoenix PubSub adapter based on `:pg`/`:pg2`. It runs on Distributed Erlang and is the default adapter. """ @behaviour Phoenix.PubSub.Adapter use Supervisor ## Adapter callbacks @impl true def node_name(_), do: node() @impl true def broadcast(ada...
lib/phoenix/pubsub/pg2.ex
0.730578
0.406567
pg2.ex
starcoder
defmodule Infusionsoft.Endpoints.XML.Data do @moduledoc """ Provides the raw endpoints to Infusionsoft's XML API for Data actions. """ alias Infusionsoft.Endpoints.XML.Helpers @doc """ https://developer.infusionsoft.com/docs/xml-rpc/#data-query-a-data-table Available options: page - defaults to 0 li...
lib/infusionsoft/endpoints/xml/data.ex
0.846673
0.40928
data.ex
starcoder
defmodule ExWeb3EcRecover.SignedType.Message do @moduledoc """ This module represents a message data structure that is used to sign and recover, based on EIP 712. ## Domain For details look at this [website](https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator). ``` - string name the use...
lib/ex_web3_ec_recover/signed_type/message.ex
0.854384
0.871201
message.ex
starcoder
defmodule Cldr.Message do @moduledoc """ Implements the [ICU Message Format](http://userguide.icu-project.org/formatparse/messages) with functions to parse and interpolate messages. """ alias Cldr.Message.{Parser, Interpreter, Print} import Kernel, except: [to_string: 1, binding: 1] defdelegate format_li...
lib/cldr/messages/messages.ex
0.885786
0.531878
messages.ex
starcoder
defmodule Sparklinex.Smooth do alias Sparklinex.ChartData alias Sparklinex.MogrifyDraw alias Sparklinex.Smooth.Options def draw( data, spec = %Options{height: height, background_color: bk_color, line_color: line_color} ) do spec_with_width = %{spec | width: width(data, spec)} norm...
lib/sparklinex/smooth.ex
0.674587
0.565599
smooth.ex
starcoder
defmodule Elixlsx.Util do alias Elixlsx.XML @col_alphabet Enum.to_list(?A..?Z) @doc ~S""" Returns the column letter(s) associated with a column index. Col idx starts at 1. ## Examples iex> encode_col(1) "A" iex> encode_col(28) "AB" """ @spec encode_col(non_neg_integer) :: S...
lib/elixlsx/util.ex
0.80213
0.497742
util.ex
starcoder
defmodule Mix.Tasks.Check do @moduledoc """ One task to efficiently run all code analysis & testing tools in an Elixir project. ## Tools Task comes out of the box with a rich predefined set of curated tools that are considered to be reasonable additions for most Elixir and Phoenix projects which care about ...
lib/mix/tasks/check.ex
0.85443
0.738103
check.ex
starcoder
defmodule StarkInfra do @moduledoc """ SDK to facilitate Elixir integrations with the Stark Infra API v2. """ alias StarkInfra.Project alias StarkInfra.Organization alias StarkInfra.Utils.Check @doc """ The Project struct is an authentication entity for the SDK that is permanently linked to a speci...
lib/starkinfra.ex
0.808748
0.709346
starkinfra.ex
starcoder
defmodule Problem.Data do alias Problem.CmplFile require EEx defstruct [:profits, :capacities, :costs] @type t :: %__MODULE__{ profits: profits, capacities: capacities, costs: costs } @type profits :: [pos_integer] @type capacities :: [pos_integer] @type costs :: [[pos_integer]] @templ...
apps/problem/lib/problem/data.ex
0.768473
0.483526
data.ex
starcoder
defmodule Engine.DB.Transaction.PaymentV1.Validator.Witness do @moduledoc """ Contains validation logic for signatures, see validate/2 for more details. """ alias Engine.DB.Transaction.PaymentV1.Type alias ExPlasma.Crypto @type validation_result_t() :: :ok | {:error, {:witnesses, :supe...
apps/engine/lib/engine/db/transaction/payment_v1/validators/witness.ex
0.894133
0.483405
witness.ex
starcoder
defmodule Ecto.Function do @moduledoc """ Helper macro for defining helper macros for calling DB functions. A little Xzibity, but helps. """ @doc ~S""" Define new SQL function call. ## Options Currently there is only one option allowed: - `for` - define DB function name to call ## Examples ...
lib/ecto_function.ex
0.768429
0.429609
ecto_function.ex
starcoder
defmodule Prometheus.Metric.Gauge do @moduledoc """ Gauge metric, to report instantaneous values. Gauge is a metric that represents a single numerical value that can arbitrarily go up and down. A Gauge is typically used for measured values like temperatures or current memory usage, but also "counts" that ...
astreu/deps/prometheus_ex/lib/prometheus/metric/gauge.ex
0.924637
0.856092
gauge.ex
starcoder
defmodule Grouper.Data do @moduledoc """ uniform data layer for groups of processes """ require Ex2ms alias Grouper.Ident alias Grouper.Data.App alias Grouper.Data.Group @type opts :: keyword() @type type() :: atom() @type key() :: any() @type value() :: any() @type t :: %__MODULE__{ ...
lib/grouper/data.ex
0.846197
0.453201
data.ex
starcoder
defmodule AWS.MarketplaceMetering do @moduledoc """ AWS Marketplace Metering Service This reference provides descriptions of the low-level AWS Marketplace Metering Service API. AWS Marketplace sellers can use this API to submit usage data for custom usage dimensions. For information on the permissions...
lib/aws/generated/marketplace_metering.ex
0.907621
0.571348
marketplace_metering.ex
starcoder
defmodule Mojito.Headers do @moduledoc ~S""" Functions for working with HTTP request and response headers, as described in the [HTTP 1.1 specification](https://www.w3.org/Protocols/rfc2616/rfc2616.html). Headers are represented in Elixir as a list of `{"header_name", "value"}` tuples. Multiple entries for t...
lib/mojito/headers.ex
0.875628
0.503357
headers.ex
starcoder
defmodule Artemis.Helpers.Time do @doc """ Return the beginning of the day """ def beginning_of_day(time \\ Timex.now()) do Timex.beginning_of_day(time) end @doc """ Return the beginning of the next day """ def get_next_day(time \\ Timex.now()) do time |> Timex.shift(days: 1) |> begin...
apps/artemis/lib/artemis/helpers/time.ex
0.831109
0.723016
time.ex
starcoder
defmodule Ecto.Rescope do @moduledoc """ Rescopes the default query on an Ecto schema. An Ecto Schmea is typically scoped by the `Ecto.Schema.schema/2` macro, which defines the query as: def __schema__(:query) do %Ecto.Query{ from: %Ecto.Query.FromExpr{ source: {unquote(sou...
lib/ecto_rescope.ex
0.905084
0.416737
ecto_rescope.ex
starcoder
defmodule ExifParser.ImageFileDirectory do @moduledoc """ Tiff Image File Directory parser. Parses the IFD that provides the number of tags in the IFD and offset from the start of the file buffer. ## Struct ### num_entries The length of the IFD desciptor helps in parsing the IFD. This can be used to find...
lib/exif_parser/image_file_directory.ex
0.642881
0.642292
image_file_directory.ex
starcoder
defmodule Concentrate.Encoder.VehiclePositions do @moduledoc """ Encodes a list of parsed data into a VehiclePositions.pb file. """ @behaviour Concentrate.Encoder alias Concentrate.{TripDescriptor, VehiclePosition} import Concentrate.Encoder.GTFSRealtimeHelpers @impl Concentrate.Encoder def encode_grou...
lib/concentrate/encoder/vehicle_positions.ex
0.748995
0.413152
vehicle_positions.ex
starcoder
defmodule Sanbase.Validation do import Sanbase.DateTimeUtils, only: [str_to_sec: 1] defguard is_valid_price(price) when is_number(price) and price >= 0 defguard is_valid_percent(percent) when is_number(percent) and percent >= -100 defguard is_valid_percent_change(percent) when is_number(percent) and percent > 0...
lib/sanbase/utils/validation.ex
0.769427
0.548674
validation.ex
starcoder
defmodule IEx.Helpers do @moduledoc """ A bunch of helpers available in IEx. * `c` - compiles a file in the given path * `d` - prints documentation * `h` - prints history * `m` - prints loaded modules * `r` - recompiles and reloads the given module's source file * `v` - retrieves nth value from console...
lib/elixir/lib/iex/helpers.ex
0.802246
0.486088
helpers.ex
starcoder
defmodule Advent.Y2021.D04 do @moduledoc """ https://adventofcode.com/2021/day/4 """ @doc """ To guarantee victory against the giant squid, figure out which board will win first. What will your final score be if you choose that board? """ def part_one(input) do {calls, boards} = parse_input(input) ...
lib/advent/y2021/d04.ex
0.779448
0.448487
d04.ex
starcoder
defmodule MazesWeb.CircularMazeView do use MazesWeb, :view import MazesWeb.MazeHelper alias Mazes.CircularMaze def svg_width(maze) do 2 * (svg_padding() + maze_radius(maze)) end def maze_radius(maze) do max_width = max_svg_width() - 2 * svg_padding() trunc(max_width / (2 * maze.radius)) * maz...
lib/mazes_web/views/circular_maze_view.ex
0.645455
0.51812
circular_maze_view.ex
starcoder
defmodule Exop.Validation do @moduledoc """ Provides high-level functions for a contract validation. The main function is valid?/2 Mostly invokes Exop.ValidationChecks module functions. """ import Exop.ValidationChecks alias Exop.Utils defmodule ValidationError do @moduledoc """ An op...
lib/exop/validation.ex
0.875215
0.52975
validation.ex
starcoder
defmodule Evision.Mat do @moduledoc """ OpenCV Mat """ import Evision.Errorize @typedoc """ Types for mat """ @type mat_type :: {:u, 8} | {:u, 16} | {:s, 8} | {:s, 16} | {:f, 32} | {:f, 64} @type channels_from_binary :: 1 | 3 | 4 ...
lib/opencv_mat.ex
0.789721
0.515193
opencv_mat.ex
starcoder
defmodule HAP do @moduledoc """ HAP is an implementation of the [HomeKit Accessory Protocol](https://developer.apple.com/homekit/) specification. It allows for the creation of Elixir powered HomeKit accessories which can be controlled from a user's iOS device in a similar manner to commercially available HomeKi...
lib/hap.ex
0.928132
0.971074
hap.ex
starcoder
defmodule Steve.Storage do @moduledoc """ Defines a behaviour for storage adapters to implement. """ alias Steve.Config alias Steve.Job @doc false def start_link(state) do adapter().start_link(state) end @doc false def child_spec(state) do adapter().child_spec(s...
lib/steve/storage.ex
0.756268
0.505798
storage.ex
starcoder
defmodule Module.Types.Helpers do @moduledoc false @doc """ Guard function to check if an AST node is a variable. """ defmacro is_var(expr) do quote do is_tuple(unquote(expr)) and tuple_size(unquote(expr)) == 3 and is_atom(elem(unquote(expr), 0)) and is_atom(elem(unquote(exp...
lib/elixir/lib/module/types/helpers.ex
0.743168
0.619831
helpers.ex
starcoder
defmodule Tensorflow.AutotuneResult.FailureKind do @moduledoc false use Protobuf, enum: true, syntax: :proto3 @type t :: integer | :UNKNOWN | :REDZONE_MODIFIED | :WRONG_RESULT field(:UNKNOWN, 0) field(:REDZONE_MODIFIED, 1) field(:WRONG_RESULT, 2) end defmodule Tensorflow.CudnnVersion do @moduledoc fals...
lib/tensorflow/core/protobuf/autotuning.pb.ex
0.789193
0.473231
autotuning.pb.ex
starcoder
defmodule Util.Tracing do @moduledoc """ Module to work with tracing. When starting a Trace, when no trace information is received from an HTTP request or a parent process, use `start_trace/2`. If Trace informationt is received use `join/6`. Then to start spans use `start_span/2`. """ @doc """ Starts...
lib/util/tracing/tracing.ex
0.813572
0.425844
tracing.ex
starcoder
defmodule Uploader.Ecto.UploadableFields do @moduledoc ~S""" Provides a macro for defining uploadable fields. When calling `uploadable_field/2`, two fields are created: * a virtual field is created named by the given name prefixed by "uploaded_" and holds the `Plug.Upload` struct (representing the uploa...
lib/ecto/uploadable_fields.ex
0.864582
0.881104
uploadable_fields.ex
starcoder
defmodule Pavlov.Callbacks do @moduledoc """ Allows running tasks in-between test executions. Currently only supports running tasks before tests are executed. ## Context If you return `{:ok, <dict>}` from `before :all`, the dictionary will be merged into the current context and be available in all subseq...
lib/callbacks.ex
0.731059
0.50891
callbacks.ex
starcoder
defmodule Poller do @moduledoc """ Module for continiously polling inputs """ use GenServer @server_name :process_poller def start_link(state) do GenServer.start_link(__MODULE__, state, name: @server_name) end def init(state) do init_pollers {:ok, state} end @doc """ Spawns a fun...
lib/poller.ex
0.631481
0.422117
poller.ex
starcoder
defmodule ICalex.Props.VUTCOffset do @moduledoc false use ICalex.Props alias Timex.Duration @enforce_keys [:value] defstruct ICalex.Props.common_fields() def of(%Duration{} = value), do: %__MODULE__{value: value} def from(value) when is_bitstring(value) do value_regex = ~r/(?<signal>[+-]?)(?<offset...
lib/props/v_utcoffset.ex
0.650356
0.422058
v_utcoffset.ex
starcoder
defmodule ElixirSense.Core.EdocReader do @moduledoc false alias ElixirSense.Core.Introspection @spec get_moduledoc(module()) :: list def get_moduledoc(m) when is_atom(m), do: lookup(m, [:moduledoc]) @spec get_docs(module(), atom(), non_neg_integer() | :any) :: list def get_docs(m, f \\ :any, arity \\ :an...
lib/elixir_sense/core/edoc_reader.ex
0.672439
0.438424
edoc_reader.ex
starcoder
defmodule Harald.HCI.Commands.ControllerAndBaseband.SetEventMaskPage2 do @moduledoc """ Reference: version 5.2, Vol 4, Part E, 7.3.69. """ alias Harald.{HCI, HCI.Commands.Command, HCI.ErrorCodes} @type t() :: %{ event_mask_page_2: %{ physical_link_complete_event: HCI.flag(), ...
src/lib/harald/hci/commands/controller_and_baseband/set_event_mask_page_2.ex
0.679391
0.405802
set_event_mask_page_2.ex
starcoder
defmodule Gamefield do use GenServer # Interface @doc """ Entry point. No use for a name since there are always multiple instances running """ def start_link do GenServer.start_link(__MODULE__, produce_empty_field()) end @doc """ Reset the game field to empty state """ def reset_game(serv...
lib/Backends/connect_four/gamefield.ex
0.837952
0.416144
gamefield.ex
starcoder
defmodule ExRtmidi.Message.Spec do @moduledoc """ Contains methods that present a human-friendly function signature for creating MIDI messages. Note that this module doesn't create messages but is an intermediate step to help enforce message shape. """ alias __MODULE__ @enforce_keys [:command, :status_by...
lib/ex_rtmidi/message/spec.ex
0.792384
0.519095
spec.ex
starcoder
defmodule Graphvix.Record do @moduledoc """ Models a graph vertex that has a shape of `record`. A record's label can be a single string, a single row or column, or a nested alternation of rows and columns. Once a record is created by `Graphvix.Record.new/2` it can be added to a graph using `Graphvix.Graph...
lib/graphvix/record.ex
0.913489
0.687886
record.ex
starcoder
defmodule Drab.Live.EExEngine do @moduledoc """ This is an implementation of EEx.Engine that injects `Drab.Live` behaviour. It parses the template during compile-time and inject Drab markers into it. Because of this, template must be a proper HTML. Also, there are some rules to obey, see limitations below. ...
lib/drab/live/eex_engine.ex
0.761361
0.698021
eex_engine.ex
starcoder
defmodule ExSlackLogger do @moduledoc """ ExSlackLogger is a logger backend module for Slack. ## Example At frist, add ExSlackLogger as logger backend in your config.exs. ```elixir config :logger, backends: [:console, ExSlackLogger] ``` Next, configure logger backend. ```elixir config :logger, E...
lib/ex_slack_logger.ex
0.759404
0.687669
ex_slack_logger.ex
starcoder
defmodule Ergo.Terminals do alias Ergo.{Context, Parser} import Ergo.Utils require Logger @moduledoc ~S""" `Ergo.Terminals` contains the terminal parsers, which are those parsers not parameterized with other parsers and therefore work more at the level of text than structure. """ @doc """ The eoi ...
lib/ergo/terminals.ex
0.775095
0.400046
terminals.ex
starcoder
defmodule Ewebmachine.Builder.Handlers do @moduledoc """ `use` this module will `use Plug.Builder` (so a plug pipeline described with the `plug module_or_function_plug` macro), but gives you an `:add_handler` local function plug which adds to the conn the locally defined ewebmachine handlers (see `Ewebmachin...
lib/ewebmachine/builder.handlers.ex
0.893524
0.722499
builder.handlers.ex
starcoder
defmodule AWS.SecretsManager do @moduledoc """ Amazon Web Services Secrets Manager Amazon Web Services Secrets Manager provides a service to enable you to store, manage, and retrieve, secrets. This guide provides descriptions of the Secrets Manager API. For more information about using this service, see ...
lib/aws/generated/secrets_manager.ex
0.864754
0.577078
secrets_manager.ex
starcoder
defmodule TimeGroup do alias Schedules.Schedule @type time_block :: :early_morning | :am_rush | :midday | :pm_rush | :evening | :night | :late_night @doc """ Given a list of schedules, returns those schedules grouped by the hour of day. Returns a keyword list rather than a map so that the times a...
apps/schedules/lib/time_group.ex
0.894682
0.525491
time_group.ex
starcoder
defmodule Alphametics do @type puzzle :: binary @type solution :: %{required(?A..?Z) => 0..9} @non_uppercase_characters ~r/[^A-Z]/ @single_digits Enum.to_list(0..9) @doc """ Takes an alphametics puzzle and returns a solution where every letter replaced by its number will make a valid equation. Returns `n...
elixir/alphametics/lib/alphametics.ex
0.86712
0.45944
alphametics.ex
starcoder
defmodule Cog.Command.Service.DataStore do @moduledoc """ Stores an arbitrary data structure for a given key. The only requirement is that the data structure must be able to be encoded as JSON. Keys may be fetched, replaced, and deleted. The JSON data is stored on the filesystem of the Cog host. See the C...
lib/cog/command/service/data_store.ex
0.832747
0.423845
data_store.ex
starcoder
defmodule CadetWeb.AssessmentsHelpers do @moduledoc """ Helper functions for Assessments and Grading """ import CadetWeb.ViewHelper defp build_library(%{library: library}) do transform_map_for_view(library, %{ chapter: :chapter, globals: :globals, external: &build_external_library(%{ext...
lib/cadet_web/views/assessments_helpers.ex
0.615781
0.414395
assessments_helpers.ex
starcoder
defmodule Chopperbot.Split.OrderCalculator do alias Chopperbot.Split.{ CalculatedOrdersResult, Order } @type orders :: [Order.t()] @doc """ Calculate the given orders. ## Examples iex> calculate([{"a", 100}, {"b", 200}, {"c", 300}], 1.177) %Chopperbot.Split.CalculatedOrdersResult{ ...
lib/chopperbot/split/order_calculator.ex
0.847905
0.486332
order_calculator.ex
starcoder
defmodule Rank do @moduledoc "Rank a poker hand" def rank(hand) do cond do # Rank 9 Hand.is_straight_flush_ace_high(hand) -> format_straight_flush_ace_high(hand) # Rank 9 Hand.is_straight_flush_ace_low(hand) -> format_straight_flush_ace_low(hand) # Rank 8 Hand.is_four_of_a_k...
lib/rank.ex
0.639624
0.404066
rank.ex
starcoder
defmodule Vivid.Font.Char do alias __MODULE__ alias Vivid.{Group, Path, Point} defstruct ~w(character vertices left_pos right_pos coordinates)a @moduledoc """ Describes an individual character defined by a Hershey font file. """ @opaque t :: %Char{} @doc """ Returns the (documented) width of a spec...
lib/vivid/font/char.ex
0.92972
0.594934
char.ex
starcoder
defmodule SMPPEX.MC do @moduledoc """ Module for implementing custom SMPP MC entities. In general, an SMPP MC entity represents a TCP server, which accepts connections and handles them. The TCP server is represented by a Ranch listener started by `start/2` call. On new connection the listener spawns `SMPPEX....
lib/smppex/mc.ex
0.879412
0.828939
mc.ex
starcoder
defmodule AWS.Shield do @moduledoc """ AWS Shield Advanced This is the *AWS Shield Advanced API Reference*. This guide is for developers who need detailed information about the AWS Shield Advanced API actions, data types, and errors. For detailed information about AWS WAF and AWS Shield Advanced features ...
lib/aws/shield.ex
0.85493
0.640228
shield.ex
starcoder
defmodule RedBlackTree do @moduledoc """ Module for creating and managing red-black trees. Tree nodes have keys (a number that defines the relation between nodes) and data (anything you want). A red-black tree is a approximately balanced binary tree that satisfies the following red-black properties: ...
lib/rb_tree.ex
0.927429
0.728048
rb_tree.ex
starcoder
defmodule Baseball.Base64.Encoder do @moduledoc """ Functions for Base64 Encoding The Base64 output is emitted in blocks of four characters, each character representing 6 bits of input. By definition in RFC4648, the input bitstring must contain an integral number of octets, in other words the total bit coun...
lib/baseball/base64/encoder.ex
0.856602
0.61868
encoder.ex
starcoder
defmodule Mux.Trace do @moduledoc """ Trace context for Mux.Context. This module provides B3-propagation over (multiple) Mux dispatch contexts and passes the trace id downstream. """ use Bitwise @behaviour Mux.Context @uint128_max (1 <<< 128) - 1 @uint64_max (1 <<< 64) - 1 @wire_key "com.twitte...
lib/mux/trace.ex
0.845528
0.453806
trace.ex
starcoder
defmodule Ameritrade.Order do @moduledoc false @derive Jason.Encoder defstruct session: nil, duration: nil, orderType: nil, cancelTime: nil, complexOrderStrategyType: nil, quantity: 0, filledQuantity: 0, remainingQuantity: 0, ...
lib/schema/order.ex
0.594316
0.423339
order.ex
starcoder
defmodule Firebirdex do alias Firebirdex.Query @type conn :: DBConnection.conn() @spec start_link(keyword()) :: {:ok, pid()} | {:error, Firebirdex.Error.t()} def start_link(opts) do DBConnection.start_link(Firebirdex.Protocol, opts) end @spec query(conn, iodata, list, keyword()) :: {:ok, Fi...
lib/firebirdex.ex
0.766643
0.419529
firebirdex.ex
starcoder
defmodule AMQP.Confirm do @moduledoc """ Functions that work with publisher confirms (RabbitMQ extension to AMQP 0.9.1). """ import AMQP.Core alias AMQP.{Basic, Channel} @doc """ Activates publishing confirmations on the channel. """ @spec select(Channel.t()) :: :ok | Basic.error() def select(%C...
lib/amqp/confirm.ex
0.820972
0.424203
confirm.ex
starcoder
defmodule HandimanApi.User do use HandimanApi.Web, :model @differentials %{ 5 => 1, 6 => 1, 7 => 2, 8 =>2, 9 => 3, 10 => 3, 11 => 4, 12 => 4, 13 => 5, 14 => 5, 15 => 6, 16 => 6, 17 => 7, 18 => 8, 19 => 9, 20 => 10 } schema "users" do field :e...
web/models/user.ex
0.513668
0.431105
user.ex
starcoder
defmodule Day24 do def part1(input) do weights = parse(input) target = div(Enum.sum(weights), 3) q = init_queue(weights) all_solutions(q, target, :infinity, :infinity) |> Enum.sort |> hd |> elem(1) |> quantum_entanglement end def part2(input) do weights = parse(input) t...
day24/lib/day24.ex
0.653016
0.584508
day24.ex
starcoder
defmodule ElixirExamples.Fraction do @moduledoc """ This module handles the creation of and the operations upon fractions. """ defstruct numerator: nil, denominator: nil alias ElixirExamples.Fraction @doc """ Creates a new fraction for a given numerator and denominator. """ @spec new!(integer,integer...
lib/elixir_examples/fraction.ex
0.932099
0.586878
fraction.ex
starcoder
defmodule ExDoubles do alias ExDoubles.{ErrorMessages, State, ListenerFactory} @spec mock(atom, integer) :: {:ok, function} def mock(name, arity) do listener_fn = ListenerFactory.make_listener(arity, fn args -> State.invoke_function(name, args) end) :ok = State.add_mock(%{name: name, arity: ar...
lib/ex_doubles.ex
0.841826
0.884139
ex_doubles.ex
starcoder
defmodule BSV.Mnemonic do @moduledoc """ Module for generating and restoring mnemonic phrases, for the generation of deterministic keys. Implements BIP-39. A mnemonic phrase is a group of easy to remember words. The phrase can be converted to a binary seed, which in turn is used to generate deterministic k...
lib/bsv/mnemonic.ex
0.846435
0.493653
mnemonic.ex
starcoder
defmodule ResponseSnapshot.Changes do @moduledoc """ Structure for changes of a diff. An object which is completely identical will be equal to `Changes.empty()`. Any modifications, additions, and removals are accessible from this struct. Object traversal is notated with a `.`. Array traversal is notated with...
lib/response_snapshot/changes.ex
0.886948
0.526891
changes.ex
starcoder
defmodule TwoFactorInACan.Secrets do @moduledoc """ Functions for generating cryptographic secrets. """ @type secret_generation_opts :: keyword(atom() | integer()) @default_totp_secret_byte_size 20 @doc """ Generates a secret suitable for use in time based one time password (TOTP) two factor authenti...
lib/secrets.ex
0.811228
0.509154
secrets.ex
starcoder
defmodule Form do @moduledoc """ A collection of loosely related functions helpful for filling out various forms at the city office. """ @doc """ Generates a string of a given length. This string can be used to fill out a form field that is supposed to have no value. Such fields cannot be left empty bec...
exercism/city-office/form.ex
0.825519
0.595493
form.ex
starcoder
defmodule Cldr.Calendar.Composite do @moduledoc """ A composite calendar is one in which a certain range of dates is interpreted in one calendar and a different range of dates is interpreted in a different calendar. The canonical example is the transition from the Julian to Gregorian calendar for European ...
lib/cldr/calendar/composite.ex
0.931626
0.953013
composite.ex
starcoder
defmodule Consul.Request do @moduledoc """ This module is used to build an HTTP request """ @path_template_regex ~r/{(\+?[^}]+)}/i defstruct method: :get, url: "", body: [], query: [], header: [] @type param_location :: :body | :query | :header @type method :: :head | :get | :delete | :trace | :options...
lib/consul/request.ex
0.835551
0.444444
request.ex
starcoder
defmodule LearnKit.Knn.Classify do @moduledoc """ Module for knn classify functions """ alias LearnKit.{Preprocessing, Math} defmacro __using__(_opts) do quote do defp prediction(data_set, options) do data_set |> filter_features_by_size(options[:feature]) |> check_normaliza...
lib/learn_kit/knn/classify.ex
0.809765
0.564008
classify.ex
starcoder
defmodule Bitcoin.DERSig do @moduledoc """ DER Signature. DER encoded signatures are used in Bitcoin scripts (with sighash byte at the end). This module provides parsing, serialization, normalization and checking if the signature meets BIP66 requirements. We need to normalize signatures before passing th...
lib/bitcoin/der_sig.ex
0.898009
0.554591
der_sig.ex
starcoder
defmodule Raxx.Server do @moduledoc """ Interface to handle server side communication in an HTTP message exchange. If simple `request -> response` transformation is possible, try `Raxx.SimpleServer` *A module implementing `Raxx.Server` is run by an HTTP server. For example [Ace](https://github.com/CrowdHail...
lib/raxx/server.ex
0.908476
0.541773
server.ex
starcoder
defmodule Ecto.Adapter do @moduledoc """ This module specifies the adapter API that an adapter is required to implement. """ use Behaviour @type t :: module @doc """ The callback invoked when the adapter is used. """ defmacrocallback __using__(opts :: Keyword.t) :: Macro.t @doc """ Starts an...
lib/ecto/adapter.ex
0.918745
0.509093
adapter.ex
starcoder
defmodule AWS.AutoScalingPlans do @moduledoc """ AWS Auto Scaling Use AWS Auto Scaling to quickly discover all the scalable AWS resources for your application and configure dynamic scaling and predictive scaling for your resources using scaling plans. Use this service in conjunction with the Amazon EC2 Au...
lib/aws/auto_scaling_plans.ex
0.845481
0.512266
auto_scaling_plans.ex
starcoder
defmodule AWS.Detective do @moduledoc """ Detective uses machine learning and purpose-built visualizations to help you analyze and investigate security issues across your Amazon Web Services (AWS) workloads. Detective automatically extracts time-based events such as login attempts, API calls, and network ...
lib/aws/generated/detective.ex
0.884258
0.684936
detective.ex
starcoder
if Code.ensure_loaded?(HTTPoison) do defmodule NewRelic.Instrumented.HTTPoison do use NewRelic.Tracer @moduledoc """ To track outbound requests as part of a Distributed Trace, an additional request header needs to be added. Simply alias this module and use `HTTPoison` as normal, all your requests...
lib/new_relic/instrumented/httpoison.ex
0.797004
0.563288
httpoison.ex
starcoder
defmodule CommendableComments do @attributes [ :modulecomment, :comment, :typecomment ] @moduledoc """ A trivial library that ensures that following module attributes do not throw a warning: #{ @attributes |> Enum.map(fn attribute -> " * `@#{attribute}`" end) |> Enum.join("...
lib/commendable_comments.ex
0.824533
0.842992
commendable_comments.ex
starcoder
defmodule XtbClient.Messages.SymbolInfo do defmodule Query do @moduledoc """ Info about the query for symbol info. ## Parameters - `symbol` symbol name. """ @type t :: %__MODULE__{ symbol: binary() } @enforce_keys [:symbol] @derive Jason.Encoder defstr...
lib/xtb_client/messages/symbol_info.ex
0.890509
0.508605
symbol_info.ex
starcoder
defmodule Nostrum.Cache.UserCache do @moduledoc """ Cache for users. The ETS table name associated with the User Cache is `:users`. Besides the methods provided below you can call any other ETS methods on the table. ## Example ```elixir info = :ets.info(:users) [..., heir: :none, name: :users, size: 1...
lib/nostrum/cache/user_cache.ex
0.857887
0.745861
user_cache.ex
starcoder
defmodule Validatex.Validators do @moduledoc """ This module provides a few functions for validating data. All functions return [Result](https://hexdocs.pm/result/api-reference.html). It means, if an input value is correct (i.e. the value satisfies to given validation), function returns a tuple `{:ok, val}`....
lib/validatex/validators.ex
0.921645
0.705297
validators.ex
starcoder
defmodule Absinthe.Blueprint do @moduledoc """ Represents the graphql document to be executed. Please see the code itself for more information on individual blueprint sub modules. """ alias __MODULE__ defstruct [ operations: [], types: [], directives: [], fragments: [], name: nil, ...
deps/absinthe/lib/absinthe/blueprint.ex
0.600305
0.435121
blueprint.ex
starcoder
defmodule Collision.Vector.Vector2 do @moduledoc """ Two-dimensional vectors used in detecting collisions. """ defstruct x: 0.0, y: 0.0 alias Collision.Vector.Vector2 @type t :: Vector2.t @doc """ Convert a tuple to a vector. ## Examples iex> Collision.Vector.Vector2.from_tuple({1.0, 1.5}) ...
lib/collision/vector/vector2.ex
0.927683
0.991505
vector2.ex
starcoder
defmodule EverythingLocation do @moduledoc ~S""" Everything Location is as SAAS that can verify the correctness of and address, update or correct values, and return a certainty of those values. This will also return a formatted address according to the rules of the country of that address. For more information ...
lib/everything_location.ex
0.714827
0.755231
everything_location.ex
starcoder
defmodule Harald.HCI.LEController do @moduledoc """ > The LE Controller Commands provide access and control to various capabilities of the Bluetooth > hardware, as well as methods for the Host to affect how the Link Layer manages the piconet, > and controls connections. Reference: Version 5.0, Vol 2, Part E,...
lib/harald/hci/le_controller.ex
0.767777
0.610221
le_controller.ex
starcoder
defmodule ExFix do @moduledoc """ Elixir implementation of FIX Session Protocol FIXT.1.1. Currently only supports FIX session initiator (buy side). ## Usage ``` defmodule MySessionHandler do @behaviour ExFix.SessionHandler require Logger alias ExFix.InMessage alias ExFix.OutMessage al...
lib/ex_fix.ex
0.524395
0.527742
ex_fix.ex
starcoder
defmodule Rajska.RateLimiter do @moduledoc """ Rate limiter absinthe middleware. Uses [Hammer](https://github.com/ExHammer/hammer). ## Usage First configure Hammer, following its documentation. For example: config :hammer, backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60 * 4, ...
lib/middlewares/rate_limiter.ex
0.796767
0.596815
rate_limiter.ex
starcoder
defmodule EVM.Block.Header do @moduledoc """ This structure codifies the header of a block in the blockchain. """ @empty_trie MerklePatriciaTree.Trie.empty_trie_root_hash() @empty_keccak [] |> ExRLP.encode() |> :keccakf1600.sha3_256() defstruct parent_hash: nil, # Hp P(BH)Hr # Ho K...
apps/evm/lib/evm/block/header.ex
0.61832
0.457864
header.ex
starcoder
defmodule ExPng.Chunks.Transparency do @moduledoc """ Representation of transparency data for an image """ @type t :: %__MODULE__{ type: :tRNS, data: ExPng.maybe(binary()), transparency: ExPng.maybe([integer()] | binary()) } defstruct [:data, :transparency, type: :tRNS] ...
lib/ex_png/chunks/transparency.ex
0.844441
0.611556
transparency.ex
starcoder
defmodule Blurhash.Decoder do import Blurhash.Utils alias Blurhash.Base83 use Bitwise defp size_flag(blurhash) do with {:ok, encoded_flag, rest} <- Base83.decode_number(blurhash, 1) do x = rem(encoded_flag, 9) + 1 y = floor(encoded_flag / 9) + 1 {:ok, {x, y}, rest} end end defp ...
lib/blurhash/decoder.ex
0.601828
0.496155
decoder.ex
starcoder
defmodule Monetized.Currency do @currencies [ %{name: "Argentinian Peso", symbol: "A$", key: "ARS"}, %{name: "Canadian Dollar", symbol: "C$", key: "CAD"}, %{name: "Euro", symbol: "€", key: "EUR"}, %{name: "Pound Sterling", symbol: "£", key: "GBP"}, %{name: "Hong Kong Dollar", symbol: "HK$", key: ...
lib/currency.ex
0.799521
0.446314
currency.ex
starcoder
defmodule Square.CustomerGroups do @moduledoc """ Documentation for `Square.CustomerGroups`. """ @doc """ Retrieves the list of customer groups of a business. ``` def list_customer_groups(client, [ cursor: nil ]) ``` ### Parameters | Parameter | Type | Tags | Description | | --- | --- |...
lib/api/customer_groups_api.ex
0.91511
0.807043
customer_groups_api.ex
starcoder
defmodule Resourceful.Type.Attribute do @moduledoc """ Attributes represent "value" fields for a given `Resourceful.Type`. This governs a few common operations: ## Casting Inputs Values will often come in the form of strings from the edge. Attributes use Ecto's typecasting to cast inputs into proper datat...
lib/resourceful/type/attribute.ex
0.907563
0.681024
attribute.ex
starcoder
defmodule DBConnection.OwnershipError do defexception [:message] def exception(message), do: %DBConnection.OwnershipError{message: message} end defmodule DBConnection.Ownership do @moduledoc """ A `DBConnection.Pool` that requires explicit checkout and checking as a mechanism to coordinate between processes...
deps/db_connection/lib/db_connection/ownership.ex
0.850438
0.476397
ownership.ex
starcoder
defmodule ElixirSense.Core.ErlangHtml do @moduledoc false # those typedefs mimic erl_docgen types (as of OTP 24) to not introduce dependency @type chunk_elements() :: [chunk_element()] @type chunk_element() :: {chunk_element_type(), chunk_element_attrs(), chunk_elements()} | :unicode.unicod...
lib/elixir_sense/core/erlang_html.ex
0.590425
0.426292
erlang_html.ex
starcoder
defmodule RemoteIp.Parsers.Forwarded do use Combine @behaviour RemoteIp.Parser @moduledoc """ [RFC 7239](https://tools.ietf.org/html/rfc7239) compliant parser for `Forwarded` headers. This module implements the `RemoteIp.Parser` behaviour. IPs are parsed out of the `for=` pairs across each forwarded el...
lib/remote_ip/parsers/forwarded.ex
0.832441
0.502014
forwarded.ex
starcoder
defmodule FIQLEx.QueryBuilders.SQLQueryBuilder do @moduledoc ~S""" Builds SQL queries from FIQL AST. Possible options for this query builder are: * `table`: The table name to use in the `FROM` statement (defaults to `"table"`) * `select`: `SELECT` statement to build (_see below_). * `ecto`: Tuple containi...
lib/query_builders/sql_query_builder.ex
0.787073
0.755186
sql_query_builder.ex
starcoder
defmodule Exop.ValidationChecks do @moduledoc """ Provides low-level validation functions: * check_type/3 * check_required/3 * check_numericality/3 * check_in/3 * check_not_in/3 * check_format/3 * check_length/3 * check_struct/3 * check_func/3 * check_equals/3 * check_ex...
lib/exop/validation_checks.ex
0.870989
0.599251
validation_checks.ex
starcoder
defmodule Cables.Handler do @moduledoc """ Handlers specify how to consume response data. The handler flow starts with `init/3` being called and returning the initial state or an error. In `init`, additional data can be sent with the request by using `Cabels.send_data/2` and `Cabels.send_final_data/2`. Afte...
lib/cables/handler.ex
0.825273
0.619068
handler.ex
starcoder
defmodule Aoc.Year2015.Day01 do @moduledoc """ Solution to Day 01 of 2015: Not Quite Lisp ## --- Day 01: Not Quite Lisp --- Santa was hoping for a white Christmas, but his weather machine's "snow" function is powered by stars, and he's fresh out! To save Christmas, he needs you to collect *fifty stars* by...
lib/aoc/year_2015/day_01.ex
0.804598
0.774967
day_01.ex
starcoder
defmodule Day06.SpaceObject do @moduledoc """ A recursively defined tree. """ defstruct [:name, :children] end defmodule Day06 do @moduledoc """ Advent of Code 2019 Day 6: Universal Orbit Map """ alias Day06.{Part1, Part2} def get_orbits() do Path.join(__DIR__, "inputs/day06.txt") |> Fil...
lib/day06.ex
0.703957
0.533397
day06.ex
starcoder