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
options.py
# # Copyright (c) 2013-2020 Contributors to the Eclipse Foundation # # See the NOTICE file distributed with this work for additional information regarding copyright # ownership. All rights reserved. This program and the accompanying materials are made available # under the terms of the Apache License, Version 2.0 whic...
return self._base_options.getCoprocessorJar()
random_line_split
index.js
import Controller from '@ember/controller'; import { A } from '@ember/array'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import DS from 'ember-data'; import loadAll from 'ember-osf/utils/load-relationship'; import config from 'ember-get-config'; import Analytics from '...
, expandMFR() { // State of fullScreenMFR before the transition (what the user perceives as the action) const beforeState = this.toggleProperty('fullScreenMFR') ? 'Expand' : 'Contract'; this.get('metrics') .trackEvent({ category: 'button',...
{ const licenseState = this.toggleProperty('showLicenseText') ? 'Expand' : 'Contract'; this.get('metrics') .trackEvent({ category: 'button', action: 'click', label: `Content - License ${licenseState}`, })...
identifier_body
index.js
import Controller from '@ember/controller'; import { A } from '@ember/array'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import DS from 'ember-data'; import loadAll from 'ember-osf/utils/load-relationship'; import config from 'ember-get-config'; import Analytics from '...
return false; }), showStatusBanner: computed('model.{public,provider.reviewsWorkflow,reviewsState}', 'userIsContrib', 'isPendingWithdrawal', function() { return ( this.get('model.provider.reviewsWorkflow') && this.get('model.public') && this.get('userIsContr...
{ const authorIds = this.get('authors').map((author) => { return author.get('userId'); }); return this.get('currentUser.currentUserId') ? authorIds.includes(this.get('currentUser.currentUserId')) : false; }
conditional_block
index.js
import Controller from '@ember/controller'; import { A } from '@ember/array'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import DS from 'ember-data'; import loadAll from 'ember-osf/utils/load-relationship'; import config from 'ember-get-config'; import Analytics from '...
() { const licenseState = this.toggleProperty('showLicenseText') ? 'Expand' : 'Contract'; this.get('metrics') .trackEvent({ category: 'button', action: 'click', label: `Content - License ${licenseState}`, ...
toggleLicenseText
identifier_name
index.js
import Controller from '@ember/controller'; import { A } from '@ember/array'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import DS from 'ember-data'; import loadAll from 'ember-osf/utils/load-relationship'; import config from 'ember-get-config'; import Analytics from '...
this.send('click', category, label, url); }, }, _returnContributors(contributors) { return contributors; }, });
trackNonContributors(category, label, url) {
random_line_split
misc.rs
use num::Num; use signed::Signed; use create::clone; use length::normalize; use trig::Trig; pub use vec4::inverse; pub use vec4::lerp; pub use vec4::min; pub use vec4::max; pub use vec4::clamp; pub use vec4::eq; pub use vec4::ne; #[inline] pub fn conjugate<'a, 'b, T: Copy + Signed>(out: &'a mut [T; 4], a: &'b [T; 4...
() { let mut v = [0, 0, 0, 0]; conjugate(&mut v, &[1, 1, 1, 1]); assert!(v[0] == -1); assert!(v[1] == -1); assert!(v[2] == -1); assert!(v[3] == 1); } #[inline] pub fn calculate_w<'a, 'b, T: Copy + Signed>(out: &'a mut [T; 4], a: &'b [T; 4]) -> &'a mut [T; 4] { out[0] = a[0]; out[1] = a[...
test_conjugate
identifier_name
misc.rs
use num::Num; use signed::Signed; use create::clone; use length::normalize; use trig::Trig; pub use vec4::inverse; pub use vec4::lerp; pub use vec4::min; pub use vec4::max; pub use vec4::clamp; pub use vec4::eq; pub use vec4::ne; #[inline] pub fn conjugate<'a, 'b, T: Copy + Signed>(out: &'a mut [T; 4], a: &'b [T; 4...
let ax = a[0].to_f64(); let ay = a[1].to_f64(); let az = a[2].to_f64(); let aw = a[3].to_f64(); let mut bx = b[0].to_f64(); let mut by = b[1].to_f64(); let mut bz = b[2].to_f64(); let mut bw = b[3].to_f64(); let mut cosom = ax * bx + ay * by + az * bz + aw * bw; let mut sinom; ...
} #[inline] pub fn slerp<'a, 'b, T: Copy + Signed, N: Copy + Signed>(out: &'a mut [T; 4], a: &'b [T; 4], b: &'b [T; 4], t: N) -> &'a mut [T; 4] { let t_f64 = t.to_f64();
random_line_split
misc.rs
use num::Num; use signed::Signed; use create::clone; use length::normalize; use trig::Trig; pub use vec4::inverse; pub use vec4::lerp; pub use vec4::min; pub use vec4::max; pub use vec4::clamp; pub use vec4::eq; pub use vec4::ne; #[inline] pub fn conjugate<'a, 'b, T: Copy + Signed>(out: &'a mut [T; 4], a: &'b [T; 4...
else { scale0 = 1_f64 - t_f64; scale1 = t_f64; } out[0] = T::from_f64(scale0 * ax + scale1 * bx); out[1] = T::from_f64(scale0 * ay + scale1 * by); out[2] = T::from_f64(scale0 * az + scale1 * bz); out[3] = T::from_f64(scale0 * aw + scale1 * bw); out }
{ omega = cosom.acos(); sinom = omega.sin(); sinom = if sinom != 0_f64 {1_f64 / sinom} else {sinom}; scale0 = ((1_f64 - t_f64) * omega).sin() * sinom; scale1 = (t_f64 * omega).sin() * sinom; }
conditional_block
misc.rs
use num::Num; use signed::Signed; use create::clone; use length::normalize; use trig::Trig; pub use vec4::inverse; pub use vec4::lerp; pub use vec4::min; pub use vec4::max; pub use vec4::clamp; pub use vec4::eq; pub use vec4::ne; #[inline] pub fn conjugate<'a, 'b, T: Copy + Signed>(out: &'a mut [T; 4], a: &'b [T; 4...
#[inline] pub fn nlerp<'a, 'b, T: Copy + Num, N: Copy + Num>(out: &'a mut [T; 4], a: &'b [T; 4], b: &'b [T; 4], t: N) -> &'a mut [T; 4] { let tmp = clone(lerp(out, a, b, t)); normalize(out, &tmp) } #[inline] pub fn slerp<'a, 'b, T: Copy + Signed, N: Copy + Signed>(out: &'a mut [T; 4], a: &'b [T; 4], b: &'b [...
{ out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = (T::one() - a[0] * a[0] - a[1] * a[1] - a[2] * a[2]).abs().sqrt(); out }
identifier_body
Navigation.tsx
/* * 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 http://mozilla.org/MPL/2.0/. * */ import * as React from 'react'; import { css } from '@csegames/linaria'; import { styled } from '@csegames/...
() { const nextDisabled = this.props.currentPage === this.props.pages.length - 1; const backDisabled = this.props.currentPage === 0; return ( <Container> <div className={Section} /> <MiddleNavContainer className={Section}> <NavButton disabled={backDisabled} ...
render
identifier_name
Navigation.tsx
/* * 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 http://mozilla.org/MPL/2.0/. * */ import * as React from 'react'; import { css } from '@csegames/linaria'; import { styled } from '@csegames/...
!page.pageVisited && !page.pageComplete && navImages.empty; const pageName = CharacterCreationPage[page.pageNumber]; return ( <NavProgressSection key={i}> <Tooltip styles={{ tooltip: { ...
{ const nextDisabled = this.props.currentPage === this.props.pages.length - 1; const backDisabled = this.props.currentPage === 0; return ( <Container> <div className={Section} /> <MiddleNavContainer className={Section}> <NavButton disabled={backDisabled} ...
identifier_body
Navigation.tsx
/* * 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 http://mozilla.org/MPL/2.0/. * */ import * as React from 'react'; import { css } from '@csegames/linaria'; import { styled } from '@csegames/...
export interface NavigationProps { onNextClick: () => void; onBackClick: () => void; onCancelClick: () => void; onHelpClick: () => void; pages: NavigationPageInfo[]; currentPage: CharacterCreationPage; disableNavButtons: boolean; } export interface NavigationState { } export const navImages = { curre...
onClick: () => void; }
random_line_split
test_bucketlistitems.py
''' Script used to test bucketlistitem response and request.''' from rest_framework.authtoken.models import Token from rest_framework.test import APIClient from django.core.urlresolvers import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth.models imp...
class ApiUserItemListDetail(ApiHeaderAuthorization): def test_user_can_updatebucketlist(self): data={'name': 'updateitem', 'done': True } url= reverse_lazy('itemdetail', kwargs={'id':19, 'item_id': 24 }) response = self.client.put(url, data) self.assertEqual(response.status_code...
def test_user_can_addbucketlist(self): data={'name': 'item', 'done': True } url= reverse_lazy('addbucketitem', kwargs={'id':19}) response = self.client.post(url, data) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
identifier_body
test_bucketlistitems.py
''' Script used to test bucketlistitem response and request.''' from rest_framework.authtoken.models import Token from rest_framework.test import APIClient from django.core.urlresolvers import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth.models imp...
response = self.client.put(url, data) self.assertEqual(response.status_code, status.HTTP_201_CREATED) def test_user_cannot_updatebucketlist(self): data={'': '', '': '' } url= reverse_lazy('itemdetail', kwargs={'id':19, 'item_id': 24 }) response = self.client.put(url, data)...
def test_user_can_updatebucketlist(self): data={'name': 'updateitem', 'done': True } url= reverse_lazy('itemdetail', kwargs={'id':19, 'item_id': 24 })
random_line_split
test_bucketlistitems.py
''' Script used to test bucketlistitem response and request.''' from rest_framework.authtoken.models import Token from rest_framework.test import APIClient from django.core.urlresolvers import reverse_lazy from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth.models imp...
(self): data={'name': 'item', 'done': True } url= reverse_lazy('addbucketitem', kwargs={'id':19}) response = self.client.post(url, data) self.assertEqual(response.status_code, status.HTTP_201_CREATED) class ApiUserItemListDetail(ApiHeaderAuthorization): def test_user_can_updatebu...
test_user_can_addbucketlist
identifier_name
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages import re import os import sys def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.search( ...
setup( name='iosfu', version=version, url='http://github.com/fmartingr/iosfu', license='MIT', description='iOS Forensics Utility', author='Felipe Martin', author_email='fmartingr@me.com', packages=find_packages(), include_package_data=True, zip_safe=False, install_requires...
os.system("python setup.py sdist upload") args = {'version': version} print("You probably want to also tag the version now:") print(" git tag -a %(version)s -m 'version %(version)s'" % args) print(" git push --tags") sys.exit()
conditional_block
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages import re import os import sys def
(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.search( "^__version__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1) package = 'iosfu' version = get_version(package) i...
get_version
identifier_name
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages import re import os import sys def get_version(package):
package = 'iosfu' version = get_version(package) if sys.argv[-1] == 'publish': os.system("python setup.py sdist upload") args = {'version': version} print("You probably want to also tag the version now:") print(" git tag -a %(version)s -m 'version %(version)s'" % args) print(" git push --tags"...
""" Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.search( "^__version__ = ['\"]([^'\"]+)['\"]", init_py, re.MULTILINE).group(1)
identifier_body
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup, find_packages import re import os import sys def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read() return re.search( ...
print("You probably want to also tag the version now:") print(" git tag -a %(version)s -m 'version %(version)s'" % args) print(" git push --tags") sys.exit() setup( name='iosfu', version=version, url='http://github.com/fmartingr/iosfu', license='MIT', description='iOS Forensics U...
random_line_split
testwebfunctionaldb.py
#! /usr/bin/env python # -*- coding: UTF8 -*- # Este arquivo é parte do programa Carinhas # Copyright 2013-2014 Carlo Oliveira <carlo@nce.ufrj.br>, # `Labase <http://labase.selfip.org/>`__; `GPL <http://is.gd/3Udt>`__. # # Carinhas é um software livre; você pode redistribuí-lo e/ou # modificá-lo dentro dos termos da Li...
response = app.get('/pontos') self.assertEqual('200 OK', response.status) self.assertTrue('projeto2222-lastcodename' in response, str(response)) self.assertTrue('<h3>Idade: 10 Genero: outro Ano Escolar: 9</h3>' in response, str(response)) self.assertTrue('<td><span>2222<span></t...
random_line_split
testwebfunctionaldb.py
#! /usr/bin/env python # -*- coding: UTF8 -*- # Este arquivo é parte do programa Carinhas # Copyright 2013-2014 Carlo Oliveira <carlo@nce.ufrj.br>, # `Labase <http://labase.selfip.org/>`__; `GPL <http://is.gd/3Udt>`__. # # Carinhas é um software livre; você pode redistribuí-lo e/ou # modificá-lo dentro dos termos da Li...
import MagicMock, patch, ANY from webtest import TestApp from server.control import application as appbottle import server.modelo_redis as cs import server.control as ct class FunctionalWebTest(unittest.TestCase): def setUp(self): cs.DBF = '/tmp/redis_test.db' pass def test_default_page(self...
atch else: from unittest.mock
conditional_block
testwebfunctionaldb.py
#! /usr/bin/env python # -*- coding: UTF8 -*- # Este arquivo é parte do programa Carinhas # Copyright 2013-2014 Carlo Oliveira <carlo@nce.ufrj.br>, # `Labase <http://labase.selfip.org/>`__; `GPL <http://is.gd/3Udt>`__. # # Carinhas é um software livre; você pode redistribuí-lo e/ou # modificá-lo dentro dos termos da Li...
ult_page """ app = TestApp(appbottle) response = app.get('/static/index.html') self.assertEqual('200 OK', response.status) self.assertTrue('<title>Jogo Eica - Cadastro</title>' in response.text, response.text[:1000]) def test_default_redirect(self): """test_default_redirect ...
""" test_defa
identifier_name
testwebfunctionaldb.py
#! /usr/bin/env python # -*- coding: UTF8 -*- # Este arquivo é parte do programa Carinhas # Copyright 2013-2014 Carlo Oliveira <carlo@nce.ufrj.br>, # `Labase <http://labase.selfip.org/>`__; `GPL <http://is.gd/3Udt>`__. # # Carinhas é um software livre; você pode redistribuí-lo e/ou # modificá-lo dentro dos termos da Li...
unittest.main()
id() app = TestApp(appbottle) app.post('/record/store', self._pontua(rec_id)) ct.LAST = rec_id response = app.get('/pontos') self.assertEqual('200 OK', response.status) self.assertTrue('projeto2222-lastcodename' in response, str(response)) self.assertTrue('<h3>Id...
identifier_body
FileConfidentialityMessage.js
// Register script for MDS if possible RegisterModuleInit("FileConfidentialityMessage.js", RemoteManager_Inject); //MDS registration RemoteManager_Inject(); //non MDS run if (typeof (Sys) != "undefined" && Boolean(Sys) && Boolean(Sys.Application)) { Sys.Application.notifyScriptLoaded(); } if (typeof (NotifyScrip...
head.appendChild(script); }
var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = url; // Attach handlers for all browsers var done = false; script.onload = script.onreadystatechange = function () { if (!done && (!this.readyState || this.readyState ==...
identifier_body
FileConfidentialityMessage.js
// Register script for MDS if possible RegisterModuleInit("FileConfidentialityMessage.js", RemoteManager_Inject); //MDS registration RemoteManager_Inject(); //non MDS run if (typeof (Sys) != "undefined" && Boolean(Sys) && Boolean(Sys.Application)) { Sys.Application.notifyScriptLoaded(); } if (typeof (NotifyScrip...
$("#createnewsite").parent().hide(); } }); } function SetStatusBar(message) { var strStatusID = SP.UI.Status.addStatus("Information : ", message, true); SP.UI.Status.setStatusPriColor(strStatusID, "yellow"); } function IsOnPage(pageName) { if (window.location.href.toLowerCase().in...
// Customize the viewlsts.aspx page if (IsOnPage("viewlsts.aspx")) { //hide the subsites link on the viewlsts.aspx page
random_line_split
FileConfidentialityMessage.js
// Register script for MDS if possible RegisterModuleInit("FileConfidentialityMessage.js", RemoteManager_Inject); //MDS registration RemoteManager_Inject(); //non MDS run if (typeof (Sys) != "undefined" && Boolean(Sys) && Boolean(Sys.Application)) { Sys.Application.notifyScriptLoaded(); } if (typeof (NotifyScrip...
essage) { var strStatusID = SP.UI.Status.addStatus("Information : ", message, true); SP.UI.Status.setStatusPriColor(strStatusID, "yellow"); } function IsOnPage(pageName) { if (window.location.href.toLowerCase().indexOf(pageName.toLowerCase()) > -1) { return true; } else { return false; ...
tStatusBar(m
identifier_name
FileConfidentialityMessage.js
// Register script for MDS if possible RegisterModuleInit("FileConfidentialityMessage.js", RemoteManager_Inject); //MDS registration RemoteManager_Inject(); //non MDS run if (typeof (Sys) != "undefined" && Boolean(Sys) && Boolean(Sys.Application)) { Sys.Application.notifyScriptLoaded(); } if (typeof (NotifyScrip...
lse { return false; } } function loadScript(url, callback) { var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = url; // Attach handlers for all browsers var done = false; script.onload = script.onreadystatechange = funct...
return true; } e
conditional_block
tokens_test.py
from temp_tools import TestClient from test_template import ApiTestTemplate class TokensTest(ApiTestTemplate): def setUp(self): super(TokensTest, self).setUp() TestClient.execute("""TRUNCATE auth_token""") self.test_token_data = {'description': 'Test token 1', ...
(self): # test unauthorized r = TestClient.post('api/v1/projects/%s/tokens' % self.project_id, data=self.test_token_data, headers=TestClient.get_job_authorization(self.job_id)) self.assertEqual(r['message'], 'Unauthorized') # test token creation r = ...
test_tokens_root
identifier_name
tokens_test.py
from temp_tools import TestClient from test_template import ApiTestTemplate class TokensTest(ApiTestTemplate): def setUp(self): super(TokensTest, self).setUp() TestClient.execute("""TRUNCATE auth_token""") self.test_token_data = {'description': 'Test token 1', ...
r = TestClient.execute_one(''' INSERT INTO auth_token (description, scope_push, scope_pull, project_id) VALUES (%s, %s, %s, %s) RETURNING id ''', [self.test_token_data['description'], self.test_token_data['scope_push'], self.test_token_data['scope_pull'], self.project_id]) ...
identifier_body
tokens_test.py
from temp_tools import TestClient from test_template import ApiTestTemplate class TokensTest(ApiTestTemplate): def setUp(self): super(TokensTest, self).setUp() TestClient.execute("""TRUNCATE auth_token""") self.test_token_data = {'description': 'Test token 1', ...
# test unauthorized r = TestClient.post('api/v1/projects/%s/tokens' % self.project_id, data=self.test_token_data, headers=TestClient.get_job_authorization(self.job_id)) self.assertEqual(r['message'], 'Unauthorized') # test token creation r = TestClien...
def test_tokens_root(self):
random_line_split
binops.rs
// 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/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
}
random_line_split
binops.rs
// 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/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
() { assert!((!(true < false))); assert!((!(true <= false))); assert!((true > false)); assert!((true >= false)); assert!((false < true)); assert!((false <= true)); assert!((!(false > true))); assert!((!(false >= true))); // Bools support bitwise binops assert_eq!(false & false,...
test_bool
identifier_name
binops.rs
// 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/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { test_nil(); test_bool(); test_ptr(); test_class(); }
{ let q = p(1, 2); let mut r = p(1, 2); unsafe { println!("q = {:x}, r = {:x}", (::std::mem::transmute::<*const p, uint>(&q)), (::std::mem::transmute::<*const p, uint>(&r))); } assert_eq!(q, r); r.y = 17; assert!((r.y != q.y)); assert_eq!(r.y, 17); assert!((q != r)); }
identifier_body
sfm10_wizard.py
# 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; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful,...
def BuildThisFootprint(self): pads = self.parameters["Pads"] body = self.parameters["Body"] pad_num_vert_pads = pads['*'+self.pad_num_pads_vert_key] pad_num_horz_pads = pads['*'+self.pad_num_pads_horz_key] pad_width = pads[self.pad_width_key] ...
pad_length_hansolder = pad_length+pad_handsolder return PA.PadMaker(self.module).SMDPad( pad_length_hansolder, pad_width, shape=pcbnew.PAD_SHAPE_RECT, rot_degree=rot_degree)
random_line_split
sfm10_wizard.py
# 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; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful,...
def GenerateParameterList(self): self.AddParam("Pads", self.pad_num_pads_vert_key, self.uNatural, 7) self.AddParam("Pads", self.pad_num_pads_horz_key, self.uNatural, 24) self.AddParam("Pads", self.pad_width_key, self.uMM, 0.7) self.AddParam("Pads", self.pad_length_key, self.uMM, 1)...
return "SFM10"
identifier_body
sfm10_wizard.py
# 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; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful,...
(self): pads = self.parameters["Pads"] body = self.parameters["Body"] pad_num_vert_pads = pads['*'+self.pad_num_pads_vert_key] pad_num_horz_pads = pads['*'+self.pad_num_pads_horz_key] pad_width = pads[self.pad_width_key] pad_length = pads[self....
BuildThisFootprint
identifier_name
15.2.3.6-4-531-1.js
// Copyright (c) 2012 Ecma International. All rights reserved. // Ecma International makes this code available under the terms and conditions set // forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the // "Use Terms"). Any redistribution of this code must retain the above // copyright and this n...
obj.verifySetFunction = value; }, configurable: true }); obj.verifySetFunction1 = "data1"; var getFunc = function () { return obj.verifySetFunction1; }; var setFunc = function (value) { obj.verifySetFunction1 = value; }; Object.defineProperty(obj, "property", { get: getFunc, set: setFu...
set: function (value) {
random_line_split
index.js
/** * * AttributeOption * */ import React from 'react'; import PropTypes from 'prop-types'; import { useIntl } from 'react-intl'; import { Box } from '@strapi/design-system/Box'; import { Flex } from '@strapi/design-system/Flex'; import { Typography } from '@strapi/design-system/Typography'; import useFormModalNav...
step, }); }; return ( <BoxWrapper padding={4} as="button" hasRadius type="button" onClick={handleClick}> <Flex> <AttributeIcon type={type} /> <Box paddingLeft={4}> <Flex> <Typography fontWeight="bold"> {formatMessage({ id: getTrad(`attribute.$...
const handleClick = () => { const step = type === 'component' ? '1' : null; onClickSelectField({ attributeType: type,
random_line_split
collatz.rs
pub struct
{ curr: u64, done: bool, } impl Collatz { pub fn new(start: u64) -> Collatz { Collatz { curr: start, done: false, } } } impl Iterator for Collatz { type Item = u64; fn next(&mut self) -> Option<u64> { if self.done { return None }; let ...
Collatz
identifier_name
collatz.rs
pub struct Collatz { curr: u64, done: bool, } impl Collatz { pub fn new(start: u64) -> Collatz { Collatz { curr: start, done: false, } } } impl Iterator for Collatz { type Item = u64; fn next(&mut self) -> Option<u64> { if self.done { return No...
, }; result } } #[test] fn test_collatz() { let v = [10, 5, 16, 8, 4, 2, 1]; let mut c = Collatz::new(10); for i in 0..7 { assert_eq!(c.next(), Some(v[i])); } assert_eq!(c.next(), None); }
{ n * 3 + 1 }
conditional_block
collatz.rs
pub struct Collatz { curr: u64, done: bool, } impl Collatz { pub fn new(start: u64) -> Collatz { Collatz {
} } } impl Iterator for Collatz { type Item = u64; fn next(&mut self) -> Option<u64> { if self.done { return None }; let result = Some(self.curr); self.curr = match self.curr { n if n <= 1 => { self.done = true; 1 }, n if n % 2 == 0 => { n / 2 }, ...
curr: start, done: false,
random_line_split
source.rs
use check_file; use ffprobe; use path; use std::cmp::Ordering; use std::error::Error as StdError; use std::fmt; use std::io; use std::iter::IntoIterator; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; #[derive(Debug)] pub enum Error { CheckFileError(check_file::Error), FFProbeError { path: Pa...
(&self) -> Option<&StdError> { match *self { Error::CheckFileError(ref error) => Some(error), Error::FFProbeError { ref error, .. } => Some(error), Error::PathError { ref error, .. } => Some(error), Error::SourceDirectory { ref error, .. } => Some(error), ...
cause
identifier_name
source.rs
use check_file; use ffprobe; use path; use std::cmp::Ordering; use std::error::Error as StdError; use std::fmt; use std::io; use std::iter::IntoIterator; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; #[derive(Debug)] pub enum Error { CheckFileError(check_file::Error), FFProbeError { path: Pa...
fn ffprobe_it(path: &PathBuf) -> SourceResult<Option<ffprobe::FFProbe>> { use self::Error::FFProbeError; let res = ffprobe::ffprobe(path); match res { Err(e) => { Err(FFProbeError { path: path.to_owned(), error: e, }) } Ok(r)...
{ use path::{RecursivePathIterator, PathType}; let paths: Vec<PathBuf> = match path.is_dir() { false => vec![path], true => { RecursivePathIterator::new(path) .filter_map(|x| { match x { PathType::Directory(_) => None, ...
identifier_body
source.rs
use check_file; use ffprobe; use path; use std::cmp::Ordering; use std::error::Error as StdError; use std::fmt; use std::io; use std::iter::IntoIterator; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; #[derive(Debug)] pub enum Error { CheckFileError(check_file::Error), FFProbeError { path: Pa...
let mut expanded_paths: Vec<PathBuf> = paths.into_iter() .flat_map(expand_path) .collect(); expanded_paths.sort(); expanded_paths.dedup(); // Quick filtering using 'file' let (paths, skipped_file) = try!(check_file::check_files(expanded_paths.into_iter...
{ return Err(Error::StraySource { path: path.clone() }); }
conditional_block
source.rs
use check_file; use ffprobe; use path; use std::cmp::Ordering; use std::error::Error as StdError; use std::fmt; use std::io; use std::iter::IntoIterator; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; #[derive(Debug)] pub enum Error { CheckFileError(check_file::Error), FFProbeError { path: Pa...
.collect(); let paths = try!(paths); if let Some(path) = paths.iter().filter(|&path| !path.starts_with(&base_directory)).next() { return Err(Error::StraySource { path: path.clone() }); } let mut expanded_paths: Vec<PathBuf> = paths.into_iter() .flat...
let paths: Result<Vec<_>, Error> = paths.into_iter() .map(|x| x.into()) .map(canonicalize)
random_line_split
orca_projection.py
""" Tri-Polar Grid Projected Plotting ================================= This example demonstrates cell plots of data on the semi-structured ORCA2 model grid. First, the data is projected into the PlateCarree coordinate reference system. Second four pcolormesh plots are created from this projected dataset, using diff...
fig = plt.figure() fig.suptitle("ORCA2 Data Projected to {}".format(name)) # Set up axes and title ax = plt.subplot(projection=projections[name]) # Set limits ax.set_global() # plot with Iris quickplot pcolormesh qplt.pcolormesh(new_cube) # Draw co...
filepath = iris.sample_data_path("orca2_votemper.nc") cube = iris.load_cube(filepath) # Choose plot projections projections = {} projections["Mollweide"] = ccrs.Mollweide() projections["PlateCarree"] = ccrs.PlateCarree() projections["NorthPolarStereo"] = ccrs.NorthPolarStereo() projections[...
identifier_body
orca_projection.py
""" Tri-Polar Grid Projected Plotting ================================= This example demonstrates cell plots of data on the semi-structured ORCA2 model grid. First, the data is projected into the PlateCarree coordinate reference system. Second four pcolormesh plots are created from this projected dataset, using diff...
(): # Load data filepath = iris.sample_data_path("orca2_votemper.nc") cube = iris.load_cube(filepath) # Choose plot projections projections = {} projections["Mollweide"] = ccrs.Mollweide() projections["PlateCarree"] = ccrs.PlateCarree() projections["NorthPolarStereo"] = ccrs.NorthPolarS...
main
identifier_name
orca_projection.py
""" Tri-Polar Grid Projected Plotting ================================= This example demonstrates cell plots of data on the semi-structured ORCA2 model grid. First, the data is projected into the PlateCarree coordinate reference system. Second four pcolormesh plots are created from this projected dataset, using diff...
if __name__ == "__main__": main()
fig = plt.figure() fig.suptitle("ORCA2 Data Projected to {}".format(name)) # Set up axes and title ax = plt.subplot(projection=projections[name]) # Set limits ax.set_global() # plot with Iris quickplot pcolormesh qplt.pcolormesh(new_cube) # Draw coastlines...
conditional_block
orca_projection.py
""" Tri-Polar Grid Projected Plotting ================================= This example demonstrates cell plots of data on the semi-structured ORCA2 model grid. First, the data is projected into the PlateCarree coordinate reference system. Second four pcolormesh plots are created from this projected dataset, using diff...
import iris.quickplot as qplt def main(): # Load data filepath = iris.sample_data_path("orca2_votemper.nc") cube = iris.load_cube(filepath) # Choose plot projections projections = {} projections["Mollweide"] = ccrs.Mollweide() projections["PlateCarree"] = ccrs.PlateCarree() projection...
import cartopy.crs as ccrs import iris import iris.analysis.cartography import iris.plot as iplt
random_line_split
fn-simple.rs
// rustfmt-normalize_comments: true fn simple(/*pre-comment on a function!?*/ i: i32/*yes, it's possible! */ ,response: NoWay /* hose */) { fn op(x: Typ, key : &[u8], upd : Box<Fn(Option<&memcache::Item>) -> (memcache::Status, Result<memcache::Item, Option<String>>)>) -> Map...
fn zzzzzzzzzzzzzzzzzzzz<Type, NodeType> (selff: Type, mut handle: node::Handle<IdRef<'id, Node<K, V>>, Type, NodeType>) -> SearchStack<'a, K, V, Type, NodeType>{ } unsafe fn generic_call(cx: *mut JSContext, argc: libc::c_uint, vp: *mut JSVal, is_lenient: bool, ...
{}
identifier_body
fn-simple.rs
// rustfmt-normalize_comments: true fn simple(/*pre-comment on a function!?*/ i: i32/*yes, it's possible! */ ,response: NoWay /* hose */) { fn op(x: Typ, key : &[u8], upd : Box<Fn(Option<&memcache::Item>) -> (memcache::Status, Result<memcache::Item, Option<String>>)>) -> Map...
(listener:Box< AsyncCORSResponseListener+Send >, script_chan: Box<ScriptChan+Send>) { } fn some_func<T:Box<Trait+Bound>>(val:T){} fn zzzzzzzzzzzzzzzzzzzz<Type, NodeType> (selff: Type, mut handle: node::Handle<IdRef<'id, Node<K, V>>, Type, NodeType>) -> SearchStack<'a, ...
http_fetch_async
identifier_name
fn-simple.rs
// rustfmt-normalize_comments: true fn simple(/*pre-comment on a function!?*/ i: i32/*yes, it's possible! */ ,response: NoWay /* hose */) { fn op(x: Typ, key : &[u8], upd : Box<Fn(Option<&memcache::Item>) -> (memcache::Status, Result<memcache::Item, Option<String>>)>) -> Map...
where T: Fn(// First arg A, // Second argument B, C, D, /* pre comment */ E /* last comment */) -> &SomeType { arg(a, b, c, d, e) } fn foo() -> ! {} pub fn http_fetch_async(listener:Box< AsyncCORSResponseListener+Send >, script_chan: Box<ScriptChan+Send>) { } fn some_func<T:Box<T...
simple(/* does this preserve comments now? */ 42, NoWay) } fn generic<T>(arg: T) -> &SomeType
random_line_split
lib.rs
at( ($c_idx:ident, $b_idx:ident) => {{ let mut branches = Branches::empty(); branches.$b_idx = contents.$c_idx; TreeBody::Branch(Box::new(branches)) }} ); self.contents = Branches { lll: at!(lll, hhh), llh: at!(llh, hhl), ...
{ let mut tree: VoxelTree<i32> = VoxelTree::new(); *tree.get_mut_or_create(VoxelBounds::new(1, 1, 1, 0)) = TreeBody::Leaf(1); *tree.get_mut_or_create(VoxelBounds::new(8, -8, 4, 0)) = TreeBody::Leaf(2); *tree.get_mut_or_create(VoxelBounds::new(2, 0, 4, 4)) = TreeBody::Leaf(3); *tree.get_mut_or_create...
identifier_body
lib.rs
use std::mem; use std::ops::Deref; mod raycast; mod voxel_bounds; pub use voxel_bounds::VoxelBounds; #[derive(Debug)] pub struct VoxelTree<T> { /// The log_2 of the tree's size. lg_size: u8, /// Force the top level to always be branches; /// it saves a branch in the grow logic. contents: Branches<T>, } #[...
#![feature(core)] #![cfg_attr(test, feature(test))]
random_line_split
lib.rs
TODO: Make this branch-free by constructing the bools into an offset. match (choose_branch(x), choose_branch(y), choose_branch(z)) { (false, false, false) => &branches.lll, (false, false, true ) => &branches.llh, (false, true , false) => &branches.lhl, (false, true , true ) => &branches.lhh...
(&self, voxel: VoxelBounds) -> i32 { // When we compare the voxel position to octree bounds to choose subtrees // for insertion, we'll be comparing voxel position to values of 2^n and // -2^n, so we can just use the position bits to branch directly. // This actually works for negative values too, withou...
find_mask
identifier_name
response-transformer.js
const toResult = require("../result-model.js"); const SELLING_STATUSES = { SOLD: "EndedWithSales", LIVE: "Active" }; const sellingStatuses = Object.keys(SELLING_STATUSES).map( k => SELLING_STATUSES[k] ); module.exports = listings => {
const [firstKey] = Object.keys(listings); const resultSet = listings[firstKey][0].searchResult[0].item; return resultSet .filter( l => !!l.galleryURL && l.galleryURL.length && sellingStatuses.includes(l.sellingStatus[0].sellingState[0]) ) .map(l => { const [about] =...
// their JSON is all wrapped in single item arrays :/
random_line_split
ClearErrorsDirective.ts
(() => { class ClearErrorsLink { private _fieldController: any; private _formController: any; constructor( $scope: ng.IScope, $element: ng.IRootElementService, $attrs: ng.IAttributes, $ctrls ) { 'ngInject'; th...
} } public clearFormErrors() { this._formController.$serverError = {}; } } function clearErrorsDirective() { return { restrict: 'A', require: ['ngModel', '^?form'], link: function ( $scope: ng.IScope, ...
{ this._fieldController.$setValidity(prop, true); }
conditional_block
ClearErrorsDirective.ts
(() => { class ClearErrorsLink { private _fieldController: any; private _formController: any; constructor( $scope: ng.IScope, $element: ng.IRootElementService, $attrs: ng.IAttributes, $ctrls ) { 'ngInject'; th...
}; } angular .module('pipClearErrors', []) .directive('pipClearErrors', clearErrorsDirective); })();
}
random_line_split
ClearErrorsDirective.ts
(() => { class ClearErrorsLink { private _fieldController: any; private _formController: any;
( $scope: ng.IScope, $element: ng.IRootElementService, $attrs: ng.IAttributes, $ctrls ) { 'ngInject'; this._fieldController = $ctrls[0]; this._formController = $ctrls[1]; $scope.$watch($attrs['ngModel'], (newValue)...
constructor
identifier_name
ClearErrorsDirective.ts
(() => { class ClearErrorsLink { private _fieldController: any; private _formController: any; constructor( $scope: ng.IScope, $element: ng.IRootElementService, $attrs: ng.IAttributes, $ctrls ) { 'ngInject'; th...
public clearFormErrors() { this._formController.$serverError = {}; } } function clearErrorsDirective() { return { restrict: 'A', require: ['ngModel', '^?form'], link: function ( $scope: ng.IScope, $element...
{ let errors = this._fieldController.$error; for (let prop in errors) { if (errors.hasOwnProperty(prop) && prop.substring(0, 6) == 'ERROR_') { this._fieldController.$setValidity(prop, true); } } }
identifier_body
chartjs-adapter-luxon.js
/*! * chartjs-adapter-luxon v0.2.0 * https://www.chartjs.org * (c) 2019 Chart.js Contributors * Released under the MIT license */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('chart.js'), require('luxon')) : typeof define === 'function' && define.amd ...
}));
random_line_split
MoN2_alpha_rect.py
from aces.materials.POSCAR import structure as Material class structure(Material): def getPOSCAR(self): return self.getMinimized() def csetup(self): from ase.dft.kpoints import ibz_points #self.bandpoints=ibz_points['hexagonal'] import numpy as np x=0.5*np.cos(np.arange(8)/8.0*2.0*np.pi) y=0.5*np...
1.0000000000000000 2.9916000366000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 5.1814560994168932 0.0000000000000000 0.0000000000000000 0.0000000000000000 25.0000000000000000 Mo N 2 4 Direct 0.5000000000000000 0.5000000000000000 0.5000000000000000 0.000000...
#self.bandpath=['Gamma',"X2"] def getMinimized(self): return """Mo N
random_line_split
MoN2_alpha_rect.py
from aces.materials.POSCAR import structure as Material class structure(Material): def getPOSCAR(self): return self.getMinimized() def csetup(self): from ase.dft.kpoints import ibz_points #self.bandpoints=ibz_points['hexagonal'] import numpy as np x=0.5*np.cos(np.arange(8)/8.0*2.0*np.pi) y=0.5*np...
return """Mo N 1.0000000000000000 2.9916000366000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 5.1814560994168932 0.0000000000000000 0.0000000000000000 0.0000000000000000 25.0000000000000000 Mo N 2 4 Direct 0.5000000000000000 0.5000000000000000 0.5000000000...
identifier_body
MoN2_alpha_rect.py
from aces.materials.POSCAR import structure as Material class structure(Material): def getPOSCAR(self): return self.getMinimized() def csetup(self): from ase.dft.kpoints import ibz_points #self.bandpoints=ibz_points['hexagonal'] import numpy as np x=0.5*np.cos(np.arange(8)/8.0*2.0*np.pi) y=0.5*np...
if(np.abs(y[i])>0.2):y[i]/=np.abs(y[i])*2.0 self.bandpoints['X'+str(i)]=[x[i],y[i],0.0] self.bandpath.append('X'+str(i)) self.bandpath.append('Gamma') #self.bandpath=['Gamma',"X2"] def getMinimized(self): return """Mo N 1.0000000000000000 2.9916000366000000 0.0000000000000000 ...
x[i]/=np.abs(x[i])*2.0
conditional_block
MoN2_alpha_rect.py
from aces.materials.POSCAR import structure as Material class structure(Material): def getPOSCAR(self): return self.getMinimized() def csetup(self): from ase.dft.kpoints import ibz_points #self.bandpoints=ibz_points['hexagonal'] import numpy as np x=0.5*np.cos(np.arange(8)/8.0*2.0*np.pi) y=0.5*np...
(self): return """Mo N 1.0000000000000000 2.9916000366000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 5.1814560994168932 0.0000000000000000 0.0000000000000000 0.0000000000000000 25.0000000000000000 Mo N 2 4 Direct 0.5000000000000000 0.5000000000000000 0....
getMinimized
identifier_name
radio-test.js
import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render, triggerEvent } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import $ from 'jquery'; module('Integration | Component | fm-widget:radio', function(hooks) { setupRenderingTest(hooks);
await render(hbs`{{fm-widgets/radio onUserInteraction=(action this.externalAction)}}`); $('input').trigger('focusout'); }); test('action onUserAction is sent on change event', async function(assert) { assert.expect(1); this.set('externalAction', () => assert.ok(true)); await render(hbs`{{fm-wid...
test('action onUserAction is sent on focus out event', async function(assert) { assert.expect(1); this.set('externalAction', () => assert.ok(true));
random_line_split
decorators_spec.ts
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; import {makeDecorator, makeParamDecorator, Class} from '@angular/core/src/util/decorators'; import {global} from '../../src/facade/lang'; import {Inject} from '@angular/core'; import {reflector} from ...
prototype: 'IGNORE' }); var obj: any = new MyClass('WORKS'); expect(obj.arg).toEqual('WORKS'); expect(obj.works()).toEqual('WORKS'); expect(obj.extendWorks()).toEqual('extend WORKS'); expect(reflector.parameters(MyClass)).toEqual([[String]]); expect(refl...
methodA: [ i0 = new Inject(String), [i1 = Inject(String), Number], function(a: any /** TODO #9100 */, b: any /** TODO #9100 */) {} ], works: function() { return this.arg; },
random_line_split
decorators_spec.ts
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; import {makeDecorator, makeParamDecorator, Class} from '@angular/core/src/util/decorators'; import {global} from '../../src/facade/lang'; import {Inject} from '@angular/core'; import {reflector} from ...
{ terminal = true; } class DecoratedParent {} class DecoratedChild extends DecoratedParent {} export function main() { var Reflect = global.Reflect; var TerminalDecorator = makeDecorator(TerminalAnnotation); var TestDecorator = makeDecorator(TestAnnotation, (fn: any) => fn.Terminal = TerminalDecorator); ...
TerminalAnnotation
identifier_name
decorators_spec.ts
import {beforeEach, ddescribe, describe, expect, iit, inject, it, xit,} from '@angular/core/testing/testing_internal'; import {makeDecorator, makeParamDecorator, Class} from '@angular/core/src/util/decorators'; import {global} from '../../src/facade/lang'; import {Inject} from '@angular/core'; import {reflector} from ...
} class TerminalAnnotation { terminal = true; } class DecoratedParent {} class DecoratedChild extends DecoratedParent {} export function main() { var Reflect = global.Reflect; var TerminalDecorator = makeDecorator(TerminalAnnotation); var TestDecorator = makeDecorator(TestAnnotation, (fn: any) => fn.Termin...
{}
identifier_body
enumerations.py
#===- enumerations.py - Python LLVM Enumerations -------------*- python -*--===# # # The LLVM Compiler Infrastructure #
# #===------------------------------------------------------------------------===# r""" LLVM Enumerations ================= This file defines enumerations from LLVM. Each enumeration is exposed as a list of 2-tuples. These lists are consumed by dedicated types elsewhere in the package. The enumerations are centrally...
# This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details.
random_line_split
PhotoSizeSelectActual.js
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime")...
exports.default = _default;
random_line_split
application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative ...
//= require_tree ./collections //= require_tree ./views //= require_tree ./routers //= require_tree .
//= require_tree ./mixins //= require_tree ./models
random_line_split
IButtonListener.d.ts
/// <reference path="Button.d.ts" /> /// <reference path="IAdaptiveRPGroup.d.ts" /> /// <reference path="IBaseListener.d.ts" /> /// <reference path="IButtonListenerError.d.ts" /> /// <reference path="IButtonListenerWarning.d.ts" /> /** --| ADAPTIVE RUNTIME PLATFORM |-----------------------------------------------------...
-------------------------------------------| aut inveniam viam aut faciam |-------------------------------------------- */ declare module Adaptive { /** Interface for Managing the button operations @author Carlos Lozano Diez @since v2.0 @version 1.0 */ /** @class Adaptiv...
random_line_split
runtests.py
us skip creating migrations for the test models as many of # them depend on one of the following contrib applications. 'auth': None, 'contenttypes': None, 'sessions': None, } log_config = copy.deepcopy(DEFAULT_LOGGING) # Filter out non-error logging so we don't have to captu...
if not test_labels: test_labels = collect_test_modules(start_at, start_after) print('***** Trying paired execution') # Make sure the constant member of the pair isn't in the test list # Also remove tests that need to be run in specific combinations for label in [paired_test, 'model_inheritance...
identifier_body
runtests.py
_label_module(label): """Return the top-level module part for a test label.""" path = Path(label) if len(path.parts) == 1: # Interpret the label as a dotted module name. return label.split('.')[0] # Otherwise, interpret the label as a path. Check existence first to # provide a bette...
(self): raise Exception( 'Please define available_apps in TransactionTestCase and its ' 'subclasses.' ) TransactionTestCase.available_apps = property(no_available_apps) TestCase.available_apps = None # Set an environment variable that other code may consult to see if...
no_available_apps
identifier_name
runtests.py
must come after # django.setup() so that connection.features.gis_enabled can be accessed. if 'gis_tests' in label_modules and not gis_enabled: print('Aborting: A GIS database backend is required to run gis_tests.') sys.exit(1) def _module_match_label(module_name, label): # Exact or...
try: test_labels.remove(label) except ValueError: pass
conditional_block
runtests.py
'flatpages_tests': ['django.contrib.flatpages'], 'redirects_tests': ['django.contrib.redirects'], } def get_test_modules(gis_enabled): """ Scan the tests directory and yield the names of all test modules. The yielded names have either one dotted part like "test_runner" or, in the case of GIS ...
# and isn't in an application in INSTALLED_APPS." CONTRIB_TESTS_TO_APPS = { 'deprecation': ['django.contrib.flatpages', 'django.contrib.redirects'],
random_line_split
metatiles.tsx
<?xml version="1.0" encoding="UTF-8"?> <tileset name="metatiles" tilewidth="32" tileheight="32"> <image source="metatiles.png" width="160" height="64"/> <tile id="0"> <properties> <property name="Collidable" value="True"/> </properties> </tile> <tile id="1"> <properties> <property name="Collidable" valu...
</tile> <tile id="9"> <properties> <property name="Collidable" value="False"/> <property name="Transition" value="Right"/> </properties> </tile> </tileset>
random_line_split
acceptance-test.ts
import { currentURL } from '@ember/test-helpers'; import { module, skip, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; import { setupRelayConnectionMocks } from 'emberclear/tests/helpers'; import { settings } from 'emberclear/tests/helpers/pages/settings'; import { toast } from 'emberclear/t...
assert.equal(messages.length, 2); }); module('Clicking the Delete Messages button', function (hooks) { hooks.beforeEach(async function () { await visit('/settings/danger-zone'); await settings.deleteMessages(); }); test('deletes the messages', async func...
await store.createRecord('message', {}).save(); const messages = await store.findAll('message');
random_line_split
LessonStyles.js
import { Dimensions } from 'react-native' export default { cardContainer: { flex: 1, }, container: { flex: 1, }, coverSubtitle: { color: '#FFF', fontSize: 15, fontWeight: '600', }, coverContainer: { marginBottom: 55, position: 'relative', }, coverImage: { height: Dimen...
justifyContent: 'center', marginHorizontal: 10, marginTop: 30, }, commentsContainer: { alignItems: 'center', flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'center', marginHorizontal: 10, marginTop: 30, }, profileImage: { borderColor: '#FFF', borderRadius: 55...
}, detailsContainer: { alignItems: 'center', flexDirection: 'row', flexWrap: 'wrap',
random_line_split
ImageEmbedModal.tsx
/** * @copyright 2009-2019 Vanilla Forums Inc.
import Button from "@library/forms/Button"; import { ButtonTypes } from "@library/forms/buttonTypes"; import InputTextBlock from "@library/forms/InputTextBlock"; import FrameBody from "@library/layout/frame/FrameBody"; import FrameFooter from "@library/layout/frame/FrameFooter"; import { t } from "@library/utility/app...
* @license GPL-2.0-only */
random_line_split
ImageEmbedModal.tsx
/** * @copyright 2009-2019 Vanilla Forums Inc. * @license GPL-2.0-only */ import Button from "@library/forms/Button"; import { ButtonTypes } from "@library/forms/buttonTypes"; import InputTextBlock from "@library/forms/InputTextBlock"; import FrameBody from "@library/layout/frame/FrameBody"; import FrameFooter from...
props.onSave({ alt, }); props.onClose(); }; const titleID = useUniqueID("modalTitle"); return ( <LazyModal isVisible={props.isVisible} size={ModalSizes.SMALL} titleID={titleID} exitHandler={props.onClose}> <EditorEventWall> <form cla...
{ const classes = embedMenuClasses(); const [alt, setAlt] = useState(props.initialAlt); const inputRef = useRef<HTMLInputElement>(null); const handleTextChange = useCallback((event) => { if (event) { event.stopPropagation(); event.preventDefault(); setAlt(eve...
identifier_body
ImageEmbedModal.tsx
/** * @copyright 2009-2019 Vanilla Forums Inc. * @license GPL-2.0-only */ import Button from "@library/forms/Button"; import { ButtonTypes } from "@library/forms/buttonTypes"; import InputTextBlock from "@library/forms/InputTextBlock"; import FrameBody from "@library/layout/frame/FrameBody"; import FrameFooter from...
( "Alternative text helps users with accessibility concerns and improves SEO.", )} labelClassName={classes.paragraph} inputProps={{ ...
t
identifier_name
ImageEmbedModal.tsx
/** * @copyright 2009-2019 Vanilla Forums Inc. * @license GPL-2.0-only */ import Button from "@library/forms/Button"; import { ButtonTypes } from "@library/forms/buttonTypes"; import InputTextBlock from "@library/forms/InputTextBlock"; import FrameBody from "@library/layout/frame/FrameBody"; import FrameFooter from...
}, []); // Focus the input when opened. useEffect(() => { inputRef.current?.focus(); }, []); const saveAndClose = () => { setAlt(alt); props.onSave({ alt, }); props.onClose(); }; const titleID = useUniqueID("modalTitle"); return ( ...
{ event.stopPropagation(); event.preventDefault(); setAlt(event.target.value || ""); }
conditional_block
ur.py
from ..rerequest import TemplateRequest init_req = TemplateRequest( re = r'(http://)?(www\.)?(?P<domain>ur(play)?)\.se/(?P<req_url>.+)', encode_vars = lambda v: { 'req_url': 'http://%(domain)s.se/%(req_url)s' % v } ) hls = { 'title': 'UR-play', 'url': 'http://urplay.se/', 'feed_url': 'http://urplay.se/rss',...
rtmp = { 'items': [init_req, TemplateRequest( re = r'file_flash":\s?"(?P<final_url>[^"]+\.(?P<ext>mp[34]))".*?"subtitles":\s?"(?P<subtitles>[^",]*)', encode_vars = lambda v: { 'final_url': ('rtmp://130.242.59.75/ondemand playpath=%(ext)s:/%(final_url)s app=ondemand' % v).replace('\\', ''), 'suf...
'suffix-hint': 'mp4', 'subtitles': v.get('subtitles', '').replace('\\', '') % v } )] }
random_line_split
main.py
import atexit from flask import Flask, jsonify, g, request, make_response from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from flask_jwt_extended import JWTManager, set_access_cookies, jwt_required, unset_jwt_cookies from apscheduler.schedulers.background import Bac...
if not verify_password(request.authorization.username, request.authorization.password): response = jsonify({'error':'Invalid username or password'}) return response, 401 token = g.user.generate_auth_token() response = jsonify({'token': token}) set_access_cookies(response, token) r...
response = make_response(jsonify({'error':'Login required'})) response.headers.set('WWW-Authenticate', 'Basic realm="patklaey.ch"') return response, 401
conditional_block
main.py
import atexit from flask import Flask, jsonify, g, request, make_response from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from flask_jwt_extended import JWTManager, set_access_cookies, jwt_required, unset_jwt_cookies from apscheduler.schedulers.background import Bac...
return "Hello, this is an API, Swagger documentation will follow here..." @app.route('/token') def get_auth_token(): if not request.authorization: response = make_response(jsonify({'error':'Login required'})) response.headers.set('WWW-Authenticate', 'Basic realm="patklaey.ch"') return ...
@app.route('/') def index():
random_line_split
main.py
import atexit from flask import Flask, jsonify, g, request, make_response from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from flask_jwt_extended import JWTManager, set_access_cookies, jwt_required, unset_jwt_cookies from apscheduler.schedulers.background import Bac...
@app.route('/token') def get_auth_token(): if not request.authorization: response = make_response(jsonify({'error':'Login required'})) response.headers.set('WWW-Authenticate', 'Basic realm="patklaey.ch"') return response, 401 if not verify_password(request.authorization.username, req...
return "Hello, this is an API, Swagger documentation will follow here..."
identifier_body
main.py
import atexit from flask import Flask, jsonify, g, request, make_response from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from flask_cors import CORS from flask_jwt_extended import JWTManager, set_access_cookies, jwt_required, unset_jwt_cookies from apscheduler.schedulers.background import Bac...
(username, password): user = User.query.filter_by(username=username, active=True).first() if not user or not user.verify_password(password): return False g.user = user return True @app.route('/logout', methods=['POST']) def logout(): resp = jsonify({'logout': True}) unset_jwt_cookies(r...
verify_password
identifier_name
keycloak.d.ts
Host?: string, callback?: (err: Error, grant: Grant) => void): Promise<Grant> /** * Obtain a service account grant. * Client option 'Service Accounts Enabled' needs to be on. * * This method returns or promise or may optionally take a callback function. *
/** * Ensure that a grant is *fresh*, refreshing if required & possible. * * If the access_token is not expired, the grant is left untouched. * * If the access_token is expired, and a refresh_token is available, * the grant is refreshed, in place (no new object is created), * and ...
* @param {Function} callback Optional callback, if not using promises. */ obtainFromClientCredentials (callback?: (err: Error, grant: Grant) => void, scopeParam?: string): Promise<Grant>
random_line_split
App.test.tsx
/* * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j 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, either version 3 of the License, or * (at your...
const mockStore = configureMockStore() const store = mockStore({}) jest.mock('../FeatureToggle/FeatureToggleProvider', () => { return ({ children }: any) => <div>{children}</div> }) jest.mock('./PerformanceOverlay.tsx', () => () => <div />) jest.mock('./styled', () => { const orig = jest.requireActual('./styled')...
import { render } from '@testing-library/react' import React from 'react' import configureMockStore from 'redux-mock-store' import { App } from './App'
random_line_split
metadata.py
# @license # Copyright 2020 Google LLC. 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...
def main(): # Create the directory to store model and data. if os.path.exists(_tmp_dir) and os.path.isdir(_tmp_dir): shutil.rmtree(_tmp_dir) os.mkdir(_tmp_dir) _create_model_with_metadata() if __name__ == '__main__': main()
input_data = constant_op.constant(1., shape=[1]) root = tracking.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) to_save = root.f.get_concrete_function(input_data) save(root, save_dir, to_save) return { ...
identifier_body
metadata.py
# @license # Copyright 2020 Google LLC. 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...
# Create the directory to store model and data. if os.path.exists(_tmp_dir) and os.path.isdir(_tmp_dir): shutil.rmtree(_tmp_dir) os.mkdir(_tmp_dir) _create_model_with_metadata() if __name__ == '__main__': main()
def main():
random_line_split
metadata.py
# @license # Copyright 2020 Google LLC. 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...
main()
conditional_block
metadata.py
# @license # Copyright 2020 Google LLC. 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...
(save_dir): input_data = constant_op.constant(1., shape=[1]) root = tracking.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) to_save = root.f.get_concrete_function(input_data) save(root, save_dir, to_save) ...
_create_saved_model
identifier_name
console.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 http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::ConsoleBinding; use dom::bindings::codegen::Bindings::ConsoleBinding::Consol...
(global: GlobalRef) -> Console { Console { reflector_: Reflector::new(), global: GlobalField::from_rooted(&global), } } pub fn new(global: GlobalRef) -> Root<Console> { reflect_dom_object(box Console::new_inherited(global), global, ConsoleBinding::Wrap) } } ...
new_inherited
identifier_name
console.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 http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::ConsoleBinding; use dom::bindings::codegen::Bindings::ConsoleBinding::Consol...
{ let global = console.global.root(); let pipelineId = global.r().pipeline(); global.r().devtools_chan().as_ref().map(|chan| { chan.send(ScriptToDevtoolsControlMsg::ConsoleAPI( pipelineId, console_message.clone(), global.r().get_worker_id())).unwrap(); }); }
identifier_body
console.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
use dom::bindings::codegen::Bindings::ConsoleBinding::ConsoleMethods; use dom::bindings::global::{GlobalRef, GlobalField}; use dom::bindings::js::Root; use dom::bindings::utils::{Reflector, reflect_dom_object}; use dom::window::WindowHelpers; use devtools_traits::{ConsoleMessage, LogLevel, ScriptToDevtoolsControlMsg}; ...
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::ConsoleBinding;
random_line_split
buffer-builder.js
// Copyright 2015-present runtime.js project authors // // 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 applicab...
} return this; } buffer() { const buf = new Uint8Array(this._p); if (this._ck) { if (this._checksumLast === 0) { this._checksumLast = this._p.length; } const sub = buf.subarray(this._checksumFirst, this._checksumLast); const cksum = this._ck(sub); buf[this._che...
}
random_line_split
buffer-builder.js
// Copyright 2015-present runtime.js project authors // // 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 applicab...
return this; } buffer() { const buf = new Uint8Array(this._p); if (this._ck) { if (this._checksumLast === 0) { this._checksumLast = this._p.length; } const sub = buf.subarray(this._checksumFirst, this._checksumLast); const cksum = this._ck(sub); buf[this._checksum...
{ for (let i = this._repeatFirst; i < this._repeatLast; ++i) { this._p.push(this._p[i]); } }
conditional_block