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 E24 do def maybe_move(location, path) do case MapSet.member?(path, location) do true -> [location] _ -> [] end end def adjacent_pairs(vertex, vertices) do [ %{x: vertex.pos.x - 1, y: vertex.pos.y}, %{x: vertex.pos.x + 1, y: vertex.pos.y}, %{x: vertex.pos.x, y:...
24/lib/e24.ex
0.5794
0.70369
e24.ex
starcoder
defmodule Vivid.Path do alias Vivid.{Path, Point, Line, Shape} defstruct vertices: [] @moduledoc ~S""" Describes a path as a series of vertices. Path implements both the `Enumerable` and `Collectable` protocols. ## Example iex> use Vivid ...> 0..3 ...> |> Stream.map(fn ...> i whe...
lib/vivid/path.ex
0.918063
0.414751
path.ex
starcoder
defmodule RDF.Vocabulary.Namespace do @moduledoc """ A RDF vocabulary as a `RDF.Namespace`. `RDF.Vocabulary.Namespace` modules represent a RDF vocabulary as a `RDF.Namespace`. They can be defined with the `defvocab/2` macro of this module. RDF.ex comes with predefined modules for some fundamental vocabulari...
lib/rdf/vocabulary_namespace.ex
0.836855
0.549641
vocabulary_namespace.ex
starcoder
defmodule Plug.Bunyan do @moduledoc """ A plug for logging JSON messages. This [Plug](https://github.com/elixir-lang/plug) wraps the standard [Elixir Logger](http://elixir-lang.org/docs/stable/logger/Logger.html) and automatically generates JSON log messages. All requests that are processed by your plug p...
lib/plug_bunyan.ex
0.867528
0.849971
plug_bunyan.ex
starcoder
defmodule Trash.Query do @moduledoc """ Provides query methods for working with records that implement `Trash`. Schemas should first include `Trash.Schema` and/or manually add the necessary fields for these to work. """ require Ecto.Query alias Ecto.Query alias Ecto.Queryable @doc """ Adds trasha...
lib/trash/query.ex
0.908056
0.568386
query.ex
starcoder
defmodule Screens.DupScreenData.Data do @moduledoc false alias Screens.Config.Dup def choose_alert([]), do: nil def choose_alert(alerts) do # Prioritize shuttle alerts when one exists; otherwise just choose the first in the list. Enum.find(alerts, hd(alerts), &(&1.effect == :shuttle)) end def in...
lib/screens/dup_screen_data/data.ex
0.584153
0.420391
data.ex
starcoder
defmodule AutoApi.DiagnosticsState do @moduledoc """ Keeps Diagnostics state engine_oil_temperature: Engine oil temperature in Celsius, whereas can be negative """ alias AutoApi.{CommonData, State, UnitType} use AutoApi.State, spec_file: "diagnostics.json" @type check_control_message :: %{ i...
lib/auto_api/states/diagnostics_state.ex
0.786787
0.424173
diagnostics_state.ex
starcoder
defmodule Timex.Parse.DateTime.Parser do @moduledoc """ This is the base plugin behavior for all Timex date/time string parsers. """ import Combine.Parsers.Base, only: [eof: 0, map: 2, pipe: 2] alias Timex.{Timezone, TimezoneInfo, AmbiguousDateTime, AmbiguousTimezoneInfo} alias Timex.Parse.ParseError ali...
lib/parse/datetime/parser.ex
0.912548
0.502869
parser.ex
starcoder
defmodule Scrabble do @moduledoc """ An Elixir version of the famous game """ def default_range do 7 end @doc """ The board template, i.e. top-left part of the game board """ def blank_board_template(range) do for i <- 0..range, j <- 0..range do [i, j] end end def make_triple...
lib/scrabble.ex
0.781456
0.688743
scrabble.ex
starcoder
defmodule SpandexOTLP.Conversion do @moduledoc false alias Spandex.Span alias SpandexOTLP.Opentelemetry.Proto.Trace.V1.{InstrumentationLibrarySpans, ResourceSpans} alias SpandexOTLP.Opentelemetry.Proto.Common.V1.{AnyValue, KeyValue} alias SpandexOTLP.Opentelemetry.Proto.Trace.V1.Span, as: OTLPSpan @resou...
lib/spandex_otlp/conversion.ex
0.671578
0.424382
conversion.ex
starcoder
defmodule Stargate.Receiver.Supervisor do @moduledoc """ Defines a supervisor for the `Stargate.Receiver` reader and consumer connections and the associated GenStage pipeline for processing and acknowledging messages received on the connection. The top-level `Stargate.Supervisor` passes the shared connection...
lib/stargate/receiver/supervisor.ex
0.786377
0.461684
supervisor.ex
starcoder
defmodule Estated.Property.Owner do @moduledoc "Current owner details taken from either the assessment." @moduledoc since: "0.2.0" defstruct [ :name, :formatted_street_address, :unit_type, :unit_number, :city, :state, :zip_code, :zip_plus_four_code, :owner_occupied ] @typ...
lib/estated/property/owner.ex
0.866331
0.466603
owner.ex
starcoder
defmodule Tesseract.Tree.R.Validation do alias Tesseract.Tree.R.Util alias Tesseract.Ext.MathExt # The rules for root being a leaf are a little bit different: # A leaf node can have between MIN and MAX entries, EXCEPT when # leaf node is also a root node. So we have to take care of that # exception by hav...
lib/tree/r/validation.ex
0.681833
0.438845
validation.ex
starcoder
defmodule Timeout do @moduledoc """ An module for manipulating configurable timeouts. Comes with the following features. * Randomizing within +/- of a given percent range * Backoffs with an optional maximum. * Timer management using the above configuration. ### Backoff Backoffs can be configured usi...
lib/timeout.ex
0.918306
0.655956
timeout.ex
starcoder
defmodule Cacherl do alias Cacherl.Cache alias Cacherl.Store @default_lease_time 60*60*24 @moduledoc """ The main APIs for the cache system. It provides an interface to manipulate the cache without knowing the inner working. """ @doc """ Inserts a {key, value} pair into the cache, setting an expiry if set. ...
lib/cacherl/cacherl.ex
0.556882
0.597344
cacherl.ex
starcoder
defmodule Crutches.Enum do @moduledoc ~s""" Convenience functions for enums. This module provides several convenience functions operating on enums. Simply call any function (with any options if applicable) to make use of it. """ @type t :: Enumerable.t @type element :: any @doc ~S""" Returns a copy...
lib/crutches/enum.ex
0.882003
0.478529
enum.ex
starcoder
defmodule RateLimiter do @moduledoc """ A high performance rate limiter implemented on top of erlang `:atomics` which uses only atomic hardware instructions without any software level locking. As a result RateLimiter is ~20x faster than `ExRated` and ~80x faster than `Hammer`. """ @ets_table Application.ge...
lib/rate_limiter.ex
0.748536
0.770465
rate_limiter.ex
starcoder
defmodule AWS.Comprehend do @moduledoc """ Amazon Comprehend is an AWS service for gaining insight into the content of documents. Use these actions to determine the topics contained in your documents, the topics they discuss, the predominant sentiment expressed in them, the predominant language used, and mor...
lib/aws/comprehend.ex
0.910097
0.635632
comprehend.ex
starcoder
defmodule MeterToLengthConverter do def convert(:feet, m) when is_number(m) and m >= 0, do: m * 3.28084 def convert(:inch, m) when is_number(m) and m >= 0, do: m * 39.3701 def convert(:yard, m) when is_number(m) and m >= 0, do: m * 1.09361 end div(10, 3) # 3 rem(10, 3) # 1 "Strings are binaries" |> is_binary ==...
learn/LittleBook/1.ex
0.565299
0.578805
1.ex
starcoder
defmodule Ash.Type.Enum do @moduledoc """ A type for abstracting enums into a single type. For example, you might have: ```elixir attribute :status, :atom, constraints: [:open, :closed] ``` But as that starts to spread around your system you may find that you want to centralize that logic. To do that,...
lib/ash/type/enum.ex
0.893704
0.856632
enum.ex
starcoder
defmodule Arrow.Compute.Comparison do alias Arrow.Array alias Arrow.Native def eq(%Array{} = left, %Array{} = right), do: Native.array_compute_eq(left, right) def neq(%Array{} = left, %Array{} = right), do: Native.array_compute_neq(left, right) def gt(%Array{} = left, %Array{} = right), do: Native.array_comp...
lib/arrow/compute/comparison.ex
0.776411
0.432663
comparison.ex
starcoder
defmodule Bittrex.Order do @moduledoc """ A Bittrex Order. """ alias StrawHat.Response @typedoc """ - `id`: unique ID of this order. - `market_name`: unique name of the market this order is being placed on. - `direction`: order direction. - `type`: order type. - `quantity`: quantity. - `limit`: ...
lib/bittrex/order.ex
0.864825
0.502014
order.ex
starcoder
defmodule ZipList do defstruct previous: [], current: nil, remaining: [] def from_list(list, index \\ 0) def from_list([], _), do: {:error, :empty_list} def from_list(list, index) when length(list) < index, do: {:error, :index_out_of_bounds} def from_list(list, index) when is_list(list) do previous = lis...
lib/ziplist.ex
0.627495
0.419648
ziplist.ex
starcoder
defmodule DsWrapper.Value do @moduledoc """ `GoogleApi.Datastore.V1.Model.Value` wrapper """ alias GoogleApi.Datastore.V1.Model.{ArrayValue, Entity, Key, LatLng, Value} @meta_filds [:excludeFromIndexes, :meaning] @doc """ Convert to a `GoogleApi.Datastore.V1.Model.Value`. ## Examples iex> DsW...
lib/ds_wrapper/value.ex
0.899905
0.41253
value.ex
starcoder
defmodule ClosedIntervals do @moduledoc """ A ClosedIntervals datastructure. `ClosedIntervals` represents a set of closed intervals and provides functions to retrieve the interval to which a given value belongs to. `ClosedIntervals` can handle arbitrary data, as long as it can be ordered in a sensible way. U...
lib/closed_intervals.ex
0.952717
0.90574
closed_intervals.ex
starcoder
defmodule Timex.Format.Time.Formatters.Humanized do @moduledoc """ Handles formatting timestamp values as human readable strings. For formatting timestamps as points in time rather than intervals, use `Timex.format` """ use Timex.Format.Time.Formatter alias Timex.Translator @minute 60 @hour @minute...
lib/format/time/formatters/humanized.ex
0.924159
0.443781
humanized.ex
starcoder
defmodule EQRCode.Alphanumeric do @doc """ Takes a string and encodes each pair of characters into an 11 bit binary. If the string has an odd number of characters the last character is encoded as a 6 bit binary. More info: https://www.thonky.com/qr-code-tutorial/alphanumeric-mode-encoding ## Examples ...
lib/eqrcode/alphanumeric.ex
0.78233
0.423458
alphanumeric.ex
starcoder
defmodule Day23.PacketQueue do @moduledoc """ A packet queue for a single Intcode computer in a network. The packet queue receives packet messages from a `Day23.Router` and queues them up so they can be provided to an Intcode computer upon request. The packet queue is the `t:Intcode.Computer.handler/0` for ...
aoc2019_elixir/apps/day23/lib/packet_queue.ex
0.845289
0.6991
packet_queue.ex
starcoder
defmodule Scenic.Primitive.Component do @moduledoc """ Add a child component to a graph. When a scene pushes a graph containing a Component to it's ViewPort, a new scene, containing the component, is created and added as a child to the scene that created it. Any events the new component creates are sent ...
lib/scenic/primitive/component.ex
0.883129
0.85555
component.ex
starcoder
defmodule XtbClient.Messages.TradeInfo do alias XtbClient.Messages.Operation @moduledoc """ Info about the trade that has happened. ## Parameters - `close_price` close price in base currency, - `close_time` `null` if order is not closed, - `closed` closed, - `operation` operation code, see `XtbClien...
lib/xtb_client/messages/trade_info.ex
0.842815
0.446736
trade_info.ex
starcoder
defmodule Infusionsoft.Caches.Companies do @moduledoc false # Manages the cache for companies. # The update task runs every 15 minutes, and gets the most recent list of # companies from Infusionsoft for every API token that's been used in # the app and is still valid. use GenServer alias Infusionsoft....
lib/infusionsoft/caches/companies.ex
0.727201
0.406096
companies.ex
starcoder
defmodule ExSync do require Logger alias ExSync.{Shadow, Edit, Storage} @moduledoc """ This module implements the main parts of the server-side flow of the Diff Sync algorithm. The main function here is [sync cycle](#sync_cycle/5), which does a full cycle given the object id, shadow, backup shadow, edi...
lib/ex_sync.ex
0.681409
0.419618
ex_sync.ex
starcoder
defmodule Magnet.Encoder do @moduledoc """ Encodes a `Magnet` struct to a Magnet URI. """ @spec encode(Magnet.t()) :: {:ok, String.t()} def encode(%Magnet{} = magnet) do data = magnet |> Map.from_struct() |> Map.to_list() |> Enum.reduce(%{}, &do_encode/2) |> Enum.map_join("&...
lib/magnet/encoder.ex
0.798226
0.418786
encoder.ex
starcoder
defmodule YEnc do @moduledoc ~S""" The Erlang yEnc decoder and encoder. yEnc is a binary-to-text encoding scheme for transferring binary files in messages on Usenet or via e-mail. It reduces the overhead over previous US-ASCII-based encoding methods by using an 8-bit encoding method. yEnc's overhead is oft...
lib/yEnc.ex
0.848847
0.528108
yEnc.ex
starcoder
defmodule Astarte.DataUpdaterPlant.DataUpdater.PayloadsDecoder do alias Astarte.Core.Interface @max_uncompressed_payload_size 10_485_760 @doc """ Decode a BSON payload a returns a tuple containing the decoded value, the timestamp and metadata. reception_timestamp is used if no timestamp has been sent with ...
lib/astarte_data_updater_plant/data_updater/payloads_decoder.ex
0.561936
0.409339
payloads_decoder.ex
starcoder
defimpl String.Chars, for: ExPcap.MagicNumber do @doc """ Returns a human readable representation of the magic number. """ @spec to_string(ExPcap.MagicNumber.t) :: String.t def to_string(magic_number) do """ magic number: 0x#{magic_number.magic |> Integer.to_string(16) |> String.downcase} ...
lib/expcap/magic_number.ex
0.850329
0.604428
magic_number.ex
starcoder
defmodule FloUI.Dropdown do @moduledoc """ ## Usage in SnapFramework Dropdown component that scrolls. You can pass two separate themes as options. one for the dropdown, and one for the scroll bar. Options ``` elixir theme: theme, scroll_bar: %{ show: true, show_buttons: true, theme: Scenic.P...
lib/dropdown/dropdown.ex
0.785432
0.699088
dropdown.ex
starcoder
defmodule Blazer do @moduledoc """ Blazer is a case parser for json keys. available case options: * `:camel` example: `camelCase` * `:pascal` example: `PascalCase` * `:snake` example: `snake_case` * `:upper` example: `UPPERCASE` * `:kebab` example: `kebab-case` * `:title` example: `Title Case` """ ...
lib/blazer.ex
0.899673
0.915091
blazer.ex
starcoder
defmodule AdventOfCode.Day13 do @moduledoc ~S""" [Advent Of Code day 13](https://adventofcode.com/2018/day/13). """ @type point :: {non_neg_integer, non_neg_integer} @type direction :: :up | :down | :left | :right @type cart :: {position :: point(), direction :: direction(), turns_sequence :: Stream.t()} ...
lib/advent_of_code/day_13.ex
0.74826
0.526586
day_13.ex
starcoder
import Kernel, except: [inspect: 2] defmodule Logger.Formatter do @moduledoc ~S""" Conveniences for formatting data for logs. This module allows developers to specify a string that serves as template for log messages, for example: $time $metadata[$level] $message\n Will print error messages as: ...
lib/logger/lib/logger/formatter.ex
0.810291
0.50354
formatter.ex
starcoder
defmodule Mock do @moduledoc """ Mock modules for testing purposes. Usually inside a unit test. Please see the README file on github for a tutorial ## Example defmodule MyTest do use ExUnit.Case import Mock test "get" do with_mock HTTPotion, [get: fn("ht...
lib/mock.ex
0.889628
0.68448
mock.ex
starcoder
defmodule Typo.PDF do @moduledoc """ PDF server public API. """ import Typo.Utils.Colour, only: [colour: 1, from_hex: 1] import Typo.Utils.Fmt, only: [n2s: 1] import Typo.Utils.Guards @k 4.0 * ((:math.sqrt(2) - 1.0) / 3.0) # appends binary directly onto the current PDF page stream. # should NOT be ...
lib/typo/pdf.ex
0.88127
0.595434
pdf.ex
starcoder
defmodule Phoenix.HTML.Tag do @moduledoc ~S""" Helpers related to producing HTML tags within templates. Note the examples in this module use `safe_to_string/1` imported from `Phoenix.HTML` for readability. """ import Phoenix.HTML @special_attributes ["data", "aria", "class"] @csrf_param "_csrf_token...
lib/phoenix_html/tag.ex
0.833833
0.427875
tag.ex
starcoder
defmodule Gim.Repo do @moduledoc """ Defines a repository. A repository maps to an underlying data store hold in-memory. When used, the repository expects the `:types` as option. The `:types` is a list of schema types to register. For example, the repository: defmodule Repo do use Gim.Repo,...
lib/gim/repo.ex
0.954063
0.58166
repo.ex
starcoder
defmodule Scenic.Primitive.Triangle do @moduledoc """ Draw a triangle on the screen. ## Data `{point_a, point_b, point_c}` The data for a line is a tuple containing three points. * `point_a` - position to start drawing from * `point_b` - position to draw to * `point_c` - position to draw to ## St...
lib/scenic/primitive/triangle.ex
0.924373
0.73841
triangle.ex
starcoder
defmodule Shadowsocks do @moduledoc """ The Shadowsocks. This module defines common apis to start,update,stop shadowsocks listeners. ### start a listener Shadowsocks.start(args) the `args` is a keyword list, fields: * `type` required `atom` - the connection type, `:client` or `:server` or custo...
lib/shadowsocks.ex
0.897983
0.529993
shadowsocks.ex
starcoder
defmodule Identicon do @moduledoc """ Documentation for Identicon. First three number from the sequence of character will be RGB. If the number in the cell of the grid is odd, we will show it as white. If the number is even, we will fill it. """ def main(input) do input |> hash_input |> pick...
19-02-02-The-Complete-Elixir-And-Phoenix-Bootcamp/04-IdenticonProject/identicon/lib/identicon.ex
0.936619
0.511595
identicon.ex
starcoder
defmodule Mongo.Session.ServerSession do @moduledoc """ This module represents the server-side session. There are three fields: * `last_use` - The timestamp for the last use of this server session * `txn_num` - The current transaction number * `session_id` - The session id of this server session Whe...
lib/session/server_session.ex
0.82734
0.429818
server_session.ex
starcoder
defmodule Noray.Tetrad do @moduledoc """ Basic data structure for points and vectors. A tetrad consists of four values: x, y, z, and w. w should be 1.0 (if it represents a point) or 0.0 (if it represents a vector). See `Noray.Point` and `Noray.Vector` for helpers and specific operations. """ @opaque t :...
lib/noray/tetrad.ex
0.926429
0.956431
tetrad.ex
starcoder
defmodule Chex.Game do @moduledoc false alias Chex.{Board, Color, Game, Move, Parser.FEN, Piece} defstruct board: %{}, active_color: :white, castling: [:K, :Q, :k, :q], en_passant: nil, moves: [], halfmove_clock: 0, fullmove_clock: 1, ...
lib/chex/game.ex
0.918982
0.526891
game.ex
starcoder
defmodule Acquirex.Space do alias Acquirex.Corporation @type status :: Empty | Full | {Incorporated, Corporation.t} def start_link(coord) do Agent.start_link(fn -> Empty end, name: {:via, :gproc, space_name(coord)}) end def status(coord) do Agent.get({:via, :gproc, space_name(coord)}, fn s -> s end...
lib/space.ex
0.707708
0.60871
space.ex
starcoder
defmodule Gealts.Crossover do @moduledoc """ Randomly selects a position in a chromosome, then exchanges sub-chromosomes. Chromosomes fit for "mating" are randomly selected, the number of parent chromosomes is controlled by the @cr (crossover rate) parameter. """ alias Gealts.MathUtils @cr 0.25 ...
lib/gealts/crossover.ex
0.750736
0.60964
crossover.ex
starcoder
defmodule ExDoc.HTMLFormatter.Autolink do @moduledoc """ Conveniences for autolinking locals, types and more. """ @elixir_docs "http://elixir-lang.org/docs/master/" @doc """ Escape `'`, `"`, `&`, `<` and `>` in the string using HTML entities. This is only intended for use by the HTML formatter. """ ...
lib/ex_doc/html_formatter/autolink.ex
0.688887
0.565479
autolink.ex
starcoder
defmodule Nebulex do @moduledoc ~S""" Nebulex is split into 2 main components: * `Nebulex.Cache` - caches are wrappers around the in-memory data store. Via the cache, we can put, get, update, delete and query existing entries. A cache needs an adapter to communicate to the in-memory data store. ...
lib/nebulex.ex
0.83924
0.664248
nebulex.ex
starcoder
defmodule Contex.Sparkline do @moduledoc """ Generates a simple sparkline from an array of numbers. Note that this does not follow the pattern for other types of plot. It is not designed to be embedded within a `Contex.Plot` and, because it only relies on a single list of numbers, does not use data wrapped i...
lib/chart/sparkline.ex
0.824285
0.907148
sparkline.ex
starcoder
defmodule Bouncer.Session do @moduledoc """ A library of functions used to work with session data. """ alias Plug.Conn alias Bouncer.Token alias Bouncer.Utility def adapter, do: Application.get_env(:bouncer, :adapter) @doc """ Generates a session token. The ttl (time-to-live) defaults to 2 weeks. ...
lib/bouncer/session.ex
0.609757
0.438485
session.ex
starcoder
defmodule Aoc2021.Day15 do @moduledoc """ See https://adventofcode.com/2021/day/15 """ @type pos() :: {non_neg_integer(), non_neg_integer()} @type riskmap() :: %{pos() => non_neg_integer()} defmodule Reader do @moduledoc false @spec read_map(Path.t()) :: {Aoc2021.Day15.riskmap(), Aoc2021.Day15.po...
lib/aoc2021/day15.ex
0.784402
0.569344
day15.ex
starcoder
defmodule AWS.ResourceGroupsTaggingAPI do @moduledoc """ Resource Groups Tagging API This guide describes the API operations for the resource groups tagging. A tag is a label that you assign to an AWS resource. A tag consists of a key and a value, both of which you define. For example, if you have two Am...
lib/aws/resource_groups_tagging_api.ex
0.867191
0.558809
resource_groups_tagging_api.ex
starcoder
defmodule JokenJwks do @moduledoc """ `Joken.Hooks` implementation for fetching `Joken.Signer`s from public JWKS URLs. This hook is intended to be used when you are _verifying_ a token is signed with a well known public key. It only overrides the `before_verify/2` callback providing a `Joken.Signer` for the ...
lib/joken_jwks.ex
0.831964
0.496826
joken_jwks.ex
starcoder
defrecord File.Stat, Record.extract(:file_info, from_lib: "kernel/include/file.hrl"), moduledoc: """ A record responsible to hold file information. Its fields are: * `size` - Size of file in bytes. * `type` - `:device`, `:directory`, `:regular`, `:other`. The type of the file. * `access` - `:read`, `:write`, `:read_wr...
lib/elixir/lib/file.ex
0.823612
0.568176
file.ex
starcoder
defmodule Quantonex.Indicators do @moduledoc """ Contains technical indicators. """ alias Quantonex.DataPoint @dataset_min_size_error "There must be at least 1 element in the dataset." @period_min_value_error "Period must be at least 1." @period_max_value_error "Period can't be greater than the length o...
lib/indicators.ex
0.939143
0.902309
indicators.ex
starcoder
defmodule Hui.Encode do @moduledoc """ Utilities for encoding Solr query and update data structures. """ @type options :: __MODULE__.Options.t() @url_delimiters {?=, ?&} @json_delimiters {?:, ?,} defmodule Options do @moduledoc false defstruct [:per_field, :prefix, type: :url] @type t :: ...
lib/hui/encode.ex
0.800809
0.466603
encode.ex
starcoder
defmodule OSC do alias OSC.Encoder alias OSC.Parser @doc """ Encode a value to OSC. iex> OSC.encode(%OSC.Message{address: "/foo", arguments: ["hello"]}) {:ok, <<47, 102, 111, 111, 0, 0, 0, 0, 44, 115, 0, 0, 104, 101, 108, 108, 111, 0, 0, 0>>} """ @spec encode(Encoder.t, Keyword.t) :: {:ok, ioda...
lib/osc.ex
0.83104
0.483892
osc.ex
starcoder
defmodule Bluetooth.HCI.Commands do @moduledoc """ This module holds conversion functions for HCI commands and their results from and to a logical format and the binary representation. This module does not to attempt to be complete but grows by need. """ alias Bluetooth.HCI alias Bluetooth.AssignedNumber...
lib/bluetooth/hci/command.ex
0.603231
0.456834
command.ex
starcoder
alias Cuda.Graph alias Cuda.Graph.Node alias Cuda.Graph.Pin defprotocol Cuda.Graph.NodeProto do @doc """ Returns pin by its id """ @spec pin(node:: Node.t, id: Graph.id) :: Pin.t | nil def pin(node, id) @doc """ Returns a list of pins of specified type """ @spec pins(node :: Node.t, type :: Pin.type...
lib/cuda/graph/protocols.ex
0.86997
0.472501
protocols.ex
starcoder
defmodule Cldr.Calendar.ISOWeek do import Cldr.Calendar, only: [iso_days_from_date: 1, date_from_iso_days: 2, add: 2, day_of_year: 1] @doc """ Returns the date of the first day of the first week of the year that includes the provided `date`. This conforms with the ISO standard definition of when the fir...
lib/cldr/calendar/iso_week.ex
0.813387
0.797004
iso_week.ex
starcoder
defmodule QRCode.ErrorCorrection do @moduledoc """ Error correction code words and block information. """ alias QRCode.{QR, Polynom} alias QRCode.GeneratorPolynomial, as: GP import QRCode.QR, only: [level: 1, version: 1] @type groups() :: {[[], ...], [[]]} @type codewords() :: groups() @type t() :: ...
lib/qr_code/error_correction.ex
0.755366
0.647645
error_correction.ex
starcoder
defmodule ExRut do @moduledoc """ An Elixir library to validate and format chilean ID/TAX number ('RUN/RUT') """ @regex_rut ~r/^((?'num'\d{1,3}(?:([\.\,]?)\d{1,3}){2})(-?)(?'dv'[\dkK]))$/ @defaults [ delimiter: ".", show_dv: true ] def valid?(rut) when is_binary(rut) do case get_rut_values(...
lib/ex_rut.ex
0.55941
0.585694
ex_rut.ex
starcoder
defmodule Day25 do def read_file(path) do {:ok, input} = File.read(path) input |> parse_input end def parse_input(input) do [init_state] = Regex.run(~r{Begin in state (\w+)\.}, input, capture: :all_but_first) [steps] = Regex.run(~r{Perform a diagnostic checksum after (\d+) steps\.}, input, ca...
lib/day25.ex
0.539226
0.576244
day25.ex
starcoder
defmodule Geometry.PointZ do @moduledoc """ A point struct, representing a 3D point. """ import Geometry.Guards alias Geometry.{GeoJson, Hex, PointZ, WKB, WKT} defstruct [:coordinate] @blank " " @empty %{ {:ndr, :hex} => "000000000000F87F000000000000F87F000000000000F87F", {:xdr, :hex} => "7...
lib/geometry/point_z.ex
0.964996
0.777511
point_z.ex
starcoder
defmodule Square.BankAccounts do @moduledoc """ Documentation for `Square.BankAccounts`. """ @doc """ Returns a list of `BankAccount` maps linked to a Square account. For more information, see [Bank Accounts API](https://developer.squareup.com/docs/docs/bank-accounts-api). ``` def list_bank_accounts...
lib/api/bank_accounts_api.ex
0.90697
0.889096
bank_accounts_api.ex
starcoder
defmodule Apoc.RSA.PublicKey do @moduledoc """ Struct and set of functions for working with an RSA public key For information on key formats in PKI see [PKI PEM overview](https://gist.github.com/awood/9338235) or [RFC5912](https://tools.ietf.org/html/rfc5912) See also [Erlang Public Key Records](http://erla...
lib/apoc/rsa/public_key.ex
0.867176
0.601652
public_key.ex
starcoder
defmodule AppOptex.Client do require Logger @moduledoc """ Module responsible for comunication with AppOptics API. """ @doc """ Send an HTTP request to [AppOptics create API](https://docs.appoptics.com/api/?shell#create-a-measurement) with a list of measurements and tags. Returns the response from AppO...
lib/app_optex/client.ex
0.897153
0.452838
client.ex
starcoder
defmodule NervesHubLink.Client do @moduledoc """ A behaviour module for customizing if and when firmware updates get applied. By default NervesHubLink applies updates as soon as it knows about them from the NervesHubLink server and doesn't give warning before rebooting. This let's devices hook into the decis...
lib/nerves_hub_link/client.ex
0.807612
0.728676
client.ex
starcoder
defmodule Ash.Notifier.PubSub do @moduledoc "A pubsub notifier extension" @publish %Ash.Dsl.Entity{ name: :publish, target: Ash.Notifier.PubSub.Publication, describe: """ Configure a given action to publish its results over a given topic. If you have multiple actions with the same name (only p...
lib/ash/notifier/pub_sub/pub_sub.ex
0.878796
0.844409
pub_sub.ex
starcoder
defmodule FnExpr do @moduledoc """ Creates immediately invoked function expressions specifically [IIFE](http://benalman.com/news/2010/11/immediately-invoked-function-expression/) to be used with the pipe operator. The motiviation for this library was from <NAME>' short talk [Put This in Your Pipe](https://...
lib/fn_expr.ex
0.878053
0.590661
fn_expr.ex
starcoder
defmodule ExDebugger.Tokenizer do @moduledoc false use CommendableComments @modulecomment """ Ideally, as a regular user one should not need to know about this. However, as leaky abstractions tend to bite us by surprise; it may be important to be aware of this. The `AST` that we have access to compile tim...
lib/ex_debugger/tokenizer.ex
0.834643
0.868269
tokenizer.ex
starcoder
defmodule Aya.Driver do @moduledoc """ Backend driver which is used with Aya. It should implement a set of functions which perform various forms of validation. These functions are: * `check_passkey` - Takes passkey, returns a user variable which will be used in future validation reqs * `check_torrent` - Valid...
lib/aya/driver.ex
0.790652
0.553505
driver.ex
starcoder
defmodule Top52.Tasks do @moduledoc """ The Tasks context. """ import Ecto.Query, warn: false alias Ecto.Query alias Top52.Repo alias Top52.Tasks.Task alias Top52.Tasks.Note @doc """ Returns the list of tasks. ## Examples iex> list_tasks() [%Task{}, ...] """ def list_tasks do...
lib/top5_2/tasks.ex
0.794544
0.433082
tasks.ex
starcoder
defmodule DiversityInTech.Companies do @moduledoc """ The Companies context. """ import Ecto.Query, warn: false alias DiversityInTech.Repo alias DiversityInTech.Companies.Company alias Ecto.Multi @doc """ Returns the list of companies. ## Examples iex> list_companies() [%Company{}, ....
lib/diversity_in_tech/companies/companies.ex
0.803598
0.415432
companies.ex
starcoder
defmodule Robot do @moduledoc """ Emergency Hull Painting Robot """ defstruct heading: :up, position: {0, 0}, panels: %{}, next_input: :paint @black 0 @white 1 @left 0 @right 1 def print(map) do pts = Map.keys(map) {min_x, max_x} = Enum.map(pts, fn {x, _y} -> x end) |> Enum.min_max() ...
apps/day11/lib/robot.ex
0.688468
0.498901
robot.ex
starcoder
defmodule AdaptableCostsEvaluator.Outputs.Output do @moduledoc """ An `AdaptableCostsEvaluator.Outputs.Output` holds the result of the evaluation of the particular `AdaptableCostsEvaluator.Formulas.Formula`. The value of the `AdaptableCostsEvaluator.Outputs.Output` is always validated against the linked `Adap...
lib/adaptable_costs_evaluator/outputs/output.ex
0.832747
0.537466
output.ex
starcoder
defmodule AWS.ACM do @moduledoc """ AWS Certificate Manager You can use AWS Certificate Manager (ACM) to manage SSL/TLS certificates for your AWS-based websites and applications. For more information about using ACM, see the [AWS Certificate Manager User Guide](https://docs.aws.amazon.com/acm/latest/usergu...
lib/aws/generated/acm.ex
0.880463
0.45181
acm.ex
starcoder
defmodule Breadboard.Joystick do @moduledoc """ Manage the 'Joystick' using the I2C protocol Joystick module refer to a simple hardware consisting of an *analog joystick* connected to an 'ADS1115' *analog to digital converter* using the I2C Interface. This hardware is tested on a [OrangePi board](http://www.o...
lib/breadboard/joystick.ex
0.7696
0.562297
joystick.ex
starcoder
defmodule EctoTablestore.Migration do @moduledoc """ Migrations are used to create your tables. Support the partition key is autoincrementing based on this library's wrapper, for this use case, we can use the migration to automatically create an another separated table to generate the serial value when `:ins...
lib/ecto_tablestore/migration.ex
0.811116
0.519338
migration.ex
starcoder
defmodule Plug.Parsers.MULTIPART do @moduledoc """ Parses multipart request body. ## Options All options supported by `Plug.Conn.read_body/2` are also supported here. They are repeated here for convenience: * `:length` - sets the maximum number of bytes to read from the request, defaults to 8_000...
deps/plug/lib/plug/parsers/multipart.ex
0.753194
0.449151
multipart.ex
starcoder
defmodule BatchPlease.FileBatcher do @typedoc ~S""" The state of a single FileBatcher batch. `filename` is a string holding the name of the file containing items from the current batch. `file` is a filehandle to the current batch file. `encode` is a function which takes an item as input and encodes it ...
lib/batch_please/file_batcher.ex
0.683525
0.55923
file_batcher.ex
starcoder
defmodule EWalletDB.ExchangePair do @moduledoc """ Ecto Schema representing an exchange pair. # What is an exchange rate? The exchange rate is the amount of the destination token (`to_token`) that will be received when exchanged with one unit of the source token (`from_token`). For example: ``` %EWa...
apps/ewallet_db/lib/ewallet_db/exchange_pair.ex
0.903236
0.710829
exchange_pair.ex
starcoder
defmodule Faker.Pokemon.De do import Faker, only: [sampler: 2] @moduledoc """ Functions for Pokemon names in German """ @doc """ Returns a Pokemon name ## Examples iex> Faker.Pokemon.De.name() "Viscogon" iex> Faker.Pokemon.De.name() "Lepumentas" iex> Faker.Pokemon.De.name...
lib/faker/pokemon/de.ex
0.589598
0.475057
de.ex
starcoder
defmodule YipyipExAuth.Plugs.ProcessAccessToken do @moduledoc """ Plug to process and verify access tokens. Must be initialized with a `YipyipExAuth.Config`-struct, which can be initialized itself using `YipyipExAuth.Config.from_enum/1`. The plug does not reject unauthenticated requests by itself. If a request i...
lib/plugs/process_access_token.ex
0.888414
0.40204
process_access_token.ex
starcoder
defmodule Scenic.Primitive.Rectangle do @moduledoc """ Draw a rectangle on the screen. ## Data `{width, height}` The data for a line is a tuple containing two numbers. * `width` - width of the rectangle * `height` - height of the rectangle ## Styles This primitive recognizes the following styles...
lib/scenic/primitive/rectangle.ex
0.957596
0.922343
rectangle.ex
starcoder
defmodule Crux.Rest.ApiError do @moduledoc """ Represents a Discord API error. Raised or returned whenever the api responded with a non `200` / `204` status code """ defexception( status_code: nil, code: nil, message: nil, path: nil, method: nil ) @typedoc """ | Property |...
lib/rest/api_error.ex
0.841728
0.41947
api_error.ex
starcoder
defmodule JsonApiDeserializer do @moduledoc """ Json api deserializer able to deserialize json api documents with relationships. For instance, this payload: ``` { "data": [ { "type": "posts", "id": "13608770-76dd-47e5-a1c4-4d0d9c2483ad", "links": { ...
lib/json_api_deserializer.ex
0.739046
0.488344
json_api_deserializer.ex
starcoder
defmodule RGBMatrix.Animation.SolidReactive do @moduledoc """ Static single hue, pulses keys hit to shifted hue then fades to current hue. """ use RGBMatrix.Animation alias Chameleon.HSV import RGBMatrix.Utils, only: [mod: 2] field :speed, :integer, default: 4, min: 0, max: 32, doc: [ ...
lib/rgb_matrix/animation/solid_reactive.ex
0.91331
0.55914
solid_reactive.ex
starcoder
defmodule Svalinn do @on_load :preload_tokens @default_encoding Svalinn.Encodings.Binary @version 1 import Svalinn.Util, only: [prefix: 1, prefix: 2] import Svalinn.Encoder, only: [encode: 3] import Svalinn.Decoder, only: [decode: 3] defprotocol Tokenize do @doc ~S""" """ @spec token(map) :...
lib/svalinn.ex
0.721645
0.448064
svalinn.ex
starcoder
defmodule Sanbase.Metric.SqlQuery.Helper do @aggregations [:any, :sum, :avg, :min, :max, :last, :first, :median, :count, :ohlc] @type operator :: :inside_channel | :outside_channel | :less_than | :less_than_or_equal_to | :greater_than | :greater_than_or_e...
lib/sanbase/metric/sql_query_helper.ex
0.640748
0.513546
sql_query_helper.ex
starcoder
defmodule Lapin.Pattern do @moduledoc """ Extensible behaviour to define pattern modules. Lapin provides a number of submodules which impelment the patterns found in the [RabbitMQ Tutorials](http://www.rabbitmq.com/getstarted.html). ``` defmodule ExampleApp.SomePatter do use Lapin.Pattern [... ca...
lib/lapin/pattern.ex
0.841158
0.607925
pattern.ex
starcoder
defmodule Plexy.Config do @moduledoc """ Provides access to a hard coded config value, a value stored as a environment variable on the current system at runtime or a default provided value. The config.exs can look like this ``` config :plexy, redis_url: {:system, "REDIS_URL"}, port: {:system, "PORT...
lib/plexy/config.ex
0.840717
0.661255
config.ex
starcoder
defmodule Hextille.Offset do alias Hextille.Offset, as: Offset alias Hextille.Cube use Bitwise @moduledoc """ Hexagon module that represents hexagon tiles using offset coordinates. Instead of names x, y this module uses names col and row. Coordinates in q-offset system represent hexagons in pointy top o...
lib/offset.ex
0.901721
0.845177
offset.ex
starcoder
defmodule CLI.UI do @moduledoc """ Renders the CLI's UI. This should be the **only** way in which the UI is drawn from the CLI, except for the prompt. """ require Integer @enforce_keys [:game_pid] defstruct(game_pid: nil, below_board: "", above_board: "") @doc ~S""" Get a string containing a visual...
apps/cli/lib/cli/ui.ex
0.725454
0.696771
ui.ex
starcoder