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 Exhort do @moduledoc ~S""" Exhort is an idomatic Elixir interface to the [Google OR Tools](https://developers.google.com/optimization/). Exhort is currently focused on the "SAT" portion of the tooling: > A constraint programming solver that uses SAT (satisfiability) methods. The primary API for...
lib/Exhort.ex
0.899038
0.972257
Exhort.ex
starcoder
defmodule ReactSurface.SSR do @moduledoc """ Macro to transform a module into a server rendered react component with some default props. ```elixir defmodule ReactComponent do use ReactSurface.SSR, [default_props: %{name: "Doug"}] end ``` This assumes there is a react component that is the default exp...
lib/react_surface/ssr.ex
0.879923
0.732592
ssr.ex
starcoder
defmodule IBMSpeechToText.Response do @moduledoc """ Elixir representation of response body from the Speech to Text API. Described [here](https://cloud.ibm.com/apidocs/speech-to-text#recognize-audio) in "Response" part """ alias IBMSpeechToText.{RecognitionResult, SpeakerLabelsResult} @type t() :: %__MODU...
lib/ibm_speech_to_text/response.ex
0.857455
0.4474
response.ex
starcoder
defmodule Luger.Message do @moduledoc """ This module contains functions to create an format log messages using Luger. This is separated out as it makes testing your logging easier as you can use the `split/1` function to convert your log into a struct. """ defstruct [ :method, :path, :status, ...
lib/luger/message.ex
0.766031
0.469763
message.ex
starcoder
defmodule Saucexages do @moduledoc """ Saucexages is a library that provides functionality for reading, writing, interrogating, and fixing [SAUCE](http://www.acid.org/info/sauce/sauce.htm) – Standard Architecture for Universal Comment Extensions. The primary use of SAUCE is to add or augment metadata for files....
lib/saucexages.ex
0.930514
0.927034
saucexages.ex
starcoder
defmodule PatternMetonyms do @moduledoc """ Documentation for `PatternMetonyms`. """ @doc """ implicit bidirectional target : pattern just2(a, b) = just({a, b}) currently work as is for that kind of complexity unidirectional target : pattern head(x) <- [x | _] but doesn't work as is "pattern(hea...
pattern_metonyms/lib/pattern_metonyms.ex
0.64512
0.431285
pattern_metonyms.ex
starcoder
defmodule Pigeon.FCM do @moduledoc """ `Pigeon.Adapter` for Firebase Cloud Messaging (FCM) push notifications. ## Getting Started 1. Create a `FCM` dispatcher. ``` # lib/fcm.ex defmodule YourApp.FCM do use Pigeon.Dispatcher, otp_app: :your_app end ``` 2. (Optional) Add configuration to your ...
lib/pigeon/fcm.ex
0.783285
0.609408
fcm.ex
starcoder
defmodule AWS.SMS do @moduledoc """ AAWS Sever Migration Service This is the *AWS Sever Migration Service API Reference*. It provides descriptions, syntax, and usage examples for each of the actions and data types for the AWS Sever Migration Service (AWS SMS). The topic for each action shows the Query API...
lib/aws/sms.ex
0.833426
0.585457
sms.ex
starcoder
defmodule Ecto.Query.Builder do @moduledoc false alias Ecto.Query @expand_fragments [:sigil_f, :sigil_F] @expand_sigils [:sigil_c, :sigil_C, :sigil_s, :sigil_S, :sigil_w, :sigil_W] @doc """ Smart escapes a query expression and extracts interpolated values in a map. Everything that is a query express...
lib/ecto/query/builder.ex
0.683102
0.551815
builder.ex
starcoder
defmodule WHATWG.PercentEncoding do @moduledoc """ Functions to work with percent-encoding. """ @doc """ Percent-encodes a byte in integer into a string. This function will raise `FunctionClauseError` if the given `char` is not an integer for a byte. See also: - [Percent-Encoding in RFC 3986 - Unifo...
lib/whatwg/percent_encoding.ex
0.839142
0.568416
percent_encoding.ex
starcoder
defmodule Individual do @moduledoc """ Process adapter to handle singleton processes in Elixir applications. ### The problem Sometimes, when yo start your program on cluster with *MASTER<->MASTER* strategy, some of your modules should be started only on one nod at a time. The should be registered within `...
lib/individual.ex
0.731346
0.418459
individual.ex
starcoder
defmodule Cachex.Services.Locksmith do @moduledoc """ Locking service in charge of table transactions. This module acts as a global lock table against all cache. This is due to the fact that ETS tables are fairly expensive to construct if they're only going to store a few keys. Due to this we have a singl...
lib/cachex/services/locksmith.ex
0.671578
0.653569
locksmith.ex
starcoder
defmodule Asteroid.ObjectStore.AuthenticatedSession.Mnesia do @moduledoc """ Mnesia implementation of the `Asteroid.ObjectStore.AuthenticatedSession` behaviour ## Options The options (`Asteroid.ObjectStore.AuthenticatedSession.opts()`) are: - `:table_name`: an `atom()` for the table name. Defaults to `:aster...
lib/asteroid/object_store/authenticated_session/mnesia.ex
0.913474
0.831622
mnesia.ex
starcoder
defmodule AdventOfCode.Solutions.Day01 do @moduledoc """ Solution for day 1 exercise. ### Exercise As the submarine drops below the surface of the ocean, it automatically performs a sonar sweep of the nearby sea floor. On a small screen, the sonar sweep report (your puzzle input) appears: each line is a m...
lib/advent_of_code/solutions/day01.ex
0.85738
0.891622
day01.ex
starcoder
defmodule AshPolicyAuthorizer.FilterCheck do @moduledoc """ A type of check that is represented by a filter statement That filter statement can be templated, currently only supporting `{:_actor, field}` which will replace that portion of the filter with the appropriate field value from the actor and `{:_acto...
lib/ash_policy_authorizer/filter_check.ex
0.831588
0.481515
filter_check.ex
starcoder
defmodule Geometry.MultiLineStringM do @moduledoc """ A set of line-strings from type `Geometry.LineStringM` `MultiLineStringMZ` implements the protocols `Enumerable` and `Collectable`. ## Examples iex> Enum.map( ...> MultiLineStringM.new([ ...> LineStringM.new([ ...> Poin...
lib/geometry/multi_line_string_m.ex
0.929983
0.498352
multi_line_string_m.ex
starcoder
defmodule Zaryn.Governance.Code.CICD do @moduledoc ~S""" Provides CICD pipeline for `Zaryn.Governance.Code.Proposal` The evolution of zaryn-node could be represented using following stages: * Init - when source code is compiled into zaryn-node (not covered here) * CI - zaryn-node is verifying a prop...
lib/zaryn/governance/code/CICD.ex
0.73431
0.6622
CICD.ex
starcoder
defmodule Nebulex.RPC do @moduledoc """ RPC utilities for distributed task execution. This module uses supervised tasks underneath `Task.Supervisor`. > **NOTE:** The approach by using distributed tasks will be deprecated in the future in favor of `:erpc`. """ @typedoc "Task supervisor" @type task_s...
lib/nebulex/rpc.ex
0.857365
0.492127
rpc.ex
starcoder
defmodule ExLimiter.Plug do @moduledoc """ Plug for enforcing rate limits. The usage should be something like ``` plug ExLimiter.Plug, scale: 1000, limit: 5 ``` Additionally, you can pass the following options: - `:bucket`, a 1-arity function of a `Plug.Conn.t` which determines the bucket for the ...
lib/ex_limiter/plug.ex
0.880938
0.921428
plug.ex
starcoder
defmodule Harald.HCI.InformationalParameters do @moduledoc """ > The Informational Parameters are fixed by the > manufacturer of the Bluetooth hardware. > These parameters provide information about the BR/EDR > Controller and the capabilities of the Link Manager and > Baseband in the BR/EDR Controller and P...
lib/harald/hci/informational_parameters.ex
0.701406
0.74934
informational_parameters.ex
starcoder
defmodule HLDSLogs do @moduledoc """ A library for connecting to Half-Life Dedicated Servers (a.k.a "HLDS") and using GenStage to produce structured log entries sent from the connected HLDS server. Uses a `DynamicSupervisor` for creating producers. If you want to manage the producer supervision yourself you ca...
lib/hlds_logs.ex
0.783823
0.712507
hlds_logs.ex
starcoder
defmodule WxStatusBar do import WxUtilities import WinInfo require Logger @moduledoc """ A status bar is a narrow window that can be placed along the bottom of a frame to show small amounts of status information. A status bar can contain one or more fields, one or more of which can be variable length ...
lib/ElixirWx/WxStatusBar.ex
0.629888
0.44065
WxStatusBar.ex
starcoder
defmodule Ello.Auth.JWT do @moduledoc """ Responsible for generating and verifying JWTs. """ @issuer "Ello, PBC" @doc """ Verifies an Ello JWT is correctly signed and has appropriate data. Checks `exp` and `iss` claims. Does not require user info. Returns {:ok, payload} or {:error, reason} """ @...
apps/ello_auth/lib/ello_auth/jwt.ex
0.853364
0.466906
jwt.ex
starcoder
defmodule Mix.Tasks.Potato.Full do @moduledoc """ Prepare a full release. ## Command line options None ## Notes This task produces a full tar file from a previously run release task, but adds a shell script, `preboot.sh` to the releases folder. The task itself expects that `mix release` has already b...
lib/mix/tasks/potato/full.ex
0.696371
0.62405
full.ex
starcoder
defmodule Crux.Structs.BitField do @moduledoc """ Custom non discord api behaviour to help with bitfields of all kind. """ @moduledoc since: "0.2.3" @typedoc """ The name of a bit flag. """ @typedoc since: "0.2.3" @type name :: atom() @doc """ Get a map of `t:name/0`s and their corresponding bit...
lib/structs/bit_field.ex
0.878829
0.447762
bit_field.ex
starcoder
defmodule Ecto.OLAP.GroupingSets do @moduledoc """ Helpers for advenced grouping functions in SQL. **WARNING**: Currently only PostgreSQL is supported # Example data All examples assumes we have table `grouping` with content: | foo | bar | baz | | --- | --- | --- | | a | 1 | c | | a | 1 ...
lib/grouping_sets.ex
0.917159
0.615203
grouping_sets.ex
starcoder
defmodule Toml.Decoder do @moduledoc false alias Toml.Document alias Toml.Builder alias Toml.Lexer @compile :inline_list_funs @compile inline: [ pop_skip: 2, peek_skip: 2, iodata_to_str: 1, iodata_to_integer: 1, iodata_to_float: 1 ...
lib/decoder.ex
0.868785
0.504516
decoder.ex
starcoder
defmodule StateMachine.Transition do @moduledoc """ Transition module gathers together all of the actions that happen around transition from the old state to the new state in response to an event. """ alias StateMachine.{Transition, Event, State, Context, Callback, Guard} @type t(model) :: %__MODULE__{ ...
lib/state_machine/transition.ex
0.852568
0.461441
transition.ex
starcoder
defmodule Bacen.CCS.ACCS004 do @moduledoc """ The ACCS004 message. This message reports the actual persons registered on Bacen's system for given CNPJ company. It has the following XML example: ```xml <CCSArqPosCad> <Repet_ACCS004_Congl> <CNPJBasePart>12345678</CNPJBasePart> </Repet_ACCS0...
lib/bacen/ccs/accs004.ex
0.784855
0.63358
accs004.ex
starcoder
defmodule Soundcloud.HashConversions do import Soundcloud.Utils, only: [list_of_maps_to_map: 1, list_of_maps_to_map: 2] @doc """ Returns a map with every key-value pair in `map` mapped with `normalize_param`. ## Examples iex> Soundcloud.HashConversions.to_params(%{"foo" => %{"bar" => %{"a" => 5}, "tar"...
lib/soundcloud/hash_conversions.ex
0.843219
0.517205
hash_conversions.ex
starcoder
defmodule Grizzly.FirmwareUpdates do @moduledoc """ Module for upgrading firmware on target devices. Required options: * `manufacturer_id` - The unique id indentifying the manufacturer of the target device * `firmware_id` - The id of the current firmware Other options: * `device_id` - Node id of the d...
lib/grizzly/firmware_updates.ex
0.808861
0.448909
firmware_updates.ex
starcoder
defmodule Collision.Vector do @moduledoc """ Wrapper around vector creation functions. """ @type vector_tuple :: {float, float} | {float, float, float} @type vector :: Collision.Vector.Vector2.t | Collision.Vector.Vector3 @spec from_tuple(vector_tuple) :: vector def from_tuple({_x, _y} = t), do: Collisio...
lib/collision/vector.ex
0.947998
0.968171
vector.ex
starcoder
defmodule Tesla.StatsD do @moduledoc """ This middleware sends histogram stats to Datadog for every outgoing request. The sent value is response time in milliseconds. Metric name is configurable and defaults to "http.request". The middleware also sends tags: * `http_status` - HTTP status code. * `ht...
lib/tesla_statsd.ex
0.888008
0.519887
tesla_statsd.ex
starcoder
defmodule Zstream do @moduledoc """ Module for creating ZIP file stream ## Example ``` Zstream.zip([ Zstream.entry("report.csv", Stream.map(records, &CSV.dump/1)), Zstream.entry("catfilm.mp4", File.stream!("/catfilm.mp4"), coder: Zstream.Coder.Stored) ]) |> Stream.into(File.stream!("/archive.zip...
lib/zstream.ex
0.799677
0.727104
zstream.ex
starcoder
defmodule Legion.RegistryDirectory do @moduledoc """ Provides metaprogramming tools to register singleton directories. ### Motivation Global settings directories can be used to gather runtime configuration. One can create a configuration to change the behavior of some modules, or enable/disable it throu...
apps/legion/lib/registry_directory/registry_directory.ex
0.869535
0.768342
registry_directory.ex
starcoder
defmodule AWS.SageMaker do @moduledoc """ Provides APIs for creating and managing Amazon SageMaker resources. Other Resources: * [Amazon SageMaker Developer Guide](https://docs.aws.amazon.com/sagemaker/latest/dg/whatis.html#first-time-user) * [Amazon Augmented AI Runtime API Reference](https://docs.aw...
lib/aws/generated/sage_maker.ex
0.885347
0.652241
sage_maker.ex
starcoder
defmodule Support.Generators do import ExUnitProperties import StreamData alias Hoplon.Data require Hoplon.Data require Record def input_package() do gen all ecosystem <- frequency([{5, proper_string()}, {1, constant(:asn1_DEFAULT)}]), name <- proper_string(), version <- proper...
test/support/generators.ex
0.522446
0.456713
generators.ex
starcoder
defmodule Bargad.LogClient do @moduledoc """ Client APIs for `Bargad.Log`. This module is automatically started on application start. The request in each API has to be of the form `t:request/0`. Look into the corresponding handler of each request for the exact arguments to be supplied. """ us...
lib/bargad_log_client.ex
0.852844
0.415373
bargad_log_client.ex
starcoder
defmodule AutoApi.Capability do @moduledoc """ Capability behaviour """ alias AutoApi.{CapabilityHelper, UniversalProperties} defmacro __using__(spec_file: spec_file) do spec_path = Path.join(["specs", "capabilities", spec_file]) raw_spec = Jason.decode!(File.read!(spec_path)) universal_propert...
lib/auto_api/capability.ex
0.871816
0.655253
capability.ex
starcoder
defmodule Plot.Subscriber do use GenServer, restart: :temporary require Decimal import Gnuplot require Logger alias Decimal, as: D D.Context.set(%D.Context{D.Context.get() | precision: 9}) defmodule State do defstruct symbol: None, trades: Deque.new(1_000_000), ma_short: ...
apps/plot/lib/plot/subscriber.ex
0.579757
0.530845
subscriber.ex
starcoder
defmodule Cpfcnpj do @moduledoc """ Módulo responsável por realizar todos os cálculos de validação. ## Examples iex>Cpfcnpj.valid?({:cnpj,"69.103.604/0001-60"}) true iex>Cpfcnpj.valid?({:cpf,"111.444.777-35"}) true Com ou sem os caracteres especiais os mesmos serão validados """ @...
lib/cpfcnpj.ex
0.708213
0.441974
cpfcnpj.ex
starcoder
defmodule TypedEctoSchema do @moduledoc """ TypedEctoSchema provides a DSL on top of `Ecto.Schema` to define schemas with typespecs without all the boilerplate code. ## Rationale Normally, when defining an `Ecto.Schema` you probably want to define: * the schema itself * the list of enforced keys (wh...
lib/typed_ecto_schema.ex
0.886445
0.835886
typed_ecto_schema.ex
starcoder
defmodule Numerix.Optimization do @moduledoc """ Optimization algorithms to select the best element from a set of possible solutions. """ @default_opts [population_size: 50, mutation_prob: 0.2, elite_fraction: 0.2, iterations: 100] @doc """ Genetic algorithm to find the solution with the lowest cost where...
lib/optimization.ex
0.927536
0.746278
optimization.ex
starcoder
defmodule Storage.Wallet.Eth do @moduledoc ~S""" NOTE: defmodule Storage.Repo.Migrations.WalletEth do use Ecto.Migration def change do create table(:eth) do add(:address, :eth) add(:privatekey, :eth) add(:publickey, :eth) end create(unique_index(:eth, [:address]...
src/apps/storage/lib/storage/wallet/eth.ex
0.771628
0.692746
eth.ex
starcoder
defmodule Pavlov.Matchers do @moduledoc """ Provides several matcher functions. Matchers accept up to two values, `actual` and `expected`, and return a Boolean. Using "Expects" syntax, all matchers have positive and negative forms. For a matcher `eq`, there is a positive `to_eq` and a negative `not_to_eq...
lib/matchers.ex
0.825976
0.706532
matchers.ex
starcoder
defmodule Dicon.SecureShell do @moduledoc """ A `Dicon.Executor` based on SSH. ## Configuration The configuration for this executor must be specified under the configuration for the `:dicon` application: config :dicon, Dicon.SecureShell, dir: "..." The available configuration options for t...
lib/dicon/secure_shell.ex
0.764232
0.405037
secure_shell.ex
starcoder
defmodule Zxcvbn.TimeEstimates do @moduledoc false @delta 5 @second 1 @minute 60 @hour 3600 @day 86_400 @month 2_678_400 @year 31_536_000 @century 3_153_600_000 def estimate_attack_times(guesses) do crack_times_seconds = %{ online_throttling_100_per_hour: guesses / 100 / 3600, onli...
lib/zxcvbn/time_estimates.ex
0.655997
0.402245
time_estimates.ex
starcoder
defmodule Hangman.Dictionary.Cache do @moduledoc """ Module implements a GenServer process providing access to a dictionary word cache. Handles lookup routines to access `words`, `tallys`, and `random` words. Serves as a wrapper around dictinary specific implementation """ use GenServer alias Hangma...
lib/hangman/dictionary_cache.ex
0.861727
0.482063
dictionary_cache.ex
starcoder
defmodule Geo.JSON.Encoder do @moduledoc false alias Geo.{ Point, PointZ, LineString, LineStringZ, Polygon, PolygonZ, MultiPoint, MultiPointZ, MultiLineString, MultiLineStringZ, MultiPolygon, MultiPolygonZ, GeometryCollection } defmodule EncodeError do @...
lib/geo/json/encoder.ex
0.828523
0.69272
encoder.ex
starcoder
defmodule TrainLoc.Vehicles.Vehicle do @moduledoc """ Functions for working with individual vehicles. """ alias TrainLoc.Utilities.Time, as: TrainLocTime alias TrainLoc.Vehicles.Vehicle require Logger @enforce_keys [:vehicle_id] defstruct [ :vehicle_id, timestamp: DateTime.from_naive!(~N[1970...
apps/train_loc/lib/train_loc/vehicles/vehicle.ex
0.878868
0.765111
vehicle.ex
starcoder
defmodule Ptolemy.Engines.PKI do @moduledoc """ `Ptolemy.Engines.PKI` provides a public facing API for CRUD operations for the Vault PKI engine. Some function in this modules have additional options that can be provided to vault, you can get the option values from: https://www.vaultproject.io/api/secret/pki/in...
lib/engines/pki/pki.ex
0.873795
0.642348
pki.ex
starcoder
defmodule Chunkr.Pagination do @moduledoc """ Pagination functions. This module provides the high-level pagination logic. Under the hood, it delegates to whatever "planner" module is configured in the call to `use Chunkr, planner: YourApp.PaginationPlanner`. Note that you'll generally want to call the `pagi...
lib/chunkr/pagination.ex
0.863089
0.736377
pagination.ex
starcoder
defprotocol Realm.Functor do @moduledoc ~S""" Functors are datatypes that allow the application of functions to their interior values. Always returns data in the same structure (same size, tree layout, and so on). Please note that bitstrings are not functors, as they fail the functor composition constraint. T...
lib/realm/functor.ex
0.829285
0.668578
functor.ex
starcoder
defmodule Geocoder.Providers.OpenStreetMaps do use HTTPoison.Base use Towel @endpoint "https://nominatim.openstreetmap.org/" @endpath_reverse "/reverse" @endpath_search "/search" @defaults [format: "json", "accept-language": "en", addressdetails: 1] def geocode(opts) do request(@endpath_search, extr...
lib/geocoder/providers/open_street_maps.ex
0.623721
0.499451
open_street_maps.ex
starcoder
defmodule Scenic.Scrollable.PositionCap do alias __MODULE__ @moduledoc """ Module for applying limits to a position. """ @typedoc """ A vector 2 in the form of {x, y} """ @type v2 :: Scenic.Scrollable.v2() @typedoc """ Data structure representing a minimum, or maximum cap which values will be com...
lib/utility/position_cap.ex
0.86148
0.748651
position_cap.ex
starcoder
defmodule Neuron do @moduledoc""" Neurons have the format {{:neuron, .37374628}, {weights}} """ defstruct cortex_id: nil, cortex_pid: nil, id: nil, pid: nil, af: :tanh, input_neurons: [], output_neurons: [], output_pids: nil, index: nil, weights: nil @doc""" Creates neurons corresponding to the size of nn...
lib/neuron.ex
0.810179
0.790328
neuron.ex
starcoder
defmodule GrovePi.Digital do alias GrovePi.Board @moduledoc """ Write to and read digital I/O on the GrovePi. This module provides a low level API to digital sensors. Example usage: ``` iex> pin = 3 iex> GrovePi.Digital.set_pin_mode(pin, :input) :ok iex> GrovePi.Digital.read(pin, 0) 1 iex> Gr...
lib/grovepi/digital.ex
0.805938
0.840128
digital.ex
starcoder
defmodule Omise.Json do alias Omise.Json.{Decoder, Encoder} defdelegate encode(input), to: Encoder defdelegate decode(input, opts \\ []), to: Decoder end defmodule Omise.Json.Encoder do def encode(input) do input |> transform_data() |> Jason.encode() |> case do {:ok, output} -> {...
lib/omise/json.ex
0.705481
0.467149
json.ex
starcoder
defmodule Absinthe.Plug.GraphiQL do @moduledoc """ Enables GraphiQL # Usage ```elixir if Absinthe.Plug.GraphiQL.serve? do plug Absinthe.Plug.GraphiQL end ``` """ require EEx @graphiql_version "0.7.8" EEx.function_from_file :defp, :graphiql_html, Path.join(__DIR__, "graphiql.html.eex"), ...
lib/absinthe/plug/graphiql.ex
0.673836
0.487307
graphiql.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...
deps/postgrex/lib/postgrex/builtins.ex
0.904387
0.596051
builtins.ex
starcoder
defmodule EctoShorts.CommonFilters do @moduledoc """ This modules main purpose is to house a collection of common schema filters and functionality to be included in params -> filters Common filters available include - `preload` - Preloads fields onto the query results - `start_date` - Query for items inse...
lib/common_filters.ex
0.829803
0.785597
common_filters.ex
starcoder
defmodule Xgit.Tree do @moduledoc ~S""" Represents a git `tree` object in memory. """ alias Xgit.ContentSource alias Xgit.FileMode alias Xgit.FilePath alias Xgit.Object alias Xgit.ObjectId import Xgit.Util.ForceCoverage @typedoc ~S""" This struct describes a single `tree` object so it can be man...
lib/xgit/tree.ex
0.90091
0.505554
tree.ex
starcoder
defmodule ExMath do @spec id(a) :: a when a: any def id(x), do: x @spec sign(number) :: -1 | 0 | 1 def sign(0), do: 0 def sign(x) when x < 0, do: -1 def sign(_), do: 1 @spec sum([number]) :: number def sum([]), do: 0 def sum(xs), do: Enum.reduce(xs, &Kernel.+/2) @spec factors(pos_integer) :: [pos...
lib/exmath.ex
0.737158
0.672053
exmath.ex
starcoder
defmodule MelodyMatch.Matches do @moduledoc """ The Matches context. """ import Ecto.Query, warn: false alias MelodyMatch.Repo alias MelodyMatch.Matches.Match @doc """ Returns the list of matches. ## Examples iex> list_matches() [%Match{}, ...] """ def list_matches do Repo.al...
server/lib/melody_match/matches.ex
0.831725
0.434821
matches.ex
starcoder
if Appsignal.phoenix?() do defmodule Appsignal.Phoenix.Instrumenter do @moduledoc """ Phoenix instrumentation hooks This module can be used as a Phoenix instrumentation module. Adding this module to the list of Phoenix instrumenters will result in the `phoenix_controller_call` and `phoenix_contro...
lib/appsignal/phoenix/instrumenter.ex
0.818193
0.778355
instrumenter.ex
starcoder
defmodule GeoTIFFFormatter do @doc ~S""" Formats a single IFD. ### Examples: iex> tag = %{:tag => "Spam", :type => "EGGS", :value => 42, :count => 1} iex> ifd = %{:offset => 42, :entries => 42, :next_ifd => 0, :tags => [tag]} iex> headers = %{:filename => 'spam', :endianess => :little, :first_ifd_of...
lib/geotiff_formatter.ex
0.519034
0.433082
geotiff_formatter.ex
starcoder
defmodule NetworkUtils do @moduledoc """ A bunch o' little titbits of code that may (or may not) make the elevator lab slightly more survivable To test software on multiple computers, use safe shell to access another user on network: 1. get all possible computers: "$ nmap -sP 10.100.23.*" 2. Connect to co...
lib/network_utils.ex
0.68595
0.478468
network_utils.ex
starcoder
defmodule Yacht do @type category :: :ones | :twos | :threes | :fours | :fives | :sixes | :full_house | :four_of_a_kind | :little_straight | :big_straight | :choice | :yacht defp die_frequencies(...
exercises/practice/yacht/.meta/example.ex
0.709019
0.458591
example.ex
starcoder
defmodule Optimus.PropertyParsers do def build_parser(_name, :integer) do {:ok, &integer_parser/1} end def build_parser(name, "integer"), do: build_parser(name, :integer) def build_parser(name, ":integer"), do: build_parser(name, :integer) def build_parser(_name, :float) do {:ok, &float_parser/1} ...
lib/optimus/property_parsers.ex
0.584864
0.522689
property_parsers.ex
starcoder
defmodule Gradient.ElixirChecker do @moduledoc ~s""" Provide checks specific to Elixir that complement type checking delivered by Gradient. Options: - {`ex_check`, boolean()}: whether to use checks specific only to Elixir. """ @spec check([:erl_parse.abstract_form()], keyword()) :: [{:file.filename(), any...
lib/gradient/elixir_checker.ex
0.829492
0.86988
elixir_checker.ex
starcoder
defmodule D03.Challenge do @moduledoc false require Logger def run(1) do columns = Utils.read_input(3, &String.codepoints/1) |> transpose column_length = length(Enum.at(columns, 0)) result = columns |> Enum.map(fn column -> find_gamma_and_epsilon_bit(column, column_length /...
lib/d03/challenge.ex
0.737536
0.459986
challenge.ex
starcoder
defmodule ExQuickBooks do @moduledoc """ API client for QuickBooks Online. ## Configuration You can configure the application through `Mix.Config`: ``` config :exquickbooks, consumer_key: "key", consumer_secret: "secret", use_production_api: true ``` ### Accepted configuration keys ##...
lib/exquickbooks.ex
0.806815
0.740808
exquickbooks.ex
starcoder
defmodule Cldr.Date do @moduledoc """ Provides localization and formatting of a `Date` struct or any map with the keys `:year`, `:month`, `:day` and `:calendar`. `Cldr.Date` provides support for the built-in calendar `Calendar.ISO` or any calendars defined with [ex_cldr_calendars](https://hex.pm/packages...
lib/cldr/date.ex
0.926703
0.704268
date.ex
starcoder
defmodule RandomColor do @moduledoc "README.md" |> File.read!() |> String.split("<!-- MDOC !-->") |> Enum.fetch!(1) alias RandomColor.Color ## Dictionary @color_dictionary [ monochrome: Color.monochrome(), red: Color.red(), orange: Color.orange(), yellow...
lib/random_color.ex
0.878679
0.537891
random_color.ex
starcoder
defmodule GoodTimes.Generate do @vsn GoodTimes.version @moduledoc """ Generate streams of datetimes. Generate a stream of datetimes, starting with the input datetime and stepping forward or backward by some time unit. All functions operate on an Erlang datetime, and returns a `Stream` of datetime elements...
lib/good_times/generate.ex
0.941601
0.742958
generate.ex
starcoder
defmodule Trans do @moduledoc ~S""" `Trans` provides a way to manage and query translations embedded into schemas and removes the necessity of maintaining extra tables only for translation storage. ## What does this package do? `Trans` allows you to store translations for a struct embedded into a field of...
lib/trans.ex
0.876859
0.677037
trans.ex
starcoder
defmodule Membrane.H264.FFmpeg.Decoder do @moduledoc """ Membrane element that decodes video in H264 format. It is backed by decoder from FFmpeg. The element expects the data for each frame (Access Unit) to be received in a separate buffer, so the parser (`Membrane.H264.FFmpeg.Parser`) may be required in a pip...
lib/membrane_h264_ffmpeg/decoder.ex
0.852736
0.440048
decoder.ex
starcoder
defmodule Kafka.Topic do @moduledoc """ Defines a Kafka topic. Kafka topics are used as message buses in Hindsight, allowing data to be passed from one service to another without directly coupling those services. ## Configuration * `name` - Required. Topic name. * `endpoints` - Required. Keyword list of...
apps/definition_kafka/lib/kafka/topic.ex
0.822937
0.553626
topic.ex
starcoder
defmodule SmartCity.Registry.Dataset do @moduledoc """ Struct defining a dataset definition and functions for reading and writing dataset definitions to Redis. ```javascript const Dataset = { "id": "", // UUID "business": { // Project Open Data Metadata Schema v1.1 "...
lib/smart_city/registry/dataset.ex
0.832747
0.705481
dataset.ex
starcoder
defmodule KVX.Bucket.ExShards do @moduledoc """ ExShards adapter. This is the default adapter supported by `KVX`. ExShards adapter only works with `set` and `ordered_set` table types. ExShards extra config options: * `:module` - internal ExShards module to use. By default, `ExShards` module is used...
lib/kvx/adapters/ex_shards/bucket_shards.ex
0.835265
0.481027
bucket_shards.ex
starcoder
defmodule ExOrient.DB do @moduledoc """ MarcoPolo ExOrientDB wrapper that provides a clean syntax for queries. This module simply routes SQL commands to the correct submodule, providing the ability to call all commands through ExOrient.DB.<command> """ alias ExOrient.DB.CRUD, as: CRUD alias ExOrient.DB.G...
lib/ex_orient/db.ex
0.739986
0.420272
db.ex
starcoder
defmodule OddJob.Scheduler do @moduledoc """ The `OddJob.Scheduler` is responsible for execution of scheduled jobs. Each scheduler is a dynamically supervised process that is created to manage a single timer and a job or collection of jobs to send to a pool when the timer expires. After the jobs are delivere...
lib/odd_job/scheduler.ex
0.817356
0.506103
scheduler.ex
starcoder
defmodule Numbers do @moduledoc """ Allows you to use arithmetical operations on _any_ type that implements the proper protocols. For each arithmetical operation, a different protocol is used so that types for which only a subset of these operations makes sense can still work with those. ## Basic Usage ...
lib/numbers.ex
0.898586
0.648369
numbers.ex
starcoder
defmodule Opus.Graph do @available_filetypes [:svg, :png, :pdf] @defaults %{ filetype: :png, docs_base_url: "", theme: %{ penwidth: 2, stage_shape: "box", colors: %{ border: %{ pipeline: "#222222", conditional: "#F9E79F", normal: "#222222" ...
lib/opus/graph.ex
0.71123
0.752513
graph.ex
starcoder
defmodule NiceMaps do @moduledoc """ NiceMaps provides a single function `parse` to convert maps into the desired format. It can build camelcase/snake_case keys, convert string keys to atom keys and vice versa, or convert structs to maps """ @doc """ The main interface - this is where the magic happens....
lib/nice_maps.ex
0.817429
0.585397
nice_maps.ex
starcoder
defmodule XDR.String do @moduledoc """ This module manages the `String` type based on the RFC4506 XDR Standard. """ @behaviour XDR.Declaration alias XDR.VariableOpaque alias XDR.Error.String, as: StringError defstruct [:string, :max_length] @typedoc """ `XDR.String` structure type specification. ...
lib/xdr/string.ex
0.923996
0.511168
string.ex
starcoder
defmodule Gate do @moduledoc """ Write description """ alias Gate.Validator alias Gate.Locale defstruct params: %{}, schema: %{}, errors: %{}, output: %{} def valid?(params, schema) when is_map(schema) do %Gate{params: params, schema: schema} |> validate() end def valid?(attribute, schema), d...
lib/gate.ex
0.656108
0.463566
gate.ex
starcoder
defmodule Bpmn.Context do @moduledoc """ Bpmn.Engine.Context =================== The context is an important part of executing a BPMN process. It allows you to keep track of any data changes in the execution of the process and well as monitor the execution state of your process. BPMN execution context f...
lib/bpmn/context.ex
0.708213
0.733237
context.ex
starcoder
defmodule Number.Human do @moduledoc """ Provides functions for converting numbers into more human readable strings. """ import Number.Delimit, only: [number_to_delimited: 2] import Decimal, only: [cmp: 2] @doc """ Formats and labels a number with the appropriate English word. ## Examples iex>...
lib/number/human.ex
0.817064
0.507751
human.ex
starcoder
defmodule Waffle.Ecto.Schema do @moduledoc ~S""" Defines helpers to work with changeset. Add a using statement `use Waffle.Ecto.Schema` to the top of your ecto schema, and specify the type of the column in your schema as `MyApp.Avatar.Type`. Attachments can subsequently be passed to Waffle's storage thoug...
lib/waffle_ecto/schema.ex
0.876363
0.400515
schema.ex
starcoder
defmodule ExPng.Image.Filtering do @moduledoc """ This module contains code for filtering and defiltering lines of bytestring image data """ use Bitwise use ExPng.Constants import ExPng.Utilities, only: [reduce_to_binary: 1] @type filtered_line :: {ExPng.filter(), binary} def none, do: @filter_non...
lib/ex_png/image/filtering.ex
0.733833
0.577793
filtering.ex
starcoder
defmodule TuringMachine.Program do @moduledoc """ Programs for a turing machine. You can define programs directly constructing list of 5-tuples, or generating from codes by `from_string/1` or `from_file/1`. The 5-tuple `{0, 1, 2, :right, 3}` means a command that when the machine state is `0`, and the valu...
lib/program.ex
0.899119
0.819135
program.ex
starcoder
defmodule Litmus.Type.Number do @moduledoc """ This type validates that values are numbers, and converts them to numbers if possible. It converts "stringified" numerical values to numbers. ## Options * `:default` - Setting `:default` will populate a field with the provided value, assuming that it is...
lib/litmus/type/number.ex
0.923996
0.663466
number.ex
starcoder
defmodule Adventofcode.Day03SpiralMemory do require Integer def steps_to_access_port(input) when is_binary(input) do steps_to_access_port(String.to_integer(input)) end def steps_to_access_port(1), do: 0 def steps_to_access_port(value) when is_number(value) do circle = get_inner_circle(value) sm...
lib/day_03_spiral_memory.ex
0.745954
0.6437
day_03_spiral_memory.ex
starcoder
defmodule Tensorflow.CostGraphDef.Node.InputInfo do @moduledoc false use Protobuf, syntax: :proto3 @type t :: %__MODULE__{ preceding_node: integer, preceding_port: integer } defstruct [:preceding_node, :preceding_port] field(:preceding_node, 1, type: :int32) field(:preceding_po...
lib/tensorflow/core/framework/cost_graph.pb.ex
0.790611
0.643651
cost_graph.pb.ex
starcoder
defmodule Dayron.Repo do @moduledoc """ Defines a rest repository. A repository maps to an underlying http client, which send requests to a remote server. Currently the only available client is HTTPoison with hackney. When used, the repository expects the `:otp_app` as option. The `:otp_app` should point ...
lib/dayron/repo.ex
0.90455
0.466056
repo.ex
starcoder
defmodule GGity.Docs.Geom.Text do @moduledoc false @doc false @spec examples() :: iolist() def examples do [ """ Examples.mtcars() |> Plot.new(%{x: :wt, y: :mpg, label: :model}) |> Plot.geom_text() """, """ # Set the font size for the label Examples.mtcars() ...
lib/mix/tasks/doc_examples/geom_text.ex
0.870996
0.584479
geom_text.ex
starcoder
defmodule ExSDP.Attribute.Extmap do @moduledoc """ This module represents extmap (RFC 8285). """ alias ExSDP.Utils @enforce_keys [:id, :uri] defstruct @enforce_keys ++ [direction: nil, attributes: []] @type extension_id :: 1..14 @type direction :: :sendonly | :recvonly | :sendrecv | :inactive | nil ...
lib/ex_sdp/attribute/extmap.ex
0.730386
0.425158
extmap.ex
starcoder
defmodule Iptrie do @external_resource "README.md" @moduledoc File.read!("README.md") |> String.split("<!-- @MODULEDOC -->") |> Enum.fetch!(1) require Pfx alias Radix defstruct [] @typedoc """ An Iptrie struct that contains a `Radix` tree per type of `t:Pfx.t/0` used. A [p...
lib/iptrie.ex
0.895137
0.489809
iptrie.ex
starcoder
defmodule WHATWG.URL.WwwFormUrlencoded do @moduledoc """ Functions to work with `application/x-www-form-urlencoded`. The `application/x-www-form-urlencoded` percent-encode set is [defined](https://url.spec.whatwg.org/#application-x-www-form-urlencoded-percent-encode-set) as: > The `application/x-www-form-urle...
lib/whatwg/url/www_form_urlencoded.ex
0.838713
0.551242
www_form_urlencoded.ex
starcoder