Adjust members' workshift hours requirements.
174043
def adjust_hours_view(request, semester):
    
    page_name = "Adjust Hours"

    pools = WorkshiftPool.objects.filter(semester=semester).order_by(
        "-is_primary", "title",
    )
    workshifters = WorkshiftProfile.objects.filter(semester=semester)
    pool_hour_forms = []

    for workshifter in workshifters:
        forms_list = []
        for pool in pools:
            hours = workshifter.pool_hours.get(pool=pool)
            forms_list.append((
                AdjustHoursForm(
                    data=request.POST or None,
                    prefix="pool_hours-{}".format(hours.pk),
                    instance=hours,
                ),
                hours,
            ))
        pool_hour_forms.append(forms_list)

    if all(
            form.is_valid()
            for workshifter_forms in pool_hour_forms
            for form, pool_hours in workshifter_forms
    ):
        for workshifter_forms in pool_hour_forms:
            for form, pool_hours in workshifter_forms:
                form.save()
        messages.add_message(request, messages.INFO, "Updated hours.")
        return HttpResponseRedirect(wurl(
            "workshift:adjust_hours",
            sem_url=semester.sem_url,
        ))

    return render_to_response("adjust_hours.html", {
        "page_name": page_name,
        "pools": pools,
        "workshifters_tuples": zip(workshifters, pool_hour_forms),
    }, context_instance=RequestContext(request))
646938
private void changeAffiliationByAdmin(Jid jid, MUCAffiliation affiliation)
                    throws NoResponseException, XMPPErrorException,
                    NotConnectedException, InterruptedException {
        changeAffiliationByAdmin(jid, affiliation, null);
    }
415900
void adjustLeft(float newValue) {
    	Object[] o = (Object[])attributes.get(Chunk.TAB);
    	if (o != null) {
    		attributes.put(Chunk.TAB, new Object[]{o[0], o[1], o[2], new Float(newValue)});
    	}
    }
329368
def add_workshift_context(request):
    
    if not request.user.is_authenticated():
        return {}

    if Semester.objects.count() < 1:
        return {
            "WORKSHIFT_ENABLED": False,
        }

    # Current semester is for navbar notifications
    try:
        current_semester = Semester.objects.get(current=True)
    except Semester.DoesNotExist:
        current_semester = None
    except Semester.MultipleObjectsReturned:
        current_semester = Semester.objects.filter(
            current=True,
        ).latest("start_date")
        workshift_emails = []
        for pos in Manager.objects.filter(workshift_manager=True, active=True):
            if pos.email:
                workshift_emails.append(pos.email)
            elif pos.incumbent.email_visible and pos.incumbent.user.email:
                workshift_emails.append(pos.incumbent.user.email)
        if workshift_emails:
            workshift_email_str = " ({})".format(
                ", ".join(
                    "<a href=\"mailto:{0}\">{0}</a>".format(i)
                    for i in workshift_emails
                ),
            )
        else:
            workshift_email_str = ""
        messages.add_message(
            request,
            messages.WARNING,
            MESSAGES["MULTIPLE_CURRENT_SEMESTERS"].format(
                admin_email=settings.ADMINS[0][1],
                workshift_emails=workshift_email_str,
            ),
        )

    today = localtime(now()).date()

    days_passed = None
    total_days = None
    semester_percentage = None
    standing = None
    happening_now = None
    workshift_profile = None

    if current_semester:
        # number of days passed in this semester
        days_passed = (today - current_semester.start_date).days

        # total number of days in this semester
        total_days = (
            current_semester.end_date - current_semester.start_date
        ).days
        semester_percentage = round((days_passed / total_days) * 100, 2)

    # Semester is for populating the current page
    try:
        semester = request.semester
    except AttributeError:
        semester = current_semester

    try:
        workshift_profile = WorkshiftProfile.objects.get(
            semester=semester,
            user=request.user,
            )
    except WorkshiftProfile.DoesNotExist:
        workshift_profile = None

    workshift_manager = utils.can_manage(request.user, semester=semester)

    upcoming_shifts = WorkshiftInstance.objects.filter(
        workshifter=workshift_profile,
        closed=False,
        date__gte=today,
        date__lte=today + timedelta(days=2),
    )

    # TODO: Add a fudge factor of an hour to this?
    time = localtime(now()).time()
    happening_now = []
    for shift in upcoming_shifts:
        if shift.week_long:
            happening_now.append(shift)
            continue
        if shift.date != today:
            continue
        if shift.start_time is None:
            if shift.end_time is not None:
                if time < shift.end_time:
                    happening_now.append(shift)
            else:
                happening_now.append(shift)
            continue
        if shift.end_time is None:
            if shift.start_time is not None:
                if time > shift.start_time:
                    happening_now.append(shift)
            else:
                happening_now.append(shift)
            continue
        if time > shift.start_time and time < shift.end_time:
            happening_now.append(shift)

    if workshift_profile:
        try:
            standing = workshift_profile.pool_hours.get(
                pool__is_primary=True,
            ).standing
        except (PoolHours.DoesNotExist, PoolHours.MultipleObjectsReturned):
            pass

    return {
        "WORKSHIFT_ENABLED": True,
        "SEMESTER": semester,
        "CURRENT_SEMESTER": current_semester,
        "WORKSHIFT_MANAGER": workshift_manager,
        "WORKSHIFT_PROFILE": workshift_profile,
        "STANDING": standing,
        "DAYS_PASSED": days_passed,
        "TOTAL_DAYS": total_days,
        "SEMESTER_PERCENTAGE": semester_percentage,
        "UPCOMING_SHIFTS": zip(upcoming_shifts, happening_now),
    }
