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 Adventofcode.Day18Duet.RecoveredFrequency do defstruct registers: %{}, instructions: [], current_index: 0, last_played: nil, recovered: false def recovered_frequency_value(input) do %__MODULE__{instructions: parse(input)} |> process_instructions() |> result() end defp result(%{last_playe...
lib/day_18_duet_recovered_frequency.ex
0.652906
0.571796
day_18_duet_recovered_frequency.ex
starcoder
defmodule Spidey.Filter.DefaultFilter do @moduledoc """ An implementation of the `Spidey.Filter` behaviour which: 1. Transforms relative urls to absolute urls 2. Strips the query parameters of all urls, to simplify unicity. 3. Strips the trailing slashes of all urls. 4. Rejects all urls from a different do...
lib/spidey/filter/default_filter.ex
0.872992
0.449272
default_filter.ex
starcoder
defmodule Univrse.Envelope do @moduledoc """ An Envelope is a structure for encoding any arbitrary data payload for data interchange and/or storage. An Envelope consists of a set of headers and a data payload. Optionally one or more `t:Univrse.Signature.t/0` structures may be used to protect data integrity w...
lib/univrse/envelope.ex
0.812123
0.670878
envelope.ex
starcoder
defmodule Serum.Build.Pass1 do @moduledoc """ This module takes care of the first pass of site building process. In pass 1, the following modules are run sequentially or parallelly. See the docs for each module for more information. * `Serum.Build.Pass1.PageBuilder` * `Serum.Build.Pass1.PostBuilder` Af...
lib/serum/build/pass_1.ex
0.772445
0.618708
pass_1.ex
starcoder
defmodule Estructura.Void do @moduledoc false use Estructura, access: false, enumerable: false, collectable: false defstruct foo: 42, bar: "", baz: %{inner_baz: 42}, zzz: nil end defmodule Estructura.LazyInst do @moduledoc false use Estructura, access: :lazy def parse_int(bin), do: with {int, _} <- Integ...
test/support/structs.ex
0.812644
0.430058
structs.ex
starcoder
defmodule Tw.V1_1.TwitterAPIError do @moduledoc """ `Exception` which wraps an error response from Twitter API. See [the Twitter API documentation](https://developer.twitter.com/docs/basics/response-codes) for details. """ defexception [:message, :errors, :response] alias Tw.HTTP.Response @type t :: %...
lib/tw/v1_1/twitter_api_error.ex
0.884751
0.412087
twitter_api_error.ex
starcoder
defmodule PlugDeviseSession.Rememberable do @moduledoc """ Helps issuing and reading Devise's remember user cookie. Important module assumptions: * All `Plug.Conn` structures should have a valid `secret_key_base` set. * User authorization info is a three element tuple of the form: `{id, auth_key, timest...
lib/plug_devise_session/rememberable.ex
0.867738
0.438304
rememberable.ex
starcoder
defmodule SendGrid.Marketing.Contacts do @moduledoc """ Module to interact with contacts. See SendGrid's [Contact API Docs](https://sendgrid.api-docs.io/v3.0/contacts) for more detail. """ @base_api_url "/v3/marketing/contacts" @doc """ Adds one or multiple contacts to one or multiple lists available...
lib/sendgrid/marketing_campaigns/contacts.ex
0.825097
0.447158
contacts.ex
starcoder
require Utils require Program defmodule D5 do @moduledoc """ --- Day 5: Sunny with a Chance of Asteroids --- You're starting to sweat as the ship makes its way toward Mercury. The Elves suggest that you get the air conditioner working by upgrading your ship computer to support the Thermal Environment Supervisio...
lib/days/05.ex
0.844297
0.898188
05.ex
starcoder
defmodule FileSize.Ecto.ByteWithUnit do @moduledoc """ An Ecto type that represents a file size in bytes, supporting storage of different units. The value is stored as map in the database (i.e. jsonb when using PostgreSQL). ## Example defmodule MySchema do use Ecto.Schema schema "my_t...
lib/file_size/ecto/byte_with_unit.ex
0.847479
0.543469
byte_with_unit.ex
starcoder
defmodule Scholar.Metrics.Distance do @moduledoc """ Distance metrics between 1-D tensors. """ import Nx.Defn import Scholar.Shared @doc """ Standard euclidean distance. $$ D(x, y) = \\sqrt{\\sum_i (x_i - y_i)^2} $$ ## Examples iex> x = Nx.tensor([1, 2]) iex> y = Nx.tensor([3, 2])...
lib/scholar/metrics/distance.ex
0.895905
0.809163
distance.ex
starcoder
defmodule Resourceful.Type do @moduledoc """ `Resourceful.Type` is a struct and set of functions for representing and mapping internal data structures to data structures more appropriate for edge clients (e.g. API clients). As a result, field names are _always_ strings and not atoms. In addition to mapping...
lib/resourceful/type.ex
0.90713
0.77586
type.ex
starcoder
defmodule Expostal do @moduledoc """ Address parsing and expansion module for Openvenue's Libpostal, which does parses addresses. """ @compile {:autoload, false} @on_load {:init, 0} app = Mix.Project.config()[:app] def init do path = :filename.join(:code.priv_dir(unquote(app)), 'expostal') :ok ...
lib/expostal.ex
0.845289
0.629718
expostal.ex
starcoder
defmodule Markex.Element do @moduledoc """ Creating and working with elements for 2D markup """ alias __MODULE__ @typedoc """ List of strings, where all string the same length """ @type t :: list(String.t()) @doc """ Creates new element using regular string or list of strings In the latter cas...
lib/markex/element.ex
0.914565
0.647478
element.ex
starcoder
defmodule RDF.Graph.Builder do alias RDF.{Description, Graph, Dataset, PrefixMap, IRI} defmodule Error do defexception [:message] end defmodule Helper do defdelegate a(), to: RDF.NS.RDF, as: :type defdelegate a(s, o), to: RDF.NS.RDF, as: :type defdelegate a(s, o1, o2), to: RDF.NS.RDF, as: :typ...
lib/rdf/graph_builder.ex
0.524882
0.467271
graph_builder.ex
starcoder
defmodule EEx.Engine do @moduledoc ~S""" Basic EEx engine that ships with Elixir. An engine needs to implement six functions: * `init(opts)` - called at the beginning of every text and it must return the initial state. * `handle_body(state)` - receives the state of the document and it must ...
lib/eex/lib/eex/engine.ex
0.745861
0.662733
engine.ex
starcoder
defmodule Supervisor do @moduledoc """ A behaviour module for implementing supervision functionality. A supervisor is a process which supervises other processes called child processes. Supervisors are used to build a hierarchical process structure called a supervision tree, a nice way to structure fault-tole...
lib/elixir/lib/supervisor.ex
0.790611
0.684593
supervisor.ex
starcoder
defmodule Kuddle.Config.Types do @moduledoc """ Annotation cast types. User specific types can be registered by setting the kuddle_config types: ## Example config :kuddle_config, types: [ typename: {Module, cast_function_name}, geopoint: {MyGeoPoint, :cast}, ] Th...
lib/kuddle/config/types.ex
0.883707
0.413566
types.ex
starcoder
defprotocol Ecto.DataType do @moduledoc """ Casts and dumps a given struct into an Ecto type. While `Ecto.Type` allows developers to cast/load/dump any value from the storage into the struct based on the schema, `Ecto.DataType` allows developers to convert existing data types into primitive Ecto types with...
deps/ecto/lib/ecto/data_type.ex
0.873754
0.615723
data_type.ex
starcoder
defmodule Releases.Plugin.LinkConfig do @moduledoc """ Distillery plugin to link the `vm.args` or `sys.config` file on deploy hosts. Because distillery uses `:systools_make.make_tar(...)` to create the release tar which resoves all links using the `:dereference` option, the release tar needs to be re...
lib/distillery/plugins/link_config.ex
0.569134
0.662972
link_config.ex
starcoder
defmodule Scenic.Component.Input.Toggle do @moduledoc """ Add toggle to a Scenic graph. ## Data `on?` * `on?` - `true` if the toggle is on, pass `false` if not. ## Styles Toggles honor the following styles. The `:light` and `:dark` styles look nice. The other bundled themes...not so much. You can als...
lib/scenic/component/input/toggle.ex
0.908171
0.681091
toggle.ex
starcoder
defmodule ExPersona.Client.Parser do @moduledoc """ This module contains functions used in parsing the results of API calls. In this context, "parsing" occurs after JSON responses have been decoded into a `Map`. """ alias ExPersona.Client.Result @typedoc """ A single result from a parsed API call. """...
lib/ex_persona/client/parser.ex
0.826922
0.548129
parser.ex
starcoder
defmodule Beeline.Honeycomb do @moduledoc """ A Honeycomb.io exporter for Beeline telemetry This exporter works by attaching a `:telemetry` handler with `:telemetry.attach/4`. This attaches a function to handle events to each `Beeline.HealthChecker` process. The work of creating and emitting the event to H...
lib/beeline/honeycomb.ex
0.892852
0.799011
honeycomb.ex
starcoder
defmodule Exq.Redis.Connection do @moduledoc """ The Connection module encapsulates interaction with a live Redis connection or pool. """ require Logger alias Exq.Support.Config def flushdb!(redis) do {:ok, res} = q(redis, ["flushdb"]) res end def decr!(redis, key) do {:ok, count} = q(re...
lib/exq/redis/connection.ex
0.709824
0.614076
connection.ex
starcoder
defmodule Data.Constructor do alias Data.Parser.KV alias FE.Result @doc """ Define and run a smart constructor on a Key-Value input, returning either well-defined `structs` or descriptive errors. The motto: parse, don't validate! Given a list of `Data.Parser.KV.field_spec/2`s, a `module`, and an input `...
lib/data/constructor.ex
0.789153
0.542136
constructor.ex
starcoder
defmodule Re.Listings.Queries do @moduledoc """ Module for grouping listing queries """ alias Re.{ Images, Listing } import Ecto.Query @full_preload [ :address, :listings_favorites, :tags, :interests, images: Images.Queries.listing_preload() ] @orderable_fields ~w(id pr...
apps/re/lib/listings/queries/queries.ex
0.728748
0.546254
queries.ex
starcoder
require Logger defmodule IntercomX.Company do use IntercomX.Client @doc """ Create / update an Company ## Parameters * `remote_created_at`, `timestamp` - The time the company was created by you * `company_id`, `String` - (Required) The company id you have defined for the company * `name`, `String` - (R...
lib/intercomx/resources/company.ex
0.841956
0.423577
company.ex
starcoder
defmodule Que.Worker do @moduledoc """ Defines a Worker for processing Jobs. The defined worker is responsible for processing passed jobs, and handling the job's success and failure callbacks. The defined worker must export a `perform/1` callback otherwise compilation will fail. ## Basic Worker ``` ...
lib/que/worker.ex
0.76454
0.761538
worker.ex
starcoder
defmodule PollutionDataStream do @moduledoc """ Loading data from file to the pollution server using Stream. """ @doc """ Gets lines from CSV file as stream. Returns stream. """ def import_lines_from_CSV do File.stream!("pollution.csv") end @doc """ Makes map containing information about 1 ...
src/pollution_data_stream.ex
0.890862
0.60542
pollution_data_stream.ex
starcoder
defmodule Braintree.Search do @moduledoc """ This module performs advanced search on a resource. For additional reference see: https://developers.braintreepayments.com/reference/general/searching/search-fields/ruby """ alias Braintree.HTTP alias Braintree.ErrorResponse, as: Error @doc """ Perform a...
lib/search.ex
0.87596
0.436022
search.ex
starcoder
defmodule ETH.Transaction.Parser do import ETH.Utils @moduledoc """ This module converts the input to a transaction map encoded with ethereum hex encodings. It can also convert the input to a transaction list if needed. """ def parse("0x" <> encoded_transaction_rlp) do [nonce, gas_price, gas_limit...
lib/eth/transaction/parser.ex
0.507568
0.531331
parser.ex
starcoder
defmodule StarkInfra.CreditNote.Invoice do alias __MODULE__, as: Invoice alias StarkInfra.Utils.Check alias StarkInfra.Utils.API @moduledoc """ Groups Invoice related functions """ @doc """ When you initialize an Invoice struct, the entity will not be automatically sent to the Stark Infra API. The '...
lib/credit_note/invoice/invoice.ex
0.822831
0.708339
invoice.ex
starcoder
defmodule AWS.CloudTrail do @moduledoc """ AWS CloudTrail This is the CloudTrail API Reference. It provides descriptions of actions, data types, common parameters, and common errors for CloudTrail. CloudTrail is a web service that records AWS API calls for your AWS account and delivers log files to an...
lib/aws/generated/cloud_trail.ex
0.850841
0.667784
cloud_trail.ex
starcoder
defmodule ExBech32 do @moduledoc """ Nif for Bech32 format encoding and decoding. It uses https://github.com/rust-bitcoin/rust-bech32 rust library """ alias ExBech32.Impl @doc """ Encodes into Bech32 format It accepts the following three paramters: - human-readable part - data to be encoded -...
lib/ex_bech32.ex
0.914996
0.625081
ex_bech32.ex
starcoder
defmodule Crawly.DataStorage.Worker do @moduledoc """ A worker process which stores items for individual spiders. All items are pre-processed by item_pipelines. All pipelines are using the state of this process for their internal needs (persistancy). For example, it might be useful to include: 1) Duplic...
lib/crawly/data_storage/data_storage_worker.ex
0.628407
0.400808
data_storage_worker.ex
starcoder
defmodule Erlef.Agenda.Parser do @moduledoc false # n.b., This module (at this time) makes no attempt to validate ICS contents and as such # the results of the combination (at least currently) can not be guaranteed # to be valid. Rather, it depends on well formed ICS inputs @doc """ Given a list of ics st...
lib/erlef/agenda/parser.ex
0.610918
0.437824
parser.ex
starcoder
defmodule StateMachine.Event do @moduledoc """ Event is a container for transitions. It is identified by name (atom) and can contain arbitrary number of transtitions. One important thing is that it's disallowed to have more than one unguarded transition from the state, since this would introduce a "non-determi...
lib/state_machine/event.ex
0.847195
0.469824
event.ex
starcoder
defmodule Postgrex.Date do @moduledoc """ Struct for Postgres date. ## Fields * `year` * `month` * `day` """ @type t :: %__MODULE__{year: 0..10000, month: 1..12, day: 1..31} defstruct [ year: 0, month: 1, day: 1] end defmodule Postgrex.Time do @moduledoc """ Struct for Postgr...
lib/postgrex/builtins.ex
0.897472
0.631963
builtins.ex
starcoder
name: {0_5} 2 I: { 1} 1 T: { 1} 14 I: { 1} 14 T: { 1} 28 ; name: {1_5} 2 I: { 1} 0 T: { 1} 9 I: { 1} 9 T: { 1} 27 ; name: {2_5} 2 I: { 1} 2 T: { 1} 26 I: { 1} 26 T: { 1} 29 ; name: {3_5} 2 I: { 1} 1 T: { 1} 3 I: { 1} 3 T: { 1} 28 ; name: {4_5} 2 I: { 1} 2 T: { 1} 3 I: { 1} 3 T: { ...
q5_train_block5.ex
0.502441
0.648898
q5_train_block5.ex
starcoder
defmodule Legato.Query do defstruct profile: nil, view_id: nil, sampling_level: :default, metrics: [], dimensions: [], date_ranges: [], order_bys: [], segments: [], filters: %{ metrics: %Legato.Query.FilterSet{as: :metrics}, dimensions: %Legato.Query.FilterSet{as: :dimensions} } defimpl Poi...
lib/legato/query.ex
0.533641
0.402157
query.ex
starcoder
defprotocol C3P0.ID do @moduledoc """ Formalizes fetching the ID from data. For maps the keys `id`, `"id"` are considered id fields and `guid`, `"guid"` are considered guid fields. When requesting a guid, if one cannot be found by default it will fall back to the id. ## Using with your own structs By de...
lib/c3p0/id.ex
0.815122
0.756268
id.ex
starcoder
defmodule Chaperon.Util do @moduledoc """ Helper functions used throughout `Chaperon`'s codebase. """ @spec preserve_vals_merge(map, map) :: map def preserve_vals_merge(map1, map2) do new_map = for {k, v2} <- map2 do case map1[k] do nil -> {k, v2} v1 when is...
lib/chaperon/util.ex
0.846578
0.486819
util.ex
starcoder
defmodule Txpost.Envelope do @moduledoc """ CBOR Envelope module, implements BRFC `5b82a2ed7b16` ([CBOR Tx Envelope](cbor-tx-envelope.md)). BRFC `5b82a2ed7b16` defines a standard for serializing a CBOR payload in order to have consistnency when signing the payload with a ECDSA keypair. The `:payload` attrib...
lib/txpost/envelope.ex
0.922426
0.54825
envelope.ex
starcoder
defmodule RF24.Util do alias Circuits.{ SPI, GPIO } use Bitwise import RF24Registers @doc """ Write a register. `addr` can be an atom found in RF24Registers.reg/1 or an uint8 value. `value` can be a uint8 or a binary """ def write_reg(rf24, addr, value) when is_atom(addr) do write_re...
lib/rf24/util.ex
0.553264
0.535341
util.ex
starcoder
defmodule UderzoExample.Thermostat do @moduledoc """ A basic thermostat display, mostly fake, to show off Uderzo """ use Clixir @clixir_header "thermostat" # A sample thermostat display. def temp(t) do # Fake the temperature 25 * :math.sin(t / 10) end def tim_init() do base_dir = Applica...
uderzo_example/lib/thermostat.ex
0.745861
0.456107
thermostat.ex
starcoder
defmodule ExPng.RawData do @moduledoc """ This struct provides an intermediate data format between a PNG image file and and `ExPng.Image` struct. Raw image file data is parsed into this struct when reading from a PNG file, and when turning an `ExPng.Image` into a saveable image file. This data can be acces...
lib/ex_png/raw_data.ex
0.814016
0.69438
raw_data.ex
starcoder
defmodule Conduit.Util do @moduledoc """ Provides utilities to wait for something to happen """ @type attempt_function :: (() -> {:error, term} | term | no_return) | (integer() -> {:error, term} | term | no_return) @doc """ Runs a function until it returns a truthy value. A timeout can optionally be sp...
lib/conduit/util.ex
0.871119
0.563678
util.ex
starcoder
defmodule Ecto.Entity do @moduledoc """ This module is used to define an entity. An entity is a record with associated meta data that is persisted to a repository. Every entity is also a record, that means that you work with entities just like you would work with records, to set the default values for the re...
lib/ecto/entity.ex
0.88897
0.61477
entity.ex
starcoder
defmodule Mix.Tasks.Escript.Build do use Mix.Task use Bitwise, only_operators: true @shortdoc "Builds an escript for the project" @recursive true @moduledoc ~S""" Builds an escript for the project. An escript is an executable that can be invoked from the command line. An escript can run on any machi...
lib/mix/lib/mix/tasks/escript.build.ex
0.772015
0.411879
escript.build.ex
starcoder
defmodule Formular do require Logger @kernel_functions Formular.DefaultFunctions.kernel_functions() @kernel_macros Formular.DefaultFunctions.kernel_macros() @default_eval_options [] @default_max_heap_size :infinity @default_timeout :infinity @moduledoc """ A tiny extendable DSL evaluator. It's a wrap ...
lib/formular.ex
0.891599
0.84241
formular.ex
starcoder
defmodule Sanbase.Signal do @moduledoc """ Dispatch module used for fetching signals. As there is a single signal adapter now, the dispatching is done directly. After a second signals source is introduced, a dispatching logic similar to the one found in Sanbase.Metric should be implemented. """ alias Sa...
lib/sanbase/signal/signal.ex
0.867204
0.715225
signal.ex
starcoder
defmodule Remit.Commit do use Remit, :schema schema "commits" do field :sha, :string field :usernames, {:array, :string}, default: [] field :owner, :string field :repo, :string field :message, :string field :committed_at, :utc_datetime_usec field :url, :string field :payload, :map ...
lib/remit/commit.ex
0.51879
0.462534
commit.ex
starcoder
defmodule Automata.Blackboard do @moduledoc """ A global Blackboard for knowledge representations Memory and Interaction Protocols With large trees, we face another challenge: storage. In an ideal world, each AI would have an entire tree allocated to it, with each behavior having a persistent ...
lib/automata/knowledge/blackboards/automata_blackboard.ex
0.807271
0.835953
automata_blackboard.ex
starcoder
defmodule Race do @moduledoc """ Simulates a race. This is meant to be run in IEx in a console which supports printing of UTF-8 characters. """ alias Race.Arena @racer_count 10 @refresh_delay 50 @goal_line 80 @doc ~S""" Starts a new race. ## Examples ...
lib/race.ex
0.670608
0.499756
race.ex
starcoder
defmodule Fly.RPC do @moduledoc """ Provides an RPC interface for executing an MFA on a node within a region. ## Configuration Assumes each node is running the `Fly.RPC` server in its supervision tree and exports `FLY_REGION` environment variable to identify the fly region. To run code on a specific regi...
fly_rpc/lib/fly_rpc.ex
0.802788
0.615666
fly_rpc.ex
starcoder
defmodule Syslog.Parser do @moduledoc """ Module to handle the parsing of various acceptable forms of a Syslog message as described in [RFC3164](https://tools.ietf.org/html/rfc3164) and [RFC5426](https://tools.ietf.org/html/rfc5426). Additionally, various other forms of syslog messages are accepted, as found ...
lib/esyslog/parser.ex
0.762866
0.624294
parser.ex
starcoder
defmodule BattleBox.Utilities.Graph.AStar do @iter_limit 2500 defmodule State do @enforce_keys [:start_loc, :end_loc, :open, :heuristic, :neighbors] defstruct [ :closed, :cost_from_start, :end_loc, :estimated_cost_to_end, :heuristic, :neighbors, :open, :start...
lib/battle_box/utilities/graph/a_star.ex
0.556882
0.509642
a_star.ex
starcoder
defmodule Bunch.KVEnum do @moduledoc """ A bunch of helper functions for manipulating key-value enums (including keyword enums). Key-value enums are represented as enums of 2-element tuples, where the first element of each tuple is a key, and the second is a value. """ @type t(_key, _value) :: Enumerabl...
lib/bunch/kv_enum.ex
0.909496
0.704707
kv_enum.ex
starcoder
defmodule Stump do @moduledoc """ Stump allows for Maps and Strings to be passed into the Elixir Logger and return logs in the JSON format. """ @moduledoc since: "1.6.2" @doc """ The `log` method formats your given error message whether it be a Map or a String then passes it to Elixirs own Logger. Usage ...
lib/stump.ex
0.798501
0.910346
stump.ex
starcoder
defmodule MapDiff do @moduledoc """ Documentation for MapDiff. """ def diff(a, b) when a == b and is_map(a), do: %{} def diff(a, b) when a == b and is_list(a), do: [] def diff(a, b) when is_map(a) and is_map(b) do delta = Enum.reduce(a, %{}, &compare(&1, &2, b)) additions(a, b, delta) end def di...
lib/map_diff.ex
0.739611
0.583915
map_diff.ex
starcoder
defmodule AWS.Forecast do @moduledoc """ Provides APIs for creating and managing Amazon Forecast resources. """ @doc """ Creates an Amazon Forecast dataset. The information about the dataset that you provide helps Forecast understand how to consume the data for model training. This includes the followin...
lib/aws/generated/forecast.ex
0.945551
0.827271
forecast.ex
starcoder
defmodule AlertProcessor.ServiceInfo.CacheFile do @moduledoc """ This module holds the logic for loading and saving cache files in dev and test environments with the goal of decreasing startup time so devs can work more quickly. If expected API payloads change the cache files should be deleted/removed to a...
apps/alert_processor/lib/service_info/cache_file.ex
0.630116
0.428742
cache_file.ex
starcoder
defmodule ExSaga.Step do @moduledoc """ """ alias ExSaga.{DryRun, Event, Stepable} @typedoc """ """ @type breakpoint_fun :: (Event.t(), Stepable.t() -> boolean) @typedoc """ """ @type breakpoint :: breakpoint_fun | {:before | :after, breakpoint_fun} @typedoc """ """ @type opt :: St...
lib/ex_saga/step.ex
0.773901
0.605916
step.ex
starcoder
defmodule RedisMutex.Lock do import Exredis.Script @moduledoc """ This module contains the actual Redis locking business logic. The `with_lock` macro is generally the only function that should be used from this module, as it will handle the logic for setting and removing key/values in Redis. """ defredi...
lib/redis_mutex/lock.ex
0.675978
0.750576
lock.ex
starcoder
defmodule Narou.Entity do @moduledoc """ APIデータの基底モジュール。 """ import Narou.Util @doc """ APIデータの共通処理。 ## param - validate: list(symbol) : バリデーションを追加したいカラムリストを指定する。 [:st, :limit] - hoge_attr: default_val : 追加したいプロパティと初期値を指定する。 ## EXAMPLE defmodule MyStruct use Narou.Entity, hoge: "", limit: 1, validate: ...
lib/narou/entity.ex
0.646572
0.413744
entity.ex
starcoder
defmodule Ex2ms do @moduledoc """ This module provides the `Ex2ms.fun/1` macro for translating Elixir functions to match specifications. """ @bool_functions [ :is_atom, :is_float, :is_integer, :is_list, :is_number, :is_pid, :is_port, :is_reference, :is_tuple, :is_binar...
lib/ex2ms.ex
0.659953
0.631395
ex2ms.ex
starcoder
defmodule Twinex do @moduledoc """ """ @doc """ Two strings are twins iff their odd **and** even substrings are anagrams That is obviously true for empty strings: iex(1)> twins?("", "") true However it is obviously false if the odds are not anagrams (we consider the odds being the second s...
lib/twinex.ex
0.670932
0.408867
twinex.ex
starcoder
defmodule TextDelta.Transformation do @moduledoc """ The transformation of two concurrent deltas such that they satisfy the convergence properties of Operational Transformation. Transformation allows optimistic conflict resolution in concurrent editing. Given a delta A that occurred at the same time as delta...
lib/text_delta/transformation.ex
0.869659
0.818519
transformation.ex
starcoder
defmodule EctoDot do @moduledoc """ EctoDot provides an easy way to generate .dot, .png, .svg and .pdf diagrams directly from your ecto schema modules. """ alias EctoDot.Schema alias EctoDot.Association alias EctoDot.Diagram @doc """ Creates the .dot representation including attributes and association...
lib/ecto_dot.ex
0.672547
0.408837
ecto_dot.ex
starcoder
defmodule EctoCommons.EmailValidator do @moduledoc ~S""" Validates emails. ## Options There are various `:checks` depending on the strictness of the validation you require. Indeed, perfect email validation does not exist (see StackOverflow questions about it): - `:html_input`: Checks if the email follows ...
lib/validators/email.ex
0.864896
0.714553
email.ex
starcoder
defprotocol Ecto.DataType do @moduledoc """ Casts and dumps a given struct into an Ecto type. While `Ecto.Type` allows developers to cast/load/dump any value from the storage into the struct based on the schema, `Ecto.DataType` allows developers to convert existing data types into existing Ecto types witho...
deps/ecto/lib/ecto/data_type.ex
0.773259
0.640256
data_type.ex
starcoder
defmodule Ecto.Query.Planner do # Normalizes a query and its parameters. @moduledoc false alias Ecto.Query.QueryExpr alias Ecto.Query.JoinExpr alias Ecto.Query.Util alias Ecto.Query.Types alias Ecto.Associations.Assoc @doc """ Plans a model for query execution. It is mostly a matter of casting th...
lib/ecto/query/planner.ex
0.821259
0.486819
planner.ex
starcoder
defmodule ExBinance do @moduledoc """ Binance API client. """ defdelegate ping, to: ExBinance.Market, as: :ping defdelegate get_time, to: ExBinance.Market, as: :get_time defdelegate market_info, to: ExBinance.Market, as: :info defdelegate order_book(x, y), to: ExBinance.Market, as: :order_book defdeleg...
lib/ex_binance.ex
0.575588
0.494873
ex_binance.ex
starcoder
defmodule EDS.Remote.Spy.Bindings do def add(from, []), do: from def add([{name, value} | from], to) do add(from, add(name, value, to)) end def add([], to), do: to def add(name, value, [{name, _} | bindings]), do: [{name, value} | bindings] def add(name, value, [b1, {name, _} | bindings]), d...
lib/eds_remote/spy/bindings.ex
0.584983
0.437643
bindings.ex
starcoder
defmodule Ptolemy.Auth do @moduledoc """ `Ptolemy.Auth` provides authentication implementations to a remote vault server. ## Usage All token request should call the `Ptolemy.Auth.authenticate/4` function and *not* the `c:authenticate/3` callback found in each modules implementing this behaviour! Here are ...
lib/auth/auth.ex
0.889816
0.609989
auth.ex
starcoder
defmodule AtomTweaks.Markdown do @moduledoc """ A structure that represents a chunk of Markdown text in memory. For the database type, see `AtomTweaks.Ecto.Markdown` instead. The structure contains both the raw Markdown `text` and, potentially, the rendered `html`. Upon a request to render the structure usi...
lib/atom_tweaks/markdown.ex
0.924526
0.832713
markdown.ex
starcoder
defmodule Telemetry do @moduledoc """ `Telemetry` allows you to invoke certain functions whenever a particular event is emitted. For more information see the documentation for `attach/5`, `attach_many/5` and `execute/3`. """ require Logger alias Telemetry.HandlerTable @type handler_id :: term() @typ...
lib/telemetry.ex
0.885774
0.501038
telemetry.ex
starcoder
defmodule Broadway do @moduledoc ~S""" Broadway is a concurrent, multi-stage tool for building data ingestion and data processing pipelines. It allows developers to consume data efficiently from different sources, such as Amazon SQS, Apache Kafka, Google Cloud PubSub, RabbitMQ and others. ## Built-in fe...
lib/broadway.ex
0.894427
0.869659
broadway.ex
starcoder
defmodule PaymentMessenger.Types.Validator do @moduledoc """ The custom Ecto types validator for ISO-8583 """ # Guard to check if given value is a valid tag defguardp is_tag(tag) when byte_size(tag) == 3 or byte_size(tag) == 7 @typep value :: String.t() | integer() @typep tlv :: {String.t(), pos_integer...
lib/payment_messenger/types/validator.ex
0.803135
0.421224
validator.ex
starcoder
defmodule OMG.Watcher.State.Core do @moduledoc """ The state meant here is the state of the ledger (UTXO set), that determines spendability of coins and forms blocks. All spend transactions, deposits and exits should sync on this for validity of moving funds. ### Notes on loading of the UTXO set We experie...
apps/omg_watcher/lib/omg_watcher/state/core.ex
0.837387
0.582254
core.ex
starcoder
defmodule Logger do @moduledoc ~S""" A logger for Elixir applications. It includes many features: * Provides debug, info, warn, and error levels. * Supports multiple backends which are automatically supervised when plugged into `Logger`. * Formats and truncates messages on the client t...
lib/logger/lib/logger.ex
0.907776
0.569942
logger.ex
starcoder
defmodule Membrane.FramerateConverter do @moduledoc """ Element converts video to target constant frame rate, by dropping and duplicating frames as necessary. Input video may have constant or variable frame rate. Element expects each frame to be received in separate buffer. Additionally, presentation timestam...
lib/membrane_framerate_converter.ex
0.898664
0.556339
membrane_framerate_converter.ex
starcoder
defmodule Priorityqueue do @moduledoc""" The prioriy queue is used by the shortest path algorithm of the `Graph` module. It keeps all the nodes that are to be evaluated and determines which node is to evaluated next. As the name suggests it works as a queue. So the main methods are `push` for adding an entry and ...
lib/priority_queue.ex
0.923558
0.707518
priority_queue.ex
starcoder
defmodule Radixir.System do @moduledoc """ Provides high level interaction with the System API. """ alias Radixir.System.API @type options :: keyword @type error_message :: String.t() @doc """ Gets system version. ## Parameters - `options`: Keyword list that contains - `api`: Keyword lis...
lib/radixir/system.ex
0.917889
0.775307
system.ex
starcoder
defmodule Joken.Error do @moduledoc """ Errors for the Joken API. """ defexception [:reason] alias Joken.Signer @doc false def exception(reason), do: %__MODULE__{reason: reason} def message(%__MODULE__{reason: :no_default_signer}), do: """ Can't sign your token because couldn't create a signe...
lib/joken/error.ex
0.863334
0.460228
error.ex
starcoder
defmodule RDF.PrefixMap do @moduledoc """ A mapping a prefix atoms to IRI namespaces. `RDF.PrefixMap` implements the `Enumerable` protocol. """ alias RDF.IRI @type prefix :: atom @type namespace :: IRI.t @type coercible_prefix :: atom | String.t @type coercible_namespace :: atom | String.t |...
lib/rdf/prefix_map.ex
0.892516
0.619759
prefix_map.ex
starcoder
defmodule Mix do @moduledoc """ Mix is a build tool that provides tasks for creating, compiling, testing (and soon deploying) Elixir projects. Mix is inspired by the Leiningen build tool for Clojure and was written by one of its contributors. This module works as a facade for accessing the most common functi...
lib/mix/lib/mix.ex
0.724286
0.422832
mix.ex
starcoder
defmodule Timelapse do use Evercam.Schema @required_fields [:camera_id, :user_id, :title, :frequency, :status, :date_always, :time_always] @optional_fields [:exid, :snapshot_count, :resolution, :from_datetime, :to_datetime, :watermark_logo, :watermark_position, :recreate_hls, :start_recreate_hls, :last_snapshot_...
lib/evercam_models/timelapse.ex
0.636353
0.4165
timelapse.ex
starcoder
defmodule Farmbot.CeleryScript.AST.Heap do @moduledoc """ A heap-ish data structure required when converting canonical CeleryScript AST nodes into the Flat IR form. This data structure is useful because it addresses each node in the CeleryScript tree via a unique numerical index, rather than using mutable r...
lib/farmbot/celery_script/ast/heap.ex
0.844601
0.440349
heap.ex
starcoder
defmodule AWS.WAFRegional do @moduledoc """ This is **AWS WAF Classic Regional** documentation. For more information, see [AWS WAF Classic](https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) in the developer guide. **For the latest version of AWS WAF**, use the AWS WAFV2 API an...
lib/aws/generated/waf_regional.ex
0.827724
0.615492
waf_regional.ex
starcoder
defmodule Aino.Middleware do @moduledoc """ Middleware functions for processing a request into a response Included in Aino are common functions that deal with requests, such as parsing the POST body for form data or parsing query/path params. """ require Logger alias Aino.Token @doc """ Common mid...
lib/aino/middleware.ex
0.806319
0.483526
middleware.ex
starcoder
defmodule ExTwitter.Parser do @moduledoc """ Provides parser logics for API results. """ alias ExTwitter.Model @doc """ Parse tweet record from the API response JSON. """ @spec parse_tweet(map | nil) :: Model.Tweet.t() | nil def parse_tweet(nil), do: nil def parse_tweet(object) do tweet ...
lib/extwitter/parser.ex
0.861392
0.485661
parser.ex
starcoder
defmodule Surface do @moduledoc """ Surface is component based library for **Phoenix LiveView**. Built on top of the new `Phoenix.LiveComponent` API, Surface provides a more declarative way to express and use components in Phoenix. A work-in-progress live demo with more details can be found at [surface-demo...
lib/surface.ex
0.816077
0.722135
surface.ex
starcoder
defmodule Typo do @moduledoc """ Typo is an Elixir library for programatically generating PDF documents. Functionality is split across a number of modules: * `Typo.PDF.Annotation` - Annotations (links etc). * `Typo.PDF.Canvas` - low-level graphics and text drawing functions. * `Typo.PDF.Document` -...
lib/typo.ex
0.930502
0.687105
typo.ex
starcoder
defmodule Weaver.Loom.Prosumer do @moduledoc """ Represents a worker that handles one `Weaver.Step` at a time. Dispatched steps are passed to the `GenStage` level below after each call to `Weaver.Step.process/1`. A step is passed again to `Weaver.Step.process/1` as long as it returns a new `Weaver.Step` as `n...
lib/weaver/loom/prosumer.ex
0.859884
0.681601
prosumer.ex
starcoder
defmodule XDR.FixedArray do @moduledoc """ This module manages the `Fixed-Length Array` type based on the RFC4506 XDR Standard. """ @behaviour XDR.Declaration alias XDR.Error.FixedArray, as: FixedArrayError defstruct [:elements, :type, :length] @typedoc """ `XDR.FixedArray` structure type specificat...
lib/xdr/fixed_array.ex
0.926844
0.581422
fixed_array.ex
starcoder
defmodule Surface.LiveView do @moduledoc """ A wrapper component around `Phoenix.LiveView`. Since this module is just a wrapper around `Phoenix.LiveView`, you cannot define custom properties for it. Only `:id` and `:session` are available. However, built-in directives like `:for` and `:if` can be used norm...
lib/surface/live_view.ex
0.869493
0.457076
live_view.ex
starcoder
defmodule ElixirRigidPhysics.Geometry.Tetrahedron do @moduledoc """ Module for handling queries related to tetrahedra. """ alias Graphmath.Vec3 require Record Record.defrecord(:tetrahedron, a: {0.0, 0.0, 0.0}, b: {1.0, 0.0, 0.0}, c: {0.0, 1.0, 0.0}, d: {0.0, 0.0, 1.0} ) @type tetrahed...
lib/geometry/tetrahedron.ex
0.916035
0.586345
tetrahedron.ex
starcoder
defmodule Operate do @moduledoc """ Load and run Operate programs (known as "tapes") encoded in Bitcoin SV transactions. Operate is a toolset to help developers build applications, games and services on top of Bitcoin (SV). It lets you write functions, called "Ops", and enables transactions to become small...
lib/operate.ex
0.853501
0.664758
operate.ex
starcoder
defmodule Verk.Queue do @moduledoc """ This module interacts with a queue """ alias Verk.Job import Verk.Dsl @doc """ Counts how many jobs are enqueued on a queue """ @spec count(binary) :: {:ok, integer} | {:error, atom | Redix.Error.t} def count(queue) do Redix.command(Verk.Redis, ["LLEN", q...
lib/verk/queue.ex
0.844313
0.493531
queue.ex
starcoder