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 Phoenix.NotAcceptableError do
@moduledoc """
Raised when one of the `accept*` headers is not accepted by the server.
This exception is commonly raised by `Phoenix.Controller.accepts/2`
which negotiates the media types the server is able to serve with
the contents the client is able to render.
If... | lib/phoenix/exceptions.ex | 0.764892 | 0.52543 | exceptions.ex | starcoder |
defmodule Clickhousex.Codec.Values do
alias Clickhousex.Query
def encode(%Query{param_count: 0, type: :insert}, _, []) do
# An insert query's arguments go into the post body and the query part goes into the query string.
# If we don't have any arguments, we don't have to encode anything, but we don't want ... | lib/clickhousex/codec/values.ex | 0.660282 | 0.535888 | values.ex | starcoder |
defmodule Bonny.Controller do
@moduledoc """
`Bonny.Controller` defines controller behaviours and generates boilerplate for generating Kubernetes manifests.
> A custom controller is a controller that users can deploy and update on a running cluster, independently of the cluster’s own lifecycle. Custom controller... | lib/bonny/controller.ex | 0.893031 | 0.430866 | controller.ex | starcoder |
defmodule Formex.Form do
alias __MODULE__
alias Formex.Field
alias Formex.Button
alias Formex.FormNested
alias Formex.FormCollection
@doc """
Defines the Formex.Form struct.
* `:type` - the module that implements `Formex.Type`, for example: `App.ArticleType`
* `:struct` - the struct of your data... | lib/formex/form.ex | 0.857351 | 0.44903 | form.ex | starcoder |
defmodule Regex do
@moduledoc %B"""
Regular expressions for Elixir built on top of the re module
in the Erlang Standard Library. More information can be found
on re documentation: http://www.erlang.org/doc/man/re.html
Regular expressions in Elixir can be created using Regex.compile!
or using the special fo... | lib/elixir/lib/regex.ex | 0.919172 | 0.633736 | regex.ex | starcoder |
defmodule GenGossip.ClusterState do
alias GenGossip.VectorClock
@opaque t :: %__MODULE__{
owner: term,
metadata: metadata,
mod: atom,
members: [{term, Member.t}],
vector_clock: VectorClock.t
}
@type metadata :: Keyword.t
defmodule Member do
@moduledoc false
@opaque t ::... | lib/gen_gossip/cluster_state.ex | 0.681303 | 0.516413 | cluster_state.ex | starcoder |
defmodule ExfileB2.LocalCache do
@moduledoc """
The manager for ExfileB2's local cache of files.
"""
use GenServer
# In ms, 30 seconds.
@vacuum_interval 30_000
def start_link do
GenServer.start_link(__MODULE__, :ok, name: __MODULE__)
end
def fetch(key),
do: GenServer.call(__MODULE__, {:fet... | lib/exfile_b2/local_cache.ex | 0.593374 | 0.434221 | local_cache.ex | starcoder |
defmodule RayTracer.Pattern do
@moduledoc """
This is a common module for all kinds of patterns
"""
alias RayTracer.Color
alias RayTracer.Shape
alias RayTracer.Matrix
alias RayTracer.RTuple
@type t :: RayTracer.StripePattern.t |
RayTracer.RingPattern.t |
RayTracer.CheckerPatte... | lib/pattern.ex | 0.913749 | 0.614408 | pattern.ex | starcoder |
defmodule Strava.Athlete.Stats do
@moduledoc """
Returns recent (last 4 weeks), year to date and all time stats for a given
athlete. Only available for the authenticated athlete. This is the
recommended endpoint when polling for athlete upload events.
More info: http://strava.github.io/api/v3/athlete/#stats
... | lib/strava/athlete/stats.ex | 0.729038 | 0.522019 | stats.ex | starcoder |
defmodule Alchemy.Embed do
@moduledoc """
A module containing structs and functions relative to Embeds.
Embeds allow you to format messages in a structured, and quite pretty way; much more
than can be done with simple text.
For a basic idea of how embeds work, check this
[link](https://cdn.discordapp.com/a... | lib/Structs/Messages/Embed/embed.ex | 0.921172 | 0.830937 | embed.ex | starcoder |
defmodule CoursePlanner.Classes.Class do
@moduledoc """
This module holds the model for the class table
"""
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias CoursePlanner.{Repo, Courses.OfferedCourse, Attendances.Attendance, Classes}
alias Ecto.{Time, Date, Changeset}
schema "classes" d... | lib/course_planner/classes/class.ex | 0.766206 | 0.469763 | class.ex | starcoder |
defmodule Codex.OAuth do
@moduledoc """
Handles OAuth related functionality for interaction with Goodreads API ONLY.
You should not use this OAuth client to interact with other APIs, for it doesn't do endpoint
discovery or anything like that. It's specifically written for Goodreads' API.
"""
alias Codex.{... | lib/codex/oauth.ex | 0.884772 | 0.58059 | oauth.ex | starcoder |
defmodule HTS221.CTRLReg2 do
@moduledoc """
Control the memory boot, heater element, and one shot initialization for the
HTS221
"""
import Bitwise
@reboot_memory 0x80
@heater_enabled 0x02
@one_shot_get_new_data_set 0x01
@type boot_mode() :: :normal | :reboot_memory
@type heater_mode() :: :disabl... | lib/hts221/ctrl_reg2.ex | 0.763484 | 0.413388 | ctrl_reg2.ex | starcoder |
defmodule TelemetryMetricsCloudwatch do
@moduledoc """
This is a [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/) Reporter for
[`Telemetry.Metrics`](https://github.com/beam-telemetry/telemetry_metrics) definitions.
Provide a list of metric definitions to the `init/2` function. It's recommended to
run... | lib/telemetry_metrics_cloudwatch.ex | 0.938018 | 0.641394 | telemetry_metrics_cloudwatch.ex | starcoder |
defmodule Sanbase.Clickhouse.HistoricalBalance.Utils do
@moduledoc ~s"""
Helper functions used when working with the historical balances
"""
@type in_type :: %{
sign: non_neg_integer(),
balance: float(),
datetime: DateTime.t()
}
@type out_type :: %{
balance: f... | lib/sanbase/clickhouse/historical_balance/utils.ex | 0.844938 | 0.562207 | utils.ex | starcoder |
defmodule Neoprice.Cache do
@moduledoc "macro to define a buffer"
use GenServer
alias Neoprice.Cryptocompare
require Logger
@minute 60
@hour 3600
@day 86_400
defmodule Config do
@moduledoc false
defstruct [:cache_name, :definition, :aggregation, :duration]
end
defmacro __using__(opts \\ ... | apps/neoprice/lib/neoprice/cache.ex | 0.550607 | 0.490663 | cache.ex | starcoder |
defmodule Contentful.Query do
require Logger
@moduledoc """
This module provides the chainable query syntax for building queries against the
APIs of Contentful.
The chains will then be serialized to a URL and send to the API. A basic query looks like this:
```
Entity
|> skip(3)
|> limit(2)
|> fet... | lib/contentful/query.ex | 0.904354 | 0.873539 | query.ex | starcoder |
defmodule Datix.DateTime do
@moduledoc """
A `DateTime` parser using `Calendar.strftime` format-string.
"""
@doc """
Parses a datetime string according to the given `format`.
See the `Calendar.strftime` documentation for how to specify a format-string.
The `:ok` tuple contains always an UTC datetime an... | lib/datix/date_time.ex | 0.936008 | 0.928539 | date_time.ex | starcoder |
defmodule ExUnitFixtures.FixtureModule do
@moduledoc """
Sets up a module as an importable module of fixtures.
This module can be used in any module that defines common fixtures to be
shared amongst many tests.
By using `ExUnitFixtures.FixtureModule` a module will become a fixture module.
A fixture module... | lib/ex_unit_fixtures/fixture_module.ex | 0.888976 | 0.616662 | fixture_module.ex | starcoder |
defmodule HAP.Accessory do
@moduledoc """
Represents a single accessory object, containing a number of services
"""
defstruct name: "Generic HAP Accessory",
model: "Generic HAP Model",
manufacturer: "Generic HAP Manufacturer",
serial_number: "Generic Serial Number",
... | lib/hap/accessory.ex | 0.856737 | 0.466299 | accessory.ex | starcoder |
defmodule Day06 do
def part1(input) do
parse(input)
|> Day06Part1.solve
end
def part2(input) do
parse(input)
|> Day06Part2.solve
end
defp parse(input) do
InstructionParser.parse(input)
end
end
defmodule Day06Part1 do
use Bitwise
def solve(input) do
input
|> Enum.reduce(ma... | day06/lib/day06.ex | 0.572006 | 0.719655 | day06.ex | starcoder |
defmodule Mix.Releases.Profile do
@moduledoc """
Represents the configuration profile for a specific environment and release.
More generally, a release has a profile, as does an environment, and
when determining the configuration for a release in a given environment, the
environment profile overrides the rele... | deps/distillery/lib/mix/lib/releases/models/profile.ex | 0.588771 | 0.405272 | profile.ex | starcoder |
defmodule LibPE.Section do
@moduledoc false
alias LibPE.Section
defstruct [
:name,
:padding,
:virtual_data,
:virtual_size,
:virtual_address,
:raw_data,
:size_of_raw_data,
:pointer_to_raw_data,
:pointer_to_relocations,
:pointer_to_linenumbers,
:number_of_relocations,
... | lib/libpe/section.ex | 0.544559 | 0.465691 | section.ex | starcoder |
defmodule Microsoft.Azure.TemplateLanguageExpressions.JSONParser do
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import NimbleParsec
defmodule JSONDocument do
@derive {Inspect, only: [:value]}
defstruct value: nil, space_before: nil, space_after: nil
use Accessible
#... | lib/json_parser.ex | 0.580709 | 0.454412 | json_parser.ex | starcoder |
defmodule ESpec.SuiteRunner do
@moduledoc """
Defines functions for running specs in modules.
"""
alias ESpec.Configuration
alias ESpec.Example
alias ESpec.ExampleRunner
@doc """
Runs `before_all` hook, examples and then `after_all` hook.
"""
def run(module, opts, shuffle \\ true) do
run_befor... | lib/espec/suite_runner.ex | 0.613815 | 0.505066 | suite_runner.ex | starcoder |
defmodule NxMath do
import Nx.Defn
@moduledoc """
Documentation for `NxMath`.
"""
@log2 Nx.log(2)
defnp factorial(x) do
{factorial, _} =
while {factorial = 1, x}, Nx.greater(x, 1) do
{factorial * x, x - 1}
end
factorial
end
defnp broadcast(s, t, {type, bit}) do
Nx.br... | lib/nx_math.ex | 0.844714 | 0.617022 | nx_math.ex | starcoder |
defmodule Membrane.Element.Action do
@moduledoc """
This module contains type specifications of actions that can be returned
from element callbacks.
Returning actions is a way of element interaction with
other elements and parts of framework. Each action may be returned by any
callback (except for `c:Membr... | lib/membrane/element/action.ex | 0.933142 | 0.609146 | action.ex | starcoder |
defmodule MmoGame.Grid do
@moduledoc """
Grid related functions.
"""
@type t :: %__MODULE__{
rows: pos_integer(),
columns: pos_integer(),
walls: %{optional(coordinate()) => boolean()}
}
@type row :: non_neg_integer()
@type col :: non_neg_integer()
@type coordinate :... | lib/mmo_game/grid.ex | 0.920799 | 0.651424 | grid.ex | starcoder |
defmodule Artemis.Helpers.DateTime do
@doc """
Sort an enumerable by Date
Calling `sort` on Date structs will return unexpected results, since:
> In Elixir structs are compared by their contents, in alphabetical order of the fields.
> In this case the most significant would be the `day`, then `month` and `y... | apps/artemis/lib/artemis/helpers/date_time.ex | 0.87142 | 0.502136 | date_time.ex | starcoder |
defmodule AdventOfCode2019.OxygenSystem do
@moduledoc """
Day 15 — https://adventofcode.com/2019/day/15
"""
require AdventOfCode2019.IntcodeComputer
@spec part1(Enumerable.t()) :: integer
def part1(in_stream) do
in_stream
|> load_program()
|> locate()
|> List.first()
end
@spec part2(E... | lib/advent_of_code_2019/day15.ex | 0.797517 | 0.579371 | day15.ex | starcoder |
defmodule SnapFramework.Component do
alias Scenic.Graph
alias Scenic.Primitive
require SnapFramework.Macros
require Logger
@moduledoc """
## Overview
SnapFramework.Component is nearly identical to a Scene. The main different is the addition of the defcomponent macro,
as well as the addition of the sce... | lib/component.ex | 0.88323 | 0.836888 | component.ex | starcoder |
defmodule TwoFactorInACan.Totp do
@moduledoc """
Provides functions for working with time based one time password (TOTP) style
two factor authentication (2FA) as defined in RFC 4226.
## Summary
For details on RFC 4226, see https://tools.ietf.org/rfc/rfc4226.txt.
TOTP two factor authentication uses the HM... | lib/totp/totp.ex | 0.90171 | 0.932207 | totp.ex | starcoder |
defmodule ServerTimingPlug do
@moduledoc """
ServerTimingPlug is a Plug that can be used to generate an HTTP Server-Timing
header so that your browser can display timing metrics for a given request.
For more details on Server-Timing see the MDN documentation
https://developer.mozilla.org/en-US/docs/Web/HTTP/H... | lib/server_timing_plug.ex | 0.918818 | 0.809088 | server_timing_plug.ex | starcoder |
defmodule Faker.Company.En do
import Faker, only: [sampler: 2]
alias Faker.Person.En, as: Person
@moduledoc """
Functions for company data in English
"""
@doc """
Returns a random complete English business related bullshit
## Examples
iex> Faker.Company.En.bs()
"syndicate e-business e-b... | lib/faker/company/en.ex | 0.643889 | 0.436562 | en.ex | starcoder |
defmodule Mnemonix.Application do
@moduledoc """
Automatically starts stores when your application starts.
Mnemonix can manage your stores for you. To do so, it looks in your config files for named stores:
config :mnemonix, stores: [:foo, :bar]
For all stores so listed, it will check for store-specific... | lib/mnemonix/application.ex | 0.839076 | 0.422922 | application.ex | starcoder |
defmodule OcppModel.V20.FieldTypes do
@moduledoc """
Field types or subclasses of the OCPP Model
"""
defmodule AdditionalInfoType do
@moduledoc false
use TypedStruct
typedstruct do
field :additionalIdToken, String.t(), enforce: true # 0..36 identifierString
field :type, Str... | lib/ocpp_model/v20/fieldtypes.ex | 0.655667 | 0.427905 | fieldtypes.ex | starcoder |
defmodule Ecto.Adapters.Pool do
@moduledoc """
Behaviour for using a pool of connections.
"""
use Behaviour
@typedoc """
A pool process
"""
@type t :: atom | pid
@typedoc """
Opaque connection reference.
Use inside `run/4` and `transaction/4` to retrieve the connection module and
pid or brea... | lib/ecto/adapters/pool.ex | 0.933869 | 0.67336 | pool.ex | starcoder |
defmodule Coxir.Struct.Webhook do
@moduledoc """
Defines methods used to interact with channel webhooks.
Refer to [this](https://discord.com/developers/docs/resources/webhook#webhook-object)
for a list of fields and a broader documentation.
"""
use Coxir.Struct
@doc false
def select(pattern)
@doc ... | lib/coxir/struct/webhook.ex | 0.881812 | 0.405949 | webhook.ex | starcoder |
defmodule ScosSystemTest.Performance do
@moduledoc """
ScosSystemTest.Performance will eventually be an actual
system test, but for now all it does is generate
and upload a specified number of datasets.
"""
require Logger
alias ScosSystemTest.Helpers
alias ScosSystemTest.Stats
@default_andi_url Applic... | lib/performance.ex | 0.566378 | 0.435421 | performance.ex | starcoder |
defmodule Forth do
defstruct stack: [],
words: [],
definition: %{}
@opaque operation :: (evaluator() -> evaluator())
@opaque word :: %{name: String.t(), code: [operation()]}
@opaque evaluator :: %__MODULE__{stack: [integer()], words: [word()], definition: map()}
defmodule StackUnderf... | exercism/elixir/forth/lib/forth.ex | 0.81283 | 0.607721 | forth.ex | starcoder |
defmodule Coxir.Gateway do
@moduledoc """
Supervises the components necessary to interact with Discord's gateway.
### Using the module
The module can be used with `Kernel.use/2` to transform the calling module into a gateway.
Check out the `__using__/1` macro to see what this does exactly.
"""
import S... | lib/coxir/gateway.ex | 0.89865 | 0.499268 | gateway.ex | starcoder |
defmodule Genex.Support.Genealogy do
alias Graph.Serializers.DOT
@moduledoc """
Implementation of a genealogy tree.
We use the Genealogy tree to model the history of the population from it's initialization to the end of the algorithm. The tree itself is a directed `Graph` implemented using [libgraph](ttps://w... | lib/genex/support/genealogy.ex | 0.870982 | 0.922132 | genealogy.ex | starcoder |
defmodule Struct.Elements.InsertedWoodenSidingWall do
use Ecto.Schema
import Ecto.Changeset
schema "inserted_wooden_siding_walls" do
field :beam_height, :float
field :beam_width, :float
field :column_depth, :float
field :column_width, :float
field :fiber_direction_compressive_strength_of_sidi... | lib/struct/elements/inserted_wooden_siding_wall.ex | 0.543348 | 0.523238 | inserted_wooden_siding_wall.ex | starcoder |
defmodule Arc.Ecto.Type do
@moduledoc false
require Logger
def type, do: :string
@filename_with_timestamp ~r{^(.*)\?(\d+)$}
def cast(definition, %{file_name: file, updated_at: updated_at}) do
cast(definition, %{"file_name" => file, "updated_at" => updated_at})
end
def cast(_definition, %{"file_nam... | lib/arc_ecto/type.ex | 0.581422 | 0.464355 | type.ex | starcoder |
defmodule Aoc2020Day24 do
import Enum
@black 1
@white 0
@doc """
Each point can be identified by treat e/w as +-2, ne/nw/se/sw as +-1
nwwswee -> flips the reference tile itself {0, 0}
"""
def coordinate(path) do
path
|> reduce({0, 0}, fn i, {x, y} ->
case i do
"nw" -> {x - 1, y - ... | lib/2020/aoc2020_day24.ex | 0.71123 | 0.670129 | aoc2020_day24.ex | starcoder |
defmodule NebulexMemcachedAdapter do
@moduledoc """
Nebulex adapter for Memcached..
This adapter is implemented by means of `Memcachex`, a Memcached driver for
Elixir.
This adapter supports multiple connection pools against different memcached
nodes in a cluster. This feature enables resiliency, be able t... | lib/nebulex_memcached_adapter.ex | 0.912216 | 0.539165 | nebulex_memcached_adapter.ex | starcoder |
defmodule Content.Audio.FollowingTrain do
@moduledoc """
The following train to [destination] arrives in [n] minutes.
"""
@enforce_keys [:destination, :route_id, :verb, :minutes]
defstruct @enforce_keys
@type verb :: :arrives | :departs
@type t :: %__MODULE__{
destination: PaEss.destination()... | lib/content/audio/following_train.ex | 0.76921 | 0.4474 | following_train.ex | starcoder |
defmodule ExTorch.Native.Tensor.Creation do
@moduledoc false
use ExTorch.Native.BindingDeclaration
@doc_section :creation
defbindings(:tensor_creation) do
@doc """
Returns a tensor filled with uninitialized data. The shape of the tensor is
defined by the tuple argument `size`.
## Arguments
... | lib/extorch/native/tensor/creation.ex | 0.958372 | 0.825976 | creation.ex | starcoder |
defmodule LogicalFile do
alias LogicalFile.{Macro, Section}
@moduledoc """
## LogicalFile
### One file from many
LogicalFile is a way of creating a logical representation of a unit of lines
of text (e.g. a source code file) supplied by one or more backing files,
presumably separate files on disk. It al... | lib/logical_file.ex | 0.797636 | 0.516961 | logical_file.ex | starcoder |
defmodule Day11 do
@moduledoc """
Documentation for `Day11`.
"""
def run() do
process("""
7612648217
7617237672
2853871836
7214367135
1533365614
6258172862
5377675583
5613268278
8381134465
3445428733
""", 100)
end
def example(), do: (example1(); example2();)... | apps/day11/lib/day11.ex | 0.683631 | 0.412146 | day11.ex | starcoder |
defmodule FilePreviews do
@type status :: :ok | :error
@type response :: {status, map}
defmodule Config do
@type t :: %Config{api_key: binary, api_secret: binary}
defstruct [:api_key, :api_secret]
end
@moduledoc """
Provides an interface to the [FilePreviews][filepreviews] API.
For the API's do... | lib/filepreviews.ex | 0.841972 | 0.686206 | filepreviews.ex | starcoder |
defmodule Ockam.Channel do
@moduledoc """
An implementation of secure channels via the Noise protocol
See an overview of the Noise handshake [here](https://noiseprotocol.org/noise.html#overview-of-handshake-state-machine)
"""
require Logger
alias Ockam.Transport
alias Ockam.Channel.Handshake
alias Ock... | implementations/elixir/lib/channel.ex | 0.955561 | 0.439447 | channel.ex | starcoder |
defmodule StatetraceElixir.Annotations do
@moduledoc """
Schema for annotating database transactions for Statetrace.
Statetrace treats values written to statetrace_annotations in a special way,
allowing you to annotate the row-level transaction information. This should not be used
directly, instead you shoul... | lib/statetrace_elixir/annotations.ex | 0.858719 | 0.58883 | annotations.ex | starcoder |
defmodule Sneex.Ops.MoveBits do
@moduledoc "
This represents the op codes for moving the bits of a value
This can either be a shift (where 0's fill in the bit, and the
moved bit goes to the carry flag) or a rotation (where the
carry flag is filled in and the moved bit goes to the carry flag).
"
defstruct ... | lib/sneex/ops/move_bits.ex | 0.799521 | 0.642439 | move_bits.ex | starcoder |
defmodule Saucexages.DataTypeInfo do
@moduledoc false
@enforce_keys [:data_type_id, :data_type, :name]
@type t :: %__MODULE__{
data_type_id: atom(),
data_type: non_neg_integer(),
name: String.t()
}
defstruct [:data_type_id, :data_type, :name]
end
def... | lib/saucexages/data_type.ex | 0.856032 | 0.691862 | data_type.ex | starcoder |
defmodule Exhort.SAT.SolverResponse do
@moduledoc """
A response from solving a model.
Provides functions for retrieving variable values from the response. The set
of valid variables are those defined in the model that was solved.
"""
@type t :: %__MODULE__{}
defstruct [:res, :model, :status, :int_statu... | lib/exhort/sat/solver_response.ex | 0.792986 | 0.401541 | solver_response.ex | starcoder |
defmodule Credo.Code.Scope do
@moduledoc """
This module provides helper functions to determine the scope name at a certain
point in the analysed code.
"""
@def_ops [:def, :defp, :defmacro]
@doc """
Returns the module part of a scope.
iex> Credo.Code.Scope.mod_name("Credo.Code")
"Credo.Code... | lib/credo/code/scope.ex | 0.737064 | 0.445771 | scope.ex | starcoder |
defmodule Swarm.Distribution.StaticQuorumRing do
@moduledoc """
A quorum is the minimum number of nodes that a distributed cluster has to obtain in order to be
allowed to perform an operation. This can be used to enforce consistent operation in a distributed system.
## Quorum size
You must configure the dis... | lib/swarm/distribution/static_quorum_ring.ex | 0.903083 | 0.706773 | static_quorum_ring.ex | starcoder |
defmodule Solid.Filter do
@moduledoc """
Standard filters
"""
import Kernel, except: [abs: 1, ceil: 1, round: 1, floor: 1, apply: 2]
@doc """
Apply `filter` if it exists. Otherwise return the first input.
iex> Solid.Filter.apply("upcase", ["ac"])
"AC"
iex> Solid.Filter.apply("no_filter_here", [1, 2... | lib/solid/filter.ex | 0.888036 | 0.592107 | filter.ex | starcoder |
defmodule Every do
@moduledoc """
Every gives you ability to use `Process.send_after/3` with
intervals which can be rounded to every:
1. Minute,
2. N minutes,
3. Hour,
4. N Hours,
5. Day.
Every function accepts an optional `relative_to` parameter, which can be used
to fake the current mo... | lib/every.ex | 0.905589 | 0.644442 | every.ex | starcoder |
defmodule AWS.S3Control do
@moduledoc """
AWS S3 Control provides access to Amazon S3 control plane operations.
"""
@doc """
Creates an access point and associates it with the specified bucket.
For more information, see [Managing Data Access with Amazon S3 Access Points](https://docs.aws.amazon.com/Amazo... | lib/aws/generated/s3_control.ex | 0.88865 | 0.462473 | s3_control.ex | starcoder |
defmodule AWS.ServiceDiscovery do
@moduledoc """
AWS Cloud Map lets you configure public DNS, private DNS, or HTTP namespaces
that your microservice applications run in.
When an instance of the service becomes available, you can call the AWS Cloud
Map API to register the instance with AWS Cloud Map. For pub... | lib/aws/generated/service_discovery.ex | 0.925382 | 0.466785 | service_discovery.ex | starcoder |
defmodule Verk.SortedSet do
@moduledoc """
This module interacts with the jobs on a sorted set
"""
import Verk.Dsl
alias Verk.Job
@requeue_now_script Verk.Scripts.sha("requeue_job_now")
@doc """
Counts how many jobs are inside the sorted set
"""
@spec count(String.t, GenServer.server) :: {:ok, int... | lib/verk/sorted_set.ex | 0.839471 | 0.476275 | sorted_set.ex | starcoder |
defmodule Chess.Square do
@moduledoc """
Square module
"""
@x_lines ["a", "b", "c", "d", "e", "f", "g", "h"]
@y_lines [1, 2, 7, 8]
alias Chess.{Figure, Position}
@doc """
Creates 32 figures for new game and puts them to specific squares
## Examples
iex> Chess.Square.prepare_for_new_game()
... | lib/chess/square.ex | 0.830903 | 0.528047 | square.ex | starcoder |
defmodule ResxBase.Decoder do
@moduledoc """
Decode data resources from a RFC 4648 encoding.
### Decoding
The type of decoding is specified by using the `:encoding` option.
Resx.Resource.transform(resource, ResxBase.Decoder, encoding: :base64)
The list of available decoding forma... | lib/resx_base/decoder.ex | 0.935391 | 0.557062 | decoder.ex | starcoder |
defmodule TableRex.Renderer.Text do
@moduledoc """
Renderer module which handles outputting ASCII-style tables for display.
"""
alias TableRex.Cell
alias TableRex.Table
alias TableRex.Renderer.Text.Meta
@behaviour TableRex.Renderer
# horizontal_styles: [:all, :header, :frame:, :off]
# vertical_style... | lib/table_rex/renderer/text.ex | 0.825765 | 0.516291 | text.ex | starcoder |
defmodule Crontab.CronExpression do
@moduledoc """
The `Crontab.CronExpression` module / struct.
"""
alias Crontab.CronExpression.Parser
@type t :: %Crontab.CronExpression{
extended: boolean,
reboot: boolean,
second: [value(second)],
minute: [value(minute)],
... | lib/crontab/cron_expression.ex | 0.914601 | 0.615203 | cron_expression.ex | starcoder |
require Record
defmodule JOSE.JWE do
@moduledoc ~S"""
JWE stands for JSON Web Encryption which is defined in [RFC 7516](https://tools.ietf.org/html/rfc7516).
## Key Derivation Algorithms
The following key derivation algorithms for the `"alg"` field are currently supported by `JOSE.JWE` (some may need the `JO... | backend/deps/jose/lib/jose/jwe.ex | 0.836321 | 0.548553 | jwe.ex | starcoder |
defmodule ForgeAbi.BigUint do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
value: binary
}
defstruct [:value]
field :value, 1, type: :bytes
end
defmodule ForgeAbi.BigSint do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
v... | lib/protobuf/gen/type.pb.ex | 0.771456 | 0.59305 | type.pb.ex | starcoder |
defmodule Benchmark do
alias :timer, as: Timer
@doc "Macro for logging benchmarks of function calls."
defmacro bench(label \\ "", do: block) do
quote do
IO.write(unquote(label) <> ": ")
{time, val} = Timer.tc(fn -> unquote(block) end)
IO.write("Returned value #{val} in #{time/1000} millisec... | elixir_libs/elixir_example/lib/complex_math.ex | 0.70304 | 0.40439 | complex_math.ex | starcoder |
defmodule Mirage.Image do
@moduledoc """
Module for reading, writing, and creating images.
"""
alias Mirage.Color
@typedoc """
Represents a loaded image in working memory.
"""
@type t :: %__MODULE__{
byte_size: non_neg_integer(),
height: non_neg_integer(),
width: non_neg_... | lib/mirage/image.ex | 0.939789 | 0.896704 | image.ex | starcoder |
defmodule Tzdata do
alias Tzdata.BasicData, as: TzData
alias Tzdata.Periods
alias Tzdata.ReleaseParser, as: TzReleaseParser
alias Tzdata.LeapSecParser
@moduledoc """
The Tzdata module provides data from the IANA tz database. Also known
as the Olson/Eggert database, zoneinfo, tzdata and other names.
Th... | elixir/codes-from-books/little-elixir/cap8/blitzy/deps/tzdata/lib/tzdata.ex | 0.875228 | 0.537041 | tzdata.ex | starcoder |
defmodule Breadboard.GPIO.BaseGPIOHelper do
@moduledoc """
Define an 'helper' behaviour to define a complete map of GPIOs pinout for a specific platform from a small set of informations.
Implementing the defined callback the result is obtained from `build_pinout_map/0` funcion, starting for example from:
```
... | lib/breadboard/gpio/base_gpio_helper.ex | 0.73659 | 0.925432 | base_gpio_helper.ex | starcoder |
defmodule Macchiato.Token do
def split(s) do
split(s, [], "")
end
def split(s, tokens, acc) do
{head, tail} = String.split_at(s, 1)
case {head, acc} do
{"(", ""} -> split(tail, ["(" | tokens], "")
{"(", some} -> split(tail, ["(" | [some | tokens]], "")
{")", ""} -> split(tail, [")"... | lib/token.ex | 0.504394 | 0.578002 | token.ex | starcoder |
defmodule Etherscan.API.Proxy do
@moduledoc """
Module to wrap Etherscan Geth/Parity proxy endpoints.
[Etherscan API Documentation](https://etherscan.io/apis#proxy)
"""
use Etherscan.API
use Etherscan.Constants
alias Etherscan.{ProxyBlock, ProxyTransaction, ProxyTransactionReceipt}
@eth_estimate_gas_... | lib/etherscan/api/proxy.ex | 0.84792 | 0.440229 | proxy.ex | starcoder |
defmodule Mix.Tasks.Elasticsearch.Build do
@moduledoc """
Builds Elasticsearch indexes using a zero-downtime, hot-swap technique.
1. Build an index for the given `alias`, with a timestamp: `alias-12323123`
2. Bulk upload data to that index using `store` and `sources`.
3. Alias the `alias` to `alias-12323123`... | lib/mix/elasticsearch.build.ex | 0.904514 | 0.613873 | elasticsearch.build.ex | starcoder |
defmodule DeliriumTremex do
@moduledoc """
DeliriumTremex is a library for standardized
[GraphQL](http://graphql.org/)
error handling through
[Absinthe](https://hex.pm/packages/absinthe).
## Idea
All errors should be returned it the `errors` field.
Errors have the following format:
```JSON
{
... | lib/delirium_tremex.ex | 0.8488 | 0.908496 | delirium_tremex.ex | starcoder |
defmodule Mariaex.Coder do
@moduledoc """
Declarative generator for MySQL protocol messages, which can generate based on declarative description
decoder and encoder.
Example:
defcoder :text_cmd do
command 1
statement :string_eof
end
Will generate 2 functions:
__en... | lib/mariaex/coder.ex | 0.73173 | 0.40204 | coder.ex | starcoder |
defmodule ExAliyun.MNS do
@moduledoc """
The official link to introduce [Alibaba Cloud Message Service](https://www.alibabacloud.com/help/doc-detail/27414.htm){:target="_blank"}.
## Queue APIs
* `batch_send_message/2`
* `batch_delete_message/3`
* `change_message_visibility/4`
* `create_queue/2`
... | lib/ex_aliyun/mns.ex | 0.854399 | 0.723138 | mns.ex | starcoder |
defmodule Support.Setup do
@moduledoc """
Functions that are designed to be used as chained `setup` callbacks.
Each callback takes certain values from the `context` state and merges in new or updated values.
Because they only get supplied the `context` as a parameter, each function has a contract around
the ... | test/support/setup.ex | 0.845974 | 0.90389 | setup.ex | starcoder |
defmodule Packet do
defstruct version: Nil, id: Nil, value: 0, children: []
@type t :: %__MODULE__{version: integer(), id: integer(), value: integer(), children: [Packet.t()]}
@spec b_to_i(boolean())::integer()
def b_to_i(b)
def b_to_i(true), do: 1
def b_to_i(false), do: 0
@spec add_version(Packet.t()):... | lib/decoder.ex | 0.745676 | 0.57517 | decoder.ex | starcoder |
defmodule XepCache do
@moduledoc """
A wrapper around Erlang's depcache, an in-memory caching server.
depcache bases its caching around ETS but can also switch to using
the in-process dictionary for maintaining a process-local cache.
Convenient functions are provided for getting/setting cache
values, wit... | lib/xepcache.ex | 0.838151 | 0.468426 | xepcache.ex | starcoder |
defmodule Gyx.Environments.Pure.Blackjack do
@moduledoc """
This is an environment implementation of the game of
[Blackjack](https://en.wikipedia.org/wiki/Blackjack) as
described in [Sutton and Barto RL book](http://incompleteideas.net/book/RLbook2018.pdf)
***Example 5.1*** cited below.
 :: any
def create(directio... | robot-simulator/lib/robot_simulator.ex | 0.904596 | 0.86212 | robot_simulator.ex | starcoder |
defmodule Adventofcode.Day07TheSumOfItsParts.PartTwo do
use Adventofcode
@enforce_keys [:steps, :dependencies, :workers, :delay]
defstruct second: -1,
workers: [],
steps: [],
completed: [],
dependencies: [],
delay: 0,
print: false
def ste... | lib/day_07_the_sum_of_its_parts_part_two.ex | 0.535098 | 0.533215 | day_07_the_sum_of_its_parts_part_two.ex | starcoder |
defmodule Ecto.Adapters.Jamdb.Oracle do
@moduledoc """
Adapter module for Oracle. `Ecto.Adapters.SQL` callbacks implementation.
It uses `jamdb_oracle` for communicating to the database.
## Features
* Using prepared statement functionality, the SQL statement you want
to run is precompiled and stored i... | lib/jamdb_oracle_ecto.ex | 0.764276 | 0.682514 | jamdb_oracle_ecto.ex | starcoder |
defmodule ElixirConsole.Autocomplete do
@moduledoc """
Encapsulates all the logic related with the autocomplete feature
"""
alias ElixirConsole.Documentation
@max_command_length 10_000
@doc """
Get a list of suggestions with all the possible words that could fit in the
command that is being typed by ... | lib/elixir_console/autocomplete.ex | 0.681727 | 0.461381 | autocomplete.ex | starcoder |
defmodule Notifications.Formatters.Utils do
@moduledoc """
Utils module for commonly reused functions within the notifications namespace
"""
use Timex
@spec format_date_string(nil | String.t) :: String.t
def format_date_string(date_string) when date_string == "" or date_string == nil, do: ""
def format_... | components/notifications-service/server/lib/formatters/utils.ex | 0.784484 | 0.401981 | utils.ex | starcoder |
defmodule LexibombServer.WordList do
@moduledoc """
Manages access to the list of valid gameplay words.
"""
@doc """
Starts an agent linked to the current process to store a normalized version
of `word_list`.
The default word list is based on <NAME>'s
_[Yet Another Word List](https://github.com/elasti... | apps/lexibomb_server/lib/lexibomb_server/word_list.ex | 0.864768 | 0.422594 | word_list.ex | starcoder |
defmodule Day10.Node.Configuration do
@moduledoc """
%Configuration{} struct describes where a node should send its
high and its low value(s) to. Destination is described as a String
that consists of the node type (bot or output) and its unique identifier.
"""
@type destination() :: String.t()
@type t() :... | advent-of-code-2016/day_10/lib/node.ex | 0.878014 | 0.509154 | node.ex | starcoder |
defmodule Timex.Parse.DateTime.Tokenizers.Directive do
@moduledoc false
alias Timex.Parse.DateTime.Parsers
alias Timex.Parse.DateTime.Tokenizers.Directive
defstruct type: :literal,
value: nil,
modifiers: [],
flags: [],
width: [min: -1, max: nil],
pars... | lib/parse/datetime/tokenizers/directive.ex | 0.880129 | 0.514644 | directive.ex | starcoder |
defmodule Militerm.Util.Yaml do
@moduledoc """
A simple YAML writer that lets us get the data from the components and display it for editing.
"""
@doc """
## Examples
iex> Yaml.write_to_string("string") |> to_string
"string"
iex> Yaml.write_to_string(["one", "two", "three"]) |> to_string
"... | lib/militerm/util/yaml.ex | 0.77552 | 0.576333 | yaml.ex | starcoder |
defmodule AWS.ApplicationAutoScaling do
@moduledoc """
With Application Auto Scaling, you can configure automatic scaling for the
following resources:
* Amazon ECS services
* Amazon EC2 Spot Fleet requests
* Amazon EMR clusters
* Amazon AppStream 2.0 fleets
* Amazon DynamoDB tables and g... | lib/aws/generated/application_auto_scaling.ex | 0.936561 | 0.610512 | application_auto_scaling.ex | starcoder |
defmodule ElixirRigidPhysics.Collision.AABB do
@moduledoc """
Module to handle [axis-aligned bounding boxes](https://en.wikipedia.org/wiki/Minimum_bounding_box#Axis-aligned_minimum_bounding_box).
Handles converting bodies to AABBs, checking overlaps, and so forth.
"""
require Record
Record.defrecord(:aabb... | lib/collision/aabb.ex | 0.916027 | 0.605595 | aabb.ex | starcoder |
defmodule Andy.Profiles.Rover.GMDefs.IntentionsOfOther do
@moduledoc "The GM definition for :intentions_of_other"
alias Andy.GM.{GenerativeModelDef, Intention, Conjecture, Round}
import Andy.GM.Utils
import Andy.Utils, only: [now: 0]
require Logger
@moves ~w{go_forward go_backward turn_right turn_left tu... | lib/andy/profiles/rover/gm_defs/intentions_of_other.ex | 0.829388 | 0.447883 | intentions_of_other.ex | starcoder |
defmodule Timeularex do
@moduledoc """
NOTE: Timeularex is in early stages of development. Use in production
should be considered with caution.
Timeularex is an API client for the [Timeular public API](http://developers.timeular.com/public-api/)
Timular is a service to improve time-tracking of activities.
... | lib/timeularex.ex | 0.815747 | 0.61115 | timeularex.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.