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 |
|---|---|---|---|---|
compute_rmsd_pdb_files.py | """
Routines to compute RMSD of all PROT_IND_ files
These routines were developed by:
Rodrigo Antonio Faccioli - rodrigo.faccioli@usp.br / rodrigo.faccioli@gmail.com
Leandro Oliveira Bortot - leandro.bortot@usp.br / leandro.obt@gmail.com
"""
import os
import sys
from collections import OrderedDict... |
main() | random_line_split | |
compute_rmsd_pdb_files.py | """
Routines to compute RMSD of all PROT_IND_ files
These routines were developed by:
Rodrigo Antonio Faccioli - rodrigo.faccioli@usp.br / rodrigo.faccioli@gmail.com
Leandro Oliveira Bortot - leandro.bortot@usp.br / leandro.obt@gmail.com
"""
import os
import sys
from collections import OrderedDict... |
def main():
pdb_path = sys.argv[1]
dict_rmsd = {}
all_pdbs = get_PROT_IND_files_pdb(pdb_path)
for pdb in all_pdbs:
aux_command = main_command.replace("@PATH_GROMACS@", path_gromacs).replace("@PROT@",pdb).replace("@NATIVE@", native)
os.system(aux_command)
temp_rmsd = open("temporary_rmsd.xvg", "r")
for li... | only_pdb_file = []
for root, dirs, files in os.walk(mypath):
for file in files:
#if file.endswith(".pdb"):
if file.find("PROT_IND_") >=0:
f_path = os.path.join(root,file)
only_pdb_file.append(f_path)
return only_pdb_file | identifier_body |
compute_rmsd_pdb_files.py | """
Routines to compute RMSD of all PROT_IND_ files
These routines were developed by:
Rodrigo Antonio Faccioli - rodrigo.faccioli@usp.br / rodrigo.faccioli@gmail.com
Leandro Oliveira Bortot - leandro.bortot@usp.br / leandro.obt@gmail.com
"""
import os
import sys
from collections import OrderedDict... |
temp_rmsd.close()
os.remove("temporary_rmsd.xvg")
#Saving dictionary
rmsd_final = open("all_rmsd.txt", "w")
d_sorted_by_value = OrderedDict(sorted(dict_rmsd.items(), key=lambda x: x[1]))
for key, value in d_sorted_by_value.items():
rmsd_final.write(str(key) +"\t" + str(value) + "\n")
rmsd_final.close()
mai... | rmsd_value = float(str(line).split()[1])
only_pdb_file_name = os.path.basename(pdb)
dict_rmsd[only_pdb_file_name] = rmsd_value | conditional_block |
move_to_fort.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pokemongo_bot import inventory
from pokemongo_bot.constants import Constants
from pokemongo_bot.walkers.walker_factory import walker_factory
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.base_task import BaseTask
from utils ... | formatted="Inventory is full. You might want to change your config to recycle more items if this message appears consistently."
)
return has_space_for_loot or self.ignore_item_count or self.bot.softban
def is_attracted(self):
return (self.lure_distance > 0)
def work... | has_space_for_loot = inventory.Items.has_space_for_loot()
if not has_space_for_loot and not self.ignore_item_count:
self.emit_event(
'inventory_full', | random_line_split |
move_to_fort.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pokemongo_bot import inventory
from pokemongo_bot.constants import Constants
from pokemongo_bot.walkers.walker_factory import walker_factory
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.base_task import BaseTask
from utils ... | forts = self.bot.get_forts(order_by_distance=True)
# Remove stops that are still on timeout
forts = filter(lambda x: x["id"] not in self.bot.fort_timeouts, forts)
next_attracted_pts, lure_distance = self._get_nearest_fort_on_lure_way(forts)
# Remove all forts which were spun in the la... | identifier_body | |
move_to_fort.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pokemongo_bot import inventory
from pokemongo_bot.constants import Constants
from pokemongo_bot.walkers.walker_factory import walker_factory
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.base_task import BaseTask
from utils ... |
return lures[0], dist_lure_me
else:
return None, 0
def get_nearest_fort(self):
forts = self.bot.get_forts(order_by_distance=True)
# Remove stops that are still on timeout
forts = filter(lambda x: x["id"] not in self.bot.fort_timeouts, forts)
next... | dist_lure_fort = distance(
fort['latitude'],
fort['longitude'],
lures[0]['latitude'],
lures[0]['longitude'])
dist_fort_me = distance(
fort['latitude'],
fort['longitude'],
... | conditional_block |
move_to_fort.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pokemongo_bot import inventory
from pokemongo_bot.constants import Constants
from pokemongo_bot.walkers.walker_factory import walker_factory
from pokemongo_bot.worker_result import WorkerResult
from pokemongo_bot.base_task import BaseTask
from utils ... | (self):
self.lure_distance = 0
self.lure_attraction = self.config.get("lure_attraction", True)
self.lure_max_distance = self.config.get("lure_max_distance", 2000)
self.ignore_item_count = self.config.get("ignore_item_count", False)
self.walker = self.config.get('walker', 'StepWal... | initialize | identifier_name |
fSequence.py | import collections
class fSeq:
def __init__(self, fNumbers):
self.fNumbers = fNumbers
self.seq = self.fSequence()
self.fDecom = self.fDecomposition()
def fSequence(self):
if self.fNumbers == 1:
fSeq = [1]
else:
fSeq = [1, 1] |
def fDecomposition(self):
d = {}
for i in range(2**self.fNumbers):
fmt = '{0:0' + str(self.fNumbers) + 'b}'
binToSubset = map(int, list(fmt.format(i)))
property_asel = [val for is_good, val in zip(binToSubset, self.seq) if is_good]
d.setdefault(sum(pr... | if self.fNumbers > 2:
for i in range(2, self.fNumbers):
fSeq.append(fSeq[i-2]+fSeq[i-1])
return fSeq | random_line_split |
fSequence.py | import collections
class fSeq:
| property_asel = [val for is_good, val in zip(binToSubset, self.seq) if is_good]
d.setdefault(sum(property_asel), []).append(binToSubset)
return d
def toon(self):
print self.seq
if __name__ == '__main__':
test = fSeq(5)
for i in range(12):
print 'i', test.fDe... | def __init__(self, fNumbers):
self.fNumbers = fNumbers
self.seq = self.fSequence()
self.fDecom = self.fDecomposition()
def fSequence(self):
if self.fNumbers == 1:
fSeq = [1]
else:
fSeq = [1, 1]
if self.fNumbers > 2:
for i i... | identifier_body |
fSequence.py | import collections
class | :
def __init__(self, fNumbers):
self.fNumbers = fNumbers
self.seq = self.fSequence()
self.fDecom = self.fDecomposition()
def fSequence(self):
if self.fNumbers == 1:
fSeq = [1]
else:
fSeq = [1, 1]
if self.fNumbers > 2:
f... | fSeq | identifier_name |
fSequence.py | import collections
class fSeq:
def __init__(self, fNumbers):
self.fNumbers = fNumbers
self.seq = self.fSequence()
self.fDecom = self.fDecomposition()
def fSequence(self):
if self.fNumbers == 1:
|
else:
fSeq = [1, 1]
if self.fNumbers > 2:
for i in range(2, self.fNumbers):
fSeq.append(fSeq[i-2]+fSeq[i-1])
return fSeq
def fDecomposition(self):
d = {}
for i in range(2**self.fNumbers):
fmt = '{0:0' + str(sel... | fSeq = [1] | conditional_block |
__init__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero Ge... | random_line_split | |
heartbeats.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 self::synchronized_heartbeat::{heartbeat_window_callback, lock_and_work};
use heartbeats_simple::HeartbeatPow... |
}
}
}
| {
for (_, v) in (*hbs_ptr).iter_mut() {
if &v.hb as *const HeartbeatContext == hb {
log_heartbeat_records(v);
}
}
} | conditional_block |
heartbeats.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 self::synchronized_heartbeat::{heartbeat_window_callback, lock_and_work};
use heartbeats_simple::HeartbeatPow... |
#[cfg(not(target_os = "android"))]
fn get_heartbeat_log(category: &ProfilerCategory) -> Option<File> {
var_os(format!("SERVO_HEARTBEAT_LOG_{:?}", category)).and_then(|name| open_heartbeat_log(&name))
}
fn get_heartbeat_window_size(category: &ProfilerCategory) -> usize {
const WINDOW_SIZE_DEFAULT: usize = 1;
... | {
open_heartbeat_log(format!("/sdcard/servo/heartbeat-{:?}.log", category))
} | identifier_body |
heartbeats.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 self::synchronized_heartbeat::{heartbeat_window_callback, lock_and_work};
use heartbeats_simple::HeartbeatPow... | (category: &ProfilerCategory) -> bool {
opts::get().profile_heartbeats ||
var_os(format!("SERVO_HEARTBEAT_ENABLE_{:?}", category)).is_some()
}
fn open_heartbeat_log<P: AsRef<Path>>(name: P) -> Option<File> {
match File::create(name) {
Ok(f) => Some(f),
Err(e) => {
warn!("Fai... | is_create_heartbeat | identifier_name |
heartbeats.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 self::synchronized_heartbeat::{heartbeat_window_callback, lock_and_work};
use heartbeats_simple::HeartbeatPow... | let logfile: Option<File> = get_heartbeat_log(&category);
// window size
let window_size: usize = get_heartbeat_window_size(&category);
// create the heartbeat
match Heartbeat::new(window_size, Some(heartbeat_window_callback), logfile) {
Ok(hb) => {
de... | category: ProfilerCategory,
) {
if is_create_heartbeat(&category) {
// get optional log file | random_line_split |
user.js | window.initUserList = () => {
initUserSelections();
initUserDeleteBtn();
initUserMergeBtn();
};
const initUserSelections = () => {
$('input[name=user_db]').each(function() {
userSelectRow($(this));
});
$('#select-all').change(function() {
$('input[name=user_db]').prop('checked', $(this).is(':checke... | {
user_keys: user_keys.join(','),
},
(err, result) => {
if (err) {
$('input[name=user_db]:disabled').removeAttr('disabled');
showNotification(
errorMessage.replace('{users}', user_keys.length),
'danger',
);
... | deleteUrl, | random_line_split |
user.js | window.initUserList = () => {
initUserSelections();
initUserDeleteBtn();
initUserMergeBtn();
};
const initUserSelections = () => {
$('input[name=user_db]').each(function() {
userSelectRow($(this));
});
$('#select-all').change(function() {
$('input[name=user_db]').prop('checked', $(this).is(':checke... |
}
};
const initUserMergeBtn = () =>
$('#user-merge').click(function(event) {
event.preventDefault();
const user_keys = [];
$('input[name=user_db]:checked').each(function() {
user_keys.push($(this).val());
});
const user_merge_url = $(this).data('user-merge-url');
window.location.href... | {
$('input[name=user_key]').val(user_db.key);
$('input[name=username]').val(user_db.username);
$('input[name=name]').val(user_db.name);
$('input[name=email]').val(user_db.email);
break;
} | conditional_block |
test_raise_error.py | # Copyright (c) 2014 Katsuya Noguchi
#
# 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 to use, copy, modify, merge, publish, dis... | (self):
self.assertRaises(NotAuthedError,
slack.http_client._raise_error_if_not_ok,
{ 'ok': False, 'error': 'not_authed' })
def test_account_inactive(self):
self.assertRaises(AccountInactiveError,
slack.http_client._raise... | test_not_authed | identifier_name |
test_raise_error.py | # Copyright (c) 2014 Katsuya Noguchi
#
# 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 to use, copy, modify, merge, publish, dis... |
def test_invalid_auth(self):
self.assertRaises(InvalidAuthError,
slack.http_client._raise_error_if_not_ok,
{ 'ok': False, 'error': 'invalid_auth' })
def test_not_authed(self):
self.assertRaises(NotAuthedError,
slack... | slack.http_client._raise_error_if_not_ok({ 'ok': True }) | identifier_body |
test_raise_error.py | # Copyright (c) 2014 Katsuya Noguchi
#
# 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 to use, copy, modify, merge, publish, dis... | slack.http_client._raise_error_if_not_ok,
{ 'ok': False, 'error': 'invalid_auth' })
def test_not_authed(self):
self.assertRaises(NotAuthedError,
slack.http_client._raise_error_if_not_ok,
{ 'ok': False, '... | slack.http_client._raise_error_if_not_ok({ 'ok': True })
def test_invalid_auth(self):
self.assertRaises(InvalidAuthError, | random_line_split |
python_mandelbrot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2012 zod.yslin
#
# 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 ... |
START_TIME = time.time()
execute()
print '\nPython Elapsed %.02f' % (time.time() - START_TIME)
| """
func doc string
"""
print 'Rendering...'
for dim_1 in xrange(-39, 39):
stdout.write('\n')
for dim_2 in xrange(-39, 39):
if mandelbrot(dim_1/40.0, dim_2/40.0) :
stdout.write(' ')
else:
stdout.write('*') | identifier_body |
python_mandelbrot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2012 zod.yslin
#
# 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 ... | # limitations under the License.
#
# Author: zod.yslin
# Email:
# File Name: python_mandelbrot.py
# Description:
#
# Edit History:
# 2012-01-27 File created.
#===============================================================================
#!/usr/local/bin/python
# by Daniel Rosengren, modified by e-satis
"""
... | # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and | random_line_split |
python_mandelbrot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2012 zod.yslin
#
# 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 ... | (dim_1, dim_2):
"""
function doc string
"""
cr1 = dim_1 - 0.5
ci1 = dim_2
zi1 = 0.0
zr1 = 0.0
for i in xrange(MAX_ITERATIONS) :
temp = zr1 * zi1
zr2 = zr1 * zr1
zi2 = zi1 * zi1
zr1 = zr2 - zi2 + cr1
zi1 = temp + temp + ci1
if zi2 + zr2 > ... | mandelbrot | identifier_name |
python_mandelbrot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2012 zod.yslin
#
# 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 ... |
else:
stdout.write('*')
START_TIME = time.time()
execute()
print '\nPython Elapsed %.02f' % (time.time() - START_TIME)
| stdout.write(' ') | conditional_block |
storage.py | """URI API
This file contains the part of the blaze API dealing with URIs. The
"URI API". In Blaze persistence is provided by the means of this URI
API, that allows specifying a "location" for an array as an URI.
The URI API allows:
- saving existing arrays to an URI.
- loading an array into memory from an URI.
- ... |
def _persist_convert(persist):
if not isinstance(persist, Storage):
if isinstance(persist, str):
persist = Storage(persist)
else:
raise ValueError('persist argument must be either a'
'URI string or Storage object')
return persist
# --------... | raise ValueError("Cannot determine format from: %s" % uri)
if self._format not in self.SUPPORTED_FORMATS:
raise ValueError("`format` '%s' is not supported." % self._format)
| random_line_split |
storage.py | """URI API
This file contains the part of the blaze API dealing with URIs. The
"URI API". In Blaze persistence is provided by the means of this URI
API, that allows specifying a "location" for an array as an URI.
The URI API allows:
- saving existing arrays to an URI.
- loading an array into memory from an URI.
- ... |
def _persist_convert(persist):
if not isinstance(persist, Storage):
if isinstance(persist, str):
persist = Storage(persist)
else:
raise ValueError('persist argument must be either a'
'URI string or Storage object')
return persist
# ------... | raise ValueError("`format` '%s' is not supported." % self._format) | conditional_block |
storage.py | """URI API
This file contains the part of the blaze API dealing with URIs. The
"URI API". In Blaze persistence is provided by the means of this URI
API, that allows specifying a "location" for an array as an URI.
The URI API allows:
- saving existing arrays to an URI.
- loading an array into memory from an URI.
- ... |
def _set_format_and_path_from_uri(self, uri, format=None):
"""Parse the uri into the format and path"""
up = urlparse.urlparse(self._uri)
if up.scheme in self.SUPPORTED_FORMATS:
warnings.warn("Blaze no longer uses file type in network protocol field of the uri. "
... | args = ["uri=%s" % self._uri, "mode=%s" % self._mode]
return '%s(%s)' % (self.__class__.__name__, ', '.join(args)) | identifier_body |
storage.py | """URI API
This file contains the part of the blaze API dealing with URIs. The
"URI API". In Blaze persistence is provided by the means of this URI
API, that allows specifying a "location" for an array as an URI.
The URI API allows:
- saving existing arrays to an URI.
- loading an array into memory from an URI.
- ... | (persist, **kwargs):
"""Open an existing persistent CSV array.
Parameters
----------
persist : a Storage instance
The Storage instance specifies, among other things, path of
where the array is stored.
kwargs : a dictionary
Put here different parameters depending on the forma... | from_csv | identifier_name |
get-lang-arg.js | )
- `undefined` (otherwise)
- `init` assigns the value of `commandOptions.lang` to the returned result
- downstream, the `lang` attribute is assigned via inline template control:
- file: `blueprints/app/files/app/index.html`
- logic: `<html<% if(lang) { %> lang="<%= lang %>"<% } %>>
Internal Mechanics ... | (langArg) {
return isLangCode(langArg).res;
}
// Generates the result to pass back to `init`
function getResult(langArg) {
return isValidLangCode(langArg) ? langArg : undefined;
}
/*
Misuse case: attempt to set application programming language via `lang`
AND
Edge case: valid language code AND a common programming... | isValidLangCode | identifier_name |
get-lang-arg.js | )
- `undefined` (otherwise)
- `init` assigns the value of `commandOptions.lang` to the returned result
- downstream, the `lang` attribute is assigned via inline template control:
- file: `blueprints/app/files/app/index.html`
- logic: `<html<% if(lang) { %> lang="<%= lang %>"<% } %>>
Internal Mechanics ... | function getLangCodeMsg(langArg) {
return isLangCode(langArg).message;
}
// Edge case: valid language code AND a common programming language abbreviation
function getValidAndProgMsg(langArg) {
return `The \`--lang\` flag has been used with argument \`${langArg}\`,
which is BOTH a valid language code AND an abbre... | // 2. `BODY` Messages: category-dependent context information
// Message context from language code validation (valid: null, invalid: reason) | random_line_split |
get-lang-arg.js | language via `lang`
AND
Edge case: valid language code AND a common programming language abbreviation
-------------------------------------------------------------------------------
It is possible that a user might mis-interpret the type of `language` that is
specified by the `--lang` flag. One notable potential `misu... | {
writeFullMsg(fullMsg, ui);
} | conditional_block | |
get-lang-arg.js | - `undefined` (otherwise)
- `init` assigns the value of `commandOptions.lang` to the returned result
- downstream, the `lang` attribute is assigned via inline template control:
- file: `blueprints/app/files/app/index.html`
- logic: `<html<% if(lang) { %> lang="<%= lang %>"<% } %>>
Internal Mechanics --... |
// 3. `STATUS` message: report if `lang` will be set in `index.html`
function getStatusMsg(langArg, willSet) {
return `The human language of the application will ${willSet ? `be set to ${langArg}` : `NOT be set`} in
the \`<html>\` element's \`lang\` attribute in \`index.html\`.`;
}
// 4. `HELP` message: | {
return `Detected a \`--lang\` specification starting with command flag \`-\`.
This issue is likely caused by using the \`--lang\` flag without a specification.`;
} | identifier_body |
app.ts | import { Aurelia } from 'aurelia-framework';
import { Router, RouterConfiguration, NavigationInstruction, Next } from 'aurelia-router';
import { PLATFORM } from 'aurelia-pal';
import 'semantic-ui-less/semantic.less';
import './app.less'
export class App {
router: Router;
app_query: string;
stickyHeight: n... | this.handleScroll = e => {
this.showBar = window.pageYOffset > 0;
};
}
configureRouter(config: RouterConfiguration, router: Router) {
config.title = 'Pliance.io';
config.options.pushState = true;
config.map([
{ route: ['', 'home'], name: 'home', m... |
constructor() {
this.showBar = false; | random_line_split |
app.ts | import { Aurelia } from 'aurelia-framework';
import { Router, RouterConfiguration, NavigationInstruction, Next } from 'aurelia-router';
import { PLATFORM } from 'aurelia-pal';
import 'semantic-ui-less/semantic.less';
import './app.less'
export class App {
router: Router;
app_query: string;
stickyHeight: n... | () {
document.getElementById('example').addEventListener('scroll', this.handleScroll);
document.addEventListener('scroll', this.handleScroll);
}
detached() {
document.getElementById('example').removeEventListener('scroll', this.handleScroll);
document.removeEventListener('scroll... | attached | identifier_name |
app.ts | import { Aurelia } from 'aurelia-framework';
import { Router, RouterConfiguration, NavigationInstruction, Next } from 'aurelia-router';
import { PLATFORM } from 'aurelia-pal';
import 'semantic-ui-less/semantic.less';
import './app.less'
export class App {
router: Router;
app_query: string;
stickyHeight: n... |
return next();
}
});
this.router = router;
}
search($event: any): void {
this.router.navigateToRoute("personsearch", { query: this.app_query });
}
attached() {
document.getElementById('example').addEventListener('scroll', this.handleScroll)... | {
window.scroll(0, 0);
} | conditional_block |
app.ts | import { Aurelia } from 'aurelia-framework';
import { Router, RouterConfiguration, NavigationInstruction, Next } from 'aurelia-router';
import { PLATFORM } from 'aurelia-pal';
import 'semantic-ui-less/semantic.less';
import './app.less'
export class App {
router: Router;
app_query: string;
stickyHeight: n... |
configureRouter(config: RouterConfiguration, router: Router) {
config.title = 'Pliance.io';
config.options.pushState = true;
config.map([
{ route: ['', 'home'], name: 'home', moduleId: PLATFORM.moduleName('./home/home'), nav: true, title: 'AreaEd' },
{ route: ['ne... | {
this.showBar = false;
this.handleScroll = e => {
this.showBar = window.pageYOffset > 0;
};
} | identifier_body |
modal.js | !function(namespace) {
'use strict';
function Modal(elem, params) |
Modal.prototype.__construct = function __construct() {
this.$box = this.$element.find('.JS-Modal-Box');
this.$close = this.$element.find('.JS-Modal-Close');
this.$title = this.$element.find('.JS-Modal-Title');
this.$container = this.$element.find('.JS-Modal-Container');
this._init();
};
Mo... | {
this.$element = jQuery(elem);
this.params = params || {};
this.cssReadyElement = this.params.cssReadyElement || 'JS-Modal-ready';
this.cssActiveElement = this.params.cssActiveElement || 'JS-Modal-active';
this.__construct();
} | identifier_body |
modal.js | !function(namespace) {
'use strict';
function | (elem, params) {
this.$element = jQuery(elem);
this.params = params || {};
this.cssReadyElement = this.params.cssReadyElement || 'JS-Modal-ready';
this.cssActiveElement = this.params.cssActiveElement || 'JS-Modal-active';
this.__construct();
}
Modal.prototype.__construct = function __construct... | Modal | identifier_name |
modal.js | !function(namespace) {
'use strict';
function Modal(elem, params) {
this.$element = jQuery(elem);
this.params = params || {};
this.cssReadyElement = this.params.cssReadyElement || 'JS-Modal-ready';
this.cssActiveElement = this.params.cssActiveElement || 'JS-Modal-active';
this.__construct();
... |
namespace.Modal = Modal;
}(this); | };
Modal.prototype.clear = function clear() {
this._clear();
}; | random_line_split |
modal.js | !function(namespace) {
'use strict';
function Modal(elem, params) {
this.$element = jQuery(elem);
this.params = params || {};
this.cssReadyElement = this.params.cssReadyElement || 'JS-Modal-ready';
this.cssActiveElement = this.params.cssActiveElement || 'JS-Modal-active';
this.__construct();
... |
};
Modal.prototype._clear = function _clear() {
};
/* API. Methods */
Modal.prototype.setContent = function setContent(content) {
if (!arguments.length) {
return false;
}
this._setContent(content);
};
Modal.prototype.open = function open() {
this._open();
};
Modal.prototype... | {
this.$element
.removeClass(this.cssActiveElement)
.removeClass('JS-Modal-active');
} | conditional_block |
dis_files.py | import magics
__all__ = ['by_version', 'by_magic']
_fallback = {
'EXTENDED_ARG': None,
'hasfree': [],
}
class dis(object):
def __init__(self, version, module):
self._version = version
from __builtin__ import __import__
self._module = __import__('decompyle.%s' % module, globals... |
else:
raise e
return val
by_version = {
'1.5': dis('1.5', 'dis_15'),
'1.6': dis('1.6', 'dis_16'),
'2.0': dis('2.0', 'dis_20'),
'2.1': dis('2.1', 'dis_21'),
'2.2': dis('2.2', 'dis_22'),
'2.3': dis('2.3', 'dis_23'),
'2.4': dis('2.4', 'dis_24'),
'2.5': ... | val = _fallback[attr] | conditional_block |
dis_files.py | import magics
__all__ = ['by_version', 'by_magic']
_fallback = {
'EXTENDED_ARG': None,
'hasfree': [],
}
class dis(object):
def __init__(self, version, module):
|
def __getattr__(self, attr):
try:
val = self._module.__dict__[attr]
except KeyError, e:
if _fallback.has_key(attr):
val = _fallback[attr]
else:
raise e
return val
by_version = {
'1.5': dis('1.5', 'dis_15'),
'1.6':... | self._version = version
from __builtin__ import __import__
self._module = __import__('decompyle.%s' % module, globals(),
locals(), 'decompyle') | identifier_body |
dis_files.py | import magics
__all__ = ['by_version', 'by_magic']
_fallback = {
'EXTENDED_ARG': None,
'hasfree': [],
}
class dis(object):
def __init__(self, version, module):
self._version = version
from __builtin__ import __import__
self._module = __import__('decompyle.%s' % module, globals... | for m, ver in by_magic.items():
magics.__show(ver, m)
print by_version['2.2'].hasjrel | random_line_split | |
dis_files.py | import magics
__all__ = ['by_version', 'by_magic']
_fallback = {
'EXTENDED_ARG': None,
'hasfree': [],
}
class | (object):
def __init__(self, version, module):
self._version = version
from __builtin__ import __import__
self._module = __import__('decompyle.%s' % module, globals(),
locals(), 'decompyle')
def __getattr__(self, attr):
try:
val = se... | dis | identifier_name |
sr.js | /*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'docprops', 'sr', {
bgColor: 'Боја позадине',
bgFixed: 'Фиксирана позадина',
bgImage: 'УРЛ позадинске слике',
charset: 'Кодирање скупа карактера',... | previewHtml: '<p>This is some <strong>sample text</strong>. You are using <a href="javascript:void(0)">CKEditor</a>.</p>', // MISSING
title: 'Особине документа',
txtColor: 'Боја текста',
xhtmlDec: 'Улључи XHTML декларације'
} ); | metaAuthor: 'Аутор',
metaCopyright: 'Ауторска права',
metaDescription: 'Опис документа',
metaKeywords: 'Кључне речи за индексирање документа (раздвојене зарезом)',
other: '<other>', | random_line_split |
fodtitalicsheets.py | #!/usr/bin/env python3
# Combine SVG Images of Italic Practice Sheets into an OpenDocument Document
# Written in 2014 by Jordan Vaughan
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software ... |
for index, path in enumerate(args.sheetimage):
add_image(path, index, "Standard" if index is 0 else "P1")
sys.stdout.write(""" </office:text>
</office:body>
</office:document>\n""")
if errors:
sys.exit(2)
| sys.stdout.write(""" <text:p text:style-name="{0}"><draw:frame draw:style-name="fr1" draw:name="n{1}" text:anchor-type="paragraph" svg:width="{2}{4}" svg:height="{3}{4}" draw:z-index="0"><draw:image><office:binary-data>""".format(paragraph_style, imgno, imgwidth, imgheight, args.units))
data = None
try:
with o... | identifier_body |
fodtitalicsheets.py | #!/usr/bin/env python3
# Combine SVG Images of Italic Practice Sheets into an OpenDocument Document
# Written in 2014 by Jordan Vaughan
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software ... |
sys.stdout.write("""</office:binary-data></draw:image></draw:frame></text:p>\n""")
for index, path in enumerate(args.sheetimage):
add_image(path, index, "Standard" if index is 0 else "P1")
sys.stdout.write(""" </office:text>
</office:body>
</office:document>\n""")
if errors:
sys.exit(2)
| sys.stdout.write(str(base64.b64encode(data), encoding="UTF-8")) | conditional_block |
fodtitalicsheets.py | #!/usr/bin/env python3
# Combine SVG Images of Italic Practice Sheets into an OpenDocument Document
# Written in 2014 by Jordan Vaughan
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software ... | (message):
global errors
sys.stderr.write(os.path.basename(sys.argv[0]) + ": error: " + message + "\n")
errors = True
if __name__ == "__main__":
try:
args = parser.parse_args()
except Exception:
error("invalid command line arguments (invalid syntax?)")
sys.exit(1)
if args.width <= 0:
error("width must b... | error | identifier_name |
fodtitalicsheets.py | #!/usr/bin/env python3
# Combine SVG Images of Italic Practice Sheets into an OpenDocument Document
# Written in 2014 by Jordan Vaughan
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software ... | if data:
sys.stdout.write(str(base64.b64encode(data), encoding="UTF-8"))
sys.stdout.write("""</office:binary-data></draw:image></draw:frame></text:p>\n""")
for index, path in enumerate(args.sheetimage):
add_image(path, index, "Standard" if index is 0 else "P1")
sys.stdout.write(""" </office:text>
</office... | error("unable to read " + path + ": " + e.strerror) | random_line_split |
mrp_production.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Pexego (<www.pexego.es>). All Rights Reserved
# $Omar Castiñeira Saavedra$
#
# This program is free software: you can redistribute it ... | #
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public... | # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. | random_line_split |
mrp_production.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Pexego (<www.pexego.es>). All Rights Reserved
# $Omar Castiñeira Saavedra$
#
# This program is free software: you can redistribute it ... |
self.pool.get('stock.move').write(cr, uid, [move.id], vals)
if move.move_dest_id:
self.pool.get('stock.move').write(cr, uid, [move.move_dest_id.id], {'prodlot_id': default_prodlot})
if move.move_dest_id.product_id.not_do_procuremen... | als['location_id'] = prodlot_location
| conditional_block |
mrp_production.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Pexego (<www.pexego.es>). All Rights Reserved
# $Omar Castiñeira Saavedra$
#
# This program is free software: you can redistribute it ... | osv.osv):
_inherit = 'mrp.production'
def action_confirm(self, cr, uid, ids, context=None):
"""extends this method for managing no_procurement_moves"""
if context is None: context = {}
picking_id = super(mrp_production, self).action_confirm(cr, uid, ids, context=context)
... | rp_production( | identifier_name |
mrp_production.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Pexego (<www.pexego.es>). All Rights Reserved
# $Omar Castiñeira Saavedra$
#
# This program is free software: you can redistribute it ... | self.pool.get('stock.move').write(cr, uid, [move.move_dest_id.id], {'location_id': move.product_id.product_tmpl_id.property_raw.id})
if move.move_dest_id.product_id.miscible:
self.pool.get('stock.move').write(cr, uid, [move.move_dest_id.id], {'state': 'ass... | inherit = 'mrp.production'
def action_confirm(self, cr, uid, ids, context=None):
"""extends this method for managing no_procurement_moves"""
if context is None: context = {}
picking_id = super(mrp_production, self).action_confirm(cr, uid, ids, context=context)
to_delete_mov... | identifier_body |
cli.js | #!/usr/bin/env node
'use strict';
var fs = require('fs');
var stdin = require('get-stdin');
var pkg = require('./package.json');
var stripIndent = require('./');
var argv = process.argv.slice(2);
var input = argv[0];
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' strip-inden... |
if (argv.indexOf('--help') !== -1) {
help();
return;
}
if (argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}
if (process.stdin.isTTY) {
if (!input) {
help();
return;
}
init(fs.readFileSync(input, 'utf8'));
} else {
stdin(init);
}
| {
console.log(stripIndent(data));
} | identifier_body |
cli.js | #!/usr/bin/env node
'use strict';
var fs = require('fs');
var stdin = require('get-stdin');
var pkg = require('./package.json');
var stripIndent = require('./');
var argv = process.argv.slice(2);
var input = argv[0];
function | () {
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' strip-indent <file>',
' echo <string> | strip-indent',
'',
' Example',
' echo \'\\tunicorn\\n\\t\\tcake\' | strip-indent',
' unicorn',
' \tcake'
].join('\n'));
}
function init(data) {
console.log(stripIndent(data))... | help | identifier_name |
cli.js | #!/usr/bin/env node
'use strict';
var fs = require('fs');
var stdin = require('get-stdin');
var pkg = require('./package.json');
var stripIndent = require('./');
var argv = process.argv.slice(2);
var input = argv[0];
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' strip-inden... | else {
stdin(init);
}
| {
if (!input) {
help();
return;
}
init(fs.readFileSync(input, 'utf8'));
} | conditional_block |
cli.js | #!/usr/bin/env node
'use strict';
var fs = require('fs');
var stdin = require('get-stdin');
var pkg = require('./package.json');
var stripIndent = require('./');
var argv = process.argv.slice(2);
var input = argv[0];
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' strip-inden... | console.log(pkg.version);
return;
}
if (process.stdin.isTTY) {
if (!input) {
help();
return;
}
init(fs.readFileSync(input, 'utf8'));
} else {
stdin(init);
} | help();
return;
}
if (argv.indexOf('--version') !== -1) { | random_line_split |
union-transmute.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | () {
unsafe {
let mut u = U { a: (1, 1) };
assert_eq!(u.b, (1 << 8) + 1);
u.b = (2 << 8) + 2;
assert_eq!(u.a, (2, 2));
let mut w = W { a: 0b0_11111111_00000000000000000000000 };
assert_eq!(w.b, f32::INFINITY);
w.b = f32::NEG_INFINITY;
assert_eq!(w.a, ... | main | identifier_name |
union-transmute.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... | {
unsafe {
let mut u = U { a: (1, 1) };
assert_eq!(u.b, (1 << 8) + 1);
u.b = (2 << 8) + 2;
assert_eq!(u.a, (2, 2));
let mut w = W { a: 0b0_11111111_00000000000000000000000 };
assert_eq!(w.b, f32::INFINITY);
w.b = f32::NEG_INFINITY;
assert_eq!(w.a, 0b1... | identifier_body | |
union-transmute.rs | // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at | //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// run-pass
ext... | // http://rust-lang.org/COPYRIGHT. | random_line_split |
conf.py | import getpass
import json
import getopt
from genericpath import isfile
from os.path import sep
from pingdumb.main_module import url_type
| if not isfile(f_path):
f = open(f_path, 'w')
conf = {
"url": "jellyms.kr",
"smtpServer": "smtp.gmail.com:587",
"smtpUser": "",
"toEmail": "",
"interval": 300,
}
f.write(json.dumps(conf))
f.close()
return conf... |
def read_config():
f_path = "." + sep + "pingdumb.json" | random_line_split |
conf.py | import getpass
import json
import getopt
from genericpath import isfile
from os.path import sep
from pingdumb.main_module import url_type
def read_config():
|
def write_config(conf):
if 'smtpPw' in conf:
del conf['smtpPw']
f_path = "." + sep + "pingdumb.json"
f = open(f_path, 'w')
f.truncate()
f.write(json.dumps(conf))
f.close()
def input_conf(message, default):
value = input(message)
if not value:
return default
retur... | f_path = "." + sep + "pingdumb.json"
if not isfile(f_path):
f = open(f_path, 'w')
conf = {
"url": "jellyms.kr",
"smtpServer": "smtp.gmail.com:587",
"smtpUser": "",
"toEmail": "",
"interval": 300,
}
f.write(json.dumps(conf))
... | identifier_body |
conf.py | import getpass
import json
import getopt
from genericpath import isfile
from os.path import sep
from pingdumb.main_module import url_type
def read_config():
f_path = "." + sep + "pingdumb.json"
if not isfile(f_path):
f = open(f_path, 'w')
conf = {
"url": "jellyms.kr",
... |
def write_config(conf):
if 'smtpPw' in conf:
del conf['smtpPw']
f_path = "." + sep + "pingdumb.json"
f = open(f_path, 'w')
f.truncate()
f.write(json.dumps(conf))
f.close()
def input_conf(message, default):
value = input(message)
if not value:
return default
retur... | f = open(f_path, 'r+b')
conf = json.loads(f.read().decode('utf-8'))
f.close()
return conf | conditional_block |
conf.py | import getpass
import json
import getopt
from genericpath import isfile
from os.path import sep
from pingdumb.main_module import url_type
def read_config():
f_path = "." + sep + "pingdumb.json"
if not isfile(f_path):
f = open(f_path, 'w')
conf = {
"url": "jellyms.kr",
... | (message, default):
value = input(message)
if not value:
return default
return value
def set_config():
configure = read_config()
url_for_test = input_conf(
"URL to test? (" + configure["url"] + ")", configure["url"]
)
url_for_test = url_type(url_for_test)
recv_mail = i... | input_conf | identifier_name |
bounding_volume.rs | use crate::math::{Isometry, Point};
use na::RealField;
/// Traits of objects having a bounding volume.
pub trait HasBoundingVolume<N: RealField, BV> {
/// The bounding volume of `self` transformed by `m`.
fn bounding_volume(&self, m: &Isometry<N>) -> BV;
/// The bounding volume of `self`.
fn local_boun... |
}
/// Trait of bounding volumes.
///
/// Bounding volumes are coarse approximations of shapes. It usually have constant time
/// intersection, inclusion test. Two bounding volume must also be mergeable into a bigger bounding
/// volume.
pub trait BoundingVolume<N: RealField>: std::fmt::Debug {
// FIXME: keep that... | {
self.bounding_volume(&Isometry::identity())
} | identifier_body |
bounding_volume.rs | use crate::math::{Isometry, Point};
use na::RealField;
/// Traits of objects having a bounding volume.
pub trait HasBoundingVolume<N: RealField, BV> {
/// The bounding volume of `self` transformed by `m`.
fn bounding_volume(&self, m: &Isometry<N>) -> BV;
/// The bounding volume of `self`.
fn | (&self) -> BV {
self.bounding_volume(&Isometry::identity())
}
}
/// Trait of bounding volumes.
///
/// Bounding volumes are coarse approximations of shapes. It usually have constant time
/// intersection, inclusion test. Two bounding volume must also be mergeable into a bigger bounding
/// volume.
pub trai... | local_bounding_volume | identifier_name |
bounding_volume.rs | use crate::math::{Isometry, Point};
use na::RealField;
/// Traits of objects having a bounding volume.
pub trait HasBoundingVolume<N: RealField, BV> {
/// The bounding volume of `self` transformed by `m`.
fn bounding_volume(&self, m: &Isometry<N>) -> BV;
/// The bounding volume of `self`.
fn local_boun... | /// Merges this bounding volume with another one. The merge is done in-place.
fn merge(&mut self, _: &Self);
/// Merges this bounding volume with another one.
fn merged(&self, _: &Self) -> Self;
/// Enlarges this bounding volume.
fn loosen(&mut self, _: N);
/// Creates a new, enlarged ver... | random_line_split | |
basemanager.py | "IsSubscriber",
"HasAttachments",
"ShowOnCashBasisReports",
"IncludeInEmails",
"SentToContact",
"CanApplyToRevenue",
"CanApplyToLiabilities",
"CanApplyToExpenses",
"CanApplyToEquity",
"CanApplyToAssets",
"IsReconciled",
"EnablePaym... |
else:
val = six.text_type(sub_data)
elm.text = val
return root_elm
def _prepare_data_for_save(self, data):
if isinstance(data, list) or isinstance(data, tuple):
root_elm = Element(self.name)
for d in data:
... | val = sub_data.strftime("%Y-%m-%dT%H:%M:%S") | conditional_block |
basemanager.py | "IsSubscriber",
"HasAttachments",
"ShowOnCashBasisReports",
"IncludeInEmails",
"SentToContact",
"CanApplyToRevenue",
"CanApplyToLiabilities",
"CanApplyToExpenses",
"CanApplyToEquity",
"CanApplyToAssets",
"IsReconciled",
"EnablePaym... | (self, id, details):
"""Add a history note to the Xero object."""
uri | _put_history_data | identifier_name |
basemanager.py | "Date",
"PaymentDate",
"StartDate",
"EndDate",
"PeriodLockDate",
"DateOfBirth",
"OpeningBalanceDate",
"PaymentDueDate",
"ReportingDate",
"DeliveryDate",
"ExpectedArrivalDate",
)
BOOLEAN_FIELDS = (
"IsSupplier",
... | DATE_FIELDS = (
"DueDate", | random_line_split | |
basemanager.py | ():
# Xero will complain if we send back these fields.
if key in self.NO_SEND_FIELDS:
continue
sub_data = data[key]
elm = SubElement(root_elm, key)
# Key references a dict. Unroll the dict
# as it's own XML node with subnodes
... | """Upload an attachment to the Xero object (from file object)."""
return self.put_attachment_data(
id, filename, file.read(), content_type, include_online=include_online
) | identifier_body | |
test_run.py | # -*- coding: utf-8 -*-
#
# This file is part of hopr: https://github.com/hopr/hopr.
#
# Hopr is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | (ut.TestCase):
def test_timeout(self):
dt = 0.01
e = 0.001
timeout = Timeout(dt)
t1 = time()
while(True):
a = timeout()
t2 = time()
if t2 - t1 < dt-e:
self.assertEqual(a, False)
else:
... | Test1Misc | identifier_name |
test_run.py | # -*- coding: utf-8 -*-
#
# This file is part of hopr: https://github.com/hopr/hopr.
#
# Hopr is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
self.assertEqual(timeout(), True)
class TestParseArgs(ut.TestCase):
def setUp(self):
self.args = {'no_grab': False,
'timeout': 5,
'log_level': 'info',
'print_keymap': False,
'log_file': '',
... | t2 = time() | conditional_block |
test_run.py | # -*- coding: utf-8 -*-
#
# This file is part of hopr: https://github.com/hopr/hopr.
#
# Hopr is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... |
if __name__ == "__main__":
# import logging
# logging.getLogger().setLevel('ERROR')
ut.main(failfast=True, exit=False)
| f = tempfile.NamedTemporaryFile('r')
backend = MagicMock(name='backend')
make_eventparser = MagicMock(name='make_eventparser')
args = ['--log-level', 'debug', '--log-file', f.name]
run_parse_args(backend=backend,
make_eventparser=make_eventparser,
... | identifier_body |
test_run.py | # -*- coding: utf-8 -*-
#
# This file is part of hopr: https://github.com/hopr/hopr.
#
# Hopr is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | args=args)
logging.getLogger().debug('Test Message')
text = f.read()
self.assertTrue(text.strip().endswith('Test Message'))
if __name__ == "__main__":
# import logging
# logging.getLogger().setLevel('ERROR')
ut.main(failfast=True, exit=Fa... | make_eventparser=make_eventparser, | random_line_split |
msg.py | import ujson as json
from pprint import pprint
import msgpack
import logging
from cifsdk.constants import PYVERSION
import os
TRACE = os.environ.get('CIFSDK_CLIENT_MSG_TRACE')
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
if TRACE:
logger.setLevel(logging.DEBUG)
MAP = {
1: 'ping',
2... | (object):
PING = 1
PING_WRITE = 2
INDICATORS_CREATE = 3
INDICATORS_SEARCH = 4
INDICATORS_DELETE = 5
TOKENS_SEARCH = 6
TOKENS_CREATE = 7
TOKENS_DELETE = 8
TOKENS_EDIT = 9
def __init__(self, *args, **kwargs):
for k in kwargs:
if isinstance(kwargs[k], str):
... | Msg | identifier_name |
msg.py | import ujson as json
from pprint import pprint
import msgpack
import logging
from cifsdk.constants import PYVERSION
import os
TRACE = os.environ.get('CIFSDK_CLIENT_MSG_TRACE')
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
if TRACE:
logger.setLevel(logging.DEBUG)
MAP = {
1: 'ping',
2... |
def recv(self, s):
m = s.recv_multipart()
if len(m) == 6:
id, client_id, null, token, mtype, data = m
mtype = msgpack.unpackb(mtype)
mtype = MAP[mtype]
return id, client_id, token.decode('utf-8'), mtype, data.decode('utf-8')
elif len(m) == ... | m = {
'id': self.id,
'mtype': self.mtype,
'token': self.token,
'data': self.data,
}
return json.dumps(m) | identifier_body |
msg.py | import ujson as json
from pprint import pprint
import msgpack
import logging
from cifsdk.constants import PYVERSION
import os
TRACE = os.environ.get('CIFSDK_CLIENT_MSG_TRACE')
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
if TRACE:
logger.setLevel(logging.DEBUG)
MAP = {
1: 'ping',
2... |
elif len(m) == 4:
id, token, mtype, data = m
mtype = msgpack.unpackb(mtype)
mtype = MAP[mtype]
return id, token.decode('utf-8'), mtype, data.decode('utf-8')
elif len(m) == 3:
id, mtype, data = m
try:
mtype = msgpa... | id, null, token, mtype, data = m
mtype = msgpack.unpackb(mtype)
mtype = MAP[mtype]
return id, token.decode('utf-8'), mtype, data.decode('utf-8') | conditional_block |
msg.py | import ujson as json
from pprint import pprint
import msgpack
import logging
from cifsdk.constants import PYVERSION
import os
TRACE = os.environ.get('CIFSDK_CLIENT_MSG_TRACE')
logger = logging.getLogger(__name__)
logger.setLevel(logging.ERROR)
if TRACE:
logger.setLevel(logging.DEBUG)
MAP = {
1: 'ping',
2... | TOKENS_SEARCH = 6
TOKENS_CREATE = 7
TOKENS_DELETE = 8
TOKENS_EDIT = 9
def __init__(self, *args, **kwargs):
for k in kwargs:
if isinstance(kwargs[k], str):
try:
kwargs[k] = kwargs[k].encode('utf-8')
except UnicodeDecodeError:
... | INDICATORS_SEARCH = 4
INDICATORS_DELETE = 5 | random_line_split |
hierarchy.js | define(['kloudspeaker/filesystem', 'kloudspeaker/utils', 'kloudspeaker/dom', 'kloudspeaker/plugins'], function(fs, utils, dom, plugins) {
dom.importCss(plugins.url('ItemDetails', 'style.css'));
return function() {
var that = this;
var model = {
item: null,
folderInfo: nu... | if ($e) $e.find(".kloudspeaker-itemselector-folder-indicator").empty();
return;
}
var level = 0;
var levels = [];
if (parent) {
var matches = parent.path.match(/\//g);
if (mat... | $tree.removeClass("loading");
loaded[parent ? parent.id : "root"] = true;
if (!r.folders || r.folders.length === 0) { | random_line_split |
hierarchy.js | define(['kloudspeaker/filesystem', 'kloudspeaker/utils', 'kloudspeaker/dom', 'kloudspeaker/plugins'], function(fs, utils, dom, plugins) {
dom.importCss(plugins.url('ItemDetails', 'style.css'));
return function() {
var that = this;
var model = {
item: null,
folderInfo: nu... |
return false;
});
load(null, model.item);
}
};
};
});
| {
load($e, p);
} | conditional_block |
font_face.rs | )]
pub enum Source {
/// A `url()` source.
Url(UrlSource),
/// A `local()` source.
#[css(function)]
Local(FamilyName),
}
impl OneOrMoreSeparated for Source {
type S = Comma;
}
/// A `UrlSource` represents a font-face source that has been specified with a
/// `url()` function.
///
/// <https://... | (&self) -> EffectiveSources {
EffectiveSources(self.sources().iter().rev().filter(|source| {
if let Source::Url(ref url_source) = **source {
let hints = &url_source.format_hints;
// We support only opentype fonts and truetype is an alias for
// that fo... | effective_sources | identifier_name |
font_face.rs | Css)]
pub enum Source {
/// A `url()` source.
Url(UrlSource),
/// A `local()` source.
#[css(function)]
Local(FamilyName),
}
impl OneOrMoreSeparated for Source {
type S = Comma;
}
/// A `UrlSource` represents a font-face source that has been specified with a
/// `url()` function.
///
/// <https... | fn next(&mut self) -> Option<Source> {
self.0.pop()
}
fn size_hint(&self) -> (usize, Option<usize>) {
(self.0.len(), Some(self.0.len()))
}
}
struct FontFaceRuleParser<'a, 'b: 'a> {
context: &'a ParserContext<'b>,
rule: &'a mut FontFaceRuleData,
}
/// Default methods reject all... | type Item = Source; | random_line_split |
font_face.rs | )]
pub enum Source {
/// A `url()` source.
Url(UrlSource),
/// A `local()` source.
#[css(function)]
Local(FamilyName),
}
impl OneOrMoreSeparated for Source {
type S = Comma;
}
/// A `UrlSource` represents a font-face source that has been specified with a
/// `url()` function.
///
/// <https://... | ;
Ok(Source::Url(UrlSource {
url: url,
format_hints: format_hints,
}))
}
}
macro_rules! is_descriptor_enabled {
("font-display") => {
unsafe {
use gecko_bindings::structs::mozilla;
mozilla::StylePrefs_sFontDisplayEnabled
}
};
... | {
vec![]
} | conditional_block |
font_face.rs | )]
pub enum Source {
/// A `url()` source.
Url(UrlSource),
/// A `local()` source.
#[css(function)]
Local(FamilyName),
}
impl OneOrMoreSeparated for Source {
type S = Comma;
}
/// A `UrlSource` represents a font-face source that has been specified with a
/// `url()` function.
///
/// <https://... |
/// A @font-face rule that is known to have font-family and src declarations.
#[cfg(feature = "servo")]
pub struct FontFace<'a>(&'a FontFaceRuleData);
/// A list of effective sources that we send over through IPC to the font cache.
#[cfg(feature = "servo")]
#[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", deriv... | {
let mut rule = FontFaceRuleData::empty(location);
{
let parser = FontFaceRuleParser {
context: context,
rule: &mut rule,
};
let mut iter = DeclarationListParser::new(input, parser);
while let Some(declaration) = iter.next() {
if let Err((erro... | identifier_body |
day8.rs | use std::io::prelude::*;
use std::fs::File;
const MAX_X: usize = 50;
const MAX_Y: usize = 6;
fn print_board(board: &Vec<Vec<bool>>) {
let mut count = 0;
for i in 0..MAX_Y {
let mut line = String::new();;
for j in 0..MAX_X {
if board[i][j] {
line += "#";
count += 1;
} else {
... | () {
let mut f = File::open("day8.txt").unwrap();
let mut f_s = String::new();
f.read_to_string(&mut f_s).unwrap();
let mut board = vec![vec![false; 50]; 6];
for l in f_s.lines() {
let line = l.to_string();
if line.contains("rect") {
let (_, last) = l.split_at(5);
let mut last_str = last... | main | identifier_name |
day8.rs | use std::io::prelude::*;
use std::fs::File;
const MAX_X: usize = 50;
const MAX_Y: usize = 6;
fn print_board(board: &Vec<Vec<bool>>) {
let mut count = 0;
for i in 0..MAX_Y {
let mut line = String::new();;
for j in 0..MAX_X {
if board[i][j] {
line += "#";
count += 1;
} else {
... | else if line.contains("column") {
let (_, last) = l.split_at(16);
let mut last_str = last.to_string();
let by_pos = last_str.find(" by").unwrap();
for _ in 0..4{
last_str.remove(by_pos);
}
let (x, times) = last_str.split_at(by_pos);
for _ in 0..times.parse().unwrap()... | {
let (_, last) = l.split_at(5);
let mut last_str = last.to_string();
let cross_pos = last_str.find("x").unwrap();
last_str.remove(cross_pos);
let (x, y) = last_str.split_at(cross_pos);
add_rect(&mut board, x.parse().unwrap(), y.parse().unwrap())
} | conditional_block |
day8.rs | use std::io::prelude::*;
use std::fs::File;
const MAX_X: usize = 50;
const MAX_Y: usize = 6;
fn print_board(board: &Vec<Vec<bool>>) {
let mut count = 0;
for i in 0..MAX_Y {
let mut line = String::new();;
for j in 0..MAX_X {
if board[i][j] {
line += "#";
count += 1;
} else {
... | rotate_column(&mut board, x.parse().unwrap())
}
} else if line.contains("row") {
let (_, last) = l.split_at(13);
let mut last_str = last.to_string();
let by_pos = last_str.find(" by").unwrap();
for _ in 0..4{
last_str.remove(by_pos);
}
let (y, times) = las... | last_str.remove(by_pos);
}
let (x, times) = last_str.split_at(by_pos);
for _ in 0..times.parse().unwrap() { | random_line_split |
day8.rs | use std::io::prelude::*;
use std::fs::File;
const MAX_X: usize = 50;
const MAX_Y: usize = 6;
fn print_board(board: &Vec<Vec<bool>>) {
let mut count = 0;
for i in 0..MAX_Y {
let mut line = String::new();;
for j in 0..MAX_X {
if board[i][j] {
line += "#";
count += 1;
} else {
... |
fn rotate_column(board: &mut Vec<Vec<bool>>, x: usize)
{
let mut val = board[0][x];
for y in 1..MAX_Y {
let temp = board[y][x];
board[y][x] = val;
val = temp;
}
board[0][x] = val;
}
fn main() {
let mut f = File::open("day8.txt").unwrap();
let mut f_s = String::new();
f.read_to_string(&mut ... | {
let mut val = board[y][0];
for x in 1..MAX_X {
let temp = board[y][x];
board[y][x] = val;
val = temp;
}
board[y][0] = val;
} | identifier_body |
profile.service.ts | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { HttpService } from './http.service'
import { Parameters } from './parameters';
import { FTHelperService } from '../helper/ftHelper.service';
import { AreaType, ProfilePerIndicator } from '../../../typings/FT';
@Injectabl... | (indicatorIds: number[]): Observable<Map<number, ProfilePerIndicator[]>> {
const params = new Parameters(this.version);
params.addIndicatorIds(indicatorIds);
return this.httpService.httpGet('api/profiles_containing_indicators', params);
}
}
| getIndicatorProfiles | identifier_name |
profile.service.ts | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { HttpService } from './http.service'
import { Parameters } from './parameters';
import { FTHelperService } from '../helper/ftHelper.service';
import { AreaType, ProfilePerIndicator } from '../../../typings/FT';
@Injectabl... | } | random_line_split | |
profile.service.ts | import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { HttpService } from './http.service'
import { Parameters } from './parameters';
import { FTHelperService } from '../helper/ftHelper.service';
import { AreaType, ProfilePerIndicator } from '../../../typings/FT';
@Injectabl... |
public areaTypesWithPdfs(profileId: number): Observable<AreaType[]> {
const params = new Parameters(this.version);
params.addProfileId(profileId);
return this.httpService.httpGet('api/profile/area_types_with_pdfs', params);
}
public getIndicatorProfiles(indicatorIds: number[]): Observable<Map<numb... | {
} | identifier_body |
day_5.rs | pub use tdd_kata::string_calc_kata::iter_2::day_5::Calculator;
pub use expectest::prelude::be_ok;
describe! string_calculator {
before_each { | }
it "should evaluate number" {
expect!(calc.evaluate("4350.264")).to(be_ok().value(4350.264));
}
it "should evaluate add operation" {
expect!(calc.evaluate("34543.767+324.654")).to(be_ok().value(34868.421));
}
it "should evaluate sub operation" {
expect!(calc.evaluate... | let calc = Calculator::new(); | random_line_split |
plugin.js | /*global tinymce:true */ | var regex = [
new RegExp('https?://(www\.)?youtube\.com/watch.*', 'i'),
new RegExp('http://youtu.be/*'),
new RegExp('http://blip.tv/*'),
new RegExp('https?://(www\.)?vimeo\.com/.*', 'i'),
new RegExp('https?://(www\.)?dailymotion\.com/.*', 'i'),
new RegExp('http://dai.ly/*'),
new R... |
tinymce.PluginManager.add('wptadv', function( editor ) {
editor.on( 'init', function() {
if ( ! editor.settings.wpautop && editor.settings.tadv_noautop ) {
editor.on( 'SaveContent', function( event ) { | random_line_split |
plugin.js | /*global tinymce:true */
tinymce.PluginManager.add('wptadv', function( editor ) {
editor.on( 'init', function() {
if ( ! editor.settings.wpautop && editor.settings.tadv_noautop ) | new RegExp('https?://(.+\.)?polldaddy\.com/.*', 'i'),
new RegExp('https?://(www\.)?funnyordie\.com/videos/.*', 'i'),
new RegExp('https?://(www\.)?twitter\.com/.+?/status(es)?/.*', 'i'),
new RegExp('https?://(www\.)?soundcloud\.com/.*', 'i'),
new RegExp('https?://(www\.)?slideshare\.net/*', 'i')... | {
editor.on( 'SaveContent', function( event ) {
var regex = [
new RegExp('https?://(www\.)?youtube\.com/watch.*', 'i'),
new RegExp('http://youtu.be/*'),
new RegExp('http://blip.tv/*'),
new RegExp('https?://(www\.)?vimeo\.com/.*', 'i'),
new RegExp('https?://(www\.)?dailymotion\.com/.*', '... | conditional_block |
2040003.js | var status = 0;
var entry;
function start() {
if(cm.getPlayer().getMapId() == 922000000) {
entry = 0;
cm.sendYesNo("Do you wish to quit this stage?");
status++;
}
else if(cm.isQuestStarted(3239)) {
entry = 1;
cm.sendYesNo("Do you want to enter #bToy Factory<Sector 4>#k?");
status++;
}
else {
cm.send... | if(cm.getWarpMap(922000000).countPlayers() == 0) {
cm.warp(922000000, 0);
if(!(cm.isQuestStarted(3239) && cm.haveItem(4031092, 10))) cm.removeAll(4031092);
} else {
cm.sendOk("... | {
if(status == 1) {
if(entry == 0) {
if(mode <= 0) {
cm.sendOk("Ok. Call me if you urge to exit, then.");
cm.dispose();
return;
}
cm.warp(922000009, 0);
if(!(cm.isQuestStarted(3239) && cm.haveItem(4031092, 10))) cm.removeAll(4031092);
cm.dispose();
}
else {
if(mode <= 0) {
... | identifier_body |
2040003.js | var status = 0;
var entry;
function start() {
if(cm.getPlayer().getMapId() == 922000000) {
entry = 0;
cm.sendYesNo("Do you wish to quit this stage?");
status++;
}
else if(cm.isQuestStarted(3239)) |
else {
cm.sendOk("Access to #bToy Factory<Sector 4>#k is restricted to the public.");
}
}
function action(mode, type, selection) {
if(status == 1) {
if(entry == 0) {
if(mode <= 0) {
cm.sendOk("Ok. Call me if you urge to exit, then.");
cm.dispose();
return;
}
cm.warp(922000009, 0);
i... | {
entry = 1;
cm.sendYesNo("Do you want to enter #bToy Factory<Sector 4>#k?");
status++;
} | conditional_block |
2040003.js | var status = 0;
var entry;
function | () {
if(cm.getPlayer().getMapId() == 922000000) {
entry = 0;
cm.sendYesNo("Do you wish to quit this stage?");
status++;
}
else if(cm.isQuestStarted(3239)) {
entry = 1;
cm.sendYesNo("Do you want to enter #bToy Factory<Sector 4>#k?");
status++;
}
else {
cm.sendOk("Access to #bToy Factory<Sector 4>#k i... | start | identifier_name |
2040003.js | var status = 0;
var entry;
function start() {
if(cm.getPlayer().getMapId() == 922000000) {
entry = 0;
cm.sendYesNo("Do you wish to quit this stage?");
status++;
}
else if(cm.isQuestStarted(3239)) {
entry = 1;
cm.sendYesNo("Do you want to enter #bToy Factory<Sector 4>#k?");
status++;
}
else {
cm.send... | cm.warp(922000000, 0);
if(!(cm.isQuestStarted(3239) && cm.haveItem(4031092, 10))) cm.removeAll(4031092);
} else {
cm.sendOk("Someone else is already attempting the parts. Wait for them to finish befor... | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.