Accessed July 28, 2015
178432
public static BigDecimal getFeeInPercentage(BigDecimal thirtyDayVolume) {
        if (thirtyDayVolume.compareTo(new BigDecimal("1")) <= 0) {
            return new BigDecimal("1");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("2.5")) <= 0) {
            return new BigDecimal("0.95");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("4")) <= 0) {
            return new BigDecimal("0.9");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("6.5")) <= 0) {
            return new BigDecimal("0.85");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("9")) <= 0) {
            return new BigDecimal("0.8");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("12")) <= 0) {
            return new BigDecimal("0.75");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("18")) <= 0) {
            return new BigDecimal("0.7");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("25")) <= 0) {
            return new BigDecimal("0.65");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("32")) <= 0) {
            return new BigDecimal("0.60");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("40")) <= 0) {
            return new BigDecimal("0.55");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("55")) <= 0) {
            return new BigDecimal("0.5");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("75")) <= 0) {
            return new BigDecimal("0.45");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("100")) <= 0) {
            return new BigDecimal("0.4");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("125")) <= 0) {
            return new BigDecimal("0.35");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("160")) <= 0) {
            return new BigDecimal("0.3");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("200")) <= 0) {
            return new BigDecimal("0.25");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("250")) <= 0) {
            return new BigDecimal("0.2");
        } else if (thirtyDayVolume.compareTo(new BigDecimal("320")) <= 0) {
            return new BigDecimal("0.15");
        } else {
            return new BigDecimal("0.10");
        }
    }
1226070
private void beginInternalLink(ResourceReference reference, boolean freestanding,
        Map<String, String> parameters)
    {
        Map<String, String> spanAttributes = new LinkedHashMap<String, String>();
        Map<String, String> anchorAttributes = new LinkedHashMap<String, String>();

        // Add all parameters to the A attributes
        anchorAttributes.putAll(parameters);

        if (StringUtils.isEmpty(reference.getReference())) {
            spanAttributes.put(CLASS, WIKILINK);
            renderAutoLink(reference, spanAttributes, anchorAttributes);
        } else if (this.wikiModel.isDocumentAvailable(reference)) {
            spanAttributes.put(CLASS, WIKILINK);
            anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentViewURL(reference));
        } else {
            // The wiki document doesn't exist
            spanAttributes.put(CLASS, "wikicreatelink");
            anchorAttributes.put(XHTMLLinkRenderer.HREF, this.wikiModel.getDocumentEditURL(reference));
        }

        getXHTMLWikiPrinter().printXMLStartElement(SPAN, spanAttributes);
        getXHTMLWikiPrinter().printXMLStartElement(XHTMLLinkRenderer.ANCHOR, anchorAttributes);
    }
1318058
function doOpenDocument() {
    var presenter = new mindmaps.OpenDocumentPresenter(eventBus,
        mindmapModel, new mindmaps.OpenDocumentView(), filePicker);
    presenter.go();
  }
182532
function(oSourceInfo, oTargetInfo, iLevel) {
			iLevel = iLevel ? iLevel : 0;

			ACCInfoHelper._normalize(oSourceInfo);
			if (iLevel == 0) {
				ACCInfoHelper._normalize(oTargetInfo);
				oTargetInfo._descriptions = [];
			}

			oTargetInfo._descriptions.push(ACCInfoHelper._getFullDescription(oSourceInfo));

			oSourceInfo.children.forEach(function(oChild) {
				if (!oChild.getAccessibilityInfo || (oChild.getVisible && !oChild.getVisible())) {
					return;
				}

				var oChildInfo = oChild.getAccessibilityInfo();
				if (oChildInfo) {
					ACCInfoHelper._flatten(oChildInfo, oTargetInfo, iLevel + 1);
				}
			});

			if (iLevel == 0) {
				oTargetInfo.description = oTargetInfo._descriptions.join(" ").trim();
				oTargetInfo._descriptions = undefined;
			}
		}
761164
def index():
    """"""
    identity = g.identity
    actions = {}
    for action in access.actions.values():
        actions[action.value] = DynamicPermission(action).allows(identity)

    if current_user.is_anonymous:
        return render_template("invenio_access/open.html",
                               actions=actions,
                               identity=identity)
    else:
        return render_template("invenio_access/limited.html",
                               message='',
                               actions=actions,
                               identity=identity)
739061
def editions(self):
        
        return [
                item
                for urn, item in self.parent.children.items()
                if isinstance(item, CtsEditionMetadata)
            ]
