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 Crew.Sites do @moduledoc """ The Sites context. """ import Ecto.Query, warn: false alias Crew.Repo alias Crew.Sites.Site def site_query(), do: from(s in Site, where: is_nil(s.discarded_at)) @doc """ Returns the list of sites. ## Examples iex> list_sites() [%Site{}, ...] ...
lib/crew/sites.ex
0.766818
0.414188
sites.ex
starcoder
defmodule MapSchema.Macros.PutPartial do @moduledoc false @doc """ The PutPartial module compone the macros that let us build the `put/2` that put a new values usign a map. It´s method check the type of every property following the schema. # Example: person = Person.new() |> Person.put(%{"n...
lib/skeleton/macros/put_partial.ex
0.819352
0.564939
put_partial.ex
starcoder
defmodule BlockingQueue do @moduledoc """ BlockingQueue is a simple queue implemented as a GenServer. It has a fixed maximum length. The queue is designed to decouple but limit the latency of a producer and consumer. When pushing to a full queue the `push` operation blocks preventing the producer from ma...
lib/blocking_queue.ex
0.905385
0.479199
blocking_queue.ex
starcoder
defmodule Erl2ex.Convert.ErlExpressions do @moduledoc false alias Erl2ex.Convert.Context alias Erl2ex.Pipeline.ModuleData alias Erl2ex.Pipeline.Names @import_kernel_metadata [context: Elixir, import: Kernel] @import_bitwise_metadata [context: Elixir, import: Bitwise] @op_map %{ ==: {@import_ker...
lib/erl2ex/convert/erl_expressions.ex
0.512937
0.640313
erl_expressions.ex
starcoder
defmodule LocalHex.Repository do @moduledoc """ Module meant for maintaining a repository of multiple library packages. A `%Repository{}` struct consists of its config plus the actual list of packages and their releases. * `name` - Name of the repository as it's being stored and also accessed via the api ...
lib/local_hex/repository.ex
0.797754
0.426501
repository.ex
starcoder
defmodule EctoTestDSL.Parse.TopLevel do use EctoTestDSL.Drink.Me use T.Drink.AndParse use T.Drink.Assertively use ExContract import DeepMerge, only: [deep_merge: 2] alias T.Nouns.AsCast # ---------------------------------------------------------------------------- def field_transformations(opts) do ...
lib/10_parse/20_top_level.ex
0.677154
0.409723
20_top_level.ex
starcoder
defmodule Quadquizaminos.Contests do @moduledoc """ Inserts and gets data from the database that would be used in different functions. -list of all contests -timer -active contests """ alias Quadquizaminos.Accounts.User alias Quadquizaminos.Contest.ContestAgent alias Quadquizaminos.Contests.Contest ...
lib/quadquizaminos/contests.ex
0.784113
0.434041
contests.ex
starcoder
defmodule ManhattanV1 do @moduledoc """ The ship starts by facing east. Action N means to move north by the given value. Action S means to move south by the given value. Action E means to move east by the given value. Action W means to move west by the given value. Action L means to turn left the given nu...
12-Manhattan/lib/manhattan_v1.ex
0.818845
0.692317
manhattan_v1.ex
starcoder
defmodule ExHal.Interpreter do @moduledoc """ Helps to build interpters of HAL documents. Given a document like ```json { "name": "<NAME>", "mailingAddress": "123 Main St", "_links": { "app:department": { "href": "http://example.com/dept/42" } } } ``` We can define an interprete...
lib/exhal/interpreter.ex
0.761184
0.76145
interpreter.ex
starcoder
defmodule Utils.CoordinateTransformations do @moduledoc """ Convert from RD (Rijksdriehoek) to WGS84 coordinates See also [here](http://home.solcon.nl/pvanmanen/Download/Transformatieformules.pdf) or [here](https://media.thomasv.nl/2015/07/Transformatieformules.pdf) Examples iex> Utils.Coordina...
packages/sim/apps/messenger/lib/utils/coordinate_transformations.ex
0.897477
0.642411
coordinate_transformations.ex
starcoder
defmodule SRTM.Client do @moduledoc """ This module holds the client for querying elevation data. """ alias __MODULE__, as: Client alias SRTM.{Error, DataCell, Source} defstruct [:client, :cache_path, :data_cells, :sources] @opaque t :: %__MODULE__{ client: Tesla.Client.t(), cac...
lib/client.ex
0.868611
0.513607
client.ex
starcoder
defmodule ExDir do @moduledoc """ `ExDir` is an iterative directory listing for Elixir. Elixir function `File.ls/1` return files from directories _after_ reading them from the filesystem. When you have an humongous number of files on a single folder, `File.ls/1` will block for a certain time. In these ca...
lib/ex_dir.ex
0.795181
0.483587
ex_dir.ex
starcoder
defmodule AWS.MigrationHubConfig do @moduledoc """ The AWS Migration Hub home region APIs are available specifically for working with your Migration Hub home region. You can use these APIs to determine a home region, as well as to create and work with controls that describe the home region. * You must ...
lib/aws/generated/migration_hub_config.ex
0.838415
0.437703
migration_hub_config.ex
starcoder
require Utils defmodule D1 do @moduledoc """ --- Day 1: The Tyranny of the Rocket Equation --- Santa has become stranded at the edge of the Solar System while delivering presents to other planets! To accurately calculate his position in space, safely align his warp drive, and return to Earth in time to save Chri...
lib/days/01.ex
0.68658
0.78436
01.ex
starcoder
defmodule Ecto.Enum do @moduledoc """ A custom type that maps atoms to strings. `Ecto.Enum` must be used whenever you want to keep atom values in a field. Since atoms cannot be persisted to the database, `Ecto.Enum` converts them to a string or an integer when writing to the database and converts them back ...
lib/ecto/enum.ex
0.874352
0.64461
enum.ex
starcoder
defmodule Phoenix.HTML do @moduledoc """ Helpers for working with HTML strings and templates. When used, it imports the given modules: * `Phoenix.HTML`- functions to handle HTML safety; * `Phoenix.HTML.Tag` - functions for generating HTML tags; * `Phoenix.HTML.Form` - functions for working with fo...
deps/phoenix_html/lib/phoenix_html.ex
0.774583
0.565809
phoenix_html.ex
starcoder
defmodule Chain.Account do defstruct nonce: 0, balance: 0, storage_root: nil, code: nil, root_hash: nil @type t :: %Chain.Account{ nonce: non_neg_integer(), balance: non_neg_integer(), storage_root: MerkleTree.t(), code: binary() | nil, root_hash: nil } ...
lib/chain/account.ex
0.792906
0.703995
account.ex
starcoder
defmodule Task.Supervisor do @moduledoc """ A task supervisor. This module defines a supervisor which can be used to dynamically supervise tasks. Behind the scenes, this module is implemented as a `:simple_one_for_one` supervisor where the workers are temporary by default (that is, they are not restarted a...
lib/elixir/lib/task/supervisor.ex
0.880951
0.604165
supervisor.ex
starcoder
defmodule Queutils.BlockingQueueProducer do use GenStage require Logger @moduledoc """ A `GenStage` producer that polls a `Queutils.BlockingQueue` at a fixed interval, emitting any events on the queue. ## Usage Add it to your application supervisor's `start/2` function, after the queue it pulls from, l...
lib/queutils/blocking_queue_producer.ex
0.873147
0.428233
blocking_queue_producer.ex
starcoder
defmodule Phoenix.Controller do import Plug.Conn alias Plug.Conn.AlreadySentError require Logger require Phoenix.Endpoint @unsent [:unset, :set] @moduledoc """ Controllers are used to group common functionality in the same (pluggable) module. For example, the route: get "/users/:id", MyApp....
lib/phoenix/controller.ex
0.750553
0.572245
controller.ex
starcoder
defmodule Payjp.Subscriptions do @moduledoc """ Main API for working with Subscriptions at Payjp. Through this API you can: - create - change - retrieve - cancel - cancel_all - list all Supports Connect workflow by allowing to pass in any API key explicitely (vs using the one from env/config). (AP...
lib/payjp/subscriptions.ex
0.815085
0.657648
subscriptions.ex
starcoder
defmodule ExBanking do @type banking_error :: {:error, :wrong_arguments | :user_already_exists | :user_does_not_exist | :not_enough_money | :sender_does_not_exist | :receiver_does_not_exist | :too_many_requests_to_user ...
lib/ex_banking.ex
0.854065
0.474022
ex_banking.ex
starcoder
defmodule Matrix do defstruct m: [[]], r: 0, c: 0 @type t :: %Matrix{ m: [[float]], r: non_neg_integer, c: non_neg_integer } def from_string(s) do String.trim(s) |> String.split("\r\n") |> Enum.map(fn s -> String.split(s) |> Enum.map(&String.to_integer/1) end) |> check_rows end...
lib/matrix.ex
0.517083
0.559832
matrix.ex
starcoder
defmodule OAuth2Utils.Scope do @moduledoc """ Util functions to work with OAuth2 scopes """ @typedoc """ A single scope token as defined in [RFC6749 section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3) Example: `mail:read` """ @type scope :: String.t() @typedoc """ Scope param (i.e. non-...
lib/oauth2_utils/scope.ex
0.901942
0.838283
scope.ex
starcoder
defmodule Brook.ViewState do require Logger @delete_marker :"$delete_me" def init(instance) do :ets.new(table(instance), [:set, :protected, :named_table]) end @spec get(Brook.instance(), Brook.view_collection(), Brook.view_key()) :: {:ok, Brook.view_value()} | {:error, Brook.reason()} def g...
lib/brook/view_state.ex
0.700178
0.459258
view_state.ex
starcoder
import Kernel, except: [==: 2, !=: 2, >: 2, <: 2, <=: 2, >=: 2, <>: 2, apply: 2] import Realm.Arrow.Algebra import Realm.Apply.Algebra defmodule Realm do @moduledoc """ A set of functions to mimic the standard Haskell libraries feature a number of type classes with algebraic or category-theoretic underpinnings. ...
lib/realm.ex
0.724091
0.68635
realm.ex
starcoder
defmodule Ecto.Query.Builder.From do @moduledoc false alias Ecto.Query.Builder @doc """ Handles from expressions. The expressions may either contain an `in` expression or not. The right side is always expected to Queryable. ## Examples iex> escape(quote(do: MySchema), __ENV__) {quote(do: ...
lib/ecto/query/builder/from.ex
0.89439
0.421552
from.ex
starcoder
defmodule Ash.Sort do @moduledoc false alias Ash.Error.Query.{InvalidSortOrder, NoSuchAttribute} @doc """ A utility for parsing sorts provided from external input. Only allows sorting on public attributes and aggregates. The supported formats are: ### Sort Strings A comma separated list of fields t...
lib/ash/sort/sort.ex
0.878092
0.544378
sort.ex
starcoder
defmodule GTFSRealtimeViz do @moduledoc """ GTFSRealtimeViz is an OTP app that can be run by itself or as part of another application. You can send it protobuf VehiclePositions.pb files, in sequence, and then output them as an HTML fragment, to either open in a browser or embed in another view. Example usa...
lib/gtfs_realtime_viz.ex
0.811041
0.770011
gtfs_realtime_viz.ex
starcoder
defmodule Idicon do @moduledoc """ Idicon can be used to produce 1x1 to 10x10 user identifiable unique icons, also known as identicons. These are similar to the default icons used with github. Idicon supports identicons in svg, png, or raw_bitmap, with custom padding. The default size is 5x5, but can be as l...
lib/idicon.ex
0.890402
0.572065
idicon.ex
starcoder
defmodule Crontab.CronExpression.Parser do @moduledoc """ Parse string like `* * * * * *` to a `%Crontab.CronExpression{}`. """ alias Crontab.CronExpression @type result :: {:ok, CronExpression.t()} | {:error, binary} @specials %{ reboot: %CronExpression{reboot: true}, yearly: %CronExpression{min...
lib/crontab/cron_expression/parser.ex
0.918521
0.60013
parser.ex
starcoder
defmodule Tensorflow.ApiDef.Visibility do @moduledoc false use Protobuf, enum: true, syntax: :proto3 @type t :: integer | :DEFAULT_VISIBILITY | :VISIBLE | :SKIP | :HIDDEN field(:DEFAULT_VISIBILITY, 0) field(:VISIBLE, 1) field(:SKIP, 2) field(:HIDDEN, 3) end defmodule Tensorflow.ApiDef.Endpoint do @mo...
lib/tensorflow/core/framework/api_def.pb.ex
0.784071
0.480844
api_def.pb.ex
starcoder
defmodule Kino.Utils.Table do @moduledoc false # Common functions for handling various Elixir # terms as table records. @doc """ Computes table columns that accomodate for all the given records. """ def columns_for_records(records) do case Enum.at(records, 0) do nil -> [] first_...
lib/kino/utils/table.ex
0.719975
0.556731
table.ex
starcoder
defmodule Is.Validator do @moduledoc """ Helpers to retrieve or validate validator. """ require Logger @doc ~S""" Convert list of validators into map with their atom underscore name as key, and module name as value. ## Examples iex> to_map([]) %{} iex> to_map([Is.Validators.Binary, ...
lib/is/validator.ex
0.858585
0.411673
validator.ex
starcoder
defmodule ExWire.Packet.Capability.Eth.BlockBodies do @moduledoc """ Eth Wire Packet for getting block bodies from a peer. ``` **BlockBodies** [`+0x06`, [`transactions_0`, `uncles_0`] , ...] Reply to `GetBlockBodies`. The items in the list (following the message ID) are some of the blocks, minus the heade...
apps/ex_wire/lib/ex_wire/packet/capability/eth/block_bodies.ex
0.895243
0.757368
block_bodies.ex
starcoder
defmodule Nebulex.Adapters.Local.Generation do @moduledoc """ Generational garbage collection process. The generational garbage collector manage the heap as several sub-heaps, known as generations, based on age of the objects. An object is allocated in the youngest generation, sometimes called the nursery, a...
lib/nebulex/adapters/local/generation.ex
0.921601
0.526038
generation.ex
starcoder
defmodule EexToHeex do @moduledoc """ EexToHeex performs best effort conversion of html.eex templates to heex. The output is not guaranteed to be correct. However, conversion works correctly for a sufficiently wide range of input templates that the amount of manual conversion work can be significantly reduce...
lib/eextoheex.ex
0.845433
0.537891
eextoheex.ex
starcoder
defmodule AWS.ComprehendMedical do @moduledoc """ Comprehend Medical; extracts structured information from unstructured clinical text. Use these actions to gain insight in your documents. """ alias AWS.Client alias AWS.Request def metadata do %AWS.ServiceMetadata{ abbreviation: "Comprehend...
lib/aws/generated/comprehend_medical.ex
0.83752
0.486332
comprehend_medical.ex
starcoder
defmodule FinTex.Model.SEPACreditTransfer do @moduledoc """ The following fields are public: * `sender_account` - Bank account of the sender * `recipient_account` - Bank account of the recipient * `amount` - Order amount * `currency` - Three-character currency code (ISO 4217) ...
lib/model/sepa_credit_transfer.ex
0.838349
0.46217
sepa_credit_transfer.ex
starcoder
defmodule Mix.Tasks.Compile.Machine do use Mix.Task.Compiler @moduledoc """ Compile the project and produce report in machine readable format. ## Flags + `--format <format>` (`-f`) - output format, currently supported values are `sarif` and `code_climate`, defaults to `sarif`. + `--output <path>` ...
lib/mix/tasks/compile.machine.ex
0.799403
0.426142
compile.machine.ex
starcoder
if Code.ensure_loaded?(Finch) do # Only define this module when Finch exists as an dependency. defmodule AppStore.HTTPClient.DefaultClient do @moduledoc """ The default implementation for `AppStore.HTTPClient`. Uses `Finch` as the HTTP client. Add the `AppStore.HTTPClient.DefaultClient` to your applica...
lib/app_store/http_client/default_client.ex
0.829216
0.538134
default_client.ex
starcoder
defmodule Tesla.Middleware.BaseUrl do @moduledoc """ Set base URL for all requests. The base URL will be prepended to request path/URL only if it does not include http(s). ## Examples ``` defmodule MyClient do use Tesla plug Tesla.Middleware.BaseUrl, "https://example.com/foo" end MyClient...
lib/tesla/middleware/core.ex
0.84792
0.478773
core.ex
starcoder
defmodule LocalLedger.Transaction do @moduledoc """ This module is an interface to the LocalLedgerDB schemas and contains the logic needed to insert valid transactions and entries. """ alias LocalLedgerDB.{Errors.InsufficientFundsError, Repo, Transaction} alias LocalLedger.{ Entry, Errors.AmountNo...
apps/local_ledger/lib/local_ledger/transaction.ex
0.875448
0.481576
transaction.ex
starcoder
defmodule Rbt.Data do @moduledoc """ Provides encoding/decoding functionality for RabbitMQ messages. Supports the following content types: #### `application/octet-stream` Uses `:erlang.term_to_binary/2` and `:erlang.binary_to_term/2` in `safe` mode) #### `application/json` Uses an optional json adapt...
lib/rbt/data.ex
0.896202
0.554109
data.ex
starcoder
defmodule Day01 do @moduledoc """ Advent of Code 2018, day 1. """ @doc """ part1 reads the data and keeps a running sum of the numbers, starting from zero. ## Examples iex> Day01.part1_v1_helper("data/day01.txt") 592 """ def part1_v1_helper(file_name) do File.stream!(file_name) ...
day01/lib/day01.ex
0.770033
0.466906
day01.ex
starcoder
defmodule Stix do @moduledoc """ This library is a simple module with helpers for working with STIX 2.0 content. It supports generating IDs, creating objects, and creating bundles. Future modules may support marking data and parsing markings, versioning, and patterning. """ @doc """ Generates a STIX-compl...
lib/stix.ex
0.853226
0.514766
stix.ex
starcoder
defmodule Re.Unit do @moduledoc """ Model for real estate commom properties, each real estate can have one or more units. """ use Ecto.Schema import Ecto.Changeset @primary_key {:uuid, :binary_id, autogenerate: false} schema "units" do field :complement, :string field :price, :integer fie...
apps/re/lib/units/unit.ex
0.690142
0.446314
unit.ex
starcoder
defmodule EctoExplorer.Resolver do defmodule Step do defstruct [:key, :index] end require Logger alias EctoExplorer.Preloader @doc false def resolve(current, %Step{} = step) do with {:ok, step} <- validate_step(current, step) do _resolve(current, step) else {:error, :current_is_ni...
lib/ecto_explorer/resolver.ex
0.701611
0.635809
resolver.ex
starcoder
import :lists, only: [flatten: 1] defmodule JSEX do def encode!(term, opts \\ []) do parser_opts = :jsx_config.extract_config(opts ++ [:escaped_strings]) parser(:jsx_to_json, opts, parser_opts).(flatten(JSEX.Encoder.json(term) ++ [:end_json])) end def encode(term, opts \\ []) do { :ok, encode!(term,...
lib/jsex.ex
0.600657
0.580501
jsex.ex
starcoder
defmodule Nerves.Package.Providers.Docker do @moduledoc """ Produce an artifact for a package using Docker. The Nerves Docker artifact provider will use docker to create the artifact for the package. The output in Mix will be limited to the headlines from the process and the full build log can be found in ...
lib/nerves/package/providers/docker.ex
0.777173
0.552721
docker.ex
starcoder
defmodule EQRCode do @moduledoc """ Simple QR Code Generator written in Elixir with no other dependencies. To generate the SVG QR code: ```elixir qr_code_content = "your_qr_code_content" qr_code_content |> EQRCode.encode() |> EQRCode.svg() ``` """ alias EQRCode.{Encode, ReedSolomon, Matrix} ...
lib/eqrcode.ex
0.892823
0.85318
eqrcode.ex
starcoder
defmodule Mailchimp.Member do alias Mailchimp.Link alias HTTPoison.Response alias Mailchimp.HTTPClient @moduledoc """ Manage members of a specific Mailchimp list, including currently subscribed, unsubscribed, and bounced members. ### Struct Fields * `email_address` - Email address for a subscriber. ...
lib/mailchimp/member.ex
0.701406
0.445771
member.ex
starcoder
defmodule Crux.Structs.Template do @moduledoc """ Represents a Discord [Template Object](https://discord.com/developers/docs/resources/template#template-object). """ @moduledoc since: "0.3.0" @behaviour Crux.Structs alias Crux.Structs alias Crux.Structs.{ Snowflake, User, Util } defstr...
lib/structs/template.ex
0.848486
0.611962
template.ex
starcoder
defmodule PipelineInstrumenter do @moduledoc """ Instruments a plug pipeline using `PlugInstrumenter`. This module can be `use`-d in a module to build an instrumented plug pipeline, similar to `Plug.Builder`: defmodule MyPipeline do use PipelineInstrumenter plug Plug.Logger end ...
lib/pipeline_instrumenter.ex
0.880906
0.463809
pipeline_instrumenter.ex
starcoder
defmodule Quarry.Load do @moduledoc false require Ecto.Query alias Quarry.{Join, From, QueryStruct} @quarry_opts [:filter, :load, :sort, :limit, :offset] @spec build({Ecto.Query.t(), [Quarry.error()]}, Quarry.load()[atom()]) :: {Ecto.Query.t(), [Quarry.error()]} def build({query, errors}, load_...
lib/quarry/load.ex
0.65379
0.416797
load.ex
starcoder
defmodule Recurly.Adjustment do @moduledoc """ Module for handling adjustments in Recurly. See the [developer docs on adjustments](https://dev.recurly.com/docs/adjustment-object) for more details """ use Recurly.Resource alias Recurly.{Resource,Adjustment,Account,Invoice,Subscription} @account_endpoint...
lib/recurly/adjustment.ex
0.852981
0.786008
adjustment.ex
starcoder
defmodule PelemayFp.ParallelBinaryMerger do @moduledoc """ Receives a given consecutive list of tuples of a `Range`, count and a list, or an exit or dying message from the monitored process and merges it into a result, and send it. """ @doc """ Receives a given consecutive list of tuples of a `Range`, co...
lib/pelemay_fp/parallel_binary_merger.ex
0.687735
0.464416
parallel_binary_merger.ex
starcoder
defmodule Wabbit.Connection do use Connection import Wabbit.Record @doc """ Starts a new connection # Connection Options * `:username` - Default is `"guest"` * `:password` - Default is `"<PASSWORD>"` * `:virtual_host` - The name of the virtual host to work with. Default is `"/"` * `:host` -...
lib/wabbit/connection.ex
0.735452
0.467028
connection.ex
starcoder
defmodule TripPlan.Itinerary do @moduledoc """ A trip at a particular time. An Itinerary is a single trip, with the legs being the different types of travel. Itineraries are separate even if they use the same modes but happen at different times of day. """ alias Fares.Fare alias Routes.Route alias S...
apps/trip_plan/lib/trip_plan/itinerary.ex
0.836421
0.62621
itinerary.ex
starcoder
defmodule Publishing.Markdown do @moduledoc """ Module for handling raw markdown texts. """ @preview_length Application.compile_env!(:publishing, :markdown)[:preview_length] @heading_length Application.compile_env!(:publishing, :markdown)[:heading_length] @heading_default Application.compile_env!(:publishi...
apps/publishing/lib/publishing/markdown.ex
0.877326
0.415996
markdown.ex
starcoder
import ExType.Typespec, only: [deftypespec: 2] deftypespec Stream do @spec chunk_by(T.p(Enumerable, x), (x -> any())) :: T.p(Enumerable, [x]) when x: any() @spec chunk_every(T.p(Enumerable, x), pos_integer()) :: T.p(Enumerable, [x]) when x: any() @spec chunk_every(T.p(Enumerable, x), pos_integer(), pos_integer...
lib/ex_type/typespec/elixir/stream.ex
0.775009
0.838283
stream.ex
starcoder
defmodule RayTracer.Transformations do @moduledoc """ This module defines matrix transformations like scaling, shearing, rotating and translating """ alias RayTracer.Matrix alias RayTracer.RTuple @spec translation(number, number, number) :: Matrix.matrix def translation(x, y, z) do Matrix.ident ...
lib/transformations.ex
0.940367
0.891999
transformations.ex
starcoder
if Code.ensure_loaded?(Ecto) do defmodule Dictator.Policies.EctoSchema do @moduledoc """ Policy definition with resource loading. Requires Ecto. By default, Dictator does not fetch the resource being accessed. As an example, if the user is trying to `GET /posts/1`, no post is actually loaded, unl...
lib/dictator/policies/ecto_schema.ex
0.830903
0.709849
ecto_schema.ex
starcoder
defmodule DealerReviews.Analyzer do @moduledoc """ Contains functions to analyze the contents of a review and score different properties for sorting. """ @doc """ Average ratings when four or more are provided. """ def score_ratings(%DealerReviews.Review{ratings: ratings}) do score_ratings(ratings)...
lib/analyzer.ex
0.768993
0.647652
analyzer.ex
starcoder
defmodule Absinthe.Relay.Node.ParseIDs do @behaviour Absinthe.Middleware @moduledoc """ Parse node (global) ID arguments before they are passed to a resolver, checking the arguments against acceptable types. For each argument: - If a single node type is provided, the node ID in the argument map will ...
lib/absinthe/relay/node/parse_ids.ex
0.933952
0.878991
parse_ids.ex
starcoder
defmodule SPARQL.ExtensionFunction do @moduledoc """ A behaviour for SPARQL extension functions. ## Examples An extension function can be defined like this: defmodule ExampleFunction do use SPARQL.ExtensionFunction, name: "http://example.com/function" def call(distinct, arguments, data...
lib/sparql/extension_function/extension_function.ex
0.802013
0.604632
extension_function.ex
starcoder
defmodule Lab42.BiMap do @moduledoc """ ## Introduction BiMap, a bidrectional map. As in a traditional map we _assign_ values to keys however the keys are **also assigned** to values. The following assertion holds therefore all the time: * If a value `v` is assigned to a key `k`, the key `k` is assig...
lib/lab42/bi_map.ex
0.835047
0.831759
bi_map.ex
starcoder
defmodule Faker.Currency do import Faker, only: [sampler: 2] @moduledoc """ Functions for generating currency related data """ @doc """ Returns a random currency code ## Examples iex> Faker.Currency.code() "WST" iex> Faker.Currency.code() "SYP" iex> Faker.Currency.code() ...
lib/faker/currency.ex
0.763704
0.57532
currency.ex
starcoder
defmodule Cluster.Strategy.Rancher do @moduledoc """ This clustering strategy is specific to the Rancher container platform. It works by querying the platform's metadata API for containers belonging to the same service as the node and attempts to connect them. (see: http://rancher.com/docs/rancher/latest/en/r...
lib/strategy/rancher.ex
0.743447
0.783699
rancher.ex
starcoder
defmodule Structex.Tensor do @moduledoc """ Tensors which block of elements are identified by registered keys. iex> Structex.Tensor.new(2) ...> |> Structex.Tensor.put_key(:a, [:free , :free , :free]) ...> |> Structex.Tensor.put_key(:b, [:free , :free , :free]) ...> |> Structex.Tensor.put_ke...
lib/structex/tensor.ex
0.534127
0.599133
tensor.ex
starcoder
defmodule Membrane.SDL.Player do @moduledoc """ This module provides an [SDL](https://www.libsdl.org/)-based video player sink. """ use Bunch use Membrane.Sink alias Membrane.{Buffer, Time} alias Membrane.Caps.Video.Raw alias Unifex.CNode require Unifex.CNode # The measured latency needed to sho...
lib/membrane_sdl/player.ex
0.780955
0.414306
player.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.908881
0.830869
meta.ex
starcoder
defmodule Joken.Hooks do @moduledoc """ Behaviour for defining hooks into Joken's lifecycle. Hooks are passed to `Joken` functions or added to `Joken.Config` through the `add_hook/2` macro. They can change the execution flow of a token configuration. Hooks are executed in a reduce_while call and so must alw...
lib/joken/hooks.ex
0.838878
0.575379
hooks.ex
starcoder
defmodule RemoteIp do import RemoteIp.Debugger @behaviour Plug @moduledoc """ A plug to rewrite the `Plug.Conn`'s `remote_ip` based on forwarding headers. Generic comma-separated headers like `X-Forwarded-For`, `X-Real-Ip`, and `X-Client-Ip` are all recognized, as well as the [RFC 7239](https://tools.i...
lib/remote_ip.ex
0.895852
0.866698
remote_ip.ex
starcoder
defmodule AdventOfCode2019.SpaceStoichiometry do @moduledoc """ Day 14 — https://adventofcode.com/2019/day/14 """ @spec part1(Enumerable.t()) :: integer def part1(in_stream) do in_stream |> read_reactions() |> produce(1) end @spec part2(Enumerable.t(), integer) :: integer def part2(in_stre...
lib/advent_of_code_2019/day14.ex
0.849706
0.53443
day14.ex
starcoder
defmodule Grizzly.ZWave.Commands.SceneActuatorConfSet do @moduledoc """ This command is used to associate the specified scene ID to the defined actuator settings. Params: * `:scene_id` - a scene id (required) * `:dimming_duration` - the time it must take to reach the target level associated to the actu...
lib/grizzly/zwave/commands/scene_actuator_conf_set.ex
0.88164
0.423428
scene_actuator_conf_set.ex
starcoder
defmodule SiteEncrypt.Acme.Client do @moduledoc """ ACME related functions for endpoints managed by `SiteEncrypt`. This module exposes higher-level ACME client-side scenarios, such as new account creation, and certification. Normally these functions are invoked automatically by `SiteEncrypt` processes. The ...
lib/site_encrypt/acme/client.ex
0.862149
0.467149
client.ex
starcoder
defmodule Guardian.Token.OneTime do @moduledoc """ A one time token implementation for Guardian. This can be used like any other Guardian token, either in a header, or a query string. Once decoded once the token is removed and can no longer be used. The resource and other data may be encoded into it. ### ...
lib/guardian/token/onetime.ex
0.811153
0.774839
onetime.ex
starcoder
defmodule SmartCity.Data.Timing do @moduledoc """ Timing struct for adding timing metrics to `SmartCity.Data` messages """ @type t :: %SmartCity.Data.Timing{ app: String.t(), label: String.t(), start_time: DateTime.t(), end_time: DateTime.t() } @enforce_keys [:...
lib/smart_city/data/timing.ex
0.917635
0.647116
timing.ex
starcoder
if match?({:module, AMQP.Channel}, Code.ensure_compiled(AMQP.Channel)) do defmodule Mix.Tasks.Rambla.Rabbit.Queue do @shortdoc "Operations with queues in RabbitMQ" @moduledoc since: "0.6.0" @moduledoc """ Mix task to deal with queues in the target RabbitMQ. This is helpful to orchestrate target R...
lib/mix/tasks/rabbit_queue.ex
0.803212
0.417034
rabbit_queue.ex
starcoder
defmodule Day12 do def run_part1() do AOCHelper.read_input() |> SolutionPart1.run() end def run_part2() do AOCHelper.read_input() |> SolutionPart2.run() end def debug_sample() do [ "F10", "N3", "F7", "R90", "F11" ] |> SolutionPart2.run() end end d...
aoc-2020/day12/lib/day12.ex
0.592313
0.614423
day12.ex
starcoder
defmodule ExUnit.Runner do @moduledoc false defrecord Config, formatter: ExUnit.CLIFormatter, formatter_id: nil, max_cases: 4, taken_cases: 0, async_cases: [], sync_cases: [] def run(async, sync, opts, load_us) do config = Config[max_cases: :erlang.system_info(:schedulers_online)] co...
lib/ex_unit/lib/ex_unit/runner.ex
0.508056
0.446676
runner.ex
starcoder
defmodule Membrane.RTP.SSRCRouter do @moduledoc """ A filter separating RTP packets from different SSRCs into different outpts. When receiving a new SSRC, it creates a new pad and notifies its parent (`t:new_stream_notification_t/0`) that should link the new output pad. When an RTCP event arrives from some ...
lib/membrane/rtp/ssrc_router.ex
0.838779
0.529446
ssrc_router.ex
starcoder
defmodule SMPPEX.Protocol.MandatoryFieldsBuilder do @moduledoc false alias SMPPEX.Protocol.Pack alias SMPPEX.Protocol.MandatoryFieldsSpecs @spec build(map, MandatoryFieldsSpecs.fields_spec()) :: {:ok, iodata} | {:error, any} def build(fields, spec) when is_map(fields) do build(fields, Enum.reverse(spec...
lib/smppex/protocol/mandatory_fields_builder.ex
0.76207
0.465934
mandatory_fields_builder.ex
starcoder
defmodule MeshxRpc.Server.Worker do @moduledoc false @behaviour :gen_statem alias MeshxRpc.Common.{Telemetry, Structs.Data} alias MeshxRpc.Protocol.{Hsk, Block.Decode, Block.Encode} @impl true def callback_mode(), do: [:state_functions, :state_enter] @impl true def init([%Data{} = data, gen_statem_opt...
lib/server/worker.ex
0.550849
0.456834
worker.ex
starcoder
defmodule Pearly do @moduledoc """ > <NAME> wanted gold and silver, but not, in the way of common > thieves, for wealth. He wanted them because they shone and were pure. > Strange, afflicted, and deformed, he sought a cure in the abstract > relation of colors. > -- <cite><NAME>, *Winter's Tale*</cite> Pe...
lib/pearly.ex
0.728362
0.690102
pearly.ex
starcoder
defmodule Cldr.Map do @moduledoc """ Functions for transforming maps, keys and values. """ @doc """ Recursively traverse a map and invoke a function for each key/ value pair that transforms the map. ## Arguments * `map` is any `t:map/0` * `function` is a function or function reference that is ...
lib/cldr/utils/map.ex
0.9551
0.781205
map.ex
starcoder
defmodule Pass.ConfirmEmail do @moduledoc """ Handles email confirmations by generating, verifying, and redeeming JWTs. The idea is that you would use `Pass.ConfirmEmail.generate_token/1` to create a JWT that you could then send to the user (probably emailing them a link. When the user accesses your inter...
lib/pass/actions/confirm_email.ex
0.741861
0.507812
confirm_email.ex
starcoder
defmodule CostFunction do @moduledoc """ A module for calculating the cost of taking a new order. """ @timeBetweenFloors Application.compile_env(:elevator, :timeBetweenFloors) @waitTimeOnFloor Application.compile_env(:elevator, :waitTimeOnFloor) # Public functions # --------------------------------------...
elevator/lib/costFunction.ex
0.721547
0.465145
costFunction.ex
starcoder
defmodule Grizzly.ZWave.Commands.SwitchMultilevelReport do @moduledoc """ Module for the SWITCH_MULTILEVEL_REPORT Params: * `:value` - '`:off` or a value betweem 1 and 100 * `:duration` - How long the switch should take to reach target value, 0 -> instantly, 1..127 -> seconds, 128..253 -> minutes, 255 -...
lib/grizzly/zwave/commands/switch_multilevel_report.ex
0.872904
0.401482
switch_multilevel_report.ex
starcoder
defmodule Snitch.Data.Model.StateZone do @moduledoc """ StateZone API """ use Snitch.Data.Model use Snitch.Data.Model.Zone import Ecto.Query alias Snitch.Data.Model.Zone, as: ZoneModel alias Snitch.Data.Schema.{State, StateZoneMember, Zone} @doc """ Creates a new state `Zone` whose members are `s...
apps/snitch_core/lib/core/data/model/zone/state_zone.ex
0.859723
0.512327
state_zone.ex
starcoder
defmodule DeskClock.Faces.Basic do @moduledoc """ A simple face that doesn't try to be at all clever about drawing, doing the whole screen on every pass """ @behaviour DeskClock.Face alias ExPaint.{Color, Font} @impl DeskClock.Face def create(upper_zone, lower_zone) do %{ label_font: Font.l...
lib/desk_clock/faces/basic.ex
0.863204
0.482124
basic.ex
starcoder
defmodule BytepackWeb.Webhooks.HTTPSignature do @moduledoc """ Verifies the request body in order to ensure that its signature is valid. This verification can avoid someone to send a request on behalf of our client. So the client must send a header with the following structure: t=timestamp-in-seconds, ...
apps/bytepack_web/lib/bytepack_web/controllers/webhooks/http_signature.ex
0.881564
0.42054
http_signature.ex
starcoder
defmodule Mariaex.RowParser do @moduledoc """ Parse a row of the MySQL protocol This parser makes extensive use of binary pattern matching and recursion to take advantage of Erlang's optimizer that will not create sub binaries when called recusively. """ use Bitwise alias Mariaex.Column alias Mariaex.M...
lib/mariaex/row_parser.ex
0.599602
0.506408
row_parser.ex
starcoder
defmodule Canary.Plugs do import Canada.Can, only: [can?: 3] import Ecto.Query import Keyword, only: [has_key?: 2] @moduledoc """ Plug functions for loading and authorizing resources for the current request. The plugs all store data in conn.assigns (in Phoenix applications, keys in conn.assigns can be acc...
lib/canary/plugs.ex
0.854672
0.846768
plugs.ex
starcoder
defmodule AOC.Day12 do defmodule Ferry do defstruct x: 0, y: 0, facing: "E", waypoint_x: 10, waypoint_y: 1 @directions ["E", "S", "W", "N"] def forward_waypoint(%Ferry{x: x, y: y, waypoint_x: x_wp, waypoint_y: y_wp} = ferry, distance), do: %{ferry | x: x + x_wp * distance, y: y + y_wp * distance} def rotate...
lib/2020/day12.ex
0.622345
0.734405
day12.ex
starcoder
defmodule Cldr.Message.Print do @moduledoc false @doc """ Takes a message AST and converts it back into a string. There are two purposes for this: 1. To define a canonical string form of a message that can be used as a translation key 2. To pretty print it for use in translation workbenches ## Argumen...
lib/cldr/messages/format/printer.ex
0.792665
0.546375
printer.ex
starcoder
defmodule EtsHelper do @moduledoc """ `EtsHelper` is a wrapper of [ETS](http://erlang.org/doc/man/ets.html). It does not try to wrap all the functionality, only those functions that are constantly used in Elixir projects. It also includes some new functions. This is a library that could be improved in the future i...
lib/ets_helper.ex
0.844858
0.923799
ets_helper.ex
starcoder
defmodule Ash.Filter.Predicate do @moduledoc """ Represents a predicate which can be simplified and/or compared with other predicates Simplification and comparison will need more documentation, but ultimately it is the logic that allows us to have a flexible and powerful authorization system. """ @type ...
lib/ash/filter/predicate.ex
0.903898
0.604136
predicate.ex
starcoder
defmodule Delugex.Stream.Name do @behaviour Delugex.StreamName.Decoder alias __MODULE__ @moduledoc """ Stream.Name is a module to manage the location where events are written. Stream names could be intended as URLs for where events are located. The struct provides an easy way to access the data that oth...
lib/delugex/stream/name.ex
0.82176
0.507629
name.ex
starcoder