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
app.module.ts
import {BrowserModule} from "@angular/platform-browser"; import {NgModule} from "@angular/core"; import {FormsModule} from "@angular/forms"; import {HttpModule} from "@angular/http"; import {RouterModule} from "@angular/router"; import {AppComponent} from "./app.component"; import {BrowseComponent} from "./browse"; imp...
BrowseService, BrowseUtils, BrowsePreferencesService ], bootstrap: [ AppComponent ] }) export class AppModule { }
TreeTableModule ], providers: [
random_line_split
app.module.ts
import {BrowserModule} from "@angular/platform-browser"; import {NgModule} from "@angular/core"; import {FormsModule} from "@angular/forms"; import {HttpModule} from "@angular/http"; import {RouterModule} from "@angular/router"; import {AppComponent} from "./app.component"; import {BrowseComponent} from "./browse"; imp...
{ }
AppModule
identifier_name
0030_skill.py
# Generated by Django 3.0.2 on 2020-03-04 20:08 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration):
dependencies = [ ('files', '0004_image_compressed'), ('userprofile', '0029_auto_20200304_2007'), ] operations = [ migrations.CreateModel( name='Skill', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_...
identifier_body
0030_skill.py
# Generated by Django 3.0.2 on 2020-03-04 20:08 from django.db import migrations, models import django.db.models.deletion class
(migrations.Migration): dependencies = [ ('files', '0004_image_compressed'), ('userprofile', '0029_auto_20200304_2007'), ] operations = [ migrations.CreateModel( name='Skill', fields=[ ('id', models.AutoField(auto_created=True, primary_key=Tr...
Migration
identifier_name
ecp.py
partial ECP results. Optionally, aALenA is an array of object lengths in the same order that aAVlsA. aALenB is an array of object lengths in the same order that aAVlsB. aMskRef is a mask array for the miRNAs (i.e. arrays within array A and B). nThrds is the number of threads to run in parallel. intrvlSz is t...
rtrnSqlFlECP
identifier_name
ecp.py
folder to store partial ECP results. Optionally, aALenA is an array of object lengths in the same order that aAVlsA. aALenB is an array of object lengths in the same order that aAVlsB. aMskRef is a mask array for the miRNAs (i.e. arrays within array A and B). nThrds is the number of threads to run in paralle...
else: if dir(aALenB)[0]=='T': assert dir(aALenB)[1]=='T' mthdECPclc = rtrnECPDnsty else: assert not aALenA and not aALenB mthdECPclc = rtrnECP #-------------------------- #~ Create list of intervals for multithreading lenaMrnVlsDtA = len(aMrnVlsDtA) lenaMrnVlsDtB = len(aMrnVlsDtB) intrvlsMrnVlsA ...
assert not aALenA and not aALenB mthdECPclc = rtrnECPMskd
conditional_block
ecp.py
folder to store partial ECP results. Optionally, aALenA is an array of object lengths in the same order that aAVlsA. aALenB is an array of object lengths in the same order that aAVlsB. aMskRef is a mask array for the miRNAs (i.e. arrays within array A and B). nThrds is the number of threads to run in paralle...
c.execute('insert into records VALUES (?,?,?,?)', (str(lCnt), \ vrblANm,vrblBNm,float64(ECP))) # create indexes. Decrease complexity of querying c.execute("CREATE INDEX index_records on records (id);") conn.commit() conn.close() return 0 ######################################################## #~ Read a sql...
('''CREATE TABLE records (id TEXT, vrblANm TEXT, vrblBNm TEXT, ECP REAL)''') lCnt = 0 for vrblAPos,vrblBPos,ECP in lECPVlsAVlsBGlbl: vrblANm,vrblBNm = aANmsA[vrblAPos],aANmsB[vrblBPos] lCnt+=1
random_line_split
ecp.py
to store partial ECP results. Optionally, aALenA is an array of object lengths in the same order that aAVlsA. aALenB is an array of object lengths in the same order that aAVlsB. aMskRef is a mask array for the miRNAs (i.e. arrays within array A and B). nThrds is the number of threads to run in parallel. intr...
vrblANm,vrblBNm,float64(ECP))) # create indexes. Decrease complexity of querying c.execute("CREATE INDEX index_records on records (id);") conn.commit() conn.close() return 0 ######################################################## #~ Read a sqlite3 database for correlations between genes/lncRNAs of # intere...
""" Input: lECPVlsAVlsBGlbl is a list of tuples (vrblAPos,vrblBPos,ECP). vrblAPos is the position of the first variables, vrblBPos is the position of the second variable, ECP is the ECP value between vrblAPos and vrblBPos. A sqlite3 database will be created for the input list. aANmsA is the array of variable n...
identifier_body
factigisModuleList.js
function FactigisModuleList(){ return [ {module: 'GENERAR_FACTIBILIDAD', alias: 'CREAR', widgets:["CREAR_FACTIBILIDAD","BUSCAR_FOLIO","CREAR_DIRECCION"] , Available: 'yes', Permission: 'no', Insert: 'no', Update: 'no', Delete: 'no', url:'factigis.html', color: 'transparent', img:'dist/css/images/factigis_imag...
(list, permissions){ var newList = []; permissions.forEach(permission => { list.forEach(array => { if(array.module === permission.module){ newList.push({ module: array['module'], alias: array['alias'], available: array['Available'], Permission: 'yes', ...
FactigisInsertMyData
identifier_name
factigisModuleList.js
function FactigisModuleList(){ return [ {module: 'GENERAR_FACTIBILIDAD', alias: 'CREAR', widgets:["CREAR_FACTIBILIDAD","BUSCAR_FOLIO","CREAR_DIRECCION"] , Available: 'yes', Permission: 'no', Insert: 'no', Update: 'no', Delete: 'no', url:'factigis.html', color: 'transparent', img:'dist/css/images/factigis_images/...
} export {FactigisModuleList,FactigisInsertMyData,excludeDataFactigis};
return result;
random_line_split
factigisModuleList.js
function FactigisModuleList(){ return [ {module: 'GENERAR_FACTIBILIDAD', alias: 'CREAR', widgets:["CREAR_FACTIBILIDAD","BUSCAR_FOLIO","CREAR_DIRECCION"] , Available: 'yes', Permission: 'no', Insert: 'no', Update: 'no', Delete: 'no', url:'factigis.html', color: 'transparent', img:'dist/css/images/factigis_imag...
}); }); return newList; } function excludeDataFactigis(allList, yourList,yourPropList){ var props = yourPropList; var result = allList.filter(function(o1){ // filter out (!) items in result2 return !yourList.some(function(o2){ return o1.module === o2.module; // assumes unique id ...
{ newList.push({ module: array['module'], alias: array['alias'], available: array['Available'], Permission: 'yes', Insert: permission['insert'], Update: permission['update'], Delete: permission['delete'], url:array['url'], ...
conditional_block
factigisModuleList.js
function FactigisModuleList(){ return [ {module: 'GENERAR_FACTIBILIDAD', alias: 'CREAR', widgets:["CREAR_FACTIBILIDAD","BUSCAR_FOLIO","CREAR_DIRECCION"] , Available: 'yes', Permission: 'no', Insert: 'no', Update: 'no', Delete: 'no', url:'factigis.html', color: 'transparent', img:'dist/css/images/factigis_imag...
export {FactigisModuleList,FactigisInsertMyData,excludeDataFactigis};
{ var props = yourPropList; var result = allList.filter(function(o1){ // filter out (!) items in result2 return !yourList.some(function(o2){ return o1.module === o2.module; // assumes unique id }); }).map(function(o){ // use reduce to make objects with only the required properties ...
identifier_body
Chatbubble.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class Chatbubble extends React.Component { render() { if(this.props.bare)
return <IconBase> <path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2 c4.3,0,8.4,0.8,12.1,2.4l84,30.9l-22.1-88.4c0-5.3,1.5-10.3,3.9-14.6c0,0,0,0,0,0c0.8-1.3,1.6-2.6,2.5-3.7 c20.9-31.3,33-68.5,33-108.4C464,137.9,370.9,48,256,48C141.1,48,48,137.9,48,248.7C48,...
{ return <g> <path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2 c4.3,0,8.4,0.8,12.1,2.4l84,30.9l-22.1-88.4c0-5.3,1.5-10.3,3.9-14.6c0,0,0,0,0,0c0.8-1.3,1.6-2.6,2.5-3.7 c20.9-31.3,33-68.5,33-108.4C464,137.9,370.9,48,256,48C141.1,48,48,137.9,48,248.7C48,359...
conditional_block
Chatbubble.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class Chatbubble extends React.Component { render() { if(this.props.bare) { return <g> <path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2 c4.3,0,8.4,0.8,...
</g>; } return <IconBase> <path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2 c4.3,0,8.4,0.8,12.1,2.4l84,30.9l-22.1-88.4c0-5.3,1.5-10.3,3.9-14.6c0,0,0,0,0,0c0.8-1.3,1.6-2.6,2.5-3.7 c20.9-31.3,33-68.5,33-108.4C464,137.9,370.9,48,256,48C141.1,48,48,137.9,...
random_line_split
Chatbubble.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class Chatbubble extends React.Component { render()
};Chatbubble.defaultProps = {bare: false}
{ if(this.props.bare) { return <g> <path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2 c4.3,0,8.4,0.8,12.1,2.4l84,30.9l-22.1-88.4c0-5.3,1.5-10.3,3.9-14.6c0,0,0,0,0,0c0.8-1.3,1.6-2.6,2.5-3.7 c20.9-31.3,33-68.5,33-108.4C464,137.9,370.9,48,256,48C141.1,48,48...
identifier_body
Chatbubble.js
import React from 'react'; import IconBase from './../components/IconBase/IconBase'; export default class
extends React.Component { render() { if(this.props.bare) { return <g> <path d="M256,449.4c28.9,0,56.4-5.7,81.3-15.9c0.6-0.3,1.1-0.5,1.7-0.7c0.1,0,0.2,0,0.2-0.1c3.5-1.3,7.3-2,11.2-2 c4.3,0,8.4,0.8,12.1,2.4l84,30.9l-22.1-88.4c0-5.3,1.5-10.3,3.9-14.6c0,0,0,0,0,0c0.8-1.3,1.6-2.6,2.5-3.7 c20.9-31.3,33-68.5,33-108.4C...
Chatbubble
identifier_name
hub.js
'use strict'; var https = require('https'); var q = require('q'); function logError(error) { console.log("[Lightify] Error!"); if (error.statusMessage) { console.log("[Lightify] HTTP Error: " + error.statusCode + " - " + error.statusMessage); console.log("[Lightify] HTTP Headers: "); ...
}); } };
random_line_split
hub.js
'use strict'; var https = require('https'); var q = require('q'); function
(error) { console.log("[Lightify] Error!"); if (error.statusMessage) { console.log("[Lightify] HTTP Error: " + error.statusCode + " - " + error.statusMessage); console.log("[Lightify] HTTP Headers: "); console.log(error.headers); } else { console.log(error); } } var ...
logError
identifier_name
hub.js
'use strict'; var https = require('https'); var q = require('q'); function logError(error) { console.log("[Lightify] Error!"); if (error.statusMessage) { console.log("[Lightify] HTTP Error: " + error.statusCode + " - " + error.statusMessage); console.log("[Lightify] HTTP Headers: "); ...
} var internal = { // global Osram Lightify constants lightifyBaseUrl : "us.lightify-api.org", lightifySessionUrl : "/lightify/services/session", lightifyDevicesUrl : "/lightify/services/devices/", deviceSerialNumber: undefined, username: undefined, password: undefined, securityToken:...
{ console.log(error); }
conditional_block
hub.js
'use strict'; var https = require('https'); var q = require('q'); function logError(error)
var internal = { // global Osram Lightify constants lightifyBaseUrl : "us.lightify-api.org", lightifySessionUrl : "/lightify/services/session", lightifyDevicesUrl : "/lightify/services/devices/", deviceSerialNumber: undefined, username: undefined, password: undefined, securityToken: u...
{ console.log("[Lightify] Error!"); if (error.statusMessage) { console.log("[Lightify] HTTP Error: " + error.statusCode + " - " + error.statusMessage); console.log("[Lightify] HTTP Headers: "); console.log(error.headers); } else { console.log(error); } }
identifier_body
json.rs
use std::collections::HashMap; use std::fmt; use std::mem; use serde::de::{self, Deserializer, Visitor}; use serde::ser::{SerializeStruct, Serializer}; use serde::{Deserialize, Serialize}; use crate::bail; use crate::errors::FinchResult; use crate::filtering::FilterParams; pub use crate::serialization::mash::{read_ma...
pub fn to_sketches(&self) -> FinchResult<Vec<Sketch>> { let empty_hashmap = HashMap::new(); let mut sketches = Vec::with_capacity(self.sketches.len()); let sketch_params = self.get_params()?; for sketch in &self.sketches { let filters = sketch.filters.as_ref().unwrap_or...
{ let json_sketches: Vec<JsonSketch> = sketches.iter().map(|x| (*x).clone().into()).collect(); let sketch_params = SketchParams::from_sketches(&sketches)?; // TODO: the scale isn't actually harmonized between the sketches at // this point; it probably should be? let (hash_type, h...
identifier_body
json.rs
use std::collections::HashMap; use std::fmt; use std::mem; use serde::de::{self, Deserializer, Visitor}; use serde::ser::{SerializeStruct, Serializer}; use serde::{Deserialize, Serialize}; use crate::bail; use crate::errors::FinchResult; use crate::filtering::FilterParams; pub use crate::serialization::mash::{read_ma...
pub num_valid_kmers: Option<u64>, pub comment: Option<String>, pub filters: Option<HashMap<String, String>>, pub hashes: Vec<KmerCount>, } impl JsonSketch { pub fn new( name: &str, length: u64, n_kmers: u64, kmercounts: Vec<KmerCount>, filters: &HashMap<Strin...
#[derive(Clone, Debug, Eq, PartialEq)] pub struct JsonSketch { pub name: String, pub seq_length: Option<u64>,
random_line_split
json.rs
use std::collections::HashMap; use std::fmt; use std::mem; use serde::de::{self, Deserializer, Visitor}; use serde::ser::{SerializeStruct, Serializer}; use serde::{Deserialize, Serialize}; use crate::bail; use crate::errors::FinchResult; use crate::filtering::FilterParams; pub use crate::serialization::mash::{read_ma...
<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { let mut hash_list = Vec::with_capacity(self.hashes.len()); let mut kmer_list = Vec::with_capacity(self.hashes.len()); let mut count_list = Vec::with_capacity(self.hashes.len()); for hash in &self....
serialize
identifier_name
website_settings.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import get_request_site_address, encode from frappe.model.document import Document from six.moves.urllib.parse import quote fr...
# attach child items to top bar for d in all_top_items: if d['parent_label']: for t in top_items: if t['label']==d['parent_label']: if not 'child_items' in t: t['child_items'] = [] t['child_items'].append(d) break return top_items
select * from `tabTop Bar Item` where parent='Website Settings' and parentfield= %s order by idx asc""", parentfield, as_dict=1) top_items = [d for d in all_top_items if not d['parent_label']]
random_line_split
website_settings.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import get_request_site_address, encode from frappe.model.document import Document from six.moves.urllib.parse import quote fr...
def validate_top_bar_items(self): """validate url in top bar items""" for top_bar_item in self.get("top_bar_items"): if top_bar_item.parent_label: parent_label_item = self.get("top_bar_items", {"label": top_bar_item.parent_label}) if not parent_label_item: # invalid item frappe.throw(_("{0}...
frappe.msgprint(_("Invalid Home Page") + " (Standard pages - index, login, products, blog, about, contact)") self.home_page = ''
conditional_block
website_settings.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import get_request_site_address, encode from frappe.model.document import Document from six.moves.urllib.parse import quote fr...
(self): self.clear_cache() def clear_cache(self): # make js and css # clear web cache (for menus!) frappe.clear_cache(user = 'Guest') from frappe.website.render import clear_cache clear_cache() # clears role based home pages frappe.clear_cache() def get_website_settings(): hooks = frappe.get_hooks...
on_update
identifier_name
website_settings.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import get_request_site_address, encode from frappe.model.document import Document from six.moves.urllib.parse import quote fr...
def validate_top_bar_items(self): """validate url in top bar items""" for top_bar_item in self.get("top_bar_items"): if top_bar_item.parent_label: parent_label_item = self.get("top_bar_items", {"label": top_bar_item.parent_label}) if not parent_label_item: # invalid item frappe.throw(_("{0}...
if frappe.flags.in_install: return if self.home_page and not resolve_route(self.home_page): frappe.msgprint(_("Invalid Home Page") + " (Standard pages - index, login, products, blog, about, contact)") self.home_page = ''
identifier_body
DirectoryUtils.ts
/* Copyright 2018 The Matrix.org Foundation C.I.C. 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 ...
(protocols: Protocols, instanceId: string): IInstance { if (!instanceId) return null; for (const proto of Object.keys(protocols)) { if (!protocols[proto].instances && protocols[proto].instances instanceof Array) continue; for (const instance of protocols[proto].instances) { if (insta...
instanceForInstanceId
identifier_name
DirectoryUtils.ts
/* Copyright 2018 The Matrix.org Foundation C.I.C. 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 ...
{ if (!instanceId) return null; for (const proto of Object.keys(protocols)) { if (!protocols[proto].instances && protocols[proto].instances instanceof Array) continue; for (const instance of protocols[proto].instances) { if (instance.instance_id == instanceId) return proto; }...
identifier_body
DirectoryUtils.ts
/* Copyright 2018 The Matrix.org Foundation C.I.C. 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 ...
for (const proto of Object.keys(protocols)) { if (!protocols[proto].instances && protocols[proto].instances instanceof Array) continue; for (const instance of protocols[proto].instances) { if (instance.instance_id == instanceId) return proto; } } }
if (!instanceId) return null;
random_line_split
__init__.py
# Copyright 2015 Peter van Zetten # # This file is part of pypkgmirror. # # pypkgmirror is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version....
""" log.info("Syncing repository '%s' hosted at %s", agent.name, agent.host) outfile_path = "%s/%s.out" % (conf['logdir'], agent.name) errfile_path = "%s/%s.err" % (conf['logdir'], agent.name) mkdir(os.path.dirname(outfile_path)) mkdir(agent.basedir) with open(outfile_path, 'w') as outfil...
random_line_split
__init__.py
# Copyright 2015 Peter van Zetten # # This file is part of pypkgmirror. # # pypkgmirror is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version....
if __name__ == "__main__": main()
""" Trigger a subprocess execution with optional stdout/stderr redirection and trivial handling of missing executables. """ try: subprocess.call(call, stdout=stdout, stderr=stderr) except OSError as e: if e.errno == os.errno.ENOENT: log.error("The required program %s was ...
identifier_body
__init__.py
# Copyright 2015 Peter van Zetten # # This file is part of pypkgmirror. # # pypkgmirror is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version....
(d): try: os.makedirs(d) except OSError as exception: if exception.errno != errno.EEXIST: raise def main(): """ Script entry point for pypkgmirror. Parses the configuration and assembles a collection of subprocess calls, then invokes them. """ from pypkgmir...
mkdir
identifier_name
__init__.py
# Copyright 2015 Peter van Zetten # # This file is part of pypkgmirror. # # pypkgmirror is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version....
mirrors = [] aptly_mirrors = [] # aptly shares a database so these should not be parallel for _ in conf.get('mirrors', {}).get('debmirror', []): mirrors.append(DebmirrorAgent(_, conf['mirrors']['debmirror'][_])) for _ in conf.get('mirrors', {}).get('rsync', []): mirrors.append(Rsync...
log.setLevel(conf['loglevel'])
conditional_block
NodeSchema.ts
import { Schema } from "jsonschema"; export const NodeSchema: Schema = { id: "/Model/Node", type: "object", properties: { nodeId: { $ref: "/Model/UUID" }, mappingName: { type: "string" }, properties: { $ref: "/Model/NodeProperties" } // audit: { // $ref: "/Audi...
type: ["string", "number", "boolean"] } }, { $ref: "/Model/NodeProperties" } ] };
}, { type: "array", items: {
random_line_split
validation.service.ts
import { Injectable } from '@angular/core'; import * as moment from 'moment'; @Injectable() export class ValidationService { static errorMessages = { required: 'This field is required', invalidEmailAddress: 'It doesn\'t look like that\'s a valid email', notEquivalent: 'Passwords should match', minle...
// Thanks!: http://mlitzinger.com/articles/password-validator-js/ static oneLowercase(control) { let regex = /^(?=.*[a-z]).+$/; if ( regex.test(control.value) ) { return null; } else { return { 'needsLowercase': true }; } } static oneUppercase(control) { let regex = /^(?=.*[A...
if (control.value.length === 0) { return null; } let after = moment().subtract(1, 'day'); let thisMoment; if (moment( control.value, 'M/D/YYYY' ).isValid()) { thisMoment = moment( control.value, 'M/D/YYYY' ); } else if (moment( control.value, 'YYYY-MM-DD' ).isValid()) { thisMoment = mom...
identifier_body
validation.service.ts
import { Injectable } from '@angular/core'; import * as moment from 'moment'; @Injectable() export class ValidationService { static errorMessages = { required: 'This field is required', invalidEmailAddress: 'It doesn\'t look like that\'s a valid email', notEquivalent: 'Passwords should match', minle...
else { return { 'invalidDate': true }; } } static futureDate(control) { if (control.value.length === 0) { return null; } let after = moment().subtract(1, 'day'); let thisMoment; if (moment( control.value, 'M/D/YYYY' ).isValid()) { thisMoment = moment( control.value, 'M/D/YYYY' ); ...
return null; }
conditional_block
validation.service.ts
import { Injectable } from '@angular/core'; import * as moment from 'moment'; @Injectable() export class ValidationService { static errorMessages = { required: 'This field is required', invalidEmailAddress: 'It doesn\'t look like that\'s a valid email', notEquivalent: 'Passwords should match', minle...
control) { let regex = /\d/; if ( regex.test(control.value) ) { return null; } else { return { 'needsNumber': true }; } } static oneSpecial(control) { let regex = /[-!@^"§$%&/()=?+*~#'_:.,;]/; if ( regex.test(control.value) ) { return null; } else { return { 'nee...
neNumber(
identifier_name
validation.service.ts
import { Injectable } from '@angular/core'; import * as moment from 'moment'; @Injectable() export class ValidationService { static errorMessages = { required: 'This field is required', invalidEmailAddress: 'It doesn\'t look like that\'s a valid email', notEquivalent: 'Passwords should match', minle...
return { 'needsSpecial': true }; } } static matchingPasswords(passwordKey: string, passwordConfirmationKey: string) { return (group) => { let passwordInput = group.controls[passwordKey]; let passwordConfirmationInput = group.controls[passwordConfirmationKey]; if (passwordInput.value...
random_line_split
jest.plugin.config.ts
import path = require('path'); import fs from 'fs'; export const allowedJestConfigOverrides = [ 'snapshotSerializers', 'moduleNameMapper', 'globalSetup', 'globalTeardown', 'testEnvironment', ]; interface EnabledJestConfigOverrides { snapshotSerializers: string[]; moduleNameMapper: { [key: string]: strin...
const shimsFilePath = path.resolve(baseDir, 'config/jest-shim'); const setupFilePath = path.resolve(baseDir, 'config/jest-setup'); // Mock css imports for tests. Otherwise Jest will have troubles understanding SASS/CSS imports const { moduleNameMapper, ...otherOverrides } = jestConfigOverrides; const modul...
{ console.error("\ngrafana-toolkit doesn't support following Jest options: ", deniedOverrides); console.log('Supported Jest options are: ', JSON.stringify(allowedJestConfigOverrides)); throw new Error('Provided Jest config is not supported'); }
conditional_block
jest.plugin.config.ts
import path = require('path'); import fs from 'fs'; export const allowedJestConfigOverrides = [ 'snapshotSerializers', 'moduleNameMapper', 'globalSetup', 'globalTeardown', 'testEnvironment', ]; interface EnabledJestConfigOverrides { snapshotSerializers: string[]; moduleNameMapper: { [key: string]: strin...
'^.+\\.js$': 'babel-jest', '^.+\\.tsx?$': require.resolve('ts-jest'), }, transformIgnorePatterns: [ '[/\\\\\\\\]node_modules[/\\\\\\\\].+\\\\.(js|jsx|ts|tsx)$', '^.+\\\\.module\\\\.(css|sass|scss)$', ], moduleNameMapper: moduleNameMapperConfig, }; return { ...defaultJest...
transform: {
random_line_split
randomInt.ts
const random = (num: number): number => Math.round(Math.random() * num); const range = (num: number, num2: number): number => { if (num2 < num) { [num, num2] = [num2, num]; } return random(num2 - num) + num; }; /** * Returns a random integer from a base number or range of numbers * * @e...
export default function randomInt(num: number, num2?: number): number { return num2 === undefined ? random(num) : range(num, num2); }
random_line_split
randomInt.ts
const random = (num: number): number => Math.round(Math.random() * num); const range = (num: number, num2: number): number => { if (num2 < num) { [num, num2] = [num2, num]; } return random(num2 - num) + num; }; /** * Returns a random integer from a base number or range of numbers * * @e...
(num: number, num2?: number): number { return num2 === undefined ? random(num) : range(num, num2); }
randomInt
identifier_name
randomInt.ts
const random = (num: number): number => Math.round(Math.random() * num); const range = (num: number, num2: number): number => { if (num2 < num) { [num, num2] = [num2, num]; } return random(num2 - num) + num; }; /** * Returns a random integer from a base number or range of numbers * * @e...
{ return num2 === undefined ? random(num) : range(num, num2); }
identifier_body
randomInt.ts
const random = (num: number): number => Math.round(Math.random() * num); const range = (num: number, num2: number): number => { if (num2 < num)
return random(num2 - num) + num; }; /** * Returns a random integer from a base number or range of numbers * * @example * ```ts * // Direct base number * randomInt(100); // -> a number between 0 and 100 * * // A range of numbers * randomInt(100, 200); // -> a number between 100 and 200 ...
{ [num, num2] = [num2, num]; }
conditional_block
cpat.py
# -*- coding: utf-8 -*- """ Copyright [2009-2021] EMBL-European Bioinformatics Institute 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...
cutoffs = parser.cutoffs(Path(data_folder)) pickle.dump(cutoffs, output)
identifier_body
cpat.py
# -*- coding: utf-8 -*- """ Copyright [2009-2021] EMBL-European Bioinformatics Institute 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...
import click from rnacentral_pipeline.cpat import parser from rnacentral_pipeline.cpat.data import CpatWriter from rnacentral_pipeline.writers import build @click.group("cpat") def cli(): """ Commands with processing the Rfam metadata. """ pass @cli.command("parse") @click.argument("cutoffs", type...
from pathlib import Path import pickle
random_line_split
cpat.py
# -*- coding: utf-8 -*- """ Copyright [2009-2021] EMBL-European Bioinformatics Institute 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...
(cutoffs, model_name, results, output): cutoffs = pickle.load(cutoffs) data = parser.parse(cutoffs, model_name, Path(results)) with build(CpatWriter, Path(output)) as wtr: wtr.write(data) @cli.command("generate-cutoffs") @click.argument("data-folder", type=click.Path()) @click.argument("output", t...
parse
identifier_name
NodeConsole.js
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2006-2011 1&1 Internet AG, Germany, http://www.1and1.org License: LGPL: http://www.gnu.org/licenses/lgpl.html EPL: http://www.eclipse.org/org/...
} } }, /** * @lint ignoreUndefined(process) */ defer : function(statics) { if (typeof(process) !== "undefined") { statics.__OUT = process.stdout; statics.__ERR = process.stderr; } } });
{ var items = entry[prop]; for (var p=0; p<items.length; p++) { var item = items[p]; this[level](item.text); } }
conditional_block
NodeConsole.js
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2006-2011 1&1 Internet AG, Germany, http://www.1and1.org License: LGPL: http://www.gnu.org/licenses/lgpl.html EPL: http://www.eclipse.org/org/...
/** * Process a log entry object from qooxdoo's logging system. * * @param entry {Map} Log entry object */ process : function(entry) { var level = entry.level || "info"; for (var prop in entry) { if (prop == "items") { var items = entry[prop]; for...
random_line_split
tvigle.py
# encoding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( float_or_none, parse_age_limit, ) class TvigleIE(InfoExtractor): IE_NAME = 'tvigle' IE_DESC = 'Интернет-телевидение Tvigle.ru' _VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?...
video_id, 'display_id': display_id, 'title': title, 'description': description, 'thumbnail': thumbnail, 'duration': duration, 'age_limit': age_limit, 'formats': formats, }
'format_id': '%s-%s' % (vcodec, quality), 'vcodec': vcodec, 'height': int(quality[:-1]), 'filesize': item['video_files_size'][vcodec][quality], }) self._sort_formats(formats) return { 'id':
conditional_block
tvigle.py
# encoding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( float_or_none, parse_age_limit, ) class TvigleIE(InfoExtractor): IE_NAME = 'tvigle' IE_DESC = 'Интернет-телевидение Tvigle.ru' _VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?...
webpage = self._download_webpage(url, display_id) video_id = self._html_search_regex( r'<li class="video-preview current_playing" id="(\d+)">', webpage, 'video id') video_data = self._download_json( 'http://cloud.tvigle.ru/api/play/video/%s/' % video_id, display_id) ...
def _real_extract(self, url): display_id = self._match_id(url)
random_line_split
tvigle.py
# encoding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( float_or_none, parse_age_limit, ) class TvigleIE(InfoExtractor):
'md5': 'd9012d7c7c598fe7a11d7fb46dc1f574', 'info_dict': { 'id': '5142516', 'ext': 'mp4', 'title': 'Ведущий телепрограммы «60 минут» (США) о Владимире Высоцком', 'description': 'md5:027f7dc872948f14c96d19b4178428a4', ...
IE_NAME = 'tvigle' IE_DESC = 'Интернет-телевидение Tvigle.ru' _VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?P<id>[^/]+)/$' _TESTS = [ { 'url': 'http://www.tvigle.ru/video/sokrat/', 'md5': '36514aed3657d4f70b4b2cef8eb520cd', 'info_dict': { ...
identifier_body
tvigle.py
# encoding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( float_or_none, parse_age_limit, ) class TvigleIE(InfoExtractor): IE_NAME = 'tvigle' IE_DESC = 'Интернет-телевидение Tvigle.ru' _VALID_URL = r'http://(?:www\.)?tvigle\.ru/(?:[^/]+/)+(?...
self._download_webpage(url, display_id) video_id = self._html_search_regex( r'<li class="video-preview current_playing" id="(\d+)">', webpage, 'video id') video_data = self._download_json( 'http://cloud.tvigle.ru/api/play/video/%s/' % video_id, display_id) item = video...
webpage =
identifier_name
exhaustive_natural_range.rs
use itertools::Itertools; use malachite_base::num::basic::traits::{One, Zero}; use malachite_base::num::conversion::traits::ExactFrom; use malachite_base::strings::ToDebugString; use malachite_nz::natural::exhaustive::exhaustive_natural_range; use malachite_nz::natural::Natural; fn expected_range_len(a: &Natural, b: &...
() { exhaustive_natural_range_helper(Natural::ZERO, Natural::ZERO, "[]"); exhaustive_natural_range_helper(Natural::ZERO, Natural::ONE, "[0]"); exhaustive_natural_range_helper( Natural::ZERO, Natural::exact_from(10), "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]", ); exhaustive_natural_rang...
test_exhaustive_natural_range
identifier_name
exhaustive_natural_range.rs
use itertools::Itertools; use malachite_base::num::basic::traits::{One, Zero}; use malachite_base::num::conversion::traits::ExactFrom; use malachite_base::strings::ToDebugString; use malachite_nz::natural::exhaustive::exhaustive_natural_range; use malachite_nz::natural::Natural; fn expected_range_len(a: &Natural, b: &...
{ exhaustive_natural_range(Natural::ONE, Natural::ZERO); }
identifier_body
exhaustive_natural_range.rs
use itertools::Itertools; use malachite_base::num::basic::traits::{One, Zero}; use malachite_base::num::conversion::traits::ExactFrom; use malachite_base::strings::ToDebugString; use malachite_nz::natural::exhaustive::exhaustive_natural_range; use malachite_nz::natural::Natural; fn expected_range_len(a: &Natural, b: &...
assert_eq!(xs, values); let len = expected_range_len(&a, &b); assert_eq!(exhaustive_natural_range(a.clone(), b.clone()).count(), len); let mut init = exhaustive_natural_range(a, b) .rev() .skip(len.saturating_sub(20)) .collect_vec(); init.reverse(); assert_eq!(xs, init.to...
.collect_vec() .to_debug_string();
random_line_split
brd-restructure.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import pprint import proteindf_bridge as bridge import logging import logging.config def get_rest_of_frame_molecule(frame_molecule, selected_molecule): # calc the rest
def assign_rest_molecule(rest_molecule, output_atom_group, model_id="model_1", chain_id="Z", res_name="UNK"): chain = bridge.AtomGroup() res = bridge.AtomGroup() res.name = res_name atom_id = 1 for atom in rest_molecule.get_atom_list(): res.set_atom(atom_id, atom)...
selector = bridge.Select_AtomGroup(selected_molecule) selected = frame_molecule.select(selector) rest_molecule = frame_molecule ^ selected return rest_molecule
identifier_body
brd-restructure.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import pprint import proteindf_bridge as bridge import logging import logging.config def get_rest_of_frame_molecule(frame_molecule, selected_molecule): # calc the rest selector = bridge.Select_AtomGroup(selected_molecule) selected ...
# load target_ag = bridge.load_atomgroup(target_brd_path) ref_ag = bridge.load_atomgroup(ref_brd_path) # matching #target_selector = bridge.Select_AtomGroup(target_ag) #restructured = ref_ag.select(target_selector) # calc the rest #rest_of_target = get_rest_of_frame_molecule(target_a...
print("target: {}".format(target_brd_path)) print("reference: {}".format(ref_brd_path))
conditional_block
brd-restructure.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import pprint import proteindf_bridge as bridge import logging import logging.config def get_rest_of_frame_molecule(frame_molecule, selected_molecule): # calc the rest selector = bridge.Select_AtomGroup(selected_molecule) selected ...
(rest_molecule, output_atom_group, model_id="model_1", chain_id="Z", res_name="UNK"): chain = bridge.AtomGroup() res = bridge.AtomGroup() res.name = res_name atom_id = 1 for atom in rest_molecule.get_atom_list(): res.set_atom(atom_id, atom) atom_id += 1 c...
assign_rest_molecule
identifier_name
brd-restructure.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import argparse import pprint import proteindf_bridge as bridge import logging import logging.config def get_rest_of_frame_molecule(frame_molecule, selected_molecule): # calc the rest selector = bridge.Select_AtomGroup(selected_molecule) selected ...
# load target_ag = bridge.load_atomgroup(target_brd_path) ref_ag = bridge.load_atomgroup(ref_brd_path) # matching #target_selector = bridge.Select_AtomGroup(target_ag) #restructured = ref_ag.select(target_selector) # calc the rest #rest_of_target = get_rest_of_frame_molecule(target_ag,...
random_line_split
generic-tuple-style-enum.rs
// Copyright 2013-2014 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...
// gdb-check:$4 = {{-1}} // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:print case1 // lldb-check:[...]$0 = Case1(0, 31868, 31868, 31868, 31868) // lldb-command:print case2 // lldb-check:[...]$1 = Case2(0, 286331153, 28633115...
random_line_split
generic-tuple-style-enum.rs
// Copyright 2013-2014 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...
() { () }
zzz
identifier_name
install.py
# MIT License. See license.txt # called from wnf.py # lib/wnf.py --install [rootpassword] [dbname] [source] from __future__ import unicode_literals import os, sys, json import webnotes import webnotes.db import getpass from webnotes.model.db_schema import DbManager from webnotes.model.sync import sync_for from web...
(site, db_name=None, db_password=None, site_config=None): import conf if not getattr(conf, "sites_dir", None): raise Exception("sites_dir missing in conf.py") site_path = os.path.join(conf.sites_dir, site) if not os.path.exists(site_path): os.mkdir(site_path) site_file = os.path.join(site_path, "site_co...
make_site_config
identifier_name
install.py
# MIT License. See license.txt # called from wnf.py # lib/wnf.py --install [rootpassword] [dbname] [source] from __future__ import unicode_literals import os, sys, json import webnotes import webnotes.db import getpass from webnotes.model.db_schema import DbManager from webnotes.model.sync import sync_for from web...
# update admin password self.update_admin_password(admin_password) # create public folder from webnotes.install_lib import setup_public_folder setup_public_folder.make(site=self.site) if not self.site: from webnotes.build import bundle bundle(False) return db_name def install_app(se...
self.install_app(verbose=verbose)
random_line_split
install.py
# MIT License. See license.txt # called from wnf.py # lib/wnf.py --install [rootpassword] [dbname] [source] from __future__ import unicode_literals import os, sys, json import webnotes import webnotes.db import getpass from webnotes.model.db_schema import DbManager from webnotes.model.sync import sync_for from web...
self.dbman.flush_privileges() # close root connection self.conn.close() webnotes.connect(db_name=db_name, site=self.site) self.dbman = DbManager(webnotes.conn) # import in db_name if verbose: print "Starting database import..." # get the path of the sql file to import if not source_sql: sou...
if force or (db_name not in self.dbman.get_database_list()): # delete user (if exists) self.dbman.delete_user(db_name) else: raise Exception("Database %s already exists" % (db_name,)) # create user and db self.dbman.create_user(db_name, webnotes.conf.db_password) if verbose: print "Created user %s...
identifier_body
install.py
# MIT License. See license.txt # called from wnf.py # lib/wnf.py --install [rootpassword] [dbname] [source] from __future__ import unicode_literals import os, sys, json import webnotes import webnotes.db import getpass from webnotes.model.db_schema import DbManager from webnotes.model.sync import sync_for from web...
elif os.path.exists("conf.py"): print "conf.py exists" else: # pyc file exists but py doesn't raise ImportError except ImportError: if site: raise Exception("conf.py does not exist") else: # create conf.py with open(os.path.join("lib", "conf", "conf.py"), "r") as confsrc: with open("...
make_site_config(site, db_name, db_password, site_config)
conditional_block
web-router.js
'use strict'; var Route = (function(){ /** * Variables */ var realPath = null, currentPath = null, currentRouteIndex = null, _on = [{ event: 'change', callback: function(){} }]; /** * events * This object handles the registration and handling of events rela...
path = path.join('/'); if(path[path.length-1] === '/') path = path.slice(0, -1); route.path = path; return route; } /** * find * Find iterates over the registered routes and looks for matches * if no route matches, the start look for routes with variables * * @return {unde...
{ path = path.split('/'); var rp = realPath.split('/'); var route = { data: [], path: '', }; for(var i = 0; i < path.length; i++){ if(path[i][0] === ':'){ if(rp[i]){ Route.data[path[i].replace(':', '').replace('?', '')] = decodeURI(rp[i]); route.data.pu...
identifier_body
web-router.js
'use strict'; var Route = (function(){ /** * Variables */ var realPath = null, currentPath = null, currentRouteIndex = null, _on = [{ event: 'change', callback: function(){} }]; /** * events * This object handles the registration and handling of events rela...
(path, middleware, callback, options){ if(path[0] != '/') path = '/'+path; if(path[path.length-1] == '/') path = path.slice(0, -1); Route.paths.push({ path: path, middleware: middleware, callback: callback }); } /** * getParams * This function retrieves url pa...
build
identifier_name
web-router.js
'use strict'; var Route = (function(){ /** * Variables */ var realPath = null, currentPath = null, currentRouteIndex = null, _on = [{ event: 'change', callback: function(){} }]; /** * events * This object handles the registration and handling of events rela...
path = path.join('/'); if(path[path.length-1] === '/') path = path.slice(0, -1); route.path = path; return route; } /** * find * Find iterates over the registered routes and looks for matches * if no route matches, the start look for routes with variables * * @return {undef...
random_line_split
web-router.js
'use strict'; var Route = (function(){ /** * Variables */ var realPath = null, currentPath = null, currentRouteIndex = null, _on = [{ event: 'change', callback: function(){} }]; /** * events * This object handles the registration and handling of events rela...
} /** * pathConstructor * Creates a defined route with variables and turns it into a usable route * * @param {Sring} path is a string of the route which needs to be formated * @return {Object} contains the formatted route and a mapping of the variables in the route */ function pathConstructo...
{ var params = window.location.search.replace('?', '').split('&'); for(var i = 0; i < params.length; i++){ var key = decodeURI(params[i].split('=')[0]); var value = decodeURI(params[i].split('=')[1]); Route.data[key] = value; } }
conditional_block
documentOrderUtils.ts
1 otherwise */ function compareSiblingElements( domFacade: DomFacade, node1: NodePointer, node2: NodePointer ): number { const parentNode = domFacade.getParentNodePointer(node1 as ChildNodePointer, null); const childNodes = domFacade.getChildNodePointers(parentNode, null); for (let i = 0, l = childNodes.length; ...
// Compare positions under the common ancestor const parentNode = actualAncestorsB[y - 1]; const childNodes = domFacade.getChildNodes(parentNode as ConcreteParentNode, null); for (let m = 0, n = childNodes.length; m < n; ++m) { const childNode = childNodes[m]; if (childNode === actualAncestorA) { re...
{ // All nodes under a node are higher in document order than said node return 1; }
conditional_block
documentOrderUtils.ts
1 otherwise */ function compareSiblingElements( domFacade: DomFacade, node1: NodePointer, node2: NodePointer ): number { const parentNode = domFacade.getParentNodePointer(node1 as ChildNodePointer, null); const childNodes = domFacade.getChildNodePointers(parentNode, null); for (let i = 0, l = childNodes.length; ...
( tieBreakerArr: NodePointer[], domFacade: DomFacade, node1: Value, node2: Value ) { const isNode1SubtypeOfAttribute = isSubtypeOf(node1.type, ValueType.ATTRIBUTE); const isNode2SubtypeOfAttribute = isSubtypeOf(node2.type, ValueType.ATTRIBUTE); let value1: NodePointer; let value2: NodePointer; if (isNode1Subty...
compareNodePositionsWithTieBreaker
identifier_name
documentOrderUtils.ts
1 otherwise */ function compareSiblingElements( domFacade: DomFacade, node1: NodePointer, node2: NodePointer ): number { const parentNode = domFacade.getParentNodePointer(node1 as ChildNodePointer, null); const childNodes = domFacade.getChildNodePointers(parentNode, null); for (let i = 0, l = childNodes.length; ...
/** * Sort (and deduplicate) the nodeValues in DOM order * Attributes are placed after their elements, before childnodes. * Attributes are sorted alphabetically by their names * * @param domFacade * @param nodeValues * * @return The
{ return compareNodePositionsWithTieBreaker( domFacade.orderOfDetachedNodes, domFacade, node1, node2 ); }
identifier_body
documentOrderUtils.ts
1 otherwise */ function compareSiblingElements( domFacade: DomFacade, node1: NodePointer, node2: NodePointer ): number { const parentNode = domFacade.getParentNodePointer(node1 as ChildNodePointer, null); const childNodes = domFacade.getChildNodePointers(parentNode, null); for (let i = 0, l = childNodes.length; ...
if (arePointersEqual(childNode, node2)) { return 1; } } } /** * Find all ancestors of the given node * * @param domFacade The domFacade to consider relations in * @param node The node to find all ancestors of * @return All of the ancestors of the given node */ function findAllAncestorPointers(domF...
if (arePointersEqual(childNode, node1)) { return -1; }
random_line_split
publish_to_beta.py
"""Uploads apk to rollout track with user fraction.""" import sys import socket from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials import subprocess import xml.etree.ElementTree as ET import os from pathlib import Path TRACK = 'beta' USER_FRACTION = 1 APK_FILE = '...
print(releaseText) print() credentials = ServiceAccountCredentials.from_json_keyfile_name( CREDENTIALS_JSON, scopes=['https://www.googleapis.com/auth/androidpublisher'] ) print('Found credentials, trying to connect...') socket.setdefaulttimeout(900) service = build('androidpublish...
package_name = os.environ.get('PACKAGE_NAME') if package_name: print('using provided package name', package_name) else: # get package name from somewhere print('finding package name') package_name = ET.parse('../platforms/android/res/xml/config.xml').getroot().attrib['id'] ...
identifier_body
publish_to_beta.py
"""Uploads apk to rollout track with user fraction.""" import sys import socket from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials import subprocess import xml.etree.ElementTree as ET import os from pathlib import Path TRACK = 'beta' USER_FRACTION = 1 APK_FILE = '...
else: # get package name from somewhere print('finding package name') package_name = ET.parse('../platforms/android/res/xml/config.xml').getroot().attrib['id'] print('found package name', package_name) print() apk_file = os.environ.get('APK_FILE') if apk_file is None: ...
print('using provided package name', package_name)
conditional_block
publish_to_beta.py
"""Uploads apk to rollout track with user fraction.""" import sys import socket from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials import subprocess import xml.etree.ElementTree as ET import os from pathlib import Path TRACK = 'beta' USER_FRACTION = 1 APK_FILE = '...
print('Uploaded', path) commit_request = service.edits().commit(editId=edit_id, packageName=package_name).execute() print('Edit "%s" has been committed' % (commit_request['id'])) if __name__ == '__main__': main(sys.argv)
packageName=package_name, language=language, imageType=imageType, media_body=path, ).execute()
random_line_split
publish_to_beta.py
"""Uploads apk to rollout track with user fraction.""" import sys import socket from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredentials import subprocess import xml.etree.ElementTree as ET import os from pathlib import Path TRACK = 'beta' USER_FRACTION = 1 APK_FILE = '...
(argv): package_name = os.environ.get('PACKAGE_NAME') if package_name: print('using provided package name', package_name) else: # get package name from somewhere print('finding package name') package_name = ET.parse('../platforms/android/res/xml/config.xml').getroot().attrib[...
main
identifier_name
__init__.py
DEPS = [ 'depot_tools', 'gclient', 'gerrit', 'gitiles', 'recipe_engine/buildbucket', 'recipe_engine/context', 'recipe_engine/commit_position', 'recipe_engine/cq', 'recipe_engine/json', 'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties', 'recipe...
'$depot_tools/bot_update': Property( help='Properties specific to bot_update module.', param_name='properties', kind=ConfigGroup( # Whether we should do the patching in gclient instead of bot_update apply_patch_on_gclient=Single(bool), ), default={}, ), }
random_line_split
c2s-leave-one-out.py
#!/usr/bin/env python """ Measure the performance of STM based spike prediction by repeatedly using all but one cell for training and the remaining cell for testing. """ import os import sys from argparse import ArgumentParser from pickle import dump from scipy.io import savemat from numpy import mean, std, corrcoef...
(argv): parser = ArgumentParser(argv[0], description=__doc__) parser.add_argument('dataset', type=str, nargs='+') parser.add_argument('output', type=str) parser.add_argument('--num_components', '-c', type=int, default=3) parser.add_argument('--num_features', '-f', type=int, d...
main
identifier_name
c2s-leave-one-out.py
#!/usr/bin/env python """ Measure the performance of STM based spike prediction by repeatedly using all but one cell for training and the remaining cell for testing. """ import os import sys from argparse import ArgumentParser from pickle import dump from scipy.io import savemat from numpy import mean, std, corrcoef...
model_parameters={ 'num_components': args.num_components, 'num_features': args.num_features}, training_parameters={ 'verbosity': 0}, regularize=args.regularize, verbosity=1) if args.verbosity > 0: print 'Predicting...' # predict responses of cell i predictions = predict(data_test, r...
window_length=args.window_length, keep_all=args.keep_all, finetune=args.finetune,
random_line_split
c2s-leave-one-out.py
#!/usr/bin/env python """ Measure the performance of STM based spike prediction by repeatedly using all but one cell for training and the remaining cell for testing. """ import os import sys from argparse import ArgumentParser from pickle import dump from scipy.io import savemat from numpy import mean, std, corrcoef...
elif args.output.lower().endswith('.xpck'): experiment['args'] = args experiment['data'] = data experiment.save(args.output) else: with open(args.output, 'w') as handle: dump(data, handle, protocol=2) return 0 if __name__ == '__main__': sys.exit(main(sys.argv))
savemat(args.output, convert({'data': data}))
conditional_block
c2s-leave-one-out.py
#!/usr/bin/env python """ Measure the performance of STM based spike prediction by repeatedly using all but one cell for training and the remaining cell for testing. """ import os import sys from argparse import ArgumentParser from pickle import dump from scipy.io import savemat from numpy import mean, std, corrcoef...
data = [] for dataset in args.dataset: data = data + load_data(dataset) # preprocess data if args.preprocess: data = preprocess(data) # list of all cells if 'cell_num' in data[0]: # several trials/entries may belong to the same cell cells = unique([entry['cell_num'] for entry in data]) else: # one ce...
parser = ArgumentParser(argv[0], description=__doc__) parser.add_argument('dataset', type=str, nargs='+') parser.add_argument('output', type=str) parser.add_argument('--num_components', '-c', type=int, default=3) parser.add_argument('--num_features', '-f', type=int, default=2)...
identifier_body
mn.js
/* flatpickr v4.2.0, @license MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.mn = {}))); }(this, (function (exports) { 'use strict'; var fp = typeof wi...
"Нэгдүгээр сар", "Хоёрдугаар сар", "Гуравдугаар сар", "Дөрөвдүгээр сар", "Тавдугаар сар", "Зургаадугаар сар", "Долдугаар сар", "Наймдугаар сар", "Есдүгээр сар", "Аравдугаар сар", ...
"10-р сар", "11-р сар", "12-р сар", ], longhand: [
random_line_split
cloudstack.py
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI...
self, key=None): if self.ip_address: return self._get_by_key(key, self.ip_address) ip_address = self.module.params.get('ip_address') if not ip_address: self.module.fail_json(msg="IP address param 'ip_address' is required") args = {} args['ipaddress'] = i...
et_ip_address(
identifier_name
cloudstack.py
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI...
def get_tags(self, resource=None): existing_tags = self.cs.listTags(resourceid=resource['id']) if existing_tags: return existing_tags['tag'] return [] def _delete_tags(self, resource, resource_type, tags): existing_tags = resource['tags'] tags_to_delete = ...
f self.domain: return self._get_by_key(key, self.domain) domain = self.module.params.get('domain') if not domain: return None args = {} args['listall'] = True domains = self.cs.listDomains(**args) if domains: for d in domains['domain'...
identifier_body
cloudstack.py
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSI...
class AnsibleCloudStack: def __init__(self, module): if not has_lib_cs: module.fail_json(msg="python library cs required: pip install cs") self.result = { 'changed': False, } self.module = module self._connect() self.domain = None s...
random_line_split
cloudstack.py
import CloudStack, CloudStackException, read_config has_lib_cs = True except ImportError: has_lib_cs = False class AnsibleCloudStack: def __init__(self, module): if not has_lib_cs: module.fail_json(msg="python library cs required: pip install cs") self.result = { ...
elf.result['changed'] = True if not self.module.check_mode: args = {} args['resourceids'] = resource['id'] args['resourcetype'] = resource_type args['tags'] = tags_to_delete self.cs.deleteTags(**args)
conditional_block
generate_std_names.py
# (C) British Crown Copyright 2010 - 2014, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
sub_section[child_elem] = found_elem.text if found_elem is not None else None yield {elem.get("id") : sub_section} def to_dict(infile, outfile): values = {} aliases = {} tree = ET.parse(infile) for section in process_name_table(tree, 'entry', 'canonical_units'): values.u...
for child_elem in child_elements: found_elem = elem.find(child_elem)
random_line_split
generate_std_names.py
# (C) British Crown Copyright 2010 - 2014, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
(tree, element_name, *child_elements): """ Yields a series of dictionaries with the key being the id of the entry element and the value containing another dictionary mapping other attributes of the standard name to their values, e.g. units, description, grib value etc. """ for elem in tree.iterfind(...
process_name_table
identifier_name
generate_std_names.py
# (C) British Crown Copyright 2010 - 2014, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
parser = argparse.ArgumentParser( description='Create Python code from CF standard name XML.') parser.add_argument('input', type=argparse.FileType(), metavar='INPUT', help='Path to CF standard name XML') parser.add_argument('output', type=argparse.FileType...
conditional_block
generate_std_names.py
# (C) British Crown Copyright 2010 - 2014, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
def to_dict(infile, outfile): values = {} aliases = {} tree = ET.parse(infile) for section in process_name_table(tree, 'entry', 'canonical_units'): values.update(section) for section in process_name_table(tree, 'alias', 'entry_id'): aliases.update(section) for key, valued ...
""" Yields a series of dictionaries with the key being the id of the entry element and the value containing another dictionary mapping other attributes of the standard name to their values, e.g. units, description, grib value etc. """ for elem in tree.iterfind(element_name): sub_section = {} ...
identifier_body
dataHelper.ts
import schemas from '../schemas'; import * as _ from 'lodash'; export default class DataHelper { public static transformBundleToNewSchema(bundle, targetBundleSchemas){ let schemaKeys = Object.keys(targetBundleSchemas); schemaKeys.forEach(key => { if(targetBundleSchemas[key] == "dict") ...
(obj1, obj2): boolean { let keys1 = Object.keys(obj1); let keys2 = Object.keys(obj2); if(keys1.length !== keys2.length) return false; for(let i=0; i<keys1.length; i++) { let key1 = keys1[i]; let key2 = keys2[i]; if(key1 !== key2 || obj1[key1] !=...
equalsObject
identifier_name
dataHelper.ts
import schemas from '../schemas'; import * as _ from 'lodash'; export default class DataHelper { public static transformBundleToNewSchema(bundle, targetBundleSchemas)
bundle['data'][key] = []; } bundle['data'][key] = DataHelper.transformDataToNewSchema(fromColumns, toColumns, bundle['data'][key]); } if(bundle['diffs']){ if(!bundle['diffs'][key]){ bundle['diffs'][key] = []...
{ let schemaKeys = Object.keys(targetBundleSchemas); schemaKeys.forEach(key => { if(targetBundleSchemas[key] == "dict") return; let toColumns = targetBundleSchemas[key].map(e => e.field); if(!bundle['columns'][key]){ bundl...
identifier_body
dataHelper.ts
import schemas from '../schemas'; import * as _ from 'lodash'; export default class DataHelper { public static transformBundleToNewSchema(bundle, targetBundleSchemas){ let schemaKeys = Object.keys(targetBundleSchemas); schemaKeys.forEach(key => { if(targetBundleSchemas[key] == "dict") ...
if(bundle['diffs']){ if(!bundle['diffs'][key]){ bundle['diffs'][key] = []; } bundle['diffs'][key] = bundle['diffs'][key].map(oldDiff => { return { added: DataHelper.transformDataToNewSchema(fromColumns, toColumns, oldD...
{ if(!bundle['data'][key]){ bundle['data'][key] = []; } bundle['data'][key] = DataHelper.transformDataToNewSchema(fromColumns, toColumns, bundle['data'][key]); }
conditional_block
dataHelper.ts
import schemas from '../schemas'; import * as _ from 'lodash'; export default class DataHelper { public static transformBundleToNewSchema(bundle, targetBundleSchemas){ let schemaKeys = Object.keys(targetBundleSchemas); schemaKeys.forEach(key => { if(targetBundleSchemas[key] == "dict") ...
let keys2 = Object.keys(obj2); if(keys1.length !== keys2.length) return false; for(let i=0; i<keys1.length; i++) { let key1 = keys1[i]; let key2 = keys2[i]; if(key1 !== key2 || obj1[key1] !== obj2[key2]) return false; } re...
public static equalsObject(obj1, obj2): boolean { let keys1 = Object.keys(obj1);
random_line_split
compute_squared_distance.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs}; use derive_common::cg; use...
}), quote!(+)); sum }; return quote! { (&#this_pattern, &#other_pattern) => Ok(#sum), }; } #[derive(Default, FromField)] #[darling(attributes(distance), default)] struct DistanceFieldAttrs { field_bound: bool, }
{ quote! { crate::values::distance::ComputeSquaredDistance::compute_squared_distance(#this, #other)? } }
conditional_block
compute_squared_distance.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs}; use derive_common::cg; use...
input.generics.where_clause = where_clause; if needs_catchall_branch { // This ideally shouldn't be needed, but see: // https://github.com/rust-lang/rust/issues/68867 match_body.append_all(quote! { _ => unsafe { debug_unreachable!() } }); } let name = &input.ident; let (imp...
random_line_split
compute_squared_distance.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs}; use derive_common::cg; use...
( variant: &synstructure::VariantInfo, mut where_clause: &mut Option<WhereClause>, ) -> TokenStream { let variant_attrs = cg::parse_variant_attrs_from_ast::<AnimationVariantAttrs>(&variant.ast()); let (this_pattern, this_info) = cg::ref_pattern(&variant, "this"); let (other_pattern, other_info) = cg...
derive_variant_arm
identifier_name