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 Aoc2021.Day9 do @moduledoc """ See https://adventofcode.com/2021/day/9 """ @spec solve_part1() :: non_neg_integer() @spec solve_part1(Path.t()) :: non_neg_integer() def solve_part1(path \\ "priv/day9/input.txt") do path |> read_map() |> low_points() |> risk_levels() |> Enum.su...
lib/aoc2021/day9.ex
0.756042
0.53443
day9.ex
starcoder
defmodule Piton.Pool do @moduledoc """ `Piton.Pool` is a `GenServer` which will be on charge of a pool of `Piton.Port`s. `Piton.Pool` will launch as many Python processes as you define in `pool_number` and it will share them between all the request (executions) it receives. It is also protected from Python exc...
lib/piton/pool.ex
0.746324
0.89616
pool.ex
starcoder
defmodule Instream do @moduledoc """ InfluxDB driver for Elixir ## Connections To connect to an InfluxDB server you need a connection module: defmodule MyConnection do use Instream.Connection, otp_app: :my_app end The `:otp_app` name and the name of the module can be freely chosen but ...
lib/instream.ex
0.908674
0.418192
instream.ex
starcoder
defmodule BSV.Util.VarBin do @moduledoc """ Module for parsing and serializing variable length binary data as integers, binaries and structs. """ @doc """ Parses the given binary into an integer. Returns a tuple containing the decoded integer and any remaining binary data. ## Examples iex> BSV....
lib/bsv/util/var_bin.ex
0.853913
0.550064
var_bin.ex
starcoder
defmodule Chain.State do alias Chain.Account # @enforce_keys [:store] defstruct accounts: %{}, hash: nil, store: nil @type t :: %Chain.State{accounts: %{}, hash: nil} def new() do %Chain.State{} end def compact(%Chain.State{accounts: accounts} = state) do accounts = Enum.map(accounts, fn ...
lib/chain/state.ex
0.705684
0.532668
state.ex
starcoder
defmodule Animina.Accounts.User do use Ecto.Schema import Ecto.Changeset @derive {Inspect, except: [:password]} schema "users" do field :email, :string field :password, :string, virtual: true field :hashed_password, :string field :confirmed_at, :naive_datetime field :first_name, :string ...
lib/animina/accounts/user.ex
0.593374
0.423398
user.ex
starcoder
defmodule Guardian.Plug.VerifyHeader do @moduledoc """ Use this plug to verify a token contained in the header. You should set the value of the Authorization header to: Authorization: <jwt> ## Example plug Guardian.Plug.VerifyHeader ## Example plug Guardian.Plug.VerifyHeader, key: :sec...
lib/guardian/plug/verify_header.ex
0.674479
0.57078
verify_header.ex
starcoder
defmodule Tensorflow.OpDef.ArgDef do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ name: String.t(), description: String.t(), type: Tensorflow.DataType.t(), type_attr: String.t(), number_attr: String.t(), type_list_attr: String....
lib/tensorflow/core/framework/op_def.pb.ex
0.819605
0.616287
op_def.pb.ex
starcoder
defmodule AWS.GameLift do @moduledoc """ Amazon GameLift Service GameLift provides solutions for hosting session-based multiplayer game servers in the cloud, including tools for deploying, operating, and scaling game servers. Built on AWS global computing infrastructure, GameLift helps you deliver high...
lib/aws/generated/game_lift.ex
0.902529
0.661322
game_lift.ex
starcoder
defmodule Snappy do @moduledoc """ An Elixir binding for snappy, a fast compressor/decompressor. """ @doc """ Compress ## Examples iex> {:ok, _compressed} = Snappy.compress("aaaaaaaaaaaaaaaaaaaa") {:ok, <<20, 0, 97, 74, 1, 0>>} """ @spec compress(binary()) :: {:ok, binary()} | {:error, S...
lib/snappy.ex
0.89217
0.411939
snappy.ex
starcoder
defmodule Abit do @moduledoc """ Use `:atomics` as a bit array or as an array of N-bit counters. [Erlang atomics documentation](http://erlang.org/doc/man/atomics.html) The `Abit` module (this module) has functions to use `:atomics` as a bit array. The bit array is zero indexed. The `Abit.Counter` module ...
lib/abit.ex
0.936343
0.771026
abit.ex
starcoder
defmodule AFK.Keycode.Layer do @moduledoc """ Represents a key that can activate other layers on and off in various ways. Layers can be activated in 3 ways: * `:hold` - Temporarily activates a layer while being held * `:toggle` - Toggles a layer on or off when pressed * `:default` - Sets a layer as the de...
lib/afk/keycode/layer.ex
0.919625
0.667349
layer.ex
starcoder
defmodule Trifolium.API do @moduledoc """ Thin helper functions to enhance requests to Trefle API. """ @type response :: {:ok, %{}} | {:error, non_neg_integer(), %{}} @doc """ Builds a query params map, which contains the token used to communicate with Trefle API, along with the keywords which shoul...
lib/trifolium/api.ex
0.813461
0.417687
api.ex
starcoder
defmodule ExUnit.Parameterized.ParamsCallback do @moduledoc false @spec test_with_params(bitstring, any, fun, [tuple]) :: any defmacro test_with_params(desc, context, fun, params_ast) do ast = Keyword.get(params_ast, :do, nil) case validate_map?(ast) do true -> ast |> do_test_with(desc, co...
lib/ex_parameterized/params_callback.ex
0.576304
0.449332
params_callback.ex
starcoder
defmodule Cuckoo do @moduledoc """ This module implements a [Cuckoo Filter](https://www.cs.cmu.edu/~dga/papers/cuckoo-conext2014.pdf). ## Implementation Details The implementation follows the specification as per the paper above. For hashing we use the x64_128 variant of Murmur3 and the Erlang phash2. #...
lib/cuckoo.ex
0.911431
0.593904
cuckoo.ex
starcoder
defmodule Alerts.Priority do @moduledoc """ Calculate an alert's priority """ alias Alerts.Match @type priority_level :: :high | :low | :system @ongoing_effects Alerts.Alert.ongoing_effects() @spec priority(map, DateTime.t()) :: priority_level def priority(map, now \\ Util.now()) def priority(%{li...
apps/alerts/lib/priority.ex
0.80837
0.473231
priority.ex
starcoder
defmodule Maverick.Api do @moduledoc """ Provides the entrypoint for configuring and managing the implementation of Maverick in an application by a single `use/2` macro that provides a supervision tree `start_link/1` and `child_spec/1` for adding Maverick as a child of the top-level application supervisor. ...
lib/maverick/api.ex
0.810479
0.416174
api.ex
starcoder
defmodule Bacen.CCS.ACCS002 do @moduledoc """ The ACCS002 message. This message is a response from ACCS001 message. It has the following XML example: ```xml <CCSArqAtlzDiariaRespArq> <SitArq>R</SitArq> <ErroCCS>ECCS0023</ErroCCS> <UltNumRemessaArq>000000000000</UltNumRemessaArq> <DtHrBC>2...
lib/bacen/ccs/accs002.ex
0.799873
0.664608
accs002.ex
starcoder
defmodule Quandl.V3.Model.DatasetMetadata do @moduledoc """ Dataset Metadata for a time-series. ## Attributes * `id` (*type:* `Integer.t`), *default:* `nil`) * `dataset_code` (*type:* `String.t`), *default:* `nil`) * `database_id` (*type:* `Integer.t`), *default:* `nil`) * `database_code` (*typ...
lib/quandl/v3/model/dataset_metadata.ex
0.777258
0.623921
dataset_metadata.ex
starcoder
defmodule RDF.XSD do @moduledoc """ An implementation of the XML Schema (XSD) datatype system for use within `RDF.Literal.Datatype` system. It consists of - `RDF.XSD.Datatype`: a more specialized `RDF.Literal.Datatype` behaviour for XSD datatypes - `RDF.XSD.Datatype.Primitive`: macros for the definition of ...
lib/rdf/xsd.ex
0.885229
0.836154
xsd.ex
starcoder
defmodule HamRadio.Bands do @moduledoc """ Retrieves amateur radio bands. Band names and ranges have been defined directly from the [ADIF 3.1.0 specification](http://adif.org/310/ADIF_310.htm#Band_Enumeration). """ alias HamRadio.Band @bands [ %Band{ name: "2190m", range: 135_700..137_8...
lib/ham_radio/bands.ex
0.776029
0.46794
bands.ex
starcoder
defmodule MarsRover.Planet do @moduledoc """ The planet object represented as a square grid with wrapping edges. """ use GenServer defstruct [:grid, :obstacles] # API @spec start_link(Int.t(), Int.t()) :: :ignore | {:error, any()} | {:ok, pid()} def start_link(width, height) when width <= 0 or heigh...
lib/planet.ex
0.893877
0.641071
planet.ex
starcoder
defmodule Shippex.Util do @moduledoc false @doc """ Takes a price and multiplies it by 100. Accepts nil, floats, integers, and strings. iex> Util.price_to_cents(nil) 0 iex> Util.price_to_cents(0) 0 iex> Util.price_to_cents(28.00) 2800 iex> Util.price_to_cents("28.00")...
lib/shippex/util.ex
0.811601
0.537102
util.ex
starcoder
defmodule Ecto.Adapters.Connection do @moduledoc """ Behaviour for adapters that rely on connections. In order to use a connection, adapter developers need to implement a single callback in a module: `connect/1` defined in this module. The benefits of implementing this module is that the adapter can then ...
lib/ecto/adapters/connection.ex
0.673729
0.462594
connection.ex
starcoder
defmodule PTV do @moduledoc """ API adaptor for the PTV Timetable API """ @doc """ Generates signed url for an API call. Builds request url and calculates hashmac digest for authentication according to instructions at https://www.ptv.vic.gov.au/footer/data-and-reporting/datasets/ptv-timetable-api/. """ ...
lib/ptv.ex
0.8288
0.42656
ptv.ex
starcoder
defmodule Aoc2020Day14 do import Enum def solve1(input) do input |> String.trim() |> String.split("\n", trim: true) |> map(&parse(&1)) |> reduce({[], %{}}, &reducer/2) |> elem(1) |> Map.values() |> sum end def solve2(input) do input |> String.trim() |> String.split(...
lib/2020/aoc2020_day14.ex
0.61231
0.459864
aoc2020_day14.ex
starcoder
defmodule Beamchmark.Suite.CPU.CpuTask do @moduledoc """ This module contains the CPU benchmarking task. Measurements are performed using [`:cpu_sup.util/1`](https://www.erlang.org/doc/man/cpu_sup.html) Currently (according to docs), as busy processor states we identify: - user - nice_user (low priority...
lib/beamchmark/suite/cpu/cpu_task.ex
0.871105
0.80112
cpu_task.ex
starcoder
defmodule ExIsbndb.Search do @moduledoc """ The `ExIsbndb.Search` module contains an endpoint that is able to search anything inside the ISBNdb database. The available function needs to receive a map with params, but only those needed for the endpoint will be taken. """ alias ExIsbndb.Client @valid_i...
lib/search.ex
0.894588
0.580114
search.ex
starcoder
defmodule Membrane.Dashboard.Charts.Update do @moduledoc """ Module responsible for preparing data for uPlot charts when they are being updated. Example (showing last 5 minutes of one chart data) -305s -300s -5s now __________________________________________________...
lib/membrane_dashboard/charts/update.ex
0.8709
0.689253
update.ex
starcoder
defmodule Day23 do def part1(input) do Interpreter.new(input) |> Map.put(:a, 7) |> Interpreter.execute |> Map.get(:a) end def part2(input) do Interpreter.new(input) |> Map.put(:a, 12) |> Interpreter.optimize |> Interpreter.execute |> Map.get(:a) end end defmodule Interprete...
day23/lib/day23.ex
0.561575
0.499023
day23.ex
starcoder
defmodule ExMatrix do @moduledoc """ `ExMatrix` is a new Matrix library for Elixir. This library helps you to create a matrix, `manipulate` it with values and `add/subtract` two matrices. ## What is a Matrix A matrix is a collection of numbers arranged into a fixed number of rows and columns. Here i...
lib/ex_matrix.ex
0.918881
0.980053
ex_matrix.ex
starcoder
defmodule Day03 do @moduledoc """ Advent of Code 2018, day 3. """ use Private defmodule Claim do defstruct id: nil, left: nil, top: nil, width: nil, height: nil end @doc """ How many square inches of fabric are within two or more claims? ## Examples iex> Day03.part1("data/day03.txt") ...
day03/lib/day03.ex
0.860149
0.583025
day03.ex
starcoder
defmodule UnionFind do alias __MODULE__ @moduledoc """ Documentation for UnionFind. """ @doc """ """ defstruct [:nodes, :sizes] def new(n) do 1..n |> Enum.reduce( %UnionFind{ nodes: List.duplicate(0, n), sizes: List.duplicate(1, n) }, fn i, %Uni...
lib/union_find.ex
0.610686
0.44059
union_find.ex
starcoder
defmodule Clover.Conversation do @moduledoc """ A multi-message conversation A `Clover.Conversation` happens in a `Clover.Room` between a robot and a `Clover.User`. """ use GenServer alias Clover.{ Message, Robot, Script } alias Clover.Conversation.Supervisor, as: ConversationSupervisor ...
lib/conversation/conversation.ex
0.855429
0.443118
conversation.ex
starcoder
defmodule ElxValidation.DateTime do @moduledoc """ ### date - The field under validation must be a valid, non-relative date. - "2020-06-26" ### time - The field under validation must be a valid, non-relative time. - am / pm is optional - "20:13" - "01:02" - "02:40am" - "05:20pm" ### date...
lib/rules/datetime.ex
0.769903
0.720786
datetime.ex
starcoder
defmodule BN.BN128Arithmetic do require Integer alias BN.{FQ, FQP, FQ2, FQ12} # y^2 = x^3 + 3 @y_power 2 @x_power 3 @b FQ.new(3) @b2 FQ2.divide(FQ2.new([3, 0]), FQ2.new([9, 1])) @b12 FQ12.new([3] ++ List.duplicate(0, 11)) @type point :: {FQP.t(), FQP.t()} | {FQ.t(), FQ.t()} @spec on_curve?(point(...
lib/bn/bn128_arithmetic.ex
0.852368
0.426023
bn128_arithmetic.ex
starcoder
defmodule ExAlgo.Set.DisjointSet do @moduledoc """ Implementation of a discjoint set data structure. More on this: https://en.wikipedia.org/wiki/Disjoint_sets # TODO: Move some doctests to unit tests. """ defstruct parents: %{}, ranks: %{} @type mapped_array() :: %{required(non_neg_integer()) => non_ne...
lib/ex_algo/set/disjoint_set.ex
0.696578
0.700524
disjoint_set.ex
starcoder
defmodule InvoiceTracker.Rounding do @moduledoc """ Perform various calculations on times by rounding to the nearest tenth of an hour. Operations are provided to: - Round a time to the nearest tenth of an hour - Compute a charge amount given a rate - Adjust the rounding a list of time entries with a t...
lib/invoice_tracker/rounding.ex
0.889535
0.863737
rounding.ex
starcoder
defmodule Schism do @moduledoc """ Schism allows you to create network partitions in erlang nodes without needing to leave elixir. Let's say that we have 5 nodes and we want to test what happens when they disconnect from each other. We can use Schism like so: ```elixir test "netsplits" do [n1, n2, n...
lib/schism.ex
0.744935
0.932576
schism.ex
starcoder
defmodule Cldr.DateTime.Format.Backend do @moduledoc false backend = config.backend def define_date_time_format_module(config) do quote location: :keep, bind_quoted: [config: config, backend: backend] do defmodule DateTime.Format do @moduledoc """ Manages the Date, TIme and DateTime for...
lib/cldr/backend/date_time_format.ex
0.926748
0.531635
date_time_format.ex
starcoder
defmodule ExVault.KV1 do @moduledoc """ A very thin wrapper over the basic operations for working with KV v1 data. Construct a *backend*--a client paired with the mount path for the `kv` version 1 secrets engine it interacts with--using the `ExVault.KV1.new/2` function. Each of the operations in this modu...
lib/exvault/kv1.ex
0.866203
0.804444
kv1.ex
starcoder
defmodule Crawlie.Page do @moduledoc """ Defines the struct representing a url's state in the system. """ alias __MODULE__, as: This @typedoc """ The `Crawlie.Page` struct type. Fields' meaning: - `:uri` - page `URI` - `:depth` - the "depth" at which the url was found while recursively crawling the...
lib/crawlie/page.ex
0.814274
0.620923
page.ex
starcoder
defmodule DarknetToOnnx.WeightLoader do @moduledoc """ Helper class used for loading the serialized weights of a binary file stream and returning the initializers and the input tensors required for populating the ONNX graph with weights. """ use Agent, restart: :transient alias DarknetToOnnx.Lea...
lib/darknet_to_onnx/weightloader.ex
0.894663
0.578002
weightloader.ex
starcoder
defmodule ExOsrsApi.PlayerHighscores do @moduledoc """ ### PlayerHighscores Holds PlayerHighscores `skills` and `activities` data """ alias ExOsrsApi.Models.Skills alias ExOsrsApi.Models.Activities alias ExOsrsApi.Errors.Error @enforce_keys [:username, :type, :skills, :activities, :empty] defstruct [...
lib/player_highscores.ex
0.865309
0.429848
player_highscores.ex
starcoder
defmodule Draconic.Flag do alias __MODULE__ defstruct name: nil, alias: nil, type: nil, description: "", default: nil @typedoc "The name of the flag, `--verbose` would have the name `:verbose`" @type name() :: atom() @typedoc "A flags alias, if `-v` maps to `--verbose` then it's alias is `:v`." @type ali...
lib/draconic/flag.ex
0.928376
0.479808
flag.ex
starcoder
defmodule Porcelain.Process do @moduledoc """ Module for working with external processes launched with `Porcelain.spawn/3` or `Porcelain.spawn_shell/2`. """ alias __MODULE__, as: P @doc """ A struct representing a wrapped OS processes which provides the ability to exchange data with it. """ defstr...
lib/porcelain/process.ex
0.719088
0.532425
process.ex
starcoder
defmodule Logger.Translator do @moduledoc """ Default translation for Erlang log messages. Logger allows developers to rewrite log messages provided by OTP applications into a format more compatible with Elixir log messages by providing a translator. A translator is simply a tuple containing a module and ...
lib/logger/lib/logger/translator.ex
0.753557
0.454835
translator.ex
starcoder
defmodule Phoenix.Endpoint do @moduledoc """ Defines a Phoenix endpoint. The endpoint is the boundary where all requests to your web application start. It is also the interface your application provides to the underlying web servers. Overall, an endpoint has three responsibilities: * to provide a wra...
lib/phoenix/endpoint.ex
0.925006
0.524577
endpoint.ex
starcoder
defmodule Config.Provider do @moduledoc """ Specifies a provider API that loads configuration during boot. Config providers are typically used during releases to load external configuration while the system boots. This is done by starting the VM with the minimum amount of applications running, then invokin...
lib/elixir/lib/config/provider.ex
0.889123
0.558989
provider.ex
starcoder
defmodule Blogit.RepositoryProvider do @moduledoc """ A behaviour module for implementing access to remote or local repository containing files which can be used as a source for a blog and its posts. A provider to a repository should be able to check if files exist in it, if files were updated or deleted, to...
lib/blogit/repository_provider.ex
0.813868
0.775137
repository_provider.ex
starcoder
defmodule Cassette.User do @moduledoc """ This is the struct that represents the user returned by a Validation request """ alias Cassette.Config alias Cassette.User defstruct login: "", type: "", attributes: %{}, authorities: MapSet.new([]) @type t :: %__MODULE__{login: String.t(), attributes: map()} ...
lib/cassette/user.ex
0.851876
0.655357
user.ex
starcoder
defmodule Exshape do @moduledoc """ This module just contains a helper function for working wtih zip archives. If you have a stream of bytes that you want to parse directly, use the Shp or Dbf modules to parse. """ alias Exshape.{Dbf, Shp} defp open_file(c, size), do: File.stream!(c, [], size) d...
lib/exshape.ex
0.754915
0.839537
exshape.ex
starcoder
defmodule Paranoid.Ecto do import Ecto.Query @moduledoc """ Module for interacting with an Ecto Repo that leverages soft delete functionality. """ defmacro __using__(opts) do verify_ecto_dep() if repo = Keyword.get(opts, :repo) do quote do def all(queryable, opts \\ []) do u...
lib/paranoid/ecto.ex
0.637708
0.516778
ecto.ex
starcoder
defmodule Slack.Group do @moduledoc """ Functions for working with private channels (groups) """ @base "groups" use Slack.Request @doc """ Archive a private channel. https://api.slack.com/methods/groups.archive ## Examples Slack.Group.archive(client, channel: "G1234567890") """ @spec...
lib/slack/group.ex
0.779909
0.543166
group.ex
starcoder
defmodule Vivid.Line do alias Vivid.{Line, Point} defstruct ~w(origin termination)a import Vivid.Math @moduledoc ~S""" Represents a line segment between two Points in 2D space. ## Example iex> use Vivid ...> Line.init(Point.init(0,0), Point.init(5,5)) ...> |> to_string() "@@@@@@@@\n" <> ...
lib/vivid/line.ex
0.927577
0.514461
line.ex
starcoder
defmodule Moonsugar.Validation do @moduledoc """ The Validation module contains functions that help create and interact with the validation type. The Validation type is represented as either `{:success, value}` or `{:failure, reasons}` """ @doc """ Helper function to create a success tuple. ## Examples ...
lib/validation.ex
0.891375
0.718644
validation.ex
starcoder
defmodule Dict do @moduledoc %B""" This module specifies the Dict API expected to be implemented by different dictionaries. It also provides functions that redirect to the underlying Dict, allowing a developer to work with different Dict implementations using one API. To create a new dict, use the `new` ...
lib/elixir/lib/dict.ex
0.917474
0.693038
dict.ex
starcoder
defmodule Crux.Structs.Permissions do @moduledoc """ Custom non discord api struct to help with working with permissions. For more informations see [Discord Docs](https://discordapp.com/developers/docs/topics/permissions). """ use Bitwise alias Crux.Structs alias Crux.Structs.Util require Util ...
lib/structs/permissions.ex
0.866796
0.807081
permissions.ex
starcoder
defmodule AdventOfCode.Y2021.Day3 do @moduledoc """ --- Day 3: Binary Diagnostic --- The submarine has been making some odd creaking noises, so you ask it to produce a diagnostic report just in case. The diagnostic report (your puzzle input) consists of a list of binary numbers which, when decoded properly, ...
lib/y_2021/d3/day3.ex
0.877857
0.877791
day3.ex
starcoder
defmodule Adventofcode.Day13TransparentOrigami do use Adventofcode alias __MODULE__.{Parser, Part1, Part2, Printer, State} def part_1(input) do input |> Parser.parse() |> Part1.solve() end def part_2(input) do input |> Parser.parse() |> Part2.solve() |> Printer.to_s() end d...
lib/day_13_transparent_origami.ex
0.635562
0.62701
day_13_transparent_origami.ex
starcoder
defmodule Grizzly.ZWave.SmartStart.MetaExtension.MaxInclusionRequestInterval do @moduledoc """ This is used to advertise if a power constrained Smart Start node will issue inclusion request at a higher interval value than the default 512 seconds. """ @typedoc """ The interval (in seconds) must be in the ra...
lib/grizzly/zwave/smart_start/meta_extension/max_inclusion_request_interval.ex
0.942228
0.604078
max_inclusion_request_interval.ex
starcoder
defmodule Conduit.Plug.Retry do use Conduit.Plug.Builder require Logger @moduledoc """ Retries messages that were nacked or raised an exception. ## Options * `attempts` - Number of times to process the message before giving up. (defaults to 3) * `backoff_factor` - What multiple of the delay should ...
lib/conduit/plug/retry.ex
0.829906
0.569972
retry.ex
starcoder
defmodule Akd.Hook do @moduledoc """ This module represents an `Akd.Hook` struct which contains metadata about a hook. Please refer to `Nomenclature` for more information about the terms used. The meta data involves: * `ensure` - A list of `Akd.Operation.t` structs that run after a deployment, ...
lib/akd/hook.ex
0.851135
0.565569
hook.ex
starcoder
defmodule DiscordBot.Util do @moduledoc """ Various utility methods and helpers. """ @doc """ Gets the PID of a child process from a supervisor given an ID. `supervisor` is the supervisor to query, and `id` is the ID to lookup. Do not call this from the `start_link/1` or the `init/1` function of any c...
apps/discordbot/lib/discordbot/util.ex
0.795142
0.457137
util.ex
starcoder
defmodule Poxa.WebHook.EventTable do @moduledoc """ This module provides functions to initialize and manipulate a table of events to be sent to the web hook. """ @table_name :web_hook_events import :ets, only: [new: 2, select: 2, select_delete: 2] @doc """ This function initializes the ETS table where...
lib/poxa/web_hook/event_table.ex
0.757705
0.611179
event_table.ex
starcoder
defmodule ExWordNet.Synset do @moduledoc """ Provides abstraction over a synset (or group of synonymous words) in WordNet. Synsets are related to each other by various (and numerous!) relationships, including Hypernym (x is a hypernym of y <=> x is a parent of y) and Hyponym (x is a child of y) Struct membe...
lib/exwordnet/synset.ex
0.785432
0.636424
synset.ex
starcoder
defmodule Nanoid.NonSecure do @moduledoc """ Generate an URL-friendly unique ID. This method use the non-secure, predictable random generator. By default, the ID will have 21 symbols with a collision probability similar to UUID v4. """ alias Nanoid.Configuration @doc """ Generates a non-secure NanoID usi...
lib/nanoid/non_secure.ex
0.884769
0.551513
non_secure.ex
starcoder
defmodule Mix.Tasks.Autox.Phoenix.Migration do use Mix.Task @shortdoc "Generates an Ecto migration" @moduledoc """ Code copy+pasted from https://github.com/phoenixframework/phoenix/blob/master/lib/mix/tasks/phoenix.gen.model.ex """ def run(args) do switches = [migration: :boolean, binary_id: :boolean,...
lib/mix/tasks/autox.phoenix.migration.ex
0.797636
0.422892
autox.phoenix.migration.ex
starcoder
defmodule Pigeon.LegacyFCM do @moduledoc """ `Pigeon.Adapter` for Legacy Firebase Cloud Messaging (FCM) push notifications. ## Getting Started 1. Create a `LegacyFCM` dispatcher. ``` # lib/legacy_fcm.ex defmodule YourApp.LegacyFCM do use Pigeon.Dispatcher, otp_app: :your_app end ``` 2. (Opti...
lib/pigeon/legacy_fcm.ex
0.876707
0.652428
legacy_fcm.ex
starcoder
defmodule Absinthe.IntegrationCase do @moduledoc """ Integration tests consist of: - A `.graphql` file containing a GraphQL document to execute - A `.exs` file alongside with the same basename, containing the scenario(s) to execute The files are located under the directory passed as the `:root` option to ...
test/support/integration_case.ex
0.898273
0.963265
integration_case.ex
starcoder
defmodule Pow.Ecto.Schema.Migration do @moduledoc """ Generates schema migration content. ## Configuration options * `:repo` - the ecto repo to use. This value defaults to the derrived context base repo from the `context_base` argument in `gen/2`. * `:table` - the ecto table name, defaults to "us...
lib/pow/ecto/schema/migration.ex
0.667798
0.405743
migration.ex
starcoder
defmodule Philtre.Wrapper do @moduledoc """ Defines a view and a set of utility functions to test how the editor component interacts with the view. Editor tests should only ever interact with the component via functions defined here. """ use Phoenix.LiveView import Phoenix.LiveView.Helpers import Phoe...
test/support/wrapper.ex
0.814533
0.624365
wrapper.ex
starcoder
defmodule Smoke.Metrics do @moduledoc """ Creates Metrics from a list of events. """ def filter(events, {tag, value}) do events |> Stream.filter(fn {_time, _measurement, metadata} -> Enum.any?(metadata, fn {^tag, ^value} -> true _ -> false end) end) end ...
lib/smoke/metrics.ex
0.81899
0.507446
metrics.ex
starcoder
defmodule LruCache do @moduledoc """ This modules implements a simple LRU cache, using 2 ets tables for it. For using it, you need to start it: iex> LruCache.start_link(:my_cache, 1000) Or add it to your supervisor tree, like: `worker(LruCache, [:my_cache, 1000])` ## Using iex> LruCache.start...
lib/lru_cache.ex
0.746971
0.533033
lru_cache.ex
starcoder
defmodule Phoenix.PubSub.ConduitAMQP do use Supervisor require Logger @moduledoc """ Phoenix PubSub adapter based on PG2. To use it as your PubSub adapter, simply add it to your Endpoint's config: config :my_app, MyApp.Endpoint, pubsub: [name: MyApp.PubSub, adapter: Phoenix....
lib/phoenix/pubsub/conduit_amqp.ex
0.796767
0.40925
conduit_amqp.ex
starcoder
defmodule Stripe.Plans do @moduledoc """ A subscription plan contains the pricing information for different products and feature levels on your site. For example, you might have a $10/month plan for basic features and a different $20/month plan for premium features. """ @endpoint "plans" @doc """ You ...
lib/stripe/plans.ex
0.829354
0.570541
plans.ex
starcoder
defmodule Tensorflow.CreateSessionRequest do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ graph_def: Tensorflow.GraphDef.t() | nil, config: Tensorflow.ConfigProto.t() | nil, target: String.t() } defstruct [:graph_def, :config, :target] field(:g...
lib/tensorflow/core/protobuf/master.pb.ex
0.780913
0.607838
master.pb.ex
starcoder
defmodule ESpec.Assertions.Be do @moduledoc """ Defines 'be' assertion. it do: expect(2).to be :>, 1 """ use ESpec.Assertions.Interface alias ESpec.DatesTimes.Comparator defp match(subject, [op, val, [{granularity, delta}]]) do actual_delta = subject |> Comparator.diff(val, granularity)...
lib/espec/assertions/be.ex
0.81231
0.786213
be.ex
starcoder
defmodule AshPolicyAuthorizer.Check do @moduledoc """ A behaviour for declaring checks, which can be used to easily construct authorization rules. If a check can be expressed simply as a function of the actor, or the context of the request, see `AshPolicyAuthorizer.SimpleCheck` for an easy way to write that ...
lib/ash_policy_authorizer/check.ex
0.867191
0.546799
check.ex
starcoder
defmodule Breadboard.Pinout do @moduledoc """ Manage the pinout for the supported platform. Note that accessing the GPIO pins through sysfs in some case (i.e. ARM SoCs family from Allwinner Technology) the pinout number/label may differ from real pin reference number. The real pin number using `Circuits.GPIO....
lib/breadboard/pinout.ex
0.754373
0.481332
pinout.ex
starcoder
defmodule Herd.Cluster do @moduledoc """ Macro for generating a cluster manager. It will create, populate and refresh a `Herd.Balancer` in an ets table by polling the configured `Herd.Discovery` implementation. Usage: ``` defmodule MyHerdCluster do use Herd.Cluster, otp_app: :myapp, ...
lib/herd/cluster.ex
0.781956
0.664652
cluster.ex
starcoder
defmodule Quadtreex.BoundingBox.Guards do @moduledoc false defguard is_within(lx, ly, rx, ry, x, y) when x >= lx and x <= rx and y >= ly and y <= ry end defmodule Quadtreex.BoundingBox do @moduledoc """ Describes a box of 2 dimensional space """ @enforce_keys [:l, :r] defstruct l: {nil, nil}, r: {nil, ni...
lib/quadtreex/bounding_box.ex
0.916381
0.808521
bounding_box.ex
starcoder
defmodule ArtemisWeb.EventIntegrationView do use ArtemisWeb, :view # Data Table def data_table_available_columns() do [ {"Actions", "actions"}, {"Active", "active"}, {"Integration", "integration_type"}, {"Name", "name"}, {"Notification Type", "notification_type"}, {"Sched...
apps/artemis_web/lib/artemis_web/views/event_integration_view.ex
0.588298
0.423786
event_integration_view.ex
starcoder
defmodule Ockam.Examples.Session.Routing do @moduledoc """ Simple routing session example Creates a spawner for sessions and establishes a routing session with a simple forwarding data worker. Usage: ``` {:ok, spawner} = Ockam.Examples.Session.Routing.create_spawner() # create a responder spawner {:o...
implementations/elixir/ockam/ockam/lib/ockam/examples/session/routing.ex
0.812161
0.836488
routing.ex
starcoder
defmodule WordSearch do @moduledoc """ Generate a word search with various options. ## Examples iex> WordSearch.generate(["word", "another", "yetanother", "food", "red", "car", "treetop"], 10) [ ["R", "A", "T", "F", "K", "Y", "K", "V", "K", "R"], ["Q", "N", "B", "I", "H", "M", "T", ...
lib/word_search.ex
0.772187
0.549278
word_search.ex
starcoder
defmodule Hunter.Notification do @moduledoc """ Notification entity This module defines a `Hunter.Notification` struct and the main functions for working with Notifications. ## Fields * `id` - The notification ID * `type` - One of: "mention", "reblog", "favourite", "follow" * `created_at` - The...
lib/hunter/notification.ex
0.858348
0.467879
notification.ex
starcoder
defmodule Sizeable do @moduledoc """ A library to make file sizes human-readable. Forked from https://github.com/arvidkahl/sizeable under MIT. """ @bytes ~w(B KB MB GB TB PB EB ZB YB) @doc """ see `filesize(value, options)` """ def filesize(value) do filesize(value, []) end def filesize(va...
lib/sizeable.ex
0.909075
0.609321
sizeable.ex
starcoder
defmodule Profiler do @moduledoc """ This sampling profiler is intendend for shell and remote shell usage. Most commands here print their results to the screen for human inspection. Example usage: ``` iex(2)> Profiler.profile("<0.187.0>") 100% {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line:...
lib/profiler.ex
0.801159
0.745236
profiler.ex
starcoder
defmodule Bigtable.ReadRows do @moduledoc """ Provides functionality for to building and submitting a `Google.Bigtable.V2.ReadRowsRequest`. """ alias Bigtable.ChunkReader alias Bigtable.{Request, Utils} alias Google.Bigtable.V2 alias V2.Bigtable.Stub @type response :: {:ok, ChunkReader.chunk_reader_res...
lib/data/read_rows.ex
0.892587
0.403097
read_rows.ex
starcoder
defmodule BubbleLib.MapUtil do @moduledoc """ Map utility functions """ alias BubbleLib.MapUtil.AutoMap.ETS def normalize(value) do value |> deep_keyword_to_map() |> enum_materialize() |> deatomize() |> drop_nils() end def deatomize(%{__struct__: _} = struct) do struct |> Ma...
lib/bubble_lib/map_util.ex
0.707203
0.471527
map_util.ex
starcoder
defmodule Ockam.Messaging.PipeChannel do @moduledoc """ Ockam channel using pipes to deliver messages Can be used with different pipe implementations to get different delivery properties See `Ockam.Messaging.PipeChannel.Initiator` and `Ockam.Messaging.PipeChannel.Responder` for usage Session setup: Init...
implementations/elixir/ockam/ockam/lib/ockam/messaging/pipe_channel.ex
0.880739
0.436322
pipe_channel.ex
starcoder
defmodule Plaid.Webhook do @moduledoc """ Creates a Plaid Event from webhook's payload if signature is valid. Verification flow following docs::: plaid.com/docs/#webhook-verification """ import Plaid, only: [make_request_with_cred: 4, validate_cred: 1] alias Plaid.Utils @endpoint :webhook_verification...
lib/plaid/webhook.ex
0.795301
0.58347
webhook.ex
starcoder
defmodule LruCache do @moduledoc ~S""" This modules implements a simple LRU cache, using 2 ets tables for it. For using it, you need to start it: iex> LruCache.start_link(:my_cache, 1000) Or add it to your supervisor tree, like: `worker(LruCache, [:my_cache, 1000])` ## Using iex> LruCache.sta...
lib/lru_cache.ex
0.769384
0.490907
lru_cache.ex
starcoder
defmodule Spellex do @words Spellex.Dictionary.words() @letters String.split("abcdefghijklmnopqrstuvwxyz", "") @moduledoc """ Documentation for Spellex. """ @doc """ Returns a list of possible corrections for a `word`. ## Examples iex> Spellex.corrections("wrod") {:ok, ["word"]} iex> ...
lib/spellex.ex
0.903552
0.493226
spellex.ex
starcoder
defmodule Prog do @moduledoc """ Documentation for `Prog`. """ @doc """ Day 12 """ def solve do {:ok, raw} = File.read("data/day_12") # raw = "F10 # N3 # F7 # R90 # F11" data = String.split(raw, "\n", trim: true) |> Enum.map(&extract/1) distance_to_end = find_path_to_ending_...
lib/days/day_12.ex
0.850562
0.561696
day_12.ex
starcoder
defmodule SecretGrinch.Matches do @moduledoc """ The Matches context. """ import Ecto.Query, warn: false alias SecretGrinch.Repo alias SecretGrinch.Matches.Match @doc """ Returns the list of matches. ## Examples iex> list_matches() [%Match{}, ...] """ def list_matches do Repo...
lib/secret_grinch/matches/matches.ex
0.820469
0.411584
matches.ex
starcoder
defmodule CouchjitsuTrack.ActivityHistory do @moduledoc """ A collection of queries for activities. """ import Ecto.Query alias CouchjitsuTrack.Record alias CouchjitsuTrack.Activity @doc """ Gets all activities for a specified user id. Will return a list of %{date, name, time, not...
lib/couchjitsu_track/activity_history.ex
0.738386
0.412678
activity_history.ex
starcoder
defmodule FileSize do @moduledoc """ A file size calculator, parser and formatter. ## Usage You can build your own file size by creating it with a number and a unit using the `new/2` function. See the "Supported Units" section for a list of possible unit atoms. iex> FileSize.new(16, :gb) #Fil...
lib/file_size.ex
0.799168
0.614943
file_size.ex
starcoder
defmodule Specify.Provider.SystemEnv do @moduledoc """ A Configuration Provider source based on `System.get_env/2` Values will be loaded based on `\#{prefix}_\#{capitalized_field_name}`. `prefix` defaults to the capitalized name of the configuration specification module. `capitalized_field_name` is in `CONST...
lib/specify/provider/system_env.ex
0.840995
0.406096
system_env.ex
starcoder
defmodule EQ do @moduledoc """ A simple wrapper around the Erlang Queue library that follows the idiomatic pattern of expecting the module target first to take advantage of the pipeline operator. Queues are double ended. The mental picture of a queue is a line of people (items) waiting for their turn. The ...
lib/e_q.ex
0.857872
0.655115
e_q.ex
starcoder