<commit_before>#!/usr/bin/env python
import sys
import os
import os.path
import xml.dom.minidom

if os.environ["TRAVIS_SECURE_ENV_VARS"] == "false":
  print "no secure env vars available, skipping deployment"
  sys.exit()

if os.environ.get("TRAVIS_BRANCH") != "master":
  print "This is not the master branch, deploy aborted"
  sys.exit()

if os.environ.get("TRAVIS_PULL_REQUEST") == "true":
  print "This is a pull request, deploy aborted"
  sys.exit()

cwd = os.getcwd()
print cwd
m2 = xml.dom.minidom.Document()
settings = m2.createElement("settings")
m2.appendChild(settings)

serversNodes = settings.getElementsByTagName("servers")
if not serversNodes:
  serversNode = m2.createElement("servers")
  settings.appendChild(serversNode)
else:
  serversNode = serversNodes[0]
  
sonatypeServerNode = m2.createElement("server")
sonatypeServerId = m2.createElement("id")
sonatypeServerUser = m2.createElement("username")
sonatypeServerPass = m2.createElement("password")

idNode = m2.createTextNode("sonatype-nexus-snapshots")
userNode = m2.createTextNode(os.environ["SONATYPE_USERNAME"])
passNode = m2.createTextNode(os.environ["SONATYPE_PASSWORD"])

sonatypeServerId.appendChild(idNode)
sonatypeServerUser.appendChild(userNode)
sonatypeServerPass.appendChild(passNode)

sonatypeServerNode.appendChild(sonatypeServerId)
sonatypeServerNode.appendChild(sonatypeServerUser)
sonatypeServerNode.appendChild(sonatypeServerPass)

serversNode.appendChild(sonatypeServerNode)
  
m2Str = m2.toxml()
f = open(cwd + '/settings.xml', 'w')
f.write(m2Str)
f.close()
<commit_msg>Added debug output to deploy script<commit_after>#!/usr/bin/env python
import sys
import os
import os.path
import xml.dom.minidom

for param in os.environ.keys():  
    print "%20s %s" % (param,os.environ[param])

if os.environ.get("TRAVIS_SECURE_ENV_VARS") == "false":
  print "No secure env vars available, skipping deployment"
  sys.exit()

if os.environ.get("TRAVIS_BRANCH") != "master":
  print "[" + os.environ.get("TRAVIS_BRANCH") + "] is not the master branch, skipping deployment"
  sys.exit()

if os.environ.get("TRAVIS_PULL_REQUEST") == "true":
  print "This is a pull request, skipping deployment"
  sys.exit()

cwd = os.getcwd()
print cwd
m2 = xml.dom.minidom.Document()
settings = m2.createElement("settings")
m2.appendChild(settings)

serversNodes = settings.getElementsByTagName("servers")
if not serversNodes:
  serversNode = m2.createElement("servers")
  settings.appendChild(serversNode)
else:
  serversNode = serversNodes[0]
  
sonatypeServerNode = m2.createElement("server")
sonatypeServerId = m2.createElement("id")
sonatypeServerUser = m2.createElement("username")
sonatypeServerPass = m2.createElement("password")

idNode = m2.createTextNode("sonatype-nexus-snapshots")
userNode = m2.createTextNode(os.environ["SONATYPE_USERNAME"])
passNode = m2.createTextNode(os.environ["SONATYPE_PASSWORD"])

sonatypeServerId.appendChild(idNode)
sonatypeServerUser.appendChild(userNode)
sonatypeServerPass.appendChild(passNode)

sonatypeServerNode.appendChild(sonatypeServerId)
sonatypeServerNode.appendChild(sonatypeServerUser)
sonatypeServerNode.appendChild(sonatypeServerPass)

serversNode.appendChild(sonatypeServerNode)
  
m2Str = m2.toxml()
f = open(cwd + '/settings.xml', 'w')
f.write(m2Str)
f.close()

{'fraction_non_alphanumeric': 0.12583790371724557, 'fraction_numerical': 0.009750152346130409, 'mean_word_length': 6.816666666666666, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '4290026', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1107, 'n_words': 205}