file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
LoadLinkView.js
/** * Created by mathabaws on 6/1/15. */ // LoadLinkView.js // // Load a specific view from a model that has a link specified for it. This is similar to LoadModel.js but without the // pre-canned set of models. This one will be passed a model URN and view GUID. // // Jim Awe // Autodesk, Inc. var _viewer = null; ...
() { console.log("Loaded viewer successfully with given asset..."); } function loadViewErrorFunc() { console.log("ERROR: could not load asset into viewer..."); } // load a particular viewable into the viewer function loadView(document, viewObj) { var path = document.getViewablePath(viewObj); console.l...
loadViewSuccessFunc
identifier_name
LoadLinkView.js
/** * Created by mathabaws on 6/1/15. */ // LoadLinkView.js // // Load a specific view from a model that has a link specified for it. This is similar to LoadModel.js but without the // pre-canned set of models. This one will be passed a model URN and view GUID. // // Jim Awe // Autodesk, Inc. var _viewer = null; ...
function getCurrentPagePathForLink() { var pathStr = window.location.pathname; pathStr = pathStr.slice(0, pathStr.lastIndexOf("/")); var linkStr = window.location.protocol + "//" + window.location.host + pathStr; return linkStr; } // we add a custom toolbar to the upper right so that we brand the view...
// setup for PRODUCTION var _viewerEnv = "AutodeskProduction"; var _myAuthToken = null; var modelUrn = null;
random_line_split
cpkb.js
(function (global) { if (global.cpkb == undefined) { global.cpkb = global.$c = {}; global.cpkb.app = global.$ca = {}; global.cpkb.locale = global.$cl = {}; //get resource text by key $cl.get = global.$clg = function (key) { if (key in cpkb.locale) { return cpkb...
progressOperationBeginEvent: "progressOperationBeginEvent", progressOperationEndEvent: "progressOperationEndEvent" }; $ca.page = { firstPageNumber: 1 }; $ca.validateCurrentUser = function (user) { if (!$ca.user || !$ca.user.userName() || $ca.user.isAuthenti...
random_line_split
cpkb.js
(function (global) { if (global.cpkb == undefined) {
serverUserAuthenticatedEvent: "server.notification.userAuthenticated", serverUserSignOutEvent: "server.notification.userSignOut", tokenUserCreated: "notification.tokenUserCreated", userAuthenticationRequired: "notification.userAuthenticationRequired", selecta...
global.cpkb = global.$c = {}; global.cpkb.app = global.$ca = {}; global.cpkb.locale = global.$cl = {}; //get resource text by key $cl.get = global.$clg = function (key) { if (key in cpkb.locale) { return cpkb.locale[key]; } return key; }; ...
conditional_block
test_success_message.py
from StringIO import StringIO from django.test import TestCase from django.test.client import Client from corehq.apps.app_manager.models import Application, APP_V1, Module from corehq.apps.app_manager.success_message import SuccessMessage from corehq.apps.domain.shortcuts import create_domain from corehq.apps.users.mod...
(userID=userID, username=self.username, xmlns=self.xmlns, time=None): submission = submission_template % { "userID": userID, "username": username, "xmlns": xmlns } f = StringIO(submission.encode('utf-8')) f.name = "tempfile....
fake_form_submission
identifier_name
test_success_message.py
from StringIO import StringIO from django.test import TestCase from django.test.client import Client from corehq.apps.app_manager.models import Application, APP_V1, Module from corehq.apps.app_manager.success_message import SuccessMessage from corehq.apps.domain.shortcuts import create_domain from corehq.apps.users.mod...
self.num_forms_today = 0 self.num_forms_this_week = 0 now = datetime.utcnow() tznow = now + self.tz week_start = tznow - timedelta(days=tznow.weekday()) week_start = datetime(week_start.year, week_start.month, week_start.day) - self.tz day_start = datetime(tznow...
submission = submission_template % { "userID": userID, "username": username, "xmlns": xmlns } f = StringIO(submission.encode('utf-8')) f.name = "tempfile.xml" kwargs = dict(HTTP_X_SUBMIT_TIME=json_format_datetime(time)) if t...
identifier_body
test_success_message.py
from StringIO import StringIO from django.test import TestCase from django.test.client import Client from corehq.apps.app_manager.models import Application, APP_V1, Module from corehq.apps.app_manager.success_message import SuccessMessage from corehq.apps.domain.shortcuts import create_domain from corehq.apps.users.mod...
couch_user.save() self.sm = SuccessMessage(self.message, userID, tz=self.tz) c = Client() app = Application.new_app(self.domain, "Test App", application_version=APP_V1) app.add_module(Module.new_module("Test Module", "en")) form = app.new_form(0, "Test Form", "en") ...
create_domain(self.domain) couch_user = CommCareUser.create(self.domain, self.username, self.password) userID = couch_user.user_id couch_user.first_name = self.first_name couch_user.last_name = self.last_name
random_line_split
test_success_message.py
from StringIO import StringIO from django.test import TestCase from django.test.client import Client from corehq.apps.app_manager.models import Application, APP_V1, Module from corehq.apps.app_manager.success_message import SuccessMessage from corehq.apps.domain.shortcuts import create_domain from corehq.apps.users.mod...
def testRender(self): self.assertEqual( self.sm.render(), ("Thanks {self.first_name} ({self.first_name} {self.last_name})! " "You have submitted {self.num_forms_today} forms today " "and {self.num_forms_this_week} forms since Monday.").format(self=self) ...
time = now-timedelta(hours=spacing*h) response = fake_form_submission(time=time) if time > week_start: self.num_forms_this_week += 1 if time > day_start: self.num_forms_today += 1 self.assertEqual( response.content, ...
conditional_block
blacklist.reducer.spec.ts
import { addBlacklistItem, BlacklistAction, setBlacklist, removeBlacklistItem, addBlacklistItems } from "./blacklist.actions" import { blacklist } from "./blacklist.reducer" import { BlacklistItem, BlacklistType } from "../../../../codeCharta.model" describe("blacklist", () => { const item: BlacklistItem = { type: Bl...
expect(result).toEqual([item, item]) }) it("should set default blacklist", () => { const result = blacklist([item, item], setBlacklist()) expect(result).toEqual([]) }) }) })
it("should set new blacklist", () => { const result = blacklist([], setBlacklist([item, item]))
random_line_split
json.ts
import viser from '../../../packages/viser/src/index'; import { data, scale } from './data' const DataSet = require('@antv/data-set');
.source(data) .transform({ type: 'percent', field: 'value', dimension: 'country', groupBy: ['year'], as: 'percent' }); viser({ data: dv.rows, scale: scale, axis: true, tooltip: true, legend: { dataKey: 'country', position: 'top-left', onItemMouseEnter: (ev) => { co...
const ds = new DataSet(); const dv = ds.createView()
random_line_split
json.ts
import viser from '../../../packages/viser/src/index'; import { data, scale } from './data' const DataSet = require('@antv/data-set'); const ds = new DataSet(); const dv = ds.createView() .source(data) .transform({ type: 'percent', field: 'value', dimension: 'country', groupBy: ['year'], as: 'p...
(ev, chart) { chart.hideTooltip(); } }, chart: { container: 'mount', forceFit: true, height: 400, padding: [100, 80, 80, 80], renderer: 'svg', onPlotdblclick: (ev: any, chart: any) => { chart.get('options').filters = {}; chart.repaint(); } }, });
onBrushMove
identifier_name
json.ts
import viser from '../../../packages/viser/src/index'; import { data, scale } from './data' const DataSet = require('@antv/data-set'); const ds = new DataSet(); const dv = ds.createView() .source(data) .transform({ type: 'percent', field: 'value', dimension: 'country', groupBy: ['year'], as: 'p...
, onBrushMove(ev, chart) { chart.hideTooltip(); } }, chart: { container: 'mount', forceFit: true, height: 400, padding: [100, 80, 80, 80], renderer: 'svg', onPlotdblclick: (ev: any, chart: any) => { chart.get('options').filters = {}; chart.repaint(); } }, });
{ chart.hideTooltip(); }
identifier_body
test.py
import sys, mapper def h(sig, id, f, timetag):
def setup(d): sig = d.add_input("/freq", 1, 'i', "Hz", None, None, h) print 'inputs',d.num_inputs print 'minimum',sig.minimum sig.minimum = 34.0 print 'minimum',sig.minimum sig.minimum = 12 print 'minimum',sig.minimum sig.minimum = None print 'minimum',sig.minimum print 'port'...
try: print sig.name, f except: print 'exception' print sig, f
identifier_body
test.py
import sys, mapper def h(sig, id, f, timetag): try: print sig.name, f except: print 'exception' print sig, f def
(d): sig = d.add_input("/freq", 1, 'i', "Hz", None, None, h) print 'inputs',d.num_inputs print 'minimum',sig.minimum sig.minimum = 34.0 print 'minimum',sig.minimum sig.minimum = 12 print 'minimum',sig.minimum sig.minimum = None print 'minimum',sig.minimum print 'port',d.port ...
setup
identifier_name
test.py
import sys, mapper def h(sig, id, f, timetag): try: print sig.name, f except: print 'exception' print sig, f def setup(d): sig = d.add_input("/freq", 1, 'i', "Hz", None, None, h) print 'inputs',d.num_inputs print 'minimum',sig.minimum sig.minimum = 34.0 print 'mini...
print 'link for /testsend.1, /testrecv.1:' print mon.db.get_link_by_src_dest_names("/testsend.1", "/testrecv.1") print 'not found link:' print mon.db.get_link_by_src_dest_names("/foo", "/bar") if i==500: mon.connect("/testsend.1/outsig_3", "/testrecv.1/insig_3", ...
print i
conditional_block
test.py
import sys, mapper def h(sig, id, f, timetag): try: print sig.name, f except: print 'exception' print sig, f def setup(d): sig = d.add_input("/freq", 1, 'i', "Hz", None, None, h) print 'inputs',d.num_inputs print 'minimum',sig.minimum sig.minimum = 34.0 print 'minim...
mon.modify({'src_name':"/testsend.1/outsig_3", 'dest_name':"/testrecv.1/insig_3", 'dest_max':[10,11,12,13], 'muted':True, 'mode': mapper.MO_LINEAR})
random_line_split
create-component.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor ==...
return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], func...
{ throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); }
conditional_block
create-component.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor ==...
(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) ...
_createClass
identifier_name
create-component.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor ==...
"use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.default = _default; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperti...
} })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
random_line_split
create-component.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor ==...
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Re...
{ if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
identifier_body
plugin.py
import logging from ..DataUploader import Plugin as DataUploaderPlugin from .reader import AndroidReader, AndroidStatsReader from ...common.interfaces import AbstractPlugin try: from volta.core.core import Core as VoltaCore except Exception: raise RuntimeError("Please install volta. https://github.com/yandex-...
except AttributeError: logger.error('Failed to read Volta config', exc_info=True) self.volta_core = VoltaCore(self.cfg) @staticmethod def get_key(): return __file__ def get_available_options(self): opts = ["volta_options"] return opts def configure...
logger.debug('Malformed VoltaConfig key: %s value %s', key, value) raise RuntimeError('Malformed VoltaConfig passed, key: %s. Should by dict' % key)
conditional_block
plugin.py
import logging from ..DataUploader import Plugin as DataUploaderPlugin from .reader import AndroidReader, AndroidStatsReader from ...common.interfaces import AbstractPlugin try: from volta.core.core import Core as VoltaCore except Exception: raise RuntimeError("Please install volta. https://github.com/yandex-...
self.volta_core.start_test() # FIXME raise/catch appropriate exception here except: # noqa: E722 logger.info('Failed to start test of Android plugin', exc_info=True) return 1 def is_test_finished(self): try: if hasattr(self.volta_core, 'phone...
try:
random_line_split
plugin.py
import logging from ..DataUploader import Plugin as DataUploaderPlugin from .reader import AndroidReader, AndroidStatsReader from ...common.interfaces import AbstractPlugin try: from volta.core.core import Core as VoltaCore except Exception: raise RuntimeError("Please install volta. https://github.com/yandex-...
class AndroidInfo(object): def __init__(self): self.address = '' self.port = 80 self.ammo_file = '' self.duration = 0 self.loop_count = 1 self.instances = 1 self.rps_schedule = ''
try: self.volta_core.post_process() # FIXME raise/catch appropriate exception here except: # noqa: E722 logger.error('Failed to complete post_process of Android plugin', exc_info=True) retcode = 1 return retcode
identifier_body
plugin.py
import logging from ..DataUploader import Plugin as DataUploaderPlugin from .reader import AndroidReader, AndroidStatsReader from ...common.interfaces import AbstractPlugin try: from volta.core.core import Core as VoltaCore except Exception: raise RuntimeError("Please install volta. https://github.com/yandex-...
(self): try: self.volta_core.start_test() # FIXME raise/catch appropriate exception here except: # noqa: E722 logger.info('Failed to start test of Android plugin', exc_info=True) return 1 def is_test_finished(self): try: if hasattr(se...
start_test
identifier_name
poll_module.py
"""Poll module is ungraded xmodule used by students to to do set of polls. On the client side we show: If student does not yet anwered - Question with set of choices. If student have answered - Question with statistics for each answers. """ import cgi import json import logging from copy import deepcopy from collecti...
(cls, xml_object, system): """Pull out the data into dictionary. Args: xml_object: xml from file. system: `system` object. Returns: (definition, children) - tuple definition - dict: { 'answers': <List of answer...
definition_from_xml
identifier_name
poll_module.py
"""Poll module is ungraded xmodule used by students to to do set of polls. On the client side we show: If student does not yet anwered - Question with set of choices. If student have answered - Question with statistics for each answers. """ import cgi import json import logging from copy import deepcopy from collecti...
module_class = PollModule @classmethod def definition_from_xml(cls, xml_object, system): """Pull out the data into dictionary. Args: xml_object: xml from file. system: `system` object. Returns: (definition, children) - tuple definiti...
class PollDescriptor(PollFields, MakoModuleDescriptor, XmlDescriptor): _tag_name = 'poll_question' _child_tag_name = 'answer'
random_line_split
poll_module.py
"""Poll module is ungraded xmodule used by students to to do set of polls. On the client side we show: If student does not yet anwered - Question with set of choices. If student have answered - Question with statistics for each answers. """ import cgi import json import logging from copy import deepcopy from collecti...
else: # return error message return json.dumps({'error': 'Unknown Command!'}) def get_html(self): """Renders parameters to template.""" params = { 'element_id': self.location.html_id(), 'element_class': self.location.category, ...
self.voted = False # FIXME: fix this, when xblock will support mutable types. # Now we use this hack. temp_poll_answers = self.poll_answers temp_poll_answers[self.poll_answer] -= 1 self.poll_answers = temp_poll_answers self.poll_answer = '' ...
conditional_block
poll_module.py
"""Poll module is ungraded xmodule used by students to to do set of polls. On the client side we show: If student does not yet anwered - Question with set of choices. If student have answered - Question with statistics for each answers. """ import cgi import json import logging from copy import deepcopy from collecti...
class PollModule(PollFields, XModule): """Poll Module""" js = { 'coffee': [resource_string(__name__, 'js/src/javascript_loader.coffee')], 'js': [resource_string(__name__, 'js/src/poll/logme.js'), resource_string(__name__, 'js/src/poll/poll.js'), resource_string(__name__,...
display_name = String(help="Display name for this module", scope=Scope.settings) voted = Boolean(help="Whether this student has voted on the poll", scope=Scope.user_state, default=False) poll_answer = String(help="Student answer", scope=Scope.user_state, default='') poll_answers = Dict(help="All possible a...
identifier_body
sensorimotor_experiment_runner.py
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as ...
sequence labels) """ sensorSequence = [] motorSequence = [] sensorimotorSequence = [] sequenceLabels = [] for _ in xrange(numSequences): for agent in agents: s,m,sm = agent.generateSensorimotorSequence(length, verbosity=verbosity) sensorSequence += s ...
random_line_split
sensorimotor_experiment_runner.py
Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as #...
(self, params): for k,v in params.iteritems(): if v == "Sorry": raise RuntimeError("Param "+k+" must be specified") def feedTransition(self, sensorPattern, motorPattern, sensorimotorPattern, tmLearn=True, tpLearn=None, sequenceLabel=None): if sensorPattern is None: s...
_checkParams
identifier_name
sensorimotor_experiment_runner.py
Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as #...
else: # Feed the TM self.tm.compute(sensorPattern, activeExternalCells=motorPattern, formInternalConnections=True, learn=tmLearn, sequenceLabel=sequenceLabel) # If requested, feed the TP if tpLearn is not None: tpInpu...
self.tm.reset() self.tp.reset()
conditional_block
sensorimotor_experiment_runner.py
Copyright (C) 2014, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as #...
def formatRow(self, x, formatString = "%d", rowSize = 700): """ Utility routine for pretty printing large vectors """ s = '' for c,v in enumerate(x): if c > 0 and c % 7 == 0: s += ' ' if c
""" Given an instance of the TM, format the information we need to send to the TP. """ # all currently active cells in layer 4 tpInputVector = numpy.zeros( self.tm.numberOfCells()).astype(realDType) tpInputVector[list(self.tm.activeCellsIndices())] = 1 # bursting columns i...
identifier_body
mergeIntervals.js
// Given a collection of intervals, merge all overlapping intervals. // For example, // Given [1,3],[2,6],[8,10],[15,18], // return [1,6],[8,10],[15,18]. /** * Definition for an interval. * function Interval(start, end) { * this.start = start; * this.end = end; * } */ /** * @param {Interval[]} inter...
//--------------------------------------------------------- var merge = function(intervals) { if( intervals.length < 1 ) return intervals; var start = [], end = []; for( var i=0; i<intervals.length; i++ ){ start.push( intervals[i].start ); end.push( intervals[i].end ); } ...
{ // 148 ms runtime if (!intervals.length) return intervals; intervals.sort((a, b) => a.start !== b.start ? a.start - b.start : a.end - b.end); var prev = intervals[0], res = [prev]; for (var curr of intervals) { if (curr.start <= prev.end) { prev.end = Math.max(prev.end, curr.end); } else ...
identifier_body
mergeIntervals.js
// Given a collection of intervals, merge all overlapping intervals. // For example, // Given [1,3],[2,6],[8,10],[15,18], // return [1,6],[8,10],[15,18]. /** * Definition for an interval. * function Interval(start, end) { * this.start = start; * this.end = end; * } */ /** * @param {Interval[]} inter...
// [ 1, 2, 8, 15 ] // [ 3, 6, 10, 18 ] return result; };
{ if( start[j] < end[k] ){ tempStart = Math.min(tempStart, start[j]); j++; } else { result.push( [tempStart, end[k+1]] ); tempStart = start[j]; k++; j++; } }
conditional_block
mergeIntervals.js
// Given a collection of intervals, merge all overlapping intervals. // For example, // Given [1,3],[2,6],[8,10],[15,18], // return [1,6],[8,10],[15,18]. /** * Definition for an interval. * function Interval(start, end) { * this.start = start; * this.end = end; * } */ /** * @param {Interval[]} inter...
(intervals) { // 148 ms runtime if (!intervals.length) return intervals; intervals.sort((a, b) => a.start !== b.start ? a.start - b.start : a.end - b.end); var prev = intervals[0], res = [prev]; for (var curr of intervals) { if (curr.start <= prev.end) { prev.end = Math.max(prev.end, curr.end);...
merge
identifier_name
mergeIntervals.js
// Given a collection of intervals, merge all overlapping intervals. // For example, // Given [1,3],[2,6],[8,10],[15,18], // return [1,6],[8,10],[15,18]. /** * Definition for an interval. * function Interval(start, end) { * this.start = start; * this.end = end; * } */
*/ function merge(intervals) { // 148 ms runtime if (!intervals.length) return intervals; intervals.sort((a, b) => a.start !== b.start ? a.start - b.start : a.end - b.end); var prev = intervals[0], res = [prev]; for (var curr of intervals) { if (curr.start <= prev.end) { prev.end = Math.max(p...
/** * @param {Interval[]} intervals * @return {Interval[]}
random_line_split
index.tsx
import * as React from "react"; import { connect } from "react-redux"; import { Col, Row, Page } from "../ui/index"; import { t } from "../i18next_wrapper"; import { Alerts } from "./alerts"; import { mapStateToProps } from "./state_to_props"; import { MessagesProps } from "./interfaces"; import { Link } from "../link"...
apiFirmwareValue={this.props.apiFirmwareValue} timeSettings={this.props.timeSettings} findApiAlertById={this.props.findApiAlertById} /> </Row> <Row> <div className="link-to-logs"> {this.props.alerts.length > 0 ? t("No more messages.") : t("No messa...
</Row> <Row> <Alerts alerts={this.props.alerts} dispatch={this.props.dispatch}
random_line_split
FSP3000R7NCU.py
###################################################################### # # FSP3000R7NCU object class # # Copyright (C) 2011 Russell Dwarshuis, Merit Network, Inc. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss.com/oss # ###############...
(FSP3000R7Component): """FSP3000R7NCU object""" portal_type = meta_type = 'FSP3000R7NCU' _relations = (("FSP3000R7Dev", ToOne(ToManyCont, "ZenPacks.Merit.AdvaFSP3000R7.FSP3000R7Device", "FSP3000R7Ncu")), ) InitializeClass(FSP300...
FSP3000R7NCU
identifier_name
FSP3000R7NCU.py
###################################################################### # # FSP3000R7NCU object class # # Copyright (C) 2011 Russell Dwarshuis, Merit Network, Inc. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss.com/oss # ###############...
"""FSP3000R7NCU object""" portal_type = meta_type = 'FSP3000R7NCU' _relations = (("FSP3000R7Dev", ToOne(ToManyCont, "ZenPacks.Merit.AdvaFSP3000R7.FSP3000R7Device", "FSP3000R7Ncu")), ) InitializeClass(FSP3000R7NCU)
import logging log = logging.getLogger('FSP3000R7NCU') class FSP3000R7NCU(FSP3000R7Component):
random_line_split
FSP3000R7NCU.py
###################################################################### # # FSP3000R7NCU object class # # Copyright (C) 2011 Russell Dwarshuis, Merit Network, Inc. # # This program can be used under the GNU General Public License version 2 # You can find full information here: http://www.zenoss.com/oss # ###############...
InitializeClass(FSP3000R7NCU)
"""FSP3000R7NCU object""" portal_type = meta_type = 'FSP3000R7NCU' _relations = (("FSP3000R7Dev", ToOne(ToManyCont, "ZenPacks.Merit.AdvaFSP3000R7.FSP3000R7Device", "FSP3000R7Ncu")), )
identifier_body
FilterSetUnit.test.tsx
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
() { const dropdownIcon = screen.getByRole('img', { name: 'ellipsis' }); userEvent.click(dropdownIcon); } const setup = (props: FilterSetUnitProps) => ( <Provider store={mockStore}> <FilterSetUnit {...props} /> </Provider> ); test('should render', () => { const mockedProps = createProps(); const { con...
openDropdown
identifier_name
FilterSetUnit.test.tsx
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
* * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the L...
* with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0
random_line_split
FilterSetUnit.test.tsx
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
const setup = (props: FilterSetUnitProps) => ( <Provider store={mockStore}> <FilterSetUnit {...props} /> </Provider> ); test('should render', () => { const mockedProps = createProps(); const { container } = render(setup(mockedProps)); expect(container).toBeInTheDocument(); }); test('should render the ...
{ const dropdownIcon = screen.getByRole('img', { name: 'ellipsis' }); userEvent.click(dropdownIcon); }
identifier_body
uniq-self-in-mut-slot.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 ...
impl Changer for X { fn change(mut self: Box<X>) -> Box<X> { self.a = 55; self } } pub fn main() { let x: Box<_> = box X { a: 32 }; let new_x = x.change(); assert_eq!(new_x.a, 55); }
fn change(self: Box<Self>) -> Box<Self>; }
random_line_split
uniq-self-in-mut-slot.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 x: Box<_> = box X { a: 32 }; let new_x = x.change(); assert_eq!(new_x.a, 55); }
identifier_body
uniq-self-in-mut-slot.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 ...
(mut self: Box<X>) -> Box<X> { self.a = 55; self } } pub fn main() { let x: Box<_> = box X { a: 32 }; let new_x = x.change(); assert_eq!(new_x.a, 55); }
change
identifier_name
debug_view_handler.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Request handler to display the debug view for a Failure.""" import jinja2 import os import sys import webapp2 from common import ispy_utils import view...
(webapp2.RequestHandler): """Request handler to display the debug view for a failure.""" def get(self): """Handles get requests to the /debug_view page. GET Parameters: test_run: The test run. expectation: The expectation name. """ test_run = self.request.get('test_run') expectatio...
DebugViewHandler
identifier_name
debug_view_handler.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Request handler to display the debug view for a Failure."""
import sys import webapp2 from common import ispy_utils import views JINJA = jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(views.__file__)), extensions=['jinja2.ext.autoescape']) class DebugViewHandler(webapp2.RequestHandler): """Request handler to display the debug view for a failur...
import jinja2 import os
random_line_split
debug_view_handler.py
# Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Request handler to display the debug view for a Failure.""" import jinja2 import os import sys import webapp2 from common import ispy_utils import view...
data['test_run'] = test_run data['expectation'] = expectation template = JINJA.get_template('debug_view.html') self.response.write(template.render(data))
"""Request handler to display the debug view for a failure.""" def get(self): """Handles get requests to the /debug_view page. GET Parameters: test_run: The test run. expectation: The expectation name. """ test_run = self.request.get('test_run') expectation = self.request.get('expect...
identifier_body
forms.py
from django.conf import settings from django.core import mail from django.test import RequestFactory from django.test import TestCase from django.contrib.sites.models import Site from contact_form.forms import ContactForm class ContactFormTests(TestCase): def test_request_required(self): """ Can...
(self): """ Valid form can and does in fact send email. """ request = RequestFactory().request() data = {'name': 'Test', 'email': 'test@example.com', 'message': 'Test message'} form = ContactForm(request=request, data=data) ...
test_send
identifier_name
forms.py
from django.conf import settings from django.core import mail from django.test import RequestFactory from django.test import TestCase from django.contrib.sites.models import Site from contact_form.forms import ContactForm class ContactFormTests(TestCase): def test_request_required(self): """ Can...
def test_valid_data_required(self): """ Can't try to build the message dict unless data is valid. """ request = RequestFactory().request() data = {'name': 'Test', 'body': 'Test message'} form = ContactForm(request=request, data=data) ...
random_line_split
forms.py
from django.conf import settings from django.core import mail from django.test import RequestFactory from django.test import TestCase from django.contrib.sites.models import Site from contact_form.forms import ContactForm class ContactFormTests(TestCase): def test_request_required(self):
def test_valid_data_required(self): """ Can't try to build the message dict unless data is valid. """ request = RequestFactory().request() data = {'name': 'Test', 'body': 'Test message'} form = ContactForm(request=request, data=data) ...
""" Can't instantiate without an HttpRequest. """ self.assertRaises(TypeError, ContactForm)
identifier_body
hashes.rs
//! Computing hashes for files. use crate::Result; use openssl::hash::{DigestBytes, Hasher, MessageDigest}; use std::io::{Read, Write}; #[derive(Debug)] pub struct
{ pub files: u64, pub bytes: u64, } // TODO: Reuse buffer and hasher for a given thread. pub(crate) fn hash_file<R: Read>(rd: &mut R) -> Result<DigestBytes> { let mut h = Hasher::new(MessageDigest::sha1())?; let mut buf = vec![0u8; 8192]; loop { let count = rd.read(&mut buf)?; if ...
Estimate
identifier_name
hashes.rs
//! Computing hashes for files. use crate::Result; use openssl::hash::{DigestBytes, Hasher, MessageDigest}; use std::io::{Read, Write}; #[derive(Debug)] pub struct Estimate { pub files: u64, pub bytes: u64, } // TODO: Reuse buffer and hasher for a given thread. pub(crate) fn hash_file<R: Read>(rd: &mut R) -> ...
use std::fs::{File, OpenOptions}; use std::io; use std::os::unix::fs::OpenOptionsExt; use std::path::Path; // From linux's fcntl.h, not exported in the libc crate. const O_NOATIME: i32 = 0o1000000; pub fn noatime_open(name: &Path) -> io::Result<File> { // Try opening it first with ...
#[cfg(target_os = "linux")] mod atime_impl {
random_line_split
hashes.rs
//! Computing hashes for files. use crate::Result; use openssl::hash::{DigestBytes, Hasher, MessageDigest}; use std::io::{Read, Write}; #[derive(Debug)] pub struct Estimate { pub files: u64, pub bytes: u64, } // TODO: Reuse buffer and hasher for a given thread. pub(crate) fn hash_file<R: Read>(rd: &mut R) -> ...
} // Other platforms, just use normal open. #[cfg(not(target_os = "linux"))] mod atime_impl { use std::fs::{File, OpenOptions}; use std::io; use std::path::Path; pub fn noatime_open(name: &Path) -> io::Result<File> { OpenOptions::new().read(true).open(name) } }
{ // Try opening it first with noatime, and if that fails, try the open // again without the option. match OpenOptions::new() .read(true) .custom_flags(O_NOATIME) .open(name) { Ok(f) => Ok(f), Err(_) => OpenOptions::new().read(t...
identifier_body
ConsignArtistAutosuggest.tsx
import Autosuggest from "react-autosuggest" import { useEffect } from "react"; import * as React from "react"; import { MagnifyingGlassIcon, Text, DROP_SHADOW, LabeledInput, } from "@artsy/palette" import { usePriceEstimateContext } from "./ConsignPriceEstimateContext" import { useTracking } from "react-trackin...
// eslint-disable-next-line react-hooks/exhaustive-deps }, [suggestions]) return ( <Autosuggest suggestions={suggestions ?? []} onSuggestionsClearRequested={x => x} // @ts-expect-error STRICT_NULL_CHECK onSuggestionsFetchRequested={() => fetchSuggestions(searchQuery)} onSugge...
{ debouncedTrackSearchWithNoResults() }
conditional_block
ConsignArtistAutosuggest.tsx
import Autosuggest from "react-autosuggest" import { useEffect } from "react"; import * as React from "react"; import { MagnifyingGlassIcon, Text, DROP_SHADOW, LabeledInput, } from "@artsy/palette" import { usePriceEstimateContext } from "./ConsignPriceEstimateContext" import { useTracking } from "react-trackin...
theme={{ container: { width: "100%", }, suggestionsContainer: { boxShadow: DROP_SHADOW, marginTop: "4px", }, }} /> ) } const AutosuggestInput: React.FC = props => { return ( <LabeledInput spellCheck={false} label={<Magnif...
onFocus: trackFocusedOnSearchInput, placeholder: "Search by artist name", value: searchQuery, }}
random_line_split
test_match_without_extension.py
#!/usr/bin/env python3 # encoding: utf-8 from nose import with_setup from tests.utils import * @with_setup(usual_setup_func, usual_teardown_func) def test_negative(): create_file('xxx', 'b.png') create_file('xxx', 'a.png') create_file('xxx', 'a')
@with_setup(usual_setup_func, usual_teardown_func) def test_positive(): create_file('xxx', 'a.png') create_file('xxx', 'a.jpg') head, *data, footer = run_rmlint('-i') assert footer['total_files'] == 2 assert footer['total_lint_size'] == 3 assert footer['duplicates'] == 1
head, *data, footer = run_rmlint('-i') assert footer['total_files'] == 3 assert footer['total_lint_size'] == 0 assert footer['duplicates'] == 0
random_line_split
test_match_without_extension.py
#!/usr/bin/env python3 # encoding: utf-8 from nose import with_setup from tests.utils import * @with_setup(usual_setup_func, usual_teardown_func) def test_negative(): create_file('xxx', 'b.png') create_file('xxx', 'a.png') create_file('xxx', 'a') head, *data, footer = run_rmlint('-i') assert footer...
create_file('xxx', 'a.png') create_file('xxx', 'a.jpg') head, *data, footer = run_rmlint('-i') assert footer['total_files'] == 2 assert footer['total_lint_size'] == 3 assert footer['duplicates'] == 1
identifier_body
test_match_without_extension.py
#!/usr/bin/env python3 # encoding: utf-8 from nose import with_setup from tests.utils import * @with_setup(usual_setup_func, usual_teardown_func) def test_negative(): create_file('xxx', 'b.png') create_file('xxx', 'a.png') create_file('xxx', 'a') head, *data, footer = run_rmlint('-i') assert footer...
(): create_file('xxx', 'a.png') create_file('xxx', 'a.jpg') head, *data, footer = run_rmlint('-i') assert footer['total_files'] == 2 assert footer['total_lint_size'] == 3 assert footer['duplicates'] == 1
test_positive
identifier_name
ShaderWater.js
uv;", "vec2 uvTimeShift = vUV + vec2( 1.1, 1.9 ) * time * 0.15;", // bumpSpeed;", "vec4 bumpData = texture2D( noiseTexture, uvTimeShift );", "float displacement = bumpData.g * 50.0;", // bumpScale "vec3 bumpedPosition = position + normal * displacement;", "vec4 mvP...
; options = options || {}; this.matrixNeedsUpdate = true; var width = options.textureWidth !== undefined ? options.textureWidth : 512; var height = options.textureHeight !== undefined ? options.textureHeight : 512; this.clipBias = options.clipBias !== undefined ? options.clipBias : 0.0; var mirrorColor...
{ return ( value & ( value - 1 ) ) === 0; }
identifier_body
ShaderWater.js
uv;", "vec2 uvTimeShift = vUV + vec2( 1.1, 1.9 ) * time * 0.15;", // bumpSpeed;", "vec4 bumpData = texture2D( noiseTexture, uvTimeShift );", "float displacement = bumpData.g * 50.0;", // bumpScale "vec3 bumpedPosition = position + normal * displacement;", "vec4 mvP...
if ( camera instanceof THREE.PerspectiveCamera ) this.camera = camera; else { this.camera = new THREE.PerspectiveCamera(); console.log(this.name + ': camera is not a Perspective Camera!') } this.textureMatrix = new THREE.Matrix4(); this.mirrorCamera = this.camera.clone(); this.texture = new...
{ var arrow = new THREE.ArrowHelper(new THREE.Vector3( 0, 0, 1 ), new THREE.Vector3( 0, 0, 0 ), 10, 0xffff80 ); var planeGeometry = new THREE.Geometry(); planeGeometry.vertices.push( new THREE.Vector3( -10, -10, 0 ) ); planeGeometry.vertices.push( new THREE.Vector3( 10, -10, 0 ) ); planeGeometry.ver...
conditional_block
ShaderWater.js
= uv;", "vec2 uvTimeShift = vUV + vec2( 1.1, 1.9 ) * time * 0.15;", // bumpSpeed;", "vec4 bumpData = texture2D( noiseTexture, uvTimeShift );", "float displacement = bumpData.g * 50.0;", // bumpScale "vec3 bumpedPosition = position + normal * displacement;", "vec4 m...
( value ) { return ( value & ( value - 1 ) ) === 0; }; options = options || {}; this.matrixNeedsUpdate = true; var width = options.textureWidth !== undefined ? options.textureWidth : 512; var height = options.textureHeight !== undefined ? options.textureHeight : 512; this.clipBias = options.clipBia...
isPowerOfTwo
identifier_name
ShaderWater.js
= uv;", "vec2 uvTimeShift = vUV + vec2( 1.1, 1.9 ) * time * 0.15;", // bumpSpeed;", "vec4 bumpData = texture2D( noiseTexture, uvTimeShift );", "float displacement = bumpData.g * 50.0;", // bumpScale "vec3 bumpedPosition = position + normal * displacement;", "vec4 m...
this.time = options.time !== undefined ? options.time : 0.0; this.renderer = renderer; this.mirrorPlane = new THREE.Plane(); this.normal = new THREE.Vector3( 0, 0, 1 ); this.mirrorWorldPosition = new THREE.Vector3(); this.cameraWorldPosition = new THREE.Vector3(); this.rotationMatrix = new THREE.Matrix...
this.baseSpeed = options.baseSpeed !== undefined ? options.baseSpeed : 0.5; this.noiseTexture = options.noiseTexture !== undefined ? options.noiseTexture : null; this.noiseScale = options.noiseScale !== undefined ? options.noiseScale : 0.5337; this.alpha = options.alpha !== undefined ? options.alpha : 1.0;
random_line_split
taz_files.py
import csv import osgeo.ogr from osgeo import ogr, osr EPSG_LAT_LON = 4326 def read_tazs_from_csv(csv_zone_locs_fname): taz_tuples = [] tfile = open(csv_zone_locs_fname, 'rb') treader = csv.reader(tfile, delimiter=',', quotechar="'") for ii, row in enumerate(treader): if ii == 0: continue ...
(shp_zone_locs_fname): taz_tuples = [] tazs_shp = osgeo.ogr.Open(shp_zone_locs_fname) tazs_layer = tazs_shp.GetLayer(0) src_srs = tazs_layer.GetSpatialRef() target_srs = osr.SpatialReference() target_srs.ImportFromEPSG(EPSG_LAT_LON) transform_to_lat_lon = osr.CoordinateTransformation(src_srs...
read_tazs_from_shp
identifier_name
taz_files.py
import csv import osgeo.ogr from osgeo import ogr, osr EPSG_LAT_LON = 4326 def read_tazs_from_csv(csv_zone_locs_fname): taz_tuples = [] tfile = open(csv_zone_locs_fname, 'rb') treader = csv.reader(tfile, delimiter=',', quotechar="'") for ii, row in enumerate(treader): if ii == 0: continue ...
target_srs) for taz_feat in tazs_layer: taz_id = taz_feat.GetField("N") taz_geom = taz_feat.GetGeometryRef() taz_geom.Transform(transform_to_lat_lon) taz_lat = taz_geom.GetX() taz_lon = taz_geom.GetY() taz_tuples.append((taz_id, taz_lat, taz_lon)) taz_...
random_line_split
taz_files.py
import csv import osgeo.ogr from osgeo import ogr, osr EPSG_LAT_LON = 4326 def read_tazs_from_csv(csv_zone_locs_fname): taz_tuples = [] tfile = open(csv_zone_locs_fname, 'rb') treader = csv.reader(tfile, delimiter=',', quotechar="'") for ii, row in enumerate(treader): if ii == 0: continue ...
taz_tuples = [] tazs_shp = osgeo.ogr.Open(shp_zone_locs_fname) tazs_layer = tazs_shp.GetLayer(0) src_srs = tazs_layer.GetSpatialRef() target_srs = osr.SpatialReference() target_srs.ImportFromEPSG(EPSG_LAT_LON) transform_to_lat_lon = osr.CoordinateTransformation(src_srs, target_srs) f...
identifier_body
taz_files.py
import csv import osgeo.ogr from osgeo import ogr, osr EPSG_LAT_LON = 4326 def read_tazs_from_csv(csv_zone_locs_fname): taz_tuples = [] tfile = open(csv_zone_locs_fname, 'rb') treader = csv.reader(tfile, delimiter=',', quotechar="'") for ii, row in enumerate(treader):
return taz_tuples def read_tazs_from_shp(shp_zone_locs_fname): taz_tuples = [] tazs_shp = osgeo.ogr.Open(shp_zone_locs_fname) tazs_layer = tazs_shp.GetLayer(0) src_srs = tazs_layer.GetSpatialRef() target_srs = osr.SpatialReference() target_srs.ImportFromEPSG(EPSG_LAT_LON) transform_to_...
if ii == 0: continue else: taz_tuple = (row[0], row[1], row[2]) taz_tuples.append(taz_tuple)
conditional_block
scripts-transform.ts
/** * Copyright 2020 The AMP HTML 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 require...
const url = tryGetUrl(script.attrs.src || ''); const parsedPath = parse(url.pathname); const src = CDNURLToLocalHostRelativeAbsoluteDist(url, [null, null], parsedPath.ext, options.port, options.useMaxNames) .toString(); script.attrs.src = src; return script; } /** * Replace the src for every script ...
{ return script; }
conditional_block
scripts-transform.ts
/** * Copyright 2020 The AMP HTML 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 require...
* For any script, with a valid path to AMP Project CDN, replace it with a local value. * @param script */ function modifySrc(script: posthtml.Node, options: OptionSet): posthtml.Node { // Make sure that isJsonScript is used before `isValidScript`. We bail out // early if the ScriptNode is of type="application/js...
/**
random_line_split
scripts-transform.ts
/** * Copyright 2020 The AMP HTML 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 require...
/** * Replace the src for every script tag to the local value. */ export default function(options: OptionSet = {}): (tree: posthtml.Node) => void { return function(tree: posthtml.Node) { tree.match({tag: 'script'}, (script) => { return modifySrc(script, options); }); } }
{ // Make sure that isJsonScript is used before `isValidScript`. We bail out // early if the ScriptNode is of type="application/json" since it wouldn't // have any src url to modify. if (isJsonScript(script)) { return script; } if (!isValidScript(script, options.looseScriptSrcCheck)) { return scrip...
identifier_body
scripts-transform.ts
/** * Copyright 2020 The AMP HTML 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 require...
(script: posthtml.Node, options: OptionSet): posthtml.Node { // Make sure that isJsonScript is used before `isValidScript`. We bail out // early if the ScriptNode is of type="application/json" since it wouldn't // have any src url to modify. if (isJsonScript(script)) { return script; } if (!isValidScri...
modifySrc
identifier_name
mc.py
MetSequenceMuEGReClean.remove(process.selectedPatJetsForMetT1T2CorrMuEGReClean) # metSequence += process.fullPatMetSequence # THIS FUNCTION IS BUGGY # from PhysicsTools.PatUtils.tools.eGammaCorrection import eGammaCorrection from PandaProd.Producer.utils.eGammaCorrection import eGammaCorrection #...
process.slimmedJets = updatedPatJets.clone( jetSource = cms.InputTag('slimmedJets', '', cms.InputTag.skipCurrentProcess()), addJetCorrFactors = cms.bool(True),
random_line_split
mc.py
metType = 'Puppi', slimmedJetsPuppi is automatically selected as the jet source for type 1 runMetCorAndUncFromMiniAOD( process, isData = options.isData, metType = 'Puppi', pfCandColl = 'puppiForMET', recoMetFromPFCs = True, jetFlavor = 'AK4PFPuppi', postfix = 'Puppi' ) # There is a bug in a...
process.load('PhysicsTools.JetMCAlgos.HadronAndPartonSelector_cfi') from PhysicsTools.JetMCAlgos.AK4PFJetsMCFlavourInfos_cfi import ak4JetFlavourInfos process.selectedHadronsAndPartons.particles = 'prunedGenParticles' process.ak4GenJetFlavourInfos = ak4JetFlavourInfos.clone( jets = 'slimmedGenJets...
conditional_block
WebServer.py
''' Kurgan AI Web Application Security Analyzer. http://www.kurgan.com.br/ Author: Glaudson Ocampos - <glaudson@vortexai.com.br> Created in May, 11th 2016. ''' import db.db as db import config as cf class WebServer(object): banner = None os = None server = None framework = None version = None ...
(self, val): self.cookie = val def get_cookie(self): return self.cookie def set_has_javascript(self, val): self.has_javascript = val def get_has_javascript(self): return self.has_javascript def check_extension(self): if self.extension is 'html': ...
set_cookie
identifier_name
WebServer.py
''' Kurgan AI Web Application Security Analyzer. http://www.kurgan.com.br/ Author: Glaudson Ocampos - <glaudson@vortexai.com.br> Created in May, 11th 2016. ''' import db.db as db import config as cf class WebServer(object): banner = None os = None server = None framework = None version = None ...
def check_server(self): #server_possibles = {"nginx", "Apache", "Tomcat", "JBoss", "IIS", "X-Varnish"} mydb = db.DB(); query = "SELECT DISTINCT name FROM server" database = cf.DB_WEBSERVERS servers_in_database = mydb.getData(query,database) server_possibles ...
break
random_line_split
WebServer.py
''' Kurgan AI Web Application Security Analyzer. http://www.kurgan.com.br/ Author: Glaudson Ocampos - <glaudson@vortexai.com.br> Created in May, 11th 2016. ''' import db.db as db import config as cf class WebServer(object): banner = None os = None server = None framework = None version = None ...
def get_server(self): return self.server def set_version(self,val): self.version = val def get_version(self): return self.version def set_options(self,val): self.options = val def get_options(self): return self.options def check_os(self...
self.server = val
identifier_body
WebServer.py
''' Kurgan AI Web Application Security Analyzer. http://www.kurgan.com.br/ Author: Glaudson Ocampos - <glaudson@vortexai.com.br> Created in May, 11th 2016. ''' import db.db as db import config as cf class WebServer(object): banner = None os = None server = None framework = None version = None ...
def check_version(self): if self.server is None: return None else: mydb = db.DB(); name = self.server; query = "SELECT DISTINCT version FROM server WHERE name='" + name + "'" database = cf.DB_WEBSERVERS server...
for i in j: if i in self.banner: self.server = i break
conditional_block
copy-dialog.js
(function() { var CopyDialog, Dialog, fs, path, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new cto...
(initialPath) { this.initialPath = initialPath; CopyDialog.__super__.constructor.call(this, { prompt: 'Enter the new path for the duplicate.', initialPath: atom.project.relativize(this.initialPath), select: true, iconClass: 'icon-arrow-right' }); } CopyDialog.p...
CopyDialog
identifier_name
copy-dialog.js
(function() { var CopyDialog, Dialog, fs, path, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new cto...
activeEditor = atom.workspace.getActiveEditor(); if ((activeEditor != null ? activeEditor.getPath() : void 0) !== this.initialPath) { activeEditor = null; } try { if (fs.isDirectorySync(this.initialPath)) { fs.copySync(this.initialPath, newPath); } else { ...
{ this.showError("'" + newPath + "' already exists."); return; }
conditional_block
copy-dialog.js
(function() { var CopyDialog, Dialog, fs, path, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor()
ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; path = require('path'); fs = require('fs-plus'); Dialog = require('./dialog'); module.exports = CopyDialog = (function(_super) { __extends(CopyDialog, _super); function CopyDialog(...
{ this.constructor = child; }
identifier_body
copy-dialog.js
(function() { var CopyDialog, Dialog, fs, path, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new cto...
})(Dialog); }).call(this);
random_line_split
iconButtonClasses.ts
import { generateUtilityClass, generateUtilityClasses } from '@mui/base'; export interface IconButtonClasses { /** Styles applied to the root element. */ root: string; /** Styles applied to the root element if `edge="start"`. */ edgeStart: string; /** Styles applied to the root element if `edge="end"`. */ ...
'sizeSmall', 'sizeMedium', 'sizeLarge', ]); export default iconButtonClasses;
random_line_split
iconButtonClasses.ts
import { generateUtilityClass, generateUtilityClasses } from '@mui/base'; export interface IconButtonClasses { /** Styles applied to the root element. */ root: string; /** Styles applied to the root element if `edge="start"`. */ edgeStart: string; /** Styles applied to the root element if `edge="end"`. */ ...
const iconButtonClasses: IconButtonClasses = generateUtilityClasses('MuiIconButton', [ 'root', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'edgeStart', 'edgeEnd', 'sizeSmall', 'sizeMedium', 'sizeLarge', ]); export default iconButtonClasses;
{ return generateUtilityClass('MuiIconButton', slot); }
identifier_body
iconButtonClasses.ts
import { generateUtilityClass, generateUtilityClasses } from '@mui/base'; export interface IconButtonClasses { /** Styles applied to the root element. */ root: string; /** Styles applied to the root element if `edge="start"`. */ edgeStart: string; /** Styles applied to the root element if `edge="end"`. */ ...
(slot: string): string { return generateUtilityClass('MuiIconButton', slot); } const iconButtonClasses: IconButtonClasses = generateUtilityClasses('MuiIconButton', [ 'root', 'disabled', 'colorInherit', 'colorPrimary', 'colorSecondary', 'edgeStart', 'edgeEnd', 'sizeSmall', 'sizeMedium', 'sizeLarge...
getIconButtonUtilityClass
identifier_name
mdl-layout-header.component.ts
import { Component, ElementRef, Renderer, ViewEncapsulation, QueryList, Inject, forwardRef } from '@angular/core'; import { MdlLayoutTabPanelComponent } from './mdl-layout-tab-panel.component'; import { MdlAnchorRippleDirective } from './../common/mdl-ripple.directive'; import { MdlLayoutComponent } from ...
( private elementRef: ElementRef, private renderer: Renderer, @Inject(forwardRef(() => MdlLayoutComponent)) private mdlLayout: MdlLayoutComponent) { this.el = elementRef.nativeElement; } protected onTransitionEnd() { this.isAnimating = false; } protected onClick() { if (this.isCompact)...
constructor
identifier_name
mdl-layout-header.component.ts
import { Component, ElementRef, Renderer, ViewEncapsulation, QueryList, Inject, forwardRef } from '@angular/core'; import { MdlLayoutTabPanelComponent } from './mdl-layout-tab-panel.component'; import { MdlAnchorRippleDirective } from './../common/mdl-ripple.directive';
@Component({ selector: 'mdl-layout-header', host: { '[class.mdl-layout__header]': 'true', '[class.is-casting-shadow]': 'mode==="standard" || isCompact', '[class.mdl-layout__header--seamed]': 'isSeamed', '[class.mdl-layout__header--waterfall]': 'mode==="waterfall"', '[class.mdl-layout__header--s...
import { MdlLayoutComponent } from './mdl-layout.component';
random_line_split
mdl-layout-header.component.ts
import { Component, ElementRef, Renderer, ViewEncapsulation, QueryList, Inject, forwardRef } from '@angular/core'; import { MdlLayoutTabPanelComponent } from './mdl-layout-tab-panel.component'; import { MdlAnchorRippleDirective } from './../common/mdl-ripple.directive'; import { MdlLayoutComponent } from ...
} }
{ this.isCompact = false; this.isAnimating = true; }
conditional_block
package_source.rs
// Copyright 2012-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-MI...
(src_dir: &Path, dst_dir: &Path, id: &PkgId) -> PkgSrc { PkgSrc { root: copy *src_dir, dst_dir: copy *dst_dir, id: copy *id, libs: ~[], mains: ~[], tests: ~[], benchs: ~[] } } fn check_dir(&se...
new
identifier_name
package_source.rs
// Copyright 2012-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-MI...
} /// True if the given path's stem is self's pkg ID's stem /// or if the pkg ID's stem is <rust-foo> and the given path's /// stem is foo /// Requires that dashes in p have already been normalized to /// underscores fn stem_matches(&self, p: &Path) -> bool { let self_id = self.id....
{ None }
conditional_block
package_source.rs
// Copyright 2012-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-MI...
pth), _ => () } } if self.libs.is_empty() && self.mains.is_empty() && self.tests.is_empty() && self.benchs.is_empty() { note("Couldn't infer any crates to build.\n\ Try ...
{ use conditions::missing_pkg_files::cond; let dir = self.check_dir(); debug!("Called check_dir, I'm in %s", dir.to_str()); let prefix = dir.components.len(); debug!("Matching against %?", self.id.local_path.filestem()); for os::walk_dir(&dir) |pth| { match p...
identifier_body
package_source.rs
// Copyright 2012-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-MI...
self.tests.len(), self.benchs.len()) } fn build_crates(&self, ctx: &Ctx, dst_dir: &Path, src_dir: &Path, crates: &[Crate], cfgs: &[~str], what: OutputType) { ...
self.mains.len(),
random_line_split
vector.ts
/* Project: Golden Author: Copyright (C) 2015, Atanas Laskov License: BSD license, see LICENSE for more details. http://www.atanaslaskov.com/golden/ */ // Cartesian 2d coordinate (x;y) // class Vector{ public x: number; public y: number; constructor(x:number =0.0, y:number =0.0) { this.x = x; ...
static plus(a: Vector, b: Vector): Vector { return new Vector( a.x+b.x, a.y+b.y ); } static minus(a: Vector, b: Vector): Vector { return new Vector( a.x-b.x, a.y-b.y ); } static scale(v: Vector, n: number) { return new Vector( v.x*n, v.y*n ); } static norm(v: Vector) { var d: number =...
{ return Math.atan2(this.y, this.x); }
identifier_body
vector.ts
/* Project: Golden Author: Copyright (C) 2015, Atanas Laskov License: BSD license, see LICENSE for more details. http://www.atanaslaskov.com/golden/ */ // Cartesian 2d coordinate (x;y) // class Vector{ public x: number; public y: number; constructor(x:number =0.0, y:number =0.0) { this.x = x; ...
return Math.sqrt( this.x*this.x + this.y*this.y ); } public angle(): number { return Math.atan2(this.y, this.x); } static plus(a: Vector, b: Vector): Vector { return new Vector( a.x+b.x, a.y+b.y ); } static minus(a: Vector, b: Vector): Vector { return new Vector( a.x-b.x, a.y-b.y ); } ...
public distance(): number {
random_line_split
vector.ts
/* Project: Golden Author: Copyright (C) 2015, Atanas Laskov License: BSD license, see LICENSE for more details. http://www.atanaslaskov.com/golden/ */ // Cartesian 2d coordinate (x;y) // class
{ public x: number; public y: number; constructor(x:number =0.0, y:number =0.0) { this.x = x; this.y = y; } public set(v: Vector) { this.x = v.x; this.y = v.y; } public copy(): Vector { return new Vector(this.x, this.y); } public distance(): number { return Math.sqrt( this....
Vector
identifier_name
range_map.rs
-> RangeMap<T> { let size = size.bytes(); let mut map = RangeMap { v: Vec::new() }; if size > 0 { map.v.push(Elem { range: 0..size, data: init }); } map }
let mut right = self.v.len(); // exclusive loop { debug_assert!(left < right, "find_offset: offset {} is out-of-bounds", offset); let candidate = left.checked_add(right).unwrap() / 2; let elem = &self.v[candidate]; if offset < elem.range.start { ...
/// Finds the index containing the given offset. fn find_offset(&self, offset: u64) -> usize { // We do a binary search. let mut left = 0usize; // inclusive
random_line_split
range_map.rs
RangeMap<T> { let size = size.bytes(); let mut map = RangeMap { v: Vec::new() }; if size > 0 { map.v.push(Elem { range: 0..size, data: init }); } map } /// Finds the index containing the given offset. fn find_offset(&self, offset: u64) -> usize
} } /// Provides read-only iteration over everything in the given range. This does /// *not* split items if they overlap with the edges. Do not use this to mutate /// through interior mutability. pub fn iter<'a>(&'a self, offset: Size, len: Size) -> impl Iterator<Item = &'a T> + 'a { ...
{ // We do a binary search. let mut left = 0usize; // inclusive let mut right = self.v.len(); // exclusive loop { debug_assert!(left < right, "find_offset: offset {} is out-of-bounds", offset); let candidate = left.checked_add(right).unwrap() / 2; let ...
identifier_body
range_map.rs
RangeMap<T> { let size = size.bytes(); let mut map = RangeMap { v: Vec::new() }; if size > 0 { map.v.push(Elem { range: 0..size, data: init }); } map } /// Finds the index containing the given offset. fn find_offset(&self, offset: u64) -> usize { ...
let mut end_idx = first_idx; loop { // Compute if `end` is the last element we need to look at. let done = self.v[end_idx].range.end >= offset + len; // We definitely need to include `end`, so move the index. end_idx += 1; ...
{ // Make sure we got a clear beginning let mut first_idx = self.find_offset(offset); if self.split_index(first_idx, offset) { // The newly created 2nd element is ours first_idx += 1; } // No more mutation. let first...
conditional_block
range_map.rs
RangeMap<T> { let size = size.bytes(); let mut map = RangeMap { v: Vec::new() }; if size > 0 { map.v.push(Elem { range: 0..size, data: init }); } map } /// Finds the index containing the given offset. fn
(&self, offset: u64) -> usize { // We do a binary search. let mut left = 0usize; // inclusive let mut right = self.v.len(); // exclusive loop { debug_assert!(left < right, "find_offset: offset {} is out-of-bounds", offset); let candidate = left.checked_add(right)....
find_offset
identifier_name
histogramTests.ts
/* Copyright 2017 The TensorFlow 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 required by applicable law or agree...
it('Handles data with no bins', () => { chai.assert.deepEqual(intermediateToD3({ wall_time: 1234.5, step: 0, min: 0, max: 0, buckets: [], }, 0, 0, 0), []); }); it('Handles data with one bin', () => { const buckets = [{left: 1.1e-12, right: 1.21e-12, count: 1}]; con...
{ h1.forEach((b1, i) => { const b2 = h2[i]; chai.assert.closeTo(b1.x, b2.x, 1e-10); chai.assert.closeTo(b1.dx, b2.dx, 1e-10); chai.assert.closeTo(b1.y, b2.y, 1e-10); }); }
identifier_body