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
about.tsx
import '../src/bootstrap'; // --- Post bootstrap ----- import React from 'react'; import Button from '@material-ui/core/Button'; import Typography from '@material-ui/core/Typography'; import { makeStyles } from '@material-ui/styles'; import Link from 'next/link'; const useStyles = makeStyles(theme => ({ root: { ...
export default About;
{ const classes = useStyles({}); return ( <div className={classes.root}> <Typography variant="h4" gutterBottom> Material-UI </Typography> <Typography variant="subtitle1" gutterBottom> about page </Typography> <Typography gutterBottom> <Link href="/"> ...
identifier_body
_hasidof.py
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # 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 2 of the License, or # (at you...
_ = glocale.translation.gettext #------------------------------------------------------------------------- # # GRAMPS modules # #------------------------------------------------------------------------- from .. import HasGrampsId #------------------------------------------------------------------------- # # HasIdOf #...
# # Standard Python modules # #------------------------------------------------------------------------- from ....const import GRAMPS_LOCALE as glocale
random_line_split
_hasidof.py
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # 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 2 of the License, or # (at you...
(HasGrampsId): """Rule that checks for a person with a specific GRAMPS ID""" name = _('Person with <Id>') description = _("Matches person with a specified Gramps ID")
HasIdOf
identifier_name
_hasidof.py
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2002-2006 Donald N. Allingham # # 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 2 of the License, or # (at you...
"""Rule that checks for a person with a specific GRAMPS ID""" name = _('Person with <Id>') description = _("Matches person with a specified Gramps ID")
identifier_body
utils.py
# -*- coding: utf-8 -*- # gedit CodeCompletion plugin # Copyright (C) 2011 Fabio Zendhi Nagao # # 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 o...
def get_document(piter): a = piter.copy() b = piter.copy() while True: if not a.backward_char(): break while True: if not b.forward_char(): break return a.get_visible_text(b) # ex:ts=4:et:
word = a.get_visible_text(b) return a, word
random_line_split
utils.py
# -*- coding: utf-8 -*- # gedit CodeCompletion plugin # Copyright (C) 2011 Fabio Zendhi Nagao # # 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 o...
def get_document(piter): a = piter.copy() b = piter.copy() while True: if not a.backward_char(): break while True: if not b.forward_char(): break return a.get_visible_text(b) # ex:ts=4:et:
a = piter.copy() b = piter.copy() while True: if a.starts_line(): break a.backward_char() ch = a.get_char() #if not (ch.isalnum() or ch in ['_', ':', '.', '-', '>']): if not (ch.isalnum() or ch in "_:.->"): a.forward_char() ...
identifier_body
utils.py
# -*- coding: utf-8 -*- # gedit CodeCompletion plugin # Copyright (C) 2011 Fabio Zendhi Nagao # # 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 o...
(piter): a = piter.copy() b = piter.copy() while True: if a.starts_line(): break a.backward_char() ch = a.get_char() #if not (ch.isalnum() or ch in ['_', ':', '.', '-', '>']): if not (ch.isalnum() or ch in "_:.->"): a.for...
get_word
identifier_name
utils.py
# -*- coding: utf-8 -*- # gedit CodeCompletion plugin # Copyright (C) 2011 Fabio Zendhi Nagao # # 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 o...
while True: if not b.forward_char(): break return a.get_visible_text(b) # ex:ts=4:et:
if not a.backward_char(): break
conditional_block
settings.py
""" Django settings for template project. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/dev/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) i...
'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', ...
'context_processors': [ # default 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug',
random_line_split
castingsource0.rs
// Supprime tous les avertissements relatifs aux dépassements // de capacité (e.g. une variable de type u8 ne peut pas // contenir plus qu'une variable de type u16). #![allow(overflowing_literals)] fn main() {
let decimal = 65.4321_f32; // Erreur! La conversion implicite n'est pas supportée. // let integer: u8 = decimal; // FIXME ^ Décommentez/Commentez cette ligne pour voir // le message d'erreur apparaître/disparaître. // Conversion explicite. let integer = decimal as u8; let character = ...
identifier_body
castingsource0.rs
// Supprime tous les avertissements relatifs aux dépassements // de capacité (e.g. une variable de type u8 ne peut pas // contenir plus qu'une variable de type u16). #![allow(overflowing_literals)] fn ma
{ let decimal = 65.4321_f32; // Erreur! La conversion implicite n'est pas supportée. // let integer: u8 = decimal; // FIXME ^ Décommentez/Commentez cette ligne pour voir // le message d'erreur apparaître/disparaître. // Conversion explicite. let integer = decimal as u8; let character...
in()
identifier_name
castingsource0.rs
// Supprime tous les avertissements relatifs aux dépassements // de capacité (e.g. une variable de type u8 ne peut pas // contenir plus qu'une variable de type u16). #![allow(overflowing_literals)] fn main() { let decimal = 65.4321_f32; // Erreur! La conversion implicite n'est pas supportée. // let inte...
}
println!(" 232 as a i8 is : {}", 232 as i8);
random_line_split
Downloader.py
import pykka from rx.subjects import * from TorrentPython.DownloadManager import * from TorrentPython.RoutingTable import * class DownloaderActor(pykka.ThreadingActor): def __init__(self, downloader): super(DownloaderActor, self).__init__() self.downloader = downloader self.download_mana...
def __del__(self): self.destroy() def destroy(self): if self.actor.is_alive(): self.actor.stop() def start(self): self.actor.tell({'func': lambda x: x.from_start()}) def stop(self): self.actor.tell({'func': lambda x: x.from_stop()})
super(Downloader, self).__init__() self.client_id = client_id self.metainfo = metainfo self.path = path self.routing_table = routing_table or RoutingTable.INITIAL_ROUTING_TABLE self.actor = DownloaderActor.start(self)
identifier_body
Downloader.py
import pykka from rx.subjects import * from TorrentPython.DownloadManager import * from TorrentPython.RoutingTable import *
class DownloaderActor(pykka.ThreadingActor): def __init__(self, downloader): super(DownloaderActor, self).__init__() self.downloader = downloader self.download_manager = DownloadManager(downloader) def on_receive(self, message): return message.get('func')(self) def from_st...
random_line_split
Downloader.py
import pykka from rx.subjects import * from TorrentPython.DownloadManager import * from TorrentPython.RoutingTable import * class
(pykka.ThreadingActor): def __init__(self, downloader): super(DownloaderActor, self).__init__() self.downloader = downloader self.download_manager = DownloadManager(downloader) def on_receive(self, message): return message.get('func')(self) def from_start(self): pa...
DownloaderActor
identifier_name
Downloader.py
import pykka from rx.subjects import * from TorrentPython.DownloadManager import * from TorrentPython.RoutingTable import * class DownloaderActor(pykka.ThreadingActor): def __init__(self, downloader): super(DownloaderActor, self).__init__() self.downloader = downloader self.download_mana...
def start(self): self.actor.tell({'func': lambda x: x.from_start()}) def stop(self): self.actor.tell({'func': lambda x: x.from_stop()})
self.actor.stop()
conditional_block
Apartment.js
import React from 'react' import ApartmentTable from './ApartmentListContainer' import TextFieldForm from './ApartmentForm' import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider' import {Tabs, Tab} from 'material-ui/Tabs' import Paper from 'material-ui/Paper' import AppBar from 'material-ui/AppBar' import '...
</div> </MuiThemeProvider> ) export default Apartment
</div> </Tab> </Tabs>
random_line_split
complicajda.py
# 1. del: funkcije #gender: female = 2, male = 0 def
(gender): if gender == "male": return 0 else: return 2 #age: 0-100 if age < 10 --> 0, 11 < age < 20 --> 5, 21 < age < 35 --> 2, 36 < age < 50 --> 4, 50+ --> 1 def calculate_score_for_age(age): if (age > 11 and age <= 20) or (age > 36 and age <= 50): return 5 elif age > 20 and age <= 35: return 2 elif...
calculate_score_for_gender
identifier_name
complicajda.py
# 1. del: funkcije #gender: female = 2, male = 0 def calculate_score_for_gender(gender): if gender == "male": return 0 else: return 2 #age: 0-100 if age < 10 --> 0, 11 < age < 20 --> 5, 21 < age < 35 --> 2, 36 < age < 50 --> 4, 50+ --> 1 def calculate_score_for_age(age): if (age > 11 and age <= 20) or (age >...
elif money_have > 0.0 and money_have <= 500.0: return 3.0 elif money_have > 500.0 and money_have <= 3000.0: return 2.0 else: return 0.0 # ---ZAKAJ MI NE PREPOZNA POZITIVNIH FLOATING NUMBERS IN NOBENE NEGATIVE (INTEGER ALI FLOATING NEGATIVNE) KOT STEVILKO? # -->PRED RAW INPUT MORAS DAT FLOAT, CE NI CELA ST...
return 4.0
conditional_block
complicajda.py
# 1. del: funkcije #gender: female = 2, male = 0 def calculate_score_for_gender(gender): if gender == "male": return 0 else: return 2 #age: 0-100 if age < 10 --> 0, 11 < age < 20 --> 5, 21 < age < 35 --> 2, 36 < age < 50 --> 4, 50+ --> 1 def calculate_score_for_age(age): if (age > 11 and age <= 20) or (age >...
elif money_have > 0.0 and money_have <= 500.0: return 3.0 elif money_have > 500.0 and money_have <= 3000.0: return 2.0 else: return 0.0 # ---ZAKAJ MI NE PREPOZNA POZITIVNIH FLOATING NUMBERS IN NOBENE NEGATIVE (INTEGER ALI FLOATING NEGATIVNE) KOT STEVILKO? # -->PRED RAW INPUT MORAS DAT FLOAT, CE NI CELA STE...
return 5.0 elif money_have > (-5000.0) and money_have <= 0.0: return 4.0
random_line_split
complicajda.py
# 1. del: funkcije #gender: female = 2, male = 0 def calculate_score_for_gender(gender): if gender == "male": return 0 else: return 2 #age: 0-100 if age < 10 --> 0, 11 < age < 20 --> 5, 21 < age < 35 --> 2, 36 < age < 50 --> 4, 50+ --> 1 def calculate_score_for_age(age): if (age > 11 and age <= 20) or (age >...
# 2. del: sestevek funkcij def calculate_score(gender, age, status, ignorance, money_have, money_want, rl_friends, children): result = calculate_score_for_gender(gender) result += calculate_score_for_age(age) result += calculate_score_for_status(status) result += calculate_score_for_ignorance(ignorance) resul...
if children == 0: return 1 elif children == 1 and children == 2: return 2 elif children == 3: return 3 elif children == 4: return 4 else: return 5
identifier_body
projects.js
var mongoose = require('mongoose'); var rooms = require('./rooms'); mongoose.connect('mongodb://localhost:27017/rpgd'); var RoomSchema = require('mongoose').model('Room').schema; var Schema = mongoose.Schema; var ObjectId = Schema.ObjectId; // Setup Database scheme var ProjectSchema = new Schema({ name: S...
default: false }, meta: { votes: Number, favs: Number }, rooms: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Room' }] }); var User = mongoose.model('User', UserSchema); var Project = mongoose.model('Project', ProjectSchema); var handleError = function (err)...
type: Boolean,
random_line_split
fb_oauth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Facebook OAuth interface.""" # System imports import json import logging try: from urllib import quote_plus except ImportError: from urllib.parse import quote_plus import oauth2 as oauth from django.conf import settings # Project imports from .base_auth import...
consumer = oauth.Consumer(key=settings.FACEBOOK_APP_ID, secret=settings.FACEBOOK_APP_SECRET) class FacebookOAuth(Base3rdPartyAuth): PROVIDER = 'facebook' BACKEND = 'draalcore.auth.backend.FacebookOAuthBackend' def get_authorize_url(self, request): """Request and prepare URL for login using Face...
FACEBOOK_REQUEST_TOKEN_URL = 'https://www.facebook.com/dialog/oauth' FACEBOOK_ACCESS_TOKEN_URL = 'https://graph.facebook.com/oauth/access_token' FACEBOOK_CHECK_AUTH = 'https://graph.facebook.com/me'
random_line_split
fb_oauth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Facebook OAuth interface.""" # System imports import json import logging try: from urllib import quote_plus except ImportError: from urllib.parse import quote_plus import oauth2 as oauth from django.conf import settings # Project imports from .base_auth import...
(self, response): return self.get_user({ 'username': 'fb-{}'.format(response['id']), 'email': response['email'], 'first_name': response['first_name'], 'last_name': response['last_name'], }) def authorize(self, request): base_url = '{}?client_...
set_user
identifier_name
fb_oauth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Facebook OAuth interface.""" # System imports import json import logging try: from urllib import quote_plus except ImportError: from urllib.parse import quote_plus import oauth2 as oauth from django.conf import settings # Project imports from .base_auth import...
self.login_failure()
user_data = json.loads(content) # Authenticate user logger.debug(user_data) user = self.set_user(user_data) return self.authenticate(request, user.username)
conditional_block
fb_oauth.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Facebook OAuth interface.""" # System imports import json import logging try: from urllib import quote_plus except ImportError: from urllib.parse import quote_plus import oauth2 as oauth from django.conf import settings # Project imports from .base_auth import...
def authorize(self, request): base_url = '{}?client_id={}&redirect_uri={}&client_secret={}&code={}' request_url = base_url.format(FACEBOOK_ACCESS_TOKEN_URL, settings.FACEBOOK_APP_ID, self.get_callback_url(), settings.FACEBOOK_APP_SECRET, ...
return self.get_user({ 'username': 'fb-{}'.format(response['id']), 'email': response['email'], 'first_name': response['first_name'], 'last_name': response['last_name'], })
identifier_body
htmlvideoelement.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::HTMLVideoElementBinding; use dom::bindings::js::Root; use dom::document::Doc...
{ htmlmediaelement: HTMLMediaElement } impl HTMLVideoElement { fn new_inherited(localName: DOMString, prefix: Option<DOMString>, document: &Document) -> HTMLVideoElement { HTMLVideoElement { htmlmediaelement: HTMLMediaElement::new_inherited(localName, prefix, document) ...
HTMLVideoElement
identifier_name
htmlvideoelement.rs
use dom::bindings::codegen::Bindings::HTMLVideoElementBinding; use dom::bindings::js::Root; use dom::document::Document; use dom::htmlmediaelement::HTMLMediaElement; use dom::node::Node; use util::str::DOMString; #[dom_struct] pub struct HTMLVideoElement { htmlmediaelement: HTMLMediaElement } impl HTMLVideoEleme...
/* 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/. */
random_line_split
cmac.rs
// Copyright 2020 The Tink-Rust Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
if tag_size > MAX_TAG_LENGTH_IN_BYTES { return Err("Tag size too long".into()); } Ok(()) }
{ return Err("Tag size too short".into()); }
conditional_block
cmac.rs
// Copyright 2020 The Tink-Rust Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
return Err("Tag size too short".into()); } if tag_size > MAX_TAG_LENGTH_IN_BYTES { return Err("Tag size too long".into()); } Ok(()) }
random_line_split
cmac.rs
// Copyright 2020 The Tink-Rust Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
(&self, data: &[u8]) -> Result<Vec<u8>, TinkError> { self.prf.compute_prf(data, self.tag_size) } } /// Validate the parameters for an AES-CMAC against the recommended parameters. pub fn validate_cmac_params(key_size: usize, tag_size: usize) -> Result<(), TinkError> { if key_size != RECOMMENDED_CMAC_KEY...
compute_mac
identifier_name
cmac.rs
// Copyright 2020 The Tink-Rust Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
{ if key_size != RECOMMENDED_CMAC_KEY_SIZE_IN_BYTES { return Err(format!( "Only {} sized keys are allowed with Tink's AES-CMAC", RECOMMENDED_CMAC_KEY_SIZE_IN_BYTES ) .into()); } if tag_size < MIN_TAG_LENGTH_IN_BYTES { return Err("Tag size too short".in...
identifier_body
011.py
def format(): text = "" stopword = "" while True: line = raw_input() if line.strip() == stopword: break text += "%s\n" % line text_arr = text.split('\n') global arr arr = [[] for _ in range(21)] for i in range(21): arr[i].append(text_arr[i]) ...
prod = arr[i][0][j]*arr[i-1][0][j+1]*arr[i-2][0][j+2]*arr[i-3][0][j+3] if prod > greatest: greatest = prod print greatest main()
random_line_split
011.py
def format(): text = "" stopword = "" while True: line = raw_input() if line.strip() == stopword: break text += "%s\n" % line text_arr = text.split('\n') global arr arr = [[] for _ in range(21)] for i in range(21): arr[i].append(text_arr[i]) ...
print greatest main()
greatest = prod
conditional_block
011.py
def format(): text = "" stopword = "" while True: line = raw_input() if line.strip() == stopword: break text += "%s\n" % line text_arr = text.split('\n') global arr arr = [[] for _ in range(21)] for i in range(21): arr[i].append(text_arr[i]) ...
main()
format() global arr greatest = 0 for i in range(20): for j in range(16): # horizontal products prod = arr[i][0][j]*arr[i][0][j+1]*arr[i][0][j+2]*arr[i][0][j+3] if prod > greatest: greatest = prod # vertical products ...
identifier_body
011.py
def format(): text = "" stopword = "" while True: line = raw_input() if line.strip() == stopword: break text += "%s\n" % line text_arr = text.split('\n') global arr arr = [[] for _ in range(21)] for i in range(21): arr[i].append(text_arr[i]) ...
(): format() global arr greatest = 0 for i in range(20): for j in range(16): # horizontal products prod = arr[i][0][j]*arr[i][0][j+1]*arr[i][0][j+2]*arr[i][0][j+3] if prod > greatest: greatest = prod # vertical pro...
main
identifier_name
home_page.js
// DOM Manipulation Challenge // I worked on this challenge with: Austin Dorff. // Add your JavaScript calls to this page: // Release 0: // Set up // Release 1: var div_r_1 = document.getElementById("release-0"); div_r_1.className = "done"; // Release 2: var div_r_2 = document.getElementById('release-1'); div_...
// Release 6: var template = document.getElementById('hidden'); document.body.appendChild(template.content.cloneNode(true));
{ div_r_5[i].style.fontSize = "2em"; }
conditional_block
home_page.js
// DOM Manipulation Challenge // I worked on this challenge with: Austin Dorff. // Add your JavaScript calls to this page: // Release 0: // Set up // Release 1: var div_r_1 = document.getElementById("release-0"); div_r_1.className = "done"; // Release 2: var div_r_2 = document.getElementById('release-1'); div_...
// Release 5: var div_r_5 = document.getElementsByClassName("release-4"); for (var i = 0; i < div_r_5.length; i++) { div_r_5[i].style.fontSize = "2em"; } // Release 6: var template = document.getElementById('hidden'); document.body.appendChild(template.content.cloneNode(true));
div_r_4.style.backgroundColor = "#955251";
random_line_split
ipset.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015 Red Hat, Inc. # # Authors: # Thomas Woerner <twoerner@redhat.com> # # 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 2 of the License...
return ret def check_name(self, name): if len(name) > IPSET_MAXNAMELEN: raise FirewallError(INVALID_NAME, "ipset name '%s' is not valid" % name) def supported_types(self): ret = { } output = "" try: output = self._...
" ".join(_args), ret))
random_line_split
ipset.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015 Red Hat, Inc. # # Authors: # Thomas Woerner <twoerner@redhat.com> # # 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 2 of the License...
(self, set_name, type_name, options=None): self.check_name(set_name) self.check_type(type_name) args = [ "create", set_name, type_name ] if options: for k,v in options.items(): args.append(k) if v != "": args.append(v) ...
create
identifier_name
ipset.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015 Red Hat, Inc. # # Authors: # Thomas Woerner <twoerner@redhat.com> # # 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 2 of the License...
def check_ipset_name(ipset): if len(ipset) > IPSET_MAXNAMELEN: return False return True
def __init__(self): self._command = COMMANDS["ipset"] def __run(self, args): # convert to string list _args = ["%s" % item for item in args] log.debug2("%s: %s %s", self.__class__, self._command, " ".join(_args)) (status, ret) = runProg(self._command, _args) if statu...
identifier_body
ipset.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015 Red Hat, Inc. # # Authors: # Thomas Woerner <twoerner@redhat.com> # # 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 2 of the License...
return ret def check_type(self, type_name): if len(type_name) > IPSET_MAXNAMELEN or type_name not in IPSET_TYPES: raise FirewallError(INVALID_TYPE, "ipset type name '%s' is not valid" % type_name) def create(self, set_name, type_name, options=None):...
if in_types: splits = line.strip().split(None, 2) ret[splits[0]] = splits[2] if line.startswith("Supported set types:"): in_types = True
conditional_block
autowrapped_static_text.py
# -*- coding: utf-8 -*- import wx from copy import copy sWhitespace = ' \t\n' def SplitAndKeep(string, splitchars = " \t\n"): substrs = [] i = 0 while len(string) > 0: if string[i] in splitchars: substrs.append(string[:i]) substrs.append(string[i]) string = string[i+1:] i = 0 else: i += 1 ...
currentLine.append('\n') lines.extend(currentLine) currentLine = [nextPiece] currentString = nextPiece else: currentString += nextPiece currentLine.append(nextPiece) lines.extend(currentLine) line = "".join(lines) super(AutowrappedStaticText, self).SetLabel(line) self.Re...
pieces = pieces[1:]
conditional_block
autowrapped_static_text.py
# -*- coding: utf-8 -*- import wx from copy import copy sWhitespace = ' \t\n' def SplitAndKeep(string, splitchars = " \t\n"): substrs = [] i = 0 while len(string) > 0: if string[i] in splitchars: substrs.append(string[:i]) substrs.append(string[i]) string = string[i+1:] i = 0 else: i += 1 ...
"""A StaticText-like widget which implements word wrapping.""" def __init__(self, *args, **kwargs): wx.StaticText.__init__(self, *args, **kwargs) self.label = super(AutowrappedStaticText, self).GetLabel() self.pieces = SplitAndKeep(self.label, sWhitespace) self.Bind(wx.EVT_SIZE, self.OnSize) self.lastWrap = ...
identifier_body
autowrapped_static_text.py
# -*- coding: utf-8 -*- import wx from copy import copy sWhitespace = ' \t\n' def SplitAndKeep(string, splitchars = " \t\n"): substrs = [] i = 0 while len(string) > 0: if string[i] in splitchars: substrs.append(string[:i]) substrs.append(string[i]) string = string[i+1:] i = 0 else: i += 1 ...
def SetLabel(self, newLabel): """Store the new label and recalculate the wrapped version.""" self.label = newLabel self.pieces = SplitAndKeep(self.label, sWhitespace) self.Wrap() def GetLabel(self): """Returns the label (unwrapped).""" return self.label def Wrap(self): """Wraps the words in label...
self.pieces = SplitAndKeep(self.label, sWhitespace) self.Bind(wx.EVT_SIZE, self.OnSize) self.lastWrap = None self.Wrap()
random_line_split
autowrapped_static_text.py
# -*- coding: utf-8 -*- import wx from copy import copy sWhitespace = ' \t\n' def
(string, splitchars = " \t\n"): substrs = [] i = 0 while len(string) > 0: if string[i] in splitchars: substrs.append(string[:i]) substrs.append(string[i]) string = string[i+1:] i = 0 else: i += 1 if i >= len(string): substrs.append(string) break return substrs class AutowrappedS...
SplitAndKeep
identifier_name
shadowroot.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::Shado...
/// Add a stylesheet owned by `owner` to the list of shadow root sheets, in the /// correct tree position. #[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily. pub fn add_stylesheet(&self, owner: &Element, sheet: Arc<Stylesheet>) { let stylesheets = &mut self.author_st...
{ let stylesheets = &self.author_styles.borrow().stylesheets; stylesheets .get(index) .and_then(|s| s.owner.upcast::<Node>().get_cssom_stylesheet()) }
identifier_body
shadowroot.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::Shado...
(&self) -> Option<DomRoot<Element>> { //XXX get retargeted focused element None } pub fn stylesheet_count(&self) -> usize { self.author_styles.borrow().stylesheets.len() } pub fn stylesheet_at(&self, index: usize) -> Option<DomRoot<CSSStyleSheet>> { let stylesheets = &s...
get_focused_element
identifier_name
shadowroot.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::Shado...
, None => None, } } // https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint fn ElementsFromPoint(&self, x: Finite<f64>, y: Finite<f64>) -> Vec<DomRoot<Element>> { // Return the result of running the retargeting algorithm with context object // and the orig...
{ let retargeted_node = self.upcast::<Node>().retarget(e.upcast::<Node>()); retargeted_node .downcast::<Element>() .map(|n| DomRoot::from_ref(n)) }
conditional_block
shadowroot.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::dom::bindings::cell::DomRefCell; use crate::dom::bindings::codegen::Bindings::ShadowRootBinding::Shado...
pub fn stylesheet_count(&self) -> usize { self.author_styles.borrow().stylesheets.len() } pub fn stylesheet_at(&self, index: usize) -> Option<DomRoot<CSSStyleSheet>> { let stylesheets = &self.author_styles.borrow().stylesheets; stylesheets .get(index) .and_...
random_line_split
selectors.py
''' @since: 2015-01-07 @author: moschlar ''' import sqlalchemy.types as sqlat import tw2.core as twc
from sauce.widgets.widgets import (LargeMixin, SmallMixin, AdvancedWysihtml5, MediumTextField, SmallTextField, CalendarDateTimePicker) from sauce.widgets.validators import AdvancedWysihtml5BleachValidator class ChosenPropertyMultipleSelectField(LargeMixin, twjc.ChosenMultipleSelectField, sw.PropertyMultipleSelect...
import tw2.bootstrap.forms as twb import tw2.jqplugins.chosen.widgets as twjc import sprox.widgets.tw2widgets.widgets as sw from sprox.sa.widgetselector import SAWidgetSelector from sprox.sa.validatorselector import SAValidatorSelector, Email
random_line_split
selectors.py
''' @since: 2015-01-07 @author: moschlar ''' import sqlalchemy.types as sqlat import tw2.core as twc import tw2.bootstrap.forms as twb import tw2.jqplugins.chosen.widgets as twjc import sprox.widgets.tw2widgets.widgets as sw from sprox.sa.widgetselector import SAWidgetSelector from sprox.sa.validatorselector import ...
class ChosenPropertySingleSelectField(SmallMixin, twjc.ChosenSingleSelectField, sw.PropertySingleSelectField): search_contains = True class MyWidgetSelector(SAWidgetSelector): '''Custom WidgetSelector for SAUCE Primarily uses fields from tw2.bootstrap.forms and tw2.jqplugins.chosen. ''' text_...
return value
conditional_block
selectors.py
''' @since: 2015-01-07 @author: moschlar ''' import sqlalchemy.types as sqlat import tw2.core as twc import tw2.bootstrap.forms as twb import tw2.jqplugins.chosen.widgets as twjc import sprox.widgets.tw2widgets.widgets as sw from sprox.sa.widgetselector import SAWidgetSelector from sprox.sa.validatorselector import ...
(self, value, state=None): value = super(ChosenPropertyMultipleSelectField, self)._validate(value, state) if self.required and not value: raise twc.ValidationError('Please select at least one value') else: return value class ChosenPropertySingleSelectField(SmallMixin, t...
_validate
identifier_name
selectors.py
''' @since: 2015-01-07 @author: moschlar ''' import sqlalchemy.types as sqlat import tw2.core as twc import tw2.bootstrap.forms as twb import tw2.jqplugins.chosen.widgets as twjc import sprox.widgets.tw2widgets.widgets as sw from sprox.sa.widgetselector import SAWidgetSelector from sprox.sa.validatorselector import ...
class ChosenPropertySingleSelectField(SmallMixin, twjc.ChosenSingleSelectField, sw.PropertySingleSelectField): search_contains = True class MyWidgetSelector(SAWidgetSelector): '''Custom WidgetSelector for SAUCE Primarily uses fields from tw2.bootstrap.forms and tw2.jqplugins.chosen. ''' text_...
search_contains = True def _validate(self, value, state=None): value = super(ChosenPropertyMultipleSelectField, self)._validate(value, state) if self.required and not value: raise twc.ValidationError('Please select at least one value') else: return value
identifier_body
android_policy_writer_unittest.py
#!/usr/bin/env python # Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. '''Unit tests for writers.android_policy_writer''' import os import sys if __name__ == '__main__': sys.path.append(os.path.join(o...
if __name__ == '__main__': unittest.main()
policy = { 'name': '_policy_name', 'caption': '_policy_caption', 'desc': '_policy_desc_first.\nadditional line', 'items': [{ 'caption': '_caption1', 'value': '_value1', }, { 'caption': '_caption2', 'value': '...
identifier_body
android_policy_writer_unittest.py
#!/usr/bin/env python # Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. '''Unit tests for writers.android_policy_writer''' import os import sys if __name__ == '__main__': sys.path.append(os.path.join(o...
(self): # Test an example policy without items. policy = { 'name': '_policy_name', 'caption': '_policy_caption', 'desc': '_policy_desc_first.\nadditional line', 'items': [{ 'caption': '_caption1', 'value': '_value1', }, { ...
testPolicyWithItems
identifier_name
android_policy_writer_unittest.py
#!/usr/bin/env python # Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. '''Unit tests for writers.android_policy_writer''' import os import sys if __name__ == '__main__': sys.path.append(os.path.join(o...
}, { 'caption': '_caption2', 'value': '_value2', }, { 'caption': '_caption3', 'value': '_value3', 'supported_on': [{ 'platform': 'win' }, { ...
'value': '_value1',
random_line_split
android_policy_writer_unittest.py
#!/usr/bin/env python # Copyright (c) 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. '''Unit tests for writers.android_policy_writer''' import os import sys if __name__ == '__main__':
import unittest from xml.dom import minidom from writers import writer_unittest_common from writers import android_policy_writer class AndroidPolicyWriterUnittest(writer_unittest_common.WriterUnittestCommon): '''Unit tests to test assumptions in Android Policy Writer''' def testPolicyWithoutItems(self): #...
sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..'))
conditional_block
connector.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::hosts::replace_host; use crate::http_loader::Decoder; use flate2::read::GzDecoder; use hyper::body::Pa...
else { // Hyper is done downloading but we still have uncompressed data match self.decoder { Decoder::Gzip(Some(ref mut decoder)) => { let mut buf = vec![0; BUF_SIZE]; let len = decoder.read(&mut buf...
{ match self.decoder { Decoder::Plain => Some(chunk), Decoder::Gzip(Some(ref mut decoder)) => { let mut buf = vec![0; BUF_SIZE]; decoder.get_mut().get_mut().extend(chunk.as_ref()); ...
conditional_block
connector.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::hosts::replace_host; use crate::http_loader::Decoder; use flate2::read::GzDecoder; use hyper::body::Pa...
let cert = x509::X509::from_pem(cert.as_bytes()).unwrap(); ssl_connector_builder .cert_store_mut() .add_cert(cert) .or_else(|e| { let v: Option<Option<&str>> = e.errors().iter().nth(0).map(|e| e.reason()); if...
loop { let token = "-----END CERTIFICATE-----"; if let Some(index) = certs.find(token) { let (cert, rest) = certs.split_at(index + token.len()); certs = rest;
random_line_split
connector.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::hosts::replace_host; use crate::http_loader::Decoder; use flate2::read::GzDecoder; use hyper::body::Pa...
(&mut self) -> Result<Async<Option<Self::Data>>, Self::Error> { self.body.poll_data() } } impl Stream for WrappedBody { type Item = <Body as Stream>::Item; type Error = <Body as Stream>::Error; fn poll(&mut self) -> Result<Async<Option<Self::Item>>, Self::Error> { self.body.poll().map(|...
poll_data
identifier_name
connector.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::hosts::replace_host; use crate::http_loader::Decoder; use flate2::read::GzDecoder; use hyper::body::Pa...
} pub type Connector = HttpsConnector<HttpConnector>; pub struct WrappedBody { pub body: Body, pub decoder: Decoder, } impl WrappedBody { pub fn new(body: Body) -> Self { Self::new_with_decoder(body, Decoder::Plain) } pub fn new_with_decoder(body: Body, decoder: Decoder) -> Self { ...
{ // Perform host replacement when making the actual TCP connection. let mut new_dest = dest.clone(); let addr = replace_host(dest.host()); new_dest.set_host(&*addr).unwrap(); self.inner.connect(new_dest) }
identifier_body
jwc-service.ts
import {Injectable} from '@angular/core'; import {Api} from './api'; import 'rxjs/Rx'; import {Headers, RequestOptions} from '@angular/http'; import {Holder} from './holder'; @Injectable() export class
{ private headers: Headers = new Headers(); private requestOption: RequestOptions = new RequestOptions({headers: this.headers, withCredentials: true}); constructor(private api: Api, private holder: Holder) { } calScore(payload: { zjh: string, mm: string, date: Date }) { let seq = this.api.post('service...
JWCService
identifier_name
jwc-service.ts
import {Injectable} from '@angular/core'; import {Api} from './api'; import 'rxjs/Rx'; import {Headers, RequestOptions} from '@angular/http'; import {Holder} from './holder'; @Injectable() export class JWCService { private headers: Headers = new Headers(); private requestOption: RequestOptions = new RequestOptions...
} }
random_line_split
jwc-service.ts
import {Injectable} from '@angular/core'; import {Api} from './api'; import 'rxjs/Rx'; import {Headers, RequestOptions} from '@angular/http'; import {Holder} from './holder'; @Injectable() export class JWCService { private headers: Headers = new Headers(); private requestOption: RequestOptions = new RequestOptions...
calScore(payload: { zjh: string, mm: string, date: Date }) { let seq = this.api.post('service/jwc/score', payload, this.requestOption).share();//发包 seq.subscribe(() => { }, err => { console.error('ERROR', err); this.holder.alerts.push({level: 'alert-danger', content: '服务器故障,请稍后再试'}); });...
{ }
identifier_body
ds_tc_resnet_test.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
# before processing new test sequence we reset model state inputs = [] for detail in interpreter.get_input_details(): inputs.append(np.zeros(detail['shape'], dtype=np.float32)) stream_out = inference.run_stream_inference_classification_tflite( self.params, interpreter, self.input_data, in...
interpreter.allocate_tensors()
random_line_split
ds_tc_resnet_test.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
if __name__ == '__main__': tf1.disable_eager_execution() tf.test.main()
"""Test for tflite streaming with external state.""" tflite_streaming_model = utils.model_to_tflite( self.sess, self.model, self.params, Modes.STREAM_EXTERNAL_STATE_INFERENCE) interpreter = tf.lite.Interpreter(model_content=tflite_streaming_model) interpreter.allocate_tensors() # befor...
identifier_body
ds_tc_resnet_test.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
tf1.disable_eager_execution() tf.test.main()
conditional_block
ds_tc_resnet_test.py
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # 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 applicab...
(self): super(DsTcResnetTest, self).setUp() config = tf1.ConfigProto() config.gpu_options.allow_growth = True self.sess = tf1.Session(config=config) tf1.keras.backend.set_session(self.sess) tf.keras.backend.set_learning_phase(0) test_utils.set_seed(123) self.params = utils.ds_tc_resnet...
setUp
identifier_name
window_test.py
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4 """Tests window.py for vimiv's test suite.""" import os from unittest import main, skipUnless from gi import require_version require_version('Gtk', '3.0') from gi.repository import Gdk from vimiv_testcase import VimivTestCase, refresh_gui class WindowTest(VimivTest...
def test_fullscreen(self): """Toggle fullscreen.""" # Start without fullscreen self.assertFalse(self._is_fullscreen()) # Fullscreen self.vimiv["window"].toggle_fullscreen() refresh_gui(0.05) # Still not reliable # self.assertTrue(self._is_fullscreen(...
cls.init_test(cls, ["vimiv/testimages/"])
identifier_body
window_test.py
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4 """Tests window.py for vimiv's test suite.""" import os from unittest import main, skipUnless from gi import require_version require_version('Gtk', '3.0') from gi.repository import Gdk from vimiv_testcase import VimivTestCase, refresh_gui class WindowTest(VimivTest...
(cls): cls.init_test(cls, ["vimiv/testimages/"]) def test_fullscreen(self): """Toggle fullscreen.""" # Start without fullscreen self.assertFalse(self._is_fullscreen()) # Fullscreen self.vimiv["window"].toggle_fullscreen() refresh_gui(0.05) # Still not...
setUpClass
identifier_name
window_test.py
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4 """Tests window.py for vimiv's test suite.""" import os from unittest import main, skipUnless from gi import require_version require_version('Gtk', '3.0') from gi.repository import Gdk from vimiv_testcase import VimivTestCase, refresh_gui class WindowTest(VimivTest...
refresh_gui(0.05) # Still not reliable # self.assertTrue(self._is_fullscreen()) # Unfullscreen self.vimiv["window"].toggle_fullscreen() refresh_gui(0.05) # self.assertFalse(self.vimiv["window"].is_fullscreen) self.vimiv["window"].fullscreen() def _is_...
# Start without fullscreen self.assertFalse(self._is_fullscreen()) # Fullscreen self.vimiv["window"].toggle_fullscreen()
random_line_split
window_test.py
# vim: ft=python fileencoding=utf-8 sw=4 et sts=4 """Tests window.py for vimiv's test suite.""" import os from unittest import main, skipUnless from gi import require_version require_version('Gtk', '3.0') from gi.repository import Gdk from vimiv_testcase import VimivTestCase, refresh_gui class WindowTest(VimivTest...
main()
conditional_block
eo.js
/* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'div', 'eo', { IdInputLabel: 'Id', advisoryTitleInputLabel: 'Priskriba Titolo', cssClassInputLabel: 'Stilfolioklasoj', edit: 'Redakti Div'...
title: 'Krei DIV ujon', toolbar: 'Krei DIV ujon' });
styleSelectLabel: 'Stilo',
random_line_split
scraper.py
''' Download Cricket Data ''' #!/usr/bin/env python # -*- coding: utf-8 -*- import urllib2 import csv import sys import time import os import unicodedata from urlparse import urlparse from BeautifulSoup import BeautifulSoup, SoupStrainer BASE_URL = 'http://www.espncricinfo.com' if not os.path.exists('./espncricinf...
for i in range(0, 6019): #odi: soupy = BeautifulSoup(urllib2.urlopen('http://search.espncricinfo.com/ci/content/match/search.html?search=odi;all=1;page=' + str(i)).read()) #test: soupy = BeautifulSoup(urllib2.urlopen('http://search.espncricinfo.com/ci/content/match/search.html?search=test;all=1;page=' + str(i...
os.mkdir('./espncricinfo-fc')
conditional_block
scraper.py
''' Download Cricket Data ''' #!/usr/bin/env python # -*- coding: utf-8 -*- import urllib2 import csv import sys import time import os import unicodedata from urlparse import urlparse from BeautifulSoup import BeautifulSoup, SoupStrainer
BASE_URL = 'http://www.espncricinfo.com' if not os.path.exists('./espncricinfo-fc'): os.mkdir('./espncricinfo-fc') for i in range(0, 6019): #odi: soupy = BeautifulSoup(urllib2.urlopen('http://search.espncricinfo.com/ci/content/match/search.html?search=odi;all=1;page=' + str(i)).read()) #test: soupy = Beau...
random_line_split
__openerp__.py
# -*- coding:utf-8 -*- # # # Copyright (C) 2011,2013 Michael Telahun Makonnen <mmakonnen@gmail.com>. # All Rights Reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation...
{ 'name': 'Employee Education Records', 'version': '1.0', 'category': 'Generic Modules/Human Resources', 'description': """ Details About and Employee's Education ====================================== Add an extra field about an employee's education. """, 'author': "Michael Telahun Makonn...
random_line_split
test_node.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...
throw e; }); jasmine_util.setTestEnvs( [{name: 'test-inference-api', backendName: 'cpu', flags: {}}]); const unitTests = 'src/**/*_test.ts'; const runner = new jasmineCtor(); runner.loadConfig({spec_files: [unitTests], random: false}); runner.execute();
process.on('unhandledRejection', e => {
random_line_split
what_is_going_on.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct UnknownUnits { pub _address: u8, } #[test] fn bindgen_test_layout_UnknownUnits() { assert_eq!( ...
#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct PointTyped<F> { pub x: F, pub y: F, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<F>>, } impl<F> Default for PointTyped<F> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } pub type IntPoint = PointTyped<f32>...
concat!("Alignment of ", stringify!(UnknownUnits)) ); } pub type Float = f32;
random_line_split
what_is_going_on.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct UnknownUnits { pub _address: u8, } #[test] fn bindgen_test_layout_UnknownUnits()
pub type Float = f32; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct PointTyped<F> { pub x: F, pub y: F, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<F>>, } impl<F> Default for PointTyped<F> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } pub type Int...
{ assert_eq!( ::std::mem::size_of::<UnknownUnits>(), 1usize, concat!("Size of: ", stringify!(UnknownUnits)) ); assert_eq!( ::std::mem::align_of::<UnknownUnits>(), 1usize, concat!("Alignment of ", stringify!(UnknownUnits)) ); }
identifier_body
what_is_going_on.rs
/* automatically generated by rust-bindgen */ #![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct UnknownUnits { pub _address: u8, } #[test] fn bindgen_test_layout_UnknownUnits() { assert_eq!( ...
<F> { pub x: F, pub y: F, pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<F>>, } impl<F> Default for PointTyped<F> { fn default() -> Self { unsafe { ::std::mem::zeroed() } } } pub type IntPoint = PointTyped<f32>;
PointTyped
identifier_name
networkDrawer.py
import sys import collections as c from scipy import special, stats import numpy as n, pylab as p, networkx as x class NetworkDrawer: drawer_count=0 def __init__(self,metric="strength"): self.drawer_count+=1 metric_=self.standardizeName(metric) self.metric_=metric_ self.draw_cou...
if "step_size" in dir(self): label+="m: {} ,".format(self.draw_count*self.step_size+self.offset) else: label+="m: %i, ".format(self.draw_count) #self.network_measures.N,self.network_measures.E) label+="N = %i, E = %i"%(self.network_measures.N,self.network_meas...
abel+="w: {}, ".format(self.window_size) #m: %i, N = %i, E = %i"%(self.draw_count*self.step_size,self.network_measures.N,self.network_measures.E)
conditional_block
networkDrawer.py
import sys import collections as c from scipy import special, stats import numpy as n, pylab as p, networkx as x class NetworkDrawer: drawer_count=0 def __init__(self,metric="strength"): self.drawer_count+=1 metric_=self.standardizeName(metric) self.metric_=metric_ self.draw_cou...
(self,name): if name in (["s","strength","st"]+["f","força","forca","fo"]): name_="s" if name in (["d","degree","dg"]+["g","grau","gr"]): name_="d" return name_ def makeLayout(self,network_measures,network_partitioning=None): """Delivers a sequence of user_ids...
standardizeName
identifier_name
networkDrawer.py
import sys import collections as c from scipy import special, stats import numpy as n, pylab as p, networkx as x class NetworkDrawer: drawer_count=0 def __init__(self,metric="strength"): self.drawer_count+=1 metric_=self.standardizeName(metric) self.metric_=metric_ self.draw_cou...
def updateNetwork(self,network,networkMeasures=None): pass def makeXY(self): size_periphery=self.k1 size_intermediary=self.k2-self.k1 size_hubs=self.network_measures.N-self.k2 if size_hubs%2==1: size_hubs+=1 size_intermediary-=1 xh=n.linsp...
abel="" if "window_size" in dir(self): label+="w: {}, ".format(self.window_size) #m: %i, N = %i, E = %i"%(self.draw_count*self.step_size,self.network_measures.N,self.network_measures.E) if "step_size" in dir(self): label+="m: {} ,".format(self.draw_count*self.step_siz...
identifier_body
networkDrawer.py
import sys import collections as c from scipy import special, stats import numpy as n, pylab as p, networkx as x class NetworkDrawer: drawer_count=0 def __init__(self,metric="strength"): self.drawer_count+=1 metric_=self.standardizeName(metric) self.metric_=metric_ self.draw_cou...
A.graph_attr["label"]=label A.graph_attr["fontcolor"]="white" cm=p.cm.Reds(range(2**10)) # color table self.cm=cm nodes=A.nodes() self.colors=colors=[] self.inds=inds=[] self.poss=poss=[] for node in nodes: n_=A.get_node(node) ...
#A.graph_attr["size"]="9.5,12" A.graph_attr["fontsize"]="25" if label=="auto": label=self.makeLabel()
random_line_split
index.js
var on = require('emmy/on'); var off = require('emmy/off'); module.exports = Sticky; /** * @constructor */ function Sticky(el, options){ if (el.getAttribute('data-sticky-id') === undefined) { return console.log('Sticky already exist'); } this.el = el; this.parent = this.el.parentNode; //recognize attribute...
proto.disable = function(){ if (this.stub.parentNode) this.parent.removeChild(this.stub); this.unbindEvents(); this.isDisabled = true; Sticky.recalc(); }; /** enables previously disabled element */ proto.enable = function(){ if (!this.stub.parentNode) this.parent.insertBefore(this.stub, this.el); this.isDisable...
random_line_split
index.js
var on = require('emmy/on'); var off = require('emmy/off'); module.exports = Sticky; /** * @constructor */ function Sticky(el, options){ if (el.getAttribute('data-sticky-id') === undefined) { return console.log('Sticky already exist'); } this.el = el; this.parent = this.el.parentNode; //recognize attribute...
let rect = el.getBoundingClientRect() //whether element is or is in fixed var fixed = isFixed(el); var xOffset = fixed ? 0 : window.pageXOffset; var yOffset = fixed ? 0 : window.pageYOffset; return { left: rect.left + xOffset, top: rect.top + yOffset, width: rect.width, height: rect.height }; } functio...
t(el) {
identifier_name
index.js
var on = require('emmy/on'); var off = require('emmy/off'); module.exports = Sticky; /** * @constructor */ function Sticky(el, options)
//list of instances Sticky.list = []; //mutually exclusive items Sticky.noStack = []; //stacks of items Sticky.stack = {}; //heights of stacks Sticky.stackHeights = {}; /** Update all sticky instances */ Sticky.recalc = function () { Sticky.list.forEach(function (instance) { instance.recalc(); }); }; /** API ...
{ if (el.getAttribute('data-sticky-id') === undefined) { return console.log('Sticky already exist'); } this.el = el; this.parent = this.el.parentNode; //recognize attributes var dataset = el.dataset; if (!dataset){ dataset = {}; if (el.getAttribute('data-within')) dataset['within'] = el.getAttribute('dat...
identifier_body
keybindingsRegistry.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
return kb; } public registerCommandRule(rule: ICommandRule): void { let actualKb = KeybindingsRegistryImpl.bindToCurrentPlatform(rule); if (actualKb && actualKb.primary) { this.registerDefaultKeybinding(actualKb.primary, rule.id, rule.weight, 0, rule.context); } if (actualKb && Array.isArray(actualK...
{ if (kb && kb.linux) { return kb.linux; } }
conditional_block
keybindingsRegistry.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
/** * Take current platform into account and reduce to primary & secondary. */ private static bindToCurrentPlatform(kb: IKeybindings): { primary?: number; secondary?: number[]; } { if (platform.isWindows) { if (kb && kb.win) { return kb.win; } } else if (platform.isMacintosh) { if (kb && kb.mac...
{ this._keybindings = []; this._commands = Object.create(null); }
identifier_body
keybindingsRegistry.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
(keybinding: number, commandId: string, weight1: number, weight2: number, context: KbExpr): void { if (platform.isWindows) { if (BinaryKeybindings.hasCtrlCmd(keybinding) && !BinaryKeybindings.hasShift(keybinding) && BinaryKeybindings.hasAlt(keybinding) && !BinaryKeybindings.hasWinCtrl(keybinding)) { if (/^[A-Z...
registerDefaultKeybinding
identifier_name
keybindingsRegistry.ts
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *---------------------------------------------------------------...
public getDefaultKeybindings(): IKeybindingItem[] { return this._keybindings; } } export let KeybindingsRegistry: IKeybindingsRegistry = new KeybindingsRegistryImpl(); // Define extension point ids export let Extensions = { EditorModes: 'platform.keybindingsRegistry' }; Registry.add(Extensions.EditorModes, Keybin...
}); }
random_line_split
offset.js
define([ "./core", "./core/access", "./var/document", "./var/documentElement", "./css/var/rnumnonpx", "./css/curCSS", "./css/addGetHookIf", "./css/support", "./core/init", "./css", "./selector" // contains ], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { ...
( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; } jQuery.offset = { setOffset: function( elem, options, i ) { var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css( elem, "position" ), curElem = jQuery( elem ),...
getWindow
identifier_name
offset.js
define([ "./core", "./core/access", "./var/document", "./var/documentElement", "./css/var/rnumnonpx", "./css/curCSS", "./css/addGetHookIf", "./css/support", "./core/init", "./css", "./selector" // contains ], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { ...
jQuery.offset = { setOffset: function( elem, options, i ) { var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css( elem, "position" ), curElem = jQuery( elem ), props = {}; // Set position first, in-case top/left are set even on static elem if ( ...
{ return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; }
identifier_body
offset.js
define([ "./core", "./core/access", "./var/document", "./var/documentElement", "./css/var/rnumnonpx", "./css/curCSS", "./css/addGetHookIf", "./css/support", "./core/init", "./css", "./selector" // contains ], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { ...
// Add offsetParent borders // Subtract offsetParent scroll positions parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ) - offsetParent.scrollTop(); parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) - offsetParent.scrollLeft(); } // Subtrac...
{ parentOffset = offsetParent.offset(); }
conditional_block
offset.js
define([ "./core", "./core/access", "./var/document", "./var/documentElement", "./css/var/rnumnonpx", "./css/curCSS", "./css/addGetHookIf", "./css/support", "./core/init", "./css", "./selector" // contains ], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { ...
jQuery.fn.extend({ offset: function( options ) { // Preserve chaining for setter if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, win, rect, doc, elem = this[ 0 ]; if ( !elem ) { ...
random_line_split
mzasm.js
#!/usr/bin/env node const NumberUtil = require("../js/lib/number-util.js"); var Z80_assemble = require('../js/Z80/assembler'); var MZ_TapeHeader = require('../js/lib/mz-tape-header'); var changeExt = require('../js/lib/change-ext.js'); var fs = require('fs'); var getPackageJson = require("./lib/get-package-json"); var ...
(async function() { let sources = []; await Promise.all(args.input_filenames.map( input_filename => { return new Promise( (resolve, reject) => { fs.readFile(input_filename, 'utf-8', function(err, data) { if(err) { reject(err); } else { ...
{ // // Create MZT-Header from the informations specified in command line options // var load_addr = 0; var exec_addr = 0; if('loading-address' in cli.options) { load_addr = parseInt(cli.options['loading-address'], 0); exec_addr = load_addr; } if('execution-address' in ...
conditional_block
mzasm.js
#!/usr/bin/env node const NumberUtil = require("../js/lib/number-util.js"); var Z80_assemble = require('../js/Z80/assembler'); var MZ_TapeHeader = require('../js/lib/mz-tape-header'); var changeExt = require('../js/lib/change-ext.js'); var fs = require('fs'); var getPackageJson = require("./lib/get-package-json"); var ...
// Determine the output filename var output_filename = null; if('output-file' in cli.options) { output_filename = cli.options['output-file']; } else { var ext = null; if('reuse-mzt-header' in cli.options || 'output-MZT-header' in cli.options) { ext = ".mzt"; } else { ext = ".bin...
console.error('error: no input file'); process.exit(-1); }
random_line_split
setup.py
""" # setup module """ import os from setuptools import setup, find_packages HERE = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(HERE, 'README.md')) as f: README = f.read() # with open(os.path.join(HERE, 'CHANGES.txt')) as f: # CHANGES = f.read() CHANGES = "Changes" PREQ = [ 'pyrami...
setup( name='codebase', version='0.0.1', description='Coding demo for Python', long_description=README + '\n\n' + CHANGES, classifiers=["Programming Language :: Python", "Framework :: Pyramid", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: ...
'webtest', 'tox', ]
random_line_split
common.js
/** * Common utilities * @module glMatrix */ // Configuration Constants export var EPSILON = 0.000001; export var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; export var RANDOM = Math.random; /** * Sets the type of array used when creating new vectors and matrices * * @param {Typ...
var degree = Math.PI / 180; /** * Convert Degree To Radian * * @param {Number} a Angle in Degrees */ export function toRadian(a) { return a * degree; } /** * Tests whether or not the arguments have approximately the same value, within an absolute * or relative tolerance of glMatrix.EPSILON (an absolute ...
{ ARRAY_TYPE = type; }
identifier_body