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 ListComp do # private function to return a list of people @spec get_people() :: list(tuple()) defp get_people() do [{"Federico", "M", 22}, {"Kim", "F", 45}, {"Hansa", "F", 30}, {"Tran", "M", 47}, {"Cathy", "F", 32}, {"Elias", "M", 50}] end @doc """ using pattern matching on a list of ...
higher_order/lib/list_comp.ex
0.516595
0.613844
list_comp.ex
starcoder
defmodule Polyline do @moduledoc ~S""" Encode and decode Polylines to and from List of `{lon, lat}` tuples. The encode functions accept a `precision` parameter that defines the number of significant digits to retain when encoding. The same precision must be supplied to the decode or the resulting linestring...
lib/polyline.ex
0.928644
0.681237
polyline.ex
starcoder
defmodule InterviewPractice.Arrays do @moduledoc """ Interview Practice - Arrays solutions with Elixir. """ @doc """ Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there...
lib/interview_practice/arrays.ex
0.786377
0.728652
arrays.ex
starcoder
defmodule RDF.Serialization.Decoder do @moduledoc """ A behaviour for decoders of strings encoded in a specific `RDF.Serialization` format. """ alias RDF.{Dataset, Graph} @doc """ Decodes a serialized `RDF.Graph` or `RDF.Dataset` from a string. It returns an `{:ok, data}` tuple, with `data` being the d...
lib/rdf/serialization/decoder.ex
0.913903
0.6922
decoder.ex
starcoder
defmodule Stripe.SetupIntent do @moduledoc """ A [SetupIntent](https://stripe.com/docs/api/setup_intents) guides you through the process of setting up a customer's payment credentials for future payments. You can: - [Create a SetupIntent](https://stripe.com/docs/api/setup_intents/create) - [Retrieve a Set...
lib/stripe/core_resources/setup_intent.ex
0.730866
0.441312
setup_intent.ex
starcoder
defmodule Gateway.Blacklist do @moduledoc """ Enables blacklisting of JWTs by their jti claim. The entries representing the banned claims feature an expiration timestamp, which prevents the blacklist from growing indefinitely. In a distributed setting, the node that does the blacklisting spreads the infor...
lib/gateway/blacklist.ex
0.793906
0.485539
blacklist.ex
starcoder
defmodule Datex.Time do @moduledoc """ Simple Time which can be used in different formats including elixir format `~T[15:45:56]`. It includes different functions to compare time and provide relative time in friendly formats and functions which can format time in multiple ways user needs. """ @doc """ G...
lib/datex/time/time.ex
0.887534
0.752331
time.ex
starcoder
defmodule Posexional.Row do @moduledoc """ this module represent a row in a positional file """ alias Posexional.{Field, Row} alias Posexional.Protocol.{FieldLength, FieldName, FieldRead, FieldSize, FieldWrite} defstruct name: nil, fields: [], separator: "", row_guesser...
lib/posexional/row.ex
0.805517
0.49823
row.ex
starcoder
defmodule Wand.CLI.Commands.Init do use Wand.CLI.Command alias Wand.CLI.Display alias WandCore.WandFile alias WandCore.WandFile.Dependency alias WandCore.Interfaces.File @moduledoc """ # Init Convert an elixir project to use wand for dependencies. ### Usage **wand** init [path] [flags] ## Examp...
lib/cli/commands/init.ex
0.511229
0.660658
init.ex
starcoder
defmodule AlertProcessor.DayType do @moduledoc """ Determine the type (weekday vs weekend) of dates and figure out future instances of a type of day. """ @type day_type_test_function :: (Date.t() | tuple -> :boolean) @type next_day_of_type_function :: (Date.t() | nil -> Date.t()) @doc """ Determine wheth...
apps/alert_processor/lib/day_type.ex
0.745584
0.577108
day_type.ex
starcoder
defmodule Plaid.Investments do @moduledoc """ [Plaid Investments APIs](https://plaid.com/docs/api/products/#investments) """ alias Plaid.Castable defmodule GetHoldingsResponse do @moduledoc """ [Plaid API /investments/holdings/get response schema.](https://plaid.com/docs/api/products/#investmentshol...
lib/plaid/investments.ex
0.876601
0.445288
investments.ex
starcoder
defmodule DataLogger.Destination.Controller do @moduledoc """ A worker process, created and supervised per destination and per `topic`/sub-destination. The first time `DataLogger.log/2` is called with a given `topic` `DataLogger.Destination.Controller`s for this `topic` for every configured destination are cre...
lib/data_logger/destination/controller.ex
0.823044
0.671844
controller.ex
starcoder
defmodule ExPokerEval.Rank do @moduledoc """ Ranking functions for poker cards """ # Order of ranks @order ~w( straight_flush four_of_a_kind full_house flush straight three_of_a_kind two_pairs pair high_card )a @doc """ Using @order finds the hig...
lib/ex_poker_eval/rank.ex
0.835383
0.849535
rank.ex
starcoder
defmodule AWS.StepFunctions do @moduledoc """ AWS Step Functions AWS Step Functions is a service that lets you coordinate the components of distributed applications and microservices using visual workflows. You can use Step Functions to build applications from individual components, each of which perform...
lib/aws/step_functions.ex
0.923507
0.876423
step_functions.ex
starcoder
defmodule Zaryn.Replication do @moduledoc """ Zaryn replication algorithms are based on a replication tree during the transaction mining and include several kind of roles: chain storage nodes, beacon storage nodes, I/O storage node. From this, different validation and storage mechanisms are used. Moreover b...
lib/zaryn/replication.ex
0.830972
0.581392
replication.ex
starcoder
defmodule Beeline do @schema Beeline.Config.schema() @producer_schema Beeline.Producer.schema() @moduledoc """ A tool for building in-order GenStage topologies for EventStoreDB Beeline provides a Broadway-like experience for building GenStage topologies for consuming streams of events from EventStoreDB in...
lib/beeline.ex
0.861567
0.793466
beeline.ex
starcoder
defmodule SmartChain.Aggregates do @moduledoc """ Functions to return metadata and other more useful stats/data than the node returns natively. """ require IEx @doc """ Return recent average difficulty, blocktime, and nethash for last N blocks ## Example: iex> SmartChain.get_recent_averages(20) ...
lib/smart_chain/aggregates.ex
0.886981
0.606498
aggregates.ex
starcoder
defmodule NarouEx.Narou.API do @moduledoc """ API Interface to Shosetsuka-ni-naro API Documentation: https://dev.syosetu.com/man/api/ """ alias NarouEx.Models.{Work, Works} alias NarouEx.Narou.API.Queries @endpoint_url "https://api.syosetu.com/novelapi/api/" @doc """ Fetch works list of specific us...
lib/narou/api.ex
0.675551
0.653424
api.ex
starcoder
defmodule Fsharpy.FromFsharp do @moduledoc """ Helper functions to take FSI output and convert `val` items into their approximate Elixir equivalents. """ def get_vals(raw_output) do raw_output |> String.replace("list =\n", "list = ") |> String.split("\n") |> Enum.filter(fn z -> String.starts_w...
lib/fsharpy/from_fsharp.ex
0.762645
0.468669
from_fsharp.ex
starcoder
defmodule Aoc.Day08 do @moduledoc false import Aoc.Utils def run(1), do: solve1(get_input(8)) def run(2), do: solve2(get_input(8)) def solve1(input) do String.split(input, "\n") |> Enum.map(&String.split/1) |> Enum.reduce(Matrex.zeros(6, 50), &exec/2) |> Enum.sum() end def exec(["rect"...
lib/aoc/day08.ex
0.655997
0.432842
day08.ex
starcoder
module Integer module Behavior mixin Numeric % Iterates the given function n times, passing values from zero % to n - 1. % % ## Examples % % 5.times -> (x) IO.puts x % => 0 1 2 3 4 % def times(function) if function.arity == 0 times_0(self, 0, function) else ...
lib/integer.ex
0.52342
0.655084
integer.ex
starcoder
defmodule ApproximateHistogram do @type t :: %__MODULE__{ bins: [bin], options: options } @type bin :: {value, count} @type value :: number() @type count :: non_neg_integer() @type options :: %{max_bins: pos_integer()} defstruct [ :bins, :options, ] @default_size 50 @spec new(po...
lib/approximate_histogram.ex
0.826397
0.576482
approximate_histogram.ex
starcoder
defmodule XlsxReader.Conversion do @moduledoc """ Conversion of cell values to Elixir types. """ @typedoc """ Date system identified by its reference year """ @type date_system :: 1900 | 1904 @typedoc """ Supported number types identified by module name """ @type number_type :: Integer | Float...
lib/xlsx_reader/conversion.ex
0.923988
0.596492
conversion.ex
starcoder
defmodule Temple.Component do @moduledoc """ API for defining components. Component modules are basically normal Phoenix View modules. The contents of the `render` macro are compiled into a `render/2` function. This means that you can define functions in your component module and use them in your component marku...
lib/temple/component.ex
0.872836
0.86988
component.ex
starcoder
defmodule Cog.Events.ApiEvent do @moduledoc """ Encapsulates information about REST API request processing events. Each event is a map; all events share a core set of fields, while each event sub-type will have an additional set of fields particular to that sub-type. The functions in this module generate A...
lib/cog/events/api_event.ex
0.888187
0.546254
api_event.ex
starcoder
defmodule CSV.Encoding.Encoder do use CSV.Defaults @moduledoc ~S""" The Encoder CSV module takes a table stream and transforms it into RFC 4180 compliant stream of lines for writing to a CSV File or other IO. """ @doc """ Encode a table stream into a stream of RFC 4180 compliant CSV lines for writing ...
deps/csv/lib/csv/encoding/encoder.ex
0.908648
0.550849
encoder.ex
starcoder
defmodule Netstrings do @moduledoc """ netstring encoding and decoding An implementation of djb's [netstrings](http://cr.yp.to/proto/netstrings.txt). Please note that the decoder violates spec by accepting leading zeros in the `len` part. However, the encoder will never generate such leading zeros. """ ...
lib/netstrings.ex
0.867696
0.622302
netstrings.ex
starcoder
defmodule XMLRPC do alias XMLRPC.DecodeError alias XMLRPC.EncodeError alias XMLRPC.Decoder alias XMLRPC.Encoder @moduledoc ~S""" Encode and decode elixir terms to [XML-RPC](http://wikipedia.org/wiki/XML-RPC) parameters. All XML-RPC parameter types are supported, including arrays, structs and Nil (option...
lib/xml_rpc.ex
0.831759
0.407687
xml_rpc.ex
starcoder
defmodule RayTracer.Tasks.Chapter7 do @moduledoc """ This module tests camera from Chapter 7 """ alias RayTracer.RTuple alias RayTracer.Sphere alias RayTracer.Canvas alias RayTracer.Material alias RayTracer.Color alias RayTracer.Light alias RayTracer.World alias RayTracer.Camera alias RayTracer...
lib/tasks/chapter7.ex
0.906808
0.626924
chapter7.ex
starcoder
defmodule AdventOfCode.Day11 do @moduledoc ~S""" [Advent Of Code day 11](https://adventofcode.com/2018/day/11). iex> AdventOfCode.Day11.power_level({3, 5}, 8) 4 iex> AdventOfCode.Day11.power_level({33, 45}, 18) 4 iex> AdventOfCode.Day11.power_level({122, 79}, 57) -5 iex> A...
lib/advent_of_code/day_11.ex
0.583559
0.586523
day_11.ex
starcoder
defmodule Holidays.DateCalculator.Easter do alias Holidays.DateCalculator.DateMath @doc ~S""" Returns the date of Easter for the given `year` ## Examples iex> Holidays.DateCalculator.Easter.gregorian_easter_for(2016) {2016, 3, 27} iex> Holidays.DateCalculator.Easter.gregorian_easter_for(2...
lib/holidays/date_calculator/easter.ex
0.874426
0.513973
easter.ex
starcoder
defmodule Honeyland.Geolocation do @moduledoc """ The Geolocation context. """ @enforce_keys [:latitude, :longitude, :timestamp] defstruct [:latitude, :longitude, :accuracy, :timestamp, :address] alias Honeyland.Astarte alias Honeyland.Astarte.Device alias Honeyland.Geolocation alias Honeyland.Repo...
backend/lib/honeyland/geolocation.ex
0.819929
0.636141
geolocation.ex
starcoder
defmodule Interledger.Packet do @moduledoc """ Decodes a binary block of data into the correct data types """ # ---------------------------------------------------------------------------- # Module Uses, Requires and Imports # ---------------------------------------------------------------------------- r...
servers/exilp/apps/interledger/lib/packet.ex
0.539226
0.403332
packet.ex
starcoder
defmodule Contex.PointPlot do @moduledoc """ A simple point plot, plotting points showing y values against x values. It is possible to specify multiple y columns with the same x column. It is not yet possible to specify multiple independent series. The x column can either be numeric or date time data. If numeric, a `...
lib/chart/pointplot.ex
0.907176
0.888759
pointplot.ex
starcoder
alias Experimental.GenStage defmodule LocalityDispatcher do @moduledoc """ A dispatcher that sends batches to the highest demand. This is the default dispatcher used by `GenStage`. In order to avoid greedy consumers, it is recommended that all consumers have exactly the same maximum demand. """ @behavi...
lib/localitydispatcher.ex
0.84869
0.479077
localitydispatcher.ex
starcoder
defmodule ConfigSmuggler do @moduledoc """ <img src="https://github.com/appcues/config_smuggler/raw/master/assets/smuggler.jpg?raw=true" height="170" width="170" align="right"> ConfigSmuggler is a library for converting Elixir-style configuration statements to and from string-encoded key/value pairs. Elixir...
lib/config_smuggler.ex
0.841891
0.452415
config_smuggler.ex
starcoder
defmodule Thumbnex.ExtractFrame do alias Thumbnex.Animations import FFmpex use FFmpex.Options @doc """ Extract a single frame from the input file. Specify the time offset in seconds (0 for still images). Returns the path of the single frame image file. Options: * `:output_path` - Where to store...
lib/thumbnex/extract_frame.ex
0.813201
0.400749
extract_frame.ex
starcoder
defmodule Exred.NodeTest do @moduledoc """ A helper module to set up tests for Exred nodes. See example usage below. The `module` and `config` arguments can be specified either on the `use` line or in the `start_node` call. `module is the node module that will be tested `config` is the config overrides to ...
lib/exred_nodetest.ex
0.774541
0.659025
exred_nodetest.ex
starcoder
defmodule Snmp.Plug do @moduledoc """ Plug for exposing MIB through REST API # API * `/get`: Retrieve MIB objects * Params: a list of OIDS * Returns: ```json { errors: { "1.2.3": "noSuchObject" }, objects: { "1.3.6.1.2.1.1.1.0": "SNMP Agent" ...
lib/snmp/plug.ex
0.820721
0.783368
plug.ex
starcoder
defmodule Nerves.Grove.PCA9685.Servo do alias Nerves.Grove.PCA9685.ServoSweep @servo_registry_name :servo_proccess_registry_name @server Nerves.Grove.PCA9685.ServoServer # mS @default_step_delay 300 @moduledoc """ Represents a positionable servo connected to an specific channel and pin on a PCA9685 d...
lib/nerves_grove/pca9685/servo.ex
0.829734
0.446736
servo.ex
starcoder
defmodule GuardLog do @moduledoc """ Module for parsing (`parse_log/1`) guard sleep logs and generating guard sleep maps (`to_guard_sleep_map/1`). **Note:** It's possible to remove public struct and parse_log altogether here; we can directly implement `to_guard_sleep_map/1` functionality, saving one `Enum....
lib/day04/guard_log.ex
0.737442
0.476884
guard_log.ex
starcoder
defmodule DecemberFour do @moduledoc """ Fourth Advent of Code task. """ @start 246_515 @stop 739_105 @doc """ Part one of day 4. """ def part_one do list_to_duples_and_triples() |> Enum.filter(fn a -> Enum.at(a[:result], 0) end) |> Kernel.length() end @doc """ Part two of day 4. ...
04/elixir/lib/december_four.ex
0.734024
0.589716
december_four.ex
starcoder
defmodule SnapFramework.Engine.Builder do @moduledoc """ ## Overview This module is responsible for taking the parsed EEx template and building the graph. """ def build_graph(list, acc \\ %{}) do Enum.reduce(list, acc, fn item, acc -> case item do [type: :graph, opts: opts] -> Sc...
lib/engine/builder.ex
0.642545
0.442697
builder.ex
starcoder
defmodule Expo.Translation do @moduledoc """ Translation Structs """ alias Expo.Translation.Plural alias Expo.Translation.Singular @type msgid :: [String.t()] @type msgstr :: [String.t()] @type msgctxt :: String.t() @type t :: Singular.t() | Plural.t() @typedoc """ key that can be used to iden...
lib/expo/translation.ex
0.860852
0.404802
translation.ex
starcoder
defmodule HTTPoison.Request do @moduledoc """ `Request` properties: * `:method` - HTTP method as an atom (`:get`, `:head`, `:post`, `:put`, `:delete`, etc.) * `:url` - target url as a binary string or char list * `:body` - request body. See more below * `:headers` - HTTP headers as an orddict ...
lib/httpoison.ex
0.858585
0.459015
httpoison.ex
starcoder
defmodule Cashtrail.Contacts do @moduledoc """ The Contacts context manages the contact data of one entity. See `Cashtrail.Contacts.Contact` to have more info about what contacts mean in the application. """ import Ecto.Query, warn: false alias Cashtrail.Repo alias Cashtrail.{Contacts, Entities, Pagi...
apps/cashtrail/lib/cashtrail/contacts.ex
0.902054
0.447521
contacts.ex
starcoder
defmodule RingCentral.API do @moduledoc """ The Main module to interact with RingCentral [REST APIs](https://developer.ringcentral.com/api-reference). """ @default_doc """ It will uses `ringcentral.http_client` to send the request to RingCentral API, which by default is the `RingCentral.HTTPClient.Default...
lib/ring_central/api.ex
0.838911
0.406803
api.ex
starcoder
defmodule Time do @moduledoc """ A Time struct and functions. The Time struct contains the fields hour, minute, second and microseconds. New times can be built with the `new/4` function or using the `~T` (see `Kernel.sigil_T/2`) sigil: iex> ~T[23:00:07.001] ~T[23:00:07.001] Both `new/4` and s...
lib/elixir/lib/calendar/time.ex
0.95003
0.788502
time.ex
starcoder
defmodule ExJenga.Signature do @moduledoc """ ## signatures To ensure the security of your transactions or requests, we have implemented security controls that we ensure that transactions can only be initiated by you and no one else. To achieve this, we use message signatures. How it works All requests, oth...
lib/ex_jenga/signature.ex
0.70069
0.552238
signature.ex
starcoder
defmodule Apiv4.Router do use Apiv4.Web, :router @moduledoc """ The router is where I describe how my data are related to each other as well as how they relate to the context at hand. In a separate file, say character.ex, I would find the description for the individual data in my app. """ ## Autox Inst...
web/router.ex
0.512937
0.544801
router.ex
starcoder
defmodule ExWire.Packet.NewBlock do @moduledoc """ Eth Wire Packet for advertising new blocks. ``` **NewBlock** [`+0x07`, [`blockHeader`, `transactionList`, `uncleList`], `totalDifficulty`] Specify a single block that the peer should know about. The composite item in the list (following the message ID) is...
apps/ex_wire/lib/ex_wire/packet/new_block.ex
0.901527
0.726741
new_block.ex
starcoder
defmodule NervesHubLinkHTTP.Client do @moduledoc """ A behaviour module for customizing the tool used for HTTP requests to NervesHub. Also allows handling FWUP messages and errors By default, `:hackney` is used for completing HTTP requests and all FWUP messages are logged to STDOUT. To specify your own modu...
lib/nerves_hub_link_http/client.ex
0.782039
0.522994
client.ex
starcoder
defmodule Mnemonic do @moduledoc """ BIP39 Implementation """ alias Mnemonic.Wordlist @languages [ :english, :chinese_simplified, :chinese_traditional, :french, :italian, :japanese, :korean, :spanish, :czech, :portuguese ] @valid_entropy_length [128, 160, 192, 22...
lib/mnemonic.ex
0.841631
0.536738
mnemonic.ex
starcoder
if Code.ensure_loaded?(Phoenix) do defmodule PromEx.Plugins.Phoenix do @moduledoc """ This plugin captures metrics emitted by Phoenix. Specifically, it captures HTTP request metrics and Phoenix channel metrics. This plugin supports the following options: - `router`: This is a REQUIRED option and ...
lib/prom_ex/plugins/phoenix.ex
0.869091
0.596756
phoenix.ex
starcoder
defmodule ExJenga.SendMoney.Swift do @moduledoc """ Swift allows sending of money to cross border banks. ## Country Codes To lookup the country codes you will use in your application you can visit https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements ## Bank Codes (BIC and IBAN)...
lib/ex_jenga/send_money/swift.ex
0.839175
0.647701
swift.ex
starcoder
defmodule OMG.State.Transaction do @moduledoc """ Internal representation of transaction spent on Plasma chain. This module holds the representation of a "raw" transaction, i.e. without signatures nor recovered input spenders This module also contains the public Transaction API to be prefered to access data ...
apps/omg/lib/omg/state/transaction.ex
0.91065
0.773345
transaction.ex
starcoder
defmodule Site.PhoneNumber do @moduledoc "Functions for working with phone numbers" @doc """ Takes a string holding a possibly formatted phone number with optional leading 1. Returns a pretty human-readable format. Returns the original input if parsing/formatting fails. Returns "" if given nil. """ @sp...
apps/site/lib/site/phone_number.ex
0.773259
0.451568
phone_number.ex
starcoder
defmodule ElixirSense.Core.Normalized.Code do @moduledoc """ Shim to replicate the behavior of deprecated `Code.get_docs/2` """ @type doc_t :: nil | false | String.t() @type fun_doc_entry_t :: {{atom, non_neg_integer}, pos_integer, :function | :macro, term, doc_t, map} @type doc_entry_t :: ...
lib/elixir_sense/core/normalized/code.ex
0.749362
0.447762
code.ex
starcoder
defmodule Cloak.Ciphers.AES.CTR do @moduledoc """ A `Cloak.Cipher` which encrypts values with the AES cipher in CTR (stream) mode. Internally relies on Erlang's `:crypto.stream_encrypt/2`. """ @behaviour Cloak.Cipher alias Cloak.Tags.{Encoder, Decoder} @doc """ Callback implementation for `Cloak.Ciph...
lib/cloak/ciphers/aes_ctr.ex
0.857216
0.569823
aes_ctr.ex
starcoder
defmodule ExDiceRoller.RandomizedRolls do @moduledoc """ Generates and executes randomized ExDiceRoller roll expressions via `ExDiceRoller.ExpressionBuilder.randomize/2`. """ alias ExDiceRoller.{Compiler, ExpressionBuilder} @type error_keyword :: [err: any, expr: String.t(), var_values: Keyword.t(), stack...
test/support/randomized_rolls.ex
0.767777
0.545891
randomized_rolls.ex
starcoder
defmodule LearnKit.Regression.Linear do @moduledoc """ Module for Linear Regression algorithm """ defstruct factors: [], results: [], coefficients: [] alias LearnKit.Regression.Linear use Linear.Calculations use LearnKit.Regression.Score @type factors :: [number] @type results :: [number] @type c...
lib/learn_kit/regression/linear.ex
0.945764
0.905322
linear.ex
starcoder
defmodule Elixush.PushState do @moduledoc "Keeps track of and modifies Push states and stacks." import Enum, only: [empty?: 1] import Elixush.Globals.Agent @doc "Returns an empty push state." def make_push_state do %{exec: [], code: [], integer: [], float: [], boolean: [], c...
lib/pushstate.ex
0.708918
0.493531
pushstate.ex
starcoder
defmodule Astarte.Flow.Blocks.HttpSink do @moduledoc """ This is a consumer block that takes `data` from incoming `Message` and makes a POST request to the configured URL containing `data`. This block supports only incoming messages with type `:binary`, so serialization to binary format must be handled in a se...
lib/astarte_flow/blocks/http_sink.ex
0.895177
0.506897
http_sink.ex
starcoder
defmodule ExLTTB.Stream do @moduledoc """ ExLTTB with lazy evalutation """ alias ExLTTB.SampleUtils @doc """ Downsamples a samples stream using a modified version of [LTTB](https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf). The difference with the original algorithm is that since a Stream cou...
lib/ex_lttb/stream.ex
0.872944
0.776623
stream.ex
starcoder
defmodule StateMachine do @moduledoc """ StateMachine package implements state machine abstraction. It supports Ecto out of the box and can work as both data structure and a process powered by gen_statem. Check out the [article](https://dev.to/youroff/state-machines-for-business-np8) for motivation. Here'...
lib/state_machine.ex
0.792705
0.69022
state_machine.ex
starcoder
defmodule Junex do @moduledoc """ Junex is a library for help you to interact to the Juno API in a easier way! ## WARNINGS 1. Although you can build the maps mannualy, like `charge_info` and `payment_billing_info`, Junex provide a bunch of helper functions to build the exactly structure that the Juno...
lib/junex.ex
0.860925
0.477189
junex.ex
starcoder
defmodule StarkInfra.IssuingWithdrawal do alias __MODULE__, as: IssuingWithdrawal alias StarkInfra.Error alias StarkInfra.Utils.Rest alias StarkInfra.Utils.Check alias StarkInfra.User.Project alias StarkInfra.User.Organization @moduledoc """ # IssuingWithdrawal struct """ @doc """ The IssuingW...
lib/issuing_withdrawal/issuing_withdrawal.ex
0.863708
0.554139
issuing_withdrawal.ex
starcoder
defmodule Construct do @moduledoc """ Construct internally divided into three components: * `Construct` — defining structures; * `Construct.Cast` — making structure instances; * `Construct.Type` — type-coercion and custom type behaviour. ## Construct definition defmodule StructureName do ...
lib/construct.ex
0.882801
0.610047
construct.ex
starcoder
defmodule ConsumerSupervisor do @moduledoc ~S""" A supervisor that starts children as events flow in. A `ConsumerSupervisor` can be used as the consumer in a `GenStage` pipeline. A new child process will be started per event, where the event is appended to the arguments in the child specification. A `Cons...
deps/gen_stage/lib/consumer_supervisor.ex
0.912499
0.633127
consumer_supervisor.ex
starcoder
defmodule Fly.Repo do @moduledoc """ This wraps the built-in `Ecto.Repo` functions to proxy writable functions like insert, update and delete to be performed on the an Elixir node in the primary region. To use it, rename your existing repo module and add a new module with the same name as your original rep...
fly_postgres/lib/repo.ex
0.84075
0.732161
repo.ex
starcoder
defmodule FarmbotFirmware.StubTransport do @moduledoc "Stub for transporting GCODES. Simulates the _real_ Firmware." use GenServer alias FarmbotFirmware.StubTransport, as: State alias FarmbotFirmware.{GCODE, Param} require Logger defstruct status: :boot, handle_gcode: nil, position...
farmbot_firmware/lib/farmbot_firmware/transports/stub_transport.ex
0.690455
0.429788
stub_transport.ex
starcoder
defmodule Mix.Tasks.Absinthe.Gen.Schema do use Mix.Task alias Mix.AbsintheGeneratorUtils @shortdoc "Generates an absinthe schema" @moduledoc """ Generates an Absinthe Schema ### Options #{NimbleOptions.docs(AbsintheGenerator.Schema.definitions())} ### Specifying Middleware To specify middleware ...
lib/mix/tasks/schema.ex
0.81309
0.591487
schema.ex
starcoder
defmodule EventStore.RecordedEvent do @moduledoc """ `EventStore.RecordedEvent` contains the persisted data and metadata for a single event. Events are immutable once recorded. ## Recorded event fields - `event_number` - position of the event within the stream. This will be identical to the `stre...
lib/event_store/recorded_event.ex
0.877994
0.635505
recorded_event.ex
starcoder
defmodule BSV.Transaction.Input do @moduledoc """ Module for parsing and serialising transaction inputs. """ alias BSV.Script alias BSV.Transaction.Output alias BSV.Util alias BSV.Util.VarBin @max_sequence 0xFFFFFFFF @p2pkh_script_size 108 defstruct output_txid: nil, output_index: nil,...
lib/bsv/transaction/input.ex
0.86212
0.48182
input.ex
starcoder
defmodule Tesla.Middleware.Logger do @behaviour Tesla.Middleware @moduledoc """ Log requests as single line. Logs request method, url, response status and time taken in milliseconds. ### Example usage ``` defmodule MyClient do use Tesla plug Tesla.Middleware.Logger end ``` ### Logger ou...
lib/tesla/middleware/logger.ex
0.798462
0.669684
logger.ex
starcoder
defmodule Oban.Plugins.Reindexer do @moduledoc """ Periodically rebuild indexes to minimize database bloat. Over time various Oban indexes may grow without `VACUUM` cleaning them up properly. When this happens, rebuilding the indexes will release bloat. The plugin uses `REINDEX` with the `CONCURRENTLY` opti...
lib/oban/plugins/reindexer.ex
0.865039
0.595228
reindexer.ex
starcoder
defmodule DBConnection.Sojourn.Regulator do @moduledoc """ A `:sregulator` callback module using an unlimited queue and a CoDel strategy for the valve. ### Connection options * `:idle_interval` - The time interval in milliseconds before the pool will start increasing connections, ideally the 95-99 per...
deps/db_connection/lib/db_connection/sojourn/regulator.ex
0.791902
0.493164
regulator.ex
starcoder
defmodule Ethereum do @moduledoc """ This library presents a convenient interface to control a full Ethereum node from Elixir, abstracting away the need to deal with the JSON-RPC API directly. It decodes the hex responses when necessary and functions return the idiomatic {:ok, data} | {:error, reason} tupl...
lib/ethereum.ex
0.736021
0.547222
ethereum.ex
starcoder
defmodule Sanbase.SmartContracts.Utils do require Logger @type address :: String.t() @type contract_function :: String.t() | %ABI.FunctionSelector{} @doc ~s""" Example usage: If we have the abi specification obtained by: ``` File.read!("some_abi.json") |> Jason.decode! |> ABI.parse_specification ...
lib/sanbase/smart_contracts/utils.ex
0.866486
0.710766
utils.ex
starcoder
defmodule Hologram do @moduledoc ~S''' Hologram is a full stack isomorphic Elixir web framework that can be used on top of Phoenix. ## Inspired by Hologram was inspired by Elm, Phoenix LiveView, Surface, Svelte, Vue.js, Mint, Ruby on Rails. ## How it works The Hologram concept is that your web app is c...
lib/hologram/hologram.ex
0.712632
0.68941
hologram.ex
starcoder
defmodule ExSentry.LoggerBackend do @moduledoc ~S""" `ExSentry.LoggerBackend` is a backend for the Elixir `Logger` app. It captures all log messages above a given severity level (default `:error`) with `ExSentry.capture_message`. ## Usage 1. Install the logger backend with: Logger.add_backend(E...
lib/exsentry/logger_backend.ex
0.726717
0.406567
logger_backend.ex
starcoder
use Croma defmodule Antikythera.Time do @moduledoc """ Data structure to represent date and time in milli-seconds resolution. Note that all values of `Antikythera.Time.t` are in UTC. `Poison.Encoder` protocol is implemented for `Antikythera.Time.t`, so that values of this type can be directly converted to...
lib/util/time.ex
0.764012
0.511046
time.ex
starcoder
defmodule Dispatch.Registry do @moduledoc """ Provides a distributes registry for services. This module implements the `Phoenix.Tracker` behaviour to provide a distributed registry of services. Services can be added and removed to and from the registry. Services are identified by their type. The type can ...
lib/dispatch/registry.ex
0.877444
0.607838
registry.ex
starcoder
defmodule Membrane.Element.Fade do alias Membrane.Buffer alias Membrane.Caps.Audio.Raw alias Membrane.Time alias __MODULE__.Fading alias __MODULE__.MultiplicativeFader, as: Fader use Membrane.Filter use Membrane.Log, tags: :membrane_element_fade def_options fadings: [ default: [], ...
lib/membrane_element_fade.ex
0.790611
0.49585
membrane_element_fade.ex
starcoder
defmodule Validatex.Validation do @moduledoc """ This module helps with validation of input forms. """ alias Validatex.MapExtra @type key() :: String.t() | atom() @type error() :: String.t() @type errors() :: [error()] @type error_or_errors :: error() | errors() @type validator(a, b) :: (a -> Resul...
lib/validatex/validation.ex
0.937569
0.65303
validation.ex
starcoder
defmodule Bunch.Struct do @moduledoc """ A bunch of functions for easier manipulation on structs. """ import Kernel, except: [get_in: 2, put_in: 2, update_in: 3, get_and_update_in: 3, pop_in: 2] use Bunch @compile {:inline, map_keys: 1} @gen_common_docs fn fun_name -> """ Wraps `Bunch.Access.#{f...
lib/bunch/struct.ex
0.66356
0.444806
struct.ex
starcoder
defmodule GitHooks.Tasks.File do @moduledoc """ Represents a file that will be executed as a git hook task. A file should be configured as `{:file, file_path, opts}`, being `opts` an optional configuration. The file should be readable and have execution permissions. See `#{__MODULE__}.new/1` for more info...
lib/tasks/file.ex
0.840357
0.837421
file.ex
starcoder
defmodule Indicado.OBV do @moduledoc """ This is the OBV module used for calculating On-Balance Volume """ @typedoc """ The argument passed to eval functions should be a list of ovb_data_map type. """ @type ovb_data_map :: %{ close: float, volume: float } @doc """ Calcul...
lib/indicado/obv.ex
0.912004
0.715474
obv.ex
starcoder
defmodule ExOpenAI do use HTTPoison.Base @moduledoc """ An Elixir client for the OpenAI API. The OpenAI API lets developers use new AI technologies from OpenAI, integrating them into products and services. The API is general-purpose and can be tried on virtually any natural language task, and its success ...
lib/ex_openai.ex
0.874553
0.909506
ex_openai.ex
starcoder
defmodule Bench do # This is the benchmark of the single operations in the # Huffman encoding and decoding process. # added bench def bench() do bench(1000000) IO.puts(" Warm up -------------------------------------------------") bench(10000) bench(100000) bench(200000) bench(400000) ...
huffman/lib/bench.ex
0.703753
0.441131
bench.ex
starcoder
defmodule Dune do @moduledoc """ A sandbox for Elixir to safely evaluate untrusted code from user input. ## Features - only authorized modules and functions can be executed (see `Dune.Allowlist.Default`) - no access to environment variables, file system, network... - code executed in an isolated process...
lib/dune.ex
0.856107
0.662946
dune.ex
starcoder
defmodule ReWeb.Types.Address do @moduledoc """ GraphQL types for addresses """ use Absinthe.Schema.Notation alias ReWeb.Resolvers object :address do field :id, :id field :street, :string field :street_number, :string field :neighborhood, :string field :city, :string field :state, ...
apps/re_web/lib/graphql/types/address.ex
0.712732
0.460228
address.ex
starcoder
defmodule Cashtrail.Statuses do @moduledoc """ Provides a set of functions to work with status on Ecto Schemas records that implements `WithStatus` protocol. If the record has one field called `:archived_at` and want map this field to `:active` or `:archived` state. It is only necessary to set `@derive Casht...
apps/cashtrail/lib/cashtrail/statuses.ex
0.882054
0.938801
statuses.ex
starcoder
defmodule Membrane.MP4.Track.SampleTable do @moduledoc """ A module that defines a structure and functions allowing to store samples, assemble them into chunks and flush when needed. Its public functions take care of recording information required to build a sample table. For performance reasons, the module ...
lib/membrane_mp4/track/sample_table.ex
0.873916
0.640256
sample_table.ex
starcoder
defexception IO.StreamError, [:reason, :message] do def exception(opts) do reason = opts[:reason] formatted = iolist_to_binary(:file.format_error(reason)) IO.StreamError[message: "error during streaming: #{formatted}", reason: reason] end end defmodule IO.Stream do @moduledoc """ Defines a `IO.S...
lib/elixir/lib/io.ex
0.876145
0.679219
io.ex
starcoder
defmodule IP2Country do @moduledoc """ IP2Country is a simple geolocating module (IP -> Country Code) with built-in database. Database is provided by https://db-ip.com, and it is compiled into the module. Compilation time is about 20 seconds on 2-core machine. Searching time is about 4µs. To update the data...
lib/ip2country.ex
0.820541
0.464962
ip2country.ex
starcoder
defmodule Exeration.Operation.Argument do defmodule Invalid do defexception message: "Argument is not in valid format" end alias Exeration.Operation.Argument @type t :: %Exeration.Operation.Argument{ name: atom(), type: atom(), required: boolean() | nil, struct: str...
lib/exeration/annotations/argument.ex
0.79546
0.406126
argument.ex
starcoder
defmodule Gorpo.Announce do @moduledoc """ register one or more services on consul and periodically update its health status. Normally, you should start :gorpo otp application and declare the services in the config file. Refer to `Gorpo` module for more information about this. If you ever need to register a s...
lib/gorpo/announce.ex
0.737158
0.467636
announce.ex
starcoder
defmodule Freshcom.Include do alias Ecto.Queryable @spec to_ecto_preloads(module, String.t() | list, map) :: list def to_ecto_preloads(schema, include, filters \\ %{}) def to_ecto_preloads(_, [], _), do: [] def to_ecto_preloads(_, nil, _), do: [] def to_ecto_preloads(schema, include, filters) when is_bin...
lib/freshcom/core/include.ex
0.596903
0.428951
include.ex
starcoder
defmodule Xgit.PersonIdent do @moduledoc ~S""" A combination of a person identity and time in git. """ alias Xgit.Util.ParseCharlist alias Xgit.Util.ParseDecimal import Xgit.Util.ForceCoverage @typedoc "Time zone offset in minutes +/- from GMT." @type tz_offset :: -720..840 @typedoc ~S""" The t...
lib/xgit/person_ident.ex
0.829596
0.417004
person_ident.ex
starcoder