

from google.appengine.ext import blobstore
from google.appengine.ext import db

from mapreduce import context
from mapreduce import operation

from soc.modules.gci.logic import profile as profile_logic


def process(student_info):
  ctx = context.get()
  params = ctx.mapreduce_spec.mapper.params

  program_key_str = params['program_key']

  program_key = db.Key.from_path('GCIProgram', program_key_str)

  # We can skip the student info entity not belonging to the given program.
  if student_info.program.key() != program_key:
    return

  entities, blobs = profile_logic.insertDummyData(student_info)
  blobstore.delete(blobs)
  for entity in entities:
    yield operation.db.Put(entity)
  yield operation.counters.Increment("profile dummy data inserted")


"""Mapreduce to insert dummy data for GCI student data for safe-harboring."""


from google.appengine.ext import blobstore
from google.appengine.ext import db

from mapreduce import context
from mapreduce import operation

from soc.modules.gci.logic import profile as profile_logic


def process(student_info):
  ctx = context.get()
  params = ctx.mapreduce_spec.mapper.params

  program_key_str = params['program_key']

  program_key = db.Key.from_path('GCIProgram', program_key_str)

  # We can skip the student info entity not belonging to the given program.
  if student_info.program.key() != program_key:
    return

  entities, blobs = profile_logic.insertDummyData(student_info)
  blobstore.delete(blobs)
  for entity in entities:
    yield operation.db.Put(entity)
  yield operation.counters.Increment("profile dummy data inserted")

Update the docstring for the mapper to reflect what it does correctly.
Update the docstring for the mapper to reflect what it does correctly.

+ 
+ """Mapreduce to insert dummy data for GCI student data for safe-harboring."""
  
  
  from google.appengine.ext import blobstore
  from google.appengine.ext import db
  
  from mapreduce import context
  from mapreduce import operation
  
  from soc.modules.gci.logic import profile as profile_logic
  
  
  def process(student_info):
    ctx = context.get()
    params = ctx.mapreduce_spec.mapper.params
  
    program_key_str = params['program_key']
  
    program_key = db.Key.from_path('GCIProgram', program_key_str)
  
    # We can skip the student info entity not belonging to the given program.
    if student_info.program.key() != program_key:
      return
  
    entities, blobs = profile_logic.insertDummyData(student_info)
    blobstore.delete(blobs)
    for entity in entities:
      yield operation.db.Put(entity)
    yield operation.counters.Increment("profile dummy data inserted")
  
Update the docstring for the mapper to reflect what it does correctly.
## Code Before:


from google.appengine.ext import blobstore
from google.appengine.ext import db

from mapreduce import context
from mapreduce import operation

from soc.modules.gci.logic import profile as profile_logic


def process(student_info):
  ctx = context.get()
  params = ctx.mapreduce_spec.mapper.params

  program_key_str = params['program_key']

  program_key = db.Key.from_path('GCIProgram', program_key_str)

  # We can skip the student info entity not belonging to the given program.
  if student_info.program.key() != program_key:
    return

  entities, blobs = profile_logic.insertDummyData(student_info)
  blobstore.delete(blobs)
  for entity in entities:
    yield operation.db.Put(entity)
  yield operation.counters.Increment("profile dummy data inserted")

## Instruction:
Update the docstring for the mapper to reflect what it does correctly.
## Code After:

"""Mapreduce to insert dummy data for GCI student data for safe-harboring."""


from google.appengine.ext import blobstore
from google.appengine.ext import db

from mapreduce import context
from mapreduce import operation

from soc.modules.gci.logic import profile as profile_logic


def process(student_info):
  ctx = context.get()
  params = ctx.mapreduce_spec.mapper.params

  program_key_str = params['program_key']

  program_key = db.Key.from_path('GCIProgram', program_key_str)

  # We can skip the student info entity not belonging to the given program.
  if student_info.program.key() != program_key:
    return

  entities, blobs = profile_logic.insertDummyData(student_info)
  blobstore.delete(blobs)
  for entity in entities:
    yield operation.db.Put(entity)
  yield operation.counters.Increment("profile dummy data inserted")
