file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
url_extractor.py
""" The consumer's code. It takes HTML from the queue and outputs the URIs found in it. """ import asyncio import json import logging from typing import List from urllib.parse import urljoin import aioredis from bs4 import BeautifulSoup from . import app_cli, redis_queue _log = logging.getLogger('url_extractor') ...
def main(): """Run the URL extractor (the consumer). """ app_cli.setup_logging() args_parser = app_cli.get_redis_args_parser( 'Start a worker that will get URL/HTML pairs from a Redis queue and for each of those ' 'pairs output (on separate lines) a JSON in format {ORIGINATING_URL: [FOUN...
await asyncio.sleep(1) # pragma: no cover
random_line_split
url_extractor.py
""" The consumer's code. It takes HTML from the queue and outputs the URIs found in it. """ import asyncio import json import logging from typing import List from urllib.parse import urljoin import aioredis from bs4 import BeautifulSoup from . import app_cli, redis_queue _log = logging.getLogger('url_extractor') ...
def main(): """Run the URL extractor (the consumer). """ app_cli.setup_logging() args_parser = app_cli.get_redis_args_parser( 'Start a worker that will get URL/HTML pairs from a Redis queue and for each of those ' 'pairs output (on separate lines) a JSON in format {ORIGINATING_URL: [F...
try: html_payload = await redis_queue.pop(redis_pool) _log.info('Processing HTML from URL %s', html_payload.url) scraped_urls = _scrape_urls(html_payload.html, html_payload.url) _log.info('Scraped URIs from URL %s', html_payload.url) output_json = {html_payl...
conditional_block
0004_copy_exif_data_to_model.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.contrib.gis.geos import geometry from PIL import Image from PIL.ExifTags import TAGS from ..util import point_from_exif class Migration(DataMigr...
} } complete_apps = ['photomap'] symmetrical = True
random_line_split
0004_copy_exif_data_to_model.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.contrib.gis.geos import geometry from PIL import Image from PIL.ExifTags import TAGS from ..util import point_from_exif class Migration(DataMigr...
def backwards(self, orm): raise NotImplementedError('Too lazy to write a method to write the' ' coordinates to the EXIF of the files') models = { u'photomap.photo': { 'Meta': {'object_name': 'Photo'}, u'id': ('django.db.models.fields.A...
photo.location = point_from_exif(photo.image.path) photo.save()
conditional_block
0004_copy_exif_data_to_model.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.contrib.gis.geos import geometry from PIL import Image from PIL.ExifTags import TAGS from ..util import point_from_exif class Migration(DataMigr...
def forwards(self, orm): for photo in orm['photomap.Photo'].objects.all(): photo.location = point_from_exif(photo.image.path) photo.save() def backwards(self, orm): raise NotImplementedError('Too lazy to write a method to write the' ' coordi...
identifier_body
0004_copy_exif_data_to_model.py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.contrib.gis.geos import geometry from PIL import Image from PIL.ExifTags import TAGS from ..util import point_from_exif class Migration(DataMigr...
(self, orm): for photo in orm['photomap.Photo'].objects.all(): photo.location = point_from_exif(photo.image.path) photo.save() def backwards(self, orm): raise NotImplementedError('Too lazy to write a method to write the' ' coordinates to the...
forwards
identifier_name
CleanMoviePrefix.py
# coding=gbk import os import re import string def isMov(filename): # ÅжÏÊÇ·ñΪµçÓ°Îļþ suffix = filename.split('.')[-1].lower() # ÌáÈ¡ºó׺ pattern = re.compile(r'mpg|mpeg|m2v|mkv|dat|vob|avi|wmv|rm|ram|rmvb|mov|avi|mp4|qt|viv') if pattern.search(suffix): # Æ¥ÅäÊÇ·ñΪµçÓ°¸ñʽ return True...
¼ print '´¦ÀíÖС­¡­' cnt = 1 for fp in os.listdir(os.getcwd()): if os.path.isfile(fp) and isMov(fp): # ÊǵçÓ°Îļþ if fp[0]=='[': # È¥µô¿ªÍ·µÄ[] index = fp.find(']') if index!=-1: print '[%d] %s ==> %s'%(cnt,fp,fp[index+1:]) ...
±éÀúµ±Ç°Ä¿
conditional_block
CleanMoviePrefix.py
# coding=gbk import os import re import string def
(filename): # ÅжÏÊÇ·ñΪµçÓ°Îļþ suffix = filename.split('.')[-1].lower() # ÌáÈ¡ºó׺ pattern = re.compile(r'mpg|mpeg|m2v|mkv|dat|vob|avi|wmv|rm|ram|rmvb|mov|avi|mp4|qt|viv') if pattern.search(suffix): # Æ¥ÅäÊÇ·ñΪµçÓ°¸ñʽ return True else: return False if __name__=='__main__':...
isMov
identifier_name
CleanMoviePrefix.py
# coding=gbk import os import re import string def isMov(filename): # ÅжÏÊÇ·ñΪµçÓ°Îļþ suffix = filename.split('.')[-1].lower() # ÌáÈ¡ºó׺ pattern = re.compile(r'mpg|mpeg|m2v|mkv|dat|vob|avi|wmv|rm|ram|rmvb|mov|avi|mp4|qt|viv') if pattern.search(suffix): # Æ¥ÅäÊÇ·ñΪµçÓ°¸ñʽ return True...
if cnt==1: print 'ûÓÐÐèÒª´¦ÀíµÄµçÓ°Îļþ' else: print '´¦ÀíÍê±Ï'
random_line_split
CleanMoviePrefix.py
# coding=gbk import os import re import string def isMov(filename): # ÅжÏÊÇ·ñΪµçÓ°Îļþ suffix = filename.
¼ print '´¦ÀíÖС­¡­' cnt = 1 for fp in os.listdir(os.getcwd()): if os.path.isfile(fp) and isMov(fp): # ÊǵçÓ°Îļþ if fp[0]=='[': # È¥µô¿ªÍ·µÄ[] index = fp.find(']') if index!=-1: print '[%d] %s ==> %s'%(cnt,fp,fp[index+1:]) ...
split('.')[-1].lower() # ÌáÈ¡ºó׺ pattern = re.compile(r'mpg|mpeg|m2v|mkv|dat|vob|avi|wmv|rm|ram|rmvb|mov|avi|mp4|qt|viv') if pattern.search(suffix): # Æ¥ÅäÊÇ·ñΪµçÓ°¸ñʽ return True else: return False if __name__=='__main__': # ±éÀúµ±Ç°Ä¿
identifier_body
anysex.py
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( parse_duration, int_or_none, ) class AnySexIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?anysex\.com/(?P<id>\d+)' _TEST = { 'url': 'http://anysex.com/156592/', 'md5': '023...
mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) video_url = self._html_search_regex(r"video_url\s*:\s*'([^']+)'", webpage, 'video URL') title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title') ...
identifier_body
anysex.py
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( parse_duration, int_or_none, ) class
(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?anysex\.com/(?P<id>\d+)' _TEST = { 'url': 'http://anysex.com/156592/', 'md5': '023e9fbb7f7987f5529a394c34ad3d3d', 'info_dict': { 'id': '156592', 'ext': 'mp4', 'title': 'Busty and sexy blondie in her bi...
AnySexIE
identifier_name
anysex.py
from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( parse_duration, int_or_none, )
'url': 'http://anysex.com/156592/', 'md5': '023e9fbb7f7987f5529a394c34ad3d3d', 'info_dict': { 'id': '156592', 'ext': 'mp4', 'title': 'Busty and sexy blondie in her bikini strips for you', 'description': 'md5:de9e418178e2931c10b62966474e1383', ...
class AnySexIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?anysex\.com/(?P<id>\d+)' _TEST = {
random_line_split
typeReference.tsx
import { ITypeReference, isDynamic, isKeyword, isGenericParameter, isRequiredModifier, isPointer, isArray, IArrayDimension, isGenericInstance, isSimpleOrOpenGeneric } from "../../structure"; import { ReactFragment, FormatContext, locationDnaid, join, array, keyword, location, concreteTypeReference } from "."; function...
(context: FormatContext, value: ITypeReference): ReactFragment { if (isDynamic(value)) return keyword('dynamic'); else if (isKeyword(value)) return location(context, value.l, keyword(value.n)); else if (isGenericParameter(value)) return value.n; // TODO: syntax highlighting for this?...
typeReference
identifier_name
typeReference.tsx
import { ITypeReference, isDynamic, isKeyword, isGenericParameter, isRequiredModifier, isPointer, isArray, IArrayDimension, isGenericInstance, isSimpleOrOpenGeneric } from "../../structure"; import { ReactFragment, FormatContext, locationDnaid, join, array, keyword, location, concreteTypeReference } from "."; function...
return null; }
];
random_line_split
typeReference.tsx
import { ITypeReference, isDynamic, isKeyword, isGenericParameter, isRequiredModifier, isPointer, isArray, IArrayDimension, isGenericInstance, isSimpleOrOpenGeneric } from "../../structure"; import { ReactFragment, FormatContext, locationDnaid, join, array, keyword, location, concreteTypeReference } from "."; function...
{ if (isDynamic(value)) return keyword('dynamic'); else if (isKeyword(value)) return location(context, value.l, keyword(value.n)); else if (isGenericParameter(value)) return value.n; // TODO: syntax highlighting for this? else if (isRequiredModifier(value)) return locatio...
identifier_body
localfileview.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2009-2010 Zuza Software Foundation # # This file is part of Virtaal. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version ...
same_src_units = self.term_model.get_units_with_source(src_text) if src_text and same_src_units: # We want to separate multiple terms with the correct list # separator for the UI language: separator = lang_factory.getlanguage(ui_language).listseperator #l10...
.lbl_add_term_errors.set_text(_('Identical entry already exists.')) self.eb_add_term_errors.modify_bg(gtk.STATE_NORMAL, gdk.color_parse(current_theme['warning_bg'])) self.eb_add_term_errors.show_all() self.btn_add_term.props.sensitive = False return
conditional_block
localfileview.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2009-2010 Zuza Software Foundation # # This file is part of Virtaal. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version ...
: """ Class that manages the localfile terminology plug-in's GUI presense and interaction. """ # INITIALIZERS # def __init__(self, model): self.term_model = model self.controller = model.controller self.mainview = model.controller.main_controller.view self._signal_id...
LocalFileView
identifier_name
localfileview.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2009-2010 Zuza Software Foundation # # This file is part of Virtaal. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version ...
def _init_add_chooser(self): # The following code was mostly copied from virtaal.views.MainView._create_dialogs() dlg = gtk.FileChooserDialog( _('Add Files'), self.controller.main_controller.view.main_window, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_...
self.lst_files = gtk.ListStore(str, bool) self.tvw_termfiles.set_model(self.lst_files) cell = gtk.CellRendererText() cell.props.ellipsize = pango.ELLIPSIZE_MIDDLE col = gtk.TreeViewColumn(_('File')) col.pack_start(cell) col.add_attribute(cell, 'text', self.COL_FILE) ...
identifier_body
localfileview.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2009-2010 Zuza Software Foundation # # This file is part of Virtaal. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version ...
import pango from gtk import gdk from locale import strcoll from translate.lang import factory as lang_factory from translate.storage import factory as store_factory from virtaal.common.pan_app import ui_language from virtaal.views.baseview import BaseView from virtaal.views import rendering from virtaal.views.theme i...
# along with this program; if not, see <http://www.gnu.org/licenses/>. import os.path import gtk import logging
random_line_split
mod.rs
//! Simple Rust AST. This is what the various code generators create, //! which then gets serialized. use grammar::repr::Grammar; use grammar::parse_tree::Visibility; use tls::Tls; use std::fmt; use std::io::{self, Write}; macro_rules! rust { ($w:expr, $($args:tt)*) => { try!(($w).writeln(&::std::fmt::for...
try!(write!(self.write, " ")); } try!(write!(self.write, "{},", i)); first = false; } } writeln!(self.write, "") } pub fn writeln(&mut self, out: &str) -> io::Result<()> { let buf = out.as_bytes(); ...
for (i, _comment) in iterable { if !first {
random_line_split
mod.rs
//! Simple Rust AST. This is what the various code generators create, //! which then gets serialized. use grammar::repr::Grammar; use grammar::parse_tree::Visibility; use tls::Tls; use std::fmt; use std::io::{self, Write}; macro_rules! rust { ($w:expr, $($args:tt)*) => { try!(($w).writeln(&::std::fmt::for...
}
{ // Stuff that we plan to use. // Occasionally we happen to not use it after all, hence the allow. rust!(self, "#[allow(unused_extern_crates)]"); rust!(self, "extern crate lalrpop_util as {}lalrpop_util;", prefix); Ok(()) }
identifier_body
mod.rs
//! Simple Rust AST. This is what the various code generators create, //! which then gets serialized. use grammar::repr::Grammar; use grammar::parse_tree::Visibility; use tls::Tls; use std::fmt; use std::io::{self, Write}; macro_rules! rust { ($w:expr, $($args:tt)*) => { try!(($w).writeln(&::std::fmt::for...
Ok(()) } pub fn write_module_attributes(&mut self, grammar: &Grammar) -> io::Result<()> { for attribute in grammar.module_attributes.iter() { rust!(self, "{}", attribute); } Ok(()) } pub fn write_uses(&mut self, super_prefix: &str, grammar: &Grammar) -> io...
{ rust!(self, ") -> {}", return_type); }
conditional_block
mod.rs
//! Simple Rust AST. This is what the various code generators create, //! which then gets serialized. use grammar::repr::Grammar; use grammar::parse_tree::Visibility; use tls::Tls; use std::fmt; use std::io::{self, Write}; macro_rules! rust { ($w:expr, $($args:tt)*) => { try!(($w).writeln(&::std::fmt::for...
(&mut self, grammar: &Grammar) -> io::Result<()> { for attribute in grammar.module_attributes.iter() { rust!(self, "{}", attribute); } Ok(()) } pub fn write_uses(&mut self, super_prefix: &str, grammar: &Grammar) -> io::Result<()> { // things the user wrote fo...
write_module_attributes
identifier_name
create.rs
static LOREM_IPSUM: &'static str = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate...
() { let path = Path::new("out/lorem_ipsum.txt"); let display = path.display(); // 以只写模式打开文件,返回 `io::Result<File>` let mut file = match File::create(&path) { Err(why) => panic!("couldn't create {}: {}", display, why.description()), O...
main
identifier_name
create.rs
static LOREM_IPSUM: &'static str = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate...
{ let path = Path::new("out/lorem_ipsum.txt"); let display = path.display(); // 以只写模式打开文件,返回 `io::Result<File>` let mut file = match File::create(&path) { Err(why) => panic!("couldn't create {}: {}", display, why.description()), Ok(f...
identifier_body
create.rs
static LOREM_IPSUM: &'static str = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate...
}
random_line_split
hasIn.ts
import { baseHasIn } from './_baseHasIn'; import { hasPath } from './_hasPath'; /** * Checks if `path` is a direct or inherited property of `_object`. * * @param object The _object to query. * @param path The path to check. * Returns `true` if `path` exists, else `false`. * * var _object = _.create({ 'a': _.cre...
{ return object != null && hasPath(object, path, baseHasIn); }
identifier_body
hasIn.ts
import { baseHasIn } from './_baseHasIn'; import { hasPath } from './_hasPath'; /** * Checks if `path` is a direct or inherited property of `_object`. * * @param object The _object to query. * @param path The path to check. * Returns `true` if `path` exists, else `false`. * * var _object = _.create({ 'a': _.cre...
(object: any, path: string[] | string): boolean { return object != null && hasPath(object, path, baseHasIn); }
hasIn
identifier_name
hasIn.ts
import { baseHasIn } from './_baseHasIn'; import { hasPath } from './_hasPath'; /** * Checks if `path` is a direct or inherited property of `_object`.
* * var _object = _.create({ 'a': _.create({ 'b': 2 }) }); * * _.hasIn(_object, 'a'); * // => true * * _.hasIn(_object, 'a.b'); * // => true * * _.hasIn(_object, ['a', 'b']); * // => true * * _.hasIn(_object, 'b'); * // => false */ export function hasIn(object: any, path: string[] | string): boolean { ...
* * @param object The _object to query. * @param path The path to check. * Returns `true` if `path` exists, else `false`.
random_line_split
Player.js
~function () { /** * Create a new player. */ function Player(params) { params || (params = {}); for (var key in params) this[key] = params[key]; _createAnimation(this); _createMesh(this); _setThirdPersonCamera(this); this.score = 0; this.target = this.mesh.position.clone(); } Player.prototype....
if (this.isInvinsible()) { this.invinsibleDelay -= delta; this.mesh.visible = ~~(this.invinsibleDelay * 10) % 2; } else this.mesh.visible = true; } /** * Check collision between the player and another entity. */ Player.prototype.hit = function (entity) { var d = entity.mesh.position.z + 35 - this...
this.mesh.position.lerp(this.target, delta * 10);
random_line_split
Player.js
~function () { /** * Create a new player. */ function Player(params)
Player.prototype.run = function () { this.anim.play("run"); } /** * Update the player at each frame. * @param delta The delta time between this frame and * the previous one. */ Player.prototype.update = function (delta) { this.anim.update(delta * 1000); if (THREE.Input.isKeyDown('leftArrow')) _moveLe...
{ params || (params = {}); for (var key in params) this[key] = params[key]; _createAnimation(this); _createMesh(this); _setThirdPersonCamera(this); this.score = 0; this.target = this.mesh.position.clone(); }
identifier_body
Player.js
~function () { /** * Create a new player. */ function
(params) { params || (params = {}); for (var key in params) this[key] = params[key]; _createAnimation(this); _createMesh(this); _setThirdPersonCamera(this); this.score = 0; this.target = this.mesh.position.clone(); } Player.prototype.run = function () { this.anim.play("run"); } /** * Update t...
Player
identifier_name
engine.js
// Enable source map support // import 'source-map-support/register' // Module Dependencies import path from 'path' import async from 'async' import { Utils as UtilsClass } from './satellites/utils' // FIXME: this is a temporary workaround, we must make this more professional const Utils = new UtilsClass() // This s...
} // initializer stop function let stopFunction = next => { if (typeof this.satellites[ initializer ].stop === 'function') { this.api.log(` > stop: ${initializer}`, 'debug') this.satellites[ initializer ].stop(this.api, err => { if (!err) { this...
{ next() }
conditional_block
engine.js
// Enable source map support // import 'source-map-support/register' // Module Dependencies import path from 'path' import async from 'async' import { Utils as UtilsClass } from './satellites/utils' // FIXME: this is a temporary workaround, we must make this more professional const Utils = new UtilsClass() // This s...
(callback = null) { let self = this // if this function has called outside of the Engine the 'this' // variable has an invalid reference if (this._self) { self = this._self } if (self.api.status === 'running') { // stop the engine self.stop(err => { // log error if present ...
restart
identifier_name
engine.js
// Enable source map support // import 'source-map-support/register' // Module Dependencies import path from 'path' import async from 'async' import { Utils as UtilsClass } from './satellites/utils' // FIXME: this is a temporary workaround, we must make this more professional const Utils = new UtilsClass() // This s...
startSatellitesRankings[ this.satellites[ initializer ].startPriority ].push(startFunction) stopSatellitesRankings[ this.satellites[ initializer ].stopPriority ].push(stopFunction) } } // get an array with all satellites loadSatellitesInPlace(Utils.getFiles(`${__dirname}/satellites`))...
random_line_split
app.js
'use-strict'; var hours = ['6:00am', '7:00am', '8:00am', '9:00am', '10:00am', '11:00am', '12:00pm', '1:00pm', '2:00pm', '3:00pm', '4:00pm', '5:00pm', '6:00pm', '7:00pm']; var allLocations = []; var theTable = document.getElementById('pike'); var el = document.getElementById('moreStores'); // var hourlyTotals = []; //...
//validate by type if (typeof minCustomers !== 'number') { return alert('Min customers must be a number'); } // ignore case on store names for(var i = 0; i < allLocations.length; i++){ if(newStoreLocation === allLocations[i].locationName) { allLocations[i].minCustomersPerHour = minCustomers;...
{ return alert('All fields must have a value'); }
conditional_block
app.js
'use-strict'; var hours = ['6:00am', '7:00am', '8:00am', '9:00am', '10:00am', '11:00am', '12:00pm', '1:00pm', '2:00pm', '3:00pm', '4:00pm', '5:00pm', '6:00pm', '7:00pm']; var allLocations = []; var theTable = document.getElementById('pike'); var el = document.getElementById('moreStores'); // var hourlyTotals = []; //...
(locationName, minCustomersPerHour, maxCustomersPerHour, avgCookiesPerCustomer) { this.locationName = locationName; this.minCustomersPerHour = minCustomersPerHour; this.maxCustomersPerHour = maxCustomersPerHour; this.avgCookiesPerCustomer = avgCookiesPerCustomer; this.customersEachHour = []; this.cookiesEac...
CookieStore
identifier_name
app.js
'use-strict'; var hours = ['6:00am', '7:00am', '8:00am', '9:00am', '10:00am', '11:00am', '12:00pm', '1:00pm', '2:00pm', '3:00pm', '4:00pm', '5:00pm', '6:00pm', '7:00pm']; var allLocations = []; var theTable = document.getElementById('pike'); var el = document.getElementById('moreStores'); // var hourlyTotals = []; //...
clearForm(); // for(var i = allLocations.length - 1; i < allLocations.length; i++){ // allLocations[i].render(); // } renderTable(); }; // Listener code el.addEventListener('submit', handleStoreSubmit);
{ event.target.storeLocation.value = null; event.target.minCustomers.value = null; event.target.maxCustomers.value = null; event.target.avgCookiesSold.value = null; }
identifier_body
app.js
'use-strict'; var hours = ['6:00am', '7:00am', '8:00am', '9:00am', '10:00am', '11:00am', '12:00pm', '1:00pm', '2:00pm', '3:00pm', '4:00pm', '5:00pm', '6:00pm', '7:00pm']; var allLocations = []; var theTable = document.getElementById('pike'); var el = document.getElementById('moreStores'); // var hourlyTotals = []; //...
thEL = document.createElement('th'); thEL.textContent = hourlyTotal; trEL.appendChild(thEL); } thEL = document.createElement('th'); thEL.textContent = totalOfTotals; trEL.appendChild(thEL); theTable.appendChild(trEL); }; // passing new stores to the cookie store constructor var pikePlace = new Co...
hourlyTotal = 0; for (var j = 0; j < allLocations.length; j++) { hourlyTotal += allLocations[j].cookiesEachHour[i]; totalOfTotals += allLocations[j].cookiesEachHour[i]; }
random_line_split
Confirm.spec.tsx
/* MIT License Copyright (c) 2022 Looker Data Sciences, Inc.
in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this ...
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
random_line_split
urls.py
# -*- coding: utf-8 -*- """ ------ Urls ------ Arquivo de configuração das urls da aplicação blog Autores: * Alisson Barbosa Ferreira <alissonbf@hotmail.com>
============== ================== Criação Atualização ============== ================== 29/11/2014 29/11/2014 ============== ================== """ from django.conf.urls import patterns, url urlpatterns = patterns('blog.views', url(r'^cadastro-usuario/$', 'usuario', name='usuario'), url(r'^c...
Data:
random_line_split
linear-for-loop.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 ...
() { let x = vec!(1, 2, 3); let mut y = 0; for i in x.iter() { println!("{:?}", *i); y += *i; } println!("{:?}", y); assert_eq!(y, 6); let s = "hello there".to_owned(); let mut i: int = 0; for c in s.bytes() { if i == 0 { assert!((c == 'h' as u8)); } if i == 1 { assert!((...
main
identifier_name
linear-for-loop.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 ...
if i == 2 { assert!((c == 'l' as u8)); } if i == 3 { assert!((c == 'l' as u8)); } if i == 4 { assert!((c == 'o' as u8)); } // ... i += 1; println!("{:?}", i); println!("{:?}", c); } assert_eq!(i, 11); }
{ assert!((c == 'e' as u8)); }
conditional_block
linear-for-loop.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 ...
{ let x = vec!(1, 2, 3); let mut y = 0; for i in x.iter() { println!("{:?}", *i); y += *i; } println!("{:?}", y); assert_eq!(y, 6); let s = "hello there".to_owned(); let mut i: int = 0; for c in s.bytes() { if i == 0 { assert!((c == 'h' as u8)); } if i == 1 { assert!((c =...
identifier_body
linear-for-loop.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
let x = vec!(1, 2, 3); let mut y = 0; for i in x.iter() { println!("{:?}", *i); y += *i; } println!("{:?}", y); assert_eq!(y, 6); let s = "hello there".to_owned(); let mut i: int = 0; for c in s.bytes() { if i == 0 { assert!((c == 'h' as u8)); } if i == 1 { assert!((c == ...
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. pub fn main() {
random_line_split
karma.conf.js
module.exports = function (config) { var configuration = {
// frameworks to use // available frameworks: https://npmjs.org/browse/keyword/karma-adapter frameworks: ['jasmine'], // list of files / patterns to load in the browser files: [ 'node_modules/jquery/dist/jquery.js', 'node_modules/jasmine-jquery/lib/jasm...
// base path that will be used to resolve all patterns (eg. files, exclude) basePath: '',
random_line_split
iterable_differs.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 */ import {Optional, Provider, SkipSelf} from '../../di'; import {ListWrapper} from '../../facade/collection'; import {...
throw new Error('Cannot extend IterableDiffers without a parent injector'); } return IterableDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[IterableDiffers, new SkipSelf(), new Option...
// Typically would occur when calling IterableDiffers.extend inside of dependencies passed // to // bootstrap(), which would override default pipes instead of extending them.
random_line_split
iterable_differs.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 */ import {Optional, Provider, SkipSelf} from '../../di'; import {ListWrapper} from '../../facade/collection'; import {...
(public factories: IterableDifferFactory[]) {} static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers { if (isPresent(parent)) { var copied = ListWrapper.clone(parent.factories); factories = factories.concat(copied); return new IterableDiffers(factories); ...
constructor
identifier_name
iterable_differs.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 */ import {Optional, Provider, SkipSelf} from '../../di'; import {ListWrapper} from '../../facade/collection'; import {...
else { return new IterableDiffers(factories); } } /** * Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the * inherited {@link IterableDiffers} instance with the provided factories and return a new * {@link IterableDiffers} instance. * * The following...
{ var copied = ListWrapper.clone(parent.factories); factories = factories.concat(copied); return new IterableDiffers(factories); }
conditional_block
jakarta.js
"use strict"; var helpers = require("../../helpers/helpers"); exports["Asia/Jakarta"] = { "guess" : helpers.makeTestGuess("Asia/Jakarta", { offset: true, abbr: true }), "1923" : helpers.makeTestYear("Asia/Jakarta", [ ["1923-12-31T16:39:59+00:00", "23:47:11", "BMT", -25632 / 60], ["1923-12-31T16:40:00+00:00", "...
"1942" : helpers.makeTestYear("Asia/Jakarta", [ ["1942-03-22T16:29:59+00:00", "23:59:59", "WIB", -450], ["1942-03-22T16:30:00+00:00", "01:30:00", "JST", -540] ]), "1945" : helpers.makeTestYear("Asia/Jakarta", [ ["1945-09-22T14:59:59+00:00", "23:59:59", "JST", -540], ["1945-09-22T15:00:00+00:00", "22:30:00",...
random_line_split
expressionengine.py
""" This signature containts test to see if the site is running on ExpressionEngine. """ __author__ = "Seth Gottlieb" __copyright__ = "CM Fieldguide" __credits__ = ["Seth Gottlieb",] __license__ = "Unlicense" __version__ = "0.1" __maintainer__ = "Seth Gottlieb" __email__ = "sgottlieb@alumni.duke.edu" __status__ = "Expe...
NAME = 'ExpressionEngine' WEBSITE = 'http://expressionengine.com/' KNOWN_POSITIVE = 'http://expressionengine.com/' TECHNOLOGY = 'PHP' def test_has_ee_login(self, site): """ By default, Expression Engine ships with a login page at /admin.php """ if site.page_...
identifier_body
expressionengine.py
""" This signature containts test to see if the site is running on ExpressionEngine. """ __author__ = "Seth Gottlieb" __copyright__ = "CM Fieldguide" __credits__ = ["Seth Gottlieb",] __license__ = "Unlicense" __version__ = "0.1" __maintainer__ = "Seth Gottlieb" __email__ = "sgottlieb@alumni.duke.edu" __status__ = "Expe...
?css=something.css """ if site.home_page.has_matching_tag('link', {'rel':'stylesheet','href': '/\?css=\w+[\.|/]'}): return 1 else: return 0
return 0 def test_has_css_loader_script(self, site): """ ExpressionEngine loads CSS files with a query string off the root of the site like
random_line_split
expressionengine.py
""" This signature containts test to see if the site is running on ExpressionEngine. """ __author__ = "Seth Gottlieb" __copyright__ = "CM Fieldguide" __credits__ = ["Seth Gottlieb",] __license__ = "Unlicense" __version__ = "0.1" __maintainer__ = "Seth Gottlieb" __email__ = "sgottlieb@alumni.duke.edu" __status__ = "Expe...
(BaseSignature): NAME = 'ExpressionEngine' WEBSITE = 'http://expressionengine.com/' KNOWN_POSITIVE = 'http://expressionengine.com/' TECHNOLOGY = 'PHP' def test_has_ee_login(self, site): """ By default, Expression Engine ships with a login page at /admin.php """ ...
Signature
identifier_name
expressionengine.py
""" This signature containts test to see if the site is running on ExpressionEngine. """ __author__ = "Seth Gottlieb" __copyright__ = "CM Fieldguide" __credits__ = ["Seth Gottlieb",] __license__ = "Unlicense" __version__ = "0.1" __maintainer__ = "Seth Gottlieb" __email__ = "sgottlieb@alumni.duke.edu" __status__ = "Expe...
else: return 0
return 1
conditional_block
serv.rs
// Copyright 2021 The Grin Developers // // 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 agree...
(&self, _h: Hash) -> Option<core::Transaction> { None } fn tx_kernel_received(&self, _h: Hash, _peer_info: &PeerInfo) -> Result<bool, chain::Error> { Ok(true) } fn transaction_received( &self, _: core::Transaction, _stem: bool, ) -> Result<bool, chain::Error> { Ok(true) } fn compact_block_received( ...
get_transaction
identifier_name
serv.rs
// Copyright 2021 The Grin Developers // // 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 agree...
}
{ false }
identifier_body
serv.rs
// Copyright 2021 The Grin Developers // // 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 agree...
peers: Arc::new(Peers::new(PeerStore::new(db_root)?, adapter, config)), stop_state, }) } /// Starts a new TCP server and listen to incoming connections. This is a /// blocking call until the TCP server stops. pub fn listen(&self) -> Result<(), Error> { // start TCP listener and handle incoming connection...
) -> Result<Server, Error> { Ok(Server { config: config.clone(), capabilities, handshake: Arc::new(Handshake::new(genesis, config.clone())),
random_line_split
serv.rs
// Copyright 2021 The Grin Developers // // 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 agree...
if let Some(p) = self.peers.get_connected_peer(addr) { // if we're already connected to the addr, just return the peer trace!("connect_peer: already connected {}", addr); return Ok(p); } trace!( "connect_peer: on {}:{}. connecting to {}", self.config.host, self.config.port, addr ); mat...
{ let hs = self.handshake.clone(); let addrs = hs.addrs.read(); if addrs.contains(&addr) { debug!("connect: ignore connecting to PeerWithSelf, addr: {}", addr); return Err(Error::PeerWithSelf); } }
conditional_block
DefaultProjectKey.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program 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, o...
* * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; import { Component } from '../../../types/types'; import Co...
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details.
random_line_split
DefaultProjectKey.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program 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, o...
{ const { component } = props; return ( <li className="abs-width-600"> <SentenceWithFilename filename="sonar-project.properties" translationKey="onboarding.tutorial.other.project_key" /> <CodeSnippet snippet={sonarProjectSnippet(component.key)} /> </li> ); }
identifier_body
DefaultProjectKey.tsx
/* * SonarQube * Copyright (C) 2009-2022 SonarSource SA * mailto:info AT sonarsource DOT com * * This program 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, o...
(props: DefaultProjectKeyProps) { const { component } = props; return ( <li className="abs-width-600"> <SentenceWithFilename filename="sonar-project.properties" translationKey="onboarding.tutorial.other.project_key" /> <CodeSnippet snippet={sonarProjectSnippet(component.key)} /...
DefaultProjectKey
identifier_name
lib.rs
extern crate regex; macro_rules! regex( ($s:expr) => (regex::Regex::new($s).unwrap()); ); pub fn is_valid(kennitala : &str) -> bool { let constants = [3, 2, 7, 6, 5, 4, 3, 2]; let re = regex!(r"^\d{6}-?\d{4}$"); if re.is_match(kennitala)
false }
{ let sanitized = kennitala.replace("-",""); let check_digit = (sanitized.as_bytes()[8] as char).to_digit(10).unwrap(); let c = constants .iter() .zip(sanitized.bytes()) .fold(0, |sum : u32, (x, y) : (&u32, u8)| sum + ...
conditional_block
lib.rs
extern crate regex; macro_rules! regex( ($s:expr) => (regex::Regex::new($s).unwrap()); ); pub fn is_valid(kennitala : &str) -> bool { let constants = [3, 2, 7, 6, 5, 4, 3, 2]; let re = regex!(r"^\d{6}-?\d{4}$"); if re.is_match(kennitala) { let sanitized = kennitala.replace("-",""); ...
}
} } false
random_line_split
lib.rs
extern crate regex; macro_rules! regex( ($s:expr) => (regex::Regex::new($s).unwrap()); ); pub fn is_valid(kennitala : &str) -> bool
{ let constants = [3, 2, 7, 6, 5, 4, 3, 2]; let re = regex!(r"^\d{6}-?\d{4}$"); if re.is_match(kennitala) { let sanitized = kennitala.replace("-",""); let check_digit = (sanitized.as_bytes()[8] as char).to_digit(10).unwrap(); let c = constants .iter() ...
identifier_body
lib.rs
extern crate regex; macro_rules! regex( ($s:expr) => (regex::Regex::new($s).unwrap()); ); pub fn
(kennitala : &str) -> bool { let constants = [3, 2, 7, 6, 5, 4, 3, 2]; let re = regex!(r"^\d{6}-?\d{4}$"); if re.is_match(kennitala) { let sanitized = kennitala.replace("-",""); let check_digit = (sanitized.as_bytes()[8] as char).to_digit(10).unwrap(); let c = constants ...
is_valid
identifier_name
cpp.rs
//! Enables the generation of header and source files for using intercom //! libraries from C++ projects. extern crate std; use std::borrow::Cow; use std::io::Write; use super::GeneratorError; use super::{pascal_case, LibraryContext, ModelOptions, TypeSystemOptions}; use intercom::typelib::{ Arg, CoClass, Direc...
(lib: TypeLib, opts: &ModelOptions) -> Result<Self, GeneratorError> { let ctx = LibraryContext::try_from(&lib)?; let mut interfaces = vec![]; let mut coclasses = vec![]; for t in &lib.types { match t { TypeInfo::Class(cls) => { coclass...
try_from
identifier_name
cpp.rs
//! Enables the generation of header and source files for using intercom //! libraries from C++ projects. extern crate std; use std::borrow::Cow; use std::io::Write; use super::GeneratorError; use super::{pascal_case, LibraryContext, ModelOptions, TypeSystemOptions}; use intercom::typelib::{ Arg, CoClass, Direc...
} /// Generates the manifest content. /// /// - `out` - The writer to use for output. pub fn write( lib: intercom::typelib::TypeLib, opts: ModelOptions, out_header: Option<&mut dyn Write>, out_source: Option<&mut dyn Write>, ) -> Result<(), GeneratorError> { let mut reg = Handlebars::new(); re...
{ let interfaces = cls .interfaces .iter() .flat_map(|itf_ref| { opts.type_systems .iter() .map(|opt| { let itf = ctx.itfs_by_ref[itf_ref.name.as_ref()]; CppInterface::fina...
identifier_body
cpp.rs
//! Enables the generation of header and source files for using intercom //! libraries from C++ projects. extern crate std; use std::borrow::Cow; use std::io::Write; use super::GeneratorError; use super::{pascal_case, LibraryContext, ModelOptions, TypeSystemOptions}; use intercom::typelib::{ Arg, CoClass, Direc...
other => other.to_string(), }; format!("{}{}", base_name, "*".repeat(indirection as usize)) } } impl CppClass { fn try_from( cls: &CoClass, opts: &ModelOptions, ctx: &LibraryContext, ) -> Result<Self, GeneratorError> { let interfaces = cls ...
random_line_split
sequences.state.ts
/* * Lumeer: Modern Data Definition and Processing Platform * * Copyright (C) since 2017 Lumeer.io, s.r.o. and/or its affiliates. * * This program is free software: you can redistribute it and/or modify
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License *...
* 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. *
random_line_split
sprk-alert.stories.ts
import { SprkAlertModule } from './sprk-alert.module'; import { SprkAlertComponent } from './sprk-alert.component'; import { markdownDocumentationLinkBuilder } from '../../../../../../../storybook-utilities/markdownDocumentationLinkBuilder'; // prettier-ignore // @ts-ignore import { moduleMetadata, Meta } from '@storyb...
`, }, }, }, } as Meta; export const info = () => ({ template: ` <sprk-alert variant="info" idString="alert-info-1" analyticsString="test" > This is important information. </sprk-alert>`, }); info.parameters = { jest: ['sprk-alert.component'], }; export cons...
assistive technologies can inform the user that their attention is needed.
random_line_split
flex-offset.ts
/** * @license * Copyright Google LLC 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 */ import { Directive, ElementRef, Input, OnInit, OnChanges, OnDestroy, Optional, SimpleChanges, SkipSe...
(val) { this._cacheInput('offsetGtMd', val); }; @Input('fxFlexOffset.gt-lg') set offsetGtLg(val) { this._cacheInput('offsetGtLg', val); }; /* tslint:enable */ constructor(monitor: MediaMonitor, elRef: ElementRef, @Optional() @SkipSelf() protected _container: LayoutDirective, ...
offsetGtMd
identifier_name
flex-offset.ts
/** * @license * Copyright Google LLC 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 */ import { Directive, ElementRef, Input, OnInit, OnChanges, OnDestroy, Optional, SimpleChanges, SkipSe...
; @Input('fxFlexOffset.lt-sm') set offsetLtSm(val) { this._cacheInput('offsetLtSm', val); }; @Input('fxFlexOffset.lt-md') set offsetLtMd(val) { this._cacheInput('offsetLtMd', val); }; @Input('fxFlexOffset.lt-lg') set offsetLtLg(val) { this._cacheInput('offsetLtLg', val); }; @Input('fxFlexOffset.lt-xl') set off...
{ this._cacheInput('offsetXl', val); }
identifier_body
flex-offset.ts
/** * @license * Copyright Google LLC 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 */ import { Directive, ElementRef, Input, OnInit, OnChanges, OnDestroy, Optional, SimpleChanges, SkipSe...
// The flex-direction of this element's flex container. Defaults to 'row'. const isRtl = this._directionality.value === 'rtl'; const layout = this._getFlexFlowDirection(this.parentElement, true); const horizontalLayoutKey = isRtl ? 'margin-right' : 'margin-left'; return isFlowHorizontal(layout) ?...
{ offset = offset + '%'; }
conditional_block
flex-offset.ts
/** * @license * Copyright Google LLC 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 */ import { Directive, ElementRef, Input, OnInit, OnChanges, OnDestroy, Optional, SimpleChanges, SkipSe...
// ********************************************* // Lifecycle Methods // ********************************************* /** * For @Input changes on the current mq activation property, see onMediaQueryChanges() */ ngOnChanges(changes: SimpleChanges) { if (changes['offset'] != null || this._mqActivati...
random_line_split
favoriteDAO.js
'use strict' var mongoose = require('mongoose'); let q = require('q'); let EventModel = require('../model/eventModel'); let FavoriteModel = require('../model/favoriteModel'); class FavoriteDAO { findUser(req) { var defer = q.defer(); let eventos = []; FavoriteModel.find({ userId: req.decoded.id }) .then(resu...
return defer.promise; } } module.exports = new FavoriteDAO();
});
random_line_split
favoriteDAO.js
'use strict' var mongoose = require('mongoose'); let q = require('q'); let EventModel = require('../model/eventModel'); let FavoriteModel = require('../model/favoriteModel'); class FavoriteDAO {
(req) { var defer = q.defer(); let eventos = []; FavoriteModel.find({ userId: req.decoded.id }) .then(result => { result.map(event => { EventModel .findById({ _id: event._doc.eventId }).then(event => { return eventos.push(event); }).then(() => { defer.resolve(eventos); }) }) })...
findUser
identifier_name
favoriteDAO.js
'use strict' var mongoose = require('mongoose'); let q = require('q'); let EventModel = require('../model/eventModel'); let FavoriteModel = require('../model/favoriteModel'); class FavoriteDAO { findUser(req)
findCompany(req) { var defer = q.defer(); FavoriteModel.find({ companyId: req.decoded.id }).then(favorite => { defer.resolve(favorite._doc); }); return defer.promise; } findPlace(req) { var defer = q.defer(); FavoriteModel.find({ userId: req.decoded.id }).then(favorite => { defer.resol...
{ var defer = q.defer(); let eventos = []; FavoriteModel.find({ userId: req.decoded.id }) .then(result => { result.map(event => { EventModel .findById({ _id: event._doc.eventId }).then(event => { return eventos.push(event); }).then(() => { defer.resolve(eventos); }) }) }) ret...
identifier_body
favoriteDAO.js
'use strict' var mongoose = require('mongoose'); let q = require('q'); let EventModel = require('../model/eventModel'); let FavoriteModel = require('../model/favoriteModel'); class FavoriteDAO { findUser(req) { var defer = q.defer(); let eventos = []; FavoriteModel.find({ userId: req.decoded.id }) .then(resu...
else { let saveFavorite = new FavoriteModel({ companyId: body.companyId, eventId: body.eventId, favorite: body.favorite, checkIn: body.check, userId: req.decoded.id, }); saveFavorite .save() .then((result) => { defer.resolve(result); }) .catch((err) => ...
{ FavoriteModel .update({ userId: req.decoded.id }, { $set: { checkIn: body.check, favorite: body.favorite, } }).then((result) => defer.resolve(result)); }
conditional_block
boardSub.js
var app = angular.module('cc98.controllers') app.controller('boardSubCtrl', function ($scope, $http, $stateParams) { $scope.title = $stateParams.title; $scope.doRefresh = function () { var boardRootId = $stateParams.id; $http.get('http://api.cc98.org/board/' + boardRootId + '/subs') .suc...
else if (postCount < 1000) return "label-pink"; else return "label-danger"; } } });
return "label-royal";
random_line_split
app.js
'use strict'; (function (angular,buildfire) { angular.module('fixedTimerPluginContent', ['ngRoute', 'ui.bootstrap', 'ui.tinymce', 'timerModals', 'ui.sortable']) //injected ngRoute for routing .config(['$routeProvider', function ($routeProvider) { $routeProvider .when('/'...
}) .when('/item', { templateUrl: 'templates/timerItem.html', controllerAs: 'ContentItem', controller: 'ContentItemCtrl' }) .when('/item/:itemId', { templateUrl: 'templates/time...
templateUrl: 'templates/home.html', controllerAs: 'ContentHome', controller: 'ContentHomeCtrl'
random_line_split
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup setup( name='pfile-tools', version='0.5.0', author='Nathan Vack', author_email='njvack@wisc.edu',
'dump_pfile_header = pfile_tools.scripts.dump_pfile_header:main', 'anonymize_pfile = pfile_tools.scripts.anonymize_pfile:main' ]} ) # setup( # name='pfile-tools', # version=pfile_tools.VERSION, # packages=setuptools.find_packages(), # data_files=[('', ['distribute...
license='BSD License', url='https://github.com/njvack/pfile-tools', packages=['pfile_tools'], entry_points={ 'console_scripts': [
random_line_split
MenuState.ts
/** * @author Julien Midedji <admin@resamvi.de> * @copyright 2017 Julien Midedji * @license {@link https://github.com/ResamVi/spayle/blob/master/LICENSE MIT License} */ import Const from './Constants'; import Player from './Player'; /** * The menu is displayed after loading and before playing. * T...
moveUp: function() { this.game.add.tween(this.game.camera).to({y: 0}, 1500, Phaser.Easing.Cubic.Out, true); }, moveDown: function() { this.game.add.tween(this.game.camera).to({y: 700}, 1500, Phaser.Easing.Cubic.Out, true); }, update: function() { this.planet.ro...
this.game.state.start('play', false, false); }, this); },
random_line_split
stubconfiguration.py
# shtub - shell command stub # Copyright (C) 2012-2013 Immobilien Scout GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
""" this module provides the class Expectation which extends Execution with a list of answers and the index of the current answer. """ __author__ = 'Alexander Metzner, Michael Gruber, Udo Juettner, Maximilien Riehl, Marcel Wolf' from shtub.answer import Answer from shtub.commandinput import CommandInput cl...
random_line_split
stubconfiguration.py
# shtub - shell command stub # Copyright (C) 2012-2013 Immobilien Scout GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
return result def then(self, answer): """ will append the given answer to the list of answers and return the object itself for invocation chaining. """ self.answers.append(answer) return self def then_answer(self, stdout=None, stderr=None, re...
self.current_answer += 1
conditional_block
stubconfiguration.py
# shtub - shell command stub # Copyright (C) 2012-2013 Immobilien Scout GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
(self): """ returns a string representation of this stub configuration using the method "as_dictionary" """ return 'StubConfiguration %s' % (self.as_dictionary()) @staticmethod def from_dictionary(dictionary): """ returns a new stub configuration object w...
__str__
identifier_name
stubconfiguration.py
# shtub - shell command stub # Copyright (C) 2012-2013 Immobilien Scout GmbH # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) ...
def __eq__(self, other): return self.command_input == other.command_input \ and self.current_answer == other.current_answer \ and self.answers == other.answers def __str__(self): """ returns a string representation of this stub configuration using the meth...
""" sets the given arguments and returns self for invocation chaining """ self.command_input.stdin = stdin return self
identifier_body
test_udpipe.py
#!/usr/bin/python # vim:fileencoding=utf8 from __future__ import unicode_literals import unittest class TestUDPipe(unittest.TestCase): def test_model(self): import ufal.udpipe model = ufal.udpipe.Model.load('test/data/test.model') self.assertTrue(model) tokenizer = model.newToken...
7 . . PUNCT Z:------------- _ 1 punct _ _ """) self.assertFalse(tokenizer.nextSentence(sentence)) if __name__ == '__main__': unittest.main()
3 , , PUNCT Z:------------- _ 6 punct _ _ 4 že že SCONJ J,------------- _ 6 mark _ _ 5 realitě realita NOUN NNFS3-----A---- Case=Dat|Gender=Fem|Negative=Pos|Number=Sing 6 dobj _ _ 6 nepodléhá podléhat VERB VB-S---3P-NA--- Aspect=Imp|Mood=Ind|Negative=Neg|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin|Voice=Act 1 ccomp _ ...
random_line_split
test_udpipe.py
#!/usr/bin/python # vim:fileencoding=utf8 from __future__ import unicode_literals import unittest class TestUDPipe(unittest.TestCase): def
(self): import ufal.udpipe model = ufal.udpipe.Model.load('test/data/test.model') self.assertTrue(model) tokenizer = model.newTokenizer(model.DEFAULT) conlluOutput = ufal.udpipe.OutputFormat.newOutputFormat("conllu") sentence = ufal.udpipe.Sentence() error = ufa...
test_model
identifier_name
test_udpipe.py
#!/usr/bin/python # vim:fileencoding=utf8 from __future__ import unicode_literals import unittest class TestUDPipe(unittest.TestCase):
'__main__': unittest.main()
def test_model(self): import ufal.udpipe model = ufal.udpipe.Model.load('test/data/test.model') self.assertTrue(model) tokenizer = model.newTokenizer(model.DEFAULT) conlluOutput = ufal.udpipe.OutputFormat.newOutputFormat("conllu") sentence = ufal.udpipe.Sentence() ...
identifier_body
test_udpipe.py
#!/usr/bin/python # vim:fileencoding=utf8 from __future__ import unicode_literals import unittest class TestUDPipe(unittest.TestCase): def test_model(self): import ufal.udpipe model = ufal.udpipe.Model.load('test/data/test.model') self.assertTrue(model) tokenizer = model.newToken...
conditional_block
index.js
/* eslint-env mocha */ import path from 'path'; import fs from 'fs'; import assert from 'assert'; import {transformFileSync} from 'babel-core'; function trim(str)
describe('Transpile ES7 async/await to vanilla ES6 Promise chains -', function () { // sometimes 2000 isn't enough when starting up in coverage mode. this.timeout(5000); const fixturesDir = path.join(__dirname, 'fixtures'); fs.readdirSync(fixturesDir).forEach(caseName => { const fixtureDir = path.join(fi...
{ return str.replace(/^\s+|\s+$/, ''); }
identifier_body
index.js
/* eslint-env mocha */ import path from 'path'; import fs from 'fs'; import assert from 'assert'; import {transformFileSync} from 'babel-core'; function
(str) { return str.replace(/^\s+|\s+$/, ''); } describe('Transpile ES7 async/await to vanilla ES6 Promise chains -', function () { // sometimes 2000 isn't enough when starting up in coverage mode. this.timeout(5000); const fixturesDir = path.join(__dirname, 'fixtures'); fs.readdirSync(fixturesDir).forEach(c...
trim
identifier_name
index.js
/* eslint-env mocha */ import path from 'path'; import fs from 'fs'; import assert from 'assert'; import {transformFileSync} from 'babel-core'; function trim(str) { return str.replace(/^\s+|\s+$/, ''); } describe('Transpile ES7 async/await to vanilla ES6 Promise chains -', function () { // sometimes 2000 isn't e...
it(caseName.split('-').join(' '), () => { const actual = transformFileSync(actualPath).code; const expected = fs.readFileSync( path.join(fixtureDir, 'expected.js') ).toString(); assert.equal(trim(actual), trim(expected)); }); }); });
{ return; }
conditional_block
index.js
/* eslint-env mocha */ import path from 'path'; import fs from 'fs';
function trim(str) { return str.replace(/^\s+|\s+$/, ''); } describe('Transpile ES7 async/await to vanilla ES6 Promise chains -', function () { // sometimes 2000 isn't enough when starting up in coverage mode. this.timeout(5000); const fixturesDir = path.join(__dirname, 'fixtures'); fs.readdirSync(fixturesD...
import assert from 'assert'; import {transformFileSync} from 'babel-core';
random_line_split
bigint_extensions.rs
use ramp::int::Int; use core::convert::From; const DEFAULT_BUCKET_SIZE: usize = 5; pub trait ModPow<T, K> { fn mod_pow(&self, exp: &T, m: &K) -> Self; fn mod_pow_k(&self, exp: &T, m: &K, k: usize) -> Self; } impl ModPow<Int, Int> for Int { fn mod_pow(&self, exp: &Int, m: &Int) -> Int { self.mod_...
pub trait ModInverse<T> : Sized { fn mod_inverse(&self, n: &T) -> Option<Self>; } impl ModInverse<Int> for Int { fn mod_inverse(&self, n: &Int) -> Option<Int> { let mut u1 = Int::one(); let mut u3 = (*self).clone(); let mut v1 = Int::zero(); let mut v3 = (*n).clone(); ...
{ let mut digits = Vec::new(); let mut n = (*e).clone(); let base = Int::from(b); while n > Int::zero() { digits.push(usize::from(&(&n % &base))); n = &n / &base; } digits }
identifier_body
bigint_extensions.rs
use ramp::int::Int; use core::convert::From; const DEFAULT_BUCKET_SIZE: usize = 5; pub trait ModPow<T, K> { fn mod_pow(&self, exp: &T, m: &K) -> Self; fn mod_pow_k(&self, exp: &T, m: &K, k: usize) -> Self; } impl ModPow<Int, Int> for Int { fn mod_pow(&self, exp: &Int, m: &Int) -> Int { self.mod_...
(a: i64, b: i64) { let big_a = Int::from(a); let big_b = Int::from(b); assert_eq!(big_a.mod_inverse(&big_b), None); } check(7, 26, 15); check(37, 216, 181); check(17, 3120, 2753); check(7, -72, 31); check_none(0, 21); check_n...
check_none
identifier_name
bigint_extensions.rs
use ramp::int::Int; use core::convert::From; const DEFAULT_BUCKET_SIZE: usize = 5; pub trait ModPow<T, K> { fn mod_pow(&self, exp: &T, m: &K) -> Self; fn mod_pow_k(&self, exp: &T, m: &K, k: usize) -> Self; } impl ModPow<Int, Int> for Int { fn mod_pow(&self, exp: &Int, m: &Int) -> Int { self.mod_...
#[test] fn test_bigint_mod_pow() { fn check(b: &Int, e: &Int, m: &Int, r: &Int) { assert_eq!(b.mod_pow(&e, &m), *r); } fn check_i64(b: i64, e: i64, m: i64, r: i64) { let big_b = Int::from(b); let big_e = Int::from(e); let big_m = Int::from...
use rand; use test::Bencher;
random_line_split
bigint_extensions.rs
use ramp::int::Int; use core::convert::From; const DEFAULT_BUCKET_SIZE: usize = 5; pub trait ModPow<T, K> { fn mod_pow(&self, exp: &T, m: &K) -> Self; fn mod_pow_k(&self, exp: &T, m: &K, k: usize) -> Self; } impl ModPow<Int, Int> for Int { fn mod_pow(&self, exp: &Int, m: &Int) -> Int { self.mod_...
else { u1 }; Some(inv) } } #[cfg(test)] mod tests { use super::*; use ramp::{ Int, RandomInt }; use rand; use test::Bencher; #[test] fn test_bigint_mod_pow() { fn check(b: &Int, e: &Int, m: &Int, r: &Int) { assert_eq!(b.mod_pow(&e, &m), ...
{ n - u1 }
conditional_block
file_info.rs
extern crate libc; use std::mem; use crate::libproc::helpers; use crate::libproc::proc_pid::{ListPIDInfo, PidInfoFlavor}; #[cfg(target_os = "macos")] use self::libc::{c_int, c_void}; // this extern block links to the libproc library // Original signatures of functions can be found at http://opensource.apple.com/sou...
<T: PIDFDInfo>(pid: i32, fd: i32) -> Result<T, String> { let flavor = T::flavor() as i32; let buffer_size = mem::size_of::<T>() as i32; let mut pidinfo = T::default(); let buffer_ptr = &mut pidinfo as *mut _ as *mut c_void; let ret: i32; unsafe { ret = proc_pidfdinfo(pid, fd, flavor, bu...
pidfdinfo
identifier_name