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 ExZipper.Zipper.Editing do @moduledoc """ Utility module for functions that concern editing zippers """ alias ExZipper.Zipper @doc """ Replaces the current focus with the node passed as the second argument. ## Examples iex> zipper = Zipper.list_zipper([1,[],[2,3,[4,5]]]) iex> zip...
lib/ex_zipper/zipper/editing.ex
0.761627
0.461927
editing.ex
starcoder
defmodule ExUnit.Case do @moduledoc """ This module is meant to be used in other modules as a way to configure and prepare them for testing. When used, it allows the following options: * :async - configure Elixir to run that specific test case in parallel with others. Must be used for performan...
lib/ex_unit/lib/ex_unit/case.ex
0.836855
0.541227
case.ex
starcoder
defmodule XUtil.Map do @moduledoc """ Syntactic sugar for working with maps. """ @doc """ Returns a function to grab the value associated with key from your map (probably a struct). Useful for composing with Enum algorithms. Examples: iex(1)> [%{a: 2, b: 1}, %{a: 3, b: 2}, %{a: 1, b: 3}] |> Enum.s...
lib/x_util/map.ex
0.801858
0.721204
map.ex
starcoder
defmodule VegaLite.Export do @moduledoc """ Various export methods for a `VegaLite` specification. """ alias VegaLite.Utils @doc """ Saves a `VegaLite` specification to file in one of the supported formats. ## Options * `:format` - the format to export the graphic as, must be either of: `:...
lib/vega_lite/export.ex
0.854202
0.455501
export.ex
starcoder
defmodule Starship.Reactor.Websocket.Frame do @moduledoc """ A websocket frame helper, used to parse and generate websocket frames. """ import Bitwise, only: [bxor: 2] @typep fin_bit :: :fin | :not_fin @typep mask_bit :: :masked | :unmasked @typep payload :: bitstring | binary | nil @typedoc "A websoc...
lib/starship/reactor/websocket/frame.ex
0.601125
0.408395
frame.ex
starcoder
defmodule PushInfluxDB do @moduledoc """ Genserver Module to push channels information to InfluxDB """ use GenServer require Logger alias FSRealtime.InConnection def start_link(_) do GenServer.start_link(__MODULE__, [], name: __MODULE__) end def init(args) do {:ok, args} end @doc """ ...
lib/push_influxdb.ex
0.835953
0.400544
push_influxdb.ex
starcoder
defmodule Anise.SubscriptionCase do @moduledoc """ Conveniences for testing Absinthe subscriptions # Usage ## Setup You need to use `use` macro, and pass required options. ```elixir @endpoint MyAppWeb.Endpoint use Anise.SubscriptionCase, schema: MyAppWeb.Schema, socket: MyAppWeb.UserSocket ...
lib/subscription_case.ex
0.831588
0.536434
subscription_case.ex
starcoder
defmodule Makeup.Styles.HTML.StyleMap do @moduledoc """ This module contains all styles, and facilities to map style names (binaries or atoms) to styles. Style names are of the form `<name>_style`. The supported style names are: `:abap`, `:algol`, `:algol_nu`. You the style name `:abap`, for example, refer...
lib/makeup/styles/html/style_map.ex
0.783285
0.611904
style_map.ex
starcoder
defmodule Re.Addresses.Neighborhoods do @moduledoc """ Context for neighborhoods. """ import Ecto.Query alias Re.{ Address, Addresses.District, Listing, Repo, Slugs } @all_query from( a in Address, join: l in Listing, where: l.address_id ...
apps/re/lib/addresses/neighborhoods.ex
0.704058
0.467757
neighborhoods.ex
starcoder
defmodule AdventOfCode.Day5 do @encoding_regex ~r/^([FB]{7})([LR]{3})$/ @ranges %{ :rows => %{ "F" => :lower, "B" => :upper }, :columns => %{ "L" => :lower, "R" => :upper } } @spec compute_range([binary], :columns | :rows) :: integer def compute_range(input, :rows) do ...
lib/day5.ex
0.737725
0.407805
day5.ex
starcoder
defmodule Weirding.Chain do @moduledoc false # This module provides a basic markov chain for generating text. It also defines # a GenServer. The GenServer is designed to load the pre-built chain when the # weirding application boots, convert the chain from binary back into a term, # and store it in persistent...
lib/weirding/chain.ex
0.675122
0.423935
chain.ex
starcoder
defmodule Irateburgers.TopBurgers do @moduledoc """ Read-model for querying the top rated burgers of all time. """ defmodule Record do @moduledoc """ This struct represents a single row in the Top-Burgers table: 1. "Resolution Breaker", 4.5, 8 Reviews 2. "Brooklyn Cheeseburger", 4.3, 5 Reviews...
lib/burger/read_models/top_burgers.ex
0.840488
0.416322
top_burgers.ex
starcoder
defmodule Cldr.Time do @moduledoc """ Provides an API for the localization and formatting of a `Time` struct or any map with the keys `:hour`, `:minute`, `:second` and optionlly `:microsecond`. CLDR provides standard format strings for `Time` which are reresented by the names `:short`, `:medium`, `:long` ...
lib/cldr/datetime/time.ex
0.943217
0.767842
time.ex
starcoder
defmodule ExPolars.Plot do @moduledoc """ Plotting tools """ alias ExPolars.DataFrame, as: DF alias Deneb.{Chart, Encoding, Mark, Plot} def plot_by_type(df, type, opts \\ []) do {:ok, csv} = DF.to_csv(df) apply(Plot, type, [csv, opts]) end def plot_single(df, mark, x, y, opts \\ []) do de...
lib/ex_polars/plot.ex
0.756313
0.60212
plot.ex
starcoder
defmodule XDR.FixedOpaque do @moduledoc """ This module manages the `Fixed-Length Opaque Data` type based on the RFC4506 XDR Standard. """ @behaviour XDR.Declaration defstruct [:opaque, :length] alias XDR.Error.FixedOpaque, as: FixedOpaqueError @typedoc """ `XDR.FixedOpaque` structure type specifica...
lib/xdr/fixed_opaque.ex
0.919949
0.685107
fixed_opaque.ex
starcoder
defmodule Timex.Parsers.DateFormat.Tokenizers.Default do @moduledoc """ Responsible for tokenizing date/time format strings which use the Default formatter. """ alias Timex.Parsers.DateFormat.ParserState, as: State alias Timex.Parsers.DateFormat.Directive, as: Directive # These are all the default form...
lib/parsers/dateformat/tokenizers/default.ex
0.723602
0.479565
default.ex
starcoder
defmodule Legion.Identity.Information.AddressBook.Address do @moduledoc """ Represents an entry found in address book. ## Schema fields - `:user_id`: The identifier of the user that address belongs to. - `:type`: Type of the address, e.g. "home", "work". - `:name`: Name of the address, e.g. "Home at Rotte...
apps/legion/lib/identity/information/address_book/address.ex
0.815122
0.512815
address.ex
starcoder
defmodule Chex.Piece.King do @moduledoc false alias Chex.{Board, Color, Piece, Square} @behaviour Piece def possible_moves(game, square, color) do moves = possible_squares(square) |> maybe_prepend_castling(game, color) moves -- Board.all_attacking_squares(game, Color.flip(color)) end ...
lib/chex/piece/king.ex
0.758332
0.436562
king.ex
starcoder
defmodule DoIt.Argument do @moduledoc false import DoIt.Helper, only: [validate_list_type: 2] @argument_types [:boolean, :integer, :float, :string] @type t :: %__MODULE__{ name: atom, type: atom, description: String.t(), allowed_values: list } @enforce_keys [...
lib/do_it/argument.ex
0.637144
0.553566
argument.ex
starcoder
defmodule Minesweeper do @mine "*" @beginning_outer_bound -1 @doc """ Annotate empty spots next to mines with the number of mines next to them. """ @spec annotate([String.t()]) :: [String.t()] def annotate([]), do: [] def annotate(board) do board |> Enum.with_index() |> Enum.map(&annotate...
elixir/minesweeper/lib/minesweeper.ex
0.778102
0.553747
minesweeper.ex
starcoder
defmodule TicTacToe.Game do @type position :: integer() @type player_type :: :x | :o @type board_type :: list(player_type()) @board for _ <- 1..9, do: nil @player_x :x @player_o :o @type t :: %__MODULE__{ board: board_type(), current_player: player_type() } defstruct board:...
server/lib/tic_tac_toe/game.ex
0.815012
0.440349
game.ex
starcoder
defmodule SpaceEx.Types.Decoders do alias SpaceEx.API.Type alias SpaceEx.{Protobufs, ObjectReference} @moduledoc false [ {Protobufs.Raw.Bool, true}, {Protobufs.Raw.Bytes, <<1, 2, 3>>}, {Protobufs.Raw.String, "dummy"}, {Protobufs.Raw.Float, 1.23}, {Protobufs.Raw.Double, 1.23}, {Protobuf...
lib/space_ex/types/decoders.ex
0.592431
0.435001
decoders.ex
starcoder
defmodule Riptide.Store.Memory do @moduledoc """ This store persists all data into an ETS table. It will not survive restarts and is best used for local development or in conjunction with `Riptide.Store.Composite` to keep a portion of the tree in memory. ## Configuration ```elixir config :riptide, store...
packages/elixir/lib/riptide/store/store_memory.ex
0.857783
0.76533
store_memory.ex
starcoder
defmodule Crossbar do @moduledoc """ The `Crossbar` module provides commands for configuring, starting, and stopping the Crossbar server. You might want to use it for running tests or interactive development. Why does this module implement the `GenEvent` behavior? It can be hooked into the `ExUnit.EventMan...
lib/crossbar.ex
0.728941
0.483161
crossbar.ex
starcoder
defmodule Polyglot.Parser do # Parse a string to an ast def parse(str) do {:ok, tokens} = tokenise(str, {"", [], 0}) tokens |> Enum.filter(fn (t) -> t != "" end) |> parse_tree([]) end # Tokenise a string defp tokenise("", {buffer, tokens, 0}) do {:ok, Enum.reverse [buffer|tokens]} end...
lib/polyglot/parser.ex
0.672762
0.595669
parser.ex
starcoder
defmodule AWS.MigrationHubConfig do @moduledoc """ The AWS Migration Hub home region APIs are available specifically for working with your Migration Hub home region. You can use these APIs to determine a home region, as well as to create and work with controls that describe the home region. * You must ...
lib/aws/generated/migration_hub_config.ex
0.826116
0.404449
migration_hub_config.ex
starcoder
defmodule AWS.DirectConnect do @moduledoc """ AWS Direct Connect links your internal network to an AWS Direct Connect location over a standard Ethernet fiber-optic cable. One end of the cable is connected to your router, the other to an AWS Direct Connect router. With this connection in place, you can creat...
lib/aws/generated/direct_connect.ex
0.851999
0.431345
direct_connect.ex
starcoder
defmodule SystemRegistry.Node do defstruct parent: [], node: [], key: nil, from: nil @type t :: [ parent: [term], node: [term], key: term, from: pid | nil ] alias SystemRegistry.Storage.Binding, as: B alias SystemRegistry.Transaction import SystemRegistry.Uti...
lib/system_registry/node.ex
0.812607
0.444866
node.ex
starcoder
defmodule Oasis.Parser do @moduledoc false def parse(type, value) when is_bitstring(value) do do_parse(type, value) end def parse(%{"type" => "null"}, nil), do: nil def parse(%{"type" => "array"} = type, value) when is_list(value) do # post request body as :urlencoded or :multipart do_parse_arr...
lib/oasis/parser.ex
0.673084
0.473718
parser.ex
starcoder
defmodule Movement.EntriesCommitProcessor do @no_action_keys ~w(noop autocorrect) @included_slave_actions ~w(new remove renew merge_on_corrected merge_on_proposed merge_on_proposed_force merge_on_corrected_force) @doc """ For list of translations, new data (like the content of a file upload) and a given functi...
lib/movement/entries_commit_processor.ex
0.78838
0.410668
entries_commit_processor.ex
starcoder
defmodule Liquex.Parser.Tag.ControlFlow do @moduledoc false import NimbleParsec alias Liquex.Parser.Argument alias Liquex.Parser.Literal alias Liquex.Parser.Tag @spec boolean_expression(NimbleParsec.t()) :: NimbleParsec.t() def boolean_expression(combinator \\ empty()) do operator = choice([ ...
lib/liquex/parser/tag/control_flow.ex
0.669961
0.493287
control_flow.ex
starcoder
defmodule Tyyppi do @moduledoc """ The main interface to `Tyyppi` library. Usually, functions and macros presented is this module are enough to work with `Tyyppi`. """ use Boundary, exports: [Function, Matchers, Stats] require Logger alias Tyyppi.{Matchers, Stats, T} import Tyyppi.T, only: [normali...
lib/tyyppi.ex
0.781539
0.401394
tyyppi.ex
starcoder
defmodule Cldr.Number do @moduledoc """ Formats numbers and currencies based upon CLDR's decimal formats specification. The format specification is documentated in [Unicode TR35](http://unicode.org/reports/tr35/tr35-numbers.html#Number_Formats). There are several classes of formatting including non-scientific,...
lib/cldr/number.ex
0.936713
0.812012
number.ex
starcoder
defmodule Aggregate.Tasks do @moduledoc """ Task filtering and aggregation functions. All timestamps are converted to the local machine's time zone. """ @day_seconds 24 * 60 * 60 @doc """ Filters and groups the tasks in supplied stream based on the specified regular expression and period. The suppor...
lib/aggregate/tasks.ex
0.89826
0.635731
tasks.ex
starcoder
defmodule Dataloader.KV do @moduledoc """ Simple KV based Dataloader source. This module is a simple key value based data loader source. You must supply a function that accepts ids, and returns a map of values keyed by id. ## Examples """ defstruct [ :load_function, opts: [], batches: %{...
lib/dataloader/kv.ex
0.828072
0.418845
kv.ex
starcoder
defmodule Tint.HSV do @moduledoc """ A color in the HSV (hue, saturation, value) colorspace. """ import Tint.Utils.Cast alias Tint.Utils.Interval defstruct [:hue, :saturation, :value] @type t :: %__MODULE__{ hue: float, saturation: float, value: float } @hue_in...
lib/tint/hsv.ex
0.941399
0.574574
hsv.ex
starcoder
defmodule AWS.ACMPCA do @moduledoc """ This is the *ACM Private CA API Reference*. It provides descriptions, syntax, and usage examples for each of the actions and data types involved in creating and managing private certificate authorities (CA) for your organization. The documentation for each action sho...
lib/aws/acmpca.ex
0.872619
0.662878
acmpca.ex
starcoder
defmodule Hui.URL do @moduledoc """ Struct and utilities for working with Solr URLs and parameters. Use the module `t:Hui.URL.t/0` struct to specify Solr core or collection URLs with request handlers. """ defstruct [:url, handler: "select", headers: [], options: []] @type headers :: HTTPoison.Base.heade...
lib/hui/url.ex
0.917497
0.680043
url.ex
starcoder
defmodule AWS.CodeStar do @moduledoc """ AWS CodeStar This is the API reference for AWS CodeStar. This reference provides descriptions of the operations and data types for the AWS CodeStar API along with usage examples. You can use the AWS CodeStar API to work with: Projects and their resources, by c...
lib/aws/generated/code_star.ex
0.854915
0.571348
code_star.ex
starcoder
defmodule Slug do @moduledoc """ Transform strings from any language into slugs. It works by transliterating Unicode characters into alphanumeric strings (e.g. `字` into `zi`). All punctuation is stripped and whitespace between words are replaced by hyphens. """ @doc """ Returns `string` as a slug or `...
lib/slug.ex
0.839257
0.577227
slug.ex
starcoder
defmodule ExULID.ULID do @moduledoc """ This module provides data encoding and decoding functions according to [ULID](https://github.com/ulid/spec). """ import ExULID.Crockford @max_time 281474976710655 # (2 ^ 48) - 1 @doc """ Generates a ULID. """ def generate do :milli_seconds |> :os.sys...
lib/ex_ulid/ulid.ex
0.829803
0.626653
ulid.ex
starcoder
defmodule Phoenix.HTML.Format do @moduledoc """ Helpers related to formatting text. """ @doc ~S""" Returns text transformed into HTML using simple formatting rules. Two or more consecutive newlines `\n\n` are considered as a paragraph and text between them is wrapped in `<p>` tags. One newline `\n` is...
golf13/deps/phoenix_html/lib/phoenix_html/format.ex
0.917778
0.406126
format.ex
starcoder
defmodule CubDB do @moduledoc """ `CubDB` is an embedded key-value database written in the Elixir language. It runs locally, it is schema-less, and backed by a single file. ## Features - Both keys and values can be any arbitrary Elixir (or Erlang) term. - Simple `get/3`, `put/3`, and `delete/2` opera...
lib/cubdb.ex
0.899709
0.587973
cubdb.ex
starcoder
defmodule ExAliyunOts.DSL do require ExAliyunOts.Const.FilterType, as: FilterType alias ExAliyunOts.TableStore.Condition alias ExAliyunOts.TableStoreFilter.{Filter, ColumnPaginationFilter} @type row_existence :: :ignore | :expect_exist | :expect_not_exist @doc """ Official document in [Chinese](https://h...
lib/ex_aliyun_ots/dsl.ex
0.861188
0.50653
dsl.ex
starcoder
defmodule BitstylesPhoenix.Component.Form do use BitstylesPhoenix.Component import BitstylesPhoenix.Component.Error alias Phoenix.HTML.Form, as: PhxForm @moduledoc """ Components for rendering input elements. ## Common attributes All helpers in this module accept the following attributes. - `form` ...
lib/bitstyles_phoenix/component/form.ex
0.837021
0.436622
form.ex
starcoder
defmodule ExRack.DHT do @moduledoc false use GenServer @period 10_000 # Client def start_link(state) do GenServer.start_link(__MODULE__, state, name: __MODULE__) end def config do Application.fetch_env!(:exrack_firmware, ExRack.DHT) |> Map.new() end def temperature do GenServer.c...
exrack_firmware/lib/exrack_firmware/dht.ex
0.729712
0.414247
dht.ex
starcoder
defmodule Geolix.Adapter.MMDB2 do @moduledoc """ Adapter for Geolix to work with MMDB2 databases. ## Adapter Configuration To start using the adapter with a compatible database you need to add the required configuration entry to your `:geolix` configuration: config :geolix, databases: [ ...
lib/mmdb2.ex
0.873458
0.649071
mmdb2.ex
starcoder
defmodule SpiderMan.Configuration do alias SpiderMan.{Pipeline, Producer, Storage, Utils} @default_settings [ downloader_options: [ producer: Producer.ETS, processor: [max_demand: 1], rate_limiting: [allowed_messages: 10, interval: 1000], pipelines: [Pipeline.DuplicateFilter], pos...
lib/spider_man/configuration.ex
0.866472
0.659213
configuration.ex
starcoder
defmodule Sanbase.Alert.Trigger.TrendingWordsTriggerSettings do @moduledoc ~s""" Trigger settings for trending words alert. The alert supports the following operations: 1. Send the list of trending words at predefined time every day 2. Send an alert if some word enters the list of trending words. 3. Send ...
lib/sanbase/alerts/trigger/settings/trending_words_trigger_settings.ex
0.785555
0.489015
trending_words_trigger_settings.ex
starcoder
defmodule Oban.Telemetry do @moduledoc """ Telemetry integration for event metrics, logging and error reporting. Oban currently emits an event when a job has exeucted: `[:oban, :success]` if the job succeeded or `[:oban, :failure]` if there was an error or the process crashed. All job events share the same ...
lib/oban/telemetry.ex
0.869645
0.927495
telemetry.ex
starcoder
defmodule Benchee.Statistics do @moduledoc """ Statistics related functionality that is meant to take the raw benchmark run times and then compute statistics like the average and the standard deviation. """ alias Benchee.{Conversion.Duration, Scenario, Suite, Utility.Parallel} alias Benchee.Statistics.Mod...
lib/benchee/statistics.ex
0.940776
0.736045
statistics.ex
starcoder
defmodule LcdDisplay.HD44780.Util do @moduledoc """ A collection of utility functions that are used for display drivers. """ @type row_col_pos :: {non_neg_integer, non_neg_integer} @typedoc """ Typically 2x16 or 4x20. """ @type display_config :: %{ required(:rows) => LcdDisplay.HD44780.Drive...
lib/lcd_display/driver/hd44780_util.ex
0.887662
0.831964
hd44780_util.ex
starcoder
defmodule Keyword do @moduledoc """ A keyword is a list of tuples where the first element of the tuple is an atom and the second element can be any value. The list is sorted by the first element of each tuple. A keyword may have duplicated keys, so it is not strictly a dictionary. However most of the fun...
lib/elixir/lib/keyword.ex
0.8835
0.691413
keyword.ex
starcoder
defmodule EWallet.Exchange do @moduledoc """ Provides exchange functionalities. """ alias EWallet.Exchange.Calculation alias EWalletDB.{ExchangePair, Token} # The private types for calculation parameters @typep non_neg_or_nil() :: non_neg_integer() | nil @doc """ Retrieves the exchange rate of the g...
apps/ewallet/lib/ewallet/exchange/exchange.ex
0.924125
0.662851
exchange.ex
starcoder
defmodule Saucexages.MediaInfoMeta do @moduledoc false require Saucexages.DataType alias Saucexages.DataType @enforce_keys [:media_type_id, :file_type, :data_type_id, :name] defstruct [:media_type_id, :file_type, :data_type_id, :name, :t_info_1, :t_info_2, :t_info_3, :t_info_4, :t_flags, :t_info_s] @typ...
lib/saucexages/media_info.ex
0.799364
0.735796
media_info.ex
starcoder
defmodule ApiWeb.LegacyStops do @moduledoc """ Enables backwards compatibility for changes to stop IDs and "splitting" of stops, e.g. from a station having one non-platform-specific child stop to having a child stop for each platform. Mappings from old to new stop IDs are expressed as: %{"2020-01-01" => %...
apps/api_web/lib/api_web/legacy_stops.ex
0.608827
0.423398
legacy_stops.ex
starcoder
defmodule Sage.Executor do @moduledoc """ This module is responsible for Sage execution. """ import Record alias Sage.Executor.Retries require Logger @type state :: record(:state, last_effect_or_error: {name :: term(), reason :: term()} | {:raise, excepti...
lib/sage/executor.ex
0.52975
0.46223
executor.ex
starcoder
defmodule P1000 do @moduledoc """ :timer.tc(&Main.main/0) Query A(x, y) : A_x + y B(x, y) : B_i + A_i (x <= i <= y) # Examples iex> an = [9, 8, 1, 9, 6, 10, 8] ...> |> Enum.with_index() |> Enum.reduce(%{}, &(Map.put(&2, elem(&1, 1), elem(&1, 0)))) ...> P1000.solve(7, 3, an, [["B", 2,...
lib/1000/p1000.ex
0.547706
0.570571
p1000.ex
starcoder
defmodule Bitcoin.Script do @moduledoc """ Bitcoin Script. Bitcoin uses a scripting system for transactions. Forth-like, Script is simple, stack-based and processed from left to right. It is purposefully not Turing-complete, with no loops. This module contains functions to oparet on scripts. The actual imp...
lib/bitcoin/script.ex
0.76921
0.606964
script.ex
starcoder
defmodule Stripe.Card do @moduledoc """ Work with Stripe card objects. You can: - Create a card - Retrieve a card - Update a card - Delete a card If you have been using an old version of the library, note that the functions which take an `owner_type` argument are now deprecated. The owner type i...
lib/stripe/payment_methods/card.ex
0.827689
0.672597
card.ex
starcoder
defmodule ExPixBRCode.Payments.Models.DynamicPixPaymentWithDueDate do @moduledoc """ A dynamic Pix payment with due date. This has extra complexity when dealing with interests and due dates. """ use ExPixBRCode.ValueObject alias ExPixBRCode.Changesets @required [:revisao, :chave, :txid, :status] @opt...
lib/ex_pix_brcode/payments/models/dynamic_pix_payment_with_due_date.ex
0.741768
0.571049
dynamic_pix_payment_with_due_date.ex
starcoder
defmodule Elexir.FSM do @moduledoc false require Logger defp calculate_path_weight(path) do path |> Enum.map(& elem(&1, 1)) |> Enum.sum end defp _find_all_paths([{nil, _}], _context, acc) do Enum.sort_by(acc, &calculate_path_weight/1, &<=/2) end defp _find_all_paths(_path, [], acc)...
lib/elexir/fsm.ex
0.591841
0.403567
fsm.ex
starcoder
defmodule SpatialHash do @moduledoc """ Documentation for SpatialHash. """ @type point :: list(number) @type point_range :: list(%Range{}) @type grid_dim :: {number, number, number} @type grid :: list(grid_dim) @type geometry :: {number, number} | %{type: String.t, coordinates: list} ...
lib/spatial_hash.ex
0.914319
0.464234
spatial_hash.ex
starcoder
defmodule Adventofcode.Day12NBodyProblem do use Adventofcode @moduledoc """ Each moon has a 3-dimensional position (x, y, and z) and a 3-dimensional velocity. The position of each moon is given in your scan; the x, y, and z velocity of each moon starts at 0. Simulate the motion of the moons in time ste...
lib/day_12_n_body_problem.ex
0.888096
0.775605
day_12_n_body_problem.ex
starcoder
defmodule SmartCity.Data do @moduledoc """ Message struct shared amongst all SmartCity microservices. ```javascript const DataMessage = { "dataset_id": "", // UUID "ingestion_id":"", // UUID "extraction_start_time": "", // iso8601 "payload": {}, "_metadata": { ...
lib/smart_city/data.ex
0.872809
0.643105
data.ex
starcoder
defmodule CanvasAPI.CanvasWatchService do @moduledoc """ A service for viewing and manipulating canvas watches. """ use CanvasAPI.Web, :service alias CanvasAPI.{Account, Canvas, CanvasService, User, UserService, CanvasWatch} @preload [:user, canvas: [:team]] @doc """ Insert a new ...
lib/canvas_api/services/canvas_watch_service.ex
0.799442
0.46873
canvas_watch_service.ex
starcoder
defmodule VintageNet.WiFi.WPASupplicantLL do use GenServer require Logger @moduledoc """ This modules provides a low-level interface for interacting with the `wpa_supplicant` Example use: ```elixir iex> {:ok, ws} = VintageNet.WiFi.WPASupplicantLL.start_link("/tmp/vintage_net/wpa_supplicant/wlan0") {:...
lib/vintage_net/wifi/wpa_supplicant_ll.ex
0.76454
0.501709
wpa_supplicant_ll.ex
starcoder
defmodule Blockchain.Transaction do @moduledoc """ This module encodes the transaction object, defined in Section 4.3 of the Yellow Paper (http://gavwood.com/Paper.pdf). We are focused on implementing 𝛶, as defined in Eq.(1). """ alias Blockchain.Account alias Block.Header defstruct nonce: 0, ...
lib/blockchain/transaction.ex
0.793946
0.533519
transaction.ex
starcoder
defmodule Log.Level do @moduledoc """ Provides functions to configure and order different levels """ @default [:trace, :debug, :info, :warn, :error, :fatal] @levels (case Application.get_env(:log, :levels, @default) do [] -> raise ArgumentError, "At least one level is required for...
lib/log/level/level.ex
0.803444
0.436202
level.ex
starcoder
defmodule Scidata.CIFAR10 do alias Scidata.Utils @default_data_path "tmp/cifar10" @base_url 'https://www.cs.toronto.edu/~kriz/' @dataset_file 'cifar-10-binary.tar.gz' defp parse_images(content) do for <<example::size(3073)-binary <- content>>, reduce: {<<>>, <<>>} do {images, labels} -> <<...
lib/cifar10.ex
0.689933
0.593079
cifar10.ex
starcoder
defmodule AMQPX.RoutingKeyMatcher do @doc """ Checks if a routing key matches a topic-style pattern. iex> AMQPX.RoutingKeyMatcher.matches?("a", "a") true iex> AMQPX.RoutingKeyMatcher.matches?("a", "b") false iex> AMQPX.RoutingKeyMatcher.matches?("a.c", "a.c") true iex> AMQPX.RoutingK...
lib/amqpx/routing_key_matcher.ex
0.683842
0.487185
routing_key_matcher.ex
starcoder
defmodule OffBroadway.Kafka.Producer do @moduledoc """ Defines a Broadway Producer module which receives messages from Kafka to initiate the Broadway pipeline. Sends messages to the `handle_info/2` and `handle_demand/2` functions based on requests and tracks acknowledgements in state. """ use GenStage ...
lib/off_broadway/kafka/producer.ex
0.858837
0.485783
producer.ex
starcoder
defmodule Program do defstruct [:input, state: %{}, pointer: 0, relative_pointer: 0, output: []] def param_value(program, {param, mode}) do case mode do 0 -> Map.get(program.state, param, 0) 1 -> param 2 -> Map.get(program.state, program.relative_pointer + param, 0) end end def param...
lib/intcode.ex
0.550607
0.444685
intcode.ex
starcoder
defmodule Ockam.Vault do @moduledoc """ """ alias Ockam.Vault.NIF defmodule Secret do @moduledoc false defstruct [:reference] @opaque t :: %__MODULE__{} end defmodule SecretAttributes do @moduledoc false defstruct ty: :buffer, length: 0, persistence: :ephemeral, purpose: :key_agreeme...
implementations/elixir/lib/ockam/vault.ex
0.795499
0.434581
vault.ex
starcoder
defmodule Day11 do defmodule Pos do defstruct x: 0, y: 0 end @spec do_turn(atom, integer) :: atom defp do_turn(direction, turn) do case turn do # left 0 -> case direction do :up -> :left :right -> :up :down -> :right :left -> :down end...
lib/day11.ex
0.819749
0.668168
day11.ex
starcoder
defmodule Calendar.NaiveDateTime.Interval do @moduledoc """ A `NaiveDateTime.Interval` consists of a start and an end `NaiveDateTime`. """ @type t :: %__MODULE__{from: %NaiveDateTime{}, to: %NaiveDateTime{}} defstruct [:from, :to] @doc """ Formats interval in ISO 8601 extended format. ## Example: # W...
lib/calendar/naive_date_time/interval.ex
0.908527
0.453867
interval.ex
starcoder
defmodule Day14 do alias Utils.Hash @moduledoc "Day 14: Disk Defragmentation" def part1(input) do input |> to_grid |> Enum.map(& Enum.count(&1, fn(x) -> x == 1 end)) |> Enum.sum end def part2(input) do input |> to_grid |> group_rows |> num_groups end defp to_grid(input) ...
apps/day14/lib/day14.ex
0.575827
0.560914
day14.ex
starcoder
defmodule OT.Fuzzer do @moduledoc """ Provides fuzzing functions for fuzz testing OT functions. """ defmacro composition_fuzz(mod, length \\ 1_000) do quote do for _ <- 1..unquote(length) do initial_value = unquote(mod).init_random(64) # Edit the document op_a = unquote(mod)....
test/support/fuzzer.ex
0.78964
0.879199
fuzzer.ex
starcoder
defmodule AWS.DeviceFarm do @moduledoc """ AWS Device Farm is a service that enables mobile app developers to test Android, iOS, and Fire OS apps on physical phones, tablets, and other devices in the cloud. """ @doc """ Creates a device pool. """ def create_device_pool(client, input, options \\ []) ...
lib/aws/device_farm.ex
0.790652
0.417925
device_farm.ex
starcoder
defmodule GroupManager.Data.WorldClock do require Record require GroupManager.Data.LocalClock require Chatter.NetID alias GroupManager.Data.LocalClock alias Chatter.NetID Record.defrecord :world_clock, time: [] @type t :: record( :world_clock, time: list(LocalClo...
lib/group_manager/data/world_clock.ex
0.690455
0.499939
world_clock.ex
starcoder
defmodule Elasticlunr.Storage.Disk do @moduledoc """ This storage provider writes data to the local disk of the running application. ```elixir config :elasticlunr, storage: Elasticlunr.Storage.Disk config :elasticlunr, Elasticlunr.Storage.Disk, directory: "/path/to/project/storage" ``` """ use E...
lib/elasticlunr/storage/disk.ex
0.658966
0.675316
disk.ex
starcoder
defmodule Membrane.RTP.OutboundPacketTracker do @moduledoc """ Tracks statistics of outband packets. Besides tracking statistics, tracker can also serialize packet's header and payload stored inside an incoming buffer into a a proper RTP packet. """ use Membrane.Filter alias Membrane.{Buffer, RTP, Paylo...
lib/membrane/rtp/outbound_packet_tracker.ex
0.868493
0.452052
outbound_packet_tracker.ex
starcoder
defmodule Confex do @moduledoc File.read!("README.md") alias Confex.ConfigSourceable, as: Source @doc """ Gets an optional string from the source. If the `key` does not exist in the source, returns `nil`. ## Examples iex> source = Confex.Sources.Map.new(str: "value", int: 123) iex> Confex.g...
lib/confex.ex
0.842004
0.404919
confex.ex
starcoder
defmodule TextDelta.Operation do @moduledoc """ Operations represent a smallest possible change applicable to a text. In case of text, there are exactly 3 possible operations we might want to perform: - `t:TextDelta.Operation.insert/0`: insert a new piece of text or an embedded element - `t:TextDelta....
lib/text_delta/operation.ex
0.947466
0.761538
operation.ex
starcoder
defmodule Draconic.Program do @moduledoc """ Draconic is a DSL for building command line programs. It allows you to define your CLI via simplistic macro functions that get compiled into simple modules used at run time to execute the desired command users enter. It's built on top of the built in `OptionParser`...
lib/draconic/program.ex
0.836621
0.464112
program.ex
starcoder
defmodule SPARQL.Query do @moduledoc """ A structure for SPARQL queries. """ defstruct [ :base, :prefixes, :form, :expr, :query_string, # This might be only temporary until we have a functionally complete SPARQL language decoder and encoder ] alias __MODULE__ @type t :: module ...
lib/sparql/query/query.ex
0.758153
0.563018
query.ex
starcoder
defmodule EnumX do @moduledoc ~S""" Some enumeration extensions. """ @doc ~S""" Reduces the enumerable until `fun` returns `{:error, reason}`. The return value for `fun` is expected to be * `{:ok, acc}` to continue the reduction with `acc` as the new accumulator or * `{:error, acc}` to halt ...
lib/common_x/enum_x.ex
0.899945
0.893216
enum_x.ex
starcoder
defmodule Gettext.Backend do @moduledoc """ Behaviour that defines the macros that a Gettext backend has to implement. """ @doc """ Default handling for missing bindings. This function is called when there are missing bindings in a translation. It takes a `Gettext.MissingBindingsError` struct and the tr...
lib/gettext/backend.ex
0.904328
0.418756
backend.ex
starcoder
defmodule Sourceror do @external_resource "README.md" @moduledoc @external_resource |> File.read!() |> String.split("<!-- MDOC !-->") |> Enum.fetch!(1) alias Sourceror.TraversalState @line_fields ~w[closing do end end_of_expression]a # @start_fields ~w[line do]a @end...
lib/sourceror.ex
0.877273
0.506042
sourceror.ex
starcoder
defmodule Flop.Generators do @moduledoc false use ExUnitProperties alias Flop.Filter @order_directions [ :asc, :asc_nulls_first, :asc_nulls_last, :desc, :desc_nulls_first, :desc_nulls_last ] def pet do gen all name <- string(:alphanumeric), age <- integer(1..500), ...
test/support/generators.ex
0.593845
0.441974
generators.ex
starcoder
defmodule SRTM.DataCell do @moduledoc false alias SRTM.Error defstruct [:hgt_data, :latitude, :longitude, :points_per_cell, :last_used] def from_file(path) do with {:ok, hgt_data} <- read(path), {:ok, ppc} <- get_ppc(hgt_data) do {lat, lng} = path |> Path.basename(".hgt") ...
lib/data_cell.ex
0.736211
0.534005
data_cell.ex
starcoder
defmodule AWS.Lambda do @moduledoc """ AWS Lambda **Overview** This is the *AWS Lambda API Reference*. The AWS Lambda Developer Guide provides additional information. For the service overview, see [What is AWS Lambda](http://docs.aws.amazon.com/lambda/latest/dg/welcome.html), and for information about ...
lib/aws/lambda.ex
0.900691
0.516595
lambda.ex
starcoder
defmodule CoopMinesweeperWeb.FieldView do use CoopMinesweeperWeb, :view alias CoopMinesweeper.Game.{Tile, Field} def render("player_field.json", %{ field: %Field{ tiles: tiles, size: size } = field }) do Map.merge( %{ tiles: f...
lib/coop_minesweeper_web/views/field_view.ex
0.623033
0.443299
field_view.ex
starcoder
defmodule SSHKit.SSH.Channel do @moduledoc """ Defines a `SSHKit.SSH.Channel` struct representing a connection channel. A channel struct has the following fields: * `connection` - the underlying `SSHKit.SSH.Connection` * `type` - the type of the channel, i.e. `:session` * `id` - the unique channel id ""...
lib/sshkit/ssh/channel.ex
0.897215
0.562777
channel.ex
starcoder
defmodule PayDayLoan.LoadWorker do @moduledoc """ Process to load requested keys into PDL cache. Whenever this process receives a ping, it attempts to load a batch of keys. Requested keys are ones returned by a call to `LoadState.requested_keys`. Pings should happen automatically via the PDL API. To for...
lib/pay_day_loan/load_worker.ex
0.772531
0.429429
load_worker.ex
starcoder
defmodule Cidr do @moduledoc """ Documentation for `Cidr`. """ use Bitwise alias Cidr.Util @bitlength 32 @type t() :: %__MODULE__{ a: integer(), b: integer(), c: integer(), d: integer(), mask: integer() } defstruct [ :a, :b, :c,...
lib/cidr.ex
0.84916
0.459925
cidr.ex
starcoder
defmodule Bson.Encoder do defprotocol Protocol do @moduledoc """ `Bson.Encoder.Protocol` protocol defines Bson encoding according to Elxir terms and some Bson predefined structs (see `Bson`). List of the protocol implementations: * `Map` - Encodes a map into a document * `HasDict` - Encodes a Ha...
hello_elixir/deps/bson/lib/bson_encoder.ex
0.896243
0.703362
bson_encoder.ex
starcoder
defmodule Set do @moduledoc %S""" This module specifies the Set API expected to be implemented by different representations. It also provides functions that redirect to the underlying Set, allowing a developer to work with different Set implementations using one API. To create a new set, use the `new` f...
lib/elixir/lib/set.ex
0.918288
0.62671
set.ex
starcoder
defmodule BSV.Transaction.Output do @moduledoc """ Module for parsing and serialising transaction outputs. """ alias BSV.Script alias BSV.Util alias BSV.Util.VarBin defstruct satoshis: 0, script: nil @typedoc "Transaction output" @type t :: %__MODULE__{ satoshis: integer, script:...
lib/bsv/transaction/output.ex
0.907753
0.538134
output.ex
starcoder
defmodule Traverse.Steps.Step do @callback run_step(definition, state) :: :started | :next | nil | {next_step, step_state} when definition: %{}, state: %{}, step_state: %{} | nil, next_step: %{} | :next | nil defmodule Definition do defstruct workflow_id: nil, step_id: nil, step_def...
lib/traverse/steps/step.ex
0.542136
0.415492
step.ex
starcoder