606753
def write_documentation(self, output_file):
    ""
    if not self.is_opened():
        raise helpers.HIDError("Device has to be opened to get documentation")
    #format
    class CompundVarDict(object):
        """Compound variables dictionary.
        Keys are strings mapping variables.
        If any string has a '.' on it, it means that is an
        object with an attribute. The attribute name will be
        used then as the returned item value.
        """
        def __init__(self, parent):
            self.parent = parent
        def __getitem__(self, key):
            if '.' not in key:
                return self.parent[key]
            else:
                all_keys = key.split('.')
                curr_var = self.parent[all_keys[0]]
                for item in all_keys[1:]:
                    new_var = getattr(curr_var, item)
                    curr_var = new_var
                return new_var
    dev_vars = vars(self)
    dev_vars['main_usage_str'] = repr(
            usage_pages.HidUsage(self.hid_caps.usage_page,
                self.hid_caps.usage) )
    output_file.write( """\n\
HID device documentation report
===============================

Top Level Details
-----------------

Manufacturer String:    %(vendor_name)s
Product String:          %(product_name)s
Serial Number:          %(serial_number)s

Vendor ID:              0x%(vendor_id)04x
Product ID:             0x%(product_id)04x
Version number:         0x%(version_number)04x

Device Path:            %(device_path)s
Device Instance Id:     %(instance_id)s
Parent Instance Id:     %(parent_instance_id)s

Top level usage:        Page=0x%(hid_caps.usage_page)04x, Usage=0x%(hid_caps.usage)02x
Usage identification:   %(main_usage_str)s
Link collections:       %(hid_caps.number_link_collection_nodes)d collection(s)

Reports
-------

Input Report
~~~~~~~~~~~~
Length:     %(hid_caps.input_report_byte_length)d byte(s)
Buttons:    %(hid_caps.number_input_button_caps)d button(s)
Values:     %(hid_caps.number_input_value_caps)d value(s)

Output Report
~~~~~~~~~~~~~
length:     %(hid_caps.output_report_byte_length)d byte(s)
Buttons:    %(hid_caps.number_output_button_caps)d button(s)
Values:     %(hid_caps.number_output_value_caps)d value(s)

Feature Report
~~~~~~~~~~~~~
Length:     %(hid_caps.feature_report_byte_length)d byte(s)
Buttons:    %(hid_caps.number_feature_button_caps)d button(s)
Values:     %(hid_caps.number_feature_value_caps)d value(s)

""" % CompundVarDict(dev_vars)) #better than vars()!
    #return
    # inspect caps
    for report_kind in [winapi.HidP_Input,
            winapi.HidP_Output, winapi.HidP_Feature]:
        all_usages = self.usages_storage.get(report_kind, [])
        if all_usages:
            output_file.write('*** %s Caps ***\n\n' % {
                    winapi.HidP_Input   : "Input",
                    winapi.HidP_Output  : "Output",
                    winapi.HidP_Feature : "Feature"
                    }[report_kind])
            # normalize usages to allow sorting by usage or min range value
            for item in all_usages:
                if getattr(item, 'usage', None) != None:
                    item.flat_id = item.usage
                elif getattr(item, 'usage_min', None) != None:
                    item.flat_id = item.usage_min
                else:
                    item.flat_id = None
            sorted(all_usages, key=attrgetter('usage_page', 'flat_id'))
            for usage_item in all_usages:
                # remove helper attribute
                del usage_item.flat_id

                all_items = usage_item.inspect()
                # sort first by 'usage_page'...
                usage_page = all_items["usage_page"]
                del all_items["usage_page"]
                if "usage" in all_items:
                    usage = all_items["usage"]
                    output_file.write("    Usage {0} ({0:#x}), "\
                            "Page {1:#x}\n".format(usage, usage_page))
                    output_file.write("    ({0})\n".format(
                        repr(usage_pages.HidUsage(usage_page, usage))) )
                    del all_items["usage"]
                elif 'usage_min' in all_items:
                    usage = (all_items["usage_min"], all_items["usage_max"])
                    output_file.write("    Usage Range {0}~{1} ({0:#x}~{1:#x}),"
                            " Page {2:#x} ({3})\n".format(
                                usage[0], usage[1], usage_page,
                                str(usage_pages.UsagePage(usage_page))) )
                    del all_items["usage_min"]
                    del all_items["usage_max"]
                else:
                    raise AttributeError("Expecting any usage id")
                attribs = list( all_items.keys() )
                attribs.sort()
                for key in attribs:
                    if 'usage' in key:
                        output_file.write("{0}{1}: {2} ({2:#x})\n".format(' '*8,
                            key, all_items[key]))
                    else:
                        output_file.write("{0}{1}: {2}\n".format(' '*8,
                            key, all_items[key]))
                output_file.write('\n')
1350220
function (cb) {
            var self = this;
            var dirs = ['classes', 'modules', 'files'];
            if (self.options.dumpview) {
                dirs.push('json');
            }
            var writeRedirect = function (dir, file, cb) {
                Y.Files.exists(file, function (x) {
                    if (x) {
                        var out = path.join(dir, 'index.html');
                        fs.createReadStream(file).pipe(fs.createWriteStream(out));
                    }
                    cb();
                });
            };
            var defaultIndex = path.join(themeDir, 'assets', 'index.html');
            var stack = new Y.Parallel();
            Y.log('Making default directories: ' + dirs.join(','), 'info', 'builder');
            dirs.forEach(function (d) {
                var dir = path.join(self.options.outdir, d);
                Y.Files.exists(dir, stack.add(function (x) {
                    if (!x) {
                        fs.mkdir(dir, 0777, stack.add(function () {
                            writeRedirect(dir, defaultIndex, stack.add(noop));
                        }));
                    } else {
                        writeRedirect(dir, defaultIndex, stack.add(noop));
                    }
                }));
            });
            stack.done(function () {
                if (cb) {
                    cb();
                }
            });
        }
