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 Mix.Triplex do
@moduledoc """
Useful functions for any triplex mix task.
Here is the list of tasks we have for now:
- [`mix triplex.gen.migration`](./Mix.Tasks.Triplex.Gen.Migration.html) -
generates a tenant migration for the repo
- [`mix triplex.migrate`](./Mix.Tasks.Triplex.Migrate.html) -
... | lib/mix/triplex.ex | 0.807764 | 0.533762 | triplex.ex | starcoder |
defmodule ExchemaCoercion.Coercions.DateAndTime do
@moduledoc """
Coercions for Date and Time types
"""
alias Exchema.Types, as: T
@doc """
Converts a ISO 8601 String to a native date/time format
"""
@spec from_iso8601(any, Exchema.Type.t, [ExchemaCoercion.coercion]) :: ExchemaCoercion.result
def ... | lib/coercions/date_and_time.ex | 0.87308 | 0.665626 | date_and_time.ex | starcoder |
defmodule Mix.Tasks.Adify do
@shortdoc ~s(Runs Adify task with given options)
@task ~s(mix adify)
@info """
#{@task} runs adify commands:
Usage:
$ `@{task} --os osx
Options:
```
Option Alias Description
-------------------------------------------------------------------------... | lib/adify/mix/adify.ex | 0.797281 | 0.619759 | adify.ex | starcoder |
defmodule Absinthe.Fixtures.PetsSchema do
use Absinthe.Schema
interface :being do
field :name, :string do
arg :surname, :boolean
end
end
interface :pet do
field :name, :string do
arg :surname, :boolean
end
end
interface :canine do
field :name, :string do
arg :surname... | test/support/fixtures/pets_schema.ex | 0.538012 | 0.645602 | pets_schema.ex | starcoder |
defmodule Parent.Client do
@moduledoc """
Functions for interacting with parent's children from other processes.
All of these functions issue a call to the parent process. Therefore, they can't be used from
inside the parent process. Use functions from the `Parent` module instead to interact with the
childre... | lib/parent/client.ex | 0.890501 | 0.556038 | client.ex | starcoder |
defmodule Mix.Tasks.Hex.Outdated do
use Mix.Task
alias Hex.Registry.Server, as: Registry
@shortdoc "Shows outdated Hex deps for the current project"
@moduledoc """
Shows all Hex dependencies that have newer versions in the registry.
mix hex.outdated [APP]
By default, it only shows top-level packag... | lib/mix/tasks/hex.outdated.ex | 0.760295 | 0.416915 | hex.outdated.ex | starcoder |
defmodule Oban.Plugins.Gossip do
@moduledoc """
Periodically broadcast queue activity to the gossip notification channel.
## Using the Plugin
The following example demonstrates using the plugin without any configuration, which will broadcast
the state of each local queue every 1 second:
config :my_ap... | lib/oban/plugins/gossip.ex | 0.84626 | 0.591104 | gossip.ex | starcoder |
defmodule CMS.Helpers do
@moduledoc """
Various helper functions that aid in parsing CMS JSON data.
"""
alias CMS.API
alias CMS.Config
alias CMS.CustomHTML5Scrubber
alias CMS.Field.{File, Image, Link}
alias CMS.Partial.Paragraph
alias Phoenix.HTML
@doc """
Each CMS entity hosts a variety of fiel... | apps/cms/lib/helpers.ex | 0.796134 | 0.490297 | helpers.ex | starcoder |
defmodule Phoenix.Component do
@moduledoc """
API for function components.
A function component is any function that receives
an assigns map as argument and returns a rendered
struct built with the `~H` sigil.
Here is an example:
defmodule MyComponent do
use Phoenix.Component
# Opt... | lib/phoenix_component.ex | 0.875747 | 0.544378 | phoenix_component.ex | starcoder |
defmodule Model.Route do
@moduledoc """
Route represents a line in the transit system.
"""
use Recordable, [
:id,
:agency_id,
:short_name,
:long_name,
:description,
:fare_class,
:type,
:color,
:text_color,
:sort_order,
:line_id,
:listed_route,
direction_names... | apps/model/lib/model/route.ex | 0.943996 | 0.643574 | route.ex | starcoder |
defmodule Exfmt.Comment do
@moduledoc """
We leverage `Code.string_to_quoted/2` to get the AST from
Elixir source code. This is great as it's maintained by
the core team (i.e. not me). This is not great as it doesn't
preserve comments, so we need to extract them ourselves and
then merge them into the AST la... | lib/exfmt/comment.ex | 0.535827 | 0.459864 | comment.ex | starcoder |
defmodule MonEx do
@moduledoc ~S"""
MonEx implements two most common monadic data types:
* `MonEx.Result` - container for a result of operation or error.
Result can be created using a constructor macro: `ok(value)` or `error(e)`,
where underlying structure is a tuple: `{:ok, value}` or `{:error, e}... | lib/monex.ex | 0.95183 | 0.796688 | monex.ex | starcoder |
defmodule Spell.Message do
@moduledoc """
The `Spell.Message` module defines the struct and functions to
back WAMP messages.
Note that these are distinct from Erlixir's messages.
"""
# Module Attributes
defstruct [:type, :code, :args]
@basic_codes [hello: 1,
welcome: 2,
... | lib/spell/message.ex | 0.623377 | 0.440409 | message.ex | starcoder |
defmodule Cldr.DateAndTime.Backend do
@moduledoc false
def define_backend_modules(config) do
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [config: config, backend: backend] do
defmodule DateTime do
@doc """
Formats a DateTime accordin... | lib/cldr/backend/date_time.ex | 0.919845 | 0.606994 | date_time.ex | starcoder |
defmodule ClusterGCE.Strategy.Labels do
@moduledoc """
Clustering strategy for Google Compute Engine.
This strategy checks for the list of app versions that are currently receiving HTTP.
For each version that is listed, the list of instances running for that version are fetched.
Once all of the instances hav... | lib/cluster_gce/strategy/labels.ex | 0.875068 | 0.854703 | labels.ex | starcoder |
defmodule Plug.Conn.Cookies do
@moduledoc """
Conveniences for encoding and decoding cookies.
"""
@doc """
Decodes the given cookies as given in either a request or response header.
If a cookie is invalid, it is automatically discarded from the result.
## Examples
iex> decode("key1=value1;key2=v... | lib/plug/conn/cookies.ex | 0.720663 | 0.415462 | cookies.ex | starcoder |
defmodule ICalex.Components.Component do
@moduledoc false
alias ICalex.Props.{Factory, Parameters, VText}
alias ICalex.Parsers.{ContentLines, ContentLine}
@enforce_keys [:name]
defstruct name: nil,
properties: %{},
components: [],
required: [],
singletons: [],
... | lib/components/component.ex | 0.569134 | 0.418935 | component.ex | starcoder |
defmodule Exfile.ProcessorChain do
@moduledoc """
A module to run a chain of processors on a file.
"""
alias Exfile.{LocalFile, ProcessorRegistry}
@type uploadable :: %Exfile.File{} | %Exfile.LocalFile{}
@type name :: String.t
@type args :: [String.t, ...]
@type opts :: [key: any]
@type definition ... | lib/exfile/processor_chain.ex | 0.765856 | 0.429728 | processor_chain.ex | starcoder |
defmodule ToxiproxyEx do
alias ToxiproxyEx.{Proxy, Client, Toxic, ToxicCollection, ServerError}
@external_resource "README.md"
@moduledoc "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
@typedoc """
A proxy that intercepts traffic to and... | lib/toxiproxy_ex.ex | 0.847795 | 0.409103 | toxiproxy_ex.ex | starcoder |
defmodule LoggerJSON.FormatterUtils do
@moduledoc """
This module contains functions that can be used across different
`LoggerJSON.Formatter` implementations to provide common functionality.
"""
import Jason.Helpers, only: [json_map: 1]
@doc """
Format an exception for use within a log entry
"""
def... | lib/logger_json/formatter_utils.ex | 0.784526 | 0.412796 | formatter_utils.ex | starcoder |
defmodule Bolt.Sips.Internals.BoltProtocol do
@moduledoc false
# A library that handles Bolt Protocol (v1 and v2).
# Note that for now, only Neo4j implements Bolt v2.
# It handles all the protocol specific steps (i.e.
# handshake, init) as well as sending and receiving messages and wrapping
# them in chunk... | lib/bolt_sips/internals/bolt_protocol.ex | 0.677154 | 0.532547 | bolt_protocol.ex | starcoder |
defmodule Notifications.ExceptionInfo do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
class: String.t(),
title: String.t(),
msg: String.t(),
backtrace: [String.t()]
}
defstruct [:class, :title, :msg, :backtrace]
field :class, 1, type:... | components/notifications-service/server/lib/pb/notifications.pb.ex | 0.749821 | 0.497498 | notifications.pb.ex | starcoder |
defmodule TrademarkFreeStrategicLandWarfare.Players.Sam do
alias TrademarkFreeStrategicLandWarfare.{Board, Player, Piece}
@behaviour Player
@type direction() :: :north | :west | :east | :south
@type count() :: Integer.t()
@type state() :: any()
@spec name() :: binary()
def name() do
"<NAME>"
end
... | lib/trademark_free_strategic_land_warfare/players/sam.ex | 0.520253 | 0.511595 | sam.ex | starcoder |
defmodule Feedback.Message do
@moduledoc """
Information for a customer support message.
"""
# The integration with HEAT only accepts certain values for the message type
# and subject. Only "Complaint", "Suggestion", "Inquiry" and "Commendation"
# are supported service options, and each has a list of allow... | apps/feedback/lib/message.ex | 0.762778 | 0.401306 | message.ex | starcoder |
defmodule FCSupport.Normalization do
def to_utc_iso8601(datetime) do
datetime
|> Timex.Timezone.convert("UTC")
|> DateTime.to_iso8601()
end
def from_utc_iso8601(nil), do: nil
def from_utc_iso8601(iso8601) do
Timex.parse!(iso8601, "{ISO:Extended}")
end
def normalize_by(map, root_key, key, ... | base/fc_support/lib/fc_support/normalization.ex | 0.700383 | 0.484075 | normalization.ex | starcoder |
defmodule Openflow.Action.NxRegMove do
@moduledoc """
Copies src[src_ofs:src_ofs+n_bits] to dst[dst_ofs:dst_ofs+n_bits], where
a[b:c] denotes the bits within 'a' numbered 'b' through 'c' (not including
bit 'c'). Bit numbering starts at 0 for the least-significant bit, 1 for
the next most significant bit, and... | lib/openflow/actions/nx_reg_move.ex | 0.873417 | 0.884788 | nx_reg_move.ex | starcoder |
defmodule BtrzAuth.Plug.VerifyProviders do
@moduledoc """
Looks for and validates if there are `provider_ids` in the query params and if they are valids with the account data under `conn.private.account`
saved by `BtrzAuth.Plug.VerifyApiKey` (the order of the plugs is very important!)
This plug will look for ... | lib/plug/verify_providers.ex | 0.838812 | 0.837952 | verify_providers.ex | starcoder |
defmodule Kalevala.Character.View do
@moduledoc """
Render output from the game
"""
defmacro __using__(_opts) do
quote do
import Kalevala.Character.View.Macro
alias Kalevala.Character.View
end
end
@doc """
"Join" an IO data list with a separator string
Similar to Enum.join, but l... | lib/kalevala/character/view.ex | 0.796292 | 0.532 | view.ex | starcoder |
defmodule Styx.SchemaRegistry.Definition.Schema do
alias Styx.SchemaRegistry.Definition.Schema, as: SchemaDef
@moduledoc """
Implements macros to generate an avro schema
Available macros:
* schema/2
* set_namespace/1
* attribute_accessors/0
* register/0
## Use:
```
use Styx.S... | lib/styx/schema_registry/definition/schema.ex | 0.697094 | 0.563858 | schema.ex | starcoder |
defmodule LevelWeb.Schema.Enums do
@moduledoc false
use Absinthe.Schema.Notation
enum :user_state do
value :active, as: "ACTIVE"
value :disabled, as: "DISABLED"
end
enum :space_user_state do
value :active, as: "ACTIVE"
value :disabled, as: "DISABLED"
end
enum :space_user_role do
va... | lib/level_web/schema/enums.ex | 0.599251 | 0.444444 | enums.ex | starcoder |
defmodule Day12.Part2 do
@doc """
iex> Day12.Part2.part2("day12-sample.txt")
286
"""
def part2(filename) do
parse_input(filename)
|> Enum.reduce({0, 0, 10, -1}, &move_from/2)
|> distance_to({0, 0})
end
@doc """
iex> Day12.Part2.part2
28885
"""
def part2, do: part2("day... | lib/day12/part2.ex | 0.529993 | 0.434821 | part2.ex | starcoder |
alias Treex.Tree
defmodule Treex.Traverse do
@moduledoc """
Basic tree traversal algorithms, implementing depth-first and breadth-first traversal.
"""
@moduledoc since: "0.1.0"
@type traverse:: :dfs | :bfs
@type tree:: Tree.t
@type history:: [any]
@type result:: {:continue, any} | {:stop, any}
@type... | lib/treex/traverse.ex | 0.924381 | 0.61086 | traverse.ex | starcoder |
defmodule FarmbotOS.SysCalls.Movement do
@moduledoc false
require FarmbotOS.Logger
alias FarmbotOS.Firmware.Command
alias FarmbotOS.BotState
def get_current_x do
get_position(:x)
end
def get_current_y do
get_position(:y)
end
def get_current_z do
get_position(:z)
end
def get_cached... | lib/os/sys_calls/movement.ex | 0.646906 | 0.494934 | movement.ex | starcoder |
defmodule ExtrText do
@moduledoc """
ExtrText is an Elixir library for extracting text and meta information from `.docx`, `.xlsx`,
`.pptx` files.
"""
@doc """
Extracts properties (metadata) from the specified OOXML data.
"""
@spec get_metadata(binary()) :: {:ok, ExtrText.Metadata.t()} | {:error, String... | lib/extr_text.ex | 0.787237 | 0.41185 | extr_text.ex | starcoder |
defmodule TypeCheck.Type.StreamData do
@moduledoc """
Transforms types into StreamData generators.
With the exception of `wrap_with_gen/2`,
methods in this module are
only compiled when the optional dependency
`:stream_data` is added to your project's dependencies.
"""
defstruct [:type, :generator_fun... | lib/type_check/type/stream_data.ex | 0.79166 | 0.501709 | stream_data.ex | starcoder |
defmodule PTA.Parser do
@moduledoc """
TODO
"""
# Partition `tokens` at the first token for which `pred` evaluates to true.
# If `inclusive` is true, the token that matched `pred` will be included in the second returned partition.
def _eat(tokens, pred \\ fn p -> p == "\n" end, inclusive \\ false) do
c... | lib/pta/parser.ex | 0.606382 | 0.55911 | parser.ex | starcoder |
defmodule Roman.Validators.Sequence do
@moduledoc false
@type sequence :: [Roman.Decoder.decoded_numeral()]
@doc """
Validates that the sequence of decoded numerals.
Runs all other validators defined in this module, returning the given
sequence or `{:error, reason}` on validation failure.
"""
@spec v... | lib/roman/validators/sequence.ex | 0.859339 | 0.573111 | sequence.ex | starcoder |
defmodule Survey.Handler do
@moduledoc """
Handles HTTP requests.
"""
@pages_path Path.expand("pages", File.cwd!)
import Survey.Plugins, only: [rewrite_path: 1, log: 1, track: 1]
import Survey.Parser, only: [parse: 1]
import Survey.FileHandler, only: [handle_file: 2]
import Survey.View, only: [render:... | survey/lib/survey/handler.ex | 0.725551 | 0.457682 | handler.ex | starcoder |
defmodule Abbr.Mnesia.Local do
@moduledoc """
Access to underlying Mnesia stored data.
"""
alias Abbr.Mnesia.Url, as: Table
alias Abbr.Url
alias Memento.Query
require Logger
@behaviour Abbr.Cache
@doc """
Retrieves stored shortened URL.
There are a few way to do this.
The usual would be to ... | lib/abbr/mnesia/local.ex | 0.807195 | 0.90053 | local.ex | starcoder |
defmodule Urn do
@moduledoc """
Documentation for Urn.
## Examples
### parse
iex> Urn.parse("urn:mycoll:143")
%Urn.Schema{collection: "mycoll", identifier: "143", namespace: "urn"}
### verify
iex> Urn.verify("urn:mycoll:143", "urn:mycoll:143")
true
### verify_namespace
i... | lib/urn.ex | 0.754734 | 0.642489 | urn.ex | starcoder |
defmodule Jsox.Encoder.Helper do
@moduledoc """
A helper module for the encoding.
"""
import Jsox.Encoder
use Bitwise
@compile {:inline, unicode: 1, _map: 1, _map_item: 1, _collection: 1,
_collection_item: 1}
@escape_map %{
?\\ => '\\\\',
?\" => '\\"',
?\n => '\\n',
?\r => '\\r',
... | lib/jsox/encoder/helper.ex | 0.58948 | 0.430506 | helper.ex | starcoder |
defmodule Zipper do
alias Zipper, as: Z
alias BinTree, as: BT
defstruct [:focus, :path]
@doc """
Get a zipper focused on the root node.
"""
@spec from_tree(BinTree.t()) :: Zipper.t()
def from_tree(bin_tree), do: %Z{focus: bin_tree, path: []}
@doc """
Get the complete tree from a zipper.
"""
@s... | elixir/zipper/lib/zipper.ex | 0.862134 | 0.6219 | zipper.ex | starcoder |
defmodule Kinesis.Buffer.Memory do
@behaviour Kinesis.Buffer
defstruct impl: :queue.new(), size: 0, count: 0
@impl Kinesis.Buffer
def new(size) when size > 0 do
%__MODULE__{
impl: :queue.new(),
size: size,
count: 0
}
end
@impl Kinesis.Buffer
def new(input, size) when size > 0 ... | lib/kinesis/buffer/memory.ex | 0.713132 | 0.584153 | memory.ex | starcoder |
defmodule TimeZoneInfo.DataPersistence.Priv do
@moduledoc """
An implementation for the behaviour `TimeZoneInfo.DataPersistence` to persist
data in the `priv` dir.
"""
@behaviour TimeZoneInfo.DataPersistence
alias File.Stat
alias TimeZoneInfo.ExternalTermFormat
@impl true
def put(data) do
with ... | lib/time_zone_info/data_persistence/priv.ex | 0.835986 | 0.474449 | priv.ex | starcoder |
defmodule Ash.Dsl.Transformer do
@moduledoc """
A transformer manipulates and/or validates the entire DSL state of a resource.
It's `transform/2` takes a `map`, which is just the values/configurations at each point
of the DSL. Don't manipulate it directly, if possible, instead use functions like
`get_entitie... | lib/ash/dsl/transformer.ex | 0.786991 | 0.627566 | transformer.ex | starcoder |
defmodule PhoenixDSK3LO.Lms do
# Puropse: Abstraction, Repo-like methods for accessing Blackboard Learn
# Instead of a database, we have the Blackboard Learn LMS.
@doc """
Get all the dataSources as a list of Learn.DSK structs
This behavior is analogous to a Repo.
2017.04.18 - Can't generalize here becaus... | lib/phoenixDSK/lms.ex | 0.576423 | 0.536495 | lms.ex | starcoder |
defmodule Donatebox.Donations do
@moduledoc """
The Donations context.
"""
import Ecto.Query, warn: false
alias Donatebox.Repo
alias Donatebox.History
alias Donatebox.Management
alias Donatebox.Management.Admin
import Plug.Conn
alias Donatebox.Donations.Pendingdonation
@doc """
Returns the... | lib/donatebox/donations/donations.ex | 0.724481 | 0.425516 | donations.ex | starcoder |
defmodule Stripe.Subscriptions do
@moduledoc """
Main API for working with Subscriptions at Stripe. Through this API you can:
- create
- change
- retrieve
- cancel
- cancel_all
- list all
- count all
Supports Connect workflow by allowing to pass in any API key explicitely (vs using the one from env... | lib/stripe/subscriptions.ex | 0.82176 | 0.590779 | subscriptions.ex | starcoder |
defmodule Tirexs.HTTP do
@standard_http_adapter Tirexs.HTTP.Standard
@moduledoc """
A set of functions for working over HTTP.
This bare-bone module provides all you need for getting things done over elasticsearch REST API.
The functions designed to be handful for various possible use cases.
A set of requ... | lib/tirexs/http.ex | 0.718199 | 0.434881 | http.ex | starcoder |
defmodule CSSEx.Helpers.AtParser do
@moduledoc false
import CSSEx.Helpers.Shared, only: [inc_col: 1]
import CSSEx.Helpers.Error, only: [error_msg: 1]
import CSSEx.Parser, only: [add_error: 2]
@line_terminators CSSEx.Helpers.LineTerminators.code_points()
@var_replacement_split ~r/(?<maybe_var_1>\$::)?.+(?<... | lib/helpers/at_parser.ex | 0.565659 | 0.504089 | at_parser.ex | starcoder |
defmodule Ash.Query.Operator.In do
@moduledoc """
left in [1, 2, 3]
this predicate matches if the left is in the list on the right
For comparison, this simplifies to a set of "or equals", e.g
`{:or, {:or, {:or, left == 1}, left == 2}, left == 3}`
"""
use Ash.Query.Operator,
operator: :in,
predic... | lib/ash/query/operator/in.ex | 0.831074 | 0.713931 | in.ex | starcoder |
use Croma
defmodule RaftKV.Config do
@default_stats_collection_interval (if Mix.env() == :test, do: 2_000, else: 60_000)
@default_workflow_execution_interval (if Mix.env() == :test, do: 2_000, else: 60_000)
@default_workflow_lock_period (if Mix.env() ==... | lib/raft_kv/config.ex | 0.768038 | 0.540985 | config.ex | starcoder |
defmodule Sanbase.Model.Project.ListSelector do
import Sanbase.DateTimeUtils
alias Sanbase.Model.Project
@doc ~s"""
Return a list of projects described by the selector object.
See `args_to_opts/1` for description of the argument format.
"""
def projects(args) do
opts = args_to_opts(args)
{:ok,... | lib/sanbase/model/project/list/list_selector.ex | 0.793826 | 0.442396 | list_selector.ex | starcoder |
defmodule Oli.Delivery.Gating.ConditionTypes.Schedule do
@moduledoc """
Schedule strategy provides a temporal based gating condition. A schedule condition
can define a start and/or end datetime for a resource to be available.
"""
alias Oli.Delivery.Gating.GatingCondition
alias Oli.Delivery.Gating.GatingCond... | lib/oli/delivery/gating/condition_types/schedule.ex | 0.737253 | 0.434161 | schedule.ex | starcoder |
defmodule Kino.Ecto do
@moduledoc """
A widget for interactively viewing `Ecto` query results.
The data must be an enumerable of records, where each
record is either map, struct, keyword list or tuple.
## Examples
The widget primarily allows for viewing a database table
given a schema:
Kino.Ecto... | lib/kino/ecto.ex | 0.906203 | 0.626481 | ecto.ex | starcoder |
# simple functions to load a file, following the hashing rules
defmodule Scenic.Cache.Term do
alias Scenic.Cache
alias Scenic.Cache.Hash
# import IEx
# --------------------------------------------------------
def load(path, hash, opts \\ [])
# insecure loading. Loads file blindly even it is altered
... | lib/scenic/cache/term.ex | 0.576304 | 0.514522 | term.ex | starcoder |
defmodule Mix.Tasks.Gen.Client do
@moduledoc """
Generates a new client for an endpoint based on a given endpoint name.
## Example
```
$ mix client_generator expenses
```
"""
use Mix.Task
def run, do: usage
def run([endpoint | [singular_endpoint | _]]) do
endpoint = String.downcase(endp... | lib/mix/tasks/client_generator.ex | 0.864525 | 0.529689 | client_generator.ex | starcoder |
defmodule Nx.Defn.Expr do
@doc """
The expression used by `Nx.Defn.Compiler`.
`Nx.Defn.Compiler` changes `Nx` default backend from `Nx.BinaryBackend`
to `Nx.Defn.Expr`. It is a struct with the following fields:
* `:id` - a unique identifier
* `:op` - the operation name
* `:args` - the operation ar... | lib/nx/defn/expr.ex | 0.755637 | 0.871092 | expr.ex | starcoder |
defmodule ExUnit.FailuresManifest do
@moduledoc false
@type test_id :: {module, name :: atom}
@opaque t :: %{test_id => test_file :: Path.t()}
@manifest_vsn 1
@spec new() :: t
def new, do: %{}
@spec files_with_failures(t) :: MapSet.t(Path.t())
def files_with_failures(%{} = manifest) do
manifest
... | lib/ex_unit/lib/ex_unit/failures_manifest.ex | 0.682785 | 0.414188 | failures_manifest.ex | starcoder |
defmodule Sanbase.Clickhouse.Label do
@moduledoc """
Labeling addresses
"""
import Sanbase.Utils.Transform, only: [maybe_apply_function: 2]
import Sanbase.Metric.SqlQuery.Helper,
only: [label_id_by_label_fqn_filter: 2, label_id_by_label_key_filter: 2]
@type label :: %{
name: String.t(),
... | lib/sanbase/clickhouse/label/label.ex | 0.724968 | 0.410284 | label.ex | starcoder |
defmodule ExTwilio.Account do
@moduledoc """
Represents an Account or Subaccount resource.
- [Account docs](https://www.twilio.com/docs/iam/api/account)
- [Subaccount docs](https://www.twilio.com/docs/api/rest/subaccounts)
## Examples
An ExTwilio.Account can represent either an Account or a SubAccount. T... | lib/ex_twilio/resources/account.ex | 0.832203 | 0.490236 | account.ex | starcoder |
defmodule AWS.Elasticsearch do
@moduledoc """
Amazon Elasticsearch Configuration Service
Use the Amazon Elasticsearch Configuration API to create, configure, and manage
Elasticsearch domains.
For sample code that uses the Configuration API, see the [Amazon Elasticsearch Service Developer
Guide](https://d... | lib/aws/generated/elasticsearch.ex | 0.814459 | 0.404184 | elasticsearch.ex | starcoder |
defmodule Readtome.Creators do
@moduledoc """
The Creators context.
"""
import Ecto.Query, warn: false
alias Readtome.Repo
alias Readtome.Creators.{Creator, UserInterestCreator}
@doc """
Returns the list of creators.
## Examples
iex> list_creators()
[%Creator{}, ...]
"""
def list... | lib/readtome/creators/creators.ex | 0.812161 | 0.506103 | creators.ex | starcoder |
defmodule Genotype do
@moduledoc """
This module provides methods for constructing a Genotype for a neural network.
The Genotype is a datastructure which provides all of the information needed
to construct the network.
"""
alias Genotype.Id, as: Id
alias Genotype.Cortex, as: Cortex
alias Genotype.Neuro... | lib/genotype/genotype.ex | 0.8398 | 0.536313 | genotype.ex | starcoder |
defmodule Snitch.Domain.Payment do
@moduledoc """
Helper functions and utlities for handling payments.
"""
use Snitch.Domain
alias Snitch.Data.Model.HostedPayment
alias SnitchPayments.PaymentMethodCode
alias Snitch.Data.Schema.{Order, PaymentMethod, Payment}
@hosted_payment PaymentMethodCode.hosted_p... | apps/snitch_core/lib/core/domain/payment/payment.ex | 0.766905 | 0.456713 | payment.ex | starcoder |
defmodule CSV do
use CSV.Defaults
alias CSV.Decoding.Preprocessing
alias CSV.Decoding.Decoder
alias CSV.Encoding.Encoder
alias CSV.EscapeSequenceError
alias CSV.StrayQuoteError
@moduledoc ~S"""
RFC 4180 compliant CSV parsing and encoding for Elixir. Allows to specify
other separators, so it could al... | lib/csv.ex | 0.938124 | 0.437403 | csv.ex | starcoder |
defmodule CTE.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
You may define functions here to be used as helpers in
your tests.
Finally, if the test case interacts with the database,
it cannot be async. For this reason, every test run... | test/support/data_case.ex | 0.668447 | 0.461866 | data_case.ex | starcoder |
defmodule JSON.Parser.Bitstring.Object do
@doc """
parses a valid JSON object value, returns its elixir representation
## Examples
iex> JSON.Parser.Bitstring.Object.parse ""
{:error, :unexpected_end_of_buffer}
iex> JSON.Parser.Bitstring.Object.parse "face0ff"
{:error, {:unexpected_token... | elixir/codes-from-books/little-elixir/cap4/metex/deps/json/lib/json/parser/bitstring/object.ex | 0.726717 | 0.413803 | object.ex | starcoder |
defmodule Etop.Monitor do
@moduledoc """
Etop Monitors.
Add `:summary` or `:process` monitors to Etop. These monitors are checked on
each run. If the threshould condition is met, the monitor's callback if called.
Monitors are added with either the `Etop.monitor/4` or `Etop.add_monitor/4` calls.
"""
requ... | lib/etop/monitor.ex | 0.699973 | 0.544922 | monitor.ex | starcoder |
defmodule Linguist.Vocabulary do
alias Linguist.Compiler
@moduledoc """
Defines lookup functions for given translation locales, binding interopolation
Locales are defined with the `locale/2` macro, accepting a locale name and
either keyword list of translations or String path to evaluate for
translations ... | lib/linguist/vocabulary.ex | 0.841256 | 0.553928 | vocabulary.ex | starcoder |
defmodule Ada.Schema.ScheduledTask do
@moduledoc """
Represents a boilerplate for the recurring execution of a workflow.
Captures the workflow to run, its frequency and params.
See `t:t/0` for more details.
"""
use Ecto.Schema
alias Ada.{Schema.Frequency, Workflow}
@task_version 1
schema "schedul... | lib/ada/schema/scheduled_task.ex | 0.917635 | 0.572812 | scheduled_task.ex | starcoder |
defmodule Stripe.Plan do
@moduledoc """
Work with Stripe plan objects.
You can:
- Create a plan
- Retrieve a plan
- Update a plan
- Delete a plan
Does not yet render lists or take options.
Stripe API reference: https://stripe.com/docs/api#plan
Example:
```
{
"id": "ivory-extended-580",... | lib/stripe/subscriptions/plan.ex | 0.851506 | 0.654215 | plan.ex | starcoder |
defmodule OT.Server.Adapter do
@moduledoc """
An adapter behaviour for interacting with peristed data in an operational
transformation system.
"""
alias OT.Server
@doc """
Call a function inside of a transaction.
This is useful for adapters that use databases that support transactions. All
of the o... | lib/ot/server/adapter.ex | 0.849129 | 0.566588 | adapter.ex | starcoder |
defmodule Chatter do
@moduledoc """
Functions and data for numerically approximating 'chatter'.
'Chatter' is when an infinite sequence of impacts accumulates in a finite time on a 'sticking' impact. It is
the analogue in this system to a real-world situation in which the mass judders against the stop. To handl... | apps/imposc/lib/dynamics/chatter.ex | 0.91266 | 0.805479 | chatter.ex | starcoder |
defmodule Appsignal.Tracer do
alias Appsignal.Span
@monitor Application.get_env(:appsignal, :appsignal_monitor, Appsignal.Monitor)
@table :"$appsignal_registry"
@type option :: {:pid, pid} | {:start_time, integer}
@type options :: [option]
@doc false
def start_link do
Agent.start_link(fn -> :ets.ne... | lib/appsignal/tracer.ex | 0.82741 | 0.544559 | tracer.ex | starcoder |
defmodule Day07 do
@moduledoc "Day 7: Recursive Circus"
def part1(input) do
input
|> Enum.map(&String.split/1)
|> Enum.map(&parse_line/1)
|> Enum.reduce({[], []},
fn {program, _, sub}, {progs, subs} ->
{[program | progs], subs ++ sub}
end)
|> (fn {progs, subs} -> progs -- su... | apps/day07/lib/day07.ex | 0.592313 | 0.464719 | day07.ex | starcoder |
defmodule Intcode do
use GenServer
def run_computer(name, inputs \\ [], timeout \\ 5000) do
case GenServer.call(name, {:run, inputs}, timeout) do
{:output, _code} -> run_computer(name, [], timeout)
{:exit, code} -> code
end
end
@empty_state %{
program: [],
position: 0,
inputs: ... | lib/intcode/intcode.ex | 0.50293 | 0.443299 | intcode.ex | starcoder |
defmodule BitPal.Crypto.Base58 do
@moduledoc """
This module implements the Base58 scheme used in various places in Bitcoin and Bitcoin Cash for
example. Note that there are multiple versions of the Base58 encoding. This module implements the
encoding specific for Bitcoin (and used in other places). The differe... | lib/bitpal/crypto/base58.ex | 0.791539 | 0.571916 | base58.ex | starcoder |
defmodule StepFlow.Step.Launch do
@moduledoc """
The Step launcher context.
"""
require Logger
alias StepFlow.Amqp.CommonEmitter
alias StepFlow.Jobs
alias StepFlow.Notifications.Notification
alias StepFlow.Step.Helpers
alias StepFlow.Step.LaunchParams
alias StepFlow.Workflows
def launch_step(wor... | lib/step_flow/step/launch.ex | 0.607197 | 0.44342 | launch.ex | starcoder |
defmodule Annex.Data.List2D do
@moduledoc """
List2D is a 2 dimensional list of lists of floats.
"""
use Annex.Data
require Annex.Data.List1D
alias Annex.{
AnnexError,
Data.List1D
}
@type t :: [[float(), ...], ...]
@doc """
Given flat `data` and a valid 2-D `shape` (in the form of `{rows... | lib/annex/data/list_2d.ex | 0.865196 | 0.813164 | list_2d.ex | starcoder |
defmodule AstroEx.Unit.HMS do
@moduledoc """
Hours:Minutes:Seconds
"""
alias AstroEx.Unit.{Arcmin, Arcsec, Degrees, DMS, Radian}
alias AstroEx.Utils.Math
@enforce_keys [:value]
defstruct [:value]
@typep hours :: 12..23
@typep minutes :: 0..59
@typep seconds :: number()
@typep hms :: {hours(), m... | lib/astro_ex/unit/hms.ex | 0.782912 | 0.432663 | hms.ex | starcoder |
defmodule WaoBirthday.Birthday do
use Memento.Table, attributes: [:uid, :day, :month, :by_owner]
alias Memento.Query
alias Alchemy.Embed
require Embed
def read_birthday(id) do
result = Memento.transaction fn ->
Query.read __MODULE__, id
end
case result do
{:ok, nil} -> {:error, :no... | lib/wao_birthday/birthday.ex | 0.513425 | 0.424949 | birthday.ex | starcoder |
defmodule Composer.DSL do
@moduledoc """
Provies methods to generate custom AST from JSON DSL.
The DSL is made of expressions and each expression has a type, arguments
Example: `{ "type": "string", "arguments": [ "factor18" ]}`
Currently the following expressions are allowed:
type `null` accepts no argu... | apps/composer/lib/dsl.ex | 0.903443 | 0.935524 | dsl.ex | starcoder |
defmodule DataDaemon.Plug do
@moduledoc false
@doc false
@spec safe_in(any, [atom | String.t()]) :: any
def safe_in(data, []), do: data
def safe_in(data, [field | fields]), do: safe_in(Map.get(data, field), fields)
@doc false
@spec enable :: term
def enable do
quote location: :keep do
@behav... | lib/data_daemon/plug.ex | 0.80271 | 0.448064 | plug.ex | starcoder |
defmodule Rolodex.Schema do
@moduledoc """
Exposes functions and macros for working with request and response parameters.
It includes two macros. Used together, they will setup reuseable schemas
for things like API responses.
- `schema/3` - for declaring a schema
- `field/3` - for declaring schema fields
... | lib/rolodex/schema.ex | 0.879613 | 0.67555 | schema.ex | starcoder |
defmodule Optimal.SchemaHelpers do
@moduledoc """
Helpers for building and working with schemas.
"""
@doc """
The schema of the opts for making an Optimal schema.
"""
@spec schema_schema() :: Optimal.Schema.t()
def schema_schema() do
%Optimal.Schema{
opts: [
:opts,
:required,
... | lib/optimal/schema_helpers.ex | 0.832237 | 0.409457 | schema_helpers.ex | starcoder |
defmodule Toby.App.Views.System do
@moduledoc """
A component that displays summarized information about the Erlang VM.
"""
import Ratatouille.View
import Toby.Util.Formatting
def render(%{
data: %{
cpu: cpu,
limits: limits,
memory: memory,
statistics: stati... | lib/toby/app/views/system.ex | 0.62498 | 0.405213 | system.ex | starcoder |
defmodule Canvas.Resources.EnrollmentTerms do
@moduledoc """
Provides functions to interact with the
[enrollment term endpoints](https://canvas.instructure.com/doc/api/enrollment_terms).
"""
alias Canvas.{Client, Listing, Response}
alias Canvas.Resources.EnrollmentTerm
def create_enrollment_term() do
... | lib/canvas/resources/enrollment_terms.ex | 0.821152 | 0.489564 | enrollment_terms.ex | starcoder |
defmodule Searchex.Command do
@moduledoc """
Main Searchex workflow
results <- query <- index <- catalog <- params
This workflow establishes a dependency chain, with higher level steps
depending on the outputs of lower level steps. Each step generates an
intermediate output which can be cached to min... | lib/searchex/command.ex | 0.835484 | 0.579043 | command.ex | starcoder |
defmodule SunTimes do
@moduledoc """
Documentation for SunTimes.
"""
@default_zenith 90.83333
@degrees_per_hour 360.0 / 24.0
@doc """
Calculates the sunrise.
"""
def rise(date, lat, lon) do
calculate(:rise, date, lat, lon)
end
@doc """
Calculates the sunset.
"""
def set(date, lat, lon)... | lib/sun_times.ex | 0.79999 | 0.469885 | sun_times.ex | starcoder |
defmodule Membrane.RTC.Engine.Track do
@moduledoc """
Module representing media track.
Media track is a single audio or video. Tracks that are related to each other
(e.g. audio from microphone that corresponds to video from a web cam) can be grouped into the same stream by
assigning each of them the same str... | lib/membrane_rtc_engine/track.ex | 0.858363 | 0.460653 | track.ex | starcoder |
defmodule Statux do
@moduledoc """
"""
defdelegate child_spec(opts), to: Statux.Tracker
def load_rule_set!(path), do: Statux.RuleSet.load_json!(path)
def init(init_arg) do
{:ok, init_arg}
end
@doc """
Simply evaluates the given value for the given status based on its value.
This function can b... | lib/statux.ex | 0.809238 | 0.483222 | statux.ex | starcoder |
defmodule Midifile.Event do
use Bitwise
defstruct symbol: :off,
delta_time: 0,
bytes: [] # data bytes, including status byte
def status(%Midifile.Event{bytes: [st|_]}) when st < 0xf0, do: band(st, 0xf0)
def status(%Midifile.Event{bytes: [st|_]}), do: st
def data(%Midifile.Event{by... | lib/midifile/event.ex | 0.714927 | 0.628051 | event.ex | starcoder |
defmodule ExMatchers.Size do
@moduledoc false
import ExUnit.Assertions
import ExMatchers.Custom
defprotocol SizeMatcher do
@fallback_to_any true
def to_match(value)
def to_match(value, size)
def to_not_match(value)
def to_not_match(value, size)
end
defimpl SizeMatcher, for: Map do
... | lib/ex_matchers/size.ex | 0.704872 | 0.859958 | size.ex | starcoder |
defmodule Solace.Prismic.Types.Prismic do
alias Solace.Prismic.Types.Prismic.StructuredText
alias Solace.Prismic.Types.Prismic.Paragraph
alias Solace.Prismic.Types.Prismic.ListItem
alias Solace.Prismic.Types.Prismic.OListItem
alias Solace.Prismic.Types.Prismic.Heading1
alias Solace.Prismic.Types.Prismic.He... | lib/prismic/types/prismic.ex | 0.616012 | 0.555073 | prismic.ex | starcoder |
defmodule Kira2.Task do
require Kira2.TaskDefinition, as: TaskDefinition
require Kira.Util, as: Util
@moduledoc false
defstruct [
:state,
:definition,
:awaiting,
:blocking,
:awaiting_unapply,
:blocking_unapply
]
@type errors :: [{any, DateTime.t()}]
@type state() ::
:n... | lib/kira_2/task.ex | 0.730482 | 0.427427 | task.ex | starcoder |
defmodule Namex.Tokenize do
@moduledoc """
States
"""
alias Namex.Tokenize, as: State
defstruct commas: 0, words: 0, initials: 0, suffices: 0, stack: [], string: ''
@comma ~r/^\s*,\s*/
@stops ",;"
@seperator ~r/^\s*(\band\b|\&|;)\s*/i
@title ~r/^\s*\b(sir|lord|count(ess)?|(gen|adm|col|maj|capt|cmdr... | lib/namex/tokenize.ex | 0.516108 | 0.522507 | tokenize.ex | starcoder |
defmodule Telnyx.MessagingPhoneNumbers do
@moduledoc """
Context for managing messaging phone numbers
"""
alias Telnyx.Client
@doc """
Lists all messaging phone numbers.
```
api_key = "YOUR_API_KEY"
Telnyx.MessagingPhoneNumbers.list(api_key, page: %{size: 10})
```
Example response:
```... | lib/telnyx/messaging_phone_numbers.ex | 0.673729 | 0.52409 | messaging_phone_numbers.ex | starcoder |
defmodule ExHal.Transcoder do
@moduledoc """
Helps to build transcoders for HAL documents.
Given a document like
```json
{
"name": "<NAME>",
"mailingAddress": "123 Main St",
"_links": {
"app:department": { "href": "http://example.com/dept/42" },
"app:manager": { "href": "http://ex... | lib/exhal/transcoder.ex | 0.899463 | 0.704461 | transcoder.ex | starcoder |
defmodule ExAlgebra.Matrix do
@moduledoc """
The Exalgebra Matrix module is a collection of functions that perform computations
on matrices. Matrices are represented by lists of lists of numbers, where the inner lists
represent the rows of the matrix.
"""
import :math, only: [pow: 2]
alias ExAlgebra.Vect... | lib/Matrix/matrix.ex | 0.945368 | 0.9255 | matrix.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.