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
nico.js
var path = require('path'); var package = require('./package'); var webpack = require('webpack'); var ProgressPlugin = require('webpack/lib/ProgressPlugin'); var inspect = require('util').inspect; var Busboy = require('busboy'); var chalk = require('chalk'); var webpackMiddleware = require('webpack-dev-middleware'); va...
lazy: false, watchOptions: { aggregateTimeout: 300, poll: true }, noInfo: true }); try { return handler(req, res, next); } catch(e) {} } }]; exports.writers = [ 'nico-jsx.PageWriter', 'nico-jsx.StaticWriter', 'nico-jsx.FileWriter' ]; // end settings }} ...
handle: function(req, res, next) { handler = handler || webpackMiddleware(webpackCompiler, { publicPath: '/dist/',
random_line_split
SingularValuesSlider.tsx
import * as React from "react"; import * as noUiSlider from "nouislider"; export interface SVSliderProps { value: number; maxSvs: number; max: number; onUpdate: (svs: number) => void; } export class SingularValuesSlider extends React.Component<SVSliderProps> { private sliderElRef: React.RefObject<HTMLDivEle...
private static getSliderValue(noUiSlider: noUiSlider.noUiSlider): number { return Math.round(parseInt(noUiSlider.get() as string, 10)); } private buildSlider(): void { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const sliderEl = this.sliderElRef.current! as HTMLElement; n...
{ this.buildSlider(); }
identifier_body
SingularValuesSlider.tsx
import * as React from "react"; import * as noUiSlider from "nouislider"; export interface SVSliderProps { value: number; maxSvs: number; max: number; onUpdate: (svs: number) => void; } export class SingularValuesSlider extends React.Component<SVSliderProps> { private sliderElRef: React.RefObject<HTMLDivEle...
(): noUiSlider.Options { const maxVal = this.props.max; const maxSvs = this.props.maxSvs; const values: number[] = []; for (let i = 1; i < 20; i++) { values.push(i); } for (let i = 20; i < 100; i += 5) { values.push(i); } for (let i = 100; i < maxVal; i += 10) { values....
getSliderOptions
identifier_name
SingularValuesSlider.tsx
import * as React from "react"; import * as noUiSlider from "nouislider"; export interface SVSliderProps { value: number; maxSvs: number; max: number; onUpdate: (svs: number) => void; } export class SingularValuesSlider extends React.Component<SVSliderProps> { private sliderElRef: React.RefObject<HTMLDivEle...
} if (this.props.value !== SingularValuesSlider.getSliderValue(slider)) { // hacky slider.set(this.props.value); } if (this.props.maxSvs !== prevProps.maxSvs) { slider.destroy(); this.buildSlider(); } } componentDidMount(): void { this.buildSlider(); } private sta...
} componentDidUpdate(prevProps: SVSliderProps): void { const slider = this.getNoUiSlider(); if (!slider) { return;
random_line_split
SingularValuesSlider.tsx
import * as React from "react"; import * as noUiSlider from "nouislider"; export interface SVSliderProps { value: number; maxSvs: number; max: number; onUpdate: (svs: number) => void; } export class SingularValuesSlider extends React.Component<SVSliderProps> { private sliderElRef: React.RefObject<HTMLDivEle...
if (v % 20 === 0) { return 2; } return 0; }, }, }; } }
{ return 2; }
conditional_block
solar_system_acquisition_form.py
from django import forms from django.utils.translation import ugettext_lazy as _ from astrobin.models import SolarSystem_Acquisition class SolarSystem_AcquisitionForm(forms.ModelForm): error_css_class = 'error' date = forms.DateField( required=False, input_formats=['%Y-%m-%d'], widge...
'fps', 'exposure_per_frame', 'focal_length', 'cmi', 'cmii', 'cmiii', 'seeing', 'transparency', ) widgets = { 'date': forms.TextInput(attrs={'class': 'datepickerclass', 'autocomplete': 'off'}), ...
model = SolarSystem_Acquisition fields = ( 'date', 'time', 'frames',
random_line_split
solar_system_acquisition_form.py
from django import forms from django.utils.translation import ugettext_lazy as _ from astrobin.models import SolarSystem_Acquisition class SolarSystem_AcquisitionForm(forms.ModelForm): error_css_class = 'error' date = forms.DateField( required=False, input_formats=['%Y-%m-%d'], widge...
class Meta: model = SolarSystem_Acquisition fields = ( 'date', 'time', 'frames', 'fps', 'exposure_per_frame', 'focal_length', 'cmi', 'cmii', 'cmiii', 'seeing', 'trans...
data = self.cleaned_data['transparency'] if data and data not in list(range(1, 11)): raise forms.ValidationError(_("Please enter a value between 1 and 10.")) return data
identifier_body
solar_system_acquisition_form.py
from django import forms from django.utils.translation import ugettext_lazy as _ from astrobin.models import SolarSystem_Acquisition class SolarSystem_AcquisitionForm(forms.ModelForm): error_css_class = 'error' date = forms.DateField( required=False, input_formats=['%Y-%m-%d'], widge...
return data class Meta: model = SolarSystem_Acquisition fields = ( 'date', 'time', 'frames', 'fps', 'exposure_per_frame', 'focal_length', 'cmi', 'cmii', 'cmiii', 'seeing...
raise forms.ValidationError(_("Please enter a value between 1 and 10."))
conditional_block
solar_system_acquisition_form.py
from django import forms from django.utils.translation import ugettext_lazy as _ from astrobin.models import SolarSystem_Acquisition class SolarSystem_AcquisitionForm(forms.ModelForm): error_css_class = 'error' date = forms.DateField( required=False, input_formats=['%Y-%m-%d'], widge...
(self): data = self.cleaned_data['seeing'] if data and data not in list(range(1, 6)): raise forms.ValidationError(_("Please enter a value between 1 and 5.")) return data def clean_transparency(self): data = self.cleaned_data['transparency'] if data and data not ...
clean_seeing
identifier_name
migrations_spec.ts
import { expect } from 'chai' import { cloneDeep } from 'lodash' import * as deepFreeze from 'deep-freeze-strict' import { SCHEMA_VERSION } from './consts' import { migrate_to_latest } from './migrations' import { State } from './types' import { DEMO_STATE, OLDEST_LEGACY_STATE_FOR_TESTS, MIGRATION_HINTS_FOR_TESTS } f...
migrate_to_latest({ schema_version: 99999 }) } expect(load).to.throw('more recent version') }) }) context('when the version is up to date', function() { it('should return the state without change', () => { expect(DATA_LATEST.schema_version).to.equal(SCHEMA_VERSION) // make sure our tests are up to date...
identifier_name
migrations_spec.ts
import { expect } from 'chai' import { cloneDeep } from 'lodash' import * as deepFreeze from 'deep-freeze-strict' import { SCHEMA_VERSION } from './consts' import { migrate_to_latest } from './migrations' import { State } from './types' import { DEMO_STATE, OLDEST_LEGACY_STATE_FOR_TESTS, MIGRATION_HINTS_FOR_TESTS } f...
})
}) })
random_line_split
migrations_spec.ts
import { expect } from 'chai' import { cloneDeep } from 'lodash' import * as deepFreeze from 'deep-freeze-strict' import { SCHEMA_VERSION } from './consts' import { migrate_to_latest } from './migrations' import { State } from './types' import { DEMO_STATE, OLDEST_LEGACY_STATE_FOR_TESTS, MIGRATION_HINTS_FOR_TESTS } f...
t(load).to.throw('more recent version') }) }) context('when the version is up to date', function() { it('should return the state without change', () => { expect(DATA_LATEST.schema_version).to.equal(SCHEMA_VERSION) // make sure our tests are up to date expect(migrate_to_latest(cloneDeep(DATA_LATEST))).to.d...
rate_to_latest({ schema_version: 99999 }) } expec
identifier_body
Binary.js
/* * is/Binary.js * * David Janes * IOTDB.org * 2019-10-22 * * Copyright (2013-2020) David P. Janes * * 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.apa...
*/ "use strict" const _ = require("iotdb-helpers") const mongodb = require("mongodb") const isBinary = v => v instanceof mongodb.Binary /** * API */ exports.Binary = isBinary
* See the License for the specific language governing permissions and * limitations under the License.
random_line_split
shadowed-argument.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 ...
(x: bool, y: bool) { zzz(); sentinel(); let x = 10; zzz(); sentinel(); let x = 10.5; let y = 20; zzz(); sentinel(); } fn main() { a_function(false, true); } fn zzz() {()} fn sentinel() {()}
a_function
identifier_name
shadowed-argument.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 ...
fn a_function(x: bool, y: bool) { zzz(); sentinel(); let x = 10; zzz(); sentinel(); let x = 10.5; let y = 20; zzz(); sentinel(); } fn main() { a_function(false, true); } fn zzz() {()} fn sentinel() {()}
// debugger:print y // check:$6 = 20 // debugger:continue
random_line_split
shadowed-argument.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 ...
fn sentinel() {()}
{()}
identifier_body
file_matcher_glob_tests.py
from nose.tools import * from unittest import TestCase import os from shutil import rmtree from tempfile import mkdtemp from fnmatch import fnmatch from files.file_matcher_glob import FileMatcherGlob class FileMatcherGlobTests(TestCase): def
(self): self.directory = mkdtemp('-caboose-file-matcher-glob-tests') def tearDown(self): rmtree(self.directory) def test_file_matcher_matches_against_glob(self): self.file_matcher = FileMatcherGlob("*.java") eq_(True, self.file_matcher.match("hello.java")) eq_(False, se...
setUp
identifier_name
file_matcher_glob_tests.py
from nose.tools import * from unittest import TestCase import os from shutil import rmtree from tempfile import mkdtemp from fnmatch import fnmatch from files.file_matcher_glob import FileMatcherGlob class FileMatcherGlobTests(TestCase): def setUp(self): self.directory = mkdtemp('-caboose-file-matcher-gl...
def test_file_matcher_matches_against_glob(self): self.file_matcher = FileMatcherGlob("*.java") eq_(True, self.file_matcher.match("hello.java")) eq_(False, self.file_matcher.match("hello.java2")) def test_file_matcher_matches_against_unicode_glob(self): self.file_match...
rmtree(self.directory)
identifier_body
file_matcher_glob_tests.py
from nose.tools import * from unittest import TestCase import os from shutil import rmtree from tempfile import mkdtemp from fnmatch import fnmatch from files.file_matcher_glob import FileMatcherGlob class FileMatcherGlobTests(TestCase): def setUp(self): self.directory = mkdtemp('-caboose-file-matcher-gl...
rmtree(self.directory) def test_file_matcher_matches_against_glob(self): self.file_matcher = FileMatcherGlob("*.java") eq_(True, self.file_matcher.match("hello.java")) eq_(False, self.file_matcher.match("hello.java2")) def test_file_matcher_matches_against_unicode_glob(...
def tearDown(self):
random_line_split
da-GL.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js export default [ 'da-GL...
if (n === 1 || !(t === 0) && (i === 0 || i === 1)) return 1; return 5; } ];
['#,##0.###', '#,##0 %', '#,##0.00 ¤', '#E0'], 'kr.', 'dansk krone', function(n: number): number { let i = Math.floor(Math.abs(n)), t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
random_line_split
lassplit.py
# -*- coding: utf-8 -*-
*************************************************************************** lassplit.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ***********************************************************...
"""
random_line_split
lassplit.py
# -*- coding: utf-8 -*- """ *************************************************************************** lassplit.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
(LasToolsAlgorithm): INPUT = "INPUT" OUTPUT = "OUTPUT" NUM_POINTS = "NUM_POINTS" def defineCharacteristics(self): self.name = "lassplit" self.group = "Tools" self.addParameter(ParameterFile(lassplit.INPUT, "Input las layer")) self.addParameter(ParameterNumber(lassplit.N...
lassplit
identifier_name
lassplit.py
# -*- coding: utf-8 -*- """ *************************************************************************** lassplit.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ******************************...
commands = [os.path.join(LasToolsUtils.LasToolsPath(), "bin", "lassplit.exe")] commands.append("-i") commands.append(self.getParameterValue(lassplit.INPUT)) commands.append("-o") commands.append(self.getOutputValue(lassplit.OUTPUT)) commands.append("-split") commands.appe...
identifier_body
urls.py
# Copyright 2008 Google Inc. # # 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 #
# 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 License. from django.conf.urls.defaults import * import re urlpatterns = patterns...
# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software
random_line_split
ref.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from __future__ import unicode_literals from _...
if home_path.endswith("/"): home_path = home_path[:-1] ref.path = home_path + ref.path[1::] elif not ref.path.startswith("/"): # CONVERT RELATIVE TO ABSOLUTE ref.path = "/".join(url.path.rstrip("/").split("/")[:-1]) + "/" + ref.path path = ref.path if os.sep != "\\...
home_path = "/" + home_path.replace(os.sep, "/")
conditional_block
ref.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from __future__ import unicode_literals from _...
global _convert global _Log global _Except from pyLibrary import convert as _convert from pyLibrary.debugs.logs import Log as _Log from pyLibrary.debugs.exceptions import Except as _Except _ = _convert _ = _Log _ = _Except def get(url): """ USE json.net CONVENTIONS TO LINK...
def _late_import():
random_line_split
ref.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from __future__ import unicode_literals from _...
(ref, url): from pyLibrary.env import http params = url.query new_value = _convert.json2value(http.get(ref), params=params, flexible=True, leaves=True) return new_value def get_env(ref, url): # GET ENVIRONMENT VARIABLES ref = ref.host try: new_value = _convert.json2value(os.enviro...
get_http
identifier_name
ref.py
# encoding: utf-8 # # # 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/. # # Author: Kyle Lahnakoski (kyle@lahnakoski.com) # from __future__ import unicode_literals from _...
scheme_loaders = { "http": get_http, "file": get_file, "env": get_env, "param": get_param }
param = url.query new_value = param[ref.host] return new_value
identifier_body
dropdown.js
/* ======================================================================== * Bootstrap: dropdown.js v3.0.0 * http://twbs.github.com/bootstrap/javascript.html#dropdowns * ======================================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, ...
function getParent($this) { var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } var $parent = selector && $(selector) ...
{ $(backdrop).remove() $(toggle).each(function (e) { var $parent = getParent($(this)) if (!$parent.hasClass('open')) { return } $parent.trigger(e = $.Event('hide.bs.dropdown')) if (e.isDefaultPrevented()) { retur...
identifier_body
dropdown.js
/* ======================================================================== * Bootstrap: dropdown.js v3.0.0 * http://twbs.github.com/bootstrap/javascript.html#dropdowns * ======================================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, ...
$parent .toggleClass('open') .trigger('shown.bs.dropdown') $this.focus() } return false } Dropdown.prototype.keydown = function (e) { if (!/(38|40|27)/.test(e.keyCode)) { return } var $this = $(this) ...
{ return }
conditional_block
dropdown.js
/* ======================================================================== * Bootstrap: dropdown.js v3.0.0 * http://twbs.github.com/bootstrap/javascript.html#dropdowns * ======================================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, ...
} // down if (!~index) { index = 0 } $items.eq(index).focus() } function clearMenus() { $(backdrop).remove() $(toggle).each(function (e) { var $parent = getParent($(this)) if (!$parent.hasClass('open')) ...
} // up if (e.keyCode == 40 && index < $items.length - 1) { index++
random_line_split
dropdown.js
/* ======================================================================== * Bootstrap: dropdown.js v3.0.0 * http://twbs.github.com/bootstrap/javascript.html#dropdowns * ======================================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, ...
() { $(backdrop).remove() $(toggle).each(function (e) { var $parent = getParent($(this)) if (!$parent.hasClass('open')) { return } $parent.trigger(e = $.Event('hide.bs.dropdown')) if (e.isDefaultPrevented()) { re...
clearMenus
identifier_name
other.py
""" accounts FILE: forms.py Created: 6/21/15 8:31 PM """ __author__ = 'Mark Scrimshire:@ekivemark' from django.conf import settings from django import forms from django.utils.safestring import mark_safe from registration.forms import (RegistrationFormUniqueEmail, RegistrationFormTerms...
(self, value): if settings.DEBUG: print("email is ", value) value = value.lower() super(Email, self).clean(value) try: User.objects.get(email=value) raise forms.ValidationError(mark_safe( "This email is already registered. <br/>Use <a h...
clean
identifier_name
other.py
""" accounts FILE: forms.py Created: 6/21/15 8:31 PM """ __author__ = 'Mark Scrimshire:@ekivemark' from django.conf import settings from django import forms from django.utils.safestring import mark_safe from registration.forms import (RegistrationFormUniqueEmail, RegistrationFormTerms...
return self.data['password1'] class RegistrationFormUserTOSAndEmail(UserRegistrationForm, RegistrationFormUniqueEmail, RegistrationFormTermsOfService, ): class Meta: model = User ...
raise forms.ValidationError('Passwords are not the same')
conditional_block
other.py
""" accounts FILE: forms.py Created: 6/21/15 8:31 PM """ __author__ = 'Mark Scrimshire:@ekivemark' from django.conf import settings from django import forms from django.utils.safestring import mark_safe from registration.forms import (RegistrationFormUniqueEmail, RegistrationFormTerms...
class Email(forms.EmailField): def clean(self, value): if settings.DEBUG: print("email is ", value) value = value.lower() super(Email, self).clean(value) try: User.objects.get(email=value) raise forms.ValidationError(mark_safe( "Thi...
from accounts.models import User
random_line_split
other.py
""" accounts FILE: forms.py Created: 6/21/15 8:31 PM """ __author__ = 'Mark Scrimshire:@ekivemark' from django.conf import settings from django import forms from django.utils.safestring import mark_safe from registration.forms import (RegistrationFormUniqueEmail, RegistrationFormTerms...
class RegistrationFormUserTOSAndEmail(UserRegistrationForm, RegistrationFormUniqueEmail, RegistrationFormTermsOfService, ): class Meta: model = User fields = ['user', ...
if self.data['password1'] != self.data['password2']: raise forms.ValidationError('Passwords are not the same') return self.data['password1']
identifier_body
QueryField.tsx
import { css } from '@emotion/css'; import { GrafanaTheme2, QueryEditorProps } from '@grafana/data'; import { ButtonCascader, CascaderOption, FileDropzone, InlineField, InlineFieldRow, RadioButtonGroup, useTheme2, QueryField, useStyles2, } from '@grafana/ui'; import { notifyApp } from 'app/core/action...
[onChange, onRunQuery, query] ); const onChangeQuery = (value: string) => { const nextQuery = { ...query, query: value }; onChange(nextQuery); }; let cascaderOptions = useMapToCascaderOptions(serviceOptions, allOptions); return ( <> <InlineFieldRow> <InlineField label="Query t...
onRunQuery(); } },
random_line_split
baseFilter.js
>= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") re...
BaseFilter.prototype.init = function (params) { this.filterParams = params; this.defaultFilter = this.filterParams.defaultOption; if (this.filterParams.filterOptions) { if (this.filterParams.filterOptions.lastIndexOf(BaseFilter.EQUALS) < 0) { this.defaultFilter =...
{ return _super !== null && _super.apply(this, arguments) || this; }
identifier_body
baseFilter.js
>= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") re...
() { return _super !== null && _super.apply(this, arguments) || this; } ComparableBaseFilter.prototype.init = function (params) { _super.prototype.init.call(this, params); this.addDestroyableEventListener(this.eTypeSelector, "change", this.onFilterTypeChanged.bind(this)); }; Comp...
ComparableBaseFilter
identifier_name
baseFilter.js
i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") ...
this.onFilterChanged(); }; BaseFilter.prototype.onNewRowsLoaded = function () { if (!this.newRowsActionKeep) { this.resetState(); } }; BaseFilter.prototype.getModel = function () { if (this.isFilterActive()) { return this.serialize(); } ...
} else { this.resetState(); }
random_line_split
baseFilter.js
(BaseFilter.EQUALS) < 0) { this.defaultFilter = this.filterParams.filterOptions[0]; } } this.customInit(); this.filter = this.defaultFilter; this.clearActive = params.clearButton === true; //Allowing for old param property apply, even though is not adv...
{ return compareResult <= 0 && (value != null); }
conditional_block
urls.py
"""tictactoe URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-bas...
1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path, include from django.conf.urls.static import static from tictactoe import settings urlpatterns = [ pat...
1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf
random_line_split
ios.py
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
(module, flags=None): flag_str = ' '.join(to_list(flags)) try: return _DEVICE_CONFIGS[flag_str] except KeyError: connection = get_connection(module) out = connection.get_config(filter=flags) cfg = to_text(out, errors='surrogate_then_replace').strip() _DEVICE_CONFIGS[...
get_config
identifier_name
ios.py
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
def get_connection(module): if hasattr(module, '_ios_connection'): return module._ios_connection capabilities = get_capabilities(module) network_api = capabilities.get('network_api') if network_api == 'cliconf': module._ios_connection = Connection(module._socket_path) else: ...
return ios_provider_spec
identifier_body
ios.py
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
capabilities = Connection(module._socket_path).get_capabilities() module._ios_capabilities = json.loads(capabilities) return module._ios_capabilities def check_args(module, warnings): pass def get_defaults_flag(module): connection = get_connection(module) out = connection.get('show running...
return module._ios_capabilities
conditional_block
ios.py
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
responses = list() connection = get_connection(module) for cmd in to_list(commands): if isinstance(cmd, dict): command = cmd['command'] prompt = cmd['prompt'] answer = cmd['answer'] else: command = cmd prompt = None ans...
return transform(commands) def run_commands(module, commands, check_rc=True):
random_line_split
xcrate.rs
// Copyright 2017 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 ...
use f as f2; mod bar { pub fn g() {} use baz::h; pub macro test() { use std::mem; use foo::cell; ::f(); ::f2(); g(); h(); ::bar::h(); } } mod baz { pub fn h() {} }
{}
identifier_body
xcrate.rs
// Copyright 2017 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 ...
extern crate std as foo; pub fn f() {} use f as f2; mod bar { pub fn g() {} use baz::h; pub macro test() { use std::mem; use foo::cell; ::f(); ::f2(); g(); h(); ::bar::h(); } } mod baz { pub fn h() {} }
pub use bar::test;
random_line_split
xcrate.rs
// Copyright 2017 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 ...
() {} use baz::h; pub macro test() { use std::mem; use foo::cell; ::f(); ::f2(); g(); h(); ::bar::h(); } } mod baz { pub fn h() {} }
g
identifier_name
fleet.py
# -*- coding:utf-8 -*- # # # Copyright (C) 2015 Clear ICT Solutions <info@clearict.com>. # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either ver...
return res # Fields # department = fields.Many2one('hr.department', default=_get_user_department)
if employee.department_id: res = employee.department_id break
conditional_block
fleet.py
# -*- coding:utf-8 -*- # # # Copyright (C) 2015 Clear ICT Solutions <info@clearict.com>. # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either ver...
_inherit = 'fleet.vehicle' @api.model def _get_user_department(self): res = self.env['hr.department'] for employee in self.env.user.employee_ids: if employee.department_id: res = employee.department_id break return res # Fields # ...
identifier_body
fleet.py
# -*- coding:utf-8 -*- # # # Copyright (C) 2015 Clear ICT Solutions <info@clearict.com>. # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either ver...
(self): res = self.env['hr.department'] for employee in self.env.user.employee_ids: if employee.department_id: res = employee.department_id break return res # Fields # department = fields.Many2one('hr.department', default=_get_user_depar...
_get_user_department
identifier_name
fleet.py
# -*- coding:utf-8 -*- # # # Copyright (C) 2015 Clear ICT Solutions <info@clearict.com>. # All Rights Reserved. #
# the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # ...
# This program is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published by
random_line_split
TestCase_Web_Baspd.py
#coding=utf-8 #author='Shichao-Dong' import unittest import Web_Method_Baspd import Public_Base_Method import requests import time import HTMLTestRunner class ST_Bas_pd(unittest.TestCase): u'商品功能性测试' def setUp(self): global cookie r = Public_Base_Method.login_func("172.31.3.73:6020", "dongshi...
suite.addTest(ST_Bas_pd("test_pd_queryData_onsale")) suite.addTest(ST_Bas_pd("test_pd_queryData_offsale")) runner=unittest.TextTestRunner() runner.run(suite) # #定义报告路径及名称 # now = time.strftime("%Y-%m-%d-%H-%M-%S",time.localtime(time.time())) # filename=r'D://Ptest/Report/'+now+'result.html...
if __name__=="__main__": suite=unittest.TestSuite() suite.addTest(ST_Bas_pd("test_pd_queryData_all"))
random_line_split
TestCase_Web_Baspd.py
#coding=utf-8 #author='Shichao-Dong' import unittest import Web_Method_Baspd import Public_Base_Method import requests import time import HTMLTestRunner class ST_Bas_pd(unittest.TestCase): u'商品功能性测试' def setUp(self): global cookie r = Public_Base_Method.login_func("172.31.3.73:6020", "dongshi...
thod_Baspd.pd_query_onsale(cookie) print r.status_code print r.content self.assertTrue('r.status_code==200',msg='获取在售商品失败') def test_pd_queryData_offsale(self): u'查询停售商品' r=Web_Method_Baspd.pd_query_offsale(cookie) print r.status_code self.assertTrue('r.statu...
查询在售商品' r=Web_Me
identifier_name
TestCase_Web_Baspd.py
#coding=utf-8 #author='Shichao-Dong' import unittest import Web_Method_Baspd import Public_Base_Method import requests import time import HTMLTestRunner class ST_Bas_pd(unittest.TestCase): u'商品功能性测试' def setUp(self): global cookie r = Public_Base_Method.login_func("172.31.3.73:6020", "dongshi...
queryData_all")) suite.addTest(ST_Bas_pd("test_pd_queryData_onsale")) suite.addTest(ST_Bas_pd("test_pd_queryData_offsale")) runner=unittest.TextTestRunner() runner.run(suite) # #定义报告路径及名称 # now = time.strftime("%Y-%m-%d-%H-%M-%S",time.localtime(time.time())) # filename=r'D://Ptest/Report/'...
print r.status_code self.assertTrue('r.status_code==200',msg='获取停售商品失败') if __name__=="__main__": suite=unittest.TestSuite() suite.addTest(ST_Bas_pd("test_pd_
identifier_body
TestCase_Web_Baspd.py
#coding=utf-8 #author='Shichao-Dong' import unittest import Web_Method_Baspd import Public_Base_Method import requests import time import HTMLTestRunner class ST_Bas_pd(unittest.TestCase): u'商品功能性测试' def setUp(self): global cookie r = Public_Base_Method.login_func("172.31.3.73:6020", "dongshi...
(ST_Bas_pd("test_pd_queryData_onsale")) suite.addTest(ST_Bas_pd("test_pd_queryData_offsale")) runner=unittest.TextTestRunner() runner.run(suite) # #定义报告路径及名称 # now = time.strftime("%Y-%m-%d-%H-%M-%S",time.localtime(time.time())) # filename=r'D://Ptest/Report/'+now+'result.html' # fp=open(f...
conditional_block
skeletonmm-tarball.py
#!/usr/bin/env python3 # External command, intended to be called with run_command() or custom_target() # in meson.build # argv[1] argv[2] argv[3:] # skeletonmm-tarball.py <output_file_or_check> <source_dir> <input_files...> import os import sys import shutil import tarfil...
# Errors raise exceptions. If an exception is raised, Meson+ninja will notice # that the command failed, despite exit(0). sys.exit(0) # shutil.make_archive() might be an alternative, but it only archives # whole directories. It's not useful, if you want to have full control # of which files are archived.
tar_file.add(file)
conditional_block
skeletonmm-tarball.py
#!/usr/bin/env python3 # External command, intended to be called with run_command() or custom_target() # in meson.build # argv[1] argv[2] argv[3:] # skeletonmm-tarball.py <output_file_or_check> <source_dir> <input_files...> import os import sys import shutil import tarfil...
with tarfile.open(output_file, mode=mode) as tar_file: os.chdir(source_dir) # Input filenames are relative to source_dir. for file in sys.argv[3:]: tar_file.add(file) # Errors raise exceptions. If an exception is raised, Meson+ninja will notice # that the command failed, despite exit(0). sys.exit(0) # shutil.m...
mode = 'w'
random_line_split
family.rs
//! Queue family and groups. use crate::{queue::QueueType, Backend}; use std::{any::Any, fmt::Debug}; /// General information about a queue family, available upon adapter discovery. /// /// Note that a backend can expose multiple queue families with the same properties. /// /// Can be obtained from an [adapter][crat...
/// Add a command queue to the group. /// /// The queue needs to be created from this queue family. pub fn add_queue(&mut self, queue: B::Queue) { self.queues.push(queue); } }
{ QueueGroup { family, queues: Vec::new(), } }
identifier_body
family.rs
//! Queue family and groups. use crate::{queue::QueueType, Backend}; use std::{any::Any, fmt::Debug}; /// General information about a queue family, available upon adapter discovery. /// /// Note that a backend can expose multiple queue families with the same properties. /// /// Can be obtained from an [adapter][crat...
(&mut self, queue: B::Queue) { self.queues.push(queue); } }
add_queue
identifier_name
family.rs
//! Queue family and groups. use crate::{queue::QueueType, Backend}; use std::{any::Any, fmt::Debug}; /// General information about a queue family, available upon adapter discovery. /// /// Note that a backend can expose multiple queue families with the same properties. /// /// Can be obtained from an [adapter][crat...
/// Identifier for a queue family of a physical device. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct QueueFamilyId(pub usize); /// Bare-metal queue group. /// /// Denotes all queues created from one queue family. #[derive(Debug)] pub struc...
random_line_split
init.ts
import * as AV from 'leancloud-storage'; // export const APP_ID = process.env.APP_ID || 'WI5a89CtPIOrWpvIwzNfOg9R-MdYXbMMI'; // export const APP_KEY = process.env.APP_KEY || 'RUoMOSD8RNlpd0MIIiSDi7BU'; // export const REGION = process.env.REGION || 'us'; export const APP_ID = process.env.APP_ID || 'uay57kigwe0b6f5n0e...
export const REGION = process.env.REGION || 'cn'; AV.init({ appId: APP_ID, appKey: APP_KEY, region: REGION });
random_line_split
q_setprot.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2018 Miha Purg <miha.purg@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
# # # Takes as arguments: # - pdb structure # - file containing residue indexes that should be charged # (each in new line or space separated) # # Renames the ARG,GLU,ASP,LYS that should be neutral to ARN,GLH,ASH and LYN # and vice versa # from __future__ import absolute_import, print_function from __future__...
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. #
random_line_split
q_setprot.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2018 Miha Purg <miha.purg@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, ...
new_pdb += new_line backup = backup_file(args.outfn) if backup: print("Backed up '{}' to '{}'".format(args.outfn, backup)) open(args.outfn, 'w').write(new_pdb) print("Wrote " + args.outfn)
new_line = line
conditional_block
view1.js
'use strict'; angular.module('myApp.view1', ['ngRoute', 'services', 'top-nav']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/view1', { templateUrl: 'view1/view1.html', controller: 'View1Ctrl as vm' }); }]) .controller('View1Ctrl', ['ItemService', '$location', 'PaymentServic...
function viewItem(item) { $location.url('view2/' + item.id); } }]);
random_line_split
view1.js
'use strict'; angular.module('myApp.view1', ['ngRoute', 'services', 'top-nav']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/view1', { templateUrl: 'view1/view1.html', controller: 'View1Ctrl as vm' }); }]) .controller('View1Ctrl', ['ItemService', '$location', 'PaymentServic...
() { vm.items = ItemService.getItems(); //PaymentService.buyItem(); Put this where users can pay for an item } function viewItem(item) { $location.url('view2/' + item.id); } }]);
init
identifier_name
view1.js
'use strict'; angular.module('myApp.view1', ['ngRoute', 'services', 'top-nav']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/view1', { templateUrl: 'view1/view1.html', controller: 'View1Ctrl as vm' }); }]) .controller('View1Ctrl', ['ItemService', '$location', 'PaymentServic...
function viewItem(item) { $location.url('view2/' + item.id); } }]);
{ vm.items = ItemService.getItems(); //PaymentService.buyItem(); Put this where users can pay for an item }
identifier_body
all_examples3.rs
#![allow(dead_code)] extern crate nalgebra as na; extern crate ncollide3d; extern crate nphysics3d; extern crate nphysics_testbed3d; macro_rules! r( ($e: expr) => { nalgebra::convert::<f64, N>($e) } ); use inflector::Inflector; use nphysics_testbed3d::Testbed; mod balls3; mod boxes3; mod broad_phas...
#[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] fn demo_name_from_url() -> Option<String> { None } fn main() { type Real = f32; // simba::scalar::FixedI40F24; let demo = demo_name_from_command_line() .or_else(|| demo_name_from_url()) .unwrap_or(String::new()) .to_...
{ let window = stdweb::web::window(); let hash = window.location()?.search().ok()?; if !hash.is_empty() { Some(hash[1..].to_string()) } else { None } }
identifier_body
all_examples3.rs
#![allow(dead_code)] extern crate nalgebra as na; extern crate ncollide3d; extern crate nphysics3d; extern crate nphysics_testbed3d; macro_rules! r( ($e: expr) => { nalgebra::convert::<f64, N>($e) } ); use inflector::Inflector; use nphysics_testbed3d::Testbed; mod balls3; mod boxes3; mod broad_phas...
fn demo_name_from_url() -> Option<String> { None } fn main() { type Real = f32; // simba::scalar::FixedI40F24; let demo = demo_name_from_command_line() .or_else(|| demo_name_from_url()) .unwrap_or(String::new()) .to_camel_case(); let mut builders: Vec<(_, fn(&mut Testbed<Real>...
None } } #[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))]
random_line_split
all_examples3.rs
#![allow(dead_code)] extern crate nalgebra as na; extern crate ncollide3d; extern crate nphysics3d; extern crate nphysics_testbed3d; macro_rules! r( ($e: expr) => { nalgebra::convert::<f64, N>($e) } ); use inflector::Inflector; use nphysics_testbed3d::Testbed; mod balls3; mod boxes3; mod broad_phas...
} None } #[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] fn demo_name_from_url() -> Option<String> { let window = stdweb::web::window(); let hash = window.location()?.search().ok()?; if !hash.is_empty() { Some(hash[1..].to_string()) } else { None } } #[cfg(not(...
{ return args.next(); }
conditional_block
all_examples3.rs
#![allow(dead_code)] extern crate nalgebra as na; extern crate ncollide3d; extern crate nphysics3d; extern crate nphysics_testbed3d; macro_rules! r( ($e: expr) => { nalgebra::convert::<f64, N>($e) } ); use inflector::Inflector; use nphysics_testbed3d::Testbed; mod balls3; mod boxes3; mod broad_phas...
() -> Option<String> { let mut args = std::env::args(); while let Some(arg) = args.next() { if &arg[..] == "--example" { return args.next(); } } None } #[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] fn demo_name_from_url() -> Option<String> { let window = s...
demo_name_from_command_line
identifier_name
0002_auto__chg_field_message_updated.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Message.updated' db.alter_column(u'mailer_message', 'u...
} complete_apps = ['mailer']
'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) }
random_line_split
0002_auto__chg_field_message_updated.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Message.updated' db.alter_column(u'mailer_message', 'u...
(self, orm): # Changing field 'Message.updated' db.alter_column(u'mailer_message', 'updated', self.gf('django.db.models.fields.DateTimeField')()) models = { u'mailer.message': { 'Meta': {'object_name': 'Message'}, 'created': ('django.db.models.fields.DateTimeField',...
backwards
identifier_name
0002_auto__chg_field_message_updated.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Changing field 'Message.updated'
def backwards(self, orm): # Changing field 'Message.updated' db.alter_column(u'mailer_message', 'updated', self.gf('django.db.models.fields.DateTimeField')()) models = { u'mailer.message': { 'Meta': {'object_name': 'Message'}, 'created': ('django.db.models.fie...
db.alter_column(u'mailer_message', 'updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True))
identifier_body
express.js
'use strict'; /** * Module dependencies. */ var express = require('express'); var load = require('express-load'); var bodyParser = require('body-parser'); var session = require('express-session'); module.exports = function(){ var app = express(); // all environments app.set('port', process.env.PORT || 80); ...
return app; };
.then('business') .then('controllers') .then('routes') .into(app);
random_line_split
express.js
'use strict'; /** * Module dependencies. */ var express = require('express'); var load = require('express-load'); var bodyParser = require('body-parser'); var session = require('express-session'); module.exports = function(){ var app = express(); // all environments app.set('port', process.env.PORT || 80); ...
next(); }); load('models', {cwd: 'server'}) // .then('helpers') .then('db') .then('dao') .then('business') .then('controllers') .then('routes') .into(app); return app; };
{ res.contentType('application/hal+json'); }
conditional_block
cable_distributors.py
"""This file is part of DING0, the DIstribution Network GeneratOr. DING0 is a tool to generate synthetic medium and low voltage power distribution grids based on open data. It is developed in the project open_eGo: https://openegoproject.wordpress.com DING0 lives at github: https://github.com/openego/ding0/ The docume...
from . import CableDistributorDing0 class MVCableDistributorDing0(CableDistributorDing0): """ MV Cable distributor (connection point) Attributes ---------- lv_load_area_group : Description #TODO """ def __init__(self, **kwargs): super().__init__(**kwargs) self...
__url__ = "https://github.com/openego/ding0/blob/master/LICENSE" __author__ = "nesnoj, gplssm"
random_line_split
cable_distributors.py
"""This file is part of DING0, the DIstribution Network GeneratOr. DING0 is a tool to generate synthetic medium and low voltage power distribution grids based on open data. It is developed in the project open_eGo: https://openegoproject.wordpress.com DING0 lives at github: https://github.com/openego/ding0/ The docume...
(self): """ :obj:`str`: Returns ...#TODO """ return '_'.join(['MV', str(self.grid.id_db), 'cld', str(self.id_db)]) def __repr__(self): return 'mv_cable_dist_' + repr(self.grid) + '_' + str(self.id_db) class LVCableDistributorDing0(CableDis...
pypsa_id
identifier_name
cable_distributors.py
"""This file is part of DING0, the DIstribution Network GeneratOr. DING0 is a tool to generate synthetic medium and low voltage power distribution grids based on open data. It is developed in the project open_eGo: https://openegoproject.wordpress.com DING0 lives at github: https://github.com/openego/ding0/ The docume...
class LVCableDistributorDing0(CableDistributorDing0): """ LV Cable distributor (connection point) Attributes ---------- string_id : Description #TODO branch_no : Description #TODO load_no : Description #TODO in_building : Description #TODO ...
return 'mv_cable_dist_' + repr(self.grid) + '_' + str(self.id_db)
identifier_body
index.js
import React, { PropTypes, Component } from 'react'; /* eslint-disable import/no-unresolved */ import { LogoImage, Header, } from 'components'; /* eslint-enable import/no-unresolved */ import styles from './index.module.scss'; import cssModules from 'react-css-modules'; import { connect } from 'react-redux'; import...
const mapDispatchToProps = (dispatch) => ({ actions: bindActionCreators(MyActions, dispatch), }); const StyledContainer = cssModules(FeatureFirstContainer, styles); export default connect( mapStateToProps, mapDispatchToProps )(StyledContainer);
isLoading: state.isLoading, }); // mapDispatchToProps :: Dispatch Func -> {Actions}
random_line_split
index.js
import React, { PropTypes, Component } from 'react'; /* eslint-disable import/no-unresolved */ import { LogoImage, Header, } from 'components'; /* eslint-enable import/no-unresolved */ import styles from './index.module.scss'; import cssModules from 'react-css-modules'; import { connect } from 'react-redux'; import...
render() { const { isLoading, } = this.props; return ( <div className={styles.container}> {isLoading ? <h1>LOADING...</h1> : <div> <LogoImage imageSource="https://github.com/RyanCCollins/cdn/raw/master/alumni-webapp/udacity-alumni-...
{ const { actions, } = this.props; actions.loadDataInitiation(); }
identifier_body
index.js
import React, { PropTypes, Component } from 'react'; /* eslint-disable import/no-unresolved */ import { LogoImage, Header, } from 'components'; /* eslint-enable import/no-unresolved */ import styles from './index.module.scss'; import cssModules from 'react-css-modules'; import { connect } from 'react-redux'; import...
() { const { isLoading, } = this.props; return ( <div className={styles.container}> {isLoading ? <h1>LOADING...</h1> : <div> <LogoImage imageSource="https://github.com/RyanCCollins/cdn/raw/master/alumni-webapp/udacity-alumni-small.png...
render
identifier_name
shorten.js
var counter = require('mongodb-counter'); var s3redirect = require('./s3redirect'); module.exports = shortener; module.exports.redis = require('./redisStore'); module.exports.mongodb = require('./mongoStore'); module.exports.s3 = s3redirect; module.exports.counter = counter; function shortener(options) { var store =...
function shorten(longUrl, done) { getUniqueId(function (err, uniqueId) { if (err) return done(err); store.set(uniqueId, longUrl, finish); function finish(err, path) { return done(null, options.shortUrlPrefix + uniqueId); } }); } function shortenUnique(longUrl, done) { getUniqueId(fu...
};
random_line_split
shorten.js
var counter = require('mongodb-counter'); var s3redirect = require('./s3redirect'); module.exports = shortener; module.exports.redis = require('./redisStore'); module.exports.mongodb = require('./mongoStore'); module.exports.s3 = s3redirect; module.exports.counter = counter; function shortener(options) { var store =...
(longUrl, done) { getUniqueId(function (err, uniqueId) { if (err) return done(err); store.set(uniqueId, longUrl, finish); function finish(err, path) { return done(null, options.shortUrlPrefix + uniqueId); } }); } function shortenUnique(longUrl, done) { getUniqueId(function (err, uniqu...
shorten
identifier_name
shorten.js
var counter = require('mongodb-counter'); var s3redirect = require('./s3redirect'); module.exports = shortener; module.exports.redis = require('./redisStore'); module.exports.mongodb = require('./mongoStore'); module.exports.s3 = s3redirect; module.exports.counter = counter; function shortener(options) { var store =...
function shortenUnique(longUrl, done) { getUniqueId(function (err, uniqueId) { if (err) return done(err); store.getOrSet(uniqueId, longUrl, finish); function finish(err, path) { return done(null, options.shortUrlPrefix + uniqueId); } }); } function unshorten(shortUrl, done) { store.ge...
{ getUniqueId(function (err, uniqueId) { if (err) return done(err); store.set(uniqueId, longUrl, finish); function finish(err, path) { return done(null, options.shortUrlPrefix + uniqueId); } }); }
identifier_body
__init__.py
"""Base test suite for extension arrays. These tests are intended for third-party libraries to subclass to validate that their extension arrays and dtypes satisfy the interface. Moving or renaming the tests should not be done lightly. Libraries are expected to implement a few pytest fixtures to provide data for the t...
class TestMyDtype(BaseDtypeTests): pass Your class ``TestDtype`` will inherit all the tests defined on ``BaseDtypeTests``. pytest's fixture discover will supply your ``dtype`` wherever the test requires it. You're free to implement additional tests. All the tests in these modules use ``self.assert_frame_...
@pytest.fixture def dtype(): return MyDtype()
random_line_split
nameable.rs
use crate::view::View; use crate::views::NamedView; /// Makes a view wrappable in an [`NamedView`]. /// /// [`NamedView`]: ../views/struct.NamedView.html pub trait Nameable: View + Sized { /// Wraps this view into an `NamedView` with the given id. /// /// This is just a shortcut for `NamedView::new(id, sel...
/// Same as [`with_name`](Nameable::with_name) #[deprecated(note = "`with_id` is being renamed to `with_name`")] fn with_id<S: Into<String>>(self, id: S) -> NamedView<Self> { self.with_name(id) } } /// Any `View` implements this trait. impl<T: View> Nameable for T {}
{ NamedView::new(name, self) }
identifier_body
nameable.rs
use crate::view::View; use crate::views::NamedView; /// Makes a view wrappable in an [`NamedView`]. /// /// [`NamedView`]: ../views/struct.NamedView.html pub trait Nameable: View + Sized { /// Wraps this view into an `NamedView` with the given id. /// /// This is just a shortcut for `NamedView::new(id, sel...
self.with_name(id) } } /// Any `View` implements this trait. impl<T: View> Nameable for T {}
/// Same as [`with_name`](Nameable::with_name) #[deprecated(note = "`with_id` is being renamed to `with_name`")] fn with_id<S: Into<String>>(self, id: S) -> NamedView<Self> {
random_line_split
nameable.rs
use crate::view::View; use crate::views::NamedView; /// Makes a view wrappable in an [`NamedView`]. /// /// [`NamedView`]: ../views/struct.NamedView.html pub trait Nameable: View + Sized { /// Wraps this view into an `NamedView` with the given id. /// /// This is just a shortcut for `NamedView::new(id, sel...
<S: Into<String>>(self, id: S) -> NamedView<Self> { self.with_name(id) } } /// Any `View` implements this trait. impl<T: View> Nameable for T {}
with_id
identifier_name
__init__.py
import os from jflow.utils.importlib import import_module from jflow.conf import global_settings #If django is installed used the django setting object try: from django.conf import settings as django_settings except: django_settings = None ENVIRONMENT_VARIABLE = "JFLOW_SETTINGS_MODULE" cla...
return self def get_settings(): settings_module = os.environ.get(ENVIRONMENT_VARIABLE,None) if settings_module: try: mod = import_module(settings_module) except ImportError, e: raise ImportError("Could not import settings '%s': %s" % ...
if setting == setting.upper(): if not hasattr(self,setting): setattr(self, setting, getattr(global_settings, setting))
conditional_block
__init__.py
import os from jflow.utils.importlib import import_module from jflow.conf import global_settings #If django is installed used the django setting object try: from django.conf import settings as django_settings except: django_settings = None ENVIRONMENT_VARIABLE = "JFLOW_SETTINGS_MODULE" cla...
(): settings_module = os.environ.get(ENVIRONMENT_VARIABLE,None) if settings_module: try: mod = import_module(settings_module) except ImportError, e: raise ImportError("Could not import settings '%s': %s" % (settings_module, e)) else: mod = None ...
get_settings
identifier_name
__init__.py
import os from jflow.utils.importlib import import_module from jflow.conf import global_settings #If django is installed used the django setting object try: from django.conf import settings as django_settings except: django_settings = None ENVIRONMENT_VARIABLE = "JFLOW_SETTINGS_MODULE"
class Settings(object): pass def fill(self, settings_module): # update this dict from global settings (but only for ALL_CAPS settings) for setting in dir(global_settings): if setting == setting.upper(): if not hasattr(self,setting): setattr(self, sett...
random_line_split
__init__.py
import os from jflow.utils.importlib import import_module from jflow.conf import global_settings #If django is installed used the django setting object try: from django.conf import settings as django_settings except: django_settings = None ENVIRONMENT_VARIABLE = "JFLOW_SETTINGS_MODULE" cla...
def fill(self, settings_module): # update this dict from global settings (but only for ALL_CAPS settings) for setting in dir(global_settings): if setting == setting.upper(): if not hasattr(self,setting): setattr(self, setting, getattr(global_settings, setti...
pass
identifier_body
extHostCommands.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
let lastUnregister: string; const shape = new class extends mock<MainThreadCommandsShape>() { $registerCommand(id: string): void { // } $unregisterCommand(id: string): void { lastUnregister = id; } }; const commands = new ExtHostCommands(SingleProxyRPCProtocol(shape), undefined, new NullL...
test('dispose calls unregister', function () {
random_line_split
extHostCommands.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
}; const commands = new ExtHostCommands(SingleProxyRPCProtocol(shape), undefined, new NullLogService()); const reg = commands.registerCommand(true, 'foo', (): any => { }); reg.dispose(); reg.dispose(); reg.dispose(); assert.equal(unregisterCounter, 1); }); });
{ unregisterCounter += 1; }
identifier_body
extHostCommands.test.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(id: string): void { unregisterCounter += 1; } }; const commands = new ExtHostCommands(SingleProxyRPCProtocol(shape), undefined, new NullLogService()); const reg = commands.registerCommand(true, 'foo', (): any => { }); reg.dispose(); reg.dispose(); reg.dispose(); assert.equal(unregisterCounter, 1)...
$unregisterCommand
identifier_name
windows.py
BDR_SUNKENINNER) IDC_SIZENWSE = 32642 IDC_SIZENESW = 32643 IDC_SIZEWE = 32644 IDC_SIZENS = 32645 IDC_SIZEALL = 32646 IDC_SIZE = 32640 IDC_ARROW = 32512 TCIF_TEXT =1 TCIF_IMAGE =2 TCIF_RTLREADING= 4 TCIF_PARAM = 8 TCS_MULTILINE = 512 MK_LBUTTON = 1 MK_RBUTTON = 2 MK_SHIFT = 4 MK_CONTROL = 8...
return value
conditional_block
windows.py
class NMHDR(Structure): _fields_ = [("hwndFrom", HWND), ("idFrom", UINT), ("code", UINT)] class PAINTSTRUCT(Structure): _fields_ = [("hdc", HDC), ("fErase", BOOL), ("rcPaint", RECT), ("fRestore", BOOL), ("fIncUp...
_fields_ = [("lpCreateParams", LPVOID), ("hInstance", HINSTANCE), ("hMenu", HMENU), ("hwndParent", HWND), ("cx", INT), ("cy", INT), ("x", INT), ("y", INT), ("style", LONG), ("l...
identifier_body
windows.py
("dwMinorVersion", DWORD), ("dwBuildNumber", DWORD), ("dwPlatformId", DWORD), ("szCSDVersion", TCHAR * 128)] def isMajorMinor(self, major, minor): return (self.dwMajorVersion, self.dwMinorVersion) == (major, minor) GetVersion = windll.ker...
class OSVERSIONINFO(Structure): _fields_ = [("dwOSVersionInfoSize", DWORD), ("dwMajorVersion", DWORD),
random_line_split