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
lg.ts
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js function plural(n: number...
export default [ 'lg', [ ['AM', 'PM'], , ], , [ ['S', 'B', 'L', 'L', 'L', 'L', 'L'], ['Sab', 'Bal', 'Lw2', 'Lw3', 'Lw4', 'Lw5', 'Lw6'], ['Sabbiiti', 'Balaza', 'Lwakubiri', 'Lwakusatu', 'Lwakuna', 'Lwakutaano', 'Lwamukaaga'], ['Sab', 'Bal', 'Lw2', 'Lw3', 'Lw4', 'Lw5', 'Lw6'] ], , [ ...
{ if (n === 1) return 1; return 5; }
identifier_body
CargaFacturaOracle.py
# -*- coding: utf-8 -*- from BaseOracle import * from Factura import * from ConfigDB import * class CargaFacturaOracle(object): def __init__(self): pass def carga(self, factura): cfgOra = ConfigDB("oracle") cfgOra.getConfig() #cfgOra.imprimir() oracle = BaseOracle(cf...
oracle.desconectar()
oracle.ejecutar("INSERT INTO ELE_FACTURA_DETALLES" + "(CLAVE_ACCESO_ELE_DOCUMENTOS,NUMFILA,CODIGO_PRINCIPAL,DESCRIPCION,CANTIDAD," + "PRECIO_UNITARIO,DESCUENTO,PRECIO_TOTAL_SIN_IMPUESTO)" + "VALUES ('" + factura.claveAcceso + "'," + str(i) + ",'" + det.codigoPrincipal + "','" ...
conditional_block
CargaFacturaOracle.py
# -*- coding: utf-8 -*- from BaseOracle import * from Factura import * from ConfigDB import * class CargaFacturaOracle(object): def __init__(self): pass def carga(self, factura):
oracle.ejecutar("INSERT INTO ELE_FACTURA_DETALLES" + "(CLAVE_ACCESO_ELE_DOCUMENTOS,NUMFILA,CODIGO_PRINCIPAL,DESCRIPCION,CANTIDAD," + "PRECIO_UNITARIO,DESCUENTO,PRECIO_TOTAL_SIN_IMPUESTO)" + "VALUES ('" + factura.claveAcceso + "'," + str(i) + ",'" + det.codigoPrincipal + "...
cfgOra = ConfigDB("oracle") cfgOra.getConfig() #cfgOra.imprimir() oracle = BaseOracle(cfgOra.maquina, cfgOra.usuario, cfgOra.clave, cfgOra.servicio) oracle.conectar() oracle.ejecutar("delete ELE_DOCUMENTOS where CLAVE_ACCESO = '" + factura.claveAcceso + "'") oracle.ej...
identifier_body
CargaFacturaOracle.py
# -*- coding: utf-8 -*- from BaseOracle import * from Factura import * from ConfigDB import * class CargaFacturaOracle(object): def __init__(self): pass def carga(self, factura): cfgOra = ConfigDB("oracle") cfgOra.getConfig() #cfgOra.imprimir() oracle = BaseOracle(cf...
+ "BASE_IMPONIBLE,VALOR) VALUES ('" + factura.claveAcceso + "'," + str(i) + "," + str(j) + ",'" + imp.codigo + "','" + imp.codigoPorcentaje + "'," + imp.tarifa + "," + imp.baseImponible + "," + imp.valor + ")") j = j + 1 i = i + 1 orac...
oracle.ejecutar("INSERT INTO ELE_FACTURA_IMPUESTOS(CLAVE_ACCESO_ELE_DOCUMENTOS," + "NUM_FILA_ELE_FACTURA_DETALLES,NUM_FILA,CODIGO,CODIGO_PORCENTAJE,TARIFA,"
random_line_split
CargaFacturaOracle.py
# -*- coding: utf-8 -*- from BaseOracle import * from Factura import * from ConfigDB import * class CargaFacturaOracle(object): def __init__(self): pass def
(self, factura): cfgOra = ConfigDB("oracle") cfgOra.getConfig() #cfgOra.imprimir() oracle = BaseOracle(cfgOra.maquina, cfgOra.usuario, cfgOra.clave, cfgOra.servicio) oracle.conectar() oracle.ejecutar("delete ELE_DOCUMENTOS where CLAVE_ACCESO = '" + factura.claveAcceso ...
carga
identifier_name
CartItem.tsx
/** * Copyright 2020 Google LLC * * 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...
} function handleRemoveClick() { const index = cart.findIndex( cartItem => cartItem.size === props.cartItem.size && cartItem.item.name === props.cartItem.item.name, ); if (index !== -1) { const newCart = [...cart]; newCart.splice(index, 1); setCart(newCart); } } retur...
{ const newCart = [...cart]; newCart.splice(index, 1, { ...cart[index], quantity, }); setCart(newCart); }
conditional_block
CartItem.tsx
/** * Copyright 2020 Google LLC * * 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...
import React, { useContext } from 'react'; import { CartContext } from './CartContext'; import { CartItemDetails } from '../data/store-data'; import { Close } from '@material-ui/icons'; import { Link } from 'react-router-dom'; interface Props { cartItem: CartItemDetails; } const CartItem: React.FC<Props> = props =>...
random_line_split
CartItem.tsx
/** * Copyright 2020 Google LLC * * 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...
(quantity: number) { const index = cart.findIndex( cartItem => cartItem.size === props.cartItem.size && cartItem.item.name === props.cartItem.item.name, ); if (index !== -1) { const newCart = [...cart]; newCart.splice(index, 1, { ...cart[index], quantity, }); s...
handleQuantityChange
identifier_name
CartItem.tsx
/** * Copyright 2020 Google LLC * * 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...
function handleRemoveClick() { const index = cart.findIndex( cartItem => cartItem.size === props.cartItem.size && cartItem.item.name === props.cartItem.item.name, ); if (index !== -1) { const newCart = [...cart]; newCart.splice(index, 1); setCart(newCart); } } return ( ...
{ const index = cart.findIndex( cartItem => cartItem.size === props.cartItem.size && cartItem.item.name === props.cartItem.item.name, ); if (index !== -1) { const newCart = [...cart]; newCart.splice(index, 1, { ...cart[index], quantity, }); setCart(newCart); ...
identifier_body
__init__.py
#------------------------------------------------------------------------- # Copyright (c) Microsoft. 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.apa...
Exception.__init__(self, message) class HTTPResponse(object): ''' Represents a response from an HTTP request. :ivar int status: the status code of the response :ivar str message: the message :ivar dict headers: the returned headers :ivar bytes body: ...
def __init__(self, status, message, respheader, respbody): self.status = status self.respheader = respheader self.respbody = respbody
random_line_split
__init__.py
#------------------------------------------------------------------------- # Copyright (c) Microsoft. 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.apa...
lf.host = '' self.method = '' self.path = '' self.query = {} # list of (name, value) self.headers = {} # list of (header name, header value) self.body = ''
identifier_body
__init__.py
#------------------------------------------------------------------------- # Copyright (c) Microsoft. 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.apa...
bject): ''' Represents an HTTP Request. :ivar str host: the host name to connect to :ivar str method: the method to use to connect (string such as GET, POST, PUT, etc.) :ivar str path: the uri fragment :ivar dict query: query parameters :ivar dict headers: ...
TPRequest(o
identifier_name
social-likes.js
} var servicePromises = counters.promises[service]; if (!extraOptions.forceUpdate && servicePromises[url]) { return servicePromises[url]; } var options = $.extend({}, services[service], extraOptions); var deferred = $.Deferred(); var jsonUrl = options.counterUrl && makeUrl(options.counterUrl, { ...
zeroes: false, wait: 500, // Show buttons only after counters are ready or after this amount of time timeout: 10000, // Show counters after this amount of time even if they aren’t ready popupCheckInterval: 500, singleTitle: 'Share', }; function SocialLikes(container, options) { this.container = contain...
$.fn.socialLikes.defaults = { url: window.location.href.replace(window.location.hash, ''), title: document.title, counters: true,
random_line_split
social-likes.js
{ buttonCls: getElementClassNames('button', 'single'), iconCls: getElementClassNames('icon', 'single'), title: this.options.singleTitle, } )); widget.append(button); wrapper.append(widget); widget.on('click', function() { var activeClass = prefix + '__widget_active'; widget.toggl...
eturn l.toUpper(); } var
identifier_body
social-likes.js
} var servicePromises = counters.promises[service]; if (!extraOptions.forceUpdate && servicePromises[url]) { return servicePromises[url]; } var options = $.extend({}, services[service], extraOptions); var deferred = $.Deferred(); var jsonUrl = options.counterUrl && makeUrl(options.counterUrl, { ...
servicePromises[url] = deferred.promise(); return servicePromises[url]; }, }; // jQuery plugin $.fn.socialLikes = function(options) { return this.each(function() { var elem = $(this); var instance = elem.data(prefix); if (instance) { if ($.isPlainObject(options)) { instance.update(options...
deferred.reject(); }
conditional_block
social-likes.js
.zeroes) { this.number += number; if (this.single) { this.getCounterElem().text(this.number); } } this.countersLeft--; if (this.countersLeft === 0) { this.appear(); this.ready(); } }, appear: function() { this.container.addClass(prefix + '_visible'); }, ready: function(...
Viewport(elem)
identifier_name
comex_page_profile_controllers.js
/**we have all * @fileoverview * Profile 1/overview and 2/completing * @todo * - package.json * * @version 1 * @copyright ISCPIF-CNRS 2016 * @author romain.loth@iscpif.fr * * @requires comex_user_shared, comex_lib_elts * * NB The uinfo variable should be set to template's user.json_info value. */ // 3...
(uinfo) { // (date and menu values are set up here // but normal text vals are set up via html template, // pic and middle_name are set below from a separate function, // and multi text inputs are set up via form init... fixable to harmonize) for (var i in cmxClt.COLS) { var colType =...
setupSavedItems
identifier_name
comex_page_profile_controllers.js
/**we have all * @fileoverview * Profile 1/overview and 2/completing * @todo * - package.json * * @version 1 * @copyright ISCPIF-CNRS 2016 * @author romain.loth@iscpif.fr * * @requires comex_user_shared, comex_lib_elts * * NB The uinfo variable should be set to template's user.json_info value. */ // 3...
tgtElt.dispatchEvent(new CustomEvent('change')) } // m <=> select saved menus if (colType == 'm') { // console.log('setting menu', colName, 'with', chosenV) var myOption = tgtElt.querySele...
{ var colName = cmxClt.COLS[i][0] var chosenV = uinfo[colName] // special case if (colName == 'inst_type' && uinfo.insts && uinfo.insts.length) { chosenV = uinfo.insts[0].inst_type } // console.log('setupSavedItems', colName, '('...
conditional_block
comex_page_profile_controllers.js
/**we have all * @fileoverview * Profile 1/overview and 2/completing * @todo * - package.json * * @version 1 * @copyright ISCPIF-CNRS 2016 * @author romain.loth@iscpif.fr * * @requires comex_user_shared, comex_lib_elts * * NB The uinfo variable should be set to template's user.json_info value. */ // 3...
} } } else { console.warn("setupSavedItems: couldn't find element: "+colName) } } } } } // also pre-setup for images var picShow = document.getElementById('show_pic') if (uinfo.pic_sr...
var optionOthers = console.warn(`setupSavedItems: couldn't find option: ${chosenV} for select element: ${colName}`)
random_line_split
comex_page_profile_controllers.js
/**we have all * @fileoverview * Profile 1/overview and 2/completing * @todo * - package.json * * @version 1 * @copyright ISCPIF-CNRS 2016 * @author romain.loth@iscpif.fr * * @requires comex_user_shared, comex_lib_elts * * NB The uinfo variable should be set to template's user.json_info value. */ // 3...
// run first check on existing profile data pre-filled by the template completionAsYouGo() // set up a "Your data was saved" modal box (tied to the SUBMIT button) function addAndShowModal(someHtmlContent) { // create and add modal cmxClt.elts.box.addGenericBox( 'save_info', 'Profile updat...
{ theUForm.elMainMessage.style.display = 'block' theUForm.elMainMessage.innerHTML = "Checking the answers..." var diagnosticParams = {'fixResidue': true, 'ignore': ['email']} cmxClt.uform.simpleValidateAndMessage(theUForm, diagnosticParams) // timestamp is done server-...
identifier_body
display-server-url.util.spec.ts
// std import { strictEqual } from 'assert'; // FoalTS import { displayServerURL } from './display-server-url.util'; describe('displayServerURL', () => { it('should display the proper output.', () => { let expectedOutput = ` \x1b[32m -------------------------------------- \x1b[0m \x1b[32m| ...
expectedOutput += '\n'; displayServerURL(8080, log); strictEqual(actualOutput, expectedOutput); }); });
{ actualOutput += str + `\n`; }
identifier_body
display-server-url.util.spec.ts
// std import { strictEqual } from 'assert'; // FoalTS import { displayServerURL } from './display-server-url.util'; describe('displayServerURL', () => { it('should display the proper output.', () => { let expectedOutput = ` \x1b[32m -------------------------------------- \x1b[0m \x1b[32m| ...
(str: string = '') { actualOutput += str + `\n`; } expectedOutput += '\n'; displayServerURL(8080, log); strictEqual(actualOutput, expectedOutput); }); });
log
identifier_name
display-server-url.util.spec.ts
// std
// FoalTS import { displayServerURL } from './display-server-url.util'; describe('displayServerURL', () => { it('should display the proper output.', () => { let expectedOutput = ` \x1b[32m -------------------------------------- \x1b[0m \x1b[32m| |\x1b[0m \x1b[32m| ...
import { strictEqual } from 'assert';
random_line_split
dup_helpers.py
target.case_name = new.case_name # Add the docket number if the old doesn't exist, but keep the old if one # does. if not target.docket.docket_number: target.docket.docket_number = new.docket.docket_number # Get the citations from the new item (ditch the old). target.federal_cite_one = ne...
(case, target_ids): """Merge data from PRO with multiple cases that seem to be a match. The process here is a conservative one. We take *only* the information from PRO that is not already in CL in any form, and add only that. """ # THIS CODE ONLY UPDATED IN THE MOST CURSORY FASHION. DO NOT TRUST IT...
merge_cases_complex
identifier_name
dup_helpers.py
target.case_name = new.case_name # Add the docket number if the old doesn't exist, but keep the old if one # does. if not target.docket.docket_number: target.docket.docket_number = new.docket.docket_number # Get the citations from the new item (ditch the old). target.federal_cite_one =...
def case_name_in_candidate(case_name_new, case_name_candidate): """When there is one candidate match, this compares their case names to see if one is contained in the other, in the right order. Returns True if so, else False. """ regex = re.compile('[%s]' % re.escape(string.punctuation)) cas...
"""Identify the candidates that have the same docket numbers as doc after each has been cleaned. """ new_docket_number = re.sub('(\D|0)', '', doc.docket.docket_number) same_docket_numbers = [] for candidate in candidates: old_docket_number = re.sub('(\D|0)', '', candidate.get('docketNumber'...
identifier_body
dup_helpers.py
_one target.state_cite_two = new.state_cite_two target.state_cite_three = new.state_cite_three target.state_cite_regional = new.state_cite_regional target.specialty_cite_one = new.specialty_cite_one target.scotus_early_cite = new.scotus_early_cite target.lexis_cite = new.lexis_cite target.we...
ca10regex = re.compile('(unpublished disposition )?notice: tenth circuit rule 36.3 states that unpublished opinions and orders and judgments have no precedential value and shall not be cited except for purposes of establishing the doctrines of the law of the case, res judicata, or collateral estoppel.?') ...
random_line_split
dup_helpers.py
target.lexis_cite = new.lexis_cite target.westlaw_cite = new.westlaw_cite target.neutral_cite = new.neutral_cite # Add judge information if lacking. New is dirty, but better than none. if not target.judges: target.judges = new.judges # Add the text. target.html_lawbox, blocked = anony...
case_name = re.sub(ca2regex, '', case_name) case_name = re.sub(ca2regex2, '', case_name) status = 'Unpublished'
conditional_block
basics.py
# Copywrite © 2017 Joe Rogge, Jacob Gasyna and Adele Rehkemper #This file is part of Rhythm Trainer Pro. Rhythm Trainer Pro 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...
oot.mainloop()
conditional_block
basics.py
# Copywrite © 2017 Joe Rogge, Jacob Gasyna and Adele Rehkemper #This file is part of Rhythm Trainer Pro. Rhythm Trainer Pro 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...
#def makeButtons(sidebar): #""" place all the buttons in the sidebar""" #TODO add commands for each button root = Tk() screenWidth = root.winfo_screenwidth() screenHeight = root.winfo_screenheight() root.geometry('%dx%d+%d+%d' % (screenWidth, screenHeight, 0, 0)) # main area mainarea = Canvas(root, bg='#FFA'...
rint "test"
identifier_body
basics.py
# Copywrite © 2017 Joe Rogge, Jacob Gasyna and Adele Rehkemper #This file is part of Rhythm Trainer Pro. Rhythm Trainer Pro 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...
): print "test" #def makeButtons(sidebar): #""" place all the buttons in the sidebar""" #TODO add commands for each button root = Tk() screenWidth = root.winfo_screenwidth() screenHeight = root.winfo_screenheight() root.geometry('%dx%d+%d+%d' % (screenWidth, screenHeight, 0, 0)) # main area mainarea = Ca...
ommandTest(
identifier_name
basics.py
# Copywrite © 2017 Joe Rogge, Jacob Gasyna and Adele Rehkemper #This file is part of Rhythm Trainer Pro. Rhythm Trainer Pro 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...
snImage = Image.open(snPath) sn = ImageTk.PhotoImage(snImage) snButton = Button(sidebar, image=sn, border=0) snButton.place(x=25, y=225) snRestPath = 'SixteenthResticon.png' snRestImage = Image.open(snRestPath) snRest = ImageTk.PhotoImage(snRestImage) snRestButton = Button(sidebar, image=snRest, border=0) snRestBut...
#enRestButton.place(x=100, y=150) snPath = 'SixteenthNoteicon.png'
random_line_split
plot_cluster_comparison.py
""" ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example aims at showing characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. The last ...
clustering_names = [ 'MiniBatchKMeans', 'AffinityPropagation', 'MeanShift', 'SpectralClustering', 'Ward', 'AgglomerativeClustering', 'DBSCAN', 'Birch'] plt.figure(figsize=(len(clustering_names) * 2 + 3, 9.5)) plt.subplots_adjust(left=.02, right=.98, bottom=.001, top=.96, wspace=.05, hs...
colors = np.array([x for x in 'bgrcmykbgrcmykbgrcmykbgrcmyk']) colors = np.hstack([colors] * 20)
random_line_split
plot_cluster_comparison.py
""" ========================================================= Comparing different clustering algorithms on toy datasets ========================================================= This example aims at showing characteristics of different clustering algorithms on datasets that are "interesting" but still in 2D. The last ...
plt.xticks(()) plt.yticks(()) plt.text(.99, .01, ('%.2fs' % (t1 - t0)).lstrip('0'), transform=plt.gca().transAxes, size=15, horizontalalignment='right') plot_num += 1 plt.show()
t0 = time.time() algorithm.fit(X) t1 = time.time() if hasattr(algorithm, 'labels_'): y_pred = algorithm.labels_.astype(np.int) else: y_pred = algorithm.predict(X) # plot plt.subplot(4, len(clustering_algorithms), plot_num) if i_dataset == ...
conditional_block
TaskE.py
from math import * def f(e, x): return abs(eval(e.replace('^', '**').replace('x', '('+str(x)+')'))) def solve(e, a, b): N = 1999 t = f(e, a) + f(e, b) for i in range(1, 2*N): if i % 2 == 0: t += 2*f(e, a + (b-a)*i/2/N) else: t += 4*f(e, a + (b-a)*i/2/N) return (b-a)*t/6/N def main(): ## with op...
# print(ans) ## ans = str(ans) with open('output.txt', 'w') as f: f.write(ans) print('Done:') if len(ans) > 500: print(ans[:200] + '...') else: print(ans) ## main()
ans = solve(e, a, b)
random_line_split
TaskE.py
from math import * def f(e, x): return abs(eval(e.replace('^', '**').replace('x', '('+str(x)+')'))) def
(e, a, b): N = 1999 t = f(e, a) + f(e, b) for i in range(1, 2*N): if i % 2 == 0: t += 2*f(e, a + (b-a)*i/2/N) else: t += 4*f(e, a + (b-a)*i/2/N) return (b-a)*t/6/N def main(): ## with open('input.txt', 'r') as f: data = f.read().splitlines() a, b = map(int, data[0].split()) e = data[1] ## # ...
solve
identifier_name
TaskE.py
from math import * def f(e, x):
def solve(e, a, b): N = 1999 t = f(e, a) + f(e, b) for i in range(1, 2*N): if i % 2 == 0: t += 2*f(e, a + (b-a)*i/2/N) else: t += 4*f(e, a + (b-a)*i/2/N) return (b-a)*t/6/N def main(): ## with open('input.txt', 'r') as f: data = f.read().splitlines() a, b = map(int, data[0].split()) e = data...
return abs(eval(e.replace('^', '**').replace('x', '('+str(x)+')')))
identifier_body
TaskE.py
from math import * def f(e, x): return abs(eval(e.replace('^', '**').replace('x', '('+str(x)+')'))) def solve(e, a, b): N = 1999 t = f(e, a) + f(e, b) for i in range(1, 2*N): if i % 2 == 0: t += 2*f(e, a + (b-a)*i/2/N) else:
return (b-a)*t/6/N def main(): ## with open('input.txt', 'r') as f: data = f.read().splitlines() a, b = map(int, data[0].split()) e = data[1] ## # a, b = map(int, input().split()) # e = input() ans = solve(e, a, b) # print(ans) ## ans = str(ans) with open('output.txt', 'w') as f: f.write(ans) ...
t += 4*f(e, a + (b-a)*i/2/N)
conditional_block
pytest.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Datetools provide a method of manipulating and working dates and times. # Copyright (C) 2013-2018 Chris Caron <lead2gold@gmail.com> # # This file is part of Datetools. Datetools is free software; you can # redistribute it and/or modify it under the terms of the GNU Gener...
print dateblock("*/10 +7", ref=999434323, block=True) # Drifting inline print dateblock("*/10 +5", ref=date(2000, 1, 1), block=False) # Drifting inline (with option specified, inline should over-ride) # Drifting without use of + print dateblock("*/10 * * * * * 5", ref=date(2000, 2, 1), block=False) # Drifting with mult...
print dateblock("*/1", ref=7999434323, block=False) # Drift Time print dateblock("*/10 +5", ref=7999434323, block=False) # Blocking should never be possible if the time is in the past
random_line_split
nox.py
from glob import glob import shutil import nox REPO_TOOLS_REQ = \ 'git+https://github.com/GoogleCloudPlatform/python-repo-tools.git' DIRS = [ # Hello world doesn't have system tests, just a lint test which will be # covered by the global lint here. # '1-hello-world', '2-structured-data', '3-b...
def run_test(session, dir, toxargs): shutil.copy('config.py', dir) session.chdir(dir) session.run('tox', *(toxargs or [])) @nox.parametrize('dir', DIRS) def session_run_tests(session, dir=None, toxargs=None): """Run all tests for all directories (slow!)""" run_test(session, dir, toxargs) def ...
session.install('flake8', 'flake8-import-order') session.run( 'flake8', '--exclude=env,.nox,._config.py,.tox', '--import-order-style=google', '.')
identifier_body
nox.py
from glob import glob import shutil import nox REPO_TOOLS_REQ = \ 'git+https://github.com/GoogleCloudPlatform/python-repo-tools.git' DIRS = [ # Hello world doesn't have system tests, just a lint test which will be # covered by the global lint here. # '1-hello-world', '2-structured-data', '3-b...
@nox.parametrize('dir', DIRS) def session_travis(session, dir=None): """On travis, only run the py3.4 and cloudsql tests.""" shutil.copy('config.py', dir) session_run_tests( session, dir=dir, toxargs=['-e', 'py34', '--', '-k', 'cloudsql'])
random_line_split
nox.py
from glob import glob import shutil import nox REPO_TOOLS_REQ = \ 'git+https://github.com/GoogleCloudPlatform/python-repo-tools.git' DIRS = [ # Hello world doesn't have system tests, just a lint test which will be # covered by the global lint here. # '1-hello-world', '2-structured-data', '3-b...
for reqfile in glob('**/requirements*.txt'): session.run('gcprepotools', command, reqfile) def session_lint(session): session.install('flake8', 'flake8-import-order') session.run( 'flake8', '--exclude=env,.nox,._config.py,.tox', '--import-order-style=google', '.') def run_test(...
command = 'check-requirements'
conditional_block
nox.py
from glob import glob import shutil import nox REPO_TOOLS_REQ = \ 'git+https://github.com/GoogleCloudPlatform/python-repo-tools.git' DIRS = [ # Hello world doesn't have system tests, just a lint test which will be # covered by the global lint here. # '1-hello-world', '2-structured-data', '3-b...
(session, dir=None, toxargs=None): """Run all tests for all directories (slow!)""" run_test(session, dir, toxargs) def session_run_one_test(session): dir = session.posargs[0] toxargs = session.posargs[1:] run_test(session, dir, toxargs) @nox.parametrize('dir', DIRS) def session_travis(session, d...
session_run_tests
identifier_name
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup readme = open('README.rst').read() history = open('HISTORY.rst').read().replace('.. :changelog:', '') requirements = [ # TODO: put package requirements here ] test_requi...
author_email='bussonniermatthias@gmail.com', url='https://github.com/Carreau/sphinx_numfig', packages=[ 'sphinx_numfig', ], package_dir={'sphinx_numfig': 'sphinx_numfig'}, include_package_data=True, install_requires=requirements, license="BSD", zip_safe=False...
version='0.1.0', description='Python Boilerplate contains all the boilerplate you need to create a Python package.', long_description=readme + '\n\n' + history, author='Matthias Bussonnier',
random_line_split
__init__.py
# -*- coding: utf-8 -*- """The application's model objects""" from zope.sqlalchemy import ZopeTransactionExtension from sqlalchemy.orm import scoped_session, sessionmaker # from sqlalchemy import MetaData from sqlalchemy.ext.declarative import declarative_base # Global session manager: DBSession() returns the Thread-...
from fileutil import *
random_line_split
__init__.py
# -*- coding: utf-8 -*- """The application's model objects""" from zope.sqlalchemy import ZopeTransactionExtension from sqlalchemy.orm import scoped_session, sessionmaker # from sqlalchemy import MetaData from sqlalchemy.ext.declarative import declarative_base # Global session manager: DBSession() returns the Thread-...
# Import your model modules here. from auth import User, Group, Permission from logic import * from sysutil import * from fileutil import *
"""Call me before using any of the tables or classes in the model.""" DBSession.configure( bind = engine ) # If you are using reflection to introspect your database and create # table objects for you, your tables must be defined and mapped inside # the init_model function, so that the engine is availab...
identifier_body
__init__.py
# -*- coding: utf-8 -*- """The application's model objects""" from zope.sqlalchemy import ZopeTransactionExtension from sqlalchemy.orm import scoped_session, sessionmaker # from sqlalchemy import MetaData from sqlalchemy.ext.declarative import declarative_base # Global session manager: DBSession() returns the Thread-...
( engine ): """Call me before using any of the tables or classes in the model.""" DBSession.configure( bind = engine ) # If you are using reflection to introspect your database and create # table objects for you, your tables must be defined and mapped inside # the init_model function, so that the e...
init_model
identifier_name
hooks.ts
import { useState, useEffect, useCallback, useMemo } from 'react'; import { debounce } from 'lodash'; import { searchAssets } from '../../../../utils/assets'; import { MAX_TOKENS, ScrollPositionEnum, FilterSelectOptionsEnum, ToggleModeEnum, } from './const'; import { getEnabledAssetIds, getCheckedIds, fil...
}; export const useFilters = ({ assets, tokenFavorites }: UseFilters) => { const [searchValue, setSearchValue] = useState<string>(''); const [currentAssets, setCurrentAssets] = useState<Assets>(assets); const [filterOption, setFilterOption] = useState<FilterSelectOptions>( FilterSelectOptionsEnum.ALL ); u...
random_line_split
hooks.ts
import { useState, useEffect, useCallback, useMemo } from 'react'; import { debounce } from 'lodash'; import { searchAssets } from '../../../../utils/assets'; import { MAX_TOKENS, ScrollPositionEnum, FilterSelectOptionsEnum, ToggleModeEnum, } from './const'; import { getEnabledAssetIds, getCheckedIds, fil...
}, [checkboxes] ); return { checkboxes, totalCheckedCount, checkedIds, isMaxTotalCount, isToggleAllDisabled, previouslyCheckedIdsSet, toggleAllFn, toggleCheckbox, isClearAllMode, }; }; export const useFilters = ({ assets, tokenFavorites }: UseFilters) => { const [sea...
{ setCheckboxes({ ...checkboxes, [assetId]: newValue }); }
conditional_block
client.rs
// A client to the server. // Contains its own map and response variables use super::super::ui::*; use super::*; use context::*; pub struct Client { connection: ClientConn, pub map: Map, pub side: Side, response_queue: Vec<Response>, } impl Client { pub fn new(mut connection: ClientConn) -> Resul...
pub fn recv(&mut self) -> bool { let mut recieved_message = false; while let Ok(message) = self.connection.recv() { match message { ServerMessage::Responses(mut responses) => { self.response_queue.append(&mut responses) } ...
{ let client_stream = TcpStream::connect(addr) .chain_err(|| format!("Failed to connect to server at '{}'", addr))?; let connection = Connection::new_tcp(client_stream)?; Client::new(connection) }
identifier_body
client.rs
// A client to the server. // Contains its own map and response variables use super::super::ui::*; use super::*; use context::*; pub struct Client { connection: ClientConn, pub map: Map, pub side: Side, response_queue: Vec<Response>, } impl Client { pub fn new(mut connection: ClientConn) -> Resul...
(&self, unit: u8, path: &[PathPoint]) { self.send_command(unit, Command::walk(path)); } pub fn turn(&self, unit: u8, facing: UnitFacing) { self.send_command(unit, Command::Turn(facing)); } pub fn fire(&self, unit: u8, x: usize, y: usize) { self.send_command(unit, Command::Fire ...
walk
identifier_name
client.rs
// A client to the server. // Contains its own map and response variables use super::super::ui::*; use super::*; use context::*; pub struct Client { connection: ClientConn, pub map: Map, pub side: Side, response_queue: Vec<Response>, } impl Client { pub fn new(mut connection: ClientConn) -> Resul...
i += 1; } if status.blocking { break; } } } pub fn process_state_updates(&mut self) -> (bool, bool) { let mut invalid_command = false; for response in self.response_queue.drain(..) { match response { ...
if status.finished { self.response_queue.remove(0); } else {
random_line_split
noParameterPropertiesRule.d.ts
/** * @license * Copyright 2013 Palantir Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by...
export declare class Rule extends Lint.Rules.AbstractRule { static metadata: Lint.IRuleMetadata; static FAILURE_STRING_FACTORY: (ident: string) => string; apply(sourceFile: ts.SourceFile): Lint.RuleFailure[]; } export declare class NoParameterPropertiesWalker extends Lint.RuleWalker { visitConstructorDe...
*/ import * as ts from "typescript"; import * as Lint from "../index";
random_line_split
noParameterPropertiesRule.d.ts
/** * @license * Copyright 2013 Palantir Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by...
extends Lint.Rules.AbstractRule { static metadata: Lint.IRuleMetadata; static FAILURE_STRING_FACTORY: (ident: string) => string; apply(sourceFile: ts.SourceFile): Lint.RuleFailure[]; } export declare class NoParameterPropertiesWalker extends Lint.RuleWalker { visitConstructorDeclaration(node: ts.Constr...
Rule
identifier_name
lang_items.rs
/// Default panic handler #[linkage = "weak"] #[lang = "panic_fmt"] unsafe extern "C" fn panic_fmt( _args: ::core::fmt::Arguments, _file: &'static str, _line: u32, ) -> ! { hprint!("panicked at '"); match () { #[cfg(feature = "semihosting")] () => { ::cortex_m_semihosting...
{ main(); 0 }
identifier_body
lang_items.rs
/// Default panic handler #[linkage = "weak"] #[lang = "panic_fmt"] unsafe extern "C" fn panic_fmt( _args: ::core::fmt::Arguments, _file: &'static str, _line: u32, ) -> ! { hprint!("panicked at '"); match () { #[cfg(feature = "semihosting")] () => { ::cortex_m_semihosting...
} hprintln!("', {}:{}", _file, _line); bkpt!(); loop {} } /// Lang item required to make the normal `main` work in applications // This is how the `start` lang item works: // When `rustc` compiles a binary crate, it creates a `main` function that looks // like this: // // ``` // #[export_name = "mai...
{}
conditional_block
lang_items.rs
/// Default panic handler #[linkage = "weak"] #[lang = "panic_fmt"] unsafe extern "C" fn panic_fmt( _args: ::core::fmt::Arguments, _file: &'static str, _line: u32, ) -> ! { hprint!("panicked at '"); match () { #[cfg(feature = "semihosting")] () => { ::cortex_m_semihosting...
(main: fn(), _argc: isize, _argv: *const *const u8) -> isize { main(); 0 }
start
identifier_name
lang_items.rs
/// Default panic handler #[linkage = "weak"] #[lang = "panic_fmt"] unsafe extern "C" fn panic_fmt( _args: ::core::fmt::Arguments, _file: &'static str, _line: u32, ) -> ! { hprint!("panicked at '"); match () { #[cfg(feature = "semihosting")] () => { ::cortex_m_semihosting...
// // The final piece is that the entry point of our program, the reset handler, // has to call `rustc_main`. That's covered by the `reset_handler` function in // `src/exceptions.rs` #[lang = "start"] extern "C" fn start(main: fn(), _argc: isize, _argv: *const *const u8) -> isize { main(); 0 }
random_line_split
block-iter-2.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
pub fn main() { let v = ~[1, 2, 3, 4, 5]; let mut sum = 0; iter_vec(v.clone(), |i| { iter_vec(v.clone(), |j| { sum += *i * *j; }); }); error!("{:?}", sum); assert_eq!(sum, 225); }
{ for x in v.iter() { f(x); } }
identifier_body
block-iter-2.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
<T>(v: ~[T], f: |&T|) { for x in v.iter() { f(x); } } pub fn main() { let v = ~[1, 2, 3, 4, 5]; let mut sum = 0; iter_vec(v.clone(), |i| { iter_vec(v.clone(), |j| { sum += *i * *j; }); }); error!("{:?}", sum); assert_eq!(sum, 225); }
iter_vec
identifier_name
block-iter-2.rs
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
fn iter_vec<T>(v: ~[T], f: |&T|) { for x in v.iter() { f(x); } } pub fn main() { let v = ~[1, 2, 3, 4, 5]; let mut sum = 0; iter_vec(v.clone(), |i| { iter_vec(v.clone(), |j| { sum += *i * *j; }); }); error!("{:?}", sum); assert_eq!(sum, 225); }
// option. This file may not be copied, modified, or distributed // except according to those terms. // xfail-fast
random_line_split
test_yaml.py
#!/bin/env python #-*- coding=utf-8 -*- import yaml data = """ f5: # 蓝汛f5信息 - ip: 192.168.0.1 dc: lx credentials: username: huzichun password: huzichun!@# role: master # 世纪互联f5信息 - ip: 192.168.0.2 dc: sjhl credentials: username: huzichun password: huzichun!@# role: slave # 移动f5信息 - ip: 1...
sername"], info["credentials"]["password"] f.close()
conditional_block
test_yaml.py
#!/bin/env python #-*- coding=utf-8 -*- import yaml data = """ f5:
dc: lx credentials: username: huzichun password: huzichun!@# role: master # 世纪互联f5信息 - ip: 192.168.0.2 dc: sjhl credentials: username: huzichun password: huzichun!@# role: slave # 移动f5信息 - ip: 192.168.0.3 dc: yd credentials: username: huzichun password: huzichun!@# role: mast...
# 蓝汛f5信息 - ip: 192.168.0.1
random_line_split
page.component.ts
/** * This file is part of the TEKKL core package * * (c) Alexander Bachmann <email.bachmann@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. **/ import { ViewChild, ViewChildren, QueryList, OnInit } from '@angular/core'; im...
( protected title: Title, protected notificationService: NotificationService ){} ngOnInit() { this.setPageTitle(); } protected setPageTitle(){ if(this.pageTitle){ this.title.setTitle(this.pageTitle.getTitle()); } } protected showNotification(id){ var notification = this.notifications.filter((notif...
constructor
identifier_name
page.component.ts
/** * This file is part of the TEKKL core package * * (c) Alexander Bachmann <email.bachmann@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. **/ import { ViewChild, ViewChildren, QueryList, OnInit } from '@angular/core'; im...
} }
{ throw new Error('There is no Notification defined with the id ' + id ); }
conditional_block
page.component.ts
/** * This file is part of the TEKKL core package * * (c) Alexander Bachmann <email.bachmann@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. **/ import { ViewChild, ViewChildren, QueryList, OnInit } from '@angular/core'; im...
protected showNotification(id){ var notification = this.notifications.filter((notification: NotificationComponent) => notification.id == id)[0]; if(notification){ return this.notificationService.show(notification); }else{ throw new Error('There is no Notification defined with the id ' + id ); } } }
{ if(this.pageTitle){ this.title.setTitle(this.pageTitle.getTitle()); } }
identifier_body
page.component.ts
/** * This file is part of the TEKKL core package * * (c) Alexander Bachmann <email.bachmann@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. **/ import { ViewChild, ViewChildren, QueryList, OnInit } from '@angular/core'; im...
this.title.setTitle(this.pageTitle.getTitle()); } } protected showNotification(id){ var notification = this.notifications.filter((notification: NotificationComponent) => notification.id == id)[0]; if(notification){ return this.notificationService.show(notification); }else{ throw new Error('There is n...
ngOnInit() { this.setPageTitle(); } protected setPageTitle(){ if(this.pageTitle){
random_line_split
windows.py
_ptr -= cmdline.length / 8 state.memory.store(stack_ptr, cmdline) state.mem[self.acmdln_ptr].long = stack_ptr stack_ptr -= wcmdline.length / 8 state.memory.store(stack_ptr, wcmdline) state.mem[self.wcmdln_ptr].long = stack_ptr argv = table.dump(state, stack_ptr) ...
(self, input_content=None, magic_content=None, preconstrain_input=True, preconstrain_flag=True, constrained_addrs=None, **kwargs): raise TracerEnvironmentError("Tracer currently only supports CGC and Unix.") def handle_exception(self, successors, engine, exc_type, exc_value, exc_traceb...
state_tracer
identifier_name
windows.py
_ptr -= cmdline.length / 8 state.memory.store(stack_ptr, cmdline) state.mem[self.acmdln_ptr].long = stack_ptr stack_ptr -= wcmdline.length / 8 state.memory.store(stack_ptr, wcmdline) state.mem[self.wcmdln_ptr].long = stack_ptr argv = table.dump(state, stack_ptr) ...
state.mem[string_area + string_size].short = 0 string_area += string_size + 2 # handle the links. we construct a python list in the correct order for each, and then, uh, mem_order = sorted(self.project.loader.all_pe_objects, key=lambda x: x.mapped_base) ...
state.mem[string_area + j*2].short = ord(c)
conditional_block
windows.py
4].dword = 0xbad76ead # thread id if self.project.loader.tls_object is not None: state.mem[TIB_addr + 0x2c].dword = self.project.loader.tls_object.user_thread_pointer # tls array pointer state.mem[TIB_addr + 0x30].dword = PEB_addr # PEB addr, of course state.regs....
exc_state.regs.esp -= 0x400 record = exc_state.regs._esp + 0x20
random_line_split
windows.py
self._exception_handler = self._find_or_make('KiUserExceptionDispatcher') self.project.hook(self._exception_handler, L['ntdll.dll'].get('KiUserExceptionDispatcher', self.arch), replace=True) self.fmode_ptr = self._find_or_make('_fmode') ...
""" Environemnt for the Windows Win32 subsystem. Does not support syscalls currently. """ def __init__(self, project): super(SimWindows, self).__init__(project, name='Win32') self._exception_handler = None self.fmode_ptr = None self.commode_ptr = None self.acmdln_ptr...
identifier_body
mempool_coinbase_spends.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test re-org scenarios with a mempool that contains transactions # that spend (directly or indirectly) coin...
if __name__ == '__main__': MempoolCoinbaseTest().main()
random_line_split
mempool_coinbase_spends.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test re-org scenarios with a mempool that contains transactions # that spend (directly or indirectly) coin...
self.sync_all() # mempool should be empty. assert_equal(set(self.nodes[0].getrawmempool()), set()) if __name__ == '__main__': MempoolCoinbaseTest().main()
node.invalidateblock(new_blocks[0])
conditional_block
mempool_coinbase_spends.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test re-org scenarios with a mempool that contains transactions # that spend (directly or indirectly) coin...
(self): args = ["-checkmempool", "-debug=mempool"] self.nodes = [] self.nodes.append(start_node(0, self.options.tmpdir, args)) self.nodes.append(start_node(1, self.options.tmpdir, args)) connect_nodes(self.nodes[1], 0) self.is_network_split = False self.sync_all ...
setup_network
identifier_name
mempool_coinbase_spends.py
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test re-org scenarios with a mempool that contains transactions # that spend (directly or indirectly) coin...
spend_103_raw = self.create_tx(coinbase_txids[2], node0_address, 50) # Broadcast and mine spend_102 and 103: spend_102_id = self.nodes[0].sendrawtransaction(spend_102_raw) spend_103_id = self.nodes[0].sendrawtransaction(spend_103_raw) self.nodes[0].generate(1) # Create ...
start_count = self.nodes[0].getblockcount() # Mine three blocks. After this, nodes[0] blocks # 101, 102, and 103 are spend-able. new_blocks = self.nodes[1].generate(4) self.sync_all() node0_address = self.nodes[0].getnewaddress() node1_address = self.nodes[1].getnewaddr...
identifier_body
diffservers1.js
s = new ShardingTest( "diffservers1" , 2 ); assert.eq( 2 , s.config.shards.count() , "server count wrong" ); assert.eq( 2 , s._connections[0].getDB( "config" ).shards.count() , "where are servers!" ); assert.eq( 0 , s._connections[1].getDB( "config" ).shards.count() , "shouldn't be here" ); test1 = s.getDB( "test1" )...
assert( ! s.admin.runCommand( { addshard: "sdd$%" } ).ok , "bad hostname" ); assert( ! s.admin.runCommand( { addshard: "127.0.0.1:43415" } ).ok , "host not up" ); assert( ! s.admin.runCommand( { addshard: "10.0.0.1:43415" } ).ok , "allowed shard in IP when config is localhost" ); s.stop();
test1.save( { a : 3 } ); assert( 3 , test1.count() );
random_line_split
profiles.py
"""Common profiles are defined here to be easily used within a project using --profile {name}""" from typing import Any, Dict black = { "multi_line_output": 3, "include_trailing_comma": True, "force_grid_wrap": 0, "use_parentheses": True, "ensure_newline_before_comments": True, "line_length": 8...
} profiles: Dict[str, Dict[str, Any]] = { "black": black, "django": django, "pycharm": pycharm, "google": google, "open_stack": open_stack, "plone": plone, "attrs": attrs, "hug": hug, }
"multi_line_output": 3, "include_trailing_comma": True, "force_grid_wrap": 0, "use_parentheses": True, "line_length": 100,
random_line_split
make_plots_smoothing.py
from utils.ols import * ########before preproccessing betas_before_process = apply_ols_to_subject(16, 3, r_outliers = False, smooth = False) ##average across all runs avg_before = average_betas(betas_before_process) ## shape to 4d avg_before = beta_2d_to_4d(avg_before)
plt.imshow(avg_before[:, :, 16, 0], interpolation='nearest', cmap='gray') plt.title('Middle Slice Beta(Gain) Before smoothing') plt.savefig("Before_preproccessing_gain") plt.figure() plt.imshow(avg_before[:, :, 16, 1], interpolation='nearest', cmap='gray') plt.title('Middle Slice Beta(Loss) Before smoothing') plt.sav...
plt.figure()
random_line_split
LogicalAnd.ts
/** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by a...
import {binaryKernelFunc} from '../utils/binary_utils'; export const logicalAndImpl = createSimpleBinaryKernelImpl((a: number, b: number) => a && b); export const logicalAnd = binaryKernelFunc( LogicalAnd, logicalAndImpl, null /* complexImpl */, 'bool'); export const logicalAndConfig: KernelConfig = { kerne...
import {KernelConfig, LogicalAnd} from '@tensorflow/tfjs-core'; import {createSimpleBinaryKernelImpl} from '../utils/binary_impl';
random_line_split
classExclusion.d.ts
/** * @license * Copyright 2013 Palantir Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by...
readonly locations: Set<Location>; readonly privacies: Set<Privacy>; excludes(node: ts.Node): boolean; private shouldLocationBeDocumented(node); private shouldPrivacyBeDocumented(node); }
locations?: Location[]; privacies?: Privacy[]; } export declare class ClassExclusion extends Exclusion<IClassExclusionDescriptor> {
random_line_split
classExclusion.d.ts
/** * @license * Copyright 2013 Palantir Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by...
extends Exclusion<IClassExclusionDescriptor> { readonly locations: Set<Location>; readonly privacies: Set<Privacy>; excludes(node: ts.Node): boolean; private shouldLocationBeDocumented(node); private shouldPrivacyBeDocumented(node); }
ClassExclusion
identifier_name
clipboard_provider.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use ipc_channel::ipc; use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::Msg as Constellat...
(&mut self) -> String { self.content.clone() } fn set_clipboard_contents(&mut self, s: String) { self.content = s; } }
clipboard_contents
identifier_name
clipboard_provider.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use ipc_channel::ipc; use msg::constellation_msg::ConstellationChan; use msg::constellation_msg::Msg as Constellat...
} } pub struct DummyClipboardContext { content: String } impl DummyClipboardContext { pub fn new(s: &str) -> DummyClipboardContext { DummyClipboardContext { content: s.to_owned() } } } impl ClipboardProvider for DummyClipboardContext { fn clipboard_contents(&mut self) ...
random_line_split
test_mixin.py
# -*- twisted.conch.test.test_mixin -*- # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. import time from twisted.internet import reactor, protocol from twisted.trial import unittest from twisted.test.proto_helpers import StringTransport from twisted.conch import mixin class TestB...
(unittest.TestCase): def testBuffering(self): p = TestBufferingProto() t = p.transport = StringTransport() self.failIf(p.scheduled) L = ['foo', 'bar', 'baz', 'quux'] p.write('foo') self.failUnless(p.scheduled) self.failIf(p.rescheduled) for s in L:...
BufferingTest
identifier_name
test_mixin.py
# -*- twisted.conch.test.test_mixin -*- # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. import time from twisted.internet import reactor, protocol from twisted.trial import unittest from twisted.test.proto_helpers import StringTransport from twisted.conch import mixin class TestB...
p.flush() self.assertEquals(t.value(), 'foo' + ''.join(L))
n = p.rescheduled p.write(s) self.assertEquals(p.rescheduled, n + 1) self.assertEquals(t.value(), '')
conditional_block
test_mixin.py
# -*- twisted.conch.test.test_mixin -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. import time from twisted.internet import reactor, protocol from twisted.trial import unittest from twisted.test.proto_helpers import StringTransport from twisted.conch import mixin class TestBufferingProto(mixin.BufferingMixin): ...
random_line_split
test_mixin.py
# -*- twisted.conch.test.test_mixin -*- # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. import time from twisted.internet import reactor, protocol from twisted.trial import unittest from twisted.test.proto_helpers import StringTransport from twisted.conch import mixin class TestB...
p = TestBufferingProto() t = p.transport = StringTransport() self.failIf(p.scheduled) L = ['foo', 'bar', 'baz', 'quux'] p.write('foo') self.failUnless(p.scheduled) self.failIf(p.rescheduled) for s in L: n = p.rescheduled p.write(s) ...
identifier_body
api.ts
(diagnostic: any): diagnostic is Diagnostic { return diagnostic != null && diagnostic.source === 'angular'; } export interface CompilerOptions extends ts.CompilerOptions { // NOTE: These comments and aio/content/guides/aot-compiler.md should be kept in sync. // Write statistics about compilation (e.g. total tim...
isNgDiagnostic
identifier_name
api.ts
option is // not provided is treated as if it were `false`. In Angular 6.0, if this option is not // provided, it will be treated as `true`. strictInjectionParameters?: boolean; // Whether to generate a flat module index of the given name and the corresponding // flat module metadata. This option is intende...
/** * Load a referenced resource either statically or asynchronously. If the host returns a * `Promise<string>` it is assumed the user of the corresponding `Program` will call * `loadNgStructureAsync()`. Returning `Promise<string>` outside `loadNgStructureAsync()` will * cause a diagnostics diagnostic er...
*/ fromSummaryFileName?(fileName: string, referringLibFileName: string): string;
random_line_split
api.ts
export function isNgDiagnostic(diagnostic: any): diagnostic is Diagnostic { return diagnostic != null && diagnostic.source === 'angular'; } export interface CompilerOptions extends ts.CompilerOptions { // NOTE: These comments and aio/content/guides/aot-compiler.md should be kept in sync. // Write statistics a...
{ return diagnostic != null && diagnostic.source !== 'angular'; }
identifier_body
border-horizontal-outlined.js
import { h } from 'omi'; import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(h("path", { d: "M3 21h2v-2H3v2zM5 7H3v2h2V7zM3 17h2v-2H3v2zm4 4h2v-2H7v2zM5 3H3v2h2V3zm4 0H7v2h2V3zm8 0h-2v2h2V3zm-4 4h-2v2h2V7zm0-4h-2v2h2V3zm6 14h2v-2h-2v2zm-8 4h2v-2h-2v2zm-8-8h18v-2H3v2zM19 3v2h2V3h-2zm0 6h2V7h-2v2zm-8 8h2v-2h-2v2zm4 4h2v-2h-2v2zm4 0h2v-2h-2v2z" }), 'BorderHorizontalO...
random_line_split
test_spherical_voronoi.py
from __future__ import print_function import numpy as np import itertools from numpy.testing import (assert_equal, assert_almost_equal, assert_array_equal, assert_array_almost_equal) from pytest import raises as assert_raises from scipy.sp...
(self): sv = SphericalVoronoi(self.points) unsorted_regions = sv.regions sv.sort_vertices_of_regions() assert_array_equal(sorted(sv.regions), sorted(unsorted_regions)) def test_sort_vertices_of_regions_flattened(self): expected = sorted([[0, 6, 5, 2, 3], [2, 3, 10, 11, 8, 7]...
test_sort_vertices_of_regions
identifier_name
test_spherical_voronoi.py
from __future__ import print_function import numpy as np import itertools from numpy.testing import (assert_equal, assert_almost_equal, assert_array_equal, assert_array_almost_equal) from pytest import raises as assert_raises from scipy.sp...
def test_voronoi_circles(self): sv = spherical_voronoi.SphericalVoronoi(self.points) for vertex in sv.vertices: distances = distance.cdist(sv.points,np.array([vertex])) closest = np.array(sorted(distances)[0:3]) assert_almost_equal(closest[0], closest[1], 7, str...
sv = SphericalVoronoi(self.points) expected = self.points.shape[0] * 2 - 4 actual = sv.vertices.shape[0] assert_equal(actual, expected)
identifier_body
test_spherical_voronoi.py
from __future__ import print_function import numpy as np import itertools from numpy.testing import (assert_equal, assert_almost_equal, assert_array_equal, assert_array_almost_equal) from pytest import raises as assert_raises from scipy.sp...
def test_duplicate_point_handling(self): # an exception should be raised for degenerate generators # related to Issue# 7046 self.degenerate = np.concatenate((self.points, self.points)) with assert_raises(ValueError): sv = spherical_voronoi.SphericalVoronoi(self.degenera...
distances = distance.cdist(sv.points,np.array([vertex])) closest = np.array(sorted(distances)[0:3]) assert_almost_equal(closest[0], closest[1], 7, str(vertex)) assert_almost_equal(closest[0], closest[2], 7, str(vertex))
conditional_block
test_spherical_voronoi.py
from __future__ import print_function import numpy as np import itertools from numpy.testing import (assert_equal, assert_almost_equal, assert_array_equal, assert_array_almost_equal) from pytest import raises as assert_raises from scipy.sp...
[-1.1, -2.1, -3.1], [-1.2, 2.2, 3.2], [-1.3, -2.3, 3.3]], [[10, 20, 30], [-10.1, -20.1, -30.1], [-10.2, 20.2, 30.2], [-10.3, -20.3, 30.3]] ]) result = spherical_voronoi.calc_circumcenters(tetrahedrons) ex...
tetrahedrons = np.array([ [[1, 2, 3],
random_line_split
lib.rs
). //! //! Description //! ----------- //!
//! //! Usage //! ----- //! //! `stal-rs` has no dependencies. It produces a vector of Redis operations that //! have to be run by the user. //! //! ```rust //! extern crate stal; //! //! let foobar = stal::Set::Inter(vec![stal::Set::Key(b"foo".to_vec()), stal::Set::Key(b"bar".to_vec())]); //! let foobar_nobaz = stal::...
//! `stal-rs` provide set operations and resolves them in [Redis][redis].
random_line_split
lib.rs
). //! //! Description //! ----------- //! //! `stal-rs` provide set operations and resolves them in [Redis][redis]. //! //! Usage //! ----- //! //! `stal-rs` has no dependencies. It produces a vector of Redis operations that //! have to be run by the user. //! //! ```rust //! extern crate stal; //! //! let foobar = st...
(&self) -> &'static str { match *self { Key(_) => unreachable!(), Union(_) => "SUNIONSTORE", Inter(_) => "SINTERSTORE", Diff(_) => "SDIFFSTORE", } } /// Appends the operation to `ops` and any temporary id created to `ids`. /// Returns the key ...
command
identifier_name
bluetoothdevice.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding; use dom::bindings::codegen::Bindings::BluetoothDevic...
pub fn new(global: GlobalRef, id: DOMString, name: Option<DOMString>, adData: &BluetoothAdvertisingData) -> Root<BluetoothDevice> { reflect_dom_object(box BluetoothDevice::new_inherited(id, ...
{ BluetoothDevice { reflector_: Reflector::new(), id: id, name: name, adData: MutHeap::new(adData), gatt: Default::default(), } }
identifier_body
bluetoothdevice.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding; use dom::bindings::codegen::Bindings::BluetoothDevic...
adData: &BluetoothAdvertisingData) -> BluetoothDevice { BluetoothDevice { reflector_: Reflector::new(), id: id, name: name, adData: MutHeap::new(adData), gatt: Default::default(), } } p...
random_line_split
bluetoothdevice.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::Bindings::BluetoothDeviceBinding; use dom::bindings::codegen::Bindings::BluetoothDevic...
(id: DOMString, name: Option<DOMString>, adData: &BluetoothAdvertisingData) -> BluetoothDevice { BluetoothDevice { reflector_: Reflector::new(), id: id, name: name, adData: MutHeap::new(adD...
new_inherited
identifier_name
color.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/. */ //! Resolved color values. use super::{Context, ToResolvedValue}; use crate::values::computed; use crate::value...
fn from_resolved_value(resolved: Self::ResolvedValue) -> Self { generics::Color::Numeric(resolved) } } impl ToResolvedValue for computed::ColorOrAuto { // A resolved caret-color value is an rgba color, with auto resolving to // currentcolor. type ResolvedValue = cssparser::RGBA; #[inli...
fn to_resolved_value(self, context: &Context) -> Self::ResolvedValue { context.style.resolve_color(self) } #[inline]
random_line_split