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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
marcelm/cutadapt | src/cutadapt/align.py | 1 | 6405 | __all__ = [
"EndSkip",
"Aligner",
"PrefixComparer",
"SuffixComparer",
"hamming_sphere",
"hamming_environment",
"edit_environment",
"edit_distance",
]
from enum import IntFlag
from typing import Iterator, Tuple
from cutadapt._align import Aligner, PrefixComparer, SuffixComparer
class ... | mit | bc9f5aac950546530eaef25a1c5ba28c | 30.855721 | 90 | 0.537248 | 3.688364 | false | false | false | false |
tooxie/shiva-server | shiva/lyrics/letrascanciones.py | 2 | 2347 | import re
import urllib2
import requests
import lxml.html
from slugify import slugify
from shiva.lyrics import LyricScraper
from shiva.utils import get_logger
log = get_logger()
class MP3Lyrics(LyricScraper):
"""
"""
def __init__(self, artist, title):
self.artist = artist
self.title = ... | mit | 67fbdbb77698a77430caf9f526a0b9d0 | 29.881579 | 79 | 0.527482 | 3.466765 | false | false | false | false |
tooxie/shiva-server | shiva/media.py | 2 | 7914 | # -*- coding: utf-8 -*-
import os
import urllib2
from flask import current_app as app
from shiva.utils import get_logger
log = get_logger()
class MediaDir(object):
"""This object allows for media configuration. By instantiating a MediaDir
class you can tell Shiva where to look for the media files and how t... | mit | df700fcc387c3b9508ab9d0fea3ad208 | 29.091255 | 79 | 0.550417 | 4.100518 | false | false | false | false |
datasift/datasift-python | datasift/identity.py | 1 | 3489 |
class Identity(object):
""" Represents the identity API and provides the ability to query it.
Internal class instantiated as part of the Client object. """
def __init__(self, request):
self.request = request.with_prefix('account/identity')
def list(self, label=None, per_page=20, page=1):
... | mit | 745081d01c300ef436f6f74dd62b0c7a | 34.969072 | 73 | 0.588994 | 4.615079 | false | false | false | false |
tooxie/shiva-server | shiva/indexer/main.py | 2 | 13223 | # -*- coding: utf-8 -*-
"""Music indexer for the Shiva-Server API.
Index your music collection and (optionally) retrieve album covers and artist
pictures from Last.FM.
Usage:
shiva-indexer [-h] [-v] [-q] [--lastfm] [--hash] [--nometadata] [--reindex]
[--write-every=<num>] [--verbose-sql]
Options... | mit | bf0ae94ec4201a99136b96f3260faf9f | 29.608796 | 79 | 0.559933 | 3.962541 | false | false | false | false |
xgcm/xgcm | xgcm/comodo.py | 1 | 4763 | from collections import OrderedDict
# Representation of axis shifts
axis_shift_left = -0.5
axis_shift_right = 0.5
axis_shift_center = 0
# Characterizes valid shifts only
valid_axis_shifts = [axis_shift_left, axis_shift_right, axis_shift_center]
def assert_valid_comodo(ds):
"""Verify that the dataset meets comodo... | mit | f52c0412066cf85b2016c4e4806cf958 | 31.182432 | 85 | 0.569809 | 3.900901 | false | false | false | false |
samuelcolvin/pydantic | pydantic/mypy.py | 1 | 29756 | from configparser import ConfigParser
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Type as TypingType, Union
from mypy.errorcodes import ErrorCode
from mypy.nodes import (
ARG_NAMED,
ARG_NAMED_OPT,
ARG_OPT,
ARG_POS,
ARG_STAR2,
MDEF,
Argument,
AssignmentStmt,
B... | mit | 2fd696410cb12f00a0fcb91ec9349b41 | 39.265223 | 120 | 0.61964 | 3.914233 | false | true | false | false |
samuelcolvin/pydantic | pydantic/typing.py | 1 | 18217 | import sys
from collections.abc import Callable
from os import PathLike
from typing import ( # type: ignore
TYPE_CHECKING,
AbstractSet,
Any,
Callable as TypingCallable,
ClassVar,
Dict,
ForwardRef,
Generator,
Iterable,
List,
Mapping,
NewType,
Optional,
Sequence,
... | mit | 383fdf69cde3dc6331c69b165cb24e46 | 31.015817 | 117 | 0.6175 | 3.656564 | false | false | false | false |
geopython/pycsw | pycsw/plugins/profiles/ebrim/__init__.py | 72 | 1311 | # -*- coding: utf-8 -*-
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2015 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the ... | mit | 4f7ff24e5b71d6bf3063ea81b68e410a | 44.206897 | 67 | 0.684973 | 4.567944 | false | false | false | false |
geopython/pycsw | tests/functionaltests/test_suites_functional.py | 5 | 14215 | # =================================================================
#
# Authors: Ricardo Garcia Silva <ricardo.garcia.silva@gmail.com>
# Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2017 Ricardo Garcia Silva
# Copyright (c) 2017 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any pe... | mit | be294920d79b0667920ed39756b5ea8a | 34.987342 | 79 | 0.642139 | 4.220606 | false | true | false | false |
geopython/pycsw | pycsw/ogc/csw/csw3.py | 2 | 106038 | # -*- coding: utf-8 -*-
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2016 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the ... | mit | 66d5d102432a8e2addaf4e3e725f158d | 47.046217 | 223 | 0.559177 | 4.45332 | false | false | false | false |
python-escpos/python-escpos | src/escpos/capabilities.py | 2 | 4381 | import re
from os import environ, path
import pkg_resources
import pickle
import logging
import time
import six
import yaml
from tempfile import gettempdir
import platform
from typing import Any, Dict
logging.basicConfig()
logger = logging.getLogger(__name__)
pickle_dir = environ.get("ESCPOS_CAPABILITIES_PICKLE_DI... | mit | e0a1a615168f5aaccf3bb93d2445bc75 | 27.083333 | 84 | 0.643689 | 3.75729 | false | false | false | false |
dmort27/epitran | epitran/bin/testvectorgen.py | 1 | 1318 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import codecs
import epitran.vector
def main(code, space, infile):
vec = epitran.vector.VectorsWithIPASpace(code, space)
with codecs.open(infile, 'r', 'utf-8') as f:
for line in f:
fields = line.split('\t')
... | mit | f8e306f9be7a0b28080d930e07df22b0 | 36.657143 | 76 | 0.550076 | 3.610959 | false | false | false | false |
dmort27/epitran | setup.py | 1 | 1958 | from io import open
from setuptools import setup
setup(name='epitran',
version='1.23',
description='Tools for transcribing languages into IPA.',
long_description=open('README.md', encoding='utf-8').read(),
long_description_content_type='text/markdown',
url='http://github.com/dmort27/epitr... | mit | fa7d5f29f50a2a4aec6eefe452a973dc | 44.534884 | 82 | 0.503575 | 3.931727 | false | false | false | false |
crdoconnor/strictyaml | strictyaml/ruamel/emitter.py | 1 | 65161 | # coding: utf-8
from __future__ import absolute_import
from __future__ import print_function
# Emitter expects events obeying the following grammar:
# stream ::= STREAM-START document* STREAM-END
# document ::= DOCUMENT-START node DOCUMENT-END
# node ::= SCALAR | sequence | mapping
# sequence ::= SEQUENCE-START node*... | mit | 1f5d920fc74fd535c5a81072daad2dea | 36.491945 | 157 | 0.498949 | 4.272572 | false | false | false | false |
crdoconnor/strictyaml | strictyaml/ruamel/composer.py | 1 | 8423 | # coding: utf-8
from __future__ import absolute_import, print_function
import warnings
from strictyaml.ruamel.error import MarkedYAMLError, ReusedAnchorWarning
from strictyaml.ruamel.compat import utf8, nprint, nprintf # NOQA
from strictyaml.ruamel.events import (
StreamStartEvent,
StreamEndEvent,
Mapp... | mit | 8f3b400bbedb9b8536a6c7ca93cec6dd | 33.662551 | 92 | 0.561795 | 4.132974 | false | false | false | false |
crdoconnor/strictyaml | strictyaml/ruamel/main.py | 1 | 54977 | # coding: utf-8
from __future__ import absolute_import, unicode_literals, print_function
import sys
import os
import warnings
import glob
from importlib import import_module
import strictyaml.ruamel
from strictyaml.ruamel.error import UnsafeLoaderWarning, YAMLError # NOQA
from strictyaml.ruamel.tokens import * #... | mit | a105bfcb1518a9a5f3afd56640ab9286 | 33.772296 | 227 | 0.577099 | 4.209418 | false | false | false | false |
crdoconnor/strictyaml | strictyaml/ruamel/loader.py | 1 | 3015 | # coding: utf-8
from __future__ import absolute_import
from strictyaml.ruamel.reader import Reader
from strictyaml.ruamel.scanner import Scanner, RoundTripScanner
from strictyaml.ruamel.parser import Parser, RoundTripParser
from strictyaml.ruamel.composer import Composer
from strictyaml.ruamel.constructor import (
... | mit | bb945a9313224d21b3850e17f890a58d | 38.671053 | 88 | 0.678939 | 3.961892 | false | false | false | false |
mnot/redbot | redbot/message/headers/pragma.py | 1 | 1808 | from redbot.message import headers
from redbot.speak import Note, categories, levels
from redbot.syntax import rfc7234
from redbot.type import AddNoteMethodType
class pragma(headers.HttpHeader):
canonical_name = "Pragma"
description = """\
The `Pragma` header is used to include implementation-specific directi... | mit | 390095a3f4a566123864c6f6cab077ad | 33.769231 | 97 | 0.695243 | 3.704918 | false | false | false | false |
mnot/redbot | redbot/resource/fetch.py | 1 | 11403 | """
The Resource Expert Droid Fetcher.
RedFetcher fetches a single URI and analyses that response for common
problems and other interesting characteristics. It only makes one request,
based upon the provided headers.
"""
from configparser import SectionProxy
import time
from typing import Any, Dict, List, Tuple, Type... | mit | 7016a7e235ef60a96ac2244e29bbe447 | 35.2 | 99 | 0.633079 | 3.921252 | false | false | false | false |
mnot/redbot | redbot/webui/__init__.py | 1 | 11401 | """
A Web UI for RED, the Resource Expert Droid.
"""
from collections import defaultdict
from configparser import SectionProxy
from functools import partial
import os
import string
import sys
import time
from typing import Any, Callable, Dict, List, Tuple, Union, cast
from urllib.parse import parse_qs, urlsplit, urlen... | mit | 3fcf83d161f93841398a0ee72392dbc8 | 32.532353 | 97 | 0.542145 | 3.962808 | false | true | false | false |
mnot/redbot | redbot/message/headers/last_modified.py | 1 | 1133 | from redbot.message import headers
from redbot.syntax import rfc7232
from redbot.type import AddNoteMethodType
class last_modified(headers.HttpHeader):
canonical_name = "Last-Modified"
description = """\
The `Last-Modified` header indicates the time that the origin server believes the
representation was last ... | mit | 0734099cffe2bd09d5d965c8e4b34eee | 28.051282 | 81 | 0.70256 | 3.486154 | false | true | false | false |
mnot/redbot | redbot/syntax/rfc7233.py | 1 | 2813 | """
Regex for RFC7233
These regex are directly derived from the collected ABNF in RFC7233.
<http://httpwg.org/specs/rfc7233.html#collected.abnf>
They should be processed with re.VERBOSE.
"""
# pylint: disable=invalid-name
from .rfc5234 import DIGIT, SP, VCHAR
from .rfc7230 import list_rule, token
from .rfc7231 ... | mit | c72bdfc6420ecef4ddb5a614702feeab | 22.838983 | 85 | 0.661571 | 2.725775 | false | false | false | false |
mnot/redbot | redbot/resource/active_check/base.py | 1 | 3361 | """
Subrequests to do things like range requests, content negotiation checks,
and validation.
This is the base class for all subrequests.
"""
from abc import ABCMeta, abstractmethod
from configparser import SectionProxy
from typing import List, Type, Union, TYPE_CHECKING
from redbot.resource.fetch import RedFetcher
... | mit | e5801ef97667a4005d434fc876ab3db0 | 31.95098 | 97 | 0.640583 | 4.044525 | false | false | false | false |
mnot/redbot | redbot/formatter/text.py | 1 | 6699 | """
HAR Formatter for REDbot.
"""
from html.parser import HTMLParser
import operator
import re
import textwrap
from typing import Any, List
import thor.http.error as httperr
from redbot.formatter import Formatter
from redbot.message import HttpResponse
from redbot.resource import HttpResource
from redbot.speak impor... | mit | 3a70f904a1ed0cbb7d43bb633f6206f5 | 28.773333 | 86 | 0.559039 | 3.828 | false | false | false | false |
mnot/redbot | redbot/message/headers/date.py | 1 | 1158 | from redbot.message import headers
from redbot.syntax import rfc7231
from redbot.type import AddNoteMethodType
class date(headers.HttpHeader):
canonical_name = "Date"
description = """\
The `Date` header represents the time when the message was generated, regardless of caching that
happened since.
It is used... | mit | 432be12625cff759a53c953fc0fb3669 | 27.243902 | 96 | 0.698618 | 3.498489 | false | true | false | false |
bambinos/bambi | bambi/tests/test_utils.py | 1 | 1143 | import pytest
import numpy as np
import pandas as pd
from bambi.utils import censored, listify
from bambi.backend.pymc import probit, cloglog
from bambi.utils import censored
def test_listify():
assert listify(None) == []
assert listify([1, 2, 3]) == [1, 2, 3]
assert listify("giraffe") == ["giraffe"]
... | mit | bae126c82d888431e246cc5539f3af36 | 23.847826 | 68 | 0.56168 | 2.864662 | false | true | false | false |
bambinos/bambi | setup.py | 1 | 1990 | import os
import sys
from setuptools import find_packages, setup
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
README_FILE = os.path.join(PROJECT_ROOT, "README.md")
VERSION_FILE = os.path.join(PROJECT_ROOT, "bambi", "version.py")
REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.txt")
OPTIONAL... | mit | e6c7cea0737eda50794bc89ff9ecdb1e | 29.151515 | 95 | 0.666332 | 3.425129 | false | false | false | false |
bambinos/bambi | bambi/backend/pymc.py | 1 | 22246 | import functools
import logging
import traceback
from copy import deepcopy
import numpy as np
import pymc as pm
import aesara.tensor as at
from bambi import version
from bambi.backend.links import cloglog, identity, inverse_squared, logit, probit, arctan_2
from bambi.backend.terms import CommonTerm, GroupSpecificT... | mit | fd9b994edc02435f895b5cd93c07fd3e | 34.996764 | 100 | 0.556594 | 4.2438 | false | false | false | false |
bambinos/bambi | bambi/families/family.py | 1 | 2700 | from bambi.families.link import Link
class Family:
"""A specification of model family.
Parameters
----------
name: str
The name of the family. It can be any string.
likelihood: Likelihood
A ``bambi.families.Likelihood`` instance specifying the model likelihood function.
link: ... | mit | 0768a6a663a42d0079d8f50749496b5e | 28.032258 | 96 | 0.568519 | 3.988183 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/components/optimal_90deg.py | 1 | 1902 | import numpy as np
from gdsfactory.cell import cell
from gdsfactory.component import Component
from gdsfactory.types import LayerSpec
@cell
def optimal_90deg(
width: float = 100,
num_pts: int = 15,
length_adjust: float = 1,
layer: LayerSpec = (1, 0),
) -> Component:
"""Returns optimally-rounded 9... | mit | e49b54603fd6db35aebf4a04c291fa86 | 28.230769 | 86 | 0.618421 | 3.030303 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/read/from_dphox.py | 1 | 1638 | from gdsfactory.component import Component, ComponentReference
def from_dphox(device: "dp.Device", foundry: "dp.foundry.Foundry") -> Component:
"""Returns Gdsfactory Component from a dphox Device.
Note that you need to install dphox `pip install dphox`
https://dphox.readthedocs.io/en/latest/index.html
... | mit | eb70f6e2d0e09a5f823507c9d839fbaa | 30.5 | 80 | 0.601954 | 3.485106 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/component_layout.py | 1 | 22858 | import numbers
from collections import defaultdict
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
from gdstk import Label, Polygon
from numpy import cos, pi, sin
from numpy.linalg import norm
def get_polygons(
instance,
by_spec: Union[bool, Tuple[int, int]] = False,
depth: Optio... | mit | cc706a22b4309db042a71953201a1200 | 31.695279 | 176 | 0.575917 | 4.029267 | false | false | false | false |
gdsfactory/gdsfactory | gdsfactory/samples/23_reticle.py | 1 | 1796 | """Sample of a reticle top level Component."""
import gdsfactory as gf
from gdsfactory.types import Component
def mzi_te_pads1(**kwargs) -> Component:
c = gf.c.mzi_phase_shifter_top_heater_metal(delta_length=40)
c = gf.routing.add_fiber_single(c)
c = c.rotate(-90)
c = gf.routing.add_electrical_pads_t... | mit | f4781ebce29d535998af7058b3ca4daa | 33.538462 | 88 | 0.658129 | 2.633431 | false | false | false | false |
galaxyproject/cargo-port | bin/gsl.py | 1 | 2648 | #!/usr/bin/env python
from future import standard_library
standard_library.install_aliases()
from builtins import str
import click
import hashlib
from io import StringIO
import logging
import os
import urllib.request, urllib.parse, urllib.error
from cargoport.utils import yield_packages, package_name, PACKAGE_SERVER,... | mit | 9922005f610aa90b7325319d76017ed3 | 42.409836 | 129 | 0.64426 | 3.975976 | false | false | false | false |
ssato/python-anyconfig | src/anyconfig/backend/yaml/ruamel_yaml.py | 1 | 4376 | #
# Copyright (C) 2011 - 2021 Satoru SATOH <satoru.satoh@gmail.com>
# SPDX-License-Identifier: MIT
#
"""A backend module to load and dump YAML data files using rumael.yaml.
- Format to support: YAML, http://yaml.org
- Requirement: ruamel.yaml, https://bitbucket.org/ruamel/yaml
- Development Status :: 4 - Beta
- Limita... | mit | 8f51f2960989ff4af2464efdf5cc87f8 | 34.008 | 79 | 0.617002 | 3.569331 | false | false | false | false |
ssato/python-anyconfig | src/anyconfig/backend/toml.py | 1 | 1048 | #
# Copyright (C) 2015 - 2021 Satoru SATOH <satoru.satoh@gmail.com>
# SPDX-License-Identifier: MIT
#
# Ref. python -c "import toml; help(toml); ..."
#
r"""A backend module to load and dump TOML files.
- Format to support: TOML, https://github.com/toml-lang/toml
- Requirements: (python) toml module, https://github.com/... | mit | 4fdf12f453b391401283780301eceeed | 24.560976 | 77 | 0.66126 | 2.871233 | false | false | false | false |
ssato/python-anyconfig | src/anyconfig/ioinfo/factory.py | 1 | 2628 | #
# Copyright (C) 2018 - 2021 Satoru SATOH <satoru.satoh @ gmmail.com>
# SPDX-License-Identifier: MIT
#
# pylint: disable=invalid-name
"""ioinfo.main to provide internal APIs used from other modules."""
import pathlib
import typing
from . import constants, datatypes, detectors, utils
def from_path_object(path: pathl... | mit | 873ee5d77c1c919ced4d011682f4c82b | 29.206897 | 79 | 0.639269 | 3.272727 | false | false | false | false |
hugsy/gef | tests/commands/pattern.py | 1 | 3009 | """
Pattern commands test module
"""
import pytest
from tests.utils import ARCH, GefUnitTestGeneric, _target, gdb_run_cmd, is_64b
class PatternCommand(GefUnitTestGeneric):
"""`pattern` command test module"""
def test_cmd_pattern_create(self):
cmd = "pattern create -n 4 32"
res = gdb_run_cmd(... | mit | 261b784212b16c119b6b8831994fcd53 | 36.6125 | 102 | 0.589232 | 3.50291 | false | true | false | false |
istresearch/traptor | traptor/rule_set.py | 1 | 8448 | import six
class RuleSet(object):
"""
Rule sets provide a convenient data structure to work with lists of
collection rules.
The rule set class enables operations using set operations (union,
difference, intersection) and simple syntax for addition and subtraction
using the +/- operators.
... | mit | 9616a3151ccd3987943b5b62419efb07 | 29.064057 | 93 | 0.572917 | 4.377202 | false | false | false | false |
javipalanca/spade | examples/join.py | 1 | 1027 | import asyncio
import getpass
from spade import quit_spade
from spade.agent import Agent
from spade.behaviour import OneShotBehaviour
class DummyAgent(Agent):
class LongBehav(OneShotBehaviour):
async def run(self):
await asyncio.sleep(5)
print("Long Behaviour has finished")
c... | mit | ed01e1265a3850854a469584beaab414 | 23.452381 | 70 | 0.635833 | 3.481356 | false | false | false | false |
istresearch/traptor | traptor/traptor_birdy.py | 1 | 2333 |
from .birdy.twitter import StreamClient, StreamResponse
class TraptorStreamResponse(StreamResponse):
"""
Adds proper connection closing.
"""
_response = None
def __init__(self, response, request_method, json_object_hook):
super(TraptorStreamResponse, self).__init__(response, request_met... | mit | 12ecb511b1e307343b2cf3f1c1189263 | 29.697368 | 111 | 0.620231 | 4.312384 | false | false | false | false |
solvebio/solvebio-python | solvebio/test/test_lookup.py | 1 | 1302 | from __future__ import absolute_import
from .helper import SolveBioTestCase
class LookupTests(SolveBioTestCase):
def setUp(self):
super(LookupTests, self).setUp()
self.dataset = self.client.Object.get_by_full_path(
self.TEST_DATASET_FULL_PATH)
def test_lookup_error(self):
... | mit | 742db7d6dec96b9d2f25b507913c4beb | 33.263158 | 69 | 0.643625 | 3.677966 | false | true | false | false |
solvebio/solvebio-python | solvebio/global_search.py | 1 | 7763 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from .client import client
from .resource import Object
from .resource import Vault
from .query import QueryBase
from .query import Query
from .query import Filter
import logging
logger = logging.getLogger('solvebio')
class GlobalSearch(Query):
"""
... | mit | b957256d6bcd47fb671f211075f6f08a | 33.502222 | 98 | 0.566662 | 4.569158 | false | false | false | false |
solvebio/solvebio-python | solvebio/resource/solveobject.py | 1 | 3113 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
import sys
from ..client import client
from .util import json
def convert_to_solve_object(resp, **kwargs):
from . import types
_client = kwargs.pop('client', None)
if isinstance(resp, list):
return [convert_to_solve_obje... | mit | 49df853c18c92b717fb6556146f85db9 | 27.559633 | 73 | 0.568583 | 3.723684 | false | false | false | false |
solvebio/solvebio-python | solvebio/utils/tabulate.py | 1 | 20872 | # -*- coding: utf-8 -*-
#
# This file contains code from python-tabulate, modified for SolveBio
#
# Copyright © 2011-2013 Sergey Astanin
#
# 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 with... | mit | 28846d259d928e8a00ff9558cbdcd68e | 32.128571 | 94 | 0.544392 | 3.724969 | false | false | false | false |
solvebio/solvebio-python | solvebio/utils/humanize.py | 1 | 2718 | # -*- coding: utf-8 -*-
#
# From Humanize (jmoiron/humanize)
#
# Copyright (c) 2010 Jason Moiron and Contributors
#
# 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, includ... | mit | a3088f8ce038cf22041c247cc125e58a | 38.391304 | 78 | 0.651582 | 3.692935 | false | false | false | false |
sigopt/sigopt-python | controller/controller/manage_pods.py | 1 | 5838 | # Copyright © 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
from http import HTTPStatus
from kubernetes.client.exceptions import ApiException as KubernetesApiException
import logging
import signal
import threading
from sigopt.run_context import RunContext
from controller.create_pod import create_run_pod
from... | mit | de6e78866cbe1854d9780a02030dd317 | 33.744048 | 97 | 0.692479 | 3.385731 | false | false | false | false |
sigopt/sigopt-python | test/xgboost/test_experiment_config.py | 1 | 9164 | # Copyright © 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
import copy
from mock import Mock
import pytest
from sigopt.xgboost.constants import (
DEFAULT_CLASSIFICATION_METRIC,
DEFAULT_EVALS_NAME,
DEFAULT_REGRESSION_METRIC,
PARAMETER_INFORMATION,
SUPPORTED_AUTOBOUND_PARAMS,
)
from sigopt.xgboost.e... | mit | d343d515070d5d3130c161251b9562d2 | 32.937037 | 94 | 0.699007 | 3.744585 | false | true | false | false |
sigopt/sigopt-python | controller/controller/watch_pods.py | 1 | 1523 | # Copyright © 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
from kubernetes import watch
from controller.thread import ControllerThread
from controller.pod_status import is_pod_finished
from controller.k8s_constants import K8sEvent
class WatchPodsThread(ControllerThread):
def __init__(self, *args, stop_th... | mit | 72c738336db46a3b876f32a0b2497c03 | 36.121951 | 109 | 0.661629 | 3.615202 | false | false | false | false |
sigopt/sigopt-python | controller/controller/run_state.py | 1 | 3210 | # Copyright © 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
import collections
import logging
from sigopt.exception import ApiException
from sigopt.run_context import RunContext
from controller.k8s_constants import K8sPhase
from controller.pod_status import is_pod_phase_active, is_pod_phase_finished
PodSta... | mit | be8096064121d3de444e55ce923fb4d6 | 33.880435 | 102 | 0.715799 | 3.439443 | false | false | false | false |
sigopt/sigopt-python | test/runs/test_local_run_context.py | 1 | 2035 | # Copyright © 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
from sigopt.local_run_context import LocalRunContext
import pytest
class TestLocalRunContext(object):
@pytest.fixture
def context(self):
return LocalRunContext()
@pytest.fixture
def params(self):
return {
'x': 1.0,
'y'... | mit | a62b1cb43590bfe4a86b20b8cd1567ad | 26.863014 | 111 | 0.631268 | 3.506897 | false | true | false | false |
sigopt/sigopt-python | sigopt/objects.py | 1 | 15075 | # Copyright © 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
import copy
import warnings
from .compat import json
from .lib import is_sequence, is_mapping, is_integer, is_number, is_numpy_array, is_string
class ListOf(object):
def __init__(self, typ):
self.type = typ
def __call__(self, value):
... | mit | f334f97acc7f373ecf14ba07dfcf90af | 23.510569 | 110 | 0.649728 | 3.516212 | false | false | false | false |
sigopt/sigopt-python | sigopt/orchestrate/controller.py | 1 | 18484 | # Copyright © 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
import os
import re
from collections import defaultdict
import click
import pint
import yaml
from botocore.exceptions import NoRegionError
from sigopt.paths import get_bin_dir, ensure_dir
from sigopt.utils import accept_sigopt_not_found
from .clus... | mit | b7e9d4df5d2943b81cf903760031e2fd | 34.959144 | 119 | 0.675215 | 3.82117 | false | false | false | false |
choderalab/openmmtools | openmmtools/multistate/utils.py | 1 | 11858 | #!/usr/local/bin/env python
# ==============================================================================
# MODULE DOCSTRING
# ==============================================================================
"""
Multistate Utilities
====================
Sampling Utilities for the YANK Multistate Package. A collecti... | mit | a0b800f536932751e6600ce6397c8971 | 39.609589 | 120 | 0.651543 | 4.030591 | false | false | false | false |
choderalab/openmmtools | openmmtools/data/cb7-viologen/molecules/create-viologen.py | 1 | 2044 | """
Create mol2 file for substituted viologen.
"""
from openeye.oechem import *
from openeye.oeomega import *
from openeye.oequacpac import *
smiles = "OC(=O)CCCCC[n+](cc1)ccc1-c2cc[n+](cc2)CCCCCC(=O)O" # substituted viologen
output_filename = 'viologen.tripos.mol2'
def assign_am1bcc_charges(mol):
"""
Assi... | mit | 7b488d5298068d31306980a635ad1630 | 21.711111 | 96 | 0.672701 | 2.979592 | false | false | false | false |
choderalab/openmmtools | openmmtools/data/benzene-toluene-implicit/generate-molecules.py | 1 | 1393 | #!/usr/bin/env python
"""
Generate molecules for test system using OpenEye tools.
"""
molecules = { 'BEN' : 'benzene',
'TOL' : 'toluene' }
from openeye import oechem
from openeye import oeomega
from openeye import oeiupac
from openeye import oequacpac
# Create molecules.
for resname in molecules:
... | mit | e034a0b9d6c0e49acd09060e0fca943d | 23.875 | 77 | 0.694185 | 3.194954 | false | false | false | false |
choderalab/openmmtools | openmmtools/forces.py | 1 | 56521 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Custom OpenMM Forces classes and utilities.
"""
# ============================================================... | mit | df4afda26853fc55cbc276208723a990 | 40.805473 | 112 | 0.635286 | 4.41881 | false | false | false | false |
choderalab/openmmtools | openmmtools/multistate/replicaexchange.py | 1 | 22206 | #!/usr/local/bin/env python
# ==============================================================================
# MODULE DOCSTRING
# ==============================================================================
"""
ReplicaExchangeSampler
======================
Derived multi-thermodynamic state multistate class with ex... | mit | b87025c139b2f8c11518c85bfd4a702d | 48.677852 | 247 | 0.65113 | 4.066288 | false | false | false | false |
davidsandberg/facenet | src/generative/models/dfc_vae_resnet.py | 1 | 6257 | # MIT License
#
# Copyright (c) 2017 David Sandberg
#
# 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, me... | mit | edb428727757b13710a7a14fb3a76947 | 55.890909 | 131 | 0.58958 | 3.565242 | false | false | false | false |
althonos/pronto | pronto/synonym.py | 1 | 6009 | # coding: utf-8
import functools
import typing
import weakref
from typing import Iterable, Optional, Set
from .utils.meta import roundrepr, typechecked
from .xref import Xref
if typing.TYPE_CHECKING:
from .ontology import Ontology
_SCOPES = frozenset({"EXACT", "RELATED", "BROAD", "NARROW", None})
__all__ = ["S... | mit | 7b57129d3bf0ad05ec33e9a4f729d2c6 | 29.045 | 87 | 0.58246 | 3.942913 | false | false | false | false |
marshmallow-code/marshmallow-sqlalchemy | tests/conftest.py | 1 | 6733 | from types import SimpleNamespace
import datetime as dt
import pytest
import sqlalchemy as sa
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship, backref, column_property, synonym
class AnotherInt... | mit | fbe86a5226b9ddbbb608b064c8ac2744 | 30.909953 | 98 | 0.614585 | 3.750975 | false | true | false | false |
marshmallow-code/marshmallow-sqlalchemy | src/marshmallow_sqlalchemy/fields.py | 1 | 5284 | import warnings
from marshmallow import fields
from marshmallow.utils import is_iterable_but_not_string
from sqlalchemy import inspect
from sqlalchemy.orm.exc import NoResultFound
def get_primary_keys(model):
"""Get primary key properties for a SQLAlchemy model.
:param model: SQLAlchemy model class
"""
... | mit | 28e113b1105a7040e3a1876ae8d44ee4 | 36.211268 | 91 | 0.623202 | 4.230584 | false | false | false | false |
pact-foundation/pact-python | pact/matchers.py | 1 | 13955 | """Classes for defining request and response data that is variable."""
import six
import datetime
from enum import Enum
class Matcher(object):
"""Base class for defining complex contract expectations."""
def generate(self):
"""
Get the value that the mock service should use for this Matcher.... | mit | 09bcc2e7984ac912462d5bdd71f5cdbb | 33.8875 | 79 | 0.530992 | 3.210999 | false | false | false | false |
pact-foundation/pact-python | examples/message/tests/provider/test_message_provider.py | 1 | 2083 | import pytest
from pact import MessageProvider
PACT_BROKER_URL = "http://localhost"
PACT_BROKER_USERNAME = "pactbroker"
PACT_BROKER_PASSWORD = "pactbroker"
PACT_DIR = "pacts"
@pytest.fixture
def default_opts():
return {
'broker_username': PACT_BROKER_USERNAME,
'broker_password': PACT_BROKER_PASSW... | mit | 9f44c00980b66ddf04cf0b1f92b0d54c | 24.096386 | 72 | 0.62266 | 4.166 | false | true | false | false |
warner/foolscap | src/foolscap/tokens.py | 1 | 17073 | import six
from twisted.python.failure import Failure
from zope.interface import Attribute, Interface
# delimiter characters.
LIST = six.int2byte(0x80) # old
INT = six.int2byte(0x81)
STRING = six.int2byte(0x82)
NEG = six.int2byte(0x83)
FLOAT = six.int2byte(0x84)
# "optional" -- these might be refuse... | mit | 21d33de835dc67749ebc96a5697a7b81 | 42.776923 | 77 | 0.68295 | 4.388946 | false | false | false | false |
warner/foolscap | src/foolscap/slicers/tuple.py | 1 | 4685 | # -*- test-case-name: foolscap.test.test_banana -*-
from __future__ import print_function
from twisted.internet.defer import Deferred
from foolscap.tokens import Violation
from foolscap.slicer import BaseUnslicer
from foolscap.slicers.list import ListSlicer
from foolscap.constraint import OpenerConstraint, Any, IConst... | mit | 876c4b51d32d7061fb72c935dc9b5769 | 32.949275 | 76 | 0.60555 | 4.091703 | false | false | false | false |
warner/foolscap | src/foolscap/test/test_crypto.py | 1 | 4158 |
import re
from twisted.trial import unittest
from zope.interface import implementer
from twisted.internet import defer
from foolscap import pb
from foolscap.api import RemoteInterface, Referenceable, Tub, flushEventualQueue
from foolscap.remoteinterface import RemoteMethodSchema
from foolscap.util import allocate_tcp... | mit | 765f56612f46b5c337745f126c4171d6 | 34.237288 | 80 | 0.632035 | 3.315789 | false | true | false | false |
warner/foolscap | src/foolscap/logging/interfaces.py | 1 | 6341 |
from zope.interface import Interface
from foolscap.remoteinterface import RemoteInterface
from foolscap.schema import DictOf, ListOf, Any, Optional, ChoiceOf
TubID = Any() # printable, base32 encoded
Incarnation = (Any(), ChoiceOf(Any(), None))
Header = DictOf(Any(), Any())
Event = DictOf(Any(), Any()) # this has mes... | mit | 0537248ba20b9d655bfe7798fe9e1b23 | 42.136054 | 77 | 0.667087 | 4.224517 | false | false | false | false |
warner/foolscap | src/foolscap/logging/gatherer.py | 1 | 22586 | from __future__ import print_function, unicode_literals
import six, os, sys, time, bz2
signal = None
try:
import signal
except ImportError:
pass
from zope.interface import implementer
from twisted.internet import reactor, utils, defer
from twisted.python import usage, procutils, filepath, log as tw_log
from twi... | mit | b271acaab057ad63fa1fa204d1e4e358 | 37.608547 | 123 | 0.622554 | 3.68992 | false | false | false | false |
lipis/electron-crash-reporter | main/model/base.py | 3 | 1201 | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
from marshmallow import validate
from webargs.flaskparser import parser
from webargs import fields as wf
from api import fields
import config
import util
class Base(ndb.Model):
created = ndb.DateTimeProperty(auto_now_add=... | mit | db3373b37c396c0ae384350de7ccc429 | 25.688889 | 93 | 0.680266 | 3.511696 | false | false | false | false |
lipis/electron-crash-reporter | main/api/v1/project.py | 1 | 2106 | # coding: utf-8
from __future__ import absolute_import
from google.appengine.ext import ndb
from flask.ext import restful
import flask
from api import helpers
import auth
import model
import util
from main import api_v1
@api_v1.resource('/project/', endpoint='api.project.list')
class ProjectListAPI(restful.Resour... | mit | 3305cfb7af7a3b07e331c7939538e529 | 34.694915 | 89 | 0.676163 | 3.6 | false | false | false | false |
pytest-dev/pluggy | scripts/release.py | 1 | 1987 | """
Release script.
"""
import argparse
import sys
from subprocess import check_call
from colorama import Fore
from colorama import init
from git import Remote
from git import Repo
def create_branch(version):
"""Create a fresh branch from upstream/main"""
repo = Repo.init(".")
if repo.is_dirty(untracked_... | mit | a69f80f1c73680db45aeb5a9be3fd1da | 26.985915 | 84 | 0.658279 | 3.770398 | false | false | false | false |
lipis/electron-crash-reporter | main/auth/yahoo.py | 8 | 2108 | # coding: utf-8
import flask
import auth
import model
import util
from main import app
yahoo_config = dict(
access_token_url='https://api.login.yahoo.com/oauth/v2/get_token',
authorize_url='https://api.login.yahoo.com/oauth/v2/request_auth',
base_url='https://query.yahooapis.com/',
consumer_key=model.Config... | mit | ae3ade71d6880e8bdf33a5bf168f8ce7 | 26.376623 | 77 | 0.669829 | 3.155689 | false | true | false | false |
lipis/electron-crash-reporter | main/auth/linkedin.py | 8 | 1892 | # coding: utf-8
import flask
import auth
import config
import model
import util
from main import app
linkedin_config = dict(
access_token_method='POST',
access_token_url='https://www.linkedin.com/uas/oauth2/accessToken',
authorize_url='https://www.linkedin.com/uas/oauth2/authorization',
base_url='https://ap... | mit | 18fe19d9a3b50f4d7a675d7bcdb10477 | 24.567568 | 71 | 0.69926 | 3.101639 | false | true | false | false |
lipis/electron-crash-reporter | main/api/helpers.py | 2 | 1762 | # coding: utf-8
from datetime import datetime
import logging
from flask.ext import restful
from werkzeug import exceptions
import flask
import util
class Api(restful.Api):
def unauthorized(self, response):
flask.abort(401)
def handle_error(self, e):
return handle_error(e)
def handle_error(e):
logg... | mit | 59491ce4ec2bd44e168305438c255689 | 24.911765 | 72 | 0.641884 | 3.545272 | false | false | false | false |
lipis/electron-crash-reporter | main/control/project.py | 1 | 4751 | # coding: utf-8
from flask.ext import wtf
from google.appengine.ext import ndb
import flask
import wtforms
import auth
import config
import model
import util
from main import app
###############################################################################
# Update
###############################################... | mit | b4acd5d9accfe04b3e288e852829d880 | 29.651613 | 111 | 0.57651 | 3.794728 | false | false | false | false |
lipis/electron-crash-reporter | main/control/profile.py | 1 | 3627 | # coding: utf-8
from flask.ext import wtf
import flask
import wtforms
import auth
import config
import model
import util
import task
from main import app
###############################################################################
# Profile View
##################################################################... | mit | 3e0156f96e99d63826a222aca4f0e29c | 28.25 | 79 | 0.590019 | 3.972618 | false | false | false | false |
dgilland/pydash | src/pydash/arrays.py | 1 | 59046 | """
Functions that operate on lists.
.. versionadded:: 1.0.0
"""
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
from math import ceil
import pydash as pyd
from .helpers import base_get, iteriteratee, parse_iteratee
__all__ = (
"chunk",
"compact",
"concat",
"differenc... | mit | 3725b1ae098b2f0f6a15438569546cb7 | 23.399174 | 100 | 0.560902 | 3.773872 | false | false | false | false |
dgilland/pydash | src/pydash/helpers.py | 1 | 8525 | """Generic utility methods not part of main API."""
import builtins
from collections.abc import Hashable, Iterable, Mapping, Sequence
from decimal import Decimal
from functools import wraps
import inspect
from inspect import getfullargspec
import warnings
import pydash as pyd
#: Singleton object that differentiates... | mit | 5ede524c30c948d050425134d19e6b2e | 27.996599 | 100 | 0.61607 | 4.057592 | false | false | false | false |
dgilland/pydash | tasks.py | 1 | 3748 | """
This module provides the CLI interface for invoke tasks.
All tasks can be executed from this file's directory using:
$ inv <task>
Where <task> is a function defined below with the @task decorator.
"""
from functools import partial
import os
from invoke import Exit, UnexpectedExit, run as _run, task
PACKA... | mit | c8a5222faa74ad36633665ff2cca88a9 | 23.337662 | 99 | 0.631537 | 3.385727 | false | true | false | false |
pebble/cloudpebble | ide/migrations/0022_auto__add_field_sourcefile_target.py | 3 | 11729 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SourceFile.target'
db.add_column(u'ide_sourcefile', 'targ... | mit | c60bf5c34798209e62dc7f13df77644f | 79.342466 | 195 | 0.550431 | 3.577005 | false | false | false | false |
pebble/cloudpebble | ide/migrations/0007_auto__add_field_project_optimisation.py | 3 | 9269 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.optimisation'
db.add_column(u'ide_project', 'optimisation',
se... | mit | bafb9b3954723d86654c10fe856f5c15 | 73.16 | 187 | 0.54925 | 3.60101 | false | false | false | false |
pebble/cloudpebble | ide/api/npm.py | 2 | 1450 | import urllib
import requests
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_safe
from django.http import Http404
from utils.td_helper import send_td_event
from utils.jsonview import json_view
from utils.filter_dict import filter_dict
__author__ = 'katharin... | mit | 31e3fd53578e624aebb3da06e69bf681 | 22.770492 | 102 | 0.635172 | 3.527981 | false | false | false | false |
bioconda/bioconda-utils | bioconda_utils/graph.py | 1 | 4478 | """
Construction and Manipulation of Package/Recipe Graphs
"""
import logging
from collections import defaultdict
from fnmatch import fnmatch
from itertools import chain
import networkx as nx
from . import utils
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
def build(recipes, config, black... | mit | 177c060f2d39b48be7d9a59a2e26538b | 29.256757 | 93 | 0.615453 | 4.236518 | false | false | false | false |
pebble/cloudpebble | ide/utils/mailinglist.py | 2 | 1338 | import logging
import mailchimp
from django.conf import settings
logger = logging.getLogger(__name__)
mailchimp_default_list_id = settings.MAILCHIMP_LIST_ID
def add_user(user, mailing_list_id=None):
try:
mailchimp_api = mailchimp.Mailchimp(apikey=settings.MAILCHIMP_API_KEY)
except mailchimp.Error:
... | mit | e5c41fb26fe74669f6dcc4e02a63dcab | 37.228571 | 100 | 0.591181 | 4.12963 | false | false | false | false |
benoitc/couchdbkit | couchdbkit/utils.py | 4 | 6295 | # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
"""
Mostly utility functions couchdbkit uses internally that don't
really belong anywhere else in the modules.
"""
from __future__ import with_statement
import codecs
import string
from h... | mit | 1987d88760ba66d26a013d976dba617c | 28.553991 | 88 | 0.535663 | 4.037845 | false | false | false | false |
benoitc/couchdbkit | couchdbkit/external.py | 6 | 1470 | # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
import sys
from .utils import json
class External(object):
""" simple class to handle an external
ans send the response.
example:
from couchdbkit.external im... | mit | 8680b2c414c7b94636d14d6763568590 | 24.344828 | 72 | 0.527891 | 4.323529 | false | false | false | false |
benoitc/couchdbkit | couchdbkit/wsgi/proxy.py | 6 | 1367 | # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
import urlparse
from restkit.contrib.wsgi_proxy import HostProxy, ALLOWED_METHODS
from webob import Request
class CouchdbProxy(object):
"""\
WSGI application to proxy a couchdb se... | mit | 46d7d28de483b17d1057feb3c8ff51d0 | 32.341463 | 76 | 0.627652 | 3.962319 | false | false | false | false |
benoitc/couchdbkit | couchdbkit/loaders.py | 6 | 3408 | # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
"""
Loaders are a simple way to manage design docs in your Python application.
Loaders are compatible with couchapp script (http://github.com/couchapp/couchapp).
So it means that you can s... | mit | cb911e830e05ae017c6d525fb3a36477 | 33.424242 | 89 | 0.660211 | 4.130909 | false | false | false | false |
benoitc/couchdbkit | couchdbkit/wsgi/handler.py | 6 | 4382 | # -*- coding: utf-8 -
#
# This file is part of couchdbkit released under the MIT license.
# See the NOTICE for more information.
import sys
import StringIO
import traceback
from urllib import unquote
from restkit.util import url_encode
from .. import __version__
from ..external import External
def _normalize_name(... | mit | 79e01aa9134fa31e7512d76d0401a6ed | 32.19697 | 78 | 0.521223 | 4.072491 | false | false | false | false |
cole/aiosmtplib | tests/test_errors.py | 1 | 4413 | """
Test error class imports, arguments, and inheritance.
"""
import asyncio
from typing import List, Tuple, Type, Union
import pytest
from hypothesis import given
from hypothesis.strategies import integers, lists, text, tuples
from aiosmtplib import (
SMTPAuthenticationError,
SMTPConnectError,
SMTPConnec... | mit | ebf9a77cb91aed2368386a92e04f9e6d | 31.932836 | 87 | 0.742579 | 3.940179 | false | true | false | false |
theonion/django-bulbs | bulbs/promotion/migrations/0002_content_list_to_pzone.py | 2 | 4862 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import json_field.fields
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
('content', '0001_initial'),
('promotion', '0001_initial'),
]
... | mit | eb463303f9febf14ebc0ad452d0a6696 | 32.07483 | 164 | 0.538256 | 4.881526 | false | false | false | false |
theonion/django-bulbs | bulbs/instant_articles/views.py | 1 | 4002 | from django.conf import settings
from django.template import RequestContext, loader
from django.template.base import TemplateDoesNotExist
from django.views.decorators.cache import cache_control
from bulbs.content.models import Content
from bulbs.content.views import BaseContentDetailView
from bulbs.feeds.views import ... | mit | a579e89af5cf278ed3882a4f51aeaace | 37.480769 | 93 | 0.661419 | 3.889213 | false | false | false | false |
theonion/django-bulbs | bulbs/campaigns/views.py | 2 | 1973 | from datetime import datetime
from rest_framework import routers, viewsets, filters
from rest_framework.permissions import IsAdminUser
from .models import Campaign
from .serializers import CampaignSerializer
from bulbs.utils.methods import get_query_params
class CampaignActiveFilter(filters.BaseFilterBackend):
... | mit | ba57a75091511b7b84230c404a2f0b4d | 30.822581 | 82 | 0.618855 | 4.01833 | false | false | false | false |
theonion/django-bulbs | bulbs/poll/views.py | 1 | 1646 | import json
from django.http import HttpResponse
from django.views.decorators.cache import cache_control
from django.views.generic.detail import DetailView
from bulbs.content.views import BaseContentDetailView
from bulbs.poll.models import Poll
from bulbs.poll.serializers import PollPublicSerializer
class PollDetai... | mit | 01302cb4f91da4c2466fe091f669f6eb | 34.021277 | 86 | 0.705954 | 4.354497 | false | false | false | false |
theonion/django-bulbs | bulbs/special_coverage/views.py | 1 | 4492 | from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils.cache import add_never_cache_headers
from django.views.decorators.cache import cache_control
from bulbs.content.views import BaseContentDetailView
from bulbs.special_coverage.models import SpecialCoverage
from bulbs.utils.... | mit | 6e256d1e08957c1062e64a6abcaa170d | 36.747899 | 99 | 0.653384 | 4.0287 | false | false | false | false |
theonion/django-bulbs | bulbs/content/templatetags/content.py | 1 | 1109 | try:
from urllib.parse import urljoin, urlencode
except ImportError:
from urlparse import urljoin
from urllib import urlencode
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def content_tunic_campaign_url(campaign_id,
... | mit | bbbf056c0bd554f16b9ffeebc63b7e47 | 26.725 | 74 | 0.626691 | 3.918728 | false | false | false | false |
theonion/django-bulbs | tests/feeds/test_rss_feeds.py | 1 | 4908 | from datetime import timedelta
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.utils import timezone
from bulbs.special_coverage.models import SpecialCoverage
from bulbs.super_features.models import BaseSuperFeature, GUIDE_TO_HOMEPAGE
from bulbs.utils.test import BaseInd... | mit | c85337e8ab66fede0d2db2df0aec8f38 | 37.645669 | 97 | 0.632233 | 3.939005 | false | true | false | false |
theonion/django-bulbs | bulbs/contributions/tasks.py | 1 | 1228 | """celery tasks for contributions."""
from celery import shared_task
from bulbs.content.models import Content
from .models import Contribution, FreelanceProfile
@shared_task(default_retry_delay=5)
def check_and_update_freelanceprofiles(content_id):
content = Content.objects.get(id=content_id)
for author in c... | mit | dac6fa361e6dc0c02f4fc31adbbff24e | 33.111111 | 82 | 0.735342 | 3.439776 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.