1010935
def do_use(self, args):
        """"""
        self.instance = args
        self.prompt = self.instance + '> '

        archive = self._client.get_archive(self.instance)
        self.streams = [s.name for s in archive.list_streams()]
        self.tables = [t.name for t in archive.list_tables()]
60159
private void showParams(List<CmsSearchParamPanel> paramPanels) {

        m_params.clear();
        if ((paramPanels == null) || (paramPanels.size() == 0)) {
            m_params.setVisible(false);
            updateListSize();
            return;
        }
        m_params.setVisible(true);
        for (CmsSearchParamPanel panel : paramPanels) {
            m_params.add(panel);
        }
        updateListSize();
    }
1148659
def url(self):
        
        if self._partition_key:
            base_url = self.design_doc.document_partition_url(
                self._partition_key)
        else:
            base_url = self.design_doc.document_url

        return '/'.join((
            base_url,
            '_view',
            self.view_name
        ))
108064
private View openIndex(int flags, boolean dryRun) throws ForestException {
        if (_view == null) {
            // Flags:
            if (_dbStore.getAutoCompact())
                flags |= Database.AutoCompact;

            // Encryption:
            SymmetricKey encryptionKey = _dbStore.getEncryptionKey();
            int enAlgorithm = Database.NoEncryption;
            byte[] enKey = null;
            if (encryptionKey != null) {
                enAlgorithm = Database.AES256Encryption;
                enKey = encryptionKey.getKey();
            }

            _view = new View(_dbStore.forest, _path, flags, enAlgorithm, enKey, name,
                    dryRun ? "0" : delegate.getMapVersion());
            if (dryRun) {
                closeIndex();
            }
        }
        return _view;
    }
1362215
function() {
			var node = new AbbreviationNode();
			var attrs = ['abbreviation', 'counter', '_name', '_text', 'repeatCount', 'hasImplicitRepeat', 'start', 'end', 'content', 'padding'];
			attrs.forEach(function(a) {
				node[a] = this[a];
			}, this);
			
			// clone attributes
			node._attributes = this._attributes.map(function(attr) {
				return utils.extend({}, attr);
			});
			
			node._data = utils.extend({}, this._data);
			
			// clone children
			node.children = this.children.map(function(child) {
				child = child.clone();
				child.parent = node;
				return child;
			});
			
			return node;
		}
1098857
protected function buildMap(): void
    {
        // Fetch articles mapped from source to main.
        foreach ($this->pageMap->sourceIds() as $page) {
            $this->fetchArticlesFrom($page, $this->sourceMap, $this->pageMap->getMainFromSource($page));
        }
        $this->sourceMapInverse = array_flip($this->sourceMap);

        foreach ($this->pageMap->targetIds() as $page) {
            $this->fetchArticlesFrom($page, $this->targetMap, $this->pageMap->getMainFromTarget($page));
        }
        $this->targetMapInverse = array_flip($this->targetMap);

        $this->combineSourceAndTargetMaps();
    }
548
def use_federated_book_view(self):
        """"""
        self._book_view = FEDERATED
        # self._get_provider_session('comment_lookup_session') # To make sure the session is tracked
        for session in self._get_provider_sessions():
            try:
                session.use_federated_book_view()
            except AttributeError:
                pass
112233
public function run()
    {
        Permission::create([
            'name' => 'view_dashboard',
            'label' => trans('chronos.scaffolding::permissions.View dashboard'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'edit_settings',
            'label' => trans('chronos.scaffolding::permissions.Edit settings'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'edit_access_tokens',
            'label' => trans('chronos.scaffolding::permissions.Edit access tokens'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'delete_access_tokens',
            'label' => trans('chronos.scaffolding::permissions.Delete access tokens'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'view_image_styles',
            'label' => trans('chronos.scaffolding::permissions.View image styles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'add_image_styles',
            'label' => trans('chronos.scaffolding::permissions.Add image styles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'edit_image_styles',
            'label' => trans('chronos.scaffolding::permissions.Edit images styles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'delete_image_styles',
            'label' => trans('chronos.scaffolding::permissions.Delete image styles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'view_roles',
            'label' => trans('chronos.scaffolding::permissions.View roles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'add_roles',
            'label' => trans('chronos.scaffolding::permissions.Add roles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'edit_roles',
            'label' => trans('chronos.scaffolding::permissions.Edit roles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'delete_roles',
            'label' => trans('chronos.scaffolding::permissions.Delete roles'),
            'order' => 10
        ]);

        Permission::create([
            'name' => 'edit_permissions',
            'label' => trans('chronos.scaffolding::permissions.Edit permissions'),
            'order' => 10
        ]);
    }
434584
def get_context_data(self, **kwargs):
        
        context = super(CapabilityView, self).get_context_data(**kwargs)
        context.update({'protocol': PROTOCOL,
                        'copyright': COPYRIGHT,
                        'feeds_format': FEEDS_FORMAT,
                        'site': Site.objects.get_current()})
        return context