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
d57f124c2e24b6c4ec721dfa
train
function
def switch(value): while(True): questions2 = [{ 'type': 'list', 'name': 'choice', 'message': 'Menu', 'choices': [ '1. Home', '2. Exit', ] }] if(value == main_questions[...
def switch(value):
while(True): questions2 = [{ 'type': 'list', 'name': 'choice', 'message': 'Menu', 'choices': [ '1. Home', '2. Exit', ] }] if(value == main_questions[0]): fo...
AT+QSPN") sp.write(style.YELLOW + "AT+QSPN:" + QSPN + "\n") time.sleep(0.5) CGREG = sendATcommand("AT+CGREG?") sp.write(style.YELLOW + "AT+CGREG?:" + CGREG+"\n") time.sleep(0.5) sp.ok("✔") ...
225
225
752
4
221
sixfab/setup-and-diagnostic-tool
diagnostic_tool/diagnostic_tool.py
Python
switch
switch
177
270
177
177
1d6aaa21f6ca73880702f4c9facae48daa01eb7b
bigcode/the-stack
train
5efdc3249fa4c0d391fd7836
train
function
def main(): print(r""" ____ _ __ _ / ___|(_)_ __/ _| __ _| |__ \___ \| \ \/ / |_ / _` | '_ \ ___) | |> <| _| (_| | |_) | |____/|_/_/\_\_| \__,_|_.__/ """) print(r""" ____ _ _ _ _____ _ | _ \(_) __ _ __ _...
def main():
print(r""" ____ _ __ _ / ___|(_)_ __/ _| __ _| |__ \___ \| \ \/ / |_ / _` | '_ \ ___) | |> <| _| (_| | |_) | |____/|_/_/\_\_| \__,_|_.__/ """) print(r""" ____ _ _ _ _____ _ | _ \(_) __ _ __ _ _ __ ___ ...
6]): print(style.MAGENTA + "\n--- Raspberry Pi Model Infomation ---") model = os.popen('cat /proc/device-tree/model').read() print(style.YELLOW + model) answers = prompt(questions2, style=custom_style_2) if(answers['choice']== choice_question[0]): ...
95
96
322
3
92
sixfab/setup-and-diagnostic-tool
diagnostic_tool/diagnostic_tool.py
Python
main
main
273
303
273
273
64e83e9a598cba62bc8aa03a39544dc6c0d954f4
bigcode/the-stack
train
2dafbcfcfcdafe44beef432d
train
function
def send_command(): if(os.path.exists("/dev/ttyUSB2")): port = serial.Serial("/dev/ttyUSB2", baudrate=115200, timeout=1) connection=sendATcommand("AT") if(connection=="OK"): logging.info("Connected to the module. Sending commands...") with yaspin(text="Se...
def send_command():
if(os.path.exists("/dev/ttyUSB2")): port = serial.Serial("/dev/ttyUSB2", baudrate=115200, timeout=1) connection=sendATcommand("AT") if(connection=="OK"): logging.info("Connected to the module. Sending commands...") with yaspin(text="Sending AT Commands......
m' CYAN = '\033[36m' WHITE = '\033[37m' UNDERLINE = '\033[4m' RESET = '\033[0m' #for i in trange(10): # sleep(10) # # # FUNCTIONS # # # def sendATcommand(command): try: port =serial.Serial("/dev/ttyUSB2", baudrate=115200, timeout=1) except Exception as e: logging.error(...
255
256
963
4
250
sixfab/setup-and-diagnostic-tool
diagnostic_tool/diagnostic_tool.py
Python
send_command
send_command
82
175
82
82
25855ccea51f06acedca6d5829d641e2c4cb70ca
bigcode/the-stack
train
d52c1ac068dc5bf7e6c03cd5
train
function
def sendATcommand(command): try: port =serial.Serial("/dev/ttyUSB2", baudrate=115200, timeout=1) except Exception as e: logging.error("Serial port connection failed.", exc_info=True) logging.error("sendATcommand function was not executed", exc_info=True) port.write((command+'\r\n').e...
def sendATcommand(command):
try: port =serial.Serial("/dev/ttyUSB2", baudrate=115200, timeout=1) except Exception as e: logging.error("Serial port connection failed.", exc_info=True) logging.error("sendATcommand function was not executed", exc_info=True) port.write((command+'\r\n').encode()) receive= port.r...
033[36m' WHITE = '\033[37m' UNDERLINE = '\033[4m' RESET = '\033[0m' #for i in trange(10): # sleep(10) # # # FUNCTIONS # # # def sendATcommand(command):
64
64
186
6
58
sixfab/setup-and-diagnostic-tool
diagnostic_tool/diagnostic_tool.py
Python
sendATcommand
sendATcommand
56
78
56
56
38e923d2e981aefd06b9b81f1a9aaaacf392acbb
bigcode/the-stack
train
fd1001cd93f0e7a683f9e029
train
class
class IronicScenarioTestCase(test.ScenarioTestCase): def test__create_node(self): self.admin_clients("ironic").node.create.return_value = "fake_node" scenario = utils.IronicScenario(self.context) scenario.generate_random_name = mock.Mock() create_node = scenario._create_node(fake_p...
class IronicScenarioTestCase(test.ScenarioTestCase):
def test__create_node(self): self.admin_clients("ironic").node.create.return_value = "fake_node" scenario = utils.IronicScenario(self.context) scenario.generate_random_name = mock.Mock() create_node = scenario._create_node(fake_param="foo") self.assertEqual("fake_node", cre...
2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed 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 # un...
123
123
410
12
111
varuntiwari27/rally
tests/unit/plugins/openstack/scenarios/ironic/test_utils.py
Python
IronicScenarioTestCase
IronicScenarioTestCase
24
68
24
25
66a65c809687b5e47e58d10363c50bb16492fde7
bigcode/the-stack
train
24bf42c6fa668e47b24fb2d2
train
function
def has_inf_or_nan(datum, tensor): """A predicate for whether a tensor consists of any bad numerical values. This predicate is common enough to merit definition in this module. Bad numerical values include `nan`s and `inf`s. The signature of this function follows the requirement of the method `DebugDumpDir.f...
def has_inf_or_nan(datum, tensor):
"""A predicate for whether a tensor consists of any bad numerical values. This predicate is common enough to merit definition in this module. Bad numerical values include `nan`s and `inf`s. The signature of this function follows the requirement of the method `DebugDumpDir.find()`. Args: datum: (`Debug...
") != 1: raise ValueError("Invalid tensor name in debug node name: '%s'" % node_name) watched_node_name = name[:name.index(":")] watched_output_slot = int(name[name.index(":") + 1:]) return watched_node_name, watched_output_slot, debug_op_index, debug_op def has_inf_or_nan(datum, tensor):
79
79
264
10
68
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
has_inf_or_nan
has_inf_or_nan
299
328
299
299
c421cfb417ef1ee1ee06cec0ec63793f43acdd89
bigcode/the-stack
train
6754e816d4a594c4acd313d5
train
function
def extract_core_metadata_from_event_proto(event): json_metadata = json.loads(event.log_message.message) core_metadata = collections.namedtuple("CoreMetadata", [ "global_step", "session_run_count", "executor_step_count", "input_names", "output_names", "target_nodes" ]) return core_metadata(json_meta...
def extract_core_metadata_from_event_proto(event):
json_metadata = json.loads(event.log_message.message) core_metadata = collections.namedtuple("CoreMetadata", [ "global_step", "session_run_count", "executor_step_count", "input_names", "output_names", "target_nodes" ]) return core_metadata(json_metadata["global_step"], json_me...
np.issubdtype(tensor.dtype, np.complex) or np.issubdtype(tensor.dtype, np.integer)): return np.any(np.isnan(tensor)) or np.any(np.isinf(tensor)) else: return False def extract_core_metadata_from_event_proto(event):
64
64
109
9
54
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
extract_core_metadata_from_event_proto
extract_core_metadata_from_event_proto
331
342
331
331
ebc842c03f362f54b80f4c433899e6586d087a57
bigcode/the-stack
train
29e38171872b570ce8199d14
train
function
def get_node_name(element_name): return element_name.split(":")[0] if ":" in element_name else element_name
def get_node_name(element_name):
return element_name.split(":")[0] if ":" in element_name else element_name
_TAG) def _is_run_fetches_info_file(file_name): return file_name == METADATA_FILE_PREFIX + FETCHES_INFO_FILE_TAG def _is_run_feed_keys_info_file(file_name): return file_name == METADATA_FILE_PREFIX + FEED_KEYS_INFO_FILE_TAG def get_node_name(element_name):
64
64
25
7
56
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
get_node_name
get_node_name
177
178
177
177
415c00636a14e6c33437ae48813c364593054aaa
bigcode/the-stack
train
015bf1c71a6203d12f86b96b
train
function
def is_copy_node(node_name): """Determine whether a node name is that of a debug Copy node. Such nodes are inserted by TensorFlow core upon request in RunOptions.debug_options.debug_tensor_watch_opts. Args: node_name: Name of the node. Returns: A bool indicating whether the input argument is the na...
def is_copy_node(node_name):
"""Determine whether a node name is that of a debug Copy node. Such nodes are inserted by TensorFlow core upon request in RunOptions.debug_options.debug_tensor_watch_opts. Args: node_name: Name of the node. Returns: A bool indicating whether the input argument is the name of a debug Copy node. ...
watch the tensor, as a string. Returns: A string representing the debug watch on the tensor (i.e., the "watch key"). """ return "%s:%s" % (_get_tensor_name(node_name, output_slot), debug_op) def is_copy_node(node_name):
64
64
90
7
57
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
is_copy_node
is_copy_node
227
240
227
227
7c471198144d73a5a234dcd18e7aec959fe74161
bigcode/the-stack
train
b3eb222525e363da1b84f662
train
function
def _is_graph_file(file_name): return file_name.startswith(METADATA_FILE_PREFIX + GRAPH_FILE_TAG)
def _is_graph_file(file_name):
return file_name.startswith(METADATA_FILE_PREFIX + GRAPH_FILE_TAG)
output_slot = int(name[name.rfind(":") + 1:]) return node_name, output_slot else: return name, None def _is_core_metadata_file(file_name): return file_name.startswith(METADATA_FILE_PREFIX + CORE_METADATA_TAG) def _is_graph_file(file_name):
64
64
23
8
56
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_is_graph_file
_is_graph_file
165
166
165
165
f68efe03643b3d6ab3e26251869ce81aac7e2503
bigcode/the-stack
train
533722c53b3e69de8467459b
train
function
def load_tensor_from_event_file(event_file_path): """Load a tensor from an event file. Assumes that the event file contains a `Event` protobuf and the `Event` protobuf contains a `Tensor` value. Args: event_file_path: (`str`) path to the event file. Returns: The tensor value loaded from the event f...
def load_tensor_from_event_file(event_file_path):
"""Load a tensor from an event file. Assumes that the event file contains a `Event` protobuf and the `Event` protobuf contains a `Tensor` value. Args: event_file_path: (`str`) path to the event file. Returns: The tensor value loaded from the event file, as a `numpy.ndarray`. For uninitialized T...
= initialized def __str__(self): output = "" if self._initialized else "Uninitialized tensor:\n" output += str(self._tensor_proto) return output @property def initialized(self): return self._initialized def load_tensor_from_event_file(event_file_path):
64
64
168
10
53
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
load_tensor_from_event_file
load_tensor_from_event_file
66
85
66
66
4ba11d65a756c6cb6e6360c85c85428e16ce6985
bigcode/the-stack
train
f200fe2f7926f00053b8839a
train
function
def _load_graph_def_from_event_file(event_file_path): event = event_pb2.Event() with gfile.Open(event_file_path, "rb") as f: event.ParseFromString(f.read()) return graph_pb2.GraphDef.FromString(event.graph_def)
def _load_graph_def_from_event_file(event_file_path):
event = event_pb2.Event() with gfile.Open(event_file_path, "rb") as f: event.ParseFromString(f.read()) return graph_pb2.GraphDef.FromString(event.graph_def)
Error: tensor_value = InconvertibleTensorProto(tensor_proto) else: # Uninitialized tensor or tensor of unconvertible data type. tensor_value = InconvertibleTensorProto(tensor_proto, False) return tensor_value def _load_graph_def_from_event_file(event_file_path):
64
64
56
12
51
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_load_graph_def_from_event_file
_load_graph_def_from_event_file
121
126
121
121
b877fd525d75503d14ddc8abf0e82dec88f38ec2
bigcode/the-stack
train
fc86231d1a872fcff223b533
train
function
def _is_run_fetches_info_file(file_name): return file_name == METADATA_FILE_PREFIX + FETCHES_INFO_FILE_TAG
def _is_run_fetches_info_file(file_name):
return file_name == METADATA_FILE_PREFIX + FETCHES_INFO_FILE_TAG
return name, None def _is_core_metadata_file(file_name): return file_name.startswith(METADATA_FILE_PREFIX + CORE_METADATA_TAG) def _is_graph_file(file_name): return file_name.startswith(METADATA_FILE_PREFIX + GRAPH_FILE_TAG) def _is_run_fetches_info_file(file_name):
64
64
27
11
53
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_is_run_fetches_info_file
_is_run_fetches_info_file
169
170
169
169
2c7012763dbebf30750f907a0901075d2078fe5b
bigcode/the-stack
train
fbec2b51e885b12d676d2965
train
class
class DebugTensorDatum(object): """A single tensor dumped by TensorFlow Debugger (tfdbg). Contains metadata about the dumped tensor, including `timestamp`, `node_name`, `output_slot`, `debug_op`, and path to the dump file (`file_path`). This type does not hold the generally space-expensive tensor value (num...
class DebugTensorDatum(object):
"""A single tensor dumped by TensorFlow Debugger (tfdbg). Contains metadata about the dumped tensor, including `timestamp`, `node_name`, `output_slot`, `debug_op`, and path to the dump file (`file_path`). This type does not hold the generally space-expensive tensor value (numpy array). Instead, it points ...
of any nan or inf values. """ _ = datum # Datum metadata is unused in this predicate. if isinstance(tensor, InconvertibleTensorProto): # Uninitialized tensor doesn't have bad numerical values. # Also return False for data types that cannot be represented as numpy # arrays. return False elif ...
255
256
1,236
6
249
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
DebugTensorDatum
DebugTensorDatum
345
521
345
345
562d817edcb19ab5502aa974b9842f1d5658d601
bigcode/the-stack
train
418b9d5aa62f56f633daf145
train
class
class DebugDumpDir(object): """Data set from a debug-dump directory on filesystem. An instance of `DebugDumpDir` contains all `DebugTensorDatum` instances in a tfdbg dump root directory. """ def __init__(self, dump_root, partition_graphs=None, validate=True): """`DebugDumpDir` constructor. Args: ...
class DebugDumpDir(object):
"""Data set from a debug-dump directory on filesystem. An instance of `DebugDumpDir` contains all `DebugTensorDatum` instances in a tfdbg dump root directory. """ def __init__(self, dump_root, partition_graphs=None, validate=True): """`DebugDumpDir` constructor. Args: dump_root: (`str`) path ...
Returns: (`int`) output slot index watched by the debug op. """ return self._output_slot @property def tensor_name(self): """Name of the tensor watched by the debug op. Returns: (`str`) `Tensor` name, in the form of `node_name`:`output_slot` """ return _get_tensor_name(se...
256
256
7,599
6
249
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
DebugDumpDir
DebugDumpDir
524
1,519
524
524
ec9127b1ac36c96804ad7550eefcf2e9a712cf9d
bigcode/the-stack
train
63c74c9a99da1298d3dd0c30
train
function
def _is_run_feed_keys_info_file(file_name): return file_name == METADATA_FILE_PREFIX + FEED_KEYS_INFO_FILE_TAG
def _is_run_feed_keys_info_file(file_name):
return file_name == METADATA_FILE_PREFIX + FEED_KEYS_INFO_FILE_TAG
_METADATA_TAG) def _is_graph_file(file_name): return file_name.startswith(METADATA_FILE_PREFIX + GRAPH_FILE_TAG) def _is_run_fetches_info_file(file_name): return file_name == METADATA_FILE_PREFIX + FETCHES_INFO_FILE_TAG def _is_run_feed_keys_info_file(file_name):
64
64
28
11
52
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_is_run_feed_keys_info_file
_is_run_feed_keys_info_file
173
174
173
173
30bf19dfe0dbd2c5f535372cf61d1f49ddcbdc0e
bigcode/the-stack
train
e7ec888aca6f8dfc2ec51185
train
function
def parse_debug_node_name(node_name): """Parse the name of a debug node. Args: node_name: Name of the debug node. Returns: 1. Name of the watched node, as a str. 2. Output slot index of the watched tensor, as an int. 3. Index of the debug node, as an int. 4. Name of the debug op, as a str, e...
def parse_debug_node_name(node_name):
"""Parse the name of a debug node. Args: node_name: Name of the debug node. Returns: 1. Name of the watched node, as a str. 2. Output slot index of the watched tensor, as an int. 3. Index of the debug node, as an int. 4. Name of the debug op, as a str, e.g, "DebugIdentity". Raises: Va...
_") def is_debug_node(node_name): """Determine whether a node name is that of a debug node. Such nodes are inserted by TensorFlow core upon request in RunOptions.debug_options.debug_tensor_watch_opts. Args: node_name: Name of the node. Returns: A bool indicating whether the input argument is the ...
96
96
321
8
88
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
parse_debug_node_name
parse_debug_node_name
258
296
258
258
0a2bc38876af27f60e04c5a32891bf42fc5ecde3
bigcode/the-stack
train
007e0e53e0c0e706dd9469e7
train
function
def is_debug_node(node_name): """Determine whether a node name is that of a debug node. Such nodes are inserted by TensorFlow core upon request in RunOptions.debug_options.debug_tensor_watch_opts. Args: node_name: Name of the node. Returns: A bool indicating whether the input argument is the name o...
def is_debug_node(node_name):
"""Determine whether a node name is that of a debug node. Such nodes are inserted by TensorFlow core upon request in RunOptions.debug_options.debug_tensor_watch_opts. Args: node_name: Name of the node. Returns: A bool indicating whether the input argument is the name of a debug node. """ return...
in RunOptions.debug_options.debug_tensor_watch_opts. Args: node_name: Name of the node. Returns: A bool indicating whether the input argument is the name of a debug Copy node. """ return node_name.startswith("__copy_") def is_debug_node(node_name):
64
64
86
7
57
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
is_debug_node
is_debug_node
243
255
243
243
9c12b785c1b0ea44c964991c28b368ffcd5b3332
bigcode/the-stack
train
acf22fa469046ea466930eaa
train
function
def _is_core_metadata_file(file_name): return file_name.startswith(METADATA_FILE_PREFIX + CORE_METADATA_TAG)
def _is_core_metadata_file(file_name):
return file_name.startswith(METADATA_FILE_PREFIX + CORE_METADATA_TAG)
if ":" in name and not name.endswith(":"): node_name = name[:name.rfind(":")] output_slot = int(name[name.rfind(":") + 1:]) return node_name, output_slot else: return name, None def _is_core_metadata_file(file_name):
64
64
24
9
54
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_is_core_metadata_file
_is_core_metadata_file
161
162
161
161
c2cac9f55ca7d45dcc1868c9b191f74a08209899
bigcode/the-stack
train
f56075225accf5b31d3e3577
train
function
def _load_log_message_from_event_file(event_file_path): event = event_pb2.Event() with gfile.Open(event_file_path, "rb") as f: event.ParseFromString(f.read()) return event.log_message.message
def _load_log_message_from_event_file(event_file_path):
event = event_pb2.Event() with gfile.Open(event_file_path, "rb") as f: event.ParseFromString(f.read()) return event.log_message.message
_def_from_event_file(event_file_path): event = event_pb2.Event() with gfile.Open(event_file_path, "rb") as f: event.ParseFromString(f.read()) return graph_pb2.GraphDef.FromString(event.graph_def) def _load_log_message_from_event_file(event_file_path):
64
64
50
12
52
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_load_log_message_from_event_file
_load_log_message_from_event_file
129
134
129
129
36cea0053fe31aad192d62ac830e2db0baee216b
bigcode/the-stack
train
98a94797ed49edd019e8d57a
train
function
def _get_tensor_watch_key(node_name, output_slot, debug_op): """Get the string representation of a debug watch on a tensor. Args: node_name: Name of the node by which the watched tensor is produced, as a string. output_slot: Output slot index of the tensor, as an integer. debug_op: Name of the ...
def _get_tensor_watch_key(node_name, output_slot, debug_op):
"""Get the string representation of a debug watch on a tensor. Args: node_name: Name of the node by which the watched tensor is produced, as a string. output_slot: Output slot index of the tensor, as an integer. debug_op: Name of the debug op that is used to watch the tensor, as a strin...
as a string. output_slot: Output slot index of the tensor, as an integer. Returns: Name of the tensor, as a string. """ return "%s:%d" % (node_name, output_slot) def _get_tensor_watch_key(node_name, output_slot, debug_op):
64
64
139
15
49
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_get_tensor_watch_key
_get_tensor_watch_key
210
224
210
210
9fff5e96ecfe94ee877975f3df87692c14a06a1c
bigcode/the-stack
train
9a91bcee9d0c0061076fdf3c
train
class
class InconvertibleTensorProto(object): """Represents a TensorProto that cannot be converted to np.ndarray.""" def __init__(self, tensor_proto, initialized=True): """Constructor. Args: tensor_proto: the `TensorProto` object that cannot be represented as a `np.ndarray` object. initializ...
class InconvertibleTensorProto(object):
"""Represents a TensorProto that cannot be converted to np.ndarray.""" def __init__(self, tensor_proto, initialized=True): """Constructor. Args: tensor_proto: the `TensorProto` object that cannot be represented as a `np.ndarray` object. initialized: (`bool`) whether the Tensor is initi...
import gfile METADATA_FILE_PREFIX = "_tfdbg_" CORE_METADATA_TAG = "core_metadata_" GRAPH_FILE_TAG = "graph_" FETCHES_INFO_FILE_TAG = "fetches_info_" FEED_KEYS_INFO_FILE_TAG = "feed_keys_info_" class InconvertibleTensorProto(object):
64
64
148
8
55
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
InconvertibleTensorProto
InconvertibleTensorProto
42
63
42
42
89d36771ccb8dc1944258143ac7736b318daf544
bigcode/the-stack
train
80b97e8c889a51e8966f45a9
train
function
def parse_node_or_tensor_name(name): """Get the node name from a string that can be node or tensor name. Args: name: An input node name (e.g., "node_a") or tensor name (e.g., "node_a:0"), as a str. Returns: 1) The node name, as a str. If the input name is a tensor name, i.e., consists of a c...
def parse_node_or_tensor_name(name):
"""Get the node name from a string that can be node or tensor name. Args: name: An input node name (e.g., "node_a") or tensor name (e.g., "node_a:0"), as a str. Returns: 1) The node name, as a str. If the input name is a tensor name, i.e., consists of a colon, the final colon and the followi...
.FromString(event.graph_def) def _load_log_message_from_event_file(event_file_path): event = event_pb2.Event() with gfile.Open(event_file_path, "rb") as f: event.ParseFromString(f.read()) return event.log_message.message def parse_node_or_tensor_name(name):
64
64
200
8
55
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
parse_node_or_tensor_name
parse_node_or_tensor_name
137
158
137
137
cf5adaa39370400d235a78766e2dbf416e6a92a4
bigcode/the-stack
train
0e32cc3028b4f421fe199d90
train
function
def _get_tensor_name(node_name, output_slot): """Get tensor name given node name and output slot index. Args: node_name: Name of the node that outputs the tensor, as a string. output_slot: Output slot index of the tensor, as an integer. Returns: Name of the tensor, as a string. """ return "%s:%...
def _get_tensor_name(node_name, output_slot):
"""Get tensor name given node name and output slot index. Args: node_name: Name of the node that outputs the tensor, as a string. output_slot: Output slot index of the tensor, as an integer. Returns: Name of the tensor, as a string. """ return "%s:%d" % (node_name, output_slot)
assumed. Args: element_name: (`str`) name of the graph element in question. Returns: (`int`) output slot number. """ return int(element_name.split(":")[-1]) if ":" in element_name else 0 def _get_tensor_name(node_name, output_slot):
64
64
89
11
52
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
_get_tensor_name
_get_tensor_name
196
207
196
196
1401ea875ad7d549dba88ea7aaa54ece6344fa1e
bigcode/the-stack
train
5e636152d8354765790ead4c
train
function
def get_output_slot(element_name): """Get the output slot number from the name of a graph element. If element_name is a node name without output slot at the end, 0 will be assumed. Args: element_name: (`str`) name of the graph element in question. Returns: (`int`) output slot number. """ return...
def get_output_slot(element_name):
"""Get the output slot number from the name of a graph element. If element_name is a node name without output slot at the end, 0 will be assumed. Args: element_name: (`str`) name of the graph element in question. Returns: (`int`) output slot number. """ return int(element_name.split(":")[-1]) i...
_INFO_FILE_TAG def _is_run_feed_keys_info_file(file_name): return file_name == METADATA_FILE_PREFIX + FEED_KEYS_INFO_FILE_TAG def get_node_name(element_name): return element_name.split(":")[0] if ":" in element_name else element_name def get_output_slot(element_name):
64
64
96
7
56
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
get_output_slot
get_output_slot
181
193
181
181
21e2d1c94f24084ba06522c37da9acf99d2c96b2
bigcode/the-stack
train
6289fba7289db47f41245097
train
function
def load_tensor_from_event(event): """Load a tensor from an Event proto. Args: event: The Event proto, assumed to hold a tensor value in its summary.value[0] field. Returns: The tensor value loaded from the event file, as a `numpy.ndarray`, if representation of the tensor value by a `numpy.n...
def load_tensor_from_event(event):
"""Load a tensor from an Event proto. Args: event: The Event proto, assumed to hold a tensor value in its summary.value[0] field. Returns: The tensor value loaded from the event file, as a `numpy.ndarray`, if representation of the tensor value by a `numpy.ndarray` is possible. For uninit...
For Tensors of data types that cannot be converted to `numpy.ndarray` (e.g., `tf.resource`), return `None`. """ event = event_pb2.Event() with gfile.Open(event_file_path, "rb") as f: event.ParseFromString(f.read()) return load_tensor_from_event(event) def load_tensor_from_event(event):
80
80
269
7
73
xincao79/tensorflow
tensorflow/python/debug/lib/debug_data.py
Python
load_tensor_from_event
load_tensor_from_event
88
118
88
88
74718b0a661dd564f74304d51d5f8c2a0504797e
bigcode/the-stack
train
7a5ae75628a59185afe59cf9
train
function
def DecodeElf(data, location): """Decode an ELF file and return information about it Args: data: Data from ELF file location: Start address of data to return Returns: ElfInfo object containing information about the decoded ELF file """ file_size = len(data) with io.Byte...
def DecodeElf(data, location):
"""Decode an ELF file and return information about it Args: data: Data from ELF file location: Start address of data to return Returns: ElfInfo object containing information about the decoded ELF file """ file_size = len(data) with io.BytesIO(data) as fd: elf = ...
ss_start (OVERLAY) : { *(.bss) } } ''', file=fd) # -static: Avoid requiring any shared libraries # -nostdlib: Don't link with C library # -Wl,--build-id=none: Don't generate a build ID, so that we just get the # text section at the start # -m32: Build for 32-bit x86 # -T...: Speci...
172
172
575
7
165
clkbit123/TheOpenHarmony
Openharmony v1.0/vendor/hisi/hi35xx/third_party/uboot/tools/binman/elf.py
Python
DecodeElf
DecodeElf
243
302
243
243
46925af4d5ecf72707bb21cff1c94e36a4d5d075
bigcode/the-stack
train
8c67b71e70e48b5634feeabd
train
function
def MakeElf(elf_fname, text, data): """Make an elf file with the given data in a single section The output file has a several section including '.text' and '.data', containing the info provided in arguments. Args: elf_fname: Output filename text: Text (code) to put in the file's .text ...
def MakeElf(elf_fname, text, data):
"""Make an elf file with the given data in a single section The output file has a several section including '.text' and '.data', containing the info provided in arguments. Args: elf_fname: Output filename text: Text (code) to put in the file's .text section data: Data to put in...
x) but the contents ' 'size is %x' % (entry.GetPath(), offset, sym.size, entry.contents_size)) if sym.size == 4: pack_string = '<I' elif sym.size == 8: pack_string = '<Q' ...
221
222
740
11
211
clkbit123/TheOpenHarmony
Openharmony v1.0/vendor/hisi/hi35xx/third_party/uboot/tools/binman/elf.py
Python
MakeElf
MakeElf
147
241
147
147
14378f413945343bf4aa6ad26fc3544d4b499785
bigcode/the-stack
train
b605148c0a1ac655e49ec8c3
train
function
def LookupAndWriteSymbols(elf_fname, entry, section): """Replace all symbols in an entry with their correct values The entry contents is updated so that values for referenced symbols will be visible at run time. This is done by finding out the symbols offsets in the entry (using the ELF file) and repla...
def LookupAndWriteSymbols(elf_fname, entry, section):
"""Replace all symbols in an entry with their correct values The entry contents is updated so that values for referenced symbols will be visible at run time. This is done by finding out the symbols offsets in the entry (using the ELF file) and replacing them with values from binman's data structure...
dict by address return OrderedDict(sorted(syms.items(), key=lambda x: x[1].address)) def GetSymbolAddress(fname, sym_name): """Get a value of a symbol from an ELF file Args: fname: Filename of the ELF file to read patterns: List of regex patterns to search for, each a string Returns:...
142
142
474
13
128
clkbit123/TheOpenHarmony
Openharmony v1.0/vendor/hisi/hi35xx/third_party/uboot/tools/binman/elf.py
Python
LookupAndWriteSymbols
LookupAndWriteSymbols
98
145
98
98
8f7daf5b3415d2f6eeb052812ab136764c8f96f8
bigcode/the-stack
train
03f1f9bbe452ef93580cc45a
train
function
def GetSymbols(fname, patterns): """Get the symbols from an ELF file Args: fname: Filename of the ELF file to read patterns: List of regex patterns to search for, each a string Returns: None, if the file does not exist, or Dict: key: Name of symbol value: Hex va...
def GetSymbols(fname, patterns):
"""Get the symbols from an ELF file Args: fname: Filename of the ELF file to read patterns: List of regex patterns to search for, each a string Returns: None, if the file does not exist, or Dict: key: Name of symbol value: Hex value of symbol """ stdout ...
weak']) # Information about an ELF file: # data: Extracted program contents of ELF file (this would be loaded by an # ELF loader when reading this file # load: Load address of code # entry: Entry address of code # memsize: Number of bytes in memory occupied by loading this ELF file ElfInfo = name...
101
102
343
7
94
clkbit123/TheOpenHarmony
Openharmony v1.0/vendor/hisi/hi35xx/third_party/uboot/tools/binman/elf.py
Python
GetSymbols
GetSymbols
40
80
40
40
dfd90dd156de4a51ac16fa08e941cb9ba3329349
bigcode/the-stack
train
e21148cb4ede054b898e0cb6
train
function
def GetSymbolAddress(fname, sym_name): """Get a value of a symbol from an ELF file Args: fname: Filename of the ELF file to read patterns: List of regex patterns to search for, each a string Returns: Symbol value (as an integer) or None if not found """ syms = GetSymbols(fn...
def GetSymbolAddress(fname, sym_name):
"""Get a value of a symbol from an ELF file Args: fname: Filename of the ELF file to read patterns: List of regex patterns to search for, each a string Returns: Symbol value (as an integer) or None if not found """ syms = GetSymbols(fname, [sym_name]) sym = syms.get(sym...
syms[name] = Symbol(section, int(value, 16), int(size,16), flags[1] == 'w') # Sort dict by address return OrderedDict(sorted(syms.items(), key=lambda x: x[1].address)) def GetSymbolAddress(fname, sym_name):
64
64
105
9
55
clkbit123/TheOpenHarmony
Openharmony v1.0/vendor/hisi/hi35xx/third_party/uboot/tools/binman/elf.py
Python
GetSymbolAddress
GetSymbolAddress
82
96
82
82
76ed0cdd42bc035e5ed9c6181f547879ef473df7
bigcode/the-stack
train
1c72ea1acc13f11a4393b63e
train
function
def get_naked_class(cls: type) -> type: # Python3.5: typing classes have __extra__ # Python3.6: typing classes have __extra__ # Python3.7: typing classes have __origin__ # Return the non-generic class (e.g. dict) of a generic type (e.g. Dict). attr = '__origin__' if sys.version_info[1] in ...
def get_naked_class(cls: type) -> type: # Python3.5: typing classes have __extra__ # Python3.6: typing classes have __extra__ # Python3.7: typing classes have __origin__ # Return the non-generic class (e.g. dict) of a generic type (e.g. Dict).
attr = '__origin__' if sys.version_info[1] in (5, 6): attr = '__extra__' return getattr(cls, attr, cls)
def get_naked_class(cls: type) -> type: # Python3.5: typing classes have __extra__ # Python3.6: typing classes have __extra__ # Python3.7: typing classes have __origin__ # Return the non-generic class (e.g. dict) of a generic type (e.g. Dict).
75
64
113
75
0
SmmServer/python-3.7.5-embed-win32
Lib/jsons/_compatibility_impl.py
Python
get_naked_class
get_naked_class
55
63
55
59
3fc2f251efbaf7eeb1e803d289215819157b57c6
bigcode/the-stack
train
a7442fb784e973307169770f
train
function
def get_type_hints(func: callable): # Python3.5: get_type_hints raises on classes without explicit constructor try: result = typing.get_type_hints(func) except AttributeError: result = {} return result
def get_type_hints(func: callable): # Python3.5: get_type_hints raises on classes without explicit constructor
try: result = typing.get_type_hints(func) except AttributeError: result = {} return result
attr = '__origin__' if sys.version_info[1] in (5, 6): attr = '__extra__' return getattr(cls, attr, cls) def get_type_hints(func: callable): # Python3.5: get_type_hints raises on classes without explicit constructor
64
64
53
27
37
SmmServer/python-3.7.5-embed-win32
Lib/jsons/_compatibility_impl.py
Python
get_type_hints
get_type_hints
66
72
66
67
8a33143935ecf2e6a1a335cc3af6746210e313df
bigcode/the-stack
train
2efe50bf14f84b85a7400028
train
class
class Flag(Enum): """ This is a light version of the Flag enum type that was introduced in Python3.6. It supports the use of pipes for members (Flag.A | Flag.B). """ @classmethod def _get_inst(cls, value): try: result = cls(value) except ValueError: ...
class Flag(Enum):
""" This is a light version of the Flag enum type that was introduced in Python3.6. It supports the use of pipes for members (Flag.A | Flag.B). """ @classmethod def _get_inst(cls, value): try: result = cls(value) except ValueError: pseudo_member...
""" PRIVATE MODULE: do not import (from) it directly. This module contains functionality for supporting the compatibility of jsons with multiple Python versions. """ import sys import typing from enum import Enum class Flag(Enum):
46
64
200
4
41
SmmServer/python-3.7.5-embed-win32
Lib/jsons/_compatibility_impl.py
Python
Flag
Flag
12
37
12
12
6bf4ce927b746b9f29723630ed8ce2f74da22a49
bigcode/the-stack
train
681be7eec8043082c4919ae0
train
function
def tuple_with_ellipsis(tup: type) -> bool: # Python3.5: Tuples have __tuple_use_ellipsis__ # Python3.7: Tuples have __args__ use_el = getattr(tup, '__tuple_use_ellipsis__', None) if use_el is None: use_el = tup.__args__[-1] is ... return use_el
def tuple_with_ellipsis(tup: type) -> bool: # Python3.5: Tuples have __tuple_use_ellipsis__ # Python3.7: Tuples have __args__
use_el = getattr(tup, '__tuple_use_ellipsis__', None) if use_el is None: use_el = tup.__args__[-1] is ... return use_el
bool: return item.value == self.value & item.value __ror__ = __or__ def tuple_with_ellipsis(tup: type) -> bool: # Python3.5: Tuples have __tuple_use_ellipsis__ # Python3.7: Tuples have __args__
63
64
84
42
21
SmmServer/python-3.7.5-embed-win32
Lib/jsons/_compatibility_impl.py
Python
tuple_with_ellipsis
tuple_with_ellipsis
40
46
40
42
68f4508344bc9d924078914878872971029a3df8
bigcode/the-stack
train
5b13090cb734265b9fd12c39
train
function
def get_union_params(un: type) -> list: # Python3.5: Unions have __union_params__ # Python3.7: Unions have __args__ return getattr(un, '__union_params__', getattr(un, '__args__', None))
def get_union_params(un: type) -> list: # Python3.5: Unions have __union_params__ # Python3.7: Unions have __args__
return getattr(un, '__union_params__', getattr(un, '__args__', None))
) if use_el is None: use_el = tup.__args__[-1] is ... return use_el def get_union_params(un: type) -> list: # Python3.5: Unions have __union_params__ # Python3.7: Unions have __args__
64
64
57
38
25
SmmServer/python-3.7.5-embed-win32
Lib/jsons/_compatibility_impl.py
Python
get_union_params
get_union_params
49
52
49
51
1900523be1cf5334dd82e2445827f4a4dfb8977f
bigcode/the-stack
train
4e4d3ee957e8b219d52ec660
train
class
class Grammar: """ Defines Storyscript's grammar using the Ebnf module, producing the complete EBNF grammar for it. """ def __init__(self): self.ebnf = Ebnf() def macros(self): """ Define the macros """ collection = '{} (nl indent)? ({} (comma nl? {})*)...
class Grammar:
""" Defines Storyscript's grammar using the Ebnf module, producing the complete EBNF grammar for it. """ def __init__(self): self.ebnf = Ebnf() def macros(self): """ Define the macros """ collection = '{} (nl indent)? ({} (comma nl? {})*)? (nl dedent)? {...
# -*- coding: utf-8 -*- from .Ebnf import Ebnf class Grammar:
21
256
2,954
3
17
jayvdb/storyscript
storyscript/parser/Grammar.py
Python
Grammar
Grammar
5
292
5
6
dc9127fb4230898d4bee4d39215978b660f03f02
bigcode/the-stack
train
98c2152ab2d0c7a6c97704a7
train
function
def update_plot(attrname, old, new): city = city_select.value plot.title.text = "Weather data for " + cities[city]['title'] src = get_dataset(df, cities[city]['airport'], distribution_select.value) source.data.update(src.data)
def update_plot(attrname, old, new):
city = city_select.value plot.title.text = "Weather data for " + cities[city]['title'] src = get_dataset(df, cities[city]['airport'], distribution_select.value) source.data.update(src.data)
.yaxis.axis_label = "Temperature (F)" plot.axis.axis_label_text_font_style = "bold" plot.x_range = DataRange1d(range_padding=0.0) plot.grid.grid_line_alpha = 0.3 return plot def update_plot(attrname, old, new):
64
64
58
10
53
Navdit/gatlingScenarioGraphs
sandpit/callbacks/test.py
Python
update_plot
update_plot
51
56
51
51
601c436cec11d73e98fc2d30be9296d4056034f4
bigcode/the-stack
train
2950f78f507cb7db3b2a0270
train
function
def make_plot(source, title): plot = figure(x_axis_type="datetime", plot_width=800, tools="", toolbar_location=None) plot.title.text = title plot.quad(top='record_max_temp', bottom='record_min_temp', left='left', right='right', color=Blues4[2], source=source, legend="Record") plot.quad(to...
def make_plot(source, title):
plot = figure(x_axis_type="datetime", plot_width=800, tools="", toolbar_location=None) plot.title.text = title plot.quad(top='record_max_temp', bottom='record_min_temp', left='left', right='right', color=Blues4[2], source=source, legend="Record") plot.quad(top='average_max_temp', bottom='...
df = df.set_index(['date']) df.sort_index(inplace=True) if distribution == 'Smoothed': window, order = 51, 3 for key in STATISTICS: df[key] = savgol_filter(df[key], window, order) return ColumnDataSource(data=df) def make_plot(source, title):
71
71
239
7
64
Navdit/gatlingScenarioGraphs
sandpit/callbacks/test.py
Python
make_plot
make_plot
31
49
31
31
87df77552c303545f92f862adab3188daa8b023a
bigcode/the-stack
train
d1aa367db0e76baa525b1a92
train
function
def get_dataset(src, name, distribution): df = src[src.airport == name].copy() del df['airport'] df['date'] = pd.to_datetime(df.date) # timedelta here instead of pd.DateOffset to avoid pandas bug < 0.18 (Pandas issue #11925) df['left'] = df.date - datetime.timedelta(days=0.5) df['right'] = df.da...
def get_dataset(src, name, distribution):
df = src[src.airport == name].copy() del df['airport'] df['date'] = pd.to_datetime(df.date) # timedelta here instead of pd.DateOffset to avoid pandas bug < 0.18 (Pandas issue #11925) df['left'] = df.date - datetime.timedelta(days=0.5) df['right'] = df.date + datetime.timedelta(days=0.5) df =...
d, Select from bokeh.palettes import Blues4 from bokeh.plotting import figure STATISTICS = ['record_min_temp', 'actual_min_temp', 'average_min_temp', 'average_max_temp', 'actual_max_temp', 'record_max_temp'] def get_dataset(src, name, distribution):
64
64
164
9
55
Navdit/gatlingScenarioGraphs
sandpit/callbacks/test.py
Python
get_dataset
get_dataset
15
29
15
15
ade492c6d71c54c3aacefe25f5ee44a4acac9062
bigcode/the-stack
train
3e55c0bd757ce229b0b26bff
train
class
class OpenDayLightDriver(driver.Driver): """Driver of network info collector from OpenDaylight. This driver uses resources in "pipeline.yaml". Resource requires below conditions: * resource is url * scheme is "opendaylight" This driver can be configured via query parameters. Supported par...
class OpenDayLightDriver(driver.Driver):
"""Driver of network info collector from OpenDaylight. This driver uses resources in "pipeline.yaml". Resource requires below conditions: * resource is url * scheme is "opendaylight" This driver can be configured via query parameters. Supported parameters: * scheme: The scheme ...
at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language gover...
256
256
3,243
8
247
cristifalcas/ceilometer
ceilometer/network/statistics/opendaylight/driver.py
Python
OpenDayLightDriver
OpenDayLightDriver
46
467
46
46
e22fd9f2e46159b23c482d6c5356e3b58281510a
bigcode/the-stack
train
c2bbe20a7cf4efb61c2b0158
train
function
def _get_properties(properties, prefix='properties'): resource_meta = {} if properties is not None: for k, v in six.iteritems(properties): value = v['value'] key = prefix + '_' + k if 'name' in v: key += '_' + v['name'] resource_meta[key] =...
def _get_properties(properties, prefix='properties'):
resource_meta = {} if properties is not None: for k, v in six.iteritems(properties): value = v['value'] key = prefix + '_' + k if 'name' in v: key += '_' + v['name'] resource_meta[key] = value return resource_meta
under the License. from oslo_log import log import six from six import moves from six.moves.urllib import parse as urlparse from ceilometer.network.statistics import driver from ceilometer.network.statistics.opendaylight import client LOG = log.getLogger(__name__) def _get_properties(properties, prefix='properties...
64
64
78
10
54
cristifalcas/ceilometer
ceilometer/network/statistics/opendaylight/driver.py
Python
_get_properties
_get_properties
28
37
28
28
64567dfee3a5acc0eef46cecfed97004b1cd096e
bigcode/the-stack
train
186f8fd360a68fb66351f4aa
train
function
def _get_int_sample(key, statistic, resource_id, resource_meta): if key not in statistic: return None return int(statistic[key]), resource_id, resource_meta
def _get_int_sample(key, statistic, resource_id, resource_meta):
if key not in statistic: return None return int(statistic[key]), resource_id, resource_meta
.iteritems(properties): value = v['value'] key = prefix + '_' + k if 'name' in v: key += '_' + v['name'] resource_meta[key] = value return resource_meta def _get_int_sample(key, statistic, resource_id, resource_meta):
64
64
39
15
48
cristifalcas/ceilometer
ceilometer/network/statistics/opendaylight/driver.py
Python
_get_int_sample
_get_int_sample
40
43
40
40
837fb43093dad1a2164ff7d21e1a225b879e2eb6
bigcode/the-stack
train
600aaa64a8e5ce53dfd4d32e
train
function
def Const(x): return lambda g_data, args: x
def Const(x):
return lambda g_data, args: x
def joinit(delimiter, iterable): it = iter(iterable) yield next(it) for x in it: yield delimiter yield x def FormatResponse(tweet,response): return '@' + tweet.GetUser().GetScreenName() + ": " + response def Const(x):
64
64
14
4
59
jvictor0/TiaraBoom
tiara/util.py
Python
Const
Const
115
116
115
115
def61706aaa5004536cd9f55349e45040119eb77
bigcode/the-stack
train
65cda6d882ad1267f2e20f1e
train
function
def Indentation(): return ' ' * len(inspect.stack())
def Indentation():
return ' ' * len(inspect.stack())
from bisect import bisect_left import logging import sys import inspect import traceback import datetime def Indentation():
27
64
14
4
22
jvictor0/TiaraBoom
tiara/util.py
Python
Indentation
Indentation
9
10
9
9
b10730c61f15845dd243ccadc4adac8c959452c8
bigcode/the-stack
train
eb19bd3d70d0cbe87e6c39c2
train
function
def Median(nums): return sorted(nums)[len(nums)/2]
def Median(nums):
return sorted(nums)[len(nums)/2]
(d.iteritems())) def ListInsert(dict, k, v): if k not in dict: dict[k] = [v] else: dict[k].append(v) def NotNone(arg1, arg2): return arg1 if not arg1 is None else arg2 def Median(nums):
64
64
14
4
59
jvictor0/TiaraBoom
tiara/util.py
Python
Median
Median
53
54
53
53
8255b74b9fa5ba9d83fced8e56565f85a88d9635
bigcode/the-stack
train
cb57bbaf2954c751bf0d19a2
train
function
def Int(x): if x is None: return None return int(x)
def Int(x):
if x is None: return None return int(x)
Y-%m-%d %H:%M:%S") def OlderThan(ts,days): return (ts.now() - ts) > datetime.timedelta(days,0,0) def Decay(x): return max(0,3 - 0.5**(x-2)) def Int(x):
64
64
19
4
60
jvictor0/TiaraBoom
tiara/util.py
Python
Int
Int
165
168
165
165
0ee964940555dfd607ec9ce621d2f6e4a5de9b91
bigcode/the-stack
train
c99f890c80ec95e77403fe65
train
function
def LKDT(d,a): return LKD(d,a,True)
def LKDT(d,a):
return LKD(d,a,True)
(LKD(d,a,r)) except Exception: return r def LKDB(d,a,r): try: if str(LKD(d,a,r)).lower() == str(r).lower(): return r return not r except Exception: return r def LKDT(d,a):
64
64
15
6
57
jvictor0/TiaraBoom
tiara/util.py
Python
LKDT
LKDT
90
91
90
90
fb19fb51b5ca7a43caaa0b6883a683eee0d1a2aa
bigcode/the-stack
train
91127cd96895462181c06bc2
train
function
def NotNone(arg1, arg2): return arg1 if not arg1 is None else arg2
def NotNone(arg1, arg2):
return arg1 if not arg1 is None else arg2
][1] return None def DictToSortedTuple(d): return tuple(sorted(d.iteritems())) def ListInsert(dict, k, v): if k not in dict: dict[k] = [v] else: dict[k].append(v) def NotNone(arg1, arg2):
64
64
23
9
55
jvictor0/TiaraBoom
tiara/util.py
Python
NotNone
NotNone
50
51
50
50
997a8d886b1dacaef5a821645054f1a98da10ba1
bigcode/the-stack
train
e71474ee4c426cb4b93c3d2b
train
function
def MySQLTimestampToTwitter(msts): if msts == "0000-00-00 00:00:00": return None ts = MySQLTimestampToPython(msts) dow = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"][ts.weekday()] mon = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][ts.month-1] def pad(a)...
def MySQLTimestampToTwitter(msts):
if msts == "0000-00-00 00:00:00": return None ts = MySQLTimestampToPython(msts) dow = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"][ts.weekday()] mon = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][ts.month-1] def pad(a): if len(a) == 1: ...
[2] time = ts[3] assert ts[4] == "+0000", ts year = ts[5] return "%s-%s-%s %s" % (year,mon,day,time) # looks like 2008-09-15 00:15:03 def MySQLTimestampToTwitter(msts):
76
76
256
9
66
jvictor0/TiaraBoom
tiara/util.py
Python
MySQLTimestampToTwitter
MySQLTimestampToTwitter
136
154
136
136
6e5cfd0148adac8d82d7bc131bc99c8cec8c7095
bigcode/the-stack
train
1c3c6715aa8e550c9662c9ea
train
function
def Decay(x): return max(0,3 - 0.5**(x-2))
def Decay(x):
return max(0,3 - 0.5**(x-2))
(result)) return result def MySQLTimestampToPython(ts): return datetime.datetime.strptime(ts, "%Y-%m-%d %H:%M:%S") def OlderThan(ts,days): return (ts.now() - ts) > datetime.timedelta(days,0,0) def Decay(x):
64
64
23
5
59
jvictor0/TiaraBoom
tiara/util.py
Python
Decay
Decay
162
163
162
162
ed5ed6de98bb18f225c6d831b4e5cd6b7d345b71
bigcode/the-stack
train
bab444f25b89af7e7a07fea8
train
function
def LKDB(d,a,r): try: if str(LKD(d,a,r)).lower() == str(r).lower(): return r return not r except Exception: return r
def LKDB(d,a,r):
try: if str(LKD(d,a,r)).lower() == str(r).lower(): return r return not r except Exception: return r
.FamilyLookup(word) if t == form] def LKD(d,a,r=None): return d[a] if a in d else r def LKDI(d,a,r): try: return int(LKD(d,a,r)) except Exception: return r def LKDB(d,a,r):
64
64
44
7
56
jvictor0/TiaraBoom
tiara/util.py
Python
LKDB
LKDB
82
88
82
82
4d36641441a8c0f8e0014b24d0927261c2e85252
bigcode/the-stack
train
a0acbf2fb6be9b689a51483d
train
function
def joinit(delimiter, iterable): it = iter(iterable) yield next(it) for x in it: yield delimiter yield x
def joinit(delimiter, iterable):
it = iter(iterable) yield next(it) for x in it: yield delimiter yield x
KD(d,a,0) def LKDS(d,a): return LKD(d,a,"") def LKDL(d,a): return LKD(d,a,[]) def SKD(a,d,r): if not a in d: d[a] = r def joinit(delimiter, iterable):
64
64
34
8
55
jvictor0/TiaraBoom
tiara/util.py
Python
joinit
joinit
105
110
105
105
bb3aee0cc0be93a710e64b3d6978f01908e38c79
bigcode/the-stack
train
0873a2b6ccce2e281f377859
train
function
def TwitterTimestampToMySQL(ts): ts = ts.split() assert ts[0] in ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"], ts mon = str(1 + ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].index(ts[1])) if len(mon) == 1: mon = "0" + mon day = ts[2] time = ts[3] ...
def TwitterTimestampToMySQL(ts):
ts = ts.split() assert ts[0] in ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"], ts mon = str(1 + ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"].index(ts[1])) if len(mon) == 1: mon = "0" + mon day = ts[2] time = ts[3] assert ts[4] == "+0000", ts ...
= Const(True) def GetURL(status): return "https://twitter.com/%s/status/%d" % (status.GetUser().GetScreenName(), status.GetId()) # looks like Fri Jan 02 03:14:31 +0000 2015 def TwitterTimestampToMySQL(ts):
64
64
158
8
55
jvictor0/TiaraBoom
tiara/util.py
Python
TwitterTimestampToMySQL
TwitterTimestampToMySQL
123
133
123
123
8a0ed0446bd8c02fb774583cc479ba214f9d320d
bigcode/the-stack
train
e0e75698be016f1579703644
train
function
def FormatResponse(tweet,response): return '@' + tweet.GetUser().GetScreenName() + ": " + response
def FormatResponse(tweet,response):
return '@' + tweet.GetUser().GetScreenName() + ": " + response
,[]) def SKD(a,d,r): if not a in d: d[a] = r def joinit(delimiter, iterable): it = iter(iterable) yield next(it) for x in it: yield delimiter yield x def FormatResponse(tweet,response):
64
64
25
6
57
jvictor0/TiaraBoom
tiara/util.py
Python
FormatResponse
FormatResponse
112
113
112
112
3cbeb3eb16aeff45fc744fd5a6bb585a7cad71e8
bigcode/the-stack
train
c54b5988c61d91bdcbf2d986
train
function
def exceptionTrace(exctype, value, tb): logger = logging.getLogger('TiaraBoom') logger.error('I seem to have crashed with an exception') logger.error('Type: %s' % str(exctype)) logger.error('Value: %s' % str(value)) logger.error('Traceback:\n%s' % "".join(traceback.format_tb(tb)))
def exceptionTrace(exctype, value, tb):
logger = logging.getLogger('TiaraBoom') logger.error('I seem to have crashed with an exception') logger.error('Type: %s' % str(exctype)) logger.error('Value: %s' % str(value)) logger.error('Traceback:\n%s' % "".join(traceback.format_tb(tb)))
def Median(nums): return sorted(nums)[len(nums)/2] def Differences(nums): nums = sorted(nums) result = [] for i in xrange(len(nums)-1): result.append(nums[i+1] - nums[i]) return result def exceptionTrace(exctype, value, tb):
64
64
81
10
53
jvictor0/TiaraBoom
tiara/util.py
Python
exceptionTrace
exceptionTrace
63
69
63
63
c3e599a45e9341480269c36195a4a0f0180db41f
bigcode/the-stack
train
e495b7954a5119c31b142526
train
function
def log_assert(bool_, message, g_data): try: assert bool_, message except AssertionError: # construct an exception message from the code of the calling frame last_stackframe = inspect.stack()[-2] source_file, line_no, func = last_stackframe[1:4] source = "Traceback (most ...
def log_assert(bool_, message, g_data):
try: assert bool_, message except AssertionError: # construct an exception message from the code of the calling frame last_stackframe = inspect.stack()[-2] source_file, line_no, func = last_stackframe[1:4] source = "Traceback (most recent call last):\n" + \ ' ...
from bisect import bisect_left import logging import sys import inspect import traceback import datetime def Indentation(): return ' ' * len(inspect.stack()) # puts traceback into the log def log_assert(bool_, message, g_data):
54
64
171
10
43
jvictor0/TiaraBoom
tiara/util.py
Python
log_assert
log_assert
13
25
13
13
47c517d6d0f8c75a29436f9f51a8c29309e5367f
bigcode/the-stack
train
354aee90788392565b4abb2f
train
function
def ListInsert(dict, k, v): if k not in dict: dict[k] = [v] else: dict[k].append(v)
def ListInsert(dict, k, v):
if k not in dict: dict[k] = [v] else: dict[k].append(v)
] == key: return l[pos][1] if pos != 0 and l[pos-1][0] == key: return l[pos-1][1] return None def DictToSortedTuple(d): return tuple(sorted(d.iteritems())) def ListInsert(dict, k, v):
64
64
34
9
55
jvictor0/TiaraBoom
tiara/util.py
Python
ListInsert
ListInsert
44
48
44
44
6c7349c01c4559b417c361efd86c7fd1693d69be
bigcode/the-stack
train
91b6394d82e39c1c6a3c4518
train
function
def DictToSortedTuple(d): return tuple(sorted(d.iteritems()))
def DictToSortedTuple(d):
return tuple(sorted(d.iteritems()))
index: return pos if pos != hi and l[pos][0] == key: return l[pos][1] if pos != 0 and l[pos-1][0] == key: return l[pos-1][1] return None def DictToSortedTuple(d):
64
64
14
7
56
jvictor0/TiaraBoom
tiara/util.py
Python
DictToSortedTuple
DictToSortedTuple
41
42
41
41
1c9559846988c0a94a60d87e8f85ab20b9b174fa
bigcode/the-stack
train
ee667662e52dc287c63cf71c
train
function
def MySQLTimestampToPython(ts): return datetime.datetime.strptime(ts, "%Y-%m-%d %H:%M:%S")
def MySQLTimestampToPython(ts):
return datetime.datetime.strptime(ts, "%Y-%m-%d %H:%M:%S")
s:%s:%s +0000 %s" % (dow,mon,day,hour,minute,second,year) assert TwitterTimestampToMySQL(result) == msts, (result,msts,TwitterTimestampToMySQL(result)) return result def MySQLTimestampToPython(ts):
64
64
28
8
55
jvictor0/TiaraBoom
tiara/util.py
Python
MySQLTimestampToPython
MySQLTimestampToPython
156
157
156
156
f993d01abc2c94fc5158e5159199cdde2ee151f4
bigcode/the-stack
train
1e810f42f2c68a65d71735eb
train
function
def LKD0(d,a): return LKD(d,a,0)
def LKD0(d,a):
return LKD(d,a,0)
,r)).lower() == str(r).lower(): return r return not r except Exception: return r def LKDT(d,a): return LKD(d,a,True) def LKDF(d,a): return LKD(d,a,True) def LKD0(d,a):
64
64
16
7
57
jvictor0/TiaraBoom
tiara/util.py
Python
LKD0
LKD0
94
95
94
94
f33e28f7e7f16a8072353e9d917b6c682822f204
bigcode/the-stack
train
b3465de515363fc0d65a852c
train
function
def LKDL(d,a): return LKD(d,a,[])
def LKDL(d,a):
return LKD(d,a,[])
DT(d,a): return LKD(d,a,True) def LKDF(d,a): return LKD(d,a,True) def LKD0(d,a): return LKD(d,a,0) def LKDS(d,a): return LKD(d,a,"") def LKDL(d,a):
64
64
14
6
58
jvictor0/TiaraBoom
tiara/util.py
Python
LKDL
LKDL
98
99
98
98
ef233fcbb55da90dee347f57c9f5f68c967f1416
bigcode/the-stack
train
d2800881a7396b60138957ba
train
function
def LKDF(d,a): return LKD(d,a,True)
def LKDF(d,a):
return LKD(d,a,True)
LKDB(d,a,r): try: if str(LKD(d,a,r)).lower() == str(r).lower(): return r return not r except Exception: return r def LKDT(d,a): return LKD(d,a,True) def LKDF(d,a):
64
64
15
6
58
jvictor0/TiaraBoom
tiara/util.py
Python
LKDF
LKDF
92
93
92
92
bf8a8de9365b738284984b15fb88397194561688
bigcode/the-stack
train
abef36b905b0ddcb5efb40b6
train
function
def LKDS(d,a): return LKD(d,a,"")
def LKDS(d,a):
return LKD(d,a,"")
return not r except Exception: return r def LKDT(d,a): return LKD(d,a,True) def LKDF(d,a): return LKD(d,a,True) def LKD0(d,a): return LKD(d,a,0) def LKDS(d,a):
64
64
14
6
58
jvictor0/TiaraBoom
tiara/util.py
Python
LKDS
LKDS
96
97
96
96
ca52fdb4fed03727dca9f136c61fd9161993e072
bigcode/the-stack
train
145cb43a0806ae979e516901
train
function
def LKD(d,a,r=None): return d[a] if a in d else r
def LKD(d,a,r=None):
return d[a] if a in d else r
% str(value)) logger.error('Traceback:\n%s' % "".join(traceback.format_tb(tb))) def ToWordForm(g_data,word,form): return [w for w, t in g_data.FamilyLookup(word) if t == form] def LKD(d,a,r=None):
64
64
20
8
56
jvictor0/TiaraBoom
tiara/util.py
Python
LKD
LKD
75
76
75
75
ae83e48d9aed1d3239c7c8f8c7ea19d6c9e26216
bigcode/the-stack
train
3f3a124402e356291c28e67a
train
function
def BinarySearch(l, key, index = False): hi = len(l) lo = 0 pos = bisect_left(l,(key,None),lo,hi) if index: return pos if pos != hi and l[pos][0] == key: return l[pos][1] if pos != 0 and l[pos-1][0] == key: return l[pos-1][1] return None
def BinarySearch(l, key, index = False):
hi = len(l) lo = 0 pos = bisect_left(l,(key,None),lo,hi) if index: return pos if pos != hi and l[pos][0] == key: return l[pos][1] if pos != 0 and l[pos-1][0] == key: return l[pos-1][1] return None
- 3:line_no + 1]) g_data.TraceError("%s\n%s" % (message, source)) raise AssertionError("%s\n%s" % (message, source)) # does binary search in a sorted alist # def BinarySearch(l, key, index = False):
64
64
98
12
52
jvictor0/TiaraBoom
tiara/util.py
Python
BinarySearch
BinarySearch
29
39
29
29
8de9cda72381cbf382fdff04fbf64ceb05a19679
bigcode/the-stack
train
e3b414517c76803518ef456e
train
function
def SKD(a,d,r): if not a in d: d[a] = r
def SKD(a,d,r):
if not a in d: d[a] = r
(d,a): return LKD(d,a,True) def LKD0(d,a): return LKD(d,a,0) def LKDS(d,a): return LKD(d,a,"") def LKDL(d,a): return LKD(d,a,[]) def SKD(a,d,r):
63
64
21
7
56
jvictor0/TiaraBoom
tiara/util.py
Python
SKD
SKD
101
103
101
101
d0db39dd43e742c31882c7c679f80dfb8b071044
bigcode/the-stack
train
0dbf946c84a404b711d28f4c
train
function
def Differences(nums): nums = sorted(nums) result = [] for i in xrange(len(nums)-1): result.append(nums[i+1] - nums[i]) return result
def Differences(nums):
nums = sorted(nums) result = [] for i in xrange(len(nums)-1): result.append(nums[i+1] - nums[i]) return result
k not in dict: dict[k] = [v] else: dict[k].append(v) def NotNone(arg1, arg2): return arg1 if not arg1 is None else arg2 def Median(nums): return sorted(nums)[len(nums)/2] def Differences(nums):
64
64
40
4
60
jvictor0/TiaraBoom
tiara/util.py
Python
Differences
Differences
56
61
56
56
beb11c8e52c2d4ef7765fcb09e6db3ca7a60b067
bigcode/the-stack
train
fb533401fed1b3a8f0d2a063
train
function
def TupleToImageURL(imid, hsh): if str(imid) == "0": return "https://abs.twimg.com/sticky/default_profile_images/default_profile_2_normal.png" return "https://pbs.twimg.com/profile_images/" + str(imid) + "/" + hsh + "_normal.jpg"
def TupleToImageURL(imid, hsh):
if str(imid) == "0": return "https://abs.twimg.com/sticky/default_profile_images/default_profile_2_normal.png" return "https://pbs.twimg.com/profile_images/" + str(imid) + "/" + hsh + "_normal.jpg"
_images/"):] url = url.split("/") assert len(url) == 2, url assert url[1].endswith("_normal.jpg"), url return int(url[0]), url[1][:-len("_normal.jpg")] def TupleToImageURL(imid, hsh):
63
64
67
11
52
jvictor0/TiaraBoom
tiara/util.py
Python
TupleToImageURL
TupleToImageURL
178
181
178
178
a781c843e14f94b1aeac5f5a0c85222a2f81c4bb
bigcode/the-stack
train
5da7c3f74a329e1feae192ad
train
function
def GetURL(status): return "https://twitter.com/%s/status/%d" % (status.GetUser().GetScreenName(), status.GetId())
def GetURL(status):
return "https://twitter.com/%s/status/%d" % (status.GetUser().GetScreenName(), status.GetId())
for x in it: yield delimiter yield x def FormatResponse(tweet,response): return '@' + tweet.GetUser().GetScreenName() + ": " + response def Const(x): return lambda g_data, args: x ConstTrue = Const(True) def GetURL(status):
64
64
32
5
59
jvictor0/TiaraBoom
tiara/util.py
Python
GetURL
GetURL
119
120
119
119
3fdff769d82a5e5254f615360124bdcddab98d28
bigcode/the-stack
train
3cfa7a2ec01bb39210ac3abf
train
function
def ToWordForm(g_data,word,form): return [w for w, t in g_data.FamilyLookup(word) if t == form]
def ToWordForm(g_data,word,form):
return [w for w, t in g_data.FamilyLookup(word) if t == form]
have crashed with an exception') logger.error('Type: %s' % str(exctype)) logger.error('Value: %s' % str(value)) logger.error('Traceback:\n%s' % "".join(traceback.format_tb(tb))) def ToWordForm(g_data,word,form):
63
64
32
11
52
jvictor0/TiaraBoom
tiara/util.py
Python
ToWordForm
ToWordForm
72
73
72
72
d2169929bdf797b26720a0f229e39cc334c71aa9
bigcode/the-stack
train
a2f2f544f7ad23b2ea953179
train
function
def LKDI(d,a,r): try: return int(LKD(d,a,r)) except Exception: return r
def LKDI(d,a,r):
try: return int(LKD(d,a,r)) except Exception: return r
.format_tb(tb))) def ToWordForm(g_data,word,form): return [w for w, t in g_data.FamilyLookup(word) if t == form] def LKD(d,a,r=None): return d[a] if a in d else r def LKDI(d,a,r):
64
64
27
7
56
jvictor0/TiaraBoom
tiara/util.py
Python
LKDI
LKDI
77
81
77
77
7d5046e649bc14779379de9f0a1fdc8ac6b0dfd9
bigcode/the-stack
train
19a673e94e7c93560fa6d9fa
train
function
def ImageURLToTuple(url): assert url.startswith("https://pbs.twimg.com/profile_images/"), url url = url[len("https://pbs.twimg.com/profile_images/"):] url = url.split("/") assert len(url) == 2, url assert url[1].endswith("_normal.jpg"), url return int(url[0]), url[1][:-len("_normal.jpg")]
def ImageURLToTuple(url):
assert url.startswith("https://pbs.twimg.com/profile_images/"), url url = url[len("https://pbs.twimg.com/profile_images/"):] url = url.split("/") assert len(url) == 2, url assert url[1].endswith("_normal.jpg"), url return int(url[0]), url[1][:-len("_normal.jpg")]
ts.now() - ts) > datetime.timedelta(days,0,0) def Decay(x): return max(0,3 - 0.5**(x-2)) def Int(x): if x is None: return None return int(x) def ImageURLToTuple(url):
64
64
87
7
57
jvictor0/TiaraBoom
tiara/util.py
Python
ImageURLToTuple
ImageURLToTuple
170
176
170
170
e9fd18f5cc373d872490fc30938de2f5fb056086
bigcode/the-stack
train
d1a088025d053a9cd24a99ba
train
function
def OlderThan(ts,days): return (ts.now() - ts) > datetime.timedelta(days,0,0)
def OlderThan(ts,days):
return (ts.now() - ts) > datetime.timedelta(days,0,0)
assert TwitterTimestampToMySQL(result) == msts, (result,msts,TwitterTimestampToMySQL(result)) return result def MySQLTimestampToPython(ts): return datetime.datetime.strptime(ts, "%Y-%m-%d %H:%M:%S") def OlderThan(ts,days):
64
64
25
7
57
jvictor0/TiaraBoom
tiara/util.py
Python
OlderThan
OlderThan
159
160
159
159
aefdfd750618a573ab0c04265532de7a8b1d8ca7
bigcode/the-stack
train
834ce4f3d4652f4188ea1c5f
train
class
class EditDescriptorOptionValueForm(Form): value = TextField('Option Value', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Update option value')
class EditDescriptorOptionValueForm(Form):
value = TextField('Option Value', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Update option value')
name = TextField('Name', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Update name') class EditDescriptorSearchableForm(Form): is_searchable = BooleanField('Searchable') submit = SubmitField('Update') class EditDescriptorOptionValueForm(Form):
64
64
40
8
56
JyYoungK/maps4resources
app/descriptor/forms.py
Python
EditDescriptorOptionValueForm
EditDescriptorOptionValueForm
39
42
39
39
9fc7206ffda7e7bdb84405f8e04f9afbef0b4198
bigcode/the-stack
train
a9783647cc1fe2c2f5b323fd
train
class
class AddDescriptorOptionValueForm(Form): value = TextField('', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Add option')
class AddDescriptorOptionValueForm(Form):
value = TextField('', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Add option')
able = BooleanField('Searchable') submit = SubmitField('Update') class EditDescriptorOptionValueForm(Form): value = TextField('Option Value', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Update option value') class AddDescriptorOptionValueForm(Form):
64
64
35
8
56
JyYoungK/maps4resources
app/descriptor/forms.py
Python
AddDescriptorOptionValueForm
AddDescriptorOptionValueForm
45
47
45
45
01f2aeb36f8940add516f1ddb9f863bf9fcd3668
bigcode/the-stack
train
5cacb21a3a92e251a836d4bc
train
class
class ChangeRequiredOptionDescriptorForm(Form): submit = SubmitField('Change')
class ChangeRequiredOptionDescriptorForm(Form):
submit = SubmitField('Change')
AddDescriptorOptionValueForm(Form): value = TextField('', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Add option') class FixAllResourceOptionValueForm(Form): submit = SubmitField('I understand, delete this option') class ChangeRequiredOptionDescriptorForm(Form):
64
64
16
8
56
JyYoungK/maps4resources
app/descriptor/forms.py
Python
ChangeRequiredOptionDescriptorForm
ChangeRequiredOptionDescriptorForm
54
55
54
54
42440f74f49a44eb48f50feb0340061adad67ba7
bigcode/the-stack
train
4acc683231e7189c071f13e2
train
class
class RequiredOptionDescriptorMissingForm(Form): resources = FieldList(SelectMultipleField(validators=[InputRequired()])) submit = SubmitField('Update')
class RequiredOptionDescriptorMissingForm(Form):
resources = FieldList(SelectMultipleField(validators=[InputRequired()])) submit = SubmitField('Update')
Required(), Length(1, 500)]) submit = SubmitField('Add option') class FixAllResourceOptionValueForm(Form): submit = SubmitField('I understand, delete this option') class ChangeRequiredOptionDescriptorForm(Form): submit = SubmitField('Change') class RequiredOptionDescriptorMissingForm(Form):
64
64
32
8
56
JyYoungK/maps4resources
app/descriptor/forms.py
Python
RequiredOptionDescriptorMissingForm
RequiredOptionDescriptorMissingForm
58
60
58
58
bd6abc04849c0e75512602316c866f30ff25a36f
bigcode/the-stack
train
75a2668db059ffcb5c69b1bd
train
class
class NewDescriptorForm(Form): desc_type = SelectField('Descriptor type', choices=[('text', 'Text'), ('option', 'Option'), ('hyperlink', 'Hyperlink')], validators=[InputRequired()] ) name = TextField('Name', validators=[InputReq...
class NewDescriptorForm(Form):
desc_type = SelectField('Descriptor type', choices=[('text', 'Text'), ('option', 'Option'), ('hyperlink', 'Hyperlink')], validators=[InputRequired()] ) name = TextField('Name', validators=[InputRequired(), Length(1, 500)]) o...
from flask_wtf import Form from wtforms.fields import ( BooleanField, FieldList, SelectField, SelectMultipleField, SubmitField, TextField ) from wtforms.validators import InputRequired, Length, ValidationError from ..models import Descriptor class NewDescriptorForm(Form):
64
64
146
6
57
JyYoungK/maps4resources
app/descriptor/forms.py
Python
NewDescriptorForm
NewDescriptorForm
14
26
14
14
84c29348e7cc2912b505a07ed6fcc71a75e1a547
bigcode/the-stack
train
a299b905b8466d8b5b6aad39
train
class
class EditDescriptorNameForm(Form): name = TextField('Name', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Update name')
class EditDescriptorNameForm(Form):
name = TextField('Name', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Update name')
_searchable = BooleanField('Searchable') submit = SubmitField('Add descriptor') def validate_name(self, field): if Descriptor.query.filter_by(name=field.data).first(): raise ValidationError('There is already a descriptor called "{}"'.format(field.data)) class EditDescriptorNameForm(Form):
64
64
36
7
57
JyYoungK/maps4resources
app/descriptor/forms.py
Python
EditDescriptorNameForm
EditDescriptorNameForm
29
31
29
29
d614898eb0544790ad8c49b089bbab34c02a5714
bigcode/the-stack
train
0f875c874a87b7fa4beeb075
train
class
class EditDescriptorSearchableForm(Form): is_searchable = BooleanField('Searchable') submit = SubmitField('Update')
class EditDescriptorSearchableForm(Form):
is_searchable = BooleanField('Searchable') submit = SubmitField('Update')
first(): raise ValidationError('There is already a descriptor called "{}"'.format(field.data)) class EditDescriptorNameForm(Form): name = TextField('Name', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Update name') class EditDescriptorSearchableForm(Form):
64
64
27
8
56
JyYoungK/maps4resources
app/descriptor/forms.py
Python
EditDescriptorSearchableForm
EditDescriptorSearchableForm
34
36
34
34
477577758ea0325e952ba10c957d415a3df66fd7
bigcode/the-stack
train
cf6a31bc9360c79fcb5fbd92
train
class
class FixAllResourceOptionValueForm(Form): submit = SubmitField('I understand, delete this option')
class FixAllResourceOptionValueForm(Form):
submit = SubmitField('I understand, delete this option')
InputRequired(), Length(1, 500)]) submit = SubmitField('Update option value') class AddDescriptorOptionValueForm(Form): value = TextField('', validators=[InputRequired(), Length(1, 500)]) submit = SubmitField('Add option') class FixAllResourceOptionValueForm(Form):
64
64
22
9
55
JyYoungK/maps4resources
app/descriptor/forms.py
Python
FixAllResourceOptionValueForm
FixAllResourceOptionValueForm
50
51
50
50
a2503ca00028a36e5d1cb9a62ae2940e1f834444
bigcode/the-stack
train
50ecd4ebb4f7ad556f6ff1a0
train
class
class TestGuiMixin: @fixture(scope='class') def ahk(self) -> AHK: return AHK() def test_show_tooltip(self, ahk: AHK): ahk.show_tooltip('hello') ahk.show_tooltip('🚀 Hello unicode 🚀', second=2) ahk.show_tooltip('⽲ hello3', x=10, y=10) ahk.show_tooltip('hello4', secon...
class TestGuiMixin: @fixture(scope='class')
def ahk(self) -> AHK: return AHK() def test_show_tooltip(self, ahk: AHK): ahk.show_tooltip('hello') ahk.show_tooltip('🚀 Hello unicode 🚀', second=2) ahk.show_tooltip('⽲ hello3', x=10, y=10) ahk.show_tooltip('hello4', second=2, x=10, y=10) with raises(ValueError...
from pytest import fixture, raises from ahk import AHK class TestGuiMixin: @fixture(scope='class')
26
95
318
12
13
scslmd/ahk
tests/unittests/test_gui.py
Python
TestGuiMixin
TestGuiMixin
6
28
6
7
0765997aeda3de79be63b5c22402fbb89f417631
bigcode/the-stack
train
755a940143b5739299c9e39e
train
class
@pulumi.input_type class SmbFileShareCacheAttributesArgs: def __init__(__self__, *, cache_stale_timeout_in_seconds: Optional[pulumi.Input[int]] = None): """ :param pulumi.Input[int] cache_stale_timeout_in_seconds: Refreshes a file share's cache by using Time To Live (TTL). ...
@pulumi.input_type class SmbFileShareCacheAttributesArgs:
def __init__(__self__, *, cache_stale_timeout_in_seconds: Optional[pulumi.Input[int]] = None): """ :param pulumi.Input[int] cache_stale_timeout_in_seconds: Refreshes a file share's cache by using Time To Live (TTL). TTL is the length of time since the last refresh aft...
owner ID for the file share (unless the files have another owner ID specified). Defaults to `65534` (`nfsnobody`). Valid values: `0` through `4294967294`. """ return pulumi.get(self, "owner_id") @owner_id.setter def owner_id(self, value: Optional[pulumi.Input[str]]): pulumi.set(self, "...
103
103
346
15
88
alexbowers/pulumi-aws
sdk/python/pulumi_aws/storagegateway/_inputs.py
Python
SmbFileShareCacheAttributesArgs
SmbFileShareCacheAttributesArgs
256
280
256
257
6190d65922b9086328f9afa6e2723115308d584c
bigcode/the-stack
train
208132a8f2157a97fdf506f0
train
class
@pulumi.input_type class GatewayGatewayNetworkInterfaceArgs: def __init__(__self__, *, ipv4_address: Optional[pulumi.Input[str]] = None): """ :param pulumi.Input[str] ipv4_address: The Internet Protocol version 4 (IPv4) address of the interface. """ if ipv4_address i...
@pulumi.input_type class GatewayGatewayNetworkInterfaceArgs:
def __init__(__self__, *, ipv4_address: Optional[pulumi.Input[str]] = None): """ :param pulumi.Input[str] ipv4_address: The Internet Protocol version 4 (IPv4) address of the interface. """ if ipv4_address is not None: pulumi.set(__self__, "ipv4_address", ...
'GatewayGatewayNetworkInterfaceArgs', 'GatewaySmbActiveDirectorySettingsArgs', 'NfsFileShareCacheAttributesArgs', 'NfsFileShareNfsFileShareDefaultsArgs', 'SmbFileShareCacheAttributesArgs', ] @pulumi.input_type class GatewayGatewayNetworkInterfaceArgs:
64
64
193
13
51
alexbowers/pulumi-aws
sdk/python/pulumi_aws/storagegateway/_inputs.py
Python
GatewayGatewayNetworkInterfaceArgs
GatewayGatewayNetworkInterfaceArgs
19
39
19
20
d9a54b151b7e82dfc63000dd5932728f8dcd9e20
bigcode/the-stack
train
4ac0b6cb97dc5a3b9690814f
train
class
@pulumi.input_type class GatewaySmbActiveDirectorySettingsArgs: def __init__(__self__, *, domain_name: pulumi.Input[str], password: pulumi.Input[str], username: pulumi.Input[str], active_directory_status: Optional[pulumi.Input[str]] = None, ...
@pulumi.input_type class GatewaySmbActiveDirectorySettingsArgs:
def __init__(__self__, *, domain_name: pulumi.Input[str], password: pulumi.Input[str], username: pulumi.Input[str], active_directory_status: Optional[pulumi.Input[str]] = None, domain_controllers: Optional[pulumi.Input[Sequence[pul...
NetworkInterfaceArgs', 'GatewaySmbActiveDirectorySettingsArgs', 'NfsFileShareCacheAttributesArgs', 'NfsFileShareNfsFileShareDefaultsArgs', 'SmbFileShareCacheAttributesArgs', ] @pulumi.input_type class GatewayGatewayNetworkInterfaceArgs: def __init__(__self__, *, ipv4_address: Optio...
256
256
1,205
15
241
alexbowers/pulumi-aws
sdk/python/pulumi_aws/storagegateway/_inputs.py
Python
GatewaySmbActiveDirectorySettingsArgs
GatewaySmbActiveDirectorySettingsArgs
42
155
42
43
efb30ee5ad5ac9f35f0cf6a2bdc318f9d87b4b7f
bigcode/the-stack
train
d5c656d51c43fc56afe89d7e
train
class
@pulumi.input_type class NfsFileShareCacheAttributesArgs: def __init__(__self__, *, cache_stale_timeout_in_seconds: Optional[pulumi.Input[int]] = None): """ :param pulumi.Input[int] cache_stale_timeout_in_seconds: Refreshes a file share's cache by using Time To Live (TTL). ...
@pulumi.input_type class NfsFileShareCacheAttributesArgs:
def __init__(__self__, *, cache_stale_timeout_in_seconds: Optional[pulumi.Input[int]] = None): """ :param pulumi.Input[int] cache_stale_timeout_in_seconds: Refreshes a file share's cache by using Time To Live (TTL). TTL is the length of time since the last refresh aft...
_seconds(self) -> Optional[pulumi.Input[int]]: """ Specifies the time in seconds, in which the JoinDomain operation must complete. The default is `20` seconds. """ return pulumi.get(self, "timeout_in_seconds") @timeout_in_seconds.setter def timeout_in_seconds(self, value: Option...
103
103
346
15
88
alexbowers/pulumi-aws
sdk/python/pulumi_aws/storagegateway/_inputs.py
Python
NfsFileShareCacheAttributesArgs
NfsFileShareCacheAttributesArgs
158
182
158
159
b7f3c95114c7b963dba64abf963880e456a5f2a8
bigcode/the-stack
train
1c2a8aca0a206f7caf758afe
train
class
@pulumi.input_type class NfsFileShareNfsFileShareDefaultsArgs: def __init__(__self__, *, directory_mode: Optional[pulumi.Input[str]] = None, file_mode: Optional[pulumi.Input[str]] = None, group_id: Optional[pulumi.Input[str]] = None, owner_id: Opti...
@pulumi.input_type class NfsFileShareNfsFileShareDefaultsArgs:
def __init__(__self__, *, directory_mode: Optional[pulumi.Input[str]] = None, file_mode: Optional[pulumi.Input[str]] = None, group_id: Optional[pulumi.Input[str]] = None, owner_id: Optional[pulumi.Input[str]] = None): """ :param pul...
30 days) """ if cache_stale_timeout_in_seconds is not None: pulumi.set(__self__, "cache_stale_timeout_in_seconds", cache_stale_timeout_in_seconds) @property @pulumi.getter(name="cacheStaleTimeoutInSeconds") def cache_stale_timeout_in_seconds(self) -> Optional[pulumi.Input[int]]:...
234
234
783
18
216
alexbowers/pulumi-aws
sdk/python/pulumi_aws/storagegateway/_inputs.py
Python
NfsFileShareNfsFileShareDefaultsArgs
NfsFileShareNfsFileShareDefaultsArgs
185
253
185
186
d51656f2d17cdb543c513048fdb1f8bc4131b752
bigcode/the-stack
train
4373b66b33c51785340a463a
train
function
def calc_nll(log_softmax, label): out = torch.zeros_like(label, dtype=torch.float) for i in range(len(label)): out[i] = log_softmax[i][label[i]] return -out.sum()/len(out)
def calc_nll(log_softmax, label):
out = torch.zeros_like(label, dtype=torch.float) for i in range(len(label)): out[i] = log_softmax[i][label[i]] return -out.sum()/len(out)
label) print("NLL {0:.2f} ".format(nll.item()*10)) print('Brier {0:.2f}'.format(brier_score*100)) return nll.item(), brier_score # Calc NLL def calc_nll(log_softmax, label):
64
64
53
10
53
pitlover/confidence_estimation
metrics.py
Python
calc_nll
calc_nll
109
114
109
109
54e5c2e7e1ded90e24342e76baacca417426688f
bigcode/the-stack
train
c0bc508f73a992788ec2206e
train
function
def calc_metrics(loader, label, label_onehot, model, criterion, args): acc, softmax, correct, logit, cls_loss, total_gt = get_metric_values(loader, model, criterion, args) # aurc, eaurc aurc, eaurc = calc_aurc_eaurc(softmax, correct) # fpr, aupr aupr, fpr = calc_fpr_aupr(softmax, correct) ...
def calc_metrics(loader, label, label_onehot, model, criterion, args):
acc, softmax, correct, logit, cls_loss, total_gt = get_metric_values(loader, model, criterion, args) # aurc, eaurc aurc, eaurc = calc_aurc_eaurc(softmax, correct) # fpr, aupr aupr, fpr = calc_fpr_aupr(softmax, correct) # calibration measure ece , mce, rmsce # ece = calc_ece(softmax, la...
import numpy as np import torch import torch.nn.functional as F from sklearn import metrics def calc_metrics(loader, label, label_onehot, model, criterion, args):
37
79
266
17
19
pitlover/confidence_estimation
metrics.py
Python
calc_metrics
calc_metrics
6
20
6
6
54715d690bd5a533905f4c1d4087417542c5d0db
bigcode/the-stack
train
63059038f12824f503e05d7b
train
function
def calc_aurc_eaurc(softmax, correct): softmax = np.array(softmax) correctness = np.array(correct) softmax_max = np.max(softmax, 1) sort_values = sorted(zip(softmax_max[:], correctness[:]), key=lambda x:x[0], reverse=True) sort_softmax_max, sort_correctness = zip(*sort_values) risk_li, c...
def calc_aurc_eaurc(softmax, correct):
softmax = np.array(softmax) correctness = np.array(correct) softmax_max = np.max(softmax, 1) sort_values = sorted(zip(softmax_max[:], correctness[:]), key=lambda x:x[0], reverse=True) sort_softmax_max, sort_correctness = zip(*sort_values) risk_li, coverage_li = coverage_risk(sort_softmax_...
E99 {0:.2f} [{1}] ".format(E99 * 100, len(over_99_idx[0]))) return E99, len(over_99_idx[0]) # AURC, EAURC def calc_aurc_eaurc(softmax, correct):
64
64
130
14
49
pitlover/confidence_estimation
metrics.py
Python
calc_aurc_eaurc
calc_aurc_eaurc
35
45
35
35
e9d76ee5febc0a248df9542394dcc400e54af26e
bigcode/the-stack
train
6b982e558408fed9b2857e82
train
function
def calc_nll_brier(softmax, logit, label, label_onehot): brier_score = np.mean(np.sum((softmax - label_onehot) ** 2, axis=1)) logit = torch.tensor(logit, dtype=torch.float) label = torch.tensor(label, dtype=torch.int) logsoftmax = torch.nn.LogSoftmax(dim=1) log_softmax = logsoftmax(logit) ...
def calc_nll_brier(softmax, logit, label, label_onehot):
brier_score = np.mean(np.sum((softmax - label_onehot) ** 2, axis=1)) logit = torch.tensor(logit, dtype=torch.float) label = torch.tensor(label, dtype=torch.int) logsoftmax = torch.nn.LogSoftmax(dim=1) log_softmax = logsoftmax(logit) nll = calc_nll(log_softmax, label) print("NLL {...
idence_in_bin - accuracy_in_bin) * prop_in_bin print("ECE {0:.2f} ".format(ece.item()*100)) return ece.item() # NLL & Brier Score def calc_nll_brier(softmax, logit, label, label_onehot):
64
64
153
19
44
pitlover/confidence_estimation
metrics.py
Python
calc_nll_brier
calc_nll_brier
93
106
93
93
ec4b06e7e54f89255c7b9b8f4c23c7b2c7d1cfb4
bigcode/the-stack
train
8f9debbcce425bc5637a4543
train
function
def calc_ece(softmax, label, bins=15): bin_boundaries = torch.linspace(0, 1, bins + 1) bin_lowers = bin_boundaries[:-1] bin_uppers = bin_boundaries[1:] softmax = torch.tensor(softmax) labels = torch.tensor(label) softmax_max, predictions = torch.max(softmax, 1) correctness = predi...
def calc_ece(softmax, label, bins=15):
bin_boundaries = torch.linspace(0, 1, bins + 1) bin_lowers = bin_boundaries[:-1] bin_uppers = bin_boundaries[1:] softmax = torch.tensor(softmax) labels = torch.tensor(label) softmax_max, predictions = torch.max(softmax, 1) correctness = predictions.eq(labels) ece = torch.zer...
("AUPR {0:.2f}".format(aupr_err*100)) print('FPR {0:.2f}'.format(fpr_in_tpr_95*100)) return aupr_err, fpr_in_tpr_95 # ECE def calc_ece(softmax, label, bins=15):
72
72
241
14
57
pitlover/confidence_estimation
metrics.py
Python
calc_ece
calc_ece
65
90
65
65
a9958d18e0838872467d8b815756948a5742943d
bigcode/the-stack
train
0b26c636d30cf84052918c68
train
function
def calc_fpr_aupr(softmax, correct): softmax = np.array(softmax) correctness = np.array(correct) softmax_max = np.max(softmax, 1) fpr, tpr, thresholds = metrics.roc_curve(correctness, softmax_max) idx_tpr_95 = np.argmin(np.abs(tpr - 0.95)) fpr_in_tpr_95 = fpr[idx_tpr_95] aupr_err ...
def calc_fpr_aupr(softmax, correct):
softmax = np.array(softmax) correctness = np.array(correct) softmax_max = np.max(softmax, 1) fpr, tpr, thresholds = metrics.roc_curve(correctness, softmax_max) idx_tpr_95 = np.argmin(np.abs(tpr - 0.95)) fpr_in_tpr_95 = fpr[idx_tpr_95] aupr_err = metrics.average_precision_score(-1 *...
risk_li, coverage_li = coverage_risk(sort_softmax_max, sort_correctness) aurc, eaurc = aurc_eaurc(risk_li) return aurc, eaurc # AUPR ERROR def calc_fpr_aupr(softmax, correct):
64
64
181
13
50
pitlover/confidence_estimation
metrics.py
Python
calc_fpr_aupr
calc_fpr_aupr
48
62
48
48
0ebd2b80ec3f14b6f850f72a2480003821dbc40c
bigcode/the-stack
train
0613728d4ebe5f022288b8ea
train
function
def calc_E99(softmax, correct, loader): softmax = np.array(softmax) correctness = np.array(correct) softmax_max = np.max(softmax, 1) over_99_idx = np.where(softmax_max >= 0.99) E99 = 1 - correctness[over_99_idx].sum() / len(over_99_idx[0]) print("E99 {0:.2f} [{1}] ".format(E99 * 100, l...
def calc_E99(softmax, correct, loader):
softmax = np.array(softmax) correctness = np.array(correct) softmax_max = np.max(softmax, 1) over_99_idx = np.where(softmax_max >= 0.99) E99 = 1 - correctness[over_99_idx].sum() / len(over_99_idx[0]) print("E99 {0:.2f} [{1}] ".format(E99 * 100, len(over_99_idx[0]))) return E99, len...
= calc_E99(softmax, correct, loader) return acc, aurc, eaurc, aupr, fpr, ece, nll, brier, E99, over_99, cls_loss # E99 def calc_E99(softmax, correct, loader):
64
64
130
12
51
pitlover/confidence_estimation
metrics.py
Python
calc_E99
calc_E99
23
32
23
23
fb2fd274ba4ce7e6271c69d3fa7fbc083dbff688
bigcode/the-stack
train
fbbcb656b3d5e90abbb725b5
train
function
def coverage_risk(confidence, correctness): risk_list = [] coverage_list = [] risk = 0 for i in range(len(confidence)): coverage = (i + 1) / len(confidence) coverage_list.append(coverage) if correctness[i] == 0: risk += 1 risk_list.append(risk / (...
def coverage_risk(confidence, correctness):
risk_list = [] coverage_list = [] risk = 0 for i in range(len(confidence)): coverage = (i + 1) / len(confidence) coverage_list.append(coverage) if correctness[i] == 0: risk += 1 risk_list.append(risk / (i + 1)) return risk_list, coverage_lis...
(log_softmax, label): out = torch.zeros_like(label, dtype=torch.float) for i in range(len(label)): out[i] = log_softmax[i][label[i]] return -out.sum()/len(out) # Calc coverage, risk def coverage_risk(confidence, correctness):
64
64
91
9
54
pitlover/confidence_estimation
metrics.py
Python
coverage_risk
coverage_risk
117
130
117
117
6f65f85b997ae2158990fdc05ce287fa57c22629
bigcode/the-stack
train
c86673496213a96fa563e7e9
train
function
def get_metric_values(loader, model, criterion, args): model.eval() with torch.no_grad(): total_loss = 0 total_acc = 0 accuracy = 0 list_softmax = [] list_correct = [] list_logit = [] total_gt = [] for input, target, idx in loader: ...
def get_metric_values(loader, model, criterion, args):
model.eval() with torch.no_grad(): total_loss = 0 total_acc = 0 accuracy = 0 list_softmax = [] list_correct = [] list_logit = [] total_gt = [] for input, target, idx in loader: input = input.cuda() target = targ...
1 / len(risk_list)) aurc = risk_coverage_curve_area eaurc = risk_coverage_curve_area - optimal_risk_area print("AURC {0:.2f}".format(aurc*1000)) print("EAURC {0:.2f}".format(eaurc*1000)) return aurc, eaurc # Get softmax, logit def get_metric_values(loader, model, criterion, args):
102
102
340
12
89
pitlover/confidence_estimation
metrics.py
Python
get_metric_values
get_metric_values
149
199
149
149
188cdcf820183090c1c3fa1f645084b1278c9e93
bigcode/the-stack
train
6ff4c6ee5b35c56eb0d4a862
train
function
def aurc_eaurc(risk_list): r = risk_list[-1] risk_coverage_curve_area = 0 optimal_risk_area = r + (1 - r) * np.log(1 - r) for risk_value in risk_list: risk_coverage_curve_area += risk_value * (1 / len(risk_list)) aurc = risk_coverage_curve_area eaurc = risk_coverage_curve_area -...
def aurc_eaurc(risk_list):
r = risk_list[-1] risk_coverage_curve_area = 0 optimal_risk_area = r + (1 - r) * np.log(1 - r) for risk_value in risk_list: risk_coverage_curve_area += risk_value * (1 / len(risk_list)) aurc = risk_coverage_curve_area eaurc = risk_coverage_curve_area - optimal_risk_area pr...
idence) coverage_list.append(coverage) if correctness[i] == 0: risk += 1 risk_list.append(risk / (i + 1)) return risk_list, coverage_list # Calc aurc, eaurc def aurc_eaurc(risk_list):
64
64
150
10
53
pitlover/confidence_estimation
metrics.py
Python
aurc_eaurc
aurc_eaurc
133
146
133
133
e4a25133f1d504dbfae0fae535280add7dac882f
bigcode/the-stack
train
5ef81d0882ee2b4678514f79
train
class
class TestLauncher(TestCase): # -------------------------------------------------------------------------- # def setUp(self): class Session(object): def __init__(self): self.uid = 'uid.0' self.sid = 'sid.0' self.cfg = ru.Config(cfg={'dbur...
class TestLauncher(TestCase): # -------------------------------------------------------------------------- #
def setUp(self): class Session(object): def __init__(self): self.uid = 'uid.0' self.sid = 'sid.0' self.cfg = ru.Config(cfg={'dburl': 'db://'}) def _get_resource_sandbox(self, pilot): return ru.Url(pilot['description']....
# pylint: disable=protected-access, no-value-for-parameter, unused-argument __copyright__ = "Copyright 2020, http://radical.rutgers.edu" __license__ = "MIT" import os from unittest import TestCase from unittest import mock import radical.utils as ru import radical.pilot as rp from radical.pilot.pmgr.launching....
101
256
915
12
89
lsawade/radical.pilot
tests/unit_tests/test_launcher/test_launcher.py
Python
TestLauncher
TestLauncher
19
131
19
22
5176973ad84cb9481a14b9a1d03a9930936f2313
bigcode/the-stack
train
c9a197754214db98a2322ce6
train
function
def test_remove_contact_from_group(app, db): db.check_available_parameters(app) if db.get_data_address_in_groups() == []: app.contact.add_first_contact_into_first_group() old_data = db.get_data_address_in_groups() row = random.choice(old_data) selected_contact = row[0] selected_group =...
def test_remove_contact_from_group(app, db):
db.check_available_parameters(app) if db.get_data_address_in_groups() == []: app.contact.add_first_contact_into_first_group() old_data = db.get_data_address_in_groups() row = random.choice(old_data) selected_contact = row[0] selected_group = row[1] app.contact.remove_contact_from_gr...
= selected_data[1] app.contact.add_contact_into_group(selected_contact, final_group) new_data = db.get_data_address_in_groups() old_data.append((int(selected_contact), int(final_group))) assert sorted(old_data) == sorted(new_data) def test_remove_contact_from_group(app, db):
64
64
115
10
54
seredyan/AddressBook
test/test_contacts_in_groups.py
Python
test_remove_contact_from_group
test_remove_contact_from_group
21
36
21
22
993f05be4ec97cc7efb7441b802096086f3667c7
bigcode/the-stack
train