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 Marbles7 do @behaviour Cadex.Behaviour @initial_conditions %{ box_A: 11, box_B: 0 } @partial_state_update_blocks [ %Cadex.Types.PartialStateUpdateBlock{ policies: [ :robot_1, :robot_2 ], variables: [ {:box_A, :a}, {:box_B, :a} ] ...
lib/examples/marbles_7.ex
0.722429
0.614192
marbles_7.ex
starcoder
defmodule ControlNode.Namespace.Initialize do @moduledoc false @state_name :initialize # `Initialize` is the first state of the namespace FSM require Logger alias ControlNode.{Release, Namespace} alias Namespace.Workflow def callback_mode, do: :handle_event_function def handle_event(:internal, curre...
lib/control_node/namespace/initialize.ex
0.694613
0.569075
initialize.ex
starcoder
defmodule AWS.KinesisAnalyticsV2 do @moduledoc """ Amazon Kinesis Data Analytics is a fully managed service that you can use to process and analyze streaming data using Java, SQL, or Scala. The service enables you to quickly author and run Java, SQL, or Scala code against streaming sources to perform time s...
lib/aws/generated/kinesis_analytics_v2.ex
0.91006
0.694575
kinesis_analytics_v2.ex
starcoder
defmodule TzWorld do @moduledoc """ Resolve a timezone name from coordinates. """ alias Geo.{Point, PointZ} import TzWorld.Guards @type backend :: module() @reload_backends [ TzWorld.Backend.Memory, TzWorld.Backend.Dets, TzWorld.Backend.DetsWithIndexCache, TzWorld.Backend.Ets, TzWor...
lib/tz_world.ex
0.92607
0.640833
tz_world.ex
starcoder
defmodule PublicSuffix do import PublicSuffix.{RemoteFileFetcher, RulesParser} @moduledoc """ Implements the publicsuffix algorithm described at https://publicsuffix.org/list/. Comments throughout this module are direct quotes from https://publicsuffix.org/list/, showing how individual lines of code relate t...
lib/public_suffix.ex
0.866571
0.429429
public_suffix.ex
starcoder
defmodule EllipticCurve.Utils.Der do @moduledoc false use Bitwise @hexAt "\x00" @hexB "\x02" @hexC "\x03" @hexD "\x04" @hexF "\x06" @hex0 "\x30" @hex31 0x1F @hex127 0x7F @hex129 0xA0 @hex160 0x80 @hex224 0xE0 alias EllipticCurve.Utils.{BinaryAscii, Base64} def encodeSequence(encodedPi...
lib/utils/der.ex
0.629775
0.436922
der.ex
starcoder
defmodule Remedy.ISO8601 do @moduledoc """ `Ecto.Type` compatible limited ISO8601 type. ISO8601 is an international standard covering the worldwide exchange and communication of date and time related data. It is maintained by the Geneva-based International Organization for Standardization (ISO) and was first pub...
lib/remedy/types/iso8601.ex
0.813016
0.712107
iso8601.ex
starcoder
defmodule MyList do @moduledoc""" Module that emulates functionality in Elixir's Enum module. Created for Learn Elixir screencast series episode 06 - Recursion """ @doc""" Calculates the length of a given `list`. Returns the length of the `list` as an integer. ## Examples: iex> MyList.length([...
episode06/my_list/lib/my_list.ex
0.841028
0.636297
my_list.ex
starcoder
defmodule WithRetry.BackOff do @moduledoc ~S""" Helper module with different back off strategies and functionality. """ @doc ~S""" A constant stream of timeouts. ## Example ``` iex> constant(2_000) |> Enum.to_list() [2_000, 2_000, ...] ``` """ @spec constant(pos_integer) :: Enumerable.t() d...
lib/with_retry/back_off.ex
0.947745
0.919823
back_off.ex
starcoder
defmodule Exfpm.Encoders.Pairs do use Bitwise def decode(_, pairs \\ []) def decode(<<>>, pairs) do pairs end def decode(data, pairs) do case pair_length!(data) do {:ok, name_size, value_size, data1} -> case String.length(data1) >= name_size + value_si...
lib/encoders/pairs.ex
0.5083
0.648202
pairs.ex
starcoder
defmodule Chatter.Gossip do require Record require Chatter.BroadcastID require Chatter.NetID alias Chatter.BroadcastID alias Chatter.NetID Record.defrecord :gossip, current_id: nil, seen_ids: [], other_ids: [], distribution_list: ...
lib/gossip.ex
0.608827
0.443902
gossip.ex
starcoder
defmodule Cldr.Calendar.Preference do alias Cldr.LanguageTag @territory_preferences Cldr.Config.calendar_preferences() @doc false def territory_preferences do @territory_preferences end @doc false def preferences_for_territory(territory) do with {:ok, territory} <- Cldr.validate_territory(terri...
lib/cldr/calendar/preference.ex
0.867864
0.499329
preference.ex
starcoder
defmodule Transformers do @moduledoc """ Transforms nested maps and list of maps """ @doc """ Returns map (or list of maps) with keys deeply-transformed with the provided function. ## Examples Camelize keys: iex> data = %{"key_one" => 1, "key_two" => 2} iex> Transformers.transform_keys...
lib/transformers.ex
0.696991
0.568895
transformers.ex
starcoder
defmodule Tensorex do @moduledoc """ Functions to operate basic commands with tensors. """ @typedoc """ Represents a tensor. The data structure is a map with list of indices keys and numeric values. Zero values are omitted. The shape is a list of each dimension at the order. This module implements the...
lib/tensorex.ex
0.842734
0.732329
tensorex.ex
starcoder
defprotocol ShEx.TripleExpression do @moduledoc !""" Triple expressions are used for defining patterns composed of triple constraints. """ @doc """ Asserts that a triple expression is matched by a set of triples that come from the neighbourhood of a node in an RDF graph. """ def mat...
lib/shex/shape_expressions/triple_expression.ex
0.869742
0.604778
triple_expression.ex
starcoder
defmodule Muster.Game.Grid do alias Muster.Game alias Muster.Game.Tile @type t :: [Tile.t()] @grid_size 6 @spec new() :: t() def new() do [] end @spec put_tile_in_random_space(t(), Tile.value()) :: t() def put_tile_in_random_space(tiles, value) do {row, column} = tiles |> spaces |> Enum.ra...
apps/muster/lib/muster/game/grid.ex
0.775647
0.551513
grid.ex
starcoder
defmodule IBU.Code do @spec parse(binary) :: {atom, map} def parse( <<66, 84, season::binary-size(4), 83, level::binary-size(5), 95, 95, gender::binary-size(2), event::binary-size(2)>> ) do {:ok, :cup, %{ season: String.to_integer(season), gender: parse_gender(gender)...
lib/ibu/code.ex
0.583203
0.580114
code.ex
starcoder
defmodule AOC.Day3 do @moduledoc """ Solution to Day 3 of the Advent of code 2021 https://adventofcode.com/2021/day/3 """ @doc """ Read the input file Return the result as an array of arrays [[0,1,0,1], [1,1,1,1]] """ @spec get_inputs(File) :: [String.t()] def get_inputs(f \\ "lib/inputs/day3.txt...
elixir/advent_of_code/lib/2021/day3.ex
0.793826
0.772574
day3.ex
starcoder
defmodule Cforum.Cites do @moduledoc """ The Cites context. """ import Ecto.Query, warn: false alias Cforum.Repo alias Cforum.Cites.Cite alias Cforum.Cites.Vote alias Cforum.System @doc """ Returns the list of cites. ## Examples iex> list_cites() [%Cite{}, ...] """ def list_c...
lib/cforum/cites.ex
0.78403
0.405625
cites.ex
starcoder
defprotocol Membrane.Payload do @moduledoc """ This protocol describes actions common to all payload types. The most basic payload type is simply a binary for which `#{__MODULE__}` is implemented by the Membrane Core. """ defmodule Behaviour do @moduledoc """ Behaviour that should be implemented b...
lib/membrane/payload.ex
0.928813
0.533701
payload.ex
starcoder
defmodule ChallengeGov.LoginGov do @moduledoc """ Helper functions to sign in with LoginGov """ use HTTPoison.Base alias ChallengeGov.LoginGov.Token def get_well_known_configuration(idp_authorize_url) do idp_authorize_url |> uri_join("/.well-known/openid-configuration") |> get() |> handle...
lib/challenge_gov/login_gov.ex
0.602296
0.407127
login_gov.ex
starcoder
defmodule ShopifyAPI.Plugs.AdminAuthenticator do @moduledoc """ The ShopifyAPI.Plugs.AdminAuthenticator plug allows for easy admin authentication. The plug when included in your route will verify Shopify signatures, that are added to the iframe call on admin page load, and set a session cookie for the duration ...
lib/shopify_api/plugs/admin_authenticator.ex
0.739705
0.493164
admin_authenticator.ex
starcoder
defmodule Liblink.Socket.Recvmsg.Impl do use Liblink.Logger alias Liblink.Socket.Device alias Liblink.Socket.Recvmsg.Fsm @moduledoc false @opaque state_t :: map() @type call_mode :: :sync | :async @type consumer_t :: {atom, atom, list} | {atom, atom} | atom | pid | (iodata -> term) @spec init() :...
lib/liblink/socket/recvmsg/impl.ex
0.757974
0.417628
impl.ex
starcoder
if Code.ensure_loaded?(Plug) do defmodule PrimaAuth0Ex.Plug.VerifyAndValidateToken do @moduledoc """ Plug to verify and validate bearer tokens Usage: plug PrimaAuth0Ex.Plug.VerifyAndValidateToken, required_permissions: ["some:permission"] ## Options The following options can be set to cu...
lib/prima_auth0_ex/plug/verify_and_validate_token.ex
0.667039
0.435841
verify_and_validate_token.ex
starcoder
defmodule Tempus.Slots do @moduledoc """ The ordered collection of slots, backed up by `AVLTree`. This module implements `Enumerable` and `Collectable` interfaces. ### Examples iex> slots = [ ...> Tempus.Slot.wrap(~D|2020-08-07|), ...> Tempus.Slot.wrap(~D|2020-08-10|), ...> %Tem...
lib/slots.ex
0.873059
0.5425
slots.ex
starcoder
defmodule Weaver.Step do @moduledoc """ Core processing logic for each chunk of streamed data. """ alias Weaver.{Marker, Resolvers} def process_resolved(resolved, step, cache, parent_ref, field) do case analyze_resolved(resolved, step) do {:entire_data, []} -> meta = meta_delete_all(cache, ...
lib/weaver/step.ex
0.667473
0.420124
step.ex
starcoder
defmodule ExDag.DAG do @moduledoc """ Represents a DAG dag """ alias ExDag.DAG.DAGTask alias ExDag.DAG.DAGTaskRun require Logger @derive {Inspect, only: [:dag_id, :status]} @derive {Jason.Encoder, only: [:dag_id, :status]} @status_init :init @enforce_keys [:dag_id, :g] defstruct dag_id: nil, ...
lib/ex_dag/dag/dag.ex
0.771628
0.476153
dag.ex
starcoder
defmodule Helper.Converter.EditorToHTML.Frags.Image do @moduledoc """ parse editor.js's block fragments, use for test too see https://editorjs.io/ """ import Helper.Validator.Guards, only: [g_none_empty_str: 1] alias Helper.Converter.EditorToHTML.Class alias Helper.Types, as: T @class get_in(Class.ar...
lib/helper/converter/editor_to_html/frags/image.ex
0.673514
0.404449
image.ex
starcoder
defmodule Ipfinder.Validation.Firewallvalidation do @moduledoc """ # IPFinder elixir Client Library The official elixir client library for the [IPFinder.io](https://ipfinder.io) get details for : - IP address details (city, region, country, postal code, latitude and more ..) - ASN details (Organization...
lib/ipfinder/Validation/Firewallvalidation.ex
0.710025
0.607809
Firewallvalidation.ex
starcoder
defmodule Brahman.Dns.Zones do @moduledoc """ convert into erldns record """ require Record require Logger @dns_header "erldns/include/erldns.hrl" for {name, field} <- Record.extract_all(from_lib: @dns_header) do Record.defrecord(name, field) end # API functions @spec put(name :: String.t()...
lib/brahman/dns/zones.ex
0.725162
0.504883
zones.ex
starcoder
defmodule LearnKit.Knn do @moduledoc """ Module for k-nearest neighbours (knn) algorithm """ defstruct data_set: [] alias LearnKit.Knn use Knn.Classify @type label :: atom @type feature :: [integer] @type point :: {label, feature} @type features :: [feature] @type data_set :: [{label, features}...
lib/learn_kit/knn.ex
0.897544
0.52543
knn.ex
starcoder
defmodule Mix.Tasks.Shipit do use Mix.Task @shortdoc "Publishes new Hex package version" @moduledoc """ ShipIt automates Hex package publishing to avoid common mistakes. mix shipit BRANCH VERSION It automates these steps: * ensure there are no uncommited changes in the working tree * ensure cur...
lib/mix/tasks/shipit.ex
0.664105
0.444685
shipit.ex
starcoder
defmodule Operate.Cache do @moduledoc """ Operate cache specification. A cache is responsible for storing and retrieving tapes and ops from a cache, and if necessary instructing an adapter to fetch items from a data source. Operate comes bundled with a `ConCache` ETS cache, although by default runs with...
lib/operate/cache.ex
0.782288
0.672708
cache.ex
starcoder
defmodule Andy.BrickPi.LegoSensor do @moduledoc "Lego sensor access." require Logger import Andy.BrickPi.Sysfs alias Andy.Device alias Andy.BrickPi.{ ColorSensor, TouchSensor, InfraredSensor, UltrasonicSensor, GyroSensor, IRSeekerSensor } @sys_path "/sys/class/lego-sensor" @pr...
lib/andy/systems/brickpi/sensors/lego_sensor.ex
0.50708
0.429968
lego_sensor.ex
starcoder
defmodule AssertHTML.Matcher do @moduledoc false alias AssertHTML alias AssertHTML.{Parser, Selector} @compile {:inline, raise_match: 3} @typep assert_or_refute :: :assert | :refute ## ---------------------------------------------------- ## Collection @doc """ Gets html by selector and raise erro...
lib/assert_html/matcher.ex
0.849488
0.603727
matcher.ex
starcoder
defmodule OMG.Eth.Blockchain.Transaction.Signature do @moduledoc """ Defines helper functions for signing and getting the signature of a transaction, as defined in Appendix F of the Yellow Paper. For any of the following functions, if chain_id is specified, it's assumed that we're post-fork and we should fo...
apps/omg_eth/lib/omg_eth/blockchain/transaction/signature.ex
0.858378
0.699306
signature.ex
starcoder
defmodule SMSFactor.SendSMS do @moduledoc """ Wrappers around **Send SMS** section of SMSFactor API. """ @typedoc """ Params for sending SMS campaign. - `text` **(required)** : Your message - `value` **(required)** : The recipients' numbers - `pushtype` : The push type (alert or marketing) - `delay`...
lib/sms_factor/send_sms.ex
0.855157
0.751967
send_sms.ex
starcoder
defmodule AlphaVantage.StockTimeSeries do @moduledoc """ A set of functions for fetching realtime and historical global equity data from [Alpha Vantage](www.alphavantage.co/documentation/#time-series-data) in 4 different temporal resolutions: (1) daily, (2) weekly, (3) monthly, and (4) intraday. Daily, weekly, ...
lib/alpha_vantage/stock_time_series.ex
0.914825
0.889912
stock_time_series.ex
starcoder
defmodule Kitt.Message.TIM do @moduledoc """ Defines the structure and instantiation function for creating a J2735-compliant Traveler Information message A `TIM` defines a generic message type used to relay various advisory notifications to equipped devices, including but not limited to vehicles """ @ty...
lib/kitt/message/tim.ex
0.832747
0.537102
tim.ex
starcoder
defmodule Tracer do alias Tracer.Pattern alias Tracer.Collector alias Tracer.Utils @moduledoc """ """ @doc """ ## Options The following options are available: * `:node` - specified the node, on which trace should be started. * `:limit` - specifies the limit, that should be used on collecta...
lib/tracer.ex
0.885384
0.500366
tracer.ex
starcoder
defmodule Akin.SubstringSort do @moduledoc """ Use Chunk Sorting to compare two strings using substrings. Ratio is based on difference in string length * if words are of similar in length according to Akin.Strategy.determine/2 * ratio is String.jaro_distance * if words are of dissimilar in length accord...
lib/akin/algorithms/substring_sort.ex
0.89647
0.510985
substring_sort.ex
starcoder
defmodule Muscat.Fraction do @moduledoc """ This module provides some simple operations for fraction. """ @type fraction_tuple :: {numerator :: integer(), denominator :: neg_integer() | pos_integer()} @type t :: %__MODULE__{ numerator: integer(), denominator: integer() | :any, s...
lib/muscat/fraction.ex
0.937868
0.880797
fraction.ex
starcoder
defmodule Surgex.Guide.SoftwareDesign do @moduledoc """ Higher level application design and engineering guidelines. """ @doc """ An `else` block should be provided for `with` when it forwards cases from external files. ## Reasoning The `with` clause allows to omit `else` entirely if its only purpose is...
lib/surgex/guide/software_design.ex
0.832407
0.632616
software_design.ex
starcoder
defmodule AdventOfCode.Day09 do @moduledoc false use AdventOfCode defmodule Point, do: defstruct(value: nil, coordinates: nil, neighbors: []) def part1(input) do grid = preprocess_input(input) Enum.reduce(grid, [], fn {_, %Point{neighbors: neighbors, value: value} = point}, acc -> neighbor_poin...
lib/day09.ex
0.661486
0.602032
day09.ex
starcoder
defmodule ID3 do @moduledoc """ Read/Write ID3 tags. All tags will be written as `ID3v2.4`. This module uses [`rust-id3`](https://github.com/jameshurst/rust-id3/) inside, so it follows the restrictions there. (Currently ID3v1/v2 reading is supported, and all writing will be done as ID3v2.4) ### Examples ...
lib/id3.ex
0.860911
0.482612
id3.ex
starcoder
defmodule ModuleDependencyVisualizer do alias ModuleDependencyVisualizer.AnalyzeCode @moduledoc """ This is the public interface for this simple little tool to parse a file or list of files for dependencies between modules. It will use the `dot` command to generate a graph PNG for us thanks to graphviz. ""...
lib/module_dependency_visualizer.ex
0.778018
0.477859
module_dependency_visualizer.ex
starcoder
defmodule DataQuacker.Builder do @moduledoc false alias DataQuacker.Context alias DataQuacker.Matcher alias DataQuacker.Skipper alias DataQuacker.Sourcer alias DataQuacker.Transformer alias DataQuacker.Validator def call( source, %{__name__: schema_name, matchers: matchers, rows: schem...
lib/data_quacker/builder.ex
0.699973
0.50415
builder.ex
starcoder
defmodule Sigaws.Provider do @moduledoc """ This behavior defines the callbacks expected from an implementation needed for signature verification. The `pre_verification` callback is expected to use the context data to verify/validate the request. All the information available for verification are passed in...
lib/sigaws/provider.ex
0.869202
0.610294
provider.ex
starcoder
defmodule GraphQL.Query do @moduledoc """ Functions to create and modify query representations. """ alias GraphQL.{Node, Variable} @enforce_keys [:operation, :name, :fields] defstruct [:operation, :name, :fields, :fragments, :variables] @typedoc """ A struct that represents a GraphQL query or mutation...
lib/graphql/query.ex
0.921816
0.66943
query.ex
starcoder
defmodule Caylir.Graph do @moduledoc """ Defines a connection to a Cayley instance. ## Graph Definition To start connecting to a Cayley instance you need to define a connection module: defmodule MyGraph do use Caylir.Graph, otp_app: :my_app end If you intend to use initializer module...
lib/caylir/graph.ex
0.831006
0.506713
graph.ex
starcoder
defmodule Kiq.Pool do @moduledoc """ Kiq maintains a fixed pool of Redix connections that are used by processes to communicate with Redis. The pool is a fixed set of supervised connections. Calling `checkout/1` will return a random connection pid. The Redis connection is fully duplexed, making it safe for ...
lib/kiq/pool.ex
0.82887
0.401981
pool.ex
starcoder
defmodule Plymio.Funcio.Enum.Map.Collate do @moduledoc ~S""" Map and Collate Patterns for Enumerables. These functions map the elements of an *enum* and then collates the results according to one of the defined *patterns*. See `Plymio.Funcio` for overview and documentation terms. """ use Plymio.Funcio....
lib/funcio/enum/map/collate.ex
0.834576
0.429429
collate.ex
starcoder
defmodule Matrix.ConnectionManager do @moduledoc """ Handles all communication between agent centers in cluster. This module is used for registration / unregistration of new agent centers. Also it provides neccesary functions for handshake mechanism between new agent center and master node. """ import ...
lib/matrix/connection_manager.ex
0.868172
0.489626
connection_manager.ex
starcoder
defmodule Comeonin do @moduledoc """ Comeonin is a password hashing library that aims to make the secure validation of passwords as straightforward as possible. It also provides extensive documentation to help developers keep their apps secure. Comeonin supports bcrypt and pbkdf2_sha512. ## Use This...
deps/comeonin/lib/comeonin.ex
0.86626
0.780537
comeonin.ex
starcoder
defmodule Ecto.Adapters.SQL.Sandbox do @moduledoc ~S""" A pool for concurrent transactional tests. The sandbox pool is implemented on top of an ownership mechanism. When started, the pool is in automatic mode, which means using the repository will automatically check connections out as with any other pool....
lib/ecto/adapters/sql/sandbox.ex
0.902079
0.629917
sandbox.ex
starcoder
defmodule RefData do @moduledoc """ RefData is a library for Phoenix projects that lets you provide reference data for your forms (e.g. Gender) without using a database table. It has been written as tool for POC development but can be used in PROD for fields that are common and do not form part of complex que...
lib/ref_data.ex
0.805556
0.400368
ref_data.ex
starcoder
defmodule Integer do @moduledoc """ Functions for working with integers. Some functions that work on integers are found in `Kernel`: * `abs/1` * `div/2` * `max/2` * `min/2` * `rem/2` """ import Bitwise @doc """ Determines if `integer` is odd. Returns `true` if the given `intege...
lib/elixir/lib/integer.ex
0.956033
0.637341
integer.ex
starcoder
defmodule Plug.Parsers.JSON do @moduledoc """ Parses JSON request body. JSON arrays are parsed into a `"_json"` key to allow proper param merging. An empty request body is parsed as an empty map. ## Options All options supported by `Plug.Conn.read_body/2` are also supported here. They ar...
deps/plug/lib/plug/parsers/json.ex
0.806662
0.437403
json.ex
starcoder
defmodule AdventOfCode.Day10 do def test_adapters(adapters, current_joltage) do test_adapters(adapters, current_joltage, 0, 0) end def test_adapters([], _, num_ones, num_threes) do {num_ones, num_threes} end def test_adapters([adapter|adapters], current_joltage, num_ones, num_threes) do {num_on...
lib/day10.ex
0.698227
0.646865
day10.ex
starcoder
defmodule Pummpcomm.Session.Exchange.ReadCarbRatios do @moduledoc """ Read open intervals for carb ratios throughout the day """ alias Pummpcomm.{Carbohydrates, Insulin} alias Pummpcomm.Session.{Command, Response} # Constants @opcode 0x8A # Functions @doc """ Decodes `Pummpcomm.Session.Response...
lib/pummpcomm/session/exchange/read_carb_ratios.ex
0.876911
0.485661
read_carb_ratios.ex
starcoder
defmodule AstraeaVirgoWeb.LanguageView do use AstraeaVirgoWeb, :view @moduledoc """ Response for Language API """ @doc """ Response ## index.json Response for index Langauges API: `GET /api/languages` Response: list of Object | field | type | required | descript ...
lib/virgo_web/views/language_view.ex
0.871502
0.614727
language_view.ex
starcoder
defmodule EDS.Fixtures.FunctionCalls.SharedFunctions do alias EDS.Fixtures.FunctionCalls defmacro __using__(_opts) do quote do def public_call(), do: public_stub() def private_call(), do: private_stub() def public_stub(), do: true def public_recursion(), do: public_recursive_stub(0) ...
test/fixtures/function_calls.ex
0.569374
0.403949
function_calls.ex
starcoder
defmodule HLL do @moduledoc """ Default HyperLogLog module. Note that this module is not Redis compatible. Use alternative `HLL.Redis` module if you need to interact with Redis and need it to be Redis compatible. This module uses `:erlang.phash2` as hash function. ## Example iex> hll = HLL.new(14...
lib/hll.ex
0.895626
0.442034
hll.ex
starcoder
defmodule Adventofcode.Day01BlocksAway do def blocks_away(instructions), do: instructions |> decode |> get_end_pos |> get_distance def first_revisit(instructions), do: instructions |> decode |> get_first_revisit_pos |> get_distance def get_distance({x, y}), do: abs(x) + abs(y) def get_end_pos( in...
lib/day_01_blocks_away.ex
0.600891
0.770939
day_01_blocks_away.ex
starcoder
defmodule Mola do @moduledoc """ Compare various poker hand strengths No validation is done on the "sanity" of any combination of cards. Card rank should be "2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A" Suits should be "c", "d", "h", "s" Cards should be provided as a string: - "Ac Kc...
lib/mola.ex
0.736401
0.630514
mola.ex
starcoder
defmodule Ace.HTTP.Channel do @moduledoc """ Reference to a single HTTP request/response exchange, within the context of a connection. - With HTTP/2 a channel corresponds to a single stream. - With HTTP/1.1 pipelining a single connection can support multiple channels. The channel struct provides a normalise...
lib/ace/http/channel.ex
0.732496
0.434821
channel.ex
starcoder
defmodule ActivestorageEx.Variant do @moduledoc """ Image blobs can have variants that are the result of a set of transformations applied to the original. These variants are used to create thumbnails, fixed-size avatars, or any other derivative image from the original. Variants rely on ImageMagick f...
lib/variant.ex
0.932176
0.9463
variant.ex
starcoder
defmodule Hypex.Register do @moduledoc """ This module defines the behaviour required by all internal Hypex register structures. Assuming all of the function callbacks defined in this module are implemented correctly, it should be possible to use as an implementation inside a Hypex. This makes it possible ...
lib/hypex/register.ex
0.847353
0.628094
register.ex
starcoder
defmodule Ports.Rumble.Board.Common do alias Harbor.Utils.SimpleId alias Ports.Rumble.Tile alias Ports.Rumble.Group @tile_width 100 def tile_width(), do: @tile_width @tile_height 130 def tile_height(), do: @tile_height @spec can_snap_to(Tile.t(), Tile.t(), 0 | 1, any()) :: boolean() def can_snap_to(...
harbor/lib/ports/rumble/board/common.ex
0.721645
0.427636
common.ex
starcoder
defmodule Dynamo.Loader do @moduledoc """ This module is responsible for managing code reloading used in development environments in Dynamo. The reloader is enabled per Elixir process, so each process which requires reloading semantics must explicitly enabled it with `Dynamo.Loader.enable`. The `Dynamo....
lib/dynamo/loader.ex
0.783864
0.424859
loader.ex
starcoder
defmodule AdventOfCode2019.SpacePolice do @moduledoc """ Day 11 — https://adventofcode.com/2019/day/11 """ @spec part1(Enumerable.t()) :: integer def part1(in_stream) do in_stream |> paint(0) |> map_size() end @spec part2(Enumerable.t()) :: String.t() def part2(in_stream) do in_stream ...
lib/advent_of_code_2019/day11.ex
0.772574
0.539105
day11.ex
starcoder
defmodule Figlet.Linebreaker do @moduledoc """ This module contains the logic that determines where to put linebreaks when converting a charlist to a specific FIGlet font representation. It relies on lists of integer codepoints (a.k.a. charlists) instead of utf8 encoded string binaries (a.k.a. strings) to by...
lib/figlet/linebreaker.ex
0.73782
0.486392
linebreaker.ex
starcoder
defmodule Behaviour do @moduledoc """ Mechanism for handling behaviours. This module is deprecated. Instead of `defcallback/1` and `defmacrocallback/1`, the `@callback` and `@macrocallback` module attributes can be used (respectively). See the documentation for `Module` for more information on these attr...
lib/elixir/lib/behaviour.ex
0.775009
0.40751
behaviour.ex
starcoder
defmodule Mix.Dep do @moduledoc false @doc """ The Mix.Dep a struct keeps information about your project dependencies. It contains: * `scm` - a module representing the source code management tool (SCM) operations * `app` - the application name as an atom * `requirement` - a binary or regex...
lib/mix/lib/mix/dep.ex
0.84626
0.596815
dep.ex
starcoder
defmodule GenServer do @moduledoc """ A behaviour module for implementing the server of a client-server relation. A GenServer is a process like any other Elixir process and it can be used to keep state, execute code asynchronously and so on. The advantage of using a generic server process (GenServer) impleme...
lib/elixir/lib/gen_server.ex
0.89875
0.650211
gen_server.ex
starcoder
defmodule LoggerJSON.JasonSafeFormatter do @moduledoc """ Utilities for converting metadata into data structures that can be safely passed to `Jason.encode!/1`. """ @doc """ Produces metadata that is "safe" for calling Jason.encode!/1 on without errors. This means that unexpected Logger metadata won't caus...
lib/logger_json/jason_safe_formatter.ex
0.767472
0.529993
jason_safe_formatter.ex
starcoder
defmodule Bitcoin.Protocol.Types.BlockHeader do alias Bitcoin.Protocol.Types.VarInteger # Block version information, based upon the software version creating this block defstruct version: 0, # char[32], The hash value of the previous block this particular block references previous_block: ...
lib/bitcoin/protocol/types/block_header.ex
0.69368
0.40072
block_header.ex
starcoder
defmodule Jason.DecodeError do @type t :: %__MODULE__{position: integer, data: String.t} defexception [:position, :token, :data] def message(%{position: position, token: token}) when is_binary(token) do "unexpected sequence at position #{position}: #{inspect token}" end def message(%{position: position,...
lib/decoder.ex
0.522689
0.557785
decoder.ex
starcoder
defmodule Sanbase.Balance do import __MODULE__.SqlQuery import Sanbase.Utils.Transform, only: [maybe_unwrap_ok_value: 1] import Sanbase.Clickhouse.HistoricalBalance.Utils, only: [maybe_update_first_balance: 2, maybe_fill_gaps_last_seen_balance: 1] alias Sanbase.ClickhouseRepo alias Sanbase.Model.Projec...
lib/sanbase/balances/balance.ex
0.867766
0.412412
balance.ex
starcoder
defmodule ABNF.Interpreter do @moduledoc """ This modules implements the Grammar.t interpreter. Applying a Grammar.t to the given input will result in a CaptureResult.t or an exception. Copyright 2015 <NAME> <<EMAIL>> Licensed under the Apache License, Version 2.0 (the "License"); you may not ...
lib/ex_abnf/interpreter.ex
0.743168
0.567337
interpreter.ex
starcoder
defmodule Bme680 do @moduledoc """ Provides a high level abstraction to interface with the BME680 environmental sensor on Linux platforms. """ use Bitwise use GenServer defmodule State do @moduledoc false defstruct port: nil, subscribers: [], async_subscribers: [], measuring: false end defmo...
lib/elixir_bme680.ex
0.866683
0.852629
elixir_bme680.ex
starcoder
defmodule ArangoXEcto.Schema do @moduledoc """ This module is a helper to automatically specify the primary key. The primary key is the Arango `_key` field but the _id field is also provided. Schema modules should use this module by add `use ArangoXEcto.Schema` to the module. The only exception to this is i...
lib/arangox_ecto/schema.ex
0.777933
0.428323
schema.ex
starcoder
defprotocol ExAws.Dynamo.Encodable do @type t :: any @doc "Converts an elixir value into a map tagging the value with its dynamodb type" def encode(value, options) end defimpl ExAws.Dynamo.Encodable, for: Atom do def encode(true, _), do: %{"BOOL" => "true"} def encode(false, _), do: %{"BOOL" => "false"} d...
lib/ex_aws/dynamo/encodable.ex
0.672762
0.436082
encodable.ex
starcoder
defmodule Faker.Date do import Faker.Util, only: [pick: 1] @moduledoc """ Functions for generating dates """ @doc """ Returns a random date of birth for a person with an age specified by a number or range """ @spec date_of_birth(integer | Range.t()) :: Date.t() def date_of_birth(age_or_range \\ 18.....
lib/faker/date.ex
0.866345
0.528959
date.ex
starcoder
defmodule Gringotts.Response do @moduledoc """ Defines the Response `struct` and some utilities. All `Gringotts` public API calls will return a `Response.t` wrapped in an `:ok` or `:error` `tuple`. It is guaranteed that an `:ok` will be returned only when the request succeeds at the gateway, ie, no error occ...
lib/gringotts/response.ex
0.883044
0.778565
response.ex
starcoder
defmodule Absinthe do @moduledoc """ Documentation for the Absinthe package, a toolkit for building GraphQL APIs with Elixir. For usage information, see [the documentation](http://hexdocs.pm/absinthe), which includes guides, API information for important modules, and links to useful resources. """ defmo...
lib/absinthe.ex
0.881341
0.866246
absinthe.ex
starcoder
defmodule Conversion.Distance do @moduledoc """ Converts from one distance to another, e.g. feet to inches """ @typedoc """ Distance measurement, e.g. :feet, inches """ @type measurement :: :miles | :yards | :feet | :inches | :kilometers | :mete...
lib/conversion/distance.ex
0.873835
0.928603
distance.ex
starcoder
defmodule Calendar.TimeZoneDatabase do @moduledoc """ This module defines a behaviour for providing time zone data. IANA provides time zone data that includes data about different UTC offsets and standard offsets for time zones. """ @typedoc """ A period where a certain combination of UTC offset, standa...
lib/elixir/lib/calendar/time_zone_database.ex
0.926404
0.84124
time_zone_database.ex
starcoder
defmodule AWS.Codeartifact do @moduledoc """ AWS CodeArtifact is a fully managed artifact repository compatible with language-native package managers and build tools such as npm, Apache Maven, and pip. You can use CodeArtifact to share packages with development teams and pull packages. Packages can be pulled...
lib/aws/generated/codeartifact.ex
0.909394
0.645329
codeartifact.ex
starcoder
defprotocol Buildable.Collectable do @moduledoc """ A protocol to traverse data structures. Collectable protocol used by [`buildables`](`t:Buildable.t/0`). The `Build.into/2` and `Build.into/3` functions use this protocol to insert an [buildable](`t:Buildable.t/0`) or a [range](`t:Range.t/0`) into a [`buildab...
lib/buildable/collectable.ex
0.886605
0.691497
collectable.ex
starcoder
defmodule Playwright.Runner.Catalog do @moduledoc false # `Catalog` provides storage and management of known resources. It implements # `GenServer` in order to maintain state, while domain logic is handled within # caller modules such as `Connection`, `Event`, and `Response`. use GenServer require Logger ...
lib/playwright/runner/catalog.ex
0.810591
0.568715
catalog.ex
starcoder
defmodule Braintree.Address do @moduledoc """ You can create an address for a customer only although the structure is also used for a merchant account. For additional reference see: https://developers.braintreepayments.com/reference/request/address/create/ruby """ use Braintree.Construction alias Bra...
lib/address.ex
0.891676
0.520862
address.ex
starcoder
defmodule Oban.Notifier do @moduledoc """ The `Notifier` coordinates listening for and publishing notifications for events in predefined channels. Every Oban supervision tree contains a notifier process, registered as `Oban.Notifier`, which can be any implementation of the `Oban.Notifier` behaviour. The defa...
lib/oban/notifier.ex
0.878223
0.501587
notifier.ex
starcoder
defmodule ReWeb.Types.Listing do @moduledoc """ GraphQL types for listings """ use Absinthe.Schema.Notation import Absinthe.Resolution.Helpers, only: [dataloader: 2] alias ReWeb.Resolvers enum :deactivation_reason, values: ~w(duplicated gave_up left_emcasa publication_mistake rented ...
apps/re_web/lib/graphql/types/listing.ex
0.724091
0.537648
listing.ex
starcoder
defmodule Argon2 do @moduledoc """ Elixir wrapper for the Argon2 password hashing function. This library can be used on its own, or it can be used together with [Comeonin](https://hexdocs.pm/comeonin/api-reference.html), which provides a higher-level api. Before using Argon2, you will need to conf...
deps/argon2_elixir/lib/argon2.ex
0.848031
0.63392
argon2.ex
starcoder
defmodule Conduit.ContentType do @moduledoc """ Formats and parses a message body based on the content type given. Custom content types can be specified in your configuration. config :conduit, Conduit.ContentType, [{"application/x-custom", MyApp.CustomContentType}] Note that any new content types speci...
lib/conduit/content_type.ex
0.826642
0.440349
content_type.ex
starcoder
defmodule Inquisitor.JsonApi.Include do @moduledoc """ Inquisitor query handlers for JSON API includes [JSON API Spec](http://jsonapi.org/format/#fetching-includes) #### Usage `use` the module *after* the `Inquisitor` module: defmodule MyApp do use Inquisitor use Inquisitor.JsonApi.I...
lib/inquisitor/jsonapi/include.ex
0.887674
0.46035
include.ex
starcoder
defmodule Timex.Format.Duration.Formatter do @moduledoc """ This module defines the behaviour for custom Time formatters """ use Timex alias Timex.Translator alias Timex.Duration alias Timex.Format.Duration.Formatters.Default alias Timex.Format.Duration.Formatters.Humanized defmacro __using__(_) do ...
lib/format/duration/formatter.ex
0.891419
0.428712
formatter.ex
starcoder
defmodule Analytics.RegionOfInterest do @moduledoc """ The Reports context. """ use Evercam.Schema import Ecto.Query, warn: false alias Analytics.RegionOfInterest schema "regionof_interest" do field :cameraex, :string field :roi_wideness, :integer field :roi_type, :string field :x, :floa...
lib/evercam_models/analytics/region_of_interest.ex
0.644337
0.418519
region_of_interest.ex
starcoder
defmodule Re.Exporters.FacebookAds.RealEstate do @moduledoc """ Listing XML exporter for Facebook Dynamic Ads for Real Estate https://developers.facebook.com/docs/marketing-api/dynamic-ads-for-real-estate """ @exported_attributes ~w(id url title availability listing_type description price property_type r...
apps/re/lib/exporters/facebook_ads/real_estate.ex
0.640748
0.402245
real_estate.ex
starcoder