723198
private void adjustVisibleColumns() {

        if (m_table.isColumnCollapsingAllowed()) {
            if ((m_model.hasDefaultValues()) || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
                m_table.setColumnCollapsed(TableProperty.DEFAULT, false);
            } else {
                m_table.setColumnCollapsed(TableProperty.DEFAULT, true);
            }

            if (((m_model.getEditMode().equals(EditMode.MASTER) || m_model.hasDescriptionValues()))
                || m_model.getBundleType().equals(BundleType.DESCRIPTOR)) {
                m_table.setColumnCollapsed(TableProperty.DESCRIPTION, false);
            } else {
                m_table.setColumnCollapsed(TableProperty.DESCRIPTION, true);
            }
        }
    }
355835
private void adjustDayInMonthIfNeeded(int month, int year) {
        int day = mCalendar.get(Calendar.DAY_OF_MONTH);
        int daysInMonth = DateTimePickerUtils.getDaysInMonth(month, year);
        if (day > daysInMonth) {
            mCalendar.set(Calendar.DAY_OF_MONTH, daysInMonth);
        }
    }
1246975
def adjust_tasks(klass)
      class_name = @code_path.to_s.sub(/.*\/functions\//,'').sub(/\.rb$/, '')
      class_name = class_name.classify
      klass.tasks.each do |task|
        task.class_name = class_name
        task.type = "function"
      end
    end
1219281
public ZonedDateTime adjustTime(ZonedDateTime time, boolean roundUp,
                                    DayOfWeek firstDayOfWeek) {
        Instant instant = time.toInstant();
        ZoneId zoneId = time.getZone();
        instant = adjustTime(instant, zoneId, roundUp, firstDayOfWeek);
        return ZonedDateTime.ofInstant(instant, zoneId);
    }
377039
def adjust(self, ln):
        """"""
        adj_ln = ln
        need_unskipped = 0
        for i in self.skips:
            if i <= ln:
                need_unskipped += 1
            elif adj_ln + need_unskipped < i:
                break
            else:
                need_unskipped -= i - adj_ln - 1
                adj_ln = i
        return adj_ln + need_unskipped
132242
function adjustTime( $hour, $minute = 0, $second = 0 )
    {
        $this->setTimeOfDay( $hour * self::SECONDS_AN_HOUR +
                             $minute * self::SECONDS_A_MINUTE +
                             $second + $this->Time );
    }
1200648
public function change() {
		$this->table('queue_processes')
			->changeColumn('created', 'datetime', ['null' => false, 'default' => null])
			->changeColumn('modified', 'datetime', ['null' => false, 'default' => null])
			->update();

		$this->table('queued_jobs')
			->changeColumn('created', 'datetime', ['null' => false, 'default' => null])
			->update();
	}
1070445
protected void adjustStartEventSubscriptions(ProcessDefinitionEntity newLatestProcessDefinition, ProcessDefinitionEntity oldLatestProcessDefinition) {
  	removeObsoleteTimers(newLatestProcessDefinition);
  	addTimerDeclarations(newLatestProcessDefinition);

  	removeObsoleteEventSubscriptions(newLatestProcessDefinition, oldLatestProcessDefinition);
  	addEventSubscriptions(newLatestProcessDefinition);
  }
1060976
def setNumWorkers(self, num_workers):
        """"""
        cur_num = len(self.workers)
        if cur_num > num_workers:
            self.dismissWorkers(cur_num - num_workers)
        else:
            self.createWorkers(num_workers - cur_num)
492917
def change_time(self):
    """"""
    timestamp = self._fsntfs_file_entry.get_entry_modification_time_as_integer()
    return dfdatetime_filetime.Filetime(timestamp=timestamp)
352811
public LocalDateTime adjustTime(LocalDateTime time, boolean roundUp,
                                    DayOfWeek firstDayOfWeek) {
        requireNonNull(time);

        if (roundUp) {
            time = time.plus(getAmount(), getUnit());
        }

        return Util.truncate(time, getUnit(), getAmount(), firstDayOfWeek);
    }
1304569
def _set_duty(self, motor_duty_file, duty, friction_offset,
                  voltage_comp):
        """"""
        # Compensate for nominal voltage and round the input
        duty_int = int(round(duty*voltage_comp))

        # Add or subtract offset and clamp the value between -100 and 100
        if duty_int > 0:
            duty_int = min(100, duty_int + friction_offset)
        elif duty_int < 0:
            duty_int = max(-100, duty_int - friction_offset)

        # Apply the signal to the motor
        self._fast_write(motor_duty_file, duty_int)
1289439
def adjustFiles(rec, op):  # type: (Any, Union[Callable[..., Any], partial[Any]]) -> None
    """"""

    if isinstance(rec, MutableMapping):
        if rec.get("class") == "File":
            rec["path"] = op(rec["path"])
        for d in rec:
            adjustFiles(rec[d], op)
    if isinstance(rec, MutableSequence):
        for d in rec:
            adjustFiles(d, op)