Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self._biddable_campaign_criterion = biddable_campaign_criterion
self._campaign_name = campaign_name
_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Status,
field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.Status),
csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'Status', v if v else None)
),
_SimpleBulkMapping(
_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.Id),
csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.CampaignId),
csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'CampaignId', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Campaign,
field_to_csv=lambda c: c.campaign_name,
csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
),
_SimpleBulkMapping(
_StringTable.BidAdjustment,
field_to_csv=lambda c: field_to_csv_BidAdjustment(c.biddable_campaign_criterion),
csv_to_field=lambda c, v: csv_to_field_BidAdjustment(c.biddable_campaign_criterion, float(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Target,
field_to_csv=lambda c: field_to_csv_DeviceTarget(c.biddable_campaign_criterion),
c,
'status',
v if v else None
)
),
_SimpleBulkMapping(
header=_StringTable.Id,
field_to_csv=lambda c: c.label_association.LabelId,
csv_to_field=lambda c, v: setattr(
c.label_association,
'LabelId',
int(v) if v else None
)
),
_SimpleBulkMapping(
header=_StringTable.ParentId,
field_to_csv=lambda c: c.label_association.EntityId,
csv_to_field=lambda c, v: setattr(
c.label_association,
'EntityId',
int(v) if v else None
)
),
]
def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
self._validate_property_not_null(self._label_association, 'label_association')
self.convert_to_values(row_values, _BulkLabelAssociation._MAPPINGS)
def process_mappings_from_row_values(self, row_values):
self._label_association = _CAMPAIGN_OBJECT_FACTORY_V11.create('LabelAssociation')
@property
def entity_name(self):
return self._entity_name
@property
def _parent_column_name(self):
raise NotImplementedError()
_MAPPINGS = [
_SimpleBulkMapping(
header=_StringTable.Status,
field_to_csv=lambda c: bulk_str(c._status),
csv_to_field=lambda c, v: setattr(c, '_status', v if v else None)
),
_SimpleBulkMapping(
header=_StringTable.ParentId,
field_to_csv=lambda c: None if c._entity_id == 0 else bulk_str(c._entity_id),
csv_to_field=lambda c, v: setattr(c, '_entity_id', int(v) if v else 0)
),
_DynamicColumnNameMapping(
header_func=lambda c: c._parent_column_name,
field_to_csv=lambda c: c._entity_name,
csv_to_field=lambda c, v: setattr(c, '_entity_name', v)
)
]
@property
def is_delete_row(self):
return self._status == 'Deleted'
def read_from_row_values(self, row_values):
row_values.convert_to_entity(self, _BulkNegativeSiteIdentifier._MAPPINGS)
self._campaign_name = campaign_name
self._ad_group_name =ad_group_name
_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Status,
field_to_csv=lambda c: bulk_str(c.negative_ad_group_criterion.Status),
csv_to_field=lambda c, v: setattr(c.negative_ad_group_criterion, 'Status', v if v else None)
),
_SimpleBulkMapping(
_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.negative_ad_group_criterion.Id),
csv_to_field=lambda c, v: setattr(c.negative_ad_group_criterion, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.negative_ad_group_criterion.AdGroupId),
csv_to_field=lambda c, v: setattr(c.negative_ad_group_criterion, 'AdGroupId', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Campaign,
field_to_csv=lambda c: c.campaign_name,
csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
),
_SimpleBulkMapping(
_StringTable.AdGroup,
field_to_csv=lambda c: c.ad_group_name,
csv_to_field=lambda c, v: setattr(c, 'ad_group_name', v)
),
_SimpleBulkMapping(
_StringTable.Target,
field_to_csv=lambda c: field_to_csv_LocationTarget(c.negative_ad_group_criterion),
self._campaign_name = campaign_name
self._ad_group_name =ad_group_name
_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Status,
field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.Status),
csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'Status', v if v else None)
),
_SimpleBulkMapping(
_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.Id),
csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.AdGroupId),
csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'AdGroupId', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Campaign,
field_to_csv=lambda c: c.campaign_name,
csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
),
_SimpleBulkMapping(
_StringTable.AdGroup,
field_to_csv=lambda c: c.ad_group_name,
csv_to_field=lambda c, v: setattr(c, 'ad_group_name', v)
),
_SimpleBulkMapping(
_StringTable.BidAdjustment,
field_to_csv=lambda c: field_to_csv_BidAdjustment(c.biddable_ad_group_criterion),
def shared_entity_association(self, shared_entity_association):
self._shared_entity_association = shared_entity_association
_MAPPINGS = [
_SimpleBulkMapping(
header=_StringTable.Status,
field_to_csv=lambda c: c.status,
csv_to_field=lambda c, v: setattr(c, 'status', v if v else None)
),
_SimpleBulkMapping(
header=_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.shared_entity_association.SharedEntityId),
csv_to_field=lambda c, v: setattr(c.shared_entity_association, 'SharedEntityId', int(v))
),
_SimpleBulkMapping(
header=_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.shared_entity_association.EntityId),
csv_to_field=lambda c, v: setattr(c.shared_entity_association, 'EntityId', int(v))
),
]
def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
self._validate_property_not_null(self._shared_entity_association, 'shared_entity_association')
self.convert_to_values(row_values, BulkCampaignNegativeKeywordList._MAPPINGS)
def process_mappings_from_row_values(self, row_values):
self._shared_entity_association = _CAMPAIGN_OBJECT_FACTORY_V11.create('SharedEntityAssociation')
self._shared_entity_association.EntityType = 'Campaign'
self._shared_entity_association.SharedEntityType = 'NegativeKeywordList'
row_values.convert_to_entity(self, BulkCampaignNegativeKeywordList._MAPPINGS)
def read_additional_data(self, stream_reader):
self._biddable_campaign_criterion = biddable_campaign_criterion
self._campaign_name = campaign_name
_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Status,
field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.Status),
csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'Status', v if v else None)
),
_SimpleBulkMapping(
_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.Id),
csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.biddable_campaign_criterion.CampaignId),
csv_to_field=lambda c, v: setattr(c.biddable_campaign_criterion, 'CampaignId', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Campaign,
field_to_csv=lambda c: c.campaign_name,
csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
),
_SimpleBulkMapping(
_StringTable.BidAdjustment,
field_to_csv=lambda c: field_to_csv_BidAdjustment(c.biddable_campaign_criterion),
csv_to_field=lambda c, v: csv_to_field_BidAdjustment(c.biddable_campaign_criterion, float(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Target,
field_to_csv=lambda c: field_to_csv_DayTimeTarget(c.biddable_campaign_criterion),
self._negative_campaign_criterion = negative_campaign_criterion
self._campaign_name = campaign_name
_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Status,
field_to_csv=lambda c: bulk_str(c.negative_campaign_criterion.Status),
csv_to_field=lambda c, v: setattr(c.negative_campaign_criterion, 'Status', v if v else None)
),
_SimpleBulkMapping(
_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.negative_campaign_criterion.Id),
csv_to_field=lambda c, v: setattr(c.negative_campaign_criterion, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.negative_campaign_criterion.CampaignId),
csv_to_field=lambda c, v: setattr(c.negative_campaign_criterion, 'CampaignId', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Campaign,
field_to_csv=lambda c: c.campaign_name,
csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
),
_SimpleBulkMapping(
_StringTable.Target,
field_to_csv=lambda c: field_to_csv_LocationTarget(c.negative_campaign_criterion),
csv_to_field=lambda c, v: csv_to_field_LocationTarget(c.negative_campaign_criterion, int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.SubType,
field_to_csv=lambda c: field_to_csv_LocationType(c.negative_campaign_criterion),
self._campaign_name = campaign_name
self._ad_group_name =ad_group_name
_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.Status,
field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.Status),
csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'Status', v if v else None)
),
_SimpleBulkMapping(
_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.Id),
csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.biddable_ad_group_criterion.AdGroupId),
csv_to_field=lambda c, v: setattr(c.biddable_ad_group_criterion, 'AdGroupId', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.Campaign,
field_to_csv=lambda c: c.campaign_name,
csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
),
_SimpleBulkMapping(
_StringTable.AdGroup,
field_to_csv=lambda c: c.ad_group_name,
csv_to_field=lambda c, v: setattr(c, 'ad_group_name', v)
),
_SimpleBulkMapping(
_StringTable.Target,
field_to_csv=lambda c: field_to_csv_LocationIntentTarget(c.biddable_ad_group_criterion),
self._negative_ad_group_criterion = negative_ad_group_criterion
_MAPPINGS = [
_SimpleBulkMapping(
header=_StringTable.Status,
field_to_csv=lambda c: c.status,
csv_to_field=lambda c, v: setattr(c, 'status', v)
),
_SimpleBulkMapping(
header=_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.negative_ad_group_criterion.Id),
csv_to_field=lambda c, v: setattr(c.negative_ad_group_criterion, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
header=_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.negative_ad_group_criterion.AdGroupId),
csv_to_field=lambda c, v: setattr(c.negative_ad_group_criterion, 'AdGroupId', int(v) if v else None)
),
_SimpleBulkMapping(
header=_StringTable.Campaign,
field_to_csv=lambda c: c.campaign_name,
csv_to_field=lambda c, v: setattr(c, 'campaign_name', v)
),
_SimpleBulkMapping(
header=_StringTable.AdGroup,
field_to_csv=lambda c: c.ad_group_name,
csv_to_field=lambda c, v: setattr(c, 'ad_group_name', v)
),
_SimpleBulkMapping(
header=_StringTable.Name,
field_to_csv=lambda c: field_to_csv_WebpageParameter_CriterionName(c.negative_ad_group_criterion),