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
_isyclimate.py
""" This is a subfile for IsyClass.py These funtions are accessable via the Isy class opj """ __author__ = 'Peter Shipley <peter.shipley@gmail.com>' __copyright__ = "Copyright (C) 2013 Peter Shipley" __license__ = "BSD" import time ## ## Climate funtions ## def load_clim(self): """ Load climate data from ISY ...
clim_tree = self._getXMLetree("/rest/climate") self.climateinfo = dict() if clim_tree is None: return # Isy._printXML(self.climateinfo) for cl in clim_tree.iter("climate"): for k, v in cl.items(): self.climateinfo[k] = v for ce in list(cl): self.clim...
print("load_clim")
conditional_block
_isyclimate.py
""" This is a subfile for IsyClass.py These funtions are accessable via the Isy class opj """ __author__ = 'Peter Shipley <peter.shipley@gmail.com>' __copyright__ = "Copyright (C) 2013 Peter Shipley" __license__ = "BSD" import time ## ## Climate funtions ## def load_clim(self): """ Load climate data from ISY ...
def clim_query(self): """ returns dictionary of climate info """ if not self.climateinfo: self.load_clim() # # ADD CODE to check self.cachetime # return self.climateinfo def clim_iter(self): """ Iterate though climate values args: None returns: ...
pass
identifier_body
setup.py
try: from setuptools import setup, Extension from setuptools.command import install_lib as _install_lib except ImportError: from distutils.core import setup, Extension from distutils.command import install_lib as _install_lib from codecs import open from os import path from os import environ from sys import pla...
elif platform == 'darwin': environ['CFLAGS'] = '-std=c99 -D_GNU_SOURCE -fcommon' else: environ['CFLAGS'] = '-std=c99 -D_GNU_SOURCE' # Patch "install_lib" command to run build_clib before build_ext # to properly work with easy_install. # See: http://bugs.python.org/issue5243 class install_lib(_install_lib.instal...
environ['CFLAGS'] = '-std=c99 -D_GNU_SOURCE -_WIN32'
conditional_block
setup.py
try: from setuptools import setup, Extension from setuptools.command import install_lib as _install_lib except ImportError: from distutils.core import setup, Extension from distutils.command import install_lib as _install_lib from codecs import open from os import path from os import environ from sys import pla...
(_install_lib.install_lib): def build(self): if not self.skip_build: if self.distribution.has_pure_modules(): self.run_command('build_py') if self.distribution.has_c_libraries(): self.run_command('build_clib') if self.distribution.has_ext_modules(): self.run_comma...
install_lib
identifier_name
setup.py
try: from setuptools import setup, Extension from setuptools.command import install_lib as _install_lib except ImportError: from distutils.core import setup, Extension from distutils.command import install_lib as _install_lib from codecs import open from os import path from os import environ from sys import pla...
rules_lib = ('durable_rules_engine_py', {'sources': ['src/rules/%s.c' % src for src in ('json', 'rete', 'state', 'events', 'regex')]}) rules = Extension('durable_rules_engine', sources = ['src/rulespy/rules.c'], include_dirs=['src/rules']) here = path.abspath(path.dirname(__file_...
def build(self): if not self.skip_build: if self.distribution.has_pure_modules(): self.run_command('build_py') if self.distribution.has_c_libraries(): self.run_command('build_clib') if self.distribution.has_ext_modules(): self.run_command('build_ext')
identifier_body
setup.py
try: from setuptools import setup, Extension from setuptools.command import install_lib as _install_lib except ImportError: from distutils.core import setup, Extension from distutils.command import install_lib as _install_lib from codecs import open from os import path from os import environ from sys import pla...
rules = Extension('durable_rules_engine', sources = ['src/rulespy/rules.c'], include_dirs=['src/rules']) here = path.abspath(path.dirname(__file__)) + '/docs/py' with open(path.join(here, 'README.txt'), encoding='utf-8') as f: long_description = f.read() setup ( name = 'du...
rules_lib = ('durable_rules_engine_py', {'sources': ['src/rules/%s.c' % src for src in ('json', 'rete', 'state', 'events', 'regex')]})
random_line_split
sliders.js
/* jshint undef: true, unused: true */ /* global define: false */ define(['jquery', 'owl', 'velocity', 'velocityUi'], function($, owl) { // Selector var S = { owl: $('.slider') }; // Main component var Sliders = { init: function() { if (S.owl.hasClass('js-main-slider'))...
} } } Sliders.init(); });
{ // Show text $('.text', thisEl).velocity('stop').velocity('transition.slideDownIn', function() { $('.button', thisEl).velocity('stop').velocity('transition.slideDownIn'); }); }
conditional_block
sliders.js
/* jshint undef: true, unused: true */ /* global define: false */ define(['jquery', 'owl', 'velocity', 'velocityUi'], function($, owl) { // Selector var S = { owl: $('.slider') }; // Main component var Sliders = { init: function() { if (S.owl.hasClass('js-main-slider'))...
if (target.hasClass('js-main-slider')) { Sliders.animateText.afterInit($('.js-main-slider')); } }, animateText: { afterInit: function(target) { target.on('translated.owl.carousel', function(event) { Sliders.animate...
random_line_split
dircolors.rs
: &str = "bourne-shell"; pub const C_SHELL: &str = "c-shell"; pub const PRINT_DATABASE: &str = "print-database"; pub const FILE: &str = "FILE"; } static USAGE: &str = "{} [OPTION]... [FILE]"; static SUMMARY: &str = "Output commands to set the LS_COLORS environment variable."; static LONG_HELP: &str = " If...
(&self, pat: &str) -> bool { pat.parse::<glob::Pattern>().unwrap().matches(self) } } #[derive(PartialEq)] enum ParseState { Global, Matched, Continue, Pass, } use std::collections::HashMap; use uucore::{format_usage, InvalidEncodingHandling}; fn parse<T>(lines: T, fmt: &OutputFmt, fp: &str...
fnmatch
identifier_name
dircolors.rs
HELL: &str = "bourne-shell"; pub const C_SHELL: &str = "c-shell"; pub const PRINT_DATABASE: &str = "print-database"; pub const FILE: &str = "FILE"; } static USAGE: &str = "{} [OPTION]... [FILE]"; static SUMMARY: &str = "Output commands to set the LS_COLORS environment variable."; static LONG_HELP: &str = "...
table.insert("fifo", "pi"); table.insert("pipe", "pi"); table.insert("sock", "so"); table.insert("blk", "bd"); table.insert("block", "bd"); table.insert("chr", "cd"); table.insert("char", "cd"); table.insert("door", "do"); table.insert("exec", "ex"); table.insert("left", "lc"); ...
{ // 1440 > $(dircolors | wc -m) let mut result = String::with_capacity(1440); match fmt { OutputFmt::Shell => result.push_str("LS_COLORS='"), OutputFmt::CShell => result.push_str("setenv LS_COLORS '"), _ => unreachable!(), } let mut table: HashMap<&str, &str> = HashMap::wit...
identifier_body
dircolors.rs
: &str = "bourne-shell"; pub const C_SHELL: &str = "c-shell"; pub const PRINT_DATABASE: &str = "print-database"; pub const FILE: &str = "FILE"; } static USAGE: &str = "{} [OPTION]... [FILE]"; static SUMMARY: &str = "Output commands to set the LS_COLORS environment variable."; static LONG_HELP: &str = " If...
#[derive(PartialEq)] enum ParseState { Global, Matched, Continue, Pass, } use std::collections::HashMap; use uucore::{format_usage, InvalidEncodingHandling}; fn parse<T>(lines: T, fmt: &OutputFmt, fp: &str) -> Result<String, String> where T: IntoIterator, T::Item: Borrow<str>, { // 1440 > ...
fn fnmatch(&self, pat: &str) -> bool { pat.parse::<glob::Pattern>().unwrap().matches(self) } }
random_line_split
dircolors.rs
!s.is_empty() => { let shell_path: &Path = s.as_ref(); if let Some(name) = shell_path.file_name() { if name == "csh" || name == "tcsh" { OutputFmt::CShell } else { OutputFmt::Shell } } else { ...
{ state = ParseState::Pass; }
conditional_block
webcomp.ts
/** * Licensed to Cloudera, Inc. under one
* "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, ...
* or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. Cloudera, Inc. licenses this file * to you under the Apache License, Version 2.0 (the
random_line_split
liblancard.ts
<!DOCTYPE TS><TS> <context> <name>LanCardGUI</name> <message> <source>LAN card</source> <translation>LAN karta</translation> </message> <message> <source>Any available LAN card</source> <translation>Jakákoliv dostupná LAN karta</translation> </message> <message> ...
<message> <source>LAN card</source> <translation>LAN karta</translation> </message> <message> <source>&lt;p&gt;Sets up a wired regular LAN card.&lt;/p&gt;&lt;p&gt;Use this to set up 10/100/1000 MBit LAN cards.&lt;/p&gt;</source> <translation>&lt;p&gt;Nastaví síťovou LAN kartu...
<name>LanCardNetNode</name>
random_line_split
task5.py
import mdp import Oger import numpy import pylab import random ### README # study the memory capacities of same size reservoirs def main(): num_waves = 100
### Create reservoir # construct individual nodes, reservoir_size = 100 reservoir = Oger.nodes.ReservoirNode(output_dim=reservoir_size, spectral_radius=1.001) # readout = Oger.nodes.RidgeRegressionNode() # build network with MDP framework # flow = mdp.Flow([reservoir, readout], verbose=1)...
waves = [gen_test_wave(2.0*random.random()-1.0) for x in range(num_waves)] print "Shape of waves" , numpy.shape(waves[0])
random_line_split
task5.py
import mdp import Oger import numpy import pylab import random ### README # study the memory capacities of same size reservoirs def main(): num_waves = 100 waves = [gen_test_wave(2.0*random.random()-1.0) for x in range(num_waves)] print "Shape of waves" , numpy.shape(waves[0]) ### Create reservoir...
# fail case return None # Call to main if __name__=='__main__': main()
step += 1
conditional_block
task5.py
import mdp import Oger import numpy import pylab import random ### README # study the memory capacities of same size reservoirs def main(): num_waves = 100 waves = [gen_test_wave(2.0*random.random()-1.0) for x in range(num_waves)] print "Shape of waves" , numpy.shape(waves[0]) ### Create reservoir...
def measure_memory(signal): # given a reservoir activity matrix for a given signal, find the first step where all activity<0.01 # for testing purpose only # step count starts at 0 step = 15 for frame in signal[15:]: if all(i<0.01 and i>-0.01 for i in frame): # found the fir...
startup_time = 10 # how long the data stays at 0 at the end cooldown_time = 79 # how long the signal will be active active_time = 11 wave = [numpy.array([0]) for x in range(startup_time)] wave += [numpy.array([max_value]) for x in range(active_time)] wave += [numpy.array([0]) for x in ran...
identifier_body
task5.py
import mdp import Oger import numpy import pylab import random ### README # study the memory capacities of same size reservoirs def main(): num_waves = 100 waves = [gen_test_wave(2.0*random.random()-1.0) for x in range(num_waves)] print "Shape of waves" , numpy.shape(waves[0]) ### Create reservoir...
(max_value = 1): # generates a 1D test wave # simple step function # tunable parameters # the max value attained by the wave # how long the data stays at 0 at the start startup_time = 10 # how long the data stays at 0 at the end cooldown_time = 79 # how long the signal will be activ...
gen_test_wave
identifier_name
routing_auto_detection.py
from importlib import import_module from djangoautoconf.auto_conf_urls import enum_app_names from djangoautoconf.auto_conf_utils import is_at_least_one_sub_filesystem_item_exists, get_module_path from ufs_tools.short_decorator.ignore_exception import ignore_exc_with_result def
(): from django.conf import settings routing_holder = settings.CHANNEL_LAYERS["default"]["ROUTING"] routing_module = ".".join(routing_holder.split(".")[0:-1]) root_url = import_module(routing_module) root_default_channel_routing = root_url.default_channel_routing for app in enum_app_names(): ...
autodiscover
identifier_name
routing_auto_detection.py
from importlib import import_module from djangoautoconf.auto_conf_urls import enum_app_names from djangoautoconf.auto_conf_utils import is_at_least_one_sub_filesystem_item_exists, get_module_path from ufs_tools.short_decorator.ignore_exception import ignore_exc_with_result def autodiscover(): from django.conf im...
@ignore_exc_with_result(exception_result=[], is_notification_needed=True) def get_routing_settings(routing_module_name): routing_module = import_module(routing_module_name) routing_settings = routing_module.channel_routing return routing_settings
if app == "channels": continue mod = import_module(app) if is_at_least_one_sub_filesystem_item_exists(get_module_path(mod), ["routing.py"]): routing_module_name = "%s.routing" % app routing_settings = get_routing_settings(routing_module_name) root_default...
conditional_block
routing_auto_detection.py
from importlib import import_module from djangoautoconf.auto_conf_urls import enum_app_names from djangoautoconf.auto_conf_utils import is_at_least_one_sub_filesystem_item_exists, get_module_path from ufs_tools.short_decorator.ignore_exception import ignore_exc_with_result def autodiscover():
@ignore_exc_with_result(exception_result=[], is_notification_needed=True) def get_routing_settings(routing_module_name): routing_module = import_module(routing_module_name) routing_settings = routing_module.channel_routing return routing_settings
from django.conf import settings routing_holder = settings.CHANNEL_LAYERS["default"]["ROUTING"] routing_module = ".".join(routing_holder.split(".")[0:-1]) root_url = import_module(routing_module) root_default_channel_routing = root_url.default_channel_routing for app in enum_app_names(): if...
identifier_body
routing_auto_detection.py
from importlib import import_module from djangoautoconf.auto_conf_urls import enum_app_names from djangoautoconf.auto_conf_utils import is_at_least_one_sub_filesystem_item_exists, get_module_path from ufs_tools.short_decorator.ignore_exception import ignore_exc_with_result def autodiscover(): from django.conf im...
root_url = import_module(routing_module) root_default_channel_routing = root_url.default_channel_routing for app in enum_app_names(): if app == "channels": continue mod = import_module(app) if is_at_least_one_sub_filesystem_item_exists(get_module_path(mod), ["routing.py"...
routing_holder = settings.CHANNEL_LAYERS["default"]["ROUTING"] routing_module = ".".join(routing_holder.split(".")[0:-1])
random_line_split
mhc_common.py
# Copyright (c) 2014. Mount Sinai School of Medicine # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
else: max_len = min(max_len, len(hla)) while pos < max_len and pred(hla[pos]): result += hla[pos] pos +=1 return result, hla[pos:] def _parse_letters(hla, max_len = None): return _parse_substring(hla, lambda c: c.isalpha(), max_len = max_len) def _parse_numbers(hla, max_len =...
max_len = len(hla)
conditional_block
mhc_common.py
# Copyright (c) 2014. Mount Sinai School of Medicine # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
return 1 elif gene in MHC_2_GENE_SET: return 2 raise ValueError( "HLA gene %s is not a part of the MHC 1 or MHC 2 gene sets." % gene) return 1
if gene in MHC_1_GENE_SET:
random_line_split
mhc_common.py
# Copyright (c) 2014. Mount Sinai School of Medicine # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
def normalize_hla_allele_name(hla): """ HLA allele names can look like: - HLA-A*03:02 - HLA-A02:03 - HLA-A:02:03 - HLA-A2 - A2 - A*03:02 - A02:02 - A:02:03 ...should all be normalized to: HLA-A*03:02 """ original = hla hla...
return _parse_substring(hla, lambda c: not c.isdigit(), max_len = max_len)
identifier_body
mhc_common.py
# Copyright (c) 2014. Mount Sinai School of Medicine # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
(hla, max_len = None): return _parse_substring(hla, lambda c: not c.isdigit(), max_len = max_len) def normalize_hla_allele_name(hla): """ HLA allele names can look like: - HLA-A*03:02 - HLA-A02:03 - HLA-A:02:03 - HLA-A2 - A2 - A*03:02 - A02:02 ...
_parse_not_numbers
identifier_name
sync.js
/* * linksync commander -- Command line interface to LinkSync * Copyright (C) 2016 Andrew Duncan * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This program is...
if (exists) { fs.writeFile(filepath, response_buffer, function() {}); } else { fs.mkdir(dirname, mask, true, function() { fs.writeFile(filepath, response_buffer, function() {}); }); } }); console.log("%s (%d bytes) / %s", queue_item.url, res...
random_line_split
sync.js
/* * linksync commander -- Command line interface to LinkSync * Copyright (C) 2016 Andrew Duncan * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This program is...
else { fs.mkdir(dirname, mask, true, function() { fs.writeFile(filepath, response_buffer, function() {}); }); } }); console.log("%s (%d bytes) / %s", queue_item.url, response_buffer.length, response.headers["content-type"]); }); self.crawler.on("fetcherror...
{ fs.writeFile(filepath, response_buffer, function() {}); }
conditional_block
firstlook.py
os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.sex' sextractor_param_fname = os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.param' sextractor_filter_fname = os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.conv' # tolerance for object matching dRa = 0.00062 ...
# open log file log = open(log_fname, 'a+') # set up the command line argument parser parser = argparse.ArgumentParser( description='Perform lightcurve photometry using sextractor.') # parser.add_argument('asteroid', metavar='asteroid#', type=int, # help='Target asteroid number') args = parse...
t = Time(jd, format='mjd', scale='utc') return t.iso
identifier_body
firstlook.py
starrs min magnitude pso_min_mag = 0 # # END SETTINGS # # logger def logme(str): log.write(str + "\n") print str return def exit(): logme('Program execution halted.') log.close() os.sys.exit(1) # run external process def runSubprocess(command_array): # command array is array with co...
# 'dec': '', 'object_name': '%d' % args.asteroid, 'found': True})
random_line_split
firstlook.py
os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.sex' sextractor_param_fname = os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.param' sextractor_filter_fname = os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.conv' # tolerance for object matching dRa = 0.00062 ...
# does output directory exist? If not, create it... outputs = [sex_output_path, cleaned_output_path, bad_path] for output in outputs: try: os.mkdir(output) except: pass image_data = [] # get a list of all FITS files in the input directory fits_files = glob.glob(input_path+'*.fits')+glob.glob(...
logme('Error. The file or path (%s) does not exist.' % input) exit()
conditional_block
firstlook.py
os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.sex' sextractor_param_fname = os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.param' sextractor_filter_fname = os.path.dirname( os.path.realpath(__file__)) + '\\' + 'sexcurve.conv' # tolerance for object matching dRa = 0.00062 ...
(jd): t = Time(jd, format='mjd', scale='utc') return t.iso # open log file log = open(log_fname, 'a+') # set up the command line argument parser parser = argparse.ArgumentParser( description='Perform lightcurve photometry using sextractor.') # parser.add_argument('asteroid', metavar='asteroid#', type=int...
jdToYYMMDD_HHMMSS
identifier_name
file_mapper.py
mo_dots.lists import last from mo_files import TempFile from mo_future import text from mo_json import stream from mo_logs import Log, Except from mo_times import Timer, Date, Duration from mo_http import http from mo_http.big_data import scompressed2ibytes class FileMapper(object): """ MAP FROM COVERAGE FIL...
(self, source_key, filename, artifact, task_cluster_record): """ :param source_key: FOR DEBUGGING :param filename: THE FILE TO LOOK FOR :param artifact: THE ARTIFACT (FOR DEBUGGING) :param task_cluster_record: FOR OTHER INFO THAT MAY HELP IDENTIFYING THE RIGHT SOURCE FILE ...
find
identifier_name
file_mapper.py
mo_dots.lists import last from mo_files import TempFile from mo_future import text from mo_json import stream from mo_logs import Log, Except from mo_times import Timer, Date, Duration from mo_http import http from mo_http.big_data import scompressed2ibytes class FileMapper(object): """ MAP FROM COVERAGE FIL...
if filename in self.known_failures: return {"name": filename} suite_names = SUITES.get( task_cluster_record.suite.name, {task_cluster_record.run.suite.name} ) filename = ( filename.split(" line ")[0] .split(...
return {"name": found, "is_firefox": True, "old_name": filename} if self.complicated_failures(filename): return {"name": filename} if self.predefined_failures(filename): return {"name": filename}
random_line_split
file_mapper.py
mo_dots.lists import last from mo_files import TempFile from mo_future import text from mo_json import stream from mo_logs import Log, Except from mo_times import Timer, Date, Duration from mo_http import http from mo_http.big_data import scompressed2ibytes class FileMapper(object): """ MAP FROM COVERAGE FIL...
return find_best(list(sorted(_values(curr))), i > 1) except Exception as ee: Log.warning( "Can not resolve {{filename}} in {{url}} for key {{key}}", key=source_key, url=artifact.url, filename=filename, cause...
return {"name": filename}
conditional_block
file_mapper.py
mo_dots.lists import last from mo_files import TempFile from mo_future import text from mo_json import stream from mo_logs import Log, Except from mo_times import Timer, Date, Duration from mo_http import http from mo_http.big_data import scompressed2ibytes class FileMapper(object): """ MAP FROM COVERAGE FIL...
{"eq": {"treeherder.symbol": "Bugzilla"}}, {"lt": {"repo.push.date": timestamp}}, ] }, "sort": {"repo.push.date": "desc"}, "limit": 100, "select": ["url", "repo.push.date"], ...
""" :param task_cluster_record: EXPECTING TC RECORD WITH repo.push.date SO AN APPROXIMATE SOURCE FILE LIST CAN BE FOUND """ # TODO: THERE IS A RISK THE FILE MAPPING MAY CHANGE # FIND RECENT FILE LISTING timestamp = Date( coalesce( task_cluster_record....
identifier_body
groupme_bot.py
import os from flask import Flask from flask import request import requests import random import codecs #API id #move this to a config file bot_id = '' app = Flask(__name__) #encode string as ASCII def
(text): text = text.lower() return text.encode('ascii','replace_spc') def send(text): message = { 'text' : text, 'bot_id' : bot_id } r = requests.post("https://api.groupme.com/v3/bots/post", params = message) @app.route('/', methods=['POST']) def message(): if not request.json or not 'text' in request.json:...
stripped
identifier_name
groupme_bot.py
import os from flask import Flask from flask import request import requests import random import codecs #API id #move this to a config file bot_id = '' app = Flask(__name__) #encode string as ASCII def stripped(text): text = text.lower() return text.encode('ascii','replace_spc')
def send(text): message = { 'text' : text, 'bot_id' : bot_id } r = requests.post("https://api.groupme.com/v3/bots/post", params = message) @app.route('/', methods=['POST']) def message(): if not request.json or not 'text' in request.json: return user_id = request.json['user_id'] nick = request.json['nam...
random_line_split
groupme_bot.py
import os from flask import Flask from flask import request import requests import random import codecs #API id #move this to a config file bot_id = '' app = Flask(__name__) #encode string as ASCII def stripped(text): text = text.lower() return text.encode('ascii','replace_spc') def send(text): message = { 't...
user_id = request.json['user_id'] nick = request.json['name'].lower() message = request.json['text'].lower() message = stripped(message).strip() print 'Got message' + message message_callback.got_message(message, nick); return '' if __name__ == "__main__": app.run(port = 8080, host...
return
conditional_block
groupme_bot.py
import os from flask import Flask from flask import request import requests import random import codecs #API id #move this to a config file bot_id = '' app = Flask(__name__) #encode string as ASCII def stripped(text): text = text.lower() return text.encode('ascii','replace_spc') def send(text):
@app.route('/', methods=['POST']) def message(): if not request.json or not 'text' in request.json: return user_id = request.json['user_id'] nick = request.json['name'].lower() message = request.json['text'].lower() message = stripped(message).strip() print 'Got message' + message message_ca...
message = { 'text' : text, 'bot_id' : bot_id } r = requests.post("https://api.groupme.com/v3/bots/post", params = message)
identifier_body
oauth.rs
extern crate rocket; use rocket::request::Form; use rocket::response::Redirect; use rocket_contrib::Json; use url::Url; #[derive(FromForm, Debug)] struct AuthForm { response_type: Option<String>, client_id: Option<String>, redirect_uri: Option<String>, scope: Option<String>, state: Option<String>,...
access_token: String, refresh_token: String, expires_in: i64, } #[post("/token", data = "<data>")] fn token(data: Form<TokenForm>) -> Json<AuthResponse> { debug!("token: {:?}", data.get()); Json(AuthResponse { token_type: "bearer".to_string(), access_token: "xxx".to_string(), ...
struct AuthResponse { token_type: String,
random_line_split
oauth.rs
extern crate rocket; use rocket::request::Form; use rocket::response::Redirect; use rocket_contrib::Json; use url::Url; #[derive(FromForm, Debug)] struct AuthForm { response_type: Option<String>, client_id: Option<String>, redirect_uri: Option<String>, scope: Option<String>, state: Option<String>,...
(data: AuthForm) -> Redirect { debug!("auth data: {:?}", data); let s = match data.state { Some(x) => x, _ => "".to_string(), }; let u = match data.redirect_uri { Some(x) => { let mut url = Url::parse(&x).unwrap(); url.set_query(Some(&format!("code=123&s...
auth
identifier_name
oauth.rs
extern crate rocket; use rocket::request::Form; use rocket::response::Redirect; use rocket_contrib::Json; use url::Url; #[derive(FromForm, Debug)] struct AuthForm { response_type: Option<String>, client_id: Option<String>, redirect_uri: Option<String>, scope: Option<String>, state: Option<String>,...
#[derive(FromForm, Debug)] struct TokenForm { grant_type: String, code: String, redirect_uri: String, client_id: String, client_secret: String, } #[derive(Serialize)] struct AuthResponse { token_type: String, access_token: String, refresh_token: String, expires_in: i64, } #[post(...
{ debug!("auth data: {:?}", data); let s = match data.state { Some(x) => x, _ => "".to_string(), }; let u = match data.redirect_uri { Some(x) => { let mut url = Url::parse(&x).unwrap(); url.set_query(Some(&format!("code=123&state={}", s))); u...
identifier_body
index.ts
import "regenerator-runtime/runtime"; import { GtfCore } from "./core"; import { GtfAgm } from "./agm"; import { GtfChannels } from "./channels"; import { GtfAppManager } from "./appManager"; import { GtfIntents } from './intents'; import { GtfLogger } from "./logger"; import { GtfConnection } from "./connection...
}, 200); } static requestPermission() { return "granted"; } onclick: any; }; const fakeSwRegistration = new Promise<ServiceWorkerRegistration>((resolve) => resolve({ showNotification: window.showNotificationFake } as ServiceWorkerRegistratio...
{ const fakeEvent = { target: options }; this.onclick(fakeEvent); }
conditional_block
index.ts
import "regenerator-runtime/runtime"; import { GtfCore } from "./core"; import { GtfAgm } from "./agm"; import { GtfChannels } from "./channels"; import { GtfAppManager } from "./appManager"; import { GtfIntents } from './intents'; import { GtfLogger } from "./logger"; import { GtfConnection } from "./connection...
(title: string, options: any) { window.notificationConstructorFake(title, options); setTimeout(() => { if (window.notificationsFakeTriggerClick) { const fakeEvent = { target: options }; ...
constructor
identifier_name
index.ts
import "regenerator-runtime/runtime"; import { GtfCore } from "./core"; import { GtfAgm } from "./agm"; import { GtfChannels } from "./channels"; import { GtfAppManager } from "./appManager"; import { GtfIntents } from './intents'; import { GtfLogger } from "./logger"; import { GtfConnection } from "./connection...
return fakeSwRegistration; }; const startGtf = async () => { const glueWebConfig: Glue42Web.Config = { libraries: [GlueWorkspaces], systemLogger: { level: "error" } }; const gluePlatformConfig: Glue42WebPlatform.Config = { // TODO: Test supplier and remote applica...
onclick: any; }; const fakeSwRegistration = new Promise<ServiceWorkerRegistration>((resolve) => resolve({ showNotification: window.showNotificationFake } as ServiceWorkerRegistration));
random_line_split
index.ts
import "regenerator-runtime/runtime"; import { GtfCore } from "./core"; import { GtfAgm } from "./agm"; import { GtfChannels } from "./channels"; import { GtfAppManager } from "./appManager"; import { GtfIntents } from './intents'; import { GtfLogger } from "./logger"; import { GtfConnection } from "./connection...
static requestPermission() { return "granted"; } onclick: any; }; const fakeSwRegistration = new Promise<ServiceWorkerRegistration>((resolve) => resolve({ showNotification: window.showNotificationFake } as ServiceWorkerRegistration)); return fakeSwRegistra...
{ window.notificationConstructorFake(title, options); setTimeout(() => { if (window.notificationsFakeTriggerClick) { const fakeEvent = { target: options }; this.onclick(fakeEvent); ...
identifier_body
lib.rs
//! This crate provides a library for Halo: Combat Evolved cache file parsing and manipulation. pub mod tag; pub mod map; pub mod resource_map; extern crate encoding; use self::encoding::{Encoding, DecoderTrap, EncoderTrap}; use self::encoding::all::ISO_8859_1; // This function will create an ISO 8859-1 vec from a st...
{ length + (4 - (length % 4)) % 4 }
identifier_body
lib.rs
//! This crate provides a library for Halo: Combat Evolved cache file parsing and manipulation. pub mod tag; pub mod map; pub mod resource_map; extern crate encoding; use self::encoding::{Encoding, DecoderTrap, EncoderTrap}; use self::encoding::all::ISO_8859_1; // This function will create an ISO 8859-1 vec from a st...
(string : &str) -> Result<Vec<u8>,&'static str> { match ISO_8859_1.encode(&string, EncoderTrap::Strict) { Ok(n) => Ok(n), Err(_) => Err("failed to encode string") } } // This function will create a string from an ISO 8859-1 string in a slice. fn string_from_slice(slice : &[u8]) -> Result<String...
encode_latin1_string
identifier_name
lib.rs
//! This crate provides a library for Halo: Combat Evolved cache file parsing and manipulation. pub mod tag; pub mod map; pub mod resource_map; extern crate encoding; use self::encoding::{Encoding, DecoderTrap, EncoderTrap}; use self::encoding::all::ISO_8859_1;
// This function will create an ISO 8859-1 vec from a string fn encode_latin1_string(string : &str) -> Result<Vec<u8>,&'static str> { match ISO_8859_1.encode(&string, EncoderTrap::Strict) { Ok(n) => Ok(n), Err(_) => Err("failed to encode string") } } // This function will create a string from ...
random_line_split
jquery.calendars.picker-ar-EG.js
/* http://keith-wood.name/calendars.html Arabic localisation for calendars datepicker for jQuery. Mahmoud Khaled -- mahmoud.khaled@badrit.com NOTE: monthNames are the new months names */ (function($) {
prevText: '&#x3c;السابق', prevStatus: 'عرض الشهر السابق', prevJumpText: '&#x3c;&#x3c;', prevJumpStatus: '', nextText: 'التالي&#x3e;', nextStatus: 'عرض الشهر القادم', nextJumpText: '&#x3e;&#x3e;', nextJumpStatus: '', currentText: 'اليوم', currentStatus: 'عرض الشهر الحالي', todayText: 'الي...
'use strict'; $.calendarsPicker.regionalOptions['ar-EG'] = { renderer: $.calendarsPicker.defaultRenderer,
random_line_split
build.rs
where P: AsRef<Path>, S: Borrow<str> + AsRef<OsStr>, { let cmd = cmd.as_ref(); let cmd = if cmd.components().count() > 1 && cmd.is_relative() { // If `cmd` is a relative path (and not a bare command that should be // looked up in PATH), absolutize it relative to `dir`, as otherwise the ...
config .define("RDKAFKA_BUILD_STATIC", "1") .define("RDKAFKA_BUILD_TESTS", "0") .define("RDKAFKA_BUILD_EXAMPLES", "0") // CMAKE_INSTALL_LIBDIR is inferred as "lib64" on some platforms, but we // want a stable location that we can add to the linker search path. // Sin...
let mut config = cmake::Config::new("librdkafka");
random_line_split
build.rs
where P: AsRef<Path>, S: Borrow<str> + AsRef<OsStr>, { let cmd = cmd.as_ref(); let cmd = if cmd.components().count() > 1 && cmd.is_relative() { // If `cmd` is a relative path (and not a bare command that should be // looked up in PATH), absolutize it relative to `dir`, as otherwise the ...
} else { configure_flags.push("--disable-lz4-ext".into()); } env::set_var("CFLAGS", cflags.join(" ")); env::set_var("LDFLAGS", ldflags.join(" ")); let out_dir = env::var("OUT_DIR").expect("OUT_DIR missing"); if !Path::new(&out_dir).join("LICENSE").exists() { // We're not allo...
{ cflags.push(format!("-I{}/include", lz4_root)); ldflags.push(format!("-L{}", lz4_root)); }
conditional_block
build.rs
where P: AsRef<Path>, S: Borrow<str> + AsRef<OsStr>, { let cmd = cmd.as_ref(); let cmd = if cmd.components().count() > 1 && cmd.is_relative() { // If `cmd` is a relative path (and not a bare command that should be // looked up in PATH), absolutize it relative to `dir`, as otherwise the ...
() { let mut configure_flags: Vec<String> = Vec::new(); let mut cflags = Vec::new(); if let Ok(var) = env::var("CFLAGS") { cflags.push(var); } let mut ldflags = Vec::new(); if let Ok(var) = env::var("LDFLAGS") { ldflags.push(var); } if env::var("CARGO_FEATURE_SSL").is_...
build_librdkafka
identifier_name
build.rs
where P: AsRef<Path>, S: Borrow<str> + AsRef<OsStr>, { let cmd = cmd.as_ref(); let cmd = if cmd.components().count() > 1 && cmd.is_relative() { // If `cmd` is a relative path (and not a bare command that should be // looked up in PATH), absolutize it relative to `dir`, as otherwise the ...
config.define("WITH_ZLIB", "0"); } if env::var("CARGO_FEATURE_SSL").is_ok() { config.define("WITH_SSL", "1"); config.register_dep("openssl"); } else { config.define("WITH_SSL", "0"); } if env::var("CARGO_FEATURE_GSSAPI").is_ok() { config.define("WITH_SASL", ...
{ let mut config = cmake::Config::new("librdkafka"); config .define("RDKAFKA_BUILD_STATIC", "1") .define("RDKAFKA_BUILD_TESTS", "0") .define("RDKAFKA_BUILD_EXAMPLES", "0") // CMAKE_INSTALL_LIBDIR is inferred as "lib64" on some platforms, but we // want a stable location ...
identifier_body
jquery.prettydate.js
/* * jQuery prettyDate v1.2.0pre * * @author John Resig (ejohn.org) * @author Jörn Zaefferer * @author Timo Tijhof * * Based on http://ejohn.org/blog/javascript-pretty-date * Documentation: http://bassistance.de/jquery-plugins/jquery-plugin-prettydate/ * * Copyright 2013 Jörn Zaefferer * Released under the M...
m[2] = +m[2] || 1; m[3] = +m[3] || 1; if (m[8] !== 'Z' && m[9] !== undefined) { minutesOffset = m[10] * 60 + m[11]; if (m[9] === '+') { minutesOffset = 0 - minutesOffset; } } else { minutesOffset = 0; } return Date.UTC( // Year m[1], // Month m[2] - 1, // Da...
// Undefined days and months are allowed
random_line_split
jquery.prettydate.js
/* * jQuery prettyDate v1.2.0pre * * @author John Resig (ejohn.org) * @author Jörn Zaefferer * @author Timo Tijhof * * Based on http://ejohn.org/blog/javascript-pretty-date * Documentation: http://bassistance.de/jquery-plugins/jquery-plugin-prettydate/ * * Copyright 2013 Jörn Zaefferer * Released under the M...
// Undefined days and months are allowed m[2] = +m[2] || 1; m[3] = +m[3] || 1; if (m[8] !== 'Z' && m[9] !== undefined) { minutesOffset = m[10] * 60 + m[11]; if (m[9] === '+') { minutesOffset = 0 - minutesOffset; } } else { minutesOffset = 0; } return Date.UTC( // Year ...
m[k] = +m[k] || 0; }
conditional_block
jquery.prettydate.js
/* * jQuery prettyDate v1.2.0pre * * @author John Resig (ejohn.org) * @author Jörn Zaefferer * @author Timo Tijhof * * Based on http://ejohn.org/blog/javascript-pretty-date * Documentation: http://bassistance.de/jquery-plugins/jquery-plugin-prettydate/ * * Copyright 2013 Jörn Zaefferer * Released under the M...
{ elements.each(function () { var date = $.prettyDate.format(options.value.apply(this)); if (date && $(this).text() !== date) { $(this).text(date); } }); } format(); if (options.interval) { setInterval(format, options.interval); } return this; }; }(jQuery));
mat()
identifier_name
jquery.prettydate.js
/* * jQuery prettyDate v1.2.0pre * * @author John Resig (ejohn.org) * @author Jörn Zaefferer * @author Timo Tijhof * * Based on http://ejohn.org/blog/javascript-pretty-date * Documentation: http://bassistance.de/jquery-plugins/jquery-plugin-prettydate/ * * Copyright 2013 Jörn Zaefferer * Released under the M...
format(); if (options.interval) { setInterval(format, options.interval); } return this; }; }(jQuery));
elements.each(function () { var date = $.prettyDate.format(options.value.apply(this)); if (date && $(this).text() !== date) { $(this).text(date); } }); }
identifier_body
qs.js
}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n...
} function parse(parts, parent, key, val) { var part = parts.shift(); // illegal if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return; // end if (!part) { if (isArray(parent[key])) { parent[key].push(val); } else if ('object' == typeof parent[key]) { parent[key] = val;...
random_line_split
qs.js
}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n...
(obj){ var ret = { base: {} }; forEach(objectKeys(obj), function(name){ merge(ret, name, obj[name]); }); return compact(ret.base); } /** * Parse the given str. */ function parseString(str){ var ret = reduce(String(str).split('&'), function(ret, pair){ var eql = indexOf(pair, '=') , brace =...
parseObject
identifier_name
qs.js
(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n...
/** * Locate last brace in `str` within the key. * * @param {String} str * @return {Number} *
{ var v = obj[key]; if (Object.getOwnPropertyDescriptor(Object.prototype, key)) return; if (undefined === v) { obj[key] = val; } else if (isArray(v)) { v.push(val); } else { obj[key] = [v, val]; } }
identifier_body
qs.js
}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n...
else if (~indexOf(part, ']')) { part = part.substr(0, part.length - 1); if (!isint.test(part) && isArray(obj)) obj = promote(parent, key); parse(parts, obj, part, val); // key } else { if (!isint.test(part) && isArray(obj)) obj = promote(parent, key); parse(parts, obj, part, val...
{ if (isArray(obj)) { if ('' != val) obj.push(val); } else if ('object' == typeof obj) { obj[objectKeys(obj).length] = val; } else { obj = parent[key] = [parent[key], val]; } // prop }
conditional_block
ItemViewHtmlBody.tsx
import * as React from 'react'; import * as Kurve from 'kurvejs'; import * as ScopedStyles from './ScopedStylePolyfill'; interface ItemViewHtmlBodyProps extends React.Props<ItemViewHtmlBody> { style: React.CSSProperties body?: string; attachments?: Kurve.AttachmentDataModel[]; } export default class Item...
doc.body.appendChild(resultElement); // Move all styles in <head/> into the new <div/> var headList = doc.getElementsByTagName("head"); if (headList.length == 1) { var head = headList.item(0); var styles = head.getElementsByTagName("style"); var styl...
{ doc.body.removeChild(node); resultElement.appendChild(node); }
conditional_block
ItemViewHtmlBody.tsx
import * as React from 'react'; import * as Kurve from 'kurvejs'; import * as ScopedStyles from './ScopedStylePolyfill'; interface ItemViewHtmlBodyProps extends React.Props<ItemViewHtmlBody> { style: React.CSSProperties body?: string; attachments?: Kurve.AttachmentDataModel[]; } export default class Item...
return <div style={this.props.style} dangerouslySetInnerHTML={ this.parseMessageBody(body, this.props.attachments) } /> } private parseMessageBody(html: string, attachments?: Kurve.AttachmentDataModel[]) { var doc = document.implementation.createHTMLDocument("example"); doc.documentEle...
var body = this.props.body || "<img src = '/public/loading.gif' width = '25'' height = '25'/>";
random_line_split
ItemViewHtmlBody.tsx
import * as React from 'react'; import * as Kurve from 'kurvejs'; import * as ScopedStyles from './ScopedStylePolyfill'; interface ItemViewHtmlBodyProps extends React.Props<ItemViewHtmlBody> { style: React.CSSProperties body?: string; attachments?: Kurve.AttachmentDataModel[]; } export default class Item...
private parseMessageBody(html: string, attachments?: Kurve.AttachmentDataModel[]) { var doc = document.implementation.createHTMLDocument("example"); doc.documentElement.innerHTML = html; // Create a new <div/> in the body and move all existing body content to that the new div. var...
{ var body = this.props.body || "<img src = '/public/loading.gif' width = '25'' height = '25'/>"; return <div style={this.props.style} dangerouslySetInnerHTML={ this.parseMessageBody(body, this.props.attachments) } /> }
identifier_body
ItemViewHtmlBody.tsx
import * as React from 'react'; import * as Kurve from 'kurvejs'; import * as ScopedStyles from './ScopedStylePolyfill'; interface ItemViewHtmlBodyProps extends React.Props<ItemViewHtmlBody> { style: React.CSSProperties body?: string; attachments?: Kurve.AttachmentDataModel[]; } export default class Item...
(html: string, attachments?: Kurve.AttachmentDataModel[]) { var doc = document.implementation.createHTMLDocument("example"); doc.documentElement.innerHTML = html; // Create a new <div/> in the body and move all existing body content to that the new div. var resultElement = doc.createEle...
parseMessageBody
identifier_name
x86_64.rs
#[repr(C)] #[derive(Copy)] pub struct
{ pub gl_pathc: ::size_t, pub gl_pathv: *mut *mut ::char_t, pub gl_offs: ::size_t, pub gl_flags: ::int_t, pub gl_closedir: ::std::option::Option<extern fn (arg1: *mut ::void_t)>, pub gl_readdir: ::std::option::Option<extern fn(arg1: *mut ::void_t) ...
glob_t
identifier_name
x86_64.rs
#[repr(C)] #[derive(Copy)] pub struct glob_t { pub gl_pathc: ::size_t, pub gl_pathv: *mut *mut ::char_t, pub gl_offs: ::size_t, pub gl_flags: ::int_t, pub gl_closedir: ::std::option::Option<extern fn (arg1: *mut ::void_t)>, pub gl_readdir: ::std::op...
pub const GLOB_ERR: ::int_t = 1; pub const GLOB_MARK: ::int_t = 2; pub const GLOB_NOCHECK: ::int_t = 16; pub const GLOB_NOESCAPE: ::int_t = 64; pub const GLOB_NOSORT: ::int_t = 4; pub const GLOB_ABORTED: ::int_t = 2; pub const GLOB_NOMATCH: ::int_t = 3; pub const GLOB_NOSPACE: ::int_t = 1;
pub const GLOB_DOOFFS: ::int_t = 8;
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-09-12 15:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration):
), ]
initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Malware', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('alert_id', models.CharField(max_length=90))...
identifier_body
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-09-12 15:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True
] operations = [ migrations.CreateModel( name='Malware', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('alert_id', models.CharField(max_length=90)), ('alert_type', mode...
dependencies = [
random_line_split
0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-09-12 15:08 from __future__ import unicode_literals from django.db import migrations, models class
(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Malware', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('alert_id', mod...
Migration
identifier_name
dataset.py
# Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License from __future__ import absolute_import import ROOT from . import log; log = log[__name__] from .. import QROOT, asrootpy from ..base import NamedObject from ..extern.six import string_types __all__ = [ 'DataSet...
return super(DataSet, self).createHistogram(*args, **kwargs) def reduce(self, *args, **kwargs): return asrootpy(super(DataSet, self).reduce(*args, **kwargs))
return ROOT.RooAbsData.createHistogram(self, *args, **kwargs)
conditional_block
dataset.py
# Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License from __future__ import absolute_import import ROOT from . import log; log = log[__name__] from .. import QROOT, asrootpy from ..base import NamedObject from ..extern.six import string_types __all__ = [ 'DataSet...
(object): def __init__(self, idx, dataset): self.idx_ = idx self.dataset_ = dataset @property def fields(self): return asrootpy(self.dataset_.get(self.idx_)) @property def weight(self): self.dataset_.get(self.i...
Entry
identifier_name
dataset.py
# Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License from __future__ import absolute_import import ROOT from . import log; log = log[__name__] from .. import QROOT, asrootpy from ..base import NamedObject from ..extern.six import string_types __all__ = [ 'DataSet...
def createHistogram(self, *args, **kwargs): if args and isinstance(args[0], string_types): return ROOT.RooAbsData.createHistogram(self, *args, **kwargs) return super(DataSet, self).createHistogram(*args, **kwargs) def reduce(self, *args, **kwargs): return asrootpy(super(Da...
for idx in range(len(self)): yield DataSet.Entry(idx, self)
identifier_body
dataset.py
# Copyright 2012 the rootpy developers # distributed under the terms of the GNU General Public License from __future__ import absolute_import import ROOT from . import log; log = log[__name__] from .. import QROOT, asrootpy from ..base import NamedObject from ..extern.six import string_types __all__ = [ 'DataSet...
self.dataset_ = dataset @property def fields(self): return asrootpy(self.dataset_.get(self.idx_)) @property def weight(self): self.dataset_.get(self.idx_) #set current event return self.dataset_.weight() def __len...
class DataSet(NamedObject, QROOT.RooDataSet): _ROOT = QROOT.RooDataSet class Entry(object): def __init__(self, idx, dataset): self.idx_ = idx
random_line_split
index.d.ts
// Type definitions for http-assert 1.4 // Project: https://github.com/jshttp/http-assert // Definitions by: jKey Lu <https://github.com/jkeylu> // Peter Squicciarini <https://github.com/stripedpajamas> // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 /** *...
type Assert = <T>(a: T, b: T, status?: number, msg?: string, opts?: {}) => void; const equal: Assert; const notEqual: Assert; const ok: Assert; const strictEqual: Assert; const notStrictEqual: Assert; const deepEqual: Assert; const notDeepEqual: Assert; } export = assert;
*/
random_line_split
settings_stack.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::js::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use j...
} } /// Returns the ["incumbent"] global object. /// /// ["incumbent"]: https://html.spec.whatwg.org/multipage/#incumbent pub fn incumbent_global() -> Option<Root<GlobalScope>> { // https://html.spec.whatwg.org/multipage/#incumbent-settings-object // Step 1, 3: See what the JS engine has to say. If we've ...
let cx = Runtime::get(); assert!(!cx.is_null()); UnhideScriptedCaller(cx); }
random_line_split
settings_stack.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::js::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use j...
(tracer: *mut JSTracer) { STACK.with(|stack| { stack.borrow().trace(tracer); }) } /// RAII struct that pushes and pops entries from the script settings stack. pub struct AutoEntryScript { global: usize, } impl AutoEntryScript { /// https://html.spec.whatwg.org/multipage/#prepare-to-run-script ...
trace
identifier_name
settings_stack.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::js::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use j...
/// RAII struct that pushes and pops entries from the script settings stack. pub struct AutoIncumbentScript { global: usize, } impl AutoIncumbentScript { /// https://html.spec.whatwg.org/multipage/#prepare-to-run-a-callback pub fn new(global: &GlobalScope) -> Self { // Step 2-3. unsafe { ...
{ STACK.with(|stack| { stack.borrow() .iter() .rev() .find(|entry| entry.kind == StackEntryKind::Entry) .map(|entry| Root::from_ref(&*entry.global)) }).unwrap() }
identifier_body
settings_stack.rs
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::js::{JS, Root}; use dom::bindings::trace::JSTraceable; use dom::globalscope::GlobalScope; use j...
} // Step 2: nothing from the JS engine. Let's use whatever's on the explicit stack. STACK.with(|stack| { stack.borrow() .last() .map(|entry| Root::from_ref(&*entry.global)) }) }
{ return Some(GlobalScope::from_object(global)); }
conditional_block
atom_data.py
0, 'G': 85.0, 'H': 194.0, 'I': 182.0, 'L': 180.0, 'K': 211.0, 'M': 204.0, 'F': 218.0, 'P': 143.0, 'S': 122.0, 'T': 146.0, 'W': 259.0, 'Y': 229.0, 'V': 160.0, } @classmethod def is_surface(cls, resn, asa,...
ASP=['C', 'CA', 'CB', 'CG', 'N', 'O', 'OD1', 'OD2'], CYS=['C', 'CA', 'CB', 'N', 'O', 'SG'], GLN=['C', 'CA', 'CB', 'CD', 'CG', 'N', 'NE2', 'O', 'OE1'], GLU=['C', 'CA', 'CB', 'CD', 'CG', 'N', 'O', 'OE1', 'OE2'], GLY=['C', 'CA', 'N', 'O'], HIS=['C', 'CA', 'CB', 'CD2', 'CE1',...
ARG=['C', 'CA', 'CB', 'CD', 'CG', 'CZ', 'N', 'NE', 'NH1', 'NH2', 'O'], ASN=['C', 'CA', 'CB', 'CG', 'N', 'ND2', 'O', 'OD1'],
random_line_split
atom_data.py
0, 'G': 85.0, 'H': 194.0, 'I': 182.0, 'L': 180.0, 'K': 211.0, 'M': 204.0, 'F': 218.0, 'P': 143.0, 'S': 122.0, 'T': 146.0, 'W': 259.0, 'Y': 229.0, 'V': 160.0, } @classmethod def is_surface(cls, resn, asa,...
resn = resn.upper() if len(resn) == 3: resn = cls.three_to_one[resn] return float(asa) / total_asa[resn] >= cutoff three_to_full = { 'Val': 'Valine', 'Ile': 'Isoleucine', 'Leu': 'Leucine', 'Glu': 'Glutamic acid', 'Gln': 'Glutamine', 'Asp': 'Aspartic acid...
total_asa = cls.total_asa
conditional_block
atom_data.py
0, 'G': 85.0, 'H': 194.0, 'I': 182.0, 'L': 180.0, 'K': 211.0, 'M': 204.0, 'F': 218.0, 'P': 143.0, 'S': 122.0, 'T': 146.0, 'W': 259.0, 'Y': 229.0, 'V': 160.0, } @classmethod def is_surface(cls, resn, asa,...
three_to_full = { 'Val': 'Valine', 'Ile': 'Isoleucine', 'Leu': 'Leucine', 'Glu': 'Glutamic acid', 'Gln': 'Glutamine', 'Asp': 'Aspartic acid', 'Asn': 'Asparagine', 'His': 'Histidine', 'Trp': 'Tryptophan', 'Phe': 'Phenylalanine', 'Tyr': 'Tyrosine', 'Arg': 'Arginine', 'Lys': '...
"""Return True if ratio of residue ASA to max ASA >= cutoff""" if total_asa is None: total_asa = cls.total_asa resn = resn.upper() if len(resn) == 3: resn = cls.three_to_one[resn] return float(asa) / total_asa[resn] >= cutoff
identifier_body
atom_data.py
(object): # Maximum ASA for each residue # from Miller et al. 1987, JMB 196: 641-656 total_asa = { 'A': 113.0, 'R': 241.0, 'N': 158.0, 'D': 151.0, 'C': 140.0, 'Q': 189.0, 'E': 183.0, 'G': 85.0, 'H': 194.0, 'I': 182.0, '...
AtomData
identifier_name
GetStockHistoryInfoTask.py
# coding=utf-8 import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), ".."))) from db.MysqlUtil import initMysql, execute, select, batchInsert, disconnect from common.JsonHelper import loadJsonConfig from api.tushareApi import getSimpleHistoryData from datetime import datetime, timedelta f...
kList: code = stock[0] i = 2010 thisYear = datetime.now().year while (i <= thisYear): # time.sleep(1) infos = getStockInfos(code, i) if infos is None: continue for date in infos: open = infos.get(date).get('...
ist): for stock in stoc
identifier_name
GetStockHistoryInfoTask.py
# coding=utf-8 import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), ".."))) from db.MysqlUtil import initMysql, execute, select, batchInsert, disconnect from common.JsonHelper import loadJsonConfig from api.tushareApi import getSimpleHistoryData from datetime import datetime, timedelta f...
ount(*) from s_stock GROUP by code HAVING count(*)<20") data = select(sql) updateStockHistoryInfoByTHS(data) def getStockHistoryInfoFromConfig(): stockList = loadJsonConfig(os.path.abspath(os.path.join(os.getcwd(), "../config/newStockList.json"))) updateStockHistoryInfoByTHS(stockList) def updateAll...
CT code,c
conditional_block
GetStockHistoryInfoTask.py
# coding=utf-8 import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), ".."))) from db.MysqlUtil import initMysql, execute, select, batchInsert, disconnect from common.JsonHelper import loadJsonConfig from api.tushareApi import getSimpleHistoryData from datetime import datetime, timedelta f...
ime.now() initMysql() # getStockHistoryInfoFromDb() # getStockHistoryInfoFromConfig() updateStockOtherInfo() disconnect() end = datetime.now() message = unicode("查询股票历史行情数据的任务执行完毕,当前时间:{0},执行用时:{1}").format(datetime.now(), end - begin) writeLog(message) ...
identifier_body
GetStockHistoryInfoTask.py
# coding=utf-8 import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), ".."))) from db.MysqlUtil import initMysql, execute, select, batchInsert, disconnect from common.JsonHelper import loadJsonConfig from api.tushareApi import getSimpleHistoryData from datetime import datetime, timedelta f...
for stock in stockList: code = stock[0] if int(code) < 601126: continue selectInfoSql = unicode("select date,closePrice from s_stock where code='{0}' order by date asc").format(code) data = select(selectInfoSql) writeLog(unicode("更新股票其他指标数据: code: {0}").format(c...
stockList = select(sql)
random_line_split
my_json.py
from typing import Dict, Any from depccg.tree import Tree from depccg.cat import Category def _json_of_category(category: Category) -> Dict[str, Any]: def rec(node): if node.is_functor: return { 'slash': node.slash, 'left': rec(node.left), 'righ...
return rec(tree)
return { 'type': node.op_string, 'cat': _json_of_category(node.cat) if full else str(node.cat), 'children': [rec(child) for child in node.children] }
conditional_block
my_json.py
from typing import Dict, Any from depccg.tree import Tree from depccg.cat import Category def _json_of_category(category: Category) -> Dict[str, Any]: def rec(node): if node.is_functor: return { 'slash': node.slash, 'left': rec(node.left), 'righ...
return rec(category) def json_of( tree: Tree, full: bool = False ) -> Dict[str, Any]: """a tree in Python dict object. Args: tree (Tree): tree object full (bool): whether to decomopose categories into its components, i.e., { 'slash': '/', ...
random_line_split
my_json.py
from typing import Dict, Any from depccg.tree import Tree from depccg.cat import Category def _json_of_category(category: Category) -> Dict[str, Any]: def rec(node): if node.is_functor: return { 'slash': node.slash, 'left': rec(node.left), 'righ...
(node: Tree) -> Dict[str, Any]: if node.is_leaf: res = dict(node.token) res['cat'] = _json_of_category(node.cat) if full else str(node.cat) return res else: return { 'type': node.op_string, 'cat': _json_of_category(node.cat...
rec
identifier_name
my_json.py
from typing import Dict, Any from depccg.tree import Tree from depccg.cat import Category def _json_of_category(category: Category) -> Dict[str, Any]: def rec(node): if node.is_functor: return { 'slash': node.slash, 'left': rec(node.left), 'righ...
return rec(tree)
if node.is_leaf: res = dict(node.token) res['cat'] = _json_of_category(node.cat) if full else str(node.cat) return res else: return { 'type': node.op_string, 'cat': _json_of_category(node.cat) if full else str(node.cat), ...
identifier_body
Grow.js
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import * as React from 'react'; import PropTypes from 'prop-types'; import { Transition } from 'react-transition-group'; import useTheme from '../styles/useThem...
node.style.transition = [theme.transitions.create('opacity', { duration, delay }), theme.transitions.create('transform', { duration: duration * 0.666, delay: delay || duration * 0.333 })].join(','); node.style.opacity = '0'; node.style.transform = getScale(0.75); if (o...
{ duration = transitionDuration; }
conditional_block
Grow.js
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import * as React from 'react'; import PropTypes from 'prop-types'; import { Transition } from 'react-transition-group'; import useTheme from '../styles/useThem...
const addEndListener = (_, next) => { if (timeout === 'auto') { timer.current = setTimeout(next, autoTimeout.current || 0); } }; React.useEffect(() => { return () => { clearTimeout(timer.current); }; }, []); return /*#__PURE__*/React.createElement(Transition, _extends({ appear...
if (onExit) { onExit(node); } };
random_line_split
Grow.js
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import * as React from 'react'; import PropTypes from 'prop-types'; import { Transition } from 'react-transition-group'; import useTheme from '../styles/useThem...
const styles = { entering: { opacity: 1, transform: getScale(1) }, entered: { opacity: 1, transform: 'none' } }; /** * The Grow transition is used by the [Tooltip](/components/tooltips/) and * [Popover](/components/popover/) components. * It uses [react-transition-group](https://github.com/...
{ return `scale(${value}, ${value ** 2})`; }
identifier_body
Grow.js
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; import * as React from 'react'; import PropTypes from 'prop-types'; import { Transition } from 'react-transition-group'; import useTheme from '../styles/useThem...
(value) { return `scale(${value}, ${value ** 2})`; } const styles = { entering: { opacity: 1, transform: getScale(1) }, entered: { opacity: 1, transform: 'none' } }; /** * The Grow transition is used by the [Tooltip](/components/tooltips/) and * [Popover](/components/popover/) components. ...
getScale
identifier_name
thread.rs
/* Waylos, a kernel built in rust Copyright (C) 2015 Waylon Cude This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later ve...
(paddr: u64) -> u64{ unsafe { let page_addr = paddr & 0xFFFFFFFFF000; (*(page_addr as *mut memory::PageTable)).set_entry(511,*(0x100000 as *const u64)); memory::create_page(0xFFFFF00000000000,page_addr); loop{} memory::create_page(0xFFFFF00000003000,page_addr); memory::create_page(0xFFFFF000...
create_thread_memory_area
identifier_name
thread.rs
/* Waylos, a kernel built in rust Copyright (C) 2015 Waylon Cude This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later ve...
(*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id = 0; } else { (*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id += 1; } } //write!(SCREEN,"PID {}\n",(*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id); ...
(*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id += 1; while (*(THREAD_TABLE_ADDR as *mut Thread_Table)).threads[(*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id].enabled != 1 { if (*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id >= (*(THREAD_TABLE_A...
random_line_split
thread.rs
/* Waylos, a kernel built in rust Copyright (C) 2015 Waylon Cude This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later ve...
} //write!(SCREEN,"PID {}\n",(*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id); (*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_page_table = (*(THREAD_TABLE_ADDR as *const Thread_Table)).threads[(*(THREAD_TABLE_ADDR as *const Thread_Table)).current_process_id].page_addr; ...
{ (*(THREAD_TABLE_ADDR as *mut Thread_Table)).current_process_id += 1; }
conditional_block