repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ic-labs/django-icekit | icekit/utils/csv_unicode.py | 1 | 1865 | # Unicode CSV reader/writer from https://docs.python.org/2.7/library/csv.html
import csv, codecs, cStringIO
class UTF8Recoder:
"""
Iterator that reads an encoded stream and reencodes the input to UTF-8
"""
def __init__(self, f, encoding):
self.reader = codecs.getreader(encoding)(f)
def __... | mit | fbb2737c3ed9b8c0b7c78982ca13f6b1 | 28.140625 | 77 | 0.605362 | 3.79065 | false | false | false | false |
ic-labs/django-icekit | glamkit_collections/contrib/work_creator/migrations/0001_initial.py | 2 | 9616 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import django_countries.fields
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('icekit_plugins_image', '0008_auto_20160920_2114'... | mit | ba0de57a57052e93fd56acf862fac7e8 | 70.761194 | 324 | 0.632072 | 4.011681 | false | false | false | false |
ic-labs/django-icekit | glamkit_collections/contrib/work_creator/migrations/0031_auto_20170606_1126.py | 1 | 6868 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import edtf.fields
class Migration(migrations.Migration):
dependencies = [
('gk_collections_work_creator', '0030_auto_20170523_1243'),
]
operations = [
migrations.RenameField(
... | mit | 537c6593a1beefd80312eb09b7f7a293 | 42.745223 | 506 | 0.598427 | 3.882419 | false | true | false | false |
ic-labs/django-icekit | icekit/plugins/location/migrations/0007_auto_20171005_1708.py | 1 | 3727 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_plugins_location', '0006_auto_20171005_1525'),
]
operations = [
migrations.RemoveField(
model_name='locat... | mit | 9f6beaa31887b3b1222b670bfddcd0ff | 53.808824 | 433 | 0.55004 | 4.18764 | false | false | false | false |
ic-labs/django-icekit | icekit/navigation/abstract_models.py | 1 | 2627 | from django.core.urlresolvers import reverse
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.utils.six import text_type, python_2_unicode_compatible
from fluent_contents.models import PlaceholderField, ContentItem
from ... | mit | 63672fe2b29bcaa0e0c92aa780ae2aee | 28.852273 | 107 | 0.668062 | 4.066563 | false | false | false | false |
ic-labs/django-icekit | glamkit_collections/contrib/work_creator/migrations/0023_auto_20170522_1508.py | 2 | 1551 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import edtf.fields
class Migration(migrations.Migration):
dependencies = [
('gk_collections_work_creator', '0022_auto_20170518_2034'),
]
operations = [
migrations.AlterField(
... | mit | 4fa3178714bfaeafa02dfc95096fa2a0 | 50.7 | 310 | 0.65764 | 3.328326 | false | false | false | false |
ic-labs/django-icekit | glamkit_collections/migrations/0003_auto_20170412_1742.py | 2 | 1085 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('glamkit_collections', '0002_auto_20170412_1520'),
]
operations = [
migrations.AlterModelOptions(
name='country',... | mit | a297309251323bad8a216780d8c4dd8d | 37.75 | 240 | 0.596313 | 3.604651 | false | false | false | false |
ic-labs/django-icekit | icekit/management/commands/add_missing_placeholders.py | 1 | 1139 | from django.apps import apps
from django.core.management.base import NoArgsCommand
from django.utils.encoding import force_text
from icekit.mixins import FluentFieldsMixin
class Command(NoArgsCommand):
help = ('Add missing placeholders from templates to database. See: '
'https://github.com/edoburu/dja... | mit | 60bd7011091e07226a51a475efc3882a | 41.185185 | 78 | 0.543459 | 4.574297 | false | false | false | false |
ic-labs/django-icekit | icekit/plugins/contact_person/migrations/0001_initial.py | 1 | 1456 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fluent_contents', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ContactPerson',
fi... | mit | 1ed06bedf61679109ea8d723d7ffe3ae | 36.333333 | 164 | 0.558379 | 4.412121 | false | false | false | false |
ic-labs/django-icekit | icekit/plugins/contact_person/migrations/0003_auto_20170605_1109.py | 1 | 1113 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_plugins_contact_person', '0002_auto_20161110_1531'),
]
operations = [
migrations.AddField(
model_name='co... | mit | f051d45500f5baad27f4ba8c3d1b82f4 | 34.903226 | 192 | 0.575921 | 4.248092 | false | false | false | false |
ic-labs/django-icekit | setup.py | 1 | 6563 | from __future__ import print_function
import datetime
import os
import setuptools
# Make `pip install -e .` much faster.
# See: https://bitbucket.org/pypa/setuptools/pull-requests/140/big-performance-fix-for-find_packages-by/diff#comment-18174057
def find_packages(*paths):
packages = []
for path in paths or ... | mit | aa2171ab6a58aae81597f0671f0b322a | 35.06044 | 153 | 0.552948 | 3.687079 | false | false | false | false |
ic-labs/django-icekit | icekit/page_types/search_page/migrations/0002_auto_20160420_0029.py | 1 | 1334 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('search_page', '0001_initial'),
]
operations = [
migrations.Add... | mit | cfd2e256f149af7b5ea03aa8373a9daf | 32.35 | 174 | 0.612444 | 4.331169 | false | false | false | false |
ic-labs/django-icekit | icekit/plugins/image/migrations/0001_initial.py | 1 | 1970 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('icekit', '0001_initial'),
('fluent_contents', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | mit | e9eb6fe339d6f35b35649339ca03d861 | 43.772727 | 164 | 0.572081 | 4.348786 | false | false | false | false |
ic-labs/django-icekit | docs/conf.py | 1 | 6181 | # -*- coding: utf-8 -*-
#
# GLAMkit documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 20 00:39:45 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | mit | 8b579f1d30791e5e4d42d0c0b376988c | 30.697436 | 80 | 0.676913 | 3.666074 | false | true | false | false |
ic-labs/django-icekit | icekit/models.py | 1 | 1571 | from icekit.publishing.models import PublishingModel, \
PublishableFluentContents, PublishableFluentContentsPage
from icekit.workflow.models import WorkflowStateMixin
from . import abstract_models, managers
class Layout(abstract_models.AbstractLayout):
"""
An implementation of ``fluent_pages.models.db.Pa... | mit | 33b4e9d61e2fe26bf83d68e249d93c78 | 23.546875 | 79 | 0.707829 | 4.327824 | false | false | false | false |
ic-labs/django-icekit | icekit_events/models.py | 1 | 35363 | """
Models for ``icekit_events`` app.
"""
# Compose concrete models from abstract models and mixins, to facilitate reuse.
from collections import OrderedDict
from datetime import timedelta
from colorful.fields import RGBColorField
from dateutil import rrule
import six
from django.core.exceptions import ValidationErro... | mit | 296307c600f7ad7472be6778694829b0 | 34.11718 | 219 | 0.617482 | 4.22699 | false | false | false | false |
ic-labs/django-icekit | icekit/plugins/iiif/utils.py | 1 | 11922 | import calendar
from django.core.urlresolvers import reverse
SUPPORTED_EXTENSIONS = ('jpg', 'tif', 'png', 'gif')
UNSUPPORTED_EXTENSIONS = ('jp2', 'pdf', 'webp')
SUPPORTED_QUALITY = ('default', 'color', 'gray',)
class IIIFImageApiException(Exception):
""" Base class for IIIF Image API Exceptions """
pass
... | mit | 51ac9ddb9912b8b8d88b3e47ed8e6501 | 34.58806 | 104 | 0.623218 | 4.126687 | false | false | false | false |
ic-labs/django-icekit | glamkit_collections/contrib/work_creator/migrations/0022_auto_20170518_2034.py | 2 | 3395 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import edtf.fields
class Migration(migrations.Migration):
dependencies = [
('gk_collections_work_creator', '0021_auto_20170518_2023'),
]
operations = [
migrations.AddField(
... | mit | cadadf7fa1a901d1d6b686d59002ea42 | 44.266667 | 269 | 0.614138 | 3.871152 | false | true | false | false |
ic-labs/django-icekit | icekit/tests/migrations/0009_auto_20170519_1232.py | 1 | 1153 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tests', '0008_auto_20161204_1456'),
]
operations = [
migrations.AddField(
model_name='articlelisting',
... | mit | b83322554bcb8c9470e3d0ab6a974f6c | 32.911765 | 117 | 0.611448 | 4.486381 | false | false | false | false |
frictionlessdata/tabulator-py | tabulator/parsers/sql.py | 3 | 1976 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from sqlalchemy import create_engine, sql
from ..parser import Parser
from .. import exceptions
# Module API
class SQLParser(Parser):
"""Pa... | mit | 890c6f074e288ac2a232bfc46bc73d5a | 25.346667 | 88 | 0.59666 | 4.108108 | false | false | false | false |
frictionlessdata/tabulator-py | tabulator/parsers/ods.py | 4 | 2862 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import datetime
import six
import ezodf
from six import BytesIO
from ..parser import Parser
from .. import exceptions
from .. import... | mit | 1d5ecc819376d5073b9b0ad05d22a7d1 | 26.519231 | 82 | 0.56499 | 4.221239 | false | false | false | false |
frictionlessdata/tabulator-py | tabulator/parsers/json.py | 3 | 2282 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import ijson
from ..parser import Parser
from .. import exceptions
from .. import helpers
# Module API
class JSONParser(Parser):
"""Parser ... | mit | 3871946e5b434acfd3a9bea8e316e33d | 26.829268 | 78 | 0.552585 | 4.338403 | false | false | false | false |
frictionlessdata/tabulator-py | tests/formats/test_datapackage.py | 3 | 2400 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import json
import pytest
from mock import Mock
from tabulator import Stream
from tabulator.parsers.datapackage import DataPackageParser... | mit | 04d1866b4a50b717d45cf2cb822a06ef | 25.333333 | 84 | 0.571308 | 3.590909 | false | true | false | false |
frictionlessdata/tabulator-py | tests/formats/test_csv.py | 3 | 6597 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import io
import pytest
from mock import Mock
from tabulator import Stream
from tabulator.parsers.csv import CSVParser
BASE_URL = 'https://raw.git... | mit | 1eaf5caa1b5d88f79e761d7cc6b16484 | 32.208122 | 113 | 0.603179 | 3.217905 | false | true | false | false |
zsiciarz/django-envelope | docs/conf.py | 1 | 7252 | # -*- coding: utf-8 -*-
#
# django-envelope documentation build configuration file, created by
# sphinx-quickstart on Wed Jun 1 18:45:24 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | mit | 69b27467dbcc130a5701499474f1c8c8 | 31.520179 | 106 | 0.709735 | 3.707566 | false | true | false | false |
zsiciarz/django-envelope | envelope/templatetags/envelope_tags.py | 1 | 1129 | # -*- coding: utf-8 -*-
"""
Template tags related to the contact form.
"""
from __future__ import unicode_literals
from django import template
register = template.Library()
try:
import honeypot
# Register antispam_fields as an inclusion tag
t = template.Template('{% load honeypot %}{% render_honeypot_f... | mit | 7b09d219cb6890b7b9ca089218ee1c7c | 29.513514 | 75 | 0.691763 | 4.003546 | false | false | false | false |
zsiciarz/django-envelope | setup.py | 1 | 1484 | import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='django-envelope',
version=__import__('envelope').__version__,
description='A contact form app for Django',
long_description=read('README.rst'),
... | mit | 6c218f0dfa3d266e747a92031f15fd30 | 34.333333 | 70 | 0.605121 | 4.032609 | false | false | false | false |
openforcefield/openff-toolkit | openff/toolkit/utils/callback.py | 1 | 6529 | """
Utility classes and functions to create objects supporting callback registration.
"""
__all__ = [
"callback_method",
"Callbackable",
]
import functools
import inspect
from openff.toolkit.utils.exceptions import CallbackRegistrationError
def callback_method(func=None, events=()):
"""Decorator used... | mit | 16588c080f367e65508e3e36ebbe8ee4 | 33.544974 | 89 | 0.623066 | 4.468857 | false | false | false | false |
pypa/pip | src/pip/_internal/operations/check.py | 9 | 5109 | """Validation of dependencies of packages
"""
import logging
from typing import Callable, Dict, List, NamedTuple, Optional, Set, Tuple
from pip._vendor.packaging.requirements import Requirement
from pip._vendor.packaging.utils import NormalizedName, canonicalize_name
from pip._internal.distributions import make_dist... | mit | 9763593ef113490cf5939ccf3d3a896d | 33.288591 | 88 | 0.678998 | 4.351789 | false | false | false | false |
pypa/pip | src/pip/_internal/resolution/resolvelib/resolver.py | 4 | 11533 | import functools
import logging
import os
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple, cast
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.resolvelib import BaseReporter, ResolutionImpossible
from pip._vendor.resolvelib import Resolver as RLResolver
from pip._vendor.r... | mit | c5672c7af3aa14840b03361589017e9b | 37.962838 | 83 | 0.628111 | 4.538764 | false | false | false | false |
pypa/pip | src/pip/_vendor/pyparsing/unicode.py | 12 | 10787 | # unicode.py
import sys
from itertools import filterfalse
from typing import List, Tuple, Union
class _lazyclassproperty:
def __init__(self, fn):
self.fn = fn
self.__doc__ = fn.__doc__
self.__name__ = fn.__name__
def __get__(self, obj, cls):
if cls is None:
cls = ... | mit | a02e7d91c08abccccaee8d149b2f064b | 29.207386 | 106 | 0.535126 | 3.231915 | false | false | false | false |
pypa/pip | src/pip/_vendor/rich/padding.py | 8 | 4970 | from typing import cast, List, Optional, Tuple, TYPE_CHECKING, Union
if TYPE_CHECKING:
from .console import (
Console,
ConsoleOptions,
RenderableType,
RenderResult,
)
from .jupyter import JupyterMixin
from .measure import Measurement
from .style import Style
from .segment import... | mit | 9b1a97b7c17beadf12573ad0e7fcbf53 | 34.248227 | 99 | 0.569416 | 3.938193 | false | false | false | false |
pypa/pip | src/pip/_vendor/urllib3/contrib/_securetransport/bindings.py | 20 | 17632 | """
This module uses ctypes to bind a whole bunch of functions and constants from
SecureTransport. The goal here is to provide the low-level API to
SecureTransport. These are essentially the C-level functions and constants, and
they're pretty gross to work with.
This code is a bastardised version of the code found in ... | mit | f4e9d4321a77c40d96ef2cb35d550212 | 32.973025 | 96 | 0.735311 | 3.567786 | false | false | false | false |
pypa/pip | src/pip/_vendor/rich/syntax.py | 4 | 34697 | import os.path
import platform
import re
import sys
import textwrap
from abc import ABC, abstractmethod
from typing import (
Any,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Set,
Tuple,
Type,
Union,
)
from pip._vendor.pygments.lexer import Lexer
from pip._vendor.py... | mit | 0769b74e9579cdcc2ff0735fab666df7 | 36.146681 | 163 | 0.573224 | 4.233679 | false | false | false | false |
pypa/pip | src/pip/_vendor/rich/_emoji_replace.py | 10 | 1064 | from typing import Callable, Match, Optional
import re
from ._emoji_codes import EMOJI
_ReStringMatch = Match[str] # regex match object
_ReSubCallable = Callable[[_ReStringMatch], str] # Callable invoked by re.sub
_EmojiSubMethod = Callable[[_ReSubCallable, str], str] # Sub method of a compiled re
def _emoji_re... | mit | 3c484f94dee91ecb0957a3e8c2926248 | 32.25 | 87 | 0.62688 | 3.454545 | false | false | false | false |
pypa/pip | src/pip/_internal/vcs/git.py | 8 | 18116 | import logging
import os.path
import pathlib
import re
import urllib.parse
import urllib.request
from typing import List, Optional, Tuple
from pip._internal.exceptions import BadCommand, InstallationError
from pip._internal.utils.misc import HiddenText, display_path, hide_url
from pip._internal.utils.subprocess import... | mit | 9c643858a9255f6ad4e40a0bc6ab4bde | 33.441065 | 87 | 0.550839 | 4.040143 | false | false | false | false |
pypa/pip | src/pip/_internal/utils/compat.py | 11 | 1884 | """Stuff that differs in different Python versions and platform
distributions."""
import logging
import os
import sys
__all__ = ["get_path_uid", "stdlib_pkgs", "WINDOWS"]
logger = logging.getLogger(__name__)
def has_tls() -> bool:
try:
import _ssl # noqa: F401 # ignore unused
return True
... | mit | 89b253848d72a5e62716d5810645e763 | 28.904762 | 87 | 0.659766 | 3.637066 | false | false | false | false |
pypa/pip | src/pip/_vendor/cachecontrol/_cmd.py | 8 | 1379 | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import logging
from pip._vendor import requests
from pip._vendor.cachecontrol.adapter import CacheControlAdapter
from pip._vendor.cachecontrol.cache import DictCache
from pip._vendor.cachecontrol.controller import logger
from argpars... | mit | f374311dbaa5c0770f1f0ec4f822eaa8 | 21.606557 | 70 | 0.683829 | 3.819945 | false | false | false | false |
pypa/pip | src/pip/_internal/commands/__init__.py | 4 | 3882 | """
Package containing all pip commands
"""
import importlib
from collections import namedtuple
from typing import Any, Dict, Optional
from pip._internal.cli.base_command import Command
CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary")
# This dictionary does a bunch of heavy lifting for he... | mit | 5db472b8a1958f03f042745e7e91c617 | 28.409091 | 75 | 0.628027 | 4.308546 | false | false | false | false |
pypa/pip | src/pip/_vendor/packaging/tags.py | 27 | 15699 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import logging
import platform
import sys
import sysconfig
from importlib.machinery import EXTENSION_SUFFIXES
from typing import (
Dict... | mit | e51540879372bb4bdb4865fe0042a8e0 | 31.23614 | 88 | 0.602968 | 3.813214 | false | false | false | false |
pypa/pip | src/pip/_vendor/pyparsing/__init__.py | 4 | 9171 | # module pyparsing.py
#
# Copyright (c) 2003-2022 Paul T. McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... | mit | 87c3798c0d686fe64f6a1806e6acdd6d | 26.706949 | 82 | 0.637008 | 3.803816 | false | false | false | false |
pypa/pip | src/pip/_internal/utils/subprocess.py | 4 | 9197 | import logging
import os
import shlex
import subprocess
from typing import (
TYPE_CHECKING,
Any,
Callable,
Iterable,
List,
Mapping,
Optional,
Union,
)
from pip._vendor.rich.markup import escape
from pip._internal.cli.spinners import SpinnerInterface, open_spinner
from pip._internal.exc... | mit | b8a7059aba2ef179e6dd50b69d88a351 | 34.373077 | 84 | 0.605958 | 4.251965 | false | false | false | false |
pypa/pip | src/pip/_vendor/rich/jupyter.py | 4 | 3252 | from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Sequence
if TYPE_CHECKING:
from pip._vendor.rich.console import ConsoleRenderable
from . import get_console
from .segment import Segment
from .terminal_theme import DEFAULT_TERMINAL_THEME
if TYPE_CHECKING:
from pip._vendor.rich.console import Conso... | mit | a4506ce1e7f2e8bd7b46afcda6ed9460 | 31.19802 | 146 | 0.611624 | 3.637584 | false | false | false | false |
pypa/pip | tests/functional/test_check.py | 4 | 10498 | from typing import Collection
from tests.lib import PipTestEnvironment, create_test_package_with_setup
def matches_expected_lines(string: str, expected_lines: Collection[str]) -> bool:
# Ignore empty lines
output_lines = list(filter(None, string.splitlines()))
# We'll match the last n lines, given n line... | mit | f7446bd04e4bfda4ebd5a9a255663c35 | 32.755627 | 88 | 0.64317 | 3.647672 | false | true | false | false |
pypa/pip | src/pip/_internal/resolution/resolvelib/provider.py | 4 | 9914 | import collections
import math
from typing import (
TYPE_CHECKING,
Dict,
Iterable,
Iterator,
Mapping,
Sequence,
TypeVar,
Union,
)
from pip._vendor.resolvelib.providers import AbstractProvider
from .base import Candidate, Constraint, Requirement
from .candidates import REQUIRES_PYTHON_I... | mit | 3a926883e09c6c17686b0993de674cae | 38.975806 | 88 | 0.656647 | 4.589815 | false | false | false | false |
pypa/pip | src/pip/_vendor/packaging/requirements.py | 11 | 4676 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
import re
import string
import urllib.parse
from typing import List, Optional as TOptional, Set
from pip._vendor.pyparsing import ( # noq... | mit | d1a28bb7b668629c71d9bcbf54a8a04f | 31.027397 | 87 | 0.648204 | 3.602465 | false | false | false | false |
pypa/pip | tests/lib/wheel.py | 4 | 11796 | """Helper for building wheels as would be in test cases.
"""
import csv
import itertools
from base64 import urlsafe_b64encode
from collections import namedtuple
from copy import deepcopy
from email.message import Message
from enum import Enum
from functools import partial
from hashlib import sha256
from io import Bytes... | mit | cdad723a5c9c8f64d44d9e41afcef908 | 28.939086 | 88 | 0.634622 | 3.805161 | false | false | false | false |
pypa/pip | src/pip/_vendor/six.py | 40 | 34549 | # Copyright (c) 2010-2020 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | mit | 6447e2655481c3b06bd00daa9842854b | 33.618236 | 118 | 0.624649 | 4.01266 | false | false | false | false |
pypa/pip | src/pip/_internal/utils/urls.py | 9 | 1759 | import os
import string
import urllib.parse
import urllib.request
from typing import Optional
from .compat import WINDOWS
def get_url_scheme(url: str) -> Optional[str]:
if ":" not in url:
return None
return url.split(":", 1)[0].lower()
def path_to_url(path: str) -> str:
"""
Convert a path t... | mit | 948c0229f2d9ac418b948e2082b89d2d | 27.370968 | 88 | 0.602047 | 3.649378 | false | false | false | false |
pypa/pip | src/pip/_vendor/urllib3/util/ssl_match_hostname.py | 13 | 5758 | """The match_hostname() function from Python 3.3.3, essential when using SSL."""
# Note: This file is under the PSF license as the code comes from the python
# stdlib. http://docs.python.org/3/license.html
import re
import sys
# ipaddress has been backported to 2.6+ in pypi. If it is installed on the
# system, us... | mit | c0f0a62cdf5f21bd9276c81cc5cd46ac | 35.213836 | 88 | 0.624175 | 4.069258 | false | false | false | false |
pypa/pip | src/pip/_internal/network/download.py | 4 | 6096 | """Download files with progress indicators.
"""
import email.message
import logging
import mimetypes
import os
from typing import Iterable, Optional, Tuple
from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
from pip._internal.cli.progress_bars import get_download_progress_renderer
from pip._internal... | mit | faa4167c7f0bc346ffeffdccaace5dad | 31.774194 | 87 | 0.632218 | 4.085791 | false | false | false | false |
pypa/pip | src/pip/_vendor/requests/utils.py | 4 | 33240 | """
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import codecs
import contextlib
import io
import os
import re
import socket
import struct
import sys
import tempfile
import warnings
import zipfile
from collections... | mit | c87566c7b79b213847ff6b5f452a7cc5 | 29.607735 | 128 | 0.602106 | 4.047735 | false | false | false | false |
pypa/pip | src/pip/_internal/operations/build/wheel_legacy.py | 8 | 3064 | import logging
import os.path
from typing import List, Optional
from pip._internal.cli.spinners import open_spinner
from pip._internal.utils.setuptools_build import make_setuptools_bdist_wheel_args
from pip._internal.utils.subprocess import call_subprocess, format_command_args
logger = logging.getLogger(__name__)
d... | mit | e462e6dca6d9d6049139c3e43e2071d4 | 29.039216 | 81 | 0.612924 | 3.898219 | false | false | false | false |
pypa/pip | src/pip/_vendor/rich/panel.py | 4 | 8744 | from typing import TYPE_CHECKING, Optional
from .align import AlignMethod
from .box import ROUNDED, Box
from .jupyter import JupyterMixin
from .measure import Measurement, measure_renderables
from .padding import Padding, PaddingDimensions
from .segment import Segment
from .style import StyleType
from .text import Tex... | mit | 22c055c5622d0a9cf3cdda34bda34469 | 33.836653 | 142 | 0.576395 | 4.138192 | false | false | false | false |
pypa/pip | src/pip/_vendor/pygments/regexopt.py | 8 | 3072 | """
pygments.regexopt
~~~~~~~~~~~~~~~~~
An algorithm that generates optimized regexes for matching long lists of
literal strings.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from re import escape
from os.path import ... | mit | 46308545f4c3b03c9e3300c1d5fc63c6 | 32.758242 | 82 | 0.570638 | 3.898477 | false | false | false | false |
pypa/pip | tools/protected_pip.py | 4 | 1127 | import os
import pathlib
import shutil
import subprocess
import sys
from glob import glob
from typing import Iterable, Union
VIRTUAL_ENV = os.environ["VIRTUAL_ENV"]
TOX_PIP_DIR = os.path.join(VIRTUAL_ENV, "pip")
def pip(args: Iterable[Union[str, pathlib.Path]]) -> None:
# First things first, get a recent (stable... | mit | 945a62db300f0344927c8f4b71d4970f | 28.657895 | 87 | 0.566992 | 3.394578 | false | false | false | false |
pypa/pip | src/pip/_internal/metadata/importlib/_dists.py | 4 | 8181 | import email.message
import importlib.metadata
import os
import pathlib
import zipfile
from typing import (
Collection,
Dict,
Iterable,
Iterator,
Mapping,
Optional,
Sequence,
cast,
)
from pip._vendor.packaging.requirements import Requirement
from pip._vendor.packaging.utils import Norma... | mit | 9edad7e061040cfa73dda9cb94386cc8 | 35.522321 | 87 | 0.643687 | 4.243257 | false | false | false | false |
pypa/pip | src/pip/_vendor/urllib3/connectionpool.py | 10 | 39093 | from __future__ import absolute_import
import errno
import logging
import re
import socket
import sys
import warnings
from socket import error as SocketError
from socket import timeout as SocketTimeout
from .connection import (
BaseSSLError,
BrokenPipeError,
DummyConnection,
HTTPConnection,
HTTPEx... | mit | 09375578b67a721c2af1c896475e34e9 | 34.218919 | 106 | 0.577367 | 4.560546 | false | false | false | false |
pypa/pip | src/pip/_internal/commands/index.py | 5 | 4762 | import logging
from optparse import Values
from typing import Any, Iterable, List, Optional, Union
from pip._vendor.packaging.version import LegacyVersion, Version
from pip._internal.cli import cmdoptions
from pip._internal.cli.req_command import IndexGroupCommand
from pip._internal.cli.status_codes import ERROR, SUC... | mit | 5aec95ea34eca8d09c1bd8d9fee6f90e | 33.507246 | 87 | 0.623058 | 4.45463 | false | false | false | false |
pypa/pip | src/pip/_vendor/distlib/index.py | 9 | 20834 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
try:
from threading import Thread
except ImportErr... | mit | c3d5318f10ed10523ab1c72bf1cf89db | 40.011811 | 99 | 0.544159 | 4.661893 | false | false | false | false |
pypa/pip | tests/functional/test_index.py | 4 | 3087 | import pytest
from pip._internal.cli.status_codes import ERROR, SUCCESS
from pip._internal.commands import create_command
from tests.lib import PipTestEnvironment
@pytest.mark.network
def test_list_all_versions_basic_search(script: PipTestEnvironment) -> None:
"""
End to end test of index versions command.
... | mit | cccd70d3b191e371b89f832b8a1f53ec | 40.16 | 87 | 0.536767 | 2.081591 | false | true | false | false |
pypa/pip | src/pip/_internal/utils/direct_url_helpers.py | 9 | 3206 | from typing import Optional
from pip._internal.models.direct_url import ArchiveInfo, DirectUrl, DirInfo, VcsInfo
from pip._internal.models.link import Link
from pip._internal.utils.urls import path_to_url
from pip._internal.vcs import vcs
def direct_url_as_pep440_direct_reference(direct_url: DirectUrl, name: str) ->... | mit | b640345b82bef55a47ba7ec96c118a8f | 35.850575 | 86 | 0.608858 | 3.982609 | false | false | false | false |
pypa/pip | src/pip/_vendor/urllib3/util/timeout.py | 57 | 10003 | from __future__ import absolute_import
import time
# The default socket timeout, used by httplib to indicate that no timeout was
# specified by the user
from socket import _GLOBAL_DEFAULT_TIMEOUT
from ..exceptions import TimeoutStateError
# A sentinel value to indicate that no timeout was specified by the user in
#... | mit | 5395f51eee27d68734fdd9a506eb2fa3 | 36.324627 | 84 | 0.629211 | 4.561332 | false | false | false | false |
pypa/pip | tests/unit/resolution_resolvelib/test_resolver.py | 4 | 9424 | from typing import Dict, List, Optional, Set, Tuple, cast
from unittest import mock
import pytest
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.resolvelib.resolvers import Result
from pip._vendor.resolvelib.structs import DirectedGraph
from pip._internal.index.package_finder import Packag... | mit | 29ae9112401da1e19b17a83df186ca9f | 30.518395 | 79 | 0.403756 | 3.983094 | false | false | false | false |
pypa/pip | src/pip/_vendor/msgpack/__init__.py | 4 | 1132 | # coding: utf-8
from .exceptions import *
from .ext import ExtType, Timestamp
import os
import sys
version = (1, 0, 4)
__version__ = "1.0.4"
if os.environ.get("MSGPACK_PUREPYTHON") or sys.version_info[0] == 2:
from .fallback import Packer, unpackb, Unpacker
else:
try:
from ._cmsgpack import Packer,... | mit | ab51917450bac7f0c47028b405df02f9 | 18.859649 | 68 | 0.643993 | 3.379104 | false | false | false | false |
pypa/pip | src/pip/_vendor/pygments/lexers/__init__.py | 4 | 11174 | """
pygments.lexers
~~~~~~~~~~~~~~~
Pygments lexers.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
import sys
import types
from fnmatch import fnmatch
from os.path import basename
from pip._vendor.pygments.lexers._mapping... | mit | 43765fcbb94782feb5df681b506814a4 | 32.355224 | 79 | 0.615894 | 3.940056 | false | false | false | false |
pypa/pip | src/pip/_vendor/rich/palette.py | 9 | 3396 | from math import sqrt
from functools import lru_cache
from typing import Sequence, Tuple, TYPE_CHECKING
from .color_triplet import ColorTriplet
if TYPE_CHECKING:
from pip._vendor.rich.table import Table
class Palette:
"""A palette of available colors."""
def __init__(self, colors: Sequence[Tuple[int, i... | mit | 2e1863b391c72b4186a25eaed6954161 | 32.94 | 82 | 0.539481 | 3.960327 | false | false | false | false |
pypa/pip | src/pip/_vendor/colorama/tests/initialise_test.py | 8 | 6741 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import sys
from unittest import TestCase, main, skipUnless
try:
from unittest.mock import patch, Mock
except ImportError:
from mock import patch, Mock
from ..ansitowin32 import StreamWrapper
from ..initialise import init, just_fix_wind... | mit | c5837e3a8ffb82d59b201a6ec983c5bd | 34.666667 | 87 | 0.584483 | 4.107861 | false | true | false | false |
pypa/pip | src/pip/_vendor/__init__.py | 4 | 4966 | """
pip._vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.
Files inside of pip._vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute_import
import glob
import os.path
import sys
# Downstream r... | mit | 020ff054abb2458e2aa30fb36211a366 | 40.383333 | 79 | 0.720499 | 3.675796 | false | false | false | false |
pypa/pip | src/pip/_vendor/rich/status.py | 10 | 4425 | from types import TracebackType
from typing import Optional, Type
from .console import Console, RenderableType
from .jupyter import JupyterMixin
from .live import Live
from .spinner import Spinner
from .style import StyleType
class Status(JupyterMixin):
"""Displays a status indicator with a 'spinner' animation.
... | mit | bb80d23672186fcc5876b986e890d5e1 | 32.522727 | 122 | 0.603842 | 4.026388 | false | false | false | false |
pypa/pip | src/pip/_vendor/pyparsing/exceptions.py | 12 | 9023 | # exceptions.py
import re
import sys
import typing
from .util import col, line, lineno, _collapse_string_to_ranges
from .unicode import pyparsing_unicode as ppu
class ExceptionWordUnicode(ppu.Latin1, ppu.LatinA, ppu.LatinB, ppu.Greek, ppu.Cyrillic):
pass
_extract_alphanums = _collapse_string_to_ranges(Excepti... | mit | 98c7447268150b35b66984086532c8de | 32.794007 | 106 | 0.580073 | 4.429553 | false | false | false | false |
knipknap/exscript | Exscript/protocols/ssh2.py | 2 | 17195 | #
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy,... | mit | 8f110767fd6a4c8c8fdbc48c2f0afa24 | 36.05819 | 90 | 0.581157 | 4.185735 | false | false | false | false |
knipknap/exscript | Exscript/util/mail.py | 1 | 14404 | #
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy,... | mit | 09dd35e3a3e10a741fab95113222e0f6 | 28.516393 | 92 | 0.577617 | 3.932296 | false | false | false | false |
knipknap/exscript | Exscript/protocols/drivers/enterasys.py | 3 | 1777 | #
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy,... | mit | a601147cf8f08902333f1e6efc315bb0 | 37.630435 | 72 | 0.703433 | 3.694387 | false | false | false | false |
knipknap/exscript | Exscript/util/decorator.py | 3 | 5898 | #
# Copyright (C) 2010-2017 Samuel Abels
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy,... | mit | 6883e1af09290385f6799f442af7e302 | 34.317365 | 77 | 0.65785 | 4.283224 | false | false | false | false |
knipknap/exscript | tests/Exscript/util/ttyTest.py | 3 | 2966 | from builtins import int
import sys
import unittest
import re
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', '..'))
import tempfile
from subprocess import Popen, PIPE
import Exscript.util.tty
class ttyTest(unittest.TestCase):
CORRELATE = Exscript.util.tty
def setUp(self):
... | mit | 9b0238e8755de141b403f805d819e0d0 | 34.73494 | 78 | 0.619353 | 3.882199 | false | true | false | false |
openatx/uiautomator2 | uiautomator2/webview.py | 1 | 6703 | # coding: utf-8
#
# Not implemented yet.
#
import contextlib
import json
import string
from pprint import pprint
import adbutils
import pychrome
import requests
from logzero import logger
class WebviewDriver():
def __init__(self, url):
self._url = url
self._browser = pychrome.Browser(self._url)... | mit | 3a64cc66528266400227dc3c2af84f7f | 29.058296 | 137 | 0.582127 | 3.666849 | false | false | false | false |
pwndbg/pwndbg | ida_script.py | 1 | 5480 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import datetime
import threading
import xmlrpc.client as xmlclient
from xml.sax.saxutils import escape
from xmlrpc.server import SimpleXMLRPCServer
import idaapi
import idc
# Wait for any processing to get done
idaapi.auto_wait()
# ... | mit | 4ae21f26605d2cc3ff9e8acf3edde45c | 28.304813 | 99 | 0.619708 | 3.455233 | false | false | false | false |
pwndbg/pwndbg | pwndbg/enhance.py | 1 | 4884 | """
Given an address in memory which does not contain a pointer elsewhere
into memory, attempt to describe the data as best as possible.
Currently prints out code, integers, or strings, in a best-effort manner
dependent on page permissions, the contents of the data, and any
supplemental information sources (e.g. activ... | mit | 589fd5b149335af53e4a2533f63df8ae | 30.10828 | 88 | 0.63964 | 3.424965 | false | false | false | false |
pwndbg/pwndbg | pwndbg/commands/aslr.py | 1 | 1051 | import argparse
import gdb
import pwndbg.commands
import pwndbg.gdblib.proc
import pwndbg.gdblib.vmmap
from pwndbg.color import message
options = {"on": "off", "off": "on"}
parser = argparse.ArgumentParser(
description="""
Check the current ASLR status, or turn it on/off.
Does not take effect until the program... | mit | 7517ba85d42c1f4074cdacf1f8a86608 | 22.355556 | 100 | 0.659372 | 3.357827 | false | false | false | false |
pwndbg/pwndbg | pwndbg/constants/powerpc64.py | 1 | 27898 | from .constant import Constant
__NR_exit = Constant("__NR_exit", 1)
__NR_fork = Constant("__NR_fork", 2)
__NR_read = Constant("__NR_read", 3)
__NR_write = Constant("__NR_write", 4)
__NR_open = Constant("__NR_open", 5)
__NR_close = Constant("__NR_close", 6)
__NR_waitpid = Constant("__NR_waitpid", 7)
__NR_creat = Consta... | mit | 9a71e4486adf8c77b46c274d85617f45 | 45.342193 | 74 | 0.685103 | 2.72335 | false | false | true | false |
pwndbg/pwndbg | pwndbg/commands/shell.py | 1 | 1615 | """
Wrapper for shell commands.
"""
import os
import pwndbg.commands
import pwndbg.lib.which
pwncmd_names = ["asm", "constgrep", "disasm", "pwn", "unhex"]
shellcmd_names = [
"awk",
"bash",
"cat",
"chattr",
"chmod",
"chown",
# "clear",
"cp",
"date",
"diff",
"egrep",
# "... | mit | 2720fc5cb23b528f5e15afe777e77192 | 16.747253 | 135 | 0.521362 | 3.064516 | false | false | false | false |
pwndbg/pwndbg | pwndbg/commands/ipython_interactive.py | 1 | 1488 | """
Command to start an interactive IPython prompt.
"""
import sys
from contextlib import contextmanager
import gdb
import pwndbg.color.message as M
import pwndbg.commands
import pwndbg.lib.stdio
@contextmanager
def switch_to_ipython_env():
"""We need to change stdout/stderr to the default ones, otherwise we ca... | mit | 0cd185585bc8205db63b9ad13c3c0d47 | 30 | 105 | 0.639785 | 3.78626 | false | false | false | false |
pwndbg/pwndbg | pwndbg/gdblib/info.py | 1 | 1157 | """
Runs a few useful commands which are available under "info".
"""
import re
from typing import Optional
import gdb
import pwndbg.lib.memoize
# TODO: Add symbol, threads, dll, program
@pwndbg.lib.memoize.reset_on_exit
def proc_mappings():
try:
return gdb.execute("info proc mappings", to_string=True)... | mit | 8131fbc1c21ad183a58fb0559cbf05ba | 18.948276 | 67 | 0.627485 | 3.383041 | false | false | false | false |
pwndbg/pwndbg | pwndbg/gdblib/elf.py | 1 | 12124 | """
This file declares types and methods useful for enumerating
all of the address spaces and permissions of an ELF file in memory.
This is necessary for when access to /proc is restricted, or when
working on a BSD system which simply does not have /proc.
"""
import ctypes
import importlib
import sys
from collections... | mit | 1b12d46bfab0ea0b157ef2b6051e9191 | 27.935561 | 100 | 0.609782 | 3.305344 | false | false | false | false |
pwndbg/pwndbg | pwndbg/constants/sparc.py | 1 | 28782 | from .constant import Constant
__NR_exit = Constant("__NR_exit", 1)
__NR_fork = Constant("__NR_fork", 2)
__NR_read = Constant("__NR_read", 3)
__NR_write = Constant("__NR_write", 4)
__NR_open = Constant("__NR_open", 5)
__NR_close = Constant("__NR_close", 6)
__NR_wait4 = Constant("__NR_wait4", 7)
__NR_creat = Constant("... | mit | 583fd36e27e5f71c9f007bd0f0fbe479 | 45.724026 | 74 | 0.688938 | 2.746636 | false | false | true | false |
pwndbg/pwndbg | tests/gdb-tests/tests/heap/test_vis_heap_chunks.py | 1 | 7521 | import gdb
import pwndbg
import tests
HEAP_VIS = tests.binaries.get("heap_vis.out")
def test_vis_heap_chunk_command(start_binary):
start_binary(HEAP_VIS)
gdb.execute("break break_here")
gdb.execute("continue")
# TODO/FIXME: Shall we have a standard method to do this kind of filtering?
# Note th... | mit | 4266fe05f18a4563313216f078499fed | 32.726457 | 100 | 0.637415 | 3.34713 | false | false | false | false |
tilezen/tilequeue | tilequeue/queue/message.py | 1 | 5406 | import threading
from collections import namedtuple
from tilequeue.tile import deserialize_coord
from tilequeue.tile import serialize_coord
class MessageHandle(object):
"""
represents a message read from a queue
This encapsulates both the payload and an opaque message handle
that's queue specific. ... | mit | 135af4ae79f1d04432a4456bde2a1670 | 29.542373 | 79 | 0.601184 | 4.263407 | false | false | false | false |
tilezen/tilequeue | tests/test_process.py | 1 | 21632 | import unittest
from ModestMaps.Core import Coordinate
from tilequeue.process import remove_wrong_zoomed_features
class TestProcess(unittest.TestCase):
def _make_json_tiles(
self, coord, post_process_data={}, db_features=[], cut_coords=[],
buffer_cfg={}):
from tilequeue.process ... | mit | 0be4c723759398308465b37ac464325b | 35.478921 | 119 | 0.536612 | 3.58383 | false | true | false | false |
fcurella/django-recommends | recommends/tests/recommendations.py | 4 | 5403 | from django.conf import settings
from django.contrib.auth.models import User
from recommends.providers import RecommendationProvider
from recommends.providers import recommendation_registry
try:
from recommends.storages.mongodb.storage import MongoStorage
except ImportError:
MongoStorage = None
try:
from re... | mit | c63a3ae7a7e8d74a0f3de391ad660a49 | 31.353293 | 124 | 0.654081 | 4.450577 | false | true | false | false |
tilezen/tilequeue | tilequeue/queue/mapper.py | 1 | 5200 | from collections import defaultdict
from collections import namedtuple
from tilequeue.tile import coord_marshall_int
# this is what gets returned by the group function
# each group represents what the payload to the queue should be
# the queue_id exists to allow dispatching to different underlying
# tile queue imple... | mit | 4aea93f45d3e4daf5d4e8b796a5dc78a | 39 | 79 | 0.607885 | 4.107425 | false | false | false | false |
tilezen/tilequeue | tilequeue/command.py | 1 | 103897 | #!/usr/bin/env python2
from __future__ import absolute_import
import argparse
import datetime
import logging.config
import multiprocessing
import operator
import os.path
import Queue
import signal
import sys
import threading
import time
import traceback
from collections import defaultdict
from collections import named... | mit | a67341dffe008f1dcbe3e3e689b2bb48 | 37.883608 | 135 | 0.616197 | 3.758121 | false | false | false | false |
tilezen/tilequeue | tilequeue/queue/redis_queue.py | 1 | 1754 | import time
from tilequeue.queue import MessageHandle
from tilequeue.utils import grouper
class RedisQueue(object):
"""
Redis backed queue implementation
No attempts are made to guarantee messages are not lost if not
acknowledged. If a worker reads messages from the queue and
crashes, they are l... | mit | 9feaf57f43af9782fc8920eb0aa4981c | 26.84127 | 73 | 0.619156 | 3.788337 | false | false | false | false |
tilezen/tilequeue | tilequeue/wof.py | 1 | 46836 | from __future__ import absolute_import
import csv
import json
import os.path
import Queue
import threading
from collections import namedtuple
from contextlib import closing
from cStringIO import StringIO
from datetime import datetime
from operator import attrgetter
import psycopg2
import requests
import shapely.geome... | mit | 3a7f155837ba8c3146419a55d26607e6 | 35.166795 | 79 | 0.583163 | 3.637748 | false | false | false | false |
fcurella/django-recommends | recommends/algorithms/pyrecsys.py | 4 | 1726 | from recsys.datamodel.data import Data
from recsys.algorithm.factorize import SVD
from .base import BaseAlgorithm
from recommends.converters import convert_vote_list_to_itemprefs
class RecSysAlgorithm(BaseAlgorithm):
def __init__(self, k=100, *args, **kwargs):
self.k = k
super(RecSysAlgorithm, sel... | mit | c229cfa8317cdc621a1c1bb1ae256a03 | 32.843137 | 98 | 0.585168 | 3.719828 | false | false | false | false |
fcurella/django-recommends | recommends/storages/base.py | 4 | 4326 | from recommends.converters import IdentifierManager
class BaseRecommendationStorage(object):
threshold_similarities = 0
threshold_recommendations = 0
can_lock = False
def __init__(self, settings=None):
self.identifier_manager = IdentifierManager()
self.settings = settings
def ge... | mit | df8e9bb984d89718b699087540b5cc6d | 28.22973 | 102 | 0.54184 | 4.828125 | false | false | false | false |
tilezen/tilequeue | tilequeue/utils.py | 1 | 5974 | import re
import sys
import traceback
from collections import defaultdict
from datetime import datetime
from itertools import islice
from time import time
import boto3
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session
from tilequeue.tile import coord_marshall_int
from ti... | mit | 9962fa0758fa95dc9103075c6739daaa | 31.11828 | 78 | 0.592233 | 3.881741 | false | false | false | false |
tilezen/tilequeue | tilequeue/worker.py | 1 | 24575 | import Queue
import signal
import sys
import time
from collections import namedtuple
from itertools import izip
from operator import attrgetter
from tilequeue.log import LogCategory
from tilequeue.log import LogLevel
from tilequeue.log import MsgType
from tilequeue.metatile import common_parent
from tilequeue.metatile... | mit | c57a1a09cf7a188984462a234b1f74ad | 35.299852 | 79 | 0.563052 | 4.405701 | false | false | false | false |
fcurella/django-recommends | recommends/storages/djangoorm/models.py | 1 | 2075 | from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from .managers import RecommendsManager, SimilarityManager, RecommendationManager
class RecommendsBaseModel(models.Model):
... | mit | b609669b20962c024d91bb3c5d6aeef8 | 34.775862 | 138 | 0.705542 | 4.166667 | false | false | false | false |
sqlalchemy/sqlalchemy | lib/sqlalchemy/event/api.py | 2 | 8470 | # event/api.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Public API functions for the event system.
"""
from __future__ import annotations
... | mit | 80422c32928fd20cd5d6bc30ebe846a0 | 35.826087 | 79 | 0.672255 | 4.514925 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.