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 Ecto.ERD.PlantUML do @moduledoc false alias Ecto.ERD.{Node, Edge, Graph, Render, Color} @safe_name_pattern ~r/^[a-z\d_\.:\?]+$/i def render(%Graph{nodes: nodes, edges: edges}, options) do columns = Keyword.fetch!(options, :columns) fontname = Keyword.fetch!(options, :fontname) clusters =...
lib/ecto/erd/plantuml.ex
0.567697
0.435421
plantuml.ex
starcoder
defmodule Exyt.Auth do defmodule HTTPError do defexception message: "HTTP Error" end @moduledoc """ A struct to fetch access / refresh token(s) from the Google's OAuth2 endpoints. """ @default_headers [ "Accept": "application/json", "Content-Type": "application/x-www-form-urlencoded" ] ...
lib/exyt/auth.ex
0.889613
0.40389
auth.ex
starcoder
defmodule Number.Human do @moduledoc """ Provides functions for converting numbers into more human readable strings. """ import Number.Delimit, only: [number_to_delimited: 2] import Decimal, only: [cmp: 2] @doc """ Formats and labels a number with the appropriate English word. ## Examples iex>...
lib/number/human.ex
0.816991
0.523847
human.ex
starcoder
defmodule CSV do @moduledoc ~S""" RFC 4180 compliant CSV parsing and encoding for Elixir. Allows to specify other separators, so it could also be named: TSV, but it isn't. """ @doc """ Decode a stream of comma-separated lines into a table. ## Options These are the options: * `:separator` – ...
data/web/deps/csv/lib/csv.ex
0.84891
0.559561
csv.ex
starcoder
defmodule Contex.Dataset do @moduledoc """ `Dataset` is a simple wrapper around a datasource for plotting charts. Dataset marshalls a couple of different data structures into a consistent form for consumption by the chart plotting functions. It allows a list of maps, list of lists or a list of tuples to be t...
lib/chart/dataset.ex
0.802942
0.874774
dataset.ex
starcoder
defmodule Sanbase.TemplateEngine do @moduledoc ~s""" Produce a string value from a given template and key-value enumerable. All occurances in the template that are enclosed in double braces are replaced with the corersponding values from KV enumerable. Example: iex> Sanbase.TemplateEngine.run("My name is...
lib/sanbase/template_engine/template_engine.ex
0.685529
0.555646
template_engine.ex
starcoder
defmodule ExWire.Packet.BlockBodies do @moduledoc """ Eth Wire Packet for getting block bodies from a peer. ``` **BlockBodies** [`+0x06`, [`transactions_0`, `uncles_0`] , ...] Reply to `GetBlockBodies`. The items in the list (following the message ID) are some of the blocks, minus the header, in the forma...
apps/ex_wire/lib/ex_wire/packet/block_bodies.ex
0.885965
0.808483
block_bodies.ex
starcoder
defmodule Phoenix.LiveDashboard.TableComponent do use Phoenix.LiveDashboard.Web, :live_component @limit [50, 100, 500, 1000, 5000] @type params() :: %{ limit: pos_integer(), sort_by: :atom, sort_dir: :desc | :asc, search: binary(), hint: binary() | nil }...
lib/phoenix/live_dashboard/components/table_component.ex
0.597021
0.421016
table_component.ex
starcoder
defmodule Aoc2019.Day3 do @behaviour DaySolution def solve_part1(), do: paths() |> part1() def solve_part2(), do: paths() |> part2() defp paths(), do: load("inputs/input_day3") defp load(filepath), do: File.read!(filepath) |> String.split("\n") |> Enum.map(fn path -> path |> String.sp...
lib/aoc2019/day3.ex
0.670177
0.555073
day3.ex
starcoder
defmodule DeepMerge do @moduledoc """ Provides functionality for deeply/recursively merging structures (normally for `Map` and `Keyword`). If you want to change the deep merge behavior of a custom struct, please have a look at the `DeepMerge.Resolver` protocol. """ alias DeepMerge.Resolver @continue_s...
lib/deep_merge.ex
0.850996
0.811452
deep_merge.ex
starcoder
defmodule ExWinlog do @moduledoc """ `Logger` backend for the [Windows Event Log](https://docs.microsoft.com/windows/win32/wes/windows-event-log) ## Usage Add it to your list of `Logger` backends in your `config.exs` file like this: ```elixir config :logger, backends: [:console, {ExWi...
lib/ex_winlog.ex
0.811937
0.668706
ex_winlog.ex
starcoder
require Utils require Program defmodule D7 do @moduledoc """ --- Day 7: Amplification Circuit --- Based on the navigational maps, you're going to need to send more power to your ship's thrusters to reach Santa in time. To do this, you'll need to configure a series of amplifiers already installed on the ship. ...
lib/days/07.ex
0.828766
0.840717
07.ex
starcoder
defmodule ListToCsv.Option do @moduledoc """ `ListToCsv.Option` contains types and utilities for option. """ alias ListToCsv.Header alias ListToCsv.Key @type t() :: [ headers: list(Header.t()) | nil, keys: list(Key.many()), length: list({Key.many(), integer}) | nil ] ...
lib/list_to_csv/option.ex
0.84869
0.493164
option.ex
starcoder
defmodule EctoEnumMigration do @moduledoc """ Provides a DSL to easily handle Postgres Enum Types in Ecto database migrations. """ import Ecto.Migration, only: [execute: 1, execute: 2] @doc """ Create a Postgres Enum Type. ## Examples ```elixir defmodule MyApp.Repo.Migrations.CreateTypeMigration d...
lib/ecto_enum_migration.ex
0.865537
0.809427
ecto_enum_migration.ex
starcoder
defmodule Posexional.Field.Value do @moduledoc """ this module represent a single field in a row of a positional file """ alias Posexional.Field defstruct name: nil, size: nil, filler: ?\s, alignment: :left, default: nil @spec new(atom, integer, Keyword.t())...
lib/posexional/field/value.ex
0.84375
0.563408
value.ex
starcoder
defmodule GraphQL.Lang.AST.ParallelVisitor do @moduledoc ~S""" A ParallelVisitor runs all child visitors in parallel instead of serially like the CompositeVisitor. In this context, 'in parallel' really means that for each node in the AST, each visitor will be invoked for each node in the AST, but the :skip/:co...
lib/graphql/lang/ast/parallel_visitor.ex
0.712332
0.478712
parallel_visitor.ex
starcoder
defmodule ArtemisLog.IntervalWorker do @moduledoc """ A `use` able module for creating GenServer instances that perform tasks on a set interval. ## Callbacks Define a `call/1` function to be executed at the interval. Receives the current `state.data`. Must return a tuple `{:ok, _}` or `{:error, _}`. ...
apps/artemis_log/lib/artemis_log/workers/interval_worker.ex
0.860369
0.463809
interval_worker.ex
starcoder
defmodule Day10 do @moduledoc """ Advent of Code 2019 Day 10: Monitoring Station """ alias Day10.{Part1, Part2} def get_map() do Path.join(__DIR__, "inputs/day10.txt") |> File.open!() |> IO.stream(:line) |> Stream.map(&String.trim/1) |> Stream.map(&String.graphemes/1) |> Enum.map(&...
lib/day10.ex
0.695028
0.60996
day10.ex
starcoder
defmodule GoogleMaps do @moduledoc """ Provides various map-related functionality. Unless otherwise noted, all the functions take the required Google parameters as its own parameters, and all optional ones in an `options` keyword list. The `options` keyword can also take special entry for `headers` and ...
lib/google_maps.ex
0.955827
0.758399
google_maps.ex
starcoder
defmodule Plug.Builder do @moduledoc """ Conveniences for building plugs. This module can be used into a module in order to build a plug stack: defmodule MyApp do use Plug.Builder plug :hello, upper: true def hello(conn, opts) do body = if opts[:upper], do: "WORLD", e...
lib/plug/builder.ex
0.789153
0.428861
builder.ex
starcoder
defmodule WeePub.Broadcaster do @moduledoc """ A `GenServer` that manages distribution of messages to interested clients """ use GenServer @broadcaster __MODULE__ @registry WeePub.Registry @topic @broadcaster @doc false def child_spec(options) do %{ id: @broadcaster, start: {__MODUL...
lib/wee_pub/broadcaster.ex
0.788746
0.460653
broadcaster.ex
starcoder
defmodule Tint.Distance.CIEDE2000 do @moduledoc """ A module that implements the CIEDE2000 color distance algorithm. (http://www2.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf) """ @behaviour Tint.Distance alias Tint.Utils.Math @deg_6_in_rad Math.deg_to_rad(6) @deg_25_in_rad Math.deg_to_...
lib/tint/distance/ciede2000.ex
0.775137
0.579817
ciede2000.ex
starcoder
defmodule Wasmex.Instance do @moduledoc """ Instantiates a WebAssembly module and allows calling exported functions on it. # Read a WASM file and compile it into a WASM module {:ok, bytes } = File.read("wasmex_test.wasm") {:ok, module} = Wasmex.Module.compile(bytes) # Instantiates the WASM...
lib/wasmex/instance.ex
0.850375
0.822225
instance.ex
starcoder
defmodule Treex.Tree do @moduledoc """ Primarily a struct for representing tree data to be processed with the `Tree.Traverse` module. Also includes implementations necessary for the `Enumerable` protocol and conversion functions to/from ordinary `t:Map.t/0` representations of the same data. One import note i...
lib/treex/tree.ex
0.94064
0.806738
tree.ex
starcoder
defmodule Rajska.ObjectScopeAuthorization do @moduledoc """ Absinthe Phase to perform object scoping. Authorizes all Absinthe's [objects](https://hexdocs.pm/absinthe/Absinthe.Schema.Notation.html#object/3) requested in a query by checking the underlying struct. ## Usage [Create your Authorization module an...
lib/middlewares/object_scope_authorization.ex
0.803328
0.808143
object_scope_authorization.ex
starcoder
defmodule ESpec.ExampleHelpers do @moduledoc """ Defines macros 'example' and 'it'. These macros defines function with random name which will be called when example runs. Example structs %ESpec.Example are accumulated in @examples attribute """ @aliases ~w(it specify)a @skipped ~w(xit xexample xspecify)a ...
lib/espec/example_helpers.ex
0.700997
0.578627
example_helpers.ex
starcoder
defmodule HXL.Evaluator do @moduledoc """ Defines the behaviour for custom evaluation of the AST returned from `HXL.Parser` See `c:eval/2` for more information """ @type t :: module() defmacro __using__(_) do quote do @behaviour unquote(__MODULE__) end end @doc ~S""" This functions is...
lib/hxl/evaluator.ex
0.858985
0.597344
evaluator.ex
starcoder
defmodule QuizServer.Boundary.Validator do @moduledoc """ Functions to validate that the API inputs are properly configured """ @type result_error :: {atom(), String.t()} @type validation_result :: :ok | {:error, String.t()} @spec required(list(result_error), map(), list() | atom()) :: list(result_error) ...
apps/quiz_server/lib/boundary/validator.ex
0.766818
0.480844
validator.ex
starcoder
defmodule ExRPC do @moduledoc """ ExRPC is an out-of band RPC application and library that uses multiple TCP ports to send and receive data between Elixir nodes. It behaves mostly like Erlang's `RPC` module but uses different ports and processes for different nodes, effectively spreading the load to...
lib/exrpc.ex
0.794345
0.611802
exrpc.ex
starcoder
defmodule Asteroid.ObjectStore.AuthenticationEvent.Mnesia do @moduledoc """ Mnesia implementation of the `Asteroid.ObjectStore.AuthenticationEvent` behaviour ## Options The options (`Asteroid.ObjectStore.AuthenticationEvent.opts()`) are: - `:table_name`: an `atom()` for the table name. Defaults to `:asteroid...
lib/asteroid/object_store/authentication_event/mnesia.ex
0.903126
0.835752
mnesia.ex
starcoder
defmodule RefInspector.Config do @moduledoc """ Module to simplify access to configuration values with default values. There should be no configuration required to start using `:ref_inspector` if you rely on the default values: config :ref_inspector, database_files: ["referers.yml"], dat...
lib/ref_inspector/config.ex
0.896591
0.534673
config.ex
starcoder
defmodule ExSaga.Hook do @moduledoc """ """ alias ExSaga.{DryRun, Event, Stage, Stepable} @typedoc """ """ @type opt :: {:override, boolean} | {:cascade_depth, non_neg_integer} @typedoc """ """ @type opts :: [opt] @typedoc """ """ @type hook_state :: term @typedoc """ ...
lib/ex_saga/hook.ex
0.701509
0.420719
hook.ex
starcoder
defmodule QRCode.DataMasking do @moduledoc """ A mask pattern changes which modules are dark and which are light according to a particular rule. The purpose of this step is to modify the QR code to make it as easy for a QR code reader to scan as possible. """ use Bitwise alias MatrixReloaded.Matrix a...
lib/qr_code/data_masking.ex
0.796134
0.788298
data_masking.ex
starcoder
defmodule TimeZoneInfo do @moduledoc """ `TimeZoneInfo` provides a time zone database for [Elixir](https://elixir-lang.org/) using the data from the [the Internet Assigned Numbers Authority (IANA)](https://www.iana.org/time-zones). Therefore `TimeZoneInfo` contains an implementation of the `Calendar.TimeZo...
lib/time_zone_info.ex
0.917985
0.669674
time_zone_info.ex
starcoder
defmodule Cure.Server do use GenEvent alias Cure.Queue, as: Queue require Logger @moduledoc """ The server is responsible for the communication between Elixir and C/C++. The communication is based on Erlang Ports. """ @port_options [:binary, :use_stdio, packet: 2] defmodule State do defstruct p...
lib/cure_server.ex
0.659734
0.485905
cure_server.ex
starcoder
defmodule Extractly.Toc.Options do @moduledoc false defstruct format: :markdown, gh_links: false, max_level: 7, min_level: 1, remove_gaps: false, start: 1, type: :ul # %Extractly.Toc.Options{format: :markdown, gh_links: false, max_level: 7, min_level: 1, remove_gaps: false, start: 1, ty...
lib/extractly/toc/options.ex
0.66072
0.456773
options.ex
starcoder
defmodule Mix.Tasks.Bmark.Cmp do use Mix.Task @shortdoc "Compare bmark results" @moduledoc """ ## Usage mix bmark.cmp <result1> <result2> Compares a pair of benchmark results. result1 and result2 should be results files written by bmark for different runs of the same benchmark...
lib/mix/tasks/bmark_cmp.ex
0.725843
0.512693
bmark_cmp.ex
starcoder
defmodule Ueberauth.Strategy.W3ID do use Ueberauth.Strategy # Authorize Phase @doc """ The initial redirect to the w3id authentication page. """ def handle_request!(conn) do state = Map.get(conn.params, "state") authorize_url = Ueberauth.Strategy.W3ID.OAuth.authorize_url!(state: state) redire...
apps/artemis_web/lib/ueberauth/strategy/w3id.ex
0.779364
0.432543
w3id.ex
starcoder
defmodule Cog.Config do @type interval_type :: :ms | :sec | :min | :hour | :day | :week @type typed_interval :: {integer, interval_type} @doc """ Token lifetime configuration, converted into seconds. This is how long after creation time a token is considered valid. """ def token_lifetime do value = ...
lib/cog/config.ex
0.863118
0.540499
config.ex
starcoder
defmodule Phoenix.LiveView.Router do @moduledoc """ Provides LiveView routing for Phoenix routers. """ @doc """ Defines a LiveView route. ## Layout When a layout isn't explicitly set, a default layout is inferred similar to controller actions. For example, the layout for the router `MyAppWeb.Router` ...
lib/phoenix_live_view/router.ex
0.926312
0.465327
router.ex
starcoder
defprotocol Phoenix.Param do @moduledoc """ A protocol that converts data structures into URL parameters. This protocol is used by URL helpers and other parts of the Phoenix stack. For example, when you write: user_path(conn, :edit, @user) Phoenix knows how to extract the `:id` from `@user` thanks ...
lib/phoenix/param.ex
0.910689
0.627923
param.ex
starcoder
defmodule Twirp do @moduledoc """ Twirp provides an elixir implementation of the [twirp rpc framework](https://github.com/twitchtv/twirp) developed by Twitch. The protocol defines semantics for routing and serialization of RPCs based on protobufs. ## Example The canonical Twirp example is a Haberdasher se...
lib/twirp.ex
0.909365
0.886813
twirp.ex
starcoder
defmodule LQueue do @moduledoc """ Functions that work on the double-ended queue with limited length. `[1, 2, 3]` queue has the front at the element `1` and the rear at `3`. By pushing a new element to the queue (`4`), and assuming that the max length of the queue is 3, we will get `[2, 3, 4]` (the `push/2` ...
lib/lqueue.ex
0.896883
0.675015
lqueue.ex
starcoder
defmodule CCSP.Chapter5.SendMoreMoney do alias __MODULE__, as: T @moduledoc """ Corresponds to CCSP in Python, Chapter 5, titled "Genetic Algorithms" """ @type t :: %T{ letters: list(String.t()) } defstruct [ :letters ] @spec new(list(String.t())) :: t def new(letters) do ...
lib/ccsp/chapter5/send_more_money.ex
0.680772
0.452838
send_more_money.ex
starcoder
defmodule Elasticsearch.Index do @moduledoc """ Functions for manipulating Elasticsearch indexes. """ alias Elasticsearch.{ Cluster.Config, Index.Bulk } @doc """ Creates an index using a zero-downtime hot-swap technique. 1. Build an index for the given `alias`, with a timestamp: `alias-123231...
lib/elasticsearch/indexing/index.ex
0.901884
0.593963
index.ex
starcoder
defmodule Xandra.ConnectionError do @moduledoc """ An exception struct that represents an error in the connection to the Cassandra server. For more information on when this error is returned or raised, see the documentation for the `Xandra` module. The `:action` field represents the action that was being ...
lib/xandra/connection_error.ex
0.919227
0.584864
connection_error.ex
starcoder
defmodule Credo.Check.Refactor.WithClauses do use Credo.Check, base_priority: :high, explanations: [ check: ~S""" `with` statements are useful when you need to chain a sequence of pattern matches, stopping at the first one that fails. But sometimes, we go a little overboard with them ...
lib/credo/check/refactor/with_clauses.ex
0.526465
0.423935
with_clauses.ex
starcoder
defmodule McProtocol.Util.GenerateRSA do @moduledoc """ Utilities for generating RSA keys. """ @doc """ Generates an RSA key with the size of key_size. Calls out to the openssl commend line executable for key generation. Returns an RSA private key in the form of a :RSAPrivateKey record. """ def ge...
lib/util/generate_rsa.ex
0.762026
0.419143
generate_rsa.ex
starcoder
defmodule Vox do @moduledoc """ Functions for working with voxels. """ @doc """ Create vox data from some data. """ @spec new(any) :: Vox.Data.t | nil def new(data), do: new(data, format(data)) @doc """ Create vox data from some data that should be loaded by the specified...
lib/vox.ex
0.913286
0.598547
vox.ex
starcoder
defmodule GuessWho.Contenders.Seancribbs do @behaviour GuessWho.Contender def name do "Sean's Guesstimator" end # Post result, need an algorithm to eliminate characters and attributes excluded defmodule State do defstruct guesses: [], characters: GuessWho.Attributes.ch...
lib/guess_who/contenders/seancribbs.ex
0.523908
0.477493
seancribbs.ex
starcoder
defmodule Nerves.Package do @moduledoc """ Defines a Nerves package struct and helper functions. A Nerves package is an application which defines a Nerves package configuration file at the root of the application path. The configuration file is `nerves.exs` and uses Mix.Config to list configuration values. ...
lib/nerves/package.ex
0.850267
0.779248
package.ex
starcoder
defmodule Militerm.ECS.Entity do @moduledoc """ An entity is composed of components. Each entity has a process that coordinates event messages with the components if the entity responds to events. The entity module holds any event handlers that are specific to the entity type. Entity modules can delegate som...
lib/militerm/ecs/entity.ex
0.802942
0.527742
entity.ex
starcoder
defmodule DocuSign.Api.BulkEnvelopes do @moduledoc """ API calls for all endpoints tagged `BulkEnvelopes`. """ alias DocuSign.Connection import DocuSign.RequestBuilder @doc """ Gets the status of a specified bulk send operation. Retrieves the status information of a single bulk recipient batch. A bul...
lib/docusign/api/bulk_envelopes.ex
0.889846
0.485234
bulk_envelopes.ex
starcoder
defmodule Bolt.Sips.Internals.PackStream.Message.Encoder do @moduledoc false _module_doc = """ Manages the message encoding. A mesage is a tuple formated as: `{message_type, data}` with: - message_type: atom amongst the valid message type (:init, :discard_all, :pull_all, :ack_failure, :reset, :run) -...
lib/bolt_sips/internals/pack_stream/message/encoder.ex
0.845385
0.61025
encoder.ex
starcoder
defmodule Makeup.Lexer do @moduledoc """ A lexer turns raw source code into a list of tokens. """ alias Makeup.Lexer.Types, as: T alias Makeup.Lexer.Postprocess @doc """ Parses the smallest number of tokens that make sense. It's a `parsec`. """ @callback root_element(String.t) :: T.parsec_result ...
lib/makeup/lexer.ex
0.788502
0.421552
lexer.ex
starcoder
defmodule Adap.Piper do @moduledoc ~S""" Piper proposes an implementation of `Adap.Stream.Emitter` where the distributed processing of each element is defined as a succession of matching rules. Each rule can use external data to process the element or emit new ones. When external data is needed, a process ...
lib/piper.ex
0.773516
0.562537
piper.ex
starcoder
defmodule Timex.Parse.Timezones.Posix do @moduledoc """ Parses POSIX-style timezones: ## Format POSIX-style timezones are of the format: `local_timezone,date/time,date/time` Where `date` is in the `Mm.n.d` format, and where: - `Mm` (1-12) for 12 months - `n` (1-5) 1 for the first week and 5 for the la...
lib/parse/posix/parser.ex
0.808635
0.700056
parser.ex
starcoder
defmodule Enumancer do @moduledoc """ Macros to effortlessly define highly optimized `Enum` pipelines ## Overview `Enumancer` provides a `defenum/2` macro, which will convert a pipeline of `Enum` function calls to an optimized tail-recursive function. defmodule BlazingFast do import Enumancer...
lib/enumancer.ex
0.91204
0.70609
enumancer.ex
starcoder
defmodule EpicenterWeb.Test.Pages.DemographicsEdit do import Euclid.Test.Extra.Assertions import ExUnit.Assertions import Phoenix.LiveViewTest alias Epicenter.Cases.Person alias Epicenter.Test alias EpicenterWeb.Test.Pages alias Phoenix.LiveViewTest.View def visit(%Plug.Conn{} = conn, %Person{id: pers...
test/support/pages/demographics_edit.ex
0.651909
0.690716
demographics_edit.ex
starcoder
defmodule Replug do @moduledoc """ ``` # ---- router.ex ---- plug Replug, plug: Corsica, opts: {MyAppWeb.PlugConfigs, :corsica} # ---- plug_configs.ex ---- defmodule MyAppWeb.PlugConfigs do def corsica do [ max_age: System.get_env("CORSICA_MAX_AGE"), expose_headers: ~w(X-F...
lib/replug.ex
0.647798
0.512327
replug.ex
starcoder
defmodule Tensorflow.DataClass do @moduledoc false use Protobuf, enum: true, syntax: :proto3 @type t :: integer | :DATA_CLASS_UNKNOWN | :DATA_CLASS_SCALAR | :DATA_CLASS_TENSOR | :DATA_CLASS_BLOB_SEQUENCE field(:DATA_CLASS_UNKNOWN, 0) field(:DATA_CLASS_SCALAR...
lib/tensorflow/core/framework/summary.pb.ex
0.8288
0.590897
summary.pb.ex
starcoder
defmodule Money.Currency do @moduledoc """ Functions to return lists of known, historic and legal tender currencies. """ @current_currencies Cldr.Config.get_locale(Cldr.get_current_locale().cldr_locale_name) |> Map.get(:currencies) |> Enum.filter(fn {_code, currenc...
lib/money/currency.ex
0.734024
0.600979
currency.ex
starcoder
defmodule Plymio.Ast.Form do @moduledoc ~S""" Utility Functions for Manipulating Asts (Quoted Forms) Many functions return either `{:ok, value}` or `{:error, error}` where `error` with be usually an `ArgumentError` """ require Logger @type error :: %ArgumentError{} @doc ~S""" Takes a maybe quoted v...
lib/ast/form.ex
0.887229
0.529993
form.ex
starcoder
defmodule React do use GenServer defmodule InputCell do defstruct [:name, :value] @type t :: %InputCell{name: String.t(), value: any} end defmodule OutputCell do defstruct [:name, :inputs, :compute, :value, callbacks: %{}] @type t :: %OutputCell{ name: String.t(), inpu...
exercises/practice/react/.meta/example.ex
0.824991
0.513912
example.ex
starcoder
defmodule React do use GenServer @opaque cells :: pid @typep input :: {:input, String.t(), any} @typep output :: {:output, String.t(), [String.t()], fun()} @type cell :: input | output @doc """ Start a reactive system """ @spec new(cells :: [cell]) :: {:ok, pid} def new(cells) do GenServer.st...
exercism/elixir/react/lib/react.ex
0.786377
0.41481
react.ex
starcoder
defmodule Elasticfusion.Index do defmacro __using__(_opts) do quote do import Elasticfusion.Index @transforms [] @before_compile {Elasticfusion.Index.Compiler, :compile_index} end end @doc """ Defines the searchable index name. This setting is required. """ defmacro index_nam...
lib/elasticfusion/index.ex
0.808597
0.878001
index.ex
starcoder
defmodule Intcode do require IEx def build(s) do s |> parse_machine |> assign_offsets(0, %{}) end def parse_machine(s) do s |> String.split(",") |> Enum.map(&(Integer.parse(&1) |> elem(0))) end def execute(machine, input \\ [1]) def execute(machine, {:mailbox, pid}), do: execute...
year_2019/lib/intcode.ex
0.50293
0.611672
intcode.ex
starcoder
defmodule Mix.Releases.Checks.LoadedOrphanedApps do @moduledoc """ This check determines whether or not any of the applications in the release satisfy all three of the following conditions: * Have a start type of `:load` or `:none` * Are not included by any other application in the release (orphaned) ...
lib/mix/lib/releases/checks/loaded_orphaned_apps.ex
0.791015
0.553385
loaded_orphaned_apps.ex
starcoder
defmodule Expected.MnesiaStore do @moduledoc """ Stores login data in a Mnesia table. To use this store, configure `:expected` accordingly and set the table name in the application configuration: config :expected, store: :mnesia, table: :logins, ... This table is not created b...
lib/expected/mnesia_store.ex
0.831109
0.506958
mnesia_store.ex
starcoder
defmodule Geometry.MultiPointM do @moduledoc """ A set of points from type `Geometry.PointM`. `MultiPointM` implements the protocols `Enumerable` and `Collectable`. ## Examples iex> Enum.map( ...> MultiPointM.new([ ...> PointM.new(1, 2, 4), ...> PointM.new(3, 4, 6) ......
lib/geometry/multi_point_m.ex
0.956604
0.81549
multi_point_m.ex
starcoder
defmodule TimeZoneInfo.DataStore.ErlangTermStorage do @moduledoc false # This module implements the `TimeZoneInfo.DataStore` and stores the data with # [:ets](https://erlang.org/doc/man/ets.html). @behaviour TimeZoneInfo.DataStore @app :time_zone_info @time_zones :time_zone_info_time_zones @transitions...
lib/time_zone_info/data_store/erlang_term_storage.ex
0.822368
0.570092
erlang_term_storage.ex
starcoder
defmodule SimpleCipher do @moduledoc false @doc """ Given a `plaintext` and `key`, encode each character of the `plaintext` by shifting it by the corresponding letter in the alphabet shifted by the number of letters represented by the `key` character, repeating the `key` if it is shorter than the `plaintex...
simple-cipher/lib/simple_cipher.ex
0.914853
0.779238
simple_cipher.ex
starcoder
defmodule Assertions do @moduledoc """ Helpful assertions with great error messages to help you write better tests. """ alias Assertions.Comparisons @type comparison :: (any, any -> boolean | no_return) @doc """ Asserts that the return value of the given expression is `true`. This is different than ...
lib/assertions.ex
0.930789
0.808483
assertions.ex
starcoder
defmodule Tomato.ProgressBar do @format [ bar: "=", blank: " ", left: "|", right: "|", percent: true, suffix: false, bar_color: [], blank_color: [], width: :auto ] @min_bar_width 1 @max_bar_width 100 @fallback 80 def render(current, total) do percent = (current / tot...
lib/progressbar.ex
0.505859
0.454714
progressbar.ex
starcoder
defmodule Blogit.Supervisor do @moduledoc """ This module represents the root Supervisor of Blogit. It uses a `one_for_all` strategy to supervise its children. The children are: * `Blogit.Server` worker used as the core process of `Blogit`. If it fails all the top-level processes of the application must ...
lib/blogit/supervisor.ex
0.627609
0.551876
supervisor.ex
starcoder
if Code.ensure_loaded?(Plug.Conn) do defmodule Joken.Plug do import Joken alias Joken.Token require Logger @moduledoc """ A Plug for signing and verifying authentication tokens. ## Usage There are two possible scenarios: 1. Same configuration for all routes 2. Per route config...
lib/joken/plug.ex
0.628065
0.42937
plug.ex
starcoder
defmodule Nebulex.Caching.Decorators do @moduledoc ~S""" Function decorators which provide a way of annotating functions to be cached or evicted. By means of these decorators, it is possible the implementation of cache usage patterns like **Read-through**, **Write-through**, **Cache-as-SoR**, etc. ## Shar...
lib/nebulex/caching/decorators.ex
0.899984
0.635449
decorators.ex
starcoder
defmodule Tensorflow.MemoryLogStep do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ step_id: integer, handle: String.t() } defstruct [:step_id, :handle] field(:step_id, 1, type: :int64) field(:handle, 2, type: :string) end defmodule Tensorflow.MemoryLo...
lib/tensorflow/core/framework/log_memory.pb.ex
0.728265
0.547343
log_memory.pb.ex
starcoder
defmodule Lonely.Result.List do @moduledoc """ Functions to operate on result lists. """ alias Lonely.Result @type t :: Result.t @doc """ Combines a list of results into a result with a list of values. If there is any error, the first is returned. iex> import Lonely.Result.List ...> comb...
lib/lonely/result/list.ex
0.738009
0.41567
list.ex
starcoder
defmodule ExDebugger.Meta do @moduledoc """ Debugging the debugger. In order to facilitate development of `ExDebugger`, various `inspect` statements have been placed strategically which can be switched on/off by means of the settings under `#{Documentation.debug_options_path()}`. ```elixir config :ex_debu...
lib/ex_debugger/meta.ex
0.660501
0.691562
meta.ex
starcoder
defmodule ShEx.Schema do @moduledoc """ A ShEx schema is a collection of ShEx shape expressions that prescribes conditions that RDF data graphs must meet in order to be considered "conformant". Usually a `ShEx.Schema` is not created by hand, but read from a ShExC or ShExJ representation via `ShEx.ShExC.decode/...
lib/shex/schema.ex
0.762866
0.603377
schema.ex
starcoder
defmodule ExWire.Framing.Secrets do @moduledoc """ Secrets are used to both encrypt and authenticate incoming and outgoing peer to peer messages. """ alias ExthCrypto.{AES, MAC} alias ExthCrypto.ECIES.ECDH alias ExthCrypto.Hash.Keccak alias ExWire.Handshake @type t :: %__MODULE__{ egress_m...
apps/ex_wire/lib/ex_wire/framing/secrets.ex
0.881436
0.412767
secrets.ex
starcoder
defmodule ExInsights do @moduledoc """ Exposes methods for POST events & metrics to Azure Application Insights. For more information on initialization and usage consult the [README.md](readme.html) """ alias ExInsights.Data.Payload @typedoc """ Measurement name. Will be used extensively in the app insig...
lib/ex_insights.ex
0.916119
0.897291
ex_insights.ex
starcoder
defmodule Haex.Data.Parser do @moduledoc """ Parses an AST received from `Haex.data/1` macro, and generates a `Haex.Data.t()` struct which can be used to generate modules to represent that data type """ alias Haex.Data alias Haex.Data.DataConstructor alias Haex.Data.TypeConstructor @spec parse(Macro....
lib/haex/data/parser.ex
0.846784
0.618924
parser.ex
starcoder
defmodule Opus.Instrumentation do @moduledoc false defmacro instrument(event, fun) do handling = __MODULE__.definstrument(fun) quote do @doc false def instrument(unquote(event), _, metrics), do: unquote(handling) end end defmacro instrument(event, opts, fun) do handling = __MODULE...
lib/opus/instrumentation.ex
0.619471
0.434821
instrumentation.ex
starcoder
defmodule Logz.Nginx do @moduledoc """ Implements a Stream that reads from files and emits maps. """ require Logger defp parse_month(str) do case str do "Jan" -> 1 "Feb" -> 2 "Mar" -> 3 "Apr" -> 4 "May" -> 5 "Jun" -> 6 "Jul" -> 7 "Aug" -> 8 "Sep" -> ...
lib/logz/nginx.ex
0.584745
0.456349
nginx.ex
starcoder
defmodule SvgBuilder.Transform do alias SvgBuilder.Element @moduledoc """ Apply transforms to SVG elements. These add or append to the "transform" attribute on an element. """ @doc """ Apply a translation to an element. """ @spec translate(Element.t(), number, number) :: Element.t() def transla...
lib/transform.ex
0.896841
0.633552
transform.ex
starcoder
defmodule Nba.Stats do @moduledoc """ Provides a function for each stats.nba.com endpoint. ## Examples See what endpoints you can hit: Nba.Stats.endpoints() #=> [:assist_tracker:, :box_score:, :box_score_summary:, ...] Pass in the atom `:help` as a parameter to an endpoint function to get a l...
lib/nba/stats.ex
0.803945
0.480235
stats.ex
starcoder
defmodule ExUnitFixtures.Imp.Preprocessing do @moduledoc false # Provides functions that pre-process fixtures at compile time. # Most of the functions provide some sort of transformation or validation # process that we need to do on fixtures at compile time. alias ExUnitFixtures.FixtureDef @type fixture_d...
lib/ex_unit_fixtures/imp/preprocessing.ex
0.812123
0.47993
preprocessing.ex
starcoder
defmodule Vapor do @moduledoc """ Vapor provides mechanisms for handling runtime configuration in your system. """ alias Vapor.{ Store, Watch } @type key :: String.t() | list() @type type :: :string | :int | :float | :bool @type value :: String.t() | integer | float | boolean @doc """ Fet...
lib/vapor.ex
0.881742
0.426202
vapor.ex
starcoder
defmodule Sitemapper do @moduledoc """ Sitemapper is an Elixir library for generating [XML Sitemaps](https://www.sitemaps.org). It's designed to generate large sitemaps while maintaining a low memory profile. It can persist sitemaps to Amazon S3, disk or any other adapter you wish to write. """ alias Sit...
lib/sitemapper.ex
0.852214
0.520801
sitemapper.ex
starcoder
defmodule Ecto.Associations.Assoc do @moduledoc """ This module provides the assoc selector merger and utilities around it. """ alias Ecto.Query.QueryExpr alias Ecto.Query.Util @doc """ Transforms a result set based on the assoc selector, loading the associations onto their parent model. See `Ecto.Que...
lib/ecto/associations/assoc.ex
0.775052
0.600159
assoc.ex
starcoder
defmodule Game do @moduledoc """ Intcode Arcade Cabinet """ defstruct tiles: %{}, score: 0, output: [], window: nil def print({map, score}) do pts = Map.keys(map) {min_x, max_x} = Enum.map(pts, fn {x, _y} -> x end) |> Enum.min_max() {min_y, max_y} = Enum.map(pts, fn {_x, y} -> y end) |> Enum.mi...
apps/day13/lib/game.ex
0.605566
0.504089
game.ex
starcoder
defmodule Datix.Date do @moduledoc """ A `Date` parser using `Calendar.strftime` format string. """ @doc """ Parses a date string according to the given `format`. See the `Calendar.strftime` documentation for how to specify a format-string. ## Options * `:calendar` - the calendar to build the `Dat...
lib/datix/date.ex
0.925255
0.906073
date.ex
starcoder
defmodule CCSP.Chapter2.DnaSearch do @moduledoc """ Corresponds to CCSP in Python, Section 2.1, titled "DNA Search" """ @type nucleotide :: non_neg_integer # should only ever have exactly 3 elements # note that we do not use a tuple like CCSPiP as lists are better suited @type codon :: list(nucleotide) ...
lib/ccsp/chapter2/dna_search.ex
0.772316
0.638018
dna_search.ex
starcoder
defmodule Extractly do alias Extractly.DoNotEdit import Extractly.Helpers @moduledoc """ Provide easy access to information inside the templates rendered by `mix xtra` """ @doc """ Emits a comment including a message not to edit the created file, as it will be recreated from this template. It ...
lib/extractly.ex
0.804675
0.601477
extractly.ex
starcoder
defmodule Movielist.Reports do @moduledoc """ The Reports context. """ import Ecto.Query, warn: false alias Movielist.Repo alias Movielist.Admin alias Movielist.Admin.Movie alias Movielist.Admin.Rating def increment(num) do num + 1 end def calculate_percent_of_ratings(total, ratings_count)...
apps/movielist/lib/movielist/admin/reports.ex
0.784526
0.447823
reports.ex
starcoder
defmodule Plug.Session do @moduledoc """ A plug to handle session cookies and session stores. The session is accessed via functions on `Plug.Conn`. Cookies and session have to be fetched with `Plug.Conn.fetch_session/1` before the session can be accessed. ## Session stores See `Plug.Session.Store` for ...
lib/plug/session.ex
0.772273
0.496948
session.ex
starcoder
defmodule TuringMachine do @moduledoc """ Turing machine simulator. """ alias TuringMachine.Program @type state :: any @type value :: any @type t :: %__MODULE__{ initial_tape: (integer -> value), tape_hash: %{optional(integer) => value}, position: integer, state: state,...
lib/turing_machine.ex
0.843975
0.90355
turing_machine.ex
starcoder
% Basic unit test structure for Elixir. % % ## Example % % A basic setup for ExUnit is shown below: % % % File: assertion_test.exs % % % 1) If you wish to configure ExUnit. See a list of options below. % ExUnit.configure % % % 2) Next we create a new TestCase and add ExUnit::Case to it % module Asse...
lib/ex_unit.ex
0.745769
0.582966
ex_unit.ex
starcoder