body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
701e355f58511927e5dc1ef3fd3948ebabedc9f2d2d45c252e8578dfd751d8ab
def get_gender(text): '\n Determine gender by the count of referring pronouns in the biography (he, she,\n they).\n ' he_count = len(re.findall(' he ', text.lower())) she_count = len(re.findall(' she ', text.lower())) they_count = len(re.findall(' they ', text.lower())) if (he_count == max(...
Determine gender by the count of referring pronouns in the biography (he, she, they).
parlai/tasks/md_gender/wikipedia.py
get_gender
justinbuzzni/ParlAI
9,228
python
def get_gender(text): '\n Determine gender by the count of referring pronouns in the biography (he, she,\n they).\n ' he_count = len(re.findall(' he ', text.lower())) she_count = len(re.findall(' she ', text.lower())) they_count = len(re.findall(' they ', text.lower())) if (he_count == max(...
def get_gender(text): '\n Determine gender by the count of referring pronouns in the biography (he, she,\n they).\n ' he_count = len(re.findall(' he ', text.lower())) she_count = len(re.findall(' she ', text.lower())) they_count = len(re.findall(' they ', text.lower())) if (he_count == max(...
d9480908cfca9575d02be97011ece6639eeed60079ebdaac3bfda40db171c705
def get_num_samples(self, opt) -> int: '\n Return the number of samples given the datatype.\n ' datatype = opt['datatype'] if ('train' in datatype): return (12774693, 12774693) elif ('valid' in datatype): return (7410, 7410) else: return (7441, 7441)
Return the number of samples given the datatype.
parlai/tasks/md_gender/wikipedia.py
get_num_samples
justinbuzzni/ParlAI
9,228
python
def get_num_samples(self, opt) -> int: '\n \n ' datatype = opt['datatype'] if ('train' in datatype): return (12774693, 12774693) elif ('valid' in datatype): return (7410, 7410) else: return (7441, 7441)
def get_num_samples(self, opt) -> int: '\n \n ' datatype = opt['datatype'] if ('train' in datatype): return (12774693, 12774693) elif ('valid' in datatype): return (7410, 7410) else: return (7441, 7441)<|docstring|>Return the number of samples given the datatype...
4ee56bc06f664f11507c88d301290c972a0fa571c51000f3e974abc588105c4d
def get_fold_chunks(self, opt) -> List[int]: '\n Return a list of chunk IDs (integer).\n\n Given the datatype (train/test/valid), return the list of chunk IDs that\n correspond to that split.\n ' datatype = opt['datatype'] all_chunk_idxs = list(self.chunk_idx_to_file.keys()) ...
Return a list of chunk IDs (integer). Given the datatype (train/test/valid), return the list of chunk IDs that correspond to that split.
parlai/tasks/md_gender/wikipedia.py
get_fold_chunks
justinbuzzni/ParlAI
9,228
python
def get_fold_chunks(self, opt) -> List[int]: '\n Return a list of chunk IDs (integer).\n\n Given the datatype (train/test/valid), return the list of chunk IDs that\n correspond to that split.\n ' datatype = opt['datatype'] all_chunk_idxs = list(self.chunk_idx_to_file.keys()) ...
def get_fold_chunks(self, opt) -> List[int]: '\n Return a list of chunk IDs (integer).\n\n Given the datatype (train/test/valid), return the list of chunk IDs that\n correspond to that split.\n ' datatype = opt['datatype'] all_chunk_idxs = list(self.chunk_idx_to_file.keys()) ...
63183ec47de33654fcdeb8f6d36fdf522be01085090bfdc3e28078eacc0ff407
def load_from_chunk(self, chunk_idx: int): '\n [Abstract] Given the chunk index, load examples from that chunk.\n\n Return a list of tuples. The function `_create_message` will take these tuples\n to form the Message object that is returned by the teacher.\n ' output = [] chunk_p...
[Abstract] Given the chunk index, load examples from that chunk. Return a list of tuples. The function `_create_message` will take these tuples to form the Message object that is returned by the teacher.
parlai/tasks/md_gender/wikipedia.py
load_from_chunk
justinbuzzni/ParlAI
9,228
python
def load_from_chunk(self, chunk_idx: int): '\n [Abstract] Given the chunk index, load examples from that chunk.\n\n Return a list of tuples. The function `_create_message` will take these tuples\n to form the Message object that is returned by the teacher.\n ' output = [] chunk_p...
def load_from_chunk(self, chunk_idx: int): '\n [Abstract] Given the chunk index, load examples from that chunk.\n\n Return a list of tuples. The function `_create_message` will take these tuples\n to form the Message object that is returned by the teacher.\n ' output = [] chunk_p...
8f600444dec219adfb0944d852f3824c30ccec6d901b1e6584a99bfb0790216c
def create_message(self, queue_output, entry_idx=0) -> 'Message': '\n [Abstract] Given the tuple output of the queue, return an act.\n ' (par, title, lbl, gender, class_type) = queue_output if (self.class_task == 'all'): if (class_type == 'self'): labels = gend_utils.UNKNOW...
[Abstract] Given the tuple output of the queue, return an act.
parlai/tasks/md_gender/wikipedia.py
create_message
justinbuzzni/ParlAI
9,228
python
def create_message(self, queue_output, entry_idx=0) -> 'Message': '\n \n ' (par, title, lbl, gender, class_type) = queue_output if (self.class_task == 'all'): if (class_type == 'self'): labels = gend_utils.UNKNOWN_LABELS['self'] else: labels = [lbl] ...
def create_message(self, queue_output, entry_idx=0) -> 'Message': '\n \n ' (par, title, lbl, gender, class_type) = queue_output if (self.class_task == 'all'): if (class_type == 'self'): labels = gend_utils.UNKNOWN_LABELS['self'] else: labels = [lbl] ...
c617395fbaded790b7446ff86b5cfb8f5f3e51a20508c1c2b9dcd9cd326782da
def next_redirect(request, default, default_view, **get_kwargs): '\n Handle the "where should I go next?" part of comment views.\n\n The next value could be a kwarg to the function (``default``), or a\n ``?next=...`` GET arg, or the URL of a given view (``default_view``). See\n the view modules for exam...
Handle the "where should I go next?" part of comment views. The next value could be a kwarg to the function (``default``), or a ``?next=...`` GET arg, or the URL of a given view (``default_view``). See the view modules for examples. Returns an ``HttpResponseRedirect``.
django/contrib/comments/views/utils.py
next_redirect
riklaunim/django-custom-multisite
790
python
def next_redirect(request, default, default_view, **get_kwargs): '\n Handle the "where should I go next?" part of comment views.\n\n The next value could be a kwarg to the function (``default``), or a\n ``?next=...`` GET arg, or the URL of a given view (``default_view``). See\n the view modules for exam...
def next_redirect(request, default, default_view, **get_kwargs): '\n Handle the "where should I go next?" part of comment views.\n\n The next value could be a kwarg to the function (``default``), or a\n ``?next=...`` GET arg, or the URL of a given view (``default_view``). See\n the view modules for exam...
72051ad9c4e52cae5e3609ae52e1be5fbba4d9f0c2d2dcdb3f4474c4ecc94ad5
def confirmation_view(template, doc='Display a confirmation view.'): '\n Confirmation view generator for the "comment was\n posted/flagged/deleted/approved" views.\n ' def confirmed(request): comment = None if ('c' in request.GET): try: comment = comments.ge...
Confirmation view generator for the "comment was posted/flagged/deleted/approved" views.
django/contrib/comments/views/utils.py
confirmation_view
riklaunim/django-custom-multisite
790
python
def confirmation_view(template, doc='Display a confirmation view.'): '\n Confirmation view generator for the "comment was\n posted/flagged/deleted/approved" views.\n ' def confirmed(request): comment = None if ('c' in request.GET): try: comment = comments.ge...
def confirmation_view(template, doc='Display a confirmation view.'): '\n Confirmation view generator for the "comment was\n posted/flagged/deleted/approved" views.\n ' def confirmed(request): comment = None if ('c' in request.GET): try: comment = comments.ge...
f9a20607dd79ab87c610c28c2d625a459c4e9e18d4a741442dd48240ead16d7d
def _init_lazy_if_proper(results, lazy): 'Initialize lazy operation properly.\n\n Make sure that a lazy operation is properly initialized,\n and avoid a non-lazy operation accidentally getting mixed in.\n\n Required keys in results are "imgs" if "img_shape" not in results,\n otherwise, Required keys in ...
Initialize lazy operation properly. Make sure that a lazy operation is properly initialized, and avoid a non-lazy operation accidentally getting mixed in. Required keys in results are "imgs" if "img_shape" not in results, otherwise, Required keys in results are "img_shape", add or modified keys are "img_shape", "lazy...
mmaction/datasets/pipelines/augmentations.py
_init_lazy_if_proper
dumbPy/Video-Swin-Transformer
648
python
def _init_lazy_if_proper(results, lazy): 'Initialize lazy operation properly.\n\n Make sure that a lazy operation is properly initialized,\n and avoid a non-lazy operation accidentally getting mixed in.\n\n Required keys in results are "imgs" if "img_shape" not in results,\n otherwise, Required keys in ...
def _init_lazy_if_proper(results, lazy): 'Initialize lazy operation properly.\n\n Make sure that a lazy operation is properly initialized,\n and avoid a non-lazy operation accidentally getting mixed in.\n\n Required keys in results are "imgs" if "img_shape" not in results,\n otherwise, Required keys in ...
e3f962c90ab210b1b5a9d3a97a06aea49781237919ae6e565f1afaf519dc2748
@staticmethod def default_transforms(): "Default transforms for imgaug.\n\n Implement RandAugment by imgaug.\n Plase visit `https://arxiv.org/abs/1909.13719` for more information.\n\n Augmenters and hyper parameters are borrowed from the following repo:\n https://github.com/tensorflow/tp...
Default transforms for imgaug. Implement RandAugment by imgaug. Plase visit `https://arxiv.org/abs/1909.13719` for more information. Augmenters and hyper parameters are borrowed from the following repo: https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/autoaugment.py # noqa Miss one augmente...
mmaction/datasets/pipelines/augmentations.py
default_transforms
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def default_transforms(): "Default transforms for imgaug.\n\n Implement RandAugment by imgaug.\n Plase visit `https://arxiv.org/abs/1909.13719` for more information.\n\n Augmenters and hyper parameters are borrowed from the following repo:\n https://github.com/tensorflow/tp...
@staticmethod def default_transforms(): "Default transforms for imgaug.\n\n Implement RandAugment by imgaug.\n Plase visit `https://arxiv.org/abs/1909.13719` for more information.\n\n Augmenters and hyper parameters are borrowed from the following repo:\n https://github.com/tensorflow/tp...
7c17478f29be5128f2344361979af7c70be22e982249cd52851fbaeb979298b0
def imgaug_builder(self, cfg): 'Import a module from imgaug.\n\n It follows the logic of :func:`build_from_cfg`. Use a dict object to\n create an iaa.Augmenter object.\n\n Args:\n cfg (dict): Config dict. It should at least contain the key "type".\n\n Returns:\n obj...
Import a module from imgaug. It follows the logic of :func:`build_from_cfg`. Use a dict object to create an iaa.Augmenter object. Args: cfg (dict): Config dict. It should at least contain the key "type". Returns: obj:`iaa.Augmenter`: The constructed imgaug augmenter.
mmaction/datasets/pipelines/augmentations.py
imgaug_builder
dumbPy/Video-Swin-Transformer
648
python
def imgaug_builder(self, cfg): 'Import a module from imgaug.\n\n It follows the logic of :func:`build_from_cfg`. Use a dict object to\n create an iaa.Augmenter object.\n\n Args:\n cfg (dict): Config dict. It should at least contain the key "type".\n\n Returns:\n obj...
def imgaug_builder(self, cfg): 'Import a module from imgaug.\n\n It follows the logic of :func:`build_from_cfg`. Use a dict object to\n create an iaa.Augmenter object.\n\n Args:\n cfg (dict): Config dict. It should at least contain the key "type".\n\n Returns:\n obj...
b51996381a96762e3525aed653ab66f183661f70e6c743da5336cf6d079e5bb9
@staticmethod def _box_crop(box, crop_bbox): 'Crop the bounding boxes according to the crop_bbox.\n\n Args:\n box (np.ndarray): The bounding boxes.\n crop_bbox(np.ndarray): The bbox used to crop the original image.\n ' (x1, y1, x2, y2) = crop_bbox (img_w, img_h) = ((x2 - ...
Crop the bounding boxes according to the crop_bbox. Args: box (np.ndarray): The bounding boxes. crop_bbox(np.ndarray): The bbox used to crop the original image.
mmaction/datasets/pipelines/augmentations.py
_box_crop
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def _box_crop(box, crop_bbox): 'Crop the bounding boxes according to the crop_bbox.\n\n Args:\n box (np.ndarray): The bounding boxes.\n crop_bbox(np.ndarray): The bbox used to crop the original image.\n ' (x1, y1, x2, y2) = crop_bbox (img_w, img_h) = ((x2 - ...
@staticmethod def _box_crop(box, crop_bbox): 'Crop the bounding boxes according to the crop_bbox.\n\n Args:\n box (np.ndarray): The bounding boxes.\n crop_bbox(np.ndarray): The bbox used to crop the original image.\n ' (x1, y1, x2, y2) = crop_bbox (img_w, img_h) = ((x2 - ...
cda00a0fe0eac2fc32292ca397379b0347e9be8d3b9d56ef834f77940ae4aec8
def _all_box_crop(self, results, crop_bbox): "Crop the gt_bboxes and proposals in results according to crop_bbox.\n\n Args:\n results (dict): All information about the sample, which contain\n 'gt_bboxes' and 'proposals' (optional).\n crop_bbox(np.ndarray): The bbox used t...
Crop the gt_bboxes and proposals in results according to crop_bbox. Args: results (dict): All information about the sample, which contain 'gt_bboxes' and 'proposals' (optional). crop_bbox(np.ndarray): The bbox used to crop the original image.
mmaction/datasets/pipelines/augmentations.py
_all_box_crop
dumbPy/Video-Swin-Transformer
648
python
def _all_box_crop(self, results, crop_bbox): "Crop the gt_bboxes and proposals in results according to crop_bbox.\n\n Args:\n results (dict): All information about the sample, which contain\n 'gt_bboxes' and 'proposals' (optional).\n crop_bbox(np.ndarray): The bbox used t...
def _all_box_crop(self, results, crop_bbox): "Crop the gt_bboxes and proposals in results according to crop_bbox.\n\n Args:\n results (dict): All information about the sample, which contain\n 'gt_bboxes' and 'proposals' (optional).\n crop_bbox(np.ndarray): The bbox used t...
a5cab4d76535908ec1cb821682ff99f62c926930934e7fb079525e675867ad40
def __call__(self, results): 'Performs the RandomCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (n...
Performs the RandomCrop augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the RandomCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (n...
def __call__(self, results): 'Performs the RandomCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (n...
4441536059873dfcd94ad51eef3bfbde19fedab7d51c6b32ef159dc17b76816f
@staticmethod def get_crop_bbox(img_shape, area_range, aspect_ratio_range, max_attempts=10): "Get a crop bbox given the area range and aspect ratio range.\n\n Args:\n img_shape (Tuple[int]): Image shape\n area_range (Tuple[float]): The candidate area scales range of\n out...
Get a crop bbox given the area range and aspect ratio range. Args: img_shape (Tuple[int]): Image shape area_range (Tuple[float]): The candidate area scales range of output cropped images. Default: (0.08, 1.0). aspect_ratio_range (Tuple[float]): The candidate aspect ratio range of output cro...
mmaction/datasets/pipelines/augmentations.py
get_crop_bbox
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def get_crop_bbox(img_shape, area_range, aspect_ratio_range, max_attempts=10): "Get a crop bbox given the area range and aspect ratio range.\n\n Args:\n img_shape (Tuple[int]): Image shape\n area_range (Tuple[float]): The candidate area scales range of\n out...
@staticmethod def get_crop_bbox(img_shape, area_range, aspect_ratio_range, max_attempts=10): "Get a crop bbox given the area range and aspect ratio range.\n\n Args:\n img_shape (Tuple[int]): Image shape\n area_range (Tuple[float]): The candidate area scales range of\n out...
bccf0b767e1e093e91e3120d1b9206e0a91c9d7b585e06a16e834afd38fe3334
def __call__(self, results): 'Performs the RandomResizeCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): ass...
Performs the RandomResizeCrop augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the RandomResizeCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): ass...
def __call__(self, results): 'Performs the RandomResizeCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): ass...
3befd14110dd6d2c8944198214f692e2c372cbb349da2b3968d3fc9c27e62afb
def __call__(self, results): 'Performs the MultiScaleCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): asser...
Performs the MultiScaleCrop augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the MultiScaleCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): asser...
def __call__(self, results): 'Performs the MultiScaleCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): asser...
a0e445595f6ee2794fc72e21b86cec6f7de80d4f704048a9035cb29b1ed2d969
@staticmethod def _box_resize(box, scale_factor): 'Rescale the bounding boxes according to the scale_factor.\n\n Args:\n box (np.ndarray): The bounding boxes.\n scale_factor (np.ndarray): The scale factor used for rescaling.\n ' assert (len(scale_factor) == 2) scale_facto...
Rescale the bounding boxes according to the scale_factor. Args: box (np.ndarray): The bounding boxes. scale_factor (np.ndarray): The scale factor used for rescaling.
mmaction/datasets/pipelines/augmentations.py
_box_resize
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def _box_resize(box, scale_factor): 'Rescale the bounding boxes according to the scale_factor.\n\n Args:\n box (np.ndarray): The bounding boxes.\n scale_factor (np.ndarray): The scale factor used for rescaling.\n ' assert (len(scale_factor) == 2) scale_facto...
@staticmethod def _box_resize(box, scale_factor): 'Rescale the bounding boxes according to the scale_factor.\n\n Args:\n box (np.ndarray): The bounding boxes.\n scale_factor (np.ndarray): The scale factor used for rescaling.\n ' assert (len(scale_factor) == 2) scale_facto...
7da6559803f6ea35176d302785396f11c9850bf4bddc8f03dd32223c51d4a1eb
def __call__(self, results): 'Performs the Resize augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (not s...
Performs the Resize augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the Resize augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (not s...
def __call__(self, results): 'Performs the Resize augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (not s...
3c9602093388e84b9535dc6015bdff0bc2dc8c0fb1a4f0a7a23dc5659cebbb8e
def __call__(self, results): 'Performs the Resize augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' short_edge = np.random.randint(self.scale_range[0], (self.scale_range[1] + 1)) resize = Re...
Performs the Resize augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the Resize augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' short_edge = np.random.randint(self.scale_range[0], (self.scale_range[1] + 1)) resize = Re...
def __call__(self, results): 'Performs the Resize augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' short_edge = np.random.randint(self.scale_range[0], (self.scale_range[1] + 1)) resize = Re...
22878b7220116cf5ff2492dd8f3099d0c36cf9abbdf6abdf1a1d76adff45413a
@staticmethod def _box_flip(box, img_width): 'Flip the bounding boxes given the width of the image.\n\n Args:\n box (np.ndarray): The bounding boxes.\n img_width (int): The img width.\n ' box_ = box.copy() box_[(..., 0::4)] = (img_width - box[(..., 2::4)]) box_[(..., ...
Flip the bounding boxes given the width of the image. Args: box (np.ndarray): The bounding boxes. img_width (int): The img width.
mmaction/datasets/pipelines/augmentations.py
_box_flip
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def _box_flip(box, img_width): 'Flip the bounding boxes given the width of the image.\n\n Args:\n box (np.ndarray): The bounding boxes.\n img_width (int): The img width.\n ' box_ = box.copy() box_[(..., 0::4)] = (img_width - box[(..., 2::4)]) box_[(..., ...
@staticmethod def _box_flip(box, img_width): 'Flip the bounding boxes given the width of the image.\n\n Args:\n box (np.ndarray): The bounding boxes.\n img_width (int): The img width.\n ' box_ = box.copy() box_[(..., 0::4)] = (img_width - box[(..., 2::4)]) box_[(..., ...
3895faa881ff7eab673e4a74ac9284ac5f94a9bf921d6cda679e6cda3410ed93
def __call__(self, results): 'Performs the Flip augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (not sel...
Performs the Flip augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the Flip augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (not sel...
def __call__(self, results): 'Performs the Flip augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (not sel...
5b483a7c00126ab485845c249e7bad7f9f8940c80d4e23af13279e49494dfe34
@staticmethod def brightness(img, delta): 'Brightness distortion.\n\n Args:\n img (np.ndarray): An input image.\n delta (float): Delta value to distort brightness.\n It ranges from [-32, 32).\n\n Returns:\n np.ndarray: A brightness distorted image.\n ...
Brightness distortion. Args: img (np.ndarray): An input image. delta (float): Delta value to distort brightness. It ranges from [-32, 32). Returns: np.ndarray: A brightness distorted image.
mmaction/datasets/pipelines/augmentations.py
brightness
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def brightness(img, delta): 'Brightness distortion.\n\n Args:\n img (np.ndarray): An input image.\n delta (float): Delta value to distort brightness.\n It ranges from [-32, 32).\n\n Returns:\n np.ndarray: A brightness distorted image.\n ...
@staticmethod def brightness(img, delta): 'Brightness distortion.\n\n Args:\n img (np.ndarray): An input image.\n delta (float): Delta value to distort brightness.\n It ranges from [-32, 32).\n\n Returns:\n np.ndarray: A brightness distorted image.\n ...
7607bd1f6815d2a818ad3dcb4cd55856e00973f844bd96079c0d80969cc591ac
@staticmethod def contrast(img, alpha): 'Contrast distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to distort contrast.\n It ranges from [0.6, 1.4).\n\n Returns:\n np.ndarray: A contrast distorted image.\n ' ...
Contrast distortion. Args: img (np.ndarray): An input image. alpha (float): Alpha value to distort contrast. It ranges from [0.6, 1.4). Returns: np.ndarray: A contrast distorted image.
mmaction/datasets/pipelines/augmentations.py
contrast
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def contrast(img, alpha): 'Contrast distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to distort contrast.\n It ranges from [0.6, 1.4).\n\n Returns:\n np.ndarray: A contrast distorted image.\n ' ...
@staticmethod def contrast(img, alpha): 'Contrast distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to distort contrast.\n It ranges from [0.6, 1.4).\n\n Returns:\n np.ndarray: A contrast distorted image.\n ' ...
271ff80d1949442ca1787d439988c62e041dc950713946c8b0a35f4faa5b4926
@staticmethod def saturation(img, alpha): 'Saturation distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to distort the saturation.\n It ranges from [0.6, 1.4).\n\n Returns:\n np.ndarray: A saturation distorted image.\...
Saturation distortion. Args: img (np.ndarray): An input image. alpha (float): Alpha value to distort the saturation. It ranges from [0.6, 1.4). Returns: np.ndarray: A saturation distorted image.
mmaction/datasets/pipelines/augmentations.py
saturation
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def saturation(img, alpha): 'Saturation distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to distort the saturation.\n It ranges from [0.6, 1.4).\n\n Returns:\n np.ndarray: A saturation distorted image.\...
@staticmethod def saturation(img, alpha): 'Saturation distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to distort the saturation.\n It ranges from [0.6, 1.4).\n\n Returns:\n np.ndarray: A saturation distorted image.\...
99c092a01ed531f7eaa71f13847add76ba8e11e98f8a24d188996661a37d04f5
@staticmethod def hue(img, alpha): 'Hue distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to control the degree of rotation\n for hue. It ranges from [-18, 18).\n\n Returns:\n np.ndarray: A hue distorted image.\n ...
Hue distortion. Args: img (np.ndarray): An input image. alpha (float): Alpha value to control the degree of rotation for hue. It ranges from [-18, 18). Returns: np.ndarray: A hue distorted image.
mmaction/datasets/pipelines/augmentations.py
hue
dumbPy/Video-Swin-Transformer
648
python
@staticmethod def hue(img, alpha): 'Hue distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to control the degree of rotation\n for hue. It ranges from [-18, 18).\n\n Returns:\n np.ndarray: A hue distorted image.\n ...
@staticmethod def hue(img, alpha): 'Hue distortion.\n\n Args:\n img (np.ndarray): An input image.\n alpha (float): Alpha value to control the degree of rotation\n for hue. It ranges from [-18, 18).\n\n Returns:\n np.ndarray: A hue distorted image.\n ...
94492e707601201aa77fc3167c96467f842d362fddff3d7db7e9269c8a80521d
def __call__(self, results): 'Performs the CenterCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (n...
Performs the CenterCrop augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the CenterCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (n...
def __call__(self, results): 'Performs the CenterCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, self.lazy) if ('keypoint' in results): assert (n...
0a2752bcad604ea6cde549ad732271367875bf5179c8a1d8eece27b6e27c692b
def __call__(self, results): 'Performs the ThreeCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, False) if (('gt_bboxes' in results) or ('proposals' in re...
Performs the ThreeCrop augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the ThreeCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, False) if (('gt_bboxes' in results) or ('proposals' in re...
def __call__(self, results): 'Performs the ThreeCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, False) if (('gt_bboxes' in results) or ('proposals' in re...
5a3f000b6cb764a0e20e00de15667e828d222a2cf68c9d7f9b227144917bd411
def __call__(self, results): 'Performs the TenCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, False) if (('gt_bboxes' in results) or ('proposals' in resu...
Performs the TenCrop augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the TenCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, False) if (('gt_bboxes' in results) or ('proposals' in resu...
def __call__(self, results): 'Performs the TenCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' _init_lazy_if_proper(results, False) if (('gt_bboxes' in results) or ('proposals' in resu...
1575652819b4543fe423259ccfe2532c1653084d2c003bec4e70b53391de74d6
def __call__(self, results): 'Performs the MultiGroupCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' if (('gt_bboxes' in results) or ('proposals' in results)): warnings.warn('Mult...
Performs the MultiGroupCrop augmentation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Performs the MultiGroupCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' if (('gt_bboxes' in results) or ('proposals' in results)): warnings.warn('Mult...
def __call__(self, results): 'Performs the MultiGroupCrop augmentation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' if (('gt_bboxes' in results) or ('proposals' in results)): warnings.warn('Mult...
8d37214a5c19456be1b09d3617c86ff3838e4ffc763fda467e7081188d7e4a9f
def __call__(self, results): 'Perfrom the audio amplification.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' assert ('audios' in results) results['audios'] *= self.ratio results['amplify_ratio'] =...
Perfrom the audio amplification. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Perfrom the audio amplification.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' assert ('audios' in results) results['audios'] *= self.ratio results['amplify_ratio'] =...
def __call__(self, results): 'Perfrom the audio amplification.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' assert ('audios' in results) results['audios'] *= self.ratio results['amplify_ratio'] =...
8a6b068e8ec3dd76aaaa9e10e75b546d1d6110fd24e73c8e01dcbef658b95cb0
def __call__(self, results): 'Perform MelSpectrogram transformation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' try: import librosa except ImportError: raise ImportError('Install li...
Perform MelSpectrogram transformation. Args: results (dict): The resulting dict to be modified and passed to the next transform in pipeline.
mmaction/datasets/pipelines/augmentations.py
__call__
dumbPy/Video-Swin-Transformer
648
python
def __call__(self, results): 'Perform MelSpectrogram transformation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' try: import librosa except ImportError: raise ImportError('Install li...
def __call__(self, results): 'Perform MelSpectrogram transformation.\n\n Args:\n results (dict): The resulting dict to be modified and passed\n to the next transform in pipeline.\n ' try: import librosa except ImportError: raise ImportError('Install li...
99855440a70829894b5215e14a1da58603eaf5c12d7e89666c67a741442821cf
def create(self, name, parent_id=1, order=None, id=None, name_en=None): '\n 创建部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90205\n\n :param name: 部门名称。长度限制为1~32个字符,字符不能包括\\:?”<>|\n :param parent_id: 父部门id,32位整型\n :param order: 在父部门中的次序值。order值大的排序靠前。有效的...
创建部门 详情请参考 https://developer.work.weixin.qq.com/document/path/90205 :param name: 部门名称。长度限制为1~32个字符,字符不能包括\:?”<>| :param parent_id: 父部门id,32位整型 :param order: 在父部门中的次序值。order值大的排序靠前。有效的值范围是[0, 2^32) :param id: 部门id,32位整型,指定时必须大于1。若不填该参数,将自动生成id :param name_en: 英文名称。同一个层级的部门名称不能重复。需要在管理后台开启多语言支持才能生效。长度限制为1~32个字符,字符不能包括:...
wechatpy/work/client/api/department.py
create
vainl/wechatpy
2,428
python
def create(self, name, parent_id=1, order=None, id=None, name_en=None): '\n 创建部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90205\n\n :param name: 部门名称。长度限制为1~32个字符,字符不能包括\\:?”<>|\n :param parent_id: 父部门id,32位整型\n :param order: 在父部门中的次序值。order值大的排序靠前。有效的...
def create(self, name, parent_id=1, order=None, id=None, name_en=None): '\n 创建部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90205\n\n :param name: 部门名称。长度限制为1~32个字符,字符不能包括\\:?”<>|\n :param parent_id: 父部门id,32位整型\n :param order: 在父部门中的次序值。order值大的排序靠前。有效的...
c05d77d3d2bd9b651b1bffab08bcb0eb463c6e58bc9fe6aa6b6377f499298863
def update(self, id, name=None, parent_id=None, order=None, name_en=None): '\n 更新部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90206\n\n :param id: 部门 id\n :param name: 部门名称。长度限制为1~32个字符,字符不能包括\\:?”<>|\n :param parent_id: 父亲部门id\n :param order: 在父...
更新部门 详情请参考 https://developer.work.weixin.qq.com/document/path/90206 :param id: 部门 id :param name: 部门名称。长度限制为1~32个字符,字符不能包括\:?”<>| :param parent_id: 父亲部门id :param order: 在父部门中的次序值。order值大的排序靠前。有效的值范围是[0, 2^32) :param name_en: 英文名称。同一个层级的部门名称不能重复。需要在管理后台开启多语言支持才能生效。长度限制为1~32个字符,字符不能包括:*?"<>| :return: 返回的 JSON 数据包
wechatpy/work/client/api/department.py
update
vainl/wechatpy
2,428
python
def update(self, id, name=None, parent_id=None, order=None, name_en=None): '\n 更新部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90206\n\n :param id: 部门 id\n :param name: 部门名称。长度限制为1~32个字符,字符不能包括\\:?”<>|\n :param parent_id: 父亲部门id\n :param order: 在父...
def update(self, id, name=None, parent_id=None, order=None, name_en=None): '\n 更新部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90206\n\n :param id: 部门 id\n :param name: 部门名称。长度限制为1~32个字符,字符不能包括\\:?”<>|\n :param parent_id: 父亲部门id\n :param order: 在父...
3b4a4e2906464060b22fad37deb5037bf178e78e677327e23187684e3bf6ca19
def delete(self, id): '\n 删除部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90207\n\n :param id: 部门id。(注:不能删除根部门;不能删除含有子部门、成员的部门)\n :return: 返回的 JSON 数据包\n ' return self._get('department/delete', params={'id': id})
删除部门 详情请参考 https://developer.work.weixin.qq.com/document/path/90207 :param id: 部门id。(注:不能删除根部门;不能删除含有子部门、成员的部门) :return: 返回的 JSON 数据包
wechatpy/work/client/api/department.py
delete
vainl/wechatpy
2,428
python
def delete(self, id): '\n 删除部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90207\n\n :param id: 部门id。(注:不能删除根部门;不能删除含有子部门、成员的部门)\n :return: 返回的 JSON 数据包\n ' return self._get('department/delete', params={'id': id})
def delete(self, id): '\n 删除部门\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90207\n\n :param id: 部门id。(注:不能删除根部门;不能删除含有子部门、成员的部门)\n :return: 返回的 JSON 数据包\n ' return self._get('department/delete', params={'id': id})<|docstring|>删除部门 详情请参考 https://devel...
726f8ecbc0a876569047311a15d713088c996e752e842d9b9038b3220651dbc4
def list(self, id=None): '\n 获取指定部门列表\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90208\n\n 权限说明:\n 只能拉取token对应的应用的权限范围内的部门列表\n\n :param id: 部门id。获取指定部门及其下的子部门。 如果不填,默认获取全量组织架构\n :return: 部门列表\n ' if (id is None): res = self._get...
获取指定部门列表 详情请参考 https://developer.work.weixin.qq.com/document/path/90208 权限说明: 只能拉取token对应的应用的权限范围内的部门列表 :param id: 部门id。获取指定部门及其下的子部门。 如果不填,默认获取全量组织架构 :return: 部门列表
wechatpy/work/client/api/department.py
list
vainl/wechatpy
2,428
python
def list(self, id=None): '\n 获取指定部门列表\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90208\n\n 权限说明:\n 只能拉取token对应的应用的权限范围内的部门列表\n\n :param id: 部门id。获取指定部门及其下的子部门。 如果不填,默认获取全量组织架构\n :return: 部门列表\n ' if (id is None): res = self._get...
def list(self, id=None): '\n 获取指定部门列表\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/90208\n\n 权限说明:\n 只能拉取token对应的应用的权限范围内的部门列表\n\n :param id: 部门id。获取指定部门及其下的子部门。 如果不填,默认获取全量组织架构\n :return: 部门列表\n ' if (id is None): res = self._get...
695df7e7251ed8b0ece0efebe180e8c5f7364359cd121806a968efc98ec1539b
def simple_list(self, id=None): '\n 获取子部门 ID 列表,和 list 接口相比,此接口只返回部门 ID,ORDER 和 PARENTID 字段\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/95350\n\n :param id: 部门id。获取指定部门及其下的子部门(以及子部门的子部门等等,递归)。 如果不填,默认获取全量组织架构\n :return: 部门列表\n ' if (id is None): ...
获取子部门 ID 列表,和 list 接口相比,此接口只返回部门 ID,ORDER 和 PARENTID 字段 详情请参考 https://developer.work.weixin.qq.com/document/path/95350 :param id: 部门id。获取指定部门及其下的子部门(以及子部门的子部门等等,递归)。 如果不填,默认获取全量组织架构 :return: 部门列表
wechatpy/work/client/api/department.py
simple_list
vainl/wechatpy
2,428
python
def simple_list(self, id=None): '\n 获取子部门 ID 列表,和 list 接口相比,此接口只返回部门 ID,ORDER 和 PARENTID 字段\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/95350\n\n :param id: 部门id。获取指定部门及其下的子部门(以及子部门的子部门等等,递归)。 如果不填,默认获取全量组织架构\n :return: 部门列表\n ' if (id is None): ...
def simple_list(self, id=None): '\n 获取子部门 ID 列表,和 list 接口相比,此接口只返回部门 ID,ORDER 和 PARENTID 字段\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/95350\n\n :param id: 部门id。获取指定部门及其下的子部门(以及子部门的子部门等等,递归)。 如果不填,默认获取全量组织架构\n :return: 部门列表\n ' if (id is None): ...
f99b3c91a20407a81d21ac3baec80ea53e16ab9161cee82703d2b3b2195c085c
def get(self, id): '\n 获取单个部门详情\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/95351\n\n :param id: 部门 ID\n :return: 部门信息\n ' res = self._get('department/get', params={'id': id}) return res['department']
获取单个部门详情 详情请参考 https://developer.work.weixin.qq.com/document/path/95351 :param id: 部门 ID :return: 部门信息
wechatpy/work/client/api/department.py
get
vainl/wechatpy
2,428
python
def get(self, id): '\n 获取单个部门详情\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/95351\n\n :param id: 部门 ID\n :return: 部门信息\n ' res = self._get('department/get', params={'id': id}) return res['department']
def get(self, id): '\n 获取单个部门详情\n\n 详情请参考\n https://developer.work.weixin.qq.com/document/path/95351\n\n :param id: 部门 ID\n :return: 部门信息\n ' res = self._get('department/get', params={'id': id}) return res['department']<|docstring|>获取单个部门详情 详情请参考 https://developer....
f77501acbaf7797dce664a10e9eec45c9770e338ad9d84c1164751f245cabdd0
def get_users(self, id, fetch_child=0, simple=True): '\n 获取部门成员:https://developer.work.weixin.qq.com/document/path/90200\n\n 获取部门成员详情:https://developer.work.weixin.qq.com/document/path/90201\n\n :param id: 部门 id\n :param fetch_child: 1/0:是否递归获取子部门下面的成员\n :param simple: True 获取部门成员...
获取部门成员:https://developer.work.weixin.qq.com/document/path/90200 获取部门成员详情:https://developer.work.weixin.qq.com/document/path/90201 :param id: 部门 id :param fetch_child: 1/0:是否递归获取子部门下面的成员 :param simple: True 获取部门成员,False 获取部门成员详情 :return: 部门成员列表
wechatpy/work/client/api/department.py
get_users
vainl/wechatpy
2,428
python
def get_users(self, id, fetch_child=0, simple=True): '\n 获取部门成员:https://developer.work.weixin.qq.com/document/path/90200\n\n 获取部门成员详情:https://developer.work.weixin.qq.com/document/path/90201\n\n :param id: 部门 id\n :param fetch_child: 1/0:是否递归获取子部门下面的成员\n :param simple: True 获取部门成员...
def get_users(self, id, fetch_child=0, simple=True): '\n 获取部门成员:https://developer.work.weixin.qq.com/document/path/90200\n\n 获取部门成员详情:https://developer.work.weixin.qq.com/document/path/90201\n\n :param id: 部门 id\n :param fetch_child: 1/0:是否递归获取子部门下面的成员\n :param simple: True 获取部门成员...
69bda341c68ea10c176cae587756ecb76599dcc94896fa8a0e8816c0317b2ec3
def get_map_users(self, id=None, key='name', fetch_child=0): '\n 映射员工某详细字段到 ``user_id``\n\n 企业微信许多对员工操作依赖于 ``user_id`` ,但没有提供直接查询员工对应 ``user_id`` 的结构,\n\n 这里是一个变通的方法,常用于储存员工 ``user_id`` ,并用于后续查询或对单人操作(如发送指定消息)\n\n :param id: 部门 id, 如果不填,默认获取有权限的所有部门\n :param key: 员工详细信息字段 key,所指向的...
映射员工某详细字段到 ``user_id`` 企业微信许多对员工操作依赖于 ``user_id`` ,但没有提供直接查询员工对应 ``user_id`` 的结构, 这里是一个变通的方法,常用于储存员工 ``user_id`` ,并用于后续查询或对单人操作(如发送指定消息) :param id: 部门 id, 如果不填,默认获取有权限的所有部门 :param key: 员工详细信息字段 key,所指向的值必须唯一 :param fetch_child: 1/0:是否递归获取子部门下面的成员 :return: dict - 部门成员指定字段到 user_id 的 map ``{ key: user_id }``
wechatpy/work/client/api/department.py
get_map_users
vainl/wechatpy
2,428
python
def get_map_users(self, id=None, key='name', fetch_child=0): '\n 映射员工某详细字段到 ``user_id``\n\n 企业微信许多对员工操作依赖于 ``user_id`` ,但没有提供直接查询员工对应 ``user_id`` 的结构,\n\n 这里是一个变通的方法,常用于储存员工 ``user_id`` ,并用于后续查询或对单人操作(如发送指定消息)\n\n :param id: 部门 id, 如果不填,默认获取有权限的所有部门\n :param key: 员工详细信息字段 key,所指向的...
def get_map_users(self, id=None, key='name', fetch_child=0): '\n 映射员工某详细字段到 ``user_id``\n\n 企业微信许多对员工操作依赖于 ``user_id`` ,但没有提供直接查询员工对应 ``user_id`` 的结构,\n\n 这里是一个变通的方法,常用于储存员工 ``user_id`` ,并用于后续查询或对单人操作(如发送指定消息)\n\n :param id: 部门 id, 如果不填,默认获取有权限的所有部门\n :param key: 员工详细信息字段 key,所指向的...
ff4916c67b60353a5d26e8ab7555270924e4a4e280b00824dc7efd324350fc6a
def __init__(self, graph, draw=False): '\n Constructor\n :param graph: Graph of the network to analyze\n ' self.graph = graph if draw: nx.draw_planar(self.graph) plt.show()
Constructor :param graph: Graph of the network to analyze
general_methods/nodal_analysis.py
__init__
bcornelusse/ELEC0053-circuits-electriques
3
python
def __init__(self, graph, draw=False): '\n Constructor\n :param graph: Graph of the network to analyze\n ' self.graph = graph if draw: nx.draw_planar(self.graph) plt.show()
def __init__(self, graph, draw=False): '\n Constructor\n :param graph: Graph of the network to analyze\n ' self.graph = graph if draw: nx.draw_planar(self.graph) plt.show()<|docstring|>Constructor :param graph: Graph of the network to analyze<|endoftext|>
f79303b134f82b4b10088de0b5b573ccac86cb003d107049de541ac90a74bf65
def solve(self, reference_node): '\n TODO Only handles the case of Resistors + independent current sources, should also handle VCT\n :param reference_node: reference node used for the solution\n :return: a map: node -> node potential\n ' passified_graph = nx.MultiDiGraph() for (u...
TODO Only handles the case of Resistors + independent current sources, should also handle VCT :param reference_node: reference node used for the solution :return: a map: node -> node potential
general_methods/nodal_analysis.py
solve
bcornelusse/ELEC0053-circuits-electriques
3
python
def solve(self, reference_node): '\n TODO Only handles the case of Resistors + independent current sources, should also handle VCT\n :param reference_node: reference node used for the solution\n :return: a map: node -> node potential\n ' passified_graph = nx.MultiDiGraph() for (u...
def solve(self, reference_node): '\n TODO Only handles the case of Resistors + independent current sources, should also handle VCT\n :param reference_node: reference node used for the solution\n :return: a map: node -> node potential\n ' passified_graph = nx.MultiDiGraph() for (u...
65e759e7c21cfcecf4b589781b4e559ae725ad4d47f14a6ffdb3491bd97c7ac7
def plot_histogram(hist, x_label, y_label=None, is_num=True, is_ts=False, pdf_file_name='', top=20): 'Create and plot histogram of column values.\n\n :param hist: input numpy histogram = values, bin_edges\n :param str x_label: Label for histogram x-axis\n :param str y_label: Label for histogram y-axis\n ...
Create and plot histogram of column values. :param hist: input numpy histogram = values, bin_edges :param str x_label: Label for histogram x-axis :param str y_label: Label for histogram y-axis :param bool is_num: True if observable to plot is numeric :param bool is_ts: True if observable to plot is a timestamp :param ...
python/eskapade/visualization/vis_utils.py
plot_histogram
mbaak/Eskapade
16
python
def plot_histogram(hist, x_label, y_label=None, is_num=True, is_ts=False, pdf_file_name=, top=20): 'Create and plot histogram of column values.\n\n :param hist: input numpy histogram = values, bin_edges\n :param str x_label: Label for histogram x-axis\n :param str y_label: Label for histogram y-axis\n :...
def plot_histogram(hist, x_label, y_label=None, is_num=True, is_ts=False, pdf_file_name=, top=20): 'Create and plot histogram of column values.\n\n :param hist: input numpy histogram = values, bin_edges\n :param str x_label: Label for histogram x-axis\n :param str y_label: Label for histogram y-axis\n :...
b4ec8ce4f7d60f6765bf4cf45f7b469fdb95b420e861d2d8299b497fe781d9cd
def plot_2d_histogram(hist, x_lim, y_lim, title, x_label, y_label, pdf_file_name): 'Plot 2d histogram with matplotlib.\n\n :param hist: input numpy histogram = x_bin_edges, y_bin_edges, bin_entries_2dgrid\n :param tuple x_lim: range tuple of x-axis (min,max)\n :param tuple y_lim: range tuple of y-axis (min...
Plot 2d histogram with matplotlib. :param hist: input numpy histogram = x_bin_edges, y_bin_edges, bin_entries_2dgrid :param tuple x_lim: range tuple of x-axis (min,max) :param tuple y_lim: range tuple of y-axis (min,max) :param str title: title of plot :param str x_label: Label for histogram x-axis :param str y_label:...
python/eskapade/visualization/vis_utils.py
plot_2d_histogram
mbaak/Eskapade
16
python
def plot_2d_histogram(hist, x_lim, y_lim, title, x_label, y_label, pdf_file_name): 'Plot 2d histogram with matplotlib.\n\n :param hist: input numpy histogram = x_bin_edges, y_bin_edges, bin_entries_2dgrid\n :param tuple x_lim: range tuple of x-axis (min,max)\n :param tuple y_lim: range tuple of y-axis (min...
def plot_2d_histogram(hist, x_lim, y_lim, title, x_label, y_label, pdf_file_name): 'Plot 2d histogram with matplotlib.\n\n :param hist: input numpy histogram = x_bin_edges, y_bin_edges, bin_entries_2dgrid\n :param tuple x_lim: range tuple of x-axis (min,max)\n :param tuple y_lim: range tuple of y-axis (min...
256536e124796c5b3c4059bded77ed376f05efeb06382e9439b485a587fd66ec
def delete_smallstat(df, group_col, statlim=400): 'Remove low-statistics groups from dataframe.\n\n Function to make a new DataFrame that removes all groups of group_col that have less than statlim entries.\n\n :param df: pandas DataFrame\n :param str group_col: name of the column to group on\n :param i...
Remove low-statistics groups from dataframe. Function to make a new DataFrame that removes all groups of group_col that have less than statlim entries. :param df: pandas DataFrame :param str group_col: name of the column to group on :param int statlim: number of entries a group has to have to be statistically signifi...
python/eskapade/visualization/vis_utils.py
delete_smallstat
mbaak/Eskapade
16
python
def delete_smallstat(df, group_col, statlim=400): 'Remove low-statistics groups from dataframe.\n\n Function to make a new DataFrame that removes all groups of group_col that have less than statlim entries.\n\n :param df: pandas DataFrame\n :param str group_col: name of the column to group on\n :param i...
def delete_smallstat(df, group_col, statlim=400): 'Remove low-statistics groups from dataframe.\n\n Function to make a new DataFrame that removes all groups of group_col that have less than statlim entries.\n\n :param df: pandas DataFrame\n :param str group_col: name of the column to group on\n :param i...
2c4940976f30c5874e843a65fd0f6e524f5c7e2e74c8c7176049ecfd469ada8a
def box_plot(df, cause_col, result_col='cost', pdf_file_name='', ylim_quant=0.95, ylim_high=None, ylim_low=0, rot=90, statlim=400, label_dict=None, title_add='', top=20): "Make box plot.\n\n Function that plots the boxplot of the column df[result_col] in groups of cause_col. This means that\n the DataFrame is...
Make box plot. Function that plots the boxplot of the column df[result_col] in groups of cause_col. This means that the DataFrame is grouped-by on the cause column and then the distribution per group is plotted in a boxplot using the standard pandas functionality. Boxplots with less than statlim (default=400 ) entries...
python/eskapade/visualization/vis_utils.py
box_plot
mbaak/Eskapade
16
python
def box_plot(df, cause_col, result_col='cost', pdf_file_name=, ylim_quant=0.95, ylim_high=None, ylim_low=0, rot=90, statlim=400, label_dict=None, title_add=, top=20): "Make box plot.\n\n Function that plots the boxplot of the column df[result_col] in groups of cause_col. This means that\n the DataFrame is gro...
def box_plot(df, cause_col, result_col='cost', pdf_file_name=, ylim_quant=0.95, ylim_high=None, ylim_low=0, rot=90, statlim=400, label_dict=None, title_add=, top=20): "Make box plot.\n\n Function that plots the boxplot of the column df[result_col] in groups of cause_col. This means that\n the DataFrame is gro...
2a36d462721c17071f32db141e6a12f0d36bdd14682a3b6ffef673fa06b941a0
def plot_correlation_matrix(matrix_colors, x_labels, y_labels, pdf_file_name='', title='correlation', vmin=(- 1), vmax=1, color_map='RdYlGn', x_label='', y_label='', top=20, matrix_numbers=None, print_both_numbers=True): "Create and plot correlation matrix.\n\n :param matrix_colors: input correlation matrix\n ...
Create and plot correlation matrix. :param matrix_colors: input correlation matrix :param list x_labels: Labels for histogram x-axis bins :param list y_labels: Labels for histogram y-axis bins :param str pdf_file_name: if set, will store the plot in a pdf file :param str title: if set, title of the plot :param float v...
python/eskapade/visualization/vis_utils.py
plot_correlation_matrix
mbaak/Eskapade
16
python
def plot_correlation_matrix(matrix_colors, x_labels, y_labels, pdf_file_name=, title='correlation', vmin=(- 1), vmax=1, color_map='RdYlGn', x_label=, y_label=, top=20, matrix_numbers=None, print_both_numbers=True): "Create and plot correlation matrix.\n\n :param matrix_colors: input correlation matrix\n :para...
def plot_correlation_matrix(matrix_colors, x_labels, y_labels, pdf_file_name=, title='correlation', vmin=(- 1), vmax=1, color_map='RdYlGn', x_label=, y_label=, top=20, matrix_numbers=None, print_both_numbers=True): "Create and plot correlation matrix.\n\n :param matrix_colors: input correlation matrix\n :para...
013709e1831186416df2b26b9b56ba01caec17d90cf9b49be4c5cc697282cdf9
def plot_overlay_histogram(hists, x_label, y_label=None, hist_names=[], is_num=True, is_ts=False, pdf_file_name='', top=20, width_in=None, xlim=None): 'Create and plot overlapping histograms of column values.\n\n :param hists: list of input numpy histogram = values, bin_edges\n :param str x_label: Label for h...
Create and plot overlapping histograms of column values. :param hists: list of input numpy histogram = values, bin_edges :param str x_label: Label for histogram x-axis :param str y_label: Label for histogram y-axis :param bool is_num: True if observable to plot is numeric :param bool is_ts: True if observable to plot ...
python/eskapade/visualization/vis_utils.py
plot_overlay_histogram
mbaak/Eskapade
16
python
def plot_overlay_histogram(hists, x_label, y_label=None, hist_names=[], is_num=True, is_ts=False, pdf_file_name=, top=20, width_in=None, xlim=None): 'Create and plot overlapping histograms of column values.\n\n :param hists: list of input numpy histogram = values, bin_edges\n :param str x_label: Label for his...
def plot_overlay_histogram(hists, x_label, y_label=None, hist_names=[], is_num=True, is_ts=False, pdf_file_name=, top=20, width_in=None, xlim=None): 'Create and plot overlapping histograms of column values.\n\n :param hists: list of input numpy histogram = values, bin_edges\n :param str x_label: Label for his...
11a30755253fffcf9a81af00ef4967ba29ca1ea7a90f630347b19a74d1c39743
def plot_pair_grid(data, title, fpath, column_names=[], data2=None): 'Plot a pairgrid for one or two datasets\n :param array data: Input data to plot\n :param str title: Title of the plot\n :param str fpath: if set, will store the plot in a pdf file\n :param list column_names: list of column names to be...
Plot a pairgrid for one or two datasets :param array data: Input data to plot :param str title: Title of the plot :param str fpath: if set, will store the plot in a pdf file :param list column_names: list of column names to be give to the plot :param array data2: second dataset to be plot in the pairgrid.
python/eskapade/visualization/vis_utils.py
plot_pair_grid
mbaak/Eskapade
16
python
def plot_pair_grid(data, title, fpath, column_names=[], data2=None): 'Plot a pairgrid for one or two datasets\n :param array data: Input data to plot\n :param str title: Title of the plot\n :param str fpath: if set, will store the plot in a pdf file\n :param list column_names: list of column names to be...
def plot_pair_grid(data, title, fpath, column_names=[], data2=None): 'Plot a pairgrid for one or two datasets\n :param array data: Input data to plot\n :param str title: Title of the plot\n :param str fpath: if set, will store the plot in a pdf file\n :param list column_names: list of column names to be...
49d224934e9aeb86834b2f30a1e6baf0a9481018f033f39d13a5516843d5eb0d
def tick(lab): 'Get tick.' if isinstance(lab, (float, int)): lab = ('NaN' if np.isnan(lab) else '{0:.1f}'.format(lab)) lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab
Get tick.
python/eskapade/visualization/vis_utils.py
tick
mbaak/Eskapade
16
python
def tick(lab): if isinstance(lab, (float, int)): lab = ('NaN' if np.isnan(lab) else '{0:.1f}'.format(lab)) lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab
def tick(lab): if isinstance(lab, (float, int)): lab = ('NaN' if np.isnan(lab) else '{0:.1f}'.format(lab)) lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab<|docstring|>Get tick.<|endoftext|>
6cf9903a0838f70aeca3936a57689958c47744bc05bc098b842f117b22f76ad9
def xtick(lab): 'Get x-tick.' lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab
Get x-tick.
python/eskapade/visualization/vis_utils.py
xtick
mbaak/Eskapade
16
python
def xtick(lab): lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab
def xtick(lab): lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab<|docstring|>Get x-tick.<|endoftext|>
6cf9903a0838f70aeca3936a57689958c47744bc05bc098b842f117b22f76ad9
def xtick(lab): 'Get x-tick.' lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab
Get x-tick.
python/eskapade/visualization/vis_utils.py
xtick
mbaak/Eskapade
16
python
def xtick(lab): lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab
def xtick(lab): lab = str(lab) if (len(lab) > top): lab = (lab[:17] + '...') return lab<|docstring|>Get x-tick.<|endoftext|>
b0f5dcdb8dda91a5b177b8e184ae7ce05db2f5d27d7e83ea61148a22eea54f5e
def validate_persistent_hash(ht): 'NOT RPYTHON' root = ht._root assert (((root is None) and (ht._cnt == 0)) or ((root is not None) and (ht._cnt == root._size))) if (root is not None): validate_nodes(root)
NOT RPYTHON
pycket/hash/persistent_hash_map.py
validate_persistent_hash
namin/pycket
129
python
def validate_persistent_hash(ht): root = ht._root assert (((root is None) and (ht._cnt == 0)) or ((root is not None) and (ht._cnt == root._size))) if (root is not None): validate_nodes(root)
def validate_persistent_hash(ht): root = ht._root assert (((root is None) and (ht._cnt == 0)) or ((root is not None) and (ht._cnt == root._size))) if (root is not None): validate_nodes(root)<|docstring|>NOT RPYTHON<|endoftext|>
4cf865fc2e1170a9ef7418368abe11cfdf4e1027d96264768e45e8d97e8a2ea1
def validate_nodes(root): 'NOT RPYTHON' subnodes = root._subnodes() entries = root._entries() subnode_count = sum((node._size for node in subnodes)) total = (subnode_count + len(entries)) assert (root._size == total) for node in subnodes: validate_nodes(node)
NOT RPYTHON
pycket/hash/persistent_hash_map.py
validate_nodes
namin/pycket
129
python
def validate_nodes(root): subnodes = root._subnodes() entries = root._entries() subnode_count = sum((node._size for node in subnodes)) total = (subnode_count + len(entries)) assert (root._size == total) for node in subnodes: validate_nodes(node)
def validate_nodes(root): subnodes = root._subnodes() entries = root._entries() subnode_count = sum((node._size for node in subnodes)) total = (subnode_count + len(entries)) assert (root._size == total) for node in subnodes: validate_nodes(node)<|docstring|>NOT RPYTHON<|endoftext|>
db2ee5c560d9a9a0b633dfb72dcbdb6fc0af21f0eeaf59faa4aaf088760f5e8a
def _validate_node(self): 'NOT RPYTHON' pass
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_validate_node
namin/pycket
129
python
def _validate_node(self): pass
def _validate_node(self): pass<|docstring|>NOT RPYTHON<|endoftext|>
ba3a77cfb462846f193f7f83bf16633ca491b673543cff847ce5943135559e17
def _entries(self): 'NOT RPYTHON' pass
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_entries
namin/pycket
129
python
def _entries(self): pass
def _entries(self): pass<|docstring|>NOT RPYTHON<|endoftext|>
4ffd3f0c67d735d19bec3bca6a11ab04bda6f29e2e26e590fbc4f788f9b24fee
def _subnodes(self): 'NOT RPYTHON' pass
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_subnodes
namin/pycket
129
python
def _subnodes(self): pass
def _subnodes(self): pass<|docstring|>NOT RPYTHON<|endoftext|>
21950ac7ccbd05909604a51b3b39a478c98d71bf30c3aba283cffa26d01f63dd
def _entries(self): 'NOT RPYTHON' entries = [] for x in range((len(self._array) / 2)): (key_or_none, val_or_node) = self.entry(x) if ((key_or_none is not None) or (val_or_node is None)): entries.append((key_or_none, val_or_node)) return entries
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_entries
namin/pycket
129
python
def _entries(self): entries = [] for x in range((len(self._array) / 2)): (key_or_none, val_or_node) = self.entry(x) if ((key_or_none is not None) or (val_or_node is None)): entries.append((key_or_none, val_or_node)) return entries
def _entries(self): entries = [] for x in range((len(self._array) / 2)): (key_or_none, val_or_node) = self.entry(x) if ((key_or_none is not None) or (val_or_node is None)): entries.append((key_or_none, val_or_node)) return entries<|docstring|>NOT RPYTHON<|endoftext|>
0de899dc52f7169f164689c9c596794876e888579932d13c6982848100c72051
def _subnodes(self): 'NOT RPYTHON' subnodes = [] for x in range((len(self._array) / 2)): (key_or_none, val_or_node) = self.entry(x) if ((key_or_none is None) and (val_or_node is not None)): assert isinstance(val_or_node, INode) subnodes.append(val_or_node) return ...
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_subnodes
namin/pycket
129
python
def _subnodes(self): subnodes = [] for x in range((len(self._array) / 2)): (key_or_none, val_or_node) = self.entry(x) if ((key_or_none is None) and (val_or_node is not None)): assert isinstance(val_or_node, INode) subnodes.append(val_or_node) return subnodes
def _subnodes(self): subnodes = [] for x in range((len(self._array) / 2)): (key_or_none, val_or_node) = self.entry(x) if ((key_or_none is None) and (val_or_node is not None)): assert isinstance(val_or_node, INode) subnodes.append(val_or_node) return subnodes<|doc...
08b9258f25d0221e099b0b01b92a089608558e24d81bd68e548b9886a106a090
@objectmodel.always_inline def entry(self, index): ' Helper function to extract the ith key/value pair ' base = (index * 2) key = self._array[base] val = self._array[(base + 1)] return (key, val)
Helper function to extract the ith key/value pair
pycket/hash/persistent_hash_map.py
entry
namin/pycket
129
python
@objectmodel.always_inline def entry(self, index): ' ' base = (index * 2) key = self._array[base] val = self._array[(base + 1)] return (key, val)
@objectmodel.always_inline def entry(self, index): ' ' base = (index * 2) key = self._array[base] val = self._array[(base + 1)] return (key, val)<|docstring|>Helper function to extract the ith key/value pair<|endoftext|>
602778d126b62c4d5b491a42943a0fb1a1f0594b277765a63becf48333a2a2bd
def _entries(self): 'NOT RPYTHON' return []
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_entries
namin/pycket
129
python
def _entries(self): return []
def _entries(self): return []<|docstring|>NOT RPYTHON<|endoftext|>
9ba1aa61be9a724098738fee2cb94709e1ba04feb4c5a874e173fad3f9793fef
def _subnodes(self): 'NOT RPYTHON' return [node for node in self._array if (node is not None)]
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_subnodes
namin/pycket
129
python
def _subnodes(self): return [node for node in self._array if (node is not None)]
def _subnodes(self): return [node for node in self._array if (node is not None)]<|docstring|>NOT RPYTHON<|endoftext|>
08b9258f25d0221e099b0b01b92a089608558e24d81bd68e548b9886a106a090
@objectmodel.always_inline def entry(self, index): ' Helper function to extract the ith key/value pair ' base = (index * 2) key = self._array[base] val = self._array[(base + 1)] return (key, val)
Helper function to extract the ith key/value pair
pycket/hash/persistent_hash_map.py
entry
namin/pycket
129
python
@objectmodel.always_inline def entry(self, index): ' ' base = (index * 2) key = self._array[base] val = self._array[(base + 1)] return (key, val)
@objectmodel.always_inline def entry(self, index): ' ' base = (index * 2) key = self._array[base] val = self._array[(base + 1)] return (key, val)<|docstring|>Helper function to extract the ith key/value pair<|endoftext|>
2c0f896e0d03840f3ff8719a66ed0dc801f586656f0a6237caa628e3ec699d1d
def _entries(self): 'NOT RPYTHON' entries = [] for x in range((len(self._array) / 2)): key_or_none = self.keyat(x) if (key_or_none is None): continue val = self.valat(x) entries.append((key_or_none, val)) return entries
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_entries
namin/pycket
129
python
def _entries(self): entries = [] for x in range((len(self._array) / 2)): key_or_none = self.keyat(x) if (key_or_none is None): continue val = self.valat(x) entries.append((key_or_none, val)) return entries
def _entries(self): entries = [] for x in range((len(self._array) / 2)): key_or_none = self.keyat(x) if (key_or_none is None): continue val = self.valat(x) entries.append((key_or_none, val)) return entries<|docstring|>NOT RPYTHON<|endoftext|>
205b7198ea47c88a0edb0cb48ae9323e98751048b94b1df3a17a4ad89612657f
def _subnodes(self): 'NOT RPYTHON' return []
NOT RPYTHON
pycket/hash/persistent_hash_map.py
_subnodes
namin/pycket
129
python
def _subnodes(self): return []
def _subnodes(self): return []<|docstring|>NOT RPYTHON<|endoftext|>
99c7d1a90cbe39c0ca76b8c554e01a8f04910310d3c328b2ad8d885d746e58db
def union(self, other): '\n Performs a right biased union via iterated insertion. This could be\n made faster at the cost of me figuring out how to actually implement\n a proper union operation.\n This skews the asymptotics a little since the implementation of\n ...
Performs a right biased union via iterated insertion. This could be made faster at the cost of me figuring out how to actually implement a proper union operation. This skews the asymptotics a little since the implementation of iteration is O(n lg n) as is insertion.
pycket/hash/persistent_hash_map.py
union
namin/pycket
129
python
def union(self, other): '\n Performs a right biased union via iterated insertion. This could be\n made faster at the cost of me figuring out how to actually implement\n a proper union operation.\n This skews the asymptotics a little since the implementation of\n ...
def union(self, other): '\n Performs a right biased union via iterated insertion. This could be\n made faster at the cost of me figuring out how to actually implement\n a proper union operation.\n This skews the asymptotics a little since the implementation of\n ...
04552f4e9506c339044eadd33af50c2f4b91a24fc3450e33014f27f192835c25
def __change_students_names(self): 'Replaces `ё` with `е` in each name to sort names properly' for student in self.students: student.name = student.name.replace('ё', 'е')
Replaces `ё` with `е` in each name to sort names properly
src/export.py
__change_students_names
NChechulin/python-yandex-contest-tools
3
python
def __change_students_names(self): for student in self.students: student.name = student.name.replace('ё', 'е')
def __change_students_names(self): for student in self.students: student.name = student.name.replace('ё', 'е')<|docstring|>Replaces `ё` with `е` in each name to sort names properly<|endoftext|>
242f893c45b12d1610b7ff87173ca16c702af13c0a340ad1d96e169ba7036c9a
def _task_result_to_symbol(self, task_result: TaskResult) -> str: "Returns a symbol corresponding to student's result" if (task_result == TaskResult.Solved): return self.solved_symbol elif (task_result == TaskResult.Banned): return self.banned_symbol return self.not_solved_symbol
Returns a symbol corresponding to student's result
src/export.py
_task_result_to_symbol
NChechulin/python-yandex-contest-tools
3
python
def _task_result_to_symbol(self, task_result: TaskResult) -> str: if (task_result == TaskResult.Solved): return self.solved_symbol elif (task_result == TaskResult.Banned): return self.banned_symbol return self.not_solved_symbol
def _task_result_to_symbol(self, task_result: TaskResult) -> str: if (task_result == TaskResult.Solved): return self.solved_symbol elif (task_result == TaskResult.Banned): return self.banned_symbol return self.not_solved_symbol<|docstring|>Returns a symbol corresponding to student's res...
aff27ad196f698f88dffcc781666b4f962ea5f8906e5568a16ad7f7acac9add3
def __set_filename(self, output_dir: Path) -> str: 'Returns a filename (stem) where the data will be saved' name = datetime.now().strftime('%Y-%m-%d_%H_%M_%S') self.filename = (output_dir / f'RESULTS_{name}.{self.extension}')
Returns a filename (stem) where the data will be saved
src/export.py
__set_filename
NChechulin/python-yandex-contest-tools
3
python
def __set_filename(self, output_dir: Path) -> str: name = datetime.now().strftime('%Y-%m-%d_%H_%M_%S') self.filename = (output_dir / f'RESULTS_{name}.{self.extension}')
def __set_filename(self, output_dir: Path) -> str: name = datetime.now().strftime('%Y-%m-%d_%H_%M_%S') self.filename = (output_dir / f'RESULTS_{name}.{self.extension}')<|docstring|>Returns a filename (stem) where the data will be saved<|endoftext|>
4ea775981e43c2a0eb0bc19273c22667b3d0bfc88ea19de050cf9ffbad527898
def __write_header_to_file(self): 'Writes column names' raise NotImplementedError()
Writes column names
src/export.py
__write_header_to_file
NChechulin/python-yandex-contest-tools
3
python
def __write_header_to_file(self): raise NotImplementedError()
def __write_header_to_file(self): raise NotImplementedError()<|docstring|>Writes column names<|endoftext|>
bd93d22e1c925fa3e8b9d2b64178326cfe325a084664e48d059e197fcd5e33c7
def __write_students_data(self): 'Writes the results of students into the file' raise NotImplementedError()
Writes the results of students into the file
src/export.py
__write_students_data
NChechulin/python-yandex-contest-tools
3
python
def __write_students_data(self): raise NotImplementedError()
def __write_students_data(self): raise NotImplementedError()<|docstring|>Writes the results of students into the file<|endoftext|>
67d097e04aaad8e68b5c5bef5d7adeb59e4e25baaed05c645bbdc3587362f8d0
def write(self): 'Writes the all of the data into a file' raise NotImplementedError()
Writes the all of the data into a file
src/export.py
write
NChechulin/python-yandex-contest-tools
3
python
def write(self): raise NotImplementedError()
def write(self): raise NotImplementedError()<|docstring|>Writes the all of the data into a file<|endoftext|>
38aabfd34df0f1576926492b32c7a08b9c9336ed63a998be0d69d70db5e78f18
def __write_header_to_file(self): 'Writes column names' columns = ['name'] for task in self.tasks: columns.append(task.name) with open(self.filename, 'x') as fh: writer = csv.writer(fh) writer.writerow(columns)
Writes column names
src/export.py
__write_header_to_file
NChechulin/python-yandex-contest-tools
3
python
def __write_header_to_file(self): columns = ['name'] for task in self.tasks: columns.append(task.name) with open(self.filename, 'x') as fh: writer = csv.writer(fh) writer.writerow(columns)
def __write_header_to_file(self): columns = ['name'] for task in self.tasks: columns.append(task.name) with open(self.filename, 'x') as fh: writer = csv.writer(fh) writer.writerow(columns)<|docstring|>Writes column names<|endoftext|>
900ebbd0544279b6a0a8ae7c7659f6bd959263027bfeca99cc60263cecc3f41f
def __write_students_data(self): 'Writes the results of students into the file' with open(self.filename, 'a') as fh: writer = csv.writer(fh) for student in self.students: row = [student.name] for task in self.tasks: symbol = self._task_result_to_symbol(stu...
Writes the results of students into the file
src/export.py
__write_students_data
NChechulin/python-yandex-contest-tools
3
python
def __write_students_data(self): with open(self.filename, 'a') as fh: writer = csv.writer(fh) for student in self.students: row = [student.name] for task in self.tasks: symbol = self._task_result_to_symbol(student.results[task.name]) row.a...
def __write_students_data(self): with open(self.filename, 'a') as fh: writer = csv.writer(fh) for student in self.students: row = [student.name] for task in self.tasks: symbol = self._task_result_to_symbol(student.results[task.name]) row.a...
0c2e363b85b8a4647f22f8241d7971e71fddb8cbbeff6c4763d77abb2d04b769
def write(self): 'Writes the all of the data into a file' self.__write_header_to_file() self.__write_students_data() print(f'File saved as {self.filename}')
Writes the all of the data into a file
src/export.py
write
NChechulin/python-yandex-contest-tools
3
python
def write(self): self.__write_header_to_file() self.__write_students_data() print(f'File saved as {self.filename}')
def write(self): self.__write_header_to_file() self.__write_students_data() print(f'File saved as {self.filename}')<|docstring|>Writes the all of the data into a file<|endoftext|>
d1157ecef2e2a71ce409fdb92dcf6ef85b5eda8514cba84132620e4568aa842b
def __write_header_to_file(self): 'Writes column names' columns = ['name'] for task in self.tasks: columns.append(task.name) ROW = 1 for col in range(len(columns)): cell = self.worksheet.cell(row=ROW, column=(col + 1)) cell.value = columns[col]
Writes column names
src/export.py
__write_header_to_file
NChechulin/python-yandex-contest-tools
3
python
def __write_header_to_file(self): columns = ['name'] for task in self.tasks: columns.append(task.name) ROW = 1 for col in range(len(columns)): cell = self.worksheet.cell(row=ROW, column=(col + 1)) cell.value = columns[col]
def __write_header_to_file(self): columns = ['name'] for task in self.tasks: columns.append(task.name) ROW = 1 for col in range(len(columns)): cell = self.worksheet.cell(row=ROW, column=(col + 1)) cell.value = columns[col]<|docstring|>Writes column names<|endoftext|>
cf13b2024e75b969015ef2cb2902acbf8d05968e31f7c69deb264c32bd33bd15
def __write_students_data(self): 'Writes the results of students into the file' for (row, student) in enumerate(self.students, start=2): self.worksheet.cell(row=row, column=1).value = student.name for (col, task) in enumerate(self.tasks, start=2): symbol = self._task_result_to_symbol...
Writes the results of students into the file
src/export.py
__write_students_data
NChechulin/python-yandex-contest-tools
3
python
def __write_students_data(self): for (row, student) in enumerate(self.students, start=2): self.worksheet.cell(row=row, column=1).value = student.name for (col, task) in enumerate(self.tasks, start=2): symbol = self._task_result_to_symbol(student.results[task.name]) self....
def __write_students_data(self): for (row, student) in enumerate(self.students, start=2): self.worksheet.cell(row=row, column=1).value = student.name for (col, task) in enumerate(self.tasks, start=2): symbol = self._task_result_to_symbol(student.results[task.name]) self....
c22f99dcc242cc1884fbd75151e8d05aec6997c3d67c000fcd7df9f67c3f3b67
def __setup_workbook(self): 'Creates workbook and worksheet' self.workbook = Workbook() self.worksheet = self.workbook.active
Creates workbook and worksheet
src/export.py
__setup_workbook
NChechulin/python-yandex-contest-tools
3
python
def __setup_workbook(self): self.workbook = Workbook() self.worksheet = self.workbook.active
def __setup_workbook(self): self.workbook = Workbook() self.worksheet = self.workbook.active<|docstring|>Creates workbook and worksheet<|endoftext|>
3adfd2f82adf7a56e8d39816877e7de52bfdbff4344368c2f095dabe4a7c52a4
def write(self): 'Writes the all of the data into a file' self.__setup_workbook() self.__write_header_to_file() self.__write_students_data() self.workbook.save(self.filename) print(f'File saved as {self.filename}')
Writes the all of the data into a file
src/export.py
write
NChechulin/python-yandex-contest-tools
3
python
def write(self): self.__setup_workbook() self.__write_header_to_file() self.__write_students_data() self.workbook.save(self.filename) print(f'File saved as {self.filename}')
def write(self): self.__setup_workbook() self.__write_header_to_file() self.__write_students_data() self.workbook.save(self.filename) print(f'File saved as {self.filename}')<|docstring|>Writes the all of the data into a file<|endoftext|>
1a8ce7bc46cb88d0360cbad598ef8b8c7685fa801253dbf4adfe20174571b39d
def extract_initable(t: type, inst=None) -> Optional[Callable[(..., type)]]: 'Extract e.g `dict` from `Optional[dict]`.\n Returns None if non-extractable.\n\n >>> from typing import Optional, Dict, List\n >>> ei = extract_initable\n\n >>> ei(List[str]) is ei(List) is ei(list) is ei(Optional[List[str]]) ...
Extract e.g `dict` from `Optional[dict]`. Returns None if non-extractable. >>> from typing import Optional, Dict, List >>> ei = extract_initable >>> ei(List[str]) is ei(List) is ei(list) is ei(Optional[List[str]]) is list True >>> ei(Dict[str,int]) is ei(Dict) is ei(dict) is ei(Optional[Dict[str,int]]) is dict True ...
timefred/dikt/dikt.py
extract_initable
giladbarnea/timefred
0
python
def extract_initable(t: type, inst=None) -> Optional[Callable[(..., type)]]: 'Extract e.g `dict` from `Optional[dict]`.\n Returns None if non-extractable.\n\n >>> from typing import Optional, Dict, List\n >>> ei = extract_initable\n\n >>> ei(List[str]) is ei(List) is ei(list) is ei(Optional[List[str]]) ...
def extract_initable(t: type, inst=None) -> Optional[Callable[(..., type)]]: 'Extract e.g `dict` from `Optional[dict]`.\n Returns None if non-extractable.\n\n >>> from typing import Optional, Dict, List\n >>> ei = extract_initable\n\n >>> ei(List[str]) is ei(List) is ei(list) is ei(Optional[List[str]]) ...
b8c1006a4e65c0152ad6850749148a4e50abe3d2c9605d1a2d8b753e970aa4e4
def __iter__(self): '\n so `dict(model)` works.\n pydantic/main.py#L733\n ' (yield from self.__dict__.items())
so `dict(model)` works. pydantic/main.py#L733
timefred/dikt/dikt.py
__iter__
giladbarnea/timefred
0
python
def __iter__(self): '\n so `dict(model)` works.\n pydantic/main.py#L733\n ' (yield from self.__dict__.items())
def __iter__(self): '\n so `dict(model)` works.\n pydantic/main.py#L733\n ' (yield from self.__dict__.items())<|docstring|>so `dict(model)` works. pydantic/main.py#L733<|endoftext|>
3693c8f3c9b2d1ab0b0bbcb9aa067bb27e1b213eeec23c423721b306b61f8c39
@annotate(set_in_self=True) def __getattribute__(self, name): "Makes d.foo return d['foo']" try: item = super().__getitem__(name) return item except KeyError as e: attr = super().__getattribute__(name) return attr
Makes d.foo return d['foo']
timefred/dikt/dikt.py
__getattribute__
giladbarnea/timefred
0
python
@annotate(set_in_self=True) def __getattribute__(self, name): try: item = super().__getitem__(name) return item except KeyError as e: attr = super().__getattribute__(name) return attr
@annotate(set_in_self=True) def __getattribute__(self, name): try: item = super().__getitem__(name) return item except KeyError as e: attr = super().__getattribute__(name) return attr<|docstring|>Makes d.foo return d['foo']<|endoftext|>
48688665b5017a950505a6684c868b23400a3af527f58eb631a0f9820bbc041b
def __setattr__(self, name: str, value) -> None: "Makes d.foo = 'bar' also set d['foo']" super().__setattr__(name, value) self[name] = value
Makes d.foo = 'bar' also set d['foo']
timefred/dikt/dikt.py
__setattr__
giladbarnea/timefred
0
python
def __setattr__(self, name: str, value) -> None: super().__setattr__(name, value) self[name] = value
def __setattr__(self, name: str, value) -> None: super().__setattr__(name, value) self[name] = value<|docstring|>Makes d.foo = 'bar' also set d['foo']<|endoftext|>
76a0edf22c2ace26c001f6f28295f63c39ad76fb529dcdf9b8e5986b7d28df67
def load_wrf(filename): 'docstring for load_wrf' data = [] datelist = [] qvdata = mygis.read_nc(filename, 'QVAPOR').data qcdata = (((mygis.read_nc(filename, 'QCLOUD').data + mygis.read_nc(filename, 'QICE').data) + mygis.read_nc(filename, 'QSNOW').data) + mygis.read_nc(filename, 'QRAIN').data) td...
docstring for load_wrf
helpers/wrf/compare_ideal.py
load_wrf
d-reynolds/HICAR
61
python
def load_wrf(filename): data = [] datelist = [] qvdata = mygis.read_nc(filename, 'QVAPOR').data qcdata = (((mygis.read_nc(filename, 'QCLOUD').data + mygis.read_nc(filename, 'QICE').data) + mygis.read_nc(filename, 'QSNOW').data) + mygis.read_nc(filename, 'QRAIN').data) tdata = (mygis.read_nc(fil...
def load_wrf(filename): data = [] datelist = [] qvdata = mygis.read_nc(filename, 'QVAPOR').data qcdata = (((mygis.read_nc(filename, 'QCLOUD').data + mygis.read_nc(filename, 'QICE').data) + mygis.read_nc(filename, 'QSNOW').data) + mygis.read_nc(filename, 'QRAIN').data) tdata = (mygis.read_nc(fil...
ed275a0fba46c2e7164c636cac738b5d99092b8089e49c147acbf3560c937160
def plot_panel(panel, d1, d0, title=''): 'docstring for plot_panel' nrows = len(d1) ncols = 3 currow = 0 for k in d1.keys(): plt.subplot(nrows, ncols, ((currow * ncols) + panel)) if (k != 'r'): delta = (d1[k] - d0[k]) vrange = (max(abs(delta.min()), delta.max(...
docstring for plot_panel
helpers/wrf/compare_ideal.py
plot_panel
d-reynolds/HICAR
61
python
def plot_panel(panel, d1, d0, title=): nrows = len(d1) ncols = 3 currow = 0 for k in d1.keys(): plt.subplot(nrows, ncols, ((currow * ncols) + panel)) if (k != 'r'): delta = (d1[k] - d0[k]) vrange = (max(abs(delta.min()), delta.max()) * 0.95) if (v...
def plot_panel(panel, d1, d0, title=): nrows = len(d1) ncols = 3 currow = 0 for k in d1.keys(): plt.subplot(nrows, ncols, ((currow * ncols) + panel)) if (k != 'r'): delta = (d1[k] - d0[k]) vrange = (max(abs(delta.min()), delta.max()) * 0.95) if (v...
3a5c1039766260ad8a82bd6c146707384aef0c16a4e384550c56e3fbb1e15251
def main(wrffile, icarfiles): 'docstring for main' if (len(sys.argv) > 1): icar_dir = (sys.argv[1] + '/') if (len(sys.argv) > 2): title = sys.argv[2] else: title = '' else: icar_dir = 'output/' print('Loading WRF data') (wrf_data, dates) = load...
docstring for main
helpers/wrf/compare_ideal.py
main
d-reynolds/HICAR
61
python
def main(wrffile, icarfiles): if (len(sys.argv) > 1): icar_dir = (sys.argv[1] + '/') if (len(sys.argv) > 2): title = sys.argv[2] else: title = else: icar_dir = 'output/' print('Loading WRF data') (wrf_data, dates) = load_wrf(wrffile) prin...
def main(wrffile, icarfiles): if (len(sys.argv) > 1): icar_dir = (sys.argv[1] + '/') if (len(sys.argv) > 2): title = sys.argv[2] else: title = else: icar_dir = 'output/' print('Loading WRF data') (wrf_data, dates) = load_wrf(wrffile) prin...
304b7abb3201ef1e8506747bcc7aa55859c6131a16ec7d20b41bdc27e3390fb6
@registry.register_check('cloudsearch') def cloudsearch_https_enforcement_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) -> dict: '[CloudSearch.1] CloudSearch Domains should be configured to use enforce HTTPS-only communications' iso8601Time = datetime.datetime.utcnow().replace(tzinfo=...
[CloudSearch.1] CloudSearch Domains should be configured to use enforce HTTPS-only communications
eeauditor/auditors/aws/Amazon_CloudSearch_Auditor.py
cloudsearch_https_enforcement_check
dreamz1974/ElectricEye
442
python
@registry.register_check('cloudsearch') def cloudsearch_https_enforcement_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) -> dict: iso8601Time = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat() for domain in cloudsearch.describe_domains()['DomainStatusLi...
@registry.register_check('cloudsearch') def cloudsearch_https_enforcement_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) -> dict: iso8601Time = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat() for domain in cloudsearch.describe_domains()['DomainStatusLi...
386b86c1c7b7ab110c325022ba72e3aa4944af4bef05d44048a211a04f00296b
@registry.register_check('cloudsearch') def cloudsearch_tls1dot2_policy_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) -> dict: '[CloudSearch.2] CloudSearch Domains that enforce HTTPS-only communications should use TLS 1.2 cipher suites' iso8601Time = datetime.datetime.utcnow().replace...
[CloudSearch.2] CloudSearch Domains that enforce HTTPS-only communications should use TLS 1.2 cipher suites
eeauditor/auditors/aws/Amazon_CloudSearch_Auditor.py
cloudsearch_tls1dot2_policy_check
dreamz1974/ElectricEye
442
python
@registry.register_check('cloudsearch') def cloudsearch_tls1dot2_policy_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) -> dict: iso8601Time = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat() for domain in cloudsearch.describe_domains()['DomainStatusList...
@registry.register_check('cloudsearch') def cloudsearch_tls1dot2_policy_check(cache: dict, awsAccountId: str, awsRegion: str, awsPartition: str) -> dict: iso8601Time = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat() for domain in cloudsearch.describe_domains()['DomainStatusList...
a38ae8f89114411ac091ffc9f528454dee2b7a4ad1dfc8a3bc400c8c403290cc
def runge_kutta_step(dsystem_dt, phi, z_mem, z_rnd, z_rnd2, tau): '\n This function performs a single Runge-Kutta step from the current\n time to a time tau forward.\n\n PARAMETERS\n ----------\n 1. dsystem_dt : function\n a function that calculates the system derivatives\n 2. p...
This function performs a single Runge-Kutta step from the current time to a time tau forward. PARAMETERS ---------- 1. dsystem_dt : function a function that calculates the system derivatives 2. phi : array the full hierarchy vector 3. z_mem : array the memory terms for the bath 4. z_...
mesohops/dynamics/integrator_rk.py
runge_kutta_step
MesoscienceLab/mesohops
7
python
def runge_kutta_step(dsystem_dt, phi, z_mem, z_rnd, z_rnd2, tau): '\n This function performs a single Runge-Kutta step from the current\n time to a time tau forward.\n\n PARAMETERS\n ----------\n 1. dsystem_dt : function\n a function that calculates the system derivatives\n 2. p...
def runge_kutta_step(dsystem_dt, phi, z_mem, z_rnd, z_rnd2, tau): '\n This function performs a single Runge-Kutta step from the current\n time to a time tau forward.\n\n PARAMETERS\n ----------\n 1. dsystem_dt : function\n a function that calculates the system derivatives\n 2. p...
dd22f9652defaf75f6effe8d17dc03ac2f48b6b2f440f8f66b901fafeda9d93b
def runge_kutta_variables(storage, noise, noise2, tau): '\n This is a function that accepts a storage and noise objects and returns the\n pre-requisite variables for a runge-kutta integration step in a list\n that can be unraveled to correctly feed into runge_kutta_step.\n\n PARAMETERS\n ----------\n...
This is a function that accepts a storage and noise objects and returns the pre-requisite variables for a runge-kutta integration step in a list that can be unraveled to correctly feed into runge_kutta_step. PARAMETERS ---------- 1. storage : HopsStorage object an instantiation of HopsStorage associated w...
mesohops/dynamics/integrator_rk.py
runge_kutta_variables
MesoscienceLab/mesohops
7
python
def runge_kutta_variables(storage, noise, noise2, tau): '\n This is a function that accepts a storage and noise objects and returns the\n pre-requisite variables for a runge-kutta integration step in a list\n that can be unraveled to correctly feed into runge_kutta_step.\n\n PARAMETERS\n ----------\n...
def runge_kutta_variables(storage, noise, noise2, tau): '\n This is a function that accepts a storage and noise objects and returns the\n pre-requisite variables for a runge-kutta integration step in a list\n that can be unraveled to correctly feed into runge_kutta_step.\n\n PARAMETERS\n ----------\n...
60acd7f55d1da1e6287101a888ae17a44bab2aacb782d25b0c2a3f4872a7cb7a
def url_parser(file_name='urls.cfg') -> list: '\n Function that parses urls file and returns currently selected urls\n ' urls = [] try: with open(file_name, 'r') as url_file: for line in url_file.readlines(): line = line[:(- 1)] if ((len(line) != 0) ...
Function that parses urls file and returns currently selected urls
sneakerupdate.py
url_parser
TudorPescaru/SneakerUpdate
1
python
def url_parser(file_name='urls.cfg') -> list: '\n \n ' urls = [] try: with open(file_name, 'r') as url_file: for line in url_file.readlines(): line = line[:(- 1)] if ((len(line) != 0) and (line[0] != '#')): urls.append(line) ...
def url_parser(file_name='urls.cfg') -> list: '\n \n ' urls = [] try: with open(file_name, 'r') as url_file: for line in url_file.readlines(): line = line[:(- 1)] if ((len(line) != 0) and (line[0] != '#')): urls.append(line) ...
6b5cf6cf1751f5d37a6318626770da56bfb98d6a7e696869bf3b06316c2822f9
def html_parser(url: str) -> BeautifulSoup: '\n Function that returns soup of page source from url\n ' req = requests.get(url) response = req.text link = BeautifulSoup(response, 'html.parser') return link
Function that returns soup of page source from url
sneakerupdate.py
html_parser
TudorPescaru/SneakerUpdate
1
python
def html_parser(url: str) -> BeautifulSoup: '\n \n ' req = requests.get(url) response = req.text link = BeautifulSoup(response, 'html.parser') return link
def html_parser(url: str) -> BeautifulSoup: '\n \n ' req = requests.get(url) response = req.text link = BeautifulSoup(response, 'html.parser') return link<|docstring|>Function that returns soup of page source from url<|endoftext|>
963ae0328d16d5b3aa3fdc9103c9476674bd07f0e768877cef45941c4e42ec45
def pretty_print(sneakers: list, retailer: str) -> str: '\n Function that prints raffles from retailer in formatted way\n ' print((((((color['BOLD'] + color['UNDERLINE']) + 'Raffles from ') + retailer) + ':') + color['END'])) for sneaker in sneakers: raffle = '' colors = ['CYAN', 'DARK...
Function that prints raffles from retailer in formatted way
sneakerupdate.py
pretty_print
TudorPescaru/SneakerUpdate
1
python
def pretty_print(sneakers: list, retailer: str) -> str: '\n \n ' print((((((color['BOLD'] + color['UNDERLINE']) + 'Raffles from ') + retailer) + ':') + color['END'])) for sneaker in sneakers: raffle = colors = ['CYAN', 'DARKCYAN', 'BLUE', 'BOLD'] i = 0 for item in snea...
def pretty_print(sneakers: list, retailer: str) -> str: '\n \n ' print((((((color['BOLD'] + color['UNDERLINE']) + 'Raffles from ') + retailer) + ':') + color['END'])) for sneaker in sneakers: raffle = colors = ['CYAN', 'DARKCYAN', 'BLUE', 'BOLD'] i = 0 for item in snea...
91bc5014c6a9a2b7ea68aad8a7ab898c2e33be53a9234c632709b1f01d8ee21b
def footshop_raffle(link: BeautifulSoup) -> list: '\n Function that gets the current raffles from FootShop\n ' sneakers = [] containers = link.find_all('div', class_=re.compile('container active-or-coming-soon')) for container in containers: cards = container.find_all('div', class_=re.comp...
Function that gets the current raffles from FootShop
sneakerupdate.py
footshop_raffle
TudorPescaru/SneakerUpdate
1
python
def footshop_raffle(link: BeautifulSoup) -> list: '\n \n ' sneakers = [] containers = link.find_all('div', class_=re.compile('container active-or-coming-soon')) for container in containers: cards = container.find_all('div', class_=re.compile('card.*closing-soon')) cards += containe...
def footshop_raffle(link: BeautifulSoup) -> list: '\n \n ' sneakers = [] containers = link.find_all('div', class_=re.compile('container active-or-coming-soon')) for container in containers: cards = container.find_all('div', class_=re.compile('card.*closing-soon')) cards += containe...
f8b87cdab127340e2b2dfcaf1a468ac53ea8f9505d88843c54e17abdba2f9a0d
def svd_raffle(link: BeautifulSoup) -> list: '\n Function that gets the current raffles from SVD\n ' sneakers = [] containers = link.find_all('li', attrs={'class': ['item', 'product']}) for container in containers: state = container.find('span', class_='product-state__tag') state =...
Function that gets the current raffles from SVD
sneakerupdate.py
svd_raffle
TudorPescaru/SneakerUpdate
1
python
def svd_raffle(link: BeautifulSoup) -> list: '\n \n ' sneakers = [] containers = link.find_all('li', attrs={'class': ['item', 'product']}) for container in containers: state = container.find('span', class_='product-state__tag') state = state.get_text() if (state == 'Raffle'...
def svd_raffle(link: BeautifulSoup) -> list: '\n \n ' sneakers = [] containers = link.find_all('li', attrs={'class': ['item', 'product']}) for container in containers: state = container.find('span', class_='product-state__tag') state = state.get_text() if (state == 'Raffle'...
28e38c4fb3a4ebd26e3bf7915231632b2fc3932644f32a328f10be75abb87ac4
def main(): '\n Main driver code\n ' urls = url_parser() if urls: for i in range(len(urls)): link = html_parser(urls[i]) if (i == 0): sneakers = footshop_raffle(link) pretty_print(sneakers, 'FootShop') elif (i == 1): ...
Main driver code
sneakerupdate.py
main
TudorPescaru/SneakerUpdate
1
python
def main(): '\n \n ' urls = url_parser() if urls: for i in range(len(urls)): link = html_parser(urls[i]) if (i == 0): sneakers = footshop_raffle(link) pretty_print(sneakers, 'FootShop') elif (i == 1): sneakers ...
def main(): '\n \n ' urls = url_parser() if urls: for i in range(len(urls)): link = html_parser(urls[i]) if (i == 0): sneakers = footshop_raffle(link) pretty_print(sneakers, 'FootShop') elif (i == 1): sneakers ...
82e261e236f27f9bf7137f5a677fc71d0c3f74708af6364596c4a9e786f3a61a
@respond_to('^(gpoem|make a poem about) (?P<topic>.*)$') def google_poem(self, message, topic): 'make a poem about __: show a google poem about __' r = requests.get((('http://www.google.com/complete/search?output=toolbar&q=' + topic) + '%20')) xmldoc = minidom.parseString(r.text) item_list = xmldoc.getE...
make a poem about __: show a google poem about __
will/plugins/fun/googlepoem.py
google_poem
dawn-minion/will
349
python
@respond_to('^(gpoem|make a poem about) (?P<topic>.*)$') def google_poem(self, message, topic): r = requests.get((('http://www.google.com/complete/search?output=toolbar&q=' + topic) + '%20')) xmldoc = minidom.parseString(r.text) item_list = xmldoc.getElementsByTagName('suggestion') context = {'topi...
@respond_to('^(gpoem|make a poem about) (?P<topic>.*)$') def google_poem(self, message, topic): r = requests.get((('http://www.google.com/complete/search?output=toolbar&q=' + topic) + '%20')) xmldoc = minidom.parseString(r.text) item_list = xmldoc.getElementsByTagName('suggestion') context = {'topi...
0d6c1dbb44f4988827dd2462fa7a2033f3a3193193130675a9bd3ba68e6bf8cf
def __init__(self, df, utility, availability=None): '"\n Initialize the class\n\n :param df: DataFrame\n ' self.df = df self.utility = utility self.params = [] self.params_choice = {} for alt in self.utility.keys(): for pair in self.utility[alt]: if (len(...
" Initialize the class :param df: DataFrame
code/classes/MNLogit.py
__init__
glederrey/IEEE2018-SNM
1
python
def __init__(self, df, utility, availability=None): '"\n Initialize the class\n\n :param df: DataFrame\n ' self.df = df self.utility = utility self.params = [] self.params_choice = {} for alt in self.utility.keys(): for pair in self.utility[alt]: if (len(...
def __init__(self, df, utility, availability=None): '"\n Initialize the class\n\n :param df: DataFrame\n ' self.df = df self.utility = utility self.params = [] self.params_choice = {} for alt in self.utility.keys(): for pair in self.utility[alt]: if (len(...
26af3bc6f5158cb67381d0ea2d3a7b4442123d710837a7cd41293fcca1278314
def compute_utility(self, x, indices=None, alt=None): '\n Compute the utility for a given alternative.\n\n If None are given, compute the utility for all alternatives\n\n :param x: Value for the parameters\n :param indices: Indices for which we compute the utility\n :param alt: St...
Compute the utility for a given alternative. If None are given, compute the utility for all alternatives :param x: Value for the parameters :param indices: Indices for which we compute the utility :param alt: String with an alternative :return: Either a float or a dict
code/classes/MNLogit.py
compute_utility
glederrey/IEEE2018-SNM
1
python
def compute_utility(self, x, indices=None, alt=None): '\n Compute the utility for a given alternative.\n\n If None are given, compute the utility for all alternatives\n\n :param x: Value for the parameters\n :param indices: Indices for which we compute the utility\n :param alt: St...
def compute_utility(self, x, indices=None, alt=None): '\n Compute the utility for a given alternative.\n\n If None are given, compute the utility for all alternatives\n\n :param x: Value for the parameters\n :param indices: Indices for which we compute the utility\n :param alt: St...
9f740d22f178cdc4e5a86196a6af9d852376aee60d14fb92c7d807a4400dab6b
def probabilities(self, x, indices=None): '\n Compute probabilities for given parameters\n\n :param x: array with values of parameters\n :param indices: Array with indices\n :return:\n ' proba = {} utilities = self.compute_utility(x, indices) if (indices is None): ...
Compute probabilities for given parameters :param x: array with values of parameters :param indices: Array with indices :return:
code/classes/MNLogit.py
probabilities
glederrey/IEEE2018-SNM
1
python
def probabilities(self, x, indices=None): '\n Compute probabilities for given parameters\n\n :param x: array with values of parameters\n :param indices: Array with indices\n :return:\n ' proba = {} utilities = self.compute_utility(x, indices) if (indices is None): ...
def probabilities(self, x, indices=None): '\n Compute probabilities for given parameters\n\n :param x: array with values of parameters\n :param indices: Array with indices\n :return:\n ' proba = {} utilities = self.compute_utility(x, indices) if (indices is None): ...
fc1ca7e29befe7c79b97419a408e5d738fa8c714243e5d2bee1534dfae66f206
def loglikelihood(self, x, indices=None): '\n Log Likelihood for given parameters\n\n :param x: parameters\n :return:\n ' if (indices is None): indices = np.array(range(len(self.df))) if ((not isinstance(indices, list)) and (not isinstance(indices, np.ndarray))): ...
Log Likelihood for given parameters :param x: parameters :return:
code/classes/MNLogit.py
loglikelihood
glederrey/IEEE2018-SNM
1
python
def loglikelihood(self, x, indices=None): '\n Log Likelihood for given parameters\n\n :param x: parameters\n :return:\n ' if (indices is None): indices = np.array(range(len(self.df))) if ((not isinstance(indices, list)) and (not isinstance(indices, np.ndarray))): ...
def loglikelihood(self, x, indices=None): '\n Log Likelihood for given parameters\n\n :param x: parameters\n :return:\n ' if (indices is None): indices = np.array(range(len(self.df))) if ((not isinstance(indices, list)) and (not isinstance(indices, np.ndarray))): ...