rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
lambda self, selectors: self.assertEqual( selectors.test_run.attachments, {}), lambda self, selectors: self.assertEqual( selectors.test_run.sw_context, None), lambda self, selectors: self.assertEqual( selectors.test_run.hw_context, None), ] }), ('analyzer_assigned_uuid_is_parsed_as_uuid', { 'json_text': """ { "test_runs": [{ "analyzer_assigned_uuid": "1ab86b36-c23d-11df-a81b-002163936223" }] } """, 'selectors': { 'test_run': lambda bundle: bundle.test_runs[0] }, 'validators': [
def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deserialization_error # directly due to the way django handles operations that affect # existing instances (it does not touch them like storm would # IIRC). self.assertRaises( BundleDeserializationError.DoesNotExist, BundleDeserializationError.objects.get, bundle=self.bundle)
957b0eab837f40bbe8180ecadeffedaf82ab9311 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/957b0eab837f40bbe8180ecadeffedaf82ab9311/tests.py
] }), ('analyzer_assigned_date_is_parsed_as_datetime', { 'json_text': """ { "test_runs": [{ "analyzer_assigned_date": "2010-12-31T23:59:59Z" }] } """, 'selectors': { 'test_run': lambda bundle: bundle.test_runs[0] }, 'validators': [ lambda self, selectors: self.assertEqual(
lambda self, selectors: self.assertEqual(
def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deserialization_error # directly due to the way django handles operations that affect # existing instances (it does not touch them like storm would # IIRC). self.assertRaises( BundleDeserializationError.DoesNotExist, BundleDeserializationError.objects.get, bundle=self.bundle)
957b0eab837f40bbe8180ecadeffedaf82ab9311 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/957b0eab837f40bbe8180ecadeffedaf82ab9311/tests.py
]
lambda self, selectors: self.assertEqual( selectors.test_run.time_check_performed, False), lambda self, selectors: self.assertEqual( selectors.test_run.attributes, {}), lambda self, selectors: self.assertEqual( selectors.test_run.attachments, {}), lambda self, selectors: self.assertEqual( selectors.test_run.sw_context, None), lambda self, selectors: self.assertEqual( selectors.test_run.hw_context, None), ]
def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deserialization_error # directly due to the way django handles operations that affect # existing instances (it does not touch them like storm would # IIRC). self.assertRaises( BundleDeserializationError.DoesNotExist, BundleDeserializationError.objects.get, bundle=self.bundle)
957b0eab837f40bbe8180ecadeffedaf82ab9311 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/957b0eab837f40bbe8180ecadeffedaf82ab9311/tests.py
('software_context_defaults', {
('software_context_parsing', {
def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deserialization_error # directly due to the way django handles operations that affect # existing instances (it does not touch them like storm would # IIRC). self.assertRaises( BundleDeserializationError.DoesNotExist, BundleDeserializationError.objects.get, bundle=self.bundle)
957b0eab837f40bbe8180ecadeffedaf82ab9311 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/957b0eab837f40bbe8180ecadeffedaf82ab9311/tests.py
"test_id": "some_test",
""" + _TEST_RUN_BOILERPLATE + """
def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deserialization_error # directly due to the way django handles operations that affect # existing instances (it does not touch them like storm would # IIRC). self.assertRaises( BundleDeserializationError.DoesNotExist, BundleDeserializationError.objects.get, bundle=self.bundle)
957b0eab837f40bbe8180ecadeffedaf82ab9311 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/957b0eab837f40bbe8180ecadeffedaf82ab9311/tests.py
"test_id": "some_test",
""" + _TEST_RUN_BOILERPLATE + """
def test_deserialize_clears_old_error_on_success(self): BundleDeserializationError.objects.create( bundle = self.bundle, error_message="not important").save() mock = self.mocker.patch(self.bundle) expect(mock._do_deserialize()) self.mocker.replay() self.bundle.deserialize() # note we cannot check for self.bundle.deserialization_error # directly due to the way django handles operations that affect # existing instances (it does not touch them like storm would # IIRC). self.assertRaises( BundleDeserializationError.DoesNotExist, BundleDeserializationError.objects.get, bundle=self.bundle)
957b0eab837f40bbe8180ecadeffedaf82ab9311 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/957b0eab837f40bbe8180ecadeffedaf82ab9311/tests.py
def dispatch(self): args = self.parser.parse_args()
def dispatch(self, args=None): args = self.parser.parse_args(args)
def dispatch(self): args = self.parser.parse_args() command = args.command_cls(self.parser, args) command.invoke(args)
220841f93939dc287a2b4bb3e47ee62529ae6841 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/220841f93939dc287a2b4bb3e47ee62529ae6841/dispatcher.py
users = set() groups = set()
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ users = set() groups = set() bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] users.add(user) initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] groups.add(group) initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams for bundle_stream in bundle_streams: bundle_stream.delete() for user in users: user.delete() for group in groups: group.delete()
1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22/fixtures.py
users.add(user)
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ users = set() groups = set() bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] users.add(user) initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] groups.add(group) initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams for bundle_stream in bundle_streams: bundle_stream.delete() for user in users: user.delete() for group in groups: group.delete()
1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22/fixtures.py
groups.add(group)
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ users = set() groups = set() bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] users.add(user) initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] groups.add(group) initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams for bundle_stream in bundle_streams: bundle_stream.delete() for user in users: user.delete() for group in groups: group.delete()
1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22/fixtures.py
for bundle_stream in bundle_streams: bundle_stream.delete() for user in users: user.delete() for group in groups: group.delete()
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ users = set() groups = set() bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] users.add(user) initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] groups.add(group) initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams for bundle_stream in bundle_streams: bundle_stream.delete() for user in users: user.delete() for group in groups: group.delete()
1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/1bf7e9c81a8c80c89f5085e57e6b33bd3c945f22/fixtures.py
{'test_runs': [TestRuns]})
{'test_runs': [TestRun]})
def test_get_json_attr_types(self): self.assertEqual(DashboardBundle.get_json_attr_types(), {'test_runs': [TestRuns]})
70a9b009a7f3dcc48a315235c99fe73f28661897 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/70a9b009a7f3dcc48a315235c99fe73f28661897/test_dashboard_bundle_format_1_0.py
netloc = "%s:%s@%s:%d" % (
netloc = "%s:%s@%s" % (
def __init__(self, parser, args): super(XMLRPCCommand, self).__init__(parser, args) parts = urlparse.urlsplit(args.dashboard_url) if args.username and args.password: netloc = "%s:%s@%s:%d" % ( args.username, args.password, parts.host, parts.port or 80) else: netloc = parts.netloc urltext = urlparse.urlunsplit((parts.scheme, netloc, "/xml-rpc/", "", "")) self.server = xmlrpclib.ServerProxy(urltext, use_datetime=True, allow_none=True, verbose=args.verbose_xml_rpc)
00c8102ce944cac7073ef110d09be4e395cbd9dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/00c8102ce944cac7073ef110d09be4e395cbd9dd/dashboard.py
parts.host, parts.port or 80)
parts.netloc)
def __init__(self, parser, args): super(XMLRPCCommand, self).__init__(parser, args) parts = urlparse.urlsplit(args.dashboard_url) if args.username and args.password: netloc = "%s:%s@%s:%d" % ( args.username, args.password, parts.host, parts.port or 80) else: netloc = parts.netloc urltext = urlparse.urlunsplit((parts.scheme, netloc, "/xml-rpc/", "", "")) self.server = xmlrpclib.ServerProxy(urltext, use_datetime=True, allow_none=True, verbose=args.verbose_xml_rpc)
00c8102ce944cac7073ef110d09be4e395cbd9dd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/00c8102ce944cac7073ef110d09be4e395cbd9dd/dashboard.py
to_hide = set(self._hook.prohibited)
to_hide = set()
def mock_imports(self, reload_list=None): """ Make prohibit_importing() work by hiding and importing again all the modules that depended on an imported prohibited module.
854aa352aa94714be03ae862468be5ade10e2279 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/854aa352aa94714be03ae862468be5ade10e2279/import_prohibitor.py
print cleaned_data
def clean(self): cleaned_data = self.cleaned_data print cleaned_data if (cleaned_data.get('user', '') is not None and cleaned_data.get('group') is not None): raise forms.ValidationError('BundleStream cannot have both user ' 'and name set at the same time') return super(BundleStreamAdminForm, self).clean()
f7e475811b297ced783f48f128b2a940a894ba6d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/f7e475811b297ced783f48f128b2a940a894ba6d/admin.py
group.add_argument("--dashboard-url", required=True,
group.add_argument("--dashboard-url", required=True,
def register_arguments(cls, parser): group = parser.add_argument_group("Dashboard Server options") group.add_argument("--dashboard-url", required=True, metavar="URL", help="URL of your validation dashboard") group.add_argument("--verbose-xml-rpc", action="store_true", default=False, help="Show XML-RPC data")
91706d3d61a8015f21b525218503e0a2797ec77b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/91706d3d61a8015f21b525218503e0a2797ec77b/dashboard.py
this sample. The quantity describes a value of certain type. See the units property to know more. Measurement can be None on failed tests only. >>> sample = QuantitativeSample('test-id', None, ... test_result='fail') >>> sample.measurement is None True We expect to have some value if the test was carried out correctly. ValueError is raised if this is not the case: >>> sample = QuantitativeSample('test-id', None, ... test_result='pass') Traceback (most recent call last): ... ValueError: Measurement cannot be None if the test succeeded Measurement must be a number. Either int, long or float: >>> sample.measurement = 10 >>> sample.measurement = 10L >>> sample.measurement = 10.0
a test result. The quantity describes a value of certain type. See the units property to know more. Measurement must be a number. Either int, long, float or Decimal: >>> result = TestResult('some-test', 'unknown') >>> result.measurement = 10 >>> result.measurement = 10L >>> result.measurement = 10.0 >>> result.measurement = Decimal('10.0')
def _set_measurement(self, value): valid_types = (int, long, float, Decimal, NoneType) if not isinstance(value, valid_types): raise TypeError("Measurement must be an int, long, float, Decimal or None") self._measurement = value
9b6bbb4a99f01adb7c31b0f16a5fedafbfa9f7c3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/9b6bbb4a99f01adb7c31b0f16a5fedafbfa9f7c3/test_result.py
>>> sample.measurement = "great" Traceback (most recent call last): ... TypeError: Measurement must be an int, long or float
>>> result.measurement = "great" Traceback (most recent call last): ... TypeError: Measurement must be an int, long, float, Decimal or None
def _set_measurement(self, value): valid_types = (int, long, float, Decimal, NoneType) if not isinstance(value, valid_types): raise TypeError("Measurement must be an int, long, float, Decimal or None") self._measurement = value
9b6bbb4a99f01adb7c31b0f16a5fedafbfa9f7c3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/9b6bbb4a99f01adb7c31b0f16a5fedafbfa9f7c3/test_result.py
>>> sample = QualitativeSample('fail')
>>> sample = TestResult('some-test-case', 'fail')
def _set_duration(self, duration): if duration is not None and not isinstance(duration, timedelta): raise TypeError("Duration must be None or timedelta " "instance") if duration is not None and duration.days < 0: raise ValueError("Duration cannot be negative") self._duration = duration
9b6bbb4a99f01adb7c31b0f16a5fedafbfa9f7c3 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/9b6bbb4a99f01adb7c31b0f16a5fedafbfa9f7c3/test_result.py
def test_get_help_defaults_to_None(self): class mysterious(Command): pass self.assertEqual(mysterious.get_help(), None)
76497e21cd31cd5aa5eb6c9f468d74a50f49917e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/76497e21cd31cd5aa5eb6c9f468d74a50f49917e/test_commands.py
class BundleStreamDetailViewAuthenticatedTest(TestCase):
class BundleStreamDetailViewAuthorizedTest(BundleStreamDetailViewAnonymousTest):
def test_template_used(self): response = self.client.get("/streams" + self.bundle_stream.pathname) if self.bundle_stream.can_access(self.user): self.assertTemplateUsed(response, "dashboard_app/bundle_stream_detail.html") else: self.assertTemplateUsed(response, "403.html")
4629496fb811f352fcd93b1a7fea39acfb2e7767 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/4629496fb811f352fcd93b1a7fea39acfb2e7767/tests.py
specification
specification.
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams
ece5425653c15633b07f0df486f6fdfe2bdbef33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/ece5425653c15633b07f0df486f6fdfe2bdbef33/fixtures.py
spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional]
`spec`: list of dictionaries List of values to make_bundle_stream()
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams
ece5425653c15633b07f0df486f6fdfe2bdbef33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/ece5425653c15633b07f0df486f6fdfe2bdbef33/fixtures.py
yields: list of created bundle streams
yields: list of BundleStream List of created bundle stream objects
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams
ece5425653c15633b07f0df486f6fdfe2bdbef33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/ece5425653c15633b07f0df486f6fdfe2bdbef33/fixtures.py
initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream)
bundle_streams.append(make_bundle_stream(stream_args))
def created_bundle_streams(spec): """ Helper context manager that creates bundle streams according to specification spec is a list of dictionaries with the following keys: user: string indicating user name to create [optional] group: string indicating group name to create [optional] slug: slug-like name [optional] name: name of the stream to create [optional] yields: list of created bundle streams """ bundle_streams = [] for stream_args in spec: initargs = { 'user': None, 'group': None, 'slug': stream_args.get('slug', ''), 'name': stream_args.get('name', '')} username = stream_args.get('user') if username: user = User.objects.get_or_create(username=username)[0] initargs['user'] = user groupname = stream_args.get('group') if groupname: group = Group.objects.get_or_create(name=groupname)[0] initargs['group'] = group bundle_stream = BundleStream.objects.create(**initargs) bundle_stream.save() bundle_streams.append(bundle_stream) yield bundle_streams
ece5425653c15633b07f0df486f6fdfe2bdbef33 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/ece5425653c15633b07f0df486f6fdfe2bdbef33/fixtures.py
if self.deserialization_error.exists():
if self.deserialization_error.count():
def deserialize(self): """ Deserialize the contents of this bundle.
0d264d0c952ecd84fdd28f5d41b54cc75dee1d8b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/0d264d0c952ecd84fdd28f5d41b54cc75dee1d8b/models.py
... def _deserialize(cls, doc):
b0b93f243207431f5cbba46dce144b5f2515c30d /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/b0b93f243207431f5cbba46dce144b5f2515c30d/utils_json.py
def __eq__(self, other): return self.name == other.name and \ debian_version_compare(self.version, other.version) == 0 def __lt__(self, other): return self.name < other.name or ( self.name == other.name and debian_version_compare(self.version, other.version) < 0)
def __cmp__(self, other): result = cmp(self.name, other.name) if result != 0: return result return debian_version_compare(self.version, other.version)
def __eq__(self, other): return self.name == other.name and \ debian_version_compare(self.version, other.version) == 0
6ac5c044beb0e7086f20e7cfbd408b9b3fda2632 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/6ac5c044beb0e7086f20e7cfbd408b9b3fda2632/sw_profile.py
self.args.BUNDLE_ID, filename)
self.args.SHA1, filename)
def invoke_remote(self): response = self.server.get(self.args.SHA1) if self.args.output is None: filename = response['content_filename'] if os.path.exists(filename) and not self.args.overwrite: print "File {filename!r} already exists".format( filename=filename) print "You may pass --overwrite to write over it" return stream = open(filename, "wb") else: stream = self.args.output filename = self.args.output.name stream.write(response['content']) print "Downloaded bundle {0} to file {1!r}".format( self.args.BUNDLE_ID, filename)
1bdf6d97e4ffa0c93b962fc82b4a08377f417a27 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/1bdf6d97e4ffa0c93b962fc82b4a08377f417a27/dashboard.py
QuantitativeSample Qualitative Sample class. Used to represent results for benchmarks.
Quantitative Sample class. Used to represent results for benchmarks.
def __init__(self, test_result, test_id=None, message=None, timestamp=None, duration=None): """ Initialize qualitative sample instance.
05fb9c903ee64c235177b26789f632712a0aa717 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/05fb9c903ee64c235177b26789f632712a0aa717/sample.py
self.prohibit_importing('debian.debian_support') self.mock_imports('launch_control.sw_profile') mocker = Mocker() obj = mocker.replace('debian_bundle.debian_support.version_compare') mocker.replay() import launch_control.sw_profile self.assertTrue(launch_control.sw_profile.debian_version_compare is obj) mocker.verify() mocker.restore()
try: import debian except ImportError: pass else: self.prohibit_importing('debian.debian_support') self.mock_imports('launch_control.sw_profile') mocker = Mocker() obj = mocker.replace('debian_bundle.debian_support.version_compare') mocker.replay() import launch_control.sw_profile self.assertTrue(launch_control.sw_profile.debian_version_compare is obj) mocker.verify() mocker.restore()
def test_debian_import_failure(self): """ Make sure we import debian_bundle if debian is not available """ self.prohibit_importing('debian.debian_support') self.mock_imports('launch_control.sw_profile') mocker = Mocker() obj = mocker.replace('debian_bundle.debian_support.version_compare') mocker.replay() import launch_control.sw_profile self.assertTrue(launch_control.sw_profile.debian_version_compare is obj) mocker.verify() mocker.restore()
dca9f2f5f76d60bccbb7c30194b7d789cf436e20 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/dca9f2f5f76d60bccbb7c30194b7d789cf436e20/sw_profile.py
""" Log file name. """)
"Log file name")
def _set_log_filename(self, log_filename): self._log_filename = log_filename
217d12136ccc1d46d76fbe600da287bfa7ff002b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/217d12136ccc1d46d76fbe600da287bfa7ff002b/test_result.py
""" Log file name. """)
"Log file line number")
def _set_log_lineno(self, log_lineno): self._log_lineno = log_lineno
217d12136ccc1d46d76fbe600da287bfa7ff002b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/217d12136ccc1d46d76fbe600da287bfa7ff002b/test_result.py
bundle.deserialization_error.error_message)
bundle.deserialization_error.get().error_message)
def deserialize(self, content_sha1): """ Name ---- `deserialize` (`content_sha1`)
c8c3b4e439633e01c00ee4757bfd775558afc861 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/c8c3b4e439633e01c00ee4757bfd775558afc861/xmlrpc.py
analyzer_assigned_uuid = c_test_run.analyzer_assigned_uuid,
analyzer_assigned_uuid = str(c_test_run.analyzer_assigned_uuid),
def memory_model_to_db_model(self, c_bundle, s_bundle): """ Translate a memory model to database model """ from dashboard_app.models import ( Attachment, HardwareDevice, NamedAttribute, SoftwarePackage, Test, TestCase, TestResult, TestRun, ) # All variables prefixed with c_ refer to CLIENT SIDE models # All variables prefixed with s_ refer to SERVER SIDE models for c_test_run in c_bundle.test_runs: s_test, test_created = Test.objects.get_or_create( test_id = c_test_run.test_id) if test_created: s_test.save() s_test_run = TestRun.objects.create( bundle = s_bundle, test = s_test, analyzer_assigned_uuid = c_test_run.analyzer_assigned_uuid, analyzer_assigned_date = c_test_run.analyzer_assigned_date, time_check_performed = c_test_run.time_check_performed, sw_image_desc = (c_test_run.sw_context.sw_image.desc if c_test_run.sw_context and c_test_run.sw_context.sw_image else "")) s_test_run.save() # needed for foreign key models below # Software Context: if c_test_run.sw_context: for c_package in c_test_run.sw_context.packages: s_package, package_created = SoftwarePackage.objects.get_or_create( name=c_package.name, version=c_package.version) if package_created: s_package.save() s_test_run.packages.add(s_package) # Hardware Context: if c_test_run.hw_context: for c_device in c_test_run.hw_context.devices: s_device = HardwareDevice.objects.create( device_type = c_device.device_type, description = c_device.description) s_device.save() for name, value in c_device.attributes.iteritems(): s_device.attributes.create(name=name, value=value) s_test_run.devices.add(s_device) # Test Results: for c_test_result in c_test_run.test_results: if c_test_result.test_case_id: s_test_case, test_case_created = TestCase.objects.get_or_create( test_case_id = c_test_result.test_case_id, test = s_test_run.test, defaults = {'units': c_test_result.units}) if test_case_created: s_test_case.save() else: s_test_case = None s_test_result = TestResult.objects.create( test_run = s_test_run, test_case = s_test_case, result = self._translate_result_string(c_test_result.result), measurement = c_test_result.measurement, filename = c_test_result.log_filename, lineno = c_test_result.log_lineno, message = c_test_result.message, timestamp = c_test_result.timestamp, duration = c_test_result.duration) s_test_result.save() # needed for foreign key models below for name, value in c_test_result.attributes.iteritems(): s_test_result.attributes.create( name=name, value=value) # Test Run Attachments for filename, lines in c_test_run.attachments.iteritems(): s_attachment = s_test_run.attachments.create(content_filename=filename) s_attachment.save() s_attachment.content.save( "attachment-{0}.txt".format(s_attachment.pk), ContentFile("".join(lines).encode("UTF-8"))) # Test Run Attributes for name, value in c_test_run.attributes.iteritems(): s_test_run.attributes.create( name=str(name), value=str(value))
21eb09a469dc088b11a2bc7671443d3630353b58 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/21eb09a469dc088b11a2bc7671443d3630353b58/helpers.py
retval = self.xml_rpc_call("ping") self.assertEqual(retval, "pong")
def test_echo(self): self.assertEqual(self.xml_rpc_call("echo", 1), 1) self.assertEqual(self.xml_rpc_call("echo", "string"), "string") self.assertEqual(self.xml_rpc_call("echo", 1.5), 1.5) retval = self.xml_rpc_call("ping") self.assertEqual(retval, "pong")
1b3e4beef23fa8c3a21ea94ebece18bd499e0c09 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/1b3e4beef23fa8c3a21ea94ebece18bd499e0c09/tests.py
Returns value
Return value
def version(self): """ Name ---- `version` ()
ff9ad429d643ac267d528521f3e30a1b0c97f5bb /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/ff9ad429d643ac267d528521f3e30a1b0c97f5bb/xmlrpc.py
verbose_name = _(u"Description."),
verbose_name = _(u"Description"),
def __unicode__(self): return _(u"{name}: {value}").format( name = self.name, value = self.value)
915b1e102fca41c9dd70c8ebc6140c71e2257d13 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/915b1e102fca41c9dd70c8ebc6140c71e2257d13/models.py
def mock_imports(self, reload_list=None): """ Make prohibit_importing() work by hiding and importing again all the modules that depended on an imported prohibited module.
63c7544cbd08c81807594f551d35b440c3301076 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/63c7544cbd08c81807594f551d35b440c3301076/import_prohibitor.py
urls = 'dashboard_app.test_urls'
def test_test_result__unknown(self): obj = TestResult(result=TestResult.RESULT_UNKNOWN, id=1) self.assertEqual(unicode(obj), "#1 unknown")
7362473c8efa9da5331b82251c0ea87009f105dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/7362473c8efa9da5331b82251c0ea87009f105dc/tests.py
endpoint_path = reverse("dashboard_app.dashboard_xml_rpc_handler")
endpoint_path = reverse("xml-rpc")
def test_csrf_not_protecting_xml_rpc_views(self): """call version and check that we didn't get 403""" endpoint_path = reverse("dashboard_app.dashboard_xml_rpc_handler") request_body = xmlrpclib.dumps((), methodname="version") response = self.client.post(endpoint_path, request_body, "text/xml") self.assertContains(response, "<methodResponse>", status_code=200)
7362473c8efa9da5331b82251c0ea87009f105dc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/7362473c8efa9da5331b82251c0ea87009f105dc/tests.py
self.format = format or self.FORMAT self.test_runs = test_runs or []
if format is None: format = self.FORMAT if test_runs is None: test_runs = [] self.format = format self.test_runs = test_runs
def __init__(self, format=None, test_runs=None): self.format = format or self.FORMAT self.test_runs = test_runs or []
18e5045be4f84bb096455ab4656b4661941da0cc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/18e5045be4f84bb096455ab4656b4661941da0cc/bundle.py
class CSRFExemptForXMLRPCAPITestCase(CSRFTestCase, DashboardAPITestCase):
def test_cross_site_login_fails(self): response = self.client.post(self.login_path, { 'user': 'user', 'pass': 'pass'}) self.assertEquals(response.status_code, 403)
35e6b4b2dd937e66499079eb13fa5a959649d48b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/35e6b4b2dd937e66499079eb13fa5a959649d48b/tests.py
response = self.client.post( self.endpoint_path, request_body, "text/xml")
response = self.client.post(endpoint_path, request_body, "text/xml")
def test_csrf_not_protecting_xml_rpc_views(self): """call version and check that we didn't get 403""" request_body = xmlrpclib.dumps((), methodname="version") response = self.client.post( self.endpoint_path, request_body, "text/xml") self.assertContains(response, "<methodResponse>", status_code=200)
35e6b4b2dd937e66499079eb13fa5a959649d48b /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12617/35e6b4b2dd937e66499079eb13fa5a959649d48b/tests.py
def parse(data): header = {} signals = {1:('0',0),2:('1',0),3:('Local',0)} modules = {} for token in data: objtype=token.get('ObjTp','') if objtype=='Hd': header['dealer']=token.get('DlrNm','n/a') header['programer']=token.get('PgmNm','n/a') header['file']=token.get('PrNm','n/a') header['hint']=token.get('CltNm','n/a') elif objtype=='Sg': snumber = int(token.get('H', '-1')) # for debug purpose sname = token.get('Nm','n/a') stype = int(token.get('SgTp','1')) if stype not in [1,2,4]: stype=0 elif stype==4: stype=3 signals[snumber]=(sname, stype) elif objtype=='Sm': mtag = token.get('H', '-1') minfo = get_info(token) mtype = int(token.get('SmC','-1')) mname = token.get('Nm') mcomment = token.get('Cmn1','') if mname is None: mname = database.get(mtype,{}).get('name','!unknown') if mtype in moduleAPI: module = make_module(mname+" - in", mtype, [], minfo['ins'], minfo['params'], minfo['comps'], mcomment) modules["m"+mtag+"i"] = module module = make_module(mname+" - out", mtype, minfo['outs'], comment=mcomment) modules["m"+mtag+"o"] = module elif mtype in interconnectAPI: module = make_module(mname+" - feedback", mtype, minfo['ins'], [], minfo['params'], minfo['comps'], mcomment) modules["m"+mtag+"i"] = module module = make_module(mname+" - input", mtype, outs=minfo['outs'], comment=mcomment) modules["m"+mtag+"o"] = module else: module = make_module( mname, mtype, minfo['ins'], minfo['outs'], minfo['params'], minfo['comps'], mcomment) modules["m"+mtag] = module return header, signals, modules
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
def nonum(name): return filter(lambda x: not x.isdigit(), name)
def make_head(header): return """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) def make_tail(): return "}"
def nonum(name): return filter(lambda x: not x.isdigit(), name)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head]
dot_file = [make_head(header)]
def make_dot(header, signals, modules): head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head] checkT = False checkF = False limit_mods = filter(lambda m: adv_len(modules[m]['ins']) or adv_len(modules[m]['outs']), modules) limit_mods.sort() for m in limit_mods: dot_file.append(make_node(m, modules[m])) checkT = 2 in modules[m]['ins'] or checkT checkF = 1 in modules[m]['ins'] or checkF if checkF: dot_file.append(' 0 [shape="circle"];') if checkT: dot_file.append(' 1 [shape="circle"];') dot_file.append('') limit_sigs = filter(lambda s: is_significant(signals[s][0]), signals) extended_sigs = {} #extended_sigs = { (src,dst):[(name0,type0),(name1,type1)] } for s in limit_sigs: sname, stype = signals[s] outs = filter(lambda m: s in modules[m]['outs'], limit_mods) if sname == '0': outs.append('0') if sname == '1': outs.append('1') ins = filter(lambda m: s in modules[m]['ins'], limit_mods) pack = set() for o in outs: for i in ins: pack.add((o,i)) for line in pack: if extended_sigs.get(line) is None: extended_sigs[line]=[] extended_sigs[line].append(signals[s]) # bus signals agregate for addr in extended_sigs: if len(extended_sigs[addr])==1: sname, stype = extended_sigs[addr][0] dot_file.append(make_direct_signal(addr,sname,stype)) else: pack = {} for n,t in extended_sigs[addr]: tag = (nonum(n),t) if pack.get(tag) is None: pack[tag]=[] pack[tag].append(n) for bulk in pack: if len(pack[bulk])==1: dot_file.append(make_direct_signal(addr,pack[bulk][0],bulk[1])) else: dot_file.append(make_signal_bus(addr,pack[bulk],bulk[1])) dot_file.append(tail) return "\n".join(dot_file)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
dot_file.append(tail)
dot_file.append(make_tail())
def make_dot(header, signals, modules): head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head] checkT = False checkF = False limit_mods = filter(lambda m: adv_len(modules[m]['ins']) or adv_len(modules[m]['outs']), modules) limit_mods.sort() for m in limit_mods: dot_file.append(make_node(m, modules[m])) checkT = 2 in modules[m]['ins'] or checkT checkF = 1 in modules[m]['ins'] or checkF if checkF: dot_file.append(' 0 [shape="circle"];') if checkT: dot_file.append(' 1 [shape="circle"];') dot_file.append('') limit_sigs = filter(lambda s: is_significant(signals[s][0]), signals) extended_sigs = {} #extended_sigs = { (src,dst):[(name0,type0),(name1,type1)] } for s in limit_sigs: sname, stype = signals[s] outs = filter(lambda m: s in modules[m]['outs'], limit_mods) if sname == '0': outs.append('0') if sname == '1': outs.append('1') ins = filter(lambda m: s in modules[m]['ins'], limit_mods) pack = set() for o in outs: for i in ins: pack.add((o,i)) for line in pack: if extended_sigs.get(line) is None: extended_sigs[line]=[] extended_sigs[line].append(signals[s]) # bus signals agregate for addr in extended_sigs: if len(extended_sigs[addr])==1: sname, stype = extended_sigs[addr][0] dot_file.append(make_direct_signal(addr,sname,stype)) else: pack = {} for n,t in extended_sigs[addr]: tag = (nonum(n),t) if pack.get(tag) is None: pack[tag]=[] pack[tag].append(n) for bulk in pack: if len(pack[bulk])==1: dot_file.append(make_direct_signal(addr,pack[bulk][0],bulk[1])) else: dot_file.append(make_signal_bus(addr,pack[bulk],bulk[1])) dot_file.append(tail) return "\n".join(dot_file)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head]
dot_file = [make_head(header)]
def make_dot_merged(header, signals, modules): head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head] limit_mods = filter(lambda m: adv_len(modules[m]['ins']) or adv_len(modules[m]['outs']), modules) limit_mods.sort() dot_file.extend(map(lambda m: make_node(m, modules[m]), limit_mods)) dot_file.append('') limit_sigs = filter(lambda s: is_significant(signals[s][0]), signals) limit_sigs.sort() direct_sigs = {} # for every signal get set of pairs (signal,module) and (module, signal) # bus unable to create for s in limit_sigs: sname, stype = signals[s] stag = "s%d"%s outs = filter(lambda m: s in modules[m]['outs'], limit_mods) ins = filter(lambda m: s in modules[m]['ins'], limit_mods) # filtering out single signals if len(outs)==1 and len(ins)==1: line = (outs[0],ins[0]) if direct_sigs.get(line) is None: direct_sigs[line]=[] direct_sigs[line].append(signals[s]) # for single signals don't create dots # we will add them later continue # for others create packets pack = set() map(lambda m: pack.add((m,stag)), outs) map(lambda m: pack.add((stag,m)), ins) if len(pack)>1: dot_file.append(make_direct_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) elif len(pack)==1: dot_file.append(make_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) # adding single signals, some of them aggregating into bus for addr in direct_sigs: pack = {} for sname, stype in direct_sigs[addr]: tag = (nonum(sname),stype) if pack.get(tag) is None: pack[tag]=[] pack[tag].append(sname) for bulk in pack: if len(pack[bulk])==1: dot_file.append(make_direct_signal(addr,pack[bulk][0],bulk[1])) else: dot_file.append(make_signal_bus(addr,pack[bulk],bulk[1])) dot_file.append(tail) return "\n".join(dot_file)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
dot_file.append(make_direct_signal(stag, sname, stype))
dot_file.append(make_signal(stag, sname, stype))
def make_dot_merged(header, signals, modules): head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head] limit_mods = filter(lambda m: adv_len(modules[m]['ins']) or adv_len(modules[m]['outs']), modules) limit_mods.sort() dot_file.extend(map(lambda m: make_node(m, modules[m]), limit_mods)) dot_file.append('') limit_sigs = filter(lambda s: is_significant(signals[s][0]), signals) limit_sigs.sort() direct_sigs = {} # for every signal get set of pairs (signal,module) and (module, signal) # bus unable to create for s in limit_sigs: sname, stype = signals[s] stag = "s%d"%s outs = filter(lambda m: s in modules[m]['outs'], limit_mods) ins = filter(lambda m: s in modules[m]['ins'], limit_mods) # filtering out single signals if len(outs)==1 and len(ins)==1: line = (outs[0],ins[0]) if direct_sigs.get(line) is None: direct_sigs[line]=[] direct_sigs[line].append(signals[s]) # for single signals don't create dots # we will add them later continue # for others create packets pack = set() map(lambda m: pack.add((m,stag)), outs) map(lambda m: pack.add((stag,m)), ins) if len(pack)>1: dot_file.append(make_direct_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) elif len(pack)==1: dot_file.append(make_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) # adding single signals, some of them aggregating into bus for addr in direct_sigs: pack = {} for sname, stype in direct_sigs[addr]: tag = (nonum(sname),stype) if pack.get(tag) is None: pack[tag]=[] pack[tag].append(sname) for bulk in pack: if len(pack[bulk])==1: dot_file.append(make_direct_signal(addr,pack[bulk][0],bulk[1])) else: dot_file.append(make_signal_bus(addr,pack[bulk],bulk[1])) dot_file.append(tail) return "\n".join(dot_file)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
dot_file.append(tail)
dot_file.append(make_tail())
def make_dot_merged(header, signals, modules): head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head] limit_mods = filter(lambda m: adv_len(modules[m]['ins']) or adv_len(modules[m]['outs']), modules) limit_mods.sort() dot_file.extend(map(lambda m: make_node(m, modules[m]), limit_mods)) dot_file.append('') limit_sigs = filter(lambda s: is_significant(signals[s][0]), signals) limit_sigs.sort() direct_sigs = {} # for every signal get set of pairs (signal,module) and (module, signal) # bus unable to create for s in limit_sigs: sname, stype = signals[s] stag = "s%d"%s outs = filter(lambda m: s in modules[m]['outs'], limit_mods) ins = filter(lambda m: s in modules[m]['ins'], limit_mods) # filtering out single signals if len(outs)==1 and len(ins)==1: line = (outs[0],ins[0]) if direct_sigs.get(line) is None: direct_sigs[line]=[] direct_sigs[line].append(signals[s]) # for single signals don't create dots # we will add them later continue # for others create packets pack = set() map(lambda m: pack.add((m,stag)), outs) map(lambda m: pack.add((stag,m)), ins) if len(pack)>1: dot_file.append(make_direct_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) elif len(pack)==1: dot_file.append(make_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) # adding single signals, some of them aggregating into bus for addr in direct_sigs: pack = {} for sname, stype in direct_sigs[addr]: tag = (nonum(sname),stype) if pack.get(tag) is None: pack[tag]=[] pack[tag].append(sname) for bulk in pack: if len(pack[bulk])==1: dot_file.append(make_direct_signal(addr,pack[bulk][0],bulk[1])) else: dot_file.append(make_signal_bus(addr,pack[bulk],bulk[1])) dot_file.append(tail) return "\n".join(dot_file)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
def make_dot_merged(header, signals, modules): head = """// file: %s\n// dealer: %s\n// programmer: %s\n// hint: %s\n\ndigraph {"""%( header['file'],header['dealer'],header['programer'],header['hint']) tail = """}""" dot_file = [head] limit_mods = filter(lambda m: adv_len(modules[m]['ins']) or adv_len(modules[m]['outs']), modules) limit_mods.sort() dot_file.extend(map(lambda m: make_node(m, modules[m]), limit_mods)) dot_file.append('') limit_sigs = filter(lambda s: is_significant(signals[s][0]), signals) limit_sigs.sort() direct_sigs = {} # for every signal get set of pairs (signal,module) and (module, signal) # bus unable to create for s in limit_sigs: sname, stype = signals[s] stag = "s%d"%s outs = filter(lambda m: s in modules[m]['outs'], limit_mods) ins = filter(lambda m: s in modules[m]['ins'], limit_mods) # filtering out single signals if len(outs)==1 and len(ins)==1: line = (outs[0],ins[0]) if direct_sigs.get(line) is None: direct_sigs[line]=[] direct_sigs[line].append(signals[s]) # for single signals don't create dots # we will add them later continue # for others create packets pack = set() map(lambda m: pack.add((m,stag)), outs) map(lambda m: pack.add((stag,m)), ins) if len(pack)>1: dot_file.append(make_direct_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) elif len(pack)==1: dot_file.append(make_signal(stag, sname, stype)) for src, dst in pack: dot_file.append(make_link(src,dst,stype)) # adding single signals, some of them aggregating into bus for addr in direct_sigs: pack = {} for sname, stype in direct_sigs[addr]: tag = (nonum(sname),stype) if pack.get(tag) is None: pack[tag]=[] pack[tag].append(sname) for bulk in pack: if len(pack[bulk])==1: dot_file.append(make_direct_signal(addr,pack[bulk][0],bulk[1])) else: dot_file.append(make_signal_bus(addr,pack[bulk],bulk[1])) dot_file.append(tail) return "\n".join(dot_file)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
if len(sys.argv) != 2: print 'Please specify one filename on the command line.' sys.exit(1) text = open(sys.argv[1],"rt").read()
usage = "usage: %prog [options] inputfile\ninputfile of smw/umc/cmc Crestron's filetypes" parser = OptionParser(usage=usage) parser.add_option("-o","--output", dest="output", help="write result to FILE", metavar="FILE") parser.add_option("-m","--merged", dest="merge", action="store_true", help="make \"merged signals\" version", default=False) (options,args) = parser.parse_args() if len(args) != 1: parser.error("input file is required") (filename,) = args text = open(filename, "rt").read()
def main(): if len(sys.argv) != 2: print 'Please specify one filename on the command line.' sys.exit(1) text = open(sys.argv[1],"rt").read() tree = tokenize(text) header,sigs,mods = parse(tree) print make_dot(header,sigs,mods) #print make_dot_merged(header,sigs,mods)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
print make_dot(header,sigs,mods)
if options.merge: result = make_dot_merged(header,sigs,mods) else: result = make_dot(header,sigs,mods) if options.output is not None: open(options.output, "wt").write(result) else: print result
def main(): if len(sys.argv) != 2: print 'Please specify one filename on the command line.' sys.exit(1) text = open(sys.argv[1],"rt").read() tree = tokenize(text) header,sigs,mods = parse(tree) print make_dot(header,sigs,mods) #print make_dot_merged(header,sigs,mods)
92d449070c08914a89e0b20421f4ac4b4b3bf017 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/280/92d449070c08914a89e0b20421f4ac4b4b3bf017/smw2dot.py
check(isinstance(month, str)) dbapi.return_strs_as_unicode(True)
check(isinstance(month, str), "Value of str should be regular string") return_strs_as_unicode(True)
def checkEqual(var1, var2): check(var1 == var2, "Values not equal: '" + str(var1) + "' !='" + str(var2) + "'")
56bc6b31d09d110f65f951817ff31ab21aed968a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/310/56bc6b31d09d110f65f951817ff31ab21aed968a/python_dbapi_test.py
check(isinstance(month, unicode)) dbapi.return_strs_as_unicode(False)
check(isinstance(month, unicode), "Value of str should be unicode string") return_strs_as_unicode(False)
def checkEqual(var1, var2): check(var1 == var2, "Values not equal: '" + str(var1) + "' !='" + str(var2) + "'")
56bc6b31d09d110f65f951817ff31ab21aed968a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/310/56bc6b31d09d110f65f951817ff31ab21aed968a/python_dbapi_test.py
check(isinstance(month, str))
check(isinstance(month, str), "Value of str should be regular string")
def checkEqual(var1, var2): check(var1 == var2, "Values not equal: '" + str(var1) + "' !='" + str(var2) + "'")
56bc6b31d09d110f65f951817ff31ab21aed968a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/310/56bc6b31d09d110f65f951817ff31ab21aed968a/python_dbapi_test.py
'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theorical Revenue',
'ca_theorical': fields.function(_analysis_all, method=True, multi='analytic_analysis', type='float', string='Theoretical Revenue',
def _theorical_margin_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids, context=context): res[account.id] = account.ca_theorical + account.total_cost for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3415b14d6137c1321c302ddbfce5d3abfacd8e15 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3415b14d6137c1321c302ddbfce5d3abfacd8e15/account_analytic_analysis.py
'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theorical Margin',
'theorical_margin': fields.function(_theorical_margin_calc, method=True, type='float', string='Theoretical Margin',
def _theorical_margin_calc(self, cr, uid, ids, name, arg, context=None): res = {} for account in self.browse(cr, uid, ids, context=context): res[account.id] = account.ca_theorical + account.total_cost for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3415b14d6137c1321c302ddbfce5d3abfacd8e15 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3415b14d6137c1321c302ddbfce5d3abfacd8e15/account_analytic_analysis.py
_description = "Hours summary by user"
_description = "Hours Summary by User"
def _user(self, cr, uid, ids, name, arg, context=None): res = {} cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] for id in ids: ids2 = self.search(cr, uid, [('parent_id', 'child_of', [id])]) if ids2: cr.execute('SELECT DISTINCT("user") FROM account_analytic_analysis_summary_user ' \ 'WHERE account_id =ANY(%s) AND unit_amount <> 0.0',(ids2,)) res[id] = [int((id * max_user) + x[0]) for x in cr.fetchall()] else: res[id] = [] return res
b50118c07936d539bf5d8ed52bcba7bab70c5acc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/b50118c07936d539bf5d8ed52bcba7bab70c5acc/account_analytic_analysis.py
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'): if context is None: context = {} if not ids: return []
81b996cdad05b6a314695f98a04ee77827852339 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/81b996cdad05b6a314695f98a04ee77827852339/account_analytic_analysis.py
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \
res_final = {} child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) for i in child_ids: res[i] = {} for n in [name]: res[i][n] = 0.0 if not child_ids: return res if child_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount), 0.0) \
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
8642bc7e591b6165264e303c37dfb9055fd63362 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/8642bc7e591b6165264e303c37dfb9055fd63362/account_analytic_analysis.py
GROUP BY account_analytic_line.account_id", (parent_ids,))
GROUP BY account_analytic_line.account_id", (child_ids,))
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
8642bc7e591b6165264e303c37dfb9055fd63362 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/8642bc7e591b6165264e303c37dfb9055fd63362/account_analytic_analysis.py
res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
res[account_id][name] = round(sum,2) data = self._compute_level_tree(cr, uid, ids, child_ids, res, [name], context) for i in data: res_final[i] = data[i][name] return res_final
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND account_analytic_journal.type = 'sale' \ GROUP BY account_analytic_line.account_id", (parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
8642bc7e591b6165264e303c37dfb9055fd63362 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/8642bc7e591b6165264e303c37dfb9055fd63362/account_analytic_analysis.py
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \
res_final = {} child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) for i in child_ids: res[i] = {} for n in [name]: res[i][n] = 0.0 if not child_ids: return res if child_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount), 0.0) \
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
8642bc7e591b6165264e303c37dfb9055fd63362 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/8642bc7e591b6165264e303c37dfb9055fd63362/account_analytic_analysis.py
GROUP BY account_analytic_line.account_id""",(parent_ids,))
GROUP BY account_analytic_line.account_id""",(child_ids,))
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
8642bc7e591b6165264e303c37dfb9055fd63362 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/8642bc7e591b6165264e303c37dfb9055fd63362/account_analytic_analysis.py
res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
res[account_id][name] = round(sum,2) data = self._compute_level_tree(cr, uid, ids, child_ids, res, [name], context) for i in data: res_final[i] = data[i][name] return res_final
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
8642bc7e591b6165264e303c37dfb9055fd63362 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/8642bc7e591b6165264e303c37dfb9055fd63362/account_analytic_analysis.py
for account_id, sum in cr.fetchall(): res[account_id] = sum
for account_id, lid in cr.fetchall(): res[account_id][f] = lid
def _analysis_all(self, cr, uid, ids, fields, arg, context=None): dp = 2 res = dict([(i, {}) for i in ids])
1a63e1c0446ff8a7681b88775ab2dc9fbd57a788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/1a63e1c0446ff8a7681b88775ab2dc9fbd57a788/account_analytic_analysis.py
for account_id, sum in cr.fetchall(): res[account_id][f] = sum
for account_id, lwd in cr.fetchall(): res[account_id][f] = lwd
def _analysis_all(self, cr, uid, ids, fields, arg, context=None): dp = 2 res = dict([(i, {}) for i in ids])
1a63e1c0446ff8a7681b88775ab2dc9fbd57a788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/1a63e1c0446ff8a7681b88775ab2dc9fbd57a788/account_analytic_analysis.py
for account_id, sum in cr.fetchall(): res[account_id][f] = round(sum, dp)
for account_id, sua in cr.fetchall(): res[account_id][f] = round(sua, dp)
def _analysis_all(self, cr, uid, ids, fields, arg, context=None): dp = 2 res = dict([(i, {}) for i in ids])
1a63e1c0446ff8a7681b88775ab2dc9fbd57a788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/1a63e1c0446ff8a7681b88775ab2dc9fbd57a788/account_analytic_analysis.py
for account_id, sum in ff: res[account_id][f] = round(sum, dp)
for account_id, hq in ff: res[account_id][f] = round(hq, dp)
def _analysis_all(self, cr, uid, ids, fields, arg, context=None): dp = 2 res = dict([(i, {}) for i in ids])
1a63e1c0446ff8a7681b88775ab2dc9fbd57a788 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/1a63e1c0446ff8a7681b88775ab2dc9fbd57a788/account_analytic_analysis.py
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids: cr.execute("select account_analytic_line.account_id, COALESCE(sum(amount_currency),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id IN %s \ and account_analytic_journal.type = 'sale' \ group by account_analytic_line.account_id" ,(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context)
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids: cr.execute("""select account_analytic_line.account_id,COALESCE(sum(amount_currency),0.0) \
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
def _ca_theorical_calc(self, cr, uid, ids, name, arg, context=None): res = {} res2 = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) # Warning # This computation doesn't take care of pricelist ! # Just consider list_price if parent_ids: cr.execute("""select account_analytic_line.account_id as account_id, \ COALESCE(sum((account_analytic_line.unit_amount * pt.list_price) \ - (account_analytic_line.unit_amount * pt.list_price \ * hr.factor)),0.0) as somme from account_analytic_line \ left join account_analytic_journal \ on (account_analytic_line.journal_id = account_analytic_journal.id) \ join product_product pp \ on (account_analytic_line.product_id = pp.id) \ join product_template pt \ on (pp.product_tmpl_id = pt.id) \ join account_analytic_account a \ on (a.id=account_analytic_line.account_id) \ join hr_timesheet_invoice_factor hr \ on (hr.id=a.to_invoice) \ where account_analytic_line.account_id IN %s \ and a.to_invoice IS NOT NULL \ and account_analytic_journal.type IN ('purchase','general') GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res2[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) res2.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) res[obj_id] += res2.get(child_id, 0.0) # sum both result on account_id for id in ids: res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2) return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
def _ca_theorical_calc(self, cr, uid, ids, name, arg, context=None): res = {} res2 = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) # Warning # This computation doesn't take care of pricelist ! # Just consider list_price if parent_ids: cr.execute("""select account_analytic_line.account_id as account_id, \ COALESCE(sum((account_analytic_line.unit_amount * pt.list_price) \ - (account_analytic_line.unit_amount * pt.list_price \ * hr.factor)),0.0) as somme from account_analytic_line \ left join account_analytic_journal \ on (account_analytic_line.journal_id = account_analytic_journal.id) \ join product_product pp \ on (account_analytic_line.product_id = pp.id) \ join product_template pt \ on (pp.product_tmpl_id = pt.id) \ join account_analytic_account a \ on (a.id=account_analytic_line.account_id) \ join hr_timesheet_invoice_factor hr \ on (hr.id=a.to_invoice) \ where account_analytic_line.account_id IN %s \ and a.to_invoice IS NOT NULL \ and account_analytic_journal.type IN ('purchase','general') GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res2[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) res2.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) res[obj_id] += res2.get(child_id, 0.0) # sum both result on account_id for id in ids: res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2) return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
def _user(self, cr, uid, ids, name, arg, context=None): res = {} cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] for id in ids: parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids: cr.execute('SELECT DISTINCT("user") FROM account_analytic_analysis_summary_user ' \ 'WHERE account_id IN %s AND unit_amount <> 0.0',(parent_ids,)) res[id] = [int((id * max_user) + x[0]) for x in cr.fetchall()] else: res[id] = [] return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)]))
parent_ids = tuple(account_obj.search(cr, uid, [('parent_id', 'child_of', account_ids)]))
def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} account_obj = self.pool.get('account.analytic.account') cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] account_ids = [int(str(x/max_user - (x%max_user == 0 and 1 or 0))) for x in ids] user_ids = [int(str(x-((x/max_user - (x%max_user == 0 and 1 or 0)) *max_user))) for x in ids] parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)])) if parent_ids: cr.execute('SELECT id, unit_amount ' \ 'FROM account_analytic_analysis_summary_user ' \ 'WHERE account_id IN %s ' \ 'AND "user" IN %s',(parent_ids, user_ids,)) for sum_id, unit_amount in cr.fetchall(): res[sum_id] = unit_amount for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in account_obj.search(cr, uid, [('parent_id', 'child_of', [int(str(obj_id/max_user - (obj_id%max_user == 0 and 1 or 0)))])]): if child_id != int(str(obj_id/max_user - (obj_id%max_user == 0 and 1 or 0))): res[obj_id] += res.get((child_id * max_user) + obj_id -((obj_id/max_user - (obj_id%max_user == 0 and 1 or 0)) * max_user), 0.0) for id in ids: res[id] = round(res.get(id, 0.0), 2) return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
'AND "user" IN %s',(parent_ids, user_ids,))
'AND "user" IN %s',(parent_ids, tuple(user_ids),))
def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} account_obj = self.pool.get('account.analytic.account') cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] account_ids = [int(str(x/max_user - (x%max_user == 0 and 1 or 0))) for x in ids] user_ids = [int(str(x-((x/max_user - (x%max_user == 0 and 1 or 0)) *max_user))) for x in ids] parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)])) if parent_ids: cr.execute('SELECT id, unit_amount ' \ 'FROM account_analytic_analysis_summary_user ' \ 'WHERE account_id IN %s ' \ 'AND "user" IN %s',(parent_ids, user_ids,)) for sum_id, unit_amount in cr.fetchall(): res[sum_id] = unit_amount for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in account_obj.search(cr, uid, [('parent_id', 'child_of', [int(str(obj_id/max_user - (obj_id%max_user == 0 and 1 or 0)))])]): if child_id != int(str(obj_id/max_user - (obj_id%max_user == 0 and 1 or 0))): res[obj_id] += res.get((child_id * max_user) + obj_id -((obj_id/max_user - (obj_id%max_user == 0 and 1 or 0)) * max_user), 0.0) for id in ids: res[id] = round(res.get(id, 0.0), 2) return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} account_obj = self.pool.get('account.analytic.account') cr.execute('SELECT MAX(id) FROM res_users') max_user = cr.fetchone()[0] account_ids = [int(str(x/max_user - (x%max_user == 0 and 1 or 0))) for x in ids] user_ids = [int(str(x-((x/max_user - (x%max_user == 0 and 1 or 0)) *max_user))) for x in ids] parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)])) if parent_ids: cr.execute('SELECT id, unit_amount ' \ 'FROM account_analytic_analysis_summary_user ' \ 'WHERE account_id IN %s ' \ 'AND "user" IN %s',(parent_ids, user_ids,)) for sum_id, unit_amount in cr.fetchall(): res[sum_id] = unit_amount for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in account_obj.search(cr, uid, [('parent_id', 'child_of', [int(str(obj_id/max_user - (obj_id%max_user == 0 and 1 or 0)))])]): if child_id != int(str(obj_id/max_user - (obj_id%max_user == 0 and 1 or 0))): res[obj_id] += res.get((child_id * max_user) + obj_id -((obj_id/max_user - (obj_id%max_user == 0 and 1 or 0)) * max_user), 0.0) for id in ids: res[id] = round(res.get(id, 0.0), 2) return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
d1, d2 = self.pool.get('ir.rule').domain_get(cr, user, self._name)
d1, d2, tables = self.pool.get('ir.rule').domain_get(cr, user, self._name, 'read', context=context)
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'): if not context: context={} if not ids: return []
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)]))
parent_ids = tuple(account_obj.search(cr, uid, [('parent_id', 'child_of', account_ids)]))
def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} account_obj = self.pool.get('account.analytic.account') account_ids = [int(str(int(x))[:-6]) for x in ids] month_ids = [int(str(int(x))[-6:]) for x in ids] parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)])) if parent_ids: cr.execute('SELECT id, unit_amount ' \ 'FROM account_analytic_analysis_summary_month ' \ 'WHERE account_id IN %s ' \ 'AND month_id IN %s ',(parent_ids, month_ids,)) for sum_id, unit_amount in cr.fetchall(): res[sum_id] = unit_amount for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in account_obj.search(cr, uid, [('parent_id', 'child_of', [int(str(int(obj_id))[:-6])])]): if child_id != int(str(int(obj_id))[:-6]): res[obj_id] += res.get(int(child_id * 1000000 + int(str(int(obj_id))[-6:])), 0.0) for id in ids: res[id] = round(res.get(id, 0.0), 2) return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
'AND month_id IN %s ',(parent_ids, month_ids,))
'AND month_id IN %s ',(parent_ids, tuple(month_ids),))
def _unit_amount(self, cr, uid, ids, name, arg, context=None): res = {} account_obj = self.pool.get('account.analytic.account') account_ids = [int(str(int(x))[:-6]) for x in ids] month_ids = [int(str(int(x))[-6:]) for x in ids] parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', account_ids)])) if parent_ids: cr.execute('SELECT id, unit_amount ' \ 'FROM account_analytic_analysis_summary_month ' \ 'WHERE account_id IN %s ' \ 'AND month_id IN %s ',(parent_ids, month_ids,)) for sum_id, unit_amount in cr.fetchall(): res[sum_id] = unit_amount for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in account_obj.search(cr, uid, [('parent_id', 'child_of', [int(str(int(obj_id))[:-6])])]): if child_id != int(str(int(obj_id))[:-6]): res[obj_id] += res.get(int(child_id * 1000000 + int(str(int(obj_id))[-6:])), 0.0) for id in ids: res[id] = round(res.get(id, 0.0), 2) return res
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
d1, d2 = self.pool.get('ir.rule').domain_get(cr, user, self._name)
d1, d2, tables = self.pool.get('ir.rule').domain_get(cr, user, self._name)
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'): if not context: context={} if not ids: return []
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
def _read_flat(self, cr, user, ids, fields, context=None, load='_classic_read'): if not context: context={} if not ids: return []
a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/a0e414ad08d1b9ac704dc1cb18dc7a500bcf9123/account_analytic_analysis.py
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: acc_set = ",".join(map(str, ids2))
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids:
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: acc_set = ",".join(map(str, ids2)) cr.execute("select account_analytic_line.account_id, COALESCE(sum(amount_currency),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type = 'sale' \ group by account_analytic_line.account_id" ,(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
where account_analytic_line.account_id =ANY(%s) \
where account_analytic_line.account_id IN %s \
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: acc_set = ",".join(map(str, ids2)) cr.execute("select account_analytic_line.account_id, COALESCE(sum(amount_currency),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type = 'sale' \ group by account_analytic_line.account_id" ,(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
group by account_analytic_line.account_id" ,(ids2,))
group by account_analytic_line.account_id" ,(parent_ids,))
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: acc_set = ",".join(map(str, ids2)) cr.execute("select account_analytic_line.account_id, COALESCE(sum(amount_currency),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type = 'sale' \ group by account_analytic_line.account_id" ,(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context)
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context)
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: acc_set = ",".join(map(str, ids2)) cr.execute("select account_analytic_line.account_id, COALESCE(sum(amount_currency),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type = 'sale' \ group by account_analytic_line.account_id" ,(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, ids2, res, acc_set, context)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2:
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids:
def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context={}): res = {} res2 = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: # Amount uninvoiced hours to invoice at sale price # Warning # This computation doesn't take care of pricelist ! # Just consider list_price acc_set = ",".join(map(str, ids2)) cr.execute("""SELECT account_analytic_account.id, \ COALESCE(sum (product_template.list_price * \ account_analytic_line.unit_amount * \ ((100-hr_timesheet_invoice_factor.factor)/100)),0.0) \ AS ca_to_invoice \ FROM product_template \ join product_product \ on product_template.id = product_product.product_tmpl_id \ JOIN account_analytic_line \ on account_analytic_line.product_id = product_product.id \ JOIN account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ JOIN account_analytic_account \ on account_analytic_account.id = account_analytic_line.account_id \ JOIN hr_timesheet_invoice_factor \ on hr_timesheet_invoice_factor.id = account_analytic_account.to_invoice \ WHERE account_analytic_account.id =ANY(%s) \ AND account_analytic_line.invoice_id is null \ AND account_analytic_line.to_invoice IS NOT NULL \ and account_analytic_journal.type in ('purchase','general') \ GROUP BY account_analytic_account.id;""",(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
acc_set = ",".join(map(str, ids2))
def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context={}): res = {} res2 = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: # Amount uninvoiced hours to invoice at sale price # Warning # This computation doesn't take care of pricelist ! # Just consider list_price acc_set = ",".join(map(str, ids2)) cr.execute("""SELECT account_analytic_account.id, \ COALESCE(sum (product_template.list_price * \ account_analytic_line.unit_amount * \ ((100-hr_timesheet_invoice_factor.factor)/100)),0.0) \ AS ca_to_invoice \ FROM product_template \ join product_product \ on product_template.id = product_product.product_tmpl_id \ JOIN account_analytic_line \ on account_analytic_line.product_id = product_product.id \ JOIN account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ JOIN account_analytic_account \ on account_analytic_account.id = account_analytic_line.account_id \ JOIN hr_timesheet_invoice_factor \ on hr_timesheet_invoice_factor.id = account_analytic_account.to_invoice \ WHERE account_analytic_account.id =ANY(%s) \ AND account_analytic_line.invoice_id is null \ AND account_analytic_line.to_invoice IS NOT NULL \ and account_analytic_journal.type in ('purchase','general') \ GROUP BY account_analytic_account.id;""",(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
WHERE account_analytic_account.id =ANY(%s) \
WHERE account_analytic_account.id IN %s \
def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context={}): res = {} res2 = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: # Amount uninvoiced hours to invoice at sale price # Warning # This computation doesn't take care of pricelist ! # Just consider list_price acc_set = ",".join(map(str, ids2)) cr.execute("""SELECT account_analytic_account.id, \ COALESCE(sum (product_template.list_price * \ account_analytic_line.unit_amount * \ ((100-hr_timesheet_invoice_factor.factor)/100)),0.0) \ AS ca_to_invoice \ FROM product_template \ join product_product \ on product_template.id = product_product.product_tmpl_id \ JOIN account_analytic_line \ on account_analytic_line.product_id = product_product.id \ JOIN account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ JOIN account_analytic_account \ on account_analytic_account.id = account_analytic_line.account_id \ JOIN hr_timesheet_invoice_factor \ on hr_timesheet_invoice_factor.id = account_analytic_account.to_invoice \ WHERE account_analytic_account.id =ANY(%s) \ AND account_analytic_line.invoice_id is null \ AND account_analytic_line.to_invoice IS NOT NULL \ and account_analytic_journal.type in ('purchase','general') \ GROUP BY account_analytic_account.id;""",(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
GROUP BY account_analytic_account.id;""",(ids2,))
GROUP BY account_analytic_account.id;""",(parent_ids,))
def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context={}): res = {} res2 = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: # Amount uninvoiced hours to invoice at sale price # Warning # This computation doesn't take care of pricelist ! # Just consider list_price acc_set = ",".join(map(str, ids2)) cr.execute("""SELECT account_analytic_account.id, \ COALESCE(sum (product_template.list_price * \ account_analytic_line.unit_amount * \ ((100-hr_timesheet_invoice_factor.factor)/100)),0.0) \ AS ca_to_invoice \ FROM product_template \ join product_product \ on product_template.id = product_product.product_tmpl_id \ JOIN account_analytic_line \ on account_analytic_line.product_id = product_product.id \ JOIN account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ JOIN account_analytic_account \ on account_analytic_account.id = account_analytic_line.account_id \ JOIN hr_timesheet_invoice_factor \ on hr_timesheet_invoice_factor.id = account_analytic_account.to_invoice \ WHERE account_analytic_account.id =ANY(%s) \ AND account_analytic_line.invoice_id is null \ AND account_analytic_line.to_invoice IS NOT NULL \ and account_analytic_journal.type in ('purchase','general') \ GROUP BY account_analytic_account.id;""",(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2)
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2:
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids:
def _hours_qtt_non_invoiced_calc (self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: cr.execute("select account_analytic_line.account_id, COALESCE(sum(unit_amount),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type='general' \ and invoice_id is null \ AND to_invoice IS NOT NULL \ GROUP BY account_analytic_line.account_id;",(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
where account_analytic_line.account_id =ANY(%s) \
where account_analytic_line.account_id IN %s \
def _hours_qtt_non_invoiced_calc (self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: cr.execute("select account_analytic_line.account_id, COALESCE(sum(unit_amount),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type='general' \ and invoice_id is null \ AND to_invoice IS NOT NULL \ GROUP BY account_analytic_line.account_id;",(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
GROUP BY account_analytic_line.account_id;",(ids2,))
GROUP BY account_analytic_line.account_id;",(parent_ids,))
def _hours_qtt_non_invoiced_calc (self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: cr.execute("select account_analytic_line.account_id, COALESCE(sum(unit_amount),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type='general' \ and invoice_id is null \ AND to_invoice IS NOT NULL \ GROUP BY account_analytic_line.account_id;",(ids2,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2:
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids:
def _hours_quantity_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: cr.execute("select account_analytic_line.account_id,COALESCE(SUM(unit_amount),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type='general' \ GROUP BY account_analytic_line.account_id",(ids2,)) ff = cr.fetchall() for account_id, sum in ff: res[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
where account_analytic_line.account_id =ANY(%s) \
where account_analytic_line.account_id IN %s \
def _hours_quantity_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: cr.execute("select account_analytic_line.account_id,COALESCE(SUM(unit_amount),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type='general' \ GROUP BY account_analytic_line.account_id",(ids2,)) ff = cr.fetchall() for account_id, sum in ff: res[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
GROUP BY account_analytic_line.account_id",(ids2,))
GROUP BY account_analytic_line.account_id",(parent_ids,))
def _hours_quantity_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: cr.execute("select account_analytic_line.account_id,COALESCE(SUM(unit_amount),0.0) \ from account_analytic_line \ join account_analytic_journal \ on account_analytic_line.journal_id = account_analytic_journal.id \ where account_analytic_line.account_id =ANY(%s) \ and account_analytic_journal.type='general' \ GROUP BY account_analytic_line.account_id",(ids2,)) ff = cr.fetchall() for account_id, sum in ff: res[account_id] = round(sum,2) for obj_id in ids: res.setdefault(obj_id, 0.0) for child_id in self.search(cr, uid, [('parent_id', 'child_of', [obj_id])]): if child_id != obj_id: res[obj_id] += res.get(child_id, 0.0) for id in ids: res[id] = round(res.get(id, 0.0),2) return res
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py
ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: acc_set = ",".join(map(str, ids2))
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)])) if parent_ids:
def _total_cost_calc(self, cr, uid, ids, name, arg, context={}): res = {} ids2 = self.search(cr, uid, [('parent_id', 'child_of', ids)]) if ids2: acc_set = ",".join(map(str, ids2)) cr.execute("""select account_analytic_line.account_id,COALESCE(sum(amount_currency),0.0) \
3c18c11c83e2549431192a3a0c1f46403db9d628 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8241/3c18c11c83e2549431192a3a0c1f46403db9d628/account_analytic_analysis.py