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 |
|---|---|---|---|---|
cow.rs | #![allow(unused_imports)]
use geometry::prim::{Prim};
use geometry::prims::{Plane, Sphere, Triangle};
use light::light::{Light};
use light::lights::{PointLight, SphereLight};
use material::materials::{CookTorranceMaterial, FlatMaterial, PhongMaterial};
use material::Texture;
use material::textures::{CheckerTexture, Cu... |
Scene {
lights: lights,
octree: octree,
background: Vec3 { x: 0.3, y: 0.5, z: 0.8 },
skybox: None
}
} | println!("Generating octree...");
let octree = prims.into_iter().collect();
println!("Octree generated..."); | random_line_split |
PageActions-test.tsx | /*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or | * 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Pub... | * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* | random_line_split |
make-tree.js | $(document).ready(function() {
var content_frame = $('#content_frame');
var page_link = $('#pageLink');
change_page = function (pagename) {
content_frame.attr ('src', 'monodoc.ashx?link=' + pagename);
page_link.attr ('href', '?link=' + pagename);
if (window.history && window.history.pushState) {
... | };
update_tree ();
add_native_browser_link = function () {
var contentDiv = $('#content_frame').contents ().find ('div[class=Content]').first ();
if (contentDiv.length > 0 && contentDiv.attr ('id')) {
var id = contentDiv.attr ('id').replace (':Summary', '');
var h... | random_line_split | |
javax.swing.text.html.HTMLEditorKit$LinkController.d.ts | declare namespace javax {
namespace swing {
namespace text {
namespace html {
class | extends java.awt.event.MouseAdapter implements java.awt.event.MouseMotionListener, java.io.Serializable {
public constructor()
public mouseClicked(arg0: java.awt.event.MouseEvent): void
public mouseDragged(arg0: java.awt.event.MouseEvent): void
public mouseMoved(arg0: java.awt.e... | HTMLEditorKit$LinkController | identifier_name |
javax.swing.text.html.HTMLEditorKit$LinkController.d.ts | declare namespace javax {
namespace swing {
namespace text {
namespace html {
class HTMLEditorKit$LinkController extends java.awt.event.MouseAdapter implements java.awt.event.MouseMotionListener, java.io.Serializable { | public mouseDragged(arg0: java.awt.event.MouseEvent): void
public mouseMoved(arg0: java.awt.event.MouseEvent): void
protected activateLink(arg0: number | java.lang.Integer, arg1: javax.swing.JEditorPane): void
activateLink(arg0: number | java.lang.Integer, arg1: javax.swing.JEdit... | public constructor()
public mouseClicked(arg0: java.awt.event.MouseEvent): void | random_line_split |
documentation.py | import sys
import requests
from urllib.parse import urlparse
docs_repos = [
"frappe_docs",
"erpnext_documentation",
"erpnext_com",
"frappe_io",
]
def uri_validator(x):
result = urlparse(x)
return all([result.scheme, result.netloc, result.path])
def docs_link_exists(body):
for line in body.splitlines():
fo... | pr = sys.argv[1]
response = requests.get("https://api.github.com/repos/frappe/frappe/pulls/{}".format(pr))
if response.ok:
payload = response.json()
title = payload.get("title", "").lower()
head_sha = payload.get("head", {}).get("sha")
body = payload.get("body", "").lower()
if title.startswith("feat") an... | if len(parts) == 5 and parts[1] == "frappe" and parts[2] in docs_repos:
return True
if __name__ == "__main__": | random_line_split |
documentation.py | import sys
import requests
from urllib.parse import urlparse
docs_repos = [
"frappe_docs",
"erpnext_documentation",
"erpnext_com",
"frappe_io",
]
def uri_validator(x):
|
def docs_link_exists(body):
for line in body.splitlines():
for word in line.split():
if word.startswith('http') and uri_validator(word):
parsed_url = urlparse(word)
if parsed_url.netloc == "github.com":
parts = parsed_url.path.split('/')
if len(parts) == 5 and parts[1] == "frappe" and parts[2]... | result = urlparse(x)
return all([result.scheme, result.netloc, result.path]) | identifier_body |
documentation.py | import sys
import requests
from urllib.parse import urlparse
docs_repos = [
"frappe_docs",
"erpnext_documentation",
"erpnext_com",
"frappe_io",
]
def uri_validator(x):
result = urlparse(x)
return all([result.scheme, result.netloc, result.path])
def docs_link_exists(body):
for line in body.splitlines():
fo... | e:
print("Skipping documentation checks... 🏃")
| nt("Documentation Link Not Found! ⚠️")
sys.exit(1)
els | conditional_block |
documentation.py | import sys
import requests
from urllib.parse import urlparse
docs_repos = [
"frappe_docs",
"erpnext_documentation",
"erpnext_com",
"frappe_io",
]
def uri_validator(x):
result = urlparse(x)
return all([result.scheme, result.netloc, result.path])
def | (body):
for line in body.splitlines():
for word in line.split():
if word.startswith('http') and uri_validator(word):
parsed_url = urlparse(word)
if parsed_url.netloc == "github.com":
parts = parsed_url.path.split('/')
if len(parts) == 5 and parts[1] == "frappe" and parts[2] in docs_repos:
... | docs_link_exists | identifier_name |
__init__.py | """
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | DEFAULT_CACHE_ALIAS = 'default'
def parse_backend_uri(backend_uri):
"""
Converts the "backend_uri" into a cache scheme ('db', 'memcached', etc), a
host and any extra params that are required for the backend. Returns a
(scheme, host, params) tuple.
"""
if backend_uri.find(':') == -1:
rai... | }
| random_line_split |
__init__.py | """
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | try:
if '://' in backend:
# for backwards compatibility
backend, location, params = parse_backend_uri(backend)
if backend in BACKENDS:
backend = 'django.core.cache.backends.%s' % BACKENDS[backend]
params.update(kwargs)
mod = importl... | """
Function to load a cache backend dynamically. This is flexible by design
to allow different use cases:
To load a backend with the old URI-based notation::
cache = get_cache('locmem://')
To load a backend that is pre-defined in the settings::
cache = get_cache('default')
To l... | identifier_body |
__init__.py | """
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... | (backend, **kwargs):
"""
Helper function to parse the backend configuration
that doesn't use the URI notation.
"""
# Try to get the CACHES entry for the given backend name first
conf = settings.CACHES.get(backend, None)
if conf is not None:
args = conf.copy()
backend = args.p... | parse_backend_conf | identifier_name |
__init__.py | """
Caching framework.
This package defines set of cache backends that all conform to a simple API.
In a nutshell, a cache is a set of values -- which can be any object that
may be pickled -- identified by string keys. For the complete API, see
the abstract BaseCache class in django.core.cache.backends.base.
Client ... |
if host.endswith('/'):
host = host[:-1]
return scheme, host, params
if not settings.CACHES:
import warnings
warnings.warn(
"settings.CACHE_* is deprecated; use settings.CACHES instead.",
PendingDeprecationWarning
)
# Mapping for new-style cache backend api
backend_... | params = {} | conditional_block |
fields.rs | //! # fields
//! All necessery functions for appliying fields to json results.
use serde_json::Value;
use serde_json;
use service::query_api::Queries;
/// let only named fields array according to the query api
pub fn apply(obj: &mut Value, queries: &Queries) {
let ref fields = queries.fields;
if fields.len() ... |
#[cfg(test)]
mod tests {
use super::*;
fn get_json() -> Value {
let json_string = r#"[
{
"name":"seray",
"age":31,
"active":true,
"password":"123"
},
{
"name":"kamil",
"... | {
let mut diff = Vec::<String>::new();
'outer: for a_item in a {
for b_item in b {
if a_item == b_item {
continue 'outer;
}
}
diff.push(a_item.clone());
}
diff
} | identifier_body |
fields.rs | //! # fields
//! All necessery functions for appliying fields to json results.
use serde_json::Value;
use serde_json;
use service::query_api::Queries;
/// let only named fields array according to the query api
pub fn apply(obj: &mut Value, queries: &Queries) {
let ref fields = queries.fields;
if fields.len() ... |
i += 1;
}
}
&mut Value::Object(ref mut map) => {
let remove_keys = diff_left(map.keys(), fields);
for key in &remove_keys {
map.remove(key);
}
}
_ => {
//No need to handle other types
}
... | {
for key in &remove_keys {
obj.remove(key);
}
} | conditional_block |
fields.rs | //! # fields
//! All necessery functions for appliying fields to json results.
use serde_json::Value;
use serde_json;
use service::query_api::Queries;
/// let only named fields array according to the query api
pub fn apply(obj: &mut Value, queries: &Queries) {
let ref fields = queries.fields;
if fields.len() ... | },
{
"name":"kamil",
"age":900,
"active":false,
"password":"333"
},
{
"name":"hasan",
"age":25,
"active":true,
"password":"321"
}
... | {
"name":"seray",
"age":31,
"active":true,
"password":"123" | random_line_split |
fields.rs | //! # fields
//! All necessery functions for appliying fields to json results.
use serde_json::Value;
use serde_json;
use service::query_api::Queries;
/// let only named fields array according to the query api
pub fn apply(obj: &mut Value, queries: &Queries) {
let ref fields = queries.fields;
if fields.len() ... | () -> Value {
let json_string = r#"[
{
"name":"seray",
"age":31,
"active":true,
"password":"123"
},
{
"name":"kamil",
"age":900,
"active":false,
"pa... | get_json | identifier_name |
meta.js | var model = require('model');
var adapter = require('./..').adapter;
var Issue = function () {
this.adapter = adapter;
this.property('assignees','string');
this.property('htmlUrl','string');
this.property('number','number');
this.property('state','string');
this.property('title','string');
this.property(... | this.property('milestone','object');
this.property('comments','number');
this.property('pullRequest','object');
this.property('closedAt','date');
this.property('createdAt','date');
this.property('updatedAt','date');
this.property('trckrState','string');
this.property('trckrLastReview','date');
this.p... | this.property('assignee','object'); | random_line_split |
0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-09 11:32
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class | (migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models... | Migration | identifier_name |
0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-09 11:32
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): | ]
operations = [
migrations.CreateModel(
name='Company',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('source', django.con... |
initial = True
dependencies = [ | random_line_split |
0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-07-09 11:32
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
| ('title', models.CharField(max_length=255)),
('source', django.contrib.postgres.fields.jsonb.JSONField(default={})),
],
),
migrations.CreateModel(
name='News',
fields=[
('id', models.AutoField(auto_created=True, primary_... | initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
... | identifier_body |
vm.py | #!/usr/bin/python
"""
VM starter - start your virtual hosts based on config file
--------------------------------------------------------------------------------
@author Petr Juhanak, http://www.hackerlab.cz
@release 1.0, 20130808
@licence GPLv3 http:://www.gnu.org/licenses/gpl-3.0.html
---------------------... | ():
file = open(LAB_CONFIG)
for line in file:
print line.strip()
def vmtable(filename):
vmt = []
file = open(filename)
for i,line in enumerate(file):
if not line.startswith(";"):
match = re.search('(.*)\|(.*)\|(.*)\|(.*)', line)
if matc... | print_vmtable | identifier_name |
vm.py | #!/usr/bin/python
"""
VM starter - start your virtual hosts based on config file
--------------------------------------------------------------------------------
@author Petr Juhanak, http://www.hackerlab.cz
@release 1.0, 20130808
@licence GPLv3 http:://www.gnu.org/licenses/gpl-3.0.html
---------------------... | if len(sys.argv) > 2:
ACTION = sys.argv[2].upper().strip()
else:
ACTION = "start".upper().strip()
# start VMs according lab.config
vmt = vmtable(CONFIG_FILE)
vmt.sort(key=lambda x: int(x[2]))
for vm in vmt:
name = vm[0]
execute = vm[1]
delay = vm[2]
comment = vm[3]
if ... | random_line_split | |
vm.py | #!/usr/bin/python
"""
VM starter - start your virtual hosts based on config file
--------------------------------------------------------------------------------
@author Petr Juhanak, http://www.hackerlab.cz
@release 1.0, 20130808
@licence GPLv3 http:://www.gnu.org/licenses/gpl-3.0.html
---------------------... |
def report_error(message):
print "Usage: vm.py <lab.config> [START|stop|reset]"
print ""
print " [!]", message
def print_vmtable():
file = open(LAB_CONFIG)
for line in file:
print line.strip()
def vmtable(filename):
vmt = []
file = open(filename)
for i,line in... | print "VM starter 1.0 - Author Petr Juhanak | http://www.hackerlab.cz (GPLv3)"
print "" | identifier_body |
vm.py | #!/usr/bin/python
"""
VM starter - start your virtual hosts based on config file
--------------------------------------------------------------------------------
@author Petr Juhanak, http://www.hackerlab.cz
@release 1.0, 20130808
@licence GPLv3 http:://www.gnu.org/licenses/gpl-3.0.html
---------------------... |
if out != '':
sys.stdout.write(out)
sys.stdout.flush()
"""
Example LAB.CONFIG:
===================
;
;
; Start VM when start symbol is found [S, X, 1, I]
; with a delay: integer [sec] - default zero
; VM name has to match with ... | break | conditional_block |
publish.js | module.exports = publish
var url = require('url')
var semver = require('semver')
var Stream = require('stream').Stream
var assert = require('assert')
var fixer = require('normalize-package-data').fixer
var concat = require('concat-stream')
var ssri = require('ssri')
function escaped (name) {
return name.... | case 'dist-tags':
case 'versions':
case '_attachments':
for (var j in root[i]) {
current[i][j] = root[i][j]
}
break
// ignore these
case 'maintainers':
break
// copy
default:
current[i] = root[i]
}
}
v... | // objects that copy over the new stuffs
| random_line_split |
publish.js | module.exports = publish
var url = require('url')
var semver = require('semver')
var Stream = require('stream').Stream
var assert = require('assert')
var fixer = require('normalize-package-data').fixer
var concat = require('concat-stream')
var ssri = require('ssri')
function escaped (name) {
return name.... |
var metadata = params.metadata
assert(
metadata && typeof metadata === 'object',
'must pass package metadata to publish'
)
try {
fixer.fixNameField(metadata, {strict: true, allowLegacyCase: true})
} catch (er) {
return cb(er)
}
var version = semver.clean(metadata.version)
... | {
var er = new Error('auth required for publishing')
er.code = 'ENEEDAUTH'
return cb(er)
} | conditional_block |
publish.js | module.exports = publish
var url = require('url')
var semver = require('semver')
var Stream = require('stream').Stream
var assert = require('assert')
var fixer = require('normalize-package-data').fixer
var concat = require('concat-stream')
var ssri = require('ssri')
function escaped (name) {
return name.... | (registry, data, tarbuffer, access, auth, cb) {
// optimistically try to PUT all in one single atomic thing.
// If 409, then GET and merge, try again.
// If other error, then fail.
var root = {
_id: data.name,
name: data.name,
description: data.description,
'dist-tags': {},
versi... | putFirst | identifier_name |
publish.js | module.exports = publish
var url = require('url')
var semver = require('semver')
var Stream = require('stream').Stream
var assert = require('assert')
var fixer = require('normalize-package-data').fixer
var concat = require('concat-stream')
var ssri = require('ssri')
function escaped (name) |
function publish (uri, params, cb) {
assert(typeof uri === 'string', 'must pass registry URI to publish')
assert(params && typeof params === 'object', 'must pass params to publish')
assert(typeof cb === 'function', 'must pass callback to publish')
var access = params.access
assert(
(!access) |... | {
return name.replace('/', '%2f')
} | identifier_body |
tell.py | import re
from .. import irc, var, ini
from ..tools import is_identified
# Require identification with NickServ to send messages.
def ident (f):
def check (user, channel, word):
if is_identified(user):
f(user, channel, word)
else:
irc.msg(channel, "{}: Identify with NickServ first.".format(user))
return c... | if user not in var.data["messages"]:
irc.msg(channel, "{}: You don't have any messages.".format(user))
return
send_messages(user)
irc.msg(channel, "{}: Sent ;)".format(user)) | identifier_body | |
tell.py | import re
from .. import irc, var, ini
from ..tools import is_identified
# Require identification with NickServ to send messages.
def ident (f):
def check (user, channel, word):
if is_identified(user):
f(user, channel, word)
else:
irc.msg(channel, "{}: Identify with NickServ first.".format(user))
return c... | if (user, message) in var.data["messages"][target]:
irc.msg(channel, "{}: You already left this message.".format(user))
return
# Create an empty list for users not in the database.
if target not in var.data["messages"]:
var.data["messages"][target] = []
# Append tuple and add to ini.
var.data["messages"... | if target in var.data["messages"]: | random_line_split |
tell.py | import re
from .. import irc, var, ini
from ..tools import is_identified
# Require identification with NickServ to send messages.
def ident (f):
def check (user, channel, word):
if is_identified(user):
f(user, channel, word)
else:
irc.msg(channel, "{}: Identify with NickServ first.".format(user))
return c... |
target = word[1]
message = " ".join(word[2:])
# Check if target is a valid nickname.
match = re.match("[a-zA-Z\[\]\\`_\^\{\|\}][a-zA-Z0-9\[\]\\`_\^\{\|\}]+", target)
if not match or (hasattr(match, "group") and match.group() != target):
irc.msg(channel, "{} is not a valid nickname.".format(target))
return
... | irc.msg(channel, "{}: Wrong syntax. Check .help".format(user))
return | conditional_block |
tell.py | import re
from .. import irc, var, ini
from ..tools import is_identified
# Require identification with NickServ to send messages.
def ident (f):
def check (user, channel, word):
if is_identified(user):
f(user, channel, word)
else:
irc.msg(channel, "{}: Identify with NickServ first.".format(user))
return c... | (user, channel, word):
# It needs a nickname and a message.
if len(word) < 3:
irc.msg(channel, "{}: Wrong syntax. Check .help".format(user))
return
target = word[1]
message = " ".join(word[2:])
# Check if target is a valid nickname.
match = re.match("[a-zA-Z\[\]\\`_\^\{\|\}][a-zA-Z0-9\[\]\\`_\^\{\|\}]+", t... | leave_message | identifier_name |
bloom.rs | compared to
/// traditional style systems given Servo does a parallel breadth-first
/// traversal instead of a sequential depth-first traversal.
///
/// This implies that we need to track a bit more state than other browsers to
/// ensure we're doing the correct thing during the traversal, and being able to
/// apply ... | }
}
/// Return the bloom filter used properly by the `selectors` crate.
pub fn filter(&self) -> &BloomFilter {
&*self.filter
}
/// Push an element to the bloom filter, knowing that it's a child of the
/// last element parent.
pub fn push(&mut self, element: E) {
if ... | random_line_split | |
bloom.rs | compared to
/// traditional style systems given Servo does a parallel breadth-first
/// traversal instead of a sequential depth-first traversal.
///
/// This implies that we need to track a bit more state than other browsers to
/// ensure we're doing the correct thing during the traversal, and being able to
/// apply ... | (&mut self, element: E) {
let mut count = 0;
each_relevant_element_hash(element, |hash| {
count += 1;
self.filter.insert_hash(hash);
self.pushed_hashes.push(hash);
});
self.elements.push(PushedElement::new(element, count));
}
/// Pop the last ... | push_internal | identifier_name |
bloom.rs | compared to
/// traditional style systems given Servo does a parallel breadth-first
/// traversal instead of a sequential depth-first traversal.
///
/// This implies that we need to track a bit more state than other browsers to
/// ensure we're doing the correct thing during the traversal, and being able to
/// apply ... |
}
impl<E: TElement> StyleBloom<E> {
/// Create an empty `StyleBloom`. Because StyleBloom acquires the thread-
/// local filter buffer, creating multiple live StyleBloom instances at
/// the same time on the same thread will panic.
// Forced out of line to limit stack frame sizes after extra inlining ... | {
// Leave the reusable bloom filter in a zeroed state.
self.clear();
} | identifier_body |
bloom.rs | compared to
/// traditional style systems given Servo does a parallel breadth-first
/// traversal instead of a sequential depth-first traversal.
///
/// This implies that we need to track a bit more state than other browsers to
/// ensure we're doing the correct thing during the traversal, and being able to
/// apply ... |
}
/// Rebuilds the bloom filter up to the parent of the given element.
pub fn rebuild(&mut self, mut element: E) {
self.clear();
let mut parents_to_insert = SmallVec::<[E; 16]>::new();
while let Some(parent) = element.traversal_parent() {
parents_to_insert.push(parent)... | {
for hash in self.pushed_hashes.drain() {
self.filter.remove_hash(hash);
}
debug_assert!(self.filter.is_zeroed());
} | conditional_block |
client.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... |
@property
def sensors(self):
return self.managers['Sensor']
@property
def tokens(self):
return self.managers['Token']
@property
def triggertypes(self):
return self.managers['TriggerType']
@property
def triggerinstances(self):
return self.managers['Tri... | return self.managers['RunnerType'] | identifier_body |
client.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... |
if cacert:
self.cacert = cacert
else:
self.cacert = os.environ.get('ST2_CACERT', None)
if self.cacert and not os.path.isfile(self.cacert):
raise ValueError('CA cert file "%s" does not exist.' % (self.cacert))
self.debug = debug
# Note: Thi... | self.endpoints['auth'] = os.environ.get(
'ST2_AUTH_URL', '%s:%s' % (self.endpoints['base'], DEFAULT_AUTH_PORT)) | conditional_block |
client.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | (self):
return self.managers['RunnerType']
@property
def sensors(self):
return self.managers['Sensor']
@property
def tokens(self):
return self.managers['Token']
@property
def triggertypes(self):
return self.managers['TriggerType']
@property
def trigger... | runners | identifier_name |
client.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | self.debug = debug
# Note: This is a nasty hack for now, but we need to get rid of the decrator abuse
if token:
os.environ['ST2_AUTH_TOKEN'] = token
self.token = token
# Instantiate resource managers and assign appropriate API endpoint.
self.managers = dict... | self.cacert = os.environ.get('ST2_CACERT', None)
if self.cacert and not os.path.isfile(self.cacert):
raise ValueError('CA cert file "%s" does not exist.' % (self.cacert))
| random_line_split |
config.py | # -*- coding: utf-8 -*-
#Copyright (C) 2015 David Delgado Hernandez
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
... |
elif self.cfgfile.has_option("OPCIONES","KBPS"):
self.kpbs = self.cfgfile.get("OPCIONES","KBPS")
else:
self.cfgfile.set("OPCIONES","KBPS",var.KBPS)
self.kpbs = var.KBPS
return self.kpbs
def setKbps(self,kpbs,flag=False):
self.reg[5] = True
... | pass | conditional_block |
config.py | # -*- coding: utf-8 -*-
#Copyright (C) 2015 David Delgado Hernandez
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
... | dup = True
else:
dup = False
with open(self.url_file,"a") as f:
if dup == False:
f.write(URL+"\n")
def getAllURL(self):
# Devolver una lista con las url
urllist = []
try:
with open(self.url_file,"r") as f:
... | if URL in lst: | random_line_split |
config.py | # -*- coding: utf-8 -*-
#Copyright (C) 2015 David Delgado Hernandez
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
... | (self):
if self.reg[2]:
pass
elif self.cfgfile.has_option("OPCIONES","FORMAT_DEFAULT"):
self.format = self.cfgfile.getint("OPCIONES","FORMAT_DEFAULT")
else:
self.cfgfile.set("OPCIONES","FORMAT_DEFAULT",var.FORMAT_DEFAULT)
return self.format
def ... | getFormat | identifier_name |
config.py | # -*- coding: utf-8 -*-
#Copyright (C) 2015 David Delgado Hernandez
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
... |
def getDelWrongList(self):
if self.cfgfile.has_option("OPCIONES","DELETE_WRONG_LIST"):
self.DELETE_WRONG_LIST = self.cfgfile.get("OPCIONES","DELETE_WRONG_LIST")
else:
# si no esta en fichero de configuracion
self.cfgfile.set("OPCIONES","DELETE_WRONG_L... | urllist = []
try:
with open(self.url_file,"r") as f:
while True:
url = f.readline()
if not url:
break
url = url.replace("\n","")
if len(url) > 0:
urllist.ap... | identifier_body |
read_write_lock.py | from kazoo.exceptions import NoNodeError
from sys import maxsize
from .mutex import Mutex
from .internals import LockDriver
from .utils import lazyproperty
READ_LOCK_NAME = "__READ__"
WRITE_LOCK_NAME = "__WRIT__"
class _LockDriver(LockDriver):
def sort_key(self, string, _lock_name):
string = super(_LockD... |
def _read_is_acquirable_predicate(self, children, sequence_node_name):
if self.write_lock.is_owned_by_current_thread:
return (None, True)
index = 0
write_index = maxsize
our_index = -1
for node in children:
if WRITE_LOCK_NAME in node:
... | nodes = self.read_lock.get_participant_nodes()
nodes.extend(self.write_lock.get_participant_nodes())
return nodes | identifier_body |
read_write_lock.py | from kazoo.exceptions import NoNodeError
from sys import maxsize
from .mutex import Mutex
from .internals import LockDriver
from .utils import lazyproperty
READ_LOCK_NAME = "__READ__"
WRITE_LOCK_NAME = "__WRIT__"
class _LockDriver(LockDriver):
def sort_key(self, string, _lock_name):
string = super(_LockD... | (self):
return self._path
@property
def timeout(self):
return self._timeout
@timeout.setter
def timeout(self, value):
self._timeout = value
self.read_lock.timeout = value
self.write_lock.timeout = value
@lazyproperty
def read_lock(self):
def pre... | path | identifier_name |
read_write_lock.py | from kazoo.exceptions import NoNodeError
from sys import maxsize
from .mutex import Mutex
from .internals import LockDriver
from .utils import lazyproperty
READ_LOCK_NAME = "__READ__"
WRITE_LOCK_NAME = "__WRIT__"
class _LockDriver(LockDriver):
def sort_key(self, string, _lock_name):
string = super(_LockD... |
index = 0
write_index = maxsize
our_index = -1
for node in children:
if WRITE_LOCK_NAME in node:
write_index = min(index, write_index)
elif node.startswith(sequence_node_name):
our_index = index
break
... | return (None, True) | conditional_block |
read_write_lock.py | from kazoo.exceptions import NoNodeError
from sys import maxsize
from .mutex import Mutex
from .internals import LockDriver
from .utils import lazyproperty
READ_LOCK_NAME = "__READ__"
WRITE_LOCK_NAME = "__WRIT__"
class _LockDriver(LockDriver):
def sort_key(self, string, _lock_name):
string = super(_LockD... | self._client,
self.path,
READ_LOCK_NAME,
maxsize,
_ReadLockDriver(predicate),
self.timeout
)
@lazyproperty
def write_lock(self):
return _Mutex(
self._client,
self.path,
WRITE_LOCK_NAME,
... | random_line_split | |
custom.js | //select all
$(".input-select-all").change(function () {
var target = $(this).attr("data-target");
// alert(target)
var checked = $(this).is(":checked");
$(target + " input[type=checkbox]").attr("checked", checked);
});
$(function () {
//////////////check group checkboxes/////////
$("body ... | title: title,
text: message,
html: true,
showConfirmButton: true,
type: "success"
});
}
function infoDialog(message) {
//code
swal({
title: "",
text: "<i class='text-blue fa fa-exclamation-circle'></i> " + message,
html: true,
showCon... | swal({ | random_line_split |
custom.js | //select all
$(".input-select-all").change(function () {
var target = $(this).attr("data-target");
// alert(target)
var checked = $(this).is(":checked");
$(target + " input[type=checkbox]").attr("checked", checked);
});
$(function () {
//////////////check group checkboxes/////////
$("body ... |
}
});
$(".square").each(function () {
var t = $(this).width();
$(this).css({
"height": t + "px",
"opacity": 1
});
});
///position drop menus
// $(".overflow-menu").each(function () {
// var menubox = $(this);
// ... | {
$(".step-ride .next").addClass("hide");
$(".step-ride .save").removeClass("hide");
} | conditional_block |
custom.js | //select all
$(".input-select-all").change(function () {
var target = $(this).attr("data-target");
// alert(target)
var checked = $(this).is(":checked");
$(target + " input[type=checkbox]").attr("checked", checked);
});
$(function () {
//////////////check group checkboxes/////////
$("body ... | (selector, message) {
if ($(selector).hasClass("btn")) {
$(selector).html("<i class='fa fa-spin fa-spinner'></i> <strong> " + message + "</strong>");
} else {
$(selector).html("<br/><i class='fa fa-spin fa-spinner'></i> <strong> " + message + "</strong>");
}
}
function successDialog(title... | loader | identifier_name |
custom.js | //select all
$(".input-select-all").change(function () {
var target = $(this).attr("data-target");
// alert(target)
var checked = $(this).is(":checked");
$(target + " input[type=checkbox]").attr("checked", checked);
});
$(function () {
//////////////check group checkboxes/////////
$("body ... |
//Date
if ($('.date-picker')[0]) {
$('.date-picker').datetimepicker({
format: 'DD/MM/YYYY'
});
}
| {
//code
swal({
title: "",
text: "<i class='text-blue fa fa-exclamation-circle'></i> " + message,
html: true,
showConfirmButton: true,
type: ""
});
} | identifier_body |
bot.py | #-*- coding: utf- -*-
import os
import sys
import random
import time
import json
import wikiquote
import tuitear
from threading import Thread
CONGIG_JSON = 'bots.json'
# Variable local, para modificar el intervalo real cambiar la configuración
INTERVALO = 1
stop = False
def start_bot(bot):
" | tiempo = 0
tiempo += INTERVALO
time.sleep(INTERVALO)
print 'Thread para', bot['name'], 'detenido'
def main():
path = os.path.dirname(__file__)
if len(sys.argv) == 2:
filename = sys.argv[1]
else:
filename = os.path.join(path, CONGIG_JSON)
print 'Cargando b... | "" Hilo que inicia el bot pasado como argumento (diccionario) """
citas = []
for pagina in bot['paginas']:
print 'Cargando', pagina
quotes = wikiquote.get_quotes(pagina.encode('utf8'))
quotes = [(q, pagina) for q in quotes]
citas += quotes
tiempo = 0
while not stop:
... | identifier_body |
bot.py | import sys
import random
import time
import json
import wikiquote
import tuitear
from threading import Thread
CONGIG_JSON = 'bots.json'
# Variable local, para modificar el intervalo real cambiar la configuración
INTERVALO = 1
stop = False
def start_bot(bot):
""" Hilo que inicia el bot pasado como argumento (dic... | #-*- coding: utf- -*-
import os | random_line_split | |
bot.py | #-*- coding: utf- -*-
import os
import sys
import random
import time
import json
import wikiquote
import tuitear
from threading import Thread
CONGIG_JSON = 'bots.json'
# Variable local, para modificar el intervalo real cambiar la configuración
INTERVALO = 1
stop = False
def start_bot(bot):
""" Hilo que inicia ... | ):
path = os.path.dirname(__file__)
if len(sys.argv) == 2:
filename = sys.argv[1]
else:
filename = os.path.join(path, CONGIG_JSON)
print 'Cargando bots en', filename
j = json.load(file(filename))
for bot in j['bots']:
if bot.get('disabled'):
continue
... | ain( | identifier_name |
bot.py | #-*- coding: utf- -*-
import os
import sys
import random
import time
import json
import wikiquote
import tuitear
from threading import Thread
CONGIG_JSON = 'bots.json'
# Variable local, para modificar el intervalo real cambiar la configuración
INTERVALO = 1
stop = False
def start_bot(bot):
""" Hilo que inicia ... | tiempo += INTERVALO
time.sleep(INTERVALO)
print 'Thread para', bot['name'], 'detenido'
def main():
path = os.path.dirname(__file__)
if len(sys.argv) == 2:
filename = sys.argv[1]
else:
filename = os.path.join(path, CONGIG_JSON)
print 'Cargando bots en', filename
... | uote, pagina = random.choice(citas)
tweet = bot['format'].encode('utf8') % dict(pagina = \
pagina.encode('utf8'), frase = quote.encode('utf8'))
if len(tweet) > 138:
#print 'tweet largo'
continue
print "%s: %s" % (bot['name'], tw... | conditional_block |
wind.d.ts | /**
* Created with WebStorm.
* User: tylere
* Date: 14-1-15
* Time: 上午7:56
*/
//声明$await全局函数
declare function $await(arg:any):any;
declare module "wind" {
export function compile(ctype:string, callback:Function):string
export var Async: AsyncDef;
export var Logging: LoggingDef;
export var logger: logger... | }
export interface LevelDef{
INFO:string;
}
//Wind.logger.level = Wind.Logging.Level.INFO;
export interface AsyncDef{
//Task(arg:any):WindTask;
Task:Task;
Binding:BindingDef;
sleep(delayInMs:number):Function;
}
/**
* 任务模型数据结构
*/
export inte... | level:any;
}
export interface LoggingDef{
Level:LevelDef; | random_line_split |
views.py | import datetime
import importlib
import os
from urlparse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.http import HttpResponse, Http404
from django.shortcuts import render
import jingo
import jinja2
import newrelic.agent
import waffle
f... |
if waffle.switch_is_active('firefox-accounts'):
# We never want to include persona shim if firefox accounts is enabled:
# native fxa already provides navigator.id, and fallback fxa doesn't
# need it.
include_persona = False
site_settings = {}
else:
site_settings... | include_persona = False
include_splash = True | conditional_block |
views.py | import datetime
import importlib
import os
from urlparse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.http import HttpResponse, Http404
from django.shortcuts import render
import jingo
import jinja2
import newrelic.agent
import waffle
f... | (request, repo, **kwargs):
if repo not in settings.COMMONPLACE_REPOS:
raise Http404
BUILD_ID = get_build_id(repo)
ua = request.META.get('HTTP_USER_AGENT', '').lower()
include_persona = True
include_splash = False
if repo == 'fireplace':
include_splash = True
if (reques... | commonplace | identifier_name |
views.py | import datetime
import importlib
import os | from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.http import HttpResponse, Http404
from django.shortcuts import render
import jingo
import jinja2
import newrelic.agent
import waffle
from cache_nuggets.lib import memoize
def get_build_id(repo):
try:
... | from urlparse import urlparse
| random_line_split |
views.py | import datetime
import importlib
import os
from urlparse import urlparse
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.http import HttpResponse, Http404
from django.shortcuts import render
import jingo
import jinja2
import newrelic.agent
import waffle
f... |
def iframe_install(request):
return render(request, 'commonplace/iframe-install.html')
def potatolytics(request):
return render(request, 'commonplace/potatolytics.html')
| ctx = {
'BUILD_ID': get_build_id(repo),
'imgurls': get_imgurls(repo),
'repo': repo,
'timestamp': datetime.datetime.now(),
}
t = jingo.env.get_template('commonplace/manifest.appcache').render(ctx)
return unicode(jinja2.Markup(t)) | identifier_body |
c_api_util.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
def __del__(self):
# Note: when we're destructing the global context (i.e when the process is
# terminating) we can have already deleted other modules.
if c_api is not None and c_api.TF_DeleteApiDefMap is not None:
c_api.TF_DeleteApiDefMap(self._api_def_map)
def put_api_def(self, text):
c_a... | self._op_per_name[op.name] = op | conditional_block |
c_api_util.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | (self):
# Note: when we're destructing the global context (i.e when the process is
# terminating) we can have already deleted other modules.
if c_api is not None and c_api.TF_DeleteStatus is not None:
c_api.TF_DeleteStatus(self.status)
class ScopedTFGraph(object):
"""Wrapper around TF_Graph that h... | __del__ | identifier_name |
c_api_util.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
def put_api_def(self, text):
c_api.TF_ApiDefMapPut(self._api_def_map, text, len(text))
def get_api_def(self, op_name):
api_def_proto = api_def_pb2.ApiDef()
buf = c_api.TF_ApiDefMapGet(self._api_def_map, op_name, len(op_name))
try:
api_def_proto.ParseFromString(c_api.TF_GetBuffer(buf))
f... | if c_api is not None and c_api.TF_DeleteApiDefMap is not None:
c_api.TF_DeleteApiDefMap(self._api_def_map) | identifier_body |
c_api_util.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | self.options = c_api.TF_NewImportGraphDefOptions()
def __del__(self):
# Note: when we're destructing the global context (i.e when the process is
# terminating) we can have already deleted other modules.
if c_api is not None and c_api.TF_DeleteImportGraphDefOptions is not None:
c_api.TF_DeleteIm... |
def __init__(self): | random_line_split |
recline.js | state) {
state.currentView = 'graph';
}
// Init the explorer.
init();
// Attach toogle event.
$('.recline-embed a.embed-link').on('click', function(){
$(this).parents('.recline-embed').find('.embed-code-wrapper').toggle();
return false;
})... |
// Creates the embed code.
function getEmbedCode (options){
return function(state){
var iframeOptions = _.clone(options);
var iframeTmpl = _.template('<iframe width="<%= width %>" height="<%= height %>" src="<%= src %>" frameborder="0"></iframe>');
var previewTmpl = _.template('<... | {
$explorer.html('<div class="messages error">' + message + '</div>');
} | identifier_body |
recline.js | state) {
state.currentView = 'graph';
}
// Init the explorer.
init();
// Attach toogle event.
$('.recline-embed a.embed-link').on('click', function(){
$(this).parents('.recline-embed').find('.embed-code-wrapper').toggle();
return false;
})... | };
break;
case 'xls':
datasetOptions = {
backend: 'xls',
url: file
};
break;
case 'dataproxy':
datasetOptions = {
url: file,
backend: 'dataproxy'
};
break;
default:
... | endpoint: 'api',
id: uuid,
backend: 'ckan' | random_line_split |
recline.js | : state
})
});
}
if (settings.map) {
views.push({
id: 'map',
label: 'Map',
view: new recline.View.Map({
model: dataset,
options: {
mapTilesURL: '//stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png',
... | tickFormatter | identifier_name | |
evemit.js | /**
* @name Evemit
* @description Minimal and fast JavaScript event emitter for Node.js and front-end.
* @author Nicolas Tallefourtane <dev@nicolab.net>
* @link https://github.com/Nicolab/evemit
* @license MIT https://github.com/Nicolab/evemit/blob/master/LICENSE
*/
;(function() {
'use strict';
/**
* Eve... | () {
this.events = {};
}
/**
* Register a new event listener for a given event.
*
* @param {string} event Event name.
* @param {function} fn Callback function (listener).
* @param {*} [context] Context for function execution.
* @return {Evemit} Current instance.
* @a... | Evemit | identifier_name |
evemit.js | /**
* @name Evemit
* @description Minimal and fast JavaScript event emitter for Node.js and front-end.
* @author Nicolas Tallefourtane <dev@nicolab.net>
* @link https://github.com/Nicolab/evemit
* @license MIT https://github.com/Nicolab/evemit/blob/master/LICENSE
*/
;(function() {
'use strict';
/**
* Eve... |
/**
* Register a new event listener for a given event.
*
* @param {string} event Event name.
* @param {function} fn Callback function (listener).
* @param {*} [context] Context for function execution.
* @return {Evemit} Current instance.
* @api public
*/
Evemit.proto... | {
this.events = {};
} | identifier_body |
evemit.js | /**
* @name Evemit
* @description Minimal and fast JavaScript event emitter for Node.js and front-end.
* @author Nicolas Tallefourtane <dev@nicolab.net>
* @link https://github.com/Nicolab/evemit
* @license MIT https://github.com/Nicolab/evemit/blob/master/LICENSE
*/
;(function() {
'use strict';
/**
* Eve... |
evs = this.events;
ltns = [];
for(var ev in evs) {
ltns = ltns.concat(evs[ev].valueOf());
}
return ltns;
};
/**
* Expose Evemit
* @type {Evemit}
*/
if(typeof module !== 'undefined' && module.exports) {
module.exports = Evemit;
} else {
window.Evemit = Evemit;
}... | {
return this.events[event] || [];
} | conditional_block |
evemit.js | /**
* @name Evemit
* @description Minimal and fast JavaScript event emitter for Node.js and front-end.
* @author Nicolas Tallefourtane <dev@nicolab.net>
* @link https://github.com/Nicolab/evemit
* @license MIT https://github.com/Nicolab/evemit/blob/master/LICENSE
*/
;(function() {
'use strict';
/**
* Eve... | break;
case 1:
fn.call(fn._E_ctx, arg1);
break;
case 2:
fn.call(fn._E_ctx, arg1, arg2);
break;
case 3:
fn.call(fn._E_ctx, arg1, arg2, arg3);
break;
case 4:
fn.call(fn._E_ctx, arg1, arg2, arg3, arg4);
... | switch (aLn) {
case 0:
fn.call(fn._E_ctx); | random_line_split |
filter.rs | use expression::{Expression, SelectableExpression, NonAggregate};
use expression::expression_methods::*;
use expression::predicates::And;
use helper_types::Filter;
use query_builder::*;
use query_dsl::FilterDsl;
use query_source::QuerySource;
use types::Bool;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Fil... | }
}
impl<Source, Predicate> QuerySource for FilteredQuerySource<Source, Predicate> where
Source: QuerySource,
{
fn from_clause(&self, out: &mut QueryBuilder) -> BuildQueryResult {
self.source.from_clause(out)
}
}
impl<Source, Predicate> UpdateTarget for FilteredQuerySource<Source, Predicate> w... | random_line_split | |
filter.rs | use expression::{Expression, SelectableExpression, NonAggregate};
use expression::expression_methods::*;
use expression::predicates::And;
use helper_types::Filter;
use query_builder::*;
use query_dsl::FilterDsl;
use query_source::QuerySource;
use types::Bool;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Fil... |
fn table(&self) -> &Self::Table {
self.source.table()
}
}
| {
out.push_sql(" WHERE ");
self.predicate.to_sql(out)
} | identifier_body |
filter.rs | use expression::{Expression, SelectableExpression, NonAggregate};
use expression::expression_methods::*;
use expression::predicates::And;
use helper_types::Filter;
use query_builder::*;
use query_dsl::FilterDsl;
use query_source::QuerySource;
use types::Bool;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct | <Source, Predicate> {
source: Source,
predicate: Predicate,
}
impl<Source, Predicate> FilteredQuerySource<Source, Predicate> {
pub fn new(source: Source, predicate: Predicate) -> Self {
FilteredQuerySource {
source: source,
predicate: predicate,
}
}
}
impl<Sourc... | FilteredQuerySource | identifier_name |
cls_plan_BDI.py | # cls_plan_BDI.py
import datetime
class Plan_BDI(object):
"""
class for handling various plans for AIKIF using
Belief | Desires | Intentions
"""
def __init__(self, name, dependency):
self.name = name
self.id = 1
self.dependency = dependency
self.plan_versi... | (self, name, tpe, val):
"""
adds a constraint for the plan
"""
self.constraint.append([name, tpe, val])
class Thoughts(object):
""" base class for beliefs, desires, intentions simply
to make it easier to manage similar groups of objects """
def __init__(self, thought... | add_constraint | identifier_name |
cls_plan_BDI.py | # cls_plan_BDI.py
import datetime
class Plan_BDI(object):
"""
class for handling various plans for AIKIF using
Belief | Desires | Intentions
"""
def __init__(self, name, dependency):
self.name = name
self.id = 1
self.dependency = dependency
self.plan_versi... | self.desires = Desires(self)
self.intentions = Intentions(self)
def __str__(self):
res = "---== Plan ==---- \n"
res += "name : " + self.name + "\n"
res += "version : " + self.plan_version + "\n"
for i in self.beliefs.list():
r... | random_line_split | |
cls_plan_BDI.py | # cls_plan_BDI.py
import datetime
class Plan_BDI(object):
"""
class for handling various plans for AIKIF using
Belief | Desires | Intentions
"""
def __init__(self, name, dependency):
self.name = name
self.id = 1
self.dependency = dependency
self.plan_versi... |
return lst
class Beliefs(Thoughts):
def __init__(self, parent_plan):
self.parent_plan = parent_plan
super(Beliefs, self).__init__('belief')
class Desires(Thoughts):
def __init__(self, parent_plan):
self.parent_plan = parent_plan
super(Desires, ... | if print_console is True:
print(self._type + str(i) + ' = ' + thought)
lst.append(thought) | conditional_block |
cls_plan_BDI.py | # cls_plan_BDI.py
import datetime
class Plan_BDI(object):
"""
class for handling various plans for AIKIF using
Belief | Desires | Intentions
"""
def __init__(self, name, dependency):
self.name = name
self.id = 1
self.dependency = dependency
self.plan_versi... |
def __str__(self):
res = ' -- Thoughts --\n'
for i in self._thoughts:
res += i + '\n'
return res
def add(self, name):
self._thoughts.append(name)
def list(self, print_console=False):
lst = []
for i, thought in enumerate(self._th... | self._thoughts = []
self._type = thought_type | identifier_body |
express-handlebars.d.ts | // Type definitions for express-handlebars
// Project: https://github.com/ericf/express-handlebars
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../es6-promise/es6-promise.d.ts" />
interface PartialTemplateO... | } | random_line_split | |
canteraTest.py | import unittest
import os
import numpy
from rmgpy.tools.canteraModel import findIgnitionDelay, CanteraCondition, Cantera
from rmgpy.quantity import Quantity
import rmgpy
class CanteraTest(unittest.TestCase):
def testIgnitionDelay(self):
"""
Test that findIgnitionDelay() works.
"""
... | self.assertTrue(checkEquivalentCanteraReaction(self.ctReactions[i],self.rmg_ctReactions[i])) | conditional_block | |
canteraTest.py | import unittest
import os
import numpy
from rmgpy.tools.canteraModel import findIgnitionDelay, CanteraCondition, Cantera
from rmgpy.quantity import Quantity
import rmgpy
class CanteraTest(unittest.TestCase):
| """
Test that the repr function for a CanteraCondition object can reconstitute
the same object
"""
reactorType='IdealGasReactor'
molFrac={'CC': 0.05, '[Ar]': 0.95}
P=(3,'atm')
T=(1500,'K')
terminationTime=(5e-5,'s')
condition = CanteraCondi... | def testIgnitionDelay(self):
"""
Test that findIgnitionDelay() works.
"""
t = numpy.arange(0,5,0.5)
P = numpy.array([0,0.33,0.5,0.9,2,4,15,16,16.1,16.2])
OH = numpy.array([0,0.33,0.5,0.9,2,4,15,16,7,2])
CO = OH*0.9
t_ign = findIgnitionDelay(t,P)
... | identifier_body |
canteraTest.py | import unittest
import os
import numpy
from rmgpy.tools.canteraModel import findIgnitionDelay, CanteraCondition, Cantera
from rmgpy.quantity import Quantity
import rmgpy
class CanteraTest(unittest.TestCase):
def testIgnitionDelay(self):
"""
Test that findIgnitionDelay() works.
"""
... | terminationTime,
molFrac,
T0=T,
P0=P)
reprCondition=eval(condition.__repr__())
self.assertEqual(reprCondition.T0.value_si,Quantity(T).value_si)
self.assertEqual(reprCondition.P0.value_si,Quantity(P).... | molFrac={'CC': 0.05, '[Ar]': 0.95}
P=(3,'atm')
T=(1500,'K')
terminationTime=(5e-5,'s')
condition = CanteraCondition(reactorType, | random_line_split |
canteraTest.py | import unittest
import os
import numpy
from rmgpy.tools.canteraModel import findIgnitionDelay, CanteraCondition, Cantera
from rmgpy.quantity import Quantity
import rmgpy
class | (unittest.TestCase):
def testIgnitionDelay(self):
"""
Test that findIgnitionDelay() works.
"""
t = numpy.arange(0,5,0.5)
P = numpy.array([0,0.33,0.5,0.9,2,4,15,16,16.1,16.2])
OH = numpy.array([0,0.33,0.5,0.9,2,4,15,16,7,2])
CO = OH*0.9
t_ign = findI... | CanteraTest | identifier_name |
test-regexp-instance-properties.js | /*
* RegExp instance properties.
*
* RegExp instance 'source' property must behave as specified in E5 Section
* 15.10.4.1 paragraphcs 5 and 6. Note: there is no one required form of source.
* Tests are for the source form that we want.
*/
/*
* FIXME: when does '\' in source need to be escaped?
*/
/*
* ... |
return res;
}
/*
* Empty string
*/
/*===
(?:)
===*/
try {
t = new RegExp('');
print(t.source);
t = eval('/' + t.source + '/' + getflags(t));
t = t.exec('');
print(t[0]);
} catch (e) {
print(e.name);
}
/*
* Forward slash
*/
/*===
\/
/
===*/
try {
t = new RegExp('/'); /* ma... | {
res += 'm';
} | conditional_block |
test-regexp-instance-properties.js | /*
* RegExp instance properties.
*
* RegExp instance 'source' property must behave as specified in E5 Section
* 15.10.4.1 paragraphcs 5 and 6. Note: there is no one required form of source.
* Tests are for the source form that we want.
*/
/*
* FIXME: when does '\' in source need to be escaped?
*/
/*
* ... | print(t[0]);
} catch (e) {
print(e.name);
}
/*
* Forward slash
*/
/*===
\/
/
===*/
try {
t = new RegExp('/'); /* matches one forward slash (only) */
print(t.source);
t = eval('/' + t.source + '/' + getflags(t));
t = t.exec('/');
print(t[0]);
} catch (e) {
print(e.name);
}
/*
* ... | t = eval('/' + t.source + '/' + getflags(t));
t = t.exec(''); | random_line_split |
test-regexp-instance-properties.js | /*
* RegExp instance properties.
*
* RegExp instance 'source' property must behave as specified in E5 Section
* 15.10.4.1 paragraphcs 5 and 6. Note: there is no one required form of source.
* Tests are for the source form that we want.
*/
/*
* FIXME: when does '\' in source need to be escaped?
*/
/*
* ... |
/*
* Empty string
*/
/*===
(?:)
===*/
try {
t = new RegExp('');
print(t.source);
t = eval('/' + t.source + '/' + getflags(t));
t = t.exec('');
print(t[0]);
} catch (e) {
print(e.name);
}
/*
* Forward slash
*/
/*===
\/
/
===*/
try {
t = new RegExp('/'); /* matches one forward ... | {
var res = ''
if (r.global) {
res += 'g';
}
if (r.ignoreCase) {
res += 'i';
}
if (r.multiline) {
res += 'm';
}
return res;
} | identifier_body |
test-regexp-instance-properties.js | /*
* RegExp instance properties.
*
* RegExp instance 'source' property must behave as specified in E5 Section
* 15.10.4.1 paragraphcs 5 and 6. Note: there is no one required form of source.
* Tests are for the source form that we want.
*/
/*
* FIXME: when does '\' in source need to be escaped?
*/
/*
* ... | (r) {
var res = ''
if (r.global) {
res += 'g';
}
if (r.ignoreCase) {
res += 'i';
}
if (r.multiline) {
res += 'm';
}
return res;
}
/*
* Empty string
*/
/*===
(?:)
===*/
try {
t = new RegExp('');
print(t.source);
t = eval('/' + t.source + '/' + ge... | getflags | identifier_name |
index.js | import React from 'react';
import { storiesOf } from '@storybook/react';
import moment from 'moment';
import {
withKnobs,
number,
object,
boolean,
text,
select,
date,
array,
color,
files,
} from '../../src';
const stories = storiesOf('Example of Knobs', module);
stories.addDecorator(withKnobs);
s... | padding: 20,
});
const style = {
...customStyle,
fontWeight: bold ? 800 : 400,
favoriteNumber,
color: selectedColor,
};
return (
<div style={style}>
I'm {name} and I was born on "{moment(dob).format('DD MMM YYYY')}" I like:{' '}
<ul>{passions.map(p => <li key={p}>{p}</li>)}... |
const customStyle = object('Style', {
fontFamily: 'Arial', | random_line_split |
invalid-crate-type.rs | // Copyright 2014 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 ... | // regression test for issue 11256
#![crate_type="foo"] //~ ERROR invalid `crate_type` value
// Tests for suggestions (#53958)
#![crate_type="statoclib"]
//~^ ERROR invalid `crate_type` value
//~| HELP did you mean
//~| SUGGESTION staticlib
#![crate_type="procmacro"]
//~^ ERROR invalid `crate_type` value
//~| HEL... | random_line_split | |
invalid-crate-type.rs | // Copyright 2014 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 ... | {
return
} | identifier_body | |
invalid-crate-type.rs | // Copyright 2014 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 ... | () {
return
}
| main | identifier_name |
cmd_notes.py | import json
import click
from tabulate import tabulate
@click.command('notes', short_help='List notes')
@click.option('--alert-id', '-i', metavar='UUID', help='alert IDs (can use short 8-char id)')
@click.pass_obj
def cli(obj, alert_id):
"""List notes."""
client = obj['client']
if alert_id:
if ob... |
else:
timezone = obj['timezone']
headers = {
'id': 'NOTE ID', 'text': 'NOTE', 'user': 'USER', 'type': 'TYPE', 'attributes': 'ATTRIBUTES',
'createTime': 'CREATED', 'updateTime': 'UPDATED', 'related': 'RELATED ID', 'customer': 'CUSTOMER'
}
... | r = client.http.get('/alert/{}/notes'.format(alert_id))
click.echo(json.dumps(r['notes'], sort_keys=True, indent=4, ensure_ascii=False)) | conditional_block |
cmd_notes.py | import json
import click
from tabulate import tabulate
@click.command('notes', short_help='List notes')
@click.option('--alert-id', '-i', metavar='UUID', help='alert IDs (can use short 8-char id)')
@click.pass_obj
def | (obj, alert_id):
"""List notes."""
client = obj['client']
if alert_id:
if obj['output'] == 'json':
r = client.http.get('/alert/{}/notes'.format(alert_id))
click.echo(json.dumps(r['notes'], sort_keys=True, indent=4, ensure_ascii=False))
else:
timezone = obj... | cli | identifier_name |
cmd_notes.py | import json
import click
from tabulate import tabulate
@click.command('notes', short_help='List notes') | @click.option('--alert-id', '-i', metavar='UUID', help='alert IDs (can use short 8-char id)')
@click.pass_obj
def cli(obj, alert_id):
"""List notes."""
client = obj['client']
if alert_id:
if obj['output'] == 'json':
r = client.http.get('/alert/{}/notes'.format(alert_id))
clic... | random_line_split | |
cmd_notes.py | import json
import click
from tabulate import tabulate
@click.command('notes', short_help='List notes')
@click.option('--alert-id', '-i', metavar='UUID', help='alert IDs (can use short 8-char id)')
@click.pass_obj
def cli(obj, alert_id):
| """List notes."""
client = obj['client']
if alert_id:
if obj['output'] == 'json':
r = client.http.get('/alert/{}/notes'.format(alert_id))
click.echo(json.dumps(r['notes'], sort_keys=True, indent=4, ensure_ascii=False))
else:
timezone = obj['timezone']
... | identifier_body | |
admin.py | # -----------------------------------------------------------------------------
# Karajlug.org
# Copyright (C) 2010 Karajlug community
#
# 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 Found... | (self, request, obj, form, change):
obj.creator = request.user
obj.save()
class RepositoryAdmin(admin.ModelAdmin):
"""
Admin interface class for repository model
"""
list_display = ("project", "address", "weight")
list_editable = ("address", "weight")
ordering = ("weight", )
... | save_model | identifier_name |
admin.py | # -----------------------------------------------------------------------------
# Karajlug.org
# Copyright (C) 2010 Karajlug community
#
# 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 Found... |
admin.site.register(Project, ProjectAdmin)
admin.site.register(Repository, RepositoryAdmin)
| """
Admin interface class for repository model
"""
list_display = ("project", "address", "weight")
list_editable = ("address", "weight")
ordering = ("weight", )
search_fields = ("project", )
list_filter = ("project", ) | identifier_body |
admin.py | # -----------------------------------------------------------------------------
# Karajlug.org
# Copyright (C) 2010 Karajlug community
#
# 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 Found... |
class ProjectAdmin(admin.ModelAdmin):
"""
Admin interface class for project model
"""
list_display = ("__unicode__", "version", "home", "license", "vcs",
"creator", "weight")
ordering = ("weight", )
list_editable = ("home", "weight")
search_fields = ("name", )
prepo... | from .models import Project, Repository | random_line_split |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.