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
gallery-component.js
from 'react'; import FileComponent from './file-component'; import EditorComponent from './editor-component'; import BulkActionsComponent from './bulk-actions-component'; import BaseComponent from './base-component'; import CONSTANTS from '../constants'; function getComparator(field, direction) { return (a, b) => { ...
else { this.props.backend.search(); } } componentWillUnmount() { for (let event in this.listeners) { this.props.backend.removeListener(event, this.listeners[event]); } } componentDidUpdate() { var $select = $(React.findDOMNode(this)).find('.gallery__sort .dropdown'); // We opt-out of letting the...
{ this.onNavigate(this.props.current_folder); }
conditional_block
orderlist.d.ts
import { ElementRef, AfterViewChecked, AfterContentInit, QueryList, TemplateRef, EventEmitter } from '@angular/core'; import { DomHandler } from '../dom/domhandler';
value: any[]; header: string; style: any; styleClass: string; listStyle: any; responsive: boolean; metaKeySelection: boolean; onReorder: EventEmitter<any>; templates: QueryList<any>; itemTemplate: TemplateRef<any>; selectedItems: any[]; movedUp: boolean; movedDown: bo...
export declare class OrderList implements AfterViewChecked, AfterContentInit { el: ElementRef; domHandler: DomHandler;
random_line_split
orderlist.d.ts
import { ElementRef, AfterViewChecked, AfterContentInit, QueryList, TemplateRef, EventEmitter } from '@angular/core'; import { DomHandler } from '../dom/domhandler'; export declare class OrderList implements AfterViewChecked, AfterContentInit { el: ElementRef; domHandler: DomHandler; value: any[]; heade...
{ }
OrderListModule
identifier_name
options.rs
TokenStream >, } impl quote::ToTokens for FnQuick { fn to_tokens( &self, tokens : &mut proc_macro2::TokenStream ) { for attr in self.attrs.iter() { attr.to_tokens( tokens ); } self.sig.to_tokens( tokens ); match &self.block { Some( block ) => tokens.append( proc_macro2::Group...
( name : &str, field : &syn::Field ) -> Result< GetterDescriptor > { let name_ident = syn::Ident::new( &name, field.span() ); let ty = &field.ty; // tree_print!( ty ); let ty_is_ref = matches!( ty, syn::Type::Reference( _ ) ); let ty2 = if ty_is_ref { ty.to_token_stream() } else { quote!{ ...
getter_gen
identifier_name
options.rs
::TokenStream >, } impl quote::ToTokens for FnQuick { fn to_tokens( &self, tokens : &mut proc_macro2::TokenStream ) { for attr in self.attrs.iter() { attr.to_tokens( tokens ); } self.sig.to_tokens( tokens ); match &self.block { Some( block ) => tokens.append( proc_macro2::Gro...
let fn_desc = FnQuick { attrs, vis, sig, block : None, }; return Ok( Element::Fn( fn_desc ) ); } } else { input.call( syn::Field::parse_named ).map( | mut e | { e.vis = vis; e.attrs = attrs; El...
{ let sig : syn::Signature = input.parse()?; let lookahead2 = input.lookahead1(); if lookahead2.peek( syn::token::Brace ) { let input2; let brace_token : syn::token::Brace = syn::braced!( input2 in input ); let block : proc_macro2::TokenStream = input2.parse()?; ...
conditional_block
options.rs
TokenStream >, } impl quote::ToTokens for FnQuick { fn to_tokens( &self, tokens : &mut proc_macro2::TokenStream ) {
for attr in self.attrs.iter() { attr.to_tokens( tokens ); } self.sig.to_tokens( tokens ); match &self.block { Some( block ) => tokens.append( proc_macro2::Group::new( proc_macro2::Delimiter::Brace, block.to_token_stream() ) ), None => tokens.append( proc_macro2::Punct::new( ...
random_line_split
reftest.rs
std::io::process::ExitStatus; use std::io::fs::PathExtensions; use std::os; use std::path::Path; use test::{AutoColor, DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn}; use test::run_tests_console; use regex::Regex; use url::Url; bitflags!( flags RenderMode: u32 { const CPU_RENDERING = 0x00000...
<'a> { conditions: &'a str, kind: &'a str, file_left: &'a str, file_right: &'a str, } fn parse_lists(file: &Path, servo_args: &[String], render_mode: RenderMode, id_offset: uint) -> Vec<TestDescAndFn> { let mut tests = Vec::new(); let contents = File::open_mode(file, io::Open, io::Read) ...
TestLine
identifier_name
reftest.rs
std::io::process::ExitStatus; use std::io::fs::PathExtensions; use std::os; use std::path::Path; use test::{AutoColor, DynTestName, DynTestFn, TestDesc, TestOpts, TestDescAndFn}; use test::run_tests_console; use regex::Regex; use url::Url; bitflags!( flags RenderMode: u32 { const CPU_RENDERING = 0x00000...
} if reftest.render_mode.contains(GPU_RENDERING) { command.arg("-g"); } if reftest.experimental { command.arg("--experimental"); } let retval = match command.status() { Ok(status) => status, Err(e) => panic!("failed to execute process: {}", e), }; assert_e...
random_line_split
bind_instead_of_map_multipart.rs
#![deny(clippy::bind_instead_of_map)] #![allow(clippy::blocks_in_if_conditions)] pub fn main() { let _ = Some("42").and_then(|s| if s.len() < 42 { Some(0) } else { Some(s.len()) }); let _ = Some("42").and_then(|s| if s.len() < 42 { None } else { Some(s.len()) }); let _ = Ok::<_, ()>("42").and_then(|s| if ...
if s == "43" { return Some(43); } s == "42" } { return Some(45); } match s.len() { 10 => Some(2), 20 => { if foo() { return { if foo() { ...
} fn hard_example() { Some("42").and_then(|s| { if {
random_line_split
bind_instead_of_map_multipart.rs
#![deny(clippy::bind_instead_of_map)] #![allow(clippy::blocks_in_if_conditions)] pub fn main() { let _ = Some("42").and_then(|s| if s.len() < 42 { Some(0) } else { Some(s.len()) }); let _ = Some("42").and_then(|s| if s.len() < 42 { None } else { Some(s.len()) }); let _ = Ok::<_, ()>("42").and_then(|s| if ...
{ let _ = Some("").and_then(|s| if s.len() == 20 { m!() } else { Some(20) }); let _ = Some("").and_then(|s| if s.len() == 20 { Some(m!()) } else { Some(Some(20)) }); }
identifier_body
bind_instead_of_map_multipart.rs
#![deny(clippy::bind_instead_of_map)] #![allow(clippy::blocks_in_if_conditions)] pub fn main() { let _ = Some("42").and_then(|s| if s.len() < 42 { Some(0) } else { Some(s.len()) }); let _ = Some("42").and_then(|s| if s.len() < 42 { None } else { Some(s.len()) }); let _ = Ok::<_, ()>("42").and_then(|s| if ...
() { let _ = Some("").and_then(|s| if s.len() == 20 { m!() } else { Some(20) }); let _ = Some("").and_then(|s| if s.len() == 20 { Some(m!()) } else { Some(Some(20)) }); }
macro_example
identifier_name
QuestionShuffling.py
import numpy as np # import text file, which has a determined format a=open("test.dat") b=open("test2.dat","w") f=a.read() g=f.split("\n") nlines=6 nquestions=16 q1=[g[nlines*i:nlines*(i+1)] for i in range(nquestions)] # these two lines can be commented if you want to shuffle last question also last=q1[-1] q2=q1[:-1] n...
a.close() b.close()
b.write(str(l)+"\n")
conditional_block
QuestionShuffling.py
import numpy as np # import text file, which has a determined format a=open("test.dat") b=open("test2.dat","w") f=a.read() g=f.split("\n") nlines=6 nquestions=16 q1=[g[nlines*i:nlines*(i+1)] for i in range(nquestions)] # these two lines can be commented if you want to shuffle last question also last=q1[-1] q2=q1[:-1] n...
alts=last[4:9] np.random.shuffle(alts) last=np.concatenate([last[:4],alts,last[-2:]]) for l in last: b.write(str(l)+"\n") a.close() b.close()
q=np.concatenate([q[:4],alts,q[-2:]]) for l in q: b.write(str(l)+"\n") # comment this block also if you want to shuffle last question
random_line_split
control.py
# -*- coding: utf-8 -*- # Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com> # License: MIT (see LICENSE.TXT file) import os
from apps.gallery.models import Picture from apps.team.utils import assert_member from apps.team import control as team_control def can_edit(account, gallery): return not ((gallery.team and not team_control.is_member(account, gallery.team)) or (not gallery.team and gallery.created_by != account))...
from django.core.exceptions import PermissionDenied from apps.gallery.models import Gallery
random_line_split
control.py
# -*- coding: utf-8 -*- # Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com> # License: MIT (see LICENSE.TXT file) import os from django.core.exceptions import PermissionDenied from apps.gallery.models import Gallery from apps.gallery.models import Picture from apps.team.utils import asse...
(account, picture): """ Remove picture from the gallery and delete the image file on server. """ gallery = picture.gallery _assert_can_edit(account, gallery) if gallery.primary == picture: gallery.primary = None gallery.updated_by = account gallery.save() os.remove(picture.im...
remove
identifier_name
control.py
# -*- coding: utf-8 -*- # Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com> # License: MIT (see LICENSE.TXT file) import os from django.core.exceptions import PermissionDenied from apps.gallery.models import Gallery from apps.gallery.models import Picture from apps.team.utils import asse...
os.remove(picture.image.path) os.remove(picture.preview.path) os.remove(picture.thumbnail.path) picture.delete() return gallery def setprimary(account, picture): """ Set picture as the galleries primary picture. """ gallery = picture.gallery _assert_can_edit(account, gallery) gall...
gallery.primary = None gallery.updated_by = account gallery.save()
conditional_block
control.py
# -*- coding: utf-8 -*- # Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com> # License: MIT (see LICENSE.TXT file) import os from django.core.exceptions import PermissionDenied from apps.gallery.models import Gallery from apps.gallery.models import Picture from apps.team.utils import asse...
def setprimary(account, picture): """ Set picture as the galleries primary picture. """ gallery = picture.gallery _assert_can_edit(account, gallery) gallery.primary = picture gallery.save() def add(account, image, gallery): """ Add a picture to the gallery. """ _assert_can_edit(account,...
""" Remove picture from the gallery and delete the image file on server. """ gallery = picture.gallery _assert_can_edit(account, gallery) if gallery.primary == picture: gallery.primary = None gallery.updated_by = account gallery.save() os.remove(picture.image.path) os.remove(...
identifier_body
configuration.js
/* // Copyright (c) 2016 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License");
// You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // S...
// you may not use this file except in compliance with the License.
random_line_split
lib.rs
#![feature(braced_empty_structs)] extern crate html5ever; extern crate hyper; extern crate libc; extern crate string_cache; extern crate tendril; extern crate url; use libc::c_char; use std::collections::{HashMap, HashSet, VecDeque}; use std::default::Default; use std::ffi::CStr; use std::io::Read; use std::result::R...
dom_steps } } impl AtomicProcess for PageDownloader { fn process_this(&self) -> Vec<ProcessOutputs> { let client = Client::new(); // Read the Response. let mut body = String::new(); let res = client.get(&self.thread_url[..]) .header(Connection::close()) ...
{ dom_steps.push(ProcessOutputs::Output(self.count)); }
conditional_block
lib.rs
#![feature(braced_empty_structs)] extern crate html5ever; extern crate hyper; extern crate libc; extern crate string_cache; extern crate tendril; extern crate url; use libc::c_char; use std::collections::{HashMap, HashSet, VecDeque}; use std::default::Default; use std::ffi::CStr; use std::io::Read; use std::result::R...
if name.local == Atom::from("article") { self.count += 1 } } Document => (), Doctype(_, _, _) => (), Text(_) => (), Comment(_) => (), }; let dom_steps: Vec<ProcessOutputs> = node.children...
fn process_this(&self) -> Vec<ProcessOutputs> { let node = self.handle.borrow(); match node.node { Element(ref name, _, _) => {
random_line_split
lib.rs
#![feature(braced_empty_structs)] extern crate html5ever; extern crate hyper; extern crate libc; extern crate string_cache; extern crate tendril; extern crate url; use libc::c_char; use std::collections::{HashMap, HashSet, VecDeque}; use std::default::Default; use std::ffi::CStr; use std::io::Read; use std::result::R...
(&self) -> Vec<ProcessOutputs> { park(); vec![ProcessOutputs::Output(0i64)] } } impl TaskQueue { pub fn nextTask(&self) -> Box<AtomicProcess> { match self.queue.clone().lock().unwrap().pop_back() { Some(res) => res, None => Box::new(PauseThread), } } ...
process_this
identifier_name
TrustedAuthority.spec.ts
import { TEST_CONFIG } from "../TestConstants"; import sinon from "sinon"; import TelemetryManager from "../../src/telemetry/TelemetryManager"; import { TelemetryConfig } from "../../src/telemetry/TelemetryTypes"; import { Logger } from "../../src/Logger"; import { TrustedAuthority } from "../../src/authority/TrustedAu...
} }; const stubbedTelemetryManager = new TelemetryManager(stubbedTelemetryConfig, () => {}, new Logger(() => {})); describe("TrustedAuthority.ts Class", function () { afterEach(function() { sinon.restore(); }); describe("setTrustedAuthoritiesFromConfig", () => { it("Sets TrustedHostLi...
random_line_split
command.rs
use super::{CommandType}; #[derive(Clone, Debug, PartialEq)] pub enum Sender { User(String, Option<String>, Option<String>), Server(String) } impl Sender { fn to_cmd(&self) -> String { match *self { Sender::User(ref n, None, None) => format!(":{} ", n), Sender::User(ref n, ...
} #[derive(Clone, Debug, PartialEq)] pub struct Command { pub tags: Option<Tags>, pub prefix: Option<Sender>, pub command: CommandType, pub params: Params, } impl Command { pub fn to_string(&self) -> String { let cmd: &str = self.command.into(); format!("{}{}{}{}\r\n", self.tags.a...
{ let mut buf = String::new(); buf.push(' '); let n = self.data.len(); if n > 0 { for i in 0..n-1 { buf.push_str(&*format!("{} ", self.data[i])); } buf.push_str(&*format!(":{}", self.data[n-1])); } buf }
identifier_body
command.rs
use super::{CommandType}; #[derive(Clone, Debug, PartialEq)] pub enum Sender { User(String, Option<String>, Option<String>), Server(String) } impl Sender { fn to_cmd(&self) -> String { match *self { Sender::User(ref n, None, None) => format!(":{} ", n), Sender::User(ref n, ...
(&self) -> String { let cmd: &str = self.command.into(); format!("{}{}{}{}\r\n", self.tags.as_ref().map(|x|x.to_cmd()).unwrap_or("".to_string()), self.prefix.as_ref().map(|x|x.to_cmd()).unwrap_or("".to_string()), cmd, se...
to_string
identifier_name
command.rs
use super::{CommandType}; #[derive(Clone, Debug, PartialEq)] pub enum Sender { User(String, Option<String>, Option<String>), Server(String) } impl Sender { fn to_cmd(&self) -> String { match *self { Sender::User(ref n, None, None) => format!(":{} ", n), Sender::User(ref n, ...
} #[derive(Clone, Debug, PartialEq)] pub struct Command { pub tags: Option<Tags>, pub prefix: Option<Sender>, pub command: CommandType, pub params: Params, } impl Command { pub fn to_string(&self) -> String { let cmd: &str = self.command.into(); format!("{}{}{}{}\r\n", self.tags.as...
}
random_line_split
BackdropUI.py
########################################################################## # # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
Gaffer.Backdrop, "description", """ A utility node which allows the positioning of other nodes on a coloured backdrop with optional text. Selecting a backdrop in the ui selects all the nodes positioned on it, and moving it moves them with it. """, plugs = { "title" : [ "description", """ The ti...
Gaffer.Metadata.registerNode(
random_line_split
BackdropUI.py
########################################################################## # # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
imath.V2f( menuPosition.x, menuPosition.y ), gadget = graphGadget ).p0 graphGadget.setNodePosition( backdrop, imath.V2f( nodePosition.x, nodePosition.y ) ) return backdrop ########################################################################## # Metadata ############################################...
graphEditor = menu.ancestor( GafferUI.GraphEditor ) assert( graphEditor is not None ) gadgetWidget = graphEditor.graphGadgetWidget() graphGadget = graphEditor.graphGadget() script = graphEditor.scriptNode() with Gaffer.UndoScope( script ) : backdrop = Gaffer.Backdrop() Gaffer.NodeAlgo.applyUserDefaults( bac...
identifier_body
BackdropUI.py
########################################################################## # # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
else : menuPosition = menu.popupPosition( relativeTo = gadgetWidget ) nodePosition = gadgetWidget.getViewportGadget().rasterToGadgetSpace( imath.V2f( menuPosition.x, menuPosition.y ), gadget = graphGadget ).p0 graphGadget.setNodePosition( backdrop, imath.V2f( nodePosition.x, nodePosition.y ) ) ...
nodeGadget = graphGadget.nodeGadget( backdrop ) nodeGadget.frame( [ x for x in script.selection() ] )
conditional_block
BackdropUI.py
########################################################################## # # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
( menu ) : graphEditor = menu.ancestor( GafferUI.GraphEditor ) assert( graphEditor is not None ) gadgetWidget = graphEditor.graphGadgetWidget() graphGadget = graphEditor.graphGadget() script = graphEditor.scriptNode() with Gaffer.UndoScope( script ) : backdrop = Gaffer.Backdrop() Gaffer.NodeAlgo.applyUser...
nodeMenuCreateCommand
identifier_name
test_Chromosome.py
import pytest from locuspocus import Chromosome @pytest.fixture def chr1(): return Chromosome("chr1", "A" * 500000) @pytest.fixture def chr2(): return Chromosome("chr1", "C" * 500000) def test_init(chr1): assert chr1 def test_init_from_seq(): x = Chromosome("chr1", ["a", "c", "g", "t"]) asse...
with pytest.raises(KeyError): Chromosome("test", "abcd") assert True
identifier_body
test_Chromosome.py
import pytest from locuspocus import Chromosome @pytest.fixture def chr1(): return Chromosome("chr1", "A" * 500000) @pytest.fixture def chr2(): return Chromosome("chr1", "C" * 500000) def test_init(chr1): assert chr1 def test_init_from_seq(): x = Chromosome("chr1", ["a", "c", "g", "t"]) asse...
(chr1, chr2): x = chr1 y = chr2 assert x == x assert x != y def test_N_in_chromosome(): Chromosome("test", "aaacccgggtttAN") assert True def test_bad_nucleotide_in_chromosome_seq(): with pytest.raises(KeyError): Chromosome("test", "abcd") assert True
test_equals
identifier_name
test_Chromosome.py
import pytest from locuspocus import Chromosome @pytest.fixture def chr1(): return Chromosome("chr1", "A" * 500000) @pytest.fixture def chr2(): return Chromosome("chr1", "C" * 500000) def test_init(chr1): assert chr1 def test_init_from_seq(): x = Chromosome("chr1", ["a", "c", "g", "t"]) asse...
Chromosome("test", "abcd") assert True
with pytest.raises(KeyError):
random_line_split
momentum.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
mom = state.get_slot(var, "momentum") return training_ops.resource_sparse_apply_momentum( var.handle, mom.handle, state.get_hyper("learning_rate", var.dtype.base_dtype), grad, indices, state.get_hyper("momentum", var.dtype.base_dtype), use_locking=self._use_lo...
identifier_body
momentum.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
def _apply_dense(self, grad, var, state): mom = state.get_slot(var, "momentum") return training_ops.apply_momentum( var, mom, state.get_hyper("learning_rate", var.dtype.base_dtype), grad, state.get_hyper("momentum", var.dtype.base_dtype), use_locking=self._use...
state.zeros_slot(v, "momentum")
conditional_block
momentum.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at
# 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. # ========================================================================...
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software
random_line_split
momentum.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
(self, grad, var, indices, state): mom = state.get_slot(var, "momentum") return training_ops.resource_sparse_apply_momentum( var.handle, mom.handle, state.get_hyper("learning_rate", var.dtype.base_dtype), grad, indices, state.get_hyper("momentum", var.dtype.base_d...
_resource_apply_sparse
identifier_name
setup.py
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
build_args = [] if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ: build_args += ["-j4"] if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) # Generate build files: subprocess.check_call( [ext.cmake] + cmake_args + ["-S", ext.sourcedir], cwd=self.build_temp) ...
cmake_args.append(f"-DDM_ROBOTICS_VERSION_SCRIPT={version_script}",)
conditional_block
setup.py
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
(requirements_file): # pylint: disable=g-doc-args """Returns a list of dependencies for setup() from requirements.txt. Currently a requirements.txt is being used to specify dependencies. In order to avoid specifying it in two places, we're going to use that file as the source of truth. Lines starting with ...
_get_requirements
identifier_name
setup.py
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
"-DDM_ROBOTICS_BUILD_WHEEL=True", "--log-level=VERBOSE", ] version_script = os.environ.get("DM_ROBOTICS_VERSION_SCRIPT", None) if version_script: cmake_args.append(f"-DDM_ROBOTICS_VERSION_SCRIPT={version_script}",) build_args = [] if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.env...
"-DPYTHON_EXECUTABLE={}".format(sys.executable), "-DDMR_PYTHON_VERSION={}.{}".format(sys.version_info.major, sys.version_info.minor), "-DCMAKE_BUILD_TYPE={}".format(build_type), "-DDM_ROBOTICS_BUILD_TESTS=OFF",
random_line_split
setup.py
# Copyright 2020 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
class CMakeBuild(build_ext): """Runs cmake.""" def build_extension(self, ext): output_directory = os.path.abspath( os.path.dirname(self.get_ext_fullpath(ext.name))) # required for auto-detection of auxiliary "native" libs if not output_directory.endswith(os.path.sep): output_directory...
Extension.__init__(self, name, sources=[]) self.sourcedir = os.path.abspath(sourcedir) self.cmake = cmake
identifier_body
urls.py
"""api_server URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples:
Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.url...
Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
random_line_split
test_geoip.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import socket import unittest import warnings from unittest import skipUnless from django.conf import settings from django.contrib.gis.geoip import HAS_GEOIP from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry from django.test import ign...
def test05_unicode_response(self): "Testing that GeoIP strings are properly encoded, see #16553." g = GeoIP() fqdn = "messe-duesseldorf.com" if self._is_dns_available(fqdn): d = g.city(fqdn) self.assertEqual('Düsseldorf', d['city']) d = g.country('20...
self.assertAlmostEqual(lon, tup[0], 0) self.assertAlmostEqual(lat, tup[1], 0)
conditional_block
test_geoip.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import socket import unittest import warnings from unittest import skipUnless from django.conf import settings from django.contrib.gis.geoip import HAS_GEOIP from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry from django.test import ign...
with warnings.catch_warnings(record=True) as warns: warnings.simplefilter('always') GeoIP() self.assertEqual(len(warns), 1) msg = str(warns[0].message) self.assertIn('django.contrib.gis.geoip is deprecated', msg) def test_repr(self): path = settings....
def test_deprecation_warning(self):
random_line_split
test_geoip.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import socket import unittest import warnings from unittest import skipUnless from django.conf import settings from django.contrib.gis.geoip import HAS_GEOIP from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry from django.test import ign...
(self): "Testing GeoIP initialization." g1 = GeoIP() # Everything inferred from GeoIP path path = settings.GEOIP_PATH g2 = GeoIP(path, 0) # Passing in data path explicitly. g3 = GeoIP.open(path, 0) # MaxMind Python API syntax. for g in (g1, g2, g3): self.a...
test01_init
identifier_name
test_geoip.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os import socket import unittest import warnings from unittest import skipUnless from django.conf import settings from django.contrib.gis.geoip import HAS_GEOIP from django.contrib.gis.geos import HAS_GEOS, GEOSGeometry from django.test import ign...
def test_deprecation_warning(self): with warnings.catch_warnings(record=True) as warns: warnings.simplefilter('always') GeoIP() self.assertEqual(len(warns), 1) msg = str(warns[0].message) self.assertIn('django.contrib.gis.geoip is deprecated', msg) def t...
"Testing that GeoIP strings are properly encoded, see #16553." g = GeoIP() fqdn = "messe-duesseldorf.com" if self._is_dns_available(fqdn): d = g.city(fqdn) self.assertEqual('Düsseldorf', d['city']) d = g.country('200.26.205.1') # Some databases have only u...
identifier_body
attachments.component.ts
import { Component, Input } from '@angular/core'; import { environment } from 'src/environments/environment'; import { ImageService } from 'src/app/maincontent/image'; @Component({ selector: 'app-attachments', templateUrl: 'attachments.component.html', styleUrls: ['attachments.component.css'] }) export class At...
} /** * https://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-srcset/ */ public getThumbnailSrcSet(picture: any): string { return this.imageService.getThumbnailSrcSet(environment.server, this.recorduri, picture); } }
public getDefaultImage(picture: any): string { return this.imageService.getDefaultThumbnail(environment.server, this.recorduri, picture);
random_line_split
attachments.component.ts
import { Component, Input } from '@angular/core'; import { environment } from 'src/environments/environment'; import { ImageService } from 'src/app/maincontent/image'; @Component({ selector: 'app-attachments', templateUrl: 'attachments.component.html', styleUrls: ['attachments.component.css'] }) export class At...
(private imageService: ImageService) { } public getDefaultImage(picture: any): string { return this.imageService.getDefaultThumbnail(environment.server, this.recorduri, picture); } /** * https://css-tricks.com/responsive-images-youre-just-changing-resolutions-use-srcset/ */ public getThumbnailSrcSet(...
constructor
identifier_name
templatevm.py
# # The Qubes OS Project, http://www.qubes-os.org # # Copyright (C) 2014-2016 Wojtek Porczyk <woju@invisiblethingslab.com> # Copyright (C) 2016 Marek Marczykowski <marmarek@invisiblethingslab.com>) # Copyright (C) 2016 Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de> # # This library is free software; you ca...
"""Send event about default value change to child VMs (which use default inherited from the template). This handler is supposed to be set for properties using `_default_with_template()` function for the default value. """ if newvalue == oldvalue: return ...
identifier_body
templatevm.py
# # The Qubes OS Project, http://www.qubes-os.org # # Copyright (C) 2014-2016 Wojtek Porczyk <woju@invisiblethingslab.com> # Copyright (C) 2016 Marek Marczykowski <marmarek@invisiblethingslab.com>) # Copyright (C) 2016 Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de> # # This library is free software; you ca...
(QubesVM): '''Template for AppVM''' dir_path_prefix = qubes.config.system_path['qubes_templates_dir'] @property def appvms(self): ''' Returns a generator containing all domains based on the current TemplateVM. ''' for vm in self.app.domains: if hasattr(v...
TemplateVM
identifier_name
templatevm.py
# # The Qubes OS Project, http://www.qubes-os.org # # Copyright (C) 2014-2016 Wojtek Porczyk <woju@invisiblethingslab.com> # Copyright (C) 2016 Marek Marczykowski <marmarek@invisiblethingslab.com>) # Copyright (C) 2016 Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de> # # This library is free software; you ca...
import qubes.vm.mix.net from qubes.config import defaults from qubes.vm.qubesvm import QubesVM class TemplateVM(QubesVM): '''Template for AppVM''' dir_path_prefix = qubes.config.system_path['qubes_templates_dir'] @property def appvms(self): ''' Returns a generator containing all domains base...
import qubes import qubes.config import qubes.vm.qubesvm
random_line_split
templatevm.py
# # The Qubes OS Project, http://www.qubes-os.org # # Copyright (C) 2014-2016 Wojtek Porczyk <woju@invisiblethingslab.com> # Copyright (C) 2016 Marek Marczykowski <marmarek@invisiblethingslab.com>) # Copyright (C) 2016 Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de> # # This library is free software; you ca...
netvm = qubes.VMProperty('netvm', load_stage=4, allow_none=True, default=None, # pylint: disable=protected-access setter=qubes.vm.qubesvm.QubesVM.netvm._setter, doc='VM that provides network connection to this domain. When ' '`None`, machine is disconnected.') def ...
if hasattr(vm, 'template') and vm.template is self: yield vm
conditional_block
errors.rs
// Copyright 2018 Mozilla // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software...
/// We're just not done yet. Message that the feature is recognized but not yet /// implemented. #[fail(display = "not yet implemented: {}", _0)] NotYetImplemented(String), #[fail(display = "no possible types for value provided to {:?}", _0)] CannotProjectImpossibleBinding(SimpleAggregationOp)...
#[derive(Debug, Fail)] pub enum ProjectorError {
random_line_split
errors.rs
// Copyright 2018 Mozilla // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software...
} impl From<mentat_db::DbError> for ProjectorError { fn from(error: mentat_db::DbError) -> ProjectorError { ProjectorError::DbError(error) } } impl From<mentat_query_pull::PullError> for ProjectorError { fn from(error: mentat_query_pull::PullError) -> ProjectorError { ProjectorError::Pull...
{ ProjectorError::RusqliteError(error.to_string()) }
identifier_body
errors.rs
// Copyright 2018 Mozilla // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software...
(error: rusqlite::Error) -> ProjectorError { ProjectorError::RusqliteError(error.to_string()) } } impl From<mentat_db::DbError> for ProjectorError { fn from(error: mentat_db::DbError) -> ProjectorError { ProjectorError::DbError(error) } } impl From<mentat_query_pull::PullError> for Project...
from
identifier_name
has_element_with_class_name.js
/** * High performant way to check whether an element with a specific class name is in the given document * Optimized for being heavily executed * Unleashes the power of live node lists * * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @exa...
// getElementsByClassName is not supported by IE<9 // but is sometimes mocked via library code (which then doesn't return live node lists) if (!wysihtml5.browser.supportsNativeGetElementsByClassName()) { return !!doc.querySelector("." + className); } var key = _getDocumentIdentifier(d...
return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); } wysihtml5.dom.hasElementWithClassName = function(doc, className) {
random_line_split
has_element_with_class_name.js
/** * High performant way to check whether an element with a specific class name is in the given document * Optimized for being heavily executed * Unleashes the power of live node lists * * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @exa...
return cacheEntry.length > 0; }; })(wysihtml5);
{ cacheEntry = LIVE_CACHE[key] = doc.getElementsByClassName(className); }
conditional_block
has_element_with_class_name.js
/** * High performant way to check whether an element with a specific class name is in the given document * Optimized for being heavily executed * Unleashes the power of live node lists * * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @exa...
wysihtml5.dom.hasElementWithClassName = function(doc, className) { // getElementsByClassName is not supported by IE<9 // but is sometimes mocked via library code (which then doesn't return live node lists) if (!wysihtml5.browser.supportsNativeGetElementsByClassName()) { return !!doc.querySelector(...
{ return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); }
identifier_body
has_element_with_class_name.js
/** * High performant way to check whether an element with a specific class name is in the given document * Optimized for being heavily executed * Unleashes the power of live node lists * * @param {Object} doc The document object of the context where to check * @param {String} tagName Upper cased tag name * @exa...
(doc) { return doc._wysihtml5_identifier || (doc._wysihtml5_identifier = DOCUMENT_IDENTIFIER++); } wysihtml5.dom.hasElementWithClassName = function(doc, className) { // getElementsByClassName is not supported by IE<9 // but is sometimes mocked via library code (which then doesn't return live node lists...
_getDocumentIdentifier
identifier_name
cycler.py
# -*- coding: UTF-8 -*- # Copyright 2013-2014 by Luc Saffre. # License: BSD, see LICENSE for more details. """ Turns a list of items into an endless loop. Useful when generating demo fixtures. >>> from lino.utils import Cycler >>> def myfunc(): ... yield "a" ... yield "b" ... yield "c" >>> c = Cycler(myf...
if len(self.items) == 0: return None item = self.items[self.current] self.current += 1 if self.current >= len(self.items): self.current = 0 if isinstance(item, Cycler): return item.pop() return item def __len__(self): retur...
def __init__(self, *args): """ If there is exactly one argument, then this must be an iterable and will be used as the list of items to cycle on. If there is more than one positional argument, then these arguments themselves will be the list of items. """ if len(...
identifier_body
cycler.py
# -*- coding: UTF-8 -*- # Copyright 2013-2014 by Luc Saffre. # License: BSD, see LICENSE for more details. """ Turns a list of items into an endless loop. Useful when generating demo fixtures. >>> from lino.utils import Cycler >>> def myfunc(): ... yield "a" ... yield "b" ... yield "c" >>> c = Cycler(myf...
None None None """ from __future__ import unicode_literals from __future__ import print_function from builtins import object class Cycler(object): def __init__(self, *args): """ If there is exactly one argument, then this must be an iterable and will be used as the list of items to cycle...
>>> c = Cycler(None) >>> print (c.pop(), c.pop(), c.pop())
random_line_split
cycler.py
# -*- coding: UTF-8 -*- # Copyright 2013-2014 by Luc Saffre. # License: BSD, see LICENSE for more details. """ Turns a list of items into an endless loop. Useful when generating demo fixtures. >>> from lino.utils import Cycler >>> def myfunc(): ... yield "a" ... yield "b" ... yield "c" >>> c = Cycler(myf...
self.current = 0 def pop(self): if len(self.items) == 0: return None item = self.items[self.current] self.current += 1 if self.current >= len(self.items): self.current = 0 if isinstance(item, Cycler): return item.pop() ret...
self.items = args
conditional_block
cycler.py
# -*- coding: UTF-8 -*- # Copyright 2013-2014 by Luc Saffre. # License: BSD, see LICENSE for more details. """ Turns a list of items into an endless loop. Useful when generating demo fixtures. >>> from lino.utils import Cycler >>> def myfunc(): ... yield "a" ... yield "b" ... yield "c" >>> c = Cycler(myf...
(self): if len(self.items) == 0: return None item = self.items[self.current] self.current += 1 if self.current >= len(self.items): self.current = 0 if isinstance(item, Cycler): return item.pop() return item def __len__(self): ...
pop
identifier_name
vcview.py
self.fileentry.prepend_history(location) it = self.model.add_entries( None, [location] ) self.treeview.grab_focus() self.treeview.get_selection().select_iter(it) self.model.set_path_state(it, 0, tree.STATE_NORMAL, isdir=1) self.recompute_label() self.scheduler.remove_all...
CommitDialog(self).run()
identifier_body
vcview.py
"VcCompare": ("diff_command", ()), "VcCommit": ("commit_command", ("",)), "VcUpdate": ("update_command", ()), "VcAdd": ("add_command", ()), "VcResolved": ("resolved_command", ()), ...
random_line_split
vcview.py
len(path)==1: self.treeview.expand_to_path(path) else: # just the root self.treeview.expand_row( (0,), 0) self.vc.uncache_inventory() def on_fileentry_activate(self, fileentry): path = fileentry.get_full_path() self.set_location(path) de...
for d in diffs: os.chmod(d[0], 0o444) self.emit("create-diff", d) return True
conditional_block
vcview.py
_("_Normal"), None, _("Show normal"), self.on_filter_state_toggled, False), ("VcShowNonVC", "filter-nonvc-24", _("Non _VC"), None, _("Show unversioned files"), self.on_filter_state_toggled, False), ("VcShowIgnored", "filter-ignored-24", _("Ignored"), None, _("Show ignored files...
(self, s): if s: b = self.textview.get_buffer() b.insert(b.get_end_iter(), s) self.textview.scroll_mark_onscreen( self.mark ) self.consolestream = ConsoleStream(self.consoleview) self.location = None self.treeview_column...
write
identifier_name
test_semi_supervised.py
#!/usr/bin/env python import pytest import sklearn.datasets as datasets import sklearn.semi_supervised as ss import pandas_ml as pdml import pandas_ml.util.testing as tm class TestSemiSupervised(tm.TestCase):
self.assertIs(df.semi_supervised.LabelPropagation, ss.LabelPropagation) self.assertIs(df.semi_supervised.LabelSpreading, ss.LabelSpreading) @pytest.mark.parametrize("algo", ['LabelPropagation', 'LabelSpreading']) def test_Classifications(self, algo): iris = datasets.load_iris() ...
def test_objectmapper(self): df = pdml.ModelFrame([])
random_line_split
test_semi_supervised.py
#!/usr/bin/env python import pytest import sklearn.datasets as datasets import sklearn.semi_supervised as ss import pandas_ml as pdml import pandas_ml.util.testing as tm class TestSemiSupervised(tm.TestCase): def test_objectmapper(self): df = pdml.ModelFrame([]) self.assertIs(df.s...
iris = datasets.load_iris() df = pdml.ModelFrame(iris) mod1 = getattr(df.semi_supervised, algo)() mod2 = getattr(ss, algo)() df.fit(mod1) mod2.fit(iris.data, iris.target) result = df.predict(mod1) expected = mod2.predict(iris.data) self.ass...
identifier_body
test_semi_supervised.py
#!/usr/bin/env python import pytest import sklearn.datasets as datasets import sklearn.semi_supervised as ss import pandas_ml as pdml import pandas_ml.util.testing as tm class TestSemiSupervised(tm.TestCase): def test_objectmapper(self): df = pdml.ModelFrame([]) self.assertIs(df.s...
(self, algo): iris = datasets.load_iris() df = pdml.ModelFrame(iris) mod1 = getattr(df.semi_supervised, algo)() mod2 = getattr(ss, algo)() df.fit(mod1) mod2.fit(iris.data, iris.target) result = df.predict(mod1) expected = mod2.predict(iris.da...
test_Classifications
identifier_name
che-workspace-agent.ts
/* * Copyright (c) 2015-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API a...
} getProject(): CheProject { return this.project; } getGit(): CheGit { return this.git; } getProjectType(): CheProjectType { return this.projectType; } getProjectTypeResolver(): CheTypeResolver { return this.typeResolver; } getSvn(): CheSvn { return this.svn; } getWsAg...
{ this.wsagentApi.connect(this.workspaceAgentData.websocket, this.workspaceAgentData.clientId); }
conditional_block
che-workspace-agent.ts
/* * Copyright (c) 2015-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0
* SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API and implementation */ 'use strict'; import {CheProject} from './che-project'; import {CheGit} from './che-git'; import {CheSvn} from './che-svn'; import {CheProjectType} from './che-project-type'; import {CheTypeResolver} from '....
* which is available at https://www.eclipse.org/legal/epl-2.0/ *
random_line_split
che-workspace-agent.ts
/* * Copyright (c) 2015-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API a...
{ private $resource: ng.resource.IResourceService; private git: CheGit; private svn: CheSvn; private project: CheProject; private projectType: CheProjectType; private workspaceAgentData: IWorkspaceAgentData; private typeResolver: CheTypeResolver; private wsagentApi: CheJsonRpcWsagentApi; /** * D...
CheWorkspaceAgent
identifier_name
che-workspace-agent.ts
/* * Copyright (c) 2015-2018 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * Red Hat, Inc. - initial API a...
}
{ return this.wsagentApi; }
identifier_body
__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Online Discounts and Coupons # Authors: Dominador B. Ramos Jr. <mongramosjr@gmail.com> # Company: 3D2N World (http://www.3d2nworld.com) # # Copyright 2016 Dominador B. Ramos Jr. # # Licensed under the Ap...
'description': """ Online Discounts and Coupons """, 'depends': ['website', 'website_partner', 'website_mail', 'best_deal'], 'data': [ 'data/best_deal_data.xml', 'views/website_best_deal_template.xml', 'views/website_best_deal_backend.xml', 'security/ir.model.access.c...
random_line_split
sort.pipe.ts
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'sortPipe' }) export class SortPipe implements PipeTransform { transform(books: Book[], args?: string): Book[] { console.log(books); let res = [], booksTemp = books.slice(0), i = 0, j = 0, x = Object.assign({}, books[0]); x.issueYear =...
}
}
random_line_split
sort.pipe.ts
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'sortPipe' }) export class SortPipe implements PipeTransform { transform(books: Book[], args?: string): Book[] { console.log(books); let res = [], booksTemp = books.slice(0), i = 0, j = 0, x = Object.assign({}, books[0]); x.issueYear =...
return acc; }, x); res.push(temp); console.log(booksTemp.indexOf(temp)); booksTemp.splice(booksTemp.indexOf(temp), 1); } } if (args === 'По названию') { while (booksTemp.length > 0) { let temp = booksTemp.reduce((acc, item, ) => { if (item.title...
n item; }
conditional_block
sort.pipe.ts
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'sortPipe' }) export class
implements PipeTransform { transform(books: Book[], args?: string): Book[] { console.log(books); let res = [], booksTemp = books.slice(0), i = 0, j = 0, x = Object.assign({}, books[0]); x.issueYear = 0; x.title = "Я"; if (args === 'По году') { while(booksTemp.length > 0) { let tem...
SortPipe
identifier_name
sort.pipe.ts
import { Pipe, PipeTransform } from '@angular/core'; @Pipe({ name: 'sortPipe' }) export class SortPipe implements PipeTransform { transform(books: Book[], args?: string): Book[]
let temp = booksTemp.reduce((acc, item, ) => { if (item.title.charCodeAt(0) < acc.title.charCodeAt(0)) { return item; } return acc; }, x); res.push(temp); console.log(booksTemp.indexOf(temp)); booksTemp.splice(booksTemp.indexOf(temp), 1); } } re...
{ console.log(books); let res = [], booksTemp = books.slice(0), i = 0, j = 0, x = Object.assign({}, books[0]); x.issueYear = 0; x.title = "Я"; if (args === 'По году') { while(booksTemp.length > 0) { let temp = booksTemp.reduce((acc, item, ) => { if (item.issueYear > acc.issu...
identifier_body
GammuSender.py
''' Created on Jan 18, 2010 @author: Paul ''' from SQLEng import SQLEng class PduSender(object): ''' classdocs This class is designed for Gammu-smsd Inserting a record into MySQL Gammu-smsd will send the record Using command line will cause smsd stop for a while ''' def
(self,byte_array): mesg = "" for byte in byte_array: if byte < 16 : val = hex(byte) if val == "0x0" : val = "00" else : val = val.lstrip("0x") val = "{0}{1}".format('0', val)...
get_mesg
identifier_name
GammuSender.py
''' Created on Jan 18, 2010 @author: Paul ''' from SQLEng import SQLEng class PduSender(object):
mesg += val return mesg def send(self,to,byte_array): sEng = SQLEng() sEng.exeSQL(sEng.getInsetSentBox(to, self.get_mesg(byte_array))) def __init__(self): ''' Constructor ''' pass
''' classdocs This class is designed for Gammu-smsd Inserting a record into MySQL Gammu-smsd will send the record Using command line will cause smsd stop for a while ''' def get_mesg(self,byte_array): mesg = "" for byte in byte_array: if byte < 16 : ...
identifier_body
GammuSender.py
''' Created on Jan 18, 2010 @author: Paul ''' from SQLEng import SQLEng class PduSender(object): ''' classdocs This class is designed for Gammu-smsd Inserting a record into MySQL Gammu-smsd will send the record Using command line will cause smsd stop for a while ''' def ...
else : val = val.lstrip("0x") val = "{0}{1}".format('0', val) else : val = hex(byte) val = val.lstrip("0x") mesg += val return mesg def send(self,to,byte_array): sEng = SQLEng...
val = "00"
conditional_block
GammuSender.py
''' Created on Jan 18, 2010 @author: Paul ''' from SQLEng import SQLEng class PduSender(object): ''' classdocs This class is designed for Gammu-smsd Inserting a record into MySQL Gammu-smsd will send the record Using command line will cause smsd stop for a while ''' def ...
sEng = SQLEng() sEng.exeSQL(sEng.getInsetSentBox(to, self.get_mesg(byte_array))) def __init__(self): ''' Constructor ''' pass
mesg += val return mesg def send(self,to,byte_array):
random_line_split
intercom-web-tests.ts
/* From https://docs.intercom.io/configure-intercom-for-your-product-or-site/ customize-the-intercom-messenger/the-intercom-javascript-api */ intercomSettings = { email: "example@example.com", name: "John Doe", user_id: "123", created_at: 1234567890, app_id: "YOUR_APP_ID", widget: { activator...
};
random_line_split
15.4.4.22-8-b-ii-1.js
/// Copyright (c) 2009 Microsoft Corporation /// /// Redistribution and use in source and binary forms, with or without modification, are permitted provided /// that the following conditions are met: /// * Redistributions of source code must retain the above copyright notice, this list of conditions and /// ...
description: "Array.prototype.reduceRight - added properties in step 2 are visible here", test: function testcase() { var obj = {}; function callbackfn(prevVal, curVal, idx, obj) { } Object.defineProperty(obj, "length", { get: function () { obj[2] = "accu...
ES5Harness.registerTest({ id: "15.4.4.22-8-b-ii-1", path: "TestCases/chapter15/15.4/15.4.4/15.4.4.22/15.4.4.22-8-b-ii-1.js",
random_line_split
15.4.4.22-8-b-ii-1.js
/// Copyright (c) 2009 Microsoft Corporation /// /// Redistribution and use in source and binary forms, with or without modification, are permitted provided /// that the following conditions are met: /// * Redistributions of source code must retain the above copyright notice, this list of conditions and /// ...
Object.defineProperty(obj, "length", { get: function () { obj[2] = "accumulator"; return 3; }, configurable: true }); return Array.prototype.reduceRight.call(obj, callbackfn) === "accumulator"; }, precondition: funct...
{ }
identifier_body
15.4.4.22-8-b-ii-1.js
/// Copyright (c) 2009 Microsoft Corporation /// /// Redistribution and use in source and binary forms, with or without modification, are permitted provided /// that the following conditions are met: /// * Redistributions of source code must retain the above copyright notice, this list of conditions and /// ...
(prevVal, curVal, idx, obj) { } Object.defineProperty(obj, "length", { get: function () { obj[2] = "accumulator"; return 3; }, configurable: true }); return Array.prototype.reduceRight.call(obj, callbackfn) === "accumulator"; ...
callbackfn
identifier_name
effect.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
} } fn check_str_index(&mut self, e: &ast::Expr) { let base_type = match e.node { ast::ExprIndex(ref base, _) => ty::node_id_to_type(self.tcx, base.id), _ => return }; debug!("effect: checking index with base type {}", ppaux::ty_to_string(...
debug!("effect: recording unsafe block as used: {}", block_id); self.tcx.used_unsafe.borrow_mut().insert(block_id); } UnsafeFn => {}
random_line_split
effect.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
(&mut self, expr: &ast::Expr) { match expr.node { ast::ExprMethodCall(_, _, _) => { let method_call = MethodCall::expr(expr.id); let base_type = self.tcx.method_map.borrow().get(&method_call).ty; debug!("effect: method call case, base type is {}", ...
visit_expr
identifier_name
effect.rs
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
fn check_str_index(&mut self, e: &ast::Expr) { let base_type = match e.node { ast::ExprIndex(ref base, _) => ty::node_id_to_type(self.tcx, base.id), _ => return }; debug!("effect: checking index with base type {}", ppaux::ty_to_string(self.tcx, base_...
{ match self.unsafe_context { SafeContext => { // Report an error. span_err!(self.tcx.sess, span, E0133, "{} requires unsafe function or block", description); } UnsafeBlock(block_id) => { ...
identifier_body
sunf95.py
"""SCons.Tool.sunf95 Tool-specific initialization for sunf95, the Sun Studio F95 compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20...
# Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
return env.Detect(compilers)
identifier_body
sunf95.py
"""SCons.Tool.sunf95 Tool-specific initialization for sunf95, the Sun Studio F95 compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20...
(env): return env.Detect(compilers) # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
exists
identifier_name
sunf95.py
"""SCons.Tool.sunf95 Tool-specific initialization for sunf95, the Sun Studio F95 compiler. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20...
compilers = ['sunf95', 'f95'] def generate(env): """Add Builders and construction variables for sunf95 to an Environment.""" add_all_to_env(env) fcomp = env.Detect(compilers) or 'f95' env['FORTRAN'] = fcomp env['F95'] = fcomp env['SHFORTRAN'] = '$FORTRAN' env['SHF95'] = '$...
import SCons.Util from FortranCommon import add_all_to_env
random_line_split
lsn.js
$(document).ready(function() { /* initialize the external events -----------------------------------------------------------------*/ $('#external-events div.external-event').each(function() { // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/) // it doesn't need t...
}; var cancel = function() { $("#dialog-form").dialog("close"); } var dialogOpts = { modal: true, position: "center", buttons: { "确定": execute, "取消": cancel } }; $("#dialog-form").dialog(dialogOpts); }); }, even...
event.className = color; calendar.fullCalendar('updateEvent', event); calendar.fullCalendar('refetchEvents');
random_line_split
originalXhrAgent.js
/** * only adapted XMLHttpRequest object. **/ let xhrObjectList = []; let proxyXhrOpen = () => { let handle = () => { let e = document.createEvent('Events'); e.initEvent('xhrRequestOpen'); let option = { url: arguments[1], method: arguments[0] }; e.opt = option; document.dispatchEven...
proxyXhrOpen, proxy, getXhrList };
random_line_split
originalXhrAgent.js
/** * only adapted XMLHttpRequest object. **/ let xhrObjectList = []; let proxyXhrOpen = () => { let handle = () => { let e = document.createEvent('Events'); e.initEvent('xhrRequestOpen'); let option = { url: arguments[1], method: arguments[0] }; e.opt = option; document.dispatchEven...
let xhrObject = getXhrProto(); if (xhrObject && xhrObject[funcName] && typeof xhrObject[funcName] === 'function') { let oldFunc = xhrObject[funcName]; xhrObject[funcName] = () => { injectFunc.apply(this, arguments); oldFunc.apply(this, arguments); }; } return true; }; let getXhrProto = () ...
{ return false; }
conditional_block
cli_options.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 */ export class CliOptions { public basePath: string|null; constructor({basePath = null}: {basePath?: string | null}...
this.missingTranslation = missingTranslation; } }
random_line_split
cli_options.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 */ export class CliOptions { public basePath: string|null; constructor({basePath = null}: {basePath?: string | null}...
extends CliOptions { public i18nFormat: string|null; public i18nFile: string|null; public locale: string|null; public missingTranslation: string|null; constructor({i18nFormat = null, i18nFile = null, locale = null, missingTranslation = null, basePath = null}: { i18nFormat?: string | null,...
NgcCliOptions
identifier_name
index.tsx
import * as Rx from 'rxjs/Rx'; import * as Cactus from '../../../core'; import * as React from '../../../drivers/react'; import * as Fetch from '../../../drivers/fetch'; import * as Events from '../../../drivers/events'; import { selectable } from '../../../react/helpers'; // app import { view, ViewEvents } from './vi...
(sources: Sources): Sinks { const events = selectable(sources.events); const responses$ = sources.fetch; const actions = intents(responses$, events); const { view$, events$ } = view(model(actions)); return { render: view$, fetch: generateRequest(actions.searchRequest$), events: events$, }; } Cactus.run<Sou...
main
identifier_name
index.tsx
import * as Rx from 'rxjs/Rx'; import * as Cactus from '../../../core'; import * as React from '../../../drivers/react'; import * as Fetch from '../../../drivers/fetch'; import * as Events from '../../../drivers/events'; import { selectable } from '../../../react/helpers'; // app import { view, ViewEvents } from './vi...
Cactus.run<Sources, Drivers>(main, { render: React.makeReactDOMDriver(document.getElementById('app')), fetch: Fetch.makeFetchJSONDriver(), events: Events.makeEventDriver(), });
{ const events = selectable(sources.events); const responses$ = sources.fetch; const actions = intents(responses$, events); const { view$, events$ } = view(model(actions)); return { render: view$, fetch: generateRequest(actions.searchRequest$), events: events$, }; }
identifier_body
index.tsx
import * as Rx from 'rxjs/Rx'; import * as Cactus from '../../../core'; import * as React from '../../../drivers/react'; import * as Fetch from '../../../drivers/fetch'; import * as Events from '../../../drivers/events'; import { selectable } from '../../../react/helpers'; // app import { view, ViewEvents } from './vi...
const events = selectable(sources.events); const responses$ = sources.fetch; const actions = intents(responses$, events); const { view$, events$ } = view(model(actions)); return { render: view$, fetch: generateRequest(actions.searchRequest$), events: events$, }; } Cactus.run<Sources, Drivers>(main, { rend...
} function main(sources: Sources): Sinks {
random_line_split