desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Test touchFile'
@unittest.skip('Not yet implemented') def test_touch_file(self):
pass
'Test link'
@unittest.skip('Not yet implemented') def test_link(self):
pass
'Test hardlinkFile'
@unittest.skip('Not yet implemented') def test_hardlink_file(self):
pass
'Test symlink'
@unittest.skip('Not yet implemented') def test_symlink(self):
pass
'Test moveAndSymlinkFile'
@unittest.skip('Not yet implemented') def test_move_and_symlink_file(self):
pass
'Test that create_https_certificates successfully generates certificate and private key'
def test_create_https_certificates(self):
try: import OpenSSL except ImportError: self.skipTest('pyOpenSSL is not installed') return False base_path = os.path.dirname(__file__) cert_path = os.path.abspath(os.path.join(base_path, 'test.crt')) pkey_path = os.path.abspath(os.path.join(base_path, 'test.key')) ...
'Test encrypt'
@unittest.skip('Not yet implemented') def test_encrypt(self):
pass
'Test decrypt'
@unittest.skip('Not yet implemented') def test_decrypt(self):
pass
'Test generateCookieSecret'
@unittest.skip('Not yet implemented') def test_generate_cookie_secret(self):
pass
'Test searchIndexerForShowID'
@unittest.skip('Not yet implemented') def test_search_indexer_for_show_id(self):
pass
'Test is_anime_in_show_list'
@unittest.skip('Not yet implemented') def test_is_anime_in_show_list(self):
pass
'Test _check_against_names'
@unittest.skip('Not yet implemented') def test_check_against_names(self):
pass
'Test get_show'
@unittest.skip('Not yet implemented') def test_get_show(self):
pass
'Test validateShow'
@unittest.skip('Not yet implemented') def test_validate_show(self):
pass
'Test mapIndexersToShow'
@unittest.skip('Not yet implemented') def test_map_indexers_to_show(self):
pass
'Test get_absolute_number_from_season_and_episode'
@unittest.skip('Not yet implemented') def test_get_abs_no_from_s_and_e(self):
pass
'Test get_all_episodes_from_absolute_number'
@unittest.skip('Not yet implemented') def test_get_all_eps_from_abs_no(self):
pass
'Test get_lan_ip'
@unittest.skip('Not yet implemented') def test_get_lan_ip(self):
pass
'Test check_url'
@unittest.skip('Not yet implemented') def test_check_url(self):
pass
'Test anon_url'
@unittest.skip('Not yet implemented') def test_anon_url(self):
pass
'Test set_up_anidb_connection'
@unittest.skip('Not yet implemented') def test_set_up_anidb_connection(self):
pass
'Test _setUpSession'
@unittest.skip('Not yet implemented') def test_set_up_session(self):
pass
'Test getURL'
@unittest.skip('Not yet implemented') def test_get_url(self):
pass
'Test generateApiKey'
@unittest.skip('Not yet implemented') def test_generate_api_key(self):
pass
'Test indentXML'
@unittest.skip('Not yet implemented') def test_indent_xml(self):
pass
'Test remove_non_release_groups'
@unittest.skip('Not yet implemented') def test_remove_non_release_groups(self):
pass
'Test fixSetGroupID'
@unittest.skip('Not yet implemented') def test_fix_set_group_id(self):
pass
'Test update_anime_support'
@unittest.skip('Not yet implemented') def test_update_anime_support(self):
pass
'Test sanitizeSceneName'
@unittest.skip('Not yet implemented') def test_sanitize_scene_name(self):
pass
'Test arithmeticEval'
@unittest.skip('Not yet implemented') def test_arithmetic_eval(self):
pass
'Test full_sanitizeSceneName'
@unittest.skip('Not yet implemented') def test_full_sanitize_scene_name(self):
pass
'Test remove_article'
@unittest.skip('Not yet implemented') def test_remove_article(self):
pass
'Test pretty_time_delta'
@unittest.skip('Not yet implemented') def test_pretty_time_delta(self):
pass
'Test bitcannon'
def test_bitcannon(self):
bitcannon = BitCannonProvider() bitcannon.custom_url = '' bitcannon.api_key = '' if bitcannon.custom_url: search_strings_list = bitcannon._get_episode_search_strings(self.shows[0].episodes[0]) for search_strings in search_strings_list: bitcannon.search(search_strings) ret...
'Test searching'
@staticmethod @unittest.skip('KickAssTorrents is down, needs a replacement') def test_search():
url = 'http://kickass.to/' search_url = 'http://kickass.to/usearch/American%20Dad%21%20S08%20-S08E%20category%3Atv/?field=seeders&sorder=desc' html = getURL(search_url, session=make_session(), returns='text') if (not html): return soup = BeautifulSoup(html, 'html5lib') torrent_table = so...
'Test none returns empty'
def test_none_returns_empty(self):
self.assertEqual(ex(None), u'')
'Test empty args returns empty'
def test_empty_args_returns_empty(self):
self.assertEqual(ex(Exception()), u'')
'Test args of none returns empty'
def test_args_of_none_returns_empty(self):
self.assertEqual(ex(Exception(None, None)), u'')
'Test exception returns args strings :return:'
def test_ex_ret_args_string(self):
self.assertEqual(ex(Exception(u'hi')), u'hi')
'Test exception returns args ustring'
@unittest.skip(u'Errors with six.text_type conversion') def test_ex_ret_args_ustring(self):
self.assertEqual(ex(Exception(u'\xc3\xa4h')), u'\xe4h')
'Test exception returns concatenated args and strings'
def test_ex_ret_concat_args_strings(self):
self.assertEqual(ex(Exception(u'lots', u'of', u'strings')), u'lots : of : strings')
'Test exception returns stringed args'
def test_ex_ret_stringed_args(self):
self.assertEqual(ex(Exception(303)), u'error 303')
'Set up tests'
def setUp(self):
self._debug_spew('\n\r')
'Test boxcar notifications'
@unittest.skip('Not yet implemented') def test_boxcar(self):
pass
'Test email notifications'
def test_email(self):
email_notifier = EmailNotifier() legacy_test_emails = 'email-1@address.com,email2@address.org,email_3@address.tv' test_emails = 'email-4@address.com,email5@address.org,email_6@address.tv' for show in self.legacy_shows: showid = self._get_showid_by_showname(show.name) self.mydb.action('UP...
'Test emby notifications'
@unittest.skip('Not yet implemented') def test_emby(self):
pass
'Test freemobile notifications'
@unittest.skip('Not yet implemented') def test_freemobile(self):
pass
'Test growl notifications'
@unittest.skip('Not yet implemented') def test_growl(self):
pass
'Test kodi notifications'
@unittest.skip('Not yet implemented') def test_kodi(self):
pass
'Test libnotify notifications'
@unittest.skip('Not yet implemented') def test_libnotify(self):
pass
'Test nma notifications'
@unittest.skip('Not yet implemented') def test_nma(self):
pass
'Test nmj notifications'
@unittest.skip('Not yet implemented') def test_nmj(self):
pass
'Test nmjv2 notifications'
@unittest.skip('Not yet implemented') def test_nmjv2(self):
pass
'Test plex notifications'
@unittest.skip('Not yet implemented') def test_plex(self):
pass
'Test prowl notifications'
def test_prowl(self):
prowl_notifier = ProwlNotifier() test_prowl_apis = '11111111111111111111,22222222222222222222' for show in self.shows: showid = self._get_showid_by_showname(show.name) Home.saveShowNotifyList(show=showid, prowlAPIs=test_prowl_apis) for show in self.shows: for episode in show.epis...
'Test pushalot notifications'
@unittest.skip('Not yet implemented') def test_pushalot(self):
pass
'Test pushbullet notifications'
@unittest.skip('Not yet implemented') def test_pushbullet(self):
pass
'Test pushover notifications'
@unittest.skip('Not yet implemented') def test_pushover(self):
pass
'Test pytivo notifications'
@unittest.skip('Not yet implemented') def test_pytivo(self):
pass
'Test synoindex notifications'
@unittest.skip('Not yet implemented') def test_synoindex(self):
pass
'Test synologynotifier notifications'
@unittest.skip('Not yet implemented') def test_synologynotifier(self):
pass
'Test trakt notifications'
@unittest.skip('Not yet implemented') def test_trakt(self):
pass
'Test tweet notifications'
@unittest.skip('Not yet implemented') def test_tweet(self):
pass
'Test twilio notifications'
@unittest.skip('Not yet implemented') def test_twilio(self):
pass
'Spew text notifications :param text: to spew :return:'
@staticmethod def _debug_spew(text):
if ((__name__ == '__main__') and (text is not None)): print text
'Get show ID by show name :param showname: :return:'
def _get_showid_by_showname(self, showname):
if (showname is not None): rows = self.mydb.select('SELECT show_id FROM tv_shows WHERE show_name = ?', [showname]) if (len(rows) == 1): return rows[0]['show_id'] return (-1)
'Test encoding'
def test_encoding(self):
root_dir = u'C:\\Temp\\TV' strings = [u'Les Enfants De La T\xe9l\xe9', u'RT\ufffd One'] sickbeard.SYS_ENCODING = None try: locale.setlocale(locale.LC_ALL, u'') sickbeard.SYS_ENCODING = locale.getpreferredencoding() except (locale.Error, IOError): pass if ((...
'cookielib has no legitimate use for this method; add it back if you find one.'
def add_header(self, key, val):
raise NotImplementedError('Cookie headers should be added with add_unredirected_header()')
'Make a MockResponse for `cookielib` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers'
def __init__(self, headers):
self._headers = headers
'Dict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1).'
def get(self, name, default=None, domain=None, path=None):
try: return self._find_no_duplicates(name, domain, path) except KeyError: return default
'Dict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains.'
def set(self, name, value, **kwargs):
if (value is None): remove_cookie_by_name(self, name, domain=kwargs.get('domain'), path=kwargs.get('path')) return if isinstance(value, Morsel): c = morsel_to_cookie(value) else: c = create_cookie(name, value, **kwargs) self.set_cookie(c) return c
'Dict-like iterkeys() that returns an iterator of names of cookies from the jar. .. seealso:: itervalues() and iteritems().'
def iterkeys(self):
for cookie in iter(self): (yield cookie.name)
'Dict-like keys() that returns a list of names of cookies from the jar. .. seealso:: values() and items().'
def keys(self):
return list(self.iterkeys())
'Dict-like itervalues() that returns an iterator of values of cookies from the jar. .. seealso:: iterkeys() and iteritems().'
def itervalues(self):
for cookie in iter(self): (yield cookie.value)
'Dict-like values() that returns a list of values of cookies from the jar. .. seealso:: keys() and items().'
def values(self):
return list(self.itervalues())
'Dict-like iteritems() that returns an iterator of name-value tuples from the jar. .. seealso:: iterkeys() and itervalues().'
def iteritems(self):
for cookie in iter(self): (yield (cookie.name, cookie.value))
'Dict-like items() that returns a list of name-value tuples from the jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a vanilla python dict of key value pairs. .. seealso:: keys() and values().'
def items(self):
return list(self.iteritems())
'Utility method to list all the domains in the jar.'
def list_domains(self):
domains = [] for cookie in iter(self): if (cookie.domain not in domains): domains.append(cookie.domain) return domains
'Utility method to list all the paths in the jar.'
def list_paths(self):
paths = [] for cookie in iter(self): if (cookie.path not in paths): paths.append(cookie.path) return paths
'Returns True if there are multiple domains in the jar. Returns False otherwise. :rtype: bool'
def multiple_domains(self):
domains = [] for cookie in iter(self): if ((cookie.domain is not None) and (cookie.domain in domains)): return True domains.append(cookie.domain) return False
'Takes as an argument an optional domain and path and returns a plain old Python dict of name-value pairs of cookies that meet the requirements. :rtype: dict'
def get_dict(self, domain=None, path=None):
dictionary = {} for cookie in iter(self): if (((domain is None) or (cookie.domain == domain)) and ((path is None) or (cookie.path == path))): dictionary[cookie.name] = cookie.value return dictionary
'Dict-like __getitem__() for compatibility with client code. Throws exception if there are more than one cookie with name. In that case, use the more explicit get() method instead. .. warning:: operation is O(n), not O(1).'
def __getitem__(self, name):
return self._find_no_duplicates(name)
'Dict-like __setitem__ for compatibility with client code. Throws exception if there is already a cookie of that name in the jar. In that case, use the more explicit set() method instead.'
def __setitem__(self, name, value):
self.set(name, value)
'Deletes a cookie given a name. Wraps ``cookielib.CookieJar``\'s ``remove_cookie_by_name()``.'
def __delitem__(self, name):
remove_cookie_by_name(self, name)
'Updates this jar with cookies from another CookieJar or dict-like'
def update(self, other):
if isinstance(other, cookielib.CookieJar): for cookie in other: self.set_cookie(copy.copy(cookie)) else: super(RequestsCookieJar, self).update(other)
'Requests uses this method internally to get cookie values. If there are conflicting cookies, _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown if there are conflicting cookies. :param name: a string containing name of cookie :param domain: (optional) string containing domain of coo...
def _find(self, name, domain=None, path=None):
for cookie in iter(self): if (cookie.name == name): if ((domain is None) or (cookie.domain == domain)): if ((path is None) or (cookie.path == path)): return cookie.value raise KeyError(('name=%r, domain=%r, path=%r' % (name, domain, path)))
'Both ``__get_item__`` and ``get`` call this function: it\'s never used elsewhere in Requests. :param name: a string containing name of cookie :param domain: (optional) string containing domain of cookie :param path: (optional) string containing path of cookie :raises KeyError: if cookie is not found :raises CookieConf...
def _find_no_duplicates(self, name, domain=None, path=None):
toReturn = None for cookie in iter(self): if (cookie.name == name): if ((domain is None) or (cookie.domain == domain)): if ((path is None) or (cookie.path == path)): if (toReturn is not None): raise CookieConflictError(('There ar...
'Unlike a normal CookieJar, this class is pickleable.'
def __getstate__(self):
state = self.__dict__.copy() state.pop('_cookies_lock') return state
'Unlike a normal CookieJar, this class is pickleable.'
def __setstate__(self, state):
self.__dict__.update(state) if ('_cookies_lock' not in self.__dict__): self._cookies_lock = threading.RLock()
'Return a copy of this RequestsCookieJar.'
def copy(self):
new_cj = RequestsCookieJar() new_cj.update(self) return new_cj
'Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents.'
def reset(self):
self.result = {'encoding': None, 'confidence': 0.0, 'language': None} self.done = False self._got_data = False self._has_win_bytes = False self._input_state = InputState.PURE_ASCII self._last_char = '' if self._esc_charset_prober: self._esc_charset_prober.reset() for prober in se...
'Takes a chunk of a document and feeds it through all of the relevant charset probers. After calling ``feed``, you can check the value of the ``done`` attribute to see if you need to continue feeding the ``UniversalDetector`` more data, or if it has made a prediction (in the ``result`` attribute). .. note:: You should ...
def feed(self, byte_str):
if self.done: return if (not len(byte_str)): return if (not isinstance(byte_str, bytearray)): byte_str = bytearray(byte_str) if (not self._got_data): if byte_str.startswith(codecs.BOM_UTF8): self.result = {'encoding': 'UTF-8-SIG', 'confidence': 1.0, 'language'...
'Stop analyzing the current document and come up with a final prediction. :returns: The ``result`` attribute, a ``dict`` with the keys `encoding`, `confidence`, and `language`.'
def close(self):
if self.done: return self.result self.done = True if (not self._got_data): self.logger.debug('no data received!') elif (self._input_state == InputState.PURE_ASCII): self.result = {'encoding': 'ascii', 'confidence': 1.0, 'language': ''} elif (self._input_state == InputSt...
'We define three types of bytes: alphabet: english alphabets [a-zA-Z] international: international characters [€-ÿ] marker: everything else [^a-zA-Z€-ÿ] The input buffer can be thought to contain a series of words delimited by markers. This function works to filter all words that contain at least one international char...
@staticmethod def filter_international_words(buf):
filtered = bytearray() words = re.findall('[a-zA-Z]*[\x80-\xff]+[a-zA-Z]*[^a-zA-Z\x80-\xff]?', buf) for word in words: filtered.extend(word[:(-1)]) last_char = word[(-1):] if ((not last_char.isalpha()) and (last_char < '\x80')): last_char = ' ' filtered.extend(...
'Returns a copy of ``buf`` that retains only the sequences of English alphabet and high byte characters that are not between <> characters. Also retains English alphabet and high byte characters immediately before occurrences of >. This filter can be applied to all scripts which contain both English characters and exte...
@staticmethod def filter_with_english_letters(buf):
filtered = bytearray() in_tag = False prev = 0 for curr in range(len(buf)): buf_char = buf[curr:(curr + 1)] if (buf_char == '>'): in_tag = False elif (buf_char == '<'): in_tag = True if ((buf_char < '\x80') and (not buf_char.isalpha())): ...
'reset analyser, clear any state'
def reset(self):
self._done = False self._total_chars = 0 self._freq_chars = 0
'feed a character with known length'
def feed(self, char, char_len):
if (char_len == 2): order = self.get_order(char) else: order = (-1) if (order >= 0): self._total_chars += 1 if (order < self._table_size): if (512 > self._char_to_freq_order[order]): self._freq_chars += 1
'return confidence based on existing data'
def get_confidence(self):
if ((self._total_chars <= 0) or (self._freq_chars <= self.MINIMUM_DATA_THRESHOLD)): return self.SURE_NO if (self._total_chars != self._freq_chars): r = (self._freq_chars / ((self._total_chars - self._freq_chars) * self.typical_distribution_ratio)) if (r < self.SURE_YES): retu...
':returns: The number of likelihood categories in the enum.'
@classmethod def get_num_categories(cls):
return 4
'Should we redirect and where to? :returns: Truthy redirect location string if we got a redirect status code and valid location. ``None`` if redirect status and no location. ``False`` if not a redirect status code.'
def get_redirect_location(self):
if (self.status in self.REDIRECT_STATUSES): return self.headers.get('location') return False