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 RDF.Query do @moduledoc """ The RDF Graph query API. """ alias RDF.Graph alias RDF.Query.{BGP, Builder} @default_matcher RDF.Query.BGP.Stream @doc """ Execute the given `query` against the given `graph`. The `query` can be given directly as `RDF.Query.BGP` struct created with one of th...
lib/rdf/query.ex
0.919367
0.914825
query.ex
starcoder
defmodule FinanceTS.Adapters.Finnhub do @moduledoc """ An Adapter for Finnhub.io Homepage: https://finnhub.io/ API Docs: https://finnhub.io/docs/api """ use Tesla plug(Tesla.Middleware.BaseUrl, "https://finnhub.io/api/v1") @behaviour FinanceTS.Adapter @supported_resolutions [:minute, {:minute, 5}, ...
lib/finance_ts/adapters/finnhub.ex
0.80765
0.453262
finnhub.ex
starcoder
defmodule InteropProxy.Message do @moduledoc """ Contains the Protobuf messages from exprotobuf. """ @external_resource "lib/messages/interop.proto" use Protobuf, from: Path.expand("../messages/interop.proto", __DIR__), use_package_names: true @doc ~S""" Takes a map and turns it into a Protobuf...
services/interop-proxy/lib/interop_proxy/message.ex
0.79542
0.438064
message.ex
starcoder
defmodule Crux.Structs.Util do @moduledoc """ Collection of util functions. """ @moduledoc since: "0.1.0" alias Crux.Structs alias Crux.Structs.Snowflake @doc ~S""" Converts a list of raw api data to structs keyed under the passed key. ## Examples ```elixir iex> [ ...> %{"username" => "space...
lib/structs/util.ex
0.844249
0.610976
util.ex
starcoder
defmodule Bolt.Sips.Internals.PackStream.V2 do alias Bolt.Sips.Types.{TimeWithTZOffset, DateTimeWithTZOffset, Duration, Point} alias Bolt.Sips.Internals.PackStream.Encoder defmacro __using__(_options) do quote do import unquote(__MODULE__) @last_version Bolt.Sips.Internals.BoltVersionHelper.last...
lib/bolt_sips/internals/pack_stream/v2.ex
0.647464
0.533823
v2.ex
starcoder
defmodule Herald.Router do @moduledoc """ Provides the routes DSL. Routes is a way trought Herald know: * Which Message Schema uses to encode a message before send it; * Which function must be used to process a message when receives An router must be implemented as a module of your application, as...
lib/herald/router.ex
0.85564
0.655977
router.ex
starcoder
defmodule MeshxRpc.Common.Telemetry do @moduledoc false alias MeshxRpc.Common.Structs.Data require Logger @error_prefix :error_rpc @error_prefix_remote :error_rpc_remote def attach([_n, i] = telemetry_prefix, id \\ nil) do id = if is_nil(id), do: i, else: id events = [ telemetry_prefix ++ [...
lib/common/telemetry.ex
0.521715
0.413596
telemetry.ex
starcoder
defmodule Binance do alias Binance.Rest.HTTPClient @type error :: {:binance_error, %{code: integer(), message: String.t()}} | {:http_error, any()} | {:poison_decode_error, any()} | {:config_missing, String.t()} # Server @doc """ Pings binance API """ @spec ping()...
lib/binance.ex
0.889373
0.596081
binance.ex
starcoder
defmodule StaffNotesWeb.PrimerHelpers do @moduledoc """ Helper functions for generating elements that work with [Primer](https://primer.github.io/). """ use Phoenix.HTML import Phoenix.View, only: [render: 3, render_many: 4] import PhoenixOcticons alias Phoenix.HTML.Form alias StaffNotes.Markdown al...
lib/staff_notes_web/helpers/primer_helpers.ex
0.883293
0.746959
primer_helpers.ex
starcoder
defmodule AWS.EMR do @moduledoc """ Amazon EMR is a web service that makes it easy to process large amounts of data efficiently. Amazon EMR uses Hadoop processing combined with several AWS products to do tasks such as web indexing, data mining, log file analysis, machine learning, scientific simulation, and ...
lib/aws/emr.ex
0.854824
0.664756
emr.ex
starcoder
defmodule AWS.Comprehend do @moduledoc """ Amazon Comprehend is an AWS service for gaining insight into the content of documents. Use these actions to determine the topics contained in your documents, the topics they discuss, the predominant sentiment expressed in them, the predominant language used, and ...
lib/aws/generated/comprehend.ex
0.900163
0.520374
comprehend.ex
starcoder
defmodule ManhattanV2 do @moduledoc """ The waypoint starts 10 units east and 1 unit north. Action N means to move the waypoint north by the given value. Action S means to move the waypoint south by the given value. Action E means to move the waypoint east by the given value. Action W means to move the wayp...
12-Manhattan/lib/manhattan_v2.ex
0.846101
0.841956
manhattan_v2.ex
starcoder
defmodule Gringotts.CreditCard do @moduledoc """ Defines a `struct` for (credit) cards and some utilities. """ defstruct [:number, :month, :year, :first_name, :last_name, :verification_code, :brand] @typedoc """ Represents a Credit Card. | Field | Type | Description ...
lib/gringotts/credit_card.ex
0.86977
0.750004
credit_card.ex
starcoder
defmodule Eigr.FunctionsController.Controllers.V1.PersistentFunction do @moduledoc """ Eigr.FunctionsController: PersistentFunction CRD. ## Kubernetes CRD Spec Eigr PersistentFunction CRD ### Examples ``` apiVersion: functions.eigr.io/v1 kind: PersistentFunction metadata: name: shopping-cart ...
lib/eigr_functions_controller/controllers/v1/persistent_function.ex
0.762557
0.735095
persistent_function.ex
starcoder
defmodule Unicode.SentenceBreak do @moduledoc """ Functions to introspect Unicode sentence breaks for binaries (Strings) and codepoints. """ @behaviour Unicode.Property.Behaviour alias Unicode.Utils @sentence_breaks Utils.sentence_breaks() |> Utils.remove_annotations() @doc """...
lib/unicode/sentence_break.ex
0.903276
0.446434
sentence_break.ex
starcoder
defmodule SimplexNoise.Overview do use OctaveNoise.Mixin import Bitwise # Skewing Factor 1D to 5D with dummy 0D value @precomputed_dimensions 5 @skewing_factor ([1.0] ++ (1..@precomputed_dimensions |> Enum.map(&SimplexNoise.Skew.skewing_factor_to_simplical_grid/1))) |> List.to_tuple @unskewing_fac...
lib/simplex_noise/overview.ex
0.696165
0.619529
overview.ex
starcoder
defmodule RigCloudEvents.CloudEvent do @moduledoc """ CloudEvents is a vendor-neutral specification for defining the format of event data. See: https://github.com/cloudevents """ @parser RigCloudEvents.Parser.PartialParser @type t :: %__MODULE__{ json: String.t(), parsed: @parser.t() ...
apps/rig_cloud_events/lib/rig_cloud_events/cloud_event.ex
0.84905
0.537284
cloud_event.ex
starcoder
defmodule PlugCacheControl.Helpers do @moduledoc """ Contains helper functions for working with cache-control header on Plug connections. """ alias Plug.Conn alias PlugCacheControl.Header @typep unit :: :second | :seconds | :minute | :minutes | :hou...
lib/plug_cache_control/helpers.ex
0.811078
0.551091
helpers.ex
starcoder
defmodule Validation do @moduledoc """ This module provides rails-like validations and strong parameters. Set `use Validation` in your model or web.ex. ## Examples ``` defmodule Hoge.User do use Hoge.Web, :model use Validation schema "users" do field :name, :string timestamps() ...
lib/validation.ex
0.891493
0.879974
validation.ex
starcoder
defmodule ExMachina.Ecto do @moduledoc """ Module for building and inserting factories with Ecto This module works much like the regular `ExMachina` module, but adds a few nice things that make working with Ecto easier. * It uses `ExMachina.EctoStrategy`, which adds `insert/1`, `insert/2`, `insert_pair/...
lib/ex_machina/ecto.ex
0.783368
0.414395
ecto.ex
starcoder
defmodule Sanbase.Metric.Helper do @moduledoc """ A helper module that uses the separate metric modules and builds maps and mappings that combine the data from all modules into a single place. This module is hiding the metric modules from the user-facing `Sanbase.Metric` module and makes adding new modules ...
lib/sanbase/metric/helper.ex
0.794385
0.467818
helper.ex
starcoder
defmodule CarCache.Cache do @moduledoc """ Data structure representing an CAR cache. """ alias CarCache.Clock alias CarCache.LRU defstruct c: 1_000, name: nil, p: 0, data: nil, t1: nil, t2: nil, b1: nil, b2: nil @type t...
lib/car_cache/cache.ex
0.770767
0.471223
cache.ex
starcoder
defmodule Elsa.Util do @moduledoc """ Provides functions for simplifying first-class interactions (consuming and producing) such as connecting to a cluster and establishing a persistent client process for interacting with a cluster. """ @default_max_chunk_size 900_000 @timestamp_size_in_bytes 10 @doc ...
lib/elsa/util.ex
0.819641
0.58673
util.ex
starcoder
defmodule Ngram.GameState do @moduledoc """ Model the game state for a tic-tac-toe game. """ alias Ngram.Player alias __MODULE__ defstruct code: nil, players: [], player_turn: nil, status: :not_started, timer_ref: nil, ngram: "", guess...
lib/ngram/game_state.ex
0.780286
0.453141
game_state.ex
starcoder
defmodule EctoCommons.URLValidator do @moduledoc ~S""" This validator is used to validate URLs. ## Options There are some available `:checks` depending on the strictness of what you want to validate: - `:parsable`: Checks to see if the URL is parsable by `:http_uri.parse/1` Erlang function. This ca...
lib/validators/url.ex
0.83825
0.579103
url.ex
starcoder
defmodule CommandedMessaging do @moduledoc ~S""" # Commanded Messaging **Common macros for messaging in a Commanded application** ## Commands The `Commanded.Command` macro creates an Ecto `embedded_schema` so you can take advantage of the well known `Ecto.Changeset` API. defmodule BasicCreateAccount...
lib/commanded_messaging.ex
0.638159
0.403978
commanded_messaging.ex
starcoder
defmodule Mix.Tasks.FillExchange do @moduledoc """ Module defining a mix task to fill an Exchange with random orders. """ use Mix.Task @shortdoc "Populate exchange" def run(args) do Application.ensure_all_started(:hackney) switches = [help: :boolean, mode: :boolean, count: :integer, ticker: :atom] ...
lib/tasks/fill_exchange.ex
0.60964
0.404213
fill_exchange.ex
starcoder
defmodule Html5ever do @moduledoc """ This is an HTML parser written in Rust. The project provides a NIF - Native Implemented Function. It works on top of [a parser of the same name](https://github.com/servo/html5ever) from the Servo project. By default this lib will try to use a precompiled NIF from th...
lib/html5ever.ex
0.746139
0.510252
html5ever.ex
starcoder
defmodule Nx.Heatmap do @moduledoc """ Provides a heatmap that is printed using ANSI colors in the terminal. """ @doc false defstruct [:tensor, opts: []] @behaviour Access @impl true def fetch(%Nx.Heatmap{tensor: tensor} = hm, value) do case Access.fetch(tensor, value) do {:ok, %Nx.Tensor...
lib/nx/heatmap.ex
0.78374
0.613352
heatmap.ex
starcoder
defmodule PartitionSupervisor do @moduledoc """ A supervisor that starts multiple partitions of the same child. Certain processes may become bottlenecks in large systems. If those processes can have their state trivially partitioned, in a way there is no dependency between them, then they can use the `Part...
lib/elixir/lib/partition_supervisor.ex
0.928943
0.719692
partition_supervisor.ex
starcoder
defmodule TtrCore.Players.Player do @moduledoc false alias TtrCore.Cards.TicketCard alias TtrCore.Players defstruct [ id: 1, name: "anonymous", pieces: 45, tickets: [], tickets_buffer: [], trains: [], trains_selected: 0, routes: [], ] @type count :: integer() @type t ::...
lib/ttr_core/players/player.ex
0.744656
0.425187
player.ex
starcoder
defmodule Helpers do use Bitwise @doc """ Function that takes two lists of bytes of equal size Returns a list of the bitwise XOR of the two arguments ### Examples iex> Helpers.my_xor([1], [1]) [0] iex> Helpers.my_xor([0], [1]) [1] """ @spec my_xor([byte], [byte]) :: [byte] def my_xor(...
lib/helpers.ex
0.786336
0.558688
helpers.ex
starcoder
defmodule PoxTool do defmodule Options do defstruct [ palette: 256, depth: { [0, 1, 2, 3, 4, 5, 6, 7], 128 } ] @type palette_size :: 4 | 16 | 256 @type depth_mode :: 0..7 @type depth_bits :: 32 | 128 @type t :: %__MODULE__{ palett...
lib/pox_tool.ex
0.751739
0.541651
pox_tool.ex
starcoder
defmodule NimbleOptions do @options_schema [ *: [ type: :keyword_list, keys: [ type: [ type: {:custom, __MODULE__, :validate_type, []}, default: :any, doc: "The type of the option item." ], required: [ type: :boolean, default: f...
lib/nimble_options.ex
0.905701
0.639792
nimble_options.ex
starcoder
defmodule AdventOfCode.DayFourSolution do defp load_data() do [draw | rest] = AdventOfCode.load_data(4, "data.txt") boards = rest |> Enum.map(fn row -> String.split(row) end) |> Enum.chunk_every(5) |> Enum.map(&load_board/1) draw_list = draw |> String.split(",") |> Enum.map(&Stri...
lib/advent_of_code/day-4/solution.ex
0.563978
0.505676
solution.ex
starcoder
defmodule Mix.Tasks.Hedwig.Gen.Robot do use Mix.Task import Mix.Generator @shortdoc "Generate a new robot" @moduledoc """ Generates a new robot. The robot will be placed in the `lib` directory. ## Examples mix hedwig.gen.robot mix hedwig.gen.robot --name alfred --robot Custom.Module #...
lib/mix/tasks/hedwig.gen.robot.ex
0.756088
0.425963
hedwig.gen.robot.ex
starcoder
elixir_doc = """ Top level module providing convenience access to needed functions as well as the very high level `Benchee.run` API. Intended Elixir interface. """ erlang_doc = """ High-Level interface for more convenient usage from Erlang. Same as `Benchee`. """ for {module, moduledoc} <- [{Benchee, elixir_doc},...
lib/benchee.ex
0.81457
0.420362
benchee.ex
starcoder
defmodule Mlx90640 do @moduledoc """ `elixir_mlx90640` provides a high level abstraction to interface with the MLX90640 Far Infrared Thermal Sensor Array on Linux platforms. """ use Bitwise use GenServer defmodule State do @moduledoc false defstruct port: nil, receiver: nil end defmodule Fra...
lib/elixir_mlx90640.ex
0.866754
0.745097
elixir_mlx90640.ex
starcoder
defmodule Akd.Init.Distillery do @moduledoc """ A native Hook module that comes shipped with Akd. This module uses `Akd.Hook`. Provides a set of operations that run distillery's `release.init` task with a given template (optional). These commands are ran on the `build_at` destination of a deployment. E...
lib/akd/base/init/distillery.ex
0.845161
0.54825
distillery.ex
starcoder
defmodule Algoliax do @moduledoc """ Algoliax is wrapper for Algolia api ### Configuration Algoliax needs only `:api_key` and `application_id` config. These configs can either be on config files or using environment varialble `"ALGOLIA_API_KEY"` and `"ALGOLIA_APPLICATION_ID"`. config :algoliax, ...
lib/algoliax.ex
0.873134
0.432003
algoliax.ex
starcoder
defmodule Sanbase.SocialData.TrendingWords do @moduledoc ~s""" Module for fetching the list of trending words This list does NOT calculate the most popular words on crypto social media overall - those would often be the same, redundant words such as ‘Bitcoin’, ‘Ethereum’, ‘crypto’ etc. Instead, our list a...
lib/sanbase/social_data/trending_words.ex
0.869133
0.68296
trending_words.ex
starcoder
defmodule OrdMap do defstruct tuples: nil @moduledoc """ - A set of functions and a macro for working with **ordered maps**. - An **ordered map** is a *struct* with a *list of key-value tuples* where *key* and *value* can be any value. - It can be serialized to JSON with [Poison](https://github.com/devi...
lib/ord_map.ex
0.917728
0.814975
ord_map.ex
starcoder
defmodule Elixium.Mnemonic do alias Elixium.Utilities @leading_zeros_for_mnemonic 8 @leading_zeros_of_mnemonic 11 @regex_chunk_from_entropy Regex.compile!(".{1,#{@leading_zeros_of_mnemonic}}") @regex_chunk_to_entropy Regex.compile!(".{1,#{@leading_zeros_for_mnemonic}}") @moduledoc """ Functionality fo...
lib/encoding/mnemonic.ex
0.774413
0.477615
mnemonic.ex
starcoder
defmodule Jumper do @moduledoc """ Jump consistent hashing for Elixir, without the need of C compilers. This module exposes nothing beyond a simple `slot/2`, used to slot a key into a ange of buckets `[0, buckets)`. This offers a fairly good consistency rate with changing bucket counts, such that: iex...
deps/jumper/lib/jumper.ex
0.915969
0.614336
jumper.ex
starcoder
defmodule AlphaVantage.Cryptocurrencies do @moduledoc """ A set of functions for fetching cryptocurrency data from [Alpha Vantage](www.alphavantage.co/documentation/#digital-currency). """ alias AlphaVantage.Gateway @doc """ Returns the realtime exchange rate for any pair of digital currency (e.g., Bitco...
lib/alpha_vantage/cryptocurrencies.ex
0.89809
0.771241
cryptocurrencies.ex
starcoder
defmodule RealtimeClient do @moduledoc """ Client library to work with [Realtime](https://github.com/supabase/realtime). It's mostly a wrapper around [Phoenix Client](https://github.com/mobileoverlord/phoenix_client). ## Getting started First you have to create a client Socket: options = [ u...
lib/realtime_client.ex
0.78345
0.458712
realtime_client.ex
starcoder
defmodule SpiritFingers.SimHash do @moduledoc """ SimHash Module which delegates to Rust NIFs which will perform the hashing, similarity and distance calculations. """ use Rustler, otp_app: :spirit_fingers, crate: "simhash" @typedoc "unsigned 64 bit integer represenation of simhash" @type t :: pos_intege...
lib/simhash.ex
0.907985
0.565269
simhash.ex
starcoder
use Croma defmodule RaftKV.SplitMergePolicy do defmodule MergeThresholdRatio do use Croma.SubtypeOfFloat, min: 0.0, max: 1.0, default: 0.5 end @moduledoc """ An Elixir struct to specify when to split/merge shards in a keyspace. `:raft_kv` uses the following 3 stats to judge whether splitting/merging sh...
lib/raft_kv/split_merge_policy.ex
0.871844
0.777553
split_merge_policy.ex
starcoder
defmodule SiteGenerator.Helpers do def format_timestamp(time) do # Sites occasionally set cookies with insane expiration times (> 9999-12-31 23:59:59), # which DateTime balks at. In those cases, we forcibly set the time to 9999-12-31 23:59:59. time |> case do timestamp when timestamp > 253402...
lib/site_generator/helpers.ex
0.572125
0.426083
helpers.ex
starcoder
defmodule BitFieldSet do @moduledoc false use Bitwise @type piece_index :: non_neg_integer @type size :: non_neg_integer @type errors :: :out_of_bounds | :bit_field_size_too_small @opaque t :: %__MODULE__{size: size, pieces: non_neg_integer} defstruct size: 0, pieces: 0 @doc """ Create a new bit f...
lib/bit_field_set.ex
0.880277
0.635505
bit_field_set.ex
starcoder
defmodule Membrane.HTTPAdaptiveStream.SinkBin do @moduledoc """ Bin responsible for receiving audio and video streams, performing payloading and CMAF muxing to eventually store them using provided storage configuration. ## Input streams Parsed H264 or AAC video or audio streams are expected to be connected v...
lib/membrane_http_adaptive_stream/sink_bin.ex
0.881047
0.561575
sink_bin.ex
starcoder
defmodule RegimenRunner do @moduledoc """ Runs a regimen """ defmodule Item do @moduledoc false @type t :: %__MODULE__{time_offset: integer, sequence: Farmbot.CeleryScript.Ast.t} defstruct [:time_offset, :sequence] def parse(%{"time_offset" => offset, "sequence" => sequence}) do ...
lib/regimen/regimen_runner.ex
0.762866
0.432243
regimen_runner.ex
starcoder
defmodule UnicodeData do @moduledoc """ Provides access to Unicode properties needed for more complex text processing. ## Script detection Proper text layout requires knowing which script is in use for a run of text. Unicode provides the `Script` property to identify the script associated with a codepoint...
lib/unicodedata.ex
0.93189
0.752035
unicodedata.ex
starcoder
defmodule ArkEcosystem.Crypto.Helpers.MapKeyTransformer do def underscore(map) when is_map(map) do transform_map(map, &Macro.underscore/1) end def camelCase(map) when is_map(map) do transform_map(map, &camelizer/1) end defp transform_map(map, transformer) when is_map(map) do Map.keys(map) |>...
lib/arkecosystem/crypto/helpers/map_key_transformer.ex
0.730963
0.492615
map_key_transformer.ex
starcoder
defmodule Day18 do def part_one(file_reader \\ InputFile, rounds \\ 100, dim \\ 100) do file_reader.contents_of(18, :stream) |> Enum.map(&String.trim/1) |> Enum.map(&String.split(&1, "", trim: true)) |> Enum.with_index() |> Enum.flat_map(fn {row, y} -> row |> Enum.with_index() |>...
year_2015/lib/day_18.ex
0.547222
0.591104
day_18.ex
starcoder
defmodule EWallet.Web.SearchParser do @moduledoc """ This module allows parsing of arbitrary attributes into a search query. It takes in a request's attributes, parses only the attributes needed for searching, then builds those attributes into a search query on top of the given `Ecto.Queryable`. """ import ...
apps/ewallet/lib/ewallet/web/search_parser.ex
0.767167
0.598606
search_parser.ex
starcoder
defmodule CsvGenerator do @moduledoc File.read!("README.md") defmacro __using__(_options) do quote do Module.register_attribute(__MODULE__, :columns, accumulate: true, persist: false) Module.register_attribute(__MODULE__, :delimiter, accumulate: false, persist: false) Module.register_attribut...
lib/csv_generator.ex
0.832815
0.435421
csv_generator.ex
starcoder
defmodule Xgit.Object do @moduledoc ~S""" Describes a single object stored (or about to be stored) in a git repository. This struct is constructed, modified, and shared as a working description of how to find and describe an object before it gets written to a repository. """ use Xgit.ObjectType alias X...
lib/xgit/object.ex
0.892764
0.646655
object.ex
starcoder
defmodule ExUnitGWT do @moduledoc """ Helpers that add Given-When-Then (GWT) syntax to ExUnit ## Examples ``` defmodule ExUnitGWTExample do use ExUnit.Case import ExUnitGWT feature "Serve coffee: in order to earn money customers should be able to buy coffee at all times" do scen...
lib/ex_unit_gwt.ex
0.834441
0.926835
ex_unit_gwt.ex
starcoder
defmodule Workflow.Domain.Account do defstruct [ account_number: nil, balance: 0, state: nil, ] alias Workflow.Domain.Account defmodule Commands do defmodule OpenAccount, do: defstruct [:account_number, :initial_balance] defmodule DepositMoney, do: defstruct [:account_number, ...
test/domain/account/account.ex
0.602296
0.606061
account.ex
starcoder
defmodule Cog.Relay.Tracker do require Logger @moduledoc """ Represents the internal state of `Cog.Relay.Relays` and functions to operate on it. Tracks all the relays that have checked in with the bot, recording which bundles they each serve. Maintains a set of disabled relays. Relays that appear in th...
lib/cog/relay/tracker.ex
0.864982
0.472075
tracker.ex
starcoder
defmodule Playwright.Channel.Catalog do @moduledoc """ Provides storage and management of ChannelOwner instances. `Catalog` implements `GenServer` to maintain state, while domain logic is expected to be handled within caller modules such as `Playwright.Channel`. """ use GenServer import Playwright.Helper...
lib/playwright/channel/catalog.ex
0.914534
0.595669
catalog.ex
starcoder
defmodule RlStudy.MDP.Environment do alias RlStudy.MDP.State alias RlStudy.MDP.Action require Logger @type grid_t :: [[integer]] @type t :: %RlStudy.MDP.Environment{ grid: grid_t(), agent_state: RlStudy.MDP.State.t(), move_probe: float, default_reward: float } ...
lib/mdp/environment.ex
0.76947
0.636847
environment.ex
starcoder
defmodule Hex.Utils do def safe_deserialize_erlang("") do nil end def safe_deserialize_erlang(binary) do case safe_binary_to_term(binary) do {:ok, term} -> term :error -> Mix.raise("Received malformed erlang from Hex API") end rescue ArgumentError -> Mix.raise...
lib/hex/utils.ex
0.606032
0.478833
utils.ex
starcoder
defmodule Ockam.Examples.Messaging.ReliableDeduplication do @moduledoc """ Example of combining reliable delivery with index-ordering deduplication. Such combination allows to get low message loss with high uniqness of messages as long as pipes and channels are available and have no errors """ alias Ockam...
implementations/elixir/ockam/ockam/lib/ockam/examples/messaging/reliable_deduplication.ex
0.815416
0.484197
reliable_deduplication.ex
starcoder
defmodule OMG.EthereumEventListener do @moduledoc """ GenServer running the listener. Periodically fetches events made on dynamically changing block range from the root chain contract and feeds them to a callback. It is **not** responsible for figuring out which ranges of Ethereum blocks are eligible to sc...
apps/omg/lib/omg/ethereum_event_listener.ex
0.862323
0.551453
ethereum_event_listener.ex
starcoder
defmodule AWS.ElastiCache do @moduledoc """ Amazon ElastiCache Amazon ElastiCache is a web service that makes it easier to set up, operate, and scale a distributed cache in the cloud. With ElastiCache, customers get all of the benefits of a high-performance, in-memory cache with less of the administrativ...
lib/aws/generated/elasticache.ex
0.794903
0.521227
elasticache.ex
starcoder
defmodule PuppeteerPdf.Generate do @moduledoc """ Generate a PDF file from multiple available sources. """ @doc """ Generate PDF file given an HTML string input ## Options - `header_template` - HTML template for the print header. - `footer_template` - HTML template for the print footer. - `display_h...
lib/generate.ex
0.899925
0.537102
generate.ex
starcoder
defmodule Soap.Response.Parser do @moduledoc """ Provides a functions for parse an xml-like response body. """ import SweetXml, only: [xpath: 2, sigil_x: 2] @soap_version_namespaces %{ "1.1" => :"http://schemas.xmlsoap.org/soap/envelope/", "1.2" => :"http://www.w3.org/2003/05/soap-envelope" } @d...
lib/soap/response/parser.ex
0.632162
0.423518
parser.ex
starcoder
defmodule Toby.Data.Provider do @moduledoc """ Provides statistics about the running Erlang VM for display in components. Since these lookups can be expensive, access this data via `Toby.Data.Server` instead of calling this module directly. The server module provides a throttled interface to this data to avo...
lib/toby/data/provider.ex
0.811003
0.600657
provider.ex
starcoder
import Kernel, except: [apply: 2] defmodule Ecto.Query.Builder.Join do @moduledoc false alias Ecto.Query.Builder alias Ecto.Query.{JoinExpr, QueryExpr} @doc """ Escapes a join expression (not including the `on` expression). It returns a tuple containing the binds, the on expression (if available) and ...
lib/ecto/query/builder/join.ex
0.850608
0.429788
join.ex
starcoder
defmodule Filterable.Params do @moduledoc ~S""" Allows to fetch `Map` of filterable params. Performs casting/triming/normalization of filter params. """ alias Filterable.Utils @spec filter_value(map | Keyword.t(), Keyword.t()) :: {:ok | :error, any} def filter_value(params, opts \\ []) do with param...
lib/filterable/params.ex
0.811452
0.495911
params.ex
starcoder
defmodule Bodyguard.Plug.Authorize do @behaviour Plug @moduledoc """ Perform authorization in a Plug pipeline. ## Options * `policy` *required* - the policy (or context) module * `action` *required* - the action to authorize, either an atom or a 1-arity function that accepts a conn and returns the ac...
lib/bodyguard/plug/authorize.ex
0.854991
0.438124
authorize.ex
starcoder
defmodule Spacesaving do @type counter :: {%{}, integer} @type countable :: atom | String.t @doc """ Initialize the state ## Examples iex> Spacesaving.init(2) {%{}, 2} """ @spec init(integer) :: counter def init(n) do {%{}, n} end @doc """ Add the item, which ...
lib/spacesaving.ex
0.808748
0.520862
spacesaving.ex
starcoder
defmodule PgMoney.Extension do @moduledoc """ Implements how to encode and decode PostgeSQL's [`money` data type](https://www.postgresql.org/docs/9.5/datatype-money.html). """ @behaviour Postgrex.Extension import PgMoney @impl true @spec init(keyword) :: PgMoney.config() def init(opts) do precisio...
lib/pg_money/extension.ex
0.892869
0.489564
extension.ex
starcoder
defmodule Hornet do @moduledoc """ Hornet is a simple library for stress testing. It executes the given function with the given rate (calls per second) dynamically changing the number of processes to maintain the rate. """ alias Hornet.Scheduler @doc """ Starts an instance of Hornet. ## Paramete...
lib/hornet.ex
0.908889
0.727951
hornet.ex
starcoder
defmodule Rig.Subscription do @moduledoc false @typedoc """ A subscription for a specific event type. The constraints are expected in [conjunctive normal form](https://en.wikipedia.org/wiki/Conjunctive_normal_form) and defined using a list of maps. For example: ```elixir %{ event_type: "com.github...
apps/rig/lib/rig/subscription.ex
0.845751
0.883538
subscription.ex
starcoder
defmodule NaryTree do @moduledoc """ NaryTree implements a data structure for an n-ary tree in which each node has zero or more children. A node in a tree can have arbitrary number of children and depth. Trees are unbalanced and children unordered. """ defstruct root: nil, nodes: %{} alias NaryTree.Node...
lib/nary_tree.ex
0.913194
0.705573
nary_tree.ex
starcoder
defmodule GrovePi.Poller do @moduledoc """ A behaviour module for implementing polling on a pin. The GrovePi.Poller behavior abstracts polling on a pin. Developers are responsible for implementing `c:read_value/2` and a module using the `GrovePi.Trigger` behaviour. ## Example This example shows implem...
lib/grovepi/poller.ex
0.906288
0.724529
poller.ex
starcoder
defmodule Plug.BasicAuth do @moduledoc """ Functionality for providing Basic HTTP authentication. It is recommended to only use this module in production if SSL is enabled and enforced. See `Plug.SSL` for more information. ## High-level usage If you have a single username and password, you can use th...
lib/plug/basic_auth.ex
0.809991
0.445168
basic_auth.ex
starcoder
defmodule Verk.Manager do @moduledoc """ A process that manages the state of each started queue """ use GenServer require Logger alias Verk.WorkersManager @table :verk_manager @ets_options [:ordered_set, :named_table, :public, read_concurrency: true] @doc false def start_link(queues), do: GenServ...
lib/verk/manager.ex
0.738952
0.452899
manager.ex
starcoder
defmodule GenWorker.State do @moduledoc """ Configure worker """ alias GenWorker.{Error, State} @default_run_each [days: 1] @default_run_at [{:microsecond, {1, 0}}] @type run_at_options() :: [ date: Timex.Types.date(), year: Timex.Types.year(), month: Timex.Types.month(), ...
lib/gen_worker/state.ex
0.759582
0.484136
state.ex
starcoder
defmodule Mix.Tasks.Compile.Boundary do # credo:disable-for-this-file Credo.Check.Readability.Specs use Boundary, deps: [Boundary] use Mix.Task.Compiler @moduledoc """ Verifies cross-module function calls according to defined boundaries. This compiler reports all cross-boundary function calls which are n...
lib/mix/tasks/compile/boundary.ex
0.857843
0.741931
boundary.ex
starcoder
defmodule Flickrex.Auth do @moduledoc """ Operations on Flickr Auth. ## Authentication Certain Flickr methods require authorization from a user account. You must present an authorization URL to the user, and obtain a verification code that can be exchanged for access tokens. You can store and re-use the a...
lib/flickrex/auth.ex
0.819893
0.41834
auth.ex
starcoder
defmodule Mongo.InsertOneResult do @moduledoc """ The successful result struct of `Mongo.insert_one/4`. Its fields are: * `:inserted_id` - The id of the inserted document """ @type t :: %__MODULE__{ inserted_id: nil | BSON.ObjectId.t } defstruct [acknowledged: true, inserted_id: nil] end defmodu...
lib/mongo/results.ex
0.842102
0.59843
results.ex
starcoder
defmodule Crux.Structs.Member do @moduledoc """ Represents a Discord [Guild Member Object](https://discordapp.com/developers/docs/resources/guild#guild-member-object-guild-member-structure). Differences opposed to the Discord API Object: - `:user` is just the user id """ @behaviour Crux.Structs ali...
lib/structs/member.ex
0.802788
0.466724
member.ex
starcoder
defmodule Broker.BrokerServer do use GenServer # GenServer state is # {types, triggers, stats} # Types is [string] # Triggers is [{type, source, destination}] # Stats is %{{type,source} -> {enqueue, delivered, dropped}} def start_link(_opts \\ []) do state = {[], [], Map.new()} GenServer.start_l...
broker/lib/broker/brokerserver.ex
0.55435
0.442817
brokerserver.ex
starcoder
defmodule RDF.NS do @moduledoc """ `RDF.Namespace`s for fundamental RDF vocabularies. Namely: - `RDF.NS.RDF` - `RDF.NS.RDFS` - `RDF.NS.OWL` - `RDF.NS.SKOS` - `RDF.NS.XSD` """ use RDF.Vocabulary.Namespace # This is needed to ensure that the Turtle compiler is compiled and ready to be used to pa...
lib/rdf/ns.ex
0.83152
0.486697
ns.ex
starcoder
defmodule Hologram.Compiler.Transformer do alias Hologram.Compiler.{Context, Reflection} alias Hologram.Compiler.{ AccessOperatorTransformer, AdditionOperatorTransformer, AliasDirectiveTransformer, AnonymousFunctionCallTransformer, AnonymousFunctionTypeTransformer, BinaryTypeTransformer, ...
lib/hologram/compiler/transformer.ex
0.695648
0.410018
transformer.ex
starcoder
if Code.ensure_loaded?(Absinthe.Relay) do defmodule Cqrs.Absinthe.Relay do @moduledoc """ Macros for `Absinthe.Relay` ## Optinal Application Configuration config :cqrs_tools, :absinthe_relay, repo: Example.Repo """ require Logger alias Cqrs.Guards alias Cqrs.Absinthe.{Relay, Qu...
lib/cqrs/absinthe/relay.ex
0.823931
0.428891
relay.ex
starcoder
defmodule URL do @moduledoc """ Functions for parsing URLs This module provides functions for parsing URLs. It is modelled on Elixir's `URI` module but will also parse scheme-specific URIs such as [geo](https://tools.ietf.org/rfc/rfc5870), [data](https://tools.ietf.org/html/rfc2397) [tel](https://tools.iet...
lib/url.ex
0.84792
0.659367
url.ex
starcoder
defmodule Jerboa.Client do @moduledoc """ STUN client process Use `start/1` function to spawn new client process: iex> Jerboa.Client.start server: %{address: server_ip, port: server_port} {:ok, #PID<...>} (see `start/1` for configuration options) ## Basic usage ### Requesting server reflexi...
lib/jerboa/client.ex
0.862569
0.497803
client.ex
starcoder
defmodule Exceptional.Normalize do @moduledoc ~S""" Normalize values to a consistent exception struct or plain value. In some ways this can be seen as the opposite of `tagged_tuple`/`ok`. """ defmacro __using__(_) do quote do import unquote(__MODULE__) end end @doc ~S""" Normalizes value...
lib/exceptional/normalize.ex
0.916081
0.528351
normalize.ex
starcoder
defmodule AWS.EMR do @moduledoc """ Amazon EMR is a web service that makes it easier to process large amounts of data efficiently. Amazon EMR uses Hadoop processing combined with several AWS services to do tasks such as web indexing, data mining, log file analysis, machine learning, scientific simulation,...
lib/aws/generated/emr.ex
0.876397
0.523664
emr.ex
starcoder
defmodule Sanbase.Cryptocompare.Jobs do alias Sanbase.Model.Project # Execute the function until the moved rows are 0 or up to 100 iterations. # The iterations are needed to avoid an infinite loop. If there is a task that # finishes one job every second we risk to always return 1 row and never finish # the j...
lib/sanbase/cryptocompare/jobs.ex
0.685423
0.426919
jobs.ex
starcoder
defmodule BSV.TxBuilder do @moduledoc """ A flexible and powerful transaction building module and API. The TxBuilder accepts inputs and outputs that are modules implementing the `BSV.Contract` behaviour. This abstraction makes for a succinct and elegant approach to building transactions. The `BSV.Contract` b...
lib/bsv/tx_builder.ex
0.922036
0.561215
tx_builder.ex
starcoder
defmodule ExDiceRoller.Parser do @moduledoc """ Functionality for parsing `t:ExDiceRoller.Tokenizer.tokens/0`. iex> {:ok, tokens} = ExDiceRoller.Tokenizer.tokenize("2d3+9-(ydz)d(31+x)/(3d8+2)") {:ok, [ {:int, 1, '2'}, {:roll, 1, 'd'}, {:int, 1, '3'}, {:basic_operat...
lib/parser.ex
0.781414
0.442155
parser.ex
starcoder
defmodule Resx.Resource.Content do @moduledoc """ The content of a resource. %Resx.Resource.Content{ type: ["text/html]", data: "<p>Hello</p>" } """ alias Resx.Resource.Content @enforce_keys [:type, :data] defstruct [:type, :data] @type acc :: E...
lib/resx/resource/content.ex
0.894438
0.435181
content.ex
starcoder
defmodule AWS.ACMPCA do @moduledoc """ <note> <p/> </note> This is the *ACM Private CA API Reference*. It provides descriptions, syntax, and usage examples for each of the actions and data types involved in creating and managing private certificate authorities (CA) for your organization. The documentation...
lib/aws/generated/acmpca.ex
0.826046
0.717723
acmpca.ex
starcoder
defmodule FireAct do @moduledoc """ Inspired by Plug, a helper module for defining action handlers with optional params validations via Ecto.Changeset. Perfect for extracting logic outside the controller endpoints. Example usage: ``` defmodule RegisterUser do use FireAct.Handler use FireAct.Ch...
lib/fire_act.ex
0.705481
0.518912
fire_act.ex
starcoder