gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
переведи с perl на python sub getmaxpk { my $self = shift; my $instr = shift; my $dbhdst…
- User
переведи с perl на python sub _get_max_pk { my instr = shift; my $dbh_dst = shift;
# если инструкция перезаписываемая, то максимальный прошлый id - всегда 0 return undef if $instr->{overwrite}; return undef if $instr->{is_diff_required}; my $max_pk = $self->_get_max_col( dbh => $instr->{dbh_dst }, tb => $instr->{ dst_tb_original }, col => $instr->{ pk }, ); return $max_pk if not $instr->{is_history}; my $max_pk__history = $self->_get_max_col( dbh => $instr->{dbh_dst }, tb => $instr->{ dst_tb }, col => $instr->{ pk }, ); $max_pk = $max_pk__history if $max_pk__history and $max_pk__history > $max_pk; return $max_pk; } - Assistant
def _get_max_pk(self, instr, dbh_dst): if instr['overwrite']: return None if instr['is_diff_required']: return None max_pk = self._get_max_col( dbh=dbh_dst, tb=instr['dst_tb_original'], col=instr['pk'], ) if not instr['is_history']: return max_pk max_pk__history = self._get_max_col( dbh=instr['dbh_dst'], tb=instr['dst_tb'], col=instr['pk'], ) if max_pk__history and max_pk__history > max_pk: max_pk = max_pk__history return max_pk
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.