prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>sblim_sfcb.py<|end_file_name|><|fim▁begin|>#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic fun... | logging.info('\n nfails is non-zero')
raise error.TestError('\nTest failed') |
<|file_name|>sblim_sfcb.py<|end_file_name|><|fim▁begin|>#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic fun... | logging.info('\n Test completed successfully ') |
<|file_name|>sblim_sfcb.py<|end_file_name|><|fim▁begin|>#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic fun... | initialize |
<|file_name|>sblim_sfcb.py<|end_file_name|><|fim▁begin|>#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic fun... | run_once |
<|file_name|>sblim_sfcb.py<|end_file_name|><|fim▁begin|>#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class sblim_sfcb(test.test):
"""
Autotest module for testing basic fun... | postprocess |
<|file_name|>Example_Dudko_Fit.py<|end_file_name|><|fim▁begin|># force floating point division. Can still use integer with //<|fim▁hole|>import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../")
from EnergyLandscapes.Lifetime_Dudko2008.Python.TestExamples.Util import \
Examp... | from __future__ import division
# This file is used for importing the common utilities classes. |
<|file_name|>Example_Dudko_Fit.py<|end_file_name|><|fim▁begin|># force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../")... | fig = Example_Data.PlotHistograms(data)
fig.savefig(BaseName + "_Histogram.png")
fig = Example_Data.PlotLifetimesAndFit(data)
fig.savefig(BaseName + "_Lifetimes.png") |
<|file_name|>Example_Dudko_Fit.py<|end_file_name|><|fim▁begin|># force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../")... | """
"""
# figure 1 from dudko 2008
data = Example_Data.Dudko2008Fig1_Probabilities()
PlotFit(data,"../Out/Dudko2008_Fig1")
# figure 2 frm dudko 2008
data = Example_Data.Dudko2008Fig2_Probabilities()
PlotFit(data,"../Out/Dudko2008_Fig2") |
<|file_name|>Example_Dudko_Fit.py<|end_file_name|><|fim▁begin|># force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../")... | run() |
<|file_name|>Example_Dudko_Fit.py<|end_file_name|><|fim▁begin|># force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../")... | PlotFit |
<|file_name|>Example_Dudko_Fit.py<|end_file_name|><|fim▁begin|># force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.append("../../../../../")... | run |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | # else:
journal_path = "%s/osd/$cluster-$id/journal" % self.tempdir
with open(conffile, "w") as f: |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | DEFAULT_PORT = 6790
def __init__(self, port=DEFAULT_PORT,
**kwargs):
"""Create a new Ceph cluster."""
super(CephDriver, self).__init__(**kwargs)
self.port = port
@classmethod
def get_options(cls):
return [
{"param_decls": ["--port"],
... |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | """Create a new Ceph cluster."""
super(CephDriver, self).__init__(**kwargs)
self.port = port |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | return [
{"param_decls": ["--port"],
"type": int,
"default": cls.DEFAULT_PORT,
"help": "port to use for Ceph Monitor"},
] |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | super(CephDriver, self)._setUp()
self._ensure_xattr_support()
fsid = str(uuid.uuid4())
conffile = os.path.join(self.tempdir, "ceph.conf")
mondir = os.path.join(self.tempdir, "mon", "ceph-a")
osddir = os.path.join(self.tempdir, "osd", "ceph-0")
os.makedirs(mondir... |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | extra = """
mon_osd_nearfull_ratio = 1
mon_osd_full_ratio = 1
osd_failsafe_nearfull_ratio = 1
osd_failsafe_full_ratio = 1
""" |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | extra = """
mon_allow_pool_delete = true
""" |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | wait_for_line = "journal close" |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | wait_for_line = "done with init" |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | self._exec(ceph_opts + ["osd", "set-full-ratio", "0.95"])
self._exec(ceph_opts + ["osd", "set-backfillfull-ratio", "0.95"])
self._exec(ceph_opts + ["osd", "set-nearfull-ratio", "0.95"]) |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | raise RuntimeError("Fail to deploy ceph") |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | __init__ |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | get_options |
<|file_name|>ceph.py<|end_file_name|><|fim▁begin|># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | _setUp |
<|file_name|>dumpPHOTO.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import sys
from gi.repository import GExiv2
phototags = {
'Exif.Photo.ExposureTime': "Belichtung:\t",
'Exif.Photo.FNumber': "Blende:\t\tF",
# 'Exif.Photo.ExposureProgram',
'Exif.Photo.ISOSpeedRatings': "ISO:\t\t",
# 'Exif.Ph... | # 'Exif.Photo.Flash',
'Exif.Photo.FocalLength': "Brennweite:\t"
# 'Exif.Photo.MakerNote'
} |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#<|fim▁hole|>"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how to use this script. This docstring
will be printed by the script if there is an error ... | # TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
# |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | global options, args
# TODO: Do something more interesting here...
print 'Hello from the test() function!' |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | global options, args
# TODO: Do something more interesting here...
print 'Hello world!' |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | try:
start_time = time.time()
#parser = argparse.ArgumentParser(description="This is the program description", usage=globals()['__doc__'])
parser = argparse.ArgumentParser(description='This is the program description')
parser.add_argument('--version', action='version', version='%(pr... |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | print time.asctime() |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | test() |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | main() |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | print time.asctime() |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | print 'TOTAL TIME IN MINUTES:', |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | print (time.time() - start_time) / 60.0 |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | test |
<|file_name|>act_twitter.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# TODO prog_base.py - A starting template for Python scripts
#
# Copyright 2013 Robert B. Hawkins
#
"""
SYNOPSIS
TODO prog_base [-h,--help] [-v,--verbose] [--version]
DESCRIPTION
TODO This describes how t... | main |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | # Create this index
self.es.indices.create(index, {
"mappings": {
doc_type._type: doc_type.get_mapping() |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | _index = "warehouse"
def __init__(self, models, config):
self.models = models
self.config = config
self.es = Elasticsearch(
hosts=self.config.hosts,
**self.config.get("client_options", {})
)
self.types = AttributeDict()
def register(self, ty... |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | self.models = models
self.config = config
self.es = Elasticsearch(
hosts=self.config.hosts,
**self.config.get("client_options", {})
)
self.types = AttributeDict() |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | obj = type_(self)
self.types[obj._type] = obj |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | index = "".join([
index if index is not None else self._index,
hashlib.md5(os.urandom(16)).hexdigest()[:8],
])
# Create this index
self.es.indices.create(index, {
"mappings": {
doc_type._type: doc_type.get_mapping()
for... |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | try:
old_index = self.es.indices.get_alias(self._index).keys()[0]
except TransportError as exc:
if not exc.status_code == 404:
raise
old_index = None
# Remove the alias to the old index if it exists
if old_index is not None:
... |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | SEARCH_LIMIT = 25
def __init__(self, index):
self.index = index
def get_mapping(self):
raise NotImplementedError
def get_indexable(self):
raise NotImplementedError
def extract_id(self, item):
raise NotImplementedError
def extract_document(self, item):
... |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | self.index = index |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | raise NotImplementedError |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | raise NotImplementedError |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | raise NotImplementedError |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | raise NotImplementedError |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | _index = index if index is not None else self.index._index
# Bulk Index our documents
bulk_index(
self.index.es,
[
{
"_index": _index,
"_type": self._type,
"_id": self.extract_id(item),
... |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | raise NotImplementedError |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | self.update_alias(self._index, index, keep_old=keep_old) |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | raise |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | actions = [{"remove": {"index": old_index, "alias": alias}}] |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | actions = [] |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | self.es.indices.delete(old_index) |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | __init__ |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | register |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | reindex |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | update_alias |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | __init__ |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | get_mapping |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | get_indexable |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | extract_id |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | extract_document |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | index_all |
<|file_name|>indexes.py<|end_file_name|><|fim▁begin|># Copyright 2013 Donald Stufft
#
# 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 r... | search |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
"""
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def __init__(self, **kwargs):
#: Configure options
self._configs = kwargs... |
Args:
translator[Translator]: The object to be used for converting the html. |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
<|fim_middle|>
<|fim▁end|> | """
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def __init__(self, **kwargs):
#: Configure options
self._configs = kwargs
self._configs.setdefault('headings', ['section', 'subsection', 'subsubsecti... |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
"""
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def __init__(self, **kwargs):
#: Configure options
<|fim_middle|>
def... | self._configs = kwargs
self._configs.setdefault('headings', ['section', 'subsection', 'subsubsection', 'textbf', 'underline', 'emph']) |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
"""
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def __init__(self, **kwargs):
#: Configure options
self._configs = kwargs... | """
Return the dictionary of configure options.
"""
return self._configs |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
"""
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def __init__(self, **kwargs):
#: Configure options
self._configs = kwargs... | """
Elements should be added to the storage of the Translator instance within this function.
Args:
translator[Translator]: The object to be used for converting the html.
"""
pass |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
"""
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def <|fim_middle|>(self, **kwargs):
#: Configure options
self._configs = ... | __init__ |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
"""
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def __init__(self, **kwargs):
#: Configure options
self._configs = kwargs... | getConfigs |
<|file_name|>Extension.py<|end_file_name|><|fim▁begin|>class Extension(object):
"""
Base class for creating extensions.
Args:
kwargs[dict]: All key, value pairings are stored as "configuration" options, see getConfigs.
"""
def __init__(self, **kwargs):
#: Configure options
self._configs = kwargs... | extend |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse<|fim▁hole|>import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-management public/dist... | import traceback
import sys
|
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | r = requests.get("http://localhost:80/api/{}".format(endpoint))
if r.status_code != 200:
raise Exception("Bad status code for endpoint {}: {}".format(endpoint, r.status_code))
return r.json() |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | for a in endpoints:
objects[a] = getEndpoint(a) |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | if response.status_code == 200:
response.cache_control.max_age = 5
response.cache_control.s_maxage = 1
return response |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | updateData()
try:
template = env.get_template(path)
body = template.render(objects=objects, options=request.args)
except TemplateNotFound:
return 'Template "{}" not found\n'.format(path), 404
except Exception as err:
return 'Templating of "{}" failed to render. Most likel... |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | updateData()
try:
content = request.stream.read(int(request.headers["Content-Length"]))
template = env.from_string(content.decode("utf-8"))
body = template.render(objects=objects, options=request.args)
except Exception as err:
return 'Templating of "{}" failed to render. Most... |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | raise Exception("Bad status code for endpoint {}: {}".format(endpoint, r.status_code)) |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | response.cache_control.max_age = 5
response.cache_control.s_maxage = 1 |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | parser.print_help() |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | getEndpoint |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | updateData |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | add_header |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | root_get |
<|file_name|>templating.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
import argparse
import traceback
import sys
import netaddr
import requests
from flask import Flask, request
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
endpoints = "read/networks read/oplog read/snmp read/switches-mana... | root_post |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | return
help_item = index[cmd_type].get(cmd) |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
<|fim_middle|>
class HelpModule(BaseModule):
c... | def cmd_list(self, argument):
"""List commands"""
arg = argument.lower()
index = self.bot.help_index
public = "public commands -- %s" % " ".join(index['public'])
private = "private commands -- %s" % " ".join(index['private'])
if 'all' in arg or 'both' in arg:
... |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
<|fim_middle|>
... | """List commands"""
arg = argument.lower()
index = self.bot.help_index
public = "public commands -- %s" % " ".join(index['public'])
private = "private commands -- %s" % " ".join(index['private'])
if 'all' in arg or 'both' in arg:
output = "\n".join((public, p... |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | """List active modules"""
index = self.bot.help_index
output = "active modules -- %s" % " ".join(index['modules'].keys())
self.send(self.target, output) |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | """Get help on a command or module"""
arg = argument.lower()
index = self.bot.help_index
target = self.target
args = arg.split()
if not args:
s = "usage: help <command> [public|private] / help module <module>"
self.send(target, s)
elif args... |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | context_class = HelpContext |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | output = "\n".join((public, private)) |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | output = public |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | output = private |
<|file_name|>help.py<|end_file_name|><|fim▁begin|># Author: Nick Raptis <airscorp@gmail.com>
"""
Module for listing commands and help.
"""
from basemodule import BaseModule, BaseCommandContext
from alternatives import _
class HelpContext(BaseCommandContext):
def cmd_list(self, argument):
"""List command... | self.logger.error("cmd_list")
return |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.