uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
ea60ac21340b6ecbe7a17211
train
function
def test_set_levels_codes_directly(idx): # setting levels/codes directly raises AttributeError levels = idx.levels new_levels = [[lev + 'a' for lev in level] for level in levels] codes = idx.codes major_codes, minor_codes = codes major_codes = [(x + 1) % 3 for x in major_codes] minor_codes...
def test_set_levels_codes_directly(idx): # setting levels/codes directly raises AttributeError
levels = idx.levels new_levels = [[lev + 'a' for lev in level] for level in levels] codes = idx.codes major_codes, minor_codes = codes major_codes = [(x + 1) % 3 for x in major_codes] minor_codes = [(x + 1) % 1 for x in minor_codes] new_codes = [major_codes, minor_codes] msg = "can't s...
assert ind.names == new_names res = ind.set_names(new_names2, level=[0, 1], inplace=True) assert res is None assert ind.names == new_names2 def test_set_levels_codes_directly(idx): # setting levels/codes directly raises AttributeError
64
64
156
20
43
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_levels_codes_directly
test_set_levels_codes_directly
155
171
155
157
4bea411a609e78ef5389f5c22143725d8ae5fb99
bigcode/the-stack
train
579c1116f91f23820f0d9a39
train
function
def test_set_levels(idx): # side note - you probably wouldn't want to use levels and codes # directly like this - but it is possible. levels = idx.levels new_levels = [[lev + 'a' for lev in level] for level in levels] # level changing [w/o mutation] ind2 = idx.set_levels(new_levels) assert_...
def test_set_levels(idx): # side note - you probably wouldn't want to use levels and codes # directly like this - but it is possible.
levels = idx.levels new_levels = [[lev + 'a' for lev in level] for level in levels] # level changing [w/o mutation] ind2 = idx.set_levels(new_levels) assert_matching(ind2.levels, new_levels) assert_matching(idx.levels, levels) # level changing [w/ mutation] ind2 = idx.copy() inplac...
level=[0, 1], inplace=True) assert res is None assert ind.names == new_names2 def test_set_levels_codes_directly(idx): # setting levels/codes directly raises AttributeError levels = idx.levels new_levels = [[lev + 'a' for lev in level] for level in levels] codes = idx.codes major_codes,...
213
213
712
32
180
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_levels
test_set_levels
174
249
174
176
8d27be9fedd604c3a2e552959747cf78197fcc4c
bigcode/the-stack
train
14b0943269a1a4bc2f8fef44
train
function
def test_get_value_duplicates(): index = MultiIndex(levels=[['D', 'B', 'C'], [0, 26, 27, 37, 57, 67, 75, 82]], codes=[[0, 0, 0, 1, 2, 2, 2, 2, 2, 2], [1, 3, 4, 6, 0, 2, 2, 3, 5, 7]], names=['tag', 'day']) ...
def test_get_value_duplicates():
index = MultiIndex(levels=[['D', 'B', 'C'], [0, 26, 27, 37, 57, 67, 75, 82]], codes=[[0, 0, 0, 1, 2, 2, 2, 2, 2, 2], [1, 3, 4, 6, 0, 2, 2, 3, 5, 7]], names=['tag', 'day']) assert index.get_loc('D') == sli...
'B', 'B']) tm.assert_index_equal(index.get_level_values(0), exp) exp = CategoricalIndex([1, 2, 3, 1, 2, 3]) tm.assert_index_equal(index.get_level_values(1), exp) def test_get_value_duplicates():
64
64
163
6
58
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_get_value_duplicates
test_get_value_duplicates
57
66
57
57
bb905b5da662f240d8a5e628b39abf498a5bd976
bigcode/the-stack
train
d1d4c4c0f6e34b8618d72025
train
function
def test_set_levels_codes_names_bad_input(idx): levels, codes = idx.levels, idx.codes names = idx.names with pytest.raises(ValueError, match='Length of levels'): idx.set_levels([levels[0]]) with pytest.raises(ValueError, match='Length of codes'): idx.set_codes([codes[0]]) with pyt...
def test_set_levels_codes_names_bad_input(idx):
levels, codes = idx.levels, idx.codes names = idx.names with pytest.raises(ValueError, match='Length of levels'): idx.set_levels([levels[0]]) with pytest.raises(ValueError, match='Length of codes'): idx.set_codes([codes[0]]) with pytest.raises(ValueError, match='Length of names'):...
.MultiIndex.from_tuples( [(0, i) for i in new_labels]) # [w/o mutation] with tm.assert_produces_warning(FutureWarning): result = ind.set_labels(labels=new_labels, level=1) assert result.equals(expected) # [w/ mutation] result = ind.copy() with tm.assert_produces_warning(FutureW...
113
113
378
10
103
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_levels_codes_names_bad_input
test_set_levels_codes_names_bad_input
345
389
345
345
2f591d6bd840d3316cc75208d850669fc64dae90
bigcode/the-stack
train
ecfbc29b0f1256593643bfeb
train
function
def test_set_value_keeps_names(): # motivating example from #3742 lev1 = ['hans', 'hans', 'hans', 'grethe', 'grethe', 'grethe'] lev2 = ['1', '2', '3'] * 2 idx = pd.MultiIndex.from_arrays([lev1, lev2], names=['Name', 'Number']) df = pd.DataFrame( np.random.randn(6, 4), columns=['one',...
def test_set_value_keeps_names(): # motivating example from #3742
lev1 = ['hans', 'hans', 'hans', 'grethe', 'grethe', 'grethe'] lev2 = ['1', '2', '3'] * 2 idx = pd.MultiIndex.from_arrays([lev1, lev2], names=['Name', 'Number']) df = pd.DataFrame( np.random.randn(6, 4), columns=['one', 'two', 'three', 'four'], index=idx) df = df.sort_index() ...
result_lvl = result.get_level_values(0) expected_lvl = CategoricalIndex(list("bacb"), categories=cidx.categories, ordered=cidx.ordered) tm.assert_index_equal(result_lvl, expected_lvl) def test_set_value_keeps_names(): # motivating e...
64
64
189
17
47
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_value_keeps_names
test_set_value_keeps_names
427
441
427
428
22774e9ffc0f647482d83fa7625ccb144961d51f
bigcode/the-stack
train
72dfa5f11fa724ca6fe2da24
train
function
def test_get_level_values(idx): result = idx.get_level_values(0) expected = Index(['foo', 'foo', 'bar', 'baz', 'qux', 'qux'], name='first') tm.assert_index_equal(result, expected) assert result.name == 'first' result = idx.get_level_values('first') expected = idx.get_level_...
def test_get_level_values(idx):
result = idx.get_level_values(0) expected = Index(['foo', 'foo', 'bar', 'baz', 'qux', 'qux'], name='first') tm.assert_index_equal(result, expected) assert result.name == 'first' result = idx.get_level_values('first') expected = idx.get_level_values(0) tm.assert_index_eq...
) == 1 msg = "Too many levels: Index has only 2 levels, not 3" with pytest.raises(IndexError, match=msg): idx._get_level_number(2) with pytest.raises(KeyError, match='Level fourth not found'): idx._get_level_number('fourth') def test_get_level_values(idx):
75
75
252
7
68
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_get_level_values
test_get_level_values
33
54
33
33
4a82fd70265acc2eea2847e910b1ce76fa8edea2
bigcode/the-stack
train
7e4c6f20e9d3116b261bf0f8
train
function
def assert_matching(actual, expected, check_dtype=False): # avoid specifying internal representation # as much as possible assert len(actual) == len(expected) for act, exp in zip(actual, expected): act = np.asarray(act) exp = np.asarray(exp) tm.assert_numpy_array_equal(act, exp, ...
def assert_matching(actual, expected, check_dtype=False): # avoid specifying internal representation # as much as possible
assert len(actual) == len(expected) for act, exp in zip(actual, expected): act = np.asarray(act) exp = np.asarray(exp) tm.assert_numpy_array_equal(act, exp, check_dtype=check_dtype)
coding: utf-8 -*- import numpy as np import pytest import pandas as pd from pandas import CategoricalIndex, Index, MultiIndex import pandas.util.testing as tm def assert_matching(actual, expected, check_dtype=False): # avoid specifying internal representation # as much as possible
64
64
75
25
38
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
assert_matching
assert_matching
12
19
12
14
4640d60ea7c449bc1518ab1d215f25f1483a4261
bigcode/the-stack
train
dd4ccc251d5765bc30640dff
train
function
def test_set_levels_with_iterable(): # GH23273 sizes = [1, 2, 3] colors = ['black'] * 3 index = pd.MultiIndex.from_arrays([sizes, colors], names=['size', 'color']) result = index.set_levels(map(int, ['3', '2', '1']), level='size') expected_sizes = [3, 2, 1] expected = pd.MultiIndex.from_ar...
def test_set_levels_with_iterable(): # GH23273
sizes = [1, 2, 3] colors = ['black'] * 3 index = pd.MultiIndex.from_arrays([sizes, colors], names=['size', 'color']) result = index.set_levels(map(int, ['3', '2', '1']), level='size') expected_sizes = [3, 2, 1] expected = pd.MultiIndex.from_arrays([expected_sizes, colors], ...
.index.names == ('Name', 'Number') df.at[('grethe', '4'), 'one'] = 99.34 assert df._is_copy is None assert df.index.names == ('Name', 'Number') def test_set_levels_with_iterable(): # GH23273
64
64
122
14
50
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_levels_with_iterable
test_set_levels_with_iterable
444
455
444
445
213c94d375c07ce4df9f133f2b354b31befabbf4
bigcode/the-stack
train
2438cd8c179d5422836c580f
train
function
def test_set_name_methods(idx, index_names): # so long as these are synonyms, we don't need to test set_names assert idx.rename == idx.set_names new_names = [name + "SUFFIX" for name in index_names] ind = idx.set_names(new_names) assert idx.names == index_names assert ind.names == new_names ...
def test_set_name_methods(idx, index_names): # so long as these are synonyms, we don't need to test set_names
assert idx.rename == idx.set_names new_names = [name + "SUFFIX" for name in index_names] ind = idx.set_names(new_names) assert idx.names == index_names assert ind.names == new_names msg = "Length of names must match number of levels in MultiIndex" with pytest.raises(ValueError, match=msg): ...
expected = pd.DatetimeIndex([0, 1, pd.NaT]) tm.assert_index_equal(result, expected) arrays = [[], []] index = pd.MultiIndex.from_arrays(arrays) result = index.get_level_values(0) expected = pd.Index([], dtype=object) tm.assert_index_equal(result, expected) def test_set_name_methods(idx, index_...
99
99
330
27
72
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_name_methods
test_set_name_methods
121
152
121
122
9cc83169bf4cf2d398c2dc0ec15f53e5451c343a
bigcode/the-stack
train
1f586a5f91f9448b58235d75
train
function
def test_get_level_values_all_na(): # GH 17924 when level entirely consists of nan arrays = [[np.nan, np.nan, np.nan], ['a', np.nan, 1]] index = pd.MultiIndex.from_arrays(arrays) result = index.get_level_values(0) expected = pd.Index([np.nan, np.nan, np.nan], dtype=np.float64) tm.assert_index_eq...
def test_get_level_values_all_na(): # GH 17924 when level entirely consists of nan
arrays = [[np.nan, np.nan, np.nan], ['a', np.nan, 1]] index = pd.MultiIndex.from_arrays(arrays) result = index.get_level_values(0) expected = pd.Index([np.nan, np.nan, np.nan], dtype=np.float64) tm.assert_index_equal(result, expected) result = index.get_level_values(1) expected = pd.Index([...
assert index.get_loc('D') == slice(0, 3) with pytest.raises(KeyError, match=r"^'D'$"): index._engine.get_value(np.array([]), 'D') def test_get_level_values_all_na(): # GH 17924 when level entirely consists of nan
64
64
130
21
43
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_get_level_values_all_na
test_get_level_values_all_na
69
79
69
70
fabc12f58203c4e49bf9f037792bcedeccc5967c
bigcode/the-stack
train
33d0911d8987436ca4caae1e
train
function
def test_set_codes(idx): # side note - you probably wouldn't want to use levels and codes # directly like this - but it is possible. codes = idx.codes major_codes, minor_codes = codes major_codes = [(x + 1) % 3 for x in major_codes] minor_codes = [(x + 1) % 1 for x in minor_codes] new_codes ...
def test_set_codes(idx): # side note - you probably wouldn't want to use levels and codes # directly like this - but it is possible.
codes = idx.codes major_codes, minor_codes = codes major_codes = [(x + 1) % 3 for x in major_codes] minor_codes = [(x + 1) % 1 for x in minor_codes] new_codes = [major_codes, minor_codes] # changing codes w/o mutation ind2 = idx.set_codes(new_codes) assert_matching(ind2.codes, new_codes...
0, inplace=inplace) assert_matching(idx.levels, original_index.levels, check_dtype=True) with pytest.raises(ValueError, match="^On"): idx.set_codes([0, 1, 2, 3, 4, 5], level=0, inplace=inplace) assert_matching(idx.codes, original_ind...
199
199
664
32
167
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_codes
test_set_codes
252
323
252
254
6a8c376a755dc2fe0e535a657865eedb52389790
bigcode/the-stack
train
91fbf2dbdcc160dc38d8538f
train
function
def test_set_labels_deprecated(): # GH23752 ind = pd.MultiIndex.from_tuples([(0, i) for i in range(130)]) new_labels = range(129, -1, -1) expected = pd.MultiIndex.from_tuples( [(0, i) for i in new_labels]) # [w/o mutation] with tm.assert_produces_warning(FutureWarning): result =...
def test_set_labels_deprecated(): # GH23752
ind = pd.MultiIndex.from_tuples([(0, i) for i in range(130)]) new_labels = range(129, -1, -1) expected = pd.MultiIndex.from_tuples( [(0, i) for i in new_labels]) # [w/o mutation] with tm.assert_produces_warning(FutureWarning): result = ind.set_labels(labels=new_labels, level=1) ...
result = ind.copy() result.set_codes(codes=new_codes, level=1, inplace=True) assert result.equals(expected) with tm.assert_produces_warning(FutureWarning): ind.set_codes(labels=new_codes, level=1) def test_set_labels_deprecated(): # GH23752
64
64
155
13
51
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_labels_deprecated
test_set_labels_deprecated
326
342
326
327
6a95bf0af0d0b0588b7f3014573047a825012659
bigcode/the-stack
train
475500b0ee53476091dd6ef4
train
function
@pytest.mark.parametrize('ordered', [True, False]) def test_set_levels_categorical(ordered): # GH13854 index = MultiIndex.from_arrays([list("xyzx"), [0, 1, 2, 3]]) cidx = CategoricalIndex(list("bac"), ordered=ordered) result = index.set_levels(cidx, 0) expected = MultiIndex(levels=[cidx, [0, 1, 2, ...
@pytest.mark.parametrize('ordered', [True, False]) def test_set_levels_categorical(ordered): # GH13854
index = MultiIndex.from_arrays([list("xyzx"), [0, 1, 2, 3]]) cidx = CategoricalIndex(list("bac"), ordered=ordered) result = index.set_levels(cidx, 0) expected = MultiIndex(levels=[cidx, [0, 1, 2, 3]], codes=index.codes) tm.assert_index_equal(result, expected) result_l...
1]]) result = m.set_names('first', level=0, inplace=inplace) if inplace: result = m tm.assert_index_equal(result, expected) @pytest.mark.parametrize('ordered', [True, False]) def test_set_levels_categorical(ordered): # GH13854
64
64
162
26
38
kpflugshaupt/pandas
pandas/tests/indexes/multi/test_get_set.py
Python
test_set_levels_categorical
test_set_levels_categorical
409
424
409
411
2f69899ee2eecf3f3ef57ef9369b7e9a4e941d44
bigcode/the-stack
train
d2b2c9b40e638b5d0ddbb1c5
train
function
def setup_dataset(config, subset, rank): DatasetClass = config.DATASET_CLASS dataset_kwargs = dict((key.lower(), val) for key, val in config.DATASET.items()) dataset = DatasetClass(subset=subset, **dataset_kwargs) enable_prefetch = dataset_kwargs.pop("enable_prefetch", False) return DatasetIterator(...
def setup_dataset(config, subset, rank):
DatasetClass = config.DATASET_CLASS dataset_kwargs = dict((key.lower(), val) for key, val in config.DATASET.items()) dataset = DatasetClass(subset=subset, **dataset_kwargs) enable_prefetch = dataset_kwargs.pop("enable_prefetch", False) return DatasetIterator(dataset, seed=rank, enable_prefetch=enabl...
checkpoint_file = "save.ckpt" saver.save( sess, os.path.join(environment.CHECKPOINTS_DIR, checkpoint_file), global_step=global_step, ) print("Save ckpt. step: {}.".format(step + 1)) def setup_dataset(config, subset, rank):
64
64
86
9
55
tvlenin/blueoil
lmnet/executor/train.py
Python
setup_dataset
setup_dataset
38
43
38
38
28a4112f0c9404235408c6722d80d041af08f524
bigcode/the-stack
train
3d0977878adbaef4e4788253
train
function
def run(network, dataset, config_file, experiment_id, recreate): environment.init(experiment_id) config = config_util.load(config_file) if network: network_class = module_loader.load_network_class(network) config.NETWORK_CLASS = network_class if dataset: dataset_class = module_...
def run(network, dataset, config_file, experiment_id, recreate):
environment.init(experiment_id) config = config_util.load(config_file) if network: network_class = module_loader.load_network_class(network) config.NETWORK_CLASS = network_class if dataset: dataset_class = module_loader.load_dataset_class(dataset) config.DATASET_CLASS =...
.run( [metrics_summary_op], feed_dict=metrics_feed_dict, ) if rank == 0: val_writer.add_summary(metrics_summary, step + 1) # training loop end. print("reach max step") def run(network, dataset, config_file, experiment_id, recreate):
64
64
126
14
50
tvlenin/blueoil
lmnet/executor/train.py
Python
run
run
358
377
358
358
5f1d7c93b9f28708ad164dddd23381affe3ef092
bigcode/the-stack
train
2bd7597ba60e5b0e2018ff2f
train
function
def start_training(config): if config.IS_DISTRIBUTION: import horovod.tensorflow as hvd # initialize Horovod. hvd.init() num_worker = hvd.size() rank = hvd.rank() # verify that MPI multi-threading is supported. assert hvd.mpi_threads_supported() # make...
def start_training(config):
if config.IS_DISTRIBUTION: import horovod.tensorflow as hvd # initialize Horovod. hvd.init() num_worker = hvd.size() rank = hvd.rank() # verify that MPI multi-threading is supported. assert hvd.mpi_threads_supported() # make sure MPI is not re-initiali...
IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================= import os import math import click import tensorf...
256
256
2,788
5
251
tvlenin/blueoil
lmnet/executor/train.py
Python
start_training
start_training
46
355
46
46
c28f199527dc7bac76aabf2f63fc8576716fd298
bigcode/the-stack
train
be0ab063c5945dd2e6b6b7a8
train
function
@click.command(context_settings=dict(help_option_names=['-h', '--help'])) @click.option( "-c", "--config_file", help="config file path for this training", default=os.path.join("configs", "example", "classification.py"), required=True, ) @click.option( "-i", "--experiment_id", help="id of...
@click.command(context_settings=dict(help_option_names=['-h', '--help'])) @click.option( "-c", "--config_file", help="config file path for this training", default=os.path.join("configs", "example", "classification.py"), required=True, ) @click.option( "-i", "--experiment_id", help="id of...
run(network, dataset, config_file, experiment_id, recreate)
@click.command(context_settings=dict(help_option_names=['-h', '--help'])) @click.option( "-c", "--config_file", help="config file path for this training", default=os.path.join("configs", "example", "classification.py"), required=True, ) @click.option( "-i", "--experiment_id", help="id of...
192
64
206
192
0
tvlenin/blueoil
lmnet/executor/train.py
Python
main
main
380
412
380
411
8a3c77446ef5a3b7d6c0416b813c0daefc0e9ec9
bigcode/the-stack
train
8f8d6ad633494759826e6f6f
train
function
def _save_checkpoint(saver, sess, global_step, step): checkpoint_file = "save.ckpt" saver.save( sess, os.path.join(environment.CHECKPOINTS_DIR, checkpoint_file), global_step=global_step, ) print("Save ckpt. step: {}.".format(step + 1))
def _save_checkpoint(saver, sess, global_step, step):
checkpoint_file = "save.ckpt" saver.save( sess, os.path.join(environment.CHECKPOINTS_DIR, checkpoint_file), global_step=global_step, ) print("Save ckpt. step: {}.".format(step + 1))
import click import tensorflow as tf from tensorflow.core.util.event_pb2 import SessionLog from lmnet.utils import executor, module_loader, config as config_util from lmnet import environment from lmnet.datasets.dataset_iterator import DatasetIterator def _save_checkpoint(saver, sess, global_step, step):
64
64
70
14
49
tvlenin/blueoil
lmnet/executor/train.py
Python
_save_checkpoint
_save_checkpoint
28
35
28
28
8ddfeddab37960e6f568fb08776df7e8b5b9bedf
bigcode/the-stack
train
f72585ea37bcc198e1da4233
train
class
class VertexHistogram(Kernel): """Vertex Histogram kernel as found in :cite:`Sugiyama2015NIPS` Parameters ---------- None. Attributes ---------- None. """ # Define the graph format that this kernel needs (if needed) # _graph_format = "auto" (default: "auto") def __init__...
class VertexHistogram(Kernel):
"""Vertex Histogram kernel as found in :cite:`Sugiyama2015NIPS` Parameters ---------- None. Attributes ---------- None. """ # Define the graph format that this kernel needs (if needed) # _graph_format = "auto" (default: "auto") def __init__(self, n_jobs=...
from collections import Counter, Iterable from sklearn.utils.validation import check_is_fitted from grakel import Kernel, Graph from numpy import zeros, einsum class VertexHistogram(Kernel):
39
256
1,350
6
32
vishalbelsare/GraKeL
doc/user_manual/code_for_examples/vertex_kernel_advanced.py
Python
VertexHistogram
VertexHistogram
7
193
7
7
d9e3887dae6993cdf7ee4627118bf849f4b0805d
bigcode/the-stack
train
26e44547a2d8eec6baa8912c
train
class
class StreamValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__(self, plotly_name="stream", parent_name="streamtube", **kwargs): super(StreamValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, data_class_str=kwargs.pop("data_cl...
class StreamValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="stream", parent_name="streamtube", **kwargs): super(StreamValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, data_class_str=kwargs.pop("data_class_str", "Stream"), data_docs=kwargs.pop( ...
import _plotly_utils.basevalidators class StreamValidator(_plotly_utils.basevalidators.CompoundValidator):
21
64
186
13
7
acrucetta/Chicago_COVI_WebApp
env/lib/python3.8/site-packages/plotly/validators/streamtube/_stream.py
Python
StreamValidator
StreamValidator
4
25
4
4
803413ee4bdd2518506e751fcdd225e1e7ec85b3
bigcode/the-stack
train
b6bc6bd88b6d1adb346b47e0
train
class
class SONATAWorldComm(object): def __init__(self): self._comm = None @property def comm(self): if self._comm is None: try: from mpi4py import MPI self._comm = MPI.COMM_WORLD except Exception as exc: self._comm = None ...
class SONATAWorldComm(object):
def __init__(self): self._comm = None @property def comm(self): if self._comm is None: try: from mpi4py import MPI self._comm = MPI.COMM_WORLD except Exception as exc: self._comm = None return self._comm ...
class SONATAWorldComm(object):
7
64
180
7
0
AllenInstitute/project7
src/pysonata/sonata/iotools.py
Python
SONATAWorldComm
SONATAWorldComm
1
37
1
1
a0532c3f8b099fd55469d73b271a4a0b4615a5c9
bigcode/the-stack
train
239197509f36d755383442ef
train
function
def set_world_comm(comm): # global sonata_world_comm sonata_world_comm.comm = comm
def set_world_comm(comm): # global sonata_world_comm
sonata_world_comm.comm = comm
if self.comm is None: return 1 else: return self.comm.Get_size() def barrier(self): if self.comm is not None: self.comm.Barrier() sonata_world_comm = SONATAWorldComm() def set_world_comm(comm): # global sonata_world_comm
64
64
22
14
50
AllenInstitute/project7
src/pysonata/sonata/iotools.py
Python
set_world_comm
set_world_comm
43
45
43
44
f5b92e0a52cb34224dcd698e99e8dec474399c1a
bigcode/the-stack
train
78026acb20d40faf0a38b684
train
function
@app.route('/ticks/<int:tick>/vehicles/<string:vehID>', methods=['GET']) def information_vehicle(tick, vehID): response = jsonify(Flask_DB.get_vehicle(tick, vehID)) # status code 200 (OK) response.status_code = 200 return response
@app.route('/ticks/<int:tick>/vehicles/<string:vehID>', methods=['GET']) def information_vehicle(tick, vehID):
response = jsonify(Flask_DB.get_vehicle(tick, vehID)) # status code 200 (OK) response.status_code = 200 return response
"vehicles": Flask_DB.get_vehicles(tick) }) # status code 200 (OK) response.status_code = 200 return response @app.route('/ticks/<int:tick>/vehicles/<string:vehID>', methods=['GET']) def information_vehicle(tick, vehID):
64
64
66
29
34
RDC4Smart-Mobility/UniSim
UniSim/unisim/RESTserver.py
Python
information_vehicle
information_vehicle
63
68
63
64
0475791949a56713b9663c9ceda15ab7019c6299
bigcode/the-stack
train
db45de94ed82a6f23a81bf21
train
function
def dbstart(dbpath, port): Flask_DB.dbpath = dbpath Flask_DB.connect() app.run(host='0.0.0.0', port=port)
def dbstart(dbpath, port):
Flask_DB.dbpath = dbpath Flask_DB.connect() app.run(host='0.0.0.0', port=port)
!= content_type: # status code 400 (Bad Request) abort(400) return function(*args, **keywords) return __consumes return _consumes # Flask side app = Flask(__name__) Flask_DB = DB() def dbstart(dbpath, port):
64
64
39
8
56
RDC4Smart-Mobility/UniSim
UniSim/unisim/RESTserver.py
Python
dbstart
dbstart
32
35
32
32
c99e815cf00ec562d8f10ce166cc0b0dfdb6f37b
bigcode/the-stack
train
164058595ca04ce56420d397
train
function
@app.route('/ticks', methods=['GET']) def return_ticks(): response = jsonify({"ticks": Flask_DB.get_all()}) # status code 200 (OK) response.status_code = 200 return response
@app.route('/ticks', methods=['GET']) def return_ticks():
response = jsonify({"ticks": Flask_DB.get_all()}) # status code 200 (OK) response.status_code = 200 return response
app = Flask(__name__) Flask_DB = DB() def dbstart(dbpath, port): Flask_DB.dbpath = dbpath Flask_DB.connect() app.run(host='0.0.0.0', port=port) @app.route('/ticks', methods=['GET']) def return_ticks():
64
64
47
13
51
RDC4Smart-Mobility/UniSim
UniSim/unisim/RESTserver.py
Python
return_ticks
return_ticks
37
42
37
38
339878030cb6bdb0fc6efa4f69673fc14c5889d2
bigcode/the-stack
train
2b3d500a94dd0c719c301bbe
train
function
@app.route('/ticks/<int:tick>', methods=['GET']) def return_tick(tick): response = jsonify({ "tick": tick, "vehicles": Flask_DB.get_vehicles(tick) }) # status code 200 (OK) response.status_code = 200 return response
@app.route('/ticks/<int:tick>', methods=['GET']) def return_tick(tick):
response = jsonify({ "tick": tick, "vehicles": Flask_DB.get_vehicles(tick) }) # status code 200 (OK) response.status_code = 200 return response
('/ticks', methods=['GET']) def return_ticks(): response = jsonify({"ticks": Flask_DB.get_all()}) # status code 200 (OK) response.status_code = 200 return response @app.route('/ticks/<int:tick>', methods=['GET']) def return_tick(tick):
64
64
65
19
44
RDC4Smart-Mobility/UniSim
UniSim/unisim/RESTserver.py
Python
return_tick
return_tick
44
52
44
45
ed4fc8516ed62f4604fff0511957c91fef21d533
bigcode/the-stack
train
29f19e805e1ff5a4cc5ef814
train
function
def consumes(content_type): def _consumes(function): @wraps(function) def __consumes(*args, **keywords): if request.headers['Content-Type'] != content_type: # status code 400 (Bad Request) abort(400) return function(*args, **keywords) r...
def consumes(content_type):
def _consumes(function): @wraps(function) def __consumes(*args, **keywords): if request.headers['Content-Type'] != content_type: # status code 400 (Bad Request) abort(400) return function(*args, **keywords) return __consumes return ...
unicode_literals from .db import DB from datetime import datetime # import threading import json from flask import Flask, jsonify, request, url_for, abort, Response # for using decorator from functools import wraps import sys # Decolator for MIME Type Check def consumes(content_type):
64
64
77
5
58
RDC4Smart-Mobility/UniSim
UniSim/unisim/RESTserver.py
Python
consumes
consumes
16
25
16
16
870dbf3213a664e549b1bba207e1754a140cc264
bigcode/the-stack
train
a2595bc61a2f5397c0baec27
train
function
@app.route('/ticks/<int:tick>/vehicles', methods=['GET']) def return_vehicles(tick): response = jsonify({ "vehicles": Flask_DB.get_vehicles(tick) }) # status code 200 (OK) response.status_code = 200 return response
@app.route('/ticks/<int:tick>/vehicles', methods=['GET']) def return_vehicles(tick):
response = jsonify({ "vehicles": Flask_DB.get_vehicles(tick) }) # status code 200 (OK) response.status_code = 200 return response
({ "tick": tick, "vehicles": Flask_DB.get_vehicles(tick) }) # status code 200 (OK) response.status_code = 200 return response @app.route('/ticks/<int:tick>/vehicles', methods=['GET']) def return_vehicles(tick):
64
64
62
22
41
RDC4Smart-Mobility/UniSim
UniSim/unisim/RESTserver.py
Python
return_vehicles
return_vehicles
54
61
54
55
7e35181d7c840a2a2c02be0d58b667ddfcdd57d7
bigcode/the-stack
train
265572e9f59400f8e83eae4c
train
function
def execute(block, options): perbin, auto_only = options apply_to_cl = True if block.has_section("galaxy_xi"): n_z_bins_pos = block["galaxy_xi", "nbin"] apply_to_cl = False if block.has_section('galaxy_shear_xi'): n_z_bins_shear = block["galaxy_shear_xi", "nbin_b"] n_z_bi...
def execute(block, options):
perbin, auto_only = options apply_to_cl = True if block.has_section("galaxy_xi"): n_z_bins_pos = block["galaxy_xi", "nbin"] apply_to_cl = False if block.has_section('galaxy_shear_xi'): n_z_bins_shear = block["galaxy_shear_xi", "nbin_b"] n_z_bins_pos = block["galaxy_shear_...
from builtins import range from cosmosis.datablock import names, option_section import sys def setup(options): perbin = options.get_bool("bin_bias", "perbin", True) auto_only = options.get_bool("bin_bias", "auto_only", False) return perbin, auto_only def execute(block, options):
72
233
778
6
65
ktanidis2/Modified_CosmoSIS_for_galaxy_number_count_angular_power_spectra
cosmosis-standard-library/bias/binwise_bias/bin_bias.py
Python
execute
execute
12
81
12
12
49b4ae2109b576dc1de9ea606ce6f1ee7bfb5185
bigcode/the-stack
train
22c9bf109ede92071163b879
train
function
def setup(options): perbin = options.get_bool("bin_bias", "perbin", True) auto_only = options.get_bool("bin_bias", "auto_only", False) return perbin, auto_only
def setup(options):
perbin = options.get_bool("bin_bias", "perbin", True) auto_only = options.get_bool("bin_bias", "auto_only", False) return perbin, auto_only
from builtins import range from cosmosis.datablock import names, option_section import sys def setup(options):
24
64
46
4
19
ktanidis2/Modified_CosmoSIS_for_galaxy_number_count_angular_power_spectra
cosmosis-standard-library/bias/binwise_bias/bin_bias.py
Python
setup
setup
6
9
6
6
c80d21fbdb4a8943824fee9584b28d67a9db7f9f
bigcode/the-stack
train
8af833ae4d7985bac0de17f6
train
class
class Solution(object): def similarRGB(self, color): def f(comp): q, r = divmod(int(comp, 16), 17) # 17 is from 0x22. 16 is in [0,15] 0..9A..F chars. if r > 8: q += 1 return '{:02x}'.format(17 * q) return '#' + f(color[1:3]) + f(color[3:5]) + f(color[5:])
class Solution(object):
def similarRGB(self, color): def f(comp): q, r = divmod(int(comp, 16), 17) # 17 is from 0x22. 16 is in [0,15] 0..9A..F chars. if r > 8: q += 1 return '{:02x}'.format(17 * q) return '#' + f(color[1:3]) + f(color[3:5]) + f(color[5:])
valid RGB color: for i > 0, color[i] is a hexadecimal digit from 0 to f # Any answer which has the same (highest) similarity as the best answer will be accepted. # All inputs and outputs should use lowercase letters, and the output is 7 characters. class Solution(object):
64
64
112
4
60
ttungl/Coding-Interview-Challenge
source-code/Similar RGB Color 800.py
Python
Solution
Solution
26
33
26
26
a2908fb1d192ae4334b3b74f0a1d5d83249353c1
bigcode/the-stack
train
4a513e9ead2618a774d38d29
train
class
class RunTracker(Subsystem): """Tracks and times the execution of a pants run. Also manages background work. Use like this: run_tracker.start() with run_tracker.new_workunit('compile'): with run_tracker.new_workunit('java'): ... with run_tracker.new_workunit('scala'): ... run_tracker....
class RunTracker(Subsystem):
"""Tracks and times the execution of a pants run. Also manages background work. Use like this: run_tracker.start() with run_tracker.new_workunit('compile'): with run_tracker.new_workunit('java'): ... with run_tracker.new_workunit('scala'): ... run_tracker.close() Can track executio...
.auth.basic_auth import BasicAuth from pants.base.exiter import PANTS_FAILED_EXIT_CODE, PANTS_SUCCEEDED_EXIT_CODE from pants.base.run_info import RunInfo from pants.base.worker_pool import SubprocPool, WorkerPool from pants.base.workunit import WorkUnit, WorkUnitLabel from pants.goal.aggregated_timings import Aggregate...
256
256
6,559
6
250
rusrushal13/pants
src/python/pants/goal/run_tracker.py
Python
RunTracker
RunTracker
49
735
49
49
bab89da9fbfc78eb40ed380cf5aa44a2d07d0501
bigcode/the-stack
train
ea1b46269e92815b94b6760d
train
class
class RunTrackerOptionEncoder(CoercingOptionEncoder): """Use the json encoder we use for making options hashable to support datatypes. This encoder also explicitly allows OrderedDict inputs, as we accept more than just option values when encoding stats to json. """ def default(self, o): if isinstance(o,...
class RunTrackerOptionEncoder(CoercingOptionEncoder):
"""Use the json encoder we use for making options hashable to support datatypes. This encoder also explicitly allows OrderedDict inputs, as we accept more than just option values when encoding stats to json. """ def default(self, o): if isinstance(o, OrderedDict): return o return super().defau...
CoercingOptionEncoder from pants.reporting.json_reporter import JsonReporter from pants.reporting.report import Report from pants.subsystem.subsystem import Subsystem from pants.util.dirutil import relative_symlink, safe_file_dump from pants.version import VERSION class RunTrackerOptionEncoder(CoercingOptionEncoder):
64
64
83
11
52
rusrushal13/pants
src/python/pants/goal/run_tracker.py
Python
RunTrackerOptionEncoder
RunTrackerOptionEncoder
36
46
36
36
766bb551087835e91955f3a03b44ccaede33552e
bigcode/the-stack
train
ae6d8d99156f53aed6b43100
train
class
class RunTrackerLogger: """A logger facade that logs into a run tracker.""" def __init__(self, run_tracker): self._run_tracker = run_tracker def debug(self, *msg_elements): self._run_tracker.log(Report.DEBUG, *msg_elements) def info(self, *msg_elements): self._run_tracker.log(Report.INFO, *msg_el...
class RunTrackerLogger:
"""A logger facade that logs into a run tracker.""" def __init__(self, run_tracker): self._run_tracker = run_tracker def debug(self, *msg_elements): self._run_tracker.log(Report.DEBUG, *msg_elements) def info(self, *msg_elements): self._run_tracker.log(Report.INFO, *msg_elements) def warn(self...
The value of the information being stored. :API: public """ new_key_list = [target.address.spec, scope] new_key_list += keys self._merge_list_of_keys_into_dict(self._target_to_data, new_key_list, val, 0) class RunTrackerLogger:
64
64
153
5
59
rusrushal13/pants
src/python/pants/goal/run_tracker.py
Python
RunTrackerLogger
RunTrackerLogger
738
757
738
738
86bb66fa682ac069337869d31e3dda5926a5285a
bigcode/the-stack
train
1bccc98b44683b20af614647
train
function
def test_Level1Design_inputs(): input_map = dict(bases=dict(field='bases', mandatory=True, ), factor_info=dict(field='fact', ), global_intensity_normalization=dict(field='global', ), ignore_exception=dict(nohash=True, usedefault=True, ), interscan_interval=dict(field='timing....
def test_Level1Design_inputs():
input_map = dict(bases=dict(field='bases', mandatory=True, ), factor_info=dict(field='fact', ), global_intensity_normalization=dict(field='global', ), ignore_exception=dict(nohash=True, usedefault=True, ), interscan_interval=dict(field='timing.RT', mandatory=True, ), ...
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT from ....testing import assert_equal from ..model import Level1Design def test_Level1Design_inputs():
38
90
300
7
30
Conxz/nipype
nipype/interfaces/spm/tests/test_auto_Level1Design.py
Python
test_Level1Design_inputs
test_Level1Design_inputs
6
53
6
6
49f7b3bd2843760327b71f868e510865c15ecd9f
bigcode/the-stack
train
163c288997748cbe995761a3
train
function
def test_Level1Design_outputs(): output_map = dict(spm_mat_file=dict(), ) outputs = Level1Design.output_spec() for key, metadata in list(output_map.items()): for metakey, value in list(metadata.items()): yield assert_equal, getattr(outputs.traits()[key], metakey), value
def test_Level1Design_outputs():
output_map = dict(spm_mat_file=dict(), ) outputs = Level1Design.output_spec() for key, metadata in list(output_map.items()): for metakey, value in list(metadata.items()): yield assert_equal, getattr(outputs.traits()[key], metakey), value
=dict(field='volt', ), ) inputs = Level1Design.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): yield assert_equal, getattr(inputs.traits()[key], metakey), value def test_Level1Design_outputs():
64
64
68
7
56
Conxz/nipype
nipype/interfaces/spm/tests/test_auto_Level1Design.py
Python
test_Level1Design_outputs
test_Level1Design_outputs
56
63
56
56
fca2035b00f8d0c861af91334a1f351de2df4a6e
bigcode/the-stack
train
c9a2b8447a245bfcf5ddeeb6
train
function
def CandidatusStaskawiczbacteriaBacteriumRifcsplowo201Full3812b( directed: bool = False, preprocess: bool = True, load_nodes: bool = True, verbose: int = 2, cache: bool = True, cache_path: str = "graphs/string", version: str = "links.v11.5", **additional_graph_kwargs: Dict ) -> Graph: ...
def CandidatusStaskawiczbacteriaBacteriumRifcsplowo201Full3812b( directed: bool = False, preprocess: bool = True, load_nodes: bool = True, verbose: int = 2, cache: bool = True, cache_path: str = "graphs/string", version: str = "links.v11.5", **additional_graph_kwargs: Dict ) -> Graph:
"""Return new instance of the Candidatus Staskawiczbacteria bacterium RIFCSPLOWO2_01_FULL_38_12b graph. The graph is automatically retrieved from the STRING repository. Parameters ------------------- directed: bool = False Wether to load the graph as directed or undirected. By def...
, Milan and Doncheva, Nadezhda T and Morris, John H and Bork, Peer and others}, journal={Nucleic acids research}, volume={47}, number={D1}, pages={D607--D613}, year={2019}, publisher={Oxford University Press} } ``` """ from typing import Dict from ..automatic_graph_retrieval import Automaticall...
199
199
666
95
103
AnacletoLAB/ensmallen_graph
bindings/python/ensmallen/datasets/string/candidatusstaskawiczbacteriabacteriumrifcsplowo201full3812b.py
Python
CandidatusStaskawiczbacteriaBacteriumRifcsplowo201Full3812b
CandidatusStaskawiczbacteriaBacteriumRifcsplowo201Full3812b
30
104
30
39
a6a2e73cd5e1d1c0e6efa710f46003739e634b07
bigcode/the-stack
train
da098c5f7306a3e7eacfd5ad
train
class
class Solution: def flatten(self, root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. """ if root == None: return root if root.left == None and root.right == None: return root self.flatten(root.left) ...
class Solution:
def flatten(self, root: TreeNode) -> None: """ Do not return anything, modify root in-place instead. """ if root == None: return root if root.left == None and root.right == None: return root self.flatten(root.left) self.flatten(ro...
8.70% of Python3 online submissions for Flatten Binary Tree to Linked List. # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution:
64
64
136
3
60
crazywiden/Leetcode_daily_submit
Widen/LC114_Flatten_Binary_Tree_to_Linked_List.py
Python
Solution
Solution
36
61
36
36
0b042f8d3329bbec315fdeaa8be51644246f64de
bigcode/the-stack
train
701bf9076ef1e2910cfdffc7
train
function
def _gen_get_acs_user_req(request, options) -> RawRequestReq: return RawRequestReq( dataclass=GetACSUserResp, scope="ACS", api="GetACSUser", method="GET", url="https://open.feishu.cn/open-apis/acs/v1/users/:user_id", body=request, method_option=_new_method_opt...
def _gen_get_acs_user_req(request, options) -> RawRequestReq:
return RawRequestReq( dataclass=GetACSUserResp, scope="ACS", api="GetACSUser", method="GET", url="https://open.feishu.cn/open-apis/acs/v1/users/:user_id", body=request, method_option=_new_method_option(options), need_tenant_access_token=True, )
class GetACSUserResp(object): user: GetACSUserRespUser = attr.ib( default=None, metadata={"req_type": "json", "key": "user"} ) # 门禁用户信息 def _gen_get_acs_user_req(request, options) -> RawRequestReq:
64
64
93
17
46
chyroc/pylark
pylark/api_service_acs_user_get.py
Python
_gen_get_acs_user_req
_gen_get_acs_user_req
45
55
45
45
a9cece3465c600e316cdbde1efcddaa93786136b
bigcode/the-stack
train
9e4d54b82dfa25c8851f7ff8
train
class
@attr.s class GetACSUserReq(object): user_id_type: lark_type.IDType = attr.ib( default=None, metadata={"req_type": "query", "key": "user_id_type"} ) # 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`,, 当值为 `user_id`, 字段权限要求: 获取用户 user ...
@attr.s class GetACSUserReq(object):
user_id_type: lark_type.IDType = attr.ib( default=None, metadata={"req_type": "query", "key": "user_id_type"} ) # 用户 ID 类型, 示例值:"open_id", 可选值有: `open_id`:用户的 open id, `union_id`:用户的 union id, `user_id`:用户的 user id, 默认值: `open_id`,, 当值为 `user_id`, 字段权限要求: 获取用户 user ID user_id: str = attr.ib( ...
lark_sdk_gen. DO NOT EDIT. from pylark.lark_request import RawRequestReq, _new_method_option from pylark import lark_type, lark_type_sheet, lark_type_approval import attr import typing import io @attr.s class GetACSUserReq(object):
64
64
178
11
52
chyroc/pylark
pylark/api_service_acs_user_get.py
Python
GetACSUserReq
GetACSUserReq
10
17
10
11
aceba0cd4c65a3c22c6825d7480ed07836ccd526
bigcode/the-stack
train
93cd1fc0d449cfdd5f6de67e
train
class
@attr.s class GetACSUserResp(object): user: GetACSUserRespUser = attr.ib( default=None, metadata={"req_type": "json", "key": "user"} ) # 门禁用户信息
@attr.s class GetACSUserResp(object):
user: GetACSUserRespUser = attr.ib( default=None, metadata={"req_type": "json", "key": "user"} ) # 门禁用户信息
_type": "json", "key": "feature"} ) # 用户特征 user_id: str = attr.ib( default="", metadata={"req_type": "json", "key": "user_id"} ) # 用户 ID @attr.s class GetACSUserResp(object):
64
64
50
11
52
chyroc/pylark
pylark/api_service_acs_user_get.py
Python
GetACSUserResp
GetACSUserResp
38
42
38
39
3851af5bc457435db7b1f540928238273e4bd53e
bigcode/the-stack
train
ff280412aa98944474801c1a
train
class
@attr.s class GetACSUserRespUserFeature(object): card: int = attr.ib(default=0, metadata={"req_type": "json", "key": "card"}) # 卡号 face_uploaded: bool = attr.ib( factory=lambda: bool(), metadata={"req_type": "json", "key": "face_uploaded"} ) # 是否已上传人脸图片
@attr.s class GetACSUserRespUserFeature(object):
card: int = attr.ib(default=0, metadata={"req_type": "json", "key": "card"}) # 卡号 face_uploaded: bool = attr.ib( factory=lambda: bool(), metadata={"req_type": "json", "key": "face_uploaded"} ) # 是否已上传人脸图片
( default="", metadata={"req_type": "path", "key": "user_id"} ) # 用户 ID, 示例值:"ou_7dab8a3d3cdcc9da365777c7ad535d62" @attr.s class GetACSUserRespUserFeature(object):
64
64
84
13
51
chyroc/pylark
pylark/api_service_acs_user_get.py
Python
GetACSUserRespUserFeature
GetACSUserRespUserFeature
20
25
20
21
6fb2d1d9ac85d0b985e1e96e23db79d9f8d3cc92
bigcode/the-stack
train
e00ab952309fb779f024b8f9
train
class
@attr.s class GetACSUserRespUser(object): feature: GetACSUserRespUserFeature = attr.ib( default=None, metadata={"req_type": "json", "key": "feature"} ) # 用户特征 user_id: str = attr.ib( default="", metadata={"req_type": "json", "key": "user_id"} ) # 用户 ID
@attr.s class GetACSUserRespUser(object):
feature: GetACSUserRespUserFeature = attr.ib( default=None, metadata={"req_type": "json", "key": "feature"} ) # 用户特征 user_id: str = attr.ib( default="", metadata={"req_type": "json", "key": "user_id"} ) # 用户 ID
"key": "card"}) # 卡号 face_uploaded: bool = attr.ib( factory=lambda: bool(), metadata={"req_type": "json", "key": "face_uploaded"} ) # 是否已上传人脸图片 @attr.s class GetACSUserRespUser(object):
64
64
85
12
51
chyroc/pylark
pylark/api_service_acs_user_get.py
Python
GetACSUserRespUser
GetACSUserRespUser
28
35
28
29
61485bf687c9c73689daba2cf3c05e90cd6dab43
bigcode/the-stack
train
afdec01422864a083f62bc48
train
class
class AppsTests(TestCase): def test_app_config(self): self.assertEquals(apps.get_app_config('gather').verbose_name, 'Gather')
class AppsTests(TestCase):
def test_app_config(self): self.assertEquals(apps.get_app_config('gather').verbose_name, 'Gather')
on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. from django.apps import apps from django.test import TestCase class AppsTests(TestCase):
64
64
32
6
57
eHealthAfrica/gather
app/gather/tests/test_apps.py
Python
AppsTests
AppsTests
23
26
23
24
9ae0e08330dacc8ae053f0a4692d2a1ac980143c
bigcode/the-stack
train
0e60f99b34008a7144821efa
train
function
def func(x, pos): # formatter function takes tick label and tick position s = '{:0,d}'.format(int(x)) return s
def func(x, pos): # formatter function takes tick label and tick position
s = '{:0,d}'.format(int(x)) return s
', **font) plt.rc('axes', **axes) # Add some space around the tick lables for better readability plt.rcParams['xtick.major.pad']='8' plt.rcParams['ytick.major.pad']='8' def func(x, pos): # formatter function takes tick label and tick position
64
64
33
17
47
letsgoexploring/economic-data
real-rate/python/realRateData.py
Python
func
func
200
202
200
200
63981e8485141c8630954f969b211b414c8c43e8
bigcode/the-stack
train
03956f392d5c381c4d8cbfb5
train
class
class config: dataset_name = 'COCO' network = 'resnet18_centernet' pretrained = False num_classes = 80 input_image_size = 512 model = centernet.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) criterion = CenterNetLoss() decoder = Cente...
class config:
dataset_name = 'COCO' network = 'resnet18_centernet' pretrained = False num_classes = 80 input_image_size = 512 model = centernet.__dict__[network](**{ 'pretrained': pretrained, 'num_classes': num_classes, }) criterion = CenterNetLoss() decoder = CenterNetDecoder() ...
BASE_DIR = os.path.dirname( os.path.dirname(os.path.dirname(os.path.dirname( os.path.abspath(__file__))))) sys.path.append(BASE_DIR) from tools.path import COCO2017_path from simpleAICV.detection.models import centernet from simpleAICV.detection.losses import CenterNetLoss from simpleAICV.detection.decod...
135
135
451
3
131
LANCEREN/simpleAICV-pytorch-ImageNet-COCO-training
detection_training/coco/centernet_res18_yoloresize512_multi/train_config.py
Python
config
config
19
81
19
19
4090f25d8159db83423ebffdace5a04ecd02fe74
bigcode/the-stack
train
0dee542910109463b6dc1977
train
function
def get_path(file): path = os.path.abspath("../src/data/" + file) return path
def get_path(file):
path = os.path.abspath("../src/data/" + file) return path
# -*- coding: utf-8 -*- """ Get file absolute path from script & file type. ------------------- """ import pandas as pd import os def get_path(file):
35
64
19
5
29
megemini/DataCastle2017
src/util/fileutil.py
Python
get_path
get_path
11
15
11
12
cbf47b4e91552b699ff5a7c2de43f612ca3a6f8c
bigcode/the-stack
train
b83d8a477433a5a05b57d676
train
class
class TestPath(unittest.TestCase): """Tests the functionality of the Path class using a two segment path in the city of Philadelphia.""" def setUp(self): #chestnut and 40th #39.955828, -75.202286 #chesnut and 6th #39.949191, -75.150776 #snyder and 6th #39.922...
class TestPath(unittest.TestCase):
"""Tests the functionality of the Path class using a two segment path in the city of Philadelphia.""" def setUp(self): #chestnut and 40th #39.955828, -75.202286 #chesnut and 6th #39.949191, -75.150776 #snyder and 6th #39.922669, -75.156699 #distance f...
import unittest from .geopath import GeoPath class TestPath(unittest.TestCase):
18
118
395
7
10
lewfish/gis-tools
lewfish/gistools/test_geopath.py
Python
TestPath
TestPath
5
41
5
5
e985e756018b81592dade120a8460407e8daf778
bigcode/the-stack
train
b1812727a620f9fa2d05d16d
train
function
def save_config(opt, save_dir): if not os.path.exists(save_dir): os.makedirs(save_dir, exist_ok=True) with open(os.path.join(save_dir, "opt.pkl"), "wb") as f: pickle.dump(opt, f)
def save_config(opt, save_dir):
if not os.path.exists(save_dir): os.makedirs(save_dir, exist_ok=True) with open(os.path.join(save_dir, "opt.pkl"), "wb") as f: pickle.dump(opt, f)
.warmup_steps) / float(max(1, self.t_total - self.warmup_steps)) return max(0.0, 0.5 * (1. + math.cos(math.pi * float(self.cycles) * 2.0 * progress))) def save_config(opt, save_dir):
64
64
53
8
56
stjordanis/graph4nlp
examples/pytorch/nmt/utils.py
Python
save_config
save_config
28
32
28
28
6ee2d765ac09b4aecd1d23e6454e8da84ac17bad
bigcode/the-stack
train
0c7fda26c244d0c00f215d5b
train
function
def get_glove_weights(vocabulary: Vocab, dim=300): print(vocabulary.index2word) glove = vocab.GloVe(name='6B', dim=dim) vocab_size = vocabulary.get_vocab_size() weight = torch.randn(vocab_size, dim) for i, word in enumerate(vocabulary.index2word): glove_index = glove.stoi.get(word) ...
def get_glove_weights(vocabulary: Vocab, dim=300):
print(vocabulary.index2word) glove = vocab.GloVe(name='6B', dim=dim) vocab_size = vocabulary.get_vocab_size() weight = torch.randn(vocab_size, dim) for i, word in enumerate(vocabulary.index2word): glove_index = glove.stoi.get(word) glove_rep = glove.get_vecs_by_tokens(word) ...
(asctime)s - %(name)s - %(levelname)s - %(message)s") ch.setFormatter(formatter) fh.setFormatter(formatter) logger.addHandler(ch) logger.addHandler(fh) return logger def get_glove_weights(vocabulary: Vocab, dim=300):
63
64
107
15
47
stjordanis/graph4nlp
examples/pytorch/nmt/utils.py
Python
get_glove_weights
get_glove_weights
52
62
52
52
3d8ab37086873997b3d87516726f6f4496264adc
bigcode/the-stack
train
e708c4a20cd6f78f5045cc93
train
class
class WarmupCosineSchedule(LambdaLR): """ Linear warmup and then cosine decay. Linearly increases learning rate from 0 to 1 over `warmup_steps` training steps. Decreases learning rate from 1. to 0. over remaining `t_total - warmup_steps` steps following a cosine curve. If `cycles` (default=0...
class WarmupCosineSchedule(LambdaLR):
""" Linear warmup and then cosine decay. Linearly increases learning rate from 0 to 1 over `warmup_steps` training steps. Decreases learning rate from 1. to 0. over remaining `t_total - warmup_steps` steps following a cosine curve. If `cycles` (default=0.5) is different from default, learnin...
import pickle import torchtext.vocab as vocab from graph4nlp.pytorch.modules.utils.vocab_utils import Vocab import torch, logging, math import os from torch.optim.lr_scheduler import LambdaLR class WarmupCosineSchedule(LambdaLR):
56
84
281
10
45
stjordanis/graph4nlp
examples/pytorch/nmt/utils.py
Python
WarmupCosineSchedule
WarmupCosineSchedule
9
26
9
9
e24065e41b942b52b92bc1e4fa8f646432317ff8
bigcode/the-stack
train
68d7a8bf23b08dba91ed23ee
train
function
def get_log(log_file): log_folder = os.path.split(log_file)[0] os.makedirs(log_folder, exist_ok=True) logger = logging.getLogger(log_file) logger.setLevel(logging.DEBUG) fh = logging.FileHandler(log_file) fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.INFO) ...
def get_log(log_file):
log_folder = os.path.split(log_file)[0] os.makedirs(log_folder, exist_ok=True) logger = logging.getLogger(log_file) logger.setLevel(logging.DEBUG) fh = logging.FileHandler(log_file) fh.setLevel(logging.DEBUG) ch = logging.StreamHandler() ch.setLevel(logging.INFO) formatter = logging....
.0 * progress))) def save_config(opt, save_dir): if not os.path.exists(save_dir): os.makedirs(save_dir, exist_ok=True) with open(os.path.join(save_dir, "opt.pkl"), "wb") as f: pickle.dump(opt, f) def get_log(log_file):
64
64
130
6
58
stjordanis/graph4nlp
examples/pytorch/nmt/utils.py
Python
get_log
get_log
36
50
36
36
6e53a95e1d9b35f650c3db867557adb4e4a304a8
bigcode/the-stack
train
09c0270a690b353abb5a4c01
train
function
def wordid2str(word_ids, vocab: Vocab): ret = [] assert len(word_ids.shape) == 2, print(word_ids.shape) for i in range(word_ids.shape[0]): id_list = word_ids[i, :] ret_inst = [] for j in range(id_list.shape[0]): if id_list[j] == vocab.EOS: break ...
def wordid2str(word_ids, vocab: Vocab):
ret = [] assert len(word_ids.shape) == 2, print(word_ids.shape) for i in range(word_ids.shape[0]): id_list = word_ids[i, :] ret_inst = [] for j in range(id_list.shape[0]): if id_list[j] == vocab.EOS: break token = vocab.getWord(id_list[j]) ...
, dim) for i, word in enumerate(vocabulary.index2word): glove_index = glove.stoi.get(word) glove_rep = glove.get_vecs_by_tokens(word) weight[i, :] = glove_rep return weight def wordid2str(word_ids, vocab: Vocab):
64
64
112
13
50
stjordanis/graph4nlp
examples/pytorch/nmt/utils.py
Python
wordid2str
wordid2str
65
77
65
65
3f4570248fe400ae94ed034302b7383ed6cf66fa
bigcode/the-stack
train
511f616d1b2b4ded45f0912e
train
function
def get(key, default=None): global DEBUG_VARS if key in DEBUG_VARS: return DEBUG_VARS[key] return default
def get(key, default=None):
global DEBUG_VARS if key in DEBUG_VARS: return DEBUG_VARS[key] return default
is None: DEBUG_VARS = {} else: DEBUG_VARS.pop(key, None) def set(key, value): global DEBUG_VARS if torch.is_tensor(value): value = value.detach().cpu() DEBUG_VARS[key] = value def get(key, default=None):
64
64
32
7
56
Achazwl/BMTrain
bmtrain/debug.py
Python
get
get
18
22
18
18
c542585fa4096ca322bf825017ecf904ba5283fa
bigcode/the-stack
train
5d3ab9b0206a9c1638dfa88b
train
function
def set(key, value): global DEBUG_VARS if torch.is_tensor(value): value = value.detach().cpu() DEBUG_VARS[key] = value
def set(key, value):
global DEBUG_VARS if torch.is_tensor(value): value = value.detach().cpu() DEBUG_VARS[key] = value
import torch DEBUG_VARS = {} def clear(key=None): global DEBUG_VARS if key is None: DEBUG_VARS = {} else: DEBUG_VARS.pop(key, None) def set(key, value):
49
64
36
6
43
Achazwl/BMTrain
bmtrain/debug.py
Python
set
set
12
16
12
12
9016451a3813766cc1bacc31a8aacad758e8539e
bigcode/the-stack
train
0c4b0d61c9e46abf36d926f3
train
function
def clear(key=None): global DEBUG_VARS if key is None: DEBUG_VARS = {} else: DEBUG_VARS.pop(key, None)
def clear(key=None):
global DEBUG_VARS if key is None: DEBUG_VARS = {} else: DEBUG_VARS.pop(key, None)
import torch DEBUG_VARS = {} def clear(key=None):
13
64
35
5
8
Achazwl/BMTrain
bmtrain/debug.py
Python
clear
clear
5
10
5
5
10504226b808440d71b2e33be73d385371be811a
bigcode/the-stack
train
a841910a826484d5b6438fd0
train
function
def extend(key, value): global DEBUG_VARS if key not in DEBUG_VARS: DEBUG_VARS[key] = [] DEBUG_VARS[key].extend(value)
def extend(key, value):
global DEBUG_VARS if key not in DEBUG_VARS: DEBUG_VARS[key] = [] DEBUG_VARS[key].extend(value)
if key in DEBUG_VARS: return DEBUG_VARS[key] return default def append(key, value): global DEBUG_VARS if key not in DEBUG_VARS: DEBUG_VARS[key] = [] DEBUG_VARS[key].append(value) def extend(key, value):
64
64
38
6
58
Achazwl/BMTrain
bmtrain/debug.py
Python
extend
extend
30
34
30
30
4cf1e9d948bc5fcde440d12c955027079e7593ac
bigcode/the-stack
train
1112a98d6d5082f46ccd029d
train
function
def append(key, value): global DEBUG_VARS if key not in DEBUG_VARS: DEBUG_VARS[key] = [] DEBUG_VARS[key].append(value)
def append(key, value):
global DEBUG_VARS if key not in DEBUG_VARS: DEBUG_VARS[key] = [] DEBUG_VARS[key].append(value)
ARS if torch.is_tensor(value): value = value.detach().cpu() DEBUG_VARS[key] = value def get(key, default=None): global DEBUG_VARS if key in DEBUG_VARS: return DEBUG_VARS[key] return default def append(key, value):
64
64
38
6
57
Achazwl/BMTrain
bmtrain/debug.py
Python
append
append
24
28
24
24
a53c9f7b12fe34c25c66e17e794754498ca8d9ed
bigcode/the-stack
train
2e65d33208becfbfe3c072ce
train
function
@app.route("/") def welcome(): """List all available api routes.""" return ( f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/tobs" )
@app.route("/") def welcome():
"""List all available api routes.""" return ( f"Available Routes:<br/>" f"/api/v1.0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/tobs" )
a new model Base = automap_base() # reflect the tables Base.prepare(engine, reflect=True) # Save reference to the table Measurement = Base.classes.measurement ################################################# # Flask Setup ################################################# app = Flask(__name__) ####################...
64
64
67
6
58
scavazos4/sqlalchemy-challenge
app.py
Python
welcome
welcome
34
42
34
35
d5781e5235680dab368f81c860522999db209f05
bigcode/the-stack
train
a11ea57dc453e120092cd197
train
function
@app.route("/api/v1.0/stations") def stations(): # Create our session (link) from Python to the DB session = Session(engine) """Return a list of all station names""" # Query all passengers results = session.query(Measurement.station).all() session.close() # Convert list of tuples into nor...
@app.route("/api/v1.0/stations") def stations(): # Create our session (link) from Python to the DB
session = Session(engine) """Return a list of all station names""" # Query all passengers results = session.query(Measurement.station).all() session.close() # Convert list of tuples into normal list all_stations = list(np.ravel(results)) return jsonify(all_stations)
measurement_dict["prcp"] = prcp measurement_dict["date"] = date all_prcp.append(measurement_dict) return jsonify(all_prcp) @app.route("/api/v1.0/stations") def stations(): # Create our session (link) from Python to the DB
64
64
93
28
36
scavazos4/sqlalchemy-challenge
app.py
Python
stations
stations
66
80
66
68
ffd166b0ce99b39c8fce1c73b138036aa4a32450
bigcode/the-stack
train
085ba4497a06c297f4f98c21
train
function
@app.route("/api/v1.0/precipitation") def precipitation(): # Create our session (link) from Python to the DB session = Session(engine) """Return a list of all precipitation values""" # Query all passengers results = session.query(Measurement.prcp, Measurement.date).all() session.close() # ...
@app.route("/api/v1.0/precipitation") def precipitation(): # Create our session (link) from Python to the DB
session = Session(engine) """Return a list of all precipitation values""" # Query all passengers results = session.query(Measurement.prcp, Measurement.date).all() session.close() # Create a dictionary from the row data and append to a list all_prcp = [] for prcp, date in results: ...
0/precipitation<br/>" f"/api/v1.0/stations<br/>" f"/api/v1.0/tobs" ) @app.route("/api/v1.0/precipitation") def precipitation(): # Create our session (link) from Python to the DB
64
64
143
30
34
scavazos4/sqlalchemy-challenge
app.py
Python
precipitation
precipitation
44
63
44
46
9d784ca7590e0199e85e37f8d584604e41b056ac
bigcode/the-stack
train
8cd0bd458a0808027b83ecf7
train
function
@app.route("/api/v1.0/tobs") def tobs(): # Create our session (link) from Python to the DB session = Session(engine) """Return a list of all tobs in last year of data""" # Query all passengers results = session.query(Measurement.date, Measurement.tobs)\ .filter(Measurement.date > '2016-08-2...
@app.route("/api/v1.0/tobs") def tobs(): # Create our session (link) from Python to the DB
session = Session(engine) """Return a list of all tobs in last year of data""" # Query all passengers results = session.query(Measurement.date, Measurement.tobs)\ .filter(Measurement.date > '2016-08-23').\ order_by(Measurement.date).all() session.close() # Create a dictiona...
).all() session.close() # Convert list of tuples into normal list all_stations = list(np.ravel(results)) return jsonify(all_stations) @app.route("/api/v1.0/tobs") def tobs(): # Create our session (link) from Python to the DB
64
64
170
29
35
scavazos4/sqlalchemy-challenge
app.py
Python
tobs
tobs
83
104
83
85
0e2845012477c22c9ca169f5af8cd5dedd443c95
bigcode/the-stack
train
ca8a3fc7d7b7817b4fb090ae
train
class
class HRSiteModel(S3Model): names = ("hrm_human_resource_site",) def model(self): T = current.T # ========================================================================= # Link between Human Resources & Facilities # - this is used to allow different Site Contacts per Sector...
class HRSiteModel(S3Model):
names = ("hrm_human_resource_site",) def model(self): T = current.T # ========================================================================= # Link between Human Resources & Facilities # - this is used to allow different Site Contacts per Sector # - it can be used t...
["first_name"] = first_name if middle_name: item["middle_name"] = middle_name if last_name: item["last_name"] = last_name if email: item["email"] = email if mobile_phone: item["mphone"] = mobile_phone if home_phone: item...
256
256
878
9
246
ramdesh/eden
modules/s3db/hrm.py
Python
HRSiteModel
HRSiteModel
1,375
1,493
1,375
1,376
9066afc3b1b684cf70c32ad6da153d72277f5fdf
bigcode/the-stack
train
4b30d9cb30fa066629a56be1
train
class
class HRSalaryModel(S3Model): """ Data Model to track salaries of staff """ names = ("hrm_staff_level", "hrm_salary_grade", "hrm_salary", ) def model(self): db = current.db T = current.T define_table = self.define_table configure = se...
class HRSalaryModel(S3Model):
""" Data Model to track salaries of staff """ names = ("hrm_staff_level", "hrm_salary_grade", "hrm_salary", ) def model(self): db = current.db T = current.T define_table = self.define_table configure = self.configure organisa...
record.site_id table = db.hrm_human_resource db(table.id == human_resource_id).update(site_id = site_id, site_contact = record.site_contact ) # Update realm_entity of HR entity = current.s3...
256
256
965
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
HRSalaryModel
HRSalaryModel
1,496
1,656
1,496
1,496
bafa9002becaf93fa084b3af0b1e4afcfd2cba2d
bigcode/the-stack
train
044920177d57145bb4d6938e
train
function
def hrm_training_onaccept(form): """ Ensure that Certifications, Hours & list:Trainings are Populated from Trainings Provide a Pass/Fail rating based on the Course's Pass Mark - called both onaccept & ondelete """ # Deletion and update have a different format delete = False ...
def hrm_training_onaccept(form):
""" Ensure that Certifications, Hours & list:Trainings are Populated from Trainings Provide a Pass/Fail rating based on the Course's Pass Mark - called both onaccept & ondelete """ # Deletion and update have a different format delete = False try: training_id = form.v...
== otable.id) org = db(query).select(otable.realm_entity, limitby=(0, 1)).first() if org: return org.realm_entity return None # ============================================================================= def hrm_training_onvalidatio...
256
256
1,416
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_training_onaccept
hrm_training_onaccept
3,980
4,166
3,980
3,980
233de15f4bfc1568b5ba8847ec66e9e9cc5f7c78
bigcode/the-stack
train
2557cfba33a1ae0d8738ef48
train
function
def hrm_training_organisation(row): """ Which Organisation(s)/Branch(es) the person is actively affiliated with """ try: person_id = row.hrm_training.person_id except AttributeError: # not available person_id = None if person_id: s3db = current.s3db ...
def hrm_training_organisation(row):
""" Which Organisation(s)/Branch(es) the person is actively affiliated with """ try: person_id = row.hrm_training.person_id except AttributeError: # not available person_id = None if person_id: s3db = current.s3db table = s3db.hrm_human_resource ...
for job in jobs: jobtitle = job.name if output: output = "%s, %s" % (output, jobtitle) else: output = jobtitle return output return current.messages["NONE"] # ===========================================...
64
64
200
8
55
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_training_organisation
hrm_training_organisation
7,020
7,049
7,020
7,020
3598044750157872735c7f3b3f8ca1baa2ddf353
bigcode/the-stack
train
2378de54eac4b6a60e0c1a3c
train
class
class HRAppraisalModel(S3Model): """ Appraisal for an HR - can be for a specific Mission or routine annual appraisal """ names = ("hrm_appraisal", "hrm_appraisal_document", ) def model(self): T = current.T configure = self.configure de...
class HRAppraisalModel(S3Model):
""" Appraisal for an HR - can be for a specific Mission or routine annual appraisal """ names = ("hrm_appraisal", "hrm_appraisal_document", ) def model(self): T = current.T configure = self.configure define_table = self.define_table ...
) * Evaluation (currently the only use case - for IFRC's Bangkok CCST) """ names = ("hrm_event_target", ) def model(self): T = current.T # @ToDo: Deployment_setting if use expanded beyond Bangkok CCST type_opts = {1: T("Other"), 3: T(...
256
256
1,238
9
246
ramdesh/eden
modules/s3db/hrm.py
Python
HRAppraisalModel
HRAppraisalModel
4,303
4,485
4,303
4,303
8b9a8314e262127d944e76988304325875ba7e71
bigcode/the-stack
train
6aa26612dcddde7cedbce82f
train
function
def hrm_programme_hours_month(row): """ Virtual field for hrm_programme_hours - returns the date of the first day of the month of this entry, used for programme hours report. Requires "date" to be in the additional report_fields @param row: the Row """ try: thisdat...
def hrm_programme_hours_month(row):
""" Virtual field for hrm_programme_hours - returns the date of the first day of the month of this entry, used for programme hours report. Requires "date" to be in the additional report_fields @param row: the Row """ try: thisdate = row["hrm_programme_hours.date"] ...
, } # ------------------------------------------------------------------------- @staticmethod def defaults(): """ Safe defaults for names in case the module is disabled """ #dummy = S3ReusableField.dummy return {"hrm_delegation_status_opts": {}} # ================...
64
64
151
9
54
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_programme_hours_month
hrm_programme_hours_month
5,609
5,631
5,609
5,609
9326f9436db3ca13ac3f133c426ee42f4849266c
bigcode/the-stack
train
f4e7783ff9fe55ca7307ad4d
train
function
def hrm_competency_list_layout(list_id, item_id, resource, rfields, record): """ Default dataList item renderer for Skills on the HRM Profile @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param rfie...
def hrm_competency_list_layout(list_id, item_id, resource, rfields, record):
""" Default dataList item renderer for Skills on the HRM Profile @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param rfields: the S3ResourceFields to render @param record: the record as dict...
() test = name_format % {"first_name": 1, "middle_name": 2, "last_name": 3, } test = "".join(ch for ch in test if ch in ("1", "2", "3")) if test[:1] == "1": orderby = "pr_person.first_name" ...
196
196
654
21
174
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_competency_list_layout
hrm_competency_list_layout
10,165
10,254
10,165
10,165
9f369de423fed5f5840e030ce74980430e6c62c6
bigcode/the-stack
train
af1115d69bffeb3776cc1bc7
train
class
class hrm_Medical(S3Method): """ HR Medical Tab, custom profile page with multiple elements: * Physical Description * Insurance NB It is expected to create S3SQLCustomForm for these in customise_hrm_insurance_resource customise_pr_physical_description_...
class hrm_Medical(S3Method):
""" HR Medical Tab, custom profile page with multiple elements: * Physical Description * Insurance NB It is expected to create S3SQLCustomForm for these in customise_hrm_insurance_resource customise_pr_physical_description_resource """ # -----...
} # profile_widgets.append(widget) if r.representation == "html": response = current.response # Maintain normal rheader for consistency rheader = attr["rheader"] profile_header = TAG[""](H2(response.s3.crud_strings...
203
203
678
10
192
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_Medical
hrm_Medical
9,581
9,675
9,581
9,581
9f3e4dbcfaba8b85b17ec23537dc40eeeaa9f888
bigcode/the-stack
train
ad9a8853d9f6be0059f5eae6
train
function
def hrm_training_controller(): """ Training Controller, defined in the model for use from multiple controllers for unified menus - used for Searching for Participants - used for Adding/Editing on Profile page """ s3db = current.s3db def prep(r): method = r.met...
def hrm_training_controller():
""" Training Controller, defined in the model for use from multiple controllers for unified menus - used for Searching for Participants - used for Adding/Editing on Profile page """ s3db = current.s3db def prep(r): method = r.method if r.interactive or...
s3.postp = postp # REST Interface #orgname = session.s3.hrm.orgname _attr = {"csv_stylesheet": ("hrm", "person.xsl"), "csv_template": "staff", "csv_extra_fields": [{"label": "Type", "field": s3db.hrm_human_resource.type, ...
168
168
563
6
161
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_training_controller
hrm_training_controller
8,952
9,018
8,952
8,952
d68dcb773293a1797112e560ca8fa639101aab22
bigcode/the-stack
train
5cf7df894a096e1cf79caa1b
train
class
class HREventAssessmentModel(S3Model): """ (Training) Events <> Data Collection Assessments Link Table Can be used for: * Needs Assessment / Readiness checklist * Tests (either for checking learning/application or for final grade) * Evaluation (currently the only...
class HREventAssessmentModel(S3Model):
""" (Training) Events <> Data Collection Assessments Link Table Can be used for: * Needs Assessment / Readiness checklist * Tests (either for checking learning/application or for final grade) * Evaluation (currently the only use case - for IFRC's Bangkok CCST) ...
self.define_table(tablename, self.hrm_training_event_id(empty = False, ondelete = "CASCADE", ), self.project_project_id(empty = False, ...
89
89
297
10
78
ramdesh/eden
modules/s3db/hrm.py
Python
HREventAssessmentModel
HREventAssessmentModel
4,256
4,300
4,256
4,256
32e6da7830b79fbd8ab80af163bc661d80e67f28
bigcode/the-stack
train
c48ec59d8f34182ae0ccd718
train
function
def hrm_human_resource_onaccept(form): """ On-accept for HR records """ if "vars" in form: # e.g. coming from staff/create form_vars = form.vars elif "id" in form: # e.g. coming from user/create or from hrm_site_onaccept or req_onaccept form_vars = form elif hasattr(form...
def hrm_human_resource_onaccept(form):
""" On-accept for HR records """ if "vars" in form: # e.g. coming from staff/create form_vars = form.vars elif "id" in form: # e.g. coming from user/create or from hrm_site_onaccept or req_onaccept form_vars = form elif hasattr(form, "vars"): # SQLFORM e.g. ? ...
s]" % start_date) return " ".join(representation) # ============================================================================= #def hrm_position_represent(id, row=None): # """ # """ # if row: # id = row.id # elif not id: # return current.messages["NONE"] # db = current.db # ...
256
256
2,541
10
245
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_human_resource_onaccept
hrm_human_resource_onaccept
6,410
6,730
6,410
6,410
5b74c989c7a6c8c728206ef1faa5b1b7231a1949
bigcode/the-stack
train
04c466430c677b7413b1cc58
train
class
class HREventProgrammeModel(S3Model): """ (Training) Events <> Programmes Link Table """ names = ("hrm_event_programme", ) def model(self): # ===================================================================== # (Training) Events <> Programmes Link Table ...
class HREventProgrammeModel(S3Model):
""" (Training) Events <> Programmes Link Table """ names = ("hrm_event_programme", ) def model(self): # ===================================================================== # (Training) Events <> Programmes Link Table # tablename = "hrm_event_prog...
", ), self.project_strategy_id(empty = False, ondelete = "CASCADE", ), *s3_meta_fields()) # ------------...
64
64
149
10
53
ramdesh/eden
modules/s3db/hrm.py
Python
HREventProgrammeModel
HREventProgrammeModel
4,198
4,224
4,198
4,198
81acc56d5a9ea2204101e103a408af3961b3fdcc
bigcode/the-stack
train
93479b79fd9bf06325cd4c81
train
class
class hrm_TrainingEventRepresent(S3Represent): """ Representation of training_event_id """ def __init__(self): """ Constructor """ super(hrm_TrainingEventRepresent, self).__init__( lookup = "hrm_training_event") # -------...
class hrm_TrainingEventRepresent(S3Represent):
""" Representation of training_event_id """ def __init__(self): """ Constructor """ super(hrm_TrainingEventRepresent, self).__init__( lookup = "hrm_training_event") # ------------------------------------------------------...
""" Constructor """ super(hrm_TrainingRepresent, self).__init__(lookup = "hrm_training") # ------------------------------------------------------------------------- def lookup_rows(self, key, values, fields=None): """ Custom rows lookup @par...
235
235
786
11
223
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_TrainingEventRepresent
hrm_TrainingEventRepresent
6,258
6,379
6,258
6,258
6ffadc2d3cc969fb2360b4368ab80c74aba62df6
bigcode/the-stack
train
ee46a62bd121fb86d73bfc94
train
function
def hrm_rheader(r, tabs=None, profile=False): """ Resource headers for component views """ if r.representation != "html": # RHeaders only used in interactive views return None record = r.record if record is None: # List or Create form: rheader makes no sense here return ...
def hrm_rheader(r, tabs=None, profile=False):
""" Resource headers for component views """ if r.representation != "html": # RHeaders only used in interactive views return None record = r.record if record is None: # List or Create form: rheader makes no sense here return None T = current.T table = r.table ...
: output = "%s, %s" % (output, jobtitle) else: output = jobtitle return output return current.messages["NONE"] # ============================================================================= def hrm_training_organisation(row): """ Whi...
256
256
5,168
13
242
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_rheader
hrm_rheader
7,052
7,716
7,052
7,052
16bab3927b92cd2185b2015428fab15474a08718
bigcode/the-stack
train
6edd4efd1a03fbadacb9393c
train
class
class HREventStrategyModel(S3Model): """ (Training) Events <> Strategies Link Table """ names = ("hrm_event_strategy", ) def model(self): # ===================================================================== # (Training) Events <> Strategies Link Table #...
class HREventStrategyModel(S3Model):
""" (Training) Events <> Strategies Link Table """ names = ("hrm_event_strategy", ) def model(self): # ===================================================================== # (Training) Events <> Strategies Link Table # tablename = "hrm_event_strat...
= "Added by training", owned_by_user = user_id, ) # Propagate to Skills form = Storage() form.vars = Storage() form.vars.id = certification_id hrm_certification_onaccept(form) # ============...
64
64
143
10
53
ramdesh/eden
modules/s3db/hrm.py
Python
HREventStrategyModel
HREventStrategyModel
4,169
4,195
4,169
4,169
e293a0cee84937fd432c7f1957936f91632a8c90
bigcode/the-stack
train
f8ba2a49039ee1f91aa26f9e
train
class
class hrm_OrgSpecificTypeRepresent(S3Represent): """ Representation of organisation-specific taxonomic categories """ def __init__(self, lookup=None): """ Constructor """ if lookup is None: raise SyntaxError("must specify a lookup table") fields = ("name", "organisation_id...
class hrm_OrgSpecificTypeRepresent(S3Represent):
""" Representation of organisation-specific taxonomic categories """ def __init__(self, lookup=None): """ Constructor """ if lookup is None: raise SyntaxError("must specify a lookup table") fields = ("name", "organisation_id") super(hrm_OrgSpecificTypeRepresent, se...
@todo: implement return {} # ------------------------------------------------------------------------- @staticmethod def hrm_salary_onvalidation(form): try: form_vars = form.vars start_date = form_vars.get("start_date") end_date = form_vars.get("end_da...
116
116
389
12
103
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_OrgSpecificTypeRepresent
hrm_OrgSpecificTypeRepresent
1,659
1,725
1,659
1,659
2ac1542b1858e069a9de931d3383a2a07d7adb94
bigcode/the-stack
train
27ad62e39e1c04624ef56480
train
function
def hrm_training_month(row): """ Year/Month of the start date of the training event """ if hasattr(row, "hrm_training"): row = row.hrm_training try: date = row.date except AttributeError: # not available date = None if date: return "%s/%02d" % (date.year, date...
def hrm_training_month(row):
""" Year/Month of the start date of the training event """ if hasattr(row, "hrm_training"): row = row.hrm_training try: date = row.date except AttributeError: # not available date = None if date: return "%s/%02d" % (date.year, date.month) else: ret...
ters) pass # Email address (as hyperlink) if email: append(TR(TD(B("%s:" % CONTACT_OPTS.get("EMAIL"))), TD(A(email, _href="mailto:%s" % email)))) return output # ============================================================================= def hrm_training_month(row):...
64
64
93
7
56
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_training_month
hrm_training_month
6,956
6,968
6,956
6,956
f09d79ab0b328f05604f360f8c39465603d4e81a
bigcode/the-stack
train
aa327b6d71864f6c0b3f8803
train
function
def hrm_group_controller(): """ Team controller - uses the group table from PR """ T = current.T s3db = current.s3db s3 = current.response.s3 settings = current.deployment_settings team_name = settings.get_hrm_teams() tablename = "pr_group" table = s3db[tablename] ...
def hrm_group_controller():
""" Team controller - uses the group table from PR """ T = current.T s3db = current.s3db s3 = current.response.s3 settings = current.deployment_settings team_name = settings.get_hrm_teams() tablename = "pr_group" table = s3db[tablename] _group_type = table.grou...
m", "credential"), ) # ============================================================================= def hrm_experience_controller(): """ Experience Controller, defined in the model for use from multiple controllers for unified menus - used for Adding/Edi...
256
256
1,441
6
249
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_group_controller
hrm_group_controller
7,879
8,071
7,879
7,879
e412f8be925cb5344790c1bebb40f6dc67f574f3
bigcode/the-stack
train
915ea610c26a7b7fa326855d
train
class
class HRAwardModel(S3Model): """ Data model for staff awards """ names = ("hrm_award_type", "hrm_award", ) def model(self): T = current.T db = current.db define_table = self.define_table # ========================================================...
class HRAwardModel(S3Model):
""" Data model for staff awards """ names = ("hrm_award_type", "hrm_award", ) def model(self): T = current.T db = current.db define_table = self.define_table # ===================================================================== # Award...
"job_title_id", "location_id", "comments", ], list_layout = hrm_experience_list_layout, orderby = "hrm_experience.start_da...
142
142
476
9
132
ramdesh/eden
modules/s3db/hrm.py
Python
HRAwardModel
HRAwardModel
4,668
4,742
4,668
4,668
08412cc49ec2300e6e8e269af80589fea7bf5ee7
bigcode/the-stack
train
cd4721d5a79fdee293064660
train
function
def hrm_experience_list_layout(list_id, item_id, resource, rfields, record): """ Default dataList item renderer for Experience on the HRM Profile @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param ...
def hrm_experience_list_layout(list_id, item_id, resource, rfields, record):
""" Default dataList item renderer for Experience on the HRM Profile @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param rfields: the S3ResourceFields to render @param record: the record as ...
", args=[record_id, "update.popup"], vars={"refresh": list_id, "record": record_id}), _class="s3_modal", _title=current.response.s3.crud_strings["hrm_credential"].title_update, ...
256
256
1,242
20
235
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_experience_list_layout
hrm_experience_list_layout
10,342
10,520
10,342
10,342
1e787e5ce4900ed1bce7dca1c1d6c9305e421de4
bigcode/the-stack
train
5a3c7e3a05dbc81b4b958a44
train
class
class HRDelegationModel(S3Model): """ Model to manage delegations of staff/volunteers to other organisations. """ names = ("hrm_delegation", "hrm_delegation_status_opts", "hrm_delegation_message", ) def model(self): T = current.T ...
class HRDelegationModel(S3Model):
""" Model to manage delegations of staff/volunteers to other organisations. """ names = ("hrm_delegation", "hrm_delegation_status_opts", "hrm_delegation_message", ) def model(self): T = current.T db = current.db s3 = curr...
Edit Shift"), #title_upload = T("Import Shift data"), label_list_button = T("List Shifts"), msg_record_created = T("Shift added"), msg_record_modified = T("Shift updated"), msg_record_deleted = T("Shift deleted"), msg_list_empty = T("No Shifts defi...
256
256
1,656
9
246
ramdesh/eden
modules/s3db/hrm.py
Python
HRDelegationModel
HRDelegationModel
5,352
5,606
5,352
5,352
4f1ed8388a8cdaef470ad1e67aeb1515416ebcbf
bigcode/the-stack
train
43783d0a4420603d4fa54fc0
train
function
def hrm_training_job_title(row): """ Which Job Titles(s) the person is active with """ try: person_id = row.hrm_training.person_id except AttributeError: # not available person_id = None if person_id: s3db = current.s3db table = s3db.hrm_human_resour...
def hrm_training_job_title(row):
""" Which Job Titles(s) the person is active with """ try: person_id = row.hrm_training.person_id except AttributeError: # not available person_id = None if person_id: s3db = current.s3db table = s3db.hrm_human_resource jtable = s3db.hrm_job_...
_training"): row = row.hrm_training try: date = row.date except AttributeError: # not available date = None if date: return date.year else: return current.messages["NONE"] # ============================================================================= def...
64
64
211
8
55
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_training_job_title
hrm_training_job_title
6,986
7,017
6,986
6,986
f0cf30a94b42d9565193c67e5d86f678f081bc20
bigcode/the-stack
train
c76d7237775a471d2f76d80f
train
class
class HRExperienceModel(S3Model): """ Record a person's work experience """ names = ("hrm_experience",) def model(self): T = current.T person_id = self.pr_person_id settings = current.deployment_settings if settings.get_org_autocomplete(): org_wid...
class HRExperienceModel(S3Model):
""" Record a person's work experience """ names = ("hrm_experience",) def model(self): T = current.T person_id = self.pr_person_id settings = current.deployment_settings if settings.get_org_autocomplete(): org_widget = S3OrganisationAutocompleteWi...
: return db.deploy_assignment_appraisal.insert(assignment_id = assignment.id, appraisal_id = record_id, ) # ------------------------------------------------------------------------- @staticmethod ...
256
256
1,216
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
HRExperienceModel
HRExperienceModel
4,488
4,665
4,488
4,488
f462eeaec740e903289907affc141a7d6a8d4e27
bigcode/the-stack
train
ce3fa0f05e3285ca6ac3fb88
train
class
class HRContractModel(S3Model): """ Data model to track employment contract details of staff members """ names = ("hrm_contract", ) def model(self): T = current.T contract_terms = {"SHORT": T("Short-term"), "LONG": T("Long-term"), ...
class HRContractModel(S3Model):
""" Data model to track employment contract details of staff members """ names = ("hrm_contract", ) def model(self): T = current.T contract_terms = {"SHORT": T("Short-term"), "LONG": T("Long-term"), "PERMANENT": T("Permanen...
= T("Beneficiary"), # ), s3_comments(), *s3_meta_fields()) self.configure(tablename, #context = {"person": "human_resource_id$person_id", # }, dedup...
90
90
301
8
81
ramdesh/eden
modules/s3db/hrm.py
Python
HRContractModel
HRContractModel
1,797
1,847
1,797
1,797
bb0cea085dc337ae167763761cfc318231427978
bigcode/the-stack
train
f6da03c1c0fc4093308a5803
train
function
def hrm_training_list_layout(list_id, item_id, resource, rfields, record): """ Default dataList item renderer for Trainings on the HRM Profile @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param rfi...
def hrm_training_list_layout(list_id, item_id, resource, rfields, record):
""" Default dataList item renderer for Trainings on the HRM Profile @param list_id: the HTML ID of the list @param item_id: the HTML ID of the item @param resource: the S3Resource to render @param rfields: the S3ResourceFields to render @param record: the record as d...
3_modal", _title=current.T("Edit Experience"), ) else: edit_btn = "" if permit("delete", table, record_id=record_id): delete_btn = A(ICON("delete"), _class="dl-item-delete", ) else: delete_btn = "...
244
244
814
19
224
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_training_list_layout
hrm_training_list_layout
10,523
10,649
10,523
10,523
cac83d3fe09a7ac4493da7de92b26be566ca8f09
bigcode/the-stack
train
cf82898efd6209ae480ad873
train
function
def hrm_training_event_controller(): """ Training Event Controller, defined in the model for use from multiple controllers for unified menus """ s3 = current.response.s3 def prep(r): if r.component_name == "target": tablename = "dc_target" # Simplify ...
def hrm_training_event_controller():
""" Training Event Controller, defined in the model for use from multiple controllers for unified menus """ s3 = current.response.s3 def prep(r): if r.component_name == "target": tablename = "dc_target" # Simplify table = r.component.table ...
# f.writable = True if method == "report": # Configure virtual fields for reports s3db.configure("hrm_training", extra_fields=["date"]) table = s3db.hrm_training table.year = Field.Method("year", hrm_training_year) table.month = Fie...
256
256
1,173
7
248
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_training_event_controller
hrm_training_event_controller
9,021
9,157
9,021
9,021
48af4fd128b13ca91b649c3e9f44eaf909628bab
bigcode/the-stack
train
49f0407ec55faa801617b015
train
function
def hrm_programme_hours_onaccept(form): """ Update the Active Status for the volunteer - called both onaccept & ondelete """ vol_active = current.deployment_settings.get_hrm_vol_active() if not callable(vol_active): # Nothing to do (either field is disabled or else set manually)...
def hrm_programme_hours_onaccept(form):
""" Update the Active Status for the volunteer - called both onaccept & ondelete """ vol_active = current.deployment_settings.get_hrm_vol_active() if not callable(vol_active): # Nothing to do (either field is disabled or else set manually) return # Deletion and upda...
date" to be in the additional report_fields @param row: the Row """ try: thisdate = row["hrm_programme_hours.date"] except AttributeError: return current.messages["NONE"] if not thisdate: return current.messages["NONE"] #thisdate = thisdate.date() month = thisd...
118
118
394
10
107
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_programme_hours_onaccept
hrm_programme_hours_onaccept
5,634
5,690
5,634
5,634
96ec089ae347f9ef900b8d652dc758e5bd2314c1
bigcode/the-stack
train
9de53224d61797d84b3a4e70
train
function
def hrm_configure_pr_group_membership(): """ Configures the labels and CRUD Strings of pr_group_membership """ T = current.T s3db = current.s3db settings = current.deployment_settings request = current.request function = request.function tablename = "pr_group_membership" ta...
def hrm_configure_pr_group_membership():
""" Configures the labels and CRUD Strings of pr_group_membership """ T = current.T s3db = current.s3db settings = current.deployment_settings request = current.request function = request.function tablename = "pr_group_membership" table = s3db.pr_group_membership if set...
ValueError: pass if default_hr_id in hr_id: field.default = default_hr_id # Filter field options field.requires = IS_ONE_OF(current.db, "hrm_human_resource.id", current.s3db.hrm_human_resource_represent, ...
216
216
723
10
205
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_configure_pr_group_membership
hrm_configure_pr_group_membership
10,077
10,162
10,077
10,077
1a7d66a9f7a78af30d7b508363fdd0c4ecd2cae7
bigcode/the-stack
train
0646736a4d933277ee285e2d
train
class
class HRModel(S3Model): names = ("hrm_department", "hrm_department_id", "hrm_job_title", "hrm_job_title_id", "hrm_job_title_human_resource", "hrm_human_resource", "hrm_human_resource_id", "hrm_type_opts", "hrm_h...
class HRModel(S3Model):
names = ("hrm_department", "hrm_department_id", "hrm_job_title", "hrm_job_title_id", "hrm_job_title_human_resource", "hrm_human_resource", "hrm_human_resource_id", "hrm_type_opts", "hrm_human_resource_represent",...
"hrm_compose", "hrm_map_popup", "hrm_rheader", "hrm_competency_controller", "hrm_credential_controller", "hrm_experience_controller", "hrm_group_controller", "hrm_human_resource_controller", "hrm_person_controller", ...
256
256
9,715
7
248
ramdesh/eden
modules/s3db/hrm.py
Python
HRModel
HRModel
92
1,372
92
93
99cd79ac739f5e96d6973ac0dd9a90732a9dfb44
bigcode/the-stack
train
a9a29fe8239b26e5be3a6893
train
class
class HRShiftModel(S3Model): """ Shifts """ names = ("hrm_shift_template", "hrm_shift", "hrm_shift_id", "hrm_human_resource_shift", ) def model(self): T = current.T #configure = self.configure crud_strings = curren...
class HRShiftModel(S3Model):
""" Shifts """ names = ("hrm_shift_template", "hrm_shift", "hrm_shift_id", "hrm_human_resource_shift", ) def model(self): T = current.T #configure = self.configure crud_strings = current.response.s3.crud_strings ...
), ] report_fields = ["training", "programme_id", "job_title_id", "training_id", (T("Month"), "month"), "hours", "person_id$gender", ...
256
256
1,668
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
HRShiftModel
HRShiftModel
5,096
5,349
5,096
5,096
bd6863f00cb01f242421c641706a178ee10f8b5f
bigcode/the-stack
train
ef96ec8b5de5f0031fd99113
train
class
class hrm_Record(S3Method): """ HR Record, custom profile page with multiple DataTables: * Human Resource * Hours (for volunteers) * Teams """ def __init__(self, salary=False, awards=False, disciplinary_record=Fa...
class hrm_Record(S3Method):
""" HR Record, custom profile page with multiple DataTables: * Human Resource * Hours (for volunteers) * Teams """ def __init__(self, salary=False, awards=False, disciplinary_record=False, org_ex...
hrm_human_resource", "context": "person", "sqlform": S3SQLCustomForm("insurance.insurance_number", "insurance.phone", "insurance.insurer", ), }, ] ...
256
256
2,396
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_Record
hrm_Record
9,678
10,005
9,678
9,678
0dc16fae9ea9888e95bf94eac6f19896008cdb38
bigcode/the-stack
train
60c103fcc67d7a19fd6981f8
train
class
class HRSkillModel(S3Model): names = ("hrm_skill_type", "hrm_skill", "hrm_competency_rating", "hrm_competency", #"hrm_competency_id", "hrm_credential", "hrm_training", "hrm_trainings", "hrm_event_type", ...
class HRSkillModel(S3Model):
names = ("hrm_skill_type", "hrm_skill", "hrm_competency_rating", "hrm_competency", #"hrm_competency_id", "hrm_credential", "hrm_training", "hrm_trainings", "hrm_event_type", "hrm_training_event", ...
tablename = "hrm_vacancy" define_table(tablename, organisation_id(), #Field("code"), Field("title"), Field("description", "text"), self.super_link("site_id", "org_site", ...
256
256
13,969
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
HRSkillModel
HRSkillModel
2,021
3,946
2,021
2,022
d92d0af73d4faf2a7b7f67c268da8d9247fa17af
bigcode/the-stack
train
bd21714e69cec8e68d48baf4
train
class
class HRDisciplinaryActionModel(S3Model): """ Data model for staff disciplinary record """ names = ("hrm_disciplinary_type", "hrm_disciplinary_action", ) def model(self): T = current.T define_table = self.define_table # =================================...
class HRDisciplinaryActionModel(S3Model):
""" Data model for staff disciplinary record """ names = ("hrm_disciplinary_type", "hrm_disciplinary_action", ) def model(self): T = current.T define_table = self.define_table # ===================================================================== ...
("Edit Award"), label_list_button = T("List Awards"), label_delete_button = T("Delete Award"), msg_record_created = T("Award added"), msg_record_modified = T("Award updated"), msg_record_deleted = T("Award removed"), msg_no_match = T("No entries fo...
107
107
358
11
95
ramdesh/eden
modules/s3db/hrm.py
Python
HRDisciplinaryActionModel
HRDisciplinaryActionModel
4,745
4,805
4,745
4,745
97cd7654adb3806bfd9fe3b4ecb26684e7efdc22
bigcode/the-stack
train
9d80b009bab0268f1c9896f3
train
function
def hrm_competency_controller(): """ RESTful CRUD controller - used for Searching for people by Skill - used for Adding/Editing on Profile page """ T = current.T s3db = current.s3db s3 = current.response.s3 def prep(r): if r.method in ("create", "create.popup"...
def hrm_competency_controller():
""" RESTful CRUD controller - used for Searching for people by Skill - used for Adding/Editing on Profile page """ T = current.T s3db = current.s3db s3 = current.response.s3 def prep(r): if r.method in ("create", "create.popup", "update", "update.popup"): ...
1), ).first() if link: human_resource_id = link.human_resource_id else: human_resource_id = None rheader = DIV(TABLE(TR(TH("%s: " % stable.site_id.label), stable.site_id.represent(site_i...
222
222
740
8
213
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_competency_controller
hrm_competency_controller
7,719
7,815
7,719
7,719
ae42c921cb02044eb1ef743e07313261c273060b
bigcode/the-stack
train
122d177a66d49fa2e2a3f17f
train
function
def hrm_configure_salary(r): """ Configure the salary tab @param r: the S3Request """ hr_id = None multiple = False # Get all accessible HR records of this person resource = r.resource rows = resource.select(["human_resource.id", "human_resource...
def hrm_configure_salary(r):
""" Configure the salary tab @param r: the S3Request """ hr_id = None multiple = False # Get all accessible HR records of this person resource = r.resource rows = resource.select(["human_resource.id", "human_resource.type", ...
crud_strings["pr_person"].title_display profile_header = TAG[""](H2(title), DIV(hrm_rheader(r), _id = "rheader", )) else: profile_header = None s3db.configure(...
142
142
474
8
133
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_configure_salary
hrm_configure_salary
10,008
10,074
10,008
10,008
a7a64a1266d369cf4ca632edcc0eeadaf97bcd7c
bigcode/the-stack
train
b865ffd53795ba07a7644c82
train
class
class HRJobModel(S3Model): """ Unused @ToDo: If bringing back into use then Availability better as Person component not HR """ names = ("hrm_position", "hrm_position_id", ) def model(self): s3db = current.s3db UNKNOWN_OPT = current.messages.UN...
class HRJobModel(S3Model):
""" Unused @ToDo: If bringing back into use then Availability better as Person component not HR """ names = ("hrm_position", "hrm_position_id", ) def model(self): s3db = current.s3db UNKNOWN_OPT = current.messages.UNKNOWN_OPT define_t...
LONG": T("Long-term"), "PERMANENT": T("Permanent") } contract_term_represent = S3Represent(options = contract_terms) hours_models = {"PARTTIME": T("Part-time"), "FULLTIME": T("Full-time"), } hour...
256
256
1,251
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
HRJobModel
HRJobModel
1,850
2,018
1,850
1,850
e6ec9f89971a76575c9b1057e2f097ed632ff1ee
bigcode/the-stack
train
84189bf60466066cbe6e8747
train
class
class hrm_TrainingRepresent(S3Represent): """ Represent a Training by its Course - used from within hrm_programme_hours """ def __init__(self): """ Constructor """ super(hrm_TrainingRepresent, self).__init__(lookup = "hrm_training") # -----------...
class hrm_TrainingRepresent(S3Represent):
""" Represent a Training by its Course - used from within hrm_programme_hours """ def __init__(self): """ Constructor """ super(hrm_TrainingRepresent, self).__init__(lookup = "hrm_training") # -----------------------------------------------------...
(and configured) if hr.organisation_id and \ current.deployment_settings.get_hrm_show_organisation(): htable = current.s3db.hrm_human_resource append(htable.organisation_id.represent(hr.organisation_id, show_link=False)) ...
78
78
261
10
67
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_TrainingRepresent
hrm_TrainingRepresent
6,210
6,255
6,210
6,210
4277a7eadb0496de255323ad794d3cca46fb1436
bigcode/the-stack
train
3dd0f37e35a247524cea2bd2
train
function
def hrm_person_controller(**attr): """ Persons Controller, defined in the model for use from multiple controllers for unified menus - used for access to component Tabs, Personal Profile & Imports - includes components relevant to HRM """ T = current.T db = current.db ...
def hrm_person_controller(**attr):
""" Persons Controller, defined in the model for use from multiple controllers for unified menus - used for access to component Tabs, Personal Profile & Imports - includes components relevant to HRM """ T = current.T db = current.db s3db = current.s3db #auth = ...
, not HR deletable = True # Open Profile page read_url = URL(args = ["[id]", "profile"]) update_url = URL(args = ["[id]", "profile"]) else: deletable = settings.get_hrm_deletable() # S...
256
256
3,265
8
247
ramdesh/eden
modules/s3db/hrm.py
Python
hrm_person_controller
hrm_person_controller
8,558
8,949
8,558
8,558
c2017edf60533cf1b01dd87e507ba396d18b4ba7
bigcode/the-stack
train