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 Map do
@moduledoc """
A `Dict` implementation that works on maps.
Maps are key-value stores where keys are compared using
the match operator (`===`). Maps can be created with
the `%{}` special form defined in the `Kernel.SpecialForms`
module.
For more information about the functions in this mo... | lib/elixir/lib/map.ex | 0.680348 | 0.666066 | map.ex | starcoder |
defmodule GenEvent.Behaviour do
@moduledoc """
This module is a convenience for defining GenEvent callbacks in Elixir.
GenEvent is an OTP behaviour that encapsulates event handling functionality.
## Example
Below is an example of a GenEvent that stores notifications
until they are fetched:
defmodu... | lib/elixir/lib/gen_event/behaviour.ex | 0.678647 | 0.413862 | behaviour.ex | starcoder |
defmodule Seren.Player do
@moduledoc """
The Player context.
"""
import Ecto.Query, warn: false
alias Seren.Repo
alias Seren.Player.Track
@doc """
Returns the list of tracks.
## Examples
iex> list_tracks()
[%Track{}, ...]
"""
def list_tracks do
Repo.all(Track)
end
def li... | lib/seren/player/player.ex | 0.843009 | 0.545225 | player.ex | starcoder |
defprotocol Phoenix.HTML.FormData do
@moduledoc """
Converts a data structure into a [`Phoenix.HTML.Form`](`t:Phoenix.HTML.Form.t/0`) struct.
"""
@doc """
Converts a data structure into a [`Phoenix.HTML.Form`](`t:Phoenix.HTML.Form.t/0`) struct.
The options are the same options given to `form_for/4`. It
... | lib/phoenix_html/form_data.ex | 0.911559 | 0.692044 | form_data.ex | starcoder |
defmodule AshPostgres.DataLayer do
@manage_tenant %Ash.Dsl.Section{
name: :manage_tenant,
describe: """
Configuration for the behavior of a resource that manages a tenant
""",
examples: [
"""
manage_tenant do
template ["organization_", :id]
create? true
update? ... | lib/data_layer.ex | 0.935942 | 0.52074 | data_layer.ex | starcoder |
defmodule Absinthe.Type.Union do
@moduledoc """
A unions is an abstract type made up of multiple possible concrete types.
No common fields are declared in a union. Compare to `Absinthe.Type.Interface`.
Because it's necessary for the union to determine the concrete type of a
resolved object, you must either... | deps/absinthe/lib/absinthe/type/union.ex | 0.858422 | 0.881615 | union.ex | starcoder |
defmodule Slack do
@moduledoc """
Slack is a genserver-ish interface for working with the Slack real time
messaging API through a Websocket connection.
To use this module you'll need a valid Slack API token. You can find your
personal token on the [Slack Web API] page, or you can add a new
[bot integration... | lib/slack.ex | 0.824073 | 0.820073 | slack.ex | starcoder |
defmodule Bolt.Sips.Metadata do
@moduledoc false
defstruct [:bookmarks, :tx_timeout, :metadata]
@type t :: %__MODULE__{
bookmarks: [String.t()],
tx_timeout: non_neg_integer(),
metadata: map()
}
alias Bolt.Sips.Metadata
@doc """
Create a new metadata structure.
Data... | lib/bolt_sips/metadata.ex | 0.803829 | 0.492371 | metadata.ex | starcoder |
defmodule Elastix.Bulk do
@moduledoc """
The bulk API makes it possible to perform many index/delete operations in a single API call.
[Elastic documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html)
"""
import Elastix.HTTP, only: [prepare_url: 2]
alias Elastix.{HTTP, ... | lib/elastix/bulk.ex | 0.839718 | 0.472318 | bulk.ex | starcoder |
defmodule AWS.Synthetics do
@moduledoc """
Amazon CloudWatch Synthetics
You can use Amazon CloudWatch Synthetics to continually monitor your
services. You can create and manage *canaries*, which are modular,
lightweight scripts that monitor your endpoints and APIs from the
outside-in. You can set up your ... | lib/aws/synthetics.ex | 0.809953 | 0.595875 | synthetics.ex | starcoder |
defmodule Yyzzy.Enum do
### Protocols and Behaviors: Enum
## Note, this implementation might have to change if we want fully qualified uids..
defimpl Enumerable, for: Yyzzy do
def count(yyzzy) do
{:ok, Enum.reduce(yyzzy,0,fn _x, acc -> acc + 1 end) }
end
@doc """
entities are in a tree lik... | lib/yyzzy/enum.ex | 0.610453 | 0.405154 | enum.ex | starcoder |
defmodule ElixirBoilerplateWeb.Errors do
alias Ecto.Changeset
alias ElixirBoilerplateWeb.Errors.View
@doc """
Generates a human-readable block containing all errors in a changeset. Errors
are then localized using translations in the `ecto` domain.
For example, you could have an `ecto.po` file in the frenc... | lib/elixir_boilerplate_web/errors/errors.ex | 0.819424 | 0.622631 | errors.ex | starcoder |
defmodule Flop do
@moduledoc """
Flop is a helper library for filtering, ordering and pagination with Ecto.
## Usage
The simplest way of using this library is just to use
`Flop.validate_and_run/3` and `Flop.validate_and_run!/3`. Both functions
take a queryable and a parameter map, validate the parameters,... | lib/flop.ex | 0.806853 | 0.617686 | flop.ex | starcoder |
defmodule PersistentList.Day02 do
alias PersistentList.Day02, as: List
defstruct [:head, :tail]
defimpl String.Chars, for: PersistentList.Day02 do
def to_string(list), do: "[" <> stringify(list) <> "]"
defp stringify(%List{head: nil}), do: ""
defp stringify(
%List{
head: hea... | persistent_list/lib/persistent_list/day02.ex | 0.583441 | 0.461502 | day02.ex | starcoder |
defmodule Meeseeks.Selector.Combinator do
@moduledoc """
Combinator structs package some method for finding related nodes and a
`Meeseeks.Selector` to be run on found nodes.
For instance, the css selector `ul > li` contains the combinator `> li`,
which roughly translates to "find a node's children and match ... | lib/meeseeks/selector/combinator.ex | 0.900717 | 0.726013 | combinator.ex | starcoder |
defmodule Protobuf.Parser do
defmodule ParserError do
defexception [:message]
end
def parse_files!(files, options \\ []) do
files
|> Enum.flat_map(fn path ->
schema = File.read!(path)
parse!(path, schema, options)
end)
|> finalize!(options)
end
def parse_string!(file, string,... | lib/exprotobuf/parser.ex | 0.592077 | 0.485722 | parser.ex | starcoder |
defmodule HelloOperator.Controller.V1.Greeting do
@moduledoc """
HelloOperator: Greeting CRD.
## Kubernetes CRD Spec
By default all CRD specs are assumed from the module name, you can override them using attributes.
### Examples
```
# Kubernetes API version of this CRD, defaults to value in module name... | lib/hello_operator/controllers/v1/greeting.ex | 0.88499 | 0.824108 | greeting.ex | starcoder |
End of preview. Expand in Data Studio
Dataset Card for "clean_code_data"
High quality code data filtering from the stack and pypi. The stack data is pulled from starcoder data, so it has some filtering applied already.
All data was cleaned to remove code licenses and other headers, and filtered for quality and learning value.
- Downloads last month
- 94