<commit_before>import json

import requests

class Device(object):

	PUSH_URL = "https://api.pushbullet.com/api/pushes"

	def __init__(self, api_key, device_id, device_info = None):
		self.api_key = api_key
		self.device_id = device_id

		device_info = device_info or {}

		self.owner = device_info.get("owner_name")

		extras = device_info.get("extras", {})
		self.model = extras.get("model")
		self.manufacturer = extras.get("manufacturer")
		self.android_version = extras.get("android_version")
		self.sdk_version = extras.get("sdk_version")
		self.app_version = extras.get("app_version")

		self._fullname = "{} {} {}".format(self.manufacturer,
										   self.model, self.android_version)

		nickname = extras.get("nickname")
		self.name = nickname or self._fullname

		self._json_header = {'Content-Type': 'application/json'}

	def push_note(self, title, body):
		data = {"type": "note", "title": title, "body": body}
		return self._push(data, headers=self._json_header)

	def push_address(self, name, address):
		data = {"type": "address", "name": name, "address": address}
		return self._push(data, headers=self._json_header)

	def push_list(self, title, items):
		data = {"type": "list", "title": title, "items": items}
		return self._push(data, headers=self._json_header)

	def push_file(self, file):
		data = {"type": "file"}
		files = {"file": file}
		return self._push(data, files=files)

	def push_link(self, title, url):
		data = {"type": "link", "title": title, "url": url}
		return self._push(data, headers=self._json_header)

	def _push(self, data, headers={}, files = {}):
		data["device_id"] = self.device_id
		if not files:
			data = json.dumps(data)
		headers.update({"User-Agent": "ifttt2pushbullet.herokuapp.com"})
		return requests.post(self.PUSH_URL, data=data, headers=headers,
							 files=files, auth=(self.api_key, ""))

	def __repr__(self):
		return "Device('{}', {})".format(self.api_key, self.device_id)<commit_msg>This shouldn't have been added here.<commit_after>import json

import requests

class Device(object):

	PUSH_URL = "https://api.pushbullet.com/api/pushes"

	def __init__(self, api_key, device_id, device_info = None):
		self.api_key = api_key
		self.device_id = device_id

		device_info = device_info or {}

		self.owner = device_info.get("owner_name")

		extras = device_info.get("extras", {})
		self.model = extras.get("model")
		self.manufacturer = extras.get("manufacturer")
		self.android_version = extras.get("android_version")
		self.sdk_version = extras.get("sdk_version")
		self.app_version = extras.get("app_version")

		self._fullname = "{} {} {}".format(self.manufacturer,
										   self.model, self.android_version)

		nickname = extras.get("nickname")
		self.name = nickname or self._fullname

		self._json_header = {'Content-Type': 'application/json'}

	def push_note(self, title, body):
		data = {"type": "note", "title": title, "body": body}
		return self._push(data, headers=self._json_header)

	def push_address(self, name, address):
		data = {"type": "address", "name": name, "address": address}
		return self._push(data, headers=self._json_header)

	def push_list(self, title, items):
		data = {"type": "list", "title": title, "items": items}
		return self._push(data, headers=self._json_header)

	def push_file(self, file):
		data = {"type": "file"}
		files = {"file": file}
		return self._push(data, files=files)

	def push_link(self, title, url):
		data = {"type": "link", "title": title, "url": url}
		return self._push(data, headers=self._json_header)

	def _push(self, data, headers={}, files = {}):
		data["device_id"] = self.device_id
		if not files:
			data = json.dumps(data)
		return requests.post(self.PUSH_URL, data=data, headers=headers,
							 files=files, auth=(self.api_key, ""))

	def __repr__(self):
		return "Device('{}', {})".format(self.api_key, self.device_id)
{'fraction_non_alphanumeric': 0.16511145671332297, 'fraction_numerical': 0.0002592016588906169, 'mean_word_length': 4.76831091180867, 'pattern_counts': {'":': 29, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5407911', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1310, 'n_words': 286}