Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update license years #5384

Closed
wants to merge 3 commits into from
Closed

Update license years #5384

wants to merge 3 commits into from

Conversation

ofek
Copy link
Contributor

@ofek ofek commented Jan 3, 2020

Additional Notes

Script (Python 3 only)

import os
import re

CORE_DIR = r'C:\Users\ofek\Desktop\code\integrations-core'
BLACKLISTED_DIRS = ('.git', '.tox')
LICENSE_INDICATOR = re.compile(br'# \(C\) Datadog, Inc\. (.+)$', re.IGNORECASE | re.MULTILINE)


def main():
    for root, dirs, files in os.walk(CORE_DIR):
        dirs[:] = [d for d in dirs if d not in BLACKLISTED_DIRS]

        for f in files:
            if not f.endswith('.py'):
                continue

            file_path = os.path.join(root, f)
            with open(file_path, 'rb') as fd:
                file_contents = fd.read()

            match = LICENSE_INDICATOR.search(file_contents)
            if not match:
                continue

            full_match = match.group(0)
            year_match = match.group(1)
            first_year = year_match.split(b'-')[0]
            replacement = full_match.replace(year_match, b'%s-present' % first_year)
            file_contents = file_contents.replace(full_match, replacement)

            with open(file_path, 'wb') as fd:
                fd.write(file_contents)


if __name__ == '__main__':
    main()

@codecov
Copy link

codecov bot commented Jan 3, 2020

Codecov Report

Merging #5384 into master will decrease coverage by 0.86%.
The diff coverage is n/a.

Impacted Files Coverage Δ
cacti/tests/test_cacti.py 100% <ø> (ø)
...g_checks_base/datadog_checks/base/utils/headers.py 57.14% <ø> (ø) ⬆️
cisco_aci/datadog_checks/cisco_aci/aci_metrics.py 97.29% <ø> (ø) ⬆️
ambari/tests/conftest.py 85.71% <ø> (ø)
cilium/tests/conftest.py 85.36% <ø> (ø) ⬆️
datadog_checks_base/datadog_checks/base/ddyaml.py 56.71% <ø> (-4.48%) ⬇️
cilium/tests/test_cilium.py 100% <ø> (ø) ⬆️
cilium/datadog_checks/cilium/cilium.py 78.94% <ø> (ø) ⬆️
crio/datadog_checks/crio/crio.py 100% <ø> (ø) ⬆️
couchbase/tests/test_unit.py 100% <ø> (ø) ⬆️
... and 392 more

@ofek ofek closed this Jan 7, 2020
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
alishalopes87 pushed a commit that referenced this pull request Jan 9, 2020
* Update license years

* Update mysql.py

* Update teamcity.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants