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 Imagineer.Image.PNG.Helpers do
@doc """
Given a PNG's color type, returns its color format
"""
def color_format(0), do: :grayscale
def color_format(2), do: :rgb
def color_format(3), do: :palette
def color_format(4), do: :grayscale_alpha
def color_format(6), do: :rgb_alpha
@doc """
Given a... | lib/imagineer/image/png/helpers.ex | 0.889475 | 0.719063 | helpers.ex | starcoder |
defmodule GameOfThree.Domain.Game do
@moduledoc """
The Game module is responsible by evaluate the player's movements
and announce the winner or pass the turn for the opponent
"""
defstruct game_id: nil,
game_name: nil,
player_a: nil,
player_b: nil,
move: nil,
... | lib/game_of_three/domain/game.ex | 0.746324 | 0.549157 | game.ex | starcoder |
defmodule PhoenixStarter.Uploads do
@moduledoc """
Logic for creating direct uploads to AWS S3.
"""
@default_upload_limit 25 * 1024 * 1024
@doc """
Returns a presigned URL to the upload on S3.
It is assumed that the given param is a list of maps with string keys `variation`
and `key`. The returned UR... | lib/phoenix_starter/uploads.ex | 0.843525 | 0.407216 | uploads.ex | starcoder |
defmodule Harald.HCI.Transport do
@moduledoc """
A server to manage lower level transports and parse bluetooth events.
"""
use GenServer
@type adapter() :: module()
@type adapter_opts() :: keyword(any())
@type id() :: atom()
@typedoc """
## Options
`:adapter_opts` - `adapter_opts()`. `[]`. The o... | lib/harald/hci/transport.ex | 0.825414 | 0.507873 | transport.ex | starcoder |
defmodule Bible.Versions.ESV do
@moduledoc """
Contains the meta data for the English Standard Version (ESV) bible.
The format of a version file is as follows:
Line 1 : 'T tt bb ccc name'
Line 2 : vvv vvv vvv ...
Where: 'T' is either "O" or "N" for old or new testament book.
tt is the order of the book in it... | lib/bible/versions/esv.ex | 0.644449 | 0.709311 | esv.ex | starcoder |
defmodule Sonda.Sink.Memory do
defmodule Defaults do
def signals, do: :any
end
defstruct signals: Defaults.signals(), records: []
@type message :: {Sonda.Sink.signal(), Sonda.Sink.timestamp(), any()}
@type accepted_signals :: :any | [Sonda.Sink.signal()]
@type config_opts :: [
{:signals, acc... | lib/sonda/sink/memory.ex | 0.813794 | 0.474875 | memory.ex | starcoder |
defmodule Vivaldi.Peer.Coordinate do
@moduledoc """
Contains the core logic, where the coordinate of a peer is updated
when it communicates with another peer
Ported from [hashicorp/serf](https://github.com/hashicorp/serf/tree/master/coordinate)
"""
use GenServer
require Logger
alias Vivaldi.Peer.{C... | vivaldi/lib/peer/coordinate.ex | 0.766862 | 0.455865 | coordinate.ex | starcoder |
defmodule NewRelic.Tracer do
@moduledoc """
Function Tracing
To enable function tracing in a particular module, `use NewRelic.Tracer`,
and annotate the functions you want to `@trace`.
Traced functions will report as:
- Segments in Transaction Traces
- Span Events in Distributed Traces
- Special custom... | lib/new_relic/tracer.ex | 0.889418 | 0.784154 | tracer.ex | starcoder |
defmodule IEx do
@moduledoc ~S"""
Elixir's interactive shell.
Some of the functionalities described here will not be available
depending on your terminal. In particular, if you get a message
saying that the smart terminal could not be run, some of the
features described here won't work.
## Helpers
IE... | lib/iex/lib/iex.ex | 0.779783 | 0.517693 | iex.ex | starcoder |
defmodule Mockery do
@moduledoc """
Core functionality
"""
alias Mockery.Utils
defmacro __using__(_opts) do
quote do
import Mockery
import Mockery.Assertions
import Mockery.History, only: [enable_history: 0, enable_history: 1, disable_history: 0]
end
end
@typep global_mock :: m... | lib/mockery.ex | 0.845401 | 0.464598 | mockery.ex | starcoder |
defmodule TrademarkFreeStrategicLandWarfare.Players.Johnny5 do
alias TrademarkFreeStrategicLandWarfare.{Board, Player, Piece}
@behaviour Player
@type direction() :: :north | :west | :east | :south
@type count() :: Integer.t()
@type state() :: any()
@spec name() :: binary()
def name() do
"Johnny5"
... | lib/trademark_free_strategic_land_warfare/players/johnny_5.ex | 0.528047 | 0.501404 | johnny_5.ex | starcoder |
defmodule Geo.PostGIS do
@moduledoc """
PostGIS functions that can used in ecto queries
[PostGIS Function Documentation](http://postgis.net/docs/manual-1.3/ch06.html).
Currently only the OpenGIS functions are implemented.
## Examples
defmodule Example do
import Ecto.Query
import Geo.P... | lib/geo_postgis.ex | 0.788868 | 0.895294 | geo_postgis.ex | starcoder |
defmodule Conform.Schema.Transform do
@moduledoc """
This module defines the behaviour for custom transformations.
Transformations can be defined inline, in which case this behaviour need not be used,
but if you want to define reusable transforms which you can reference in your
schema, you should implement t... | lib/conform/schema/transform.ex | 0.741206 | 0.511778 | transform.ex | starcoder |
defrecord Mix.Dep, [ scm: nil, app: nil, requirement: nil, status: nil, opts: nil,
deps: [], source: nil, manager: nil ] do
@moduledoc """
This is a record that keeps information about your project
dependencies. It keeps:
* scm - a module representing the source code management tool (SCM) ... | lib/mix/lib/mix/deps.ex | 0.859177 | 0.434041 | deps.ex | starcoder |
defmodule Day5 do
@input "priv/inputs/day5.txt"
defp get_input(), do: File.read!(@input)
def part1() do
get_input()
|> get_program()
|> compute()
end
def test(input) do
input
|> get_program()
|> compute()
end
defp get_program(input) do
input
|> String.split(",", t... | lib/Day5.ex | 0.524151 | 0.41739 | Day5.ex | starcoder |
defmodule Relay.Marathon.Store do
@moduledoc """
A store for Marathon apps and tasks. Keeps a mapping of apps to their tasks
and triggers updates when a new version of an app or task is stored.
"""
alias Relay.Marathon.{Adapter, App, Task}
alias Relay.Resources
use LogWrapper, as: Log
use GenServer
... | lib/relay/marathon/store.ex | 0.795181 | 0.402069 | store.ex | starcoder |
defmodule QRCodeEx.PNG do
@moduledoc """
Render the QR Code matrix in PNG format
```elixir
qr_code_content
|> QRCodeEx.encode()
|> QRCodeEx.png()
```
You can specify the following attributes of the QR code:
* `color`: In binary format. The default is `<<0, 0, 0>>`
* `background_color`: In binary ... | lib/eqrcode/png.ex | 0.87266 | 0.894329 | png.ex | starcoder |
defmodule PasswordValidator.Validators.LengthValidator do
@moduledoc """
Validates a password by checking the length of the password.
"""
@behaviour PasswordValidator.Validator
@doc """
Validate the password by checking the length
Example config (min 5 characters, max 9 characters):
```
[
lengt... | lib/password_validator/validators/length_validator.ex | 0.926728 | 0.790247 | length_validator.ex | starcoder |
defmodule Callisto.Query do
alias __MODULE__
alias Callisto.{Cypher, Vertex}
defstruct create: nil,
match: nil,
merge: nil,
where: nil,
set: nil,
delete: nil,
order: nil,
limit: nil,
return: nil,
piped_que... | lib/callisto/query.ex | 0.712832 | 0.452536 | query.ex | starcoder |
defmodule BMP3XX do
@moduledoc """
Read pressure and temperature from a Bosch BMP388 or BMP390 sensor
"""
use GenServer
require Logger
@type sensor_mod :: BMP3XX.BMP388 | BMP3XX.BMP390
@type bus_address :: 0x76 | 0x77
@typedoc """
BMP3XX GenServer start_link options
* `:name` - a name for the ... | lib/bmp3xx.ex | 0.928999 | 0.545588 | bmp3xx.ex | starcoder |
defmodule Elsa do
@moduledoc """
Provides public api to Elsa. Top-level short-cuts to sub-module functions
for performing basic interactions with Kafka including listing, creating,
deleting, and validating topics. Also provides a function for one-off
produce_sync of message(s) to a topic.
"""
@typedoc "n... | lib/elsa.ex | 0.821868 | 0.522446 | elsa.ex | starcoder |
defmodule Noizu.EmailService.Email.Binding.Substitution.Dynamic.Effective do
@vsn 1.0
alias Noizu.EmailService.Email.Binding.Substitution.Dynamic.Selector
alias Noizu.EmailService.Email.Binding.Substitution.Dynamic.Section
alias Noizu.EmailService.Email.Binding.Substitution.Dynamic.Formula
@type t :: %... | lib/email_service/entities/email/binding/substitution/dynamic/effective.ex | 0.591605 | 0.440469 | effective.ex | starcoder |
defmodule Univrse.Alg.AES_CBC_HMAC do
@moduledoc """
AES_CBC_HMAC algorithm module.
Sign and encrypt messages using AES-CBC symetric encryption, with HMAC message
authentication.
https://tools.ietf.org/html/rfc7518#section-5.2.2
"""
alias Univrse.Key
@doc """
Decrypts the cyphertext with the key us... | lib/univrse/alg/aes_cbc_hmac.ex | 0.658747 | 0.473475 | aes_cbc_hmac.ex | starcoder |
defmodule Identicon do
def main(input) do
input
|> hash_input
|> pick_color
|> build_grid
|> filter_odd_squares
|> build_pixel_map
|> draw_image
|> save_image(input) #input is actually second argument, first one comes from the pipe (image)
end
... | lib/identicon.ex | 0.815159 | 0.408395 | identicon.ex | starcoder |
defmodule Hammox.Protect do
@moduledoc """
A `use`able module simplifying protecting functions with Hammox.
The explicit way is to use `Hammox.protect/3` and friends to generate
protected versions of functions as anonymous functions. In tests, the most
convenient way is to generate them once in a setup hook ... | lib/hammox/protect.ex | 0.791096 | 0.667185 | protect.ex | starcoder |
defmodule SFTPToolkit.Recursive do
@moduledoc """
Module containing functions that allow to do recursive
operations on the directories.
"""
@default_operation_timeout 5000
@doc """
Recursively creates a directory over existing SFTP channel.
## Arguments
Expects the following arguments:
* `sftp_... | lib/sftp_toolkit/recursive.ex | 0.884794 | 0.625638 | recursive.ex | starcoder |
defmodule Jumubase.JumuParams do
import Jumubase.Gettext
@moduledoc """
Defines various params inherent to the Jumu institution.
"""
@doc """
Returns the year for a given season.
"""
def year(season) do
1963 + season
end
@doc """
Returns the season for a given year.
"""
def season(year)... | lib/jumubase/jumu_params.ex | 0.829561 | 0.500122 | jumu_params.ex | starcoder |
defmodule ABI.TypeDecoder do
@moduledoc """
`ABI.TypeDecoder` is responsible for decoding types to the format
expected by Solidity. We generally take a function selector and binary
data and decode that into the original arguments according to the
specification.
"""
@doc """
Decodes the given data based... | lib/abi/type_decoder.ex | 0.915374 | 0.534248 | type_decoder.ex | starcoder |
defmodule Finitomata.PlantUML do
@moduledoc false
import NimbleParsec
alias Finitomata.Transition
use Boundary, deps: [Finitomata], exports: []
@alphanumeric [?a..?z, ?A..?Z, ?0..?9, ?_]
blankspace = ignore(ascii_string([?\s], min: 1))
transition_op = string("-->")
event_op = string(":")
event =
... | lib/finitomata/parsers/plant_uml.ex | 0.712432 | 0.474266 | plant_uml.ex | starcoder |
defmodule Dust.Requests.Proxy do
@moduledoc """
Proxy configuration struct.
Proxy address can start with `http/s` or `socks5`.
It is also possible to only specify `address` field
and when you call `Proxy.get_config/1` then we try to
parse URI to figure out type, auth details in this case
default values wi... | lib/dust/requests/proxy.ex | 0.740831 | 0.631779 | proxy.ex | starcoder |
defmodule Rir.Api do
@moduledoc """
Functions that update a given context with datasets by querying the RIPEstat API
Notes:
- AS nrs are strings, without the AS prefix, e.g. AS42 -> "42"
- Each API endpoint has a map stored under its own key in the context
- Each API call has its results stored under the r... | lib/rir/api.ex | 0.52902 | 0.663941 | api.ex | starcoder |
defmodule RpiBacklight.AutoDimmer do
@moduledoc """
A simple automatic screen blanker.
`AutoDimmer` can be started under a supervision tree and it will take care
to dim and poweroff the display. By default the timeout is 10 seconds and
the brightness level is 255, the maximum allowed.
Is responsibity of t... | lib/rpi_backlight/auto_dimmer.ex | 0.910344 | 0.537223 | auto_dimmer.ex | starcoder |
defmodule Plenario.Etl.FieldGuesser do
require Logger
import Plenario.Utils, only: [parse_timestamp: 1]
alias Plenario.DataSet
alias Plenario.Etl.Downloader
alias Socrata.Client
@download_limit 10 # chunks
@num_rows 1_001
@soc_types %{
"calendar_date" => "timestamp",
"checkbox" => "boole... | lib/plenario/etl/field_guesser.ex | 0.642657 | 0.437884 | field_guesser.ex | starcoder |
defmodule ExHashRing.Node do
@moduledoc """
Types and Functions for working with Ring Nodes and their Replicas
"""
alias ExHashRing.Hash
@typedoc """
Nodes are uniquely identified in the ring by their name.
"""
@type name :: binary()
@typedoc """
Replicas is a count of how many times a Node shoul... | lib/ex_hash_ring/node.ex | 0.887525 | 0.710829 | node.ex | starcoder |
defmodule Gradient.ElixirFmt do
@moduledoc """
Module that handles formatting and printing error messages produced by Gradualizer in Elixir.
Options:
- `ex_colors`: list of color options:
- {`use_colors`, boolean()}: - wheather to use the colors, default: true
- {`expression`, ansicode()}: color of the... | lib/gradient/elixir_fmt.ex | 0.82748 | 0.54468 | elixir_fmt.ex | starcoder |
defmodule Membrane.Core.Element.Toilet do
@moduledoc false
# Toilet is an entity that can be filled and drained. If it's not drained on
# time and exceeds its capacity, it overflows by logging an error and killing
# the responsible process (passed on the toilet creation).
require Membrane.Logger
@opaque ... | lib/membrane/core/element/toilet.ex | 0.683947 | 0.481759 | toilet.ex | starcoder |
defmodule Dynamo.HTTP.Case do
@moduledoc ~S"""
A bunch of helpers to make it easy to test Dynamos and routers.
By default, these helpers are macros that dispatch directly
to the registered endpoint. Here is an example:
defmodule MyAppTest do
use ExUnit.Case
use Dynamo.HTTP.Case
... | lib/dynamo/http/case.ex | 0.892639 | 0.593609 | case.ex | starcoder |
defmodule SiteWeb.ScheduleView.StopList do
alias SiteWeb.ViewHelpers
alias Site.StopBubble
@doc """
Link to expand or collapse a route branch.
Note: The target element (with id `"target_id"`) must also have class `"collapse stop-list"`
for the javascript to appropriately modify the button and the dotted/s... | apps/site/lib/site_web/views/schedule/stop_list.ex | 0.809953 | 0.412974 | stop_list.ex | starcoder |
defmodule Mix.Tasks.Authority.Gen.Context do
use Mix.Task
alias Mix.Authority.Ecto.Context
@shortdoc "Generate a context with Authority"
@moduledoc """
Generates a new context with Authority ready to go.
mix authority.gen.context Accounts
The following files will be created (assuming the provided... | lib/mix/tasks/authority.gen.context.ex | 0.810741 | 0.406214 | authority.gen.context.ex | starcoder |
defmodule Exred.Library.NodePrototype do
@moduledoc """
### Basic Example
```elixir
defmodule Exred.Node.HelloWorld do
@moduledoc \"""
Sends "<NAME>" or any other configured greeting as payload
when it receives a message.
**Incoming message format**
Anything / ignored
**Outgoing messag... | lib/exred_library/node_prototype.ex | 0.827967 | 0.778733 | node_prototype.ex | starcoder |
defmodule Structex.Hysteresis.InsertedWoodenSidingWall do
@moduledoc """
Calculates rigidity and ultimate strength of the inserted wooden siding walls.
Depending the following study.
https://www.jstage.jst.go.jp/article/aijs/76/659/76_659_97/_article/-char/ja/
"""
@doc """
初期すべり変形角R0
wall_inner_length ... | lib/structex/hysteresis/inserted_wooden_siding_wall.ex | 0.551574 | 0.476519 | inserted_wooden_siding_wall.ex | starcoder |
defmodule Rps do
@moduledoc """
The `RPS` app is composed by 4 main components:
* `Rps.Games.Fsm` - This might be the main component, since it is the one
that implements the logic of the game itself; it handles the game session.
When a match is created, a new FSM (or session) instance can be create... | lib/rps.ex | 0.826081 | 0.715821 | rps.ex | starcoder |
defmodule TubeStreamer.Metrics do
require Logger
alias :exometer, as: Exometer
def subscribe([:erlang, :beam, :star_time], _), do: []
def subscribe([:api, :request, :counter, _status] = metric, :counter), do:
{metric, :value, get_interval(), [series_name: "api.request.counter",
... | lib/tube_streamer/metrics.ex | 0.784071 | 0.415225 | metrics.ex | starcoder |
defmodule BitFlagger do
@moduledoc """
A set of functions that manipulate bit flags.
"""
use Bitwise, only_operators: true
@type state :: non_neg_integer | binary
@type index :: non_neg_integer
@doc """
Converts state to a list of boolean values.
## Examples
iex> parse(0b1010, 4)
[fal... | lib/bit_flagger.ex | 0.814385 | 0.502441 | bit_flagger.ex | starcoder |
defmodule Transpose do
@moduledoc false
def transpose(m) do
attach_row(m, [])
end
@doc """
Given a matrix and a result, make the first row into a column,
attach it to the result, and then recursively attach the
remaining rows to that new result.
When the original matrix has no rows remaining, the... | lib/transpose.ex | 0.770422 | 0.879716 | transpose.ex | starcoder |
defmodule Flexto do
@moduledoc """
Configuration-driven Ecto Schemata.
"""
@doc """
Adds additional associations dynamically from app config.
Reads config for the given OTP application, under the name of the
current module. Each key maps to an Ecto.Schema function:
* `belongs_to`
* `field`
* `has... | lib/flexto.ex | 0.838084 | 0.780662 | flexto.ex | starcoder |
defmodule ArangoXEcto.Migration do
@moduledoc """
Defines Ecto Migrations for ArangoDB
**NOTE: ArangoXEcto dynamically creates collections for you and this method is discouraged unless
you need to define indexes.**
Migrations must use this module, otherwise migrations will not work. To do this, replace
`u... | lib/arangox_ecto/migration.ex | 0.874694 | 0.520557 | migration.ex | starcoder |
defmodule EnumParser do
@moduledoc """
EnumParser transform your Enum.
You must consider, transform enums have a significant cost
"""
@doc ~S"""
Transform map's keys to atom
# Example:
iex> EnumParser.to_atom_key(%{"key" => "value"})
%{key: "value"}
"""
def to_atom_key(enum) when... | lib/enum_parser.ex | 0.698535 | 0.430866 | enum_parser.ex | starcoder |
defmodule Solana.SPL.Governance do
@moduledoc """
Functions for interacting with the [SPL Governance
program](https://github.com/solana-labs/solana-program-library/tree/master/governance#readme).
The governance program aims to provide core building blocks for creating
Decentralized Autonomous Organizations (... | lib/solana/spl/governance.ex | 0.833934 | 0.432303 | governance.ex | starcoder |
defmodule Flipay.BestRateFinder do
@moduledoc """
Find the best rate according to input/output assets, input amount and exchange's order book.
"""
@doc """
Finds the best rate for input request.
Order book comes from specific exchange and the quotes are sorted by best to worst order.
Input/output assets ... | lib/flipay/best_rate_finder.ex | 0.846562 | 0.542984 | best_rate_finder.ex | starcoder |
defmodule PokerValidator do
@moduledoc """
This is the main module for validating the hands.
"""
alias PokerValidator.Combination
alias PokerValidator.Hand
alias PokerValidator.Card
@doc """
With a given list of cards (Greater or equal than 5), this function evaluates
the best possible hand, it retur... | lib/poker_validator.ex | 0.739422 | 0.454351 | poker_validator.ex | starcoder |
defmodule EVM.Memory do
@moduledoc """
Functions to help us handle memory operations
in the MachineState of the VM.
"""
alias EVM.MachineState
@type t :: binary()
@doc """
Reads a word out of memory, and also decides whether or not
we should increment number of active words in our machine state.
... | apps/evm/lib/evm/memory.ex | 0.799599 | 0.464476 | memory.ex | starcoder |
defmodule Solana.SPL.Token do
@moduledoc """
Functions for interacting with Solana's [Token
Program](https://spl.solana.com/token).
"""
alias Solana.{Instruction, Account, SystemProgram}
import Solana.Helpers
@typedoc "Token account metadata."
@type t :: %__MODULE__{
mint: Solana.key(),
... | lib/solana/spl/token.ex | 0.907838 | 0.423041 | token.ex | starcoder |
defmodule Scenic.Primitive.Style.Paint.Image do
alias Scenic.Assets.Static
@moduledoc """
Fill a primitive with an image from Scenic.Assets.Static
### Data Format
`{:image, id}`
Fill with the static image indicated by `id`
The `id` can be either the name of the file when the static assets library wa... | lib/scenic/primitive/style/paint/image.ex | 0.898023 | 0.867429 | image.ex | starcoder |
defmodule Reductions do
@moduledoc """
Utility functions for reducing lists.
"""
defmacro __using__(_opts) do
quote do
import Reductions
end
end
use InliningTools
# [0.1, 0.2, 0.3]
# fun +
# acc = [0.1], xs = [0.2, 0.3]
# acc = [0.1], item = 0.2, xs = [0.3]
# [fun(hd(acc), item) ... | lib/mulix/genome/reductions.ex | 0.739611 | 0.613975 | reductions.ex | starcoder |
defmodule Sippet.Message.RequestLine do
@moduledoc """
A SIP Request-Line struct, composed by the Method, Request-URI and
SIP-Version.
The `start_line` of requests are represented by this struct. The RFC 3261
represents the Request-Line as:
Request-Line = Method SP Request-URI SP SIP-Version CRLF
... | lib/sippet/message/request_line.ex | 0.922752 | 0.475179 | request_line.ex | starcoder |
defmodule SecureX.Helper do
@moduledoc false
@spec keys_to_atoms(any()) :: map()
def keys_to_atoms(string_key_map) when is_map(string_key_map) do
for {key, val} <- string_key_map, into: %{} do
if is_struct(val) do
if val.__struct__ in [DateTime, NaiveDateTime, Date, Time] do
{String.t... | lib/utils/helper.ex | 0.806815 | 0.405743 | helper.ex | starcoder |
defmodule Bintreeviz.Node do
@moduledoc """
Bintreeviz.Node describes a single Node in the graph and contains the functions
to manipulate said Nodes.
"""
@padding 4
alias __MODULE__
@type t() :: %Node{
label: String.t(),
x: non_neg_integer(),
y: non_neg_integer(),
... | lib/node.ex | 0.841598 | 0.643336 | node.ex | starcoder |
defmodule Hive do
@moduledoc """
Efficient in-memory fleet state management
where each vehicle is a separate process
which manages it's own state and provides
APIs to access and use it.
Public API exposed under Hive module.
"""
use Hive.Base
import Hive.Vehicle.Helpers
@doc """
Infleet by `vehic... | lib/hive.ex | 0.713232 | 0.456046 | hive.ex | starcoder |
defmodule ExQueb do
@moduledoc """
Build Ecto filter Queries.
"""
import Ecto.Query
@doc """
Create the filter
Uses the :q query parameter to build the filter.
"""
def filter(query, params) do
filters =
params[Application.get_env(:ex_queb, :filter_param, :q)]
|> params_to_filters()
... | lib/ex_queb.ex | 0.719482 | 0.418459 | ex_queb.ex | starcoder |
defmodule ExAws.ACM do
@moduledoc """
Operations for AWS Certificate Manager.
## Basic Usage
```elixir
ExAws.ACM.request_certificate("helloworld.example.com", validation_method: "DNS") |> ExAws.request!()
```
"""
@namespace "CertificateManager"
@type certificate_arn ::
String.t()
@type... | lib/ex_aws/acm.ex | 0.792504 | 0.770119 | acm.ex | starcoder |
defmodule StarkInfra.PixRequest do
alias __MODULE__, as: PixRequest
alias StarkInfra.User.Organization
alias StarkInfra.User.Project
alias StarkInfra.Utils.Parse
alias StarkInfra.Utils.Check
alias StarkInfra.Utils.Rest
alias StarkInfra.Error
@moduledoc """
Groups PixRequest related functions
"""
... | lib/pix_request/pix_request.ex | 0.851999 | 0.51812 | pix_request.ex | starcoder |
defmodule Family do
alias Family.Individual
@moduledoc """
Family module is to be used in order to parse GEDCOM 5.5 files.
"""
@individual_tag "INDI"
@name_tag "NAME"
@gender_tag "SEX"
@birthday_tag "BIRT"
@given_name_tag "GIVN"
@surname_tag "SURN"
@family_tag "FAM"
@doc """
Returns a list ... | lib/family.ex | 0.681515 | 0.437763 | family.ex | starcoder |
defmodule Cashtrail.Users do
@moduledoc """
The Users context manages the users data of one entity and performs user
authentication.
See `Cashtrail.Users.User` to have more info about user.
"""
import Ecto.Query, warn: false
alias Cashtrail.Repo
alias Cashtrail.{Paginator, Users}
alias Cashtrail.Us... | apps/cashtrail/lib/cashtrail/users.ex | 0.843219 | 0.421254 | users.ex | starcoder |
defmodule Xfighter.Orderbook do
import Xfighter.API, only: [decode_response: 2, request: 2]
@type entry :: %{price: non_neg_integer, qty: non_neg_integer, isBuy: boolean}
@type t :: %__MODULE__{
ok: boolean,
venue: String.t,
symbol: String.t,
bids: [__MODULE__.ent... | lib/xfighter/orderbook.ex | 0.826151 | 0.867878 | orderbook.ex | starcoder |
defmodule RDF.Turtle.Encoder do
@moduledoc """
An encoder for Turtle serializations of RDF.ex data structures.
As for all encoders of `RDF.Serialization.Format`s, you normally won't use these
functions directly, but via one of the `write_` functions on the `RDF.Turtle`
format module or the generic `RDF.Seria... | lib/rdf/serializations/turtle_encoder.ex | 0.876489 | 0.642545 | turtle_encoder.ex | starcoder |
defmodule Homework.Merchants do
@moduledoc """
The Merchants context.
"""
import Ecto.Query, warn: false
alias Homework.Repo
alias Homework.Pagination
alias Homework.Merchants.Merchant
@doc """
Returns the list of merchants.
## Examples
iex> list_merchants(%{limit: 10, offset: 0})
[... | elixir/lib/homework/merchants.ex | 0.819026 | 0.403508 | merchants.ex | starcoder |
defmodule Numy.Lapack.Vector do
@moduledoc """
LAPACK Vector.
Implements protocols: `Numy.Vc`, `Numy.Vcm`
## Example of mutating `add!`
iex(7)> v = Numy.Lapack.Vector.new([1,2,3])
%Numy.Lapack.Vector{lapack: #Numy.Lapack<shape: [...], ...>, nelm: 3}
iex(8)> Numy.Vcm.add!(v,v)
:ok
... | lib/lapack/lapack_vector.ex | 0.862004 | 0.627252 | lapack_vector.ex | starcoder |
defmodule DaySeventeen do
def solve(input, opts \\ []) do
cycles = Keyword.get(opts, :cycles, 6)
input
|> format_input()
|> step(cycles)
|> count_active()
end
def format_input(input) do
input
|> String.split("", trim: true)
|> build_map()
end
def build_map(input) do
inpu... | adv_2020/lib/day_17.ex | 0.554832 | 0.611817 | day_17.ex | starcoder |
defmodule Advent20.Docking do
@moduledoc """
Day 14: Docking Data
"""
defp parse(input) do
input
|> String.split("\n", trim: true)
|> Enum.map(&String.split(&1, " = "))
|> Enum.map(fn
["mem" <> address_string, value] ->
address = address_string |> String.replace(["[", "]"], "") |>... | lib/advent20/14_docking.ex | 0.808219 | 0.548915 | 14_docking.ex | starcoder |
defmodule LineBot.Message.Action do
@moduledoc """
Represents any one of the possible [Action objects](https://developers.line.biz/en/reference/messaging-api/#action-objects).
"""
@type t() ::
LineBot.Message.Action.Message.t()
| LineBot.Message.Action.URI.t()
| LineBot.Message.Ac... | lib/line_bot/message/action.ex | 0.877503 | 0.5 | action.ex | starcoder |
defmodule Wavexfront.Proxy.Worker do
@moduledoc """
This is the actual connection to the proxy and handle all the TCP
aspect of sending the message to the proxy
"""
use Connection
require Logger
alias Wavexfront.Item
@initial_state %{socket: nil}
def start_link(opts) do
state = Map.merge(@init... | lib/wavexfront/proxy/worker.ex | 0.503418 | 0.413418 | worker.ex | starcoder |
defmodule Kira.RuntimeState do
require Kira.Branch, as: Branch
require Kira.BranchState, as: BranchState
require Kira.Progress, as: Progress
require Kira.Util, as: Util
@moduledoc false
defstruct [:config, :branch_states, :running, :timeout, :progress]
@type branches :: %{required(atom()) => BranchStat... | lib/kira/runtime_state.ex | 0.746509 | 0.408808 | runtime_state.ex | starcoder |
defmodule Cased.Sensitive.Handler do
@moduledoc """
Behaviour used to identify sensitive data.
Implementing custom handlers only requires two functions:
- `c:new/2`, which is called by `from_spec/1`, passing any custom configuration.
- `c:ranges/3`, which is called for each value in an audit event by `Cased... | lib/cased/sensitive/handler.ex | 0.930954 | 0.810629 | handler.ex | starcoder |
import Kernel, except: [length: 1]
defmodule String do
@moduledoc ~S"""
A String in Elixir is a UTF-8 encoded binary.
## Codepoints and graphemes
The functions in this module act according to the Unicode
Standard, version 6.3.0. As per the standard, a codepoint is
an Unicode Character, which may be repre... | lib/elixir/lib/string.ex | 0.848376 | 0.695041 | string.ex | starcoder |
defmodule Rubbergloves.Mapper do
@moduledoc"""
The core module to convert your input into a struct using the previously defined stucture mappings
### Usage
```
Rubbergloves.Mapper.map(LoginRequest, params)
"""
defmodule Override do
defstruct [key: :default, value: :default]
end
defmodule Option... | lib/mapper/mapper.ex | 0.773901 | 0.854156 | mapper.ex | starcoder |
defprotocol PhStTransform do
@moduledoc """
The `PhStTransform` protocol will convert any Elixir data structure
using a given transform into a new data structure.
The `transform/3` function takes the data structure and
a map of transformation functions and a depth list. It
then does a depth-first recursion... | lib/phst_transform.ex | 0.915752 | 0.905615 | phst_transform.ex | starcoder |
defmodule Differ do
alias Differ.Diffable
alias Differ.Patchable
@moduledoc """
Module that computes `diff` for terms
# Using with structs
It is possible to use `Differ` with structs, you need to derive default implementation
for `Differ.Diffable` and `Differ.Patchable` protocols:
```elixir
defmodu... | lib/differ.ex | 0.904033 | 0.87289 | differ.ex | starcoder |
defmodule Alods.Queue do
@moduledoc """
This module takes care of starting a DETS store which will hold the message to be delivered.
"""
import Ex2ms
use Alods.DETS, "queue"
@valid_methods [:get, :post]
@valid_statuses [:pending, :processing]
@doc """
Returns all entries of which their timestamp ... | lib/alods/queue.ex | 0.799638 | 0.412412 | queue.ex | starcoder |
defmodule Elibuf.Primitives do
alias Elibuf.Primitives.Base
@moduledoc """
Protobuf primitive types
* Double, Float
* Int32, Int64
* Uint32, Uint64
* Sint32, Sint64
* Fixed32, Fixed64
* Sfixed32, Sfixed64
* Bool
* String
* Bytes
* Enum
"""
@doc ""... | lib/primitives/primitives.ex | 0.806662 | 0.470615 | primitives.ex | starcoder |
defmodule Ecto.Adapters.SQL.Connection do
@moduledoc """
Specifies the behaviour to be implemented by all SQL connections.
"""
@typedoc "The prepared query which is an SQL command"
@type prepared :: String.t
@typedoc "The cache query which is a DBConnection Query"
@type cached :: map
@doc """
Recei... | lib/ecto/adapters/sql/connection.ex | 0.903145 | 0.431045 | connection.ex | starcoder |
defmodule Math.Enum do
@moduledoc """
Math.Enum defines Math-functions that work on any collection extending the Enumerable protocol.
This means Maps, Lists, Sets, etc., and any custom collection types as well.
"""
require Integer
@doc """
Calculates the product, obtained by multiplying all elements in *... | lib/math/enum.ex | 0.919742 | 0.583144 | enum.ex | starcoder |
defmodule Wobserver2.Util.Process do
@moduledoc ~S"""
Process and pid handling.
"""
import Wobserver2.Util.Helper, only: [string_to_module: 1, format_function: 1]
@process_summary [
:registered_name,
:initial_call,
:memory,
:reductions,
:current_function,
:message_queue_len,
:dic... | lib/wobserver2/util/process.ex | 0.796846 | 0.800653 | process.ex | starcoder |
defmodule AWS.Workspaces do
@moduledoc """
Amazon WorkSpaces Service
Amazon WorkSpaces enables you to provision virtual, cloud-based Microsoft
Windows and Amazon Linux desktops for your users.
"""
@doc """
Associates the specified IP access control group with the specified
directory.
"""
def asso... | lib/aws/workspaces.ex | 0.869798 | 0.431884 | workspaces.ex | starcoder |
defmodule Util.EqualityOperator do
@moduledoc """
The `equalif*` method is designed to allow for unorderd equality comparison between lists.
In an ordered comparison, `[1,2,3]` is not considered equal to `[3,2,1]`, but `equali/fy?|form?` would consider those two lists to be equal.
`equalify|equaliform?` will ... | lib/util/equality_operator.ex | 0.909058 | 0.620118 | equality_operator.ex | starcoder |
defmodule Benchmarks.Proto2.GoogleMessage1 do
@moduledoc false
use Protobuf, syntax: :proto2
field :field1, 1, required: true, type: :string
field :field9, 9, optional: true, type: :string
field :field18, 18, optional: true, type: :string
field :field80, 80, optional: true, type: :bool, default: false
fi... | bench/lib/datasets/google_message1/proto2/benchmark_message1_proto2.pb.ex | 0.590543 | 0.457016 | benchmark_message1_proto2.pb.ex | starcoder |
defmodule ExAws.CloudwatchLogs do
@moduledoc """
Documentation for ExAwsCloudwatchLogs.
"""
import ExAws.Utils, only: [camelize_keys: 1]
@namespace "Logs_20140328"
@doc """
Create a log group with the given name.
## Examples
ExAws.CloudwatchLogs.create_log_group("my-group")
|> ExAws.req... | lib/ex_aws_cloudwatch_logs.ex | 0.752831 | 0.437643 | ex_aws_cloudwatch_logs.ex | starcoder |
defmodule Readability do
@moduledoc """
Readability library for extracting & curating articles.
## Example
```elixir
@type html :: binary
# Just pass url
%Readability.Summary{title: title, authors: authors, article_html: article} = Readability.summarize(url)
# Extract title
Readability.title(html)... | lib/readability.ex | 0.818156 | 0.654177 | readability.ex | starcoder |
defmodule CCSP.Chapter5.ListCompression do
alias __MODULE__, as: T
@moduledoc """
Corresponds to CCSP in Python, Chapter 5, titled "Genetic Algorithms"
NOTE: This is very slow to find a solution... along the lines of a couple of hours.
It does not terminate early and runs through all generations. Maybe an ... | lib/ccsp/chapter5/list_compression.ex | 0.7865 | 0.535402 | list_compression.ex | starcoder |
defmodule ReviewScraper.DealerRater.Scraper do
@moduledoc """
Module responsible for parsing the HTML document.
"""
alias ReviewScraper.DealerRater.Review
@doc """
Find the reviews in an HTML document and parse into the `ReviewScraper.DealerRater.Review` struct.
"""
@spec get_reviews(String.t()) :: [R... | lib/dealer_rater/scraper.ex | 0.722918 | 0.41941 | scraper.ex | starcoder |
defmodule FIQLEx do
@moduledoc """
[FIQL](http://tools.ietf.org/html/draft-nottingham-atompub-fiql-00) (Feed Item Query Language)
is a URI-friendly syntax for expressing filters.
FIQL looks like this:
```
fiql = "author.age=ge=25;author.name==*Doe"
```
Using this module you will be able to parse a FI... | lib/fiql_ex.ex | 0.863909 | 0.904777 | fiql_ex.ex | starcoder |
defmodule AWS.IoT do
@moduledoc """
IoT
IoT provides secure, bi-directional communication between Internet-connected
devices (such as sensors, actuators, embedded devices, or smart appliances) and
the Amazon Web Services cloud.
You can discover your custom IoT-Data endpoint to communicate with, configure... | lib/aws/generated/iot.ex | 0.816113 | 0.459986 | iot.ex | starcoder |
defmodule Dict.Behaviour do
@moduledoc """
This module makes it easier to create your own `Dict` compliant
module, by providing default implementations for some required functions.
Usage:
defmodule MyDict do
use Dict.Behaviour
# implement required functions (see below)
# over... | lib/elixir/lib/dict/behaviour.ex | 0.789721 | 0.642587 | behaviour.ex | starcoder |
defmodule OMG.Watcher.ExitProcessor do
@moduledoc """
Tracks and handles the exits from the child chain, their validity and challenges.
Keeps a state of exits that are in progress, updates it with news from the root chain contract, compares to the
state of the ledger (`OMG.State`), issues notifications as it ... | apps/omg_watcher/lib/omg_watcher/exit_processor.ex | 0.864067 | 0.455441 | exit_processor.ex | starcoder |
defmodule AWS.Amplify do
@moduledoc """
Amplify enables developers to develop and deploy cloud-powered mobile and
web apps. The Amplify Console provides a continuous delivery and hosting
service for web applications. For more information, see the [Amplify
Console User
Guide](https://docs.aws.amazon.com/amp... | lib/aws/amplify.ex | 0.711331 | 0.463201 | amplify.ex | starcoder |
defmodule AbsintheAuth.Policy do
@moduledoc """
Helper functions for use in policies.
## Usage
```
defmodule MyPolicy do
use AbsintheAuth.Policy
end
```
"""
defmacro __using__(_) do
quote do
import unquote(__MODULE__)
end
end
@doc """
Allows a request
For example:
`... | lib/absinthe_auth/policy.ex | 0.717507 | 0.807726 | policy.ex | starcoder |
defmodule EctoTablestore.Schema do
@moduledoc ~S"""
Defines a schema for Tablestore.
Since the atomic increment may need to return the increased value, `EctoTablestore.Schema` module underlying uses `Ecto.Schema`,
and automatically append all `:integer` field type with `read_after_writes: true` option by defau... | lib/ecto_tablestore/schema.ex | 0.910364 | 0.844601 | schema.ex | starcoder |
defmodule Ash.Filter.Runtime do
@moduledoc """
Checks a record to see if it matches a filter statement.
We can't always tell if a record matches a filter statement, and as such
this function may return `:unknown`
"""
alias Ash.Filter.{Expression, Not, Predicate}
def matches?(api, record, filter, dirty_f... | lib/ash/filter/runtime.ex | 0.770033 | 0.574992 | runtime.ex | starcoder |
defmodule SSD1322.Device do
@moduledoc """
This module provides a high-level interface to control and display content on
a SSD1322 based OLED display.
Note that this module is stateless - there is no protection here at all for
concurrent access
For details regarding the magic values used herein, consult... | lib/ssd1322/device.ex | 0.846831 | 0.58062 | device.ex | starcoder |
defmodule StepFlow.WorkerDefinitions do
@moduledoc """
The WorkerDefinitions context.
"""
import Ecto.Query, warn: false
alias StepFlow.Repo
alias StepFlow.WorkerDefinitions.WorkerDefinition
@doc """
Returns the list of WorkerDefinitions.
## Examples
iex> StepFlow.WorkerDefinitions.list_wor... | lib/step_flow/worker_definitions/worker_definitions.ex | 0.755276 | 0.457864 | worker_definitions.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.