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 GerryCipher do @moduledoc """ Documentation for GerryCipher, an encoder based on the [Ugly Gerry typeface](https://twitter.com/UglyGerry/status/1153661354462588929) Upper and lower case letters are the two letter US state abbreviation (in upper and lower case, respectively) and their two digit distric...
lib/gerry_cipher.ex
0.690455
0.579311
gerry_cipher.ex
starcoder
defmodule ExAdmin.CSV do @moduledoc """ ExAdmin provides a CSV export link on the index page of each resource. The CSV file format can be customized with the `csv` macro. For example, give the following ecto model for Example.Contact: defmodule Example.Contact do use Ecto.Model schema "...
lib/ex_admin/csv.ex
0.802246
0.430925
csv.ex
starcoder
defmodule Carmen.Object.Worker do @moduledoc false use GenStateMachine @interface Application.get_env(:carmen, :interface, Carmen.InterfaceExample) defmodule Data do @moduledoc false defstruct [:id, :shape, inters: [], meta: %{}, processed: 0] end def start_link({id, opts}) do GenStateMachine...
lib/carmen/object/object_worker.ex
0.574992
0.410166
object_worker.ex
starcoder
defmodule Advent2019Web.Day03Controller do use Advent2019Web, :controller @doc """ Calculate the list of the segments from the path description. Segments are defined as a map of 5 values: x1, y1, x2, y2 and distance distance is the distance traveled across this path from the origin until the beginning of t...
lib/advent2019_web/controllers/day03_controller.ex
0.790652
0.722796
day03_controller.ex
starcoder
defmodule XDR.Optional do @moduledoc """ This module manages the `Optional-Data` type based on the RFC4506 XDR Standard. """ @behaviour XDR.Declaration alias XDR.{Bool, OptionalError} defstruct [:type] @typedoc """ `XDR.Optional` structure type specification. """ @type t :: %XDR.Optional{type: a...
lib/xdr/optional.ex
0.920388
0.5564
optional.ex
starcoder
defmodule Trunk.VersionState do @moduledoc """ This module defines a `Trunk.VersionState` struct and provides some helper functions for working with that state. Most of these fields are used internally during processing. ## Fields The following fields are available in the version state object. Some values a...
lib/trunk/version_state.ex
0.852859
0.863909
version_state.ex
starcoder
defmodule Plaid.Identity do @moduledoc """ [Plaid Identity API](https://plaid.com/docs/api/products/#identity) calls and schema. """ @behaviour Plaid.Castable alias Plaid.Castable alias Plaid.Identity.{Address, Email, PhoneNumber} @type t :: %__MODULE__{ addresses: [Address.t()], em...
lib/plaid/identity.ex
0.872504
0.410609
identity.ex
starcoder
defmodule Broadway.Options do @moduledoc false def definition() do [ name: [ required: true, type: {:custom, __MODULE__, :validate_name, []}, doc: """ Used for name registration. When an atom, all processes/stages created will be named using this value as prefix. ...
lib/broadway/options.ex
0.865878
0.510374
options.ex
starcoder
defmodule Mipha.Topics.Topic do @moduledoc false use Ecto.Schema import Ecto.{Changeset, Query} import EctoEnum, only: [defenum: 3] alias Mipha.{ Repo, Accounts.User, Replies.Reply, Stars.Star, Collections.Collection } alias Mipha.Topics.{Topic, Node} @type t :: %Topic{} defen...
lib/mipha/topics/topic.ex
0.708011
0.404243
topic.ex
starcoder
defmodule Monetized.Math do alias Monetized.Money alias Decimal @moduledoc """ This module defines arithmetical operations on money. All functions in this module take either money structs as parameters from which the currency for the result is inferred or if you don't care for the currency, any of the ...
lib/math.ex
0.879374
0.580174
math.ex
starcoder
defmodule ActivestorageEx.DiskService do @moduledoc """ Wraps a local disk path as an ActivestorageEx service. `:root_path` in your config must be set. Both blobs and variants are stored in folders with `:root_path` as the root """ @behaviour ActivestorageEx.Service alias ActivestorageEx.Service ...
lib/service/disk_service.ex
0.904009
0.859605
disk_service.ex
starcoder
defmodule Nerves.Runtime.LogTailer do @moduledoc """ Collects operating system-level messages from `/dev/log` and `/proc/kmsg`, forwarding them to `Logger` with an appropriate level to match the syslog priority parsed out of the message. You can disable this feature (e.g. for testing) by configuring the foll...
lib/nerves_runtime/log_tailer.ex
0.625896
0.743727
log_tailer.ex
starcoder
defmodule IdleAnimations.GOL do use GenServer, restart: :temporary @moduledoc "A GOL idle animation" defmodule State do use TypedStruct typedstruct enforce: true do field :id, String.t() field :gol_state, Matrix.t(boolean()) field :fading_out, boolean(), default: false field :...
web/lib/infolab_light_games/idle_animations/game_of_life.ex
0.764804
0.490358
game_of_life.ex
starcoder
defmodule Benchee.Conversion.Scale do @moduledoc """ Functions for scaling values to other units. Different domains handle this task differently, for example durations and counts. See `Benchee.Conversion.Count` and `Benchee.Conversion.Duration` for examples """ alias Benchee.Conversion.Unit @type unit ...
lib/benchee/conversion/scale.ex
0.94419
0.880848
scale.ex
starcoder
defmodule Instruments.Probe do @moduledoc """ A behavior for a Probe. Modules that define probes are expected to implement all of the functions in this behaviour. A probe is created via the call to `Instruments.Probe.probe_init/3`, and is then called every `sample_interval` milliseconds via the `Instrum...
lib/probe.ex
0.902289
0.655682
probe.ex
starcoder
defmodule FileSize.Ecto.BitWithUnit do @moduledoc """ An Ecto type that represents a file size in bits, supporting storage of different units. The value is stored as map in the database (i.e. jsonb when using PostgreSQL). ## Example defmodule MySchema do use Ecto.Schema schema "my_tab...
lib/file_size/ecto/bit_with_unit.ex
0.836053
0.520374
bit_with_unit.ex
starcoder
defmodule Annex.Layer.Sequence do @moduledoc """ The Sequence layer is the container and orchestrator of other layers and is used to define a list of Layers that compose a deep neural network. """ alias Annex.{ AnnexError, Data, Data.DMatrix, Layer, Layer.Backprop, Layer.Sequence, ...
lib/annex/layer/sequence.ex
0.875202
0.538498
sequence.ex
starcoder
defmodule XGen.Option do @moduledoc """ Helpers to create and resolve generator options. Options have some properties do define: * `key` - the key to add in the options map after resolution * `type` - the option type * `default` - a default value *(optional)* * `options` - some options *(optiona...
lib/xgen/option.ex
0.867598
0.577853
option.ex
starcoder
defmodule BitstylesPhoenix.Component.Icon do use BitstylesPhoenix.Component import BitstylesPhoenix.Component.UseSVG @moduledoc """ An SVG icon system, that expects the icons to be present on the page, rendered as SVG `<symbol>`s. """ @doc ~S""" Renders an icon element. This uses `BitstylesPhoenix.Co...
lib/bitstyles_phoenix/component/icon.ex
0.861974
0.426501
icon.ex
starcoder
defmodule Distributed do @moduledoc """ Make your systems distributed, replicated, scaled well, easily. [![Hex Version](https://img.shields.io/hexpm/v/distributed.svg?style=flat-square)](https://hex.pm/packages/distributed) [![Docs](https://img.shields.io/badge/api-docs-orange.svg?style=flat-square)](https://hexdoc...
lib/distributed.ex
0.739046
0.57684
distributed.ex
starcoder
defmodule AWS.Route53Resolver do @moduledoc """ When you create a VPC using Amazon VPC, you automatically get DNS resolution within the VPC from Route 53 Resolver. By default, Resolver answers DNS queries for VPC domain names such as domain names for EC2 instances or ELB load balancers. Resolver performs re...
lib/aws/generated/route53_resolver.ex
0.899722
0.480235
route53_resolver.ex
starcoder
defmodule Commanded.Aggregate.Multi.BankAccount do defstruct [:account_number, :status, balance: 0] alias Commanded.Aggregate.Multi alias Commanded.Aggregate.Multi.BankAccount defmodule Commands do defmodule OpenAccount do defstruct [:account_number, :initial_balance] end defmodule DepositM...
test/aggregates/support/multi_bank_account.ex
0.568895
0.572334
multi_bank_account.ex
starcoder
defmodule Nostrum.Cache.UserCache do @default_cache_implementation Nostrum.Cache.UserCache.ETS @moduledoc """ Cache behaviour & dispatcher for users. """ alias Nostrum.Struct.User alias Nostrum.Util import Nostrum.Snowflake, only: [is_snowflake: 1] if function_exported?(Application, :compile_env, 3) d...
lib/nostrum/cache/user_cache.ex
0.821152
0.415017
user_cache.ex
starcoder
defmodule Money do @moduledoc """ Money implements a set of functions to store, retrieve, convert and perform arithmetic on a `Money.t` type that is composed of a currency code and a decimal currency amount. Money is very opinionated in the interests of serving as a dependable library that can underpin acc...
lib/money.ex
0.918256
0.776157
money.ex
starcoder
defmodule Marker.Element do @moduledoc """ This module is responsible for generating element macro's. Marker generates by default all html5 elements, but you can easily generate other elements too: ```elixir defmodule MyElements do use Marker.Element, tags: [:my_element, :another_one] end ``` ...
lib/marker/element.ex
0.808974
0.775817
element.ex
starcoder
defmodule Level10.Games.Levels do @moduledoc """ The game typically goes through 10 levels. This module contains the details for those levels so that they can be grabbed when needed. """ alias Level10.Games.{Card, Game} @type type :: :color | :set | :run @type count :: non_neg_integer() @type group ::...
lib/level10/games/levels.ex
0.867626
0.528594
levels.ex
starcoder
defmodule HashRing do @moduledoc """ This module defines an API for creating/manipulating a hash ring. The internal data structure for the hash ring is actually a gb_tree, which provides fast lookups for a given key on the ring. - The ring is a continuum of 2^32 "points", or integer values. - Nodes are sha...
lib/ring.ex
0.947051
0.761405
ring.ex
starcoder
defmodule MeshxRpc do @readme File.read!("docs/README.md") |> String.split("<!-- MDOC !-->") |> Enum.fetch!(1) @moduledoc """ #{@readme} ## Common configuration RPC client and server modules provide child specifications which should be used with user supervisors as shown on examples above. RPC client `child...
lib/meshx_rpc.ex
0.837254
0.76074
meshx_rpc.ex
starcoder
defmodule AdventOfCode.Y2020.Day24 do def run1(input) do input |> setup_floor() |> count_black() end def run2(input, day) do input |> setup_floor() |> Stream.iterate(&apply_art_rules/1) |> Stream.drop(day) |> Enum.take(1) |> hd() |> count_black end def setup_floor(inp...
lib/2020/day24.ex
0.570092
0.590218
day24.ex
starcoder
defmodule ExWire.Struct.BlockQueue do @moduledoc """ A structure to store and process blocks received by peers. The goal of this module is to keep track of partial blocks until we're ready to add the block to the chain. There are two reasons we need to keep them stored in a queue: 1. Block headers are sent s...
apps/ex_wire/lib/ex_wire/struct/block_queue.ex
0.661923
0.560614
block_queue.ex
starcoder
defmodule RingCentral.OAuth do @moduledoc """ The main module for the [Authorization flow](https://developers.ringcentral.com/api-reference/authentication) """ alias RingCentral.HTTPClient alias RingCentral.Response alias RingCentral.Error @doc """ Get the URL for initializing the OAuth 2.0 authorizai...
lib/ring_central/oauth.ex
0.834508
0.740597
oauth.ex
starcoder
defmodule RlStudy.DP.BellmanEquation do @moduledoc """ Value base """ require Logger @spec v(String.t(), float()) :: float() def v(s, gamma \\ 0.99) do Logger.info("v: #{inspect(s)}") v = r(s) + gamma * max_v_on_next_state(s) Logger.info("v: #{inspect(s)} -> #{inspect(v)}") v end @spe...
lib/dp/bellman_equation.ex
0.745584
0.495117
bellman_equation.ex
starcoder
defmodule Day19 do def part1(input) do {pos, width, grid} = parse(input) move(:down, pos, grid, width, []) end def part2(input) do {pos, width, grid} = parse(input) move_count(:down, pos, grid, width, 0) end defp move(dir, {x, y}, grid, width, seen) do case :binary.at(grid, x + y * width...
day19/lib/day19.ex
0.593609
0.894467
day19.ex
starcoder
defmodule Authex.AuthorizationPlug do @moduledoc """ A plug to handle authorization. This plug must be passed an auth module in which to authorize with. Otherwise, it will raise an `Authex.Error`. The plug must also only be used after the `Authex.AuthenticationPlug` has been used. With it, we can easily a...
lib/authex/plugs/authorization_plug.ex
0.837354
0.421582
authorization_plug.ex
starcoder
defmodule X3m.System.Message do @moduledoc """ System Message. This module defines a `X3m.System.Message` struct and the main functions for working with it. ## Fields: * `service_name` - the name of the service that should handle this message. Example: `:create_job`. * `id` - unique id of the messa...
lib/message.ex
0.885142
0.519399
message.ex
starcoder
defmodule Fiat.CacheServer do @moduledoc """ Fiat is a module to handle basic caching needs. Behind the scenes it leverages an ets table to store objects and a GenServer to maintain the state of the current keys. ## Usage Add `Fiat.CacheServer` to your application's supervision tree. Because `Fiat.Cac...
lib/fiat.ex
0.866867
0.812644
fiat.ex
starcoder
defmodule Dicer.Validator do @invalid_operator_sequences [%Dicer.Tokens.Plus{}, %Dicer.Tokens.Minus{}, %Dicer.Tokens.Multiply{}, %Dicer.Tokens.Divide{}] @invalid_operators_at_start [%Dicer.Tokens.Multiply{}, %Dicer.Tokens.Divide{}] def validate({:ok, input}, validation_options) when is_list(input) and is_map...
lib/dicer/validator.ex
0.631253
0.411436
validator.ex
starcoder
defmodule EctoAutoFilter do @moduledoc """ Ecto Auto Filter **Automatic Filters based Ecto Schemas** EctoAutoFilter is a helper for projects that use Ecto Schemas and segregate the queries in entity repository modules. EctoAutoFilter inject the `filter/3` function that by default has a pattern matching for e...
lib/ecto_auto_filter.ex
0.756762
0.433442
ecto_auto_filter.ex
starcoder
defmodule MafiaEngine.Accusations do @moduledoc """ This module defines the type for accusations and functions to handle them. ## Examples iex> a = MafiaEngine.Accusations.new(2) %MafiaEngine.Accusations{ballots: %{}, required: 2} iex> abed = MafiaEngine.Player.new("Abed") ...> jeff = MafiaEngine.Player...
lib/mafia_engine/accusations.ex
0.717903
0.499084
accusations.ex
starcoder
defmodule PQueue2 do @moduledoc """ Priority queue that wraps [pqueue2](https://hex.pm/packages/pqueue). iex> {value, _} = PQueue2.new iex> |> PQueue2.put(:a, 2) iex> |> PQueue2.put(:b, 1) iex> |> PQueue2.put(:c, 1) iex> |> PQueue2.pop iex> value :b PQueue2 implements C...
lib/pqueue2.ex
0.793346
0.518607
pqueue2.ex
starcoder
defmodule Iteraptor.Utils do @moduledoc "Helper functions to update nested terms" defmodule Unsupported do @moduledoc """ An exception to be thrown from banged methods of `Iteraptor`. Sooner or later we’ll support everything, that’s why meanwhile we raise `Unsupported` if something goes wrong. ...
lib/iteraptor/utils.ex
0.901047
0.517388
utils.ex
starcoder
defrecord File.Stat, Record.extract(:file_info, from_lib: "kernel/include/file.hrl") do @moduledoc """ A record responsible to hold file information. Its fields are: * `size` - Size of file in bytes. * `type` - `:device`, `:directory`, `:regular`, `:other`. The type of the file. * `access` - `:read`, `:write...
lib/elixir/lib/file.ex
0.786336
0.5816
file.ex
starcoder
defmodule Shmex.Native do @moduledoc """ This module provides natively implemented functions allowing low-level operations on Posix shared memory. Use with caution! """ use Bundlex.Loader, nif: :shmex @doc """ Creates shared memory segment and adds a guard for it. The guard associated with this memor...
lib/shmex_native.ex
0.84137
0.531392
shmex_native.ex
starcoder
defmodule FusionDsl.NativeImpl do @moduledoc """ This module helps with building proxy Fusion modules to native erlang/elixir modules. A native package has `type: :native` in its opts. Example: ``` config :fusion_dsl, packages: [{String, [type: :native]}, ...] ``` Refer to [packages](packages.html#...
lib/fusion_dsl/native_impl.ex
0.860779
0.681853
native_impl.ex
starcoder
defmodule Abbr.Mnesia.Sync do @moduledoc """ Ensures cache stays in sync across cluster. Flow: - monitors the `:inconsistent_database` mnesia system event - and merges local cache with (potentially) out of sync node """ alias Abbr.Cache alias Abbr.Mnesia.Local alias Abbr.Mnesia.Url alias Memento.S...
lib/abbr/mnesia/sync.ex
0.825941
0.450843
sync.ex
starcoder
defmodule Typesense.Documents do @moduledoc """ The `Typesense.Documents` module is the service implementation for Typesense' `Documents` API Resource. """ @doc """ Index a document. ## Examples ```elixir iex> document = %{ company_name: "<NAME>", num_employees: 5215, country: "USA" } ...
lib/typesense/documents/documents.ex
0.885823
0.792022
documents.ex
starcoder
defmodule RDF.Turtle.Decoder do @moduledoc """ A decoder for N-Triples serializations to `RDF.Graph`s. As for all decoders of `RDF.Serialization.Format`s, you normally won't use these functions directly, but via one of the `read_` functions on the `RDF.Turtle` format module or the generic `RDF.Serialization`...
lib/rdf/serializations/turtle_decoder.ex
0.817319
0.616936
turtle_decoder.ex
starcoder
defmodule Spotify.Tracks do @moduledoc """ For manipulating tracks. [Spotify Docs](https://beta.developer.spotify.com/documentation/web-api/reference/tracks/) """ alias Spotify.Tracks.{TrackFull, TrackLink} alias Spotify.{ExternalIds, ExternalUrls, Restrictions, Timestamp} alias Spotify.Albums.Album...
lib/spotify/models/tracks/tracks.ex
0.874212
0.759538
tracks.ex
starcoder
defmodule AWS.CertificateManager do @moduledoc """ AWS Certificate Manager Welcome to the AWS Certificate Manager (ACM) API documentation. You can use ACM to manage SSL/TLS certificates for your AWS-based websites and applications. For general information about using ACM, see the [ *AWS Certificate Manag...
lib/aws/certificate_manager.ex
0.883116
0.638314
certificate_manager.ex
starcoder
defmodule AdventOfCode.Day11 do @moduledoc "Day 11" defmodule Seat, do: defstruct x: 0, y: 0, empty?: true defmodule SeatMap do defstruct by_row: %{}, neighbors: %{} def new(by_row, neighbors) when is_function(neighbors), do: %SeatMap{ by_row: by_row, neighbors: Map.new(Enum.flat_map(by_row...
lib/advent_of_code/day11.ex
0.599368
0.572394
day11.ex
starcoder
defmodule LogicalFile.Section do alias __MODULE__ @moduledoc """ A `Section` represents lines of text from a backing file that represent a range of logical line numbers within a `LogicalFile`. ## Fields * `source_path` the fully qualified file name of the backing file that the `Section` represent...
lib/logical_file/section.ex
0.867022
0.698188
section.ex
starcoder
defmodule XPlane.Instance do @moduledoc """ Represent a running instance of X-Plane and provide a GenServer to monitor the local network for X-Plane multicast "beacon" messages and return them as a list. ## Example ``` iex> XPlane.Instance.start {:ok, #PID<0.138.0>} iex> XPlane.Instance.list [ ...
lib/xplane_instance.ex
0.745398
0.694342
xplane_instance.ex
starcoder
defmodule Kalevala.Output.Websocket.Tag do @moduledoc false @derive Jason.Encoder defstruct [:name, attributes: %{}, children: []] def append(tag, child) do %{tag | children: tag.children ++ [child]} end end defmodule Kalevala.Output.Websocket do @moduledoc """ Processes tags for the websocket outp...
lib/kalevala/output/websocket.ex
0.718693
0.423339
websocket.ex
starcoder
defmodule Toolshed.Top.Report do @moduledoc false @typedoc """ Options: * `:order` - the sort order for the results (`:reductions`, `:delta_reductions`, `:mailbox`, `:delta_mailbox`, `:total_heap_size`, `:delta_total_heap_size`, `:heap_size`, `:delta_heap_size`, `:stack_size`, `:delta_stack_size`) *...
lib/toolshed/top/report.ex
0.768081
0.738693
report.ex
starcoder
defmodule DataMatrix.Matrix do @moduledoc false alias DataMatrix.MappingMatrix defstruct ~w(dark version nrow ncol)a @symbol_size Code.eval_file("lib/datamatrix/static/symbol_size.tuple") |> elem(0) @region_size Code.eval_file("lib/datamatrix/static/data_region_size.tuple") |> elem(0) @doc """ """ ...
lib/datamatrix/matrix.ex
0.775817
0.533884
matrix.ex
starcoder
defmodule Pngstruct do @enforce_keys [:length, :width, :height, :chunks] defstruct [:length, :width, :height, :bit_depth, :color_type, :compression_method, :filter_method, :interlace_method, :crc, :chunks] end defmodule ParseImg do @moduledoc """ Helper module for image parsing functions """ @doc """ ...
lib/helpers/parse_img.ex
0.736401
0.518668
parse_img.ex
starcoder
defmodule Xgit.Repository do @moduledoc ~S""" Represents a git repository. Create a repository by calling the `start_link` function on one of the modules that implements `Xgit.Repository.Storage`. The resulting PID can be used when calling functions in this module and `Xgit.Repository.Plumbing`. The funct...
lib/xgit/repository.ex
0.901608
0.554591
repository.ex
starcoder
defmodule Convertat do @moduledoc """ Provides functions for converting **from** and **to** arbitrary bases. """ @type integer_base :: 2..36 @type list_base :: [] @doc """ Converts any string of digits or list of digits (where each digit is a string) to a value in decimal base (base 10), given a start...
lib/convertat.ex
0.897657
0.524577
convertat.ex
starcoder
defmodule ScrollHat.Font.Medium do @moduledoc """ Medium 5x5 Font Transposed from https://github.com/pimoroni/scroll-phat-hd/blob/master/library/scrollphathd/fonts/font5x5.py """ @behaviour ScrollHat.Font def char_matrix(char, brightness \\ 0xFF) def char_matrix(0x20, _b) do [ [0x0, 0x0, 0x0,...
lib/scroll_hat/fonts/medium.ex
0.664867
0.604632
medium.ex
starcoder
defmodule Solana.SystemProgram.Nonce do @moduledoc """ Functions for interacting with the [System Program](https://docs.solana.com/developing/runtime-facilities/programs#system-program)'s nonce accounts, required for [durable transaction nonces](https://docs.solana.com/offline-signing/durable-nonce). These...
lib/solana/system_program/nonce.ex
0.814496
0.575469
nonce.ex
starcoder
defmodule Harald.HCI.ACLData do @moduledoc """ Reference: version 5.2, vol 4, part E, 5.4.2. """ alias Harald.Host.L2CAP @enforce_keys [ :handle, :packet_boundary_flag, :broadcast_flag, :data_total_length, :data ] defstruct [ :handle, :packet_boundary_flag, :broadcast_fl...
lib/harald/hci/acl_data.ex
0.668988
0.478102
acl_data.ex
starcoder
defmodule Class do @moduledoc """ The `Class` module defines a few macros that provide object-oriented features, such as inheritance and polymorphism, on top of Elixir's structs. Additional documentation is available on the [Classy structs Github page](https://github.com/timmolderez/classy-structs#usage). @...
lib/classy_structs.ex
0.656108
0.802633
classy_structs.ex
starcoder
defmodule D7 do @moduledoc """ --- Day 7: Handy Haversacks --- You land at the regional airport in time for your next flight. In fact, it looks like you'll even have time to grab some food: all flights are currently delayed due to issues in luggage processing. Due to recent aviation regulations, many rules (yo...
lib/days/07.ex
0.652131
0.602412
07.ex
starcoder
defmodule Machinery do @moduledoc """ This is the main Machinery module. It keeps most of the Machinery logics, it's the module that will be imported with `use` on the module responsible for the state machine. Declare the states as an argument when importing `Machinery` on the module that will control you...
deps/machinery/lib/machinery.ex
0.907102
0.969728
machinery.ex
starcoder
defmodule Snitch.Data.Model.ShippingMethod do @moduledoc """ ShippingMethod API """ use Snitch.Data.Model import Ecto.Query alias Snitch.Data.Schema.ShippingMethod, as: SM alias Snitch.Data.Schema.ShippingCategory, as: SC alias Snitch.Data.Schema.Zone @doc """ Creates a ShippingMethod with given ...
apps/snitch_core/lib/core/data/model/shipping_method.ex
0.869112
0.781497
shipping_method.ex
starcoder
defmodule AWS.RedshiftData do @moduledoc """ You can use the Amazon Redshift Data API to run queries on Amazon Redshift tables. You can run individual SQL statements, which are committed if the statement succeeds. """ @doc """ Cancels a running query. To be canceled, a query must be running. """...
lib/aws/generated/redshift_data.ex
0.8119
0.615637
redshift_data.ex
starcoder
defmodule Game.Stats do @moduledoc """ Regen stats during ticks """ alias Data.Stats @doc """ Regen statistics (hp/sp) every few ticks iex> Game.Stats.regen(%{health_points: 10, max_health_points: 15}, :health_points, 3) %{health_points: 13, max_health_points: 15} iex> Game.Stats.regen(%{hea...
lib/game/stats.ex
0.805211
0.555978
stats.ex
starcoder
defmodule Absinthe.ValidationPhaseCase do import ExUnit.Assertions alias Absinthe.{Blueprint, Schema, Phase, Pipeline, Language} @type error_checker_t :: ([{Blueprint.t(), Phase.Error.t()}] -> boolean) def get_error_location(line) do case List.wrap(line) do [] -> "(at any line number)" ...
test/support/validation_phase_case.ex
0.698329
0.439627
validation_phase_case.ex
starcoder
defmodule Game.Format.Rooms do @moduledoc """ Format functions for rooms """ import Game.Format.Context alias Data.Exit alias Data.Room alias Game.Door alias Game.Format alias Game.Format.NPCs, as: FormatNPCs @doc """ Display a room's name """ def room_name(room) do "{room}#{room.name}{...
lib/game/format/rooms.ex
0.5769
0.461441
rooms.ex
starcoder
defmodule VintageNet.IP.IPv4Config do @moduledoc """ This is a helper module for VintageNet.Technology implementations that use IPv4. IPv4 configuration is specified under the `:ipv4` key in the configuration map. Fields include: * `:method` - `:dhcp`, `:static`, or `:disabled` The `:dhcp` method curre...
lib/vintage_net/ip/ipv4_config.ex
0.891111
0.417271
ipv4_config.ex
starcoder
defmodule AshPostgres.Repo do @moduledoc """ Resources that use the `AshPostgres` data layer use a `Repo` to access the database. This repo is a slightly modified version of an `Ecto.Repo`. You can use `Ecto.Repo`'s `init/2` to configure your repo like normal, but instead of returning `{:ok, config}`, use `...
lib/repo.ex
0.849191
0.673963
repo.ex
starcoder
defmodule MehrSchulferien.Timetables do @moduledoc """ The Timetables context. """ import Ecto.Query, warn: false alias MehrSchulferien.Repo alias MehrSchulferien.Timetables.Year @doc """ Returns the list of years. ## Examples iex> list_years() [%Year{}, ...] """ def list_years d...
phoenix/lib/mehr_schulferien/timetables/timetables.ex
0.873613
0.427038
timetables.ex
starcoder
defmodule <%= components_module %>.Form.MultiSelect do use <%= web_module %>, :component alias Phoenix.LiveView.JS import <%= components_module %>.Icon defp close_select_dropdown(js \\ %JS{}, id) do js |> JS.remove_class("show", to: "##{id}.show") |> JS.remove_class("show", to: "##{id}.show .dropd...
priv/templates/gen.components/components/form/multi_select.ex
0.694199
0.660128
multi_select.ex
starcoder
defmodule CarCache do @external_resource "README.md" @moduledoc "README.md" |> File.read!() |> String.split("<!-- MDOC !-->") |> Enum.fetch!(1) use GenServer alias CarCache.Cache @options_schema [ name: [ type: :atom, required: true ], max_siz...
lib/car_cache.ex
0.826852
0.71607
car_cache.ex
starcoder
defmodule Request.Validator.Plug do alias Plug.Conn alias Request.Validator import Plug.Conn @doc ~S""" Init the Request.Validator.Plug with an optional error callback and handlers with their corresponding request validator module. ```elixir plug Request.Validator.Plug, register: App.Requests.Regi...
lib/plug.ex
0.756627
0.449876
plug.ex
starcoder
defmodule XDR.VariableArray do @moduledoc """ This module manages the `Variable-Length Array` type based on the RFC4506 XDR Standard. """ @behaviour XDR.Declaration alias XDR.{UInt, FixedArray, VariableArrayError} defstruct [:elements, :type, :max_length] @type elements :: list() | binary() @typedo...
lib/xdr/variable_array.ex
0.905956
0.542197
variable_array.ex
starcoder
|QUESTIONNAME| Produce a timestamp for 1 a.m. on the 31st of August 2012 |QUESTION| Produce a timestamp for 1 a.m. on the 31st of August 2012. |QUERY| select timestamp '2012-08-31 01:00:00'; |ANSWER| <p>Here's a pretty easy question to start off with! SQL has a bunch of different date and time types, which you can per...
questions/date/00010000-timestamp.ex
0.555676
0.54153
00010000-timestamp.ex
starcoder
defmodule SyncPrimitives.CyclicBarrier do @moduledoc """ A CyclicBarrier expects a predefined number of `parties` to `await/2` before all calls to `await/2` can continue. Parties _arrive_ at the _barrier_ by calling `await/2`. When all `parties` have _arrived_, all calls to `await/2` unblock, and parties ...
lib/sync_primitives/cyclic_barrier.ex
0.785103
0.498413
cyclic_barrier.ex
starcoder
defmodule UploadcareEx.Config do @moduledoc """ Configuration ### Required parameters: ``` config :uploadcare_ex, public_key: "public_key", private_key: "private_key" ``` By default [Uploadcare.Simple auth-scheme](https://uploadcare.com/docs/api_reference/rest/requests_auth/) is used. ### O...
lib/uploadcare_ex/config.ex
0.78345
0.635081
config.ex
starcoder
defmodule Delaunay do use Bitwise alias __MODULE__ alias Delaunay.Internals alias Delaunay.Utils @moduledoc """ Documentation for Delaunay. """ @epsilon :math.pow(2, -52) defstruct [ :coords, :halfedges, :hull, :hull_next, :hull_prev, :hull_start, :hull_tri, :hull_ha...
lib/delaunay.ex
0.820218
0.4474
delaunay.ex
starcoder
defmodule Akd.Stop.Release do @moduledoc """ A native Hook module that comes shipped with Akd. This module uses `Akd.Hook`. Provides a set of operations that can stop an app built and released using distillery. If fails, it restarts the stopped node. # Options: * `run_ensure`: `boolean`. Specifies ...
lib/akd/base/stop/release.ex
0.872062
0.517022
release.ex
starcoder
defmodule PhoneNumber do @doc """ Remove formatting from a phone number if the given number is valid. Return an error otherwise. """ @spec clean(String.t()) :: {:ok, String.t()} | {:error, String.t()} def clean(raw) do validators = [ &validate_digits/1, &validate_length/1, &validate_coun...
exercises/practice/phone-number/.meta/example.ex
0.769643
0.437103
example.ex
starcoder
defmodule Workflows.Rule do @moduledoc """ Choice state rule. """ @type t :: %__MODULE__{ next: String.t(), rule: (map() -> boolean()) } defstruct [:next, :rule] @doc """ Create a rule that can be matched on an input. """ def create(%{"Next" => next} = rule) do case ...
lib/workflows/rule.ex
0.607197
0.512205
rule.ex
starcoder
defmodule ECS.Entity do @moduledoc """ Functions to work with entities. An entity is a map container of components. Components are placed in the map with their key as a converted atom based on their struct atom by default. The key is created by converting the struct name after `Component` to snakecase, del...
lib/ecs/entity.ex
0.883927
0.434041
entity.ex
starcoder
defmodule Cannes.Dumper do @moduledoc """ This module is for communicating with linux can sockets over candump. TODO: - Add logic to mount a can interface - Test if desired interface is reacable - Test if candump is available - Pass options to candump """ alias Porcelain.Process, as: Proc ...
lib/dumper.ex
0.675444
0.448185
dumper.ex
starcoder
defmodule Strukt.Test.Fixtures do use Strukt defmodule Classic do @moduledoc "This module uses Kernel.defstruct/1, even though our defstruct/1 is in scope, since it is given only a list of field names" use Strukt defstruct [:name] end defmodule Simple do @moduledoc "This module represents the...
test/support/defstruct_fixtures.ex
0.873741
0.609757
defstruct_fixtures.ex
starcoder
defmodule Pass.Hash do @moduledoc """ Implements methods for password hashing, verification, and formatting for data storage. """ defp config, do: Application.get_env(:pass, __MODULE__, %{}) @doc """ Given a plaintext string it generates a new salt, hashes the string, and returns a string formatted fo...
lib/pass/actions/hash.ex
0.758868
0.439266
hash.ex
starcoder
defmodule EctoSharding do @moduledoc """ EctoSharding ShardRegistry and Repo supervisor. This is the supervisor that will supervise the internal shard registry and build and supervise the ecto repo for each shard specified in the configuration. Before `start_link` is called all of the shard configuration mus...
lib/ecto_sharding.ex
0.64232
0.414662
ecto_sharding.ex
starcoder
defmodule Scientist.Observation do @moduledoc """ A set of functions for working with experiment observations. A `Scientist.Observation` struct contains information about the execution of a given candidate, including its execution duration, value, and cleaned value. The timestamp is recorded as the system t...
lib/scientist/observation.ex
0.934447
0.81648
observation.ex
starcoder
defmodule ExStringUtil do @moduledoc """ This module helps validate any string from user input. """ @doc ~S""" This function checks whether a given string is alphanumeric. It will return true when the string is valid or false on the contrary. ## Parameters - string0: String to validate ## Return...
lib/ex_string_util.ex
0.895383
0.550607
ex_string_util.ex
starcoder
defmodule Mollie.Customers do import Mollie alias Mollie.Client @moduledoc """ Creates a simple minimal representation of a customer in the Mollie API to use for the Mollie Checkout and Recurring features. These customers will appear in your Mollie Dashboard where you can manage their details, and also see the...
lib/mollie/customers.ex
0.809088
0.454048
customers.ex
starcoder
defmodule Edeliver.Relup.Instructions.Info do @moduledoc """ This upgrade instruction logs the given info message on the node which runs the upgrade and in the running upgrade script which was started by the `$APP/bin/$APP upgarde $RELEASE` command. Usage: ``` Edeliver.Relup.Instructions...
lib/edeliver/relup/instructions/info.ex
0.71889
0.690976
info.ex
starcoder
defmodule Transmit do @moduledoc """ Plug for handling the creation of presigned urls for direct client-side uploading ## Setup In your router, add the following: ```elixir defmodule MyAppWeb.Router do use MyAppWeb, :router ... forward("/signer", Transmit, signer: Transmit.S3Signer, bucket:...
lib/transmit.ex
0.770249
0.735
transmit.ex
starcoder
defmodule Entice.Logic.Vitals do @moduledoc """ Responsible for the entities vital stats like (health, mana, regen, degen). If the entity has no explicit level, it is implicitly assumed to be 20. If and entity dies, a local broadcast will be send that looks like this: {:entity_dead, %{entity_id: entity_...
lib/entice/logic/vitals.ex
0.638385
0.601535
vitals.ex
starcoder
defmodule Sworm do @moduledoc """ Sworm takes the accessible API from [Swarm](https://github.com/bitwalker/swarm), and combines it with the robustness of [Horde](https://github.com/derekkraan/horde). It strives to be a combination of a global, distributed process registry and supervisor, accessible through...
lib/sworm.ex
0.78287
0.708906
sworm.ex
starcoder
defmodule OkrApp.Objectives.Objective do @moduledoc """ Objectives are high level goals that an individual wishes to complete. They are contained with other objectives in an Okr. They are scored automatically based on the completion of key results. """ use Ecto.Schema import Ecto.Changeset alias OkrA...
lib/okr_app/objectives/objective.ex
0.728169
0.423667
objective.ex
starcoder
defmodule GenFRP do @moduledoc """ The main GenFRP module. GenFRP wraps GenServer, which means that a separate process is spawned using `start` or start_link`. After this, the other functions in this module can be used to send messages to this process. The idea is to: - start a GenFRP process with yo...
lib/gen_frp.ex
0.811303
0.582046
gen_frp.ex
starcoder
defmodule Snitch.Domain.ShipmentEngine do @moduledoc """ Finds the optimal shipment for a given order. `ShipmentEngine` models the problem as a [Constraint Satisfaction Problem][csp] and find the optimal `shipment` subject to the following constraints: 1. Two (or more) `packages` cannot fulfill the same `...
apps/snitch_core/lib/core/domain/shipment_engine.ex
0.857261
0.768168
shipment_engine.ex
starcoder
defmodule Day05 do def part1(input) do memory = read_program(input) memory = set_input(memory, 1) List.last(execute(memory)) end def part2(program, input) do memory = read_program(program) memory = set_input(memory, input) List.last(execute(memory)) end defp execute(memory, ip \\ 0) ...
day05/lib/day05.ex
0.531939
0.499756
day05.ex
starcoder
defmodule Day24.BugLyfe2 do @doc """ iex> Day24.BugLyfe2.part2("day24-sample.txt", 10) 99 iex> Day24.BugLyfe2.part2("day24.txt", 200) 2009 """ def part2(filename, time_limit) do level0 = parse_input(filename) iterate(%{0 => level0}, time_limit) end def parse_input(filename) d...
lib/day24/bug_lyfe2.ex
0.511473
0.503235
bug_lyfe2.ex
starcoder