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 Quantity.Math do @moduledoc """ Functions for doing math with Quantities """ import Kernel, except: [div: 2] @doc """ Add two Quantities, keeping the unit iex> add(~Q[1.34 MWh], ~Q[3.49 MWh]) {:ok, ~Q[4.83 MWh]} iex> add(~Q[1.234567 days], ~Q[3.5 days]) {:ok, ~Q[4.734567 days]} iex>...
lib/quantity/math.ex
0.877831
0.585812
math.ex
starcoder
defmodule Mix.Tasks.ExampleFiles do @dialyzer :no_undefined_callbacks use Mix.Task @moduledoc """ Lists example files in your project and shows the status of each. This task traverses the current working directory, looking for files that are intended to serve as illustrative samples of files provided by a...
lib/mix/tasks/example_files.ex
0.694717
0.869382
example_files.ex
starcoder
defmodule PacketAnalyzer do @moduledoc """ PacketAnalyzer keeps the contexts that define your domain and business logic. Contexts are also responsible for managing your data, regardless if it comes from the database, an external API or others. """ @doc """ 入力されたデータを返します. ## パラメータ - input_data: ...
packet_analyzer/lib/packet_analyzer.ex
0.589362
0.53443
packet_analyzer.ex
starcoder
defmodule Ririsu.Interpreter do @moduledoc """ The evaluator for the Ririsu language. """ @doc """ Runs a Ririsu source code. The runner takes a character list, and an initial state, and it returns a new state. The state is a Tuple in the form: { Mode :: Number, Environment :: Dict, Stack :: L...
lib/interpreter.ex
0.586641
0.654853
interpreter.ex
starcoder
defmodule Stripe.Cards do @moduledoc """ Functions for working with cards at Stripe. Through this API you can: * create a card, * update a card, * get a card, * delete a card, * delete all cards, * list cards, * list all cards, * count cards. All requests require `owner_type` and...
lib/stripe/cards.ex
0.917001
0.493836
cards.ex
starcoder
defmodule TypeCheck.TypeError.Formatter do @moduledoc """ Behaviour to format your own type errors """ @typedoc """ A `problem tuple` contains four fields: 1. the module of the type for which a check did not pass 2. an atom describing the exact error; for many types there are multiple checks 3. a...
lib/type_check/type_error/formatter.ex
0.817356
0.552691
formatter.ex
starcoder
defmodule Mnemonex.Config do alias TheFuzz.Phonetic.MetaphoneAlgorithm, as: MPA @moduledoc """ word list configuration state """ defstruct words: {}, word_indices: %{}, words_version: nil, metaphone_map: %{}, as_list: false, total_words: nil, ...
lib/mnemonex/config.ex
0.654232
0.426202
config.ex
starcoder
defmodule Data.Parser.KV do @moduledoc """ Creates parsers that accept KeyValue-style `Enum`s as input. In particular, KV parsers work with: - maps (e.g. `%{"hello" => "world"}`) - `Keyword.t`s (e.g. `[hello: "world"]`) - Lists of pairs (e.g. `[{"hello", "world"}]`) KV parsers are higher-order parsers,...
lib/data/parser/kv.ex
0.933287
0.934455
kv.ex
starcoder
defmodule Grizzly.ZWave.Commands.ExtendedNodeAddStatus do @moduledoc """ ExtendedNodeAddStatus This command is used to report the result of a node inclusion of an a node with an extended node id, normally a long range node. Params: * `:seq_number` - the sequence number of the inclusion command * `:...
lib/grizzly/zwave/commands/extended_node_add_status.ex
0.7413
0.527621
extended_node_add_status.ex
starcoder
defmodule Advent2019Web.Day05Controller do use Advent2019Web, :controller @doc """ Given a list of operations, a position, an input list and the history of previous operations and output, runs the program until completion. It returns the final position, list of outputs and history of operations including ...
lib/advent2019_web/controllers/day05_controller.ex
0.614741
0.470615
day05_controller.ex
starcoder
defmodule Recurly.XML.Schema do @moduledoc """ Module responsible for handling schemas of the resources. Schemas are used for building the resource structs as well as marshalling and unmarshalling the xml. The syntax for defining schemas is similar to Ecto: ``` defmodule MyResource do use Recurly.XML.S...
lib/recurly/xml/schema.ex
0.645679
0.756605
schema.ex
starcoder
defmodule CommerceCure.Year do @moduledoc """ Assumes years are from 1000 - 9999 """ alias __MODULE__ @type year :: integer @type t :: %Year{year: year} @enforce_keys [:year] defstruct [:year] @doc """ iex> Year.new(17) {:ok, %Year{year: 2017}} iex> Year.new("114") {:ok, %Year{year: 2114}} ...
lib/commerce_cure/data_type/year.ex
0.721547
0.469155
year.ex
starcoder
defmodule Trike.Proxy do @moduledoc """ A Ranch protocol that receives TCP packets, extracts OCS messages from them, generates a CloudEvent for each message, and forwards the event to Amazon Kinesis. """ use GenServer require Logger alias ExAws.Kinesis alias Trike.CloudEvent @behaviour :ranch_proto...
lib/trike/proxy.ex
0.792344
0.425605
proxy.ex
starcoder
defmodule Chex.Move do @moduledoc false alias Chex.{Piece, Square} alias Chex.Move.{SAN, Smith} @files ?a..?h @file_atoms [:a, :b, :c, :d, :e, :f, :g, :h] @ranks ?1..?8 @rank_ints 1..8 @piece_atoms [:rook, :knight, :bishop, :queen, :king] defstruct destination: nil, origin: nil, ...
lib/chex/move.ex
0.785638
0.552902
move.ex
starcoder
defmodule Oracledbex do require Logger @moduledoc """ Interface for interacting with Oracle Database via an ODBC driver for Elixir. It implements `DBConnection` behaviour, using `:odbc` to connect to the system's ODBC driver. Requires Oracle Database ODBC driver, see [ODBCREADME](readme.html) for installat...
lib/oracledbex.ex
0.926868
0.524029
oracledbex.ex
starcoder
defmodule Fxnk.Math do @moduledoc """ `Fxnk.Math` are functions dealing with math. """ import Fxnk.Functions, only: [curry: 1] @doc """ Find the maximum of a list. ## Example iex> Fxnk.Math.max([1337, 42, 23]) 1337 """ @spec max([any(), ...]) :: any() def max([hd | _] = args) do fi...
lib/fxnk/Math.ex
0.882826
0.494324
Math.ex
starcoder
defmodule DiscoveryApi.Data.Model do @moduledoc """ utilities to persist and load discovery data models """ alias DiscoveryApi.Data.Persistence @behaviour Access @derive Jason.Encoder defstruct [ :accessLevel, :categories, :completeness, :conformsToUri, :contactEmail, :contactNam...
apps/discovery_api/lib/discovery_api/data/model.ex
0.812904
0.431045
model.ex
starcoder
defmodule Optimus.ColumnFormatter do @type align :: :left | :center | :right @type column_spec :: pos_integer | {pos_integer, align} @spec format([column_spec], [String.t()]) :: {:ok, [[String.t()]]} | {:error, String.t()} def format(column_specs, strings) do with :ok <- validate(column_specs, strings), do...
lib/optimus/column_formatter.ex
0.773302
0.725892
column_formatter.ex
starcoder
defmodule Driver 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, mo...
heis_driver/lib/heis_driver.ex
0.860999
0.705335
heis_driver.ex
starcoder
defmodule Intro do def smallest(n1, n2) when n1 < n2, do: n1 def smallest(_n1, n2), do: n2 def smallest(n1, n2, n3, n4), do: smallest(smallest(n1, n2), smallest(n3, n4)) def largest(n1, n2) when n1 > n2, do: n1 def largest(_n1, n2), do: n2 def largest(n1, n2, n3), do: largest(largest(n1, n2), n3) def...
lib/intro.ex
0.524882
0.721007
intro.ex
starcoder
defmodule Timex.Date do if Version.compare(System.version(), "1.11.0") == :lt do @doc false def new!(year, month, day, calendar \\ Calendar.ISO) do case Date.new(year, month, day, calendar) do {:ok, value} -> value {:error, reason} -> raise ArgumentError, "cannot bui...
lib/timex/date.ex
0.776326
0.689077
date.ex
starcoder
defmodule AWS.AppConfig do @moduledoc """ AWS AppConfig Use AWS AppConfig, a capability of AWS Systems Manager, to create, manage, and quickly deploy application configurations. AppConfig supports controlled deployments to applications of any size and includes built-in validation checks and monitoring. Y...
lib/aws/generated/app_config.ex
0.883274
0.463019
app_config.ex
starcoder
defmodule Oban.Config do @moduledoc """ The Config struct validates and encapsulates Oban instance state. Options passed to `Oban.start_link/1` are validated and stored in a config struct. Internal modules and plugins are always passed the config with a `:conf` key. """ @type t :: %__MODULE__{ d...
lib/oban/config.ex
0.822082
0.432363
config.ex
starcoder
require Utils defmodule D1 do @moduledoc """ --- Day 1: Report Repair --- After saving Christmas five years in a row, you've decided to take a vacation at a nice resort on a tropical island. Surely, Christmas will go on without you. The tropical island has its own currency and is entirely cash-only. The gold ...
lib/days/01.ex
0.709523
0.569494
01.ex
starcoder
defmodule State.Metadata do @moduledoc """ Holds metadata for State data. Currently, the only metadata being stored is when a service last received new data as well as the current feed version. """ use GenServer @table_name :state_metadata def start_link(opts \\ []) do GenServer.start_link(__MOD...
apps/state/lib/state/metadata.ex
0.843815
0.576184
metadata.ex
starcoder
defmodule Type.Function.Var do @moduledoc """ a special container type indicating that the function has a type dependency. ### Example: The following typespec: ```elixir @spec identity(x) :: x when x: var ``` generates the following typespec: ```elixir %Type.Function{ params: [%Type.Functio...
lib/type/function.var.ex
0.932323
0.940681
function.var.ex
starcoder
defmodule Ueberauth.Strategy.Meli do @moduledoc """ Implements an ÜeberauthMeli strategy for authentication with mercadolibre.com When configuring the strategy in the Üeberauth providers, you can specify some defaults. * `default_scope` - The scope to request by default from mercadolibre (permissions). Default ...
lib/ueberauth/strategy/meli.ex
0.693784
0.648647
meli.ex
starcoder
defmodule AstraeaVirgo.Cache.Utils.Hash do @moduledoc """ Interface for Cache Generic Hash - User - Judgement Generate `exist?/1` and `show/1` operation for Cache Note: Callback functions can be private """ @doc """ Cache Show Key """ @callback get_show_key(id :: String.t()) :: String.t() ...
lib/virgo/cache/utils/hash.ex
0.885526
0.643077
hash.ex
starcoder
defmodule WatchFaces.Faces do @moduledoc """ The Faces context. """ import Ecto.Query, warn: false alias WatchFaces.Repo alias WatchFaces.Faces.Face @doc """ Returns the list of faces. ## Examples iex> list_faces() [%Face{}, ...] """ def list_faces do Repo.all(Face) |> Re...
lib/watch_faces/faces.ex
0.8415
0.406803
faces.ex
starcoder
defmodule Annex.Layer do @moduledoc """ The Annex.Layer is the module that defines types, callbacks, and helper for Layers. By implementing the Layer behaviour a struct/model can be used along side other Layers to compose the layers of a deep neural network. """ alias Annex.{ Data, Layer.Backprop,...
lib/annex/layer.ex
0.823364
0.612686
layer.ex
starcoder
import Kernel, except: [apply: 2] defmodule Ecto.Query.Builder.Join do @moduledoc false alias Ecto.Query.Builder alias Ecto.Query.{JoinExpr, QueryExpr} @doc """ Escapes a join expression (not including the `on` expression). It returns a tuple containing the binds, the on expression (if available) and ...
lib/ecto/query/builder/join.ex
0.827689
0.426322
join.ex
starcoder
defmodule UrbitEx.Channel do @moduledoc """ GenServer module to open Eyre channels. Defines an UrbitEx.Channel struct to keep track of the channel state. Elixir processes can subscribe to channels to consume the events their propagate, either raw Eyre events or Eyre events parsed by UrbitEx.Reducer """...
lib/types/channel.ex
0.639849
0.465509
channel.ex
starcoder
defmodule AWS.RedshiftData do @moduledoc """ You can use the Amazon Redshift Data API to run queries on Amazon Redshift tables. You can run SQL statements, which are committed if the statement succeeds. For more information about the Amazon Redshift Data API, see [Using the Amazon Redshift Data API](http...
lib/aws/generated/redshift_data.ex
0.880296
0.600511
redshift_data.ex
starcoder
defmodule Xlsxir do alias Xlsxir.{XlsxFile} use Application def start(_type, _args) do import Supervisor.Spec children = [ worker(Xlsxir.StateManager, []), ] opts = [strategy: :one_for_one, name: __MODULE__] Supervisor.start_link(children, opts) end @moduledoc """ Extracts and...
lib/xlsxir.ex
0.762954
0.648953
xlsxir.ex
starcoder
defmodule Pointers.Tables do @moduledoc """ A Global cache of Tables to be queried by their (Pointer) IDs, table names or Ecto Schema module names. Use of the Table Service requires: 1. You have run the migrations shipped with this library. 2. You have started `Pointers.Tables` before querying. 3. All O...
lib/tables.ex
0.825027
0.479686
tables.ex
starcoder
defmodule ZcashExplorerWeb.BlockView do use ZcashExplorerWeb, :view def mined_time(nil) do "Not yet mined" end def mined_time(timestamp) do abs = timestamp |> Timex.from_unix() |> Timex.format!("{ISOdate} {ISOtime}") rel = timestamp |> Timex.from_unix() |> Timex.format!("{relative}", :relative) ...
lib/zcash_explorer_web/views/block_view.ex
0.636579
0.414277
block_view.ex
starcoder
defmodule Jorb.Job do @moduledoc ~S""" Modules that `use Jorb.Job` can enqueue, read, and perform jobs. These modules must implement the `Jorb.Job` behaviour. In addition to the callbacks defined in `Jorb.Job`, these modules also export the `enqueue/2`, `work/1`, and `workers/1` functions. See the documen...
lib/jorb/job.ex
0.896027
0.429489
job.ex
starcoder
defmodule Benchmarks.Proto2.GoogleMessage2.Group1 do @moduledoc false use Protobuf, protoc_gen_elixir_version: "0.9.0-dev", syntax: :proto2 field :field11, 11, required: true, type: :float field :field26, 26, optional: true, type: :float field :field12, 12, optional: true, type: :string field :field13, 13,...
bench/lib/datasets/google_message2/benchmark_message2.pb.ex
0.609408
0.448849
benchmark_message2.pb.ex
starcoder
defmodule ExAws.S3.Crypto do @moduledoc """ `ExAws.S3.Crypto` provides [client-side encryption](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingClientSideEncryption.html) support for [Amazon S3](https://aws.amazon.com/s3/). It allows you to encrypt data before sending it to S3. This particular implementati...
lib/ex_aws_s3_crypto.ex
0.863147
0.54256
ex_aws_s3_crypto.ex
starcoder
defmodule Roadtrip.Garage.Vin do @moduledoc """ Provides utilities for working with (North American) VIN sequences. """ def length(), do: 17 def na_weights(), do: [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2] @doc """ Provides a value that can be used in `<input pattern=… />` HTML tags. """ ...
apps/roadtrip/lib/roadtrip/garage/vin.ex
0.926028
0.792544
vin.ex
starcoder
defmodule Ecto.Adapters.Postgres do @moduledoc """ Adapter module for PostgreSQL. It uses `postgrex` for communicating to the database and a connection pool, such as `poolboy`. ## Features * Full query support (including joins, preloads and associations) * Support for transactions * Support for...
lib/ecto/adapters/postgres.ex
0.783036
0.538073
postgres.ex
starcoder
Postgrex.Types.define(Plenario.PostgresTypes, [Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(), json: Jason) for type <- [Geo.Point, Geo.Polygon, Geo.LineString, Geo.MultiPoint, Geo.MultiPolygon, Geo.MultiLineString] do defimpl Phoenix.HTML.Safe, for: type, do: def to_iodata(geom), do: Geo.WKT.enco...
lib/plenario/postgres_extensions.ex
0.696887
0.517693
postgres_extensions.ex
starcoder
defmodule AWS.IoT do @moduledoc """ AWS IoT AWS IoT provides secure, bi-directional communication between Internet-connected devices (such as sensors, actuators, embedded devices, or smart appliances) and the AWS cloud. You can discover your custom IoT-Data endpoint to communicate with, configure rules fo...
lib/aws/iot.ex
0.782663
0.455986
iot.ex
starcoder
defmodule Money do @moduledoc """ Represents a Money type, inspired in [<NAME>'s Money Patter](https://martinfowler.com/eaaCatalog/money.html) """ defstruct [:amount, :currency] @number ~r/^[\+\-]?\d*\,?\d*\.?\d+(?:[\+\-]?\d+)?$/ @doc """ Creates a new `Money` type with amount and currency: Default cur...
lib/money/money.ex
0.934208
0.825765
money.ex
starcoder
defprotocol Realm.Semigroupoid do @moduledoc """ A semigroupoid describes some way of composing morphisms on between some collection of objects. ## Type Class An instance of `Realm.Semigroupoid` must define `Realm.Semigroupoid.compose/2`. Semigroupoid [compose/2] """ @doc """ Take two morphisms a...
lib/realm/semigroupoid.ex
0.826116
0.566678
semigroupoid.ex
starcoder
defmodule Sdr do @moduledoc """ SDR is an Elixir library for Sparse Distributed Representations """ defp factorial(n), do: factorial(n, 1) defp factorial(0, acc), do: acc defp factorial(n, acc) when n > 0, do: factorial(n - 1, acc * n) @doc """ Capacity of a SDR. ## Examples ```elixir iex...
lib/sdr.ex
0.799168
0.893216
sdr.ex
starcoder
defmodule Adventofcode.Day07HandyHaversacks do use Adventofcode alias __MODULE__.{Graph, Parser, Part1, Part2} def part_1(input) do input |> Parser.parse() |> Graph.new() |> Part1.solve() |> Enum.count() end def part_2(input) do input |> Parser.parse() |> Graph.new() |> ...
lib/day_07_handy_haversacks.ex
0.716715
0.460895
day_07_handy_haversacks.ex
starcoder
defmodule XtbClient.Messages.TradeTransaction do defmodule Command do alias XtbClient.Messages.{Operation, TradeType} @moduledoc """ Info about command to trade the transaction. ## Parameters - `cmd` operation code, see `XtbClient.Messages.Operation`, - `customComment` the value the cust...
lib/xtb_client/messages/trade_transaction.ex
0.879361
0.477371
trade_transaction.ex
starcoder
defmodule FalconPlusApi.Api.Host do alias Maxwell.Conn alias FalconPlusApi.{Util, Sig, Api} @doc """ * [Session](#/authentication) Required ### Request ``` { "ids": [1,2,3,4], "maintain_begin": 1497951907, "maintain_end": 1497951907 } ``` or ``` { ...
lib/falcon_plus_api/api/host.ex
0.533397
0.738763
host.ex
starcoder
defmodule SupabaseSurface.Plugs.Session do @moduledoc """ A plug to handle access and refresh tokens. In case `access_token` and `refresh_token` are not available in the session, it redirects to a `login_endpoint`. If the session already contains those tokens, it checks the expiration time of the access t...
lib/supabase_surface/plugs/session.ex
0.736495
0.400515
session.ex
starcoder
defmodule FusionDsl.Kernel do @moduledoc """ Kernel module of FusionDSL """ use FusionDsl.Impl alias FusionDsl.Runtime.Executor @r_json_vars ~r/\$([A-Za-z]{1}[A-Za-z0-9.\_]*)/ @functions [ :last_index_of, :regex_replace, :create_array, :json_decode, :json_encode, :regex_match, ...
lib/fusion_dsl/kernel.ex
0.830732
0.61927
kernel.ex
starcoder
defmodule Hawk.Server do @moduledoc """ This module provides functions to create response headers and authenticate request. """ alias Hawk.{Crypto, Header, Now} @algorithms Crypto.algorithms() @doc """ Authenticate a hawk request ## Options * `:timestamp_skew_sec` Number of seconds of permitted cl...
lib/hawk/server.ex
0.919971
0.515437
server.ex
starcoder
defmodule Unicode.Utils do @moduledoc false @doc """ Returns a map of the Unicode codepoints with the `script` name as the key and a list of codepoint ranges as the values. """ @scripts_path Path.join(Unicode.data_dir(), "scripts.txt") @external_resource @scripts_path def scripts do parse_file(@scr...
lib/utils.ex
0.887339
0.517144
utils.ex
starcoder
defmodule GatherSubmissions.DOMjudge do @moduledoc """ This module defines a function `gather_submissions` that uses the DOMjudge API to obtain the submissions of a given problem. """ alias GatherSubmissions.DOMjudge.API alias GatherSubmissions.DOMjudge.Connection alias GatherSubmissions.Submission ali...
lib/domjudge/domjudge.ex
0.846451
0.469155
domjudge.ex
starcoder
defmodule ExMpesa.C2B do @moduledoc """ C2B M-Pesa API enables Paybill and Buy Goods merchants to integrate to M-Pesa and receive real time payments notifications. """ import ExMpesa.MpesaBase @doc """ There are two URLs required for RegisterURL API: Validation URL and Confirmation URL. For the two URLs...
lib/ex_mpesa/c2b.ex
0.825625
0.535949
c2b.ex
starcoder
defmodule Kelvin.InOrderSubscription do @moduledoc """ A subscription producer which processes events in order as they appear in the EventStoreDB ## Options * `:name` - (optional) the GenServer name for this producer * `:stream_name` - (required) the stream name to which to subscribe * `:connection` - (...
lib/kelvin/in_order_subscription.ex
0.800887
0.59193
in_order_subscription.ex
starcoder
defmodule JsonSchema.Resolver do @moduledoc """ Module containing functions for resolving types. Main function being the `resolve_type` function. """ alias JsonSchema.{Parser, Types} alias Parser.{ErrorUtil, ParserError} alias Types.{PrimitiveType, SchemaDefinition, TypeReference} @doc """ Resolves ...
lib/resolver.ex
0.819171
0.435421
resolver.ex
starcoder
defmodule Combine.Parsers.Binary do @moduledoc """ This module defines common raw binary parsers, i.e. bits, bytes, uint, etc. To use them, just add `import Combine.Parsers.Binary` to your module, or reference them directly. All of these parsers operate on, and return bitstrings as their results. """ ali...
deps/combine/lib/combine/parsers/binary.ex
0.783326
0.519948
binary.ex
starcoder
defmodule Omise.Customer do @moduledoc ~S""" Provides Customer API interfaces. <https://www.omise.co/customers-api> """ use Omise.HTTPClient, endpoint: "customers" defstruct object: "customer", id: nil, livemode: nil, location: nil, default_card: nil, ...
lib/omise/customer.ex
0.899152
0.420183
customer.ex
starcoder
defprotocol Timex.Convertable do @moduledoc """ This protocol is used to convert between various common datetime formats. """ @doc """ Converts a date/time representation to an Erlang datetime tuple + timezone tuple ## Examples: iex> use Timex ...> datetime = Timex.datetime({{2015, 3, 5}, {12...
lib/convert/convertable.ex
0.911362
0.670425
convertable.ex
starcoder
defmodule Irateburgers.Aggregate do @moduledoc """ Defines common helpers for working with Aggregates. Aggregates are represented as `Agent` processes holding some state. The state must at least have `id` `:binary_id` and `version` `:integer` keys. """ alias Irateburgers.{Command, CommandProtocol, Event, ...
lib/aggregate.ex
0.835584
0.431704
aggregate.ex
starcoder
defmodule Granulix.Util do alias Granulix.Math @doc """ Make two channels muliplied with pos and 1.0 - pos respectively. pos shall be between 0.0 and 1.0. """ @spec pan(x :: Granulix.frames(), pos :: float()) :: list(Granulix.frames) def pan(x, pos) when is_binary(x) do posn = 0.5 * pos + 0.5 [Ma...
lib/granulix/util.ex
0.778649
0.469277
util.ex
starcoder
defmodule Flex.Decoder do @moduledoc """ Decoder decodes the JSON-Cadence Data Interchange Format into a simple JSON format. """ def decode(%{"type" => "Void"}) do nil end def decode(%{"type" => "Optional", "value" => value}) do case value do nil -> nil value -> decode(value) end ...
lib/flex/decoder.ex
0.61231
0.571677
decoder.ex
starcoder
defmodule Salvadanaio.Import.Fineco do @moduledoc """ This module creates movements for a Fineco account, reading them from the XLSX file exported from the Fineco movements web page. The original exported file is a XLS file, which must be converted to XSLX before running this script. The module looks for th...
backend/lib/salvadanaio/import/fineco.ex
0.53048
0.403214
fineco.ex
starcoder
defmodule Durango.Dsl.Function do @moduledoc """ Listed at https://docs.arangodb.com/3.3/AQL/Functions/ This module parses and renders functions. """ def validate!({_name, low..high}, args) when length(args) >= low and length(args) <= high do nil end def validate!({name, count}, args) when is_intege...
lib/dsl/function.ex
0.556159
0.461927
function.ex
starcoder
defmodule Wordza.GameBoard do @moduledoc """ This is our Wordza GameBoard The configuration of all board positions. The configuration of all current played tiles on the board. NOTE I have chosen to represent the board as a map vs. 2 dim list because elixir... http://blog.danielberkompas.com/2016/04/23/mu...
lib/game/game_board.ex
0.76934
0.540318
game_board.ex
starcoder
defmodule BlueHeron.HCI.Command.ControllerAndBaseband.Reset do use BlueHeron.HCI.Command.ControllerAndBaseband, ocf: 0x0003 @moduledoc """ Reset the baseband * OGF: `#{inspect(@ogf, base: :hex)}` * OCF: `#{inspect(@ocf, base: :hex)}` * Opcode: `#{inspect(@opcode)}` Bluetooth Spec v5.2, Vol 4, Part E, s...
lib/blue_heron/hci/commands/controller_and_baseband/reset.ex
0.803135
0.530784
reset.ex
starcoder
defmodule Vivid.Polygon do alias Vivid.{Polygon, Point, Line} defstruct vertices: [], fill: false require Integer @moduledoc ~S""" Describes a Polygon as a series of vertices. Polygon implements both the `Enumerable` and `Collectable` protocols. ## Example iex> use Vivid ...> 0..3 .....
lib/vivid/polygon.ex
0.926935
0.61477
polygon.ex
starcoder
defmodule Alerts.Alert do @moduledoc "Module for representation of an alert, including information such as description, severity or additional URL to learn more" alias Alerts.Priority alias Alerts.InformedEntitySet, as: IESet defstruct id: "", header: "", informed_entity: %IESet{}, ...
apps/alerts/lib/alert.ex
0.812049
0.406096
alert.ex
starcoder
defmodule Univrse do @moduledoc """ ![Univrse](https://github.com/libitx/univrse/raw/master/media/poster.png) ![License](https://img.shields.io/github/license/libitx/univrse?color=informational) Univrse is a universal schema for serializing data objects, secured with signatures and encryption. * **Serial...
lib/univrse.ex
0.876456
0.915545
univrse.ex
starcoder
defprotocol RDF.Term do @moduledoc """ Shared behaviour for all RDF terms. A `RDF.Term` is anything which can be an element of RDF statements of a RDF graph: - `RDF.IRI`s - `RDF.BlankNode`s - `RDF.Literal`s see <https://www.w3.org/TR/sparql11-query/#defn_RDFTerm> """ @type t :: RDF.IRI.t() | RDF.B...
lib/rdf/term.ex
0.930844
0.741393
term.ex
starcoder
defmodule K8s.Client.Runner.Base do @moduledoc """ Base HTTP processor for `K8s.Client` """ @type result_t :: {:ok, map() | reference()} | {:error, K8s.Middleware.Error.t()} | {:error, :connection_not_registered} | {:error, :missing_required_param} | {:error, b...
lib/k8s/client/runner/base.ex
0.901902
0.456894
base.ex
starcoder
defmodule Translecto.Schema.Translatable do import Ecto.Schema @moduledoc """ Reference a translatable field in the schema. This module coincides with the migration function `Translecto.Migration.translate/2`. To correctly use this module a schema should call `use Translecto.Schema.Translatab...
lib/translecto/schema/translatable.ex
0.860384
0.453685
translatable.ex
starcoder
defmodule Gyx.Core.Env do @moduledoc """ This behaviour is intended to be followed for any `Environment` implementation The most critical function to be exposed is `step/1` , which serves as a direct bridge between the environment and any agent. Here, an important design question to address is the fundamenta...
lib/core/env.ex
0.895657
0.696926
env.ex
starcoder
defmodule Gorpo do @moduledoc """ An OTP application that announce services on consul. After a successful start `Gorpo.Announce` process will be running. Unconfigured, it assumes consul is running on localhost:8500 requiring no ACL and no services are announced. Optionally you may provide services that get...
lib/gorpo.ex
0.69946
0.534127
gorpo.ex
starcoder
defmodule Manic.Multi do @moduledoc """ Module for encapsulating multiple miner Merchant API clients. """ alias Manic.Miner defstruct miners: [], operation: nil, yield: :any, timeout: 5_000 @typedoc "Bitcoin multi miner API client" @type t :: %__MODULE__{ miners...
lib/manic/multi.ex
0.803251
0.50415
multi.ex
starcoder
defmodule Talib.CMA do @moduledoc ~S""" Defines a Cumulative Moving Average. ## History Version: 1.0 Source: https://qkdb.wordpress.com/tag/cumulative-moving-average/ Audited by: | Name | Title | | :----------- | :---------------- | | | | ""...
lib/talib/cma.ex
0.910759
0.649766
cma.ex
starcoder
defmodule AWS.LexRuntime do @moduledoc """ Amazon Lex provides both build and runtime endpoints. Each endpoint provides a set of operations (API). Your application uses the runtime API to understand user utterances (user input text or voice). For example, suppose user says "I want pizza", your application se...
lib/aws/lex_runtime.ex
0.870687
0.536738
lex_runtime.ex
starcoder
defmodule Retro.Phoenix.HTML.SVG do @moduledoc """ View helpers for rendering inline SVG. > The core code is borrowed from [nikkomiu/phoenix_inline_svg](https://github.com/nikkomiu/phoenix_inline_svg) > whose author has been gone for a long time. ## Import Helpers Add the following to the quoted `view` i...
lib/retro/phoenix_html/svg.ex
0.750004
0.915318
svg.ex
starcoder
defmodule Day14 do @moduledoc """ Advent of Code 2019 Day 14: Space Stoichiometry """ alias Day14.{Part1, Part2} def get_reactions() do Path.join(__DIR__, "inputs/day14.txt") |> File.open!() |> IO.stream(:line) |> parse_reactions() end def parse_reactions(lines) do lines |> St...
lib/day14.ex
0.786623
0.61819
day14.ex
starcoder
defmodule Gim.Rdf do @moduledoc """ Terse RDF Triple Language (Turtle) import and export for Gim. """ # Import Terse RDF Triple Language (Turtle) # "1million.rdf.gz" |> File.stream!([:compressed]) |> Gim.Rdf.read_rdf() @doc """ Read Terse RDF Triple Language (Turtle) format from a stream. `pfun` is an...
lib/gim/rdf.ex
0.688992
0.515925
rdf.ex
starcoder
defmodule Caravan do @moduledoc """ Tools for running Distributed Elixir/Erlang with Nomad and Consul # Caravan The built-in Erlang distribution mechanisms are prefaced on using the Erlang Port Mapper Daemon(EPMD), a process that is started with the VM and communicates with remote EPMD instances to determ...
lib/caravan.ex
0.846292
0.876264
caravan.ex
starcoder
defmodule EctoLtree.Functions do @moduledoc """ This module exposes the `ltree` functions. For more information see the [PostgreSQL documentation](https://www.postgresql.org/docs/current/static/ltree.html#LTREE-FUNC-TABLE). """ @doc """ subpath of `ltree` from position start to position end-1 (counting fro...
lib/ecto_ltree/functions.ex
0.814274
0.747524
functions.ex
starcoder
defmodule Day4 do def run(lines) do with input = parse_input(lines), part1 = Enum.count(input, &part1_valid/1), part2 = Enum.count(input, &part2_valid/1) do "part1: #{part1} part2: #{part2}" end end def part1_valid(passport) do case passport do %{byr: _, iyr: _, eyr: _...
elixir_advent/lib/day4.ex
0.617282
0.40589
day4.ex
starcoder
defmodule EarmarkParser.Block do @moduledoc false defmodule Heading do @moduledoc false defstruct lnb: 0, attrs: nil, content: nil, level: nil end defmodule Ruler do @moduledoc false defstruct lnb: 0, attrs: nil, type: nil end defmodule BlockQuote do @moduledoc false defstruct lnb:...
lib/earmark_parser/block.ex
0.591369
0.427217
block.ex
starcoder
defmodule Ash.EmbeddableType do @moduledoc false @embedded_resource_array_constraints [ sort: [ type: :any, doc: """ A sort to be applied when casting the data. Only relevant for a type of {:array, `EmbeddedResource}` The sort is not applied when reading the data, so if the sort...
lib/ash/embeddable_type.ex
0.811265
0.404919
embeddable_type.ex
starcoder
defmodule Jeff.Command do @moduledoc """ Commands are sent from an ACU to a PD | Code | Name | Description | Data Type | |------|--------------|---------------------------------------|-------------------------| | 0x60 | POLL | Poll ...
lib/jeff/command.ex
0.749821
0.625266
command.ex
starcoder
defmodule FFmpex do @moduledoc """ Create and execute ffmpeg CLI commands. The API is a builder, building up the list of options per-file, per-stream(-per-file), and globally. Note that adding options is backwards from using the ffmpeg CLI; when using ffmpeg CLI, you specify the options before each file...
lib/ffmpex.ex
0.823719
0.479686
ffmpex.ex
starcoder
defmodule BSV.BlockHeader do @moduledoc """ A block header is an 80 byte packet of information providing a summary of the `t:BSV.Block.t/0`. Contained within the block header is a Merkle root - the result of hashing all of the transactions contained in the block into a tree-like structure known as a Merkle...
lib/bsv/block_header.ex
0.897022
0.783575
block_header.ex
starcoder
defmodule RemoteIp.Headers do @moduledoc """ Entry point for parsing any type of forwarding header. """ require Logger @doc """ Selects the appropriate headers and parses IPs out of them. * `headers` - The entire list of the `Plug.Conn` `req_headers` * `allowed` - The list of headers `RemoteIp` is co...
lib/remote_ip/headers.ex
0.767864
0.445107
headers.ex
starcoder
if Code.ensure_loaded?(Plug) do defmodule Guardian.Plug.Pipeline do @moduledoc """ Helps to build plug pipelines for use with Guardian and associated plugs. All Guardian provided plugs have a number of features. 1. They take a `:key` option to know where to store information in the session and conne...
lib/guardian/plug/pipeline.ex
0.77081
0.818556
pipeline.ex
starcoder
defmodule Numy.Float do @moduledoc """ Floating point number utilities. """ @spec from_number(number) :: float def from_number(n) do n / 1 # idiomatic way to convert a number to float end @spec sign(number) :: -1 | 0 | 1 def sign(0), do: 0 def sign(0.0), do: 0 def sign(x) when x < 0, do: -1 ...
lib/float.ex
0.860633
0.648939
float.ex
starcoder
defmodule Statisaur.Combinatorics do @moduledoc """ Contains functions for analyzing finite descrete structures. """ @doc ~S""" Finds the factorial of a given non-negative integer. The factorial of a non-negative integer n, is the product of all positive integers less than or equal to n. The value of fa...
lib/statisaur/combinatorics.ex
0.930592
0.849097
combinatorics.ex
starcoder
defmodule Akin.Helpers.InitialsComparison do @moduledoc """ Function specific to the comparison and matching of names. Returns matching names and metrics. """ import Akin.Util, only: [ngram_tokenize: 2] alias Akin.Corpus def similarity(%Corpus{} = left, %Corpus{} = right) do left_initials = initials(le...
lib/akin/algorithms/helpers/initials_comparison.ex
0.773644
0.696629
initials_comparison.ex
starcoder
defmodule CTE.Adapter.Memory do @moduledoc """ Basic implementation of the CTE, using the memory for persisting the models. Adapter provided as a convenient way of using CTE in tests or during the development """ use CTE.Adapter @doc false def descendants(pid, ancestor, opts) do GenServer.call(pid, {:d...
lib/cte/adapter/memory.ex
0.754373
0.448064
memory.ex
starcoder
defmodule Crawlie do @moduledoc """ The simple Elixir web crawler. """ require Logger alias Crawlie.Options alias Crawlie.Page alias Crawlie.Response alias Crawlie.Utils alias Crawlie.Stage.UrlManager alias Crawlie.Stats.Server, as: StatsServer @spec crawl(Stream.t, module, Keyword.t) :: Flow...
lib/crawlie.ex
0.845145
0.584064
crawlie.ex
starcoder
defprotocol Timex.Protocol do @moduledoc """ This protocol defines the API for functions which take a `Date`, `NaiveDateTime`, or `DateTime` as input. """ @fallback_to_any true alias Timex.Types @doc """ Convert a date/time value to a Julian calendar date number """ @spec to_julian(Types.valid_da...
lib/protocol.ex
0.940898
0.707089
protocol.ex
starcoder
defmodule Contex.LinePlot 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. Data are sorted by the x-value prior to plotting. The x c...
lib/chart/lineplot.ex
0.950652
0.987911
lineplot.ex
starcoder
defmodule FarmbotFirmware.GCODE.Decoder do @moduledoc false alias FarmbotFirmware.{GCODE, Param} @doc false @spec do_decode(binary(), [binary()]) :: {GCODE.kind(), GCODE.args()} def do_decode("R00", []), do: {:report_idle, []} def do_decode("R01", []), do: {:report_begin, []} def do_decode("R02", []), d...
farmbot_firmware/lib/farmbot_firmware/gcode/decoder.ex
0.731155
0.491151
decoder.ex
starcoder
defmodule AshAdmin.Resource do @field %Ash.Dsl.Entity{ describe: "Declare non-default behavior for a specific attribute", name: :field, schema: AshAdmin.Resource.Field.schema(), target: AshAdmin.Resource.Field, args: [:name] } @form %Ash.Dsl.Section{ describe: "Configure the appearance of...
lib/ash_admin/resource/resource.ex
0.701917
0.400134
resource.ex
starcoder