file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
12.1k
suffix
large_stringlengths
0
12k
middle
large_stringlengths
0
7.51k
fim_type
large_stringclasses
4 values
conf.py
a special name prefix 'p_' to keep them separate from the static attributes of Config. That way we don't have to check elsewhere to make sure the user doesn't stomp on our built in properties. Args: parse_config: A YAMLConfiguration. """ for key, value in parsed_config.parameters.iterit...
"""Check if the current cached config is stale, and if so update it.""" app_version, current_config_version, development = _inspect_environment() global _cached_config if (development and _new_request()) or not _cached_config: _cached_config = _fetch_from_local_file() or Config() if _cached_config...
identifier_body
conf.py
memcache from google.appengine.ext import db from google.appengine.api import validation from google.appengine.api import yaml_object except: from google.appengine.api import memcache from google.appengine.ext import db from google.appengine.ext import validation from google.appengine.ext import yaml_obj...
return None def _fetch_from_local_file(pathfinder=_find_yaml_path, fileopener=open): """Get the configuration that was uploaded with this version. Args: pathfinder: a callable to use for finding the path of the conf.yaml file. This is only for use in testing. fileopener: a callable to use for op...
for yaml_name in FILENAMES: yaml_path = os.path.join(current, yaml_name) if os.path.exists(yaml_path): return yaml_path last = current current, last = os.path.dirname(current), current
conditional_block
conf.py
import logging import os import re import time try: from google.appengine.api import memcache from google.appengine.ext import db from google.appengine.api import validation from google.appengine.api import yaml_object except: from google.appengine.api import memcache from google.appengine.ext import db ...
"""A library for managing flags-like configuration that update dynamically. """
random_line_split
kv.formSet.expandable.js
(function ($, kv) { var $fSetToggler = $('<a href="#" class="fSetToggler">advanced</a>'); /** * * @param event * @context {ExpandableSet} */ function handleToggleClick(event)
/** * */ kv.FormSet.prototype.expandable = function () { this.settings.expandable = $.extend({}, kv.FormSet.expandable.defaults, this.settings.expandable); var $expandableSet = this.$formSet , $toggler = $fSetToggler.clone().appendTo($('.fSetHead .fSetInner', $expandableSet)) , $nestedSet = $('> .fSe...
{ event.preventDefault(); event.data.expandableSet.expandableToggle(); }
identifier_body
kv.formSet.expandable.js
(function ($, kv) { var $fSetToggler = $('<a href="#" class="fSetToggler">advanced</a>'); /** * * @param event * @context {ExpandableSet} */ function handleToggleClick(event) { event.preventDefault(); event.data.expandableSet.expandableToggle(); } /** * */ kv.FormSet.prototype.expandable = fu...
} /** * Expands the expandableSet */ , expand: function () { var self = this; self.$nestedSet.stop().slideDown(function () { self.$toggler.text(self.settings.expandedText); self.attr('expandableState', 'expanded'); $(this).addClass(self.settings.expandable.openClass); });...
{ this.expand(); }
conditional_block
kv.formSet.expandable.js
(function ($, kv) { var $fSetToggler = $('<a href="#" class="fSetToggler">advanced</a>'); /**
* * @param event * @context {ExpandableSet} */ function handleToggleClick(event) { event.preventDefault(); event.data.expandableSet.expandableToggle(); } /** * */ kv.FormSet.prototype.expandable = function () { this.settings.expandable = $.extend({}, kv.FormSet.expandable.defaults, this.settings...
random_line_split
kv.formSet.expandable.js
(function ($, kv) { var $fSetToggler = $('<a href="#" class="fSetToggler">advanced</a>'); /** * * @param event * @context {ExpandableSet} */ function
(event) { event.preventDefault(); event.data.expandableSet.expandableToggle(); } /** * */ kv.FormSet.prototype.expandable = function () { this.settings.expandable = $.extend({}, kv.FormSet.expandable.defaults, this.settings.expandable); var $expandableSet = this.$formSet , $toggler = $fSetToggler.c...
handleToggleClick
identifier_name
vip.py
import urllib from models.vipsubscriber import VipSubscriber from base import BaseHandler class Vip(BaseHandler):
if(tVipForumName != None and len(tVipForumName) > 0): tVip.subscriberForumName = tVipForumName tVip.put() return tContext
LOCATION = "../views/vip.html" def GetContext(self): tContext = {} tVipList = [] tVipKey = urllib.unquote(self.request.get('key')) if(tVipKey != None and len(tVipKey) > 0): tVip = VipSubscriber.get(tVipKey) tContext['tVip'] = tVip return tCont...
identifier_body
vip.py
import urllib from models.vipsubscriber import VipSubscriber from base import BaseHandler class Vip(BaseHandler): LOCATION = "../views/vip.html" def GetContext(self): tContext = {} tVipList = [] tVipKey = urllib.unquote(self.request.get('key')) if(tVipKey != None and le...
if(tVipForumName != None and len(tVipForumName) > 0): tVip.subscriberForumName = tVipForumName tVip.put() return tContext
tVip = VipSubscriber.get(tVipKey) tContext['tVip'] = tVip
conditional_block
vip.py
import urllib from models.vipsubscriber import VipSubscriber from base import BaseHandler class Vip(BaseHandler): LOCATION = "../views/vip.html" def GetContext(self): tContext = {} tVipList = []
return tContext def PostContext(self): tContext = {} tVip = VipSubscriber() tVipForumName = urllib.unquote(self.request.get('forumname')) tVipKey = urllib.unquote(self.request.get('key')) if(tVipKey != None and len(tVipKey) > 0): tVip = VipSu...
tVipKey = urllib.unquote(self.request.get('key')) if(tVipKey != None and len(tVipKey) > 0): tVip = VipSubscriber.get(tVipKey) tContext['tVip'] = tVip
random_line_split
vip.py
import urllib from models.vipsubscriber import VipSubscriber from base import BaseHandler class
(BaseHandler): LOCATION = "../views/vip.html" def GetContext(self): tContext = {} tVipList = [] tVipKey = urllib.unquote(self.request.get('key')) if(tVipKey != None and len(tVipKey) > 0): tVip = VipSubscriber.get(tVipKey) tContext['tVip'] = tVip ...
Vip
identifier_name
des_c.py
l1 = l1 | (U32(c[1]) << 8) f = 1 if f or (n == 1): l1 = l1 | U32(c[0]) return (l1, l2) def l2c(l): "unsigned long to char[4]" c = [] c.append(int(l & U32(0xFF))) c.append(int((l >> 8) & U32(0xFF))) c.append(int((l >> 16) & U32(0xFF))) c.append(int((l >> 24) & U32(0xFF))...
block = des_ecb_encrypt(block, self.KeySched, 1) res = '' for i in block: res = res + (chr(i)) return res #------------------------ def des_encript(input, ks, encrypt): # input - U32[] # output - U32[] # ks - des_key_shedule - U32[2][16] # encrypt - int # l, r,...
block.append(ord(i))
conditional_block
des_c.py
l1 = l1 | (U32(c[1]) << 8) f = 1 if f or (n == 1): l1 = l1 | U32(c[0]) return (l1, l2) def l2c(l): "unsigned long to char[4]" c = [] c.append(int(l & U32(0xFF))) c.append(int((l >> 8) & U32(0xFF))) c.append(int((l >> 16) & U32(0xFF))) c.append(int((l >> 24) & U32(0xFF))...
des_SPtrans[2][int((u >> 8) & U32(0x3f))] | \ des_SPtrans[4][int((u >> 16) & U32(0x3f))] | \ des_SPtrans[6][int((u >> 24) & U32(0x3f))]) #print 'LRS:', L, R, S, u, t return ((L, R, S), u, t, s) def PERM_OP (tup, n, m): "tup - (a, b, t)" a, b, t = tup t = ((a >> n) ^ b) & m...
random_line_split
des_c.py
l1 = l1 | (U32(c[1]) << 8) f = 1 if f or (n == 1): l1 = l1 | U32(c[0]) return (l1, l2) def l2c(l): "unsigned long to char[4]" c = [] c.append(int(l & U32(0xFF))) c.append(int((l >> 8) & U32(0xFF))) c.append(int((l >> 16) & U32(0xFF))) c.append(int((l >> 24) & U32(0xFF))...
def encrypt(self, str): # block - UChar[] block = [] for i in str: block.append(ord(i)) block = des_ecb_encrypt(block, self.KeySched, 1) res = '' for i in block: res = res + (chr(i)) return res #------------------------ def des_encript(input, ks, encryp...
KeySched = None # des_key_schedule def __init__(self, key_str): # key - UChar[8] key = [] for i in key_str: key.append(ord(i)) #print 'key:', key self.KeySched = des_set_key(key) #print 'schedule:', self.KeySched, len(self.KeySched) def decrypt(self, str): ...
identifier_body
des_c.py
(c): "char[4] to unsigned long" l = U32(c[0]) l = l | (U32(c[1]) << 8) l = l | (U32(c[2]) << 16) l = l | (U32(c[3]) << 24) return l def c2ln(c,l1,l2,n): "char[n] to two unsigned long???" c = c + n l1, l2 = U32(0), U32(0) f = 0 if n == 8: l2 = l2 | (U32(c[7]) << 24) ...
c2l
identifier_name
world.rs
_and_swap(current, start_from, Ordering::Relaxed) { return; } } } /// Allocate a new entity fn allocate_atomic(&self) -> Entity { let idx = self.start_from.load(Ordering::Relaxed); for i in idx.. { if !self.alive.contains(i as Index) && !self....
write_resource
identifier_name
world.rs
} } /// Helper builder for entities. pub struct EntityBuilder<'a, C = ()>(Entity, &'a World<C>) where C: 'a + PartialEq + Eq + Hash; impl<'a, C> EntityBuilder<'a, C> where C: 'a + PartialEq + Eq + Hash { /// Adds a `Component` value to the new `Entity`. pub fn with_w_comp_id<T: Component>(self, co...
components: HashMap::new(), allocator: RwLock::new(Allocator::new()), resources: HashMap::new() } } /// Registers a new component type and id pair. pub fn register_w_comp_id<T: Component>(&mut self, comp_id: C) { let any = RwLock::new(MaskedStorage::<T>::n...
/// Creates a new empty `World` with the associated component id. pub fn new_w_comp_id() -> World<C> { World {
random_line_split
world.rs
::new(0) } } fn kill(&self, e: Entity) { self.killed.add_atomic(e.get_id()); } /// Return `true` if the entity is alive. pub fn is_alive(&self, e: Entity) -> bool { e.get_gen() == match self.generations.get(e.get_id() as usize) { Some(g) if !g.is_alive() && sel...
{ let mut allocator = self.allocator.write().unwrap(); let temp_list = allocator.merge(); for comp in self.components.values() { comp.del_slice(&temp_list); } }
identifier_body
world.rs
} } /// Helper builder for entities. pub struct EntityBuilder<'a, C = ()>(Entity, &'a World<C>) where C: 'a + PartialEq + Eq + Hash; impl<'a, C> EntityBuilder<'a, C> where C: 'a + PartialEq + Eq + Hash { /// Adds a `Component` value to the new `Entity`. pub fn with_w_comp_id<T: Component>(self, comp_...
else { gen.raised() }) .unwrap_or(Generation(1)); return Entity(i as Index, gen); } } panic!("No entities left to allocate") } /// Allocate a new entity fn allocate(&mut self) -> Entity { let idx = self.start_from.load(Ordering::Rela...
{ gen }
conditional_block
nxos_vpc_interface.py
'supported_by': 'community'} DOCUMENTATION = ''' --- module: nxos_vpc_interface extends_documentation_fragment: nxos version_added: "2.2" short_description: Manages interface VPC configuration description: - Manages interface VPC configuration author: - Jason Edelman (@jedelman8) - Gabriele Gerbino (@GGa...
(module): found = False run = get_vpc_running_config(module) vpc_list = run.split('\n') for each in vpc_list: if 'peer-link' in each: found = True return found def get_vpc_running_config(module): command = 'show running section vpc' body = execute_show_command(command,...
peer_link_exists
identifier_name
nxos_vpc_interface.py
'supported_by': 'community'} DOCUMENTATION = ''' --- module: nxos_vpc_interface extends_documentation_fragment: nxos version_added: "2.2" short_description: Manages interface VPC configuration description: - Manages interface VPC configuration author: - Jason Edelman (@jedelman8) - Gab...
def get_portchannel_vpc_config(module, portchannel): command = 'show vpc brief' peer_link_pc = None peer_link = False vpc = "" pc = "" config = {} body = execute_show_command(command, module) try: table = body[0]['TABLE_peerlink']['ROW_peerlink'] except (KeyError, Attrib...
command = 'show vpc brief' peer_link = None body = execute_show_command(command, module) try: peer_link = body[0]['TABLE_peerlink']['ROW_peerlink']['peerlink-ifindex'] except (KeyError, AttributeError): return peer_link return peer_link
identifier_body
nxos_vpc_interface.py
the user to unconfigure an existing vpc/pl before configuring the same value on a new portchannel options: portchannel: description: - Group number of the portchannel that will be configured. required: true vpc: description: - VPC group/id that will be conf...
command = get_commands_to_config_vpc_interface( portchannel, delta, config_value, existing ) commands.append(command)
conditional_block
nxos_vpc_interface.py
'supported_by': 'community'} DOCUMENTATION = ''' --- module: nxos_vpc_interface extends_documentation_fragment: nxos version_added: "2.2" short_description: Manages interface VPC configuration description: - Manages interface VPC configuration author: - Jason Edelman (@jedelman8) - Gab...
returned: always type: dict sample: {"peer-link": false, "portchannel": "100", "vpc": "10"} updates: description: commands sent to the device returned: always type: list sample: ["interface port-channel100", "vpc 10"] changed: description: check to see if a change was made on the device...
type: dict sample: {} end_state: description: k/v pairs of configuration after module execution
random_line_split
__openerp__.py
# -*- coding: utf-8 -*- # # # Copyright 2014 Camptocamp SA # Author: Yannick Vaucher # # 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, either version 3 of the # License,...
'installable': True, "auto_install": True, }
], "demo": [], "data": ['view/sale_order.xml', ], "test": [],
random_line_split
jquery.fix.clone.js
// Textarea and select clone() bug workaround | Spencer Tipping // Licensed under the terms of the MIT source code license // Motivation. // jQuery's clone() method works in most cases, but it fails to copy the value of textareas and select elements. This patch replaces jQuery's clone() method with a wrapper that fill...
return result; }; }) (jQuery.fn.clone);
{ for (var j = 0, m = my_selects[i].options.length; j < m; ++j) { if (my_selects[i].options[j].selected === true) { result_selects[i].options[j].selected = true; } } }
conditional_block
jquery.fix.clone.js
// Textarea and select clone() bug workaround | Spencer Tipping // Licensed under the terms of the MIT source code license // Motivation. // jQuery's clone() method works in most cases, but it fails to copy the value of textareas and select elements. This patch replaces jQuery's clone() method with a wrapper that fill...
my_textareas = this.find('textarea').add(this.filter('textarea')), result_textareas = result.find('textarea').add(result.filter('textarea')), my_selects = this.find('select').add(this.filter('select')), result_selects = result.find('select').add(result.filter('select')); ...
var result = original.apply(this, arguments),
random_line_split
io_compat.rs
// there's no real io error on a byte slice pub type Error = (); pub type Result<T> = core::result::Result<T, Error>; pub trait Write { fn write(&mut self, buf: &[u8]) -> Result<usize>; } impl Write for &mut [u8] { fn write(&mut self, data: &[u8]) -> Result<usize> { let amt = core::cmp::min(data.len()...
pub fn into_inner(self) -> &'a mut [u8] { self.0 } pub fn position(&self) -> u64 { self.1 as u64 } pub fn set_position(&mut self, pos: u64) { self.1 = pos; } pub fn get_mut(&mut self) -> &mut [u8] { self.0 } pub fn get_ref(&self) -> &[u8] { ...
{ Self(inner, 0) }
identifier_body
io_compat.rs
// there's no real io error on a byte slice pub type Error = (); pub type Result<T> = core::result::Result<T, Error>; pub trait Write { fn write(&mut self, buf: &[u8]) -> Result<usize>; } impl Write for &mut [u8] { fn write(&mut self, data: &[u8]) -> Result<usize> { let amt = core::cmp::min(data.len()...
(inner: &'a mut [u8]) -> Self { Self(inner, 0) } pub fn into_inner(self) -> &'a mut [u8] { self.0 } pub fn position(&self) -> u64 { self.1 as u64 } pub fn set_position(&mut self, pos: u64) { self.1 = pos; } pub fn get_mut(&mut self) -> &mut [u8] { ...
new
identifier_name
io_compat.rs
// there's no real io error on a byte slice pub type Error = (); pub type Result<T> = core::result::Result<T, Error>; pub trait Write { fn write(&mut self, buf: &[u8]) -> Result<usize>; } impl Write for &mut [u8] { fn write(&mut self, data: &[u8]) -> Result<usize> { let amt = core::cmp::min(data.len()...
impl<'a> Seek for Cursor<&'a mut [u8]> { fn seek(&mut self, pos: SeekFrom) -> Result<u64> { let (start, offset) = match pos { SeekFrom::Start(n) => { self.1 = n; return Ok(n); } SeekFrom::Current(n) => (self.1 as u64, n), }; ...
} }
random_line_split
models.py
from flask_login import LoginManager, UserMixin, login_user, logout_user, current_user, login_required from werkzeug.security import generate_password_hash, check_password_hash import ctf class User(UserMixin, ctf.db.Model): __tablename__ = 'users' id = ctf.db.Column(ctf.db.Integer, primary_key=True) user...
@property def password(self): raise AttributeError('password is not a readable attribute') @password.setter def password(self, password): self.password_hash = generate_password_hash(password) def verify_password(self, password): return check_password_hash(self.password_has...
# super(User, self).__init__(**kwargs)
random_line_split
models.py
from flask_login import LoginManager, UserMixin, login_user, logout_user, current_user, login_required from werkzeug.security import generate_password_hash, check_password_hash import ctf class User(UserMixin, ctf.db.Model): __tablename__ = 'users' id = ctf.db.Column(ctf.db.Integer, primary_key=True) user...
__tablename__ = 'challenges' id = ctf.db.Column(ctf.db.Integer, primary_key=True) name = ctf.db.Column(ctf.db.String(80), unique=True) category = ctf.db.Column(ctf.db.String(80)) info = ctf.db.Column(ctf.db.String(800)) score = ctf.db.Column(ctf.db.String(20)) flag = ctf.db.Column(ctf.db.String(...
identifier_body
models.py
from flask_login import LoginManager, UserMixin, login_user, logout_user, current_user, login_required from werkzeug.security import generate_password_hash, check_password_hash import ctf class User(UserMixin, ctf.db.Model): __tablename__ = 'users' id = ctf.db.Column(ctf.db.Integer, primary_key=True) user...
(self): raise AttributeError('password is not a readable attribute') @password.setter def password(self, password): self.password_hash = generate_password_hash(password) def verify_password(self, password): return check_password_hash(self.password_hash, password) def __repr__(...
password
identifier_name
storage.py
(self, s): self.k = int(s[0:32].encode('hex'), 16) self.s = s[32:] if self.k==0 and self.s: print "init error", len(self.s), "0x%0.64X" % self.k raise BaseException("z") def serialized(self): k = "0x%0.64X" % self.k k = k[2:].decode('hex') ass...
__init__
identifier_name
storage.py
_int(item[76:80]) out.append((hi, txi)) out.append((ho, txo)) # uniqueness out = set(out) # sort by height then tx_hash out = sorted(out) return map(lambda x: {'height':x[0], 'tx_hash':x[1]}, out) def get_address(self, txi): return self.db_add...
key = self.address_to_key(addr) txo = (tx_hash + int_to_hex4(tx_pos)).decode('hex') # write the new history self.add_key(key + txo, value, tx_height) # backlink self.db_addr.put(txo, addr)
identifier_body
storage.py
try: _hash = Hash(skip_string + hh) except: _hash = None if x: assert self.k != 0 return _hash, v @classmethod def from_dict(klass, d): k = 0 s = '' for i in xrange(256): if chr(i) in d: k +...
if (self.k&(1<<i)) != 0: ss = self.s[x:x+40] hh += ss[0:32] v += bytes8_to_int(ss[32:40]) x += 40
conditional_block
storage.py
def update_node_hash(self, node, path, _hash, value): c = node for x in path[::-1]: self.parents[c] = x c = x self.hash_list[node] = (_hash, value) def update_hashes(self): nodes = {} # nodes to write for i in xrange(KEYLENGTH, -1, -1): ...
prev_addr = undo.pop('prev_addr') for i, x in reversed(list(enumerate(tx.get('inputs')))): addr = prev_addr[i] if addr is not None:
random_line_split
normalizeUrl.js
function normalizeUrl(url){ // parseUri 1.2.2 // (c) Steven Levithan <stevenlevithan.com> // MIT License function parseUri (str) { var o = parseUri.options, m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), uri = {}, i = 14; while (i--) uri[o.key[i]] = m[i] || ""; uri[o.q.name] = {...
var newUrl = uri.protocol+"://"+uri.authority+uri.path + (uri.query ? '?'+uri.query :'') + (uri.anchor ? '#'+uri.anchor:''); // return the newUrl return newUrl; } // export in common js if( typeof module !== "undefined" && ('exports' in module)){ module.exports = normalizeUrl }
random_line_split
normalizeUrl.js
function normalizeUrl(url){ // parseUri 1.2.2 // (c) Steven Levithan <stevenlevithan.com> // MIT License function
(str) { var o = parseUri.options, m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), uri = {}, i = 14; while (i--) uri[o.key[i]] = m[i] || ""; uri[o.q.name] = {}; uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { if ($1) uri[o.q.name][$1] = $2; }); return uri; }; ...
parseUri
identifier_name
normalizeUrl.js
function normalizeUrl(url)
strictMode: false, key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^...
{ // parseUri 1.2.2 // (c) Steven Levithan <stevenlevithan.com> // MIT License function parseUri (str) { var o = parseUri.options, m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), uri = {}, i = 14; while (i--) uri[o.key[i]] = m[i] || ""; uri[o.q.name] = {}; uri[o.key[12]].replac...
identifier_body
Location.py
""" <This library provides a Python interface for the Telegram Bot API> Copyright (C) <2015> <Jacopo De Luca> 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 t...
:type jlocation: dict :rtype: Location """ return Location(jlocation['longitude'], jlocation['latitude'])
""" This object represents a point on the map. """ def __init__(self, longitude, latitude): """ :param longitude: Longitude as defined by sender :type longitude: float :param latitude: Latitude as defined by sender :type latitude: float """ self.long...
identifier_body
Location.py
""" <This library provides a Python interface for the Telegram Bot API> Copyright (C) <2015> <Jacopo De Luca> 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 t...
:param jlocation: A dictionary that contains JSON-parsed object :type jlocation: dict :rtype: Location """ return Location(jlocation['longitude'], jlocation['latitude'])
def build_from_json(jlocation): """
random_line_split
Location.py
""" <This library provides a Python interface for the Telegram Bot API> Copyright (C) <2015> <Jacopo De Luca> 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 t...
(jlocation): """ :param jlocation: A dictionary that contains JSON-parsed object :type jlocation: dict :rtype: Location """ return Location(jlocation['longitude'], jlocation['latitude'])
build_from_json
identifier_name
chai-http-tests.ts
import fs = require('fs'); import http = require('http'); import chai = require('chai'); import ChaiHttp = require('chai-http'); import when = require('when'); chai.use(ChaiHttp); // ReSharper disable WrongExpressionStatement // Add promise support if this does not exist natively. if (!global.Promise) { chai.reques...
chai.expect(res).to.redirectTo('http://example.com'); chai.expect(res).to.have.param('orderby'); chai.expect(res).to.have.param('orderby', 'date'); chai.expect(res).to.not.have.param('limit'); chai.expect(req).to.have.cookie('session_id'); chai.expect(req).to.have.cookie('session_id', '1234'); chai.expect...
chai.expect('127.0.0.1').to.be.an.ip; chai.expect(res).to.be.json; chai.expect(res).to.be.html; chai.expect(res).to.be.text; chai.expect(res).to.redirect;
random_line_split
chai-http-tests.ts
import fs = require('fs'); import http = require('http'); import chai = require('chai'); import ChaiHttp = require('chai-http'); import when = require('when'); chai.use(ChaiHttp); // ReSharper disable WrongExpressionStatement // Add promise support if this does not exist natively. if (!global.Promise) { chai.reques...
chai.expect(res).to.have.cookie('session_id', '1234'); chai.expect(res).to.not.have.cookie('PHPSESSID'); chai.expect(res.body).to.have.property('version', '4.0.0'); chai.expect(res.text).to.equal('<html><body></body></html>'); }, (err: any) => { throw err; }); } when(chai.request(app).get('/')).done(() =>...
{ const req = chai.request(app).get('/'); req.then((res: ChaiHttp.Response) => { chai.expect(res).to.have.status(200); chai.expect(res).to.have.header('content-type', 'text/plain'); chai.expect(res).to.have.header('content-type', /^text/); chai.expect(res).to.have.headers; chai.expect('127.0.0.1').to.be.an....
identifier_body
chai-http-tests.ts
import fs = require('fs'); import http = require('http'); import chai = require('chai'); import ChaiHttp = require('chai-http'); import when = require('when'); chai.use(ChaiHttp); // ReSharper disable WrongExpressionStatement // Add promise support if this does not exist natively. if (!global.Promise) { chai.reques...
() { const req = chai.request(app).get('/'); req.then((res: ChaiHttp.Response) => { chai.expect(res).to.have.status(200); chai.expect(res).to.have.header('content-type', 'text/plain'); chai.expect(res).to.have.header('content-type', /^text/); chai.expect(res).to.have.headers; chai.expect('127.0.0.1').to.be....
test1
identifier_name
chai-http-tests.ts
import fs = require('fs'); import http = require('http'); import chai = require('chai'); import ChaiHttp = require('chai-http'); import when = require('when'); chai.use(ChaiHttp); // ReSharper disable WrongExpressionStatement // Add promise support if this does not exist natively. if (!global.Promise)
declare const app: http.Server; chai.request(app).get('/'); chai.request('http://localhost:8080').get('/'); chai.request(app) .put('/user/me') .set('X-API-Key', 'foobar') .send({ password: '123', confirmPassword: '123' }); chai.request(app) .post('/user/me') .field('_method', 'put') .field('password', '123')...
{ chai.request.addPromises(when.promise); }
conditional_block
account_panel.js
/*--------------------------------------------------------------------------- * AccountPanel *-------------------------------------------------------------------------*/ var AccountPanel = Ext.extend(Ext.BoxComponent, { cls: 'account-panel', height: 40, autoCreate: { html:'<table cellspacing="0"><t...
adjustSize : function(w, h) { return { width : this.width, height: this.height }; }, // adjustSize onDestroy: function() { Ext.destroy.apply(Ext, this.items.items); onDestroy.superclass.initComponent.call(this); } // onDestroy }); // AccountPanel AccountPanel.Button = Ext.ext...
}, // setTop
random_line_split
account_panel.js
/*--------------------------------------------------------------------------- * AccountPanel *-------------------------------------------------------------------------*/ var AccountPanel = Ext.extend(Ext.BoxComponent, { cls: 'account-panel', height: 40, autoCreate: { html:'<table cellspacing="0"><t...
else { var bt = o.render( this.nextBlock() ); this.items.add(o); this.autoResize(); } return o; }, // add autoResize: function() { this.el.setWidth( this.table.getWidth(true) ); }, // autoResize addButton: function(conf) { return this.add( new AccountPanel.Button(conf) );...
{ this.items.push(o); }
conditional_block
webpack.prod.js
* Created by yingding on 04.04.17. */ var webpack = require('webpack'); var webpackMerge = require('webpack-merge'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var commonConfig = require('./webpack.common.js'); var helpers = require('./helpers'); const ENV = process.env.NODE_ENV = process.env.EN...
/**
random_line_split
find_key_relation.py
# -*- coding: utf-8 -*- from gensim.models import word2vec from gensim import models import jieba import codecs import io from collections import Counter import operator import numpy f = codecs.open("target_article.txt",'r','utf8') content = f.readlines() article = [] jieba.set_dictionary('jieba_dict/dict.txt.big')...
for j in range(i+1,len(s_imp_words)): if fg[j] != 1: if model.similarity(s_imp_words[i][0], s_imp_words[j][0]) >= 0.7: fg[j] = 1 keywords.append(s_imp_words[i]) #print s_imp_words[i][0] for i in keywords[:10]: print i[0] # with io.open("target_keywords.txt",'w',encoding='utf-8') as output: # f...
random_line_split
find_key_relation.py
# -*- coding: utf-8 -*- from gensim.models import word2vec from gensim import models import jieba import codecs import io from collections import Counter import operator import numpy f = codecs.open("target_article.txt",'r','utf8') content = f.readlines() article = [] jieba.set_dictionary('jieba_dict/dict.txt.big')...
value += model.similarity(friend_1, friend_2) leng = len(friend_list) related_word[words[i]] = value/float(leng*leng) s_imp_words = sorted(related_word.items(), key=operator.itemgetter(1), reverse=True) for i in s_imp_words[:20]: print i[0] print "-----------------------" #print s_imp_words # for value in out...
continue
conditional_block
rendering.py
# -*- coding: utf-8 -*- """ The Renderer class provides the infrastructure for generating template-based code. It's used by the .grammars module for parser generation. """ from __future__ import generator_stop import itertools import string from tatsu.util import indent, isiter, trim def render(item, join='', **fie...
class RenderingFormatter(string.Formatter): def render(self, item, join='', **fields): return render(item, join=join, **fields) def format_field(self, value, format_spec): if ':' not in format_spec: return super().format_field( self.render(value), ...
return str(item)
conditional_block
rendering.py
# -*- coding: utf-8 -*- """ The Renderer class provides the infrastructure for generating template-based code. It's used by the .grammars module for parser generation. """ from __future__ import generator_stop import itertools import string from tatsu.util import indent, isiter, trim def render(item, join='', **fie...
return trim(self.rend(item), tabwidth=tabwidth) def render_fields(self, fields): """ Pre-render fields before rendering the template. """ return def render(self, **fields): template = fields.pop('template', None) fields.update(__class__=self.__class__.__name__) ...
def trim(self, item, tabwidth=4):
random_line_split
rendering.py
# -*- coding: utf-8 -*- """ The Renderer class provides the infrastructure for generating template-based code. It's used by the .grammars module for parser generation. """ from __future__ import generator_stop import itertools import string from tatsu.util import indent, isiter, trim def render(item, join='', **fie...
(self, value, format_spec): if ':' not in format_spec: return super().format_field( self.render(value), format_spec ) ind, sep, fmt = format_spec.split(':') if sep == '\\n': sep = '\n' if not ind: ind = 0 ...
format_field
identifier_name
rendering.py
# -*- coding: utf-8 -*- """ The Renderer class provides the infrastructure for generating template-based code. It's used by the .grammars module for parser generation. """ from __future__ import generator_stop import itertools import string from tatsu.util import indent, isiter, trim def render(item, join='', **fie...
@classmethod def reset_counter(cls): Renderer._counter = itertools.count() @property def formatter(self): return self._formatter @formatter.setter def formatter(self, value): self._formatter = value def rend(self, item, join='', **fields): """ A shortcut fo...
""" Renders the fileds in the current object using a template provided statically, on the constructor, or as a parameter to render(). Fields with a leading underscore are not made available to the template. Additional fields may be made available by overriding render_fields(). ...
identifier_body
setup.py
#!/usr/bin/env python import os import re from setuptools import find_packages, setup def
(relpath): """ Return string containing the contents of the file at *relpath* relative to this file. """ thisdir = os.path.dirname(__file__) file_path = os.path.join(thisdir, os.path.normpath(relpath)) with open(file_path) as f: text = f.read() return text # Read the version fr...
text_of
identifier_name
setup.py
import re from setuptools import find_packages, setup def text_of(relpath): """ Return string containing the contents of the file at *relpath* relative to this file. """ thisdir = os.path.dirname(__file__) file_path = os.path.join(thisdir, os.path.normpath(relpath)) with open(file_path) a...
#!/usr/bin/env python import os
random_line_split
setup.py
#!/usr/bin/env python import os import re from setuptools import find_packages, setup def text_of(relpath):
# Read the version from docx.__version__ without importing the package # (and thus attempting to import packages it depends on that may not be # installed yet) version = re.search(r'__version__ = "([^"]+)"', text_of("docx/__init__.py")).group(1) NAME = "python-docx" VERSION = version DESCRIPTION = "Create and upda...
""" Return string containing the contents of the file at *relpath* relative to this file. """ thisdir = os.path.dirname(__file__) file_path = os.path.join(thisdir, os.path.normpath(relpath)) with open(file_path) as f: text = f.read() return text
identifier_body
AC_dfs_n.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- # Author: illuz <iilluzen[at]gmail.com> # File: AC_dfs_n.py # Create Date: 2015-08-16 10:15:54 # Usage: AC_dfs_n.py # Descripton: # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left ...
paths = [] def dfs(root): if root: path.append(str(root.val)) if root.left == None and root.right == None: paths.append('->'.join(path)) dfs(root.left) dfs(root.right) path.pop() dfs(r...
# @return {string[]} def binaryTreePaths(self, root): path =[]
random_line_split
AC_dfs_n.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- # Author: illuz <iilluzen[at]gmail.com> # File: AC_dfs_n.py # Create Date: 2015-08-16 10:15:54 # Usage: AC_dfs_n.py # Descripton: # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left ...
dfs(root.left) dfs(root.right) path.pop() dfs(root) return paths
paths.append('->'.join(path))
conditional_block
AC_dfs_n.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- # Author: illuz <iilluzen[at]gmail.com> # File: AC_dfs_n.py # Create Date: 2015-08-16 10:15:54 # Usage: AC_dfs_n.py # Descripton: # Definition for a binary tree node. class TreeNode: def __init__(self, x):
class Solution: # @param {TreeNode} root # @return {string[]} def binaryTreePaths(self, root): path =[] paths = [] def dfs(root): if root: path.append(str(root.val)) if root.left == None and root.right == None: paths.a...
self.val = x self.left = None self.right = None
identifier_body
AC_dfs_n.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- # Author: illuz <iilluzen[at]gmail.com> # File: AC_dfs_n.py # Create Date: 2015-08-16 10:15:54 # Usage: AC_dfs_n.py # Descripton: # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left ...
(root): if root: path.append(str(root.val)) if root.left == None and root.right == None: paths.append('->'.join(path)) dfs(root.left) dfs(root.right) path.pop() dfs(root) return paths ...
dfs
identifier_name
TransferListItem.tsx
/* Copyright (C) 2017 Cloudbase Solutions SRL 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, either version 3 of the License, or (at your option) any later version. This program is distribute...
</StatusWrapper> </Title> {endpointImages} {this.renderCreationDate()} {this.renderUpdateDate()} {this.renderUser()} </Content> </Wrapper> ) } } export default TransferListItem
{this.props.showScheduleIcon ? ( <ScheduleImage data-tip="The Replica has scheduling enabled and will execute automatically" /> ) : null}
identifier_body
TransferListItem.tsx
/* Copyright (C) 2017 Cloudbase Solutions SRL 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, either version 3 of the License, or (at your option) any later version. This program is distribute...
transition: all ${ThemeProps.animations.swift}; min-width: 785px; &:hover { background: ${ThemePalette.grayscale[1]}; } ` const Wrapper = styled.div<any>` display: flex; align-items: center; &:hover ${CheckboxStyled} { opacity: 1; } &:last-child ${Content} { border-bottom: 1px solid ${T...
margin-left: 16px; border-top: 1px solid ${ThemePalette.grayscale[1]}; padding: 8px 16px; cursor: pointer; flex-grow: 1;
random_line_split
TransferListItem.tsx
/* Copyright (C) 2017 Cloudbase Solutions SRL 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, either version 3 of the License, or (at your option) any later version. This program is distribute...
? ( <StatusPill status={status} style={{ marginRight: '8px' }} /> ) : null} {this.props.showScheduleIcon ? ( <ScheduleImage data-tip="The Replica has scheduling enabled and will execute aut...
status
identifier_name
test_kubernetes_executor.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
) def test_integration_run_dag_with_scheduler_failure(self): dag_id = 'example_kubernetes_executor' dag_run_id, execution_date = self.start_job_in_kubernetes(dag_id, self.host) self._delete_airflow_pod("scheduler") time.sleep(10) # give time for pod to restart ...
dag_id = 'example_kubernetes_executor' dag_run_id, execution_date = self.start_job_in_kubernetes(dag_id, self.host) print(f"Found the job with execution_date {execution_date}") # Wait some time for the operator to complete self.monitor_task( host=self.host, dag_r...
identifier_body
test_kubernetes_executor.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
dag_run_id=dag_run_id, dag_id=dag_id, task_id='other_namespace_task', expected_final_state='success', timeout=300, ) self.ensure_dag_expected_state( host=self.host, execution_date=execution_date, dag_id=dag_...
random_line_split
test_kubernetes_executor.py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
(self): dag_id = 'example_kubernetes_executor' dag_run_id, execution_date = self.start_job_in_kubernetes(dag_id, self.host) print(f"Found the job with execution_date {execution_date}") # Wait some time for the operator to complete self.monitor_task( host=self.host, ...
test_integration_run_dag
identifier_name
BLASTing.py
####### LICENSE ####### # This code is part of the Recombineering module, written by Gregory # Moyerbrailean at Michigan State University, Department of Microbiology # and Molecular Genetics. # Copyright (C) 2010 Gregory Moyerbrailean # # This program is free software; you can redistribute it and/or modify # it under...
g = g.replace('\n','') return g
return p def openGenome(gpath): fd = open(gpath+'.fasta') g = fd.read()
random_line_split
BLASTing.py
####### LICENSE ####### # This code is part of the Recombineering module, written by Gregory # Moyerbrailean at Michigan State University, Department of Microbiology # and Molecular Genetics. # Copyright (C) 2010 Gregory Moyerbrailean # # This program is free software; you can redistribute it and/or modify # it under...
# Modify the genome filename to reflect the path to the genome genome = genome.replace(' ','') genomePath = 'Files/genome/' + genome + '/' + genome ## Call blast+ from python cline = ncl(query=queryFile,db=genomePath,out=outputFile,outfmt=5) ret_code = subprocess.call(str(cline),shell=True) ...
print "In BLASTing.BlastGenome"
conditional_block
BLASTing.py
####### LICENSE ####### # This code is part of the Recombineering module, written by Gregory # Moyerbrailean at Michigan State University, Department of Microbiology # and Molecular Genetics. # Copyright (C) 2010 Gregory Moyerbrailean # # This program is free software; you can redistribute it and/or modify # it under...
(genomePath): l,t = getTermRegion(genomePath+'.txt') buff = 0.05 * l high = t + buff low = t - buff return high,low def getTermRegion(path): fd = open(path) info = fd.read() l,t = info.split('\n') l,t = int(l),int(t) return l,t def getDirection(line): if '(+)' in line:...
getRelativeLocation
identifier_name
BLASTing.py
####### LICENSE ####### # This code is part of the Recombineering module, written by Gregory # Moyerbrailean at Michigan State University, Department of Microbiology # and Molecular Genetics. # Copyright (C) 2010 Gregory Moyerbrailean # # This program is free software; you can redistribute it and/or modify # it under...
def getTermRegion(path): fd = open(path) info = fd.read() l,t = info.split('\n') l,t = int(l),int(t) return l,t def getDirection(line): if '(+)' in line: d = 'forward' elif '(-)' in line: d = 'reverse' return d def getLocation(num,high,low): if num < low: ...
l,t = getTermRegion(genomePath+'.txt') buff = 0.05 * l high = t + buff low = t - buff return high,low
identifier_body
textpad.py
# -*- coding: utf-8 -*- #Ege Öz from PyQt4 import QtCore, QtGui import sys,os try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, ...
self): QtGui.QMessageBox.about(None, "About", "Ege Öz 2014") def yeni(self): self.textEdit.clear() def ac(self): self.afilename = QtGui.QFileDialog.getOpenFileName(None, "Open File", "",os.getenv("USER")) f=open (self.afilename,"r") data=f.read() self.textEdit.setText(data) f.close() self.status...
akkinda(
identifier_name
textpad.py
# -*- coding: utf-8 -*- #Ege Öz from PyQt4 import QtCore, QtGui import sys,os try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, ...
self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName(_fromUtf8("gridLayout")) self.textEdit = QtGui.QTextEdit(self.centralwidget) self.textEdit.setObjectName(_fromUtf8("textEdit")) font = QtGui.QFont() font.setFamily(_fromUtf8("Monospace")) self.textEdit.setFont(font) se...
random_line_split
textpad.py
# -*- coding: utf-8 -*- #Ege Öz from PyQt4 import QtCore, QtGui import sys,os try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, ...
port sys app = QtGui.QApplication(sys.argv) MainWindow = QtGui.QMainWindow() ui = Ui_MainWindow() ui.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_())
conditional_block
textpad.py
# -*- coding: utf-8 -*- #Ege Öz from PyQt4 import QtCore, QtGui import sys,os try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, ...
def yeni(self): self.textEdit.clear() def ac(self): self.afilename = QtGui.QFileDialog.getOpenFileName(None, "Open File", "",os.getenv("USER")) f=open (self.afilename,"r") data=f.read() self.textEdit.setText(data) f.close() self.statusbar.showMessage("File opened.") def kaydet(self): f=open (...
tGui.QMessageBox.about(None, "About", "Ege Öz 2014")
identifier_body
decoder.rs
2, padded_width: usize, state: JPEGState, } impl<R: Read>JPEGDecoder<R> { /// Create a new decoder that decodes from the stream ```r``` pub fn new(r: R) -> JPEGDecoder<R> { let h: HuffTable = Default::default(); JPEGDecoder { r: r, qtables: [0u8; 64 * 4], ...
(&mut self) -> ImageResult<()> { let _frame_length = try!(self.r.read_u16::<BigEndian>()); let sample_precision = try!(self.r.read_u8()); if sample_precision != 8 { return Err(image::ImageError::UnsupportedError(format!( "A sample precision of {} is not supported", ...
read_frame_header
identifier_name
decoder.rs
while table_length > 0 { let pqtq = try!(self.r.read_u8()); let pq = pqtq >> 4; let tq = pqtq & 0x0F; if pq != 0 || tq > 3 { return Err(image::ImageError::FormatError("Quantization table malformed.".to_string())) } let sli...
(r, g, b) } // Section F.2.2.1
random_line_split
decoder.rs
2, padded_width: usize, state: JPEGState, } impl<R: Read>JPEGDecoder<R> { /// Create a new decoder that decodes from the stream ```r``` pub fn new(r: R) -> JPEGDecoder<R> { let h: HuffTable = Default::default(); JPEGDecoder { r: r, qtables: [0u8; 64 * 4], ...
return Err(image::ImageError::UnsupportedError(format!( "Frames with {} components are not supported", self.num_components ))) } self.padded_width = 8 * ((self.width as usize + 7) / 8); let num_components = self.num_components; se...
{ let _frame_length = try!(self.r.read_u16::<BigEndian>()); let sample_precision = try!(self.r.read_u8()); if sample_precision != 8 { return Err(image::ImageError::UnsupportedError(format!( "A sample precision of {} is not supported", sample_precision...
identifier_body
nist-spce.rs
// Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license //! Testing energy computation for SPC/E water using data from //! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-9%C3%A5-cutoff
use lumol::consts::K_BOLTZMANN; use lumol::energy::{CoulombicPotential, Ewald, PairRestriction, SharedEwald}; use lumol::energy::{LennardJones, NullPotential, PairInteraction}; use lumol::sys::{System, UnitCell}; use lumol::sys::TrajectoryBuilder; use std::fs::File; use std::io::prelude::*; use std::path::Path; pub ...
//! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-10å-cutoff extern crate lumol;
random_line_split
nist-spce.rs
// Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license //! Testing energy computation for SPC/E water using data from //! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-9%C3%A5-cutoff //! https://www.nist.gov/mml/csd/c...
.expect("'c' cell parameter is not a float"); system.cell = UnitCell::ortho(a, b, c); for i in 0..system.size() { if i % 3 == 0 { system.add_bond(i, i + 1); system.add_bond(i, i + 2); } } for particle in system.particles_mut() { ...
let path = Path::new(file!()).parent().unwrap().join("data").join("nist-spce").join(path); let mut system = TrajectoryBuilder::new().open(&path).and_then(|mut traj| traj.read()).unwrap(); let mut file = File::open(path).unwrap(); let mut buffer = String::new(); file.read_to_string(&mut buffer).unwra...
identifier_body
nist-spce.rs
// Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license //! Testing energy computation for SPC/E water using data from //! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-9%C3%A5-cutoff //! https://www.nist.gov/mml/csd/c...
{ let system = get_system("spce-2.xyz", 10.0); let energy = system.potential_energy() / K_BOLTZMANN; let expected = -1.06590e6; assert!(f64::abs((energy - expected) / expected) < 1e-3); } #[test] fn nist3() { let system = get_system("spce-3.xyz", 10.0); let...
t2()
identifier_name
dropday.component.ts
import { Component, OnInit } from '@angular/core'; import { Store, select, Action } from '@ngrx/store'; import { Observable } from 'rxjs'; import { Episode } from '@app/ngrx'; import { selectEpisodeDropdayLoading, selectEpisodeDropdayLoaded, selectDropdaySelectedEpisodeGuids, selectRoutedPodcastEpisodesSelectLi...
} }
random_line_split
dropday.component.ts
import { Component, OnInit } from '@angular/core'; import { Store, select, Action } from '@ngrx/store'; import { Observable } from 'rxjs'; import { Episode } from '@app/ngrx'; import { selectEpisodeDropdayLoading, selectEpisodeDropdayLoaded, selectDropdaySelectedEpisodeGuids, selectRoutedPodcastEpisodesSelectLi...
ngOnInit() { this.loading$ = this.store.pipe(select(selectEpisodeDropdayLoading)); this.loaded$ = this.store.pipe(select(selectEpisodeDropdayLoaded)); this.errors$ = this.store.pipe(select(select500ErrorReloadActions)); this.selectedEpisodes$ = this.store.pipe(select(selectDropdaySelectedEpisodeGuid...
{}
identifier_body
dropday.component.ts
import { Component, OnInit } from '@angular/core'; import { Store, select, Action } from '@ngrx/store'; import { Observable } from 'rxjs'; import { Episode } from '@app/ngrx'; import { selectEpisodeDropdayLoading, selectEpisodeDropdayLoaded, selectDropdaySelectedEpisodeGuids, selectRoutedPodcastEpisodesSelectLi...
(public store: Store<any>) {} ngOnInit() { this.loading$ = this.store.pipe(select(selectEpisodeDropdayLoading)); this.loaded$ = this.store.pipe(select(selectEpisodeDropdayLoaded)); this.errors$ = this.store.pipe(select(select500ErrorReloadActions)); this.selectedEpisodes$ = this.store.pipe(select(sel...
constructor
identifier_name
parent.js
SVG.Parent = SVG.invent({ // Initialize node create: function(element) { this.constructor.call(this, element) } // Inherit from , inherit: SVG.Element // Add class methods , extend: { // Returns all child elements children: function() { return SVG.utils.map(SVG.utils.filterSVGElements(this...
while(this.node.hasChildNodes()) this.node.removeChild(this.node.lastChild) // remove defs reference delete this._defs return this } , // Get defs defs: function() { return this.doc().defs() } } })
return this } // Remove all elements in this container , clear: function() { // remove children
random_line_split
question.module.ts
import { CommonModule } from '@angular/common' import { NgModule } from '@angular/core' import { FormsModule } from '@angular/forms'
import { IonicModule } from 'ionic-angular' import { Ng2FittextModule } from 'ng2-fittext' import { PipesModule } from '../../../../shared/pipes/pipes.module' import { WheelSelectorComponent } from '../wheel-selector/wheel-selector.component' import { AudioInputComponent } from './audio-input/audio-input.component' im...
random_line_split
question.module.ts
import { CommonModule } from '@angular/common' import { NgModule } from '@angular/core' import { FormsModule } from '@angular/forms' import { IonicModule } from 'ionic-angular' import { Ng2FittextModule } from 'ng2-fittext' import { PipesModule } from '../../../../shared/pipes/pipes.module' import { WheelSelectorCompo...
{}
QuestionModule
identifier_name
statistics_8cpp.js
var statistics_8cpp = [ [ "aggregation", "statistics_8cpp.html#adbaf34baf5d580c41e688fac33dd98f1", null ], [ "analyze_activate", "statistics_8cpp.html#a69710fef7e8144e8b21409cc664546b7", null ], [ "analyze_append", "statistics_8cpp.html#ab45bf125fca220a83a95f2600f1b58c7", null ], [ "analyze_configs", "s...
[ "centermass", "statistics_8cpp.html#a864d66d37030982165316b29f31bbde2", null ], [ "centermass_conf", "statistics_8cpp.html#a149735b34c6af7073d1c42a78cbc3c91", null ], [ "centermass_vel", "statistics_8cpp.html#a6c8032fc8cb8b31e39f6cff8c7c664b7", null ], [ "density_profile_av", "statistics_8cpp.html#aa2...
[ "calc_vanhove", "statistics_8cpp.html#a9f4538f08c2356d995754a50a28b7208", null ],
random_line_split
messages.ts
/* * MIT License * * Copyright (c) 2018 Choko (choko@curioswitch.org) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * ...
export default defineMessages({ header: { id: 'app.components.NotFoundPage.header', defaultMessage: 'This is NotFoundPage component!', }, });
import { defineMessages } from 'react-intl';
random_line_split
Visitors.ts
import { types as t } from '@babel/core'; import type { Identifier, Node } from '@babel/types'; import { warn } from '@linaria/logger'; import { peek } from '@linaria/babel-preset'; import type { VisitorKeys } from '@linaria/babel-preset'; import GraphBuilderState from './GraphBuilderState'; import identifierHandlers f...
} if (handler === 'refer') { const declaration = this.scope.addReference(node); // Let's check that it's not a global variable if (declaration) { // usage of a variable depends on its declaration this.graph.addEdge(node, declaration); const context = peek(this.context...
{ if (!parent || !parentKey) { return; } const handler = identifierHandlers[`${parent.type}:${parentKey}`]; if (typeof handler === 'function') { handler(this, node, parent, parentKey, listIdx); return; } if (handler === 'keep') { return; } if (handler === 'dec...
identifier_body
Visitors.ts
import { types as t } from '@babel/core'; import type { Identifier, Node } from '@babel/types'; import { warn } from '@linaria/logger'; import { peek } from '@linaria/babel-preset'; import type { VisitorKeys } from '@linaria/babel-preset'; import GraphBuilderState from './GraphBuilderState'; import identifierHandlers f...
return; } /* * There is an unhandled identifier. * This case should be added to ./identifierHandlers.ts */ warn( 'evaluator:shaker', 'Unhandled identifier', node.name, parent.type, parentKey, listIdx ); }, ...core, }; const isKeyOfVisitor...
{ // usage of a variable depends on its declaration this.graph.addEdge(node, declaration); const context = peek(this.context); if (context === 'lval') { // This is an identifier in the left side of an assignment expression and a variable value depends on that. this.g...
conditional_block
Visitors.ts
import { types as t } from '@babel/core'; import type { Identifier, Node } from '@babel/types'; import { warn } from '@linaria/logger'; import { peek } from '@linaria/babel-preset'; import type { VisitorKeys } from '@linaria/babel-preset'; import GraphBuilderState from './GraphBuilderState'; import identifierHandlers f...
listIdx: number | null = null ) { if (!parent || !parentKey) { return; } const handler = identifierHandlers[`${parent.type}:${parentKey}`]; if (typeof handler === 'function') { handler(this, node, parent, parentKey, listIdx); return; } if (handler === 'keep') { r...
parentKey: VisitorKeys<TParent> | null,
random_line_split
Visitors.ts
import { types as t } from '@babel/core'; import type { Identifier, Node } from '@babel/types'; import { warn } from '@linaria/logger'; import { peek } from '@linaria/babel-preset'; import type { VisitorKeys } from '@linaria/babel-preset'; import GraphBuilderState from './GraphBuilderState'; import identifierHandlers f...
<TParent extends Node>( this: GraphBuilderState, node: Identifier, parent: TParent | null, parentKey: VisitorKeys<TParent> | null, listIdx: number | null = null ) { if (!parent || !parentKey) { return; } const handler = identifierHandlers[`${parent.type}:${parentKey}`]; if ...
Identifier
identifier_name
CVI_1004.py
# -*- coding: utf-8 -*- """ auto rule template ~~~~ :author: LoRexxar <LoRexxar@gmail.com> :homepage: https://github.com/LoRexxar/Kunlun-M :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 LoRexxar. All rights reserved """ from utils.api import * class CVI_100...
return match return None
conditional_block
CVI_1004.py
# -*- coding: utf-8 -*- """ auto rule template ~~~~ :author: LoRexxar <LoRexxar@gmail.com> :homepage: https://github.com/LoRexxar/Kunlun-M :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 LoRexxar. All rights reserved """ from utils.api import * class CVI_100...
ut just for sql statements :return: """ sql_sen = regex_string[0][0] reg = "\$\w+" if re.search(reg, sql_sen, re.I): p = re.compile(reg) match = p.findall(sql_sen) return match return None
inp
identifier_name
CVI_1004.py
# -*- coding: utf-8 -*- """ auto rule template ~~~~ :author: LoRexxar <LoRexxar@gmail.com> :homepage: https://github.com/LoRexxar/Kunlun-M :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 LoRexxar. All rights reserved """ from utils.api import * class CVI_100...
ents :return: """ sql_sen = regex_string[0][0] reg = "\$\w+" if re.search(reg, sql_sen, re.I): p = re.compile(reg) match = p.findall(sql_sen) return match return None
identifier_body
CVI_1004.py
# -*- coding: utf-8 -*- """ auto rule template ~~~~ :author: LoRexxar <LoRexxar@gmail.com> :homepage: https://github.com/LoRexxar/Kunlun-M :license: MIT, see LICENSE for more details. :copyright: Copyright (c) 2017 LoRexxar. All rights reserved """ from utils.api import * class CVI_100...
# for chrome ext self.keyword = None # for regex self.unmatch = None self.vul_function = None def main(self, regex_string): """ regex string input just for sql statements :return: """ sql_sen = regex_string[0][0] reg...
random_line_split
__init__.py
from django.conf import settings, UserSettingsHolder from django.contrib.auth.models import User from django.contrib.messages.storage.fallback import FallbackStorage from django.test.client import Client from django.utils.functional import wraps from django.utils.importlib import import_module import constance.config ...
class overrider(object): """ See http://djangosnippets.org/snippets/2437/ Acts as either a decorator, or a context manager. If it's a decorator it takes a function and returns a wrapped function. If it's a contextmanager it's used with the ``with`` statement. In either event entering/exiting ...
random_line_split
__init__.py
from django.conf import settings, UserSettingsHolder from django.contrib.auth.models import User from django.contrib.messages.storage.fallback import FallbackStorage from django.test.client import Client from django.utils.functional import wraps from django.utils.importlib import import_module import constance.config ...
class LocalizingClient(LocalizingMixin, SessionAwareClient): """Client which prepends a locale so test requests can get through LocaleURLMiddleware without resulting in a locale-prefix-adding 301. Otherwise, we'd have to hard-code locales into our tests everywhere or {mock out reverse() and make Loc...
def request(self, **request): """Make a request, but prepend a locale if there isn't one already.""" # Fall back to defaults as in the superclass's implementation: path = request.get('PATH_INFO', self.defaults.get('PATH_INFO', '/')) locale, shortened = split_path(path) if not loc...
identifier_body