repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
kalyons11/kevin
kevin/tests/leet/test_missing_number.py
<filename>kevin/tests/leet/test_missing_number.py """ https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/588/week-1-march-1st-march-7th/3659/ """ from typing import List from unittest import TestCase from kevin.leet.missing_number import Solution class TestMissingNumber(TestCase): def _...
kalyons11/kevin
kevin/tests/leet/test_convert_bst_to_greater_tree.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3634/ """ from unittest import TestCase from kevin.leet.convert_bst_to_greater_tree import Solution from kevin.utils.bst import BST, TreeNode class TestConvertBSTToGreaterTree(TestCase): def _...
kalyons11/kevin
kevin/leet/hamming_distance.py
<filename>kevin/leet/hamming_distance.py """ https://leetcode.com/problems/hamming-distance/ """ class Solution: def hamming_distance(self, x: int, y: int) -> int: # use XOR to compute difference diff = x ^ y # count number of 1s - just count the set bits count = 0 while di...
kalyons11/kevin
kevin/leet/spiral_matrix.py
<reponame>kalyons11/kevin """ https://leetcode.com/explore/interview/card/top-interview-questions-hard/116/array-and-strings/828/ """ from typing import List class Direction: RIGHT = 0 DOWN = 1 LEFT = 2 UP = 3 # TODO eventually clean this up - DRY up this code for sure class Solution: def spira...
kalyons11/kevin
kevin/leet/missing_number.py
""" https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/588/week-1-march-1st-march-7th/3659/ """ from typing import List class Solution: def missing_number(self, nums: List[int]) -> int: # compute the sum # subtract from what the sum should really be n(n + 1) / 2 #...
kalyons11/kevin
kevin/tests/leet/test_product_except_self.py
<reponame>kalyons11/kevin """ https://leetcode.com/explore/interview/card/top-interview-questions-hard/116/array-and-strings/827/ """ from unittest import TestCase from kevin.leet.product_except_self import Solution, SolutionOptimized class TestProductExceptSelf(TestCase): def _base_test_product_except_self(sel...
kalyons11/kevin
kevin/tests/leet/test_two_sum.py
<gh_stars>1-10 """ LeetCode two sum test script. """ from unittest import TestCase from kevin.leet import two_sum class TestTwoSum(TestCase): def test_two_sum(self): nums = [3, 2, 4] target = 6 sol = two_sum.Solution() assert sorted(sol.two_sum(nums, target)) == [1, 2]
kalyons11/kevin
kevin/tests/leet/test_shortest_path_binary_matrix.py
<reponame>kalyons11/kevin """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3638/ """ import json import os from typing import List from unittest import TestCase from kevin.leet.shortest_path_binary_matrix import Solution class TestShortestPathB...
kalyons11/kevin
kevin/tests/leet/test_trim_bst.py
<reponame>kalyons11/kevin """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/584/week-1-february-1st-february-7th/3626/ """ from unittest import TestCase from kevin.leet.trim_bst import Solution from kevin.utils.bst import BST class TestTrimBST(TestCase): def _base_test_trim_bst(s...
kalyons11/kevin
kevin/tests/leet/test_max_area_of_island.py
""" https://leetcode.com/explore/featured/card/june-leetcoding-challenge-2021/603/week-1-june-1st-june-7th/3764/ """ from typing import List from unittest import TestCase from kevin.leet.max_area_of_island import Solution class TestMaxAreaOfIsland: def _base_test_max_area_of_island(self, grid: List[List[int]], ...
kalyons11/kevin
kevin/leet/swap_nodes.py
<reponame>kalyons11/kevin<gh_stars>1-10 """ https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/589/week-2-march-8th-march-14th/3671/ """ from kevin.utils.link import ListNode class SolutionFailure: def swap_nodes(self, head: ListNode, k: int) -> ListNode: # have to go through and...
kalyons11/kevin
kevin/tests/utils/test_bst.py
<reponame>kalyons11/kevin """ BST utils test script. """ from unittest import TestCase from kevin.utils.bst import BST, TreeNode class TestBSTUtils(TestCase): def test_bst_make(self): n = TreeNode(0) x = BST(n) def test_init_from_list_empty_should_fail(self): keys = [] with s...
kalyons11/kevin
kevin/leet/score_of_parentheses.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/587/week-4-february-22nd-february-28th/3651/ """ class Solution: def score_of_parentheses(self, S: str) -> int: # recursive approach potentially? # need to get down to base cases of (), (A), (AB) # know S is ...
kalyons11/kevin
kevin/tests/leet/test_add_two_numbers.py
<gh_stars>1-10 """ LeetCode two sum test script. """ from unittest import TestCase from kevin.leet import add_two_numbers class TestAddTwoNumbers(TestCase): def check_add_two_numbers_numerical(self, v1, v2, expected): l1 = self.convert_number_to_linked_list(v1) l2 = self.convert_number_to_linked...
kalyons11/kevin
kevin/tests/leet/test_hamming_distance.py
<reponame>kalyons11/kevin """ https://leetcode.com/problems/hamming-distance/ """ from unittest import TestCase from kevin.leet.hamming_distance import Solution class TestHammingDistance(TestCase): def _base_test_hamming_distance(self, x, y, expected): sol = Solution() actual = sol.hamming_distan...
kalyons11/kevin
kevin/leet/restore_the_array.py
<filename>kevin/leet/restore_the_array.py """ https://leetcode.com/problems/restore-the-array/ """ # inspired by: # https://leetcode.com/problems/restore-the-array/discuss/585554/C%2B%2BPython-Simple-DP-with-python class Solution: def number_of_arrays(self, s: str, k: int) -> int: # this is going to be har...
kalyons11/kevin
kevin/leet/shortest_path_binary_matrix.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3638/ """ from collections import deque from typing import List class Solution: def shortest_path_binary_matrix(self, grid: List[List[int]]) -> int: # BFS will give shortest path solut...
kalyons11/kevin
kevin/tests/leet/test_top_k_frequent.py
<gh_stars>1-10 # LeetCode top k frequent test script. from unittest import TestCase from kevin.leet import top_k_frequent class TestTopKFrequent(TestCase): def test_top_k_frequent_multi(self): nums = [1, 1, 1, 2, 2, 3] k = 2 expected = [1, 2] sol = top_k_frequent.Solution() ...
kalyons11/kevin
kevin/playground/gpa.py
<filename>kevin/playground/gpa.py # Quick script to calculate GPA given a class list file. # Class list file should be a csv with COURSE_ID,NUM_UNITS,GRADE # GRADE should be LETTER with potential modifiers after that # registrar.mit.edu/classes-grades-evaluations/grades/calculating-gpa import argparse import pandas as...
kalyons11/kevin
kevin/leet/peeking_iterator.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3633/ """ from typing import List class Iterator: def __init__(self, nums: List[int]): """ Initializes an iterator object to the beginning of a list. :type nums: List[i...
kalyons11/kevin
kevin/tests/leet/test_is_graph_bipartite.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3639/ """ from unittest import TestCase from kevin.leet.is_graph_bipartite import Solution class TestIsGraphBipartite(TestCase): def _base_test_is_graph_bipartite(self, graph, expected): ...
kalyons11/kevin
kevin/leet/convert_bst_to_greater_tree.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3634/ """ from kevin.utils.bst import TreeNode class Solution: def convert_bst(self, root: TreeNode) -> TreeNode: # inspired by https://leetcode.com/problems/binary-search-tree-to-great...
kalyons11/kevin
kevin/leet/top_k_frequent.py
<filename>kevin/leet/top_k_frequent.py # https://leetcode.com/problems/top-k-frequent-elements/ class Solution: def top_k_frequent(self, nums, k): # Given a non-empty array of integers, return the k most frequent # elements. # 1. Construct frequency dictionary freq = self.__freq_d...
kalyons11/kevin
kevin/leet/palindrome_linked_list.py
""" https://leetcode.com/explore/featured/card/april-leetcoding-challenge-2021/593/week-1-april-1st-april-7th/3693/ """ from kevin.utils.link import ListNode class Solution: def is_palindrome(self, head: ListNode) -> bool: # naive solution is O(n) time, but requires more than O(1) space # because...
kalyons11/kevin
kevin/tests/leet/test_letter_case_permutation.py
<reponame>kalyons11/kevin<filename>kevin/tests/leet/test_letter_case_permutation.py """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/586/week-3-february-15th-february-21st/3642/ """ from typing import List from unittest import TestCase from kevin.leet.letter_case_permutation import S...
kalyons11/kevin
kevin/playground/read.py
<reponame>kalyons11/kevin<filename>kevin/playground/read.py """Quick script to read inputs. """ if __name__ == '__main__': # Read the number of inputs num_inputs = int(input("How many inputs? ")) assert num_inputs >= 3, "At least 3 please." print("Enter your {num_inputs} inputs in the following form: i...
kalyons11/kevin
kevin/leet/is_anagram.py
<reponame>kalyons11/kevin """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3636/ """ class Solution: def is_anagram(self, s: str, t: str) -> bool: # construct a simple count dictionary and validate equality def _construct_count...
kalyons11/kevin
kevin/tests/leet/test_average_of_levels.py
<filename>kevin/tests/leet/test_average_of_levels.py<gh_stars>1-10 """ https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/588/week-1-march-1st-march-7th/3661/ """ from typing import List from unittest import TestCase from kevin.leet.average_of_levels import Solution, SolutionOptimized from ke...
kalyons11/kevin
kevin/tests/leet/test_vertical_order_traversal.py
""" https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/ """ from typing import List from unittest import TestCase from kevin.leet.vertical_order_traversal import Solution from kevin.utils.bst import BST class TestVerticalOrderTraversal(TestCase): def _base_test_vertical_order_traversal(self...
kalyons11/kevin
kevin/tests/leet/test_arithmetic_slices.py
""" https://leetcode.com/explore/featured/card/february-leetcoding-challenge-2021/586/week-3-february-15th-february-21st/3644/ """ from typing import List from unittest import TestCase from kevin.leet.arithmetic_slices import Solution class TestArithmeticSlices(TestCase): def _base_test_number_of_arithmetic_sli...
kalyons11/kevin
kevin/leet/remove_sub_folders.py
<reponame>kalyons11/kevin # https://leetcode.com/problems/remove-sub-folders-from-the-filesystem/ class Solution: def remove_sub_folders(self, folder): # Given a list of folders, remove all sub-folders in those folders # and return in any order the folders after removing. # If a folder[i] ...
kalyons11/kevin
kevin/utils/general.py
<gh_stars>1-10 """ Quick package utils script. """ import numpy as np def strip_str(inp): """Helper method to strip a string of all non alphanumeric characters. Args: inp (str): - Returns: str: stripped output >>> x = 'Test-string123__:' >>> y = strip_str(x) >>> y 'test...
kalyons11/kevin
kevin/leet/is_graph_bipartite.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3639/ """ from typing import List class Solution: def is_bipartite(self, graph: List[List[int]]) -> bool: # depth first search on graph # color each node 0 or 1 depending on th...
kalyons11/kevin
kevin/leet/nim_game.py
""" https://leetcode.com/problems/nim-game/ """ class Solution: def can_win_nim(self, n: int) -> bool: # turns out... # You can always win a Nim game if the number of stones n in the # pile is not divisible by 4. return n % 4 != 0
kalyons11/kevin
kevin/leet/__init__.py
""" Sub-package for LeetCode problems and solutions. https://leetcode.com """ from . import add_two_numbers from . import remove_sub_folders from . import two_sum
kalyons11/kevin
kevin/leet/letter_case_permutation.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/586/week-3-february-15th-february-21st/3642/ """ from typing import List class TrieNode: def __init__(self, val=''): self._val = val self._parent = None self._children = set() def add_child(self, child...
kalyons11/kevin
kevin/leet/average_of_levels.py
""" https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/588/week-1-march-1st-march-7th/3661/ """ from typing import List from kevin.utils.bst import TreeNode class Solution: def average_of_levels(self, root: TreeNode) -> List[float]: # need to go level by level, so let's do a BFS...
kalyons11/kevin
kevin/tests/leet/test_peeking_iterator.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3633/ """ from typing import List from unittest import TestCase from kevin.leet.peeking_iterator import Iterator, PeekingIterator class TestPeekingIterator(TestCase): def _test_peeking_iterat...
kalyons11/kevin
kevin/leet/max_area_of_island.py
""" https://leetcode.com/explore/featured/card/june-leetcoding-challenge-2021/603/week-1-june-1st-june-7th/3764/ """ from typing import List """ taken from: https://leetcode.com/discuss/explore/june-leetcoding-challenge-2021/1244554/Max-Area-of-Island-or-JS-Python-Java-C%2B%2B-or-Simple-DFS-Recursion-Solution-w-Expla...
kalyons11/kevin
kevin/tests/leet/test_score_of_parentheses.py
<reponame>kalyons11/kevin """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/587/week-4-february-22nd-february-28th/3651/ """ from unittest import TestCase from kevin.leet.score_of_parentheses import Solution, SolutionOptimized class TestScoreOfParentheses(TestCase): def _base_tes...
kalyons11/kevin
kevin/leet/trim_bst.py
<reponame>kalyons11/kevin<filename>kevin/leet/trim_bst.py<gh_stars>1-10 """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/584/week-1-february-1st-february-7th/3626/ """ from kevin.utils.bst import TreeNode class Solution: def trim_bst(self, root: TreeNode, low: int, high: int) -> ...
kalyons11/kevin
setup.py
""" Package setup file. """ import sys from setuptools import setup, find_packages sys.path.append('kevin/') from __init__ import __version__, __author__, __description__ setup(name='kevin', version=__version__, author=__author__, description=__description__, url='hhttps://github.com/kalyons1...
kalyons11/kevin
kevin/tests/leet/test_palindrome_linked_list.py
""" https://leetcode.com/explore/featured/card/april-leetcoding-challenge-2021/593/week-1-april-1st-april-7th/3693/ """ from typing import List from unittest import TestCase from kevin.leet.palindrome_linked_list import Solution, SolutionOptimized from kevin.utils.link import LinkedList class TestPalindromeLinkedLi...
kalyons11/kevin
kevin/leet/copy_list_with_random_pointers.py
""" https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3635/ """ class Node: def __init__(self, x: int, next: 'Node'=None, random: 'Node'=None): self.val = int(x) self.next = next self.random = random class Solution: def...
kalyons11/kevin
kevin/leet/k_weakest_rows.py
<gh_stars>1-10 """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/586/week-3-february-15th-february-21st/3641/ """ import heapq from typing import List class Solution: def k_weakest_rows(self, mat: List[List[int]], k: int) -> List[int]: # compute sum of each row # ...
kalyons11/kevin
kevin/leet/check_binary_codes.py
""" https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/589/week-2-march-8th-march-14th/3669/ """ # time O(N), where N = len(s) # memory O(2 ** k) class Solution: def has_all_codes(self, s: str, k: int) -> bool: # O(n) solution - gather all length k substrings and check their set ...
kalyons11/kevin
kevin/leet/reduce_array_size_half.py
""" https://leetcode.com/explore/featured/card/july-leetcoding-challenge-2021/608/week-1-july-1st-july-7th/3804/ """ from typing import List, Dict class Solution: def min_set_size(self, arr: List[int]) -> int: # max frequency greedy approach should work here # thank you hints freq_map = s...
kalyons11/kevin
kevin/__init__.py
# Kevin's custom Python package for testing purposes. __version__ = '0.1.0' __author__ = '<NAME>' __description__ = 'Personal repository for development and experimentation.'
kalyons11/kevin
kevin/leet/vertical_order_traversal.py
""" https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree/ """ from typing import List from kevin.utils.bst import TreeNode class Solution: def vertical_traversal(self, root: TreeNode) -> List[List[int]]: # this is a hard one - you got this! # recursively, maybe? # coul...
kalyons11/kevin
kevin/tests/leet/test_check_binary_codes.py
""" https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/589/week-2-march-8th-march-14th/3669/ """ from unittest import TestCase from kevin.leet.check_binary_codes import Solution class TestCheckBinaryCodes(TestCase): def _base_test_check_binary_codes(self, s: str, k: int, expected: bool):...
kalyons11/kevin
kevin/tests/leet/test_remove_sub_folders.py
<filename>kevin/tests/leet/test_remove_sub_folders.py """ LeetCode remove sub folders test script. """ from unittest import TestCase from kevin.leet import remove_sub_folders class TestRemoveSubFolders(TestCase): def _validate_folder(self, expected, actual): # Validate that expected folder set equals a...
kalyons11/kevin
kevin/tests/leet/test_is_anagram.py
<reponame>kalyons11/kevin<filename>kevin/tests/leet/test_is_anagram.py """ https://leetcode.com/explore/challenge/card/february-leetcoding-challenge-2021/585/week-2-february-8th-february-14th/3636/ """ from unittest import TestCase from kevin.leet.is_anagram import Solution class TestIsAnagram(TestCase): def _b...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_portstatstest.py
<reponame>LucProvoost/samplevnf #!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## ## http://www.apache.org/licenses/L...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_impairtest.py
<reponame>LucProvoost/samplevnf #!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## ## http://www.apache.org/licenses/L...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_cli.py
#!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_log.py
#!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/stackdeployment.py
<reponame>LucProvoost/samplevnf #!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICE...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_irqtest.py
#!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/sshclient.py
<gh_stars>0 #!/usr/bin/env python2.7 ## ## Copyright (c) 2019 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ##...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py
<filename>VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py #!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## ## http...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/createrapidk8s.py
<gh_stars>0 #!/usr/bin/env python2.7 ## ## Copyright (c) 2019 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ##...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py
<reponame>LucProvoost/samplevnf ## ## Copyright (c) 2010-2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## ...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py
#!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
<reponame>LucProvoost/samplevnf #!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICE...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapid_flowsizetest.py
<reponame>LucProvoost/samplevnf #!/usr/bin/python ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## ## http://www.apache.org/licenses/L...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/createrapid.py
#!/usr/bin/python ## ## Copyright (c) 2010-2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless requir...
LucProvoost/samplevnf
VNFs/DPPD-PROX/helper-scripts/rapid/rapidxt.py
#!/usr/bin/python3 ## ## Copyright (c) 2020 Intel Corporation ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required b...
joellabes/mode-dbt-exposures
generate_yaml.py
<gh_stars>0 import json; import re; import os; import yaml; table_ref_lookup = {}; with open("/Users/joel/Projects/ep-dbt-project/target/manifest.json") as file: data = json.load(file) for node in data['nodes']: if not data['nodes'][node]['resource_type'] in ('test', 'analysis'): table_and...
MattHealy/troposphere
tests/test_validators.py
<filename>tests/test_validators.py import unittest from troposphere import Parameter, Ref, NoValue from troposphere.validators import boolean, integer, integer_range from troposphere.validators import positive_integer, network_port from troposphere.validators import tg_healthcheck_port from troposphere.validators impor...
HugoChateauLaurent/cogni-quiz
quiz.py
<filename>quiz.py<gh_stars>0 import asyncio import random import re import unidecode import os import numpy as np import operator import discord class Question: def __init__(self, question, propositions, proposition_emojis, correct_idx, score): self.question = question self.propositions = proposit...
HugoChateauLaurent/cogni-quiz
bot.py
<filename>bot.py import discord from discord.ext import commands import sys import re from typing import Union, List import quiz bot = commands.Bot(command_prefix = '!', description = '') VERBOSE = False def has_role(ctx, role_name, user:discord.Member=None): if user is None: user = ctx.message.author ...
cbymar/testing-and-monitoring-ml-deployments
sandbox_pytest/test_my_module.py
import sys import os x = os.path.dirname(os.path.abspath(__file__)) sys.path.append(x) from my_module import square def test_square_returns_correctly(): # When subject = square(2) # then assert subject == 4
cbymar/testing-and-monitoring-ml-deployments
packages/gradient_boosting_model/tests/conftest.py
import pytest from sklearn.model_selection import train_test_split from gradient_boosting_model.config.core import config from gradient_boosting_model.processing.data_management import load_dataset @pytest.fixture(scope="session") def pipeline_inputs(): # For larger datasets, here we would use a testing sub-samp...
cbymar/testing-and-monitoring-ml-deployments
sandbox_pytest/my_module.py
def square(x): return x ** 2
cbymar/testing-and-monitoring-ml-deployments
sandbox_pytest/test_my_module_again.py
from my_module import square import pytest @pytest.mark.parametrize("inputs",[2, 3, 4.5]) def test_square_return_type_is_int(inputs): # When subject = square(inputs) # then assert isinstance(subject, int)
ansible/ansible-kubernetes-modules-
library/openshift_v1_image_stream_tag_list.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_image_stream_tag_list short_description: OpenShift ImageStreamTagList description: - Retrieve a list of image_stream_tags. List operati...
ansible/ansible-kubernetes-modules-
library/k8s_v1beta1_custom_resource_definition.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_v1beta1_custom_resource_definition short_description: Kubernetes CustomResourceDefinition description: - Manage the lifecycle of a custom_resource_d...
ansible/ansible-kubernetes-modules-
library/openshift_v1_applied_cluster_resource_quota_list.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_applied_cluster_resource_quota_list short_description: OpenShift AppliedClusterResourceQuotaList description: - Retrieve a list of appl...
ansible/ansible-kubernetes-modules-
library/openshift_v1_build_config.py
<reponame>ansible/ansible-kubernetes-modules-<gh_stars>10-100 #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_build_config short_description: OpenShift BuildConfig description: - Mana...
ansible/ansible-kubernetes-modules-
library/openshift_v1_route.py
<reponame>ansible/ansible-kubernetes-modules- #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_route short_description: OpenShift Route description: - Manage the lifecycle of a route o...
ansible/ansible-kubernetes-modules-
library/openshift_v1_template_list.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_template_list short_description: OpenShift TemplateList description: - Retrieve a list of templates. List operations provide a snapshot...
ansible/ansible-kubernetes-modules-
library/openshift_v1_template.py
<reponame>ansible/ansible-kubernetes-modules-<filename>library/openshift_v1_template.py #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_template short_description: OpenShift Template ...
ansible/ansible-kubernetes-modules-
library/openshift_v1_applied_cluster_resource_quota.py
<filename>library/openshift_v1_applied_cluster_resource_quota.py #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_applied_cluster_resource_quota short_description: OpenShift AppliedClu...
ansible/ansible-kubernetes-modules-
library/openshift_v1_image_stream_image.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_image_stream_image short_description: OpenShift ImageStreamImage description: - Manage the lifecycle of a image_stream_image object. Su...
ansible/ansible-kubernetes-modules-
library/k8s_v1beta1_stateful_set.py
<filename>library/k8s_v1beta1_stateful_set.py #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_v1beta1_stateful_set short_description: Kubernetes StatefulSet description: - Manage the lifecycle of ...
ansible/ansible-kubernetes-modules-
library/openshift_v1_o_auth_client_list.py
<filename>library/openshift_v1_o_auth_client_list.py<gh_stars>10-100 #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_o_auth_client_list short_description: OpenShift OAuthClientList de...
ansible/ansible-kubernetes-modules-
library/k8s_v1_service.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_v1_service short_description: Kubernetes Service description: - Manage the lifecycle of a service object. Supports check mode, and attempts to to ...
ansible/ansible-kubernetes-modules-
library/openshift_v1beta1_mutating_webhook_configuration.py
<gh_stars>10-100 #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1beta1_mutating_webhook_configuration short_description: OpenShift MutatingWebhookConfiguration description: - Manage th...
ansible/ansible-kubernetes-modules-
library/openshift_v1_image_stream_import.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_image_stream_import short_description: OpenShift ImageStreamImport description: - Manage the lifecycle of a image_stream_import object....
ansible/ansible-kubernetes-modules-
library/openshift_v1_role_list.py
<reponame>ansible/ansible-kubernetes-modules- #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_role_list short_description: OpenShift RoleList description: - Retrieve a list of roles. ...
ansible/ansible-kubernetes-modules-
library/openshift_v1_image_list.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_image_list short_description: OpenShift ImageList description: - Retrieve a list of images. List operations provide a snapshot read of ...
ansible/ansible-kubernetes-modules-
library/k8s_v1beta1_api_service.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_v1beta1_api_service short_description: Kubernetes APIService description: - Manage the lifecycle of a api_service object. Supports check mode, and a...
ansible/ansible-kubernetes-modules-
library/openshift_v1_template_instance.py
<reponame>ansible/ansible-kubernetes-modules- #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_template_instance short_description: OpenShift TemplateInstance description: - Manage the...
ansible/ansible-kubernetes-modules-
library/k8s_extensions_v1beta1_scale.py
<reponame>ansible/ansible-kubernetes-modules-<gh_stars>10-100 #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_extensions_v1beta1_scale short_description: Kubernetes Scale description: - Manage the...
ansible/ansible-kubernetes-modules-
library/openshift_v1_security_context_constraints.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_security_context_constraints short_description: OpenShift SecurityContextConstraints description: - Manage the lifecycle of a security_...
ansible/ansible-kubernetes-modules-
library/k8s_v2beta1_horizontal_pod_autoscaler.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_v2beta1_horizontal_pod_autoscaler short_description: Kubernetes HorizontalPodAutoscaler description: - Manage the lifecycle of a horizontal_pod_auto...
ansible/ansible-kubernetes-modules-
library/k8s_v1_persistent_volume.py
<gh_stars>10-100 #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_v1_persistent_volume short_description: Kubernetes PersistentVolume description: - Manage the lifecycle of a persistent_volume obje...
ansible/ansible-kubernetes-modules-
library/openshift_v1beta1_event_list.py
<filename>library/openshift_v1beta1_event_list.py #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1beta1_event_list short_description: OpenShift EventList description: - Retrieve a list...
ansible/ansible-kubernetes-modules-
library/openshift_v1_security_context_constraints_list.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.openshift_common import OpenShiftAnsibleModule, OpenShiftAnsibleException DOCUMENTATION = ''' module: openshift_v1_security_context_constraints_list short_description: OpenShift SecurityContextConstraintsList description: - Retrieve a list of securit...
ansible/ansible-kubernetes-modules-
library/k8s_v1_status.py
#!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.k8s_common import KubernetesAnsibleModule, KubernetesAnsibleException DOCUMENTATION = ''' module: k8s_v1_status short_description: Kubernetes Status description: - Manage the lifecycle of a status object. Supports check mode, and attempts to to be ...