Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Given snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_migrate, top_sync, ...
def main():
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_mig...
try:
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_migrate, to...
except ClickException:
Next line prediction: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_migrate, top_...
],
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_migrate, ...
try:
Next line prediction: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_migrate, top_...
cli(obj={})
Using the snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_migrate, top_syn...
)
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- from __future__ import print_function cli = click.CommandCollection( sources=[ top_account, top_config, top_execute, top_hosting, top_init, top_instance, top_level, top_migrate, top_...
)
Using the snippet: <|code_start|> def _process_field_with_type(cls, key, value, processed_object, files, reference_map): if value['__type'] == ParseFieldTypeE.DATE: processed_object[key.lower()] = value['iso'] elif value['__type'] == ParseFieldTypeE.POINTER: processed_object[k...
else:
Next line prediction: <|code_start|># -*- coding: utf-8 -*- class SyncanoSchema(object): def __init__(self, class_name, schema, relations): self.class_name = class_name self.schema = schema self.relations = relations def process_relations(self): pass @property def ...
map = {
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class SyncanoSchema(object): def __init__(self, class_name, schema, relations): self.class_name = class_name self.schema = schema self.relations = relations def process_relations(self): pass @property def has...
'Date': 'datetime',
Given the code snippet: <|code_start|># coding=UTF8 from __future__ import print_function, unicode_literals ALLOWED_TYPES = {"array", "boolean", "datetime", "file", "float", "geopoint", "integer", "object", "reference", "relation", "string", "text"} ALLOWED_PERMISIONS = ('none', 'r...
value = tokens.pop(0).lower()
Given the code snippet: <|code_start|># -*- coding: utf-8 -*- @click.group() def top_level(): pass <|code_end|> , generate the next line using the imports in this file: import os import click import syncano from syncano.exceptions import SyncanoException from syncano_cli.base.command import BaseCommand from s...
@top_level.command()
Predict the next line after this snippet: <|code_start|> def _create_script_endpoint(self, source, name_prefix): script = self.instance.scripts.create( label='test_script', source=source, runtime_name=RuntimeChoices.PYTHON_V5_0, ) self.instance.script_end...
name_prefix=name_prefix
Here is a snippet: <|code_start|> def test_script_endpoint(self): name_prefix = 'normal_response' self._create_script_endpoint( source='print(12)', name_prefix=name_prefix ) result = self.runner.invoke(cli, args=[ 'execute', '{}_test_script_endpoi...
name_prefix = 'custom_response'
Predict the next line after this snippet: <|code_start|> @click.group() def top_account(): pass <|code_end|> using the current file's imports: import click from syncano_cli.account.command import AccountCommands from syncano_cli.base.options import ColorSchema, SpacedOpt, WarningOpt from syncano_cli.config imp...
@top_account.group()
Given the following code snippet before the placeholder: <|code_start|> @click.group() def top_account(): pass <|code_end|> , predict the next line using imports from the current file: import click from syncano_cli.account.command import AccountCommands from syncano_cli.base.options import ColorSchema, SpacedOp...
@top_account.group()
Here is a snippet: <|code_start|> @click.group() def top_account(): pass @top_account.group() @click.pass_context @click.option('--config', help=u'Account configuration file.') <|code_end|> . Write the next line using the current file imports: import click from syncano_cli.account.command import AccountCommands...
def accounts(ctx, config):
Here is a snippet: <|code_start|> @classmethod def setUpClass(cls): super(MigrateCommandsTest, cls).setUpClass() # do a login first; cls.runner.invoke(cli, args=['login', '--instance-name', cls.instance.name], obj={}) # and make setup; cls.old_key = cls.connection.connecti...
self.assertIn('PARSE_MASTER_KEY', result.output)
Continue the code snippet: <|code_start|> mock.MagicMock(return_value=None)) @mock.patch('syncano_cli.parse_to_syncano.migrations.transfer.SyncanoTransfer.transfer_files', mock.MagicMock(return_value=None)) def test_class_migrations(self, request_mock): with open('tests/js...
classes['results'] = classes['results'][1:]
Predict the next line for this snippet: <|code_start|> @mock.patch('syncano_cli.parse_to_syncano.parse.connection.ParseConnection.request') def test_object_migrations(self, request_mock): # create Classes first; with open('tests/json_migrate_mocks/schema.json', 'r+') as f: classes = ...
self.assertEqual(object_to_test.barg, 12)
Based on the snippet: <|code_start|> self.assertIn('Transfer aborted.', result.output) @mock.patch('syncano_cli.parse_to_syncano.parse.connection.ParseConnection.request') @mock.patch('syncano_cli.parse_to_syncano.migrations.transfer.SyncanoTransfer.process_relations', mock.MagicMock(ret...
objects = json.loads(f.read())
Next line prediction: <|code_start|># -*- coding: utf-8 -*- def force_config_value(config, config_var_name, section='P2S'): prompter = Prompter() config_var = prompter.prompt('{}'.format(config_var_name)) if not config.has_section(section): config.add_section(section) config.set(section, confi...
force_config_value(config, config_var_name)
Here is a snippet: <|code_start|> def write_config_to_file(config): with open(ACCOUNT_CONFIG_PATH, 'wt') as config_file: config.write(config_file) def check_configuration(config, silent=False): for config_var_name in CONFIG_VARIABLES_NAMES: check_config_value(config, config_var_name, silent=si...
formatter.write("{config_var_name}: {config_var}".format(
Based on the snippet: <|code_start|> else: if not silent: formatter.write("{config_var_name}: {config_var}".format( config_var_name=click.style(config_var_name, fg=ColorSchema.PROMPT), config_var=click.style(config.get(section, config_var_name), fg=ColorSchema.INFO...
config.add_section('P2S')
Here is a snippet: <|code_start|> config.write(config_file) def check_configuration(config, silent=False): for config_var_name in CONFIG_VARIABLES_NAMES: check_config_value(config, config_var_name, silent=silent) write_config_to_file(config) def force_configuration_overwrite(config): for...
))
Predict the next line for this snippet: <|code_start|> config_var=click.style(config.get(section, config_var_name), fg=ColorSchema.INFO) )) def write_config_to_file(config): with open(ACCOUNT_CONFIG_PATH, 'wt') as config_file: config.write(config_file) def check_configuration(...
else:
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class ParseConnection(object): BASE_URL = 'https://api.parse.com/{url}/' def __init__(self, application_id, master_key): <|code_end|> , determine the next line of code. You have imports: import json import requests from syncano_cli.parse_to_syncano....
self.application_id = application_id
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- class DependencyTypeE(): CLASS = 'class' SCRIPT = 'script' class SocketJsonYml(object): SOCKET_FIELDS = ['name', 'description', 'endpoints', 'dependencies'] ENDPOINT_TYPES = ['script'] <|code_end|> . Use current file imports: import...
HTTP_METHODS = ['GET', 'POST', 'DELETE', 'PUT', 'PATCH']
Given snippet: <|code_start|># -*- coding: utf-8 -*- class DependencyTypeE(): CLASS = 'class' SCRIPT = 'script' class SocketJsonYml(object): SOCKET_FIELDS = ['name', 'description', 'endpoints', 'dependencies'] <|code_end|> , continue by predicting the next line. Consider current file imports: import ...
ENDPOINT_TYPES = ['script']
Based on the snippet: <|code_start|> connection = syncano.connect().connection() api_key = connection.authenticate(email=email, password=password) ACCOUNT_CONFIG.set('DEFAULT', 'key', api_key) with open(config_path, 'wt') as fp: ACCOUNT_CONFIG.write(fp) def do_register(se...
self.set_instance_as_default(config_path, instance_name, instance_commands)
Using the snippet: <|code_start|> class RegisterMixin(object): def do_login(self, email, password, config_path): connection = syncano.connect().connection() api_key = connection.authenticate(email=email, password=password) ACCOUNT_CONFIG.set('DEFAULT', 'key', api_key) with open(con...
self.do_register(exc, email, password, config_path)
Given the code snippet: <|code_start|> account_command.register(email=email, password=password) self.formatter.write('Account created for email: {}'.format(email), TopSpacedOpt()) elif 'password' in exc.message: self.formatt...
password = self.prompter.prompt('password', hide_input=True)
Using the snippet: <|code_start|> def do_login(self, email, password, config_path): connection = syncano.connect().connection() api_key = connection.authenticate(email=email, password=password) ACCOUNT_CONFIG.set('DEFAULT', 'key', api_key) with open(config_path, 'wt') as fp: ...
instance_name = instances[0].name if instances else self.create_instance(instance_commands).name
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- class RegisterMixin(object): def do_login(self, email, password, config_path): connection = syncano.connect().connection() api_key = connection.authenticate(email=email, password=password) ACCO...
def do_login_or_register(self, email, password, config_path):
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- class MissingRequestDataException(CLIBaseException): default_message = u'--data option should be provided when method {} is used' class EndpointNotFoundException(CLIBaseException): default_message = u'Endpoint `{...
default_message = u'Bad config format.'
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- class SocketConfigParser(object): PROMPT_FIELD = 'prompt' VALUE_FIELD = 'value' def __init__(self, socket_yml): <|code_end|> using the current file's imports: import click import six from syncano_cli.custom_sockets.excepti...
self.config = socket_yml.get('config', {})
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- if six.PY2: elif six.PY3: else: raise ImportError() class InstanceCommands(BaseCommand): def list(self): return self.api_list() def api_list(self): return self.connection.Instance.please.all() def details(self, instan...
def create(self, instance_name, description=None):
Predict the next line after this snippet: <|code_start|># -*- coding: utf-8 -*- if six.PY2: elif six.PY3: else: <|code_end|> using the current file's imports: import click import six from syncano_cli.base.command import BaseCommand from syncano_cli.base.options import BottomSpacedOpt, ColorSchema, SpacedOpt, TopSpac...
raise ImportError()
Given snippet: <|code_start|>if six.PY2: elif six.PY3: else: raise ImportError() class InstanceCommands(BaseCommand): def list(self): return self.api_list() def api_list(self): return self.connection.Instance.please.all() def details(self, instance_name): return self.display...
}
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- if six.PY2: elif six.PY3: else: raise ImportError() class InstanceCommands(BaseCommand): def list(self): return self.api_list() def api_list(self): return self.connection.Instance.please.all() def details...
def create(self, instance_name, description=None):
Based on the snippet: <|code_start|># -*- coding: utf-8 -*- if six.PY2: elif six.PY3: else: raise ImportError() class InstanceCommands(BaseCommand): def list(self): return self.api_list() <|code_end|> , predict the immediate next line with the help of imports: import click import six from syncano_...
def api_list(self):
Given snippet: <|code_start|> if not socket_list: self.write('Sockets not defined for `{}` instance.'.format(instance_name), WarningOpt(), SpacedOpt()) sys.exit(1) self.write('Sockets for `{}` instance.'.format(instance_name), SpacedOpt()) for cs in...
api_key=api_key,
Using the snippet: <|code_start|># -*- coding: utf-8 -*- class SocketFormatter(Formatter): SOCKET_LIST_FIELDS = ['name', 'description', 'status', 'status_info', 'endpoints'] SOCKET_DETAILS_FIELDS = ['config', 'endpoints', 'dependencies', 'metadata'] ENDPOINT_FIELDS = ['calls', 'acl', 'metadata'] de...
custom_socket.instance_name
Next line prediction: <|code_start|> ) ], SpacedOpt() ) lines = self._display_list_details(custom_socket) self.write_block(lines) for socket_field in self.SOCKET_DETAILS_FIELDS: self.display_block( socket_field, ...
(self.display_endpoints, ('base_link', 'api_key')),
Predict the next line for this snippet: <|code_start|># -*- coding: utf-8 -*- class PathNotFoundException(CLIBaseException): default_message = u'File `{}` not found.' class UnicodeInPathException(CLIBaseException): <|code_end|> with the help of current file imports: from syncano_cli.base.exceptions import CL...
default_message = u'Unicode characters in path are not supported. Check the files names.'
Given snippet: <|code_start|> class Formatter(object): indent = ' ' not_set = '-- not set --' def write(self, single_line, *options): option = self.get_options(options) styles = option.map_click() single_line = self._indent(single_line, option) self._write(single_line, o...
self.write('{}{:20} {}'.format(
Using the snippet: <|code_start|>class Formatter(object): indent = ' ' not_set = '-- not set --' def write(self, single_line, *options): option = self.get_options(options) styles = option.map_click() single_line = self._indent(single_line, option) self._write(single_line...
self.indent,
Predict the next line after this snippet: <|code_start|> for key, value in six.iteritems(dictionary): if isinstance(value, dict): self.write('{}:'.format(click.style(key, fg=ColorSchema.PROMPT)), DefaultOpt(indent=indent)) self.format_object(value, indent=indent, skip_...
if options.space_top:
Predict the next line after this snippet: <|code_start|> click.style(name, fg=ColorSchema.PROMPT), click.style(value, fg=ColorSchema.INFO) )) if not config: self.write('No config specified yet.', DefaultOpt(indent=2)) self.empty_line() def get_...
skip_fields = skip_fields or []
Predict the next line after this snippet: <|code_start|> @classmethod def empty_line(cls): click.echo() def separator(self, size=70, indent=1): self.write(size * '-', DefaultOpt(indent=indent), WarningOpt(), BottomSpacedOpt()) def display_config(self, config): for name, value i...
self.format_object(value, indent=indent, skip_fields=skip_fields)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- class AccountCommandsTest(BaseCLITest): def test_register(self): # remove file with connection data: if os.path.isfile(ACCOUNT_CONFIG_PATH): os.remove(ACCOUNT_CONFIG_PATH) self.assertFalse(os.path.isfile(ACCOUNT...
email = 'syncano.bot+977999{}@syncano.com'.format(random.randint(100000, 50000000))
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- class AccountCommandsTest(BaseCLITest): def test_register(self): # remove file with connection data: if os.path.isfile(ACCOUNT_CONFIG_PATH): os.remove(ACCOUNT_CONFIG_PATH) self.assertFalse(os.path.isfile(ACCOUNT_CONFIG_...
old_key = self.connection.connection().api_key
Here is a snippet: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestUtils(SpannerSimpleTestClass): SQL_WITH_WHERE = "Select 1 from Table WHERE 1...
SUPPORTED_DJANGO_VERSIONS = [(2, 2), (3, 2)]
Predict the next line after this snippet: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestQueries(TransactionTestCase): @classmethod def se...
with connection.schema_editor() as editor:
Predict the next line for this snippet: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestQueries(TransactionTestCase): @classmethod def setU...
def test_insert_and_fetch_value(self):
Next line prediction: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestQueries(TransactionTestCase): @classmethod def setUpClass(cls): ...
def test_insert_and_fetch_value(self):
Given the code snippet: <|code_start|> self.assertEqual(span.name, "CloudSpannerDjango.Test") self.assertEqual(span.status.status_code, StatusCode.OK) def test_trace_error(self): extra_attributes = {"db.instance": "database_name"} expected_attributes = { ...
self.assertEqual(span.status.status_code, StatusCode.ERROR)
Using the snippet: <|code_start|># Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd try: except ImportError: pass PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"] INSTANCE_ID = "instance_id" DATABASE_ID...
"OPTIONS": OPTIONS,
Next line prediction: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd try: except ImportError: pass PROJECT = os.environ["GOOGLE_CLOUD_PROJECT"] <|code...
INSTANCE_ID = "instance_id"
Given the code snippet: <|code_start|> def test_bulk_batch_size(self): self.assertEqual( self.db_operations.bulk_batch_size(fields=None, objs=None), self.db_operations.connection.features.max_query_params, ) def test_sql_flush(self): self.assertEqual( ...
self.assertIsInstance(
Predict the next line for this snippet: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestExpressions(SpannerSimpleTestClass): def test_order_by_...
)
Here is a snippet: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestExpressions(SpannerSimpleTestClass): def test_order_by_sql_query_with_order_...
sql_compiled, _ = compiler.as_sql()
Continue the code snippet: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestExpressions(SpannerSimpleTestClass): def test_order_by_sql_query_wit...
"SELECT tests_report.name FROM tests_report ORDER BY "
Continue the code snippet: <|code_start|> mock_instance.assert_called_once_with(self.INSTANCE_ID) def test_property_nodb_connection(self): with self.assertRaises(NotImplementedError): self.db_wrapper._nodb_connection() def test_get_connection_params(self): params = self....
mock_connection.cursor = mock_cursor = mock.MagicMock()
Next line prediction: <|code_start|> def setUpClass(cls): setup_instance() setup_database() with connection.schema_editor() as editor: # Create the tables editor.create_model(Author) editor.create_model(Number) @classmethod def tearDownClass(cls): ...
def test_insert_and_search_decimal_value(self):
Continue the code snippet: <|code_start|>class TestDecimal(TransactionTestCase): @classmethod def setUpClass(cls): setup_instance() setup_database() with connection.schema_editor() as editor: # Create the tables editor.create_model(Author) editor.creat...
)
Continue the code snippet: <|code_start|> def setUpClass(cls): setup_instance() setup_database() with connection.schema_editor() as editor: # Create the tables editor.create_model(Author) editor.create_model(Number) @classmethod def tearDownClass(c...
def test_insert_and_search_decimal_value(self):
Here is a snippet: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestDecimal(TransactionTestCase): @classmethod def setUpClass(cls): ...
return value["rating"]
Given the following code snippet before the placeholder: <|code_start|># Copyright 2021 Google LLC # # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file or at # https://developers.google.com/open-source/licenses/bsd class TestDecimal(TransactionTestCase): @classme...
def tearDownClass(cls):
Given snippet: <|code_start|>#!/usr/bin/env python2 # -- coding: utf-8 -- token = get_api_key() url = 'https://www.muckrock.com/api_v1/' headers = {'Authorization': 'Token %s' % token, 'content-type': 'application/json'} next_ = url + 'communication' fields = ( "id", "ffile", "title", <|code_end|> , con...
"date",
Given snippet: <|code_start|> while next_ is not None: r = requests.get(next_, headers=headers) try: json = r.json() next_ = json['next'] for datum in json['results']: try: items = [] print "Working on request with ID " + str(datum['id']) ...
jurisdiction_url = "https://www.muckrock.com/api_v1/jurisdiction/" + str(jurisdiction_data['parent']) + '/'
Continue the code snippet: <|code_start|> next_ = url + 'assignment-responses' while next_ is not None: r = requests.get(next_, headers=headers) try: json = r.json() next_ = json['next'] for datum in json['results']: csv_writer.writerow([datum[field] for field in field...
38: "Potential Stories and Records Issues",
Given the code snippet: <|code_start|>headers = {'Authorization': 'Token %s' % token, 'content-type': 'application/json'} next_ = url + 'statistics' fields = ( "date", "total_requests", "total_requests_success", "total_requests_denied", "total_requests_draft", "total_requests_submitted", "total_requests_awaiting_ack",...
"total_unresolved_tasks",
Using the snippet: <|code_start|>jurisdiction_fields = ( 'name', 'parent', 'level', ) page = 1 # make this true while exporting data to not crash on errors SUPRESS_ERRORS = False # This allows you to cach jurisdiction look ups jurisdictions = {} def get_jurisdiction(jurisdiction_id)...
csv_writer = unicodecsv.writer(csv_file)
Here is a snippet: <|code_start|>#!/usr/bin/env python2 # -- coding: utf-8 -- token = get_api_key() url = 'https://www.muckrock.com/api_v1/' headers = {'Authorization': 'Token %s' % token, 'content-type': 'application/json'} <|code_end|> . Write the next line using the current file imports: import requests import u...
next_ = url + 'jurisdiction'
Based on the snippet: <|code_start|> ## Need to install google-api-python-clientself. ## pip install --upgrade google-api-python-client # GA_product = raw_input('What is your Google Analytics product Key? ') token = get_api_key() url = 'https://www.muckrock.com/api_v1/' headers = {'Authorization': 'Token %s' % tok...
"authors",
Next line prediction: <|code_start|>#!/usr/bin/env python2 # -- coding: utf-8 -- token = get_api_key() url = 'https://www.muckrock.com/api_v1/' headers = {'Authorization': 'Token %s' % token, 'content-type': 'application/json'} assignmentID = raw_input('What assignment are you trying to export? Look at the numbers...
"user",
Given the code snippet: <|code_start|>#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'Arnaud' class GoogleDriveHelper: __clientInstance = None <|code_end|> , generate the next line using the imports in this file: import multiprocessing import operator import httplib2 import logging import random im...
DOCUMENTS_LIST_API_BATCH_URL = 'https://docs.google.com/feeds/default/private/full/batch'
Continue the code snippet: <|code_start|>#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'Arnaud' class GoogleDriveHelper: __clientInstance = None DOCUMENTS_LIST_API_BATCH_URL = 'https://docs.google.com/feeds/default/private/full/batch' DOCUMENT_LIST_API_ITEM_TEMPLATE = 'https://docs.google.c...
RESOURCE_ID_REGEX = re.compile(DOCUMENT_LIST_API_ITEM_TEMPLATE % "document:([a-z0-9_-]+)", re.IGNORECASE)
Predict the next line for this snippet: <|code_start|>#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'Arnaud' class GoogleDriveHelper: __clientInstance = None DOCUMENTS_LIST_API_BATCH_URL = 'https://docs.google.com/feeds/default/private/full/batch' DOCUMENT_LIST_API_ITEM_TEMPLATE = 'https://...
TITLE_FILTER = ['your new unishared\'s class', 'document title', 'untitled document', 'test', 'copy of template', 'unishared template', 'template']
Continue the code snippet: <|code_start|>#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = 'Arnaud' class GoogleDriveHelper: __clientInstance = None DOCUMENTS_LIST_API_BATCH_URL = 'https://docs.google.com/feeds/default/private/full/batch' DOCUMENT_LIST_API_ITEM_TEMPLATE = 'https://docs.google.c...
MAX_DOCUMENTS = 50
Based on the snippet: <|code_start|> def get_user_avatar(backend, details, response, social_user, uid, user, *args, **kwargs): url = None if backend.__class__ == FacebookBackend: url = "http://graph.facebook.com/%s/picture?type=large" % response['id'] <|code_end|> , predict the immediate next li...
if url:
Predict the next line for this snippet: <|code_start|> def get_user_avatar(backend, details, response, social_user, uid, user, *args, **kwargs): url = None if backend.__class__ == FacebookBackend: url = "http://graph.facebook.com/%s/picture?type=large" % response['id'] if url: profil...
profile.save()
Next line prediction: <|code_start|> imsi_list = map(lambda item: item['imsi'], result); query = HLRDBSession.query( Subscriber.imsi, func.count(Sms.id).label('sms_count') ).filter(( (Sms.src_addr == Subscriber.extension) | (Sms.dest_addr == Subscriber.extension)) & (S...
gps_status = 'failed'
Continue the code snippet: <|code_start|> (Subscriber.imsi.in_(imsi_list)) ).group_by( Subscriber.imsi ).all() for record in query: messages.append({ 'imsi': int(record.imsi), 'count': record.sms_count }) if 'jtSorting' in request.GET: so...
}
Continue the code snippet: <|code_start|> dest_subscriber_res = HLRDBSession.query( Subscriber.imsi ).filter( Subscriber.extension == obj.dest_addr ).all() dest = "xx" if len(dest_subscriber_res) > 0: dest_imsi = int(dest_subscriber_res[0].imsi...
sms['sent'] = True if obj.sent else False
Given the code snippet: <|code_start|> for circle in query.all(): result['circles'].append({ 'center': [ circle.gps_lat, circle.gps_lon ], 'radius': circle.distance, 'ts': time.mktime(circle.timestamp.timetuple()) }) ...
result = {}
Given the code snippet: <|code_start|> dest = "xx" if len(dest_subscriber_res) > 0: dest_imsi = int(dest_subscriber_res[0].imsi) dest = "station" if dest_imsi == int(pimsi) else str(dest_imsi) direction = 'to' if obj.src_addr == pfnum else 'from' try: ...
multipart_massages[msg_id] = result['sms'][-1]
Given the following code snippet before the placeholder: <|code_start|> @view_config(route_name='send_imsi_message', request_method='POST', renderer='json') def send_imsi_message(request): result = {} imsi = request.matchdict['imsi'] text = request.body try: sent = request.xmlrpc.send_sms(imsi,...
result = {}
Given the code snippet: <|code_start|>def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) settings = get_appsettings(config_uri) engine = engine_from_config(settings, 'sqlalchemy.pf.') DBSession.configure(bind=engine) Base.metadata.c...
])
Next line prediction: <|code_start|> hlr_engine = engine_from_config(settings, 'sqlalchemy.hlr.') HLRDBSession.configure(bind=hlr_engine) # initial settings with transaction.manager: DBSession.add_all([ Settings(name='imsiUpdate', value=3000), Settings(name='smsUpdate', v...
lac=0
Based on the snippet: <|code_start|>def usage(argv): cmd = os.path.basename(argv[0]) print('usage: %s <config_uri>\n' '(example: "%s development.ini")' % (cmd, cmd)) sys.exit(1) def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_...
'Your temporary phone number is {ms_phone_number}'
Given snippet: <|code_start|> def usage(argv): cmd = os.path.basename(argv[0]) print('usage: %s <config_uri>\n' '(example: "%s development.ini")' % (cmd, cmd)) sys.exit(1) def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri = argv[1] setup_logging(config_uri) ...
'Please SMS to {ph_phone_number} to communicate. ' + \
Given the following code snippet before the placeholder: <|code_start|> def usage(argv): cmd = os.path.basename(argv[0]) print('usage: %s <config_uri>\n' '(example: "%s development.ini")' % (cmd, cmd)) sys.exit(1) def main(argv=sys.argv): if len(argv) != 2: usage(argv) config_uri...
'Please SMS to {ph_phone_number} to communicate. ' + \
Based on the snippet: <|code_start|> def number_of_measurements_in_queue(self): return len(self.queue) def add_gps_meas(self, time, lat, lon): self.__cc.add(time, lat, lon) self.current_gps = (lat, lon) def get_current_gps(self): return self.current_gps class ...
srv = SMSServer(configuration, comms_model, logger)
Here is a snippet: <|code_start|> logger.info("Sms server STARTED with pid: {0}".format( sms_server_process.pid)) meas_json_listener.start() logger.info("meas_json listener STARTED with pid: {0}".format( meas_json_listener.pid)) # Queue statistic =================================...
comms_interface_server_process.terminate()
Given the following code snippet before the placeholder: <|code_start|> def add(self, time, lat, log): if self.__count == self.__max_for_save: self.__gps_times.pop(0) self.__gps_coordinates.pop(0) self.__count -= 1 self.__gps_times.append(time) self...
def put_measurement(self, obj):
Predict the next line after this snippet: <|code_start|>if __name__ == "__main__": parser = argparse.ArgumentParser( description='People finder. Comm interface.') parser.add_argument('-c', '--configuration', type=file, required=True) parser.add_argument('-t', '--test_mode', action='store_true') ...
hlr_db_conn_str = None
Based on the snippet: <|code_start|> self.__gps_coordinates = [] self.__count = 0 self.__max_for_save = 100 self.logger = logging_utils.get_logger("GPSCoordinatesCollection") self.add(time.time(), None, None) def add(self, time, lat, log): if self.__count =...
self.queue = []