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 Realm.Apply do
@moduledoc """
An extension of `Realm.Functor`, `Apply` provides a way to _apply_ arguments
to functions when both are apply in the same kind of container. This can be
seen as running function application "in a context".
For a nice, illustrated introduction,
see [Functors, Applica... | lib/realm/apply.ex | 0.88786 | 0.695836 | apply.ex | starcoder |
defmodule ApiWeb.Presence do
@moduledoc """
Provides presence tracking to channels and processes.
See the [`Phoenix.Presence`](http://hexdocs.pm/phoenix/Phoenix.Presence.html)
docs for more details.
## Usage
Presences can be tracked in your channel after joining:
defmodule Api.MyChannel do
... | api/lib/api_web/channels/presence.ex | 0.837321 | 0.416114 | presence.ex | starcoder |
if match?({:module, _}, Code.ensure_compiled(ExAws.S3)) do
defmodule Trunk.Storage.S3 do
@moduledoc """
A `Trunk.Storage` implementation for Amazon’s S3 service.
"""
@behaviour Trunk.Storage
@doc ~S"""
Saves the file to Amazon S3.
- `directory` - The directory (will be combined with the... | lib/trunk/storage/s3.ex | 0.780579 | 0.730891 | s3.ex | starcoder |
defmodule Mgp.Utils do
@default_date Date.from_iso8601!("2016-10-01")
@default_time Time.from_iso8601!("08:00:00")
def pluck(list, []), do: list
def pluck([], _), do: []
def pluck(list, indexes), do: pluck(list, indexes, 0, [])
def pluck(_, [], _, agg), do: :lists.reverse(agg)
def pluck([], _, _, agg), d... | lib/mgp/utils.ex | 0.682045 | 0.431405 | utils.ex | starcoder |
defmodule BlobFont.CLI do
@moduledoc """
BlobFont is a utility to convert BMFont files into blob
font files.
usage:
blob_font [options] [file]
Options:
* `--help`, `-h` - Prints this message and exits
* `--newline`, `-n` - Add a newline letter
* `--tab`, `-t` - Ad... | lib/blob_font/cli.ex | 0.697815 | 0.417984 | cli.ex | starcoder |
defmodule IO do
@moduledoc """
Module responsible for doing IO. The function in this
module expects an iodata as argument encoded in UTF-8.
An iodata can be:
* A list of integers representing a string. Any unicode
character must be represented with one entry in the list,
this entry being an integer w... | lib/elixir/lib/io.ex | 0.820613 | 0.670244 | io.ex | starcoder |
defmodule OpenLocationCode do
@pair_code_length 10
@separator "+"
@separator_position 8
@padding "0"
@latitude_max 90
@longitude_max 180
@code_alphabet "23456789CFGHJMPQRVWX"
#The resolution values in degrees for each position in the lat/lng pair
#encoding. Thes... | lib/openlocationcode.ex | 0.698946 | 0.574096 | openlocationcode.ex | starcoder |
defmodule RayTracer.Light do
@moduledoc """
This module defines light sources
"""
alias RayTracer.RTuple
alias RayTracer.Color
alias RayTracer.Material
alias RayTracer.Pattern
alias RayTracer.Shape
import RTuple, only: [normalize: 1, reflect: 2]
@type t :: %__MODULE__{
position: RTuple.point,... | lib/light.ex | 0.93744 | 0.570989 | light.ex | starcoder |
defmodule Prometheus.Collector do
@moduledoc """
A collector for a set of metrics.
Normal users should use `Prometheus.Metric.Gauge`, `Prometheus.Metric.Counter`,
`Prometheus.Metric.Summary`
and `Prometheus.Metric.Histogram`.
Implementing `:prometheus_collector` behaviour is for advanced uses such as prox... | astreu/deps/prometheus_ex/lib/prometheus/collector.ex | 0.882117 | 0.844985 | collector.ex | starcoder |
defmodule VintageNet.RouteManager do
use GenServer
require Logger
alias VintageNet.Interface.Classification
alias VintageNet.Route.{Calculator, InterfaceInfo, IPRoute, Properties}
@moduledoc """
This module manages the default route.
Devices with more than one network interface may have more than one
... | lib/vintage_net/route_manager.ex | 0.854824 | 0.491578 | route_manager.ex | starcoder |
defmodule P6 do
@moduledoc """
[K, N]区間内の素数に対して、尺取り法を用いて、ハッシュ関数を満たす最大数列を探す。
# Examples
> P6.solve(2, 2)
2
> P6.solve(1, 11)
3
> P6.solve(10, 100)
31
"""
import Integer, only: [is_odd: 1]
def main do
k = IO.read(:line) |> String.trim() |> String.to_integer()
n = IO.read(:l... | lib/100/p6.ex | 0.674801 | 0.551272 | p6.ex | starcoder |
defmodule Node do
@moduledoc """
Functions related to VM nodes.
Some of the functions in this module are inlined by the compiler,
similar to functions in the `Kernel` module and they are explicitly
marked in their docs as "inlined by the compiler". For more information
about inlined functions, check out th... | lib/elixir/lib/node.ex | 0.888961 | 0.72526 | node.ex | starcoder |
defmodule Snitch.Data.Schema.PromotionRule.OrderTotal do
@moduledoc """
Models the `promotion rule` based on order total.
"""
use Snitch.Data.Schema
use Snitch.Data.Schema.PromotionRule
alias Snitch.Domain.Order, as: OrderDomain
@type t :: %__MODULE__{}
@name "Order Item Total"
embedded_schema do
... | apps/snitch_core/lib/core/data/schema/promotion/promotion_rule/order_total.ex | 0.871283 | 0.525551 | order_total.ex | starcoder |
defmodule Ecto.Date do
@moduledoc """
An Ecto type for dates.
"""
defstruct [:year, :month, :day]
@doc """
Converts an `Ecto.Date` into a date triplet.
"""
def to_erl(%Ecto.Date{year: year, month: month, day: day}) do
{year, month, day}
end
@doc """
Converts a date triplet into an `Ecto.Dat... | lib/ecto/datetime.ex | 0.892924 | 0.74008 | datetime.ex | starcoder |
defmodule Oli.Delivery.Hierarchy do
@moduledoc """
A module for hierarchy and HierarchyNode operations and utilities
A delivery hierarchy is the main structure in which a course curriculum is organized
to be delivered. It is mainly persisted through section resource records. A hierarchy is
also a generic in-... | lib/oli/delivery/hierarchy.ex | 0.723016 | 0.55911 | hierarchy.ex | starcoder |
defmodule Helper.Parser do
@moduledoc false
defmacro parser(country, code) do
quote do
@doc """
Same as `parse/1` but the number doesn't have the international code, instead you specify country as an atom with two-letters code.
For NANP countries you can use the atom `:nanp` or two-letter c... | lib/helpers/parser.ex | 0.874808 | 0.833731 | parser.ex | starcoder |
defmodule Cassette.Controller do
@moduledoc """
A helper module to quickly validate roles and get the current user
To use in your controller, add as a plug restricting the actions:
```elixir
defmodule MyApp.MyController do
use MyApp.Web, :controller
use Cassette.Controller
plug :require_role!,... | lib/cassette/controller.ex | 0.832475 | 0.645518 | controller.ex | starcoder |
defmodule Tai.Venues.Product do
@type status ::
:unknown
| :pre_trading
| :trading
| :restricted
| :post_trading
| :end_of_day
| :halt
| :auction_match
| :break
| :settled
| :unlisted
@typedoc """
The pr... | apps/tai/lib/tai/venues/product.ex | 0.8471 | 0.544256 | product.ex | starcoder |
defmodule Harald.HCI do
@moduledoc """
> The HCI provides a uniform interface method of accessing a Bluetooth Controller’s
> capabilities.
Reference: Version 5.0, Vol. 2, Part E, 1
"""
alias Harald.{HCI.Event, Serializable}
@behaviour Serializable
@typedoc """
OpCode Group Field.
See `t:opcode/... | lib/harald/hci.ex | 0.887266 | 0.602325 | hci.ex | starcoder |
defmodule Plaid.Item do
@moduledoc """
Functions for Plaid `item` endpoint.
"""
import Plaid, only: [make_request_with_cred: 4, validate_cred: 1]
alias Plaid.Utils
@derive Jason.Encoder
defstruct available_products: [],
billed_products: [],
error: nil,
institution_id... | lib/plaid/item.ex | 0.816991 | 0.629632 | item.ex | starcoder |
defmodule Mix.Tasks.Absinthe.Gen.Resolver do
use Mix.Task
alias Mix.AbsintheGeneratorUtils
@shortdoc "Generates an absinthe resolver"
@moduledoc """
Generates an Absinthe Schema
### Options
#{NimbleOptions.docs(AbsintheGenerator.Resolver.definitions())}
### Specifying Middleware
To specify middl... | lib/mix/tasks/resolver.ex | 0.791378 | 0.675641 | resolver.ex | starcoder |
defmodule ListDict do
@moduledoc """
A Dict implementation that works on lists of two-items tuples.
This dictionary is only recommended for keeping a small amount
of values. Other dict alternatives are more viable for keeping
any other amount than a handful.
For more information about the functions and th... | lib/elixir/lib/list_dict.ex | 0.647464 | 0.558809 | list_dict.ex | starcoder |
defmodule PandaDoc do
@moduledoc """
Documentation for `PandaDoc` which provides an API for pandadoc.com.
## Installation
This package can be installed by adding `pandadoc` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:pandadoc, "~> 0.1.2"}]
end
```
## Configuration
Pu... | lib/panda_doc.ex | 0.772659 | 0.783658 | panda_doc.ex | starcoder |
defmodule Day12.Instruction do
@moduledoc """
Parses an instruction.
"""
@copy_number ~r{cpy (\d+) ([a-d])}
@copy_register ~r{cpy ([a-d]) ([a-d])}
@increment ~r{inc ([a-d])}
@decrement ~r{dec ([a-d])}
@jump_if_non_zero ~r{jnz ([a-d]) (-?\d+)}
@jump_numbers ~r{jnz (-?\d+) (-?\... | 2016/day12/lib/day12/instruction.ex | 0.517571 | 0.408336 | instruction.ex | starcoder |
defmodule Money.Backend do
@moduledoc false
def define_money_module(config) do
module = inspect(__MODULE__)
backend = config.backend
config = Macro.escape(config)
quote location: :keep, bind_quoted: [module: module, backend: backend, config: config] do
defmodule Money do
@moduledoc f... | lib/money/backend.ex | 0.876476 | 0.484746 | backend.ex | starcoder |
defmodule Naboo.Domains do
@moduledoc """
The Domain context.
"""
import Ecto.Query, warn: false
alias Naboo.Repo
alias Naboo.Domain.Address
alias Naboo.Domain.Node
@doc """
Returns the list of all nodes.
## Examples
iex> list_nodes()
[%Node{}, ...]
"""
def list_nodes(), do: Repo.all(N... | lib/naboo/domain/domains.ex | 0.877306 | 0.436502 | domains.ex | starcoder |
defmodule Pushex.GCM.Request do
@moduledoc """
`Pushex.GCM.Request` represents a request that will be sent to GCM.
It contains the notification, and all the metadata that can be sent with it.
Only the key with a value will be sent to GCM, so that the proper default
are used.
"""
use Vex.Struct
defstr... | lib/pushex/gcm/request.ex | 0.711832 | 0.517571 | request.ex | starcoder |
defmodule StarkInfra.IssuingInvoice do
alias __MODULE__, as: IssuingInvoice
alias StarkInfra.Utils.Rest
alias StarkInfra.Utils.Check
alias StarkInfra.User.Project
alias StarkInfra.User.Organization
alias StarkInfra.Error
@moduledoc """
# IssuingInvoice struct
"""
@doc """
The IssuingInvoice st... | lib/issuing_invoice/issuing_invoice.ex | 0.887052 | 0.588948 | issuing_invoice.ex | starcoder |
defmodule ExWikipedia.Page do
@moduledoc """
`ExWikipedia.page/2` delegates here. This module represents the current
implementation.
"""
@behaviour ExWikipedia
@follow_redirect true
@default_http_client HTTPoison
@default_json_parser Jason
@default_status_key :status_code
@default_body_key :body
... | lib/ex_wikipedia/page/page.ex | 0.869077 | 0.403097 | page.ex | starcoder |
defmodule EllipticCurve.Signature do
@moduledoc """
Used to convert signature between struct (raw numbers r and s) and .der or .pem formats.
Functions:
- fromBase64()
- fromBase64!()
- fromDer()
- fromDer!()
- toBase64()
- toDer()
"""
alias __MODULE__, as: Signature
alias EllipticCurve.Utils.{... | lib/signature.ex | 0.929927 | 0.509459 | signature.ex | starcoder |
defmodule Drunkard.Recipes do
@moduledoc """
The Recipes context.
"""
import Ecto.Query, warn: false
alias Drunkard.Repo
alias Drunkard.Recipes.Slug
alias Drunkard.Recipes.Ingredient
@doc """
Returns the list of ingredients.
## Examples
iex> list_ingredients()
[%Ingredient{}, ...]
... | lib/drunkard/recipes.ex | 0.787646 | 0.447943 | recipes.ex | starcoder |
defimpl Timex.Protocol, for: Date do
@moduledoc """
This module represents all functions specific to creating/manipulating/comparing Dates (year/month/day)
"""
use Timex.Constants
import Timex.Macros
@epoch_seconds :calendar.datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}})
def to_julian(%Date{:y... | lib/date/date.ex | 0.74872 | 0.64058 | date.ex | starcoder |
defmodule Brex.Rule do
@moduledoc """
The behaviour for module based rules which requires an `evaluate/1` function.
Also offers some helpful functions to deal with all kinds of rules.
Furthermore contains the `Brex.Rule.Evaluable` protocol which represents the
basic building block of `Brex`. Currently suppor... | lib/brex/rule.ex | 0.919615 | 0.693577 | rule.ex | starcoder |
defmodule Memory do
@moduledoc """
Module for working with the VM's internal memory.
The VM's internal memory is indexed (chunked) every 32 bytes,
thus represented with a mapping between index and a 32-byte integer (word).
Data from the memory can be accessed at byte level.
"""
use Bitwise
@chunk_si... | apps/aevm/lib/memory.ex | 0.840292 | 0.637003 | memory.ex | starcoder |
defmodule VintageNet.IP.DhcpdConfig do
@moduledoc """
This is a helper module for VintageNet.Technology implementations that use
a DHCP server.
DHCP server parameters are:
* `:start` - Start of the lease block
* `:end` - End of the lease block
* `:max_leases` - The maximum number of leases
* `:decline... | lib/vintage_net/ip/dhcpd_config.ex | 0.864732 | 0.726523 | dhcpd_config.ex | starcoder |
defmodule AWS.AppConfig do
@moduledoc """
AWS AppConfig
Use AWS AppConfig, a capability of AWS Systems Manager, to create, manage, and
quickly deploy application configurations.
AppConfig supports controlled deployments to applications of any size and
includes built-in validation checks and monitoring. Y... | lib/aws/generated/app_config.ex | 0.887778 | 0.488954 | app_config.ex | starcoder |
defmodule Bitcraft do
@moduledoc """
The following are the main Bitcraft components:
* `Bitcraft.BitBlock` - This is the main Bitcraft component. It provides
a DSL that allows to define bit-blocks with their segments (useful for
building binary protocols) and automatically injects encoding and deco... | lib/bitcraft.ex | 0.941372 | 0.705506 | bitcraft.ex | starcoder |
defmodule AdventOfCode.Day05 do
import AdventOfCode.Utils
@type coordinate :: {integer(), integer()}
@type vent :: {coordinate(), coordinate()}
@type heatmap :: %{required(coordinate()) => integer()}
@spec part1([binary()]) :: integer()
def part1(args) do
parse_args(args)
|> number_intersections(:... | lib/advent_of_code/day_05.ex | 0.799286 | 0.543893 | day_05.ex | starcoder |
defmodule AdventOfCode2019.CarePackage do
@moduledoc """
Day 13 — https://adventofcode.com/2019/day/13
"""
require AdventOfCode2019.IntcodeComputer
@spec part1(Enumerable.t()) :: integer
def part1(in_stream) do
in_stream
|> load_program()
|> play()
|> List.first()
end
@spec part2(Enum... | lib/advent_of_code_2019/day13.ex | 0.837387 | 0.506836 | day13.ex | starcoder |
defmodule Beacon.Chain.Params do
@moduledoc """
Defines global parameters for ETH 2.0 as defined in the specifiction:
https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/beacon-chain.md
"""
values = [
# Misc
eth1_follow_distance: :math.pow(2, 10),
max_committes_per_slot: :math.pow(2, 6... | apps/panacea_beacon/lib/panacea_beacon/chain/params.ex | 0.810929 | 0.71222 | params.ex | starcoder |
defmodule GraphQL.Schema do
@type t :: %GraphQL.Schema{
query: Map,
mutation: Map,
type_cache: Map,
directives: [GraphQL.Type.Directive.t]
}
alias GraphQL.Type.Input
alias GraphQL.Type.Interface
alias GraphQL.Type.Union
alias GraphQL.Type.ObjectType
alias GraphQL.Type.Introspection
ali... | lib/graphql/type/schema.ex | 0.541166 | 0.464476 | schema.ex | starcoder |
defmodule Asciichart do
@moduledoc """
ASCII chart generation.
Ported to Elixir from [https://github.com/kroitor/asciichart](https://github.com/kroitor/asciichart)
"""
@doc ~S"""
Generates a chart for the specified list of numbers.
Optionally, the following settings can be provided:
* :offset -... | lib/asciichart.ex | 0.841598 | 0.624279 | asciichart.ex | starcoder |
defmodule MazeServer.MazeAi do
@moduledoc """
this is an AI for maze game that developed with elixir
it solve maze with this algorithms:
* Breadth-first search (BFS)
* Iterative deepening depth-first search (IDS)
* A* search (A Star)
all of this algorithms will use graph search algorithm with ** special *... | lib/maze_server/maze_ai.ex | 0.849316 | 0.673822 | maze_ai.ex | starcoder |
defmodule Zaryn.Mining.ValidationContext do
@moduledoc """
Represent the transaction validation workflow state
"""
defstruct [
:transaction,
:previous_transaction,
:welcome_node,
:coordinator_node,
:cross_validation_nodes,
:validation_stamp,
unspent_outputs: [],
cross_validation... | lib/zaryn/mining/validation_context.ex | 0.875088 | 0.566318 | validation_context.ex | starcoder |
defmodule Certbot.Acme.Plug do
@moduledoc """
Plug used to intercept challenge verification calls on the request path
`/.well-known/acme-challenge/<token>`.
The plug can be placed early in the pipeline. When using Phoenix, it should
be placed before your router in your `endpoint.ex`.
If you plan on redire... | lib/certbot/acme/plug.ex | 0.854733 | 0.720835 | plug.ex | starcoder |
defmodule EllipticCurve.PrivateKey do
@moduledoc """
Used to create private keys or convert them between struct and .der or .pem formats. Also allows creations of public keys from private keys.
Functions:
- generate()
- toPem()
- toDer()
- fromPem()
- fromPem!()
- fromDer()
- fromDer!()
"""
al... | lib/privateKey/privateKey.ex | 0.939512 | 0.438184 | privateKey.ex | starcoder |
defmodule Conejo.Consumer do
@moduledoc """
`Conejo.Consumer` is the behaviour which will help you to implement your own RabbitMQ consumers.
### Configuration
Conejo.Consumer needs a configuration in the environment files.
Example:
```elixir
config :my_application, :consumer,
exchange: "my_exchange"... | lib/conejo/consumer.ex | 0.89501 | 0.785185 | consumer.ex | starcoder |
defmodule Zstream do
@moduledoc """
Module for reading and writing ZIP file stream
## Example
```
Zstream.zip([
Zstream.entry("report.csv", Stream.map(records, &CSV.dump/1)),
Zstream.entry("catfilm.mp4", File.stream!("/catfilm.mp4", [], 512), coder: Zstream.Coder.Stored)
])
|> Stream.into(File.s... | lib/zstream.ex | 0.880129 | 0.870212 | zstream.ex | starcoder |
defmodule Solid.Expression do
@moduledoc """
Expression evaluation for the following binary operators:
== != > < >= <=
Also combine expressions with `and`, `or`
"""
alias Solid.Argument
@type value :: number | iolist | boolean | nil
@doc """
Evaluate a single expression
iex> Solid.Expression.ev... | lib/solid/expression.ex | 0.720565 | 0.488405 | expression.ex | starcoder |
defmodule Pummpcomm.Cgm.Timestamper do
@moduledoc """
Adds timestamps to events based on the preceeding timestamps or timestamped events in a series of events
"""
# Constants
@relative_events [
:sensor_weak_signal,
:sensor_calibration,
:sensor_glucose_value,
:sensor_data_low,
:sensor_dat... | lib/pummpcomm/cgm/timestamper.ex | 0.824144 | 0.626267 | timestamper.ex | starcoder |
defmodule Learn.CourseUser do
# Struct for a v1 CourseUser
defstruct [:userId, :courseId, :childCourse, :dataSourceId, :availability, :courseRoleId, :user, :course]
@doc """
{
"userId": "string",
"courseId": "string",
"childCourseId": "string",
"dataSourceId": "string",
"created": "2019-04... | lib/learn/course_user.ex | 0.543106 | 0.473049 | course_user.ex | starcoder |
defmodule NodePing.Results do
@moduledoc """
Get check results and uptime information
"""
alias NodePing.Helpers, as: Helpers
alias NodePing.HttpRequests, as: HttpRequests
@api_url "https://api.nodeping.com/api/1"
@results_path "/results"
@uptime_path "/results/uptime"
@current_path "/results/curren... | lib/results.ex | 0.867514 | 0.46393 | results.ex | starcoder |
defmodule ECS.System do
@moduledoc """
Functions to setup and control systems.
# Basic Usage
A system iterates over entities with certain components, defined in
`component_keys/0`, and calls `perform/1` on each entity. `perform/1` should
return the entity_pid when the entity should continue to exist in th... | lib/ecs/system.ex | 0.882225 | 0.695467 | system.ex | starcoder |
defmodule Model.Schedule do
@moduledoc """
The arrival drop off (`drop_off_type`) time (`arrival_time`) and departure pick up (`pickup_type`) time
(`departure_time`) to/from a stop (`stop_id`) at a given sequence (`stop_sequence`) along a trip (`trip_id`) going in
a direction (`direction_id`) along a route (`ro... | apps/model/lib/model/schedule.ex | 0.871775 | 0.623979 | schedule.ex | starcoder |
defmodule Timex.Parsers.DateFormat.Directive do
@moduledoc """
This module defines parsing directives for all date/time
tokens timex knows about. It is composed of a Directive struct,
containing the rules for parsing a given token, and a `get/1`
function, which fetches a directive for a given token value, i... | lib/parsers/dateformat/directive.ex | 0.906314 | 0.721363 | directive.ex | starcoder |
defmodule RDF.Triple do
@moduledoc """
Helper functions for RDF triples.
A RDF Triple is represented as a plain Elixir tuple consisting of three valid
RDF values for subject, predicate and object.
"""
alias RDF.Statement
@type t :: {Statement.subject, Statement.predicate, Statement.object}
@type coe... | lib/rdf/triple.ex | 0.841891 | 0.739799 | triple.ex | starcoder |
defmodule ExCrud do
@moduledoc """
A module that injects crud based functions into a context module for use in Ecto based applications
Call the `use ExCrud` macro to inject crud functions into the context module
In each Context Module - you want to use the crud functions
----------------------------... | lib/ex_crud.ex | 0.906852 | 0.629888 | ex_crud.ex | starcoder |
defmodule Currency do
@moduledoc """
Represents a Currency type accordingly to ISO 4217
"""
alias __MODULE__, as: Currency
alias Repository.CurrencyRepository, as: CurrencyRepository
defstruct alpha_code: "BRL",
numeric_code: 986,
exponent: 2,
name: "Brazilian Real",
... | lib/money/currency/currency.ex | 0.95334 | 0.886911 | currency.ex | starcoder |
defmodule Pandadoc.Options.CreateFromTemplate do
@moduledoc """
Structure for creating documents
"""
alias Pandadoc.Options
@fields quote(
do: [
folder_uuid: String.t() | nil,
tags: list(String.t()) | nil,
recipients: list(Options.Recipient.t()) | nil,
... | lib/pandadoc/documents/create_options.ex | 0.80969 | 0.417806 | create_options.ex | starcoder |
defmodule AWS.CloudSearch do
@moduledoc """
Amazon CloudSearch Configuration Service
You use the Amazon CloudSearch configuration service to create, configure, and
manage search domains.
Configuration service requests are submitted using the AWS Query protocol. AWS
Query requests are HTTP or HTTPS reques... | lib/aws/generated/cloud_search.ex | 0.893797 | 0.463019 | cloud_search.ex | starcoder |
defmodule JaResource.Index do
import Plug.Conn, only: [put_status: 2]
@moduledoc """
Provides `handle_index/2`, `filter/4` and `sort/4` callbacks.
It relies on (and uses):
* JaResource.Repo
* JaResource.Records
* JaResource.Serializable
When used JaResource.Index defines the `index/2` action s... | lib/ja_resource/index.ex | 0.81928 | 0.404478 | index.ex | starcoder |
defmodule Sippet.Transactions.Server.Invite do
@moduledoc false
use Sippet.Transactions.Server, initial_state: :proceeding
alias Sippet.Message
alias Sippet.Message.StatusLine
alias Sippet.Transactions.Server.State
@t2 4_000
@before_trying 200
@timer_g 500
@timer_h 64 * @timer_g
# timer I is 5s
... | lib/sippet/transactions/server/invite.ex | 0.550124 | 0.44065 | invite.ex | starcoder |
defmodule APNSx.Server do
@moduledoc """
Simulates an APN server
* Collect alls certificate verifications and channel messages.
* Will accept any SSL connection (no real verification)
* Support queued commands which will trigger behaviours when a client sends data
* `:close` Will terminate the ... | lib/apns/server.ex | 0.765725 | 0.536677 | server.ex | starcoder |
defmodule Weaver.Loom do
@moduledoc """
Enables running a topology of concurrent Weaver workers using `GenStage`.
## Supervisor
`Weaver.Loom` implements the `Supervisor` specification, so you can run it
as part of any supervision tree:
```
defmodule MyApp.Application do
...
def start(_type, _a... | lib/weaver/loom/loom.ex | 0.876284 | 0.827131 | loom.ex | starcoder |
defmodule Vttyl.Decode do
@moduledoc false
alias Vttyl.Part
def parse(enum_content) do
enum_content
|> Stream.map(fn line -> Regex.replace(~r/#.*/, line, "") end)
|> Stream.map(&String.trim/1)
|> Stream.reject(&(&1 in ["", "WEBVTT"]))
|> Stream.chunk_while(%Part{}, &parse_chunk/2, &parse_chu... | lib/vttyl/decode.ex | 0.524638 | 0.404213 | decode.ex | starcoder |
defmodule Genome.LooseSequence do
alias Genome.Nucleotide
import Genome.Sequence, only: [encode: 1, decode: 2, reverse_complement: 1]
def pattern_count(seq, pattern, d), do: Enum.count(pattern_matches(seq, pattern, d))
def pattern_matches(seq, pattern, d, index \\ 0, acc \\ [])
def pattern_matches(seq, pat... | lib/genome/loose_sequence.ex | 0.736116 | 0.500916 | loose_sequence.ex | starcoder |
defmodule ArtemisWeb.AsyncRenderLive do
use ArtemisWeb.LiveView
@moduledoc """
Asynchronously render a template
## Fetch Data Asynchronously (Optional)
Can be passed an arbitrary `async_data` function to be executed as part of
the async load. It is excluded from the assign data and never exposed to the
... | apps/artemis_web/lib/artemis_web/live/async_render_live.ex | 0.78083 | 0.41324 | async_render_live.ex | starcoder |
defmodule Issues.TableFormatter do
@doc """
Print issue table based on selected issues columns.
Table allignment is dynamically calculated based on column data maximal length.
"""
def table_print issues,columns do
header_column_lengths = column_widths(issues,columns)
IO.puts create_header(columns,he... | issues/lib/issues/table_formatter.ex | 0.511717 | 0.416678 | table_formatter.ex | starcoder |
defmodule MapSchema.Macros.JsonEncoding do
@moduledoc false
@doc """
The JsonEncoding module compone the macros that let us, build the methods:
- json_encode(map)
Take a map and cast to json string format.
- json_decode(json)
Take a json string format and build a map, following the rules of schema.
... | lib/skeleton/macros/json_encoding.ex | 0.69233 | 0.435962 | json_encoding.ex | starcoder |
defmodule Zaryn.SelfRepair.Sync.BeaconSummaryHandler.TransactionHandler do
@moduledoc false
alias Zaryn.BeaconChain.Slot.TransactionSummary
alias Zaryn.Crypto
alias Zaryn.P2P
alias Zaryn.P2P.Message.GetTransaction
alias Zaryn.P2P.Message.NotFound
alias Zaryn.Replication
alias Zaryn.TransactionChain... | lib/zaryn/self_repair/sync/beacon_summary_handler/transaction_handler.ex | 0.782621 | 0.401424 | transaction_handler.ex | starcoder |
defmodule Kernel.SpecialForms do
@moduledoc """
In this module we define Elixir special forms. Special forms
cannot be overridden by the developer and are the basic
building blocks of Elixir code.
Some of those forms are lexical (like `alias`, `case`, etc).
The macros `{}` and `<<>>` are also special forms... | lib/elixir/lib/kernel/special_forms.ex | 0.923251 | 0.628749 | special_forms.ex | starcoder |
defmodule GameServer.DaraDots.DaraDotsGame do
use GenServer
alias Phoenix.PubSub
alias GameServer.DaraDots.{Board, Coordinate}
@broadcast_frequency 70
def start(id) do
GenServer.start(__MODULE__, id, name: via_tuple(id))
end
defp via_tuple(id) do
{:via, Registry, {GameServer.Registry, {__MODULE... | apps/game_server/lib/game_server/dara_dots/dara_dots_game.ex | 0.773901 | 0.435481 | dara_dots_game.ex | starcoder |
defmodule VehicleHelpers do
@moduledoc """
Various functions for working on lists of vehicle to show on a map, or render tooltips.
"""
alias Vehicles.Vehicle
alias Predictions.Prediction
alias Routes.{Route, Shape}
alias Stops.Stop
alias Schedules.Trip
alias SiteWeb.ScheduleController.VehicleLocations... | apps/site/lib/vehicle_helpers.ex | 0.747892 | 0.44354 | vehicle_helpers.ex | starcoder |
defmodule Mix.Tasks.Deps do
use Mix.Task
import Mix.Dep, only: [loaded: 1, format_dep: 1, format_status: 1, check_lock: 1]
@shortdoc "Lists dependencies and their status"
@moduledoc ~S"""
Lists all dependencies and their status.
Dependencies must be specified in the `mix.exs` file in one of
the follow... | lib/mix/lib/mix/tasks/deps.ex | 0.841011 | 0.568056 | deps.ex | starcoder |
defmodule FinTex.Model.Transaction do
@moduledoc """
The following fields are public:
* `name` - Name of originator or recipient
* `account_number` - Account number of originator or recipient. Empty if transaction has no account number.
* `bank_code` - Bank code of originator or recipi... | lib/model/transaction.ex | 0.908962 | 0.502808 | transaction.ex | starcoder |
defmodule ExWire.Packet.NewBlockHashes do
@moduledoc """
Advertises new blocks to the network.
```
**NewBlockHashes** [`+0x01`: `P`, [`hash_0`: `B_32`, `number_0`: `P`], [`hash_1`: `B_32`, `number_1`: `P`], ...]
Specify one or more new blocks which have appeared on the
network. To be maximally helpful, no... | apps/ex_wire/lib/ex_wire/packet/new_block_hashes.ex | 0.828766 | 0.876898 | new_block_hashes.ex | starcoder |
defmodule Crux.Structs.Message do
@moduledoc """
Represents a Discord [Message Object](https://discord.com/developers/docs/resources/channel#message-object).
Differences opposed to the Discord API Object:
- `:mentions` is a MapSet of user ids
"""
@moduledoc since: "0.1.0"
@behaviour Crux.Structs
alia... | lib/structs/message.ex | 0.819785 | 0.427935 | message.ex | starcoder |
defmodule Pandex do
@readers [
"markdown",
"markdown_github",
"markdown_strict",
"markdown_mmd",
"markdown_phpextra",
"commonmark",
"json",
"rst",
"textile",
"html",
"latex"
]
@writers [
"json",
"html",
"html5",
"s5",
"slidy",
"dzslides",
"do... | lib/pandex.ex | 0.59843 | 0.46041 | pandex.ex | starcoder |
defmodule Pigeon.APNS do
@moduledoc """
`Pigeon.Adapter` for Apple Push Notification Service (APNS) push notifications.
## Getting Started
1. Create an `APNS` dispatcher.
```
# lib/apns.ex
defmodule YourApp.APNS do
use Pigeon.Dispatcher, otp_app: :your_app
end
```
2. (Optional) Add configura... | lib/pigeon/apns.ex | 0.8415 | 0.737087 | apns.ex | starcoder |
defmodule Unicode do
@moduledoc """
Functions to introspect the Unicode character database and
to provide fast codepoint lookups for scripts, blocks,
categories and properties.
"""
alias Unicode.Utils
@type codepoint :: non_neg_integer
@type codepoint_or_string :: codepoint | String.t()
@doc false
... | lib/unicode.ex | 0.903521 | 0.505676 | unicode.ex | starcoder |
defmodule Cldr.Normalize.Units do
@moduledoc false
alias Cldr.Substitution
def normalize(content, locale) do
content
|> normalize_units(locale)
end
@unit_types ["short", "long", "narrow"]
def normalize_units(content, locale) do
units =
units_for_locale(locale)
|> get_in(["main", l... | mix/support/normalize/normalize_units.ex | 0.775052 | 0.407363 | normalize_units.ex | starcoder |
defmodule Membrane.Core.Element.PadsSpecsParser do
@moduledoc """
Functions parsing element pads specifications, generating functions and docs
based on them.
"""
alias Membrane.{Buffer, Caps, Element}
alias Element.Pad
alias Bunch.Type
use Bunch
@type parsed_pad_specs_t :: %{
:availability ... | lib/membrane/core/element/pads_specs_parser.ex | 0.768646 | 0.448004 | pads_specs_parser.ex | starcoder |
defmodule BggXmlApi2.Item do
@moduledoc """
A set of functions for searching and retrieving information on Items.
"""
import SweetXml
alias BggXmlApi2.Api, as: BggApi
@enforce_keys [:id, :name, :type, :year_published]
defstruct [
:id,
:name,
:type,
:year_published,
:image,
:thu... | lib/bgg_xml_api2/item.ex | 0.736685 | 0.433502 | item.ex | starcoder |
defmodule Commandex do
@moduledoc """
Defines a command struct.
Commandex structs are a loose implementation of the command pattern, making it easy
to wrap parameters, data, and errors into a well-defined struct.
## Example
A fully implemented command module might look like this:
defmodule Registe... | lib/commandex.ex | 0.840128 | 0.496765 | commandex.ex | starcoder |
defmodule RogerUI.Queues do
@moduledoc """
Normalizes nodes data structures from Roger.Info.running_jobs() function in order to obtain queues:
Given a nested data structure, where each element contents nested items:
input = [
"server@127.0.0.1": %{
running: %{
"roger_test_partition_1"... | lib/roger_ui/queues.ex | 0.819135 | 0.472014 | queues.ex | starcoder |
defmodule KeywordValidator do
@moduledoc """
Functions for validating keyword lists.
The main function in this module is `validate/2`, which allows developers to
validate a keyword list against a given schema.
A schema is simply a map that matches the keys for the keyword list. The values
in the schema re... | lib/keyword_validator.ex | 0.936103 | 0.625981 | keyword_validator.ex | starcoder |
defmodule Timex.Ecto.TimestampWithTimezone do
@moduledoc """
Support for using Timex with :timestamptz fields
"""
use Timex
@behaviour Ecto.Type
def type, do: :timestamptz
@doc """
Handle casting to Timex.Ecto.TimestampWithTimezone
"""
def cast(%DateTime{} = dt), do: to_local(dt)
# Support embe... | lib/types/timestamptz.ex | 0.763396 | 0.420957 | timestamptz.ex | starcoder |
defmodule Ockam.Kafka.Hub.Service.Provider do
@moduledoc """
Implementation for Ockam.Hub.Service.Provider
providing kafka stream services, :stream_kafka and :stream_kafka_index
Services arguments:
stream_kafka:
address_prefix: optional<string>, worker address prefix
stream_prefix: optional<string>, ... | implementations/elixir/ockam/ockam_hub/lib/hub/service/provider/kafka.ex | 0.789761 | 0.450239 | kafka.ex | starcoder |
defmodule Goth.Token do
@moduledoc """
Functions for retrieving the token from the Google API.
"""
@type t :: %__MODULE__{
token: String.t(),
type: String.t(),
scope: String.t(),
expires: non_neg_integer,
sub: String.t() | nil
}
defstruct [
:toke... | lib/goth/token.ex | 0.891679 | 0.600598 | token.ex | starcoder |
defmodule NRepl.Messages.Eval do
import UUID, only: [uuid4: 0]
defstruct op: "eval",
code: nil,
session: nil,
id: UUID.uuid4(),
# The column number in [file] at which [code] starts.
column: nil,
# A fully-qualified symbol naming a var whose fu... | lib/n_repl/messages/eval.ex | 0.541166 | 0.521227 | eval.ex | starcoder |
defmodule Tensorflow.MemAllocatorStats do
@moduledoc false
use Protobuf, syntax: :proto3
@type t :: %__MODULE__{
num_allocs: integer,
bytes_in_use: integer,
peak_bytes_in_use: integer,
largest_alloc_size: integer,
fragmentation_metric: float | :infinity | :negati... | lib/tensorflow/core/protobuf/bfc_memory_map.pb.ex | 0.77373 | 0.47457 | bfc_memory_map.pb.ex | starcoder |
defmodule Timewrap do
@moduledoc """
Timewrap is a "Time-Wrapper" through which you can access different
time-sources, Elixir and Erlang offers you. Other than that you
can implement on your own.
Also, _Timewrap_ can do the time-warp, freeze, and unfreeze a
`Timewrap.Timer`.
You can instantiate differ... | lib/timewrap.ex | 0.796253 | 0.494995 | timewrap.ex | starcoder |
defmodule RoboticaUi.RootManager do
@moduledoc """
Manage active scene and tabs
"""
require Logger
use GenServer
alias Scenic.ViewPort
defmodule Scenes do
@moduledoc false
@type t :: %__MODULE__{
message: atom() | {atom(), any()} | nil
}
defstruct [:message]
end
... | robotica_ui/lib/root_manager.ex | 0.70416 | 0.433502 | root_manager.ex | starcoder |
defmodule Cqrs.BoundedContext do
alias Cqrs.{BoundedContext, Guards}
@moduledoc """
Macros to create proxy functions to [commands](`Cqrs.Command`) and [queries](`Cqrs.Query`) in a module.
## Examples
defmodule Users do
use Cqrs.BoundedContext
command CreateUser
command CreateUse... | lib/cqrs/bounded_context.ex | 0.775477 | 0.411643 | bounded_context.ex | starcoder |
defmodule Rolodex.Response do
@moduledoc """
Exposes functions and macros for defining reusable responses.
It exposes the following macros, which when used together will setup a response:
- `response/2` - for declaring a response
- `desc/1` - for setting an (optional) response description
- `content/2` - ... | lib/rolodex/response.ex | 0.906681 | 0.561215 | response.ex | starcoder |
defmodule Cannes.Tools do
@moduledoc """
`Cannes.Tools` facilitates a usefull wrapper for the python library called `cantool`.
"""
use Export.Python
@python_dir "lib/python"
@python_module "cantool"
@doc """
Calls the given function with args from the given Python file.
"""
@spec python_call(binar... | lib/tools.ex | 0.874466 | 0.460471 | tools.ex | starcoder |
defmodule Etherscan.Util do
@moduledoc false
@denominations [
wei: 1,
kwei: 1000,
mwei: 1_000_000,
gwei: 1_000_000_000,
shannon: 1_000_000_000,
nano: 1_000_000_000,
szabo: 1_000_000_000_000,
micro: 1_000_000_000_000,
finney: 1_000_000_000_000_000,
milli: 1_000_000_000_000_00... | lib/etherscan/util.ex | 0.866217 | 0.560433 | util.ex | starcoder |
defmodule Ash.Flow.Transformers.SetTypes do
@moduledoc "Sets the actual types and transforms the type constraints"
use Ash.Dsl.Transformer
alias Ash.Dsl.Transformer
def transform(_resource, dsl_state) do
set_argument_types(dsl_state)
end
defp set_argument_types(dsl_state) do
arguments = Transform... | lib/ash/flow/transformers/set_types.ex | 0.82379 | 0.498047 | set_types.ex | starcoder |
defmodule Wabbit.Exchange do
@moduledoc """
Functions to operate on Exchanges.
"""
import Wabbit.Record
@doc """
Declares an Exchange. The default Exchange type is `direct`.
AMQP 0-9-1 brokers provide four pre-declared exchanges:
* Direct exchange: (empty string) or `amq.direct`
* Fanout exchange:... | lib/wabbit/exchange.ex | 0.814459 | 0.602559 | exchange.ex | starcoder |
defmodule MazeServer.MazeAi.AStar do
alias MazeServer.MazeAi
@moduledoc """
this module define A* rules.
in this algorithm, frontier is same as BFS with a tiny difference!
frontier will sort by ascending `path_cost` order after every push.
"""
@doc """
this expander is same as `MazeAi.expander` but it... | lib/maze_server/maze_ai/a_star.ex | 0.852721 | 0.522263 | a_star.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.