index int64 | repo_name string | branch_name string | path string | content string | import_graph string |
|---|---|---|---|---|---|
14,431 | Kyungpyo-Kang/EV | refs/heads/master | /Community/views.py | from django.shortcuts import render
def community(request):
return render(request, 'community.html')
| {"/EV/urls.py": ["/Community/views.py", "/Member/views.py", "/Recommand/views.py"], "/Member/views.py": ["/Member/models.py"]} |
14,432 | ashok-arjun/fsl_ssl | refs/heads/master | /methods/.ipynb_checkpoints/protonet-checkpoint.py | # This code is modified from https://github.com/jakesnell/prototypical-networks
import backbone
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from methods.meta_template import MetaTemplate
from model_resnet import *
from itertools import cycle... | {"/.ipynb_checkpoints/train-checkpoint.py": ["/methods/baselinetrain.py"]} |
14,433 | ashok-arjun/fsl_ssl | refs/heads/master | /merge.py | import os
import shutil
subfolders = os.listdir("miniImageNet/images")
print(subfolders)
for folder in subfolders:
files = os.listdir(os.path.join("miniImageNet/images", folder))
for file in files:
shutil.move(os.path.join("miniImageNet/images/"+folder, file), "miniImageNet/images/"+file)
os.rmdi... | {"/.ipynb_checkpoints/train-checkpoint.py": ["/methods/baselinetrain.py"]} |
14,434 | ashok-arjun/fsl_ssl | refs/heads/master | /wandb_restore.py | # This script will ask for a wandb run ID and restore path
import wandb
RUN_ID = "27wluxlz"
PATH = "ckpts/dogs/_resnet18_baseline_aug_tracking_lr0.0010/last_model.tar"
wandb.init(id=RUN_ID, project="fsl_ssl", resume=True)
wandb.restore(PATH) | {"/.ipynb_checkpoints/train-checkpoint.py": ["/methods/baselinetrain.py"]} |
14,435 | ashok-arjun/fsl_ssl | refs/heads/master | /.ipynb_checkpoints/io_utils-checkpoint.py | import numpy as np
import os
import glob
import argparse
import backbone
from model_resnet import *
model_dict = dict(
Conv4 = backbone.Conv4,
Conv4S = backbone.Conv4S,
Conv6 = backbone.Conv6,
ResNet10 = backbone.ResNet10,
ResNet18 = backbone.ResNet18,
... | {"/.ipynb_checkpoints/train-checkpoint.py": ["/methods/baselinetrain.py"]} |
14,436 | ashok-arjun/fsl_ssl | refs/heads/master | /data/dataset_unlabel.py | # This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import torch
from PIL import Image
import json
import numpy as np
import torchvision.transforms as transforms
import os
identity = lambda x:x
import math
def get_patches(img, transform_jigsaw, transform_patch_jigsaw, permutat... | {"/.ipynb_checkpoints/train-checkpoint.py": ["/methods/baselinetrain.py"]} |
14,437 | ashok-arjun/fsl_ssl | refs/heads/master | /methods/baselinetrain.py | import backbone
import utils
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
import torch.nn.functional as F
from model_resnet import *
from resnet_pytorch import *
import wandb
class BaselineTrain(nn.Module):
def __init__(self, model_func, num_class, loss_type = 'softma... | {"/.ipynb_checkpoints/train-checkpoint.py": ["/methods/baselinetrain.py"]} |
14,438 | ashok-arjun/fsl_ssl | refs/heads/master | /.ipynb_checkpoints/train-checkpoint.py | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim
import torch.optim.lr_scheduler as lr_scheduler
import time
import os
import glob
import random
import backbone
from data.datamgr import SimpleDataManager, SetDataManager
from methods.baselinetrain import Basel... | {"/.ipynb_checkpoints/train-checkpoint.py": ["/methods/baselinetrain.py"]} |
14,442 | MeteoSwiss/python-TAMER | refs/heads/main | /python_tamer/subroutines.py | import numpy as np
import pandas as pd
import datetime as dt
import string
def assert_data_shape_24(data,reverse=False,force_second_dim=True) :
"""Simple function to check if first dimension is 24 hours and, if not, reshapes accordingly
"""
datashape = np.shape(data)
# TODO: Could be a big job, but thi... | {"/python_tamer/SpecificDoses.py": ["/python_tamer/subroutines.py"], "/test/test_dummy_library.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificDoses.py"], "/python_tamer/ExposureMap.py": ["/python_tamer/subroutines.py"], "/python_tamer/__init__.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificD... |
14,443 | MeteoSwiss/python-TAMER | refs/heads/main | /python_tamer/SpecificDoses.py | import pandas as pd
import numpy as np
import netCDF4 as nc
from .subroutines import *
class SpecificDoses(pd.DataFrame):
"""A class for specific dose estimates akin to dosimetry measurements
High resolution data allows for personal and ambient dose estimation without the need for
direct measurement. Thi... | {"/python_tamer/SpecificDoses.py": ["/python_tamer/subroutines.py"], "/test/test_dummy_library.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificDoses.py"], "/python_tamer/ExposureMap.py": ["/python_tamer/subroutines.py"], "/python_tamer/__init__.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificD... |
14,444 | MeteoSwiss/python-TAMER | refs/heads/main | /test/test_dummy_library.py | import pytest
import datetime as dt
from python_tamer.ExposureMap import *
from python_tamer.SpecificDoses import *
def test_ExposureMap_max():
test = ExposureMap(date_selection=pd.date_range(start="2018-07-01",end="2018-07-01"),
units = "UVI",
statistic = "max",
data_directory="test/",
src_filen... | {"/python_tamer/SpecificDoses.py": ["/python_tamer/subroutines.py"], "/test/test_dummy_library.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificDoses.py"], "/python_tamer/ExposureMap.py": ["/python_tamer/subroutines.py"], "/python_tamer/__init__.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificD... |
14,445 | MeteoSwiss/python-TAMER | refs/heads/main | /python_tamer/ExposureMap.py | from numpy.core.numeric import True_
import pandas as pd
import numpy as np
import datetime as dt
import os
import re
import netCDF4 as nc
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeat
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from matplotlib.projections i... | {"/python_tamer/SpecificDoses.py": ["/python_tamer/subroutines.py"], "/test/test_dummy_library.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificDoses.py"], "/python_tamer/ExposureMap.py": ["/python_tamer/subroutines.py"], "/python_tamer/__init__.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificD... |
14,446 | MeteoSwiss/python-TAMER | refs/heads/main | /setup.py | from setuptools import setup, find_packages
requirements = [
'pandas',
'netcdf4',
'numpy',
'cartopy',
'matplotlib',
]
setup_requirements = [
'pytest-runner',
]
test_requirements = [
'pytest-cov',
]
extras = {
'test': test_requirements,
}
packages = find_packages(include=['python_tam... | {"/python_tamer/SpecificDoses.py": ["/python_tamer/subroutines.py"], "/test/test_dummy_library.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificDoses.py"], "/python_tamer/ExposureMap.py": ["/python_tamer/subroutines.py"], "/python_tamer/__init__.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificD... |
14,447 | MeteoSwiss/python-TAMER | refs/heads/main | /python_tamer/__init__.py | """ Initializations """
from pkg_resources import get_distribution, DistributionNotFound # What's this?
from .ExposureMap import *
from .SpecificDoses import *
# from yaconfigobject import Config
# try:
# __version__ = get_distribution(__name__).version
# except DistributionNotFound:
# # package is not inst... | {"/python_tamer/SpecificDoses.py": ["/python_tamer/subroutines.py"], "/test/test_dummy_library.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificDoses.py"], "/python_tamer/ExposureMap.py": ["/python_tamer/subroutines.py"], "/python_tamer/__init__.py": ["/python_tamer/ExposureMap.py", "/python_tamer/SpecificD... |
14,450 | Sindroc/coding_problems | refs/heads/main | /rotate_three_quart.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 3 14:37:00 2021
@author: sindy
"""
def three_quarter_rotate(original_matrix):
length = len(original_matrix)
three_quarter_rotate = [None]*length
for row in range(length): # initialize the rotate matrix
thre... | {"/main.py": ["/rotate_right.py", "/rotate_left.py", "/rotate_half.py", "/rotate_three_quart.py"]} |
14,451 | Sindroc/coding_problems | refs/heads/main | /rotate_half.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 3 10:26:55 2021
rotate 180.
@author: sindy
"""
def half_rotate(original_matrix):
length = len(original_matrix)
half_rotate = [None]*length
for row in range(length): # initialize the rotate matrix
half_rotate[... | {"/main.py": ["/rotate_right.py", "/rotate_left.py", "/rotate_half.py", "/rotate_three_quart.py"]} |
14,452 | Sindroc/coding_problems | refs/heads/main | /rotate_right.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 1 23:28:20 2021
Given an image represented by an NxN matrix, where
each pixel in the image is 4 bytes, write a method to
rotate the image by 90 degrees. Can you do this in place?
@author: sindy
"""
def right_rotate(original_matrix):
length =... | {"/main.py": ["/rotate_right.py", "/rotate_left.py", "/rotate_half.py", "/rotate_three_quart.py"]} |
14,453 | Sindroc/coding_problems | refs/heads/main | /main.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 3 09:50:03 2021
@author: sindy
"""
import unittest
import rotate_right
import rotate_left
import rotate_half
import rotate_three_quart
class Test(unittest.TestCase):
def test_left(self):
matriz1 = [[1,2,3], [4,5,6],[7... | {"/main.py": ["/rotate_right.py", "/rotate_left.py", "/rotate_half.py", "/rotate_three_quart.py"]} |
14,454 | Sindroc/coding_problems | refs/heads/main | /rotate_left.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 3 09:47:38 2021
@author: sindy
"""
def left_rotate(original_matrix):
length = len(original_matrix)
left_rotate = [None]*length
for row in range(length): # initialize the rotate matrix
left_rotate[row] = [... | {"/main.py": ["/rotate_right.py", "/rotate_left.py", "/rotate_half.py", "/rotate_three_quart.py"]} |
14,456 | reneichhorn/gameoflife | refs/heads/master | /main.py |
import pyglet
from pyglet import shapes
import random
from cell import Cell
width = 2500
height = 1300
window = pyglet.window.Window(width, height)
scale = 10
cols = width // scale
rows = height // scale
batch = pyglet.graphics.Batch()
width = width - scale
height = height - scale
DEAD = [0, 0, 0]
ALIVE = [255, 255,... | {"/main.py": ["/cell.py"]} |
14,457 | reneichhorn/gameoflife | refs/heads/master | /cell.py | DEAD = [0, 0, 0]
ALIVE = [255, 255, 255]
ALIVESTATE1 = [255, 0, 0]
ALIVESTATE2 = [255, 165, 0]
ALIVESTATE3 = [255, 255, 0]
ALIVESTATE4 = [0, 128, 0]
ALIVESTATE5 = [0, 0, 255]
ALIVESTATE6 = [75, 0, 130]
ALIVESTATE7 = [238, 130, 238]
ALIVESTATE8 = [255, 255, 255]
WITHCOLOR = True
class Cell:
def __init__(self, game... | {"/main.py": ["/cell.py"]} |
14,464 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/recipes.py | # coding: utf-8
u'''
Helper functions to process Conda recipes.
.. versionadded:: 0.18
'''
from __future__ import absolute_import, unicode_literals, print_function
from ruamel.yaml import YAML
from ruamel.yaml.constructor import DuplicateKeyError
import pydash as _py
def find_requirements(recipe_obj, package_name=... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,465 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/__init__.py | # coding: utf-8
'''
.. versionchanged:: 0.13
Add support for Python 3.
.. versionchanged:: 0.21
Add support for ``conda>=4.4``.
'''
from __future__ import absolute_import, print_function, unicode_literals
from ._version import get_versions
from .exe_api import *
from .py_api import *
__version__ = get_versio... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,466 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/__main__.py | # coding: utf-8
u'''
condac - Execute Conda commands, reusing cached output if available.
'''
from __future__ import absolute_import, unicode_literals, print_function
from argparse import ArgumentParser
from collections import OrderedDict
from functools import wraps
import datetime as dt
import re
import subprocess as ... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,467 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/_async_py27.py | from __future__ import absolute_import, print_function, unicode_literals
from backports.shutil_get_terminal_size import get_terminal_size
from functools import partial
import io
import itertools as it
import subprocess as sp
import sys
import colorama as co
import trollius as asyncio
@asyncio.coroutine
def _read_str... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,468 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/exe_api.py | # coding: utf-8
'''
.. versionadded:: 0.21
This module contains functions that require a `conda` executable to be
available on the system path.
'''
from __future__ import absolute_import, print_function, unicode_literals
import itertools as it
import io
import logging
import platform
import re
import sys
import subpro... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,469 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/py_api.py | # coding: utf-8
'''
.. versionadded:: 0.21
'''
from __future__ import absolute_import, print_function, unicode_literals
import json
import logging
import re
import sys
import path_helpers as ph
import six
logger = logging.getLogger(__name__)
class PackageNotFound(Exception):
def __init__(self, missing, availab... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,470 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/_async_py35.py | from __future__ import absolute_import, print_function, unicode_literals
from functools import partial
from shutil import get_terminal_size
import asyncio
import io
import itertools as it
import subprocess as sp
import sys
import colorama as co
async def _read_stream(stream, callback=None, buffer_size=None):
whi... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,471 | mkdryden/conda-helpers | refs/heads/master | /conda_helpers/asyncio_util.py | # coding: utf-8
'''
.. versionadded:: 0.21
'''
from __future__ import absolute_import, print_function, unicode_literals
from functools import wraps
import logging
import platform
import sys
import threading
if sys.version_info <= (3, 4):
import trollius as asyncio
from ._async_py27 import run_command
else:
... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,472 | mkdryden/conda-helpers | refs/heads/master | /setup.py | import sys
import setuptools as st
sys.path.insert(0, '.')
import versioneer
st.setup(name='conda-helpers',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='Add description here.',
keywords='',
author='Christian Fobel',
author_e... | {"/conda_helpers/__init__.py": ["/conda_helpers/exe_api.py", "/conda_helpers/py_api.py"], "/conda_helpers/__main__.py": ["/conda_helpers/__init__.py", "/conda_helpers/exe_api.py"], "/conda_helpers/exe_api.py": ["/conda_helpers/asyncio_util.py", "/conda_helpers/py_api.py", "/conda_helpers/recipes.py"], "/conda_helpers/a... |
14,477 | rahulkris1/SSW810 | refs/heads/master | /HW09_ReSub_Rahul_Kampati.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 26 November 2019, 08:00
@author: Kampati Rahul
Creation of a data repository for students and instructors to keep track of data
"""
import os
from collections import defaultdict
from prettytable import PrettyTable
class Student:
def __init__(self, cw... | {"/HW09_ReSub_Test_Rahul_Kampati.py": ["/HW09_ReSub_Rahul_Kampati.py"]} |
14,478 | rahulkris1/SSW810 | refs/heads/master | /HW09_ReSub_Test_Rahul_Kampati.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 26 November 2019, 09:30:00
@author: Kampati Rahul
Testing the Creation of data repository of courses, students, faculty members.
"""
import unittest
from HW09_ReSub_Rahul_Kampati import Repository
fp = "C:/Users/HP/Desktop/redo/file_09/test"
clas... | {"/HW09_ReSub_Test_Rahul_Kampati.py": ["/HW09_ReSub_Rahul_Kampati.py"]} |
14,490 | MRSharff/adventofcode | refs/heads/master | /2018/day8.py | class Node:
def __init__(self, license_iter) -> None:
super().__init__()
self.child_count = next(license_iter)
self.metadata_count = next(license_iter)
self.child_nodes = [Node(license_iter) for _ in range(self.child_count)]
self.metadata = [next(license_iter) for _ in range... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,491 | MRSharff/adventofcode | refs/heads/master | /2018/day1.py | from itertools import cycle
resulting_frequency = sum
def calibration_frequency(frequencies):
seen = set()
running_sum = 0
for frequency in frequencies:
running_sum += frequency
if running_sum in seen:
return running_sum
seen.add(running_sum)
def part1(day1input):
... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,492 | MRSharff/adventofcode | refs/heads/master | /2018/day4.py | import datetime
from collections import defaultdict
def parse_date(log_line):
date_string = log_line[log_line.index('[') + 1:log_line.index(']')]
return datetime.datetime.strptime(date_string, '%Y-%m-%d %H:%M')
def get_guard_number(log_line):
guard_fh = log_line[log_line.index('#') + 1:]
return int... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,493 | MRSharff/adventofcode | refs/heads/master | /2018/day3.py | import re
from collections import defaultdict
def claim_coordinates(claim):
for x in range(int(claim['left_edge']), int(claim['left_edge']) + int(claim['width'])):
for y in range(int(claim['top_edge']), int(claim['top_edge']) + int(claim['height'])):
yield x, y
def get_claimed_fabric(claims... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,494 | MRSharff/adventofcode | refs/heads/master | /advent_of_code.py | import os
import requests
try:
session = os.environ['advent_session_cookie']
except KeyError:
session = None
class AdventOfCodeException(Exception):
pass
def get_cached_input(input_file_path):
with open(input_file_path) as advent_input_file:
advent_input = advent_input_file.read()
... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,495 | MRSharff/adventofcode | refs/heads/master | /2018/day7.py | import re
from collections import defaultdict
seconds_per_step = 60
worker_count = 5
def get_available_steps(steps):
counts = defaultdict(int)
for step, dependencies in steps.items():
for dependency in dependencies:
counts[dependency] += 1
return [dependency for dependency in steps ... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,496 | MRSharff/adventofcode | refs/heads/master | /2018/day5.py | import string
def annihilates(unit1, unit2):
return abs(ord(unit1) - ord(unit2)) == 32
def react(polymer):
catalyzed_polymer = []
for unit in polymer:
if catalyzed_polymer and annihilates(catalyzed_polymer[-1], unit):
catalyzed_polymer.pop()
else:
catalyzed_polymer... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,497 | MRSharff/adventofcode | refs/heads/master | /2018/day2.py | from collections import defaultdict
from itertools import combinations
def get_letter_counts(box_id):
counts = defaultdict(int)
for char in box_id:
counts[char] += 1
return counts
def checksum(box_ids):
two_count = 0
three_count = 0
for box_id in box_ids:
letter_counts = get_... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,498 | MRSharff/adventofcode | refs/heads/master | /2018/day6.py | from collections import defaultdict
def manhattan_distance(a, b):
return abs(a[0] - b[0]) + abs(a[1] - b[1])
def get_closest(coordinate, coordinates):
distances = defaultdict(list)
for other_coordinate in coordinates:
distances[manhattan_distance(coordinate, other_coordinate)].append(other_coord... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,499 | MRSharff/adventofcode | refs/heads/master | /2018/day9.py | """ --- Day 9: Marble Mania --- """
import re
from collections import deque, defaultdict
def marble_game(player_count, marble_count):
score = defaultdict(int)
circle = deque([0])
# current marble is always at the head of the deque
for marble in range(1, marble_count + 1):
if marble % 23 == 0... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,500 | MRSharff/adventofcode | refs/heads/master | /2018/day11.py | from functools import lru_cache
def hundreds_digit_or_zero(power_level):
return int(power_level / 100) % 10
@lru_cache(maxsize=pow(2, 17))
def cell_power_level(x, y, grid_serial_number):
# rack_id = x + 10
# power_level = rack_id * y
# power_level = power_level + grid_serial_number
# power_level... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,501 | MRSharff/adventofcode | refs/heads/master | /2018/runner.py | import advent_of_code
import importlib
import glob
days = {day[:-3]: importlib.import_module(day[:-3]) for day in glob.glob('day*.py')}
def print_solutions_for_day(day):
print('Day {}:'.format(day))
dayinput = advent_of_code.get_day_input(day)
solver = days['day{}'.format(day)]
for part in range(1, ... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,502 | MRSharff/adventofcode | refs/heads/master | /2018/day10.py | """ --- Day 10: The Stars Align --- """
import re
point_regex = re.compile('position=<(?P<position>.+)> velocity=<(?P<velocity>.+)>')
def get_yrange_at_time(points, t):
y_values = [point[1] + t * velocity[1] for point, velocity in points.items()]
return max(y_values) - min(y_values)
def get_smallest_y_ra... | {"/2018/runner.py": ["/advent_of_code.py"]} |
14,503 | Cydt/Pareidolia | refs/heads/master | /pareidolia/types.py | from collections import namedtuple
Size = namedtuple('Size', 'width height')
Dimensions = namedtuple('Dimensions', 'rows columns')
| {"/pareidolia/combiner.py": ["/pareidolia/types.py"], "/pareidolia/__init__.py": ["/pareidolia/combiner.py"]} |
14,504 | Cydt/Pareidolia | refs/heads/master | /pareidolia/combiner.py | import random
import math
from PIL import Image, ImageFilter
from PIL.ImageOps import autocontrast
from .types import Size, Dimensions
# PIL wrappers
def image(filename):
return Image.open(filename)
def make_grayscale(image):
return image.convert("L")
def combine(filenames, size=None, number=None, dimen... | {"/pareidolia/combiner.py": ["/pareidolia/types.py"], "/pareidolia/__init__.py": ["/pareidolia/combiner.py"]} |
14,505 | Cydt/Pareidolia | refs/heads/master | /pareidolia/__init__.py | from .combiner import combine
| {"/pareidolia/combiner.py": ["/pareidolia/types.py"], "/pareidolia/__init__.py": ["/pareidolia/combiner.py"]} |
14,507 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/processing/gazetteer/stringgazetteer.py | """
This module provides Gazetteer classes which allow matching the text or the tokens of documents against
gazetteer lists, lists of interesting texts or token sequences and annotate the matches with features from the
gazetteer lists.
"""
from recordclass import structclass
from gatenlp.utils import init_logger
from ... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,508 | davidwilby/python-gatenlp | refs/heads/main | /setup.py | #!/usr/bin/env python
# encoding: utf-8
"""Packaging script for the gatenlp library."""
import sys
import os
from setuptools import setup, find_packages
import re
if sys.version_info < (3, 6):
sys.exit("ERROR: gatenlp requires Python 3.6+")
JARFILE = "gatetools-gatenlpworker-1.0.jar"
JARFILE_DEST = os.path.join(... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,509 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/version.py | __version__ = "1.0.6-dev0"
| {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,510 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/annotation_set.py | """
Module for AnnotationSet class which represents a named collection of
annotations which can arbitrarily overlap.
"""
# TODO: when should two sets be equal? Currently object identity is requried!
from typing import Any, List, Union, Dict, Set, KeysView, Iterator, Generator
# TODO: prior to Python 3.9 we need diffe... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,511 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/document.py | """
Module that implements the Document class for representing gatenlp documents with
features and annotation sets.
"""
from typing import KeysView, Callable, Union, List
import logging
import importlib
import copy as lib_copy
from gatenlp.annotation_set import AnnotationSet
from gatenlp.annotation import Annotation
f... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,512 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/processing/gazetteer/base.py | """
Base class for all gazetteer annotators
"""
from gatenlp.processing.annotator import Annotator
class GazetteerAnnotator(Annotator):
def __call__(self, *args, **kwargs):
raise RuntimeError("Not implemented in Gazetteer base class") | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,513 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/processing/gazetteer/__init__.py | """
Module for various gazetteer annotator implementations.
"""
from gatenlp.processing.annotator import Annotator
from gatenlp.processing.gazetteer.tokengazetteer import TokenGazetteer
from gatenlp.processing.gazetteer.stringgazetteer import StringGazetteer | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,514 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/urlfileutils.py | """
Module for functions that help reading binary and textual data from either URLs or local files.
"""
from io import TextIOWrapper
from pathlib import Path
from urllib.parse import ParseResult
from urllib.request import urlopen
import requests
def is_url(ext):
"""
Returns a tuple (True, urlstring) if ext ... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,515 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/corpora/files.py | """
Module that defines Corpus and DocumentSource/DocumentDestination classes which access documents
as lines or parts in a file.
"""
import json
from gatenlp.urlfileutils import yield_lines_from
from gatenlp.document import Document
from gatenlp.corpora.base import DocumentSource, DocumentDestination
from gatenlp.cor... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,516 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/processing/__init__.py | """
Package for annotators, and other things related to processing documents.
"""
from gatenlp.processing.gazetteer.tokengazetteer import TokenGazetteer | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,517 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/processing/matcher.py | """
Module that defines classes for matchers other than gazetteers which match e.g. regular expressions
of strings or annotations.
"""
class StringRegexMatcher:
"""
NOT YET IMPLEMENTED
"""
pass
# class AnnotationRegexMatcher:
# """ """
# pass
| {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,518 | davidwilby/python-gatenlp | refs/heads/main | /tests/test_gateworker.py | """
Module to test the GateWorker and GateWorkerAnnotator
"""
import os
from gatenlp import Document
from gatenlp.utils import init_logger
from gatenlp.gateworker import GateWorker
logger = init_logger("test_gateworker")
should_exit = not os.environ.get("GATE_HOME")
if should_exit:
logger.warning("Environment va... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,519 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/processing/normalizer.py | """
Module that provides classes for normalizers. Normalizers are annotators which change the text of selected
annotations or the entire text of the document.
Since the text of a document is immutable, such Normalizers return a new document with the modified text.
Since the text is modified any annotations present in ... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,520 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/__init__.py | # NOTE: do not place a comment at the end of the version assignment
# line since we parse that line in a shell script!
# __version__ = "0.9.9"
from gatenlp.version import __version__
try:
import sortedcontainers
except Exception:
import sys
print(
"ERROR: required package sortedcontainers cannot be... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,521 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/serialization/default.py | """
Module that implements the various ways of how to save and load documents and change logs.
"""
import io
import os
import sys
import yaml
from collections import defaultdict
# import ruyaml as yaml
try:
from yaml import CFullLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import FullLoader... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,522 | davidwilby/python-gatenlp | refs/heads/main | /gatenlp/processing/client.py | """
Module that provides various Annotators which act as clients to REST annotation services.
"""
import logging
import json
from gatenlp.processing.annotator import Annotator
import requests
from requests.auth import HTTPBasicAuth
from gatenlp.utils import init_logger
import time
from gatenlp.offsetmapper import Offs... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,523 | davidwilby/python-gatenlp | refs/heads/main | /html-ann-viewer/create-debug-html.py | from nltk import word_tokenize
from gatenlp import Document
txt = "This is a document "
# 0123456789012345678901
# 0000000000111111111122
doc = Document("This is a document ")
annset = doc.annset()
annset.add(0,4,"Token")
annset.add(4,5,"SpaceToken")
annset.add(5,7,"Token")
annset.add(7,8,"SpaceToken")
a... | {"/gatenlp/processing/gazetteer/stringgazetteer.py": ["/gatenlp/processing/gazetteer/base.py"], "/gatenlp/document.py": ["/gatenlp/annotation_set.py", "/gatenlp/serialization/default.py"], "/gatenlp/processing/gazetteer/__init__.py": ["/gatenlp/processing/gazetteer/stringgazetteer.py"], "/gatenlp/corpora/files.py": ["/... |
14,524 | tommywenjiezhang/flask_auth_starter | refs/heads/master | /flaskr/__init__.py | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
from flask_login import LoginManager
def create_app():
app = Flask(__name__,instance_relative_config=False)
login_manager = LoginManager()
login_manager.login_view = "auth.auth_bp"
login_manager.init_app(app)
... | {"/flaskr/auth/auth.py": ["/flaskr/__init__.py"]} |
14,525 | tommywenjiezhang/flask_auth_starter | refs/heads/master | /flaskr/auth/auth.py | from flask import Blueprint, render_template, url_for, request, redirect, flash
import os
from flask import current_app as app
from ..model import User
from .. import db
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import login_user
auth_bp = Blueprint('auth_bp', __name__,... | {"/flaskr/auth/auth.py": ["/flaskr/__init__.py"]} |
14,526 | tommywenjiezhang/flask_auth_starter | refs/heads/master | /flaskr/home/home.py | from flask import Blueprint , render_template
home_bp = Blueprint('home_bp',__name__,template_folder='templates')
@home_bp.route('/',methods=['GET'])
def index():
return render_template("body.html")
@home_bp.route('/profile')
def profile():
return 'Profile' | {"/flaskr/auth/auth.py": ["/flaskr/__init__.py"]} |
14,532 | izaansohail/Django_Testing | refs/heads/main | /home/models.py | from django.db import models
# Create your models here.
class Contact(models.Model):
name = models.CharField(max_length=200,default=None,null=True)
cnic = models.CharField(max_length=200,default=None,null=True)
address = models.CharField(max_length=200,default=None,null=True)
organization = models.Char... | {"/home/admin.py": ["/home/models.py"], "/home/views.py": ["/home/models.py"]} |
14,533 | izaansohail/Django_Testing | refs/heads/main | /home/migrations/0003_contact_cnic.py | # Generated by Django 3.2.5 on 2021-07-09 04:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_auto_20210708_1316'),
]
operations = [
migrations.AddField(
model_name='contact',
name='cnic',
... | {"/home/admin.py": ["/home/models.py"], "/home/views.py": ["/home/models.py"]} |
14,534 | izaansohail/Django_Testing | refs/heads/main | /home/migrations/0002_auto_20210708_1316.py | # Generated by Django 3.2.5 on 2021-07-08 08:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='contact',
name='date',
),
... | {"/home/admin.py": ["/home/models.py"], "/home/views.py": ["/home/models.py"]} |
14,535 | izaansohail/Django_Testing | refs/heads/main | /home/admin.py | from django.contrib import admin
from home.models import Contact
# Register your models here.
admin.site.register(Contact)
class ContactView(admin.ModelAdmin):
list_display = ['Name','cnic','address',
'organization','contact_number','checkin','checkout',
'contact_person','purpose','img_location'] | {"/home/admin.py": ["/home/models.py"], "/home/views.py": ["/home/models.py"]} |
14,536 | izaansohail/Django_Testing | refs/heads/main | /home/views.py | from django.shortcuts import render
from django.http import HttpResponse
from home.models import Contact
from django.contrib import messages
# Create your views here.
def index(request):
return render(request, 'homescreen.html')
# return HttpResponse("this is homepage")
def about(request):
return render(... | {"/home/admin.py": ["/home/models.py"], "/home/views.py": ["/home/models.py"]} |
14,537 | fyabc/DBLab02 | refs/heads/master | /DBLab02.py | from flask import Flask
from flask_bootstrap import Bootstrap
# Main Application
from views import app
if __name__ == '__main__':
app.run(debug=False)
| {"/DBLab02.py": ["/views.py"], "/forms.py": ["/config.py"], "/dbOperations.py": ["/createApp.py", "/config.py"], "/views.py": ["/createApp.py", "/config.py", "/forms.py", "/dbOperations.py"]} |
14,538 | fyabc/DBLab02 | refs/heads/master | /forms.py | # -*- coding: utf-8 -*-
__author__ = 'fyabc'
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField, SelectField, PasswordField, IntegerField
from wtforms.validators import DataRequired, NumberRange, Length
# Local modules.
from config import TableNames
class SignInForm(Form):
userID = Str... | {"/DBLab02.py": ["/views.py"], "/forms.py": ["/config.py"], "/dbOperations.py": ["/createApp.py", "/config.py"], "/views.py": ["/createApp.py", "/config.py", "/forms.py", "/dbOperations.py"]} |
14,539 | fyabc/DBLab02 | refs/heads/master | /dbOperations.py | # -*- coding: utf-8 -*-
__author__ = 'fyabc'
# These 2 statements are important.
import pymysql
pymysql.install_as_MySQLdb()
from flask import request, session
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.exc import IntegrityError, InvalidRequestError
# Local modules.
from createApp import app
impor... | {"/DBLab02.py": ["/views.py"], "/forms.py": ["/config.py"], "/dbOperations.py": ["/createApp.py", "/config.py"], "/views.py": ["/createApp.py", "/config.py", "/forms.py", "/dbOperations.py"]} |
14,540 | fyabc/DBLab02 | refs/heads/master | /createApp.py | # -*- coding: utf-8 -*-
__author__ = 'fyabc'
import os
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask.ext.login import LoginManager
app = Flask(__name__)
app.config.from_object('config')
Bootstrap(app)
lm = LoginManager()
lm.init_app(app)
| {"/DBLab02.py": ["/views.py"], "/forms.py": ["/config.py"], "/dbOperations.py": ["/createApp.py", "/config.py"], "/views.py": ["/createApp.py", "/config.py", "/forms.py", "/dbOperations.py"]} |
14,541 | fyabc/DBLab02 | refs/heads/master | /views.py | # -*- coding: utf-8 -*-
__author__ = 'fyabc'
from flask import render_template, request, redirect, url_for
from flask.ext.login import login_user, logout_user, login_required
# Local modules.
from createApp import app, lm
import config
from forms import QueryForm, LoginForm, ReserveForm, UnsubscribeForm, \
Inser... | {"/DBLab02.py": ["/views.py"], "/forms.py": ["/config.py"], "/dbOperations.py": ["/createApp.py", "/config.py"], "/views.py": ["/createApp.py", "/config.py", "/forms.py", "/dbOperations.py"]} |
14,542 | fyabc/DBLab02 | refs/heads/master | /config.py | # -*- coding: utf-8 -*-
__author__ = 'fyabc'
import os
basedir = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY = 'hard-string'
SQLALCHEMY_DATABASE_URI = 'mysql://root:fy95102@localhost/DBLab02'
SQLALCHEMY_TRACK_MODIFICATIONS = True
TableNames = [
('Flights', '航班'),
('Hotels', '宾... | {"/DBLab02.py": ["/views.py"], "/forms.py": ["/config.py"], "/dbOperations.py": ["/createApp.py", "/config.py"], "/views.py": ["/createApp.py", "/config.py", "/forms.py", "/dbOperations.py"]} |
14,566 | Pingze-github/pyRequest | refs/heads/master | /lib/sqlite.py | import sqlite3
class ReqLogDB:
def __init__(self):
(self.conn, self.cursor) = self.createConn()
def createConn(self):
conn = sqlite3.connect('reqlog.db')
print('sqlite 数据库连接成功')
cursor = conn.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS LOG
(ID I... | {"/index.py": ["/lib/sqlite.py"]} |
14,567 | Pingze-github/pyRequest | refs/heads/master | /index.py |
import os
import sys
import time
import re
import json
from urllib.parse import urlparse
from collections import OrderedDict
import requests
from PyQt5.QtWidgets import QApplication,QWidget,QVBoxLayout,QHBoxLayout,QTabWidget,QPushButton,QTextEdit,QPlainTextEdit,QLineEdit,QLabel,QComboBox,QListWidget,QListWidgetItem
fr... | {"/index.py": ["/lib/sqlite.py"]} |
14,585 | sumanthm-git/mongo_pipe | refs/heads/master | /csv_json.py | import pandas as pd
import numpy as np
from pandas.io import json
#reading the sample CSV
df = pd.read_csv('sales.csv', dtype=object)
#making the _id field for json to use as unique field in MongoDB
df.index = np.arange(1, len(df)+1)
df['_id'] = df.index
copy_index = df.pop('_id')
df.insert(0,'_id',copy_index)
#conv... | {"/json_into_mongo.py": ["/csv_json.py"]} |
14,586 | sumanthm-git/mongo_pipe | refs/heads/master | /json_into_mongo.py | import csv_json as cj
import pymongo
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["mydatabase"]
mycol = mydb["sales"]
mycol.insert_many(cj.parsed)
#print(cj.parsed)
| {"/json_into_mongo.py": ["/csv_json.py"]} |
14,587 | steven1227/Drello | refs/heads/master | /config.py | import os
basedir = os.path.abspath(os.path.dirname(__file__))
WTF_CSRF_ENABLED = True
DATABASE = '/tmp/drello.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = 'default'
MONGODB_SETTINGS = {'DB': "Drello"}
| {"/app/__init__.py": ["/app/models.py"], "/app/models.py": ["/app/__init__.py"]} |
14,588 | steven1227/Drello | refs/heads/master | /app/__init__.py | from flask import Flask
from flask.ext.mongoengine import MongoEngine
app = Flask(__name__)
app.config.from_object('config')
db = MongoEngine(app)
from app.views import *
from app.models import *
| {"/app/__init__.py": ["/app/models.py"], "/app/models.py": ["/app/__init__.py"]} |
14,589 | steven1227/Drello | refs/heads/master | /drello.py | # all the imports
import sqlite3
from contextlib import closing
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash, jsonify
# configuration
DATABASE = '/tmp/flaskr.db'
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = 'admin'
PASSWORD = 'default'
# create our li... | {"/app/__init__.py": ["/app/models.py"], "/app/models.py": ["/app/__init__.py"]} |
14,590 | steven1227/Drello | refs/heads/master | /app/models.py | from app import db
from flask import url_for
import datetime
class Comment(db.EmbeddedDocument):
created_at = db.DateTimeField(default=datetime.datetime.now, required=True)
body = db.StringField(verbose_name="Comment", required=True)
author = db.StringField(verbose_name="Name", max_length=255, required=Tr... | {"/app/__init__.py": ["/app/models.py"], "/app/models.py": ["/app/__init__.py"]} |
14,603 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/copy_.py | import logging
import os
import sys
from argparse import ArgumentParser, Namespace
from typing import cast
import tilecloud_chain.configuration
from tilecloud_chain import Count, DropEmpty, HashDropper, TileGeneration, add_common_options
from tilecloud_chain.format import duration_format, size_format
logger = logging... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,604 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/database_logger.py | import logging
import sys
import time
import psycopg2.sql
from prometheus_client import Summary
import tilecloud_chain.configuration
from tilecloud import Tile
_LOGGER = logging.getLogger(__name__)
_INSERT_SUMMARY = Summary("tilecloud_chain_database_logger", "Number of database inserts", ["layer"])
class Database... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,605 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/controller.py | import logging
import math
import os
import pkgutil
import sys
from argparse import ArgumentParser
from copy import copy
from hashlib import sha1
from io import BytesIO, StringIO
from math import exp, log
from typing import IO, List, Literal, Optional, Union, cast
from urllib.parse import urlencode, urljoin
import bot... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,606 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/multitilestore.py | import logging
from itertools import chain, groupby, starmap
from typing import Callable, Dict, Iterable, Iterator, Optional, Tuple
from tilecloud import Tile, TileStore
logger = logging.getLogger(__name__)
class MultiTileStore(TileStore):
"""Redirect to the corresponding Tilestore for the layer and config file... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,607 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/views/admin.py | # Copyright (c) 2018-2023 by Camptocamp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and ... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,608 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/tests/test_ui.py | import os
import subprocess
import pytest
import skimage.io
from c2cwsgiutils.acceptance.image import check_image
REGENERATE = False
def test_should_not_commit():
assert REGENERATE is False
@pytest.mark.parametrize(
"url,expected_file_name,height,width",
[
pytest.param("http://application:8080... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,609 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/tests/__init__.py | import logging
import os
import re
import shutil
import sys
import traceback
from io import StringIO
from logging import config
from typing import Any, Callable, List, Tuple, Union
from unittest import TestCase
import yaml
DIFF = 200
log = logging.getLogger("tests")
config.dictConfig(
{
"version": 1,
... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,610 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/server.py | # Copyright (c) 2013-2023 by Stéphane Brunner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of condition... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,611 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/expiretiles.py | import logging
import sys
from argparse import ArgumentParser
import psycopg2.sql
from shapely.geometry import MultiPolygon, Polygon
from shapely.ops import unary_union
from tilecloud.grid.quad import QuadTileGrid
from tilecloud_chain import parse_tilecoord
logger = logging.getLogger(__name__)
def main() -> None:
... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,612 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/tests/test_controller.py | import os
import shutil
from tilecloud_chain import TileGeneration, controller
from tilecloud_chain.tests import CompareCase
class TestController(CompareCase):
def setUp(self) -> None: # noqa
self.maxDiff = None
@classmethod
def setUpClass(cls): # noqa
os.chdir(os.path.dirname(__file__... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,613 | camptocamp/tilecloud-chain | refs/heads/master | /gunicorn.conf.py | ###
# app configuration
# https://docs.gunicorn.org/en/stable/settings.html
###
import os
import gunicorn.arbiter
import gunicorn.workers.base
from c2cwsgiutils import get_config_defaults, prometheus
from prometheus_client import multiprocess
bind = ":8080"
worker_class = "gthread"
workers = os.environ.get("GUNICOR... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,614 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/tests/test_config.py | import os
from testfixtures import LogCapture
from tilecloud_chain import controller
from tilecloud_chain.tests import CompareCase
class TestConfig(CompareCase):
def setUp(self) -> None: # noqa
self.maxDiff = None
@classmethod
def setUpClass(cls): # noqa
os.chdir(os.path.dirname(__fil... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
14,615 | camptocamp/tilecloud-chain | refs/heads/master | /tilecloud_chain/format.py | from datetime import timedelta
from typing import Tuple
def default_int(number_array: Tuple[float, float, float, float]) -> Tuple[int, int, int, int]:
"""Convert an array of float in an array of int."""
return (int(number_array[0]), int(number_array[1]), int(number_array[2]), int(number_array[3]))
def size_... | {"/tilecloud_chain/copy_.py": ["/tilecloud_chain/__init__.py", "/tilecloud_chain/format.py"], "/tilecloud_chain/controller.py": ["/tilecloud_chain/__init__.py"], "/tilecloud_chain/views/admin.py": ["/tilecloud_chain/server.py", "/tilecloud_chain/__init__.py", "/tilecloud_chain/controller.py"], "/tilecloud_chain/server.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.