<commit_before># Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Amazon Software License (the "License"). 
# You may not use this file except in compliance with the License. A copy of the License is located at 
#    http://aws.amazon.com/asl/ 
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. See the License for
# the specific language governing permissions and limitations under the License.

# snippet-sourcedescription:[push-in-parts.py demonstrates how to migrate a Git repository in increments and repushes only those increments that did not succeed until the migration is complete.]
# snippet-service:[codecommit]
# snippet-keyword:[Python]
# snippet-keyword:[AWS CodeCommit]
# snippet-keyword:[Code Sample]
# snippet-keyword:[Git]
# snippet-sourcetype:[full-example]
# snippet-sourcedate:[2015-07-09]
# snippet-sourceauthor:[AWS]
# snippet-start:[codecommit.python.push-in-parts.complete]


#!/usr/bin/env python

import os
import sys
from optparse import OptionParser
from git import Repo, TagReference, RemoteProgress, GitCommandError

class PushProgressPrinter(RemoteProgress):
    def update(self, op_code, cur_count, max_count=None, message=''):
        op_id = op_code & self.OP_MASK
        stage_id = op_code & self.STAGE_MASK
        if op_id == self.WRITING and stage_id == self.BEGIN:
            print("\tObjects: %d" % max_count)

class RepositoryMigration:

    MAX_COMMITS_TOLERANCE_PERCENT = 0.05<commit_msg>Moving license to be within snippet<commit_after># snippet-sourcedescription:[push-in-parts.py demonstrates how to migrate a Git repository in increments and repushes only those increments that did not succeed until the migration is complete.]
# snippet-service:[codecommit]
# snippet-keyword:[Python]
# snippet-keyword:[AWS CodeCommit]
# snippet-keyword:[Code Sample]
# snippet-keyword:[Git]
# snippet-sourcetype:[full-example]
# snippet-sourcedate:[2015-07-09]
# snippet-sourceauthor:[AWS]
# snippet-start:[codecommit.python.push-in-parts.complete]
# Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Amazon Software License (the "License"). 
# You may not use this file except in compliance with the License. A copy of the License is located at 
#    http://aws.amazon.com/asl/ 
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. See the License for
# the specific language governing permissions and limitations under the License.

#!/usr/bin/env python

import os
import sys
from optparse import OptionParser
from git import Repo, TagReference, RemoteProgress, GitCommandError

class PushProgressPrinter(RemoteProgress):
    def update(self, op_code, cur_count, max_count=None, message=''):
        op_id = op_code & self.OP_MASK
        stage_id = op_code & self.STAGE_MASK
        if op_id == self.WRITING and stage_id == self.BEGIN:
            print("\tObjects: %d" % max_count)

class RepositoryMigration:

    MAX_COMMITS_TOLERANCE_PERCENT = 0.05
{'fraction_non_alphanumeric': 0.09032258064516129, 'fraction_numerical': 0.00967741935483871, 'mean_word_length': 4.597472924187725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5209291', 'n_tokens_mistral': 954, 'n_tokens_neox': 868, 'n_words': 308}