file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
test_multimeter.py
import unittest import nest from nix4nest.nest_api.models.multimeter import NestMultimeter class TestNode(unittest.TestCase): def setUp(self): nest.ResetKernel() self.neuron_id = nest.Create('iaf_neuron')[0] rec_params = {'record_from': ['V_m'], 'withtime': True} self.mm_id = n...
(self): nest.ResetKernel() def test_properties(self): for k in nest.GetStatus([self.mm_id])[0].keys(): assert(k in self.mm.properties) def test_data(self): assert(len(self.mm.data) == 0) nest.Simulate(50) assert(len(self.mm.data) == 0) self.mm.ref...
tearDown
identifier_name
test_multimeter.py
import unittest import nest from nix4nest.nest_api.models.multimeter import NestMultimeter class TestNode(unittest.TestCase): def setUp(self): nest.ResetKernel() self.neuron_id = nest.Create('iaf_neuron')[0] rec_params = {'record_from': ['V_m'], 'withtime': True} self.mm_id = n...
def test_data(self): assert(len(self.mm.data) == 0) nest.Simulate(50) assert(len(self.mm.data) == 0) self.mm.refresh() assert(len(self.mm.data) == 49) assert(self.neuron_id in self.mm.senders) assert((self.mm.senders == self.neuron_id).all())
assert(k in self.mm.properties)
conditional_block
test_multimeter.py
import unittest import nest from nix4nest.nest_api.models.multimeter import NestMultimeter class TestNode(unittest.TestCase): def setUp(self):
def tearDown(self): nest.ResetKernel() def test_properties(self): for k in nest.GetStatus([self.mm_id])[0].keys(): assert(k in self.mm.properties) def test_data(self): assert(len(self.mm.data) == 0) nest.Simulate(50) assert(len(self.mm.data) == 0) ...
nest.ResetKernel() self.neuron_id = nest.Create('iaf_neuron')[0] rec_params = {'record_from': ['V_m'], 'withtime': True} self.mm_id = nest.Create('multimeter', params=rec_params)[0] nest.Connect([self.mm_id], [self.neuron_id]) self.mm = NestMultimeter(self.mm_id, 'V_m')
identifier_body
test_multimeter.py
import unittest import nest from nix4nest.nest_api.models.multimeter import NestMultimeter class TestNode(unittest.TestCase): def setUp(self): nest.ResetKernel() self.neuron_id = nest.Create('iaf_neuron')[0] rec_params = {'record_from': ['V_m'], 'withtime': True} self.mm_id = n...
def test_data(self): assert(len(self.mm.data) == 0) nest.Simulate(50) assert(len(self.mm.data) == 0) self.mm.refresh() assert(len(self.mm.data) == 49) assert(self.neuron_id in self.mm.senders) assert((self.mm.senders == self.neuron_id).all())
def test_properties(self): for k in nest.GetStatus([self.mm_id])[0].keys(): assert(k in self.mm.properties)
random_line_split
exercise.js
/* * Copyright 2015 Westfälische Hochschule * * This file is part of Poodle. * * Poodle is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any...
if ($("#textList > li").length === 0) disabledTabs.push(4); var tabCount = $chartsTabs.find("#tabList > li").length; // all tabs disabled, hide them and abort if (disabledTabs.length === tabCount) { $chartsTabs.hide(); return; } // get index of the first tab that is not disabled var activeTab...
disabledTabs.push(1); if (!drawFunChart(dataTable)) disabledTabs.push(2); if (!drawCompletedChart(dataTable)) disabledTabs.push(3);
random_line_split
exercise.js
/* * Copyright 2015 Westfälische Hochschule * * This file is part of Poodle. * * Poodle is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any...
dataTable) { var $timeChart = $("#timeChart"); var avgTime = $timeChart.data("avg"); var view = new google.visualization.DataView(dataTable); view.setRows(view.getFilteredRows( [{ column: 3, // only columns with time >= 1 minValue: 1 }]) ); view.setColumns([3]); // only time column if ...
rawTimeChart(
identifier_name
exercise.js
/* * Copyright 2015 Westfälische Hochschule * * This file is part of Poodle. * * Poodle is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any...
function drawCompletedChart(dataTable) { var counts = new google.visualization.DataTable(); counts.addColumn("string", messages.completed); counts.addColumn("number", messages.count); var dataCount = 0; /* messages.completedStatus contains the Java enum values (which are also * in the dataTable) as the...
var $funChart = $("#funChart"); var avgFun = $funChart.data("avg"); var funOptions = $.extend(true, {}, OPTIONS_ALL, { hAxis: { title: messages.funTitle.format(avgFun) } }); var counts = new google.visualization.DataTable(); // this column must be of type string. Otherwise not all values are di...
identifier_body
timer.py
import pile import matplotlib.pyplot as plt import time import random x,y = [],[] for i in range(0,10): p = 10 ** i print(i) start = time.time() pile.pile(p) final = time.time() delta = final - start x.append(p) y.append(delta) plt.plot(x,y) plt.ylabel("The time taken to compute the pile...
(tsize,dsize): p = [tsize] soma = 0 size = 1 for i in range(dsize): if size == 0: break update = [] for n in p: if n == 1: soma += 0 else: a = random.randint(1,n-1) b = n - a soma ...
cutter
identifier_name
timer.py
import pile import matplotlib.pyplot as plt import time import random x,y = [],[] for i in range(0,10): p = 10 ** i print(i) start = time.time() pile.pile(p) final = time.time() delta = final - start x.append(p) y.append(delta) plt.plot(x,y) plt.ylabel("The time taken to compute the pile...
p = list(update) size = len(p) print(update,soma) return(p,soma) print(cutter(30,99))
a = random.randint(1,n-1) b = n - a soma += a*b update.append(a) update.append(b)
conditional_block
timer.py
import pile import matplotlib.pyplot as plt import time import random x,y = [],[] for i in range(0,10): p = 10 ** i print(i) start = time.time() pile.pile(p) final = time.time() delta = final - start x.append(p) y.append(delta) plt.plot(x,y) plt.ylabel("The time taken to compute the pile...
return(p,soma) print(cutter(30,99))
random_line_split
timer.py
import pile import matplotlib.pyplot as plt import time import random x,y = [],[] for i in range(0,10): p = 10 ** i print(i) start = time.time() pile.pile(p) final = time.time() delta = final - start x.append(p) y.append(delta) plt.plot(x,y) plt.ylabel("The time taken to compute the pile...
print(cutter(30,99))
p = [tsize] soma = 0 size = 1 for i in range(dsize): if size == 0: break update = [] for n in p: if n == 1: soma += 0 else: a = random.randint(1,n-1) b = n - a soma += a*b ...
identifier_body
mod.rs
// Copyright 2013-2015, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> mod font_options; mod font_face; mod scaled_font; pub use ffi::enums::{ Antialias, S...
Allocates an array of cairo_glyph_t's. This function is only useful in implementations of cairo_user_scaled_font_text_to_glyphs_func_t where the user needs to allocate an array of glyphs that cairo will free. For all other uses, user can use their own allocation method for glyphs. impl TextCluster { //pub fn c...
random_line_split
kindck-owned-trait-scoped.rs
// xfail-test // xfail'd because to_foo() doesn't work. // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/lic...
fn to_foo_3<T:Clone + 'static>(t: T) -> @foo { // OK---T may escape as part of the returned foo value, but it is // owned and hence does not contain borrowed ptrs struct F<T> { f: T } @F {f:t} as @foo } fn main() { }
{ // Not OK---T may contain borrowed ptrs and it is going to escape // as part of the returned foo value struct F<T> { f: T } @F {f:t} as @foo //~ ERROR value may contain borrowed pointers; add `'static` bound }
identifier_body
kindck-owned-trait-scoped.rs
// xfail-test // xfail'd because to_foo() doesn't work. // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/lic...
<T> { f: T } @F {f:t} as @foo //~ ERROR value may contain borrowed pointers; add `'static` bound } fn to_foo_3<T:Clone + 'static>(t: T) -> @foo { // OK---T may escape as part of the returned foo value, but it is // owned and hence does not contain borrowed ptrs struct F<T> { f: T } @F {f:t} as @foo...
F
identifier_name
kindck-owned-trait-scoped.rs
// xfail-test // xfail'd because to_foo() doesn't work. // Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/lic...
fn to_foo_3<T:Clone + 'static>(t: T) -> @foo { // OK---T may escape as part of the returned foo value, but it is // owned and hence does not contain borrowed ptrs struct F<T> { f: T } @F {f:t} as @foo } fn main() { }
struct F<T> { f: T } @F {f:t} as @foo //~ ERROR value may contain borrowed pointers; add `'static` bound }
random_line_split
Macro.py
#!/usr/bin/python3 #JMP:xkozub03 import sys import re import Config from Config import exit_err macro_list = {}; def init_list(redef_opt): def_macro = Macro("@def"); set_macro = Macro("@set"); let_macro = Macro("@let"); null_macro = Macro("@null"); _def_macro = Macro("@__def__"); _set_macro = Macro("@__set__"...
def get_num_of_args(self): return self.args_cnt; def add_arg(self, name): if name in self.args.keys(): #redefinice argumentu; exit_err("Semantic error (argument redefinition - '" + name + "')", 56); self.args[name] = ''; self.args_ord_name.append(name); self.args_cnt += 1; def set_next_arg(self, valu...
def get_name(self): return self.name;
random_line_split
Macro.py
#!/usr/bin/python3 #JMP:xkozub03 import sys import re import Config from Config import exit_err macro_list = {}; def init_list(redef_opt): def_macro = Macro("@def"); set_macro = Macro("@set"); let_macro = Macro("@let"); null_macro = Macro("@null"); _def_macro = Macro("@__def__"); _set_macro = Macro("@__set__"...
if self.is_null: return self.expand_null(); if self.is_let: return self.expand_let(); exp_body = self.body; m = re.findall("((^|[^\$]*?)(\$[a-zA-Z_][a-zA-Z_0-9]*)(\s|\$|$|[^a-zA-Z_0-9]))", exp_body); for rex in m: if rex[2] in self.args.keys(): exp_body = exp_body.replace(rex[0], rex[1] + self.args[rex[2...
return self.expand_set();
conditional_block
Macro.py
#!/usr/bin/python3 #JMP:xkozub03 import sys import re import Config from Config import exit_err macro_list = {}; def init_list(redef_opt): def_macro = Macro("@def"); set_macro = Macro("@set"); let_macro = Macro("@let"); null_macro = Macro("@null"); _def_macro = Macro("@__def__"); _set_macro = Macro("@__set__"...
def expand_def(self): return _expand_def(self); def expand_set(self): return _expand_set(self); def expand_let(self): return _expand_let(self); def expand_null(self): return _expand_null(self); def _expand(self): if self.args_order != self.args_cnt: sys.stderr.write("Syntax error\n"); exit(56); self...
return _expand(self);
identifier_body
Macro.py
#!/usr/bin/python3 #JMP:xkozub03 import sys import re import Config from Config import exit_err macro_list = {}; def init_list(redef_opt): def_macro = Macro("@def"); set_macro = Macro("@set"); let_macro = Macro("@let"); null_macro = Macro("@null"); _def_macro = Macro("@__def__"); _set_macro = Macro("@__set__"...
: name = ""; body = ""; args = {}; args_ord_name = []; args_cnt = 0; args_order = 0; is_def = False; is_set = False; is_let = False; is_null = False; redef = True; def __init__(self, name): self.name = name; self.body = ""; self.args = {}; self.args_ord_name = []; self.args_cnt = 0; self.args_or...
Macro
identifier_name
middleware.py
import logging from django.utils.translation import ugettext_lazy as _ from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.http import Http404 from readthedocs.projects.models import Project, Domain log = logg...
(object): """Reset urlconf for requests for 'single_version' docs. In settings.MIDDLEWARE_CLASSES, SingleVersionMiddleware must follow after SubdomainMiddleware. """ def _get_slug(self, request): """Get slug from URLs requesting docs. If URL is like '/docs/<project_name>/', we s...
SingleVersionMiddleware
identifier_name
middleware.py
import logging from django.utils.translation import ugettext_lazy as _ from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.http import Http404 from readthedocs.projects.models import Project, Domain log = logg...
if not hasattr(request, 'domain_object') and 'HTTP_X_RTD_SLUG' in request.META: request.slug = request.META['HTTP_X_RTD_SLUG'].lower() request.urlconf = 'readthedocs.core.subdomain_urls' request.rtdheader = True log.debug(LOG_TEMPLATE.format( ...
if domain.domain == host: request.slug = domain.project.slug request.urlconf = 'core.subdomain_urls' request.domain_object = True domain.count = domain.count + 1 domain.save() ...
conditional_block
middleware.py
import logging from django.utils.translation import ugettext_lazy as _ from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.http import Http404 from readthedocs.projects.models import Project, Domain log = logg...
def process_request(self, request): host = request.get_host().lower() path = request.get_full_path() log_kwargs = dict(host=host, path=path) if settings.DEBUG: log.debug(LOG_TEMPLATE.format(msg='DEBUG on, not processing middleware', **log_kwargs)) return None...
class SubdomainMiddleware(object):
random_line_split
middleware.py
import logging from django.utils.translation import ugettext_lazy as _ from django.conf import settings from django.core.cache import cache from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned from django.http import Http404 from readthedocs.projects.models import Project, Domain log = logg...
""" Middleware that sets REMOTE_ADDR based on HTTP_X_FORWARDED_FOR, if the latter is set. This is useful if you're sitting behind a reverse proxy that causes each request's REMOTE_ADDR to be set to 127.0.0.1. Note that this does NOT validate HTTP_X_FORWARDED_FOR. If you're not behind a reverse proxy...
identifier_body
ua_utils.py
""" Usefull method and classes not belonging anywhere and depending on opcua library """ from dateutil import parser from datetime import datetime from enum import Enum, IntEnum import uuid from opcua import ua from opcua.ua.uaerrors import UaError def val_to_string(val): """ convert a python object or pyth...
def get_node_subtypes(node, nodes=None): if nodes is None: nodes = [node] for child in node.get_children(refs=ua.ObjectIds.HasSubtype): nodes.append(child) get_node_subtypes(child, nodes) return nodes def get_node_supertypes(node, includeitself=False, skipbase=True): """ ...
random_line_split
ua_utils.py
""" Usefull method and classes not belonging anywhere and depending on opcua library """ from dateutil import parser from datetime import datetime from enum import Enum, IntEnum import uuid from opcua import ua from opcua.ua.uaerrors import UaError def val_to_string(val): """ convert a python object or pyth...
def string_to_val(string, vtype): """ Convert back a string to a python or python-opcua object Note: no error checking is done here, supplying null strings could raise exceptions (datetime and guid) """ string = string.strip() if string.startswith("["): string = string[1:-1] v...
""" convert a variant to a string which should be easy to understand for human easy to modify, and not too hard to parse back ....not easy meant for UI or command lines """ return val_to_string(var.Value)
identifier_body
ua_utils.py
""" Usefull method and classes not belonging anywhere and depending on opcua library """ from dateutil import parser from datetime import datetime from enum import Enum, IntEnum import uuid from opcua import ua from opcua.ua.uaerrors import UaError def val_to_string(val): """ convert a python object or pyth...
(string, vtype): """ convert back a string to an ua.Variant """ return ua.Variant(string_to_val(string, vtype), vtype) def get_node_children(node, nodes=None): """ Get recursively all children of a node """ if nodes is None: nodes = [node] for child in node.get_children(): ...
string_to_variant
identifier_name
ua_utils.py
""" Usefull method and classes not belonging anywhere and depending on opcua library """ from dateutil import parser from datetime import datetime from enum import Enum, IntEnum import uuid from opcua import ua from opcua.ua.uaerrors import UaError def val_to_string(val): """ convert a python object or pyth...
elif vtype in (ua.VariantType.SByte, ua.VariantType.Int16, ua.VariantType.Int32, ua.VariantType.Int64): val = int(string) elif vtype in (ua.VariantType.Byte, ua.VariantType.UInt16, ua.VariantType.UInt32, ua.VariantType.UInt64): val = int(string) elif vtype in (ua.VariantType.Float, ua.Varia...
val = False
conditional_block
datloader.py
""" Summary: Factory class for building the AUnits from an ISIS data file. This is used to read and build the parts of the ISIS dat file. Author: Duncan Runnacles Created: 01 Apr 2016 Copyright: Duncan Runnacles 2016 TODO: There are a few functions in here that should be made prote...
(self): """Getter for imported units Note: Deprecated: Will be removed. Please use self.units directly. Returns: IsisUnitCollection - The units loaded from the dat file. """ return self.units def updateSubContents(self): """Updates the self....
getUnits
identifier_name
datloader.py
""" Summary: Factory class for building the AUnits from an ISIS data file. This is used to read and build the parts of the ISIS dat file. Author: Duncan Runnacles Created: 01 Apr 2016 Copyright: Duncan Runnacles 2016 TODO: There are a few functions in here that should be made prote...
else: first_word = 'Nothing' if first_word in unit_vars: # If building an UnknownUnit then create and reset if(in_unknown_section == True): self.createUnknownSection() self.updateSubContents() ...
first_word = line.split()[0].strip()
conditional_block
datloader.py
""" Summary: Factory class for building the AUnits from an ISIS data file. This is used to read and build the parts of the ISIS dat file. Author: Duncan Runnacles Created: 01 Apr 2016 Copyright: Duncan Runnacles 2016 TODO: There are a few functions in here that should be made prote...
i += 1 self.unknown_data.append(self.contents[i].rstrip('\n')) in_unknown_section = True else: self.updateSubContents() in_unknown_section = False else: in_unknown_section = T...
self.unknown_data.append(self.contents[i].rstrip('\n'))
random_line_split
datloader.py
""" Summary: Factory class for building the AUnits from an ISIS data file. This is used to read and build the parts of the ISIS dat file. Author: Duncan Runnacles Created: 01 Apr 2016 Copyright: Duncan Runnacles 2016 TODO: There are a few functions in here that should be made prote...
""" Isis data file (.DAT) I/O methods. Factory for creating the .DAT file objects. Identifies different section of the .DAT file and creates objects of the different units. Also saves updated file. All unknown data within the file is contained within UnkownSection units. These read in the text...
identifier_body
app_test.py
import os import unittest os.environ['SIMULATE_HARDWARE'] = '1' os.environ['LOCK_SETTINGS_PATH'] = 'test-settings' import db from app import app primary_pin = '1234' sub_pin = '0000' class AppTestCase(unittest.TestCase): def setUp(self): app.testing = True self.app = app.test_client() d...
def test_sub_lock_unlock(self): self.login(sub_pin) rv = self.app.post('/lock', follow_redirects=True) assert b'Box has been locked for' in rv.data rv = self.app.post('/unlock', follow_redirects=True) assert b'Box is unlocked' in rv.data def test_primary_lock_and_sub_c...
self.login(primary_pin) rv = self.app.post('/lock', follow_redirects=True) assert b'Box has been locked for' in rv.data rv = self.app.post('/unlock', follow_redirects=True) assert b'Box is unlocked' in rv.data
identifier_body
app_test.py
import os import unittest os.environ['SIMULATE_HARDWARE'] = '1' os.environ['LOCK_SETTINGS_PATH'] = 'test-settings' import db from app import app primary_pin = '1234' sub_pin = '0000'
def setUp(self): app.testing = True self.app = app.test_client() db.read() db.clear() def test_empty_db(self): rv = self.app.get('/') assert b'Login' in rv.data def test_login_logout(self): rv = self.login('1234') assert b'Profile' in rv.data...
class AppTestCase(unittest.TestCase):
random_line_split
app_test.py
import os import unittest os.environ['SIMULATE_HARDWARE'] = '1' os.environ['LOCK_SETTINGS_PATH'] = 'test-settings' import db from app import app primary_pin = '1234' sub_pin = '0000' class AppTestCase(unittest.TestCase): def setUp(self): app.testing = True self.app = app.test_client() d...
unittest.main()
conditional_block
app_test.py
import os import unittest os.environ['SIMULATE_HARDWARE'] = '1' os.environ['LOCK_SETTINGS_PATH'] = 'test-settings' import db from app import app primary_pin = '1234' sub_pin = '0000' class AppTestCase(unittest.TestCase): def setUp(self): app.testing = True self.app = app.test_client() d...
(self): self.login(primary_pin) self.app.post('/lock', follow_redirects=True) self.logout() self.login(sub_pin) rv = self.app.post('/lock', follow_redirects=True) assert b'Already locked' in rv.data rv = self.app.post('/unlock', follow_redirects=True) # s...
test_primary_lock_and_sub_cant_unlock
identifier_name
__init__.py
# Copyright (c) 2012 CNRS # Author: Florent Lamiraux # # This file is part of hpp-corbaserver. # hpp-corbaserver is free software: you can redistribute it # and/or modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation, either version # 3 of the License, or (at...
import os ros_package_paths = os.environ["ROS_PACKAGE_PATH"].split(':') if path.startswith("package://"): relpath = path[len("package://"):] for dir in ros_package_paths: abspath = os.path.join(dir,relpath) if os.path.exists(abspath): return abspath ...
identifier_body
__init__.py
# Copyright (c) 2012 CNRS # Author: Florent Lamiraux # # This file is part of hpp-corbaserver. # hpp-corbaserver is free software: you can redistribute it # and/or modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation, either version # 3 of the License, or (at...
(path): import os ros_package_paths = os.environ["ROS_PACKAGE_PATH"].split(':') if path.startswith("package://"): relpath = path[len("package://"):] for dir in ros_package_paths: abspath = os.path.join(dir,relpath) if os.path.exists(abspath): return a...
retrieveRosResource
identifier_name
__init__.py
# Copyright (c) 2012 CNRS # Author: Florent Lamiraux # # This file is part of hpp-corbaserver. # hpp-corbaserver is free software: you can redistribute it # and/or modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation, either version # 3 of the License, or (at...
return IOError ("Could not find resource " + path) else: return path
abspath = os.path.join(dir,relpath) if os.path.exists(abspath): return abspath
conditional_block
__init__.py
# Copyright (c) 2012 CNRS # Author: Florent Lamiraux # # This file is part of hpp-corbaserver. # hpp-corbaserver is free software: you can redistribute it # and/or modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation, either version # 3 of the License, or (at...
return path
abspath = os.path.join(dir,relpath) if os.path.exists(abspath): return abspath return IOError ("Could not find resource " + path) else:
random_line_split
D3Chart.js
sap.ui.define([ "sap/ui/core/Control", "sap/ui/core/HTML", "sap/ui/core/ResizeHandler", "sap/ui/dom/jquery/rect" // provides jQuery.fn.rect ], function(Control, HTML, ResizeHandler) { "use strict"; return Control.extend("sap.ui.demo.toolpageapp.control.D3Chart", { metadata: { properties: { type: {type:...
}, renderer: { apiVersion: 2, /** * Renders the root div and the HTML aggregation * @param {sap.ui.core.RenderManger} oRM the render manager * @param {sap.ui.demo.toolpageapp.control.D3Chart} oControl the control to be rendered */ render: function (oRM, oControl) { oRM.openStart("div"...
{ // jQuery Plugin "rect" this._updateSVG($control.rect().width); }
conditional_block
D3Chart.js
sap.ui.define([ "sap/ui/core/Control", "sap/ui/core/HTML", "sap/ui/core/ResizeHandler", "sap/ui/dom/jquery/rect" // provides jQuery.fn.rect ], function(Control, HTML, ResizeHandler) { "use strict"; return Control.extend("sap.ui.demo.toolpageapp.control.D3Chart", { metadata: { properties: { type: {type:...
this._sContainerId = this.getId() + "--container"; this._iHeight = 130; this.setAggregation("_html", new HTML(this._sContainerId, { content: "<svg id=\"" + this._sContainerId + "\" width=\"100%\" height=\"130px\"></svg>" })); }, _onResize: function (oEvent) { this._updateSVG(oEvent.size.width); ...
random_line_split
highlight.js
/* Syntax highlighting with language autodetection. http://softwaremaniacs.org/soft/highlight/ */ var DEFAULT_LANGUAGES = ['python', 'ruby', 'perl', 'php', 'css', 'xml', 'html', 'django', 'javascript', 'java', 'cpp', 'sql', 'smalltalk']; var ALL_LANGUAGES = (DEFAULT_LANGUAGES.join(',') + ',' + ['1c', 'ada', 'elisp', '...
function highlight(value) { var index = 0; language.defaultMode.buffer = ''; do { var mode_info = eatModeChunk(value, index); processModeInfo(mode_info[0], mode_info[1], mode_info[2]); index += mode_info[0].length + mode_info[1].length; } while (!mode_info[2]); if(modes.length ...
{ if (end) { result += processKeywords(modes[modes.length - 1].buffer + buffer); return; }//if if (isIllegal(lexem)) throw 'Illegal'; var new_mode = subMode(lexem); if (new_mode) { modes[modes.length - 1].buffer += buffer; result += processKeywords(modes[modes.length - ...
identifier_body
highlight.js
/* Syntax highlighting with language autodetection. http://softwaremaniacs.org/soft/highlight/ */ var DEFAULT_LANGUAGES = ['python', 'ruby', 'perl', 'php', 'css', 'xml', 'html', 'django', 'javascript', 'java', 'cpp', 'sql', 'smalltalk']; var ALL_LANGUAGES = (DEFAULT_LANGUAGES.join(',') + ',' + ['1c', 'ada', 'elisp', '...
if (modes[modes.length - 1].excludeEnd) { result += processKeywords(modes[modes.length - 1].buffer) + '</span>' + lexem; } else { result += processKeywords(modes[modes.length - 1].buffer + lexem) + '</span>'; } while (end_level > 1) { result += '</span>'; end_leve...
if (end_level) { modes[modes.length - 1].buffer += buffer;
random_line_split
highlight.js
/* Syntax highlighting with language autodetection. http://softwaremaniacs.org/soft/highlight/ */ var DEFAULT_LANGUAGES = ['python', 'ruby', 'perl', 'php', 'css', 'xml', 'html', 'django', 'javascript', 'java', 'cpp', 'sql', 'smalltalk']; var ALL_LANGUAGES = (DEFAULT_LANGUAGES.join(',') + ',' + ['1c', 'ada', 'elisp', '...
(lexem) { if (!modes[modes.length - 1].illegalRe) return false; return modes[modes.length - 1].illegalRe.test(lexem); }//isIllegal function eatModeChunk(value, index) { if (!modes[modes.length - 1].terminators) { var terminators = []; if (modes[modes.length - 1].contains) for...
isIllegal
identifier_name
lib.rs
// rust-xmpp // Copyright (c) 2014 Florian Zeitz // Copyright (c) 2014 Allan SIMON // // This project is MIT licensed. // Please see the COPYING file for more information. #![crate_name = "xmpp"] #![crate_type = "lib"] #![feature(macro_rules)] extern crate serialize; extern crate xml; extern crate openssl; use ser...
{ ip: String, port: u16 } /// impl XmppServerListener { pub fn new( ip: &str, port: u16 ) -> XmppServerListener { XmppServerListener { ip: ip.to_string(), port: port } } pub fn listen(&mut self) { let listener = TcpListener::bin...
XmppServerListener
identifier_name
lib.rs
// rust-xmpp // Copyright (c) 2014 Florian Zeitz // Copyright (c) 2014 Allan SIMON // // This project is MIT licensed. // Please see the COPYING file for more information. #![crate_name = "xmpp"] #![crate_type = "lib"] #![feature(macro_rules)] extern crate serialize; extern crate xml; extern crate openssl; use ser...
} pub fn listen(&mut self) { let listener = TcpListener::bind( self.ip.as_slice(), self.port ); let mut acceptor= listener.listen().unwrap(); for opt_stream in acceptor.incoming() { spawn(proc() { let mut xmppStream = XmppServe...
random_line_split
table.ts
/// <reference path="../vendor/underscore.d.ts" /> /// <reference path="./promises/promises.ts" /> /// <reference path="./common.ts" /> module IndexedStorage { export module Table { export interface Info { ix: string[][]; ux: string[][]; key:string; } export class Structure { static factory( nam...
static factory():Changes { return new Changes(); } private items:ChangeSet[] = []; public list():ChangeSet[] { return this.items; } public add( name:string, cb:any ):Changes { this.items.push( { name: name, callback: cb } ); return this; } } export interface ChangeSet { n...
random_line_split
table.ts
/// <reference path="../vendor/underscore.d.ts" /> /// <reference path="./promises/promises.ts" /> /// <reference path="./common.ts" /> module IndexedStorage { export module Table { export interface Info { ix: string[][]; ux: string[][]; key:string; } export class Structure { static factory( nam...
return this.structure; } public structureId():string { return JSON.stringify( { i: this.indexes, u: this.uniques } ); } public getName():string { return this.name; } } export class Changes { static factory():Changes { return new Changes(); } private items:ChangeSet[] = ...
{ var struct:Info = { ux: [], ix: [], key: this.key }; _.each( {ix: this.indexes, ux: this.uniques}, function ( structure:any[], param?:string ):void { struct[param] = _.map( structure, function ( value:any ) { return _.isArray( value ) ? value : [value]; } ); } ); this.structur...
conditional_block
table.ts
/// <reference path="../vendor/underscore.d.ts" /> /// <reference path="./promises/promises.ts" /> /// <reference path="./common.ts" /> module IndexedStorage { export module Table { export interface Info { ix: string[][]; ux: string[][]; key:string; } export class Structure { static
( name:string, uniques:any[] = [], indexes:any[] = [], key:string = '' ):Structure { var structure:Structure = new Structure(); structure.name = name; structure.uniques = uniques; structure.indexes = indexes; structure.key = key; return structure; } // string:keyPath, '':autoIncrement, fa...
factory
identifier_name
traceback.rs
use libc::c_int; use object::*; use pyport::Py_ssize_t; use frameobject::PyFrameObject; #[repr(C)] #[derive(Copy, Clone)] pub struct
{ #[cfg(py_sys_config="Py_TRACE_REFS")] pub _ob_next: *mut PyObject, #[cfg(py_sys_config="Py_TRACE_REFS")] pub _ob_prev: *mut PyObject, pub ob_refcnt: Py_ssize_t, pub ob_type: *mut PyTypeObject, pub tb_next: *mut PyTracebackObject, pub tb_frame: *mut PyFrameObject, pub tb_lasti: c_i...
PyTracebackObject
identifier_name
traceback.rs
use libc::c_int; use object::*; use pyport::Py_ssize_t; use frameobject::PyFrameObject; #[repr(C)] #[derive(Copy, Clone)] pub struct PyTracebackObject { #[cfg(py_sys_config="Py_TRACE_REFS")] pub _ob_next: *mut PyObject, #[cfg(py_sys_config="Py_TRACE_REFS")] pub _ob_prev: *mut PyObject, pub ob_refcn...
pub unsafe fn PyTraceBack_Check(op : *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyTraceBack_Type) as c_int }
#[inline(always)]
random_line_split
main.rs
extern crate chrono; extern crate docopt; extern crate rustc_serialize; mod advanced_iterator; mod date; mod format; use advanced_iterator::AdvancedIterator; use date::dates; use format::layout_month; use docopt::Docopt; const USAGE: &'static str = " Calendar. Usage: calendar <year> [--months-per-line=<num>] ca...
{ let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); let calendar = dates(args.arg_year) .by_month() .map(layout_month) .chunk(args.flag_months_per_line) .map(...
identifier_body
main.rs
extern crate chrono; extern crate docopt; extern crate rustc_serialize; mod advanced_iterator; mod date; mod format; use advanced_iterator::AdvancedIterator; use date::dates; use format::layout_month; use docopt::Docopt; const USAGE: &'static str = " Calendar. Usage: calendar <year> [--months-per-line=<num>] ca...
"; #[derive(Debug, RustcDecodable)] struct Args { arg_year: i32, flag_months_per_line: usize } fn main() { let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); let calendar = dates(args.arg_year) .by_month...
--months-per-line=<num> Number of months per line [default: 3]
random_line_split
main.rs
extern crate chrono; extern crate docopt; extern crate rustc_serialize; mod advanced_iterator; mod date; mod format; use advanced_iterator::AdvancedIterator; use date::dates; use format::layout_month; use docopt::Docopt; const USAGE: &'static str = " Calendar. Usage: calendar <year> [--months-per-line=<num>] ca...
{ arg_year: i32, flag_months_per_line: usize } fn main() { let args: Args = Docopt::new(USAGE).and_then(|d| d.decode()) .unwrap_or_else(|e| e.exit()); let calendar = dates(args.arg_year) .by_month() .map(layout_month) ...
Args
identifier_name
packet.rs
use crate::err::AccessError; use sodiumoxide::crypto::box_; pub fn open<'packet>( packet: &'packet [u8], secret_key: &box_::SecretKey, public_key: &box_::PublicKey, ) -> Result<Vec<u8>, AccessError> { match box_::Nonce::from_slice(&packet[..box_::NONCEBYTES]) { Some(nonce) => box_::open( ...
( msg: &[u8], nonce: &box_::Nonce, secret_key: &box_::SecretKey, public_key: &box_::PublicKey, ) -> Vec<u8> { box_::seal(&msg, nonce, &public_key, &secret_key) }
create
identifier_name
packet.rs
use crate::err::AccessError; use sodiumoxide::crypto::box_; pub fn open<'packet>( packet: &'packet [u8], secret_key: &box_::SecretKey, public_key: &box_::PublicKey, ) -> Result<Vec<u8>, AccessError>
pub fn create( msg: &[u8], nonce: &box_::Nonce, secret_key: &box_::SecretKey, public_key: &box_::PublicKey, ) -> Vec<u8> { box_::seal(&msg, nonce, &public_key, &secret_key) }
{ match box_::Nonce::from_slice(&packet[..box_::NONCEBYTES]) { Some(nonce) => box_::open( &packet[box_::NONCEBYTES..], &nonce, &public_key, &secret_key, ) .map_err(|_| AccessError::InvalidCiphertext), None => Err(AccessError::InvalidNon...
identifier_body
packet.rs
use crate::err::AccessError; use sodiumoxide::crypto::box_;
pub fn open<'packet>( packet: &'packet [u8], secret_key: &box_::SecretKey, public_key: &box_::PublicKey, ) -> Result<Vec<u8>, AccessError> { match box_::Nonce::from_slice(&packet[..box_::NONCEBYTES]) { Some(nonce) => box_::open( &packet[box_::NONCEBYTES..], &nonce, ...
random_line_split
hero-detail.component.ts
//引入基本组件 import { Component,Input , OnInit} from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; import { Location } from '@angular/common'; //引入 Hero 类 import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ moduleId:module.id, selector:'my-hero-de...
}); } //返回按钮 goBack():void{ this.location.back(); } //保存按钮 save():void{ this.heroService.update(this.hero) .then( () => this.goBack()); } }
ero);
identifier_name
hero-detail.component.ts
//引入基本组件 import { Component,Input , OnInit} from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; import { Location } from '@angular/common'; //引入 Hero 类 import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ moduleId:module.id, selector:'my-hero-de...
e.getHeroById(id) .then(hero => this.hero = hero); }); } //返回按钮 goBack():void{ this.location.back(); } //保存按钮 save():void{ this.heroService.update(this.hero) .then( () => this.goBack()); } }
ervic
identifier_body
hero-detail.component.ts
//引入基本组件 import { Component,Input , OnInit} from '@angular/core'; import { ActivatedRoute, Params } from '@angular/router'; import { Location } from '@angular/common'; //引入 Hero 类 import { Hero } from './hero'; import { HeroService } from './hero.service'; @Component({ moduleId:module.id, selector:'my-hero-de...
//加载该组件,就根据url中的id查询hero ngOnInit():void{ this.route.params.forEach((params:Params) => { let id = +params['id']; this.heroService.getHeroById(id) .then(hero => this.hero = hero); }); } //返回按钮 goBack():void{ this.location.back(); }...
private location:Location ){ }
random_line_split
quick-evdev.rs
// This is a translation of the xkbcommon quick start guide: // https://xkbcommon.org/doc/current/md_doc_quick_guide.html extern crate evdev; extern crate xkbcommon; use xkbcommon::xkb; // evdev constants: const KEYCODE_OFFSET: u16 = 8; const KEY_STATE_RELEASE: i32 = 0; const KEY_STATE_REPEAT: i32 = 2; fn main()
{ // Open evdev device let mut device = evdev::Device::open( std::env::args() .nth(1) .unwrap_or(String::from("/dev/input/event0")), ) .unwrap(); // Create context let context = xkb::Context::new(xkb::CONTEXT_NO_FLAGS); // Load keymap informations let ke...
identifier_body
quick-evdev.rs
// This is a translation of the xkbcommon quick start guide: // https://xkbcommon.org/doc/current/md_doc_quick_guide.html extern crate evdev; extern crate xkbcommon; use xkbcommon::xkb; // evdev constants: const KEYCODE_OFFSET: u16 = 8; const KEY_STATE_RELEASE: i32 = 0; const KEY_STATE_REPEAT: i32 = 2; fn
() { // Open evdev device let mut device = evdev::Device::open( std::env::args() .nth(1) .unwrap_or(String::from("/dev/input/event0")), ) .unwrap(); // Create context let context = xkb::Context::new(xkb::CONTEXT_NO_FLAGS); // Load keymap informations let...
main
identifier_name
quick-evdev.rs
// This is a translation of the xkbcommon quick start guide: // https://xkbcommon.org/doc/current/md_doc_quick_guide.html
use xkbcommon::xkb; // evdev constants: const KEYCODE_OFFSET: u16 = 8; const KEY_STATE_RELEASE: i32 = 0; const KEY_STATE_REPEAT: i32 = 2; fn main() { // Open evdev device let mut device = evdev::Device::open( std::env::args() .nth(1) .unwrap_or(String::from("/dev/input/event0"...
extern crate evdev; extern crate xkbcommon;
random_line_split
quick-evdev.rs
// This is a translation of the xkbcommon quick start guide: // https://xkbcommon.org/doc/current/md_doc_quick_guide.html extern crate evdev; extern crate xkbcommon; use xkbcommon::xkb; // evdev constants: const KEYCODE_OFFSET: u16 = 8; const KEY_STATE_RELEASE: i32 = 0; const KEY_STATE_REPEAT: i32 = 2; fn main() { ...
; // Inspect state if state.mod_name_is_active(xkb::MOD_NAME_CTRL, xkb::STATE_MODS_EFFECTIVE) { print!("Control "); } if state.led_name_is_active(xkb::LED_NAME_NUM) { print!("NumLockLED"); } ...
{ state.update_key(keycode, xkb::KeyDirection::Down) }
conditional_block
types.py
# Lint as: python3
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
# Copyright 2020 The Bazel Authors. All rights reserved. #
random_line_split
types.py
# Lint as: python3 # Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
(Configuration): """Special marker for the host configuration. There's exactly one host configuration per build, so we shouldn't suggest merging it with other configurations. TODO(gregce): suggest host configuration trimming once we figure out the right criteria. Even if Bazel's not technically equipped to ...
HostConfiguration
identifier_name
types.py
# Lint as: python3 # Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
@dataclass(frozen=True) class HostConfiguration(Configuration): """Special marker for the host configuration. There's exactly one host configuration per build, so we shouldn't suggest merging it with other configurations. TODO(gregce): suggest host configuration trimming once we figure out the right crit...
"""Encapsulates a target + configuration + required fragments.""" # Label of the target this represents. label: str # Configuration this target is applied to. May be None. config: Optional[Configuration] # The hash of this configuration as reported by Bazel. config_hash: str # Fragments required by this c...
identifier_body
benchmark-dbg-insert.py
import argparse from goetia import libgoetia from goetia.dbg import dBG from goetia.hashing import StrandAware, FwdLemireShifter, CanLemireShifter from goetia.parsing import iter_fastx_inputs, get_fastx_args from goetia.storage import * from goetia.timer import measure_time parser = argparse.ArgumentParser() group = ...
else: storage = storage_t.build() graph = dBG[storage_t, hasher_t].build(storage, hasher) consumer = dBG[storage_t, hasher_t].Processor.build(graph, 100000) for sample, name in iter_fastx_inputs(args.inputs, args.pairing_mode): print(f'dBG type: {type(graph)}') ...
storage = storage_t.build(int(1e9), 4)
conditional_block
benchmark-dbg-insert.py
import argparse from goetia import libgoetia from goetia.dbg import dBG from goetia.hashing import StrandAware, FwdLemireShifter, CanLemireShifter from goetia.parsing import iter_fastx_inputs, get_fastx_args from goetia.storage import * from goetia.timer import measure_time parser = argparse.ArgumentParser()
group.add_argument('-i', dest='inputs', nargs='+', required=True) args = parser.parse_args() for storage_t in [SparseppSetStorage, PHMapStorage, BitStorage, BTreeStorage]: for hasher_t in [FwdLemireShifter, CanLemireShifter]: hasher = hasher_t(31) if storage_t is BitStorage: storage = ...
group = get_fastx_args(parser)
random_line_split
script.js
// Предпросмотр картинки при загрузке $(document).ready(function () { var filesCounter = 0; //publicity photos update validate checking $('#update-publicity-form').on('afterValidateAttribute', function (evt, attribute, messages) { if (attribute.name == 'photos[]') { if (messages.lengt...
unter++; if (filesCounter > 1) { return false; } $('#user-photoname').on('change', function () { handleFileSelect(event); }); } } }); }); function handleFileSelect(event) { var files = e...
os').remove(); return false; } else { filesCo
conditional_block
script.js
// Предпросмотр картинки при загрузке $(document).ready(function () { var filesCounter = 0; //publicity photos update validate checking $('#update-publicity-form').on('afterValidateAttribute', function (evt, attribute, messages) { if (attribute.name == 'photos[]') { if (messages.lengt...
$('#start_thumb').trigger('click'); }); // reloading page after croping picture. Default this plugin uses ajax. We don't need ajax $('#crop_thumb').on('click', function () { window.location.reload() }); });
$('#edit-thumbnail').on('click', function () {
random_line_split
script.js
// Предпросмотр картинки при загрузке $(document).ready(function () { var filesCounter = 0; //publicity photos update validate checking $('#update-publicity-form').on('afterValidateAttribute', function (evt, attribute, messages) { if (attribute.name == 'photos[]') { if (messages.lengt...
.target.files; $('.temp-photos').fadeOut('fast', function () { $(this).remove(); // $.Jcrop('#thumb').destroy(); // $('#thumb').empty(); }); for (var i = 0, file; file = files[i]; i++) { if (file.type === 'image/jpeg' || file.type === 'image/png') { var reader ...
ar files = event
identifier_name
script.js
// Предпросмотр картинки при загрузке $(document).ready(function () { var filesCounter = 0; //publicity photos update validate checking $('#update-publicity-form').on('afterValidateAttribute', function (evt, attribute, messages) { if (attribute.name == 'photos[]') { if (messages.lengt...
w at top $(document).ready(function () { var $searchOpen = $('#search-open'); var $searchClose = $('#search-close'); var $searchMenu = $('#search-menu'); $searchOpen.on('click', function () { $searchMenu.fadeIn("fast", "swing", function () { $searchOpen.css("cursor", "no-drop"); ...
files; $('.temp-photos').fadeOut('fast', function () { $(this).remove(); // $.Jcrop('#thumb').destroy(); // $('#thumb').empty(); }); for (var i = 0, file; file = files[i]; i++) { if (file.type === 'image/jpeg' || file.type === 'image/png') { var reader = new Fi...
identifier_body
stories.js
'use strict'; /** * Developed by Engagement Lab, 2019 * ============== * Route to retrieve data by url * @class api * @author Johnny Richardson * * ========== */ const keystone = global.keystone, mongoose = require('mongoose'), Bluebird = require('bluebird'); mongoose.Promise = require('bluebird'); let...
}, fields).limit(1); let prevPerson = list.findOne({ sortOrder: { $lt: results.jsonData.sortOrder } }, fields).sort({ sortOrder: -1 }).limit(1); // Poplulate next/prev and output response Bluebird.props({ next: nextPerson, prev: prevPerson ...
$gt: results.jsonData.sortOrder }
random_line_split
config.py
# =========================================================================== # eXe config # Copyright 2004-2006, University of Auckland # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; e...
# Otherwise find the most appropriate existing file if self.configPath is None: for confPath in configFileOptions: if confPath.isfile(): self.configPath = confPath break else: # If no config files ex...
envconf = Path(os.environ["EXECONF"]) if envconf.isfile(): self.configPath = os.environ["EXECONF"]
conditional_block
config.py
# =========================================================================== # eXe config # Copyright 2004-2006, University of Auckland # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; e...
if self.configParser.has_section('system'): system = self.configParser.system if system.has_option('appDataDir'): # Older config files had configDir stored as appDataDir self.configDir = Path(system.appDataDir) self.stylesDir =Path(sel...
random_line_split
config.py
# =========================================================================== # eXe config # Copyright 2004-2006, University of Auckland # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; e...
def _overrideDefaultVals(self): """ Override this to override the default config values """ def _getConfigPathOptions(self): """ Override this to give a list of possible config filenames in order of preference """ ...
""" Initialise """ self.configPath = None self.configParser = ConfigParser(self.onWrite) # Set default values # exePath is the whole path and filename of the exe executable self.exePath = Path(sys.argv[0]).abspath() # webDir is the parent direc...
identifier_body
config.py
# =========================================================================== # eXe config # Copyright 2004-2006, University of Auckland # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; e...
(self): """ setup logging file """ try: hdlr = RotatingFileHandler(self.configDir/'exe.log', 'a', 500000, 10) hdlr.doRollover() except OSError: # ignore the error we get if the log file is logged...
setupLogging
identifier_name
bluetoothpermissionresult.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResul...
pub fn get_state(&self) -> PermissionState { self.status.State() } #[allow(unrooted_must_root)] pub fn set_devices(&self, devices: Vec<Dom<BluetoothDevice>>) { *self.devices.borrow_mut() = devices; } } impl BluetoothPermissionResultMethods for BluetoothPermissionResult { // htt...
}
random_line_split
bluetoothpermissionresult.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResul...
(&self) -> PermissionName { self.status.get_query() } pub fn set_state(&self, state: PermissionState) { self.status.set_state(state) } pub fn get_state(&self) -> PermissionState { self.status.State() } #[allow(unrooted_must_root)] pub fn set_devices(&self, devices:...
get_query
identifier_name
bluetoothpermissionresult.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::BluetoothPermissionResul...
}
{ match response { // https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices // Step 3, 11, 13 - 14. BluetoothResponse::RequestDevice(device) => { self.set_state(PermissionState::Granted); let bluetooth = self.get_bluetooth()...
identifier_body
register.js
'use_strict'; /* * Model Names Register: * only registered model can have relations * * Relations register: * there must be some evidence of relations, to prevent duplicities, * and easy getting relation details, such as type, or constructor * */ var _models = {}; var _relations = {}; module.exports = { ...
if(_models[name]) throw new Error('Model with name "' +name+ '" already exists, choose another name.'); _models[name] = modelConstructor; }, /** * Quick check if model name is registered * @param {String} name model name * @returns {Boolean} true/false */ has: functi...
add: function(name, modelConstructor){
random_line_split
login.js
'use strict'; /** * @author walle <liaozhicheng.cn@163.com> */ module.exports = function(done) { // 获取当前登录用户(session 中的用户) $.router.get('/api/login_user', async function(req, res, next) { res.json({user: req.session.user, token: req.session.logout_token}); }); // 用户登录 $.router.post('/api/login', async...
eq.session.logout_token = $.utils.randomString(20); res.json({success: true, token: req.session.logout_token}); }); // 退出 $.router.get('/api/logout', async function(req, res, next) { if(req.session.logout_token && req.query.token !== req.session.logout_token) { return next(new Error('invalid token...
id password')); } req.session.user = user; r
conditional_block
login.js
'use strict'; /** * @author walle <liaozhicheng.cn@163.com> */ module.exports = function(done) { // 获取当前登录用户(session 中的用户) $.router.get('/api/login_user', async function(req, res, next) { res.json({user: req.session.user, token: req.session.logout_token}); }); // 用户登录 $.router.post('/api/login', async...
done(); }
random_line_split
rpc-proxy.spec.ts
import { expect } from 'chai'; import { of, throwError } from 'rxjs'; import * as sinon from 'sinon'; import { RpcProxy } from '../../context/rpc-proxy'; import { RpcException } from '../../exceptions/rpc-exception'; import { RpcExceptionsHandler } from '../../exceptions/rpc-exceptions-handler'; describe('RpcProxy', (...
it('should attach "catchError" operator when observable was returned', async () => { const expectation = handlerMock.expects('handle').once(); const proxy = routerProxy.create(async (client, data) => { return throwError(new RpcException('test')); }, handler); (await proxy(null, null...
expectation.verify(); });
random_line_split
wrapPicker.js
import _extends from 'babel-runtime/helpers/extends'; import _defineProperty from 'babel-runtime/helpers/defineProperty'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possib...
(_ref) { var showHour = _ref.showHour, showMinute = _ref.showMinute, showSecond = _ref.showSecond, use12Hours = _ref.use12Hours; var column = 0; if (showHour) { column += 1; } if (showMinute) { column += 1; } if (showSecond) { column += 1; ...
getColumns
identifier_name
wrapPicker.js
import _extends from 'babel-runtime/helpers/extends'; import _defineProperty from 'babel-runtime/helpers/defineProperty'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possib...
if (showSecond) { column += 1; } if (use12Hours) { column += 1; } return column; } export default function wrapPicker(Picker, defaultFormat) { return _a = function (_React$Component) { _inherits(PickerWrapper, _React$Component); function PickerWrapper() { ...
{ column += 1; }
conditional_block
wrapPicker.js
import _extends from 'babel-runtime/helpers/extends'; import _defineProperty from 'babel-runtime/helpers/defineProperty'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possib...
}, _a.defaultProps = { format: defaultFormat || 'YYYY-MM-DD', transitionName: 'slide-up', popupStyle: {}, onChange: function onChange() {}, onOk: function onOk() {}, onOpenChange: function onOpenChange() {}, locale: {}, prefixCls: 'ant-calendar', ...
antLocale: PropTypes.object
random_line_split
wrapPicker.js
import _extends from 'babel-runtime/helpers/extends'; import _defineProperty from 'babel-runtime/helpers/defineProperty'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _createClass from 'babel-runtime/helpers/createClass'; import _possibleConstructorReturn from 'babel-runtime/helpers/possib...
export default function wrapPicker(Picker, defaultFormat) { return _a = function (_React$Component) { _inherits(PickerWrapper, _React$Component); function PickerWrapper() { _classCallCheck(this, PickerWrapper); var _this = _possibleConstructorReturn(this, (PickerWrapper.__...
{ var showHour = _ref.showHour, showMinute = _ref.showMinute, showSecond = _ref.showSecond, use12Hours = _ref.use12Hours; var column = 0; if (showHour) { column += 1; } if (showMinute) { column += 1; } if (showSecond) { column += 1; } ...
identifier_body
urls.py
"""simpledrf URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-...
url(r'^admin/', admin.site.urls), url(r'^employee/', include('employee.urls')), ]
random_line_split
tables.component.ts
import { element } from 'protractor'; import { Team } from './../../../../models/team'; import { Component, OnInit } from '@angular/core'; import { TablesService } from './../../../services/api/tables.service'; import { Router, ActivatedRoute, Params } from '@angular/router'; @Component({ selector: 'app-tables', t...
() { history.go(-1); } }
goBack
identifier_name
tables.component.ts
import { element } from 'protractor'; import { Team } from './../../../../models/team'; import { Component, OnInit } from '@angular/core'; import { TablesService } from './../../../services/api/tables.service'; import { Router, ActivatedRoute, Params } from '@angular/router'; @Component({ selector: 'app-tables', t...
}
{ history.go(-1); }
identifier_body
tables.component.ts
import { element } from 'protractor'; import { Team } from './../../../../models/team'; import { Component, OnInit } from '@angular/core'; import { TablesService } from './../../../services/api/tables.service'; import { Router, ActivatedRoute, Params } from '@angular/router'; @Component({ selector: 'app-tables', t...
this.sub = this.activatedRoute.params.subscribe(params => { this.id = +params['id']; this.loading = true; this.service.get(this.id).subscribe( (table) => { table.forEach(team => { // parse teamID for teams team.teamId = +TablesComponent.getID(team._links...
ngOnInit() {
random_line_split
index-compiled.js
"use strict"; exports.__esModule = true; // istanbul ignore next var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value"...
return new ModuleFormatter(this); }; /** * [Please add a description.] */ File.prototype.parse = function parse(code) { var opts = this.opts; // var parseOpts = { highlightCode: opts.highlightCode, nonStandard: opts.nonStandard, sourceType: opts.sourceType, file...
{ throw new ReferenceError("Unknown module formatter type " + JSON.stringify(type)); }
conditional_block
index-compiled.js
"use strict"; exports.__esModule = true; // istanbul ignore next var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value"...
// istanbul ignore next function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } // istanbul ignore next function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ...
{ if (obj && obj.__esModule) { return obj; } else { var newObj = {};if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } }newObj["default"] = obj;return newObj; } }
identifier_body
index-compiled.js
"use strict"; exports.__esModule = true; // istanbul ignore next var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value"...
var secondaryStack = []; var stack = []; // build internal transformers for (var key in this.pipeline.transformers) { var transformer = this.pipeline.transformers[key]; var pass = transformers[key] = transformer.buildPass(file); if (pass.canTransform()) { stack.push(pass); ...
File.prototype.buildTransformers = function buildTransformers() { var file = this; var transformers = this.transformers = {};
random_line_split
index-compiled.js
"use strict"; exports.__esModule = true; // istanbul ignore next var _createClass = (function () { function
(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor); } }return function (...
defineProperties
identifier_name
paging.rs
//! Description of the data-structures for IA-32e paging mode. use core::fmt; /// Represent a virtual (linear) memory address #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct VAddr(usize); impl VAddr { /// Convert to `usize` pub const fn as_usize(&self) -> usize { self.0 }...
}
random_line_split
paging.rs
//! Description of the data-structures for IA-32e paging mode. use core::fmt; /// Represent a virtual (linear) memory address #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct VAddr(usize); impl VAddr { /// Convert to `usize` pub const fn as_usize(&self) -> usize { self.0 }...
(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) } } impl fmt::Octal for VAddr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) } } impl fmt::UpperHex for VAddr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(f) } }
fmt
identifier_name
packed-struct-vec.rs
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { let foos = [Foo { bar: 1, baz: 2 }, .. 10]; assert_eq!(sys::size_of::<[Foo, .. 10]>(), 90); for i in range(0u, 10) { assert_eq!(foos[i], Foo { bar: 1, baz: 2}); } for &foo in foos.iter() { assert_eq!(foo, Foo { bar: 1, baz: 2 }); } }
main
identifier_name