Пример #1
0
 def __init__(self,
              url,
              filename,
              part_callback=None,
              headers=None,
              force_filename=False,
              allow_compression=True):
     """
     :param url: the url to download from
     :type url: string
     :param filename: the filename to save the file as
     :type filename: string
     :param part_callback: a function to be called when a part of data
         is received, it's signature should be: func(data, current_length, total_length)
     :type part_callback: function
     :param headers: any optional headers to send
     :type headers: dictionary
     """
     self.part_callback = part_callback
     self.current_length = 0
     self.decoder = None
     self.value = filename
     self.force_filename = force_filename
     self.allow_compression = allow_compression
     agent = "Deluge/%s (http://deluge-torrent.org)" % get_version()
     client.HTTPDownloader.__init__(self,
                                    url,
                                    filename,
                                    headers=headers,
                                    agent=agent)
Пример #2
0
 def _get_version(self, doc):
     try:
         return stix.get_version(doc)
     except KeyError:
         raise errors.UnknownSTIXVersionError(
             "Unable to validate instance document. STIX version not "
             "found in instance document and not supplied to validate() "
             "method"
         )
Пример #3
0
def check_version():
    """Check the version we're running."""
    my_version = common.get_version()
    latest_version = common.get_master_version()
    if my_version and latest_version and (my_version < latest_version):
        print("Version {}.{}.{} is now available".format(*latest_version))
        print("Run with -c after upgrading to clear your cache!".format(
            *latest_version))
        time.sleep(3)
    else:
        logger.info("Current version: %s", my_version)
        logger.info("Latest version:  %s", latest_version)
Пример #4
0
    def _get_version(self, doc):
        """Attempts to return the version of the STIX `doc`.

        Args:
            doc: A STIX document. This can be a filename, file-like object,
                ``etree._Element`` or ``etree._ElementTree`` instance.

        Returns:
            The version for the STIX `doc`.

        """
        try:
            return stix.get_version(doc)
        except KeyError:
            raise errors.UnknownSTIXVersionError(
                "Document did not contain a 'version' attribute"
            )
Пример #5
0
 def __init__(self, url, filename, part_callback=None, headers=None,
              force_filename=False, allow_compression=True):
     """
     :param url: the url to download from
     :type url: string
     :param filename: the filename to save the file as
     :type filename: string
     :param part_callback: a function to be called when a part of data
         is received, it's signature should be: func(data, current_length, total_length)
     :type part_callback: function
     :param headers: any optional headers to send
     :type headers: dictionary
     """
     self.part_callback = part_callback
     self.current_length = 0
     self.decoder = None
     self.value = filename
     self.force_filename = force_filename
     self.allow_compression = allow_compression
     agent = "Deluge/%s (http://deluge-torrent.org)" % get_version()
     client.HTTPDownloader.__init__(self, url, filename, headers=headers, agent=agent)
Пример #6
0
html("      blush(ns[0]);")
html("      setTimeout(function(){ window.scroll(0,(t < 0) ? 0 : t); },10);")
html("    }")
html("    return true;")
html("  }")
html("  function toppos(){")
html("    document.location=\"#top\"")
html("    var ns = document.getElementsByName(\"searchbox\"), n;")
html("    if ((ns.length > 0) && (typeof (n = ns[0]).value !== \"undefined\")) {")
html("      n.focus(); n.select();")
html("    }")
html("  }</script>")
html(" </head>")
html(" <body>")
html("  <h1>Espruino Software Reference</h1>")
html("  <p style=\"text-align:right;\">Version "+common.get_version()+"</p>")

if htmldev == True:
  html("  <div>")
  html("   <input class=\"searchbox\" name=\"searchbox\" size=\"60\" type=\"text\" autocomplete=\"off\">");
  html("  </div>")

detail = []
links = {}
jsondatas = sorted(jsondatas, key=lambda s: common.get_name_or_space(s).lower())

html('  <div id="contents">')
html("  <h2><a name=\"contents\"></a>Contents</h2>")
html("  <ul>")
html("  <li><a class=\"blush\" name=\"t__global\" href=\"#_global\" onclick=\"place('_global');\">Globals</A></li>")
for jsondata in jsondatas:
Пример #7
0
)
html("   .instance { font-weight: bold; }")
html(
    "   .detail { width:90%; border-bottom: 1px solid black; margin-top: 50px; }"
)
html("   .top { float:right; }")
html("   .call { padding-left: 50px; }")
html("   .description { padding-left: 50px; }")
html("   .param { padding-left: 50px; }")
html("   .return { padding-left: 50px; }")
html("   .examples { padding-left: 50px; }")
html("  </style>")
html(" </head>")
html(" <body>")
html("  <h1>Espruino Software Reference</h1>")
html("  <p style=\"text-align:right;\">Version " + common.get_version() +
     "</p>")
