Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line after this snippet: <|code_start|>"""Script defined to test the Plan class.""" class TestPlan(BaseTestCase): """Class to test Plans.""" @httpretty.activate def test_create(self): """Method defined to test plan creation.""" httpretty.register_uri( httpre...
response = Plan.create(
Continue the code snippet: <|code_start|>format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): parsed_statements = list(parse(tokens1)) assert parsed_statements == statements2 @pytest.mark....
Identifier('ident'),
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): parsed_statements = list(parse(tokens1)) assert parsed_statements == st...
([Token(Token.WHERE, ''), Token(Token.IDENTIFIER, '')], InvalidCondition),
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): parsed_statements = list(parse(tokens1)) assert parsed_statements == stateme...
with pytest.raises(InvalidIdentifier):
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): parsed_statements = list(parse(tokens1)) ...
([Token(Token.LIMIT, '')], InvalidLimit),
Next line prediction: <|code_start|>Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): parsed_statements = list(parse(tokens1)) assert parsed_statements == statements2 @pytest.mark.parametrize(('tokens', 'exception'), [ ...
Number('1'),
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): parsed_statements = list(parse(tokens1)) assert parsed_statements == stateme...
_parse_identifier([])
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): <|code_end|> . Use current file imports: import pytest from format_sql.pars...
parsed_statements = list(parse(tokens1))
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def assert_statements(tokens1, statements2): parsed_statements = list(parse(tokens1)) assert parsed_statements == stat...
([Token(Token.LIMIT, '')], InvalidLimit),
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def _match(toks, types_list): if len(toks) < len(types_list): return False for tok, types i...
Token.IDENTIFIER: Identifier,
Predict the next line for this snippet: <|code_start|> ('<>', (Token.COMPARE, '<>')), ('<', (Token.COMPARE, '<')), ('>', (Token.COMPARE, '>')), ('!=', (Token.COMPARE, '!=')), ('>=', (Token.COMPARE, '>=')), ('<=', (Token.COMPARE, '<=')), ]) def test_tokenize_compare(sql, expected_token): token...
with pytest.raises(StringNotTerminated):
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ try: except ImportError: def assert_tokens(tokens1, tokens2): tokens2 = list(tokens2) for tk1, tk...
(Token.GROUP_BY, 'GROUP BY'),
Here is a snippet: <|code_start|> ]), ('select count\n(distinct(1)) from my_table', [ (Token.SELECT, 'select'), (Token.FUNC, 'count'), (Token.PARENTHESIS_OPEN, '('), (Token.FUNC, 'distinct'), (Token.PARENTHESIS_OPEN, '('), (Token.NUMBER, '1'), (Token.PAREN...
assert_tokens(tokens, tokenize(sql))
Given snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def format_sql(s, debug=False): tokens = list(tokenize(s)) if debug: print_non_data('Tokens: %s' % tokens) <|code_end...
parsed = list(parse(tokens))
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def format_sql(s, debug=False): tokens = list(tokenize(s)) if debug: print_non_data('Tokens: %s' % tokens) ...
styled = style(parsed)
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def format_sql(s, debug=False): <|code_end|> with the help of current file imports: from format_sql.parser...
tokens = list(tokenize(s))
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def format_sql(s, debug=False): tokens = list(tokenize(s)) if debug: <|code_end|> . Write the next line using the current...
print_non_data('Tokens: %s' % tokens)
Given the following code snippet before the placeholder: <|code_start|> liner.add_to_line(' '.join('%s' % x for x in condition.values)) i += 1 liner.end_line() if types_match(condition, [Not, Func, Operator, Number]): liner.add_to_line('NOT') liner.add...
Between,
Using the snippet: <|code_start|> liner.end_line() def _style_insert(insert, liner, indent): liner.add_line('INSERT INTO') liner.add_line(' %s' % insert.table) if insert.cols: liner.add_to_last_line(' (%s)' % ', '.join('%s' % x for x in insert.cols)) ...
elif isinstance(value, Case):
Continue the code snippet: <|code_start|> if isinstance(value, Join): liner.add_to_line(' ' * (indent + 1)) liner.add_to_line(value.value.upper()) liner.add_to_line(' ') _style_identifier(from_.values[i + 1], liner, end_line=False) if i + 2 < len(f...
elif isinstance(v, Condition):
Continue the code snippet: <|code_start|> def _style_select(select, liner, indent): liner.add_line(' ' * indent + select.value.upper()) for i, value in enumerate(select.values): liner.add_to_line(' ' * (indent + 1)) if isinstance(value, (Identifier, Str, Number)): _style_iden...
From: _style_from,
Predict the next line for this snippet: <|code_start|> liner.add_to_line(value.value.upper()) liner.add_to_line(' ') _style_identifier(from_.values[i + 1], liner, end_line=False) if i + 2 < len(from_.values) and isinstance(from_.values[i + 2], On): liner....
if isinstance(vv, Func):
Predict the next line after this snippet: <|code_start|> def _style_select(select, liner, indent): liner.add_line(' ' * indent + select.value.upper()) for i, value in enumerate(select.values): liner.add_to_line(' ' * (indent + 1)) if isinstance(value, (Identifier, Str, Number)): ...
GroupBy: _style_group_by,
Using the snippet: <|code_start|>def _style_select(select, liner, indent): liner.add_line(' ' * indent + select.value.upper()) for i, value in enumerate(select.values): liner.add_to_line(' ' * (indent + 1)) if isinstance(value, (Identifier, Str, Number)): _style_identifier(val...
Having: _style_having,
Predict the next line after this snippet: <|code_start|> if identifier.as_: liner.add_to_line(' AS') if identifier.alias: liner.add_to_line(' ') liner.add_to_line(identifier.alias) if end_line: liner.end_line() def _style_from(from_, liner, indent): liner.add_line(' ...
elif isinstance(value, Identifier):
Predict the next line for this snippet: <|code_start|> liner.add_line(' ' * indent + select.value.upper()) for i, value in enumerate(select.values): liner.add_to_line(' ' * (indent + 1)) if isinstance(value, (Identifier, Str, Number)): _style_identifier(value, liner, end_line=F...
Insert: _style_insert,
Based on the snippet: <|code_start|> if i + 1 < len(select.values): liner.add_to_line(',') liner.end_line() def _style_semicolon(semicolon, liner, indent): liner.add_to_last_line(semicolon.value) def style(statements, indent=0, keyword_upper=True, liner=None): if not liner: ...
raise InvalidSQL()
Predict the next line after this snippet: <|code_start|> liner.add_to_line(' ') liner.add_to_line(condition.values[2]) liner.add_to_line(' ') liner.add_to_line(condition.values[3]) i += 1 liner.end_line() def _style_condition(condition, liner, indent): ...
elif types_match(condition, [(Identifier, Number, Str), Is, Null]):
Continue the code snippet: <|code_start|> self.line = [] def add_to_last_line(self, val): line = self.lines.pop() self.add_to_line(line) self.add_to_line(val) self.end_line() def _style_identifier(identifier, liner, end_line=True): liner.add_to_line(identifier) if ...
if isinstance(value, Join):
Predict the next line after this snippet: <|code_start|> for i, value in enumerate(select.values): liner.add_to_line(' ' * (indent + 1)) if isinstance(value, (Identifier, Str, Number)): _style_identifier(value, liner, end_line=False) elif isinstance(value, Case): ...
Limit: _style_limit,
Given the code snippet: <|code_start|> i = 0 while i < len(from_.values): value = from_.values[i] if isinstance(value, Join): liner.add_to_line(' ' * (indent + 1)) liner.add_to_line(value.value.upper()) liner.add_to_line(' ') _style_identifier(...
if isinstance(v, Link):
Continue the code snippet: <|code_start|> liner.add_to_line(' ' * (indent + 1) + '%s' % value) if value.sort: sort = value.sort.upper() liner.add_to_line(' %s' % sort) if i + 1 < len(order_by.values): liner.add_to_line(',') liner.end_line() def ...
if types_match(condition, [Not, Func, Operator, Number]):
Given snippet: <|code_start|> liner.add_to_line(' ') liner.add_to_line(condition.values[2]) liner.add_to_line(' ') liner.add_to_line(condition.values[3]) i += 1 liner.end_line() def _style_condition(condition, liner, indent): if len(condition.values...
elif types_match(condition, [(Identifier, Number, Str), Is, Null]):
Predict the next line for this snippet: <|code_start|> def _style_order_by(order_by, liner, indent): liner.add_line(' ' * indent + 'ORDER BY') for i, value in enumerate(order_by.values): liner.add_to_line(' ' * (indent + 1) + '%s' % value) if value.sort: sort = value.sort.upp...
if types_match(condition, [Identifier, Operator, Number]):
Given the following code snippet before the placeholder: <|code_start|> def _style_identifier(identifier, liner, end_line=True): liner.add_to_line(identifier) if identifier.as_: liner.add_to_line(' AS') if identifier.alias: liner.add_to_line(' ') liner.add_to_line(identifier.alias...
if i + 2 < len(from_.values) and isinstance(from_.values[i + 2], On):
Next line prediction: <|code_start|> def _style_order_by(order_by, liner, indent): liner.add_line(' ' * indent + 'ORDER BY') for i, value in enumerate(order_by.values): liner.add_to_line(' ' * (indent + 1) + '%s' % value) if value.sort: sort = value.sort.upper() l...
if types_match(condition, [Identifier, Operator, Number]):
Based on the snippet: <|code_start|> for i, value in enumerate(select.values): liner.add_to_line(' ' * (indent + 1)) if isinstance(value, (Identifier, Str, Number)): _style_identifier(value, liner, end_line=False) elif isinstance(value, Case): _style_case(value, li...
OrderBy: _style_order_by,
Based on the snippet: <|code_start|> liner.add_to_line(' ' * (indent + 1)) if isinstance(value, (Identifier, Str, Number)): _style_identifier(value, liner, end_line=False) elif isinstance(value, Case): _style_case(value, liner, indent) elif isinstance(value, F...
Select: _style_select,
Next line prediction: <|code_start|> if isinstance(value, (Identifier, Str, Number)): _style_identifier(value, liner, end_line=False) elif isinstance(value, Case): _style_case(value, liner, indent) elif isinstance(value, Func): _style_func(value, liner, end_l...
Semicolon: _style_semicolon,
Given the code snippet: <|code_start|> if isinstance(having.values[i], Link): liner.add_to_line('%s ' % having.values[i].value.upper()) i += 1 condition = having.values[i] if types_match(condition, [Identifier, Operator, Number]): liner.add_to_line(' '.join('...
if types_match(condition, [(Identifier, Number, Str),
Given the code snippet: <|code_start|> elif types_match(condition, [(Identifier, Number, Str), Between, (Identifier, Number, Str), Link, (Identifier, Number, Str)]): liner.add_t...
elif types_match(condition, [Identifier, Operator, SubSelect]):
Here is a snippet: <|code_start|> _style_identifier(value, liner, end_line=False) elif isinstance(value, Case): _style_case(value, liner, indent) elif isinstance(value, Func): _style_func(value, liner, end_line=False) if i + 1 < len(select.values): ...
Where: _style_where,
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ from __future__ import unicode_literals def assert_func_style(statements1, styled2): <|code_end|> with the...
liner = Liner()
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ from __future__ import unicode_literals def assert_func_style(statements1, styled2): liner = Liner() <|code_end|> , gen...
_style_func(statements1[0], liner)
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ from __future__ import unicode_literals def assert_func_style(statements1, styled2): l...
assert style(statements1) == styled2
Next line prediction: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def test_(): <|code_end|> . Use current file imports: (import pytest from format_sql.parser import InvalidSQL from format_sql.shor...
with pytest.raises(InvalidSQL):
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ def test_(): with pytest.raises(InvalidSQL): <|code_end|> , predict the next line using impo...
format_sql("Select x T K")
Given the code snippet: <|code_start|>def get_statements(lines): regex = r'(\s*)[_\w\d\.]*\s*=*\s*[_\w\d\.]*\s*\(*("""|\'\'\')(\s*.*?;*\s*)\2' queries = re.findall(regex, lines, re.DOTALL) for indent, query_quote_start, query in queries: indent = indent.strip('\n') indent += ' ' * 4 ...
except InvalidSQL as e:
Here is a snippet: <|code_start|> def get_statements(lines): regex = r'(\s*)[_\w\d\.]*\s*=*\s*[_\w\d\.]*\s*\(*("""|\'\'\')(\s*.*?;*\s*)\2' queries = re.findall(regex, lines, re.DOTALL) for indent, query_quote_start, query in queries: indent = indent.strip('\n') indent += ' ' * 4 old_...
fmt = format_sql(query, debug)
Next line prediction: <|code_start|> fmt = format_sql(query, debug) except InvalidSQL as e: print_non_data(e) continue fs = [] for line in fmt: s = '%s%s' % (indent, line) fs.append(s.rstrip()) lines = lines.replace(old_query, ...
print_data(lines)
Given the following code snippet before the placeholder: <|code_start|> return args def _get_filenames(paths, recursive): filenames = set() for path in paths: path = os.path.abspath(path) if os.path.isfile(path): filenames.add(path) elif os.path.isdir(path): ...
print_non_data(filename)
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- """ format-sql Makes your SQL readable. Copyright (c) 2014-2015, Friedrich Paetzke (paetzke@fastmail.fm) All rights reserved. """ try: except ImportError: @pytest.mark.parametrize('args, expected_paths, expected_types', [ ('file1 file2 --types sql --t...
args = _get_args(args.split())
Given snippet: <|code_start|>def test_multiple_statements_per_sql_file(test_data, filename, expected_filename): test_filename = test_data.get_path(filename) expected_filename = test_data.get_path(expected_filename) result = handle_sql_file(test_filename) with open(expected_filename) as f: expe...
old_query, query, indent = next(get_statements(input_))
Continue the code snippet: <|code_start|> assert mocked_write_back.call_count == 2 expected_paths = ['three.py', 'sub_dir/five.py'] for path, expected in zip_longest(arguments, sorted(expected_paths)): assert path.endswith('format-sql/tests/data/test_00/%s' % expected) @pytest.mark.parametri...
result = handle_py_file(test_filename)
Continue the code snippet: <|code_start|> def test_find_py_in_directory(test_data): args = '%s -r --types py' % test_data.get_path('test_00') args = args.split() with patch('format_sql.main.handle_py_file') as mocked_handle_py_file, \ patch('format_sql.main._write_back') as mocked_write_back: ...
result = handle_sql_file(test_filename)
Here is a snippet: <|code_start|> try: except ImportError: @pytest.mark.parametrize('args, expected_paths, expected_types', [ ('file1 file2 --types sql --types py', ['file1', 'file2'], ['sql', 'py']), ('file1 --types py --types sql', ['file1'], ['py', 'sql']), ('file1 file2 --types sql', ['file1', 'file2'...
main(args)
Here is a snippet: <|code_start|> "gamma": ("alpha",), "gaussian": ("sigma",), "negativebinomial": ("alpha",), "t": ("sigma", "nu"), "vonmises": ("kappa",), "wald": ("lam",), } def _extract_family_prior(family, priors): """Extract priors for a given family If a key in the priors dictio...
elif isinstance(family, Family):
Given the following code snippet before the placeholder: <|code_start|> def test_listify(): assert listify(None) == [] assert listify([1, 2, 3]) == [1, 2, 3] assert listify("giraffe") == ["giraffe"] def test_probit(): <|code_end|> , predict the next line using imports from the current file: import nump...
x = probit(np.random.normal(scale=10000, size=100)).eval()
Given the code snippet: <|code_start|> def test_listify(): assert listify(None) == [] assert listify([1, 2, 3]) == [1, 2, 3] assert listify("giraffe") == ["giraffe"] def test_probit(): x = probit(np.random.normal(scale=10000, size=100)).eval() assert (x > 0).all() and (x < 1).all() def test_cl...
x = cloglog(np.random.normal(scale=10000, size=100)).eval()
Predict the next line for this snippet: <|code_start|> full_model = self.mle # Get log-likelihood values from beta=0 to beta=MLE beta_mle = full_model.params[name].item() beta_seq = np.linspace(0, beta_mle, points) log_likelihood = get_llh(self.model, exog, full_model, name,...
if isinstance(self.model.family, (Gaussian, StudentT)):
Continue the code snippet: <|code_start|> full_model = self.mle # Get log-likelihood values from beta=0 to beta=MLE beta_mle = full_model.params[name].item() beta_seq = np.linspace(0, beta_mle, points) log_likelihood = get_llh(self.model, exog, full_model, name, values, beta...
if isinstance(self.model.family, (Gaussian, StudentT)):
Given the following code snippet before the placeholder: <|code_start|> beta_mle = full_model.params[name].item() beta_seq = np.linspace(0, beta_mle, points) log_likelihood = get_llh(self.model, exog, full_model, name, values, beta_seq) coef_a, coef_b = get_llh_coeffs(log_likelihood, bet...
priors["sigma"] = Prior("HalfStudentT", nu=4, sigma=sigma)
Given the code snippet: <|code_start|> >>> family = bmb.Family("bernoulli", likelihood, "logit") """ SUPPORTED_LINKS = [ "cloglog", "identity", "inverse_squared", "inverse", "log", "logit", "probit", "softmax", "tan_2", ] def _...
self._link = Link(x)
Given snippet: <|code_start|> A function that maps the response to the linear predictor. Known as the :math:`g` function in GLM jargon. Does not need to be specified when ``name`` is a known name. linkinv: function A function that maps the linear predictor to the response. Known as the :math:...
return f"{self.__class__.__name__}({spacify(multilinify(args))}\n)"
Given the following code snippet before the placeholder: <|code_start|> A function that maps the response to the linear predictor. Known as the :math:`g` function in GLM jargon. Does not need to be specified when ``name`` is a known name. linkinv: function A function that maps the linear pred...
return f"{self.__class__.__name__}({spacify(multilinify(args))}\n)"
Based on the snippet: <|code_start|> if priors and args: difference = set(args) - set(priors) if len(difference) > 0: raise ValueError(f"'{self.name}' misses priors for the parameters {difference}") # And check priors passed are in fact of class Prior ...
if any(not isinstance(prior, (Prior, int, float)) for prior in priors.values()):
Given the following code snippet before the placeholder: <|code_start|> x = self.DISTRIBUTIONS[self.name]["parent"] elif x not in self.DISTRIBUTIONS[self.name]["params"]: raise ValueError(f"'{x}' is not a valid parameter for the likelihood '{self.name}'") # Otherwise, ...
return f"{self.__class__.__name__}({spacify(multilinify(args))}\n)"
Given the following code snippet before the placeholder: <|code_start|> x = self.DISTRIBUTIONS[self.name]["parent"] elif x not in self.DISTRIBUTIONS[self.name]["params"]: raise ValueError(f"'{x}' is not a valid parameter for the likelihood '{self.name}'") # Otherwise, ...
return f"{self.__class__.__name__}({spacify(multilinify(args))}\n)"
Here is a snippet: <|code_start|> class PriorScaler: """Scale prior distributions parameters.""" # Standard deviation multiplier. STD = 2.5 def __init__(self, model): self.model = model self.has_intercept = model.intercept_term is not None self.priors = {} # Compute...
if isinstance(self.model.family, (Gaussian, StudentT)):
Given snippet: <|code_start|> class PriorScaler: """Scale prior distributions parameters.""" # Standard deviation multiplier. STD = 2.5 def __init__(self, model): self.model = model self.has_intercept = model.intercept_term is not None self.priors = {} # Compute mea...
if isinstance(self.model.family, (Gaussian, StudentT)):
Given the code snippet: <|code_start|> # Compute mean and std of the response if isinstance(self.model.family, (Gaussian, StudentT)): self.response_mean = np.mean(model.response.data) self.response_std = np.std(self.model.response.data) else: self.response_mea...
elif isinstance(self.model.family, VonMises):
Next line prediction: <|code_start|> self.priors = {} # Compute mean and std of the response if isinstance(self.model.family, (Gaussian, StudentT)): self.response_mean = np.mean(model.response.data) self.response_std = np.std(self.model.response.data) else: ...
priors["sigma"] = Prior("HalfStudentT", nu=4, sigma=self.response_std)
Predict the next line after this snippet: <|code_start|># Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
out.write(StrUtils.decode_base64(response.text))
Given snippet: <|code_start|># Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
version=__version__,
Predict the next line after this snippet: <|code_start|># # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # ...
OSCAR('init')
Given the code snippet: <|code_start|>#! /usr/bin/python # Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
ecr = IAM({})
Continue the code snippet: <|code_start|>#! /usr/bin/python # Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
cwl = CloudWatchLogs({})
Based on the snippet: <|code_start|># Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and #...
result = FDLParser().parse_yaml('fdl.yaml')
Next line prediction: <|code_start|>#! /usr/bin/python # Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
ecr = ECR({})
Predict the next line for this snippet: <|code_start|> text_message = f'Service \'{resources_info["name"]}\' successfully created on cluster \'{resources_info.get("cluster_id")}\'.' _print_generic_response(resources_info, output_type, text_message, result) def parse_service_deletion(resources_info: Dict, outpu...
if output_type == OutputType.PLAIN_TEXT.value:
Continue the code snippet: <|code_start|> # Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
oscar = OSCARClient({"endpoint": "url", "auth_user": "user", "auth_password": "pass", "ssl_verify": False}, "cid")
Using the snippet: <|code_start|># http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the s...
with self.assertRaises(ServiceCreationError) as ex:
Continue the code snippet: <|code_start|> def test_create_serviced(self, post): response = MagicMock(["status_code", "text"]) response.status_code = 201 post.return_value = response oscar = OSCARClient({"endpoint": "url", "auth_user": "user", "auth_password": "pass", "ssl_verify": Fal...
with self.assertRaises(ServiceDeletionError) as ex:
Here is a snippet: <|code_start|> response = MagicMock(["status_code", "text"]) response.status_code = 204 delete.return_value = response oscar = OSCARClient({"endpoint": "url", "auth_user": "user", "auth_password": "pass", "ssl_verify": False}, "cid") oscar.delete_service("sname"...
with self.assertRaises(ServiceNotFoundError) as ex:
Predict the next line after this snippet: <|code_start|> response.status_code = 200 response.json.return_value = {"key": "value"} get.return_value = response oscar = OSCARClient({"endpoint": "url", "auth_user": "user", "auth_password": "pass", "ssl_verify": False}, "cid") self.ass...
with self.assertRaises(ListServicesError) as ex:
Predict the next line for this snippet: <|code_start|>#! /usr/bin/python # Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
rg = ResourceGroups({})
Given the following code snippet before the placeholder: <|code_start|># Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
DataTypesUtils.merge_dicts_with_copy(conf.get(provider,{}), function)
Using the snippet: <|code_start|>#! /usr/bin/python # Copyright (C) GRyCAP - I3M - UPV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
ecr = APIGateway({})
Given the code snippet: <|code_start|> url = f'https://api.github.com/repos/{user}/{project}/releases/latest' response = request.get_file(url) if response: response = json.loads(response) return response.get('tag_name', '') else: return None @stati...
raise GitHubTagNotFoundError(tag=tag_name)
Given the following code snippet before the placeholder: <|code_start|> tar.extractall(path=destination_path) @staticmethod def unzip_folder(zip_path: str, folder_where_unzip_path: str, msg: str='') -> None: """Must use the unzip binary to preserve the file properties and the symlinks.""" ...
raise YamlFileNotFoundError(file_path=file_path)
Next line prediction: <|code_start|> sys.path.append('..') class DataItem: def __init__(self, x, y, block, code_id): self.x = x self.y = y self.block = block self.code_id = code_id <|code_end|> . Use current file imports: (import numpy as np import random import torch.nn as nn ...
class DataInstructionEmbedding(Data):
Given the code snippet: <|code_start|> DATA = dict( subject='Re: Saying Hello', from_='jdoe@machine.example', to=('smith@home.example',), cc=(), bcc=(), reply_to=(), date=datetime.datetime(1997, 11, 21, 11, 0, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))), date_str='Fri, 21 No...
from_values=EmailAddress('John Doe', 'jdoe@machine.example', 'John Doe <jdoe@machine.example>'),
Given snippet: <|code_start|> DATA = dict( subject='Daily Data: D09.ZPH (Averaged data)', from_='status@sender.com', to=('data@email.com',), cc=(), bcc=(), reply_to=(), date=datetime.datetime(2020, 11, 9, 14, 49, 7, tzinfo=datetime.timezone(datetime.timedelta(-1, 57600))), date_str='Mon,...
from_values=EmailAddress('Sender', 'status@sender.com', 'Sender <status@sender.com>'),
Given the following code snippet before the placeholder: <|code_start|> DATA = dict( subject='Redacted', from_='redacted@flashmail.net', to=('redacted@Enron.com',), cc=(), bcc=(), reply_to=(), date=datetime.datetime(1900, 1, 1, 0, 0), date_str='', text='', html='<p>foo</p>\n', ...
from_values=EmailAddress('', 'redacted@flashmail.net', 'redacted@flashmail.net'),
Given snippet: <|code_start|> DATA = dict( subject='', from_='xxx@xxxx.xxx', to=('xxxxxxxxxxx@xxxx.xxxx.xxx',), cc=(), bcc=(), reply_to=(), date=datetime.datetime(2005, 5, 10, 15, 27, 3, tzinfo=datetime.timezone(datetime.timedelta(-1, 68400))), date_str='Tue, 10 May 2005 15:27:03 -0500',...
from_values=EmailAddress('', 'xxx@xxxx.xxx', 'xxx@xxxx.xxx'),
Based on the snippet: <|code_start|> DATA = dict( subject='Saying Hello', from_='jdoe@machine.example', to=('mary@example.net',), cc=(), bcc=(), reply_to=(), date=datetime.datetime(1997, 11, 21, 9, 55, 6, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))), date_str='Fri, 21 Nov 199...
from_values=EmailAddress('John Doe', 'jdoe@machine.example', 'John Doe <jdoe@machine.example>'),
Based on the snippet: <|code_start|> DATA = dict( subject='', from_='john.q.public@example.com', to=('mary@example.net', 'jdoe@test.example'), cc=(), bcc=(), reply_to=(), date=datetime.datetime(2003, 7, 1, 10, 52, 37, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))), date_str='Tue,...
from_values=EmailAddress('Joe Q. Public', 'john.q.public@example.com', 'Joe Q. Public <john.q.public@example.com>'),
Given the code snippet: <|code_start|> DATA = dict( subject='testing', from_='foo@example.com', to=('blah@example.com',), cc=(), bcc=(), reply_to=(), date=datetime.datetime(2005, 6, 6, 22, 21, 22, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))), date_str='Mon, 6 Jun 2005 22:21:22 ...
from_values=EmailAddress('', 'foo@example.com', 'foo@example.com'),
Given the code snippet: <|code_start|> DATA = dict( subject='Impress your clients with a business phone��� ', from_='info@here2there-travelers-msgs.net', to=('anyone@YAHOO.COM',), cc=(), bcc=(), reply_to=('44.41.17.14.11.2010.1139.1.328.1477949.614@reply.here2there-travelers-msgs.net',), dat...
from_values=EmailAddress('Biz Phone Systems from EclipseMediaOnline��', 'info@here2there-travelers-msgs.net', 'Biz Phone Systems from EclipseMediaOnline�� <info@here2there-travelers-msgs.net>'),
Given snippet: <|code_start|> DATA = dict( subject='Saying Hello', from_='jdoe@machine.example', to=('mary@example.net',), cc=(), bcc=(), reply_to=(), date=datetime.datetime(1997, 11, 21, 9, 55, 6, tzinfo=datetime.timezone(datetime.timedelta(-1, 64800))), date_str='Fri, 21 Nov 1997 09:55...
from_values=EmailAddress('John Doe', 'jdoe@machine.example', 'John Doe <jdoe@machine.example>'),