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 Raxx.Context do @type section_name :: term() @typedoc """ An opaque type for the context snapshot data. """ @opaque snapshot :: map() @moduledoc """ `Raxx.Context` is a mechanism for simple sharing of state/information between `Raxx.Middleware`s and `Raxx.Server`s. It is designed to be fl...
lib/raxx/context.ex
0.885681
0.553324
context.ex
starcoder
defmodule Membrane.Element.Base do @moduledoc """ Modules in this namespace contain behaviours, default callback implementations and other stuff useful when creating elements. Elements are units that produce, process or consume data. They can be linked with `Membrane.Pipeline`, and thus form a pipeline able ...
lib/membrane/element/base.ex
0.847369
0.467514
base.ex
starcoder
defmodule Scenic.Primitive.Ellipse do @moduledoc """ Draw an ellipse on the screen. ## Data `{radius_1, radius_2}` The data for an arc is a single number. * `radius_1` - the radius of the ellipse in one direction * `radius_2` - the radius of the ellipse in the other direction ## Styles This prim...
lib/scenic/primitive/ellipse.ex
0.927486
0.725114
ellipse.ex
starcoder
defmodule OpenTelemetry.Honeycomb.Event do @moduledoc """ Event structure. Honeycomb events bind a timestamp to data as described in `t:t/0` below. The `data` corresponds to OpenTelemetry span attributes, with limitations dictated by the intersection of their data data models. For information on how we clean...
lib/open_telemetry/honeycomb/event.ex
0.898443
0.525186
event.ex
starcoder
defmodule Sptfy.Client do @moduledoc false alias Sptfy.Client.{Document, HTTP, Parameter, Placeholder, ResponseHandler, ReturnType} defmacro __using__(_) do quote location: :keep do import Sptfy.Client import Sptfy.Client.BodyMapper end end defmacro get(path, opts) do [as: fun, quer...
lib/sptfy/client.ex
0.829112
0.439507
client.ex
starcoder
defmodule GitHubActions.Config do @moduledoc """ A simple keyword-based configuration API. ## Examples This module is used to define the configuration for `GitHubActions`. ```elixir import GitHubActions.Config config :linux, name: "Ubuntu", runs_on: "ubuntu-latest" config key: "value" """...
lib/git_hub_actions/config.ex
0.856122
0.676132
config.ex
starcoder
defmodule Grizzly.CommandClass.Mappings do @type command_class_name :: atom @type command_class_type :: :raw | :network | :application | :management @type basic_class_name :: :controller | :static_controller | :routing_slave | :slave @type specific_type_name :: atom() @type generic_type_name :: atom() @...
lib/grizzly/command_class/mappings.ex
0.66888
0.441673
mappings.ex
starcoder
defmodule Phoenix.HTML.Link do @moduledoc """ Conveniences for working with links and URLs in HTML. """ import Phoenix.HTML.Tag @doc """ Generates a link to the given URL. ## Examples link("hello", to: "/world") #=> <a href="/world">hello</a> link("<hello>", to: "/world") #=> ...
data/web/deps/phoenix_html/lib/phoenix_html/link.ex
0.702734
0.46557
link.ex
starcoder
defmodule Geolix.Adapter.MaxMindCSV do @moduledoc """ Adapter for Geolix to work with MaxMind CSV 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, databas...
lib/maxmind_csv.ex
0.812682
0.505859
maxmind_csv.ex
starcoder
defmodule MastaniServer.Test.AssertHelper do @moduledoc """ This module defines some helper function used by tests that require check from graphql response """ import Phoenix.ConnTest import Helper.Utils, only: [map_key_stringify: 1, get_config: 2] @endpoint MastaniServerWeb.Endpoint @page_size get_c...
test/support/assert_helper.ex
0.658088
0.403655
assert_helper.ex
starcoder
defmodule ExDns.Message.Question do @moduledoc """ Manages the Question part of a DNS message 4.1.2. Question section format The question section is used to carry the "question" in most queries, i.e., the parameters that define what is being asked. The section contains QDCOUNT (usually 1) entries, each o...
lib/ex_dns/message/question.ex
0.566738
0.595434
question.ex
starcoder
defmodule EctoOrdered do @moduledoc """ EctoOrdered provides changeset methods for updating ordering an ordering column It should be added to your schema like so: ``` defmodule OrderedListItem do use Ecto.Schema import Ecto.Changeset import EctoOrdered schema "ordered_list_item" do fi...
lib/ecto_ordered.ex
0.85405
0.676683
ecto_ordered.ex
starcoder
defmodule Pushest.Socket.Data.Frame do @moduledoc ~S""" Structure representing a Frame being passed between Pushest and Pusher server. Includes methods constructing Frame structure for various pusher events. This module handles encode/decode actions for a Frame. """ alias Pushest.Socket.Data.SubscriptionDa...
lib/pushest/socket/data/frame.ex
0.891696
0.497315
frame.ex
starcoder
defmodule Transmog.Parser do @moduledoc """ `Parser` is a module which parses the two tuple dot notation strings into a format that can be understood by the rest of the library. It is able to parse values of the format "a.b.c" into the library format of ["a", "b", "c"], for example. It exposes two function...
lib/transmog/parser.ex
0.92501
0.792705
parser.ex
starcoder
defmodule VersionHelper do @moduledoc """ Helper functions for dealing with `Version` values. """ @doc """ Bumps the specified `part` of the given `version`, zeroing out all smaller parts of the version. ## Examples Bump the major version, which increments the major version number and zeroes out the mi...
lib/version_helper.ex
0.902926
0.549278
version_helper.ex
starcoder
defmodule Trie do @behaviour Access @moduledoc ~S""" This module contains the type and functions to work with a [Trie (tree data structure)](https://en.wikipedia.org/wiki/Trie). The difference from the accepted data structure is that this one only keeps one character per node. The data structure here also ...
lib/trie.ex
0.933195
0.892234
trie.ex
starcoder
defmodule Ecto.Model.OptimisticLock do @moduledoc """ Facilities for using the optimistic-locking technique. [Optimistic locking](http://en.wikipedia.org/wiki/Optimistic_concurrency_control) (or *optimistic concurrency control*) is a technique that allows concurrent edits on a single record. While pessimis...
lib/ecto/model/optimistic_lock.ex
0.911913
0.597314
optimistic_lock.ex
starcoder
defmodule Griffin.Model.Adapters do @moduledoc """ Module for storing model database adapters, which are module with CRUDL APIs for persisting model operations to a database. """ defmodule Memory do @moduledoc """ Module for storing model data in an in-memory map. Useful for development but not p...
lib/griffin/model/adapters.ex
0.715821
0.497437
adapters.ex
starcoder
defmodule Botfuel.Entity do defstruct [sentence: "", dimensions: [], antidimensions: [], timezone: "", case_sensitive: false, keep_quotes: false, keep_accents: false ] @type t :: %__MODULE__{sentence: String.t, dimensions: [...
lib/botfuel/entity.ex
0.690246
0.618723
entity.ex
starcoder
defmodule Ada.Source.LastFm.Track do @moduledoc false defstruct [:artist, :album, :name, :listened_at] @type t :: %__MODULE__{ artist: String.t(), album: String.t(), name: String.t(), listened_at: :now_playing | DateTime.t() } @doc """ Finds the currently play...
lib/ada/source/last_fm/track.ex
0.838051
0.476458
track.ex
starcoder
defmodule Nostrum.Cache.ChannelCache do @default_cache_implementation Nostrum.Cache.ChannelCache.ETS @moduledoc """ Cache behaviour & dispatcher for channels. You can call the functions provided by this module independent of which cache is configured, and it will dispatch to the configured cache implementati...
lib/nostrum/cache/channel_cache.ex
0.875608
0.770594
channel_cache.ex
starcoder
defmodule ExAudit.Type.PatchMap do use Ecto.Type def type, do: :map def cast(a), do: {:ok, a} def dump(patch) do {:ok, encode(patch)} end def load(binary) do {:ok, decode(binary)} end defp encode({:added, value}), do: %{"a" => "add", "v" => value} defp encode({:removed, value}), do: %{"a"...
lib/repo/types/patch_map_type.ex
0.636466
0.430806
patch_map_type.ex
starcoder
defmodule JsonWebToken.Jwt do @moduledoc """ Encode claims for transmission as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure, enabling the claims to be integrity protected with a Message Authentication Code (MAC), to be later verified see http://tools.ietf.org/html/rfc7519...
lib/json_web_token/jwt.ex
0.876931
0.466906
jwt.ex
starcoder
defmodule AWS.Batch do @moduledoc """ AWS Batch enables you to run batch computing workloads on the AWS Cloud. Batch computing is a common way for developers, scientists, and engineers to access large amounts of compute resources, and AWS Batch removes the undifferentiated heavy lifting of configuring and ma...
lib/aws/generated/batch.ex
0.879878
0.739446
batch.ex
starcoder
# position x-y-z # size W(x)-H(y)-D(z) # Objections # calculate corners # detect collisions # rotate 90 degrees (mind boundaries) defmodule Cuboid do defstruct position: %{ x: 0, y: 0, z: 0 }, dimensions: %{ w: 0, h: 0, d: 0 } # cube = Cuboid.create_cuboid(%{x: <int>, y: <int>, z: <int>}, %{ w: <int>, ...
lib/cuboid.ex
0.505127
0.593786
cuboid.ex
starcoder
defmodule DivoPulsar do @moduledoc """ Defines a pulsar broker in 'standalone' mode as a map compatible with divo for building a docker-compose file. """ @behaviour Divo.Stack @doc """ Implements the Divo Stack behaviour to take a keyword list of defined variables specific to the DivoPulsar stack ...
lib/divo_pulsar.ex
0.749087
0.519704
divo_pulsar.ex
starcoder
defmodule Librecov.BadgeCreator do require EEx # values and SVG are taken from https://github.com/badges/shields @base_width 89 @extra_width 7 @template_path Path.join(__DIR__, "templates/badge_template.eex") @authorized_formats ~w(png jpg svg) EEx.function_from_file(:defp, :template, @template_path, [ ...
lib/opencov/badge_creator.ex
0.533397
0.444444
badge_creator.ex
starcoder
defmodule Resourceful.Registry do @doc """ Instances of `Resourceful.Type` are intended to be used in conjunction with a registry in most circumstances. The application, and even the client, will likely understand a resource type by its string name/identifier. Types themselves, when associated with a registry...
lib/resourceful/registry.ex
0.842637
0.528108
registry.ex
starcoder
defmodule ExploringMars.Mission.Coordinate do @moduledoc """ This module defines functions that create and operate on coordinates in the probe's space of movement. This module and the `Direction` module should change if the coordinate representation used in the problem changes - for instance, if we choose ...
lib/exploring_mars/mission/coordinate.ex
0.894341
0.900748
coordinate.ex
starcoder
defmodule AOC.Day13.CarePackage do alias AOC.Day13.Intcode @moduledoc """ Had to get clarification that we are supposed to wait until the program finishes before gathering output. """ @type grid :: map @type point :: {integer, integer} def part1(path) do Intcode.stream_puzzle_input(path) |> Int...
aoc-2019/lib/aoc/day13/care_package.ex
0.778691
0.452415
care_package.ex
starcoder
defmodule Kira.BranchState do require Kira.Branch, as: Branch require Kira.Util, as: Util @moduledoc false defstruct [ :branch, :awaiting, :blocking, :awaiting_unapply, :blocking_unapply, :task ] @type errors :: [{any, DateTime.t()}] @type resolved :: any @type task :: ...
lib/kira/branch_state.ex
0.794544
0.42319
branch_state.ex
starcoder
defmodule Godfist do @moduledoc """ Godfist is a wrapper for the League of Legends ReST API written in Elixir. There are some endpoints that I'll be adding later which will be the static data from Data Dragon and Tournament support. Every function requires that you pass the region to execute the request to ...
lib/godfist.ex
0.856167
0.84124
godfist.ex
starcoder
defmodule Collidex.Detector do @moduledoc """ Main module responsible for detecting whether two particular pieces of geometry have collided. All actual detections are delegated to functions in Collidex.Detection.* modules; this module effectively just routes geometry to the correct detection function. ""...
lib/collidex/detector.ex
0.910585
0.833663
detector.ex
starcoder
defmodule Grizzly.ZWave.DSK do @moduledoc """ Module for working with the SmartStart and S2 DSKs """ import Integer, only: [is_even: 1] defstruct raw: <<>> @type t() :: %__MODULE__{raw: <<_::128>>} @typedoc """ The DSK string is the string version of the DSK The general format is `XXXXX-XXXXX-XXX...
lib/grizzly/zwave/dsk.ex
0.912077
0.842604
dsk.ex
starcoder
defmodule Hierbautberlin.Importer.Infravelo do alias Hierbautberlin.Importer.KmlParser alias Hierbautberlin.Importer.LiqdApi alias Hierbautberlin.GeoData @state_mapping %{ "Vorgesehen" => "intended", "in Vorbereitung" => "in_preparation", "in Planung" => "in_planning", "Abgeschlossen" => "finis...
lib/hierbautberlin/importer/infravelo.ex
0.606848
0.488527
infravelo.ex
starcoder
defmodule AWS.OpsWorks.ChefAutomate do @moduledoc """ AWS OpsWorks for Chef Automate A service that runs and manages configuration management servers. Glossary of terms <ul> <li> **Server**: A server is a configuration management server, and can be highly-available. The configuration manager runs on you...
lib/aws/ops_works_chef_automate.ex
0.903301
0.53437
ops_works_chef_automate.ex
starcoder
defmodule EdgeDB.Protocol.Codecs.Builtin.Array do @moduledoc false use EdgeDB.Protocol.Codec alias EdgeDB.Protocol.{ Datatypes, Types } @reserved0 0 @reserved1 0 @empty_list_iodata [ Datatypes.Int32.encode(0), Datatypes.Int32.encode(@reserved0), Datatypes.Int32.encode(@reserved1) ...
lib/edgedb/protocol/codecs/builtin/array.ex
0.696991
0.429788
array.ex
starcoder
defmodule Optimus.Builder do alias Optimus alias Optimus.PropertyParsers, as: PP def build(props) do with :ok <- validate_keyword_list(props), {:ok, name} <- build_name(props), {:ok, description} <- build_description(props), {:ok, version} <- build_version(props), {:ok, au...
lib/optimus/builder.ex
0.530723
0.405007
builder.ex
starcoder
defmodule GitExPress.Entries.Storage do @moduledoc """ This Storage module handles the Mnesia database. """ require Logger # alias :mnesia, as: Mnesia alias GitExPress.Entries.Entry @entry_table GitExPressEntries @entry_attributes [:title, :date, :slug, :content_raw, :content_html, :content_type] @do...
lib/gitexpress/entries/storage.ex
0.588771
0.543651
storage.ex
starcoder
defmodule Mix.Tasks.OptimusHash.Seed do @moduledoc """ Generates the required configuration for using OptimusHash. This task is intended to be run only once. ## Example mix ecto.dump ## Command line options * `--bits` - does not compile applications before dumping * `--no-deps-check` - does ...
lib/mix/tasks/optimushash.seed.ex
0.825519
0.571438
optimushash.seed.ex
starcoder
defmodule Bitcraft.Helpers do @moduledoc """ Module for building extra helper functions. """ alias __MODULE__ @doc false defmacro __using__(_opts) do quote do unquote(Helpers.build_segment_decoder()) end end @doc """ Helper function used internally for building `decode_segment/5` func...
lib/bitcraft/helpers.ex
0.637708
0.491944
helpers.ex
starcoder
defmodule Scientist.Experiment do @moduledoc """ A behaviour module for creating and running experiments. An experiment contains all information about how your control and candidate functions operate, and how their observations are reported. Experiments include functionality for determining when they should ...
lib/scientist/experiment.ex
0.893228
0.694251
experiment.ex
starcoder
defmodule ExPlasma.Builder do @moduledoc """ Helper module to make crafting plasma transactions much simpler. """ alias ExPlasma.Output alias ExPlasma.Transaction alias ExPlasma.Transaction.Signed @type tx_opts :: [ inputs: Transaction.outputs(), outputs: Transaction.outputs(), ...
lib/ex_plasma/builder.ex
0.875202
0.418162
builder.ex
starcoder
defmodule Donut.GraphQL.Result do @moduledoc """ Create a result type for GraphQL queries. These result types standardize the result interfaces and error behaviour that the client with interact with. ## Example \# Declare a result with only one custom type result :new_type,...
apps/donut_graphql/lib/donut.graphql/result.ex
0.877608
0.609728
result.ex
starcoder
defmodule Example_Macro do defmodule Example do defmacro macro_inspect(value) do IO.inspect(value) value end def fun_inspect(value) do IO.inspect(value) value end end defmodule MySigils do defmacro sigil_x(term, [?r]) do quote do unquote(term) |> String...
lib/beam/macro/macro.ex
0.62681
0.627737
macro.ex
starcoder
defmodule Retex.Node.PNode do @moduledoc """ Production node. This is like a production node in Rete algorithm. It is activated if all the conditions in a rule are matching and contains the action that can be executed as consequence. """ defstruct action: nil, id: nil, raw_action: nil, bindings: %{}, filters:...
lib/nodes/p_node.ex
0.726717
0.534005
p_node.ex
starcoder
defmodule Rihanna.Migration do @max_32_bit_signed_integer (:math.pow(2, 31) |> round) - 1 @moduledoc """ A set of tools for creating the Rihanna jobs table. Rihanna stores jobs in a table in your database. The default table name is "rihanna_jobs". The name is configurable by either passing it as an argument...
lib/rihanna/migration.ex
0.88984
0.725083
migration.ex
starcoder
defmodule Stats do require Integer @doc """ returns the mean of a list of numbers ## Examples iex> Stats.mean([]) 0.0 iex> Stats.mean([2]) 2.0 iex> Stats.mean([7, 2, 9]) 6.0 iex> Stats.mean([7, 2, 9, 5]) 5.75 """ @spec mean(list) :: float def mean([]) do ...
higher_order/lib/stats.ex
0.856902
0.549701
stats.ex
starcoder
defmodule Logrex do @moduledoc """ An Elixir package for more easily adding Logger metadata and formatting the console output so it's easier for humans to parse. It wraps Elixir's Logger module to let you write code like this: ``` > use Logrex > name = "Matt" > user_info = %{login_count: 1} > Logrex...
lib/logrex.ex
0.748168
0.791297
logrex.ex
starcoder
defmodule Exkii.Text do @moduledoc """ `Exkii.Text` module helps to transform a string into a ASCII art string """ # Single letter ascii art with @width 9 @doc """ Returns a string with each alphabet letter. ## Examples iex> Exkii.Text.alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ" """ def...
lib/exkii/text.ex
0.918667
0.49048
text.ex
starcoder
defmodule Bolt.Sips.Internals.BoltProtocolV3 do alias Bolt.Sips.Internals.BoltProtocol alias Bolt.Sips.Internals.BoltProtocolHelper alias Bolt.Sips.Internals.Error @doc """ Implementation of Bolt's HELLO. It initialises the connection. Expects a transport module (i.e. `gen_tcp`) and a `Port`. Accepts au...
lib/bolt_sips/internals/bolt_protocol_v3.ex
0.816113
0.566019
bolt_protocol_v3.ex
starcoder
defmodule Ueberauth.Strategy.ADFS do @moduledoc """ ADFS Strategy for Überauth. In ADFS Server setup a new Client using Powershell: ```powershell Add-AdfsClient -Name "OAUTH2 Client" -ClientId "unique-custom-client-id" -RedirectUri "http://localhost:4000/auth/adfs/callback" Add-ADFSRelyingPartyTrust -Name...
lib/ueberauth/adfs.ex
0.732496
0.596316
adfs.ex
starcoder
defmodule ExBin do @moduledoc """ Documentation for ExBin. """ @doc """ Creates a stream for fetching bytes within a binary. Ideal for large volumes of bytes, or large binaries. ## Examples iex> ExBin.byte_stream(<<0x01, 0x02, 0x03>>) |> Enum.take(2) [1, 2] """ def byte_stream(binary) ...
lib/ex_bin.ex
0.812793
0.564939
ex_bin.ex
starcoder
defmodule Remedy.Consumer do @moduledoc """ Consumer process for gateway event handling. ## Consuming Dispatch Events To handle events, Remedy uses a GenStage implementation. Remedy defines the `producer` and `producer_consumer` in the GenStage design. To consume the events you must create at least one `c...
lib/remedy/consumer.ex
0.8575
0.710013
consumer.ex
starcoder
defmodule Enphex do @moduledoc """ Enphex is an Elixir wrapper for [Enphase API](https://developer.enphase.com/docs) All the API calls defined here follow the [API documentation](https://developer.enphase.com/docs) Please refer to the documentation. You can pass a map of URL parameters as the `params` value...
lib/enphex.ex
0.828835
0.515803
enphex.ex
starcoder
defmodule Options do @moduledoc false @doc """ List that represents an available option names for new pool creation. """ @spec names :: [ :fifo | :max_active | :max_idle | :max_idle_time | :max_wait | :min_idle | :test_on_borrow ...
lib/resource_pool.ex
0.886224
0.558929
resource_pool.ex
starcoder
defimpl String.Chars, for: Protocol.Dns do @doc """ Prints a DNS packet to a human readable string """ @spec to_string(Protocol.Dns.t) :: String.t def to_string(dns) do """ DNS: #{dns.header} Length: #{byte_size(dns.data)} Parsed: Questions: #{dns.pars...
lib/protocol/dns.ex
0.613468
0.44559
dns.ex
starcoder
defmodule Linear do @doc """ Apply a linear rule to a signed formula. Returns a list of conclusions. ## Examples iex> Linear.apply_linear({:t, {:not, :p}}) [{:f, :p}] iex> Linear.apply_linear({:f, {:not, :p}}) [{:t, :p}] iex> Linear.apply_linear({:t, {:p, :and, :q}}) [{:t...
lib/linear.ex
0.874573
0.793506
linear.ex
starcoder
defmodule MailerLite.Stats do @moduledoc """ Account statitistics. """ @typedoc """ MailerLite stats object """ @type stats :: %{subscribed: non_neg_integer, unsubscribed: non_neg_integer, campaigns: non_neg_integer, sent_emails: non_neg_integer, ...
lib/stats.ex
0.832475
0.421969
stats.ex
starcoder
defmodule OT.Server do @moduledoc """ A safe API for interacting with operations and the data they operate against. """ use GenServer @typedoc """ A map containing OT-related information. This map must contain at least three keys: - `type`: A string representing the OT type, which will be used to fi...
lib/ot/server.ex
0.906867
0.658361
server.ex
starcoder
defmodule Cocktail.Validation do @moduledoc false alias Cocktail.Validation.{ Day, HourOfDay, Interval, MinuteOfHour, ScheduleLock, SecondOfMinute, TimeOfDay, TimeRange } @type validation_key :: :base_sec | :base_min | :base_hour | :base_...
lib/cocktail/validation.ex
0.812904
0.485295
validation.ex
starcoder
defmodule SvgBuilder.Element do @moduledoc """ Create and manipulate basic SVG elements. Elements are represented the same as XmlBuilder elements as a tuple with three values, the tag name, atttributes and child elements. ## Example iex> Element.element(:text, %{}, "A text element") {:text, %{}...
lib/element.ex
0.888569
0.710892
element.ex
starcoder
defmodule SNTP do @moduledoc """ SNTP v4 client [RFC4330](https://tools.ietf.org/html/rfc4330) for Elixir """ alias SNTP.{Retriever, RetrieverError, Socket, Timestamp} @doc """ Returns the system time in milliseconds. If the `SNTP.Retriever` is running then it will return the adjusted system time. ## ...
lib/sntp.ex
0.912221
0.540621
sntp.ex
starcoder
defmodule Day14.Table do @moduledoc """ Functions for creating and working with a table of chemical reactions. A chemical reaction table is represented as a digraph where each vertex is a material. The graph has edges from the output of a reaction to each input required for the reaction, with labels for the ...
aoc2019_elixir/apps/day14/lib/table.ex
0.903736
0.839471
table.ex
starcoder
defmodule Mox do @moduledoc """ Mox is a library for defining concurrent mocks in Elixir. The library follows the principles outlined in ["Mocks and explicit contracts"](http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/), summarized below: 1. No ad-hoc mocks. You can only create moc...
lib/mox.ex
0.861786
0.679664
mox.ex
starcoder
defmodule RepoCache.Log do @moduledoc """ Responsible for logging hit/miss rates for the different caches. Maintains an ETS table of hit/miss rates, which looks like: {{repo_module, function_name}, hit_count, miss_count} Every 60 seconds, we reset the counts and log the rates, along with the sizes of the...
apps/repo_cache/lib/log.ex
0.66628
0.468365
log.ex
starcoder
# Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, # copy, modify, merge, publish, distribute, sublicense, and/or sell # c...
lib/cfxxl/client.ex
0.747339
0.559771
client.ex
starcoder
defmodule CImg do @moduledoc """ CImg image processing extention. """ alias __MODULE__ # image object defstruct handle: nil, shape: {} @doc """ load the image file and create new image object. """ def create(fname) do with {:ok, h, [shape]} <- CImgNIF.cimg_load(fname), do: %CImg{handle: ...
lib/cimg.ex
0.806738
0.552238
cimg.ex
starcoder
defmodule BlueHeron.ErrorCode do @moduledoc """ Defines all error codes and functions to map between error code and name. > When a command fails, or an LMP, LL, or AMP message needs to indicate a failure, error codes > are used to indicate the reason for the error. Error codes have a size of one octet. Refe...
lib/blue_heron/error_code.ex
0.796094
0.462716
error_code.ex
starcoder
defmodule Day11 do def part1(program) do robot = operate_robot(program) Robot.num_painted_panels(robot) end def part2(program) do robot = operate_robot(program, %{{0,0} => 1}) Robot.draw_grid(robot) end defp operate_robot(program, initial_grid \\ %{}) do machine = Intcode.new(program) ...
day11/lib/day11.ex
0.586523
0.555496
day11.ex
starcoder
defmodule Pharams do @moduledoc """ Functions and macros for validating requests to Phoenix Controllers. """ alias Pharams.Utils @doc """ Takes a nested struct data structure and turns it into a map with atoms as keys. """ def schema_to_atom_map(map) when is_map(map) do map |> Map.delete(:...
lib/pharams.ex
0.529263
0.439507
pharams.ex
starcoder
defmodule Bouncer.Token do @moduledoc """ A library of functions used to work with session data. """ alias Phoenix.Token def adapter, do: Application.get_env(:bouncer, :adapter) @doc """ Generates a token, uses it as a key to save user data to the store, and associates it with the user's ID. """ ...
lib/bouncer/token.ex
0.784814
0.585901
token.ex
starcoder
defmodule ISBN do @moduledoc """ Documentation for ISBN. """ @isbn13_multipliers [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3] @isbn10_multipliers [1, 2, 3, 4, 5, 6, 7, 8, 9] @doc """ Checks if the given string is a valid ISBN. Works with both ISBN-10 and ISBN-13. Allows hyphens and spaces in the string. #...
lib/isbn.ex
0.804713
0.429788
isbn.ex
starcoder
defmodule Metatags do @moduledoc """ Metatags is used to provide an easy api to print out context-specific metatags. """ alias Phoenix.HTML.Tag @sitename Application.get_env(:metatags, :sitename) @default_meta_tags Application.get_env(:metatags, :default_tags, %{}) @separator Application.get_env(:m...
lib/metatags.ex
0.800185
0.732974
metatags.ex
starcoder
defmodule Recase.NameCase do @moduledoc """ Module to convert strings to `Name Case`. This module should not be used directly. ## Examples iex> Recase.to_name "mccarthy o'donnell" "<NAME>" Read about `Name Case` here: https://metacpan.org/pod/Lingua::EN::NameCase """ import Recase.Replac...
lib/recase/cases/name_case.ex
0.687105
0.42674
name_case.ex
starcoder
defmodule Guards do # Uses the sentinel values of # :guard # :empty # :locked # Is this space valid for visiting, on the board + empty. defp is_valid({_board, rows, cols}, {r, c}) when r < 0 or c < 0 or r >= rows or c >= cols do false end defp is_valid({board, _rows, _cols}, {r, c}) do value(bo...
lib/guards.ex
0.700075
0.767951
guards.ex
starcoder
defmodule Ecto.Adapters.Mnesia.Read do @moduledoc false require Qlc alias Ecto.Adapters.Mnesia.Record alias Ecto.Adapters.Mnesia.Table alias Ecto.Query.BooleanExpr alias Ecto.Query.QueryExpr alias Ecto.Query.SelectExpr @order_mapping %{ asc: :ascending, desc: :descending } def query(selec...
lib/ecto/adapters/mnesia/read.ex
0.583559
0.443902
read.ex
starcoder
defmodule Aoc2019Day12 do def solve1(input, steps \\ 10) do [a, b, c, d] = parse_input(input) do_n_steps(a, b, c, d, steps) |> Enum.map(&total_energy_for_a_moon/1) |> Enum.sum() end def parse_input(input) do input |> String.trim() |> String.split("\n", [:trim, true]) |> Enum.map(&parse/1)...
lib/aoc2019_day12.ex
0.698946
0.650342
aoc2019_day12.ex
starcoder
defmodule ExWire.Packet.Capability.Par.Transactions do @moduledoc """ Par Wire Packet for communicating new transactions. ``` **Transactions** [`+0x02`: `P`, [`nonce`: `P`, `receivingAddress`: `B_20`, `value`: `P`, ...], ...] Specify (a) transaction(s) that the peer should make sure is included on its tra...
apps/ex_wire/lib/ex_wire/packet/capability/par/transactions.ex
0.838614
0.852752
transactions.ex
starcoder
defmodule TimeZoneInfo.IanaParser.Helper do @moduledoc false import NimbleParsec @seconds_per_hour 3600 @seconds_per_minute 60 @op %{ ">=" => :ge, "<=" => :le } @default_time_standard :wall @time_standard %{ "w" => @default_time_standard, "s" => :standard, "g" => :gmt, "u" => ...
lib/time_zone_info/iana_parser/helper.ex
0.565059
0.445771
helper.ex
starcoder
defmodule <%= inspect schema.module %>Token do use Ecto.Schema import Ecto.Query @hash_algorithm :sha256 @rand_size 32 # It is very important to keep the reset password token expiry short, # since someone with access to the email may take over the account. @reset_password_validity_in_days 1 @confirm_v...
priv/templates/phx.gen.auth/schema_token.ex
0.528047
0.464841
schema_token.ex
starcoder
defmodule Membrane.H264.FFmpeg.Decoder do @moduledoc """ Membrane element that decodes video in H264 format. It is backed by decoder from FFmpeg. The element expects the data for each frame (Access Unit) to be received in a separate buffer, so the parser (`Membrane.H264.FFmpeg.Parser`) may be required in a pip...
lib/membrane_h264_ffmpeg/decoder.ex
0.898572
0.436622
decoder.ex
starcoder
defmodule Axon.Schedules do @moduledoc """ Parameter Schedules. Parameter schedules are often used to anneal hyperparameters such as the learning rate during the training process. Schedules provide a mapping from the current time step to a learning rate or another hyperparameter. Choosing a good learnin...
lib/axon/schedules.ex
0.860852
0.964422
schedules.ex
starcoder
defmodule Wasmex do @moduledoc """ Wasmex is an Elixir library for executing WebAssembly binaries. WASM functions can be executed like this: ```elixir {:ok, bytes } = File.read("wasmex_test.wasm") {:ok, instance } = Wasmex.start_link.from_bytes(bytes) {:ok, [42]} == Wasmex.call_function(instance, "sum"...
lib/wasmex.ex
0.920299
0.876634
wasmex.ex
starcoder
defmodule BehaviorTree do @moduledoc """ A library for building [behavior trees](https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)). ### About A behavior tree is a method for encapsulating complex, nested logic in a declarative data structure. They are often used for...
lib/behavior_tree.ex
0.937132
0.90444
behavior_tree.ex
starcoder
defmodule OMG.Watcher.ExitProcessor.DoubleSpend do @moduledoc """ Wraps information about a single double spend occuring between a verified transaction and a known transaction """ defstruct [:index, :utxo_pos, :known_spent_index, :known_tx] alias OMG.State.Transaction alias OMG.Utxo alias OMG.Watcher.E...
apps/omg_watcher/lib/omg_watcher/exit_processor/double_spend.ex
0.839076
0.574425
double_spend.ex
starcoder
defmodule Aoc.Year2018.Day01 do @moduledoc """ Solution to Day 01 of 2018: Chronal Calibration ## --- Day 01: Chronal Calibration --- "We've detected some temporal anomalies," one of Santa's Elves at the Temporal Anomaly Research and Detection Instrument Station tells you. She sounded pretty worried when ...
lib/aoc/year_2018/day_01.ex
0.880624
0.844729
day_01.ex
starcoder
defmodule Graph.Utils do @moduledoc false @compile {:inline, [vertex_id: 1, edge_weight: 3]} @binary_heap_limit 64 @doc """ A large portion of the code for `sizeof/1` is based on `erlang_term` which can be found at [here](https://github.com/okeuday/erlang_term), authored by <NAME>, and licensed under th...
lib/graph/utils.ex
0.59749
0.591104
utils.ex
starcoder
defmodule Taskmaster do @moduledoc """ A set of convenience functions for concurrent, asynchronous tasks, loosely inspired by JavaScript's Promises. ## Why? While Elixir's `Task` module provides an API for easy creation of concurrent processes, it does so by *blocking* the caller process on calls to `Task.awa...
lib/taskmaster.ex
0.782247
0.676934
taskmaster.ex
starcoder
defmodule Exgencode.Pdu do @moduledoc """ The module contains functions for operating with PDUs defined with the `defpdu/2` macro. """ @doc "Returns the size of the field in bits." @spec sizeof(Exgencode.pdu(), atom) :: non_neg_integer | {:subrecord, Exgencode.pdu()} def sizeof(pdu, fieldName), do: Exgenc...
lib/exgencode/pdu.ex
0.885217
0.54359
pdu.ex
starcoder
defmodule CxLeaderboard.Indexer.Stats do @moduledoc """ This module is full of functions that can be used in a custom indexer. Each uses a different way of calculating stats. Do you want your ranks to go sequentially, like `1, 1, 2`? Then choose one of the `sequential_rank_*` functions. Want them offset inste...
lib/cx_leaderboard/indexer/stats.ex
0.876892
0.773302
stats.ex
starcoder
if Code.ensure_loaded?(Ecto.Type) do defmodule Cldr.UnitWithUsage.Ecto.Composite.Type do @moduledoc """ Implements the Ecto.Type behaviour for a user-defined Postgres composite type called `:cldr_unit`. This is the preferred option for Postgres database since the serialized unit value is stored a...
lib/cldr/unit/ecto/unit_with_usage_ecto_composite_type.ex
0.768516
0.489442
unit_with_usage_ecto_composite_type.ex
starcoder
defmodule AWS.GameLift do @moduledoc """ GameLift Service Amazon Web Services provides solutions for hosting session-based multiplayer game servers in the cloud, including tools for deploying, operating, and scaling game servers. Built on Amazon Web Services global computing infrastructure, GameLift help...
lib/aws/generated/game_lift.ex
0.874158
0.732305
game_lift.ex
starcoder
defmodule AWS.LakeFormation do @moduledoc """ AWS Lake Formation Defines the public endpoint for the AWS Lake Formation service. """ @doc """ Batch operation to grant permissions to the principal. """ def batch_grant_permissions(client, input, options \\ []) do request(client, "BatchGrantPermissi...
lib/aws/lake_formation.ex
0.819352
0.470068
lake_formation.ex
starcoder
defmodule MangoPay do @moduledoc """ The elixir client for MangoPay API. This module is the root of all the application. ## Configuring Set your API key by configuring the :mangopay application. ``` config :mangopay, client_id: YOUR_MANGOPAY_CLIENT_ID config :mangopay, passphrase: <PASSWORD> ``...
lib/mango_pay.ex
0.748076
0.611005
mango_pay.ex
starcoder
defmodule Bitcoin.Protocol.Messages.GetBlocks do @moduledoc """ Return an inv packet containing the list of blocks starting right after the last known hash in the block locator object, up to hash_stop or 500 blocks, whichever comes first. The locator hashes are processed by a node in the order as they a...
lib/bitcoin/protocol/messages/get_blocks.ex
0.812719
0.519338
get_blocks.ex
starcoder
defmodule Config do @moduledoc ~S""" A simple keyword-based configuration API. ## Example This module is most commonly used to define application configuration, typically in `config/config.exs`: import Config config :some_app, key1: "value1", key2: "value2" import_config...
lib/elixir/lib/config.ex
0.894271
0.493103
config.ex
starcoder
defmodule Unit do @moduledoc """ Types and helper functions to safely work with and convert between units """ import Kernel, except: [+: 1, +: 2, -: 1, -: 2, *: 2, /: 2] defmacro __using__(_) do quote do import Unit import Kernel, except: [+: 1, +: 2, -: 1, -: 2, *: 2, /: 2] end en...
lib/unit.ex
0.798776
0.839405
unit.ex
starcoder
defmodule ExqLimit.Global do @moduledoc """ Exq comes with concurrency control support per queue, but it's limited to a single worker node. This module on the other hand limits the concurrency globally across all the worker nodes. For example, with a limit of 10, if there are two active worker nodes, each w...
lib/exq_limit/global.ex
0.869701
0.63576
global.ex
starcoder
defmodule Harmonex.Pitch do @moduledoc """ Provides functions for working with pitches on the Western dodecaphonic scale. """ alias Harmonex.Interval defstruct natural_name: nil, accidental: :natural, octave: nil @typedoc """ A `Harmonex.Pitch` struct. """ @type pitch :: %Harmonex.Pitch{natural_name...
lib/harmonex/pitch.ex
0.936263
0.666239
pitch.ex
starcoder