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 :queue do
# Types
@type queue :: queue(_)
# Functions
@spec cons(item, q1 :: queue(item)) :: q2 :: queue(item)
def cons(x, q), do: in_r(x, q)
@spec daeh(q :: queue(item)) :: item
def daeh(q), do: get_r(q)
@spec drop(q1 :: queue(item)) :: q2 :: queue(item)
def drop({[], []} = q), do: :e... | testData/org/elixir_lang/beam/decompiler/queue.ex | 0.808559 | 0.481088 | queue.ex | starcoder |
defmodule Clickhousex.Codec.Values do
alias Clickhousex.Query
def encode(%Query{param_count: 0, type: :insert}, _, []) do
# An insert query's arguments go into the post body and the query part goes into the query string.
# If we don't have any arguments, we don't have to encode anything, but we don't want ... | lib/clickhousex/codec/values.ex | 0.618896 | 0.514888 | values.ex | starcoder |
defmodule LFSR do
@moduledoc """
Implements a binary Galois Linear Feedback Shift Register with arbitrary size `n`.
A LFSR is a shift register whose input bit is a linear function of its previous state.
The bit positions that affect the next state are called the taps.
A LFSR with well chosen taps will prod... | lib/lfsr.ex | 0.887979 | 0.702607 | lfsr.ex | starcoder |
defmodule AWS.Inspector do
@moduledoc """
Amazon Inspector
Amazon Inspector enables you to analyze the behavior of your AWS resources and
to identify potential security issues.
For more information, see [ Amazon Inspector User Guide](https://docs.aws.amazon.com/inspector/latest/userguide/inspector_introduc... | lib/aws/generated/inspector.ex | 0.853486 | 0.426859 | inspector.ex | starcoder |
defmodule AWS.SageMakerA2IRuntime do
@moduledoc """
Amazon Augmented AI is in preview release and is subject to change.
We do not recommend using this product in production environments.
Amazon Augmented AI (Amazon A2I) adds the benefit of human judgment to any
machine learning application. When an AI appl... | lib/aws/generated/sage_maker_a2i_runtime.ex | 0.787646 | 0.69259 | sage_maker_a2i_runtime.ex | starcoder |
defmodule PointOfInterest do
alias PointOfInterest.Secrets, as: Secrets
@moduledoc """
-->Takes a Country as Input
-->Fetches top 100 cities
-->Fetches Top 200 Points of Interest for Each City
-->Writes the result to a file after parsing the data
"""
@base_url "https://www.triposo.com/api/20181213"
... | lib/point_of_interest.ex | 0.646572 | 0.456531 | point_of_interest.ex | starcoder |
defmodule Plymio.Codi do
@moduledoc ~S"""
`Plymio.Codi` generates *quoted forms* for common code *patterns*.
The `produce_codi/2` function produces the *quoted forms* for the
*patterns*.
The `reify_codi/2` macro calls `produce_codi/2` and then compiles
the forms.
## Documentation Terms
In the docume... | lib/codi/codi.ex | 0.902876 | 0.684238 | codi.ex | starcoder |
defmodule AwsExRay.Subsegment do
@moduledoc ~S"""
This module provides data structure which represents X-Ray's **subsegment**
"""
alias AwsExRay.Record.Error
alias AwsExRay.Record.SQL
alias AwsExRay.Record.HTTPRequest
alias AwsExRay.Record.HTTPResponse
alias AwsExRay.Segment
alias ... | lib/aws_ex_ray/subsegment.ex | 0.814311 | 0.434341 | subsegment.ex | starcoder |
defmodule Raxx.Server do
@moduledoc """
Interface to handle server side communication in an HTTP message exchange.
*Using `Raxx.Server` allows an application to be run on multiple adapters.
For example [Ace](https://github.com/CrowdHailer/Ace)
has several adapters for different versions of the HTTP protocol,... | lib/raxx/server.ex | 0.869687 | 0.48621 | server.ex | starcoder |
defmodule Day15 do
def find_next_vertex(not_visited) do
not_visited |> Enum.min_by(&elem(&1, 1))
end
def iterate({weights, visited, not_visited}) do
{vertex, vertex_distance} = find_next_vertex(not_visited)
visited = Map.put(visited, vertex, vertex_distance)
not_visited = Map.delete(not_visited,... | aoc21/lib/day15.ex | 0.744099 | 0.402363 | day15.ex | starcoder |
defmodule AWS.Chime do
@moduledoc """
The Amazon Chime API (application programming interface) is designed for
developers to perform key tasks, such as creating and managing Amazon Chime
accounts, users, and Voice Connectors.
This guide provides detailed information about the Amazon Chime API, including
o... | lib/aws/generated/chime.ex | 0.874761 | 0.551695 | chime.ex | starcoder |
defmodule ElixirKeeb.PinMapper do
@moduledoc """
Imagine a 3x4 keyboard like this:
-----------------
| Q | W | E | R |
| A | S | D | F |
| Z | X | C | V |
-----------------
The controller has 8 pins, P1, P2, ..., P7, P8.
(A)
P1, P3, P5, P8 => "Lines"
P2, P4, P6, P7 => "Columns"
Each key conn... | lib/pin_mapper.ex | 0.874225 | 0.861713 | pin_mapper.ex | starcoder |
defmodule Day14 do
import Bitwise
require Logger
def part1(path) do
or_mask = 0
and_mask = ~~~or_mask
masks = {and_mask, or_mask}
solve(path, &exec/2, masks)
end
def part2(path) do
or_mask = 0
floating_bits = []
solve(path, &exec_v2/2, {or_mask, floating_bits})
end
def solv... | lib/day_14.ex | 0.512205 | 0.526465 | day_14.ex | starcoder |
defmodule RethinkDB.Pseudotypes do
@moduledoc false
defmodule Binary do
@moduledoc false
defstruct data: nil
def parse(%{"$reql_type$" => "BINARY", "data" => data}, opts) do
case Keyword.get(opts, :binary_format) do
:raw ->
%__MODULE__{data: data}
_ ->
:base64... | lib/rethinkdb/pseudotypes.ex | 0.514888 | 0.568775 | pseudotypes.ex | starcoder |
defmodule Mollie.Connect do
import Mollie
alias Mollie.Client
@moduledoc """
Mollie Connect is a set of APIs and tools that allows you to connect multiple Mollie accounts together.
More info at: https://docs.mollie.com/connect/overview
"""
@doc """
Generates the authorization URL
Params example
... | lib/mollie/connect.ex | 0.802788 | 0.558598 | connect.ex | starcoder |
defmodule AWS.Lambda do
@moduledoc """
AWS Lambda
**Overview**
This is the *AWS Lambda API Reference*. The AWS Lambda Developer Guide
provides additional information. For the service overview, see [What is AWS
Lambda](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html), and for
information about... | lib/aws/lambda.ex | 0.88729 | 0.533397 | lambda.ex | starcoder |
defmodule Vaxin do
@moduledoc """
Contains the core functionality to work with Vaxin.
Vaxin at its core is a data validator combinator library. It tries to solve
the problem of validating the shape and content of some data (most useful
when such data come from an external source) and of conforming those data... | lib/vaxin.ex | 0.92657 | 0.814533 | vaxin.ex | starcoder |
defmodule Mentat do
@moduledoc """
Provides a basic cache with ttls.
## Usage
A cache must be given a name when its started.
```
Mentat.start_link(name: :my_cache)
```
After its been started you can store and retrieve values:
```
Mentat.put(:my_cache, user_id, user)
user = Mentat.get(:my_cach... | lib/mentat.ex | 0.90045 | 0.891481 | mentat.ex | starcoder |
defmodule HumanizeTime do
@moduledoc """
Module for converting seconds and milliseconds to human readable timestamps.
"""
@type duration_map :: %{
days: integer(),
hours: integer(),
minutes: integer(),
seconds: integer()
}
@doc """
Formatter for converting s... | lib/humanize_time.ex | 0.845002 | 0.575081 | humanize_time.ex | starcoder |
defmodule Matrex.Validation do
@moduledoc """
Basic validation
Available options:
- type: validates the type
- :string
- :integer
- key: store in a different key
- default: default value for optional
- default_lazy: function to define a default
- post: function to post process
"""
@typep ... | lib/matrex/validation.ex | 0.825167 | 0.467271 | validation.ex | starcoder |
defmodule Optimizer do
@moduledoc """
Provides a optimizer for [AST](https://elixirschool.com/en/lessons/advanced/metaprogramming/)
"""
import SumMag
alias Pelemay.Db
require Logger
@term_options [Enum: true, String: true]
@doc """
Optimize funcions which be enclosed `defpelemay`, using `optimize... | lib/pelemay/optimizer.ex | 0.828419 | 0.789842 | optimizer.ex | starcoder |
defmodule LoopsWithFriends.JamCollection.Collection do
@moduledoc """
Represents a collection of jams, indexed by UUID and containing a list of
users.
Ensures that there are never more than `@max_users` users in a given jam.
"""
@behaviour LoopsWithFriends.JamCollection
alias LoopsWithFriends.StatsColl... | lib/loops_with_friends/jam_collection/collection.ex | 0.672654 | 0.433382 | collection.ex | starcoder |
defmodule Farmbot.CeleryScript.AST do
@moduledoc """
Handy functions for turning various data types into Farbot Celery Script
Ast nodes.
"""
@typedoc "Arguments to a Node."
@type args :: map
@typedoc "Body of a Node."
@type body :: [t]
@typedoc "Kind of a Node."
@type kind :: module
@typedoc "... | lib/farmbot/celery_script/ast/ast.ex | 0.852245 | 0.485051 | ast.ex | starcoder |
defmodule Relax.Router do
@moduledoc """
A DSL for defining a routing structure to determine what resources handle
which requests.
## Example:
defmodule MyApp.Router do
use Relax.Router
plug :route
plug :not_found
version :v1 do
resource :posts, MyApp.Resourc... | lib/relax/router.ex | 0.83498 | 0.404125 | router.ex | starcoder |
defmodule VoteNerd.Poll do
defstruct [:title, options: [], votes: nil]
@doc """
Adds option `o` to the `poll`.
Note that the options are stored in the inverse order that
they were added.
## Examples
iex> %VoteNerd.Poll{} |> VoteNerd.Poll.add_option("foobar")
%VoteNerd.Poll{options: ["foobar"]}
ie... | lib/vote_nerd/poll.ex | 0.810404 | 0.453988 | poll.ex | starcoder |
defmodule Adventofcode.Day17TwoStepsForward.Utils do
def open_doors(hashed_passcode) do
hashed_passcode
|> String.graphemes
|> Enum.zip("UDLR" |> String.graphemes)
|> Enum.filter(&open?/1)
|> Enum.map(&elem(&1, 1))
end
defp open?({"b", _}), do: true
defp open?({"c", _}), do: true
defp ope... | lib/day_17_two_steps_forward.ex | 0.694924 | 0.428144 | day_17_two_steps_forward.ex | starcoder |
defmodule Result.Calc do
@moduledoc """
Result calculations
"""
@doc """
Calculate the AND of two results
r_and :: Result e1 a -> Result e2 b -> Result [e1, e2] [a, b]
## Examples
iex> Result.Calc.r_and({:ok, 1}, {:ok, 2})
{:ok, [1, 2]}
iex> Result.Calc.r_and({:ok, 1}, {:error, 2})
... | lib/operators/calc.ex | 0.87266 | 0.725284 | calc.ex | starcoder |
defmodule FlowAssertions.Checkers do
alias FlowAssertions.Define.Defchecker.Failure
import FlowAssertions.Define.{Defchecker,BodyParts}
alias FlowAssertions.Messages
@moduledoc """
Functions that create handy predicates for use with `FlowAssertions.MiscA.assert_good_enough/2`
actual
|> assert_go... | lib/checkers.ex | 0.877674 | 0.767646 | checkers.ex | starcoder |
defmodule AWS.MarketplaceMetering do
@moduledoc """
AWS Marketplace Metering Service
This reference provides descriptions of the low-level AWS Marketplace Metering
Service API.
AWS Marketplace sellers can use this API to submit usage data for custom usage
dimensions.
For information on the permissions... | lib/aws/generated/marketplace_metering.ex | 0.800887 | 0.508422 | marketplace_metering.ex | starcoder |
defmodule ExUnit.Case do
@moduledoc """
This module is meant to be used in other modules
as a way to configure and prepare them for testing.
When used, it allows the following options:
* :async - configure Elixir to run that specific test case
in parallel with others. Must be used for performan... | lib/ex_unit/lib/ex_unit/case.ex | 0.742422 | 0.459197 | case.ex | starcoder |
defmodule AstraeaVirgoWeb.ProblemView do
use AstraeaVirgoWeb, :view
@moduledoc """
Response for Problem API
"""
@doc """
Response
## index.json
Response for index Problems API: `GET /api/problems`
Response: list of Object
| field | type | required | descript |
|----... | lib/virgo_web/views/problem_view.ex | 0.875794 | 0.425844 | problem_view.ex | starcoder |
defmodule Scidata.Caltech101 do
@moduledoc """
Module for downloading the [Caltech101 dataset](http://www.vision.caltech.edu/Image_Datasets/Caltech101).
"""
require Scidata.Utils
alias Scidata.Utils
@base_url "https://s3.amazonaws.com/fast-ai-imageclas/"
@dataset_file "caltech_101.tgz"
@labels_shape {... | lib/scidata/caltech101.ex | 0.824179 | 0.558387 | caltech101.ex | starcoder |
defmodule Protobuf.Wire.Varint do
@moduledoc """
Varint encoding and decoding utilities.
https://developers.google.com/protocol-buffers/docs/encoding#varints
For performance reasons, varint decoding must be built through a macro, so that binary
match contexts are reused and no new large binaries get allocat... | lib/protobuf/wire/varint.ex | 0.605216 | 0.400105 | varint.ex | starcoder |
defmodule Aja.Vector.Raw do
@moduledoc false
import Kernel, except: [min: 2, max: 2]
require Aja.Vector.CodeGen, as: C
alias Aja.Vector.{Builder, Node, Tail, Trie}
@empty {0}
defmacrop small(size, tail, first) do
# TODO distinguish match
quote do
{unquote(size), 0, nil, nil, unquote(tail)... | lib/vector/raw.ex | 0.516595 | 0.76625 | raw.ex | starcoder |
defmodule AdventOfCode.Y2020.Day4 do
defstruct birth_year: nil,
issued: nil,
expire: nil,
height: nil,
hair_color: nil,
eye_color: nil,
pid: nil,
country: nil
alias AdventOfCode.Y2020.Day4
import AdventOfCode.Helpers.Data, only: ... | lib/2020/day4.ex | 0.597725 | 0.446072 | day4.ex | starcoder |
defmodule AntikytheraCore.TemplateEngine do
@moduledoc """
This is an implementation of `EEx.Engine` that auto-escape dynamic parts within HAML templates.
"""
@behaviour EEx.Engine
alias Antikythera.TemplateSanitizer
@impl true
def init(_opts) do
%{
iodata: [],
dynamic: [],
... | core/web/template_engine.ex | 0.752877 | 0.413773 | template_engine.ex | starcoder |
defmodule(ExAliyunOts.TableStoreSearch.AggregationType) do
@moduledoc false
(
defstruct([])
(
@spec default() :: :AGG_AVG
def(default()) do
:AGG_AVG
end
)
@spec encode(atom()) :: integer() | atom()
[
(
def(encode(:AGG_AVG)) do
1
end
... | lib/elixir_ex_aliyun_ots_table_store_search_aggregation_type.ex | 0.770249 | 0.461502 | elixir_ex_aliyun_ots_table_store_search_aggregation_type.ex | starcoder |
defmodule Google.Protobuf.FileDescriptorSet do
@moduledoc false
use Protobuf, syntax: :proto2
@type t :: %__MODULE__{
file: [Google.Protobuf.FileDescriptorProto.t()]
}
defstruct [:file]
field :file, 1, repeated: true, type: Google.Protobuf.FileDescriptorProto
end
defmodule Google.Protobuf... | lib/google/descriptor.pb.ex | 0.706899 | 0.407392 | descriptor.pb.ex | starcoder |
defmodule Braintree.Customer do
@moduledoc """
You can create a customer by itself, with a payment method, or with a
credit card with a billing address.
For additional reference see:
https://developers.braintreepayments.com/reference/request/customer/create/ruby
"""
use Braintree.Construction
alias B... | lib/customer.ex | 0.857201 | 0.505188 | customer.ex | starcoder |
defmodule OMG.Watcher.ExitProcessor.Piggyback do
@moduledoc """
Encapsulates managing and executing the behaviors related to treating exits by the child chain and watchers
Keeps a state of exits that are in progress, updates it with news from the root chain, compares to the
state of the ledger (`OMG.State`), i... | apps/omg_watcher/lib/omg_watcher/exit_processor/piggyback.ex | 0.728941 | 0.473049 | piggyback.ex | starcoder |
defmodule DAL do
@moduledoc """
Global Data Access Layer to replace direct use of `Ecto.Repo` and other data services.
The DAL performs two core functions:
1. Provides an abstraction for other data repositories
1. Provides a set of macros representing all available data types that can be used in services
... | lib/dal.ex | 0.916521 | 0.862815 | dal.ex | starcoder |
defmodule Abacus.Eval do
@moduledoc """
Function definitions on how to evaluate a syntax tree.
You usually don't need to call `eval/2` yourself, use `Abacus.eval/2` instead.
"""
use Bitwise
alias Abacus.Util
@spec eval(expr :: tuple | number, scope :: map) ::
{:ok, result :: number} | {:ok,... | lib/eval.ex | 0.794185 | 0.461381 | eval.ex | starcoder |
defmodule ExtrText.MetadataHandler do
@behaviour Saxy.Handler
def handle_event(:start_element, {name, _attributes}, state) do
{:ok, %{state | name: name}}
end
def handle_event(:end_element, _name, state) do
{:ok, %{state | name: nil}}
end
def handle_event(:characters, chars, %{name: "dc:title", m... | lib/handlers/metadata_handler.ex | 0.697609 | 0.484014 | metadata_handler.ex | starcoder |
defmodule ElasticsearchElixirBulkProcessor do
alias ElasticsearchElixirBulkProcessor.Bulk.{BulkStage, Upload}
@moduledoc """
Elasticsearch Elixir Bulk Processor is a configurable manager for efficiently inserting data into Elasticsearch.
This processor uses genstages for handling backpressure, and various sett... | lib/elasticsearch_elixir_bulk_processor.ex | 0.910132 | 0.910067 | elasticsearch_elixir_bulk_processor.ex | starcoder |
defmodule Ecto.Adapter do
@moduledoc """
This module specifies the adapter API that an adapter is required to
implement.
"""
use Behaviour
@type t :: module
@type query_meta :: map
@type model_meta :: %{source: {prefix :: binary, table :: binary}, model: atom, context: term}
@type fields :: Keyword.... | lib/ecto/adapter.ex | 0.909948 | 0.474814 | adapter.ex | starcoder |
defmodule SpaceEx.Event do
alias SpaceEx.{API, Types, Stream, KRPC, ObjectReference, Protobufs}
@bool_type API.Type.parse(%{"code" => "BOOL"})
@moduledoc """
Allows for the server to notify us only when a conditional expression becomes true.
Events are an efficient way to wait for a particular condition or... | lib/space_ex/event.ex | 0.859413 | 0.609611 | event.ex | starcoder |
defmodule GitHubActions.Mix do
@moduledoc """
Some functions for handling mix commands in workflows.
"""
alias GitHubActions.Config
alias GitHubActions.ConvCase
@doc """
Generates a mix task.
## Examples
iex> mix(:compile)
"mix compile"
"""
@spec mix(atom()) :: String.t()
def mix(t... | lib/git_hub_actions/mix.ex | 0.861378 | 0.41327 | mix.ex | starcoder |
defmodule Astarte.Device.Handler do
@moduledoc """
This module defines a behaviour for handling incoming messages directed to an `Astarte.Device`.
Modules implementing this behaviour will be executed in a separate process, to avoid blocking the MQTT
connection process.
"""
@doc """
Initialize the state... | lib/astarte_device/handler.ex | 0.871064 | 0.434941 | handler.ex | starcoder |
defmodule Schedule do
defstruct [
schedule_id: nil,
delay: nil,
count: nil,
concurrency: nil,
func_id: nil,
func_name: nil,
scheduled_datetime: nil,
start_datetime: nil,
end_datetime: nil,
count_200: nil,
# dur_min: nil,
# dur_max: nil,
# dur_avg: nil,
# dur_mea... | auditor/lib/scheduler.ex | 0.587233 | 0.463566 | scheduler.ex | starcoder |
defmodule Sanbase.Cache.RehydratingCache do
@moduledoc ~s"""
A service that automatically re-runs functions and caches their values at
intervals smaller than the TTL so the cache never expires but is just renewed.
This service is useful when heavy queries need to be cached without any waiting
for recalculati... | lib/sanbase/cache/rehydrating_cache/rehydrating_cache.ex | 0.819749 | 0.564579 | rehydrating_cache.ex | starcoder |
defmodule SymbolicExpression.Canonical.Writer do
@doc """
Converts the abstract representation of an s-expression into a string holding
an s-expression in canonical form. Returns `{:ok, result}` on success,
`{:error, reason}` otherwise.
## Example
iex> alias SymbolicExpression.Canonical.Writer
... | lib/symbolic_expression/canonical/writer.ex | 0.821832 | 0.504455 | writer.ex | starcoder |
defmodule NervesjpBasis.Sensor.Aht20 do
@moduledoc """
Documentation for `Aht20`.
温湿度センサAHT20の制御モジュール
"""
# 関連するライブラリを読み込み
require Logger
use Bitwise
alias Circuits.I2C
# 定数
## i2c-1 for Raspberry Pi, i2c-2 for BBB/BBG Board
@i2c_bus "i2c-1"
## AHT32 I2C Addr
@i2c_addr 0x38
# 定数
## I2C通... | lib/sensor/aht20.ex | 0.538255 | 0.49469 | aht20.ex | starcoder |
defmodule Farmbot.BotState.Transport.HTTP do
@moduledoc """
RESTful API for accessing internal Farmbot state.
# Accessing the API
A developer should be able to access the REST API at
`http://<my_farmbot_id>:27347/api/v1/`.
The calls will require an authentication token.
See the [API docs](https://github.... | lib/farmbot/bot_state/transport/http/http.ex | 0.607197 | 0.400134 | http.ex | starcoder |
defmodule OptionParser do
@doc """
Parses the argv and returns one tuple with parsed options
and the arguments.
## Examples
iex> OptionParser.parse(["--debug"])
{ [debug: true], [] }
iex> OptionParser.parse(["--source", "lib"])
{ [source: "lib"], [] }
iex> OptionParser.parse(["... | lib/elixir/lib/option_parser.ex | 0.73914 | 0.439146 | option_parser.ex | starcoder |
defmodule AWS.ApplicationInsights do
@moduledoc """
Amazon CloudWatch Application Insights
Amazon CloudWatch Application Insights is a service that helps you detect common
problems with your applications.
It enables you to pinpoint the source of issues in your applications (built with
technologies such a... | lib/aws/generated/application_insights.ex | 0.906849 | 0.436082 | application_insights.ex | starcoder |
defmodule Rexbug.Translator do
@moduledoc """
Utility module for translating Elixir syntax to the one expected by
`:redbug`.
You probably don't need to use it directly.
"""
@valid_guard_functions [
:is_atom,
:is_binary,
:is_bitstring,
:is_boolean,
:is_float,
:is_function,
:is_i... | lib/rexbug/translator.ex | 0.717606 | 0.479565 | translator.ex | starcoder |
defmodule GroupManager.Data.TimedSet do
require Record
require GroupManager.Data.Item
require GroupManager.Data.LocalClock
require GroupManager.Data.TimedItem
require Chatter.NetID
alias GroupManager.Data.TimedItem
alias Chatter.NetID
alias GroupManager.Data.Item
alias GroupManager.Data.LocalClock
... | lib/group_manager/data/timed_set.ex | 0.606265 | 0.413684 | timed_set.ex | starcoder |
defmodule Data.Type do
@moduledoc """
Helper functions for types saved to the database
"""
alias Data.Type.Changeset
import Changeset, only: [add_error: 3]
@type changeset :: Changeset.t()
@doc """
Load all non-nil keys from a struct
iex> Data.Type.keys(%{key: 1, nil: nil})
[:key]
... | lib/data/type.ex | 0.735737 | 0.482734 | type.ex | starcoder |
defmodule ForgeAbi.Util.BigInt do
@moduledoc """
Big int operators. Note that at the moment we only need `:+` and `:-`.
As for `==`, `!=`, `>`, `>=`, `<`, `<=` the default behavior is as expected so
we won't override them.
"""
import Kernel, except: [+: 2, -: 2, >=: 2, >: 2, <=: 2, <: 2]
alias ForgeAbi.{B... | lib/forge_abi/util/bigint.ex | 0.748904 | 0.754802 | bigint.ex | starcoder |
defmodule Blinkchain.Config.Channel do
@pwm_0_pins [12, 18, 40, 52]
@pwm_1_pins [13, 19, 41, 45, 53]
@valid_types [
:rgb,
:rbg,
:grb,
:gbr,
:brg,
:bgr,
:rgbw,
:rbgw,
:grbw,
:gbrw,
:brgw,
:bgrw
]
@moduledoc """
Represents a single "chain" of pixels of the sam... | lib/blinkchain/config/channel.ex | 0.840946 | 0.599514 | channel.ex | starcoder |
defmodule MsgPackObject do
defmodule MsgPackExtension do
@type t :: %__MODULE__{
type: integer,
value: binary
}
defstruct [
type: 0,
value: <<>>
]
end
@type object_type :: :integer | :nil | :boolean | :float | :string | :binar... | lib/msgpack.ex | 0.733452 | 0.413418 | msgpack.ex | starcoder |
defmodule Maestro.Store.Adapter do
@moduledoc """
Defines the minimal API for a well-behaved storage implementation.
"""
alias Maestro.Types.{Event, Snapshot}
@type id :: Event.aggregate_id()
@type seq :: Event.sequence()
@type options :: map()
@doc """
If any transactional projections are present... | lib/maestro/store/adapter.ex | 0.885167 | 0.451085 | adapter.ex | starcoder |
defmodule Ane do
@moduledoc """
A very efficient way to share mutable data by utilizing `:atomics` and `:ets` modules.
[github.com/gyson/ane](https://github.com/gyson/ane) has detailed guides.
"""
@type atomics_ref() :: :atomics.atomics_ref()
@type tid() :: :ets.tid() | atom()
@type t_for_ane_mode() ... | lib/ane.ex | 0.890026 | 0.768494 | ane.ex | starcoder |
alias Generator.State, as: State
alias Generator.Result, as: Result
alias InterpreterTerms.Regex, as: RegexTerm
alias InterpreterTerms.Nothing, as: Nothing
alias InterpreterTerms.RegexEmitter, as: RegexEmitter
defmodule InterpreterTerms.RegexMatch do
defstruct [:match, {:whitespace, ""}, { :external, %{} }]
defim... | lib/ebnf_parser/interpreter_terms/regex.ex | 0.517571 | 0.47926 | regex.ex | starcoder |
defmodule Board do
defstruct [:board]
def new(row_count \\ 10, col_count \\ 10) do
%Board{
board: empty_board(row_count, col_count)
}
end
def row_count(board) do
length(board)
end
def col_count(board) do
first_row = Enum.at(board, 0)
length(first_row)
end
def all_tiles(boar... | lib/board.ex | 0.591015 | 0.560192 | board.ex | starcoder |
defmodule Harmonex.Interval do
@moduledoc """
Provides functions for working with intervals between pitches on the Western
dodecaphonic scale.
"""
alias Harmonex.{Ordinal,Pitch}
defstruct quality: nil, size: nil
@typedoc """
A `Harmonex.Interval` struct.
"""
@type interval :: %Harmonex.Interval{qu... | lib/harmonex/interval.ex | 0.871789 | 0.767189 | interval.ex | starcoder |
defmodule Bolt.Sips.Internals.PackStream.EncoderV2 do
@moduledoc false
use Bolt.Sips.Internals.PackStream.Markers
alias Bolt.Sips.Internals.PackStream.EncoderHelper
alias Bolt.Sips.Types.{TimeWithTZOffset, DateTimeWithTZOffset, Duration, Point}
@doc """
Encode a Time (represented by Time) into Bolt binary ... | lib/bolt_sips/internals/pack_stream/encoder_v2.ex | 0.903182 | 0.713818 | encoder_v2.ex | starcoder |
defmodule Membrane.Element.Base.Source do
@moduledoc """
Module defining behaviour for sources - elements producing data.
Behaviours for filters are specified, besides this place, in modules
`Membrane.Element.Base.Mixin.CommonBehaviour`,
`Membrane.Element.Base.Mixin.SourceBehaviour`.
Source elements can d... | lib/membrane/element/base/source.ex | 0.869396 | 0.405508 | source.ex | starcoder |
defmodule Starchoice do
@external_resource "README.md"
@moduledoc "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->") |> Enum.fetch!(1)
alias Starchoice.Decoder
@type decoder :: Decoder.t() | funct... | lib/starchoice.ex | 0.900479 | 0.734358 | starchoice.ex | starcoder |
defmodule Unicode.Block do
@moduledoc """
Functions to introspect Unicode
blocks for binaries
(Strings) and codepoints.
"""
@behaviour Unicode.Property.Behaviour
alias Unicode.Utils
@blocks Utils.blocks()
|> Utils.remove_annotations()
@doc """
Returns the map of Unicode
blocks.
T... | lib/unicode/block.ex | 0.918045 | 0.611324 | block.ex | starcoder |
defmodule DemoWeb.UrGame do
@special_positions [4, 8, 14]
@battle_ground 5..12
@home_position 15
@initial_state %{
current_roll: nil,
alice_socket: nil,
bob_socket: nil,
current_player: :alice,
alice: Enum.map(1..7, fn _ -> 0 end),
bob: Enum.map(1..7, fn _ -> 0 end),
winner: nil
}... | lib/demo_web/live/ur_game.ex | 0.508788 | 0.412205 | ur_game.ex | starcoder |
defmodule Instream.Encoder.Line do
@moduledoc """
Encoder module for the line protocol.
Takes a list of points and returns the data string to be passed
to the write endpoint of influxdb.
"""
@type point_map :: %{
required(:fields) => [{term, term}],
required(:measurement) => term,
... | lib/instream/encoder/line.ex | 0.757122 | 0.472501 | line.ex | starcoder |
defmodule ExopData.Generators.Float do
@moduledoc """
Implements ExopData generators behaviour for `float` parameter type.
"""
alias ExopData.Generators.AliasResolvers.Numericality
@behaviour ExopData.Generator
@diff 0.1
def generate(opts \\ %{}, _props_opts \\ %{}) do
opts |> Map.get(:numericalit... | lib/exop_data/generators/float.ex | 0.742982 | 0.555978 | float.ex | starcoder |
defmodule Axon.Training do
@moduledoc """
Abstractions for training machine learning models.
"""
require Axon
require Axon.Updates
alias Axon.Training.Step
@doc false
def step({_, _} = model, {_, _} = update), do: step(model, update, [])
@doc """
Represents a single training step.
The first tw... | lib/axon/training.ex | 0.855384 | 0.713163 | training.ex | starcoder |
defmodule AbsintheCache.BeforeSend do
@moduledoc ~s"""
Cache & Persist API Call Data right before sending the response.
This module is responsible for persisting the whole result of some queries
right before it is send to the client.
All queries that did not raise exceptions and were successfully handled
... | lib/before_send.ex | 0.764672 | 0.474692 | before_send.ex | starcoder |
defmodule Oauth2MetadataUpdater do
@moduledoc """
Oauth2MetadataUpdater dynamically loads metadata (lazy-loading) and keeps it in memory for further access. Examples:
It Implements the following standards:
- [RFC8414](https://tools.ietf.org/html/rfc8414) - OAuth 2.0 Authorization Server Metadata
- Ex... | lib/oauth2_metadata_updater.ex | 0.869105 | 0.866641 | oauth2_metadata_updater.ex | starcoder |
defmodule Ecto.Adapter.Queryable do
@moduledoc """
Specifies the query API required from adapters.
If your adapter is only able to respond to one or a couple of the query functions,
add custom implementations of those functions directly to the Repo
by using `c:Ecto.Adapter.__before_compile__/1` instead.
""... | lib/ecto/adapter/queryable.ex | 0.919615 | 0.634204 | queryable.ex | starcoder |
defmodule Cli.Render do
@moduledoc """
Module used for formatting output into charts and tables.
"""
@bar_chart_block "▇"
@bar_chart_empty_block "-"
@bar_chart_ellipsis "..."
@day_minutes 24 * 60
@week_minutes 7 * @day_minutes
@month_minutes 31 * @day_minutes
@doc """
Builds a line chart from th... | lib/cli/render.ex | 0.83545 | 0.538923 | render.ex | starcoder |
defmodule AWS.AutoScaling do
@moduledoc """
With Application Auto Scaling, you can automatically scale your AWS
resources. The experience similar to that of [Auto
Scaling](https://aws.amazon.com/autoscaling/). You can use Application Auto
Scaling to accomplish the following tasks:
<ul> <li> Define scaling... | lib/aws/autoscaling.ex | 0.89539 | 0.52543 | autoscaling.ex | starcoder |
defmodule AWS.Streams.DynamoDB 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](http://docs.aws.amazon.com/amazo... | lib/aws/streams_dynamodb.ex | 0.886844 | 0.54698 | streams_dynamodb.ex | starcoder |
defmodule Sponsorly.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
@derive {Inspect, except: [:password]}
schema "users" do
field :confirmed_at, :naive_datetime
field :email, :string
field :hashed_password, :string
field :slug, :string
field :is_creator, :boolean
field :is_spons... | lib/sponsorly/accounts/user.ex | 0.685213 | 0.434461 | user.ex | starcoder |
defmodule ResxDropbox do
@moduledoc """
A producer to handle dropbox URIs.
ResxDropbox.open("dbpath:/path/to/file.txt")
ResxDropbox.open("dbid:AAAAAAAAAAAAAAAAAAAAAA")
Add `ResxDropbox` to your list of resx producers.
config :resx,
producers: [ResxDropbox]
#... | lib/resx_dropbox.ex | 0.743075 | 0.414484 | resx_dropbox.ex | starcoder |
defmodule Joi do
@external_resource "README.md"
@moduledoc "README.md"
|> File.read!()
|> String.split("<!-- MDOC !-->")
|> Enum.fetch!(1)
alias Joi.Type
@doc ~S"""
Validate the data by schema
Examples:
iex> schema = %{
...> id: [:string, uuid: tru... | lib/joi.ex | 0.734596 | 0.406361 | joi.ex | starcoder |
defmodule Raxx.Router do
@moduledoc """
Simple router for Raxx applications.
A router is a list of associations between a request pattern and controller module.
`Raxx.Router` needs to be used after `Raxx.Server`,
it is an extension to a standard Raxx.Server.
Each controller module that is passed requests ... | lib/raxx/router.ex | 0.794664 | 0.532729 | router.ex | starcoder |
defmodule Dataset do
@moduledoc """
Defines the structure of a dataset within Hindsight.
Datasets track the metadata attached to a collection of data
including the owning entity (source) for the data, a description
and keywords for catagorizing and discoverability, and a profile
of updates to the data and ... | apps/definition_dataset/lib/dataset.ex | 0.775732 | 0.768603 | dataset.ex | starcoder |
defmodule Porterage do
@moduledoc """
Checks, fetches and delivers configurable data sources.
## Usage
Place a porterage instance in your supervision tree:
{
Porterage,
%{
deliverer: MyDeliverer,
deliverer_opts: %{},
fetcher: MyFetcher,
fetcher_op... | lib/porterage.ex | 0.81409 | 0.429429 | porterage.ex | starcoder |
defmodule BSON.Binary do
@moduledoc """
Represents BSON binary type
"""
defstruct [binary: nil, subtype: :generic]
defimpl Inspect do
def inspect(%BSON.Binary{binary: value, subtype: :generic}, _opts) do
"#BSON.Binary<#{Base.encode16(value, case: :lower)}>"
end
def inspect(%BSON.Binary{bi... | lib/bson/types.ex | 0.772273 | 0.519521 | types.ex | starcoder |
defmodule Fxnk.Logic do
@moduledoc """
`Fxnk.Logic` are functions for dealing with booleans.
"""
import Fxnk.Functions, only: [curry: 1]
@doc """
Curried `and?/2`.
## Examples
iex> isTwo? = Fxnk.Logic.and?(2)
iex> isTwo?.(2)
true
iex> isTwo?.(3)
false
"""
@spec and?(any... | lib/fxnk/logic.ex | 0.908496 | 0.652975 | logic.ex | starcoder |
defmodule Condiment do
@moduledoc """
Add flavors to your context APIs easily!
No need to create different functions to cater to different use cases, instead you can have one single public function and add flavors conditionally, with Condiment.
"""
@type t :: %__MODULE__{
token: any(),
o... | lib/condiment.ex | 0.781956 | 0.581511 | condiment.ex | starcoder |
defmodule HLClock do
@moduledoc """
Hybrid Logical Clock
Provides globally-unique, monotonic timestamps. Timestamps are bounded by the
clock synchronization constraint, max_drift. By default the max_drift is set
to 300 seconds.
In order to account for physical time drift within the system, timestamps
sh... | lib/hlclock.ex | 0.918192 | 0.580293 | hlclock.ex | starcoder |
defmodule Velocy.Decoder do
@moduledoc false
# The implementation of this decoder is heavily inspired by that of Jason (https://github.com/michalmuskala/jason)
use Bitwise
alias Velocy.{Codegen, Error}
import Codegen, only: [bytecase: 2]
@spec parse(binary(), keyword()) :: {:ok, any()} | {:error, any()}
... | lib/velocy/decoder.ex | 0.514156 | 0.565239 | decoder.ex | starcoder |
defmodule Vnu.Assertions do
@moduledoc "ExUnit assertions for checking the validity of HTML, CSS, and SVG documents."
alias Vnu.{CLI, Formatter}
@doc """
Asserts that the given HTML document is valid.
## Options
- `:server_url` - The URL of [the Checker server](https://github.com/validator/validator). D... | lib/vnu/assertions.ex | 0.836103 | 0.628279 | assertions.ex | starcoder |
defmodule Macro.Env do
@moduledoc """
A struct that holds compile time environment information.
The current environment can be accessed at any time as
`__ENV__/0`. Inside macros, the caller environment can be
accessed as `__CALLER__/0`.
An instance of `Macro.Env` must not be modified by hand. If you need ... | lib/elixir/lib/macro/env.ex | 0.916016 | 0.464902 | env.ex | starcoder |
defmodule Tzdata do
@moduledoc """
The Tzdata module provides data from the IANA tz database. Also known
as the Olson/Eggert database, zoneinfo, tzdata and other names.
A list of time zone names (e.g. `America/Los_Angeles`) are provided.
As well as functions for finding out the UTC offset, abbreviation,
st... | deps/tzdata/lib/tzdata.ex | 0.900729 | 0.441372 | tzdata.ex | starcoder |
defmodule Ockam.Wire do
@moduledoc """
Encodes and decodes messages that can be transported on the wire.
"""
alias Ockam.Address
alias Ockam.Message
alias Ockam.Wire.DecodeError
alias Ockam.Wire.EncodeError
require DecodeError
require EncodeError
@default_implementation Ockam.Wire.Binary.V1
@... | implementations/elixir/ockam/ockam/lib/ockam/wire.ex | 0.936416 | 0.451871 | wire.ex | starcoder |
defmodule ShopifexWeb.PaymentController do
@moduledoc """
You can use this module inside of another controller to handle initial iFrame load and shop installation
Example:
mix phx.gen.html Shops Plan plans name:string price:string features:array grants:array test:boolean
mix phx.gen.html Shops Grant grants ... | lib/shopifex_web/controllers/payment_controller.ex | 0.745954 | 0.44059 | payment_controller.ex | starcoder |
defmodule VintageNet.InterfacesMonitor.Info do
@moduledoc false
alias VintageNet.{IP, PropertyTable}
@link_if_properties [:lower_up, :mac_address]
@address_if_properties [:addresses]
@all_if_properties [:present] ++ @link_if_properties ++ @address_if_properties
defstruct ifname: nil,
link: %... | lib/vintage_net/interfaces_monitor/info.ex | 0.788502 | 0.677714 | info.ex | starcoder |
defmodule Absinthe.Subscription do
@moduledoc """
Real time updates via GraphQL
For a how to guide on getting started with Absinthe.Subscriptions in your phoenix
project see the Absinthe.Phoenix package.
Define in your schema via `Absinthe.Schema.subscription/2`
## Basic Usage
## Performance Character... | lib/absinthe/subscription.ex | 0.804828 | 0.781038 | subscription.ex | starcoder |
defmodule Honcho.Cogs.Help do
@moduledoc false
# Adapted from https://github.com/jchristgit/bolt/blob/master/lib/bolt/cogs/help.ex
@behaviour Nosedrum.Command
alias Nosedrum.Storage.ETS, as: CommandStorage
alias Nostrum.Api
alias Nostrum.Struct.Embed
@spec prefix() :: String.t()
defp prefix, do: App... | lib/honcho/cogs/help.ex | 0.760606 | 0.536981 | help.ex | starcoder |
defmodule Phoenix.LiveDashboard.Router do
@moduledoc """
Provides LiveView routing for LiveDashboard.
"""
@doc """
Defines a LiveDashboard route.
It expects the `path` the dashboard will be mounted at
and a set of options.
## Options
* `:metrics` - Configures the module to retrieve metrics from.... | lib/phoenix/live_dashboard/router.ex | 0.86792 | 0.442576 | router.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.