prompt
large_stringlengths
72
9.34k
completion
large_stringlengths
0
7.61k
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): <|fim_middle|> @contextmanager def tmpdir(*args, **kwargs): ori...
""" Construct a tcp.Read object from bytes. """ fp = BytesIO(bytes) return tcp.Reader(fp)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
orig_workdir = os.getcwd() temp_workdir = tempfile.mkdtemp(*args, **kwargs) os.chdir(temp_workdir) yield temp_workdir os.chdir(orig_workdir) shutil.rmtree(temp_workdir)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
if isinstance(expected, six.string_types): if expected.lower() not in str(actual).lower(): six.reraise(AssertionError, AssertionError( "Expected %s, but caught %s" % ( repr(expected), repr(actual) ) ), exc_tb) else: if n...
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
""" Assert that a callable raises a specified exception. :exc An exception class or a string. If a class, assert that an exception of this type is raised. If a string, assert that the string occurs in the string representation of the exception, based on a case-insenstivie ma...
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
def __init__(self, expected_exception): self.expected_exception = expected_exception def __enter__(self): return def __exit__(self, exc_type, exc_val, exc_tb): if not exc_type: raise AssertionError("No exception raised.") else: _check_exception(self....
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
self.expected_exception = expected_exception
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
return
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
if not exc_type: raise AssertionError("No exception raised.") else: _check_exception(self.expected_exception, exc_val, exc_tb) return True
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
""" Returns: netlib.http.Request """ default = dict( first_line_format="relative", method=b"GET", scheme=b"http", host=b"address", port=22, path=b"/path", http_version=b"HTTP/1.1", headers=http.Headers(((b"header", b"qvalue"), (b"co...
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
""" Returns: netlib.http.Response """ default = dict( http_version=b"HTTP/1.1", status_code=200, reason=b"OK", headers=http.Headers(((b"header-response", b"svalue"), (b"content-length", b"7"))), content=b"message", timestamp_start=time.time(), ...
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
if expected.lower() not in str(actual).lower(): six.reraise(AssertionError, AssertionError( "Expected %s, but caught %s" % ( repr(expected), repr(actual) ) ), exc_tb)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
six.reraise(AssertionError, AssertionError( "Expected %s, but caught %s" % ( repr(expected), repr(actual) ) ), exc_tb)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
if not isinstance(actual, expected): six.reraise(AssertionError, AssertionError( "Expected %s, but caught %s %s" % ( expected.__name__, actual.__class__.__name__, repr(actual) ) ), exc_tb)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
six.reraise(AssertionError, AssertionError( "Expected %s, but caught %s %s" % ( expected.__name__, actual.__class__.__name__, repr(actual) ) ), exc_tb)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
return RaisesContext(expected_exception)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
try: ret = obj(*args, **kwargs) except Exception as actual: _check_exception(expected_exception, actual, sys.exc_info()[2]) else: raise AssertionError("No exception raised. Return value: {}".format(ret))
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
raise AssertionError("No exception raised. Return value: {}".format(ret))
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
raise AssertionError("No exception raised.")
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
_check_exception(self.expected_exception, exc_val, exc_tb)
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def <|fim_middle|>(bytes): """ Construct a tcp.Read object from bytes. """ ...
treader
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
tmpdir
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
_check_exception
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
raises
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
__init__
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
__enter__
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
__exit__
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
treq
<|file_name|>tutils.py<|end_file_name|><|fim▁begin|>from io import BytesIO import tempfile import os import time import shutil from contextlib import contextmanager import six import sys from netlib import utils, tcp, http def treader(bytes): """ Construct a tcp.Read object from bytes. """ fp = B...
tresp
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
],
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
if parser is None: parser = ParlaiParser(True, True, 'Check tasks for common errors') # Get command line arguments parser.add_argument('-ltim', '--log-every-n-secs', type=float, default=2) parser.add_argument('-d', '--display-examples', type='bool', default=False) parser.set_defaults(datatyp...
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
report = world.report() log = { 'missing_text': counts['missing_text'], 'missing_labels': counts['missing_labels'], 'missing_label_candidates': counts['missing_label_candidates'], 'empty_string_label_candidates': counts['empty_string_label_candidates'], 'label_candidates_...
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
if opt.get('display_examples'): print(txt + ":\n" + str(act)) else: warn_once(txt)
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
if opt['datatype'] == 'train': logging.warning("changing datatype from train to train:ordered") opt['datatype'] = 'train:ordered' opt.log() # create repeat label agent and assign it to the specified task agent = RepeatLabelAgent(opt) world = create_task(opt, agent) log_every_n_s...
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
counts = verify(opt) print(counts) return counts
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
@classmethod def setup_args(cls): return setup_args() def run(self): return verify_data(self.opt)
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
return setup_args()
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
return verify_data(self.opt)
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
parser = ParlaiParser(True, True, 'Check tasks for common errors')
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
print(txt + ":\n" + str(act))
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
warn_once(txt)
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
logging.warning("changing datatype from train to train:ordered") opt['datatype'] = 'train:ordered'
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
log_every_n_secs = float('inf')
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
counts['did_not_return_message'] += 1
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
warn("warning: missing text field:\n", act, opt) counts['missing_text'] += 1
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
warn("warning: missing labels/eval_labels field:\n", act, opt) counts['missing_labels'] += 1
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
if 'label_candidates' not in act: counts['missing_label_candidates'] += 1 else: labels = act.get('labels', act.get('eval_labels')) is_label_cand = {} for l in labels: is_label_cand[l] = False for ...
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
counts['missing_label_candidates'] += 1
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
labels = act.get('labels', act.get('eval_labels')) is_label_cand = {} for l in labels: is_label_cand[l] = False for c in act['label_candidates']: if c == '': warn("warning: empty string label_...
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
warn("warning: empty string label_candidate:\n", act, opt) counts['empty_string_label_candidates'] += 1
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
if is_label_cand[c] is True: warn( "warning: label mentioned twice in candidate_labels:\n", act, opt, ) is_label_cand[c]...
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
warn( "warning: label mentioned twice in candidate_labels:\n", act, opt, )
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
warn("warning: label missing in candidate_labels:\n", act, opt) counts['label_candidates_with_missing_label'] += 1
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
text, log = report(world, counts, log_time) print(text)
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
VerifyData.main()
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
setup_args
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
report
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
warn
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
verify
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
verify_data
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
setup_args
<|file_name|>verify_data.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ Verify data doesn't have basic mistakes, like empty text fie...
run
<|file_name|>settings.py<|end_file_name|><|fim▁begin|>""" Django settings for sparta project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside ...
WSGI_APPLICATION = 'sparta.wsgi.application' # Database
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|>import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data = ...
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): <|fim_middle|> if __name__ == '__m...
def setUp(self): itau_data = get_itau_data_from_file() self.header_arquivo = itau_data['header_arquivo'] self.seg_p = itau_data['seg_p1'] self.seg_p_str = itau_data['seg_p1_str'] self.seg_q = itau_data['seg_q1'] self.seg_q_str = itau_data['seg_q1_str'] def test_l...
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): <|fim_middl...
itau_data = get_itau_data_from_file() self.header_arquivo = itau_data['header_arquivo'] self.seg_p = itau_data['seg_p1'] self.seg_p_str = itau_data['seg_p1_str'] self.seg_q = itau_data['seg_q1'] self.seg_q_str = itau_data['seg_q1_str']
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
self.assertEqual(self.seg_p.valor_titulo, Decimal('100.00'))
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
with self.assertRaises(errors.TipoError): self.seg_p.valor_titulo = 10.0 with self.assertRaises(errors.TipoError): self.seg_p.valor_titulo = '' # Testa se as casas decimais estao sendo verificadas with self.assertRaises(errors.NumDecimaisError): self....
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
self.assertEqual(self.header_arquivo.controle_banco, 341)
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
with self.assertRaises(errors.TipoError): self.header_arquivo.controle_banco = 10.0 with self.assertRaises(errors.TipoError): self.header_arquivo.controle_banco = '' # verifica se o numero de digitos esta sendo verificado with self.assertRaises(errors.NumDigitosE...
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
self.assertEqual(self.header_arquivo.cedente_nome, 'TRACY TECNOLOGIA LTDA ME')
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
with self.assertRaises(errors.TipoError): self.header_arquivo.cedente_nome = 'tracy' # Testa que strings mais longas que obj.digitos nao serao aceitas with self.assertRaises(errors.NumDigitosExcedidoError): self.header_arquivo.cedente_convenio = '123456789012345678901' ...
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
header_dict = self.header_arquivo.todict() header_arquivo = itau.registros.HeaderArquivo(**header_dict) self.assertEqual(header_arquivo.cedente_nome, 'TRACY TECNOLOGIA LTDA ME') self.assertEqual(header_arquivo.nome_do_banco, 'BANCO ITAU SA'...
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
self.assertTrue(self.seg_p) seg_p2 = itau.registros.SegmentoP() self.assertFalse(seg_p2.necessario()) seg_p2.controle_banco = 33 self.assertFalse(seg_p2.necessario()) seg_p2.vencimento_titulo = 10102012 self.assertTrue(seg_p2.necessario())
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
def unicode_test(seg_instance, seg_str): seg_gen_str = str(seg_instance) self.assertEqual(len(seg_gen_str), 240) self.assertEqual(len(seg_str), 240) self.assertEqual(seg_gen_str, seg_str) unicode_test(self.seg_p, self.seg_p_str) unicode_test(self...
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
seg_gen_str = str(seg_instance) self.assertEqual(len(seg_gen_str), 240) self.assertEqual(len(seg_str), 240) self.assertEqual(seg_gen_str, seg_str)
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
unittest.main()
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def <|fim_middle|>(self): it...
setUp
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_leitura_campo_num_decimal
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_escrita_campo_num_decimal
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_leitura_campo_num_int
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_escrita_campo_num_int
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_leitura_campo_alfa
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_escrita_campo_alfa
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_fromdict
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_necessario
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
test_unicode
<|file_name|>test_registro.py<|end_file_name|><|fim▁begin|> import unittest from unittest import skip from decimal import Decimal from cnab240 import errors from cnab240.bancos import itau from tests.data import get_itau_data_from_file class TestRegistro(unittest.TestCase): def setUp(self): itau_data =...
unicode_test
<|file_name|>config.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*- # # This file is part of Invenio. # Copyright (C) 2015-2018 CERN. # # Invenio is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Configuration options for Inve...
<|file_name|>db_migrate.py<|end_file_name|><|fim▁begin|>#!hyphen-venv/bin/python import imp from migrate.versioning import api from app import db from config import SQLALCHEMY_DATABASE_URI from config import SQLALCHEMY_MIGRATE_REPO migration = SQLALCHEMY_MIGRATE_REPO + \ '/versions/%03d_migration.py' %...
SQLALCHEMY_MIGRATE_REPO,
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
parser = optparse.OptionParser(version=MAILMAN_VERSION, usage=_("""\ %prog [options] Check for pending admin requests and mail the list owners if necessary.""")) parser.add_option('-C', '--config', help=_('Alternative configuration file to use')) opt...
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
lcset = mlist.preferred_language.charset pending = [] first = True requestsdb = IListRequests(mlist) for request in requestsdb.of_type(RequestType.subscription): if first: pending.append(_('Pending subscriptions:')) first = False key, data = requestsdb.get_req...
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
discard_count = 0 expire = config.days(mlist.max_days_to_hold) requestsdb = IListRequests(mlist) heldmsgs = list(requestsdb.of_type(RequestType.held_message)) if expire and heldmsgs: for request in heldmsgs: key, data = requestsdb.get_request(request.id) if now - data...
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
if date is None: date = time.localtime()[:3] # -1 for dst flag tells the library to figure it out return time.mktime(date + (0,)*5 + (-1,))
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
opts, args, parser = parseargs() initialize(opts.config) for name in config.list_manager.names: # The list must be locked in order to open the requests database mlist = MailList.MailList(name) try: count = IListRequests(mlist).count # While we're at it, let's...
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
parser.print_help() print(_('Unexpected arguments'), file=sys.stderr) sys.exit(1)
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
pending.append(_('Pending subscriptions:')) first = False
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
if isinstance(fullname, unicode): fullname = fullname.encode(lcset, 'replace') fullname = ' (%s)' % fullname
<|file_name|>checkdbs.py<|end_file_name|><|fim▁begin|># Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This file is part of GNU Mailman. # # GNU Mailman is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software F...
fullname = fullname.encode(lcset, 'replace')