function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def _subscribe_extend(tensor, side_effects):
"""Helper method to extend the list of side_effects for a subscribed tensor.
Args:
tensor: A `tf.Tensor` as returned by subscribe().
side_effects: List of side_effect functions, see subscribe for details.
Returns:
The given subscribed tensor (for API cons... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def _subscribe(tensor, side_effects, control_cache):
"""Helper method that subscribes a single tensor to a list of side_effects.
This method will check if the given tensor has already been subscribed or if
it's a tensor returned by a previous call to `subscribe()` and, if so, will
reuse the existing identity o... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def _preserve_control_flow_context(tensor):
"""Preserve the control flow context for the given tensor.
Sets the graph context to the tensor's context so that side effect ops are
added under the same context.
This is needed when subscribing to tensors defined within a conditional
block or a while loop. In th... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def __init__(self, description='operation'):
self._starttime = None
self._endtime = None
self._description = description
self.Start() | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def GetDelta(self):
"""Returns the rounded delta.
Also stops the timer if Stop() has not already been called.
"""
if self._endtime is None:
self.Stop(log=False)
delta = self._endtime - self._starttime
delta = round(delta, 2) if delta < 10 else round(delta, 1)
return delta | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def test_mixed_float16_policy(self):
with policy.policy_scope('mixed_float16'):
inputs1 = keras.Input(shape=(36, 512), dtype='float16')
inputs2 = keras.Input(shape=(36,), dtype='bool')
average_layer = keras.layers.pooling.GlobalAveragePooling1D()
_ = average_layer(inputs1, inputs2) | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_globalpooling_1d_masking_support(self):
model = keras.Sequential()
model.add(keras.layers.Masking(mask_value=0., input_shape=(None, 4)))
model.add(keras.layers.GlobalAveragePooling1D())
model.compile(loss='mae', optimizer='rmsprop')
model_input = np.random.random((2, 3, 4))
model_input... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_globalpooling_2d_with_ragged(self):
ragged_data = ragged_factory_ops.constant(
[[[[1.0], [1.0]], [[2.0], [2.0]], [[3.0], [3.0]]],
[[[1.0], [1.0]], [[2.0], [2.0]]]],
ragged_rank=1)
dense_data = ragged_data.to_tensor()
inputs = keras.Input(shape=(None, 2, 1), dtype='float32'... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_globalpooling_2d(self):
testing_utils.layer_test(
keras.layers.pooling.GlobalMaxPooling2D,
kwargs={'data_format': 'channels_first'},
input_shape=(3, 4, 5, 6))
testing_utils.layer_test(
keras.layers.pooling.GlobalMaxPooling2D,
kwargs={'data_format': 'channels_last... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_globalpooling_1d_keepdims(self):
testing_utils.layer_test(
keras.layers.pooling.GlobalMaxPooling1D,
kwargs={'keepdims': True},
input_shape=(3, 4, 5),
expected_output_shape=(None, 1, 5))
testing_utils.layer_test(
keras.layers.pooling.GlobalMaxPooling1D,
kw... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_globalpooling_3d_keepdims(self):
testing_utils.layer_test(
keras.layers.pooling.GlobalMaxPooling3D,
kwargs={'data_format': 'channels_first', 'keepdims': True},
input_shape=(3, 4, 3, 4, 3),
expected_output_shape=(None, 4, 1, 1, 1))
testing_utils.layer_test(
keras.... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_maxpooling_2d(self):
pool_size = (3, 3)
for strides in [(1, 1), (2, 2)]:
testing_utils.layer_test(
keras.layers.MaxPooling2D,
kwargs={
'strides': strides,
'padding': 'valid',
'pool_size': pool_size
},
input_shape=(3... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_maxpooling_3d(self):
pool_size = (3, 3, 3)
testing_utils.layer_test(
keras.layers.MaxPooling3D,
kwargs={
'strides': 2,
'padding': 'valid',
'pool_size': pool_size
},
input_shape=(3, 11, 12, 10, 4))
testing_utils.layer_test(
... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def test_maxpooling_1d(self):
for padding in ['valid', 'same']:
for stride in [1, 2]:
testing_utils.layer_test(
keras.layers.MaxPooling1D,
kwargs={
'strides': stride,
'padding': padding
},
input_shape=(3, 5, 4))
testin... | tensorflow/tensorflow | [
171949,
87931,
171949,
2300,
1446859160
] |
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
self.child = None
self.child_prompt = '(lldb) '
self.strict_sources = False
# Source filename.
self.source = 'main.m'
# Output filename.
self.exe_name = self.getBuildArtifact("a.out")
... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def run_lldb_to_breakpoint(self, exe, source_file, line,
settings_commands=None):
# Set self.child_prompt, which is "(lldb) ".
prompt = self.child_prompt
# So that the child gets torn down after the test.
import pexpect
import sys
if sys.ve... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def expect_prompt(self, exactly=True):
self.expect(self.child_prompt, exactly=exactly) | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def do_test(self, expect_regexes=None, settings_commands=None):
""" Run a test. """
self.build(dictionary=self.d)
self.setTearDownCleanup(dictionary=self.d)
exe = self.getBuildArtifact(self.exe_name)
self.run_lldb_to_breakpoint(exe, self.source, self.line,
... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def setUp(self):
self._output_dir = tempfile.mkdtemp()
self._output_manager = local_output_manager.LocalOutputManager(
self._output_dir) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def tearDown(self):
shutil.rmtree(self._output_dir) | ric2b/Vivaldi-browser | [
131,
27,
131,
3,
1490828945
] |
def __new__(cls, value):
val = str(value)
if val not in cls._instances:
cls._instances[val] = super(VerNum, cls).__new__(cls)
ret = cls._instances[val]
return ret | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __add__(self, value):
ret = int(self) + int(value)
return VerNum(ret) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __eq__(self, value):
return int(self) == int(value) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __lt__(self, value):
return int(self) < int(value) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __ge__(self, value):
return int(self) >= int(value) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __repr__(self):
return "<VerNum(%s)>" % self.value | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __int__(self):
return int(self.value) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __hash__(self):
return hash(self.value) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __init__(self, path):
"""Collect current version scripts in repository
and store them in self.versions
"""
super(Collection, self).__init__(path)
# Create temporary list of files, allowing skipped version numbers.
files = os.listdir(path)
if '1' in files:
... | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def latest(self):
""":returns: Latest version in Collection"""
return max([VerNum(0)] + list(self.versions.keys())) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def create_new_python_version(self, description, **k):
"""Create Python files for new version"""
ver = self._next_ver_num(k.pop('use_timestamp_numbering', False))
extra = str_to_filename(description)
if extra:
if extra == '_':
extra = ''
elif not ... | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def version(self, vernum=None):
"""Returns required version.
If vernum is not given latest version will be returned otherwise
required version will be returned.
:raises: : exceptions.VersionNotFoundError if respective migration
script file of version is not present in the migrat... | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def clear(cls):
super(Collection, cls).clear() | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def __init__(self, vernum, path, filelist):
self.version = VerNum(vernum)
# Collect scripts in this folder
self.sql = dict()
self.python = None
for script in filelist:
self.add_script(os.path.join(path, script)) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def add_script(self, path):
"""Add script to Collection/Version"""
if path.endswith(Extensions.py):
self._add_script_py(path)
elif path.endswith(Extensions.sql):
self._add_script_sql(path) | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def _add_script_sql(self, path):
basename = os.path.basename(path)
match = self.SQL_FILENAME.match(basename)
if match:
basename = basename.replace('.sql', '')
parts = basename.split('_')
if len(parts) < 3:
raise exceptions.ScriptError(
... | gltn/stdm | [
26,
29,
26,
55,
1401777923
] |
def setUp(self):
super(BuildDumbTestCase, self).setUp()
self.old_location = os.getcwd()
self.old_sys_argv = sys.argv, sys.argv[:] | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_simple_built(self):
# let's create a simple package
tmp_dir = self.mkdtemp()
pkg_dir = os.path.join(tmp_dir, 'foo')
os.mkdir(pkg_dir)
self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
self.write_file((pkg_dir, 'foo.py'), '#')
self.write_file((pkg_dir, 'MA... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def upgrade():
query = '''UPDATE "user"
SET ckan_api=null
WHERE id IN (SELECT id
FROM (SELECT id, row_number() over (partition BY ckan_api ORDER BY id) AS rnum
FROM "user") t
WHERE t.rnum > 1);
'''
op.exe... | PyBossa/pybossa | [
716,
269,
716,
21,
1321773782
] |
def set_test_params(self):
self.num_nodes = 0
self.supports_cli = True | NeblioTeam/neblio | [
119,
45,
119,
29,
1501023994
] |
def run_test(self):
pass | NeblioTeam/neblio | [
119,
45,
119,
29,
1501023994
] |
def add_gallery_post(generator):
contentpath = generator.settings.get('PATH')
gallerycontentpath = os.path.join(contentpath,'images/gallery')
for article in generator.articles:
if 'gallery' in article.metadata.keys():
album = article.metadata.get('gallery')
galleryimages = ... | ioos/system-test | [
7,
14,
7,
59,
1387901856
] |
def generate_gallery_page(generator):
contentpath = generator.settings.get('PATH')
gallerycontentpath = os.path.join(contentpath,'images/gallery')
for page in generator.pages:
if page.metadata.get('template') == 'gallery':
gallery = dict()
for a in os.listdir(galleryconten... | ioos/system-test | [
7,
14,
7,
59,
1387901856
] |
def input_fn_train: # returns x, y (where y represents label's class index).
pass | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def _get_feature_dict(features):
if isinstance(features, dict):
return features
return {"": features} | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def train_op_fn(loss):
return optimizers.optimize_loss(
loss, global_step=None, learning_rate=0.3, optimizer="Adagrad") | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def input_fn_train: # returns x, y (where y represents label's class index).
pass | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def __init__(self,
model_dir=None,
n_classes=2,
weight_column_name=None,
config=None,
feature_engineering_fn=None,
label_keys=None):
"""Initializes a DebugClassifier instance.
Args:
model_dir: Directory to save mode... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def predict_proba(self,
input_fn=None,
batch_size=None):
"""Returns prediction probabilities for given features.
Args:
input_fn: Input function.
batch_size: Override default batch size.
Returns:
An iterable of predicted probabilities with shape [ba... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def input_fn_train: # returns x, y (where y represents label's class index).
pass | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def __init__(self,
model_dir=None,
label_dimension=1,
weight_column_name=None,
config=None,
feature_engineering_fn=None):
"""Initializes a DebugRegressor instance.
Args:
model_dir: Directory to save model parameters, graph and etc... | npuichigo/ttsflow | [
16,
6,
16,
1,
1500635633
] |
def __init__(self, dataset_url):
self.dataset_url = dataset_url
self.SELECT = Counter()
self.WHERE = None # list()
self.GROUPBY = list()
self.OFFSET = None
self.LIMIT = None
self.ORDERBY = list() | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def removeSELECT(self, obj):
logging.debug("Removing SELECT {}".format(obj))
if obj not in self.SELECT:
return
self.SELECT[obj] -= 1
if self.SELECT[obj] == 0:
del self.SELECT[obj]
logging.debug(self.SELECT) | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def addWHERE(self, where, boolean=None):
if where is None:
return
if self.WHERE is None:
self.WHERE = where
else:
# if boolean is None:
# raise RuntimeError("Must provide boolean instruction to WHERE")
if boolean != "OR" and boolea... | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def addGROUPBY(self, value):
self.GROUPBY.append(str(value)) | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def setOFFSET(self, value):
# Basically the start of slicing. This can normally be a negative
# number in python. For now (and probably forever), not supported.
# i.e. my_list[-10:] is not supported
if type(value) != int:
raise RuntimeError("Can only slice with integer")
... | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def addORDERBY(self, value):
self.ORDERBY.append(value) | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def mergeQuery(self, query, how=None):
self.mergeSELECT(query)
self.mergeWHERE(query, how)
self.mergeGROUPBY(query)
self.mergeORDERBY(query)
if self.OFFSET is not None and query.OFFSET is not None:
raise RuntimeError("Multiple slicing asked")
if self.OFFSET ... | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def executeQuery(self, format):
query = self.buildQuery()
query["format"] = format
logging.debug("REST params\n{}".format(json.dumps(query)))
select_url = self.dataset_url + "/query"
try:
# logging.info(select_url)
response = requests.get(select_url, pa... | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def __and__(self, value):
if isinstance(value, Query):
query = self.copy()
# self.addWHERE('AND')
query.mergeQuery(value, "AND")
return query | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def __ror__(self, value):
raise NotImplementedError() | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def __repr__(self):
return json.dumps(self.buildQuery(), indent=4) | datacratic/pymldb | [
8,
12,
8,
4,
1426693694
] |
def __ls(broadcast_vars, iterator):
"""
Get the list of files in the worker-local directory
"""
return [__get_hostname(), os.listdir(SparkFiles.getRootDirectory())] | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def __unpack_conda_env(broadcast_vars, iterator):
"""
Command to install the conda env in the local worker
"""
# transform '/path/to/conda' to 'path'
worker_conda_folder = __parse_worker_local_path(broadcast_vars['CONDA_ENV_LOCATION'])
# delete existing unpacked env root 'path' folder
cmd = ... | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def __get_hostname():
"""
Get the hostname of the worker
"""
import socket
return socket.gethostname() | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def __get_local_module_file_location():
"""Discover the location of the sparkonda module
"""
module_file = os.path.abspath(__file__).replace('pyc', 'py')
return module_file | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def __tar_env():
"""Untar the conda env tar file
"""
with tarfile.open('/tmp/' + CONDA_ENV_NAME + '.tar', 'w') as tar_handle:
for root, dirs, files in os.walk(CONDA_ENV_LOCATION):
for cur_file in files:
tar_handle.add(os.path.join(root, cur_file)) | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def pack_conda_env(overwrite=True):
"""
Pack the local conda env located at CONDA_ENV_LOCATION
"""
if overwrite:
print('Overwriting tar file if exists at:' + '/tmp/' + CONDA_ENV_NAME + '.tar')
__tar_env()
else:
if not os.path.exists('/tmp/%s.tar' % CONDA_ENV_NAME):
... | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def list_cwd_files(sc, debug=False):
"""
List the files in the temporary directory of each executor given a sparkcontext
"""
return prun(sc, __ls, debug=debug) | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def remove_conda_env(sc):
"""
Remove the conda env from each executor given a sparkcontext
"""
return prun(sc, __rm_conda_env) | moutai/sparkonda | [
11,
2,
11,
2,
1448656530
] |
def file(self):
openfile = lambda: file(self.path, "rb+")
if PocketChunksFile.holdFileOpen:
if self._file is None:
self._file = openfile()
return notclosing(self._file)
else:
return openfile() | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def __init__(self, path):
self.path = path
self._file = None
if not os.path.exists(path):
file(path, "w").close()
with self.file as f:
filesize = os.path.getsize(path)
if filesize & 0xfff:
filesize = (filesize | 0xfff) + 1
... | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def usedSectors(self):
return len(self.freeSectors) - sum(self.freeSectors) | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def sectorCount(self):
return len(self.freeSectors) | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def chunkCount(self):
return sum(self.offsets > 0) | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def _readChunk(self, cx, cz):
cx &= 0x1f
cz &= 0x1f
offset = self.getOffset(cx, cz)
if offset == 0:
return None
sectorStart = offset >> 8
numSectors = offset & 0xff
if numSectors == 0:
return None
if sectorStart + numSectors > len... | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def saveChunk(self, chunk):
cx, cz = chunk.chunkPosition
cx &= 0x1f
cz &= 0x1f
offset = self.getOffset(cx, cz)
sectorNumber = offset >> 8
sectorsAllocated = offset & 0xff
data = chunk._savedData()
sectorsNeeded = (len(data) + self.CHUNK_HEADER_SIZE) / s... | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def containsChunk(self, cx, cz):
return self.getOffset(cx, cz) != 0 | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def setOffset(self, cx, cz, offset):
cx &= 0x1f
cz &= 0x1f
self.offsets[cx + cz * 32] = offset
with self.file as f:
f.seek(0)
f.write(self.offsets.tostring()) | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def allChunks(self):
return list(self.chunkFile.chunkCoords()) | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def getChunk(self, cx, cz):
for p in cx, cz:
if not 0 <= p <= 31:
raise ChunkNotPresent((cx, cz, self))
c = self._loadedChunks.get((cx, cz))
if c is None:
c = self.chunkFile.loadChunk(cx, cz, self)
self._loadedChunks[cx, cz] = c
return... | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def _isLevel(cls, filename):
clp = ("chunks.dat", "level.dat")
if not os.path.isdir(filename):
f = os.path.basename(filename)
if f not in clp:
return False
filename = os.path.dirname(filename)
return all([os.path.exists(os.path.join(filename,... | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def containsChunk(self, cx, cz):
if cx > 31 or cz > 31 or cx < 0 or cz < 0:
return False
return self.chunkFile.getOffset(cx, cz) != 0 | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def chunksNeedingLighting(self):
for chunk in self._loadedChunks.itervalues():
if chunk.needsLighting:
yield chunk.chunkPosition | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def __init__(self, cx, cz, data, world):
self.chunkPosition = (cx, cz)
self.world = world
data = fromstring(data, dtype='uint8')
self.Blocks, data = data[:32768], data[32768:]
self.Data, data = data[:16384], data[16384:]
self.SkyLight, data = data[:16384], data[16384:]
... | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def shapeChunkData(self):
chunkSize = 16
self.Blocks.shape = (chunkSize, chunkSize, self.world.Height)
self.SkyLight.shape = (chunkSize, chunkSize, self.world.Height)
self.BlockLight.shape = (chunkSize, chunkSize, self.world.Height)
self.Data.shape = (chunkSize, chunkSize, self.w... | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def packData(dataArray):
assert dataArray.shape[2] == self.world.Height
data = array(dataArray).reshape(16, 16, self.world.Height / 2, 2)
data[..., 1] <<= 4
data[..., 1] |= data[..., 0]
return array(data[:, :, :, 1]) | Khroki/MCEdit-Unified | [
467,
109,
467,
116,
1410734091
] |
def find_package_data(where='.', package='', exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True, show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
... | tbarbugli/django_email_multibackend | [
16,
10,
16,
1,
1366216440
] |
def main():
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=__doc__)
parser.add_argument(
"--show-help", "-l",
action="store_true",
help="Show any help texts as well")
parser.add_argument(
"kconfig",
... | ulfalizer/Kconfiglib | [
362,
141,
362,
29,
1341946757
] |
def __init__(self, session, request, cache):
self.session = session
self.request = request
self.cache = cache
# required for GraphUtils access to access points
Logic.factory('vanilla') | theonlydude/RandomMetroidSolver | [
33,
22,
33,
11,
1508516621
] |
def __init__(self, title=None, **kwargs):
if title is not None:
self.title = title
for key in kwargs:
if hasattr(self.__class__, key):
setattr(self, key, kwargs[key])
self.children = self.children or []
self.css_classes = self.css_classes or []
... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def init_with_context(self, context):
request = context['request']
# we use sessions to store the visited pages stack
history = request.session.get('history', [])
for item in history:
self.children.append(item)
... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def is_empty(self):
"""
Return True if the module has no content and False otherwise.
>>> mod = DashboardModule()
>>> mod.is_empty()
True
>>> mod.pre_content = 'foo'
>>> mod.is_empty()
False
>>> mod.pre_content = None
>>> mod.is_empty()
... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def _prepare_children(self):
pass | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def __init__(self, **kwargs):
Dashboard.__init__(self, **kwargs)
self.children.append(modules.Group(
title="My group",
display="tabs",
children=[
modules.AppList(
title='Admini... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def init_with_context(self, context):
if self._initialized:
return
for module in self.children:
# to simplify the whole stuff, modules have some limitations,
# they cannot be dragged, collapsed or closed
module.collapsible = False
module.dragga... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def _prepare_children(self):
# computes ids for children: generates them if they are not set
# and then prepends them with this group's id
seen = set()
for id, module in enumerate(self.children):
proposed_id = "%s_%s" % (self.id, module.id or id+1)
module.id = uni... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def __init__(self, **kwargs):
Dashboard.__init__(self, **kwargs)
self.children.append(modules.LinkList(
layout='inline',
children=(
{
'title': 'Python website',
'url':... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def init_with_context(self, context):
if self._initialized:
return
new_children = []
for link in self.children:
if isinstance(link, (tuple, list,)):
link_dict = {'title': link[0], 'url': link[1]}
if len(link) >= 3:
link_... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
def __init__(self, **kwargs):
Dashboard.__init__(self, **kwargs)
# will only list the django.contrib apps
self.children.append(modules.AppList(
title='Administration',
models=('django.contrib.*',)
))
... | liberation/django-admin-tools | [
2,
2,
2,
3,
1371719510
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.