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 Membrane.Element.MPEGAudioParse.Parser.Helper do
@moduledoc false
alias Membrane.Caps.Audio.MPEG
@spec parse_header(binary) :: {:ok, MPEG.t()} | {:error, :invalid | :unsupported}
def parse_header(header) do
with <<0b11111111111::size(11), version::bitstring-size(2), layer::bitstring-size(2),
... | lib/membrane_element_mpegaudioparse/parser_helper.ex | 0.625438 | 0.430447 | parser_helper.ex | starcoder |
defmodule Contex.GanttChart do
@moduledoc """
Generates a Gantt Chart.
Bars are drawn for each task covering the start and end time for each task. In addition, tasks can be grouped
into categories which have a different coloured background - this is useful for showing projects that are
in major phases.
The time inter... | lib/chart/gantt.ex | 0.881245 | 0.799833 | gantt.ex | starcoder |
defmodule Ecto.DateTime.Util do
@moduledoc false
@doc false
def zero_pad(val, count) do
num = Integer.to_string(val)
:binary.copy("0", count - byte_size(num)) <> num
end
@doc false
def to_i(string) do
String.to_integer(<<string::16>>)
end
@doc false
def to_li(string) do
String.to_in... | lib/ecto/datetime.ex | 0.746971 | 0.564759 | datetime.ex | starcoder |
defmodule Solr do
@moduledoc """
Tools to ease the use of solr with dynamic fields based schemas
"""
@doc """
Example usage:
defmodule Solr.DynamicFields.Banana do
require Solr
Solr.fields_mapping [
solr_query_field: [
[:also_text],
[:text, :to, :transform, Solr.transform_... | solr.ex | 0.712032 | 0.561155 | solr.ex | starcoder |
defmodule CommerceCure.ExpiryDate do
alias __MODULE__
alias CommerceCure.Year
alias CommerceCure.Month
@type t :: %__MODULE__{year: Year.year, month: Month.month}
@enforce_keys [:year, :month]
defstruct [:year, :month]
@doc """
iex> ExpiryDate.new(5, 1234)
{:ok, %ExpiryDate{year: 1234, month: 5}}
... | lib/commerce_cure/data_type/expiry_date.ex | 0.728555 | 0.468365 | expiry_date.ex | starcoder |
defmodule Fares.Format do
@moduledoc """
Formatting functions for fare data.
"""
alias Fares.{Fare, Summary}
@type mode_type :: :bus_subway | :commuter_rail | :ferry
@doc "Formats the price of a fare as a traditional $dollar.cents value"
@spec price(Fare.t() | non_neg_integer | nil) :: String.t()
def ... | apps/fares/lib/format.ex | 0.854566 | 0.616878 | format.ex | starcoder |
defmodule ExAws.Polly do
@moduledoc """
Service module for AWS Polly for speech synthesis.
"""
@default_output_format "mp3"
@default_voice_id "Joanna"
@doc """
Returns the list of voices that are available for use when requesting speech synthesis.
Each voice speaks a specified language, is either male... | lib/ex_aws/polly.ex | 0.898087 | 0.412648 | polly.ex | starcoder |
defmodule Exexif.Decode do
@moduledoc """
Decode tags and (in some cases) their parameters.
"""
alias Exexif.Data.Gps
@spec tag(atom(), non_neg_integer(), value) :: {atom | <<_::64, _::_*8>>, value}
when value: binary() | float() | non_neg_integer()
@doc "Returns the decoded and humanized tag ou... | lib/exexif/decode.ex | 0.808143 | 0.594787 | decode.ex | starcoder |
defmodule ExCdrPusher.Utils do
@moduledoc """
This module contains a misc of useful functions
"""
@doc ~S"""
Convert to int and default to 0
## Example
iex> ExCdrPusher.Utils.convert_int(nil, 6)
6
iex> ExCdrPusher.Utils.convert_int("", 6)
6
iex> ExCdrPusher.Utils.convert_int(12, 6)
... | lib/utils.ex | 0.713232 | 0.538377 | utils.ex | starcoder |
defmodule Sin do
@moduledoc """
A convenient isomorphic alternative to elixir's AST. Describes
elixir syntax as structs.
"""
import Sin.Guards
@binops [
:and, :or, :in, :when, :+, :-, :/, :*, :++, :--, :.,
:~~~, :<>, :.., :^^^, :<|>, :<~>, :<~, :~>, :~>>, :<<~,
:>>>, :<<<, :|>, :>=, :<=, :>, :<... | lib/sin.ex | 0.611846 | 0.501221 | sin.ex | starcoder |
defmodule Hyperex do
@moduledoc """
A pure-Elixir HTML renderer.
"""
@void_tags ~w(area base br col embed hr img input link meta param source track wbr)
@type tag :: atom
@type unescaped_element :: {:dangerously_unescaped, binary, renderable, binary}
@type regular_element ::
{tag, %{optional(:... | lib/hyperex.ex | 0.844152 | 0.441252 | hyperex.ex | starcoder |
defmodule Cartographer do
@moduledoc """
Utility module with all kind of helper functions, e.g. related to encoding to human readable forms
or storing different popular alphabets and constants related with that.
"""
@base32_word_size 5
@base32_alphabet "0123456789bcdefghjkmnpqrstuvwxyz"
@doc """
Retu... | lib/cartographer.ex | 0.767036 | 0.500183 | cartographer.ex | starcoder |
defmodule Faker.Airports.En do
import Faker, only: [sampler: 2]
@moduledoc """
Functions for generating airports related data in English
"""
@doc """
Returns a random airport name
## Examples
iex> Faker.Airports.En.name()
"Union Island International Airport"
iex> Faker.Airports.En.na... | lib/faker/airports/en.ex | 0.693473 | 0.632446 | en.ex | starcoder |
defprotocol Lapin.Message.Payload do
@moduledoc """
You can use this protocol to implement a custom message payload transformation.
For example you could impelment a JSON message with a predefined structure by
first implementing a struct for your payload:
```elixir
defmodule Example.Payload do
defstruc... | lib/lapin/message/payload.ex | 0.898239 | 0.859605 | payload.ex | starcoder |
defmodule Regulator.Telemetry do
@moduledoc """
Regulator produces multiple telemetry events.
## Events
* `[:regulator, :limit]` - Returns the calculated limit
#### Measurements
* `:limit` - The new limit
#### Metadata
* `:regulator` - The name of the regulator
* `[:regulator, :ask, :... | lib/regulator/telemetry.ex | 0.821152 | 0.756313 | telemetry.ex | starcoder |
defmodule Strava.SegmentEffort do
import Strava.Util, only: [parse_date: 1]
@moduledoc """
A segment effort represents an athlete’s attempt at a segment. It can also be thought of as a portion of a ride that covers a segment.
More info: https://strava.github.io/api/v3/efforts/
"""
@type t :: %__MODULE__{... | lib/strava/segment_effort.ex | 0.900947 | 0.557123 | segment_effort.ex | starcoder |
defmodule Astarte.Streams.Flows.Flow do
@moduledoc """
This module implements an embedded_schema representing a Flow and also
the GenServer responsible of starting and monitoring the Flow.
"""
use GenServer
use Ecto.Schema
import Ecto.Changeset
alias Astarte.Streams.Flows.Flow
alias Astarte.Streams.... | lib/astarte_streams/flows/flow.ex | 0.784113 | 0.448426 | flow.ex | starcoder |
defmodule Params.Schema do
@moduledoc ~S"""
Defines a params schema for a module.
A params schema is just a map where keys are the parameter name
(ending with a `!` to mark the parameter as required) and the
value is either a valid Ecto.Type, another map for embedded schemas
or an array of those.
## Exa... | lib/params/schema.ex | 0.887929 | 0.75602 | schema.ex | starcoder |
defmodule FusionAuth.Login do
@moduledoc """
The `FusionAuth.Login` module provides access methods to the [FusionAuth Login API](https://fusionauth.io/docs/v1/tech/apis/login).
If an Application ID is not specified no refresh token will return in the response when logging in a user.
All methods require a Tesla... | lib/fusion_auth/login.ex | 0.772359 | 0.536495 | login.ex | starcoder |
defmodule Misc do
alias Nostrum.Api
@moduledoc """
Miscellaneous commands
"""
defmacrop funcs do
quote do
__MODULE__.__info__(:functions)
|> Enum.map(fn {k, _} -> {Atom.to_string(k), k} end)
|> Map.new
|> Map.delete("list_funcs")
end
end
def list_... | lib/misc.ex | 0.567337 | 0.449393 | misc.ex | starcoder |
defmodule Quantum.DateLibrary do
@moduledoc false
require Logger
alias Quantum.DateLibrary.{InvalidDateTimeForTimezoneError, InvalidTimezoneError}
@doc """
Convert Date to Utc
"""
@spec to_utc!(NaiveDateTime.t(), :utc | String.t()) :: NaiveDateTime.t()
def to_utc!(date, :utc), do: date
def to_utc... | lib/quantum/date_library.ex | 0.870005 | 0.419737 | date_library.ex | starcoder |
defmodule Esperanto.Parsers.Generics.EnclosingTag do
alias Esperanto.Parsers.TopLevel
alias Esperanto.ParserUtility
alias Esperanto.Walker
@doc """
opts
* :start_delimiter
* :barrier
* :enclosing_tag
* :attrs
"""
@moduledoc """
Simple enclose the contents between `:start_delimiter` and... | apps/esperanto/lib/trybe/esperanto/parsers/generics/enclosing_tag.ex | 0.729423 | 0.430267 | enclosing_tag.ex | starcoder |
defmodule XtbClient.Messages.TickPrice do
alias XtbClient.Messages.QuoteId
@moduledoc """
Info about one tick of price.
## Parameters
- `ask` ask price in base currency,
- `ask_volume` number of available lots to buy at given price or `null` if not applicable
- `bid` bid price in base currency,
- `b... | lib/xtb_client/messages/tick_price.ex | 0.835181 | 0.481393 | tick_price.ex | starcoder |
defmodule Perpetual do
@moduledoc """
Perpetual is a simple abstraction around repeatedly iterating state.
It is similar to Elixir's `Agent` module in that it can share or store state
that must be accessed from different processes or by the same process at
different points in time, and in additiion to that, ... | lib/perpetual.ex | 0.915879 | 0.785473 | perpetual.ex | starcoder |
defmodule Godfist.LeagueRates do
@moduledoc false
# Handles checking the information passed and assigning the correct
# limit to the request.
use GenServer
alias Godfist.HTTP
# Rates for different servers.
@rates [
# "League" endpoints/servers
euw: {300, 60_000},
na: {270, 60_000},
eun... | lib/godfist/league_rates.ex | 0.69035 | 0.488527 | league_rates.ex | starcoder |
defmodule Advent20.Ticket do
@moduledoc """
Day 16: Ticket Translation
"""
defp parse(input) do
[rules_raw, your_ticket_raw, nearby_tickets_raw] =
input
|> String.split("\n\n", trim: true)
rules =
rules_raw
|> String.split("\n")
|> Enum.map(&Regex.run(~r/^(.*): (\d+)-(\d+... | lib/advent20/16_ticket.ex | 0.727395 | 0.536981 | 16_ticket.ex | starcoder |
defmodule Dumpster do
require Logger
import Path, only: [expand: 1]
alias Dumpster.Utils
@moduledoc ~S"""
Simple Binary dumps.
## Usage
Add Dumpster as a dependency in your `mix.exs`:
defp deps() do
[
{:dumpster, "~> 1.0.0"}
]
end
Either add Dumpster to your applicatio... | lib/dumpster.ex | 0.778733 | 0.436442 | dumpster.ex | starcoder |
defmodule Nerves.Runtime.Log.Parser do
@moduledoc """
Functions for parsing syslog and kmsg strings
"""
@doc """
Parse out the syslog facility, severity, and message (including the timestamp
and host) from a syslog-formatted string.
The message is of the form:
```text
<pri>message
```
`pri` is... | lib/nerves_runtime/log/parser.ex | 0.536313 | 0.857709 | parser.ex | starcoder |
defmodule VintageNet.Interface.Classification do
@moduledoc """
Module for classifying and prioritizing network interfaces
"""
@typedoc """
Categorize interfaces based on their technology
"""
@type interface_type :: :ethernet | :wifi | :mobile | :local | :unknown
@typedoc """
Interface connection st... | lib/vintage_net/interface/classification.ex | 0.901604 | 0.414158 | classification.ex | starcoder |
defmodule NounProjex do
@moduledoc """
[Noun Project](https://thenounproject.com) API Client in Elixir.
"""
@base_url "http://api.thenounproject.com"
@consumer_key Application.get_env(:noun_projex, :api_key)
@consumer_secret Application.get_env(:noun_projex, :api_secret)
@doc """
Returns a single coll... | lib/noun_projex.ex | 0.778523 | 0.427038 | noun_projex.ex | starcoder |
defmodule Textgain.Service do
@moduledoc """
This module provides the common entrypoints into the Textgain API used by
the specific web service modules.
"""
# Module dependencies.
require Logger
# Module attributes.
@api_endpoint "https://api.textgain.com/1/"
defmacro __using__(_opts) do
quote ... | lib/textgain/service.ex | 0.793106 | 0.844152 | service.ex | starcoder |
defmodule ExUnit.Diff do
@moduledoc false
@doc """
Returns an edit script representing the difference between `left` and `right`.
Returns `nil` if they are not the same data type,
or if the given data type is not supported.
"""
def script(left, right)
def script(term, term)
when is_binary(term)... | lib/ex_unit/lib/ex_unit/diff.ex | 0.825167 | 0.676673 | diff.ex | starcoder |
defmodule StarkInfra.IssuingCard do
alias __MODULE__, as: IssuingCard
alias StarkInfra.IssuingRule
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.API
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
Groups Issu... | lib/issuing_card/issuing_card.ex | 0.881946 | 0.568476 | issuing_card.ex | starcoder |
defmodule Bunch.Enum do
@moduledoc """
A bunch of helper functions for manipulating enums.
"""
use Bunch
alias Bunch.Type
@doc """
Generates a list consisting of `i` values `v`.
iex> #{inspect(__MODULE__)}.repeated(:abc, 4)
[:abc, :abc, :abc, :abc]
iex> #{inspect(__MODULE__)}.repeate... | lib/bunch/enum.ex | 0.799364 | 0.446072 | enum.ex | starcoder |
defmodule OcppModel.V20.EnumTypes do
@moduledoc """
Contains a map of all EnumTypes that are used in the currently supported messages, with a function to validate if a value is part of the EnumType
"""
@enum_types %{
authorizeCertificateStatusEnumType: ["Accepted", "SignatureError", "CertificateExpired", ... | lib/ocpp_model/v20/enumtypes.ex | 0.682997 | 0.418875 | enumtypes.ex | starcoder |
defmodule BSON.Decimal128 do
@moduledoc """
see https://en.wikipedia.org/wiki/Decimal128_floating-point_format
"""
use Bitwise
@signed_bit_mask 1 <<< 63
@combination_mask 0x1f
@combintation_infinity 30
@combintation_nan 31
@exponent_mask 0x3fff
@exponent_bias 6176
@max_exponent 6111
@min_ex... | lib/bson/decimal128.ex | 0.743261 | 0.609495 | decimal128.ex | starcoder |
defmodule Singyeong.Proxy do
@moduledoc """
Singyeong is capable of proxying HTTP requests between services, while still
retaining the ability to route requests by metadata.
Proxied requests are handled by `POST`ing a JSON structure describing how the
request is to be sent to the `/proxy` endpoint (see API.m... | lib/singyeong/proxy.ex | 0.707304 | 0.691367 | proxy.ex | starcoder |
defmodule Pbkdf2.Base do
@moduledoc """
Base module for the Pbkdf2 password hashing library.
"""
use Bitwise
alias Pbkdf2.{Base64, Tools}
@max_length bsl(1, 32) - 1
@doc """
Generate a salt for use with Django's version of pbkdf2.
## Examples
To create a valid Django hash, using pbkdf2_sha256:
... | deps/pbkdf2_elixir/lib/pbkdf2/base.ex | 0.890422 | 0.521106 | base.ex | starcoder |
defmodule Earmark.Options do
@moduledoc """
This is a superset of the options that need to be passed into `EarmarkParser.as_ast/2`
The following options are proper to `Earmark` only and therefore explained in detail
- `compact_output`: boolean indicating to avoid indentation and minimize whitespace
- `eex`... | lib/earmark/options.ex | 0.829975 | 0.581927 | options.ex | starcoder |
defmodule EdgeDB.Result do
@moduledoc """
A structure that contains information related to the query result.
It's mostly used in driver internally, but user can retrive it along with `EdgeDB.Query` struct
from succeed query execution using `:raw` option for `EdgeDB.query*/4` functions. See `t:EdgeDB.query_op... | lib/edgedb/result.ex | 0.910526 | 0.580411 | result.ex | starcoder |
defmodule Phoenix.PubSub do
@moduledoc """
Realtime Publisher/Subscriber service.
## Getting started
You start Phoenix.PubSub directly in your supervision
tree:
{Phoenix.PubSub, name: :my_pubsub}
You can now use the functions in this module to subscribe
and broadcast messages:
iex> alias ... | lib/phoenix/pubsub.ex | 0.903917 | 0.486758 | pubsub.ex | starcoder |
defmodule ExCucumber.Exceptions.Messages.UnableToAutoMatchParam do
@moduledoc false
alias ExCucumber.{
Exceptions.MatchFailure,
Utils
}
# alias ExCucumber.Exceptions.Messages.Common, as: CommonMessages
alias CucumberExpressions.Parser.ParseTree
def render(%MatchFailure{error_code: :unable_to_auto_... | apps/ex_cucumber/lib/ex_cucumber/exceptions/messages/match_failure_messages/unable_to_auto_match_param.ex | 0.776877 | 0.427217 | unable_to_auto_match_param.ex | starcoder |
defmodule Pane.Viewer do
@moduledoc false
defstruct pages: [], total_pages: 0, index: 0
use GenServer
@doc ~S"""
Starts a `Pane.Viewer` with given opts.
## Examples
iex> {:ok, pid} = Pane.Viewer.start_link(data: "test")
iex> is_pid(pid)
true
"""
def start_link(opts \\ []) do
... | lib/viewer.ex | 0.6973 | 0.438725 | viewer.ex | starcoder |
defmodule DataMatrix.CLI do
@moduledoc false
alias DataMatrix.Render
@version Mix.Project.config()[:version]
@switches [
help: :boolean,
version: :boolean,
preview: :boolean,
input: :string,
output: :string,
symbol: :integer,
rectangle: :boolean,
dark: :string,
light: :str... | lib/datamatrix/cli.ex | 0.672547 | 0.494629 | cli.ex | starcoder |
defmodule KademliaSearch do
@moduledoc """
A @alpha multi-threaded kademlia search. Starts a master as well as @alpha workers
and executed the specified cmd query in the network.
"""
use GenServer
@max_oid 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 1
@alpha 3
def init(:ok)... | lib/kademliasearch.ex | 0.591487 | 0.41837 | kademliasearch.ex | starcoder |
defmodule AWS.Shield do
@moduledoc """
AWS Shield Advanced
This is the *AWS Shield Advanced API Reference*. This guide is for
developers who need detailed information about the AWS Shield Advanced API
actions, data types, and errors. For detailed information about AWS WAF and
AWS Shield Advanced features ... | lib/aws/shield.ex | 0.806358 | 0.472197 | shield.ex | starcoder |
defmodule Temporal.Fetch do
@doc """
Touch a file, useful if you want to "skip" a download
## Examples
iex> Temporal.Fetch.touch(%{basedir: "/tmp/", fequency: :monthly, source: "https://my.a4word.com/webfiles/x.txt"})
"/tmp/20170504/my.a4word.com/webfiles/x.txt"
iex> Temporal.Fetch.touch(%{ba... | lib/temporal/fetch.ex | 0.677367 | 0.429998 | fetch.ex | starcoder |
defmodule Glicko.Result do
@moduledoc """
Provides convenience functions for handling a result against an opponent.
## Usage
iex> opponent = Player.new_v2
iex> Result.new(opponent, 1.0)
{0.0, 2.014761872416068, 1.0}
iex> Result.new(opponent, :draw) # With shortcut
{0.0, 2.014761872... | lib/glicko/result.ex | 0.882453 | 0.403743 | result.ex | starcoder |
defmodule ShouldI.Matchers.Context do
@moduledoc """
Convenience macros for generating short test cases of common structure. These matchers work with the context.
"""
import ExUnit.Assertions
import ShouldI.Matcher
@doc """
Exactly match a key in the context to a value.
## Examples
setup conte... | lib/shouldi/matchers/context.ex | 0.912016 | 0.622431 | context.ex | starcoder |
defmodule Taylor do
defstruct [:function, :name]
@default_precision 10
alias Numbers, as: N
# First argument should be 'x', second argument should be 'n'.
def new(function, name) when is_function(function, 2) do
%__MODULE__{function: function, name: name}
end
def apply(taylor, x) do
Taylor.com... | lib/taylor.ex | 0.504883 | 0.713556 | taylor.ex | starcoder |
defmodule Instream.Series.Validator do
@moduledoc false
@forbidden_keys [:_field, :_measurement, :time]
@doc """
Checks if all mandatory definitions for a series are available.
"""
@spec proper_series?(module) :: no_return
def proper_series?(series) do
_ =
series
|> defined?
|> mea... | lib/instream/series/validator.ex | 0.85747 | 0.430327 | validator.ex | starcoder |
defmodule FakeServer do
@moduledoc """
Manage HTTP servers on your tests
"""
@doc """
Starts an HTTP server.
Returns the tuple `{:ok, pid}` if the server started and `{:error, reason}` if any error happens.
## Parameters:
- `name`: An identifier to the server. It must be an atom.
- `port` (optional... | lib/fake_server.ex | 0.842653 | 0.815085 | fake_server.ex | starcoder |
defmodule Mix.Tasks.Legion.Reg.Nationality do
@moduledoc """
Registers nationalities to the repository.
"""
use Legion.RegistryDirectory.Synchronization, site: Legion.Messaging.Settings, repo: Legion.Repo
alias Legion.Repo
alias Legion.Identity.Information.Nationality
def put_nationality(
abbrev... | apps/legion/lib/mix/tasks/legion.reg.nationality.ex | 0.553385 | 0.485905 | legion.reg.nationality.ex | starcoder |
defmodule Binance do
@doc """
Pings binance API. Returns `{:ok, %{}}` if successful, `{:error, reason}` otherwise
"""
def ping() do
BinanceHttp.get_binance("/api/v1/ping")
end
@doc """
Get binance server time in unix epoch.
Returns `{:ok, time}` if successful, `{:error, reason}` otherwise
## Ex... | lib/binance.ex | 0.90941 | 0.823293 | binance.ex | starcoder |
defmodule RRule.Parser.ICal do
alias RRule.Rule
@time_regex ~r/^:?;?(?:TZID=(.+?):)?(.*?)(Z)?$/
@datetime_format "{YYYY}{0M}{0D}T{h24}{m}{s}"
# @time_format "{h24}{m}{s}"
@spec parse(String.t()) :: {:ok, Rule.t()} | {:error, term()}
def parse(str) when is_binary(str) do
ruleset =
str
|> St... | lib/rrule/parser/ical.ex | 0.67822 | 0.403743 | ical.ex | starcoder |
defmodule TimeZoneInfo.Transformer.ZoneState do
@moduledoc """
The transformer for time-zones.
"""
alias TimeZoneInfo.{GregorianSeconds, IanaDateTime, IanaParser}
alias TimeZoneInfo.Transformer.{Abbr, Rule, RuleSet}
@end_of_time GregorianSeconds.from_naive(~N[9999-12-31 00:00:00])
@doc """
Transforms... | lib/time_zone_info/transformer/zone_state.ex | 0.901379 | 0.450964 | zone_state.ex | starcoder |
defmodule Clickhousex.Codec.Binary.Extractor do
@moduledoc """
Allows modules that `use` this module to create efficient extractor functions that speak clickhouse's binary protocol.
To define extractors, annotate a function with the `extract` attribute like this:
@extract length: :varint
def extrac... | lib/clickhousex/codec/binary/extractor.ex | 0.787646 | 0.512083 | extractor.ex | starcoder |
defmodule Benchmarks.Proto2.GoogleMessage2 do
@moduledoc false
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{
field1: String.t(),
field3: integer,
field4: integer,
field30: integer,
field75: boolean,
field6: String.t(),
field2: String.t... | bench/lib/datasets/google_message2/benchmark_message2.pb.ex | 0.83128 | 0.464841 | benchmark_message2.pb.ex | starcoder |
defmodule LocalLedger.Entry do
@moduledoc """
This module is an interface to the LocalLedgerDB schemas and contains the logic
needed to insert valid entries and transactions.
"""
alias LocalLedgerDB.{Repo, Entry, Errors.InsufficientFundsError}
alias LocalLedger.{
Transaction,
Balance,
Errors.Inv... | apps/local_ledger/lib/local_ledger/entry.ex | 0.848392 | 0.456894 | entry.ex | starcoder |
defmodule Grizzly.ZWave.Commands.ScheduleEntryLockTimeOffsetSet do
@moduledoc """
This command is used to set the current local tzo and dst offsets into an Entry Lock Device. A
Params:
* `:sign_tzo` - Plus (0) or minus (1) sign to indicate a positive or negative offset from UTC.
* `:hour_tzo` - Specify ... | lib/grizzly/zwave/commands/schedule_entry_lock_time_offset_set.ex | 0.905401 | 0.558809 | schedule_entry_lock_time_offset_set.ex | starcoder |
defmodule Cldr.Number.Backend.Decimal.Formatter do
@moduledoc false
def define_number_module(config) do
alias Cldr.Number.Formatter.Decimal
backend = config.backend
quote location: :keep do
defmodule Number.Formatter.Decimal do
unless Cldr.Config.include_module_docs?(unquote(config.gene... | lib/cldr/number/backend/decimal_formatter.ex | 0.774242 | 0.484563 | decimal_formatter.ex | starcoder |
defmodule Benchmarks.GoogleMessage3.Message10576 do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.10.1-dev", syntax: :proto2
end
defmodule Benchmarks.GoogleMessage3.Message10154 do
@moduledoc false
use Protobuf, protoc_gen_elixir_version: "0.10.1-dev", syntax: :proto2
field :field10192, 1, op... | bench/lib/datasets/google_message3/benchmark_message3_6.pb.ex | 0.655005 | 0.490602 | benchmark_message3_6.pb.ex | starcoder |
defmodule ExInsights.Utils do
@moduledoc false
@doc ~S"""
Convert ms to c# time span format. Ported from https://github.com/Microsoft/ApplicationInsights-node.js/blob/68e217e6c6646114d8df0952437590724070204f/Library/Util.ts#L122
### Parameters:
'''
number: Number for time in milliseconds.
'''
### Ex... | lib/ex_insights/utils.ex | 0.868116 | 0.480905 | utils.ex | starcoder |
defmodule RsTwitter do
@http_client Application.get_env(:rs_twitter, :http_client, RsTwitter.Http.Client)
@moduledoc """
Twitter API SDK
This is low level twitter client. The idea behind this package is not to define special functions for each endpoint,
but use generic request structure that will allow to m... | lib/rs_twitter.ex | 0.656548 | 0.451568 | rs_twitter.ex | starcoder |
defmodule CommerceCure.BillingAddress do
alias CommerceCure.{Name, Phone, Address}
@moduledoc """
Billing Address have the following:
:name - The full name of the customer
:comapny - The company name of the customer
:phone - The phone number of the customer
:suite - The suite or apartment number o... | lib/commerce_cure/data_type/billing_address.ex | 0.747247 | 0.540075 | billing_address.ex | starcoder |
defmodule AWS.SSOAdmin do
@moduledoc """
"""
@doc """
Attaches an IAM managed policy ARN to a permission set.
<note> If the permission set is already referenced by one or more account
assignments, you will need to call ` `ProvisionPermissionSet` ` after this
action to apply the corresponding IAM polic... | lib/aws/generated/s_s_o_admin.ex | 0.879471 | 0.509032 | s_s_o_admin.ex | starcoder |
defmodule JsonSchema do
@moduledoc ~S"""
A service which validates objects according to types defined
in `schema.json`.
SRD -> Modified from https://gist.github.com/gamache/e8e24eee5bd3f190de23
"""
use GenServer
def start_link() do
GenServer.start_link(__MODULE__, :ok, [name: :json_schema])
end
... | lib/game_service/json_schema.ex | 0.708414 | 0.452354 | json_schema.ex | starcoder |
defmodule OMG.Utils.HttpRPC.Response do
@moduledoc """
Serializes the response into expected result/data format.
"""
alias OMG.Utils.HttpRPC.Encoding
@type response_t :: %{version: binary(), success: boolean(), data: map()}
def serialize_page(data, data_paging) do
data
|> serialize()
|> Map.put... | apps/omg_utils/lib/omg_utils/http_rpc/response.ex | 0.841679 | 0.541348 | response.ex | starcoder |
defmodule PlugInstrumenter do
@moduledoc """
Reports plug timing to a configurable callback function.
Wraps plugs, adding instrumentation. Use it in your plug pipeline like this:
plug PlugInstrumenter, plug: MyPlug
Pass options to the plug like this:
plug PlugInstrumenter, plug: MyPlug, opts: [m... | lib/plug_instrumenter.ex | 0.863233 | 0.487185 | plug_instrumenter.ex | starcoder |
defmodule OnFlow do
import __MODULE__.Channel, only: [get_channel: 0]
import __MODULE__.{Util, Transaction}
alias __MODULE__.{Credentials, JSONCDC, TransactionResponse}
@type account() :: OnFlow.Entities.Account.t()
@type address() :: binary()
@type error() :: {:error, GRPC.RPCError.t()}
@type hex_strin... | lib/on_flow.ex | 0.85266 | 0.406214 | on_flow.ex | starcoder |
defmodule BasicAuthentication do
@moduledoc """
Submit and verify client credentials using Basic authentication.
*The 'Basic' authentication scheme is specified in RFC 7617 (which obsoletes RFC 2617).
This scheme is not a secure method of user authentication,
see https://tools.ietf.org/html/rfc7617#section-4... | lib/basic_authentication.ex | 0.858822 | 0.436622 | basic_authentication.ex | starcoder |
defmodule Dextruct do
@moduledoc """
The operator `<~` imitates destructing assignment behavior like in Ruby or ES6.
It's so obvious that pattern matching with `=` is just awesome. But less then occasionally, we still want some destructing assignment, witout MatchError, works like in other languge. Dextruct libr... | lib/dextruct.ex | 0.85344 | 0.885532 | dextruct.ex | starcoder |
defmodule MonEx.Option do
@moduledoc """
Option module provides Option type with utility functions.
"""
alias MonEx.Result
defmacro some(val) do
quote do
{:some, unquote(val)}
end
end
defmacro none do
quote do
{:none}
end
end
@typedoc """
Option type.
`some(a)` or `... | lib/monex/option.ex | 0.918972 | 0.434281 | option.ex | starcoder |
defmodule Geometry.PolygonZ do
@moduledoc """
A polygon struct, representing a 3D polygon.
A none empty line-string requires at least one ring with four points.
"""
alias Geometry.{GeoJson, LineStringZ, PolygonZ, WKB, WKT}
defstruct rings: []
@type t :: %PolygonZ{rings: [Geometry.coordinates()]}
@d... | lib/geometry/polygon_z.ex | 0.939561 | 0.668617 | polygon_z.ex | starcoder |
defmodule HammocWeb.LiveIntegrationCase do
@moduledoc """
This module defines the test case to be used by
tests for everything between API responses and
rendered LiveViews.
Such tests rely on `Phoenix.ConnTest` and also
import other functionality to make it easier
to build common data structures and quer... | test/support/live_integration_case.ex | 0.81231 | 0.444022 | live_integration_case.ex | starcoder |
defmodule ElixirLatex.Job do
defmodule LatexError do
defexception message: "LaTeX compilation job failed with an error"
@moduledoc """
Error raised when a LaTeX compilation job exits with a non-zero code.
"""
end
@type assigns :: %{optional(atom) => any}
@type attachments :: %{optional(atom | ... | lib/elixir_latex/job.ex | 0.788054 | 0.428712 | job.ex | starcoder |
defmodule Anansi.Text do
@moduledoc """
ANSI escape codes that format, color, and change the font of terminal text.
"""
import Anansi, only: [instruction: 2]
@doc """
Resets text formatting, font, and color.
"""
def reset do
instruction :text, :reset
end
@doc """
Convenience function to ins... | lib/anansi/text.ex | 0.88106 | 0.700498 | text.ex | starcoder |
defmodule Wasm do
import Enum, only: [map_join: 2]
import Bitwise
@moduledoc """
Functions and types for encoding WebAssembly.
For more information, see the [WebAssembly spec](https://github.com/WebAssembly/spec), the [Binary section](http://webassembly.github.io/spec/core/bikeshed/index.html#binary-format%... | lib/wasm.ex | 0.760828 | 0.455562 | wasm.ex | starcoder |
defmodule Dataset do
defstruct rows: [], labels: {}
@moduledoc ~S"""
Datasets represent labeled tabular data.
Datasets are enumerable:
iex> Dataset.new([{:a, :b, :c},
...> {:A, :B, :C},
...> {:i, :ii, :iii},
...> {:I, :II, :III}],
...> ... | lib/dataset.ex | 0.87127 | 0.832611 | dataset.ex | starcoder |
defmodule Grizzly.ZWave.Commands.MultiChannelCommandEncapsulation do
@moduledoc """
This command is used to encapsulate commands to or from a Multi Channel End Point.
Params:
* `:source_end_point` - the originating End Point (defaults to 0 - if 0, destination_end_point must be non-zero).
* `:bit_addres... | lib/grizzly/zwave/commands/multi_channel_command_encapsulation.ex | 0.894698 | 0.509154 | multi_channel_command_encapsulation.ex | starcoder |
defmodule IntSort.Chunk do
@moduledoc """
Contains functionality for handling chunk files, which contain chunks
of sorted integers
"""
@integer_file Application.get_env(:int_sort, :integer_file)
@doc """
Creates a stream that divides the integers in an input stream into chunks
Note that this function... | int_sort/lib/chunk.ex | 0.898027 | 0.734905 | chunk.ex | starcoder |
defmodule Bunch.Macro do
@moduledoc """
A bunch of helpers for implementing macros.
"""
@doc """
Imitates `import` functionality by finding and replacing bare function
calls (like `foo()`) in AST with fully-qualified call (like `Some.Module.foo()`)
Receives AST fragment as first parameter and
list of ... | lib/bunch/macro.ex | 0.820757 | 0.612165 | macro.ex | starcoder |
defmodule StepFlow.Jobs do
@moduledoc """
The Jobs context.
"""
import Ecto.Query, warn: false
alias StepFlow.Repo
alias StepFlow.Jobs.Job
alias StepFlow.Jobs.Status
@doc """
Returns the list of jobs.
## Examples
iex> list_jobs()
[%Job{}, ...]
"""
def list_jobs(params \\ %{}) d... | lib/step_flow/jobs/jobs.ex | 0.839668 | 0.472562 | jobs.ex | starcoder |
defmodule RingBuffer do
@moduledoc ~S"""
[Circular Buffer](https://en.wikipedia.org/wiki/Circular_buffer) data structure
"""
alias RingBuffer.Internals
@opaque t :: %__MODULE__{
size: non_neg_integer,
default: any,
internal: Internals.t
}
defstruct size: 0, internal: nil, default: :undefined... | lib/ringbuffer.ex | 0.877582 | 0.578359 | ringbuffer.ex | starcoder |
defmodule FDB.Versionstamp do
@moduledoc """
A versionstamp is a 12 byte, unique, monotonically (but not sequentially) increasing value for each committed transaction.
`{8 byte} {2 byte} {2 byte}`
1. The first 8 bytes are the committed version of the database.
1. The next 2 bytes are monotonic in the serial... | lib/fdb/versionstamp.ex | 0.87397 | 0.455683 | versionstamp.ex | starcoder |
defmodule StarkInfra.PixClaim do
alias __MODULE__, as: PixClaim
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
Groups PixClaim related functions
"""
@doc """
PixClaims intend to trans... | lib/pix_claim/pix_claim.ex | 0.91117 | 0.662428 | pix_claim.ex | starcoder |
defmodule Akd.Operation do
require Logger
@moduledoc """
This module represents an `Operation` struct which contains metadata about
a command/operation that can be run on a destination.
Please refer to `Nomenclature` for more information about the terms used.
The meta data involves:
* `cmd` - Commands... | lib/akd/operation.ex | 0.773943 | 0.568356 | operation.ex | starcoder |
defmodule ExlasticSearch.Response do
@moduledoc """
Base module for ES response parsing. Works off a few macros, `schema/1`, `field/1`, `has_many/2`, `has_one/2`
The usage is more or less:
```
use ExlasticSearch.Response
schema do
field :total
has_many :hits, HitsModule
end
```
This will... | lib/exlasticsearch/response.ex | 0.856197 | 0.85269 | response.ex | starcoder |
defmodule ExCov.Project do
@moduledoc """
Gives information about and analyses a Mix Project for code coverage.
"""
alias ExCov.Project, as: Project
alias ExCov.Module, as: Module
alias ExCov.Statistics, as: Statistics
defstruct [
compile_path: nil,
cover_compiled?: false,
cover_analy... | lib/excov/project.ex | 0.879813 | 0.438665 | project.ex | starcoder |
defmodule AdventOfCode.Day25A do
def simulate(input) do
input
|> parse
|> build_machine
|> run
|> (& &1.tape).()
|> Map.values
|> Enum.sum
end
defp parse(input) do
input
|> String.split("\n\n")
|> parse_preamble
|> parse_rules
end
defp parse_preamble([preamble | ... | lib/advent_of_code/day_25_a.ex | 0.63624 | 0.665747 | day_25_a.ex | starcoder |
defmodule PgEx.Connection.Query do
@moduledoc false
alias __MODULE__, as: Prepared
alias PgEx.{Connection, Parser}
defstruct [
# A list of the column names we're going to get as part of the result
:columns,
# A list of the modules we need to decode the returned rows. In other words,
# decoder... | lib/pgex/connection/query.ex | 0.811153 | 0.643385 | query.ex | starcoder |
import Kernel, except: [apply: 2]
defmodule Ecto.Query.Builder.Dynamic do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Builds a dynamic expression.
"""
@spec build([Macro.t], Macro.t, Macro.Env.t) :: Macro.t
def build(binding, expr, env) do
{query, vars} = Builder.escape_binding(quote(do: que... | deps/ecto/lib/ecto/query/builder/dynamic.ex | 0.728265 | 0.482673 | dynamic.ex | starcoder |
defmodule ETS.Base do
@moduledoc """
Base implementation for table modules (e.g. `ETS.Set` and `ETS.Bag`). Should not be used directly.
"""
use ETS.Utils
@protection_types [:public, :protected, :private]
@type option ::
{:name, atom()}
| {:protection, :private | :protected | :public}
... | lib/ets/base.ex | 0.752831 | 0.439326 | base.ex | starcoder |
defmodule EWallet.BalanceFetcher do
@moduledoc """
Handles the retrieval and formatting of balances from the local ledger.
"""
alias EWalletDB.{Token, User, Wallet}
@spec all(map()) :: {:ok, %EWalletDB.Wallet{}} | {:error, atom()}
@doc """
Prepare the list of balances and turn them into a suitable form... | apps/ewallet/lib/ewallet/fetchers/balance_fetcher.ex | 0.762866 | 0.456652 | balance_fetcher.ex | starcoder |
defmodule Omise.Transfer do
@moduledoc ~S"""
Provides Transfers API interfaces.
<https://www.omise.co/transfers-api>
"""
use Omise.HTTPClient, endpoint: "transfers"
defstruct object: "transfer",
id: nil,
livemode: nil,
location: nil,
recipient: nil,
... | lib/omise/transfer.ex | 0.902615 | 0.459076 | transfer.ex | starcoder |
defmodule Functions do
use Koans
@intro "Functions"
def greet(name) do
"Hello, #{name}!"
end
koan "Functions map arguments to outputs" do
assert greet("World") == "Hello, World!"
end
def multiply(a, b), do: a * b
koan "Single line functions are cool, but mind the comma and the colon!" do
... | lib/koans/13_functions.ex | 0.86757 | 0.763396 | 13_functions.ex | starcoder |
defmodule GrovePi.Board do
@moduledoc """
Low-level interface for sending raw requests and receiving responses from a
GrovePi hat. Create one of these first and then use one of the other GrovePi
modules for interacting with a connected sensor, light, or actuator.
To check that your GrovePi hardware is workin... | lib/grovepi/board.ex | 0.832917 | 0.750621 | board.ex | starcoder |
defmodule Base do
import Bitwise
@moduledoc """
This module provides data encoding and decoding functions
according to [RFC 4648](https://tools.ietf.org/html/rfc4648).
This document defines the commonly used base 16, base 32, and base
64 encoding schemes.
## Base 16 alphabet
| Value | Encoding |... | lib/elixir/lib/base.ex | 0.665519 | 0.684106 | base.ex | starcoder |
defmodule Instruments.MacroHelpers do
@moduledoc false
@safe_metric_types [:increment, :decrement, :gauge, :event, :set]
def build_metric_macro(:measure, caller, metrics_module, key_ast, options_ast, function) do
key = to_iolist(key_ast, caller)
quote do
safe_opts = unquote(to_safe_options(:measur... | lib/macro_helpers.ex | 0.759315 | 0.423428 | macro_helpers.ex | starcoder |
defmodule EctoMnesia.Storage do
@moduledoc """
This module provides interface to manage Mnesia state and records data structure.
"""
require Logger
alias :mnesia, as: Mnesia
@behaviour Ecto.Adapter.Storage
@defaults [
host: {:system, :atom, "MNESIA_HOST", Kernel.node()},
storage_type: {:system, ... | lib/ecto_mnesia/storage.ex | 0.845305 | 0.48121 | storage.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.