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 Raygun.Util do
@moduledoc """
This module contains utility functions for formatting particular pieces
of stacktrace data into strings.
"""
@default_environment_name Mix.env()
@doc """
Determines whether we will actually send an event to Raygun
"""
def environment? do
environment_name()... | lib/raygun/util.ex | 0.768777 | 0.473596 | util.ex | starcoder |
defmodule Polyglot.Plural.Parser do
# Parse a string into {tree, deps}
def parse("") do
{true, HashSet.new}
end
def parse(str) do
{tokens, deps} = tokenise(str, [], HashSet.new)
{parse_tree(tokens, [], []), deps}
end
# Tokenise string, using simple recursive peeking
defp tokenise(str, tokens,... | lib/polyglot/plural/parser.ex | 0.509032 | 0.638863 | parser.ex | starcoder |
defmodule Geocoder.Providers.OpenCageData do
use HTTPoison.Base
use Towel
@endpoint "http://api.opencagedata.com/"
@path "geocode/v1/json"
def geocode(opts) do
request(@path, opts |> extract_opts())
|> fmap(&parse_geocode/1)
end
def geocode_list(opts) do
request_all(@path, opts |> extract_o... | lib/geocoder/providers/open_cage_data.ex | 0.61682 | 0.484258 | open_cage_data.ex | starcoder |
defmodule SignedOverpunch do
@error_message "invalid signed overpunch value: "
@moduledoc """
Module for converting a string in signed overpunch format into the
corresponding integer.
## Conversion Table:
| Code | Digit | Sign |
| ---- | ----- | ---- |
| } | 0 | − |
| J | 1 | − |
| K | 2 | − |
... | lib/signed_overpunch.ex | 0.840701 | 0.585605 | signed_overpunch.ex | starcoder |
defmodule PasswordPhilosophy do
@moduledoc """
For example, suppose you have the following list:
1-3 a: abcde
1-3 b: cdefg
2-9 c: ccccccccc
Each line gives the password policy and then the password. The password policy
indicates the lowest and highest number of times a given letter must appear
for the... | 2-PasswordPhilosophy/lib/password_philosophy.ex | 0.776665 | 0.583945 | password_philosophy.ex | starcoder |
defmodule ABNF do
@moduledoc """
Main module. ABNF parser as described in [RFC4234](https://tools.ietf.org/html/rfc4234)
and [RFC5234](https://tools.ietf.org/html/rfc5234)
Copyright 2015 <NAME> <<EMAIL>>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file ... | lib/ex_abnf.ex | 0.792865 | 0.461745 | ex_abnf.ex | starcoder |
defmodule Indicado.EMA do
@moduledoc """
This is the EMA module used for calculating Exponential Moving Average
"""
@doc """
Calculates EMA for the list. It needs non empty list of numbers and a positive
period argument.
Returns `{:ok, ema_list}` or `{:error, reason}`
## Examples
iex> Indicado... | lib/indicado/ema.ex | 0.904485 | 0.647673 | ema.ex | starcoder |
defmodule NebulexRedisAdapter do
@moduledoc """
Nebulex adapter for Redis.
This adapter is implemented by means of `Redix`, a Redis driver for
Elixir.
This adapter supports multiple connection pools against different Redis
nodes in a cluster. This feature enables resiliency, be able to survive
in case a... | lib/nebulex_redis_adapter.ex | 0.904356 | 0.602822 | nebulex_redis_adapter.ex | starcoder |
defmodule Cldr.Unit.Conversion do
@moduledoc """
Unit conversion functions for the units defined
in `Cldr`.
"""
@enforce_keys [:factor, :offset, :base_unit]
defstruct factor: 1,
offset: 0,
base_unit: nil
@type t :: %{
factor: integer | float | Ratio.t(),
base... | lib/cldr/unit/conversion.ex | 0.94366 | 0.701783 | conversion.ex | starcoder |
defmodule Ferryman.Server do
@moduledoc """
This module provides the Server API to start a JSONRPC 2.0 Server
instance.
## Overview
First, let's define a JSONRPC2 handler, and define the functions we want to be
handled by RPC calls.
defmodule ExampleHandler do
use JSONRPC2.Server.Handler
... | lib/server.ex | 0.807992 | 0.522872 | server.ex | starcoder |
defmodule Calcinator.Authorization do
@moduledoc """
Behaviour for `Calcinator.Resources.t` `authorization_module`
"""
# Types
@typedoc """
The actions that must be handled by `can?/3`, `filter_associations_can/3`, and `filter_can/3`.
"""
@type action :: :create | :delete | :index | :update | :show
... | lib/calcinator/authorization.ex | 0.902026 | 0.687177 | authorization.ex | starcoder |
defmodule Grizzly.ZWave.SmartStart.MetaExtension do
@moduledoc """
Meta Extensions for SmartStart devices for QR codes and node provisioning
list
"""
alias Grizzly.ZWave
alias Grizzly.ZWave.{DeviceClasses, IconType, Security}
alias Grizzly.ZWave.SmartStart.MetaExtension.UUID16
import Bitwise
@advan... | lib/grizzly/zwave/smart_start/meta_extension.ex | 0.87153 | 0.669826 | meta_extension.ex | starcoder |
defmodule Ecto.Model.Queryable do
@moduledoc """
Defines a model as queryable.
In order to create queries in Ecto, you need to pass a queryable
data structure as argument. By using `Ecto.Model.Queryable` in
your model, it imports the `queryable/2` macro.
Assuming you have an entity named `Weather.Entity`,... | lib/ecto/model/queryable.ex | 0.861174 | 0.588357 | queryable.ex | starcoder |
defmodule Owl.ProgressBar do
@moduledoc ~S"""
A live progress bar widget.
## Single bar
Owl.ProgressBar.start(id: :users, label: "Creating users", total: 1000)
Enum.each(1..100, fn _ ->
Process.sleep(10)
Owl.ProgressBar.inc(id: :users)
end)
Owl.LiveScreen.await_render()... | lib/owl/progress_bar.ex | 0.825238 | 0.437042 | progress_bar.ex | starcoder |
defmodule Expression do
@moduledoc """
Documentation for `Expression`, a library to parse and evaluate
[Floip](https://floip.gitbook.io/flow-specification/expressions) compatible expressions
Expression is an expression language which consists of the functions provided
by Excel with a few additions.
Functi... | lib/expression.ex | 0.903575 | 0.973894 | expression.ex | starcoder |
defmodule Aoc2019.Day7 do
@behaviour DaySolution
def solve_part1(), do: get_program() |> get_max_signal()
def solve_part2(), do: get_program() |> get_max_signal_loop()
defp get_program(), do: Utils.load_delim_ints("inputs/input_day7", ",")
def get_max_signal(program),
# Number of permutations = 5! = 12... | lib/aoc2019/day7.ex | 0.581184 | 0.487673 | day7.ex | starcoder |
defmodule Alods.Delivered do
@moduledoc """
This module takes care of starting a DETS store which will hold delivered messages.
"""
import Ex2ms
require Logger
use Alods.DETS, "delivered"
@spec init(String.t) :: {:ok, nil}
def init(name) do
{:ok, _} = super(name)
_pid = clean_store()
t... | lib/alods/delivered.ex | 0.765374 | 0.402304 | delivered.ex | starcoder |
defmodule ExToErl do
@moduledoc """
Utilities to convert Elixir expressions into the corresponding Erlang.
This package is meant to be used as a learning tool or as part of development workflow.
It was written to answer questions like: "What does this Elixir expression compile to?".
It's very useful to explo... | lib/ex_to_erl.ex | 0.741112 | 0.563678 | ex_to_erl.ex | starcoder |
defmodule OkThen.Result.Private do
@moduledoc """
These functions are not part of the public API, and may change without notice.
"""
alias OkThen.Result
@type func_or_value(out) :: (any() -> out) | (() -> out) | out
@type func_or_value(tag, out) :: (tag, any() -> out) | func_or_value(out)
defguard is_t... | lib/ok_then/result/private.ex | 0.7641 | 0.452294 | private.ex | starcoder |
defmodule ExAlgebra.Vector3 do
alias ExAlgebra.Vector, as: Vector
alias ExAlgebra.Matrix, as: Matrix
@moduledoc """
The ExAlgebra Vector3 module is a collection of functions that perform
computations on 3-vectors. 3-vectors are represented by lists with exactly
three elements.
"""
@doc """
Computes ... | lib/Vector/vector3.ex | 0.917654 | 0.870487 | vector3.ex | starcoder |
defmodule Excelion do
@moduledoc """
Excel (xlsx) file reader for Elixir.
The library is [excellent](https://hex.pm/packages/excellent) like interface wrapper of [xlsx\_parser](https://hex.pm/packages/xlsx_parser).
"""
@doc """
The function returns worksheet name list of specifiled .xlsx file. If fail get... | lib/excelion.ex | 0.889807 | 0.876845 | excelion.ex | starcoder |
defmodule Surgex.Parser do
@moduledoc """
Parses, casts and catches errors in the web request input, such as params or JSON API body.
## Usage
In order to use it, you should import the `Surgex.Parser` module, possibly in the `controller`
macro in the `web.ex` file belonging to your Phoenix project, which wi... | lib/surgex/parser/parser.ex | 0.850841 | 0.72645 | parser.ex | starcoder |
defmodule Vapor.Provider.Map do
@moduledoc """
The Map config module provides support for inputting configuration values
from a map struct. This can be useful when integrating with other external
secret stores which provide secret payload as JSON.
Bindings must be specified at a keyword list.
## Example
... | lib/vapor/providers/map.ex | 0.787727 | 0.403508 | map.ex | starcoder |
defmodule TimeZoneInfo.IanaDateTime do
@moduledoc false
# Some functions to handle datetimes in `TimeZoneInfo`.
alias Calendar.ISO
alias TimeZoneInfo.IanaParser
@type time :: {Calendar.hour(), Calendar.minute(), Calendar.second()}
@type t ::
{Calendar.year()}
| {Calendar.year(), Cal... | lib/time_zone_info/iana_datetime.ex | 0.874794 | 0.630059 | iana_datetime.ex | starcoder |
defmodule ExCypher.Statements.Generic.Expression do
@moduledoc """
A module to abstract the AST format into something mode human-readable
"""
alias ExCypher.Statements.Generic.Association
alias ExCypher.Statements.Generic.Variable
defstruct [:type, :env, :args]
def build(%{type: type, args: args, env... | lib/ex_cypher/statements/generic/expression.ex | 0.719778 | 0.451871 | expression.ex | starcoder |
defmodule Credo.Check.Refactor.PerceivedComplexity do
@moduledoc """
Cyclomatic complexity is a software complexity metric closely correlated with
coding errors.
If a function feels like it's gotten too complex, it more often than not also
has a high CC value. So, if anything, this is useful to convince team... | lib/credo/check/refactor/perceived_complexity.ex | 0.831656 | 0.560914 | perceived_complexity.ex | starcoder |
import TypeClass
defclass Witchcraft.Chain do
@moduledoc """
Chain function applications on contained data that may have some additional effect
As a diagram:
%Container<data> --- (data -> %Container<updated_data>) ---> %Container<updated_data>
## Examples
iex> chain([1, 2, 3], fn x -> [x, x] en... | lib/witchcraft/chain.ex | 0.796411 | 0.652318 | chain.ex | starcoder |
defmodule Surface.Components.Form.TimeSelect do
@moduledoc """
Generates select tags for time.
Provides a wrapper for Phoenix.HTML.Form's `time_select/3` function.
All options passed via `opts` will be sent to `time_select/3`,
`value`, `default`, `hour`, `minute`, `second` and `builder`
can be set directl... | lib/surface/components/form/time_select.ex | 0.898365 | 0.792986 | time_select.ex | starcoder |
defmodule AWS.CodeCommit do
@moduledoc """
AWS CodeCommit
This is the *AWS CodeCommit API Reference*. This reference provides
descriptions of the operations and data types for AWS CodeCommit API along
with usage examples.
You can use the AWS CodeCommit API to work with the following objects:
Repositor... | lib/aws/generated/code_commit.ex | 0.86988 | 0.432543 | code_commit.ex | starcoder |
defmodule Day13 do
@spec parse_points(String.t()) :: list
def parse_points(input) do
input
|> String.split("\n", trim: true)
|> Enum.reject(&String.contains?(&1, "fold"))
|> Enum.map(&Grid.string_to_point/1)
end
@spec parse_fold_string(String.t()) :: %{dir: String.t(), value: integer}
def par... | aoc21/lib/day13.ex | 0.788949 | 0.435841 | day13.ex | starcoder |
defmodule Raft.LogEntry do
@moduledoc """
Log entry for Raft implementation.
"""
alias __MODULE__
@enforce_keys [:index, :term]
defstruct(
index: nil,
term: nil,
operation: nil,
requester: nil,
argument: nil
)
@doc """
Return an empty log entry, this is mostly
used for convenien... | apps/lab3/lib/messages.ex | 0.780244 | 0.429071 | messages.ex | starcoder |
defmodule TicTacToe.Negascout do
@moduledoc """
Generic Negascout algorithm
For information on the negascout algorithm please refer to
[wikipedia](https://en.wikipedia.org/wiki/Principal_variation_search). Before
you can use this module you have to implement the `TicTacToe.Negascout.Node`
protocol for your... | lib/tictactoe/negascout.ex | 0.81626 | 0.772874 | negascout.ex | starcoder |
defmodule TelemetryMetricsTelegraf do
@moduledoc """
InfluxDB reporter for `Telemetry.Metrics`.
`TelemetryMetricsTelegraf`:
* uses all except last dot-separated segments of metric name as influxdb measurement name ("foo.bar.duration" -> "foo.bar")
* uses the last name segment or `:field_name` reporter option... | lib/telemetry_metrics_telegraf.ex | 0.925735 | 0.683565 | telemetry_metrics_telegraf.ex | starcoder |
defmodule UpRun.BetterList do
@type t :: Empty.t() | Cons.t()
defmodule Empty do
@type t :: %Empty{}
defstruct []
def new(), do: %Empty{}
end
defmodule Cons do
@behaviour Access
@type t :: %Cons{
value: any(),
link: MyList.t()
}
defstruct value: nil, link: %Empty{}
... | lib/up_run/better_list.ex | 0.663887 | 0.434281 | better_list.ex | starcoder |
defmodule Ibanity.Request do
@moduledoc """
Abstraction layer that eases the construction of an HTTP request.
Most of the functions come in two flavors. Those with a `Ibanity.Request` as first argument modify return a modified version of it,
and those without one first create a base `Ibanity.Request` and modif... | lib/ibanity/request.ex | 0.893007 | 0.40987 | request.ex | starcoder |
defmodule PBFParser do
@moduledoc """
Elixir parser and decoder for OpenStreetMap PBF format described in [PBF file specification](https://wiki.openstreetmap.org/wiki/PBF_Format#Encoding_OSM_entities_into_fileblocks). This library provides a collection of functions that one can use to build their own decoder flow o... | lib/pbf_parser.ex | 0.913701 | 0.698021 | pbf_parser.ex | starcoder |
import Kernel, except: [apply: 2]
defmodule Ecto.Query.Builder.Select do
@moduledoc false
alias Ecto.Query.Builder
@doc """
Escapes a select.
It allows tuples, lists and variables at the top level. Inside the
tuples and lists query expressions are allowed.
## Examples
iex> escape({1, 2}, [], _... | deps/ecto/lib/ecto/query/builder/select.ex | 0.740925 | 0.402891 | select.ex | starcoder |
defmodule Plaid.PaymentInitiation.Payments do
@moduledoc """
Functions for Plaid `payment_initiation/payment` endpoints.
"""
import Plaid, only: [make_request_with_cred: 4, validate_cred: 1]
alias Plaid.Utils
@derive Jason.Encoder
defstruct payment_id: nil,
status: nil,
request_... | lib/plaid/payment_initiation/payments.ex | 0.773259 | 0.604487 | payments.ex | starcoder |
defmodule ConvCase do
@moduledoc """
Functions to convert strings, atoms and map keys between `camelCase`,
`snake_case` and `kebab-case`.
Currently this functions do not support UTF-8.
If this package fits not your requirements then take a look here:
* [Macro.camelize/1](https://hexdocs.pm/elixir/Macro... | lib/conv_case.ex | 0.921689 | 0.623979 | conv_case.ex | starcoder |
defmodule Ash.Resource.Validation.Builtins do
@moduledoc """
Built in validations that are available to all resources
The functions in this module are imported by default in the validations section.
"""
alias Ash.Resource.Validation
@doc """
Validates that an attribute's value is in a given list
"""
... | lib/ash/resource/validation/builtins.ex | 0.833816 | 0.515437 | builtins.ex | starcoder |
defmodule Plaid.PaymentInitiation do
@moduledoc """
[Plaid Payment Initiation API](https://plaid.com/docs/api/products/#payment-initiation-uk-and-europe) calls and schema.
"""
alias Plaid.Castable
alias Plaid.PaymentInitiation.{
Address,
Amount,
BACS,
Payment,
Recipient,
Schedule
}... | lib/plaid/payment_initiation.ex | 0.879432 | 0.55254 | payment_initiation.ex | starcoder |
defmodule AWS.Glue do
@moduledoc """
AWS Glue
Defines the public endpoint for the AWS Glue service.
"""
@doc """
Creates one or more partitions in a batch operation.
"""
def batch_create_partition(client, input, options \\ []) do
request(client, "BatchCreatePartition", input, options)
end
@d... | lib/aws/glue.ex | 0.894352 | 0.490236 | glue.ex | starcoder |
defmodule RfxCli.Main.ExtractCommand do
@moduledoc """
Converts Optimus parse data into a command_args list.
The command_args list contains the following elements:
```elixir
[
launch_cmd: <cmd_name: atom>
launch_args: struct
op_module: <module_name: string>
op_scope: <code | file | project |... | lib/rfx_cli/main/extract_command.ex | 0.692538 | 0.729038 | extract_command.ex | starcoder |
defmodule Snitch.Data.Model.Order do
@moduledoc """
Order API
"""
use Snitch.Data.Model
import Snitch.Tools.Helper.QueryFragment
alias Snitch.Data.Schema.Order
alias Snitch.Data.Model.LineItem, as: LineItemModel
@order_states ["confirmed", "complete"]
@doc """
Creates an order with supplied `param... | apps/snitch_core/lib/core/data/model/order.ex | 0.906299 | 0.86799 | order.ex | starcoder |
defmodule Solid.Tag do
@moduledoc """
This module define behaviour for tags.
To implement new tag you need to create new module that implement the `Tag` behaviour:
defmodule MyCustomTag do
import NimbleParsec
@behaviour Solid.Tag
@impl true
def spec(_parser) do
s... | lib/solid/tag.ex | 0.889769 | 0.480296 | tag.ex | starcoder |
defmodule AWS.ACMPCA do
@moduledoc """
This is the *ACM Private CA API Reference*.
It provides descriptions, syntax, and usage examples for each of the actions and
data types involved in creating and managing private certificate authorities
(CA) for your organization.
The documentation for each action sh... | lib/aws/generated/acmpca.ex | 0.816187 | 0.528473 | acmpca.ex | starcoder |
defmodule Scenic.Scrollable.Direction do
@moduledoc """
Utility module for limiting certain operations along a certain direction only. A value can be connected to either horizontal or vertical directions.
"""
@typedoc """
The directions a value can be associated with.
"""
@type direction :: :horizontal |... | lib/utility/direction.ex | 0.947769 | 0.655322 | direction.ex | starcoder |
defmodule AWS.IoTAnalytics do
@moduledoc """
AWS IoT Analytics allows you to collect large amounts of device data, process
messages, and store them.
You can then query the data and run sophisticated analytics on it. AWS IoT
Analytics enables advanced data exploration through integration with Jupyter
Noteb... | lib/aws/generated/iot_analytics.ex | 0.857291 | 0.701036 | iot_analytics.ex | starcoder |
defmodule HL7.Codec do
@moduledoc """
Functions that decode and encode HL7 fields, repetitions, components and subcomponents.
Each type of item has a intermediate representation, that will vary depending on whether the `trim`
option was used when decoding or encoding. If we set `trim` to `true`, some trailing ... | lib/ex_hl7/codec.ex | 0.950629 | 0.629148 | codec.ex | starcoder |
defmodule Oban.Job do
@moduledoc """
A Job is an Ecto schema used for asynchronous execution.
Job changesets are created by your application code and inserted into the database for
asynchronous execution. Jobs can be inserted along with other application data as part of a
transaction, which guarantees that j... | lib/oban/job.ex | 0.835047 | 0.433981 | job.ex | starcoder |
defmodule Jwt.Plugs.FilterClaims do
import Plug.Conn
require Logger
def init(opts), do: opts
def call(conn, []), do: send_401(conn)
def call(conn, opts) do
filter_claims(conn.assigns[:jwtclaims], conn, opts)
end
defp filter_claims([], conn, _), do: send_401(conn)
defp filter... | lib/plugfilterclaims.ex | 0.507324 | 0.409634 | plugfilterclaims.ex | starcoder |
defmodule Openmaize.OnetimePass do
@moduledoc """
Module to handle one-time passwords for use in two factor authentication.
`Openmaize.OnetimePass` checks the one-time password, and returns an
`openmaize_user` message (the user model) if the one-time password is
correct or an `openmaize_error` message if the... | lib/openmaize/onetime_pass.ex | 0.772531 | 0.601096 | onetime_pass.ex | starcoder |
defmodule Norm.Core.Selection do
@moduledoc false
# Provides the definition for selections
defstruct required: [], schema: nil
alias Norm.Core.Schema
alias Norm.SpecError
def new(schema, selectors) do
# We're going to front load some work so that we can ensure that people are
# requiring keys tha... | lib/norm/core/selection.ex | 0.767385 | 0.471588 | selection.ex | starcoder |
defmodule Xandra.Cluster do
@moduledoc """
Connection to a Cassandra cluster.
This module is a "proxy" connection with support for connecting to multiple
nodes in a Cassandra cluster and executing queries on such nodes based on a
given *strategy*.
## Usage
This module manages connections to different n... | lib/xandra/cluster.ex | 0.923674 | 0.834946 | cluster.ex | starcoder |
defmodule Sanbase.Metric do
@moduledoc """
Dispatch module used for fetching metrics.
This module dispatches the fetching to modules implementing the
`Sanbase.Metric.Behaviour` behaviour. Such modules are added to the
@metric_modules list and everything else happens automatically.
This project is a data-c... | lib/sanbase/metric/metric.ex | 0.919912 | 0.603348 | metric.ex | starcoder |
defmodule TtrCore.Games do
@moduledoc """
A `DynamicSupervisor` process that manages each game's process tree.
"""
use DynamicSupervisor
alias TtrCore.{
Cards,
Mechanics,
Players
}
alias TtrCore.Mechanics.State
alias TtrCore.Games.{
Game,
Index
}
require Logger
@type user_... | lib/ttr_core/games.ex | 0.867183 | 0.423339 | games.ex | starcoder |
defmodule Plaid.Sandbox do
@moduledoc """
[Plaid Sandbox API](https://plaid.com/docs/api/sandbox/) calls and schema.
> Only used for sandbox testing purposes. None of these calls will work in `development` or `production`.
🏗 I haven'tyet tested the `bank_transfer` endpoints against the actual plaid API becau... | lib/plaid/sandbox.ex | 0.862583 | 0.528351 | sandbox.ex | starcoder |
defmodule Mazes.CircularMaze do
@behaviour Mazes.Maze
alias Mazes.Maze
@doc "Returns a circular maze with given size, either with all walls or no walls"
@impl true
def new(opts) do
radius = Keyword.get(opts, :radius, 10)
first_ring_vertex_count = 8
all_vertices_adjacent? = Keyword.get(opts, :all... | lib/mazes/circular_maze.ex | 0.849878 | 0.645588 | circular_maze.ex | starcoder |
defimpl Transmog.Parser, for: List do
@moduledoc """
Implementation of `Transmog.Parser` for lists. Parses lists which are already
considered valid key paths. A list is only invalid if it is empty. You might
want to use lists instead of the string notation if you need to represent
special values that the pars... | lib/transmog/parser/list.ex | 0.874955 | 0.413004 | list.ex | starcoder |
defmodule InlineSVG do
@moduledoc """
Render inline SVG.
## Initialization
```elixir
def SVGHelper do
use InlineSVG, root: "assets/static/svg", default_collection: "generic"
end
```
This will generate functions for each SVG file, effectively caching them at
compile time.
## Usage
### re... | lib/inline_svg.ex | 0.728459 | 0.881666 | inline_svg.ex | starcoder |
defmodule Sanbase.Clickhouse.HistoricalBalance.EthSpent do
@moduledoc ~s"""
Module providing functions for fetching ethereum spent
"""
alias Sanbase.Clickhouse.HistoricalBalance
alias Sanbase.Clickhouse.HistoricalBalance.EthBalance
@type slug :: String.t()
@type address :: String.t() | list(String.t())... | lib/sanbase/clickhouse/historical_balance/eth_spent.ex | 0.885706 | 0.557454 | eth_spent.ex | starcoder |
defmodule Cldr.List do
@moduledoc """
Cldr module to formats lists.
If we have a list of days like `["Monday", "Tuesday", "Wednesday"]`
then we can format that list for a given locale by:
iex> Cldr.List.to_string(["Monday", "Tuesday", "Wednesday"], MyApp.Cldr, locale: "en")
{:ok, "Monday, Tuesday,... | lib/cldr/list.ex | 0.915858 | 0.5083 | list.ex | starcoder |
defmodule Mix.TaskHelpers.Strings do
@doc """
Downcase a string
"""
def lowercase(value), do: String.downcase(value)
@doc """
Sentence case a string
"""
def sentencecase(value), do: String.capitalize(value)
@doc """
Upcase a string
"""
def uppercase(value), do: String.upcase(value)
@doc """... | apps/artemis/lib/mix/task_helpers/strings.ex | 0.775902 | 0.46478 | strings.ex | starcoder |
defmodule Epicenter.Test.SchemaAssertions do
import ExUnit.Assertions
alias Epicenter.Test.SchemaAssertions.Database
alias Epicenter.Test.SchemaAssertions.Schema
@doc """
Assert that the given schema module exists, it has a corresponding table, and its fields are correct.
See `assert_schema_fields/2` for... | test/support/schema_assertions.ex | 0.775477 | 0.654674 | schema_assertions.ex | starcoder |
defmodule Saucexages.IO.FileWriter do
@moduledoc """
Functions for writing and maintaining SAUCE files.
This writer is primarily for working with larger files. You may elect to use `Saucexages.IO.BinaryWriter` if you want a more flexible writer, provided that your files are small and fit in memory.
The genera... | lib/saucexages/io/file_writer.ex | 0.759047 | 0.519399 | file_writer.ex | starcoder |
defmodule StarkInfra.PixStatement do
alias __MODULE__, as: PixStatement
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
Groups PixStatement related functions
"""
@doc """
The PixStatem... | lib/pix_statement/pix_statement.ex | 0.90214 | 0.724468 | pix_statement.ex | starcoder |
defmodule ElasticsearchElixirBulkProcessor.Helpers.Events do
@doc ~S"""
Return the size of the string in bytes
## Examples
iex> ElasticsearchElixirBulkProcessor.Helpers.Events.byte_sum(["abcd", "a", "b"])
6
iex> ElasticsearchElixirBulkProcessor.Helpers.Events.byte_sum([])
0
"""
def byte_s... | lib/elasticsearch_elixir_bulk_processor/helpers/events.ex | 0.794744 | 0.557905 | events.ex | starcoder |
defmodule Tailwind.Phoenix.Combined do
@moduledoc """
Helper to make useful notifications to be used in LiveView controllers where
Index and Show is combined.
It implements handle_info/2 LiveView callbacks for events,
updates the current assigns if a notification arrives.
The value function gets passed th... | lib/tailwind/phoenix/combined.ex | 0.744192 | 0.812347 | combined.ex | starcoder |
defmodule Remsign.Utils do
import Logger, only: [log: 2]
def get_in_default(m, kl, d) do
case get_in(m, kl) do
nil -> d
r -> r
end
end
def make_nonce, do: :crypto.strong_rand_bytes(16) |> Base.encode16(case: :lower)
def validate_clock(t, skew) do
case Timex.parse(t, "{ISO:Extended:Z... | lib/remsign/utils.ex | 0.533154 | 0.41564 | utils.ex | starcoder |
defmodule ExState.Definition do
@moduledoc """
`ExState.Definition` provides macros to define a workflow state chart.
A workflow is defined with a name:
workflow "make_deal" do
#...
end
## Subject
The subject of the workflow is used to associate the workflow for lookup
in the databas... | lib/ex_state/definition.ex | 0.893815 | 0.68187 | definition.ex | starcoder |
defmodule MerklePatriciaTree.Proof do
require Integer
alias MerklePatriciaTree.Trie
alias MerklePatriciaTree.Trie.Node
alias MerklePatriciaTree.Trie.Helper
alias MerklePatriciaTree.ListHelper
alias MerklePatriciaTree.DB
@doc """
Building proof tree for given path by going through each node ot this pat... | lib/proof.ex | 0.768038 | 0.439206 | proof.ex | starcoder |
defmodule Game.Character do
@moduledoc """
Character GenServer client
A character is a player (session genserver) or an NPC (genserver). They should
handle the following casts:
- `{:targeted, player}`
- `{:apply_effects, effects, player}`
"""
alias Data.NPC
alias Data.User
alias Game.Character.Vi... | lib/game/character.ex | 0.826991 | 0.518424 | character.ex | starcoder |
defmodule TileRack do
@moduledoc """
Encapsulate the shape of each piece, initially in the player's rack
then later on the board.
"""
defstruct [:rack_squares, :width, :height, :currently_selected, :on_board, :raw_chars]
# This rack layout drives the entire set of pieces.
# It is parsed to find the locat... | lib/live_view_demo/tile_rack.ex | 0.698535 | 0.592991 | tile_rack.ex | starcoder |
defmodule Paddle.Filters do
@moduledoc ~S"""
Module used internally by Paddle to manipulate LDAP filters.
"""
@type easy_filter :: keyword | %{optional(atom | binary) => binary}
@type eldap_filter :: tuple
@type filter :: easy_filter | eldap_filter | nil
@type t :: filter
@spec construct_filter(filter... | lib/paddle/filters.ex | 0.888242 | 0.519399 | filters.ex | starcoder |
defmodule AWS.DynamoDBStreams do
@moduledoc """
Amazon DynamoDB
Amazon DynamoDB Streams provides API actions for accessing streams and
processing stream records.
To learn more about application development with Streams, see [Capturing Table Activity with DynamoDB
Streams](https://docs.aws.amazon.com/amaz... | lib/aws/generated/dynamodb_streams.ex | 0.8731 | 0.57341 | dynamodb_streams.ex | starcoder |
defmodule IntermodalContainers.ContainerCode.Parser do
@moduledoc false
alias IntermodalContainers.ContainerCode
alias IntermodalContainers.ContainerCode.SizeCodes
alias IntermodalContainers.ContainerCode.TypeCodes
@type result() :: {:ok, %ContainerCode{}} | {:error, String.t()}
@spec parse(String.t()) :... | lib/intermodal_containers/container_code/parser.ex | 0.704872 | 0.407392 | parser.ex | starcoder |
defmodule Depot.Visibility.PortableUnixVisibilityConverter do
@moduledoc """
`Depot.Visibility.UnixVisibilityConverter` supporting `Depot.Visibility.portable()`.
This is a good default visibility converter for adapters using unix based permissions.
"""
alias Depot.Visibility.UnixVisibilityConverter
defmod... | lib/depot/visibility/portable_unix_visibility_converter.ex | 0.855429 | 0.408395 | portable_unix_visibility_converter.ex | starcoder |
defmodule Hui.Query do
@moduledoc """
Hui.Query module provides underpinning HTTP-based request functions for Solr, including:
- `get/2`, `get!/2`
- `post/2`, `post!/2`
"""
use HTTPoison.Base
alias Hui.URL
alias Hui.Encoder
alias Hui.Query
@type querying_struct :: Query.Standard.t() | Query.Com... | lib/hui/query.ex | 0.895235 | 0.699742 | query.ex | starcoder |
defmodule Snap do
def snap(0) do
camera = Camera.normal({800, 600})
obj1 = %Sphere{radius: 140, pos: {0, 0, 700}}
obj2 = %Sphere{radius: 50, pos: {200, 0, 600}}
obj3 = %Sphere{radius: 50, pos: {-80, 0, 400}}
image = Tracer.tracer(camera, [obj1, obj2, obj3])
PPM.write("snap0.ppm", image)
e... | Tracer/snap.ex | 0.54577 | 0.740151 | snap.ex | starcoder |
defmodule StarkInfra.Utils.Check do
@moduledoc false
alias EllipticCurve.PrivateKey
alias StarkInfra.Project
alias StarkInfra.Organization
def environment(environment) do
case environment do
:production -> environment
:sandbox -> environment
nil -> raise "please set an environment"
_any ->... | lib/utils/checks.ex | 0.540196 | 0.566978 | checks.ex | starcoder |
defmodule Crit.Sql do
alias Crit.Repo
import Crit.Servers.Institution.Server, only: [server: 1]
@moduledoc """
These functions use the Institution's shortname to send the right
SQL to the right place.
There's an function for each `Ecto.Repo` function (that is used by
this application). Each works by as... | lib/crit/sql.ex | 0.604399 | 0.629205 | sql.ex | starcoder |
defmodule ExAliyunOts.Filter do
@moduledoc false
require ExAliyunOts.Const.ComparatorType, as: ComparatorType
require ExAliyunOts.Const.LogicOperator, as: LogicOperator
@operator_mapping %{
and: LogicOperator.and(),
not: LogicOperator.not(),
or: LogicOperator.or()
}
@comparator_mapping %{
... | lib/ex_aliyun_ots/filter.ex | 0.673514 | 0.459197 | filter.ex | starcoder |
defmodule OrderWatchdog do
@moduledoc """
A module for keeping track of the hall orders which are underway to being handled, and triggering a resend of orders which stay unhandled for too long.
"""
use GenServer, restart: :permanent
require Logger
@baseWaitingTime Application.compile_env(:elevator, :orderWa... | elevator/lib/orderWatchdog.ex | 0.655777 | 0.47725 | orderWatchdog.ex | starcoder |
defmodule Cassette.Plug.AuthenticationHandler do
@moduledoc """
Behaviour and macro module to define callbacks for the authentication handlers the plug uses.
Most of this works out-of-the-box, but it might be interesting to override
`Cassette.Plug.AuthenticationHandler.invalid_authentication/2` and present a m... | lib/cassette/plug/authentication_handler.ex | 0.879955 | 0.767167 | authentication_handler.ex | starcoder |
defmodule Explorer.PolarsBackend.DataFrame do
@moduledoc false
alias Explorer.DataFrame, as: DataFrame
alias Explorer.PolarsBackend.Native
alias Explorer.PolarsBackend.Series, as: PolarsSeries
alias Explorer.PolarsBackend.Shared
alias Explorer.Series, as: Series
@type t :: %__MODULE__{resource: binary()... | lib/explorer/polars_backend/data_frame.ex | 0.789234 | 0.441854 | data_frame.ex | starcoder |
defmodule ResourceManager.Credentials.TOTPs do
@moduledoc """
TOTPs (Time based on time password) are a type of credential used by a subject as
an implementation of two factor autentication.
This type of credential generates a one-time password which uses the current time as
a source of uniqueness.
"""
... | apps/resource_manager/lib/credentials/totps.ex | 0.787646 | 0.602266 | totps.ex | starcoder |
defmodule Absinthe.Schema do
import Absinthe.Schema.Notation
@moduledoc """
Define a GraphQL schema.
See also `Absinthe.Schema.Notation` for a reference of the macros imported by
this module available to build types for your schema.
## Basic Usage
To define a schema, `use Absinthe.Schema` within
a m... | lib/absinthe/schema.ex | 0.906348 | 0.852353 | schema.ex | starcoder |
defmodule Monad.State do
@moduledoc """
Like `Monad.Reader`, the state monad can share an environment between
different operations. Additionally, it can store an arbitrary value.
## Example
iex> use Monad.Operators
iex> env = %{dev: %{url: "http://www.example.com/dev"}, prod: %{url: "https://www.e... | lib/monad/state.ex | 0.857857 | 0.530601 | state.ex | starcoder |
defmodule Goth.Token do
@moduledoc ~S"""
Interface for retrieving access tokens, from either the `Goth.TokenStore`
or the Google token API. The first request for a token will hit the API,
but subsequent requests will retrieve the token from Goth's token store.
Goth will automatically refresh access tokens in... | lib/goth/token.ex | 0.885706 | 0.527864 | token.ex | starcoder |
defmodule Poison.EncodeError do
defexception value: nil, message: nil
def message(%{value: value, message: nil}) do
"unable to encode value: #{inspect value}"
end
def message(%{message: message}) do
message
end
end
defmodule Poison.Encode do
def encode_name(value) do
cond do
is_binary(v... | lib/poison/encoder.ex | 0.601594 | 0.403214 | encoder.ex | starcoder |
defmodule Faker.Superhero.En do
import Faker, only: [sampler: 2]
@moduledoc """
Functions for Superhero data in English
"""
@doc """
Returns a Superhero name
"""
@spec name() :: String.t
def name, do: name(:crypto.rand_uniform(1, 11))
defp name(1), do: "#{prefix()} #{descriptor()} #{suffix()}"
d... | lib/faker/superhero/en.ex | 0.636692 | 0.404272 | en.ex | starcoder |
defmodule AWS.OpsWorksCM do
@moduledoc """
AWS OpsWorks CM
AWS OpsWorks for configuration management (CM) is a service that runs and
manages configuration management servers. You can use AWS OpsWorks CM to
create and manage AWS OpsWorks for Chef Automate and AWS OpsWorks for
Puppet Enterprise servers, and... | lib/aws/ops_works_c_m.ex | 0.899091 | 0.458773 | ops_works_c_m.ex | starcoder |
defmodule Automata do
@moduledoc """
"""
@typedoc """
All automata start with a %State{}.
"""
@type state :: module()
@typedoc "The error state returned by `Automata.WorldInfo` and `Automata.AutomatonInfo`"
@type failed :: [{Exception.kind(), reason :: term, Exception.stacktrace()}]
@typedoc "A ma... | lib/automata.ex | 0.867794 | 0.603844 | automata.ex | starcoder |
defmodule Geo.WKT.Encoder do
@moduledoc false
alias Geo.{
Point,
PointZ,
PointM,
PointZM,
LineString,
LineStringZ,
Polygon,
PolygonZ,
MultiPoint,
MultiPointZ,
MultiLineString,
MultiLineStringZ,
MultiPolygon,
MultiPolygonZ,
GeometryCollection
}
@doc "... | lib/geo/wkt/encoder.ex | 0.809201 | 0.702976 | encoder.ex | starcoder |
defmodule AWS.ServiceQuotas do
@moduledoc """
Service Quotas is a web service that you can use to manage many of your AWS
service quotas. Quotas, also referred to as limits, are the maximum values
for a resource, item, or operation. This guide provide descriptions of the
Service Quotas actions that you can c... | lib/aws/service_quotas.ex | 0.864625 | 0.57075 | service_quotas.ex | starcoder |
defmodule XUtil.Math do
@moduledoc "Various mathematical helpers; corresponds to X-Plane's hl_math.h"
def reinterpolate(input, from_bits, to_bits)
when is_integer(input) and input >= 0 and is_integer(from_bits) and is_integer(to_bits) do
from_max = floor(:math.pow(2, from_bits)) - 1
to_max = floor(:m... | lib/x_util/math.ex | 0.846498 | 0.576184 | math.ex | starcoder |
defmodule Membrane.Element.Msdk.H264.Encoder do
@moduledoc """
Membrane element that encodes raw video frames to H264 format using
hardware-accelerated API available for Intel® Gen graphics hardware platforms.
The element expects each frame to be received in a separate buffer, so the parser
(`Membrane.Elemen... | lib/membrane_element_msdk_h264/encoder.ex | 0.82573 | 0.548553 | encoder.ex | starcoder |
defmodule AFK.Keycode.Key do
@moduledoc """
Represents a basic keyboard keycode, like letters, numbers, etc.
All standard keys on a keyboard except the modifiers can be represented by
`Key` keycodes. The currently supported keys are `t:key/0`.
"""
@enforce_keys [:key]
defstruct [:key]
@type key ::
... | lib/afk/keycode/key.ex | 0.849628 | 0.436622 | key.ex | starcoder |
defmodule ArangoDB.Ecto do
@moduledoc """
Ecto 2.x adapter for ArangoDB.
At the moment the `from`, `where`, `order_by`, `limit`
`offset` and `select` clauses are supported.
"""
alias ArangoDB.Ecto.Utils
def truncate(repo, coll) do
%Arango.Collection{name: coll}
|> Arango.Collection.truncate()
... | lib/arangodb_ecto.ex | 0.730482 | 0.404184 | arangodb_ecto.ex | starcoder |
defmodule Conform.Utils do
@moduledoc false
import IO.ANSI, only: [green: 0, yellow: 0, red: 0]
@doc "Print an debugging message"
def debug(message), do: log("==> #{message}")
@doc "Print an informational message"
def info(message), do: log("==> #{message}", green)
@doc "Print a warning message"
def ... | lib/conform/utils/utils.ex | 0.554229 | 0.459258 | utils.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.