index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
9,640 | aymane081/python_algo | refs/heads/master | /arrays/maximum_subarray.py | class Solution(object):
# time: O(N), space: O(N)
def maximum_subarray(self, arr):
if not arr:
return 0
result = arr[0]
dp = [arr[0]]
for i in range(1, len(arr)):
dp.append(arr[i] + max(dp[i - 1], 0)) # longest subarray until index i
result =... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,641 | aymane081/python_algo | refs/heads/master | /dynamicProgramming/buy_sell_stock1.py | class Solution:
def get_max_profit(self, prices):
if not prices:
return 0
max_profit, max_here = 0, 0
for i in range(1, len(prices)):
max_here = max(max_here + prices[i] - prices[i - 1], 0)
max_profit = max(max_profit, max_here)
return max... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,642 | aymane081/python_algo | refs/heads/master | /trees/second_minimum_binary_tree.py | #671
from utils.treeNode import TreeNode
class Solution:
def second_minimum(self, root):
if not root:
return -1
level = [root]
curr_min = root.value
while level:
next_level = []
for node in level:
if node.left:
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,643 | aymane081/python_algo | refs/heads/master | /dynamicProgramming/partition_equal_subset_sum.py | class Solution:
def can_partition(self, nums):
sum_nums = sum(nums)
if sum_nums % 2:
return False
target = sum_nums // 2
nums.sort(reverse = True) #Try the largest numbers first, since less operations to reach the target
subset_sum = [True] + [False for _... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,644 | aymane081/python_algo | refs/heads/master | /trees/complete_tree_nodes_count.py | class Solution:
def count_nodes(self, node):
if not node:
return 0
left_depth, right_depth = self.get_depth(node.left), self.get_depth(node.right)
if left_depth == right_depth:
#left side is complete
return 2 ** (left_depth) + self.count_nodes(no... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,645 | aymane081/python_algo | refs/heads/master | /utils/graph.py | from collections import defaultdict
class Vertex:
def __init__(self, key):
self.id =key
self.connectedTo = {}
def add_neighbor(self, nbr, weight = 0):
self.connectedTo[nbr] = weight
def __str__(self):
return str(self.id) + ' connectedTo: ' + str([x.id for x in self... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,646 | aymane081/python_algo | refs/heads/master | /graphs/pacific_atlantic.py | from utils.matrix import Matrix
class Solution:
def pacific_atlantic(self, matrix):
if not matrix or not matrix[0]:
return []
rows, cols = len(matrix), len(matrix[0])
pacific, atlantic = set(), set()
for row in range(rows):
atlantic.add((row, cols -... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,647 | aymane081/python_algo | refs/heads/master | /next_right_pointer2.py | class Solution:
def connect(self, node):
if not node:
return
level = [node]
while level:
prev = None
next_level = []
for node in level:
if prev:
prev.next = node
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,648 | aymane081/python_algo | refs/heads/master | /dynamicProgramming/coin_change.py | class Solution:
def coin_change(self, coins, amount):
if amount < 1:
return -1
memo = [0 for _ in range(amount)]
return self.helper(coins, amount, memo)
def helper(self, coins, amount, memo):
if amount < 0:
return -1
if amoun... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,649 | aymane081/python_algo | refs/heads/master | /trees/binary_tree_zigzag_level_order.py | from utils.treeNode import TreeNode
from utils.treeUtils import generate_tree
class Solution:
def get_zigzag_level_order(self, node):
result = []
if not node:
return result
should_reverse = False
level_nodes = [node]
while level_nodes:
result... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,650 | aymane081/python_algo | refs/heads/master | /linkedList/swap_nodes_in_pair.py | #24
from utils.listNode import ListNode
class Solution:
def swap_pairs(self, head):
if not head:
return None
dummy = prev = ListNode(None)
while head and head.next:
next_head = head.next.next
prev.next = head.next
head.next.next = head
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,651 | aymane081/python_algo | refs/heads/master | /trees/add_one_row_to_tree.py | # 623
from utils.treeNode import TreeNode
# time: O(N)
# space: O(N) or the max number of node at each level
class Solution:
def add_row(self, root, v, d):
if d == 1:
new_root = TreeNode(v)
new_root.left = root
return new_root
current_level = [root]
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,652 | aymane081/python_algo | refs/heads/master | /trees/tree_from_preorder_inorder.py | from utils.treeUtils import TreeNode
class Solution:
def build_tree(self, pre_order, in_order):
if not pre_order:
return None
return self.helper(0, 0, len(in_order) - 1, pre_order, in_order)
def helper(self, pre_start, in_start, in_end, pre_order, in_order):
if... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,653 | aymane081/python_algo | refs/heads/master | /strings/basic_calculator.py | class Solution(object):
# O(n) time and space
def basic_calculator(self, expression):
if not expression:
return
stack = []
num = 0
operation = '+'
for i, c in enumerate(expression):
if c.isdigit():
num = num * 10 + int(c)
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,654 | aymane081/python_algo | refs/heads/master | /linkedList/add_two_numbers.py | # 445
from utils.listNode import ListNode
class Solution:
def add(self, head1, head2):
num1 = self.listToInt(head1)
num2 = self.listToInt(head2)
return self.intToList(num1 + num2)
def listToInt(self, head):
result = 0
if not head:
return result
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,655 | aymane081/python_algo | refs/heads/master | /trees/bst_iterator.py | from utils.treeNode import TreeNode
class BSTIterator:
# O(n) worst case for time and space
def __init__(self, root):
self.stack = []
while root:
self.stack.append(root)
root = root.left
# O(1) time and space
def has_next(self):
return len(self.stack... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,656 | aymane081/python_algo | refs/heads/master | /binarySearch/search_insert_position.py | class Solution:
def get_insert_position(self, nums, value):
left, right = 0, len(nums) - 1
# left <= right because we want the first occurrence of left > right, aka, left is bigger than value
while left <= right:
mid = (left + right) // 2
if mid == value:
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,657 | aymane081/python_algo | refs/heads/master | /trees/path_sum2.py | from utils.treeNode import TreeNode
class Solution:
def get_paths_sum(self, node, target):
result = []
if not node:
return result
self.get_paths_helper([], target, node, result)
return result
def get_paths_helper(self, path, target, node, result):
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,658 | aymane081/python_algo | refs/heads/master | /arrays/subsets.py | class Solution:
# Time: O(2 ** n), space(n * 2**n)
def generate_subsets_from_unique(self, nums):
result = []
self.backtrack(nums, [], 0, result)
return result
def generate_subsets_from_duplicates(self, nums):
result = []
nums.sort()
self.backtrack(nums, [... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,659 | aymane081/python_algo | refs/heads/master | /arrays/four_way.py | # time: O(n ** 3)
class Solution:
ELEMENTS_COUNT = 4
def four_way(self, nums, target):
results = []
self.n_way(sorted(nums), target, [], self.ELEMENTS_COUNT, results)
return results
def n_way(self, nums, target, partial, n, results):
if len(nums) < n or nums[0] * n > t... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,660 | aymane081/python_algo | refs/heads/master | /linkedList/insertion_sort_list.py | # 147
from utils.listNode import ListNode
# time: O(N ** 2)
# space: O(1)
class Solution:
def insert_sort_list(self, head):
sorted_tail = dummy = ListNode(float('-inf'))
dummy.next = head
while sorted_tail.next:
node = sorted_tail.next
if node.value >= sorted_... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,661 | aymane081/python_algo | refs/heads/master | /arrays/find_duplicate.py | class Solution:
def get_duplicate(self, nums):
if not nums:
return
slow = nums[0]
fast = nums[slow] # which is nums[nums[0]]
while slow != fast:
slow = nums[slow]
fast = nums[nums[fast]]
fast = 0
while slow != fast... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,662 | aymane081/python_algo | refs/heads/master | /arrays/min_cost_climbing_stairs.py | # 746
class Solution:
def min_cost(self, costs):
one_before, two_before = costs[1], costs[0]
for i in range(2, len(costs)):
one_before, two_before = min(one_before, two_before) + costs[i], one_before
return min(one_before, two_before)
solution = Solution()
costs = [1... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,663 | aymane081/python_algo | refs/heads/master | /arrays/two_sum_sorted_array.py | class Solution(object):
def two_sum(self, numbers, target):
"""
:type numbers: List[int]
:type target: int
:rtype: Tuple(int)
"""
left, right = 0, len(numbers) - 1
while left < right:
pair_sum = numbers[left] + numbers[right]
if pair_s... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,664 | aymane081/python_algo | refs/heads/master | /trees/flatten_binary_tree.py | from utils.treeNode import TreeNode
from utils.treeUtils import generate_tree
class Solution:
def __init__(self):
self.prev = None
def flatten(self, node):
if not node:
return None
self.prev = node
self.flatten(node.left)
temp = node.right
node.rig... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,665 | aymane081/python_algo | refs/heads/master | /trees/find_bottom_left_value.py | # 513
from utils.treeNode import TreeNode
# time: O(N)
# space: O(N)
class Solution:
def find_bottom_left_value(self, root):
level = [root]
most_left = None
while level:
most_left = level[0].value
new_level = []
for node in level:
if no... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,666 | aymane081/python_algo | refs/heads/master | /arrays/remove_element.py | class Solution(object):
def remove_element(self, arr, val):
if not arr:
return 0
j = 0
for i in range(len(arr)):
if arr[i] != val:
arr[j] = arr[i]
j += 1
for i in range(len(arr) - j):
arr.pop()
ret... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,667 | aymane081/python_algo | refs/heads/master | /dynamicProgramming/ugly_number.py | class Solution:
def get_ugly_number(self, n, primes):
if n <= 0:
return 0
if n == 1:
return 1
uglys = [1]
indices = [0 for _ in range(len(primes))]
candidates = primes[:]
while len(uglys) < n:
ugly = min(candidates)
u... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,668 | aymane081/python_algo | refs/heads/master | /trees/unique_bst.py | class Solution:
def get_unique_bst_count(self, n):
if n <= 0:
return 0
return self.get_unique_bst_count_rec(1, n)
def get_unique_bst_count_rec(self, start, end):
if start >= end:
return 1
result = 0
for i in range(start, end ... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,669 | aymane081/python_algo | refs/heads/master | /graphs/network_delay_time.py | from collections import defaultdict
class Solution:
def networkDelayTime(self, times, K):
graph = self.build_graph(times)
dist = { node: int('float') for node in graph }
def dfs(node, elapsed):
if elapsed >= dist[node]:
return
dist[node]... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,670 | aymane081/python_algo | refs/heads/master | /trees/tree_from_postorder_inorder.py | from utils.treeNode import TreeNode
class Solution:
def build_tree(self, in_order, post_order):
if not in_order:
return None
return self.build(len(post_order) - 1, 0, len(in_order) - 1, in_order, post_order)
def build(self, post_end, in_start, in_end, in_order, post_or... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,671 | aymane081/python_algo | refs/heads/master | /arrays/unique_paths2.py | import unittest
class Solution:
def get_unique_paths_count(self, matrix):
row_count, col_count = len(matrix), len(matrix[0])
if row_count == 0 or col_count == 0:
raise Exception('Unvalid Matrix')
if matrix[0][0] or matrix[-1][-1]:
return 0
r... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,672 | aymane081/python_algo | refs/heads/master | /arrays/find_minimum_rotated_sorted_arary.py | class Solution:
def get_minimum(self, nums):
left, right = 0, len(nums) - 1
while left < right:
if nums[left] <= nums[right]: # sorted array, return nums[left]
break
mid = (left + right) // 2
if nums[mid] < nums[left]: # min is either mid the left ... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,673 | aymane081/python_algo | refs/heads/master | /linkedList/palindrome_linked_list.py | # 234
from utils.listNode import ListNode
class Solution:
def is_palindrome(self, head):
if not head:
return False
rev, slow, fast = None, head, head
while fast and fast.next:
fast = fast.next.next
rev, rev.next, slow = slow, rev, slow.next
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,674 | aymane081/python_algo | refs/heads/master | /arrays/rotate_array.py | class Solution(object):
# O(N) time and space
def rotate_array(self, numbers, k):
"""
:type numbers: List[int]
:type k: int
:rtype: List[int]
"""
n = len(numbers)
if k > n:
raise ValueError('The array is not long enough to be rotated')
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,675 | aymane081/python_algo | refs/heads/master | /trees/left_leaves_sum.py | from utils.treeNode import TreeNode
class Solution:
#O(N) time, O(1) space
def get_left_leaves_sum(self, node):
result = 0
if not node:
return result
if node.left and not node.left.left and not node.left.right:
result += node.left.value
else:
... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,676 | aymane081/python_algo | refs/heads/master | /arrays/minimum_size_subarray_sum.py | class Solution:
def get_min_length(self, nums, target):
"""
type nums: List[int]
type target: int
:rtype : int
"""
min_length, sum_so_far, start = len(nums), 0, 0
for i, num in enumerate(nums):
sum_so_far += num
while sum_so_far - nums[... | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,677 | aymane081/python_algo | refs/heads/master | /arrays/missing_element.py | class Solution(object):
def missing_element(self, numbers):
"""
:type numbers: List[int]
:rtype: int
"""
n = len(numbers)
return (n * (n + 1) // 2) - sum(numbers)
solution = Solution()
numbers = [0, 2, 5, 3, 1]
print(solution.missing_element(numbers)) | {"/linkedList/linked_list_cycle.py": ["/utils/listNode.py"], "/linkedList/reverse_linked_list.py": ["/utils/listNode.py"], "/dynamicProgramming/range_sum_query2.py": ["/utils/matrix.py"], "/linkedList/remove_duplicates.py": ["/utils/listNode.py"], "/linkedList/delete_nth_node_from_end.py": ["/utils/listNode.py"], "/lin... |
9,682 | tsurrdurr/MNIST-classification | refs/heads/master | /read_data.py | import fileinput
import struct
from sklearn.externals import joblib
root = "YOUR ROOT PATH ENDING WITH SLASH"
def main():
labels_path = root + "train-labels-idx1-ubyte.gz"
labels = get_labels(labels_path)
joblib.dump(labels, root + "labels.joblib.pkl")
images_path = root + "train-images-idx3-ubyte.gz"
... | {"/classification.py": ["/classifier_svc.py", "/classifier_sgd.py", "/classifier_nb.py", "/classifier_kn.py", "/read_data.py"], "/prediction.py": ["/read_data.py"]} |
9,683 | tsurrdurr/MNIST-classification | refs/heads/master | /classifier_kn.py | from sklearn.neighbors import KNeighborsClassifier
def classify(images, labels):
nbrs = KNeighborsClassifier(n_neighbors=3)
nbrs.fit(images, labels)
print("Accuracy: ", nbrs.score(images, labels))
return nbrs | {"/classification.py": ["/classifier_svc.py", "/classifier_sgd.py", "/classifier_nb.py", "/classifier_kn.py", "/read_data.py"], "/prediction.py": ["/read_data.py"]} |
9,684 | tsurrdurr/MNIST-classification | refs/heads/master | /classifier_nb.py | from sklearn.naive_bayes import MultinomialNB
def classify(images, labels):
mnb = MultinomialNB()
mnb.fit(images, labels)
print("Accuracy: ", mnb.score(images, labels))
return mnb | {"/classification.py": ["/classifier_svc.py", "/classifier_sgd.py", "/classifier_nb.py", "/classifier_kn.py", "/read_data.py"], "/prediction.py": ["/read_data.py"]} |
9,685 | tsurrdurr/MNIST-classification | refs/heads/master | /classifier_sgd.py | from sklearn.linear_model import SGDClassifier
def classify(images, labels):
clf = SGDClassifier(loss="hinge", penalty="l2")
clf.fit(images, labels)
print("Accuracy: ", clf.score(images, labels))
return clf | {"/classification.py": ["/classifier_svc.py", "/classifier_sgd.py", "/classifier_nb.py", "/classifier_kn.py", "/read_data.py"], "/prediction.py": ["/read_data.py"]} |
9,686 | tsurrdurr/MNIST-classification | refs/heads/master | /classifier_svc.py | from sklearn import svm
def classify(images, labels):
C = 1.0 # SVM regularization parameter
lin_svc = svm.LinearSVC(C=C)
lin_svc.fit(images, labels)
print("Accuracy: ", lin_svc.score(images, labels))
return lin_svc | {"/classification.py": ["/classifier_svc.py", "/classifier_sgd.py", "/classifier_nb.py", "/classifier_kn.py", "/read_data.py"], "/prediction.py": ["/read_data.py"]} |
9,687 | tsurrdurr/MNIST-classification | refs/heads/master | /classification.py | import numpy as np
import classifier_svc as SVC
import classifier_sgd as SGD
import classifier_nb as NB
import classifier_kn as KN
from sklearn.externals import joblib
from read_data import root
import sys
def main():
if sys.argv[1:]:
argument = sys.argv[1]
else:
argument = None
if(argument... | {"/classification.py": ["/classifier_svc.py", "/classifier_sgd.py", "/classifier_nb.py", "/classifier_kn.py", "/read_data.py"], "/prediction.py": ["/read_data.py"]} |
9,688 | tsurrdurr/MNIST-classification | refs/heads/master | /prediction.py | import numpy as np
import read_data as reader
from sklearn.externals import joblib
from read_data import root
def normalize(image):
image = np.asanyarray(image)
image = image.reshape(10000, -10000)
return image
def main():
test_images_path = root + "t10k-images-idx3-ubyte.gz"
test_labels_path = r... | {"/classification.py": ["/classifier_svc.py", "/classifier_sgd.py", "/classifier_nb.py", "/classifier_kn.py", "/read_data.py"], "/prediction.py": ["/read_data.py"]} |
9,689 | StefanM98/Project-Movie-Trailer-Website | refs/heads/master | /entertainment_center.py | import media
import fresh_tomatoes
# Create new instances of the Movie class for each movie
moana = media.Movie("Moana",
"https://upload.wikimedia.org/wikipedia/en/2/26/"
"Moana_Teaser_Poster.jpg",
"https://youtu.be/LKFuXETZUsI")
zootopia = media.Movie("Zoo... | {"/entertainment_center.py": ["/media.py"]} |
9,690 | StefanM98/Project-Movie-Trailer-Website | refs/heads/master | /media.py | """Define the Movie class which gives us the basic format of each
movie instance upon initalization."""
class Movie():
def __init__(self, movie_title, box_art, trailer_link):
self.title = movie_title
self.poster_image_url = box_art
self.trailer_youtube_url = trailer_link
| {"/entertainment_center.py": ["/media.py"]} |
9,725 | abbass2/pyqstrat | refs/heads/master | /pyqstrat/notebooks/support/build_example_strategy.py | # type: ignore
# flake8: noqa
import pandas as pd
import numpy as np
import math
from types import SimpleNamespace
import pyqstrat as pq
def sma(contract_group, timestamps, indicators, strategy_context): # simple moving average
sma = pd.Series(indicators.c).rolling(window = strategy_context.lookback_period).mean(... | {"/pyqstrat/notebooks/support/build_example_strategy.py": ["/pyqstrat/__init__.py"]} |
9,726 | abbass2/pyqstrat | refs/heads/master | /pyqstrat/__init__.py | # flake8: noqa
# include functions for easy reference from pq prefix
from pyqstrat.pq_utils import *
from pyqstrat.pq_types import *
from pyqstrat.pq_io import *
from pyqstrat.holiday_calendars import *
from pyqstrat.markets import *
from pyqstrat.account import *
from pyqstrat.strategy import *
from pyqstrat.portfoli... | {"/pyqstrat/notebooks/support/build_example_strategy.py": ["/pyqstrat/__init__.py"]} |
9,727 | abbass2/pyqstrat | refs/heads/master | /setup.py | import setuptools
from Cython.Build import cythonize
from distutils.core import setup, Extension
import numpy as np
import pybind11
import glob
import os
import sys
if __name__ == '__main__':
_conda_prefix = os.getenv('CONDA_PREFIX')
_conda_prefix_1 = os.getenv('CONDA_PREFIX_1')
if _conda_prefix is None a... | {"/pyqstrat/notebooks/support/build_example_strategy.py": ["/pyqstrat/__init__.py"]} |
9,750 | Gigibit/ubildin | refs/heads/master | /comments/admin.py | from django.contrib import admin
from .models import Comment
# Register your models here.
class CommentAdmin(admin.ModelAdmin):
list_display = ('comment', 'created_date', 'created_time')
fields = ('event', 'comment', 'created_by')
search_fields = ('comment',)
admin.site.register(Comment, CommentAdmin)... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,751 | Gigibit/ubildin | refs/heads/master | /apiv1/views.py | from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import permissions, reverse, generics
# Create your views here.
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,752 | Gigibit/ubildin | refs/heads/master | /userprofile/migrations/0002_auto_20180508_0004.py | # Generated by Django 2.0.4 on 2018-05-08 00:04
import cloudinary.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='profile',
optio... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,753 | Gigibit/ubildin | refs/heads/master | /lib/python3.7/site-packages/filebrowser/compat.py | # coding: utf-8
def get_modified_time(storage, path):
if hasattr(storage, "get_modified_time"):
return storage.get_modified_time(path)
return storage.modified_time(path)
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,754 | Gigibit/ubildin | refs/heads/master | /events/migrations/0003_auto_20180424_1611.py | # Generated by Django 2.0.4 on 2018-04-24 16:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0002_auto_20180421_2218'),
]
operations = [
migrations.RenameField(
model_name='comment',
old_name='post',
... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,755 | Gigibit/ubildin | refs/heads/master | /events/forms.py | from django import forms
from tinymce import TinyMCE
from .models import Event
class TinyMCEWidget(TinyMCE):
def use_required_attribute(self, *args):
return False
class EventForm(forms.ModelForm):
details = forms.CharField(
widget=TinyMCEWidget(
attrs={'required':False, 'cols':... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,756 | Gigibit/ubildin | refs/heads/master | /userprofile/models.py | from django.db import models
from django.conf import settings
from django.shortcuts import reverse
from cloudinary.models import CloudinaryField
from events.models import Event
# Create your models here.
class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,757 | Gigibit/ubildin | refs/heads/master | /comments/tests/test_views.py | from django.test import TestCase
from django.shortcuts import reverse
from events.models import Event, User, Category
from comments.models import Comment
class CommentDeleteViewTest(TestCase):
def setUp(self):
self.user = User.objects.create_user(username='iyanu', password=12345, email='iyanu@gmail.com... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,758 | Gigibit/ubildin | refs/heads/master | /userprofile/tests/test_models.py | from django.test import TestCase
from django.contrib.auth.models import User
from userprofile.models import Profile
class ProfileModelTest(TestCase):
@classmethod
def setUpTestData(cls):
user = User.objects.create(username='iyanu', password=12345, email='iyanu@gmail.com')
Profile.objects.cre... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,759 | Gigibit/ubildin | refs/heads/master | /userprofile/urls.py | from django.urls import path
from . import views
app_name = 'userprofile'
urlpatterns = [
path('edit/', views.edit_profile, name='edit'),
path('detail/<int:pk>/', views.UserDetail.as_view(), name='detail'),
]
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,760 | Gigibit/ubildin | refs/heads/master | /events/tests/test_models.py | from django.test import TestCase
from events.models import Event, Category, User
class EventModelTest(TestCase):
@classmethod
def setUpTestData(cls):
category = Category.objects.create(name='Technology', description='This is the future')
user = User.objects.create(username='iyanu', password=... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,761 | Gigibit/ubildin | refs/heads/master | /events/migrations/0006_auto_20180425_1825.py | # Generated by Django 2.0.4 on 2018-04-25 18:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0005_auto_20180425_1727'),
]
operations = [
migrations.AlterField(
model_name='event',
name='details',
... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,762 | Gigibit/ubildin | refs/heads/master | /events/urls.py | from django.urls import path
from . import views
app_name = 'events'
urlpatterns = [
path('', views.EventList.as_view(), name='event-list'),
path('events/<int:pk>/', views.EventDetail.as_view(), name='event-detail'),
path('events/new/', views.EventCreate.as_view(), name='event-create' ),
path('events/<... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,763 | Gigibit/ubildin | refs/heads/master | /comments/tests/test_forms.py | from django.test import TestCase
from events.models import Category, Event, User
from userprofile.models import Profile
from comments.models import Comment
from comments.forms import CommentForm
class CommentFormTest(TestCase):
def setUp(self):
category = Category.objects.create(name='Technology', desc... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,764 | Gigibit/ubildin | refs/heads/master | /events/migrations/0001_initial.py | # Generated by Django 2.0.4 on 2018-04-21 15:39
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,765 | Gigibit/ubildin | refs/heads/master | /userprofile/migrations/0003_auto_20180516_1534.py | # Generated by Django 2.0.4 on 2018-05-16 15:34
import cloudinary.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0002_auto_20180508_0004'),
]
operations = [
migrations.AlterField(
model_name='profile',
... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,766 | Gigibit/ubildin | refs/heads/master | /events/templatetags/events_tags.py | from django import template
from ..models import Event
from comments.models import Comment
register = template.Library()
@register.simple_tag(name='total')
def total_attending():
pass
@register.simple_tag()
def total_comments():
return Comment.objects.count() | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,767 | Gigibit/ubildin | refs/heads/master | /events/tests/test_views.py | from django.test import TestCase
from django.urls import reverse
from comments.models import Comment
from comments.forms import CommentForm
from events.models import Event, Category, User
class EventListViewTest(TestCase):
def setUp(self):
user = User.objects.create_user(username='iyanu', password=123... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,768 | Gigibit/ubildin | refs/heads/master | /userprofile/migrations/0004_auto_20180523_1407.py | # Generated by Django 2.0.4 on 2018-05-23 14:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0003_auto_20180516_1534'),
]
operations = [
migrations.AlterModelOptions(
name='profile',
options={'verbose_n... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,769 | Gigibit/ubildin | refs/heads/master | /lib/python3.7/site-packages/tests/models.py | from .test_base import *
from .test_commands import *
from .test_decorators import *
from .test_settings import *
from .test_sites import *
from .test_templatetags import *
from .test_versions import *
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,770 | Gigibit/ubildin | refs/heads/master | /events/migrations/0008_auto_20180428_0831.py | # Generated by Django 2.0.4 on 2018-04-28 08:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0007_auto_20180427_2316'),
]
operations = [
migrations.AlterField(
model_name='event',
name='details',
... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,771 | Gigibit/ubildin | refs/heads/master | /apiv1/urls.py | from django.urls import path, include
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.routers import DefaultRouter
from . import viewsets
router = DefaultRouter()
router.register(r'events', viewsets.EventViewset)
router.register(r'comments', viewsets.CommentViewset)
router.register(... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,772 | Gigibit/ubildin | refs/heads/master | /actions/views.py | from django.shortcuts import render
from django.views.generic import ListView
from .models import Action
# Create your views here.
class NotificationList(ListView):
model = Action
template_name = 'actions/notifications.html'
context_object_name = 'actions'
def get_queryset(self):
return Act... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,773 | Gigibit/ubildin | refs/heads/master | /userprofile/views.py | from django.shortcuts import render
from django.views import generic
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from events.models import Event
from comments.models import Comment
from .forms import Pr... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,774 | Gigibit/ubildin | refs/heads/master | /events/models.py | from django.db import models
from django.conf import settings
from django.shortcuts import reverse
from django.contrib.auth.models import User
from tinymce import HTMLField
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=50, unique=True)
description = models.Text... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,775 | Gigibit/ubildin | refs/heads/master | /comments/forms.py | from django import forms
from .models import Comment
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ('comment', 'parent')
widgets = {
'comment': forms.Textarea(attrs={'class': 'form-control'}),
'parent': forms.HiddenInput()
}
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,776 | Gigibit/ubildin | refs/heads/master | /userprofile/tests/test_forms.py | from django.test import TestCase
from django.contrib.auth.models import User
from userprofile.forms import ProfileForm
from userprofile.models import Profile
class ProfileFormTest(TestCase):
def setUp(self):
self.user = User.objects.create(username='iyanu', password=12345, email='iyanu@gmail.com')
... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,777 | Gigibit/ubildin | refs/heads/master | /events/admin.py | from django.contrib import admin
from .models import Category, Event
# Register your models here.
class CategoryAdmin(admin.ModelAdmin):
list_display = ('name', 'description')
fields = ('name', 'description')
admin.site.register(Category, CategoryAdmin)
class EventAdmin(admin.ModelAdmin):
list_dis... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,778 | Gigibit/ubildin | refs/heads/master | /apiv1/serializers.py | from rest_framework import serializers
from events.models import Category, Event, User
from comments.models import Comment
from userprofile.models import Profile
from actions.models import Action
class UserSerializer(serializers.HyperlinkedModelSerializer):
events = serializers.HyperlinkedRelatedField(many=True,... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,779 | Gigibit/ubildin | refs/heads/master | /comments/urls.py | from django.urls import path
from . import views
app_name = 'comments'
urlpatterns = [
path('<int:pk>/delete/', views.CommentDelete.as_view(), name='comment-delete'),
path('<comment_id>/<event_id>/detail/', views.comment_detail, name='comment-detail'),
]
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,780 | Gigibit/ubildin | refs/heads/master | /events/tests/test_forms.py | from django.test import TestCase
from events.forms import EventForm
from events.models import Event, Category, User
class EventFormTest(TestCase):
def setUp(self):
self.category = Category.objects.create(name='Technology', description='This is the future')
self.user = User.objects.create(userna... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,781 | Gigibit/ubildin | refs/heads/master | /events/templatetags/events_filters.py | from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter(name='total_attendees')
def all_caps(text):
pass | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,782 | Gigibit/ubildin | refs/heads/master | /apiv1/viewsets.py |
from rest_framework import viewsets, permissions
from rest_framework.decorators import action
from rest_framework.response import Response
from .serializers import CategorySerializer, EventSerializer, CommentSerializer, ProfileSerializer, ActionSerializer
from events.models import Category, Event
from comments.models... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,783 | Gigibit/ubildin | refs/heads/master | /accounts/views.py | from django.urls import reverse_lazy
from django.views import generic
from .forms import SignUpForm
# Create your views here.
class SignUp(generic.CreateView):
form_class = SignUpForm
template_name = 'registration/signup.html'
success_url = reverse_lazy('login')
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,784 | Gigibit/ubildin | refs/heads/master | /actions/urls.py | from django.urls import path
from . import views
app_name = 'actions'
urlpatterns = [
path('', views.NotificationList.as_view(), name='notification_list')
]
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,785 | Gigibit/ubildin | refs/heads/master | /comments/models.py | from django.db import models
from django.conf import settings
from django.shortcuts import reverse
from events.models import Event
# Create your models here.
class Comment(models.Model):
comment = models.TextField(max_length=500)
created_date = models.DateField(auto_now=True)
created_time = models.TimeFi... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,786 | Gigibit/ubildin | refs/heads/master | /comments/tests/test_models.py | from django.test import TestCase
from events.models import Category, Event, User
from userprofile.models import Profile
from comments.models import Comment
class CommentModelTest(TestCase):
@classmethod
def setUpTestData(cls):
category = Category.objects.create(name='Technology', description='This ... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,787 | Gigibit/ubildin | refs/heads/master | /events/views.py | from django.views import generic
from django.urls import reverse_lazy
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import get_object_or_404, redirect
from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin
from django.contrib.auth.models impor... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,788 | Gigibit/ubildin | refs/heads/master | /lib/python3.7/site-packages/tests/test_namers.py | # coding: utf-8
import shutil
from mock import patch
from filebrowser.settings import VERSIONS
from tests import FilebrowserTestCase as TestCase
from filebrowser.namers import OptionsNamer
class BaseNamerTests(TestCase):
NAMER_CLASS = OptionsNamer
def setUp(self):
super(BaseNamerTests, self).setU... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,789 | Gigibit/ubildin | refs/heads/master | /accounts/forms.py | from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from userprofile.models import Profile
from actions.utils import create_action
class SignUpForm(UserCreationForm):
first_name = forms.CharField(max_length=50, required=False, help_text='Opt... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,790 | Gigibit/ubildin | refs/heads/master | /actions/tests/test_models.py | from django.test import TestCase
from django.contrib.auth.models import User
from actions.models import Action
class ActionModelTest(TestCase):
@classmethod
def setUpTestData(cls):
user = User.objects.create_user(username='iyanu', password=12345)
action = Action.objects.create(user = user, ... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,791 | Gigibit/ubildin | refs/heads/master | /bin/django-admin.py | #!/Users/luigichougrad/Downloads/meethub-master/bin/python3.7
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,792 | Gigibit/ubildin | refs/heads/master | /userprofile/tests/test_views.py | from django.test import TestCase
from django.contrib.auth.models import User
from django.shortcuts import reverse
from userprofile.models import Profile
class ProfileDetailViewTest(TestCase):
def setUp(self):
self.user = User.objects.create_user(username='iyanu', password=12345, email='iyanu@gmail.com')... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,793 | Gigibit/ubildin | refs/heads/master | /comments/views.py | from django.urls import reverse_lazy
from django.views import generic
from django.contrib.messages.views import SuccessMessageMixin
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.decorators import login_required
from django.views import View
from d... | {"/comments/admin.py": ["/comments/models.py"], "/events/forms.py": ["/events/models.py"], "/userprofile/models.py": ["/events/models.py"], "/comments/tests/test_views.py": ["/events/models.py", "/comments/models.py"], "/userprofile/tests/test_models.py": ["/userprofile/models.py"], "/events/tests/test_models.py": ["/e... |
9,802 | ReimuYk/ifstools | refs/heads/master | /ifstools/ifs.py | from collections import defaultdict
from multiprocessing import Pool
from os.path import basename, dirname, splitext, join, isdir, isfile, getmtime
from os import utime, walk
from io import BytesIO
import itertools
import hashlib
import lxml.etree as etree
from time import time as unixtime
from tqdm import t... | {"/ifstools/ifs.py": ["/ifstools/handlers/__init__.py", "/ifstools/__init__.py"], "/ifstools/handlers/TexFolder.py": ["/ifstools/handlers/__init__.py", "/ifstools/handlers/ImageDecoders.py"], "/ifstools/handlers/MD5Folder.py": ["/ifstools/handlers/__init__.py"], "/ifstools_bin.py": ["/ifstools/__init__.py"], "/ifstools... |
9,803 | ReimuYk/ifstools | refs/heads/master | /ifstools/handlers/TexFolder.py | from io import BytesIO
from kbinxml import KBinXML
from tqdm import tqdm
from PIL import Image, ImageDraw
from . import MD5Folder, ImageFile, GenericFile
from .ImageDecoders import cachable_formats
class TextureList(GenericFile):
def _load_from_filesystem(self, **kwargs):
raw = GenericFile._load_from_fil... | {"/ifstools/ifs.py": ["/ifstools/handlers/__init__.py", "/ifstools/__init__.py"], "/ifstools/handlers/TexFolder.py": ["/ifstools/handlers/__init__.py", "/ifstools/handlers/ImageDecoders.py"], "/ifstools/handlers/MD5Folder.py": ["/ifstools/handlers/__init__.py"], "/ifstools_bin.py": ["/ifstools/__init__.py"], "/ifstools... |
9,804 | ReimuYk/ifstools | refs/heads/master | /ifstools/utils.py | import errno
import os
def mkdir_silent(dir):
try: # python 3
FileExistsError
try:
os.mkdir(dir)
except FileExistsError:
pass
except NameError: # python 2
try:
os.mkdir(dir)
except OSError as e:
if e.errno == errno.EEXIST:
... | {"/ifstools/ifs.py": ["/ifstools/handlers/__init__.py", "/ifstools/__init__.py"], "/ifstools/handlers/TexFolder.py": ["/ifstools/handlers/__init__.py", "/ifstools/handlers/ImageDecoders.py"], "/ifstools/handlers/MD5Folder.py": ["/ifstools/handlers/__init__.py"], "/ifstools_bin.py": ["/ifstools/__init__.py"], "/ifstools... |
9,805 | ReimuYk/ifstools | refs/heads/master | /ifstools/handlers/lz77.py | # consistency with py 2/3
from builtins import bytes
from struct import unpack, pack
from io import BytesIO
from tqdm import tqdm
WINDOW_SIZE = 0x1000
WINDOW_MASK = WINDOW_SIZE - 1
THRESHOLD = 3
INPLACE_THRESHOLD = 0xA
LOOK_RANGE = 0x200
MAX_LEN = 0xF + THRESHOLD
def decompress(input):
input = BytesIO(input)
... | {"/ifstools/ifs.py": ["/ifstools/handlers/__init__.py", "/ifstools/__init__.py"], "/ifstools/handlers/TexFolder.py": ["/ifstools/handlers/__init__.py", "/ifstools/handlers/ImageDecoders.py"], "/ifstools/handlers/MD5Folder.py": ["/ifstools/handlers/__init__.py"], "/ifstools_bin.py": ["/ifstools/__init__.py"], "/ifstools... |
9,806 | ReimuYk/ifstools | refs/heads/master | /ifstools/handlers/ImageDecoders.py | from io import BytesIO
from struct import unpack, pack
from PIL import Image
from tqdm import tqdm
# header for a standard DDS with DXT5 compression and RGBA pixels
# gap placed for image height/width insertion
dxt_start = b'DDS |\x00\x00\x00\x07\x10\x00\x00'
dxt_middle = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\... | {"/ifstools/ifs.py": ["/ifstools/handlers/__init__.py", "/ifstools/__init__.py"], "/ifstools/handlers/TexFolder.py": ["/ifstools/handlers/__init__.py", "/ifstools/handlers/ImageDecoders.py"], "/ifstools/handlers/MD5Folder.py": ["/ifstools/handlers/__init__.py"], "/ifstools_bin.py": ["/ifstools/__init__.py"], "/ifstools... |
9,807 | ReimuYk/ifstools | refs/heads/master | /ifstools/handlers/MD5Folder.py | from hashlib import md5
from kbinxml import KBinXML
from . import GenericFolder
class MD5Folder(GenericFolder):
def __init__(self, ifs_data, parent, obj, path = '', name = '', supers = None,
super_disable = False, super_skip_bad = False,
super_abort_if_bad = False, md5_tag = None, extens... | {"/ifstools/ifs.py": ["/ifstools/handlers/__init__.py", "/ifstools/__init__.py"], "/ifstools/handlers/TexFolder.py": ["/ifstools/handlers/__init__.py", "/ifstools/handlers/ImageDecoders.py"], "/ifstools/handlers/MD5Folder.py": ["/ifstools/handlers/__init__.py"], "/ifstools_bin.py": ["/ifstools/__init__.py"], "/ifstools... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.