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 |
|---|---|---|---|---|---|
defprotocol BinFormat.Field do
@fallback_to_any true
@moduledoc """
Converts information about the field into snippets of Elixir AST that can be
used to define it instructs and match against it in structs and binaries if
necessary.
If field generates code for a given function, it should return a tuple wit... | lib/bin_format/field.ex | 0.901391 | 0.77437 | field.ex | starcoder |
defmodule Cog.Controller.Helpers do
alias Phoenix.ConnTest
alias Plug.Conn
@doc """
Prepare and execute a Cog API request.
Arguments:
* `requestor` - a `%User{}` with an associated token. This token
will be added to the request via an `Authorization` header. All
request authentication and author... | test/support/controller_helpers.ex | 0.84228 | 0.54256 | controller_helpers.ex | starcoder |
defmodule Expwd do
use Bitwise
@type supported_algs :: :ripemd160 | :sha256 | :sha384 | :sha512
@supported_hash_algorithms [:ripemd160, :sha256, :sha384, :sha512]
def supported_hash_algorithms(), do: @supported_hash_algorithms
@doc """
Securely compare two strings, in constant time.
Returns `true` if... | lib/expwd.ex | 0.902612 | 0.727855 | expwd.ex | starcoder |
defmodule Vex.Validators.Uuid do
@moduledoc """
Ensure a value is a valid UUID string.
## Options
At least one of the following must be provided:
* `:format`: Required. An atom that defines the UUID format of the value:
* `:default`: The value must be a string with format `xxxxxxxx-xxxx-xxxx-xxxx-xxxx... | lib/vex/validators/uuid.ex | 0.853715 | 0.741627 | uuid.ex | starcoder |
defmodule AWS.KinesisAnalyticsV2 do
@moduledoc """
Amazon Kinesis Data Analytics is a fully managed service that you can use
to process and analyze streaming data using SQL or Java. The service
enables you to quickly author and run SQL or Java code against streaming
sources to perform time series analytics, ... | lib/aws/kinesis_analytics_v2.ex | 0.914161 | 0.659967 | kinesis_analytics_v2.ex | starcoder |
defmodule Apoc.Hazmat.MAC.HMAC256 do
@moduledoc """
Implementation of the HMAC construction
as described in [FIPS PUB 198-1](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.198-1.pdf)
"""
# This is needed for our API check
require :crypto
use Apoc.Adapter.MAC
defguard is_valid_key(key) when is_binary(... | lib/apoc/hazmat/mac/hmac256.ex | 0.842199 | 0.584953 | hmac256.ex | starcoder |
defmodule Zoneinfo.TimeZoneDatabase do
@moduledoc """
Calendar.TimeZoneDatabase implementation for Zoneinfo
Pass this module to the `DateTime` functions or set it as the default by
calling `Calendar.put_time_zone_database/1`
"""
@behaviour Calendar.TimeZoneDatabase
import Zoneinfo.Utils
@impl Calenda... | lib/zoneinfo/time_zone_database.ex | 0.864754 | 0.453262 | time_zone_database.ex | starcoder |
defmodule TflInterp do
@timeout 300000
@moduledoc """
Tensorflow lite intepreter for Elixir.
Deep Learning inference framework for embedded devices.
## Installation
This module is designed for Poncho-style. Therefore, it cannot be installed
by adding this module to your project's dependency list. Follow... | lib/tfl_interp.ex | 0.88129 | 0.838415 | tfl_interp.ex | starcoder |
defmodule Crux.Structs.Snowflake.Parts do
@moduledoc """
Custom non discord api struct representing a deconstructed Discord snowflake.
## Structure of the Parts
| Field | Bits | Number of Bits | Description |
| :---------------... | lib/structs/snowflake/parts.ex | 0.755952 | 0.4474 | parts.ex | starcoder |
defmodule Day12 do
@moduledoc """
Documentation for Day12.
"""
@north {1, 0}
@south {-1, 0}
@east {0, 1}
@west {0, -1}
@right_turns [@north, @east, @south, @west]
def part1 do
Day12.read_data("input.txt")
|> Day12.calc_distances()
|> Day12.sum_distances()
|> IO.inspect()
end
def... | day12/lib/day12.ex | 0.709019 | 0.511534 | day12.ex | starcoder |
defmodule Esperanto.Parsers.TopLevel do
require Logger
alias Esperanto.Walker
@behaviour Esperanto.Parser
@default_parsers [
{Esperanto.Parsers.PlainText, nil},
{Esperanto.Parsers.Br, nil},
{Esperanto.Parsers.Img, nil},
{Esperanto.Parsers.Link, nil},
{Esperanto.Parsers.IndentedCode, nil},
... | apps/esperanto/lib/trybe/esperanto/parsers/top_level_parser.ex | 0.662251 | 0.462473 | top_level_parser.ex | starcoder |
defmodule FusionAuth.Response do
@moduledoc """
The `FusionAuth.Response` module provides functions to format the response from FusionAuth.result.
## Example
```
iex> FusionAuth.client()
|> FusionAuth.Groups.get_groups()
|> FusionAuth.Response.format("groups", &atomize_keys/1)
{:ok,... | lib/fusion_auth/response.ex | 0.911367 | 0.706899 | response.ex | starcoder |
defmodule Scenic.Primitive.Transform do
@moduledoc """
Change the position, rotation, scale and more of a primitive.
Unlike html, which uses auto-layout to position items on the screen, Scenic moves primitives around using matrix transforms. This is common in video games and provides powerful control of your pr... | lib/scenic/primitive/transform/transform.ex | 0.930829 | 0.960212 | transform.ex | starcoder |
defmodule Nosedrum.Converters do
@moduledoc """
Conversion from command arguments to various types.
This module provides an interface to the individual converter modules.
Most converter functions related to Discord itself take a `guild_id`
which is used for loading the guild from the cache. If the guild coul... | lib/nosedrum/converters.ex | 0.827863 | 0.551393 | converters.ex | starcoder |
defmodule Base32Crockford do
@moduledoc ~S"""
Base32-Crockford: base-32 encoding for expressing integer numbers
in a form that can be conveniently and accurately transmitted
between humans and computer systems.
[https://www.crockford.com/wrmg/base32.html](https://www.crockford.com/wrmg/base32.html)
A symb... | lib/base32_crockford.ex | 0.913148 | 0.676179 | base32_crockford.ex | starcoder |
defmodule MacroX do
@moduledoc ~S"""
`Macro` extension module.
"""
@doc ~S"""
Converts the given atom or binary to snakize format.
If an atom is given, it is assumed to be an Elixir module,
so it is converted to a binary and then processed.
This function was designed to snakize language identifiers/tok... | lib/common_x/macro_x.ex | 0.853379 | 0.818084 | macro_x.ex | starcoder |
defmodule PatternMatching do
use Koans
@intro "PatternMatching"
koan "One matches one" do
assert match?(1, 1)
end
koan "Patterns can be used to pull things apart" do
[head | tail] = [1, 2, 3, 4]
assert head == 1
assert tail == [2, 3, 4]
end
koan "And then put them back together" do
... | lib/koans/12_pattern_matching.ex | 0.863607 | 0.720811 | 12_pattern_matching.ex | starcoder |
defmodule Envelope do
@moduledoc ~S"""
A library for calculating envelopes of geometries and tools to compare them.
This is most useful as an approximation of spacial relationships between more
complicated geometries.
iex> Envelope.from_geo( %Geo.Polygon{coordinates: [[{2, -2}, {20, -2}, {11, 11}, {2, -2... | lib/envelope.ex | 0.938899 | 0.727855 | envelope.ex | starcoder |
defmodule Cogoli do
@moduledoc """
A highly modular implementation of Conway's Game of Life.
The implementation itself is provided as a callback module, and as such
alternative callback modules can be written to explore variations on the
original Game of Life. A number of variations are in fact included wit... | lib/cogoli.ex | 0.850065 | 0.784154 | cogoli.ex | starcoder |
defmodule AWS.MTurk do
@moduledoc """
Amazon Mechanical Turk API Reference
"""
@doc """
The `AcceptQualificationRequest` operation approves a Worker's request for a
Qualification.
Only the owner of the Qualification type can grant a Qualification request for
that type.
A successful request for the... | lib/aws/generated/mturk.ex | 0.89963 | 0.687532 | mturk.ex | starcoder |
defmodule Phoenix.Channels.GenSocketClient do
@moduledoc """
Communication with a Phoenix Channels server.
This module powers a process which can connect to a Phoenix Channels server and
exchange messages with it. Currently, only websocket communication protocol is
supported.
The module is implemented as ... | lib/gen_socket_client.ex | 0.861217 | 0.541227 | gen_socket_client.ex | starcoder |
defmodule Cloak.Ecto.HMAC do
@moduledoc """
A custom `Ecto.Type` for hashing fields using `:crypto.hmac/3`.
## Why
If you store a hash of a field's value, you can then query on it as a proxy
for an encrypted field. This works because HMAC is deterministic and
always results in the same value, while secure... | lib/cloak_ecto/types/hmac.ex | 0.895739 | 0.505554 | hmac.ex | starcoder |
defmodule Sourceror.Identifier do
@moduledoc false
@unary_ops [:&, :!, :^, :not, :+, :-, :~~~, :@]
binary_ops = [
:<-,
:\\,
:when,
:"::",
:|,
:=,
:||,
:|||,
:or,
:&&,
:&&&,
:and,
:==,
:!=,
:=~,
:===,
:!==,
:<,
:<=,
:>=,
:>,
:... | lib/sourceror/identifier.ex | 0.550366 | 0.538862 | identifier.ex | starcoder |
defmodule Timex.Macros do
@moduledoc false
@doc """
Wraps a function definition in a warning at runtime on :stderr that the wrapped function has been deprecated.
The message parameter should be used to communicate the action needed to move to supported behaviour.
"""
defmacro defdeprecated({name, _env, arg... | lib/timex/macros.ex | 0.779154 | 0.712362 | macros.ex | starcoder |
defmodule ElixirRigidPhysics.Geometry.Capsule do
@moduledoc """
Capsule geometry module.
[Capsules](https://en.wikipedia.org/wiki/Capsule_(geometry)) are cylinders capped with hemispheres, with two dimensions:
* `axial_length` -- the length of the cylinder (not including hemispheres)
* `cap_radius` -- the r... | lib/geometry/capsule.ex | 0.912655 | 0.808332 | capsule.ex | starcoder |
defmodule Connect do
@x_piece "X"
@o_piece "O"
@players %{
@x_piece => :black,
@o_piece => :white
}
@out_of_bounds_index -1
@doc """
Calculates the winner (if any) of a board
using "O" as the white player
and "X" as the black player
"""
@spec result_for([String.t()]) :: :none | :black | :... | elixir/connect/lib/connect.ex | 0.634996 | 0.406862 | connect.ex | starcoder |
defmodule Oasis.Spec.Parameter do
@moduledoc false
alias Oasis.InvalidSpecError
@locations ["query", "head", "path", "cookie"]
def build(path_expr, parameter) do
parameter
|> check_schema_or_content(parameter["schema"], parameter["content"])
|> check_name(path_expr)
end
defp check_schema_or_... | lib/oasis/spec/parameter.ex | 0.7181 | 0.415492 | parameter.ex | starcoder |
import Kernel, except: [to_string: 1]
defmodule Ecto.DateTime.Utils do
@moduledoc false
@doc "Pads with zero"
def zero_pad(val, count) do
num = Integer.to_string(val)
pad_length = max(count - byte_size(num), 0)
:binary.copy("0", pad_length) <> num
end
@doc "Converts to integer if possible"
de... | deps/ecto/lib/ecto/date_time.ex | 0.838382 | 0.605507 | date_time.ex | starcoder |
defmodule Nanoid.Secure do
@moduledoc """
Generate a secure URL-friendly unique ID. This method uses the secure and non predictable random generator.
By default, the ID will have 21 symbols with a collision probability similar to UUID v4.
"""
use Bitwise
alias Nanoid.Configuration
@doc """
Generates a ... | lib/nanoid/secure.ex | 0.869174 | 0.635265 | secure.ex | starcoder |
defmodule Snek.Board.Snake do
@moduledoc """
Represents a snake on a board.
You may also refer to it as a "snake on a plane", as the joke
goes in the Battlesnake community. 😎
"""
@moduledoc since: "0.1.0"
alias __MODULE__
alias Snek.Board.Point
@typedoc """
A unique ID to differentiate between s... | lib/snek/board/snake.ex | 0.915013 | 0.539772 | snake.ex | starcoder |
defmodule Money.Financial do
@moduledoc """
A set of financial functions, primarily related to discounted cash flows.
Some of the algorithms are from [finance formulas](http://www.financeformulas.net)
"""
alias Cldr.Math
@doc """
Calculates the future value for a present value, an interest rate
and a ... | lib/money/financial.ex | 0.932215 | 0.779532 | financial.ex | starcoder |
defmodule Trunk.Storage.Filesystem do
@moduledoc """
A `Trunk.Storage` implementation for the local file system.
"""
@behaviour Trunk.Storage
@doc ~S"""
Saves the file to the file system.
- `directory` - The relative directory within which to store the file
- `filename` - The name of the file to be s... | lib/trunk/storage/filesystem.ex | 0.790369 | 0.765418 | filesystem.ex | starcoder |
defmodule X509.Certificate.Validity do
@moduledoc """
Convenience functions for creating `:Validity` records for use in
certificates. The `:Validity` record represents the X.509 Validity
type, defining the validity of a certificate in terms of `notBefore`
and `notAfter` timestamps.
"""
import X509.ASN1
... | lib/x509/certificate/validity.ex | 0.917326 | 0.480662 | validity.ex | starcoder |
defmodule Cand.Socket do
@moduledoc """
TCP socket handler for socketcand endpoint.
This module provides functions for configuration, read/write CAN frames.
`Cand.Socket` is implemented as a `__using__` macro so that you can put it in any module,
you can initialize your Socket manually (see `test/soc... | lib/cand/socket.ex | 0.815894 | 0.664275 | socket.ex | starcoder |
defmodule Geometry.PointZM do
@moduledoc """
A point struct, representing a 3D point with a measurement.
"""
import Geometry.Guards
alias Geometry.{GeoJson, Hex, PointZM, WKB, WKT}
defstruct [:coordinate]
@blank " "
@empty %{
{:ndr, :hex} => "000000000000F87F000000000000F87F000000000000F87F0000... | lib/geometry/point_zm.ex | 0.959602 | 0.731766 | point_zm.ex | starcoder |
defmodule Mix.Tasks.Bonny.Gen.Manifest do
@moduledoc """
Generates the Kubernetes YAML manifest for this operator
mix bonny.gen.manifest expects a docker image name if deploying to a cluster. You may optionally provide a namespace.
## Examples
The `image` switch is required.
Options:
* --image (docker... | lib/mix/tasks/bonny.gen.manifest.ex | 0.898328 | 0.703728 | bonny.gen.manifest.ex | starcoder |
defmodule PlayfabEx.Client.SharedGroupData do
use Interface
@doc """
Adds users to the set of those able to update both the shared data, as well as the set of users in the group. Only users in the group can add new members. Shared Groups are designed for sharing data between a very small number of players, ple... | lib/client/shared_group_data.ex | 0.602179 | 0.407776 | shared_group_data.ex | starcoder |
defmodule Puid do
@moduledoc """
Define modules for the efficient generation of cryptographically strong probably unique
identifiers (<strong>puid</strong>s, aka random strings) of specified entropy from various
character sets
## Examples
The simplest usage of `Puid` requires no options. The library add... | lib/puid/puid.ex | 0.904353 | 0.446374 | puid.ex | starcoder |
defmodule Geometry.GeometryCollectionM do
@moduledoc """
A collection set of 2D geometries with a measurement.
`GeometryCollectionM` implements the protocols `Enumerable` and `Collectable`.
## Examples
iex> Enum.map(
...> GeometryCollectionM.new([
...> PointM.new(11, 12, 14),
..... | lib/geometry/geometry_collection_m.ex | 0.967869 | 0.627837 | geometry_collection_m.ex | starcoder |
defmodule TinkoffInvest do
@moduledoc """
Convenient functions for frequent use-cases
"""
@type mode() :: :sandbox | :production
@default_endpoint "https://api-invest.tinkoff.ru/openapi"
alias TinkoffInvest.Portfolio
alias TinkoffInvest.User
alias TinkoffInvest.Orders
alias TinkoffInvest.Model.Api.... | lib/tinkoff_invest.ex | 0.714927 | 0.489381 | tinkoff_invest.ex | starcoder |
defmodule Protobuf.DSL.Typespecs do
@moduledoc false
alias Protobuf.{FieldProps, MessageProps}
@spec quoted_enum_typespec(MessageProps.t()) :: Macro.t()
def quoted_enum_typespec(%MessageProps{field_props: field_props}) do
atom_specs =
field_props
|> Enum.sort_by(fn {fnum, _prop} -> fnum end)
... | lib/protobuf/dsl/typespecs.ex | 0.867317 | 0.409132 | typespecs.ex | starcoder |
defmodule ExJsonSchema.Schema do
defmodule UnsupportedSchemaVersionError do
defexception message: "unsupported schema version, only draft 4 is supported"
end
defmodule InvalidSchemaError do
defexception message: "invalid schema"
end
defmodule UndefinedRemoteSchemaResolverError do
defexception me... | lib/ex_json_schema/schema.ex | 0.706393 | 0.434641 | schema.ex | starcoder |
defmodule Logger.Backends.GelfAsync do
@moduledoc """
GELF Logger Backend Async
A logger backend that will generate Graylog Extended Log Format messages. The
current version only supports UDP messages. This module specify an async way
to send the messages avoiding a bottleneck.
## Configuration
In the ... | lib/logger/backends/gelf_async.ex | 0.772702 | 0.797399 | gelf_async.ex | starcoder |
defmodule AWS.DocDB do
@moduledoc """
Amazon DocumentDB API documentation
"""
@doc """
Adds metadata tags to an Amazon DocumentDB resource. You can use these tags
with cost allocation reporting to track costs that are associated with
Amazon DocumentDB resources. or in a `Condition` statement in an AWS
... | lib/aws/doc_db.ex | 0.884502 | 0.481027 | doc_db.ex | starcoder |
defmodule AlphaVantage.TechnicalIndicators do
@moduledoc """
A set of functions for fetching technical indicators from [Alpha Vantage](www.alphavantage.co/documentation/#technical-indicators).
"""
alias AlphaVantage.Gateway
@doc """
Returns the simple moving average (SMA) values for a given symbol, inter... | lib/alpha_vantage/technical_indicators.ex | 0.948834 | 0.940463 | technical_indicators.ex | starcoder |
defmodule Console.GraphQl.Observability do
use Console.GraphQl.Schema.Base
alias Console.GraphQl.Resolvers.Observability
alias Console.Middleware.{Authenticated, Rbac}
enum :autoscaling_target do
value :statefulset
value :deployment
end
input_object :label_input do
field :name, :string
fi... | lib/console/graphql/observability.ex | 0.70028 | 0.417984 | observability.ex | starcoder |
defmodule Grizzly.ZWave.Commands.SupervisionReport do
@moduledoc """
This command is used to advertise the status of one or more command process(es).
Params:
* `:more_status_updates` - used to advertise if more Supervision Reports follow for the actual Session ID (required)
* `:session_id` - carries th... | lib/grizzly/zwave/commands/supervision_report.ex | 0.858437 | 0.499329 | supervision_report.ex | starcoder |
defmodule CodeCorps.StripeConnectSubscription do
@moduledoc """
Represents a `Subscription` object created using the Stripe API
## Fields
* `application_fee_percent` - Percentage of fee taken by Code Corps
* `cancelled_at` - Timestamp of cancellation, provided the subscription has been cancelled
* `create... | web/models/stripe_connect_subscription.ex | 0.901894 | 0.445831 | stripe_connect_subscription.ex | starcoder |
defmodule JSON.Parser.Bitstring.Number do
@doc """
parses a valid JSON numerical value, returns its elixir numerical representation
## Examples
iex> JSON.Parser.Bitstring.Number.parse ""
{:error, :unexpected_end_of_buffer}
iex> JSON.Parser.Bitstring.Number.parse "face0ff"
{:error, {:une... | elixir/codes-from-books/little-elixir/cap4/metex/deps/json/lib/json/parser/bitstring/number.ex | 0.562657 | 0.435601 | number.ex | starcoder |
defmodule Faker.Beer.En do
import Faker, only: [sampler: 2]
@moduledoc """
Functions for generating Beer related data in English
"""
@doc """
Returns a Beer brand string
## Examples
iex> Faker.Beer.En.brand()
"Paulaner"
iex> Faker.Beer.En.brand()
"Pabst Blue Ribbon"
iex> ... | lib/faker/beer/en.ex | 0.732592 | 0.419648 | en.ex | starcoder |
defmodule Membrane.AAC.Parser do
@moduledoc """
Parser for Advanced Audio Codec.
Supports both plain and ADTS-encapsulated output (configured by `out_encapsulation`).
Input with encapsulation `:none` is supported, but correct AAC caps need to be supplied with the stream.
Adds sample rate based timestamp to ... | lib/membrane/aac/parser.ex | 0.885835 | 0.620176 | parser.ex | starcoder |
defmodule TinyColor do
@moduledoc """
TinyColor is an elixir port of the javascript tinycolor2 library used to manipulate color values
and convert them to different color spaces. Alpha is supported for all color spaces.
Currently it supports RGB, HSV, HSL, and the OKLab color space. All supported color spaces ... | lib/tiny_color.ex | 0.936219 | 0.665404 | tiny_color.ex | starcoder |
defmodule Operate.Adapter.Bob do
@moduledoc """
Adapter module for loading tapes and Ops from [BOB](https://bob.planaria.network).
## Examples
iex> Operate.Adapter.Bob.fetch_tx(txid, api_key: "mykey")
{:ok, %Operate.BPU.Transaction{}}
"""
alias Operate.BPU
use Operate.Adapter
use Tesla, onl... | lib/operate/adapter/bob.ex | 0.738198 | 0.498657 | bob.ex | starcoder |
defmodule BackupHandler do
@moduledoc """
A module for keeping and periodically synchronizing a log of all orders not yet finished in the distributed system.
"""
use GenServer, restart: :permanent
require Logger
@backupRate Application.compile_env(:elevator, :backupRate)
# Public functions
# ----------... | elevator/lib/backupHandler.ex | 0.790126 | 0.432603 | backupHandler.ex | starcoder |
defmodule :gl do
# Private Types
@typep clamp :: float()
@typep enum :: non_neg_integer()
@typep matrix :: (matrix12() | matrix16())
@typep matrix12 :: {float(), float(), float(), float(), float(), float(), float(), float(), float(), float(), float(), float()}
@typep matrix16 :: {float(), float(), flo... | testData/org/elixir_lang/beam/decompiler/gl.ex | 0.905533 | 0.675987 | gl.ex | starcoder |
defmodule CCSP.Chapter5.GeneticAlgorithm do
alias __MODULE__, as: T
alias CCSP.Chapter5.Chromosome
@moduledoc """
Corresponds to CCSP in Python, Chapter 5, titled "Genetic Algorithms"
"""
@type c :: Chromosome.t()
@type t :: %T{
population: list(c),
threshold: float | integer,
... | lib/ccsp/chapter5/genetic_algorithm.ex | 0.849472 | 0.557002 | genetic_algorithm.ex | starcoder |
defmodule Membrane.RTP.Packet do
@moduledoc """
Defines a struct describing an RTP packet and a way to parse and serialize it.
Based on [RFC3550](https://tools.ietf.org/html/rfc3550#page-13)
"""
alias Membrane.RTP.{Header, Utils}
@type t :: %__MODULE__{
header: Header.t(),
payload: bin... | lib/membrane/rtp/packet.ex | 0.746231 | 0.454048 | packet.ex | starcoder |
defmodule Reactivity.DSL.Behaviour do
@moduledoc """
The DSL for distributed reactive programming,
specifically, operations applicable to Behaviours.
"""
alias Reactivity.DSL.SignalObs, as: Sobs
alias Reactivity.DSL.Signal, as: Signal
alias ReactiveMiddleware.Registry
alias Observables.Obs
require Lo... | lib/reactivity/dsl/behaviour.ex | 0.859502 | 0.624794 | behaviour.ex | starcoder |
defmodule Mars.Robot do
@moduledoc """
This module has a Mars Rover Robot that takes a list of actions (movements or
turns), and returns the new state of the robot
"""
alias Mars.Robot
@type action :: atom
@type position :: {number, number}
@type orientation :: atom
defstruct orientation: :north, posi... | lib/mars/robot.ex | 0.929328 | 0.864196 | robot.ex | starcoder |
defmodule SemanticLive do
@moduledoc """
Provides LiveView Semantic-UI components that function without the use of Javascript.
"""
import Phoenix.LiveView
@doc """
Renders a Dropdown LiveView. The form should be a `Phoenix.HTML.Form`. Expects `options`
to be a list of `{name, value}` tuples, and `opts` t... | lib/semantic_live.ex | 0.828454 | 0.512205 | semantic_live.ex | starcoder |
defmodule Erl2ex do
@moduledoc """
Erl2ex is an Erlang to Elixir transpiler, converting well-formed Erlang
source to Elixir source with equivalent functionality.
The goal is to produce correct, functioning Elixir code, but not necessarily
perfectly idiomatic. This tool may be used as a starting point when ... | lib/erl2ex.ex | 0.679923 | 0.47591 | erl2ex.ex | starcoder |
defmodule Benchmarks.GoogleMessage3.Message24346 do
@moduledoc false
use Protobuf, syntax: :proto2
end
defmodule Benchmarks.GoogleMessage3.Message24401 do
@moduledoc false
use Protobuf, syntax: :proto2
field :field24679, 1, optional: true, type: Benchmarks.GoogleMessage3.Message24400
end
defmodule Benchmar... | bench/lib/datasets/google_message3/benchmark_message3_4.pb.ex | 0.61682 | 0.423875 | benchmark_message3_4.pb.ex | starcoder |
defmodule Cashtrail.Banking do
@moduledoc """
The Banking context manages bank accounts and institutions.
"""
import Ecto.Query, warn: false
alias Cashtrail.Repo
alias Cashtrail.{Banking, Entities, Paginator}
import Cashtrail.Entities.Tenants, only: [to_prefix: 1]
import Cashtrail.QueryBuilder, only:... | apps/cashtrail/lib/cashtrail/banking.ex | 0.831725 | 0.467818 | banking.ex | starcoder |
defmodule Mole.Content.Condition do
use Private
import Kernel, except: [to_string: 1]
@moduledoc "Helper functions for conditions."
require Integer
# no learning, standard feedback
defp normal, do: 7
@eds [:abcd, :duckling, :none, :both]
@feedback [:motivational, :standard, :none]
# the cartesian p... | lib/mole/content/condition.ex | 0.830663 | 0.594051 | condition.ex | starcoder |
defmodule Geo.Utils do
@moduledoc false
use Bitwise
@doc """
Turns a hex string or an integer of base 16 into its floating point
representation.
Takes an optional endian atom. Either :xdr for big endian or :ndr for little
endian. Defaults to :xdr
# Examples
iex> Geo.Utils.hex_to_float("4000000... | lib/geo/utils.ex | 0.844136 | 0.622015 | utils.ex | starcoder |
if Code.ensure_loaded?(Plug) do
defmodule BtrzAuth.Plug.VerifyApiKey do
@moduledoc """
Looks for and validates a token found in the `x-api-key` header requesting the accounts service to verify the token and saving the resource in `conn.private[:account]`.
This, like all other Guardian plugs, requires a ... | lib/plug/verify_api_key.ex | 0.781956 | 0.815122 | verify_api_key.ex | starcoder |
defmodule EliVndb.Client do
@moduledoc """
VNDB API Client Module.
[VNDB API Refernce](https://vndb.org/d11)
## `EliVndb.Client` types
### Global
In order to start global client use `EliVndb.Client.start_link/1` or `EliVndb.Client.start_link/3` without options or with `:global` set to true.
Since the ... | lib/vndb/client.ex | 0.8575 | 0.497742 | client.ex | starcoder |
defmodule Kaur.Environment do
@moduledoc """
Utilities for working with configuration allowing environment variables.
* `{:system, something}`: will load the environment variable stored in `something`
* `value`: will return the value
"""
alias Kaur.Result
@doc ~S"""
Reads the value or environment var... | lib/kaur/environment.ex | 0.814938 | 0.407687 | environment.ex | starcoder |
defmodule Explot do
@docmodule """
The main module of this package. It provides an easy way to use Python's Matplotlib.
It allows to send arbitrary commands to be interpreted by Python.
It also provides functions to make it easy to use the most common functionality of Matplotlib.
There will be more functions ... | lib/explot.ex | 0.656548 | 0.758108 | explot.ex | starcoder |
defmodule LiveViewStudio.Flights do
def search_by_number(number) do
list_flights()
|> Enum.filter(&(&1.number == number))
end
def search_by_airport(airport) do
list_flights()
|> Enum.filter(&(&1.origin == airport || &1.destination == airport))
end
def list_flights do
[
%{
n... | live_view_studio/lib/live_view_studio/flights.ex | 0.544075 | 0.548855 | flights.ex | starcoder |
defmodule ComplexNum do
@moduledoc """
Complex Numbers.
## Cartesian vs Polar
There are two kinds of representaions for Complex Numbers:
- Cartesian, of the form `a + bi`. (Storing the `real` and `imaginary` parts of the complex number)
- Polar, of the form `r * e^(i*phi)`. (storing the `magnitude` and th... | lib/complex_num.ex | 0.941574 | 0.92597 | complex_num.ex | starcoder |
defmodule AWS.WorkMail do
@moduledoc """
Amazon WorkMail is a secure, managed business email and calendaring service
with support for existing desktop and mobile email clients. You can access
your email, contacts, and calendars using Microsoft Outlook, your browser,
or other native iOS and Android email appl... | lib/aws/generated/work_mail.ex | 0.704364 | 0.519399 | work_mail.ex | starcoder |
defmodule HAP.AccessoryServer do
@moduledoc """
Represents a top-level HAP instance configuration
"""
defstruct display_module: nil,
data_path: nil,
name: nil,
model: nil,
identifier: nil,
pairing_code: nil,
setup_id: nil,
acce... | lib/hap/accessory_server.ex | 0.885148 | 0.423339 | accessory_server.ex | starcoder |
defmodule Spla2API do
@moduledoc """
Wrapper for Spla2 API.
@see https://spla2.yuu26.com/
"""
alias __MODULE__.Struct.{Coop, Stages, Stage}
defstruct [:result]
@rules [:regular, :gachi, :league]
@type rules :: :regular | :gachi | :league
@options [:now, :next, :next_all, :schedule]
@type options... | apps/spla2_api/lib/spla2_api.ex | 0.707708 | 0.427576 | spla2_api.ex | starcoder |
defmodule Opencensus.Honeycomb.Event do
@moduledoc """
Event structure.
Honeycomb events bind a timestamp to data as described in `t:t/0` below. The `data` corresponds
to Opencensus span attributes, with limitations dictated by the intersection of OpenCensus' and
Honeycomb's data models.
## Supported Valu... | lib/opencensus/honeycomb/event.ex | 0.924543 | 0.843573 | event.ex | starcoder |
defmodule Linguist.MemorizedVocabulary do
alias Linguist.Compiler
alias Linguist.{LocaleError, NoTranslationError}
defmodule TranslationDecodeError do
defexception [:message]
end
@pluralization_key Application.get_env(:linguist, :pluralization_key, :count)
if Application.get_env(:linguist, :vocabular... | lib/linguist/memorized_vocabulary.ex | 0.729423 | 0.418073 | memorized_vocabulary.ex | starcoder |
defmodule ExUnited.Spawn do
@moduledoc """
This module is used by `ExUnited` to spawn nodes for testing purposes.
`ExUnited.Spawn` uses the Elixir `Port` module for spawning and as it
implements the GenServer behaviour it is able to store state containing
information about the spawn nodes.
You will probab... | lib/ex_united/spawn.ex | 0.77675 | 0.456652 | spawn.ex | starcoder |
defmodule Shippex do
@moduledoc """
Module documentation for `Shippex`.
"""
alias Shippex.{Address, Carrier, Config, Rate, Service, Shipment, Transaction}
@type response() :: %{code: String.t(), message: String.t()}
@doc """
Fetches rates for a given `shipment`. Possible options:
* `carriers` - Fe... | lib/shippex.ex | 0.904595 | 0.603932 | shippex.ex | starcoder |
defmodule Crux.Structs.Util do
@moduledoc """
Collection of util functions.
"""
alias Crux.Structs
if Version.compare(System.version(), "1.7.0") != :lt do
@moduledoc since: "0.1.0"
end
@doc ~s"""
Converts a string, likely Discord snowflake, to an integer
## Examples
```elixir
# A st... | lib/structs/util.ex | 0.871283 | 0.625896 | util.ex | starcoder |
defmodule RoboticaCommon.Date do
@moduledoc """
Provides data/time functions for Robotica.
"""
@spec get_timezone :: String.t()
def get_timezone, do: Application.get_env(:robotica_common, :timezone)
@doc """
Converts an UTC date time to a local Date for today.
Note: 13:00 UTC is midnight in Australia... | robotica_common/lib/date.ex | 0.743075 | 0.472318 | date.ex | starcoder |
defmodule Comeonin do
@moduledoc """
Defines a behaviour for higher-level password hashing functions.
"""
@type opts :: keyword
@type password :: binary
@type user_struct :: map | nil
@doc """
Hashes a password and returns the password hash in a map.
"""
@callback add_hash(password, opts) :: map
... | deps/comeonin/lib/comeonin.ex | 0.879374 | 0.477798 | comeonin.ex | starcoder |
defmodule Crux.Structs.Member do
@moduledoc """
Represents a Discord [Guild Member Object](https://discord.com/developers/docs/resources/guild#guild-member-object).
Differences opposed to the Discord API Object:
- `:user` is just the user id
"""
@moduledoc since: "0.1.0"
@behaviour Crux.Structs
ali... | lib/structs/member.ex | 0.820829 | 0.691823 | member.ex | starcoder |
defmodule Cog.Commands.Sort do
use Cog.Command.GenCommand.Base,
bundle: Cog.Util.Misc.embedded_bundle
alias Cog.Command.Service.MemoryClient
@description "Sort inputs by field"
@long_description """
Fields are used to pick which values to sort by. If two keys have the same
value the values of the nex... | lib/cog/commands/sort.ex | 0.649023 | 0.566049 | sort.ex | starcoder |
defmodule Game.Phase.Resolution do
@moduledoc """
Player's dices face off against each other
and previously selected God Favors are triggered before
and/or after the standoff
"""
@behaviour Game.Phase
alias Game.{
Player,
Phase,
Turn,
Action,
Favor
}
@impl Game.Phase
@spec acti... | src/server/lib/game/phase/resolution.ex | 0.856932 | 0.441974 | resolution.ex | starcoder |
defmodule CatalogApi.Category do
@moduledoc """
Defines the CatalogApi.Category struct and functions which are responsible
for parsing categories from CatalogApi responses.
"""
alias CatalogApi.Category
@derive Jason.Encoder
defstruct category_id: nil,
children: [],
depth: 1,
... | lib/catalog_api/category.ex | 0.835584 | 0.40489 | category.ex | starcoder |
defmodule Interceptor do
@moduledoc """
See <NAME>'s LispCast Blog article:
[A Model of Interceptors](https://lispcast.com/a-model-of-interceptors/)
and the [interceptor](https://github.com/exoscale/interceptor)
library as inspirations.
The idea of interceptors is similar to that of middleware, they define... | lib/interceptor.ex | 0.776242 | 0.663786 | interceptor.ex | starcoder |
defmodule Stompex.Validator do
@moduledoc """
The Validator module can be used for ensuring that
frames being sent to the STOMP server are valid.
Primarily, the reason for a frame being invalid is
due to the version of the protocol being used, as
you should not really be building frames up directly
yourse... | lib/stompex/validator.ex | 0.759315 | 0.441854 | validator.ex | starcoder |
defmodule PhoenixComponents.View do
@moduledoc """
This module provides a way to easily generate helper functions to render
components.
The module can be included by others Phoenix.View modules to import components easily.
## Example
When working on a project with several components you can use this modu... | lib/phoenix_components/view.ex | 0.843057 | 0.588682 | view.ex | starcoder |
defmodule Plausible.Stats.Clickhouse do
use Plausible.Repo
alias Plausible.Stats.Query
alias Plausible.Clickhouse
@no_ref "Direct / None"
def compare_pageviews_and_visitors(site, query, {pageviews, visitors}) do
query = Query.shift_back(query)
{old_pageviews, old_visitors} = pageviews_and_visitors(si... | lib/plausible/stats/clickhouse.ex | 0.616243 | 0.411879 | clickhouse.ex | starcoder |
defmodule OMG.ChildChain.Fees.JSONSingleSpecParser do
@moduledoc """
Parsing module for a single fee spec
"""
require Logger
# the fee spec for a specific type/token is missing keys
@type parsing_error() ::
:invalid_fee_spec
# the fee amount is invalid (must be >= 0)
| :invali... | apps/omg_child_chain/lib/omg_child_chain/fees/json_single_spec_parser.ex | 0.832203 | 0.417123 | json_single_spec_parser.ex | starcoder |
defmodule Wallaby.Phantom do
@moduledoc """
Wallaby driver for PhantomJS.
## Usage
Start a Wallaby Session using this driver with the following command:
```
{:ok, session} = Wallaby.start_session()
```
## Notes
This driver requires PhantomJS be installed in your path. You can install PhantomJS th... | lib/wallaby/phantom.ex | 0.765637 | 0.609989 | phantom.ex | starcoder |
defmodule SpandexPhoenix.Telemetry do
@moduledoc """
Defines the `:telemetry` handlers to attach tracing to Phoenix Telemetry.
See `install/1` documentation for usage.
"""
alias Spandex.SpanContext
@doc """
Installs `:telemetry` event handlers for Phoenix Telemetry events.
`Plug.Telemetry` must be i... | lib/spandex_phoenix/telemetry.ex | 0.846467 | 0.500305 | telemetry.ex | starcoder |
defmodule PromEx.Plugins.Beam do
@moduledoc """
Telemetry metrics for the BEAM.
This plugin captures metrics regarding the Erlang Virtual Machine (i.e the BEAM). Specifically, it captures metrics
regarding the CPU topology, system limits, VM feature support, scheduler information, memory utilization, distribut... | lib/prom_ex/plugins/beam.ex | 0.818845 | 0.78469 | beam.ex | starcoder |
defmodule Bnf do
@doc """
iex> Bnf.count_valid(Bnf.sample())
2
"""
def count_valid(input) do
[a, b] = String.split(input, "\n\n", trim: true)
regex =
a
|> parse_grammar()
|> build_regex_string()
|> Regex.compile!()
String.split(b, "\n", trim: true)
|> Enum.count(&Rege... | 19-Bnf/lib/bnf.ex | 0.542863 | 0.407923 | bnf.ex | starcoder |
defmodule Protobuf.JSON do
@moduledoc """
JSON encoding and decoding utilities for Protobuf structs.
It follows Google's [specs](https://developers.google.com/protocol-buffers/docs/proto3#json)
and reference implementation. Some features
such as [well-known](https://developers.google.com/protocol-buffers/doc... | lib/protobuf/json.ex | 0.943608 | 0.704201 | json.ex | starcoder |
defmodule GGity.Axis do
@moduledoc false
alias GGity.{Draw, Labels, Plot, Scale}
@spec draw_x_axis(Plot.t()) :: iolist()
def draw_x_axis(%Plot{} = plot) do
[x_axis_line(plot), x_gridlines(plot), x_ticks(plot), draw_x_axis_label(plot)]
end
defp x_axis_line(%Plot{} = plot) do
length = plot.width + ... | lib/ggity/axis.ex | 0.884639 | 0.574275 | axis.ex | starcoder |
defmodule ZipperTree do
@moduledoc """
Provides traversal and modification methods for variadic arity trees. All
methods maintain an active 'cursor' or focus in the tree. The methods will
also technically work for lists too - I guess, if you're into that sorta
thing.
All traversal and insertion methods hap... | lib/zipper_tree.ex | 0.857649 | 0.719088 | zipper_tree.ex | starcoder |
defmodule Grakn do
@moduledoc """
The main entry point for interacting with Grakn. All functions take a connection reference.
"""
@typedoc """
A connection process name, pid or reference.
A connection reference is used when making multiple requests within a transaction, see `transaction/3`.
"""
@type c... | lib/grakn.ex | 0.952596 | 0.746601 | grakn.ex | starcoder |
defmodule AdventOfCode.Day04 do
@moduledoc """
Day 4.
Repose Record.
Part 1: Find the guard that has the most minutes of sleep.
Part 2: Find the guard and the minute that has the highest frequency of slept time.
"""
@day4 Path.join(["day04.txt"])
def read do
data =
File.stream!(@day4, [], :l... | 2018/elixir/advent_of_code/lib/day04/day04.ex | 0.688678 | 0.528594 | day04.ex | starcoder |
defmodule X.Parser do
@moduledoc """
X template parser module.
"""
alias X.Ast
defguardp is_text_token(token) when elem(token, 0) in [:tag_text, :tag_output]
@doc ~S"""
Converts given tokens into X template AST.
## Example
iex> X.Parser.call([
...> {:tag_start, {1, 1}, 'div', [], nil, n... | lib/x/parser.ex | 0.79166 | 0.419321 | parser.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.