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 Exchange.Utils do @moduledoc """ Auxiliary functions for Exchange APP """ @doc """ Fetches the completed trades stored by a `Exchange.TimeSeries` adapter given a ticker and a id ## Parameters - ticker: Market where the fetch should be made - trader_id: The that a given trade must match ...
lib/exchange/utils.ex
0.891811
0.601359
utils.ex
starcoder
defmodule Elastic.Scroller do alias Elastic.Index alias Elastic.Scroll use GenServer @moduledoc ~S""" Provides an API for working with [Elastic Search's Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/search-request-scroll.html) ## Example ```elixir {:ok, pid} = Elastic.Scrol...
lib/elastic/scroller.ex
0.8628
0.749912
scroller.ex
starcoder
defmodule NebulexExt.Adapters.Replicated do @moduledoc """ Adapter module for replicated cache. This adapter depends on a local cache adapter, it adds a thin layer on top of it in order to replicate requests across a group of nodes, where is supposed the local cache is running already. PG2 is used by the ...
lib/nebulex_ext/adapters/replicated.ex
0.841874
0.620047
replicated.ex
starcoder
defmodule Vault.Engine.KVV2 do @moduledoc """ Get and put secrets using the v2 KV (versioned) secrets engine See: [Vault Docs](https://www.vaultproject.io/api/secret/kv/kv-v2.html) for details. """ @behaviour Vault.Engine.Adapter @type vault :: Vault.t() @type path :: String.t() @type version :: integ...
lib/vault/engine/kv/v2.ex
0.907094
0.784236
v2.ex
starcoder
defmodule LoadResource.Scope do @moduledoc """ This module defines a scope that can be used in validating a resouce. A simple example: we have books and citations. When loading a citation, we want to validate that it belongs to a valid book -- that is, to add `citation.book_id = ${valid_book_id}` to our SQL quer...
lib/load_resource/scope.ex
0.876456
0.930521
scope.ex
starcoder
defmodule Etherscan.API.Logs do @moduledoc """ Module to wrap Etherscan event log endpoints. [Etherscan API Documentation](https://etherscan.io/apis#logs) """ use Etherscan.API use Etherscan.Constants alias Etherscan.Log @operators ["and", "or"] @get_logs_default_params %{ address: nil, fr...
lib/etherscan/api/logs.ex
0.855081
0.52409
logs.ex
starcoder
defprotocol Flop.Schema do @moduledoc """ This protocol allows you to set query options in your Ecto schemas. ## Usage Derive `Flop.Schema` in your Ecto schema and set the filterable and sortable fields. defmodule Flop.Pet do use Ecto.Schema @derive { Flop.Schema, ...
lib/flop/schema.ex
0.826607
0.703069
schema.ex
starcoder
defmodule Geohash do @moduledoc ~S""" Geohash encode/decode and helper functions ## Usage - Encode coordinates with `Geohash.encode(lat, lon, precision \\ 11)` ``` Geohash.encode(42.6, -5.6, 5) # "ezs42" ``` - Decode coordinates with `Geohash.decode(geohash)` ``` Geohash.decode("ezs42") # {...
lib/geohash.ex
0.908341
0.882225
geohash.ex
starcoder
defmodule TelemetryMetricsRiemann do @moduledoc """ `Telemetry.Metrics` reporter for riemann-compatible metric servers. To use it, start the reporter with the `start_link/1` function, providing it a list of `Telemetry.Metrics` metric definitions: import Telemetry.Metrics TelemetryMetricsRiemann.s...
lib/telemetry_metrics_riemann.ex
0.949972
0.656878
telemetry_metrics_riemann.ex
starcoder
defmodule Checkov do @moduledoc """ Checkov aims to emulate the data driven testing functionality of the [Spock Framework](http://spockframework.org/) A where block can be used in a data_test to exercise the assertions of the test multiple times. ``` defmodule MyModuleTest do use ExUnit.Case import...
lib/checkov.ex
0.70912
0.982406
checkov.ex
starcoder
defmodule LearnKit.NaiveBayes.Gaussian do @moduledoc """ Module for Gaussian NB algorithm """ defstruct data_set: [], fit_data: [] alias LearnKit.NaiveBayes.Gaussian use Gaussian.Normalize use Gaussian.Fit use Gaussian.Classify use Gaussian.Score @type label :: atom @type feature :: [integer] ...
lib/learn_kit/naive_bayes/gaussian.ex
0.932821
0.734358
gaussian.ex
starcoder
defmodule BSV.Hash do @moduledoc """ A collection of one-way hashing functions used frequently throughout Bitcoin. All hashing functions accept the `:encoding` option which can be either `:base64` or `:hex`. """ import BSV.Util, only: [encode: 2] @doc """ Computes the RIPEMD hash of a given input, out...
lib/bsv/hash.ex
0.91579
0.545286
hash.ex
starcoder
defmodule Plymio.Vekil.Forom.Form do @moduledoc ~S""" The module implements the `Plymio.Vekil.Forom` protocol and produces *quoted forms*. See `Plymio.Vekil.Forom` for the definitions of the protocol functions. See `Plymio.Vekil` for an explanation of the test environment. The default `:produce_default` is...
lib/vekil/concrete/forom/form.ex
0.855911
0.582758
form.ex
starcoder
defmodule SvgBuilder.Units do @moduledoc """ Units for SVG documents. """ @type len_t() :: number | {number, atom} | {number, number} | binary | nil @type length_list_t() :: len_t | [len_t] @type angle_t() :: number | binary | {number, :deg | :rad | :grad} @spec angle(angle_t) :: binary def angle(angl...
lib/units.ex
0.708414
0.462291
units.ex
starcoder
defmodule ListDict do @moduledoc """ A Dict implementation that works on lists of two-items tuples. For more information about the functions and their APIs, please consult the `Dict` module. """ @doc """ Returns a new `ListDict`, i.e. an empty list. """ def new, do: [] @doc """ Creates a new `L...
lib/elixir/lib/list_dict.ex
0.833155
0.717556
list_dict.ex
starcoder
defmodule K8s.Client.Runner.Watch do @moduledoc """ `K8s.Client` runner that will watch a resource or resources and stream results back to a process. """ alias K8s.Client.Runner.Base alias K8s.Client.Runner.Watch.Stream alias K8s.Conn alias K8s.Operation alias K8s.Operation.Error @resource_version_j...
lib/k8s/client/runner/watch.ex
0.88856
0.48182
watch.ex
starcoder
defmodule JaResource.Create do @moduledoc """ Defines a behaviour for creating a resource and the function to execute it. It relies on (and uses): * JaResource.Repo * JaResource.Model * JaResource.Attributes When used JaResource.Create defines the following overrideable callbacks: * handle_c...
lib/ja_resource/create.ex
0.863622
0.433502
create.ex
starcoder
defmodule Printer.Gcode do @moduledoc """ Collection of functions for building G-code commands. More on G-code """ @doc """ Builds the command for a [linear move](https://marlinfw.org/docs/gcode/G000-G001.html). """ def g0(axes) do params = ["X", "Y", "Z"] |> Enum.map(fn key -> {key, ax...
printer/lib/printer/gcode.ex
0.840062
0.600071
gcode.ex
starcoder
defmodule Protobuf.Encoder do import Protobuf.WireTypes import Bitwise, only: [bsr: 2, band: 2, bsl: 2, bor: 2] alias Protobuf.{MessageProps, FieldProps} @spec encode(struct, keyword) :: iodata def encode(%{__struct__: mod} = struct, opts \\ []) do Protobuf.Validator.validate!(struct) res = encode(s...
lib/protobuf/encoder.ex
0.761937
0.431584
encoder.ex
starcoder
defmodule TypeCheck.Builtin.FixedTuple do defstruct [:element_types] use TypeCheck @type! t :: %__MODULE__{element_types: list(TypeCheck.Type.t())} @type! problem_tuple :: {t(), :not_a_tuple, %{}, any()} | {t(), :different_size, %{expected_size: integer()}, tuple()} | {t(), :element...
lib/type_check/builtin/fixed_tuple.ex
0.715921
0.47725
fixed_tuple.ex
starcoder
defmodule MarsExplorer do # Get values from prompt def get_x() do x = IO.gets "What's the size of X of the area? > " val = String.trim(x) String.to_integer(val) end def get_y() do y = IO.gets "What's the value of Y of the area? > " val = String.trim(y) String.to_integer(val) end d...
src/marsExplorer.ex
0.64232
0.551091
marsExplorer.ex
starcoder
defmodule Membrane.WebRTC.Server.Message do @moduledoc """ Struct defining messages exchanged between peers and rooms. ## Fields - `:data` - Main part of the message. Value under that field MUST BE encodable by `Jason.Encoder`. - `:event` - Topic of the message. - `:from` - Peer ID of a sender. ...
lib/webrtc_server/message.ex
0.88232
0.465084
message.ex
starcoder
defmodule Roman.Validators.Numeral do @moduledoc false @valid_numerals ~w(M D C L X V I) @type ok_numeral_or_error :: {:ok, Roman.numeral()} | Roman.error() @spec validate(Roman.numeral()) :: Roman.numeral() | Roman.error() def validate(numeral, opts \\ [strict: true]) when is_binary(numeral) do with {...
lib/roman/validators/numeral.ex
0.756987
0.495606
numeral.ex
starcoder
defmodule Hierbautberlin.GeoData.GeoItem do use Ecto.Schema import Ecto.Query, warn: false import Ecto.Changeset alias Hierbautberlin.Repo alias Hierbautberlin.GeoData.{GeoItem, GeoPosition, GeoMapItem, Source} @states [ "intended", "in_preparation", "in_planning", "under_construction", ...
lib/hierbautberlin/geo_data/geo_item.ex
0.51879
0.405596
geo_item.ex
starcoder
defmodule Gettext.Interpolation do @moduledoc false @type interpolatable :: [String.t() | atom] @doc """ Extracts interpolations from a given string. This function extracts all interpolations in the form `%{interpolation}` contained inside `str`, converts them to atoms and then returns a list of string...
lib/gettext/interpolation.ex
0.889577
0.49109
interpolation.ex
starcoder
defmodule SimpleSchema.Schema do @moduledoc """ A module to convert a simple schema to JSON Schema Basic: ``` iex> schema = %{name: :string, ...> value: {:integer, optional: true}, ...> array: [:string], ...> map: {%{x: :integer, y: :integer}, optional: true}, ...> ...
lib/simple_schema/schema.ex
0.802788
0.765593
schema.ex
starcoder
defmodule Apoc.Hazmat.AEAD.AESGCM do @moduledoc """ Implementation of the AES block encryption standard as per [FIPS PUB 197](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197.pdf). The functions in this module operate in GCM (Galois/Counter Mode) to provide fast Authenticated Encryption. See [Recommend...
lib/apoc/hazmat/aead/aes-gcm.ex
0.891493
0.924756
aes-gcm.ex
starcoder
defmodule Spandex.Ecto.Trace do @moduledoc """ A trace builder that can be given to ecto as a logger. It will try to get the trace_id and span_id from the caller pid in the case that the particular query is being run asynchronously (as in the case of parallel preloads). To configure, set it up as an ecto lo...
lib/ecto/trace.ex
0.57332
0.433082
trace.ex
starcoder
defmodule Day17 do @moduledoc """ Documentation for Day17. """ @dimensions 4 def part1 do active_set = load_initial("input.txt") step6 = 0..5 |> Enum.reduce(active_set, fn _iter, current_set -> step(current_set) end) IO.puts(Enum.count(step6)) end def load_initial(filename) do File.st...
day17/lib/day17.ex
0.616359
0.494263
day17.ex
starcoder
defmodule Etl.Pipeline do defmodule Step do @type t :: %__MODULE__{ child_spec: Supervisor.child_spec(), opts: keyword(), dispatcher: {module(), keyword()} } defstruct [:child_spec, :opts, :dispatcher] end @type t :: %__MODULE__{ context: Etl.Conte...
lib/etl/pipeline.ex
0.718496
0.436022
pipeline.ex
starcoder
defmodule Zstream.Unzip do @moduledoc false alias Zstream.Entry alias Zstream.Unzip.Extra defmodule Error do defexception [:message] end use Bitwise defmodule LocalHeader do @moduledoc false defstruct [ :version_need_to_extract, :general_purpose_bit_flag, :compression_meth...
lib/zstream/unzip.ex
0.584153
0.510802
unzip.ex
starcoder
defmodule WaoBirthday.Commands.Birthday do use Alchemy.Cogs alias Alchemy.{Client, Embed} alias WaoBirthday.Birthday import WaoBirthday.Utils require Logger require Embed Cogs.def birthday "help" do Cogs.say """ ``` birthday me - Displays your birthday. birthday <userid> - Displays thi...
lib/wao_birthday/commands/birthday.ex
0.603581
0.685831
birthday.ex
starcoder
defmodule DemonSpiritGame.Game do @moduledoc """ Provides a structure to hold all game state, with functions to manipulate that state. board: Map. Keys are {x, y} tuples of integers. Values are maps representing pieces. cards. Map with the following keys (indented) %Map{ white: List of 2 %Cards{}....
apps/demon_spirit_game/lib/demon_spirit_game/game.ex
0.888039
0.548976
game.ex
starcoder
defmodule EctoJob.Migrations do @moduledoc false defmodule Helpers do @moduledoc false def qualify(name, nil), do: name def qualify(name, prefix), do: "#{prefix}.#{name}" end defmodule Install do @moduledoc """ Defines migrations for installing shared functions """ import Ecto.Mi...
lib/ecto_job/migrations.ex
0.750553
0.469155
migrations.ex
starcoder
defmodule Tipalti.API.Payer do @moduledoc """ Payer functions. Details are taken from: <https://api.tipalti.com/v5/PayerFunctions.asmx> """ import SweetXml, only: [sigil_x: 2] alias Tipalti.API.SOAP.Client alias Tipalti.{Invoice, Balance, ClientError, RequestError} @version "v5" @url [ sandbox...
lib/tipalti/api/payer.ex
0.863046
0.452717
payer.ex
starcoder
defmodule Roll35Core.Types do @moduledoc """ Core type definitions for Roll35. """ @typedoc """ Represents an item. """ @type item :: %{ :name => String.t(), optional(atom()) => term() } @typedoc """ Represents the category of an item. """ @type category :: ...
apps/roll35_core/lib/roll35_core/types.ex
0.910665
0.513851
types.ex
starcoder
defmodule ConnectFour.Game do @moduledoc """ A Connect Four game. Players are distinguished by game piece color (yellow and red). Moves are represented by the columns in which they are made. To create a new game, create an empty `ConnectFour.Game.t()` struct (`%ConnectFour.Game{}`). Yellow moves first....
lib/connect_four/game.ex
0.929103
0.767625
game.ex
starcoder
defmodule MyList do require MyEnum require Integer @doc """ MyEnum.span(from, to, step) returns a list starting at from and ending at to with step step, the resulting list can be empty ## Examples iex > MyList.span(6, 20, 5) [6, 11, 16] iex > MyList.span(0, 20, 2) [0, 2, 4, 6, 8, 10, 12, 14...
my_enum/lib/my_list.ex
0.713032
0.534005
my_list.ex
starcoder
defmodule HTTPStream do @moduledoc """ Main API interface. HTTPStream is a tiny tiny library for streaming big big files. It works by wrapping HTTP requests onto a Stream. You can use it with Flow, write it to disk through regular streams and more! ``` HTTPStream.get(large_image_url) |> Stream.into(Fi...
lib/http_stream.ex
0.882959
0.639975
http_stream.ex
starcoder
defmodule Expyplot.Plot do @moduledoc """ <b>This is the end-user API for pyplot.</b> See the matplotlib.plot docs at: http://matplotlib.org/api/pyplot_api.html <b>Most of these functions are UNTESTED. I know. That's terrible. But you can test them by using them! Then, if they don't work, open an issue on t...
lib/plot.ex
0.88127
0.945951
plot.ex
starcoder
defmodule ElixirConsole.Sandbox do @moduledoc """ Provides a sandbox where Elixir code from untrusted sources can be executed """ @type sandbox() :: %__MODULE__{} alias ElixirConsole.Sandbox.CodeExecutor @max_command_length 500 @max_memory_kb_default 256 @max_binary_memory_kb_default 50 * 1024 @tim...
lib/elixir_console/sandbox.ex
0.862221
0.440229
sandbox.ex
starcoder
defmodule IntelligentBrute do @moduledoc """ Following advice from some matematictian, this brute will make more intellegent guesses when solving """ import Acros @doc """ notation - List :: Either(String, Float) limits - List :: {Integer, Integer} precision - Float variables - List :: String line...
lib/intelligent_brute.ex
0.719876
0.545588
intelligent_brute.ex
starcoder
defmodule Intcode.Computer do alias Intcode.{Computer, Instruction, Memory} @moduledoc """ A process that runs a single Intcode program to completion. """ @typedoc """ The PID for an Intcode computer process. """ @type t :: pid @typedoc """ The PID for a process that is able to handle messages fr...
aoc2019_elixir/apps/aoc/lib/intcode/computer.ex
0.854975
0.559049
computer.ex
starcoder
defprotocol DeepMerge.Resolver do @moduledoc """ Protocol defining how conflicts during deep_merge should be resolved. As part of the DeepMerge library this protocol is already implemented for `Map` and `List` as well as a fallback to `Any` (which just always takes the override). If you want your custom s...
lib/deep_merge/resolver.ex
0.842491
0.604516
resolver.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 usecase, we can use the migration to automatically create an another separated table to generate the serial value when `:inse...
lib/ecto_tablestore/migration.ex
0.852291
0.46952
migration.ex
starcoder
defmodule Advent.Y2016.D01 do @moduledoc """ https://adventofcode.com/2016/day/1 """ @typep directions :: [{integer(), non_neg_integer()}] @doc """ How far is the shortest path to the destination? """ @spec part_one(String.t()) :: non_neg_integer() def part_one(input) do {x, y, _d} = input...
lib/advent/y2016/d01.ex
0.796174
0.544862
d01.ex
starcoder
defmodule Cased.Sensitive.Processor do @moduledoc """ Processes audit events for sensitive data. """ @default_process_opts [ return: :embedded, handlers: [] ] @type process_opts :: [process_opt()] @type process_opt :: {:return, :embedded | :pii} | {:handlers, [Cased.Sensitiv...
lib/cased/sensitive/processor.ex
0.907421
0.741089
processor.ex
starcoder
defmodule BPXE.Engine.Process.Log do defmodule NewProcessActivation do defstruct pid: nil, id: nil, activation: nil end defmodule FlowNodeActivated do defstruct pid: nil, id: nil, token_id: nil, token: nil end defmodule FlowNodeForward do defstruct pid: nil, id: nil, token_id: nil, to: [] end ...
lib/bpxe/engine/process/log.ex
0.5083
0.466542
log.ex
starcoder
defmodule ICalendar.Recurrence do @moduledoc """ Adds support for recurring events. Events can recur by frequency, count, interval, and/or start/end date. To see the specific rules and examples, see `add_recurring_events/2` below. Credit to @fazibear for this module. """ alias ICalendar.Event # igno...
lib/icalendar/recurrence.ex
0.93223
0.533519
recurrence.ex
starcoder
defmodule Zappa.OptionParser do @moduledoc false # The name of the index variable should match up with the index helper. @index_var "index___helper" @valid_variable_name_regex ~r/^[a-zA-Z]{1}[a-zA-Z0-9_]+$/ @typep variable :: String.t() @typep iterator :: String.t() @typep index :: String.t() @doc ~S...
lib/zappa/option_parser.ex
0.777131
0.504089
option_parser.ex
starcoder
defmodule Liveness do @moduledoc """ `Liveness` offers the `eventually` higher-order function, which can be used to specify liveness properties, or to busy-wait for a particular condition. """ defexception [:message] @doc """ Runs `f` repeatedly until `f` succeeds or the number of `tries` is reached. ...
lib/liveness.ex
0.811527
0.724773
liveness.ex
starcoder
defmodule Tensorflow.AllocationRecord do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ alloc_micros: integer, alloc_bytes: integer } defstruct [:alloc_micros, :alloc_bytes] field(:alloc_micros, 1, type: :int64) field(:alloc_bytes, 2, type: :int64) end ...
lib/tensorflow/core/framework/step_stats.pb.ex
0.769297
0.450178
step_stats.pb.ex
starcoder
defmodule Liquex.Parser.Object do @moduledoc false import NimbleParsec alias Liquex.Parser.Field alias Liquex.Parser.Literal @spec arguments(NimbleParsec.t()) :: NimbleParsec.t() def arguments(combinator \\ empty()) do choice([ combinator |> Literal.argument() |> lookahead_not(strin...
lib/liquex/parser/object.ex
0.710829
0.430207
object.ex
starcoder
defmodule Exi.Connect do @moduledoc """ Nerves起動時に指定したノードに `Node.connect()` し、接続が切れた場合は再接続を試みる。 ## 使い方 application.exに以下を記載する。 ``` {Exi.Connect, [node_name, cookie, conn_node]} ``` - node_name: 自分のノード名 - cookie: クッキー(共通鍵) - conn_node: Node.connectするノード ## 例 ``` {Exi.Connect, ["my_node...
dio/exibee/lib/exi/exi_connect.ex
0.67971
0.722796
exi_connect.ex
starcoder
defmodule WebSockex do alias WebSockex.{Utils} @handshake_guid "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" @moduledoc ~S""" A client handles negotiating the connection, then sending frames, receiving frames, closing, and reconnecting that connection. A simple client implementation would be: ``` defmodule ...
lib/websockex.ex
0.855338
0.777933
websockex.ex
starcoder
defmodule Bandit do @moduledoc """ Bandit is an HTTP server for Plug apps. As an HTTP server, Bandit's primary goal is to act as 'glue' between client connections managed by [Thousand Island](https://github.com/mtrudel/thousand_island) and application code defined via the [Plug API](https://github.com/elixir...
lib/bandit.ex
0.922062
0.902653
bandit.ex
starcoder
defmodule Day12 do @facing ~w[north east south west]a def part1(input) do {{x, y}, _facing} = input |> String.splitter("\n", trim: true) |> Stream.map(&parse_line/1) |> Enum.reduce({{0, 0}, :east}, &follow_directions/2) abs(x) + abs(y) end def parse_line(line) when is_binary(l...
2020/day12/ex/day12.ex
0.69035
0.656662
day12.ex
starcoder
defmodule Faker.Lorem.Shakespeare.En do import Faker, only: [sampler: 2] @moduledoc """ Random quotes from <NAME>'s plays, sonnets and poems in English. """ @doc """ Return random quote from "The Tragedy of Hamlet, Prince of Denmark" tragedy. ## Examples iex> Faker.Lorem.Shakespeare.En.hamlet() ...
lib/faker/lorem/shakespeare/en.ex
0.577138
0.470919
en.ex
starcoder
defmodule Posexional.File do @moduledoc """ a Posexional.File is the main struct to manage a positional file """ alias Posexional.{Field, Row} defstruct rows: [], separator: "\n" def new(rows, separator \\ nil) def new(rows, nil) do %Posexional.File{rows: rows, separator: "\n"} end ...
lib/posexional/file.ex
0.642208
0.485905
file.ex
starcoder
defmodule Day21 do # Faster version for Day 21 (~100-1000x time faster). # Inspired by <NAME> version: https://gist.github.com/sasa1977/1246dc75886faf7da6b7956d158c2420 # This version uses boolean lists instead of binaries and makes heavy use of # streams to transform the pixel grid. def solveA(filename), do...
2017/elixir/day21/lib/day21.ex
0.673192
0.541348
day21.ex
starcoder
defmodule Rambla.Smtp do @moduledoc """ Default connection implementation for 📧 SMTP. It expects a message to be a map containing the following fields: `:to`, `:subject`, `:body` _and_ the optional `:from` that otherwise would be taken from the global settings (`releases.mix`) from `[]:rambla, :pools, Rambl...
lib/rambla/connections/smtp.ex
0.842475
0.670649
smtp.ex
starcoder
defmodule Toolshed do @moduledoc """ Making the IEx console friendlier one command at a time To use the helpers, run: iex> use Toolshed Add this to your `.iex.exs` to load automatically. The following is a list of helpers: * `cat/1` - print out a file * `cmd/1` - run a sys...
lib/toolshed.ex
0.672009
0.537163
toolshed.ex
starcoder
require Utils defmodule D10 do @moduledoc """ --- Day 10: Monitoring Station --- You fly into the asteroid belt and reach the Ceres monitoring station. The Elves here have an emergency: they're having trouble tracking all of the asteroids and can't be sure they're safe. The Elves would like to build a new mon...
lib/days/10.ex
0.785103
0.879095
10.ex
starcoder
defmodule Grizzly.ZWave.CommandClasses.Powerlevel do @moduledoc """ "Powerlevel" Command Class The Powerlevel Command Class defines RF transmit power controlling Commands useful when installing or testing a network. The Commands makes it possible for supporting controllers to set/get the RF transmit power le...
lib/grizzly/zwave/command_classes/powerlevel.ex
0.84691
0.592283
powerlevel.ex
starcoder
defmodule Toml.Lexer do @moduledoc false import __MODULE__.Guards defstruct [:pid] @type t :: %__MODULE__{pid: pid} # The type of the token @type type :: :whitespace | :newline | :comment | :digits | :hex | :octal | :binary ...
lib/lexer.ex
0.845958
0.601184
lexer.ex
starcoder
defmodule ExWire.Struct.BlockQueue do @moduledoc """ A structure to store and process blocks received by peers. The goal of this module is to keep track of partial blocks until we're ready to add the block to the chain. There are three reasons we need to keep them stored in a queue: 1. Block headers are se...
apps/ex_wire/lib/ex_wire/struct/block_queue.ex
0.821939
0.621498
block_queue.ex
starcoder
defmodule Day22 do @moduledoc """ AoC 2019, Day 22 - Slam Shuffle The math for Part 2 was beyond me. Much inspiration was taken from: https://github.com/bjorng/advent-of-code-2019/blob/master/day22/lib/day22.ex https://www.reddit.com/r/adventofcode/comments/ee0rqi/2019_day_22_solutions/fbnkaju/?context=3 h...
apps/day22/lib/day22.ex
0.760873
0.577555
day22.ex
starcoder
defmodule Etso.ETS.MatchSpecification do @moduledoc """ The ETS Match Specifications module contains various functions which convert Ecto queries to ETS Match Specifications in order to execute the given queries. """ def build(query, params) do {_, schema} = query.from.source field_names = Etso.ETS.T...
lib/etso/ets/match_specification.ex
0.630116
0.54952
match_specification.ex
starcoder
defmodule NimblePool do @external_resource "README.md" @moduledoc "README.md" |> File.read!() |> String.split("<!-- MDOC !-->") |> Enum.fetch!(1) use GenServer require Logger @type from :: {pid, reference} @type init_arg :: term @type pool_state :: term @type wor...
lib/nimble_pool.ex
0.876278
0.558568
nimble_pool.ex
starcoder
defmodule Robolia.Competitions.RandomGroupedAllAgainstAll do @doc """ Generate a list of tuples where each tuple has the players that are going to battle against each other. The players are put in random groups. Which means every time this function is called, the players might battle against another opponent...
lib/robolia/competitions/random_grouped_all_against_all.ex
0.698535
0.687079
random_grouped_all_against_all.ex
starcoder
% Date represents dates, with years, months, and days. Date has no concept of timezones, % while DateTime does(but not currently). This implementation is based on Erlang's date BIF: % http://www.erlang.org/doc/man/erlang.html#date-0 module Date def new(date_tuple) {year, month, day} = date_tuple #Date::Behavi...
lib/date.ex
0.680348
0.526708
date.ex
starcoder
defmodule Collidex.Utils do @moduledoc """ Assorted utilities and geometric transformations. """ alias Collidex.Geometry.Polygon alias Collidex.Geometry.Rect alias Collidex.Geometry.Circle alias Graphmath.Vec2 @doc """ Returns a vector normal to each edge of the shape, in a right-handed coordinate ...
lib/collidex/utils.ex
0.891681
0.93115
utils.ex
starcoder
defmodule Crawlie.PqueueWrapper do @moduledoc """ Wraps the Erlang [pqueue](https://github.com/okeuday/pqueue) `:pqueue`, `:pqueue2`, `:pqueue3` and `:pqueue4` modules functionality for easier use in Elixir and easier swapping of the implementations """ alias __MODULE__, as: This alias Crawlie.Page @...
lib/crawlie/pqueue_wrapper.ex
0.751283
0.620909
pqueue_wrapper.ex
starcoder
defmodule Co2Offset.Donations.DonationCreationSchema do use Ecto.Schema import Ecto.Changeset alias __MODULE__ alias Co2Offset.Converters alias Co2Offset.Geo schema "donations" do field :iata_from, :string field :iata_to, :string field :original_city_from, :string field :original_city_to,...
lib/co2_offset/donations/donation_creation_schema.ex
0.544317
0.450178
donation_creation_schema.ex
starcoder
defmodule Calendar.ISO.Extension do @moduledoc """ A module to extend the calendar implementation that follows to ISO8601 with methods found in Elixir 1.5.1. This is to allow ESpec to support Elixir >= 1.3.4 more easily. """ @type year :: 0..9999 @type month :: 1..12 @type day :: 1..31 @seconds_per_mi...
lib/espec/extension/calendar_extension.ex
0.904543
0.498535
calendar_extension.ex
starcoder
defmodule EctoAsStateMachine do @moduledoc """ This package allows to use [finite state machine pattern](https://en.wikipedia.org/wiki/Finite-state_machine) in Ecto. 1. Add ecto_as_state_machine to your list of dependencies in `mix.exs`: ```elixir def deps do [{:ecto_as_state_machine, "~> 1.0"}] end ...
lib/ecto_as_state_machine.ex
0.782413
0.868102
ecto_as_state_machine.ex
starcoder
defmodule AWS.AutoScaling do @moduledoc """ Amazon EC2 Auto Scaling Amazon EC2 Auto Scaling is designed to automatically launch or terminate EC2 instances based on user-defined scaling policies, scheduled actions, and health checks. Use this service with AWS Auto Scaling, Amazon CloudWatch, and Elastic Lo...
lib/aws/auto_scaling.ex
0.900685
0.661861
auto_scaling.ex
starcoder
defmodule Broker.Collector.Distributor do @moduledoc """ Documentation for Broker.Collector.Distributor. This lightweight processor will receive all the flow of transactions from tx_feeder(s) or sn_feeder(s) and it will insert them to FIFO queue and will receive ask requests from tx_validator(s) or sn_feed...
apps/broker/lib/collector/distributor/distributor.ex
0.777469
0.402891
distributor.ex
starcoder
defmodule Snap.Indexes do @moduledoc """ Helper functions around index management. """ alias Snap.Bulk alias Snap @doc """ Creates an index. """ @spec create(module(), String.t(), map(), Keyword.t()) :: Snap.Cluster.result() def create(cluster, index, mapping, opts \\ []) do Snap.put(cluster, "...
lib/snap/indexes/indexes.ex
0.753013
0.669493
indexes.ex
starcoder
defmodule Wargaming.Warships.Account do @moduledoc """ Account provides functions for interacting with the WarGaming.net World of Warships Account API. """ use Wargaming.ApiEndpoint, api: Wargaming.Warships @account_list "/account/list/" @account_info "/account/info/" @account_achievements "/account/a...
lib/wargaming/warships/account.ex
0.861145
0.571288
account.ex
starcoder
defmodule ExPokerEval do @moduledoc """ Documentation for ExPokerEval. """ alias ExPokerEval.Card alias ExPokerEval.Rank @doc """ Gets the higest ranked hand from the two given """ def get_highest(black: b_hand, white: w_hand) do with {:ok, b_cards} <- Card.parse_hand(b_hand), {:ok, w_card...
lib/ex_poker_eval.ex
0.832679
0.653061
ex_poker_eval.ex
starcoder
defmodule LinePay.PreapprovedPay do @moduledoc """ Functions for working with accounts at LinePay. Through this API you can: * get an account, LinePay API reference: https://pay.jp/docs/api/#account-アカウント """ @endpoint "payments/preapprovedPay" @doc """ Create a pre approved payment. Creates a pre ap...
lib/line_pay/preapproved_pay.ex
0.881088
0.433442
preapproved_pay.ex
starcoder
defmodule DataTree do alias DataTree.{Node, TreePath} def normalize(tree) do Map.keys(tree) |> Enum.reduce(tree, &normalize(&2, &1)) end def normalize(tree, %TreePath{} = path) do tree = Map.put_new_lazy(tree, path, &Node.new/0) parent = TreePath.parent(path) case TreePath.level(parent) do ...
lib/data_tree.ex
0.593374
0.661359
data_tree.ex
starcoder
defmodule Geometry.PolygonM do @moduledoc """ A polygon struct, representing a 2D polygon with a measurement. A none empty line-string requires at least one ring with four points. """ alias Geometry.{GeoJson, LineStringM, PolygonM, WKB, WKT} defstruct rings: [] @type t :: %PolygonM{rings: [Geometry.co...
lib/geometry/polygon_m.ex
0.92883
0.722008
polygon_m.ex
starcoder
defmodule Jaxon.Decoders.Value do alias Jaxon.ParseError @array 0 @object 1 def decode(events) do value(events, []) end defp parse_error(got, expected) do {:error, %ParseError{ unexpected: got, expected: expected }} end @compile {:inline, value: 2} defp value(e, sta...
lib/jaxon/decoders/value.ex
0.740456
0.728917
value.ex
starcoder
defmodule OpenTelemetryJaeger do @moduledoc """ `OpenTelemetryJaeger` is a library for exporting [OpenTelemetry](https://opentelemetry.io/) trace data, as modeled by [opentelemetry-erlang](https://github.com/open-telemetry/opentelemetry-erlang), to a [Jaeger](https://www.jaegertracing.io/) endpoint. The conf...
lib/opentelemetry_jaeger.ex
0.880013
0.862178
opentelemetry_jaeger.ex
starcoder
defmodule SSE.Chunk do @moduledoc """ Structure and type for Chunk model """ @enforce_keys [:data] defstruct [:comment, :event, :data, :id, :retry] @typedoc """ Defines the Chunk struct. Reference: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Fields ...
lib/sse/chunk.ex
0.821546
0.50238
chunk.ex
starcoder
defmodule Day11 do use Bitwise def part1(input) do Parser.parse(input) |> solve end def part2(input) do Parser.parse(input) |> add_to_first_floor |> solve end defp add_to_first_floor([{1, things} | rest]) do [{1, [{:generator, :dilithium}, {:generator, :elerium}, ...
day11/lib/day11.ex
0.624752
0.620277
day11.ex
starcoder
defmodule CSQuery do @moduledoc """ A query builder for the AWS [CloudSearch][] [structured search syntax][sss]. This query builder is largely inspired by [csquery for Python][csquery.py]. The queries built with this library are raw input to the `q` parameter of a CloudSearch request when `q.parser=structured...
lib/csquery.ex
0.910132
0.86771
csquery.ex
starcoder
defmodule ExUnit.Diff do @moduledoc false @doc """ Formats the difference between `left` and `right`. Returns `nil` if they are not the same data type, or if the given data type is not supported. """ def format(left, right, formatter) def format(left, right, formatter) when is_binary(left) and ...
lib/ex_unit/lib/ex_unit/diff.ex
0.798972
0.62266
diff.ex
starcoder
defmodule XPlane.Cmd do @moduledoc """ Send X-Plane commands. """ @listen_port 59001 use GenServer # API @doc """ Start GenServer controlling port used to send commands to a specific X-Plane instance. ## Parameters - instance: X-Plane instance from list returned by `XPlane...
lib/xplane_cmd.ex
0.834238
0.440951
xplane_cmd.ex
starcoder
defmodule RobotSimulator do defstruct direction: :north, position: {0, 0} @bearings [:north, :east, :south, :west] @instructions %{ "A" => :advance, "L" => :turn_left, "R" => :turn_right } alias __MODULE__, as: RobotSimulator defguardp invalid_direction?(direction) when not (direction in @bea...
elixir/robot-simulator/lib/robot_simulator.ex
0.909299
0.785473
robot_simulator.ex
starcoder
defmodule GenNNTP do @moduledoc ~S""" The NNTP client and server library. This module provides both the behaviour for an NNTP server, and the client API to interact with a NNTP server. All functionality is defined in `:gen_nntp`. This Elixir module is just a wrapper for `:gen_nntp`. ## Example The `...
lib/gen_nntp.ex
0.836688
0.744238
gen_nntp.ex
starcoder
defmodule AdyenCheckoutEx.Model.AdditionalDataRisk do @moduledoc """ """ @derive [Poison.Encoder] defstruct [ :"riskdata.[customFieldName]", :"riskdata.basket.item[itemNr].amountPerItem", :"riskdata.basket.item[itemNr].brand", :"riskdata.basket.item[itemNr].category", :"riskdata.basket....
lib/adyen_checkout_ex/model/additional_data_risk.ex
0.658966
0.403332
additional_data_risk.ex
starcoder
defmodule ExWire.Packet.Status do @moduledoc """ Status messages establish a proper Eth Wire connection, and verify the two clients are compatable. ``` **Status** [`+0x00`: `P`, `protocolVersion`: `P`, `networkId`: `P`, `td`: `P`, `bestHash`: `B_32`, `genesisHash`: `B_32`] Inform a peer of its current ether...
apps/ex_wire/lib/ex_wire/packet/status.ex
0.883663
0.840586
status.ex
starcoder
defmodule Cocktail.Validation.Interval do @moduledoc false import Integer, only: [mod: 2, floor_div: 2] import Cocktail.Validation.Shift @typep iso_week :: {Timex.Types.year(), Timex.Types.weeknum()} @type t :: %__MODULE__{type: Cocktail.frequency(), interval: pos_integer} @enforce_keys [:type, :interva...
lib/cocktail/validation/interval.ex
0.852675
0.610802
interval.ex
starcoder
defmodule ExSieve do @moduledoc """ `ExSieve` is meant to be `use`d by a module implementing `Ecto.Repo` behaviour. When used, optional configuration parameters can be provided. For details about cofngiuration parameters see `t:ExSieve.Config.t/0`. defmodule MyApp.Repo do use Ecto.Repo, otp_app:...
lib/ex_sieve.ex
0.914355
0.759136
ex_sieve.ex
starcoder
defmodule Spell.Peer do @moduledoc """ The `Spell.Peer` module implements the general WAMP peer behaviour. From the WAMP protocol: > A WAMP Session connects two Peers, a Client and a Router. Each WAMP > Peer can implement one or more roles. See `new` for documentation on starting new peers. """ use G...
lib/spell/peer.ex
0.88452
0.403626
peer.ex
starcoder
defmodule TomlElixir.Mapper do @moduledoc """ Module for transforming toml list to map format """ alias TomlElixir.Error @doc """ Transform TOML list to map format """ @spec parse(list) :: map def parse([]), do: %{} def parse(toml) when is_list(toml), do: to_map(toml, {[], %{}}) @spec to_map(lis...
lib/toml_elixir/mapper.ex
0.657758
0.654267
mapper.ex
starcoder
defmodule Idconex do @moduledoc """ Creates an identicon for a given username. Use `render/1` to create a usual github like identicon. Use `render/2` to create an extended identicon. Use `encode64/1` to get the identicon as a base64 encoded png image. Use `save/2` to save the identicon as a png image file...
lib/idconex.ex
0.892234
0.660087
idconex.ex
starcoder