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 Grizzly.Packet do @moduledoc """ Module for working with raw Z/IP packets This is used to marshell a Z/IP packet of bytes into an Elixir data structure for use to work with. This data structure is a more "lower level" repersentation of the messaging between this library and Zwave. Most the time ...
lib/grizzly/packet.ex
0.536799
0.423339
packet.ex
starcoder
defmodule Statisaur.Bivariate do @moduledoc """ Contains functions for computing bivariate statistics. """ @doc """ Finds the covariance between two lists ### Examples iex>Statisaur.Bivariate.covariance([1,3,5,7,9],[10,20,30,40,50]) 50.0 """ def covariance(list1, list2) when is_list(list1) ...
lib/statisaur/bivariate.ex
0.856392
0.698709
bivariate.ex
starcoder
defmodule Zaryn.BeaconChain do @moduledoc """ Manage the beacon chain by providing functions to add to the subsets information and to retrieve the beacon storage nodes involved. """ alias Zaryn.Election alias Zaryn.BeaconChain.Slot alias Zaryn.BeaconChain.Slot.EndOfNodeSync alias Zaryn.BeaconChain.Slo...
lib/zaryn/beacon_chain.ex
0.884763
0.541288
beacon_chain.ex
starcoder
defmodule BMFont do @moduledoc """ Parses text and binary BMFont files in accordance with the [AngelCode spec](http://www.angelcode.com/products/bmfont/doc/file_format.html). Everything is kept pretty much as is, with the exception of some of the fields being renamed to their longer forms. ...
lib/bmfont.ex
0.829596
0.444444
bmfont.ex
starcoder
defmodule GitHubActions.Workflow do @moduledoc """ The `GitHubActions.Workflow` is used to create a GitHub actions workflow. ```elixir defmodule Minimal do use GitHubActions.Workflow def workflow do [ name: "CI" ] end end ``` The workflow module must define the `workflow...
lib/git_hub_actions/workflow.ex
0.769817
0.897695
workflow.ex
starcoder
defmodule Neoscan.Assets do @moduledoc """ The boundary for the Assets system. """ @page_size 15 import Ecto.Query, warn: false alias Neoscan.Repo alias Neoscan.Asset alias Neoscan.Counter @doc """ Gets a single asset by its hash value ## Examples iex> get(123) %Block{} iex> g...
apps/neoscan/lib/neoscan/assets/assets.ex
0.814053
0.453867
assets.ex
starcoder
defmodule Day5 do @moduledoc """ --- Day 5: A Maze of Twisty Trampolines, All Alike --- An urgent interrupt arrives from the CPU: it's trapped in a maze of jump instructions, and it would like assistance from any programs with spare cycles to help find the exit. The message includes a list of the offsets fo...
lib/day5.ex
0.73848
0.883638
day5.ex
starcoder
defmodule Nostrum.Struct.Guild.Member do @moduledoc ~S""" Struct representing a Discord guild member. A `Nostrum.Struct.Guild.Member` stores a `Nostrum.Struct.User`'s properties pertaining to a specific `Nostrum.Struct.Guild`. ## Mentioning Members in Messages A `Nostrum.Struct.Guild.Member` can be menti...
lib/nostrum/struct/guild/member.ex
0.867204
0.729941
member.ex
starcoder
defmodule Akd.Generator.Task do @moduledoc """ This module handles the generation of a custom task which use `Akd.Task`. This can either directly be called, or called through a mix task, `mix akd.gen.task`. This class uses EEx and Mix.Generator to fetch file contents from an eex template and populate the i...
lib/akd/generator/task.ex
0.88471
0.875095
task.ex
starcoder
defmodule Ockam.Session.Pluggable.Initiator do @moduledoc """ Simple routing session initiator Upon starting, uses Handshake.init to generate a handshake message and send it to init_route. Initial stage is :handshake, in this stage waits for a handshake response After receiving a handshake response, runs ...
implementations/elixir/ockam/ockam/lib/ockam/session/pluggable/initiator.ex
0.691185
0.5083
initiator.ex
starcoder
defmodule Xpeg.Codegen do @moduledoc false defp emit_inst(ip, inst, options) do case inst do {:nop} -> quote location: :keep do def parse(unquote(ip), s, si, ctx, back_stack, ret_stack, cap_stack, captures) do parse(unquote(ip+1), s, si, ctx, back_stack, ret_stack, cap_stac...
lib/codegen.ex
0.571647
0.598899
codegen.ex
starcoder
defmodule Holidays.Definitions.Us do import Holidays.Define alias Holidays.DateCalculator.DateMath @moduledoc """ United States holiday definitions. """ def init() do holiday "Good Friday", %{regions: [:us], function: {Holidays, :easter, [:year], -2}, type: :informal} holid...
lib/holidays/definitions/us.ex
0.793226
0.789477
us.ex
starcoder
defmodule Axon.Initializers do @moduledoc """ Parameter initializers. Parameter initializers are used to initialize the weights and biases of a neural network. Because most deep learning optimization algorithms are iterative, they require an initial point to iterate from. Sometimes the initialization of...
lib/axon/initializers.ex
0.894384
0.821188
initializers.ex
starcoder
require Record defmodule Geef.Reference do import Geef alias Geef.Reference defstruct repo: nil, name: nil, type: nil, target: nil def create(repo, name, target, force \\ :false) do # fixme: this needs to ask the repo itself repo_handle = :geef_repo.handle(repo) case :geef_nif.reference_create(re...
lib/geef/reference.ex
0.522446
0.400134
reference.ex
starcoder
defmodule JTD.TypeError do @type t :: %__MODULE__{message: String.t()} defexception message: nil def message(%{message: message}) do message end end defmodule JTD.Schema do @moduledoc """ Module to convert Map to JSON Type Definition schema struct. """ alias JTD.TypeError @keywords [ :m...
lib/schema.ex
0.78016
0.625381
schema.ex
starcoder
defmodule Finch.Telemetry do @moduledoc """ Telemetry integration. Unless specified, all times are in `:native` units. Finch executes the following events: ### Request Start `[:finch, :request, :start]` - Executed when `Finch.request/3` or `Finch.stream/5` is called. #### Measurements * `:system...
lib/finch/telemetry.ex
0.921012
0.734477
telemetry.ex
starcoder
defmodule Day15.Redo do def part1(file_name \\ "test.txt") do file_name |> parse() |> dijkstra() end def part2(file_name \\ "test.txt") do file_name |> parse() |> add_mins() |> add_direction() |> add_final_step(24) |> expand_grid() |> dijkstra() end def pop(queue) do ...
jpcarver+elixir/day15/lib/day15.redo.ex
0.501953
0.450601
day15.redo.ex
starcoder
module List module Behavior % Returns a new list as a concatenation of the given number % of the original list. If n is a string, then the behavior is the same as join. % % ## Examples % % [1] * 3 % => [1,1,1] % [1,2] * 2 % => [1,2,1,2] % [1,2,3] * "," % => "1,2,3" ...
lib/list.ex
0.745954
0.666883
list.ex
starcoder
defmodule Steroids.Utils do @spec boolMerge(list) :: map def boolMerge([]), do: %{} # If we are a single bool should we need to include the condition def boolMerge([{:query, field, condition, query}]) when condition != :must, do: context(:query, field, condition, query) def boolMerge([{:filter, field, con...
lib/utils.ex
0.697712
0.501526
utils.ex
starcoder
defmodule BSV.MerkleProof do @moduledoc """ The MerkleProof module implements the [BSV TCS Merkle proof standard](https://tsc.bitcoinassociation.net/standards/merkle-proof-standardised-format/). Merkle proofs are fundamental to the Simplified Payment Verification (SPV) model that underpins bitcoin scaling. Ass...
lib/bsv/merkle_proof.ex
0.914515
0.65758
merkle_proof.ex
starcoder
defmodule Appsignal.TransactionBehaviour do @callback start(String.t(), atom) :: Appsignal.Transaction.t() @callback start_event() :: Appsignal.Transaction.t() @callback finish_event(Appsignal.Transaction.t() | nil, String.t(), String.t(), any, integer) :: Appsignal.Transaction.t() @callback finis...
lib/appsignal/transaction.ex
0.832985
0.501343
transaction.ex
starcoder
defmodule Day07 do @moduledoc """ Advent of Code 2019 Day 7: Amplification Circuit """ alias Day07.{Part1, Part2} def get_program() do Path.join(__DIR__, "inputs/day07.txt") |> File.read!() |> String.trim() |> String.split(",") |> Enum.map(&String.to_integer/1) end def execute() d...
lib/day07.ex
0.600891
0.417301
day07.ex
starcoder
defmodule ComplexNumbers do @typedoc """ In this module, complex numbers are represented as a tuple-pair containing the real and imaginary parts. For example, the real number `1` is `{1, 0}`, the imaginary number `i` is `{0, 1}` and the complex number `4+3i` is `{4, 3}'. """ @type complex :: {float, float...
exercises/practice/complex-numbers/.meta/example.ex
0.939665
0.789193
example.ex
starcoder
defmodule Brando.Blueprint.Attributes do @moduledoc """ ### Attributes #### Uniqueness To create an unique index in the db as well as running `unique_constraint` in the changeset: attribute :email, unique: true If you have fields that need to be unique together: attribute :email, unique: [w...
lib/brando/blueprint/attributes.ex
0.755186
0.448306
attributes.ex
starcoder
defmodule Abbrev do @moduledoc """ Calculates the set of unambiguous abbreviations for a given set of strings. """ @doc """ Given a set of strings, calculate the set of unambiguous abbreviations for those strings, and return a map where the keys are all the possible abbreviations and the values are the f...
lib/abbrev.ex
0.805594
0.614481
abbrev.ex
starcoder
defmodule LatLong do @moduledoc """ A parser for all the ways that a longitude or latitude may be specified. Comments and suggestions on how this might have been better written are welcome. The following lat long formats are allowed ... all are equivalent: - 38.8977, -77.0365 - 38° 53' 51.635" N, 77° 2' ...
lib/latlong.ex
0.901853
0.713132
latlong.ex
starcoder
defmodule Blockchain.Chain do @moduledoc """ Represents the information about a specific chain. This will either be a current chain (such as homestead), or a test chain (such as ropsten). Different chains have different parameters, such as accounts with an initial balance and when EIPs are implemented. F...
apps/blockchain/lib/blockchain/chain.ex
0.913886
0.551091
chain.ex
starcoder
defmodule XDR.Struct do @moduledoc """ This module manages the `Structure` type based on the RFC4506 XDR Standard. """ @behaviour XDR.Declaration alias XDR.StructError defstruct [:components] @typedoc """ `XDR.Struct` structure type specification. """ @type t :: %XDR.Struct{components: keyword()...
lib/xdr/struct.ex
0.939609
0.533276
struct.ex
starcoder
defmodule Ada.Workflow do @moduledoc """ The Ada.Workflow module specifies a behaviour which needs to be implemented by all workflows. ## Core concepts A workflow has a set of requirements which define the parameters required for its correct execution (e.g. it may require a user id). It separates the *...
lib/ada/workflow.ex
0.83952
0.687007
workflow.ex
starcoder
defmodule Plaid.PaymentInitiation.Recipients do @moduledoc """ Functions for Plaid `payment_initiation/recipient` endpoints. """ import Plaid, only: [make_request_with_cred: 4, validate_cred: 1] alias Plaid.Utils @derive Jason.Encoder defstruct recipient_id: nil, request_id: nil @type t ...
lib/plaid/payment_initiation/recipients.ex
0.784402
0.628621
recipients.ex
starcoder
defmodule Ambry.Books do @moduledoc """ Functions for dealing with Books. """ import Ambry.{FileUtils, SearchUtils} import Ecto.Query alias Ambry.Books.{Book, BookFlat} alias Ambry.Media.Media alias Ambry.{PubSub, Repo} @book_direct_assoc_preloads [book_authors: [:author], series_books: [:series]] ...
lib/ambry/books.ex
0.85246
0.47792
books.ex
starcoder
defmodule TelemetryWrappers do @moduledoc """ Documentation for TelemetryWrappers. """ defmacro __using__(_opts) do quote do import TelemetryWrappers, only: [deftimed: 2, deftimed: 3, deftimed: 4, deftimedp: 2, deftimedp: 3, deftimedp: 4] require TelemetryWrappers end end @doc...
lib/telemetry_wrappers.ex
0.891693
0.594875
telemetry_wrappers.ex
starcoder
defmodule TypeCheck.Builtin.FixedMap do @moduledoc """ Checks whether the value is a list with the expected elements On failure returns a problem tuple with: - `:not_a_map` if the value is not a map - `:missing_keys` if the value does not have all of the expected keys. The extra information contains in this ...
lib/type_check/builtin/fixed_map.ex
0.716318
0.688468
fixed_map.ex
starcoder
defmodule ElixirLeaderboard.Indexer do @moduledoc """ Indexer walks the entire leaderboard and calculates the needed stats, such as rank and percentile. You can customize the stats by creating a custom indexer — a struct consisting of 2 callback functions: - `on_rank` is called when the indexer finishes...
lib/elixir_leaderboard/indexer.ex
0.886629
0.755502
indexer.ex
starcoder
defmodule Day15 do def part1(input) do map = parse(input) solve(map) end def part2(input) do grid = parse(input) {max_x, max_y} = find_lower_right(grid) width = max_x + 1 height = max_y + 1 grid = grid |> Enum.reduce(grid, fn {{x, y}, risk}, grid -> Enum.reduce(1..4, grid, ...
day15/lib/day15.ex
0.581778
0.643448
day15.ex
starcoder
defmodule PersistentList.Day01 do alias PersistentList.Day01, as: List defstruct head: nil, tail: nil defimpl String.Chars, for: List do def to_string(list), do: "[" <> string_from(list) <> "]" defp string_from(%List{head: nil, tail: nil}), do: "" defp string_from( %List{ ...
persistent_list/lib/persistent_list/day01.ex
0.595022
0.442335
day01.ex
starcoder
defmodule RemoteIp.Debugger do require Logger @moduledoc """ Compile-time debugging facilities. `RemoteIp` uses the `debug/3` macro to instrument its implementation with *debug events* at compile time. If an event is enabled, the macro will expand into a `Logger.debug/2` call with a specific message. If a...
lib/remote_ip/debugger.ex
0.882687
0.845942
debugger.ex
starcoder
defmodule Joken do @moduledoc """ Joken is a library for working with standard JSON Web Tokens. It provides 4 basic operations: - Verify: the act of confirming the signature of the JWT; - Validate: processing validation logic on the set of claims; - Claim generation: generate dynamic value at token creati...
lib/joken.ex
0.913857
0.897201
joken.ex
starcoder
defmodule Parser do @moduledoc """ Entrypoint to parse SPARQL queries and the W3C EBNF syntax. """ @type syntax :: %{optional(atom) => any} @type unparsed_query :: String.t() @type query :: %InterpreterTerms.SymbolMatch{} | %InterpreterTerms.WordMatch{} @spec parse_sparql() :: syntax def parse_sparql()...
lib/parser.ex
0.761627
0.463141
parser.ex
starcoder
defmodule SanbaseWeb.Graphql.CustomTypes.DateTime do use Absinthe.Schema.Notation scalar :datetime, name: "DateTime" do description(""" The `DateTime` scalar type represents a date and time in the UTC timezone. The DateTime appears in a JSON response as an ISO8601 formatted string, including UTC ti...
lib/sanbase_web/graphql/schema/custom_types/datetime.ex
0.913068
0.482368
datetime.ex
starcoder
defmodule Andy.MockRover.InfraredSensor do @moduledoc "A mock infrared sensor" @behaviour Andy.Sensing alias Andy.Device import Andy.Utils require Logger @max_distance 70 @max_heading 25 def new(port) do %Device{ mod: __MODULE__, class: :sensor, port: port, path: "/mock/i...
lib/andy/platforms/mock_rover/infrared_sensor.ex
0.594787
0.45042
infrared_sensor.ex
starcoder
defmodule Relexe.Steps.Build.PackAndBuild.Commands do defmodule Command do @enforce_keys [:name, :help] defstruct [:name, :help, args: []] @type t :: %__MODULE__{ name: String.t(), help: String.t(), args: [String.t()] } end defmodule CompoundCommand do ...
lib/steps/build/pack_and_build/commands.ex
0.519765
0.478712
commands.ex
starcoder
if Cldr.Code.ensure_compiled?(Cldr.Unit) do defmodule Cldr.HTML.Unit do @moduledoc """ Implements `Phoenix.HTML.Form.select/4` specifically for localised unit display. """ @type select_options :: [ {:units, [atom() | binary(), ...]} | {:locale, Cldr.Locale.locale_name() |...
lib/cldr_html_units.ex
0.854354
0.611063
cldr_html_units.ex
starcoder
defmodule GrovePi.Analog do alias GrovePi.Board @moduledoc ~S""" Perform analog I/O using the GrovePi. Analog reads return 10-bit values (0-1023) from analog to digital converters on the GrovePi. These values map to voltages between 0 and 5 volts. Analog writes generate a steady square wave on supported p...
lib/grovepi/analog.ex
0.844633
0.94625
analog.ex
starcoder
defmodule Bolt.Sips.Internals.BoltProtocolV1 do @moduledoc false alias Bolt.Sips.Internals.BoltProtocolHelper alias Bolt.Sips.Internals.BoltVersionHelper alias Bolt.Sips.Internals.Error @hs_magic <<0x60, 0x60, 0xB0, 0x17>> @doc """ Initiates the handshake between the client and the server. See [http:...
lib/bolt_sips/internals/bolt_protocol_v1.ex
0.84607
0.523603
bolt_protocol_v1.ex
starcoder
defmodule AWS.SecretsManager do @moduledoc """ AWS Secrets Manager API Reference AWS Secrets Manager provides a service to enable you to store, manage, and retrieve, secrets. This guide provides descriptions of the Secrets Manager API. For more information about using this service, see the [AWS Secrets M...
lib/aws/generated/secrets_manager.ex
0.876793
0.657209
secrets_manager.ex
starcoder
defmodule ThousandIsland.Handler do @moduledoc """ `ThousandIsland.Handler` defines the behaviour required of the application layer of a Thousand Island server. When starting a Thousand Island server, you must pass the name of a module implementing this behaviour as the `handler_module` parameter. Thousand Isla...
lib/thousand_island/handler.ex
0.937555
0.888614
handler.ex
starcoder
defmodule Sanbase.Clickhouse.HistoricalBalance do @moduledoc ~s""" Module providing functions for historical balances and balance changes. This module dispatches to underlaying modules and serves as common interface for many different database tables and schemas. """ use AsyncWith @async_with_timeout 29_...
lib/sanbase/clickhouse/historical_balance/historical_balance.ex
0.851552
0.435361
historical_balance.ex
starcoder
defmodule Dynamo do @moduledoc """ Run, Dynamo, Run! This is the main module in the Dynamo repository. It allows users to configure the Dynamo framework and define their own Dynamos. A very simple Dynamo can be defined as follow: defmodule MyDynamo do use Dynamo endpoint SomeRouter ...
lib/dynamo.ex
0.873781
0.576572
dynamo.ex
starcoder
defmodule Nx.Defn.Tree do @moduledoc """ Helper functions to traverse expressions. """ alias Nx.Defn.Expr alias Nx.Tensor, as: T @doc """ Helper to traverse the arguments of a tensor expression. Note the arguments of function nodes are never traversed, as it is not always desired to recursively mod...
lib/nx/defn/tree.ex
0.882624
0.713907
tree.ex
starcoder
defmodule Grizzly.Trace do @moduledoc """ Module that tracks the commands that are sent and received by Grizzly The trace will hold in memory the last 300 messages. If you want to generate a log file of the trace records you use `Grizzly.Trace.dump/1`. The log format is: ``` timestamp source destinatio...
lib/grizzly/trace.ex
0.834778
0.702594
trace.ex
starcoder
defmodule Benchmark do @moduledoc """ Benchmarks the CPU and Memory consumption for struct operations with type checking comparing to native ones. """ alias Benchmark.{Inputs, Samples, Tweet} @warmup_time_s 2 @cpu_time_s 8 @memory_time_s 2 def run do count = 3_000 puts_title("Generating #{c...
benchmark/lib/benchmark.ex
0.77373
0.540742
benchmark.ex
starcoder
defmodule Fastfwd.Modules do alias Fastfwd.Namespace @moduledoc """ Interact with Fastfwd-compatible modules - find, filter, build maps. """ @doc """ Lists *all* modules, whether or not they are using Fastfwd. Returns a list of module names, including both Elixir style and Erlang atoms. ## Examples...
lib/fastfwd/modules.ex
0.76782
0.411613
modules.ex
starcoder
defmodule Trunk.Storage do @moduledoc """ This is a behaviour that can be implemented by any storage module to make sure it supports all required functions. """ @type opts :: Keyword.t() @doc ~S""" Save the `source_file` to the storage system on path `Path.join(directory, filename)` - `directory` - The...
lib/trunk/storage.ex
0.806281
0.679425
storage.ex
starcoder
defmodule Clickhousex.Codec.Binary.Extractor do @moduledoc """ Allows modules that `use` this module to create efficient extractor functions that speak clickhouse's binary protocol. To define extractors, annotate a function with the `extract` attribute like this: @extract length: :varint def extrac...
lib/clickhousex/codec/binary/extractor.ex
0.80502
0.514034
extractor.ex
starcoder
defmodule Day13.Paper do defstruct dots: MapSet.new(), folds_left: [] @doc """ Get a Paper struct from a string representation (a.k.a. puzzle input) """ def parse(string) do [dots_input, folds_input] = String.split(string, "\n\n") %__MODULE__{ dots: parse_dots(dots_input), folds_left: par...
day13/solver.ex
0.823967
0.513607
solver.ex
starcoder
defmodule DiscUnion do @moduledoc """ Discriminated unions for Elixir - for building algebraic data types. Allows for building data structure with a closed set of representations/cases as an alternative for a set of tuple+atom combo. Elixir already had product type - tuples. With DiscUnion library, sum-types...
lib/disc_union.ex
0.892469
0.838084
disc_union.ex
starcoder
defmodule Stripe.Customers do @moduledoc """ Customer objects allow you to perform recurring charges and track multiple charges that are associated with the same customer. The API allows you to create, delete, and update your customers. You can retrieve individual customers as well as a list of all your custo...
lib/stripe/customers.ex
0.86053
0.712282
customers.ex
starcoder
defmodule BitwiseIp do @moduledoc """ A struct representing an IP address encoded as an integer. The [Internet Protocol](https://en.wikipedia.org/wiki/Internet_Protocol) defines computer network addresses using fixed-width integers, which are efficient for both transmission and the implementation of logic us...
lib/bitwise_ip.ex
0.957814
0.95018
bitwise_ip.ex
starcoder
defmodule Deparam.Params do @moduledoc """ A generic parameter parser and coercer. """ alias Deparam.DeepMapGet alias Deparam.InvalidParamError alias Deparam.Type @typedoc """ A type describing a parameter collection. """ @type params :: %{optional(String.t()) => any} @typedoc """ A type desc...
lib/deparam/params.ex
0.913131
0.493287
params.ex
starcoder
defmodule Commanded.Registration.HordeRegistry do import Commanded.Registration.HordeRegistry.Util alias Commanded.Registration.HordeRegistry.NodeListener require Logger @moduledoc """ Process registration and distribution via [Horde](https://github.com/derekkraan/horde) In order to use this, you will nee...
lib/commanded/registration/horde_registry.ex
0.738669
0.648139
horde_registry.ex
starcoder
defmodule Hunter.Api do @moduledoc """ Hunter API contract """ ## Account @doc """ Retrieve account of authenticated user ## Parameters * `conn` - connection credentials """ @callback verify_credentials(conn :: Hunter.Client.t()) :: Hunter.Account.t() @doc """ Make changes to the authent...
lib/hunter/api.ex
0.890035
0.430267
api.ex
starcoder
defmodule ExOauth2Provider.Plug do @moduledoc """ ExOauth2Provider.Plug contains functions that assist with interacting with ExOauth2Provider via Plugs. ExOauth2Provider.Plug is not itself a plug. Use the helpers to look up current_access_token and current_resource_owner. ## Example ExOauth2Provide...
lib/ex_oauth2_provider/plug.ex
0.856647
0.416055
plug.ex
starcoder
defmodule State.Pagination do @moduledoc """ Utility module to paginate result-set items. """ alias State.Pagination.Offsets @typep page_count :: pos_integer @type page_size :: non_neg_integer @type offset :: non_neg_integer @type pagination_option :: {:limit, page_size} | {:offset,...
apps/state/lib/state/pagination.ex
0.89523
0.422356
pagination.ex
starcoder
defmodule HTTPStream.Request do @moduledoc """ Struct that represents a request. Fields: * `scheme`: `atom()` - e.g. `:http` * `host`: `binary()` - e.g. `"localhost"` * `port`: `integer()` - e.g. `80` * `path`: `binary()` - e.g `"/users/1/avatar.png"` * `method`: `String.t()` - e.g. `"GET"` * `heade...
lib/http_stream/request.ex
0.926769
0.424859
request.ex
starcoder
defmodule AbsintheCache.DocumentProvider do @moduledoc ~s""" Custom Absinthe DocumentProvider for more effective caching. Absinthe phases have one main difference in comparison to plugs - all phases must run and cannot be halted. But phases can be jumped over by returning `{:jump, result, destination_phase}`...
lib/document_provider.ex
0.825238
0.555737
document_provider.ex
starcoder
defmodule Grizzly.CommandClass.Configuration.Set do @moduledoc """ Command module for working with the Configuration command class SET command Command Options: * `:config_param` - The parameter for the configuration item outlined in the device's Z-Wave spec * `:size` - The amount of bytes in terms of by...
lib/grizzly/command_class/configuration/set.ex
0.841223
0.415877
set.ex
starcoder
defmodule Manic.Fees do @moduledoc """ Query dynamic fee rates from Bitcoin miners, and calculate accurate transaction fees. Miners are moving to a model where they will fix their fees in Fiat terms. In addition, miners will compete with each other and some may specialise in different types on transactions...
lib/manic/fees.ex
0.880944
0.666117
fees.ex
starcoder
defmodule WhiteBread.Outputers.JSON do use GenServer @moduledoc """ This generic server accumulates information about White Bread scenarios then formats them as JSON and outputs them to a file in one go. """ defstruct path: nil, data: [] ## Client Interface @doc false def start do {:ok, outp...
lib/white_bread/outputers/json.ex
0.557604
0.431584
json.ex
starcoder
defmodule Boss.WebController do defmacro __using__(_) do quote do Module.register_attribute __MODULE__, :__routes__, persist: false, accumulate: true @before_compile unquote(__MODULE__) import unquote(__MODULE__) end end defmacro get(action, tokens, block) do handle(:GET, action, t...
priv/web_controller.ex
0.54359
0.40987
web_controller.ex
starcoder
if Code.ensure_loaded?(Jason) do defmodule AbsintheRelayKeysetConnection.CursorTranslator.Base64Hashed do @moduledoc """ A cursor translator implementation that uses base64 and a hashed padding. A tamper-resistant (not tamper-proof) implementation that uses base64 and a hashed padding. These values ...
lib/absinthe_relay_keyset_connection/cursor_translator/base64_hashed.ex
0.896546
0.817101
base64_hashed.ex
starcoder
defmodule RDF.XSD.Facet do @moduledoc """ A behaviour for XSD restriction facets. Here's a list of all the `RDF.XSD.Facet`s RDF.ex implements out-of-the-box: | XSD facet | `RDF.XSD.Facet` | | :-------------- | :------------- | | length | `RDF.XSD.Face...
lib/rdf/xsd/facet.ex
0.891646
0.948585
facet.ex
starcoder
defmodule Fix do @type fix() :: (Macro.t() -> Macro.t()) | built_in() @typep built_in() :: tuple() @doc """ Transforms code in `string` according to `fixes`. A "fix" is a 1-arity function that transforms the AST. The function is given to `Macro.prewalk/2`. There's also a list of pre-prepared fixes that...
lib/fix.ex
0.873417
0.532121
fix.ex
starcoder
defmodule Odo.Bucket do @moduledoc """ `Odo.Bucket` is a simple `GenServer` based token bucket. To start a new token bucket call `Odo.Bucket.new_bucket/2` with the name for the bucket and values for the number of tokens the bucket should hold. Once the bucket is running call `Odo.Bucket.get_token...
lib/odo.ex
0.826817
0.627752
odo.ex
starcoder
defmodule Gyx.Agents.SARSA.Agent do @moduledoc """ This agent implements SARSA, it takes into account the current state, action, reward (s<sub>t</sub>, a<sub>t</sub>, r<sub>t</sub>) and on policy estimates for the best next action a<sub>t+1</sub> and state s<sub>t+1</sub>. <br/>The Q update is given by: ![s...
lib/agents/sarsa/sarsa_agent.ex
0.92415
0.637687
sarsa_agent.ex
starcoder
defmodule DecemberThree do @moduledoc """ Third Advent of Code task. """ @doc """ The solution for part one. """ def part_one(file) do {_, contents} = File.read(file) [first, second] = contents |> String.trim() |> String.split("\n") |> Enum.map(&draw_wire/1) first ...
03/elixir/lib/december_three.ex
0.813053
0.430387
december_three.ex
starcoder
defmodule Day14 do def from_file(path) do File.stream!(path) |> Enum.to_list |> Enum.map(&parse_row/1) end def parse_material([amount, type]), do: {String.to_integer(amount), String.to_atom(type)} def parse_row(row) do [from, to] = Regex.run(~r{(.*) => (.*)}, row, capture: :all_but_first) ...
lib/day14.ex
0.508544
0.482124
day14.ex
starcoder
defmodule LastfmArchive.Transform do @moduledoc """ This module provides functions for reading and transforming downloaded Lastfm data. """ alias LastfmArchive.Utils @default_delimiter "\t" @tsv_headers "id\tname\tscrobble_date\tscrobble_date_iso\tmbid\turl\tartist\tartist_mbid\tartist_url\talbum\talbum_...
lib/transform.ex
0.784484
0.76145
transform.ex
starcoder
defmodule PhoenixDatatables.Query do @moduledoc """ Functions for updating an `Ecto.Query` based on Datatables request parameters. """ import Ecto.Query use PhoenixDatatables.Query.Macros alias Ecto.Query.JoinExpr alias PhoenixDatatables.Request.Params alias PhoenixDatatables.Request.Column alias Phoe...
lib/phoenix_datatables/query.ex
0.757436
0.473353
query.ex
starcoder
defmodule EVM.Logger do require Logger alias EVM.{MachineState, Operation} @doc """ Helper function to log the stack given the machine state """ @spec log_stack(MachineState.t()) :: MachineState.t() def log_stack(machine_state) do stack = machine_state.stack |> Enum.map(&stack_value_strin...
apps/evm/lib/evm/logger.ex
0.716219
0.513607
logger.ex
starcoder
defmodule Day23.Router do @moduledoc """ A packet router for a network of Intcode computers. A router keeps track of a collection of `Day23.PacketQueue`s which are each assigned a unique address within the router. When the computers in the network produce output, their packet queue sends that output as a pac...
aoc2019_elixir/apps/day23/lib/router.ex
0.836488
0.65896
router.ex
starcoder
defmodule Entrance.User do @moduledoc """ This module provider helpers functions for your app users management """ alias Entrance.Auth.Secret import Entrance.Config, only: [config: 1] @doc """ Execute this behind the scenes: ``` alias Entrance.Auth.Secret # ... %YourUser{} |> YourUser.creat...
lib/user.ex
0.873626
0.609553
user.ex
starcoder
defmodule Opencensus.Honeycomb.Sender do @event_start [:opencensus, :honeycomb, :start] @event_stop_failure [:opencensus, :honeycomb, :stop, :failure] @event_stop_success [:opencensus, :honeycomb, :stop, :success] @moduledoc """ Sends events to Honeycomb. ## Telemetry `send_batch/1` calls `:telemetry.e...
lib/opencensus/honeycomb/sender.ex
0.692538
0.780328
sender.ex
starcoder
defmodule Cloudinary.Transformation.Width do @moduledoc false defguardp is_width(width) when is_number(width) and width >= 0 defguardp is_rounding_step(rounding_step) when is_number(rounding_step) and rounding_step > 0 defguardp is_bytes_step(bytes_step) when is_integer(bytes_step) and bytes_step >...
lib/cloudinary/transformation/width.ex
0.731155
0.424889
width.ex
starcoder
defmodule EspEx.Projection do @moduledoc """ Project events upon an entity to convert it to an up-to-date value. ## use EspEx.Projection Will provide a default `apply` implementation that will catch any event and just return the entity as is. It will also log a warn, reporting that the event is unhandled....
lib/esp_ex/projection.ex
0.820326
0.768473
projection.ex
starcoder
defmodule Geo.Turf.Helpers do @moduledoc """ A collection of helper utilities. Usually users will not have to refer to this directly but it is here if the need arises. """ @min_bounds {+1.0e+10, +1.0e+10, -1.0e+10, -1.0e+10} @doc """ Create a bounding box for a given `t:Geo.geometry/0`. ## Example...
lib/geo/turf/helpers.ex
0.869922
0.586138
helpers.ex
starcoder
defmodule Remedy.ColourHelpers do @moduledoc """ This module provides a number of helper functions for working with colours. """ @type rgb_tuple :: {0..0xFF, 0..0xFF, 0..0xFF} @type hex_binary :: String.t() @type hex_integer :: 0..0xFFFFFF @doc false @doc section: :guards defguard is_component(r)...
lib/remedy/helpers/colour_helpers.ex
0.783947
0.513425
colour_helpers.ex
starcoder
defmodule Scenic do @moduledoc """ The Scenic module itself is a supervisor that manages all the machinery that makes the [Scenes](overview_scene.html), [ViewPorts](overview_viewport.html), and [Drivers](overview_driver.html) run. In order to run any Scenic application, you will need to start the Scenic su...
lib/scenic.ex
0.649912
0.447219
scenic.ex
starcoder
defmodule Extatus.Process do @moduledoc """ This module defines a behaviour to instrument a `GenServer`s. For an uninstrumented `GenServer` process, i.e: ```elixir defmodule Uninstrumented do use GenServer def start_link, do: GenServer.start_link(__MODULE__, nil) def stop(pid), do: GenServer....
lib/extatus/process.ex
0.878432
0.896024
process.ex
starcoder
defmodule Binance do alias Binance.Rest.HTTPClient # Server @doc """ Pings binance API. Returns `{:ok, %{}}` if successful, `{:error, reason}` otherwise """ def ping() do HTTPClient.get_binance("/api/v3/ping") end @doc """ Get binance server time in unix epoch. Returns `{:ok, time}` if succe...
lib/binance.ex
0.902539
0.740667
binance.ex
starcoder
defmodule Credo.Code.Block do @moduledoc """ This module provides helper functions to analyse blocks, e.g. the block taken by the `if` macro. """ @doc """ Returns the do: block of a given AST node. """ def all_blocks_for!(ast) do [ do_block_for!(ast), else_block_for!(ast), rescue_...
lib/credo/code/block.ex
0.872998
0.670581
block.ex
starcoder
defmodule ExDiceRoller do @moduledoc """ Converts strings into dice rolls and returns expected results. Ignores any spaces, including tabs and newlines, in the provided string. A roll can be invoked via `ExDiceRoller.roll/2`. iex> ExDiceRoller.roll("2d6+3") 8 iex> ExDiceRoller.roll("(1d4)d(6...
lib/ex_dice_roller.ex
0.827898
0.815306
ex_dice_roller.ex
starcoder
defmodule Bootleg.DSL do @moduledoc """ Configuration DSL for Bootleg. """ alias Bootleg.{Config, Role, SSH, UI} defmacro __using__(_) do quote do import Bootleg.DSL, only: [ role: 2, role: 3, config: 2, config: 1, config: 0, bef...
lib/bootleg/dsl.ex
0.872931
0.805861
dsl.ex
starcoder
defmodule Mop8.Bot.WordMap do require Logger alias Mop8.Bot.Ngram alias Mop8.Bot.Selector @opaque t() :: %{ String.t() => %{ heads: pos_integer(), tails: pos_integer(), count: pos_integer(), nexts: [String.t()] } } @s...
lib/mop8/bot/word_map.ex
0.768646
0.478102
word_map.ex
starcoder
defmodule LineWalker do # Return the overall distance walk to a point. # nil when point NOT on the line. def findPointDistanceOnLine([x, y| nextList], targetPoint, currentPoint \\ [0,0], currentDistance \\ 0) do [tx, ty] = targetPoint [cx, cy] = currentPoint cond do (ty == cy) && (MathUtil.inBe...
lib/day3-2.ex
0.699254
0.818156
day3-2.ex
starcoder
defmodule Mazes.Maze do @type vertex :: {integer, integer} @type maze :: %{ adjacency_matrix: %{vertex => %{vertex => boolean}}, from: vertex, to: vertex, module: atom } @callback new(keyword) :: maze @callback center(maze) :: vertex @spec vertices(maze) :: [v...
lib/mazes/maze.ex
0.886629
0.608798
maze.ex
starcoder
defmodule Horde.Registry do @moduledoc """ A distributed process registry. Horde.Registry implements a distributed Registry backed by an add-wins last-write-wins δ-CRDT (provided by `DeltaCrdt.AWLWWMap`). This CRDT is used for both tracking membership of the cluster and implementing the registry functionality it...
lib/horde/registry.ex
0.901874
0.817793
registry.ex
starcoder
defmodule Util.LogRotator do @vsn "0.1.0" use GenServer require Logger @msg :log_rotate @shift 10 @min_diff 1000 @moduledoc """ A napi logokat intezi a `:loggger_file_backend`-hez. `app.ex`: ```elixir defmodule App do use Application def start(_type, _args) do import Supervisor.Sp...
lib/util/log_rotator.ex
0.728652
0.602997
log_rotator.ex
starcoder
defmodule Kaffe.Subscriber do @moduledoc """ Consume messages from a single partition of a single Kafka topic. Assignments are received from a group consumer member, `Kaffe.GroupMember`. Messages are delegated to `Kaffe.Worker`. The worker is expected to cast back a response, at which time the stored offset...
lib/kaffe/consumer_group/subscriber/subscriber.ex
0.860823
0.533276
subscriber.ex
starcoder
defmodule AWS.Route53RecoveryCluster do @moduledoc """ Welcome to the Amazon Route 53 Application Recovery Controller API Reference Guide for Recovery Control Data Plane . Recovery control in Route 53 Application Recovery Controller includes extremely reliable routing controls that enable you to recover app...
lib/aws/generated/route53_recovery_cluster.ex
0.880874
0.480966
route53_recovery_cluster.ex
starcoder