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 CoursePlannerWeb.AttendanceController do @moduledoc false use CoursePlannerWeb, :controller alias CoursePlanner.{Attendances, Attendances.Attendance, Courses.OfferedCourse} import Canary.Plugs plug :authorize_controller action_fallback CoursePlannerWeb.FallbackController def index(%{assigns: ...
lib/course_planner_web/controllers/attendance_controller.ex
0.612657
0.515864
attendance_controller.ex
starcoder
defmodule SudokuSolver.CPSCandidates do @moduledoc """ Implements SudokuSolver using continuation passing style """ @behaviour SudokuSolver @doc """ Solve a soduku """ @impl SudokuSolver @spec solve(SudokuBoardCandidates.t()) :: SudokuBoardCandidates.t() | nil def solve(%SudokuBoardCandidates{siz...
lib/sudoku_solver/cps_candidates.ex
0.645902
0.48438
cps_candidates.ex
starcoder
defmodule Slipstream.Connection.State do @moduledoc false alias Slipstream.TelemetryHelper # a struct for storing the internal state of a Slipstream.Connection # process # the module which implements the Slipstream behaviour is hereby known # as the implementor defstruct [ :connection_id, :tra...
lib/slipstream/connection/state.ex
0.809803
0.529568
state.ex
starcoder
defmodule UriQuery do @doc """ For cases when lists and maps are used in GET parameters. Returns keyword list corresponding to given enumerable that is safe to be encoded into a query string. Keys and Values can be any term that implements the `String.Chars` protocol. Lists connot be used as keys. Value...
lib/uri_query.ex
0.831691
0.492005
uri_query.ex
starcoder
defmodule Xgit.Util.ObservedFile do @moduledoc false # Records the cached parsed state of the file and its modification date # so that Xgit can avoid the work of re-parsing that file when we can # be sure it is unchanged. import Xgit.Util.ForceCoverage @typedoc ~S""" Cache for parsed state of the file ...
lib/xgit/util/observed_file.ex
0.887263
0.638849
observed_file.ex
starcoder
defmodule Main do @moduledoc """ This module is the main one, either called directly when starting the physical elevator, or indirectly by the Simulation node (below). The main purpose is to start a supervisor and initialize the child processes from it. """ use Supervisor @strategy :one_for_one @doc """...
lib/main.ex
0.608129
0.574454
main.ex
starcoder
defmodule Ecto.Query.Validator do @moduledoc false # This module does validation on the query checking that it's in a correct # format, raising if it's not. alias Ecto.Query.Util alias Ecto.Query.Query alias Ecto.Query.QueryExpr alias Ecto.Query.JoinExpr alias Ecto.Query.AssocJoinExpr defrecord Sta...
lib/ecto/query/validator.ex
0.542379
0.513363
validator.ex
starcoder
defmodule Multiverses.Application do @moduledoc """ This module is intended to be a drop-in replacement for `Application`. When you drop this module in, functions relating to runtime environment variables have been substituted with equivalent macros that respect the Multiverse pattern. ## Warning This ...
lib/multiverses/application.ex
0.73412
0.413566
application.ex
starcoder
defmodule AdventOfCode.Day17 do import AdventOfCode.Utils @typep int_pair :: {integer, integer} @typep area :: {int_pair, int_pair} # An arbitrary range that is suited for the dataset # Due to the large step size, the solution space may be # discontinuous. Brute-force is relatively fast and a lot simpler....
lib/advent_of_code/day_17.ex
0.798501
0.520923
day_17.ex
starcoder
defmodule Elixush.Instructions.Vectors do @moduledoc "Instructions that operate on various vector stacks." import Elixush.PushState import Elixush.Instructions.Common import Elixush.Globals.Agent, only: [get_globals: 1] def vector_integer_pop(state), do: popper(:vector_integer, state) def vector_float_pop(...
lib/instructions/vectors.ex
0.76207
0.635024
vectors.ex
starcoder
defmodule Cardanoex.Key do alias Cardanoex.Backend @moduledoc """ The Key module helps you to work with public keys for a wallet. """ @spec get_account_public_key(String.t()) :: {:error, String.t()} | {:ok, String.t()} @doc """ Retrieve the account public key of this wallet. ### Options * `wallet...
lib/key.ex
0.923212
0.451447
key.ex
starcoder
defmodule EdgeDB.Object do @moduledoc """ An immutable representation of an object instance returned from a query. `EdgeDB.Object` implements `Access` behavior to access properties by key. ```elixir iex(1)> {:ok, pid} = EdgeDB.start_link() iex(2)> %EdgeDB.Object{} = object = iex(2)> EdgeDB.query_requir...
lib/edgedb/types/object.ex
0.914157
0.695592
object.ex
starcoder
defmodule Guachiman.Auth0.Sandbox.JWTToken do @moduledoc """ JWT token sandbox to use in tests. In your `config/test.exs` file add the following: ``` config :guachiman, update_module: Guachiman.Auth0.Sandbox.JWTToken, audience: "some_audience" ``` and then in your tests request a valid token us...
lib/guachiman/auth0/sandbox/jwt_token.ex
0.820326
0.864882
jwt_token.ex
starcoder
defmodule BattleCity.Position do @moduledoc """ Position """ @type direction :: :up | :down | :left | :right import Integer, only: [is_even: 1] @size 12 @border 4 @atom 2 @width @border * 2 @xmin 0 @xmax @size * @atom @ymin 0 @ymax @size * @atom @xmid round((@xmin + @xmax) * 0.5) @x_pl...
lib/battle_city/position.ex
0.791499
0.610976
position.ex
starcoder
defmodule Sponsorly.DataCase do @moduledoc """ This module defines the setup for tests requiring access to the application's data layer. You may define functions here to be used as helpers in your tests. Finally, if the test case interacts with the database, we enable the SQL sandbox, so changes done to...
test/support/data_case.ex
0.837121
0.711732
data_case.ex
starcoder
defmodule Day20 do @regex_all ~r/p=<(-?\d+),(-?\d+),(-?\d+)>, v=<(-?\d+),(-?\d+),(-?\d+)>, a=<(-?\d+),(-?\d+),(-?\d+)>/ @regex_accelerations ~r/p=<-?\d+,-?\d+,-?\d+>, v=<-?\d+,-?\d+,-?\d+>, a=<(-?\d+),(-?\d+),(-?\d+)>/ def solveA(filename) do # Position at time t for a particule is: # Pt = P0 + x * V0 +...
2017/elixir/day20/lib/day20.ex
0.621196
0.730386
day20.ex
starcoder
defmodule MapRasterizer do require Logger def rasterize(map_data, grid_width, grid_height, resolution) do polygons = Stream.map(map_data, &process_map_data &1) |> Stream.filter(fn p -> p != nil end) |> Enum.to_list rasterize_grids(polygons, grid_width, grid_height, resolution) ...
lib/map_tile_renderer/map_rasterizer.ex
0.721743
0.57818
map_rasterizer.ex
starcoder
defmodule Nebulex.Adapters.Partitioned do @moduledoc ~S""" Built-in adapter for partitioned cache topology. ## Overall features * Partitioned cache topology (Sharding Distribution Model). * Configurable primary storage adapter. * Configurable Keyslot to distributed the keys across the cluster member...
lib/nebulex/adapters/partitioned.ex
0.904531
0.732185
partitioned.ex
starcoder
defmodule Madari.Accounts.UserToken do use Ecto.Schema import Ecto.Query @hash_algorithm :sha256 @rand_size 32 # It is very important to keep the reset password token expiry short, # since someone with access to the email may take over the account. @reset_password_validity_in_days 1 @confirm_validity_...
lib/madari/accounts/user_token.ex
0.722625
0.488344
user_token.ex
starcoder
defmodule AWS.FSx do @moduledoc """ Amazon FSx is a fully managed service that makes it easy for storage and application administrators to launch and use shared file storage. """ alias AWS.Client alias AWS.Request def metadata do %AWS.ServiceMetadata{ abbreviation: nil, api_version: "20...
lib/aws/generated/fsx.ex
0.872849
0.490602
fsx.ex
starcoder
defmodule Placebo do @moduledoc """ Placebo is a mocking library based on [meck](http://eproxus.github.io/meck/). It is inspired by [RSpec](http://rspec.info/) and [Mock](https://github.com/jjh42/mock). All the functionality covered below is provided by meck. Placebo is just a pretty wrapper around the featur...
lib/placebo.ex
0.776199
0.934335
placebo.ex
starcoder
defmodule Expug.Compiler do @moduledoc """ Compiles tokens into an AST. ## How it works Nodes are maps with a `:type` key. They are then filled up using a function with the same name as the type: node = %{type: :document} document({node, tokens}) This function returns another `{node, tokens}`...
lib/expug/compiler.ex
0.831554
0.647561
compiler.ex
starcoder
defmodule Abacus do @moduledoc """ A math-expression parser, evaluator and formatter for Elixir. ## Features ### Supported operators - `+`, `-`, `/`, `*` - Exponentials with `^` - Factorial (`n!`) - Bitwise operators * `<<` `>>` bitshift * `&` bitwise and * `|` bitwise or * `|...
lib/abacus.ex
0.741861
0.76145
abacus.ex
starcoder
defprotocol MapShaper do @moduledoc """ Protocol to turn a map into nested structs. """ @fallback_to_any true @doc """ Function to translate JSON map to a structure or a list of structures given as the first argument. First argument defines the shape of nested structures like the following: `[%Post...
example_json_parse/lib/map_shaper.ex
0.896485
0.612107
map_shaper.ex
starcoder
defmodule Membrane.RTP.SSRCRouter do @moduledoc """ A filter separating RTP packets from different SSRCs into different outpts. When receiving a new SSRC, it creates a new pad and notifies its parent (`t:new_stream_notification_t/0`) that should link the new output pad. """ use Membrane.Filter alias Me...
lib/membrane/rtp/ssrc_router.ex
0.832134
0.425665
ssrc_router.ex
starcoder
defmodule ABI do @moduledoc """ Documentation for ABI, the function interface language for Solidity. Generally, the ABI describes how to take binary Ethereum and transform it to or from types that Solidity understands. """ @doc """ Encodes the given data into the function signature or tuple signature. ...
lib/abi.ex
0.859221
0.520801
abi.ex
starcoder
defexception Dynamo.Router.InvalidHookError, kind: nil, hook: nil, actual: nil do def message(exception) do "expected #{exception.kind} hook #{inspect exception.hook} to return " <> "a HTTP connection, but got #{inspect exception.actual}" end end defmodule Dynamo.Router.Base do @moduledoc """ This mo...
lib/dynamo/router/base.ex
0.910903
0.464355
base.ex
starcoder
defmodule EpicenterWeb.Test.Pages.People do import ExUnit.Assertions import Phoenix.LiveViewTest alias Epicenter.Test alias EpicenterWeb.Test.LiveViewAssertions alias EpicenterWeb.Test.Pages alias Phoenix.LiveViewTest.View def visit(%Plug.Conn{} = conn), do: conn |> Pages.visit("/people") def ass...
test/support/pages/people.ex
0.58522
0.558959
people.ex
starcoder
defmodule Wallaby.Helpers.KeyCodes do @moduledoc """ Shortcuts for various keys. - :null - :cancel - :help - :backspace - :tab - :clear - :return - :enter - :shift - :control - :alt - :pause - :escape - :space - :pageup - :pagedown - :end - :home - :left_arrow - :up_arrow ...
lib/wallaby/helpers/key_codes.ex
0.673406
0.447219
key_codes.ex
starcoder
defmodule Pokecards do @moduledoc """ Provides functions to create and handle a deck of pokemons """ @moduledoc since: "0.1.0" require Pokemon @doc """ Creates a deck of pokemons ## Examples iex> deck = Pokecards.create_deck iex> deck """ @doc since: "0.1.0" def create_deck do ...
lib/pokecards.ex
0.783368
0.47792
pokecards.ex
starcoder
defmodule Lily.Operator do @moduledoc """ Creates operators using anonymous functions. Lily operators extends Elixir operators with anonymous functions. Instead of defining an operator using `def` or `defmacro`, you provide an equivalent anonymous function to `operator/1` or `operator_macro/1`. Use a fun...
lib/lily/operator.ex
0.893117
0.901791
operator.ex
starcoder
defmodule Ockam.Hub.Service.PubSub do @moduledoc """ PubSub service Subscribes workers (by return route) to a string topic Each topic can have multiple subscrtiptions Each subscription has a unique name and topic Name and topic are parsed from the payload as a BARE `string` type with the following form...
implementations/elixir/ockam/ockam_hub/lib/hub/service/pub_sub.ex
0.782953
0.483039
pub_sub.ex
starcoder
defmodule ExDjango.Utils.Baseconv do @moduledoc """ Functions for converting numbers from base 10 integers to base X strings and back again. Compatible with django/utils/baseconv.py """ @base10_chars "0123456789" def get_chars(base) do case base do :base2 -> "012" :base10 -> @base10_char...
lib/utils/baseconv.ex
0.655667
0.408336
baseconv.ex
starcoder
defmodule GoogleMaps do @moduledoc """ Helper functions for working with the Google Maps API. """ alias Util.Position alias GoogleMaps.MapData @host "https://maps.googleapis.com" @host_uri URI.parse(@host) @web "https://maps.google.com" @web_uri URI.parse(@web) @doc """ Given a path, returns a...
apps/google_maps/lib/google_maps.ex
0.806358
0.488893
google_maps.ex
starcoder
defmodule Statifier.Zipper.List do @moduledoc """ An implementation of a Zipper over a list Introductory Article: https://ferd.ca/yet-another-article-on-zippers.html Supports being able to traverse a list both forwards and backwards while maintaining a focus on the current element much like a doubly-linked ...
impl/ex/lib/zipper/list.ex
0.885869
0.751671
list.ex
starcoder
defmodule ExDhcp.Packet do @moduledoc """ provides a structure for the DHCP packet, according to the spec. (http://en.wikipedia.org/wiki/DHCP) the fields are as follows: - op: operation (request: 1, response: 2). This operation value allows DHCP providers to coexist with other DHCP providers. Since ...
lib/ex_dhcp/packet.ex
0.73431
0.502991
packet.ex
starcoder
defmodule Exnoops.Mashbot do @moduledoc """ Module to interact with Github's Noop: Mashbot See the [official `noop` documentation](https://noopschallenge.com/challenges/mashbot) for API information including the accepted parameters. """ require Logger import Exnoops.API import Exnoops.Vexbot, only: [for...
lib/exnoops/mashbot.ex
0.698946
0.600423
mashbot.ex
starcoder
defmodule Matrix do import ExclusiveRange @moduledoc "Matrix like things" @type t(of) :: %{required(non_neg_integer()) => %{required(non_neg_integer()) => of}} @spec of_dims(non_neg_integer(), non_neg_integer(), of) :: t(of) when of: var def of_dims(x, y, init) do col = Enum.map(erange(0..y), fn i -> {...
web/lib/infolab_light_games/matrix.ex
0.68763
0.541348
matrix.ex
starcoder
defmodule AWS.Cloudsearchdomain do @moduledoc """ You use the AmazonCloudSearch2013 API to upload documents to a search domain and search those documents. The endpoints for submitting `UploadDocuments`, `Search`, and `Suggest` requests are domain-specific. To get the endpoints for your domain, use the Amazo...
lib/aws/generated/cloudsearchdomain.ex
0.884108
0.593786
cloudsearchdomain.ex
starcoder
defmodule Judgment.Majority.Analysis do @moduledoc """ An analysis of the tally of a single proposal (its merit profile). This does not hold the score nor the rank and is used to compute the score. """ defstruct [ :median_grade, :second_group_grade, :second_group_size, :second_group_sign, ...
lib/judgment/majority/analysis.ex
0.738858
0.530662
analysis.ex
starcoder
defmodule VintageNetEthernet do @behaviour VintageNet.Technology require Logger alias VintageNet.Interface.RawConfig alias VintageNet.IP.{DhcpdConfig, IPv4Config} alias VintageNetEthernet.MacAddress @moduledoc """ Support for common wired Ethernet interface configurations Configurations for this tec...
lib/vintage_net_ethernet.ex
0.814422
0.605391
vintage_net_ethernet.ex
starcoder
defmodule MoneyBin.Ledgers do use MoneyBin, :service @moduledoc """ This module is the primary interface for creating and retrieving ledgers. It also contains a query that can be used for preloading ecto associations with aggregate data. """ @doc """ Creates a `MoneyBin.Ledger`. Must have at least ...
lib/money_bin/ledgers/ledgers.ex
0.77081
0.404655
ledgers.ex
starcoder
defmodule Placid.Response.Helpers do @moduledoc """ Placid bundles these response helpers with handlers to assist in sending a response. #### Example defmodule Hello do use Placid.Handler def index(conn, []) do render conn, "showing index handler" end def show...
lib/placid/response/helpers.ex
0.867808
0.528108
helpers.ex
starcoder
defmodule Resourceful.Type.Ecto.Query do @moduledoc """ This module is something of hack designed to deal with the fact that Ecto does not make it simple to: 1. Dynamically assigned aliases to joins. When specifying `:as` it _must_ be a compile-time atom. A recent reference to this issue can be found ...
lib/resourceful/type/ecto/query.ex
0.856752
0.732855
query.ex
starcoder
defmodule Pulsar.Dashboard do @moduledoc """ The logic for managing a set of jobs and updating them. """ alias IO.ANSI alias __MODULE__.Terminal, as: T # jobs is a map from job id to job # new_jobs is a count of the number of jobs added since the most recent flush, e.g., number of new lines to print on ...
lib/pulsar/dashboard.ex
0.830353
0.485905
dashboard.ex
starcoder
defmodule Sanbase.Metric.Transform do def transform_to_value_pairs(data, key_name \\ nil) def transform_to_value_pairs({:ok, []}, _), do: {:ok, []} def transform_to_value_pairs({:ok, result}, nil) do # deduce the key name. It is the key other than the :datetime # If there are more than 1 key different t...
lib/sanbase/metric/transform.ex
0.692954
0.602822
transform.ex
starcoder
defmodule Grid do @moduledoc """ Grid creation :rand.seed(:exsplus, seed) """ import Util alias Grid.Obstacle @type grid :: %{{integer, integer} => :empty | :obstacle | :occupied} @type coordinates :: {integer, integer} @type t :: grid @doc ~S""" Example usage `Grid.generate(:disk, [17], 30...
lib/grid.ex
0.744099
0.573201
grid.ex
starcoder
defmodule Resemblixir.Compare do require EEx use Wallaby.DSL use GenServer alias Resemblixir.{Scenario, Screenshot, Breakpoint} defstruct [:test, :scenario, :breakpoint, :mismatch_percentage, :bypass, :session, :raw_mismatch_percentage, :is_same_dimensions, :analysis_time, dimensio...
lib/resemblixir/compare.ex
0.621656
0.468487
compare.ex
starcoder
defmodule Oban.Plugins.Lifeline do @moduledoc """ Naively transition jobs stuck `executing` back to `available`. The `Lifeline` plugin periodically rescues orphaned jobs, i.e. jobs that are stuck in the `executing` state because the node was shut down before the job could finish. Rescuing is purely based on ...
lib/oban/plugins/lifeline.ex
0.86212
0.655257
lifeline.ex
starcoder
defmodule Elastic.Index do alias Elastic.HTTP alias Elastic.Query @moduledoc ~S""" Collection of functions to work with indices. """ @doc """ Helper function for getting the name of an index combined with the `index_prefix` and `mix_env` configuration. """ def name(index) do [index_prefix(), m...
lib/elastic/index.ex
0.911618
0.845241
index.ex
starcoder
defmodule ProxerEx.Api.Info do @moduledoc """ Contains helper methods to build requests for the info api. """ use ProxerEx.Api.Base, api_class: "info" api_func "character" do api_doc(""" Constructs a `ProxerEx.Request` that can be used to send a request to the ```Info/Get Character``` api. This...
lib/api_classes/info_api.ex
0.891841
0.779574
info_api.ex
starcoder
defmodule ESpec.Assertions.BeType do @moduledoc """ Defines 'be_type' assertion. it do: expect("abc").to be_binary """ use ESpec.Assertions.Interface defp match(subject, :null) do result = is_nil(subject) {result, result} end defp match(subject, [:function, arity]) do result = is_function...
lib/espec/assertions/be_type.ex
0.671255
0.709849
be_type.ex
starcoder
defmodule LinkedMapSet do @moduledoc """ A `LinkedMapSet` is an extension to `MapSet` that keeps pointers to previous and next elements based on add order. """ alias LinkedMapSet.{DuplicateValueError, MissingValueError} alias LinkedMapSet.Node @enforce_keys [:items] defstruct head: nil, tail: nil, item...
lib/linked_map_set.ex
0.941714
0.619097
linked_map_set.ex
starcoder
defmodule Roger.Partition.Retry do @moduledoc """ Implements the retry logic for jobs. Jobs are retried at a fixed number of delay intervals. By default, these are the following (in seconds): 1, 3, 5, 10, 20, 35, 60, 100, 200, 400, 1000, 1800. To override these levels, set the following configuration: ...
lib/roger/partition/retry.ex
0.734501
0.467332
retry.ex
starcoder
defmodule AccessTokens do @moduledoc """ A module that provides basic functionality to retrieve an Access Token via its ID. """ import Ecto.Query alias AccessToken alias Issuer alias Audience @doc """ Retrieve an AccessToken schema struct, given it's ID. See query_by_id/2 for further details on...
lib/access_tokens.ex
0.743447
0.433322
access_tokens.ex
starcoder
defmodule BattleBox.Games.Marooned.Error do alias BattleBox.Games.Marooned alias BattleBox.Games.Marooned.Logic defmodule Template do defmacro __using__(_opts) do quote do import unquote(__MODULE__) @derive Jason.Encoder @enforce_keys [:msg] defstruct [:msg] end ...
lib/battle_box/games/marooned/error.ex
0.719088
0.432303
error.ex
starcoder
defmodule BoggleEngine.Utilities do @moduledoc """ Utility functions for project. """ @doc """ Takes a string and returns a list of strings separated on uppercase. Leading lowercase letters will be dropped. Letters that do not have cases will be chunked like uppercase letters. Lower case letters trailing...
lib/boggle_engine/utilities.ex
0.808899
0.452415
utilities.ex
starcoder
defmodule Roman.Decoder do @moduledoc false alias Roman.Validators.{Numeral, Sequence} @default_error {:error, {:invalid_numeral, "numeral is invalid"}} @valid_options [:explain, :ignore_case, :strict, :zero] @type decoded_numeral :: {Roman.numeral(), map} @spec decode(String.t(), keyword | map) :: {:ok...
lib/roman/decoder.ex
0.856677
0.464355
decoder.ex
starcoder
defmodule Dwarves.BinanceFutures do alias Binance.Rest.HTTPClient require Logger # Server @spec ping :: {:error, {:http_error, HTTPoison.Error.t()} | {:poison_decode_error, Poison.ParseError.t()} | map} | {:ok, false | nil | true | binary | list | number |...
lib/binance_futures.ex
0.880989
0.683736
binance_futures.ex
starcoder
defmodule Exq.Redis.Connection do @moduledoc """ The Connection module encapsulates interaction with a live Redis connection or pool. """ require Logger def flushdb!() do qa(["flushdb"]) end def incr!(key) do {:ok, count} = q(["INCR", key]) count end def get!(key) do {:ok, val} = q...
lib/exq/redis/connection.ex
0.640523
0.411879
connection.ex
starcoder
defmodule Liaison.IP do @moduledoc """ Allow the conversion of common IP formats to and from * string: "1.2.3.4" * component: {1, 2, 3, 4} * integer: 16909060 Input formats can be equal to output formats ## Example iex> Liaison.IP.as_string("1.2.3.4") "1.2.3.4" """ use Bitwise @type...
lib/ip.ex
0.87785
0.602354
ip.ex
starcoder
defmodule Estated.CastHelpers do @moduledoc false @moduledoc since: "0.1.0" @doc """ Cast a `t:String.t/0` to a `t:Date.t/0`. Passes through invalid `t:String.t/0` values and values that are not a `t:String.t/0`. ## Examples iex> Estated.CastHelpers.cast_date("2020-04-17") ~D[2020-04-17] ...
lib/estated/cast_helpers.ex
0.917912
0.462352
cast_helpers.ex
starcoder
defmodule Neuron do use GenServer @moduledoc """ A neuron for neural networks, for now it only works with raw numeric data """ @impl true def init(%{ activation_function: activation_function, learning_rate: learning_rate, input_weights: input_weights, bias_weight: bias_weig...
lib/neuron.ex
0.874761
0.635456
neuron.ex
starcoder
defmodule Day9 do defstruct [:scores, :players, :board] alias Board def parse(str) do [_, players, turns] = Regex.run(~r/(\d+) players.+ (\d+) points/, str) {String.to_integer(players), String.to_integer(turns)} end def new(players) do %__MODULE__{ scores: %{}, players: players, ...
lib/day9.ex
0.797044
0.489442
day9.ex
starcoder
defmodule Arb do @moduledoc """ A NIF for controlling the ABACOM CH341A relay board. """ use Rustler, otp_app: :arb, crate: :arb @port_definition [ type: :non_neg_integer, doc: "The USB port to be used. Only necessary if multiple relay boards are connected." ] @verify_definition [ t...
lib/arb.ex
0.883072
0.465995
arb.ex
starcoder
defmodule HAP.Characteristic do @moduledoc """ Functions to aid in the manipulation of characteristics tuples """ @typedoc """ Represents a single characteristic consisting of a static definition and a value source """ @type t :: {module(), value_source()} @typedoc """ Represents a source for a char...
lib/hap/characteristic.ex
0.836321
0.541954
characteristic.ex
starcoder
defmodule PolyAmory do @moduledoc """ Creates a polymorphic embedded type """ alias Ecto.Changeset @doc """ # Arguments * `types`: Keyword list of `{name, type}`. The `name` is stored in the database in order to identify what `type` to use in runtime. * `type_field`: Name of the field used to the typ...
lib/poly_amory.ex
0.829457
0.410993
poly_amory.ex
starcoder
defmodule Okta.OIDC do @moduledoc """ The `Okta.OIDC` module provides access methods to the [Okta OpenID Connect & OAuth 2.0 API](https://developer.okta.com/docs/reference/api/oidc/). All methods require a Tesla Client struct created with `Okta.OIDC.client`. This client uses [client authentication](https://dev...
lib/okta/oidc.ex
0.89546
0.476823
oidc.ex
starcoder
defmodule Seven.EventStore.State do @moduledoc false @type string_to_pids :: Map.t() @type pid_to_strings :: Map.t() @type pid_to_references :: Map.t() @opaque t :: %__MODULE__{ event_to_pids: string_to_pids, pid_to_events: pid_to_strings, pid_to_monitor: pid_to_reference...
lib/seven/event_store/state.ex
0.677581
0.567547
state.ex
starcoder
defmodule Tensorflow.TensorDebugMode do @moduledoc false use Protobuf, enum: true, syntax: :proto3 @type t :: integer | :UNSPECIFIED | :NO_TENSOR | :CURT_HEALTH | :CONCISE_HEALTH | :FULL_HEALTH | :SHAPE | :FULL_NUMERICS | :...
lib/tensorflow/core/protobuf/debug_event.pb.ex
0.721939
0.44342
debug_event.pb.ex
starcoder
defmodule Render.Core.DataHandler do @moduledoc """ Handle the model's setps's sections data The `Render.Core.Parser.exec/1` is used in the name and the content """ alias Fatex.LatexConfigs @doc """ Returns a list with the strins of the sections in order from the DB """ @spec concat_all(integer) :: ...
lib/render/core/data_handler.ex
0.713332
0.409457
data_handler.ex
starcoder
defmodule GuardianRedis.Repo do @moduledoc """ `GuardianRedis.Repo` is a repo module that operates Guardian.DB.Token in Redis. The repo module serves only GuardianDb purpose, do not use it as a Redis repo for your project. Dependant on :jason and :redix. Stores and deletes JWT token to/from Redis usi...
lib/repo.ex
0.776919
0.615926
repo.ex
starcoder
defmodule StringIO do @moduledoc """ This module provides an IO device that wraps a string. ## Examples iex> { :ok, pid } = StringIO.open("foo") iex> IO.read(pid, 2) "fo" """ use GenServer.Behaviour defrecordp :state, input: "", output: "", capture_prompt: false @doc """ Creates ...
lib/elixir/lib/string_io.ex
0.82755
0.401453
string_io.ex
starcoder
defmodule Sanbase.Alert.Validation.Target do @doc ~s""" Check if a given `target` is a valid target argument for an alert. A target can be valid if it match one of many criteria. For more information, check the function headers. """ def valid_target?("default"), do: :ok def valid_target?(%{user_list: in...
lib/sanbase/alerts/trigger/validation/target_validation.ex
0.805938
0.500854
target_validation.ex
starcoder
defmodule Money do @moduledoc ~S""" `Money` represents some monetary value (stored in cents) in a given currency. See `Money.Ecto` for a custom type implementation that can be used in schemas. In order to use the `~M` sigil, import the module: import Money ## Examples iex> Money.new("10.0...
apps/money/lib/money.ex
0.837155
0.470493
money.ex
starcoder
import Kernel, except: [apply: 2] defmodule Ecto.Query.Builder.OrderBy do @moduledoc false alias Ecto.Query.Builder @doc """ Escapes an order by query. The query is escaped to a list of `{direction, expression}` pairs at runtime. Escaping also validates direction is one of `:asc` or `:desc`. ## Exa...
data/web/deps/ecto/lib/ecto/query/builder/order_by.ex
0.853593
0.508422
order_by.ex
starcoder
defmodule ChainDefinition do @enforce_keys [ :block_reward_position, :chain_id, :check_window, :min_diversity, :min_transaction_fee, :get_block_hash_limit, :allow_contract_override ] defstruct @enforce_keys @type t :: %ChainDefinition{ block_reward_position: :last | :first...
lib/chaindefinition.ex
0.811228
0.430626
chaindefinition.ex
starcoder
defmodule Apoc do @moduledoc """ Comprehensive docs coming soon! """ @typedoc """ Hex (lowercase) encoded string See `Apoc.hex/1` """ @type hexstring :: binary() @typedoc """ An encoded string that represents a string encoded in Apoc's encoding scheme (URL safe Base 64). See `Apoc.encode/1` ...
lib/apoc.ex
0.865764
0.888614
apoc.ex
starcoder
defmodule Searchex.Keyword.Server do @moduledoc false use GenServer @doc """ Keyword Server We start one KeywordSer for each keyword in the index. The state looks like: %{"DIOCID1" => [list of positions], "DIOCID2" => [list of positions]} """ def start_link(server_name \\ :server) do GenServer...
lib/searchex/keyword/server.ex
0.581778
0.445047
server.ex
starcoder
defmodule Xgit.Repository.WorkingTree do @moduledoc ~S""" A working tree is an on-disk manifestation of a commit or pending commit in a git repository. An `Xgit.Repository.Storage` may have a default working tree associated with it or it may not. (A repository without a working tree is often referred to as a...
lib/xgit/repository/working_tree.ex
0.859723
0.412589
working_tree.ex
starcoder
defmodule KinesisClient.Stream do @moduledoc """ This is the entry point for processing the shards of a Kinesis Data Stream. """ use Supervisor require Logger import KinesisClient.Util alias KinesisClient.Stream.Coordinator @doc """ Starts a `KinesisClient.Stream` process. ## Options * `:strea...
lib/kinesis_client/stream.ex
0.836354
0.456107
stream.ex
starcoder
defmodule ElixirFilms.Movies do @moduledoc """ The Movies context. """ import Ecto.Query, warn: false alias ElixirFilms.{ Repo, Movies.Movie, Movies.ImportMovieJob } @doc """ Returns the list of movies. ## Examples iex> list_movies() [%Movie{}, ...] """ def list_movie...
lib/elixir_films/movies.ex
0.837221
0.431764
movies.ex
starcoder
defmodule LatticeObserver.Observed.Lattice do @annotation_app_spec "wasmcloud.dev/appspec" @moduledoc """ The root structure of an observed lattice. An observed lattice is essentially an event sourced aggregate who state is determined by application of a stream of lattice events """ alias __MODULE__ a...
lib/lattice_observer/observed/lattice.ex
0.806091
0.404272
lattice.ex
starcoder
defmodule Extatus.Metric.Counter do @moduledoc """ This module defines a wrapper over `Prometheus.Metric.Counter` functions to be compatible with `Extatus` way of handling metrics. """ alias Extatus.Settings @metric Settings.extatus_counter_mod() @doc """ Creates a counter using the `name` of a metric...
lib/extatus/metric/counter.ex
0.846657
0.550245
counter.ex
starcoder
defmodule FalconPlusApi.Api.Alarm do alias Maxwell.Conn alias FalconPlusApi.{Util, Sig, Api} @doc """ * [Session](#/authentication) Required ### Request Content-type: application/x-www-form-urlencoded ```event_id=s_165_cef145900bf4e2a4a0db8b85762b9cdb ``` ### Response `...
lib/falcon_plus_api/api/alarm.ex
0.705278
0.648181
alarm.ex
starcoder
defmodule Terrasol do @moduledoc """ Various utility functions to assist with some of the unique requirements for Earthstar documents. """ defimpl Jason.Encoder, for: [Terrasol.Author, Terrasol.Workspace, Terrasol.Path] do def encode(struct, opts) do Jason.Encode.string(struct.string, opts) end...
lib/terrasol.ex
0.730001
0.536495
terrasol.ex
starcoder
defmodule Timex.Comparable.Diff do @moduledoc false alias Timex.Types alias Timex.Duration alias Timex.Comparable @units [:years, :months, :weeks, :calendar_weeks, :days, :hours, :minutes, :seconds, :milliseconds, :microseconds, :duration] @spec diff(Types.microseconds, Types.microsec...
deps/timex/lib/comparable/diff.ex
0.783906
0.709384
diff.ex
starcoder
defmodule Raft.Log do @moduledoc """ The `Log` module provides an api for all log operations. Since the log process is the only process that can access the underlying log store we cache several values in the log process state. """ use GenServer require Logger alias Raft.{ Config, Log.Entry, ...
lib/raft/log.ex
0.841272
0.587647
log.ex
starcoder
defmodule Dune.AtomMapping do @moduledoc false alias Dune.{Success, Failure} @type substitute_atom :: atom @type substitute_string :: String.t() @type original_string :: String.t() @type sub_mapping :: %{optional(substitute_atom) => original_string} @type extra_info :: %{optional(substitute_atom) => :wr...
lib/dune/atom_mapping.ex
0.813831
0.488222
atom_mapping.ex
starcoder
defmodule Jumubase.Showtime.Results do alias Jumubase.JumuParams alias Jumubase.Foundation.AgeGroups alias Jumubase.Showtime.{Appearance, Performance} @doc """ Returns a mapping from point ranges to ratings, depending on round. """ def ratings_for_round(0) do %{ (23..25) => "mit hervorragendem ...
lib/jumubase/showtime/results.ex
0.688468
0.437643
results.ex
starcoder
defmodule Sneex.Ops.Increment do @moduledoc """ This represents the op codes for incrementing a value (INC, INX, and INY). """ defstruct [:disasm_override, :bit_size, :cycle_mods, :address_mode] alias Sneex.Address.{Absolute, CycleCalculator, DirectPage, Indexed, Mode, Register} alias Sneex.{Cpu, CpuHelper...
lib/sneex/ops/increment.ex
0.822403
0.408483
increment.ex
starcoder
defmodule SPARQL.Query.Result.Format do @moduledoc """ A behaviour for SPARQL query result formats. A `SPARQL.Query.Result.Format` for a format can be implemented like this defmodule SomeFormat do use SPARQL.Query.Result.Format import RDF.Sigils @id ~I<http://example.com/s...
lib/sparql/query/result/format.ex
0.736874
0.491822
format.ex
starcoder
defmodule AWS.CloudHSMV2 do @moduledoc """ For more information about AWS CloudHSM, see [AWS CloudHSM](http://aws.amazon.com/cloudhsm/) and the [AWS CloudHSM User Guide](https://docs.aws.amazon.com/cloudhsm/latest/userguide/). """ @doc """ Copy an AWS CloudHSM cluster backup to a different region. """...
lib/aws/cloud_hsm_v2.ex
0.774754
0.569553
cloud_hsm_v2.ex
starcoder
defmodule Appsignal.Instrumentation.Helpers do @moduledoc """ Helper functions and macros to instrument function calls. """ alias Appsignal.{Transaction, TransactionRegistry} @type instrument_arg :: Transaction.t | Plug.Conn.t | pid() | nil @doc """ Execute the given function in start / finish event ca...
lib/appsignal/instrumentation/helpers.ex
0.865778
0.81549
helpers.ex
starcoder
defmodule Terminus.Bitbus do @moduledoc """ Module for interfacing with the [Bitbus](https://bitbus.network) API. Bitbus is a powerful API that allows you to crawl a filtered subset of the Bitcoin blockchain. Bitbus indexes blocks, thus can be used to crawl **confirmed** transactions. > We run a highly ef...
lib/terminus/bitbus.ex
0.890014
0.871639
bitbus.ex
starcoder
defmodule Upvest.Tenancy.Historical.HDBlock do @moduledoc """ HDBlock represents block object from historical data API """ defstruct [ :number, :hash, :parent_hash, :nonce, :sha3uncles, :transactions_root, :receipts_root, :miner, :difficulty, :total_difficulty, :extra...
lib/upvest/tenancy/historical.ex
0.785144
0.418608
historical.ex
starcoder
defmodule Genex.Tools.Benchmarks.Binary do @moduledoc """ Benchmark objective functions for binary genetic algorithms. """ @doc """ Binary deceptive function. Returns ```math```. # Parameters - `chromosome`: `%Chromosome{}` """ def chuang_f1(chromosome) do last = Enum.at(chromosome.genes, ...
lib/genex/tools/benchmarks/binary.ex
0.83901
0.892187
binary.ex
starcoder
defmodule Grapevine.Presence.Client do @moduledoc """ Implementation of the Presence client """ alias Grapevine.Applications alias Grapevine.Client alias Grapevine.Games import Grapevine.Presence, only: [ets_key: 0] @timeout_seconds 60 @doc """ Number of seconds that a game can be offline before...
lib/grapevine/presence/client.ex
0.721351
0.41742
client.ex
starcoder
defmodule Plymio.Name.Utils do @moduledoc ~S""" Utility functions for `names` An element of a `name` is anything `Kernel.to_string/1` can transform to a string. """ @typedoc "A name element" @type namel :: nil | :atom | :number | String.t @typedoc "A name" @type name :: namel | [namel] @typedoc "...
lib/name/utils.ex
0.912495
0.603581
utils.ex
starcoder
defmodule ExPIX do @moduledoc """ Module with basic operations. All functions in this library use the parameters in the `config.exs` file. By default, the configuration for building static QR-Codes is: ```elixir config :ex_pix, :static_code, payload_indicator: "01", start_method: "11", gui: "br....
lib/ex_pix.ex
0.89998
0.941708
ex_pix.ex
starcoder