partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
apply_overwrites_to_context
Modify the given context in place based on the overwrite_context.
cookiecutter/generate.py
def apply_overwrites_to_context(context, overwrite_context): """Modify the given context in place based on the overwrite_context.""" for variable, overwrite in overwrite_context.items(): if variable not in context: # Do not include variables which are not used in the template con...
def apply_overwrites_to_context(context, overwrite_context): """Modify the given context in place based on the overwrite_context.""" for variable, overwrite in overwrite_context.items(): if variable not in context: # Do not include variables which are not used in the template con...
[ "Modify", "the", "given", "context", "in", "place", "based", "on", "the", "overwrite_context", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/generate.py#L53-L72
[ "def", "apply_overwrites_to_context", "(", "context", ",", "overwrite_context", ")", ":", "for", "variable", ",", "overwrite", "in", "overwrite_context", ".", "items", "(", ")", ":", "if", "variable", "not", "in", "context", ":", "# Do not include variables which ar...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
generate_context
Generate the context for a Cookiecutter project template. Loads the JSON file as a Python object, with key being the JSON filename. :param context_file: JSON file containing key/value pairs for populating the cookiecutter's variables. :param default_context: Dictionary containing config to take in...
cookiecutter/generate.py
def generate_context(context_file='cookiecutter.json', default_context=None, extra_context=None): """Generate the context for a Cookiecutter project template. Loads the JSON file as a Python object, with key being the JSON filename. :param context_file: JSON file containing key/value ...
def generate_context(context_file='cookiecutter.json', default_context=None, extra_context=None): """Generate the context for a Cookiecutter project template. Loads the JSON file as a Python object, with key being the JSON filename. :param context_file: JSON file containing key/value ...
[ "Generate", "the", "context", "for", "a", "Cookiecutter", "project", "template", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/generate.py#L75-L114
[ "def", "generate_context", "(", "context_file", "=", "'cookiecutter.json'", ",", "default_context", "=", "None", ",", "extra_context", "=", "None", ")", ":", "context", "=", "OrderedDict", "(", "[", "]", ")", "try", ":", "with", "open", "(", "context_file", ...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
generate_file
Render filename of infile as name of outfile, handle infile correctly. Dealing with infile appropriately: a. If infile is a binary file, copy it over without rendering. b. If infile is a text file, render its contents and write the rendered infile to outfile. Precondition: ...
cookiecutter/generate.py
def generate_file(project_dir, infile, context, env): """Render filename of infile as name of outfile, handle infile correctly. Dealing with infile appropriately: a. If infile is a binary file, copy it over without rendering. b. If infile is a text file, render its contents and write the ...
def generate_file(project_dir, infile, context, env): """Render filename of infile as name of outfile, handle infile correctly. Dealing with infile appropriately: a. If infile is a binary file, copy it over without rendering. b. If infile is a text file, render its contents and write the ...
[ "Render", "filename", "of", "infile", "as", "name", "of", "outfile", "handle", "infile", "correctly", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/generate.py#L117-L180
[ "def", "generate_file", "(", "project_dir", ",", "infile", ",", "context", ",", "env", ")", ":", "logger", ".", "debug", "(", "'Processing file {}'", ".", "format", "(", "infile", ")", ")", "# Render the path to the output file (not including the root project dir)", "...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
render_and_create_dir
Render name of a directory, create the directory, return its path.
cookiecutter/generate.py
def render_and_create_dir(dirname, context, output_dir, environment, overwrite_if_exists=False): """Render name of a directory, create the directory, return its path.""" name_tmpl = environment.from_string(dirname) rendered_dirname = name_tmpl.render(**context) dir_to_create =...
def render_and_create_dir(dirname, context, output_dir, environment, overwrite_if_exists=False): """Render name of a directory, create the directory, return its path.""" name_tmpl = environment.from_string(dirname) rendered_dirname = name_tmpl.render(**context) dir_to_create =...
[ "Render", "name", "of", "a", "directory", "create", "the", "directory", "return", "its", "path", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/generate.py#L183-L212
[ "def", "render_and_create_dir", "(", "dirname", ",", "context", ",", "output_dir", ",", "environment", ",", "overwrite_if_exists", "=", "False", ")", ":", "name_tmpl", "=", "environment", ".", "from_string", "(", "dirname", ")", "rendered_dirname", "=", "name_tmpl...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
_run_hook_from_repo_dir
Run hook from repo directory, clean project directory if hook fails. :param repo_dir: Project template input directory. :param hook_name: The hook to execute. :param project_dir: The directory to execute the script from. :param context: Cookiecutter project context. :param delete_project_on_failure...
cookiecutter/generate.py
def _run_hook_from_repo_dir(repo_dir, hook_name, project_dir, context, delete_project_on_failure): """Run hook from repo directory, clean project directory if hook fails. :param repo_dir: Project template input directory. :param hook_name: The hook to execute. :param project...
def _run_hook_from_repo_dir(repo_dir, hook_name, project_dir, context, delete_project_on_failure): """Run hook from repo directory, clean project directory if hook fails. :param repo_dir: Project template input directory. :param hook_name: The hook to execute. :param project...
[ "Run", "hook", "from", "repo", "directory", "clean", "project", "directory", "if", "hook", "fails", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/generate.py#L223-L244
[ "def", "_run_hook_from_repo_dir", "(", "repo_dir", ",", "hook_name", ",", "project_dir", ",", "context", ",", "delete_project_on_failure", ")", ":", "with", "work_in", "(", "repo_dir", ")", ":", "try", ":", "run_hook", "(", "hook_name", ",", "project_dir", ",", ...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
generate_files
Render the templates and saves them to files. :param repo_dir: Project template input directory. :param context: Dict for populating the template's variables. :param output_dir: Where to output the generated project dir into. :param overwrite_if_exists: Overwrite the contents of the output directory ...
cookiecutter/generate.py
def generate_files(repo_dir, context=None, output_dir='.', overwrite_if_exists=False): """Render the templates and saves them to files. :param repo_dir: Project template input directory. :param context: Dict for populating the template's variables. :param output_dir: Where to output ...
def generate_files(repo_dir, context=None, output_dir='.', overwrite_if_exists=False): """Render the templates and saves them to files. :param repo_dir: Project template input directory. :param context: Dict for populating the template's variables. :param output_dir: Where to output ...
[ "Render", "the", "templates", "and", "saves", "them", "to", "files", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/generate.py#L247-L379
[ "def", "generate_files", "(", "repo_dir", ",", "context", "=", "None", ",", "output_dir", "=", "'.'", ",", "overwrite_if_exists", "=", "False", ")", ":", "template_dir", "=", "find_template", "(", "repo_dir", ")", "logger", ".", "debug", "(", "'Generating proj...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
_expand_path
Expand both environment variables and user home in the given path.
cookiecutter/config.py
def _expand_path(path): """Expand both environment variables and user home in the given path.""" path = os.path.expandvars(path) path = os.path.expanduser(path) return path
def _expand_path(path): """Expand both environment variables and user home in the given path.""" path = os.path.expandvars(path) path = os.path.expanduser(path) return path
[ "Expand", "both", "environment", "variables", "and", "user", "home", "in", "the", "given", "path", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/config.py#L36-L40
[ "def", "_expand_path", "(", "path", ")", ":", "path", "=", "os", ".", "path", ".", "expandvars", "(", "path", ")", "path", "=", "os", ".", "path", ".", "expanduser", "(", "path", ")", "return", "path" ]
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
merge_configs
Recursively update a dict with the key/value pair of another. Dict values that are dictionaries themselves will be updated, whilst preserving existing keys.
cookiecutter/config.py
def merge_configs(default, overwrite): """Recursively update a dict with the key/value pair of another. Dict values that are dictionaries themselves will be updated, whilst preserving existing keys. """ new_config = copy.deepcopy(default) for k, v in overwrite.items(): # Make sure to p...
def merge_configs(default, overwrite): """Recursively update a dict with the key/value pair of another. Dict values that are dictionaries themselves will be updated, whilst preserving existing keys. """ new_config = copy.deepcopy(default) for k, v in overwrite.items(): # Make sure to p...
[ "Recursively", "update", "a", "dict", "with", "the", "key", "/", "value", "pair", "of", "another", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/config.py#L43-L59
[ "def", "merge_configs", "(", "default", ",", "overwrite", ")", ":", "new_config", "=", "copy", ".", "deepcopy", "(", "default", ")", "for", "k", ",", "v", "in", "overwrite", ".", "items", "(", ")", ":", "# Make sure to preserve existing items in", "# nested di...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
get_config
Retrieve the config from the specified path, returning a config dict.
cookiecutter/config.py
def get_config(config_path): """Retrieve the config from the specified path, returning a config dict.""" if not os.path.exists(config_path): raise ConfigDoesNotExistException logger.debug('config_path is {0}'.format(config_path)) with io.open(config_path, encoding='utf-8') as file_handle: ...
def get_config(config_path): """Retrieve the config from the specified path, returning a config dict.""" if not os.path.exists(config_path): raise ConfigDoesNotExistException logger.debug('config_path is {0}'.format(config_path)) with io.open(config_path, encoding='utf-8') as file_handle: ...
[ "Retrieve", "the", "config", "from", "the", "specified", "path", "returning", "a", "config", "dict", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/config.py#L62-L85
[ "def", "get_config", "(", "config_path", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "config_path", ")", ":", "raise", "ConfigDoesNotExistException", "logger", ".", "debug", "(", "'config_path is {0}'", ".", "format", "(", "config_path", ")",...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
get_user_config
Return the user config as a dict. If ``default_config`` is True, ignore ``config_file`` and return default values for the config parameters. If a path to a ``config_file`` is given, that is different from the default location, load the user config from that. Otherwise look up the config file path...
cookiecutter/config.py
def get_user_config(config_file=None, default_config=False): """Return the user config as a dict. If ``default_config`` is True, ignore ``config_file`` and return default values for the config parameters. If a path to a ``config_file`` is given, that is different from the default location, load th...
def get_user_config(config_file=None, default_config=False): """Return the user config as a dict. If ``default_config`` is True, ignore ``config_file`` and return default values for the config parameters. If a path to a ``config_file`` is given, that is different from the default location, load th...
[ "Return", "the", "user", "config", "as", "a", "dict", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/config.py#L88-L125
[ "def", "get_user_config", "(", "config_file", "=", "None", ",", "default_config", "=", "False", ")", ":", "# Do NOT load a config. Return defaults instead.", "if", "default_config", ":", "return", "copy", ".", "copy", "(", "DEFAULT_CONFIG", ")", "# Load the given config...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
force_delete
Error handler for `shutil.rmtree()` equivalent to `rm -rf`. Usage: `shutil.rmtree(path, onerror=force_delete)` From stackoverflow.com/questions/1889597
cookiecutter/utils.py
def force_delete(func, path, exc_info): """Error handler for `shutil.rmtree()` equivalent to `rm -rf`. Usage: `shutil.rmtree(path, onerror=force_delete)` From stackoverflow.com/questions/1889597 """ os.chmod(path, stat.S_IWRITE) func(path)
def force_delete(func, path, exc_info): """Error handler for `shutil.rmtree()` equivalent to `rm -rf`. Usage: `shutil.rmtree(path, onerror=force_delete)` From stackoverflow.com/questions/1889597 """ os.chmod(path, stat.S_IWRITE) func(path)
[ "Error", "handler", "for", "shutil", ".", "rmtree", "()", "equivalent", "to", "rm", "-", "rf", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/utils.py#L19-L26
[ "def", "force_delete", "(", "func", ",", "path", ",", "exc_info", ")", ":", "os", ".", "chmod", "(", "path", ",", "stat", ".", "S_IWRITE", ")", "func", "(", "path", ")" ]
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
make_sure_path_exists
Ensure that a directory exists. :param path: A directory path.
cookiecutter/utils.py
def make_sure_path_exists(path): """Ensure that a directory exists. :param path: A directory path. """ logger.debug('Making sure path exists: {}'.format(path)) try: os.makedirs(path) logger.debug('Created directory at: {}'.format(path)) except OSError as exception: if ex...
def make_sure_path_exists(path): """Ensure that a directory exists. :param path: A directory path. """ logger.debug('Making sure path exists: {}'.format(path)) try: os.makedirs(path) logger.debug('Created directory at: {}'.format(path)) except OSError as exception: if ex...
[ "Ensure", "that", "a", "directory", "exists", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/utils.py#L37-L49
[ "def", "make_sure_path_exists", "(", "path", ")", ":", "logger", ".", "debug", "(", "'Making sure path exists: {}'", ".", "format", "(", "path", ")", ")", "try", ":", "os", ".", "makedirs", "(", "path", ")", "logger", ".", "debug", "(", "'Created directory a...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
work_in
Context manager version of os.chdir. When exited, returns to the working directory prior to entering.
cookiecutter/utils.py
def work_in(dirname=None): """Context manager version of os.chdir. When exited, returns to the working directory prior to entering. """ curdir = os.getcwd() try: if dirname is not None: os.chdir(dirname) yield finally: os.chdir(curdir)
def work_in(dirname=None): """Context manager version of os.chdir. When exited, returns to the working directory prior to entering. """ curdir = os.getcwd() try: if dirname is not None: os.chdir(dirname) yield finally: os.chdir(curdir)
[ "Context", "manager", "version", "of", "os", ".", "chdir", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/utils.py#L53-L64
[ "def", "work_in", "(", "dirname", "=", "None", ")", ":", "curdir", "=", "os", ".", "getcwd", "(", ")", "try", ":", "if", "dirname", "is", "not", "None", ":", "os", ".", "chdir", "(", "dirname", ")", "yield", "finally", ":", "os", ".", "chdir", "(...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
make_executable
Make `script_path` executable. :param script_path: The file to change
cookiecutter/utils.py
def make_executable(script_path): """Make `script_path` executable. :param script_path: The file to change """ status = os.stat(script_path) os.chmod(script_path, status.st_mode | stat.S_IEXEC)
def make_executable(script_path): """Make `script_path` executable. :param script_path: The file to change """ status = os.stat(script_path) os.chmod(script_path, status.st_mode | stat.S_IEXEC)
[ "Make", "script_path", "executable", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/utils.py#L67-L73
[ "def", "make_executable", "(", "script_path", ")", ":", "status", "=", "os", ".", "stat", "(", "script_path", ")", "os", ".", "chmod", "(", "script_path", ",", "status", ".", "st_mode", "|", "stat", ".", "S_IEXEC", ")" ]
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
prompt_and_delete
Ask user if it's okay to delete the previously-downloaded file/directory. If yes, delete it. If no, checks to see if the old version should be reused. If yes, it's reused; otherwise, Cookiecutter exits. :param path: Previously downloaded zipfile. :param no_input: Suppress prompt to delete repo and jus...
cookiecutter/utils.py
def prompt_and_delete(path, no_input=False): """ Ask user if it's okay to delete the previously-downloaded file/directory. If yes, delete it. If no, checks to see if the old version should be reused. If yes, it's reused; otherwise, Cookiecutter exits. :param path: Previously downloaded zipfile. ...
def prompt_and_delete(path, no_input=False): """ Ask user if it's okay to delete the previously-downloaded file/directory. If yes, delete it. If no, checks to see if the old version should be reused. If yes, it's reused; otherwise, Cookiecutter exits. :param path: Previously downloaded zipfile. ...
[ "Ask", "user", "if", "it", "s", "okay", "to", "delete", "the", "previously", "-", "downloaded", "file", "/", "directory", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/utils.py#L76-L112
[ "def", "prompt_and_delete", "(", "path", ",", "no_input", "=", "False", ")", ":", "# Suppress prompt if called via API", "if", "no_input", ":", "ok_to_delete", "=", "True", "else", ":", "question", "=", "(", "\"You've downloaded {} before. \"", "\"Is it okay to delete a...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
unzip
Download and unpack a zipfile at a given URI. This will download the zipfile to the cookiecutter repository, and unpack into a temporary directory. :param zip_uri: The URI for the zipfile. :param is_url: Is the zip URI a URL or a file? :param clone_to_dir: The cookiecutter repository directory ...
cookiecutter/zipfile.py
def unzip(zip_uri, is_url, clone_to_dir='.', no_input=False, password=None): """Download and unpack a zipfile at a given URI. This will download the zipfile to the cookiecutter repository, and unpack into a temporary directory. :param zip_uri: The URI for the zipfile. :param is_url: Is the zip URI...
def unzip(zip_uri, is_url, clone_to_dir='.', no_input=False, password=None): """Download and unpack a zipfile at a given URI. This will download the zipfile to the cookiecutter repository, and unpack into a temporary directory. :param zip_uri: The URI for the zipfile. :param is_url: Is the zip URI...
[ "Download", "and", "unpack", "a", "zipfile", "at", "a", "given", "URI", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/zipfile.py#L18-L124
[ "def", "unzip", "(", "zip_uri", ",", "is_url", ",", "clone_to_dir", "=", "'.'", ",", "no_input", "=", "False", ",", "password", "=", "None", ")", ":", "# Ensure that clone_to_dir exists", "clone_to_dir", "=", "os", ".", "path", ".", "expanduser", "(", "clone...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
cookiecutter
Run Cookiecutter just as if using it from the command line. :param template: A directory containing a project template directory, or a URL to a git repository. :param checkout: The branch, tag or commit ID to checkout after clone. :param no_input: Prompt the user at command line for manual configur...
cookiecutter/main.py
def cookiecutter( template, checkout=None, no_input=False, extra_context=None, replay=False, overwrite_if_exists=False, output_dir='.', config_file=None, default_config=False, password=None): """ Run Cookiecutter just as if using it from the command line. :param template: A director...
def cookiecutter( template, checkout=None, no_input=False, extra_context=None, replay=False, overwrite_if_exists=False, output_dir='.', config_file=None, default_config=False, password=None): """ Run Cookiecutter just as if using it from the command line. :param template: A director...
[ "Run", "Cookiecutter", "just", "as", "if", "using", "it", "from", "the", "command", "line", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/main.py#L25-L101
[ "def", "cookiecutter", "(", "template", ",", "checkout", "=", "None", ",", "no_input", "=", "False", ",", "extra_context", "=", "None", ",", "replay", "=", "False", ",", "overwrite_if_exists", "=", "False", ",", "output_dir", "=", "'.'", ",", "config_file", ...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
read_user_yes_no
Prompt the user to reply with 'yes' or 'no' (or equivalent values). Note: Possible choices are 'true', '1', 'yes', 'y' or 'false', '0', 'no', 'n' :param str question: Question to the user :param default_value: Value that will be returned if no input happens
cookiecutter/prompt.py
def read_user_yes_no(question, default_value): """Prompt the user to reply with 'yes' or 'no' (or equivalent values). Note: Possible choices are 'true', '1', 'yes', 'y' or 'false', '0', 'no', 'n' :param str question: Question to the user :param default_value: Value that will be returned if no in...
def read_user_yes_no(question, default_value): """Prompt the user to reply with 'yes' or 'no' (or equivalent values). Note: Possible choices are 'true', '1', 'yes', 'y' or 'false', '0', 'no', 'n' :param str question: Question to the user :param default_value: Value that will be returned if no in...
[ "Prompt", "the", "user", "to", "reply", "with", "yes", "or", "no", "(", "or", "equivalent", "values", ")", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/prompt.py#L35-L49
[ "def", "read_user_yes_no", "(", "question", ",", "default_value", ")", ":", "# Please see http://click.pocoo.org/4/api/#click.prompt", "return", "click", ".", "prompt", "(", "question", ",", "default", "=", "default_value", ",", "type", "=", "click", ".", "BOOL", ")...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
read_user_choice
Prompt the user to choose from several options for the given variable. The first item will be returned if no input happens. :param str var_name: Variable as specified in the context :param list options: Sequence of options that are available to select from :return: Exactly one item of ``options`` that...
cookiecutter/prompt.py
def read_user_choice(var_name, options): """Prompt the user to choose from several options for the given variable. The first item will be returned if no input happens. :param str var_name: Variable as specified in the context :param list options: Sequence of options that are available to select from ...
def read_user_choice(var_name, options): """Prompt the user to choose from several options for the given variable. The first item will be returned if no input happens. :param str var_name: Variable as specified in the context :param list options: Sequence of options that are available to select from ...
[ "Prompt", "the", "user", "to", "choose", "from", "several", "options", "for", "the", "given", "variable", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/prompt.py#L61-L93
[ "def", "read_user_choice", "(", "var_name", ",", "options", ")", ":", "# Please see http://click.pocoo.org/4/api/#click.prompt", "if", "not", "isinstance", "(", "options", ",", "list", ")", ":", "raise", "TypeError", "if", "not", "options", ":", "raise", "ValueError...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
read_user_dict
Prompt the user to provide a dictionary of data. :param str var_name: Variable as specified in the context :param default_value: Value that will be returned if no input is provided :return: A Python dictionary to use in the context.
cookiecutter/prompt.py
def read_user_dict(var_name, default_value): """Prompt the user to provide a dictionary of data. :param str var_name: Variable as specified in the context :param default_value: Value that will be returned if no input is provided :return: A Python dictionary to use in the context. """ # Please s...
def read_user_dict(var_name, default_value): """Prompt the user to provide a dictionary of data. :param str var_name: Variable as specified in the context :param default_value: Value that will be returned if no input is provided :return: A Python dictionary to use in the context. """ # Please s...
[ "Prompt", "the", "user", "to", "provide", "a", "dictionary", "of", "data", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/prompt.py#L113-L136
[ "def", "read_user_dict", "(", "var_name", ",", "default_value", ")", ":", "# Please see http://click.pocoo.org/4/api/#click.prompt", "if", "not", "isinstance", "(", "default_value", ",", "dict", ")", ":", "raise", "TypeError", "default_display", "=", "'default'", "user_...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
render_variable
Inside the prompting taken from the cookiecutter.json file, this renders the next variable. For example, if a project_name is "Peanut Butter Cookie", the repo_name could be be rendered with: `{{ cookiecutter.project_name.replace(" ", "_") }}`. This is then presented to the user as the default. ...
cookiecutter/prompt.py
def render_variable(env, raw, cookiecutter_dict): """Inside the prompting taken from the cookiecutter.json file, this renders the next variable. For example, if a project_name is "Peanut Butter Cookie", the repo_name could be be rendered with: `{{ cookiecutter.project_name.replace(" ", "_") }}`. ...
def render_variable(env, raw, cookiecutter_dict): """Inside the prompting taken from the cookiecutter.json file, this renders the next variable. For example, if a project_name is "Peanut Butter Cookie", the repo_name could be be rendered with: `{{ cookiecutter.project_name.replace(" ", "_") }}`. ...
[ "Inside", "the", "prompting", "taken", "from", "the", "cookiecutter", ".", "json", "file", "this", "renders", "the", "next", "variable", ".", "For", "example", "if", "a", "project_name", "is", "Peanut", "Butter", "Cookie", "the", "repo_name", "could", "be", ...
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/prompt.py#L139-L173
[ "def", "render_variable", "(", "env", ",", "raw", ",", "cookiecutter_dict", ")", ":", "if", "raw", "is", "None", ":", "return", "None", "elif", "isinstance", "(", "raw", ",", "dict", ")", ":", "return", "{", "render_variable", "(", "env", ",", "k", ","...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
prompt_choice_for_config
Prompt the user which option to choose from the given. Each of the possible choices is rendered beforehand.
cookiecutter/prompt.py
def prompt_choice_for_config(cookiecutter_dict, env, key, options, no_input): """Prompt the user which option to choose from the given. Each of the possible choices is rendered beforehand. """ rendered_options = [ render_variable(env, raw, cookiecutter_dict) for raw in options ] if no_i...
def prompt_choice_for_config(cookiecutter_dict, env, key, options, no_input): """Prompt the user which option to choose from the given. Each of the possible choices is rendered beforehand. """ rendered_options = [ render_variable(env, raw, cookiecutter_dict) for raw in options ] if no_i...
[ "Prompt", "the", "user", "which", "option", "to", "choose", "from", "the", "given", ".", "Each", "of", "the", "possible", "choices", "is", "rendered", "beforehand", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/prompt.py#L176-L186
[ "def", "prompt_choice_for_config", "(", "cookiecutter_dict", ",", "env", ",", "key", ",", "options", ",", "no_input", ")", ":", "rendered_options", "=", "[", "render_variable", "(", "env", ",", "raw", ",", "cookiecutter_dict", ")", "for", "raw", "in", "options...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
prompt_for_config
Prompts the user to enter new config, using context as a source for the field names and sample values. :param no_input: Prompt the user at command line for manual configuration?
cookiecutter/prompt.py
def prompt_for_config(context, no_input=False): """ Prompts the user to enter new config, using context as a source for the field names and sample values. :param no_input: Prompt the user at command line for manual configuration? """ cookiecutter_dict = OrderedDict([]) env = StrictEnvironme...
def prompt_for_config(context, no_input=False): """ Prompts the user to enter new config, using context as a source for the field names and sample values. :param no_input: Prompt the user at command line for manual configuration? """ cookiecutter_dict = OrderedDict([]) env = StrictEnvironme...
[ "Prompts", "the", "user", "to", "enter", "new", "config", "using", "context", "as", "a", "source", "for", "the", "field", "names", "and", "sample", "values", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/prompt.py#L189-L242
[ "def", "prompt_for_config", "(", "context", ",", "no_input", "=", "False", ")", ":", "cookiecutter_dict", "=", "OrderedDict", "(", "[", "]", ")", "env", "=", "StrictEnvironment", "(", "context", "=", "context", ")", "# First pass: Handle simple and raw variables, pl...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
ExtensionLoaderMixin._read_extensions
Return list of extensions as str to be passed on to the Jinja2 env. If context does not contain the relevant info, return an empty list instead.
cookiecutter/environment.py
def _read_extensions(self, context): """Return list of extensions as str to be passed on to the Jinja2 env. If context does not contain the relevant info, return an empty list instead. """ try: extensions = context['cookiecutter']['_extensions'] except KeyErr...
def _read_extensions(self, context): """Return list of extensions as str to be passed on to the Jinja2 env. If context does not contain the relevant info, return an empty list instead. """ try: extensions = context['cookiecutter']['_extensions'] except KeyErr...
[ "Return", "list", "of", "extensions", "as", "str", "to", "be", "passed", "on", "to", "the", "Jinja2", "env", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/environment.py#L42-L53
[ "def", "_read_extensions", "(", "self", ",", "context", ")", ":", "try", ":", "extensions", "=", "context", "[", "'cookiecutter'", "]", "[", "'_extensions'", "]", "except", "KeyError", ":", "return", "[", "]", "else", ":", "return", "[", "str", "(", "ext...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
configure_logger
Configure logging for cookiecutter. Set up logging to stdout with given level. If ``debug_file`` is given set up logging to file with DEBUG level.
cookiecutter/log.py
def configure_logger(stream_level='DEBUG', debug_file=None): """Configure logging for cookiecutter. Set up logging to stdout with given level. If ``debug_file`` is given set up logging to file with DEBUG level. """ # Set up 'cookiecutter' logger logger = logging.getLogger('cookiecutter') lo...
def configure_logger(stream_level='DEBUG', debug_file=None): """Configure logging for cookiecutter. Set up logging to stdout with given level. If ``debug_file`` is given set up logging to file with DEBUG level. """ # Set up 'cookiecutter' logger logger = logging.getLogger('cookiecutter') lo...
[ "Configure", "logging", "for", "cookiecutter", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/log.py#L22-L54
[ "def", "configure_logger", "(", "stream_level", "=", "'DEBUG'", ",", "debug_file", "=", "None", ")", ":", "# Set up 'cookiecutter' logger", "logger", "=", "logging", ".", "getLogger", "(", "'cookiecutter'", ")", "logger", ".", "setLevel", "(", "logging", ".", "D...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
identify_repo
Determine if `repo_url` should be treated as a URL to a git or hg repo. Repos can be identified by prepending "hg+" or "git+" to the repo URL. :param repo_url: Repo URL of unknown type. :returns: ('git', repo_url), ('hg', repo_url), or None.
cookiecutter/vcs.py
def identify_repo(repo_url): """Determine if `repo_url` should be treated as a URL to a git or hg repo. Repos can be identified by prepending "hg+" or "git+" to the repo URL. :param repo_url: Repo URL of unknown type. :returns: ('git', repo_url), ('hg', repo_url), or None. """ repo_url_values ...
def identify_repo(repo_url): """Determine if `repo_url` should be treated as a URL to a git or hg repo. Repos can be identified by prepending "hg+" or "git+" to the repo URL. :param repo_url: Repo URL of unknown type. :returns: ('git', repo_url), ('hg', repo_url), or None. """ repo_url_values ...
[ "Determine", "if", "repo_url", "should", "be", "treated", "as", "a", "URL", "to", "a", "git", "or", "hg", "repo", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/vcs.py#L26-L47
[ "def", "identify_repo", "(", "repo_url", ")", ":", "repo_url_values", "=", "repo_url", ".", "split", "(", "'+'", ")", "if", "len", "(", "repo_url_values", ")", "==", "2", ":", "repo_type", "=", "repo_url_values", "[", "0", "]", "if", "repo_type", "in", "...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
clone
Clone a repo to the current directory. :param repo_url: Repo URL of unknown type. :param checkout: The branch, tag or commit ID to checkout after clone. :param clone_to_dir: The directory to clone to. Defaults to the current directory. :param no_input: Suppress all user prompts...
cookiecutter/vcs.py
def clone(repo_url, checkout=None, clone_to_dir='.', no_input=False): """Clone a repo to the current directory. :param repo_url: Repo URL of unknown type. :param checkout: The branch, tag or commit ID to checkout after clone. :param clone_to_dir: The directory to clone to. Defa...
def clone(repo_url, checkout=None, clone_to_dir='.', no_input=False): """Clone a repo to the current directory. :param repo_url: Repo URL of unknown type. :param checkout: The branch, tag or commit ID to checkout after clone. :param clone_to_dir: The directory to clone to. Defa...
[ "Clone", "a", "repo", "to", "the", "current", "directory", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/vcs.py#L59-L121
[ "def", "clone", "(", "repo_url", ",", "checkout", "=", "None", ",", "clone_to_dir", "=", "'.'", ",", "no_input", "=", "False", ")", ":", "# Ensure that clone_to_dir exists", "clone_to_dir", "=", "os", ".", "path", ".", "expanduser", "(", "clone_to_dir", ")", ...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
valid_hook
Determine if a hook file is valid. :param hook_file: The hook file to consider for validity :param hook_name: The hook to find :return: The hook file validity
cookiecutter/hooks.py
def valid_hook(hook_file, hook_name): """Determine if a hook file is valid. :param hook_file: The hook file to consider for validity :param hook_name: The hook to find :return: The hook file validity """ filename = os.path.basename(hook_file) basename = os.path.splitext(filename)[0] ma...
def valid_hook(hook_file, hook_name): """Determine if a hook file is valid. :param hook_file: The hook file to consider for validity :param hook_name: The hook to find :return: The hook file validity """ filename = os.path.basename(hook_file) basename = os.path.splitext(filename)[0] ma...
[ "Determine", "if", "a", "hook", "file", "is", "valid", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/hooks.py#L26-L40
[ "def", "valid_hook", "(", "hook_file", ",", "hook_name", ")", ":", "filename", "=", "os", ".", "path", ".", "basename", "(", "hook_file", ")", "basename", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "0", "]", "matching_hook", "=...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
find_hook
Return a dict of all hook scripts provided. Must be called with the project template as the current working directory. Dict's key will be the hook/script's name, without extension, while values will be the absolute path to the script. Missing scripts will not be included in the returned dict. :par...
cookiecutter/hooks.py
def find_hook(hook_name, hooks_dir='hooks'): """Return a dict of all hook scripts provided. Must be called with the project template as the current working directory. Dict's key will be the hook/script's name, without extension, while values will be the absolute path to the script. Missing scripts will...
def find_hook(hook_name, hooks_dir='hooks'): """Return a dict of all hook scripts provided. Must be called with the project template as the current working directory. Dict's key will be the hook/script's name, without extension, while values will be the absolute path to the script. Missing scripts will...
[ "Return", "a", "dict", "of", "all", "hook", "scripts", "provided", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/hooks.py#L43-L65
[ "def", "find_hook", "(", "hook_name", ",", "hooks_dir", "=", "'hooks'", ")", ":", "logger", ".", "debug", "(", "'hooks_dir is {}'", ".", "format", "(", "os", ".", "path", ".", "abspath", "(", "hooks_dir", ")", ")", ")", "if", "not", "os", ".", "path", ...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
run_script
Execute a script from a working directory. :param script_path: Absolute path to the script to run. :param cwd: The directory to run the script from.
cookiecutter/hooks.py
def run_script(script_path, cwd='.'): """Execute a script from a working directory. :param script_path: Absolute path to the script to run. :param cwd: The directory to run the script from. """ run_thru_shell = sys.platform.startswith('win') if script_path.endswith('.py'): script_comman...
def run_script(script_path, cwd='.'): """Execute a script from a working directory. :param script_path: Absolute path to the script to run. :param cwd: The directory to run the script from. """ run_thru_shell = sys.platform.startswith('win') if script_path.endswith('.py'): script_comman...
[ "Execute", "a", "script", "from", "a", "working", "directory", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/hooks.py#L68-L101
[ "def", "run_script", "(", "script_path", ",", "cwd", "=", "'.'", ")", ":", "run_thru_shell", "=", "sys", ".", "platform", ".", "startswith", "(", "'win'", ")", "if", "script_path", ".", "endswith", "(", "'.py'", ")", ":", "script_command", "=", "[", "sys...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
run_script_with_context
Execute a script after rendering it with Jinja. :param script_path: Absolute path to the script to run. :param cwd: The directory to run the script from. :param context: Cookiecutter project template context.
cookiecutter/hooks.py
def run_script_with_context(script_path, cwd, context): """Execute a script after rendering it with Jinja. :param script_path: Absolute path to the script to run. :param cwd: The directory to run the script from. :param context: Cookiecutter project template context. """ _, extension = os.path....
def run_script_with_context(script_path, cwd, context): """Execute a script after rendering it with Jinja. :param script_path: Absolute path to the script to run. :param cwd: The directory to run the script from. :param context: Cookiecutter project template context. """ _, extension = os.path....
[ "Execute", "a", "script", "after", "rendering", "it", "with", "Jinja", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/hooks.py#L104-L128
[ "def", "run_script_with_context", "(", "script_path", ",", "cwd", ",", "context", ")", ":", "_", ",", "extension", "=", "os", ".", "path", ".", "splitext", "(", "script_path", ")", "contents", "=", "io", ".", "open", "(", "script_path", ",", "'r'", ",", ...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
run_hook
Try to find and execute a hook from the specified project directory. :param hook_name: The hook to execute. :param project_dir: The directory to execute the script from. :param context: Cookiecutter project context.
cookiecutter/hooks.py
def run_hook(hook_name, project_dir, context): """ Try to find and execute a hook from the specified project directory. :param hook_name: The hook to execute. :param project_dir: The directory to execute the script from. :param context: Cookiecutter project context. """ script = find_hook(h...
def run_hook(hook_name, project_dir, context): """ Try to find and execute a hook from the specified project directory. :param hook_name: The hook to execute. :param project_dir: The directory to execute the script from. :param context: Cookiecutter project context. """ script = find_hook(h...
[ "Try", "to", "find", "and", "execute", "a", "hook", "from", "the", "specified", "project", "directory", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/hooks.py#L131-L144
[ "def", "run_hook", "(", "hook_name", ",", "project_dir", ",", "context", ")", ":", "script", "=", "find_hook", "(", "hook_name", ")", "if", "script", "is", "None", ":", "logger", ".", "debug", "(", "'No {} hook found'", ".", "format", "(", "hook_name", ")"...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
version_msg
Return the Cookiecutter version, location and Python powering it.
cookiecutter/cli.py
def version_msg(): """Return the Cookiecutter version, location and Python powering it.""" python_version = sys.version[:3] location = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) message = u'Cookiecutter %(version)s from {} (Python {})' return message.format(location, python_version)
def version_msg(): """Return the Cookiecutter version, location and Python powering it.""" python_version = sys.version[:3] location = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) message = u'Cookiecutter %(version)s from {} (Python {})' return message.format(location, python_version)
[ "Return", "the", "Cookiecutter", "version", "location", "and", "Python", "powering", "it", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/cli.py#L27-L32
[ "def", "version_msg", "(", ")", ":", "python_version", "=", "sys", ".", "version", "[", ":", "3", "]", "location", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file_...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
validate_extra_context
Validate extra context.
cookiecutter/cli.py
def validate_extra_context(ctx, param, value): """Validate extra context.""" for s in value: if '=' not in s: raise click.BadParameter( 'EXTRA_CONTEXT should contain items of the form key=value; ' "'{}' doesn't match that form".format(s) ) # C...
def validate_extra_context(ctx, param, value): """Validate extra context.""" for s in value: if '=' not in s: raise click.BadParameter( 'EXTRA_CONTEXT should contain items of the form key=value; ' "'{}' doesn't match that form".format(s) ) # C...
[ "Validate", "extra", "context", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/cli.py#L35-L46
[ "def", "validate_extra_context", "(", "ctx", ",", "param", ",", "value", ")", ":", "for", "s", "in", "value", ":", "if", "'='", "not", "in", "s", ":", "raise", "click", ".", "BadParameter", "(", "'EXTRA_CONTEXT should contain items of the form key=value; '", "\"...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
main
Create a project from a Cookiecutter project template (TEMPLATE). Cookiecutter is free and open source software, developed and managed by volunteers. If you would like to help out or fund the project, please get in touch at https://github.com/audreyr/cookiecutter.
cookiecutter/cli.py
def main( template, extra_context, no_input, checkout, verbose, replay, overwrite_if_exists, output_dir, config_file, default_config, debug_file): """Create a project from a Cookiecutter project template (TEMPLATE). Cookiecutter is free and open source software, developed and managed by...
def main( template, extra_context, no_input, checkout, verbose, replay, overwrite_if_exists, output_dir, config_file, default_config, debug_file): """Create a project from a Cookiecutter project template (TEMPLATE). Cookiecutter is free and open source software, developed and managed by...
[ "Create", "a", "project", "from", "a", "Cookiecutter", "project", "template", "(", "TEMPLATE", ")", "." ]
audreyr/cookiecutter
python
https://github.com/audreyr/cookiecutter/blob/3bc7b987e4ae9dcee996ae0b00375c1325b8d866/cookiecutter/cli.py#L91-L142
[ "def", "main", "(", "template", ",", "extra_context", ",", "no_input", ",", "checkout", ",", "verbose", ",", "replay", ",", "overwrite_if_exists", ",", "output_dir", ",", "config_file", ",", "default_config", ",", "debug_file", ")", ":", "# If you _need_ to suppor...
3bc7b987e4ae9dcee996ae0b00375c1325b8d866
train
MountedType.mounted
Mount the UnmountedType instance
graphene/types/mountedtype.py
def mounted(cls, unmounted): # noqa: N802 """ Mount the UnmountedType instance """ assert isinstance(unmounted, UnmountedType), ("{} can't mount {}").format( cls.__name__, repr(unmounted) ) return cls( unmounted.get_type(), *unmounted...
def mounted(cls, unmounted): # noqa: N802 """ Mount the UnmountedType instance """ assert isinstance(unmounted, UnmountedType), ("{} can't mount {}").format( cls.__name__, repr(unmounted) ) return cls( unmounted.get_type(), *unmounted...
[ "Mount", "the", "UnmountedType", "instance" ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/types/mountedtype.py#L7-L20
[ "def", "mounted", "(", "cls", ",", "unmounted", ")", ":", "# noqa: N802", "assert", "isinstance", "(", "unmounted", ",", "UnmountedType", ")", ",", "(", "\"{} can't mount {}\"", ")", ".", "format", "(", "cls", ".", "__name__", ",", "repr", "(", "unmounted", ...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
Parameter.replace
Creates a customized copy of the Parameter.
graphene/pyutils/signature.py
def replace( self, name=_void, kind=_void, annotation=_void, default=_void, _partial_kwarg=_void, ): """Creates a customized copy of the Parameter.""" if name is _void: name = self._name if kind is _void: kind = self._...
def replace( self, name=_void, kind=_void, annotation=_void, default=_void, _partial_kwarg=_void, ): """Creates a customized copy of the Parameter.""" if name is _void: name = self._name if kind is _void: kind = self._...
[ "Creates", "a", "customized", "copy", "of", "the", "Parameter", "." ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/pyutils/signature.py#L288-L319
[ "def", "replace", "(", "self", ",", "name", "=", "_void", ",", "kind", "=", "_void", ",", "annotation", "=", "_void", ",", "default", "=", "_void", ",", "_partial_kwarg", "=", "_void", ",", ")", ":", "if", "name", "is", "_void", ":", "name", "=", "...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
Signature.from_function
Constructs Signature for the given python function
graphene/pyutils/signature.py
def from_function(cls, func): """Constructs Signature for the given python function""" if not isinstance(func, types.FunctionType): raise TypeError("{!r} is not a Python function".format(func)) Parameter = cls._parameter_cls # Parameter information. func_code = fun...
def from_function(cls, func): """Constructs Signature for the given python function""" if not isinstance(func, types.FunctionType): raise TypeError("{!r} is not a Python function".format(func)) Parameter = cls._parameter_cls # Parameter information. func_code = fun...
[ "Constructs", "Signature", "for", "the", "given", "python", "function" ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/pyutils/signature.py#L526-L606
[ "def", "from_function", "(", "cls", ",", "func", ")", ":", "if", "not", "isinstance", "(", "func", ",", "types", ".", "FunctionType", ")", ":", "raise", "TypeError", "(", "\"{!r} is not a Python function\"", ".", "format", "(", "func", ")", ")", "Parameter",...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
Signature.replace
Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy.
graphene/pyutils/signature.py
def replace(self, parameters=_void, return_annotation=_void): """Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy. """ if parameters is _void: parameters = self.parameters.values() ...
def replace(self, parameters=_void, return_annotation=_void): """Creates a customized copy of the Signature. Pass 'parameters' and/or 'return_annotation' arguments to override them in the new copy. """ if parameters is _void: parameters = self.parameters.values() ...
[ "Creates", "a", "customized", "copy", "of", "the", "Signature", ".", "Pass", "parameters", "and", "/", "or", "return_annotation", "arguments", "to", "override", "them", "in", "the", "new", "copy", "." ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/pyutils/signature.py#L619-L631
[ "def", "replace", "(", "self", ",", "parameters", "=", "_void", ",", "return_annotation", "=", "_void", ")", ":", "if", "parameters", "is", "_void", ":", "parameters", "=", "self", ".", "parameters", ".", "values", "(", ")", "if", "return_annotation", "is"...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
Signature._bind
Private method. Don't use directly.
graphene/pyutils/signature.py
def _bind(self, args, kwargs, partial=False): """Private method. Don't use directly.""" arguments = OrderedDict() parameters = iter(self.parameters.values()) parameters_ex = () arg_vals = iter(args) if partial: # Support for binding arguments to 'functools...
def _bind(self, args, kwargs, partial=False): """Private method. Don't use directly.""" arguments = OrderedDict() parameters = iter(self.parameters.values()) parameters_ex = () arg_vals = iter(args) if partial: # Support for binding arguments to 'functools...
[ "Private", "method", ".", "Don", "t", "use", "directly", "." ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/pyutils/signature.py#L672-L806
[ "def", "_bind", "(", "self", ",", "args", ",", "kwargs", ",", "partial", "=", "False", ")", ":", "arguments", "=", "OrderedDict", "(", ")", "parameters", "=", "iter", "(", "self", ".", "parameters", ".", "values", "(", ")", ")", "parameters_ex", "=", ...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
Signature.bind_partial
Get a BoundArguments object, that partially maps the passed `args` and `kwargs` to the function's signature. Raises `TypeError` if the passed arguments can not be bound.
graphene/pyutils/signature.py
def bind_partial(self, *args, **kwargs): """Get a BoundArguments object, that partially maps the passed `args` and `kwargs` to the function's signature. Raises `TypeError` if the passed arguments can not be bound. """ return self._bind(args, kwargs, partial=True)
def bind_partial(self, *args, **kwargs): """Get a BoundArguments object, that partially maps the passed `args` and `kwargs` to the function's signature. Raises `TypeError` if the passed arguments can not be bound. """ return self._bind(args, kwargs, partial=True)
[ "Get", "a", "BoundArguments", "object", "that", "partially", "maps", "the", "passed", "args", "and", "kwargs", "to", "the", "function", "s", "signature", ".", "Raises", "TypeError", "if", "the", "passed", "arguments", "can", "not", "be", "bound", "." ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/pyutils/signature.py#L815-L820
[ "def", "bind_partial", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_bind", "(", "args", ",", "kwargs", ",", "partial", "=", "True", ")" ]
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
is_node
Check if the given objecttype has Node as an interface
graphene/relay/node.py
def is_node(objecttype): """ Check if the given objecttype has Node as an interface """ if not isclass(objecttype): return False if not issubclass(objecttype, ObjectType): return False for i in objecttype._meta.interfaces: if issubclass(i, Node): return True...
def is_node(objecttype): """ Check if the given objecttype has Node as an interface """ if not isclass(objecttype): return False if not issubclass(objecttype, ObjectType): return False for i in objecttype._meta.interfaces: if issubclass(i, Node): return True...
[ "Check", "if", "the", "given", "objecttype", "has", "Node", "as", "an", "interface" ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/relay/node.py#L12-L26
[ "def", "is_node", "(", "objecttype", ")", ":", "if", "not", "isclass", "(", "objecttype", ")", ":", "return", "False", "if", "not", "issubclass", "(", "objecttype", ",", "ObjectType", ")", ":", "return", "False", "for", "i", "in", "objecttype", ".", "_me...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
get_complete_version
Returns a tuple of the graphene version. If version argument is non-empty, then checks for correctness of the tuple provided.
graphene/pyutils/version.py
def get_complete_version(version=None): """Returns a tuple of the graphene version. If version argument is non-empty, then checks for correctness of the tuple provided. """ if version is None: from graphene import VERSION as version else: assert len(version) == 5 assert versi...
def get_complete_version(version=None): """Returns a tuple of the graphene version. If version argument is non-empty, then checks for correctness of the tuple provided. """ if version is None: from graphene import VERSION as version else: assert len(version) == 5 assert versi...
[ "Returns", "a", "tuple", "of", "the", "graphene", "version", ".", "If", "version", "argument", "is", "non", "-", "empty", "then", "checks", "for", "correctness", "of", "the", "tuple", "provided", "." ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/pyutils/version.py#L40-L50
[ "def", "get_complete_version", "(", "version", "=", "None", ")", ":", "if", "version", "is", "None", ":", "from", "graphene", "import", "VERSION", "as", "version", "else", ":", "assert", "len", "(", "version", ")", "==", "5", "assert", "version", "[", "3...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
maybe_thenable
Execute a on_resolve function once the thenable is resolved, returning the same type of object inputed. If the object is not thenable, it should return on_resolve(obj)
graphene/utils/thenables.py
def maybe_thenable(obj, on_resolve): """ Execute a on_resolve function once the thenable is resolved, returning the same type of object inputed. If the object is not thenable, it should return on_resolve(obj) """ if isawaitable(obj) and not isinstance(obj, Promise): return await_and_exec...
def maybe_thenable(obj, on_resolve): """ Execute a on_resolve function once the thenable is resolved, returning the same type of object inputed. If the object is not thenable, it should return on_resolve(obj) """ if isawaitable(obj) and not isinstance(obj, Promise): return await_and_exec...
[ "Execute", "a", "on_resolve", "function", "once", "the", "thenable", "is", "resolved", "returning", "the", "same", "type", "of", "object", "inputed", ".", "If", "the", "object", "is", "not", "thenable", "it", "should", "return", "on_resolve", "(", "obj", ")"...
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/utils/thenables.py#L28-L42
[ "def", "maybe_thenable", "(", "obj", ",", "on_resolve", ")", ":", "if", "isawaitable", "(", "obj", ")", "and", "not", "isinstance", "(", "obj", ",", "Promise", ")", ":", "return", "await_and_execute", "(", "obj", ",", "on_resolve", ")", "if", "is_thenable"...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
get_field_as
Get type mounted
graphene/types/utils.py
def get_field_as(value, _as=None): """ Get type mounted """ if isinstance(value, MountedType): return value elif isinstance(value, UnmountedType): if _as is None: return value return _as.mounted(value)
def get_field_as(value, _as=None): """ Get type mounted """ if isinstance(value, MountedType): return value elif isinstance(value, UnmountedType): if _as is None: return value return _as.mounted(value)
[ "Get", "type", "mounted" ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/types/utils.py#L12-L21
[ "def", "get_field_as", "(", "value", ",", "_as", "=", "None", ")", ":", "if", "isinstance", "(", "value", ",", "MountedType", ")", ":", "return", "value", "elif", "isinstance", "(", "value", ",", "UnmountedType", ")", ":", "if", "_as", "is", "None", ":...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
yank_fields_from_attrs
Extract all the fields in given attributes (dict) and return them ordered
graphene/types/utils.py
def yank_fields_from_attrs(attrs, _as=None, sort=True): """ Extract all the fields in given attributes (dict) and return them ordered """ fields_with_names = [] for attname, value in list(attrs.items()): field = get_field_as(value, _as) if not field: continue ...
def yank_fields_from_attrs(attrs, _as=None, sort=True): """ Extract all the fields in given attributes (dict) and return them ordered """ fields_with_names = [] for attname, value in list(attrs.items()): field = get_field_as(value, _as) if not field: continue ...
[ "Extract", "all", "the", "fields", "in", "given", "attributes", "(", "dict", ")", "and", "return", "them", "ordered" ]
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/types/utils.py#L24-L38
[ "def", "yank_fields_from_attrs", "(", "attrs", ",", "_as", "=", "None", ",", "sort", "=", "True", ")", ":", "fields_with_names", "=", "[", "]", "for", "attname", ",", "value", "in", "list", "(", "attrs", ".", "items", "(", ")", ")", ":", "field", "="...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
import_string
Import a dotted module path and return the attribute/class designated by the last name in the path. When a dotted attribute path is also provided, the dotted attribute path would be applied to the attribute/class retrieved from the first step, and return the corresponding value designated by the attribu...
graphene/utils/module_loading.py
def import_string(dotted_path, dotted_attributes=None): """ Import a dotted module path and return the attribute/class designated by the last name in the path. When a dotted attribute path is also provided, the dotted attribute path would be applied to the attribute/class retrieved from the first st...
def import_string(dotted_path, dotted_attributes=None): """ Import a dotted module path and return the attribute/class designated by the last name in the path. When a dotted attribute path is also provided, the dotted attribute path would be applied to the attribute/class retrieved from the first st...
[ "Import", "a", "dotted", "module", "path", "and", "return", "the", "attribute", "/", "class", "designated", "by", "the", "last", "name", "in", "the", "path", ".", "When", "a", "dotted", "attribute", "path", "is", "also", "provided", "the", "dotted", "attri...
graphql-python/graphene
python
https://github.com/graphql-python/graphene/blob/abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6/graphene/utils/module_loading.py#L5-L42
[ "def", "import_string", "(", "dotted_path", ",", "dotted_attributes", "=", "None", ")", ":", "try", ":", "module_path", ",", "class_name", "=", "dotted_path", ".", "rsplit", "(", "\".\"", ",", "1", ")", "except", "ValueError", ":", "raise", "ImportError", "(...
abff3d75a39bc8f2d1fdb48aafa1866cf47dfff6
train
scan_aggs
Helper function used to iterate over all possible bucket combinations of ``source_aggs``, returning results of ``inner_aggs`` for each. Uses the ``composite`` aggregation under the hood to perform this.
examples/composite_agg.py
def scan_aggs(search, source_aggs, inner_aggs={}, size=10): """ Helper function used to iterate over all possible bucket combinations of ``source_aggs``, returning results of ``inner_aggs`` for each. Uses the ``composite`` aggregation under the hood to perform this. """ def run_search(**kwargs):...
def scan_aggs(search, source_aggs, inner_aggs={}, size=10): """ Helper function used to iterate over all possible bucket combinations of ``source_aggs``, returning results of ``inner_aggs`` for each. Uses the ``composite`` aggregation under the hood to perform this. """ def run_search(**kwargs):...
[ "Helper", "function", "used", "to", "iterate", "over", "all", "possible", "bucket", "combinations", "of", "source_aggs", "returning", "results", "of", "inner_aggs", "for", "each", ".", "Uses", "the", "composite", "aggregation", "under", "the", "hood", "to", "per...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/composite_agg.py#L5-L26
[ "def", "scan_aggs", "(", "search", ",", "source_aggs", ",", "inner_aggs", "=", "{", "}", ",", "size", "=", "10", ")", ":", "def", "run_search", "(", "*", "*", "kwargs", ")", ":", "s", "=", "search", "[", ":", "0", "]", "s", ".", "aggs", ".", "b...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Person.clean
Automatically construct the suggestion input and weight by taking all possible permutation of Person's name as ``input`` and taking their popularity as ``weight``.
examples/completion.py
def clean(self): """ Automatically construct the suggestion input and weight by taking all possible permutation of Person's name as ``input`` and taking their popularity as ``weight``. """ self.suggest = { 'input': [' '.join(p) for p in permutations(self.name....
def clean(self): """ Automatically construct the suggestion input and weight by taking all possible permutation of Person's name as ``input`` and taking their popularity as ``weight``. """ self.suggest = { 'input': [' '.join(p) for p in permutations(self.name....
[ "Automatically", "construct", "the", "suggestion", "input", "and", "weight", "by", "taking", "all", "possible", "permutation", "of", "Person", "s", "name", "as", "input", "and", "taking", "their", "popularity", "as", "weight", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/completion.py#L38-L47
[ "def", "clean", "(", "self", ")", ":", "self", ".", "suggest", "=", "{", "'input'", ":", "[", "' '", ".", "join", "(", "p", ")", "for", "p", "in", "permutations", "(", "self", ".", "name", ".", "split", "(", ")", ")", "]", ",", "'weight'", ":",...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
ObjectBase.__list_fields
Get all the fields defined for our class, if we have an Index, try looking at the index mappings as well, mark the fields from Index as optional.
elasticsearch_dsl/utils.py
def __list_fields(cls): """ Get all the fields defined for our class, if we have an Index, try looking at the index mappings as well, mark the fields from Index as optional. """ for name in cls._doc_type.mapping: field = cls._doc_type.mapping[name] ...
def __list_fields(cls): """ Get all the fields defined for our class, if we have an Index, try looking at the index mappings as well, mark the fields from Index as optional. """ for name in cls._doc_type.mapping: field = cls._doc_type.mapping[name] ...
[ "Get", "all", "the", "fields", "defined", "for", "our", "class", "if", "we", "have", "an", "Index", "try", "looking", "at", "the", "index", "mappings", "as", "well", "mark", "the", "fields", "from", "Index", "as", "optional", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/utils.py#L376-L394
[ "def", "__list_fields", "(", "cls", ")", ":", "for", "name", "in", "cls", ".", "_doc_type", ".", "mapping", ":", "field", "=", "cls", ".", "_doc_type", ".", "mapping", "[", "name", "]", "yield", "name", ",", "field", ",", "False", "if", "hasattr", "(...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
UpdateByQuery._clone
Return a clone of the current search request. Performs a shallow copy of all the underlying objects. Used internally by most state modifying APIs.
elasticsearch_dsl/update_by_query.py
def _clone(self): """ Return a clone of the current search request. Performs a shallow copy of all the underlying objects. Used internally by most state modifying APIs. """ ubq = super(UpdateByQuery, self)._clone() ubq._response_class = self._response_class ...
def _clone(self): """ Return a clone of the current search request. Performs a shallow copy of all the underlying objects. Used internally by most state modifying APIs. """ ubq = super(UpdateByQuery, self)._clone() ubq._response_class = self._response_class ...
[ "Return", "a", "clone", "of", "the", "current", "search", "request", ".", "Performs", "a", "shallow", "copy", "of", "all", "the", "underlying", "objects", ".", "Used", "internally", "by", "most", "state", "modifying", "APIs", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/update_by_query.py#L57-L68
[ "def", "_clone", "(", "self", ")", ":", "ubq", "=", "super", "(", "UpdateByQuery", ",", "self", ")", ".", "_clone", "(", ")", "ubq", ".", "_response_class", "=", "self", ".", "_response_class", "ubq", ".", "_script", "=", "self", ".", "_script", ".", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
UpdateByQuery.response_class
Override the default wrapper used for the response.
elasticsearch_dsl/update_by_query.py
def response_class(self, cls): """ Override the default wrapper used for the response. """ ubq = self._clone() ubq._response_class = cls return ubq
def response_class(self, cls): """ Override the default wrapper used for the response. """ ubq = self._clone() ubq._response_class = cls return ubq
[ "Override", "the", "default", "wrapper", "used", "for", "the", "response", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/update_by_query.py#L70-L76
[ "def", "response_class", "(", "self", ",", "cls", ")", ":", "ubq", "=", "self", ".", "_clone", "(", ")", "ubq", ".", "_response_class", "=", "cls", "return", "ubq" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
train
UpdateByQuery.update_from_dict
Apply options from a serialized body to the current instance. Modifies the object in-place. Used mostly by ``from_dict``.
elasticsearch_dsl/update_by_query.py
def update_from_dict(self, d): """ Apply options from a serialized body to the current instance. Modifies the object in-place. Used mostly by ``from_dict``. """ d = d.copy() if 'query' in d: self.query._proxied = Q(d.pop('query')) if 'script' in d: ...
def update_from_dict(self, d): """ Apply options from a serialized body to the current instance. Modifies the object in-place. Used mostly by ``from_dict``. """ d = d.copy() if 'query' in d: self.query._proxied = Q(d.pop('query')) if 'script' in d: ...
[ "Apply", "options", "from", "a", "serialized", "body", "to", "the", "current", "instance", ".", "Modifies", "the", "object", "in", "-", "place", ".", "Used", "mostly", "by", "from_dict", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/update_by_query.py#L78-L89
[ "def", "update_from_dict", "(", "self", ",", "d", ")", ":", "d", "=", "d", ".", "copy", "(", ")", "if", "'query'", "in", "d", ":", "self", ".", "query", ".", "_proxied", "=", "Q", "(", "d", ".", "pop", "(", "'query'", ")", ")", "if", "'script'"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
UpdateByQuery.script
Define update action to take: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html for more details. Note: the API only accepts a single script, so calling the script multiple times will overwrite. Example:: ubq = Search() ...
elasticsearch_dsl/update_by_query.py
def script(self, **kwargs): """ Define update action to take: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html for more details. Note: the API only accepts a single script, so calling the script multiple times will overwrite. ...
def script(self, **kwargs): """ Define update action to take: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html for more details. Note: the API only accepts a single script, so calling the script multiple times will overwrite. ...
[ "Define", "update", "action", "to", "take", ":", "https", ":", "//", "www", ".", "elastic", ".", "co", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", "current", "/", "modules", "-", "scripting", "-", "using", ".", "html", "for", ...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/update_by_query.py#L91-L111
[ "def", "script", "(", "self", ",", "*", "*", "kwargs", ")", ":", "ubq", "=", "self", ".", "_clone", "(", ")", "if", "ubq", ".", "_script", ":", "ubq", ".", "_script", "=", "{", "}", "ubq", ".", "_script", ".", "update", "(", "kwargs", ")", "ret...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
UpdateByQuery.to_dict
Serialize the search into the dictionary that will be sent over as the request'ubq body. All additional keyword arguments will be included into the dictionary.
elasticsearch_dsl/update_by_query.py
def to_dict(self, **kwargs): """ Serialize the search into the dictionary that will be sent over as the request'ubq body. All additional keyword arguments will be included into the dictionary. """ d = {} if self.query: d["query"] = self.query.to_dict(...
def to_dict(self, **kwargs): """ Serialize the search into the dictionary that will be sent over as the request'ubq body. All additional keyword arguments will be included into the dictionary. """ d = {} if self.query: d["query"] = self.query.to_dict(...
[ "Serialize", "the", "search", "into", "the", "dictionary", "that", "will", "be", "sent", "over", "as", "the", "request", "ubq", "body", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/update_by_query.py#L113-L130
[ "def", "to_dict", "(", "self", ",", "*", "*", "kwargs", ")", ":", "d", "=", "{", "}", "if", "self", ".", "query", ":", "d", "[", "\"query\"", "]", "=", "self", ".", "query", ".", "to_dict", "(", ")", "if", "self", ".", "_script", ":", "d", "[...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
UpdateByQuery.execute
Execute the search and return an instance of ``Response`` wrapping all the data.
elasticsearch_dsl/update_by_query.py
def execute(self): """ Execute the search and return an instance of ``Response`` wrapping all the data. """ es = connections.get_connection(self._using) self._response = self._response_class( self, es.update_by_query( index=self._i...
def execute(self): """ Execute the search and return an instance of ``Response`` wrapping all the data. """ es = connections.get_connection(self._using) self._response = self._response_class( self, es.update_by_query( index=self._i...
[ "Execute", "the", "search", "and", "return", "an", "instance", "of", "Response", "wrapping", "all", "the", "data", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/update_by_query.py#L132-L147
[ "def", "execute", "(", "self", ")", ":", "es", "=", "connections", ".", "get_connection", "(", "self", ".", "_using", ")", "self", ".", "_response", "=", "self", ".", "_response_class", "(", "self", ",", "es", ".", "update_by_query", "(", "index", "=", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Properties._collect_fields
Iterate over all Field objects within, including multi fields.
elasticsearch_dsl/mapping.py
def _collect_fields(self): """ Iterate over all Field objects within, including multi fields. """ for f in itervalues(self.properties.to_dict()): yield f # multi fields if hasattr(f, 'fields'): for inner_f in itervalues(f.fields.to_dict()): ...
def _collect_fields(self): """ Iterate over all Field objects within, including multi fields. """ for f in itervalues(self.properties.to_dict()): yield f # multi fields if hasattr(f, 'fields'): for inner_f in itervalues(f.fields.to_dict()): ...
[ "Iterate", "over", "all", "Field", "objects", "within", "including", "multi", "fields", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/mapping.py#L40-L51
[ "def", "_collect_fields", "(", "self", ")", ":", "for", "f", "in", "itervalues", "(", "self", ".", "properties", ".", "to_dict", "(", ")", ")", ":", "yield", "f", "# multi fields", "if", "hasattr", "(", "f", ",", "'fields'", ")", ":", "for", "inner_f",...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.clone
Create a copy of the instance with another name or connection alias. Useful for creating multiple indices with shared configuration:: i = Index('base-index') i.settings(number_of_shards=1) i.create() i2 = i.clone('other-index') i2.create() :...
elasticsearch_dsl/index.py
def clone(self, name=None, using=None): """ Create a copy of the instance with another name or connection alias. Useful for creating multiple indices with shared configuration:: i = Index('base-index') i.settings(number_of_shards=1) i.create() i2...
def clone(self, name=None, using=None): """ Create a copy of the instance with another name or connection alias. Useful for creating multiple indices with shared configuration:: i = Index('base-index') i.settings(number_of_shards=1) i.create() i2...
[ "Create", "a", "copy", "of", "the", "instance", "with", "another", "name", "or", "connection", "alias", ".", "Useful", "for", "creating", "multiple", "indices", "with", "shared", "configuration", "::" ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L81-L103
[ "def", "clone", "(", "self", ",", "name", "=", "None", ",", "using", "=", "None", ")", ":", "i", "=", "Index", "(", "name", "or", "self", ".", "_name", ",", "using", "=", "using", "or", "self", ".", "_using", ")", "i", ".", "_settings", "=", "s...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.document
Associate a :class:`~elasticsearch_dsl.Document` subclass with an index. This means that, when this index is created, it will contain the mappings for the ``Document``. If the ``Document`` class doesn't have a default index yet (by defining ``class Index``), this instance will be used. C...
elasticsearch_dsl/index.py
def document(self, document): """ Associate a :class:`~elasticsearch_dsl.Document` subclass with an index. This means that, when this index is created, it will contain the mappings for the ``Document``. If the ``Document`` class doesn't have a default index yet (by defining ``cla...
def document(self, document): """ Associate a :class:`~elasticsearch_dsl.Document` subclass with an index. This means that, when this index is created, it will contain the mappings for the ``Document``. If the ``Document`` class doesn't have a default index yet (by defining ``cla...
[ "Associate", "a", ":", "class", ":", "~elasticsearch_dsl", ".", "Document", "subclass", "with", "an", "index", ".", "This", "means", "that", "when", "this", "index", "is", "created", "it", "will", "contain", "the", "mappings", "for", "the", "Document", ".", ...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L121-L150
[ "def", "document", "(", "self", ",", "document", ")", ":", "self", ".", "_doc_types", ".", "append", "(", "document", ")", "# If the document index does not have any name, that means the user", "# did not set any index already to the document.", "# So set this index as document i...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.analyzer
Explicitly add an analyzer to an index. Note that all custom analyzers defined in mappings will also be created. This is useful for search analyzers. Example:: from elasticsearch_dsl import analyzer, tokenizer my_analyzer = analyzer('my_analyzer', tokenizer=tok...
elasticsearch_dsl/index.py
def analyzer(self, *args, **kwargs): """ Explicitly add an analyzer to an index. Note that all custom analyzers defined in mappings will also be created. This is useful for search analyzers. Example:: from elasticsearch_dsl import analyzer, tokenizer my_analyze...
def analyzer(self, *args, **kwargs): """ Explicitly add an analyzer to an index. Note that all custom analyzers defined in mappings will also be created. This is useful for search analyzers. Example:: from elasticsearch_dsl import analyzer, tokenizer my_analyze...
[ "Explicitly", "add", "an", "analyzer", "to", "an", "index", ".", "Note", "that", "all", "custom", "analyzers", "defined", "in", "mappings", "will", "also", "be", "created", ".", "This", "is", "useful", "for", "search", "analyzers", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L175-L200
[ "def", "analyzer", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "analyzer", "=", "analysis", ".", "analyzer", "(", "*", "args", ",", "*", "*", "kwargs", ")", "d", "=", "analyzer", ".", "get_analysis_definition", "(", ")", "# empt...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.search
Return a :class:`~elasticsearch_dsl.Search` object searching over the index (or all the indices belonging to this template) and its ``Document``\\s.
elasticsearch_dsl/index.py
def search(self, using=None): """ Return a :class:`~elasticsearch_dsl.Search` object searching over the index (or all the indices belonging to this template) and its ``Document``\\s. """ return Search( using=using or self._using, index=self._name, ...
def search(self, using=None): """ Return a :class:`~elasticsearch_dsl.Search` object searching over the index (or all the indices belonging to this template) and its ``Document``\\s. """ return Search( using=using or self._using, index=self._name, ...
[ "Return", "a", ":", "class", ":", "~elasticsearch_dsl", ".", "Search", "object", "searching", "over", "the", "index", "(", "or", "all", "the", "indices", "belonging", "to", "this", "template", ")", "and", "its", "Document", "\\\\", "s", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L221-L231
[ "def", "search", "(", "self", ",", "using", "=", "None", ")", ":", "return", "Search", "(", "using", "=", "using", "or", "self", ".", "_using", ",", "index", "=", "self", ".", "_name", ",", "doc_type", "=", "self", ".", "_doc_types", ")" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.updateByQuery
Return a :class:`~elasticsearch_dsl.UpdateByQuery` object searching over the index (or all the indices belonging to this template) and updating Documents that match the search criteria. For more information, see here: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-...
elasticsearch_dsl/index.py
def updateByQuery(self, using=None): """ Return a :class:`~elasticsearch_dsl.UpdateByQuery` object searching over the index (or all the indices belonging to this template) and updating Documents that match the search criteria. For more information, see here: https://www....
def updateByQuery(self, using=None): """ Return a :class:`~elasticsearch_dsl.UpdateByQuery` object searching over the index (or all the indices belonging to this template) and updating Documents that match the search criteria. For more information, see here: https://www....
[ "Return", "a", ":", "class", ":", "~elasticsearch_dsl", ".", "UpdateByQuery", "object", "searching", "over", "the", "index", "(", "or", "all", "the", "indices", "belonging", "to", "this", "template", ")", "and", "updating", "Documents", "that", "match", "the",...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L233-L245
[ "def", "updateByQuery", "(", "self", ",", "using", "=", "None", ")", ":", "return", "UpdateByQuery", "(", "using", "=", "using", "or", "self", ".", "_using", ",", "index", "=", "self", ".", "_name", ",", ")" ]
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.create
Creates the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.create`` unchanged.
elasticsearch_dsl/index.py
def create(self, using=None, **kwargs): """ Creates the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.create`` unchanged. """ self._get_connection(using).indices.create(index=self._name, body=self.to_dict(), **kwargs)
def create(self, using=None, **kwargs): """ Creates the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.create`` unchanged. """ self._get_connection(using).indices.create(index=self._name, body=self.to_dict(), **kwargs)
[ "Creates", "the", "index", "in", "elasticsearch", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L247-L254
[ "def", "create", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "create", "(", "index", "=", "self", ".", "_name", ",", "body", "=", "self", ".", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.save
Sync the index definition with elasticsearch, creating the index if it doesn't exist and updating its settings and mappings if it does. Note some settings and mapping changes cannot be done on an open index (or at all on an existing index) and for those this method will fail with the un...
elasticsearch_dsl/index.py
def save(self, using=None): """ Sync the index definition with elasticsearch, creating the index if it doesn't exist and updating its settings and mappings if it does. Note some settings and mapping changes cannot be done on an open index (or at all on an existing index) and for...
def save(self, using=None): """ Sync the index definition with elasticsearch, creating the index if it doesn't exist and updating its settings and mappings if it does. Note some settings and mapping changes cannot be done on an open index (or at all on an existing index) and for...
[ "Sync", "the", "index", "definition", "with", "elasticsearch", "creating", "the", "index", "if", "it", "doesn", "t", "exist", "and", "updating", "its", "settings", "and", "mappings", "if", "it", "does", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L260-L307
[ "def", "save", "(", "self", ",", "using", "=", "None", ")", ":", "if", "not", "self", ".", "exists", "(", "using", "=", "using", ")", ":", "return", "self", ".", "create", "(", "using", "=", "using", ")", "body", "=", "self", ".", "to_dict", "(",...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.analyze
Perform the analysis process on a text and return the tokens breakdown of the text. Any additional keyword arguments will be passed to ``Elasticsearch.indices.analyze`` unchanged.
elasticsearch_dsl/index.py
def analyze(self, using=None, **kwargs): """ Perform the analysis process on a text and return the tokens breakdown of the text. Any additional keyword arguments will be passed to ``Elasticsearch.indices.analyze`` unchanged. """ return self._get_connection(using)...
def analyze(self, using=None, **kwargs): """ Perform the analysis process on a text and return the tokens breakdown of the text. Any additional keyword arguments will be passed to ``Elasticsearch.indices.analyze`` unchanged. """ return self._get_connection(using)...
[ "Perform", "the", "analysis", "process", "on", "a", "text", "and", "return", "the", "tokens", "breakdown", "of", "the", "text", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L309-L317
[ "def", "analyze", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "analyze", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwarg...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.refresh
Preforms a refresh operation on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.refresh`` unchanged.
elasticsearch_dsl/index.py
def refresh(self, using=None, **kwargs): """ Preforms a refresh operation on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.refresh`` unchanged. """ return self._get_connection(using).indices.refresh(index=self._name, **kwargs)
def refresh(self, using=None, **kwargs): """ Preforms a refresh operation on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.refresh`` unchanged. """ return self._get_connection(using).indices.refresh(index=self._name, **kwargs)
[ "Preforms", "a", "refresh", "operation", "on", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L319-L326
[ "def", "refresh", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "refresh", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwarg...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.flush
Preforms a flush operation on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush`` unchanged.
elasticsearch_dsl/index.py
def flush(self, using=None, **kwargs): """ Preforms a flush operation on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush`` unchanged. """ return self._get_connection(using).indices.flush(index=self._name, **kwargs)
def flush(self, using=None, **kwargs): """ Preforms a flush operation on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush`` unchanged. """ return self._get_connection(using).indices.flush(index=self._name, **kwargs)
[ "Preforms", "a", "flush", "operation", "on", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L328-L335
[ "def", "flush", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "flush", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.get
The get index API allows to retrieve information about the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get`` unchanged.
elasticsearch_dsl/index.py
def get(self, using=None, **kwargs): """ The get index API allows to retrieve information about the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get`` unchanged. """ return self._get_connection(using).indices.get(index=self._name, **k...
def get(self, using=None, **kwargs): """ The get index API allows to retrieve information about the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get`` unchanged. """ return self._get_connection(using).indices.get(index=self._name, **k...
[ "The", "get", "index", "API", "allows", "to", "retrieve", "information", "about", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L337-L344
[ "def", "get", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs", ")...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.open
Opens the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.open`` unchanged.
elasticsearch_dsl/index.py
def open(self, using=None, **kwargs): """ Opens the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.open`` unchanged. """ return self._get_connection(using).indices.open(index=self._name, **kwargs)
def open(self, using=None, **kwargs): """ Opens the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.open`` unchanged. """ return self._get_connection(using).indices.open(index=self._name, **kwargs)
[ "Opens", "the", "index", "in", "elasticsearch", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L346-L353
[ "def", "open", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "open", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.close
Closes the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.close`` unchanged.
elasticsearch_dsl/index.py
def close(self, using=None, **kwargs): """ Closes the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.close`` unchanged. """ return self._get_connection(using).indices.close(index=self._name, **kwargs)
def close(self, using=None, **kwargs): """ Closes the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.close`` unchanged. """ return self._get_connection(using).indices.close(index=self._name, **kwargs)
[ "Closes", "the", "index", "in", "elasticsearch", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L355-L362
[ "def", "close", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "close", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.delete
Deletes the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete`` unchanged.
elasticsearch_dsl/index.py
def delete(self, using=None, **kwargs): """ Deletes the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete`` unchanged. """ return self._get_connection(using).indices.delete(index=self._name, **kwargs)
def delete(self, using=None, **kwargs): """ Deletes the index in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete`` unchanged. """ return self._get_connection(using).indices.delete(index=self._name, **kwargs)
[ "Deletes", "the", "index", "in", "elasticsearch", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L364-L371
[ "def", "delete", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "delete", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.exists
Returns ``True`` if the index already exists in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists`` unchanged.
elasticsearch_dsl/index.py
def exists(self, using=None, **kwargs): """ Returns ``True`` if the index already exists in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists`` unchanged. """ return self._get_connection(using).indices.exists(index=self._nam...
def exists(self, using=None, **kwargs): """ Returns ``True`` if the index already exists in elasticsearch. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists`` unchanged. """ return self._get_connection(using).indices.exists(index=self._nam...
[ "Returns", "True", "if", "the", "index", "already", "exists", "in", "elasticsearch", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L373-L380
[ "def", "exists", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "exists", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.exists_type
Check if a type/types exists in the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_type`` unchanged.
elasticsearch_dsl/index.py
def exists_type(self, using=None, **kwargs): """ Check if a type/types exists in the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_type`` unchanged. """ return self._get_connection(using).indices.exists_type(index=self._name, **...
def exists_type(self, using=None, **kwargs): """ Check if a type/types exists in the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_type`` unchanged. """ return self._get_connection(using).indices.exists_type(index=self._name, **...
[ "Check", "if", "a", "type", "/", "types", "exists", "in", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L382-L389
[ "def", "exists_type", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "exists_type", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.put_mapping
Register specific mapping definition for a specific type. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_mapping`` unchanged.
elasticsearch_dsl/index.py
def put_mapping(self, using=None, **kwargs): """ Register specific mapping definition for a specific type. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_mapping`` unchanged. """ return self._get_connection(using).indices.put_mapping(index...
def put_mapping(self, using=None, **kwargs): """ Register specific mapping definition for a specific type. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_mapping`` unchanged. """ return self._get_connection(using).indices.put_mapping(index...
[ "Register", "specific", "mapping", "definition", "for", "a", "specific", "type", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L391-L398
[ "def", "put_mapping", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "put_mapping", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.get_mapping
Retrieve specific mapping definition for a specific type. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_mapping`` unchanged.
elasticsearch_dsl/index.py
def get_mapping(self, using=None, **kwargs): """ Retrieve specific mapping definition for a specific type. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_mapping`` unchanged. """ return self._get_connection(using).indices.get_mapping(index...
def get_mapping(self, using=None, **kwargs): """ Retrieve specific mapping definition for a specific type. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_mapping`` unchanged. """ return self._get_connection(using).indices.get_mapping(index...
[ "Retrieve", "specific", "mapping", "definition", "for", "a", "specific", "type", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L400-L407
[ "def", "get_mapping", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_mapping", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.get_field_mapping
Retrieve mapping definition of a specific field. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_field_mapping`` unchanged.
elasticsearch_dsl/index.py
def get_field_mapping(self, using=None, **kwargs): """ Retrieve mapping definition of a specific field. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_field_mapping`` unchanged. """ return self._get_connection(using).indices.get_field_mapp...
def get_field_mapping(self, using=None, **kwargs): """ Retrieve mapping definition of a specific field. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_field_mapping`` unchanged. """ return self._get_connection(using).indices.get_field_mapp...
[ "Retrieve", "mapping", "definition", "of", "a", "specific", "field", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L409-L416
[ "def", "get_field_mapping", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_field_mapping", "(", "index", "=", "self", ".", "_name", ",", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.put_alias
Create an alias for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_alias`` unchanged.
elasticsearch_dsl/index.py
def put_alias(self, using=None, **kwargs): """ Create an alias for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_alias`` unchanged. """ return self._get_connection(using).indices.put_alias(index=self._name, **kwargs)
def put_alias(self, using=None, **kwargs): """ Create an alias for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_alias`` unchanged. """ return self._get_connection(using).indices.put_alias(index=self._name, **kwargs)
[ "Create", "an", "alias", "for", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L418-L425
[ "def", "put_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "put_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "k...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.exists_alias
Return a boolean indicating whether given alias exists for this index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_alias`` unchanged.
elasticsearch_dsl/index.py
def exists_alias(self, using=None, **kwargs): """ Return a boolean indicating whether given alias exists for this index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_alias`` unchanged. """ return self._get_connection(using).indices.ex...
def exists_alias(self, using=None, **kwargs): """ Return a boolean indicating whether given alias exists for this index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.exists_alias`` unchanged. """ return self._get_connection(using).indices.ex...
[ "Return", "a", "boolean", "indicating", "whether", "given", "alias", "exists", "for", "this", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L427-L434
[ "def", "exists_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "exists_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.get_alias
Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged.
elasticsearch_dsl/index.py
def get_alias(self, using=None, **kwargs): """ Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged. """ return self._get_connection(using).indices.get_alias(index=self._name, **kwargs)
def get_alias(self, using=None, **kwargs): """ Retrieve a specified alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_alias`` unchanged. """ return self._get_connection(using).indices.get_alias(index=self._name, **kwargs)
[ "Retrieve", "a", "specified", "alias", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L436-L443
[ "def", "get_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "k...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.delete_alias
Delete specific alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete_alias`` unchanged.
elasticsearch_dsl/index.py
def delete_alias(self, using=None, **kwargs): """ Delete specific alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete_alias`` unchanged. """ return self._get_connection(using).indices.delete_alias(index=self._name, **kwargs)
def delete_alias(self, using=None, **kwargs): """ Delete specific alias. Any additional keyword arguments will be passed to ``Elasticsearch.indices.delete_alias`` unchanged. """ return self._get_connection(using).indices.delete_alias(index=self._name, **kwargs)
[ "Delete", "specific", "alias", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L445-L452
[ "def", "delete_alias", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "delete_alias", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.get_settings
Retrieve settings for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_settings`` unchanged.
elasticsearch_dsl/index.py
def get_settings(self, using=None, **kwargs): """ Retrieve settings for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_settings`` unchanged. """ return self._get_connection(using).indices.get_settings(index=self._name, **kwargs)
def get_settings(self, using=None, **kwargs): """ Retrieve settings for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_settings`` unchanged. """ return self._get_connection(using).indices.get_settings(index=self._name, **kwargs)
[ "Retrieve", "settings", "for", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L454-L461
[ "def", "get_settings", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_settings", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.put_settings
Change specific index level settings in real time. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_settings`` unchanged.
elasticsearch_dsl/index.py
def put_settings(self, using=None, **kwargs): """ Change specific index level settings in real time. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_settings`` unchanged. """ return self._get_connection(using).indices.put_settings(index=sel...
def put_settings(self, using=None, **kwargs): """ Change specific index level settings in real time. Any additional keyword arguments will be passed to ``Elasticsearch.indices.put_settings`` unchanged. """ return self._get_connection(using).indices.put_settings(index=sel...
[ "Change", "specific", "index", "level", "settings", "in", "real", "time", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L463-L470
[ "def", "put_settings", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "put_settings", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.stats
Retrieve statistics on different operations happening on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.stats`` unchanged.
elasticsearch_dsl/index.py
def stats(self, using=None, **kwargs): """ Retrieve statistics on different operations happening on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.stats`` unchanged. """ return self._get_connection(using).indices.stats(index=self._n...
def stats(self, using=None, **kwargs): """ Retrieve statistics on different operations happening on the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.stats`` unchanged. """ return self._get_connection(using).indices.stats(index=self._n...
[ "Retrieve", "statistics", "on", "different", "operations", "happening", "on", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L472-L479
[ "def", "stats", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "stats", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.segments
Provide low level segments information that a Lucene index (shard level) is built with. Any additional keyword arguments will be passed to ``Elasticsearch.indices.segments`` unchanged.
elasticsearch_dsl/index.py
def segments(self, using=None, **kwargs): """ Provide low level segments information that a Lucene index (shard level) is built with. Any additional keyword arguments will be passed to ``Elasticsearch.indices.segments`` unchanged. """ return self._get_connection(...
def segments(self, using=None, **kwargs): """ Provide low level segments information that a Lucene index (shard level) is built with. Any additional keyword arguments will be passed to ``Elasticsearch.indices.segments`` unchanged. """ return self._get_connection(...
[ "Provide", "low", "level", "segments", "information", "that", "a", "Lucene", "index", "(", "shard", "level", ")", "is", "built", "with", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L481-L489
[ "def", "segments", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "segments", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwa...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.validate_query
Validate a potentially expensive query without executing it. Any additional keyword arguments will be passed to ``Elasticsearch.indices.validate_query`` unchanged.
elasticsearch_dsl/index.py
def validate_query(self, using=None, **kwargs): """ Validate a potentially expensive query without executing it. Any additional keyword arguments will be passed to ``Elasticsearch.indices.validate_query`` unchanged. """ return self._get_connection(using).indices.validate...
def validate_query(self, using=None, **kwargs): """ Validate a potentially expensive query without executing it. Any additional keyword arguments will be passed to ``Elasticsearch.indices.validate_query`` unchanged. """ return self._get_connection(using).indices.validate...
[ "Validate", "a", "potentially", "expensive", "query", "without", "executing", "it", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L491-L498
[ "def", "validate_query", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "validate_query", "(", "index", "=", "self", ".", "_name", ",", "*", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.clear_cache
Clear all caches or specific cached associated with the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.clear_cache`` unchanged.
elasticsearch_dsl/index.py
def clear_cache(self, using=None, **kwargs): """ Clear all caches or specific cached associated with the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.clear_cache`` unchanged. """ return self._get_connection(using).indices.clear_cache(...
def clear_cache(self, using=None, **kwargs): """ Clear all caches or specific cached associated with the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.clear_cache`` unchanged. """ return self._get_connection(using).indices.clear_cache(...
[ "Clear", "all", "caches", "or", "specific", "cached", "associated", "with", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L500-L507
[ "def", "clear_cache", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "clear_cache", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.recovery
The indices recovery API provides insight into on-going shard recoveries for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.recovery`` unchanged.
elasticsearch_dsl/index.py
def recovery(self, using=None, **kwargs): """ The indices recovery API provides insight into on-going shard recoveries for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.recovery`` unchanged. """ return self._get_connection(...
def recovery(self, using=None, **kwargs): """ The indices recovery API provides insight into on-going shard recoveries for the index. Any additional keyword arguments will be passed to ``Elasticsearch.indices.recovery`` unchanged. """ return self._get_connection(...
[ "The", "indices", "recovery", "API", "provides", "insight", "into", "on", "-", "going", "shard", "recoveries", "for", "the", "index", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L509-L517
[ "def", "recovery", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "recovery", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwa...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.upgrade
Upgrade the index to the latest format. Any additional keyword arguments will be passed to ``Elasticsearch.indices.upgrade`` unchanged.
elasticsearch_dsl/index.py
def upgrade(self, using=None, **kwargs): """ Upgrade the index to the latest format. Any additional keyword arguments will be passed to ``Elasticsearch.indices.upgrade`` unchanged. """ return self._get_connection(using).indices.upgrade(index=self._name, **kwargs)
def upgrade(self, using=None, **kwargs): """ Upgrade the index to the latest format. Any additional keyword arguments will be passed to ``Elasticsearch.indices.upgrade`` unchanged. """ return self._get_connection(using).indices.upgrade(index=self._name, **kwargs)
[ "Upgrade", "the", "index", "to", "the", "latest", "format", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L519-L526
[ "def", "upgrade", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "upgrade", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwarg...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.get_upgrade
Monitor how much of the index is upgraded. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_upgrade`` unchanged.
elasticsearch_dsl/index.py
def get_upgrade(self, using=None, **kwargs): """ Monitor how much of the index is upgraded. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_upgrade`` unchanged. """ return self._get_connection(using).indices.get_upgrade(index=self._name, **...
def get_upgrade(self, using=None, **kwargs): """ Monitor how much of the index is upgraded. Any additional keyword arguments will be passed to ``Elasticsearch.indices.get_upgrade`` unchanged. """ return self._get_connection(using).indices.get_upgrade(index=self._name, **...
[ "Monitor", "how", "much", "of", "the", "index", "is", "upgraded", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L528-L535
[ "def", "get_upgrade", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "get_upgrade", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.flush_synced
Perform a normal flush, then add a generated unique marker (sync_id) to all shards. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush_synced`` unchanged.
elasticsearch_dsl/index.py
def flush_synced(self, using=None, **kwargs): """ Perform a normal flush, then add a generated unique marker (sync_id) to all shards. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush_synced`` unchanged. """ return self._get_connect...
def flush_synced(self, using=None, **kwargs): """ Perform a normal flush, then add a generated unique marker (sync_id) to all shards. Any additional keyword arguments will be passed to ``Elasticsearch.indices.flush_synced`` unchanged. """ return self._get_connect...
[ "Perform", "a", "normal", "flush", "then", "add", "a", "generated", "unique", "marker", "(", "sync_id", ")", "to", "all", "shards", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L537-L545
[ "def", "flush_synced", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "flush_synced", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.shard_stores
Provides store information for shard copies of the index. Store information reports on which nodes shard copies exist, the shard copy version, indicating how recent they are, and any exceptions encountered while opening the shard index or from earlier engine failure. Any additional keyw...
elasticsearch_dsl/index.py
def shard_stores(self, using=None, **kwargs): """ Provides store information for shard copies of the index. Store information reports on which nodes shard copies exist, the shard copy version, indicating how recent they are, and any exceptions encountered while opening the shard ...
def shard_stores(self, using=None, **kwargs): """ Provides store information for shard copies of the index. Store information reports on which nodes shard copies exist, the shard copy version, indicating how recent they are, and any exceptions encountered while opening the shard ...
[ "Provides", "store", "information", "for", "shard", "copies", "of", "the", "index", ".", "Store", "information", "reports", "on", "which", "nodes", "shard", "copies", "exist", "the", "shard", "copy", "version", "indicating", "how", "recent", "they", "are", "an...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L547-L557
[ "def", "shard_stores", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "shard_stores", "(", "index", "=", "self", ".", "_name", ",", "*", "*"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.forcemerge
The force merge API allows to force merging of the index through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by merging them. This call will block until the merge is complet...
elasticsearch_dsl/index.py
def forcemerge(self, using=None, **kwargs): """ The force merge API allows to force merging of the index through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by mergin...
def forcemerge(self, using=None, **kwargs): """ The force merge API allows to force merging of the index through an API. The merge relates to the number of segments a Lucene index holds within each shard. The force merge operation allows to reduce the number of segments by mergin...
[ "The", "force", "merge", "API", "allows", "to", "force", "merging", "of", "the", "index", "through", "an", "API", ".", "The", "merge", "relates", "to", "the", "number", "of", "segments", "a", "Lucene", "index", "holds", "within", "each", "shard", ".", "T...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L559-L573
[ "def", "forcemerge", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "forcemerge", "(", "index", "=", "self", ".", "_name", ",", "*", "*", ...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Index.shrink
The shrink index API allows you to shrink an existing index into a new index with fewer primary shards. The number of primary shards in the target index must be a factor of the shards in the source index. For example an index with 8 primary shards can be shrunk into 4, 2 or 1 primary sha...
elasticsearch_dsl/index.py
def shrink(self, using=None, **kwargs): """ The shrink index API allows you to shrink an existing index into a new index with fewer primary shards. The number of primary shards in the target index must be a factor of the shards in the source index. For example an index with 8 pri...
def shrink(self, using=None, **kwargs): """ The shrink index API allows you to shrink an existing index into a new index with fewer primary shards. The number of primary shards in the target index must be a factor of the shards in the source index. For example an index with 8 pri...
[ "The", "shrink", "index", "API", "allows", "you", "to", "shrink", "an", "existing", "index", "into", "a", "new", "index", "with", "fewer", "primary", "shards", ".", "The", "number", "of", "primary", "shards", "in", "the", "target", "index", "must", "be", ...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/index.py#L575-L590
[ "def", "shrink", "(", "self", ",", "using", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "_get_connection", "(", "using", ")", ".", "indices", ".", "shrink", "(", "index", "=", "self", ".", "_name", ",", "*", "*", "kwargs"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Connections.configure
Configure multiple connections at once, useful for passing in config dictionaries obtained from other sources, like Django's settings or a configuration management tool. Example:: connections.configure( default={'hosts': 'localhost'}, dev={'hosts': [...
elasticsearch_dsl/connections.py
def configure(self, **kwargs): """ Configure multiple connections at once, useful for passing in config dictionaries obtained from other sources, like Django's settings or a configuration management tool. Example:: connections.configure( default={'ho...
def configure(self, **kwargs): """ Configure multiple connections at once, useful for passing in config dictionaries obtained from other sources, like Django's settings or a configuration management tool. Example:: connections.configure( default={'ho...
[ "Configure", "multiple", "connections", "at", "once", "useful", "for", "passing", "in", "config", "dictionaries", "obtained", "from", "other", "sources", "like", "Django", "s", "settings", "or", "a", "configuration", "management", "tool", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L16-L37
[ "def", "configure", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "k", "in", "list", "(", "self", ".", "_conns", ")", ":", "# try and preserve existing client to keep the persistent connections alive", "if", "k", "in", "self", ".", "_kwargs", "and", "...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Connections.remove_connection
Remove connection from the registry. Raises ``KeyError`` if connection wasn't found.
elasticsearch_dsl/connections.py
def remove_connection(self, alias): """ Remove connection from the registry. Raises ``KeyError`` if connection wasn't found. """ errors = 0 for d in (self._conns, self._kwargs): try: del d[alias] except KeyError: err...
def remove_connection(self, alias): """ Remove connection from the registry. Raises ``KeyError`` if connection wasn't found. """ errors = 0 for d in (self._conns, self._kwargs): try: del d[alias] except KeyError: err...
[ "Remove", "connection", "from", "the", "registry", ".", "Raises", "KeyError", "if", "connection", "wasn", "t", "found", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L45-L58
[ "def", "remove_connection", "(", "self", ",", "alias", ")", ":", "errors", "=", "0", "for", "d", "in", "(", "self", ".", "_conns", ",", "self", ".", "_kwargs", ")", ":", "try", ":", "del", "d", "[", "alias", "]", "except", "KeyError", ":", "errors"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Connections.create_connection
Construct an instance of ``elasticsearch.Elasticsearch`` and register it under given alias.
elasticsearch_dsl/connections.py
def create_connection(self, alias='default', **kwargs): """ Construct an instance of ``elasticsearch.Elasticsearch`` and register it under given alias. """ kwargs.setdefault('serializer', serializer) conn = self._conns[alias] = Elasticsearch(**kwargs) return conn
def create_connection(self, alias='default', **kwargs): """ Construct an instance of ``elasticsearch.Elasticsearch`` and register it under given alias. """ kwargs.setdefault('serializer', serializer) conn = self._conns[alias] = Elasticsearch(**kwargs) return conn
[ "Construct", "an", "instance", "of", "elasticsearch", ".", "Elasticsearch", "and", "register", "it", "under", "given", "alias", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L60-L67
[ "def", "create_connection", "(", "self", ",", "alias", "=", "'default'", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'serializer'", ",", "serializer", ")", "conn", "=", "self", ".", "_conns", "[", "alias", "]", "=", "Elasticsear...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
Connections.get_connection
Retrieve a connection, construct it if necessary (only configuration was passed to us). If a non-string alias has been passed through we assume it's already a client instance and will just return it as-is. Raises ``KeyError`` if no client (or its definition) is registered under the alia...
elasticsearch_dsl/connections.py
def get_connection(self, alias='default'): """ Retrieve a connection, construct it if necessary (only configuration was passed to us). If a non-string alias has been passed through we assume it's already a client instance and will just return it as-is. Raises ``KeyError`` if no ...
def get_connection(self, alias='default'): """ Retrieve a connection, construct it if necessary (only configuration was passed to us). If a non-string alias has been passed through we assume it's already a client instance and will just return it as-is. Raises ``KeyError`` if no ...
[ "Retrieve", "a", "connection", "construct", "it", "if", "necessary", "(", "only", "configuration", "was", "passed", "to", "us", ")", ".", "If", "a", "non", "-", "string", "alias", "has", "been", "passed", "through", "we", "assume", "it", "s", "already", ...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/connections.py#L69-L94
[ "def", "get_connection", "(", "self", ",", "alias", "=", "'default'", ")", ":", "# do not check isinstance(Elasticsearch) so that people can wrap their", "# clients", "if", "not", "isinstance", "(", "alias", ",", "string_types", ")", ":", "return", "alias", "# connectio...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
setup
Create the index template in elasticsearch specifying the mappings and any settings to be used. This can be run at any time, ideally at every new code deploy.
examples/alias_migration.py
def setup(): """ Create the index template in elasticsearch specifying the mappings and any settings to be used. This can be run at any time, ideally at every new code deploy. """ # create an index template index_template = BlogPost._index.as_template(ALIAS, PATTERN) # upload the templat...
def setup(): """ Create the index template in elasticsearch specifying the mappings and any settings to be used. This can be run at any time, ideally at every new code deploy. """ # create an index template index_template = BlogPost._index.as_template(ALIAS, PATTERN) # upload the templat...
[ "Create", "the", "index", "template", "in", "elasticsearch", "specifying", "the", "mappings", "and", "any", "settings", "to", "be", "used", ".", "This", "can", "be", "run", "at", "any", "time", "ideally", "at", "every", "new", "code", "deploy", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/alias_migration.py#L54-L68
[ "def", "setup", "(", ")", ":", "# create an index template", "index_template", "=", "BlogPost", ".", "_index", ".", "as_template", "(", "ALIAS", ",", "PATTERN", ")", "# upload the template into elasticsearch", "# potentially overriding the one already there", "index_template"...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
migrate
Upgrade function that creates a new index for the data. Optionally it also can (and by default will) reindex previous copy of the data into the new index (specify ``move_data=False`` to skip this step) and update the alias to point to the latest index (set ``update_alias=False`` to skip). Note that whi...
examples/alias_migration.py
def migrate(move_data=True, update_alias=True): """ Upgrade function that creates a new index for the data. Optionally it also can (and by default will) reindex previous copy of the data into the new index (specify ``move_data=False`` to skip this step) and update the alias to point to the latest in...
def migrate(move_data=True, update_alias=True): """ Upgrade function that creates a new index for the data. Optionally it also can (and by default will) reindex previous copy of the data into the new index (specify ``move_data=False`` to skip this step) and update the alias to point to the latest in...
[ "Upgrade", "function", "that", "creates", "a", "new", "index", "for", "the", "data", ".", "Optionally", "it", "also", "can", "(", "and", "by", "default", "will", ")", "reindex", "previous", "copy", "of", "the", "data", "into", "the", "new", "index", "(",...
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/examples/alias_migration.py#L70-L106
[ "def", "migrate", "(", "move_data", "=", "True", ",", "update_alias", "=", "True", ")", ":", "# construct a new index name by appending current timestamp", "next_index", "=", "PATTERN", ".", "replace", "(", "'*'", ",", "datetime", ".", "now", "(", ")", ".", "str...
874b52472fc47b601de0e5fa0e4300e21aff0085
train
CustomAnalyzer.simulate
Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all token attributes for each token. You can filter token attributes you want to output ...
elasticsearch_dsl/analysis.py
def simulate(self, text, using='default', explain=False, attributes=None): """ Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all t...
def simulate(self, text, using='default', explain=False, attributes=None): """ Use the Analyze API of elasticsearch to test the outcome of this analyzer. :arg text: Text to be analyzed :arg using: connection alias to use, defaults to ``'default'`` :arg explain: will output all t...
[ "Use", "the", "Analyze", "API", "of", "elasticsearch", "to", "test", "the", "outcome", "of", "this", "analyzer", "." ]
elastic/elasticsearch-dsl-py
python
https://github.com/elastic/elasticsearch-dsl-py/blob/874b52472fc47b601de0e5fa0e4300e21aff0085/elasticsearch_dsl/analysis.py#L85-L120
[ "def", "simulate", "(", "self", ",", "text", ",", "using", "=", "'default'", ",", "explain", "=", "False", ",", "attributes", "=", "None", ")", ":", "es", "=", "connections", ".", "get_connection", "(", "using", ")", "body", "=", "{", "'text'", ":", ...
874b52472fc47b601de0e5fa0e4300e21aff0085