html("  <h2><a name=\"contents\">Contents</a></h2>")
html("  <h3><a href=\"#_global\">Globals</A></h3>")
html("  <ul>")
detail = []
links = {}
jsondatas = sorted(jsondatas, key=common.get_name_or_space)
for jsondata in jsondatas:
    if "name" in jsondata and not "class" in jsondata and not jsondata[
            "type"] == "object":
        html("    <li><a href=\"#" + get_link(jsondata) + "\">" +
             get_surround(jsondata) + "</a></li>")
        if not "no_create_links" in jsondata:
            links[get_prefixed_name(jsondata)] = get_link(jsondata)
        detail.append(jsondata)
Пример #8
0
jsonFilename = "boards/" + boardname + ".json"
print("JSON_FILENAME " + jsonFilename)
print("BOARD " + boardname)
# import the board def
board = importlib.import_module(boardname)
# Call the included board_specific file - it sets up 'pins' and 'fill_gaps'
pins = board.get_pins()
pins = pinutils.append_devices_to_pin_list(pins, board)
# -----------------------------------------------------------------------------------------
# Documentation/functions
jsondatas = common.get_jsondata(False, False, board)
# -----------------------------------------------------------------------------------------
board.info["image_url"] = "http://www.espruino.com/img/" + boardname + ".jpg"
board.info[
    "thumb_url"] = "http://www.espruino.com/img/" + boardname + "_thumb.jpg"
board.info["binary_version"] = common.get_version()
board.info[
    "binary_url"] = "http://www.espruino.com/binaries/" + common.get_board_binary_name(
        board)
# -----------------------------------------------------------------------------------------
# Built-in modules

builtinModules = []
for jsondata in jsondatas:
    if jsondata["type"] == "library":
        builtinModules.append(jsondata["class"])

board.info["builtin_modules"] = builtinModules
# -----------------------------------------------------------------------------------------
pinperipherals = {}
Пример #9
0
boardname = sys.argv[1]
jsonFilename = "boards/"+boardname+".json"
print("JSON_FILENAME "+jsonFilename)
print("BOARD "+boardname)
# import the board def
board = importlib.import_module(boardname)
# Call the included board_specific file - it sets up 'pins' and 'fill_gaps'
pins = board.get_pins()
pins = pinutils.append_devices_to_pin_list(pins, board)
# -----------------------------------------------------------------------------------------
# Documentation/functions
jsondatas = common.get_jsondata(False, False, board)
# -----------------------------------------------------------------------------------------
board.info["image_url"] = "http://www.espruino.com/img/"+boardname+".jpg"
board.info["thumb_url"] = "http://www.espruino.com/img/"+boardname+"_thumb.jpg"
board.info["binary_version"] = common.get_version();
board.info["binary_url"] = "http://www.espruino.com/binaries/"+common.get_board_binary_name(board)
# -----------------------------------------------------------------------------------------
# Built-in modules

builtinModules = []
for jsondata in jsondatas:
  if jsondata["type"]=="library":
    builtinModules.append(jsondata["class"])

board.info["builtin_modules"] = builtinModules
# -----------------------------------------------------------------------------------------
pinperipherals = {}

for pin in pins:
  if pin["name"][0] == 'P':
 def __init__(self, log):
     self.log = log
     self.agent = "Deluge v%s YaRSS2 v%s" % (common.get_deluge_version(), common.get_version())
Пример #11
0
 def __init__(self, log):
     self.log = log
     self.agent = "Deluge v%s YaRSS2 v%s" % (common.get_deluge_version(),
                                             common.get_version())
Пример #12
0
common.click_button_by_title('Search')

# click it
common.click_button_by_title('Add to Cart', multiple=True)

common.click_button_by_title('Proceed to Checkout', multiple=True)

a.wait_for(a.assert_displayed, 'checkout-step-billing')

a.click_button(a.get_element_by_xpath(
    "//div[@id='checkout-step-billing']"
    "//button[@title='Continue']"))

# in 1.4 it doesn't automatically proceed to shipping method
# because Use Billing Address is not active
if common.get_version() < (1, 5, 0, 0):
    check = a.get_element_by_xpath("//input[@id='shipping:same_as_billing']")
    a.wait_for(a.assert_displayed, check)
    check.click()
    # we need the right continue button, so roll by hand
    button = a.get_element_by_xpath(
        "//form[@id='co-shipping-form']//button[@title='Continue']")
    button.click()

a.wait_for(a.assert_displayed, 'checkout-step-shipping_method')

a.click_button(a.get_element_by_xpath(
    "//div[@id='checkout-step-shipping_method']"
    "//button"))

a.wait_for(a.assert_displayed, 'p_method_getfinancing')