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 GenQueue do @moduledoc """ A behaviour module for implementing queues. GenQueue relies on adapters to handle the specifics of how the queues are run. At its most simple, this can mean basic memory FIFO queues. At its most advanced, this can mean full async job queues with retries and backoffs. By...
lib/gen_queue.ex
0.888822
0.587529
gen_queue.ex
starcoder
defmodule ScrapyCloudEx.Endpoints.Storage do @moduledoc """ Documents commonalities between all storage endpoint-related functions. ## Format The `:format` option given as an optional parameter must be one of `:json`, `:csv`, `:html`, `:jl`, `:text`, `:xml`. If none is given, it defaults to `:json`. Note ...
lib/endpoints/storage.ex
0.944035
0.958343
storage.ex
starcoder
defmodule Mix.Tasks.Renew do use Mix.Task @shortdoc "Creates a new Elixir project based on Nebo #15 requirements." @moduledoc """ Creates a new Elixir project. It expects the path of the project as argument. mix renew PATH [--module MODULE] [--app APP] [--umbrella | --ecto --amqp --sup --phoenix] [--...
lib/mix/renew.ex
0.805326
0.509703
renew.ex
starcoder
defmodule AdventOfCode.Day13 do import AdventOfCode.Utils @typep coords :: {integer(), integer()} @typep fold :: {:x | :y, integer()} @spec part1([binary()]) :: integer() def part1(args) do {coords, [fold | _]} = parse_args(args) apply_fold(fold, coords) |> Enum.count() end @spec part2([binary(...
lib/advent_of_code/day_13.ex
0.734215
0.428831
day_13.ex
starcoder
defmodule Brook.Storage do @moduledoc """ Defines the `Brook.Storage` behaviour that must be implemented by storage driver processes. Starts a process and defines a child specification for including the driver in Brook's supervision tree. Implements the CRUD functionality for persisting events to the applica...
lib/brook/storage.ex
0.8477
0.551211
storage.ex
starcoder
defmodule Cldr.LanguageTag.Parser do @moduledoc """ Parses a CLDR language tag (also referred to as locale string). The applicable specification is from [CLDR](http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers) which is similar based upon [RFC5646](https://tools.ietf.org/html/rfc5646) wi...
lib/cldr/language_tag/parser.ex
0.897131
0.634458
parser.ex
starcoder
defmodule NioDokku do @doc """ Connects to a specific IP address using SSH. Returns the PID for the invoked connection or returns the atom descibing the error if there was an error connecting. """ def dokku(ip) when is_binary(ip), do: connect(ip) @doc """ Takes a PID and a string and runs the ...
lib/nio_dokku.ex
0.784732
0.462776
nio_dokku.ex
starcoder
defmodule ArangoXEcto.GeoData do @moduledoc """ Methods for interacting with ArangoDB GeoJSON and geo related functions The methods within this module are really just helpers to generate `Geo` structs. """ @type coordinate :: number() defguard is_coordinate(coordinate) when is_float(coordinate) or is_int...
lib/arangox_ecto/geodata.ex
0.911574
0.799677
geodata.ex
starcoder
defmodule Elsol do use HTTPoison.Base # deprecated def query(query_arg), do: _query(query_arg, false, [], [recv_timeout: 30000]) def query!(query_arg), do: _query(query_arg, true, [], [recv_timeout: 30000]) def query(query_arg, timeout) when is_integer(timeout), do: _query(query_arg, false, [], [recv_timeou...
lib/elsol.ex
0.77552
0.450722
elsol.ex
starcoder
import Kernel, except: [abs: 1] defmodule RationalNumbers do @type rational :: {integer, integer} @doc """ Add two rational numbers """ @spec add(a :: rational, b :: rational) :: rational def add({a1, b}, {a2, b}) when a1 === a2 * -1, do: {0, 1} def add({a1, b1}, {a2, b2}), do: {a1 * b2 + a2 * b1, b1 * ...
exercism/elixir/rational-numbers/lib/rational_numbers.ex
0.848157
0.489503
rational_numbers.ex
starcoder
defmodule Numato.Gpio do use GenStage defmodule State do defstruct [ uart_pid: nil, last_command: nil ] end def start_link(uart_pid) do GenStage.start_link(__MODULE__, uart_pid) end def init(uart_pid) when is_pid(uart_pid) do {:producer, %State{uart_pid: uart_pid}} end de...
lib/numato_gpio.ex
0.771499
0.495484
numato_gpio.ex
starcoder
defmodule Membrane.WebRTC.EndpointBin do @moduledoc """ Module responsible for interacting with a WebRTC peer. To send or receive tracks from a WebRTC peer, specify them with `:inbound_tracks` and `:outbound_tracks` options, and link corresponding `:input` and `:output` pads with ids matching the declared tr...
lib/membrane_webrtc_plugin/endpoint_bin.ex
0.896849
0.478773
endpoint_bin.ex
starcoder
defmodule Litmus.Type.DateTime do @moduledoc """ This type validates DateTimes. It accepts either `DateTime` structs or ISO-8601 strings. ISO-8601 datetime with timezone strings will be converted into `DateTime`s. ## Options * `:default` - Setting `:default` will populate a field with the provided ...
lib/litmus/type/date_time.ex
0.925188
0.455986
date_time.ex
starcoder
defmodule PinElixir.Charge do import PinElixir.Utils.RequestOptions import PinElixir.Utils.Response @moduledoc """ Handles the creation and retrieval of charges """ @pin_url Application.get_env(:pin_elixir, :pin_url) @doc """ Retreives all charges Returns a tuple ``` {:ok, %{charges: [%{a...
lib/charges/charge.ex
0.76708
0.726583
charge.ex
starcoder
defmodule Hound.Helpers.Element do @moduledoc "Provides functions related to elements." @type element_selector :: {atom, String.t} @type element :: element_selector | String.t @doc """ Gets visible text of element. Requires the element ID. element_id = find_element(:css, ".example") visible_tex...
lib/hound/helpers/element.ex
0.726523
0.442757
element.ex
starcoder
defmodule Flop.Meta do @moduledoc """ Defines a struct for holding meta information of a query result. """ @typedoc """ Meta information for a query result. - `:flop` - The `Flop` struct used in the query. - `:current_offset` - The `:offset` value used in the query when using offset-based pagination...
lib/flop/meta.ex
0.91358
0.861072
meta.ex
starcoder
defmodule Snitch.Data.Model.TaxRate do @moduledoc """ Model functions TaxRate. """ use Snitch.Data.Model alias Snitch.Data.Schema.TaxRate @doc """ Creates a TaxRate with supplied `params`. > ### Note The `calculator` field should be converted to an `atom` before passing in the `params` map. ...
apps/snitch_core/lib/core/data/model/tax_rate.ex
0.865153
0.677787
tax_rate.ex
starcoder
defmodule Gradient.Tokens do @moduledoc """ Functions useful for token management. """ alias Gradient.Types, as: T @typedoc "Type of conditional with following tokens" @type conditional_t() :: {:case, T.tokens()} | {:cond, T.tokens()} | {:unless, T.tokens()} | {:if, ...
lib/gradient/tokens.ex
0.848471
0.521715
tokens.ex
starcoder
defmodule LiveProps.LiveView do @moduledoc ~S''' Use this module inside a Phoenix.LiveView to expose to add state to your LiveView. ### LiveView Lifecycle with LiveProps LiveProps injects lightweight `c:Phoenix.LiveView.mount/3` and `c:Phoenix.LiveView.handle_info/2` callbacks to help manage state. If yo...
lib/live_props/live_view.ex
0.858125
0.457924
live_view.ex
starcoder
defmodule ExAliyunOts do @moduledoc ~S""" The `ExAliyunOts` module provides a tablestore-based API as a client for working with Alibaba TableStore product servers. Here are links to official documents in [Chinese](https://help.aliyun.com/document_detail/27280.html) | [English](https://www.alibabacloud.com/help/p...
lib/ex_aliyun_ots.ex
0.882965
0.465145
ex_aliyun_ots.ex
starcoder
defmodule Money.Subscription.Change do @moduledoc """ Defines the structure of a plan changeset. * `:first_interval_starts` which is the start date of the first interval for the new plan * `:first_billing_amount` is the amount to be billed, net of any credit, at the `:first_interval_starts` * `:nex...
lib/money/subscription/change.ex
0.886181
0.906777
change.ex
starcoder
defmodule AshPostgres.Functions.TrigramSimilarity do @moduledoc """ A filter predicate that filters based on trigram similarity. See the postgres docs on [https://www.postgresql.org/docs/9.6/pgtrgm.html](trigram) for more information. Requires the pg_trgm extension. Configure which extensions you have install...
lib/functions/trigram_similarity.ex
0.88504
0.681707
trigram_similarity.ex
starcoder
defmodule Seasonal.Pool do @moduledoc """ Provides a set of functions for using worker pools. Unlike the main `Seasonal` module, this module allows for working directly with unnamed and unsupervised pools. """ use GenServer defmodule State do @moduledoc false defstruct [ workers: 1, ...
lib/seasonal/pool.ex
0.734405
0.553747
pool.ex
starcoder
defmodule Mix.Tasks.Hydra do use Mix.Task @shortdoc "Starts a Hydra server" @moduledoc @shortdoc @ascii """ .. . ..:M... I. .. .. . ..... . NM ..M.. . ........ , ..MZ O...
lib/mix/tasks/hydra.ex
0.574634
0.651587
hydra.ex
starcoder
defmodule Doorman do @moduledoc """ Provides authentication helpers that take advantage of the options configured in your config files. """ @doc """ Authenticates a user by their email and password. Returns the user if the user is found and the password is correct, otherwise nil. Requires `user_module...
lib/doorman.ex
0.874131
0.736756
doorman.ex
starcoder
defmodule AWS.NetworkManager do @moduledoc """ Transit Gateway Network Manager (Network Manager) enables you to create a global network, in which you can monitor your AWS and on-premises networks that are built around transit gateways. """ @doc """ Associates a customer gateway with a device and optiona...
lib/aws/generated/network_manager.ex
0.818229
0.423279
network_manager.ex
starcoder
defmodule Tensorflow.TensorProto do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ dtype: Tensorflow.DataType.t(), tensor_shape: Tensorflow.TensorShapeProto.t() | nil, version_number: integer, tensor_content: binary, half_val: [integer], ...
lib/messages/tensorflow/core/framework/tensor.pb.ex
0.79158
0.820146
tensor.pb.ex
starcoder
defmodule EctoIPRange.IP4R do @moduledoc """ Struct for PostgreSQL `:ip4r`. ## Usage When used during a changeset cast the following values are accepted: - `:inet.ip4_address()`: an IP4 tuple, e.g. `{127, 0, 0, 1}` (single address only) - `binary` - `"127.0.0.1"`: single address - `"127.0.0.0/24"...
lib/ecto_ip_range/ip4r.ex
0.900638
0.534309
ip4r.ex
starcoder
defmodule ExUnit.DuplicateTestError do defexception [:message] end defmodule ExUnit.DuplicateDescribeError do defexception [:message] end defmodule ExUnit.Case do @moduledoc """ Helpers for defining test cases. This module must be used in other modules as a way to configure and prepare them for testing. ...
lib/ex_unit/lib/ex_unit/case.ex
0.865082
0.738881
case.ex
starcoder
defmodule VintageNet do @moduledoc """ `VintageNet` is network configuration library built specifically for [Nerves Project](https://nerves-project.org) devices. It has the following features: * Ethernet and WiFi support included. Extendible to other technologies * Default configurations specified in your Ap...
lib/vintage_net.ex
0.898023
0.624379
vintage_net.ex
starcoder
defmodule Segment.Analytics.Batcher do @moduledoc """ The `Segment.Analytics.Batcher` module is the default service implementation for the library which uses the [Segment Batch HTTP API](https://segment.com/docs/sources/server/http/#batch) to put events in a FIFO queue and send on a regular basis. Th...
lib/segment/batcher.ex
0.912859
0.855187
batcher.ex
starcoder
defmodule Crudry.Query do @moduledoc """ Generates Ecto Queries. All functions in this module return an `Ecto.Query`. Combining the functions in this module can be very powerful. For example, to do pagination with filter and search: pagination_params = %{limit: 10, offset: 1, order_by: "id", sorting_or...
lib/crudry_query.ex
0.883399
0.520801
crudry_query.ex
starcoder
defmodule Whisk do @moduledoc """ The scrambler. """ @typedoc """ A string representation of a puzzle type. See `puzzle_types/0` for supported values. """ @type puzzle_type :: atom() @typedoc """ A scramble is string representing a sequence of moves, separated by spaces. Moves are also strings...
lib/whisk.ex
0.858006
0.894329
whisk.ex
starcoder
defmodule Rolodex.Config do @moduledoc """ A behaviour for defining Rolodex config and functions to parse config. To define your config for Rolodex, `use` Rolodex.Config in a module and override the default behaviour functions. Then, tell Rolodex the name of your config module in your project's configuration...
lib/rolodex/config.ex
0.873525
0.482856
config.ex
starcoder
defmodule GrpcMock do @moduledoc """ GrpcMock is library for easy gRPC server mocking to be used with [grpc-elixir library](https://github.com/tony612/grpc-elixir). ### Concurrency Unlike `mox`, GrpcMock is not thread-safe and cannot be used in concurrent tests. ## Example As an example, imagine that y...
lib/grpc_mock.ex
0.907271
0.50061
grpc_mock.ex
starcoder
defimpl Cog.Eval, for: Piper.Permissions.Ast.BinaryExpr do alias Cog.Eval alias Cog.Permissions.Context alias Piper.Permissions.Ast def value_of(%Ast.BinaryExpr{op: op, left: lhs, right: rhs}, context) do comparator = comparison_type_to_function(op) {lhsv, context} = Eval.value_of(lhs, context) {r...
lib/cog/permissions/eval/binary_expr.ex
0.746046
0.448487
binary_expr.ex
starcoder
defmodule Brando.Images.Utils do @moduledoc """ General utilities pertaining to the Images module """ @type id :: binary | integer @type image_kind :: :image | :image_series | :image_field @type image_schema :: Brando.Image.t() @type image_series_schema :: Brando.ImageSeries.t() @type image_struct :: Br...
lib/brando/images/utils.ex
0.904427
0.476701
utils.ex
starcoder
defmodule Elsa.Consumer.WorkerSupervisor do @moduledoc """ Supervisor that starts and manages consumer worker processes based on given configuration. Without a specified `:partition`, starts a worker for each partition on the configured topic. Otherwise, starts a worker for the single, specified partition. ...
lib/elsa/consumer/worker_supervisor.ex
0.729327
0.432003
worker_supervisor.ex
starcoder
defmodule Geonames do @moduledoc """ Geonames-Elixir is a simple wrapper around the API provided by geonames.org. All interaction with the API is provied by this module via easy to use functions. Each API endpoint maps to a single function, all of which requiring a map containing the parameters of the requ...
lib/geonames.ex
0.825906
0.580144
geonames.ex
starcoder
defmodule Absinthe.Adapter.LanguageConventions do use Absinthe.Adapter alias Absinthe.Utils @moduledoc """ This defines an adapter that supports GraphQL query documents in their conventional (in JS) camelcase notation, while allowing the schema to be defined using conventional (in Elixir) underscore (snake...
deps/absinthe/lib/absinthe/adapter/language_conventions.ex
0.837819
0.770594
language_conventions.ex
starcoder
defmodule Asteroid.OAuth2.PKCE do @moduledoc false alias Asteroid.OAuth2 @type code_challenge :: String.t() @type code_challenge_method :: :plain | :S256 @typedoc """ Must be the string representation of `t:code_challenge_method/0` """ @type code_challenge_method_str :: String.t() @type code_ver...
lib/asteroid/oauth2/pkce.ex
0.897673
0.54819
pkce.ex
starcoder
defmodule ExMock do @moduledoc """ ExMock modules for testing purposes. Usually inside a unit test. Please see the README file on github for a tutorial ## Example defmodule MyTest do use ExUnit.Case import ExMock test "get" do with_mock HTTPotion, [get: ...
lib/ex_mock.ex
0.869174
0.661121
ex_mock.ex
starcoder
defmodule Kuddle.Encoder do @moduledoc """ Encodes a Kuddle document into a KDL blob """ alias Kuddle.Value alias Kuddle.Node import Kuddle.Utils @doc """ Encodes a kuddle document as a KDL string """ @spec encode(Kuddle.Decoder.document()) :: {:ok, String.t()} | {:error, term(...
lib/kuddle/encoder.ex
0.703142
0.54952
encoder.ex
starcoder
import TypeClass defclass Witchcraft.Bifunctor do @moduledoc """ Similar to `Witchcraft.Functor`, but able to map two functions over two separate portions of some data structure (some product type). Especially helpful when you need different hebaviours on different fields. ## Type Class An instance of `...
lib/witchcraft/bifunctor.ex
0.731251
0.502258
bifunctor.ex
starcoder
defmodule Riptide.Store.SQL do defstruct [:table, :columns, :where, :mode, :set] def new(table) do %Riptide.Store.SQL{ table: table, columns: [], set: [], where: %{} } end def select(table) do table |> new() |> Map.put(:mode, "SELECT") end def update(table) do ...
packages/elixir/lib/riptide/store/sql.ex
0.532668
0.449936
sql.ex
starcoder
defmodule Utils do @moduledoc """ A module gathering function which provide functionalities used in different other modules. """ @numerator_of_probing_factor 1 @denominator_of_probing_factor 100 @type single_run_metrics :: %{list(any()) => any()} defmodule TestOptions do @enforce_keys [ :mode,...
lib/Utils.ex
0.899273
0.768255
Utils.ex
starcoder
defmodule Bolt.Sips.BoltKitCase do @moduledoc """ tag your tests with `boltkit`, like this: @tag boltkit: %{ url: "neo4j://127.0.0.1:9001/?name=molly&age=1", scripts: [ {"test/scripts/get_routing_table_with_context.script", 9001}, {"test/scripts/return_x.bo...
test/support/boltkit_case.ex
0.6137
0.44553
boltkit_case.ex
starcoder
defmodule Tensorflow.MetaGraphDef.MetaInfoDef.FunctionAliasesEntry do @moduledoc false use Protobuf, map: true, syntax: :proto3 @type t :: %__MODULE__{ key: String.t(), value: String.t() } defstruct [:key, :value] field(:key, 1, type: :string) field(:value, 2, type: :string) en...
lib/tensorflow/core/protobuf/meta_graph.pb.ex
0.818701
0.451871
meta_graph.pb.ex
starcoder
defmodule Tesseract.Geometry.AABB3 do alias Tesseract.Math.Vec3 @type t :: {Vec3.t(), Vec3.t()} @spec make(Vec3.t(), Vec3.t()) :: t def make(a, b) do fix({a, b}) end @spec make(t) :: t def make(a) do fix(a) end @spec fix(t) :: t def fix({{a_x, a_y, a_z}, {b_x, b_y, b_z}}) do { ...
lib/geometry/aabb3.ex
0.840292
0.544317
aabb3.ex
starcoder
defmodule Zamrazac.FlokiUtil do @moduledoc """ Tools for forcing Floki to do something it really doesn't want to do--transform HTML. """ @doc """ Function to walk a floki-style dom and patch it up. Here patching means discovering referenced images, downloading them, dithering them and encoding a smaller v...
lib/floki_util.ex
0.659624
0.422028
floki_util.ex
starcoder
defmodule Plausible.Timezones do @moduledoc "https://stackoverflow.com/a/52265733" @options [ [key: "(GMT-12:00) International Date Line West", value: "Etc/GMT+12", offset: "720"], [key: "(GMT-11:00) Midway Island, Samoa", value: "Pacific/Midway", offset: "660"], [key: "(GMT-10:00) Hawaii", value: "Pac...
lib/plausible/timezones.ex
0.600305
0.713669
timezones.ex
starcoder
defmodule Scanner do defstruct coords: [], offset: [0,0,0], rotation: [1,2,3] @type coord::[integer()] @type t :: %__MODULE__{ coords: [coord()], offset: coord(), rotation: coord() } def split_n_toi(x), do: String.split(x, ",", trim: true) |> Enum.map(&String.to_integ...
lib/scanner.ex
0.851968
0.776581
scanner.ex
starcoder
defmodule Mix.Tasks.Absinthe.Gen.Type do use Mix.Task alias Mix.AbsintheGeneratorUtils @shortdoc "Generates an absinthe type" @moduledoc """ Generates an Absinthe Type ### Options #{NimbleOptions.docs(AbsintheGenerator.Type.definitions())} ### Specifying Types To specify types we can utilize the...
lib/mix/tasks/type.ex
0.627837
0.699639
type.ex
starcoder
defmodule Knigge.Options do @defaults [ delegate_at_runtime?: [only: :test], do_not_delegate: [], warn: true ] @moduledoc """ Specifies valid `Knigge`-options and allows to validate and encapsulate the options in a struct. `Knigge` differentiates between **required** and _optional_ options: ...
lib/knigge/options.ex
0.844377
0.584894
options.ex
starcoder
defmodule Enki do @moduledoc """ Enki is a simple queue that provides Mnesia persistence across nodes and `ttf` (time-to-flight) capability. Time-to-flight means that, when dequeuing a message, if the dequeue is not ack'd within a given period of time, the message is automatically added back to the queue. ...
lib/enki.ex
0.887052
0.532
enki.ex
starcoder
defmodule Knigge.Code do @moduledoc """ Internal module responsible of injecting the delegations into the calling module. Injects the actual delegations to the implementing module. For this it gets registered as a `before_compile`-hook from where it fetches all callbacks from the behaviour and generates dele...
lib/knigge/code.ex
0.593491
0.449574
code.ex
starcoder
defmodule SPARQL.Functions.Builtins do require Logger alias RDF.{IRI, BlankNode, Literal, XSD, NS} @doc """ Value equality see - <https://www.w3.org/TR/sparql11-query/#OperatorMapping> - <https://www.w3.org/TR/sparql11-query/#func-RDFterm-equal> """ def call(:=, [left, right], _) do left |> RD...
lib/sparql/functions/builtins.ex
0.849971
0.711312
builtins.ex
starcoder
defmodule Membrane.RTP.Serializer do @moduledoc """ Serializes RTP payload to RTP packets by adding the RTP header to each of them. Accepts the following metadata under `:rtp` key: `:marker`, `:csrcs`, `:extension`. See `Membrane.RTP.Header` for their meaning and specifications. """ use Membrane.Filter ...
lib/membrane/rtp/serializer.ex
0.874647
0.505737
serializer.ex
starcoder
defmodule Expression.Callbacks do @moduledoc """ The function callbacks for the standard function set available in FLOIP expressions. This should be relatively swappable with another implementation. The only requirement is the `handle/3` function. FLOIP functions are case insensitive. All functions in thi...
lib/expression/callbacks.ex
0.927215
0.854095
callbacks.ex
starcoder
defmodule Poison do alias Poison.{Encoder, EncodeError} alias Poison.{Parser, ParseError} alias Poison.{Decode, Decoder, DecodeError} @doc """ Encode a value to JSON. iex> Poison.encode([1, 2, 3]) {:ok, "[1,2,3]"} """ @spec encode(Encoder.t, keyword | Encoder.options) :: {:ok, iodata} | ...
lib/poison.ex
0.775987
0.519765
poison.ex
starcoder
defmodule CyberSourceSDK do @moduledoc """ This CyberSource module communicates with the Simple Order API service (SOAP) of CyberSource. """ use Application alias CyberSourceSDK.Client alias CyberSourceSDK.Helper def start(_type, _args) do import Supervisor.Spec, warn: false children = [ ...
lib/cybersource-sdk/cybersource_sdk.ex
0.865153
0.436802
cybersource_sdk.ex
starcoder
defmodule DateTimeParser.Parser.Serial do @moduledoc """ Parses a spreadsheet Serial timestamp. This is gated by the number of present digits. It must contain 1 through 5 digits that represent days, with an optional precision of up to 10 digits that represents time. Negative serial timestamps are supported. ...
lib/parser/serial.ex
0.881971
0.471041
serial.ex
starcoder
defmodule Meeple.Territory.One do alias Sim.Grid alias Meeple.Pawn def all() do %{ fields: fields(), group_names: group_names() |> Enum.map(fn {_n, key} -> key end), groups: %{headquarter: group(0), mountains_south: group(1)} } end def headquarter(), do: {7, 1} def pawns() do ...
apps/meeple/lib/meeple/territory/one.ex
0.515864
0.463687
one.ex
starcoder
defmodule Beamchmark.Suite.CPU.CpuTask do @moduledoc """ This module contains the CPU benchmarking task. Measurements are performed using [`:cpu_sup.util/1`](https://www.erlang.org/doc/man/cpu_sup.html) Currently (according to docs), as busy processor states we identify: - user - nice_user (low priority...
lib/beamchmark/suite/cpu/cpu_task.ex
0.831143
0.789437
cpu_task.ex
starcoder
defmodule Rediscl.Query.Pipe do @moduledoc """ Pipe query builder """ defstruct [ :set, :get, :mset, :mget, :del, :lpush, :rpush, :lrange, :lrem, :lset, :append, :exists, :setex, :setnx, :setrange, :psetex, :getrange, :getset, :strlen,...
lib/rediscl/query/pipe.ex
0.595257
0.408454
pipe.ex
starcoder
defmodule Roadtrip.Garage.Vehicle do @moduledoc """ Describes a vehicle registered in the system. Vehicles are the base unit of record-keeping in Roadtrip: they own, and give context to, a series of odometer, fuel, and maintenance measurements. """ use Roadtrip.Schema import Ecto.Changeset alias Roadt...
apps/roadtrip/lib/roadtrip/garage/vehicle.ex
0.798933
0.555556
vehicle.ex
starcoder
defmodule ChangesFollower do @moduledoc """ A behaviour module for following live changes in a CouchDB. It is basically an extended `GenServer` and also inherits all of `GenServer`'s callbacks and semantics. The main difference is the expected return value of `init/1` and the new `handle_change/2` callback....
lib/changes_follower.ex
0.858467
0.511412
changes_follower.ex
starcoder
defmodule Perpetual.Server do @moduledoc false use GenServer @timeout 0 def init(opts \\ []) do init_fun = Keyword.fetch!(opts, :init_fun) next_fun = Keyword.fetch!(opts, :next_fun) _ = initial_call(init_fun, next_fun) init_value = run(init_fun, []) state = %{ next_fun: next_fun,...
lib/perpetual/server.ex
0.631594
0.421492
server.ex
starcoder
defmodule Flex.System do @moduledoc """ An interface to create a Fuzzy Logic Control System (FLS). The Fuzzy controllers are very simple conceptually. They consist of an input stage (fuzzification), a processing stage (inference), and an output stage (defuzzification). """ use GenServer require Logger a...
lib/system.ex
0.913802
0.697171
system.ex
starcoder
defmodule Elixpath.Parser do @moduledoc """ Parses Elixpath expressions. """ import NimbleParsec @type option :: {:unsafe_atom, boolean} | {:prefer_keys, :string | :atom} defmodule ParseError do @moduledoc """ Syntax error while parsing an Elixpath string. """ defexception [:message] end...
lib/elixpath/parser.ex
0.853562
0.45538
parser.ex
starcoder
defmodule Asteroid.Utils do @doc """ Returns the current UNIX timestamp """ @spec now() :: non_neg_integer() def now(), do: System.system_time(:second) @doc """ Returns a secure random base 64 string of `size` bytes of randomness """ @spec secure_random_b64(non_neg_integer()) :: String.t() def secu...
lib/asteroid/utils.ex
0.871181
0.795817
utils.ex
starcoder
defmodule IslandsEngine.Rules do @moduledoc """ Handles which actions can be applied to a game based on its state """ defstruct state: :initialized, player1: :island_not_set, player2: :island_not_set @typedoc """ A struct that holds the state of a game """ @type t :: %__MODULE__{ state: atom(...
lib/islands_engine/rules.ex
0.889174
0.697725
rules.ex
starcoder
defmodule Cafex.Protocol.OffsetFetch do @moduledoc """ This api reads back a consumer position previously written using the OffsetCommit api. The offset fetch request support version 0, 1 and 2. To read more details, visit the [A Guide to The Kafka Protocol](https://cwiki.apache.org/confluence/display/KAFKA/A+...
lib/cafex/protocol/offset_fetch.ex
0.77552
0.550909
offset_fetch.ex
starcoder
defmodule DgraphEx.Expr.Uid do @moduledoc """ https://docs.dgraph.io/query-language/#uid Syntax Examples: q(func: uid(<uid>)) predicate @filter(uid(<uid1>, ..., <uidn>)) predicate @filter(uid(a)) for variable a q(func: uid(a,b)) for variables a and b """ alias DgraphEx.Expr.Uid alias Dgra...
lib/dgraph_ex/expr/uid.ex
0.687735
0.518668
uid.ex
starcoder
defmodule AWS.DatabaseMigration do @moduledoc """ AWS Database Migration Service AWS Database Migration Service (AWS DMS) can migrate your data to and from the most widely used commercial and open-source databases such as Oracle, PostgreSQL, Microsoft SQL Server, Amazon Redshift, MariaDB, Amazon Aurora, M...
lib/aws/generated/database_migration.ex
0.874212
0.490297
database_migration.ex
starcoder
if Code.ensure_loaded?(Plug) do defmodule Plug.Session.MNEMONIX do @moduledoc """ Stores the session in a Mnemonix store. This store does not create the Mnemonix store; it expects that a reference to an existing store server is passed in as an argument. We recommend carefully choosing the store ...
lib/plug/session/mnemonix.ex
0.841077
0.479565
mnemonix.ex
starcoder
defmodule Sim.Laboratory.Registry do alias Sim.Laboratory.{InVitro, InVitroSupervisor} # 1 hour in seconds @expires_in 60 * 60 def create(state, pub_sub) do id = generate_token() {:ok, pid} = create_entry(id, pub_sub) ref = Process.monitor(pid) entry = %{id: id, pid: pid, ref: ref, timestamp: ...
apps/sim/lib/sim/laboratory/registry.ex
0.538255
0.430686
registry.ex
starcoder
defmodule BSV.TxOut do @moduledoc """ A TxOut is a data structure representing a single output in a `t:BSV.Tx.t/0`. A TxOut consists of the number of satoshis being locked in the output, and a `t:BSV.Script.t/0`, otherwise known as the locking script. The output can later be spent by creating an input in a n...
lib/bsv/tx_out.ex
0.896925
0.797714
tx_out.ex
starcoder
defmodule Militerm.Parsers.VerbSyntax do @moduledoc """ Provides a parser to take a simple string description of a verb form and parse it into something that can be matched against player input. """ @doc """ Parses the string into a set of directives and texts ## Examples iex> VerbSyntax.parse("[<adv...
lib/militerm/parsers/verb_syntax.ex
0.87153
0.585309
verb_syntax.ex
starcoder
defmodule ExMicrosoftBot.TokenValidation do @moduledoc """ This module provides functions to validate the authorization token recived by the bot service from the Microsoft Bot Framework """ require Logger alias ExMicrosoftBot.SigningKeysManager @doc """ Helper function to validate the authentication i...
lib/token_validation.ex
0.751466
0.40928
token_validation.ex
starcoder
if Code.ensure_loaded?(Ecto.Type) do defmodule Massex.Ecto.Type do @moduledoc """ Provides a type for Ecto to store masses with their units. The underlying type should be a map, JSONB would be perfect in a PostgreSQL database. ## Migration Example create table(:foo) do add :mass, :...
lib/library_support/ecto.ex
0.837421
0.467332
ecto.ex
starcoder
defmodule FlowMonitor do @moduledoc """ Measure progress of each step in a `Flow` pipeline. """ alias FlowMonitor.{Collector, Inspector} @doc """ Runs the metrics collector on a given `Flow` pipeline. Results are store in a directory `{graph_name}-{timestamp}` in a given path. See `FlowMonitor.Config`...
lib/flow_monitor.ex
0.917958
0.66186
flow_monitor.ex
starcoder
defmodule Solarex.Sun do import Solarex.Math @moduledoc """ Solarex.Sun is module for calculating sunrise, sunset and solar noon for particular date, latitude and longitude """ @doc """ Returns sunrise for passed Date, latitude, longitude. iex> Solarex.Sun.rise(~D[2017-01-01], 50.0598054, 14.3251...
lib/solarex/sun.ex
0.918018
0.704147
sun.ex
starcoder
defmodule Identicon do @moduledoc """ Generates an identicon based on a string """ def main(input) do input |> hash_string |> pick_color |> build_grid |> filter_odd_squares |> build_pixel_map |> draw_image |> save_image(input) end @doc """ Returns an Identicon.Image s...
lib/identicon.ex
0.952397
0.437824
identicon.ex
starcoder
defmodule Chunker do @moduledoc """ Provides functions to interact with chunked files. """ alias Chunker.ChunkedFile @type t :: ChunkedFile.t() @type reason :: any @type success_tuple :: {:ok, t} @type error_tuple :: {:error, reason} @type result :: success_tuple | error_tuple @doc """ Appends ...
lib/chunker.ex
0.830078
0.713806
chunker.ex
starcoder
defmodule CodeReloader.Server do @moduledoc """ Recompiles modified files in the current mix project by invoking configured reloadable compilers. Specify the compilers that should be run for reloading when starting the server, e.g.: ``` children = [{CodeReloader.Server, [:elixir, :erlang]}] Supe...
lib/code_reloader/server.ex
0.745584
0.78838
server.ex
starcoder
defmodule Pandora do require QueueWrapper, as: Queue require Pandora.Data, as: Data require Pandora.Parse, as: Parse def create_document(declaration, doctype, nodes) do Data.document( declaration: declaration, doctype: doctype, nodes: Queue.from_list(nodes) ) end def create_eleme...
lib/pandora.ex
0.558568
0.472623
pandora.ex
starcoder
defmodule ElixirRigidPhysics.Geometry.LineSegment do alias Graphmath.Vec3 @moduledoc """ Line segment geometry module. Line segemnts go from a start point `a` to an end point `b`. """ require Record Record.defrecord(:line_segment, a: {0.0, 0.0, 0.0}, b: {0.0, 0.0, 0.0}) @type line_segment :: record(:l...
lib/geometry/line_segment.ex
0.918745
0.678686
line_segment.ex
starcoder
defmodule ExRabbitMQ.Producer do @moduledoc """ A behaviour module that abstracts away the handling of RabbitMQ connections and channels. It also provides hooks to allow the programmer to publish a message without having to directly access the AMPQ interfaces. For a connection configuration example see `ExR...
lib/ex_rabbit_m_q/producer.ex
0.881526
0.82963
producer.ex
starcoder
defmodule Grapevine.Gossip.Rumor do @moduledoc false use Grapevine.Gossip alias Grapevine.Gossip.Rumor.State alias Grapevine.Gossip.Message def handle_info( :gc, %{self: pid, updates: updates, meta: meta, gc: timeout, ttl: ttl} = state ) do gc(pid, timeout) {:noreply, Map.merg...
lib/grapevine/gossip/rumor.ex
0.606265
0.418994
rumor.ex
starcoder
defmodule Xandra.Protocol do @moduledoc false import Bitwise @valid_flag_bits for shift <- 0..7, do: 1 <<< shift @flag_mask_range 0x00..0xFF @type flag_mask() :: 0x00..0xFF @type flag_bit() :: unquote(Enum.reduce(@valid_flag_bits, &quote(do: unquote(&1) | unquote(&2)))) defp assert_not_a_var...
lib/xandra/protocol/protocol.ex
0.784319
0.449272
protocol.ex
starcoder
defmodule ElixirLS.LanguageServer.Providers.ExecuteCommand.ManipulatePipes.AST do @moduledoc """ AST manipulation helpers for the `ElixirLS.LanguageServer.Providers.ExecuteCommand.ManipulatePipes`\ command. """ @doc "Parses a string and converts the first function call, pre-order depth-first, into a pipe." ...
apps/language_server/lib/language_server/providers/execute_command/manipulate_pipes/ast.ex
0.756537
0.420748
ast.ex
starcoder
defmodule RTypes.Generator.StreamData do @moduledoc """ The module contains functions to derive generators to be used with StreamData library. """ import StreamData @behaviour RTypes.Generator @doc """ Derive a StreamData generator for the specified type AST. """ @spec derive(RTypes.Extractor.type(...
lib/rtypes/generator/stream_data.ex
0.795181
0.501404
stream_data.ex
starcoder
defmodule Process do @moduledoc """ This module provides convenience functions around processes and the process dictionary. In Erlang, most of these functions are auto-imported, but in Elixir they are grouped in a module for convenience. Notice that these functions, different from Erlang's, always return ni...
lib/elixir/lib/process.ex
0.817975
0.49823
process.ex
starcoder
defmodule CreateFunEndpoint.Digester do @digested_file_regex ~r/(-[a-fA-F\d]{32})/ @manifest_version 1 @empty_manifest %{ "version" => 1, "digests" => %{}, "latest" => %{} } defp now() do :calendar.datetime_to_gregorian_seconds(:calendar.universal_time) end @moduledoc """ The contents ...
create_fun_umbrella/apps/create_fun_endpoint/lib/create_fun_endpoint/digester.ex
0.664105
0.438605
digester.ex
starcoder
defmodule Scenic.Primitive.Style.Theme do @moduledoc """ The theme style is a way to bundle up default colors that are intended to be used by dynamic components invoked by a scene. There is a set of pre-defined themes. You can also pass in a map of theme values. Unlike other styles, these are a guide to th...
lib/scenic/primitive/style/theme.ex
0.908191
0.500916
theme.ex
starcoder
defmodule Spex.Macros do @moduledoc """ defines the following macros: - describe (xdescribe) - context (xcontext) - before - let - it (xit) it examples like: describe Calculator do let(:a), do: 1 describe "#add" do let(:b), do: 1 + 1 it "adds correctly" do ...
lib/spex/macros.ex
0.662578
0.612759
macros.ex
starcoder
defmodule AWS.ECR do @moduledoc """ Amazon Elastic Container Registry (Amazon ECR) is a managed Docker registry service. Customers can use the familiar Docker CLI to push, pull, and manage images. Amazon ECR provides a secure, scalable, and reliable registry. Amazon ECR supports private Docker repositories w...
lib/aws/ecr.ex
0.886494
0.57517
ecr.ex
starcoder
defmodule Kitt do @moduledoc """ Provides encoding and decoding functionality for UPER-encoded DSRC message payloads defined by the J2735 standard defined by the Society for Automotive Engineers. Kitt uses Erlang's native ASN1 compiler to parse the raw binary of the DSRC messages and then converts them...
lib/kitt.ex
0.91012
0.444806
kitt.ex
starcoder
defmodule RigInboundGateway.RateLimit do @moduledoc """ Allow only a certain amount of requests per seconds per endpoint (per IP). For synchronizing the corresponding state between the short-lived request processes, an ETS table is used for optimal performance. """ use Rig.Config, [:table_name, :enable...
apps/rig_inbound_gateway/lib/rig_inbound_gateway/rate_limit.ex
0.747984
0.563768
rate_limit.ex
starcoder