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
% Most methods simply map to Erlang ones. Use ETS.new(tid|atom) to wrap an % existing ETS table. Use ETS.create to create a new one. module ETS def new(table) #ETS::Behavior(table) end % Creates new ets table. def create(name, options) #ETS::Behavior(Erlang.ets.new(name, options.to_list)) end % Re...
lib/ets.ex
0.696578
0.683169
ets.ex
starcoder
defmodule ExAdmin.Index do @moduledoc """ Override the default index page for an ExAdmin resource By default, ExAdmin renders the index table without any additional configuration. It renders each column in the model, except the id, inserted_at, and updated_at columns. ## Default Table Type ExAdmin disp...
lib/ex_admin/index.ex
0.841663
0.608769
index.ex
starcoder
defmodule SudokuSolver.RecursiveCandidates do @moduledoc """ Implementes SudokuSolver using recursion """ @behaviour SudokuSolver @doc """ Implements a sudoku solver using recursion """ @impl SudokuSolver @spec solve(SudokuBoardCandidates.t()) :: SudokuBoardCandidates.t() | nil def solve(%SudokuBoa...
lib/sudoku_solver/recursive_candidates.ex
0.694717
0.522263
recursive_candidates.ex
starcoder
defmodule Facade.Attributes.Global do @moduledoc """ Global attributes are attributes common to all HTML elements; they can be used on all elements, though they may have no effect on some elements. Global attributes may be specified on all HTML elements, even those not specified in the standard. That means t...
lib/facade/attributes/global.ex
0.91829
0.481698
global.ex
starcoder
defmodule Contex.PointPlot do @moduledoc """ A simple point plot, plotting points showing y values against x values. It is possible to specify multiple y columns with the same x column. It is not yet possible to specify multiple independent series. The x column can either be numeric or date time data. If nu...
lib/chart/pointplot.ex
0.955319
0.98652
pointplot.ex
starcoder
defmodule Livebook.FileSystem.Utils do @moduledoc false alias Livebook.FileSystem @doc """ Asserts that the given path is a directory. """ @spec assert_dir_path!(FileSystem.path()) :: :ok def assert_dir_path!(path) do unless dir_path?(path) do raise ArgumentError, "expected a directory path, g...
lib/livebook/file_system/utils.ex
0.81409
0.463505
utils.ex
starcoder
defmodule Radixir.Core do @moduledoc """ Provides high level interaction with the Core API. """ alias Radixir.Core.API alias Radixir.Core.Request alias Radixir.Key alias Radixir.Util @type public_key :: String.t() @type private_key :: String.t() @type type :: String.t() @type address :: String.t...
lib/radixir/core.ex
0.905763
0.458712
core.ex
starcoder
defmodule OwlBear do @moduledoc """ OwlBear handles both the happy paths and the error paths of functions within a single Elixir pipeline. A terribly conflicted creature, light and free like an `{:ok, owl}`, heavy and brutal like an angry `{:error, bear}`. ### Run _...to run functions on the happy path......
scottsouthworth+elixir/lib/owlbear.ex
0.817101
0.72086
owlbear.ex
starcoder
defmodule EctoUtils.Repo do @moduledoc """ Utility module containing functions which aim to augment modules that `use Ecto.Repo` """ @doc """ Allows you to execute any `EctoUtils.Repo` function in the module that `use`-es this macro. This is useful for centralizing Repo functions in your app's own repo ...
lib/ecto_utils/repo.ex
0.777764
0.716541
repo.ex
starcoder
defmodule RedisCache do @moduledoc """ Currently only works by merging/replacing with maps and then pull/push-ing. In the future, this should implement `Access`, `Enumerable` and `Collectable` - meaning this could then be used with Elixir's `Enum` w/o limitations. These should work independant of whether or ...
lib/redis_cache.ex
0.737064
0.493653
redis_cache.ex
starcoder
defmodule Bigtable.ChunkReader do @moduledoc """ Reads chunks from `Google.Bigtable.V2.ReadRowsResponse` and parses them into complete cells grouped by rowkey. """ use Agent, restart: :temporary defmodule ReadCell do @moduledoc """ A finished cell produced by `Bigtable.ChunkReader`. """ defs...
lib/data/chunk_reader.ex
0.828141
0.519887
chunk_reader.ex
starcoder
defmodule FlexLogger do @moduledoc """ `FlexLogger` is a flexible logger (backend) that adds module/application specific log levels to Elixir's `Logger`. `FlexLogger` brings the following additions to the table: * Configuration of log levels per application, module or even function * Possibility of hav...
lib/flex_logger.ex
0.86712
0.508666
flex_logger.ex
starcoder
defmodule Que.Queue do defstruct [:worker, :queued, :running] @moduledoc """ Module to manage a Queue comprising of multiple jobs. Responsible for queueing (duh), executing and handling callbacks, for `Que.Job`s of a specific `Que.Worker`. Also keeps track of running jobs and processes them concurrently ...
lib/que/queue.ex
0.695752
0.4856
queue.ex
starcoder
defmodule Config.Reader do @moduledoc """ API for reading config files defined with `Config`. ## As a provider `Config.Reader` can also be used as a `Config.Provider`. A config provider is used during releases to customize how applications are configured. When used as a provider, it expects a single argum...
lib/elixir/lib/config/reader.ex
0.851691
0.478894
reader.ex
starcoder
defmodule API.Plugs.ExpectParams.ParamsValidator do @moduledoc """ Contains validation logic for params. """ def validate(conn_params, expected_params) do Enum.reduce_while(expected_params, {:ok, %{}}, fn param, {:ok, acc} -> with {:ok, value} <- validate_required(conn_params, param.name, param.requi...
apps/api/lib/api/plugs/expect_params/params_validator.ex
0.689933
0.49109
params_validator.ex
starcoder
defmodule Faker.Name.Ru.Male do import Faker, only: [sampler: 2] @moduledoc """ Functions for male name data in Russian """ @doc """ Returns a complete name (may include a prefix) ## Examples iex> Faker.Name.Ru.Male.name() "Д-р. <NAME>" iex> Faker.Name.Ru.Male.name() "<NAME>" ...
lib/faker/name/ru/male.ex
0.507324
0.543711
male.ex
starcoder
defmodule Scrivener.HTML.Parse do import Scrivener.HTML.Helper, only: [fetch_options: 2, clamp: 3] require Integer alias Scrivener.Page @defaults [ range: 5, prev: "PREV", next: "NEXT", first?: true, last?: true, ellipsis: {:safe, "&hellip;"} ] @doc """ Returns the raw data in or...
lib/scrivener/html/parse.ex
0.898924
0.861305
parse.ex
starcoder
defmodule AWS.Macie2 do @moduledoc """ Amazon Macie is a fully managed data security and data privacy service that uses machine learning and pattern matching to discover and protect your sensitive data in AWS. Macie automates the discovery of sensitive data, such as PII and intellectual property, to provi...
lib/aws/generated/macie2.ex
0.657209
0.587174
macie2.ex
starcoder
defmodule Serum.Post do @moduledoc """ Defines a struct representing a blog post page. ## Fields * `file`: Source path * `title`: Post title * `date`: Post date (formatted) * `raw_date`: Post date (erlang tuple style) * `tags`: A list of tags * `url`: Absolute URL of the blog post in the website *...
lib/serum/post.ex
0.817246
0.413211
post.ex
starcoder
defmodule Article do require Logger @type t :: %__MODULE__{ date: Date.t() | nil, end: Data.RoughDate.t() | nil, full_title: binary() | nil, hide_footer: boolean() | nil, name: binary(), no_auto_title: boolean() | nil, start: Data.RoughDate.t() ...
lib/article/article.ex
0.850453
0.400984
article.ex
starcoder
defmodule BSV.TxIn do @moduledoc """ A TxIn is a data structure representing a single input in a `t:BSV.Tx.t/0`. A TxIn consists of the `t:BSV.OutPoint.t/0` of the output which is being spent, a Script known as the unlocking script, and a sequence number. A TxIn spends a previous output by concatenating the...
lib/bsv/tx_in.ex
0.898571
0.884189
tx_in.ex
starcoder
defmodule Rig.Config do @moduledoc """ Rig module configuration that provides `settings/0`. There are two ways to use this module ### Specify a list of expected keys ``` defmodule Rig.MyExample do use Rig.Config, [:some_key, :other_key] end ``` `Rig.Config` expects a config entry similar to th...
apps/rig/lib/rig/config.ex
0.919521
0.821796
config.ex
starcoder
defmodule Day2 do @moduledoc """ Solutions for day 2 """ @min_search 1 @max_search 99 # Get the next {noun, verb} to use in finding a solution for an # intcode program defp get_next_search({noun, verb}, search_start, search_end) when is_integer(noun) do n = noun + 1 v = verb + 1 cond do ...
aoc2019/lib/day2.ex
0.736306
0.529507
day2.ex
starcoder
defmodule TinyColor.HSV do @moduledoc """ Represents a color in the for of red, green, blue, and optional alpha """ defstruct hue: 0.0, saturation: 0.0, value: 0.0, alpha: 1.0 import TinyColor.Normalize @doc ~S""" Returns a string representation of this color. hex is only supported if alpha == 1.0 ##...
lib/tiny_color/spaces/hsv.ex
0.89285
0.614466
hsv.ex
starcoder
defmodule ExDoc.Markdown do @moduledoc """ Adapter behaviour and conveniences for converting Markdown to HTML. ExDoc is compatible with any markdown processor that implements the functions defined in this module. The markdown processor can be changed via the `:markdown_processor` option in your `mix.exs`. ...
lib/ex_doc/markdown.ex
0.792705
0.488954
markdown.ex
starcoder
defmodule XDR.Base do @moduledoc """ Provides the ability to predefine and precompile specific XDR types for your application. Create a module in your app, and `use XDR.Base`. Your module will now have access to the `define_type` macro, as well as all of the functions on the main `XDR` module. See [the ...
lib/xdr/base.ex
0.877437
0.401043
base.ex
starcoder
defmodule Cog.Assertions do import ExUnit.Assertions alias Cog.Util.TimeHelpers require Logger @interval 1000 # 1 second @timeout 10000 # 10 seconds # Used when the expected and actual values will eventually converge within a # given timeout. The `expected` value will be checked for equality with the ...
test/support/assertions.ex
0.716119
0.659097
assertions.ex
starcoder
defmodule Together do @moduledoc ~S""" Group actions that can be handled / responded to later together ## What for? - group notifications to be sent in *one* email - cancel the previously queued email if another event happens within a short period (type: debounce) - make heavy operations happen less oft...
lib/together.ex
0.787155
0.53522
together.ex
starcoder
alias Igo.Stone, as: Stone alias Igo.Printer, as: Printer defmodule Igo.Board do def new(size) do build_board(size * size, []) end def place_stone(board, color, coord) do index = board_index(board, coord) board = List.replace_at(board, index, color) capture_stones(board, Stone.opposite_color(col...
lib/igo/board.ex
0.512937
0.472136
board.ex
starcoder
defmodule Adventofcode.Day24PlanetOfDiscord do use Adventofcode alias __MODULE__.{ BiodiversityRating, Bugs, Parser, Printer, Recursive, UntilRepeat } def part_1(input) do input |> Parser.parse() |> Bugs.new() |> UntilRepeat.run() |> BiodiversityRating.calculate() ...
lib/day_24_planet_of_discord.ex
0.7181
0.653238
day_24_planet_of_discord.ex
starcoder
defmodule EctoTablestore.Schema do @moduledoc ~S""" Defines a schema for Tablestore. An Ecto schema is used to map any data source into an Elixir struct. The definition of the schema is possible through the API: `tablestore_schema/2`. `tablestore_schema/2` is typically used to map data from a persisted sour...
lib/ecto_tablestore/schema.ex
0.847242
0.588446
schema.ex
starcoder
defmodule Raxx.HTTP1 do @moduledoc """ Toolkit for parsing and serializing requests to HTTP/1.1 format. The majority of functions return iolists and not compacted binaries. To efficiently turn a list into a binary use `IO.iodata_to_binary/1` ## Notes ### content-length The serializer does not add the ...
lib/raxx/http1.ex
0.901014
0.530358
http1.ex
starcoder
defprotocol Socket.Stream.Protocol do @doc """ Send data through the socket. """ @spec send(t, iodata) :: :ok | { :error, term } def send(self, data) @doc """ Send a file through the socket, using non-copying operations where available. """ @spec file(t, String.t) :: :ok | { :error, term ...
deps/socket/lib/socket/stream.ex
0.837421
0.551574
stream.ex
starcoder
defmodule ExDhcp.Packet do @moduledoc """ Provides a structure for the DHCP UDP packet, according to _[RFC 1531](https://tools.ietf.org/html/rfc1531)_ specifications. For a simpler reference on the DHCP protocol's binary layout, refer to [Wikipedia](https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Prot...
lib/ex_dhcp/packet.ex
0.88081
0.632616
packet.ex
starcoder
defmodule Snitch.Data.Schema.ShippingMethod do @moduledoc """ Models a ShippingMethod that caters to a set of Zones and ShippingCategories. A ShippingMethod, * may belong to zero or more unique zones. > A particular Zone may have none or many ShippingMethods -- a classic many-to-many relation. * ca...
apps/snitch_core/lib/core/data/schema/shipping_method.ex
0.881219
0.468183
shipping_method.ex
starcoder
defmodule Caravan.Cluster.DnsStrategy do @moduledoc """ Implements a libcluster strategy for node distribution based on Consul DNS. By default it uses `:inet_res` to query the nameservers, though it can be configured to use any module conforming to the `Caravan.DnsClient` behaviour. ## Prerequisites First...
lib/caravan/cluster/dns_strategy.ex
0.913416
0.900661
dns_strategy.ex
starcoder
defmodule Openmaize.Login do @moduledoc """ Module to handle login. `Openmaize.Login` checks the user's password, making sure that the account has been confirmed, if necessary, and returns an `openmaize_user` message (the user model) if login is successful or an `openmaize_error` message if there is an err...
lib/openmaize/login.ex
0.733738
0.507385
login.ex
starcoder
defmodule P4 do @moduledoc """ ## Examples """ def main do n = IO.read(:line) |> String.trim() |> String.to_integer() wn = IO.read(:line) |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer/1) solve(n, wn) |> IO.puts() end @doc """ ## Examples iex> P4.solve(3, [1, 2, 3...
lib/100/p4.ex
0.576304
0.414484
p4.ex
starcoder
defmodule RawDriver do @moduledoc""" All credits to Jostein for implementing this ## Description You must start the driver with `start_link()` or `start_link(ip_address, port)` before any of the other functions will work ## API: ``` {:ok, driver_pid} = Driver.start_link set_motor_direction( driver_pid,...
heis_driver/lib/my_driver.ex
0.794225
0.645169
my_driver.ex
starcoder
defmodule ExAlgo.Stack do @moduledoc """ A basic Stack implementation """ @doc """ The Stack struct. """ defstruct container: [] @type value_type :: any() @type t :: %__MODULE__{container: [value_type()]} @doc """ Create a new empty stack ## Example iex> alias ExAlgo.Stack iex> Stac...
lib/ex_algo/stack/stack.ex
0.859118
0.4881
stack.ex
starcoder
defmodule Callbackex.Callbacks do @moduledoc """ Compile callback configs into a callback call """ alias Callbackex.Callback alias Callbackex.Context @type callback_config_t :: {Callback.t, Keyword.t} | {atom, Keyword.t} @type callbacks :: [callback_config_t | [callback_config_t]] @type callback_ca...
lib/callbackex/callbacks.ex
0.801392
0.520984
callbacks.ex
starcoder
defmodule Conrex.PolygonBuilder do @moduledoc false # WGS84 @default_srid 4326 @typep point :: {number, number} @typep segment :: {point, point} @spec build_polygon([segment], point) :: [segment] def build_polygon(rings, reference_point) do normalize_rings(rings, reference_point) |> format_coor...
lib/conrex/polygon_builder.ex
0.848722
0.554651
polygon_builder.ex
starcoder
defmodule EthEvent.Api.Block do @moduledoc """ Defines the `Block` event. In order to request a `Block`, you have to specify the desired `block_number` by setting it in the event struct itself (if no `block_number` is set, then defaults to `"latest"`) e.g: ``` > alias EthEvent.Api.Block > {:ok, %Block{...
lib/eth_event/api/block.ex
0.869368
0.886125
block.ex
starcoder
defmodule Mailchimp.Template do alias HTTPoison.Response alias Mailchimp.HTTPClient @moduledoc """ Manage the Templates in your account. Manage members of a specific Mailchimp list, including currently subscribed, unsubscribed, and bounced members. ### Struct Fields * `id` - The individual id for the...
lib/mailchimp/template.ex
0.69181
0.437042
template.ex
starcoder
defmodule OMG.Performance.Generators do @moduledoc """ Provides helper functions to generate bundles of various useful entities for performance tests """ require OMG.Utxo alias OMG.Eth.Configuration alias OMG.Eth.RootChain alias OMG.State.Transaction alias OMG.Utxo alias OMG.Watcher.HttpRPC.Client ...
apps/omg_performance/lib/omg_performance/generators.ex
0.829043
0.410579
generators.ex
starcoder
defmodule CirruSepal do require CirruParser def transform(code, filename) do ast = CirruParser.pare code, filename IO.inspect ast args = Enum.map ast, fn(x) -> mapAst x end compiledAst = {:__block__, [], args} IO.inspect compiledAst Macro.to_string compiledAst end defp mapAst(expr) whe...
lib/cirru_sepal.ex
0.50415
0.417836
cirru_sepal.ex
starcoder
defmodule NewRelix.Aggregator do @moduledoc """ Aggregates collected metrics for submission to New Relic. """ @adapters NewRelix.compile_config() @doc """ Transforms `Collector.t` to components list. Aggregates values recorded for each key in the `data` key in `Collector.t` and puts the results into ...
lib/new_relix/aggregator.ex
0.771155
0.539954
aggregator.ex
starcoder
defmodule Ash.Query do @moduledoc """ Utilties around constructing/manipulating ash queries. Ash queries are used for read actions and side loads, and ultimately map to queries to a resource's data layer. Queries are run by calling `read` on an API that contains the resource in question Examples: ```e...
lib/ash/query/query.ex
0.878848
0.737584
query.ex
starcoder
defmodule Phoenix.View do @moduledoc """ Defines the view layer of a Phoenix application. This module is used to define the application's main view, which serves as the base for all other views and templates. The view layer also contains conveniences for rendering templates, including support for layouts ...
assets/node_modules/phoenix/lib/phoenix/view.ex
0.904856
0.532243
view.ex
starcoder
defmodule Phoenix.View do @moduledoc """ Defines the view layer of a Phoenix application. This module is used to define the application main view, which serves as the base for all other views and templates in the application. The view layer also contains conveniences for rendering templates, including s...
lib/phoenix/view.ex
0.898486
0.628208
view.ex
starcoder
defmodule KVstore.Storage do @moduledoc """ Module for functions to work with storage """ use GenServer require Logger def start_link(_), do: GenServer.start_link(__MODULE__, :ok, name: __MODULE__) @doc """ Update or insert `value` for `key` in table and return {key, value} """ @spec insert(tuple...
lib/kvstore/storage.ex
0.707
0.539105
storage.ex
starcoder
defmodule JsonApiQueryBuilder do @moduledoc """ Behaviour and mixin for building an Ecto query from a JSON-API request. ## Example defmodule Article do use Ecto.Schema schema "articles" do field :body, :string field :description, :string field :slug, :string ...
lib/json_api_query_builder.ex
0.898608
0.403743
json_api_query_builder.ex
starcoder
defmodule SocialFeeds.Cache do @moduledoc """ Simple map-based cache server with expiring keys. """ @default_expiry_in_msec 600_000 use GenServer ## Client API defmodule Entry do @moduledoc """ `Cache.Entry` struct capable of holding any value along with expiration timestamp. """ defs...
apps/social_feeds/lib/social_feeds/cache.ex
0.852337
0.491883
cache.ex
starcoder
defmodule Guardian.Permissions do @moduledoc """ An optional plugin to Guardian to provide permissions for your tokens. These can be used for any token types since they only work on the `claims`. Permissions are set on a per implementation module basis. Each implementation module can have their own sets. ...
lib/guardian/permissions.ex
0.897908
0.850717
permissions.ex
starcoder
defmodule Swiss do @moduledoc """ # Swiss Swiss is a bundle of extensions to the standard lib. It includes several helper functions for dealing with standard types. ## API The root module has generic helper functions; check each sub-module's docs for each type's API. """ @doc """ More idiomatic ...
lib/swiss.ex
0.847479
0.591458
swiss.ex
starcoder
defmodule JaSerializer.PhoenixView do @moduledoc """ Use in your Phoenix view to render jsonapi.org spec json. See JaSerializer.Serializer for documentation on defining your serializer. ## Usage example defmodule PhoenixExample.ArticlesView do use PhoenixExample.Web, :view use JaSerial...
lib/ja_serializer/phoenix_view.ex
0.786459
0.49939
phoenix_view.ex
starcoder
defmodule Action do @callback execute(map() | [map()], map()) :: atom() | {atom(), iodata()} @callback expects_list?() :: boolean() @callback requirements() :: map() | [map()] @callback expected_options() :: map() @callback description() :: iodata() @doc """ Validates `:args` and `:options` for the a...
apps/imposc/lib/core/actions/action.ex
0.784773
0.445409
action.ex
starcoder
defmodule Tyyppi.Value.Generations do @moduledoc false @prop_test Application.get_env(:tyyppi, :prop_testing_backend, StreamData) alias Tyyppi.Value def prop_test, do: @prop_test def any, do: @prop_test.term() def atom(kind \\ :alphanumeric) when is_atom(kind), do: kind |> @prop_test.atom() |> @pro...
lib/tyyppi/value/generations.ex
0.645567
0.549097
generations.ex
starcoder
defmodule RGBMatrix.Animation.Config.FieldType.Integer do @moduledoc """ An integer field type for use in animation configuration. Supports defining a minimum and a maximum, as well as a step value. To define an integer field in an animation, specify `:integer` as the field type. Example: field :sp...
lib/rgb_matrix/animation/config/field_type/integer.ex
0.938435
0.610018
integer.ex
starcoder
defmodule TimeQueueCase do use ExUnit.CaseTemplate defmacro __using__(opts) do impl = Keyword.fetch!(opts, :impl) quote location: :keep do use ExUnit.Case, async: false alias unquote(impl), as: TQ doctest unquote(impl) test "Basic API test" do assert tq = TQ.new() ...
test/support/time_queue_case.ex
0.743447
0.55097
time_queue_case.ex
starcoder
defmodule Unidecode do @moduledoc """ This library provides functions to transliterate Unicode characters to an ASCII approximation. ## Design Philosophy(taken from original Unidecode perl library) Unidecode's ability to transliterate from a given language is limited by two factors: - The amount and quality...
lib/unidecode.ex
0.792062
0.558207
unidecode.ex
starcoder
defmodule ExInsights.Data.Envelope do @moduledoc ~S""" Track request envelope Envelope data looks like this ```json { "time": "2017-08-24T08:55:56.968Z", "iKey": "some-guid-value-key", "name": "Microsoft.ApplicationInsights.someguidvaluekey.Event", "tags": { "ai.session.id": "SLzGH", ...
lib/data/envelope.ex
0.841696
0.679159
envelope.ex
starcoder
defimpl Timex.Convertable, for: Tuple do alias Timex.Date alias Timex.DateTime alias Timex.AmbiguousDateTime alias Timex.Time alias Timex.Convertable import Timex.Macros def to_gregorian({y, m, d} = date) when is_date(y,m,d) do case :calendar.valid_date(date) do true -> {date, {0, 0, 0}...
lib/convert/tuple.ex
0.674801
0.406626
tuple.ex
starcoder
defmodule ExLCD.Driver do @moduledoc """ ExLCD.Driver defines the behaviour expected of display driver modules. Each display driver module must use this module and implement the expected callback functions. ```elixir defmodule MyDisplayDriver do use ExLCD.Driver ... end ``` """ ...
lib/ex_lcd/driver.ex
0.76769
0.698959
driver.ex
starcoder
defmodule Day20.Part1 do @doc """ iex> Day20.Part1.part1("day20-sample.txt") 20899048083289 """ def part1(filename) do parse_input(filename) |> find_corner_tiles() |> tiles_to_numbers() |> Enum.reduce(&Kernel.*/2) end @doc """ iex> Day20.Part1.part1 29125888761511 """ def ...
lib/day20/part1.ex
0.565299
0.518424
part1.ex
starcoder
defmodule Pow.Plug.Session do @moduledoc """ This plug will handle user authorization using session. The plug will store user and session metadata in the cache store backend. The session metadata has at least an `:inserted_at` and a `:fingerprint` key. The `:inserted_at` value is used to determine if the ses...
lib/pow/plug/session.ex
0.866232
0.538073
session.ex
starcoder
defmodule Level10.Games.Game do @moduledoc """ The game struct is used to represent the state for an entire game. It is a token that will be passed to different functions in order to modify the game's state, and then stored on the server to be updated or to serve data down to clients. """ require Logger ...
lib/level10/games/game.ex
0.810854
0.472623
game.ex
starcoder
require Logger alias Network.Simple, as: Net defmodule Network.Simple.Cortex do use GenServer @moduledoc """ The Cortex is the controller for the network. It is responsible for synchronizing signals from sensors and waiting for responses from actuators. This Cortex implementation does not wait for actuat...
lib/network/simple.ex
0.893379
0.446434
simple.ex
starcoder
defmodule NeoscanMonitor.Worker do @moduledoc """ GenServer module responsable to store blocks, states, trasactions and assets, Common interface to handle it is NeoscanMonitor.Api module(look there for more info) """ use GenServer alias NeoscanMonitor.Utils alias NeoscanMonitor.Server alias Neoscan.Blo...
apps/neoscan_monitor/lib/neoscan_monitor/monitor/worker.ex
0.592313
0.408572
worker.ex
starcoder
defmodule Stripe.ExternalAccount do @moduledoc """ Work with Stripe external account objects. You can: - Create an external account - Retrieve an external account - Update an external account - Delete an external account Does not yet render lists or take options. Probably does not yet work for cre...
lib/stripe/external_account.ex
0.690976
0.442938
external_account.ex
starcoder
defmodule ExDns.Resource.SOA do @moduledoc """ This modiule manages the SOA resource record. The wire protocol is defined in [RFC1035](https://tools.ietf.org/html/rfc1035#section-3.3.13) 3.3.13. SOA RDATA format +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ / MNAME ...
lib/ex_dns/resource/soa.ex
0.591369
0.413448
soa.ex
starcoder
defmodule Snitch.Tools.Helper.Query do @moduledoc """ Helper functions to implement Model CRUD methods. CRUD of most Models is identical, so there's no need to duplicate that everywhere. """ @spec get(module, map | non_neg_integer | binary, Ecto.Repo.t()) :: Ecto.Schema.t() | nil | no_return d...
apps/snitch_core/lib/core/tools/helpers/query.ex
0.793546
0.407245
query.ex
starcoder
defmodule Broadway.Producer do @moduledoc """ A Broadway producer is a `GenStage` producer that emits `Broadway.Message` structs as events. The `Broadway.Producer` is declared in a Broadway topology via the `:module` option: producer: [ module: {MyProducer, options} ] Once declared, `...
lib/broadway/producer.ex
0.906565
0.706532
producer.ex
starcoder
defprotocol ExAws.GameLift.Encodable do @type t :: any @doc "Converts an elixir value into a map tagging the value with its gamelift type" def encode(value, options \\ []) def encode(value, options) end defimpl ExAws.GameLift.Encodable, for: Atom do def encode(atom, _), do: %{"S" => Atom.to_string(atom)} end...
lib/ex_aws/gamelift/encodable.ex
0.703346
0.458591
encodable.ex
starcoder
defmodule TaskBunny.Partition do @moduledoc """ Coordinates the global Roger partition state Each Roger partition has a single place where global state is kept. Global state (and global coordination) is needed for the following things: - Job cancellation; when cancelling a job, we store the job ID globa...
lib/task_bunny/partition/partition.ex
0.714528
0.471467
partition.ex
starcoder
defmodule Membrane.Core.Child.PadModel do @moduledoc false # Utility functions for veryfying and manipulating pads and their data. use Bunch alias Bunch.Type alias Membrane.Core.Child alias Membrane.Pad @type bin_pad_data_t :: %Membrane.Bin.PadData{ ref: Membrane.Pad.ref_t(), optio...
lib/membrane/core/child/pad_model.ex
0.877424
0.578091
pad_model.ex
starcoder
defmodule ElixirLS.LanguageServer.Providers.FoldingRange.TokenPair do @moduledoc """ Code folding based on pairs of tokens Certain pairs of tokens, like `do` and `end`, natrually define ranges. These ranges all have `kind?: :region`. Note that we exclude the line that the 2nd of the pair, e.g. `end`, is on....
apps/language_server/lib/language_server/providers/folding_range/token_pairs.ex
0.886874
0.604428
token_pairs.ex
starcoder
defmodule Elsa.Fetch do @moduledoc """ Provides functions for doing one-off retrieval of messages from the Kafka cluster. """ @doc """ A simple interface for quickly retrieving a message set from the cluster on the given topic. Partition and offset may be specified as keyword options, defaulting to 0 i...
lib/elsa/fetch.ex
0.865267
0.625996
fetch.ex
starcoder
defmodule Membrane.Core.PullBuffer do @moduledoc """ Buffer that is attached to the `:input` pad when working in a `:pull` mode. It stores `Membrane.Buffer`, `Membrane.Event` and `Membrane.Caps` structs and prevents the situation where the data in a stream contains the discontinuities. It also guarantees tha...
lib/membrane/core/pull_buffer.ex
0.890696
0.635166
pull_buffer.ex
starcoder
defmodule Aja.EnumHelper do @moduledoc false import Aja.OrdMap, only: [is_dense: 1] alias Aja.Vector.Raw, as: RawVector @dialyzer :no_opaque @compile {:inline, try_get_raw_vec_or_list: 1} def try_get_raw_vec_or_list(%Aja.Vector{__vector__: vector}), do: vector def try_get_raw_vec_or_list(list) when is...
lib/helpers/enum_helper.ex
0.651355
0.604224
enum_helper.ex
starcoder
defmodule Day16 do def part1(input, num_programs) do line_after_dances(1, input, num_programs) |> Enum.to_list |> to_string end def part2(input, num_programs) do line_after_dances(1_000_000_000, input, num_programs) |> Enum.to_list |> to_string end defp line_after_dances(num_dances, ...
day16/lib/day16.ex
0.513668
0.538316
day16.ex
starcoder
defmodule Config do @moduledoc ~S""" A simple keyword-based configuration API. ## Example This module is most commonly used to define application configuration, typically in `config/config.exs`: import Config config :some_app, key1: "value1", key2: "value2" import_config...
lib/elixir/lib/config.ex
0.866458
0.496155
config.ex
starcoder
defmodule SlackDB.Key do @moduledoc """ A struct that holds all required information for a SlackDB key """ alias SlackDB.Client alias SlackDB.Messages alias SlackDB.Utils @callback get_value(SlackDB.Key.t()) :: {:error, String.t()} | {:ok, SlackDB.value()} @typedoc """ Types of SlackDB keys represen...
lib/key.ex
0.851567
0.427935
key.ex
starcoder
defmodule AWS.Chime do @moduledoc """ The Amazon Chime API (application programming interface) is designed for developers to perform key tasks, such as creating and managing Amazon Chime accounts, users, and Voice Connectors. This guide provides detailed information about the Amazon Chime API, including oper...
lib/aws/chime.ex
0.860178
0.535706
chime.ex
starcoder
defmodule Geometry.LineStringM do @moduledoc """ A line-string struct, representing a 2D line with a measurement. A none empty line-string requires at least two points. """ alias Geometry.{GeoJson, LineStringM, PointM, WKB, WKT} defstruct points: [] @type t :: %LineStringM{points: Geometry.coordinates...
lib/geometry/line_string_m.ex
0.952342
0.613063
line_string_m.ex
starcoder
defmodule CSV.Decoding.Parser do alias CSV.EscapeSequenceError alias CSV.StrayQuoteError @moduledoc ~S""" The CSV Parser module - parses tokens coming from the lexer and parses them into a row of fields. """ @doc """ Parses tokens by receiving them from a sender / lexer and sending them to the given...
lib/csv/decoding/parser.ex
0.774455
0.484441
parser.ex
starcoder
defmodule QuantumStoragePersistentEts do @moduledoc """ `PersistentEts` based implementation of a `Quantum.Storage`. """ use GenServer require Logger alias __MODULE__.State @behaviour Quantum.Storage @doc false def start_link(opts), do: GenServer.start_link(__MODULE__, opts, opts) @doc fal...
lib/quantum_storage_ets.ex
0.780997
0.433742
quantum_storage_ets.ex
starcoder
defmodule Edeliver.Relup.Modification do @moduledoc """ This behaviour can be used to provide custom modifications of relup instructions when a release upgrade is built by edeliver. By default the implementation from `Edeliver.Relup.PhoenixModification` is used for phoenix applications and for a...
lib/edeliver/relup/modification.ex
0.815637
0.4165
modification.ex
starcoder
defmodule Day22.Move do @moduledoc """ Functions and types for working with shuffling moves. """ import Day22.Math @typedoc """ A shuffling move. """ @type t :: {:deal, number} | {:cut, number} | :reverse @typedoc """ The result of one or more shuffling moves as a pair of multipler and offset. ...
aoc2019_elixir/apps/day22/lib/move.ex
0.90027
0.642306
move.ex
starcoder
defmodule Shapeshifter do @moduledoc """ ![Shapeshifter lets you quickly and simply switch between Bitcoin transaction formats](https://github.com/libitx/shapeshifter/raw/master/media/poster.png) ![GitHub](https://img.shields.io/github/license/libitx/shapeshifter?color=informational) Shapeshifter is an Elixir...
lib/shapeshifter.ex
0.918338
0.745352
shapeshifter.ex
starcoder
defmodule MapTileRenderer.Intersection do def point_inside_polygon?({x, y}, vertices) do shifted_vertices = tl(vertices) ++ [hd(vertices)] {inside, _} = Enum.reduce(shifted_vertices, {false, hd vertices}, fn v1, {inside, v0} -> case scanline_intersection(y, v0, v1) do ix ...
lib/map_tile_renderer/intersection.ex
0.874138
0.601506
intersection.ex
starcoder
defmodule Day6 do def parse_coordinate(binary) when is_binary(binary) do [x, y] = String.split(binary, ", ") {String.to_integer(x), String.to_integer(y)} end def bounding_box(coordinates) do {{min_x, _}, {max_x, _}} = Enum.min_max_by(coordinates, &elem(&1, 0)) {{_, min_y}, {_, max_y}} = Enum.min_...
lib/day6.ex
0.775095
0.695015
day6.ex
starcoder
defmodule Cforum.AdventCalendars do @moduledoc """ The AdventCalendars context. """ import Ecto.Query, warn: false alias Cforum.Repo alias Cforum.Helpers alias Cforum.AdventCalendars.Day def list_years do from(day in Day, select: fragment("EXTRACT(YEAR from ?)::character varying", day.date)...
lib/cforum/advent_calendars.ex
0.822973
0.470433
advent_calendars.ex
starcoder
defmodule Adventofcode.Day05BinaryBoarding do use Adventofcode alias __MODULE__.{Part1, Part2, Printer, Seat} def part_1(input) do input |> parse |> Enum.map(&Part1.locate/1) |> Enum.map(&Seat.pos/1) |> Enum.map(&unique_seat_id/1) |> Enum.max() end def part_2(input) do input ...
lib/day_05_binary_boarding.ex
0.668447
0.52208
day_05_binary_boarding.ex
starcoder
defprotocol OpenSCAD.Renderable do @moduledoc """ We'll try and render anything, because it could be a deeply nested structure of things to render, so we'll keep going until we hit something we can't handle. """ @typedoc """ The types of renderables """ @type types :: :string | :l...
lib/renderable.ex
0.807916
0.438485
renderable.ex
starcoder
defmodule Alambic.BlockingQueue do @moduledoc """ A queue hosted in a process so that other processes can access it concurrently. It implements the BlockingCollection protocol. Enumerating a `BlockingQueue` will consumes it content. Enumeration only complete when the `BlockingQueue` is empty and `BlockingQue...
lib/alambic/blocking_queue.ex
0.861465
0.536131
blocking_queue.ex
starcoder
defmodule Membrane.FLV.Demuxer do @moduledoc """ Element for demuxing FLV streams into audio and video streams. FLV format supports only one video and audio stream. They are optional however, FLV without either audio or video is also possible. When a new FLV stream is detected, you will be notified with `Mem...
lib/membrane_flv_plugin/demuxer.ex
0.877148
0.447883
demuxer.ex
starcoder
defmodule MixDeployLocal.Commands do @moduledoc """ Deployment commands. These functions perform deployment functions like copying files and generating output files from templates. Because deployment requres elevated permissions, instead of executing the commands, they can optionally output the shell equiva...
lib/mix_deploy_local/commands.ex
0.653459
0.41745
commands.ex
starcoder
defmodule Spect do @moduledoc """ Elixir typespec enhancements """ use Memoize defmodule ConvertError do @moduledoc """ A custom exception raised when a field could not be converted to the type declared by the target typespec. """ defexception message: "could not map to spec" end @d...
lib/spect.ex
0.93542
0.875361
spect.ex
starcoder
defmodule TypedEnum do @moduledoc """ A module to allow you to use Enum's in ecto schemas, while automatically deriving their type definition. Usage: ```elixir defmodule InvoiceStatus do use TypedEnum, values: [:paid, :open, :closed, :rejected, :processing] end ``` And then in your schema(s): ...
lib/typed_enum.ex
0.848628
0.917635
typed_enum.ex
starcoder