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 AWS.KinesisVideo do
@moduledoc """
<p/>
"""
@doc """
Creates a signaling channel.
`CreateSignalingChannel` is an asynchronous operation.
"""
def create_signaling_channel(client, input, options \\ []) do
path_ = "/createSignalingChannel"
headers = []
query_ = []
request(clien... | lib/aws/generated/kinesis_video.ex | 0.901864 | 0.538862 | kinesis_video.ex | starcoder |
defmodule Sanbase.BlockchainAddress.MetricAdapter do
@behaviour Sanbase.Metric.Behaviour
import Sanbase.Utils.Transform, only: [maybe_apply_function: 2, rename_map_keys: 2]
alias Sanbase.Model.Project
alias Sanbase.Balance
@aggregations [:sum, :ohlc]
@default_aggregation :sum
@timeseries_metrics ["his... | lib/sanbase/blockchain_address/metric_adapter.ex | 0.813238 | 0.467149 | metric_adapter.ex | starcoder |
defmodule SanbaseWeb.Graphql.Helpers.CalibrateInterval do
alias Sanbase.DateTimeUtils
def calibrate(module, id, from, to, interval, min_seconds \\ 300, max_data_points \\ 500)
def calibrate(module, id, from, to, "", min_seconds, max_data_points) do
with {:ok, first_datetime} <- module.first_datetime(id) do
... | lib/sanbase_web/graphql/helpers/calibrate_interval.ex | 0.794505 | 0.417598 | calibrate_interval.ex | starcoder |
defmodule HL7 do
@moduledoc """
Main module of the **ex_hl7** library.
"""
alias HL7.{Codec, Message, Reader, Segment, Type, Writer}
@type segment_id :: Type.segment_id()
@type sequence :: Type.sequence()
@type composite_id :: Type.composite_id()
@type field :: Type.field()
@type item_type :: Type.it... | lib/ex_hl7.ex | 0.871434 | 0.487368 | ex_hl7.ex | starcoder |
defmodule Quetzal.Graph do
@doc """
The base module to make graph components based on plotly.js
In order to make components provide two keywords, the first one contains the
div properties and the second the keywords to use as data in PlotlyJS, with this
you are able to build any graph supported into PlotlyJS... | lib/graph/quetzal_graph.ex | 0.746139 | 0.60964 | quetzal_graph.ex | starcoder |
defmodule BSV.Tx do
@moduledoc """
A Tx is a data structure representing a Bitcoin transaction.
A Tx consists of a version number, a list of inputs, list of outputs, and a
locktime value.
A Bitcoin transaction is used to transfer custody of Bitcoins. It can also be
used for smart contracts, recording and ... | lib/bsv/tx.ex | 0.914844 | 0.719186 | tx.ex | starcoder |
defmodule MongooseICE.UDP do
@moduledoc """
UDP STUN server
The easiest way to start a server is to spawn it under MongooseICE's
supervision tree providing the following configuration:
config :mongooseice, :servers,
udp: [ip: {192,168, 1, 21}, port: 32323]
...or hook it up to your supervision... | lib/mongooseice/udp.ex | 0.792785 | 0.410284 | udp.ex | starcoder |
defmodule AWS.NetworkFirewall do
@moduledoc """
This is the API Reference for AWS Network Firewall.
This guide is for developers who need detailed information about the Network
Firewall API actions, data types, and errors.
* The REST API requires you to handle connection details, such as
calculating si... | lib/aws/generated/network_firewall.ex | 0.904242 | 0.752718 | network_firewall.ex | starcoder |
defmodule Airtable do
@moduledoc """
Documentation for Airtable.
"""
@doc """
Retrieves a certain row from a table.
"""
def get(api_key, table_key, table_name, item_id), do: perform(:get, api_key, table_key, table_name, item_id, [])
@doc """
Deletes a certain row from a table. Returns {:ok, "DELETED... | lib/airtable.ex | 0.739046 | 0.464355 | airtable.ex | starcoder |
defmodule Faker.Phone.EnUs do
@moduledoc """
This follows the rules outlined in the North American Numbering Plan
at https://en.wikipedia.org/wiki/North_American_Numbering_Plan.
The NANP number format may be summarized in the notation NPA-NXX-xxxx:
The allowed ranges for NPA (area code) are: [2–9] for the f... | lib/faker/phone/en_us.ex | 0.811003 | 0.608914 | en_us.ex | starcoder |
defmodule Bintree do
@moduledoc """
Basic module
"""
defstruct value: nil, left: nil, right: nil
@typedoc """
Binary tree where branches can be nil
"""
@type t :: %Bintree{value: any, left: t | nil, right: t | nil}
@type filter_fun :: (any -> boolean)
@type process_fun :: (any -> any)
@doc """
... | lib/bintree.ex | 0.917755 | 0.614669 | bintree.ex | starcoder |
require Logger
require Integer
defmodule ExoSQL.Builtins do
@moduledoc """
Builtin functions.
There are two categories, normal functions and aggregate functions. Aggregate
functions receive as first parameter a ExoSQL.Result with a full table,
and the rest of parameters are the function calling parameters, ... | lib/builtins.ex | 0.670824 | 0.584568 | builtins.ex | starcoder |
defmodule Adventofcode.Day09SmokeBasin do
use Adventofcode
alias __MODULE__.{Parser, Part1, Part2}
def part_1(input) do
input
|> Parser.parse()
|> Part1.solve()
end
def part_2(input) do
input
|> Parser.parse()
|> Part2.solve()
end
defmodule Part1 do
def solve(state) do
... | lib/day_09_smoke_basin.ex | 0.599837 | 0.530297 | day_09_smoke_basin.ex | starcoder |
defmodule Omise.Token do
@moduledoc ~S"""
Provides Token API interfaces.
<https://www.omise.co/tokens-api>
***NOTE***:
Full Credit Card data should never go through your server.
Do not send the credit card data to Omise from your servers directly.
You must send the card data from the client browser via ... | lib/omise/token.ex | 0.847021 | 0.624923 | token.ex | starcoder |
defmodule Atlas.Adapters.Postgres do
@behaviour Atlas.Database.Adapter
import Atlas.Query.Builder, only: [list_to_binding_placeholders: 1]
import Atlas.Database.FieldNormalizer
alias :pgsql, as: PG
def connect(config) do
case PG.connect(
String.to_char_list(config.host),
String.to_char_list(c... | lib/atlas/adapters/postgres.ex | 0.570571 | 0.573021 | postgres.ex | starcoder |
defmodule NLP do
import Network
alias Deeppipe, as: DP
@moduledoc """
for natural language
"""
defnetwork init1(_x) do
_x
|> lstm(29, 14, 0.1, 0.001)
|> w(29, 2)
|> softmax
end
def sgd(m, n) do
image = train_image()
onehot = train_label_onehot()
network = init1(0)
test... | lib/nlp.ex | 0.574992 | 0.413832 | nlp.ex | starcoder |
defmodule Histogrex do
@moduledoc """
High Dynamic Range (HDR) Histogram allows the recording of values across
a configurable range at a configurable precision.
Storage requirement is fixed (and depends on how the histogram is configured).
All functions are fully executed within the calling process (not seri... | lib/histogrex.ex | 0.922883 | 0.683353 | histogrex.ex | starcoder |
defmodule Jerboa.Format.Body.Attribute.ErrorCode do
@moduledoc """
ERROR-CODE attribute as defined in [STUN RFC](https://tools.ietf.org/html/rfc5389#section-15.6)
"""
alias Jerboa.Format.Body.Attribute.{Decoder,Encoder}
alias Jerboa.Format.ErrorCode.{FormatError, LengthError}
alias Jerboa.Format.Meta
de... | lib/jerboa/format/body/attribute/error_code.ex | 0.788787 | 0.460046 | error_code.ex | starcoder |
defmodule Recurly.Webhooks do
@moduledoc """
Module responsible for parsing webhooks: https://dev.recurly.com/page/webhooks
Each webhook has it's own type. These types are returned from `Recurly.Webhooks.parse/1` respectively.
* [BillingInfoUpdatedNotification](https://dev.recurly.com/page/webhooks#section-up... | lib/recurly/webhooks.ex | 0.720663 | 0.614625 | webhooks.ex | starcoder |
defmodule EctoTestDSL.Parse.Pnode.Group do
use EctoTestDSL.Drink.Me
use T.Drink.AndParse
use T.Drink.Assertively
def squeeze_into_map(kws) do
reducer = fn {name, value}, acc ->
case {Map.get(acc, name), Pnode.Mergeable.impl_for(value)} do
{nil, _} ->
Map.put(acc, name, value)
... | lib/10_parse/nodes/pnode_group.ex | 0.549641 | 0.49884 | pnode_group.ex | starcoder |
defmodule Ash.Changeset.ManagedRelationshipHelpers do
@moduledoc """
Tools for introspecting managed relationships.
Extensions can use this to look at an argument that will be passed
to a `manage_relationship` change and determine what their behavior
should be. For example, AshAdmin uses these to find out wh... | lib/ash/changeset/managed_relationship_helpers.ex | 0.786254 | 0.424352 | managed_relationship_helpers.ex | starcoder |
defmodule WeChat do
@moduledoc """
WeChat SDK for Elixir
## 定义 `Client` 模块
### 公众号(默认):
```elixir
defmodule YourApp.WeChatAppCodeName do
@moduledoc "CodeName"
use WeChat,
appid: "wx-appid",
appsecret: "appsecret"
end
```
### 小程序:
```elixir
defmodule YourApp.WeChatAppCodeName do
... | lib/wechat.ex | 0.641759 | 0.4133 | wechat.ex | starcoder |
defmodule ElixirLS.Utils.OutputDevice do
@moduledoc """
Intercepts IO request messages and forwards them to the Output server to be sent as events to
the IDE.
In order to send console output to Visual Studio Code, the debug adapter needs to send events
using the usual wire protocol. In order to intercept the... | apps/elixir_ls_utils/lib/output_device.ex | 0.741112 | 0.437223 | output_device.ex | starcoder |
defmodule Unleash do
@moduledoc """
If you have no plans on extending the client, then `Unleash` will be the main
usage point of the library. Upon starting your app, the client is registered
with the unleash server, and two `GenServer`s are started, one to fetch and
poll for feature flags from the server, and... | lib/unleash.ex | 0.915828 | 0.410638 | unleash.ex | starcoder |
defmodule CFSync.RichText do
@moduledoc """
RichText recursive struct
RichText in Contentful is implemented as a tree of nodes.
All nodes share a common structure and some of them have specific properties.
Here I chosed to represent all nodes with a single struct for simplicity.
"""
alias CFSync.Link
... | lib/cf_sync/rich_text.ex | 0.673299 | 0.486636 | rich_text.ex | starcoder |
defmodule BinFormat.FieldType.Boolean do
defstruct name: nil, default: nil, size: nil, options: nil
@moduledoc """
Boolean field type for defformat.
"""
@doc """
Add a Boolean field to the format structure in defformat.
A lookup field uses a list of values and labels to map a stanard value type
in ... | lib/bin_format/field_type/boolean.ex | 0.641647 | 0.627167 | boolean.ex | starcoder |
defmodule Magnet do
@moduledoc """
`Magnet` struct which represents Magnet URI.
See: https://en.wikipedia.org/wiki/Magnet_URI_scheme
"""
defstruct name: nil,
length: nil,
info_hash: [],
fallback: nil,
source: [],
keywords: [],
manifest:... | lib/magnet.ex | 0.836454 | 0.495789 | magnet.ex | starcoder |
defmodule Engine.DB.Fee do
@moduledoc """
This module represents computed fees and how they are stored in the database.
The schema contains the following fields:
- hash: The sha256 hash of the `term`
- type:
- previous_fees: Fees that are still valid for a short period of time after being updated.
... | apps/engine/lib/engine/db/fee.ex | 0.853852 | 0.607343 | fee.ex | starcoder |
defmodule Day03.Point do
defstruct x: 0, y: 0
def origin, do: %__MODULE__{}
def distance(p0, p1) do
abs(p0.x - p1.x) + abs(p0.y - p1.y)
end
end
defmodule Day03.Path do
def parse(raw) do
raw
|> String.split(",")
|> Enum.map(&tupleize/1)
end
def tupleize("R" <> len), do: tupleize(:right,... | year_2019/lib/day_03/wires.ex | 0.646237 | 0.746093 | wires.ex | starcoder |
defmodule MangoPay.BankingAlias do
@moduledoc """
Functions for MangoPay [BankingAlias](https://docs.mangopay.com/endpoints/v2.01/banking-aliases#e849_the-banking-alias-object).
"""
use MangoPay.Query.Base
set_path "bankingaliases"
@doc """
Get a banking alias.
## Examples
{:ok, banking_alias} =... | lib/mango_pay/banking_alias.ex | 0.683208 | 0.417509 | banking_alias.ex | starcoder |
defmodule Stein.Accounts do
@moduledoc """
Helper functions around user accounts
To fully utilize the `Stein.Accounts` functions, your user schema struct
should contain the following fields:
```elixir
defmodule MyApp.Users.User do
# ...
schema "users" do
field(:email, :string)
field(:... | lib/stein/accounts.ex | 0.822189 | 0.704948 | accounts.ex | starcoder |
defmodule Erl2ex.Results do
@moduledoc """
Erl2ex.Results defines the structure of result data returned from most
functions in the Erl2ex module.
"""
alias Erl2ex.Results
defmodule File do
@moduledoc """
Erl2ex.Results.File defines the result data structure for a particular file.
"""
... | lib/erl2ex/results.ex | 0.679817 | 0.63696 | results.ex | starcoder |
defmodule Chex do
@moduledoc """
A library for playing chess in Elixir.
"""
alias Chex.{Board, Color, Game, Piece}
@typedoc """
The main type representing a single game. Values should be treated as
read-only and should only be modified using public API functions.
* `:active_color` - The color of th... | lib/chex.ex | 0.946101 | 0.689737 | chex.ex | starcoder |
defmodule Mix.Tasks.Absinthe.Gen.Query do
@shortdoc "Generates an absinthe query schema and inserts the record in the base schema.ex"
@moduledoc """
Generates an Absinthe Query
### Options
#{NimbleOptions.docs(AbsintheGenerator.Query.definitions())}
### Specifying Queries
The following format can be u... | lib/mix/tasks/query.ex | 0.860369 | 0.713007 | query.ex | starcoder |
defmodule ExCell.View do
@moduledoc """
Cell helpers used to render the cells in both Views and Cells
"""
@view_adapter ExCell.config(:view_adapter, Phoenix.View)
@doc """
Returns the relative path of a module to the namespace. This method is used
to determine the template path of the cell.
## Example... | lib/ex_cell/view.ex | 0.770335 | 0.581184 | view.ex | starcoder |
defmodule Base85.UnrecognizedCharacterSet do
@moduledoc """
Raised at runtime when an unknown character set is specified.
"""
defexception [:charset, :operation]
@doc false
def message(%__MODULE__{charset: charset, operation: op}) do
"unrecognized character set #{charset} requested while #{op}"
end
e... | lib/base85/exceptions.ex | 0.835249 | 0.452475 | exceptions.ex | starcoder |
defmodule North.Scope.Wildcard do
@moduledoc """
Scope behaviour that supports wildcard matching.
"""
@wc "*"
@behaviour North.Scope
@doc """
Matches using the `*` wildcard character.
Wildcards can be used on either side of the match, with the left hand side
taking precedence. The examples provide ... | lib/north/scope/wildcard.ex | 0.85928 | 0.402099 | wildcard.ex | starcoder |
defmodule ForcingPhase do
@moduledoc """
Functions for converting between time and phase modulo a forcing frequency.
"""
@doc """
Returns the fractional part of a number()ing point number
"""
@spec frac_part(number()) :: number()
def frac_part(x) do
x - trunc(x)
end
@doc """
Returns the rem... | apps/imposc/lib/dynamics/forcing_phase.ex | 0.936 | 0.874077 | forcing_phase.ex | starcoder |
defmodule MssqlexV3.Error do
@moduledoc """
Defines an error returned from the ODBC adapter.
* `message` is the full message returned by ODBC
* `odbc_code` is an atom representing the returned
[SQLSTATE](https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/appendix-a-odbc-error-codes)
or the s... | lib/mssqlex_v3/error.ex | 0.814422 | 0.400661 | error.ex | starcoder |
defmodule Aino.Session do
@moduledoc """
Session storage
"""
alias Aino.Session.Storage
@doc """
Put a session configuration into the token
Used for `decode/1` and `encode/1`. The configuration should be an implementation
of `Aino.Session.Storage`.
The following keys will be added to the token `[:... | lib/aino/session.ex | 0.834508 | 0.54692 | session.ex | starcoder |
defmodule ExUnit.Formatter do
@moduledoc """
This module holds helper functions related to formatting and contains
documentation about the formatting protocol.
Formatters are registered at the `ExUnit.EventManager` event manager and
will be send events by the runner.
The following events are possible:
... | lib/ex_unit/lib/ex_unit/formatter.ex | 0.849831 | 0.700511 | formatter.ex | starcoder |
defmodule BroadwaySQS.Producer do
@moduledoc """
A GenStage producer that continuously polls messages from a SQS queue and
acknowledge them after being successfully processed.
By default this producer uses `BroadwaySQS.ExAwsClient` to talk to SQS but
you can provide your client by implementing the `BroadwayS... | lib/broadway_sqs/producer.ex | 0.896104 | 0.67256 | producer.ex | starcoder |
defmodule Mix.Tasks.Run do
use Mix.Task
@shortdoc "Runs the given file or expression"
@moduledoc """
Runs the given file or expression in the context of the application.
You can use this task to execute a particular file or command:
mix run -e Hello.world
mix run my_script.exs
This task pro... | lib/mix/lib/mix/tasks/run.ex | 0.70202 | 0.519826 | run.ex | starcoder |
defmodule Contex.BarChart do
@moduledoc """
Draws a barchart from a `Contex.Dataset`.
`Contex.BarChart` will attempt to create reasonable output with minimal input. The defaults are as follows:
- Bars will be drawn vertically (use `orientation/2` to override - options are `:horizontal` and `:vertical`)
- The... | lib/chart/barchart.ex | 0.952353 | 0.837354 | barchart.ex | starcoder |
defprotocol Cat.Effect.Spawn do
@moduledoc """
Spawn defines
* `start(t(a)) :: t(Fiber.t(t, a))`
* `never(t(any)) :: t(none)`
* `cede(t(any)) :: t(no_return)`
* `background(t(a)) :: Resource.t(t, t(MonadCancel.outcome(a)))`
* `race_pair(t(a), t(b)) :: t(race_pair_out(a, b))`
* `race(t(a), t... | lib/cat/protocols/effect/spawn.ex | 0.877746 | 0.524577 | spawn.ex | starcoder |
defmodule ExForce.Client.Tesla do
@moduledoc """
HTTP Client for Salesforce REST API using Tesla.
## Adapter
To use different Tesla adapter, set it via Mix configuration.
```elixir
config :tesla, ExForce.Client.Tesla, adapter: Tesla.Adapter.Hackney
```
"""
@behaviour ExForce.Client
alias ExForc... | lib/ex_force/client/tesla/tesla.ex | 0.892429 | 0.699806 | tesla.ex | starcoder |
defmodule JSON.Parser.Array do
@moduledoc """
Implements a JSON Array Parser for Bitstring values
"""
alias JSON.Parser, as: Parser
require Logger
import JSON.Logger
@doc """
parses a valid JSON array value, returns its elixir list representation
## Examples
iex> JSON.Parser.Array.parse ""
... | node_modules/@snyk/snyk-hex-plugin/elixirsrc/deps/json/lib/json/parser/array.ex | 0.831588 | 0.434761 | array.ex | starcoder |
defmodule Wobserver.Table do
@moduledoc ~S"""
Table (ets) information and listing.
"""
import Wobserver.Util.Helper, only: [string_to_module: 1]
@doc ~S"""
Lists all tables with basic information.
Note: data is not included.
"""
@spec list :: list(map)
def list do
:ets.all()
|> Enum.map(&... | lib/wobserver/util/table.ex | 0.830525 | 0.843251 | table.ex | starcoder |
defmodule Ecto.Model.Validations do
@moduledoc ~S"""
Conveniences for defining module-level validations in models.
This module provides two macros `validate` and `validatep` that
wrap around `Ecto.Validator`. Let's see an example:
defmodule User do
use Ecto.Model
queryable "users" do
... | lib/ecto/model/validations.ex | 0.893501 | 0.659624 | validations.ex | starcoder |
defmodule EctoSchemaStore.BuildQueries do
@moduledoc false
defmacro build_ecto_query(query, :is_nil, key) do
quote do
from q in unquote(query),
where: is_nil(field(q, ^unquote(key)))
end
end
defmacro build_ecto_query(query, :not_nil, key) do
quote do
from q in unquote(query),
... | lib/ecto_schema_store/build_queries.ex | 0.639624 | 0.609844 | build_queries.ex | starcoder |
defmodule Crawly.Pipelines.WriteToFile do
@moduledoc """
Stores a given item into Filesystem
Pipeline Lifecycle:
1. When run (by `Crawly.Utils.pipe`), creates a file descriptor if not already created.
2. Performs the write operation
3. File descriptor is reused by passing it through the pipeline state with... | lib/crawly/pipelines/write_to_file.ex | 0.745861 | 0.792464 | write_to_file.ex | starcoder |
defmodule AWS.Rekognition do
@moduledoc """
This is the Amazon Rekognition API reference.
"""
@doc """
Compares a face in the *source* input image with each of the 100 largest
faces detected in the *target* input image.
<note> If the source image contains multiple faces, the service detects the
large... | lib/aws/rekognition.ex | 0.961116 | 0.927166 | rekognition.ex | starcoder |
defmodule Nebulex.Adapter do
@moduledoc """
This module specifies the adapter API that a Cache adapter is required to
implement.
"""
@type t :: module
@type cache :: Nebulex.Cache.t()
@type key :: Nebulex.Cache.key()
@type object :: Nebulex.Object.t()
@type opts :: Nebulex.Cache.opts()
@doc """
... | lib/nebulex/adapter.ex | 0.891952 | 0.439386 | adapter.ex | starcoder |
defmodule Hui.Encode do
@moduledoc """
Utilities for encoding Solr query and update data structures.
"""
alias Hui.Query.Update
@type query :: Hui.Query.solr_query()
@type options :: Hui.Encode.Options.t()
@url_delimiters {"=", "&"}
@json_delimters {":", ","}
@update_encoding_sequence [:doc, :delet... | lib/hui/encode.ex | 0.755727 | 0.487063 | encode.ex | starcoder |
defmodule Nat do
def corpus(str) do
str |> String.replace(".", " .") |> String.split(" ")
end
def wordvec(x) do
x
|> String.to_charlist()
|> Enum.map(fn x -> (x - 96) / 26 end)
end
end
defmodule Rnn do
def forward(_, _, [], res) do
res
end
def forward([x | xs], h, [wx, wh, b | ls], ... | lib/natlang.ex | 0.590661 | 0.612397 | natlang.ex | starcoder |
defmodule Kalevala.Character.Foreman do
@moduledoc """
Session Foreman
Manages data flowing from the player into the game.
"""
use GenServer
require Logger
alias Kalevala.Character.Conn
alias Kalevala.Event
alias Kalevala.Character.Foreman.Channel
@type t() :: %__MODULE__{}
defstruct [
:... | lib/kalevala/character/foreman.ex | 0.811825 | 0.404743 | foreman.ex | starcoder |
defmodule IceCream do
defmacro __using__(_opts) do
quote do
require IceCream
import IceCream
end
end
@doc """
Prints the calling filename, line number, and parent module/function. It returns an `:ok` atom.
```elixir
# lib/foo.ex
defmodule Foo do
import IceCream
def bar do
... | lib/ice_cream.ex | 0.820721 | 0.792143 | ice_cream.ex | starcoder |
defmodule InfinityOne.TabBar do
@moduledoc """
Manage the TabBar data store.
Manages the the data store for buttons and ftab state.
"""
@name :tabbar
@doc """
Initialize the TabBar data store.
"""
def initialize do
:ets.new @name, [:public, :named_table]
end
@doc """
Insert an entry into ... | lib/infinity_one/tab_bar.ex | 0.831691 | 0.487063 | tab_bar.ex | starcoder |
defmodule ReIntegrations.Orulo.TagMapper do
@moduledoc """
Module to map orulo's tags into our tags.
"""
alias ReIntegrations.{
Orulo.BuildingPayload
}
def map_tags(%BuildingPayload{} = %{payload: %{"features" => features}}) do
features
|> Enum.reduce([], &convert_tag(&1, &2))
|> Enum.dedup... | apps/re_integrations/lib/orulo/tag_mapper.ex | 0.513425 | 0.448245 | tag_mapper.ex | starcoder |
defmodule Gas do
@moduledoc """
Module for updating the current gas value and calculating
the additional costs for the opcodes, based on dynamic data
"""
use Bitwise
require OpCodesUtil
require GasCodes
@doc """
Subtract a given `gas_cost` from the current gas in the state
"""
@spec update_gas(... | apps/aevm/lib/gas.ex | 0.771757 | 0.645267 | gas.ex | starcoder |
defmodule Ecto.Query.Util do
@moduledoc """
This module provide utility functions on queries.
"""
alias Ecto.Query
@doc """
Look up a source with a variable.
"""
def find_source(sources, {:&, _, [ix]}) when is_tuple(sources) do
elem(sources, ix)
end
def find_source(sources, {:&, _, [ix]}) whe... | lib/ecto/query/util.ex | 0.852245 | 0.447641 | util.ex | starcoder |
defmodule Mix.Tasks.Surface.Init.ExPatcher do
@moduledoc false
alias Sourceror.Zipper, as: Z
alias Mix.Tasks.Surface.Init.ExPatcher.Move
@derive {Inspect, only: [:code, :result, :node]}
defstruct [:zipper, :node, :code, :moves, :result]
@line_break ["\n", "\r\n", "\r"]
def parse_string!(code) do
z... | lib/mix/tasks/surface/surface.init/ex_patcher.ex | 0.711832 | 0.474509 | ex_patcher.ex | starcoder |
defmodule Authoritex do
@moduledoc "Elixir authority lookup behavior"
@type authority :: {module(), String.t(), String.t()}
@type fetch_result :: %{
id: String.t(),
label: String.t(),
qualified_label: String.t(),
hint: String.t() | nil
}
@type search_result :: %{... | lib/authoritex.ex | 0.89129 | 0.694277 | authoritex.ex | starcoder |
defmodule HTS221 do
@moduledoc """
Functions for working with the HTS221
The functionality is useful for use cases where you need complete control
over the sensor or to debug the registers. If you just want to get started
quickly see `HTS221.Server` module.
To read registers you will need to provide a `HT... | lib/hts221.ex | 0.922255 | 0.939969 | hts221.ex | starcoder |
use Dogma.RuleBuilder
defrule Dogma.Rule.InfixOperatorPadding,
[fn_arrow_padding: false, elixir: ">= 1.1.0"] do
@moduledoc """
A rule that ensures that all infix operators, except the range operator `..`,
are surrounded by spaces.
This rule is only enabled for Elixir v1.1 or greater.
Good:
foo = b... | lib/dogma/rule/infix_operator_padding.ex | 0.778986 | 0.489137 | infix_operator_padding.ex | starcoder |
defmodule HandimanApi.GuardianHooks do
require IEx
use Guardian.Hooks
@moduledoc """
HandimanApi.GuardianHooks is a simple module that hooks into guardian to prevent playback of tokens.
In vanilla Guardian, tokens aren't tracked so the main mechanism that exists to make a token inactive is to set the expiry a... | lib/handiman_api/guardian_hooks.ex | 0.652131 | 0.5083 | guardian_hooks.ex | starcoder |
defmodule Rummage.Phoenix.PaginateController do
@moduledoc """
`PaginateController` a controller helper in `Rummage.Phoenix` which stores
helpers for Paginate hook in `Rummage`. This formats params before `index`
action into a format that is expected by the default `Rummage.Ecto`'s paginate
hook: `Rummage.Ect... | lib/rummage_phoenix/hooks/controllers/paginate_controller.ex | 0.738669 | 0.708112 | paginate_controller.ex | starcoder |
defmodule Exenv.Adapter do
@moduledoc """
Defines an Exenv adapter.
An Exenv adapter is simply a module that adheres to the callbacks required. It
can be as simple as:
defmodule MyAdapter do
use Exenv.Adapter
@imple true
def load(opts) do
# load some system env vars
... | lib/exenv/adapter.ex | 0.718298 | 0.400573 | adapter.ex | starcoder |
defmodule Filtrex.Condition do
@moduledoc """
`Filtrex.Condition` is an abstract module for parsing conditions.
To implement your own condition, add `use Filtrex.Condition` in your module and implement the three callbacks:
* `parse/2` - produce a condition struct from a configuration and attributes
* `ty... | lib/filtrex/condition.ex | 0.874614 | 0.834474 | condition.ex | starcoder |
defmodule Day2 do
@moduledoc """
Solution to Day 2 Advent of Code puzzle 2021: Dive!
Assumptions: All values for command distance are < 10 units
"""
# sort inputs into 2 lists to reduce, x & y
# up/down (up: negative, down: positive)
# - seems like all commands are < 10
# 2 ways to skin this cat -
... | lib/day_2/day_2.ex | 0.825449 | 0.751489 | day_2.ex | starcoder |
defmodule Solution do
@moduledoc """
Solving the next problem:
https://www.hackerrank.com/challenges/flatland-space-stations/problem
"""
@doc """
Hackerank main function to execute solution
"""
def main do
[n, m] = IO.gets("") |> String.trim |> String.split(" ") |> Enum.map(&String.to_integer/1)
... | hackerank_elixir/easy/flatland_space_stations.ex | 0.794505 | 0.62042 | flatland_space_stations.ex | starcoder |
defmodule NavigationHistory.Tracker do
@moduledoc """
A plug to track user navigation history.
Visited paths will be stored in the session by the plug.
The paths can then be accessed with `NavigationHistory.last_path` and
`NavigationHistory.last_paths`.
The session must already be fetched with `Plug.Conn.... | lib/navigation_history/tracker.ex | 0.853211 | 0.859605 | tracker.ex | starcoder |
defmodule Asteroid.Token.DeviceCode do
import Asteroid.Utils
alias Asteroid.Context
alias Asteroid.Client
alias Asteroid.OAuth2
alias Asteroid.Token
@moduledoc """
Device code structure
Note that this token is searched using 2 keys:
- the device code (when polling)
- the user code, to mark this t... | lib/asteroid/token/device_code.ex | 0.910386 | 0.523055 | device_code.ex | starcoder |
defmodule CSQuery.OperatorOption do
@moduledoc """
A struct representing an option for one of the structured query syntax
operators.
During expression construction, options that are not recognized for a given
operator will either be discarded (if already a `CSQuery.OperatorOption` struct) or
be treated as ... | lib/csquery/operator_option.ex | 0.850965 | 0.609001 | operator_option.ex | starcoder |
defmodule Ecto.Model.Schema do
@moduledoc """
Defines a schema for a model. A schema is a struct with associated
meta data that is persisted to a repository.
Every schema model is also a struct, that means that you work with models just
like you would work with structs, to set the default values for the stru... | lib/ecto/model/schema.ex | 0.897914 | 0.484014 | schema.ex | starcoder |
defmodule Spotify.Albums do
@moduledoc """
For manipulating albums.
[Spotify Docs](https://beta.developer.spotify.com/documentation/web-api/reference/albums/)
"""
alias Spotify.Albums.AlbumFull
alias Spotify.Artists.ArtistSimple
alias Spotify.Tracks.TrackSimple
alias Spotify.Pagings.Paging
alias... | lib/spotify/models/albums/albums.ex | 0.857604 | 0.704961 | albums.ex | starcoder |
defmodule Absinthe.Blueprint.Execution do
@moduledoc """
Blueprint Execution Data
The `%Absinthe.Blueprint.Execution{}` struct holds on to the core values that
drive a document's execution.
Here's how the execution flow works. Given a document like:
```
{
posts {
title
author { name }
... | lib/absinthe/blueprint/execution.ex | 0.859796 | 0.835282 | execution.ex | starcoder |
defmodule Benchee.Conversion.Memory do
@moduledoc """
Unit scaling for memory converting from bytes to kilobytes and others.
Only benchee plugins should use this code.
"""
alias Benchee.Conversion.{Format, Scale, Unit}
@behaviour Scale
@behaviour Format
@bytes_per_kilobyte 1024
@bytes_per_megabyte... | lib/benchee/conversion/memory.ex | 0.88054 | 0.537527 | memory.ex | starcoder |
defmodule BlueBird.Controller do
@moduledoc """
Defines macros used to add documentation to api routes.
## Usage
Use `api/3` in your controllers. Optionally add the `apigroup/1` or
`apigroup/2` macro to your controllers.
defmodule MyApp.Web.UserController do
use BlueBird.Controller
al... | lib/blue_bird/controller.ex | 0.856107 | 0.623176 | controller.ex | starcoder |
defmodule Engine.Ethereum.RootChain.AbiEventSelector do
@moduledoc """
We define Solidity Event selectors that help us decode returned values from function calls.
Function names are to be used as inputs to Event Fetcher.
Function names describe the type of the event Event Fetcher will retrieve.
"""
@spec e... | apps/engine/lib/engine/ethereum/root_chain/abi_event_selectors.ex | 0.710226 | 0.411909 | abi_event_selectors.ex | starcoder |
defmodule DBux.Protocol do
require Logger
@type endianness :: :little_endian | :big_endian
@debug !is_nil(System.get_env("DBUX_DEBUG"))
@doc """
Unmarshalls given bitstring while interpreting data using given endianness
and signature (where signature comes in D-Bus format).
It returns `{:ok, {list_of_... | lib/protocol.ex | 0.743354 | 0.680567 | protocol.ex | starcoder |
defmodule Result do
@moduledoc """
Documentation for Result.
"""
@type t(error, value) :: Result.Error.t(error) | Result.Ok.t(value)
@doc """
See `Result.Ok.of/1`
"""
defdelegate ok(value), to: Result.Ok, as: :of
@doc """
See `Result.Error.of/1`
"""
defdelegate error(value), to: Result.Error,... | lib/result.ex | 0.827584 | 0.585931 | result.ex | starcoder |
defmodule Inspecto do
@moduledoc """
`Inspecto` is a utility for inspecting Ecto schemas to view their field names,
data types, and default values.
Ecto schema modules do not contain full information about your database
schemas: they only contain enough information to act as a viable intermediary
for the E... | lib/inspecto.ex | 0.853088 | 0.841891 | inspecto.ex | starcoder |
defmodule Versioning.Adapter.Semantic do
@moduledoc """
A versioning adapter for semantic-based versions.
Under the hood, this adapter uses the `Version` module. For details on the rules
that are used for parsing and comparison, please see the `Version` module.
## Example
defmodule MyApp.Versioning d... | lib/versioning/adapter/semantic.ex | 0.880887 | 0.438244 | semantic.ex | starcoder |
defmodule AWS.IoT do
@moduledoc """
AWS IoT
AWS IoT provides secure, bi-directional communication between
Internet-connected things (such as sensors, actuators, embedded devices, or
smart appliances) and the AWS cloud. You can discover your custom IoT-Data
endpoint to communicate with, configure rules for... | lib/aws/iot.ex | 0.776708 | 0.416737 | iot.ex | starcoder |
defmodule CsvParser do
alias CsvParser.{Csv, Xlsx, Memory}
@doc """
Creates a new object to be passed into reduce!/3. new and reduce exist separately
so that errors in your files can be handled explicitly.
opts:
type: :csv | :xlsx
Defaults to nil, which will auto-detect
map: true | false | :lower | :uppe... | lib/parser.ex | 0.613584 | 0.47792 | parser.ex | starcoder |
defmodule Sourceror.Patch do
@moduledoc """
Functions that generate patches for common operations.
Functions in this module assume that the AST was parsed using Sourceror
functions and that it wasn't modified. If you changed the tree before calling
`Sourceror.Patch` functions, then the patch ranges are not g... | lib/sourceror/patch.ex | 0.866401 | 0.583085 | patch.ex | starcoder |
defmodule Erlef.Accounts.Member do
use Erlef.Schema
@moduledoc """
Erlef.Accounts.Member provides a schema and helper functions for working with erlef members.
Members are a "concrete" representation of an associated external resource, namely wildapricot,
and as such it shou ld be duly that this applicat... | lib/erlef/accounts/member.ex | 0.575946 | 0.482246 | member.ex | starcoder |
defmodule SistemaFinanceiro.AccountService do
@moduledoc """
A lightfull service to orchestrate incoming calls/requests actions from our controller
"""
alias Repository.AccountRepository
alias Repository.ExchangeRateRepository
@doc """
Lists all accounts
## Examples:
```
iex> SistemaFinanceiro.... | lib/service/account_service.ex | 0.889463 | 0.709824 | account_service.ex | starcoder |
defmodule ChexDigits.Helper do
@moduledoc """
This module contains all helper functions to specify the algorithms for checking digit calculation.
The main function is `checksum`, which adds a lot of flexibility to the generic algorithm:
1 - add all digits, each multiplied by its respective weight
2 - cal... | lib/helper.ex | 0.926918 | 0.894375 | helper.ex | starcoder |
defmodule Journey.Process do
@moduledoc """
"""
@derive Jason.Encoder
@enforce_keys [:process_id, :steps]
defstruct [:process_id, steps: []]
@typedoc ~S"""
Holds the definition of a process.
"""
@type t :: %Journey.Process{process_id: String.t(), steps: list(Journey.Step.t())}
defp random_strin... | lib/process.ex | 0.695752 | 0.566978 | process.ex | starcoder |
defmodule MarcoPolo.Protocol.Types do
@moduledoc false
alias MarcoPolo.Document
alias MarcoPolo.BinaryRecord
alias MarcoPolo.Protocol.RecordSerialization
import MarcoPolo.Protocol.BinaryHelpers
@type encodable_term ::
boolean
| nil
| binary
| integer
| iolist
| {:short, integer}
... | lib/marco_polo/protocol/types.ex | 0.904349 | 0.50415 | types.ex | starcoder |
defmodule Component do
@moduledoc """
The Component behaviour specification.
This is heavily inspired by plug. I wanted the same type of functionality
without being locked into the Plug.Conn struct.
#### Function components
A function component is any function that receives a conn and a set of
options ... | lib/component.ex | 0.77518 | 0.582194 | component.ex | starcoder |
defmodule Kojin.Pod.PodPackageSet do
@moduledoc """
Models a collection of related packages which may refer to
types with `dot notation` paths.
"""
use TypedStruct
alias Kojin.Pod.{PodPackage, PodPackageSet, PodTypeRef, PodArray, PodType, PodObject, PodEnum}
@typedoc """
Models a collection of relate... | lib/kojin/pod/pod_package_set.ex | 0.759225 | 0.431225 | pod_package_set.ex | starcoder |
defmodule NewRelic do
@moduledoc """
New Relic Agent - Public API
"""
@doc """
Set the name of the current transaction.
The first segment will be treated as the Transaction namespace,
and commonly contains the name of the framework.
In the following example, you will see `/custom/transaction/name`
... | lib/new_relic.ex | 0.884551 | 0.84228 | new_relic.ex | starcoder |
defmodule ExHealth.HealthServer do
@moduledoc """
The HealthServer is a GenServer that is responsible for running all health
checks and determining system health.
All other integrations must communicate to the HealthServer to get
information about the latest checks.
"""
use GenServer
@doc """
Start ... | lib/ex_health/health_server.ex | 0.852399 | 0.443299 | health_server.ex | starcoder |
defmodule StellarBase.XDR.OfferEntry do
@moduledoc """
Representation of Stellar `OfferEntry` type.
An offer is the building block of the offer book, they are automatically
claimed by payments when the price set by the owner is met.
For example an Offer is selling 10A where 1A is priced at 1.5B
"""
alia... | lib/xdr/ledger_entries/offer_entry.ex | 0.859516 | 0.430506 | offer_entry.ex | starcoder |
defmodule DiodeClient.Transaction do
# alias DiodeClient.TransactionReceipt
alias DiodeClient.{Base16, Hash, Rlp, Rlpx, Secp256k1, Transaction, Wallet}
@enforce_keys [:chain_id]
defstruct nonce: 1,
gasPrice: 0,
gasLimit: 0,
to: nil,
value: 0,
chain_id... | lib/diode_client/transaction.ex | 0.718199 | 0.476275 | transaction.ex | starcoder |
defmodule Cocktail.RuleState do
@moduledoc false
alias Cocktail.{Rule, Validation, Validation.Shift}
@type t :: %__MODULE__{
count: pos_integer | nil,
until: Cocktail.time() | nil,
validations: [Validation.t(), ...],
current_time: Cocktail.time() | nil
}
@enfor... | lib/cocktail/rule_state.ex | 0.790369 | 0.475971 | rule_state.ex | starcoder |
defmodule SoftRepo do
@moduledoc """
Contains get/delete functions to do a soft delete
"""
import Ecto.Changeset, only: [change: 2]
import Ecto.Queryable, only: [to_query: 1]
require Ecto.Query
@repo SoftRepo.Client.repo()
def all(queryable, opts \\ [])
def all(queryable, opts = [with_thrash: true... | lib/soft_repo.ex | 0.631026 | 0.491578 | soft_repo.ex | starcoder |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.